diff --git a/.all-contributorsrc b/.all-contributorsrc index 3223dd887fc0..83cf734ca4ed 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -58,6 +58,13 @@ "profile": "https://github.com/G-Rath", "contributions": [] }, + { + "login": "JoshuaKGoldberg", + "name": "Josh Goldberg", + "avatar_url": "https://avatars.githubusercontent.com/u/3335181?v=4", + "profile": "https://github.com/JoshuaKGoldberg", + "contributions": [] + }, { "login": "nzakas", "name": "Nicholas C. Zakas", @@ -73,10 +80,10 @@ "contributions": [] }, { - "login": "JoshuaKGoldberg", - "name": "Josh Goldberg", - "avatar_url": "https://avatars.githubusercontent.com/u/3335181?v=4", - "profile": "https://github.com/JoshuaKGoldberg", + "login": "yeonjuan", + "name": "YeonJuan", + "avatar_url": "https://avatars.githubusercontent.com/u/41323220?v=4", + "profile": "https://github.com/yeonjuan", "contributions": [] }, { @@ -87,10 +94,10 @@ "contributions": [] }, { - "login": "yeonjuan", - "name": "YeonJuan", - "avatar_url": "https://avatars.githubusercontent.com/u/41323220?v=4", - "profile": "https://github.com/yeonjuan", + "login": "phaux", + "name": "Nikita Stefaniak", + "avatar_url": "https://avatars.githubusercontent.com/u/1270987?v=4", + "profile": "https://github.com/phaux", "contributions": [] }, { @@ -135,13 +142,6 @@ "profile": "https://github.com/mysticatea", "contributions": [] }, - { - "login": "phaux", - "name": "Nikita Stefaniak", - "avatar_url": "https://avatars.githubusercontent.com/u/1270987?v=4", - "profile": "https://github.com/phaux", - "contributions": [] - }, { "login": "azz", "name": "Lucas Azzola", @@ -170,6 +170,13 @@ "profile": "https://github.com/macklinu", "contributions": [] }, + { + "login": "JounQin", + "name": "JounQin", + "avatar_url": "https://avatars.githubusercontent.com/u/8336744?v=4", + "profile": "https://github.com/JounQin", + "contributions": [] + }, { "login": "lukyth", "name": "Kanitkorn Sujautra", @@ -207,7 +214,7 @@ }, { "login": "ldrick", - "name": "Ricky Lippmann", + "name": "ldrick", "avatar_url": "https://avatars.githubusercontent.com/u/3674067?v=4", "profile": "https://github.com/ldrick", "contributions": [] @@ -352,6 +359,20 @@ "profile": "https://github.com/timkraut", "contributions": [] }, + { + "login": "magurotuna", + "name": "Yusuke Tanaka", + "avatar_url": "https://avatars.githubusercontent.com/u/23649474?v=4", + "profile": "https://github.com/magurotuna", + "contributions": [] + }, + { + "login": "Zzzen", + "name": "Zzzen", + "avatar_url": "https://avatars.githubusercontent.com/u/6630042?v=4", + "profile": "https://github.com/Zzzen", + "contributions": [] + }, { "login": "koooge", "name": "koooge", @@ -379,6 +400,13 @@ "avatar_url": "https://avatars.githubusercontent.com/u/16860535?v=4", "profile": "https://github.com/soobing", "contributions": [] + }, + { + "login": "RebeccaStevens", + "name": "Rebecca Stevens", + "avatar_url": "https://avatars.githubusercontent.com/u/7224206?v=4", + "profile": "https://github.com/RebeccaStevens", + "contributions": [] } ], "contributorsPerLine": 5 diff --git a/.cspell.json b/.cspell.json index c74d69186b91..c4de52f54328 100644 --- a/.cspell.json +++ b/.cspell.json @@ -47,6 +47,7 @@ "bigint", "bivariant", "blockless", + "camelcase", "codebases", "Codecov", "contravariant", diff --git a/.eslintignore b/.eslintignore index 3c9816ccb5cc..255b369df6b0 100644 --- a/.eslintignore +++ b/.eslintignore @@ -7,3 +7,6 @@ coverage __snapshots__ packages/eslint-plugin-tslint/tests + +# Files copied as part of the build +packages/types/src/ast-spec.ts diff --git a/.eslintrc.js b/.eslintrc.js index 562b6855f75a..afe9b3b78d93 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -7,6 +7,7 @@ module.exports = { 'import', 'eslint-comments', '@typescript-eslint/internal', + 'simple-import-sort', ], env: { es6: true, @@ -21,12 +22,13 @@ module.exports = { sourceType: 'module', project: [ './tsconfig.eslint.json', - './tests/integration/utils/jsconfig.json', './packages/*/tsconfig.json', + './tests/integration/tsconfig.json', ], + allowAutomaticSingleRunInference: true, tsconfigRootDir: __dirname, warnOnUnsupportedTypeScriptVersion: false, - EXPERIMENTAL_useSourceOfProjectReferenceRedirect: true, + EXPERIMENTAL_useSourceOfProjectReferenceRedirect: false, }, rules: { // @@ -57,19 +59,21 @@ module.exports = { '@typescript-eslint/prefer-optional-chain': 'error', '@typescript-eslint/unbound-method': 'off', '@typescript-eslint/prefer-as-const': 'error', + '@typescript-eslint/restrict-template-expressions': [ + 'error', + { + allowNumber: true, + allowBoolean: true, + allowAny: true, + allowNullish: true, + allowRegExp: true, + }, + ], '@typescript-eslint/no-unused-vars': [ 'warn', { varsIgnorePattern: '^_', argsIgnorePattern: '^_' }, ], - // TODO - enable these new recommended rules - '@typescript-eslint/no-floating-promises': 'off', - '@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', - '@typescript-eslint/restrict-plus-operands': 'off', - '@typescript-eslint/restrict-template-expressions': 'off', // TODO - enable this '@typescript-eslint/naming-convention': 'off', @@ -82,13 +86,17 @@ module.exports = { '@typescript-eslint/internal/prefer-ast-types-enum': 'error', // - // eslint base + // eslint-base // curly: ['error', 'all'], 'no-mixed-operators': 'error', 'no-console': 'error', 'no-process-exit': 'error', + 'no-fallthrough': [ + 'warn', + { commentPattern: '.*intentional fallthrough.*' }, + ], // // eslint-plugin-eslint-comment @@ -162,14 +170,23 @@ module.exports = { // all test files { files: [ - 'packages/*/tests/**/*.test.ts', 'packages/*/tests/**/*.spec.ts', + 'packages/*/tests/**/*.test.ts', + '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', ], env: { 'jest/globals': true, }, rules: { + '@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/no-identical-tests': 'error', 'jest/no-disabled-tests': 'warn', 'jest/no-focused-tests': 'error', @@ -180,8 +197,7 @@ module.exports = { 'jest/no-test-prefixes': 'error', 'jest/no-done-callback': 'error', 'jest/no-test-return-statement': 'error', - 'jest/prefer-to-be-null': 'warn', - 'jest/prefer-to-be-undefined': 'warn', + 'jest/prefer-to-be': 'warn', 'jest/prefer-to-contain': 'warn', 'jest/prefer-to-have-length': 'warn', 'jest/prefer-spy-on': 'error', @@ -189,6 +205,17 @@ module.exports = { 'jest/no-deprecated-functions': 'error', }, }, + // test utility scripts + { + files: ['tests/**/*.js'], + rules: { + '@typescript-eslint/explicit-function-return-type': 'off', + '@typescript-eslint/no-unsafe-call': 'off', + '@typescript-eslint/no-unsafe-member-access': 'off', + '@typescript-eslint/no-unsafe-return': 'off', + '@typescript-eslint/restrict-plus-operands': 'off', + }, + }, // plugin source files { files: [ @@ -255,5 +282,27 @@ module.exports = { '@typescript-eslint/internal/prefer-ast-types-enum': 'off', }, }, + // ast spec specific standardization + { + files: ['packages/ast-spec/src/**/*.ts'], + rules: { + '@typescript-eslint/consistent-type-imports': [ + 'error', + { prefer: 'type-imports', disallowTypeAnnotations: true }, + ], + '@typescript-eslint/no-unused-vars': 'error', + '@typescript-eslint/sort-type-union-intersection-members': 'error', + 'import/first': 'error', + 'import/newline-after-import': 'error', + 'import/no-duplicates': 'error', + 'simple-import-sort/imports': 'error', + }, + }, + { + files: ['rollup.config.ts'], + rules: { + 'import/no-default-export': 'off', + }, + }, ], }; diff --git a/.gitattributes b/.gitattributes index 73968f2a6144..d46a42b7fc44 100644 --- a/.gitattributes +++ b/.gitattributes @@ -5,3 +5,6 @@ *.ts eol=lf *.tsx eol=lf *.yml eol=lf + +# force github to treat out custom jest snapshot extension as normal jest snapshots +*.shot linguist-language=Jest-Snapshot diff --git a/.github/ISSUE_TEMPLATE/eslint-plugin-typescript.yml b/.github/ISSUE_TEMPLATE/eslint-plugin-typescript.yml new file mode 100644 index 000000000000..36ab5d7985f9 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/eslint-plugin-typescript.yml @@ -0,0 +1,41 @@ +name: Rule proposal +description: "Propose a new rule for the '@typescript-eslint/eslint-plugin' package" +title: "Rule proposal: " +labels: + - "enhancement: new base rule extension" + - "package: eslint-plugin" + - triage +body: + - type: markdown + attributes: + value: | + Before opening a new issue: + - Look for existing [open or closed rule proposals](https://github.com/typescript-eslint/typescript-eslint/issues?q=label%3A%22enhancement%3A+new+base+rule+extension%22) + - Look for [existing rules](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin) + - Ensure that the rule you want to propose is related to types. If not, consider looking into [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn) + - type: textarea + validations: + required: true + attributes: + label: Description + description: Explain here why this rule would be beneficial + - type: textarea + validations: + required: true + attributes: + label: Fail + description: Specify an example of code that should be detected + value: | + ```ts + var replace = 'me'; + ``` + - type: textarea + validations: + required: true + attributes: + label: Pass + description: Specify an example of code that would be accepted in its place + value: | + ```ts + const replace = 'me'; + ``` diff --git a/.github/PULL_REQUEST_TEMPLATE/standard.md b/.github/PULL_REQUEST_TEMPLATE/standard.md deleted file mode 100644 index fb7952bc7689..000000000000 --- a/.github/PULL_REQUEST_TEMPLATE/standard.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -name: 'Standard' -about: Standard Pull Request Template -title: '' -labels: '' -assignees: '' ---- - - diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 000000000000..a93f9eea9143 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,14 @@ + + +## PR Checklist + +- [ ] Addresses an existing issue: fixes #000 +- [ ] That issue was marked as [accepting prs](https://github.com/typescript-eslint/typescript-eslint/issues?q=is%3Aopen+is%3Aissue+label%3A%22accepting+prs%22) +- [ ] Steps in [CONTRIBUTING.md](https://github.com/typescript-eslint/typescript-eslint/blob/master/CONTRIBUTING.md) were taken + +## Overview + + diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0986c2df8f6c..3e25c8d3eab0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,14 +4,17 @@ on: push: branches: - master - # TODO - delete this before merging v4 into master - - v4 + - v5 pull_request: branches: - '**' env: PRIMARY_NODE_VERSION: 12 + NX_BRANCH: ${{ github.event.number }} + NX_RUN_GROUP: ${{ github.run_id }} + # Added the - at the end to function as a separator to improve readability in the PR comment from the Nx cloud app + NX_CLOUD_ENV_NAME: 'Node 12.x -' jobs: typecheck: @@ -32,7 +35,7 @@ jobs: id: yarn-cache-dir-path run: echo "::set-output name=dir::$(yarn cache dir)" - - uses: actions/cache@v1 + - uses: actions/cache@v2 id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) with: path: ${{ steps.yarn-cache-dir-path.outputs.dir }} @@ -43,8 +46,7 @@ jobs: - name: Install dependencies run: | yarn --ignore-engines --frozen-lockfile --ignore-scripts - yarn lerna:init - yarn check:clean-workspace-after-install + yarn check-clean-workspace-after-install - name: Build run: | @@ -75,7 +77,7 @@ jobs: id: yarn-cache-dir-path run: echo "::set-output name=dir::$(yarn cache dir)" - - uses: actions/cache@v1 + - uses: actions/cache@v2 id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) with: path: ${{ steps.yarn-cache-dir-path.outputs.dir }} @@ -86,58 +88,49 @@ jobs: - name: Install dependencies run: | yarn --ignore-engines --frozen-lockfile --ignore-scripts - yarn lerna:init - yarn check:clean-workspace-after-install + yarn check-clean-workspace-after-install - name: Build run: | yarn build - name: Run unit tests for typescript-estree - run: yarn test - working-directory: packages/typescript-estree + run: npx nx test @typescript-eslint/typescript-estree env: CI: true - name: Run unit tests for visitor-keys - run: yarn test - working-directory: packages/visitor-keys + run: npx nx test @typescript-eslint/visitor-keys env: CI: true - name: Run unit tests for scope-manager - run: yarn test - working-directory: packages/scope-manager + run: npx nx test @typescript-eslint/scope-manager env: CI: true - name: Run unit tests for experimental-utils - run: yarn test - working-directory: packages/experimental-utils + run: npx nx test @typescript-eslint/experimental-utils env: CI: true - name: Run unit tests for parser - run: yarn test - working-directory: packages/parser + run: npx nx test @typescript-eslint/parser env: CI: true - name: Run unit tests for eslint-plugin - run: yarn test - working-directory: packages/eslint-plugin + run: npx nx test @typescript-eslint/eslint-plugin env: CI: true - name: Run unit tests for eslint-plugin-tslint - run: yarn test - working-directory: packages/eslint-plugin-tslint + run: npx nx test @typescript-eslint/eslint-plugin-tslint env: CI: true - name: Run unit tests for eslint-plugin-internal - run: yarn test - working-directory: packages/eslint-plugin-internal + run: npx nx test @typescript-eslint/eslint-plugin-internal env: CI: true @@ -162,7 +155,7 @@ jobs: id: yarn-cache-dir-path run: echo "::set-output name=dir::$(yarn cache dir)" - - uses: actions/cache@v1 + - uses: actions/cache@v2 id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) with: path: ${{ steps.yarn-cache-dir-path.outputs.dir }} @@ -173,24 +166,23 @@ jobs: - name: Install dependencies run: | yarn --ignore-engines --frozen-lockfile --ignore-scripts - yarn lerna:init - yarn check:clean-workspace-after-install + yarn check-clean-workspace-after-install - name: Build run: | yarn build - name: Check code formatting - run: yarn check:format + run: yarn check-format - name: Lint code run: yarn lint - name: Lint markdown - run: yarn lint:markdown + run: yarn lint-markdown - name: Check spelling - run: yarn check:spelling + run: yarn check-spelling integration_tests: name: Run integration tests on primary Node.js version @@ -206,7 +198,7 @@ jobs: id: yarn-cache-dir-path run: echo "::set-output name=dir::$(yarn cache dir)" - - uses: actions/cache@v1 + - uses: actions/cache@v2 id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) with: path: ${{ steps.yarn-cache-dir-path.outputs.dir }} @@ -217,15 +209,14 @@ jobs: - name: Install dependencies run: | yarn --ignore-engines --frozen-lockfile --ignore-scripts - yarn lerna:init - yarn check:clean-workspace-after-install + yarn check-clean-workspace-after-install - name: Build run: | yarn build - name: Run integrations tests - run: yarn test:integration + run: yarn test-integration env: CI: true @@ -234,7 +225,10 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: [10.x, 14.x] + node-version: [12.x, 14.x, 16.x] + env: + # Added the - at the end to function as a separator to improve readability in the PR comment from the Nx cloud app + NX_CLOUD_ENV_NAME: 'Node ${{ matrix.node-version }} -' steps: - uses: actions/checkout@v2 - name: Use Node.js ${{ matrix.node-version }} @@ -246,7 +240,7 @@ jobs: id: yarn-cache-dir-path run: echo "::set-output name=dir::$(yarn cache dir)" - - uses: actions/cache@v1 + - uses: actions/cache@v2 id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) with: path: ${{ steps.yarn-cache-dir-path.outputs.dir }} @@ -257,52 +251,44 @@ jobs: - name: Install dependencies run: | yarn --ignore-engines --frozen-lockfile --ignore-scripts - yarn lerna:init - yarn check:clean-workspace-after-install + yarn check-clean-workspace-after-install - name: Build run: | yarn build - name: Run unit tests for typescript-estree - run: yarn test - working-directory: packages/typescript-estree + run: npx nx test @typescript-eslint/typescript-estree env: CI: true - name: Run unit tests for visitor-keys - run: yarn test - working-directory: packages/visitor-keys + run: npx nx test @typescript-eslint/visitor-keys env: CI: true - name: Run unit tests for scope-manager - run: yarn test - working-directory: packages/scope-manager + run: npx nx test @typescript-eslint/scope-manager env: CI: true - name: Run unit tests for experimental-utils - run: yarn test - working-directory: packages/experimental-utils + run: npx nx test @typescript-eslint/experimental-utils env: CI: true - name: Run unit tests for parser - run: yarn test - working-directory: packages/parser + run: npx nx test @typescript-eslint/parser env: CI: true - name: Run unit tests for eslint-plugin - run: yarn test - working-directory: packages/eslint-plugin + run: npx nx test @typescript-eslint/eslint-plugin env: CI: true - name: Run unit tests for eslint-plugin-tslint - run: yarn test - working-directory: packages/eslint-plugin-tslint + run: npx nx test @typescript-eslint/eslint-plugin-tslint env: CI: true @@ -311,8 +297,15 @@ jobs: publish_canary_version: name: Publish the latest code as a canary version runs-on: ubuntu-latest - needs: [typecheck, test_on_primary_node_version, unit_tests_on_other_node_versions, linting_and_style, integration_tests] - if: github.ref == 'refs/heads/master' + needs: + [ + typecheck, + test_on_primary_node_version, + unit_tests_on_other_node_versions, + linting_and_style, + integration_tests, + ] + if: github.repository == 'typescript-eslint/typescript-eslint' && github.ref == 'refs/heads/master' steps: - uses: actions/checkout@v2 # Fetch all history for all tags and branches in this job because lerna needs it @@ -329,7 +322,7 @@ jobs: id: yarn-cache-dir-path run: echo "::set-output name=dir::$(yarn cache dir)" - - uses: actions/cache@v1 + - uses: actions/cache@v2 id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) with: path: ${{ steps.yarn-cache-dir-path.outputs.dir }} @@ -340,8 +333,7 @@ jobs: - name: Install dependencies run: | yarn --ignore-engines --frozen-lockfile --ignore-scripts - yarn lerna:init - yarn check:clean-workspace-after-install + yarn check-clean-workspace-after-install - name: Build run: | diff --git a/.github/workflows/generate-contributors.yml b/.github/workflows/generate-contributors.yml new file mode 100644 index 000000000000..c1d29f1fda2a --- /dev/null +++ b/.github/workflows/generate-contributors.yml @@ -0,0 +1,50 @@ +name: "Generate contributors" + +on: + schedule: + - cron: "0 0 1 * *" + +env: + PRIMARY_NODE_VERSION: 12 + +jobs: + generate-contributors: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Use Node.js ${{ env.PRIMARY_NODE_VERSION }} + uses: actions/setup-node@v2 + with: + node-version: ${{ env.PRIMARY_NODE_VERSION }} + + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" + + - uses: actions/cache@v2 + id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + - name: Install dependencies + run: | + yarn --ignore-engines --frozen-lockfile --ignore-scripts + + - name: Generate contributors + run: yarn generate-contributors + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v3 + with: + # The standard GITHUB_TOKEN cannot be used as it will not trigger status checks on + # the PR that gets created (this behavior is not specific to this action). + # https://github.com/peter-evans/create-pull-request/blob/master/docs/concepts-guidelines.md#triggering-further-workflow-runs + token: ${{ secrets.JAMES_HENRY_GH_TOKEN }} + commit-message: "chore: update contributors" + title: "chore: update contributors" + body: "" + branch: auto-update-contributors diff --git a/.github/workflows/manual-release.yml b/.github/workflows/manual-release.yml deleted file mode 100644 index 4f75c3b438e7..000000000000 --- a/.github/workflows/manual-release.yml +++ /dev/null @@ -1,66 +0,0 @@ -# This workflow is used on the rare occassion we need to manually cut a release. -# It can be triggered via the Github UI or the Github API. - -name: Manual publish to Github Releases and NPM - -on: - workflow_dispatch: - -jobs: - release: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - # Check out as an admin to allow for pushing back to master - token: ${{ secrets.JAMES_HENRY_GH_TOKEN }} - # Check out the branch that was specified as part of the trigger - ref: ${{ github.ref }} - # We need to fetch all tags and branches - fetch-depth: 0 - - - name: Verify head of master hasn't changed - run: | - # We ensure that the latest commit on master is still the one we expected when - # we started the release job, otherwise we exit - if [ "$GITHUB_SHA" != "$(git rev-parse --verify HEAD)" ]; then - echo "ERROR: The commit SHA at the HEAD of master has changed" - echo "Expected: $GITHUB_SHA" - echo "Actual: $(git rev-parse --verify HEAD)" - exit 1; - fi - - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - - uses: actions/cache@v2 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - - name: Install dependencies - run: | - yarn --ignore-engines --frozen-lockfile --ignore-scripts - yarn lerna:init - yarn check:clean-workspace-after-install - - - name: Run build - run: | - yarn build - - - name: Determine what version to release and publish to Github (--yes skips the confirmation prompt) - run: | - # Required for github release to work - git config user.name 'James Henry' - git config user.email 'james@henry.sc' - - GH_TOKEN=${{ secrets.JAMES_HENRY_GH_TOKEN }} npx lerna version --loglevel=silly --yes --conventional-commits --exact --force-publish --github-release -m "chore: publish %s" - - - name: Publish the updated versions to NPM (--yes skips the confirmation prompt) - run: npx lerna publish from-package --yes - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.gitignore b/.gitignore index b7d08022ef73..95ec54effa37 100644 --- a/.gitignore +++ b/.gitignore @@ -67,3 +67,7 @@ dist _ts3.4 *.tsbuildinfo .watchmanconfig +.rollup.cache + +# Files copied as part of the build +packages/types/src/ast-spec.ts diff --git a/.huskyrc b/.huskyrc deleted file mode 100644 index 687c2614bf8a..000000000000 --- a/.huskyrc +++ /dev/null @@ -1,7 +0,0 @@ -{ - "hooks": { - "pre-commit": "yarn pre-commit", - "pre-push": "yarn pre-push", - "commit-msg": "commitlint -E HUSKY_GIT_PARAMS" - } -} diff --git a/.markdownlint.json b/.markdownlint.json index 9dc1aa860029..a83e9dad63c1 100644 --- a/.markdownlint.json +++ b/.markdownlint.json @@ -92,7 +92,13 @@ "MD043": false, // MD044/proper-names - Proper names should have the correct capitalization "MD044": { - "names": ["JavaScript", "TypeScript", "TSLint", "ESLint"], + "names": [ + "JavaScript", + "TypeScript", + "TSLint", + "ESLint", + "typescript-eslint" + ], "code_blocks": false }, // MD045/no-alt-text - Images should have alternate text (alt text) diff --git a/.prettierrc.json b/.prettierrc.json index 2fdcda48cf47..dc08f70238b0 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -2,7 +2,7 @@ "arrowParens": "avoid", "bracketSpacing": true, "endOfLine": "lf", - "jsxBracketSameLine": false, + "bracketSameLine": false, "jsxSingleQuote": false, "printWidth": 80, "proseWrap": "preserve", diff --git a/.vscode/settings.json b/.vscode/settings.json index 20830a2fa0b8..f0677068d037 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -13,8 +13,8 @@ // typescript auto-format settings "typescript.tsdk": "node_modules/typescript/lib", - "javascript.preferences.importModuleSpecifier": "auto", - "typescript.preferences.importModuleSpecifier": "auto", + "javascript.preferences.importModuleSpecifier": "project-relative", + "typescript.preferences.importModuleSpecifier": "project-relative", "javascript.preferences.quoteStyle": "single", "typescript.preferences.quoteStyle": "single", "editor.defaultFormatter": "esbenp.prettier-vscode", diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b47e3099906..b1186a12eb8a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,535 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.2.0...v5.3.0) (2021-11-01) + + +### Bug Fixes + +* **eslint-plugin:** ignore private identifiers in explicit-module-boundary-types ([#4046](https://github.com/typescript-eslint/typescript-eslint/issues/4046)) ([80b853d](https://github.com/typescript-eslint/typescript-eslint/commit/80b853db90ae3d4e32c4b7ec9d45a5c41dc459c9)) +* **eslint-plugin:** skip seenTypes for unions in isTypeReadonly ([#4043](https://github.com/typescript-eslint/typescript-eslint/issues/4043)) ([6af7ca7](https://github.com/typescript-eslint/typescript-eslint/commit/6af7ca7d9fde230342d27ad5a75a09a58c022974)) +* **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 + +* **eslint-plugin:** [no-shadow] exclude external type declaration merging ([#3959](https://github.com/typescript-eslint/typescript-eslint/issues/3959)) ([a93cebf](https://github.com/typescript-eslint/typescript-eslint/commit/a93cebfc0f2026c50972bcb110bcd3295ba9a44d)) +* **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) + + +### Bug Fixes + +* **eslint-plugin:** [typedef] fix regression with class properties ([#4034](https://github.com/typescript-eslint/typescript-eslint/issues/4034)) ([fe53d22](https://github.com/typescript-eslint/typescript-eslint/commit/fe53d22f57ad418397fb31fa89c97db0ab4cd6c0)), closes [#4033](https://github.com/typescript-eslint/typescript-eslint/issues/4033) + + +### Features + +* **eslint-plugin:** adding `consistent-type-exports` rule ([#3936](https://github.com/typescript-eslint/typescript-eslint/issues/3936)) ([1971a3f](https://github.com/typescript-eslint/typescript-eslint/commit/1971a3f8027416cd1fb33b1d50faa035599917de)) + + + + + +# [5.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.0.0...v5.1.0) (2021-10-18) + + +### Bug Fixes + +* **eslint-plugin:** [no-restricted-imports]: report type-only imports properly ([#3996](https://github.com/typescript-eslint/typescript-eslint/issues/3996)) ([283cdf2](https://github.com/typescript-eslint/typescript-eslint/commit/283cdf26e6b32985531ff6416cd13ef4cb0a3c8c)) +* **eslint-plugin:** [strict-bool-expr] treat unconstrained generic as any ([#3981](https://github.com/typescript-eslint/typescript-eslint/issues/3981)) ([9b29ca7](https://github.com/typescript-eslint/typescript-eslint/commit/9b29ca751f496c25240c0c14b8fa432bf4443d39)) +* **typescript-estree:** support private optional property definition ([#3997](https://github.com/typescript-eslint/typescript-eslint/issues/3997)) ([8605e08](https://github.com/typescript-eslint/typescript-eslint/commit/8605e080a4dac4a277e6108cd9ed1e5a707302fa)) + + +### 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 + +* **eslint-plugin:** [explicit-member-accessibility] report `TSAbstractPropertyDefinition` and `TSAbstractMethodDefinition` properly ([#3901](https://github.com/typescript-eslint/typescript-eslint/issues/3901)) ([82016f9](https://github.com/typescript-eslint/typescript-eslint/commit/82016f99b14825c9c60e1f7eb3b4efcc492bba86)) +* **eslint-plugin:** update new rules from master ([#3840](https://github.com/typescript-eslint/typescript-eslint/issues/3840)) ([d88a6b4](https://github.com/typescript-eslint/typescript-eslint/commit/d88a6b44eedcf9dd59569160570aa118851aa86b)) +* update new rules from master ([b34fb7e](https://github.com/typescript-eslint/typescript-eslint/commit/b34fb7eb3102ea603bb4aef0dbbf9885b3d47557)) +* **eslint-plugin:** crash in no-dupe-class-members (v5) ([#3813](https://github.com/typescript-eslint/typescript-eslint/issues/3813)) ([4b09644](https://github.com/typescript-eslint/typescript-eslint/commit/4b096442f731c0a60926ac0391a4f2c4208aa8d4)) +* **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)) +* **typescript-estree:** change `source` of ExportNamedDeclaration to Literal from Expression ([#3763](https://github.com/typescript-eslint/typescript-eslint/issues/3763)) ([dc5a0f5](https://github.com/typescript-eslint/typescript-eslint/commit/dc5a0f5104b400f4422b8d67ecfc6cc7a32613a2)) + + +### 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)) +* **eslint-plugin:** remove `object` from `ban-types`' default types ([#3818](https://github.com/typescript-eslint/typescript-eslint/issues/3818)) ([ae3fa90](https://github.com/typescript-eslint/typescript-eslint/commit/ae3fa900d5b4e1f557a52ca58d35a7d098d9efaf)) +* **eslint-plugin:** removed value from abstract property nodes ([#3765](https://github.com/typescript-eslint/typescript-eslint/issues/3765)) ([5823524](https://github.com/typescript-eslint/typescript-eslint/commit/58235241714596b641a1e8b39c569e561e0039b4)), closes [#3748](https://github.com/typescript-eslint/typescript-eslint/issues/3748) +* **eslint-plugin:** update recommended configs ([#3809](https://github.com/typescript-eslint/typescript-eslint/issues/3809)) ([deeb7bb](https://github.com/typescript-eslint/typescript-eslint/commit/deeb7bb9334d301c6af56aefd37d318231af11ef)) +* 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 `PrivateIdentifier` ([#3808](https://github.com/typescript-eslint/typescript-eslint/issues/3808)) ([0eefe5e](https://github.com/typescript-eslint/typescript-eslint/commit/0eefe5e49d21af3f1e3e2d9a90c2e49929863ac2)), closes [#3430](https://github.com/typescript-eslint/typescript-eslint/issues/3430) [#2933](https://github.com/typescript-eslint/typescript-eslint/issues/2933) +* **eslint-plugin:** [comma-dangle] align schema with ESLint v8 ([#3768](https://github.com/typescript-eslint/typescript-eslint/issues/3768)) ([0acfafc](https://github.com/typescript-eslint/typescript-eslint/commit/0acfafcc655e28dcfc05a5caa567c0d0217ee7ad)) +* **eslint-plugin:** [member-ordering] add support for getters and setters ([#3611](https://github.com/typescript-eslint/typescript-eslint/issues/3611)) ([e264124](https://github.com/typescript-eslint/typescript-eslint/commit/e2641246571b69df36cde5cb7bce7c4fffc43f98)) +* **eslint-plugin:** remove `no-unused-vars-experimental` ([79ae03b](https://github.com/typescript-eslint/typescript-eslint/commit/79ae03b8adbae2b0a86276711a9c834af01bbb61)) +* **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)) +* **typescript-estree:** remove legacy `useJSXTextNode` option ([#3109](https://github.com/typescript-eslint/typescript-eslint/issues/3109)) ([5b84b98](https://github.com/typescript-eslint/typescript-eslint/commit/5b84b98fb3cf68d944b7d4e970f39f4e88f0b2d5)) +* 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:** 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)) + + +### BREAKING CHANGES + +* **eslint-plugin:** `ban-types` no longer reports `object` by default + + + + + +# [4.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.32.0...v4.33.0) (2021-10-04) + + +### Bug Fixes + +* **eslint-plugin:** [lines-between-class-members] fix `exceptAfterOverload` for abstract methods ([#3943](https://github.com/typescript-eslint/typescript-eslint/issues/3943)) ([240fc65](https://github.com/typescript-eslint/typescript-eslint/commit/240fc65c307769eae9b35e611fca74ba4c35a025)) +* **eslint-plugin:** [no-confusing-void-expression] support optional chaining ([#3937](https://github.com/typescript-eslint/typescript-eslint/issues/3937)) ([c40dd13](https://github.com/typescript-eslint/typescript-eslint/commit/c40dd13df76b77052c85254622df5533307dc07e)) +* **eslint-plugin:** [no-restricted-imports] fix crash when no options given ([#3947](https://github.com/typescript-eslint/typescript-eslint/issues/3947)) ([edaa3c1](https://github.com/typescript-eslint/typescript-eslint/commit/edaa3c10eb67bb89f9c6a78bd1ed593925c33f16)) +* **eslint-plugin:** [non-nullable-type-assertion-style] false-positive with non-nullish `as` assertions and types ([#3940](https://github.com/typescript-eslint/typescript-eslint/issues/3940)) ([40760f9](https://github.com/typescript-eslint/typescript-eslint/commit/40760f98da0d23c7bce3da04cf37a56c10447bde)) +* **eslint-plugin:** [padding-line-between-statements] TSModuleBlock should change scope ([#3944](https://github.com/typescript-eslint/typescript-eslint/issues/3944)) ([f8f534e](https://github.com/typescript-eslint/typescript-eslint/commit/f8f534e42b0ec517274442422c37ab019cf3c200)) +* **eslint-plugin:** [prefer-regexp-exec] check `RegExp` without flags ([#3946](https://github.com/typescript-eslint/typescript-eslint/issues/3946)) ([0868725](https://github.com/typescript-eslint/typescript-eslint/commit/0868725713e8102e8932303d4c680340688e1fa9)) +* **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 + +* **eslint-plugin:** [consistent-type-definitions] correct fix for `export default` ([#3899](https://github.com/typescript-eslint/typescript-eslint/issues/3899)) ([ebb33ed](https://github.com/typescript-eslint/typescript-eslint/commit/ebb33ed8bc29f69ca2a657ec5b31857c0aeb4b56)) +* **eslint-plugin:** [no-require-imports] report only global `require` ([#3871](https://github.com/typescript-eslint/typescript-eslint/issues/3871)) ([8aa87a1](https://github.com/typescript-eslint/typescript-eslint/commit/8aa87a136e7cd7b40fbf09fcfa26bf04d1c6d5fe)) +* **eslint-plugin:** [no-shadow] ignore type-only imports properly ([#3868](https://github.com/typescript-eslint/typescript-eslint/issues/3868)) ([dda9cee](https://github.com/typescript-eslint/typescript-eslint/commit/dda9cee68a5cd78b358a854027999c739ac623e9)) +* **eslint-plugin:** [no-var-requires] report problems within `NewExpression` ([#3884](https://github.com/typescript-eslint/typescript-eslint/issues/3884)) ([ed5e459](https://github.com/typescript-eslint/typescript-eslint/commit/ed5e45983fa052accf3a7b5fcdbfcb15ed09490f)) +* **eslint-plugin:** [padding-line-between-statements] problems within namespaces not being reported ([#3869](https://github.com/typescript-eslint/typescript-eslint/issues/3869)) ([1861356](https://github.com/typescript-eslint/typescript-eslint/commit/186135698b40b510ffff6a2402aa34f2726596ea)) +* **eslint-plugin:** [prefer-regexp-exec] respect flags when using `RegExp` ([#3855](https://github.com/typescript-eslint/typescript-eslint/issues/3855)) ([ffdb5ff](https://github.com/typescript-eslint/typescript-eslint/commit/ffdb5ff9900e07374a2f3686447e3e2c78fbc38a)) +* **eslint-plugin:** [prefer-return-this-type] handle generics properly in fixer ([#3852](https://github.com/typescript-eslint/typescript-eslint/issues/3852)) ([9e98b8f](https://github.com/typescript-eslint/typescript-eslint/commit/9e98b8f43ca6aadc9758a4e9a0d1d3c250af6cca)) +* **eslint-plugin:** false-positive/negative with array index in no-unnecessary-condition ([#3805](https://github.com/typescript-eslint/typescript-eslint/issues/3805)) ([bdb8f0b](https://github.com/typescript-eslint/typescript-eslint/commit/bdb8f0be1466e4a4b713e91199be91030650ed01)) +* **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)) + + +### Features + +* **eslint-plugin:** [no-type-alias]: add allowGenerics option ([#3865](https://github.com/typescript-eslint/typescript-eslint/issues/3865)) ([4195919](https://github.com/typescript-eslint/typescript-eslint/commit/41959199735a6d4fe3ae7825f3087e8fb249be9f)) +* **eslint-plugin:** add `no-non-null-asserted-nullish-coalescing` rule ([#3349](https://github.com/typescript-eslint/typescript-eslint/issues/3349)) ([4e99961](https://github.com/typescript-eslint/typescript-eslint/commit/4e999614e9761f6dc7e5aa0c5bad76ab164ab3fb)) +* **eslint-plugin:** add new extended rule `no-restricted-imports` ([#3775](https://github.com/typescript-eslint/typescript-eslint/issues/3775)) ([ec5d506](https://github.com/typescript-eslint/typescript-eslint/commit/ec5d50696b249a207d322e4a2fc66582122eb010)) +* **eslint-plugin-internal:** [prefer-ast-types-enum] add `DefinitionType` enum ([#3916](https://github.com/typescript-eslint/typescript-eslint/issues/3916)) ([13b7de5](https://github.com/typescript-eslint/typescript-eslint/commit/13b7de508e0f8eac492879ff9ab99acd8d3e977e)) +* Support `'latest'` as `ecmaVersion` ([#3873](https://github.com/typescript-eslint/typescript-eslint/issues/3873)) ([25a42c0](https://github.com/typescript-eslint/typescript-eslint/commit/25a42c0bbe92d1ecbc2e8ff9ef3a3ef413f728b0)) + + + + + +## [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/typescript-eslint + + + + + +## [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/typescript-eslint + + + + + +# [4.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.30.0...v4.31.0) (2021-09-06) + + +### Bug Fixes + +* **ast-spec:** remove duplicate union types from `Expression` ([#3770](https://github.com/typescript-eslint/typescript-eslint/issues/3770)) ([463e768](https://github.com/typescript-eslint/typescript-eslint/commit/463e768978731d019345f6552d7fd7a073a80192)) +* **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 + +* **eslint-plugin:** [prefer-readonly-parameter-types] add option treatMethodsAsReadonly ([#3733](https://github.com/typescript-eslint/typescript-eslint/issues/3733)) ([a46e318](https://github.com/typescript-eslint/typescript-eslint/commit/a46e3182c8a0b07c914605d6d9fe28ef36a7c32a)) +* **eslint-plugin:** [restrict-template-expressions] add option to allow RegExp ([#3709](https://github.com/typescript-eslint/typescript-eslint/issues/3709)) ([363b3dc](https://github.com/typescript-eslint/typescript-eslint/commit/363b3dc4dd0dc343311c729d75935b10f9d2fd5e)) +* **eslint-plugin:** add `no-meaningless-void-operator` rule ([#3641](https://github.com/typescript-eslint/typescript-eslint/issues/3641)) ([ea40ab6](https://github.com/typescript-eslint/typescript-eslint/commit/ea40ab659351ae7cf7235ea063d42ac155b11e5f)) +* **eslint-plugin:** add extension rule `padding-line-between-statements` ([#3418](https://github.com/typescript-eslint/typescript-eslint/issues/3418)) ([f79ae9b](https://github.com/typescript-eslint/typescript-eslint/commit/f79ae9b58e82f4fddef640a34a1d7ff92b763e65)) +* **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) + + +### Bug Fixes + +* **eslint-plugin:** [dot-notation] false positive with optional chaining ([#3711](https://github.com/typescript-eslint/typescript-eslint/issues/3711)) ([c19fc6e](https://github.com/typescript-eslint/typescript-eslint/commit/c19fc6e03072ed549bc9b35ebe6961e10f8f9b43)), closes [#3510](https://github.com/typescript-eslint/typescript-eslint/issues/3510) +* **eslint-plugin:** [prefer-reduce-type-parameter] handle already existing type params ([#3706](https://github.com/typescript-eslint/typescript-eslint/issues/3706)) ([71dd273](https://github.com/typescript-eslint/typescript-eslint/commit/71dd27361a1bc93b5d5eb2279d805922b10002fd)) +* **eslint-plugin:** isTypeReadonly error with With the exception of extremely minor documentation typos, **only send pull requests that resolve open issues**. + Anyone is free to help us build and maintain this project. If you see an issue that needs working on because it's important to you, comment on the issue to help make sure that nobody else works on it at the same time, and then start working. Developing in this repo is easy: @@ -55,12 +57,12 @@ We have a sophisticated CI process setup which gets run on every PR. You must pa - Coverage reports should automatically be generated locally, and the `codecov` bot should also comment on your PR with the percentage, as well as links to the line-by-line coverage of each file touched by your PR. - Ensure you have no lint errors. - You can run `yarn lint` in any package or in the root. - - You can run `yarn lint:markdown` in the root. + - You can run `yarn lint-markdown` in the root. - If you have made changes to any markdown documentation, ensure there are no spelling errors - - You can run `yarn check:spelling` in the root. + - You can run `yarn check-spelling` in the root. - Or if you are using vscode, you can use [`Code Spell Checker`](https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker) plugin. - If you have made changes within the `eslint-plugin` package, ensure the configs and documentation are valid. - - You can run `yarn check:configs` and `yarn check:docs` in the root, or in the `eslint-plugin` folder. + - You can run `yarn check-configs` and `yarn check-docs` in the root, or in the `eslint-plugin` folder. ### Raising a PR diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 5616c037282c..0a2e0963cfcc 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -16,75 +16,81 @@ Thanks goes to these wonderful people ([emoji key](https://github.com/all-contri
Patricio Trevino


Gareth Jones

+
Josh Goldberg


Nicholas C. Zakas


Jed Fox

-
Josh Goldberg

-
Ben Lichtman


YeonJuan

+
Ben Lichtman

+
Nikita Stefaniak


Scott O'Hara


Retsam

-
Sosuke Suzuki

+
Sosuke Suzuki


Kai Cataldo


Rasmus Eneman


Toru Nagashima

-
Nikita Stefaniak


Lucas Azzola


Danny Fritz


Ika


mackie

+
JounQin


Kanitkorn Sujautra

-
cherryblossom000

+
cherryblossom000


Simen Bekkhus


Anix


Pete Gonzalez

-
Ricky Lippmann

-
Susisu

+
ldrick

+
Susisu


G r e y


Gavin Barron


Kevin Partington


Lucas Duailibe

-
Validark

+
Validark


Pavel Birukov


Shahar Dawn Or


ulrichb


Daniil Dubrava

-
Daniel Nixon

+
Daniel Nixon


Denys Kniazevych


Dimitri Mitropoulos


Ian MacLeod


Jonathan Delgado

-
Philipp A.

+
Philipp A.


Pig Fang


Tadhg McDonald-Jensen


Thomas den Hollander


Tim Kraut

-
koooge

+
Yusuke Tanaka

+
Zzzen

+
koooge


thomas michael wallace


Bence Dányi

+ +
Soobin Bak

+ This list is auto-generated using `yarn generate-contributors`. It shows the top 100 contributors with > 3 contributions. diff --git a/README.md b/README.md index e44cd7102461..2443ba50a162 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ - [How does `typescript-eslint` work and why do you have multiple packages?](#how-does-typescript-eslint-work-and-why-do-you-have-multiple-packages) - [Can I use all of the existing ESLint plugins and rules without any changes?](#can-i-use-all-of-the-existing-eslint-plugins-and-rules-without-any-changes) - [Can we write rules which leverage type information?](#can-we-write-rules-which-leverage-type-information) -- [What about Babel and `babel-eslint`?](#what-about-babel-and-babel-eslint) +- [What about Babel and `@babel/eslint-parser`?](#what-about-babel-and-babeleslint-parser) - [How can I help?](#how-can-i-help) - [Packages included in this project?](#packages-included-in-this-project) - [Package Versions](#package-versions) @@ -161,15 +161,15 @@ We already do this in numerous rules within [`@typescript-eslint/eslint-plugin`]
-## What about Babel and `babel-eslint`? +## What about Babel and `@babel/eslint-parser`? Babel does now support parsing (but not type-checking) TypeScript source code. This is as an alternative to using the TypeScript Compiler. It also supports many other syntaxes, via plugins, which are not supported by the TypeScript Compiler. As mentioned above, `typescript-eslint` is powered by the TypeScript Compiler, so we support whatever it does. -The key trade-off can be summarized as `babel-eslint` supports additional syntax which TypeScript itself does not, but `typescript-eslint` supports creating rules based on type information, which is not available to babel because there is no type-checker. +The key trade-off can be summarized as `@babel/eslint-parser` supports additional syntax which TypeScript itself does not, but `typescript-eslint` supports creating rules based on type information, which is not available to babel because there is no type-checker. Because they are separate projects powered by different underlying tooling, they are currently not intended to be used together. -Some of the people involved in `typescript-eslint` are also involved in Babel and `babel-eslint`, and in this project, we are working hard to align on the AST format for non-standard JavaScript syntax. This is an ongoing effort. +Some of the people involved in `typescript-eslint` are also involved in Babel and `@babel/eslint-parser`, and in this project, we are working hard to align on the AST format for non-standard JavaScript syntax. This is an ongoing effort.
@@ -233,7 +233,7 @@ The latest version under the `canary` tag **(latest commit to master)** is: ## Supported TypeScript Version -**The version range of TypeScript currently supported by this parser is `>=3.3.1 <4.3.0`.** +**The version range of TypeScript currently supported by this parser is `>=3.3.1 <4.5.0`.** These versions are what we test against. diff --git a/lerna.json b/lerna.json index df984d35e16c..0247b06e8869 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "4.16.1", + "version": "5.3.0", "npmClient": "yarn", "useWorkspaces": true, "stream": true diff --git a/nx.json b/nx.json new file mode 100644 index 000000000000..ec90f4a1f5c2 --- /dev/null +++ b/nx.json @@ -0,0 +1,36 @@ +{ + "npmScope": "typescript-eslint", + "implicitDependencies": { + "package.json": { + "dependencies": "*", + "devDependencies": "*" + }, + ".github/workflows/ci.yml": "*" + }, + "affected": { + "defaultBase": "master" + }, + "workspaceLayout": { + "libsDir": "packages" + }, + "tasksRunnerOptions": { + "default": { + "runner": "@nrwl/nx-cloud", + "options": { + "cacheableOperations": ["build", "test", "package", "prepare"], + "accessToken": "YjFjNTBhOWUtY2JmNy00ZDhiLWE5N2UtZjliNDAwNmIzOTdjfHJlYWQtd3JpdGU=", + "canTrackAnalytics": false, + "showUsageWarnings": true, + "runtimeCacheInputs": ["node -v"] + } + } + }, + "targetDependencies": { + "build": [ + { + "target": "build", + "projects": "dependencies" + } + ] + } +} diff --git a/package.json b/package.json index a7a9b8fc318c..3fcacac8fda6 100644 --- a/package.json +++ b/package.json @@ -17,28 +17,27 @@ "url": "https://github.com/typescript-eslint/typescript-eslint/issues" }, "scripts": { - "build": "lerna run build", - "check:clean-workspace-after-install": "git diff --quiet --exit-code", - "check:configs": "lerna run check:configs", - "check:docs": "lerna run check:docs", - "check:format": "prettier --list-different \"./**/*.{ts,js,json,md}\"", - "check:spelling": "cspell --config=.cspell.json \"**/*.{md,ts,js}\"", + "build": "npx nx prebuild @typescript-eslint/types && nx run-many --target=build --all --parallel", + "check-clean-workspace-after-install": "git diff --quiet --exit-code", + "check-configs": "nx run-many --target=check-configs --all --parallel", + "check-docs": "nx run-many --target=check-docs --all --parallel", + "check-format": "prettier --list-different \"./**/*.{ts,js,json,md}\"", + "check-spelling": "cspell --config=.cspell.json \"**/*.{md,ts,js}\"", "clean": "lerna clean && lerna run clean", "cz": "git-cz", "format": "prettier --write \"./**/*.{ts,js,json,md}\"", - "generate:contributors": "yarn ts-node --transpile-only ./tools/generate-contributors.ts && yarn all-contributors generate", - "lerna:init": "lerna bootstrap --ignore-scripts && lerna link --force-local", - "lint:fix": "eslint . --ext .js,.ts --fix", - "lint:markdown:fix": "yarn lint:markdown --fix", - "lint:markdown": "markdownlint \"**/*.md\" --config=.markdownlint.json --ignore-path=.markdownlintignore", + "generate-contributors": "yarn ts-node --transpile-only ./tools/generate-contributors.ts && yarn all-contributors generate", + "lint-fix": "eslint . --ext .js,.ts --fix", + "lint-markdown-fix": "yarn lint-markdown --fix", + "lint-markdown": "markdownlint \"**/*.md\" --config=.markdownlint.json --ignore-path=.markdownlintignore", "lint": "eslint . --ext .js,.ts", - "postinstall": "yarn husky install && yarn lerna:init && yarn build", + "postinstall": "yarn husky install && yarn build", "pre-commit": "yarn lint-staged", - "pre-push": "yarn check:format", - "test": "lerna run test --concurrency 1", - "test:integration": "./tests/integration/run-all-tests.sh", - "test:kill-integration-containers": "docker-compose -f tests/integration/docker-compose.yml down -v --rmi local", - "typecheck": "lerna run typecheck" + "pre-push": "yarn check-format", + "test": "nx run-many --target=test --all --parallel", + "test-integration": "yarn jest -c ./tests/integration/jest.config.js", + "test-kill-integration-containers": "docker-compose -f tests/integration/docker-compose.yml down -v --rmi local", + "typecheck": "nx run-many --target=typecheck --all --parallel" }, "config": { "commitizen": { @@ -69,52 +68,66 @@ } }, "engines": { - "node": "^10.12.0 || >=12.0.0" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "devDependencies": { - "@commitlint/cli": "^11.0.0", - "@commitlint/config-conventional": "^11.0.0", - "@commitlint/config-lerna-scopes": "^11.0.0", - "@types/babel__code-frame": "^7.0.2", - "@types/debug": "^4.1.5", + "@babel/code-frame": "^7.14.5", + "@babel/parser": "^7.15.7", + "@babel/types": "^7.15.6", + "@commitlint/cli": "^13.1.0", + "@commitlint/config-conventional": "^13.1.0", + "@commitlint/config-lerna-scopes": "^13.1.0", + "@nrwl/cli": "13.0.2", + "@nrwl/nx-cloud": "12.5.1", + "@nrwl/tao": "13.0.2", + "@nrwl/workspace": "13.0.2", + "@types/babel__code-frame": "^7.0.3", + "@types/debug": "^4.1.7", "@types/eslint-visitor-keys": "^1.0.0", - "@types/glob": "^7.1.3", - "@types/is-glob": "^4.0.1", - "@types/jest": "^26.0.20", + "@types/glob": "^7.2.0", + "@types/is-glob": "^4.0.2", + "@types/jest": "^27.0.2", "@types/jest-specific-snapshot": "^0.5.5", - "@types/lodash": "^4.14.149", - "@types/marked": "^1.1.0", - "@types/node": "^14.14.27", - "@types/prettier": "^2.2.1", - "@types/rimraf": "^3.0.0", - "@types/semver": "^7.3.4", - "@types/tmp": "^0.2.0", + "@types/lodash": "^4.14.176", + "@types/marked": "^3.0.2", + "@types/ncp": "^2.0.5", + "@types/node": "^16.11.4", + "@types/prettier": "^2.3.2", + "@types/rimraf": "^3.0.2", + "@types/semver": "^7.3.9", + "@types/tmp": "^0.2.2", "all-contributors-cli": "^6.20.0", - "cspell": "^5.2.4", + "cspell": "^5.12.3", "cz-conventional-changelog": "^3.3.0", "downlevel-dts": "^0.7.0", - "eslint": "^7.20.0", + "enhanced-resolve": "^5.8.3", + "eslint": "^8.1.0", "eslint-plugin-eslint-comments": "^3.2.0", - "eslint-plugin-eslint-plugin": "^2.3.0", - "eslint-plugin-import": "^2.22.0", - "eslint-plugin-jest": "^24.1.3", - "glob": "^7.1.6", - "husky": "^5.0.9", - "isomorphic-fetch": "^3.0.0", - "jest": "^26.6.3", - "jest-specific-snapshot": "^4.0.0", + "eslint-plugin-eslint-plugin": "^4.0.1", + "eslint-plugin-import": "^2.25.2", + "eslint-plugin-jest": "^25.0.5", + "eslint-plugin-simple-import-sort": "^7.0.0", + "glob": "^7.1.7", + "husky": "^7.0.4", + "jest": "^27.3.1", + "jest-specific-snapshot": "^5.0.0", "lerna": "^3.22.1", - "lint-staged": "^10.2.13", + "lint-staged": "^11.1.2", "make-dir": "^3.1.0", - "markdownlint-cli": "^0.26.0", - "prettier": "^2.2.1", + "markdownlint-cli": "^0.29.0", + "ncp": "^2.0.0", + "node-fetch": "^3.0.0", + "prettier": "2.4.1", + "pretty-format": "^27.3.1", "rimraf": "^3.0.2", - "ts-jest": "^26.5.1", - "ts-node": "^9.0.0", + "tmp": "^0.2.1", + "ts-jest": "^27.0.5", + "ts-node": "^10.4.0", "tslint": "^6.1.3", - "typescript": ">=3.3.1 <4.3.0" + "typescript": ">=3.3.1 <4.5.0" }, "resolutions": { - "typescript": "4.2.2" + "@types/node": "^16.11.4", + "typescript": "4.4.4" } } diff --git a/packages/ast-spec/CHANGELOG.md b/packages/ast-spec/CHANGELOG.md new file mode 100644 index 000000000000..9a0a4f4869a6 --- /dev/null +++ b/packages/ast-spec/CHANGELOG.md @@ -0,0 +1,251 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +# [5.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.2.0...v5.3.0) (2021-11-01) + +**Note:** Version bump only for package @typescript-eslint/ast-spec + + + + + +# [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/ast-spec + + + + + +# [5.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.0.0...v5.1.0) (2021-10-18) + +**Note:** Version bump only for package @typescript-eslint/ast-spec + + + + + +# [5.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.33.0...v5.0.0) (2021-10-11) + + +### Bug Fixes + +* **typescript-estree:** change `source` of ExportNamedDeclaration to Literal from Expression ([#3763](https://github.com/typescript-eslint/typescript-eslint/issues/3763)) ([dc5a0f5](https://github.com/typescript-eslint/typescript-eslint/commit/dc5a0f5104b400f4422b8d67ecfc6cc7a32613a2)) + + +### 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 `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 `PrivateIdentifier` ([#3808](https://github.com/typescript-eslint/typescript-eslint/issues/3808)) ([0eefe5e](https://github.com/typescript-eslint/typescript-eslint/commit/0eefe5e49d21af3f1e3e2d9a90c2e49929863ac2)), closes [#3430](https://github.com/typescript-eslint/typescript-eslint/issues/3430) [#2933](https://github.com/typescript-eslint/typescript-eslint/issues/2933) +* **eslint-plugin:** removed value from abstract property nodes ([#3765](https://github.com/typescript-eslint/typescript-eslint/issues/3765)) ([5823524](https://github.com/typescript-eslint/typescript-eslint/commit/58235241714596b641a1e8b39c569e561e0039b4)), closes [#3748](https://github.com/typescript-eslint/typescript-eslint/issues/3748) + + + + + +# [4.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.32.0...v4.33.0) (2021-10-04) + +**Note:** Version bump only for package @typescript-eslint/ast-spec + + + + + +# [4.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.2...v4.32.0) (2021-09-27) + +**Note:** Version bump only for package @typescript-eslint/ast-spec + + + + + +## [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/ast-spec + + + + + +## [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/ast-spec + + + + + +# [4.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.30.0...v4.31.0) (2021-09-06) + + +### Bug Fixes + +* **ast-spec:** remove duplicate union types from `Expression` ([#3770](https://github.com/typescript-eslint/typescript-eslint/issues/3770)) ([463e768](https://github.com/typescript-eslint/typescript-eslint/commit/463e768978731d019345f6552d7fd7a073a80192)) + + +### Features + +* **eslint-plugin:** add extension rule `padding-line-between-statements` ([#3418](https://github.com/typescript-eslint/typescript-eslint/issues/3418)) ([f79ae9b](https://github.com/typescript-eslint/typescript-eslint/commit/f79ae9b58e82f4fddef640a34a1d7ff92b763e65)) + + + + + +# [4.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.3...v4.30.0) (2021-08-30) + + +### Features + +* **typescript-estree:** add support for class static blocks ([#3730](https://github.com/typescript-eslint/typescript-eslint/issues/3730)) ([f81831b](https://github.com/typescript-eslint/typescript-eslint/commit/f81831bd279a32da6dbab0f1c061053ea43965f6)) + + + + + +## [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/ast-spec + + + + + +## [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/ast-spec + + + + + +## [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/ast-spec + + + + + +# [4.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.5...v4.29.0) (2021-08-02) + + +### Features + +* **ast-spec:** extract `ExportKind` & `ImportKind` ([#3564](https://github.com/typescript-eslint/typescript-eslint/issues/3564)) ([120d566](https://github.com/typescript-eslint/typescript-eslint/commit/120d566c980c61d3823fbe8b2db30d76b8c31140)) +* **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/ast-spec + + + + + +## [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/ast-spec + + + + + +## [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/ast-spec + + + + + +## [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/ast-spec + + + + + +## [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/ast-spec + + + + + +# [4.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.27.0...v4.28.0) (2021-06-21) + +**Note:** Version bump only for package @typescript-eslint/ast-spec + + + + + +# [4.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.1...v4.27.0) (2021-06-14) + + +### Bug Fixes + +* **typescript-estree:** support override modifier for parameter property ([#3485](https://github.com/typescript-eslint/typescript-eslint/issues/3485)) ([33b9f69](https://github.com/typescript-eslint/typescript-eslint/commit/33b9f69a681cd3219a2acca5b0b2fa67609f099e)) + + +### Features + +* **ast-spec:** specify `LogicalExpression`'s `operator` type ([#3497](https://github.com/typescript-eslint/typescript-eslint/issues/3497)) ([9e343fd](https://github.com/typescript-eslint/typescript-eslint/commit/9e343fdaa0b04ed007b873c781e8cc98fc1fb7f5)) +* **ast-spec:** specify `PunctuatorToken`'s `value` type ([#3496](https://github.com/typescript-eslint/typescript-eslint/issues/3496)) ([fdb1d81](https://github.com/typescript-eslint/typescript-eslint/commit/fdb1d81f0fcf75a9216e6a90469f18c24c91f718)) + + + + + +## [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/ast-spec + + + + + +# [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/ast-spec + + + + + +# [4.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.24.0...v4.25.0) (2021-05-24) + + +### Features + +* **typescript-estree:** [TS4.3] support overrides on class members ([#3429](https://github.com/typescript-eslint/typescript-eslint/issues/3429)) ([21d1b62](https://github.com/typescript-eslint/typescript-eslint/commit/21d1b62a0b84b502d2cf12674b3d141994a3ffd4)) +* **typescript-estree:** add support for getter/setter signatures on types ([#3427](https://github.com/typescript-eslint/typescript-eslint/issues/3427)) ([b830b7f](https://github.com/typescript-eslint/typescript-eslint/commit/b830b7f4e8a99affc8af8b53cb83371ef81d7032)), closes [#3272](https://github.com/typescript-eslint/typescript-eslint/issues/3272) [#3272](https://github.com/typescript-eslint/typescript-eslint/issues/3272) + + + + + +# [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/ast-spec + + + + + +# [4.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.1...v4.23.0) (2021-05-10) + + +### Features + +* 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)) diff --git a/packages/ast-spec/LICENSE b/packages/ast-spec/LICENSE new file mode 100644 index 000000000000..7e7370143b26 --- /dev/null +++ b/packages/ast-spec/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 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 +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/ast-spec/README.md b/packages/ast-spec/README.md new file mode 100644 index 000000000000..7c954398395b --- /dev/null +++ b/packages/ast-spec/README.md @@ -0,0 +1,24 @@ +

TypeScript-ESTree AST Specification

+ +

+ CI + NPM Version + NPM Downloads +

+ +This is the complete specification for the TypeScript-ESTree AST. + +It includes: + +- Node definitions as TypeScript types (the specification) +- Logic for converting from the TypeScript AST to the TypeScript-ESTree AST. +- Tests/Fixtures/Examples for each Node + +**You probably don't want to use it directly.** + +If you're building an ESLint plugin, consider using [`@typescript-eslint/experimental-utils`](../experimental-utils). +If you're parsing TypeScript code, consider using [`@typescript-eslint/typescript-estree`](../typescript-estree). + +## Contributing + +[See the contributing guide here](../../CONTRIBUTING.md) diff --git a/packages/ast-spec/api-extractor.json b/packages/ast-spec/api-extractor.json new file mode 100644 index 000000000000..f474f3bf26fd --- /dev/null +++ b/packages/ast-spec/api-extractor.json @@ -0,0 +1,31 @@ +{ + "mainEntryPointFilePath": "/dist/index.d.ts", + "apiReport": { + "enabled": false + }, + "docModel": { + "enabled": false + }, + "dtsRollup": { + "enabled": true, + "untrimmedFilePath": "/dist/ast-spec.ts" + }, + "tsdocMetadata": { + "enabled": false + }, + "messages": { + "extractorMessageReporting": { + "default": { + "logLevel": "none" + }, + "ae-forgotten-export": { + "logLevel": "none" + } + }, + "tsdocMessageReporting": { + "default": { + "logLevel": "none" + } + } + } +} diff --git a/packages/ast-spec/jest.config.js b/packages/ast-spec/jest.config.js new file mode 100644 index 000000000000..c23ca67fbc68 --- /dev/null +++ b/packages/ast-spec/jest.config.js @@ -0,0 +1,20 @@ +'use strict'; + +// @ts-check +/** @type {import('@jest/types').Config.InitialOptions} */ +module.exports = { + globals: { + 'ts-jest': { + isolatedModules: true, + }, + }, + testEnvironment: 'node', + transform: { + ['^.+\\.tsx?$']: 'ts-jest', + }, + testRegex: ['./tests/.+\\.test\\.ts$'], + collectCoverage: false, + collectCoverageFrom: ['src/**/*.{js,jsx,ts,tsx}'], + moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], + coverageReporters: ['text-summary', 'lcov'], +}; diff --git a/packages/ast-spec/package.json b/packages/ast-spec/package.json new file mode 100644 index 000000000000..905a4eec05e5 --- /dev/null +++ b/packages/ast-spec/package.json @@ -0,0 +1,47 @@ +{ + "name": "@typescript-eslint/ast-spec", + "version": "5.3.0", + "description": "TypeScript-ESTree AST spec", + "private": true, + "keywords": [ + "eslint", + "typescript", + "estree" + ], + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "files": [ + "dist", + "package.json", + "README.md", + "LICENSE" + ], + "repository": { + "type": "git", + "url": "https://github.com/typescript-eslint/typescript-eslint.git", + "directory": "packages/ast-spec" + }, + "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 && api-extractor run --local", + "clean": "tsc -b tsconfig.build.json --clean", + "postclean": "rimraf dist && rimraf _ts3.4 && rimraf .rollup.cache && rimraf coverage", + "format": "prettier --write \"./**/*.{ts,js,json,md}\" --ignore-path ../../.prettierignore", + "lint": "eslint . --ext .js,.ts --ignore-path='../../.eslintignore'", + "typecheck": "tsc -p tsconfig.json --noEmit" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "devDependencies": { + "@microsoft/api-extractor": "^7.18.16", + "typescript": "*" + } +} diff --git a/packages/ast-spec/project.json b/packages/ast-spec/project.json new file mode 100644 index 000000000000..3cb2cf7be65b --- /dev/null +++ b/packages/ast-spec/project.json @@ -0,0 +1,5 @@ +{ + "root": "packages/ast-spec", + "type": "library", + "implicitDependencies": [] +} diff --git a/packages/types/src/ast-node-types.ts b/packages/ast-spec/src/ast-node-types.ts similarity index 86% rename from packages/types/src/ast-node-types.ts rename to packages/ast-spec/src/ast-node-types.ts index f233d60f8aeb..c5ee4a189df4 100644 --- a/packages/types/src/ast-node-types.ts +++ b/packages/ast-spec/src/ast-node-types.ts @@ -1,4 +1,4 @@ -enum AST_NODE_TYPES { +export enum AST_NODE_TYPES { ArrayExpression = 'ArrayExpression', ArrayPattern = 'ArrayPattern', ArrowFunctionExpression = 'ArrowFunctionExpression', @@ -14,7 +14,6 @@ enum AST_NODE_TYPES { ClassBody = 'ClassBody', ClassDeclaration = 'ClassDeclaration', ClassExpression = 'ClassExpression', - ClassProperty = 'ClassProperty', ConditionalExpression = 'ConditionalExpression', ContinueStatement = 'ContinueStatement', DebuggerStatement = 'DebuggerStatement', @@ -62,12 +61,15 @@ enum AST_NODE_TYPES { NewExpression = 'NewExpression', ObjectExpression = 'ObjectExpression', ObjectPattern = 'ObjectPattern', + PrivateIdentifier = 'PrivateIdentifier', Program = 'Program', Property = 'Property', + PropertyDefinition = 'PropertyDefinition', RestElement = 'RestElement', ReturnStatement = 'ReturnStatement', SequenceExpression = 'SequenceExpression', SpreadElement = 'SpreadElement', + StaticBlock = 'StaticBlock', Super = 'Super', SwitchCase = 'SwitchCase', SwitchStatement = 'SwitchStatement', @@ -87,9 +89,9 @@ enum AST_NODE_TYPES { /** * TS-prefixed nodes */ - TSAbstractClassProperty = 'TSAbstractClassProperty', TSAbstractKeyword = 'TSAbstractKeyword', TSAbstractMethodDefinition = 'TSAbstractMethodDefinition', + TSAbstractPropertyDefinition = 'TSAbstractPropertyDefinition', TSAnyKeyword = 'TSAnyKeyword', TSArrayType = 'TSArrayType', TSAsExpression = 'TSAsExpression', @@ -134,7 +136,6 @@ enum AST_NODE_TYPES { TSObjectKeyword = 'TSObjectKeyword', TSOptionalType = 'TSOptionalType', TSParameterProperty = 'TSParameterProperty', - TSParenthesizedType = 'TSParenthesizedType', TSPrivateKeyword = 'TSPrivateKeyword', TSPropertySignature = 'TSPropertySignature', TSProtectedKeyword = 'TSProtectedKeyword', @@ -164,23 +165,3 @@ enum AST_NODE_TYPES { TSUnknownKeyword = 'TSUnknownKeyword', TSVoidKeyword = 'TSVoidKeyword', } - -export { AST_NODE_TYPES }; - -// Below is a special type-only test which ensures that we don't accidentally leave unused keys in this enum -// eslint-disable-next-line import/first -- purposely down here to colocate it with this hack of a test -import type { Node } from './ts-estree'; - -type GetKeys = keyof Extract; - -type AllKeys = { - readonly [T in AST_NODE_TYPES]: GetKeys; -}; - -type TakesString> = T; - -// @ts-expect-error: purposely unused -type _Test = - // forcing the test onto a new line so it isn't covered by the expect error - // If there are any enum members that don't have a corresponding TSESTree.Node, then this line will error with "Type 'string | number | symbol' is not assignable to type 'string'." - void | TakesString; diff --git a/packages/types/src/ast-token-types.ts b/packages/ast-spec/src/ast-token-types.ts similarity index 87% rename from packages/types/src/ast-token-types.ts rename to packages/ast-spec/src/ast-token-types.ts index 144befece83e..f839d8dfae59 100644 --- a/packages/types/src/ast-token-types.ts +++ b/packages/ast-spec/src/ast-token-types.ts @@ -1,4 +1,4 @@ -enum AST_TOKEN_TYPES { +export enum AST_TOKEN_TYPES { Boolean = 'Boolean', Identifier = 'Identifier', JSXIdentifier = 'JSXIdentifier', @@ -15,5 +15,3 @@ enum AST_TOKEN_TYPES { Block = 'Block', Line = 'Line', } - -export { AST_TOKEN_TYPES }; diff --git a/packages/ast-spec/src/base/Accessibility.ts b/packages/ast-spec/src/base/Accessibility.ts new file mode 100644 index 000000000000..d52942f43ab2 --- /dev/null +++ b/packages/ast-spec/src/base/Accessibility.ts @@ -0,0 +1 @@ +export type Accessibility = 'private' | 'protected' | 'public'; diff --git a/packages/ast-spec/src/base/BaseNode.ts b/packages/ast-spec/src/base/BaseNode.ts new file mode 100644 index 000000000000..797b3d351320 --- /dev/null +++ b/packages/ast-spec/src/base/BaseNode.ts @@ -0,0 +1,15 @@ +// import type { Node } from '../unions/Node'; +import type { AST_NODE_TYPES } from '../ast-node-types'; +import type { NodeOrTokenData } from './NodeOrTokenData'; + +export interface BaseNode extends NodeOrTokenData { + /** + * The parent node of the current node + * + * This is added in the @typescript-eslint/types package as ESLint adds it + * while traversing. + */ + // parent?: Node; + + type: AST_NODE_TYPES; +} diff --git a/packages/ast-spec/src/base/BaseToken.ts b/packages/ast-spec/src/base/BaseToken.ts new file mode 100644 index 000000000000..8780cfcb9695 --- /dev/null +++ b/packages/ast-spec/src/base/BaseToken.ts @@ -0,0 +1,10 @@ +import type { AST_TOKEN_TYPES } from '../ast-token-types'; +import type { NodeOrTokenData } from './NodeOrTokenData'; + +/* + * Token and Comment are pseudo-nodes to represent pieces of source code + */ +export interface BaseToken extends NodeOrTokenData { + type: AST_TOKEN_TYPES; + value: string; +} diff --git a/packages/ast-spec/src/base/BinaryExpressionBase.ts b/packages/ast-spec/src/base/BinaryExpressionBase.ts new file mode 100644 index 000000000000..926491d49855 --- /dev/null +++ b/packages/ast-spec/src/base/BinaryExpressionBase.ts @@ -0,0 +1,8 @@ +import type { Expression } from '../unions/Expression'; +import type { BaseNode } from './BaseNode'; + +export interface BinaryExpressionBase extends BaseNode { + operator: string; + left: Expression; + right: Expression; +} diff --git a/packages/ast-spec/src/base/ClassDeclarationBase.ts b/packages/ast-spec/src/base/ClassDeclarationBase.ts new file mode 100644 index 000000000000..f104b739b517 --- /dev/null +++ b/packages/ast-spec/src/base/ClassDeclarationBase.ts @@ -0,0 +1,20 @@ +import type { Identifier } from '../expression/Identifier/spec'; +import type { ClassBody } from '../special/ClassBody/spec'; +import type { Decorator } from '../special/Decorator/spec'; +import type { TSClassImplements } from '../special/TSClassImplements/spec'; +import type { TSTypeParameterDeclaration } from '../special/TSTypeParameterDeclaration/spec'; +import type { TSTypeParameterInstantiation } from '../special/TSTypeParameterInstantiation/spec'; +import type { LeftHandSideExpression } from '../unions/LeftHandSideExpression'; +import type { BaseNode } from './BaseNode'; + +export interface ClassDeclarationBase extends BaseNode { + typeParameters?: TSTypeParameterDeclaration; + superTypeParameters?: TSTypeParameterInstantiation; + id: Identifier | null; + body: ClassBody; + superClass: LeftHandSideExpression | null; + implements?: TSClassImplements[]; + abstract?: boolean; + declare?: boolean; + decorators?: Decorator[]; +} diff --git a/packages/ast-spec/src/base/FunctionDeclarationBase.ts b/packages/ast-spec/src/base/FunctionDeclarationBase.ts new file mode 100644 index 000000000000..50b7aa97bf2f --- /dev/null +++ b/packages/ast-spec/src/base/FunctionDeclarationBase.ts @@ -0,0 +1,18 @@ +import type { Identifier } from '../expression/Identifier/spec'; +import type { TSTypeAnnotation } from '../special/TSTypeAnnotation/spec'; +import type { TSTypeParameterDeclaration } from '../special/TSTypeParameterDeclaration/spec'; +import type { BlockStatement } from '../statement/BlockStatement/spec'; +import type { Parameter } from '../unions/Parameter'; +import type { BaseNode } from './BaseNode'; + +export interface FunctionDeclarationBase extends BaseNode { + id: Identifier | null; + generator: boolean; + expression: boolean; + async: boolean; + params: Parameter[]; + body?: BlockStatement | null; + returnType?: TSTypeAnnotation; + typeParameters?: TSTypeParameterDeclaration; + declare?: boolean; +} diff --git a/packages/ast-spec/src/base/LiteralBase.ts b/packages/ast-spec/src/base/LiteralBase.ts new file mode 100644 index 000000000000..c878fe7b7aa5 --- /dev/null +++ b/packages/ast-spec/src/base/LiteralBase.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../ast-node-types'; +import type { BaseNode } from './BaseNode'; + +export interface LiteralBase extends BaseNode { + type: AST_NODE_TYPES.Literal; + raw: string; + value: RegExp | bigint | boolean | number | string | null; +} diff --git a/packages/ast-spec/src/base/MethodDefinitionBase.ts b/packages/ast-spec/src/base/MethodDefinitionBase.ts new file mode 100644 index 000000000000..f1f2087ccae8 --- /dev/null +++ b/packages/ast-spec/src/base/MethodDefinitionBase.ts @@ -0,0 +1,43 @@ +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, + PropertyNameComputed, + PropertyNameNonComputed, +} from '../unions/PropertyName'; +import type { Accessibility } from './Accessibility'; +import type { BaseNode } from './BaseNode'; + +/** this should not be directly used - instead use MethodDefinitionComputedNameBase or MethodDefinitionNonComputedNameBase */ +interface MethodDefinitionBase extends BaseNode { + key: PropertyName; + value: FunctionExpression | TSEmptyBodyFunctionExpression; + computed: boolean; + static: boolean; + kind: 'constructor' | 'get' | 'method' | 'set'; + optional?: boolean; + decorators?: Decorator[]; + accessibility?: Accessibility; + typeParameters?: TSTypeParameterDeclaration; + override?: boolean; +} + +export interface MethodDefinitionComputedNameBase extends MethodDefinitionBase { + key: PropertyNameComputed; + computed: true; +} + +export interface MethodDefinitionNonComputedNameBase + extends MethodDefinitionBase { + key: PropertyNameNonComputed; + computed: false; +} + +export interface ClassMethodDefinitionNonComputedNameBase + extends MethodDefinitionBase { + key: ClassPropertyNameNonComputed; + computed: false; +} diff --git a/packages/ast-spec/src/base/NodeOrTokenData.ts b/packages/ast-spec/src/base/NodeOrTokenData.ts new file mode 100644 index 000000000000..013f96002fc4 --- /dev/null +++ b/packages/ast-spec/src/base/NodeOrTokenData.ts @@ -0,0 +1,20 @@ +import type { Range } from './Range'; +import type { SourceLocation } from './SourceLocation'; + +export interface NodeOrTokenData { + /** + * The source location information of the node. + * + * The loc property is defined as nullable by ESTree, but ESLint requires this property. + * + * @see {SourceLocation} + */ + loc: SourceLocation; + + /** + * @see {Range} + */ + range: Range; + + type: string; +} diff --git a/packages/ast-spec/src/base/OptionalRangeAndLoc.ts b/packages/ast-spec/src/base/OptionalRangeAndLoc.ts new file mode 100644 index 000000000000..d9b8cc9f874d --- /dev/null +++ b/packages/ast-spec/src/base/OptionalRangeAndLoc.ts @@ -0,0 +1,11 @@ +import type { Range } from './Range'; +import type { SourceLocation } from './SourceLocation'; + +// TODO - breaking change move this into `typescript-estree` +export type OptionalRangeAndLoc = Pick< + T, + Exclude +> & { + range?: Range; + loc?: SourceLocation; +}; diff --git a/packages/ast-spec/src/base/Position.ts b/packages/ast-spec/src/base/Position.ts new file mode 100644 index 000000000000..672fe5d5d4d0 --- /dev/null +++ b/packages/ast-spec/src/base/Position.ts @@ -0,0 +1,10 @@ +export interface Position { + /** + * Line number (1-indexed) + */ + line: number; + /** + * Column number on the line (0-indexed) + */ + column: number; +} diff --git a/packages/ast-spec/src/base/PropertyDefinitionBase.ts b/packages/ast-spec/src/base/PropertyDefinitionBase.ts new file mode 100644 index 000000000000..f1d5b9cc4402 --- /dev/null +++ b/packages/ast-spec/src/base/PropertyDefinitionBase.ts @@ -0,0 +1,44 @@ +import type { Decorator } from '../special/Decorator/spec'; +import type { TSTypeAnnotation } from '../special/TSTypeAnnotation/spec'; +import type { Expression } from '../unions/Expression'; +import type { + ClassPropertyNameNonComputed, + PropertyName, + PropertyNameComputed, + PropertyNameNonComputed, +} from '../unions/PropertyName'; +import type { Accessibility } from './Accessibility'; +import type { BaseNode } from './BaseNode'; + +interface PropertyDefinitionBase extends BaseNode { + key: PropertyName; + value: Expression | null; + computed: boolean; + static: boolean; + declare: boolean; + readonly?: boolean; + decorators?: Decorator[]; + accessibility?: Accessibility; + optional?: boolean; + definite?: boolean; + typeAnnotation?: TSTypeAnnotation; + override?: boolean; +} + +export interface PropertyDefinitionComputedNameBase + extends PropertyDefinitionBase { + key: PropertyNameComputed; + computed: true; +} + +export interface PropertyDefinitionNonComputedNameBase + extends PropertyDefinitionBase { + key: PropertyNameNonComputed; + computed: false; +} + +export interface ClassPropertyDefinitionNonComputedNameBase + extends PropertyDefinitionBase { + key: ClassPropertyNameNonComputed; + computed: false; +} diff --git a/packages/ast-spec/src/base/Range.ts b/packages/ast-spec/src/base/Range.ts new file mode 100644 index 000000000000..e78f71e3f747 --- /dev/null +++ b/packages/ast-spec/src/base/Range.ts @@ -0,0 +1,6 @@ +/** + * An array of two numbers. + * Both numbers are a 0-based index which is the position in the array of source code characters. + * The first is the start position of the node, the second is the end position of the node. + */ +export type Range = [number, number]; diff --git a/packages/ast-spec/src/base/SourceLocation.ts b/packages/ast-spec/src/base/SourceLocation.ts new file mode 100644 index 000000000000..67b5246fed5d --- /dev/null +++ b/packages/ast-spec/src/base/SourceLocation.ts @@ -0,0 +1,12 @@ +import type { Position } from './Position'; + +export interface SourceLocation { + /** + * The position of the first character of the parsed source region + */ + start: Position; + /** + * The position of the first character after the parsed source region + */ + end: Position; +} diff --git a/packages/ast-spec/src/base/TSFunctionSignatureBase.ts b/packages/ast-spec/src/base/TSFunctionSignatureBase.ts new file mode 100644 index 000000000000..0da1e7b414d6 --- /dev/null +++ b/packages/ast-spec/src/base/TSFunctionSignatureBase.ts @@ -0,0 +1,10 @@ +import type { TSTypeAnnotation } from '../special/TSTypeAnnotation/spec'; +import type { TSTypeParameterDeclaration } from '../special/TSTypeParameterDeclaration/spec'; +import type { Parameter } from '../unions/Parameter'; +import type { BaseNode } from './BaseNode'; + +export interface TSFunctionSignatureBase extends BaseNode { + params: Parameter[]; + returnType?: TSTypeAnnotation; + typeParameters?: TSTypeParameterDeclaration; +} diff --git a/packages/ast-spec/src/base/TSHeritageBase.ts b/packages/ast-spec/src/base/TSHeritageBase.ts new file mode 100644 index 000000000000..b3ed1770b674 --- /dev/null +++ b/packages/ast-spec/src/base/TSHeritageBase.ts @@ -0,0 +1,8 @@ +import type { TSTypeParameterInstantiation } from '../special/TSTypeParameterInstantiation/spec'; +import type { Expression } from '../unions/Expression'; +import type { BaseNode } from './BaseNode'; + +export interface TSHeritageBase extends BaseNode { + expression: Expression; + typeParameters?: TSTypeParameterInstantiation; +} diff --git a/packages/ast-spec/src/base/UnaryExpressionBase.ts b/packages/ast-spec/src/base/UnaryExpressionBase.ts new file mode 100644 index 000000000000..feb681ccbc3c --- /dev/null +++ b/packages/ast-spec/src/base/UnaryExpressionBase.ts @@ -0,0 +1,10 @@ +import type { UnaryExpression } from '../expression/UnaryExpression/spec'; +import type { LeftHandSideExpression } from '../unions/LeftHandSideExpression'; +import type { Literal } from '../unions/Literal'; +import type { BaseNode } from './BaseNode'; + +export interface UnaryExpressionBase extends BaseNode { + operator: string; + prefix: boolean; + argument: LeftHandSideExpression | Literal | UnaryExpression; +} diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/spec.ts b/packages/ast-spec/src/declaration/ClassDeclaration/spec.ts new file mode 100644 index 000000000000..2154b8863a02 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { ClassDeclarationBase } from '../../base/ClassDeclarationBase'; + +export interface ClassDeclaration extends ClassDeclarationBase { + type: AST_NODE_TYPES.ClassDeclaration; +} diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/spec.ts b/packages/ast-spec/src/declaration/ExportAllDeclaration/spec.ts new file mode 100644 index 000000000000..3b50c001f850 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/spec.ts @@ -0,0 +1,12 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Identifier } from '../../expression/Identifier/spec'; +import type { StringLiteral } from '../../expression/literal/StringLiteral/spec'; +import type { ExportKind } from '../ExportAndImportKind'; + +export interface ExportAllDeclaration extends BaseNode { + type: AST_NODE_TYPES.ExportAllDeclaration; + source: StringLiteral | null; + exportKind: ExportKind; + exported: Identifier | null; +} diff --git a/packages/ast-spec/src/declaration/ExportAndImportKind.ts b/packages/ast-spec/src/declaration/ExportAndImportKind.ts new file mode 100644 index 000000000000..e8d90b767981 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAndImportKind.ts @@ -0,0 +1,4 @@ +type ExportAndImportKind = 'type' | 'value'; + +export type ExportKind = ExportAndImportKind; +export type ImportKind = ExportAndImportKind; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/spec.ts b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/spec.ts new file mode 100644 index 000000000000..492d0981b8ca --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/spec.ts @@ -0,0 +1,11 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { ExportDeclaration } from '../../unions/ExportDeclaration'; +import type { Expression } from '../../unions/Expression'; +import type { ExportKind } from '../ExportAndImportKind'; + +export interface ExportDefaultDeclaration extends BaseNode { + type: AST_NODE_TYPES.ExportDefaultDeclaration; + declaration: ExportDeclaration | Expression; + exportKind: ExportKind; +} diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/spec.ts b/packages/ast-spec/src/declaration/ExportNamedDeclaration/spec.ts new file mode 100644 index 000000000000..b43471428094 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/spec.ts @@ -0,0 +1,14 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { StringLiteral } from '../../expression/literal/StringLiteral/spec'; +import type { ExportSpecifier } from '../../special/ExportSpecifier/spec'; +import type { ExportDeclaration } from '../../unions/ExportDeclaration'; +import type { ExportKind } from '../ExportAndImportKind'; + +export interface ExportNamedDeclaration extends BaseNode { + type: AST_NODE_TYPES.ExportNamedDeclaration; + declaration: ExportDeclaration | null; + specifiers: ExportSpecifier[]; + source: StringLiteral | null; + exportKind: ExportKind; +} diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/spec.ts b/packages/ast-spec/src/declaration/FunctionDeclaration/spec.ts new file mode 100644 index 000000000000..59d7c4ffe39d --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { FunctionDeclarationBase } from '../../base/FunctionDeclarationBase'; +import type { BlockStatement } from '../../statement/BlockStatement/spec'; + +export interface FunctionDeclaration extends FunctionDeclarationBase { + type: AST_NODE_TYPES.FunctionDeclaration; + body: BlockStatement; +} diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/spec.ts b/packages/ast-spec/src/declaration/ImportDeclaration/spec.ts new file mode 100644 index 000000000000..d9a11f6e3145 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/spec.ts @@ -0,0 +1,12 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { StringLiteral } from '../../expression/literal/StringLiteral/spec'; +import type { ImportClause } from '../../unions/ImportClause'; +import type { ImportKind } from '../ExportAndImportKind'; + +export interface ImportDeclaration extends BaseNode { + type: AST_NODE_TYPES.ImportDeclaration; + source: StringLiteral; + specifiers: ImportClause[]; + importKind: ImportKind; +} diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/spec.ts b/packages/ast-spec/src/declaration/TSDeclareFunction/spec.ts new file mode 100644 index 000000000000..88bd4aff2f21 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { FunctionDeclarationBase } from '../../base/FunctionDeclarationBase'; + +export interface TSDeclareFunction extends FunctionDeclarationBase { + type: AST_NODE_TYPES.TSDeclareFunction; +} diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/spec.ts b/packages/ast-spec/src/declaration/TSEnumDeclaration/spec.ts new file mode 100644 index 000000000000..1c1530d501ff --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/spec.ts @@ -0,0 +1,14 @@ +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; + id: Identifier; + members: TSEnumMember[]; + const?: boolean; + declare?: boolean; + modifiers?: Modifier[]; +} diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/spec.ts b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/spec.ts new file mode 100644 index 000000000000..5ccd9b6fc4fc --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/spec.ts @@ -0,0 +1,14 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Identifier } from '../../expression/Identifier/spec'; +import type { TSExternalModuleReference } from '../../special/TSExternalModuleReference/spec'; +import type { EntityName } from '../../unions/EntityName'; +import type { ImportKind } from '../ExportAndImportKind'; + +export interface TSImportEqualsDeclaration extends BaseNode { + type: AST_NODE_TYPES.TSImportEqualsDeclaration; + id: Identifier; + moduleReference: EntityName | TSExternalModuleReference; + importKind: ImportKind; + isExport: boolean; +} diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/spec.ts b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/spec.ts new file mode 100644 index 000000000000..1e95380c3cbb --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/spec.ts @@ -0,0 +1,17 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Identifier } from '../../expression/Identifier/spec'; +import type { TSInterfaceBody } from '../../special/TSInterfaceBody/spec'; +import type { TSInterfaceHeritage } from '../../special/TSInterfaceHeritage/spec'; +import type { TSTypeParameterDeclaration } from '../../special/TSTypeParameterDeclaration/spec'; + +export interface TSInterfaceDeclaration extends BaseNode { + type: AST_NODE_TYPES.TSInterfaceDeclaration; + body: TSInterfaceBody; + id: Identifier; + typeParameters?: TSTypeParameterDeclaration; + extends?: TSInterfaceHeritage[]; + implements?: TSInterfaceHeritage[]; + abstract?: boolean; + declare?: boolean; +} diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/spec.ts b/packages/ast-spec/src/declaration/TSModuleDeclaration/spec.ts new file mode 100644 index 000000000000..ac63e52a5938 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/spec.ts @@ -0,0 +1,26 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Identifier } from '../../expression/Identifier/spec'; +import type { TSModuleBlock } from '../../special/TSModuleBlock/spec'; +import type { Literal } from '../../unions/Literal'; +import type { Modifier } from '../../unions/Modifier'; + +export interface TSModuleDeclaration extends BaseNode { + type: AST_NODE_TYPES.TSModuleDeclaration; + id: Identifier | Literal; + body?: + | TSModuleBlock + /* + TODO - 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 + */ + | TSModuleDeclaration; + global?: boolean; + declare?: boolean; + modifiers?: Modifier[]; +} diff --git a/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/spec.ts b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/spec.ts new file mode 100644 index 000000000000..6853d4a28544 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Identifier } from '../../expression/Identifier/spec'; + +export interface TSNamespaceExportDeclaration extends BaseNode { + type: AST_NODE_TYPES.TSNamespaceExportDeclaration; + id: Identifier; +} diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/spec.ts b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/spec.ts new file mode 100644 index 000000000000..61ce986c2a23 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/spec.ts @@ -0,0 +1,13 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Identifier } from '../../expression/Identifier/spec'; +import type { TSTypeParameterDeclaration } from '../../special/TSTypeParameterDeclaration/spec'; +import type { TypeNode } from '../../unions/TypeNode'; + +export interface TSTypeAliasDeclaration extends BaseNode { + type: AST_NODE_TYPES.TSTypeAliasDeclaration; + id: Identifier; + typeAnnotation: TypeNode; + declare?: boolean; + typeParameters?: TSTypeParameterDeclaration; +} diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/spec.ts b/packages/ast-spec/src/declaration/VariableDeclaration/spec.ts new file mode 100644 index 000000000000..418a51eb735b --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/spec.ts @@ -0,0 +1,11 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { VariableDeclarator } from '../../special/VariableDeclarator/spec'; + +export interface VariableDeclaration extends BaseNode { + type: AST_NODE_TYPES.VariableDeclaration; + // NOTE - this is not guaranteed to have any elements in it. i.e. `const;` + declarations: VariableDeclarator[]; + kind: 'const' | 'let' | 'var'; + declare?: boolean; +} diff --git a/packages/ast-spec/src/declaration/spec.ts b/packages/ast-spec/src/declaration/spec.ts new file mode 100644 index 000000000000..52ab7c72bab6 --- /dev/null +++ b/packages/ast-spec/src/declaration/spec.ts @@ -0,0 +1,14 @@ +export * from './ClassDeclaration/spec'; +export * from './ExportAllDeclaration/spec'; +export * from './ExportDefaultDeclaration/spec'; +export * from './ExportNamedDeclaration/spec'; +export * from './FunctionDeclaration/spec'; +export * from './ImportDeclaration/spec'; +export * from './TSDeclareFunction/spec'; +export * from './TSEnumDeclaration/spec'; +export * from './TSImportEqualsDeclaration/spec'; +export * from './TSInterfaceDeclaration/spec'; +export * from './TSModuleDeclaration/spec'; +export * from './TSNamespaceExportDeclaration/spec'; +export * from './TSTypeAliasDeclaration/spec'; +export * from './VariableDeclaration/spec'; diff --git a/packages/ast-spec/src/element/MethodDefinition/spec.ts b/packages/ast-spec/src/element/MethodDefinition/spec.ts new file mode 100644 index 000000000000..c02aa19b5df3 --- /dev/null +++ b/packages/ast-spec/src/element/MethodDefinition/spec.ts @@ -0,0 +1,19 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { + ClassMethodDefinitionNonComputedNameBase, + MethodDefinitionComputedNameBase, +} from '../../base/MethodDefinitionBase'; + +export interface MethodDefinitionComputedName + extends MethodDefinitionComputedNameBase { + type: AST_NODE_TYPES.MethodDefinition; +} + +export interface MethodDefinitionNonComputedName + extends ClassMethodDefinitionNonComputedNameBase { + type: AST_NODE_TYPES.MethodDefinition; +} + +export type MethodDefinition = + | MethodDefinitionComputedName + | MethodDefinitionNonComputedName; diff --git a/packages/ast-spec/src/element/Property/spec.ts b/packages/ast-spec/src/element/Property/spec.ts new file mode 100644 index 000000000000..c96a7a26e371 --- /dev/null +++ b/packages/ast-spec/src/element/Property/spec.ts @@ -0,0 +1,37 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TSEmptyBodyFunctionExpression } from '../../expression/TSEmptyBodyFunctionExpression/spec'; +import type { AssignmentPattern } from '../../parameter/AssignmentPattern/spec'; +import type { BindingName } from '../../unions/BindingName'; +import type { Expression } from '../../unions/Expression'; +import type { + PropertyName, + PropertyNameComputed, + PropertyNameNonComputed, +} from '../../unions/PropertyName'; + +interface PropertyBase extends BaseNode { + type: AST_NODE_TYPES.Property; + key: PropertyName; + value: + | AssignmentPattern + | BindingName + | Expression + | TSEmptyBodyFunctionExpression; + computed: boolean; + method: boolean; + shorthand: boolean; + optional?: boolean; + kind: 'get' | 'init' | 'set'; +} + +export interface PropertyComputedName extends PropertyBase { + key: PropertyNameComputed; + computed: true; +} +export interface PropertyNonComputedName extends PropertyBase { + key: PropertyNameNonComputed; + computed: false; +} + +export type Property = PropertyComputedName | PropertyNonComputedName; diff --git a/packages/ast-spec/src/element/PropertyDefinition/spec.ts b/packages/ast-spec/src/element/PropertyDefinition/spec.ts new file mode 100644 index 000000000000..d249b140e661 --- /dev/null +++ b/packages/ast-spec/src/element/PropertyDefinition/spec.ts @@ -0,0 +1,19 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { + ClassPropertyDefinitionNonComputedNameBase, + PropertyDefinitionComputedNameBase, +} from '../../base/PropertyDefinitionBase'; + +export interface PropertyDefinitionComputedName + extends PropertyDefinitionComputedNameBase { + type: AST_NODE_TYPES.PropertyDefinition; +} + +export interface PropertyDefinitionNonComputedName + extends ClassPropertyDefinitionNonComputedNameBase { + type: AST_NODE_TYPES.PropertyDefinition; +} + +export type PropertyDefinition = + | PropertyDefinitionComputedName + | PropertyDefinitionNonComputedName; diff --git a/packages/ast-spec/src/element/SpreadElement/spec.ts b/packages/ast-spec/src/element/SpreadElement/spec.ts new file mode 100644 index 000000000000..13a691901710 --- /dev/null +++ b/packages/ast-spec/src/element/SpreadElement/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; + +export interface SpreadElement extends BaseNode { + type: AST_NODE_TYPES.SpreadElement; + argument: Expression; +} diff --git a/packages/ast-spec/src/element/StaticBlock/spec.ts b/packages/ast-spec/src/element/StaticBlock/spec.ts new file mode 100644 index 000000000000..526a5f65f6d8 --- /dev/null +++ b/packages/ast-spec/src/element/StaticBlock/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Statement } from '../../unions/Statement'; + +export interface StaticBlock extends BaseNode { + type: AST_NODE_TYPES.StaticBlock; + body: Statement[]; +} diff --git a/packages/ast-spec/src/element/TSAbstractMethodDefinition/spec.ts b/packages/ast-spec/src/element/TSAbstractMethodDefinition/spec.ts new file mode 100644 index 000000000000..ad2c3f7e51ff --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractMethodDefinition/spec.ts @@ -0,0 +1,20 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { + MethodDefinitionComputedNameBase, + MethodDefinitionNonComputedNameBase, +} from '../../base/MethodDefinitionBase'; + +export interface TSAbstractMethodDefinitionComputedName + extends MethodDefinitionComputedNameBase { + type: AST_NODE_TYPES.TSAbstractMethodDefinition; +} + +export interface TSAbstractMethodDefinitionNonComputedName + // this does not extend ClassMethodDefinitionNonComputedNameBase because abstract private names are not allowed + extends MethodDefinitionNonComputedNameBase { + type: AST_NODE_TYPES.TSAbstractMethodDefinition; +} + +export type TSAbstractMethodDefinition = + | TSAbstractMethodDefinitionComputedName + | TSAbstractMethodDefinitionNonComputedName; diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/spec.ts b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/spec.ts new file mode 100644 index 000000000000..efa41b3bd364 --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/spec.ts @@ -0,0 +1,22 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { + PropertyDefinitionComputedNameBase, + PropertyDefinitionNonComputedNameBase, +} from '../../base/PropertyDefinitionBase'; + +export interface TSAbstractPropertyDefinitionComputedName + extends PropertyDefinitionComputedNameBase { + type: AST_NODE_TYPES.TSAbstractPropertyDefinition; + value: null; +} + +export interface TSAbstractPropertyDefinitionNonComputedName + // this does not extend ClassPropertyDefinitionNonComputedNameBase because abstract private names are not allowed + extends PropertyDefinitionNonComputedNameBase { + type: AST_NODE_TYPES.TSAbstractPropertyDefinition; + value: null; +} + +export type TSAbstractPropertyDefinition = + | TSAbstractPropertyDefinitionComputedName + | TSAbstractPropertyDefinitionNonComputedName; diff --git a/packages/ast-spec/src/element/TSCallSignatureDeclaration/spec.ts b/packages/ast-spec/src/element/TSCallSignatureDeclaration/spec.ts new file mode 100644 index 000000000000..8ba015661ccb --- /dev/null +++ b/packages/ast-spec/src/element/TSCallSignatureDeclaration/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { TSFunctionSignatureBase } from '../../base/TSFunctionSignatureBase'; + +export interface TSCallSignatureDeclaration extends TSFunctionSignatureBase { + type: AST_NODE_TYPES.TSCallSignatureDeclaration; +} diff --git a/packages/ast-spec/src/element/TSConstructSignatureDeclaration/spec.ts b/packages/ast-spec/src/element/TSConstructSignatureDeclaration/spec.ts new file mode 100644 index 000000000000..21feddb824d1 --- /dev/null +++ b/packages/ast-spec/src/element/TSConstructSignatureDeclaration/spec.ts @@ -0,0 +1,7 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { TSFunctionSignatureBase } from '../../base/TSFunctionSignatureBase'; + +export interface TSConstructSignatureDeclaration + extends TSFunctionSignatureBase { + type: AST_NODE_TYPES.TSConstructSignatureDeclaration; +} diff --git a/packages/ast-spec/src/element/TSEnumMember/spec.ts b/packages/ast-spec/src/element/TSEnumMember/spec.ts new file mode 100644 index 000000000000..97d8e49fcd94 --- /dev/null +++ b/packages/ast-spec/src/element/TSEnumMember/spec.ts @@ -0,0 +1,41 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; +import type { + PropertyNameComputed, + PropertyNameNonComputed, +} from '../../unions/PropertyName'; + +interface TSEnumMemberBase extends BaseNode { + type: AST_NODE_TYPES.TSEnumMember; + id: + | PropertyNameComputed // this should only happen in semantically invalid code (ts error 1164) + | PropertyNameNonComputed; + initializer?: Expression; + computed?: boolean; +} + +/** + * this should only really happen in semantically invalid code (errors 1164 and 2452) + * + * VALID: + * enum Foo { ['a'] } + * + * INVALID: + * const x = 'a'; + * enum Foo { [x] } + * enum Bar { ['a' + 'b'] } + */ +export interface TSEnumMemberComputedName extends TSEnumMemberBase { + id: PropertyNameComputed; + computed: true; +} + +export interface TSEnumMemberNonComputedName extends TSEnumMemberBase { + id: PropertyNameNonComputed; + computed?: false; +} + +export type TSEnumMember = + | TSEnumMemberComputedName + | TSEnumMemberNonComputedName; diff --git a/packages/ast-spec/src/element/TSIndexSignature/spec.ts b/packages/ast-spec/src/element/TSIndexSignature/spec.ts new file mode 100644 index 000000000000..38002bec2951 --- /dev/null +++ b/packages/ast-spec/src/element/TSIndexSignature/spec.ts @@ -0,0 +1,15 @@ +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 { 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; +} diff --git a/packages/ast-spec/src/element/TSMethodSignature/spec.ts b/packages/ast-spec/src/element/TSMethodSignature/spec.ts new file mode 100644 index 000000000000..5ca7cbead3e0 --- /dev/null +++ b/packages/ast-spec/src/element/TSMethodSignature/spec.ts @@ -0,0 +1,40 @@ +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 { TSTypeParameterDeclaration } from '../../special/TSTypeParameterDeclaration/spec'; +import type { Parameter } from '../../unions/Parameter'; +import type { + PropertyName, + PropertyNameComputed, + PropertyNameNonComputed, +} from '../../unions/PropertyName'; + +interface TSMethodSignatureBase extends BaseNode { + type: AST_NODE_TYPES.TSMethodSignature; + key: PropertyName; + computed: boolean; + params: Parameter[]; + optional?: boolean; + returnType?: TSTypeAnnotation; + readonly?: boolean; + typeParameters?: TSTypeParameterDeclaration; + accessibility?: Accessibility; + export?: boolean; + static?: boolean; + kind: 'get' | 'method' | 'set'; +} + +export interface TSMethodSignatureComputedName extends TSMethodSignatureBase { + key: PropertyNameComputed; + computed: true; +} +export interface TSMethodSignatureNonComputedName + extends TSMethodSignatureBase { + key: PropertyNameNonComputed; + computed: false; +} + +export type TSMethodSignature = + | TSMethodSignatureComputedName + | TSMethodSignatureNonComputedName; diff --git a/packages/ast-spec/src/element/TSPropertySignature/spec.ts b/packages/ast-spec/src/element/TSPropertySignature/spec.ts new file mode 100644 index 000000000000..a3f91ac26807 --- /dev/null +++ b/packages/ast-spec/src/element/TSPropertySignature/spec.ts @@ -0,0 +1,39 @@ +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, + PropertyNameNonComputed, +} from '../../unions/PropertyName'; + +interface TSPropertySignatureBase extends BaseNode { + type: AST_NODE_TYPES.TSPropertySignature; + key: PropertyName; + optional?: boolean; + computed: boolean; + typeAnnotation?: TSTypeAnnotation; + initializer?: Expression; + readonly?: boolean; + static?: boolean; + export?: boolean; + accessibility?: Accessibility; +} + +export interface TSPropertySignatureComputedName + extends TSPropertySignatureBase { + key: PropertyNameComputed; + computed: true; +} + +export interface TSPropertySignatureNonComputedName + extends TSPropertySignatureBase { + key: PropertyNameNonComputed; + computed: false; +} + +export type TSPropertySignature = + | TSPropertySignatureComputedName + | TSPropertySignatureNonComputedName; diff --git a/packages/ast-spec/src/element/spec.ts b/packages/ast-spec/src/element/spec.ts new file mode 100644 index 000000000000..77ed3f2f283d --- /dev/null +++ b/packages/ast-spec/src/element/spec.ts @@ -0,0 +1,13 @@ +export * from './PropertyDefinition/spec'; +export * from './MethodDefinition/spec'; +export * from './Property/spec'; +export * from './SpreadElement/spec'; +export * from './StaticBlock/spec'; +export * from './TSAbstractPropertyDefinition/spec'; +export * from './TSAbstractMethodDefinition/spec'; +export * from './TSCallSignatureDeclaration/spec'; +export * from './TSConstructSignatureDeclaration/spec'; +export * from './TSEnumMember/spec'; +export * from './TSIndexSignature/spec'; +export * from './TSMethodSignature/spec'; +export * from './TSPropertySignature/spec'; diff --git a/packages/ast-spec/src/expression/ArrayExpression/spec.ts b/packages/ast-spec/src/expression/ArrayExpression/spec.ts new file mode 100644 index 000000000000..7da330e231a4 --- /dev/null +++ b/packages/ast-spec/src/expression/ArrayExpression/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; + +export interface ArrayExpression extends BaseNode { + type: AST_NODE_TYPES.ArrayExpression; + elements: Expression[]; +} diff --git a/packages/ast-spec/src/expression/ArrowFunctionExpression/spec.ts b/packages/ast-spec/src/expression/ArrowFunctionExpression/spec.ts new file mode 100644 index 000000000000..347ee8541371 --- /dev/null +++ b/packages/ast-spec/src/expression/ArrowFunctionExpression/spec.ts @@ -0,0 +1,19 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TSTypeAnnotation } from '../../special/TSTypeAnnotation/spec'; +import type { TSTypeParameterDeclaration } from '../../special/TSTypeParameterDeclaration/spec'; +import type { BlockStatement } from '../../statement/BlockStatement/spec'; +import type { Expression } from '../../unions/Expression'; +import type { Parameter } from '../../unions/Parameter'; + +export interface ArrowFunctionExpression extends BaseNode { + type: AST_NODE_TYPES.ArrowFunctionExpression; + generator: boolean; + id: null; + params: Parameter[]; + body: BlockStatement | Expression; + async: boolean; + expression: boolean; + returnType?: TSTypeAnnotation; + typeParameters?: TSTypeParameterDeclaration; +} diff --git a/packages/ast-spec/src/expression/AssignmentExpression/spec.ts b/packages/ast-spec/src/expression/AssignmentExpression/spec.ts new file mode 100644 index 000000000000..8d76be21bdcc --- /dev/null +++ b/packages/ast-spec/src/expression/AssignmentExpression/spec.ts @@ -0,0 +1,23 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BinaryExpressionBase } from '../../base/BinaryExpressionBase'; + +export interface AssignmentExpression extends BinaryExpressionBase { + type: AST_NODE_TYPES.AssignmentExpression; + operator: + | '-=' + | '??=' + | '**=' + | '*=' + | '/=' + | '&&=' + | '&=' + | '%=' + | '^=' + | '+=' + | '<<=' + | '=' + | '>>=' + | '>>>=' + | '|=' + | '||='; +} diff --git a/packages/ast-spec/src/expression/AwaitExpression/spec.ts b/packages/ast-spec/src/expression/AwaitExpression/spec.ts new file mode 100644 index 000000000000..0017ff6b868f --- /dev/null +++ b/packages/ast-spec/src/expression/AwaitExpression/spec.ts @@ -0,0 +1,14 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { LeftHandSideExpression } from '../../unions/LeftHandSideExpression'; +import type { UnaryExpression } from '../UnaryExpression/spec'; +import type { UpdateExpression } from '../UpdateExpression/spec'; + +export interface AwaitExpression extends BaseNode { + type: AST_NODE_TYPES.AwaitExpression; + argument: + | AwaitExpression + | LeftHandSideExpression + | UnaryExpression + | UpdateExpression; +} diff --git a/packages/ast-spec/src/expression/BinaryExpression/spec.ts b/packages/ast-spec/src/expression/BinaryExpression/spec.ts new file mode 100644 index 000000000000..5df33cc3e16a --- /dev/null +++ b/packages/ast-spec/src/expression/BinaryExpression/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BinaryExpressionBase } from '../../base/BinaryExpressionBase'; + +export interface BinaryExpression extends BinaryExpressionBase { + type: AST_NODE_TYPES.BinaryExpression; +} diff --git a/packages/ast-spec/src/expression/CallExpression/spec.ts b/packages/ast-spec/src/expression/CallExpression/spec.ts new file mode 100644 index 000000000000..bd71773a1be8 --- /dev/null +++ b/packages/ast-spec/src/expression/CallExpression/spec.ts @@ -0,0 +1,13 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TSTypeParameterInstantiation } from '../../special/TSTypeParameterInstantiation/spec'; +import type { CallExpressionArgument } from '../../unions/CallExpressionArgument'; +import type { LeftHandSideExpression } from '../../unions/LeftHandSideExpression'; + +export interface CallExpression extends BaseNode { + type: AST_NODE_TYPES.CallExpression; + callee: LeftHandSideExpression; + arguments: CallExpressionArgument[]; + typeParameters?: TSTypeParameterInstantiation; + optional: boolean; +} diff --git a/packages/ast-spec/src/expression/ChainExpression/spec.ts b/packages/ast-spec/src/expression/ChainExpression/spec.ts new file mode 100644 index 000000000000..dfad50f3580f --- /dev/null +++ b/packages/ast-spec/src/expression/ChainExpression/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { ChainElement } from '../../unions/ChainElement'; + +export interface ChainExpression extends BaseNode { + type: AST_NODE_TYPES.ChainExpression; + expression: ChainElement; +} diff --git a/packages/ast-spec/src/expression/ClassExpression/spec.ts b/packages/ast-spec/src/expression/ClassExpression/spec.ts new file mode 100644 index 000000000000..15215c31f1b6 --- /dev/null +++ b/packages/ast-spec/src/expression/ClassExpression/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { ClassDeclarationBase } from '../../base/ClassDeclarationBase'; + +export interface ClassExpression extends ClassDeclarationBase { + type: AST_NODE_TYPES.ClassExpression; +} diff --git a/packages/ast-spec/src/expression/ConditionalExpression/spec.ts b/packages/ast-spec/src/expression/ConditionalExpression/spec.ts new file mode 100644 index 000000000000..545fc9497b77 --- /dev/null +++ b/packages/ast-spec/src/expression/ConditionalExpression/spec.ts @@ -0,0 +1,10 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; + +export interface ConditionalExpression extends BaseNode { + type: AST_NODE_TYPES.ConditionalExpression; + test: Expression; + consequent: Expression; + alternate: Expression; +} diff --git a/packages/ast-spec/src/expression/FunctionExpression/spec.ts b/packages/ast-spec/src/expression/FunctionExpression/spec.ts new file mode 100644 index 000000000000..111be168b024 --- /dev/null +++ b/packages/ast-spec/src/expression/FunctionExpression/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { FunctionDeclarationBase } from '../../base/FunctionDeclarationBase'; +import type { BlockStatement } from '../../statement/BlockStatement/spec'; + +export interface FunctionExpression extends FunctionDeclarationBase { + type: AST_NODE_TYPES.FunctionExpression; + body: BlockStatement; +} diff --git a/packages/ast-spec/src/expression/Identifier/spec.ts b/packages/ast-spec/src/expression/Identifier/spec.ts new file mode 100644 index 000000000000..384922a061a1 --- /dev/null +++ b/packages/ast-spec/src/expression/Identifier/spec.ts @@ -0,0 +1,12 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Decorator } from '../../special/Decorator/spec'; +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[]; +} diff --git a/packages/ast-spec/src/expression/ImportExpression/spec.ts b/packages/ast-spec/src/expression/ImportExpression/spec.ts new file mode 100644 index 000000000000..c381802571a6 --- /dev/null +++ b/packages/ast-spec/src/expression/ImportExpression/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; + +export interface ImportExpression extends BaseNode { + type: AST_NODE_TYPES.ImportExpression; + source: Expression; +} diff --git a/packages/ast-spec/src/expression/JSXElement/spec.ts b/packages/ast-spec/src/expression/JSXElement/spec.ts new file mode 100644 index 000000000000..32a514f677a3 --- /dev/null +++ b/packages/ast-spec/src/expression/JSXElement/spec.ts @@ -0,0 +1,12 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { JSXClosingElement } from '../../jsx/JSXClosingElement/spec'; +import type { JSXOpeningElement } from '../../jsx/JSXOpeningElement/spec'; +import type { JSXChild } from '../../unions/JSXChild'; + +export interface JSXElement extends BaseNode { + type: AST_NODE_TYPES.JSXElement; + openingElement: JSXOpeningElement; + closingElement: JSXClosingElement | null; + children: JSXChild[]; +} diff --git a/packages/ast-spec/src/expression/JSXFragment/spec.ts b/packages/ast-spec/src/expression/JSXFragment/spec.ts new file mode 100644 index 000000000000..9adce12ada58 --- /dev/null +++ b/packages/ast-spec/src/expression/JSXFragment/spec.ts @@ -0,0 +1,12 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { JSXClosingFragment } from '../../jsx/JSXClosingFragment/spec'; +import type { JSXOpeningFragment } from '../../jsx/JSXOpeningFragment/spec'; +import type { JSXChild } from '../../unions/JSXChild'; + +export interface JSXFragment extends BaseNode { + type: AST_NODE_TYPES.JSXFragment; + openingFragment: JSXOpeningFragment; + closingFragment: JSXClosingFragment; + children: JSXChild[]; +} diff --git a/packages/ast-spec/src/expression/LogicalExpression/spec.ts b/packages/ast-spec/src/expression/LogicalExpression/spec.ts new file mode 100644 index 000000000000..6d2b56b50dd4 --- /dev/null +++ b/packages/ast-spec/src/expression/LogicalExpression/spec.ts @@ -0,0 +1,7 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BinaryExpressionBase } from '../../base/BinaryExpressionBase'; + +export interface LogicalExpression extends BinaryExpressionBase { + type: AST_NODE_TYPES.LogicalExpression; + operator: '??' | '&&' | '||'; +} diff --git a/packages/ast-spec/src/expression/MemberExpression/spec.ts b/packages/ast-spec/src/expression/MemberExpression/spec.ts new file mode 100644 index 000000000000..260574cc59f9 --- /dev/null +++ b/packages/ast-spec/src/expression/MemberExpression/spec.ts @@ -0,0 +1,29 @@ +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 { LeftHandSideExpression } from '../../unions/LeftHandSideExpression'; +import type { Identifier } from '../Identifier/spec'; + +interface MemberExpressionBase extends BaseNode { + object: LeftHandSideExpression; + property: Expression | Identifier | PrivateIdentifier; + computed: boolean; + optional: boolean; +} + +export interface MemberExpressionComputedName extends MemberExpressionBase { + type: AST_NODE_TYPES.MemberExpression; + property: Expression; + computed: true; +} + +export interface MemberExpressionNonComputedName extends MemberExpressionBase { + type: AST_NODE_TYPES.MemberExpression; + property: Identifier | PrivateIdentifier; + computed: false; +} + +export type MemberExpression = + | MemberExpressionComputedName + | MemberExpressionNonComputedName; diff --git a/packages/ast-spec/src/expression/MetaProperty/spec.ts b/packages/ast-spec/src/expression/MetaProperty/spec.ts new file mode 100644 index 000000000000..5bc9afb81113 --- /dev/null +++ b/packages/ast-spec/src/expression/MetaProperty/spec.ts @@ -0,0 +1,9 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Identifier } from '../Identifier/spec'; + +export interface MetaProperty extends BaseNode { + type: AST_NODE_TYPES.MetaProperty; + meta: Identifier; + property: Identifier; +} diff --git a/packages/ast-spec/src/expression/NewExpression/spec.ts b/packages/ast-spec/src/expression/NewExpression/spec.ts new file mode 100644 index 000000000000..bb75ae3f4b8f --- /dev/null +++ b/packages/ast-spec/src/expression/NewExpression/spec.ts @@ -0,0 +1,12 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TSTypeParameterInstantiation } from '../../special/TSTypeParameterInstantiation/spec'; +import type { Expression } from '../../unions/Expression'; +import type { LeftHandSideExpression } from '../../unions/LeftHandSideExpression'; + +export interface NewExpression extends BaseNode { + type: AST_NODE_TYPES.NewExpression; + callee: LeftHandSideExpression; + arguments: Expression[]; + typeParameters?: TSTypeParameterInstantiation; +} diff --git a/packages/ast-spec/src/expression/ObjectExpression/spec.ts b/packages/ast-spec/src/expression/ObjectExpression/spec.ts new file mode 100644 index 000000000000..0573a2a76faf --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { ObjectLiteralElement } from '../../unions/ObjectLiteralElement'; + +export interface ObjectExpression extends BaseNode { + type: AST_NODE_TYPES.ObjectExpression; + properties: ObjectLiteralElement[]; +} diff --git a/packages/ast-spec/src/expression/SequenceExpression/spec.ts b/packages/ast-spec/src/expression/SequenceExpression/spec.ts new file mode 100644 index 000000000000..fa571adb4f08 --- /dev/null +++ b/packages/ast-spec/src/expression/SequenceExpression/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; + +export interface SequenceExpression extends BaseNode { + type: AST_NODE_TYPES.SequenceExpression; + expressions: Expression[]; +} diff --git a/packages/ast-spec/src/expression/Super/spec.ts b/packages/ast-spec/src/expression/Super/spec.ts new file mode 100644 index 000000000000..eb310620d8ed --- /dev/null +++ b/packages/ast-spec/src/expression/Super/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface Super extends BaseNode { + type: AST_NODE_TYPES.Super; +} diff --git a/packages/ast-spec/src/expression/TSAsExpression/spec.ts b/packages/ast-spec/src/expression/TSAsExpression/spec.ts new file mode 100644 index 000000000000..b90925a53ca7 --- /dev/null +++ b/packages/ast-spec/src/expression/TSAsExpression/spec.ts @@ -0,0 +1,10 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; +import type { TypeNode } from '../../unions/TypeNode'; + +export interface TSAsExpression extends BaseNode { + type: AST_NODE_TYPES.TSAsExpression; + expression: Expression; + typeAnnotation: TypeNode; +} diff --git a/packages/ast-spec/src/expression/TSEmptyBodyFunctionExpression/spec.ts b/packages/ast-spec/src/expression/TSEmptyBodyFunctionExpression/spec.ts new file mode 100644 index 000000000000..2cc413c01095 --- /dev/null +++ b/packages/ast-spec/src/expression/TSEmptyBodyFunctionExpression/spec.ts @@ -0,0 +1,7 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { FunctionDeclarationBase } from '../../base/FunctionDeclarationBase'; + +export interface TSEmptyBodyFunctionExpression extends FunctionDeclarationBase { + type: AST_NODE_TYPES.TSEmptyBodyFunctionExpression; + body: null; +} diff --git a/packages/ast-spec/src/expression/TSNonNullExpression/spec.ts b/packages/ast-spec/src/expression/TSNonNullExpression/spec.ts new file mode 100644 index 000000000000..fd25d33d372f --- /dev/null +++ b/packages/ast-spec/src/expression/TSNonNullExpression/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; + +export interface TSNonNullExpression extends BaseNode { + type: AST_NODE_TYPES.TSNonNullExpression; + expression: Expression; +} diff --git a/packages/ast-spec/src/expression/TSTypeAssertion/spec.ts b/packages/ast-spec/src/expression/TSTypeAssertion/spec.ts new file mode 100644 index 000000000000..d820f8fcc378 --- /dev/null +++ b/packages/ast-spec/src/expression/TSTypeAssertion/spec.ts @@ -0,0 +1,10 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; +import type { TypeNode } from '../../unions/TypeNode'; + +export interface TSTypeAssertion extends BaseNode { + type: AST_NODE_TYPES.TSTypeAssertion; + typeAnnotation: TypeNode; + expression: Expression; +} diff --git a/packages/ast-spec/src/expression/TaggedTemplateExpression/spec.ts b/packages/ast-spec/src/expression/TaggedTemplateExpression/spec.ts new file mode 100644 index 000000000000..e3438484d9dd --- /dev/null +++ b/packages/ast-spec/src/expression/TaggedTemplateExpression/spec.ts @@ -0,0 +1,12 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TSTypeParameterInstantiation } from '../../special/TSTypeParameterInstantiation/spec'; +import type { LeftHandSideExpression } from '../../unions/LeftHandSideExpression'; +import type { TemplateLiteral } from '../TemplateLiteral/spec'; + +export interface TaggedTemplateExpression extends BaseNode { + type: AST_NODE_TYPES.TaggedTemplateExpression; + typeParameters?: TSTypeParameterInstantiation; + tag: LeftHandSideExpression; + quasi: TemplateLiteral; +} diff --git a/packages/ast-spec/src/expression/TemplateLiteral/spec.ts b/packages/ast-spec/src/expression/TemplateLiteral/spec.ts new file mode 100644 index 000000000000..4d92ef79176d --- /dev/null +++ b/packages/ast-spec/src/expression/TemplateLiteral/spec.ts @@ -0,0 +1,10 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TemplateElement } from '../../special/TemplateElement/spec'; +import type { Expression } from '../../unions/Expression'; + +export interface TemplateLiteral extends BaseNode { + type: AST_NODE_TYPES.TemplateLiteral; + quasis: TemplateElement[]; + expressions: Expression[]; +} diff --git a/packages/ast-spec/src/expression/ThisExpression/spec.ts b/packages/ast-spec/src/expression/ThisExpression/spec.ts new file mode 100644 index 000000000000..63b5a213a883 --- /dev/null +++ b/packages/ast-spec/src/expression/ThisExpression/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface ThisExpression extends BaseNode { + type: AST_NODE_TYPES.ThisExpression; +} diff --git a/packages/ast-spec/src/expression/UnaryExpression/spec.ts b/packages/ast-spec/src/expression/UnaryExpression/spec.ts new file mode 100644 index 000000000000..26ec8a0e9cdf --- /dev/null +++ b/packages/ast-spec/src/expression/UnaryExpression/spec.ts @@ -0,0 +1,7 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { UnaryExpressionBase } from '../../base/UnaryExpressionBase'; + +export interface UnaryExpression extends UnaryExpressionBase { + type: AST_NODE_TYPES.UnaryExpression; + operator: '-' | '!' | '+' | '~' | 'delete' | 'typeof' | 'void'; +} diff --git a/packages/ast-spec/src/expression/UpdateExpression/spec.ts b/packages/ast-spec/src/expression/UpdateExpression/spec.ts new file mode 100644 index 000000000000..909815fdabf3 --- /dev/null +++ b/packages/ast-spec/src/expression/UpdateExpression/spec.ts @@ -0,0 +1,7 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { UnaryExpressionBase } from '../../base/UnaryExpressionBase'; + +export interface UpdateExpression extends UnaryExpressionBase { + type: AST_NODE_TYPES.UpdateExpression; + operator: '--' | '++'; +} diff --git a/packages/ast-spec/src/expression/YieldExpression/spec.ts b/packages/ast-spec/src/expression/YieldExpression/spec.ts new file mode 100644 index 000000000000..1f07e4f78e32 --- /dev/null +++ b/packages/ast-spec/src/expression/YieldExpression/spec.ts @@ -0,0 +1,9 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; + +export interface YieldExpression extends BaseNode { + type: AST_NODE_TYPES.YieldExpression; + delegate: boolean; + argument?: Expression; +} diff --git a/packages/ast-spec/src/expression/literal/BigIntLiteral/spec.ts b/packages/ast-spec/src/expression/literal/BigIntLiteral/spec.ts new file mode 100644 index 000000000000..2df33369cf74 --- /dev/null +++ b/packages/ast-spec/src/expression/literal/BigIntLiteral/spec.ts @@ -0,0 +1,6 @@ +import type { LiteralBase } from '../../../base/LiteralBase'; + +export interface BigIntLiteral extends LiteralBase { + value: bigint | null; + bigint: string; +} diff --git a/packages/ast-spec/src/expression/literal/BooleanLiteral/spec.ts b/packages/ast-spec/src/expression/literal/BooleanLiteral/spec.ts new file mode 100644 index 000000000000..be7477f015cb --- /dev/null +++ b/packages/ast-spec/src/expression/literal/BooleanLiteral/spec.ts @@ -0,0 +1,6 @@ +import type { LiteralBase } from '../../../base/LiteralBase'; + +export interface BooleanLiteral extends LiteralBase { + value: boolean; + raw: 'false' | 'true'; +} diff --git a/packages/ast-spec/src/expression/literal/NullLiteral/spec.ts b/packages/ast-spec/src/expression/literal/NullLiteral/spec.ts new file mode 100644 index 000000000000..03ff8a43c866 --- /dev/null +++ b/packages/ast-spec/src/expression/literal/NullLiteral/spec.ts @@ -0,0 +1,6 @@ +import type { LiteralBase } from '../../../base/LiteralBase'; + +export interface NullLiteral extends LiteralBase { + value: null; + raw: 'null'; +} diff --git a/packages/ast-spec/src/expression/literal/NumberLiteral/spec.ts b/packages/ast-spec/src/expression/literal/NumberLiteral/spec.ts new file mode 100644 index 000000000000..5a6cc12a59c1 --- /dev/null +++ b/packages/ast-spec/src/expression/literal/NumberLiteral/spec.ts @@ -0,0 +1,5 @@ +import type { LiteralBase } from '../../../base/LiteralBase'; + +export interface NumberLiteral extends LiteralBase { + value: number; +} diff --git a/packages/ast-spec/src/expression/literal/RegExpLiteral/spec.ts b/packages/ast-spec/src/expression/literal/RegExpLiteral/spec.ts new file mode 100644 index 000000000000..f72b53c7956b --- /dev/null +++ b/packages/ast-spec/src/expression/literal/RegExpLiteral/spec.ts @@ -0,0 +1,9 @@ +import type { LiteralBase } from '../../../base/LiteralBase'; + +export interface RegExpLiteral extends LiteralBase { + value: RegExp | null; + regex: { + pattern: string; + flags: string; + }; +} diff --git a/packages/ast-spec/src/expression/literal/StringLiteral/spec.ts b/packages/ast-spec/src/expression/literal/StringLiteral/spec.ts new file mode 100644 index 000000000000..32734f443e29 --- /dev/null +++ b/packages/ast-spec/src/expression/literal/StringLiteral/spec.ts @@ -0,0 +1,5 @@ +import type { LiteralBase } from '../../../base/LiteralBase'; + +export interface StringLiteral extends LiteralBase { + value: string; +} diff --git a/packages/ast-spec/src/expression/literal/spec.ts b/packages/ast-spec/src/expression/literal/spec.ts new file mode 100644 index 000000000000..d40804b424e1 --- /dev/null +++ b/packages/ast-spec/src/expression/literal/spec.ts @@ -0,0 +1,6 @@ +export * from './BigIntLiteral/spec'; +export * from './BooleanLiteral/spec'; +export * from './NullLiteral/spec'; +export * from './NumberLiteral/spec'; +export * from './RegExpLiteral/spec'; +export * from './StringLiteral/spec'; diff --git a/packages/ast-spec/src/expression/spec.ts b/packages/ast-spec/src/expression/spec.ts new file mode 100644 index 000000000000..9ea054546202 --- /dev/null +++ b/packages/ast-spec/src/expression/spec.ts @@ -0,0 +1,33 @@ +export * from './ArrayExpression/spec'; +export * from './ArrowFunctionExpression/spec'; +export * from './AssignmentExpression/spec'; +export * from './AwaitExpression/spec'; +export * from './BinaryExpression/spec'; +export * from './CallExpression/spec'; +export * from './ChainExpression/spec'; +export * from './ClassExpression/spec'; +export * from './ConditionalExpression/spec'; +export * from './FunctionExpression/spec'; +export * from './Identifier/spec'; +export * from './ImportExpression/spec'; +export * from './JSXElement/spec'; +export * from './JSXFragment/spec'; +export * from './LogicalExpression/spec'; +export * from './MemberExpression/spec'; +export * from './MetaProperty/spec'; +export * from './NewExpression/spec'; +export * from './ObjectExpression/spec'; +export * from './SequenceExpression/spec'; +export * from './Super/spec'; +export * from './TSAsExpression/spec'; +export * from './TSEmptyBodyFunctionExpression/spec'; +export * from './TSNonNullExpression/spec'; +export * from './TSTypeAssertion/spec'; +export * from './TaggedTemplateExpression/spec'; +export * from './TemplateLiteral/spec'; +export * from './ThisExpression/spec'; +export * from './UnaryExpression/spec'; +export * from './UpdateExpression/spec'; +export * from './YieldExpression/spec'; + +export * from './literal/spec'; diff --git a/packages/ast-spec/src/index.ts b/packages/ast-spec/src/index.ts new file mode 100644 index 000000000000..ba9ee6800007 --- /dev/null +++ b/packages/ast-spec/src/index.ts @@ -0,0 +1,52 @@ +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/OptionalRangeAndLoc'; +export * from './base/Position'; +export * from './base/Range'; +export * from './base/SourceLocation'; + +export * from './unions/BindingName'; +export * from './unions/BindingPattern'; +export * from './unions/CallExpressionArgument'; +export * from './unions/ChainElement'; +export * from './unions/ClassElement'; +export * from './unions/Comment'; +export * from './unions/DeclarationStatement'; +export * from './unions/DestructuringPattern'; +export * from './unions/EntityName'; +export * from './unions/ExportDeclaration'; +export * from './unions/Expression'; +export * from './unions/ForInitialiser'; +export * from './unions/FunctionLike'; +export * from './unions/ImportClause'; +export * from './unions/IterationStatement'; +export * from './unions/JSXChild'; +export * from './unions/JSXExpression'; +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'; +export * from './unions/PrimaryExpression'; +export * from './unions/PropertyName'; +export * from './unions/Statement'; +export * from './unions/TSUnaryExpression'; +export * from './unions/Token'; +export * from './unions/TypeElement'; +export * from './unions/TypeNode'; + +export * from './declaration/spec'; +export * from './element/spec'; +export * from './expression/spec'; +export * from './jsx/spec'; +export * from './parameter/spec'; +export * from './special/spec'; +export * from './statement/spec'; +export * from './token/spec'; +export * from './type/spec'; + +export * from './ast-node-types'; +export * from './ast-token-types'; diff --git a/packages/ast-spec/src/jsx/JSXAttribute/spec.ts b/packages/ast-spec/src/jsx/JSXAttribute/spec.ts new file mode 100644 index 000000000000..8fc8364c05fd --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXAttribute/spec.ts @@ -0,0 +1,12 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { JSXExpression } from '../../unions/JSXExpression'; +import type { Literal } from '../../unions/Literal'; +import type { JSXIdentifier } from '../JSXIdentifier/spec'; +import type { JSXNamespacedName } from '../JSXNamespacedName/spec'; + +export interface JSXAttribute extends BaseNode { + type: AST_NODE_TYPES.JSXAttribute; + name: JSXIdentifier | JSXNamespacedName; + value: JSXExpression | Literal | null; +} diff --git a/packages/ast-spec/src/jsx/JSXClosingElement/spec.ts b/packages/ast-spec/src/jsx/JSXClosingElement/spec.ts new file mode 100644 index 000000000000..ea698d6059ed --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXClosingElement/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { JSXTagNameExpression } from '../../unions/JSXTagNameExpression'; + +export interface JSXClosingElement extends BaseNode { + type: AST_NODE_TYPES.JSXClosingElement; + name: JSXTagNameExpression; +} diff --git a/packages/ast-spec/src/jsx/JSXClosingFragment/spec.ts b/packages/ast-spec/src/jsx/JSXClosingFragment/spec.ts new file mode 100644 index 000000000000..8edd7c4e958f --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXClosingFragment/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface JSXClosingFragment extends BaseNode { + type: AST_NODE_TYPES.JSXClosingFragment; +} diff --git a/packages/ast-spec/src/jsx/JSXEmptyExpression/spec.ts b/packages/ast-spec/src/jsx/JSXEmptyExpression/spec.ts new file mode 100644 index 000000000000..36e3c16069c4 --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXEmptyExpression/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface JSXEmptyExpression extends BaseNode { + type: AST_NODE_TYPES.JSXEmptyExpression; +} diff --git a/packages/ast-spec/src/jsx/JSXExpressionContainer/spec.ts b/packages/ast-spec/src/jsx/JSXExpressionContainer/spec.ts new file mode 100644 index 000000000000..1a0673e6fd15 --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXExpressionContainer/spec.ts @@ -0,0 +1,9 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; +import type { JSXEmptyExpression } from '../JSXEmptyExpression/spec'; + +export interface JSXExpressionContainer extends BaseNode { + type: AST_NODE_TYPES.JSXExpressionContainer; + expression: Expression | JSXEmptyExpression; +} diff --git a/packages/ast-spec/src/jsx/JSXIdentifier/spec.ts b/packages/ast-spec/src/jsx/JSXIdentifier/spec.ts new file mode 100644 index 000000000000..1d7b71d67ab0 --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXIdentifier/spec.ts @@ -0,0 +1,7 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface JSXIdentifier extends BaseNode { + type: AST_NODE_TYPES.JSXIdentifier; + name: string; +} diff --git a/packages/ast-spec/src/jsx/JSXMemberExpression/spec.ts b/packages/ast-spec/src/jsx/JSXMemberExpression/spec.ts new file mode 100644 index 000000000000..e0cda9c16ee4 --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXMemberExpression/spec.ts @@ -0,0 +1,10 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { JSXTagNameExpression } from '../../unions/JSXTagNameExpression'; +import type { JSXIdentifier } from '../JSXIdentifier/spec'; + +export interface JSXMemberExpression extends BaseNode { + type: AST_NODE_TYPES.JSXMemberExpression; + object: JSXTagNameExpression; + property: JSXIdentifier; +} diff --git a/packages/ast-spec/src/jsx/JSXNamespacedName/spec.ts b/packages/ast-spec/src/jsx/JSXNamespacedName/spec.ts new file mode 100644 index 000000000000..22443d938eca --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXNamespacedName/spec.ts @@ -0,0 +1,9 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { JSXIdentifier } from '../JSXIdentifier/spec'; + +export interface JSXNamespacedName extends BaseNode { + type: AST_NODE_TYPES.JSXNamespacedName; + namespace: JSXIdentifier; + name: JSXIdentifier; +} diff --git a/packages/ast-spec/src/jsx/JSXOpeningElement/spec.ts b/packages/ast-spec/src/jsx/JSXOpeningElement/spec.ts new file mode 100644 index 000000000000..710fade02fa5 --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXOpeningElement/spec.ts @@ -0,0 +1,14 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TSTypeParameterInstantiation } from '../../special/TSTypeParameterInstantiation/spec'; +import type { JSXTagNameExpression } from '../../unions/JSXTagNameExpression'; +import type { JSXAttribute } from '../JSXAttribute/spec'; +import type { JSXSpreadAttribute } from '../JSXSpreadAttribute/spec'; + +export interface JSXOpeningElement extends BaseNode { + type: AST_NODE_TYPES.JSXOpeningElement; + typeParameters?: TSTypeParameterInstantiation; + selfClosing: boolean; + name: JSXTagNameExpression; + attributes: (JSXAttribute | JSXSpreadAttribute)[]; +} diff --git a/packages/ast-spec/src/jsx/JSXOpeningFragment/spec.ts b/packages/ast-spec/src/jsx/JSXOpeningFragment/spec.ts new file mode 100644 index 000000000000..9b972a237f22 --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXOpeningFragment/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface JSXOpeningFragment extends BaseNode { + type: AST_NODE_TYPES.JSXOpeningFragment; +} diff --git a/packages/ast-spec/src/jsx/JSXSpreadAttribute/spec.ts b/packages/ast-spec/src/jsx/JSXSpreadAttribute/spec.ts new file mode 100644 index 000000000000..db6e6fc1d1bc --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXSpreadAttribute/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; + +export interface JSXSpreadAttribute extends BaseNode { + type: AST_NODE_TYPES.JSXSpreadAttribute; + argument: Expression; +} diff --git a/packages/ast-spec/src/jsx/JSXSpreadChild/spec.ts b/packages/ast-spec/src/jsx/JSXSpreadChild/spec.ts new file mode 100644 index 000000000000..53fe53555c30 --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXSpreadChild/spec.ts @@ -0,0 +1,9 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; +import type { JSXEmptyExpression } from '../JSXEmptyExpression/spec'; + +export interface JSXSpreadChild extends BaseNode { + type: AST_NODE_TYPES.JSXSpreadChild; + expression: Expression | JSXEmptyExpression; +} diff --git a/packages/ast-spec/src/jsx/JSXText/spec.ts b/packages/ast-spec/src/jsx/JSXText/spec.ts new file mode 100644 index 000000000000..a323493fba90 --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXText/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface JSXText extends BaseNode { + type: AST_NODE_TYPES.JSXText; + value: string; + raw: string; +} diff --git a/packages/ast-spec/src/jsx/spec.ts b/packages/ast-spec/src/jsx/spec.ts new file mode 100644 index 000000000000..1efb134bed7f --- /dev/null +++ b/packages/ast-spec/src/jsx/spec.ts @@ -0,0 +1,13 @@ +export * from './JSXAttribute/spec'; +export * from './JSXClosingElement/spec'; +export * from './JSXClosingFragment/spec'; +export * from './JSXEmptyExpression/spec'; +export * from './JSXExpressionContainer/spec'; +export * from './JSXIdentifier/spec'; +export * from './JSXMemberExpression/spec'; +export * from './JSXNamespacedName/spec'; +export * from './JSXOpeningElement/spec'; +export * from './JSXOpeningFragment/spec'; +export * from './JSXSpreadAttribute/spec'; +export * from './JSXSpreadChild/spec'; +export * from './JSXText/spec'; diff --git a/packages/ast-spec/src/parameter/ArrayPattern/spec.ts b/packages/ast-spec/src/parameter/ArrayPattern/spec.ts new file mode 100644 index 000000000000..420a93278731 --- /dev/null +++ b/packages/ast-spec/src/parameter/ArrayPattern/spec.ts @@ -0,0 +1,13 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Decorator } from '../../special/Decorator/spec'; +import type { TSTypeAnnotation } from '../../special/TSTypeAnnotation/spec'; +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[]; +} diff --git a/packages/ast-spec/src/parameter/AssignmentPattern/spec.ts b/packages/ast-spec/src/parameter/AssignmentPattern/spec.ts new file mode 100644 index 000000000000..ee558c2167c2 --- /dev/null +++ b/packages/ast-spec/src/parameter/AssignmentPattern/spec.ts @@ -0,0 +1,15 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Decorator } from '../../special/Decorator/spec'; +import type { TSTypeAnnotation } from '../../special/TSTypeAnnotation/spec'; +import type { BindingName } from '../../unions/BindingName'; +import type { Expression } from '../../unions/Expression'; + +export interface AssignmentPattern extends BaseNode { + type: AST_NODE_TYPES.AssignmentPattern; + left: BindingName; + right: Expression; + typeAnnotation?: TSTypeAnnotation; + optional?: boolean; + decorators?: Decorator[]; +} diff --git a/packages/ast-spec/src/parameter/ObjectPattern/spec.ts b/packages/ast-spec/src/parameter/ObjectPattern/spec.ts new file mode 100644 index 000000000000..12c89878794e --- /dev/null +++ b/packages/ast-spec/src/parameter/ObjectPattern/spec.ts @@ -0,0 +1,14 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Property } from '../../element/Property/spec'; +import type { Decorator } from '../../special/Decorator/spec'; +import type { TSTypeAnnotation } from '../../special/TSTypeAnnotation/spec'; +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[]; +} diff --git a/packages/ast-spec/src/parameter/RestElement/spec.ts b/packages/ast-spec/src/parameter/RestElement/spec.ts new file mode 100644 index 000000000000..006f5e48ba3b --- /dev/null +++ b/packages/ast-spec/src/parameter/RestElement/spec.ts @@ -0,0 +1,15 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Decorator } from '../../special/Decorator/spec'; +import type { TSTypeAnnotation } from '../../special/TSTypeAnnotation/spec'; +import type { DestructuringPattern } from '../../unions/DestructuringPattern'; +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[]; +} diff --git a/packages/ast-spec/src/parameter/TSParameterProperty/spec.ts b/packages/ast-spec/src/parameter/TSParameterProperty/spec.ts new file mode 100644 index 000000000000..0cf3c4a911d0 --- /dev/null +++ b/packages/ast-spec/src/parameter/TSParameterProperty/spec.ts @@ -0,0 +1,18 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { Accessibility } from '../../base/Accessibility'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Decorator } from '../../special/Decorator/spec'; +import type { BindingName } from '../../unions/BindingName'; +import type { AssignmentPattern } from '../AssignmentPattern/spec'; +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; + parameter: AssignmentPattern | BindingName | RestElement; + decorators?: Decorator[]; +} diff --git a/packages/ast-spec/src/parameter/spec.ts b/packages/ast-spec/src/parameter/spec.ts new file mode 100644 index 000000000000..b006664a36ae --- /dev/null +++ b/packages/ast-spec/src/parameter/spec.ts @@ -0,0 +1,5 @@ +export * from './ArrayPattern/spec'; +export * from './AssignmentPattern/spec'; +export * from './ObjectPattern/spec'; +export * from './RestElement/spec'; +export * from './TSParameterProperty/spec'; diff --git a/packages/ast-spec/src/special/CatchClause/spec.ts b/packages/ast-spec/src/special/CatchClause/spec.ts new file mode 100644 index 000000000000..dea8168acda0 --- /dev/null +++ b/packages/ast-spec/src/special/CatchClause/spec.ts @@ -0,0 +1,10 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { BlockStatement } from '../../statement/BlockStatement/spec'; +import type { BindingName } from '../../unions/BindingName'; + +export interface CatchClause extends BaseNode { + type: AST_NODE_TYPES.CatchClause; + param: BindingName | null; + body: BlockStatement; +} diff --git a/packages/ast-spec/src/special/ClassBody/spec.ts b/packages/ast-spec/src/special/ClassBody/spec.ts new file mode 100644 index 000000000000..11c93d540fb3 --- /dev/null +++ b/packages/ast-spec/src/special/ClassBody/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { ClassElement } from '../../unions/ClassElement'; + +export interface ClassBody extends BaseNode { + type: AST_NODE_TYPES.ClassBody; + body: ClassElement[]; +} diff --git a/packages/ast-spec/src/special/Decorator/spec.ts b/packages/ast-spec/src/special/Decorator/spec.ts new file mode 100644 index 000000000000..3c8d1e819042 --- /dev/null +++ b/packages/ast-spec/src/special/Decorator/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { LeftHandSideExpression } from '../../unions/LeftHandSideExpression'; + +export interface Decorator extends BaseNode { + type: AST_NODE_TYPES.Decorator; + expression: LeftHandSideExpression; +} diff --git a/packages/ast-spec/src/special/EmptyStatement/spec.ts b/packages/ast-spec/src/special/EmptyStatement/spec.ts new file mode 100644 index 000000000000..530283d3bdc1 --- /dev/null +++ b/packages/ast-spec/src/special/EmptyStatement/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface EmptyStatement extends BaseNode { + type: AST_NODE_TYPES.EmptyStatement; +} diff --git a/packages/ast-spec/src/special/ExportSpecifier/spec.ts b/packages/ast-spec/src/special/ExportSpecifier/spec.ts new file mode 100644 index 000000000000..8fd038e92be6 --- /dev/null +++ b/packages/ast-spec/src/special/ExportSpecifier/spec.ts @@ -0,0 +1,9 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Identifier } from '../../expression/Identifier/spec'; + +export interface ExportSpecifier extends BaseNode { + type: AST_NODE_TYPES.ExportSpecifier; + local: Identifier; + exported: Identifier; +} diff --git a/packages/ast-spec/src/special/ImportDefaultSpecifier/spec.ts b/packages/ast-spec/src/special/ImportDefaultSpecifier/spec.ts new file mode 100644 index 000000000000..c4ad22f20340 --- /dev/null +++ b/packages/ast-spec/src/special/ImportDefaultSpecifier/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Identifier } from '../../expression/Identifier/spec'; + +export interface ImportDefaultSpecifier extends BaseNode { + type: AST_NODE_TYPES.ImportDefaultSpecifier; + local: Identifier; +} diff --git a/packages/ast-spec/src/special/ImportNamespaceSpecifier/spec.ts b/packages/ast-spec/src/special/ImportNamespaceSpecifier/spec.ts new file mode 100644 index 000000000000..eec79636f1fc --- /dev/null +++ b/packages/ast-spec/src/special/ImportNamespaceSpecifier/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Identifier } from '../../expression/Identifier/spec'; + +export interface ImportNamespaceSpecifier extends BaseNode { + type: AST_NODE_TYPES.ImportNamespaceSpecifier; + local: Identifier; +} diff --git a/packages/ast-spec/src/special/ImportSpecifier/spec.ts b/packages/ast-spec/src/special/ImportSpecifier/spec.ts new file mode 100644 index 000000000000..326df7db6b65 --- /dev/null +++ b/packages/ast-spec/src/special/ImportSpecifier/spec.ts @@ -0,0 +1,9 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Identifier } from '../../expression/Identifier/spec'; + +export interface ImportSpecifier extends BaseNode { + type: AST_NODE_TYPES.ImportSpecifier; + local: Identifier; + imported: Identifier; +} diff --git a/packages/ast-spec/src/special/PrivateIdentifier/spec.ts b/packages/ast-spec/src/special/PrivateIdentifier/spec.ts new file mode 100644 index 000000000000..f1d2172b8374 --- /dev/null +++ b/packages/ast-spec/src/special/PrivateIdentifier/spec.ts @@ -0,0 +1,7 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface PrivateIdentifier extends BaseNode { + type: AST_NODE_TYPES.PrivateIdentifier; + name: string; +} diff --git a/packages/ast-spec/src/special/Program/spec.ts b/packages/ast-spec/src/special/Program/spec.ts new file mode 100644 index 000000000000..81d69e1e604d --- /dev/null +++ b/packages/ast-spec/src/special/Program/spec.ts @@ -0,0 +1,13 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Comment } from '../../unions/Comment'; +import type { ProgramStatement } from '../../unions/Statement'; +import type { Token } from '../../unions/Token'; + +export interface Program extends BaseNode { + type: AST_NODE_TYPES.Program; + body: ProgramStatement[]; + sourceType: 'module' | 'script'; + comments?: Comment[]; + tokens?: Token[]; +} diff --git a/packages/ast-spec/src/special/SwitchCase/spec.ts b/packages/ast-spec/src/special/SwitchCase/spec.ts new file mode 100644 index 000000000000..f48f323536a4 --- /dev/null +++ b/packages/ast-spec/src/special/SwitchCase/spec.ts @@ -0,0 +1,10 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; +import type { Statement } from '../../unions/Statement'; + +export interface SwitchCase extends BaseNode { + type: AST_NODE_TYPES.SwitchCase; + test: Expression | null; + consequent: Statement[]; +} diff --git a/packages/ast-spec/src/special/TSClassImplements/spec.ts b/packages/ast-spec/src/special/TSClassImplements/spec.ts new file mode 100644 index 000000000000..98213713edc4 --- /dev/null +++ b/packages/ast-spec/src/special/TSClassImplements/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { TSHeritageBase } from '../../base/TSHeritageBase'; + +export interface TSClassImplements extends TSHeritageBase { + type: AST_NODE_TYPES.TSClassImplements; +} diff --git a/packages/ast-spec/src/special/TSExternalModuleReference/spec.ts b/packages/ast-spec/src/special/TSExternalModuleReference/spec.ts new file mode 100644 index 000000000000..e634d4d0d6e9 --- /dev/null +++ b/packages/ast-spec/src/special/TSExternalModuleReference/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; + +export interface TSExternalModuleReference extends BaseNode { + type: AST_NODE_TYPES.TSExternalModuleReference; + expression: Expression; +} diff --git a/packages/ast-spec/src/special/TSInterfaceBody/spec.ts b/packages/ast-spec/src/special/TSInterfaceBody/spec.ts new file mode 100644 index 000000000000..1ee1c901c14d --- /dev/null +++ b/packages/ast-spec/src/special/TSInterfaceBody/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TypeElement } from '../../unions/TypeElement'; + +export interface TSInterfaceBody extends BaseNode { + type: AST_NODE_TYPES.TSInterfaceBody; + body: TypeElement[]; +} diff --git a/packages/ast-spec/src/special/TSInterfaceHeritage/spec.ts b/packages/ast-spec/src/special/TSInterfaceHeritage/spec.ts new file mode 100644 index 000000000000..29382acd5460 --- /dev/null +++ b/packages/ast-spec/src/special/TSInterfaceHeritage/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { TSHeritageBase } from '../../base/TSHeritageBase'; + +export interface TSInterfaceHeritage extends TSHeritageBase { + type: AST_NODE_TYPES.TSInterfaceHeritage; +} diff --git a/packages/ast-spec/src/special/TSModuleBlock/spec.ts b/packages/ast-spec/src/special/TSModuleBlock/spec.ts new file mode 100644 index 000000000000..9fed19af3b80 --- /dev/null +++ b/packages/ast-spec/src/special/TSModuleBlock/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { ProgramStatement } from '../../unions/Statement'; + +export interface TSModuleBlock extends BaseNode { + type: AST_NODE_TYPES.TSModuleBlock; + body: ProgramStatement[]; +} diff --git a/packages/ast-spec/src/special/TSTypeAnnotation/spec.ts b/packages/ast-spec/src/special/TSTypeAnnotation/spec.ts new file mode 100644 index 000000000000..bb9272353cbc --- /dev/null +++ b/packages/ast-spec/src/special/TSTypeAnnotation/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TypeNode } from '../../unions/TypeNode'; + +export interface TSTypeAnnotation extends BaseNode { + type: AST_NODE_TYPES.TSTypeAnnotation; + typeAnnotation: TypeNode; +} diff --git a/packages/ast-spec/src/special/TSTypeParameter/spec.ts b/packages/ast-spec/src/special/TSTypeParameter/spec.ts new file mode 100644 index 000000000000..61d75a6a29ed --- /dev/null +++ b/packages/ast-spec/src/special/TSTypeParameter/spec.ts @@ -0,0 +1,11 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Identifier } from '../../expression/Identifier/spec'; +import type { TypeNode } from '../../unions/TypeNode'; + +export interface TSTypeParameter extends BaseNode { + type: AST_NODE_TYPES.TSTypeParameter; + name: Identifier; + constraint?: TypeNode; + default?: TypeNode; +} diff --git a/packages/ast-spec/src/special/TSTypeParameterDeclaration/spec.ts b/packages/ast-spec/src/special/TSTypeParameterDeclaration/spec.ts new file mode 100644 index 000000000000..ac8971e38a0c --- /dev/null +++ b/packages/ast-spec/src/special/TSTypeParameterDeclaration/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TSTypeParameter } from '../TSTypeParameter/spec'; + +export interface TSTypeParameterDeclaration extends BaseNode { + type: AST_NODE_TYPES.TSTypeParameterDeclaration; + params: TSTypeParameter[]; +} diff --git a/packages/ast-spec/src/special/TSTypeParameterInstantiation/spec.ts b/packages/ast-spec/src/special/TSTypeParameterInstantiation/spec.ts new file mode 100644 index 000000000000..e5122c2f6a5c --- /dev/null +++ b/packages/ast-spec/src/special/TSTypeParameterInstantiation/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TypeNode } from '../../unions/TypeNode'; + +export interface TSTypeParameterInstantiation extends BaseNode { + type: AST_NODE_TYPES.TSTypeParameterInstantiation; + params: TypeNode[]; +} diff --git a/packages/ast-spec/src/special/TemplateElement/spec.ts b/packages/ast-spec/src/special/TemplateElement/spec.ts new file mode 100644 index 000000000000..abf4dc910457 --- /dev/null +++ b/packages/ast-spec/src/special/TemplateElement/spec.ts @@ -0,0 +1,11 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface TemplateElement extends BaseNode { + type: AST_NODE_TYPES.TemplateElement; + value: { + raw: string; + cooked: string; + }; + tail: boolean; +} diff --git a/packages/ast-spec/src/special/VariableDeclarator/spec.ts b/packages/ast-spec/src/special/VariableDeclarator/spec.ts new file mode 100644 index 000000000000..619c6a57d5dc --- /dev/null +++ b/packages/ast-spec/src/special/VariableDeclarator/spec.ts @@ -0,0 +1,11 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { BindingName } from '../../unions/BindingName'; +import type { Expression } from '../../unions/Expression'; + +export interface VariableDeclarator extends BaseNode { + type: AST_NODE_TYPES.VariableDeclarator; + id: BindingName; + init: Expression | null; + definite?: boolean; +} diff --git a/packages/ast-spec/src/special/spec.ts b/packages/ast-spec/src/special/spec.ts new file mode 100644 index 000000000000..91e5037751d7 --- /dev/null +++ b/packages/ast-spec/src/special/spec.ts @@ -0,0 +1,22 @@ +export * from './CatchClause/spec'; +export * from './ClassBody/spec'; +export * from './Decorator/spec'; +export * from './EmptyStatement/spec'; +export * from './ExportSpecifier/spec'; +export * from './ImportDefaultSpecifier/spec'; +export * from './ImportNamespaceSpecifier/spec'; +export * from './ImportSpecifier/spec'; +export * from './PrivateIdentifier/spec'; +export * from './Program/spec'; +export * from './SwitchCase/spec'; +export * from './TSClassImplements/spec'; +export * from './TSExternalModuleReference/spec'; +export * from './TSInterfaceBody/spec'; +export * from './TSInterfaceHeritage/spec'; +export * from './TSModuleBlock/spec'; +export * from './TSTypeAnnotation/spec'; +export * from './TSTypeParameter/spec'; +export * from './TSTypeParameterDeclaration/spec'; +export * from './TSTypeParameterInstantiation/spec'; +export * from './TemplateElement/spec'; +export * from './VariableDeclarator/spec'; diff --git a/packages/ast-spec/src/statement/BlockStatement/spec.ts b/packages/ast-spec/src/statement/BlockStatement/spec.ts new file mode 100644 index 000000000000..298a962e5161 --- /dev/null +++ b/packages/ast-spec/src/statement/BlockStatement/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Statement } from '../../unions/Statement'; + +export interface BlockStatement extends BaseNode { + type: AST_NODE_TYPES.BlockStatement; + body: Statement[]; +} diff --git a/packages/ast-spec/src/statement/BreakStatement/spec.ts b/packages/ast-spec/src/statement/BreakStatement/spec.ts new file mode 100644 index 000000000000..0441c298d365 --- /dev/null +++ b/packages/ast-spec/src/statement/BreakStatement/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Identifier } from '../../expression/Identifier/spec'; + +export interface BreakStatement extends BaseNode { + type: AST_NODE_TYPES.BreakStatement; + label: Identifier | null; +} diff --git a/packages/ast-spec/src/statement/ContinueStatement/spec.ts b/packages/ast-spec/src/statement/ContinueStatement/spec.ts new file mode 100644 index 000000000000..70f2373dc217 --- /dev/null +++ b/packages/ast-spec/src/statement/ContinueStatement/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Identifier } from '../../expression/Identifier/spec'; + +export interface ContinueStatement extends BaseNode { + type: AST_NODE_TYPES.ContinueStatement; + label: Identifier | null; +} diff --git a/packages/ast-spec/src/statement/DebuggerStatement/spec.ts b/packages/ast-spec/src/statement/DebuggerStatement/spec.ts new file mode 100644 index 000000000000..f28b7fc41b72 --- /dev/null +++ b/packages/ast-spec/src/statement/DebuggerStatement/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface DebuggerStatement extends BaseNode { + type: AST_NODE_TYPES.DebuggerStatement; +} diff --git a/packages/ast-spec/src/statement/DoWhileStatement/spec.ts b/packages/ast-spec/src/statement/DoWhileStatement/spec.ts new file mode 100644 index 000000000000..933ce61b2c4c --- /dev/null +++ b/packages/ast-spec/src/statement/DoWhileStatement/spec.ts @@ -0,0 +1,10 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; +import type { Statement } from '../../unions/Statement'; + +export interface DoWhileStatement extends BaseNode { + type: AST_NODE_TYPES.DoWhileStatement; + test: Expression; + body: Statement; +} diff --git a/packages/ast-spec/src/statement/ExpressionStatement/spec.ts b/packages/ast-spec/src/statement/ExpressionStatement/spec.ts new file mode 100644 index 000000000000..f5fd336a9604 --- /dev/null +++ b/packages/ast-spec/src/statement/ExpressionStatement/spec.ts @@ -0,0 +1,9 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; + +export interface ExpressionStatement extends BaseNode { + type: AST_NODE_TYPES.ExpressionStatement; + expression: Expression; + directive?: string; +} diff --git a/packages/ast-spec/src/statement/ForInStatement/spec.ts b/packages/ast-spec/src/statement/ForInStatement/spec.ts new file mode 100644 index 000000000000..7abe3b2f5fad --- /dev/null +++ b/packages/ast-spec/src/statement/ForInStatement/spec.ts @@ -0,0 +1,12 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; +import type { ForInitialiser } from '../../unions/ForInitialiser'; +import type { Statement } from '../../unions/Statement'; + +export interface ForInStatement extends BaseNode { + type: AST_NODE_TYPES.ForInStatement; + left: ForInitialiser; + right: Expression; + body: Statement; +} diff --git a/packages/ast-spec/src/statement/ForOfStatement/spec.ts b/packages/ast-spec/src/statement/ForOfStatement/spec.ts new file mode 100644 index 000000000000..963261eaaac8 --- /dev/null +++ b/packages/ast-spec/src/statement/ForOfStatement/spec.ts @@ -0,0 +1,13 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; +import type { ForInitialiser } from '../../unions/ForInitialiser'; +import type { Statement } from '../../unions/Statement'; + +export interface ForOfStatement extends BaseNode { + type: AST_NODE_TYPES.ForOfStatement; + left: ForInitialiser; + right: Expression; + body: Statement; + await: boolean; +} diff --git a/packages/ast-spec/src/statement/ForStatement/spec.ts b/packages/ast-spec/src/statement/ForStatement/spec.ts new file mode 100644 index 000000000000..1b56756b3a50 --- /dev/null +++ b/packages/ast-spec/src/statement/ForStatement/spec.ts @@ -0,0 +1,13 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; +import type { ForInitialiser } from '../../unions/ForInitialiser'; +import type { Statement } from '../../unions/Statement'; + +export interface ForStatement extends BaseNode { + type: AST_NODE_TYPES.ForStatement; + init: Expression | ForInitialiser | null; + test: Expression | null; + update: Expression | null; + body: Statement; +} diff --git a/packages/ast-spec/src/statement/IfStatement/spec.ts b/packages/ast-spec/src/statement/IfStatement/spec.ts new file mode 100644 index 000000000000..f9081923e64a --- /dev/null +++ b/packages/ast-spec/src/statement/IfStatement/spec.ts @@ -0,0 +1,11 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; +import type { Statement } from '../../unions/Statement'; + +export interface IfStatement extends BaseNode { + type: AST_NODE_TYPES.IfStatement; + test: Expression; + consequent: Statement; + alternate: Statement | null; +} diff --git a/packages/ast-spec/src/statement/LabeledStatement/spec.ts b/packages/ast-spec/src/statement/LabeledStatement/spec.ts new file mode 100644 index 000000000000..d007008d3a4b --- /dev/null +++ b/packages/ast-spec/src/statement/LabeledStatement/spec.ts @@ -0,0 +1,10 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Identifier } from '../../expression/Identifier/spec'; +import type { Statement } from '../../unions/Statement'; + +export interface LabeledStatement extends BaseNode { + type: AST_NODE_TYPES.LabeledStatement; + label: Identifier; + body: Statement; +} diff --git a/packages/ast-spec/src/statement/ReturnStatement/spec.ts b/packages/ast-spec/src/statement/ReturnStatement/spec.ts new file mode 100644 index 000000000000..d7758715c8dd --- /dev/null +++ b/packages/ast-spec/src/statement/ReturnStatement/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; + +export interface ReturnStatement extends BaseNode { + type: AST_NODE_TYPES.ReturnStatement; + argument: Expression | null; +} diff --git a/packages/ast-spec/src/statement/SwitchStatement/spec.ts b/packages/ast-spec/src/statement/SwitchStatement/spec.ts new file mode 100644 index 000000000000..9c76f81455c8 --- /dev/null +++ b/packages/ast-spec/src/statement/SwitchStatement/spec.ts @@ -0,0 +1,10 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { SwitchCase } from '../../special/SwitchCase/spec'; +import type { Expression } from '../../unions/Expression'; + +export interface SwitchStatement extends BaseNode { + type: AST_NODE_TYPES.SwitchStatement; + discriminant: Expression; + cases: SwitchCase[]; +} diff --git a/packages/ast-spec/src/statement/TSExportAssignment/spec.ts b/packages/ast-spec/src/statement/TSExportAssignment/spec.ts new file mode 100644 index 000000000000..3792bc5012b1 --- /dev/null +++ b/packages/ast-spec/src/statement/TSExportAssignment/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; + +export interface TSExportAssignment extends BaseNode { + type: AST_NODE_TYPES.TSExportAssignment; + expression: Expression; +} diff --git a/packages/ast-spec/src/statement/ThrowStatement/spec.ts b/packages/ast-spec/src/statement/ThrowStatement/spec.ts new file mode 100644 index 000000000000..ac47bd98778c --- /dev/null +++ b/packages/ast-spec/src/statement/ThrowStatement/spec.ts @@ -0,0 +1,9 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TSAsExpression } from '../../expression/TSAsExpression/spec'; +import type { Statement } from '../../unions/Statement'; + +export interface ThrowStatement extends BaseNode { + type: AST_NODE_TYPES.ThrowStatement; + argument: Statement | TSAsExpression | null; +} diff --git a/packages/ast-spec/src/statement/TryStatement/spec.ts b/packages/ast-spec/src/statement/TryStatement/spec.ts new file mode 100644 index 000000000000..0435fbeb2100 --- /dev/null +++ b/packages/ast-spec/src/statement/TryStatement/spec.ts @@ -0,0 +1,11 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { CatchClause } from '../../special/CatchClause/spec'; +import type { BlockStatement } from '../BlockStatement/spec'; + +export interface TryStatement extends BaseNode { + type: AST_NODE_TYPES.TryStatement; + block: BlockStatement; + handler: CatchClause | null; + finalizer: BlockStatement | null; +} diff --git a/packages/ast-spec/src/statement/WhileStatement/spec.ts b/packages/ast-spec/src/statement/WhileStatement/spec.ts new file mode 100644 index 000000000000..1c9492c77140 --- /dev/null +++ b/packages/ast-spec/src/statement/WhileStatement/spec.ts @@ -0,0 +1,10 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; +import type { Statement } from '../../unions/Statement'; + +export interface WhileStatement extends BaseNode { + type: AST_NODE_TYPES.WhileStatement; + test: Expression; + body: Statement; +} diff --git a/packages/ast-spec/src/statement/WithStatement/spec.ts b/packages/ast-spec/src/statement/WithStatement/spec.ts new file mode 100644 index 000000000000..c661a5175b9a --- /dev/null +++ b/packages/ast-spec/src/statement/WithStatement/spec.ts @@ -0,0 +1,10 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; +import type { Statement } from '../../unions/Statement'; + +export interface WithStatement extends BaseNode { + type: AST_NODE_TYPES.WithStatement; + object: Expression; + body: Statement; +} diff --git a/packages/ast-spec/src/statement/spec.ts b/packages/ast-spec/src/statement/spec.ts new file mode 100644 index 000000000000..2621cf53004e --- /dev/null +++ b/packages/ast-spec/src/statement/spec.ts @@ -0,0 +1,18 @@ +export * from './BlockStatement/spec'; +export * from './BreakStatement/spec'; +export * from './ContinueStatement/spec'; +export * from './DebuggerStatement/spec'; +export * from './DoWhileStatement/spec'; +export * from './ExpressionStatement/spec'; +export * from './ForInStatement/spec'; +export * from './ForOfStatement/spec'; +export * from './ForStatement/spec'; +export * from './IfStatement/spec'; +export * from './LabeledStatement/spec'; +export * from './ReturnStatement/spec'; +export * from './SwitchStatement/spec'; +export * from './TSExportAssignment/spec'; +export * from './ThrowStatement/spec'; +export * from './TryStatement/spec'; +export * from './WhileStatement/spec'; +export * from './WithStatement/spec'; diff --git a/packages/ast-spec/src/token/BlockComment/spec.ts b/packages/ast-spec/src/token/BlockComment/spec.ts new file mode 100644 index 000000000000..c2c7db298a4f --- /dev/null +++ b/packages/ast-spec/src/token/BlockComment/spec.ts @@ -0,0 +1,6 @@ +import type { AST_TOKEN_TYPES } from '../../ast-token-types'; +import type { BaseToken } from '../../base/BaseToken'; + +export interface BlockComment extends BaseToken { + type: AST_TOKEN_TYPES.Block; +} diff --git a/packages/ast-spec/src/token/BooleanToken/spec.ts b/packages/ast-spec/src/token/BooleanToken/spec.ts new file mode 100644 index 000000000000..eeace18c8cd9 --- /dev/null +++ b/packages/ast-spec/src/token/BooleanToken/spec.ts @@ -0,0 +1,6 @@ +import type { AST_TOKEN_TYPES } from '../../ast-token-types'; +import type { BaseToken } from '../../base/BaseToken'; + +export interface BooleanToken extends BaseToken { + type: AST_TOKEN_TYPES.Boolean; +} diff --git a/packages/ast-spec/src/token/IdentifierToken/spec.ts b/packages/ast-spec/src/token/IdentifierToken/spec.ts new file mode 100644 index 000000000000..9df6e14c3c99 --- /dev/null +++ b/packages/ast-spec/src/token/IdentifierToken/spec.ts @@ -0,0 +1,6 @@ +import type { AST_TOKEN_TYPES } from '../../ast-token-types'; +import type { BaseToken } from '../../base/BaseToken'; + +export interface IdentifierToken extends BaseToken { + type: AST_TOKEN_TYPES.Identifier; +} diff --git a/packages/ast-spec/src/token/JSXIdentifierToken/spec.ts b/packages/ast-spec/src/token/JSXIdentifierToken/spec.ts new file mode 100644 index 000000000000..858775073735 --- /dev/null +++ b/packages/ast-spec/src/token/JSXIdentifierToken/spec.ts @@ -0,0 +1,6 @@ +import type { AST_TOKEN_TYPES } from '../../ast-token-types'; +import type { BaseToken } from '../../base/BaseToken'; + +export interface JSXIdentifierToken extends BaseToken { + type: AST_TOKEN_TYPES.JSXIdentifier; +} diff --git a/packages/ast-spec/src/token/JSXTextToken/spec.ts b/packages/ast-spec/src/token/JSXTextToken/spec.ts new file mode 100644 index 000000000000..6a8d3aa5d50d --- /dev/null +++ b/packages/ast-spec/src/token/JSXTextToken/spec.ts @@ -0,0 +1,6 @@ +import type { AST_TOKEN_TYPES } from '../../ast-token-types'; +import type { BaseToken } from '../../base/BaseToken'; + +export interface JSXTextToken extends BaseToken { + type: AST_TOKEN_TYPES.JSXText; +} diff --git a/packages/ast-spec/src/token/KeywordToken/spec.ts b/packages/ast-spec/src/token/KeywordToken/spec.ts new file mode 100644 index 000000000000..b7e9c058f692 --- /dev/null +++ b/packages/ast-spec/src/token/KeywordToken/spec.ts @@ -0,0 +1,6 @@ +import type { AST_TOKEN_TYPES } from '../../ast-token-types'; +import type { BaseToken } from '../../base/BaseToken'; + +export interface KeywordToken extends BaseToken { + type: AST_TOKEN_TYPES.Keyword; +} diff --git a/packages/ast-spec/src/token/LineComment/spec.ts b/packages/ast-spec/src/token/LineComment/spec.ts new file mode 100644 index 000000000000..82db26f07442 --- /dev/null +++ b/packages/ast-spec/src/token/LineComment/spec.ts @@ -0,0 +1,6 @@ +import type { AST_TOKEN_TYPES } from '../../ast-token-types'; +import type { BaseToken } from '../../base/BaseToken'; + +export interface LineComment extends BaseToken { + type: AST_TOKEN_TYPES.Line; +} diff --git a/packages/ast-spec/src/token/NullToken/spec.ts b/packages/ast-spec/src/token/NullToken/spec.ts new file mode 100644 index 000000000000..d5ae492de83a --- /dev/null +++ b/packages/ast-spec/src/token/NullToken/spec.ts @@ -0,0 +1,6 @@ +import type { AST_TOKEN_TYPES } from '../../ast-token-types'; +import type { BaseToken } from '../../base/BaseToken'; + +export interface NullToken extends BaseToken { + type: AST_TOKEN_TYPES.Null; +} diff --git a/packages/ast-spec/src/token/NumericToken/spec.ts b/packages/ast-spec/src/token/NumericToken/spec.ts new file mode 100644 index 000000000000..a00fd383df75 --- /dev/null +++ b/packages/ast-spec/src/token/NumericToken/spec.ts @@ -0,0 +1,6 @@ +import type { AST_TOKEN_TYPES } from '../../ast-token-types'; +import type { BaseToken } from '../../base/BaseToken'; + +export interface NumericToken extends BaseToken { + type: AST_TOKEN_TYPES.Numeric; +} diff --git a/packages/ast-spec/src/token/PunctuatorToken/PunctuatorTokenToText.ts b/packages/ast-spec/src/token/PunctuatorToken/PunctuatorTokenToText.ts new file mode 100644 index 000000000000..d15682a4efe7 --- /dev/null +++ b/packages/ast-spec/src/token/PunctuatorToken/PunctuatorTokenToText.ts @@ -0,0 +1,65 @@ +import type { SyntaxKind } from 'typescript'; + +export interface PunctuatorTokenToText { + [SyntaxKind.OpenBraceToken]: '{'; + [SyntaxKind.CloseBraceToken]: '}'; + [SyntaxKind.OpenParenToken]: '('; + [SyntaxKind.CloseParenToken]: ')'; + [SyntaxKind.OpenBracketToken]: '['; + [SyntaxKind.CloseBracketToken]: ']'; + [SyntaxKind.DotToken]: '.'; + [SyntaxKind.DotDotDotToken]: '...'; + [SyntaxKind.SemicolonToken]: ';'; + [SyntaxKind.CommaToken]: ','; + [SyntaxKind.QuestionDotToken]: '?.'; + [SyntaxKind.LessThanToken]: '<'; + [SyntaxKind.LessThanSlashToken]: ''; + [SyntaxKind.LessThanEqualsToken]: '<='; + [SyntaxKind.GreaterThanEqualsToken]: '>='; + [SyntaxKind.EqualsEqualsToken]: '=='; + [SyntaxKind.ExclamationEqualsToken]: '!='; + [SyntaxKind.EqualsEqualsEqualsToken]: '==='; + [SyntaxKind.ExclamationEqualsEqualsToken]: '!=='; + [SyntaxKind.EqualsGreaterThanToken]: '=>'; + [SyntaxKind.PlusToken]: '+'; + [SyntaxKind.MinusToken]: '-'; + [SyntaxKind.AsteriskToken]: '*'; + [SyntaxKind.AsteriskAsteriskToken]: '**'; + [SyntaxKind.SlashToken]: '/'; + [SyntaxKind.PercentToken]: '%'; + [SyntaxKind.PlusPlusToken]: '++'; + [SyntaxKind.MinusMinusToken]: '--'; + [SyntaxKind.LessThanLessThanToken]: '<<'; + [SyntaxKind.GreaterThanGreaterThanToken]: '>>'; + [SyntaxKind.GreaterThanGreaterThanGreaterThanToken]: '>>>'; + [SyntaxKind.AmpersandToken]: '&'; + [SyntaxKind.BarToken]: '|'; + [SyntaxKind.CaretToken]: '^'; + [SyntaxKind.ExclamationToken]: '!'; + [SyntaxKind.TildeToken]: '~'; + [SyntaxKind.AmpersandAmpersandToken]: '&&'; + [SyntaxKind.BarBarToken]: '||'; + [SyntaxKind.QuestionToken]: '?'; + [SyntaxKind.ColonToken]: ':'; + [SyntaxKind.AtToken]: '@'; + [SyntaxKind.QuestionQuestionToken]: '??'; + [SyntaxKind.BacktickToken]: '`'; + [SyntaxKind.HashToken]: '#'; + [SyntaxKind.EqualsToken]: '='; + [SyntaxKind.PlusEqualsToken]: '+='; + [SyntaxKind.MinusEqualsToken]: '-='; + [SyntaxKind.AsteriskEqualsToken]: '*='; + [SyntaxKind.AsteriskAsteriskEqualsToken]: '**='; + [SyntaxKind.SlashEqualsToken]: '/='; + [SyntaxKind.PercentEqualsToken]: '%='; + [SyntaxKind.LessThanLessThanEqualsToken]: '<<='; + [SyntaxKind.GreaterThanGreaterThanEqualsToken]: '>>='; + [SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken]: '>>>='; + [SyntaxKind.AmpersandEqualsToken]: '&='; + [SyntaxKind.BarEqualsToken]: '|='; + [SyntaxKind.BarBarEqualsToken]: '||='; + [SyntaxKind.AmpersandAmpersandEqualsToken]: '&&='; + [SyntaxKind.QuestionQuestionEqualsToken]: '??='; + [SyntaxKind.CaretEqualsToken]: '^='; +} diff --git a/packages/ast-spec/src/token/PunctuatorToken/spec.ts b/packages/ast-spec/src/token/PunctuatorToken/spec.ts new file mode 100644 index 000000000000..68156aad6638 --- /dev/null +++ b/packages/ast-spec/src/token/PunctuatorToken/spec.ts @@ -0,0 +1,12 @@ +import type { AST_TOKEN_TYPES } from '../../ast-token-types'; +import type { BaseToken } from '../../base/BaseToken'; +import type { PunctuatorTokenToText } from './PunctuatorTokenToText'; + +export * from './PunctuatorTokenToText'; + +type ValueOf = T[keyof T]; + +export interface PunctuatorToken extends BaseToken { + type: AST_TOKEN_TYPES.Punctuator; + value: ValueOf; +} diff --git a/packages/ast-spec/src/token/RegularExpressionToken/spec.ts b/packages/ast-spec/src/token/RegularExpressionToken/spec.ts new file mode 100644 index 000000000000..7b0bb09d5262 --- /dev/null +++ b/packages/ast-spec/src/token/RegularExpressionToken/spec.ts @@ -0,0 +1,10 @@ +import type { AST_TOKEN_TYPES } from '../../ast-token-types'; +import type { BaseToken } from '../../base/BaseToken'; + +export interface RegularExpressionToken extends BaseToken { + type: AST_TOKEN_TYPES.RegularExpression; + regex: { + pattern: string; + flags: string; + }; +} diff --git a/packages/ast-spec/src/token/StringToken/spec.ts b/packages/ast-spec/src/token/StringToken/spec.ts new file mode 100644 index 000000000000..6b6535c6208d --- /dev/null +++ b/packages/ast-spec/src/token/StringToken/spec.ts @@ -0,0 +1,6 @@ +import type { AST_TOKEN_TYPES } from '../../ast-token-types'; +import type { BaseToken } from '../../base/BaseToken'; + +export interface StringToken extends BaseToken { + type: AST_TOKEN_TYPES.String; +} diff --git a/packages/ast-spec/src/token/TSAbstractKeyword/spec.ts b/packages/ast-spec/src/token/TSAbstractKeyword/spec.ts new file mode 100644 index 000000000000..d15a55443c57 --- /dev/null +++ b/packages/ast-spec/src/token/TSAbstractKeyword/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface TSAbstractKeyword extends BaseNode { + type: AST_NODE_TYPES.TSAbstractKeyword; +} diff --git a/packages/ast-spec/src/token/TSAsyncKeyword/spec.ts b/packages/ast-spec/src/token/TSAsyncKeyword/spec.ts new file mode 100644 index 000000000000..26baddf7ad64 --- /dev/null +++ b/packages/ast-spec/src/token/TSAsyncKeyword/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface TSAsyncKeyword extends BaseNode { + type: AST_NODE_TYPES.TSAsyncKeyword; +} diff --git a/packages/ast-spec/src/token/TSDeclareKeyword/spec.ts b/packages/ast-spec/src/token/TSDeclareKeyword/spec.ts new file mode 100644 index 000000000000..8b6e6606b3e8 --- /dev/null +++ b/packages/ast-spec/src/token/TSDeclareKeyword/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface TSDeclareKeyword extends BaseNode { + type: AST_NODE_TYPES.TSDeclareKeyword; +} diff --git a/packages/ast-spec/src/token/TSExportKeyword/spec.ts b/packages/ast-spec/src/token/TSExportKeyword/spec.ts new file mode 100644 index 000000000000..016664d11b03 --- /dev/null +++ b/packages/ast-spec/src/token/TSExportKeyword/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface TSExportKeyword extends BaseNode { + type: AST_NODE_TYPES.TSExportKeyword; +} diff --git a/packages/ast-spec/src/token/TSPrivateKeyword/spec.ts b/packages/ast-spec/src/token/TSPrivateKeyword/spec.ts new file mode 100644 index 000000000000..ae57db0a066c --- /dev/null +++ b/packages/ast-spec/src/token/TSPrivateKeyword/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface TSPrivateKeyword extends BaseNode { + type: AST_NODE_TYPES.TSPrivateKeyword; +} diff --git a/packages/ast-spec/src/token/TSProtectedKeyword/spec.ts b/packages/ast-spec/src/token/TSProtectedKeyword/spec.ts new file mode 100644 index 000000000000..815b28a1c2c1 --- /dev/null +++ b/packages/ast-spec/src/token/TSProtectedKeyword/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface TSProtectedKeyword extends BaseNode { + type: AST_NODE_TYPES.TSProtectedKeyword; +} diff --git a/packages/ast-spec/src/token/TSPublicKeyword/spec.ts b/packages/ast-spec/src/token/TSPublicKeyword/spec.ts new file mode 100644 index 000000000000..3409fc6d689a --- /dev/null +++ b/packages/ast-spec/src/token/TSPublicKeyword/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface TSPublicKeyword extends BaseNode { + type: AST_NODE_TYPES.TSPublicKeyword; +} diff --git a/packages/ast-spec/src/token/TSReadonlyKeyword/spec.ts b/packages/ast-spec/src/token/TSReadonlyKeyword/spec.ts new file mode 100644 index 000000000000..462849972785 --- /dev/null +++ b/packages/ast-spec/src/token/TSReadonlyKeyword/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface TSReadonlyKeyword extends BaseNode { + type: AST_NODE_TYPES.TSReadonlyKeyword; +} diff --git a/packages/ast-spec/src/token/TSStaticKeyword/spec.ts b/packages/ast-spec/src/token/TSStaticKeyword/spec.ts new file mode 100644 index 000000000000..1c2417eeb589 --- /dev/null +++ b/packages/ast-spec/src/token/TSStaticKeyword/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface TSStaticKeyword extends BaseNode { + type: AST_NODE_TYPES.TSStaticKeyword; +} diff --git a/packages/ast-spec/src/token/TemplateToken/spec.ts b/packages/ast-spec/src/token/TemplateToken/spec.ts new file mode 100644 index 000000000000..da64ef0b6e98 --- /dev/null +++ b/packages/ast-spec/src/token/TemplateToken/spec.ts @@ -0,0 +1,6 @@ +import type { AST_TOKEN_TYPES } from '../../ast-token-types'; +import type { BaseToken } from '../../base/BaseToken'; + +export interface TemplateToken extends BaseToken { + type: AST_TOKEN_TYPES.Template; +} diff --git a/packages/ast-spec/src/token/spec.ts b/packages/ast-spec/src/token/spec.ts new file mode 100644 index 000000000000..45df05189eb2 --- /dev/null +++ b/packages/ast-spec/src/token/spec.ts @@ -0,0 +1,22 @@ +export * from './BlockComment/spec'; +export * from './BooleanToken/spec'; +export * from './IdentifierToken/spec'; +export * from './JSXIdentifierToken/spec'; +export * from './JSXTextToken/spec'; +export * from './KeywordToken/spec'; +export * from './LineComment/spec'; +export * from './NullToken/spec'; +export * from './NumericToken/spec'; +export * from './PunctuatorToken/spec'; +export * from './RegularExpressionToken/spec'; +export * from './StringToken/spec'; +export * from './TSAbstractKeyword/spec'; +export * from './TSAsyncKeyword/spec'; +export * from './TSDeclareKeyword/spec'; +export * from './TSExportKeyword/spec'; +export * from './TSPrivateKeyword/spec'; +export * from './TSProtectedKeyword/spec'; +export * from './TSPublicKeyword/spec'; +export * from './TSReadonlyKeyword/spec'; +export * from './TSStaticKeyword/spec'; +export * from './TemplateToken/spec'; diff --git a/packages/ast-spec/src/type/TSAnyKeyword/spec.ts b/packages/ast-spec/src/type/TSAnyKeyword/spec.ts new file mode 100644 index 000000000000..a9e2ba977f1d --- /dev/null +++ b/packages/ast-spec/src/type/TSAnyKeyword/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface TSAnyKeyword extends BaseNode { + type: AST_NODE_TYPES.TSAnyKeyword; +} diff --git a/packages/ast-spec/src/type/TSArrayType/spec.ts b/packages/ast-spec/src/type/TSArrayType/spec.ts new file mode 100644 index 000000000000..f7aa4f16a596 --- /dev/null +++ b/packages/ast-spec/src/type/TSArrayType/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TypeNode } from '../../unions/TypeNode'; + +export interface TSArrayType extends BaseNode { + type: AST_NODE_TYPES.TSArrayType; + elementType: TypeNode; +} diff --git a/packages/ast-spec/src/type/TSBigIntKeyword/spec.ts b/packages/ast-spec/src/type/TSBigIntKeyword/spec.ts new file mode 100644 index 000000000000..fc18a9519dee --- /dev/null +++ b/packages/ast-spec/src/type/TSBigIntKeyword/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface TSBigIntKeyword extends BaseNode { + type: AST_NODE_TYPES.TSBigIntKeyword; +} diff --git a/packages/ast-spec/src/type/TSBooleanKeyword/spec.ts b/packages/ast-spec/src/type/TSBooleanKeyword/spec.ts new file mode 100644 index 000000000000..89438151de1f --- /dev/null +++ b/packages/ast-spec/src/type/TSBooleanKeyword/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface TSBooleanKeyword extends BaseNode { + type: AST_NODE_TYPES.TSBooleanKeyword; +} diff --git a/packages/ast-spec/src/type/TSConditionalType/spec.ts b/packages/ast-spec/src/type/TSConditionalType/spec.ts new file mode 100644 index 000000000000..979fcb3e6026 --- /dev/null +++ b/packages/ast-spec/src/type/TSConditionalType/spec.ts @@ -0,0 +1,11 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TypeNode } from '../../unions/TypeNode'; + +export interface TSConditionalType extends BaseNode { + type: AST_NODE_TYPES.TSConditionalType; + checkType: TypeNode; + extendsType: TypeNode; + trueType: TypeNode; + falseType: TypeNode; +} diff --git a/packages/ast-spec/src/type/TSConstructorType/spec.ts b/packages/ast-spec/src/type/TSConstructorType/spec.ts new file mode 100644 index 000000000000..08e19757d14a --- /dev/null +++ b/packages/ast-spec/src/type/TSConstructorType/spec.ts @@ -0,0 +1,7 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { TSFunctionSignatureBase } from '../../base/TSFunctionSignatureBase'; + +export interface TSConstructorType extends TSFunctionSignatureBase { + type: AST_NODE_TYPES.TSConstructorType; + abstract: boolean; +} diff --git a/packages/ast-spec/src/type/TSFunctionType/spec.ts b/packages/ast-spec/src/type/TSFunctionType/spec.ts new file mode 100644 index 000000000000..4388b097efd5 --- /dev/null +++ b/packages/ast-spec/src/type/TSFunctionType/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { TSFunctionSignatureBase } from '../../base/TSFunctionSignatureBase'; + +export interface TSFunctionType extends TSFunctionSignatureBase { + type: AST_NODE_TYPES.TSFunctionType; +} diff --git a/packages/ast-spec/src/type/TSImportType/spec.ts b/packages/ast-spec/src/type/TSImportType/spec.ts new file mode 100644 index 000000000000..b2eea1a78e01 --- /dev/null +++ b/packages/ast-spec/src/type/TSImportType/spec.ts @@ -0,0 +1,13 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TSTypeParameterInstantiation } from '../../special/TSTypeParameterInstantiation/spec'; +import type { EntityName } from '../../unions/EntityName'; +import type { TypeNode } from '../../unions/TypeNode'; + +export interface TSImportType extends BaseNode { + type: AST_NODE_TYPES.TSImportType; + isTypeOf: boolean; + parameter: TypeNode; + qualifier: EntityName | null; + typeParameters: TSTypeParameterInstantiation | null; +} diff --git a/packages/ast-spec/src/type/TSIndexedAccessType/spec.ts b/packages/ast-spec/src/type/TSIndexedAccessType/spec.ts new file mode 100644 index 000000000000..86a22e22a16e --- /dev/null +++ b/packages/ast-spec/src/type/TSIndexedAccessType/spec.ts @@ -0,0 +1,9 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TypeNode } from '../../unions/TypeNode'; + +export interface TSIndexedAccessType extends BaseNode { + type: AST_NODE_TYPES.TSIndexedAccessType; + objectType: TypeNode; + indexType: TypeNode; +} diff --git a/packages/ast-spec/src/type/TSInferType/spec.ts b/packages/ast-spec/src/type/TSInferType/spec.ts new file mode 100644 index 000000000000..11cdacb25d20 --- /dev/null +++ b/packages/ast-spec/src/type/TSInferType/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TSTypeParameter } from '../../special/TSTypeParameter/spec'; + +export interface TSInferType extends BaseNode { + type: AST_NODE_TYPES.TSInferType; + typeParameter: TSTypeParameter; +} diff --git a/packages/ast-spec/src/type/TSIntersectionType/spec.ts b/packages/ast-spec/src/type/TSIntersectionType/spec.ts new file mode 100644 index 000000000000..b84834143a0e --- /dev/null +++ b/packages/ast-spec/src/type/TSIntersectionType/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TypeNode } from '../../unions/TypeNode'; + +export interface TSIntersectionType extends BaseNode { + type: AST_NODE_TYPES.TSIntersectionType; + types: TypeNode[]; +} diff --git a/packages/ast-spec/src/type/TSIntrinsicType/spec.ts b/packages/ast-spec/src/type/TSIntrinsicType/spec.ts new file mode 100644 index 000000000000..b7158c2803c0 --- /dev/null +++ b/packages/ast-spec/src/type/TSIntrinsicType/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface TSIntrinsicKeyword extends BaseNode { + type: AST_NODE_TYPES.TSIntrinsicKeyword; +} diff --git a/packages/ast-spec/src/type/TSLiteralType/spec.ts b/packages/ast-spec/src/type/TSLiteralType/spec.ts new file mode 100644 index 000000000000..39f6ae0d2961 --- /dev/null +++ b/packages/ast-spec/src/type/TSLiteralType/spec.ts @@ -0,0 +1,10 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { UnaryExpression } from '../../expression/UnaryExpression/spec'; +import type { UpdateExpression } from '../../expression/UpdateExpression/spec'; +import type { LiteralExpression } from '../../unions/LiteralExpression'; + +export interface TSLiteralType extends BaseNode { + type: AST_NODE_TYPES.TSLiteralType; + literal: LiteralExpression | UnaryExpression | UpdateExpression; +} diff --git a/packages/ast-spec/src/type/TSMappedType/spec.ts b/packages/ast-spec/src/type/TSMappedType/spec.ts new file mode 100644 index 000000000000..db5abd4063a1 --- /dev/null +++ b/packages/ast-spec/src/type/TSMappedType/spec.ts @@ -0,0 +1,13 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TSTypeParameter } from '../../special/TSTypeParameter/spec'; +import type { TypeNode } from '../../unions/TypeNode'; + +export interface TSMappedType extends BaseNode { + type: AST_NODE_TYPES.TSMappedType; + typeParameter: TSTypeParameter; + readonly?: boolean | '-' | '+'; + optional?: boolean | '-' | '+'; + typeAnnotation?: TypeNode; + nameType: TypeNode | null; +} diff --git a/packages/ast-spec/src/type/TSNamedTupleMember/spec.ts b/packages/ast-spec/src/type/TSNamedTupleMember/spec.ts new file mode 100644 index 000000000000..540d8bf19db5 --- /dev/null +++ b/packages/ast-spec/src/type/TSNamedTupleMember/spec.ts @@ -0,0 +1,11 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Identifier } from '../../expression/Identifier/spec'; +import type { TypeNode } from '../../unions/TypeNode'; + +export interface TSNamedTupleMember extends BaseNode { + type: AST_NODE_TYPES.TSNamedTupleMember; + elementType: TypeNode; + label: Identifier; + optional: boolean; +} diff --git a/packages/ast-spec/src/type/TSNeverKeyword/spec.ts b/packages/ast-spec/src/type/TSNeverKeyword/spec.ts new file mode 100644 index 000000000000..59fe839e3473 --- /dev/null +++ b/packages/ast-spec/src/type/TSNeverKeyword/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface TSNeverKeyword extends BaseNode { + type: AST_NODE_TYPES.TSNeverKeyword; +} diff --git a/packages/ast-spec/src/type/TSNullKeyword/spec.ts b/packages/ast-spec/src/type/TSNullKeyword/spec.ts new file mode 100644 index 000000000000..254d5cc592d5 --- /dev/null +++ b/packages/ast-spec/src/type/TSNullKeyword/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface TSNullKeyword extends BaseNode { + type: AST_NODE_TYPES.TSNullKeyword; +} diff --git a/packages/ast-spec/src/type/TSNumberKeyword/spec.ts b/packages/ast-spec/src/type/TSNumberKeyword/spec.ts new file mode 100644 index 000000000000..768742a425dc --- /dev/null +++ b/packages/ast-spec/src/type/TSNumberKeyword/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface TSNumberKeyword extends BaseNode { + type: AST_NODE_TYPES.TSNumberKeyword; +} diff --git a/packages/ast-spec/src/type/TSObjectKeyword/spec.ts b/packages/ast-spec/src/type/TSObjectKeyword/spec.ts new file mode 100644 index 000000000000..3472bc9191ff --- /dev/null +++ b/packages/ast-spec/src/type/TSObjectKeyword/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface TSObjectKeyword extends BaseNode { + type: AST_NODE_TYPES.TSObjectKeyword; +} diff --git a/packages/ast-spec/src/type/TSOptionalType/spec.ts b/packages/ast-spec/src/type/TSOptionalType/spec.ts new file mode 100644 index 000000000000..9cdb0f636d32 --- /dev/null +++ b/packages/ast-spec/src/type/TSOptionalType/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TypeNode } from '../../unions/TypeNode'; + +export interface TSOptionalType extends BaseNode { + type: AST_NODE_TYPES.TSOptionalType; + typeAnnotation: TypeNode; +} diff --git a/packages/ast-spec/src/type/TSQualifiedName/spec.ts b/packages/ast-spec/src/type/TSQualifiedName/spec.ts new file mode 100644 index 000000000000..cdd6feeee0ef --- /dev/null +++ b/packages/ast-spec/src/type/TSQualifiedName/spec.ts @@ -0,0 +1,10 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Identifier } from '../../expression/Identifier/spec'; +import type { EntityName } from '../../unions/EntityName'; + +export interface TSQualifiedName extends BaseNode { + type: AST_NODE_TYPES.TSQualifiedName; + left: EntityName; + right: Identifier; +} diff --git a/packages/ast-spec/src/type/TSRestType/spec.ts b/packages/ast-spec/src/type/TSRestType/spec.ts new file mode 100644 index 000000000000..f1b4f2ecfa85 --- /dev/null +++ b/packages/ast-spec/src/type/TSRestType/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TypeNode } from '../../unions/TypeNode'; + +export interface TSRestType extends BaseNode { + type: AST_NODE_TYPES.TSRestType; + typeAnnotation: TypeNode; +} diff --git a/packages/ast-spec/src/type/TSStringKeyword/spec.ts b/packages/ast-spec/src/type/TSStringKeyword/spec.ts new file mode 100644 index 000000000000..35721dd44137 --- /dev/null +++ b/packages/ast-spec/src/type/TSStringKeyword/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface TSStringKeyword extends BaseNode { + type: AST_NODE_TYPES.TSStringKeyword; +} diff --git a/packages/ast-spec/src/type/TSSymbolKeyword/spec.ts b/packages/ast-spec/src/type/TSSymbolKeyword/spec.ts new file mode 100644 index 000000000000..6b8b949dd0b8 --- /dev/null +++ b/packages/ast-spec/src/type/TSSymbolKeyword/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface TSSymbolKeyword extends BaseNode { + type: AST_NODE_TYPES.TSSymbolKeyword; +} diff --git a/packages/ast-spec/src/type/TSTemplateLiteralType/spec.ts b/packages/ast-spec/src/type/TSTemplateLiteralType/spec.ts new file mode 100644 index 000000000000..c2e8783da873 --- /dev/null +++ b/packages/ast-spec/src/type/TSTemplateLiteralType/spec.ts @@ -0,0 +1,10 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TemplateElement } from '../../special/TemplateElement/spec'; +import type { TypeNode } from '../../unions/TypeNode'; + +export interface TSTemplateLiteralType extends BaseNode { + type: AST_NODE_TYPES.TSTemplateLiteralType; + quasis: TemplateElement[]; + types: TypeNode[]; +} diff --git a/packages/ast-spec/src/type/TSThisType/spec.ts b/packages/ast-spec/src/type/TSThisType/spec.ts new file mode 100644 index 000000000000..319e82460f67 --- /dev/null +++ b/packages/ast-spec/src/type/TSThisType/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface TSThisType extends BaseNode { + type: AST_NODE_TYPES.TSThisType; +} diff --git a/packages/ast-spec/src/type/TSTupleType/spec.ts b/packages/ast-spec/src/type/TSTupleType/spec.ts new file mode 100644 index 000000000000..641a0c15b4c6 --- /dev/null +++ b/packages/ast-spec/src/type/TSTupleType/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TypeNode } from '../../unions/TypeNode'; + +export interface TSTupleType extends BaseNode { + type: AST_NODE_TYPES.TSTupleType; + elementTypes: TypeNode[]; +} diff --git a/packages/ast-spec/src/type/TSTypeLiteral/spec.ts b/packages/ast-spec/src/type/TSTypeLiteral/spec.ts new file mode 100644 index 000000000000..243179d23d9f --- /dev/null +++ b/packages/ast-spec/src/type/TSTypeLiteral/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TypeElement } from '../../unions/TypeElement'; + +export interface TSTypeLiteral extends BaseNode { + type: AST_NODE_TYPES.TSTypeLiteral; + members: TypeElement[]; +} diff --git a/packages/ast-spec/src/type/TSTypeOperator/spec.ts b/packages/ast-spec/src/type/TSTypeOperator/spec.ts new file mode 100644 index 000000000000..c83b8721eed9 --- /dev/null +++ b/packages/ast-spec/src/type/TSTypeOperator/spec.ts @@ -0,0 +1,9 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TypeNode } from '../../unions/TypeNode'; + +export interface TSTypeOperator extends BaseNode { + type: AST_NODE_TYPES.TSTypeOperator; + operator: 'keyof' | 'readonly' | 'unique'; + typeAnnotation?: TypeNode; +} diff --git a/packages/ast-spec/src/type/TSTypePredicate/spec.ts b/packages/ast-spec/src/type/TSTypePredicate/spec.ts new file mode 100644 index 000000000000..cd34a31bcaf0 --- /dev/null +++ b/packages/ast-spec/src/type/TSTypePredicate/spec.ts @@ -0,0 +1,12 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Identifier } from '../../expression/Identifier/spec'; +import type { TSTypeAnnotation } from '../../special/TSTypeAnnotation/spec'; +import type { TSThisType } from '../TSThisType/spec'; + +export interface TSTypePredicate extends BaseNode { + type: AST_NODE_TYPES.TSTypePredicate; + asserts: boolean; + parameterName: Identifier | TSThisType; + typeAnnotation: TSTypeAnnotation | null; +} diff --git a/packages/ast-spec/src/type/TSTypeQuery/spec.ts b/packages/ast-spec/src/type/TSTypeQuery/spec.ts new file mode 100644 index 000000000000..bf1cd3e192df --- /dev/null +++ b/packages/ast-spec/src/type/TSTypeQuery/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { EntityName } from '../../unions/EntityName'; + +export interface TSTypeQuery extends BaseNode { + type: AST_NODE_TYPES.TSTypeQuery; + exprName: EntityName; +} diff --git a/packages/ast-spec/src/type/TSTypeReference/spec.ts b/packages/ast-spec/src/type/TSTypeReference/spec.ts new file mode 100644 index 000000000000..9d88fe7f6b4f --- /dev/null +++ b/packages/ast-spec/src/type/TSTypeReference/spec.ts @@ -0,0 +1,10 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TSTypeParameterInstantiation } from '../../special/TSTypeParameterInstantiation/spec'; +import type { EntityName } from '../../unions/EntityName'; + +export interface TSTypeReference extends BaseNode { + type: AST_NODE_TYPES.TSTypeReference; + typeName: EntityName; + typeParameters?: TSTypeParameterInstantiation; +} diff --git a/packages/ast-spec/src/type/TSUndefinedKeyword/spec.ts b/packages/ast-spec/src/type/TSUndefinedKeyword/spec.ts new file mode 100644 index 000000000000..0aa062c84212 --- /dev/null +++ b/packages/ast-spec/src/type/TSUndefinedKeyword/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface TSUndefinedKeyword extends BaseNode { + type: AST_NODE_TYPES.TSUndefinedKeyword; +} diff --git a/packages/ast-spec/src/type/TSUnionType/spec.ts b/packages/ast-spec/src/type/TSUnionType/spec.ts new file mode 100644 index 000000000000..a286f796a23d --- /dev/null +++ b/packages/ast-spec/src/type/TSUnionType/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TypeNode } from '../../unions/TypeNode'; + +export interface TSUnionType extends BaseNode { + type: AST_NODE_TYPES.TSUnionType; + types: TypeNode[]; +} diff --git a/packages/ast-spec/src/type/TSUnknownKeyword/spec.ts b/packages/ast-spec/src/type/TSUnknownKeyword/spec.ts new file mode 100644 index 000000000000..c8c1f9340c6e --- /dev/null +++ b/packages/ast-spec/src/type/TSUnknownKeyword/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface TSUnknownKeyword extends BaseNode { + type: AST_NODE_TYPES.TSUnknownKeyword; +} diff --git a/packages/ast-spec/src/type/TSVoidKeyword/spec.ts b/packages/ast-spec/src/type/TSVoidKeyword/spec.ts new file mode 100644 index 000000000000..abf0c14c5ab3 --- /dev/null +++ b/packages/ast-spec/src/type/TSVoidKeyword/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface TSVoidKeyword extends BaseNode { + type: AST_NODE_TYPES.TSVoidKeyword; +} diff --git a/packages/ast-spec/src/type/spec.ts b/packages/ast-spec/src/type/spec.ts new file mode 100644 index 000000000000..d6209d260673 --- /dev/null +++ b/packages/ast-spec/src/type/spec.ts @@ -0,0 +1,35 @@ +export * from './TSAnyKeyword/spec'; +export * from './TSArrayType/spec'; +export * from './TSBigIntKeyword/spec'; +export * from './TSBooleanKeyword/spec'; +export * from './TSConditionalType/spec'; +export * from './TSConstructorType/spec'; +export * from './TSFunctionType/spec'; +export * from './TSImportType/spec'; +export * from './TSIndexedAccessType/spec'; +export * from './TSInferType/spec'; +export * from './TSIntersectionType/spec'; +export * from './TSLiteralType/spec'; +export * from './TSMappedType/spec'; +export * from './TSNamedTupleMember/spec'; +export * from './TSNeverKeyword/spec'; +export * from './TSNullKeyword/spec'; +export * from './TSNumberKeyword/spec'; +export * from './TSObjectKeyword/spec'; +export * from './TSOptionalType/spec'; +export * from './TSQualifiedName/spec'; +export * from './TSRestType/spec'; +export * from './TSStringKeyword/spec'; +export * from './TSSymbolKeyword/spec'; +export * from './TSTemplateLiteralType/spec'; +export * from './TSThisType/spec'; +export * from './TSTupleType/spec'; +export * from './TSTypeLiteral/spec'; +export * from './TSTypeOperator/spec'; +export * from './TSTypePredicate/spec'; +export * from './TSTypeQuery/spec'; +export * from './TSTypeReference/spec'; +export * from './TSUndefinedKeyword/spec'; +export * from './TSUnionType/spec'; +export * from './TSUnknownKeyword/spec'; +export * from './TSVoidKeyword/spec'; diff --git a/packages/ast-spec/src/unions/BindingName.ts b/packages/ast-spec/src/unions/BindingName.ts new file mode 100644 index 000000000000..2da273d80476 --- /dev/null +++ b/packages/ast-spec/src/unions/BindingName.ts @@ -0,0 +1,4 @@ +import type { Identifier } from '../expression/Identifier/spec'; +import type { BindingPattern } from './BindingPattern'; + +export type BindingName = BindingPattern | Identifier; diff --git a/packages/ast-spec/src/unions/BindingPattern.ts b/packages/ast-spec/src/unions/BindingPattern.ts new file mode 100644 index 000000000000..ef39d0af1126 --- /dev/null +++ b/packages/ast-spec/src/unions/BindingPattern.ts @@ -0,0 +1,4 @@ +import type { ArrayPattern } from '../parameter/ArrayPattern/spec'; +import type { ObjectPattern } from '../parameter/ObjectPattern/spec'; + +export type BindingPattern = ArrayPattern | ObjectPattern; diff --git a/packages/ast-spec/src/unions/CallExpressionArgument.ts b/packages/ast-spec/src/unions/CallExpressionArgument.ts new file mode 100644 index 000000000000..42a419b4b25b --- /dev/null +++ b/packages/ast-spec/src/unions/CallExpressionArgument.ts @@ -0,0 +1,4 @@ +import type { SpreadElement } from '../element/SpreadElement/spec'; +import type { Expression } from './Expression'; + +export type CallExpressionArgument = Expression | SpreadElement; diff --git a/packages/ast-spec/src/unions/ChainElement.ts b/packages/ast-spec/src/unions/ChainElement.ts new file mode 100644 index 000000000000..fccde99ed8c6 --- /dev/null +++ b/packages/ast-spec/src/unions/ChainElement.ts @@ -0,0 +1,8 @@ +import type { CallExpression } from '../expression/CallExpression/spec'; +import type { MemberExpression } from '../expression/MemberExpression/spec'; +import type { TSNonNullExpression } from '../expression/TSNonNullExpression/spec'; + +export type ChainElement = + | CallExpression + | MemberExpression + | TSNonNullExpression; diff --git a/packages/ast-spec/src/unions/ClassElement.ts b/packages/ast-spec/src/unions/ClassElement.ts new file mode 100644 index 000000000000..27d4ec4d752c --- /dev/null +++ b/packages/ast-spec/src/unions/ClassElement.ts @@ -0,0 +1,14 @@ +import type { MethodDefinition } from '../element/MethodDefinition/spec'; +import type { PropertyDefinition } from '../element/PropertyDefinition/spec'; +import type { StaticBlock } from '../element/StaticBlock/spec'; +import type { TSAbstractMethodDefinition } from '../element/TSAbstractMethodDefinition/spec'; +import type { TSAbstractPropertyDefinition } from '../element/TSAbstractPropertyDefinition/spec'; +import type { TSIndexSignature } from '../element/TSIndexSignature/spec'; + +export type ClassElement = + | MethodDefinition + | PropertyDefinition + | StaticBlock + | TSAbstractMethodDefinition + | TSAbstractPropertyDefinition + | TSIndexSignature; diff --git a/packages/ast-spec/src/unions/Comment.ts b/packages/ast-spec/src/unions/Comment.ts new file mode 100644 index 000000000000..d5cdca042476 --- /dev/null +++ b/packages/ast-spec/src/unions/Comment.ts @@ -0,0 +1,4 @@ +import type { BlockComment } from '../token/BlockComment/spec'; +import type { LineComment } from '../token/LineComment/spec'; + +export type Comment = BlockComment | LineComment; diff --git a/packages/ast-spec/src/unions/DeclarationStatement.ts b/packages/ast-spec/src/unions/DeclarationStatement.ts new file mode 100644 index 000000000000..be0637254ae7 --- /dev/null +++ b/packages/ast-spec/src/unions/DeclarationStatement.ts @@ -0,0 +1,29 @@ +import type { ClassDeclaration } from '../declaration/ClassDeclaration/spec'; +import type { ExportAllDeclaration } from '../declaration/ExportAllDeclaration/spec'; +import type { ExportDefaultDeclaration } from '../declaration/ExportDefaultDeclaration/spec'; +import type { ExportNamedDeclaration } from '../declaration/ExportNamedDeclaration/spec'; +import type { FunctionDeclaration } from '../declaration/FunctionDeclaration/spec'; +import type { 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 { TSNamespaceExportDeclaration } from '../declaration/TSNamespaceExportDeclaration/spec'; +import type { TSTypeAliasDeclaration } from '../declaration/TSTypeAliasDeclaration/spec'; +import type { ClassExpression } from '../expression/ClassExpression/spec'; + +// TODO - breaking change remove this +export type DeclarationStatement = + | ClassDeclaration + | ClassExpression + | ExportAllDeclaration + | ExportDefaultDeclaration + | ExportNamedDeclaration + | FunctionDeclaration + | TSDeclareFunction + | TSEnumDeclaration + | TSImportEqualsDeclaration + | TSInterfaceDeclaration + | TSModuleDeclaration + | TSNamespaceExportDeclaration + | TSTypeAliasDeclaration; diff --git a/packages/ast-spec/src/unions/DestructuringPattern.ts b/packages/ast-spec/src/unions/DestructuringPattern.ts new file mode 100644 index 000000000000..40d07009651c --- /dev/null +++ b/packages/ast-spec/src/unions/DestructuringPattern.ts @@ -0,0 +1,14 @@ +import type { Identifier } from '../expression/Identifier/spec'; +import type { MemberExpression } from '../expression/MemberExpression/spec'; +import type { ArrayPattern } from '../parameter/ArrayPattern/spec'; +import type { AssignmentPattern } from '../parameter/AssignmentPattern/spec'; +import type { ObjectPattern } from '../parameter/ObjectPattern/spec'; +import type { RestElement } from '../parameter/RestElement/spec'; + +export type DestructuringPattern = + | ArrayPattern + | AssignmentPattern + | Identifier + | MemberExpression + | ObjectPattern + | RestElement; diff --git a/packages/ast-spec/src/unions/EntityName.ts b/packages/ast-spec/src/unions/EntityName.ts new file mode 100644 index 000000000000..82f7b1c9b0ca --- /dev/null +++ b/packages/ast-spec/src/unions/EntityName.ts @@ -0,0 +1,4 @@ +import type { Identifier } from '../expression/Identifier/spec'; +import type { TSQualifiedName } from '../type/TSQualifiedName/spec'; + +export type EntityName = Identifier | TSQualifiedName; diff --git a/packages/ast-spec/src/unions/ExportDeclaration.ts b/packages/ast-spec/src/unions/ExportDeclaration.ts new file mode 100644 index 000000000000..1ae9d9ddb9f8 --- /dev/null +++ b/packages/ast-spec/src/unions/ExportDeclaration.ts @@ -0,0 +1,20 @@ +import type { ClassDeclaration } from '../declaration/ClassDeclaration/spec'; +import type { FunctionDeclaration } from '../declaration/FunctionDeclaration/spec'; +import type { TSDeclareFunction } from '../declaration/TSDeclareFunction/spec'; +import type { TSEnumDeclaration } from '../declaration/TSEnumDeclaration/spec'; +import type { TSInterfaceDeclaration } from '../declaration/TSInterfaceDeclaration/spec'; +import type { TSModuleDeclaration } from '../declaration/TSModuleDeclaration/spec'; +import type { TSTypeAliasDeclaration } from '../declaration/TSTypeAliasDeclaration/spec'; +import type { VariableDeclaration } from '../declaration/VariableDeclaration/spec'; +import type { ClassExpression } from '../expression/ClassExpression/spec'; + +export type ExportDeclaration = + | ClassDeclaration + | ClassExpression + | FunctionDeclaration + | TSDeclareFunction + | TSEnumDeclaration + | TSInterfaceDeclaration + | TSModuleDeclaration + | TSTypeAliasDeclaration + | VariableDeclaration; diff --git a/packages/ast-spec/src/unions/Expression.ts b/packages/ast-spec/src/unions/Expression.ts new file mode 100644 index 000000000000..5359dc9c69c7 --- /dev/null +++ b/packages/ast-spec/src/unions/Expression.ts @@ -0,0 +1,76 @@ +import type { ArrayExpression } from '../expression/ArrayExpression/spec'; +import type { ArrowFunctionExpression } from '../expression/ArrowFunctionExpression/spec'; +import type { AssignmentExpression } from '../expression/AssignmentExpression/spec'; +import type { AwaitExpression } from '../expression/AwaitExpression/spec'; +import type { BinaryExpression } from '../expression/BinaryExpression/spec'; +import type { CallExpression } from '../expression/CallExpression/spec'; +import type { ChainExpression } from '../expression/ChainExpression/spec'; +import type { ClassExpression } from '../expression/ClassExpression/spec'; +import type { ConditionalExpression } from '../expression/ConditionalExpression/spec'; +import type { FunctionExpression } from '../expression/FunctionExpression/spec'; +import type { Identifier } from '../expression/Identifier/spec'; +import type { ImportExpression } from '../expression/ImportExpression/spec'; +import type { JSXElement } from '../expression/JSXElement/spec'; +import type { JSXFragment } from '../expression/JSXFragment/spec'; +import type { LogicalExpression } from '../expression/LogicalExpression/spec'; +import type { MemberExpression } from '../expression/MemberExpression/spec'; +import type { MetaProperty } from '../expression/MetaProperty/spec'; +import type { NewExpression } from '../expression/NewExpression/spec'; +import type { ObjectExpression } from '../expression/ObjectExpression/spec'; +import type { SequenceExpression } from '../expression/SequenceExpression/spec'; +import type { Super } from '../expression/Super/spec'; +import type { TaggedTemplateExpression } from '../expression/TaggedTemplateExpression/spec'; +import type { TemplateLiteral } from '../expression/TemplateLiteral/spec'; +import type { ThisExpression } from '../expression/ThisExpression/spec'; +import type { TSAsExpression } from '../expression/TSAsExpression/spec'; +import type { TSNonNullExpression } from '../expression/TSNonNullExpression/spec'; +import type { TSTypeAssertion } from '../expression/TSTypeAssertion/spec'; +import type { UnaryExpression } from '../expression/UnaryExpression/spec'; +import type { UpdateExpression } from '../expression/UpdateExpression/spec'; +import type { YieldExpression } from '../expression/YieldExpression/spec'; +import type { ArrayPattern } from '../parameter/ArrayPattern/spec'; +import type { ObjectPattern } from '../parameter/ObjectPattern/spec'; +import type { LiteralExpression } from './LiteralExpression'; + +/* +This isn't technically correct, as it includes ArrayPattern and ObjectPattern - which are only valid +in a LeftHandSideExpression, and not in a general expression location. + +However most of the time that this type is used, the intention will be to assign a LeftHandSideExpression to this type. +So excluding the Pattern types just makes it a pain, as people have to write Expression | LeftHandSideExpression everywhere. +*/ + +export type Expression = + | ArrayExpression + | ArrayPattern + | ArrowFunctionExpression + | AssignmentExpression + | AwaitExpression + | BinaryExpression + | CallExpression + | ChainExpression + | ClassExpression + | ConditionalExpression + | FunctionExpression + | Identifier + | ImportExpression + | JSXElement + | JSXFragment + | LiteralExpression + | LogicalExpression + | MemberExpression + | MetaProperty + | NewExpression + | ObjectExpression + | ObjectPattern + | SequenceExpression + | Super + | TaggedTemplateExpression + | TemplateLiteral + | ThisExpression + | TSAsExpression + | TSNonNullExpression + | TSTypeAssertion + | UnaryExpression + | UpdateExpression + | YieldExpression; diff --git a/packages/ast-spec/src/unions/ForInitialiser.ts b/packages/ast-spec/src/unions/ForInitialiser.ts new file mode 100644 index 000000000000..05138cb52fbc --- /dev/null +++ b/packages/ast-spec/src/unions/ForInitialiser.ts @@ -0,0 +1,4 @@ +import type { VariableDeclaration } from '../declaration/VariableDeclaration/spec'; +import type { Expression } from './Expression'; + +export type ForInitialiser = Expression | VariableDeclaration; diff --git a/packages/ast-spec/src/unions/FunctionLike.ts b/packages/ast-spec/src/unions/FunctionLike.ts new file mode 100644 index 000000000000..6ab06d834960 --- /dev/null +++ b/packages/ast-spec/src/unions/FunctionLike.ts @@ -0,0 +1,12 @@ +import type { FunctionDeclaration } from '../declaration/FunctionDeclaration/spec'; +import type { TSDeclareFunction } from '../declaration/TSDeclareFunction/spec'; +import type { ArrowFunctionExpression } from '../expression/ArrowFunctionExpression/spec'; +import type { FunctionExpression } from '../expression/FunctionExpression/spec'; +import type { TSEmptyBodyFunctionExpression } from '../expression/TSEmptyBodyFunctionExpression/spec'; + +export type FunctionLike = + | ArrowFunctionExpression + | FunctionDeclaration + | FunctionExpression + | TSDeclareFunction + | TSEmptyBodyFunctionExpression; diff --git a/packages/ast-spec/src/unions/ImportClause.ts b/packages/ast-spec/src/unions/ImportClause.ts new file mode 100644 index 000000000000..80b40826ff6d --- /dev/null +++ b/packages/ast-spec/src/unions/ImportClause.ts @@ -0,0 +1,8 @@ +import type { ImportDefaultSpecifier } from '../special/ImportDefaultSpecifier/spec'; +import type { ImportNamespaceSpecifier } from '../special/ImportNamespaceSpecifier/spec'; +import type { ImportSpecifier } from '../special/ImportSpecifier/spec'; + +export type ImportClause = + | ImportDefaultSpecifier + | ImportNamespaceSpecifier + | ImportSpecifier; diff --git a/packages/ast-spec/src/unions/IterationStatement.ts b/packages/ast-spec/src/unions/IterationStatement.ts new file mode 100644 index 000000000000..6a611431ca05 --- /dev/null +++ b/packages/ast-spec/src/unions/IterationStatement.ts @@ -0,0 +1,12 @@ +import type { DoWhileStatement } from '../statement/DoWhileStatement/spec'; +import type { ForInStatement } from '../statement/ForInStatement/spec'; +import type { ForOfStatement } from '../statement/ForOfStatement/spec'; +import type { ForStatement } from '../statement/ForStatement/spec'; +import type { WhileStatement } from '../statement/WhileStatement/spec'; + +export type IterationStatement = + | DoWhileStatement + | ForInStatement + | ForOfStatement + | ForStatement + | WhileStatement; diff --git a/packages/ast-spec/src/unions/JSXChild.ts b/packages/ast-spec/src/unions/JSXChild.ts new file mode 100644 index 000000000000..2b38836c82ef --- /dev/null +++ b/packages/ast-spec/src/unions/JSXChild.ts @@ -0,0 +1,6 @@ +import type { JSXElement } from '../expression/JSXElement/spec'; +import type { JSXFragment } from '../expression/JSXFragment/spec'; +import type { JSXText } from '../jsx/JSXText/spec'; +import type { JSXExpression } from './JSXExpression'; + +export type JSXChild = JSXElement | JSXExpression | JSXFragment | JSXText; diff --git a/packages/ast-spec/src/unions/JSXExpression.ts b/packages/ast-spec/src/unions/JSXExpression.ts new file mode 100644 index 000000000000..78dfad53525b --- /dev/null +++ b/packages/ast-spec/src/unions/JSXExpression.ts @@ -0,0 +1,8 @@ +import type { JSXEmptyExpression } from '../jsx/JSXEmptyExpression/spec'; +import type { JSXExpressionContainer } from '../jsx/JSXExpressionContainer/spec'; +import type { JSXSpreadChild } from '../jsx/JSXSpreadChild/spec'; + +export type JSXExpression = + | JSXEmptyExpression + | JSXExpressionContainer + | JSXSpreadChild; diff --git a/packages/ast-spec/src/unions/JSXTagNameExpression.ts b/packages/ast-spec/src/unions/JSXTagNameExpression.ts new file mode 100644 index 000000000000..05a831f68b45 --- /dev/null +++ b/packages/ast-spec/src/unions/JSXTagNameExpression.ts @@ -0,0 +1,8 @@ +import type { JSXIdentifier } from '../jsx/JSXIdentifier/spec'; +import type { JSXMemberExpression } from '../jsx/JSXMemberExpression/spec'; +import type { JSXNamespacedName } from '../jsx/JSXNamespacedName/spec'; + +export type JSXTagNameExpression = + | JSXIdentifier + | JSXMemberExpression + | JSXNamespacedName; diff --git a/packages/ast-spec/src/unions/LeftHandSideExpression.ts b/packages/ast-spec/src/unions/LeftHandSideExpression.ts new file mode 100644 index 000000000000..fc3a80b23618 --- /dev/null +++ b/packages/ast-spec/src/unions/LeftHandSideExpression.ts @@ -0,0 +1,44 @@ +import type { ArrayExpression } from '../expression/ArrayExpression/spec'; +import type { ArrowFunctionExpression } from '../expression/ArrowFunctionExpression/spec'; +import type { CallExpression } from '../expression/CallExpression/spec'; +import type { ClassExpression } from '../expression/ClassExpression/spec'; +import type { FunctionExpression } from '../expression/FunctionExpression/spec'; +import type { Identifier } from '../expression/Identifier/spec'; +import type { JSXElement } from '../expression/JSXElement/spec'; +import type { JSXFragment } from '../expression/JSXFragment/spec'; +import type { MemberExpression } from '../expression/MemberExpression/spec'; +import type { MetaProperty } from '../expression/MetaProperty/spec'; +import type { ObjectExpression } from '../expression/ObjectExpression/spec'; +import type { SequenceExpression } from '../expression/spec'; +import type { Super } from '../expression/Super/spec'; +import type { TaggedTemplateExpression } from '../expression/TaggedTemplateExpression/spec'; +import type { ThisExpression } from '../expression/ThisExpression/spec'; +import type { TSAsExpression } from '../expression/TSAsExpression/spec'; +import type { TSNonNullExpression } from '../expression/TSNonNullExpression/spec'; +import type { TSTypeAssertion } from '../expression/TSTypeAssertion/spec'; +import type { ArrayPattern } from '../parameter/ArrayPattern/spec'; +import type { ObjectPattern } from '../parameter/ObjectPattern/spec'; +import type { LiteralExpression } from './LiteralExpression'; + +export type LeftHandSideExpression = + | ArrayExpression + | ArrayPattern + | ArrowFunctionExpression + | CallExpression + | ClassExpression + | FunctionExpression + | Identifier + | JSXElement + | JSXFragment + | LiteralExpression + | MemberExpression + | MetaProperty + | ObjectExpression + | ObjectPattern + | SequenceExpression + | Super + | TaggedTemplateExpression + | ThisExpression + | TSAsExpression + | TSNonNullExpression + | TSTypeAssertion; diff --git a/packages/ast-spec/src/unions/Literal.ts b/packages/ast-spec/src/unions/Literal.ts new file mode 100644 index 000000000000..4da361d88423 --- /dev/null +++ b/packages/ast-spec/src/unions/Literal.ts @@ -0,0 +1,14 @@ +import type { BigIntLiteral } from '../expression/literal/BigIntLiteral/spec'; +import type { BooleanLiteral } from '../expression/literal/BooleanLiteral/spec'; +import type { NullLiteral } from '../expression/literal/NullLiteral/spec'; +import type { NumberLiteral } from '../expression/literal/NumberLiteral/spec'; +import type { RegExpLiteral } from '../expression/literal/RegExpLiteral/spec'; +import type { StringLiteral } from '../expression/literal/StringLiteral/spec'; + +export type Literal = + | BigIntLiteral + | BooleanLiteral + | NullLiteral + | NumberLiteral + | RegExpLiteral + | StringLiteral; diff --git a/packages/ast-spec/src/unions/LiteralExpression.ts b/packages/ast-spec/src/unions/LiteralExpression.ts new file mode 100644 index 000000000000..e29ddeec7ee5 --- /dev/null +++ b/packages/ast-spec/src/unions/LiteralExpression.ts @@ -0,0 +1,4 @@ +import type { TemplateLiteral } from '../expression/TemplateLiteral/spec'; +import type { Literal } from './Literal'; + +export type LiteralExpression = Literal | TemplateLiteral; diff --git a/packages/ast-spec/src/unions/Modifier.ts b/packages/ast-spec/src/unions/Modifier.ts new file mode 100644 index 000000000000..0922a52eca2e --- /dev/null +++ b/packages/ast-spec/src/unions/Modifier.ts @@ -0,0 +1,16 @@ +import type { TSAbstractKeyword } from '../token/TSAbstractKeyword/spec'; +import type { TSAsyncKeyword } from '../token/TSAsyncKeyword/spec'; +import type { TSPrivateKeyword } from '../token/TSPrivateKeyword/spec'; +import type { TSProtectedKeyword } from '../token/TSProtectedKeyword/spec'; +import type { TSPublicKeyword } from '../token/TSPublicKeyword/spec'; +import type { TSReadonlyKeyword } from '../token/TSReadonlyKeyword/spec'; +import type { TSStaticKeyword } from '../token/TSStaticKeyword/spec'; + +export type Modifier = + | TSAbstractKeyword + | TSAsyncKeyword + | TSPrivateKeyword + | TSProtectedKeyword + | TSPublicKeyword + | TSReadonlyKeyword + | TSStaticKeyword; diff --git a/packages/ast-spec/src/unions/Node.ts b/packages/ast-spec/src/unions/Node.ts new file mode 100644 index 000000000000..ba2b07bf4d4d --- /dev/null +++ b/packages/ast-spec/src/unions/Node.ts @@ -0,0 +1,331 @@ +import type { ClassDeclaration } from '../declaration/ClassDeclaration/spec'; +import type { ExportAllDeclaration } from '../declaration/ExportAllDeclaration/spec'; +import type { ExportDefaultDeclaration } from '../declaration/ExportDefaultDeclaration/spec'; +import type { ExportNamedDeclaration } from '../declaration/ExportNamedDeclaration/spec'; +import type { FunctionDeclaration } from '../declaration/FunctionDeclaration/spec'; +import type { ImportDeclaration } from '../declaration/ImportDeclaration/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 { TSNamespaceExportDeclaration } from '../declaration/TSNamespaceExportDeclaration/spec'; +import type { TSTypeAliasDeclaration } from '../declaration/TSTypeAliasDeclaration/spec'; +import type { VariableDeclaration } from '../declaration/VariableDeclaration/spec'; +import type { MethodDefinition } from '../element/MethodDefinition/spec'; +import type { Property } from '../element/Property/spec'; +import type { PropertyDefinition } from '../element/PropertyDefinition/spec'; +import type { SpreadElement } from '../element/SpreadElement/spec'; +import type { StaticBlock } from '../element/StaticBlock/spec'; +import type { TSAbstractMethodDefinition } from '../element/TSAbstractMethodDefinition/spec'; +import type { TSAbstractPropertyDefinition } from '../element/TSAbstractPropertyDefinition/spec'; +import type { TSCallSignatureDeclaration } from '../element/TSCallSignatureDeclaration/spec'; +import type { TSConstructSignatureDeclaration } from '../element/TSConstructSignatureDeclaration/spec'; +import type { TSEnumMember } from '../element/TSEnumMember/spec'; +import type { TSIndexSignature } from '../element/TSIndexSignature/spec'; +import type { TSMethodSignature } from '../element/TSMethodSignature/spec'; +import type { TSPropertySignature } from '../element/TSPropertySignature/spec'; +import type { ArrayExpression } from '../expression/ArrayExpression/spec'; +import type { ArrowFunctionExpression } from '../expression/ArrowFunctionExpression/spec'; +import type { AssignmentExpression } from '../expression/AssignmentExpression/spec'; +import type { AwaitExpression } from '../expression/AwaitExpression/spec'; +import type { BinaryExpression } from '../expression/BinaryExpression/spec'; +import type { CallExpression } from '../expression/CallExpression/spec'; +import type { ChainExpression } from '../expression/ChainExpression/spec'; +import type { ClassExpression } from '../expression/ClassExpression/spec'; +import type { ConditionalExpression } from '../expression/ConditionalExpression/spec'; +import type { FunctionExpression } from '../expression/FunctionExpression/spec'; +import type { Identifier } from '../expression/Identifier/spec'; +import type { ImportExpression } from '../expression/ImportExpression/spec'; +import type { JSXElement } from '../expression/JSXElement/spec'; +import type { JSXFragment } from '../expression/JSXFragment/spec'; +import type { LogicalExpression } from '../expression/LogicalExpression/spec'; +import type { MemberExpression } from '../expression/MemberExpression/spec'; +import type { MetaProperty } from '../expression/MetaProperty/spec'; +import type { NewExpression } from '../expression/NewExpression/spec'; +import type { ObjectExpression } from '../expression/ObjectExpression/spec'; +import type { SequenceExpression } from '../expression/SequenceExpression/spec'; +import type { Super } from '../expression/Super/spec'; +import type { TaggedTemplateExpression } from '../expression/TaggedTemplateExpression/spec'; +import type { TemplateLiteral } from '../expression/TemplateLiteral/spec'; +import type { ThisExpression } from '../expression/ThisExpression/spec'; +import type { TSAsExpression } from '../expression/TSAsExpression/spec'; +import type { TSEmptyBodyFunctionExpression } from '../expression/TSEmptyBodyFunctionExpression/spec'; +import type { TSNonNullExpression } from '../expression/TSNonNullExpression/spec'; +import type { TSTypeAssertion } from '../expression/TSTypeAssertion/spec'; +import type { UnaryExpression } from '../expression/UnaryExpression/spec'; +import type { UpdateExpression } from '../expression/UpdateExpression/spec'; +import type { YieldExpression } from '../expression/YieldExpression/spec'; +import type { JSXAttribute } from '../jsx/JSXAttribute/spec'; +import type { JSXClosingElement } from '../jsx/JSXClosingElement/spec'; +import type { JSXClosingFragment } from '../jsx/JSXClosingFragment/spec'; +import type { JSXEmptyExpression } from '../jsx/JSXEmptyExpression/spec'; +import type { JSXExpressionContainer } from '../jsx/JSXExpressionContainer/spec'; +import type { JSXIdentifier } from '../jsx/JSXIdentifier/spec'; +import type { JSXMemberExpression } from '../jsx/JSXMemberExpression/spec'; +import type { JSXNamespacedName } from '../jsx/JSXNamespacedName/spec'; +import type { JSXOpeningElement } from '../jsx/JSXOpeningElement/spec'; +import type { JSXOpeningFragment } from '../jsx/JSXOpeningFragment/spec'; +import type { JSXSpreadAttribute } from '../jsx/JSXSpreadAttribute/spec'; +import type { JSXSpreadChild } from '../jsx/JSXSpreadChild/spec'; +import type { JSXText } from '../jsx/JSXText/spec'; +import type { ArrayPattern } from '../parameter/ArrayPattern/spec'; +import type { AssignmentPattern } from '../parameter/AssignmentPattern/spec'; +import type { ObjectPattern } from '../parameter/ObjectPattern/spec'; +import type { RestElement } from '../parameter/RestElement/spec'; +import type { TSParameterProperty } from '../parameter/TSParameterProperty/spec'; +import type { CatchClause } from '../special/CatchClause/spec'; +import type { ClassBody } from '../special/ClassBody/spec'; +import type { Decorator } from '../special/Decorator/spec'; +import type { EmptyStatement } from '../special/EmptyStatement/spec'; +import type { ExportSpecifier } from '../special/ExportSpecifier/spec'; +import type { ImportDefaultSpecifier } from '../special/ImportDefaultSpecifier/spec'; +import type { ImportNamespaceSpecifier } from '../special/ImportNamespaceSpecifier/spec'; +import type { ImportSpecifier } from '../special/ImportSpecifier/spec'; +import type { PrivateIdentifier } from '../special/PrivateIdentifier/spec'; +import type { Program } from '../special/Program/spec'; +import type { SwitchCase } from '../special/SwitchCase/spec'; +import type { TemplateElement } from '../special/TemplateElement/spec'; +import type { TSClassImplements } from '../special/TSClassImplements/spec'; +import type { TSExternalModuleReference } from '../special/TSExternalModuleReference/spec'; +import type { TSInterfaceBody } from '../special/TSInterfaceBody/spec'; +import type { TSInterfaceHeritage } from '../special/TSInterfaceHeritage/spec'; +import type { TSModuleBlock } from '../special/TSModuleBlock/spec'; +import type { TSTypeAnnotation } from '../special/TSTypeAnnotation/spec'; +import type { TSTypeParameter } from '../special/TSTypeParameter/spec'; +import type { TSTypeParameterDeclaration } from '../special/TSTypeParameterDeclaration/spec'; +import type { TSTypeParameterInstantiation } from '../special/TSTypeParameterInstantiation/spec'; +import type { VariableDeclarator } from '../special/VariableDeclarator/spec'; +import type { BlockStatement } from '../statement/BlockStatement/spec'; +import type { BreakStatement } from '../statement/BreakStatement/spec'; +import type { ContinueStatement } from '../statement/ContinueStatement/spec'; +import type { DebuggerStatement } from '../statement/DebuggerStatement/spec'; +import type { DoWhileStatement } from '../statement/DoWhileStatement/spec'; +import type { ExpressionStatement } from '../statement/ExpressionStatement/spec'; +import type { ForInStatement } from '../statement/ForInStatement/spec'; +import type { ForOfStatement } from '../statement/ForOfStatement/spec'; +import type { ForStatement } from '../statement/ForStatement/spec'; +import type { IfStatement } from '../statement/IfStatement/spec'; +import type { LabeledStatement } from '../statement/LabeledStatement/spec'; +import type { ReturnStatement } from '../statement/ReturnStatement/spec'; +import type { SwitchStatement } from '../statement/SwitchStatement/spec'; +import type { ThrowStatement } from '../statement/ThrowStatement/spec'; +import type { TryStatement } from '../statement/TryStatement/spec'; +import type { TSExportAssignment } from '../statement/TSExportAssignment/spec'; +import type { WhileStatement } from '../statement/WhileStatement/spec'; +import type { WithStatement } from '../statement/WithStatement/spec'; +import type { TSAbstractKeyword } from '../token/TSAbstractKeyword/spec'; +import type { TSAsyncKeyword } from '../token/TSAsyncKeyword/spec'; +import type { TSDeclareKeyword } from '../token/TSDeclareKeyword/spec'; +import type { TSExportKeyword } from '../token/TSExportKeyword/spec'; +import type { TSPrivateKeyword } from '../token/TSPrivateKeyword/spec'; +import type { TSProtectedKeyword } from '../token/TSProtectedKeyword/spec'; +import type { TSPublicKeyword } from '../token/TSPublicKeyword/spec'; +import type { TSReadonlyKeyword } from '../token/TSReadonlyKeyword/spec'; +import type { TSStaticKeyword } from '../token/TSStaticKeyword/spec'; +import type { TSAnyKeyword } from '../type/TSAnyKeyword/spec'; +import type { TSArrayType } from '../type/TSArrayType/spec'; +import type { TSBigIntKeyword } from '../type/TSBigIntKeyword/spec'; +import type { TSBooleanKeyword } from '../type/TSBooleanKeyword/spec'; +import type { TSConditionalType } from '../type/TSConditionalType/spec'; +import type { TSConstructorType } from '../type/TSConstructorType/spec'; +import type { TSFunctionType } from '../type/TSFunctionType/spec'; +import type { TSImportType } from '../type/TSImportType/spec'; +import type { TSIndexedAccessType } from '../type/TSIndexedAccessType/spec'; +import type { TSInferType } from '../type/TSInferType/spec'; +import type { TSIntersectionType } from '../type/TSIntersectionType/spec'; +import type { TSIntrinsicKeyword } from '../type/TSIntrinsicType/spec'; +import type { TSLiteralType } from '../type/TSLiteralType/spec'; +import type { TSMappedType } from '../type/TSMappedType/spec'; +import type { TSNamedTupleMember } from '../type/TSNamedTupleMember/spec'; +import type { TSNeverKeyword } from '../type/TSNeverKeyword/spec'; +import type { TSNullKeyword } from '../type/TSNullKeyword/spec'; +import type { TSNumberKeyword } from '../type/TSNumberKeyword/spec'; +import type { TSObjectKeyword } from '../type/TSObjectKeyword/spec'; +import type { TSOptionalType } from '../type/TSOptionalType/spec'; +import type { TSQualifiedName } from '../type/TSQualifiedName/spec'; +import type { TSRestType } from '../type/TSRestType/spec'; +import type { TSStringKeyword } from '../type/TSStringKeyword/spec'; +import type { TSSymbolKeyword } from '../type/TSSymbolKeyword/spec'; +import type { TSTemplateLiteralType } from '../type/TSTemplateLiteralType/spec'; +import type { TSThisType } from '../type/TSThisType/spec'; +import type { TSTupleType } from '../type/TSTupleType/spec'; +import type { TSTypeLiteral } from '../type/TSTypeLiteral/spec'; +import type { TSTypeOperator } from '../type/TSTypeOperator/spec'; +import type { TSTypePredicate } from '../type/TSTypePredicate/spec'; +import type { TSTypeQuery } from '../type/TSTypeQuery/spec'; +import type { TSTypeReference } from '../type/TSTypeReference/spec'; +import type { TSUndefinedKeyword } from '../type/TSUndefinedKeyword/spec'; +import type { TSUnionType } from '../type/TSUnionType/spec'; +import type { TSUnknownKeyword } from '../type/TSUnknownKeyword/spec'; +import type { TSVoidKeyword } from '../type/TSVoidKeyword/spec'; +import type { Literal } from './Literal'; + +/* + * NOTE: + * Tokens are not included in the `Node` union below on purpose because they are not ever included as part of the standard AST tree. + */ + +export type Node = + | ArrayExpression + | ArrayPattern + | ArrowFunctionExpression + | AssignmentExpression + | AssignmentPattern + | AwaitExpression + | BinaryExpression + | BlockStatement + | BreakStatement + | CallExpression + | CatchClause + | ChainExpression + | ClassBody + | ClassDeclaration + | ClassExpression + | ConditionalExpression + | ContinueStatement + | DebuggerStatement + | Decorator + | DoWhileStatement + | EmptyStatement + | ExportAllDeclaration + | ExportDefaultDeclaration + | ExportNamedDeclaration + | ExportSpecifier + | ExpressionStatement + | ForInStatement + | ForOfStatement + | ForStatement + | FunctionDeclaration + | FunctionExpression + | Identifier + | IfStatement + | ImportDeclaration + | ImportDefaultSpecifier + | ImportExpression + | ImportNamespaceSpecifier + | ImportSpecifier + | JSXAttribute + | JSXClosingElement + | JSXClosingFragment + | JSXElement + | JSXEmptyExpression + | JSXExpressionContainer + | JSXFragment + | JSXIdentifier + | JSXMemberExpression + | JSXNamespacedName + | JSXOpeningElement + | JSXOpeningFragment + | JSXSpreadAttribute + | JSXSpreadChild + | JSXText + | LabeledStatement + | Literal + | LogicalExpression + | MemberExpression + | MetaProperty + | MethodDefinition + | NewExpression + | ObjectExpression + | ObjectPattern + | PrivateIdentifier + | Program + | Property + | PropertyDefinition + | RestElement + | ReturnStatement + | SequenceExpression + | SpreadElement + | StaticBlock + | Super + | SwitchCase + | SwitchStatement + | TaggedTemplateExpression + | TemplateElement + | TemplateLiteral + | ThisExpression + | ThrowStatement + | TryStatement + | TSAbstractKeyword + | TSAbstractMethodDefinition + | TSAbstractPropertyDefinition + | TSAnyKeyword + | TSArrayType + | TSAsExpression + | TSAsyncKeyword + | TSBigIntKeyword + | TSBooleanKeyword + | TSCallSignatureDeclaration + | TSClassImplements + | TSConditionalType + | TSConstructorType + | TSConstructSignatureDeclaration + | TSDeclareFunction + | TSDeclareKeyword + | TSEmptyBodyFunctionExpression + | TSEnumDeclaration + | TSEnumMember + | TSExportAssignment + | TSExportKeyword + | TSExternalModuleReference + | TSFunctionType + | TSImportEqualsDeclaration + | TSImportType + | TSIndexedAccessType + | TSIndexSignature + | TSInferType + | TSInterfaceBody + | TSInterfaceDeclaration + | TSInterfaceHeritage + | TSIntersectionType + | TSIntrinsicKeyword + | TSLiteralType + | TSMappedType + | TSMethodSignature + | TSModuleBlock + | TSModuleDeclaration + | TSNamedTupleMember + | TSNamespaceExportDeclaration + | TSNeverKeyword + | TSNonNullExpression + | TSNullKeyword + | TSNumberKeyword + | TSObjectKeyword + | TSOptionalType + | TSParameterProperty + | TSPrivateKeyword + | TSPropertySignature + | TSProtectedKeyword + | TSPublicKeyword + | TSQualifiedName + | TSReadonlyKeyword + | TSRestType + | TSStaticKeyword + | TSStringKeyword + | TSSymbolKeyword + | TSTemplateLiteralType + | TSThisType + | TSTupleType + | TSTypeAliasDeclaration + | TSTypeAnnotation + | TSTypeAssertion + | TSTypeLiteral + | TSTypeOperator + | TSTypeParameter + | TSTypeParameterDeclaration + | TSTypeParameterInstantiation + | TSTypePredicate + | TSTypeQuery + | TSTypeReference + | TSUndefinedKeyword + | TSUnionType + | TSUnknownKeyword + | TSVoidKeyword + | UnaryExpression + | UpdateExpression + | VariableDeclaration + | VariableDeclarator + | WhileStatement + | WithStatement + | YieldExpression; diff --git a/packages/ast-spec/src/unions/ObjectLiteralElement.ts b/packages/ast-spec/src/unions/ObjectLiteralElement.ts new file mode 100644 index 000000000000..d7575c80c1b9 --- /dev/null +++ b/packages/ast-spec/src/unions/ObjectLiteralElement.ts @@ -0,0 +1,8 @@ +import type { MethodDefinition } from '../element/MethodDefinition/spec'; +import type { Property } from '../element/Property/spec'; +import type { SpreadElement } from '../element/SpreadElement/spec'; + +export type ObjectLiteralElement = MethodDefinition | Property | SpreadElement; + +// TODO - breaking change remove this +export type ObjectLiteralElementLike = ObjectLiteralElement; diff --git a/packages/ast-spec/src/unions/Parameter.ts b/packages/ast-spec/src/unions/Parameter.ts new file mode 100644 index 000000000000..766a8dedbe7e --- /dev/null +++ b/packages/ast-spec/src/unions/Parameter.ts @@ -0,0 +1,14 @@ +import type { Identifier } from '../expression/Identifier/spec'; +import type { ArrayPattern } from '../parameter/ArrayPattern/spec'; +import type { AssignmentPattern } from '../parameter/AssignmentPattern/spec'; +import type { ObjectPattern } from '../parameter/ObjectPattern/spec'; +import type { RestElement } from '../parameter/RestElement/spec'; +import type { TSParameterProperty } from '../parameter/TSParameterProperty/spec'; + +export type Parameter = + | ArrayPattern + | AssignmentPattern + | Identifier + | ObjectPattern + | RestElement + | TSParameterProperty; diff --git a/packages/ast-spec/src/unions/PrimaryExpression.ts b/packages/ast-spec/src/unions/PrimaryExpression.ts new file mode 100644 index 000000000000..3c1dbf07fb85 --- /dev/null +++ b/packages/ast-spec/src/unions/PrimaryExpression.ts @@ -0,0 +1,35 @@ +import type { ArrayExpression } from '../expression/ArrayExpression/spec'; +import type { ClassExpression } from '../expression/ClassExpression/spec'; +import type { FunctionExpression } from '../expression/FunctionExpression/spec'; +import type { Identifier } from '../expression/Identifier/spec'; +import type { JSXElement } from '../expression/JSXElement/spec'; +import type { JSXFragment } from '../expression/JSXFragment/spec'; +import type { MetaProperty } from '../expression/MetaProperty/spec'; +import type { ObjectExpression } from '../expression/ObjectExpression/spec'; +import type { Super } from '../expression/Super/spec'; +import type { TemplateLiteral } from '../expression/TemplateLiteral/spec'; +import type { ThisExpression } from '../expression/ThisExpression/spec'; +import type { JSXOpeningElement } from '../jsx/JSXOpeningElement/spec'; +import type { ArrayPattern } from '../parameter/ArrayPattern/spec'; +import type { ObjectPattern } from '../parameter/ObjectPattern/spec'; +import type { TSNullKeyword } from '../type/TSNullKeyword/spec'; +import type { LiteralExpression } from './LiteralExpression'; + +// TODO - breaking change remove this +export type PrimaryExpression = + | ArrayExpression + | ArrayPattern + | ClassExpression + | FunctionExpression + | Identifier + | JSXElement + | JSXFragment + | JSXOpeningElement + | LiteralExpression + | MetaProperty + | ObjectExpression + | ObjectPattern + | Super + | TemplateLiteral + | ThisExpression + | TSNullKeyword; diff --git a/packages/ast-spec/src/unions/PropertyName.ts b/packages/ast-spec/src/unions/PropertyName.ts new file mode 100644 index 000000000000..dce45834d7f6 --- /dev/null +++ b/packages/ast-spec/src/unions/PropertyName.ts @@ -0,0 +1,19 @@ +import type { Identifier } from '../expression/Identifier/spec'; +import type { NumberLiteral } from '../expression/literal/NumberLiteral/spec'; +import type { StringLiteral } from '../expression/literal/StringLiteral/spec'; +import type { PrivateIdentifier } from '../special/PrivateIdentifier/spec'; +import type { Expression } from '../unions/Expression'; + +export type PropertyName = + | ClassPropertyNameNonComputed + | PropertyNameComputed + | PropertyNameNonComputed; +export type PropertyNameComputed = Expression; +export type PropertyNameNonComputed = + | Identifier + | NumberLiteral + | StringLiteral; +export type ClassPropertyNameNonComputed = + | PrivateIdentifier + // only class properties can have private identifiers as their names + | PropertyNameNonComputed; diff --git a/packages/ast-spec/src/unions/Statement.ts b/packages/ast-spec/src/unions/Statement.ts new file mode 100644 index 000000000000..e1af96b7fe5d --- /dev/null +++ b/packages/ast-spec/src/unions/Statement.ts @@ -0,0 +1,78 @@ +import type { ClassDeclaration } from '../declaration/ClassDeclaration/spec'; +import type { ExportAllDeclaration } from '../declaration/ExportAllDeclaration/spec'; +import type { ExportDefaultDeclaration } from '../declaration/ExportDefaultDeclaration/spec'; +import type { ExportNamedDeclaration } from '../declaration/ExportNamedDeclaration/spec'; +import type { FunctionDeclaration } from '../declaration/FunctionDeclaration/spec'; +import type { ImportDeclaration } from '../declaration/ImportDeclaration/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 { TSNamespaceExportDeclaration } from '../declaration/TSNamespaceExportDeclaration/spec'; +import type { TSTypeAliasDeclaration } from '../declaration/TSTypeAliasDeclaration/spec'; +import type { VariableDeclaration } from '../declaration/VariableDeclaration/spec'; +import type { BlockStatement } from '../statement/BlockStatement/spec'; +import type { BreakStatement } from '../statement/BreakStatement/spec'; +import type { ContinueStatement } from '../statement/ContinueStatement/spec'; +import type { DebuggerStatement } from '../statement/DebuggerStatement/spec'; +import type { DoWhileStatement } from '../statement/DoWhileStatement/spec'; +import type { ExpressionStatement } from '../statement/ExpressionStatement/spec'; +import type { ForInStatement } from '../statement/ForInStatement/spec'; +import type { ForOfStatement } from '../statement/ForOfStatement/spec'; +import type { ForStatement } from '../statement/ForStatement/spec'; +import type { IfStatement } from '../statement/IfStatement/spec'; +import type { LabeledStatement } from '../statement/LabeledStatement/spec'; +import type { ReturnStatement } from '../statement/ReturnStatement/spec'; +import type { SwitchStatement } from '../statement/SwitchStatement/spec'; +import type { ThrowStatement } from '../statement/ThrowStatement/spec'; +import type { TryStatement } from '../statement/TryStatement/spec'; +import type { TSExportAssignment } from '../statement/TSExportAssignment/spec'; +import type { WhileStatement } from '../statement/WhileStatement/spec'; +import type { WithStatement } from '../statement/WithStatement/spec'; + +export type Statement = + | BlockStatement + | BreakStatement + | ClassDeclaration + | ContinueStatement + | DebuggerStatement + | DoWhileStatement + | ExportAllDeclaration + | ExportDefaultDeclaration + | ExportNamedDeclaration + | ExpressionStatement + | ForInStatement + | ForOfStatement + | ForStatement + | FunctionDeclaration + | IfStatement + | ImportDeclaration + | LabeledStatement + | ReturnStatement + | SwitchStatement + | ThrowStatement + | TryStatement + | TSDeclareFunction + | TSEnumDeclaration + | TSExportAssignment + | TSImportEqualsDeclaration + | TSInterfaceDeclaration + | TSModuleDeclaration + | TSNamespaceExportDeclaration + | TSTypeAliasDeclaration + | VariableDeclaration + | WhileStatement + | WithStatement; + +// These nodes are ***only*** allowed at the top-level +export type ProgramStatement = + | ExportAllDeclaration + | ExportDefaultDeclaration + | ExportNamedDeclaration + | ImportDeclaration + | Statement + | TSImportEqualsDeclaration + | TSNamespaceExportDeclaration; + +// TODO - once we have syntax errors, the types in ProgramStatement should not be in Statement diff --git a/packages/ast-spec/src/unions/TSUnaryExpression.ts b/packages/ast-spec/src/unions/TSUnaryExpression.ts new file mode 100644 index 000000000000..14bde5deec14 --- /dev/null +++ b/packages/ast-spec/src/unions/TSUnaryExpression.ts @@ -0,0 +1,11 @@ +import type { AwaitExpression } from '../expression/AwaitExpression/spec'; +import type { UnaryExpression } from '../expression/UnaryExpression/spec'; +import type { UpdateExpression } from '../expression/UpdateExpression/spec'; +import type { LeftHandSideExpression } from './LeftHandSideExpression'; + +// TODO - breaking change remove this +export type TSUnaryExpression = + | AwaitExpression + | LeftHandSideExpression + | UnaryExpression + | UpdateExpression; diff --git a/packages/ast-spec/src/unions/Token.ts b/packages/ast-spec/src/unions/Token.ts new file mode 100644 index 000000000000..3d71cb019a7f --- /dev/null +++ b/packages/ast-spec/src/unions/Token.ts @@ -0,0 +1,26 @@ +import type { BooleanToken } from '../token/BooleanToken/spec'; +import type { IdentifierToken } from '../token/IdentifierToken/spec'; +import type { JSXIdentifierToken } from '../token/JSXIdentifierToken/spec'; +import type { JSXTextToken } from '../token/JSXTextToken/spec'; +import type { KeywordToken } from '../token/KeywordToken/spec'; +import type { NullToken } from '../token/NullToken/spec'; +import type { NumericToken } from '../token/NumericToken/spec'; +import type { PunctuatorToken } from '../token/PunctuatorToken/spec'; +import type { RegularExpressionToken } from '../token/RegularExpressionToken/spec'; +import type { StringToken } from '../token/StringToken/spec'; +import type { TemplateToken } from '../token/TemplateToken/spec'; +import type { Comment } from './Comment'; + +export type Token = + | BooleanToken + | Comment + | IdentifierToken + | JSXIdentifierToken + | JSXTextToken + | KeywordToken + | NullToken + | NumericToken + | PunctuatorToken + | RegularExpressionToken + | StringToken + | TemplateToken; diff --git a/packages/ast-spec/src/unions/TypeElement.ts b/packages/ast-spec/src/unions/TypeElement.ts new file mode 100644 index 000000000000..9a4bbc99c223 --- /dev/null +++ b/packages/ast-spec/src/unions/TypeElement.ts @@ -0,0 +1,12 @@ +import type { TSCallSignatureDeclaration } from '../element/TSCallSignatureDeclaration/spec'; +import type { TSConstructSignatureDeclaration } from '../element/TSConstructSignatureDeclaration/spec'; +import type { TSIndexSignature } from '../element/TSIndexSignature/spec'; +import type { TSMethodSignature } from '../element/TSMethodSignature/spec'; +import type { TSPropertySignature } from '../element/TSPropertySignature/spec'; + +export type TypeElement = + | TSCallSignatureDeclaration + | TSConstructSignatureDeclaration + | TSIndexSignature + | TSMethodSignature + | TSPropertySignature; diff --git a/packages/ast-spec/src/unions/TypeNode.ts b/packages/ast-spec/src/unions/TypeNode.ts new file mode 100644 index 000000000000..55436b7a44d4 --- /dev/null +++ b/packages/ast-spec/src/unions/TypeNode.ts @@ -0,0 +1,72 @@ +import type { TSAnyKeyword } from '../type/TSAnyKeyword/spec'; +import type { TSArrayType } from '../type/TSArrayType/spec'; +import type { TSBigIntKeyword } from '../type/TSBigIntKeyword/spec'; +import type { TSBooleanKeyword } from '../type/TSBooleanKeyword/spec'; +import type { TSConditionalType } from '../type/TSConditionalType/spec'; +import type { TSConstructorType } from '../type/TSConstructorType/spec'; +import type { TSFunctionType } from '../type/TSFunctionType/spec'; +import type { TSImportType } from '../type/TSImportType/spec'; +import type { TSIndexedAccessType } from '../type/TSIndexedAccessType/spec'; +import type { TSInferType } from '../type/TSInferType/spec'; +import type { TSIntersectionType } from '../type/TSIntersectionType/spec'; +import type { TSIntrinsicKeyword } from '../type/TSIntrinsicType/spec'; +import type { TSLiteralType } from '../type/TSLiteralType/spec'; +import type { TSMappedType } from '../type/TSMappedType/spec'; +import type { TSNamedTupleMember } from '../type/TSNamedTupleMember/spec'; +import type { TSNeverKeyword } from '../type/TSNeverKeyword/spec'; +import type { TSNullKeyword } from '../type/TSNullKeyword/spec'; +import type { TSNumberKeyword } from '../type/TSNumberKeyword/spec'; +import type { TSObjectKeyword } from '../type/TSObjectKeyword/spec'; +import type { TSOptionalType } from '../type/TSOptionalType/spec'; +import type { TSRestType } from '../type/TSRestType/spec'; +import type { TSStringKeyword } from '../type/TSStringKeyword/spec'; +import type { TSSymbolKeyword } from '../type/TSSymbolKeyword/spec'; +import type { TSTemplateLiteralType } from '../type/TSTemplateLiteralType/spec'; +import type { TSThisType } from '../type/TSThisType/spec'; +import type { TSTupleType } from '../type/TSTupleType/spec'; +import type { TSTypeLiteral } from '../type/TSTypeLiteral/spec'; +import type { TSTypeOperator } from '../type/TSTypeOperator/spec'; +import type { TSTypePredicate } from '../type/TSTypePredicate/spec'; +import type { TSTypeQuery } from '../type/TSTypeQuery/spec'; +import type { TSTypeReference } from '../type/TSTypeReference/spec'; +import type { TSUndefinedKeyword } from '../type/TSUndefinedKeyword/spec'; +import type { TSUnionType } from '../type/TSUnionType/spec'; +import type { TSUnknownKeyword } from '../type/TSUnknownKeyword/spec'; +import type { TSVoidKeyword } from '../type/TSVoidKeyword/spec'; + +export type TypeNode = + | TSAnyKeyword + | TSArrayType + | TSBigIntKeyword + | TSBooleanKeyword + | TSConditionalType + | TSConstructorType + | TSFunctionType + | TSImportType + | TSIndexedAccessType + | TSInferType + | TSIntersectionType + | TSIntrinsicKeyword + | TSLiteralType + | TSMappedType + | TSNamedTupleMember + | TSNeverKeyword + | TSNullKeyword + | TSNumberKeyword + | TSObjectKeyword + | TSOptionalType + | TSRestType + | TSStringKeyword + | TSSymbolKeyword + | TSTemplateLiteralType + | TSThisType + | TSTupleType + | TSTypeLiteral + | TSTypeOperator + | TSTypePredicate + | TSTypeQuery + | TSTypeReference + | TSUndefinedKeyword + | TSUnionType + | TSUnknownKeyword + | TSVoidKeyword; diff --git a/packages/ast-spec/tests/PunctuatorTokenToText.test.ts b/packages/ast-spec/tests/PunctuatorTokenToText.test.ts new file mode 100644 index 000000000000..32deee0bea9a --- /dev/null +++ b/packages/ast-spec/tests/PunctuatorTokenToText.test.ts @@ -0,0 +1,11 @@ +import type { PunctuationSyntaxKind } from 'typescript'; + +import type { PunctuatorTokenToText } from '../src'; + +// @ts-expect-error: purposely unused +type _Test = { + readonly [T in PunctuationSyntaxKind]: PunctuatorTokenToText[T]; + // If there are any PunctuationSyntaxKind members that don't have a + // corresponding PunctuatorTokenToText, then this line will error with + // "Type 'T' cannot be used to index type 'PunctuatorTokenToText'." +}; diff --git a/packages/ast-spec/tests/ast-node-types.test.ts b/packages/ast-spec/tests/ast-node-types.test.ts new file mode 100644 index 000000000000..7cc247f2d094 --- /dev/null +++ b/packages/ast-spec/tests/ast-node-types.test.ts @@ -0,0 +1,16 @@ +import type { AST_NODE_TYPES } from '../src/ast-node-types'; +import type { Node } from '../src/unions/Node'; + +type GetKeys = keyof Extract; + +type AllKeys = { + readonly [T in AST_NODE_TYPES]: GetKeys; +}; + +type TakesString> = T; + +// @ts-expect-error: purposely unused +type _Test = + // forcing the test onto a new line so it isn't covered by the expect error + // If there are any enum members that don't have a corresponding TSESTree.Node, then this line will error with "Type 'string | number | symbol' is not assignable to type 'string'." + TakesString | void; diff --git a/packages/ast-spec/tsconfig.build.json b/packages/ast-spec/tsconfig.build.json new file mode 100644 index 000000000000..215a0282df2b --- /dev/null +++ b/packages/ast-spec/tsconfig.build.json @@ -0,0 +1,10 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "composite": true, + "outDir": "./dist", + "rootDir": "./src", + "resolveJsonModule": true + }, + "include": ["src", "typings"] +} diff --git a/packages/ast-spec/tsconfig.json b/packages/ast-spec/tsconfig.json new file mode 100644 index 000000000000..4b76ef4253b9 --- /dev/null +++ b/packages/ast-spec/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.build.json", + "compilerOptions": { + "composite": false, + "rootDir": "." + }, + "include": ["src", "typings", "tests", "tools", "./rollup.config.ts"] +} diff --git a/packages/eslint-plugin-internal/CHANGELOG.md b/packages/eslint-plugin-internal/CHANGELOG.md index fbfe59d26529..63eec6987363 100644 --- a/packages/eslint-plugin-internal/CHANGELOG.md +++ b/packages/eslint-plugin-internal/CHANGELOG.md @@ -3,6 +3,280 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.2.0...v5.3.0) (2021-11-01) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal + + + + + +# [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/eslint-plugin-internal + + + + + +# [5.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.0.0...v5.1.0) (2021-10-18) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal + + + + + +# [5.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.33.0...v5.0.0) (2021-10-11) + + +### Features + +* 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)) +* support ESLint v8 ([#3737](https://github.com/typescript-eslint/typescript-eslint/issues/3737)) ([4ca62ae](https://github.com/typescript-eslint/typescript-eslint/commit/4ca62aee6681d706e762a8db727541ca204364f2)) + + + + + +# [4.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.32.0...v4.33.0) (2021-10-04) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal + + + + + +# [4.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.2...v4.32.0) (2021-09-27) + + +### Features + +* **eslint-plugin-internal:** [prefer-ast-types-enum] add `DefinitionType` enum ([#3916](https://github.com/typescript-eslint/typescript-eslint/issues/3916)) ([13b7de5](https://github.com/typescript-eslint/typescript-eslint/commit/13b7de508e0f8eac492879ff9ab99acd8d3e977e)) + + + + + +## [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/eslint-plugin-internal + + + + + +## [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/eslint-plugin-internal + + + + + +# [4.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.30.0...v4.31.0) (2021-09-06) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal + + + + + +# [4.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.3...v4.30.0) (2021-08-30) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal + + + + + +## [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/eslint-plugin-internal + + + + + +## [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/eslint-plugin-internal + + + + + +## [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/eslint-plugin-internal + + + + + +# [4.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.5...v4.29.0) (2021-08-02) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal + + + + + +## [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/eslint-plugin-internal + + + + + +## [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/eslint-plugin-internal + + + + + +## [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/eslint-plugin-internal + + + + + +## [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/eslint-plugin-internal + + + + + +## [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/eslint-plugin-internal + + + + + +# [4.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.27.0...v4.28.0) (2021-06-21) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal + + + + + +# [4.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.1...v4.27.0) (2021-06-14) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal + + + + + +## [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/eslint-plugin-internal + + + + + +# [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/eslint-plugin-internal + + + + + +# [4.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.24.0...v4.25.0) (2021-05-24) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal + + + + + +# [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/eslint-plugin-internal + + + + + +# [4.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.1...v4.23.0) (2021-05-10) + + +### Features + +* 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/eslint-plugin-internal + + + + + +# [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/eslint-plugin-internal + + + + + +# [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/eslint-plugin-internal + + + + + +# [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/eslint-plugin-internal + + + + + +# [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/eslint-plugin-internal + + + + + +# [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/eslint-plugin-internal + + + + + +# [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/eslint-plugin-internal + + + + + ## [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/eslint-plugin-internal diff --git a/packages/eslint-plugin-internal/jest.config.js b/packages/eslint-plugin-internal/jest.config.js index cce8d6c61baf..bf4e270e3760 100644 --- a/packages/eslint-plugin-internal/jest.config.js +++ b/packages/eslint-plugin-internal/jest.config.js @@ -3,6 +3,7 @@ // @ts-check /** @type {import('@jest/types').Config.InitialOptions} */ module.exports = { + resolver: '/../../tests/jest-resolver.js', globals: { 'ts-jest': { isolatedModules: true, diff --git a/packages/eslint-plugin-internal/package.json b/packages/eslint-plugin-internal/package.json index 8d6cc10ab338..5ee193ea771d 100644 --- a/packages/eslint-plugin-internal/package.json +++ b/packages/eslint-plugin-internal/package.json @@ -1,12 +1,12 @@ { "name": "@typescript-eslint/eslint-plugin-internal", - "version": "4.16.1", + "version": "5.3.0", "private": true, "main": "dist/index.js", "scripts": { "build": "tsc -b tsconfig.build.json", "clean": "tsc -b tsconfig.build.json --clean", - "postclean": "rimraf dist", + "postclean": "rimraf dist && rimraf coverage", "format": "prettier --write \"./**/*.{ts,js,json,md}\" --ignore-path ../../.prettierignore", "lint": "eslint . --ext .js,.ts --ignore-path='../../.eslintignore'", "test": "jest --coverage", @@ -14,7 +14,8 @@ }, "dependencies": { "@types/prettier": "*", - "@typescript-eslint/experimental-utils": "4.16.1", + "@typescript-eslint/experimental-utils": "5.3.0", + "@typescript-eslint/scope-manager": "5.3.0", "prettier": "*" } } diff --git a/packages/eslint-plugin-internal/project.json b/packages/eslint-plugin-internal/project.json new file mode 100644 index 000000000000..948fce1f60cc --- /dev/null +++ b/packages/eslint-plugin-internal/project.json @@ -0,0 +1,5 @@ +{ + "root": "packages/eslint-plugin-internal", + "type": "library", + "implicitDependencies": [] +} 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 1fa447080ba7..f91068d9ffe0 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 @@ -1,7 +1,7 @@ import { - TSESTree, ESLintUtils, TSESLint, + TSESTree, } from '@typescript-eslint/experimental-utils'; import { createRule } from '../util'; @@ -24,6 +24,7 @@ const BANNED_PROPERTIES = [ fixWith: 'getDeclarations()', }, { + // eslint-disable-next-line @typescript-eslint/internal/prefer-ast-types-enum type: 'Type', property: 'symbol', fixWith: 'getSymbol()', @@ -37,12 +38,12 @@ export default createRule({ docs: { description: "Enforces rules don't use TS API properties with known bad type definitions", - category: 'Possible Errors', recommended: 'error', suggestion: true, requiresTypeChecking: true, }, fixable: 'code', + hasSuggestions: true, schema: [], messages: { doNotUse: 'Do not use {{type}}.{{property}} because it is poorly typed.', @@ -53,9 +54,8 @@ export default createRule({ }, defaultOptions: [], create(context) { - const { program, esTreeNodeToTSNodeMap } = ESLintUtils.getParserServices( - context, - ); + const { program, esTreeNodeToTSNodeMap } = + ESLintUtils.getParserServices(context); const checker = program.getTypeChecker(); return { 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 ff4e35dc4f60..c82561312496 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 @@ -22,7 +22,6 @@ export default createRule({ docs: { description: "Enforces that packages rules don't do `import ts from 'typescript';`", - category: 'Possible Errors', recommended: 'error', }, fixable: 'code', 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 b3c3a71c60d6..3cc96a0f6003 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,6 @@ export default createRule({ type: 'problem', docs: { description: `Enforces that eslint-plugin rules don't require anything from ${TSESTREE_NAME} or ${TYPES_NAME}`, - category: 'Possible Errors', recommended: 'error', }, fixable: 'code', 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 bc26d9d9d9a1..81fcb8c41cf2 100644 --- a/packages/eslint-plugin-internal/src/rules/plugin-test-formatting.ts +++ b/packages/eslint-plugin-internal/src/rules/plugin-test-formatting.ts @@ -108,7 +108,6 @@ export default createRule({ type: 'problem', docs: { description: `Enforces that eslint-plugin test snippets are correctly formatted`, - category: 'Stylistic Issues', recommended: 'error', }, fixable: 'code', @@ -408,7 +407,9 @@ export default createRule({ } } - function isNoFormatTemplateTag(tag: TSESTree.Expression): boolean { + function isNoFormatTemplateTag( + tag: TSESTree.LeftHandSideExpression, + ): boolean { return tag.type === AST_NODE_TYPES.Identifier && tag.name === 'noFormat'; } @@ -488,7 +489,8 @@ export default createRule({ return { // valid - 'CallExpression > ObjectExpression > Property[key.name = "valid"] > ArrayExpression': checkValidTest, + 'CallExpression > ObjectExpression > Property[key.name = "valid"] > ArrayExpression': + checkValidTest, // invalid - errors [invalidTestsSelectorPath.join(' > ')]: checkInvalidTest, // invalid - suggestions @@ -502,7 +504,8 @@ export default createRule({ AST_NODE_TYPES.ObjectExpression, ].join(' > ')]: checkInvalidTest, // special case for our batchedSingleLineTests utility - 'CallExpression[callee.name = "batchedSingleLineTests"] > ObjectExpression': checkInvalidTest, + 'CallExpression[callee.name = "batchedSingleLineTests"] > ObjectExpression': + checkInvalidTest, }; }, }); 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 8a5ec63bb4eb..e98d0904af52 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 @@ -3,6 +3,7 @@ import { AST_TOKEN_TYPES, TSESTree, } from '@typescript-eslint/experimental-utils'; +import { DefinitionType } from '@typescript-eslint/scope-manager'; import { createRule } from '../util'; const isStringLiteral = ( @@ -14,10 +15,9 @@ export default createRule({ meta: { type: 'problem', docs: { - category: 'Best Practices', recommended: 'error', description: - 'Ensures consistent usage of AST_NODE_TYPES & AST_TOKEN_TYPES enums.', + 'Ensures consistent usage of `AST_NODE_TYPES`, `AST_TOKEN_TYPES` and `DefinitionType` enums.', }, messages: { preferEnum: 'Prefer {{ enumName }}.{{ literal }} over raw literal', @@ -28,7 +28,7 @@ export default createRule({ defaultOptions: [], create(context) { const report = ( - enumName: 'AST_NODE_TYPES' | 'AST_TOKEN_TYPES', + enumName: 'AST_NODE_TYPES' | 'AST_TOKEN_TYPES' | 'DefinitionType', literal: TSESTree.StringLiteral, ): void => context.report({ @@ -44,7 +44,7 @@ export default createRule({ if ( node.parent?.type === AST_NODE_TYPES.TSEnumMember && node.parent.parent?.type === AST_NODE_TYPES.TSEnumDeclaration && - ['AST_NODE_TYPES', 'AST_TOKEN_TYPES'].includes( + ['AST_NODE_TYPES', 'AST_TOKEN_TYPES', 'DefinitionType'].includes( node.parent.parent.id.name, ) ) { @@ -64,6 +64,10 @@ export default createRule({ if (Object.prototype.hasOwnProperty.call(AST_TOKEN_TYPES, value)) { report('AST_TOKEN_TYPES', node); } + + if (Object.prototype.hasOwnProperty.call(DefinitionType, value)) { + report('DefinitionType', node); + } }, }; }, diff --git a/packages/eslint-plugin-internal/src/util/createRule.ts b/packages/eslint-plugin-internal/src/util/createRule.ts index 24c630d52450..2ac52d199fc8 100644 --- a/packages/eslint-plugin-internal/src/util/createRule.ts +++ b/packages/eslint-plugin-internal/src/util/createRule.ts @@ -1,7 +1,8 @@ import { ESLintUtils } from '@typescript-eslint/experimental-utils'; // note - cannot migrate this to an import statement because it will make TSC copy the package.json to the dist folder -const version = require('../../package.json').version; +// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment +const version: string = require('../../package.json'); const createRule = ESLintUtils.RuleCreator( name => 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 8fe109ee3d13..4c9751489bd9 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,5 +1,6 @@ +/* eslint-disable @typescript-eslint/internal/prefer-ast-types-enum */ import rule from '../../src/rules/no-poorly-typed-ts-props'; -import { RuleTester, getFixturesRootDir } from '../RuleTester'; +import { getFixturesRootDir, RuleTester } 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 c2ffd8e489e0..94f8830a04ed 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 @@ -2,8 +2,9 @@ import { AST_NODE_TYPES, AST_TOKEN_TYPES, } from '@typescript-eslint/experimental-utils'; +import { DefinitionType } from '@typescript-eslint/scope-manager'; import rule from '../../src/rules/prefer-ast-types-enum'; -import { RuleTester, batchedSingleLineTests } from '../RuleTester'; +import { batchedSingleLineTests, RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', @@ -17,6 +18,7 @@ ruleTester.run('prefer-ast-types-enum', rule, { "node.type === 'constructor';", 'node.type === AST_NODE_TYPES.Literal;', 'node.type === AST_TOKEN_TYPES.Keyword;', + 'node.type === DefinitionType.Parameter;', 'node.type === 1;', ` enum MY_ENUM { @@ -33,10 +35,12 @@ ruleTester.run('prefer-ast-types-enum', rule, { 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: [ { @@ -49,6 +53,11 @@ node.type === AST_TOKEN_TYPES.Keyword; messageId: 'preferEnum', line: 3, }, + { + data: { enumName: 'DefinitionType', literal: DefinitionType.Parameter }, + messageId: 'preferEnum', + line: 4, + }, ], }), }); diff --git a/packages/eslint-plugin-tslint/CHANGELOG.md b/packages/eslint-plugin-tslint/CHANGELOG.md index 423df7673046..71737e6edff4 100644 --- a/packages/eslint-plugin-tslint/CHANGELOG.md +++ b/packages/eslint-plugin-tslint/CHANGELOG.md @@ -3,6 +3,277 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.2.0...v5.3.0) (2021-11-01) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + + + + + +# [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/eslint-plugin-tslint + + + + + +# [5.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.0.0...v5.1.0) (2021-10-18) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + + + + + +# [5.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.33.0...v5.0.0) (2021-10-11) + + +### Features + +* 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)) +* support ESLint v8 ([#3737](https://github.com/typescript-eslint/typescript-eslint/issues/3737)) ([4ca62ae](https://github.com/typescript-eslint/typescript-eslint/commit/4ca62aee6681d706e762a8db727541ca204364f2)) + + + + + +# [4.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.32.0...v4.33.0) (2021-10-04) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + + + + + +# [4.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.2...v4.32.0) (2021-09-27) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + + + + + +## [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/eslint-plugin-tslint + + + + + +## [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/eslint-plugin-tslint + + + + + +# [4.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.30.0...v4.31.0) (2021-09-06) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + + + + + +# [4.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.3...v4.30.0) (2021-08-30) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + + + + + +## [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/eslint-plugin-tslint + + + + + +## [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/eslint-plugin-tslint + + + + + +## [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/eslint-plugin-tslint + + + + + +# [4.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.5...v4.29.0) (2021-08-02) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + + + + + +## [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/eslint-plugin-tslint + + + + + +## [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/eslint-plugin-tslint + + + + + +## [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/eslint-plugin-tslint + + + + + +## [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/eslint-plugin-tslint + + + + + +## [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/eslint-plugin-tslint + + + + + +# [4.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.27.0...v4.28.0) (2021-06-21) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + + + + + +# [4.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.1...v4.27.0) (2021-06-14) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + + + + + +## [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/eslint-plugin-tslint + + + + + +# [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/eslint-plugin-tslint + + + + + +# [4.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.24.0...v4.25.0) (2021-05-24) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + + + + + +# [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/eslint-plugin-tslint + + + + + +# [4.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.1...v4.23.0) (2021-05-10) + + +### Features + +* 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/eslint-plugin-tslint + + + + + +# [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/eslint-plugin-tslint + + + + + +# [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/eslint-plugin-tslint + + + + + +# [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/eslint-plugin-tslint + + + + + +# [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/eslint-plugin-tslint + + + + + +# [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/eslint-plugin-tslint + + + + + +# [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/eslint-plugin-tslint + + + + + ## [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/eslint-plugin-tslint diff --git a/packages/eslint-plugin-tslint/jest.config.js b/packages/eslint-plugin-tslint/jest.config.js index 76cf71504591..37b87a10d75b 100644 --- a/packages/eslint-plugin-tslint/jest.config.js +++ b/packages/eslint-plugin-tslint/jest.config.js @@ -3,6 +3,7 @@ // @ts-check /** @type {import('@jest/types').Config.InitialOptions} */ module.exports = { + resolver: '/../../tests/jest-resolver.js', globals: { 'ts-jest': { isolatedModules: true, diff --git a/packages/eslint-plugin-tslint/package.json b/packages/eslint-plugin-tslint/package.json index 1deff124a26e..1a178b917f6e 100644 --- a/packages/eslint-plugin-tslint/package.json +++ b/packages/eslint-plugin-tslint/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin-tslint", - "version": "4.16.1", + "version": "5.3.0", "main": "dist/index.js", "typings": "src/index.ts", "description": "TSLint wrapper plugin for ESLint", @@ -11,7 +11,7 @@ "tslint" ], "engines": { - "node": "^10.12.0 || >=12.0.0" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "files": [ "dist", @@ -31,23 +31,23 @@ "scripts": { "build": "tsc -b tsconfig.build.json", "clean": "tsc -b tsconfig.build.json --clean", - "postclean": "rimraf dist", + "postclean": "rimraf dist && rimraf coverage", "format": "prettier --write \"./**/*.{ts,js,json,md}\" --ignore-path ../../.prettierignore", "lint": "eslint . --ext .js,.ts --ignore-path='../../.eslintignore'", "test": "jest --coverage", "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/experimental-utils": "4.16.1", - "lodash": "^4.17.15" + "@typescript-eslint/experimental-utils": "5.3.0", + "lodash": "^4.17.21" }, "peerDependencies": { - "eslint": "^5.0.0 || ^6.0.0 || ^7.0.0", + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0", "tslint": "^5.0.0 || ^6.0.0", "typescript": "*" }, "devDependencies": { "@types/lodash": "*", - "@typescript-eslint/parser": "4.16.1" + "@typescript-eslint/parser": "5.3.0" } } diff --git a/packages/eslint-plugin-tslint/project.json b/packages/eslint-plugin-tslint/project.json new file mode 100644 index 000000000000..8ca785bd7d15 --- /dev/null +++ b/packages/eslint-plugin-tslint/project.json @@ -0,0 +1,5 @@ +{ + "root": "packages/eslint-plugin-tslint", + "type": "library", + "implicitDependencies": [] +} diff --git a/packages/eslint-plugin-tslint/src/custom-linter.ts b/packages/eslint-plugin-tslint/src/custom-linter.ts index eb8527b99d71..9fcaf9c2b3ed 100644 --- a/packages/eslint-plugin-tslint/src/custom-linter.ts +++ b/packages/eslint-plugin-tslint/src/custom-linter.ts @@ -1,11 +1,8 @@ import { ILinterOptions, Linter, LintResult } from 'tslint'; import { Program, SourceFile } from 'typescript'; -// We need to access the program, but Linter has private program already -// eslint-disable-next-line @typescript-eslint/no-explicit-any -const TSLintLinter = Linter as any; - -export class CustomLinter extends TSLintLinter { +// @ts-expect-error - We need to access the program, but Linter has private program already +export class CustomLinter extends Linter { constructor(options: ILinterOptions, private readonly program: Program) { super(options, program); } diff --git a/packages/eslint-plugin-tslint/src/rules/config.ts b/packages/eslint-plugin-tslint/src/rules/config.ts index b6da50bbf50e..7bf51826541f 100644 --- a/packages/eslint-plugin-tslint/src/rules/config.ts +++ b/packages/eslint-plugin-tslint/src/rules/config.ts @@ -4,7 +4,8 @@ import { Configuration, RuleSeverity } from 'tslint'; import { CustomLinter } from '../custom-linter'; // note - cannot migrate this to an import statement because it will make TSC copy the package.json to the dist folder -const version = require('../../package.json').version; +// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment +const version: string = require('../../package.json'); const createRule = ESLintUtils.RuleCreator( () => @@ -62,8 +63,6 @@ export default createRule({ docs: { description: 'Wraps a TSLint configuration and lints the whole source using TSLint', - // one off special category for this plugin - category: 'TSLint' as any, // eslint-disable-line @typescript-eslint/no-explicit-any recommended: false, }, fixable: 'code', @@ -105,11 +104,9 @@ export default createRule({ /** * The TSLint rules configuration passed in by the user */ - const { - rules: tslintRules, - rulesDirectory: tslintRulesDirectory, - lintFile, - } = context.options[0]; + const [ + { rules: tslintRules, rulesDirectory: tslintRulesDirectory, lintFile }, + ] = context.options; const program = parserServices.program; diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index 4b4fda7ee153..d102d6349394 100644 --- a/packages/eslint-plugin/CHANGELOG.md +++ b/packages/eslint-plugin/CHANGELOG.md @@ -3,6 +3,475 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.2.0...v5.3.0) (2021-11-01) + + +### Bug Fixes + +* **eslint-plugin:** ignore private identifiers in explicit-module-boundary-types ([#4046](https://github.com/typescript-eslint/typescript-eslint/issues/4046)) ([80b853d](https://github.com/typescript-eslint/typescript-eslint/commit/80b853db90ae3d4e32c4b7ec9d45a5c41dc459c9)) +* **eslint-plugin:** skip seenTypes for unions in isTypeReadonly ([#4043](https://github.com/typescript-eslint/typescript-eslint/issues/4043)) ([6af7ca7](https://github.com/typescript-eslint/typescript-eslint/commit/6af7ca7d9fde230342d27ad5a75a09a58c022974)) + + +### Features + +* **eslint-plugin:** [no-shadow] exclude external type declaration merging ([#3959](https://github.com/typescript-eslint/typescript-eslint/issues/3959)) ([a93cebf](https://github.com/typescript-eslint/typescript-eslint/commit/a93cebfc0f2026c50972bcb110bcd3295ba9a44d)) + + + + + +# [5.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.1.0...v5.2.0) (2021-10-25) + + +### Bug Fixes + +* **eslint-plugin:** [typedef] fix regression with class properties ([#4034](https://github.com/typescript-eslint/typescript-eslint/issues/4034)) ([fe53d22](https://github.com/typescript-eslint/typescript-eslint/commit/fe53d22f57ad418397fb31fa89c97db0ab4cd6c0)), closes [#4033](https://github.com/typescript-eslint/typescript-eslint/issues/4033) + + +### Features + +* **eslint-plugin:** adding `consistent-type-exports` rule ([#3936](https://github.com/typescript-eslint/typescript-eslint/issues/3936)) ([1971a3f](https://github.com/typescript-eslint/typescript-eslint/commit/1971a3f8027416cd1fb33b1d50faa035599917de)) + + + + + +# [5.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.0.0...v5.1.0) (2021-10-18) + + +### Bug Fixes + +* **eslint-plugin:** [no-restricted-imports]: report type-only imports properly ([#3996](https://github.com/typescript-eslint/typescript-eslint/issues/3996)) ([283cdf2](https://github.com/typescript-eslint/typescript-eslint/commit/283cdf26e6b32985531ff6416cd13ef4cb0a3c8c)) +* **eslint-plugin:** [strict-bool-expr] treat unconstrained generic as any ([#3981](https://github.com/typescript-eslint/typescript-eslint/issues/3981)) ([9b29ca7](https://github.com/typescript-eslint/typescript-eslint/commit/9b29ca751f496c25240c0c14b8fa432bf4443d39)) + + + + + +# [5.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.33.0...v5.0.0) (2021-10-11) + + +### Bug Fixes + +* **eslint-plugin:** [explicit-member-accessibility] report `TSAbstractPropertyDefinition` and `TSAbstractMethodDefinition` properly ([#3901](https://github.com/typescript-eslint/typescript-eslint/issues/3901)) ([82016f9](https://github.com/typescript-eslint/typescript-eslint/commit/82016f99b14825c9c60e1f7eb3b4efcc492bba86)) +* **eslint-plugin:** update new rules from master ([#3840](https://github.com/typescript-eslint/typescript-eslint/issues/3840)) ([d88a6b4](https://github.com/typescript-eslint/typescript-eslint/commit/d88a6b44eedcf9dd59569160570aa118851aa86b)) +* update new rules from master ([b34fb7e](https://github.com/typescript-eslint/typescript-eslint/commit/b34fb7eb3102ea603bb4aef0dbbf9885b3d47557)) +* **eslint-plugin:** crash in no-dupe-class-members (v5) ([#3813](https://github.com/typescript-eslint/typescript-eslint/issues/3813)) ([4b09644](https://github.com/typescript-eslint/typescript-eslint/commit/4b096442f731c0a60926ac0391a4f2c4208aa8d4)) + + +### 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)) +* **eslint-plugin:** remove `object` from `ban-types`' default types ([#3818](https://github.com/typescript-eslint/typescript-eslint/issues/3818)) ([ae3fa90](https://github.com/typescript-eslint/typescript-eslint/commit/ae3fa900d5b4e1f557a52ca58d35a7d098d9efaf)) +* **eslint-plugin:** removed value from abstract property nodes ([#3765](https://github.com/typescript-eslint/typescript-eslint/issues/3765)) ([5823524](https://github.com/typescript-eslint/typescript-eslint/commit/58235241714596b641a1e8b39c569e561e0039b4)), closes [#3748](https://github.com/typescript-eslint/typescript-eslint/issues/3748) +* **eslint-plugin:** update recommended configs ([#3809](https://github.com/typescript-eslint/typescript-eslint/issues/3809)) ([deeb7bb](https://github.com/typescript-eslint/typescript-eslint/commit/deeb7bb9334d301c6af56aefd37d318231af11ef)) +* 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 `PrivateIdentifier` ([#3808](https://github.com/typescript-eslint/typescript-eslint/issues/3808)) ([0eefe5e](https://github.com/typescript-eslint/typescript-eslint/commit/0eefe5e49d21af3f1e3e2d9a90c2e49929863ac2)), closes [#3430](https://github.com/typescript-eslint/typescript-eslint/issues/3430) [#2933](https://github.com/typescript-eslint/typescript-eslint/issues/2933) +* **eslint-plugin:** [comma-dangle] align schema with ESLint v8 ([#3768](https://github.com/typescript-eslint/typescript-eslint/issues/3768)) ([0acfafc](https://github.com/typescript-eslint/typescript-eslint/commit/0acfafcc655e28dcfc05a5caa567c0d0217ee7ad)) +* **eslint-plugin:** [member-ordering] add support for getters and setters ([#3611](https://github.com/typescript-eslint/typescript-eslint/issues/3611)) ([e264124](https://github.com/typescript-eslint/typescript-eslint/commit/e2641246571b69df36cde5cb7bce7c4fffc43f98)) +* **eslint-plugin:** remove `no-unused-vars-experimental` ([79ae03b](https://github.com/typescript-eslint/typescript-eslint/commit/79ae03b8adbae2b0a86276711a9c834af01bbb61)) +* support ESLint v8 ([#3737](https://github.com/typescript-eslint/typescript-eslint/issues/3737)) ([4ca62ae](https://github.com/typescript-eslint/typescript-eslint/commit/4ca62aee6681d706e762a8db727541ca204364f2)) + + +### BREAKING CHANGES + +* **eslint-plugin:** `ban-types` no longer reports `object` by default + + + + + +# [4.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.32.0...v4.33.0) (2021-10-04) + + +### Bug Fixes + +* **eslint-plugin:** [lines-between-class-members] fix `exceptAfterOverload` for abstract methods ([#3943](https://github.com/typescript-eslint/typescript-eslint/issues/3943)) ([240fc65](https://github.com/typescript-eslint/typescript-eslint/commit/240fc65c307769eae9b35e611fca74ba4c35a025)) +* **eslint-plugin:** [no-confusing-void-expression] support optional chaining ([#3937](https://github.com/typescript-eslint/typescript-eslint/issues/3937)) ([c40dd13](https://github.com/typescript-eslint/typescript-eslint/commit/c40dd13df76b77052c85254622df5533307dc07e)) +* **eslint-plugin:** [no-restricted-imports] fix crash when no options given ([#3947](https://github.com/typescript-eslint/typescript-eslint/issues/3947)) ([edaa3c1](https://github.com/typescript-eslint/typescript-eslint/commit/edaa3c10eb67bb89f9c6a78bd1ed593925c33f16)) +* **eslint-plugin:** [non-nullable-type-assertion-style] false-positive with non-nullish `as` assertions and types ([#3940](https://github.com/typescript-eslint/typescript-eslint/issues/3940)) ([40760f9](https://github.com/typescript-eslint/typescript-eslint/commit/40760f98da0d23c7bce3da04cf37a56c10447bde)) +* **eslint-plugin:** [padding-line-between-statements] TSModuleBlock should change scope ([#3944](https://github.com/typescript-eslint/typescript-eslint/issues/3944)) ([f8f534e](https://github.com/typescript-eslint/typescript-eslint/commit/f8f534e42b0ec517274442422c37ab019cf3c200)) +* **eslint-plugin:** [prefer-regexp-exec] check `RegExp` without flags ([#3946](https://github.com/typescript-eslint/typescript-eslint/issues/3946)) ([0868725](https://github.com/typescript-eslint/typescript-eslint/commit/0868725713e8102e8932303d4c680340688e1fa9)) + + + + + +# [4.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.2...v4.32.0) (2021-09-27) + + +### Bug Fixes + +* **eslint-plugin:** [consistent-type-definitions] correct fix for `export default` ([#3899](https://github.com/typescript-eslint/typescript-eslint/issues/3899)) ([ebb33ed](https://github.com/typescript-eslint/typescript-eslint/commit/ebb33ed8bc29f69ca2a657ec5b31857c0aeb4b56)) +* **eslint-plugin:** [no-require-imports] report only global `require` ([#3871](https://github.com/typescript-eslint/typescript-eslint/issues/3871)) ([8aa87a1](https://github.com/typescript-eslint/typescript-eslint/commit/8aa87a136e7cd7b40fbf09fcfa26bf04d1c6d5fe)) +* **eslint-plugin:** [no-shadow] ignore type-only imports properly ([#3868](https://github.com/typescript-eslint/typescript-eslint/issues/3868)) ([dda9cee](https://github.com/typescript-eslint/typescript-eslint/commit/dda9cee68a5cd78b358a854027999c739ac623e9)) +* **eslint-plugin:** [no-var-requires] report problems within `NewExpression` ([#3884](https://github.com/typescript-eslint/typescript-eslint/issues/3884)) ([ed5e459](https://github.com/typescript-eslint/typescript-eslint/commit/ed5e45983fa052accf3a7b5fcdbfcb15ed09490f)) +* **eslint-plugin:** [padding-line-between-statements] problems within namespaces not being reported ([#3869](https://github.com/typescript-eslint/typescript-eslint/issues/3869)) ([1861356](https://github.com/typescript-eslint/typescript-eslint/commit/186135698b40b510ffff6a2402aa34f2726596ea)) +* **eslint-plugin:** [prefer-regexp-exec] respect flags when using `RegExp` ([#3855](https://github.com/typescript-eslint/typescript-eslint/issues/3855)) ([ffdb5ff](https://github.com/typescript-eslint/typescript-eslint/commit/ffdb5ff9900e07374a2f3686447e3e2c78fbc38a)) +* **eslint-plugin:** [prefer-return-this-type] handle generics properly in fixer ([#3852](https://github.com/typescript-eslint/typescript-eslint/issues/3852)) ([9e98b8f](https://github.com/typescript-eslint/typescript-eslint/commit/9e98b8f43ca6aadc9758a4e9a0d1d3c250af6cca)) +* **eslint-plugin:** false-positive/negative with array index in no-unnecessary-condition ([#3805](https://github.com/typescript-eslint/typescript-eslint/issues/3805)) ([bdb8f0b](https://github.com/typescript-eslint/typescript-eslint/commit/bdb8f0be1466e4a4b713e91199be91030650ed01)) + + +### Features + +* **eslint-plugin:** [no-type-alias]: add allowGenerics option ([#3865](https://github.com/typescript-eslint/typescript-eslint/issues/3865)) ([4195919](https://github.com/typescript-eslint/typescript-eslint/commit/41959199735a6d4fe3ae7825f3087e8fb249be9f)) +* **eslint-plugin:** add `no-non-null-asserted-nullish-coalescing` rule ([#3349](https://github.com/typescript-eslint/typescript-eslint/issues/3349)) ([4e99961](https://github.com/typescript-eslint/typescript-eslint/commit/4e999614e9761f6dc7e5aa0c5bad76ab164ab3fb)) +* **eslint-plugin:** add new extended rule `no-restricted-imports` ([#3775](https://github.com/typescript-eslint/typescript-eslint/issues/3775)) ([ec5d506](https://github.com/typescript-eslint/typescript-eslint/commit/ec5d50696b249a207d322e4a2fc66582122eb010)) +* **eslint-plugin-internal:** [prefer-ast-types-enum] add `DefinitionType` enum ([#3916](https://github.com/typescript-eslint/typescript-eslint/issues/3916)) ([13b7de5](https://github.com/typescript-eslint/typescript-eslint/commit/13b7de508e0f8eac492879ff9ab99acd8d3e977e)) + + + + + +## [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/eslint-plugin + + + + + +## [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/eslint-plugin + + + + + +# [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 + +* **eslint-plugin:** [prefer-readonly-parameter-types] add option treatMethodsAsReadonly ([#3733](https://github.com/typescript-eslint/typescript-eslint/issues/3733)) ([a46e318](https://github.com/typescript-eslint/typescript-eslint/commit/a46e3182c8a0b07c914605d6d9fe28ef36a7c32a)) +* **eslint-plugin:** [restrict-template-expressions] add option to allow RegExp ([#3709](https://github.com/typescript-eslint/typescript-eslint/issues/3709)) ([363b3dc](https://github.com/typescript-eslint/typescript-eslint/commit/363b3dc4dd0dc343311c729d75935b10f9d2fd5e)) +* **eslint-plugin:** add `no-meaningless-void-operator` rule ([#3641](https://github.com/typescript-eslint/typescript-eslint/issues/3641)) ([ea40ab6](https://github.com/typescript-eslint/typescript-eslint/commit/ea40ab659351ae7cf7235ea063d42ac155b11e5f)) +* **eslint-plugin:** add extension rule `padding-line-between-statements` ([#3418](https://github.com/typescript-eslint/typescript-eslint/issues/3418)) ([f79ae9b](https://github.com/typescript-eslint/typescript-eslint/commit/f79ae9b58e82f4fddef640a34a1d7ff92b763e65)) + + + + + +# [4.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.3...v4.30.0) (2021-08-30) + + +### Bug Fixes + +* **eslint-plugin:** [dot-notation] false positive with optional chaining ([#3711](https://github.com/typescript-eslint/typescript-eslint/issues/3711)) ([c19fc6e](https://github.com/typescript-eslint/typescript-eslint/commit/c19fc6e03072ed549bc9b35ebe6961e10f8f9b43)), closes [#3510](https://github.com/typescript-eslint/typescript-eslint/issues/3510) +* **eslint-plugin:** [prefer-reduce-type-parameter] handle already existing type params ([#3706](https://github.com/typescript-eslint/typescript-eslint/issues/3706)) ([71dd273](https://github.com/typescript-eslint/typescript-eslint/commit/71dd27361a1bc93b5d5eb2279d805922b10002fd)) +* **eslint-plugin:** isTypeReadonly error with -**Key**: :heavy_check_mark: = recommended, :wrench: = fixable, :thought_balloon: = requires type information - -| Name | Description | :heavy_check_mark: | :wrench: | :thought_balloon: | -| --------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ------------------ | -------- | ----------------- | -| [`@typescript-eslint/adjacent-overload-signatures`](./docs/rules/adjacent-overload-signatures.md) | Require that member overloads be consecutive | :heavy_check_mark: | | | -| [`@typescript-eslint/array-type`](./docs/rules/array-type.md) | Requires using either `T[]` or `Array` for arrays | | :wrench: | | -| [`@typescript-eslint/await-thenable`](./docs/rules/await-thenable.md) | Disallows awaiting a value that is not a Thenable | :heavy_check_mark: | | :thought_balloon: | -| [`@typescript-eslint/ban-ts-comment`](./docs/rules/ban-ts-comment.md) | Bans `@ts-` comments from being used or requires descriptions after directive | :heavy_check_mark: | | | -| [`@typescript-eslint/ban-tslint-comment`](./docs/rules/ban-tslint-comment.md) | Bans `// tslint:` comments from being used | | :wrench: | | -| [`@typescript-eslint/ban-types`](./docs/rules/ban-types.md) | Bans specific types from being used | :heavy_check_mark: | :wrench: | | -| [`@typescript-eslint/class-literal-property-style`](./docs/rules/class-literal-property-style.md) | Ensures that literals on classes are exposed in a consistent style | | :wrench: | | -| [`@typescript-eslint/consistent-indexed-object-style`](./docs/rules/consistent-indexed-object-style.md) | Enforce or disallow the use of the record type | | :wrench: | | -| [`@typescript-eslint/consistent-type-assertions`](./docs/rules/consistent-type-assertions.md) | Enforces consistent usage of type assertions | | | | -| [`@typescript-eslint/consistent-type-definitions`](./docs/rules/consistent-type-definitions.md) | Consistent with type definition either `interface` or `type` | | :wrench: | | -| [`@typescript-eslint/consistent-type-imports`](./docs/rules/consistent-type-imports.md) | Enforces consistent usage of type imports | | :wrench: | | -| [`@typescript-eslint/explicit-function-return-type`](./docs/rules/explicit-function-return-type.md) | Require explicit return types on functions and class methods | | | | -| [`@typescript-eslint/explicit-member-accessibility`](./docs/rules/explicit-member-accessibility.md) | Require explicit accessibility modifiers on class properties and methods | | :wrench: | | -| [`@typescript-eslint/explicit-module-boundary-types`](./docs/rules/explicit-module-boundary-types.md) | Require explicit return and argument types on exported functions' and classes' public class methods | :heavy_check_mark: | | | -| [`@typescript-eslint/member-delimiter-style`](./docs/rules/member-delimiter-style.md) | Require a specific member delimiter style for interfaces and type literals | | :wrench: | | -| [`@typescript-eslint/member-ordering`](./docs/rules/member-ordering.md) | Require a consistent member declaration order | | | | -| [`@typescript-eslint/method-signature-style`](./docs/rules/method-signature-style.md) | Enforces using a particular method signature syntax. | | :wrench: | | -| [`@typescript-eslint/naming-convention`](./docs/rules/naming-convention.md) | Enforces naming conventions for everything across a codebase | | | :thought_balloon: | -| [`@typescript-eslint/no-base-to-string`](./docs/rules/no-base-to-string.md) | Requires that `.toString()` is only called on objects which provide useful information when stringified | | | :thought_balloon: | -| [`@typescript-eslint/no-confusing-non-null-assertion`](./docs/rules/no-confusing-non-null-assertion.md) | Disallow non-null assertion in locations that may be confusing | | :wrench: | | -| [`@typescript-eslint/no-confusing-void-expression`](./docs/rules/no-confusing-void-expression.md) | Requires expressions of type void to appear in statement position | | :wrench: | :thought_balloon: | -| [`@typescript-eslint/no-dynamic-delete`](./docs/rules/no-dynamic-delete.md) | Disallow the delete operator with computed key expressions | | :wrench: | | -| [`@typescript-eslint/no-empty-interface`](./docs/rules/no-empty-interface.md) | Disallow the declaration of empty interfaces | :heavy_check_mark: | :wrench: | | -| [`@typescript-eslint/no-explicit-any`](./docs/rules/no-explicit-any.md) | Disallow usage of the `any` type | :heavy_check_mark: | :wrench: | | -| [`@typescript-eslint/no-extra-non-null-assertion`](./docs/rules/no-extra-non-null-assertion.md) | Disallow extra non-null assertion | :heavy_check_mark: | :wrench: | | -| [`@typescript-eslint/no-extraneous-class`](./docs/rules/no-extraneous-class.md) | Forbids the use of classes as namespaces | | | | -| [`@typescript-eslint/no-floating-promises`](./docs/rules/no-floating-promises.md) | Requires Promise-like values to be handled appropriately | :heavy_check_mark: | | :thought_balloon: | -| [`@typescript-eslint/no-for-in-array`](./docs/rules/no-for-in-array.md) | Disallow iterating over an array with a for-in loop | :heavy_check_mark: | | :thought_balloon: | -| [`@typescript-eslint/no-implicit-any-catch`](./docs/rules/no-implicit-any-catch.md) | Disallow usage of the implicit `any` type in catch clauses | | :wrench: | | -| [`@typescript-eslint/no-inferrable-types`](./docs/rules/no-inferrable-types.md) | Disallows explicit type declarations for variables or parameters initialized to a number, string, or boolean | :heavy_check_mark: | :wrench: | | -| [`@typescript-eslint/no-invalid-void-type`](./docs/rules/no-invalid-void-type.md) | Disallows usage of `void` type outside of generic or return types | | | | -| [`@typescript-eslint/no-misused-new`](./docs/rules/no-misused-new.md) | Enforce valid definition of `new` and `constructor` | :heavy_check_mark: | | | -| [`@typescript-eslint/no-misused-promises`](./docs/rules/no-misused-promises.md) | Avoid using promises in places not designed to handle them | :heavy_check_mark: | | :thought_balloon: | -| [`@typescript-eslint/no-namespace`](./docs/rules/no-namespace.md) | Disallow the use of custom TypeScript modules and namespaces | :heavy_check_mark: | | | -| [`@typescript-eslint/no-non-null-asserted-optional-chain`](./docs/rules/no-non-null-asserted-optional-chain.md) | Disallows using a non-null assertion after an optional chain expression | :heavy_check_mark: | | | -| [`@typescript-eslint/no-non-null-assertion`](./docs/rules/no-non-null-assertion.md) | Disallows non-null assertions using the `!` postfix operator | :heavy_check_mark: | | | -| [`@typescript-eslint/no-parameter-properties`](./docs/rules/no-parameter-properties.md) | Disallow the use of parameter properties in class constructors | | | | -| [`@typescript-eslint/no-require-imports`](./docs/rules/no-require-imports.md) | Disallows invocation of `require()` | | | | -| [`@typescript-eslint/no-this-alias`](./docs/rules/no-this-alias.md) | Disallow aliasing `this` | :heavy_check_mark: | | | -| [`@typescript-eslint/no-type-alias`](./docs/rules/no-type-alias.md) | Disallow the use of type aliases | | | | -| [`@typescript-eslint/no-unnecessary-boolean-literal-compare`](./docs/rules/no-unnecessary-boolean-literal-compare.md) | Flags unnecessary equality comparisons against boolean literals | | :wrench: | :thought_balloon: | -| [`@typescript-eslint/no-unnecessary-condition`](./docs/rules/no-unnecessary-condition.md) | Prevents conditionals where the type is always truthy or always falsy | | :wrench: | :thought_balloon: | -| [`@typescript-eslint/no-unnecessary-qualifier`](./docs/rules/no-unnecessary-qualifier.md) | Warns when a namespace qualifier is unnecessary | | :wrench: | :thought_balloon: | -| [`@typescript-eslint/no-unnecessary-type-arguments`](./docs/rules/no-unnecessary-type-arguments.md) | Enforces that type arguments will not be used if not required | | :wrench: | :thought_balloon: | -| [`@typescript-eslint/no-unnecessary-type-assertion`](./docs/rules/no-unnecessary-type-assertion.md) | Warns if a type assertion does not change the type of an expression | :heavy_check_mark: | :wrench: | :thought_balloon: | -| [`@typescript-eslint/no-unnecessary-type-constraint`](./docs/rules/no-unnecessary-type-constraint.md) | Disallows unnecessary constraints on generic types | | :wrench: | | -| [`@typescript-eslint/no-unsafe-assignment`](./docs/rules/no-unsafe-assignment.md) | Disallows assigning any to variables and properties | :heavy_check_mark: | | :thought_balloon: | -| [`@typescript-eslint/no-unsafe-call`](./docs/rules/no-unsafe-call.md) | Disallows calling an any type value | :heavy_check_mark: | | :thought_balloon: | -| [`@typescript-eslint/no-unsafe-member-access`](./docs/rules/no-unsafe-member-access.md) | Disallows member access on any typed variables | :heavy_check_mark: | | :thought_balloon: | -| [`@typescript-eslint/no-unsafe-return`](./docs/rules/no-unsafe-return.md) | Disallows returning any from a function | :heavy_check_mark: | | :thought_balloon: | -| [`@typescript-eslint/no-var-requires`](./docs/rules/no-var-requires.md) | Disallows the use of require statements except in import statements | :heavy_check_mark: | | | -| [`@typescript-eslint/non-nullable-type-assertion-style`](./docs/rules/non-nullable-type-assertion-style.md) | Prefers a non-null assertion over explicit type cast when possible | | :wrench: | :thought_balloon: | -| [`@typescript-eslint/prefer-as-const`](./docs/rules/prefer-as-const.md) | Prefer usage of `as const` over literal type | :heavy_check_mark: | :wrench: | | -| [`@typescript-eslint/prefer-enum-initializers`](./docs/rules/prefer-enum-initializers.md) | Prefer initializing each enums member value | | | | -| [`@typescript-eslint/prefer-for-of`](./docs/rules/prefer-for-of.md) | Prefer a ‘for-of’ loop over a standard ‘for’ loop if the index is only used to access the array being iterated | | | | -| [`@typescript-eslint/prefer-function-type`](./docs/rules/prefer-function-type.md) | Use function types instead of interfaces with call signatures | | :wrench: | | -| [`@typescript-eslint/prefer-includes`](./docs/rules/prefer-includes.md) | Enforce `includes` method over `indexOf` method | | :wrench: | :thought_balloon: | -| [`@typescript-eslint/prefer-literal-enum-member`](./docs/rules/prefer-literal-enum-member.md) | Require that all enum members be literal values to prevent unintended enum member name shadow issues | | | | -| [`@typescript-eslint/prefer-namespace-keyword`](./docs/rules/prefer-namespace-keyword.md) | Require the use of the `namespace` keyword instead of the `module` keyword to declare custom TypeScript modules | :heavy_check_mark: | :wrench: | | -| [`@typescript-eslint/prefer-nullish-coalescing`](./docs/rules/prefer-nullish-coalescing.md) | Enforce the usage of the nullish coalescing operator instead of logical chaining | | | :thought_balloon: | -| [`@typescript-eslint/prefer-optional-chain`](./docs/rules/prefer-optional-chain.md) | Prefer using concise optional chain expressions instead of chained logical ands | | | | -| [`@typescript-eslint/prefer-readonly`](./docs/rules/prefer-readonly.md) | Requires that private members are marked as `readonly` if they're never modified outside of the constructor | | :wrench: | :thought_balloon: | -| [`@typescript-eslint/prefer-readonly-parameter-types`](./docs/rules/prefer-readonly-parameter-types.md) | Requires that function parameters are typed as readonly to prevent accidental mutation of inputs | | | :thought_balloon: | -| [`@typescript-eslint/prefer-reduce-type-parameter`](./docs/rules/prefer-reduce-type-parameter.md) | Prefer using type parameter when calling `Array#reduce` instead of casting | | :wrench: | :thought_balloon: | -| [`@typescript-eslint/prefer-regexp-exec`](./docs/rules/prefer-regexp-exec.md) | Enforce that `RegExp#exec` is used instead of `String#match` if no global flag is provided | :heavy_check_mark: | | :thought_balloon: | -| [`@typescript-eslint/prefer-string-starts-ends-with`](./docs/rules/prefer-string-starts-ends-with.md) | Enforce the use of `String#startsWith` and `String#endsWith` instead of other equivalent methods of checking substrings | | :wrench: | :thought_balloon: | -| [`@typescript-eslint/prefer-ts-expect-error`](./docs/rules/prefer-ts-expect-error.md) | Recommends using `@ts-expect-error` over `@ts-ignore` | | :wrench: | | -| [`@typescript-eslint/promise-function-async`](./docs/rules/promise-function-async.md) | Requires any function or method that returns a Promise to be marked async | | :wrench: | :thought_balloon: | -| [`@typescript-eslint/require-array-sort-compare`](./docs/rules/require-array-sort-compare.md) | Requires `Array#sort` calls to always provide a `compareFunction` | | | :thought_balloon: | -| [`@typescript-eslint/restrict-plus-operands`](./docs/rules/restrict-plus-operands.md) | When adding two variables, operands must both be of type number or of type string | :heavy_check_mark: | | :thought_balloon: | -| [`@typescript-eslint/restrict-template-expressions`](./docs/rules/restrict-template-expressions.md) | Enforce template literal expressions to be of string type | :heavy_check_mark: | | :thought_balloon: | -| [`@typescript-eslint/sort-type-union-intersection-members`](./docs/rules/sort-type-union-intersection-members.md) | Enforces that members of a type union/intersection are sorted alphabetically | | :wrench: | | -| [`@typescript-eslint/strict-boolean-expressions`](./docs/rules/strict-boolean-expressions.md) | Restricts the types allowed in boolean expressions | | | :thought_balloon: | -| [`@typescript-eslint/switch-exhaustiveness-check`](./docs/rules/switch-exhaustiveness-check.md) | Exhaustiveness checking in switch with union type | | | :thought_balloon: | -| [`@typescript-eslint/triple-slash-reference`](./docs/rules/triple-slash-reference.md) | Sets preference level for triple slash directives versus ES6-style import declarations | :heavy_check_mark: | | | -| [`@typescript-eslint/type-annotation-spacing`](./docs/rules/type-annotation-spacing.md) | Require consistent spacing around type annotations | | :wrench: | | -| [`@typescript-eslint/typedef`](./docs/rules/typedef.md) | Requires type annotations to exist | | | | -| [`@typescript-eslint/unbound-method`](./docs/rules/unbound-method.md) | Enforces unbound methods are called with their expected scope | :heavy_check_mark: | | :thought_balloon: | -| [`@typescript-eslint/unified-signatures`](./docs/rules/unified-signatures.md) | Warns for any two overloads that could be unified into one by using a union or an optional/rest parameter | | | | +**Key**: :white_check_mark: = recommended, :wrench: = fixable, :thought_balloon: = requires type information + +| Name | Description | :white_check_mark: | :wrench: | :thought_balloon: | +| ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ------------------ | -------- | ----------------- | +| [`@typescript-eslint/adjacent-overload-signatures`](./docs/rules/adjacent-overload-signatures.md) | Require that member overloads be consecutive | :white_check_mark: | | | +| [`@typescript-eslint/array-type`](./docs/rules/array-type.md) | Requires using either `T[]` or `Array` for arrays | | :wrench: | | +| [`@typescript-eslint/await-thenable`](./docs/rules/await-thenable.md) | Disallows awaiting a value that is not a Thenable | :white_check_mark: | | :thought_balloon: | +| [`@typescript-eslint/ban-ts-comment`](./docs/rules/ban-ts-comment.md) | Bans `@ts-` comments from being used or requires descriptions after directive | :white_check_mark: | | | +| [`@typescript-eslint/ban-tslint-comment`](./docs/rules/ban-tslint-comment.md) | Bans `// tslint:` comments from being used | | :wrench: | | +| [`@typescript-eslint/ban-types`](./docs/rules/ban-types.md) | Bans specific types from being used | :white_check_mark: | :wrench: | | +| [`@typescript-eslint/class-literal-property-style`](./docs/rules/class-literal-property-style.md) | Ensures that literals on classes are exposed in a consistent style | | :wrench: | | +| [`@typescript-eslint/consistent-indexed-object-style`](./docs/rules/consistent-indexed-object-style.md) | Enforce or disallow the use of the record type | | :wrench: | | +| [`@typescript-eslint/consistent-type-assertions`](./docs/rules/consistent-type-assertions.md) | Enforces consistent usage of type assertions | | | | +| [`@typescript-eslint/consistent-type-definitions`](./docs/rules/consistent-type-definitions.md) | Consistent with type definition either `interface` or `type` | | :wrench: | | +| [`@typescript-eslint/consistent-type-exports`](./docs/rules/consistent-type-exports.md) | Enforces consistent usage of type exports | | :wrench: | :thought_balloon: | +| [`@typescript-eslint/consistent-type-imports`](./docs/rules/consistent-type-imports.md) | Enforces consistent usage of type imports | | :wrench: | | +| [`@typescript-eslint/explicit-function-return-type`](./docs/rules/explicit-function-return-type.md) | Require explicit return types on functions and class methods | | | | +| [`@typescript-eslint/explicit-member-accessibility`](./docs/rules/explicit-member-accessibility.md) | Require explicit accessibility modifiers on class properties and methods | | :wrench: | | +| [`@typescript-eslint/explicit-module-boundary-types`](./docs/rules/explicit-module-boundary-types.md) | Require explicit return and argument types on exported functions' and classes' public class methods | | | | +| [`@typescript-eslint/member-delimiter-style`](./docs/rules/member-delimiter-style.md) | Require a specific member delimiter style for interfaces and type literals | | :wrench: | | +| [`@typescript-eslint/member-ordering`](./docs/rules/member-ordering.md) | Require a consistent member declaration order | | | | +| [`@typescript-eslint/method-signature-style`](./docs/rules/method-signature-style.md) | Enforces using a particular method signature syntax. | | :wrench: | | +| [`@typescript-eslint/naming-convention`](./docs/rules/naming-convention.md) | Enforces naming conventions for everything across a codebase | | | :thought_balloon: | +| [`@typescript-eslint/no-base-to-string`](./docs/rules/no-base-to-string.md) | Requires that `.toString()` is only called on objects which provide useful information when stringified | | | :thought_balloon: | +| [`@typescript-eslint/no-confusing-non-null-assertion`](./docs/rules/no-confusing-non-null-assertion.md) | Disallow non-null assertion in locations that may be confusing | | :wrench: | | +| [`@typescript-eslint/no-confusing-void-expression`](./docs/rules/no-confusing-void-expression.md) | Requires expressions of type void to appear in statement position | | :wrench: | :thought_balloon: | +| [`@typescript-eslint/no-dynamic-delete`](./docs/rules/no-dynamic-delete.md) | Disallow the delete operator with computed key expressions | | :wrench: | | +| [`@typescript-eslint/no-empty-interface`](./docs/rules/no-empty-interface.md) | Disallow the declaration of empty interfaces | :white_check_mark: | :wrench: | | +| [`@typescript-eslint/no-explicit-any`](./docs/rules/no-explicit-any.md) | Disallow usage of the `any` type | :white_check_mark: | :wrench: | | +| [`@typescript-eslint/no-extra-non-null-assertion`](./docs/rules/no-extra-non-null-assertion.md) | Disallow extra non-null assertion | :white_check_mark: | :wrench: | | +| [`@typescript-eslint/no-extraneous-class`](./docs/rules/no-extraneous-class.md) | Forbids the use of classes as namespaces | | | | +| [`@typescript-eslint/no-floating-promises`](./docs/rules/no-floating-promises.md) | Requires Promise-like values to be handled appropriately | :white_check_mark: | | :thought_balloon: | +| [`@typescript-eslint/no-for-in-array`](./docs/rules/no-for-in-array.md) | Disallow iterating over an array with a for-in loop | :white_check_mark: | | :thought_balloon: | +| [`@typescript-eslint/no-inferrable-types`](./docs/rules/no-inferrable-types.md) | Disallows explicit type declarations for variables or parameters initialized to a number, string, or boolean | :white_check_mark: | :wrench: | | +| [`@typescript-eslint/no-invalid-void-type`](./docs/rules/no-invalid-void-type.md) | Disallows usage of `void` type outside of generic or return types | | | | +| [`@typescript-eslint/no-meaningless-void-operator`](./docs/rules/no-meaningless-void-operator.md) | Disallow the `void` operator except when used to discard a value | | :wrench: | :thought_balloon: | +| [`@typescript-eslint/no-misused-new`](./docs/rules/no-misused-new.md) | Enforce valid definition of `new` and `constructor` | :white_check_mark: | | | +| [`@typescript-eslint/no-misused-promises`](./docs/rules/no-misused-promises.md) | Avoid using promises in places not designed to handle them | :white_check_mark: | | :thought_balloon: | +| [`@typescript-eslint/no-namespace`](./docs/rules/no-namespace.md) | Disallow the use of custom TypeScript modules and namespaces | :white_check_mark: | | | +| [`@typescript-eslint/no-non-null-asserted-nullish-coalescing`](./docs/rules/no-non-null-asserted-nullish-coalescing.md) | Disallows using a non-null assertion in the left operand of the nullish coalescing operator | | | | +| [`@typescript-eslint/no-non-null-asserted-optional-chain`](./docs/rules/no-non-null-asserted-optional-chain.md) | Disallows using a non-null assertion after an optional chain expression | :white_check_mark: | | | +| [`@typescript-eslint/no-non-null-assertion`](./docs/rules/no-non-null-assertion.md) | Disallows non-null assertions using the `!` postfix operator | :white_check_mark: | | | +| [`@typescript-eslint/no-parameter-properties`](./docs/rules/no-parameter-properties.md) | Disallow the use of parameter properties in class constructors | | | | +| [`@typescript-eslint/no-require-imports`](./docs/rules/no-require-imports.md) | Disallows invocation of `require()` | | | | +| [`@typescript-eslint/no-this-alias`](./docs/rules/no-this-alias.md) | Disallow aliasing `this` | :white_check_mark: | | | +| [`@typescript-eslint/no-type-alias`](./docs/rules/no-type-alias.md) | Disallow the use of type aliases | | | | +| [`@typescript-eslint/no-unnecessary-boolean-literal-compare`](./docs/rules/no-unnecessary-boolean-literal-compare.md) | Flags unnecessary equality comparisons against boolean literals | | :wrench: | :thought_balloon: | +| [`@typescript-eslint/no-unnecessary-condition`](./docs/rules/no-unnecessary-condition.md) | Prevents conditionals where the type is always truthy or always falsy | | :wrench: | :thought_balloon: | +| [`@typescript-eslint/no-unnecessary-qualifier`](./docs/rules/no-unnecessary-qualifier.md) | Warns when a namespace qualifier is unnecessary | | :wrench: | :thought_balloon: | +| [`@typescript-eslint/no-unnecessary-type-arguments`](./docs/rules/no-unnecessary-type-arguments.md) | Enforces that type arguments will not be used if not required | | :wrench: | :thought_balloon: | +| [`@typescript-eslint/no-unnecessary-type-assertion`](./docs/rules/no-unnecessary-type-assertion.md) | Warns if a type assertion does not change the type of an expression | :white_check_mark: | :wrench: | :thought_balloon: | +| [`@typescript-eslint/no-unnecessary-type-constraint`](./docs/rules/no-unnecessary-type-constraint.md) | Disallows unnecessary constraints on generic types | :white_check_mark: | :wrench: | | +| [`@typescript-eslint/no-unsafe-argument`](./docs/rules/no-unsafe-argument.md) | Disallows calling a function with an any type value | :white_check_mark: | | :thought_balloon: | +| [`@typescript-eslint/no-unsafe-assignment`](./docs/rules/no-unsafe-assignment.md) | Disallows assigning any to variables and properties | :white_check_mark: | | :thought_balloon: | +| [`@typescript-eslint/no-unsafe-call`](./docs/rules/no-unsafe-call.md) | Disallows calling an any type value | :white_check_mark: | | :thought_balloon: | +| [`@typescript-eslint/no-unsafe-member-access`](./docs/rules/no-unsafe-member-access.md) | Disallows member access on any typed variables | :white_check_mark: | | :thought_balloon: | +| [`@typescript-eslint/no-unsafe-return`](./docs/rules/no-unsafe-return.md) | Disallows returning any from a function | :white_check_mark: | | :thought_balloon: | +| [`@typescript-eslint/no-var-requires`](./docs/rules/no-var-requires.md) | Disallows the use of require statements except in import statements | :white_check_mark: | | | +| [`@typescript-eslint/non-nullable-type-assertion-style`](./docs/rules/non-nullable-type-assertion-style.md) | Prefers a non-null assertion over explicit type cast when possible | | :wrench: | :thought_balloon: | +| [`@typescript-eslint/prefer-as-const`](./docs/rules/prefer-as-const.md) | Prefer usage of `as const` over literal type | :white_check_mark: | :wrench: | | +| [`@typescript-eslint/prefer-enum-initializers`](./docs/rules/prefer-enum-initializers.md) | Prefer initializing each enums member value | | | | +| [`@typescript-eslint/prefer-for-of`](./docs/rules/prefer-for-of.md) | Prefer a ‘for-of’ loop over a standard ‘for’ loop if the index is only used to access the array being iterated | | | | +| [`@typescript-eslint/prefer-function-type`](./docs/rules/prefer-function-type.md) | Use function types instead of interfaces with call signatures | | :wrench: | | +| [`@typescript-eslint/prefer-includes`](./docs/rules/prefer-includes.md) | Enforce `includes` method over `indexOf` method | | :wrench: | :thought_balloon: | +| [`@typescript-eslint/prefer-literal-enum-member`](./docs/rules/prefer-literal-enum-member.md) | Require that all enum members be literal values to prevent unintended enum member name shadow issues | | | | +| [`@typescript-eslint/prefer-namespace-keyword`](./docs/rules/prefer-namespace-keyword.md) | Require the use of the `namespace` keyword instead of the `module` keyword to declare custom TypeScript modules | :white_check_mark: | :wrench: | | +| [`@typescript-eslint/prefer-nullish-coalescing`](./docs/rules/prefer-nullish-coalescing.md) | Enforce the usage of the nullish coalescing operator instead of logical chaining | | | :thought_balloon: | +| [`@typescript-eslint/prefer-optional-chain`](./docs/rules/prefer-optional-chain.md) | Prefer using concise optional chain expressions instead of chained logical ands | | | | +| [`@typescript-eslint/prefer-readonly`](./docs/rules/prefer-readonly.md) | Requires that private members are marked as `readonly` if they're never modified outside of the constructor | | :wrench: | :thought_balloon: | +| [`@typescript-eslint/prefer-readonly-parameter-types`](./docs/rules/prefer-readonly-parameter-types.md) | Requires that function parameters are typed as readonly to prevent accidental mutation of inputs | | | :thought_balloon: | +| [`@typescript-eslint/prefer-reduce-type-parameter`](./docs/rules/prefer-reduce-type-parameter.md) | Prefer using type parameter when calling `Array#reduce` instead of casting | | :wrench: | :thought_balloon: | +| [`@typescript-eslint/prefer-regexp-exec`](./docs/rules/prefer-regexp-exec.md) | Enforce that `RegExp#exec` is used instead of `String#match` if no global flag is provided | | :wrench: | :thought_balloon: | +| [`@typescript-eslint/prefer-return-this-type`](./docs/rules/prefer-return-this-type.md) | Enforce that `this` is used when only `this` type is returned | | :wrench: | :thought_balloon: | +| [`@typescript-eslint/prefer-string-starts-ends-with`](./docs/rules/prefer-string-starts-ends-with.md) | Enforce the use of `String#startsWith` and `String#endsWith` instead of other equivalent methods of checking substrings | | :wrench: | :thought_balloon: | +| [`@typescript-eslint/prefer-ts-expect-error`](./docs/rules/prefer-ts-expect-error.md) | Recommends using `@ts-expect-error` over `@ts-ignore` | | :wrench: | | +| [`@typescript-eslint/promise-function-async`](./docs/rules/promise-function-async.md) | Requires any function or method that returns a Promise to be marked async | | :wrench: | :thought_balloon: | +| [`@typescript-eslint/require-array-sort-compare`](./docs/rules/require-array-sort-compare.md) | Requires `Array#sort` calls to always provide a `compareFunction` | | | :thought_balloon: | +| [`@typescript-eslint/restrict-plus-operands`](./docs/rules/restrict-plus-operands.md) | When adding two variables, operands must both be of type number or of type string | :white_check_mark: | | :thought_balloon: | +| [`@typescript-eslint/restrict-template-expressions`](./docs/rules/restrict-template-expressions.md) | Enforce template literal expressions to be of string type | :white_check_mark: | | :thought_balloon: | +| [`@typescript-eslint/sort-type-union-intersection-members`](./docs/rules/sort-type-union-intersection-members.md) | Enforces that members of a type union/intersection are sorted alphabetically | | :wrench: | | +| [`@typescript-eslint/strict-boolean-expressions`](./docs/rules/strict-boolean-expressions.md) | Restricts the types allowed in boolean expressions | | :wrench: | :thought_balloon: | +| [`@typescript-eslint/switch-exhaustiveness-check`](./docs/rules/switch-exhaustiveness-check.md) | Exhaustiveness checking in switch with union type | | | :thought_balloon: | +| [`@typescript-eslint/triple-slash-reference`](./docs/rules/triple-slash-reference.md) | Sets preference level for triple slash directives versus ES6-style import declarations | :white_check_mark: | | | +| [`@typescript-eslint/type-annotation-spacing`](./docs/rules/type-annotation-spacing.md) | Require consistent spacing around type annotations | | :wrench: | | +| [`@typescript-eslint/typedef`](./docs/rules/typedef.md) | Requires type annotations to exist | | | | +| [`@typescript-eslint/unbound-method`](./docs/rules/unbound-method.md) | Enforces unbound methods are called with their expected scope | :white_check_mark: | | :thought_balloon: | +| [`@typescript-eslint/unified-signatures`](./docs/rules/unified-signatures.md) | Warns for any two overloads that could be unified into one by using a union or an optional/rest parameter | | | | @@ -186,45 +190,47 @@ In these cases, we create what we call an extension rule; a rule within our plug -**Key**: :heavy_check_mark: = recommended, :wrench: = fixable, :thought_balloon: = requires type information - -| Name | Description | :heavy_check_mark: | :wrench: | :thought_balloon: | -| ----------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------ | ------------------ | -------- | ----------------- | -| [`@typescript-eslint/brace-style`](./docs/rules/brace-style.md) | Enforce consistent brace style for blocks | | :wrench: | | -| [`@typescript-eslint/comma-dangle`](./docs/rules/comma-dangle.md) | Require or disallow trailing comma | | :wrench: | | -| [`@typescript-eslint/comma-spacing`](./docs/rules/comma-spacing.md) | Enforces consistent spacing before and after commas | | :wrench: | | -| [`@typescript-eslint/default-param-last`](./docs/rules/default-param-last.md) | Enforce default parameters to be last | | | | -| [`@typescript-eslint/dot-notation`](./docs/rules/dot-notation.md) | enforce dot notation whenever possible | | :wrench: | :thought_balloon: | -| [`@typescript-eslint/func-call-spacing`](./docs/rules/func-call-spacing.md) | Require or disallow spacing between function identifiers and their invocations | | :wrench: | | -| [`@typescript-eslint/indent`](./docs/rules/indent.md) | Enforce consistent indentation | | :wrench: | | -| [`@typescript-eslint/init-declarations`](./docs/rules/init-declarations.md) | require or disallow initialization in variable declarations | | | | -| [`@typescript-eslint/keyword-spacing`](./docs/rules/keyword-spacing.md) | Enforce consistent spacing before and after keywords | | :wrench: | | -| [`@typescript-eslint/lines-between-class-members`](./docs/rules/lines-between-class-members.md) | Require or disallow an empty line between class members | | :wrench: | | -| [`@typescript-eslint/no-array-constructor`](./docs/rules/no-array-constructor.md) | Disallow generic `Array` constructors | :heavy_check_mark: | :wrench: | | -| [`@typescript-eslint/no-dupe-class-members`](./docs/rules/no-dupe-class-members.md) | Disallow duplicate class members | | | | -| [`@typescript-eslint/no-duplicate-imports`](./docs/rules/no-duplicate-imports.md) | Disallow duplicate imports | | | | -| [`@typescript-eslint/no-empty-function`](./docs/rules/no-empty-function.md) | Disallow empty functions | :heavy_check_mark: | | | -| [`@typescript-eslint/no-extra-parens`](./docs/rules/no-extra-parens.md) | Disallow unnecessary parentheses | | :wrench: | | -| [`@typescript-eslint/no-extra-semi`](./docs/rules/no-extra-semi.md) | Disallow unnecessary semicolons | :heavy_check_mark: | :wrench: | | -| [`@typescript-eslint/no-implied-eval`](./docs/rules/no-implied-eval.md) | Disallow the use of `eval()`-like methods | :heavy_check_mark: | | :thought_balloon: | -| [`@typescript-eslint/no-invalid-this`](./docs/rules/no-invalid-this.md) | Disallow `this` keywords outside of classes or class-like objects | | | | -| [`@typescript-eslint/no-loop-func`](./docs/rules/no-loop-func.md) | Disallow function declarations that contain unsafe references inside loop statements | | | | -| [`@typescript-eslint/no-loss-of-precision`](./docs/rules/no-loss-of-precision.md) | Disallow literal numbers that lose precision | | | | -| [`@typescript-eslint/no-magic-numbers`](./docs/rules/no-magic-numbers.md) | Disallow magic numbers | | | | -| [`@typescript-eslint/no-redeclare`](./docs/rules/no-redeclare.md) | Disallow variable redeclaration | | | | -| [`@typescript-eslint/no-shadow`](./docs/rules/no-shadow.md) | Disallow variable declarations from shadowing variables declared in the outer scope | | | | -| [`@typescript-eslint/no-throw-literal`](./docs/rules/no-throw-literal.md) | Disallow throwing literals as exceptions | | | :thought_balloon: | -| [`@typescript-eslint/no-unused-expressions`](./docs/rules/no-unused-expressions.md) | Disallow unused expressions | | | | -| [`@typescript-eslint/no-unused-vars`](./docs/rules/no-unused-vars.md) | Disallow unused variables | :heavy_check_mark: | | | -| [`@typescript-eslint/no-use-before-define`](./docs/rules/no-use-before-define.md) | Disallow the use of variables before they are defined | | | | -| [`@typescript-eslint/no-useless-constructor`](./docs/rules/no-useless-constructor.md) | Disallow unnecessary constructors | | | | -| [`@typescript-eslint/object-curly-spacing`](./docs/rules/object-curly-spacing.md) | Enforce consistent spacing inside braces | | :wrench: | | -| [`@typescript-eslint/quotes`](./docs/rules/quotes.md) | Enforce the consistent use of either backticks, double, or single quotes | | :wrench: | | -| [`@typescript-eslint/require-await`](./docs/rules/require-await.md) | Disallow async functions which have no `await` expression | :heavy_check_mark: | | :thought_balloon: | -| [`@typescript-eslint/return-await`](./docs/rules/return-await.md) | Enforces consistent returning of awaited values | | :wrench: | :thought_balloon: | -| [`@typescript-eslint/semi`](./docs/rules/semi.md) | Require or disallow semicolons instead of ASI | | :wrench: | | -| [`@typescript-eslint/space-before-function-paren`](./docs/rules/space-before-function-paren.md) | Enforces consistent spacing before function parenthesis | | :wrench: | | -| [`@typescript-eslint/space-infix-ops`](./docs/rules/space-infix-ops.md) | This rule is aimed at ensuring there are spaces around infix operators. | | :wrench: | | +**Key**: :white_check_mark: = recommended, :wrench: = fixable, :thought_balloon: = requires type information + +| Name | Description | :white_check_mark: | :wrench: | :thought_balloon: | +| ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------ | ------------------ | -------- | ----------------- | +| [`@typescript-eslint/brace-style`](./docs/rules/brace-style.md) | Enforce consistent brace style for blocks | | :wrench: | | +| [`@typescript-eslint/comma-dangle`](./docs/rules/comma-dangle.md) | Require or disallow trailing comma | | :wrench: | | +| [`@typescript-eslint/comma-spacing`](./docs/rules/comma-spacing.md) | Enforces consistent spacing before and after commas | | :wrench: | | +| [`@typescript-eslint/default-param-last`](./docs/rules/default-param-last.md) | Enforce default parameters to be last | | | | +| [`@typescript-eslint/dot-notation`](./docs/rules/dot-notation.md) | enforce dot notation whenever possible | | :wrench: | :thought_balloon: | +| [`@typescript-eslint/func-call-spacing`](./docs/rules/func-call-spacing.md) | Require or disallow spacing between function identifiers and their invocations | | :wrench: | | +| [`@typescript-eslint/indent`](./docs/rules/indent.md) | Enforce consistent indentation | | :wrench: | | +| [`@typescript-eslint/init-declarations`](./docs/rules/init-declarations.md) | require or disallow initialization in variable declarations | | | | +| [`@typescript-eslint/keyword-spacing`](./docs/rules/keyword-spacing.md) | Enforce consistent spacing before and after keywords | | :wrench: | | +| [`@typescript-eslint/lines-between-class-members`](./docs/rules/lines-between-class-members.md) | Require or disallow an empty line between class members | | :wrench: | | +| [`@typescript-eslint/no-array-constructor`](./docs/rules/no-array-constructor.md) | Disallow generic `Array` constructors | :white_check_mark: | :wrench: | | +| [`@typescript-eslint/no-dupe-class-members`](./docs/rules/no-dupe-class-members.md) | Disallow duplicate class members | | | | +| [`@typescript-eslint/no-duplicate-imports`](./docs/rules/no-duplicate-imports.md) | Disallow duplicate imports | | | | +| [`@typescript-eslint/no-empty-function`](./docs/rules/no-empty-function.md) | Disallow empty functions | :white_check_mark: | | | +| [`@typescript-eslint/no-extra-parens`](./docs/rules/no-extra-parens.md) | Disallow unnecessary parentheses | | :wrench: | | +| [`@typescript-eslint/no-extra-semi`](./docs/rules/no-extra-semi.md) | Disallow unnecessary semicolons | :white_check_mark: | :wrench: | | +| [`@typescript-eslint/no-implied-eval`](./docs/rules/no-implied-eval.md) | Disallow the use of `eval()`-like methods | :white_check_mark: | | :thought_balloon: | +| [`@typescript-eslint/no-invalid-this`](./docs/rules/no-invalid-this.md) | Disallow `this` keywords outside of classes or class-like objects | | | | +| [`@typescript-eslint/no-loop-func`](./docs/rules/no-loop-func.md) | Disallow function declarations that contain unsafe references inside loop statements | | | | +| [`@typescript-eslint/no-loss-of-precision`](./docs/rules/no-loss-of-precision.md) | Disallow literal numbers that lose precision | :white_check_mark: | | | +| [`@typescript-eslint/no-magic-numbers`](./docs/rules/no-magic-numbers.md) | Disallow magic numbers | | | | +| [`@typescript-eslint/no-redeclare`](./docs/rules/no-redeclare.md) | Disallow variable redeclaration | | | | +| [`@typescript-eslint/no-restricted-imports`](./docs/rules/no-restricted-imports.md) | Disallow specified modules when loaded by `import` | | | | +| [`@typescript-eslint/no-shadow`](./docs/rules/no-shadow.md) | Disallow variable declarations from shadowing variables declared in the outer scope | | | | +| [`@typescript-eslint/no-throw-literal`](./docs/rules/no-throw-literal.md) | Disallow throwing literals as exceptions | | | :thought_balloon: | +| [`@typescript-eslint/no-unused-expressions`](./docs/rules/no-unused-expressions.md) | Disallow unused expressions | | | | +| [`@typescript-eslint/no-unused-vars`](./docs/rules/no-unused-vars.md) | Disallow unused variables | :white_check_mark: | | | +| [`@typescript-eslint/no-use-before-define`](./docs/rules/no-use-before-define.md) | Disallow the use of variables before they are defined | | | | +| [`@typescript-eslint/no-useless-constructor`](./docs/rules/no-useless-constructor.md) | Disallow unnecessary constructors | | | | +| [`@typescript-eslint/object-curly-spacing`](./docs/rules/object-curly-spacing.md) | Enforce consistent spacing inside braces | | :wrench: | | +| [`@typescript-eslint/padding-line-between-statements`](./docs/rules/padding-line-between-statements.md) | require or disallow padding lines between statements | | :wrench: | | +| [`@typescript-eslint/quotes`](./docs/rules/quotes.md) | Enforce the consistent use of either backticks, double, or single quotes | | :wrench: | | +| [`@typescript-eslint/require-await`](./docs/rules/require-await.md) | Disallow async functions which have no `await` expression | :white_check_mark: | | :thought_balloon: | +| [`@typescript-eslint/return-await`](./docs/rules/return-await.md) | Enforces consistent returning of awaited values | | :wrench: | :thought_balloon: | +| [`@typescript-eslint/semi`](./docs/rules/semi.md) | Require or disallow semicolons instead of ASI | | :wrench: | | +| [`@typescript-eslint/space-before-function-paren`](./docs/rules/space-before-function-paren.md) | Enforces consistent spacing before function parenthesis | | :wrench: | | +| [`@typescript-eslint/space-infix-ops`](./docs/rules/space-infix-ops.md) | This rule is aimed at ensuring there are spaces around infix operators. | | :wrench: | | diff --git a/packages/eslint-plugin/ROADMAP.md b/packages/eslint-plugin/ROADMAP.md index 749ba2bdf829..6a55ef2cb7d2 100644 --- a/packages/eslint-plugin/ROADMAP.md +++ b/packages/eslint-plugin/ROADMAP.md @@ -240,7 +240,7 @@ Relevant plugins: [`chai-expect-keywords`](https://github.com/gavinaiken/eslint- | `no-banned-terms` | 🌟 | [`no-caller`][no-caller] & [`no-eval`][no-eval] | | `no-constant-condition` | 🌟 | [`no-constant-condition`][no-constant-condition] | | `no-control-regex` | 🌟 | [`no-control-regex`][no-control-regex] | -| `no-delete-expression` | 🌓 | [`no-delete-var`][no-delete-var] | +| `no-delete-expression` | ✅ | [`@typescript-eslint/no-dynamic-delete`] | | `no-empty-line-after-opening-brace` | 🌟 | [`padded-blocks`][padded-blocks] [1] or [Prettier] | | `no-for-in` | 🌟 | [`no-restricted-syntax`][no-restricted-syntax] [2] | | `no-function-expression` | 🌟 | [`func-style`][func-style] [3] | @@ -299,7 +299,7 @@ Relevant plugins: [`chai-expect-keywords`](https://github.com/gavinaiken/eslint- | `no-document-write` | 🌓 | Use [`no-restricted-syntax`][no-restricted-syntax] | | `no-exec-script` | 🌓 | Use [`no-restricted-syntax`][no-restricted-syntax] | | `no-jquery-raw-elements` | 🛑 | N/A | -| `no-unsupported-browser-code` | 🔌 | [`eslint-plugin-compat`][plugin:compat] | +| `no-unsupported-browser-code` | 🛑 | N/A | | `react-this-binding-issue` | 🛑 | N/A | | `react-tsx-curly-spacing` | 🔌 | [`react/jsx-curly-spacing`] | | `react-unused-props-and-state` | 🌓 | [`react/no-unused-state`] | @@ -315,7 +315,7 @@ Relevant plugins: [`chai-expect-keywords`](https://github.com/gavinaiken/eslint- | `react-a11y-image-button-has-alt` | 🔌 | [`jsx-a11y/alt-text`] | | `react-a11y-img-has-alt` | 🔌 | [`jsx-a11y/alt-text`] | | `react-a11y-input-elements` | 🛑 | N/A | -| `react-a11y-lang` | 🔌 | [`jsx-a11y/html-has-lang`] & [`jsx-a11y/lang`] | +| `react-a11y-lang` | 🔌 | [`jsx-a11y/lang`] | | `react-a11y-meta` | 🛑 | N/A | | `react-a11y-no-onchange` | 🔌 | [`jsx-a11y/no-onchange`] | | `react-a11y-props` | 🔌 | [`jsx-a11y/aria-props`] | @@ -583,7 +583,6 @@ Relevant plugins: [`chai-expect-keywords`](https://github.com/gavinaiken/eslint- [no-invalid-regexp]: https://eslint.org/docs/rules/no-invalid-regexp [no-regex-spaces]: https://eslint.org/docs/rules/no-regex-spaces [no-new-func]: https://eslint.org/docs/rules/no-new-func -[no-delete-var]: https://eslint.org/docs/rules/no-delete-var [padded-blocks]: https://eslint.org/docs/rules/padded-blocks [func-style]: https://eslint.org/docs/rules/func-style [no-multi-str]: https://eslint.org/docs/rules/no-multi-str diff --git a/packages/eslint-plugin/docs/rules/adjacent-overload-signatures.md b/packages/eslint-plugin/docs/rules/adjacent-overload-signatures.md index e7a1596d1674..339425c8d427 100644 --- a/packages/eslint-plugin/docs/rules/adjacent-overload-signatures.md +++ b/packages/eslint-plugin/docs/rules/adjacent-overload-signatures.md @@ -87,3 +87,9 @@ If you don't care about the general structure of the code, then you will not nee ## Compatibility - TSLint: [adjacent-overload-signatures](https://palantir.github.io/tslint/rules/adjacent-overload-signatures/) + +## Attributes + +- [x] ✅ Recommended +- [ ] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/array-type.md b/packages/eslint-plugin/docs/rules/array-type.md index 75e2b1c6d655..66f0bcb750b4 100644 --- a/packages/eslint-plugin/docs/rules/array-type.md +++ b/packages/eslint-plugin/docs/rules/array-type.md @@ -114,3 +114,9 @@ This matrix lists all possible option combinations and their expected results fo ## Related to - TSLint: [array-type](https://palantir.github.io/tslint/rules/array-type/) + +## Attributes + +- [ ] ✅ Recommended +- [x] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/await-thenable.md b/packages/eslint-plugin/docs/rules/await-thenable.md index fc65df9be38f..c4046cbf9883 100644 --- a/packages/eslint-plugin/docs/rules/await-thenable.md +++ b/packages/eslint-plugin/docs/rules/await-thenable.md @@ -31,3 +31,9 @@ This is generally not preferred, but can sometimes be useful for visual consiste ## Related to - TSLint: ['await-promise'](https://palantir.github.io/tslint/rules/await-promise) + +## Attributes + +- [x] ✅ Recommended +- [ ] 🔧 Fixable +- [x] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/ban-ts-comment.md b/packages/eslint-plugin/docs/rules/ban-ts-comment.md index bfdd4104751d..f9727887603e 100644 --- a/packages/eslint-plugin/docs/rules/ban-ts-comment.md +++ b/packages/eslint-plugin/docs/rules/ban-ts-comment.md @@ -130,3 +130,9 @@ If you want to use all of the TypeScript directives. ## Compatibility - TSLint: [ban-ts-ignore](https://palantir.github.io/tslint/rules/ban-ts-ignore/) + +## Attributes + +- [x] ✅ Recommended +- [ ] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/ban-tslint-comment.md b/packages/eslint-plugin/docs/rules/ban-tslint-comment.md index 6af168f4bc4e..48e49c1ddcbf 100644 --- a/packages/eslint-plugin/docs/rules/ban-tslint-comment.md +++ b/packages/eslint-plugin/docs/rules/ban-tslint-comment.md @@ -27,3 +27,9 @@ Examples of **correct** code for this rule: ## When Not To Use It If you are still using TSLint. + +## Attributes + +- [ ] ✅ Recommended +- [x] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/ban-types.md b/packages/eslint-plugin/docs/rules/ban-types.md index bf59ffb84618..0fc1c3af94bc 100644 --- a/packages/eslint-plugin/docs/rules/ban-types.md +++ b/packages/eslint-plugin/docs/rules/ban-types.md @@ -75,8 +75,6 @@ The default options provide a set of "best practices", intended to provide safet - Avoid the `Object` and `{}` types, as they mean "any non-nullish value". - This is a point of confusion for many developers, who think it means "any object type". - See [this comment for more information](https://github.com/typescript-eslint/typescript-eslint/issues/2063#issuecomment-675156492). -- Avoid the `object` type, as it is currently hard to use due to not being able to assert that keys exist. - - See [microsoft/TypeScript#21732](https://github.com/microsoft/TypeScript/issues/21732). **_Important note:_** the default options suggest using `Record`; this was a stylistic decision, as the built-in `Record` type is considered to look cleaner. @@ -126,12 +124,6 @@ const defaultTypes = { '- If you want a type meaning "any value", you probably want `unknown` instead.', ].join('\n'), }, - object: { - message: [ - 'The `object` type is currently hard to use ([see this issue](https://github.com/microsoft/TypeScript/issues/21732)).', - 'Consider using `Record` instead, as it allows you to more easily inspect and use the keys.', - ].join('\n'), - }, }; ``` @@ -152,8 +144,6 @@ const symb: Symbol = Symbol('foo'); const func: Function = () => 1; // use safer object types -const lowerObj: object = {}; - const capitalObj1: Object = 1; const capitalObj2: Object = { a: 'string' }; @@ -174,7 +164,7 @@ const symb: symbol = Symbol('foo'); const func: () => number = () => 1; // use safer object types -const lowerObj: Record = {}; +const lowerObj: object = {}; const capitalObj1: number = 1; const capitalObj2: { a: string } = { a: 'string' }; @@ -185,4 +175,10 @@ const curly2: Record<'a', string> = { a: 'string' }; ## Compatibility -- TSLint: [ban-types](https://palantir.github.io/tslint/rules/ban-types/) +- TSLint: [ban-types](https://palantir.github.io/tslint/rules/ban-types) + +## Attributes + +- [x] ✅ Recommended +- [x] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/brace-style.md b/packages/eslint-plugin/docs/rules/brace-style.md index 06dfa1619fb2..87c123a43d7a 100644 --- a/packages/eslint-plugin/docs/rules/brace-style.md +++ b/packages/eslint-plugin/docs/rules/brace-style.md @@ -20,3 +20,9 @@ It adds support for `enum`, `interface`, `namespace` and `module` declarations. See [`eslint/brace-style` options](https://eslint.org/docs/rules/brace-style#options). Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/brace-style.md) + +## Attributes + +- [ ] ✅ Recommended +- [x] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/class-literal-property-style.md b/packages/eslint-plugin/docs/rules/class-literal-property-style.md index 1bca8390fd3b..220d858f03cb 100644 --- a/packages/eslint-plugin/docs/rules/class-literal-property-style.md +++ b/packages/eslint-plugin/docs/rules/class-literal-property-style.md @@ -94,3 +94,9 @@ class Mx { When you have no strong preference, or do not wish to enforce a particular style for how literal values are exposed by your classes. + +## Attributes + +- [ ] ✅ Recommended +- [x] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/comma-dangle.md b/packages/eslint-plugin/docs/rules/comma-dangle.md index bfb40d338bcf..6db276e59d90 100644 --- a/packages/eslint-plugin/docs/rules/comma-dangle.md +++ b/packages/eslint-plugin/docs/rules/comma-dangle.md @@ -32,3 +32,9 @@ This rule has a string option and an object option. - [See the other options allowed](https://github.com/eslint/eslint/blob/master/docs/rules/comma-dangle.md#options) Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/comma-dangle.md) + +## Attributes + +- [ ] ✅ Recommended +- [x] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/comma-spacing.md b/packages/eslint-plugin/docs/rules/comma-spacing.md index 0920180416ad..4ed084d8ee00 100644 --- a/packages/eslint-plugin/docs/rules/comma-spacing.md +++ b/packages/eslint-plugin/docs/rules/comma-spacing.md @@ -20,3 +20,9 @@ It adds support for trailing comma in a types parameters list. See [`eslint/comma-spacing` options](https://eslint.org/docs/rules/comma-spacing#options). Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/comma-spacing.md) + +## Attributes + +- [ ] ✅ Recommended +- [x] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/consistent-indexed-object-style.md b/packages/eslint-plugin/docs/rules/consistent-indexed-object-style.md index c98997c5e0a6..a65281a6050c 100644 --- a/packages/eslint-plugin/docs/rules/consistent-indexed-object-style.md +++ b/packages/eslint-plugin/docs/rules/consistent-indexed-object-style.md @@ -65,3 +65,9 @@ type Foo = { [key: string]: unknown; }; ``` + +## Attributes + +- [ ] ✅ Recommended +- [x] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/consistent-type-assertions.md b/packages/eslint-plugin/docs/rules/consistent-type-assertions.md index 899647636cb6..56a3cbddde2d 100644 --- a/packages/eslint-plugin/docs/rules/consistent-type-assertions.md +++ b/packages/eslint-plugin/docs/rules/consistent-type-assertions.md @@ -92,3 +92,9 @@ If you do not want to enforce consistent type assertions. - TSLint: [no-angle-bracket-type-assertion](https://palantir.github.io/tslint/rules/no-angle-bracket-type-assertion/) - TSLint: [no-object-literal-type-assertion](https://palantir.github.io/tslint/rules/no-object-literal-type-assertion/) + +## Attributes + +- [ ] ✅ Recommended +- [ ] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/consistent-type-definitions.md b/packages/eslint-plugin/docs/rules/consistent-type-definitions.md index 52afd3f9a81c..6f91d480e52d 100644 --- a/packages/eslint-plugin/docs/rules/consistent-type-definitions.md +++ b/packages/eslint-plugin/docs/rules/consistent-type-definitions.md @@ -72,3 +72,9 @@ If you specifically want to use an interface or type literal for stylistic reaso ## Compatibility - TSLint: [interface-over-type-literal](https://palantir.github.io/tslint/rules/interface-over-type-literal/) + +## Attributes + +- [ ] ✅ Recommended +- [x] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/consistent-type-exports.md b/packages/eslint-plugin/docs/rules/consistent-type-exports.md new file mode 100644 index 000000000000..cb3b01f51dfe --- /dev/null +++ b/packages/eslint-plugin/docs/rules/consistent-type-exports.md @@ -0,0 +1,34 @@ +# Enforces consistent usage of type exports (`consistent-type-exports`) + +TypeScript 3.8 added support for type-only exports. + +Type-only exports allow you to specify that 1 or more named exports are exported as type-only. This allows +transpilers to drop exports without knowing the types of the dependencies. + +## Rule Details + +This rule aims to standardize the use of type exports style across a codebase. + +Given a class `Button`, and an interface `ButtonProps`, examples of **correct** code: + +```ts +export { Button } from 'some-library'; +export type { ButtonProps } from 'some-library'; +``` + +Examples of **incorrect** code: + +```ts +export { Button, ButtonProps } from 'some-library'; +``` + +## When Not To Use It + +- If you are using a TypeScript version less than 3.8, then you will not be able to use this rule as type exports are not supported. +- If you specifically want to use both export kinds for stylistic reasons, you can disable this rule. + +## Attributes + +- [ ] ✅ Recommended +- [x] 🔧 Fixable +- [x] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/consistent-type-imports.md b/packages/eslint-plugin/docs/rules/consistent-type-imports.md index c30e59b40b99..515675e6e6fe 100644 --- a/packages/eslint-plugin/docs/rules/consistent-type-imports.md +++ b/packages/eslint-plugin/docs/rules/consistent-type-imports.md @@ -61,6 +61,10 @@ const x: import('Bar') = 1; ## When Not To Use It - If you are not using TypeScript 3.8 (or greater), then you will not be able to use this rule, as type-only imports are not allowed. -- Certain libraries use the non-inlined imports to infer information about the variables. For example, for dependency injection. - type-only imports cannot be used with these libraries. See [#2559](https://github.com/typescript-eslint/typescript-eslint/issues/2559#issuecomment-692780580) - If you specifically want to use both import kinds for stylistic reasons, you can disable this rule. + +## Attributes + +- [ ] ✅ Recommended +- [x] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/default-param-last.md b/packages/eslint-plugin/docs/rules/default-param-last.md index c9c51df40a36..0eb9aa429df4 100644 --- a/packages/eslint-plugin/docs/rules/default-param-last.md +++ b/packages/eslint-plugin/docs/rules/default-param-last.md @@ -54,3 +54,9 @@ class Foo { See [`eslint/default-param-last` options](https://eslint.org/docs/rules/default-param-last#options). Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/default-param-last.md) + +## Attributes + +- [ ] ✅ Recommended +- [ ] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/dot-notation.md b/packages/eslint-plugin/docs/rules/dot-notation.md index 56097090e2e0..bc2b4f340f21 100644 --- a/packages/eslint-plugin/docs/rules/dot-notation.md +++ b/packages/eslint-plugin/docs/rules/dot-notation.md @@ -3,7 +3,10 @@ ## Rule Details This rule extends the base [`eslint/dot-notation`](https://eslint.org/docs/rules/dot-notation) rule. -It adds support for optionally ignoring computed `private` member access. +It adds: + +- Support for optionally ignoring computed `private` and/or `protected` member access. +- Compatibility with TypeScript's `noPropertyAccessFromIndexSignature` option. ## How to use @@ -24,14 +27,18 @@ This rule adds the following options: interface Options extends BaseDotNotationOptions { allowPrivateClassPropertyAccess?: boolean; allowProtectedClassPropertyAccess?: boolean; + allowIndexSignaturePropertyAccess?: boolean; } const defaultOptions: Options = { ...baseDotNotationDefaultOptions, allowPrivateClassPropertyAccess: false, allowProtectedClassPropertyAccess: false, + allowIndexSignaturePropertyAccess: false, }; ``` +If the TypeScript compiler option `noPropertyAccessFromIndexSignature` is set to `true`, then this rule always allows the use of square bracket notation to access properties of types that have a `string` index signature, even if `allowIndexSignaturePropertyAccess` is `false`. + ### `allowPrivateClassPropertyAccess` Example of a correct code when `allowPrivateClassPropertyAccess` is set to `true` @@ -58,4 +65,25 @@ const x = new X(); x['protected_prop'] = 123; ``` +### `allowIndexSignaturePropertyAccess` + +Example of correct code when `allowIndexSignaturePropertyAccess` is set to `true` + +```ts +class X { + [key: string]: number; +} + +const x = new X(); +x['hello'] = 123; +``` + +If the TypeScript compiler option `noPropertyAccessFromIndexSignature` is set to `true`, then the above code is always allowed, even if `allowIndexSignaturePropertyAccess` is `false`. + Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/dot-notation.md) + +## Attributes + +- [ ] ✅ Recommended +- [x] 🔧 Fixable +- [x] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/explicit-function-return-type.md b/packages/eslint-plugin/docs/rules/explicit-function-return-type.md index 894a99617532..27e731d3d84f 100644 --- a/packages/eslint-plugin/docs/rules/explicit-function-return-type.md +++ b/packages/eslint-plugin/docs/rules/explicit-function-return-type.md @@ -246,3 +246,9 @@ you will not need this rule. ## Further Reading - TypeScript [Functions](https://www.typescriptlang.org/docs/handbook/functions.html#function-types) + +## Attributes + +- [ ] ✅ Recommended +- [ ] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md b/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md index cfbb3154f902..f65af54c4d5d 100644 --- a/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md +++ b/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md @@ -346,3 +346,9 @@ If you think defaulting to public is a good default, then you should consider us ## Compatibility - TSLint: [member-access](http://palantir.github.io/tslint/rules/member-access/) + +## Attributes + +- [ ] ✅ Recommended +- [x] 🔧 Fixable +- [ ] 💭 Requires type information 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 a6945749f2a2..0365deeaea54 100644 --- a/packages/eslint-plugin/docs/rules/explicit-module-boundary-types.md +++ b/packages/eslint-plugin/docs/rules/explicit-module-boundary-types.md @@ -267,3 +267,9 @@ If you wish to make sure all functions have explicit return types, as opposed to ## Further Reading - TypeScript [Functions](https://www.typescriptlang.org/docs/handbook/functions.html#function-types) + +## Attributes + +- [ ] ✅ Recommended +- [ ] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/func-call-spacing.md b/packages/eslint-plugin/docs/rules/func-call-spacing.md index 8aa9e7e0cbff..0070c5633030 100644 --- a/packages/eslint-plugin/docs/rules/func-call-spacing.md +++ b/packages/eslint-plugin/docs/rules/func-call-spacing.md @@ -20,3 +20,9 @@ It adds support for generic type parameters on function calls. See [`eslint/func-call-spacing` options](https://eslint.org/docs/rules/func-call-spacing#options). Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/func-call-spacing.md) + +## Attributes + +- [ ] ✅ Recommended +- [x] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/indent.md b/packages/eslint-plugin/docs/rules/indent.md index 023c774657ae..1c8af15906c8 100644 --- a/packages/eslint-plugin/docs/rules/indent.md +++ b/packages/eslint-plugin/docs/rules/indent.md @@ -22,3 +22,9 @@ It adds support for TypeScript nodes. See [`eslint/indent` options](https://eslint.org/docs/rules/indent#options). Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/indent.md) + +## Attributes + +- [ ] ✅ Recommended +- [x] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/init-declarations.md b/packages/eslint-plugin/docs/rules/init-declarations.md index f83c5bd9c3f4..53783e23759b 100644 --- a/packages/eslint-plugin/docs/rules/init-declarations.md +++ b/packages/eslint-plugin/docs/rules/init-declarations.md @@ -20,3 +20,9 @@ It adds support for TypeScript's `declare` variables. See [`eslint/init-declarations` options](https://eslint.org/docs/rules/init-declarations#options). Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/init-declarations.md) + +## Attributes + +- [ ] ✅ Recommended +- [ ] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/keyword-spacing.md b/packages/eslint-plugin/docs/rules/keyword-spacing.md index 3178542d2d68..f4d4403bd400 100644 --- a/packages/eslint-plugin/docs/rules/keyword-spacing.md +++ b/packages/eslint-plugin/docs/rules/keyword-spacing.md @@ -20,3 +20,9 @@ This version adds support for generic type parameters on function calls. See [`eslint/keyword-spacing` options](https://eslint.org/docs/rules/keyword-spacing#options). Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/keyword-spacing.md) + +## Attributes + +- [ ] ✅ Recommended +- [x] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/lines-between-class-members.md b/packages/eslint-plugin/docs/rules/lines-between-class-members.md index e2692bb18a0c..ab40dfdbdf3e 100644 --- a/packages/eslint-plugin/docs/rules/lines-between-class-members.md +++ b/packages/eslint-plugin/docs/rules/lines-between-class-members.md @@ -71,3 +71,9 @@ class foo { ``` Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/lines-between-class-members.md) + +## Attributes + +- [ ] ✅ Recommended +- [x] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/member-delimiter-style.md b/packages/eslint-plugin/docs/rules/member-delimiter-style.md index c6f7ca470002..259915f7b419 100644 --- a/packages/eslint-plugin/docs/rules/member-delimiter-style.md +++ b/packages/eslint-plugin/docs/rules/member-delimiter-style.md @@ -199,3 +199,9 @@ type FooBar = { name: string; greet(): string } ## When Not To Use It If you don't care about enforcing a consistent member delimiter in interfaces and type literals, then you will not need this rule. + +## Attributes + +- [ ] ✅ Recommended +- [x] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/member-ordering.md b/packages/eslint-plugin/docs/rules/member-ordering.md index eda1c573c8e9..5924b18aaaa7 100644 --- a/packages/eslint-plugin/docs/rules/member-ordering.md +++ b/packages/eslint-plugin/docs/rules/member-ordering.md @@ -77,6 +77,64 @@ There are multiple ways to specify the member types. The most explicit and granu "protected-constructor", "private-constructor", + // Getters + "public-static-get", + "protected-static-get", + "private-static-get", + + "public-decorated-get", + "protected-decorated-get", + "private-decorated-get", + + "public-instance-get", + "protected-instance-get", + "private-instance-get", + + "public-abstract-get", + "protected-abstract-get", + "private-abstract-get", + + "public-get", + "protected-get", + "private-get", + + "static-get", + "instance-get", + "abstract-get", + + "decorated-get", + + "get", + + // Setters + "public-static-set", + "protected-static-set", + "private-static-set", + + "public-decorated-set", + "protected-decorated-set", + "private-decorated-set", + + "public-instance-set", + "protected-instance-set", + "private-instance-set", + + "public-abstract-set", + "protected-abstract-set", + "private-abstract-set", + + "public-set", + "protected-set", + "private-set", + + "static-set", + "instance-set", + "abstract-set", + + "decorated-set", + + "set", + // Methods "public-static-method", "protected-static-method", @@ -112,6 +170,16 @@ It is also possible to group member types by their accessibility (`static`, `ins // Constructors // Only the accessibility of constructors is configurable. See below. + // Getters + "public-get", // = ["public-static-get", "public-instance-get"] + "protected-get", // = ["protected-static-get", "protected-instance-get"] + "private-get", // = ["private-static-get", "private-instance-get"] + + // Setters + "public-set", // = ["public-static-set", "public-instance-set"] + "protected-set", // = ["protected-static-set", "protected-instance-set"] + "private-set", // = ["private-static-set", "private-instance-set"] + // Methods "public-method", // = ["public-static-method", "public-instance-method"] "protected-method", // = ["protected-static-method", "protected-instance-method"] @@ -139,6 +207,21 @@ their accessibility. // Constructors // There are no decorators for constructors. + // Getters + "public-decorated-get", + "protected-decorated-get", + "private-decorated-get", + + "decorated-get" // = ["public-decorated-get", "protected-decorated-get", "private-decorated-get"] + + // Setters + "public-decorated-set", + "protected-decorated-set", + "private-decorated-set", + + "decorated-set" // = ["public-decorated-set", "protected-decorated-set", "private-decorated-set"] + + // Methods "public-decorated-method", "protected-decorated-method", "private-decorated-method", @@ -164,6 +247,16 @@ Another option is to group the member types by their scope (`public`, `protected // Constructors "constructor", // = ["public-constructor", "protected-constructor", "private-constructor"] + // Getters + "static-get", // = ["public-static-get", "protected-static-get", "private-static-get"] + "instance-get", // = ["public-instance-get", "protected-instance-get", "private-instance-get"] + "abstract-get" // = ["public-abstract-get", "protected-abstract-get", "private-abstract-get"] + + // Setters + "static-set", // = ["public-static-set", "protected-static-set", "private-static-set"] + "instance-set", // = ["public-instance-set", "protected-instance-set", "private-instance-set"] + "abstract-set" // = ["public-abstract-set", "protected-abstract-set", "private-abstract-set"] + // Methods "static-method", // = ["public-static-method", "protected-static-method", "private-static-method"] "instance-method", // = ["public-instance-method", "protected-instance-method", "private-instance-method"] @@ -187,6 +280,14 @@ The third grouping option is to ignore both scope and accessibility. // Constructors // Only the accessibility of constructors is configurable. See above. + // Getters + "get" // = ["public-static-get", "protected-static-get", "private-static-get", "public-instance-get", "protected-instance-get", "private-instance-get", + // "public-abstract-get", "protected-abstract-get", "private-abstract-get"] + + // Setters + "set" // = ["public-static-set", "protected-static-set", "private-static-set", "public-instance-set", "protected-instance-set", "private-instance-set", + // "public-abstract-set", "protected-abstract-set", "private-abstract-set"] + // Methods "method" // = ["public-static-method", "protected-static-method", "private-static-method", "public-instance-method", "protected-instance-method", "private-instance-method", // "public-abstract-method", "protected-abstract-method", "private-abstract-method"] @@ -239,6 +340,64 @@ The default configuration looks as follows: "constructor", + // Getters + "public-static-get", + "protected-static-get", + "private-static-get", + + "public-decorated-get", + "protected-decorated-get", + "private-decorated-get", + + "public-instance-get", + "protected-instance-get", + "private-instance-get", + + "public-abstract-get", + "protected-abstract-get", + "private-abstract-get", + + "public-get", + "protected-get", + "private-get", + + "static-get", + "instance-get", + "abstract-get", + + "decorated-get", + + "get", + + // Setters + "public-static-set", + "protected-static-set", + "private-static-set", + + "public-decorated-set", + "protected-decorated-set", + "private-decorated-set", + + "public-instance-set", + "protected-instance-set", + "private-instance-set", + + "public-abstract-set", + "protected-abstract-set", + "private-abstract-set", + + "public-set", + "protected-set", + "private-set", + + "static-set", + "instance-set", + "abstract-set", + + "decorated-set", + + "set", + // Methods "public-static-method", "protected-static-method", @@ -865,3 +1024,9 @@ If you don't care about the general structure of your classes and interfaces, th ## Compatibility - TSLint: [member-ordering](https://palantir.github.io/tslint/rules/member-ordering/) + +## Attributes + +- [ ] ✅ Recommended +- [ ] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/method-signature-style.md b/packages/eslint-plugin/docs/rules/method-signature-style.md index 4358ee36ca06..acfc4317db97 100644 --- a/packages/eslint-plugin/docs/rules/method-signature-style.md +++ b/packages/eslint-plugin/docs/rules/method-signature-style.md @@ -92,3 +92,9 @@ type T2 = { ## When Not To Use It If you don't want to enforce a particular style for object/interface function types, and/or if you don't use `strictFunctionTypes`, then you don't need this rule. + +## Attributes + +- [ ] ✅ Recommended +- [x] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/naming-convention.md b/packages/eslint-plugin/docs/rules/naming-convention.md index ff9f8e79a3cf..a55dfde13181 100644 --- a/packages/eslint-plugin/docs/rules/naming-convention.md +++ b/packages/eslint-plugin/docs/rules/naming-convention.md @@ -110,7 +110,7 @@ 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` - accepts a regular expression (anything accepted into `new RegExp(regex)`). +- `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`. ### `filter` @@ -121,7 +121,7 @@ You can use this to include or exclude specific identifiers from specific config Accepts an object with the following properties: -- `regex` - accepts a regular expression (anything accepted into `new RegExp(regex)`). +- `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`. 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`. @@ -694,3 +694,9 @@ You can use the `destructured` modifier to match these names, and explicitly set ## When Not To Use It If you do not want to enforce naming conventions for anything. + +## Attributes + +- [ ] ✅ Recommended +- [ ] 🔧 Fixable +- [x] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-array-constructor.md b/packages/eslint-plugin/docs/rules/no-array-constructor.md index fb9a68e7429f..dd9dd25bc140 100644 --- a/packages/eslint-plugin/docs/rules/no-array-constructor.md +++ b/packages/eslint-plugin/docs/rules/no-array-constructor.md @@ -41,3 +41,9 @@ new Array(someOtherArray.length); See [`eslint/no-array-constructor` options](https://eslint.org/docs/rules/no-array-constructor#options). Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/no-array-constructor.md) + +## Attributes + +- [x] ✅ Recommended +- [x] 🔧 Fixable +- [ ] 💭 Requires type information 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 f1c2abab3a78..3daf5624792b 100644 --- a/packages/eslint-plugin/docs/rules/no-base-to-string.md +++ b/packages/eslint-plugin/docs/rules/no-base-to-string.md @@ -85,3 +85,9 @@ let text = `${value}`; If you don't mind `"[object Object]"` in your strings, then you will not need this rule. - [`Object.prototype.toString()` MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString) + +## Attributes + +- [ ] ✅ Recommended +- [ ] 🔧 Fixable +- [x] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-confusing-non-null-assertion.md b/packages/eslint-plugin/docs/rules/no-confusing-non-null-assertion.md index a61f6a8a9f4e..cac0acbc2434 100644 --- a/packages/eslint-plugin/docs/rules/no-confusing-non-null-assertion.md +++ b/packages/eslint-plugin/docs/rules/no-confusing-non-null-assertion.md @@ -44,3 +44,9 @@ If you don't care about this confusion, then you will not need this rule. ## Further Reading - [`Issue: Easy misunderstanding: "! ==="`](https://github.com/microsoft/TypeScript/issues/37837) in [TypeScript repo](https://github.com/microsoft/TypeScript) + +## Attributes + +- [ ] ✅ Recommended +- [x] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-confusing-void-expression.md b/packages/eslint-plugin/docs/rules/no-confusing-void-expression.md index 8a00255170d5..3ea101e18b4a 100644 --- a/packages/eslint-plugin/docs/rules/no-confusing-void-expression.md +++ b/packages/eslint-plugin/docs/rules/no-confusing-void-expression.md @@ -147,3 +147,9 @@ Also, if you prefer concise coding style then also don't use it. ## Related to - TSLint: ['no-void-expression'](https://palantir.github.io/tslint/rules/no-void-expression/) + +## Attributes + +- [ ] ✅ Recommended +- [x] 🔧 Fixable +- [x] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-dupe-class-members.md b/packages/eslint-plugin/docs/rules/no-dupe-class-members.md index ddfc1b9f1bd8..121c07a46703 100644 --- a/packages/eslint-plugin/docs/rules/no-dupe-class-members.md +++ b/packages/eslint-plugin/docs/rules/no-dupe-class-members.md @@ -20,3 +20,9 @@ It adds support for TypeScript's method overload definitions. See [`eslint/no-dupe-class-members` options](https://eslint.org/docs/rules/no-dupe-class-members#options). Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/no-dupe-class-members.md) + +## Attributes + +- [ ] ✅ Recommended +- [ ] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-duplicate-imports.md b/packages/eslint-plugin/docs/rules/no-duplicate-imports.md index 140a8a1ece14..1cc99ddd0977 100644 --- a/packages/eslint-plugin/docs/rules/no-duplicate-imports.md +++ b/packages/eslint-plugin/docs/rules/no-duplicate-imports.md @@ -20,3 +20,9 @@ This version adds support for type-only import and export. See [`eslint/no-duplicate-imports` options](https://eslint.org/docs/rules/no-duplicate-imports#options). Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/no-duplicate-imports.md) + +## Attributes + +- [ ] ✅ Recommended +- [ ] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-dynamic-delete.md b/packages/eslint-plugin/docs/rules/no-dynamic-delete.md index 5d84cb1c9ade..4d12eef8ffe8 100644 --- a/packages/eslint-plugin/docs/rules/no-dynamic-delete.md +++ b/packages/eslint-plugin/docs/rules/no-dynamic-delete.md @@ -47,3 +47,9 @@ Even repeated minor performance slowdowns likely do not significantly affect you ## Related to - TSLint: [no-dynamic-delete](https://palantir.github.io/tslint/rules/no-dynamic-delete) + +## Attributes + +- [ ] ✅ Recommended +- [x] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-empty-function.md b/packages/eslint-plugin/docs/rules/no-empty-function.md index 356700d834ea..b7d0fb99f5f2 100644 --- a/packages/eslint-plugin/docs/rules/no-empty-function.md +++ b/packages/eslint-plugin/docs/rules/no-empty-function.md @@ -88,3 +88,9 @@ class Foo { --- Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/no-empty-function.md) + +## Attributes + +- [x] ✅ Recommended +- [ ] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-empty-interface.md b/packages/eslint-plugin/docs/rules/no-empty-interface.md index 7df218a7eca8..5eca9c8af107 100644 --- a/packages/eslint-plugin/docs/rules/no-empty-interface.md +++ b/packages/eslint-plugin/docs/rules/no-empty-interface.md @@ -62,3 +62,9 @@ If you don't care about having empty/meaningless interfaces, then you will not n ## Compatibility - TSLint: [no-empty-interface](https://palantir.github.io/tslint/rules/no-empty-interface/) + +## Attributes + +- [x] ✅ Recommended +- [x] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-explicit-any.md b/packages/eslint-plugin/docs/rules/no-explicit-any.md index 7aeb465874eb..85256e33c716 100644 --- a/packages/eslint-plugin/docs/rules/no-explicit-any.md +++ b/packages/eslint-plugin/docs/rules/no-explicit-any.md @@ -179,3 +179,9 @@ and you want to be able to specify `any`. ## Compatibility - TSLint: [no-any](https://palantir.github.io/tslint/rules/no-any/) + +## Attributes + +- [x] ✅ Recommended +- [x] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-extra-non-null-assertion.md b/packages/eslint-plugin/docs/rules/no-extra-non-null-assertion.md index 0991efdee52f..8eb27f805c4e 100644 --- a/packages/eslint-plugin/docs/rules/no-extra-non-null-assertion.md +++ b/packages/eslint-plugin/docs/rules/no-extra-non-null-assertion.md @@ -47,3 +47,9 @@ function foo(bar?: { n: number }) { "@typescript-eslint/no-extra-non-null-assertion": ["error"] } ``` + +## Attributes + +- [x] ✅ Recommended +- [x] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-extra-parens.md b/packages/eslint-plugin/docs/rules/no-extra-parens.md index 8173b2ef1adb..8a748ac5a231 100644 --- a/packages/eslint-plugin/docs/rules/no-extra-parens.md +++ b/packages/eslint-plugin/docs/rules/no-extra-parens.md @@ -20,3 +20,9 @@ It adds support for TypeScript type assertions. See [`eslint/no-extra-parens` options](https://eslint.org/docs/rules/no-extra-parens#options). Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/no-extra-parens.md) + +## Attributes + +- [ ] ✅ Recommended +- [x] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-extra-semi.md b/packages/eslint-plugin/docs/rules/no-extra-semi.md index f6865bd8b54a..2d43f5223ee6 100644 --- a/packages/eslint-plugin/docs/rules/no-extra-semi.md +++ b/packages/eslint-plugin/docs/rules/no-extra-semi.md @@ -20,3 +20,9 @@ It adds support for class properties. See [`eslint/no-extra-semi` options](https://eslint.org/docs/rules/no-extra-semi#options). Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/no-extra-semi.md) + +## Attributes + +- [x] ✅ Recommended +- [x] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-extraneous-class.md b/packages/eslint-plugin/docs/rules/no-extraneous-class.md index abc84f272b4d..5a57c71ec4f0 100644 --- a/packages/eslint-plugin/docs/rules/no-extraneous-class.md +++ b/packages/eslint-plugin/docs/rules/no-extraneous-class.md @@ -78,3 +78,9 @@ team or if you use classes as namespaces. ## Compatibility [`no-unnecessary-class`](https://palantir.github.io/tslint/rules/no-unnecessary-class/) from TSLint + +## Attributes + +- [ ] ✅ Recommended +- [ ] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-floating-promises.md b/packages/eslint-plugin/docs/rules/no-floating-promises.md index bda8c26b7855..1e7d0bf3299a 100644 --- a/packages/eslint-plugin/docs/rules/no-floating-promises.md +++ b/packages/eslint-plugin/docs/rules/no-floating-promises.md @@ -77,7 +77,7 @@ void returnsPromise(); void Promise.reject('value'); ``` -With this option set to `true`, and if you are using `no-void`, you should turn on the [`allowAsAStatement`](https://eslint.org/docs/rules/no-void#allowasstatement) option. +With this option set to `true`, and if you are using `no-void`, you should turn on the [`allowAsStatement`](https://eslint.org/docs/rules/no-void#allowasstatement) option. ### `ignoreIIFE` @@ -102,3 +102,9 @@ If you do not use Promise-like values in your codebase, or want to allow them to ## Related to - TSLint: ['no-floating-promises'](https://palantir.github.io/tslint/rules/no-floating-promises/) + +## Attributes + +- [x] ✅ Recommended +- [ ] 🔧 Fixable +- [x] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-for-in-array.md b/packages/eslint-plugin/docs/rules/no-for-in-array.md index c5d4c3f648dd..61ab8e0c1186 100644 --- a/packages/eslint-plugin/docs/rules/no-for-in-array.md +++ b/packages/eslint-plugin/docs/rules/no-for-in-array.md @@ -42,3 +42,9 @@ If you want to iterate through a loop using the indices in an array as strings, ## Related to - TSLint: ['no-for-in-array'](https://palantir.github.io/tslint/rules/no-for-in-array/) + +## Attributes + +- [x] ✅ Recommended +- [ ] 🔧 Fixable +- [x] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-implicit-any-catch.md b/packages/eslint-plugin/docs/rules/no-implicit-any-catch.md index 8ef946b42865..81ac098690e2 100644 --- a/packages/eslint-plugin/docs/rules/no-implicit-any-catch.md +++ b/packages/eslint-plugin/docs/rules/no-implicit-any-catch.md @@ -74,3 +74,9 @@ If you are not using TypeScript 4.0 (or greater), then you will not be able to u ## Further Reading - [TypeScript 4.0 Beta Release Notes](https://devblogs.microsoft.com/typescript/announcing-typescript-4-0-beta/#unknown-on-catch) + +## Attributes + +- [ ] ✅ Recommended +- [x] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-implied-eval.md b/packages/eslint-plugin/docs/rules/no-implied-eval.md index a03ce7279352..2a89bed488fe 100644 --- a/packages/eslint-plugin/docs/rules/no-implied-eval.md +++ b/packages/eslint-plugin/docs/rules/no-implied-eval.md @@ -103,3 +103,9 @@ setTimeout(Foo.fn, 100); If you want to allow `new Function()` or `setTimeout()`, `setInterval()`, `setImmediate()` and `execScript()` with string arguments, then you can safely disable this rule. Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/no-implied-eval.md) + +## Attributes + +- [x] ✅ Recommended +- [ ] 🔧 Fixable +- [x] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-inferrable-types.md b/packages/eslint-plugin/docs/rules/no-inferrable-types.md index 91fdfe6784a4..cde64f5b73da 100644 --- a/packages/eslint-plugin/docs/rules/no-inferrable-types.md +++ b/packages/eslint-plugin/docs/rules/no-inferrable-types.md @@ -144,3 +144,9 @@ TypeScript [Inference](https://www.typescriptlang.org/docs/handbook/type-inferen ## Compatibility TSLint: [no-inferrable-types](https://palantir.github.io/tslint/rules/no-inferrable-types/) + +## Attributes + +- [x] ✅ Recommended +- [x] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-invalid-this.md b/packages/eslint-plugin/docs/rules/no-invalid-this.md index a7f907380af9..86d7a03eba5c 100644 --- a/packages/eslint-plugin/docs/rules/no-invalid-this.md +++ b/packages/eslint-plugin/docs/rules/no-invalid-this.md @@ -24,3 +24,9 @@ See [`eslint/no-invalid-this` options](https://eslint.org/docs/rules/no-invalid- When you are indifferent as to how your variables are initialized. Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/no-invalid-this.md) + +## Attributes + +- [ ] ✅ Recommended +- [ ] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-invalid-void-type.md b/packages/eslint-plugin/docs/rules/no-invalid-void-type.md index 567d9c0bb33e..7ba223348938 100644 --- a/packages/eslint-plugin/docs/rules/no-invalid-void-type.md +++ b/packages/eslint-plugin/docs/rules/no-invalid-void-type.md @@ -124,3 +124,9 @@ or in invalid places, then you don't need this rule. ## Compatibility - TSLint: [invalid-void](https://palantir.github.io/tslint/rules/invalid-void/) + +## Attributes + +- [ ] ✅ Recommended +- [ ] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-loop-func.md b/packages/eslint-plugin/docs/rules/no-loop-func.md index d4e66d6c7de7..0ca7ea515166 100644 --- a/packages/eslint-plugin/docs/rules/no-loop-func.md +++ b/packages/eslint-plugin/docs/rules/no-loop-func.md @@ -20,3 +20,9 @@ It adds support for TypeScript types. See [`eslint/no-loop-func` options](https://eslint.org/docs/rules/no-loop-func#options). Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/no-loop-func.md) + +## Attributes + +- [ ] ✅ Recommended +- [ ] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-loss-of-precision.md b/packages/eslint-plugin/docs/rules/no-loss-of-precision.md index d6cf7b71c14a..d2e9fb23f6cd 100644 --- a/packages/eslint-plugin/docs/rules/no-loss-of-precision.md +++ b/packages/eslint-plugin/docs/rules/no-loss-of-precision.md @@ -17,3 +17,9 @@ Note that this rule requires ESLint v7. ``` Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/no-loss-of-precision.md) + +## Attributes + +- [x] ✅ Recommended +- [ ] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-magic-numbers.md b/packages/eslint-plugin/docs/rules/no-magic-numbers.md index f41204c132bf..26739600713d 100644 --- a/packages/eslint-plugin/docs/rules/no-magic-numbers.md +++ b/packages/eslint-plugin/docs/rules/no-magic-numbers.md @@ -53,8 +53,8 @@ Examples of **incorrect** code for the `{ "ignoreEnums": false }` option: ```ts /*eslint @typescript-eslint/no-magic-numbers: ["error", { "ignoreEnums": false }]*/ -enum foo = { - SECOND = 1000, +enum foo { + SECOND = 1000, } ``` @@ -63,8 +63,8 @@ Examples of **correct** code for the `{ "ignoreEnums": true }` option: ```ts /*eslint @typescript-eslint/no-magic-numbers: ["error", { "ignoreEnums": true }]*/ -enum foo = { - SECOND = 1000, +enum foo { + SECOND = 1000, } ``` @@ -117,3 +117,9 @@ class Foo { ``` Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/no-magic-numbers.md) + +## Attributes + +- [ ] ✅ Recommended +- [ ] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-meaningless-void-operator.md b/packages/eslint-plugin/docs/rules/no-meaningless-void-operator.md new file mode 100644 index 000000000000..c9479679f414 --- /dev/null +++ b/packages/eslint-plugin/docs/rules/no-meaningless-void-operator.md @@ -0,0 +1,56 @@ +# Disallow the `void` operator except when used to discard a value (`no-meaningless-void-operator`) + +Disallow the `void` operator when its argument is already of type `void` or `undefined`. + +## Rule Details + +The `void` operator is a useful tool to convey the programmer's intent to discard a value. For example, it is recommended as one way of suppressing [`@typescript-eslint/no-floating-promises`](./no-floating-promises.md) instead of adding `.catch()` to a promise. + +This rule helps an author catch API changes where previously a value was being discarded at a call site, but the callee changed so it no longer returns a value. When combined with [no-unused-expressions](https://eslint.org/docs/rules/no-unused-expressions), it also helps _readers_ of the code by ensuring consistency: a statement that looks like `void foo();` is **always** discarding a return value, and a statement that looks like `foo();` is **never** discarding a return value. + +Examples of **incorrect** code for this rule: + +```ts +void (() => {})(); + +function foo() {} +void foo(); +``` + +Examples of **correct** code for this rule: + +```ts +(() => {})(); + +function foo() {} +foo(); // nothing to discard + +function bar(x: number) { + void x; // discarding a number + return 2; +} +void bar(); // discarding a number +``` + +### Options + +This rule accepts a single object option with the following default configuration: + +```json +{ + "@typescript-eslint/no-meaningless-void-operator": [ + "error", + { + "checkNever": false + } + ] +} +``` + +- `checkNever: true` will suggest removing `void` when the argument has type `never`. + +## Attributes + +- [ ] ✅ Recommended +- [x] 🔧 Fixable +- [x] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-misused-new.md b/packages/eslint-plugin/docs/rules/no-misused-new.md index f315fcac289c..a920ba03cbf0 100644 --- a/packages/eslint-plugin/docs/rules/no-misused-new.md +++ b/packages/eslint-plugin/docs/rules/no-misused-new.md @@ -39,3 +39,9 @@ interface I { ## Compatibility - TSLint: [no-misused-new](https://palantir.github.io/tslint/rules/no-misused-new/) + +## Attributes + +- [x] ✅ Recommended +- [ ] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-misused-promises.md b/packages/eslint-plugin/docs/rules/no-misused-promises.md index 6a4c2a557921..7e4f28170a6a 100644 --- a/packages/eslint-plugin/docs/rules/no-misused-promises.md +++ b/packages/eslint-plugin/docs/rules/no-misused-promises.md @@ -23,6 +23,25 @@ while (promise) { } ``` +Examples of **correct** code with `checksConditionals: true`: + +```ts +const promise = Promise.resolve('value'); + +// Always `await` the Promise in a conditional +if (await promise) { + // Do something +} + +const val = (await promise) ? 123 : 456; + +while (await promise) { + // Do something +} +``` + +--- + Examples of **incorrect** code for this rule with `checksVoidReturn: true`: ```ts @@ -37,37 +56,51 @@ new Promise(async (resolve, reject) => { const eventEmitter = new EventEmitter(); eventEmitter.on('some-event', async () => { + synchronousCall(); await doSomething(); + otherSynchronousCall(); }); ``` -Examples of **correct** code for this rule: +Examples of **correct** code with `checksVoidReturn: true`: ```ts -const promise = Promise.resolve('value'); - -if (await promise) { - // Do something -} - -const val = (await promise) ? 123 : 456; - -while (await promise) { - // Do something -} - +// for-of puts `await` in outer context for (const value of [1, 2, 3]) { await doSomething(value); } +// If outer context is not `async`, handle error explicitly +Promise.all( + [1, 2, 3].map(async value => { + await doSomething(value); + }), +).catch(handleError); + +// Use an async IIFE wrapper new Promise((resolve, reject) => { - // Do something - resolve(); + // combine with `void` keyword to tell `no-floating-promises` rule to ignore unhandled rejection + void (async () => { + await doSomething(); + resolve(); + })(); }); +// Name the async wrapper to call it later const eventEmitter = new EventEmitter(); eventEmitter.on('some-event', () => { - doSomething(); + const handler = async () => { + await doSomething(); + otherSynchronousCall(); + }; + + try { + synchronousCall(); + } catch (err) { + handleSpecificError(err); + } + + handler().catch(handleError); }); ``` @@ -117,3 +150,9 @@ misuses of them outside of what the TypeScript compiler will check. ## Further Reading - [TypeScript void function assignability](https://github.com/Microsoft/TypeScript/wiki/FAQ#why-are-functions-returning-non-void-assignable-to-function-returning-void) + +## Attributes + +- [x] ✅ Recommended +- [ ] 🔧 Fixable +- [x] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-namespace.md b/packages/eslint-plugin/docs/rules/no-namespace.md index da83ada2bbaa..465dd58b3e00 100644 --- a/packages/eslint-plugin/docs/rules/no-namespace.md +++ b/packages/eslint-plugin/docs/rules/no-namespace.md @@ -113,3 +113,9 @@ If you are using the ES2015 module syntax, then you will not need this rule. ## Compatibility - TSLint: [no-namespace](https://palantir.github.io/tslint/rules/no-namespace/) + +## Attributes + +- [x] ✅ Recommended +- [ ] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-non-null-asserted-nullish-coalescing.md b/packages/eslint-plugin/docs/rules/no-non-null-asserted-nullish-coalescing.md new file mode 100644 index 000000000000..2eb8ff2585d6 --- /dev/null +++ b/packages/eslint-plugin/docs/rules/no-non-null-asserted-nullish-coalescing.md @@ -0,0 +1,55 @@ +# Disallows using a non-null assertion in the left operand of the nullish coalescing operator (`no-non-null-asserted-nullish-coalescing`) + +## Rule Details + +The nullish coalescing operator is designed to provide a default value when dealing with `null` or `undefined`. +Using non-null assertions in the left operand of the nullish coalescing operator is redundant. + +Examples of **incorrect** code for this rule: + +```ts +/* eslint @typescript-eslint/no-non-null-asserted-nullish-coalescing: "error" */ + +foo! ?? bar; +foo.bazz! ?? bar; +foo!.bazz! ?? bar; +foo()! ?? bar; + +let x!: string; +x! ?? ''; + +let x: string; +x = foo(); +x! ?? ''; +``` + +Examples of **correct** code for this rule: + +```ts +/* eslint @typescript-eslint/no-non-null-asserted-nullish-coalescing: "error" */ + +foo ?? bar; +foo ?? bar!; +foo!.bazz ?? bar; +foo!.bazz ?? bar!; +foo() ?? bar; + +// This is considered correct code because there's no way for the user to satisfy it. +let x: string; +x! ?? ''; +``` + +## When Not To Use It + +If you are not using TypeScript 3.7 (or greater), then you will not need to use this rule, as the nullish coalescing operator is not supported. + +## Further Reading + +- [TypeScript 3.7 Release Notes](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html) +- [Nullish Coalescing Proposal](https://github.com/tc39/proposal-nullish-coalescing) + +## Attributes + +- [ ] ✅ Recommended +- [ ] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-non-null-asserted-optional-chain.md b/packages/eslint-plugin/docs/rules/no-non-null-asserted-optional-chain.md index fdb2a8a18f08..16a22b480358 100644 --- a/packages/eslint-plugin/docs/rules/no-non-null-asserted-optional-chain.md +++ b/packages/eslint-plugin/docs/rules/no-non-null-asserted-optional-chain.md @@ -46,3 +46,9 @@ If you are not using TypeScript 3.7 (or greater), then you will not need to use - [TypeScript 3.7 Release Notes](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html) - [Optional Chaining Proposal](https://github.com/tc39/proposal-optional-chaining/) + +## Attributes + +- [x] ✅ Recommended +- [ ] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-non-null-assertion.md b/packages/eslint-plugin/docs/rules/no-non-null-assertion.md index 04de5768628e..1eaebff625cc 100644 --- a/packages/eslint-plugin/docs/rules/no-non-null-assertion.md +++ b/packages/eslint-plugin/docs/rules/no-non-null-assertion.md @@ -33,3 +33,9 @@ If you don't care about strict null-checking, then you will not need this rule. ## Further Reading - [`no-non-null-assertion`](https://palantir.github.io/tslint/rules/no-non-null-assertion/) in [TSLint](https://palantir.github.io/tslint/) + +## Attributes + +- [x] ✅ Recommended +- [ ] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-parameter-properties.md b/packages/eslint-plugin/docs/rules/no-parameter-properties.md index bb2fd2691967..6bde9296b5be 100644 --- a/packages/eslint-plugin/docs/rules/no-parameter-properties.md +++ b/packages/eslint-plugin/docs/rules/no-parameter-properties.md @@ -365,3 +365,9 @@ If you don't care about the using parameter properties in constructors, then you ## Compatibility - TSLint: [no-parameter-properties](https://palantir.github.io/tslint/rules/no-parameter-properties/) + +## Attributes + +- [ ] ✅ Recommended +- [ ] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-redeclare.md b/packages/eslint-plugin/docs/rules/no-redeclare.md index 4b5164d6f0e0..98a4cf78ba3a 100644 --- a/packages/eslint-plugin/docs/rules/no-redeclare.md +++ b/packages/eslint-plugin/docs/rules/no-redeclare.md @@ -41,6 +41,7 @@ When set to `true`, the rule will ignore declaration merges between the followin - class + namespace - class + interface + namespace - function + namespace +- enum + namespace Examples of **correct** code with `{ ignoreDeclarationMerge: true }`: @@ -77,3 +78,9 @@ const something = 2; ``` Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/no-redeclare.md) + +## Attributes + +- [ ] ✅ Recommended +- [ ] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-require-imports.md b/packages/eslint-plugin/docs/rules/no-require-imports.md index 655fc57bd60a..2bc3eca93f97 100644 --- a/packages/eslint-plugin/docs/rules/no-require-imports.md +++ b/packages/eslint-plugin/docs/rules/no-require-imports.md @@ -32,3 +32,9 @@ If you don't care about TypeScript module syntax, then you will not need this ru ## Compatibility - TSLint: [no-require-imports](https://palantir.github.io/tslint/rules/no-require-imports/) + +## Attributes + +- [ ] ✅ Recommended +- [ ] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-restricted-imports.md b/packages/eslint-plugin/docs/rules/no-restricted-imports.md new file mode 100644 index 000000000000..359cfd4f084f --- /dev/null +++ b/packages/eslint-plugin/docs/rules/no-restricted-imports.md @@ -0,0 +1,70 @@ +# Disallow specified modules when loaded by `import` (`no-restricted-imports`) + +## Rule Details + +This rule extends the base [`eslint/no-restricted-imports`](https://eslint.org/docs/rules/no-restricted-imports) rule. + +## How to use + +```jsonc +{ + // note you must disable the base rule as it can report incorrect errors + "no-restricted-imports": "off", + "@typescript-eslint/no-restricted-imports": "off" +} +``` + +## Options + +See [`eslint/no-restricted-imports` options](https://eslint.org/docs/rules/no-restricted-imports#options). +This rule adds the following options: + +### `allowTypeImports` + +(default: `false`) + +You can specify this option for a specific path or pattern as follows: + +```jsonc +"@typescript-eslint/no-restricted-imports": ["error", { + "paths": [{ + "name": "import-foo", + "message": "Please use import-bar instead.", + "allowTypeImports": true + }, { + "name": "import-baz", + "message": "Please use import-quux instead.", + "allowTypeImports": true + }] +}] +``` + +When set to `true`, the rule will allow [Type-Only Imports](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export). + +Examples of **correct** code with the above config: + +```ts +import { foo } from 'other-module'; + +import type foo from 'import-foo'; +export type { Foo } from 'import-foo'; + +import type baz from 'import-baz'; +export type { Baz } from 'import-baz'; +``` + +Example of **incorrect** code with the above config: + +```ts +import foo from 'import-foo'; +export { Foo } from 'import-foo'; + +import baz from 'import-baz'; +export { Baz } from 'import-baz'; +``` + +## Attributes + +- [ ] ✅ Recommended +- [ ] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-shadow.md b/packages/eslint-plugin/docs/rules/no-shadow.md index bcb40d4fb5a0..681ac7b25616 100644 --- a/packages/eslint-plugin/docs/rules/no-shadow.md +++ b/packages/eslint-plugin/docs/rules/no-shadow.md @@ -85,3 +85,9 @@ type Func = (test: string) => typeof test; ``` Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/no-shadow.md) + +## Attributes + +- [ ] ✅ Recommended +- [ ] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-this-alias.md b/packages/eslint-plugin/docs/rules/no-this-alias.md index 324929e52c2b..67cb36df2e4a 100644 --- a/packages/eslint-plugin/docs/rules/no-this-alias.md +++ b/packages/eslint-plugin/docs/rules/no-this-alias.md @@ -44,7 +44,7 @@ You can pass an object option: "@typescript-eslint/no-this-alias": [ "error", { - "allowDestructuring": true, // Allow `const { props, state } = this`; false by default + "allowDestructuring": false, // Disallow `const { props, state } = this`; true by default "allowedNames": ["self"] // Allow `const self = this`; `[]` by default } ] @@ -58,3 +58,9 @@ If you need to assign `this` to variables, you shouldn’t use this rule. ## Related to - TSLint: [`no-this-assignment`](https://palantir.github.io/tslint/rules/no-this-assignment/) + +## Attributes + +- [x] ✅ Recommended +- [ ] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-throw-literal.md b/packages/eslint-plugin/docs/rules/no-throw-literal.md index 0b89f10e9276..a67d422cdc43 100644 --- a/packages/eslint-plugin/docs/rules/no-throw-literal.md +++ b/packages/eslint-plugin/docs/rules/no-throw-literal.md @@ -92,3 +92,9 @@ throw new CustomError(); --- Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/no-throw-literal.md) + +## Attributes + +- [ ] ✅ Recommended +- [ ] 🔧 Fixable +- [x] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-type-alias.md b/packages/eslint-plugin/docs/rules/no-type-alias.md index 5b720b2f331d..a915516d065b 100644 --- a/packages/eslint-plugin/docs/rules/no-type-alias.md +++ b/packages/eslint-plugin/docs/rules/no-type-alias.md @@ -89,6 +89,7 @@ or more of the following you may pass an object with the options set as follows: - `allowLiterals` set to `"always"` will allow you to use type aliases with literal objects (Defaults to `"never"`) - `allowMappedTypes` set to `"always"` will allow you to use type aliases as mapping tools (Defaults to `"never"`) - `allowTupleTypes` set to `"always"` will allow you to use type aliases with tuples (Defaults to `"never"`) +- `allowGenerics` set to `"always"` will allow you to use type aliases with generics (Defaults to `"never"`) ### `allowAliases` @@ -405,8 +406,9 @@ type Foo = type Foo = { [P in keyof T]?: T[P] } | { [P in keyof U]?: U[P] }; -type Foo = { readonly [P in keyof T]: T[P] } & - { readonly [P in keyof U]: U[P] }; +type Foo = { readonly [P in keyof T]: T[P] } & { + readonly [P in keyof U]: U[P]; +}; type Foo = { [P in keyof T]?: T[P] } & { [P in keyof U]?: U[P] }; ``` @@ -418,8 +420,9 @@ type Foo = { readonly [P in keyof T]: T[P] }; type Foo = { [P in keyof T]?: T[P] }; -type Foo = { readonly [P in keyof T]: T[P] } & - { readonly [P in keyof U]: U[P] }; +type Foo = { readonly [P in keyof T]: T[P] } & { + readonly [P in keyof U]: U[P]; +}; type Foo = { [P in keyof T]?: T[P] } & { [P in keyof U]?: U[P] }; ``` @@ -451,8 +454,9 @@ type Foo = { [P in keyof T]?: T[P] } | { [P in keyof U]?: U[P] }; Examples of **correct** code for the `{ "allowMappedTypes": "in-intersections" }` option: ```ts -type Foo = { readonly [P in keyof T]: T[P] } & - { readonly [P in keyof U]: U[P] }; +type Foo = { readonly [P in keyof T]: T[P] } & { + readonly [P in keyof U]: U[P]; +}; type Foo = { [P in keyof T]?: T[P] } & { [P in keyof U]?: U[P] }; ``` @@ -474,8 +478,9 @@ type Foo = type Foo = { [P in keyof T]?: T[P] } | { [P in keyof U]?: U[P] }; -type Foo = { readonly [P in keyof T]: T[P] } & - { readonly [P in keyof U]: U[P] }; +type Foo = { readonly [P in keyof T]: T[P] } & { + readonly [P in keyof U]: U[P]; +}; type Foo = { [P in keyof T]?: T[P] } & { [P in keyof U]?: U[P] }; ``` @@ -555,6 +560,28 @@ type Foo = [number] & [number, number]; type Foo = [string] | [number]; ``` +### `allowGenerics` + +This applies to generic types, including TypeScript provided global utility types (`type Foo = Record`). + +The setting accepts the following options: + +- `"always"` or `"never"` to active or deactivate the feature. + +Examples of **correct** code for the `{ "allowGenerics": "always" }` options: + +```ts +type Foo = Bar; + +type Foo = Record; + +type Foo = Readonly; + +type Foo = Partial; + +type Foo = Omit; +``` + ## When Not To Use It When you can't express some shape with an interface or you need to use a union, tuple type, @@ -567,3 +594,9 @@ callback, etc. that would cause the code to be unreadable or impractical. ## Related to - TSLint: [interface-over-type-literal](https://palantir.github.io/tslint/rules/interface-over-type-literal/) + +## Attributes + +- [ ] ✅ Recommended +- [ ] 🔧 Fixable +- [ ] 💭 Requires type information 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 972b48a3bde0..f39f663ddfb4 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 @@ -124,10 +124,10 @@ if (!(someNullCondition ?? true)) { | Comparison | Fixer Output | Notes | | :----------------------------: | ------------------------------- | ----------------------------------------------------------------------------------- | -| `booleanVar === true` | `booleanLiteral` | | -| `booleanVar !== true` | `!booleanLiteral` | | -| `booleanVar === false` | `!booleanLiteral` | | -| `booleanVar !== false` | `booleanLiteral` | | +| `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` | @@ -136,3 +136,9 @@ if (!(someNullCondition ?? true)) { ## Related to - TSLint: [no-boolean-literal-compare](https://palantir.github.io/tslint/rules/no-boolean-literal-compare) + +## Attributes + +- [ ] ✅ Recommended +- [x] 🔧 Fixable +- [x] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-unnecessary-condition.md b/packages/eslint-plugin/docs/rules/no-unnecessary-condition.md index bff0f548f50e..0dda0b0d8b2b 100644 --- a/packages/eslint-plugin/docs/rules/no-unnecessary-condition.md +++ b/packages/eslint-plugin/docs/rules/no-unnecessary-condition.md @@ -105,3 +105,9 @@ The main downside to using this rule is the need for type information. - ESLint: [no-constant-condition](https://eslint.org/docs/rules/no-constant-condition) - `no-unnecessary-condition` is essentially a stronger version of `no-constant-condition`, but requires type information. - [strict-boolean-expressions](./strict-boolean-expressions.md) - a more opinionated version of `no-unnecessary-condition`. `strict-boolean-expressions` enforces a specific code style, while `no-unnecessary-condition` is about correctness. + +## Attributes + +- [ ] ✅ Recommended +- [x] 🔧 Fixable +- [x] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-unnecessary-qualifier.md b/packages/eslint-plugin/docs/rules/no-unnecessary-qualifier.md index 56aba181cbae..2983307bbdb0 100644 --- a/packages/eslint-plugin/docs/rules/no-unnecessary-qualifier.md +++ b/packages/eslint-plugin/docs/rules/no-unnecessary-qualifier.md @@ -77,3 +77,9 @@ If you don't care about having unneeded namespace or enum qualifiers, then you d ## Further Reading - TSLint: [no-unnecessary-qualifier](https://palantir.github.io/tslint/rules/no-unnecessary-qualifier/) + +## Attributes + +- [ ] ✅ Recommended +- [x] 🔧 Fixable +- [x] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-unnecessary-type-arguments.md b/packages/eslint-plugin/docs/rules/no-unnecessary-type-arguments.md index f5caaa42cdfa..83d1041974d7 100644 --- a/packages/eslint-plugin/docs/rules/no-unnecessary-type-arguments.md +++ b/packages/eslint-plugin/docs/rules/no-unnecessary-type-arguments.md @@ -51,3 +51,9 @@ class Impl implements I {} ## Related to - TSLint: [use-default-type-parameter](https://palantir.github.io/tslint/rules/use-default-type-parameter) + +## Attributes + +- [ ] ✅ Recommended +- [x] 🔧 Fixable +- [x] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-unnecessary-type-assertion.md b/packages/eslint-plugin/docs/rules/no-unnecessary-type-assertion.md index 4464b6483ef1..cfca8f20b1c3 100644 --- a/packages/eslint-plugin/docs/rules/no-unnecessary-type-assertion.md +++ b/packages/eslint-plugin/docs/rules/no-unnecessary-type-assertion.md @@ -70,4 +70,10 @@ If you don't care about having no-op type assertions in your code, then you can ## Related to -- TSLint: ['no-unnecessary-type-assertion`](https://palantir.github.io/tslint/rules/no-unnecessary-type-assertion/) +- TSLint: [`no-unnecessary-type-assertion`](https://palantir.github.io/tslint/rules/no-unnecessary-type-assertion/) + +## Attributes + +- [x] ✅ Recommended +- [x] 🔧 Fixable +- [x] 💭 Requires type information 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 8656ace566e3..dd0d5025f9ad 100644 --- a/packages/eslint-plugin/docs/rules/no-unnecessary-type-constraint.md +++ b/packages/eslint-plugin/docs/rules/no-unnecessary-type-constraint.md @@ -53,3 +53,9 @@ function Quuz() {} ## When Not To Use It If you don't care about the specific styles of your type constraints, or never use them in the first place, then you will not need this rule. + +## Attributes + +- [x] ✅ Recommended +- [x] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-unsafe-argument.md b/packages/eslint-plugin/docs/rules/no-unsafe-argument.md new file mode 100644 index 000000000000..a197ff65cab5 --- /dev/null +++ b/packages/eslint-plugin/docs/rules/no-unsafe-argument.md @@ -0,0 +1,75 @@ +# Disallows calling a function with an any type value (`no-unsafe-argument`) + +Despite your best intentions, the `any` type can sometimes leak into your codebase. +Call a function with `any` typed argument are not checked at all by TypeScript, so it creates a potential safety hole, and source of bugs in your codebase. + +## Rule Details + +This rule disallows calling a function with `any` in its arguments, and it will disallow spreading `any[]`. +This rule also disallows spreading a tuple type with one of its elements typed as `any`. +This rule also compares the argument's type to the variable's type to ensure you don't pass an unsafe `any` in a generic position to a receiver that's expecting a specific type. For example, it will error if you assign `Set` to an argument declared as `Set`. + +Examples of **incorrect** code for this rule: + +```ts +declare function foo(arg1: string, arg2: number, arg2: string): void; + +const anyTyped = 1 as any; + +foo(...anyTyped); +foo(anyTyped, 1, 'a'); + +const anyArray: any[] = []; +foo(...anyArray); + +const tuple1 = ['a', anyTyped, 'b'] as const; +foo(...tuple1); + +const tuple2 = [1] as const; +foo('a', ...tuple, anyTyped); + +declare function bar(arg1: string, arg2: number, ...rest: string[]): void; +const x = [1, 2] as [number, ...number[]]; +foo('a', ...x, anyTyped); + +declare function baz(arg1: Set, arg2: Map): void; +foo(new Set(), new Map()); +``` + +Examples of **correct** code for this rule: + +```ts +declare function foo(arg1: string, arg2: number, arg2: string): void; + +foo('a', 1, 'b'); + +const tuple1 = ['a', 1, 'b'] as const; +foo(...tuple1); + +declare function bar(arg1: string, arg2: number, ...rest: string[]): void; +const array: string[] = ['a']; +bar('a', 1, ...array); + +declare function baz(arg1: Set, arg2: Map): void; +foo(new Set(), new Map()); +``` + +There are cases where the rule allows passing an argument of `any` to `unknown`. + +Example of `any` to `unknown` assignment that are allowed. + +```ts +declare function foo(arg1: unknown, arg2: Set, arg3: unknown[]): void; +foo(1 as any, new Set(), [] as any[]); +``` + +## Related to + +- [`no-explicit-any`](./no-explicit-any.md) +- TSLint: [`no-unsafe-any`](https://palantir.github.io/tslint/rules/no-unsafe-any/) + +## Attributes + +- [x] ✅ Recommended +- [ ] 🔧 Fixable +- [x] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-unsafe-assignment.md b/packages/eslint-plugin/docs/rules/no-unsafe-assignment.md index 64207e5365ec..36542927eed0 100644 --- a/packages/eslint-plugin/docs/rules/no-unsafe-assignment.md +++ b/packages/eslint-plugin/docs/rules/no-unsafe-assignment.md @@ -70,3 +70,9 @@ const x: Set = y as Set; - [`no-explicit-any`](./no-explicit-any.md) - TSLint: [`no-unsafe-any`](https://palantir.github.io/tslint/rules/no-unsafe-any/) + +## Attributes + +- [x] ✅ Recommended +- [ ] 🔧 Fixable +- [x] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-unsafe-call.md b/packages/eslint-plugin/docs/rules/no-unsafe-call.md index 1000e5921b8c..0dfb019bbaea 100644 --- a/packages/eslint-plugin/docs/rules/no-unsafe-call.md +++ b/packages/eslint-plugin/docs/rules/no-unsafe-call.md @@ -46,3 +46,9 @@ String.raw`foo`; - [`no-explicit-any`](./no-explicit-any.md) - TSLint: [`no-unsafe-any`](https://palantir.github.io/tslint/rules/no-unsafe-any/) + +## Attributes + +- [x] ✅ Recommended +- [ ] 🔧 Fixable +- [x] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-unsafe-member-access.md b/packages/eslint-plugin/docs/rules/no-unsafe-member-access.md index e64294f4e990..39c982d5debc 100644 --- a/packages/eslint-plugin/docs/rules/no-unsafe-member-access.md +++ b/packages/eslint-plugin/docs/rules/no-unsafe-member-access.md @@ -52,3 +52,9 @@ arr[idx++]; - [`no-explicit-any`](./no-explicit-any.md) - TSLint: [`no-unsafe-any`](https://palantir.github.io/tslint/rules/no-unsafe-any/) + +## Attributes + +- [x] ✅ Recommended +- [ ] 🔧 Fixable +- [x] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-unsafe-return.md b/packages/eslint-plugin/docs/rules/no-unsafe-return.md index 9810be3cf16f..e089757a1771 100644 --- a/packages/eslint-plugin/docs/rules/no-unsafe-return.md +++ b/packages/eslint-plugin/docs/rules/no-unsafe-return.md @@ -1,7 +1,7 @@ # Disallows returning any from a function (`no-unsafe-return`) Despite your best intentions, the `any` type can sometimes leak into your codebase. -Returned `any` typed values not checked at all by TypeScript, so it creates a potential safety hole, and source of bugs in your codebase. +Returned `any` typed values are not checked at all by TypeScript, so it creates a potential safety hole, and source of bugs in your codebase. ## Rule Details @@ -87,3 +87,9 @@ function foo2(): unknown[] { - [`no-explicit-any`](./no-explicit-any.md) - TSLint: [`no-unsafe-any`](https://palantir.github.io/tslint/rules/no-unsafe-any/) + +## Attributes + +- [x] ✅ Recommended +- [ ] 🔧 Fixable +- [x] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-unused-expressions.md b/packages/eslint-plugin/docs/rules/no-unused-expressions.md index cb61c2ed0409..760fca411932 100644 --- a/packages/eslint-plugin/docs/rules/no-unused-expressions.md +++ b/packages/eslint-plugin/docs/rules/no-unused-expressions.md @@ -20,3 +20,9 @@ It adds support for optional call expressions `x?.()`, and directive in module d See [`eslint/no-unused-expressions` options](https://eslint.org/docs/rules/no-unused-expressions#options). Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/no-unused-expressions.md) + +## Attributes + +- [ ] ✅ Recommended +- [ ] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-unused-vars-experimental.md b/packages/eslint-plugin/docs/rules/no-unused-vars-experimental.md deleted file mode 100644 index 918cbc595f5d..000000000000 --- a/packages/eslint-plugin/docs/rules/no-unused-vars-experimental.md +++ /dev/null @@ -1,115 +0,0 @@ -# Disallow unused variables and arguments (`no-unused-vars-experimental`) - -Variables that are declared and not used anywhere in the code are most likely an error due to incomplete refactoring. Such variables take up space in the code and can lead to confusion by readers. - -## Rule Details - -This rule leverages the TypeScript compiler's unused variable checks to report. This means that with all rule options set to `false`, it should report the same errors as if you used both the `noUnusedLocals` and `noUnusedParameters` compiler options. - -This rule is vastly different to, and maintains no compatibility with the base ESLint version of the rule. - -### Limitations - -There are two limitations to this rule when compared with ESLint's `no-unused-vars` rule, which are imposed by the fact that it directly uses TypeScript's implementation. - -1. This rule only works on files that TypeScript deems is a module (i.e. it has an `import` or an `export` statement). -2. The rule is significantly less configurable, as it cannot deviate too far from the base implementation. - -## Supported Nodes - -This rule supports checks on the following features: - -- Declarations: - - `var` / `const` / `let` - - `function` - - `class` - - `enum` - - `interface` - - `type` -- Class methods -- Class properties and parameter properties -- Function parameters -- Generic type parameters -- Import statements - -## Options - -```ts -type Options = { - ignoredNamesRegex?: string | boolean; - ignoreArgsIfArgsAfterAreUsed?: boolean; -}; - -const defaultOptions: Options = { - ignoredNamesRegex: '^_', - ignoreArgsIfArgsAfterAreUsed: false, -}; -``` - -### `ignoredNamesRegex` - -This option accepts a regex string to match names against. -Any matched names will be ignored and have no errors reported. -If you set it to false, it will never ignore any names. - -The default value is `'^_'` (i.e. matches any name prefixed with an underscore). - -Examples of valid code with `{ variables: { ignoredNamesRegex: '^_' } }`. - -```ts -const _unusedVar = 'unused'; -class _Unused { - private _unused = 1; - private _unusedMethod() {} -} -function _unusedFunction() {} -enum _UnusedEnum { - a = 1, -} -interface _UnusedInterface {} -type _UnusedType = {}; -``` - -**_NOTE:_** The TypeScript compiler automatically ignores imports, function arguments, type parameter declarations, and object destructuring variables prefixed with an underscore. -As this is hard-coded into the compiler, we cannot change this. - -Examples of valid code based on the unchangeable compiler settings - -```ts -import _UnusedDefault, { _UnusedNamed } from 'foo'; -export function foo(_unusedProp: string) {} -export class Foo<_UnusedGeneric> {} -const { prop: _unusedDestructure } = foo; -``` - -## `ignoreArgsIfArgsAfterAreUsed` - -When true, this option will ignore unused function arguments if the arguments proceeding arguments are used. - -Examples of invalid code with `{ ignoreArgsIfArgsAfterAreUsed: false }` - -```ts -function foo(unused: string, used: number) { - console.log(used); -} - -class Foo { - constructor(unused: string, public used: number) { - console.log(used); - } -} -``` - -Examples of valid code with `{ ignoreArgsIfArgsAfterAreUsed: true }` - -```ts -function foo(unused: string, used: number) { - console.log(used); -} - -class Foo { - constructor(unused: string, public used: number) { - console.log(used); - } -} -``` diff --git a/packages/eslint-plugin/docs/rules/no-unused-vars.md b/packages/eslint-plugin/docs/rules/no-unused-vars.md index 5eaf167a379a..0878d325c1ef 100644 --- a/packages/eslint-plugin/docs/rules/no-unused-vars.md +++ b/packages/eslint-plugin/docs/rules/no-unused-vars.md @@ -20,3 +20,9 @@ It adds support for TypeScript features, such as types. See [`eslint/no-unused-vars` options](https://eslint.org/docs/rules/no-unused-vars#options). Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/no-unused-vars.md) + +## Attributes + +- [x] ✅ Recommended +- [ ] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-use-before-define.md b/packages/eslint-plugin/docs/rules/no-use-before-define.md index dfdab4d60f70..c6344fb04efc 100644 --- a/packages/eslint-plugin/docs/rules/no-use-before-define.md +++ b/packages/eslint-plugin/docs/rules/no-use-before-define.md @@ -1,7 +1,5 @@ # Disallow the use of variables before they are defined (`no-use-before-define`) -## PLEASE READ THIS ISSUE BEFORE USING THIS RULE [#1856](https://github.com/typescript-eslint/typescript-eslint/issues/1856) - ## Rule Details This rule extends the base [`eslint/no-use-before-define`](https://eslint.org/docs/rules/no-use-before-define) rule. @@ -42,10 +40,10 @@ const defaultOptions: Options = { If this is `true`, this rule warns every reference to a enum before the enum declaration. If this is `false`, this rule will ignore references to enums, when the reference is in a child scope. -Examples of **incorrect** code for the `{ "enums": false }` option: +Examples of **incorrect** code for the `{ "enums": true }` option: ```ts -/*eslint no-use-before-define: ["error", { "enums": false }]*/ +/*eslint no-use-before-define: ["error", { "enums": true }]*/ const x = Foo.FOO; @@ -104,3 +102,9 @@ enum Enum {} See [`eslint/no-use-before-define` options](https://eslint.org/docs/rules/no-use-before-define#options). Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/no-use-before-define.md) + +## Attributes + +- [ ] ✅ Recommended +- [ ] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-useless-constructor.md b/packages/eslint-plugin/docs/rules/no-useless-constructor.md index 524ad4b92d9c..bca548db536c 100644 --- a/packages/eslint-plugin/docs/rules/no-useless-constructor.md +++ b/packages/eslint-plugin/docs/rules/no-useless-constructor.md @@ -24,3 +24,9 @@ It adds support for: See [`eslint/no-useless-constructor` options](https://eslint.org/docs/rules/no-useless-constructor#options). Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/no-useless-constructor.md) + +## Attributes + +- [ ] ✅ Recommended +- [ ] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/no-var-requires.md b/packages/eslint-plugin/docs/rules/no-var-requires.md index 104a54943cda..19373a892838 100644 --- a/packages/eslint-plugin/docs/rules/no-var-requires.md +++ b/packages/eslint-plugin/docs/rules/no-var-requires.md @@ -27,3 +27,9 @@ If you don't care about TypeScript module syntax, then you will not need this ru ## Compatibility - TSLint: [no-var-requires](https://palantir.github.io/tslint/rules/no-var-requires/) + +## Attributes + +- [x] ✅ Recommended +- [ ] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/non-nullable-type-assertion-style.md b/packages/eslint-plugin/docs/rules/non-nullable-type-assertion-style.md index 473f83b0a9bf..a152ee122058 100644 --- a/packages/eslint-plugin/docs/rules/non-nullable-type-assertion-style.md +++ b/packages/eslint-plugin/docs/rules/non-nullable-type-assertion-style.md @@ -25,3 +25,9 @@ const alsoDefinitely = maybe!; ## When Not To Use It If you don't mind having unnecessarily verbose type casts, you can avoid this rule. + +## Attributes + +- [ ] ✅ Recommended +- [x] 🔧 Fixable +- [x] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/object-curly-spacing.md b/packages/eslint-plugin/docs/rules/object-curly-spacing.md index 44bd35afb592..7fec0a164936 100644 --- a/packages/eslint-plugin/docs/rules/object-curly-spacing.md +++ b/packages/eslint-plugin/docs/rules/object-curly-spacing.md @@ -20,3 +20,9 @@ It adds support for TypeScript's object types. See [`eslint/object-curly-spacing` options](https://eslint.org/docs/rules/object-curly-spacing#options). Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/object-curly-spacing.md) + +## Attributes + +- [ ] ✅ Recommended +- [x] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/padding-line-between-statements.md b/packages/eslint-plugin/docs/rules/padding-line-between-statements.md new file mode 100644 index 000000000000..bce407ea4410 --- /dev/null +++ b/packages/eslint-plugin/docs/rules/padding-line-between-statements.md @@ -0,0 +1,54 @@ +# require or disallow padding lines between statements (`padding-line-between-statements`) + +## Rule Details + +This rule extends the base [`eslint/padding-line-between-statements`](https://eslint.org/docs/rules/padding-line-between-statements) rule. + +**It adds support for TypeScript constructs such as `interface` and `type`.** + +## How to use + +```jsonc +{ + // note you must disable the base rule as it can report incorrect errors + "padding-line-between-statements": "off", + "@typescript-eslint/padding-line-between-statements": [ + "error", + { + "blankLine": "always", + "prev": "var", + "next": "return" + } + ] +} +``` + +```jsonc +{ + // Example - Add blank lines before interface and type definitions. + // note you must disable the base rule as it can report incorrect errors + "padding-line-between-statements": "off", + "@typescript-eslint/padding-line-between-statements": [ + "error", + { + "blankLine": "always", + "prev": "*", + "next": ["interface", "type"] + } + ] +} +``` + +## Options + +See [`eslint/padding-line-between-statements` options](https://eslint.org/docs/rules/padding-line-between-statements#options). + +**Note** - In addition to options provided by ESLint, we have also added options for `interface` and `type`. + +Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/padding-line-between-statements.md) + +## Attributes + +- [ ] ✅ Recommended +- [x] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/prefer-as-const.md b/packages/eslint-plugin/docs/rules/prefer-as-const.md index b710a8275e7a..94c21dac9d0d 100644 --- a/packages/eslint-plugin/docs/rules/prefer-as-const.md +++ b/packages/eslint-plugin/docs/rules/prefer-as-const.md @@ -26,3 +26,9 @@ let foo = { bar: 'baz' }; ## When Not To Use It If you are using TypeScript < 3.4 + +## Attributes + +- [x] ✅ Recommended +- [x] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/prefer-enum-initializers.md b/packages/eslint-plugin/docs/rules/prefer-enum-initializers.md index 1e8f568d721f..b7aeb21a772f 100644 --- a/packages/eslint-plugin/docs/rules/prefer-enum-initializers.md +++ b/packages/eslint-plugin/docs/rules/prefer-enum-initializers.md @@ -68,3 +68,9 @@ enum Color { ## When Not To Use It If you don't care about `enum`s having implicit values you can safely disable this rule. + +## Attributes + +- [ ] ✅ Recommended +- [ ] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/prefer-for-of.md b/packages/eslint-plugin/docs/rules/prefer-for-of.md index 0b1e5570d757..919531136a47 100644 --- a/packages/eslint-plugin/docs/rules/prefer-for-of.md +++ b/packages/eslint-plugin/docs/rules/prefer-for-of.md @@ -39,3 +39,9 @@ If you transpile for browsers that do not support for-of loops, you may wish to ## Related to - TSLint: ['prefer-for-of'](https://palantir.github.io/tslint/rules/prefer-for-of/) + +## Attributes + +- [ ] ✅ Recommended +- [ ] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/prefer-function-type.md b/packages/eslint-plugin/docs/rules/prefer-function-type.md index 5c3bc55c9f2c..007f3baa01a0 100644 --- a/packages/eslint-plugin/docs/rules/prefer-function-type.md +++ b/packages/eslint-plugin/docs/rules/prefer-function-type.md @@ -79,3 +79,9 @@ If you specifically want to use an interface or type literal with a single call ## Further Reading - TSLint: [`callable-types`](https://palantir.github.io/tslint/rules/callable-types/) + +## Attributes + +- [ ] ✅ Recommended +- [x] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/prefer-includes.md b/packages/eslint-plugin/docs/rules/prefer-includes.md index 07cc9ea44e12..29c37563fd40 100644 --- a/packages/eslint-plugin/docs/rules/prefer-includes.md +++ b/packages/eslint-plugin/docs/rules/prefer-includes.md @@ -22,6 +22,7 @@ let str: string; let array: any[]; let readonlyArray: ReadonlyArray; let typedArray: UInt8Array; +let maybe: string; let userDefined: { indexOf(x: any): number; includes(x: any): boolean; @@ -31,6 +32,7 @@ str.indexOf(value) !== -1; array.indexOf(value) !== -1; readonlyArray.indexOf(value) === -1; typedArray.indexOf(value) > -1; +maybe?.indexOf('') !== -1; userDefined.indexOf(value) >= 0; // simple RegExp test @@ -69,3 +71,9 @@ There are no options. ## When Not To Use It If you don't want to suggest `includes`, you can safely turn this rule off. + +## Attributes + +- [ ] ✅ Recommended +- [x] 🔧 Fixable +- [x] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/prefer-literal-enum-member.md b/packages/eslint-plugin/docs/rules/prefer-literal-enum-member.md index e2350f357113..94891c46235c 100644 --- a/packages/eslint-plugin/docs/rules/prefer-literal-enum-member.md +++ b/packages/eslint-plugin/docs/rules/prefer-literal-enum-member.md @@ -21,6 +21,10 @@ The answer is that `Foo.c` will be `1` at runtime. The [playground](https://www. This rule is meant to prevent unexpected results in code by requiring the use of literal values as enum members to prevent unexpected runtime behavior. Template literals, arrays, objects, constructors, and all other expression types can end up using a variable from its scope or the parent scope, which can result in the same unexpected behavior at runtime. +## Options + +- `allowBitwiseExpressions` set to `true` will allow you to use bitwise expressions in enum initializer (Default: `false`). + Examples of **incorrect** code for this rule: ```ts @@ -46,6 +50,43 @@ enum Valid { } ``` +### `allowBitwiseExpressions` + +Examples of **incorrect** code for the `{ "allowBitwiseExpressions": true }` option: + +```ts +const x = 1; +enum Foo { + A = x << 0, + B = x >> 0, + C = x >>> 0, + D = x | 0, + E = x & 0, + F = x ^ 0, + G = ~x, +} +``` + +Examples of **correct** code for the `{ "allowBitwiseExpressions": true }` option: + +```ts +enum Foo { + A = 1 << 0, + B = 1 >> 0, + C = 1 >>> 0, + D = 1 | 0, + E = 1 & 0, + F = 1 ^ 0, + G = ~1, +} +``` + ## When Not To Use It If you want use anything other than simple literals as an enum value. + +## Attributes + +- [ ] ✅ Recommended +- [ ] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/prefer-namespace-keyword.md b/packages/eslint-plugin/docs/rules/prefer-namespace-keyword.md index faeeaadf8c58..4723cbd06f6d 100644 --- a/packages/eslint-plugin/docs/rules/prefer-namespace-keyword.md +++ b/packages/eslint-plugin/docs/rules/prefer-namespace-keyword.md @@ -20,3 +20,9 @@ If you are using the ES2015 module syntax, then you will not need this rule. ## Compatibility - TSLint: [no-internal-module](https://palantir.github.io/tslint/rules/no-internal-module/) + +## Attributes + +- [x] ✅ Recommended +- [x] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/prefer-nullish-coalescing.md b/packages/eslint-plugin/docs/rules/prefer-nullish-coalescing.md index bb32c02895be..feb7735ddc83 100644 --- a/packages/eslint-plugin/docs/rules/prefer-nullish-coalescing.md +++ b/packages/eslint-plugin/docs/rules/prefer-nullish-coalescing.md @@ -139,3 +139,9 @@ If you are not using TypeScript 3.7 (or greater), then you will not be able to u - [TypeScript 3.7 Release Notes](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html) - [Nullish Coalescing Operator Proposal](https://github.com/tc39/proposal-nullish-coalescing/) + +## Attributes + +- [ ] ✅ Recommended +- [ ] 🔧 Fixable +- [x] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/prefer-optional-chain.md b/packages/eslint-plugin/docs/rules/prefer-optional-chain.md index 6505c93959a6..22c596b4375d 100644 --- a/packages/eslint-plugin/docs/rules/prefer-optional-chain.md +++ b/packages/eslint-plugin/docs/rules/prefer-optional-chain.md @@ -80,3 +80,9 @@ If you are not using TypeScript 3.7 (or greater), then you will not be able to u - [TypeScript 3.7 Release Notes](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html) - [Optional Chaining Proposal](https://github.com/tc39/proposal-optional-chaining/) + +## Attributes + +- [ ] ✅ Recommended +- [ ] 🔧 Fixable +- [ ] 💭 Requires type information 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 34544456f09e..b6a57c4b0692 100644 --- a/packages/eslint-plugin/docs/rules/prefer-readonly-parameter-types.md +++ b/packages/eslint-plugin/docs/rules/prefer-readonly-parameter-types.md @@ -130,6 +130,7 @@ interface Options { const defaultOptions: Options = { checkParameterProperties: true, ignoreInferredTypes: false, + treatMethodsAsReadonly: false, }; ``` @@ -214,3 +215,49 @@ export const acceptsCallback: AcceptsCallback; ``` + +### `treatMethodsAsReadonly` + +This option allows you to treat all mutable methods as though they were readonly. This may be desirable in when you are never reassigning methods. + +Examples of **incorrect** code for this rule with `{treatMethodsAsReadonly: false}`: + +```ts +type MyType = { + readonly prop: string; + method(): string; // note: this method is mutable +}; +function foo(arg: MyType) {} +``` + +Examples of **correct** code for this rule with `{treatMethodsAsReadonly: false}`: + +```ts +type MyType = Readonly<{ + prop: string; + method(): string; +}>; +function foo(arg: MyType) {} + +type MyOtherType = { + readonly prop: string; + readonly method: () => string; +}; +function bar(arg: MyOtherType) {} +``` + +Examples of **correct** code for this rule with `{treatMethodsAsReadonly: true}`: + +```ts +type MyType = { + readonly prop: string; + method(): string; // note: this method is mutable +}; +function foo(arg: MyType) {} +``` + +## Attributes + +- [ ] ✅ Recommended +- [ ] 🔧 Fixable +- [x] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/prefer-readonly.md b/packages/eslint-plugin/docs/rules/prefer-readonly.md index 9ce16a8c35fb..df41adb8c838 100644 --- a/packages/eslint-plugin/docs/rules/prefer-readonly.md +++ b/packages/eslint-plugin/docs/rules/prefer-readonly.md @@ -79,3 +79,9 @@ class Container { ## Related to - TSLint: ['prefer-readonly'](https://palantir.github.io/tslint/rules/prefer-readonly) + +## Attributes + +- [ ] ✅ Recommended +- [x] 🔧 Fixable +- [x] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/prefer-reduce-type-parameter.md b/packages/eslint-plugin/docs/rules/prefer-reduce-type-parameter.md index d6f68021cc73..04bd5803a4a9 100644 --- a/packages/eslint-plugin/docs/rules/prefer-reduce-type-parameter.md +++ b/packages/eslint-plugin/docs/rules/prefer-reduce-type-parameter.md @@ -52,3 +52,9 @@ There are no options. ## When Not To Use It If you don't want to use typechecking in your linting, you can't use this rule. + +## Attributes + +- [ ] ✅ Recommended +- [x] 🔧 Fixable +- [x] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/prefer-regexp-exec.md b/packages/eslint-plugin/docs/rules/prefer-regexp-exec.md index 4640d35a98ec..32209cf731c5 100644 --- a/packages/eslint-plugin/docs/rules/prefer-regexp-exec.md +++ b/packages/eslint-plugin/docs/rules/prefer-regexp-exec.md @@ -1,18 +1,16 @@ # Enforce that `RegExp#exec` is used instead of `String#match` if no global flag is provided (`prefer-regexp-exec`) -`RegExp#exec` is faster than `String#match` and both work the same when not using the `/g` flag. +As `String#match` is defined to be the same as `RegExp#exec` when the regular expression does not include the `g` flag, prefer a consistent usage. ## Rule Details -This rule is aimed at enforcing the more performant way of applying regular expressions on strings. +This rule is aimed at enforcing a consistent way to apply regular expressions to strings. From [`String#match` on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match): > If the regular expression does not include the g flag, returns the same result as `RegExp.exec()`. -From [Stack Overflow](https://stackoverflow.com/questions/9214754/what-is-the-difference-between-regexp-s-exec-function-and-string-s-match-fun) - -> `RegExp.prototype.exec` is a lot faster than `String.prototype.match`, but that’s because they are not exactly the same thing, they are different. +`RegExp#exec` may also be slightly faster than `String#match`; this is the reason to choose it as the preferred usage. Examples of **incorrect** code for this rule: @@ -51,3 +49,9 @@ There are no options. ## When Not To Use It If you prefer consistent use of `String#match` for both, with `g` flag and without it, you can turn this rule off. + +## Attributes + +- [ ] ✅ Recommended +- [x] 🔧 Fixable +- [x] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/prefer-return-this-type.md b/packages/eslint-plugin/docs/rules/prefer-return-this-type.md new file mode 100644 index 000000000000..c61c462889f9 --- /dev/null +++ b/packages/eslint-plugin/docs/rules/prefer-return-this-type.md @@ -0,0 +1,96 @@ +# Enforce that `this` is used when only `this` type is returned (`prefer-return-this-type`) + +[Method chaining](https://en.wikipedia.org/wiki/Method_chaining) is a common pattern in OOP languages and TypeScript provides a special [polymorphic this type](https://www.typescriptlang.org/docs/handbook/2/classes.html#this-types). +If any type other than `this` is specified as the return type of these chaining methods, TypeScript will fail to cast it when invoking in subclass. + +```ts +class Animal { + eat(): Animal { + console.log("I'm moving!"); + return this; + } +} + +class Cat extends Animal { + meow(): Cat { + console.log('Meow~'); + return this; + } +} + +const cat = new Cat(); +// Error: Property 'meow' does not exist on type 'Animal'. +// because `eat` returns `Animal` and not all animals meow. +cat.eat().meow(); + +// the error can be fixed by removing the return type of `eat` or use `this` as the return type. +class Animal { + eat(): this { + console.log("I'm moving!"); + return this; + } +} + +class Cat extends Animal { + meow(): this { + console.log('Meow~'); + return this; + } +} + +const cat = new Cat(); +// no errors. Because `eat` returns `Cat` now +cat.eat().meow(); +``` + +Examples of **incorrect** code for this rule: + +```ts +class Foo { + f1(): Foo { + return this; + } + f2 = (): Foo => { + return this; + }; + f3(): Foo | undefined { + return Math.random() > 0.5 ? this : undefined; + } +} +``` + +Examples of **correct** code for this rule: + +```ts +class Foo { + f1(): this { + return this; + } + f2() { + return this; + } + f3 = (): this => { + return this; + }; + f4 = () => { + return this; + }; +} + +class Base {} +class Derived extends Base { + f(): Base { + return this; + } +} +``` + +## When Not To Use It + +If you don't use method chaining or explicit return values, you can safely turn this rule off. + +## Attributes + +- [ ] ✅ Recommended +- [x] 🔧 Fixable +- [x] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/prefer-string-starts-ends-with.md b/packages/eslint-plugin/docs/rules/prefer-string-starts-ends-with.md index 110061d554b7..729da9373078 100644 --- a/packages/eslint-plugin/docs/rules/prefer-string-starts-ends-with.md +++ b/packages/eslint-plugin/docs/rules/prefer-string-starts-ends-with.md @@ -52,3 +52,9 @@ There are no options. ## When Not To Use It If you don't mind that style, you can turn this rule off safely. + +## Attributes + +- [ ] ✅ Recommended +- [x] 🔧 Fixable +- [x] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/prefer-ts-expect-error.md b/packages/eslint-plugin/docs/rules/prefer-ts-expect-error.md index 60fdf79c8069..2ae69fe7d19d 100644 --- a/packages/eslint-plugin/docs/rules/prefer-ts-expect-error.md +++ b/packages/eslint-plugin/docs/rules/prefer-ts-expect-error.md @@ -63,3 +63,9 @@ If you are **NOT** using TypeScript 3.9 (or greater), then you will not be able ## Further Reading - [Original Implementing PR](https://github.com/microsoft/TypeScript/pull/36014) + +## Attributes + +- [ ] ✅ Recommended +- [x] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/promise-function-async.md b/packages/eslint-plugin/docs/rules/promise-function-async.md index 192e66a35775..7638e6bc5920 100644 --- a/packages/eslint-plugin/docs/rules/promise-function-async.md +++ b/packages/eslint-plugin/docs/rules/promise-function-async.md @@ -64,3 +64,9 @@ In addition, each of the following properties may be provided, and default to `t ## Related To - TSLint: [promise-function-async](https://palantir.github.io/tslint/rules/promise-function-async) + +## Attributes + +- [ ] ✅ Recommended +- [x] 🔧 Fixable +- [x] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/quotes.md b/packages/eslint-plugin/docs/rules/quotes.md index 6b63587f6b46..0801bebe5cc6 100644 --- a/packages/eslint-plugin/docs/rules/quotes.md +++ b/packages/eslint-plugin/docs/rules/quotes.md @@ -20,3 +20,9 @@ It adds support for TypeScript features which allow quoted names, but not backti See [`eslint/quotes` options](https://eslint.org/docs/rules/quotes#options). Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/quotes.md) + +## Attributes + +- [ ] ✅ Recommended +- [x] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/require-array-sort-compare.md b/packages/eslint-plugin/docs/rules/require-array-sort-compare.md index 78de19863f0c..7ad10fbdb00a 100644 --- a/packages/eslint-plugin/docs/rules/require-array-sort-compare.md +++ b/packages/eslint-plugin/docs/rules/require-array-sort-compare.md @@ -11,7 +11,7 @@ When sorting numbers, this results in the classic "10 before 2" order: [1, 2, 3, 10, 20, 30].sort(); //→ [1, 10, 2, 20, 3, 30] ``` -This also means that `Array#sort` does not always sort consistently, as elements may have custom `#toString` implementations that are not deterministic; this trap is noted in the noted in the language specification thusly: +This also means that `Array#sort` does not always sort consistently, as elements may have custom `#toString` implementations that are not deterministic; this trap is noted in the language specification thusly: > NOTE 2: Method calls performed by the `ToString` abstract operations in steps 5 and 7 have the potential to cause `SortCompare` to not behave as a consistent comparison function.
> https://www.ecma-international.org/ecma-262/9.0/#sec-sortcompare @@ -83,3 +83,9 @@ const three = '3'; ## When Not To Use It If you understand the language specification enough, you can turn this rule off safely. + +## Attributes + +- [ ] ✅ Recommended +- [ ] 🔧 Fixable +- [x] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/require-await.md b/packages/eslint-plugin/docs/rules/require-await.md index 2d8ad41fda9e..a0eeda41eaf7 100644 --- a/packages/eslint-plugin/docs/rules/require-await.md +++ b/packages/eslint-plugin/docs/rules/require-await.md @@ -30,3 +30,9 @@ const returnsPromise2 = () => returnsPromise1(); See [`eslint/require-await` options](https://eslint.org/docs/rules/require-await#options). Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/require-await.md) + +## Attributes + +- [x] ✅ Recommended +- [ ] 🔧 Fixable +- [x] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/restrict-plus-operands.md b/packages/eslint-plugin/docs/rules/restrict-plus-operands.md index 0959f837739b..5299b7345268 100644 --- a/packages/eslint-plugin/docs/rules/restrict-plus-operands.md +++ b/packages/eslint-plugin/docs/rules/restrict-plus-operands.md @@ -56,3 +56,9 @@ bar += 'test'; ## Compatibility - TSLint: [restrict-plus-operands](https://palantir.github.io/tslint/rules/restrict-plus-operands/) + +## Attributes + +- [x] ✅ Recommended +- [ ] 🔧 Fixable +- [x] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/restrict-template-expressions.md b/packages/eslint-plugin/docs/rules/restrict-template-expressions.md index 0ee7427ddac1..d56eb6ae74b9 100644 --- a/packages/eslint-plugin/docs/rules/restrict-template-expressions.md +++ b/packages/eslint-plugin/docs/rules/restrict-template-expressions.md @@ -35,6 +35,8 @@ type Options = { allowAny?: boolean; // if true, also allow null and undefined in template expressions allowNullish?: boolean; + // if true, also allow RegExp in template expressions + allowRegExp?: boolean; }; const defaults = { @@ -42,6 +44,7 @@ const defaults = { allowBoolean: false, allowAny: false, allowNullish: false, + allowRegExp: false, }; ``` @@ -83,3 +86,23 @@ Examples of additional **correct** code for this rule with `{ allowNullish: true const arg = condition ? 'ok' : null; const msg1 = `arg = ${arg}`; ``` + +### `allowRegExp` + +Examples of additional **correct** code for this rule with `{ allowRegExp: true }`: + +```ts +const arg = new RegExp('foo'); +const msg1 = `arg = ${arg}`; +``` + +```ts +const arg = /foo/; +const msg1 = `arg = ${arg}`; +``` + +## Attributes + +- [x] ✅ Recommended +- [ ] 🔧 Fixable +- [x] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/return-await.md b/packages/eslint-plugin/docs/rules/return-await.md index 3c621d251044..df8813ff9c0f 100644 --- a/packages/eslint-plugin/docs/rules/return-await.md +++ b/packages/eslint-plugin/docs/rules/return-await.md @@ -206,3 +206,9 @@ async function validNever3() { return 'value'; } ``` + +## Attributes + +- [ ] ✅ Recommended +- [x] 🔧 Fixable +- [x] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/semi.md b/packages/eslint-plugin/docs/rules/semi.md index c233d3546316..15b13d80b4a4 100644 --- a/packages/eslint-plugin/docs/rules/semi.md +++ b/packages/eslint-plugin/docs/rules/semi.md @@ -24,3 +24,9 @@ See also the [`@typescript-eslint/member-delimiter-style`](member-delimiter-styl See [`eslint/semi` options](https://eslint.org/docs/rules/semi#options). Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/semi.md) + +## Attributes + +- [ ] ✅ Recommended +- [x] 🔧 Fixable +- [ ] 💭 Requires type information 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 index 43ef069a7165..c275dc5ee052 100644 --- a/packages/eslint-plugin/docs/rules/sort-type-union-intersection-members.md +++ b/packages/eslint-plugin/docs/rules/sort-type-union-intersection-members.md @@ -145,3 +145,9 @@ The ordering of groups is determined by this option. - `tuple` - Tuple types (`[A, B, C]`) - `union` - Union types (`A | B`) - `nullish` - `null` and `undefined` + +## Attributes + +- [ ] ✅ Recommended +- [x] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/space-before-function-paren.md b/packages/eslint-plugin/docs/rules/space-before-function-paren.md index db2579e44d1b..29378534d40c 100644 --- a/packages/eslint-plugin/docs/rules/space-before-function-paren.md +++ b/packages/eslint-plugin/docs/rules/space-before-function-paren.md @@ -20,3 +20,9 @@ It adds support for generic type parameters on function calls. See [`eslint/space-before-function-paren` options](https://eslint.org/docs/rules/space-before-function-paren#options). Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/space-before-function-paren.md) + +## Attributes + +- [ ] ✅ Recommended +- [x] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/space-infix-ops.md b/packages/eslint-plugin/docs/rules/space-infix-ops.md index da36f25726e2..030edc2f69c9 100644 --- a/packages/eslint-plugin/docs/rules/space-infix-ops.md +++ b/packages/eslint-plugin/docs/rules/space-infix-ops.md @@ -24,3 +24,9 @@ enum MyEnum { See [`eslint/space-infix-ops` options](https://eslint.org/docs/rules/space-infix-ops#options). Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/space-infix-ops.md) + +## Attributes + +- [ ] ✅ Recommended +- [x] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/strict-boolean-expressions.md b/packages/eslint-plugin/docs/rules/strict-boolean-expressions.md index 9eb5712ab482..1d5b0435fe17 100644 --- a/packages/eslint-plugin/docs/rules/strict-boolean-expressions.md +++ b/packages/eslint-plugin/docs/rules/strict-boolean-expressions.md @@ -155,8 +155,46 @@ You should be using `strictNullChecks` to ensure complete type-safety in your co If for some reason you cannot turn on `strictNullChecks`, but still want to use this rule - you can use this option to allow it - but know that the behavior of this rule is _undefined_ with the compiler option turned off. We will not accept bug reports if you are using this option. +## Fixes and suggestions + +This rule provides following fixes and suggestions for particular types in boolean context: + +- `boolean` - Always allowed - no fix needed. +- `string` - (when `allowString` is `false`) - Provides following suggestions: + - Change condition to check string's length (`str` → `str.length > 0`) + - Change condition to check for empty string (`str` → `str !== ""`) + - Explicitly cast value to a boolean (`str` → `Boolean(str)`) +- `number` - (when `allowNumber` is `false`): + - For `array.length` - Provides **autofix**: + - Change condition to check for 0 (`array.length` → `array.length > 0`) + - For other number values - Provides following suggestions: + - Change condition to check for 0 (`num` → `num !== 0`) + - Change condition to check for NaN (`num` → `!Number.isNaN(num)`) + - Explicitly cast value to a boolean (`num` → `Boolean(num)`) +- `object | null | undefined` - (when `allowNullableObject` is `false`) - Provides **autofix**: + - Change condition to check for null/undefined (`maybeObj` → `maybeObj != null`) +- `boolean | null | undefined` - Provides following suggestions: + - Explicitly treat nullish value the same as false (`maybeBool` → `maybeBool ?? false`) + - Change condition to check for true/false (`maybeBool` → `maybeBool === true`) +- `string | null | undefined` - Provides following suggestions: + - Change condition to check for null/undefined (`maybeStr` → `maybeStr != null`) + - Explicitly treat nullish value the same as an empty string (`maybeStr` → `maybeStr ?? ""`) + - Explicitly cast value to a boolean (`maybeStr` → `Boolean(maybeStr)`) +- `number | null | undefined` - Provides following suggestions: + - Change condition to check for null/undefined (`maybeNum` → `maybeNum != null`) + - Explicitly treat nullish value the same as 0 (`maybeNum` → `maybeNum ?? 0`) + - Explicitly cast value to a boolean (`maybeNum` → `Boolean(maybeNum)`) +- `any` and `unknown` - Provides following suggestions: + - Explicitly cast value to a boolean (`value` → `Boolean(value)`) + ## Related To - TSLint: [strict-boolean-expressions](https://palantir.github.io/tslint/rules/strict-boolean-expressions) - [no-unnecessary-condition](./no-unnecessary-condition.md) - Similar rule which reports always-truthy and always-falsy values in conditions + +## Attributes + +- [ ] ✅ Recommended +- [x] 🔧 Fixable +- [x] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/switch-exhaustiveness-check.md b/packages/eslint-plugin/docs/rules/switch-exhaustiveness-check.md index a26c6e6dff27..b5f3ad11f3c6 100644 --- a/packages/eslint-plugin/docs/rules/switch-exhaustiveness-check.md +++ b/packages/eslint-plugin/docs/rules/switch-exhaustiveness-check.md @@ -101,3 +101,9 @@ switch (day) { ## When Not To Use It If program doesn't have union types with many parts. Downside of this rule is the need for type information, so it's slower than regular rules. + +## Attributes + +- [ ] ✅ Recommended +- [ ] 🔧 Fixable +- [x] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/triple-slash-reference.md b/packages/eslint-plugin/docs/rules/triple-slash-reference.md index af9e5498b6d4..89bf247650de 100644 --- a/packages/eslint-plugin/docs/rules/triple-slash-reference.md +++ b/packages/eslint-plugin/docs/rules/triple-slash-reference.md @@ -2,8 +2,6 @@ Use of triple-slash reference type directives is discouraged in favor of the newer `import` style. This rule allows you to ban use of `/// `, `/// `, or `/// ` directives. -Consider using this rule in place of [`no-triple-slash-reference`](./no-triple-slash-reference.md) which has been deprecated. - ## Rule Details With `{ "path": "never", "types": "never", "lib": "never" }` options set, the following will all be **incorrect** usage: @@ -56,3 +54,9 @@ If you want to use all flavors of triple slash reference directives. - TSLint: [no-reference](http://palantir.github.io/tslint/rules/no-reference/) - TSLint: [no-reference-import](https://palantir.github.io/tslint/rules/no-reference-import/) + +## Attributes + +- [x] ✅ Recommended +- [ ] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/type-annotation-spacing.md b/packages/eslint-plugin/docs/rules/type-annotation-spacing.md index 32b7b655814d..cb6b694a15b9 100644 --- a/packages/eslint-plugin/docs/rules/type-annotation-spacing.md +++ b/packages/eslint-plugin/docs/rules/type-annotation-spacing.md @@ -289,3 +289,9 @@ If you don't want to enforce spacing for your type annotations, you can safely t ## Compatibility - TSLint: [`typedef-whitespace`](https://palantir.github.io/tslint/rules/typedef-whitespace/) + +## Attributes + +- [ ] ✅ Recommended +- [x] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/typedef.md b/packages/eslint-plugin/docs/rules/typedef.md index 6c96fa0317da..e3de5baf5e56 100644 --- a/packages/eslint-plugin/docs/rules/typedef.md +++ b/packages/eslint-plugin/docs/rules/typedef.md @@ -114,7 +114,7 @@ const mapper = { Examples of **correct** code with `{ "arrowParameter": true }`: ```ts -const logsSize = (size: number) => console.log(text); +const logsSize = (size: number) => console.log(size); ['hello', 'world'].map((text: string) => text.length); @@ -306,3 +306,9 @@ In general, if you do not consider the cost of writing unnecessary type annotati ## Compatibility - TSLint: [`typedef`](https://palantir.github.io/tslint/rules/typedef) + +## Attributes + +- [ ] ✅ Recommended +- [ ] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/unbound-method.md b/packages/eslint-plugin/docs/rules/unbound-method.md index a9a4fe396a24..22a9a9039b39 100644 --- a/packages/eslint-plugin/docs/rules/unbound-method.md +++ b/packages/eslint-plugin/docs/rules/unbound-method.md @@ -4,6 +4,10 @@ Warns when a method is used outside of a method call. Class functions don't preserve the class scope when passed as standalone variables. +If your function does not access `this`, [you can annotate it with `this: void`](https://www.typescriptlang.org/docs/handbook/2/functions.html#declaring-this-in-a-function), or consider using an arrow function instead. + +If you're working with `jest`, you can use [`eslint-plugin-jest`'s version of this rule](https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/unbound-method.md) to lint your test files, which knows when it's ok to pass an unbound method to `expect` calls. + ## Rule Details Examples of **incorrect** code for this rule @@ -103,6 +107,14 @@ log(); If your code intentionally waits to bind methods after use, such as by passing a `scope: this` along with the method, you can disable this rule. +If you're wanting to use `toBeCalled` and similar matches in `jest` tests, you can disable this rule for your test files in favor of [`eslint-plugin-jest`'s version of this rule](https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/unbound-method.md). + ## Related To - TSLint: [no-unbound-method](https://palantir.github.io/tslint/rules/no-unbound-method/) + +## Attributes + +- [x] ✅ Recommended +- [ ] 🔧 Fixable +- [x] 💭 Requires type information diff --git a/packages/eslint-plugin/docs/rules/unified-signatures.md b/packages/eslint-plugin/docs/rules/unified-signatures.md index 7ed5116c2aa6..f9d6b3a49e69 100644 --- a/packages/eslint-plugin/docs/rules/unified-signatures.md +++ b/packages/eslint-plugin/docs/rules/unified-signatures.md @@ -31,3 +31,9 @@ function f(x?: ...number[]): void; ## Related to - TSLint: [`unified-signatures`](https://palantir.github.io/tslint/rules/unified-signatures/) + +## Attributes + +- [ ] ✅ Recommended +- [ ] 🔧 Fixable +- [ ] 💭 Requires type information diff --git a/packages/eslint-plugin/index.d.ts b/packages/eslint-plugin/index.d.ts new file mode 100644 index 000000000000..8092cabcc4b2 --- /dev/null +++ b/packages/eslint-plugin/index.d.ts @@ -0,0 +1,4 @@ +import { TSESLint } from '@typescript-eslint/experimental-utils'; + +export const rules: Record>; +export const configs: Record; diff --git a/packages/eslint-plugin/jest.config.js b/packages/eslint-plugin/jest.config.js index cce8d6c61baf..bf4e270e3760 100644 --- a/packages/eslint-plugin/jest.config.js +++ b/packages/eslint-plugin/jest.config.js @@ -3,6 +3,7 @@ // @ts-check /** @type {import('@jest/types').Config.InitialOptions} */ module.exports = { + resolver: '/../../tests/jest-resolver.js', globals: { 'ts-jest': { isolatedModules: true, diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 8391c2b25500..9655d60e8062 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin", - "version": "4.16.1", + "version": "5.3.0", "description": "TypeScript plugin for ESLint", "keywords": [ "eslint", @@ -9,11 +9,12 @@ "typescript" ], "engines": { - "node": "^10.12.0 || >=12.0.0" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "files": [ "dist", "docs", + "index.d.ts", "package.json", "README.md", "LICENSE" @@ -28,12 +29,13 @@ }, "license": "MIT", "main": "dist/index.js", + "types": "index.d.ts", "scripts": { "build": "tsc -b tsconfig.build.json", - "check:docs": "jest tests/docs.test.ts --runTestsByPath --silent --runInBand", - "check:configs": "jest tests/configs.test.ts --runTestsByPath --silent --runInBand", + "check-docs": "jest tests/docs.test.ts --runTestsByPath --silent --runInBand", + "check-configs": "jest tests/configs.test.ts --runTestsByPath --silent --runInBand", "clean": "tsc -b tsconfig.build.json --clean", - "postclean": "rimraf dist", + "postclean": "rimraf dist && rimraf coverage", "format": "prettier --write \"./**/*.{ts,js,json,md}\" --ignore-path ../../.prettierignore", "generate:configs": "../../node_modules/.bin/ts-node --files --transpile-only tools/generate-configs.ts", "generate:rules-lists": "../../node_modules/.bin/ts-node --files --transpile-only tools/generate-rules-lists.ts", @@ -42,27 +44,27 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/experimental-utils": "4.16.1", - "@typescript-eslint/scope-manager": "4.16.1", - "debug": "^4.1.1", + "@typescript-eslint/experimental-utils": "5.3.0", + "@typescript-eslint/scope-manager": "5.3.0", + "debug": "^4.3.2", "functional-red-black-tree": "^1.0.1", - "lodash": "^4.17.15", - "regexpp": "^3.0.0", - "semver": "^7.3.2", - "tsutils": "^3.17.1" + "ignore": "^5.1.8", + "regexpp": "^3.2.0", + "semver": "^7.3.5", + "tsutils": "^3.21.0" }, "devDependencies": { "@types/debug": "*", "@types/marked": "*", "@types/prettier": "*", - "chalk": "^4.0.0", - "marked": "^2.0.0", + "chalk": "^4.1.2", + "marked": "^3.0.7", "prettier": "*", "typescript": "*" }, "peerDependencies": { - "@typescript-eslint/parser": "^4.0.0", - "eslint": "^5.0.0 || ^6.0.0 || ^7.0.0" + "@typescript-eslint/parser": "^5.0.0", + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" }, "peerDependenciesMeta": { "typescript": { diff --git a/packages/eslint-plugin/project.json b/packages/eslint-plugin/project.json new file mode 100644 index 000000000000..d04cdcb07b13 --- /dev/null +++ b/packages/eslint-plugin/project.json @@ -0,0 +1,5 @@ +{ + "root": "packages/eslint-plugin", + "type": "library", + "implicitDependencies": [] +} diff --git a/packages/eslint-plugin/src/configs/all.ts b/packages/eslint-plugin/src/configs/all.ts index 98afc4ae3a45..538be53ce583 100644 --- a/packages/eslint-plugin/src/configs/all.ts +++ b/packages/eslint-plugin/src/configs/all.ts @@ -22,6 +22,7 @@ export = { '@typescript-eslint/consistent-type-assertions': 'error', '@typescript-eslint/consistent-type-definitions': 'error', '@typescript-eslint/consistent-type-imports': 'error', + '@typescript-eslint/consistent-type-exports': 'error', 'default-param-last': 'off', '@typescript-eslint/default-param-last': 'error', 'dot-notation': 'off', @@ -65,7 +66,6 @@ export = { '@typescript-eslint/no-extraneous-class': 'error', '@typescript-eslint/no-floating-promises': 'error', '@typescript-eslint/no-for-in-array': 'error', - '@typescript-eslint/no-implicit-any-catch': 'error', 'no-implied-eval': 'off', '@typescript-eslint/no-implied-eval': 'error', '@typescript-eslint/no-inferrable-types': 'error', @@ -78,15 +78,19 @@ export = { '@typescript-eslint/no-loss-of-precision': 'error', 'no-magic-numbers': 'off', '@typescript-eslint/no-magic-numbers': 'error', + '@typescript-eslint/no-meaningless-void-operator': 'error', '@typescript-eslint/no-misused-new': 'error', '@typescript-eslint/no-misused-promises': '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-parameter-properties': 'error', 'no-redeclare': 'off', '@typescript-eslint/no-redeclare': 'error', '@typescript-eslint/no-require-imports': 'error', + 'no-restricted-imports': 'off', + '@typescript-eslint/no-restricted-imports': 'error', 'no-shadow': 'off', '@typescript-eslint/no-shadow': 'error', '@typescript-eslint/no-this-alias': 'error', @@ -99,6 +103,7 @@ export = { '@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-member-access': 'error', @@ -115,6 +120,8 @@ export = { '@typescript-eslint/non-nullable-type-assertion-style': 'error', 'object-curly-spacing': 'off', '@typescript-eslint/object-curly-spacing': 'error', + 'padding-line-between-statements': 'off', + '@typescript-eslint/padding-line-between-statements': 'error', '@typescript-eslint/prefer-as-const': 'error', '@typescript-eslint/prefer-enum-initializers': 'error', '@typescript-eslint/prefer-for-of': 'error', @@ -128,6 +135,7 @@ export = { '@typescript-eslint/prefer-readonly-parameter-types': 'error', '@typescript-eslint/prefer-reduce-type-parameter': 'error', '@typescript-eslint/prefer-regexp-exec': 'error', + '@typescript-eslint/prefer-return-this-type': 'error', '@typescript-eslint/prefer-string-starts-ends-with': 'error', '@typescript-eslint/prefer-ts-expect-error': 'error', '@typescript-eslint/promise-function-async': 'error', diff --git a/packages/eslint-plugin/src/configs/recommended-requiring-type-checking.ts b/packages/eslint-plugin/src/configs/recommended-requiring-type-checking.ts index fecfa6002af9..369d33d6687e 100644 --- a/packages/eslint-plugin/src/configs/recommended-requiring-type-checking.ts +++ b/packages/eslint-plugin/src/configs/recommended-requiring-type-checking.ts @@ -12,11 +12,11 @@ export = { '@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', - '@typescript-eslint/prefer-regexp-exec': 'error', 'require-await': 'off', '@typescript-eslint/require-await': 'error', '@typescript-eslint/restrict-plus-operands': 'error', diff --git a/packages/eslint-plugin/src/configs/recommended.ts b/packages/eslint-plugin/src/configs/recommended.ts index d9450197c415..10b1d04581fb 100644 --- a/packages/eslint-plugin/src/configs/recommended.ts +++ b/packages/eslint-plugin/src/configs/recommended.ts @@ -8,7 +8,6 @@ export = { '@typescript-eslint/adjacent-overload-signatures': 'error', '@typescript-eslint/ban-ts-comment': 'error', '@typescript-eslint/ban-types': 'error', - '@typescript-eslint/explicit-module-boundary-types': 'warn', 'no-array-constructor': 'off', '@typescript-eslint/no-array-constructor': 'error', 'no-empty-function': 'off', @@ -19,11 +18,14 @@ export = { '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', diff --git a/packages/eslint-plugin/src/rules/adjacent-overload-signatures.ts b/packages/eslint-plugin/src/rules/adjacent-overload-signatures.ts index 05f120b4cf24..c0eec499ab3e 100644 --- a/packages/eslint-plugin/src/rules/adjacent-overload-signatures.ts +++ b/packages/eslint-plugin/src/rules/adjacent-overload-signatures.ts @@ -21,12 +21,11 @@ export default util.createRule({ type: 'suggestion', docs: { description: 'Require that member overloads be consecutive', - category: 'Best Practices', recommended: 'error', }, schema: [], messages: { - adjacentSignature: "All '{{name}}' signatures should be adjacent.", + adjacentSignature: 'All {{name}} signatures should be adjacent.', }, }, defaultOptions: [], @@ -37,6 +36,7 @@ export default util.createRule({ name: string; static: boolean; callSignature: boolean; + type: util.MemberNameType; } /** @@ -72,11 +72,12 @@ export default util.createRule({ name, static: isStatic, callSignature: false, + type: util.MemberNameType.Normal, }; } case AST_NODE_TYPES.TSMethodSignature: return { - name: util.getNameFromMember(member, sourceCode), + ...util.getNameFromMember(member, sourceCode), static: isStatic, callSignature: false, }; @@ -85,16 +86,18 @@ export default util.createRule({ name: 'call', static: isStatic, callSignature: true, + type: util.MemberNameType.Normal, }; case AST_NODE_TYPES.TSConstructSignatureDeclaration: return { name: 'new', static: isStatic, callSignature: false, + type: util.MemberNameType.Normal, }; case AST_NODE_TYPES.MethodDefinition: return { - name: util.getNameFromMember(member, sourceCode), + ...util.getNameFromMember(member, sourceCode), static: isStatic, callSignature: false, }; @@ -108,7 +111,8 @@ export default util.createRule({ !!method2 && method1.name === method2.name && method1.static === method2.static && - method1.callSignature === method2.callSignature + method1.callSignature === method2.callSignature && + method1.type === method2.type ); } @@ -151,7 +155,7 @@ export default util.createRule({ node: member, messageId: 'adjacentSignature', data: { - name: (method.static ? 'static ' : '') + method.name, + name: `${method.static ? 'static ' : ''}${method.name}`, }, }); } else if (index === -1) { diff --git a/packages/eslint-plugin/src/rules/array-type.ts b/packages/eslint-plugin/src/rules/array-type.ts index 8c97729623a7..da2bfdef518b 100644 --- a/packages/eslint-plugin/src/rules/array-type.ts +++ b/packages/eslint-plugin/src/rules/array-type.ts @@ -92,7 +92,6 @@ export default util.createRule({ type: 'suggestion', docs: { description: 'Requires using either `T[]` or `Array` for arrays', - category: 'Stylistic Issues', // too opinionated to be recommended recommended: false, }, @@ -132,13 +131,8 @@ export default util.createRule({ * @param node the node to be evaluated. */ function getMessageType(node: TSESTree.Node): string { - if (node) { - if (node.type === AST_NODE_TYPES.TSParenthesizedType) { - return getMessageType(node.typeAnnotation); - } - if (isSimpleType(node)) { - return sourceCode.getText(node); - } + if (node && isSimpleType(node)) { + return sourceCode.getText(node); } return 'T'; } @@ -172,11 +166,7 @@ export default util.createRule({ type: getMessageType(node.elementType), }, fix(fixer) { - const typeNode = - node.elementType.type === AST_NODE_TYPES.TSParenthesizedType - ? node.elementType.typeAnnotation - : node.elementType; - + const typeNode = node.elementType; const arrayType = isReadonly ? 'ReadonlyArray' : 'Array'; return [ @@ -244,9 +234,12 @@ export default util.createRule({ } const type = typeParams[0]; - const typeParens = typeNeedsParentheses(type); + const typeParens = + !util.isParenthesized(type, sourceCode) && typeNeedsParentheses(type); const parentParens = - readonlyPrefix && node.parent?.type === AST_NODE_TYPES.TSArrayType; + readonlyPrefix && + node.parent?.type === AST_NODE_TYPES.TSArrayType && + !util.isParenthesized(node.parent.elementType, sourceCode); const start = `${parentParens ? '(' : ''}${readonlyPrefix}${ typeParens ? '(' : '' diff --git a/packages/eslint-plugin/src/rules/await-thenable.ts b/packages/eslint-plugin/src/rules/await-thenable.ts index 9858bad8ba2a..e1decc5ad3df 100644 --- a/packages/eslint-plugin/src/rules/await-thenable.ts +++ b/packages/eslint-plugin/src/rules/await-thenable.ts @@ -7,7 +7,6 @@ export default util.createRule({ meta: { docs: { description: 'Disallows awaiting a value that is not a Thenable', - category: 'Best Practices', recommended: 'error', requiresTypeChecking: true, }, diff --git a/packages/eslint-plugin/src/rules/ban-ts-comment.ts b/packages/eslint-plugin/src/rules/ban-ts-comment.ts index 7c2f237cd4cf..a9e0caf0fe47 100644 --- a/packages/eslint-plugin/src/rules/ban-ts-comment.ts +++ b/packages/eslint-plugin/src/rules/ban-ts-comment.ts @@ -22,7 +22,6 @@ export default util.createRule<[Options], MessageIds>({ docs: { description: 'Bans `@ts-` comments from being used or requires descriptions after directive', - category: 'Best Practices', recommended: 'error', }, messages: { @@ -102,8 +101,10 @@ export default util.createRule<[Options], MessageIds>({ The regex used are taken from the ones used in the official TypeScript repo - https://github.com/microsoft/TypeScript/blob/master/src/compiler/scanner.ts#L281-L289 */ - const commentDirectiveRegExSingleLine = /^\/*\s*@ts-(expect-error|ignore|check|nocheck)(.*)/; - const commentDirectiveRegExMultiLine = /^\s*(?:\/|\*)*\s*@ts-(expect-error|ignore|check|nocheck)(.*)/; + const commentDirectiveRegExSingleLine = + /^\/*\s*@ts-(expect-error|ignore|check|nocheck)(.*)/; + const commentDirectiveRegExMultiLine = + /^\s*(?:\/|\*)*\s*@ts-(expect-error|ignore|check|nocheck)(.*)/; const sourceCode = context.getSourceCode(); return { diff --git a/packages/eslint-plugin/src/rules/ban-tslint-comment.ts b/packages/eslint-plugin/src/rules/ban-tslint-comment.ts index 4521fcb13c36..14d32e72d889 100644 --- a/packages/eslint-plugin/src/rules/ban-tslint-comment.ts +++ b/packages/eslint-plugin/src/rules/ban-tslint-comment.ts @@ -3,7 +3,8 @@ import * as util from '../util'; // tslint regex // https://github.com/palantir/tslint/blob/95d9d958833fd9dc0002d18cbe34db20d0fbf437/src/enableDisableRules.ts#L32 -const ENABLE_DISABLE_REGEX = /^\s*tslint:(enable|disable)(?:-(line|next-line))?(:|\s|$)/; +const ENABLE_DISABLE_REGEX = + /^\s*tslint:(enable|disable)(?:-(line|next-line))?(:|\s|$)/; const toText = ( text: string, @@ -19,7 +20,6 @@ export default util.createRule({ type: 'suggestion', docs: { description: 'Bans `// tslint:` comments from being used', - category: 'Stylistic Issues', recommended: false, }, messages: { diff --git a/packages/eslint-plugin/src/rules/ban-types.ts b/packages/eslint-plugin/src/rules/ban-types.ts index c9f03c89b969..dea2e79c4b0e 100644 --- a/packages/eslint-plugin/src/rules/ban-types.ts +++ b/packages/eslint-plugin/src/rules/ban-types.ts @@ -96,12 +96,6 @@ const defaultTypes: Types = { '- If you want a type meaning "empty object", you probably want `Record` instead.', ].join('\n'), }, - object: { - message: [ - 'The `object` type is currently hard to use ([see this issue](https://github.com/microsoft/TypeScript/issues/21732)).', - 'Consider using `Record` instead, as it allows you to more easily inspect and use the keys.', - ].join('\n'), - }, }; export const TYPE_KEYWORDS = { @@ -124,7 +118,6 @@ export default util.createRule({ type: 'suggestion', docs: { description: 'Bans specific types from being used', - category: 'Best Practices', recommended: 'error', }, fixable: 'code', diff --git a/packages/eslint-plugin/src/rules/brace-style.ts b/packages/eslint-plugin/src/rules/brace-style.ts index 7107bdf4d1ba..6635303b3865 100644 --- a/packages/eslint-plugin/src/rules/brace-style.ts +++ b/packages/eslint-plugin/src/rules/brace-style.ts @@ -1,5 +1,5 @@ import { TSESTree } from '@typescript-eslint/experimental-utils'; -import baseRule from 'eslint/lib/rules/brace-style'; +import { getESLintCoreRule } from '../util/getESLintCoreRule'; import { InferOptionsTypeFromRule, InferMessageIdsTypeFromRule, @@ -7,6 +7,8 @@ import { isTokenOnSameLine, } from '../util'; +const baseRule = getESLintCoreRule('brace-style'); + export type Options = InferOptionsTypeFromRule; export type MessageIds = InferMessageIdsTypeFromRule; @@ -16,20 +18,18 @@ export default createRule({ type: 'layout', docs: { description: 'Enforce consistent brace style for blocks', - category: 'Stylistic Issues', recommended: false, extendsBaseRule: true, }, messages: baseRule.meta.messages, fixable: baseRule.meta.fixable, + hasSuggestions: baseRule.meta.hasSuggestions, schema: baseRule.meta.schema, }, defaultOptions: ['1tbs'], create(context) { - const [ - style, - { allowSingleLine } = { allowSingleLine: false }, - ] = context.options; + const [style, { allowSingleLine } = { allowSingleLine: false }] = + context.options; const isAllmanStyle = style === 'allman'; const sourceCode = context.getSourceCode(); @@ -49,15 +49,12 @@ export default createRule({ return; } - const tokenBeforeOpeningCurly = sourceCode.getTokenBefore( - openingCurlyToken, - )!; - const tokenBeforeClosingCurly = sourceCode.getTokenBefore( - closingCurlyToken, - )!; - const tokenAfterOpeningCurly = sourceCode.getTokenAfter( - openingCurlyToken, - )!; + const tokenBeforeOpeningCurly = + sourceCode.getTokenBefore(openingCurlyToken)!; + const tokenBeforeClosingCurly = + sourceCode.getTokenBefore(closingCurlyToken)!; + const tokenAfterOpeningCurly = + sourceCode.getTokenAfter(openingCurlyToken)!; if ( !isAllmanStyle && 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 0a257427ec10..b3f9fb401c2f 100644 --- a/packages/eslint-plugin/src/rules/class-literal-property-style.ts +++ b/packages/eslint-plugin/src/rules/class-literal-property-style.ts @@ -44,7 +44,6 @@ export default util.createRule({ docs: { description: 'Ensures that literals on classes are exposed in a consistent style', - category: 'Best Practices', recommended: false, }, fixable: 'code', @@ -56,9 +55,9 @@ export default util.createRule({ }, defaultOptions: ['fields'], create(context, [style]) { - if (style === 'fields') { - return { - MethodDefinition(node: TSESTree.MethodDefinition): void { + return { + ...(style === 'fields' && { + MethodDefinition(node): void { if ( node.kind !== 'get' || !node.value.body || @@ -96,38 +95,37 @@ export default util.createRule({ }, }); }, - }; - } + }), + ...(style === 'getters' && { + PropertyDefinition(node): void { + if (!node.readonly || node.declare) { + return; + } - return { - ClassProperty(node: TSESTree.ClassProperty): void { - if (!node.readonly || node.declare) { - return; - } - - const { value } = node; - - if (!value || !isSupportedLiteral(value)) { - return; - } - - 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); - }, - }); - }, + const { value } = node; + + if (!value || !isSupportedLiteral(value)) { + return; + } + + 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); + }, + }); + }, + }), }; }, }); diff --git a/packages/eslint-plugin/src/rules/comma-dangle.ts b/packages/eslint-plugin/src/rules/comma-dangle.ts index e0e06a6711d7..298a3e92639c 100644 --- a/packages/eslint-plugin/src/rules/comma-dangle.ts +++ b/packages/eslint-plugin/src/rules/comma-dangle.ts @@ -1,10 +1,12 @@ import * as util from '../util'; -import baseRule from 'eslint/lib/rules/comma-dangle'; +import { getESLintCoreRule } from '../util/getESLintCoreRule'; import { TSESTree, AST_NODE_TYPES, } from '@typescript-eslint/experimental-utils'; +const baseRule = getESLintCoreRule('comma-dangle'); + export type Options = util.InferOptionsTypeFromRule; export type MessageIds = util.InferMessageIdsTypeFromRule; @@ -43,7 +45,6 @@ export default util.createRule({ type: 'layout', docs: { description: 'Require or disallow trailing comma', - category: 'Stylistic Issues', recommended: false, extendsBaseRule: true, }, @@ -80,8 +81,10 @@ export default util.createRule({ ], }, ], + additionalProperties: false, }, fixable: 'code', + hasSuggestions: baseRule.meta.hasSuggestions, messages: baseRule.meta.messages, }, defaultOptions: ['never'], diff --git a/packages/eslint-plugin/src/rules/comma-spacing.ts b/packages/eslint-plugin/src/rules/comma-spacing.ts index e0b206221162..c78322be8ea3 100644 --- a/packages/eslint-plugin/src/rules/comma-spacing.ts +++ b/packages/eslint-plugin/src/rules/comma-spacing.ts @@ -23,7 +23,6 @@ export default createRule({ type: 'suggestion', docs: { description: 'Enforces consistent spacing before and after commas', - category: 'Stylistic Issues', recommended: false, extendsBaseRule: true, }, @@ -108,8 +107,8 @@ export default createRule({ */ function validateCommaSpacing( commaToken: TSESTree.PunctuatorToken, - prevToken: TSESTree.Token | TSESTree.Comment | null, - nextToken: TSESTree.Token | TSESTree.Comment | null, + prevToken: TSESTree.Token | null, + nextToken: TSESTree.Token | null, ): void { if ( prevToken && 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 a30102dd123e..8c2081adebfe 100644 --- a/packages/eslint-plugin/src/rules/consistent-indexed-object-style.ts +++ b/packages/eslint-plugin/src/rules/consistent-indexed-object-style.ts @@ -1,9 +1,9 @@ -import { createRule } from '../util'; import { AST_NODE_TYPES, - TSESTree, TSESLint, + TSESTree, } from '@typescript-eslint/experimental-utils'; +import { createRule } from '../util'; type MessageIds = 'preferRecord' | 'preferIndexSignature'; type Options = ['record' | 'index-signature']; @@ -14,12 +14,11 @@ export default createRule({ type: 'suggestion', docs: { description: 'Enforce or disallow the use of the record type', - category: 'Stylistic Issues', // too opinionated to be recommended recommended: false, }, messages: { - preferRecord: 'A record is preferred over an index signature', + preferRecord: 'A record is preferred over an index signature.', preferIndexSignature: 'An index signature is preferred over a record.', }, fixable: 'code', @@ -30,38 +29,9 @@ export default createRule({ ], }, defaultOptions: ['record'], - create(context) { + create(context, [mode]) { const sourceCode = context.getSourceCode(); - if (context.options[0] === 'index-signature') { - return { - TSTypeReference(node): void { - const typeName = node.typeName; - if (typeName.type !== AST_NODE_TYPES.Identifier) { - return; - } - if (typeName.name !== 'Record') { - return; - } - - const params = node.typeParameters?.params; - if (params?.length !== 2) { - return; - } - - context.report({ - node, - messageId: 'preferIndexSignature', - fix(fixer) { - const key = sourceCode.getText(params[0]); - const type = sourceCode.getText(params[1]); - return fixer.replaceText(node, `{ [key: ${key}]: ${type} }`); - }, - }); - }, - }; - } - function checkMembers( members: TSESTree.TypeElement[], node: TSESTree.Node, @@ -114,27 +84,54 @@ export default createRule({ } return { - TSTypeLiteral(node): void { - checkMembers(node.members, node, '', ''); - }, + ...(mode === 'index-signature' && { + TSTypeReference(node): void { + const typeName = node.typeName; + if (typeName.type !== AST_NODE_TYPES.Identifier) { + return; + } + if (typeName.name !== 'Record') { + return; + } - TSInterfaceDeclaration(node): void { - let genericTypes = ''; + const params = node.typeParameters?.params; + if (params?.length !== 2) { + return; + } - if ((node.typeParameters?.params ?? []).length > 0) { - genericTypes = `<${node.typeParameters?.params - .map(p => p.name.name) - .join(', ')}>`; - } + context.report({ + node, + messageId: 'preferIndexSignature', + fix(fixer) { + const key = sourceCode.getText(params[0]); + const type = sourceCode.getText(params[1]); + return fixer.replaceText(node, `{ [key: ${key}]: ${type} }`); + }, + }); + }, + }), + ...(mode === 'record' && { + TSTypeLiteral(node): void { + checkMembers(node.members, node, '', ''); + }, + TSInterfaceDeclaration(node): void { + let genericTypes = ''; - checkMembers( - node.body.body, - node, - `type ${node.id.name}${genericTypes} = `, - ';', - !node.extends?.length, - ); - }, + if ((node.typeParameters?.params ?? []).length > 0) { + genericTypes = `<${node.typeParameters?.params + .map(p => p.name.name) + .join(', ')}>`; + } + + checkMembers( + node.body.body, + node, + `type ${node.id.name}${genericTypes} = `, + ';', + !node.extends?.length, + ); + }, + }), }; }, }); diff --git a/packages/eslint-plugin/src/rules/consistent-type-assertions.ts b/packages/eslint-plugin/src/rules/consistent-type-assertions.ts index 3b431b80675c..617381790665 100644 --- a/packages/eslint-plugin/src/rules/consistent-type-assertions.ts +++ b/packages/eslint-plugin/src/rules/consistent-type-assertions.ts @@ -25,7 +25,6 @@ export default util.createRule({ meta: { type: 'suggestion', docs: { - category: 'Best Practices', description: 'Enforces consistent usage of type assertions', recommended: false, }, diff --git a/packages/eslint-plugin/src/rules/consistent-type-definitions.ts b/packages/eslint-plugin/src/rules/consistent-type-definitions.ts index f5b2c48a44f4..efb7bdd8d5da 100644 --- a/packages/eslint-plugin/src/rules/consistent-type-definitions.ts +++ b/packages/eslint-plugin/src/rules/consistent-type-definitions.ts @@ -13,7 +13,6 @@ export default util.createRule({ docs: { description: 'Consistent with type definition either `interface` or `type`', - category: 'Stylistic Issues', // too opinionated to be recommended recommended: false, }, @@ -48,10 +47,10 @@ export default util.createRule({ } return { - "TSTypeAliasDeclaration[typeAnnotation.type='TSTypeLiteral']"( - node: TSESTree.TSTypeAliasDeclaration, - ): void { - if (option === 'interface') { + ...(option === 'interface' && { + "TSTypeAliasDeclaration[typeAnnotation.type='TSTypeLiteral']"( + node: TSESTree.TSTypeAliasDeclaration, + ): void { context.report({ node: node.id, messageId: 'interfaceOverType', @@ -82,10 +81,10 @@ export default util.createRule({ return fixes; }, }); - } - }, - TSInterfaceDeclaration(node): void { - if (option === 'type') { + }, + }), + ...(option === 'type' && { + TSInterfaceDeclaration(node): void { context.report({ node: node.id, messageId: 'typeOverInterface', @@ -122,11 +121,24 @@ export default util.createRule({ }); } + if ( + node.parent?.type === + AST_NODE_TYPES.ExportDefaultDeclaration + ) { + fixes.push( + fixer.removeRange([node.parent.range[0], node.range[0]]), + fixer.insertTextAfter( + node.body, + `\nexport default ${node.id.name}`, + ), + ); + } + return fixes; }, }); - } - }, + }, + }), }; }, }); diff --git a/packages/eslint-plugin/src/rules/consistent-type-exports.ts b/packages/eslint-plugin/src/rules/consistent-type-exports.ts new file mode 100644 index 000000000000..98e6bd355e4c --- /dev/null +++ b/packages/eslint-plugin/src/rules/consistent-type-exports.ts @@ -0,0 +1,287 @@ +import { + TSESTree, + ParserServices, + AST_NODE_TYPES, + TSESLint, +} from '@typescript-eslint/experimental-utils'; +import { SymbolFlags } from 'typescript'; +import * as util from '../util'; + +type Options = []; + +interface SourceExports { + source: string; + reportValueExports: ReportValueExport[]; + typeOnlyNamedExport: TSESTree.ExportNamedDeclaration | null; + valueOnlyNamedExport: TSESTree.ExportNamedDeclaration | null; +} + +interface ReportValueExport { + node: TSESTree.ExportNamedDeclaration; + typeSpecifiers: TSESTree.ExportSpecifier[]; + valueSpecifiers: TSESTree.ExportSpecifier[]; +} + +type MessageIds = + | 'typeOverValue' + | 'singleExportIsType' + | 'multipleExportsAreTypes'; + +export default util.createRule({ + name: 'consistent-type-exports', + defaultOptions: [], + meta: { + type: 'suggestion', + docs: { + description: 'Enforces consistent usage of type exports', + recommended: false, + requiresTypeChecking: true, + }, + messages: { + typeOverValue: + 'All exports in the declaration are only used as types. Use `export type`.', + + singleExportIsType: + 'Type export {{exportNames}} is not a value and should be exported using `export type`.', + multipleExportsAreTypes: + 'Type exports {{exportNames}} are not values and should be exported using `export type`.', + }, + schema: [], + fixable: 'code', + }, + + create(context) { + const sourceCode = context.getSourceCode(); + const sourceExportsMap: { [key: string]: SourceExports } = {}; + const parserServices = util.getParserServices(context); + + return { + ExportNamedDeclaration(node: TSESTree.ExportNamedDeclaration): void { + // Coerce the source into a string for use as a lookup entry. + const source = getSourceFromExport(node) ?? 'undefined'; + const sourceExports = (sourceExportsMap[source] ||= { + source, + reportValueExports: [], + typeOnlyNamedExport: null, + valueOnlyNamedExport: null, + }); + + // Cache the first encountered exports for the package. We will need to come + // back to these later when fixing the problems. + if (node.exportKind === 'type') { + if (!sourceExports.typeOnlyNamedExport) { + // The export is a type export + sourceExports.typeOnlyNamedExport = node; + } + } else if (!sourceExports.valueOnlyNamedExport) { + // The export is a value export + sourceExports.valueOnlyNamedExport = node; + } + + // Next for the current export, we will separate type/value specifiers. + const typeSpecifiers: TSESTree.ExportSpecifier[] = []; + const valueSpecifiers: TSESTree.ExportSpecifier[] = []; + + // Note: it is valid to export values as types. We will avoid reporting errors + // when this is encountered. + if (node.exportKind !== 'type') { + for (const specifier of node.specifiers) { + const isTypeBased = isSpecifierTypeBased(parserServices, specifier); + + if (isTypeBased === true) { + typeSpecifiers.push(specifier); + } else if (isTypeBased === false) { + // When isTypeBased is undefined, we should avoid reporting them. + valueSpecifiers.push(specifier); + } + } + } + + if ( + (node.exportKind === 'value' && typeSpecifiers.length) || + (node.exportKind === 'type' && valueSpecifiers.length) + ) { + sourceExports.reportValueExports.push({ + node, + typeSpecifiers, + valueSpecifiers, + }); + } + }, + + 'Program:exit'(): void { + for (const sourceExports of Object.values(sourceExportsMap)) { + // If this export has no issues, move on. + if (sourceExports.reportValueExports.length === 0) { + continue; + } + + for (const report of sourceExports.reportValueExports) { + if (!report.valueSpecifiers.length) { + // Export is all type-only; convert the entire export to `export type`. + context.report({ + node: report.node, + messageId: 'typeOverValue', + *fix(fixer) { + yield* fixExportInsertType(fixer, sourceCode, report.node); + }, + }); + } else { + // We have both type and value violations. + const allExportNames = report.typeSpecifiers.map( + specifier => `${specifier.local.name}`, + ); + + if (allExportNames.length === 1) { + const exportNames = allExportNames[0]; + + context.report({ + node: report.node, + messageId: 'singleExportIsType', + data: { exportNames }, + *fix(fixer) { + yield* fixSeparateNamedExports(fixer, sourceCode, report); + }, + }); + } else { + const exportNames = util.formatWordList(allExportNames); + + context.report({ + node: report.node, + messageId: 'multipleExportsAreTypes', + data: { exportNames }, + *fix(fixer) { + yield* fixSeparateNamedExports(fixer, sourceCode, report); + }, + }); + } + } + } + } + }, + }; + }, +}); + +/** + * 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. + * + * Example: + * + * export type { Foo } from 'foo'; + * ^^^^ + */ +function* fixExportInsertType( + fixer: TSESLint.RuleFixer, + sourceCode: Readonly, + node: TSESTree.ExportNamedDeclaration, +): IterableIterator { + const exportToken = util.nullThrows( + sourceCode.getFirstToken(node), + util.NullThrowsReasons.MissingToken('export', node.type), + ); + + yield fixer.insertTextAfter(exportToken, ' type'); +} + +/** + * Separates the exports which mismatch the kind of export the given + * node represents. For example, a type export's named specifiers which + * represent values will be inserted in a separate `export` statement. + */ +function* fixSeparateNamedExports( + fixer: TSESLint.RuleFixer, + sourceCode: Readonly, + report: ReportValueExport, +): IterableIterator { + const { node, typeSpecifiers, valueSpecifiers } = report; + const source = getSourceFromExport(node); + const separateTypes = node.exportKind !== 'type'; + const specifiersToSeparate = separateTypes ? typeSpecifiers : valueSpecifiers; + const specifierNames = specifiersToSeparate.map(getSpecifierText).join(', '); + + const exportToken = util.nullThrows( + sourceCode.getFirstToken(node), + util.NullThrowsReasons.MissingToken('export', node.type), + ); + + // Filter the bad exports from the current line. + const filteredSpecifierNames = ( + separateTypes ? valueSpecifiers : typeSpecifiers + ) + .map(getSpecifierText) + .join(', '); + const openToken = util.nullThrows( + sourceCode.getFirstToken(node, util.isOpeningBraceToken), + util.NullThrowsReasons.MissingToken('{', node.type), + ); + const closeToken = util.nullThrows( + sourceCode.getLastToken(node, util.isClosingBraceToken), + util.NullThrowsReasons.MissingToken('}', node.type), + ); + + // Remove exports from the current line which we're going to re-insert. + yield fixer.replaceTextRange( + [openToken.range[1], closeToken.range[0]], + ` ${filteredSpecifierNames} `, + ); + + // Insert the bad exports into a new export line above. + yield fixer.insertTextBefore( + exportToken, + `export ${separateTypes ? 'type ' : ''}{ ${specifierNames} }${ + source ? ` from '${source}'` : '' + };\n`, + ); +} + +/** + * Returns the source of the export, or undefined if the named export has no source. + */ +function getSourceFromExport( + node: TSESTree.ExportNamedDeclaration, +): string | undefined { + if ( + node.source?.type === AST_NODE_TYPES.Literal && + typeof node.source.value === 'string' + ) { + return node.source.value; + } + + return undefined; +} + +/** + * Returns the specifier text for the export. If it is aliased, we take care to return + * the proper formatting. + */ +function getSpecifierText(specifier: TSESTree.ExportSpecifier): string { + return `${specifier.local.name}${ + specifier.exported.name !== specifier.local.name + ? ` as ${specifier.exported.name}` + : '' + }`; +} diff --git a/packages/eslint-plugin/src/rules/consistent-type-imports.ts b/packages/eslint-plugin/src/rules/consistent-type-imports.ts index 6a3067270a45..d549ab8f7289 100644 --- a/packages/eslint-plugin/src/rules/consistent-type-imports.ts +++ b/packages/eslint-plugin/src/rules/consistent-type-imports.ts @@ -31,13 +31,13 @@ interface ReportValueImport { } function isImportToken( - token: TSESTree.Token | TSESTree.Comment, + token: TSESTree.Token, ): token is TSESTree.KeywordToken & { value: 'import' } { return token.type === AST_TOKEN_TYPES.Keyword && token.value === 'import'; } function isTypeToken( - token: TSESTree.Token | TSESTree.Comment, + token: TSESTree.Token, ): token is TSESTree.IdentifierToken & { value: 'type' } { return token.type === AST_TOKEN_TYPES.Identifier && token.value === 'type'; } @@ -56,18 +56,18 @@ export default util.createRule({ type: 'suggestion', docs: { description: 'Enforces consistent usage of type imports', - category: 'Stylistic Issues', recommended: false, }, messages: { typeOverValue: - 'All imports in the declaration are only used as types. Use `import type`', - someImportsAreOnlyTypes: 'Imports {{typeImports}} are only used as types', - aImportIsOnlyTypes: 'Import {{typeImports}} is only used as types', + 'All imports in the declaration are only used as types. Use `import type`.', + someImportsAreOnlyTypes: + 'Imports {{typeImports}} are only used as types.', + aImportIsOnlyTypes: 'Import {{typeImports}} is only used as types.', someImportsInDecoMeta: - 'Type imports {{typeImports}} are used by decorator metadata', + 'Type imports {{typeImports}} are used by decorator metadata.', aImportInDecoMeta: - 'Type import {{typeImports}} is used by decorator metadata', + 'Type import {{typeImports}} is used by decorator metadata.', valueOverType: 'Use an `import` instead of an `import type`.', noImportTypeAnnotations: '`import()` type annotations are forbidden.', }, @@ -107,7 +107,7 @@ export default util.createRule({ ? { // prefer type imports ImportDeclaration(node: TSESTree.ImportDeclaration): void { - const source = node.source.value as string; + const source = node.source.value; const sourceImports = sourceImportsMap[source] ?? (sourceImportsMap[source] = { @@ -254,17 +254,19 @@ export default util.createRule({ const isTypeImport = report.node.importKind === 'type'; // we have a mixed type/value import, so we need to split them out into multiple exports - const importNames = (isTypeImport - ? report.valueSpecifiers - : report.typeSpecifiers + const importNames = ( + isTypeImport + ? report.valueSpecifiers + : report.typeSpecifiers ).map(specifier => `"${specifier.local.name}"`); const message = ((): { messageId: MessageIds; data: Record; } => { + const typeImports = util.formatWordList(importNames); + if (importNames.length === 1) { - const typeImports = importNames[0]; if (isTypeImport) { return { messageId: 'aImportInDecoMeta', @@ -277,10 +279,6 @@ export default util.createRule({ }; } } else { - const typeImports = [ - importNames.slice(0, -1).join(', '), - importNames.slice(-1)[0], - ].join(' and '); if (isTypeImport) { return { messageId: 'someImportsInDecoMeta', @@ -342,9 +340,7 @@ export default util.createRule({ : {}), }; - function classifySpecifier( - node: TSESTree.ImportDeclaration, - ): { + function classifySpecifier(node: TSESTree.ImportDeclaration): { defaultSpecifier: TSESTree.ImportDefaultSpecifier | null; namespaceSpecifier: TSESTree.ImportNamespaceSpecifier | null; namedSpecifiers: TSESTree.ImportSpecifier[]; @@ -358,10 +354,11 @@ export default util.createRule({ (specifier): specifier is TSESTree.ImportNamespaceSpecifier => specifier.type === AST_NODE_TYPES.ImportNamespaceSpecifier, ) ?? null; - const namedSpecifiers: TSESTree.ImportSpecifier[] = node.specifiers.filter( - (specifier): specifier is TSESTree.ImportSpecifier => - specifier.type === AST_NODE_TYPES.ImportSpecifier, - ); + const namedSpecifiers: TSESTree.ImportSpecifier[] = + node.specifiers.filter( + (specifier): specifier is TSESTree.ImportSpecifier => + specifier.type === AST_NODE_TYPES.ImportSpecifier, + ); return { defaultSpecifier, namespaceSpecifier, @@ -526,11 +523,8 @@ export default util.createRule({ ): IterableIterator { const { node } = report; - const { - defaultSpecifier, - namespaceSpecifier, - namedSpecifiers, - } = classifySpecifier(node); + const { defaultSpecifier, namespaceSpecifier, namedSpecifiers } = + classifySpecifier(node); if (namespaceSpecifier && !defaultSpecifier) { // e.g. @@ -737,11 +731,8 @@ export default util.createRule({ ): IterableIterator { const { node } = report; - const { - defaultSpecifier, - namespaceSpecifier, - namedSpecifiers, - } = classifySpecifier(node); + const { defaultSpecifier, namespaceSpecifier, namedSpecifiers } = + classifySpecifier(node); if (namespaceSpecifier) { // e.g. diff --git a/packages/eslint-plugin/src/rules/default-param-last.ts b/packages/eslint-plugin/src/rules/default-param-last.ts index dea41116911b..9673d852dd1d 100644 --- a/packages/eslint-plugin/src/rules/default-param-last.ts +++ b/packages/eslint-plugin/src/rules/default-param-last.ts @@ -10,7 +10,6 @@ export default createRule({ type: 'suggestion', docs: { description: 'Enforce default parameters to be last', - category: 'Best Practices', recommended: false, extendsBaseRule: true, }, diff --git a/packages/eslint-plugin/src/rules/dot-notation.ts b/packages/eslint-plugin/src/rules/dot-notation.ts index 2c9dd9f23514..01db4680cbec 100644 --- a/packages/eslint-plugin/src/rules/dot-notation.ts +++ b/packages/eslint-plugin/src/rules/dot-notation.ts @@ -1,13 +1,16 @@ import { TSESTree } from '@typescript-eslint/experimental-utils'; import * as ts from 'typescript'; -import baseRule from 'eslint/lib/rules/dot-notation'; +import * as tsutils from 'tsutils'; +import { getESLintCoreRule } from '../util/getESLintCoreRule'; import { - InferOptionsTypeFromRule, - InferMessageIdsTypeFromRule, createRule, getParserServices, + InferMessageIdsTypeFromRule, + InferOptionsTypeFromRule, } from '../util'; +const baseRule = getESLintCoreRule('dot-notation'); + export type Options = InferOptionsTypeFromRule; export type MessageIds = InferMessageIdsTypeFromRule; @@ -17,7 +20,6 @@ export default createRule({ type: 'suggestion', docs: { description: 'enforce dot notation whenever possible', - category: 'Best Practices', recommended: false, extendsBaseRule: true, requiresTypeChecking: true, @@ -42,44 +44,59 @@ export default createRule({ type: 'boolean', default: false, }, + allowIndexSignaturePropertyAccess: { + type: 'boolean', + default: false, + }, }, additionalProperties: false, }, ], fixable: baseRule.meta.fixable, + hasSuggestions: baseRule.meta.hasSuggestions, messages: baseRule.meta.messages, }, defaultOptions: [ { allowPrivateClassPropertyAccess: false, allowProtectedClassPropertyAccess: false, + allowIndexSignaturePropertyAccess: false, allowKeywords: true, allowPattern: '', }, ], create(context, [options]) { const rules = baseRule.create(context); + + const { program, esTreeNodeToTSNodeMap } = getParserServices(context); + const typeChecker = program.getTypeChecker(); + const allowPrivateClassPropertyAccess = options.allowPrivateClassPropertyAccess; const allowProtectedClassPropertyAccess = options.allowProtectedClassPropertyAccess; - - const parserServices = getParserServices(context); - const typeChecker = parserServices.program.getTypeChecker(); + const allowIndexSignaturePropertyAccess = + (options.allowIndexSignaturePropertyAccess ?? false) || + tsutils.isCompilerOptionEnabled( + program.getCompilerOptions(), + // @ts-expect-error - TS is refining the type to never for some reason + 'noPropertyAccessFromIndexSignature', + ); return { MemberExpression(node: TSESTree.MemberExpression): void { if ( (allowPrivateClassPropertyAccess || - allowProtectedClassPropertyAccess) && + allowProtectedClassPropertyAccess || + allowIndexSignaturePropertyAccess) && node.computed ) { - // for perf reasons - only fetch the symbol if we have to - const objectSymbol = typeChecker.getSymbolAtLocation( - parserServices.esTreeNodeToTSNodeMap.get(node.property), + // for perf reasons - only fetch symbols if we have to + const propertySymbol = typeChecker.getSymbolAtLocation( + esTreeNodeToTSNodeMap.get(node.property), ); - const modifierKind = objectSymbol?.getDeclarations()?.[0] - ?.modifiers?.[0].kind; + const modifierKind = + propertySymbol?.getDeclarations()?.[0]?.modifiers?.[0].kind; if ( (allowPrivateClassPropertyAccess && modifierKind == ts.SyntaxKind.PrivateKeyword) || @@ -88,6 +105,20 @@ export default createRule({ ) { return; } + if ( + propertySymbol === undefined && + allowIndexSignaturePropertyAccess + ) { + const objectType = typeChecker.getTypeAtLocation( + esTreeNodeToTSNodeMap.get(node.object), + ); + const indexType = objectType + .getNonNullableType() + .getStringIndexType(); + if (indexType != undefined) { + return; + } + } } rules.MemberExpression(node); }, 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 f0904f07744e..e9a27b2b1fc0 100644 --- a/packages/eslint-plugin/src/rules/explicit-function-return-type.ts +++ b/packages/eslint-plugin/src/rules/explicit-function-return-type.ts @@ -26,7 +26,6 @@ export default util.createRule({ docs: { description: 'Require explicit return types on functions and class methods', - category: 'Stylistic Issues', recommended: false, }, messages: { diff --git a/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts b/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts index 23ac95814c06..dc549fc1411b 100644 --- a/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts +++ b/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts @@ -1,8 +1,8 @@ import { AST_NODE_TYPES, - TSESTree, AST_TOKEN_TYPES, TSESLint, + TSESTree, } from '@typescript-eslint/experimental-utils'; import * as util from '../util'; @@ -36,7 +36,6 @@ export default util.createRule({ docs: { description: 'Require explicit accessibility modifiers on class properties and methods', - category: 'Stylistic Issues', // too opinionated to be recommended recommended: false, }, @@ -97,13 +96,13 @@ export default util.createRule({ fix: TSESLint.ReportFixFunction | null = null, ): void { context.report({ - node: node, - messageId: messageId, + node, + messageId, data: { type: nodeType, name: nodeName, }, - fix: fix, + fix, }); } @@ -114,6 +113,10 @@ export default util.createRule({ function checkMethodAccessibilityModifier( methodDefinition: TSESTree.MethodDefinition, ): void { + if (methodDefinition.key.type === AST_NODE_TYPES.PrivateIdentifier) { + return; + } + let nodeType = 'method definition'; let check = baseCheck; switch (methodDefinition.kind) { @@ -130,7 +133,10 @@ export default util.createRule({ break; } - const methodName = util.getNameFromMember(methodDefinition, sourceCode); + const { name: methodName } = util.getNameFromMember( + methodDefinition, + sourceCode, + ); if (check === 'off' || ignoredMethodNames.has(methodName)) { return; @@ -163,7 +169,9 @@ export default util.createRule({ function getUnwantedPublicAccessibilityFixer( node: | TSESTree.MethodDefinition - | TSESTree.ClassProperty + | TSESTree.PropertyDefinition + | TSESTree.TSAbstractMethodDefinition + | TSESTree.TSAbstractPropertyDefinition | TSESTree.TSParameterProperty, ): TSESLint.ReportFixFunction { return function (fixer: TSESLint.RuleFixer): TSESLint.RuleFix { @@ -175,9 +183,8 @@ export default util.createRule({ token.type === AST_TOKEN_TYPES.Keyword && token.value === 'public' ) { - const commensAfterPublicKeyword = sourceCode.getCommentsAfter( - token, - ); + const commensAfterPublicKeyword = + sourceCode.getCommentsAfter(token); if (commensAfterPublicKeyword.length) { // public /* Hi there! */ static foo() // ^^^^^^^ @@ -200,30 +207,38 @@ export default util.createRule({ /** * Checks if property has an accessibility modifier. - * @param classProperty The node representing a ClassProperty. + * @param propertyDefinition The node representing a PropertyDefinition. */ function checkPropertyAccessibilityModifier( - classProperty: TSESTree.ClassProperty, + propertyDefinition: + | TSESTree.PropertyDefinition + | TSESTree.TSAbstractPropertyDefinition, ): void { const nodeType = 'class property'; - const propertyName = util.getNameFromMember(classProperty, sourceCode); + const { name: propertyName } = util.getNameFromMember( + propertyDefinition, + sourceCode, + ); if ( propCheck === 'no-public' && - classProperty.accessibility === 'public' + propertyDefinition.accessibility === 'public' ) { reportIssue( 'unwantedPublicAccessibility', nodeType, - classProperty, + propertyDefinition, propertyName, - getUnwantedPublicAccessibilityFixer(classProperty), + getUnwantedPublicAccessibilityFixer(propertyDefinition), ); - } else if (propCheck === 'explicit' && !classProperty.accessibility) { + } else if ( + propCheck === 'explicit' && + !propertyDefinition.accessibility + ) { reportIssue( 'missingAccessibility', nodeType, - classProperty, + propertyDefinition, propertyName, ); } @@ -274,9 +289,11 @@ export default util.createRule({ } return { + 'MethodDefinition, TSAbstractMethodDefinition': + checkMethodAccessibilityModifier, + 'PropertyDefinition, TSAbstractPropertyDefinition': + checkPropertyAccessibilityModifier, TSParameterProperty: checkParameterPropertyAccessibilityModifier, - ClassProperty: checkPropertyAccessibilityModifier, - MethodDefinition: checkMethodAccessibilityModifier, }; }, }); 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 bdcd9750c887..adaacaf363f6 100644 --- a/packages/eslint-plugin/src/rules/explicit-module-boundary-types.ts +++ b/packages/eslint-plugin/src/rules/explicit-module-boundary-types.ts @@ -1,7 +1,8 @@ import { - TSESTree, AST_NODE_TYPES, + TSESTree, } from '@typescript-eslint/experimental-utils'; +import { DefinitionType } from '@typescript-eslint/scope-manager'; import * as util from '../util'; import { checkFunctionExpressionReturnType, @@ -36,8 +37,7 @@ export default util.createRule({ docs: { description: "Require explicit return and argument types on exported functions' and classes' public class methods", - category: 'Stylistic Issues', - recommended: 'warn', + recommended: false, }, messages: { missingReturnType: 'Missing return type on function.', @@ -129,7 +129,6 @@ export default util.createRule({ TSExportAssignment(node): void { checkNode(node.expression); }, - 'ArrowFunctionExpression, FunctionDeclaration, FunctionExpression'( node: FunctionNode, ): void { @@ -294,11 +293,12 @@ export default util.createRule({ for (const definition of variable.defs) { // cases we don't care about in this rule if ( - definition.type === 'ImplicitGlobalVariable' || - definition.type === 'ImportBinding' || - // eslint-disable-next-line @typescript-eslint/internal/prefer-ast-types-enum - definition.type === 'CatchClause' || - definition.type === 'Parameter' + [ + DefinitionType.ImplicitGlobalVariable, + DefinitionType.ImportBinding, + DefinitionType.CatchClause, + DefinitionType.Parameter, + ].includes(definition.type) ) { continue; } @@ -335,9 +335,11 @@ export default util.createRule({ } return; - case AST_NODE_TYPES.ClassProperty: - case AST_NODE_TYPES.TSAbstractClassProperty: - if (node.accessibility === 'private') { + case AST_NODE_TYPES.PropertyDefinition: + if ( + node.accessibility === 'private' || + node.key.type === AST_NODE_TYPES.PrivateIdentifier + ) { return; } return checkNode(node.value); @@ -354,7 +356,10 @@ export default util.createRule({ case AST_NODE_TYPES.MethodDefinition: case AST_NODE_TYPES.TSAbstractMethodDefinition: - if (node.accessibility === 'private') { + if ( + node.accessibility === 'private' || + node.key.type === AST_NODE_TYPES.PrivateIdentifier + ) { return; } return checkNode(node.value); diff --git a/packages/eslint-plugin/src/rules/func-call-spacing.ts b/packages/eslint-plugin/src/rules/func-call-spacing.ts index 08d72181eeb6..254f89396601 100644 --- a/packages/eslint-plugin/src/rules/func-call-spacing.ts +++ b/packages/eslint-plugin/src/rules/func-call-spacing.ts @@ -19,7 +19,6 @@ export default util.createRule({ docs: { description: 'Require or disallow spacing between function identifiers and their invocations', - category: 'Stylistic Issues', recommended: false, extendsBaseRule: true, }, diff --git a/packages/eslint-plugin/src/rules/indent-new-do-not-use/BinarySearchTree.ts b/packages/eslint-plugin/src/rules/indent-new-do-not-use/BinarySearchTree.ts index 0010750ebfd8..7c4b78f5b7b5 100644 --- a/packages/eslint-plugin/src/rules/indent-new-do-not-use/BinarySearchTree.ts +++ b/packages/eslint-plugin/src/rules/indent-new-do-not-use/BinarySearchTree.ts @@ -4,10 +4,9 @@ import { TSESTree } from '@typescript-eslint/experimental-utils'; import createTree from 'functional-red-black-tree'; -export type TokenOrComment = TSESTree.Token | TSESTree.Comment; export interface TreeValue { offset: number; - from: TokenOrComment | null; + from: TSESTree.Token | null; force: boolean; } diff --git a/packages/eslint-plugin/src/rules/indent-new-do-not-use/OffsetStorage.ts b/packages/eslint-plugin/src/rules/indent-new-do-not-use/OffsetStorage.ts index d19334672630..6feea3d95ada 100644 --- a/packages/eslint-plugin/src/rules/indent-new-do-not-use/OffsetStorage.ts +++ b/packages/eslint-plugin/src/rules/indent-new-do-not-use/OffsetStorage.ts @@ -2,11 +2,7 @@ // License: https://github.com/eslint/eslint/blob/48700fc8408f394887cdedd071b22b757700fdcb/LICENSE import { TSESTree } from '@typescript-eslint/experimental-utils'; -import { - BinarySearchTree, - TokenOrComment, - TreeValue, -} from './BinarySearchTree'; +import { BinarySearchTree, TreeValue } from './BinarySearchTree'; import { TokenInfo } from './TokenInfo'; /** @@ -17,9 +13,9 @@ export class OffsetStorage { private readonly indentSize: number; private readonly indentType: string; private readonly tree: BinarySearchTree; - private readonly lockedFirstTokens: WeakMap; - private readonly desiredIndentCache: WeakMap; - private readonly ignoredTokens: WeakSet; + private readonly lockedFirstTokens: WeakMap; + private readonly desiredIndentCache: WeakMap; + private readonly ignoredTokens: WeakSet; /** * @param tokenInfo a TokenInfo instance * @param indentSize The desired size of each indentation level @@ -38,7 +34,7 @@ export class OffsetStorage { this.ignoredTokens = new WeakSet(); } - private getOffsetDescriptor(token: TokenOrComment): TreeValue { + private getOffsetDescriptor(token: TSESTree.Token): TreeValue { return this.tree.findLe(token.range[0]).value; } @@ -50,8 +46,8 @@ export class OffsetStorage { * @param offsetToken The second token, whose offset should be matched to the first token */ public matchOffsetOf( - baseToken: TokenOrComment, - offsetToken: TokenOrComment, + baseToken: TSESTree.Token, + offsetToken: TSESTree.Token, ): void { /* * lockedFirstTokens is a map from a token whose indentation is controlled by the "first" option to @@ -120,8 +116,8 @@ export class OffsetStorage { * @param offset The desired indent level */ public setDesiredOffset( - token: TokenOrComment, - fromToken: TokenOrComment | null, + token: TSESTree.Token, + fromToken: TSESTree.Token | null, offset: number, ): void { this.setDesiredOffsets(token.range, fromToken, offset); @@ -154,7 +150,7 @@ export class OffsetStorage { */ public setDesiredOffsets( range: [number, number], - fromToken: TokenOrComment | null, + fromToken: TSESTree.Token | null, offset = 0, force = false, ): void { @@ -183,7 +179,7 @@ export class OffsetStorage { fromToken.range[1] <= range[1]; // this has to be before the delete + insert below or else you'll get into a cycle const fromTokenDescriptor = fromTokenIsInRange - ? this.getOffsetDescriptor(fromToken!) + ? this.getOffsetDescriptor(fromToken) : null; // First, remove any existing nodes in the range from the tree. @@ -197,8 +193,8 @@ export class OffsetStorage { * even if it's in the current range. */ if (fromTokenIsInRange) { - this.tree.insert(fromToken!.range[0], fromTokenDescriptor!); - this.tree.insert(fromToken!.range[1], descriptorToInsert); + this.tree.insert(fromToken.range[0], fromTokenDescriptor!); + this.tree.insert(fromToken.range[1], descriptorToInsert); } /* @@ -212,7 +208,7 @@ export class OffsetStorage { * Gets the desired indent of a token * @returns The desired indent of the token */ - public getDesiredIndent(token: TokenOrComment): string { + public getDesiredIndent(token: TSESTree.Token): string { if (!this.desiredIndentCache.has(token)) { if (this.ignoredTokens.has(token)) { /* @@ -263,7 +259,7 @@ export class OffsetStorage { /** * Ignores a token, preventing it from being reported. */ - ignoreToken(token: TokenOrComment): void { + ignoreToken(token: TSESTree.Token): void { if (this.tokenInfo.isFirstTokenOfLine(token)) { this.ignoredTokens.add(token); } diff --git a/packages/eslint-plugin/src/rules/indent-new-do-not-use/TokenInfo.ts b/packages/eslint-plugin/src/rules/indent-new-do-not-use/TokenInfo.ts index 16d15c4ae5f1..7dd27346560b 100644 --- a/packages/eslint-plugin/src/rules/indent-new-do-not-use/TokenInfo.ts +++ b/packages/eslint-plugin/src/rules/indent-new-do-not-use/TokenInfo.ts @@ -2,14 +2,13 @@ // License: https://github.com/eslint/eslint/blob/48700fc8408f394887cdedd071b22b757700fdcb/LICENSE import { TSESLint, TSESTree } from '@typescript-eslint/experimental-utils'; -import { TokenOrComment } from './BinarySearchTree'; /** * A helper class to get token-based info related to indentation */ export class TokenInfo { private readonly sourceCode: TSESLint.SourceCode; - public firstTokensByLineNumber: Map; + public readonly firstTokensByLineNumber: Map; constructor(sourceCode: TSESLint.SourceCode) { this.sourceCode = sourceCode; @@ -28,7 +27,7 @@ export class TokenInfo { } return map; }, - new Map(), + new Map(), ); } @@ -37,8 +36,8 @@ export class TokenInfo { * @returns The first token on the given line */ public getFirstTokenOfLine( - token: TokenOrComment | TSESTree.Node, - ): TokenOrComment { + token: TSESTree.Token | TSESTree.Node, + ): TSESTree.Token { return this.firstTokensByLineNumber.get(token.loc.start.line)!; } @@ -46,7 +45,7 @@ export class TokenInfo { * Determines whether a token is the first token in its line * @returns `true` if the token is the first on its line */ - public isFirstTokenOfLine(token: TokenOrComment): boolean { + public isFirstTokenOfLine(token: TSESTree.Token): boolean { return this.getFirstTokenOfLine(token) === token; } @@ -55,7 +54,7 @@ export class TokenInfo { * @param token Token to examine. This should be the first token on its line. * @returns The indentation characters that precede the token */ - public getTokenIndent(token: TokenOrComment): string { + public getTokenIndent(token: TSESTree.Token): string { return this.sourceCode.text.slice( token.range[0] - token.loc.start.column, token.range[0], diff --git a/packages/eslint-plugin/src/rules/indent-new-do-not-use/index.ts b/packages/eslint-plugin/src/rules/indent-new-do-not-use/index.ts index 7b6bf6d35b99..58da2c044e10 100644 --- a/packages/eslint-plugin/src/rules/indent-new-do-not-use/index.ts +++ b/packages/eslint-plugin/src/rules/indent-new-do-not-use/index.ts @@ -9,7 +9,6 @@ import { TSESTree, } from '@typescript-eslint/experimental-utils'; -import { TokenOrComment } from './BinarySearchTree'; import { OffsetStorage } from './OffsetStorage'; import { TokenInfo } from './TokenInfo'; import { @@ -114,7 +113,7 @@ const KNOWN_NODES = new Set([ AST_NODE_TYPES.ImportNamespaceSpecifier, // Class properties aren't yet supported by eslint... - AST_NODE_TYPES.ClassProperty, + AST_NODE_TYPES.PropertyDefinition, // ts keywords AST_NODE_TYPES.TSAbstractKeyword, @@ -130,7 +129,7 @@ const KNOWN_NODES = new Set([ AST_NODE_TYPES.TSNullKeyword, // ts specific nodes we want to support - AST_NODE_TYPES.TSAbstractClassProperty, + AST_NODE_TYPES.TSAbstractPropertyDefinition, AST_NODE_TYPES.TSAbstractMethodDefinition, AST_NODE_TYPES.TSArrayType, AST_NODE_TYPES.TSAsExpression, @@ -162,7 +161,6 @@ const KNOWN_NODES = new Set([ AST_NODE_TYPES.TSModuleDeclaration, AST_NODE_TYPES.TSNonNullExpression, AST_NODE_TYPES.TSParameterProperty, - AST_NODE_TYPES.TSParenthesizedType, 'TSPlusToken', AST_NODE_TYPES.TSPropertySignature, AST_NODE_TYPES.TSQualifiedName, @@ -259,7 +257,6 @@ export default createRule({ type: 'layout', docs: { description: 'Enforce consistent indentation.', - category: 'Stylistic Issues', recommended: false, }, fixable: 'whitespace', @@ -474,7 +471,7 @@ export default createRule({ * @param token Token violating the indent rule * @param neededIndent Expected indentation string */ - function report(token: TokenOrComment, neededIndent: string): void { + function report(token: TSESTree.Token, neededIndent: string): void { const actualIndent = Array.from(tokenInfo.getTokenIndent(token)); const numSpaces = actualIndent.filter(char => char === ' ').length; const numTabs = actualIndent.filter(char => char === '\t').length; @@ -503,7 +500,7 @@ export default createRule({ * @returns `true` if the token's indentation is correct */ function validateTokenIndent( - token: TokenOrComment, + token: TSESTree.Token, desiredIndent: string, ): boolean { const indentation = tokenInfo.getTokenIndent(token); @@ -1016,9 +1013,8 @@ export default createRule({ token.type === AST_TOKEN_TYPES.Punctuator && token.value === ':', )!; - const firstConsequentToken = sourceCode.getTokenAfter( - questionMarkToken, - )!; + const firstConsequentToken = + sourceCode.getTokenAfter(questionMarkToken)!; const lastConsequentToken = sourceCode.getTokenBefore(colonToken)!; const firstAlternateToken = sourceCode.getTokenAfter(colonToken)!; @@ -1208,9 +1204,8 @@ export default createRule({ node.property, isNotClosingParenToken, )!; - const secondNonObjectToken = sourceCode.getTokenAfter( - firstNonObjectToken, - )!; + const secondNonObjectToken = + sourceCode.getTokenAfter(firstNonObjectToken)!; const objectParenCount = sourceCode.getTokensBetween( object, @@ -1653,23 +1648,21 @@ export default createRule({ addParensIndent(sourceCode.ast.tokens); /* - * Create a Map from (tokenOrComment) => (precedingToken). + * Create a Map from (token) => (precedingToken). * This is necessary because sourceCode.getTokenBefore does not handle a comment as an argument correctly. */ const precedingTokens = sourceCode.ast.comments.reduce( (commentMap, comment) => { - const tokenOrCommentBefore = sourceCode.getTokenBefore(comment, { + const tokenBefore = sourceCode.getTokenBefore(comment, { includeComments: true, })!; return commentMap.set( comment, - commentMap.has(tokenOrCommentBefore) - ? commentMap.get(tokenOrCommentBefore) - : tokenOrCommentBefore, + commentMap.get(tokenBefore) ?? tokenBefore, ); }, - new WeakMap(), + new WeakMap(), ); sourceCode.lines.forEach((_, lineIndex) => { @@ -1680,9 +1673,8 @@ export default createRule({ return; } - const firstTokenOfLine = tokenInfo.firstTokensByLineNumber.get( - lineNumber, - )!; + const firstTokenOfLine = + tokenInfo.firstTokensByLineNumber.get(lineNumber)!; if (firstTokenOfLine.loc.start.line !== lineNumber) { // Don't check the indentation of multi-line tokens (e.g. template literals or block comments) twice. @@ -1700,7 +1692,7 @@ export default createRule({ } if (isCommentToken(firstTokenOfLine)) { - const tokenBefore = precedingTokens.get(firstTokenOfLine); + const tokenBefore = precedingTokens.get(firstTokenOfLine)!; const tokenAfter = tokenBefore ? sourceCode.getTokenAfter(tokenBefore)! : sourceCode.ast.tokens[0]; diff --git a/packages/eslint-plugin/src/rules/indent.ts b/packages/eslint-plugin/src/rules/indent.ts index 9ac6a1593d9c..e057ca9886b3 100644 --- a/packages/eslint-plugin/src/rules/indent.ts +++ b/packages/eslint-plugin/src/rules/indent.ts @@ -3,21 +3,23 @@ * This is due to some really funky type conversions between different node types. * This is done intentionally based on the internal implementation of the base indent rule. */ -/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-assignment */ import { TSESTree, AST_NODE_TYPES, } from '@typescript-eslint/experimental-utils'; -import baseRule from 'eslint/lib/rules/indent'; +import { getESLintCoreRule } from '../util/getESLintCoreRule'; import * as util from '../util'; +const baseRule = getESLintCoreRule('indent'); + type Options = util.InferOptionsTypeFromRule; type MessageIds = util.InferMessageIdsTypeFromRule; const KNOWN_NODES = new Set([ // Class properties aren't yet supported by eslint... - AST_NODE_TYPES.ClassProperty, + AST_NODE_TYPES.PropertyDefinition, // ts keywords AST_NODE_TYPES.TSAbstractKeyword, @@ -33,7 +35,7 @@ const KNOWN_NODES = new Set([ AST_NODE_TYPES.TSNullKeyword, // ts specific nodes we want to support - AST_NODE_TYPES.TSAbstractClassProperty, + AST_NODE_TYPES.TSAbstractPropertyDefinition, AST_NODE_TYPES.TSAbstractMethodDefinition, AST_NODE_TYPES.TSArrayType, AST_NODE_TYPES.TSAsExpression, @@ -65,7 +67,6 @@ const KNOWN_NODES = new Set([ AST_NODE_TYPES.TSModuleDeclaration, AST_NODE_TYPES.TSNonNullExpression, AST_NODE_TYPES.TSParameterProperty, - AST_NODE_TYPES.TSParenthesizedType, 'TSPlusToken', AST_NODE_TYPES.TSPropertySignature, AST_NODE_TYPES.TSQualifiedName, @@ -90,17 +91,14 @@ export default util.createRule({ type: 'layout', docs: { description: 'Enforce consistent indentation', - category: 'Stylistic Issues', // too opinionated to be recommended recommended: false, extendsBaseRule: true, }, fixable: 'whitespace', + hasSuggestions: baseRule.meta.hasSuggestions, schema: baseRule.meta.schema, - messages: baseRule.meta.messages ?? { - wrongIndentation: - 'Expected indentation of {{expected}} but found {{actual}}.', - }, + messages: baseRule.meta.messages, }, defaultOptions: [ // typescript docs and playground use 4 space indent @@ -138,7 +136,7 @@ export default util.createRule({ | TSESTree.TSEnumMember | TSESTree.TypeElement, type: - | AST_NODE_TYPES.ClassProperty + | AST_NODE_TYPES.PropertyDefinition | AST_NODE_TYPES.Property = AST_NODE_TYPES.Property, ): TSESTree.Node | null { const base = { @@ -170,7 +168,7 @@ export default util.createRule({ readonly: false, declare: false, ...base, - } as TSESTree.ClassProperty; + } as TSESTree.PropertyDefinition; } } @@ -241,10 +239,9 @@ export default util.createRule({ // transform it to an ObjectExpression return rules['ObjectExpression, ObjectPattern']({ type: AST_NODE_TYPES.ObjectExpression, - properties: (node.members as ( - | TSESTree.TSEnumMember - | TSESTree.TypeElement - )[]).map( + properties: ( + node.members as (TSESTree.TSEnumMember | TSESTree.TypeElement)[] + ).map( member => TSPropertySignatureToProperty(member) as TSESTree.Property, ), @@ -333,8 +330,8 @@ export default util.createRule({ p => TSPropertySignatureToProperty( p, - AST_NODE_TYPES.ClassProperty, - ) as TSESTree.ClassProperty, + AST_NODE_TYPES.PropertyDefinition, + ) as TSESTree.PropertyDefinition, ), // location data @@ -396,7 +393,7 @@ export default util.createRule({ computed: false, method: false, shorthand: false, - } as any, + }, ], // location data diff --git a/packages/eslint-plugin/src/rules/index.ts b/packages/eslint-plugin/src/rules/index.ts index ffa70e57a290..83e76f0a23d0 100644 --- a/packages/eslint-plugin/src/rules/index.ts +++ b/packages/eslint-plugin/src/rules/index.ts @@ -11,6 +11,7 @@ import commaSpacing from './comma-spacing'; import consistentIndexedObjectStyle from './consistent-indexed-object-style'; import consistentTypeAssertions from './consistent-type-assertions'; import consistentTypeDefinitions from './consistent-type-definitions'; +import consistentTypeExports from './consistent-type-exports'; import consistentTypeImports from './consistent-type-imports'; import defaultParamLast from './default-param-last'; import dotNotation from './dot-notation'; @@ -50,14 +51,17 @@ import noInvalidVoidType from './no-invalid-void-type'; import noLoopFunc from './no-loop-func'; import noLossOfPrecision from './no-loss-of-precision'; import noMagicNumbers from './no-magic-numbers'; +import noMeaninglessVoidOperator from './no-meaningless-void-operator'; import noMisusedNew from './no-misused-new'; import noMisusedPromises from './no-misused-promises'; 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 noRequireImports from './no-require-imports'; +import noRestrictedImports from './no-restricted-imports'; import noShadow from './no-shadow'; import noThisAlias from './no-this-alias'; import noThrowLiteral from './no-throw-literal'; @@ -68,18 +72,19 @@ import noUnnecessaryQualifier from './no-unnecessary-qualifier'; import noUnnecessaryTypeArguments from './no-unnecessary-type-arguments'; import noUnnecessaryTypeAssertion from './no-unnecessary-type-assertion'; import noUnnecessaryTypeConstraint from './no-unnecessary-type-constraint'; +import noUnsafeArgument from './no-unsafe-argument'; import noUnsafeAssignment from './no-unsafe-assignment'; import noUnsafeCall from './no-unsafe-call'; import noUnsafeMemberAccess from './no-unsafe-member-access'; import noUnsafeReturn from './no-unsafe-return'; import noUnusedExpressions from './no-unused-expressions'; import noUnusedVars from './no-unused-vars'; -import noUnusedVarsExperimental from './no-unused-vars-experimental'; import noUseBeforeDefine from './no-use-before-define'; import noUselessConstructor from './no-useless-constructor'; import noVarRequires from './no-var-requires'; import nonNullableTypeAssertionStyle from './non-nullable-type-assertion-style'; import objectCurlySpacing from './object-curly-spacing'; +import paddingLineBetweenStatements from './padding-line-between-statements'; import preferAsConst from './prefer-as-const'; import preferEnumInitializers from './prefer-enum-initializers'; import preferForOf from './prefer-for-of'; @@ -93,6 +98,7 @@ import preferReadonly from './prefer-readonly'; import preferReadonlyParameterTypes from './prefer-readonly-parameter-types'; import preferReduceTypeParameter from './prefer-reduce-type-parameter'; import preferRegexpExec from './prefer-regexp-exec'; +import preferReturnThisType from './prefer-return-this-type'; import preferStringStartsEndsWith from './prefer-string-starts-ends-with'; import preferTsExpectError from './prefer-ts-expect-error'; import promiseFunctionAsync from './promise-function-async'; @@ -128,6 +134,7 @@ export default { 'consistent-indexed-object-style': consistentIndexedObjectStyle, 'consistent-type-assertions': consistentTypeAssertions, 'consistent-type-definitions': consistentTypeDefinitions, + 'consistent-type-exports': consistentTypeExports, 'consistent-type-imports': consistentTypeImports, 'default-param-last': defaultParamLast, 'dot-notation': dotNotation, @@ -167,14 +174,17 @@ export default { 'no-loop-func': noLoopFunc, 'no-loss-of-precision': noLossOfPrecision, 'no-magic-numbers': noMagicNumbers, + 'no-meaningless-void-operator': noMeaninglessVoidOperator, 'no-misused-new': noMisusedNew, 'no-misused-promises': noMisusedPromises, 'no-namespace': noNamespace, + '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-require-imports': noRequireImports, + 'no-restricted-imports': noRestrictedImports, 'no-shadow': noShadow, 'no-this-alias': noThisAlias, 'no-throw-literal': noThrowLiteral, @@ -185,18 +195,19 @@ export default { 'no-unnecessary-type-arguments': noUnnecessaryTypeArguments, 'no-unnecessary-type-assertion': noUnnecessaryTypeAssertion, 'no-unnecessary-type-constraint': noUnnecessaryTypeConstraint, + 'no-unsafe-argument': noUnsafeArgument, 'no-unsafe-assignment': noUnsafeAssignment, 'no-unsafe-call': noUnsafeCall, 'no-unsafe-member-access': noUnsafeMemberAccess, 'no-unsafe-return': noUnsafeReturn, 'no-unused-expressions': noUnusedExpressions, 'no-unused-vars': noUnusedVars, - 'no-unused-vars-experimental': noUnusedVarsExperimental, 'no-use-before-define': noUseBeforeDefine, 'no-useless-constructor': noUselessConstructor, 'no-var-requires': noVarRequires, 'non-nullable-type-assertion-style': nonNullableTypeAssertionStyle, 'object-curly-spacing': objectCurlySpacing, + 'padding-line-between-statements': paddingLineBetweenStatements, 'prefer-as-const': preferAsConst, 'prefer-enum-initializers': preferEnumInitializers, 'prefer-for-of': preferForOf, @@ -210,6 +221,7 @@ export default { 'prefer-readonly-parameter-types': preferReadonlyParameterTypes, 'prefer-reduce-type-parameter': preferReduceTypeParameter, 'prefer-regexp-exec': preferRegexpExec, + 'prefer-return-this-type': preferReturnThisType, 'prefer-string-starts-ends-with': preferStringStartsEndsWith, 'prefer-ts-expect-error': preferTsExpectError, 'promise-function-async': promiseFunctionAsync, diff --git a/packages/eslint-plugin/src/rules/init-declarations.ts b/packages/eslint-plugin/src/rules/init-declarations.ts index 5706006852b2..6cd83e636f9e 100644 --- a/packages/eslint-plugin/src/rules/init-declarations.ts +++ b/packages/eslint-plugin/src/rules/init-declarations.ts @@ -1,14 +1,16 @@ import { - TSESTree, AST_NODE_TYPES, + TSESTree, } from '@typescript-eslint/experimental-utils'; -import baseRule from 'eslint/lib/rules/init-declarations'; +import { getESLintCoreRule } from '../util/getESLintCoreRule'; import { - InferOptionsTypeFromRule, - InferMessageIdsTypeFromRule, createRule, + InferMessageIdsTypeFromRule, + InferOptionsTypeFromRule, } from '../util'; +const baseRule = getESLintCoreRule('init-declarations'); + export type Options = InferOptionsTypeFromRule; export type MessageIds = InferMessageIdsTypeFromRule; @@ -19,22 +21,16 @@ export default createRule({ docs: { description: 'require or disallow initialization in variable declarations', - category: 'Variables', recommended: false, extendsBaseRule: true, }, + hasSuggestions: baseRule.meta.hasSuggestions, schema: baseRule.meta.schema, - messages: baseRule.meta.messages ?? { - initialized: - "Variable '{{idName}}' should be initialized on declaration.", - notInitialized: - "Variable '{{idName}}' should not be initialized on declaration.", - }, + messages: baseRule.meta.messages, }, defaultOptions: ['always'], - create(context) { + create(context, [mode]) { const rules = baseRule.create(context); - const mode = context.options[0] || 'always'; return { 'VariableDeclaration:exit'(node: TSESTree.VariableDeclaration): void { diff --git a/packages/eslint-plugin/src/rules/keyword-spacing.ts b/packages/eslint-plugin/src/rules/keyword-spacing.ts index 2265b2604436..a5620fb7d530 100644 --- a/packages/eslint-plugin/src/rules/keyword-spacing.ts +++ b/packages/eslint-plugin/src/rules/keyword-spacing.ts @@ -1,7 +1,9 @@ import { AST_TOKEN_TYPES } from '@typescript-eslint/experimental-utils'; -import baseRule from 'eslint/lib/rules/keyword-spacing'; +import { getESLintCoreRule } from '../util/getESLintCoreRule'; import * as util from '../util'; +const baseRule = getESLintCoreRule('keyword-spacing'); + export type Options = util.InferOptionsTypeFromRule; export type MessageIds = util.InferMessageIdsTypeFromRule; @@ -11,18 +13,13 @@ export default util.createRule({ type: 'layout', docs: { description: 'Enforce consistent spacing before and after keywords', - category: 'Stylistic Issues', recommended: false, extendsBaseRule: true, }, fixable: 'whitespace', + hasSuggestions: baseRule.meta.hasSuggestions, schema: baseRule.meta.schema, - messages: baseRule.meta.messages ?? { - expectedBefore: 'Expected space(s) before "{{value}}".', - expectedAfter: 'Expected space(s) after "{{value}}".', - unexpectedBefore: 'Unexpected space(s) before "{{value}}".', - unexpectedAfter: 'Unexpected space(s) after "{{value}}".', - }, + messages: baseRule.meta.messages, }, defaultOptions: [{}], 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 fc89f43c15c8..c78216b125fc 100644 --- a/packages/eslint-plugin/src/rules/lines-between-class-members.ts +++ b/packages/eslint-plugin/src/rules/lines-between-class-members.ts @@ -2,9 +2,11 @@ import { AST_NODE_TYPES, TSESTree, } from '@typescript-eslint/experimental-utils'; -import baseRule from 'eslint/lib/rules/lines-between-class-members'; +import { getESLintCoreRule } from '../util/getESLintCoreRule'; import * as util from '../util'; +const baseRule = getESLintCoreRule('lines-between-class-members'); + type Options = util.InferOptionsTypeFromRule; type MessageIds = util.InferMessageIdsTypeFromRule; @@ -26,16 +28,13 @@ export default util.createRule({ type: 'layout', docs: { description: 'Require or disallow an empty line between class members', - category: 'Stylistic Issues', recommended: false, extendsBaseRule: true, }, fixable: 'whitespace', + hasSuggestions: baseRule.meta.hasSuggestions, schema, - messages: baseRule.meta.messages ?? { - never: 'Unexpected blank line between class members.', - always: 'Expected blank line between class members.', - }, + messages: baseRule.meta.messages, }, defaultOptions: [ 'always', @@ -44,14 +43,15 @@ export default util.createRule({ exceptAfterSingleLine: false, }, ], - create(context, options) { + create(context, [firstOption, secondOption]) { const rules = baseRule.create(context); const exceptAfterOverload = - options[1]?.exceptAfterOverload && options[0] === 'always'; + secondOption?.exceptAfterOverload && firstOption === 'always'; function isOverload(node: TSESTree.Node): boolean { return ( - node.type === AST_NODE_TYPES.MethodDefinition && + (node.type === AST_NODE_TYPES.TSAbstractMethodDefinition || + node.type === AST_NODE_TYPES.MethodDefinition) && node.value.type === AST_NODE_TYPES.TSEmptyBodyFunctionExpression ); } diff --git a/packages/eslint-plugin/src/rules/member-delimiter-style.ts b/packages/eslint-plugin/src/rules/member-delimiter-style.ts index 64147b37cf2a..5fa5a863a6fd 100644 --- a/packages/eslint-plugin/src/rules/member-delimiter-style.ts +++ b/packages/eslint-plugin/src/rules/member-delimiter-style.ts @@ -1,4 +1,5 @@ import { + TSESLint, TSESTree, AST_NODE_TYPES, } from '@typescript-eslint/experimental-utils'; @@ -11,6 +12,9 @@ type TypeOptions = { delimiter?: Delimiter; requireLast?: boolean; }; +type TypeOptionsWithType = TypeOptions & { + type: string; +}; // eslint-disable-next-line @typescript-eslint/consistent-type-definitions type BaseOptions = { multiline?: TypeOptions; @@ -29,6 +33,20 @@ type MessageIds = | 'unexpectedSemi' | 'expectedComma' | 'expectedSemi'; +type LastTokenType = TSESTree.Token; + +interface MakeFixFunctionParams { + optsNone: boolean; + optsSemi: boolean; + lastToken: LastTokenType; + missingDelimiter: boolean; + lastTokenLine: string; + isSingleLine: boolean; +} + +type MakeFixFunctionReturnType = + | ((fixer: TSESLint.RuleFixer) => TSESLint.RuleFix) + | null; const definition = { type: 'object', @@ -54,6 +72,47 @@ const definition = { additionalProperties: false, }; +const isLastTokenEndOfLine = (token: string, line: string): boolean => { + const positionInLine = line.indexOf(token); + + return positionInLine === line.length - 1; +}; + +const makeFixFunction = ({ + optsNone, + optsSemi, + lastToken, + missingDelimiter, + lastTokenLine, + isSingleLine, +}: MakeFixFunctionParams): MakeFixFunctionReturnType => { + // if removing is the action but last token is not the end of the line + if ( + optsNone && + !isLastTokenEndOfLine(lastToken.value, lastTokenLine) && + !isSingleLine + ) { + return null; + } + + return (fixer: TSESLint.RuleFixer): TSESLint.RuleFix => { + if (optsNone) { + // remove the unneeded token + return fixer.remove(lastToken); + } + + const token = optsSemi ? ';' : ','; + + if (missingDelimiter) { + // add the missing delimiter + return fixer.insertTextAfter(lastToken, token); + } + + // correct the current delimiter + return fixer.replaceText(lastToken, token); + }; +}; + export default util.createRule({ name: 'member-delimiter-style', meta: { @@ -61,7 +120,6 @@ export default util.createRule({ docs: { description: 'Require a specific member delimiter style for interfaces and type literals', - category: 'Stylistic Issues', recommended: false, }, fixable: 'code', @@ -127,7 +185,7 @@ export default util.createRule({ */ function checkLastToken( member: TSESTree.TypeElement, - opts: TypeOptions, + opts: TypeOptionsWithType, isLast: boolean, ): void { /** @@ -147,10 +205,14 @@ export default util.createRule({ const lastToken = sourceCode.getLastToken(member, { includeComments: false, }); + if (!lastToken) { return; } + const sourceCodeLines = sourceCode.getLines(); + const lastTokenLine = sourceCodeLines[lastToken?.loc.start.line - 1]; + const optsSemi = getOption('semi'); const optsComma = getOption('comma'); const optsNone = getOption('none'); @@ -193,22 +255,14 @@ export default util.createRule({ }, }, messageId, - fix(fixer) { - if (optsNone) { - // remove the unneeded token - return fixer.remove(lastToken); - } - - const token = optsSemi ? ';' : ','; - - if (missingDelimiter) { - // add the missing delimiter - return fixer.insertTextAfter(lastToken, token); - } - - // correct the current delimiter - return fixer.replaceText(lastToken, token); - }, + fix: makeFixFunction({ + optsNone, + optsSemi, + lastToken, + missingDelimiter, + lastTokenLine, + isSingleLine: opts.type === 'single-line', + }), }); } } @@ -239,7 +293,9 @@ export default util.createRule({ node.type === AST_NODE_TYPES.TSInterfaceBody ? interfaceOptions : typeLiteralOptions; - const opts = isSingleLine ? typeOpts.singleline : typeOpts.multiline; + const opts = isSingleLine + ? { ...typeOpts.singleline, type: 'single-line' } + : { ...typeOpts.multiline, type: 'multi-line' }; members.forEach((member, index) => { checkLastToken(member, opts ?? {}, index === members.length - 1); diff --git a/packages/eslint-plugin/src/rules/member-ordering.ts b/packages/eslint-plugin/src/rules/member-ordering.ts index de5b971f5339..c1e30adc2ef5 100644 --- a/packages/eslint-plugin/src/rules/member-ordering.ts +++ b/packages/eslint-plugin/src/rules/member-ordering.ts @@ -55,6 +55,7 @@ const objectConfig = (memberTypes: string[]): JSONSchema.JSONSchema4 => ({ export const defaultOrder = [ // Index signature 'signature', + 'call-signature', // Fields 'public-static-field', @@ -92,6 +93,64 @@ export const defaultOrder = [ 'constructor', + // Getters + 'public-static-get', + 'protected-static-get', + 'private-static-get', + + 'public-decorated-get', + 'protected-decorated-get', + 'private-decorated-get', + + 'public-instance-get', + 'protected-instance-get', + 'private-instance-get', + + 'public-abstract-get', + 'protected-abstract-get', + 'private-abstract-get', + + 'public-get', + 'protected-get', + 'private-get', + + 'static-get', + 'instance-get', + 'abstract-get', + + 'decorated-get', + + 'get', + + // Setters + 'public-static-set', + 'protected-static-set', + 'private-static-set', + + 'public-decorated-set', + 'protected-decorated-set', + 'private-decorated-set', + + 'public-instance-set', + 'protected-instance-set', + 'private-instance-set', + + 'public-abstract-set', + 'protected-abstract-set', + 'private-abstract-set', + + 'public-set', + 'protected-set', + 'private-set', + + 'static-set', + 'instance-set', + 'abstract-set', + + 'decorated-set', + + 'set', + // Methods 'public-static-method', 'protected-static-method', @@ -122,9 +181,15 @@ export const defaultOrder = [ 'method', ]; -const allMemberTypes = ['signature', 'field', 'method', 'constructor'].reduce< - string[] ->((all, type) => { +const allMemberTypes = [ + 'signature', + 'field', + 'method', + 'call-signature', + 'constructor', + 'get', + 'set', +].reduce((all, type) => { all.push(type); ['public', 'protected', 'private'].forEach(accessibility => { @@ -132,8 +197,13 @@ const allMemberTypes = ['signature', 'field', 'method', 'constructor'].reduce< all.push(`${accessibility}-${type}`); // e.g. `public-field` } - // Only class instance fields and methods can have decorators attached to them - if (type === 'field' || type === 'method') { + // Only class instance fields, methods, get and set can have decorators attached to them + if ( + type === 'field' || + type === 'method' || + type === 'get' || + type === 'set' + ) { const decoratedMemberType = `${accessibility}-decorated-${type}`; const decoratedMemberTypeNoAccessibility = `decorated-${type}`; if (!all.includes(decoratedMemberType)) { @@ -170,17 +240,19 @@ const functionExpressions = [ * @param node the node to be evaluated. */ function getNodeType(node: Member): string | null { - // TODO: add missing TSCallSignatureDeclaration switch (node.type) { case AST_NODE_TYPES.TSAbstractMethodDefinition: case AST_NODE_TYPES.MethodDefinition: return node.kind; case AST_NODE_TYPES.TSMethodSignature: return 'method'; + case AST_NODE_TYPES.TSCallSignatureDeclaration: + return 'call-signature'; case AST_NODE_TYPES.TSConstructSignatureDeclaration: return 'constructor'; - case AST_NODE_TYPES.TSAbstractClassProperty: - case AST_NODE_TYPES.ClassProperty: + case AST_NODE_TYPES.TSAbstractPropertyDefinition: + return 'field'; + case AST_NODE_TYPES.PropertyDefinition: return node.value && functionExpressions.includes(node.value.type) ? 'method' : 'field'; @@ -206,16 +278,18 @@ function getMemberName( switch (node.type) { case AST_NODE_TYPES.TSPropertySignature: case AST_NODE_TYPES.TSMethodSignature: - case AST_NODE_TYPES.TSAbstractClassProperty: - case AST_NODE_TYPES.ClassProperty: - return util.getNameFromMember(node, sourceCode); + case AST_NODE_TYPES.TSAbstractPropertyDefinition: + case AST_NODE_TYPES.PropertyDefinition: + return util.getNameFromMember(node, sourceCode).name; case AST_NODE_TYPES.TSAbstractMethodDefinition: case AST_NODE_TYPES.MethodDefinition: return node.kind === 'constructor' ? 'constructor' - : util.getNameFromMember(node, sourceCode); + : util.getNameFromMember(node, sourceCode).name; case AST_NODE_TYPES.TSConstructSignatureDeclaration: return 'new'; + case AST_NODE_TYPES.TSCallSignatureDeclaration: + return 'call'; case AST_NODE_TYPES.TSIndexSignature: return util.getNameFromIndexSignature(node); default: @@ -265,7 +339,7 @@ function getRank( } const abstract = - node.type === AST_NODE_TYPES.TSAbstractClassProperty || + node.type === AST_NODE_TYPES.TSAbstractPropertyDefinition || node.type === AST_NODE_TYPES.TSAbstractMethodDefinition; const scope = @@ -284,7 +358,13 @@ function getRank( if (supportsModifiers) { const decorated = 'decorators' in node && node.decorators!.length > 0; - if (decorated && (type === 'field' || type === 'method')) { + if ( + decorated && + (type === 'field' || + type === 'method' || + type === 'get' || + type === 'set') + ) { memberGroups.push(`${accessibility}-decorated-${type}`); memberGroups.push(`decorated-${type}`); } @@ -344,12 +424,11 @@ export default util.createRule({ type: 'suggestion', docs: { description: 'Require a consistent member declaration order', - category: 'Stylistic Issues', recommended: false, }, messages: { incorrectOrder: - 'Member "{{member}}" should be declared before member "{{beforeMember}}".', + 'Member {{member}} should be declared before member {{beforeMember}}.', incorrectGroupOrder: 'Member {{name}} should be declared before all {{rank}} definitions.', }, diff --git a/packages/eslint-plugin/src/rules/method-signature-style.ts b/packages/eslint-plugin/src/rules/method-signature-style.ts index 54e68b2c671f..b05c4f9fbd18 100644 --- a/packages/eslint-plugin/src/rules/method-signature-style.ts +++ b/packages/eslint-plugin/src/rules/method-signature-style.ts @@ -13,7 +13,6 @@ export default util.createRule({ type: 'suggestion', docs: { description: 'Enforces using a particular method signature syntax.', - category: 'Best Practices', recommended: false, }, fixable: 'code', @@ -117,28 +116,72 @@ export default util.createRule({ } return { - TSMethodSignature(methodNode): void { - if (mode === 'method') { - return; - } - - const parent = methodNode.parent; - const members = - parent?.type === AST_NODE_TYPES.TSInterfaceBody - ? parent.body - : parent?.type === AST_NODE_TYPES.TSTypeLiteral - ? parent.members - : []; - - const duplicatedKeyMethodNodes: TSESTree.TSMethodSignature[] = members.filter( - (element): element is TSESTree.TSMethodSignature => - element.type === AST_NODE_TYPES.TSMethodSignature && - element !== methodNode && - getMethodKey(element) === getMethodKey(methodNode), - ); - const isParentModule = isNodeParentModuleDeclaration(methodNode); + ...(mode === 'property' && { + TSMethodSignature(methodNode): void { + const parent = methodNode.parent; + const members = + parent?.type === AST_NODE_TYPES.TSInterfaceBody + ? parent.body + : parent?.type === AST_NODE_TYPES.TSTypeLiteral + ? parent.members + : []; + + const duplicatedKeyMethodNodes: TSESTree.TSMethodSignature[] = + members.filter( + (element): element is TSESTree.TSMethodSignature => + element.type === AST_NODE_TYPES.TSMethodSignature && + element !== methodNode && + getMethodKey(element) === getMethodKey(methodNode), + ); + const isParentModule = isNodeParentModuleDeclaration(methodNode); + + if (duplicatedKeyMethodNodes.length > 0) { + if (isParentModule) { + context.report({ + node: methodNode, + messageId: 'errorMethod', + }); + } else { + context.report({ + node: methodNode, + messageId: 'errorMethod', + *fix(fixer) { + const methodNodes = [ + methodNode, + ...duplicatedKeyMethodNodes, + ].sort((a, b) => (a.range[0] < b.range[0] ? -1 : 1)); + const typeString = methodNodes + .map(node => { + const params = getMethodParams(node); + const returnType = getMethodReturnType(node); + return `(${params} => ${returnType})`; + }) + .join(' & '); + const key = getMethodKey(methodNode); + const delimiter = getDelimiter(methodNode); + yield fixer.replaceText( + methodNode, + `${key}: ${typeString}${delimiter}`, + ); + for (const node of duplicatedKeyMethodNodes) { + const lastToken = sourceCode.getLastToken(node); + if (lastToken) { + const nextToken = sourceCode.getTokenAfter(lastToken); + if (nextToken) { + yield fixer.remove(node); + yield fixer.replaceTextRange( + [lastToken.range[1], nextToken.range[0]], + '', + ); + } + } + } + }, + }); + } + return; + } - if (duplicatedKeyMethodNodes.length > 0) { if (isParentModule) { context.report({ node: methodNode, @@ -148,90 +191,43 @@ export default util.createRule({ context.report({ node: methodNode, messageId: 'errorMethod', - *fix(fixer) { - const methodNodes = [ - methodNode, - ...duplicatedKeyMethodNodes, - ].sort((a, b) => (a.range[0] < b.range[0] ? -1 : 1)); - const typeString = methodNodes - .map(node => { - const params = getMethodParams(node); - const returnType = getMethodReturnType(node); - return `(${params} => ${returnType})`; - }) - .join(' & '); + fix: fixer => { const key = getMethodKey(methodNode); + const params = getMethodParams(methodNode); + const returnType = getMethodReturnType(methodNode); const delimiter = getDelimiter(methodNode); - yield fixer.replaceText( + return fixer.replaceText( methodNode, - `${key}: ${typeString}${delimiter}`, + `${key}: ${params} => ${returnType}${delimiter}`, ); - for (const node of duplicatedKeyMethodNodes) { - const lastToken = sourceCode.getLastToken(node); - if (lastToken) { - const nextToken = sourceCode.getTokenAfter(lastToken); - if (nextToken) { - yield fixer.remove(node); - yield fixer.replaceTextRange( - [lastToken.range[1], nextToken.range[0]], - '', - ); - } - } - } }, }); } - return; - } + }, + }), + ...(mode === 'method' && { + TSPropertySignature(propertyNode): void { + const typeNode = propertyNode.typeAnnotation?.typeAnnotation; + if (typeNode?.type !== AST_NODE_TYPES.TSFunctionType) { + return; + } - if (isParentModule) { - context.report({ - node: methodNode, - messageId: 'errorMethod', - }); - } else { context.report({ - node: methodNode, - messageId: 'errorMethod', + node: propertyNode, + messageId: 'errorProperty', fix: fixer => { - const key = getMethodKey(methodNode); - const params = getMethodParams(methodNode); - const returnType = getMethodReturnType(methodNode); - const delimiter = getDelimiter(methodNode); + const key = getMethodKey(propertyNode); + const params = getMethodParams(typeNode); + const returnType = getMethodReturnType(typeNode); + const delimiter = getDelimiter(propertyNode); return fixer.replaceText( - methodNode, - `${key}: ${params} => ${returnType}${delimiter}`, + propertyNode, + `${key}${params}: ${returnType}${delimiter}`, ); }, }); - } - }, - TSPropertySignature(propertyNode): void { - const typeNode = propertyNode.typeAnnotation?.typeAnnotation; - if (typeNode?.type !== AST_NODE_TYPES.TSFunctionType) { - return; - } - - if (mode === 'property') { - return; - } - - context.report({ - node: propertyNode, - messageId: 'errorProperty', - fix: fixer => { - const key = getMethodKey(propertyNode); - const params = getMethodParams(typeNode); - const returnType = getMethodReturnType(typeNode); - const delimiter = getDelimiter(propertyNode); - return fixer.replaceText( - propertyNode, - `${key}${params}: ${returnType}${delimiter}`, - ); - }, - }); - }, + }, + }), }; }, }); 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 d66f9ad13d4f..9cff76129dba 100644 --- a/packages/eslint-plugin/src/rules/naming-convention-utils/types.ts +++ b/packages/eslint-plugin/src/rules/naming-convention-utils/types.ts @@ -60,7 +60,7 @@ interface NormalizedSelector { } type ValidatorFunction = ( - node: TSESTree.Identifier | TSESTree.Literal, + node: TSESTree.Identifier | TSESTree.PrivateIdentifier | TSESTree.Literal, 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 a683933d61b4..374302f7f124 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,9 @@ function createValidator( type: SelectorsString, context: Context, allConfigs: NormalizedSelector[], -): (node: TSESTree.Identifier | TSESTree.Literal) => void { +): ( + node: TSESTree.Identifier | TSESTree.PrivateIdentifier | TSESTree.Literal, +) => void { // make sure the "highest priority" configs are checked first const selectorType = Selectors[type]; const configs = allConfigs @@ -70,11 +72,14 @@ function createValidator( }); return ( - node: TSESTree.Identifier | TSESTree.Literal, + node: TSESTree.Identifier | TSESTree.PrivateIdentifier | TSESTree.Literal, modifiers: Set = new Set(), ): void => { const originalName = - node.type === AST_NODE_TYPES.Identifier ? node.name : `${node.value}`; + node.type === AST_NODE_TYPES.Identifier || + node.type === AST_NODE_TYPES.PrivateIdentifier + ? node.name + : `${node.value}`; // return will break the loop and stop checking configs // it is only used when the name is known to have failed or succeeded a config. @@ -178,7 +183,7 @@ function createValidator( position: 'leading' | 'trailing', config: NormalizedSelector, name: string, - node: TSESTree.Identifier | TSESTree.Literal, + node: TSESTree.Identifier | TSESTree.PrivateIdentifier | TSESTree.Literal, originalName: string, ): string | null { const option = @@ -299,7 +304,7 @@ function createValidator( position: 'prefix' | 'suffix', config: NormalizedSelector, name: string, - node: TSESTree.Identifier | TSESTree.Literal, + node: TSESTree.Identifier | TSESTree.PrivateIdentifier | TSESTree.Literal, originalName: string, ): string | null { const affixes = config[position]; @@ -339,7 +344,7 @@ function createValidator( function validateCustom( config: NormalizedSelector, name: string, - node: TSESTree.Identifier | TSESTree.Literal, + node: TSESTree.Identifier | TSESTree.PrivateIdentifier | TSESTree.Literal, originalName: string, ): boolean { const custom = config.custom; @@ -372,7 +377,7 @@ function createValidator( function validatePredefinedFormat( config: NormalizedSelector, name: string, - node: TSESTree.Identifier | TSESTree.Literal, + node: TSESTree.Identifier | TSESTree.PrivateIdentifier | TSESTree.Literal, originalName: string, ): boolean { const formats = config.format; diff --git a/packages/eslint-plugin/src/rules/naming-convention.ts b/packages/eslint-plugin/src/rules/naming-convention.ts index 16e31b62ef8a..db4463edd985 100644 --- a/packages/eslint-plugin/src/rules/naming-convention.ts +++ b/packages/eslint-plugin/src/rules/naming-convention.ts @@ -55,7 +55,6 @@ export default util.createRule({ name: 'naming-convention', meta: { docs: { - category: 'Variables', description: 'Enforces naming conventions for everything across a codebase', recommended: false, @@ -81,17 +80,17 @@ export default util.createRule({ }, defaultOptions: defaultCamelCaseAllTheThingsConfig, create(contextWithoutDefaults) { - const context: Context = + const context = contextWithoutDefaults.options && contextWithoutDefaults.options.length > 0 ? contextWithoutDefaults : // only apply the defaults when the user provides no config - Object.setPrototypeOf( + (Object.setPrototypeOf( { options: defaultCamelCaseAllTheThingsConfig, }, contextWithoutDefaults, - ); + ) as Context); const validators = parseOptions(context); @@ -103,8 +102,8 @@ export default util.createRule({ validator: ValidatorFunction | null, node: | TSESTree.PropertyNonComputedName - | TSESTree.ClassPropertyNonComputedName - | TSESTree.TSAbstractClassPropertyNonComputedName + | TSESTree.PropertyDefinitionNonComputedName + | TSESTree.TSAbstractPropertyDefinitionNonComputedName | TSESTree.TSPropertySignatureNonComputedName | TSESTree.MethodDefinitionNonComputedName | TSESTree.TSAbstractMethodDefinitionNonComputedName @@ -125,8 +124,8 @@ export default util.createRule({ function getMemberModifiers( node: - | TSESTree.ClassProperty - | TSESTree.TSAbstractClassProperty + | TSESTree.PropertyDefinition + | TSESTree.TSAbstractPropertyDefinition | TSESTree.MethodDefinition | TSESTree.TSAbstractMethodDefinition | TSESTree.TSParameterProperty, @@ -144,7 +143,7 @@ export default util.createRule({ modifiers.add(Modifiers.readonly); } if ( - node.type === AST_NODE_TYPES.TSAbstractClassProperty || + node.type === AST_NODE_TYPES.TSAbstractPropertyDefinition || node.type === AST_NODE_TYPES.TSAbstractMethodDefinition ) { modifiers.add(Modifiers.abstract); @@ -331,10 +330,10 @@ export default util.createRule({ handleMember(validators.objectLiteralProperty, node, modifiers); }, - ':matches(ClassProperty, TSAbstractClassProperty)[computed = false][value.type != "ArrowFunctionExpression"][value.type != "FunctionExpression"][value.type != "TSEmptyBodyFunctionExpression"]'( + ':matches(PropertyDefinition, TSAbstractPropertyDefinition)[computed = false][value.type != "ArrowFunctionExpression"][value.type != "FunctionExpression"][value.type != "TSEmptyBodyFunctionExpression"]'( node: - | TSESTree.ClassPropertyNonComputedName - | TSESTree.TSAbstractClassPropertyNonComputedName, + | TSESTree.PropertyDefinitionNonComputedName + | TSESTree.TSAbstractPropertyDefinitionNonComputedName, ): void { const modifiers = getMemberModifiers(node); handleMember(validators.classProperty, node, modifiers); @@ -369,14 +368,14 @@ export default util.createRule({ }, [[ - ':matches(ClassProperty, TSAbstractClassProperty)[computed = false][value.type = "ArrowFunctionExpression"]', - ':matches(ClassProperty, TSAbstractClassProperty)[computed = false][value.type = "FunctionExpression"]', - ':matches(ClassProperty, TSAbstractClassProperty)[computed = false][value.type = "TSEmptyBodyFunctionExpression"]', + ':matches(PropertyDefinition, TSAbstractPropertyDefinition)[computed = false][value.type = "ArrowFunctionExpression"]', + ':matches(PropertyDefinition, TSAbstractPropertyDefinition)[computed = false][value.type = "FunctionExpression"]', + ':matches(PropertyDefinition, TSAbstractPropertyDefinition)[computed = false][value.type = "TSEmptyBodyFunctionExpression"]', ':matches(MethodDefinition, TSAbstractMethodDefinition)[computed = false][kind = "method"]', ].join(', ')]( node: - | TSESTree.ClassPropertyNonComputedName - | TSESTree.TSAbstractClassPropertyNonComputedName + | TSESTree.PropertyDefinitionNonComputedName + | TSESTree.TSAbstractPropertyDefinitionNonComputedName | TSESTree.MethodDefinitionNonComputedName | TSESTree.TSAbstractMethodDefinitionNonComputedName, ): void { @@ -621,11 +620,14 @@ function isGlobal(scope: TSESLint.Scope.Scope | null): boolean { } function requiresQuoting( - node: TSESTree.Identifier | TSESTree.Literal, + node: TSESTree.Identifier | TSESTree.Literal | TSESTree.PrivateIdentifier, target: ScriptTarget | undefined, ): boolean { const name = - node.type === AST_NODE_TYPES.Identifier ? node.name : `${node.value}`; + node.type === AST_NODE_TYPES.Identifier || + node.type === AST_NODE_TYPES.PrivateIdentifier + ? node.name + : `${node.value}`; return util.requiresQuoting(name, target); } diff --git a/packages/eslint-plugin/src/rules/no-array-constructor.ts b/packages/eslint-plugin/src/rules/no-array-constructor.ts index f9d09439cbb4..c0eac4a75af8 100644 --- a/packages/eslint-plugin/src/rules/no-array-constructor.ts +++ b/packages/eslint-plugin/src/rules/no-array-constructor.ts @@ -10,7 +10,6 @@ export default util.createRule({ type: 'suggestion', docs: { description: 'Disallow generic `Array` constructors', - category: 'Stylistic Issues', recommended: 'error', extendsBaseRule: true, }, 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 b1593c23d8b0..11962363c642 100644 --- a/packages/eslint-plugin/src/rules/no-base-to-string.ts +++ b/packages/eslint-plugin/src/rules/no-base-to-string.ts @@ -25,7 +25,6 @@ export default util.createRule({ docs: { description: 'Requires that `.toString()` is only called on objects which provide useful information when stringified', - category: 'Best Practices', recommended: false, requiresTypeChecking: true, }, 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 bcf561b58562..f578c5d3a1da 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 @@ -13,20 +13,20 @@ export default util.createRule({ docs: { description: 'Disallow non-null assertion in locations that may be confusing', - category: 'Stylistic Issues', recommended: false, }, fixable: 'code', + hasSuggestions: true, messages: { confusingEqual: - 'Confusing combinations of non-null assertion and equal test like "a! == b", which looks very similar to not equal "a !== b"', + 'Confusing combinations of non-null assertion and equal test like "a! == b", which looks very similar to not equal "a !== b".', confusingAssign: - 'Confusing combinations of non-null assertion and equal test like "a! = b", which looks very similar to not equal "a != b"', - notNeedInEqualTest: 'Unnecessary non-null assertion (!) in equal test', + 'Confusing combinations of non-null assertion and equal test like "a! = b", which looks very similar to not equal "a != b".', + notNeedInEqualTest: 'Unnecessary non-null assertion (!) in equal test.', notNeedInAssign: - 'Unnecessary non-null assertion (!) in assignment left hand', + 'Unnecessary non-null assertion (!) in assignment left hand.', wrapUpLeft: - 'Wrap up left hand to avoid putting non-null assertion "!" and "=" together', + 'Wrap up left hand to avoid putting non-null assertion "!" and "=" together.', }, schema: [], }, 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 a9b715350e99..696c3d7af2dc 100644 --- a/packages/eslint-plugin/src/rules/no-confusing-void-expression.ts +++ b/packages/eslint-plugin/src/rules/no-confusing-void-expression.ts @@ -30,7 +30,6 @@ export default util.createRule({ docs: { description: 'Requires expressions of type void to appear in statement position', - category: 'Best Practices', recommended: false, requiresTypeChecking: true, }, @@ -57,7 +56,7 @@ export default util.createRule({ invalidVoidExprReturnWrapVoid: 'Void expressions returned from a function ' + 'must be marked explicitly with the `void` operator.', - voidExprWrapVoid: 'Mark with an explicit `void` operator', + voidExprWrapVoid: 'Mark with an explicit `void` operator.', }, schema: [ { @@ -71,6 +70,7 @@ export default util.createRule({ ], type: 'problem', fixable: 'code', + hasSuggestions: true, }, defaultOptions: [{}], @@ -268,6 +268,11 @@ export default util.createRule({ } } + if (parent.type === AST_NODE_TYPES.ChainExpression) { + // e.g. `console?.log('foo')` + return findInvalidAncestor(parent); + } + // any other parent is invalid return parent; } 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 bc48b2a843e8..e9cb151d6d69 100644 --- a/packages/eslint-plugin/src/rules/no-dupe-class-members.ts +++ b/packages/eslint-plugin/src/rules/no-dupe-class-members.ts @@ -1,7 +1,12 @@ -import { AST_NODE_TYPES } from '@typescript-eslint/experimental-utils'; -import baseRule from 'eslint/lib/rules/no-dupe-class-members'; +import { + AST_NODE_TYPES, + TSESTree, +} from '@typescript-eslint/experimental-utils'; +import { getESLintCoreRule } from '../util/getESLintCoreRule'; import * as util from '../util'; +const baseRule = getESLintCoreRule('no-dupe-class-members'); + type Options = util.InferOptionsTypeFromRule; type MessageIds = util.InferMessageIdsTypeFromRule; @@ -11,10 +16,10 @@ export default util.createRule({ type: 'problem', docs: { description: 'Disallow duplicate class members', - category: 'Possible Errors', recommended: false, extendsBaseRule: true, }, + hasSuggestions: baseRule.meta.hasSuggestions, schema: baseRule.meta.schema, messages: baseRule.meta.messages, }, @@ -22,19 +27,44 @@ export default util.createRule({ create(context) { const rules = baseRule.create(context); - return { - ...rules, - MethodDefinition(node): void { + function wrapMemberDefinitionListener< + N extends TSESTree.MethodDefinition | TSESTree.PropertyDefinition, + >(coreListener: (node: N) => void): (node: N) => void { + return (node: N): void => { if (node.computed) { return; } - if (node.value.type === AST_NODE_TYPES.TSEmptyBodyFunctionExpression) { + if ( + node.value && + node.value.type === AST_NODE_TYPES.TSEmptyBodyFunctionExpression + ) { return; } - return rules.MethodDefinition(node); - }, + return coreListener(node); + }; + } + + return { + ...rules, + // for ESLint <= v7 + ...(rules.MethodDefinition + ? { + MethodDefinition: wrapMemberDefinitionListener( + rules.MethodDefinition, + ), + } + : {}), + // for ESLint v8 + ...(rules['MethodDefinition, PropertyDefinition'] + ? { + 'MethodDefinition, PropertyDefinition': + wrapMemberDefinitionListener( + rules['MethodDefinition, PropertyDefinition'], + ), + } + : {}), }; }, }); diff --git a/packages/eslint-plugin/src/rules/no-duplicate-imports.ts b/packages/eslint-plugin/src/rules/no-duplicate-imports.ts index a6f368902e38..b2ded1a2ea73 100644 --- a/packages/eslint-plugin/src/rules/no-duplicate-imports.ts +++ b/packages/eslint-plugin/src/rules/no-duplicate-imports.ts @@ -2,9 +2,11 @@ import { AST_NODE_TYPES, TSESTree, } from '@typescript-eslint/experimental-utils'; -import baseRule from 'eslint/lib/rules/no-duplicate-imports'; +import { getESLintCoreRule } from '../util/getESLintCoreRule'; import * as util from '../util'; +const baseRule = getESLintCoreRule('no-duplicate-imports'); + type Options = util.InferOptionsTypeFromRule; type MessageIds = util.InferMessageIdsTypeFromRule; @@ -14,17 +16,17 @@ export default util.createRule({ type: 'problem', docs: { description: 'Disallow duplicate imports', - category: 'Best Practices', 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', + 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: [ @@ -32,9 +34,8 @@ export default util.createRule({ includeExports: false, }, ], - create(context, [option]) { + create(context, [{ includeExports }]) { const rules = baseRule.create(context); - const includeExports = option.includeExports; const typeMemberImports = new Set(); const typeDefaultImports = new Set(); const typeExports = new Set(); diff --git a/packages/eslint-plugin/src/rules/no-dynamic-delete.ts b/packages/eslint-plugin/src/rules/no-dynamic-delete.ts index 71ce7f2d91e8..716590c66b66 100644 --- a/packages/eslint-plugin/src/rules/no-dynamic-delete.ts +++ b/packages/eslint-plugin/src/rules/no-dynamic-delete.ts @@ -10,7 +10,6 @@ export default util.createRule({ name: 'no-dynamic-delete', meta: { docs: { - category: 'Best Practices', description: 'Disallow the delete operator with computed key expressions', recommended: false, }, diff --git a/packages/eslint-plugin/src/rules/no-empty-function.ts b/packages/eslint-plugin/src/rules/no-empty-function.ts index 246680c60e34..06c04cb4ecad 100644 --- a/packages/eslint-plugin/src/rules/no-empty-function.ts +++ b/packages/eslint-plugin/src/rules/no-empty-function.ts @@ -2,9 +2,11 @@ import { AST_NODE_TYPES, TSESTree, } from '@typescript-eslint/experimental-utils'; -import baseRule from 'eslint/lib/rules/no-empty-function'; +import { getESLintCoreRule } from '../util/getESLintCoreRule'; import * as util from '../util'; +const baseRule = getESLintCoreRule('no-empty-function'); + type Options = util.InferOptionsTypeFromRule; type MessageIds = util.InferMessageIdsTypeFromRule; @@ -43,10 +45,10 @@ export default util.createRule({ type: 'suggestion', docs: { description: 'Disallow empty functions', - category: 'Best Practices', recommended: 'error', extendsBaseRule: true, }, + hasSuggestions: baseRule.meta.hasSuggestions, schema: [schema], messages: baseRule.meta.messages, }, diff --git a/packages/eslint-plugin/src/rules/no-empty-interface.ts b/packages/eslint-plugin/src/rules/no-empty-interface.ts index 11ed8582c75b..ee472e703903 100644 --- a/packages/eslint-plugin/src/rules/no-empty-interface.ts +++ b/packages/eslint-plugin/src/rules/no-empty-interface.ts @@ -14,11 +14,11 @@ export default util.createRule({ type: 'suggestion', docs: { description: 'Disallow the declaration of empty interfaces', - category: 'Best Practices', recommended: 'error', suggestion: true, }, fixable: 'code', + hasSuggestions: true, messages: { noEmpty: 'An empty interface is equivalent to `{}`.', noEmptyWithSuper: diff --git a/packages/eslint-plugin/src/rules/no-explicit-any.ts b/packages/eslint-plugin/src/rules/no-explicit-any.ts index 4e6b8c34fc1d..a41d443e9243 100644 --- a/packages/eslint-plugin/src/rules/no-explicit-any.ts +++ b/packages/eslint-plugin/src/rules/no-explicit-any.ts @@ -1,9 +1,9 @@ import { - TSESTree, AST_NODE_TYPES, + TSESLint, + TSESTree, } from '@typescript-eslint/experimental-utils'; import * as util from '../util'; -import { TSESLint } from '@typescript-eslint/experimental-utils'; export type Options = [ { @@ -19,11 +19,11 @@ export default util.createRule({ type: 'suggestion', docs: { description: 'Disallow usage of the `any` type', - category: 'Best Practices', recommended: 'warn', suggestion: true, }, fixable: 'code', + hasSuggestions: true, messages: { unexpectedAny: 'Unexpected any. Specify a different type.', suggestUnknown: @@ -199,8 +199,8 @@ export default util.createRule({ }; if (fixToUnknown) { - fixOrSuggest.fix = (fixer => - fixer.replaceText(node, 'unknown')) as TSESLint.ReportFixFunction; + fixOrSuggest.fix = (fixer): TSESLint.RuleFix => + fixer.replaceText(node, 'unknown'); } context.report({ 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 b58edd99ed6a..1ea8970da2fe 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 @@ -7,7 +7,6 @@ export default util.createRule({ type: 'problem', docs: { description: 'Disallow extra non-null assertion', - category: 'Stylistic Issues', recommended: 'error', }, fixable: 'code', @@ -32,8 +31,10 @@ export default util.createRule({ return { 'TSNonNullExpression > TSNonNullExpression': checkExtraNonNullAssertion, - 'MemberExpression[optional = true] > TSNonNullExpression.object': checkExtraNonNullAssertion, - 'CallExpression[optional = true] > TSNonNullExpression.callee': checkExtraNonNullAssertion, + 'MemberExpression[optional = true] > TSNonNullExpression.object': + checkExtraNonNullAssertion, + 'CallExpression[optional = true] > TSNonNullExpression.callee': + checkExtraNonNullAssertion, }; }, }); diff --git a/packages/eslint-plugin/src/rules/no-extra-parens.ts b/packages/eslint-plugin/src/rules/no-extra-parens.ts index 948f12ad8546..743c22596c18 100644 --- a/packages/eslint-plugin/src/rules/no-extra-parens.ts +++ b/packages/eslint-plugin/src/rules/no-extra-parens.ts @@ -1,14 +1,16 @@ // any is required to work around manipulating the AST in weird ways -/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-assignment */ import { AST_NODE_TYPES, TSESTree, TSESLint, } from '@typescript-eslint/experimental-utils'; -import baseRule from 'eslint/lib/rules/no-extra-parens'; +import { getESLintCoreRule } from '../util/getESLintCoreRule'; import * as util from '../util'; +const baseRule = getESLintCoreRule('no-extra-parens'); + type Options = util.InferOptionsTypeFromRule; type MessageIds = util.InferMessageIdsTypeFromRule; @@ -18,11 +20,11 @@ export default util.createRule({ type: 'layout', docs: { description: 'Disallow unnecessary parentheses', - category: 'Possible Errors', recommended: false, extendsBaseRule: true, }, fixable: 'code', + hasSuggestions: baseRule.meta.hasSuggestions, schema: baseRule.meta.schema, messages: baseRule.meta.messages, }, @@ -81,9 +83,7 @@ export default util.createRule({ if ( node.arguments.length === 1 && node.typeParameters?.params.some( - param => - param.type === AST_NODE_TYPES.TSParenthesizedType || - param.type === AST_NODE_TYPES.TSImportType, + param => param.type === AST_NODE_TYPES.TSImportType, ) ) { return rule({ diff --git a/packages/eslint-plugin/src/rules/no-extra-semi.ts b/packages/eslint-plugin/src/rules/no-extra-semi.ts index d1ffdf61d8d4..4ae5cb5c396b 100644 --- a/packages/eslint-plugin/src/rules/no-extra-semi.ts +++ b/packages/eslint-plugin/src/rules/no-extra-semi.ts @@ -1,6 +1,8 @@ -import baseRule from 'eslint/lib/rules/no-extra-semi'; +import { getESLintCoreRule } from '../util/getESLintCoreRule'; import * as util from '../util'; +const baseRule = getESLintCoreRule('no-extra-semi'); + type Options = util.InferOptionsTypeFromRule; type MessageIds = util.InferMessageIdsTypeFromRule; @@ -10,11 +12,11 @@ export default util.createRule({ type: 'suggestion', docs: { description: 'Disallow unnecessary semicolons', - category: 'Possible Errors', recommended: 'error', extendsBaseRule: true, }, fixable: 'code', + hasSuggestions: baseRule.meta.hasSuggestions, schema: baseRule.meta.schema, messages: baseRule.meta.messages, }, @@ -24,8 +26,16 @@ export default util.createRule({ return { ...rules, - ClassProperty(node): void { - rules.MethodDefinition(node as never); + 'TSAbstractMethodDefinition, TSAbstractPropertyDefinition'( + node: never, + ): void { + if (rules.MethodDefinition) { + // for ESLint <= v7 + rules.MethodDefinition(node); + } else { + // for ESLint v8 + rules['MethodDefinition, PropertyDefinition']?.(node); + } }, }; }, diff --git a/packages/eslint-plugin/src/rules/no-extraneous-class.ts b/packages/eslint-plugin/src/rules/no-extraneous-class.ts index 996dd0ea71cd..2686ab0f478d 100644 --- a/packages/eslint-plugin/src/rules/no-extraneous-class.ts +++ b/packages/eslint-plugin/src/rules/no-extraneous-class.ts @@ -20,7 +20,6 @@ export default util.createRule({ type: 'suggestion', docs: { description: 'Forbids the use of classes as namespaces', - category: 'Best Practices', recommended: false, }, schema: [ @@ -79,13 +78,13 @@ export default util.createRule({ | TSESTree.ClassExpression | undefined; - if (!parent || parent.superClass) { + if (!parent || parent.superClass || isAllowWithDecorator(parent)) { return; } const reportNode = 'id' in parent && parent.id ? parent.id : parent; if (node.body.length === 0) { - if (allowEmpty || isAllowWithDecorator(parent)) { + if (allowEmpty) { return; } diff --git a/packages/eslint-plugin/src/rules/no-floating-promises.ts b/packages/eslint-plugin/src/rules/no-floating-promises.ts index deb4ee5c00f9..5687f08a06b1 100644 --- a/packages/eslint-plugin/src/rules/no-floating-promises.ts +++ b/packages/eslint-plugin/src/rules/no-floating-promises.ts @@ -22,16 +22,17 @@ export default util.createRule({ meta: { docs: { description: 'Requires Promise-like values to be handled appropriately', - category: 'Best Practices', recommended: 'error', suggestion: true, requiresTypeChecking: true, }, + hasSuggestions: true, messages: { - floating: 'Promises must be handled appropriately.', + floating: + 'Promises must be awaited, end with a call to .catch, or end with a call to .then with a rejection handler.', floatingVoid: - 'Promises must be handled appropriately' + - ' or explicitly marked as ignored with the `void` operator.', + '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.', floatingFixVoid: 'Add void operator to ignore.', }, schema: [ @@ -60,13 +61,11 @@ export default util.createRule({ return { ExpressionStatement(node): void { - const { expression } = parserServices.esTreeNodeToTSNodeMap.get(node); - if (options.ignoreIIFE && isAsyncIife(node)) { return; } - if (isUnhandledPromise(checker, expression)) { + if (isUnhandledPromise(checker, node.expression)) { if (options.ignoreVoid) { context.report({ node, @@ -107,34 +106,34 @@ export default util.createRule({ function isUnhandledPromise( checker: ts.TypeChecker, - node: ts.Node, + node: TSESTree.Node, ): boolean { // First, check expressions whose resulting types may not be promise-like - if ( - ts.isBinaryExpression(node) && - node.operatorToken.kind === ts.SyntaxKind.CommaToken - ) { + 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 ( - isUnhandledPromise(checker, node.left) || - isUnhandledPromise(checker, node.right) - ); + return node.expressions.some(item => isUnhandledPromise(checker, item)); } - if (ts.isVoidExpression(node) && !options.ignoreVoid) { + if ( + !options.ignoreVoid && + node.type === AST_NODE_TYPES.UnaryExpression && + node.operator === 'void' + ) { // Similarly, a `void` expression always returns undefined, so we need to // see what's inside it without checking the type of the overall expression. - return isUnhandledPromise(checker, node.expression); + return isUnhandledPromise(checker, node.argument); } // Check the type. At this point it can't be unhandled if it isn't a promise - if (!isPromiseLike(checker, node)) { + if ( + !isPromiseLike(checker, parserServices.esTreeNodeToTSNodeMap.get(node)) + ) { return false; } - if (ts.isCallExpression(node)) { + 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 ( @@ -142,17 +141,17 @@ export default util.createRule({ !isPromiseThenCallWithRejectionHandler(node) && !isPromiseFinallyCallWithHandler(node) ); - } else if (ts.isConditionalExpression(node)) { + } 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.whenFalse) || - isUnhandledPromise(checker, node.whenTrue) + isUnhandledPromise(checker, node.alternate) || + isUnhandledPromise(checker, node.consequent) ); } else if ( - ts.isPropertyAccessExpression(node) || - ts.isIdentifier(node) || - ts.isNewExpression(node) + node.type === AST_NODE_TYPES.MemberExpression || + node.type === AST_NODE_TYPES.Identifier || + node.type === AST_NODE_TYPES.NewExpression ) { // 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 @@ -225,30 +224,35 @@ function isFunctionParam( return false; } -function isPromiseCatchCallWithHandler(expression: ts.CallExpression): boolean { +function isPromiseCatchCallWithHandler( + expression: TSESTree.CallExpression, +): boolean { return ( - tsutils.isPropertyAccessExpression(expression.expression) && - expression.expression.name.text === 'catch' && + expression.callee.type === AST_NODE_TYPES.MemberExpression && + expression.callee.property.type === AST_NODE_TYPES.Identifier && + expression.callee.property.name === 'catch' && expression.arguments.length >= 1 ); } function isPromiseThenCallWithRejectionHandler( - expression: ts.CallExpression, + expression: TSESTree.CallExpression, ): boolean { return ( - tsutils.isPropertyAccessExpression(expression.expression) && - expression.expression.name.text === 'then' && + expression.callee.type === AST_NODE_TYPES.MemberExpression && + expression.callee.property.type === AST_NODE_TYPES.Identifier && + expression.callee.property.name === 'then' && expression.arguments.length >= 2 ); } function isPromiseFinallyCallWithHandler( - expression: ts.CallExpression, + expression: TSESTree.CallExpression, ): boolean { return ( - tsutils.isPropertyAccessExpression(expression.expression) && - expression.expression.name.text === 'finally' && + expression.callee.type === AST_NODE_TYPES.MemberExpression && + expression.callee.property.type === AST_NODE_TYPES.Identifier && + expression.callee.property.name === 'finally' && expression.arguments.length >= 1 ); } 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 f89d2ffd08d7..c382a11021c1 100644 --- a/packages/eslint-plugin/src/rules/no-for-in-array.ts +++ b/packages/eslint-plugin/src/rules/no-for-in-array.ts @@ -6,7 +6,6 @@ export default util.createRule({ meta: { docs: { description: 'Disallow iterating over an array with a for-in loop', - category: 'Best Practices', recommended: 'error', requiresTypeChecking: true, }, diff --git a/packages/eslint-plugin/src/rules/no-implicit-any-catch.ts b/packages/eslint-plugin/src/rules/no-implicit-any-catch.ts index aed526f8ab01..aa050794c4ae 100644 --- a/packages/eslint-plugin/src/rules/no-implicit-any-catch.ts +++ b/packages/eslint-plugin/src/rules/no-implicit-any-catch.ts @@ -17,17 +17,18 @@ export type MessageIds = 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', - category: 'Best Practices', recommended: false, suggestion: true, }, fixable: 'code', + hasSuggestions: true, messages: { - implicitAnyInCatch: 'Implicit any in catch clause', - explicitAnyInCatch: 'Explicit any in catch clause', + 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.', }, diff --git a/packages/eslint-plugin/src/rules/no-implied-eval.ts b/packages/eslint-plugin/src/rules/no-implied-eval.ts index c7caf2d4bef4..91bf0d0d3199 100644 --- a/packages/eslint-plugin/src/rules/no-implied-eval.ts +++ b/packages/eslint-plugin/src/rules/no-implied-eval.ts @@ -20,7 +20,6 @@ export default util.createRule({ meta: { docs: { description: 'Disallow the use of `eval()`-like methods', - category: 'Best Practices', recommended: 'error', extendsBaseRule: true, requiresTypeChecking: true, @@ -99,6 +98,12 @@ export default util.createRule({ return signatures.length > 0; } + function isBind(node: TSESTree.Node): boolean { + return node.type === AST_NODE_TYPES.MemberExpression + ? isBind(node.property) + : node.type === AST_NODE_TYPES.Identifier && node.name === 'bind'; + } + function isFunction(node: TSESTree.Node): boolean { switch (node.type) { case AST_NODE_TYPES.ArrowFunctionExpression: @@ -106,20 +111,15 @@ export default util.createRule({ case AST_NODE_TYPES.FunctionExpression: return true; - case AST_NODE_TYPES.MemberExpression: - case AST_NODE_TYPES.Identifier: - case AST_NODE_TYPES.ConditionalExpression: - return isFunctionType(node); + case AST_NODE_TYPES.Literal: + case AST_NODE_TYPES.TemplateLiteral: + return false; case AST_NODE_TYPES.CallExpression: - return ( - (node.callee.type === AST_NODE_TYPES.Identifier && - node.callee.name === 'bind') || - isFunctionType(node) - ); + return isBind(node.callee) || isFunctionType(node); default: - return false; + return isFunctionType(node); } } diff --git a/packages/eslint-plugin/src/rules/no-inferrable-types.ts b/packages/eslint-plugin/src/rules/no-inferrable-types.ts index d6b6538a95d4..9c8a1a14c20b 100644 --- a/packages/eslint-plugin/src/rules/no-inferrable-types.ts +++ b/packages/eslint-plugin/src/rules/no-inferrable-types.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/internal/prefer-ast-types-enum */ import { AST_NODE_TYPES, TSESTree, @@ -19,7 +20,6 @@ export default util.createRule({ docs: { description: 'Disallows explicit type declarations for variables or parameters initialized to a number, string, or boolean', - category: 'Best Practices', recommended: 'error', }, fixable: 'code', @@ -129,7 +129,6 @@ export default util.createRule({ case AST_NODE_TYPES.TSBooleanKeyword: return ( hasUnaryPrefix(init, '!') || - // eslint-disable-next-line @typescript-eslint/internal/prefer-ast-types-enum isFunctionCall(init, 'Boolean') || isLiteral(init, 'boolean') ); @@ -151,7 +150,6 @@ export default util.createRule({ case AST_NODE_TYPES.TSStringKeyword: return ( - // eslint-disable-next-line @typescript-eslint/internal/prefer-ast-types-enum isFunctionCall(init, 'String') || isLiteral(init, 'string') || init.type === AST_NODE_TYPES.TemplateLiteral @@ -196,7 +194,7 @@ export default util.createRule({ node: | TSESTree.VariableDeclarator | TSESTree.Parameter - | TSESTree.ClassProperty, + | TSESTree.PropertyDefinition, typeNode: TSESTree.TSTypeAnnotation | undefined, initNode: TSESTree.Expression | null | undefined, ): void { @@ -242,17 +240,21 @@ export default util.createRule({ if (ignoreParameters || !node.params) { return; } - (node.params.filter( - param => - param.type === AST_NODE_TYPES.AssignmentPattern && - param.left && - param.right, - ) as TSESTree.AssignmentPattern[]).forEach(param => { + ( + node.params.filter( + param => + param.type === AST_NODE_TYPES.AssignmentPattern && + param.left && + param.right, + ) as TSESTree.AssignmentPattern[] + ).forEach(param => { reportInferrableType(param, param.left.typeAnnotation, param.right); }); } - function inferrablePropertyVisitor(node: TSESTree.ClassProperty): void { + function inferrablePropertyVisitor( + node: TSESTree.PropertyDefinition, + ): void { // We ignore `readonly` because of Microsoft/TypeScript#14416 // Essentially a readonly property without a type // will result in its value being the type, leading to @@ -268,7 +270,7 @@ export default util.createRule({ FunctionExpression: inferrableParameterVisitor, FunctionDeclaration: inferrableParameterVisitor, ArrowFunctionExpression: inferrableParameterVisitor, - ClassProperty: inferrablePropertyVisitor, + PropertyDefinition: inferrablePropertyVisitor, }; }, }); diff --git a/packages/eslint-plugin/src/rules/no-invalid-this.ts b/packages/eslint-plugin/src/rules/no-invalid-this.ts index 5d056308771f..1cd1be027b94 100644 --- a/packages/eslint-plugin/src/rules/no-invalid-this.ts +++ b/packages/eslint-plugin/src/rules/no-invalid-this.ts @@ -2,13 +2,15 @@ import { TSESTree, AST_NODE_TYPES, } from '@typescript-eslint/experimental-utils'; -import baseRule from 'eslint/lib/rules/no-invalid-this'; +import { getESLintCoreRule } from '../util/getESLintCoreRule'; import { InferOptionsTypeFromRule, createRule, InferMessageIdsTypeFromRule, } from '../util'; +const baseRule = getESLintCoreRule('no-invalid-this'); + export type Options = InferOptionsTypeFromRule; export type MessageIds = InferMessageIdsTypeFromRule; @@ -19,13 +21,14 @@ export default createRule({ docs: { description: 'Disallow `this` keywords outside of classes or class-like objects', - category: 'Best Practices', 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'.", }, + hasSuggestions: baseRule.meta.hasSuggestions, schema: baseRule.meta.schema, }, defaultOptions: [{ capIsConstructor: true }], @@ -50,10 +53,10 @@ export default createRule({ return { ...rules, - ClassProperty(): void { + PropertyDefinition(): void { thisIsValidStack.push(true); }, - 'ClassProperty:exit'(): void { + 'PropertyDefinition:exit'(): void { thisIsValidStack.pop(); }, FunctionDeclaration(node: TSESTree.FunctionDeclaration): void { 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 0dff489e585f..dceffa6d893e 100644 --- a/packages/eslint-plugin/src/rules/no-invalid-void-type.ts +++ b/packages/eslint-plugin/src/rules/no-invalid-void-type.ts @@ -23,19 +23,18 @@ export default util.createRule<[Options], MessageIds>({ docs: { description: 'Disallows usage of `void` type outside of generic or return types', - category: 'Best Practices', recommended: false, }, messages: { invalidVoidForGeneric: - '{{ generic }} may not have void as a type variable', + '{{ generic }} may not have void as a type variable.', invalidVoidNotReturnOrGeneric: - 'void is only valid as a return type or generic type variable', - invalidVoidNotReturn: 'void is only valid as a return type', + 'void is only valid as a return type or generic type variable.', + invalidVoidNotReturn: 'void is only valid as a return type.', invalidVoidNotReturnOrThisParam: - 'void is only valid as return type or type of `this` parameter', + 'void is only valid as return type or type of `this` parameter.', invalidVoidNotReturnOrThisParamOrGeneric: - 'void is only valid as a return type or generic type variable or the type of a `this` parameter', + 'void is only valid as a return type or generic type variable or the type of a `this` parameter.', }, schema: [ { @@ -69,7 +68,7 @@ export default util.createRule<[Options], MessageIds>({ const invalidGrandParents: AST_NODE_TYPES[] = [ AST_NODE_TYPES.TSPropertySignature, AST_NODE_TYPES.CallExpression, - AST_NODE_TYPES.ClassProperty, + AST_NODE_TYPES.PropertyDefinition, AST_NODE_TYPES.Identifier, ]; const validUnionMembers: AST_NODE_TYPES[] = [ diff --git a/packages/eslint-plugin/src/rules/no-loop-func.ts b/packages/eslint-plugin/src/rules/no-loop-func.ts index 44d0178e8670..4496dea91fc8 100644 --- a/packages/eslint-plugin/src/rules/no-loop-func.ts +++ b/packages/eslint-plugin/src/rules/no-loop-func.ts @@ -3,9 +3,11 @@ import { TSESLint, TSESTree, } from '@typescript-eslint/experimental-utils'; -import baseRule from 'eslint/lib/rules/no-loop-func'; +import { getESLintCoreRule } from '../util/getESLintCoreRule'; import * as util from '../util'; +const baseRule = getESLintCoreRule('no-loop-func'); + type Options = util.InferOptionsTypeFromRule; type MessageIds = util.InferMessageIdsTypeFromRule; @@ -16,15 +18,12 @@ export default util.createRule({ docs: { description: 'Disallow function declarations that contain unsafe references inside loop statements', - category: 'Best Practices', recommended: false, extendsBaseRule: true, }, + hasSuggestions: baseRule.meta.hasSuggestions, schema: [], - messages: baseRule?.meta.messages ?? { - unsafeRefs: - 'Function declared in a loop contains unsafe references to variable(s) {{ varNames }}.', - }, + messages: baseRule.meta.messages, }, defaultOptions: [], create(context) { 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 47ab5b1a74fa..d095def03cc9 100644 --- a/packages/eslint-plugin/src/rules/no-loss-of-precision.ts +++ b/packages/eslint-plugin/src/rules/no-loss-of-precision.ts @@ -1,18 +1,13 @@ import { TSESTree } from '@typescript-eslint/experimental-utils'; -import BaseRule from 'eslint/lib/rules/no-loss-of-precision'; import * as util from '../util'; +import { maybeGetESLintCoreRule } from '../util/getESLintCoreRule'; -const baseRule = ((): typeof BaseRule | null => { - try { - return require('eslint/lib/rules/no-loss-of-precision'); - } catch { - /* istanbul ignore next */ - return null; - } -})(); +const baseRule = maybeGetESLintCoreRule('no-loss-of-precision'); -type Options = util.InferOptionsTypeFromRule; -type MessageIds = util.InferMessageIdsTypeFromRule; +type Options = util.InferOptionsTypeFromRule>; +type MessageIds = util.InferMessageIdsTypeFromRule< + NonNullable +>; export default util.createRule({ name: 'no-loss-of-precision', @@ -20,10 +15,10 @@ export default util.createRule({ type: 'problem', docs: { description: 'Disallow literal numbers that lose precision', - category: 'Possible Errors', - recommended: false, + recommended: 'error', extendsBaseRule: true, }, + hasSuggestions: baseRule?.meta.hasSuggestions, schema: [], messages: baseRule?.meta.messages ?? { noLossOfPrecision: '' }, }, @@ -38,15 +33,15 @@ export default util.createRule({ // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion const rules = baseRule!.create(context); - function isSeperatedNumeric(node: TSESTree.Literal): boolean { + function isSeparatedNumeric(node: TSESTree.Literal): boolean { return typeof node.value === 'number' && node.raw.includes('_'); } return { Literal(node: TSESTree.Literal): void { rules.Literal({ ...node, - raw: isSeperatedNumeric(node) ? node.raw.replace(/_/g, '') : node.raw, - }); + raw: isSeparatedNumeric(node) ? node.raw.replace(/_/g, '') : node.raw, + } as never); }, }; }, diff --git a/packages/eslint-plugin/src/rules/no-magic-numbers.ts b/packages/eslint-plugin/src/rules/no-magic-numbers.ts index 0cb41337c1bb..e63c80686c3d 100644 --- a/packages/eslint-plugin/src/rules/no-magic-numbers.ts +++ b/packages/eslint-plugin/src/rules/no-magic-numbers.ts @@ -2,9 +2,11 @@ import { TSESTree, AST_NODE_TYPES, } from '@typescript-eslint/experimental-utils'; -import baseRule from 'eslint/lib/rules/no-magic-numbers'; +import { getESLintCoreRule } from '../util/getESLintCoreRule'; import * as util from '../util'; +const baseRule = getESLintCoreRule('no-magic-numbers'); + type Options = util.InferOptionsTypeFromRule; type MessageIds = util.InferMessageIdsTypeFromRule; @@ -18,10 +20,10 @@ export default util.createRule({ type: 'suggestion', docs: { description: 'Disallow magic numbers', - category: 'Best Practices', recommended: false, extendsBaseRule: true, }, + hasSuggestions: baseRule.meta.hasSuggestions, // Extend base schema with additional property to ignore TS numeric literal types schema: [ { @@ -40,10 +42,7 @@ export default util.createRule({ }, }, ], - messages: baseRule.meta.messages ?? { - useConst: "Number constants declarations must use 'const'.", - noMagic: 'No magic number: {{raw}}.', - }, + messages: baseRule.meta.messages, }, defaultOptions: [ { @@ -78,15 +77,14 @@ export default util.createRule({ // Check if the node is a readonly class property if ( typeof node.value === 'number' && - isParentTSReadonlyClassProperty(node) + isParentTSReadonlyPropertyDefinition(node) ) { if (options.ignoreReadonlyClassProperties) { return; } - let fullNumberNode: - | TSESTree.Literal - | TSESTree.UnaryExpression = node; + let fullNumberNode: TSESTree.Literal | TSESTree.UnaryExpression = + node; let raw = node.raw; if ( @@ -213,10 +211,10 @@ function isTSNumericLiteralType(node: TSESTree.Node): boolean { * @returns true if the node parent is a readonly class property * @private */ -function isParentTSReadonlyClassProperty(node: TSESTree.Literal): boolean { +function isParentTSReadonlyPropertyDefinition(node: TSESTree.Literal): boolean { const parent = getLiteralParent(node); - if (parent?.type === AST_NODE_TYPES.ClassProperty && parent.readonly) { + if (parent?.type === AST_NODE_TYPES.PropertyDefinition && parent.readonly) { return true; } diff --git a/packages/eslint-plugin/src/rules/no-meaningless-void-operator.ts b/packages/eslint-plugin/src/rules/no-meaningless-void-operator.ts new file mode 100644 index 000000000000..28cc7b6b051d --- /dev/null +++ b/packages/eslint-plugin/src/rules/no-meaningless-void-operator.ts @@ -0,0 +1,100 @@ +import { + ESLintUtils, + TSESLint, + TSESTree, +} from '@typescript-eslint/experimental-utils'; +import * as tsutils from 'tsutils'; +import * as util from '../util'; +import * as ts from 'typescript'; + +type Options = [ + { + checkNever: boolean; + }, +]; + +export default util.createRule< + Options, + 'meaninglessVoidOperator' | 'removeVoid' +>({ + name: 'no-meaningless-void-operator', + meta: { + type: 'suggestion', + docs: { + description: + 'Disallow the `void` operator except when used to discard a value', + recommended: false, + suggestion: true, + requiresTypeChecking: true, + }, + fixable: 'code', + hasSuggestions: true, + messages: { + meaninglessVoidOperator: + "void operator shouldn't be used on {{type}}; it should convey that a return value is being ignored", + removeVoid: "Remove 'void'", + }, + schema: [ + { + type: 'object', + properties: { + checkNever: { + type: 'boolean', + default: false, + }, + }, + additionalProperties: false, + }, + ], + }, + defaultOptions: [{ checkNever: false }], + + create(context, [{ checkNever }]) { + const parserServices = ESLintUtils.getParserServices(context); + const checker = parserServices.program.getTypeChecker(); + const sourceCode = context.getSourceCode(); + + return { + 'UnaryExpression[operator="void"]'(node: TSESTree.UnaryExpression): void { + const fix = (fixer: TSESLint.RuleFixer): TSESLint.RuleFix => { + return fixer.removeRange([ + sourceCode.getTokens(node)[0].range[0], + sourceCode.getTokens(node)[1].range[0], + ]); + }; + + const argTsNode = parserServices.esTreeNodeToTSNodeMap.get( + node.argument, + ); + const argType = checker.getTypeAtLocation(argTsNode); + const unionParts = tsutils.unionTypeParts(argType); + if ( + unionParts.every( + part => part.flags & (ts.TypeFlags.Void | ts.TypeFlags.Undefined), + ) + ) { + context.report({ + node, + messageId: 'meaninglessVoidOperator', + data: { type: checker.typeToString(argType) }, + fix, + }); + } else if ( + checkNever && + unionParts.every( + part => + part.flags & + (ts.TypeFlags.Void | ts.TypeFlags.Undefined | ts.TypeFlags.Never), + ) + ) { + context.report({ + node, + messageId: 'meaninglessVoidOperator', + data: { type: checker.typeToString(argType) }, + suggest: [{ messageId: 'removeVoid', fix }], + }); + } + }, + }; + }, +}); diff --git a/packages/eslint-plugin/src/rules/no-misused-new.ts b/packages/eslint-plugin/src/rules/no-misused-new.ts index d0331e19fa35..ae79c28a6f2e 100644 --- a/packages/eslint-plugin/src/rules/no-misused-new.ts +++ b/packages/eslint-plugin/src/rules/no-misused-new.ts @@ -10,7 +10,6 @@ export default util.createRule({ type: 'problem', docs: { description: 'Enforce valid definition of `new` and `constructor`', - category: 'Best Practices', recommended: 'error', }, schema: [], diff --git a/packages/eslint-plugin/src/rules/no-misused-promises.ts b/packages/eslint-plugin/src/rules/no-misused-promises.ts index 58d4ac9f9c6c..353b7d4a8038 100644 --- a/packages/eslint-plugin/src/rules/no-misused-promises.ts +++ b/packages/eslint-plugin/src/rules/no-misused-promises.ts @@ -20,7 +20,6 @@ export default util.createRule({ meta: { docs: { description: 'Avoid using promises in places not designed to handle them', - category: 'Best Practices', recommended: 'error', requiresTypeChecking: true, }, diff --git a/packages/eslint-plugin/src/rules/no-namespace.ts b/packages/eslint-plugin/src/rules/no-namespace.ts index f8cc05b10471..f7fb0ea1e328 100644 --- a/packages/eslint-plugin/src/rules/no-namespace.ts +++ b/packages/eslint-plugin/src/rules/no-namespace.ts @@ -19,7 +19,6 @@ export default util.createRule({ docs: { description: 'Disallow the use of custom TypeScript modules and namespaces', - category: 'Best Practices', recommended: 'error', }, messages: { diff --git a/packages/eslint-plugin/src/rules/no-non-null-asserted-nullish-coalescing.ts b/packages/eslint-plugin/src/rules/no-non-null-asserted-nullish-coalescing.ts new file mode 100644 index 000000000000..93431950c35d --- /dev/null +++ b/packages/eslint-plugin/src/rules/no-non-null-asserted-nullish-coalescing.ts @@ -0,0 +1,107 @@ +import { + ASTUtils, + TSESTree, + TSESLint, +} from '@typescript-eslint/experimental-utils'; +import { Definition, DefinitionType } from '@typescript-eslint/scope-manager'; +import * as util from '../util'; + +function hasAssignmentBeforeNode( + variable: TSESLint.Scope.Variable, + node: TSESTree.Node, +): boolean { + return ( + variable.references.some( + ref => ref.isWrite() && ref.identifier.range[1] < node.range[1], + ) || + variable.defs.some( + def => + isDefinitionWithAssignment(def) && def.node.range[1] < node.range[1], + ) + ); +} + +function isDefinitionWithAssignment(definition: Definition): boolean { + if (definition.type !== DefinitionType.Variable) { + return false; + } + + const variableDeclarator = definition.node; + return ( + variableDeclarator.definite === true || variableDeclarator.init !== null + ); +} + +export default util.createRule({ + name: 'no-non-null-asserted-nullish-coalescing', + meta: { + type: 'problem', + docs: { + description: + 'Disallows using a non-null assertion in the left operand of the nullish coalescing operator', + recommended: false, + }, + messages: { + noNonNullAssertedNullishCoalescing: + 'The nullish coalescing operator is designed to handle undefined and null - using a non-null assertion is not needed.', + suggestRemovingNonNull: 'Remove the non-null assertion.', + }, + schema: [], + hasSuggestions: true, + }, + defaultOptions: [], + create(context) { + return { + 'LogicalExpression[operator = "??"] > TSNonNullExpression.left'( + node: TSESTree.TSNonNullExpression, + ): void { + if (node.expression.type === TSESTree.AST_NODE_TYPES.Identifier) { + const scope = context.getScope(); + const identifier = node.expression; + const variable = ASTUtils.findVariable(scope, identifier.name); + if (variable && !hasAssignmentBeforeNode(variable, node)) { + return; + } + } + + const sourceCode = context.getSourceCode(); + + context.report({ + node, + messageId: 'noNonNullAssertedNullishCoalescing', + /* + Use a suggestion instead of a fixer, because this can break type checks. + The resulting type of the nullish coalesce is only influenced by the right operand if the left operand can be `null` or `undefined`. + After removing the non-null assertion the type of the left operand might contain `null` or `undefined` and then the type of the right operand + might change the resulting type of the nullish coalesce. + See the following example: + + function test(x?: string): string { + const bar = x! ?? false; // type analysis reports `bar` has type `string` + // x ?? false; // type analysis reports `bar` has type `string | false` + return bar; + } + */ + suggest: [ + { + messageId: 'suggestRemovingNonNull', + fix(fixer): TSESLint.RuleFix { + const exclamationMark = util.nullThrows( + sourceCode.getLastToken( + node, + ASTUtils.isNonNullAssertionPunctuator, + ), + util.NullThrowsReasons.MissingToken( + '!', + 'Non-null Assertion', + ), + ); + return fixer.remove(exclamationMark); + }, + }, + ], + }); + }, + }; + }, +}); 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 f5652b257c14..9fdba130b97e 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 @@ -22,10 +22,10 @@ export default util.createRule({ docs: { description: 'Disallows using a non-null assertion after an optional chain expression', - category: 'Possible Errors', recommended: 'error', suggestion: true, }, + hasSuggestions: true, messages: { noNonNullOptionalChain: 'Optional chain expressions can return undefined by design - using a non-null assertion is unsafe and wrong.', 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 4012693c7554..cd9f0dbb2552 100644 --- a/packages/eslint-plugin/src/rules/no-non-null-assertion.ts +++ b/packages/eslint-plugin/src/rules/no-non-null-assertion.ts @@ -13,10 +13,10 @@ export default util.createRule<[], MessageIds>({ docs: { description: 'Disallows non-null assertions using the `!` postfix operator', - category: 'Stylistic Issues', recommended: 'warn', suggestion: true, }, + hasSuggestions: true, messages: { noNonNull: 'Forbidden non-null assertion.', suggestOptionalChain: diff --git a/packages/eslint-plugin/src/rules/no-parameter-properties.ts b/packages/eslint-plugin/src/rules/no-parameter-properties.ts index 9b6bb31e6541..613b839bbdfa 100644 --- a/packages/eslint-plugin/src/rules/no-parameter-properties.ts +++ b/packages/eslint-plugin/src/rules/no-parameter-properties.ts @@ -26,7 +26,6 @@ export default util.createRule({ docs: { description: 'Disallow the use of parameter properties in class constructors', - category: 'Stylistic Issues', // too opinionated to be recommended recommended: false, }, diff --git a/packages/eslint-plugin/src/rules/no-redeclare.ts b/packages/eslint-plugin/src/rules/no-redeclare.ts index fa67859f5096..914dd074d33f 100644 --- a/packages/eslint-plugin/src/rules/no-redeclare.ts +++ b/packages/eslint-plugin/src/rules/no-redeclare.ts @@ -19,7 +19,6 @@ export default util.createRule({ type: 'suggestion', docs: { description: 'Disallow variable redeclaration', - category: 'Best Practices', recommended: false, extendsBaseRule: true, }, @@ -63,10 +62,12 @@ export default util.createRule({ AST_NODE_TYPES.TSModuleDeclaration, AST_NODE_TYPES.FunctionDeclaration, ]); + const ENUM_DECLARATION_MERGE_NODES = new Set([ + AST_NODE_TYPES.TSEnumDeclaration, + AST_NODE_TYPES.TSModuleDeclaration, + ]); - function* iterateDeclarations( - variable: TSESLint.Scope.Variable, - ): Generator< + function* iterateDeclarations(variable: TSESLint.Scope.Variable): Generator< { type: 'builtin' | 'syntax' | 'comment'; node?: TSESTree.Identifier | TSESTree.Comment; @@ -166,12 +167,33 @@ export default util.createRule({ return; } - // there's more than one class declaration, which needs to be reported + // there's more than one function declaration, which needs to be reported for (const { identifier } of functionDecls) { yield { type: 'syntax', node: identifier, loc: identifier.loc }; } return; } + + if ( + // enum + namespace merging + identifiers.every(({ parent }) => + ENUM_DECLARATION_MERGE_NODES.has(parent.type), + ) + ) { + const enumDecls = identifiers.filter( + ({ parent }) => parent.type === AST_NODE_TYPES.TSEnumDeclaration, + ); + if (enumDecls.length === 1) { + // safe declaration merging + return; + } + + // there's more than one enum declaration, which needs to be reported + for (const { identifier } of enumDecls) { + yield { type: 'syntax', node: identifier, loc: identifier.loc }; + } + return; + } } for (const { identifier } of identifiers) { @@ -181,9 +203,8 @@ export default util.createRule({ function findVariablesInScope(scope: TSESLint.Scope.Scope): void { for (const variable of scope.variables) { - const [declaration, ...extraDeclarations] = iterateDeclarations( - variable, - ); + const [declaration, ...extraDeclarations] = + iterateDeclarations(variable); if (extraDeclarations.length === 0) { continue; diff --git a/packages/eslint-plugin/src/rules/no-require-imports.ts b/packages/eslint-plugin/src/rules/no-require-imports.ts index 91d81e0d8c53..49bd5f237b06 100644 --- a/packages/eslint-plugin/src/rules/no-require-imports.ts +++ b/packages/eslint-plugin/src/rules/no-require-imports.ts @@ -1,4 +1,4 @@ -import { TSESTree } from '@typescript-eslint/experimental-utils'; +import { ASTUtils, TSESTree } from '@typescript-eslint/experimental-utils'; import * as util from '../util'; export default util.createRule({ @@ -7,7 +7,6 @@ export default util.createRule({ type: 'problem', docs: { description: 'Disallows invocation of `require()`', - category: 'Best Practices', recommended: false, }, schema: [], @@ -18,13 +17,19 @@ export default util.createRule({ defaultOptions: [], create(context) { return { - 'CallExpression > Identifier[name="require"]'( - node: TSESTree.Identifier, + 'CallExpression[callee.name="require"]'( + node: TSESTree.CallExpression, ): void { - context.report({ - node: node.parent!, - messageId: 'noRequireImports', - }); + const variable = ASTUtils.findVariable(context.getScope(), 'require'); + + // ignore non-global require usage as it's something user-land custom instead + // of the commonjs standard + if (!variable?.identifiers.length) { + context.report({ + node, + messageId: 'noRequireImports', + }); + } }, TSExternalModuleReference(node): void { context.report({ diff --git a/packages/eslint-plugin/src/rules/no-restricted-imports.ts b/packages/eslint-plugin/src/rules/no-restricted-imports.ts new file mode 100644 index 000000000000..d7437cab76bb --- /dev/null +++ b/packages/eslint-plugin/src/rules/no-restricted-imports.ts @@ -0,0 +1,195 @@ +import { TSESTree } from '@typescript-eslint/experimental-utils'; +import { + ArrayOfStringOrObject, + ArrayOfStringOrObjectPatterns, +} from 'eslint/lib/rules/no-restricted-imports'; +import ignore, { Ignore } from 'ignore'; +import { + createRule, + deepMerge, + InferMessageIdsTypeFromRule, + InferOptionsTypeFromRule, +} from '../util'; +import { getESLintCoreRule } from '../util/getESLintCoreRule'; + +const baseRule = getESLintCoreRule('no-restricted-imports'); + +export type Options = InferOptionsTypeFromRule; +export type MessageIds = InferMessageIdsTypeFromRule; + +const allowTypeImportsOptionSchema = { + allowTypeImports: { + type: 'boolean', + default: false, + }, +}; +const schemaForMergeArrayOfStringsOrObjects = { + items: { + anyOf: [ + {}, + { + properties: allowTypeImportsOptionSchema, + }, + ], + }, +}; +const schemaForMergeArrayOfStringsOrObjectPatterns = { + anyOf: [ + {}, + { + items: { + properties: allowTypeImportsOptionSchema, + }, + }, + ], +}; +const schema = deepMerge( + { ...baseRule.meta.schema }, + { + anyOf: [ + schemaForMergeArrayOfStringsOrObjects, + { + items: { + properties: { + paths: schemaForMergeArrayOfStringsOrObjects, + patterns: schemaForMergeArrayOfStringsOrObjectPatterns, + }, + }, + }, + ], + }, +); + +function isObjectOfPaths( + obj: unknown, +): obj is { paths: ArrayOfStringOrObject } { + return Object.prototype.hasOwnProperty.call(obj, 'paths'); +} + +function isObjectOfPatterns( + obj: unknown, +): obj is { patterns: ArrayOfStringOrObjectPatterns } { + return Object.prototype.hasOwnProperty.call(obj, 'patterns'); +} + +function isOptionsArrayOfStringOrObject( + options: Options, +): options is ArrayOfStringOrObject { + if (isObjectOfPaths(options[0])) { + return false; + } + if (isObjectOfPatterns(options[0])) { + return false; + } + return true; +} + +function getRestrictedPaths(options: Options): ArrayOfStringOrObject { + if (isOptionsArrayOfStringOrObject(options)) { + return options; + } + if (isObjectOfPaths(options[0])) { + return options[0].paths; + } + return []; +} + +function getRestrictedPatterns( + options: Options, +): ArrayOfStringOrObjectPatterns { + if (isObjectOfPatterns(options[0])) { + return options[0].patterns; + } + return []; +} + +export default createRule({ + name: 'no-restricted-imports', + meta: { + type: 'suggestion', + docs: { + description: 'Disallow specified modules when loaded by `import`', + recommended: false, + extendsBaseRule: true, + }, + messages: baseRule.meta.messages, + fixable: baseRule.meta.fixable, + schema, + }, + defaultOptions: [], + create(context) { + const rules = baseRule.create(context); + const { options } = context; + + if (options.length === 0) { + return {}; + } + + const restrictedPaths = getRestrictedPaths(options); + const allowedTypeImportPathNameSet: Set = new Set(); + for (const restrictedPath of restrictedPaths) { + if ( + typeof restrictedPath === 'object' && + restrictedPath.allowTypeImports + ) { + allowedTypeImportPathNameSet.add(restrictedPath.name); + } + } + function isAllowedTypeImportPath(importSource: string): boolean { + return allowedTypeImportPathNameSet.has(importSource); + } + + const restrictedPatterns = getRestrictedPatterns(options); + const allowedImportTypeMatchers: Ignore[] = []; + for (const restrictedPattern of restrictedPatterns) { + if ( + typeof restrictedPattern === 'object' && + restrictedPattern.allowTypeImports + ) { + allowedImportTypeMatchers.push(ignore().add(restrictedPattern.group)); + } + } + function isAllowedTypeImportPattern(importSource: string): boolean { + return ( + allowedImportTypeMatchers.length > 0 && + allowedImportTypeMatchers.every(matcher => { + return matcher.ignores(importSource); + }) + ); + } + + return { + ImportDeclaration(node): void { + if (node.importKind === 'type') { + const importSource = node.source.value.trim(); + if ( + !isAllowedTypeImportPath(importSource) && + !isAllowedTypeImportPattern(importSource) + ) { + return rules.ImportDeclaration(node); + } + } else { + return rules.ImportDeclaration(node); + } + }, + 'ExportNamedDeclaration[source]'( + node: TSESTree.ExportNamedDeclaration & { + source: NonNullable; + }, + ): void { + if (node.exportKind === 'type') { + const importSource = node.source.value.trim(); + if ( + !isAllowedTypeImportPath(importSource) && + !isAllowedTypeImportPattern(importSource) + ) { + return rules.ExportNamedDeclaration(node); + } + } else { + return rules.ExportNamedDeclaration(node); + } + }, + ExportAllDeclaration: rules.ExportAllDeclaration, + }; + }, +}); diff --git a/packages/eslint-plugin/src/rules/no-shadow.ts b/packages/eslint-plugin/src/rules/no-shadow.ts index 1d1f894b651f..dfba42cf301e 100644 --- a/packages/eslint-plugin/src/rules/no-shadow.ts +++ b/packages/eslint-plugin/src/rules/no-shadow.ts @@ -1,9 +1,15 @@ import { - TSESTree, - TSESLint, + ASTUtils, AST_NODE_TYPES, + TSESLint, + TSESTree, } from '@typescript-eslint/experimental-utils'; -import { ScopeType } from '@typescript-eslint/scope-manager'; +import { + Definition, + DefinitionType, + ImportBindingDefinition, + ScopeType, +} from '@typescript-eslint/scope-manager'; import * as util from '../util'; type MessageIds = 'noShadow'; @@ -24,7 +30,6 @@ export default util.createRule({ docs: { description: 'Disallow variable declarations from shadowing variables declared in the outer scope', - category: 'Variables', recommended: false, extendsBaseRule: true, }, @@ -82,7 +87,19 @@ export default util.createRule({ * Check if variable is a `this` parameter. */ function isThisParam(variable: TSESLint.Scope.Variable): boolean { - return variable.defs[0].type === 'Parameter' && variable.name === 'this'; + return ( + variable.defs[0].type === DefinitionType.Parameter && + variable.name === 'this' + ); + } + + function isTypeImport( + definition?: Definition, + ): definition is ImportBindingDefinition { + return ( + definition?.type === DefinitionType.ImportBinding && + definition.parent.importKind === 'type' + ); } function isTypeValueShadow( @@ -98,8 +115,11 @@ export default util.createRule({ return false; } + const [firstDefinition] = shadowed.defs; const isShadowedValue = - 'isValueVariable' in shadowed ? shadowed.isValueVariable : true; + !('isValueVariable' in shadowed) || + !firstDefinition || + (!isTypeImport(firstDefinition) && shadowed.isValueVariable); return variable.isValueVariable !== isShadowedValue; } @@ -126,6 +146,125 @@ export default util.createRule({ return util.isFunctionType(id.parent); } + function isGenericOfStaticMethod( + variable: TSESLint.Scope.Variable, + ): boolean { + if (!('isTypeVariable' in variable)) { + // this shouldn't happen... + return false; + } + + if (!variable.isTypeVariable) { + return false; + } + + if (variable.identifiers.length === 0) { + return false; + } + + const typeParameter = variable.identifiers[0].parent; + if (typeParameter?.type !== AST_NODE_TYPES.TSTypeParameter) { + return false; + } + const typeParameterDecl = typeParameter.parent; + if ( + typeParameterDecl?.type !== AST_NODE_TYPES.TSTypeParameterDeclaration + ) { + return false; + } + const functionExpr = typeParameterDecl.parent; + if ( + !functionExpr || + (functionExpr.type !== AST_NODE_TYPES.FunctionExpression && + functionExpr.type !== AST_NODE_TYPES.TSEmptyBodyFunctionExpression) + ) { + return false; + } + const methodDefinition = functionExpr.parent; + if (methodDefinition?.type !== AST_NODE_TYPES.MethodDefinition) { + return false; + } + return methodDefinition.static; + } + + function isGenericOfClassDecl(variable: TSESLint.Scope.Variable): boolean { + if (!('isTypeVariable' in variable)) { + // this shouldn't happen... + return false; + } + + if (!variable.isTypeVariable) { + return false; + } + + if (variable.identifiers.length === 0) { + return false; + } + + const typeParameter = variable.identifiers[0].parent; + if (typeParameter?.type !== AST_NODE_TYPES.TSTypeParameter) { + return false; + } + const typeParameterDecl = typeParameter.parent; + if ( + typeParameterDecl?.type !== AST_NODE_TYPES.TSTypeParameterDeclaration + ) { + return false; + } + const classDecl = typeParameterDecl.parent; + return classDecl?.type === AST_NODE_TYPES.ClassDeclaration; + } + + function isGenericOfAStaticMethodShadow( + variable: TSESLint.Scope.Variable, + shadowed: TSESLint.Scope.Variable, + ): boolean { + return ( + isGenericOfStaticMethod(variable) && isGenericOfClassDecl(shadowed) + ); + } + + function isImportDeclaration( + definition: + | TSESTree.ImportDeclaration + | TSESTree.TSImportEqualsDeclaration, + ): definition is TSESTree.ImportDeclaration { + return definition.type === AST_NODE_TYPES.ImportDeclaration; + } + + function isExternalModuleDeclarationWithName( + scope: TSESLint.Scope.Scope, + name: string, + ): boolean { + return ( + scope.type === ScopeType.tsModule && + scope.block.type === AST_NODE_TYPES.TSModuleDeclaration && + scope.block.id.type === AST_NODE_TYPES.Literal && + scope.block.id.value === name + ); + } + + function isExternalDeclarationMerging( + scope: TSESLint.Scope.Scope, + variable: TSESLint.Scope.Variable, + shadowed: TSESLint.Scope.Variable, + ): boolean { + const [firstDefinition] = shadowed.defs; + const [secondDefinition] = variable.defs; + + return ( + isTypeImport(firstDefinition) && + isImportDeclaration(firstDefinition.parent) && + isExternalModuleDeclarationWithName( + scope, + firstDefinition.parent.source.value, + ) && + secondDefinition.node.type === AST_NODE_TYPES.TSInterfaceDeclaration && + secondDefinition.node.parent?.type === + AST_NODE_TYPES.ExportNamedDeclaration + ); + } + /** * Check if variable name is allowed. * @param variable The variable to check. @@ -198,7 +337,7 @@ export default util.createRule({ inner && outer[0] < inner[0] && inner[1] < outer[1] && - ((innerDef.type === 'FunctionName' && + ((innerDef.type === DefinitionType.FunctionName && innerDef.node.type === AST_NODE_TYPES.FunctionExpression) || innerDef.node.type === AST_NODE_TYPES.ClassExpression) && outerScope === innerScope.upper @@ -242,31 +381,6 @@ export default util.createRule({ ); } - /** - * Finds the variable by a given name in a given scope and its upper scopes. - * @param initScope A scope to start find. - * @param name A variable name to find. - * @returns A found variable or `null`. - */ - function getVariableByName( - initScope: TSESLint.Scope.Scope | null, - name: string, - ): TSESLint.Scope.Variable | null { - let scope = initScope; - - while (scope) { - const variable = scope.set.get(name); - - if (variable) { - return variable; - } - - scope = scope.upper; - } - - return null; - } - /** * Checks the current context for shadowed variables. * @param {Scope} scope Fixme @@ -306,7 +420,9 @@ export default util.createRule({ } // Gets shadowed variable. - const shadowed = getVariableByName(scope.upper, variable.name); + const shadowed = scope.upper + ? ASTUtils.findVariable(scope.upper, variable.name) + : null; if (!shadowed) { continue; } @@ -321,6 +437,17 @@ export default util.createRule({ continue; } + // ignore static class method generic shadowing class generic + // this is impossible for the scope analyser to understand + // so we have to handle this manually in this rule + if (isGenericOfAStaticMethodShadow(variable, shadowed)) { + continue; + } + + if (isExternalDeclarationMerging(scope, variable, shadowed)) { + continue; + } + const isESLintGlobal = 'writeable' in shadowed; if ( (shadowed.identifiers.length > 0 || diff --git a/packages/eslint-plugin/src/rules/no-this-alias.ts b/packages/eslint-plugin/src/rules/no-this-alias.ts index 8865fad2c3fb..82ab9b22b0fa 100644 --- a/packages/eslint-plugin/src/rules/no-this-alias.ts +++ b/packages/eslint-plugin/src/rules/no-this-alias.ts @@ -18,7 +18,6 @@ export default util.createRule({ type: 'suggestion', docs: { description: 'Disallow aliasing `this`', - category: 'Best Practices', recommended: 'error', }, schema: [ diff --git a/packages/eslint-plugin/src/rules/no-throw-literal.ts b/packages/eslint-plugin/src/rules/no-throw-literal.ts index 92bf3b02a135..178f1f39f9ca 100644 --- a/packages/eslint-plugin/src/rules/no-throw-literal.ts +++ b/packages/eslint-plugin/src/rules/no-throw-literal.ts @@ -11,7 +11,6 @@ export default util.createRule({ type: 'problem', docs: { description: 'Disallow throwing literals as exceptions', - category: 'Best Practices', recommended: false, extendsBaseRule: true, requiresTypeChecking: true, diff --git a/packages/eslint-plugin/src/rules/no-type-alias.ts b/packages/eslint-plugin/src/rules/no-type-alias.ts index c53b7d1ee68c..347e36f0a425 100644 --- a/packages/eslint-plugin/src/rules/no-type-alias.ts +++ b/packages/eslint-plugin/src/rules/no-type-alias.ts @@ -1,5 +1,6 @@ import { AST_NODE_TYPES, + AST_TOKEN_TYPES, TSESTree, } from '@typescript-eslint/experimental-utils'; import * as util from '../util'; @@ -27,6 +28,7 @@ type Options = [ allowLiterals?: Values; allowMappedTypes?: Values; allowTupleTypes?: Values; + allowGenerics?: 'always' | 'never'; }, ]; type MessageIds = 'noTypeAlias' | 'noCompositionAlias'; @@ -45,7 +47,6 @@ export default util.createRule({ type: 'suggestion', docs: { description: 'Disallow the use of type aliases', - category: 'Stylistic Issues', // too opinionated to be recommended recommended: false, }, @@ -79,6 +80,9 @@ export default util.createRule({ allowTupleTypes: { enum: enumValues, }, + allowGenerics: { + enum: ['always', 'never'], + }, }, additionalProperties: false, }, @@ -93,6 +97,7 @@ export default util.createRule({ allowLiterals: 'never', allowMappedTypes: 'never', allowTupleTypes: 'never', + allowGenerics: 'never', }, ], create( @@ -106,6 +111,7 @@ export default util.createRule({ allowLiterals, allowMappedTypes, allowTupleTypes, + allowGenerics, }, ], ) { @@ -122,6 +128,7 @@ export default util.createRule({ ]; const aliasTypes = new Set([ AST_NODE_TYPES.TSArrayType, + AST_NODE_TYPES.TSImportType, AST_NODE_TYPES.TSTypeReference, AST_NODE_TYPES.TSLiteralType, AST_NODE_TYPES.TSTypeQuery, @@ -202,6 +209,13 @@ export default util.createRule({ return false; }; + const isValidGeneric = (type: TypeWithLabel): boolean => { + return ( + type.node.type === AST_NODE_TYPES.TSTypeReference && + type.node.typeParameters !== undefined + ); + }; + const checkAndReport = ( optionValue: Values, isTopLevel: boolean, @@ -259,14 +273,18 @@ export default util.createRule({ } else if (isValidTupleType(type)) { // tuple types checkAndReport(allowTupleTypes!, isTopLevel, type, 'Tuple Types'); + } else if (isValidGeneric(type)) { + if (allowGenerics === 'never') { + reportError(type.node, type.compositionType, isTopLevel, 'Generics'); + } } else if ( - // eslint-disable-next-line @typescript-eslint/internal/prefer-ast-types-enum - type.node.type.endsWith('Keyword') || + type.node.type.endsWith(AST_TOKEN_TYPES.Keyword) || aliasTypes.has(type.node.type) || (type.node.type === AST_NODE_TYPES.TSTypeOperator && - type.node.operator === 'readonly' && - type.node.typeAnnotation && - aliasTypes.has(type.node.typeAnnotation.type)) + (type.node.operator === 'keyof' || + (type.node.operator === 'readonly' && + type.node.typeAnnotation && + aliasTypes.has(type.node.typeAnnotation.type)))) ) { // alias / keyword checkAndReport(allowAliases!, isTopLevel, type, 'Aliases'); @@ -292,9 +310,6 @@ export default util.createRule({ return acc; }, []); } - if (node.type === AST_NODE_TYPES.TSParenthesizedType) { - return getTypes(node.typeAnnotation, compositionType); - } return [{ node, compositionType }]; } 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 fe1fd24cc4f1..8583e657f915 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 @@ -38,7 +38,6 @@ export default util.createRule({ docs: { description: 'Flags unnecessary equality comparisons against boolean literals', - category: 'Stylistic Issues', recommended: false, requiresTypeChecking: true, }, @@ -186,7 +185,7 @@ export default util.createRule({ range: expression.range[0] < against.range[0] ? [expression.range[1], against.range[1]] - : [against.range[1], expression.range[1]], + : [against.range[0], expression.range[0]], }; } diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts b/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts index aee4963a0c05..4e73c0623ad1 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts @@ -90,7 +90,6 @@ export default createRule({ docs: { description: 'Prevents conditionals where the type is always truthy or always falsy', - category: 'Best Practices', recommended: false, requiresTypeChecking: true, }, @@ -121,11 +120,11 @@ export default createRule({ alwaysNullish: 'Unnecessary conditional, left-hand side of `??` operator is always `null` or `undefined`.', literalBooleanExpression: - 'Unnecessary conditional, both sides of the expression are literal values', + 'Unnecessary conditional, both sides of the expression are literal values.', noOverlapBooleanExpression: - 'Unnecessary conditional, the types have no overlap', - never: 'Unnecessary conditional, value is `never`', - neverOptionalChain: 'Unnecessary optional chain on a non-nullish value', + 'Unnecessary conditional, the types have no overlap.', + never: 'Unnecessary conditional, value is `never`.', + neverOptionalChain: 'Unnecessary optional chain on a non-nullish value.', noStrictNullCheck: 'This rule requires the `strictNullChecks` compiler option to be turned on to function correctly.', }, @@ -167,7 +166,7 @@ export default createRule({ }); } - function getNodeType(node: TSESTree.Expression): ts.Type { + function getNodeType(node: TSESTree.Node): ts.Type { const tsNode = service.esTreeNodeToTSNodeMap.get(node); return getConstrainedTypeAtLocation(checker, tsNode); } @@ -261,12 +260,6 @@ export default createRule({ } function checkNodeForNullish(node: TSESTree.Expression): void { - // Since typescript array index signature types don't represent the - // possibility of out-of-bounds access, if we're indexing into an array - // just skip the check, to avoid false positives - if (isArrayIndexExpression(node)) { - return; - } const type = getNodeType(node); // Conditional is always necessary if it involves `any` or `unknown` if (isTypeAnyType(type) || isTypeUnknownType(type)) { @@ -277,7 +270,19 @@ export default createRule({ if (isTypeFlagSet(type, ts.TypeFlags.Never)) { messageId = 'never'; } else if (!isPossiblyNullish(type)) { - messageId = 'neverNullish'; + // Since typescript array index signature types don't represent the + // possibility of out-of-bounds access, if we're indexing into an array + // just skip the check, to avoid false positives + if ( + !isArrayIndexExpression(node) && + !( + node.type === AST_NODE_TYPES.ChainExpression && + node.expression.type !== AST_NODE_TYPES.TSNonNullExpression && + optionChainContainsOptionArrayIndex(node.expression) + ) + ) { + messageId = 'neverNullish'; + } } else if (isAlwaysNullish(type)) { messageId = 'alwaysNullish'; } @@ -443,9 +448,9 @@ 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 = getCallSignaturesOfType(getNodeType(callback)).map( + sig => sig.getReturnType(), + ); /* istanbul ignore if */ if (returnTypes.length === 0) { // Not a callable function return; @@ -477,19 +482,19 @@ export default createRule({ // ?.x // type is {y: "z"} // ?.y // This access is considered "unnecessary" according to the types // ``` - function optionChainContainsArrayIndex( + function optionChainContainsOptionArrayIndex( node: TSESTree.MemberExpression | TSESTree.CallExpression, ): boolean { const lhsNode = node.type === AST_NODE_TYPES.CallExpression ? node.callee : node.object; - if (isArrayIndexExpression(lhsNode)) { + if (node.optional && isArrayIndexExpression(lhsNode)) { return true; } if ( lhsNode.type === AST_NODE_TYPES.MemberExpression || lhsNode.type === AST_NODE_TYPES.CallExpression ) { - return optionChainContainsArrayIndex(lhsNode); + return optionChainContainsOptionArrayIndex(lhsNode); } return false; } @@ -584,7 +589,7 @@ export default createRule({ // Since typescript array index signature types don't represent the // possibility of out-of-bounds access, if we're indexing into an array // just skip the check, to avoid false positives - if (optionChainContainsArrayIndex(node)) { + if (optionChainContainsOptionArrayIndex(node)) { return; } diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-qualifier.ts b/packages/eslint-plugin/src/rules/no-unnecessary-qualifier.ts index 395bbfdc4f32..1f4652085bda 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-qualifier.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-qualifier.ts @@ -10,7 +10,6 @@ export default util.createRule({ name: 'no-unnecessary-qualifier', meta: { docs: { - category: 'Best Practices', description: 'Warns when a namespace qualifier is unnecessary', recommended: false, requiresTypeChecking: true, @@ -170,12 +169,16 @@ export default util.createRule({ return { TSModuleDeclaration: enterDeclaration, TSEnumDeclaration: enterDeclaration, - 'ExportNamedDeclaration[declaration.type="TSModuleDeclaration"]': enterDeclaration, - 'ExportNamedDeclaration[declaration.type="TSEnumDeclaration"]': enterDeclaration, + 'ExportNamedDeclaration[declaration.type="TSModuleDeclaration"]': + enterDeclaration, + 'ExportNamedDeclaration[declaration.type="TSEnumDeclaration"]': + enterDeclaration, 'TSModuleDeclaration:exit': exitDeclaration, 'TSEnumDeclaration:exit': exitDeclaration, - 'ExportNamedDeclaration[declaration.type="TSModuleDeclaration"]:exit': exitDeclaration, - 'ExportNamedDeclaration[declaration.type="TSEnumDeclaration"]:exit': exitDeclaration, + 'ExportNamedDeclaration[declaration.type="TSModuleDeclaration"]:exit': + exitDeclaration, + 'ExportNamedDeclaration[declaration.type="TSEnumDeclaration"]:exit': + exitDeclaration, TSQualifiedName(node: TSESTree.TSQualifiedName): void { visitNamespaceAccess(node, node.left, node.right); }, 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 2ff89c5931b4..9f7d718c2d92 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-type-arguments.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-type-arguments.ts @@ -22,7 +22,6 @@ export default util.createRule<[], MessageIds>({ docs: { description: 'Enforces that type arguments will not be used if not required', - category: 'Best Practices', recommended: false, requiresTypeChecking: true, }, @@ -118,7 +117,7 @@ function getTypeParametersFromType( } return findFirstResult(declarations, decl => - tsutils.isClassLikeDeclaration(decl) || + ts.isClassLike(decl) || ts.isTypeAliasDeclaration(decl) || ts.isInterfaceDeclaration(decl) ? decl.typeParameters 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 634d8b890ce1..cd5bce1845d5 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-type-assertion.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-type-assertion.ts @@ -25,7 +25,6 @@ export default util.createRule({ docs: { description: 'Warns if a type assertion does not change the type of an expression', - category: 'Best Practices', recommended: 'error', requiresTypeChecking: true, }, @@ -135,7 +134,31 @@ export default util.createRule({ return { TSNonNullExpression(node): void { + if ( + node.parent?.type === AST_NODE_TYPES.AssignmentExpression && + node.parent.operator === '=' + ) { + if (node.parent.left === node) { + context.report({ + node, + messageId: 'contextuallyUnnecessary', + fix(fixer) { + return fixer.removeRange([ + node.expression.range[1], + node.range[1], + ]); + }, + }); + } + // for all other = assignments we ignore non-null checks + // this is because non-null assertions can change the type-flow of the code + // so whilst they might be unnecessary for the assignment - they are necessary + // for following code + return; + } + const originalNode = parserServices.esTreeNodeToTSNodeMap.get(node); + const type = util.getConstrainedTypeAtLocation( checker, originalNode.expression, @@ -239,15 +262,21 @@ export default util.createRule({ node, messageId: 'unnecessaryAssertion', fix(fixer) { - return originalNode.kind === ts.SyntaxKind.TypeAssertionExpression - ? fixer.removeRange([ - node.range[0], - node.expression.range[0] - 1, - ]) - : fixer.removeRange([ - node.expression.range[1] + 1, - node.range[1], - ]); + if (originalNode.kind === ts.SyntaxKind.TypeAssertionExpression) { + const closingAngleBracket = sourceCode.getTokenAfter( + node.typeAnnotation, + ); + return closingAngleBracket?.value === '>' + ? fixer.removeRange([ + node.range[0], + closingAngleBracket.range[1], + ]) + : null; + } + return fixer.removeRange([ + node.expression.range[1] + 1, + node.range[1], + ]); }, }); } 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 6d5036c2d75a..68895c01e71d 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-type-constraint.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-type-constraint.ts @@ -32,9 +32,8 @@ export default util.createRule({ name: 'no-unnecessary-type-constraint', meta: { docs: { - category: 'Best Practices', description: 'Disallows unnecessary constraints on generic types', - recommended: false, + recommended: 'error', suggestion: true, }, fixable: 'code', diff --git a/packages/eslint-plugin/src/rules/no-unsafe-argument.ts b/packages/eslint-plugin/src/rules/no-unsafe-argument.ts new file mode 100644 index 000000000000..3df1e6a486c0 --- /dev/null +++ b/packages/eslint-plugin/src/rules/no-unsafe-argument.ts @@ -0,0 +1,279 @@ +import { + AST_NODE_TYPES, + TSESTree, +} from '@typescript-eslint/experimental-utils'; +import * as ts from 'typescript'; +import * as util from '../util'; + +type MessageIds = + | 'unsafeArgument' + | 'unsafeTupleSpread' + | 'unsafeArraySpread' + | 'unsafeSpread'; + +const enum RestTypeKind { + Array, + Tuple, + Other, +} +type RestType = + | { + type: ts.Type; + kind: RestTypeKind.Array; + index: number; + } + | { + typeArguments: readonly ts.Type[]; + kind: RestTypeKind.Tuple; + index: number; + } + | { + type: ts.Type; + kind: RestTypeKind.Other; + index: number; + }; + +class FunctionSignature { + private parameterTypeIndex = 0; + + public static create( + checker: ts.TypeChecker, + tsNode: ts.CallLikeExpression, + ): FunctionSignature | null { + const signature = checker.getResolvedSignature(tsNode); + if (!signature) { + return null; + } + + const paramTypes: ts.Type[] = []; + let restType: RestType | null = null; + + const parameters = signature.getParameters(); + for (let i = 0; i < parameters.length; i += 1) { + const param = parameters[i]; + const type = checker.getTypeOfSymbolAtLocation(param, tsNode); + + const decl = param.getDeclarations()?.[0]; + if (decl && ts.isParameter(decl) && decl.dotDotDotToken) { + // is a rest param + if (checker.isArrayType(type)) { + restType = { + type: checker.getTypeArguments(type)[0], + kind: RestTypeKind.Array, + index: i, + }; + } else if (checker.isTupleType(type)) { + restType = { + typeArguments: checker.getTypeArguments(type), + kind: RestTypeKind.Tuple, + index: i, + }; + } else { + restType = { + type, + kind: RestTypeKind.Other, + index: i, + }; + } + break; + } + + paramTypes.push(type); + } + + return new this(paramTypes, restType); + } + + private hasConsumedArguments = false; + + private constructor( + private paramTypes: ts.Type[], + private restType: RestType | null, + ) {} + + public getNextParameterType(): ts.Type | null { + const index = this.parameterTypeIndex; + this.parameterTypeIndex += 1; + + if (index >= this.paramTypes.length || this.hasConsumedArguments) { + if (this.restType == null) { + return null; + } + + switch (this.restType.kind) { + case RestTypeKind.Tuple: { + const typeArguments = this.restType.typeArguments; + if (this.hasConsumedArguments) { + // all types consumed by a rest - just assume it's the last type + // there is one edge case where this is wrong, but we ignore it because + // it's rare and really complicated to handle + // eg: function foo(...a: [number, ...string[], number]) + return typeArguments[typeArguments.length - 1]; + } + + const typeIndex = index - this.restType.index; + if (typeIndex >= typeArguments.length) { + return typeArguments[typeArguments.length - 1]; + } + + return typeArguments[typeIndex]; + } + + case RestTypeKind.Array: + case RestTypeKind.Other: + return this.restType.type; + } + } + return this.paramTypes[index]; + } + + public consumeRemainingArguments(): void { + this.hasConsumedArguments = true; + } +} + +export default util.createRule<[], MessageIds>({ + name: 'no-unsafe-argument', + meta: { + type: 'problem', + docs: { + description: 'Disallows calling a function with an any type value', + recommended: 'error', + requiresTypeChecking: true, + }, + messages: { + unsafeArgument: + 'Unsafe argument of type `{{sender}}` assigned to a parameter of type `{{receiver}}`.', + unsafeTupleSpread: + 'Unsafe spread of a tuple type. The {{index}} element is of type `{{sender}}` and is assigned to a parameter of type `{{reciever}}`.', + unsafeArraySpread: 'Unsafe spread of an `any` array type.', + unsafeSpread: 'Unsafe spread of an `any` type.', + }, + schema: [], + }, + defaultOptions: [], + create(context) { + const { program, esTreeNodeToTSNodeMap } = util.getParserServices(context); + const checker = program.getTypeChecker(); + + return { + 'CallExpression, NewExpression'( + node: TSESTree.CallExpression | TSESTree.NewExpression, + ): void { + if (node.arguments.length === 0) { + return; + } + + // ignore any-typed calls as these are caught by no-unsafe-call + if ( + util.isTypeAnyType( + checker.getTypeAtLocation(esTreeNodeToTSNodeMap.get(node.callee)), + ) + ) { + return; + } + + const tsNode = esTreeNodeToTSNodeMap.get(node); + const signature = FunctionSignature.create(checker, tsNode); + if (!signature) { + return; + } + + for (let i = 0; i < node.arguments.length; i += 1) { + const argument = node.arguments[i]; + + switch (argument.type) { + // spreads consume + case AST_NODE_TYPES.SpreadElement: { + const spreadArgType = checker.getTypeAtLocation( + esTreeNodeToTSNodeMap.get(argument.argument), + ); + + if (util.isTypeAnyType(spreadArgType)) { + // foo(...any) + context.report({ + node: argument, + messageId: 'unsafeSpread', + }); + } else if (util.isTypeAnyArrayType(spreadArgType, checker)) { + // foo(...any[]) + + // TODO - we could break down the spread and compare the array type against each argument + context.report({ + node: argument, + messageId: 'unsafeArraySpread', + }); + } else if (checker.isTupleType(spreadArgType)) { + // foo(...[tuple1, tuple2]) + const spreadTypeArguments = + checker.getTypeArguments(spreadArgType); + for (let j = 0; j < spreadTypeArguments.length; j += 1) { + const tupleType = spreadTypeArguments[j]; + const parameterType = signature.getNextParameterType(); + if (parameterType == null) { + continue; + } + const result = util.isUnsafeAssignment( + tupleType, + parameterType, + checker, + // we can't pass the individual tuple members in here as this will most likely be a spread variable + // not a spread array + null, + ); + if (result) { + context.report({ + node: argument, + messageId: 'unsafeTupleSpread', + data: { + sender: checker.typeToString(tupleType), + receiver: checker.typeToString(parameterType), + }, + }); + } + } + if (spreadArgType.target.hasRestElement) { + // the last element was a rest - so all remaining defined arguments can be considered "consumed" + // all remaining arguments should be compared against the rest type (if one exists) + signature.consumeRemainingArguments(); + } + } else { + // something that's iterable + // handling this will be pretty complex - so we ignore it for now + // TODO - handle generic iterable case + } + break; + } + + default: { + const parameterType = signature.getNextParameterType(); + if (parameterType == null) { + continue; + } + + const argumentType = checker.getTypeAtLocation( + esTreeNodeToTSNodeMap.get(argument), + ); + const result = util.isUnsafeAssignment( + argumentType, + parameterType, + checker, + argument, + ); + if (result) { + context.report({ + node: argument, + messageId: 'unsafeArgument', + data: { + sender: checker.typeToString(argumentType), + receiver: checker.typeToString(parameterType), + }, + }); + } + } + } + } + }, + }; + }, +}); diff --git a/packages/eslint-plugin/src/rules/no-unsafe-assignment.ts b/packages/eslint-plugin/src/rules/no-unsafe-assignment.ts index 4a8f2a9ea237..cb4b8e7c636a 100644 --- a/packages/eslint-plugin/src/rules/no-unsafe-assignment.ts +++ b/packages/eslint-plugin/src/rules/no-unsafe-assignment.ts @@ -2,8 +2,10 @@ import { TSESTree, AST_NODE_TYPES, } from '@typescript-eslint/experimental-utils'; +import * as tsutils from 'tsutils'; import * as ts from 'typescript'; import * as util from '../util'; +import { getThisExpression } from '../util'; const enum ComparisonType { /** Do no assignment comparison */ @@ -20,18 +22,21 @@ export default util.createRule({ type: 'problem', docs: { description: 'Disallows assigning any to variables and properties', - category: 'Possible Errors', recommended: 'error', requiresTypeChecking: true, }, messages: { - anyAssignment: 'Unsafe assignment of an any value.', - unsafeArrayPattern: 'Unsafe array destructuring of an any array value.', + anyAssignment: 'Unsafe assignment of an `any` value.', + anyAssignmentThis: [ + 'Unsafe assignment of an `any` value. `this` is typed as `any`.', + 'You can try to fix this by turning on the `noImplicitThis` compiler option, or adding a `this` parameter to the function.', + ].join('\n'), + unsafeArrayPattern: 'Unsafe array destructuring of an `any` array value.', unsafeArrayPatternFromTuple: - 'Unsafe array destructuring of a tuple element with an any value.', + 'Unsafe array destructuring of a tuple element with an `any` value.', unsafeAssignment: 'Unsafe assignment of type {{sender}} to a variable of type {{receiver}}.', - unsafeArraySpread: 'Unsafe spread of an any value in an array.', + unsafeArraySpread: 'Unsafe spread of an `any` value in an array.', }, schema: [], }, @@ -39,6 +44,11 @@ export default util.createRule({ create(context) { const { program, esTreeNodeToTSNodeMap } = util.getParserServices(context); const checker = program.getTypeChecker(); + const compilerOptions = program.getCompilerOptions(); + const isNoImplicitThis = tsutils.isStrictCompilerOptionEnabled( + compilerOptions, + 'noImplicitThis', + ); // returns true if the assignment reported function checkArrayDestructureHelper( @@ -243,9 +253,27 @@ export default util.createRule({ return false; } + let messageId: 'anyAssignment' | 'anyAssignmentThis' = 'anyAssignment'; + + if (!isNoImplicitThis) { + // `var foo = this` + const thisExpression = getThisExpression(senderNode); + if ( + thisExpression && + util.isTypeAnyType( + util.getConstrainedTypeAtLocation( + checker, + esTreeNodeToTSNodeMap.get(thisExpression), + ), + ) + ) { + messageId = 'anyAssignmentThis'; + } + } + context.report({ node: reportingNode, - messageId: 'anyAssignment', + messageId, }); return true; } @@ -254,7 +282,12 @@ export default util.createRule({ return false; } - const result = util.isUnsafeAssignment(senderType, receiverType, checker); + const result = util.isUnsafeAssignment( + senderType, + receiverType, + checker, + senderNode, + ); if (!result) { return false; } @@ -303,7 +336,9 @@ export default util.createRule({ checkObjectDestructureHelper(node.id, init); } }, - 'ClassProperty[value != null]'(node: TSESTree.ClassProperty): void { + 'PropertyDefinition[value != null]'( + node: TSESTree.PropertyDefinition, + ): void { checkAssignment( node.key, node.value!, diff --git a/packages/eslint-plugin/src/rules/no-unsafe-call.ts b/packages/eslint-plugin/src/rules/no-unsafe-call.ts index 0535bfeab316..781908f9497b 100644 --- a/packages/eslint-plugin/src/rules/no-unsafe-call.ts +++ b/packages/eslint-plugin/src/rules/no-unsafe-call.ts @@ -1,7 +1,13 @@ import { TSESTree } from '@typescript-eslint/experimental-utils'; +import * as tsutils from 'tsutils'; import * as util from '../util'; +import { getThisExpression } from '../util'; -type MessageIds = 'unsafeCall' | 'unsafeNew' | 'unsafeTemplateTag'; +type MessageIds = + | 'unsafeCall' + | 'unsafeCallThis' + | 'unsafeNew' + | 'unsafeTemplateTag'; export default util.createRule<[], MessageIds>({ name: 'no-unsafe-call', @@ -9,12 +15,15 @@ export default util.createRule<[], MessageIds>({ type: 'problem', docs: { description: 'Disallows calling an any type value', - category: 'Possible Errors', recommended: 'error', requiresTypeChecking: true, }, messages: { - unsafeCall: 'Unsafe call of an any typed value.', + unsafeCall: 'Unsafe call of an `any` typed value.', + unsafeCallThis: [ + 'Unsafe call of an `any` typed value. `this` is typed as `any`.', + 'You can try to fix this by turning on the `noImplicitThis` compiler option, or adding a `this` parameter to the function.', + ].join('\n'), unsafeNew: 'Unsafe construction of an any type value.', unsafeTemplateTag: 'Unsafe any typed template tag.', }, @@ -24,6 +33,11 @@ export default util.createRule<[], MessageIds>({ create(context) { const { program, esTreeNodeToTSNodeMap } = util.getParserServices(context); const checker = program.getTypeChecker(); + const compilerOptions = program.getCompilerOptions(); + const isNoImplicitThis = tsutils.isStrictCompilerOptionEnabled( + compilerOptions, + 'noImplicitThis', + ); function checkCall( node: TSESTree.Node, @@ -34,6 +48,21 @@ export default util.createRule<[], MessageIds>({ const type = util.getConstrainedTypeAtLocation(checker, tsNode); if (util.isTypeAnyType(type)) { + if (!isNoImplicitThis) { + // `this()` or `this.foo()` or `this.foo[bar]()` + const thisExpression = getThisExpression(node); + if ( + thisExpression && + util.isTypeAnyType( + util.getConstrainedTypeAtLocation( + checker, + esTreeNodeToTSNodeMap.get(thisExpression), + ), + ) + ) { + messageId = 'unsafeCallThis'; + } + } context.report({ node: reportingNode, messageId: messageId, 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 b326c754136b..6e9555a5a3e4 100644 --- a/packages/eslint-plugin/src/rules/no-unsafe-member-access.ts +++ b/packages/eslint-plugin/src/rules/no-unsafe-member-access.ts @@ -2,7 +2,9 @@ import { TSESTree, AST_NODE_TYPES, } from '@typescript-eslint/experimental-utils'; +import * as tsutils from 'tsutils'; import * as util from '../util'; +import { getThisExpression } from '../util'; const enum State { Unsafe = 1, @@ -15,13 +17,16 @@ export default util.createRule({ type: 'problem', docs: { description: 'Disallows member access on any typed variables', - category: 'Possible Errors', recommended: 'error', requiresTypeChecking: true, }, messages: { unsafeMemberExpression: - 'Unsafe member access {{property}} on an any value.', + 'Unsafe member access {{property}} on an `any` value.', + unsafeThisMemberExpression: [ + 'Unsafe member access {{property}} on an `any` value. `this` is typed as `any`.', + 'You can try to fix this by turning on the `noImplicitThis` compiler option, or adding a `this` parameter to the function.', + ].join('\n'), unsafeComputedMemberAccess: 'Computed name {{property}} resolves to an any value.', }, @@ -31,6 +36,11 @@ export default util.createRule({ create(context) { const { program, esTreeNodeToTSNodeMap } = util.getParserServices(context); const checker = program.getTypeChecker(); + const compilerOptions = program.getCompilerOptions(); + const isNoImplicitThis = tsutils.isStrictCompilerOptionEnabled( + compilerOptions, + 'noImplicitThis', + ); const sourceCode = context.getSourceCode(); const stateCache = new Map(); @@ -58,9 +68,30 @@ export default util.createRule({ if (state === State.Unsafe) { const propertyName = sourceCode.getText(node.property); + + let messageId: 'unsafeMemberExpression' | 'unsafeThisMemberExpression' = + 'unsafeMemberExpression'; + + if (!isNoImplicitThis) { + // `this.foo` or `this.foo[bar]` + const thisExpression = getThisExpression(node); + + if ( + thisExpression && + util.isTypeAnyType( + util.getConstrainedTypeAtLocation( + checker, + esTreeNodeToTSNodeMap.get(thisExpression), + ), + ) + ) { + messageId = 'unsafeThisMemberExpression'; + } + } + context.report({ node, - messageId: 'unsafeMemberExpression', + messageId, data: { property: node.computed ? `[${propertyName}]` : `.${propertyName}`, }, @@ -72,7 +103,8 @@ export default util.createRule({ return { // ignore MemberExpression if it's parent is TSClassImplements or TSInterfaceHeritage - ':not(TSClassImplements, TSInterfaceHeritage) > MemberExpression': checkMemberExpression, + ':not(TSClassImplements, TSInterfaceHeritage) > MemberExpression': + checkMemberExpression, 'MemberExpression[computed = true] > *.property'( node: TSESTree.Expression, ): void { diff --git a/packages/eslint-plugin/src/rules/no-unsafe-return.ts b/packages/eslint-plugin/src/rules/no-unsafe-return.ts index c2366bc96f2e..e226d526bca0 100644 --- a/packages/eslint-plugin/src/rules/no-unsafe-return.ts +++ b/packages/eslint-plugin/src/rules/no-unsafe-return.ts @@ -2,8 +2,9 @@ import { TSESTree, AST_NODE_TYPES, } from '@typescript-eslint/experimental-utils'; -import { isExpression } from 'tsutils'; +import * as tsutils from 'tsutils'; import * as util from '../util'; +import { getThisExpression } from '../util'; export default util.createRule({ name: 'no-unsafe-return', @@ -11,14 +12,17 @@ export default util.createRule({ type: 'problem', docs: { description: 'Disallows returning any from a function', - category: 'Possible Errors', recommended: 'error', requiresTypeChecking: true, }, messages: { - unsafeReturn: 'Unsafe return of an {{type}} typed value', + unsafeReturn: 'Unsafe return of an `{{type}}` typed value.', + unsafeReturnThis: [ + 'Unsafe return of an `{{type}}` typed value. `this` is typed as `any`.', + 'You can try to fix this by turning on the `noImplicitThis` compiler option, or adding a `this` parameter to the function.', + ].join('\n'), unsafeReturnAssignment: - 'Unsafe return of type {{sender}} from function with return type {{receiver}}.', + 'Unsafe return of type `{{sender}}` from function with return type `{{receiver}}`.', }, schema: [], }, @@ -26,6 +30,11 @@ export default util.createRule({ create(context) { const { program, esTreeNodeToTSNodeMap } = util.getParserServices(context); const checker = program.getTypeChecker(); + const compilerOptions = program.getCompilerOptions(); + const isNoImplicitThis = tsutils.isStrictCompilerOptionEnabled( + compilerOptions, + 'noImplicitThis', + ); function getParentFunctionNode( node: TSESTree.Node, @@ -74,13 +83,23 @@ export default util.createRule({ // 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 = isExpression(functionTSNode) + let functionType = tsutils.isExpression(functionTSNode) ? util.getContextualType(checker, functionTSNode) : checker.getTypeAtLocation(functionTSNode); if (!functionType) { functionType = checker.getTypeAtLocation(functionTSNode); } + // If there is an explicit type annotation *and* that type matches the actual + // function return type, we shouldn't complain (it's intentional, even if unsafe) + if (functionTSNode.type) { + for (const signature of functionType.getCallSignatures()) { + if (returnNodeType === signature.getReturnType()) { + return; + } + } + } + if (anyType !== util.AnyType.Safe) { // Allow cases when the declared return type of the function is either unknown or unknown[] // and the function is returning any or any[]. @@ -100,10 +119,28 @@ export default util.createRule({ } } + let messageId: 'unsafeReturn' | 'unsafeReturnThis' = 'unsafeReturn'; + + if (!isNoImplicitThis) { + // `return this` + const thisExpression = getThisExpression(returnNode); + if ( + thisExpression && + util.isTypeAnyType( + util.getConstrainedTypeAtLocation( + checker, + esTreeNodeToTSNodeMap.get(thisExpression), + ), + ) + ) { + messageId = 'unsafeReturnThis'; + } + } + // If the function return type was not unknown/unknown[], mark usage as unsafeReturn. return context.report({ node: reportingNode, - messageId: 'unsafeReturn', + messageId, data: { type: anyType === util.AnyType.Any ? 'any' : 'any[]', }, @@ -112,17 +149,11 @@ export default util.createRule({ for (const signature of functionType.getCallSignatures()) { const functionReturnType = signature.getReturnType(); - if (returnNodeType === functionReturnType) { - // don't bother checking if they're the same - // either the function is explicitly declared to return the same type - // or there was no declaration, so the return type is implicit - return; - } - const result = util.isUnsafeAssignment( returnNodeType, functionReturnType, checker, + returnNode, ); if (!result) { return; diff --git a/packages/eslint-plugin/src/rules/no-unused-expressions.ts b/packages/eslint-plugin/src/rules/no-unused-expressions.ts index 8116cbf704e3..91d9f4e4a384 100644 --- a/packages/eslint-plugin/src/rules/no-unused-expressions.ts +++ b/packages/eslint-plugin/src/rules/no-unused-expressions.ts @@ -2,9 +2,11 @@ import { AST_NODE_TYPES, TSESTree, } from '@typescript-eslint/experimental-utils'; -import baseRule from 'eslint/lib/rules/no-unused-expressions'; +import { getESLintCoreRule } from '../util/getESLintCoreRule'; import * as util from '../util'; +const baseRule = getESLintCoreRule('no-unused-expressions'); + type MessageIds = util.InferMessageIdsTypeFromRule; type Options = util.InferOptionsTypeFromRule; @@ -14,11 +16,12 @@ export default util.createRule({ type: 'suggestion', docs: { description: 'Disallow unused expressions', - category: 'Best Practices', 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.', @@ -31,9 +34,8 @@ export default util.createRule({ allowTaggedTemplates: false, }, ], - create(context, options) { + create(context, [{ allowShortCircuit = false, allowTernary = false }]) { const rules = baseRule.create(context); - const { allowShortCircuit = false, allowTernary = false } = options[0]; function isValidExpression(node: TSESTree.Node): boolean { if (allowShortCircuit && node.type === AST_NODE_TYPES.LogicalExpression) { diff --git a/packages/eslint-plugin/src/rules/no-unused-vars-experimental.ts b/packages/eslint-plugin/src/rules/no-unused-vars-experimental.ts deleted file mode 100644 index 0aedd20cbb20..000000000000 --- a/packages/eslint-plugin/src/rules/no-unused-vars-experimental.ts +++ /dev/null @@ -1,366 +0,0 @@ -/* eslint-disable no-fallthrough */ - -import { TSESTree } from '@typescript-eslint/experimental-utils'; -import * as ts from 'typescript'; -import * as util from '../util'; - -export type Options = [ - { - ignoredNamesRegex?: string | boolean; - ignoreArgsIfArgsAfterAreUsed?: boolean; - }, -]; -export type MessageIds = - | 'unused' - | 'unusedWithIgnorePattern' - | 'unusedImport' - | 'unusedTypeParameters'; - -type NodeWithTypeParams = ts.Node & { - typeParameters: ts.NodeArray; -}; - -export const DEFAULT_IGNORED_REGEX_STRING = '^_'; -export default util.createRule({ - name: 'no-unused-vars-experimental', - meta: { - type: 'problem', - docs: { - description: 'Disallow unused variables and arguments', - category: 'Best Practices', - recommended: false, - }, - deprecated: true, - replacedBy: ['no-unused-vars'], - schema: [ - { - type: 'object', - properties: { - ignoredNamesRegex: { - oneOf: [ - { - type: 'string', - }, - { - type: 'boolean', - enum: [false], - }, - ], - }, - ignoreArgsIfArgsAfterAreUsed: { - type: 'boolean', - }, - }, - additionalProperties: false, - }, - ], - messages: { - unused: "{{type}} '{{name}}' is declared but its value is never read.", - unusedWithIgnorePattern: - "{{type}} '{{name}}' is declared but its value is never read. Allowed unused names must match {{pattern}}.", - unusedImport: 'All imports in import declaration are unused.', - unusedTypeParameters: 'All type parameters are unused.', - }, - }, - defaultOptions: [ - { - ignoredNamesRegex: DEFAULT_IGNORED_REGEX_STRING, - ignoreArgsIfArgsAfterAreUsed: false, - }, - ], - create(context, [userOptions]) { - const parserServices = util.getParserServices(context, true); - const tsProgram = parserServices.program; - const afterAllDiagnosticsCallbacks: (() => void)[] = []; - - const options = { - ignoredNames: - userOptions && typeof userOptions.ignoredNamesRegex === 'string' - ? new RegExp(userOptions.ignoredNamesRegex) - : null, - ignoreArgsIfArgsAfterAreUsed: - userOptions.ignoreArgsIfArgsAfterAreUsed ?? false, - }; - - function handleIdentifier(identifier: ts.Identifier): void { - function report(type: string): void { - const node = parserServices.tsNodeToESTreeNodeMap.get(identifier); - const regex = options.ignoredNames; - const name = identifier.getText(); - if (regex) { - if (!regex.test(name)) { - context.report({ - node, - messageId: 'unusedWithIgnorePattern', - data: { - name, - type, - pattern: regex.toString(), - }, - }); - } - } else { - context.report({ - node, - messageId: 'unused', - data: { - name, - type, - }, - }); - } - } - - const parent = identifier.parent; - - // is a single variable diagnostic - switch (parent.kind) { - case ts.SyntaxKind.BindingElement: - case ts.SyntaxKind.ObjectBindingPattern: - report('Destructured Variable'); - break; - - case ts.SyntaxKind.ClassDeclaration: - report('Class'); - break; - - case ts.SyntaxKind.EnumDeclaration: - report('Enum'); - break; - - case ts.SyntaxKind.FunctionDeclaration: - report('Function'); - break; - - // this won't happen because there are specific nodes that wrap up named/default import identifiers - // case ts.SyntaxKind.ImportDeclaration: - // import equals is always treated as a variable - case ts.SyntaxKind.ImportEqualsDeclaration: - // the default import is NOT used, but a named import is used - case ts.SyntaxKind.ImportClause: - // a named import is NOT used, but either another named import, or the default import is used - case ts.SyntaxKind.ImportSpecifier: - // a namespace import is NOT used, but the default import is used - case ts.SyntaxKind.NamespaceImport: - report('Import'); - break; - - case ts.SyntaxKind.InterfaceDeclaration: - report('Interface'); - break; - - case ts.SyntaxKind.MethodDeclaration: - report('Method'); - break; - - case ts.SyntaxKind.Parameter: - handleParameterDeclaration( - identifier, - parent as ts.ParameterDeclaration, - ); - break; - - case ts.SyntaxKind.PropertyDeclaration: - // eslint-disable-next-line @typescript-eslint/internal/prefer-ast-types-enum - report('Property'); - break; - - case ts.SyntaxKind.TypeAliasDeclaration: - report('Type'); - break; - - case ts.SyntaxKind.TypeParameter: - handleTypeParam(identifier); - break; - - case ts.SyntaxKind.VariableDeclaration: - report('Variable'); - break; - - default: - throw new Error(`Unknown node with kind ${parent.kind}.`); - // TODO - should we just handle this gracefully? - // report('Unknown Node'); - // break; - } - } - - const unusedParameters = new Set(); - function handleParameterDeclaration( - identifier: ts.Identifier, - parent: ts.ParameterDeclaration, - ): void { - const name = identifier.getText(); - // regardless of if the parameter is ignored, track that it had a diagnostic fired on it - unusedParameters.add(identifier); - - /* - NOTE - Typescript will automatically ignore parameters that have a - leading underscore in their name. We cannot do anything about this. - */ - - function report(): void { - const node = parserServices.tsNodeToESTreeNodeMap.get(identifier); - context.report({ - node, - messageId: 'unused', - data: { - name, - type: 'Parameter', - }, - }); - } - - const isLastParameter = - parent.parent.parameters.indexOf(parent) === - parent.parent.parameters.length - 1; - if (!isLastParameter && options.ignoreArgsIfArgsAfterAreUsed) { - // once all diagnostics are processed, we can check if the following args are unused - afterAllDiagnosticsCallbacks.push(() => { - for (const param of parent.parent.parameters) { - if (!unusedParameters.has(param.name)) { - return; - } - } - - // none of the following params were unused, so report - report(); - }); - } else { - report(); - } - } - - function handleImportDeclaration(parent: ts.ImportDeclaration): void { - // the entire import statement is unused - - /* - NOTE - Typescript will automatically ignore imports that have a - leading underscore in their name. We cannot do anything about this. - */ - - context.report({ - messageId: 'unusedImport', - node: parserServices.tsNodeToESTreeNodeMap.get(parent), - }); - } - - function handleDestructure(parent: ts.BindingPattern): void { - // the entire destructure is unused - // note that this case only ever triggers for simple, single-level destructured objects - // i.e. these will not trigger it: - // - const {a:_a, b, c: {d}} = z; - // - const [a, b] = c; - - parent.elements.forEach(element => { - if (element.kind === ts.SyntaxKind.BindingElement) { - const name = element.name; - if (name.kind === ts.SyntaxKind.Identifier) { - handleIdentifier(name); - } - } - }); - } - - function handleTypeParamList(node: NodeWithTypeParams): void { - // the entire generic decl list is unused - - /* - NOTE - Typescript will automatically ignore generics that have a - leading underscore in their name. We cannot do anything about this. - */ - - const parent = parserServices.tsNodeToESTreeNodeMap.get( - node as never, - ) as { - typeParameters: TSESTree.TSTypeParameterDeclaration; - }; - context.report({ - messageId: 'unusedTypeParameters', - node: parent.typeParameters, - }); - } - function handleTypeParam(identifier: ts.Identifier): void { - context.report({ - node: parserServices.tsNodeToESTreeNodeMap.get(identifier), - messageId: 'unused', - data: { - name: identifier.getText(), - type: 'Type Parameter', - }, - }); - } - - return { - 'Program:exit'(program: TSESTree.Program): void { - const tsNode = parserServices.esTreeNodeToTSNodeMap.get(program); - const sourceFile = util.getSourceFileOfNode(tsNode); - const diagnostics = tsProgram.getSemanticDiagnostics(sourceFile); - - diagnostics.forEach(diag => { - if (isUnusedDiagnostic(diag.code)) { - if (diag.start !== undefined) { - const node = util.getTokenAtPosition(sourceFile, diag.start); - const parent = node.parent; - if (isIdentifier(node)) { - handleIdentifier(node); - } else if (isImport(parent)) { - handleImportDeclaration(parent); - } else if (isDestructure(parent)) { - handleDestructure(parent); - } else if (isGeneric(node, parent)) { - handleTypeParamList(parent); - } - } - } - }); - - // trigger all the checks to be done after all the diagnostics have been evaluated - afterAllDiagnosticsCallbacks.forEach(cb => cb()); - }, - }; - }, -}); - -/** - * Checks if the diagnostic code is one of the expected "unused var" codes - */ -function isUnusedDiagnostic(code: number): boolean { - return [ - 6133, // '{0}' is declared but never used. - 6138, // Property '{0}' is declared but its value is never read. - 6192, // All imports in import declaration are unused. - 6196, // '{0}' is declared but its value is never read. - 6198, // All destructured elements are unused. - 6199, // All variables are unused. - 6205, // All type parameters are unused. - ].includes(code); -} - -/** - * Checks if the given node is a destructuring pattern - */ -function isDestructure(node: ts.Node): node is ts.BindingPattern { - return ( - node.kind === ts.SyntaxKind.ObjectBindingPattern || - node.kind === ts.SyntaxKind.ArrayBindingPattern - ); -} - -function isImport(node: ts.Node): node is ts.ImportDeclaration { - return node.kind === ts.SyntaxKind.ImportDeclaration; -} - -function isIdentifier(node: ts.Node): node is ts.Identifier { - return node.kind === ts.SyntaxKind.Identifier; -} - -function isGeneric( - node: ts.Node, - parent: ts.Node & Partial, -): parent is NodeWithTypeParams { - return ( - node.kind === ts.SyntaxKind.LessThanToken && - parent.typeParameters !== undefined - ); -} diff --git a/packages/eslint-plugin/src/rules/no-unused-vars.ts b/packages/eslint-plugin/src/rules/no-unused-vars.ts index 2e6633afc57f..7cce473557c4 100644 --- a/packages/eslint-plugin/src/rules/no-unused-vars.ts +++ b/packages/eslint-plugin/src/rules/no-unused-vars.ts @@ -37,7 +37,6 @@ export default util.createRule({ type: 'problem', docs: { description: 'Disallow unused variables', - category: 'Variables', recommended: 'warn', extendsBaseRule: true, }, @@ -95,7 +94,7 @@ export default util.createRule({ caughtErrors: 'none', }; - const firstOption = context.options[0]; + const [firstOption] = context.options; if (firstOption) { if (typeof firstOption === '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 2b0bb32ccb57..83cf552fda52 100644 --- a/packages/eslint-plugin/src/rules/no-use-before-define.ts +++ b/packages/eslint-plugin/src/rules/no-use-before-define.ts @@ -3,9 +3,11 @@ import { TSESLint, TSESTree, } from '@typescript-eslint/experimental-utils'; +import { DefinitionType } from '@typescript-eslint/scope-manager'; import * as util from '../util'; -const SENTINEL_TYPE = /^(?:(?:Function|Class)(?:Declaration|Expression)|ArrowFunctionExpression|CatchClause|ImportDeclaration|ExportNamedDeclaration)$/; +const SENTINEL_TYPE = + /^(?:(?:Function|Class)(?:Declaration|Expression)|ArrowFunctionExpression|CatchClause|ImportDeclaration|ExportNamedDeclaration)$/; /** * Parses a given value as options. @@ -43,14 +45,14 @@ function parseOptions(options: string | Config | null): Required { * Checks whether or not a given variable is a function declaration. */ function isFunction(variable: TSESLint.Scope.Variable): boolean { - return variable.defs[0].type === 'FunctionName'; + return variable.defs[0].type === DefinitionType.FunctionName; } /** * Checks whether or not a given variable is a type declaration. */ function isTypedef(variable: TSESLint.Scope.Variable): boolean { - return variable.defs[0].type === 'Type'; + return variable.defs[0].type === DefinitionType.Type; } /** @@ -61,7 +63,7 @@ function isOuterEnum( reference: TSESLint.Scope.Reference, ): boolean { return ( - variable.defs[0].type == 'TSEnumName' && + variable.defs[0].type == DefinitionType.TSEnumName && variable.scope.variableScope !== reference.from.variableScope ); } @@ -74,7 +76,7 @@ function isOuterClass( reference: TSESLint.Scope.Reference, ): boolean { return ( - variable.defs[0].type === 'ClassName' && + variable.defs[0].type === DefinitionType.ClassName && variable.scope.variableScope !== reference.from.variableScope ); } @@ -87,7 +89,7 @@ function isOuterVariable( reference: TSESLint.Scope.Reference, ): boolean { return ( - variable.defs[0].type === 'Variable' && + variable.defs[0].type === DefinitionType.Variable && variable.scope.variableScope !== reference.from.variableScope ); } @@ -141,7 +143,7 @@ function isClassRefInClassDecorator( variable: TSESLint.Scope.Variable, reference: TSESLint.Scope.Reference, ): boolean { - if (variable.defs[0].type !== 'ClassName') { + if (variable.defs[0].type !== DefinitionType.ClassName) { return false; } @@ -230,7 +232,6 @@ export default util.createRule({ type: 'problem', docs: { description: 'Disallow the use of variables before they are defined', - category: 'Variables', recommended: false, extendsBaseRule: true, }, diff --git a/packages/eslint-plugin/src/rules/no-useless-constructor.ts b/packages/eslint-plugin/src/rules/no-useless-constructor.ts index 2ad9c765c4e7..f656af264818 100644 --- a/packages/eslint-plugin/src/rules/no-useless-constructor.ts +++ b/packages/eslint-plugin/src/rules/no-useless-constructor.ts @@ -2,9 +2,11 @@ import { TSESTree, AST_NODE_TYPES, } from '@typescript-eslint/experimental-utils'; -import baseRule from 'eslint/lib/rules/no-useless-constructor'; +import { getESLintCoreRule } from '../util/getESLintCoreRule'; import * as util from '../util'; +const baseRule = getESLintCoreRule('no-useless-constructor'); + type Options = util.InferOptionsTypeFromRule; type MessageIds = util.InferMessageIdsTypeFromRule; @@ -49,11 +51,12 @@ export default util.createRule({ type: 'problem', docs: { description: 'Disallow unnecessary constructors', - category: 'Best Practices', 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 ?? { noUselessConstructor: 'Useless constructor.', }, diff --git a/packages/eslint-plugin/src/rules/no-var-requires.ts b/packages/eslint-plugin/src/rules/no-var-requires.ts index 26c49cc9dd2f..b599d4cb87a6 100644 --- a/packages/eslint-plugin/src/rules/no-var-requires.ts +++ b/packages/eslint-plugin/src/rules/no-var-requires.ts @@ -14,7 +14,6 @@ export default util.createRule({ docs: { description: 'Disallows the use of require statements except in import statements', - category: 'Best Practices', recommended: 'error', }, messages: { @@ -25,20 +24,24 @@ export default util.createRule({ defaultOptions: [], create(context) { return { - CallExpression(node: TSESTree.CallExpression): void { + 'CallExpression[callee.name="require"]'( + node: TSESTree.CallExpression, + ): void { const parent = node.parent?.type === AST_NODE_TYPES.ChainExpression ? node.parent.parent : node.parent; + if ( - node.callee.type === AST_NODE_TYPES.Identifier && - node.callee.name === 'require' && parent && - (parent.type === AST_NODE_TYPES.VariableDeclarator || - parent.type === AST_NODE_TYPES.CallExpression || - parent.type === AST_NODE_TYPES.TSAsExpression || - parent.type === AST_NODE_TYPES.TSTypeAssertion || - parent.type === AST_NODE_TYPES.MemberExpression) + [ + AST_NODE_TYPES.CallExpression, + AST_NODE_TYPES.MemberExpression, + AST_NODE_TYPES.NewExpression, + AST_NODE_TYPES.TSAsExpression, + AST_NODE_TYPES.TSTypeAssertion, + AST_NODE_TYPES.VariableDeclarator, + ].includes(parent.type) ) { context.report({ node, 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 eef8c58445f2..1577c3b94489 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 @@ -11,7 +11,6 @@ export default util.createRule({ name: 'non-nullable-type-assertion-style', meta: { docs: { - category: 'Best Practices', description: 'Prefers a non-null assertion over explicit type cast when possible', recommended: false, @@ -57,6 +56,10 @@ export default util.createRule({ type.flags !== ts.TypeFlags.Undefined, ); + if (nonNullishOriginalTypes.length === originalTypes.length) { + return false; + } + for (const assertedType of assertedTypes) { if (!nonNullishOriginalTypes.includes(assertedType)) { return false; diff --git a/packages/eslint-plugin/src/rules/object-curly-spacing.ts b/packages/eslint-plugin/src/rules/object-curly-spacing.ts index 581e7ac15557..fe74c8f7da40 100644 --- a/packages/eslint-plugin/src/rules/object-curly-spacing.ts +++ b/packages/eslint-plugin/src/rules/object-curly-spacing.ts @@ -3,7 +3,7 @@ import { AST_TOKEN_TYPES, TSESTree, } from '@typescript-eslint/experimental-utils'; -import baseRule from 'eslint/lib/rules/object-curly-spacing'; +import { getESLintCoreRule } from '../util/getESLintCoreRule'; import { createRule, InferMessageIdsTypeFromRule, @@ -13,6 +13,8 @@ import { isTokenOnSameLine, } from '../util'; +const baseRule = getESLintCoreRule('object-curly-spacing'); + export type Options = InferOptionsTypeFromRule; export type MessageIds = InferMessageIdsTypeFromRule; @@ -22,14 +24,14 @@ export default createRule({ ...baseRule.meta, docs: { description: 'Enforce consistent spacing inside braces', - category: 'Stylistic Issues', recommended: false, extendsBaseRule: true, }, }, defaultOptions: ['never'], create(context) { - const spaced = context.options[0] === 'always'; + const [firstOption, secondOption] = context.options; + const spaced = firstOption === 'always'; const sourceCode = context.getSourceCode(); /** @@ -42,9 +44,7 @@ export default createRule({ function isOptionSet( option: 'arraysInObjects' | 'objectsInObjects', ): boolean { - return context.options[1] - ? context.options[1][option] === !spaced - : false; + return secondOption ? secondOption[option] === !spaced : false; } const options = { @@ -63,7 +63,7 @@ export default createRule({ * @param token The token to use for the report. */ function reportNoBeginningSpace( - node: TSESTree.TSTypeLiteral, + node: TSESTree.TSMappedType | TSESTree.TSTypeLiteral, token: TSESTree.Token, ): void { const nextToken = context @@ -89,7 +89,7 @@ export default createRule({ * @param token The token to use for the report. */ function reportNoEndingSpace( - node: TSESTree.TSTypeLiteral, + node: TSESTree.TSMappedType | TSESTree.TSTypeLiteral, token: TSESTree.Token, ): void { const previousToken = context @@ -115,7 +115,7 @@ export default createRule({ * @param token The token to use for the report. */ function reportRequiredBeginningSpace( - node: TSESTree.TSTypeLiteral, + node: TSESTree.TSMappedType | TSESTree.TSTypeLiteral, token: TSESTree.Token, ): void { context.report({ @@ -137,7 +137,7 @@ export default createRule({ * @param token The token to use for the report. */ function reportRequiredEndingSpace( - node: TSESTree.TSTypeLiteral, + node: TSESTree.TSMappedType | TSESTree.TSTypeLiteral, token: TSESTree.Token, ): void { context.report({ @@ -162,20 +162,24 @@ export default createRule({ * @param last The last token to check (should be closing brace) */ function validateBraceSpacing( - node: TSESTree.TSTypeLiteral, + node: TSESTree.TSMappedType | TSESTree.TSTypeLiteral, first: TSESTree.Token, - second: TSESTree.Token | TSESTree.Comment, - penultimate: TSESTree.Token | TSESTree.Comment, + second: TSESTree.Token, + penultimate: TSESTree.Token, last: TSESTree.Token, ): void { if (isTokenOnSameLine(first, second)) { const firstSpaced = sourceCode.isSpaceBetween!(first, second); - const secondType = sourceCode.getNodeByRangeIndex(second.range[0])! - .type; + const secondType = sourceCode.getNodeByRangeIndex( + second.range[0], + )!.type; const openingCurlyBraceMustBeSpaced = options.arraysInObjectsException && - secondType === AST_NODE_TYPES.TSIndexSignature + [ + AST_NODE_TYPES.TSMappedType, + AST_NODE_TYPES.TSIndexSignature, + ].includes(secondType) ? !options.spaced : options.spaced; @@ -197,15 +201,19 @@ export default createRule({ isClosingBracketToken(penultimate)) || (options.objectsInObjectsException && isClosingBraceToken(penultimate)); - const penultimateType = - shouldCheckPenultimate && - sourceCode.getNodeByRangeIndex(penultimate.range[0])!.type; + const penultimateType = shouldCheckPenultimate + ? sourceCode.getNodeByRangeIndex(penultimate.range[0])!.type + : undefined; const closingCurlyBraceMustBeSpaced = (options.arraysInObjectsException && penultimateType === AST_NODE_TYPES.TSTupleType) || (options.objectsInObjectsException && - penultimateType === AST_NODE_TYPES.TSTypeLiteral) + penultimateType !== undefined && + [ + AST_NODE_TYPES.TSMappedType, + AST_NODE_TYPES.TSTypeLiteral, + ].includes(penultimateType)) ? !options.spaced : options.spaced; @@ -246,6 +254,18 @@ export default createRule({ const rules = baseRule.create(context); return { ...rules, + TSMappedType(node: TSESTree.TSMappedType): void { + const first = sourceCode.getFirstToken(node)!; + const last = sourceCode.getLastToken(node)!; + const second = sourceCode.getTokenAfter(first, { + includeComments: true, + })!; + const penultimate = sourceCode.getTokenBefore(last, { + includeComments: true, + })!; + + validateBraceSpacing(node, first, second, penultimate, last); + }, TSTypeLiteral(node: TSESTree.TSTypeLiteral): void { if (node.members.length === 0) { return; diff --git a/packages/eslint-plugin/src/rules/padding-line-between-statements.ts b/packages/eslint-plugin/src/rules/padding-line-between-statements.ts new file mode 100644 index 000000000000..334b6928c630 --- /dev/null +++ b/packages/eslint-plugin/src/rules/padding-line-between-statements.ts @@ -0,0 +1,778 @@ +import { + AST_NODE_TYPES, + TSESLint, + TSESTree, +} from '@typescript-eslint/experimental-utils'; +import * as util from '../util'; + +/** + * This rule is a replica of padding-line-between-statements. + * + * Ideally we would want to extend the rule support typescript specific support. + * But since not all the state is exposed by the eslint and eslint has frozen stylistic rules, + * (see - https://eslint.org/blog/2020/05/changes-to-rules-policies for details.) + * we are forced to re-implement the rule here. + * + * We have tried to keep the implementation as close as possible to the eslint implementation, to make + * patching easier for future contributors. + * + * Reference rule - https://github.com/eslint/eslint/blob/master/lib/rules/padding-line-between-statements.js + */ + +type NodeTest = ( + node: TSESTree.Node, + sourceCode: TSESLint.SourceCode, +) => boolean; + +interface NodeTestObject { + test: NodeTest; +} + +interface PaddingOption { + blankLine: keyof typeof PaddingTypes; + prev: string | string[]; + next: string | string[]; +} + +type MessageIds = 'expectedBlankLine' | 'unexpectedBlankLine'; +type Options = PaddingOption[]; + +const LT = `[${Array.from( + new Set(['\r\n', '\r', '\n', '\u2028', '\u2029']), +).join('')}]`; +const PADDING_LINE_SEQUENCE = new RegExp( + String.raw`^(\s*?${LT})\s*${LT}(\s*;?)$`, + 'u', +); + +/** + * Creates tester which check if a node starts with specific keyword. + * @param keyword The keyword to test. + * @returns the created tester. + * @private + */ +function newKeywordTester(keyword: string): NodeTestObject { + return { + test(node, sourceCode): boolean { + return sourceCode.getFirstToken(node)?.value === keyword; + }, + }; +} + +/** + * Creates tester which check if a node starts with specific keyword and spans a single line. + * @param keyword The keyword to test. + * @returns the created tester. + * @private + */ +function newSinglelineKeywordTester(keyword: string): NodeTestObject { + return { + test(node, sourceCode): boolean { + return ( + node.loc.start.line === node.loc.end.line && + sourceCode.getFirstToken(node)!.value === keyword + ); + }, + }; +} + +/** + * Creates tester which check if a node starts with specific keyword and spans multiple lines. + * @param keyword The keyword to test. + * @returns the created tester. + * @private + */ +function newMultilineKeywordTester(keyword: string): NodeTestObject { + return { + test(node, sourceCode): boolean { + return ( + node.loc.start.line !== node.loc.end.line && + sourceCode.getFirstToken(node)!.value === keyword + ); + }, + }; +} + +/** + * Creates tester which check if a node is specific type. + * @param type The node type to test. + * @returns the created tester. + * @private + */ +function newNodeTypeTester(type: AST_NODE_TYPES): NodeTestObject { + return { + test: (node): boolean => node.type === type, + }; +} + +/** + * Skips a chain expression node + * @param node The node to test + * @returnsA non-chain expression + * @private + */ +function skipChainExpression(node: TSESTree.Node): TSESTree.Node { + return node && node.type === AST_NODE_TYPES.ChainExpression + ? node.expression + : node; +} + +/** + * Checks the given node is an expression statement of IIFE. + * @param node The node to check. + * @returns `true` if the node is an expression statement of IIFE. + * @private + */ +function isIIFEStatement(node: TSESTree.Node): boolean { + if (node.type === AST_NODE_TYPES.ExpressionStatement) { + let expression = skipChainExpression(node.expression); + if (expression.type === AST_NODE_TYPES.UnaryExpression) { + expression = skipChainExpression(expression.argument); + } + if (expression.type === AST_NODE_TYPES.CallExpression) { + let node: TSESTree.Node = expression.callee; + while (node.type === AST_NODE_TYPES.SequenceExpression) { + node = node.expressions[node.expressions.length - 1]; + } + return util.isFunction(node); + } + } + return false; +} + +/** + * Checks the given node is a CommonJS require statement + * @param node The node to check. + * @returns `true` if the node is a CommonJS require statement. + * @private + */ +function isCJSRequire(node: TSESTree.Node): boolean { + if (node.type === AST_NODE_TYPES.VariableDeclaration) { + const declaration = node.declarations[0]; + if (declaration?.init) { + let call = declaration?.init; + while (call.type === AST_NODE_TYPES.MemberExpression) { + call = call.object; + } + if ( + call.type === AST_NODE_TYPES.CallExpression && + call.callee.type === AST_NODE_TYPES.Identifier + ) { + return call.callee.name === 'require'; + } + } + } + return false; +} + +/** + * Checks whether the given node is a block-like statement. + * This checks the last token of the node is the closing brace of a block. + * @param sourceCode The source code to get tokens. + * @param node The node to check. + * @returns `true` if the node is a block-like statement. + * @private + */ +function isBlockLikeStatement( + node: TSESTree.Node, + sourceCode: TSESLint.SourceCode, +): boolean { + // do-while with a block is a block-like statement. + if ( + node.type === AST_NODE_TYPES.DoWhileStatement && + node.body.type === AST_NODE_TYPES.BlockStatement + ) { + return true; + } + + /** + * IIFE is a block-like statement specially from + * JSCS#disallowPaddingNewLinesAfterBlocks. + */ + if (isIIFEStatement(node)) { + return true; + } + + // Checks the last token is a closing brace of blocks. + const lastToken = sourceCode.getLastToken(node, util.isNotSemicolonToken); + const belongingNode = + lastToken && util.isClosingBraceToken(lastToken) + ? sourceCode.getNodeByRangeIndex(lastToken.range[0]) + : null; + + return ( + !!belongingNode && + (belongingNode.type === AST_NODE_TYPES.BlockStatement || + belongingNode.type === AST_NODE_TYPES.SwitchStatement) + ); +} + +/** + * Check whether the given node is a directive or not. + * @param node The node to check. + * @param sourceCode The source code object to get tokens. + * @returns `true` if the node is a directive. + */ +function isDirective( + node: TSESTree.Node, + sourceCode: TSESLint.SourceCode, +): boolean { + return ( + node.type === AST_NODE_TYPES.ExpressionStatement && + (node.parent?.type === AST_NODE_TYPES.Program || + (node.parent?.type === AST_NODE_TYPES.BlockStatement && + util.isFunction(node.parent.parent))) && + node.expression.type === AST_NODE_TYPES.Literal && + typeof node.expression.value === 'string' && + !util.isParenthesized(node.expression, sourceCode) + ); +} + +/** + * Check whether the given node is a part of directive prologue or not. + * @param node The node to check. + * @param sourceCode The source code object to get tokens. + * @returns `true` if the node is a part of directive prologue. + */ +function isDirectivePrologue( + node: TSESTree.Node, + sourceCode: TSESLint.SourceCode, +): boolean { + if ( + isDirective(node, sourceCode) && + node.parent && + 'body' in node.parent && + Array.isArray(node.parent.body) + ) { + for (const sibling of node.parent.body) { + if (sibling === node) { + break; + } + if (!isDirective(sibling, sourceCode)) { + return false; + } + } + return true; + } + return false; +} + +/** + * Checks the given node is a CommonJS export statement + * @param node The node to check. + * @returns `true` if the node is a CommonJS export statement. + * @private + */ +function isCJSExport(node: TSESTree.Node): boolean { + if (node.type === AST_NODE_TYPES.ExpressionStatement) { + const expression = node.expression; + if (expression.type === AST_NODE_TYPES.AssignmentExpression) { + let left = expression.left; + if (left.type === AST_NODE_TYPES.MemberExpression) { + while (left.object.type === AST_NODE_TYPES.MemberExpression) { + left = left.object; + } + return ( + left.object.type === AST_NODE_TYPES.Identifier && + (left.object.name === 'exports' || + (left.object.name === 'module' && + left.property.type === AST_NODE_TYPES.Identifier && + left.property.name === 'exports')) + ); + } + } + } + return false; +} + +/** + * Check whether the given node is an expression + * @param node The node to check. + * @param sourceCode The source code object to get tokens. + * @returns `true` if the node is an expression + */ +function isExpression( + node: TSESTree.Node, + sourceCode: TSESLint.SourceCode, +): boolean { + return ( + node.type === AST_NODE_TYPES.ExpressionStatement && + !isDirectivePrologue(node, sourceCode) + ); +} + +/** + * Gets the actual last token. + * + * If a semicolon is semicolon-less style's semicolon, this ignores it. + * For example: + * + * foo() + * ;[1, 2, 3].forEach(bar) + * @param sourceCode The source code to get tokens. + * @param node The node to get. + * @returns The actual last token. + * @private + */ +function getActualLastToken( + node: TSESTree.Node, + sourceCode: TSESLint.SourceCode, +): TSESTree.Token | null { + const semiToken = sourceCode.getLastToken(node)!; + const prevToken = sourceCode.getTokenBefore(semiToken); + const nextToken = sourceCode.getTokenAfter(semiToken); + const isSemicolonLessStyle = + prevToken && + nextToken && + prevToken.range[0] >= node.range[0] && + util.isSemicolonToken(semiToken) && + semiToken.loc.start.line !== prevToken.loc.end.line && + semiToken.loc.end.line === nextToken.loc.start.line; + + return isSemicolonLessStyle ? prevToken : semiToken; +} + +/** + * This returns the concatenation of the first 2 captured strings. + * @param _ Unused. Whole matched string. + * @param trailingSpaces The trailing spaces of the first line. + * @param indentSpaces The indentation spaces of the last line. + * @returns The concatenation of trailingSpaces and indentSpaces. + * @private + */ +function replacerToRemovePaddingLines( + _: string, + trailingSpaces: string, + indentSpaces: string, +): string { + return trailingSpaces + indentSpaces; +} + +/** + * Check and report statements for `any` configuration. + * It does nothing. + * + * @private + */ +function verifyForAny(): void { + // Empty +} + +/** + * Check and report statements for `never` configuration. + * This autofix removes blank lines between the given 2 statements. + * However, if comments exist between 2 blank lines, it does not remove those + * blank lines automatically. + * @param context The rule context to report. + * @param _ Unused. The previous node to check. + * @param nextNode The next node to check. + * @param paddingLines The array of token pairs that blank + * lines exist between the pair. + * + * @private + */ +function verifyForNever( + context: TSESLint.RuleContext, + _: TSESTree.Node, + nextNode: TSESTree.Node, + paddingLines: [TSESTree.Token, TSESTree.Token][], +): void { + if (paddingLines.length === 0) { + return; + } + + context.report({ + node: nextNode, + messageId: 'unexpectedBlankLine', + fix(fixer) { + if (paddingLines.length >= 2) { + return null; + } + + const prevToken = paddingLines[0][0]; + const nextToken = paddingLines[0][1]; + const start = prevToken.range[1]; + const end = nextToken.range[0]; + const text = context + .getSourceCode() + .text.slice(start, end) + .replace(PADDING_LINE_SEQUENCE, replacerToRemovePaddingLines); + + return fixer.replaceTextRange([start, end], text); + }, + }); +} + +/** + * Check and report statements for `always` configuration. + * This autofix inserts a blank line between the given 2 statements. + * If the `prevNode` has trailing comments, it inserts a blank line after the + * trailing comments. + * @param context The rule context to report. + * @param prevNode The previous node to check. + * @param nextNode The next node to check. + * @param paddingLines The array of token pairs that blank + * lines exist between the pair. + * + * @private + */ +function verifyForAlways( + context: TSESLint.RuleContext, + prevNode: TSESTree.Node, + nextNode: TSESTree.Node, + paddingLines: [TSESTree.Token, TSESTree.Token][], +): void { + if (paddingLines.length > 0) { + return; + } + + context.report({ + node: nextNode, + messageId: 'expectedBlankLine', + fix(fixer) { + const sourceCode = context.getSourceCode(); + let prevToken = getActualLastToken( + prevNode, + sourceCode, + ) as TSESTree.Token; + const nextToken = + (sourceCode.getFirstTokenBetween(prevToken, nextNode, { + includeComments: true, + + /** + * Skip the trailing comments of the previous node. + * This inserts a blank line after the last trailing comment. + * + * For example: + * + * foo(); // trailing comment. + * // comment. + * bar(); + * + * Get fixed to: + * + * foo(); // trailing comment. + * + * // comment. + * bar(); + * @param token The token to check. + * @returns `true` if the token is not a trailing comment. + * @private + */ + filter(token) { + if (util.isTokenOnSameLine(prevToken, token)) { + prevToken = token; + return false; + } + return true; + }, + }) as TSESTree.Token) || nextNode; + const insertText = util.isTokenOnSameLine(prevToken, nextToken) + ? '\n\n' + : '\n'; + + return fixer.insertTextAfter(prevToken, insertText); + }, + }); +} + +/** + * Types of blank lines. + * `any`, `never`, and `always` are defined. + * Those have `verify` method to check and report statements. + * @private + */ +const PaddingTypes = { + any: { verify: verifyForAny }, + never: { verify: verifyForNever }, + always: { verify: verifyForAlways }, +}; + +/** + * Types of statements. + * Those have `test` method to check it matches to the given statement. + * @private + */ +const StatementTypes: Record = { + '*': { test: (): boolean => true }, + 'block-like': { test: isBlockLikeStatement }, + exports: { test: isCJSExport }, + require: { test: isCJSRequire }, + directive: { test: isDirectivePrologue }, + expression: { test: isExpression }, + iife: { test: isIIFEStatement }, + + 'multiline-block-like': { + test: (node, sourceCode) => + node.loc.start.line !== node.loc.end.line && + isBlockLikeStatement(node, sourceCode), + }, + 'multiline-expression': { + test: (node, sourceCode) => + node.loc.start.line !== node.loc.end.line && + node.type === AST_NODE_TYPES.ExpressionStatement && + !isDirectivePrologue(node, sourceCode), + }, + + 'multiline-const': newMultilineKeywordTester('const'), + 'multiline-let': newMultilineKeywordTester('let'), + 'multiline-var': newMultilineKeywordTester('var'), + 'singleline-const': newSinglelineKeywordTester('const'), + 'singleline-let': newSinglelineKeywordTester('let'), + 'singleline-var': newSinglelineKeywordTester('var'), + + block: newNodeTypeTester(AST_NODE_TYPES.BlockStatement), + empty: newNodeTypeTester(AST_NODE_TYPES.EmptyStatement), + function: newNodeTypeTester(AST_NODE_TYPES.FunctionDeclaration), + + break: newKeywordTester('break'), + case: newKeywordTester('case'), + class: newKeywordTester('class'), + const: newKeywordTester('const'), + continue: newKeywordTester('continue'), + debugger: newKeywordTester('debugger'), + default: newKeywordTester('default'), + do: newKeywordTester('do'), + export: newKeywordTester('export'), + for: newKeywordTester('for'), + if: newKeywordTester('if'), + import: newKeywordTester('import'), + let: newKeywordTester('let'), + return: newKeywordTester('return'), + switch: newKeywordTester('switch'), + throw: newKeywordTester('throw'), + try: newKeywordTester('try'), + var: newKeywordTester('var'), + while: newKeywordTester('while'), + with: newKeywordTester('with'), + + // Additional Typescript constructs + interface: newKeywordTester('interface'), + type: newKeywordTester('type'), +}; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +export default util.createRule({ + name: 'padding-line-between-statements', + meta: { + type: 'layout', + docs: { + description: 'require or disallow padding lines between statements', + recommended: false, + extendsBaseRule: true, + }, + fixable: 'whitespace', + hasSuggestions: true, + schema: { + definitions: { + paddingType: { + enum: Object.keys(PaddingTypes), + }, + statementType: { + anyOf: [ + { enum: Object.keys(StatementTypes) }, + { + type: 'array', + items: { enum: Object.keys(StatementTypes) }, + minItems: 1, + uniqueItems: true, + additionalItems: false, + }, + ], + }, + }, + type: 'array', + items: { + type: 'object', + properties: { + blankLine: { $ref: '#/definitions/paddingType' }, + prev: { $ref: '#/definitions/statementType' }, + next: { $ref: '#/definitions/statementType' }, + }, + additionalProperties: false, + required: ['blankLine', 'prev', 'next'], + }, + additionalItems: false, + }, + messages: { + unexpectedBlankLine: 'Unexpected blank line before this statement.', + expectedBlankLine: 'Expected blank line before this statement.', + }, + }, + defaultOptions: [], + create(context) { + const sourceCode = context.getSourceCode(); + const configureList = context.options || []; + + type Scope = null | { + upper: Scope; + prevNode: TSESTree.Node | null; + }; + + let scopeInfo: Scope = null; + + /** + * Processes to enter to new scope. + * This manages the current previous statement. + * + * @private + */ + function enterScope(): void { + scopeInfo = { + upper: scopeInfo, + prevNode: null, + }; + } + + /** + * Processes to exit from the current scope. + * + * @private + */ + function exitScope(): void { + if (scopeInfo) { + scopeInfo = scopeInfo.upper; + } + } + + /** + * Checks whether the given node matches the given type. + * @param node The statement node to check. + * @param type The statement type to check. + * @returns `true` if the statement node matched the type. + * @private + */ + function match(node: TSESTree.Node, type: string | string[]): boolean { + let innerStatementNode = node; + + while (innerStatementNode.type === AST_NODE_TYPES.LabeledStatement) { + innerStatementNode = innerStatementNode.body; + } + + if (Array.isArray(type)) { + return type.some(match.bind(null, innerStatementNode)); + } + + return StatementTypes[type].test(innerStatementNode, sourceCode); + } + + /** + * Finds the last matched configure from configureList. + * @paramprevNode The previous statement to match. + * @paramnextNode The current statement to match. + * @returns The tester of the last matched configure. + * @private + */ + function getPaddingType( + prevNode: TSESTree.Node, + nextNode: TSESTree.Node, + ): typeof PaddingTypes[keyof typeof PaddingTypes] { + for (let i = configureList.length - 1; i >= 0; --i) { + const configure = configureList[i]; + if ( + match(prevNode, configure.prev) && + match(nextNode, configure.next) + ) { + return PaddingTypes[configure.blankLine]; + } + } + return PaddingTypes.any; + } + + /** + * Gets padding line sequences between the given 2 statements. + * Comments are separators of the padding line sequences. + * @paramprevNode The previous statement to count. + * @paramnextNode The current statement to count. + * @returns The array of token pairs. + * @private + */ + function getPaddingLineSequences( + prevNode: TSESTree.Node, + nextNode: TSESTree.Node, + ): [TSESTree.Token, TSESTree.Token][] { + const pairs: [TSESTree.Token, TSESTree.Token][] = []; + let prevToken: TSESTree.Token = getActualLastToken(prevNode, sourceCode)!; + + if (nextNode.loc.start.line - prevToken.loc.end.line >= 2) { + do { + const token: TSESTree.Token = sourceCode.getTokenAfter(prevToken, { + includeComments: true, + })!; + + if (token.loc.start.line - prevToken.loc.end.line >= 2) { + pairs.push([prevToken, token]); + } + prevToken = token; + } while (prevToken.range[0] < nextNode.range[0]); + } + + return pairs; + } + + /** + * Verify padding lines between the given node and the previous node. + * @param node The node to verify. + * + * @private + */ + function verify(node: TSESTree.Node): void { + if ( + !node.parent || + ![ + AST_NODE_TYPES.BlockStatement, + AST_NODE_TYPES.Program, + AST_NODE_TYPES.SwitchCase, + AST_NODE_TYPES.SwitchStatement, + AST_NODE_TYPES.TSModuleBlock, + ].includes(node.parent.type) + ) { + return; + } + + // Save this node as the current previous statement. + const prevNode = scopeInfo!.prevNode; + + // Verify. + if (prevNode) { + const type = getPaddingType(prevNode, node); + const paddingLines = getPaddingLineSequences(prevNode, node); + + type.verify(context, prevNode, node, paddingLines); + } + + scopeInfo!.prevNode = node; + } + + /** + * Verify padding lines between the given node and the previous node. + * Then process to enter to new scope. + * @param node The node to verify. + * + * @private + */ + function verifyThenEnterScope(node: TSESTree.Node): void { + verify(node); + enterScope(); + } + + return { + Program: enterScope, + BlockStatement: enterScope, + SwitchStatement: enterScope, + TSModuleBlock: enterScope, + 'Program:exit': exitScope, + 'BlockStatement:exit': exitScope, + 'SwitchStatement:exit': exitScope, + 'TSModuleBlock:exit': exitScope, + + ':statement': verify, + + SwitchCase: verifyThenEnterScope, + 'SwitchCase:exit': exitScope, + }; + }, +}); diff --git a/packages/eslint-plugin/src/rules/prefer-as-const.ts b/packages/eslint-plugin/src/rules/prefer-as-const.ts index 91f432420214..93bcce50889d 100644 --- a/packages/eslint-plugin/src/rules/prefer-as-const.ts +++ b/packages/eslint-plugin/src/rules/prefer-as-const.ts @@ -11,11 +11,11 @@ export default util.createRule({ type: 'suggestion', docs: { description: 'Prefer usage of `as const` over literal type', - category: 'Best Practices', recommended: 'error', suggestion: true, }, fixable: 'code', + hasSuggestions: true, messages: { preferConstAssertion: 'Expected a `const` instead of a literal type assertion.', diff --git a/packages/eslint-plugin/src/rules/prefer-enum-initializers.ts b/packages/eslint-plugin/src/rules/prefer-enum-initializers.ts index 1a5c1248c89a..5ad6dccd7cce 100644 --- a/packages/eslint-plugin/src/rules/prefer-enum-initializers.ts +++ b/packages/eslint-plugin/src/rules/prefer-enum-initializers.ts @@ -1,6 +1,5 @@ -import { TSESTree } from '@typescript-eslint/experimental-utils'; +import { TSESLint, TSESTree } from '@typescript-eslint/experimental-utils'; import * as util from '../util'; -import { TSESLint } from '@typescript-eslint/experimental-utils'; type MessageIds = 'defineInitializer' | 'defineInitializerSuggestion'; @@ -10,13 +9,13 @@ export default util.createRule<[], MessageIds>({ type: 'suggestion', docs: { description: 'Prefer initializing each enums member value', - category: 'Best Practices', recommended: false, suggestion: true, }, + hasSuggestions: true, messages: { defineInitializer: - "The value of the member '{{ name }}' should be explicitly defined", + "The value of the member '{{ name }}' should be explicitly defined.", defineInitializerSuggestion: 'Can be fixed to {{ name }} = {{ suggested }}', }, diff --git a/packages/eslint-plugin/src/rules/prefer-for-of.ts b/packages/eslint-plugin/src/rules/prefer-for-of.ts index 361ad5ec2cf7..f00868d04097 100644 --- a/packages/eslint-plugin/src/rules/prefer-for-of.ts +++ b/packages/eslint-plugin/src/rules/prefer-for-of.ts @@ -12,7 +12,6 @@ export default util.createRule({ docs: { description: 'Prefer a ‘for-of’ loop over a standard ‘for’ loop if the index is only used to access the array being iterated', - category: 'Stylistic Issues', recommended: false, }, messages: { @@ -43,7 +42,7 @@ export default util.createRule({ } function isMatchingIdentifier( - node: TSESTree.Expression, + node: TSESTree.Expression | TSESTree.PrivateIdentifier, name: string, ): boolean { return node.type === AST_NODE_TYPES.Identifier && node.name === name; diff --git a/packages/eslint-plugin/src/rules/prefer-function-type.ts b/packages/eslint-plugin/src/rules/prefer-function-type.ts index 761e8bc98eb9..ceeafcd841c3 100644 --- a/packages/eslint-plugin/src/rules/prefer-function-type.ts +++ b/packages/eslint-plugin/src/rules/prefer-function-type.ts @@ -17,7 +17,6 @@ export default util.createRule({ docs: { description: 'Use function types instead of interfaces with call signatures', - category: 'Best Practices', recommended: false, }, fixable: 'code', diff --git a/packages/eslint-plugin/src/rules/prefer-includes.ts b/packages/eslint-plugin/src/rules/prefer-includes.ts index f49b5385a0c8..f15a756abc4a 100644 --- a/packages/eslint-plugin/src/rules/prefer-includes.ts +++ b/packages/eslint-plugin/src/rules/prefer-includes.ts @@ -1,5 +1,6 @@ import { AST_NODE_TYPES, + TSESLint, TSESTree, } from '@typescript-eslint/experimental-utils'; import { AST as RegExpAST, parseRegExpLiteral } from 'regexpp'; @@ -19,7 +20,6 @@ export default createRule({ type: 'suggestion', docs: { description: 'Enforce `includes` method over `indexOf` method', - category: 'Best Practices', recommended: false, requiresTypeChecking: true, }, @@ -125,66 +125,81 @@ export default createRule({ ); } - return { - [[ - // a.indexOf(b) !== 1 - "BinaryExpression > CallExpression.left > MemberExpression.callee[property.name='indexOf'][computed=false]", - // a?.indexOf(b) !== 1 - "BinaryExpression > ChainExpression.left > CallExpression > MemberExpression.callee[property.name='indexOf'][computed=false]", - ].join(', ')](node: TSESTree.MemberExpression): void { - // Check if the comparison is equivalent to `includes()`. - const callNode = node.parent as TSESTree.CallExpression; - const compareNode = (callNode.parent?.type === - AST_NODE_TYPES.ChainExpression + function checkArrayIndexOf( + node: TSESTree.MemberExpression, + allowFixing: boolean, + ): void { + // Check if the comparison is equivalent to `includes()`. + const callNode = node.parent as TSESTree.CallExpression; + const compareNode = ( + callNode.parent?.type === AST_NODE_TYPES.ChainExpression ? callNode.parent.parent - : callNode.parent) as TSESTree.BinaryExpression; - const negative = isNegativeCheck(compareNode); - if (!negative && !isPositiveCheck(compareNode)) { - return; - } + : callNode.parent + ) as TSESTree.BinaryExpression; + const negative = isNegativeCheck(compareNode); + if (!negative && !isPositiveCheck(compareNode)) { + return; + } - // Get the symbol of `indexOf` method. - const tsNode = services.esTreeNodeToTSNodeMap.get(node.property); - const indexofMethodDeclarations = types - .getSymbolAtLocation(tsNode) + // Get the symbol of `indexOf` method. + const tsNode = services.esTreeNodeToTSNodeMap.get(node.property); + const indexofMethodDeclarations = types + .getSymbolAtLocation(tsNode) + ?.getDeclarations(); + if ( + indexofMethodDeclarations == null || + indexofMethodDeclarations.length === 0 + ) { + return; + } + + // Check if every declaration of `indexOf` method has `includes` method + // and the two methods have the same parameters. + for (const instanceofMethodDecl of indexofMethodDeclarations) { + const typeDecl = instanceofMethodDecl.parent; + const type = types.getTypeAtLocation(typeDecl); + const includesMethodDecl = type + .getProperty('includes') ?.getDeclarations(); if ( - indexofMethodDeclarations == null || - indexofMethodDeclarations.length === 0 + includesMethodDecl == null || + !includesMethodDecl.some(includesMethodDecl => + hasSameParameters(includesMethodDecl, instanceofMethodDecl), + ) ) { return; } + } - // Check if every declaration of `indexOf` method has `includes` method - // and the two methods have the same parameters. - for (const instanceofMethodDecl of indexofMethodDeclarations) { - const typeDecl = instanceofMethodDecl.parent; - const type = types.getTypeAtLocation(typeDecl); - const includesMethodDecl = type - .getProperty('includes') - ?.getDeclarations(); - if ( - includesMethodDecl == null || - !includesMethodDecl.some(includesMethodDecl => - hasSameParameters(includesMethodDecl, instanceofMethodDecl), - ) - ) { - return; - } - } - - // Report it. - context.report({ - node: compareNode, - messageId: 'preferIncludes', - *fix(fixer) { + // Report it. + context.report({ + node: compareNode, + messageId: 'preferIncludes', + ...(allowFixing && { + *fix(fixer): Generator { if (negative) { yield fixer.insertTextBefore(callNode, '!'); } yield fixer.replaceText(node.property, 'includes'); yield fixer.removeRange([callNode.range[1], compareNode.range[1]]); }, - }); + }), + }); + } + + return { + // a.indexOf(b) !== 1 + "BinaryExpression > CallExpression.left > MemberExpression.callee[property.name='indexOf'][computed=false]"( + node: TSESTree.MemberExpression, + ): void { + checkArrayIndexOf(node, /* allowFixing */ true); + }, + + // a?.indexOf(b) !== 1 + "BinaryExpression > ChainExpression.left > CallExpression > MemberExpression.callee[property.name='indexOf'][computed=false]"( + node: TSESTree.MemberExpression, + ): void { + checkArrayIndexOf(node, /* allowFixing */ false); }, // /bar/.test(foo) @@ -229,7 +244,7 @@ export default createRule({ } yield fixer.insertTextAfter( argNode, - `${node.optional ? '?.' : '.'}includes(${JSON.stringify(text)}`, + `${node.optional ? '?.' : '.'}includes('${text}'`, ); }, }); diff --git a/packages/eslint-plugin/src/rules/prefer-literal-enum-member.ts b/packages/eslint-plugin/src/rules/prefer-literal-enum-member.ts index 9843afeef4f3..8f10eb9be369 100644 --- a/packages/eslint-plugin/src/rules/prefer-literal-enum-member.ts +++ b/packages/eslint-plugin/src/rules/prefer-literal-enum-member.ts @@ -8,17 +8,30 @@ export default createRule({ docs: { description: 'Require that all enum members be literal values to prevent unintended enum member name shadow issues', - category: 'Best Practices', recommended: false, requiresTypeChecking: false, }, messages: { notLiteral: `Explicit enum value must only be a literal value (string, number, boolean, etc).`, }, - schema: [], + schema: [ + { + type: 'object', + properties: { + allowBitwiseExpressions: { + type: 'boolean', + }, + }, + additionalProperties: false, + }, + ], }, - defaultOptions: [], - create(context) { + defaultOptions: [ + { + allowBitwiseExpressions: false, + }, + ], + create(context, [{ allowBitwiseExpressions }]) { return { TSEnumMember(node): void { // If there is no initializer, then this node is just the name of the member, so ignore. @@ -39,8 +52,21 @@ export default createRule({ // -1 and +1 if ( node.initializer.type === AST_NODE_TYPES.UnaryExpression && - ['+', '-'].includes(node.initializer.operator) && - node.initializer.argument.type === AST_NODE_TYPES.Literal + node.initializer.argument.type === AST_NODE_TYPES.Literal && + (['+', '-'].includes(node.initializer.operator) || + (allowBitwiseExpressions && node.initializer.operator === '~')) + ) { + return; + } + + if ( + allowBitwiseExpressions && + node.initializer.type === AST_NODE_TYPES.BinaryExpression && + ['|', '&', '^', '<<', '>>', '>>>'].includes( + node.initializer.operator, + ) && + node.initializer.left.type === AST_NODE_TYPES.Literal && + node.initializer.right.type === AST_NODE_TYPES.Literal ) { return; } diff --git a/packages/eslint-plugin/src/rules/prefer-namespace-keyword.ts b/packages/eslint-plugin/src/rules/prefer-namespace-keyword.ts index 9137fe912aa6..4af7c9812534 100644 --- a/packages/eslint-plugin/src/rules/prefer-namespace-keyword.ts +++ b/packages/eslint-plugin/src/rules/prefer-namespace-keyword.ts @@ -11,7 +11,6 @@ export default util.createRule({ docs: { description: 'Require the use of the `namespace` keyword instead of the `module` keyword to declare custom TypeScript modules', - category: 'Best Practices', recommended: 'error', }, fixable: 'code', diff --git a/packages/eslint-plugin/src/rules/prefer-nullish-coalescing.ts b/packages/eslint-plugin/src/rules/prefer-nullish-coalescing.ts index fa6c1bb4e216..6975576edcaa 100644 --- a/packages/eslint-plugin/src/rules/prefer-nullish-coalescing.ts +++ b/packages/eslint-plugin/src/rules/prefer-nullish-coalescing.ts @@ -21,11 +21,11 @@ export default util.createRule({ docs: { description: 'Enforce the usage of the nullish coalescing operator instead of logical chaining', - category: 'Best Practices', recommended: false, suggestion: true, requiresTypeChecking: true, }, + hasSuggestions: true, messages: { preferNullish: 'Prefer using nullish coalescing operator (`??`) instead of a logical or (`||`), as it is a safer operator.', diff --git a/packages/eslint-plugin/src/rules/prefer-optional-chain.ts b/packages/eslint-plugin/src/rules/prefer-optional-chain.ts index cd886a9d9974..84c2e15e3975 100644 --- a/packages/eslint-plugin/src/rules/prefer-optional-chain.ts +++ b/packages/eslint-plugin/src/rules/prefer-optional-chain.ts @@ -37,10 +37,10 @@ export default util.createRule({ docs: { description: 'Prefer using concise optional chain expressions instead of chained logical ands', - category: 'Best Practices', recommended: false, suggestion: true, }, + hasSuggestions: true, messages: { preferOptionalChain: "Prefer using an optional chain expression instead, as it's more concise and easier to read.", @@ -65,10 +65,12 @@ export default util.createRule({ | TSESTree.MemberExpression, ): void { // selector guarantees this cast - const initialExpression = (initialIdentifierOrNotEqualsExpr.parent - ?.type === AST_NODE_TYPES.ChainExpression - ? initialIdentifierOrNotEqualsExpr.parent.parent - : initialIdentifierOrNotEqualsExpr.parent) as TSESTree.LogicalExpression; + 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 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 a36020e93d3c..ed3e4ba284b1 100644 --- a/packages/eslint-plugin/src/rules/prefer-readonly-parameter-types.ts +++ b/packages/eslint-plugin/src/rules/prefer-readonly-parameter-types.ts @@ -1,6 +1,6 @@ import { - TSESTree, AST_NODE_TYPES, + TSESTree, } from '@typescript-eslint/experimental-utils'; import * as util from '../util'; @@ -8,7 +8,7 @@ type Options = [ { checkParameterProperties?: boolean; ignoreInferredTypes?: boolean; - }, + } & util.ReadonlynessOptions, ]; type MessageIds = 'shouldBeReadonly'; @@ -19,7 +19,6 @@ export default util.createRule({ docs: { description: 'Requires that function parameters are typed as readonly to prevent accidental mutation of inputs', - category: 'Possible Errors', recommended: false, requiresTypeChecking: true, }, @@ -34,6 +33,7 @@ export default util.createRule({ ignoreInferredTypes: { type: 'boolean', }, + ...util.readonlynessOptionsSchema.properties, }, }, ], @@ -45,10 +45,13 @@ export default util.createRule({ { checkParameterProperties: true, ignoreInferredTypes: false, + ...util.readonlynessOptionsDefaults, }, ], - create(context, options) { - const [{ checkParameterProperties, ignoreInferredTypes }] = options; + create( + context, + [{ checkParameterProperties, ignoreInferredTypes, treatMethodsAsReadonly }], + ) { const { esTreeNodeToTSNodeMap, program } = util.getParserServices(context); const checker = program.getTypeChecker(); @@ -94,7 +97,9 @@ export default util.createRule({ const tsNode = esTreeNodeToTSNodeMap.get(actualParam); const type = checker.getTypeAtLocation(tsNode); - const isReadOnly = util.isTypeReadonly(checker, type); + const isReadOnly = util.isTypeReadonly(checker, type, { + treatMethodsAsReadonly: treatMethodsAsReadonly!, + }); if (!isReadOnly) { context.report({ diff --git a/packages/eslint-plugin/src/rules/prefer-readonly.ts b/packages/eslint-plugin/src/rules/prefer-readonly.ts index 27eb7dca97cc..7b0fbfee3af7 100644 --- a/packages/eslint-plugin/src/rules/prefer-readonly.ts +++ b/packages/eslint-plugin/src/rules/prefer-readonly.ts @@ -3,12 +3,12 @@ import * as ts from 'typescript'; import * as util from '../util'; import { typeIsOrHasBaseType } from '../util'; import { - TSESTree, + ASTUtils, AST_NODE_TYPES, + TSESTree, } from '@typescript-eslint/experimental-utils'; type MessageIds = 'preferReadonly'; - type Options = [ { onlyInlineLambdas?: boolean; @@ -28,7 +28,6 @@ export default util.createRule({ docs: { description: "Requires that private members are marked as `readonly` if they're never modified outside of the constructor", - category: 'Best Practices', recommended: false, requiresTypeChecking: true, }, @@ -135,15 +134,6 @@ export default util.createRule({ return false; } - function isConstructor( - node: TSESTree.Node, - ): node is TSESTree.MethodDefinition { - return ( - node.type === AST_NODE_TYPES.MethodDefinition && - node.kind === 'constructor' - ); - } - function isFunctionScopeBoundaryInStack( node: | TSESTree.ArrowFunctionExpression @@ -200,9 +190,8 @@ export default util.createRule({ const sourceCode = context.getSourceCode(); for (const violatingNode of finalizedClassScope.finalizeUnmodifiedPrivateNonReadonlys()) { - const { esNode, nameNode } = getEsNodesFromViolatingNode( - violatingNode, - ); + const { esNode, nameNode } = + getEsNodesFromViolatingNode(violatingNode); context.report({ data: { name: sourceCode.getText(nameNode), @@ -232,7 +221,7 @@ export default util.createRule({ | TSESTree.FunctionExpression | TSESTree.MethodDefinition, ): void { - if (isConstructor(node)) { + if (ASTUtils.isConstructor(node)) { classScopeStack[classScopeStack.length - 1].enterConstructor( parserServices.esTreeNodeToTSNodeMap.get(node), ); @@ -247,7 +236,7 @@ export default util.createRule({ | TSESTree.FunctionExpression | TSESTree.MethodDefinition, ): void { - if (isConstructor(node)) { + if (ASTUtils.isConstructor(node)) { classScopeStack[classScopeStack.length - 1].exitConstructor(); } else if (isFunctionScopeBoundaryInStack(node)) { classScopeStack[classScopeStack.length - 1].exitNonConstructor(); 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 3b1af79ac6e8..a797bfdf48f3 100644 --- a/packages/eslint-plugin/src/rules/prefer-reduce-type-parameter.ts +++ b/packages/eslint-plugin/src/rules/prefer-reduce-type-parameter.ts @@ -30,7 +30,6 @@ export default util.createRule({ meta: { type: 'problem', docs: { - category: 'Best Practices', recommended: false, description: 'Prefer using type parameter when calling `Array#reduce` instead of casting', @@ -77,22 +76,31 @@ export default util.createRule({ context.report({ messageId: 'preferTypeParameter', node: secondArg, - fix: fixer => [ - fixer.removeRange([ - secondArg.range[0], - secondArg.expression.range[0], - ]), - fixer.removeRange([ - secondArg.expression.range[1], - secondArg.range[1], - ]), - fixer.insertTextAfter( - callee, - `<${context - .getSourceCode() - .getText(secondArg.typeAnnotation)}>`, - ), - ], + fix: fixer => { + const fixes = [ + fixer.removeRange([ + secondArg.range[0], + secondArg.expression.range[0], + ]), + fixer.removeRange([ + secondArg.expression.range[1], + secondArg.range[1], + ]), + ]; + + if (!callee.parent.typeParameters) { + fixes.push( + fixer.insertTextAfter( + callee, + `<${context + .getSourceCode() + .getText(secondArg.typeAnnotation)}>`, + ), + ); + } + + return fixes; + }, }); return; diff --git a/packages/eslint-plugin/src/rules/prefer-regexp-exec.ts b/packages/eslint-plugin/src/rules/prefer-regexp-exec.ts index dda6f15d3a5c..bb91f3408460 100644 --- a/packages/eslint-plugin/src/rules/prefer-regexp-exec.ts +++ b/packages/eslint-plugin/src/rules/prefer-regexp-exec.ts @@ -1,22 +1,35 @@ -import { TSESTree } from '@typescript-eslint/experimental-utils'; +import { + AST_NODE_TYPES, + TSESTree, +} from '@typescript-eslint/experimental-utils'; +import * as tsutils from 'tsutils'; +import * as ts from 'typescript'; import { createRule, getParserServices, getStaticValue, getTypeName, + getWrappingFixer, } from '../util'; +enum ArgumentType { + Other = 0, + String = 1 << 0, + RegExp = 1 << 1, + Both = String | RegExp, +} + export default createRule({ name: 'prefer-regexp-exec', defaultOptions: [], meta: { type: 'suggestion', + fixable: 'code', docs: { description: 'Enforce that `RegExp#exec` is used instead of `String#match` if no global flag is provided', - category: 'Best Practices', - recommended: 'error', + recommended: false, requiresTypeChecking: true, }, messages: { @@ -27,43 +40,137 @@ export default createRule({ create(context) { const globalScope = context.getScope(); - const service = getParserServices(context); - const typeChecker = service.program.getTypeChecker(); + const parserServices = getParserServices(context); + const typeChecker = parserServices.program.getTypeChecker(); + const sourceCode = context.getSourceCode(); /** - * Check if a given node is a string. - * @param node The node to check. + * Check if a given node type is a string. + * @param node The node type to check. */ - function isStringType(node: TSESTree.LeftHandSideExpression): boolean { - const objectType = typeChecker.getTypeAtLocation( - service.esTreeNodeToTSNodeMap.get(node), - ); - return getTypeName(typeChecker, objectType) === 'string'; + function isStringType(type: ts.Type): boolean { + return getTypeName(typeChecker, type) === 'string'; + } + + /** + * Check if a given node type is a RegExp. + * @param node The node type to check. + */ + function isRegExpType(type: ts.Type): boolean { + return getTypeName(typeChecker, type) === 'RegExp'; + } + + function collectArgumentTypes(types: ts.Type[]): ArgumentType { + let result = ArgumentType.Other; + + for (const type of types) { + if (isRegExpType(type)) { + result |= ArgumentType.RegExp; + } else if (isStringType(type)) { + result |= ArgumentType.String; + } + } + + return result; + } + + function isLikelyToContainGlobalFlag( + node: TSESTree.CallExpressionArgument, + ): boolean { + if ( + node.type === AST_NODE_TYPES.CallExpression || + node.type === AST_NODE_TYPES.NewExpression + ) { + const [, flags] = node.arguments; + return ( + flags && + flags.type === AST_NODE_TYPES.Literal && + typeof flags.value === 'string' && + flags.value.includes('g') + ); + } + + return node.type === AST_NODE_TYPES.Identifier; } return { "CallExpression[arguments.length=1] > MemberExpression.callee[property.name='match'][computed=false]"( - node: TSESTree.MemberExpression, + memberNode: TSESTree.MemberExpression, ): void { - const callNode = node.parent as TSESTree.CallExpression; - const arg = callNode.arguments[0]; - const evaluated = getStaticValue(arg, globalScope); + const objectNode = memberNode.object; + const callNode = memberNode.parent as TSESTree.CallExpression; + const [argumentNode] = callNode.arguments; + const argumentValue = getStaticValue(argumentNode, globalScope); + + if ( + !isStringType( + typeChecker.getTypeAtLocation( + parserServices.esTreeNodeToTSNodeMap.get(objectNode), + ), + ) + ) { + return; + } // Don't report regular expressions with global flag. if ( - evaluated && - evaluated.value instanceof RegExp && - evaluated.value.flags.includes('g') + (!argumentValue && isLikelyToContainGlobalFlag(argumentNode)) || + (argumentValue && + argumentValue.value instanceof RegExp && + argumentValue.value.flags.includes('g')) ) { return; } - if (isStringType(node.object)) { - context.report({ - node: callNode, + if ( + argumentNode.type === AST_NODE_TYPES.Literal && + typeof argumentNode.value == 'string' + ) { + const regExp = RegExp(argumentNode.value); + return context.report({ + node: memberNode.property, messageId: 'regExpExecOverStringMatch', + fix: getWrappingFixer({ + sourceCode, + node: callNode, + innerNode: [objectNode], + wrap: objectCode => `${regExp.toString()}.exec(${objectCode})`, + }), }); - return; + } + + const argumentType = typeChecker.getTypeAtLocation( + parserServices.esTreeNodeToTSNodeMap.get(argumentNode), + ); + const argumentTypes = collectArgumentTypes( + tsutils.unionTypeParts(argumentType), + ); + switch (argumentTypes) { + case ArgumentType.RegExp: + return context.report({ + node: memberNode.property, + messageId: 'regExpExecOverStringMatch', + fix: getWrappingFixer({ + sourceCode, + node: callNode, + innerNode: [objectNode, argumentNode], + wrap: (objectCode, argumentCode) => + `${argumentCode}.exec(${objectCode})`, + }), + }); + + case ArgumentType.String: + return context.report({ + node: memberNode.property, + messageId: 'regExpExecOverStringMatch', + fix: getWrappingFixer({ + sourceCode, + node: callNode, + innerNode: [objectNode, argumentNode], + wrap: (objectCode, argumentCode) => + `RegExp(${argumentCode}).exec(${objectCode})`, + }), + }); } }, }; diff --git a/packages/eslint-plugin/src/rules/prefer-return-this-type.ts b/packages/eslint-plugin/src/rules/prefer-return-this-type.ts new file mode 100644 index 000000000000..15faf74d1ed3 --- /dev/null +++ b/packages/eslint-plugin/src/rules/prefer-return-this-type.ts @@ -0,0 +1,173 @@ +import { + AST_NODE_TYPES, + TSESTree, +} from '@typescript-eslint/experimental-utils'; +import * as ts from 'typescript'; +import { createRule, forEachReturnStatement, getParserServices } from '../util'; + +type ClassLikeDeclaration = + | TSESTree.ClassDeclaration + | TSESTree.ClassExpression; + +type FunctionLike = + | TSESTree.MethodDefinition['value'] + | TSESTree.ArrowFunctionExpression; + +export default createRule({ + name: 'prefer-return-this-type', + defaultOptions: [], + + meta: { + type: 'suggestion', + docs: { + description: + 'Enforce that `this` is used when only `this` type is returned', + recommended: false, + requiresTypeChecking: true, + }, + messages: { + useThisType: 'Use `this` type instead.', + }, + schema: [], + fixable: 'code', + }, + + create(context) { + const parserServices = getParserServices(context); + const checker = parserServices.program.getTypeChecker(); + + function tryGetNameInType( + name: string, + typeNode: TSESTree.TypeNode, + ): TSESTree.TSTypeReference | undefined { + if ( + typeNode.type === AST_NODE_TYPES.TSTypeReference && + typeNode.typeName.type === AST_NODE_TYPES.Identifier && + typeNode.typeName.name === name + ) { + return typeNode; + } + + if (typeNode.type === AST_NODE_TYPES.TSUnionType) { + for (const type of typeNode.types) { + const found = tryGetNameInType(name, type); + if (found) { + return found; + } + } + } + + return undefined; + } + + function isThisSpecifiedInParameters(originalFunc: FunctionLike): boolean { + const firstArg = originalFunc.params[0]; + return ( + firstArg && + firstArg.type === AST_NODE_TYPES.Identifier && + firstArg.name === 'this' + ); + } + + function isFunctionReturningThis( + originalFunc: FunctionLike, + originalClass: ClassLikeDeclaration, + ): boolean { + if (isThisSpecifiedInParameters(originalFunc)) { + return false; + } + + const func = parserServices.esTreeNodeToTSNodeMap.get(originalFunc); + + if (!func.body) { + return false; + } + + const classType = checker.getTypeAtLocation( + parserServices.esTreeNodeToTSNodeMap.get(originalClass), + ) as ts.InterfaceType; + + if (func.body.kind !== ts.SyntaxKind.Block) { + const type = checker.getTypeAtLocation(func.body); + return classType.thisType === type; + } + + let hasReturnThis = false; + let hasReturnClassType = false; + + forEachReturnStatement(func.body as ts.Block, stmt => { + const expr = stmt.expression; + if (!expr) { + return; + } + + // fast check + if (expr.kind === ts.SyntaxKind.ThisKeyword) { + hasReturnThis = true; + return; + } + + const type = checker.getTypeAtLocation(expr); + if (classType === type) { + hasReturnClassType = true; + return true; + } + + if (classType.thisType === type) { + hasReturnThis = true; + return; + } + + return; + }); + + return !hasReturnClassType && hasReturnThis; + } + + function checkFunction( + originalFunc: FunctionLike, + originalClass: ClassLikeDeclaration, + ): void { + const className = originalClass.id?.name; + if (!className || !originalFunc.returnType) { + return; + } + + const node = tryGetNameInType( + className, + originalFunc.returnType.typeAnnotation, + ); + if (!node) { + return; + } + + if (isFunctionReturningThis(originalFunc, originalClass)) { + context.report({ + node, + messageId: 'useThisType', + fix: fixer => fixer.replaceText(node, 'this'), + }); + } + } + + return { + 'ClassBody > MethodDefinition'(node: TSESTree.MethodDefinition): void { + checkFunction(node.value, node.parent!.parent as ClassLikeDeclaration); + }, + 'ClassBody > PropertyDefinition'( + node: TSESTree.PropertyDefinition, + ): void { + if ( + !( + node.value?.type === AST_NODE_TYPES.FunctionExpression || + node.value?.type === AST_NODE_TYPES.ArrowFunctionExpression + ) + ) { + return; + } + + 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 f4697b7c01de..c90bb0a1a746 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 @@ -27,7 +27,6 @@ export default createRule({ docs: { description: 'Enforce the use of `String#startsWith` and `String#endsWith` instead of other equivalent methods of checking substrings', - category: 'Best Practices', recommended: false, requiresTypeChecking: true, }, 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 d696fc045735..15c070298cb1 100644 --- a/packages/eslint-plugin/src/rules/prefer-ts-expect-error.ts +++ b/packages/eslint-plugin/src/rules/prefer-ts-expect-error.ts @@ -16,7 +16,6 @@ export default util.createRule<[], MessageIds>({ type: 'problem', docs: { description: 'Recommends using `@ts-expect-error` over `@ts-ignore`', - category: 'Best Practices', recommended: false, }, fixable: 'code', diff --git a/packages/eslint-plugin/src/rules/promise-function-async.ts b/packages/eslint-plugin/src/rules/promise-function-async.ts index ce624be643c1..083afcebe712 100644 --- a/packages/eslint-plugin/src/rules/promise-function-async.ts +++ b/packages/eslint-plugin/src/rules/promise-function-async.ts @@ -1,5 +1,6 @@ import { AST_NODE_TYPES, + AST_TOKEN_TYPES, TSESTree, } from '@typescript-eslint/experimental-utils'; import * as ts from 'typescript'; @@ -25,7 +26,6 @@ export default util.createRule({ docs: { description: 'Requires any function or method that returns a Promise to be marked async', - category: 'Best Practices', recommended: false, requiresTypeChecking: true, }, @@ -156,28 +156,60 @@ export default util.createRule({ (node.parent.type === AST_NODE_TYPES.Property && node.parent.method)) ) { - return fixer.insertTextBefore(node.parent.key, 'async '); + // this function is a class method or object function property shorthand + const method = node.parent; + + // the token to put `async` before + let keyToken = sourceCode.getFirstToken(method)!; + + // if there are decorators then skip past them + if ( + method.type === AST_NODE_TYPES.MethodDefinition && + method.decorators + ) { + const lastDecorator = + method.decorators[method.decorators.length - 1]; + keyToken = sourceCode.getTokenAfter(lastDecorator)!; + } + + // if current token is a keyword like `static` or `public` then skip it + while (keyToken.type === AST_TOKEN_TYPES.Keyword) { + keyToken = sourceCode.getTokenAfter(keyToken)!; + } + + // check if there is a space between key and previous token + const insertSpace = !sourceCode.isSpaceBetween!( + sourceCode.getTokenBefore(keyToken)!, + keyToken, + ); + + let code = 'async '; + if (insertSpace) { + code = ` ${code}`; + } + return fixer.insertTextBefore(keyToken, code); } + return fixer.insertTextBefore(node, 'async '); }, }); } return { - 'ArrowFunctionExpression[async = false]'( - node: TSESTree.ArrowFunctionExpression, - ): void { - if (checkArrowFunctions) { + ...(checkArrowFunctions && { + 'ArrowFunctionExpression[async = false]'( + node: TSESTree.ArrowFunctionExpression, + ): void { validateNode(node); - } - }, - 'FunctionDeclaration[async = false]'( - node: TSESTree.FunctionDeclaration, - ): void { - if (checkFunctionDeclarations) { + }, + }), + ...(checkFunctionDeclarations && { + 'FunctionDeclaration[async = false]'( + node: TSESTree.FunctionDeclaration, + ): void { validateNode(node); - } - }, + }, + }), 'FunctionExpression[async = false]'( node: TSESTree.FunctionExpression, ): void { diff --git a/packages/eslint-plugin/src/rules/quotes.ts b/packages/eslint-plugin/src/rules/quotes.ts index 3cbdbce3d875..a22782cc08ea 100644 --- a/packages/eslint-plugin/src/rules/quotes.ts +++ b/packages/eslint-plugin/src/rules/quotes.ts @@ -2,9 +2,11 @@ import { AST_NODE_TYPES, TSESTree, } from '@typescript-eslint/experimental-utils'; -import baseRule from 'eslint/lib/rules/quotes'; +import { getESLintCoreRule } from '../util/getESLintCoreRule'; import * as util from '../util'; +const baseRule = getESLintCoreRule('quotes'); + export type Options = util.InferOptionsTypeFromRule; export type MessageIds = util.InferMessageIdsTypeFromRule; @@ -15,11 +17,12 @@ export default util.createRule({ docs: { description: 'Enforce the consistent use of either backticks, double, or single quotes', - category: 'Stylistic Issues', 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}}.', }, @@ -50,8 +53,8 @@ export default util.createRule({ case AST_NODE_TYPES.TSEnumMember: return node === parent.id; - case AST_NODE_TYPES.TSAbstractClassProperty: - case AST_NODE_TYPES.ClassProperty: + case AST_NODE_TYPES.TSAbstractPropertyDefinition: + case AST_NODE_TYPES.PropertyDefinition: return node === parent.key; default: 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 6e0c49f31a8b..25476314d73f 100644 --- a/packages/eslint-plugin/src/rules/require-array-sort-compare.ts +++ b/packages/eslint-plugin/src/rules/require-array-sort-compare.ts @@ -21,7 +21,6 @@ export default util.createRule({ docs: { description: 'Requires `Array#sort` calls to always provide a `compareFunction`', - category: 'Best Practices', recommended: false, requiresTypeChecking: true, }, diff --git a/packages/eslint-plugin/src/rules/require-await.ts b/packages/eslint-plugin/src/rules/require-await.ts index 99c455cd0f6a..a1e92e8f91d8 100644 --- a/packages/eslint-plugin/src/rules/require-await.ts +++ b/packages/eslint-plugin/src/rules/require-await.ts @@ -25,7 +25,6 @@ export default util.createRule({ type: 'suggestion', docs: { description: 'Disallow async functions which have no `await` expression', - category: 'Best Practices', recommended: 'error', requiresTypeChecking: true, extendsBaseRule: true, diff --git a/packages/eslint-plugin/src/rules/restrict-plus-operands.ts b/packages/eslint-plugin/src/rules/restrict-plus-operands.ts index 0edf8a37d20e..51b4da9be466 100644 --- a/packages/eslint-plugin/src/rules/restrict-plus-operands.ts +++ b/packages/eslint-plugin/src/rules/restrict-plus-operands.ts @@ -16,7 +16,6 @@ export default util.createRule({ docs: { description: 'When adding two variables, operands must both be of type number or of type string', - category: 'Best Practices', recommended: 'error', requiresTypeChecking: true, }, @@ -57,7 +56,10 @@ export default util.createRule({ if (type.isNumberLiteral()) { return 'number'; } - if (type.isStringLiteral()) { + if ( + type.isStringLiteral() || + util.isTypeFlagSet(type, ts.TypeFlags.TemplateLiteral) + ) { return 'string'; } // is BigIntLiteral @@ -130,11 +132,11 @@ export default util.createRule({ return { "BinaryExpression[operator='+']": checkPlusOperands, - "AssignmentExpression[operator='+=']"(node): void { - if (checkCompoundAssignments) { + ...(checkCompoundAssignments && { + "AssignmentExpression[operator='+=']"(node): void { checkPlusOperands(node); - } - }, + }, + }), }; }, }); diff --git a/packages/eslint-plugin/src/rules/restrict-template-expressions.ts b/packages/eslint-plugin/src/rules/restrict-template-expressions.ts index a4756266ffca..f39bc88cfe59 100644 --- a/packages/eslint-plugin/src/rules/restrict-template-expressions.ts +++ b/packages/eslint-plugin/src/rules/restrict-template-expressions.ts @@ -11,6 +11,7 @@ type Options = [ allowBoolean?: boolean; allowAny?: boolean; allowNullish?: boolean; + allowRegExp?: boolean; }, ]; @@ -22,7 +23,6 @@ export default util.createRule({ type: 'problem', docs: { description: 'Enforce template literal expressions to be of string type', - category: 'Best Practices', recommended: 'error', requiresTypeChecking: true, }, @@ -37,6 +37,7 @@ export default util.createRule({ allowBoolean: { type: 'boolean' }, allowAny: { type: 'boolean' }, allowNullish: { type: 'boolean' }, + allowRegExp: { type: 'boolean' }, }, }, ], @@ -76,6 +77,13 @@ export default util.createRule({ return true; } + if ( + options.allowRegExp && + util.getTypeName(typeChecker, type) === 'RegExp' + ) { + return true; + } + if ( options.allowNullish && util.isTypeFlagSet(type, ts.TypeFlags.Null | ts.TypeFlags.Undefined) diff --git a/packages/eslint-plugin/src/rules/return-await.ts b/packages/eslint-plugin/src/rules/return-await.ts index c8e7f102b095..93b863757a0b 100644 --- a/packages/eslint-plugin/src/rules/return-await.ts +++ b/packages/eslint-plugin/src/rules/return-await.ts @@ -7,26 +7,27 @@ import * as tsutils from 'tsutils'; import * as ts from 'typescript'; import * as util from '../util'; -interface ScopeInfo { - hasAsync: boolean; -} - type FunctionNode = | TSESTree.FunctionDeclaration | TSESTree.FunctionExpression | TSESTree.ArrowFunctionExpression; +interface ScopeInfo { + hasAsync: boolean; + owningFunc: FunctionNode; +} + export default util.createRule({ name: 'return-await', meta: { docs: { description: 'Enforces consistent returning of awaited values', - category: 'Best Practices', recommended: false, requiresTypeChecking: true, extendsBaseRule: 'no-return-await', }, fixable: 'code', + hasSuggestions: true, type: 'problem', messages: { nonPromiseAwait: @@ -49,19 +50,24 @@ export default util.createRule({ const checker = parserServices.program.getTypeChecker(); const sourceCode = context.getSourceCode(); - let scopeInfo: ScopeInfo | null = null; + const scopeInfoStack: ScopeInfo[] = []; function enterFunction(node: FunctionNode): void { - scopeInfo = { + scopeInfoStack.push({ hasAsync: node.async, - }; + owningFunc: node, + }); + } + + function exitFunction(): void { + scopeInfoStack.pop(); } function inTry(node: ts.Node): boolean { let ancestor = node.parent; while (ancestor && !ts.isFunctionLike(ancestor)) { - if (tsutils.isTryStatement(ancestor)) { + if (ts.isTryStatement(ancestor)) { return true; } @@ -75,7 +81,7 @@ export default util.createRule({ let ancestor = node.parent; while (ancestor && !ts.isFunctionLike(ancestor)) { - if (tsutils.isCatchClause(ancestor)) { + if (ts.isCatchClause(ancestor)) { return true; } @@ -90,8 +96,8 @@ export default util.createRule({ while (ancestor && !ts.isFunctionLike(ancestor)) { if ( - tsutils.isTryStatement(ancestor.parent) && - tsutils.isBlock(ancestor) && + ts.isTryStatement(ancestor.parent) && + ts.isBlock(ancestor) && ancestor.parent.end === ancestor.end ) { return true; @@ -106,7 +112,7 @@ export default util.createRule({ let ancestor = node.parent; while (ancestor && !ts.isFunctionLike(ancestor)) { - if (tsutils.isTryStatement(ancestor)) { + if (ts.isTryStatement(ancestor)) { return !!ancestor.finallyBlock; } ancestor = ancestor.parent; @@ -147,14 +153,21 @@ export default util.createRule({ function insertAwait( fixer: TSESLint.RuleFixer, node: TSESTree.Expression, - ): TSESLint.RuleFix | null { - return fixer.insertTextBefore(node, 'await '); + ): TSESLint.RuleFix | TSESLint.RuleFix[] { + if (node.type !== AST_NODE_TYPES.TSAsExpression) { + return fixer.insertTextBefore(node, 'await '); + } + + return [ + fixer.insertTextBefore(node, 'await ('), + fixer.insertTextAfter(node, ')'), + ]; } function test(node: TSESTree.Expression, expression: ts.Node): void { let child: ts.Node; - const isAwait = tsutils.isAwaitExpression(expression); + const isAwait = ts.isAwaitExpression(expression); if (isAwait) { child = expression.getChildAt(1); @@ -263,6 +276,11 @@ export default util.createRule({ FunctionExpression: enterFunction, ArrowFunctionExpression: enterFunction, + 'FunctionDeclaration:exit': exitFunction, + 'FunctionExpression:exit': exitFunction, + 'ArrowFunctionExpression:exit': exitFunction, + + // executes after less specific handler, so exitFunction is called 'ArrowFunctionExpression[async = true]:exit'( node: TSESTree.ArrowFunctionExpression, ): void { @@ -274,6 +292,7 @@ export default util.createRule({ } }, ReturnStatement(node): void { + const scopeInfo = scopeInfoStack[scopeInfoStack.length - 1]; if (!scopeInfo || !scopeInfo.hasAsync || !node.argument) { return; } diff --git a/packages/eslint-plugin/src/rules/semi.ts b/packages/eslint-plugin/src/rules/semi.ts index 9c18d0e36712..647d2c21b3eb 100644 --- a/packages/eslint-plugin/src/rules/semi.ts +++ b/packages/eslint-plugin/src/rules/semi.ts @@ -3,9 +3,11 @@ import { TSESLint, AST_NODE_TYPES, } from '@typescript-eslint/experimental-utils'; -import baseRule from 'eslint/lib/rules/semi'; +import { getESLintCoreRule } from '../util/getESLintCoreRule'; import * as util from '../util'; +const baseRule = getESLintCoreRule('semi'); + export type Options = util.InferOptionsTypeFromRule; export type MessageIds = util.InferMessageIdsTypeFromRule; @@ -15,13 +17,14 @@ export default util.createRule({ type: 'layout', docs: { description: 'Require or disallow semicolons instead of ASI', - category: 'Stylistic Issues', // 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.', @@ -36,7 +39,8 @@ export default util.createRule({ ], create(context) { const rules = baseRule.create(context); - const checkForSemicolon = rules.ExpressionStatement as TSESLint.RuleFunction; + const checkForSemicolon = + rules.ExpressionStatement as TSESLint.RuleFunction; /* The following nodes are handled by the member-delimiter-style rule @@ -47,8 +51,8 @@ export default util.createRule({ AST_NODE_TYPES.TSPropertySignature, */ const nodesToCheck = [ - AST_NODE_TYPES.ClassProperty, - AST_NODE_TYPES.TSAbstractClassProperty, + AST_NODE_TYPES.PropertyDefinition, + AST_NODE_TYPES.TSAbstractPropertyDefinition, AST_NODE_TYPES.TSAbstractMethodDefinition, AST_NODE_TYPES.TSDeclareFunction, AST_NODE_TYPES.TSExportAssignment, 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 index fb83da6f318b..942cae423df9 100644 --- a/packages/eslint-plugin/src/rules/sort-type-union-intersection-members.ts +++ b/packages/eslint-plugin/src/rules/sort-type-union-intersection-members.ts @@ -23,9 +23,6 @@ enum Group { function getGroup(node: TSESTree.TypeNode): Group { switch (node.type) { - case AST_NODE_TYPES.TSParenthesizedType: - return getGroup(node.typeAnnotation); - case AST_NODE_TYPES.TSConditionalType: return Group.conditional; @@ -82,7 +79,6 @@ function getGroup(node: TSESTree.TypeNode): Group { return Group.union; // These types should never occur as part of a union/intersection - case AST_NODE_TYPES.TSInterfaceHeritage: case AST_NODE_TYPES.TSNamedTupleMember: case AST_NODE_TYPES.TSOptionalType: case AST_NODE_TYPES.TSRestType: @@ -92,6 +88,10 @@ function getGroup(node: TSESTree.TypeNode): Group { } } +function requiresParentheses(node: TSESTree.TypeNode): boolean { + return node.type === AST_NODE_TYPES.TSFunctionType; +} + export type Options = [ { checkIntersections?: boolean; @@ -108,10 +108,10 @@ export default util.createRule({ docs: { description: 'Enforces that members of a type union/intersection are sorted alphabetically', - category: 'Stylistic Issues', recommended: false, }, fixable: 'code', + hasSuggestions: true, messages: { notSorted: '{{type}} type members must be sorted.', notSortedNamed: '{{type}} type {{name}} members must be sorted.', @@ -212,7 +212,7 @@ export default util.createRule({ const fix: TSESLint.ReportFixFunction = fixer => { const sorted = expectedOrder - .map(t => t.text) + .map(t => (requiresParentheses(t.node) ? `(${t.text})` : t.text)) .join( node.type === AST_NODE_TYPES.TSIntersectionType ? ' & ' : ' | ', ); @@ -241,16 +241,16 @@ export default util.createRule({ } return { - TSIntersectionType(node): void { - if (checkIntersections === true) { + ...(checkIntersections && { + TSIntersectionType(node): void { checkSorting(node); - } - }, - TSUnionType(node): void { - if (checkUnions === true) { + }, + }), + ...(checkUnions && { + TSUnionType(node): void { checkSorting(node); - } - }, + }, + }), }; }, }); 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 e2ccfa5182db..8f848f92742a 100644 --- a/packages/eslint-plugin/src/rules/space-before-function-paren.ts +++ b/packages/eslint-plugin/src/rules/space-before-function-paren.ts @@ -23,7 +23,6 @@ export default util.createRule({ type: 'layout', docs: { description: 'Enforces consistent spacing before function parenthesis', - category: 'Stylistic Issues', recommended: false, extendsBaseRule: true, }, @@ -59,12 +58,10 @@ export default util.createRule({ }, defaultOptions: ['always'], - create(context) { + create(context, [firstOption]) { const sourceCode = context.getSourceCode(); - const baseConfig = - typeof context.options[0] === 'string' ? context.options[0] : 'always'; - const overrideConfig = - typeof context.options[0] === 'object' ? context.options[0] : {}; + const baseConfig = typeof firstOption === 'string' ? firstOption : 'always'; + const overrideConfig = typeof firstOption === 'object' ? firstOption : {}; /** * Determines whether a function has a name. diff --git a/packages/eslint-plugin/src/rules/space-infix-ops.ts b/packages/eslint-plugin/src/rules/space-infix-ops.ts index 57c56ad0b476..fddeaac6fb6f 100644 --- a/packages/eslint-plugin/src/rules/space-infix-ops.ts +++ b/packages/eslint-plugin/src/rules/space-infix-ops.ts @@ -2,12 +2,16 @@ import { AST_TOKEN_TYPES, TSESTree, } from '@typescript-eslint/experimental-utils'; -import baseRule from 'eslint/lib/rules/space-infix-ops'; +import { getESLintCoreRule } from '../util/getESLintCoreRule'; import * as util from '../util'; +const baseRule = getESLintCoreRule('space-infix-ops'); + export type Options = util.InferOptionsTypeFromRule; export type MessageIds = util.InferMessageIdsTypeFromRule; +const UNIONS = ['|', '&']; + export default util.createRule({ name: 'space-infix-ops', meta: { @@ -15,14 +19,16 @@ export default util.createRule({ docs: { description: 'This rule is aimed at ensuring there are spaces around infix operators.', - category: 'Stylistic Issues', recommended: false, extendsBaseRule: true, }, fixable: baseRule.meta.fixable, + hasSuggestions: baseRule.meta.hasSuggestions, schema: baseRule.meta.schema, - messages: baseRule.meta.messages ?? { + messages: { + // @ts-expect-error -- we report on this messageId so we need to ensure it's there in case ESLint changes in future missingSpace: "Operator '{{operator}}' must be spaced.", + ...baseRule.meta.messages, }, }, defaultOptions: [ @@ -34,20 +40,46 @@ export default util.createRule({ const rules = baseRule.create(context); const sourceCode = context.getSourceCode(); - /** - * Check if it has an assignment char and report if it's faulty - * @param node The node to report - */ - function checkForAssignmentSpace(node: TSESTree.TSEnumMember): void { - if (!node.initializer) { - return; - } + const report = ( + node: TSESTree.Node | TSESTree.Token, + operator: TSESTree.Token, + ): void => { + context.report({ + node: node, + loc: operator.loc, + messageId: 'missingSpace', + data: { + operator: operator.value, + }, + fix(fixer) { + const previousToken = sourceCode.getTokenBefore(operator); + const afterToken = sourceCode.getTokenAfter(operator); + let fixString = ''; - const leftNode = sourceCode.getTokenByRangeStart(node.id.range[0])!; - const rightNode = sourceCode.getTokenByRangeStart( - node.initializer.range[0], - )!; + if (operator.range[0] - previousToken!.range[1] === 0) { + fixString = ' '; + } + + fixString += operator.value; + + if (afterToken!.range[0] - operator.range[1] === 0) { + fixString += ' '; + } + return fixer.replaceText(operator, fixString); + }, + }); + }; + + function isSpaceChar(token: TSESTree.Token): boolean { + return token.type === AST_TOKEN_TYPES.Punctuator && token.value === '='; + } + + function checkAndReportAssignmentSpace( + node: TSESTree.Node, + leftNode: TSESTree.Token, + rightNode?: TSESTree.Token | null, + ): void { if (!rightNode) { return; } @@ -55,48 +87,102 @@ export default util.createRule({ const operator = sourceCode.getFirstTokenBetween( leftNode, rightNode, - token => - token.type === AST_TOKEN_TYPES.Punctuator && token.value === '=', + isSpaceChar, ); + const prev = sourceCode.getTokenBefore(operator!); const next = sourceCode.getTokenAfter(operator!); if ( - operator && - (!sourceCode.isSpaceBetweenTokens(prev!, operator) || - !sourceCode.isSpaceBetweenTokens(operator, next!)) + !sourceCode.isSpaceBetween!(prev!, operator!) || + !sourceCode.isSpaceBetween!(operator!, next!) ) { - context.report({ - node: node, - loc: operator.loc, - messageId: 'missingSpace', - data: { - operator: operator.value, - }, - fix(fixer) { - const previousToken = sourceCode.getTokenBefore(operator); - const afterToken = sourceCode.getTokenAfter(operator); - let fixString = ''; - - if (operator.range[0] - previousToken!.range[1] === 0) { - fixString = ' '; - } - - fixString += operator.value; - - if (afterToken!.range[0] - operator.range[1] === 0) { - fixString += ' '; - } - - return fixer.replaceText(operator, fixString); - }, - }); + report(node, operator!); } } + /** + * Check if it has an assignment char and report if it's faulty + * @param node The node to report + */ + function checkForEnumAssignmentSpace(node: TSESTree.TSEnumMember): void { + if (!node.initializer) { + return; + } + + const leftNode = sourceCode.getTokenByRangeStart(node.id.range[0])!; + const rightNode = sourceCode.getTokenByRangeStart( + node.initializer.range[0], + )!; + + checkAndReportAssignmentSpace(node, leftNode, rightNode); + } + + /** + * Check if it has an assignment char and report if it's faulty + * @param node The node to report + */ + function checkForPropertyDefinitionAssignmentSpace( + node: TSESTree.PropertyDefinition, + ): void { + const leftNode = sourceCode.getTokenByRangeStart( + node.typeAnnotation?.range[0] ?? node.range[0], + )!; + const rightNode = node.value + ? sourceCode.getTokenByRangeStart(node.value.range[0]) + : undefined; + + checkAndReportAssignmentSpace(node, leftNode, rightNode); + } + + /** + * Check if it is missing spaces between type annotations chaining + * @param typeAnnotation TypeAnnotations list + */ + function checkForTypeAnnotationSpace( + typeAnnotation: TSESTree.TSIntersectionType | TSESTree.TSUnionType, + ): void { + const types = typeAnnotation.types; + + types.forEach(type => { + const operator = sourceCode.getTokenBefore(type); + + if (operator != null && UNIONS.includes(operator.value)) { + const prev = sourceCode.getTokenBefore(operator); + const next = sourceCode.getTokenAfter(operator); + + if ( + !sourceCode.isSpaceBetween!(prev!, operator) || + !sourceCode.isSpaceBetween!(operator, next!) + ) { + report(typeAnnotation, operator); + } + } + }); + } + + /** + * Check if it has an assignment char and report if it's faulty + * @param node The node to report + */ + function checkForTypeAliasAssignment( + node: TSESTree.TSTypeAliasDeclaration, + ): void { + const leftNode = sourceCode.getTokenByRangeStart(node.id.range[0])!; + const rightNode = sourceCode.getTokenByRangeStart( + node.typeAnnotation.range[0], + ); + + checkAndReportAssignmentSpace(node, leftNode, rightNode); + } + return { ...rules, - TSEnumMember: checkForAssignmentSpace, + TSEnumMember: checkForEnumAssignmentSpace, + PropertyDefinition: checkForPropertyDefinitionAssignmentSpace, + TSTypeAliasDeclaration: checkForTypeAliasAssignment, + TSUnionType: checkForTypeAnnotationSpace, + TSIntersectionType: checkForTypeAnnotationSpace, }; }, }); diff --git a/packages/eslint-plugin/src/rules/strict-boolean-expressions.ts b/packages/eslint-plugin/src/rules/strict-boolean-expressions.ts index 51265feb1368..88ec00846f30 100644 --- a/packages/eslint-plugin/src/rules/strict-boolean-expressions.ts +++ b/packages/eslint-plugin/src/rules/strict-boolean-expressions.ts @@ -1,9 +1,10 @@ import { - TSESTree, AST_NODE_TYPES, + ParserServices, + TSESTree, } from '@typescript-eslint/experimental-utils'; -import * as ts from 'typescript'; import * as tsutils from 'tsutils'; +import * as ts from 'typescript'; import * as util from '../util'; export type Options = [ @@ -30,15 +31,27 @@ export type MessageId = | 'conditionErrorNullableNumber' | 'conditionErrorObject' | 'conditionErrorNullableObject' - | 'noStrictNullCheck'; + | 'noStrictNullCheck' + | 'conditionFixDefaultFalse' + | 'conditionFixDefaultEmptyString' + | 'conditionFixDefaultZero' + | 'conditionFixCompareNullish' + | 'conditionFixCastBoolean' + | 'conditionFixCompareTrue' + | 'conditionFixCompareFalse' + | 'conditionFixCompareStringLength' + | 'conditionFixCompareEmptyString' + | 'conditionFixCompareZero' + | 'conditionFixCompareNaN'; export default util.createRule({ name: 'strict-boolean-expressions', meta: { type: 'suggestion', + fixable: 'code', + hasSuggestions: true, docs: { description: 'Restricts the types allowed in boolean expressions', - category: 'Best Practices', recommended: false, requiresTypeChecking: true, }, @@ -93,6 +106,29 @@ export default util.createRule({ 'An explicit null check is required.', noStrictNullCheck: 'This rule requires the `strictNullChecks` compiler option to be turned on to function correctly.', + + conditionFixDefaultFalse: + 'Explicitly treat nullish value the same as false (`value ?? false`)', + conditionFixDefaultEmptyString: + 'Explicitly treat nullish value the same as an empty string (`value ?? ""`)', + conditionFixDefaultZero: + 'Explicitly treat nullish value the same as 0 (`value ?? 0`)', + conditionFixCompareNullish: + 'Change condition to check for null/undefined (`value != null`)', + conditionFixCastBoolean: + 'Explicitly cast value to a boolean (`Boolean(value)`)', + conditionFixCompareTrue: + 'Change condition to check if true (`value === true`)', + conditionFixCompareFalse: + 'Change condition to check if false (`value === false`)', + conditionFixCompareStringLength: + "Change condition to check string's length (`value.length !== 0`)", + conditionFixCompareEmptyString: + 'Change condition to check for empty string (`value !== ""`)', + conditionFixCompareZero: + 'Change condition to check for 0 (`value !== 0`)', + conditionFixCompareNaN: + 'Change condition to check for NaN (`!Number.isNaN(value)`)', }, }, defaultOptions: [ @@ -108,9 +144,10 @@ export default util.createRule({ }, ], create(context, [options]) { - const service = util.getParserServices(context); - const checker = service.program.getTypeChecker(); - const compilerOptions = service.program.getCompilerOptions(); + const parserServices = util.getParserServices(context); + const typeChecker = parserServices.program.getTypeChecker(); + const compilerOptions = parserServices.program.getCompilerOptions(); + const sourceCode = context.getSourceCode(); const isStrictNullChecks = tsutils.isStrictCompilerOptionEnabled( compilerOptions, 'strictNullChecks', @@ -187,8 +224,8 @@ export default util.createRule({ return; } - const tsNode = service.esTreeNodeToTSNodeMap.get(node); - const type = util.getConstrainedTypeAtLocation(checker, tsNode); + const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node); + const type = util.getConstrainedTypeAtLocation(typeChecker, tsNode); const types = inspectVariantTypes(tsutils.unionTypeParts(type)); const is = (...wantedTypes: readonly VariantType[]): boolean => @@ -217,15 +254,139 @@ export default util.createRule({ // nullable boolean if (is('nullish', 'boolean')) { if (!options.allowNullableBoolean) { - context.report({ node, messageId: 'conditionErrorNullableBoolean' }); + if (isLogicalNegationExpression(node.parent!)) { + // if (!nullableBoolean) + context.report({ + node, + messageId: 'conditionErrorNullableBoolean', + suggest: [ + { + messageId: 'conditionFixDefaultFalse', + fix: util.getWrappingFixer({ + sourceCode, + node, + wrap: code => `${code} ?? false`, + }), + }, + { + messageId: 'conditionFixCompareFalse', + fix: util.getWrappingFixer({ + sourceCode, + node: node.parent, + innerNode: node, + wrap: code => `${code} === false`, + }), + }, + ], + }); + } else { + // if (nullableBoolean) + context.report({ + node, + messageId: 'conditionErrorNullableBoolean', + suggest: [ + { + messageId: 'conditionFixDefaultFalse', + fix: util.getWrappingFixer({ + sourceCode, + node, + wrap: code => `${code} ?? false`, + }), + }, + { + messageId: 'conditionFixCompareTrue', + fix: util.getWrappingFixer({ + sourceCode, + node, + wrap: code => `${code} === true`, + }), + }, + ], + }); + } } return; } + // Known edge case: truthy primitives and nullish values are always valid boolean expressions + if ( + (options.allowNumber && is('nullish', 'truthy number')) || + (options.allowString && is('nullish', 'truthy string')) + ) { + return; + } + // string - if (is('string')) { + if (is('string') || is('truthy string')) { if (!options.allowString) { - context.report({ node, messageId: 'conditionErrorString' }); + if (isLogicalNegationExpression(node.parent!)) { + // if (!string) + context.report({ + node, + messageId: 'conditionErrorString', + suggest: [ + { + messageId: 'conditionFixCompareStringLength', + fix: util.getWrappingFixer({ + sourceCode, + node: node.parent, + innerNode: node, + wrap: code => `${code}.length === 0`, + }), + }, + { + messageId: 'conditionFixCompareEmptyString', + fix: util.getWrappingFixer({ + sourceCode, + node: node.parent, + innerNode: node, + wrap: code => `${code} === ""`, + }), + }, + { + messageId: 'conditionFixCastBoolean', + fix: util.getWrappingFixer({ + sourceCode, + node: node.parent, + innerNode: node, + wrap: code => `!Boolean(${code})`, + }), + }, + ], + }); + } else { + // if (string) + context.report({ + node, + messageId: 'conditionErrorString', + suggest: [ + { + messageId: 'conditionFixCompareStringLength', + fix: util.getWrappingFixer({ + sourceCode, + node, + wrap: code => `${code}.length > 0`, + }), + }, + { + messageId: 'conditionFixCompareEmptyString', + fix: util.getWrappingFixer({ + sourceCode, + node, + wrap: code => `${code} !== ""`, + }), + }, + { + messageId: 'conditionFixCastBoolean', + fix: util.getWrappingFixer({ + sourceCode, + node, + wrap: code => `Boolean(${code})`, + }), + }, + ], + }); + } } return; } @@ -233,15 +394,175 @@ export default util.createRule({ // nullable string if (is('nullish', 'string')) { if (!options.allowNullableString) { - context.report({ node, messageId: 'conditionErrorNullableString' }); + if (isLogicalNegationExpression(node.parent!)) { + // if (!nullableString) + context.report({ + node, + messageId: 'conditionErrorNullableString', + suggest: [ + { + messageId: 'conditionFixCompareNullish', + fix: util.getWrappingFixer({ + sourceCode, + node: node.parent, + innerNode: node, + wrap: code => `${code} == null`, + }), + }, + { + messageId: 'conditionFixDefaultEmptyString', + fix: util.getWrappingFixer({ + sourceCode, + node, + wrap: code => `${code} ?? ""`, + }), + }, + { + messageId: 'conditionFixCastBoolean', + fix: util.getWrappingFixer({ + sourceCode, + node: node.parent, + innerNode: node, + wrap: code => `!Boolean(${code})`, + }), + }, + ], + }); + } else { + // if (nullableString) + context.report({ + node, + messageId: 'conditionErrorNullableString', + suggest: [ + { + messageId: 'conditionFixCompareNullish', + fix: util.getWrappingFixer({ + sourceCode, + node, + wrap: code => `${code} != null`, + }), + }, + { + messageId: 'conditionFixDefaultEmptyString', + fix: util.getWrappingFixer({ + sourceCode, + node, + wrap: code => `${code} ?? ""`, + }), + }, + { + messageId: 'conditionFixCastBoolean', + fix: util.getWrappingFixer({ + sourceCode, + node, + wrap: code => `Boolean(${code})`, + }), + }, + ], + }); + } } return; } // number - if (is('number')) { + if (is('number') || is('truthy number')) { if (!options.allowNumber) { - context.report({ node, messageId: 'conditionErrorNumber' }); + if (isArrayLengthExpression(node, typeChecker, parserServices)) { + if (isLogicalNegationExpression(node.parent!)) { + // if (!array.length) + context.report({ + node, + messageId: 'conditionErrorNumber', + fix: util.getWrappingFixer({ + sourceCode, + node: node.parent, + innerNode: node, + wrap: code => `${code} === 0`, + }), + }); + } else { + // if (array.length) + context.report({ + node, + messageId: 'conditionErrorNumber', + fix: util.getWrappingFixer({ + sourceCode, + node, + wrap: code => `${code} > 0`, + }), + }); + } + } else if (isLogicalNegationExpression(node.parent!)) { + // if (!number) + context.report({ + node, + messageId: 'conditionErrorNumber', + suggest: [ + { + messageId: 'conditionFixCompareZero', + fix: util.getWrappingFixer({ + sourceCode, + node: node.parent, + innerNode: node, + // TODO: we have to compare to 0n if the type is bigint + wrap: code => `${code} === 0`, + }), + }, + { + // TODO: don't suggest this for bigint because it can't be NaN + messageId: 'conditionFixCompareNaN', + fix: util.getWrappingFixer({ + sourceCode, + node: node.parent, + innerNode: node, + wrap: code => `Number.isNaN(${code})`, + }), + }, + { + messageId: 'conditionFixCastBoolean', + fix: util.getWrappingFixer({ + sourceCode, + node: node.parent, + innerNode: node, + wrap: code => `!Boolean(${code})`, + }), + }, + ], + }); + } else { + // if (number) + context.report({ + node, + messageId: 'conditionErrorNumber', + suggest: [ + { + messageId: 'conditionFixCompareZero', + fix: util.getWrappingFixer({ + sourceCode, + node, + wrap: code => `${code} !== 0`, + }), + }, + { + messageId: 'conditionFixCompareNaN', + fix: util.getWrappingFixer({ + sourceCode, + node, + wrap: code => `!Number.isNaN(${code})`, + }), + }, + { + messageId: 'conditionFixCastBoolean', + fix: util.getWrappingFixer({ + sourceCode, + node, + wrap: code => `Boolean(${code})`, + }), + }, + ], + }); + } } return; } @@ -249,7 +570,73 @@ export default util.createRule({ // nullable number if (is('nullish', 'number')) { if (!options.allowNullableNumber) { - context.report({ node, messageId: 'conditionErrorNullableNumber' }); + if (isLogicalNegationExpression(node.parent!)) { + // if (!nullableNumber) + context.report({ + node, + messageId: 'conditionErrorNullableNumber', + suggest: [ + { + messageId: 'conditionFixCompareNullish', + fix: util.getWrappingFixer({ + sourceCode, + node: node.parent, + innerNode: node, + wrap: code => `${code} == null`, + }), + }, + { + messageId: 'conditionFixDefaultZero', + fix: util.getWrappingFixer({ + sourceCode, + node, + wrap: code => `${code} ?? 0`, + }), + }, + { + messageId: 'conditionFixCastBoolean', + fix: util.getWrappingFixer({ + sourceCode, + node: node.parent, + innerNode: node, + wrap: code => `!Boolean(${code})`, + }), + }, + ], + }); + } else { + // if (nullableNumber) + context.report({ + node, + messageId: 'conditionErrorNullableNumber', + suggest: [ + { + messageId: 'conditionFixCompareNullish', + fix: util.getWrappingFixer({ + sourceCode, + node, + wrap: code => `${code} != null`, + }), + }, + { + messageId: 'conditionFixDefaultZero', + fix: util.getWrappingFixer({ + sourceCode, + node, + wrap: code => `${code} ?? 0`, + }), + }, + { + messageId: 'conditionFixCastBoolean', + fix: util.getWrappingFixer({ + sourceCode, + node, + wrap: code => `Boolean(${code})`, + }), + }, + ], + }); + } } return; } @@ -264,7 +651,30 @@ export default util.createRule({ // nullable object if (is('nullish', 'object')) { if (!options.allowNullableObject) { - context.report({ node, messageId: 'conditionErrorNullableObject' }); + if (isLogicalNegationExpression(node.parent!)) { + // if (!nullableObject) + context.report({ + node, + messageId: 'conditionErrorNullableObject', + fix: util.getWrappingFixer({ + sourceCode, + node: node.parent, + innerNode: node, + wrap: code => `${code} == null`, + }), + }); + } else { + // if (nullableObject) + context.report({ + node, + messageId: 'conditionErrorNullableObject', + fix: util.getWrappingFixer({ + sourceCode, + node, + wrap: code => `${code} != null`, + }), + }); + } } return; } @@ -272,7 +682,20 @@ export default util.createRule({ // any if (is('any')) { if (!options.allowAny) { - context.report({ node, messageId: 'conditionErrorAny' }); + context.report({ + node, + messageId: 'conditionErrorAny', + suggest: [ + { + messageId: 'conditionFixCastBoolean', + fix: util.getWrappingFixer({ + sourceCode, + node, + wrap: code => `Boolean(${code})`, + }), + }, + ], + }); } return; } @@ -286,7 +709,9 @@ export default util.createRule({ | 'nullish' | 'boolean' | 'string' + | 'truthy string' | 'number' + | 'truthy number' | 'object' | 'any' | 'never'; @@ -316,21 +741,30 @@ export default util.createRule({ variantTypes.add('boolean'); } - if ( - types.some(type => tsutils.isTypeFlagSet(type, ts.TypeFlags.StringLike)) - ) { - variantTypes.add('string'); + const strings = types.filter(type => + tsutils.isTypeFlagSet(type, ts.TypeFlags.StringLike), + ); + + if (strings.length) { + if (strings.some(type => type.isStringLiteral() && type.value !== '')) { + variantTypes.add('truthy string'); + } else { + variantTypes.add('string'); + } } - if ( - types.some(type => - tsutils.isTypeFlagSet( - type, - ts.TypeFlags.NumberLike | ts.TypeFlags.BigIntLike, - ), - ) - ) { - variantTypes.add('number'); + const numbers = types.filter(type => + tsutils.isTypeFlagSet( + type, + ts.TypeFlags.NumberLike | ts.TypeFlags.BigIntLike, + ), + ); + if (numbers.length) { + if (numbers.some(type => type.isNumberLiteral() && type.value !== 0)) { + variantTypes.add('truthy number'); + } else { + variantTypes.add('number'); + } } if ( @@ -345,6 +779,7 @@ export default util.createRule({ ts.TypeFlags.StringLike | ts.TypeFlags.NumberLike | ts.TypeFlags.BigIntLike | + ts.TypeFlags.TypeParameter | ts.TypeFlags.Any | ts.TypeFlags.Unknown | ts.TypeFlags.Never, @@ -355,8 +790,13 @@ export default util.createRule({ } if ( - types.some( - type => util.isTypeAnyType(type) || util.isTypeUnknownType(type), + types.some(type => + util.isTypeFlagSet( + type, + ts.TypeFlags.TypeParameter | + ts.TypeFlags.Any | + ts.TypeFlags.Unknown, + ), ) ) { variantTypes.add('any'); @@ -370,3 +810,31 @@ export default util.createRule({ } }, }); + +function isLogicalNegationExpression( + node: TSESTree.Node, +): node is TSESTree.UnaryExpression { + return node.type === AST_NODE_TYPES.UnaryExpression && node.operator === '!'; +} + +function isArrayLengthExpression( + node: TSESTree.Node, + typeChecker: ts.TypeChecker, + parserServices: ParserServices, +): node is TSESTree.MemberExpressionNonComputedName { + if (node.type !== AST_NODE_TYPES.MemberExpression) { + return false; + } + if (node.computed) { + return false; + } + if (node.property.name !== 'length') { + return false; + } + const objectTsNode = parserServices.esTreeNodeToTSNodeMap.get(node.object); + const objectType = util.getConstrainedTypeAtLocation( + typeChecker, + objectTsNode, + ); + 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 8881473da051..08f21e3364ca 100644 --- a/packages/eslint-plugin/src/rules/switch-exhaustiveness-check.ts +++ b/packages/eslint-plugin/src/rules/switch-exhaustiveness-check.ts @@ -16,11 +16,11 @@ export default createRule({ type: 'suggestion', docs: { description: 'Exhaustiveness checking in switch with union type', - category: 'Best Practices', recommended: false, suggestion: true, requiresTypeChecking: true, }, + hasSuggestions: true, schema: [], messages: { switchIsNotExhaustive: @@ -144,7 +144,7 @@ export default createRule({ missingBranches: missingBranchTypes .map(missingType => isTypeFlagSet(missingType, ts.TypeFlags.ESSymbolLike) - ? `typeof ${missingType.getSymbol()?.escapedName}` + ? `typeof ${missingType.getSymbol()?.escapedName as string}` : checker.typeToString(missingType), ) .join(' | '), diff --git a/packages/eslint-plugin/src/rules/triple-slash-reference.ts b/packages/eslint-plugin/src/rules/triple-slash-reference.ts index 08c3ad6291b2..ba8bce5ae8a7 100644 --- a/packages/eslint-plugin/src/rules/triple-slash-reference.ts +++ b/packages/eslint-plugin/src/rules/triple-slash-reference.ts @@ -21,7 +21,6 @@ export default util.createRule({ docs: { description: 'Sets preference level for triple slash directives versus ES6-style import declarations', - category: 'Best Practices', recommended: 'error', }, messages: { @@ -94,7 +93,8 @@ export default util.createRule({ return; } programNode = node; - const referenceRegExp = /^\/\s* { diff --git a/packages/eslint-plugin/src/rules/type-annotation-spacing.ts b/packages/eslint-plugin/src/rules/type-annotation-spacing.ts index 985e008c16d2..d02b8777d5ff 100644 --- a/packages/eslint-plugin/src/rules/type-annotation-spacing.ts +++ b/packages/eslint-plugin/src/rules/type-annotation-spacing.ts @@ -35,7 +35,8 @@ type MessageIds = | 'expectedSpaceAfter' | 'expectedSpaceBefore' | 'unexpectedSpaceAfter' - | 'unexpectedSpaceBefore'; + | 'unexpectedSpaceBefore' + | 'unexpectedSpaceBetween'; const definition = { type: 'object', @@ -113,7 +114,6 @@ export default util.createRule({ type: 'layout', docs: { description: 'Require consistent spacing around type annotations', - category: 'Stylistic Issues', recommended: false, }, fixable: 'whitespace', @@ -122,6 +122,8 @@ export default util.createRule({ expectedSpaceBefore: "Expected a space before the '{{type}}'.", unexpectedSpaceAfter: "Unexpected space after the '{{type}}'.", unexpectedSpaceBefore: "Unexpected space before the '{{type}}'.", + unexpectedSpaceBetween: + "Unexpected space between the '{{previousToken}}' and the '{{type}}'.", }, schema: [ { @@ -177,6 +179,25 @@ export default util.createRule({ const { before, after } = getRules(ruleSet, typeAnnotation); if (type === ':' && previousToken.value === '?') { + if ( + sourceCode.isSpaceBetweenTokens(previousToken, punctuatorTokenStart) + ) { + context.report({ + node: punctuatorTokenStart, + messageId: 'unexpectedSpaceBetween', + data: { + type, + previousToken: previousToken.value, + }, + fix(fixer) { + return fixer.removeRange([ + previousToken.range[1], + punctuatorTokenStart.range[0], + ]); + }, + }); + } + // shift the start to the ? type = '?:'; punctuatorTokenStart = previousToken; diff --git a/packages/eslint-plugin/src/rules/typedef.ts b/packages/eslint-plugin/src/rules/typedef.ts index 766401040224..700fd347c778 100644 --- a/packages/eslint-plugin/src/rules/typedef.ts +++ b/packages/eslint-plugin/src/rules/typedef.ts @@ -1,6 +1,6 @@ import { - TSESTree, AST_NODE_TYPES, + TSESTree, } from '@typescript-eslint/experimental-utils'; import * as util from '../util'; @@ -24,7 +24,6 @@ export default util.createRule<[Options], MessageIds>({ meta: { docs: { description: 'Requires type annotations to exist', - category: 'Stylistic Issues', recommended: false, }, messages: { @@ -60,7 +59,21 @@ export default util.createRule<[Options], MessageIds>({ [OptionKeys.VariableDeclarationIgnoreFunction]: false, }, ], - create(context, [options]) { + create( + context, + [ + { + arrayDestructuring, + arrowParameter, + memberVariableDeclaration, + objectDestructuring, + parameter, + propertyDeclaration, + variableDeclaration, + variableDeclarationIgnoreFunction, + }, + ], + ) { function report(location: TSESTree.Node, name?: string): void { context.report({ node: location, @@ -133,86 +146,83 @@ export default util.createRule<[Options], MessageIds>({ function isVariableDeclarationIgnoreFunction(node: TSESTree.Node): boolean { return ( - !!options[OptionKeys.VariableDeclarationIgnoreFunction] && - (node.type === AST_NODE_TYPES.FunctionExpression || - node.type === AST_NODE_TYPES.ArrowFunctionExpression) + variableDeclarationIgnoreFunction === true && + (node.type === AST_NODE_TYPES.ArrowFunctionExpression || + node.type === AST_NODE_TYPES.FunctionExpression) ); } return { - ArrayPattern(node): void { - if ( - node.parent?.type === AST_NODE_TYPES.RestElement && - node.parent.typeAnnotation - ) { - return; - } - if ( - options[OptionKeys.ArrayDestructuring] && - !node.typeAnnotation && - !isForOfStatementContext(node) - ) { - report(node); - } - }, - ArrowFunctionExpression(node): void { - if (options[OptionKeys.ArrowParameter]) { - checkParameters(node.params); - } - }, - ClassProperty(node): void { - if (node.value && isVariableDeclarationIgnoreFunction(node.value)) { - return; - } + ...(arrayDestructuring && { + ArrayPattern(node): void { + if ( + node.parent?.type === AST_NODE_TYPES.RestElement && + node.parent.typeAnnotation + ) { + return; + } - if ( - options[OptionKeys.MemberVariableDeclaration] && - !node.typeAnnotation - ) { - report( - node, - node.key.type === AST_NODE_TYPES.Identifier - ? node.key.name - : undefined, - ); - } - }, - 'FunctionDeclaration, FunctionExpression'( - node: TSESTree.FunctionDeclaration | TSESTree.FunctionExpression, - ): void { - if (options[OptionKeys.Parameter]) { + if (!node.typeAnnotation && !isForOfStatementContext(node)) { + report(node); + } + }, + }), + ...(arrowParameter && { + ArrowFunctionExpression(node): void { checkParameters(node.params); - } - }, - ObjectPattern(node): void { - if ( - options[OptionKeys.ObjectDestructuring] && - !node.typeAnnotation && - !isForOfStatementContext(node) - ) { - report(node); - } - }, - 'TSIndexSignature, TSPropertySignature'( - node: TSESTree.TSIndexSignature | TSESTree.TSPropertySignature, - ): void { - if (options[OptionKeys.PropertyDeclaration] && !node.typeAnnotation) { - report( - node, - node.type === AST_NODE_TYPES.TSPropertySignature - ? getNodeName(node.key) - : undefined, - ); - } - }, + }, + }), + ...(memberVariableDeclaration && { + PropertyDefinition(node): void { + if ( + !(node.value && isVariableDeclarationIgnoreFunction(node.value)) && + !node.typeAnnotation + ) { + report( + node, + node.key.type === AST_NODE_TYPES.Identifier + ? node.key.name + : undefined, + ); + } + }, + }), + ...(parameter && { + 'FunctionDeclaration, FunctionExpression'( + node: TSESTree.FunctionDeclaration | TSESTree.FunctionExpression, + ): void { + checkParameters(node.params); + }, + }), + ...(objectDestructuring && { + ObjectPattern(node): void { + if (!node.typeAnnotation && !isForOfStatementContext(node)) { + report(node); + } + }, + }), + ...(propertyDeclaration && { + 'TSIndexSignature, TSPropertySignature'( + node: TSESTree.TSIndexSignature | TSESTree.TSPropertySignature, + ): void { + if (!node.typeAnnotation) { + report( + node, + node.type === AST_NODE_TYPES.TSPropertySignature + ? getNodeName(node.key) + : undefined, + ); + } + }, + }), VariableDeclarator(node): void { if ( - !options[OptionKeys.VariableDeclaration] || + !variableDeclaration || node.id.typeAnnotation || (node.id.type === AST_NODE_TYPES.ArrayPattern && - !options[OptionKeys.ArrayDestructuring]) || + !arrayDestructuring) || (node.id.type === AST_NODE_TYPES.ObjectPattern && - !options[OptionKeys.ObjectDestructuring]) || + !objectDestructuring) || (node.init && isVariableDeclarationIgnoreFunction(node.init)) ) { return; diff --git a/packages/eslint-plugin/src/rules/unbound-method.ts b/packages/eslint-plugin/src/rules/unbound-method.ts index 2ec66bc2aa33..15ddf8b89109 100644 --- a/packages/eslint-plugin/src/rules/unbound-method.ts +++ b/packages/eslint-plugin/src/rules/unbound-method.ts @@ -16,7 +16,7 @@ interface Config { export type Options = [Config]; -export type MessageIds = 'unbound'; +export type MessageIds = 'unbound' | 'unboundWithoutThisAnnotation'; /** * The following is a list of exceptions to the rule @@ -121,19 +121,24 @@ const getNodeName = (node: TSESTree.Node): string | null => const getMemberFullName = (node: TSESTree.MemberExpression): string => `${getNodeName(node.object)}.${getNodeName(node.property)}`; +const BASE_MESSAGE = + 'Avoid referencing unbound methods which may cause unintentional scoping of `this`.'; + export default util.createRule({ name: 'unbound-method', meta: { docs: { - category: 'Best Practices', description: 'Enforces unbound methods are called with their expected scope', recommended: 'error', requiresTypeChecking: true, }, messages: { - unbound: - 'Avoid referencing unbound methods which may cause unintentional scoping of `this`.', + unbound: BASE_MESSAGE, + unboundWithoutThisAnnotation: + BASE_MESSAGE + + '\n' + + 'If your function does not access `this`, you can annotate it with `this: void`, or consider using an arrow function instead.', }, schema: [ { @@ -160,6 +165,26 @@ export default util.createRule({ context.getFilename(), ); + function checkMethodAndReport( + node: TSESTree.Node, + symbol: ts.Symbol | undefined, + ): void { + if (!symbol) { + return; + } + + const { dangerous, firstParamIsThis } = checkMethod(symbol, ignoreStatic); + if (dangerous) { + context.report({ + messageId: + firstParamIsThis === false + ? 'unboundWithoutThisAnnotation' + : 'unbound', + node, + }); + } + } + return { MemberExpression(node: TSESTree.MemberExpression): void { if (isSafeUse(node)) { @@ -179,14 +204,8 @@ export default util.createRule({ } const originalNode = parserServices.esTreeNodeToTSNodeMap.get(node); - const symbol = checker.getSymbolAtLocation(originalNode); - if (symbol && isDangerousMethod(symbol, ignoreStatic)) { - context.report({ - messageId: 'unbound', - node, - }); - } + checkMethodAndReport(node, checker.getSymbolAtLocation(originalNode)); }, 'VariableDeclarator, AssignmentExpression'( node: TSESTree.VariableDeclarator | TSESTree.AssignmentExpression, @@ -219,13 +238,10 @@ export default util.createRule({ return; } - const symbol = initTypes.getProperty(property.key.name); - if (symbol && isDangerousMethod(symbol, ignoreStatic)) { - context.report({ - messageId: 'unbound', - node, - }); - } + checkMethodAndReport( + node, + initTypes.getProperty(property.key.name), + ); } }); } @@ -234,44 +250,52 @@ export default util.createRule({ }, }); -function isDangerousMethod(symbol: ts.Symbol, ignoreStatic: boolean): boolean { +function checkMethod( + symbol: ts.Symbol, + ignoreStatic: boolean, +): { dangerous: boolean; firstParamIsThis?: boolean } { const { valueDeclaration } = symbol; if (!valueDeclaration) { // working around https://github.com/microsoft/TypeScript/issues/31294 - return false; + return { dangerous: false }; } switch (valueDeclaration.kind) { case ts.SyntaxKind.PropertyDeclaration: - return ( - (valueDeclaration as ts.PropertyDeclaration).initializer?.kind === - ts.SyntaxKind.FunctionExpression - ); + return { + dangerous: + (valueDeclaration as ts.PropertyDeclaration).initializer?.kind === + ts.SyntaxKind.FunctionExpression, + }; case ts.SyntaxKind.MethodDeclaration: case ts.SyntaxKind.MethodSignature: { const decl = valueDeclaration as | ts.MethodDeclaration | ts.MethodSignature; const firstParam = decl.parameters[0]; - const thisArgIsVoid = + const firstParamIsThis = firstParam?.name.kind === ts.SyntaxKind.Identifier && - firstParam?.name.escapedText === 'this' && + firstParam?.name.escapedText === 'this'; + const thisArgIsVoid = + firstParamIsThis && firstParam?.type?.kind === ts.SyntaxKind.VoidKeyword; - return ( - !thisArgIsVoid && - !( - ignoreStatic && - tsutils.hasModifier( - valueDeclaration.modifiers, - ts.SyntaxKind.StaticKeyword, - ) - ) - ); + return { + dangerous: + !thisArgIsVoid && + !( + ignoreStatic && + tsutils.hasModifier( + valueDeclaration.modifiers, + ts.SyntaxKind.StaticKeyword, + ) + ), + firstParamIsThis, + }; } } - return false; + return { dangerous: false }; } function isSafeUse(node: TSESTree.Node): boolean { diff --git a/packages/eslint-plugin/src/rules/unified-signatures.ts b/packages/eslint-plugin/src/rules/unified-signatures.ts index e90490427c6c..7481dcd70312 100644 --- a/packages/eslint-plugin/src/rules/unified-signatures.ts +++ b/packages/eslint-plugin/src/rules/unified-signatures.ts @@ -57,7 +57,6 @@ export default util.createRule({ docs: { description: 'Warns for any two overloads that could be unified into one by using a union or an optional/rest parameter', - category: 'Variables', // too opinionated to be recommended recommended: false, }, @@ -471,7 +470,7 @@ export default util.createRule({ const scopes: Scope[] = []; let currentScope: Scope = { - overloads: new Map(), + overloads: new Map(), }; function createScope( @@ -480,7 +479,7 @@ export default util.createRule({ ): void { currentScope && scopes.push(currentScope); currentScope = { - overloads: new Map(), + overloads: new Map(), parent, typeParameters, }; diff --git a/packages/eslint-plugin/src/util/astUtils.ts b/packages/eslint-plugin/src/util/astUtils.ts index 53ad3f116e60..67bdfca5aa19 100644 --- a/packages/eslint-plugin/src/util/astUtils.ts +++ b/packages/eslint-plugin/src/util/astUtils.ts @@ -1,5 +1,6 @@ import type { TSESLint, TSESTree } from '@typescript-eslint/experimental-utils'; -import escapeRegExp from 'lodash/escapeRegExp'; +import { escapeRegExp } from './escapeRegExp'; +import * as ts from 'typescript'; // deeply re-export, for convenience export * from '@typescript-eslint/experimental-utils/dist/ast-utils'; @@ -41,3 +42,38 @@ export function getNameLocationInGlobalDirectiveComment( return { start, end }; } + +// Copied from typescript https://github.com/microsoft/TypeScript/blob/42b0e3c4630c129ca39ce0df9fff5f0d1b4dd348/src/compiler/utilities.ts#L1335 +// Warning: This has the same semantics as the forEach family of functions, +// in that traversal terminates in the event that 'visitor' supplies a truthy value. +export function forEachReturnStatement( + body: ts.Block, + visitor: (stmt: ts.ReturnStatement) => T, +): T | undefined { + return traverse(body); + + function traverse(node: ts.Node): T | undefined { + switch (node.kind) { + case ts.SyntaxKind.ReturnStatement: + return visitor(node); + case ts.SyntaxKind.CaseBlock: + case ts.SyntaxKind.Block: + case ts.SyntaxKind.IfStatement: + case ts.SyntaxKind.DoStatement: + case ts.SyntaxKind.WhileStatement: + case ts.SyntaxKind.ForStatement: + case ts.SyntaxKind.ForInStatement: + case ts.SyntaxKind.ForOfStatement: + case ts.SyntaxKind.WithStatement: + case ts.SyntaxKind.SwitchStatement: + case ts.SyntaxKind.CaseClause: + case ts.SyntaxKind.DefaultClause: + case ts.SyntaxKind.LabeledStatement: + case ts.SyntaxKind.TryStatement: + case ts.SyntaxKind.CatchClause: + return ts.forEachChild(node, traverse); + } + + return undefined; + } +} diff --git a/packages/eslint-plugin/src/util/collectUnusedVariables.ts b/packages/eslint-plugin/src/util/collectUnusedVariables.ts index 19aaf33565ff..a1cfac27232f 100644 --- a/packages/eslint-plugin/src/util/collectUnusedVariables.ts +++ b/packages/eslint-plugin/src/util/collectUnusedVariables.ts @@ -9,7 +9,7 @@ import * as util from '.'; class UnusedVarsVisitor< TMessageIds extends string, - TOptions extends readonly unknown[] + TOptions extends readonly unknown[], > extends Visitor { private static readonly RESULTS_CACHE = new WeakMap< TSESTree.Program, @@ -32,7 +32,7 @@ class UnusedVarsVisitor< public static collectUnusedVariables< TMessageIds extends string, - TOptions extends readonly unknown[] + TOptions extends readonly unknown[], >( context: TSESLint.RuleContext, ): ReadonlySet { @@ -318,7 +318,7 @@ class UnusedVarsVisitor< protected TSMethodSignature = this.visitFunctionTypeSignature; protected TSModuleDeclaration(node: TSESTree.TSModuleDeclaration): void { - // global augmentation can be in any file, and they do not need exports + // -- global augmentation can be in any file, and they do not need exports if (node.global === true) { this.markVariableAsUsed('global', node.parent!); } @@ -747,7 +747,7 @@ function isUsedVariable(variable: TSESLint.Scope.Variable): boolean { */ function collectUnusedVariables< TMessageIds extends string, - TOptions extends readonly unknown[] + TOptions extends readonly unknown[], >( context: Readonly>, ): ReadonlySet { diff --git a/packages/eslint-plugin/src/util/createRule.ts b/packages/eslint-plugin/src/util/createRule.ts index 5982f04c3d5c..8e69adb95659 100644 --- a/packages/eslint-plugin/src/util/createRule.ts +++ b/packages/eslint-plugin/src/util/createRule.ts @@ -1,7 +1,8 @@ import { ESLintUtils } from '@typescript-eslint/experimental-utils'; // note - cannot migrate this to an import statement because it will make TSC copy the package.json to the dist folder -const version = require('../../package.json').version; +// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access +const version: string = require('../../package.json').version; export const createRule = ESLintUtils.RuleCreator( name => diff --git a/packages/eslint-plugin/src/util/escapeRegExp.ts b/packages/eslint-plugin/src/util/escapeRegExp.ts new file mode 100644 index 000000000000..52d161b3b207 --- /dev/null +++ b/packages/eslint-plugin/src/util/escapeRegExp.ts @@ -0,0 +1,12 @@ +/** + * Lodash + * Released under MIT license + */ +const reRegExpChar = /[\\^$.*+?()[\]{}|]/g; +const reHasRegExpChar = RegExp(reRegExpChar.source); + +export function escapeRegExp(string = ''): string { + return string && reHasRegExpChar.test(string) + ? string.replace(reRegExpChar, '\\$&') + : string; +} diff --git a/packages/eslint-plugin/src/util/explicitReturnTypeUtils.ts b/packages/eslint-plugin/src/util/explicitReturnTypeUtils.ts index cd2f0b11826b..fd512749dfb0 100644 --- a/packages/eslint-plugin/src/util/explicitReturnTypeUtils.ts +++ b/packages/eslint-plugin/src/util/explicitReturnTypeUtils.ts @@ -32,10 +32,12 @@ function isVariableDeclaratorWithTypeAnnotation( * public x: Foo = ... * ``` */ -function isClassPropertyWithTypeAnnotation( +function isPropertyDefinitionWithTypeAnnotation( node: TSESTree.Node, -): node is TSESTree.ClassProperty { - return node.type === AST_NODE_TYPES.ClassProperty && !!node.typeAnnotation; +): node is TSESTree.PropertyDefinition { + return ( + node.type === AST_NODE_TYPES.PropertyDefinition && !!node.typeAnnotation + ); } /** @@ -52,11 +54,12 @@ function isConstructorArgument( } /** - * Checks if a node belongs to: + * Checks if a node is a property or a nested property of a typed object: * ``` * const x: Foo = { prop: () => {} } * const x = { prop: () => {} } as Foo * const x = { prop: () => {} } + * const x: Foo = { bar: { prop: () => {} } } * ``` */ function isPropertyOfObjectWithType( @@ -80,9 +83,10 @@ function isPropertyOfObjectWithType( return ( isTypeAssertion(parent) || - isClassPropertyWithTypeAnnotation(parent) || + isPropertyDefinitionWithTypeAnnotation(parent) || isVariableDeclaratorWithTypeAnnotation(parent) || - isFunctionArgument(parent) + isFunctionArgument(parent) || + isPropertyOfObjectWithType(parent) ); } @@ -192,7 +196,7 @@ function isTypedFunctionExpression( return ( isTypeAssertion(parent) || isVariableDeclaratorWithTypeAnnotation(parent) || - isClassPropertyWithTypeAnnotation(parent) || + isPropertyDefinitionWithTypeAnnotation(parent) || isPropertyOfObjectWithType(parent) || isFunctionArgument(parent, node) || isConstructorArgument(parent) @@ -217,21 +221,17 @@ function isValidFunctionExpressionReturnType( parent.type !== AST_NODE_TYPES.VariableDeclarator && parent.type !== AST_NODE_TYPES.MethodDefinition && parent.type !== AST_NODE_TYPES.ExportDefaultDeclaration && - parent.type !== AST_NODE_TYPES.ClassProperty + parent.type !== AST_NODE_TYPES.PropertyDefinition ) { return true; } // https://github.com/typescript-eslint/typescript-eslint/issues/653 - if ( - options.allowDirectConstAssertionInArrowFunctions && + return ( + options.allowDirectConstAssertionInArrowFunctions === true && node.type === AST_NODE_TYPES.ArrowFunctionExpression && returnsConstAssertionDirectly(node) - ) { - return true; - } - - return false; + ); } /** @@ -248,11 +248,11 @@ function isValidFunctionReturnType( return true; } - if (node.returnType || isConstructor(node.parent) || isSetter(node.parent)) { - return true; - } - - return false; + return ( + node.returnType != null || + isConstructor(node.parent) || + isSetter(node.parent) + ); } /** diff --git a/packages/eslint-plugin/src/util/getESLintCoreRule.ts b/packages/eslint-plugin/src/util/getESLintCoreRule.ts new file mode 100644 index 000000000000..1701b4ef1d76 --- /dev/null +++ b/packages/eslint-plugin/src/util/getESLintCoreRule.ts @@ -0,0 +1,63 @@ +import { version } from 'eslint/package.json'; +import * as semver from 'semver'; +import { nullThrows } from './nullThrows'; + +const isESLintV8 = semver.major(version) >= 8; + +interface RuleMap { + 'arrow-parens': typeof import('eslint/lib/rules/arrow-parens'); + 'brace-style': typeof import('eslint/lib/rules/brace-style'); + 'comma-dangle': typeof import('eslint/lib/rules/comma-dangle'); + 'dot-notation': typeof import('eslint/lib/rules/dot-notation'); + indent: typeof import('eslint/lib/rules/indent'); + 'init-declarations': typeof import('eslint/lib/rules/init-declarations'); + 'keyword-spacing': typeof import('eslint/lib/rules/keyword-spacing'); + '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'); + 'no-implicit-globals': typeof import('eslint/lib/rules/no-implicit-globals'); + 'no-invalid-this': typeof import('eslint/lib/rules/no-invalid-this'); + 'no-loop-func': typeof import('eslint/lib/rules/no-loop-func'); + 'no-loss-of-precision': typeof import('eslint/lib/rules/no-loss-of-precision'); + 'no-magic-numbers': typeof import('eslint/lib/rules/no-magic-numbers'); + 'no-restricted-imports': typeof import('eslint/lib/rules/no-restricted-imports'); + 'no-undef': typeof import('eslint/lib/rules/no-undef'); + 'no-unused-expressions': typeof import('eslint/lib/rules/no-unused-expressions'); + 'no-useless-constructor': typeof import('eslint/lib/rules/no-useless-constructor'); + 'no-restricted-globals': typeof import('eslint/lib/rules/no-restricted-globals'); + 'object-curly-spacing': typeof import('eslint/lib/rules/object-curly-spacing'); + 'prefer-const': typeof import('eslint/lib/rules/prefer-const'); + quotes: typeof import('eslint/lib/rules/quotes'); + semi: typeof import('eslint/lib/rules/semi'); + 'space-infix-ops': typeof import('eslint/lib/rules/space-infix-ops'); + strict: typeof import('eslint/lib/rules/strict'); +} + +type RuleId = keyof RuleMap; + +export const getESLintCoreRule: (ruleId: R) => RuleMap[R] = + isESLintV8 + ? (ruleId: R): RuleMap[R] => + nullThrows( + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call + require('eslint/use-at-your-own-risk').builtinRules.get( + ruleId, + ) as RuleMap[R], + `ESLint's core rule '${ruleId}' not found.`, + ) + : (ruleId: R): RuleMap[R] => + require(`eslint/lib/rules/${ruleId}`) as RuleMap[R]; + +export function maybeGetESLintCoreRule( + ruleId: R, +): RuleMap[R] | null { + try { + return getESLintCoreRule(ruleId); + } catch { + return null; + } +} diff --git a/packages/eslint-plugin/src/util/getFunctionHeadLoc.ts b/packages/eslint-plugin/src/util/getFunctionHeadLoc.ts index dc18a832f948..7604a8d496fc 100644 --- a/packages/eslint-plugin/src/util/getFunctionHeadLoc.ts +++ b/packages/eslint-plugin/src/util/getFunctionHeadLoc.ts @@ -31,7 +31,7 @@ export function getFunctionHeadLoc( node: FunctionNode, sourceCode: TSESLint.SourceCode, ): TSESTree.SourceLocation { - function getLocStart(): TSESTree.LineAndColumnData { + function getLocStart(): TSESTree.Position { if (node.parent && node.parent.type === AST_NODE_TYPES.MethodDefinition) { // return the start location for class method @@ -58,7 +58,7 @@ export function getFunctionHeadLoc( return node.loc.start; } - function getLocEnd(): TSESTree.LineAndColumnData { + function getLocEnd(): TSESTree.Position { if (node.type === AST_NODE_TYPES.ArrowFunctionExpression) { // find the end location for arrow function expression return sourceCode.getTokenBefore( diff --git a/packages/eslint-plugin/src/util/getThisExpression.ts b/packages/eslint-plugin/src/util/getThisExpression.ts new file mode 100644 index 000000000000..5e2772aebaec --- /dev/null +++ b/packages/eslint-plugin/src/util/getThisExpression.ts @@ -0,0 +1,24 @@ +import { + AST_NODE_TYPES, + TSESTree, +} from '@typescript-eslint/experimental-utils'; + +export function getThisExpression( + node: TSESTree.Node, +): TSESTree.ThisExpression | undefined { + while (node) { + if (node.type === AST_NODE_TYPES.CallExpression) { + node = node.callee; + } else if (node.type === AST_NODE_TYPES.ThisExpression) { + return node; + } else if (node.type === AST_NODE_TYPES.MemberExpression) { + node = node.object; + } else if (node.type === AST_NODE_TYPES.ChainExpression) { + node = node.expression; + } else { + break; + } + } + + return; +} diff --git a/packages/eslint-plugin/src/util/getWrappingFixer.ts b/packages/eslint-plugin/src/util/getWrappingFixer.ts new file mode 100644 index 000000000000..00c00e748829 --- /dev/null +++ b/packages/eslint-plugin/src/util/getWrappingFixer.ts @@ -0,0 +1,212 @@ +import { + AST_NODE_TYPES, + TSESLint, + TSESTree, +} from '@typescript-eslint/experimental-utils'; +import { SourceCode } from '@typescript-eslint/experimental-utils/src/ts-eslint'; +import * as util from '../util'; + +interface WrappingFixerParams { + /** Source code. */ + sourceCode: Readonly; + /** The node we want to modify. */ + node: TSESTree.Node; + /** + * Descendant of `node` we want to preserve. + * Use this to replace some code with another. + * By default it's the node we are modifying (so nothing is removed). + * You can pass multiple nodes as an array. + */ + innerNode?: TSESTree.Node | TSESTree.Node[]; + /** + * The function which gets the code of the `innerNode` and returns some code around it. + * Receives multiple arguments if there are multiple innerNodes. + * E.g. ``code => `${code} != null` `` + */ + wrap: (...code: string[]) => string; +} + +/** + * Wraps node with some code. Adds parenthesis as necessary. + * @returns Fixer which adds the specified code and parens if necessary. + */ +export function getWrappingFixer( + params: WrappingFixerParams, +): TSESLint.ReportFixFunction { + const { sourceCode, node, innerNode = node, wrap } = params; + const innerNodes = Array.isArray(innerNode) ? innerNode : [innerNode]; + + return (fixer): TSESLint.RuleFix => { + const innerCodes = innerNodes.map(innerNode => { + let code = sourceCode.getText(innerNode); + + // check the inner expression's precedence + if (!isStrongPrecedenceNode(innerNode)) { + // the code we are adding might have stronger precedence than our wrapped node + // let's wrap our node in parens in case it has a weaker precedence than the code we are wrapping it in + code = `(${code})`; + } + + return code; + }); + + // do the wrapping + let code = wrap(...innerCodes); + + // check the outer expression's precedence + if (isWeakPrecedenceParent(node)) { + // we wrapped the node in some expression which very likely has a different precedence than original wrapped node + // let's wrap the whole expression in parens just in case + if (!util.isParenthesized(node, sourceCode)) { + code = `(${code})`; + } + } + + // check if we need to insert semicolon + if (/^[`([]/.exec(code) && isMissingSemicolonBefore(node, sourceCode)) { + code = `;${code}`; + } + + return fixer.replaceText(node, code); + }; +} + +/** + * Check if a node will always have the same precedence if it's parent changes. + */ +function isStrongPrecedenceNode(innerNode: TSESTree.Node): boolean { + return ( + innerNode.type === AST_NODE_TYPES.Literal || + innerNode.type === AST_NODE_TYPES.Identifier || + innerNode.type === AST_NODE_TYPES.ArrayExpression || + innerNode.type === AST_NODE_TYPES.ObjectExpression || + innerNode.type === AST_NODE_TYPES.MemberExpression || + innerNode.type === AST_NODE_TYPES.CallExpression || + innerNode.type === AST_NODE_TYPES.NewExpression || + innerNode.type === AST_NODE_TYPES.TaggedTemplateExpression + ); +} + +/** + * Check if a node's parent could have different precedence if the node changes. + */ +function isWeakPrecedenceParent(node: TSESTree.Node): boolean { + const parent = node.parent!; + + if ( + parent.type === AST_NODE_TYPES.UpdateExpression || + parent.type === AST_NODE_TYPES.UnaryExpression || + parent.type === AST_NODE_TYPES.BinaryExpression || + parent.type === AST_NODE_TYPES.LogicalExpression || + parent.type === AST_NODE_TYPES.ConditionalExpression || + parent.type === AST_NODE_TYPES.AwaitExpression + ) { + return true; + } + + if ( + parent.type === AST_NODE_TYPES.MemberExpression && + parent.object === node + ) { + return true; + } + + if ( + (parent.type === AST_NODE_TYPES.CallExpression || + parent.type === AST_NODE_TYPES.NewExpression) && + parent.callee === node + ) { + return true; + } + + if ( + parent.type === AST_NODE_TYPES.TaggedTemplateExpression && + parent.tag === node + ) { + return true; + } + + return false; +} + +/** + * Returns true if a node is at the beginning of expression statement and the statement above doesn't end with semicolon. + * Doesn't check if the node begins with `(`, `[` or `` ` ``. + */ +function isMissingSemicolonBefore( + node: TSESTree.Node, + sourceCode: SourceCode, +): boolean { + for (;;) { + const parent = node.parent!; + + if (parent.type === AST_NODE_TYPES.ExpressionStatement) { + const block = parent.parent!; + if ( + block.type === AST_NODE_TYPES.Program || + block.type === AST_NODE_TYPES.BlockStatement + ) { + // parent is an expression statement in a block + const statementIndex = block.body.indexOf(parent); + const previousStatement = block.body[statementIndex - 1]; + if ( + statementIndex > 0 && + sourceCode.getLastToken(previousStatement)!.value !== ';' + ) { + return true; + } + } + } + + if (!isLeftHandSide(node)) { + return false; + } + + node = parent; + } +} + +/** + * Checks if a node is LHS of an operator. + */ +function isLeftHandSide(node: TSESTree.Node): boolean { + const parent = node.parent!; + + // a++ + if (parent.type === AST_NODE_TYPES.UpdateExpression) { + return true; + } + + // a + b + if ( + (parent.type === AST_NODE_TYPES.BinaryExpression || + parent.type === AST_NODE_TYPES.LogicalExpression || + parent.type === AST_NODE_TYPES.AssignmentExpression) && + node === parent.left + ) { + return true; + } + + // a ? b : c + if ( + parent.type === AST_NODE_TYPES.ConditionalExpression && + node === parent.test + ) { + return true; + } + + // a(b) + if (parent.type === AST_NODE_TYPES.CallExpression && node === parent.callee) { + return true; + } + + // a`b` + if ( + parent.type === AST_NODE_TYPES.TaggedTemplateExpression && + node === parent.tag + ) { + return true; + } + + return false; +} diff --git a/packages/eslint-plugin/src/util/index.ts b/packages/eslint-plugin/src/util/index.ts index fc5346f73466..4c0284895235 100644 --- a/packages/eslint-plugin/src/util/index.ts +++ b/packages/eslint-plugin/src/util/index.ts @@ -4,6 +4,8 @@ export * from './astUtils'; export * from './collectUnusedVariables'; export * from './createRule'; export * from './getFunctionHeadLoc'; +export * from './getThisExpression'; +export * from './getWrappingFixer'; export * from './isTypeReadonly'; export * from './misc'; export * from './nullThrows'; @@ -13,15 +15,10 @@ export * from './requiresQuoting'; export * from './types'; // this is done for convenience - saves migrating all of the old rules -const { - applyDefault, - deepMerge, - isObjectNotArray, - getParserServices, -} = ESLintUtils; -type InferMessageIdsTypeFromRule< - T -> = ESLintUtils.InferMessageIdsTypeFromRule; +const { applyDefault, deepMerge, isObjectNotArray, getParserServices } = + ESLintUtils; +type InferMessageIdsTypeFromRule = + ESLintUtils.InferMessageIdsTypeFromRule; type InferOptionsTypeFromRule = ESLintUtils.InferOptionsTypeFromRule; export { diff --git a/packages/eslint-plugin/src/util/isTypeReadonly.ts b/packages/eslint-plugin/src/util/isTypeReadonly.ts index b10f00006ec5..8231455c294f 100644 --- a/packages/eslint-plugin/src/util/isTypeReadonly.ts +++ b/packages/eslint-plugin/src/util/isTypeReadonly.ts @@ -4,6 +4,7 @@ import { isUnionOrIntersectionType, unionTypeParts, isPropertyReadonlyInType, + isSymbolFlagSet, } from 'tsutils'; import * as ts from 'typescript'; import { getTypeOfPropertyOfType, nullThrows, NullThrowsReasons } from '.'; @@ -17,13 +18,41 @@ const enum Readonlyness { Readonly = 3, } +export interface ReadonlynessOptions { + readonly treatMethodsAsReadonly?: boolean; +} + +export const readonlynessOptionsSchema = { + type: 'object', + additionalProperties: false, + properties: { + treatMethodsAsReadonly: { + type: 'boolean', + }, + }, +}; + +export const readonlynessOptionsDefaults: ReadonlynessOptions = { + treatMethodsAsReadonly: false, +}; + +function hasSymbol(node: ts.Node): node is ts.Node & { symbol: ts.Symbol } { + return Object.prototype.hasOwnProperty.call(node, 'symbol'); +} + function isTypeReadonlyArrayOrTuple( checker: ts.TypeChecker, type: ts.Type, + options: ReadonlynessOptions, seenTypes: Set, ): Readonlyness { function checkTypeArguments(arrayType: ts.TypeReference): Readonlyness { - const typeArguments = checker.getTypeArguments(arrayType); + const typeArguments = + // getTypeArguments was only added in TS3.7 + checker.getTypeArguments + ? checker.getTypeArguments(arrayType) + : arrayType.typeArguments ?? []; + // this shouldn't happen in reality as: // - tuples require at least 1 type argument // - ReadonlyArray requires at least 1 type argument @@ -35,7 +64,7 @@ function isTypeReadonlyArrayOrTuple( if ( typeArguments.some( typeArg => - isTypeReadonlyRecurser(checker, typeArg, seenTypes) === + isTypeReadonlyRecurser(checker, typeArg, options, seenTypes) === Readonlyness.Mutable, ) ) { @@ -71,6 +100,7 @@ function isTypeReadonlyArrayOrTuple( function isTypeReadonlyObject( checker: ts.TypeChecker, type: ts.Type, + options: ReadonlynessOptions, seenTypes: Set, ): Readonlyness { function checkIndexSignature(kind: ts.IndexKind): Readonlyness { @@ -88,7 +118,18 @@ function isTypeReadonlyObject( if (properties.length) { // ensure the properties are marked as readonly for (const property of properties) { - if (!isPropertyReadonlyInType(type, property.getEscapedName(), checker)) { + if ( + !( + isPropertyReadonlyInType(type, property.getEscapedName(), checker) || + (options.treatMethodsAsReadonly && + property.valueDeclaration !== undefined && + hasSymbol(property.valueDeclaration) && + isSymbolFlagSet( + property.valueDeclaration.symbol, + ts.SymbolFlags.Method, + )) + ) + ) { return Readonlyness.Mutable; } } @@ -112,7 +153,7 @@ function isTypeReadonlyObject( } if ( - isTypeReadonlyRecurser(checker, propertyType, seenTypes) === + isTypeReadonlyRecurser(checker, propertyType, options, seenTypes) === Readonlyness.Mutable ) { return Readonlyness.Mutable; @@ -137,14 +178,17 @@ function isTypeReadonlyObject( function isTypeReadonlyRecurser( checker: ts.TypeChecker, type: ts.Type, + options: ReadonlynessOptions, seenTypes: Set, ): Readonlyness.Readonly | Readonlyness.Mutable { seenTypes.add(type); if (isUnionType(type)) { // all types in the union must be readonly - const result = unionTypeParts(type).every(t => - isTypeReadonlyRecurser(checker, t, seenTypes), + const result = unionTypeParts(type).every( + t => + seenTypes.has(t) || + isTypeReadonlyRecurser(checker, t, options, seenTypes), ); const readonlyness = result ? Readonlyness.Readonly : Readonlyness.Mutable; return readonlyness; @@ -164,12 +208,22 @@ function isTypeReadonlyRecurser( return Readonlyness.Readonly; } - const isReadonlyArray = isTypeReadonlyArrayOrTuple(checker, type, seenTypes); + const isReadonlyArray = isTypeReadonlyArrayOrTuple( + checker, + type, + options, + seenTypes, + ); if (isReadonlyArray !== Readonlyness.UnknownType) { return isReadonlyArray; } - const isReadonlyObject = isTypeReadonlyObject(checker, type, seenTypes); + const isReadonlyObject = isTypeReadonlyObject( + checker, + type, + options, + seenTypes, + ); /* istanbul ignore else */ if ( isReadonlyObject !== Readonlyness.UnknownType ) { @@ -182,9 +236,14 @@ function isTypeReadonlyRecurser( /** * Checks if the given type is readonly */ -function isTypeReadonly(checker: ts.TypeChecker, type: ts.Type): boolean { +function isTypeReadonly( + checker: ts.TypeChecker, + type: ts.Type, + options: ReadonlynessOptions, +): boolean { return ( - isTypeReadonlyRecurser(checker, type, new Set()) === Readonlyness.Readonly + isTypeReadonlyRecurser(checker, type, options, new Set()) === + Readonlyness.Readonly ); } diff --git a/packages/eslint-plugin/src/util/misc.ts b/packages/eslint-plugin/src/util/misc.ts index 2e6c4711cb0d..052e7bfd06ce 100644 --- a/packages/eslint-plugin/src/util/misc.ts +++ b/packages/eslint-plugin/src/util/misc.ts @@ -7,6 +7,7 @@ import { TSESLint, TSESTree, } from '@typescript-eslint/experimental-utils'; +import { requiresQuoting } from './requiresQuoting'; /** * Check if the context file name is *.d.ts or *.d.tsx @@ -64,53 +65,103 @@ function getNameFromIndexSignature(node: TSESTree.TSIndexSignature): string { return propName ? propName.name : '(index signature)'; } +enum MemberNameType { + Private = 1, + Quoted = 2, + Normal = 3, + Expression = 4, +} + /** * Gets a string name representation of the name of the given MethodDefinition - * or ClassProperty node, with handling for computed property names. + * or PropertyDefinition node, with handling for computed property names. */ function getNameFromMember( member: | TSESTree.MethodDefinition | TSESTree.TSMethodSignature | TSESTree.TSAbstractMethodDefinition - | TSESTree.ClassProperty - | TSESTree.TSAbstractClassProperty + | TSESTree.PropertyDefinition + | TSESTree.TSAbstractPropertyDefinition | TSESTree.Property | TSESTree.TSPropertySignature, sourceCode: TSESLint.SourceCode, -): string { +): { type: MemberNameType; name: string } { if (member.key.type === AST_NODE_TYPES.Identifier) { - return member.key.name; + return { + type: MemberNameType.Normal, + name: member.key.name, + }; + } + if (member.key.type === AST_NODE_TYPES.PrivateIdentifier) { + return { + type: MemberNameType.Private, + name: `#${member.key.name}`, + }; } if (member.key.type === AST_NODE_TYPES.Literal) { - return `${member.key.value}`; + const name = `${member.key.value}`; + if (requiresQuoting(name)) { + return { + type: MemberNameType.Quoted, + name: `"${name}"`, + }; + } else { + return { + type: MemberNameType.Normal, + name, + }; + } } - return sourceCode.text.slice(...member.key.range); + return { + type: MemberNameType.Expression, + name: sourceCode.text.slice(...member.key.range), + }; } type ExcludeKeys< TObj extends Record, - TKeys extends keyof TObj + TKeys extends keyof TObj, > = { [k in Exclude]: TObj[k] }; type RequireKeys< TObj extends Record, - TKeys extends keyof TObj + TKeys extends keyof TObj, > = ExcludeKeys & { [k in TKeys]-?: Exclude }; function getEnumNames(myEnum: Record): T[] { return Object.keys(myEnum).filter(x => isNaN(parseInt(x))) as T[]; } +/** + * Given an array of words, returns an English-friendly concatenation, separated with commas, with + * the `and` clause inserted before the last item. + * + * Example: ['foo', 'bar', 'baz' ] returns the string "foo, bar, and baz". + */ +function formatWordList(words: string[]): string { + if (!words?.length) { + return ''; + } + + if (words.length === 1) { + return words[0]; + } + + return [words.slice(0, -1).join(', '), words.slice(-1)[0]].join(' and '); +} + export { arraysAreEqual, Equal, ExcludeKeys, findFirstResult, + formatWordList, getEnumNames, getNameFromIndexSignature, getNameFromMember, isDefinitionFile, + MemberNameType, RequireKeys, upperCaseFirst, }; diff --git a/packages/eslint-plugin/src/util/types.ts b/packages/eslint-plugin/src/util/types.ts index d29349f812fc..089620e702a3 100644 --- a/packages/eslint-plugin/src/util/types.ts +++ b/packages/eslint-plugin/src/util/types.ts @@ -1,3 +1,7 @@ +import { + AST_NODE_TYPES, + TSESTree, +} from '@typescript-eslint/experimental-utils'; import debug from 'debug'; import { isCallExpression, @@ -11,6 +15,7 @@ import { isVariableDeclaration, unionTypeParts, isPropertyAssignment, + isBinaryExpression, } from 'tsutils'; import * as ts from 'typescript'; @@ -418,6 +423,7 @@ export function isUnsafeAssignment( type: ts.Type, receiver: ts.Type, checker: ts.TypeChecker, + senderNode: TSESTree.Node | null, ): false | { sender: ts.Type; receiver: ts.Type } { if (isTypeAnyType(type)) { // Allow assignment of any ==> unknown. @@ -450,6 +456,19 @@ export function isUnsafeAssignment( return false; } + if ( + senderNode?.type === AST_NODE_TYPES.NewExpression && + senderNode.callee.type === AST_NODE_TYPES.Identifier && + senderNode.callee.name === 'Map' && + senderNode.arguments.length === 0 && + senderNode.typeParameters == null + ) { + // special case to handle `new Map()` + // unfortunately Map's default empty constructor is typed to return `Map` :( + // https://github.com/typescript-eslint/typescript-eslint/issues/2109#issuecomment-634144396 + return false; + } + const typeArguments = type.typeArguments ?? []; const receiverTypeArguments = receiver.typeArguments ?? []; @@ -457,7 +476,7 @@ export function isUnsafeAssignment( const arg = typeArguments[i]; const receiverArg = receiverTypeArguments[i]; - const unsafe = isUnsafeAssignment(arg, receiverArg, checker); + const unsafe = isUnsafeAssignment(arg, receiverArg, checker, senderNode); if (unsafe) { return { sender: type, receiver }; } @@ -498,6 +517,13 @@ export function getContextualType( return checker.getContextualType(parent); } else if (isPropertyAssignment(parent) && isIdentifier(node)) { return checker.getContextualType(node); + } else if ( + isBinaryExpression(parent) && + parent.operatorToken.kind === ts.SyntaxKind.EqualsToken && + parent.right === node + ) { + // is RHS of assignment + return checker.getTypeAtLocation(parent.left); } else if ( ![ts.SyntaxKind.TemplateSpan, ts.SyntaxKind.JsxExpression].includes( parent.kind, diff --git a/packages/eslint-plugin/tests/docs.test.ts b/packages/eslint-plugin/tests/docs.test.ts index 103caeb58ad1..5ad79c88ec79 100644 --- a/packages/eslint-plugin/tests/docs.test.ts +++ b/packages/eslint-plugin/tests/docs.test.ts @@ -70,6 +70,33 @@ describe('Validating rule docs', () => { text: `${rule.meta.docs?.description} (\`${ruleName}\`)`, }); }); + + it('Attributes in the docs must match the metadata', () => { + const file = fs.readFileSync(filePath, 'utf-8'); + const tokens = marked.lexer(file, { + gfm: true, + silent: false, + }); + + // Verify attributes header exists + const attributesHeaderIndex = tokens.findIndex( + token => token.type === 'heading' && token.text === 'Attributes', + ); + expect(attributesHeaderIndex).toBeGreaterThan(-1); + + // Verify attributes content + const attributesList = tokens[ + attributesHeaderIndex + 1 + ] as marked.Tokens.List; + const recommended = attributesList.items[0]; + expect(rule.meta.docs?.recommended !== false).toBe(recommended.checked); + const fixable = attributesList.items[1]; + expect(rule.meta.fixable !== undefined).toBe(fixable.checked); + const requiresTypeChecking = attributesList.items[2]; + expect(rule.meta.docs?.requiresTypeChecking === true).toBe( + requiresTypeChecking.checked, + ); + }); } }); @@ -120,7 +147,7 @@ describe('Validating README.md', () => { .sort() .map(createRuleLink); - expect(rulesTables.base.cells.map(row => row[0])).toStrictEqual( + expect(rulesTables.base.rows.map(row => row[0].text)).toStrictEqual( baseRuleNames, ); }); @@ -130,17 +157,20 @@ describe('Validating README.md', () => { .sort() .map(createRuleLink); - expect(rulesTables.extension.cells.map(row => row[0])).toStrictEqual( + expect(rulesTables.extension.rows.map(row => row[0].text)).toStrictEqual( extensionRuleNames, ); }); for (const [ruleName, rule] of notDeprecated) { describe(`Checking rule ${ruleName}`, () => { - const ruleRow: string[] | undefined = (rule.meta.docs?.extendsBaseRule - ? rulesTables.extension.cells - : rulesTables.base.cells - ).find(row => row[0].includes(`/${ruleName}.md`)); + const ruleRow: string[] | undefined = ( + rule.meta.docs?.extendsBaseRule + ? rulesTables.extension.rows + : rulesTables.base.rows + ) + .find(row => row[0].text.includes(`/${ruleName}.md`)) + ?.map(cell => cell.text); if (!ruleRow) { // rule is in the wrong table, the first two tests will catch this, so no point in creating noise; // these tests will ofc fail in that case @@ -148,27 +178,27 @@ describe('Validating README.md', () => { } it('Link column should be correct', () => { - expect(ruleRow[0]).toEqual(createRuleLink(ruleName)); + expect(ruleRow[0]).toBe(createRuleLink(ruleName)); }); it('Description column should be correct', () => { - expect(ruleRow[1]).toEqual(rule.meta.docs?.description); + expect(ruleRow[1]).toBe(rule.meta.docs?.description); }); it('Recommended column should be correct', () => { - expect(ruleRow[2]).toEqual( - rule.meta.docs?.recommended ? ':heavy_check_mark:' : '', + expect(ruleRow[2]).toBe( + rule.meta.docs?.recommended ? ':white_check_mark:' : '', ); }); it('Fixable column should be correct', () => { - expect(ruleRow[3]).toEqual( + expect(ruleRow[3]).toBe( rule.meta.fixable !== undefined ? ':wrench:' : '', ); }); it('Requiring type information column should be correct', () => { - expect(ruleRow[4]).toEqual( + expect(ruleRow[4]).toBe( rule.meta.docs?.requiresTypeChecking === true ? ':thought_balloon:' : '', 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 6d19021fa560..495bbe97e698 100644 --- a/packages/eslint-plugin/tests/eslint-rules/arrow-parens.test.ts +++ b/packages/eslint-plugin/tests/eslint-rules/arrow-parens.test.ts @@ -1,6 +1,8 @@ -import rule from 'eslint/lib/rules/arrow-parens'; +import { getESLintCoreRule } from '../../src/util/getESLintCoreRule'; import { RuleTester, noFormat } from '../RuleTester'; +const rule = getESLintCoreRule('arrow-parens'); + const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', }); 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 0dc4807edb15..5bc8d99490d1 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,6 +1,8 @@ -import rule from 'eslint/lib/rules/no-dupe-args'; +import { getESLintCoreRule } from '../../src/util/getESLintCoreRule'; import { RuleTester } from '../RuleTester'; +const rule = getESLintCoreRule('no-dupe-args'); + const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 6, 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 2fc971bdef60..eb3fea348b52 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,6 +1,7 @@ -import rule from 'eslint/lib/rules/no-implicit-globals'; +import { getESLintCoreRule } from '../../src/util/getESLintCoreRule'; import { RuleTester } from '../RuleTester'; +const rule = getESLintCoreRule('no-implicit-globals'); const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 6, 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 7a457a617849..6061c8ebb4ee 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,6 +1,8 @@ -import rule from 'eslint/lib/rules/no-restricted-globals'; +import { getESLintCoreRule } from '../../src/util/getESLintCoreRule'; import { RuleTester } from '../RuleTester'; +const rule = getESLintCoreRule('no-restricted-globals'); + const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 6, 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 020a4e715d67..9cff63994d39 100644 --- a/packages/eslint-plugin/tests/eslint-rules/no-undef.test.ts +++ b/packages/eslint-plugin/tests/eslint-rules/no-undef.test.ts @@ -1,6 +1,8 @@ -import rule from 'eslint/lib/rules/no-undef'; +import { getESLintCoreRule } from '../../src/util/getESLintCoreRule'; import { RuleTester } from '../RuleTester'; +const rule = getESLintCoreRule('no-undef'); + const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 6, @@ -139,6 +141,13 @@ function predicate(arg: any): asserts arg is T { throw 'oops'; } } + `, + ` +interface ITest { + attr: string; +} +let test: unknown; +(test as ITest) = { attr: '' }; `, { code: ` 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 a051ebb68610..d3bce8cfdee9 100644 --- a/packages/eslint-plugin/tests/eslint-rules/prefer-const.test.ts +++ b/packages/eslint-plugin/tests/eslint-rules/prefer-const.test.ts @@ -1,6 +1,8 @@ -import rule from 'eslint/lib/rules/prefer-const'; +import { getESLintCoreRule } from '../../src/util/getESLintCoreRule'; import { RuleTester } from '../RuleTester'; +const rule = getESLintCoreRule('prefer-const'); + const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', }); diff --git a/packages/eslint-plugin/tests/eslint-rules/strict.test.ts b/packages/eslint-plugin/tests/eslint-rules/strict.test.ts index 51d27c9bde95..83ad25a0605b 100644 --- a/packages/eslint-plugin/tests/eslint-rules/strict.test.ts +++ b/packages/eslint-plugin/tests/eslint-rules/strict.test.ts @@ -1,6 +1,8 @@ -import rule from 'eslint/lib/rules/strict'; +import { getESLintCoreRule } from '../../src/util/getESLintCoreRule'; import { RuleTester } from '../RuleTester'; +const rule = getESLintCoreRule('strict'); + const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 6, diff --git a/packages/eslint-plugin/tests/fixtures/tsconfig.noImplicitThis.json b/packages/eslint-plugin/tests/fixtures/tsconfig.noImplicitThis.json new file mode 100644 index 000000000000..c017e51c6e4c --- /dev/null +++ b/packages/eslint-plugin/tests/fixtures/tsconfig.noImplicitThis.json @@ -0,0 +1,6 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "noImplicitThis": false + } +} 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 0f034a787f78..12cf859a84a7 100644 --- a/packages/eslint-plugin/tests/rules/adjacent-overload-signatures.test.ts +++ b/packages/eslint-plugin/tests/rules/adjacent-overload-signatures.test.ts @@ -238,6 +238,18 @@ class Test { interface Foo { [Symbol.toStringTag](): void; [Symbol.iterator](): void; +} + `, + // private members + ` +class Test { + #private(): void; + #private(arg: number): void {} + + bar() {} + + '#private'(): void; + '#private'(arg: number): void {} } `, ], @@ -836,5 +848,30 @@ class Foo { }, ], }, + // private members + { + code: ` +class Test { + #private(): void; + '#private'(): void; + #private(arg: number): void {} + '#private'(arg: number): void {} +} + `, + errors: [ + { + messageId: 'adjacentSignature', + data: { name: '#private' }, + line: 5, + column: 3, + }, + { + messageId: 'adjacentSignature', + data: { name: '"#private"' }, + line: 6, + column: 3, + }, + ], + }, ], }); diff --git a/packages/eslint-plugin/tests/rules/array-type.test.ts b/packages/eslint-plugin/tests/rules/array-type.test.ts index 6551bf6e7b97..3c2c1893a3f8 100644 --- a/packages/eslint-plugin/tests/rules/array-type.test.ts +++ b/packages/eslint-plugin/tests/rules/array-type.test.ts @@ -1664,7 +1664,7 @@ interface FooInterface { ], }); -// eslint rule tester is not working with multi-pass +// -- eslint rule tester is not working with multi-pass // https://github.com/eslint/eslint/issues/11187 describe('array-type (nested)', () => { const linter = new TSESLint.Linter(); 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 994da016d5f7..b9d10b005b6f 100644 --- a/packages/eslint-plugin/tests/rules/ban-ts-comment.test.ts +++ b/packages/eslint-plugin/tests/rules/ban-ts-comment.test.ts @@ -173,8 +173,7 @@ ruleTester.run('ts-ignore', rule, { options: [{ 'ts-ignore': false }], }, { - code: - '// @ts-ignore I think that I am exempted from any need to follow the rules!', + code: '// @ts-ignore I think that I am exempted from any need to follow the rules!', options: [{ 'ts-ignore': 'allow-with-description' }], }, { @@ -340,8 +339,7 @@ ruleTester.run('ts-nocheck', rule, { options: [{ 'ts-nocheck': false }], }, { - code: - '// @ts-nocheck no doubt, people will put nonsense here from time to time just to get the rule to stop reporting, perhaps even long messages with other nonsense in them like other // @ts-nocheck or // @ts-ignore things', + code: '// @ts-nocheck no doubt, people will put nonsense here from time to time just to get the rule to stop reporting, perhaps even long messages with other nonsense in them like other // @ts-nocheck or // @ts-ignore things', options: [{ 'ts-nocheck': 'allow-with-description' }], }, { @@ -488,8 +486,7 @@ ruleTester.run('ts-check', rule, { options: [{ 'ts-check': false }], }, { - code: - '// @ts-check with a description and also with a no-op // @ts-ignore', + code: '// @ts-check with a description and also with a no-op // @ts-ignore', options: [ { 'ts-check': 'allow-with-description', minimumDescriptionLength: 3 }, ], diff --git a/packages/eslint-plugin/tests/rules/ban-types.test.ts b/packages/eslint-plugin/tests/rules/ban-types.test.ts index 27743ecc5a3a..9dbd5344be50 100644 --- a/packages/eslint-plugin/tests/rules/ban-types.test.ts +++ b/packages/eslint-plugin/tests/rules/ban-types.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/internal/prefer-ast-types-enum */ import { TSESLint } from '@typescript-eslint/experimental-utils'; import rule, { MessageIds, @@ -5,7 +6,7 @@ import rule, { TYPE_KEYWORDS, } from '../../src/rules/ban-types'; import { objectReduceKey } from '../../src/util'; -import { RuleTester, noFormat } from '../RuleTester'; +import { noFormat, RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', @@ -163,7 +164,6 @@ ruleTester.run('ban-types', rule, { { messageId: 'bannedTypeMessage', data: { - // eslint-disable-next-line @typescript-eslint/internal/prefer-ast-types-enum name: 'String', customMessage: ' Use string instead.', }, @@ -180,7 +180,6 @@ ruleTester.run('ban-types', rule, { { messageId: 'bannedTypeMessage', data: { - // eslint-disable-next-line @typescript-eslint/internal/prefer-ast-types-enum name: 'String', customMessage: ' Use string instead.', }, @@ -197,7 +196,6 @@ ruleTester.run('ban-types', rule, { { messageId: 'bannedTypeMessage', data: { - // eslint-disable-next-line @typescript-eslint/internal/prefer-ast-types-enum name: 'String', customMessage: ' Use string instead.', }, @@ -242,7 +240,6 @@ class Foo extends Bar implements Baz { { messageId: 'bannedTypeMessage', data: { - // eslint-disable-next-line @typescript-eslint/internal/prefer-ast-types-enum name: 'String', customMessage: ' Use string instead.', }, @@ -252,7 +249,6 @@ class Foo extends Bar implements Baz { { messageId: 'bannedTypeMessage', data: { - // eslint-disable-next-line @typescript-eslint/internal/prefer-ast-types-enum name: 'String', customMessage: ' Use string instead.', }, @@ -271,7 +267,6 @@ class Foo extends Bar implements Baz { { messageId: 'bannedTypeMessage', data: { - // eslint-disable-next-line @typescript-eslint/internal/prefer-ast-types-enum name: 'String', customMessage: ' Use string instead.', }, @@ -296,7 +291,6 @@ class Foo extends Bar implements Baz { { messageId: 'bannedTypeMessage', data: { - // eslint-disable-next-line @typescript-eslint/internal/prefer-ast-types-enum name: 'String', customMessage: ' Use string instead.', }, @@ -306,7 +300,6 @@ class Foo extends Bar implements Baz { { messageId: 'bannedTypeMessage', data: { - // eslint-disable-next-line @typescript-eslint/internal/prefer-ast-types-enum name: 'String', customMessage: ' Use string instead.', }, @@ -316,7 +309,6 @@ class Foo extends Bar implements Baz { { messageId: 'bannedTypeMessage', data: { - // eslint-disable-next-line @typescript-eslint/internal/prefer-ast-types-enum name: 'String', customMessage: ' Use string instead.', }, diff --git a/packages/eslint-plugin/tests/rules/brace-style.test.ts b/packages/eslint-plugin/tests/rules/brace-style.test.ts index 28b9413795db..35bc5afe9967 100644 --- a/packages/eslint-plugin/tests/rules/brace-style.test.ts +++ b/packages/eslint-plugin/tests/rules/brace-style.test.ts @@ -721,16 +721,14 @@ if (f) { errors: [{ messageId: 'sameLineClose' }], }, { - code: - 'if (foo) {\nbaz();\n} else if (bar) {\nbaz();\n}\nelse {\nqux();\n}', + code: 'if (foo) {\nbaz();\n} else if (bar) {\nbaz();\n}\nelse {\nqux();\n}', output: 'if (foo) {\nbaz();\n}\n else if (bar) {\nbaz();\n}\nelse {\nqux();\n}', options: ['stroustrup'], errors: [{ messageId: 'sameLineClose' }], }, { - code: - 'if (foo) {\npoop();\n} \nelse if (bar) {\nbaz();\n} else if (thing) {\nboom();\n}\nelse {\nqux();\n}', + code: 'if (foo) {\npoop();\n} \nelse if (bar) {\nbaz();\n} else if (thing) {\nboom();\n}\nelse {\nqux();\n}', output: 'if (foo) {\npoop();\n} \nelse if (bar) {\nbaz();\n}\n else if (thing) {\nboom();\n}\nelse {\nqux();\n}', options: ['stroustrup'], @@ -767,8 +765,7 @@ if (f) { ], }, { - code: - 'if (foo) {\nbaz();\n} else if (bar) {\nbaz();\n}\nelse {\nqux();\n}', + code: 'if (foo) {\nbaz();\n} else if (bar) {\nbaz();\n}\nelse {\nqux();\n}', output: 'if (foo) \n{\nbaz();\n}\n else if (bar) \n{\nbaz();\n}\nelse \n{\nqux();\n}', options: ['allman'], @@ -780,8 +777,7 @@ if (f) { ], }, { - code: - 'if (foo)\n{ poop();\n} \nelse if (bar) {\nbaz();\n} else if (thing) {\nboom();\n}\nelse {\nqux();\n}', + code: 'if (foo)\n{ poop();\n} \nelse if (bar) {\nbaz();\n} else if (thing) {\nboom();\n}\nelse {\nqux();\n}', output: 'if (foo)\n{\n poop();\n} \nelse if (bar) \n{\nbaz();\n}\n else if (thing) \n{\nboom();\n}\nelse \n{\nqux();\n}', options: ['allman'], @@ -946,8 +942,7 @@ if (f) { errors: [{ messageId: 'sameLineClose' }], }, { - code: - 'if (foo)\n{ poop();\n} \nelse if (bar) {\nbaz();\n} else if (thing) {\nboom();\n}\nelse {\nqux();\n}', + code: 'if (foo)\n{ poop();\n} \nelse if (bar) {\nbaz();\n} else if (thing) {\nboom();\n}\nelse {\nqux();\n}', output: 'if (foo)\n{\n poop();\n} \nelse if (bar) \n{\nbaz();\n}\n else if (thing) \n{\nboom();\n}\nelse \n{\nqux();\n}', options: ['allman', { allowSingleLine: true }], 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 105c25724c23..f96672a213fc 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,5 @@ import rule from '../../src/rules/consistent-type-definitions'; -import { RuleTester, noFormat } from '../RuleTester'; +import { noFormat, RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', @@ -281,5 +281,29 @@ declare global { }, ], }, + { + // https://github.com/typescript-eslint/typescript-eslint/issues/3894 + code: ` +export default interface Test { + bar(): string; + foo(): number; +} + `, + output: noFormat` +type Test = { + bar(): string; + foo(): number; +} +export default Test + `, + options: ['type'], + errors: [ + { + messageId: 'typeOverInterface', + line: 2, + column: 26, + }, + ], + }, ], }); diff --git a/packages/eslint-plugin/tests/rules/consistent-type-exports.test.ts b/packages/eslint-plugin/tests/rules/consistent-type-exports.test.ts new file mode 100644 index 000000000000..301d70e54dc3 --- /dev/null +++ b/packages/eslint-plugin/tests/rules/consistent-type-exports.test.ts @@ -0,0 +1,263 @@ +import rule from '../../src/rules/consistent-type-exports'; +import { RuleTester, getFixturesRootDir } from '../RuleTester'; + +const rootDir = getFixturesRootDir(); + +const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', + parserOptions: { + ecmaVersion: 2020, + sourceType: 'module', + tsconfigRootDir: rootDir, + project: './tsconfig.json', + }, +}); + +ruleTester.run('consistent-type-exports', rule, { + valid: [ + "export { Foo } from 'foo';", + "export type { AnalyzeOptions } from '@typescript-eslint/scope-manager';", + "export { BlockScope } from '@typescript-eslint/experimental-utils';", + "export type { BlockScope } from '@typescript-eslint/experimental-utils';", + ` +const variable = 1; +class Class {} +enum Enum {} +function Func() {} +namespace ValueNS { + export const x = 1; +} + +export { variable, Class, Enum, Func, ValueNS }; + `, + ` +type Alias = 1; +interface IFace {} +namespace TypeNS { + export type x = 1; +} + +export type { Alias, IFace, TypeNS }; + `, + ` +const foo = 1; +export type { foo }; + `, + ` +namespace NonTypeNS { + export const x = 1; +} + +export { NonTypeNS }; + `, + ], + invalid: [ + { + code: "export { AnalyzeOptions } from '@typescript-eslint/scope-manager';", + output: + "export type { AnalyzeOptions } from '@typescript-eslint/scope-manager';", + errors: [ + { + messageId: 'typeOverValue', + line: 1, + column: 1, + }, + ], + }, + { + code: "export { AnalyzeOptions, BlockScope } from '@typescript-eslint/scope-manager';", + output: + `export type { AnalyzeOptions } from '@typescript-eslint/scope-manager';\n` + + `export { BlockScope } from '@typescript-eslint/scope-manager';`, + errors: [ + { + messageId: 'singleExportIsType', + line: 1, + column: 1, + }, + ], + }, + { + code: ` +export { + AnalyzeOptions, + BlockScope, + CatchScope, +} from '@typescript-eslint/scope-manager'; + `, + output: ` +export type { AnalyzeOptions } from '@typescript-eslint/scope-manager'; +export { BlockScope, CatchScope } from '@typescript-eslint/scope-manager'; + `, + errors: [ + { + messageId: 'singleExportIsType', + line: 2, + column: 1, + }, + ], + }, + { + code: ` +export { + AnalyzeOptions, + BlockScope, + Definition, + CatchScope, +} from '@typescript-eslint/scope-manager'; + `, + // eslint-disable-next-line @typescript-eslint/internal/plugin-test-formatting + output: ` +export type { AnalyzeOptions, Definition } from '@typescript-eslint/scope-manager'; +export { BlockScope, CatchScope } from '@typescript-eslint/scope-manager'; + `, + errors: [ + { + messageId: 'multipleExportsAreTypes', + line: 2, + column: 1, + }, + ], + }, + { + code: "export { Definition as Foo } from '@typescript-eslint/scope-manager';", + output: + "export type { Definition as Foo } from '@typescript-eslint/scope-manager';", + errors: [ + { + messageId: 'typeOverValue', + line: 1, + column: 1, + }, + ], + }, + { + code: ` +export { + Definition as Foo, + BlockScope, +} from '@typescript-eslint/scope-manager'; + `, + output: ` +export type { Definition as Foo } from '@typescript-eslint/scope-manager'; +export { BlockScope } from '@typescript-eslint/scope-manager'; + `, + errors: [ + { + messageId: 'singleExportIsType', + line: 2, + column: 1, + }, + ], + }, + { + code: ` +export { + Definition as Foo, + BlockScope as BScope, + CatchScope as CScope, +} from '@typescript-eslint/scope-manager'; + `, + // eslint-disable-next-line @typescript-eslint/internal/plugin-test-formatting + output: ` +export type { Definition as Foo } from '@typescript-eslint/scope-manager'; +export { BlockScope as BScope, CatchScope as CScope } from '@typescript-eslint/scope-manager'; + `, + errors: [ + { + messageId: 'singleExportIsType', + line: 2, + column: 1, + }, + ], + }, + { + code: ` +import { Definition } from '@typescript-eslint/scope-manager'; +export { Definition }; + `, + output: ` +import { Definition } from '@typescript-eslint/scope-manager'; +export type { Definition }; + `, + errors: [ + { + messageId: 'typeOverValue', + line: 3, + column: 1, + }, + ], + }, + { + code: ` +import { CatchScope, Definition } from '@typescript-eslint/scope-manager'; +export { CatchScope, Definition }; + `, + output: ` +import { CatchScope, Definition } from '@typescript-eslint/scope-manager'; +export type { Definition }; +export { CatchScope }; + `, + errors: [ + { + messageId: 'singleExportIsType', + line: 3, + column: 1, + }, + ], + }, + { + code: ` +type Alias = 1; +interface IFace {} +namespace TypeNS { + export type x = 1; + export const f = 1; +} + +export { Alias, IFace, TypeNS }; + `, + output: ` +type Alias = 1; +interface IFace {} +namespace TypeNS { + export type x = 1; + export const f = 1; +} + +export type { Alias, IFace }; +export { TypeNS }; + `, + errors: [ + { + messageId: 'multipleExportsAreTypes', + line: 9, + column: 1, + }, + ], + }, + { + code: ` +namespace TypeNS { + export interface Foo {} +} + +export { TypeNS }; + `, + output: ` +namespace TypeNS { + export interface Foo {} +} + +export type { TypeNS }; + `, + errors: [ + { + messageId: 'typeOverValue', + line: 6, + column: 1, + }, + ], + }, + ], +}); diff --git a/packages/eslint-plugin/tests/rules/dot-notation.test.ts b/packages/eslint-plugin/tests/rules/dot-notation.test.ts index 0d1f755b4829..fe25e4de1f1d 100644 --- a/packages/eslint-plugin/tests/rules/dot-notation.test.ts +++ b/packages/eslint-plugin/tests/rules/dot-notation.test.ts @@ -87,6 +87,37 @@ x['protected_prop'] = 123; `, options: [{ allowProtectedClassPropertyAccess: true }], }, + { + code: ` +class X { + prop: string; + [key: string]: number; +} + +const x = new X(); +x['hello'] = 3; + `, + options: [{ allowIndexSignaturePropertyAccess: true }], + }, + { + code: ` +interface Nested { + property: string; + [key: string]: number | string; +} + +class Dingus { + nested: Nested; +} + +let dingus: Dingus | undefined; + +dingus?.nested.property; +dingus?.nested['hello']; + `, + options: [{ allowIndexSignaturePropertyAccess: true }], + parserOptions: { ecmaVersion: 2020 }, + }, ], invalid: [ { @@ -287,5 +318,27 @@ x.protected_prop = 123; `, errors: [{ messageId: 'useDot' }], }, + { + code: ` +class X { + prop: string; + [key: string]: number; +} + +const x = new X(); +x['prop'] = 'hello'; + `, + options: [{ allowIndexSignaturePropertyAccess: true }], + errors: [{ messageId: 'useDot' }], + output: ` +class X { + prop: string; + [key: string]: number; +} + +const x = new X(); +x.prop = 'hello'; + `, + }, ], }); 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 6ce8210822ba..ab98b4be27c5 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 @@ -156,6 +156,34 @@ const x = { code: ` const x: Foo = { foo: () => {}, +}; + `, + options: [{ allowTypedFunctionExpressions: true }], + }, + // https://github.com/typescript-eslint/typescript-eslint/issues/2864 + { + filename: 'test.ts', + code: ` +const x = { + foo: { bar: () => {} }, +} as Foo; + `, + options: [{ allowTypedFunctionExpressions: true }], + }, + { + filename: 'test.ts', + code: ` +const x = { + foo: { bar: () => {} }, +}; + `, + options: [{ allowTypedFunctionExpressions: true }], + }, + { + filename: 'test.ts', + code: ` +const x: Foo = { + foo: { bar: () => {} }, }; `, options: [{ allowTypedFunctionExpressions: true }], @@ -243,7 +271,8 @@ function FunctionDeclaration() { // ArrowFunctionExpression_Within_FunctionExpression return () => // ArrowFunctionExpression_Within_ArrowFunctionExpression - (): number => 1; // ArrowFunctionExpression_Within_ArrowFunctionExpression_WithNoBody + (): number => + 1; // ArrowFunctionExpression_Within_ArrowFunctionExpression_WithNoBody }; }; }; @@ -808,7 +837,8 @@ function FunctionDeclaration() { // ArrowFunctionExpression_Within_FunctionExpression return () => // ArrowFunctionExpression_Within_ArrowFunctionExpression - () => 1; // ArrowFunctionExpression_Within_ArrowFunctionExpression_WithNoBody + () => + 1; // ArrowFunctionExpression_Within_ArrowFunctionExpression_WithNoBody }; }; }; 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 906f1b6cc600..4f2951c6d910 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,5 @@ import rule from '../../src/rules/explicit-member-accessibility'; -import { RuleTester, noFormat } from '../RuleTester'; +import { noFormat, RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', @@ -330,6 +330,16 @@ class Test { code: ` class Test { constructor(private { x }: any[]) {} +} + `, + options: [{ accessibility: 'no-public' }], + }, + // private members + { + code: ` +class Test { + #foo = 1; + #bar() {} } `, options: [{ accessibility: 'no-public' }], @@ -1070,6 +1080,145 @@ class EnsureWhiteSPaceSpan { output: ` class EnsureWhiteSPaceSpan { /* */ constructor() {} +} + `, + }, + // quoted names + { + code: noFormat` +class Test { + public 'foo' = 1; + public 'foo foo' = 2; + public 'bar'() {} + public 'bar bar'() {} +} + `, + options: [{ accessibility: 'no-public' }], + errors: [ + { + messageId: 'unwantedPublicAccessibility', + data: { + type: 'class property', + name: 'foo', + }, + line: 3, + column: 3, + }, + { + messageId: 'unwantedPublicAccessibility', + data: { + type: 'class property', + name: '"foo foo"', + }, + line: 4, + column: 3, + }, + { + messageId: 'unwantedPublicAccessibility', + data: { + type: 'method definition', + name: 'bar', + }, + line: 5, + column: 3, + }, + { + messageId: 'unwantedPublicAccessibility', + data: { + type: 'method definition', + name: '"bar bar"', + }, + line: 6, + column: 3, + }, + ], + output: noFormat` +class Test { + 'foo' = 1; + 'foo foo' = 2; + 'bar'() {} + 'bar bar'() {} +} + `, + }, + { + code: ` +abstract class SomeClass { + abstract method(): string; +} + `, + options: [{ accessibility: 'explicit' }], + errors: [ + { + messageId: 'missingAccessibility', + line: 3, + column: 3, + }, + ], + }, + { + code: ` +abstract class SomeClass { + public abstract method(): string; +} + `, + options: [ + { + accessibility: 'no-public', + overrides: { parameterProperties: 'no-public' }, + }, + ], + errors: [ + { + messageId: 'unwantedPublicAccessibility', + line: 3, + column: 3, + }, + ], + output: ` +abstract class SomeClass { + abstract method(): string; +} + `, + }, + { + // https://github.com/typescript-eslint/typescript-eslint/issues/3835 + code: ` +abstract class SomeClass { + abstract x: string; +} + `, + options: [{ accessibility: 'explicit' }], + errors: [ + { + messageId: 'missingAccessibility', + line: 3, + column: 3, + }, + ], + }, + { + code: ` +abstract class SomeClass { + public abstract x: string; +} + `, + options: [ + { + accessibility: 'no-public', + overrides: { parameterProperties: 'no-public' }, + }, + ], + errors: [ + { + messageId: 'unwantedPublicAccessibility', + line: 3, + column: 3, + }, + ], + output: ` +abstract class SomeClass { + abstract x: string; } `, }, 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 3652ebc876ac..e511e29d682b 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 @@ -82,6 +82,16 @@ export class Test { } `, }, + ` +export class PrivateProperty { + #property = () => null; +} + `, + ` +export class PrivateMethod { + #method() {} +} + `, { // https://github.com/typescript-eslint/typescript-eslint/issues/2150 code: ` @@ -181,6 +191,34 @@ export const x = { code: ` export const x: Foo = { foo: () => {}, +}; + `, + options: [{ allowTypedFunctionExpressions: true }], + }, + // https://github.com/typescript-eslint/typescript-eslint/issues/2864 + { + filename: 'test.ts', + code: ` +export const x = { + foo: { bar: () => {} }, +} as Foo; + `, + options: [{ allowTypedFunctionExpressions: true }], + }, + { + filename: 'test.ts', + code: ` +export const x = { + foo: { bar: () => {} }, +}; + `, + options: [{ allowTypedFunctionExpressions: true }], + }, + { + filename: 'test.ts', + code: ` +export const x: Foo = { + foo: { bar: () => {} }, }; `, options: [{ allowTypedFunctionExpressions: true }], @@ -259,7 +297,8 @@ export function FunctionDeclaration() { // ArrowFunctionExpression_Within_FunctionExpression return () => // ArrowFunctionExpression_Within_ArrowFunctionExpression - (): number => 1; // ArrowFunctionExpression_Within_ArrowFunctionExpression_WithNoBody + (): number => + 1; // ArrowFunctionExpression_Within_ArrowFunctionExpression_WithNoBody }; }; }; @@ -1053,7 +1092,8 @@ export function FunctionDeclaration() { // ArrowFunctionExpression_Within_FunctionExpression return () => // ArrowFunctionExpression_Within_ArrowFunctionExpression - () => 1; // ArrowFunctionExpression_Within_ArrowFunctionExpression_WithNoBody + () => + 1; // ArrowFunctionExpression_Within_ArrowFunctionExpression_WithNoBody }; }; }; @@ -1604,18 +1644,20 @@ export { test }; }, { code: ` -export const foo = () => (a: string): ((n: number) => string) => { - return function (n) { - return String(n); +export const foo = + () => + (a: string): ((n: number) => string) => { + return function (n) { + return String(n); + }; }; -}; `, options: [{ allowHigherOrderFunctions: false }], errors: [ { messageId: 'missingReturnType', - line: 2, - column: 20, + line: 3, + column: 3, }, ], }, diff --git a/packages/eslint-plugin/tests/rules/indent/indent-eslint.test.ts b/packages/eslint-plugin/tests/rules/indent/indent-eslint.test.ts index a9dfda6b127b..d03ee3ea9dc8 100644 --- a/packages/eslint-plugin/tests/rules/indent/indent-eslint.test.ts +++ b/packages/eslint-plugin/tests/rules/indent/indent-eslint.test.ts @@ -846,8 +846,7 @@ ruleTester.run('indent', rule, { options: [2, { SwitchCase: 1 }], }, { - code: - 'var geometry, box, face1, face2, colorT, colorB, sprite, padding, maxWidth;', + code: 'var geometry, box, face1, face2, colorT, colorB, sprite, padding, maxWidth;', options: [2, { SwitchCase: 1 }], }, { diff --git a/packages/eslint-plugin/tests/rules/indent/indent.test.ts b/packages/eslint-plugin/tests/rules/indent/indent.test.ts index 8296bf19520c..3d6b58725f8b 100644 --- a/packages/eslint-plugin/tests/rules/indent/indent.test.ts +++ b/packages/eslint-plugin/tests/rules/indent/indent.test.ts @@ -39,7 +39,7 @@ abstract class Foo { ], }, { - node: AST_NODE_TYPES.TSAbstractClassProperty, + node: AST_NODE_TYPES.TSAbstractPropertyDefinition, code: [ ` class Foo { @@ -451,29 +451,6 @@ class Foo { `, ], }, - { - node: AST_NODE_TYPES.TSParenthesizedType, - code: [ - ` -const x: Array<( - | { - __typename: "Foo", - } - | { - __typename: "Baz", - } - | ( - | { - __typename: "Baz", - } - | { - __typename: "Buzz", - } - ) -)>; - `, - ], - }, // TSPlusToken - tested in TSMappedType { node: AST_NODE_TYPES.TSPropertySignature, 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 b25b0ca6b3ce..bb55bbbf3468 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 @@ -120,6 +120,15 @@ qux() { } { exceptAfterOverload: true, exceptAfterSingleLine: true }, ], }, + { + code: ` +abstract class foo { +abstract bar(a: string): void; +abstract bar(a: string, b: string): void; +}; + `, + options: ['always'], + }, ], invalid: [ { 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 c69e54e2af00..fa75383df8e3 100644 --- a/packages/eslint-plugin/tests/rules/member-delimiter-style.test.ts +++ b/packages/eslint-plugin/tests/rules/member-delimiter-style.test.ts @@ -851,6 +851,24 @@ interface Foo { }, { code: ` +type Test = { + a: { + one: 1 + }; b: 2 +}; + `, + output: null, + options: [{ multiline: { delimiter: 'none' } }], + errors: [ + { + messageId: 'unexpectedSemi', + line: 5, + column: 5, + }, + ], + }, + { + code: ` interface Foo { name: string age: number diff --git a/packages/eslint-plugin/tests/rules/member-ordering.test.ts b/packages/eslint-plugin/tests/rules/member-ordering.test.ts index 5134d591ffa8..97b05cfdeffc 100644 --- a/packages/eslint-plugin/tests/rules/member-ordering.test.ts +++ b/packages/eslint-plugin/tests/rules/member-ordering.test.ts @@ -75,7 +75,16 @@ interface Foo { `, options: [{ default: ['signature', 'field', 'constructor', 'method'] }], }, - + { + code: ` +interface X { + (): void; + a: unknown; + b(): void; +} + `, + options: [{ default: ['call-signature', 'field', 'method'] }], + }, { code: ` // no accessibility === public @@ -1302,7 +1311,7 @@ abstract class Foo { private D: string; protected static F(): {}; public E(): {}; - public abstract A = () => {}; + public abstract A(): void; protected abstract G(): void; } `, @@ -1448,6 +1457,27 @@ interface Foo { }, { code: ` +interface X { + a: unknown; + (): void; + b(): void; +} + `, + options: [{ default: ['call-signature', 'field', 'method'] }], + errors: [ + { + messageId: 'incorrectGroupOrder', + data: { + name: 'call', + rank: 'field', + }, + line: 4, + column: 3, + }, + ], + }, + { + code: ` // no accessibility === public interface Foo { A: string; @@ -3588,7 +3618,7 @@ type Foo = { { code: ` abstract class Foo { - abstract A = () => {}; + abstract A(): void; B: string; } `, @@ -3609,9 +3639,6 @@ abstract class Foo { abstract class Foo { abstract A: () => {}; B: string; - public C() {}; - private D() {}; - abstract E() {}; } `, errors: [ @@ -3629,18 +3656,19 @@ abstract class Foo { { code: ` abstract class Foo { - B: string; - abstract C = () => {}; abstract A: () => {}; + B: string; + public C() {}; + private D() {}; + abstract E() {}; } `, - options: [{ default: ['method', 'constructor', 'field'] }], errors: [ { messageId: 'incorrectGroupOrder', data: { - name: 'C', - rank: 'field', + name: 'B', + rank: 'public abstract field', }, line: 4, column: 5, @@ -3811,8 +3839,8 @@ const sortedWithoutGroupingDefaultOption: TSESLint.RunTests< { code: ` interface Foo { - a(): Foo; (): Foo; + a(): Foo; b(): Foo; } `, @@ -3850,8 +3878,8 @@ type Foo = { a : b; [a: string] : number; b() : void; - new () : Bar; () : Baz; + new () : Bar; } `, options: [{ default: { memberTypes: 'never', order: 'alphabetically' } }], @@ -3968,6 +3996,20 @@ class Foo { `, options: [{ default: { memberTypes: 'never', order: 'alphabetically' } }], }, + + // default option + private identifiers + { + code: ` +class Foo { + #a = 1; + #b = 2; + #c = 3; +} + `, + options: [ + { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, + ], + }, ], invalid: [ // default option + interface + wrong order @@ -3990,6 +4032,13 @@ interface Foo { beforeMember: 'b', }, }, + { + messageId: 'incorrectOrder', + data: { + member: 'call', + beforeMember: 'new', + }, + }, ], }, @@ -4041,6 +4090,13 @@ type Foo = { beforeMember: 'b', }, }, + { + messageId: 'incorrectOrder', + data: { + member: 'call', + beforeMember: 'new', + }, + }, ], }, @@ -4190,10 +4246,10 @@ const sortedWithoutGroupingClassesOption: TSESLint.RunTests< code: ` interface Foo { [a: string] : number; + () : Baz; c : b; new () : Bar; b() : void; - () : Baz; } `, options: [{ classes: { memberTypes: 'never', order: 'alphabetically' } }], @@ -4226,10 +4282,10 @@ interface Foo { code: ` type Foo = { [a: string] : number; + () : Baz; c : b; new () : Bar; b() : void; - () : Baz; } `, options: [{ classes: { memberTypes: 'never', order: 'alphabetically' } }], @@ -4400,10 +4456,10 @@ const sortedWithoutGroupingClassExpressionsOption: TSESLint.RunTests< code: ` interface Foo { [a: string] : number; + () : Baz; c : b; new () : Bar; b() : void; - () : Baz; } `, options: [ @@ -4442,10 +4498,10 @@ interface Foo { code: ` type Foo = { [a: string] : number; + () : Baz; c : b; new () : Bar; b() : void; - () : Baz; } `, options: [ @@ -4639,8 +4695,8 @@ interface Foo { [a: string] : number; a : b; b() : void; - new () : Bar; () : Baz; + new () : Bar; } `, options: [ @@ -4679,10 +4735,10 @@ interface Foo { code: ` type Foo = { [a: string] : number; + () : Baz; c : b; new () : Bar; b() : void; - () : Baz; } `, options: [ @@ -4827,6 +4883,13 @@ interface Foo { beforeMember: 'b', }, }, + { + messageId: 'incorrectOrder', + data: { + member: 'call', + beforeMember: 'new', + }, + }, ], }, @@ -4872,10 +4935,10 @@ const sortedWithoutGroupingTypeLiteralsOption: TSESLint.RunTests< code: ` interface Foo { [a: string] : number; + () : Baz; c : b; new () : Bar; b() : void; - () : Baz; } `, options: [ @@ -4916,8 +4979,8 @@ type Foo = { [a: string] : number; a : b; b() : void; - new () : Bar; () : Baz; + new () : Bar; } `, options: [ @@ -5062,6 +5125,13 @@ type Foo = { beforeMember: 'b', }, }, + { + messageId: 'incorrectOrder', + data: { + member: 'call', + beforeMember: 'new', + }, + }, ], }, @@ -5097,17 +5167,17 @@ type Foo = { ], }; -const sortedWithGroupingDefaultOption: TSESLint.RunTests< - MessageIds, - Options -> = { - valid: [ - // default option + interface + default order + alphabetically - { - code: ` +const sortedWithGroupingDefaultOption: TSESLint.RunTests = + { + valid: [ + // default option + interface + default order + alphabetically + { + code: ` interface Foo { [a: string] : number; + () : Baz; + a : x; b : x; c : x; @@ -5117,18 +5187,16 @@ interface Foo { a() : void; b() : void; c() : void; - - () : Baz; } `, - options: [ - { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, - ], - }, + options: [ + { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, + ], + }, - // default option + interface + custom order + alphabetically - { - code: ` + // default option + interface + custom order + alphabetically + { + code: ` interface Foo { new () : Bar; @@ -5144,22 +5212,24 @@ interface Foo { () : Baz; } `, - options: [ - { - default: { - memberTypes: ['constructor', 'method', 'field'], - order: 'alphabetically', + options: [ + { + default: { + memberTypes: ['constructor', 'method', 'field'], + order: 'alphabetically', + }, }, - }, - ], - }, + ], + }, - // default option + type literal + default order + alphabetically - { - code: ` + // default option + type literal + default order + alphabetically + { + code: ` type Foo = { [a: string] : number; + () : Baz; + a : x; b : x; c : x; @@ -5169,18 +5239,16 @@ type Foo = { a() : void; b() : void; c() : void; - - () : Baz; } `, - options: [ - { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, - ], - }, + options: [ + { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, + ], + }, - // default option + type literal + custom order + alphabetically - { - code: ` + // default option + type literal + custom order + alphabetically + { + code: ` type Foo = { [a: string] : number; @@ -5197,19 +5265,19 @@ type Foo = { () : Baz; } `, - options: [ - { - default: { - memberTypes: ['constructor', 'method', 'field'], - order: 'alphabetically', + options: [ + { + default: { + memberTypes: ['constructor', 'method', 'field'], + order: 'alphabetically', + }, }, - }, - ], - }, + ], + }, - // default option + class + default order + alphabetically - { - code: ` + // default option + class + default order + alphabetically + { + code: ` class Foo { public static a: string; protected static b: string = ""; @@ -5222,13 +5290,68 @@ class Foo { constructor() {} } `, - options: [ - { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, - ], - }, - // default option + class + decorators + default order + alphabetically - { - code: ` + options: [ + { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, + ], + }, + + // default option + class + defaultOrder + alphabetically + { + code: ` +class Foo { + public static a: string; + protected static b: string = ""; + private static c: string = ""; + + public d: string = ""; + protected e: string = ""; + private f: string = ""; + + constructor() {} + + get h() {} + + set g() {} +} + `, + options: [ + { + default: { + memberTypes: defaultOrder, + order: 'alphabetically', + }, + }, + ], + }, + + // default option + class + custom + alphabetically + { + code: ` +class Foo { + get a() {} + + @Bar + get b() {} + + set c() {} + + @Bar + set d() {} +} + `, + options: [ + { + default: { + memberTypes: ['get', 'decorated-get', 'set', 'decorated-set'], + order: 'alphabetically', + }, + }, + ], + }, + + // default option + class + decorators + default order + alphabetically + { + code: ` class Foo { public static a: string; protected static b: string = ""; @@ -5245,14 +5368,14 @@ class Foo { constructor() {} } `, - options: [ - { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, - ], - }, + options: [ + { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, + ], + }, - // default option + class + custom order + alphabetically - { - code: ` + // default option + class + custom order + alphabetically + { + code: ` class Foo { constructor() {} @@ -5265,19 +5388,19 @@ class Foo { private static c: string = ""; } `, - options: [ - { - default: { - memberTypes: ['constructor', 'instance-field', 'static-field'], - order: 'alphabetically', + options: [ + { + default: { + memberTypes: ['constructor', 'instance-field', 'static-field'], + order: 'alphabetically', + }, }, - }, - ], - }, + ], + }, - // default option + class expression + default order + alphabetically - { - code: ` + // default option + class expression + default order + alphabetically + { + code: ` const foo = class Foo { public static a: string; protected static b: string = ""; @@ -5290,14 +5413,14 @@ const foo = class Foo { constructor() {} } `, - options: [ - { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, - ], - }, + options: [ + { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, + ], + }, - // default option + class expression + custom order + alphabetically - { - code: ` + // default option + class expression + custom order + alphabetically + { + code: ` const foo = class Foo { constructor() {} @@ -5310,20 +5433,144 @@ const foo = class Foo { private static c: string = ""; } `, - options: [ - { - default: { - memberTypes: ['constructor', 'instance-field', 'static-field'], - order: 'alphabetically', - }, - }, - ], - }, - ], - invalid: [ - // default option + interface + wrong order within group and wrong group order + alphabetically - { - code: ` + options: [ + { + default: { + memberTypes: ['constructor', 'instance-field', 'static-field'], + order: 'alphabetically', + }, + }, + ], + }, + ], + invalid: [ + // default option + class + wrong order within group and wrong group order + alphabetically + { + code: ` +class FooTestGetter { + public static a: string; + protected static b: string = ""; + private static c: string = ""; + + public d: string = ""; + protected e: string = ""; + private f: string = ""; + + get h() {} + + set g() {} + + constructor() {} +} + `, + options: [ + { + default: { + memberTypes: defaultOrder, + order: 'alphabetically', + }, + }, + ], + errors: [ + { + messageId: 'incorrectGroupOrder', + data: { + name: 'constructor', + rank: 'public instance get', + }, + }, + ], + }, + + // default option + class + custom + alphabetically + { + code: ` +class Foo { + @Bar + get a() {} + + get b() {} + + @Bar + set c() {} + + set d() {} +} + `, + options: [ + { + default: { + memberTypes: ['get', 'decorated-get', 'set', 'decorated-set'], + order: 'alphabetically', + }, + }, + ], + errors: [ + { + messageId: 'incorrectGroupOrder', + data: { + name: 'b', + rank: 'decorated get', + }, + }, + { + messageId: 'incorrectGroupOrder', + data: { + name: 'd', + rank: 'decorated set', + }, + }, + ], + }, + + // default option + class + wrong order within group and wrong group order + alphabetically + { + code: ` +class FooTestGetter { + public static a: string; + protected static b: string = ""; + private static c: string = ""; + + public d: string = ""; + protected e: string = ""; + private f: string = ""; + + set g() {} + + constructor() {} + + get h() {} +} + `, + options: [ + { + default: { + memberTypes: defaultOrder, + order: 'alphabetically', + }, + }, + ], + errors: [ + { + messageId: 'incorrectGroupOrder', + data: { + name: 'constructor', + rank: 'public instance set', + }, + }, + { + messageId: 'incorrectGroupOrder', + data: { + name: 'h', + rank: 'public instance set', + }, + }, + ], + }, + + // default option + interface + wrong order within group and wrong group order + alphabetically + { + code: ` interface Foo { [a: string] : number; @@ -5340,23 +5587,30 @@ interface Foo { new () : Bar; } `, - options: [ - { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, - ], - errors: [ - { - messageId: 'incorrectGroupOrder', - data: { - name: 'new', - rank: 'method', - }, - }, - ], - }, - - // default option + type literal + wrong order within group and wrong group order + alphabetically - { - code: ` + options: [ + { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, + ], + errors: [ + { + messageId: 'incorrectGroupOrder', + data: { + name: 'call', + rank: 'field', + }, + }, + { + messageId: 'incorrectGroupOrder', + data: { + name: 'new', + rank: 'method', + }, + }, + ], + }, + + // default option + type literal + wrong order within group and wrong group order + alphabetically + { + code: ` type Foo = { [a: string] : number; @@ -5373,23 +5627,30 @@ type Foo = { new () : Bar; } `, - options: [ - { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, - ], - errors: [ - { - messageId: 'incorrectGroupOrder', - data: { - name: 'new', - rank: 'method', - }, - }, - ], - }, - - // default option + class + wrong order within group and wrong group order + alphabetically - { - code: ` + options: [ + { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, + ], + errors: [ + { + messageId: 'incorrectGroupOrder', + data: { + name: 'call', + rank: 'field', + }, + }, + { + messageId: 'incorrectGroupOrder', + data: { + name: 'new', + rank: 'method', + }, + }, + ], + }, + + // default option + class + wrong order within group and wrong group order + alphabetically + { + code: ` class Foo { public static c: string = ""; public static b: string = ""; @@ -5400,23 +5661,23 @@ class Foo { public d: string = ""; } `, - options: [ - { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, - ], - errors: [ - { - messageId: 'incorrectGroupOrder', - data: { - name: 'd', - rank: 'public constructor', + options: [ + { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, + ], + errors: [ + { + messageId: 'incorrectGroupOrder', + data: { + name: 'd', + rank: 'public constructor', + }, }, - }, - ], - }, + ], + }, - // default option + class expression + wrong order within group and wrong group order + alphabetically - { - code: ` + // default option + class expression + wrong order within group and wrong group order + alphabetically + { + code: ` const foo = class Foo { public static c: string = ""; public static b: string = ""; @@ -5427,22 +5688,22 @@ const foo = class Foo { public d: string = ""; } `, - options: [ - { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, - ], - errors: [ - { - messageId: 'incorrectGroupOrder', - data: { - name: 'd', - rank: 'public constructor', - }, - }, - ], - }, - // default option + class + decorators + custom order + wrong order within group and wrong group order + alphabetically - { - code: ` + options: [ + { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, + ], + errors: [ + { + messageId: 'incorrectGroupOrder', + data: { + name: 'd', + rank: 'public constructor', + }, + }, + ], + }, + // default option + class + decorators + custom order + wrong order within group and wrong group order + alphabetically + { + code: ` class Foo { @Dec() a1: string; @Dec() @@ -5459,50 +5720,50 @@ class Foo { @Dec() d(): void } `, - options: [ - { - default: { - memberTypes: [ - 'decorated-field', - 'field', - 'constructor', - 'decorated-method', - ], - order: 'alphabetically', - }, - }, - ], - errors: [ - { - messageId: 'incorrectGroupOrder', - data: { - name: 'b1', - rank: 'constructor', - }, - }, - { - messageId: 'incorrectGroupOrder', - data: { - name: 'b2', - rank: 'constructor', - }, - }, - ], - }, - ], -}; - -const sortedWithGroupingClassesOption: TSESLint.RunTests< - MessageIds, - Options -> = { - valid: [ - // classes option + interface + alphabetically --> Default order applies - { - code: ` + options: [ + { + default: { + memberTypes: [ + 'decorated-field', + 'field', + 'constructor', + 'decorated-method', + ], + order: 'alphabetically', + }, + }, + ], + errors: [ + { + messageId: 'incorrectGroupOrder', + data: { + name: 'b1', + rank: 'constructor', + }, + }, + { + messageId: 'incorrectGroupOrder', + data: { + name: 'b2', + rank: 'constructor', + }, + }, + ], + }, + ], + }; + +const sortedWithGroupingClassesOption: TSESLint.RunTests = + { + valid: [ + // classes option + interface + alphabetically --> Default order applies + { + code: ` interface Foo { [a: string] : number; + () : Baz; + c : x; b : x; a : x; @@ -5512,19 +5773,19 @@ interface Foo { c() : void; b() : void; a() : void; - - () : Baz; } `, - options: [{ classes: { order: 'alphabetically' } }], - }, + options: [{ classes: { order: 'alphabetically' } }], + }, - // classes option + type literal + alphabetically --> Default order applies - { - code: ` + // classes option + type literal + alphabetically --> Default order applies + { + code: ` type Foo = { [a: string] : number; + () : Baz; + c : x; b : x; a : x; @@ -5534,16 +5795,14 @@ type Foo = { c() : void; b() : void; a() : void; - - () : Baz; } `, - options: [{ classes: { order: 'alphabetically' } }], - }, + options: [{ classes: { order: 'alphabetically' } }], + }, - // classes option + class + default order + alphabetically - { - code: ` + // classes option + class + default order + alphabetically + { + code: ` class Foo { public static a: string; protected static b: string = ""; @@ -5556,14 +5815,14 @@ class Foo { constructor() {} } `, - options: [ - { classes: { memberTypes: defaultOrder, order: 'alphabetically' } }, - ], - }, + options: [ + { classes: { memberTypes: defaultOrder, order: 'alphabetically' } }, + ], + }, - // classes option + class + custom order + alphabetically - { - code: ` + // classes option + class + custom order + alphabetically + { + code: ` class Foo { constructor() {} @@ -5576,19 +5835,19 @@ class Foo { private static c: string = ""; } `, - options: [ - { - classes: { - memberTypes: ['constructor', 'instance-field', 'static-field'], - order: 'alphabetically', + options: [ + { + classes: { + memberTypes: ['constructor', 'instance-field', 'static-field'], + order: 'alphabetically', + }, }, - }, - ], - }, + ], + }, - // classes option + class expression + alphabetically --> Default order applies - { - code: ` + // classes option + class expression + alphabetically --> Default order applies + { + code: ` const foo = class Foo { public static a: string; protected static b: string = ""; @@ -5601,13 +5860,13 @@ const foo = class Foo { constructor() {} } `, - options: [{ classes: { order: 'alphabetically' } }], - }, - ], - invalid: [ - // default option + class + wrong order within group and wrong group order + alphabetically - { - code: ` + options: [{ classes: { order: 'alphabetically' } }], + }, + ], + invalid: [ + // default option + class + wrong order within group and wrong group order + alphabetically + { + code: ` class Foo { public static c: string = ""; public static b: string = ""; @@ -5618,21 +5877,21 @@ class Foo { public d: string = ""; } `, - options: [ - { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, - ], - errors: [ - { - messageId: 'incorrectGroupOrder', - data: { - name: 'd', - rank: 'public constructor', + options: [ + { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, + ], + errors: [ + { + messageId: 'incorrectGroupOrder', + data: { + name: 'd', + rank: 'public constructor', + }, }, - }, - ], - }, - ], -}; + ], + }, + ], + }; const sortedWithGroupingClassExpressionsOption: TSESLint.RunTests< MessageIds, @@ -5645,6 +5904,8 @@ const sortedWithGroupingClassExpressionsOption: TSESLint.RunTests< interface Foo { [a: string] : number; + () : Baz; + c : x; b : x; a : x; @@ -5654,8 +5915,6 @@ interface Foo { c() : void; b() : void; a() : void; - - () : Baz; } `, options: [{ classExpressions: { order: 'alphabetically' } }], @@ -5667,6 +5926,8 @@ interface Foo { type Foo = { [a: string] : number; + () : Baz; + c : x; b : x; a : x; @@ -5676,8 +5937,6 @@ type Foo = { c() : void; b() : void; a() : void; - - () : Baz; } `, options: [{ classExpressions: { order: 'alphabetically' } }], @@ -5849,6 +6108,8 @@ interface Foo { type Foo = { [a: string] : number; + () : Baz; + c : x; b : x; a : x; @@ -5858,8 +6119,6 @@ type Foo = { c() : void; b() : void; a() : void; - - () : Baz; } `, options: [{ interfaces: { order: 'alphabetically' } }], @@ -5925,6 +6184,13 @@ interface Foo { { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, ], errors: [ + { + messageId: 'incorrectGroupOrder', + data: { + name: 'call', + rank: 'field', + }, + }, { messageId: 'incorrectGroupOrder', data: { @@ -5948,6 +6214,8 @@ const sortedWithGroupingTypeLiteralsOption: TSESLint.RunTests< interface Foo { [a: string] : number; + () : Baz; + c : x; b : x; a : x; @@ -5957,8 +6225,6 @@ interface Foo { c() : void; b() : void; a() : void; - - () : Baz; } `, options: [{ typeLiterals: { order: 'alphabetically' } }], @@ -6081,6 +6347,13 @@ type Foo = { { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, ], errors: [ + { + messageId: 'incorrectGroupOrder', + data: { + name: 'call', + rank: 'field', + }, + }, { messageId: 'incorrectGroupOrder', data: { @@ -6090,6 +6363,32 @@ type Foo = { }, ], }, + + // default option + private identifiers + { + code: ` +class Foo { + #c = 3; + #b = 2; + #a = 1; +} + `, + options: [ + { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, + ], + errors: [ + { + messageId: 'incorrectOrder', + line: 4, + column: 3, + }, + { + messageId: 'incorrectOrder', + line: 5, + column: 3, + }, + ], + }, ], }; diff --git a/packages/eslint-plugin/tests/rules/naming-convention.test.ts b/packages/eslint-plugin/tests/rules/naming-convention.test.ts index f4ed42e3c3e3..d35afe5ed30c 100644 --- a/packages/eslint-plugin/tests/rules/naming-convention.test.ts +++ b/packages/eslint-plugin/tests/rules/naming-convention.test.ts @@ -1,11 +1,12 @@ +/* eslint-disable @typescript-eslint/internal/prefer-ast-types-enum */ import { TSESLint } from '@typescript-eslint/experimental-utils'; import rule, { MessageIds, Options } from '../../src/rules/naming-convention'; import { PredefinedFormatsString, - selectorTypeToMessageString, Selector, + selectorTypeToMessageString, } from '../../src/rules/naming-convention-utils'; -import { RuleTester, getFixturesRootDir } from '../RuleTester'; +import { getFixturesRootDir, RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', @@ -485,7 +486,9 @@ const cases: Cases = [ 'interface Ignored { %: string }', 'type Ignored = { %: string }', 'class Ignored { private % = 1 }', + 'class Ignored { #% = 1 }', 'class Ignored { constructor(private %) {} }', + 'class Ignored { #%() {} }', 'class Ignored { private %() {} }', 'const ignored = { %() {} };', 'class Ignored { private get %() {} }', @@ -561,6 +564,8 @@ const cases: Cases = [ 'class Ignored { private static readonly % = 1 }', 'class Ignored { abstract % = 1 }', 'class Ignored { declare % }', + 'class Ignored { #% }', + 'class Ignored { static #% }', ], options: { selector: 'classProperty', @@ -616,6 +621,8 @@ const cases: Cases = [ 'class Ignored { private % = () => {} }', 'class Ignored { abstract %() }', 'class Ignored { declare %() }', + 'class Ignored { #%() }', + 'class Ignored { static #%() }', ], options: { selector: 'classMethod', @@ -652,6 +659,7 @@ const cases: Cases = [ 'class Ignored { private get %() {} }', 'class Ignored { private set "%"(ignored) {} }', 'class Ignored { private static get %() {} }', + 'class Ignored { static get #%() {} }', ], options: { selector: 'accessor', @@ -1314,7 +1322,7 @@ ruleTester.run('naming-convention', rule, { interface UnusedInterface {} type UnusedType< // this line is intentionally broken out - UnusedTypeParam + UnusedTypeParam, > = {}; export const used_var = 1; @@ -1328,7 +1336,7 @@ ruleTester.run('naming-convention', rule, { export interface used_interface {} export type used_type< // this line is intentionally broken out - used_typeparam + used_typeparam, > = used_typeparam; `, options: [ @@ -2157,7 +2165,7 @@ ruleTester.run('naming-convention', rule, { interface UnusedInterface {} type UnusedType< // this line is intentionally broken out - UnusedTypeParam + UnusedTypeParam, > = {}; `, options: [ 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 3586c3388f4f..e0bdd183a0ee 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 @@ -27,6 +27,7 @@ ruleTester.run('no-confusing-void-expression', rule, { foo && console.log(foo); foo || console.log(foo); foo ? console.log(true) : console.log(false); + console?.log('foo'); `, }), @@ -61,6 +62,7 @@ ruleTester.run('no-confusing-void-expression', rule, { ...batchedSingleLineTests({ code: ` const x = console.log('foo'); + const x = console?.log('foo'); console.error(console.log('foo')); [console.log('foo')]; ({ x: console.log('foo') }); @@ -72,14 +74,15 @@ ruleTester.run('no-confusing-void-expression', rule, { `, errors: [ { line: 2, column: 11, messageId: 'invalidVoidExpr' }, - { line: 3, column: 23, messageId: 'invalidVoidExpr' }, - { line: 4, column: 10, messageId: 'invalidVoidExpr' }, - { line: 5, column: 15, messageId: 'invalidVoidExpr' }, - { line: 6, column: 14, messageId: 'invalidVoidExpr' }, - { line: 7, column: 9, messageId: 'invalidVoidExpr' }, - { line: 8, column: 10, messageId: 'invalidVoidExpr' }, - { line: 9, column: 18, messageId: 'invalidVoidExpr' }, - { line: 10, column: 10, 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' }, ], }), 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 50cbdba54107..5cfbc5e3128d 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 @@ -166,6 +166,28 @@ class A { class A { set foo(value) {} foo() {} +} + `, + errors: [ + { line: 4, column: 3, messageId: 'unexpected', data: { name: 'foo' } }, + ], + }, + { + code: ` +class A { + foo; + foo = 42; +} + `, + errors: [ + { line: 4, column: 3, messageId: 'unexpected', data: { name: 'foo' } }, + ], + }, + { + code: ` +class A { + foo; + foo() {} } `, errors: [ diff --git a/packages/eslint-plugin/tests/rules/no-duplicate-imports.test.ts b/packages/eslint-plugin/tests/rules/no-duplicate-imports.test.ts index 98e12fbeb7a8..fae90720e7ed 100644 --- a/packages/eslint-plugin/tests/rules/no-duplicate-imports.test.ts +++ b/packages/eslint-plugin/tests/rules/no-duplicate-imports.test.ts @@ -168,14 +168,6 @@ ruleTester.run('no-duplicate-imports', rule, { `, errors: [{ messageId: 'import' }], }, - { - code: ` - import foo from 'foo'; - export * from 'foo'; - `, - options: [{ includeExports: true }], - errors: [{ messageId: 'exportAs' }], - }, { code: ` import foo from 'foo'; 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 2694fdbf1042..cb99564c943d 100644 --- a/packages/eslint-plugin/tests/rules/no-explicit-any.test.ts +++ b/packages/eslint-plugin/tests/rules/no-explicit-any.test.ts @@ -235,8 +235,7 @@ interface Qux4 { options: [{ ignoreRestArgs: true }], }, { - code: - 'function quux4(fn: (...args: ReadonlyArray) => void): void {}', + code: 'function quux4(fn: (...args: ReadonlyArray) => void): void {}', options: [{ ignoreRestArgs: true }], }, { @@ -368,831 +367,835 @@ interface Garply4 { options: [{ ignoreRestArgs: true }], }, ], - invalid: ([ - { - code: 'const number: any = 1', - errors: [ - { - messageId: 'unexpectedAny', - line: 1, - column: 15, - }, - ], - }, - { - code: 'function generic(): any {}', - errors: [ - { - messageId: 'unexpectedAny', - line: 1, - column: 21, - }, - ], - }, - { - code: 'function generic(): Array {}', - errors: [ - { - messageId: 'unexpectedAny', - line: 1, - column: 27, - }, - ], - }, - { - code: 'function generic(): any[] {}', - errors: [ - { - messageId: 'unexpectedAny', - line: 1, - column: 21, - }, - ], - }, - { - code: 'function generic(param: Array): number {}', - errors: [ - { - messageId: 'unexpectedAny', - line: 1, - column: 31, - }, - ], - }, - { - code: 'function generic(param: any[]): number {}', - errors: [ - { - messageId: 'unexpectedAny', - line: 1, - column: 25, - }, - ], - }, - { - code: 'function generic(param: Array): Array {}', - errors: [ - { - messageId: 'unexpectedAny', - line: 1, - column: 31, - suggestions: [ - { - messageId: 'suggestUnknown', - output: 'function generic(param: Array): Array {}', - }, - { - messageId: 'suggestNever', - output: 'function generic(param: Array): Array {}', - }, - ], - }, - { - messageId: 'unexpectedAny', - line: 1, - column: 44, - suggestions: [ - { - messageId: 'suggestUnknown', - output: 'function generic(param: Array): Array {}', - }, - { - messageId: 'suggestNever', - output: 'function generic(param: Array): Array {}', - }, - ], - }, - ], - }, - { - code: 'function generic(): Array> {}', - errors: [ - { - messageId: 'unexpectedAny', - line: 1, - column: 33, - }, - ], - }, - { - code: 'function generic(): Array {}', - errors: [ - { - messageId: 'unexpectedAny', - line: 1, - column: 27, - }, - ], - }, - { - code: ` + invalid: ( + [ + { + code: 'const number: any = 1', + errors: [ + { + messageId: 'unexpectedAny', + line: 1, + column: 15, + }, + ], + }, + { + code: 'function generic(): any {}', + errors: [ + { + messageId: 'unexpectedAny', + line: 1, + column: 21, + }, + ], + }, + { + code: 'function generic(): Array {}', + errors: [ + { + messageId: 'unexpectedAny', + line: 1, + column: 27, + }, + ], + }, + { + code: 'function generic(): any[] {}', + errors: [ + { + messageId: 'unexpectedAny', + line: 1, + column: 21, + }, + ], + }, + { + code: 'function generic(param: Array): number {}', + errors: [ + { + messageId: 'unexpectedAny', + line: 1, + column: 31, + }, + ], + }, + { + code: 'function generic(param: any[]): number {}', + errors: [ + { + messageId: 'unexpectedAny', + line: 1, + column: 25, + }, + ], + }, + { + code: 'function generic(param: Array): Array {}', + errors: [ + { + messageId: 'unexpectedAny', + line: 1, + column: 31, + suggestions: [ + { + messageId: 'suggestUnknown', + output: + 'function generic(param: Array): Array {}', + }, + { + messageId: 'suggestNever', + output: 'function generic(param: Array): Array {}', + }, + ], + }, + { + messageId: 'unexpectedAny', + line: 1, + column: 44, + suggestions: [ + { + messageId: 'suggestUnknown', + output: + 'function generic(param: Array): Array {}', + }, + { + messageId: 'suggestNever', + output: 'function generic(param: Array): Array {}', + }, + ], + }, + ], + }, + { + code: 'function generic(): Array> {}', + errors: [ + { + messageId: 'unexpectedAny', + line: 1, + column: 33, + }, + ], + }, + { + code: 'function generic(): Array {}', + errors: [ + { + messageId: 'unexpectedAny', + line: 1, + column: 27, + }, + ], + }, + { + code: ` class Greeter { constructor(param: Array) {} } `, - errors: [ - { - messageId: 'unexpectedAny', - line: 3, - column: 30, - }, - ], - }, - { - code: ` + errors: [ + { + messageId: 'unexpectedAny', + line: 3, + column: 30, + }, + ], + }, + { + code: ` class Greeter { message: any; } `, - errors: [ - { - messageId: 'unexpectedAny', - line: 3, - column: 14, - }, - ], - }, - { - code: ` + errors: [ + { + messageId: 'unexpectedAny', + line: 3, + column: 14, + }, + ], + }, + { + code: ` class Greeter { message: Array; } `, - errors: [ - { - messageId: 'unexpectedAny', - line: 3, - column: 20, - }, - ], - }, - { - code: ` + errors: [ + { + messageId: 'unexpectedAny', + line: 3, + column: 20, + }, + ], + }, + { + code: ` class Greeter { message: any[]; } `, - errors: [ - { - messageId: 'unexpectedAny', - line: 3, - column: 14, - }, - ], - }, - { - code: ` + errors: [ + { + messageId: 'unexpectedAny', + line: 3, + column: 14, + }, + ], + }, + { + code: ` class Greeter { message: Array>; } `, - errors: [ - { - messageId: 'unexpectedAny', - line: 3, - column: 26, - }, - ], - }, - { - code: ` + errors: [ + { + messageId: 'unexpectedAny', + line: 3, + column: 26, + }, + ], + }, + { + code: ` class Greeter { message: Array; } `, - errors: [ - { - messageId: 'unexpectedAny', - line: 3, - column: 20, - }, - ], - }, - { - code: ` + errors: [ + { + messageId: 'unexpectedAny', + line: 3, + column: 20, + }, + ], + }, + { + code: ` interface Greeter { message: any; } `, - errors: [ - { - messageId: 'unexpectedAny', - line: 3, - column: 14, - }, - ], - }, - { - code: ` + errors: [ + { + messageId: 'unexpectedAny', + line: 3, + column: 14, + }, + ], + }, + { + code: ` interface Greeter { message: Array; } `, - errors: [ - { - messageId: 'unexpectedAny', - line: 3, - column: 20, - }, - ], - }, - { - code: ` + errors: [ + { + messageId: 'unexpectedAny', + line: 3, + column: 20, + }, + ], + }, + { + code: ` interface Greeter { message: any[]; } `, - errors: [ - { - messageId: 'unexpectedAny', - line: 3, - column: 14, - }, - ], - }, - { - code: ` + errors: [ + { + messageId: 'unexpectedAny', + line: 3, + column: 14, + }, + ], + }, + { + code: ` interface Greeter { message: Array>; } `, - errors: [ - { - messageId: 'unexpectedAny', - line: 3, - column: 26, - }, - ], - }, - { - code: ` + errors: [ + { + messageId: 'unexpectedAny', + line: 3, + column: 26, + }, + ], + }, + { + code: ` interface Greeter { message: Array; } `, - errors: [ - { - messageId: 'unexpectedAny', - line: 3, - column: 20, - }, - ], - }, - { - code: ` + errors: [ + { + messageId: 'unexpectedAny', + line: 3, + column: 20, + }, + ], + }, + { + code: ` type obj = { message: any; } `, - errors: [ - { - messageId: 'unexpectedAny', - line: 3, - column: 14, - }, - ], - }, - { - code: ` + errors: [ + { + messageId: 'unexpectedAny', + line: 3, + column: 14, + }, + ], + }, + { + code: ` type obj = { message: Array; } `, - errors: [ - { - messageId: 'unexpectedAny', - line: 3, - column: 20, - }, - ], - }, - { - code: ` + errors: [ + { + messageId: 'unexpectedAny', + line: 3, + column: 20, + }, + ], + }, + { + code: ` type obj = { message: any[]; } `, - errors: [ - { - messageId: 'unexpectedAny', - line: 3, - column: 14, - }, - ], - }, - { - code: ` + errors: [ + { + messageId: 'unexpectedAny', + line: 3, + column: 14, + }, + ], + }, + { + code: ` type obj = { message: Array>; } `, - errors: [ - { - messageId: 'unexpectedAny', - line: 3, - column: 26, - }, - ], - }, - { - code: ` + errors: [ + { + messageId: 'unexpectedAny', + line: 3, + column: 26, + }, + ], + }, + { + code: ` type obj = { message: Array; } `, - errors: [ - { - messageId: 'unexpectedAny', - line: 3, - column: 20, - }, - ], - }, - { - code: ` + errors: [ + { + messageId: 'unexpectedAny', + line: 3, + column: 20, + }, + ], + }, + { + code: ` type obj = { message: string | any; } `, - errors: [ - { - messageId: 'unexpectedAny', - line: 3, - column: 23, - }, - ], - }, - { - code: ` + errors: [ + { + messageId: 'unexpectedAny', + line: 3, + column: 23, + }, + ], + }, + { + code: ` type obj = { message: string | Array; } `, - errors: [ - { - messageId: 'unexpectedAny', - line: 3, - column: 29, - }, - ], - }, - { - code: ` + errors: [ + { + messageId: 'unexpectedAny', + line: 3, + column: 29, + }, + ], + }, + { + code: ` type obj = { message: string | any[]; } `, - errors: [ - { - messageId: 'unexpectedAny', - line: 3, - column: 23, - }, - ], - }, - { - code: ` + errors: [ + { + messageId: 'unexpectedAny', + line: 3, + column: 23, + }, + ], + }, + { + code: ` type obj = { message: string | Array>; } `, - errors: [ - { - messageId: 'unexpectedAny', - line: 3, - column: 35, - }, - ], - }, - { - code: ` + errors: [ + { + messageId: 'unexpectedAny', + line: 3, + column: 35, + }, + ], + }, + { + code: ` type obj = { message: string | Array; } `, - errors: [ - { - messageId: 'unexpectedAny', - line: 3, - column: 29, - }, - ], - }, - { - code: ` + errors: [ + { + messageId: 'unexpectedAny', + line: 3, + column: 29, + }, + ], + }, + { + code: ` type obj = { message: string & any; } `, - errors: [ - { - messageId: 'unexpectedAny', - line: 3, - column: 23, - }, - ], - }, - { - code: ` + errors: [ + { + messageId: 'unexpectedAny', + line: 3, + column: 23, + }, + ], + }, + { + code: ` type obj = { message: string & Array; } `, - errors: [ - { - messageId: 'unexpectedAny', - line: 3, - column: 29, - }, - ], - }, - { - code: ` + errors: [ + { + messageId: 'unexpectedAny', + line: 3, + column: 29, + }, + ], + }, + { + code: ` type obj = { message: string & any[]; } `, - errors: [ - { - messageId: 'unexpectedAny', - line: 3, - column: 23, - }, - ], - }, - { - code: ` + errors: [ + { + messageId: 'unexpectedAny', + line: 3, + column: 23, + }, + ], + }, + { + code: ` type obj = { message: string & Array>; } `, - errors: [ - { - messageId: 'unexpectedAny', - line: 3, - column: 35, - }, - ], - }, - { - code: ` + errors: [ + { + messageId: 'unexpectedAny', + line: 3, + column: 35, + }, + ], + }, + { + code: ` type obj = { message: string & Array; } `, - errors: [ - { - messageId: 'unexpectedAny', - line: 3, - column: 29, - }, - ], - }, - { - code: 'class Foo extends Bar {}', - errors: [ - { - messageId: 'unexpectedAny', - line: 1, - column: 15, - suggestions: [ - { - messageId: 'suggestUnknown', - output: 'class Foo extends Bar {}', - }, - { - messageId: 'suggestNever', - output: 'class Foo extends Bar {}', - }, - ], - }, - { - messageId: 'unexpectedAny', - line: 1, - column: 32, - suggestions: [ - { - messageId: 'suggestUnknown', - output: 'class Foo extends Bar {}', - }, - { - messageId: 'suggestNever', - output: 'class Foo extends Bar {}', - }, - ], - }, - ], - }, - { - code: 'abstract class Foo extends Bar {}', - errors: [ - { - messageId: 'unexpectedAny', - line: 1, - column: 24, - suggestions: [ - { - messageId: 'suggestUnknown', - output: 'abstract class Foo extends Bar {}', - }, - { - messageId: 'suggestNever', - output: 'abstract class Foo extends Bar {}', - }, - ], - }, - { - messageId: 'unexpectedAny', - line: 1, - column: 41, - suggestions: [ - { - messageId: 'suggestUnknown', - output: 'abstract class Foo extends Bar {}', - }, - { - messageId: 'suggestNever', - output: 'abstract class Foo extends Bar {}', - }, - ], - }, - ], - }, - { - code: 'abstract class Foo implements Bar, Baz {}', - errors: [ - { - messageId: 'unexpectedAny', - line: 1, - column: 24, - suggestions: [ - { - messageId: 'suggestUnknown', - output: - 'abstract class Foo implements Bar, Baz {}', - }, - { - messageId: 'suggestNever', - output: - 'abstract class Foo implements Bar, Baz {}', - }, - ], - }, - { - messageId: 'unexpectedAny', - line: 1, - column: 44, - suggestions: [ - { - messageId: 'suggestUnknown', - output: - 'abstract class Foo implements Bar, Baz {}', - }, - { - messageId: 'suggestNever', - output: - 'abstract class Foo implements Bar, Baz {}', - }, - ], - }, - { - messageId: 'unexpectedAny', - line: 1, - column: 54, - suggestions: [ - { - messageId: 'suggestUnknown', - output: - 'abstract class Foo implements Bar, Baz {}', - }, - { - messageId: 'suggestNever', - output: - 'abstract class Foo implements Bar, Baz {}', - }, - ], - }, - ], - }, - { - code: 'new Foo()', - errors: [ - { - messageId: 'unexpectedAny', - line: 1, - column: 9, - }, - ], - }, - { - code: 'Foo()', - errors: [ - { - messageId: 'unexpectedAny', - line: 1, - column: 5, - }, - ], - }, - { - // https://github.com/typescript-eslint/typescript-eslint/issues/64 - code: ` + errors: [ + { + messageId: 'unexpectedAny', + line: 3, + column: 29, + }, + ], + }, + { + code: 'class Foo extends Bar {}', + errors: [ + { + messageId: 'unexpectedAny', + line: 1, + column: 15, + suggestions: [ + { + messageId: 'suggestUnknown', + output: 'class Foo extends Bar {}', + }, + { + messageId: 'suggestNever', + output: 'class Foo extends Bar {}', + }, + ], + }, + { + messageId: 'unexpectedAny', + line: 1, + column: 32, + suggestions: [ + { + messageId: 'suggestUnknown', + output: 'class Foo extends Bar {}', + }, + { + messageId: 'suggestNever', + output: 'class Foo extends Bar {}', + }, + ], + }, + ], + }, + { + code: 'abstract class Foo extends Bar {}', + errors: [ + { + messageId: 'unexpectedAny', + line: 1, + column: 24, + suggestions: [ + { + messageId: 'suggestUnknown', + output: 'abstract class Foo extends Bar {}', + }, + { + messageId: 'suggestNever', + output: 'abstract class Foo extends Bar {}', + }, + ], + }, + { + messageId: 'unexpectedAny', + line: 1, + column: 41, + suggestions: [ + { + messageId: 'suggestUnknown', + output: 'abstract class Foo extends Bar {}', + }, + { + messageId: 'suggestNever', + output: 'abstract class Foo extends Bar {}', + }, + ], + }, + ], + }, + { + code: 'abstract class Foo implements Bar, Baz {}', + errors: [ + { + messageId: 'unexpectedAny', + line: 1, + column: 24, + suggestions: [ + { + messageId: 'suggestUnknown', + output: + 'abstract class Foo implements Bar, Baz {}', + }, + { + messageId: 'suggestNever', + output: + 'abstract class Foo implements Bar, Baz {}', + }, + ], + }, + { + messageId: 'unexpectedAny', + line: 1, + column: 44, + suggestions: [ + { + messageId: 'suggestUnknown', + output: + 'abstract class Foo implements Bar, Baz {}', + }, + { + messageId: 'suggestNever', + output: + 'abstract class Foo implements Bar, Baz {}', + }, + ], + }, + { + messageId: 'unexpectedAny', + line: 1, + column: 54, + suggestions: [ + { + messageId: 'suggestUnknown', + output: + 'abstract class Foo implements Bar, Baz {}', + }, + { + messageId: 'suggestNever', + output: + 'abstract class Foo implements Bar, Baz {}', + }, + ], + }, + ], + }, + { + code: 'new Foo()', + errors: [ + { + messageId: 'unexpectedAny', + line: 1, + column: 9, + }, + ], + }, + { + code: 'Foo()', + errors: [ + { + messageId: 'unexpectedAny', + line: 1, + column: 5, + }, + ], + }, + { + // https://github.com/typescript-eslint/typescript-eslint/issues/64 + code: ` function test>() {} const test = >() => {}; `.trimRight(), - errors: [ - { - messageId: 'unexpectedAny', - line: 2, - column: 33, - suggestions: [ - { - messageId: 'suggestUnknown', - output: ` + errors: [ + { + messageId: 'unexpectedAny', + line: 2, + column: 33, + suggestions: [ + { + messageId: 'suggestUnknown', + output: ` function test>() {} const test = >() => {}; `.trimRight(), - }, - { - messageId: 'suggestNever', - output: ` + }, + { + messageId: 'suggestNever', + output: ` function test>() {} const test = >() => {}; `.trimRight(), - }, - ], - }, - { - messageId: 'unexpectedAny', - line: 3, - column: 33, - suggestions: [ - { - messageId: 'suggestUnknown', - output: ` + }, + ], + }, + { + messageId: 'unexpectedAny', + line: 3, + column: 33, + suggestions: [ + { + messageId: 'suggestUnknown', + output: ` function test>() {} const test = >() => {}; `.trimRight(), - }, - { - messageId: 'suggestNever', - output: ` + }, + { + messageId: 'suggestNever', + output: ` function test>() {} const test = >() => {}; `.trimRight(), - }, - ], - }, - ], - }, - { - // https://github.com/eslint/typescript-eslint-parser/issues/397 - code: ` + }, + ], + }, + ], + }, + { + // https://github.com/eslint/typescript-eslint-parser/issues/397 + code: ` function foo(a: number, ...rest: any[]): void { return; } `, - errors: [ - { - messageId: 'unexpectedAny', - line: 2, - column: 42, - }, - ], - }, - { - code: 'type Any = any;', - options: [{ ignoreRestArgs: true }], - errors: [ - { - messageId: 'unexpectedAny', - line: 1, - column: 12, - }, - ], - }, - { - code: 'function foo5(...args: any) {}', - options: [{ ignoreRestArgs: true }], - errors: [ - { - messageId: 'unexpectedAny', - line: 1, - column: 24, - }, - ], - }, - { - code: 'const bar5 = function (...args: any) {}', - options: [{ ignoreRestArgs: true }], - errors: [ - { - messageId: 'unexpectedAny', - line: 1, - column: 33, - }, - ], - }, - { - code: 'const baz5 = (...args: any) => {}', - options: [{ ignoreRestArgs: true }], - errors: [ - { - messageId: 'unexpectedAny', - line: 1, - column: 24, - }, - ], - }, - { - code: 'interface Qux5 { (...args: any): void; }', - options: [{ ignoreRestArgs: true }], - errors: [ - { - messageId: 'unexpectedAny', - line: 1, - column: 28, - }, - ], - }, - { - code: 'function quux5(fn: (...args: any) => void): void {}', - options: [{ ignoreRestArgs: true }], - errors: [ - { - messageId: 'unexpectedAny', - line: 1, - column: 30, - }, - ], - }, - { - code: 'function quuz5(): ((...args: any) => void) {}', - options: [{ ignoreRestArgs: true }], - errors: [ - { - messageId: 'unexpectedAny', - line: 1, - column: 30, - }, - ], - }, - { - code: 'type Fred5 = (...args: any) => void;', - options: [{ ignoreRestArgs: true }], - errors: [ - { - messageId: 'unexpectedAny', - line: 1, - column: 24, - }, - ], - }, - { - code: 'type Corge5 = new (...args: any) => void;', - options: [{ ignoreRestArgs: true }], - errors: [ - { - messageId: 'unexpectedAny', - line: 1, - column: 29, - }, - ], - }, - { - code: 'interface Grault5 { new (...args: any): void; }', - options: [{ ignoreRestArgs: true }], - errors: [ - { - messageId: 'unexpectedAny', - line: 1, - column: 35, - }, - ], - }, - { - code: 'interface Garply5 { f(...args: any): void; }', - options: [{ ignoreRestArgs: true }], - errors: [ - { - messageId: 'unexpectedAny', - line: 1, - column: 32, - }, - ], - }, - { - code: 'declare function waldo5(...args: any): void;', - options: [{ ignoreRestArgs: true }], - errors: [ - { - messageId: 'unexpectedAny', - line: 1, - column: 34, - }, - ], - }, - ] as InvalidTestCase[]).reduce((acc, testCase) => { + errors: [ + { + messageId: 'unexpectedAny', + line: 2, + column: 42, + }, + ], + }, + { + code: 'type Any = any;', + options: [{ ignoreRestArgs: true }], + errors: [ + { + messageId: 'unexpectedAny', + line: 1, + column: 12, + }, + ], + }, + { + code: 'function foo5(...args: any) {}', + options: [{ ignoreRestArgs: true }], + errors: [ + { + messageId: 'unexpectedAny', + line: 1, + column: 24, + }, + ], + }, + { + code: 'const bar5 = function (...args: any) {}', + options: [{ ignoreRestArgs: true }], + errors: [ + { + messageId: 'unexpectedAny', + line: 1, + column: 33, + }, + ], + }, + { + code: 'const baz5 = (...args: any) => {}', + options: [{ ignoreRestArgs: true }], + errors: [ + { + messageId: 'unexpectedAny', + line: 1, + column: 24, + }, + ], + }, + { + code: 'interface Qux5 { (...args: any): void; }', + options: [{ ignoreRestArgs: true }], + errors: [ + { + messageId: 'unexpectedAny', + line: 1, + column: 28, + }, + ], + }, + { + code: 'function quux5(fn: (...args: any) => void): void {}', + options: [{ ignoreRestArgs: true }], + errors: [ + { + messageId: 'unexpectedAny', + line: 1, + column: 30, + }, + ], + }, + { + code: 'function quuz5(): ((...args: any) => void) {}', + options: [{ ignoreRestArgs: true }], + errors: [ + { + messageId: 'unexpectedAny', + line: 1, + column: 30, + }, + ], + }, + { + code: 'type Fred5 = (...args: any) => void;', + options: [{ ignoreRestArgs: true }], + errors: [ + { + messageId: 'unexpectedAny', + line: 1, + column: 24, + }, + ], + }, + { + code: 'type Corge5 = new (...args: any) => void;', + options: [{ ignoreRestArgs: true }], + errors: [ + { + messageId: 'unexpectedAny', + line: 1, + column: 29, + }, + ], + }, + { + code: 'interface Grault5 { new (...args: any): void; }', + options: [{ ignoreRestArgs: true }], + errors: [ + { + messageId: 'unexpectedAny', + line: 1, + column: 35, + }, + ], + }, + { + code: 'interface Garply5 { f(...args: any): void; }', + options: [{ ignoreRestArgs: true }], + errors: [ + { + messageId: 'unexpectedAny', + line: 1, + column: 32, + }, + ], + }, + { + code: 'declare function waldo5(...args: any): void;', + options: [{ ignoreRestArgs: true }], + errors: [ + { + messageId: 'unexpectedAny', + line: 1, + column: 34, + }, + ], + }, + ] as InvalidTestCase[] + ).reduce((acc, testCase) => { const suggestions = (code: string): SuggestionOutput[] => [ { messageId: 'suggestUnknown', 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 d0868e8293de..5f5dc37896fa 100644 --- a/packages/eslint-plugin/tests/rules/no-extra-parens.test.ts +++ b/packages/eslint-plugin/tests/rules/no-extra-parens.test.ts @@ -28,7 +28,7 @@ for (a in b, c); for (a in b); a(1); new a(1); -a<(A)>(1); +a(1); `, }), ...batchedSingleLineTests({ 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 db3ca1735325..4d2d870e7e50 100644 --- a/packages/eslint-plugin/tests/rules/no-extra-semi.test.ts +++ b/packages/eslint-plugin/tests/rules/no-extra-semi.test.ts @@ -32,7 +32,6 @@ ruleTester.run('no-extra-semi', rule, { }, { code: 'for(a of b);', - parserOptions: { ecmaVersion: 6 }, }, { code: 'if(true);', @@ -50,23 +49,18 @@ ruleTester.run('no-extra-semi', rule, { // Class body. { code: 'class A { }', - parserOptions: { ecmaVersion: 6 }, }, { code: 'var A = class { };', - parserOptions: { ecmaVersion: 6 }, }, { code: 'class A { a() { this; } }', - parserOptions: { ecmaVersion: 6 }, }, { code: 'var A = class { a() { this; } };', - parserOptions: { ecmaVersion: 6 }, }, { code: 'class A { } a;', - parserOptions: { ecmaVersion: 6 }, }, // modules @@ -159,7 +153,6 @@ export class Foo { { code: 'for(a of b);;', output: 'for(a of b);', - parserOptions: { ecmaVersion: 6 }, errors: [ { messageId: 'unexpected', @@ -228,7 +221,6 @@ export class Foo { { code: 'class A { ; }', output: 'class A { }', - parserOptions: { ecmaVersion: 6 }, errors: [ { messageId: 'unexpected', @@ -239,7 +231,6 @@ export class Foo { { code: 'class A { /*a*/; }', output: 'class A { /*a*/ }', - parserOptions: { ecmaVersion: 6 }, errors: [ { messageId: 'unexpected', @@ -250,7 +241,6 @@ export class Foo { { code: 'class A { ; a() {} }', output: 'class A { a() {} }', - parserOptions: { ecmaVersion: 6 }, errors: [ { messageId: 'unexpected', @@ -261,7 +251,6 @@ export class Foo { { code: 'class A { a() {}; }', output: 'class A { a() {} }', - parserOptions: { ecmaVersion: 6 }, errors: [ { messageId: 'unexpected', @@ -272,7 +261,6 @@ export class Foo { { code: 'class A { a() {}; b() {} }', output: 'class A { a() {} b() {} }', - parserOptions: { ecmaVersion: 6 }, errors: [ { messageId: 'unexpected', @@ -283,7 +271,6 @@ export class Foo { { code: 'class A {; a() {}; b() {}; }', output: 'class A { a() {} b() {} }', - parserOptions: { ecmaVersion: 6 }, errors: [ { messageId: 'unexpected', @@ -302,7 +289,6 @@ export class Foo { { code: 'class A { a() {}; get b() {} }', output: 'class A { a() {} get b() {} }', - parserOptions: { ecmaVersion: 6 }, errors: [ { messageId: 'unexpected', @@ -321,7 +307,6 @@ class Foo { public foo: number = 0; } `, - parserOptions: { ecmaVersion: 6 }, errors: [ { messageId: 'unexpected', @@ -342,7 +327,6 @@ class Foo { public baz: number = 1; } `, - parserOptions: { ecmaVersion: 6 }, errors: [ { messageId: 'unexpected', @@ -361,5 +345,88 @@ class Foo { }, ], }, + + // abstract prop/method + { + code: ` +class Foo { + abstract foo: number;; abstract bar: number;; + abstract baz: number;; +} + `, + output: ` +class Foo { + abstract foo: number; abstract bar: number; + abstract baz: number; +} + `, + errors: [ + { + messageId: 'unexpected', + line: 3, + column: 24, + }, + { + messageId: 'unexpected', + line: 3, + column: 47, + }, + { + messageId: 'unexpected', + line: 4, + column: 24, + }, + ], + }, + { + code: ` +class Foo { + abstract foo();; abstract bar();; + abstract baz();; + abstract foo(): void;; abstract bar(): void;; + abstract baz(): void;; +} + `, + output: ` +class Foo { + abstract foo(); abstract bar(); + abstract baz(); + abstract foo(): void; abstract bar(): void; + abstract baz(): void; +} + `, + errors: [ + { + messageId: 'unexpected', + line: 3, + column: 18, + }, + { + messageId: 'unexpected', + line: 3, + column: 35, + }, + { + messageId: 'unexpected', + line: 4, + column: 18, + }, + { + messageId: 'unexpected', + line: 5, + column: 24, + }, + { + messageId: 'unexpected', + line: 5, + column: 47, + }, + { + messageId: 'unexpected', + line: 6, + column: 24, + }, + ], + }, ], }); 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 2bb96f196ef1..44d32490a102 100644 --- a/packages/eslint-plugin/tests/rules/no-extraneous-class.test.ts +++ b/packages/eslint-plugin/tests/rules/no-extraneous-class.test.ts @@ -76,6 +76,19 @@ class Foo {} `, options: [{ allowWithDecorator: true }], }, + { + code: ` +@FooDecorator +class Foo { + constructor(foo: Foo) { + foo.subscribe(a => { + console.log(a); + }); + } +} + `, + options: [{ allowWithDecorator: true }], + }, ], invalid: [ @@ -150,5 +163,23 @@ class Foo {} }, ], }, + { + code: ` +@FooDecorator +class Foo { + constructor(foo: Foo) { + foo.subscribe(a => { + console.log(a); + }); + } +} + `, + options: [{ allowWithDecorator: false }], + errors: [ + { + messageId: 'onlyConstructor', + }, + ], + }, ], }); 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 de619abbc8b5..c789bd311211 100644 --- a/packages/eslint-plugin/tests/rules/no-implied-eval.test.ts +++ b/packages/eslint-plugin/tests/rules/no-implied-eval.test.ts @@ -256,6 +256,27 @@ const foo = () => {}; const bar = () => {}; setTimeout(Math.radom() > 0.5 ? foo : bar, 0); +setTimeout(foo || bar, 500); + `, + ` +class Foo { + func1() {} + func2(): void { + setTimeout(this.func1.bind(this), 1); + } +} + `, + ` +class Foo { + private a = { + b: { + c: function () {}, + }, + }; + funcw(): void { + setTimeout(this.a.b.c.bind(this), 1); + } +} `, ], @@ -796,6 +817,21 @@ globalThis['execScript'](\`\`); }, ], }, + { + code: ` +const foo: string | undefined = 'hello'; +const bar = () => {}; + +setTimeout(foo || bar, 500); + `, + errors: [ + { + messageId: 'noImpliedEvalError', + line: 5, + column: 12, + }, + ], + }, { code: 'const fn = Function();', errors: [ 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 0f7bb141f1b6..fc216c6c4764 100644 --- a/packages/eslint-plugin/tests/rules/no-inferrable-types.test.ts +++ b/packages/eslint-plugin/tests/rules/no-inferrable-types.test.ts @@ -72,27 +72,25 @@ const testCases = [ const validTestCases = flatten( testCases.map(c => c.code.map(code => `const a = ${code}`)), ); -const invalidTestCases: TSESLint.InvalidTestCase< - MessageIds, - Options ->[] = flatten( - testCases.map(cas => - cas.code.map(code => ({ - code: `const a: ${cas.type} = ${code}`, - output: `const a = ${code}`, - errors: [ - { - messageId: 'noInferrableType', - data: { - type: cas.type, +const invalidTestCases: TSESLint.InvalidTestCase[] = + flatten( + testCases.map(cas => + cas.code.map(code => ({ + code: `const a: ${cas.type} = ${code}`, + output: `const a = ${code}`, + errors: [ + { + messageId: 'noInferrableType', + data: { + type: cas.type, + }, + line: 1, + column: 7, }, - line: 1, - column: 7, - }, - ], - })), - ), -); + ], + })), + ), + ); const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', @@ -124,18 +122,15 @@ class Foo { "const fn = function (a: any = 5, b: any = true, c: any = 'foo') {};", { - code: - "const fn = (a: number = 5, b: boolean = true, c: string = 'foo') => {};", + code: "const fn = (a: number = 5, b: boolean = true, c: string = 'foo') => {};", options: [{ ignoreParameters: true }], }, { - code: - "function fn(a: number = 5, b: boolean = true, c: string = 'foo') {}", + code: "function fn(a: number = 5, b: boolean = true, c: string = 'foo') {}", options: [{ ignoreParameters: true }], }, { - code: - "const fn = function (a: number = 5, b: boolean = true, c: string = 'foo') {};", + code: "const fn = function (a: number = 5, b: boolean = true, c: string = 'foo') {};", options: [{ ignoreParameters: true }], }, { @@ -163,8 +158,7 @@ class Foo { ...invalidTestCases, { - code: - "const fn = (a: number = 5, b: boolean = true, c: string = 'foo') => {};", + code: "const fn = (a: number = 5, b: boolean = true, c: string = 'foo') => {};", output: "const fn = (a = 5, b = true, c = 'foo') => {};", options: [ { 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 56df4f47ab6f..0141da093b50 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 @@ -202,8 +202,7 @@ ruleTester.run('allowInGenericTypeArguments: true', rule, { ], }, { - code: - 'declare function functionDeclaration(arg: T): void;', + code: 'declare function functionDeclaration(arg: T): void;', errors: [ { messageId: 'invalidVoidNotReturnOrGeneric', @@ -223,8 +222,7 @@ ruleTester.run('allowInGenericTypeArguments: true', rule, { ], }, { - code: - 'declare function functionDeclaration2(arg: T): void;', + code: 'declare function functionDeclaration2(arg: T): void;', errors: [ { messageId: 'invalidVoidNotReturnOrGeneric', 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 f2405bacdb6b..cd783915b4dc 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 @@ -28,8 +28,7 @@ ruleTester.run('no-loss-of-precision', rule, { errors: [{ messageId: 'noLossOfPrecision' }], }, { - code: - 'const x = 0b100_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_001;', + code: 'const x = 0b100_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_001;', errors: [{ messageId: 'noLossOfPrecision' }], }, ], 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 new file mode 100644 index 000000000000..5e034f2904b0 --- /dev/null +++ b/packages/eslint-plugin/tests/rules/no-meaningless-void-operator.test.ts @@ -0,0 +1,90 @@ +import rule from '../../src/rules/no-meaningless-void-operator'; +import { RuleTester, getFixturesRootDir } from '../RuleTester'; + +const rootDir = getFixturesRootDir(); + +const ruleTester = new RuleTester({ + parserOptions: { + ecmaVersion: 2018, + tsconfigRootDir: rootDir, + project: './tsconfig.json', + }, + parser: '@typescript-eslint/parser', +}); + +ruleTester.run('no-meaningless-void-operator', rule, { + valid: [ + ` +(() => {})(); + +function foo() {} +foo(); // nothing to discard + +function bar(x: number) { + void x; + return 2; +} +void bar(); // discarding a number + `, + ` +function bar(x: never) { + void x; +} + `, + ], + invalid: [ + { + code: 'void (() => {})();', + output: '(() => {})();', + errors: [ + { + messageId: 'meaninglessVoidOperator', + line: 1, + column: 1, + }, + ], + }, + { + code: ` +function foo() {} +void foo(); + `, + output: ` +function foo() {} +foo(); + `, + errors: [ + { + messageId: 'meaninglessVoidOperator', + line: 3, + column: 1, + }, + ], + }, + { + options: [{ checkNever: true }], + code: ` +function bar(x: never) { + void x; +} + `.trimRight(), + errors: [ + { + messageId: 'meaninglessVoidOperator', + line: 3, + column: 3, + suggestions: [ + { + messageId: 'removeVoid', + output: ` +function bar(x: never) { + x; +} + `.trimRight(), + }, + ], + }, + ], + }, + ], +}); 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 new file mode 100644 index 000000000000..3b47a3c2bf00 --- /dev/null +++ b/packages/eslint-plugin/tests/rules/no-non-null-asserted-nullish-coalescing.test.ts @@ -0,0 +1,332 @@ +import rule from '../../src/rules/no-non-null-asserted-nullish-coalescing'; +import { RuleTester, noFormat } from '../RuleTester'; + +const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', +}); + +ruleTester.run('no-non-null-asserted-nullish-coalescing', rule, { + valid: [ + 'foo ?? bar;', + 'foo ?? bar!;', + 'foo.bazz ?? bar;', + 'foo.bazz ?? bar!;', + 'foo!.bazz ?? bar;', + 'foo!.bazz ?? bar!;', + 'foo() ?? bar;', + 'foo() ?? bar!;', + '(foo ?? bar)!;', + ` + let x: string; + x! ?? ''; + `, + ` + let x: string; + x ?? ''; + `, + ` + let x!: string; + x ?? ''; + `, + ` + let x: string; + foo(x); + x! ?? ''; + `, + ` + let x: string; + x! ?? ''; + x = foo(); + `, + ` + let x: string; + foo(x); + x! ?? ''; + x = foo(); + `, + ` + let x = foo(); + x ?? ''; + `, + ` + function foo() { + let x: string; + return x ?? ''; + } + `, + ` + let x: string; + function foo() { + return x ?? ''; + } + `, + ], + invalid: [ + { + code: 'foo! ?? bar;', + errors: [ + { + messageId: 'noNonNullAssertedNullishCoalescing', + suggestions: [ + { + messageId: 'suggestRemovingNonNull', + output: 'foo ?? bar;', + }, + ], + }, + ], + }, + { + code: 'foo! ?? bar!;', + errors: [ + { + messageId: 'noNonNullAssertedNullishCoalescing', + suggestions: [ + { + messageId: 'suggestRemovingNonNull', + output: 'foo ?? bar!;', + }, + ], + }, + ], + }, + { + code: 'foo.bazz! ?? bar;', + errors: [ + { + messageId: 'noNonNullAssertedNullishCoalescing', + suggestions: [ + { + messageId: 'suggestRemovingNonNull', + output: 'foo.bazz ?? bar;', + }, + ], + }, + ], + }, + { + code: 'foo.bazz! ?? bar!;', + errors: [ + { + messageId: 'noNonNullAssertedNullishCoalescing', + suggestions: [ + { + messageId: 'suggestRemovingNonNull', + output: 'foo.bazz ?? bar!;', + }, + ], + }, + ], + }, + { + code: 'foo!.bazz! ?? bar;', + errors: [ + { + messageId: 'noNonNullAssertedNullishCoalescing', + suggestions: [ + { + messageId: 'suggestRemovingNonNull', + output: 'foo!.bazz ?? bar;', + }, + ], + }, + ], + }, + { + code: 'foo!.bazz! ?? bar!;', + errors: [ + { + messageId: 'noNonNullAssertedNullishCoalescing', + suggestions: [ + { + messageId: 'suggestRemovingNonNull', + output: 'foo!.bazz ?? bar!;', + }, + ], + }, + ], + }, + { + code: 'foo()! ?? bar;', + errors: [ + { + messageId: 'noNonNullAssertedNullishCoalescing', + suggestions: [ + { + messageId: 'suggestRemovingNonNull', + output: 'foo() ?? bar;', + }, + ], + }, + ], + }, + { + code: 'foo()! ?? bar!;', + errors: [ + { + messageId: 'noNonNullAssertedNullishCoalescing', + suggestions: [ + { + messageId: 'suggestRemovingNonNull', + output: 'foo() ?? bar!;', + }, + ], + }, + ], + }, + { + code: ` +let x!: string; +x! ?? ''; + `.trimRight(), + errors: [ + { + messageId: 'noNonNullAssertedNullishCoalescing', + suggestions: [ + { + messageId: 'suggestRemovingNonNull', + output: ` +let x!: string; +x ?? ''; + `.trimRight(), + }, + ], + }, + ], + }, + { + code: ` +let x: string; +x = foo(); +x! ?? ''; + `.trimRight(), + errors: [ + { + messageId: 'noNonNullAssertedNullishCoalescing', + suggestions: [ + { + messageId: 'suggestRemovingNonNull', + output: ` +let x: string; +x = foo(); +x ?? ''; + `.trimRight(), + }, + ], + }, + ], + }, + { + code: ` +let x: string; +x = foo(); +x! ?? ''; +x = foo(); + `.trimRight(), + errors: [ + { + messageId: 'noNonNullAssertedNullishCoalescing', + suggestions: [ + { + messageId: 'suggestRemovingNonNull', + output: ` +let x: string; +x = foo(); +x ?? ''; +x = foo(); + `.trimRight(), + }, + ], + }, + ], + }, + { + code: ` +let x = foo(); +x! ?? ''; + `.trimRight(), + errors: [ + { + messageId: 'noNonNullAssertedNullishCoalescing', + suggestions: [ + { + messageId: 'suggestRemovingNonNull', + output: ` +let x = foo(); +x ?? ''; + `.trimRight(), + }, + ], + }, + ], + }, + { + code: ` +function foo() { + let x!: string; + return x! ?? ''; +} + `.trimRight(), + errors: [ + { + messageId: 'noNonNullAssertedNullishCoalescing', + suggestions: [ + { + messageId: 'suggestRemovingNonNull', + output: ` +function foo() { + let x!: string; + return x ?? ''; +} + `.trimRight(), + }, + ], + }, + ], + }, + { + code: ` +let x!: string; +function foo() { + return x! ?? ''; +} + `.trimRight(), + errors: [ + { + messageId: 'noNonNullAssertedNullishCoalescing', + suggestions: [ + { + messageId: 'suggestRemovingNonNull', + output: ` +let x!: string; +function foo() { + return x ?? ''; +} + `.trimRight(), + }, + ], + }, + ], + }, + { + code: noFormat` +let x = foo(); +x ! ?? ''; + `.trimRight(), + errors: [ + { + messageId: 'noNonNullAssertedNullishCoalescing', + suggestions: [ + { + messageId: 'suggestRemovingNonNull', + output: noFormat` +let x = foo(); +x ?? ''; + `.trimRight(), + }, + ], + }, + ], + }, + ], +}); diff --git a/packages/eslint-plugin/tests/rules/no-redeclare.test.ts b/packages/eslint-plugin/tests/rules/no-redeclare.test.ts index f227c5ac8919..c371a738755e 100644 --- a/packages/eslint-plugin/tests/rules/no-redeclare.test.ts +++ b/packages/eslint-plugin/tests/rules/no-redeclare.test.ts @@ -122,6 +122,13 @@ namespace A {} code: ` interface A {} class A {} +namespace A {} + `, + options: [{ ignoreDeclarationMerge: true }], + }, + { + code: ` +enum A {} namespace A {} `, options: [{ ignoreDeclarationMerge: true }], @@ -605,6 +612,23 @@ class A {} }, { code: ` +enum A {} +namespace A {} +enum A {} + `, + options: [{ ignoreDeclarationMerge: true }], + errors: [ + { + messageId: 'redeclared', + data: { + id: 'A', + }, + line: 4, + }, + ], + }, + { + code: ` function A() {} class A {} namespace A {} 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 606e4c47ce22..d884c77a6d65 100644 --- a/packages/eslint-plugin/tests/rules/no-require-imports.test.ts +++ b/packages/eslint-plugin/tests/rules/no-require-imports.test.ts @@ -17,6 +17,11 @@ ruleTester.run('no-require-imports', rule, { 'import lib9 = lib2.anotherSubImport;', "import lib10 from 'lib10';", "var lib3 = load?.('not_an_import');", + ` +import { createRequire } from 'module'; +const require = createRequire(); +require('remark-preset-prettier'); + `, ], invalid: [ { diff --git a/packages/eslint-plugin/tests/rules/no-restricted-imports.test.ts b/packages/eslint-plugin/tests/rules/no-restricted-imports.test.ts new file mode 100644 index 000000000000..059a7d1cad8f --- /dev/null +++ b/packages/eslint-plugin/tests/rules/no-restricted-imports.test.ts @@ -0,0 +1,553 @@ +import { AST_NODE_TYPES } from '@typescript-eslint/experimental-utils'; +import rule from '../../src/rules/no-restricted-imports'; +import { RuleTester } from '../RuleTester'; + +const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', +}); + +ruleTester.run('no-restricted-imports', rule, { + valid: [ + "import foo from 'foo';", + { + code: "import foo from 'foo';", + options: ['import1', 'import2'], + }, + { + code: "export { foo } from 'foo';", + options: ['import1', 'import2'], + }, + { + code: "import foo from 'foo';", + options: [{ paths: ['import1', 'import2'] }], + }, + { + code: "export { foo } from 'foo';", + options: [{ paths: ['import1', 'import2'] }], + }, + { + code: "import foo from 'foo';", + options: [ + { + paths: ['import1', 'import2'], + patterns: ['import1/private/*', 'import2/*', '!import2/good'], + }, + ], + }, + { + code: "export { foo } from 'foo';", + options: [ + { + paths: ['import1', 'import2'], + patterns: ['import1/private/*', 'import2/*', '!import2/good'], + }, + ], + }, + { + code: "import foo from 'foo';", + options: [ + { + paths: [ + { + name: 'import-foo', + message: 'Please use import-bar instead.', + }, + { + name: 'import-baz', + message: 'Please use import-quux instead.', + }, + ], + }, + ], + }, + { + code: "export { foo } from 'foo';", + options: [ + { + paths: [ + { + name: 'import-foo', + message: 'Please use import-bar instead.', + }, + { + name: 'import-baz', + message: 'Please use import-quux instead.', + }, + ], + }, + ], + }, + { + code: "import foo from 'foo';", + options: [ + { + paths: [ + { + name: 'import-foo', + importNames: ['Bar'], + message: 'Please use Bar from /import-bar/baz/ instead.', + }, + ], + }, + ], + }, + { + code: "export { foo } from 'foo';", + options: [ + { + paths: [ + { + name: 'import-foo', + importNames: ['Bar'], + message: 'Please use Bar from /import-bar/baz/ instead.', + }, + ], + }, + ], + }, + { + code: "import foo from 'foo';", + options: [ + { + patterns: [ + { + group: ['import1/private/*'], + message: 'usage of import1 private modules not allowed.', + }, + { + group: ['import2/*', '!import2/good'], + message: + 'import2 is deprecated, except the modules in import2/good.', + }, + ], + }, + ], + }, + { + code: "export { foo } from 'foo';", + options: [ + { + patterns: [ + { + group: ['import1/private/*'], + message: 'usage of import1 private modules not allowed.', + }, + { + group: ['import2/*', '!import2/good'], + message: + 'import2 is deprecated, except the modules in import2/good.', + }, + ], + }, + ], + }, + { + code: "import type foo from 'import-foo';", + options: [ + { + paths: [ + { + name: 'import-foo', + message: 'Please use import-bar instead.', + allowTypeImports: true, + }, + ], + }, + ], + }, + { + code: "import type { Bar } from 'import-foo';", + options: [ + { + paths: [ + { + name: 'import-foo', + importNames: ['Bar'], + message: 'Please use Bar from /import-bar/baz/ instead.', + allowTypeImports: true, + }, + ], + }, + ], + }, + { + code: "export type { Bar } from 'import-foo';", + options: [ + { + paths: [ + { + name: 'import-foo', + importNames: ['Bar'], + message: 'Please use Bar from /import-bar/baz/ instead.', + allowTypeImports: true, + }, + ], + }, + ], + }, + { + code: "import type foo from 'import1/private/bar';", + options: [ + { + patterns: [ + { + group: ['import1/private/*'], + message: 'usage of import1 private modules not allowed.', + allowTypeImports: true, + }, + ], + }, + ], + }, + { + code: "export type { foo } from 'import1/private/bar';", + options: [ + { + patterns: [ + { + group: ['import1/private/*'], + message: 'usage of import1 private modules not allowed.', + allowTypeImports: true, + }, + ], + }, + ], + }, + { + code: "export * from 'foo';", + options: ['import1'], + }, + ], + invalid: [ + { + code: "import foo from 'import1';", + options: ['import1', 'import2'], + errors: [ + { + messageId: 'path', + type: AST_NODE_TYPES.ImportDeclaration, + }, + ], + }, + { + code: "export { foo } from 'import1';", + options: ['import1', 'import2'], + errors: [ + { + messageId: 'path', + type: AST_NODE_TYPES.ExportNamedDeclaration, + }, + ], + }, + { + code: "import foo from 'import1';", + options: [{ paths: ['import1', 'import2'] }], + errors: [ + { + messageId: 'path', + type: AST_NODE_TYPES.ImportDeclaration, + }, + ], + }, + { + code: "export { foo } from 'import1';", + options: [{ paths: ['import1', 'import2'] }], + errors: [ + { + messageId: 'path', + type: AST_NODE_TYPES.ExportNamedDeclaration, + }, + ], + }, + { + code: "import foo from 'import1/private/foo';", + options: [ + { + paths: ['import1', 'import2'], + patterns: ['import1/private/*', 'import2/*', '!import2/good'], + }, + ], + errors: [ + { + messageId: 'patterns', + type: AST_NODE_TYPES.ImportDeclaration, + }, + ], + }, + { + code: "export { foo } from 'import1/private/foo';", + options: [ + { + paths: ['import1', 'import2'], + patterns: ['import1/private/*', 'import2/*', '!import2/good'], + }, + ], + errors: [ + { + messageId: 'patterns', + type: AST_NODE_TYPES.ExportNamedDeclaration, + }, + ], + }, + { + code: "import foo from 'import-foo';", + options: [ + { + paths: [ + { + name: 'import-foo', + message: 'Please use import-bar instead.', + }, + { + name: 'import-baz', + message: 'Please use import-quux instead.', + }, + ], + }, + ], + errors: [ + { + messageId: 'pathWithCustomMessage', + type: AST_NODE_TYPES.ImportDeclaration, + }, + ], + }, + { + code: "export { foo } from 'import-foo';", + options: [ + { + paths: [ + { + name: 'import-foo', + message: 'Please use import-bar instead.', + }, + { + name: 'import-baz', + message: 'Please use import-quux instead.', + }, + ], + }, + ], + errors: [ + { + messageId: 'pathWithCustomMessage', + type: AST_NODE_TYPES.ExportNamedDeclaration, + }, + ], + }, + { + code: "import { Bar } from 'import-foo';", + options: [ + { + paths: [ + { + name: 'import-foo', + importNames: ['Bar'], + message: 'Please use Bar from /import-bar/baz/ instead.', + }, + ], + }, + ], + errors: [ + { + messageId: 'importNameWithCustomMessage', + type: AST_NODE_TYPES.ImportDeclaration, + }, + ], + }, + { + code: "export { Bar } from 'import-foo';", + options: [ + { + paths: [ + { + name: 'import-foo', + importNames: ['Bar'], + message: 'Please use Bar from /import-bar/baz/ instead.', + }, + ], + }, + ], + errors: [ + { + messageId: 'importNameWithCustomMessage', + type: AST_NODE_TYPES.ExportNamedDeclaration, + }, + ], + }, + { + code: "import foo from 'import1/private/foo';", + options: [ + { + patterns: [ + { + group: ['import1/private/*'], + message: 'usage of import1 private modules not allowed.', + }, + { + group: ['import2/*', '!import2/good'], + message: + 'import2 is deprecated, except the modules in import2/good.', + }, + ], + }, + ], + errors: [ + { + messageId: 'patternWithCustomMessage', + type: AST_NODE_TYPES.ImportDeclaration, + }, + ], + }, + { + code: "export { foo } from 'import1/private/foo';", + options: [ + { + patterns: [ + { + group: ['import1/private/*'], + message: 'usage of import1 private modules not allowed.', + }, + { + group: ['import2/*', '!import2/good'], + message: + 'import2 is deprecated, except the modules in import2/good.', + }, + ], + }, + ], + errors: [ + { + messageId: 'patternWithCustomMessage', + type: AST_NODE_TYPES.ExportNamedDeclaration, + }, + ], + }, + { + code: "import foo from 'import-foo';", + options: [ + { + paths: [ + { + name: 'import-foo', + message: 'Please use import-bar instead.', + allowTypeImports: true, + }, + ], + }, + ], + errors: [ + { + messageId: 'pathWithCustomMessage', + type: AST_NODE_TYPES.ImportDeclaration, + }, + ], + }, + { + code: "import { Bar } from 'import-foo';", + options: [ + { + paths: [ + { + name: 'import-foo', + importNames: ['Bar'], + message: 'Please use Bar from /import-bar/baz/ instead.', + allowTypeImports: true, + }, + ], + }, + ], + errors: [ + { + messageId: 'importNameWithCustomMessage', + type: AST_NODE_TYPES.ImportDeclaration, + }, + ], + }, + { + code: "export { Bar } from 'import-foo';", + options: [ + { + paths: [ + { + name: 'import-foo', + importNames: ['Bar'], + message: 'Please use Bar from /import-bar/baz/ instead.', + allowTypeImports: true, + }, + ], + }, + ], + errors: [ + { + messageId: 'importNameWithCustomMessage', + type: AST_NODE_TYPES.ExportNamedDeclaration, + }, + ], + }, + { + code: "import foo from 'import1/private/bar';", + options: [ + { + patterns: [ + { + group: ['import1/private/*'], + message: 'usage of import1 private modules not allowed.', + allowTypeImports: true, + }, + ], + }, + ], + errors: [ + { + messageId: 'patternWithCustomMessage', + type: AST_NODE_TYPES.ImportDeclaration, + }, + ], + }, + { + code: "export { foo } from 'import1/private/bar';", + options: [ + { + patterns: [ + { + group: ['import1/private/*'], + message: 'usage of import1 private modules not allowed.', + allowTypeImports: true, + }, + ], + }, + ], + errors: [ + { + messageId: 'patternWithCustomMessage', + type: AST_NODE_TYPES.ExportNamedDeclaration, + }, + ], + }, + { + code: "export * from 'import1';", + options: ['import1'], + errors: [ + { + messageId: 'path', + type: AST_NODE_TYPES.ExportAllDeclaration, + }, + ], + }, + { + code: "import type { InvalidTestCase } from '@typescript-eslint/experimental-utils/dist/ts-eslint';", + options: [ + { + patterns: ['@typescript-eslint/experimental-utils/dist/*'], + }, + ], + errors: [ + { + messageId: 'patterns', + type: AST_NODE_TYPES.ImportDeclaration, + }, + ], + }, + ], +}); diff --git a/packages/eslint-plugin/tests/rules/no-shadow.test.ts b/packages/eslint-plugin/tests/rules/no-shadow.test.ts index abc78ee5f3ec..bedb825df704 100644 --- a/packages/eslint-plugin/tests/rules/no-shadow.test.ts +++ b/packages/eslint-plugin/tests/rules/no-shadow.test.ts @@ -1,6 +1,6 @@ +import { AST_NODE_TYPES } from '@typescript-eslint/experimental-utils'; import rule from '../../src/rules/no-shadow'; import { RuleTester } from '../RuleTester'; -import { AST_NODE_TYPES } from '@typescript-eslint/experimental-utils'; const ruleTester = new RuleTester({ parserOptions: { @@ -51,6 +51,15 @@ class Foo { } interface Foo { prop2: string; +} + `, + ` +import type { Foo } from 'bar'; + +declare module 'bar' { + export interface Foo { + x: string; + } } `, // type value shadowing @@ -159,6 +168,31 @@ type Fn = (Foo: string) => typeof Foo; `, options: [{ ignoreFunctionTypeParameterNameValueShadow: false }], }, + ` +export class Wrapper { + private constructor(private readonly wrapped: Wrapped) {} + + unwrap(): Wrapped { + return this.wrapped; + } + + static create(wrapped: Wrapped) { + return new Wrapper(wrapped); + } +} + `, + { + // https://github.com/typescript-eslint/typescript-eslint/issues/3862 + code: ` +import type { foo } from './foo'; +type bar = number; + +// 'foo' is already declared in the upper scope +// 'bar' is fine +function doThing(foo: number, bar: number) {} + `, + options: [{ ignoreTypeValueShadow: true }], + }, ], invalid: [ { @@ -1385,5 +1419,115 @@ function foo(cb) { }, ], }, + { + code: ` +import type { foo } from './foo'; +function doThing(foo: number, bar: number) {} + `, + options: [{ ignoreTypeValueShadow: false }], + errors: [ + { + messageId: 'noShadow', + data: { name: 'foo' }, + type: AST_NODE_TYPES.Identifier, + line: 3, + column: 18, + }, + ], + }, + { + code: ` +import { foo } from './foo'; +function doThing(foo: number, bar: number) {} + `, + options: [{ ignoreTypeValueShadow: true }], + errors: [ + { + messageId: 'noShadow', + data: { name: 'foo' }, + type: AST_NODE_TYPES.Identifier, + line: 3, + column: 18, + }, + ], + }, + { + code: ` +interface Foo {} + +declare module 'bar' { + export interface Foo { + x: string; + } +} + `, + errors: [ + { + messageId: 'noShadow', + data: { name: 'Foo' }, + type: AST_NODE_TYPES.Identifier, + line: 5, + column: 20, + }, + ], + }, + { + code: ` +import type { Foo } from 'bar'; + +declare module 'baz' { + export interface Foo { + x: string; + } +} + `, + errors: [ + { + messageId: 'noShadow', + data: { name: 'Foo' }, + type: AST_NODE_TYPES.Identifier, + line: 5, + column: 20, + }, + ], + }, + { + code: ` +import type { Foo } from 'bar'; + +declare module 'bar' { + export type Foo = string; +} + `, + errors: [ + { + messageId: 'noShadow', + data: { name: 'Foo' }, + type: AST_NODE_TYPES.Identifier, + line: 5, + column: 15, + }, + ], + }, + { + code: ` +import type { Foo } from 'bar'; + +declare module 'bar' { + interface Foo { + x: string; + } +} + `, + errors: [ + { + messageId: 'noShadow', + data: { name: 'Foo' }, + type: AST_NODE_TYPES.Identifier, + line: 5, + column: 13, + }, + ], + }, ], }); 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 e06233aeb466..f0da2160b632 100644 --- a/packages/eslint-plugin/tests/rules/no-type-alias.test.ts +++ b/packages/eslint-plugin/tests/rules/no-type-alias.test.ts @@ -341,10 +341,9 @@ type Foo = code: ` type Foo = { readonly [P in keyof T]: T[P]; -} & - { - readonly [P in keyof T]: T[P]; - }; +} & { + readonly [P in keyof T]: T[P]; +}; `, options: [{ allowMappedTypes: 'always' }], }, @@ -352,10 +351,9 @@ type Foo = { code: ` type Foo = { readonly [P in keyof T]: T[P]; -} & - { - readonly [P in keyof T]: T[P]; - }; +} & { + readonly [P in keyof T]: T[P]; +}; `, options: [{ allowMappedTypes: 'in-unions-and-intersections' }], }, @@ -363,10 +361,9 @@ type Foo = { code: ` type Foo = { readonly [P in keyof T]: T[P]; -} & - { - readonly [P in keyof T]: T[P]; - }; +} & { + readonly [P in keyof T]: T[P]; +}; `, options: [{ allowMappedTypes: 'in-intersections' }], }, @@ -394,10 +391,25 @@ export type ClassValue = code: 'type Foo = typeof bar;', options: [{ allowAliases: 'always' }], }, + { + code: "type Foo = typeof import('foo');", + options: [{ allowAliases: 'always' }], + }, + { + code: ` +const WithAKey = { AKey: true }; +type KeyNames = keyof typeof SCALARS; + `, + options: [{ allowAliases: 'always' }], + }, { code: 'type Foo = typeof bar | typeof baz;', options: [{ allowAliases: 'in-unions' }], }, + { + code: "type Foo = typeof bar | typeof import('foo');", + options: [{ allowAliases: 'in-unions' }], + }, { code: 'type Foo = keyof [string];', options: [{ allowTupleTypes: 'always' }], @@ -415,8 +427,7 @@ export type ClassValue = options: [{ allowTupleTypes: 'in-intersections' }], }, { - code: - 'type Foo = ([string] & [number, number]) | [number, number, number];', + code: 'type Foo = ([string] & [number, number]) | [number, number, number];', options: [{ allowTupleTypes: 'in-unions-and-intersections' }], }, { @@ -436,8 +447,7 @@ export type ClassValue = options: [{ allowTupleTypes: 'in-intersections' }], }, { - code: - 'type Foo = ([string] & [number, number]) | readonly [number, number, number];', + code: 'type Foo = ([string] & [number, number]) | readonly [number, number, number];', options: [{ allowTupleTypes: 'in-unions-and-intersections' }], }, { @@ -457,8 +467,7 @@ export type ClassValue = options: [{ allowTupleTypes: 'in-intersections' }], }, { - code: - 'type Foo = ([string] & [number, number]) | keyof [number, number, number];', + code: 'type Foo = ([string] & [number, number]) | keyof [number, number, number];', options: [{ allowTupleTypes: 'in-unions-and-intersections' }], }, { @@ -469,6 +478,10 @@ export type ClassValue = code: 'type Foo = new (bar: number) => string | null;', options: [{ allowConstructors: 'always' }], }, + { + code: 'type Foo = Record;', + options: [{ allowGenerics: 'always' }], + }, ], invalid: [ { @@ -498,6 +511,20 @@ export type ClassValue = }, ], }, + { + code: "type Foo = typeof import('foo');", + options: [{ allowAliases: 'never' }], + errors: [ + { + messageId: 'noTypeAlias', + data: { + alias: 'aliases', + }, + line: 1, + column: 12, + }, + ], + }, { code: "type Foo = 'a' | 'b';", errors: [ @@ -521,6 +548,29 @@ export type ClassValue = }, ], }, + { + code: "type Foo = 'a' | typeof import('foo');", + errors: [ + { + messageId: 'noCompositionAlias', + data: { + typeName: 'Aliases', + compositionType: 'union', + }, + line: 1, + column: 12, + }, + { + messageId: 'noCompositionAlias', + data: { + typeName: 'Aliases', + compositionType: 'union', + }, + line: 1, + column: 18, + }, + ], + }, { code: "type Foo = 'a' | 'b';", options: [{ allowLiterals: 'in-unions' }], @@ -2915,10 +2965,9 @@ type Foo = code: ` type Foo = { readonly [P in keyof T]: T[P]; -} & - { - readonly [P in keyof T]: T[P]; - }; +} & { + readonly [P in keyof T]: T[P]; +}; `, errors: [ { @@ -2936,8 +2985,8 @@ type Foo = { typeName: 'Mapped types', compositionType: 'intersection', }, - line: 5, - column: 3, + line: 4, + column: 5, }, ], }, @@ -2945,10 +2994,9 @@ type Foo = { code: ` type Foo = { readonly [P in keyof T]: T[P]; -} & - { - readonly [P in keyof T]: T[P]; - }; +} & { + readonly [P in keyof T]: T[P]; +}; `, options: [{ allowMappedTypes: 'never' }], errors: [ @@ -2967,8 +3015,8 @@ type Foo = { typeName: 'Mapped types', compositionType: 'intersection', }, - line: 5, - column: 3, + line: 4, + column: 5, }, ], }, @@ -2976,10 +3024,9 @@ type Foo = { code: ` type Foo = { readonly [P in keyof T]: T[P]; -} & - { - readonly [P in keyof T]: T[P]; - }; +} & { + readonly [P in keyof T]: T[P]; +}; `, options: [{ allowMappedTypes: 'in-unions' }], errors: [ @@ -2998,8 +3045,8 @@ type Foo = { typeName: 'Mapped types', compositionType: 'intersection', }, - line: 5, - column: 3, + line: 4, + column: 5, }, ], }, @@ -3280,5 +3327,18 @@ type Foo = { }, ], }, + { + code: 'type Foo = Record;', + errors: [ + { + messageId: 'noTypeAlias', + data: { + alias: 'generics', + }, + line: 1, + column: 12, + }, + ], + }, ], }); 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 36eb36033de1..7896fe00de88 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 @@ -224,5 +224,39 @@ ruleTester.run('no-unnecessary-boolean-literal-compare', rule, { } `, }, + { + code: ` + declare const varBoolean: boolean; + if (false !== varBoolean) { + } + `, + errors: [ + { + messageId: 'negated', + }, + ], + output: ` + declare const varBoolean: boolean; + if (varBoolean) { + } + `, + }, + { + code: ` + declare const varBoolean: boolean; + if (true !== varBoolean) { + } + `, + errors: [ + { + messageId: 'negated', + }, + ], + output: ` + declare const varBoolean: boolean; + if (!varBoolean) { + } + `, + }, ], }); 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 2658061a3572..82196fbc8a1e 100644 --- a/packages/eslint-plugin/tests/rules/no-unnecessary-condition.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unnecessary-condition.test.ts @@ -315,6 +315,11 @@ returnsArr?.()[42]?.toUpperCase(); ` declare const arr: string[][]; arr[x] ?? []; + `, + // nullish + optional array index + ` +declare const arr: { foo: number }[]; +const bar = arr[42]?.foo ?? 0; `, // Doesn't check the right-hand side of a logical expression // in a non-conditional context @@ -751,6 +756,15 @@ function test(a: string) { code: ` function test(a: string | false) { return a ?? 'default'; +} + `, + errors: [ruleError(3, 10, 'neverNullish')], + }, + // nullish + array index without optional chaining + { + code: ` +function test(a: { foo: string }[]) { + return a[0].foo ?? 'default'; } `, errors: [ruleError(3, 10, 'neverNullish')], @@ -765,6 +779,14 @@ function test(a: null) { }, { code: ` +function test(a: null[]) { + return a[0] ?? 'default'; +} + `, + errors: [ruleError(3, 10, 'alwaysNullish')], + }, + { + code: ` function test(a: never) { return a ?? 'default'; } @@ -1315,6 +1337,17 @@ foo?.fooOrBar.baz?.qux; }, { code: ` +declare const x: { a: { b: number } }[]; +x[0].a?.b; + `, + output: ` +declare const x: { a: { b: number } }[]; +x[0].a.b; + `, + errors: [ruleError(3, 7, 'neverOptionalChain')], + }, + { + code: ` type Foo = { [key: string]: string; foo: 'foo'; bar: 'bar' } | null; type Key = 'bar' | 'foo'; declare const foo: Foo; 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 f5671dd5d6b9..7cd169601392 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 @@ -186,6 +186,28 @@ const c = [...a, ...b]; { code: "const a = { foo: 'foo' };", }, + { + code: ` +let a: number | undefined; +let b: number | undefined; +let c: number; +a = b; +c = b!; +a! -= 1; + `, + }, + { + code: ` +let a: { b?: string } | undefined; +a!.b = ''; + `, + }, + ` +let value: number | undefined; +let values: number[] = []; + +value = values.pop()!; + `, ], invalid: [ @@ -342,6 +364,22 @@ function foo(bar: T) { }, { code: ` +declare const foo: Foo; +const bar = foo; + `, + output: ` +declare const foo: Foo; +const bar = foo; + `, + errors: [ + { + messageId: 'unnecessaryAssertion', + line: 3, + }, + ], + }, + { + code: ` declare function nonNull(s: string | null); let s: string | null = null; nonNull(s!); @@ -451,5 +489,25 @@ function Test(props: { id?: string | number }) { ], filename: 'react.tsx', }, + { + code: ` +let x: number | undefined; +let y: number | undefined; +y = x!; +y! = 0; + `, + output: ` +let x: number | undefined; +let y: number | undefined; +y = x!; +y = 0; + `, + errors: [ + { + messageId: 'contextuallyUnnecessary', + line: 5, + }, + ], + }, ], }); diff --git a/packages/eslint-plugin/tests/rules/no-unsafe-argument.test.ts b/packages/eslint-plugin/tests/rules/no-unsafe-argument.test.ts new file mode 100644 index 000000000000..6205a371a14a --- /dev/null +++ b/packages/eslint-plugin/tests/rules/no-unsafe-argument.test.ts @@ -0,0 +1,354 @@ +import rule from '../../src/rules/no-unsafe-argument'; +import { RuleTester, getFixturesRootDir } from '../RuleTester'; + +const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', + parserOptions: { + project: './tsconfig.json', + tsconfigRootDir: getFixturesRootDir(), + }, +}); + +ruleTester.run('no-unsafe-argument', rule, { + valid: [ + // unknown function should be ignored + ` +doesNotExist(1 as any); + `, + // non-function call should be ignored + ` +const foo = 1; +foo(1 as any); + `, + // too many arguments should be ignored as this is a TS error + ` +declare function foo(arg: number): void; +foo(1, 1 as any, 2 as any); + `, + ` +declare function foo(arg: number, arg2: string): void; +foo(1, 'a'); + `, + ` +declare function foo(arg: any): void; +foo(1 as any); + `, + ` +declare function foo(arg: unknown): void; +foo(1 as any); + `, + ` +declare function foo(...arg: number[]): void; +foo(1, 2, 3); + `, + ` +declare function foo(...arg: any[]): void; +foo(1, 2, 3, 4 as any); + `, + ` +declare function foo(arg: number, arg2: number): void; +const x = [1, 2] as const; +foo(...x); + `, + ` +declare function foo(arg: any, arg2: number): void; +const x = [1 as any, 2] as const; +foo(...x); + `, + ` +declare function foo(arg1: string, arg2: string): void; +const x: string[] = []; +foo(...x); + `, + ` +declare function foo(arg1: Set, arg2: Map): void; + +const x = [new Map()] as const; +foo(new Set(), ...x); + `, + ` +declare function foo(arg1: unknown, arg2: Set, arg3: unknown[]): void; +foo(1 as any, new Set(), [] as any[]); + `, + ` +declare function foo(...params: [number, string, any]): void; +foo(1, 'a', 1 as any); + `, + // Unfortunately - we cannot handle this case because TS infers `params` to be a tuple type + // that tuple type is the same as the type of + ` +declare function foo(...params: E): void; + +foo('a', 'b', 1 as any); + `, + ` +declare function toHaveBeenCalledWith(...params: E): void; +toHaveBeenCalledWith(1 as any); + `, + // https://github.com/typescript-eslint/typescript-eslint/issues/2109 + ` +declare function acceptsMap(arg: Map): void; +acceptsMap(new Map()); + `, + ], + invalid: [ + { + code: ` +declare function foo(arg: number): void; +foo(1 as any); + `, + errors: [ + { + messageId: 'unsafeArgument', + line: 3, + column: 5, + endColumn: 13, + data: { + sender: 'any', + receiver: 'number', + }, + }, + ], + }, + { + code: ` +declare function foo(arg1: number, arg2: string): void; +foo(1, 1 as any); + `, + errors: [ + { + messageId: 'unsafeArgument', + line: 3, + column: 8, + endColumn: 16, + data: { + sender: 'any', + receiver: 'string', + }, + }, + ], + }, + { + code: ` +declare function foo(...arg: number[]): void; +foo(1, 2, 3, 1 as any); + `, + errors: [ + { + messageId: 'unsafeArgument', + line: 3, + column: 14, + endColumn: 22, + data: { + sender: 'any', + receiver: 'number', + }, + }, + ], + }, + { + code: ` +declare function foo(arg: string, ...arg: number[]): void; +foo(1 as any, 1 as any); + `, + errors: [ + { + messageId: 'unsafeArgument', + line: 3, + column: 5, + endColumn: 13, + data: { + sender: 'any', + receiver: 'string', + }, + }, + { + messageId: 'unsafeArgument', + line: 3, + column: 15, + endColumn: 23, + data: { + sender: 'any', + receiver: 'number', + }, + }, + ], + }, + { + code: ` +declare function foo(arg1: string, arg2: number): void; + +foo(...(x as any)); + `, + errors: [ + { + messageId: 'unsafeSpread', + line: 4, + column: 5, + endColumn: 18, + }, + ], + }, + { + code: ` +declare function foo(arg1: string, arg2: number): void; + +foo(...(x as any[])); + `, + errors: [ + { + messageId: 'unsafeArraySpread', + line: 4, + column: 5, + endColumn: 20, + }, + ], + }, + { + code: ` +declare function foo(arg1: string, arg2: number): void; + +const x = ['a', 1 as any] as const; +foo(...x); + `, + errors: [ + { + messageId: 'unsafeTupleSpread', + line: 5, + column: 5, + endColumn: 9, + data: { + sender: 'any', + receiver: 'number', + }, + }, + ], + }, + { + code: ` +declare function foo(arg1: string, arg2: number, arg2: string): void; + +const x = [1] as const; +foo('a', ...x, 1 as any); + `, + errors: [ + { + messageId: 'unsafeArgument', + line: 5, + column: 16, + endColumn: 24, + data: { + sender: 'any', + receiver: 'string', + }, + }, + ], + }, + { + code: ` +declare function foo(arg1: string, arg2: number, ...rest: string[]): void; + +const x = [1, 2] as [number, ...number[]]; +foo('a', ...x, 1 as any); + `, + errors: [ + { + messageId: 'unsafeArgument', + line: 5, + column: 16, + endColumn: 24, + data: { + sender: 'any', + receiver: 'string', + }, + }, + ], + }, + { + code: ` +declare function foo(arg1: Set, arg2: Map): void; + +const x = [new Map()] as const; +foo(new Set(), ...x); + `, + errors: [ + { + messageId: 'unsafeArgument', + line: 5, + column: 5, + endColumn: 19, + data: { + sender: 'Set', + receiver: 'Set', + }, + }, + { + messageId: 'unsafeTupleSpread', + line: 5, + column: 21, + endColumn: 25, + data: { + sender: 'Map', + receiver: 'Map', + }, + }, + ], + }, + { + code: ` +declare function foo(...params: [number, string, any]): void; +foo(1 as any, 'a' as any, 1 as any); + `, + errors: [ + { + messageId: 'unsafeArgument', + line: 3, + column: 5, + endColumn: 13, + data: { + sender: 'any', + receiver: 'number', + }, + }, + { + messageId: 'unsafeArgument', + line: 3, + column: 15, + endColumn: 25, + data: { + sender: 'any', + receiver: 'string', + }, + }, + ], + }, + { + code: ` +declare function foo(param1: string, ...params: [number, string, any]): void; +foo('a', 1 as any, 'a' as any, 1 as any); + `, + errors: [ + { + messageId: 'unsafeArgument', + line: 3, + column: 10, + endColumn: 18, + data: { + sender: 'any', + receiver: 'number', + }, + }, + { + messageId: 'unsafeArgument', + line: 3, + column: 20, + endColumn: 30, + data: { + sender: 'any', + receiver: 'string', + }, + }, + ], + }, + ], +}); 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 6f3baa3fa1a1..f9594fc93481 100644 --- a/packages/eslint-plugin/tests/rules/no-unsafe-assignment.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unsafe-assignment.test.ts @@ -68,7 +68,7 @@ function assignmentTest( const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', parserOptions: { - project: './tsconfig.json', + project: './tsconfig.noImplicitThis.json', tsconfigRootDir: getFixturesRootDir(), }, }); @@ -141,6 +141,8 @@ declare function Foo(props: { a: string }): never; 'const x: unknown = y as any;', 'const x: unknown[] = y as any[];', 'const x: Set = y as Set;', + // https://github.com/typescript-eslint/typescript-eslint/issues/2109 + 'const x: Map = new Map();', ], invalid: [ ...batchedSingleLineTests({ @@ -347,5 +349,20 @@ declare function Foo(props: Props): never; }, ], }, + { + code: ` +function foo() { + const bar = this; +} + `, + errors: [ + { + messageId: 'anyAssignmentThis', + line: 3, + column: 9, + endColumn: 19, + }, + ], + }, ], }); 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 981abb0eadde..1f70c30e248c 100644 --- a/packages/eslint-plugin/tests/rules/no-unsafe-call.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unsafe-call.test.ts @@ -9,7 +9,7 @@ import { const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', parserOptions: { - project: './tsconfig.json', + project: './tsconfig.noImplicitThis.json', tsconfigRootDir: getFixturesRootDir(), }, }); @@ -148,5 +148,34 @@ function foo(x: { tag: any }) { x.tag\`foo\` } }, ], }), + { + code: noFormat` +const methods = { + methodA() { + return this.methodB() + }, + methodB() { + return true + }, + methodC() { + return this() + } +}; + `, + errors: [ + { + messageId: 'unsafeCallThis', + line: 4, + column: 12, + endColumn: 24, + }, + { + messageId: 'unsafeCallThis', + line: 10, + column: 12, + endColumn: 16, + }, + ], + }, ], }); 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 a9c21f8712b9..491d5e97d9f9 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 @@ -9,7 +9,7 @@ import { const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', parserOptions: { - project: './tsconfig.json', + project: './tsconfig.noImplicitThis.json', tsconfigRootDir: getFixturesRootDir(), }, }); @@ -202,5 +202,44 @@ function foo(x: string[], y: any) { x[y] } }, ], }), + { + code: noFormat` +const methods = { + methodA() { + return this.methodB() + }, + methodB() { + const getProperty = () => Math.random() > 0.5 ? 'methodB' : 'methodC' + return this[getProperty()]() + }, + methodC() { + return true + }, + methodD() { + return (this?.methodA)?.() + } +}; + `, + errors: [ + { + messageId: 'unsafeThisMemberExpression', + line: 4, + column: 12, + endColumn: 24, + }, + { + messageId: 'unsafeThisMemberExpression', + line: 8, + column: 12, + endColumn: 31, + }, + { + messageId: 'unsafeThisMemberExpression', + line: 14, + column: 13, + endColumn: 26, + }, + ], + }, ], }); 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 7d7777e46632..2bbdfdd5ffaf 100644 --- a/packages/eslint-plugin/tests/rules/no-unsafe-return.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unsafe-return.test.ts @@ -9,7 +9,7 @@ import { const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', parserOptions: { - project: './tsconfig.json', + project: './tsconfig.noImplicitThis.json', tsconfigRootDir: getFixturesRootDir(), }, }); @@ -40,6 +40,18 @@ function foo() { ` function foo() { return []; +} + `, + // explicit any return type is allowed, if you want to be unsafe like that + ` +function foo(): any { + return {} as any; +} + `, + // explicit any array return type is allowed, if you want to be unsafe like that + ` +function foo(): any[] { + return [] as any[]; } `, // explicit any generic return type is allowed, if you want to be unsafe like that @@ -92,6 +104,12 @@ function foo(): Set { return x as Set; } `, + // https://github.com/typescript-eslint/typescript-eslint/issues/2109 + ` + function test(): Map { + return new Map(); + } + `, ], invalid: [ ...batchedSingleLineTests({ @@ -293,5 +311,30 @@ receiver(function test() { }, ], }, + { + code: ` +function foo() { + return this; +} + +function bar() { + return () => this; +} + `, + errors: [ + { + messageId: 'unsafeReturnThis', + line: 3, + column: 3, + endColumn: 15, + }, + { + messageId: 'unsafeReturnThis', + line: 7, + column: 16, + endColumn: 20, + }, + ], + }, ], }); diff --git a/packages/eslint-plugin/tests/rules/no-unused-vars-experimental.test.ts b/packages/eslint-plugin/tests/rules/no-unused-vars-experimental.test.ts deleted file mode 100644 index c093498200cf..000000000000 --- a/packages/eslint-plugin/tests/rules/no-unused-vars-experimental.test.ts +++ /dev/null @@ -1,1363 +0,0 @@ -import { - InvalidTestCase, - ValidTestCase, -} from '@typescript-eslint/experimental-utils/dist/ts-eslint'; -import rule, { - DEFAULT_IGNORED_REGEX_STRING, - Options, - MessageIds, -} from '../../src/rules/no-unused-vars-experimental'; -import { RuleTester, getFixturesRootDir } from '../RuleTester'; - -const rootDir = getFixturesRootDir(); -const ruleTester = new RuleTester({ - parserOptions: { - ecmaVersion: 2018, - sourceType: 'module', - }, - parser: '@typescript-eslint/parser', -}); - -const hasExport = /^export/m; -// const hasImport = /^import .+? from ['"]/m; -function makeExternalModule< - T extends ValidTestCase | InvalidTestCase ->(tests: T[]): T[] { - return tests.map(t => { - if (!hasExport.test(t.code)) { - return { - ...t, - code: `${t.code}\nexport const __externalModule = 1;`, - }; - } - return t; - }); -} - -const DEFAULT_IGNORED_REGEX = new RegExp( - DEFAULT_IGNORED_REGEX_STRING, -).toString(); -ruleTester.run('no-unused-vars-experimental', rule, { - valid: makeExternalModule([ - /////////////////////// - // #region variables // - /////////////////////// - { code: 'const _x = "unused"' }, - { code: 'export const x = "used";' }, - { - code: ` -const x = "used"; -console.log(x); - `, - }, - { - code: ` -function foo() {} -foo(); - `, - }, - { code: 'function _foo() {}' }, - { - // decorators require the tsconfig compiler option - // or else they are marked as unused because it is not a valid usage - code: ` -function decorator(_clazz: any) {} - -@decorator -export class Foo {} - `, - parser: require.resolve('@typescript-eslint/parser'), - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootDir, - }, - }, - { - code: ` -type Foo = { a?: string }; -export const foo: Foo = {}; - `, - }, - { - code: ` -interface Foo { a?: string }; -export const foo: Foo = {}; - `, - }, - { code: 'type _Foo = { a?: string };' }, - { code: 'interface _Foo { a?: string };' }, - { - code: ` -class Foo {} -new Foo(); - `, - }, - { code: 'class _Foo {}' }, - { - code: ` -export class Foo { - private foo: string; - bar() { - console.log(this.foo); - } -} - `, - }, - { - code: ` -export class Foo { - private _foo: string; -} - `, - }, - { - code: ` -export class Foo { - private foo() {}; - bar() { - this.foo(); - } -} - `, - }, - { - code: ` -export class Foo { - private _foo() {}; -} - `, - }, - { - code: ` -enum Foo { a = 1 } -console.log(Foo.a); - `, - }, - { code: 'enum _Foo { a = 1 }' }, - { code: 'export const {a, b} = c;' }, - { - code: ` -const {a, b: {c}} = d; -console.log(a, c); - `, - }, - { - code: ` -const {a, b} = c; -console.log(a, b); - `, - }, - { - code: ` -const {a: _a, b} = c; -console.log(b); - `, - }, - { code: `const {a: _a, b: _b} = c;` }, - { code: 'export const [a, b] = c;' }, - { - code: ` -const [a, b] = c; -console.log(a, b); - `, - }, - { - code: ` -const [a, [b]] = c; -console.log(a, b); - `, - }, - { - code: ` -const [_a, b] = c; -console.log(b); - `, - }, - { code: `const [_a, _b] = c;` }, - // #endregion variables // - ////////////////////////// - - //////////////////////// - // #region parameters // - //////////////////////// - { - code: ` -export function foo(a) { - console.log(a); -} - `, - }, - { - code: ` -export function foo(a: string, b: string) { - console.log(b); -} - `, - options: [ - { - ignoreArgsIfArgsAfterAreUsed: true, - }, - ], - }, - { - code: ` -export class Clazz { - constructor(a: string, public b: string) {} -} - `, - options: [ - { - ignoreArgsIfArgsAfterAreUsed: true, - }, - ], - }, - { - code: ` -export class Clazz { - constructor(private a: string, public b: string) {} -} - `, - options: [ - { - ignoreArgsIfArgsAfterAreUsed: true, - }, - ], - }, - { - code: ` -export class Clazz { - constructor(private a: string) {} - foo() { console.log(this.a) } -} - `, - }, - { code: 'export function foo({a: _a}) {}' }, - { code: 'export function foo({a: { b: _b }}) {}' }, - { code: 'export function foo([_a]) {}' }, - { code: 'export function foo([[_a]]) {}' }, - { - code: ` -export function foo({a: _a}, used) { - console.log(used); -} - `, - options: [ - { - ignoreArgsIfArgsAfterAreUsed: true, - }, - ], - }, - { - code: ` -export function foo({a: { b: _b }}, used) { - console.log(used); -} - `, - options: [ - { - ignoreArgsIfArgsAfterAreUsed: true, - }, - ], - }, - { - code: ` -export function foo([_a], used) { - console.log(used); -} - `, - options: [ - { - ignoreArgsIfArgsAfterAreUsed: true, - }, - ], - }, - { - code: ` -export function foo([[_a]], used) { - console.log(used); -} - `, - options: [ - { - ignoreArgsIfArgsAfterAreUsed: true, - }, - ], - }, - // #endregion parameters // - /////////////////////////// - - //////////////////// - // #region import // - //////////////////// - { - code: ` -import defaultImp from "thing"; -console.log(defaultImp); - `, - }, - { - code: ` -import { named } from "thing"; -console.log(named); - `, - }, - { - code: ` -import defaultImp, { named } from "thing"; -console.log(defaultImp, named); - `, - }, - { - code: ` -import defaultImp = require("thing"); -console.log(defaultImp, named); - `, - }, - { - code: ` -import * as namespace from "thing"; -console.log(namespace); - `, - }, - { - code: ` -import defaultImp, * as namespace from "thing"; -console.log(defaultImp, namespace); - `, - }, - { code: 'import _defaultImp from "thing";' }, - { code: 'import { named as _named } from "thing";' }, - { code: 'import _defaultImp, { named as _named } from "thing";' }, - { code: 'import _defaultImp = require("thing");' }, - { code: 'import * as _namespace from "thing";' }, - { code: 'import _defaultImp, * as _namespace from "thing";' }, - // #endregion import // - /////////////////////// - - ////////////////////// - // #region generics // - ////////////////////// - { code: 'export function foo(): T {}' }, - { code: 'export function foo(): T & T2 {}' }, - { code: 'export function foo(): T {}' }, - { - code: ` -export class foo { - prop: T -} - `, - }, - { - code: ` -export class foo { - prop: T - prop2: T2 -} - `, - }, - { - code: ` -export class foo { - prop: T - prop2: T2 -} - `, - }, - { - code: ` -export interface foo { - prop: T -} - `, - }, - { - code: ` -export interface foo { - prop: T - prop2: T2 -} - `, - }, - { - code: ` -export interface foo { - prop: T - prop2: T2 -} - `, - }, - { - code: ` -export type foo = { - prop: T - -} - `, - }, - { - code: ` -export type foo = { - prop: T - prop2: T2 -} - `, - }, - { - code: ` -export type foo = { - prop: T - prop2: T2 -} - `, - }, - // #endregion generics // - ///////////////////////// - ]), - invalid: makeExternalModule([ - /////////////////////// - // #region variables // - /////////////////////// - { - code: 'const x = "unused"', - errors: [ - { - messageId: 'unusedWithIgnorePattern', - data: { - name: 'x', - type: 'Variable', - pattern: DEFAULT_IGNORED_REGEX, - }, - line: 1, - column: 7, - endColumn: 8, - }, - ], - }, - { - code: 'const x: string = "unused"', - errors: [ - { - messageId: 'unusedWithIgnorePattern', - data: { - name: 'x', - type: 'Variable', - pattern: DEFAULT_IGNORED_REGEX, - }, - line: 1, - column: 7, - endColumn: 16, - }, - ], - }, - { - code: 'const x = "unused"', - options: [ - { - ignoredNamesRegex: false, - }, - ], - errors: [ - { - messageId: 'unused', - data: { - name: 'x', - type: 'Variable', - }, - line: 1, - column: 7, - endColumn: 8, - }, - ], - }, - { - code: 'function foo() {}', - errors: [ - { - messageId: 'unusedWithIgnorePattern', - data: { - name: 'foo', - type: 'Function', - pattern: DEFAULT_IGNORED_REGEX, - }, - line: 1, - column: 10, - endColumn: 13, - }, - ], - }, - { - code: 'type Foo = { a?: string };', - errors: [ - { - messageId: 'unusedWithIgnorePattern', - data: { - name: 'Foo', - type: 'Type', - pattern: DEFAULT_IGNORED_REGEX, - }, - line: 1, - column: 6, - endColumn: 9, - }, - ], - }, - { - code: 'interface Foo { a?: string };', - errors: [ - { - messageId: 'unusedWithIgnorePattern', - data: { - name: 'Foo', - type: 'Interface', - pattern: DEFAULT_IGNORED_REGEX, - }, - line: 1, - column: 11, - endColumn: 14, - }, - ], - }, - { - code: 'class Foo {}', - errors: [ - { - messageId: 'unusedWithIgnorePattern', - data: { - name: 'Foo', - type: 'Class', - pattern: DEFAULT_IGNORED_REGEX, - }, - line: 1, - column: 7, - endColumn: 10, - }, - ], - }, - { - code: ` -export class Foo { - private foo: string; -} - `, - errors: [ - { - messageId: 'unusedWithIgnorePattern', - data: { - name: 'foo', - // eslint-disable-next-line @typescript-eslint/internal/prefer-ast-types-enum - type: 'Property', - pattern: DEFAULT_IGNORED_REGEX, - }, - line: 3, - column: 11, - endColumn: 14, - }, - ], - }, - { - code: ` -export class Foo { - private foo() {}; -} - `, - errors: [ - { - messageId: 'unusedWithIgnorePattern', - data: { - name: 'foo', - type: 'Method', - pattern: DEFAULT_IGNORED_REGEX, - }, - line: 3, - column: 11, - endColumn: 14, - }, - ], - }, - { - code: 'enum Foo { a = 1 }', - errors: [ - { - messageId: 'unusedWithIgnorePattern', - data: { - name: 'Foo', - type: 'Enum', - pattern: DEFAULT_IGNORED_REGEX, - }, - line: 1, - column: 6, - endColumn: 9, - }, - ], - }, - { - code: ` -const {foo, bar} = baz; -console.log(foo); - `, - errors: [ - { - messageId: 'unusedWithIgnorePattern', - data: { - name: 'bar', - type: 'Destructured Variable', - pattern: DEFAULT_IGNORED_REGEX, - }, - line: 2, - column: 13, - endColumn: 16, - }, - ], - }, - { - code: ` -const [foo, bar] = baz; -console.log(foo); - `, - errors: [ - { - messageId: 'unusedWithIgnorePattern', - data: { - name: 'bar', - type: 'Destructured Variable', - pattern: DEFAULT_IGNORED_REGEX, - }, - line: 2, - column: 13, - endColumn: 16, - }, - ], - }, - { - code: 'const {foo, bar} = baz;', - errors: [ - { - messageId: 'unusedWithIgnorePattern', - data: { - name: 'foo', - type: 'Destructured Variable', - pattern: DEFAULT_IGNORED_REGEX, - }, - line: 1, - column: 8, - endColumn: 11, - }, - { - messageId: 'unusedWithIgnorePattern', - data: { - name: 'bar', - type: 'Destructured Variable', - pattern: DEFAULT_IGNORED_REGEX, - }, - line: 1, - column: 13, - endColumn: 16, - }, - ], - }, - { - code: 'const {foo, bar: _bar} = baz;', - errors: [ - { - messageId: 'unusedWithIgnorePattern', - data: { - name: 'foo', - type: 'Destructured Variable', - pattern: DEFAULT_IGNORED_REGEX, - }, - line: 1, - column: 8, - endColumn: 11, - }, - ], - }, - { - code: 'const [foo, bar] = baz;', - errors: [ - { - messageId: 'unusedWithIgnorePattern', - data: { - name: 'foo', - type: 'Destructured Variable', - pattern: DEFAULT_IGNORED_REGEX, - }, - line: 1, - column: 8, - endColumn: 11, - }, - { - messageId: 'unusedWithIgnorePattern', - data: { - name: 'bar', - type: 'Destructured Variable', - pattern: DEFAULT_IGNORED_REGEX, - }, - line: 1, - column: 13, - endColumn: 16, - }, - ], - }, - { - code: 'const [foo, _bar] = baz;', - errors: [ - { - messageId: 'unusedWithIgnorePattern', - data: { - name: 'foo', - type: 'Destructured Variable', - pattern: DEFAULT_IGNORED_REGEX, - }, - line: 1, - column: 8, - endColumn: 11, - }, - ], - }, - { - code: 'const [foo, [bar]] = baz;', - errors: [ - { - messageId: 'unusedWithIgnorePattern', - data: { - name: 'foo', - type: 'Destructured Variable', - pattern: DEFAULT_IGNORED_REGEX, - }, - line: 1, - column: 8, - endColumn: 11, - }, - { - messageId: 'unusedWithIgnorePattern', - data: { - name: 'bar', - type: 'Destructured Variable', - pattern: DEFAULT_IGNORED_REGEX, - }, - line: 1, - column: 14, - endColumn: 17, - }, - ], - }, - { - code: 'const {foo, bar: {baz}} = bam;', - errors: [ - { - messageId: 'unusedWithIgnorePattern', - data: { - name: 'foo', - type: 'Destructured Variable', - pattern: DEFAULT_IGNORED_REGEX, - }, - line: 1, - column: 8, - endColumn: 11, - }, - { - messageId: 'unusedWithIgnorePattern', - data: { - name: 'baz', - type: 'Destructured Variable', - pattern: DEFAULT_IGNORED_REGEX, - }, - line: 1, - column: 19, - endColumn: 22, - }, - ], - }, - { - code: 'const {foo, bar: [baz]} = bam;', - errors: [ - { - messageId: 'unusedWithIgnorePattern', - data: { - name: 'foo', - type: 'Destructured Variable', - pattern: DEFAULT_IGNORED_REGEX, - }, - line: 1, - column: 8, - endColumn: 11, - }, - { - messageId: 'unusedWithIgnorePattern', - data: { - name: 'baz', - type: 'Destructured Variable', - pattern: DEFAULT_IGNORED_REGEX, - }, - line: 1, - column: 19, - endColumn: 22, - }, - ], - }, - // #endregion variables // - ////////////////////////// - - //////////////////////// - // #region parameters // - //////////////////////// - { - code: ` -export function foo(a, b) { - console.log(b); -} - `, - errors: [ - { - messageId: 'unused', - data: { - name: 'a', - type: 'Parameter', - }, - line: 2, - column: 21, - endColumn: 22, - }, - ], - }, - { - code: ` -export function foo(a: string, b: string) { - console.log(b); -} - `, - errors: [ - { - messageId: 'unused', - data: { - name: 'a', - type: 'Parameter', - }, - line: 2, - column: 21, - endColumn: 30, - }, - ], - }, - { - code: ` -export class Clazz { - constructor(a: string, b: string) { - console.log(b); - } -} - `, - errors: [ - { - messageId: 'unused', - data: { - name: 'a', - type: 'Parameter', - }, - line: 3, - column: 15, - endColumn: 24, - }, - ], - }, - { - code: ` -export class Clazz { - constructor(a: string, public b: string) {} -} - `, - errors: [ - { - messageId: 'unused', - data: { - name: 'a', - type: 'Parameter', - }, - line: 3, - column: 15, - endColumn: 24, - }, - ], - }, - { - code: ` -export function foo({a}, used) { - console.log(used); -} - `, - errors: [ - { - messageId: 'unusedWithIgnorePattern', - data: { - name: 'a', - type: 'Destructured Variable', - pattern: DEFAULT_IGNORED_REGEX, - }, - line: 2, - column: 22, - endColumn: 23, - }, - ], - }, - { - code: ` -export function foo({a: {b}}, used) { - console.log(used); -} - `, - errors: [ - { - messageId: 'unusedWithIgnorePattern', - data: { - name: 'b', - type: 'Destructured Variable', - pattern: DEFAULT_IGNORED_REGEX, - }, - line: 2, - column: 26, - endColumn: 27, - }, - ], - }, - { - code: ` -export function foo([a], used) { - console.log(used); -} - `, - errors: [ - { - messageId: 'unusedWithIgnorePattern', - data: { - name: 'a', - type: 'Destructured Variable', - pattern: DEFAULT_IGNORED_REGEX, - }, - line: 2, - column: 22, - endColumn: 23, - }, - ], - }, - { - code: ` -export function foo([[a]], used) { - console.log(used); -} - `, - errors: [ - { - messageId: 'unusedWithIgnorePattern', - data: { - name: 'a', - type: 'Destructured Variable', - pattern: DEFAULT_IGNORED_REGEX, - }, - line: 2, - column: 23, - endColumn: 24, - }, - ], - }, - // #endregion parameters // - /////////////////////////// - - //////////////////// - // #region import // - //////////////////// - { - code: 'import foo = require("test")', - errors: [ - { - messageId: 'unusedWithIgnorePattern', - data: { - name: 'foo', - type: 'Import', - pattern: DEFAULT_IGNORED_REGEX, - }, - line: 1, - column: 8, - endColumn: 11, - }, - ], - }, - { - code: 'import defaultImp from "thing";', - errors: [ - { - messageId: 'unusedImport', - line: 1, - column: 1, - endColumn: 32, - }, - ], - }, - { - code: 'import { named } from "thing";', - errors: [ - { - messageId: 'unusedImport', - line: 1, - column: 1, - endColumn: 31, - }, - ], - }, - { - code: 'import * as namespace from "thing";', - errors: [ - { - messageId: 'unusedImport', - line: 1, - column: 1, - endColumn: 36, - }, - ], - }, - { - code: 'import defaultImp, { named } from "thing";', - errors: [ - { - messageId: 'unusedImport', - line: 1, - column: 1, - endColumn: 43, - }, - ], - }, - { - code: 'import defaultImp, * as namespace from "thing";', - errors: [ - { - messageId: 'unusedImport', - line: 1, - column: 1, - endColumn: 48, - }, - ], - }, - { - code: ` -import defaultImp, { named } from "thing"; -console.log(named); - `, - errors: [ - { - messageId: 'unusedWithIgnorePattern', - data: { - name: 'defaultImp', - type: 'Import', - pattern: DEFAULT_IGNORED_REGEX, - }, - line: 2, - column: 8, - endColumn: 18, - }, - ], - }, - { - code: ` -import defaultImp, * as named from "thing"; -console.log(named); - `, - errors: [ - { - messageId: 'unusedWithIgnorePattern', - data: { - name: 'defaultImp', - type: 'Import', - pattern: DEFAULT_IGNORED_REGEX, - }, - line: 2, - column: 8, - endColumn: 18, - }, - ], - }, - { - code: ` -import defaultImp, * as named from "thing"; -console.log(defaultImp); - `, - errors: [ - { - messageId: 'unusedWithIgnorePattern', - data: { - name: 'named', - type: 'Import', - pattern: DEFAULT_IGNORED_REGEX, - }, - line: 2, - column: 25, - endColumn: 30, - }, - ], - }, - { - code: ` -import defaultImp, { named } from "thing"; -console.log(defaultImp); - `, - errors: [ - { - messageId: 'unusedWithIgnorePattern', - data: { - name: 'named', - type: 'Import', - pattern: DEFAULT_IGNORED_REGEX, - }, - line: 2, - column: 22, - endColumn: 27, - }, - ], - }, - { - code: ` -import { named1, named2 } from "thing"; -console.log(named1); - `, - errors: [ - { - messageId: 'unusedWithIgnorePattern', - data: { - name: 'named2', - type: 'Import', - pattern: DEFAULT_IGNORED_REGEX, - }, - line: 2, - column: 18, - endColumn: 24, - }, - ], - }, - // #endregion import // - /////////////////////// - - ////////////////////// - // #region generics // - ////////////////////// - { - code: 'export function foo() {}', - errors: [ - { - messageId: 'unusedTypeParameters', - line: 1, - column: 20, - endColumn: 23, - }, - ], - }, - { - code: 'export function foo() {}', - errors: [ - { - messageId: 'unusedTypeParameters', - line: 1, - column: 20, - endColumn: 27, - }, - ], - }, - { - code: 'export function foo(): T2 {}', - errors: [ - { - messageId: 'unused', - data: { - name: 'T', - type: 'Type Parameter', - }, - line: 1, - column: 21, - endColumn: 22, - }, - ], - }, - { - code: 'export function foo() {}', - errors: [ - { - messageId: 'unused', - data: { - name: 'T', - type: 'Type Parameter', - }, - line: 1, - column: 21, - endColumn: 22, - }, - ], - }, - { - code: 'export class foo {}', - errors: [ - { - messageId: 'unusedTypeParameters', - line: 1, - column: 17, - endColumn: 20, - }, - ], - }, - { - code: 'export class foo {}', - errors: [ - { - messageId: 'unusedTypeParameters', - line: 1, - column: 17, - endColumn: 24, - }, - ], - }, - { - code: ` -export class foo { - prop: T2 -} - `, - errors: [ - { - messageId: 'unused', - data: { - name: 'T', - type: 'Type Parameter', - }, - line: 2, - column: 18, - endColumn: 19, - }, - ], - }, - { - code: 'export class foo {}', - errors: [ - { - messageId: 'unused', - data: { - name: 'T', - type: 'Type Parameter', - }, - line: 1, - column: 18, - endColumn: 19, - }, - ], - }, - { - code: 'export interface foo {}', - errors: [ - { - messageId: 'unusedTypeParameters', - line: 1, - column: 21, - endColumn: 24, - }, - ], - }, - { - code: 'export interface foo {}', - errors: [ - { - messageId: 'unusedTypeParameters', - line: 1, - column: 21, - endColumn: 28, - }, - ], - }, - { - code: ` -export interface foo { - prop: T2 -} - `, - errors: [ - { - messageId: 'unused', - data: { - name: 'T', - type: 'Type Parameter', - }, - line: 2, - column: 22, - endColumn: 23, - }, - ], - }, - { - code: 'export interface foo {}', - errors: [ - { - messageId: 'unused', - data: { - name: 'T', - type: 'Type Parameter', - }, - line: 1, - column: 22, - endColumn: 23, - }, - ], - }, - { - code: 'export type foo = {}', - errors: [ - { - messageId: 'unusedTypeParameters', - line: 1, - column: 16, - endColumn: 19, - }, - ], - }, - { - code: 'export type foo = {}', - errors: [ - { - messageId: 'unusedTypeParameters', - line: 1, - column: 16, - endColumn: 23, - }, - ], - }, - { - code: ` -export type foo = { - prop: T2 -} - `, - errors: [ - { - messageId: 'unused', - data: { - name: 'T', - type: 'Type Parameter', - }, - line: 2, - column: 17, - endColumn: 18, - }, - ], - }, - { - code: 'export type foo = {}', - errors: [ - { - messageId: 'unused', - data: { - name: 'T', - type: 'Type Parameter', - }, - line: 1, - column: 17, - endColumn: 18, - }, - ], - }, - // #endregion generics // - ///////////////////////// - ]), -}); 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 c5b5ef1887f2..fb7eadb47b71 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 @@ -559,11 +559,8 @@ export interface IFoo { ` import * as fastify from 'fastify'; import { Server, IncomingMessage, ServerResponse } from 'http'; -const server: fastify.FastifyInstance< - Server, - IncomingMessage, - ServerResponse -> = fastify({}); +const server: fastify.FastifyInstance = + fastify({}); server.get('/ping'); `, // https://github.com/typescript-eslint/typescript-eslint/issues/61 @@ -1579,6 +1576,33 @@ export const ComponentFoo = () => { }, ], }, + // https://github.com/typescript-eslint/typescript-eslint/issues/3303 + { + code: ` +import React from 'react'; + +export const ComponentFoo = () => { + return
Foo Foo
; +}; + `, + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + jsxPragma: null, + }, + errors: [ + { + messageId: 'unusedVar', + line: 2, + data: { + varName: 'React', + action: 'defined', + additional: '', + }, + }, + ], + }, { code: ` declare module 'foo' { 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 688b010e4178..8c6ef638a16c 100644 --- a/packages/eslint-plugin/tests/rules/no-var-requires.test.ts +++ b/packages/eslint-plugin/tests/rules/no-var-requires.test.ts @@ -132,5 +132,24 @@ ruleTester.run('no-var-requires', rule, { }, ], }, + { + // https://github.com/typescript-eslint/typescript-eslint/issues/3883 + code: ` +const configValidator = new Validator(require('./a.json')); +configValidator.addSchema(require('./a.json')); + `, + errors: [ + { + messageId: 'noVarReqs', + line: 2, + column: 39, + }, + { + messageId: 'noVarReqs', + line: 3, + column: 27, + }, + ], + }, ], }); 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 33c603135f5f..fadd5064abd1 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 @@ -54,6 +54,13 @@ const y = x as NonNullable; ` const foo = [] as const; `, + ` +const x = 1 as 1; + `, + ` +declare function foo(): T; +const bar = foo() as number; + `, ], invalid: [ 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 5c28cbef7ed7..7b917a673086 100644 --- a/packages/eslint-plugin/tests/rules/object-curly-spacing.test.ts +++ b/packages/eslint-plugin/tests/rules/object-curly-spacing.test.ts @@ -570,6 +570,70 @@ ruleTester.run('object-curly-spacing', rule, { code: 'const x:{[key: string]: [number]}', }, + // default - mapped types + { + code: "const x:{[k in 'union']: number}", + }, + { + code: "const x:{ // line-comment\n[k in 'union']: number\n}", + }, + { + code: "const x:{// line-comment\n[k in 'union']: number\n}", + }, + { + code: "const x:{/* inline-comment */[k in 'union']: number/* inline-comment */}", + }, + { + code: "const x:{\n[k in 'union']: number\n}", + }, + { + code: "const x:{[k in 'union']: {[k in 'union']: number}}", + }, + { + code: "const x:{[k in 'union']: [number]}", + }, + { + code: "const x:{[k in 'union']: value}", + }, + + // never - mapped types + { + code: "const x:{[k in 'union']: {[k in 'union']: number} }", + options: ['never', { objectsInObjects: true }], + }, + { + code: "const x:{[k in 'union']: {[k in 'union']: number}}", + options: ['never', { objectsInObjects: false }], + }, + { + code: "const x:{[k in 'union']: () => {[k in 'union']: number} }", + options: ['never', { objectsInObjects: true }], + }, + { + code: "const x:{[k in 'union']: () => {[k in 'union']: number}}", + options: ['never', { objectsInObjects: false }], + }, + { + code: "const x:{[k in 'union']: [ number ]}", + options: ['never', { arraysInObjects: false }], + }, + { + code: "const x:{ [k in 'union']: value}", + options: ['never', { arraysInObjects: true }], + }, + { + code: "const x:{[k in 'union']: value}", + options: ['never', { arraysInObjects: false }], + }, + { + code: "const x:{ [k in 'union']: [number] }", + options: ['never', { arraysInObjects: true }], + }, + { + code: "const x:{[k in 'union']: [number]}", + options: ['never', { arraysInObjects: false }], + }, + // never - object literal types { code: 'const x:{f: {g: number} }', @@ -612,6 +676,68 @@ ruleTester.run('object-curly-spacing', rule, { options: ['never', { arraysInObjects: false }], }, + // always - mapped types + { + code: "const x:{ [k in 'union']: number }", + options: ['always'], + }, + { + code: "const x:{ // line-comment\n[k in 'union']: number\n}", + options: ['always'], + }, + { + code: "const x:{ /* inline-comment */ [k in 'union']: number /* inline-comment */ }", + options: ['always'], + }, + { + code: "const x:{\n[k in 'union']: number\n}", + options: ['always'], + }, + { + code: "const x:{ [k in 'union']: [number] }", + options: ['always'], + }, + + // always - mapped types - objectsInObjects + { + code: "const x:{ [k in 'union']: { [k in 'union']: number } }", + options: ['always', { objectsInObjects: true }], + }, + { + code: "const x:{ [k in 'union']: { [k in 'union']: number }}", + options: ['always', { objectsInObjects: false }], + }, + { + code: "const x:{ [k in 'union']: () => { [k in 'union']: number } }", + options: ['always', { objectsInObjects: true }], + }, + { + code: "const x:{ [k in 'union']: () => { [k in 'union']: number }}", + options: ['always', { objectsInObjects: false }], + }, + + // always - mapped types - arraysInObjects + { + code: "type x = { [k in 'union']: number }", + options: ['always'], + }, + { + code: "const x:{ [k in 'union']: [number] }", + options: ['always', { arraysInObjects: true }], + }, + { + code: "const x:{ [k in 'union']: value }", + options: ['always', { arraysInObjects: true }], + }, + { + code: "const x:{[k in 'union']: value }", + options: ['always', { arraysInObjects: false }], + }, + { + code: "const x:{[k in 'union']: [number]}", + options: ['always', { arraysInObjects: false }], + }, + // always - object literal types { code: 'const x:{}', @@ -642,7 +768,7 @@ ruleTester.run('object-curly-spacing', rule, { options: ['always'], }, - // always - objectsInObjects + // always - literal types - objectsInObjects { code: 'const x:{ f: { g: number } }', options: ['always', { objectsInObjects: true }], @@ -660,7 +786,7 @@ ruleTester.run('object-curly-spacing', rule, { options: ['always', { objectsInObjects: false }], }, - // always - arraysInObjects + // always - literal types - arraysInObjects { code: 'const x:{ f: [number] }', options: ['always', { arraysInObjects: true }], @@ -1912,6 +2038,7 @@ ruleTester.run('object-curly-spacing', rule, { }, // object literal types + // never - literal types { code: 'type x = { f: number }', output: 'type x = {f: number}', @@ -1930,6 +2057,7 @@ ruleTester.run('object-curly-spacing', rule, { output: 'type x = {f: number}', errors: [{ messageId: 'unexpectedSpaceBefore' }], }, + // always - literal types { code: 'type x = {f: number}', output: 'type x = { f: number }', @@ -1951,5 +2079,58 @@ ruleTester.run('object-curly-spacing', rule, { options: ['always'], errors: [{ messageId: 'requireSpaceBefore' }], }, + + // never - mapped types + { + code: "type x = { [k in 'union']: number }", + output: "type x = {[k in 'union']: number}", + errors: [ + { messageId: 'unexpectedSpaceAfter' }, + { messageId: 'unexpectedSpaceBefore' }, + ], + }, + { + code: "type x = { [k in 'union']: number}", + output: "type x = {[k in 'union']: number}", + errors: [{ messageId: 'unexpectedSpaceAfter' }], + }, + { + code: "type x = {[k in 'union']: number }", + output: "type x = {[k in 'union']: number}", + errors: [{ messageId: 'unexpectedSpaceBefore' }], + }, + // always - mapped types + { + code: "type x = {[k in 'union']: number}", + output: "type x = { [k in 'union']: number }", + options: ['always'], + errors: [ + { messageId: 'requireSpaceAfter' }, + { messageId: 'requireSpaceBefore' }, + ], + }, + { + code: "type x = {[k in 'union']: number }", + output: "type x = { [k in 'union']: number }", + options: ['always'], + errors: [{ messageId: 'requireSpaceAfter' }], + }, + { + code: "type x = { [k in 'union']: number}", + output: "type x = { [k in 'union']: number }", + options: ['always'], + errors: [{ messageId: 'requireSpaceBefore' }], + }, + // Mapped and literal types mix + { + code: "type x = { [k in 'union']: { [k: string]: number } }", + output: "type x = {[k in 'union']: {[k: string]: number}}", + errors: [ + { messageId: 'unexpectedSpaceAfter' }, + { messageId: 'unexpectedSpaceAfter' }, + { messageId: 'unexpectedSpaceBefore' }, + { messageId: 'unexpectedSpaceBefore' }, + ], + }, ], }); 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 new file mode 100644 index 000000000000..8021b4a650ef --- /dev/null +++ b/packages/eslint-plugin/tests/rules/padding-line-between-statements.test.ts @@ -0,0 +1,5098 @@ +/* eslint-disable eslint-comments/no-use */ +// this rule tests new lines which prettier tries to fix, breaking the tests +/* eslint "@typescript-eslint/internal/plugin-test-formatting": ["error", { formatWithPrettier: false }] */ +/* eslint-enable eslint-comments/no-use */ + +import rule from '../../src/rules/padding-line-between-statements'; +import { RuleTester } from '../RuleTester'; + +//------------------------------------------------------------------------------ +// Tests +//------------------------------------------------------------------------------ + +const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', +}); + +ruleTester.run('padding-line-between-statements', rule, { + valid: [ + // do nothing if no options. + "'use strict'; foo(); if (a) { bar(); }", + + // do nothing for single statement. + { + code: 'foo()', + options: [{ blankLine: 'never', prev: '*', next: '*' }], + }, + { + code: 'foo()', + options: [{ blankLine: 'always', prev: '*', next: '*' }], + }, + + //---------------------------------------------------------------------- + // wildcard + //---------------------------------------------------------------------- + + { + code: 'foo();bar();', + options: [{ blankLine: 'never', prev: '*', next: '*' }], + }, + { + code: 'foo();\nbar();', + options: [{ blankLine: 'never', prev: '*', next: '*' }], + }, + { + code: 'foo();\n//comment\nbar();', + options: [{ blankLine: 'never', prev: '*', next: '*' }], + }, + { + code: 'foo();\n/*comment*/\nbar();', + options: [{ blankLine: 'never', prev: '*', next: '*' }], + }, + { + code: 'foo();\n\nbar();', + options: [{ blankLine: 'always', prev: '*', next: '*' }], + }, + { + code: 'foo();\n\n//comment\nbar();', + options: [{ blankLine: 'always', prev: '*', next: '*' }], + }, + { + code: 'foo();\n//comment\n\nbar();', + options: [{ blankLine: 'always', prev: '*', next: '*' }], + }, + { + code: 'foo();\n//comment\n\n//comment\nbar();', + options: [{ blankLine: 'always', prev: '*', next: '*' }], + }, + { + code: 'if(a){}\n\n;[].map(b)', + options: [ + { blankLine: 'always', prev: 'if', next: '*' }, + { blankLine: 'never', prev: 'empty', next: '*' }, + ], + }, + + //---------------------------------------------------------------------- + // block-like + //---------------------------------------------------------------------- + + { + code: 'foo();\n\n{ foo() }\n\nfoo();', + options: [ + { blankLine: 'always', prev: '*', next: '*' }, + { blankLine: 'never', prev: 'block-like', next: 'block-like' }, + ], + }, + { + code: '{ foo() } { foo() }', + options: [ + { blankLine: 'always', prev: '*', next: '*' }, + { blankLine: 'never', prev: 'block-like', next: 'block-like' }, + ], + }, + { + code: '{ foo() }\n{ foo() }', + options: [ + { blankLine: 'always', prev: '*', next: '*' }, + { blankLine: 'never', prev: 'block-like', next: 'block-like' }, + ], + }, + { + code: '{ foo() }\n\n{ foo() }', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'block-like', next: 'block-like' }, + ], + }, + { + code: '{ foo() }\n\n//comment\n{ foo() }', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'block-like', next: 'block-like' }, + ], + }, + { + code: 'if(a);\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'block-like', next: '*' }, + ], + }, + { + code: 'do;while(a);\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'block-like', next: '*' }, + ], + }, + { + code: 'do{}while(a);\n\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'block-like', next: '*' }, + ], + }, + { + code: 'a={}\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'block-like', next: '*' }, + ], + }, + { + code: 'let a={}\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'block-like', next: '*' }, + ], + }, + { + code: 'foo(function(){})\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'block-like', next: '*' }, + ], + }, + { + code: '(function(){})()\n\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'block-like', next: '*' }, + ], + }, + { + code: '!function(){}()\n\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'block-like', next: '*' }, + ], + }, + + //---------------------------------------------------------------------- + // exports + //---------------------------------------------------------------------- + + { + code: 'module.exports=1', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'exports', next: '*' }, + ], + }, + { + code: 'module.exports=1\n\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'exports', next: '*' }, + ], + }, + { + code: 'module.exports.foo=1\n\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'exports', next: '*' }, + ], + }, + { + code: 'exports.foo=1\n\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'exports', next: '*' }, + ], + }, + { + code: 'm.exports=1\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'exports', next: '*' }, + ], + }, + { + code: 'module.foo=1\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'exports', next: '*' }, + ], + }, + + //---------------------------------------------------------------------- + // require + //---------------------------------------------------------------------- + + { + code: 'foo=require("foo")\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'require', next: '*' }, + ], + }, + { + code: 'const foo=a.require("foo")\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'require', next: '*' }, + ], + }, + + //---------------------------------------------------------------------- + // directive + //---------------------------------------------------------------------- + + { + code: '"use strict"\n\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'directive', next: '*' }, + ], + }, + { + code: 'function foo(){"use strict"\n\nfoo()}', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'directive', next: '*' }, + ], + }, + { + code: '(function foo(){"use strict"\n\nfoo()})', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'directive', next: '*' }, + ], + }, + { + code: '(()=>{"use strict"\n\nfoo()})', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'directive', next: '*' }, + ], + }, + { + code: "'use strict'\n\nfoo()", + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'directive', next: '*' }, + ], + }, + { + code: 'foo("use strict")\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'directive', next: '*' }, + ], + }, + { + code: '`use strict`\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'directive', next: '*' }, + ], + }, + { + code: '("use strict")\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'directive', next: '*' }, + ], + }, + { + code: "'use '+'strict'\nfoo()", + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'directive', next: '*' }, + ], + }, + { + code: 'foo()\n"use strict"\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'directive', next: '*' }, + ], + }, + { + code: '{"use strict"\nfoo()}', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'directive', next: '*' }, + ], + }, + + //---------------------------------------------------------------------- + // multiline-block-like + //---------------------------------------------------------------------- + + { + code: '{}\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'multiline-block-like', next: '*' }, + ], + }, + { + code: 'if(a){}\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'multiline-block-like', next: '*' }, + ], + }, + { + code: 'while(a){}\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'multiline-block-like', next: '*' }, + ], + }, + { + code: '{\n}\n\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'multiline-block-like', next: '*' }, + ], + }, + { + code: 'if(a){\n}\n\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'multiline-block-like', next: '*' }, + ], + }, + { + code: 'while(a){\n}\n\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'multiline-block-like', next: '*' }, + ], + }, + { + code: 'do{\n}while(a)\n\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'multiline-block-like', next: '*' }, + ], + }, + { + code: 'for(;;){\n}\n\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'multiline-block-like', next: '*' }, + ], + }, + { + code: 'for(a in b){\n}\n\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'multiline-block-like', next: '*' }, + ], + }, + { + code: 'for(a of b){\n}\n\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'multiline-block-like', next: '*' }, + ], + }, + { + code: 'switch(a){\n}\n\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'multiline-block-like', next: '*' }, + ], + }, + { + code: 'function foo(a){\n}\n\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'multiline-block-like', next: '*' }, + ], + }, + { + code: 'var a=function foo(a){\n}\n\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'multiline-block-like', next: '*' }, + ], + }, + + //---------------------------------------------------------------------- + // block + //---------------------------------------------------------------------- + + { + code: '{}\n\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'block', next: '*' }, + ], + }, + { + code: '{\n}\n\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'block', next: '*' }, + ], + }, + { + code: '{\nfoo()\n}\n\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'block', next: '*' }, + ], + }, + { + code: 'if(a){}\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'block', next: '*' }, + ], + }, + { + code: 'a={}\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'block', next: '*' }, + ], + }, + + //---------------------------------------------------------------------- + // empty + //---------------------------------------------------------------------- + + { + code: ';\n\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'empty', next: '*' }, + ], + }, + { + code: '1;\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'empty', next: '*' }, + ], + }, + + //---------------------------------------------------------------------- + // expression + //---------------------------------------------------------------------- + + { + code: 'foo()\n\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'expression', next: '*' }, + ], + }, + { + code: 'a=b+c\n\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'expression', next: '*' }, + ], + }, + { + code: 'var a=1\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'expression', next: '*' }, + ], + }, + { + code: "'use strict'\nfoo()", + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'expression', next: '*' }, + ], + }, + + //---------------------------------------------------------------------- + // multiline-expression + //---------------------------------------------------------------------- + + { + code: 'foo()\n\nfoo(\n\tx,\n\ty\n)', + options: [ + { blankLine: 'always', prev: '*', next: 'multiline-expression' }, + ], + }, + { + code: 'foo()\nfoo()', + options: [ + { blankLine: 'always', prev: '*', next: 'multiline-expression' }, + ], + }, + { + code: '() => {\n\tsomeArray.forEach(x => doSomething(x));\n\treturn theThing;\n}', + options: [ + { blankLine: 'always', prev: 'multiline-expression', next: 'return' }, + ], + }, + { + code: '() => {\n\tsomeArray.forEach(\n\t\tx => doSomething(x)\n\t);\n\n\treturn theThing;\n}', + options: [ + { blankLine: 'always', prev: 'multiline-expression', next: 'return' }, + ], + }, + + //---------------------------------------------------------------------- + // break + //---------------------------------------------------------------------- + + { + code: 'A:{break A\n\nfoo()}', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'break', next: '*' }, + ], + }, + { + code: 'while(a){break\n\nfoo()}', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'break', next: '*' }, + ], + }, + { + code: 'switch(a){case 0:break\n\nfoo()}', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'break', next: '*' }, + ], + }, + { + code: 'switch(a){case 0:break\ncase 1:break}', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'break', next: '*' }, + ], + }, + + //---------------------------------------------------------------------- + // case + //---------------------------------------------------------------------- + + { + code: 'switch(a){case 0:\nfoo()\n\ncase 1:\nfoo()}', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'case', next: '*' }, + ], + }, + { + code: 'switch(a){case 0:\nfoo()\n\ndefault:\nfoo()}', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'case', next: '*' }, + ], + }, + + //---------------------------------------------------------------------- + // class + //---------------------------------------------------------------------- + + { + code: 'class A{}\n\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'class', next: '*' }, + ], + }, + { + code: 'var A = class{}\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'class', next: '*' }, + ], + }, + + //---------------------------------------------------------------------- + // const + //---------------------------------------------------------------------- + + { + code: 'const a=1\n\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'const', next: '*' }, + ], + }, + { + code: 'let a=1\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'const', next: '*' }, + ], + }, + + //---------------------------------------------------------------------- + // type + //---------------------------------------------------------------------- + + { + code: 'type a=number\n\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'type', next: '*' }, + ], + }, + { + code: 'let a=number\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'type', next: '*' }, + ], + }, + + //---------------------------------------------------------------------- + // interface + //---------------------------------------------------------------------- + + { + code: 'interface Test{\na:number;\n}\n\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'interface', next: '*' }, + ], + }, + + //---------------------------------------------------------------------- + // continue + //---------------------------------------------------------------------- + + { + code: 'while(a){continue\n\nfoo()}', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'continue', next: '*' }, + ], + }, + { + code: 'while(a){break\nfoo()}', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'continue', next: '*' }, + ], + }, + + //---------------------------------------------------------------------- + // debugger + //---------------------------------------------------------------------- + + { + code: 'debugger\n\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'debugger', next: '*' }, + ], + }, + + //---------------------------------------------------------------------- + // default + //---------------------------------------------------------------------- + + { + code: 'switch(a){default:\nfoo()\n\ncase 0:\nfoo()\ncase 1:}', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'default', next: '*' }, + ], + }, + + //---------------------------------------------------------------------- + // do + //---------------------------------------------------------------------- + + { + code: 'do;while(a)\n\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'do', next: '*' }, + ], + }, + { + code: 'while(a);\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'do', next: '*' }, + ], + }, + + //---------------------------------------------------------------------- + // export + //---------------------------------------------------------------------- + + { + code: 'export default 1\n\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'export', next: '*' }, + ], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + }, + { + code: 'export let a=1\n\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'export', next: '*' }, + ], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + }, + { + code: 'var a = 0; export {a}\n\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'export', next: '*' }, + ], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + }, + { + code: 'exports.foo=1\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'export', next: '*' }, + ], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + }, + { + code: 'module.exports={}\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'export', next: '*' }, + ], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + }, + + //---------------------------------------------------------------------- + // for + //---------------------------------------------------------------------- + + { + code: 'for(;;);\n\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'for', next: '*' }, + ], + }, + { + code: 'for(a in b);\n\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'for', next: '*' }, + ], + }, + { + code: 'for(a of b);\n\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'for', next: '*' }, + ], + }, + { + code: 'while(a);\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'for', next: '*' }, + ], + }, + + //---------------------------------------------------------------------- + // function + //---------------------------------------------------------------------- + + { + code: 'function foo(){}\n\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'function', next: '*' }, + ], + }, + { + code: 'var foo=function(){}\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'function', next: '*' }, + ], + }, + { + code: 'async function foo(){}\n\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'function', next: '*' }, + ], + }, + + //---------------------------------------------------------------------- + // if + //---------------------------------------------------------------------- + + { + code: 'if(a);\n\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'if', next: '*' }, + ], + }, + { + code: 'if(a);else;\n\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'if', next: '*' }, + ], + }, + { + code: 'if(a);else if(b);else;\n\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'if', next: '*' }, + ], + }, + { + code: 'for(;;);\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'if', next: '*' }, + ], + }, + + //---------------------------------------------------------------------- + // iife + //---------------------------------------------------------------------- + + { + code: '(function(){\n})()\n\nvar a = 2;', + options: [{ blankLine: 'always', prev: 'iife', next: '*' }], + }, + { + code: '+(function(){\n})()\n\nvar a = 2;', + options: [{ blankLine: 'always', prev: 'iife', next: '*' }], + }, + { + code: '(function(){\n})()\nvar a = 2;', + options: [{ blankLine: 'never', prev: 'iife', next: '*' }], + }, + { + code: '+(function(){\n})()\nvar a = 2;', + options: [{ blankLine: 'never', prev: 'iife', next: '*' }], + }, + { + code: '(1, 2, 3, function(){\n})()\n\nvar a = 2;', + options: [{ blankLine: 'always', prev: 'iife', next: '*' }], + }, + + //---------------------------------------------------------------------- + // import + //---------------------------------------------------------------------- + + { + code: "import 'a'\n\nfoo()", + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'import', next: '*' }, + ], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + }, + { + code: "import a from 'a'\n\nfoo()", + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'import', next: '*' }, + ], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + }, + { + code: "import * as a from 'a'\n\nfoo()", + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'import', next: '*' }, + ], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + }, + { + code: "import {a} from 'a'\n\nfoo()", + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'import', next: '*' }, + ], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + }, + { + code: "const a=require('a')\nfoo()", + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'import', next: '*' }, + ], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + }, + + //---------------------------------------------------------------------- + // let + //---------------------------------------------------------------------- + + { + code: 'let a=1\n\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'let', next: '*' }, + ], + }, + { + code: 'var a=1\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'let', next: '*' }, + ], + }, + + //---------------------------------------------------------------------- + // return + //---------------------------------------------------------------------- + + { + code: 'function foo(){return\n\nfoo()}', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'return', next: '*' }, + ], + }, + { + code: 'throw a\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'return', next: '*' }, + ], + }, + + //---------------------------------------------------------------------- + // switch + //---------------------------------------------------------------------- + + { + code: 'switch(a){}\n\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'switch', next: '*' }, + ], + }, + { + code: 'if(a){}\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'switch', next: '*' }, + ], + }, + + //---------------------------------------------------------------------- + // throw + //---------------------------------------------------------------------- + + { + code: 'throw a\n\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'throw', next: '*' }, + ], + }, + + //---------------------------------------------------------------------- + // try + //---------------------------------------------------------------------- + + { + code: 'try{}catch(e){}\n\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'try', next: '*' }, + ], + }, + { + code: 'try{}finally{}\n\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'try', next: '*' }, + ], + }, + { + code: 'try{}catch(e){}finally{}\n\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'try', next: '*' }, + ], + }, + + //---------------------------------------------------------------------- + // var + //---------------------------------------------------------------------- + + { + code: 'var a=1\n\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'var', next: '*' }, + ], + }, + { + code: 'const a=1\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'var', next: '*' }, + ], + }, + + //---------------------------------------------------------------------- + // while + //---------------------------------------------------------------------- + + { + code: 'while(a);\n\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'while', next: '*' }, + ], + }, + { + code: 'do;while(a)\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'while', next: '*' }, + ], + }, + + //---------------------------------------------------------------------- + // with + //---------------------------------------------------------------------- + + { + code: 'with(a);\n\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'with', next: '*' }, + ], + }, + + //---------------------------------------------------------------------- + // multiline-const + //---------------------------------------------------------------------- + + { + code: 'const a={\nb:1,\nc:2\n}\n\nconst d=3', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'multiline-const', next: '*' }, + ], + }, + { + code: 'const a=1\n\nconst b={\nc:2,\nd:3\n}', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: '*', next: 'multiline-const' }, + ], + }, + { + code: 'const a=1\nconst b=2', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'multiline-const', next: '*' }, + ], + }, + { + code: 'const a=1\nconst b=2', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: '*', next: 'multiline-const' }, + ], + }, + + //---------------------------------------------------------------------- + // multiline-let + //---------------------------------------------------------------------- + + { + code: 'let a={\nb:1,\nc:2\n}\n\nlet d=3', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'multiline-let', next: '*' }, + ], + }, + { + code: 'let a=1\n\nlet b={\nc:2,\nd:3\n}', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: '*', next: 'multiline-let' }, + ], + }, + { + code: 'let a=1\nlet b=2', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'multiline-let', next: '*' }, + ], + }, + { + code: 'let a=1\nlet b=2', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: '*', next: 'multiline-let' }, + ], + }, + + //---------------------------------------------------------------------- + // multiline-var + //---------------------------------------------------------------------- + + { + code: 'var a={\nb:1,\nc:2\n}\n\nvar d=3', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'multiline-var', next: '*' }, + ], + }, + { + code: 'var a=1\n\nvar b={\nc:2,\nd:3\n}', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: '*', next: 'multiline-var' }, + ], + }, + { + code: 'var a=1\nvar b=2', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'multiline-var', next: '*' }, + ], + }, + { + code: 'var a=1\nvar b=2', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: '*', next: 'multiline-var' }, + ], + }, + + //---------------------------------------------------------------------- + // single line const + //---------------------------------------------------------------------- + + { + code: 'const a=1\n\nconst b=2', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'singleline-const', next: '*' }, + ], + }, + { + code: 'const a=1\n\nconst b=2', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: '*', next: 'singleline-const' }, + ], + }, + { + code: 'const a={\nb:1,\nc:2\n}\nconst d={\ne:3,\nf:4\n}', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'singleline-const', next: '*' }, + ], + }, + { + code: 'const a={\nb:1,\nc:2\n}\nconst d={\ne:3,\nf:4\n}', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: '*', next: 'singleline-const' }, + ], + }, + + //---------------------------------------------------------------------- + // single line let + //---------------------------------------------------------------------- + + { + code: 'let a=1\n\nlet b=2', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'singleline-let', next: '*' }, + ], + }, + { + code: 'let a=1\n\nlet b=2', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: '*', next: 'singleline-let' }, + ], + }, + { + code: 'let a={\nb:1,\nc:2\n}\nlet d={\ne:3,\nf:4\n}', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'singleline-let', next: '*' }, + ], + }, + { + code: 'let a={\nb:1,\nc:2\n}\nlet d={\ne:3,\nf:4\n}', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: '*', next: 'singleline-let' }, + ], + }, + + //---------------------------------------------------------------------- + // single line var + //---------------------------------------------------------------------- + + { + code: 'var a=1\n\nvar b=2', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'singleline-var', next: '*' }, + ], + }, + { + code: 'var a=1\n\nvar b=2', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: '*', next: 'singleline-var' }, + ], + }, + { + code: 'var a={\nb:1,\nc:2\n}\nvar d={\ne:3,\nf:4\n}', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'singleline-var', next: '*' }, + ], + }, + { + code: 'var a={\nb:1,\nc:2\n}\nvar d={\ne:3,\nf:4\n}', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: '*', next: 'singleline-var' }, + ], + }, + + //---------------------------------------------------------------------- + // Tests from newline-after-var + //---------------------------------------------------------------------- + + // should skip rule entirely + { + code: 'console.log(greet);', + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: 'console.log(greet);', + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + + // should ignore a `var` with no following token + { + code: "var greet = 'hello';", + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: "var greet = 'hello';", + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + + // should allow no line break in "never" mode + { + code: "var greet = 'hello';console.log(greet);", + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + + // should allow no blank line in "never" mode + { + code: "var greet = 'hello';\nconsole.log(greet);", + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + + // should allow one blank line in "always" mode + { + code: "var greet = 'hello';\n\nconsole.log(greet);", + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + + // should allow two or more blank lines in "always" mode + { + code: "var greet = 'hello';\n\n\nconsole.log(greet);", + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: "var greet = 'hello';\n\n\n\nconsole.log(greet);", + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + + // should allow trailing whitespace after the `var` + { + code: "var greet = 'hello'; \n\nconsole.log(greet);", + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: "var greet = 'hello'; \nconsole.log(greet);", + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + + // should allow inline comments after the `var` + { + code: "var greet = 'hello'; // inline comment\n\nconsole.log(greet);", + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: "var greet = 'hello'; // inline comment\nconsole.log(greet);", + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + + // should allow a comment on the next line in "never" mode + { + code: "var greet = 'hello';\n// next-line comment\nconsole.log(greet);", + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: "var greet = 'hello';\n/* block comment\nblock comment */\nconsole.log(greet);", + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + + // should allow comments on the next line followed by a blank in "always" mode + { + code: "var greet = 'hello';\n// next-line comment\n\nconsole.log(greet);", + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: "var greet = 'hello';\n/* block comment\nblock comment */\n\nconsole.log(greet);", + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: "var greet = 'hello';\n// next-line comment\n// second-line comment\n\nconsole.log(greet);", + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + + // should allow comments on the next line followed by no blank in "never" mode + { + code: "var greet = 'hello';\n// next-line comment\n// second-line comment\nconsole.log(greet);", + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: "var greet = 'hello';\n// next-line comment\n/* block comment\nblock comment */\nconsole.log(greet);", + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + + // should allow another `var` statement to follow without blank line + { + code: "var greet = 'hello';var name = 'world';console.log(greet, name);", + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: "var greet = 'hello';\nvar name = 'world';\nconsole.log(greet, name);", + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: "var greet = 'hello';\nvar name = 'world';\n\nconsole.log(greet, name);", + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + + // should allow a comment directly between `var` statements + { + code: "var greet = 'hello';\n// inline comment\nvar name = 'world';\n\nconsole.log(greet, name);", + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: "var greet = 'hello';\n/* block comment\nblock comment */\nvar name = 'world';\n\nconsole.log(greet, name);", + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: "var greet = 'hello';\n// inline comment\nvar name = 'world';\nconsole.log(greet, name);", + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: "var greet = 'hello';\n/* block comment\nblock comment */\nvar name = 'world';\nconsole.log(greet, name);", + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + + // should handle single `var` statement with multiple declarations + { + code: "var greet = 'hello', name = 'world';console.log(greet, name);", + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: "var greet = 'hello', name = 'world';\nconsole.log(greet, name);", + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: "var greet = 'hello', name = 'world';\n\nconsole.log(greet, name);", + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + + // should handle single `var` statement with multi-line declaration + { + code: "var greet = 'hello',\nname = 'world';\n\nconsole.log(greet, name);", + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: "var greet = 'hello',\nname = 'world';\nconsole.log(greet, name);", + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: "var greet = 'hello', // inline comment\nname = 'world'; // inline comment\n\nconsole.log(greet, name);", + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: "var greet = 'hello', // inline comment\nname = 'world'; // inline comment\nconsole.log(greet, name);", + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: "var greet = 'hello',\nname = 'world';\n// next-line comment\nconsole.log(greet);", + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: "var greet = 'hello',\nname = 'world';\n/* block comment\nblock comment */\nconsole.log(greet);", + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + + // should handle ES6 `let` block binding + { + code: "let greet = 'hello';\n\nconsole.log(greet);", + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: "let greet = 'hello';\nconsole.log(greet);", + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + + // should handle ES6 `const` block binding + { + code: "const greet = 'hello';\n\nconsole.log(greet);", + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: "const greet = 'hello';\nconsole.log(greet);", + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + + // should handle a mix of `var`, `let`, or `const` + { + code: "let greet = 'hello';\nvar name = 'world';\n\nconsole.log(greet, name);", + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: "const greet = 'hello';\nvar name = 'world';\n\nconsole.log(greet, name);", + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: "let greet = 'hello';\nconst name = 'world';\n\nconsole.log(greet, name);", + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + + // should handle a mix of `var` or `let` inside for variations + { + code: 'for(let a = 1; a < 1; a++){\n break;\n}', + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: 'for(var a = 1; a < 1; a++){\n break;\n}', + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: 'for(let a = 1; a < 1; a++){\n break;\n}', + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: 'for(var a = 1; a < 1; a++){\n break;\n}', + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: 'for(let a in obj){\n break;\n}', + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: 'for(var a in obj){\n break;\n}', + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: 'for(let a in obj){\n break;\n}', + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: 'for(var a in obj){\n break;\n}', + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + + // should handle export specifiers + { + code: 'export let a = 1;\nexport let b = 2;', + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + }, + { + code: 'export let a = 1;\nexport let b = 2;', + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + }, + { + code: 'export var a = 1;\nexport var b = 2;', + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + }, + { + code: 'export var a = 1;\nexport var b = 2;', + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + }, + { + code: 'export const a = 1;\nexport const b = 2;', + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + }, + { + code: 'export const a = 1;\nexport const b = 2;', + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + }, + + // should allow no blank line at end of block + { + code: "function example() {\nvar greet = 'hello'\n}", + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: "function example() {\nvar greet = 'hello'\n}", + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: "function example() {\nvar greet = 'hello';\nconsole.log(greet);\n}", + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: "var f = function() {\nvar greet = 'hello'\n};", + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: "var f = function() {\nvar greet = 'hello'\n};", + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: "var f = function() {\nvar greet = 'hello';\nconsole.log(greet);\n};", + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: "() => {\nvar greet = 'hello';\n}", + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: "() => {\nvar greet = 'hello';\n}", + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: "() => {\nvar greet = 'hello';\nconsole.log(greet);\n}", + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: '{\nvar foo;\n}', + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: '{\nvar foo;\n}', + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: 'if(true) {\nvar foo;\n}', + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: 'if(true) {\nvar foo;\n}', + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: 'switch(a) {\ncase 0:\nvar foo;\n}', + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: 'switch(a) {\ncase 0:\nvar foo;\n}', + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + + // should handle one/no blank before case. + { + code: 'switch(a) {\ncase 0:\nvar foo;\n\ncase 1:}', + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: 'switch(a) {\ncase 0:\nvar foo;\ncase 1:}', + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + + // https://github.com/eslint/eslint/issues/6834 + { + code: ` +var a = 1 + +;(b || c).doSomething() + `, + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: ` +var a = 1 +;(b || c).doSomething() + `, + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: ` +var a = 1 +; +(b || c).doSomething(); + `, + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + + { + code: 'switch(a) {\ncase 0:\nvar foo;\n\ncase 1:}', + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: 'switch(a) {\ncase 0:\nvar foo;\ncase 1:}', + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + { + code: ` +var a = 1 + +; +(b || c).doSomething(); + `, + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + }, + + //---------------------------------------------------------------------- + // Tests from newline-before-return + //---------------------------------------------------------------------- + + { + code: 'function a() {\nreturn;\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\n\nreturn;\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\nvar b;\n\nreturn;\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\nif (b) return;\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\nif (b) { return; }\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\nif (b) {\nreturn;\n}\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\nif (b) {\n\nreturn;\n}\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\nif (b) {\nreturn;\n}\n\nreturn c;\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\nif (b) {\n\nreturn;\n}\n\nreturn c;\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\nif (!b) {\nreturn;\n} else {\nreturn b;\n}\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\nif (!b) {\nreturn;\n} else {\n\nreturn b;\n}\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\nif (b) {\nreturn b;\n} else if (c) {\nreturn c;\n}\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\nif (b) {\nreturn b;\n} else if (c) {\nreturn c;\n} else {\nreturn d;\n}\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\nif (b) {\nreturn b;\n} else if (c) {\nreturn c;\n} else {\nreturn d;\n}\n\nreturn a;\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\nif (b) return b;\nelse if (c) return c;\nelse return d;\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\nif (b) return b;\nelse if (c) return c;\nelse {\nreturn d;\n}\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\nif (b) return b;\nelse if (c) return c;\nelse {\ne();\n\nreturn d;\n}\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\nwhile (b) return;\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\n while (b) \nreturn;\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\n while (b) { return; }\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\n while (b) {\nreturn;\n}\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\n while (b) {\nc();\n\nreturn;\n}\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\nvar c;\nwhile (b) {\n c = d; //comment\n}\n\nreturn c;\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\ndo return;\nwhile (b);\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\ndo \nreturn;\nwhile (b);\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\ndo { return; } while (b);\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\ndo { return; }\nwhile (b);\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\ndo {\nreturn;\n} while (b);\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\ndo {\nc();\n\nreturn;\n} while (b);\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\nfor (var b; b < c; b++) return;\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\nfor (var b; b < c; b++)\nreturn;\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\nfor (var b; b < c; b++) {\nreturn;\n}\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\nfor (var b; b < c; b++) {\nc();\n\nreturn;\n}\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\nfor (var b; b < c; b++) {\nif (d) {\nbreak; //comment\n}\n\nreturn;\n}\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\nfor (b in c)\nreturn;\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\nfor (b in c) { return; }\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\nfor (b in c) {\nreturn;\n}\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\nfor (b in c) {\nd();\n\nreturn;\n}\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\nfor (b of c) return;\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\nfor (b of c)\nreturn;\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\nfor (b of c) {\nreturn;\n}\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\nfor (b of c) {\nd();\n\nreturn;\n}\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: "function a() {\nswitch (b) {\ncase 'b': return;\n}\n}", + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: "function a() {\nswitch (b) {\ncase 'b':\nreturn;\n}\n}", + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: "function a() {\nswitch (b) {\ncase 'b': {\nreturn;\n}\n}\n}", + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\n//comment\nreturn b;\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\n{\n//comment\n}\n\nreturn\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\nvar b = {\n//comment\n};\n\nreturn;\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {/*multi-line\ncomment*/return b;\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\n/*comment\ncomment*/\n//comment\nreturn b;\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\n/*comment\ncomment*/\n//comment\nif (b) return;\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\n/*comment\ncomment*/\n//comment\nif (b) {\nc();\n\nreturn b;\n} else {\n//comment\nreturn d;\n}\n\n/*multi-line\ncomment*/\nreturn e;\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\nif (b) { //comment\nreturn;\n}\n\nreturn c;\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\nif (b) { return; } //comment\n\nreturn c;\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\nif (b) { return; } /*multi-line\ncomment*/\n\nreturn c;\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'function a() {\nif (b) { return; }\n\n/*multi-line\ncomment*/ return c;\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + }, + { + code: 'return;', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + parserOptions: { ecmaFeatures: { globalReturn: true } }, + }, + { + code: 'var a;\n\nreturn;', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + parserOptions: { ecmaFeatures: { globalReturn: true } }, + }, + { + code: '// comment\nreturn;', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + parserOptions: { ecmaFeatures: { globalReturn: true } }, + }, + { + code: '/* comment */\nreturn;', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + parserOptions: { ecmaFeatures: { globalReturn: true } }, + }, + { + code: '/* multi-line\ncomment */\nreturn;', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + parserOptions: { ecmaFeatures: { globalReturn: true } }, + }, + + //---------------------------------------------------------------------- + // From JSCS disallowPaddingNewLinesAfterBlocks + // https://github.com/jscs-dev/node-jscs/blob/44f9b86eb0757fd4ca05a81a50450c5f1b25c37b/test/specs/rules/disallow-padding-newlines-after-blocks.js + //---------------------------------------------------------------------- + + { + code: 'if(true){}', + options: [{ blankLine: 'never', prev: 'block-like', next: '*' }], + }, + { + code: 'if(true){}\n', + options: [{ blankLine: 'never', prev: 'block-like', next: '*' }], + }, + { + code: 'if(true){}\nvar a = 2;', + options: [{ blankLine: 'never', prev: 'block-like', next: '*' }], + }, + { + code: 'if(true){\nif(true) {}\n}', + options: [{ blankLine: 'never', prev: 'block-like', next: '*' }], + }, + { + code: 'var a = {\nfoo: function() {\n},\nbar: function() {\n}}', + options: [{ blankLine: 'never', prev: 'block-like', next: '*' }], + }, + { + code: '(function(){\n})()\nvar a = 2;', + options: [{ blankLine: 'never', prev: 'block-like', next: '*' }], + }, + { + code: 'if(true) {\n}\nelse\n{\n}', + options: [{ blankLine: 'never', prev: 'block-like', next: '*' }], + }, + { + code: 'if(true) {\n} else {\n var a = 2; }', + options: [{ blankLine: 'never', prev: 'block-like', next: '*' }], + }, + { + code: 'if(true) {\n}\nelse if(true)\n{\n}\nelse {\n}', + options: [{ blankLine: 'never', prev: 'block-like', next: '*' }], + }, + { + code: 'do{\n}\nwhile(true)', + options: [{ blankLine: 'never', prev: 'block-like', next: '*' }], + }, + { + code: 'try{\n}\ncatch(e) {}', + options: [{ blankLine: 'never', prev: 'block-like', next: '*' }], + }, + { + code: 'try{\n}\nfinally {}', + options: [{ blankLine: 'never', prev: 'block-like', next: '*' }], + }, + { + code: 'try{\n}\ncatch(e) {\n}\nfinally {\n}', + options: [{ blankLine: 'never', prev: 'block-like', next: '*' }], + }, + { + code: '[].map(function() {})\n.filter(function(){})', + options: [{ blankLine: 'never', prev: 'block-like', next: '*' }], + }, + + //---------------------------------------------------------------------- + // From JSCS disallowPaddingNewLinesBeforeExport + // https://github.com/jscs-dev/node-jscs/blob/44f9b86eb0757fd4ca05a81a50450c5f1b25c37b/test/specs/rules/disallow-padding-newlines-before-export.js + //---------------------------------------------------------------------- + + { + code: 'var a = 2;\nmodule.exports = a;', + options: [{ blankLine: 'never', prev: '*', next: 'exports' }], + }, + { + code: 'module.exports = 2;', + options: [{ blankLine: 'never', prev: '*', next: 'exports' }], + }, + { + code: 'var a = 2;\n// foo\nmodule.exports = a;', + options: [{ blankLine: 'never', prev: '*', next: 'exports' }], + }, + + /* + * TODO: May it need an option to ignore blank lines followed by comments? + * { + * code: "var a = 2;\n\n// foo\nmodule.exports = a;", + * options: [ + * { blankLine: "never", prev: "*", next: "exports" } + * ] + * }, + */ + { + code: 'var a = 2;\n\nfoo.exports = a;', + options: [{ blankLine: 'never', prev: '*', next: 'exports' }], + }, + { + code: 'var a = 2;\n\nmodule.foo = a;', + options: [{ blankLine: 'never', prev: '*', next: 'exports' }], + }, + { + code: 'var a = 2;\n\nfoo = a;', + options: [{ blankLine: 'never', prev: '*', next: 'exports' }], + }, + + //---------------------------------------------------------------------- + // From JSCS requirePaddingNewLinesAfterBlocks + // https://github.com/jscs-dev/node-jscs/blob/44f9b86eb0757fd4ca05a81a50450c5f1b25c37b/test/specs/rules/require-padding-newlines-after-blocks.js + //---------------------------------------------------------------------- + + { + code: '{}', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + }, + { + code: 'if(true){}', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + }, + { + code: 'if(true){}\n', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + }, + { + code: 'if(true){}\n\nvar a = 2;', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + }, + { + code: 'if(true){}\n\n\nvar a = 2;', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + }, + { + code: 'if(true){\nif(true) {}\n}', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + }, + { + code: 'var a = {\nfoo: function() {\n},\n\nbar: function() {\n}}', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + }, + { + code: '(function(){\n})()\n\nvar a = 2;', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + }, + { + code: 'if(true) {\n}\nelse\n{\n}', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + }, + { + code: 'if(true) {\n} else {\n var a = 2; }', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + }, + { + code: 'if(true) {\n}\nelse if(true)\n{\n}\nelse {\n}', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + }, + { + code: 'do{\n}\nwhile(true)', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + }, + { + code: 'try{\n}\ncatch(e) {}', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + }, + { + code: 'try{\n}\nfinally {}', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + }, + { + code: 'try{\n}\ncatch(e) {\n}\nfinally {\n}', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + }, + { + code: '[].map(function() {})\n.filter(function(){})', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + }, + { + code: 'func(\n2,\n3,\nfunction() {\n}\n)', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + }, + { + code: '[\n2,\n3,\nfunction() {\n}\n]', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + }, + { + code: 'a(res => {\n})\n.b();', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + }, + { + code: 'var foo = (\n\nfoo\n\n);', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + parserOptions: { ecmaFeatures: { jsx: true } }, + }, + { + code: 'var i = 0;\nwhile (i < 100) {\nif(i % 2 === 0) {continue;}\n++i;\n}', + options: [ + { blankLine: 'always', prev: 'multiline-block-like', next: '*' }, + ], + }, + { + code: 'var i = 0;\nwhile (i < 100) {\nif(i % 2 === 0) {if(i === 4) {continue;}}\n++i;\n}', + options: [ + { blankLine: 'always', prev: 'multiline-block-like', next: '*' }, + ], + }, + + //---------------------------------------------------------------------- + // From JSCS requirePaddingNewLinesBeforeExport + // https://github.com/jscs-dev/node-jscs/blob/44f9b86eb0757fd4ca05a81a50450c5f1b25c37b/test/specs/rules/require-padding-newlines-before-export.js + //---------------------------------------------------------------------- + + { + code: 'module.exports = 2;', + options: [{ blankLine: 'always', prev: '*', next: 'exports' }], + }, + { + code: 'var a = 2;\n\nmodule.exports = a;', + options: [{ blankLine: 'always', prev: '*', next: 'exports' }], + }, + { + code: 'var a = 2;\nfoo.exports = a;', + options: [{ blankLine: 'always', prev: '*', next: 'exports' }], + }, + { + code: 'var a = 2;\nmodule.foo = a;', + options: [{ blankLine: 'always', prev: '*', next: 'exports' }], + }, + { + code: 'if (true) {\nmodule.exports = a;\n}', + options: [{ blankLine: 'always', prev: '*', next: 'exports' }], + }, + + //---------------------------------------------------------------------- + // From JSCS requirePaddingNewlinesBeforeKeywords + // https://github.com/jscs-dev/node-jscs/blob/44f9b86eb0757fd4ca05a81a50450c5f1b25c37b/test/specs/rules/require-padding-newlines-before-keywords.js + //---------------------------------------------------------------------- + + { + code: 'function x() { return; }', + options: [ + { + blankLine: 'always', + prev: '*', + next: [ + 'if', + 'for', + 'return', + 'switch', + 'case', + 'break', + 'throw', + 'while', + 'default', + ], + }, + ], + }, + { + code: 'if (true) {} else if (false) {}', + options: [ + { + blankLine: 'always', + prev: '*', + next: [ + 'if', + 'for', + 'return', + 'switch', + 'case', + 'break', + 'throw', + 'while', + 'default', + ], + }, + ], + }, + { + code: 'function x() { var a = true; do { a = !a; } while (a); }', + options: [ + { + blankLine: 'always', + prev: '*', + next: [ + 'if', + 'for', + 'return', + 'switch', + 'case', + 'break', + 'throw', + 'while', + 'default', + ], + }, + ], + }, + { + code: 'function x() { if (true) return; }', + options: [ + { + blankLine: 'always', + prev: '*', + next: [ + 'if', + 'for', + 'return', + 'switch', + 'case', + 'break', + 'throw', + 'while', + 'default', + ], + }, + ], + }, + { + code: 'function test() {};', + options: [ + { blankLine: 'always', prev: 'block-like', next: 'block-like' }, + ], + }, + ], + invalid: [ + //---------------------------------------------------------------------- + // wildcard + //---------------------------------------------------------------------- + + { + code: 'foo();\n\nfoo();', + output: 'foo();\nfoo();', + options: [{ blankLine: 'never', prev: '*', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'foo();\n\n//comment\nfoo();', + output: 'foo();\n//comment\nfoo();', + options: [{ blankLine: 'never', prev: '*', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: ' foo();\n \n //comment\n foo();', + output: ' foo();\n //comment\n foo();', + options: [{ blankLine: 'never', prev: '*', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'if (a) {}\n\nfor (;;) {}', + output: 'if (a) {}\nfor (;;) {}', + options: [{ blankLine: 'never', prev: '*', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'foo();\nfoo();', + output: 'foo();\n\nfoo();', + options: [{ blankLine: 'always', prev: '*', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: ' function a() {}\n do {} while (a)', + output: ' function a() {}\n\n do {} while (a)', + options: [{ blankLine: 'always', prev: '*', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'foo();//trailing-comment\n//comment\n//comment\nfoo();', + output: 'foo();//trailing-comment\n\n//comment\n//comment\nfoo();', + options: [{ blankLine: 'always', prev: '*', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + + //---------------------------------------------------------------------- + // block-like + //---------------------------------------------------------------------- + + { + code: '{}\n\nfoo()', + output: '{}\nfoo()', + options: [{ blankLine: 'never', prev: 'block-like', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: '{}\nfoo()', + output: '{}\n\nfoo()', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'if(a){}\nfoo()', + output: 'if(a){}\n\nfoo()', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'if(a){}else{}\nfoo()', + output: 'if(a){}else{}\n\nfoo()', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'if(a){}else if(b){}\nfoo()', + output: 'if(a){}else if(b){}\n\nfoo()', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'if(a){}else if(b){}else{}\nfoo()', + output: 'if(a){}else if(b){}else{}\n\nfoo()', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'switch(a){}\nfoo()', + output: 'switch(a){}\n\nfoo()', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'switch(a){case 0:}\nfoo()', + output: 'switch(a){case 0:}\n\nfoo()', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'try{}catch(e){}\nfoo()', + output: 'try{}catch(e){}\n\nfoo()', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'try{}finally{}\nfoo()', + output: 'try{}finally{}\n\nfoo()', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'try{}catch(e){}finally{}\nfoo()', + output: 'try{}catch(e){}finally{}\n\nfoo()', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'while(a){}\nfoo()', + output: 'while(a){}\n\nfoo()', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'do{}while(a)\nfoo()', + output: 'do{}while(a)\n\nfoo()', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'for(;;){}\nfoo()', + output: 'for(;;){}\n\nfoo()', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'for(a in b){}\nfoo()', + output: 'for(a in b){}\n\nfoo()', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'for(a of b){}\nfoo()', + output: 'for(a of b){}\n\nfoo()', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'a=function(){}\nfoo()', + output: 'a=function(){}\n\nfoo()', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'a=()=>{}\nfoo()', + output: 'a=()=>{}\n\nfoo()', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'function a(){}\nfoo()', + output: 'function a(){}\n\nfoo()', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'let a=function(){}\nfoo()', + output: 'let a=function(){}\n\nfoo()', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + + //---------------------------------------------------------------------- + // exports + //---------------------------------------------------------------------- + + { + code: 'module.exports=1\n\nfoo()', + output: 'module.exports=1\nfoo()', + options: [{ blankLine: 'never', prev: 'exports', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'module.exports=1\nfoo()', + output: 'module.exports=1\n\nfoo()', + options: [{ blankLine: 'always', prev: 'exports', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'module.exports.foo=1\nfoo()', + output: 'module.exports.foo=1\n\nfoo()', + options: [{ blankLine: 'always', prev: 'exports', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'module.exports[foo]=1\nfoo()', + output: 'module.exports[foo]=1\n\nfoo()', + options: [{ blankLine: 'always', prev: 'exports', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'exports.foo=1\nfoo()', + output: 'exports.foo=1\n\nfoo()', + options: [{ blankLine: 'always', prev: 'exports', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'exports[foo]=1\nfoo()', + output: 'exports[foo]=1\n\nfoo()', + options: [{ blankLine: 'always', prev: 'exports', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + + //---------------------------------------------------------------------- + // require + //---------------------------------------------------------------------- + + { + code: 'const foo=require("foo")\n\nfoo()', + output: 'const foo=require("foo")\nfoo()', + options: [{ blankLine: 'never', prev: 'require', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'const foo=require("foo")\nfoo()', + output: 'const foo=require("foo")\n\nfoo()', + options: [{ blankLine: 'always', prev: 'require', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'const foo=require("foo").Foo\nfoo()', + output: 'const foo=require("foo").Foo\n\nfoo()', + options: [{ blankLine: 'always', prev: 'require', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'const foo=require("foo")[a]\nfoo()', + output: 'const foo=require("foo")[a]\n\nfoo()', + options: [{ blankLine: 'always', prev: 'require', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + + //---------------------------------------------------------------------- + // directive + //---------------------------------------------------------------------- + + { + code: '"use strict"\n\nfoo()', + output: '"use strict"\nfoo()', + options: [{ blankLine: 'never', prev: 'directive', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: '"use strict"\nfoo()', + output: '"use strict"\n\nfoo()', + options: [{ blankLine: 'always', prev: 'directive', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: "'use strict'\nfoo()", + output: "'use strict'\n\nfoo()", + options: [{ blankLine: 'always', prev: 'directive', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: "'use asm'\nfoo()", + output: "'use asm'\n\nfoo()", + options: [{ blankLine: 'always', prev: 'directive', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + + //---------------------------------------------------------------------- + // multiline-block-like + //---------------------------------------------------------------------- + + { + code: '{\n}\n\nfoo()', + output: '{\n}\nfoo()', + options: [{ blankLine: 'never', prev: 'block-like', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: '{\n}\nfoo()', + output: '{\n}\n\nfoo()', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'if(a){\n}\nfoo()', + output: 'if(a){\n}\n\nfoo()', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'if(a){\n}else{\n}\nfoo()', + output: 'if(a){\n}else{\n}\n\nfoo()', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'if(a){\n}else if(b){\n}\nfoo()', + output: 'if(a){\n}else if(b){\n}\n\nfoo()', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'if(a){\n}else if(b){\n}else{\n}\nfoo()', + output: 'if(a){\n}else if(b){\n}else{\n}\n\nfoo()', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'switch(a){\n}\nfoo()', + output: 'switch(a){\n}\n\nfoo()', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'try{\n}catch(e){\n}\nfoo()', + output: 'try{\n}catch(e){\n}\n\nfoo()', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'try{\n}finally{\n}\nfoo()', + output: 'try{\n}finally{\n}\n\nfoo()', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'try{\n}catch(e){\n}finally{\n}\nfoo()', + output: 'try{\n}catch(e){\n}finally{\n}\n\nfoo()', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'while(a){\n}\nfoo()', + output: 'while(a){\n}\n\nfoo()', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'do{\n}while(a)\nfoo()', + output: 'do{\n}while(a)\n\nfoo()', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'for(;;){\n}\nfoo()', + output: 'for(;;){\n}\n\nfoo()', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'for(a in b){\n}\nfoo()', + output: 'for(a in b){\n}\n\nfoo()', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'for(a of b){\n}\nfoo()', + output: 'for(a of b){\n}\n\nfoo()', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'a=function(){\n}\nfoo()', + output: 'a=function(){\n}\n\nfoo()', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'a=()=>{\n}\nfoo()', + output: 'a=()=>{\n}\n\nfoo()', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'function a(){\n}\nfoo()', + output: 'function a(){\n}\n\nfoo()', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'let a=function(){\n}\nfoo()', + output: 'let a=function(){\n}\n\nfoo()', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + + //---------------------------------------------------------------------- + // block + //---------------------------------------------------------------------- + + { + code: '{}\n\nfoo()', + output: '{}\nfoo()', + options: [{ blankLine: 'never', prev: 'block', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: '{}\nfoo()', + output: '{}\n\nfoo()', + options: [{ blankLine: 'always', prev: 'block', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + + //---------------------------------------------------------------------- + // empty + //---------------------------------------------------------------------- + + { + code: ';\n\nfoo()', + output: ';\nfoo()', + options: [{ blankLine: 'never', prev: 'empty', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: ';\nfoo()', + output: ';\n\nfoo()', + options: [{ blankLine: 'always', prev: 'empty', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + + //---------------------------------------------------------------------- + // expression + //---------------------------------------------------------------------- + + { + code: 'foo()\n\nfoo()', + output: 'foo()\nfoo()', + options: [{ blankLine: 'never', prev: 'expression', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'foo()\nfoo()', + output: 'foo()\n\nfoo()', + options: [{ blankLine: 'always', prev: 'expression', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + + //---------------------------------------------------------------------- + // multiline-expression + //---------------------------------------------------------------------- + + { + code: 'foo()\n\nfoo(\n\tx,\n\ty\n)', + output: 'foo()\nfoo(\n\tx,\n\ty\n)', + options: [ + { blankLine: 'never', prev: '*', next: 'multiline-expression' }, + ], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'foo()\nfoo(\n\tx,\n\ty\n)', + output: 'foo()\n\nfoo(\n\tx,\n\ty\n)', + options: [ + { blankLine: 'always', prev: '*', next: 'multiline-expression' }, + ], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: '() => {\n\tsomeArray.forEach(\n\t\tx => doSomething(x)\n\t);\n\treturn theThing;\n}', + output: + '() => {\n\tsomeArray.forEach(\n\t\tx => doSomething(x)\n\t);\n\n\treturn theThing;\n}', + options: [ + { blankLine: 'always', prev: 'multiline-expression', next: 'return' }, + ], + errors: [{ messageId: 'expectedBlankLine' }], + }, + + //---------------------------------------------------------------------- + // break + //---------------------------------------------------------------------- + + { + code: 'while(a){break\n\nfoo()}', + output: 'while(a){break\nfoo()}', + options: [{ blankLine: 'never', prev: 'break', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'switch(a){case 0:break\n\nfoo()}', + output: 'switch(a){case 0:break\nfoo()}', + options: [{ blankLine: 'never', prev: 'break', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'while(a){break\nfoo()}', + output: 'while(a){break\n\nfoo()}', + options: [{ blankLine: 'always', prev: 'break', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'switch(a){case 0:break\nfoo()}', + output: 'switch(a){case 0:break\n\nfoo()}', + options: [{ blankLine: 'always', prev: 'break', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + + //---------------------------------------------------------------------- + // case + //---------------------------------------------------------------------- + + { + code: 'switch(a){case 0:\nfoo()\n\ndefault:}', + output: 'switch(a){case 0:\nfoo()\ndefault:}', + options: [{ blankLine: 'never', prev: 'case', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'switch(a){case 0:\nfoo()\ndefault:}', + output: 'switch(a){case 0:\nfoo()\n\ndefault:}', + options: [{ blankLine: 'always', prev: 'case', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + + //---------------------------------------------------------------------- + // class + //---------------------------------------------------------------------- + + { + code: 'class A{}\n\nfoo()', + output: 'class A{}\nfoo()', + options: [{ blankLine: 'never', prev: 'class', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'class A{}\nfoo()', + output: 'class A{}\n\nfoo()', + options: [{ blankLine: 'always', prev: 'class', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + + //---------------------------------------------------------------------- + // const + //---------------------------------------------------------------------- + + { + code: 'const a=1\n\nfoo()', + output: 'const a=1\nfoo()', + options: [{ blankLine: 'never', prev: 'const', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'const a=1\nfoo()', + output: 'const a=1\n\nfoo()', + options: [{ blankLine: 'always', prev: 'const', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + + //---------------------------------------------------------------------- + // type + //---------------------------------------------------------------------- + + { + code: 'type a=number\n\nfoo()', + output: 'type a=number\nfoo()', + options: [{ blankLine: 'never', prev: 'type', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'type a=number\nfoo()', + output: 'type a=number\n\nfoo()', + options: [{ blankLine: 'always', prev: 'type', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + + //---------------------------------------------------------------------- + // interface + //---------------------------------------------------------------------- + + { + code: 'interface Test{\na:number;\n}\nfoo()', + output: 'interface Test{\na:number;\n}\n\nfoo()', + options: [{ blankLine: 'always', prev: 'interface', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + + //---------------------------------------------------------------------- + // continue + //---------------------------------------------------------------------- + + { + code: 'while(a){continue\n\nfoo()}', + output: 'while(a){continue\nfoo()}', + options: [{ blankLine: 'never', prev: 'continue', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'while(a){continue\nfoo()}', + output: 'while(a){continue\n\nfoo()}', + options: [{ blankLine: 'always', prev: 'continue', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + + //---------------------------------------------------------------------- + // debugger + //---------------------------------------------------------------------- + + { + code: 'debugger\n\nfoo()', + output: 'debugger\nfoo()', + options: [{ blankLine: 'never', prev: 'debugger', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'debugger\nfoo()', + output: 'debugger\n\nfoo()', + options: [{ blankLine: 'always', prev: 'debugger', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + + //---------------------------------------------------------------------- + // default + //---------------------------------------------------------------------- + + { + code: 'switch(a){default:\nfoo()\n\ncase 0:}', + output: 'switch(a){default:\nfoo()\ncase 0:}', + options: [{ blankLine: 'never', prev: 'default', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'switch(a){default:\nfoo()\ncase 0:}', + output: 'switch(a){default:\nfoo()\n\ncase 0:}', + options: [{ blankLine: 'always', prev: 'default', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + + //---------------------------------------------------------------------- + // do + //---------------------------------------------------------------------- + + { + code: 'do;while(a)\n\nfoo()', + output: 'do;while(a)\nfoo()', + options: [{ blankLine: 'never', prev: 'do', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'do;while(a)\nfoo()', + output: 'do;while(a)\n\nfoo()', + options: [{ blankLine: 'always', prev: 'do', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + + //---------------------------------------------------------------------- + // export + //---------------------------------------------------------------------- + + { + code: 'export default 1\n\nfoo()', + output: 'export default 1\nfoo()', + options: [{ blankLine: 'never', prev: 'export', next: '*' }], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'export let a=1\n\nfoo()', + output: 'export let a=1\nfoo()', + options: [{ blankLine: 'never', prev: 'export', next: '*' }], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'var a = 0;export {a}\n\nfoo()', + output: 'var a = 0;export {a}\nfoo()', + options: [{ blankLine: 'never', prev: 'export', next: '*' }], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'export default 1\nfoo()', + output: 'export default 1\n\nfoo()', + options: [{ blankLine: 'always', prev: 'export', next: '*' }], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'export let a=1\nfoo()', + output: 'export let a=1\n\nfoo()', + options: [{ blankLine: 'always', prev: 'export', next: '*' }], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'var a = 0;export {a}\nfoo()', + output: 'var a = 0;export {a}\n\nfoo()', + options: [{ blankLine: 'always', prev: 'export', next: '*' }], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + errors: [{ messageId: 'expectedBlankLine' }], + }, + + //---------------------------------------------------------------------- + // for + //---------------------------------------------------------------------- + + { + code: 'for(;;);\n\nfoo()', + output: 'for(;;);\nfoo()', + options: [{ blankLine: 'never', prev: 'for', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'for(a in b);\n\nfoo()', + output: 'for(a in b);\nfoo()', + options: [{ blankLine: 'never', prev: 'for', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'for(a of b);\n\nfoo()', + output: 'for(a of b);\nfoo()', + options: [{ blankLine: 'never', prev: 'for', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'for(;;);\nfoo()', + output: 'for(;;);\n\nfoo()', + options: [{ blankLine: 'always', prev: 'for', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'for(a in b);\nfoo()', + output: 'for(a in b);\n\nfoo()', + options: [{ blankLine: 'always', prev: 'for', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'for(a of b);\nfoo()', + output: 'for(a of b);\n\nfoo()', + options: [{ blankLine: 'always', prev: 'for', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + + //---------------------------------------------------------------------- + // function + //---------------------------------------------------------------------- + + { + code: 'function foo(){}\n\nfoo()', + output: 'function foo(){}\nfoo()', + options: [{ blankLine: 'never', prev: 'function', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'function foo(){}\nfoo()', + output: 'function foo(){}\n\nfoo()', + options: [{ blankLine: 'always', prev: 'function', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'async function foo(){}\nfoo()', + output: 'async function foo(){}\n\nfoo()', + options: [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'function', next: '*' }, + ], + errors: [{ messageId: 'expectedBlankLine' }], + }, + + //---------------------------------------------------------------------- + // if + //---------------------------------------------------------------------- + + { + code: 'if(a);\n\nfoo()', + output: 'if(a);\nfoo()', + options: [{ blankLine: 'never', prev: 'if', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'if(a);else;\n\nfoo()', + output: 'if(a);else;\nfoo()', + options: [{ blankLine: 'never', prev: 'if', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'if(a);\nfoo()', + output: 'if(a);\n\nfoo()', + options: [{ blankLine: 'always', prev: 'if', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'if(a);else;\nfoo()', + output: 'if(a);else;\n\nfoo()', + options: [{ blankLine: 'always', prev: 'if', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + + //---------------------------------------------------------------------- + // iife + //---------------------------------------------------------------------- + + { + code: '(function(){\n})()\n\nvar a = 2;', + output: '(function(){\n})()\nvar a = 2;', + options: [{ blankLine: 'never', prev: 'iife', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: '+(function(){\n})()\n\nvar a = 2;', + output: '+(function(){\n})()\nvar a = 2;', + options: [{ blankLine: 'never', prev: 'iife', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: '(function(){\n})()\nvar a = 2;', + output: '(function(){\n})()\n\nvar a = 2;', + options: [{ blankLine: 'always', prev: 'iife', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: '+(function(){\n})()\nvar a = 2;', + output: '+(function(){\n})()\n\nvar a = 2;', + options: [{ blankLine: 'always', prev: 'iife', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + + // Optional chaining + { + code: '(function(){\n})?.()\nvar a = 2;', + output: '(function(){\n})?.()\n\nvar a = 2;', + options: [{ blankLine: 'always', prev: 'iife', next: '*' }], + parserOptions: { ecmaVersion: 2020 }, + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'void (function(){\n})?.()\nvar a = 2;', + output: 'void (function(){\n})?.()\n\nvar a = 2;', + options: [{ blankLine: 'always', prev: 'iife', next: '*' }], + parserOptions: { ecmaVersion: 2020 }, + errors: [{ messageId: 'expectedBlankLine' }], + }, + + // Sequenced function + { + code: '(1,2,3,function(){\n})()\nvar a = 2;', + output: '(1,2,3,function(){\n})()\n\nvar a = 2;', + options: [{ blankLine: 'always', prev: 'iife', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + + //---------------------------------------------------------------------- + // import + //---------------------------------------------------------------------- + + { + code: "import a from 'a'\n\nfoo()", + output: "import a from 'a'\nfoo()", + options: [{ blankLine: 'never', prev: 'import', next: '*' }], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: "import * as a from 'a'\n\nfoo()", + output: "import * as a from 'a'\nfoo()", + options: [{ blankLine: 'never', prev: 'import', next: '*' }], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: "import {a} from 'a'\n\nfoo()", + output: "import {a} from 'a'\nfoo()", + options: [{ blankLine: 'never', prev: 'import', next: '*' }], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: "import a from 'a'\nfoo()", + output: "import a from 'a'\n\nfoo()", + options: [{ blankLine: 'always', prev: 'import', next: '*' }], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: "import * as a from 'a'\nfoo()", + output: "import * as a from 'a'\n\nfoo()", + options: [{ blankLine: 'always', prev: 'import', next: '*' }], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: "import {a} from 'a'\nfoo()", + output: "import {a} from 'a'\n\nfoo()", + options: [{ blankLine: 'always', prev: 'import', next: '*' }], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + errors: [{ messageId: 'expectedBlankLine' }], + }, + + //---------------------------------------------------------------------- + // let + //---------------------------------------------------------------------- + + { + code: 'let a\n\nfoo()', + output: 'let a\nfoo()', + options: [{ blankLine: 'never', prev: 'let', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'let a\nfoo()', + output: 'let a\n\nfoo()', + options: [{ blankLine: 'always', prev: 'let', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + + //---------------------------------------------------------------------- + // return + //---------------------------------------------------------------------- + + { + code: 'function foo(){return\n\nfoo()}', + output: 'function foo(){return\nfoo()}', + options: [{ blankLine: 'never', prev: 'return', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'function foo(){return\nfoo()}', + output: 'function foo(){return\n\nfoo()}', + options: [{ blankLine: 'always', prev: 'return', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + + //---------------------------------------------------------------------- + // switch + //---------------------------------------------------------------------- + + { + code: 'switch(a){}\n\nfoo()', + output: 'switch(a){}\nfoo()', + options: [{ blankLine: 'never', prev: 'switch', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'switch(a){}\nfoo()', + output: 'switch(a){}\n\nfoo()', + options: [{ blankLine: 'always', prev: 'switch', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + + //---------------------------------------------------------------------- + // throw + //---------------------------------------------------------------------- + + { + code: 'throw a\n\nfoo()', + output: 'throw a\nfoo()', + options: [{ blankLine: 'never', prev: 'throw', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'throw a\nfoo()', + output: 'throw a\n\nfoo()', + options: [{ blankLine: 'always', prev: 'throw', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + + //---------------------------------------------------------------------- + // try + //---------------------------------------------------------------------- + + { + code: 'try{}catch(e){}\n\nfoo()', + output: 'try{}catch(e){}\nfoo()', + options: [{ blankLine: 'never', prev: 'try', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'try{}finally{}\n\nfoo()', + output: 'try{}finally{}\nfoo()', + options: [{ blankLine: 'never', prev: 'try', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'try{}catch(e){}finally{}\n\nfoo()', + output: 'try{}catch(e){}finally{}\nfoo()', + options: [{ blankLine: 'never', prev: 'try', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'try{}catch(e){}\nfoo()', + output: 'try{}catch(e){}\n\nfoo()', + options: [{ blankLine: 'always', prev: 'try', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'try{}finally{}\nfoo()', + output: 'try{}finally{}\n\nfoo()', + options: [{ blankLine: 'always', prev: 'try', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'try{}catch(e){}finally{}\nfoo()', + output: 'try{}catch(e){}finally{}\n\nfoo()', + options: [{ blankLine: 'always', prev: 'try', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + + //---------------------------------------------------------------------- + // var + //---------------------------------------------------------------------- + + { + code: 'var a\n\nfoo()', + output: 'var a\nfoo()', + options: [{ blankLine: 'never', prev: 'var', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'var a\nfoo()', + output: 'var a\n\nfoo()', + options: [{ blankLine: 'always', prev: 'var', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + + //---------------------------------------------------------------------- + // while + //---------------------------------------------------------------------- + + { + code: 'while(a);\n\nfoo()', + output: 'while(a);\nfoo()', + options: [{ blankLine: 'never', prev: 'while', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'while(a);\nfoo()', + output: 'while(a);\n\nfoo()', + options: [{ blankLine: 'always', prev: 'while', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + + //---------------------------------------------------------------------- + // with + //---------------------------------------------------------------------- + + { + code: 'with(a);\n\nfoo()', + output: 'with(a);\nfoo()', + options: [{ blankLine: 'never', prev: 'with', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'with(a);\nfoo()', + output: 'with(a);\n\nfoo()', + options: [{ blankLine: 'always', prev: 'with', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + + //---------------------------------------------------------------------- + // multiline-const + //---------------------------------------------------------------------- + + { + code: 'const a={\nb:1,\nc:2\n}\n\nconst d=3', + output: 'const a={\nb:1,\nc:2\n}\nconst d=3', + options: [{ blankLine: 'never', prev: 'multiline-const', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'const a={\nb:1,\nc:2\n}\nconst d=3', + output: 'const a={\nb:1,\nc:2\n}\n\nconst d=3', + options: [{ blankLine: 'always', prev: 'multiline-const', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'const a=1\n\nconst b={\nc:2,\nd:3\n}', + output: 'const a=1\nconst b={\nc:2,\nd:3\n}', + options: [{ blankLine: 'never', prev: '*', next: 'multiline-const' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'const a=1\nconst b={\nc:2,\nd:3\n}', + output: 'const a=1\n\nconst b={\nc:2,\nd:3\n}', + options: [{ blankLine: 'always', prev: '*', next: 'multiline-const' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + + //---------------------------------------------------------------------- + // multiline-let + //---------------------------------------------------------------------- + + { + code: 'let a={\nb:1,\nc:2\n}\n\nlet d=3', + output: 'let a={\nb:1,\nc:2\n}\nlet d=3', + options: [{ blankLine: 'never', prev: 'multiline-let', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'let a={\nb:1,\nc:2\n}\nlet d=3', + output: 'let a={\nb:1,\nc:2\n}\n\nlet d=3', + options: [{ blankLine: 'always', prev: 'multiline-let', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'let a=1\n\nlet b={\nc:2,\nd:3\n}', + output: 'let a=1\nlet b={\nc:2,\nd:3\n}', + options: [{ blankLine: 'never', prev: '*', next: 'multiline-let' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'let a=1\nlet b={\nc:2,\nd:3\n}', + output: 'let a=1\n\nlet b={\nc:2,\nd:3\n}', + options: [{ blankLine: 'always', prev: '*', next: 'multiline-let' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + + //---------------------------------------------------------------------- + // multiline-var + //---------------------------------------------------------------------- + + { + code: 'var a={\nb:1,\nc:2\n}\n\nvar d=3', + output: 'var a={\nb:1,\nc:2\n}\nvar d=3', + options: [{ blankLine: 'never', prev: 'multiline-var', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'var a={\nb:1,\nc:2\n}\nvar d=3', + output: 'var a={\nb:1,\nc:2\n}\n\nvar d=3', + options: [{ blankLine: 'always', prev: 'multiline-var', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'var a=1\n\nvar b={\nc:2,\nd:3\n}', + output: 'var a=1\nvar b={\nc:2,\nd:3\n}', + options: [{ blankLine: 'never', prev: '*', next: 'multiline-var' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'var a=1\nvar b={\nc:2,\nd:3\n}', + output: 'var a=1\n\nvar b={\nc:2,\nd:3\n}', + options: [{ blankLine: 'always', prev: '*', next: 'multiline-var' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + + //---------------------------------------------------------------------- + // single line const + //---------------------------------------------------------------------- + + { + code: 'const a=1\n\nconst b=2', + output: 'const a=1\nconst b=2', + options: [{ blankLine: 'never', prev: 'singleline-const', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'const a=1\nconst b=2', + output: 'const a=1\n\nconst b=2', + options: [{ blankLine: 'always', prev: 'singleline-const', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'const a=1\n\nconst b=2', + output: 'const a=1\nconst b=2', + options: [{ blankLine: 'never', prev: '*', next: 'singleline-const' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'const a=1\nconst b=2', + output: 'const a=1\n\nconst b=2', + options: [{ blankLine: 'always', prev: '*', next: 'singleline-const' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + + //---------------------------------------------------------------------- + // single line let + //---------------------------------------------------------------------- + + { + code: 'let a=1\n\nlet b=2', + output: 'let a=1\nlet b=2', + options: [{ blankLine: 'never', prev: 'singleline-let', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'let a=1\nlet b=2', + output: 'let a=1\n\nlet b=2', + options: [{ blankLine: 'always', prev: 'singleline-let', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'let a=1\n\nlet b=2', + output: 'let a=1\nlet b=2', + options: [{ blankLine: 'never', prev: '*', next: 'singleline-let' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'let a=1\nlet b=2', + output: 'let a=1\n\nlet b=2', + options: [{ blankLine: 'always', prev: '*', next: 'singleline-let' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + + //---------------------------------------------------------------------- + // single line var + //---------------------------------------------------------------------- + + { + code: 'var a=1\n\nvar b=2', + output: 'var a=1\nvar b=2', + options: [{ blankLine: 'never', prev: 'singleline-var', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'var a=1\nvar b=2', + output: 'var a=1\n\nvar b=2', + options: [{ blankLine: 'always', prev: 'singleline-var', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'var a=1\n\nvar b=2', + output: 'var a=1\nvar b=2', + options: [{ blankLine: 'never', prev: '*', next: 'singleline-var' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'var a=1\nvar b=2', + output: 'var a=1\n\nvar b=2', + options: [{ blankLine: 'always', prev: '*', next: 'singleline-var' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + + //---------------------------------------------------------------------- + // Tests from newline-after-var + //---------------------------------------------------------------------- + + // should disallow no line break in "always" mode + { + code: "var greet = 'hello';console.log(greet);", + output: "var greet = 'hello';\n\nconsole.log(greet);", + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: "var greet = 'hello';var name = 'world';console.log(greet, name);", + output: + "var greet = 'hello';var name = 'world';\n\nconsole.log(greet, name);", + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: "var greet = 'hello', name = 'world';console.log(greet, name);", + output: + "var greet = 'hello', name = 'world';\n\nconsole.log(greet, name);", + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + errors: [{ messageId: 'expectedBlankLine' }], + }, + + // should disallow no blank line in "always" mode + { + code: "var greet = 'hello';\nconsole.log(greet);", + output: "var greet = 'hello';\n\nconsole.log(greet);", + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: "var greet = 'hello'; \nconsole.log(greet);", + output: "var greet = 'hello';\n \nconsole.log(greet);", + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: "var greet = 'hello'; // inline comment\nconsole.log(greet);", + output: "var greet = 'hello'; // inline comment\n\nconsole.log(greet);", + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: "var greet = 'hello';\nvar name = 'world';\nconsole.log(greet, name);", + output: + "var greet = 'hello';\nvar name = 'world';\n\nconsole.log(greet, name);", + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: "var greet = 'hello', name = 'world';\nconsole.log(greet, name);", + output: + "var greet = 'hello', name = 'world';\n\nconsole.log(greet, name);", + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: "var greet = 'hello',\nname = 'world';\nconsole.log(greet, name);", + output: + "var greet = 'hello',\nname = 'world';\n\nconsole.log(greet, name);", + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: "let greet = 'hello';\nconsole.log(greet);", + output: "let greet = 'hello';\n\nconsole.log(greet);", + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: "const greet = 'hello';\nconsole.log(greet);", + output: "const greet = 'hello';\n\nconsole.log(greet);", + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: "function example() {\nvar greet = 'hello';\nconsole.log(greet);\n}", + output: + "function example() {\nvar greet = 'hello';\n\nconsole.log(greet);\n}", + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: "var f = function() {\nvar greet = 'hello';\nconsole.log(greet);\n};", + output: + "var f = function() {\nvar greet = 'hello';\n\nconsole.log(greet);\n};", + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: "() => {\nvar greet = 'hello';\nconsole.log(greet);\n}", + output: "() => {\nvar greet = 'hello';\n\nconsole.log(greet);\n}", + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + errors: [{ messageId: 'expectedBlankLine' }], + }, + + // should disallow blank lines in "never" mode + { + code: "var greet = 'hello';\n\nconsole.log(greet);", + output: "var greet = 'hello';\nconsole.log(greet);", + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: "var greet = 'hello';\n\n\nconsole.log(greet);", + output: "var greet = 'hello';\nconsole.log(greet);", + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: "var greet = 'hello';\n\n\n\nconsole.log(greet);", + output: "var greet = 'hello';\nconsole.log(greet);", + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: "var greet = 'hello'; \n\nconsole.log(greet);", + output: "var greet = 'hello'; \nconsole.log(greet);", + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: "var greet = 'hello'; // inline comment\n\nconsole.log(greet);", + output: "var greet = 'hello'; // inline comment\nconsole.log(greet);", + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: "var greet = 'hello';\nvar name = 'world';\n\nconsole.log(greet, name);", + output: + "var greet = 'hello';\nvar name = 'world';\nconsole.log(greet, name);", + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: "var greet = 'hello', name = 'world';\n\nconsole.log(greet, name);", + output: "var greet = 'hello', name = 'world';\nconsole.log(greet, name);", + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: "var greet = 'hello',\nname = 'world';\n\nconsole.log(greet, name);", + output: + "var greet = 'hello',\nname = 'world';\nconsole.log(greet, name);", + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: "var greet = 'hello', // inline comment\nname = 'world'; // inline comment\n\nconsole.log(greet, name);", + output: + "var greet = 'hello', // inline comment\nname = 'world'; // inline comment\nconsole.log(greet, name);", + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: "let greet = 'hello';\n\nconsole.log(greet);", + output: "let greet = 'hello';\nconsole.log(greet);", + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: "const greet = 'hello';\n\nconsole.log(greet);", + output: "const greet = 'hello';\nconsole.log(greet);", + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + + // should disallow a comment on the next line that's not in turn followed by a blank in "always" mode + { + code: "var greet = 'hello';\n// next-line comment\nconsole.log(greet);", + output: + "var greet = 'hello';\n\n// next-line comment\nconsole.log(greet);", + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: "var greet = 'hello';\n/* block comment\nblock comment */\nconsole.log(greet);", + output: + "var greet = 'hello';\n\n/* block comment\nblock comment */\nconsole.log(greet);", + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: "var greet = 'hello',\nname = 'world';\n// next-line comment\nconsole.log(greet);", + output: + "var greet = 'hello',\nname = 'world';\n\n// next-line comment\nconsole.log(greet);", + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: "var greet = 'hello',\nname = 'world';\n/* block comment\nblock comment */\nconsole.log(greet);", + output: + "var greet = 'hello',\nname = 'world';\n\n/* block comment\nblock comment */\nconsole.log(greet);", + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: "var greet = 'hello';\n// next-line comment\n// second-line comment\nconsole.log(greet);", + output: + "var greet = 'hello';\n\n// next-line comment\n// second-line comment\nconsole.log(greet);", + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: "var greet = 'hello';\n// next-line comment\n/* block comment\nblock comment */\nconsole.log(greet);", + output: + "var greet = 'hello';\n\n// next-line comment\n/* block comment\nblock comment */\nconsole.log(greet);", + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + errors: [{ messageId: 'expectedBlankLine' }], + }, + + // https://github.com/eslint/eslint/issues/6834 + { + code: ` +var a = 1 +;(b || c).doSomething() + `, + output: ` +var a = 1 + +;(b || c).doSomething() + `, + options: [ + { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: ` +var a = 1 + +;(b || c).doSomething() + `, + output: ` +var a = 1 +;(b || c).doSomething() + `, + options: [ + { blankLine: 'never', prev: ['const', 'let', 'var'], next: '*' }, + { + blankLine: 'any', + prev: ['const', 'let', 'var'], + next: ['const', 'let', 'var'], + }, + ], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + + //---------------------------------------------------------------------- + // Tests from newline-before-return + //---------------------------------------------------------------------- + + { + code: 'function a() {\nvar b; return;\n}', + output: 'function a() {\nvar b;\n\n return;\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'function a() {\nvar b;\nreturn;\n}', + output: 'function a() {\nvar b;\n\nreturn;\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'function a() {\nif (b) return b;\nelse if (c) return c;\nelse {\ne();\nreturn d;\n}\n}', + output: + 'function a() {\nif (b) return b;\nelse if (c) return c;\nelse {\ne();\n\nreturn d;\n}\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'function a() {\nif (b) return b;\nelse if (c) return c;\nelse {\ne(); return d;\n}\n}', + output: + 'function a() {\nif (b) return b;\nelse if (c) return c;\nelse {\ne();\n\n return d;\n}\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'function a() {\n while (b) {\nc();\nreturn;\n}\n}', + output: 'function a() {\n while (b) {\nc();\n\nreturn;\n}\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'function a() {\ndo {\nc();\nreturn;\n} while (b);\n}', + output: 'function a() {\ndo {\nc();\n\nreturn;\n} while (b);\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'function a() {\nfor (var b; b < c; b++) {\nc();\nreturn;\n}\n}', + output: + 'function a() {\nfor (var b; b < c; b++) {\nc();\n\nreturn;\n}\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'function a() {\nfor (b in c) {\nd();\nreturn;\n}\n}', + output: 'function a() {\nfor (b in c) {\nd();\n\nreturn;\n}\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'function a() {\nfor (b of c) {\nd();\nreturn;\n}\n}', + output: 'function a() {\nfor (b of c) {\nd();\n\nreturn;\n}\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'function a() {\nif (b) {\nc();\n}\n//comment\nreturn b;\n}', + output: 'function a() {\nif (b) {\nc();\n}\n\n//comment\nreturn b;\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'function a() {\n/*comment\ncomment*/\nif (b) {\nc();\nreturn b;\n} else {\n//comment\n\nreturn d;\n}\n/*multi-line\ncomment*/\nreturn e;\n}', + output: + 'function a() {\n/*comment\ncomment*/\nif (b) {\nc();\n\nreturn b;\n} else {\n//comment\n\nreturn d;\n}\n\n/*multi-line\ncomment*/\nreturn e;\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + errors: [ + { messageId: 'expectedBlankLine' }, + { messageId: 'expectedBlankLine' }, + ], + }, + { + code: 'function a() {\nif (b) { return; } //comment\nreturn c;\n}', + output: 'function a() {\nif (b) { return; } //comment\n\nreturn c;\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'function a() {\nif (b) { return; } /*multi-line\ncomment*/\nreturn c;\n}', + output: + 'function a() {\nif (b) { return; } /*multi-line\ncomment*/\n\nreturn c;\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'function a() {\nif (b) { return; }\n/*multi-line\ncomment*/ return c;\n}', + output: + 'function a() {\nif (b) { return; }\n\n/*multi-line\ncomment*/ return c;\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'function a() {\nif (b) { return; } /*multi-line\ncomment*/ return c;\n}', + output: + 'function a() {\nif (b) { return; } /*multi-line\ncomment*/\n\n return c;\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'var a;\nreturn;', + output: 'var a;\n\nreturn;', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + parserOptions: { ecmaFeatures: { globalReturn: true } }, + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'var a; return;', + output: 'var a;\n\n return;', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + parserOptions: { ecmaFeatures: { globalReturn: true } }, + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'function a() {\n{\n//comment\n}\nreturn\n}', + output: 'function a() {\n{\n//comment\n}\n\nreturn\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'function a() {\n{\n//comment\n} return\n}', + output: 'function a() {\n{\n//comment\n}\n\n return\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'function a() {\nvar c;\nwhile (b) {\n c = d; //comment\n}\nreturn c;\n}', + output: + 'function a() {\nvar c;\nwhile (b) {\n c = d; //comment\n}\n\nreturn c;\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'function a() {\nfor (var b; b < c; b++) {\nif (d) {\nbreak; //comment\n}\nreturn;\n}\n}', + output: + 'function a() {\nfor (var b; b < c; b++) {\nif (d) {\nbreak; //comment\n}\n\nreturn;\n}\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'function a() {\nvar b; /*multi-line\ncomment*/\nreturn c;\n}', + output: 'function a() {\nvar b; /*multi-line\ncomment*/\n\nreturn c;\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'function a() {\nvar b;\n/*multi-line\ncomment*/ return c;\n}', + output: 'function a() {\nvar b;\n\n/*multi-line\ncomment*/ return c;\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'function a() {\nvar b; /*multi-line\ncomment*/ return c;\n}', + output: 'function a() {\nvar b; /*multi-line\ncomment*/\n\n return c;\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'function a() {\nvar b;\n//comment\nreturn;\n}', + output: 'function a() {\nvar b;\n\n//comment\nreturn;\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'function a() {\nvar b; //comment\nreturn;\n}', + output: 'function a() {\nvar b; //comment\n\nreturn;\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'function a() {\nvar b;\n/* comment */ return;\n}', + output: 'function a() {\nvar b;\n\n/* comment */ return;\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'function a() {\nvar b;\n//comment\n/* comment */ return;\n}', + output: 'function a() {\nvar b;\n\n//comment\n/* comment */ return;\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'function a() {\nvar b; /* comment */ return;\n}', + output: 'function a() {\nvar b; /* comment */\n\n return;\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'function a() {\nvar b; /* comment */\nreturn;\n}', + output: 'function a() {\nvar b; /* comment */\n\nreturn;\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'function a() {\nvar b;\nreturn; //comment\n}', + output: 'function a() {\nvar b;\n\nreturn; //comment\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'function a() {\nvar b; return; //comment\n}', + output: 'function a() {\nvar b;\n\n return; //comment\n}', + options: [{ blankLine: 'always', prev: '*', next: 'return' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + + //---------------------------------------------------------------------- + // From JSCS disallowPaddingNewLinesAfterBlocks + // https://github.com/jscs-dev/node-jscs/blob/44f9b86eb0757fd4ca05a81a50450c5f1b25c37b/test/specs/rules/disallow-padding-newlines-after-blocks.js + //---------------------------------------------------------------------- + + { + code: 'if(true){}\n\nvar a = 2;', + output: 'if(true){}\nvar a = 2;', + options: [{ blankLine: 'never', prev: 'block-like', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'if(true){\nif(true) {}\n\nvar a = 2;}', + output: 'if(true){\nif(true) {}\nvar a = 2;}', + options: [{ blankLine: 'never', prev: 'block-like', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: '(function(){\n})()\n\nvar a = 2;', + output: '(function(){\n})()\nvar a = 2;', + options: [{ blankLine: 'never', prev: 'block-like', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: '+(function(){\n})()\n\nvar a = 2;', + output: '+(function(){\n})()\nvar a = 2;', + options: [{ blankLine: 'never', prev: 'block-like', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'var a = function() {};\n\nvar b = 2;', + output: 'var a = function() {};\nvar b = 2;', + options: [{ blankLine: 'never', prev: 'block-like', next: '*' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + + //---------------------------------------------------------------------- + // From JSCS disallowPaddingNewLinesBeforeExport + // https://github.com/jscs-dev/node-jscs/blob/44f9b86eb0757fd4ca05a81a50450c5f1b25c37b/test/specs/rules/disallow-padding-newlines-before-export.js + //---------------------------------------------------------------------- + + { + code: 'var a = 2;\n\nmodule.exports = a;', + output: 'var a = 2;\nmodule.exports = a;', + options: [{ blankLine: 'never', prev: '*', next: 'exports' }], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + + //---------------------------------------------------------------------- + // From JSCS disallowPaddingNewLinesBeforeExport + // https://github.com/jscs-dev/node-jscs/blob/44f9b86eb0757fd4ca05a81a50450c5f1b25c37b/test/specs/rules/disallow-padding-newlines-before-keywords.js + //---------------------------------------------------------------------- + + { + code: 'function x() { var a;\n\nreturn; }', + output: 'function x() { var a;\nreturn; }', + options: [ + { + blankLine: 'never', + prev: '*', + next: ['if', 'for', 'return', 'switch', 'case', 'break', 'throw'], + }, + ], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'function x() { var a = true;\n\nif (a) { a = !a; }; }', + output: 'function x() { var a = true;\nif (a) { a = !a; }; }', + options: [ + { + blankLine: 'never', + prev: '*', + next: ['if', 'for', 'return', 'switch', 'case', 'break', 'throw'], + }, + ], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'function x() { var a = true;\n\nfor (var i = 0; i < 10; i++) { a = !a; }; }', + output: + 'function x() { var a = true;\nfor (var i = 0; i < 10; i++) { a = !a; }; }', + options: [ + { + blankLine: 'never', + prev: '*', + next: ['if', 'for', 'return', 'switch', 'case', 'break', 'throw'], + }, + ], + errors: [{ messageId: 'unexpectedBlankLine' }], + }, + { + code: 'function x() { var y = true;\n\nswitch ("Oranges") { case "Oranges": y = !y;\n\nbreak;\n\ncase "Apples": y = !y;\n\nbreak; default: y = !y; } }', + output: + 'function x() { var y = true;\nswitch ("Oranges") { case "Oranges": y = !y;\nbreak;\ncase "Apples": y = !y;\nbreak; default: y = !y; } }', + options: [ + { + blankLine: 'never', + prev: '*', + next: ['if', 'for', 'return', 'switch', 'case', 'break', 'throw'], + }, + ], + errors: [ + { messageId: 'unexpectedBlankLine' }, + { messageId: 'unexpectedBlankLine' }, + { messageId: 'unexpectedBlankLine' }, + { messageId: 'unexpectedBlankLine' }, + ], + }, + { + code: 'function x() {try { var a;\n\nthrow 0; } catch (e) { var b = 0;\n\nthrow e; } }', + output: + 'function x() {try { var a;\nthrow 0; } catch (e) { var b = 0;\nthrow e; } }', + options: [ + { + blankLine: 'never', + prev: '*', + next: ['if', 'for', 'return', 'switch', 'case', 'break', 'throw'], + }, + ], + errors: [ + { messageId: 'unexpectedBlankLine' }, + { messageId: 'unexpectedBlankLine' }, + ], + }, + { + code: 'function x(a) { var b = 0;\n\nif (!a) { return false; };\n\nfor (var i = 0; i < b; i++) { if (!a[i]) return false; }\n\nreturn true; }', + output: + 'function x(a) { var b = 0;\nif (!a) { return false; };\nfor (var i = 0; i < b; i++) { if (!a[i]) return false; }\nreturn true; }', + options: [ + { + blankLine: 'never', + prev: '*', + next: ['if', 'for', 'return', 'switch', 'case', 'break', 'throw'], + }, + ], + errors: [ + { messageId: 'unexpectedBlankLine' }, + { messageId: 'unexpectedBlankLine' }, + { messageId: 'unexpectedBlankLine' }, + ], + }, + + //---------------------------------------------------------------------- + // From JSCS requirePaddingNewLinesAfterBlocks + // https://github.com/jscs-dev/node-jscs/blob/44f9b86eb0757fd4ca05a81a50450c5f1b25c37b/test/specs/rules/require-padding-newlines-after-blocks.js + //---------------------------------------------------------------------- + + { + code: 'if(true){}\nvar a = 2;', + output: 'if(true){}\n\nvar a = 2;', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'var a = function() {\n};\nvar b = 2;', + output: 'var a = function() {\n};\n\nvar b = 2;', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'if(true){\nif(true) {}\nvar a = 2;}', + output: 'if(true){\nif(true) {}\n\nvar a = 2;}', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: '(function(){\n})()\nvar a = 2;', + output: '(function(){\n})()\n\nvar a = 2;', + options: [{ blankLine: 'always', prev: 'block-like', next: '*' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'var a = function() {\n};\nvar b = 2;', + output: 'var a = function() {\n};\n\nvar b = 2;', + options: [ + { blankLine: 'always', prev: 'multiline-block-like', next: '*' }, + ], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: '(function(){\n})()\nvar a = 2;', + output: '(function(){\n})()\n\nvar a = 2;', + options: [ + { blankLine: 'always', prev: 'multiline-block-like', next: '*' }, + ], + errors: [{ messageId: 'expectedBlankLine' }], + }, + + //---------------------------------------------------------------------- + // From JSCS requirePaddingNewLinesBeforeExport + // https://github.com/jscs-dev/node-jscs/blob/44f9b86eb0757fd4ca05a81a50450c5f1b25c37b/test/specs/rules/require-padding-newlines-before-export.js + //---------------------------------------------------------------------- + + { + code: 'var a = 2;\nmodule.exports = a;', + output: 'var a = 2;\n\nmodule.exports = a;', + options: [{ blankLine: 'always', prev: '*', next: 'exports' }], + errors: [{ messageId: 'expectedBlankLine' }], + }, + + //---------------------------------------------------------------------- + // From JSCS requirePaddingNewlinesBeforeKeywords + // https://github.com/jscs-dev/node-jscs/blob/44f9b86eb0757fd4ca05a81a50450c5f1b25c37b/test/specs/rules/require-padding-newlines-before-keywords.js + //---------------------------------------------------------------------- + + { + code: 'function x() { var a; return; }', + output: 'function x() { var a;\n\n return; }', + options: [ + { + blankLine: 'always', + prev: '*', + next: [ + 'if', + 'for', + 'return', + 'switch', + 'case', + 'break', + 'throw', + 'while', + 'default', + ], + }, + ], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'function x() { var a = true; for (var i = 0; i < 10; i++) { a = !a; }; }', + output: + 'function x() { var a = true;\n\n for (var i = 0; i < 10; i++) { a = !a; }; }', + options: [ + { + blankLine: 'always', + prev: '*', + next: [ + 'if', + 'for', + 'return', + 'switch', + 'case', + 'break', + 'throw', + 'while', + 'default', + ], + }, + ], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'function x() { var y = true; switch ("Oranges") { case "Oranges": y = !y; break; case "Apples": y = !y; break; default: y = !y; } }', + output: + 'function x() { var y = true;\n\n switch ("Oranges") { case "Oranges": y = !y;\n\n break;\n\n case "Apples": y = !y;\n\n break;\n\n default: y = !y; } }', + options: [ + { + blankLine: 'always', + prev: '*', + next: [ + 'if', + 'for', + 'return', + 'switch', + 'case', + 'break', + 'throw', + 'while', + 'default', + ], + }, + ], + errors: [ + { messageId: 'expectedBlankLine' }, + { messageId: 'expectedBlankLine' }, + { messageId: 'expectedBlankLine' }, + { messageId: 'expectedBlankLine' }, + { messageId: 'expectedBlankLine' }, + ], + }, + { + code: 'function x() { var a = true; while (!a) { a = !a; }; }', + output: 'function x() { var a = true;\n\n while (!a) { a = !a; }; }', + options: [ + { + blankLine: 'always', + prev: '*', + next: [ + 'if', + 'for', + 'return', + 'switch', + 'case', + 'break', + 'throw', + 'while', + 'default', + ], + }, + ], + errors: [{ messageId: 'expectedBlankLine' }], + }, + { + code: 'function x() {try { var a; throw 0; } catch (e) { var b = 0; throw e; } }', + output: + 'function x() {try { var a;\n\n throw 0; } catch (e) { var b = 0;\n\n throw e; } }', + options: [ + { + blankLine: 'always', + prev: '*', + next: [ + 'if', + 'for', + 'return', + 'switch', + 'case', + 'break', + 'throw', + 'while', + 'default', + ], + }, + ], + errors: [ + { messageId: 'expectedBlankLine' }, + { messageId: 'expectedBlankLine' }, + ], + }, + { + code: 'function x(a) { var b = 0; if (!a) { return false; }; for (var i = 0; i < b; i++) { if (!a[i]) return false; } return true; }', + output: + 'function x(a) { var b = 0;\n\n if (!a) { return false; };\n\n for (var i = 0; i < b; i++) { if (!a[i]) return false; }\n\n return true; }', + options: [ + { + blankLine: 'always', + prev: '*', + next: [ + 'if', + 'for', + 'return', + 'switch', + 'case', + 'break', + 'throw', + 'while', + 'default', + ], + }, + ], + errors: [ + { messageId: 'expectedBlankLine' }, + { messageId: 'expectedBlankLine' }, + { messageId: 'expectedBlankLine' }, + ], + }, + { + // https://github.com/typescript-eslint/typescript-eslint/issues/3863 + code: ` +declare namespace Types { + type Foo = string; + type Bar = string; + interface FooBar { + [key: string]: string; + } + interface BarBaz { + [key: string]: string; + } +} + `, + output: ` +declare namespace Types { + type Foo = string; + + type Bar = string; + + interface FooBar { + [key: string]: string; + } + + interface BarBaz { + [key: string]: string; + } +} + `, + options: [ + { blankLine: 'always', prev: '*', next: ['interface', 'type'] }, + ], + errors: [ + { messageId: 'expectedBlankLine' }, + { messageId: 'expectedBlankLine' }, + { messageId: 'expectedBlankLine' }, + ], + }, + ], +}); diff --git a/packages/eslint-plugin/tests/rules/prefer-includes.test.ts b/packages/eslint-plugin/tests/rules/prefer-includes.test.ts index c72488a49372..ceda607df494 100644 --- a/packages/eslint-plugin/tests/rules/prefer-includes.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-includes.test.ts @@ -1,6 +1,4 @@ -import { TSESLint } from '@typescript-eslint/experimental-utils'; import rule from '../../src/rules/prefer-includes'; -import * as util from '../../src/util'; import { RuleTester, getFixturesRootDir } from '../RuleTester'; const rootPath = getFixturesRootDir(); @@ -13,126 +11,101 @@ const ruleTester = new RuleTester({ }, }); -type MessageIds = util.InferMessageIdsTypeFromRule; - -type InvalidTestCase = TSESLint.InvalidTestCase; -type ValidTestCase = TSESLint.ValidTestCase | string; -function addOptional(cases: ValidTestCase[]): ValidTestCase[]; -function addOptional(cases: InvalidTestCase[]): InvalidTestCase[]; -function addOptional( - cases: (ValidTestCase | InvalidTestCase)[], -): (ValidTestCase | InvalidTestCase)[] { - return cases.reduce<(ValidTestCase | InvalidTestCase)[]>((acc, c) => { - acc.push(c); - if (typeof c === 'string') { - acc.push(c.replace('.', '?.')); - } else { - acc.push({ - ...c, - code: c.code.replace('.', '?.'), - output: 'output' in c ? c.output?.replace('.', '?.') : null, - }); - } - - return acc; - }, []); -} - ruleTester.run('prefer-includes', rule, { - valid: addOptional([ + valid: [ ` function f(a: string): void { - a.indexOf(b) + a.indexOf(b); } `, ` function f(a: string): void { - a.indexOf(b) + 0 + a.indexOf(b) + 0; } `, ` - function f(a: string | {value: string}): void { - a.indexOf(b) !== -1 + function f(a: string | { value: string }): void { + a.indexOf(b) !== -1; } `, ` type UserDefined = { - indexOf(x: any): number // don't have 'includes' - } + indexOf(x: any): number; // don't have 'includes' + }; function f(a: UserDefined): void { - a.indexOf(b) !== -1 + a.indexOf(b) !== -1; } `, ` type UserDefined = { - indexOf(x: any, fromIndex?: number): number - includes(x: any): boolean // different parameters - } + indexOf(x: any, fromIndex?: number): number; + includes(x: any): boolean; // different parameters + }; function f(a: UserDefined): void { - a.indexOf(b) !== -1 + a.indexOf(b) !== -1; } `, ` type UserDefined = { - indexOf(x: any, fromIndex?: number): number - includes(x: any, fromIndex: number): boolean // different parameters - } + indexOf(x: any, fromIndex?: number): number; + includes(x: any, fromIndex: number): boolean; // different parameters + }; function f(a: UserDefined): void { - a.indexOf(b) !== -1 + a.indexOf(b) !== -1; } `, ` type UserDefined = { - indexOf(x: any, fromIndex?: number): number - includes: boolean // different type - } + indexOf(x: any, fromIndex?: number): number; + includes: boolean; // different type + }; function f(a: UserDefined): void { - a.indexOf(b) !== -1 + a.indexOf(b) !== -1; } `, ` function f(a: string): void { - /bar/i.test(a) + /bar/i.test(a); } `, ` function f(a: string): void { - /ba[rz]/.test(a) + /ba[rz]/.test(a); } `, ` function f(a: string): void { - /foo|bar/.test(a) + /foo|bar/.test(a); } `, ` function f(a: string): void { - /bar/.test() + /bar/.test(); } `, ` function f(a: string): void { - something.test(a) + something.test(a); } `, ` - const pattern = new RegExp("bar") + const pattern = new RegExp('bar'); function f(a) { - return pattern.test(a) + return pattern.test(a); } `, - ]), - invalid: addOptional([ + ], + invalid: [ // positive { code: ` function f(a: string): void { - a.indexOf(b) !== -1 + a.indexOf(b) !== -1; } `, output: ` function f(a: string): void { - a.includes(b) + a.includes(b); } `, errors: [{ messageId: 'preferIncludes' }], @@ -140,12 +113,12 @@ ruleTester.run('prefer-includes', rule, { { code: ` function f(a: string): void { - a.indexOf(b) != -1 + a.indexOf(b) != -1; } `, output: ` function f(a: string): void { - a.includes(b) + a.includes(b); } `, errors: [{ messageId: 'preferIncludes' }], @@ -153,12 +126,12 @@ ruleTester.run('prefer-includes', rule, { { code: ` function f(a: string): void { - a.indexOf(b) > -1 + a.indexOf(b) > -1; } `, output: ` function f(a: string): void { - a.includes(b) + a.includes(b); } `, errors: [{ messageId: 'preferIncludes' }], @@ -166,12 +139,12 @@ ruleTester.run('prefer-includes', rule, { { code: ` function f(a: string): void { - a.indexOf(b) >= 0 + a.indexOf(b) >= 0; } `, output: ` function f(a: string): void { - a.includes(b) + a.includes(b); } `, errors: [{ messageId: 'preferIncludes' }], @@ -181,12 +154,12 @@ ruleTester.run('prefer-includes', rule, { { code: ` function f(a: string): void { - a.indexOf(b) === -1 + a.indexOf(b) === -1; } `, output: ` function f(a: string): void { - !a.includes(b) + !a.includes(b); } `, errors: [{ messageId: 'preferIncludes' }], @@ -194,12 +167,12 @@ ruleTester.run('prefer-includes', rule, { { code: ` function f(a: string): void { - a.indexOf(b) == -1 + a.indexOf(b) == -1; } `, output: ` function f(a: string): void { - !a.includes(b) + !a.includes(b); } `, errors: [{ messageId: 'preferIncludes' }], @@ -207,12 +180,12 @@ ruleTester.run('prefer-includes', rule, { { code: ` function f(a: string): void { - a.indexOf(b) <= -1 + a.indexOf(b) <= -1; } `, output: ` function f(a: string): void { - !a.includes(b) + !a.includes(b); } `, errors: [{ messageId: 'preferIncludes' }], @@ -220,12 +193,28 @@ ruleTester.run('prefer-includes', rule, { { code: ` function f(a: string): void { - a.indexOf(b) < 0 + a.indexOf(b) < 0; } `, output: ` function f(a: string): void { - !a.includes(b) + !a.includes(b); + } + `, + errors: [{ messageId: 'preferIncludes' }], + }, + { + code: ` + function f(a?: string): void { + a?.indexOf(b) === -1; + } + `, + errors: [{ messageId: 'preferIncludes' }], + }, + { + code: ` + function f(a?: string): void { + a?.indexOf(b) !== -1; } `, errors: [{ messageId: 'preferIncludes' }], @@ -235,42 +224,42 @@ ruleTester.run('prefer-includes', rule, { { code: ` function f(a: string): void { - /bar/.test(a) + /bar/.test(a); } `, output: ` function f(a: string): void { - a.includes("bar") + a.includes('bar'); } `, errors: [{ messageId: 'preferStringIncludes' }], }, { code: ` - const pattern = new RegExp("bar") + const pattern = new RegExp('bar'); function f(a: string): void { - pattern.test(a) + pattern.test(a); } `, output: ` - const pattern = new RegExp("bar") + const pattern = new RegExp('bar'); function f(a: string): void { - a.includes("bar") + a.includes('bar'); } `, errors: [{ messageId: 'preferStringIncludes' }], }, { code: ` - const pattern = /bar/ + const pattern = /bar/; function f(a: string, b: string): void { - pattern.test(a + b) + pattern.test(a + b); } `, output: ` - const pattern = /bar/ + const pattern = /bar/; function f(a: string, b: string): void { - (a + b).includes("bar") + (a + b).includes('bar'); } `, errors: [{ messageId: 'preferStringIncludes' }], @@ -280,12 +269,12 @@ ruleTester.run('prefer-includes', rule, { { code: ` function f(a: any[]): void { - a.indexOf(b) !== -1 + a.indexOf(b) !== -1; } `, output: ` function f(a: any[]): void { - a.includes(b) + a.includes(b); } `, errors: [{ messageId: 'preferIncludes' }], @@ -293,12 +282,12 @@ ruleTester.run('prefer-includes', rule, { { code: ` function f(a: ReadonlyArray): void { - a.indexOf(b) !== -1 + a.indexOf(b) !== -1; } `, output: ` function f(a: ReadonlyArray): void { - a.includes(b) + a.includes(b); } `, errors: [{ messageId: 'preferIncludes' }], @@ -306,12 +295,12 @@ ruleTester.run('prefer-includes', rule, { { code: ` function f(a: Int8Array): void { - a.indexOf(b) !== -1 + a.indexOf(b) !== -1; } `, output: ` function f(a: Int8Array): void { - a.includes(b) + a.includes(b); } `, errors: [{ messageId: 'preferIncludes' }], @@ -319,12 +308,12 @@ ruleTester.run('prefer-includes', rule, { { code: ` function f(a: Int16Array): void { - a.indexOf(b) !== -1 + a.indexOf(b) !== -1; } `, output: ` function f(a: Int16Array): void { - a.includes(b) + a.includes(b); } `, errors: [{ messageId: 'preferIncludes' }], @@ -332,12 +321,12 @@ ruleTester.run('prefer-includes', rule, { { code: ` function f(a: Int32Array): void { - a.indexOf(b) !== -1 + a.indexOf(b) !== -1; } `, output: ` function f(a: Int32Array): void { - a.includes(b) + a.includes(b); } `, errors: [{ messageId: 'preferIncludes' }], @@ -345,12 +334,12 @@ ruleTester.run('prefer-includes', rule, { { code: ` function f(a: Uint8Array): void { - a.indexOf(b) !== -1 + a.indexOf(b) !== -1; } `, output: ` function f(a: Uint8Array): void { - a.includes(b) + a.includes(b); } `, errors: [{ messageId: 'preferIncludes' }], @@ -358,12 +347,12 @@ ruleTester.run('prefer-includes', rule, { { code: ` function f(a: Uint16Array): void { - a.indexOf(b) !== -1 + a.indexOf(b) !== -1; } `, output: ` function f(a: Uint16Array): void { - a.includes(b) + a.includes(b); } `, errors: [{ messageId: 'preferIncludes' }], @@ -371,12 +360,12 @@ ruleTester.run('prefer-includes', rule, { { code: ` function f(a: Uint32Array): void { - a.indexOf(b) !== -1 + a.indexOf(b) !== -1; } `, output: ` function f(a: Uint32Array): void { - a.includes(b) + a.includes(b); } `, errors: [{ messageId: 'preferIncludes' }], @@ -384,12 +373,12 @@ ruleTester.run('prefer-includes', rule, { { code: ` function f(a: Float32Array): void { - a.indexOf(b) !== -1 + a.indexOf(b) !== -1; } `, output: ` function f(a: Float32Array): void { - a.includes(b) + a.includes(b); } `, errors: [{ messageId: 'preferIncludes' }], @@ -397,12 +386,12 @@ ruleTester.run('prefer-includes', rule, { { code: ` function f(a: Float64Array): void { - a.indexOf(b) !== -1 + a.indexOf(b) !== -1; } `, output: ` function f(a: Float64Array): void { - a.includes(b) + a.includes(b); } `, errors: [{ messageId: 'preferIncludes' }], @@ -410,25 +399,51 @@ ruleTester.run('prefer-includes', rule, { { code: ` function f(a: T[] | ReadonlyArray): void { - a.indexOf(b) !== -1 + a.indexOf(b) !== -1; } `, output: ` function f(a: T[] | ReadonlyArray): void { - a.includes(b) + a.includes(b); } `, errors: [{ messageId: 'preferIncludes' }], }, { code: ` - function f | Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array>(a: U): void { - a.indexOf(b) !== -1 + function f< + T, + U extends + | T[] + | ReadonlyArray + | Int8Array + | Uint8Array + | Int16Array + | Uint16Array + | Int32Array + | Uint32Array + | Float32Array + | Float64Array, + >(a: U): void { + a.indexOf(b) !== -1; } `, output: ` - function f | Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array>(a: U): void { - a.includes(b) + function f< + T, + U extends + | T[] + | ReadonlyArray + | Int8Array + | Uint8Array + | Int16Array + | Uint16Array + | Int32Array + | Uint32Array + | Float32Array + | Float64Array, + >(a: U): void { + a.includes(b); } `, errors: [{ messageId: 'preferIncludes' }], @@ -436,20 +451,20 @@ ruleTester.run('prefer-includes', rule, { { code: ` type UserDefined = { - indexOf(x: any): number - includes(x: any): boolean - } + indexOf(x: any): number; + includes(x: any): boolean; + }; function f(a: UserDefined): void { - a.indexOf(b) !== -1 + a.indexOf(b) !== -1; } `, output: ` type UserDefined = { - indexOf(x: any): number - includes(x: any): boolean - } + indexOf(x: any): number; + includes(x: any): boolean; + }; function f(a: UserDefined): void { - a.includes(b) + a.includes(b); } `, errors: [{ messageId: 'preferIncludes' }], @@ -457,15 +472,15 @@ ruleTester.run('prefer-includes', rule, { { code: ` function f(a: Readonly): void { - a.indexOf(b) !== -1 + a.indexOf(b) !== -1; } `, output: ` function f(a: Readonly): void { - a.includes(b) + a.includes(b); } `, errors: [{ messageId: 'preferIncludes' }], }, - ]), + ], }); 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 5459c42d51e1..5ec7af3c9db8 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 @@ -62,6 +62,20 @@ enum ValidKeyWithComputedSyntaxButNoComputedKey { ['a'], } `, + { + code: ` +enum Foo { + A = 1 << 0, + B = 1 >> 0, + C = 1 >>> 0, + D = 1 | 0, + E = 1 & 0, + F = 1 ^ 0, + G = ~1, +} + `, + options: [{ allowBitwiseExpressions: true }], + }, ], invalid: [ { @@ -255,5 +269,108 @@ enum InvalidSpread { }, ], }, + { + code: ` +enum Foo { + A = 1 << 0, + B = 1 >> 0, + C = 1 >>> 0, + D = 1 | 0, + E = 1 & 0, + F = 1 ^ 0, + G = ~1, +} + `, + options: [{ allowBitwiseExpressions: false }], + errors: [ + { + messageId: 'notLiteral', + line: 3, + column: 3, + }, + { + messageId: 'notLiteral', + line: 4, + column: 3, + }, + { + messageId: 'notLiteral', + line: 5, + column: 3, + }, + { + messageId: 'notLiteral', + line: 6, + column: 3, + }, + { + messageId: 'notLiteral', + line: 7, + column: 3, + }, + { + messageId: 'notLiteral', + line: 8, + column: 3, + }, + { + messageId: 'notLiteral', + line: 9, + column: 3, + }, + ], + }, + { + code: ` +const x = 1; +enum Foo { + A = x << 0, + B = x >> 0, + C = x >>> 0, + D = x | 0, + E = x & 0, + F = x ^ 0, + G = ~x, +} + `, + options: [{ allowBitwiseExpressions: true }], + errors: [ + { + messageId: 'notLiteral', + line: 4, + column: 3, + }, + { + messageId: 'notLiteral', + line: 5, + column: 3, + }, + { + messageId: 'notLiteral', + line: 6, + column: 3, + }, + { + messageId: 'notLiteral', + line: 7, + column: 3, + }, + { + messageId: 'notLiteral', + line: 8, + column: 3, + }, + { + messageId: 'notLiteral', + line: 9, + column: 3, + }, + { + messageId: 'notLiteral', + line: 10, + column: 3, + }, + ], + }, ], }); diff --git a/packages/eslint-plugin/tests/rules/prefer-optional-chain.test.ts b/packages/eslint-plugin/tests/rules/prefer-optional-chain.test.ts index 80340828a748..feb7f9bd524d 100644 --- a/packages/eslint-plugin/tests/rules/prefer-optional-chain.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-optional-chain.test.ts @@ -70,8 +70,7 @@ const baseCases = [ output: 'foo?.bar?.baz?.buzz()', }, { - code: - 'foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz && foo.bar.baz.buzz()', + code: 'foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz && foo.bar.baz.buzz()', output: 'foo?.bar?.baz?.buzz?.()', }, { @@ -94,8 +93,7 @@ const baseCases = [ }, { // 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()', + code: 'foo && foo.bar() && foo.bar().baz && foo.bar().baz.buzz && foo.bar().baz.buzz()', output: 'foo?.bar()?.baz?.buzz?.()', }, // chained calls with element access @@ -104,14 +102,12 @@ const baseCases = [ output: 'foo?.bar?.baz?.[buzz]()', }, { - code: - 'foo && foo.bar && foo.bar.baz && foo.bar.baz[buzz] && foo.bar.baz[buzz]()', + code: 'foo && foo.bar && foo.bar.baz && foo.bar.baz[buzz] && foo.bar.baz[buzz]()', output: 'foo?.bar?.baz?.[buzz]?.()', }, // (partially) pre-optional chained { - code: - 'foo && foo?.bar && foo?.bar.baz && foo?.bar.baz[buzz] && foo?.bar.baz[buzz]()', + code: 'foo && foo?.bar && foo?.bar.baz && foo?.bar.baz[buzz] && foo?.bar.baz[buzz]()', output: 'foo?.bar?.baz?.[buzz]?.()', }, { @@ -254,8 +250,7 @@ ruleTester.run('prefer-optional-chain', rule, { }, // case with inconsistent checks { - code: - 'foo && foo.bar != null && foo.bar.baz !== undefined && foo.bar.baz.buzz;', + code: 'foo && foo.bar != null && foo.bar.baz !== undefined && foo.bar.baz.buzz;', output: null, errors: [ { @@ -468,8 +463,7 @@ foo?.bar(/* comment */a, }, // using suggestion instead of autofix { - code: - 'foo && foo.bar != null && foo.bar.baz !== undefined && foo.bar.baz.buzz;', + code: 'foo && foo.bar != null && foo.bar.baz !== undefined && foo.bar.baz.buzz;', output: null, errors: [ { 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 9278420a7647..be50f096963a 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 @@ -154,6 +154,74 @@ ruleTester.run('prefer-readonly-parameter-types', rule, { } function foo(arg: Readonly) {} `, + // immutable methods + ` + type MyType = Readonly<{ + prop: string; + method(): string; + }>; + function foo(arg: MyType) {} + `, + ` + type MyType = { + readonly prop: string; + readonly method: () => string; + }; + function bar(arg: MyType) {} + `, + // methods treated as readonly + { + code: ` + type MyType = { + readonly prop: string; + method(): string; + }; + function foo(arg: MyType) {} + `, + options: [ + { + treatMethodsAsReadonly: true, + }, + ], + }, + { + code: ` + class Foo { + method() {} + } + function foo(arg: Foo) {} + `, + options: [ + { + treatMethodsAsReadonly: true, + }, + ], + }, + { + code: ` + interface Foo { + method(): void; + } + function foo(arg: Foo) {} + `, + options: [ + { + treatMethodsAsReadonly: true, + }, + ], + }, + // ReadonlySet and ReadonlyMap are seen as readonly when methods are treated as readonly + { + code: ` + function foo(arg: ReadonlySet) {} + function bar(arg: ReadonlyMap) {} + `, + options: [ + { + treatMethodsAsReadonly: true, + }, + ], + }, // parameter properties should work fine { @@ -212,13 +280,23 @@ ruleTester.run('prefer-readonly-parameter-types', rule, { `, // TSMethodSignature // https://github.com/typescript-eslint/typescript-eslint/issues/1665 - // directly recursive + // directly recursive interface ` interface Foo { readonly prop: Foo; } function foo(arg: Foo) {} `, + + // https://github.com/typescript-eslint/typescript-eslint/issues/3396 + // directly recursive union type + ` + type MyType = string | readonly MyType[]; + + function foo
(a: A): MyType[] { + return []; + } + `, // indirectly recursive ` interface Foo { @@ -715,5 +793,23 @@ ruleTester.run('prefer-readonly-parameter-types', rule, { }, ], }, + // Mutable methods. + { + code: ` + type MyType = { + readonly prop: string; + method(): string; + }; + function foo(arg: MyType) {} + `, + errors: [ + { + messageId: 'shouldBeReadonly', + line: 6, + column: 22, + endColumn: 33, + }, + ], + }, ], }); 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 a683a4ab0dc4..06613b260f74 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 @@ -39,6 +39,23 @@ ruleTester.run('prefer-reduce-type-parameter', rule, { '[1, 2, 3]?.reduce((a, s) => a.concat(s * 2), []);', ], invalid: [ + { + code: ` +declare const arr: string[]; +arr.reduce(acc => acc, arr.shift() as string); + `, + output: ` +declare const arr: string[]; +arr.reduce(acc => acc, arr.shift()); + `, + errors: [ + { + messageId: 'preferTypeParameter', + column: 32, + line: 3, + }, + ], + }, { code: '[1, 2, 3].reduce((a, s) => a.concat(s * 2), [] as number[]);', output: '[1, 2, 3].reduce((a, s) => a.concat(s * 2), []);', 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 fc97766f9f7f..2ac3c7a07ba7 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,5 @@ import rule from '../../src/rules/prefer-regexp-exec'; -import { RuleTester, getFixturesRootDir } from '../RuleTester'; +import { getFixturesRootDir, RuleTester } from '../RuleTester'; const rootPath = getFixturesRootDir(); @@ -33,6 +33,47 @@ function f(s: string | string[]) { s.match(/e/); } `, + "(Math.random() > 0.5 ? 'abc' : 123).match(2);", + "'212'.match(2);", + "'212'.match(+2);", + "'oNaNo'.match(NaN);", + "'Infinity contains -Infinity and +Infinity in JavaScript.'.match(Infinity);", + "'Infinity contains -Infinity and +Infinity in JavaScript.'.match(+Infinity);", + "'Infinity contains -Infinity and +Infinity in JavaScript.'.match(-Infinity);", + "'void and null'.match(null);", + ` +const matchers = ['package-lock.json', /regexp/]; +const file = ''; +matchers.some(matcher => !!file.match(matcher)); + `, + ` +const matchers = [/regexp/, 'package-lock.json']; +const file = ''; +matchers.some(matcher => !!file.match(matcher)); + `, + ` +const matchers = [{ match: (s: RegExp) => false }]; +const file = ''; +matchers.some(matcher => !!file.match(matcher)); + `, + // https://github.com/typescript-eslint/typescript-eslint/issues/3477 + ` +function test(pattern: string) { + 'hello hello'.match(RegExp(pattern, 'g'))?.reduce(() => []); +} + `, + // https://github.com/typescript-eslint/typescript-eslint/issues/3477 + ` +function test(pattern: string) { + 'hello hello'.match(new RegExp(pattern, 'gi'))?.reduce(() => []); +} + `, + // https://github.com/typescript-eslint/typescript-eslint/issues/3477 + ` +const matchCount = (str: string, re: RegExp) => { + return (str.match(re) || []).length; +}; + `, ], invalid: [ { @@ -41,139 +82,183 @@ function f(s: string | string[]) { { messageId: 'regExpExecOverStringMatch', line: 1, - column: 1, - }, - ], - }, - { - code: ` -const text = 'something'; -const search = /thing/; -text.match(search); - `, - errors: [ - { - messageId: 'regExpExecOverStringMatch', - line: 4, - column: 1, + column: 13, }, ], + output: "/thing/.exec('something');", }, { - code: "'212'.match(2);", + code: "'something'.match('^[a-z]+thing/?$');", errors: [ { messageId: 'regExpExecOverStringMatch', line: 1, - column: 1, + column: 13, }, ], + output: "/^[a-z]+thing\\/?$/.exec('something');", }, { - code: "'212'.match(+2);", + code: ` +const text = 'something'; +const search = /thing/; +text.match(search); + `, errors: [ { messageId: 'regExpExecOverStringMatch', - line: 1, - column: 1, + line: 4, + column: 6, }, ], + output: ` +const text = 'something'; +const search = /thing/; +search.exec(text); + `, }, { - code: "'oNaNo'.match(NaN);", + code: ` +const text = 'something'; +const search = 'thing'; +text.match(search); + `, errors: [ { messageId: 'regExpExecOverStringMatch', - line: 1, - column: 1, + line: 4, + column: 6, }, ], + output: ` +const text = 'something'; +const search = 'thing'; +RegExp(search).exec(text); + `, }, { - code: - "'Infinity contains -Infinity and +Infinity in JavaScript.'.match(Infinity);", + code: ` +function f(s: 'a' | 'b') { + s.match('a'); +} + `, errors: [ { messageId: 'regExpExecOverStringMatch', - line: 1, - column: 1, + line: 3, + column: 5, }, ], + output: ` +function f(s: 'a' | 'b') { + /a/.exec(s); +} + `, }, { - code: - "'Infinity contains -Infinity and +Infinity in JavaScript.'.match(+Infinity);", + code: ` +type SafeString = string & { __HTML_ESCAPED__: void }; +function f(s: SafeString) { + s.match(/thing/); +} + `, errors: [ { messageId: 'regExpExecOverStringMatch', - line: 1, - column: 1, + line: 4, + column: 5, }, ], + output: ` +type SafeString = string & { __HTML_ESCAPED__: void }; +function f(s: SafeString) { + /thing/.exec(s); +} + `, }, { - code: - "'Infinity contains -Infinity and +Infinity in JavaScript.'.match(-Infinity);", + code: ` +function f(s: T) { + s.match(/thing/); +} + `, errors: [ { messageId: 'regExpExecOverStringMatch', - line: 1, - column: 1, + line: 3, + column: 5, }, ], + output: ` +function f(s: T) { + /thing/.exec(s); +} + `, }, { - code: "'void and null'.match(null);", + code: ` +const text = 'something'; +const search = new RegExp('test', ''); +text.match(search); + `, errors: [ { messageId: 'regExpExecOverStringMatch', - line: 1, - column: 1, + line: 4, + column: 6, }, ], + output: ` +const text = 'something'; +const search = new RegExp('test', ''); +search.exec(text); + `, }, { code: ` -function f(s: 'a' | 'b') { - s.match('a'); +function test(pattern: string) { + 'check'.match(new RegExp(pattern, undefined)); } `, errors: [ { messageId: 'regExpExecOverStringMatch', line: 3, - column: 3, + column: 11, }, ], - }, - { - code: ` -type SafeString = string & { __HTML_ESCAPED__: void }; -function f(s: SafeString) { - s.match(/thing/); + output: ` +function test(pattern: string) { + new RegExp(pattern, undefined).exec('check'); } `, - errors: [ - { - messageId: 'regExpExecOverStringMatch', - line: 4, - column: 3, - }, - ], }, { + // https://github.com/typescript-eslint/typescript-eslint/issues/3941 code: ` -function f(s: T) { - s.match(/thing/); +function temp(text: string): void { + text.match(new RegExp(\`\${'hello'}\`)); + text.match(new RegExp(\`\${'hello'.toString()}\`)); } `, errors: [ { messageId: 'regExpExecOverStringMatch', line: 3, - column: 3, + column: 8, + }, + { + messageId: 'regExpExecOverStringMatch', + line: 4, + column: 8, }, ], + output: ` +function temp(text: string): void { + new RegExp(\`\${'hello'}\`).exec(text); + new RegExp(\`\${'hello'.toString()}\`).exec(text); +} + `, }, ], }); 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 new file mode 100644 index 000000000000..a93590dfec04 --- /dev/null +++ b/packages/eslint-plugin/tests/rules/prefer-return-this-type.test.ts @@ -0,0 +1,315 @@ +import rule from '../../src/rules/prefer-return-this-type'; +import { getFixturesRootDir, RuleTester } from '../RuleTester'; + +const rootPath = getFixturesRootDir(); + +const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', + parserOptions: { + tsconfigRootDir: rootPath, + project: './tsconfig.json', + }, +}); + +ruleTester.run('prefer-return-this-type', rule, { + valid: [ + ` +class Foo { + f1() {} + f2(): Foo { + return new Foo(); + } + f3() { + return this; + } + f4(): this { + return this; + } + f5(): any { + return this; + } + f6(): unknown { + return this; + } + f7(foo: Foo): Foo { + return Math.random() > 0.5 ? foo : this; + } + f10(this: Foo, that: Foo): Foo; + f11(): Foo { + return; + } + f13(this: Foo): Foo { + return this; + } + f14(): { f14: Function } { + return this; + } + f15(): Foo | this { + return Math.random() > 0.5 ? new Foo() : this; + } +} + `, + ` +class Foo { + f1 = () => {}; + f2 = (): Foo => { + return new Foo(); + }; + f3 = () => this; + f4 = (): this => { + return this; + }; + f5 = (): Foo => new Foo(); + f6 = ''; +} + `, + ` +const Foo = class { + bar() { + return this; + } +}; + `, + ` +class Base {} +class Derived extends Base { + f(): Base { + return this; + } +} + `, + ], + invalid: [ + { + code: ` +class Foo { + f(): Foo { + return this; + } +} + `, + errors: [ + { + messageId: 'useThisType', + line: 3, + column: 8, + }, + ], + output: ` +class Foo { + f(): this { + return this; + } +} + `, + }, + { + code: ` +class Foo { + f(): Foo { + const self = this; + return self; + } +} + `, + errors: [ + { + messageId: 'useThisType', + line: 3, + column: 8, + }, + ], + output: ` +class Foo { + f(): this { + const self = this; + return self; + } +} + `, + }, + { + code: ` +class Foo { + f = (): Foo => { + return this; + }; +} + `, + errors: [ + { + messageId: 'useThisType', + line: 3, + column: 11, + }, + ], + output: ` +class Foo { + f = (): this => { + return this; + }; +} + `, + }, + { + code: ` +class Foo { + f = (): Foo => { + const self = this; + return self; + }; +} + `, + errors: [ + { + messageId: 'useThisType', + line: 3, + column: 11, + }, + ], + output: ` +class Foo { + f = (): this => { + const self = this; + return self; + }; +} + `, + }, + { + code: ` +class Foo { + f = (): Foo => this; +} + `, + errors: [ + { + messageId: 'useThisType', + line: 3, + column: 11, + }, + ], + output: ` +class Foo { + f = (): this => this; +} + `, + }, + { + code: ` +class Foo { + f1(): Foo | undefined { + return this; + } + f2(): this | undefined { + return this; + } +} + `, + errors: [ + { + messageId: 'useThisType', + line: 3, + column: 9, + }, + ], + output: ` +class Foo { + f1(): this | undefined { + return this; + } + f2(): this | undefined { + return this; + } +} + `, + }, + { + code: ` +class Foo { + bar(): Foo | undefined { + if (Math.random() > 0.5) { + return this; + } + } +} + `, + errors: [ + { + messageId: 'useThisType', + line: 3, + column: 10, + }, + ], + output: ` +class Foo { + bar(): this | undefined { + if (Math.random() > 0.5) { + return this; + } + } +} + `, + }, + { + code: ` +class Foo { + bar(num: 1 | 2): Foo { + switch (num) { + case 1: + return this; + case 2: + return this; + } + } +} + `, + errors: [ + { + messageId: 'useThisType', + line: 3, + column: 20, + }, + ], + output: ` +class Foo { + bar(num: 1 | 2): this { + switch (num) { + case 1: + return this; + case 2: + return this; + } + } +} + `, + }, + { + // https://github.com/typescript-eslint/typescript-eslint/issues/3842 + code: ` +class Animal { + eat(): Animal { + console.log("I'm moving!"); + return this; + } +} + `, + errors: [ + { + messageId: 'useThisType', + line: 3, + column: 10, + endColumn: 19, + }, + ], + output: ` +class Animal { + eat(): this { + console.log("I'm moving!"); + return this; + } +} + `, + }, + ], +}); 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 0cef89740d56..aefb7cd8d2d9 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 @@ -1069,13 +1069,13 @@ function addOptional>( ): TSESLint.ValidTestCase[]; function addOptional< TMessageIds extends string, - TOptions extends Readonly + TOptions extends Readonly, >( cases: TSESLint.InvalidTestCase[], ): TSESLint.InvalidTestCase[]; function addOptional< TMessageIds extends string, - TOptions extends Readonly + TOptions extends Readonly, >( cases: (Case | string)[], ): Case[] { 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 961047138c99..6a0451ed8580 100644 --- a/packages/eslint-plugin/tests/rules/promise-function-async.test.ts +++ b/packages/eslint-plugin/tests/rules/promise-function-async.test.ts @@ -1,3 +1,4 @@ +import { noFormat } from '@typescript-eslint/experimental-utils/src/eslint-utils'; import rule from '../../src/rules/promise-function-async'; import { getFixturesRootDir, RuleTester } from '../RuleTester'; @@ -630,6 +631,41 @@ class Test { public async test() { return Promise.resolve(123); } +} + `, + }, + { + code: noFormat` +class Test { + @decorator(async () => {}) + static protected[(1)]() { + return Promise.resolve(1); + } + public'bar'() { + return Promise.resolve(2); + } + private['baz']() { + return Promise.resolve(3); + } +} + `, + errors: [ + { line: 4, column: 3, messageId }, + { line: 7, column: 3, messageId }, + { line: 10, column: 3, messageId }, + ], + output: noFormat` +class Test { + @decorator(async () => {}) + static protected async [(1)]() { + return Promise.resolve(1); + } + public async 'bar'() { + return Promise.resolve(2); + } + private async ['baz']() { + return Promise.resolve(3); + } } `, }, diff --git a/packages/eslint-plugin/tests/rules/quotes.test.ts b/packages/eslint-plugin/tests/rules/quotes.test.ts index 847e27e81f52..003d4fd19d7e 100644 --- a/packages/eslint-plugin/tests/rules/quotes.test.ts +++ b/packages/eslint-plugin/tests/rules/quotes.test.ts @@ -290,18 +290,15 @@ ruleTester.run('quotes', rule, { options: ['backtick'], }, { - code: - 'function foo() { "use strict"; "use strong"; "use asm"; var foo = `backtick`; }', + code: 'function foo() { "use strict"; "use strong"; "use asm"; var foo = `backtick`; }', options: ['backtick'], }, { - code: - "(function() { 'use strict'; 'use strong'; 'use asm'; var foo = `backtick`; })();", + code: "(function() { 'use strict'; 'use strong'; 'use asm'; var foo = `backtick`; })();", options: ['backtick'], }, { - code: - '(() => { "use strict"; "use strong"; "use asm"; var foo = `backtick`; })();', + code: '(() => { "use strict"; "use strong"; "use asm"; var foo = `backtick`; })();', options: ['backtick'], }, @@ -426,7 +423,7 @@ interface Foo { options: ['backtick'], }, - // ClassProperty + // PropertyDefinition { code: ` class Foo { @@ -454,20 +451,20 @@ class Foo { options: ['backtick'], }, - // TSAbstractClassProperty + // TSAbstractPropertyDefinition { code: ` abstract class Foo { - public abstract a = ""; - public abstract "a-b" = ""; + public abstract a: ""; + public abstract "a-b": ""; } `, }, { code: ` abstract class Foo { - public abstract a = ''; - public abstract 'a-b' = ''; + public abstract a: ''; + public abstract 'a-b': ''; } `, options: ['single'], @@ -475,8 +472,8 @@ abstract class Foo { { code: ` abstract class Foo { - public abstract a = \`\`; - public abstract 'a-b' = \`\`; + public abstract a: \`\`; + public abstract 'a-b': \`\`; } `, options: ['backtick'], @@ -954,7 +951,7 @@ interface Foo { options: ['single'], }, - // ClassProperty + // PropertyDefinition { code: ` class Foo { @@ -1046,25 +1043,25 @@ class Foo { options: ['backtick'], }, - // TSAbstractClassProperty + // TSAbstractPropertyDefinition { code: ` abstract class Foo { - public abstract a = ''; - public abstract 'a-b' = ''; + public abstract a: ''; + public abstract 'a-b': ''; } `, output: ` abstract class Foo { - public abstract a = ""; - public abstract "a-b" = ""; + public abstract a: ""; + public abstract "a-b": ""; } `, errors: [ { ...useDoubleQuote, line: 3, - column: 23, + column: 22, }, { ...useDoubleQuote, @@ -1074,28 +1071,28 @@ abstract class Foo { { ...useDoubleQuote, line: 4, - column: 27, + column: 26, }, ], }, { code: ` abstract class Foo { - public abstract a = ""; - public abstract "a-b" = ""; + public abstract a: ""; + public abstract "a-b": ""; } `, output: ` abstract class Foo { - public abstract a = ''; - public abstract 'a-b' = ''; + public abstract a: ''; + public abstract 'a-b': ''; } `, errors: [ { ...useSingleQuote, line: 3, - column: 23, + column: 22, }, { ...useSingleQuote, @@ -1105,38 +1102,11 @@ abstract class Foo { { ...useSingleQuote, line: 4, - column: 27, + column: 26, }, ], options: ['single'], }, - { - code: ` -abstract class Foo { - public abstract a = ""; - public abstract "a-b" = ""; -} - `, - output: ` -abstract class Foo { - public abstract a = \`\`; - public abstract "a-b" = \`\`; -} - `, - errors: [ - { - ...useBacktick, - line: 3, - column: 23, - }, - { - ...useBacktick, - line: 4, - column: 27, - }, - ], - options: ['backtick'], - }, // TSAbstractMethodDefinition { diff --git a/packages/eslint-plugin/tests/rules/require-await.test.ts b/packages/eslint-plugin/tests/rules/require-await.test.ts index 045558d2eb10..ec2b178ecbb4 100644 --- a/packages/eslint-plugin/tests/rules/require-await.test.ts +++ b/packages/eslint-plugin/tests/rules/require-await.test.ts @@ -197,7 +197,7 @@ const numberOne = async function (): Promise { { messageId: 'missingAwait', data: { - name: 'Async function', + name: "Async function 'numberOne'", }, }, ], @@ -272,7 +272,7 @@ const foo = async function* () { { messageId: 'missingAwait', data: { - name: 'Async generator function', + name: "Async generator function 'foo'", }, }, ], @@ -375,7 +375,7 @@ async function foo() { for await (x of xs); } `, - // global await + // -- global await { code: 'await foo();', }, 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 daa02fa46d9d..af33e3ad3dba 100644 --- a/packages/eslint-plugin/tests/rules/restrict-plus-operands.test.ts +++ b/packages/eslint-plugin/tests/rules/restrict-plus-operands.test.ts @@ -110,6 +110,12 @@ const x = a + b; declare const a: 'string literal' & string; declare const b: string; const x = a + b; + `, + ` +function A(s: string) { + return \`a\${s}b\` as const; +} +const b = A('') + '!'; `, { code: ` 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 df5d5aefb259..fea8b82501ae 100644 --- a/packages/eslint-plugin/tests/rules/restrict-template-expressions.test.ts +++ b/packages/eslint-plugin/tests/rules/restrict-template-expressions.test.ts @@ -189,11 +189,56 @@ ruleTester.run('restrict-template-expressions', rule, { } `, }, + // allowRegExp + { + options: [{ allowRegExp: true }], + code: ` + const arg = new RegExp('foo'); + const msg = \`arg = \${arg}\`; + `, + }, + { + options: [{ allowRegExp: true }], + code: ` + const arg = /foo/; + const msg = \`arg = \${arg}\`; + `, + }, + { + options: [{ allowRegExp: true }], + code: ` + declare const arg: string | RegExp; + const msg = \`arg = \${arg}\`; + `, + }, + { + options: [{ allowRegExp: true }], + code: ` + function test(arg: T) { + return \`arg = \${arg}\`; + } + `, + }, + { + options: [{ allowRegExp: true }], + code: ` + function test(arg: T) { + return \`arg = \${arg}\`; + } + `, + }, // allow ALL { - options: [{ allowNumber: true, allowBoolean: true, allowNullish: true }], + options: [ + { + allowNumber: true, + allowBoolean: true, + allowNullish: true, + allowRegExp: true, + }, + ], code: ` - type All = string | number | boolean | null | undefined; + type All = string | number | boolean | null | undefined | RegExp; function test(arg: T) { return \`arg = \${arg}\`; } @@ -338,6 +383,36 @@ ruleTester.run('restrict-template-expressions', rule, { }, ], }, + { + options: [{ allowRegExp: false }], + code: ` + const arg = new RegExp('foo'); + const msg = \`arg = \${arg}\`; + `, + errors: [ + { + messageId: 'invalidType', + data: { type: 'RegExp' }, + line: 3, + column: 30, + }, + ], + }, + { + options: [{ allowRegExp: false }], + code: ` + const arg = /foo/; + const msg = \`arg = \${arg}\`; + `, + errors: [ + { + messageId: 'invalidType', + data: { type: 'RegExp' }, + line: 3, + column: 30, + }, + ], + }, // TS 3.9 change { options: [{ allowAny: true }], diff --git a/packages/eslint-plugin/tests/rules/return-await.test.ts b/packages/eslint-plugin/tests/rules/return-await.test.ts index 73056f6091c6..1c0a9cdd2a13 100644 --- a/packages/eslint-plugin/tests/rules/return-await.test.ts +++ b/packages/eslint-plugin/tests/rules/return-await.test.ts @@ -232,6 +232,21 @@ ruleTester.run('return-await', rule, { } `, }, + { + code: ` + async function test() { + const res = await Promise.resolve('{}'); + try { + async function nested() { + return Promise.resolve('ok'); + } + return await nested(); + } catch (error) { + return await Promise.resolve('error'); + } + } + `, + }, ], invalid: [ { @@ -827,5 +842,72 @@ const buzz = async () => ((await foo()) ? 1 : await bar()); }, ], }, + { + // https://github.com/typescript-eslint/typescript-eslint/issues/2109 + code: ` +async function test(): Promise { + const res = await fetch('...'); + try { + return res.json() as Promise; + } catch (err) { + throw Error('Request Failed.'); + } +} + `, + output: ` +async function test(): Promise { + const res = await fetch('...'); + try { + return await (res.json() as Promise); + } catch (err) { + throw Error('Request Failed.'); + } +} + `, + errors: [ + { + line: 5, + messageId: 'requiredPromiseAwait', + }, + ], + }, + { + code: ` + async function test() { + try { + const callback1 = function () {}; + const callback2 = async function () {}; + function callback3() {} + async function callback4() {} + const callback5 = () => {}; + const callback6 = async () => {}; + return Promise.resolve('try'); + } finally { + return Promise.resolve('finally'); + } + } + `, + output: ` + async function test() { + try { + const callback1 = function () {}; + const callback2 = async function () {}; + function callback3() {} + async function callback4() {} + const callback5 = () => {}; + const callback6 = async () => {}; + return await Promise.resolve('try'); + } finally { + return Promise.resolve('finally'); + } + } + `, + errors: [ + { + line: 10, + messageId: 'requiredPromiseAwait', + }, + ], + }, ], }); 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 index 7dda416d6b3d..a0cf2d71dd59 100644 --- 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 @@ -127,7 +127,7 @@ const invalid = ( }, { code: noFormat`type T = (B) ${operator} (A);`, - output: noFormat`type T = (A) ${operator} (B);`, + output: noFormat`type T = A ${operator} B;`, errors: [ { messageId: 'notSortedNamed', 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 0c90443ca4fc..5ad92555d88e 100644 --- a/packages/eslint-plugin/tests/rules/space-infix-ops.test.ts +++ b/packages/eslint-plugin/tests/rules/space-infix-ops.test.ts @@ -33,6 +33,131 @@ ruleTester.run('space-infix-ops', rule, { } `, }, + { + code: ` + class Test { + public readonly value?: number; + } + `, + }, + { + code: ` + class Test { + public readonly value = 1; + } + `, + }, + { + code: ` + class Test { + private value:number = 1; + } + `, + }, + { + code: ` + type Test = string; + `, + }, + { + code: ` + type Test = string | boolean; + `, + }, + { + code: ` + type Test = string & boolean; + `, + }, + { + code: ` + class Test { + private value:number | string = 1; + } + `, + }, + { + code: ` + class Test { + private value:number & string = 1; + } + `, + }, + { + code: ` + type Test = + | string + | boolean; + `, + }, + { + code: ` + type Test = + & string + & boolean; + `, + }, + { + code: ` + interface Test { + prop: + & string + & boolean; + } + `, + }, + { + code: ` + interface Test { + prop: + | string + | boolean; + } + `, + }, + { + code: ` + interface Test { + props: string; + } + `, + }, + { + code: ` + interface Test { + props: string | boolean; + } + `, + }, + { + code: ` + interface Test { + props: string & boolean; + } + `, + }, + { + code: ` + const x: string & number; + `, + }, + { + code: ` + class Test { + value: string & number; + } + `, + }, + { + code: ` + function foo() {} + `, + }, + { + code: ` + function bar(): string & number {} + `, + }, ], invalid: [ { @@ -98,5 +223,515 @@ ruleTester.run('space-infix-ops', rule, { }, ], }, + { + code: ` + class Test { + public readonly value= 2; + } + `, + output: ` + class Test { + public readonly value = 2; + } + `, + errors: [ + { + messageId: 'missingSpace', + column: 32, + line: 3, + }, + ], + }, + { + code: ` + class Test { + public readonly value =2; + } + `, + output: ` + class Test { + public readonly value = 2; + } + `, + errors: [ + { + messageId: 'missingSpace', + column: 33, + line: 3, + }, + ], + }, + { + code: ` + type Test= string | number; + `, + output: ` + type Test = string | number; + `, + errors: [ + { + messageId: 'missingSpace', + column: 18, + line: 2, + }, + ], + }, + { + code: ` + type Test =string | number; + `, + output: ` + type Test = string | number; + `, + errors: [ + { + messageId: 'missingSpace', + column: 19, + line: 2, + }, + ], + }, + { + code: ` + type Test = string| number; + `, + output: ` + type Test = string | number; + `, + errors: [ + { + messageId: 'missingSpace', + column: 27, + line: 2, + }, + ], + }, + { + code: ` + type Test = string |number; + `, + output: ` + type Test = string | number; + `, + errors: [ + { + messageId: 'missingSpace', + column: 28, + line: 2, + }, + ], + }, + { + code: ` + type Test = string &number; + `, + output: ` + type Test = string & number; + `, + errors: [ + { + messageId: 'missingSpace', + column: 28, + line: 2, + }, + ], + }, + { + code: ` + type Test = string& number; + `, + output: ` + type Test = string & number; + `, + errors: [ + { + messageId: 'missingSpace', + column: 27, + line: 2, + }, + ], + }, + { + code: ` + type Test = + |string + | number; + `, + output: ` + type Test = + | string + | number; + `, + errors: [ + { + messageId: 'missingSpace', + column: 9, + line: 3, + }, + ], + }, + { + code: ` + type Test = + &string + & number; + `, + output: ` + type Test = + & string + & number; + `, + errors: [ + { + messageId: 'missingSpace', + column: 9, + line: 3, + }, + ], + }, + { + code: ` + interface Test { + prop: string| number; + } + `, + output: ` + interface Test { + prop: string | number; + } + `, + errors: [ + { + messageId: 'missingSpace', + column: 23, + line: 3, + }, + ], + }, + { + code: ` + interface Test { + prop: string |number; + } + `, + output: ` + interface Test { + prop: string | number; + } + `, + errors: [ + { + messageId: 'missingSpace', + column: 24, + line: 3, + }, + ], + }, + { + code: ` + interface Test { + prop: string &number; + } + `, + output: ` + interface Test { + prop: string & number; + } + `, + errors: [ + { + messageId: 'missingSpace', + column: 24, + line: 3, + }, + ], + }, + { + code: ` + interface Test { + prop: string& number; + } + `, + output: ` + interface Test { + prop: string & number; + } + `, + errors: [ + { + messageId: 'missingSpace', + column: 23, + line: 3, + }, + ], + }, + { + code: ` + interface Test { + prop: + |string + | number; + } + `, + output: ` + interface Test { + prop: + | string + | number; + } + `, + errors: [ + { + messageId: 'missingSpace', + column: 13, + line: 4, + }, + ], + }, + { + code: ` + interface Test { + prop: + &string + & number; + } + `, + output: ` + interface Test { + prop: + & string + & number; + } + `, + errors: [ + { + messageId: 'missingSpace', + column: 13, + line: 4, + }, + ], + }, + { + code: ` + const x: string &number; + `, + output: ` + const x: string & number; + `, + errors: [ + { + messageId: 'missingSpace', + column: 25, + line: 2, + }, + ], + }, + { + code: ` + const x: string& number; + `, + output: ` + const x: string & number; + `, + errors: [ + { + messageId: 'missingSpace', + column: 24, + line: 2, + }, + ], + }, + { + code: ` + const x: string| number; + `, + output: ` + const x: string | number; + `, + errors: [ + { + messageId: 'missingSpace', + column: 24, + line: 2, + }, + ], + }, + { + code: ` + class Test { + value: string |number; + } + `, + output: ` + class Test { + value: string | number; + } + `, + errors: [ + { + messageId: 'missingSpace', + column: 25, + line: 3, + }, + ], + }, + { + code: ` + class Test { + value: string& number; + } + `, + output: ` + class Test { + value: string & number; + } + `, + errors: [ + { + messageId: 'missingSpace', + column: 24, + line: 3, + }, + ], + }, + { + code: ` + class Test { + value: string| number; + } + `, + output: ` + class Test { + value: string | number; + } + `, + errors: [ + { + messageId: 'missingSpace', + column: 24, + line: 3, + }, + ], + }, + { + code: ` + function foo() {} + `, + output: ` + function foo() {} + `, + errors: [ + { + messageId: 'missingSpace', + column: 39, + line: 2, + }, + ], + }, + { + code: ` + function foo() {} + `, + output: ` + function foo() {} + `, + errors: [ + { + messageId: 'missingSpace', + column: 38, + line: 2, + }, + ], + }, + { + code: ` + function foo() {} + `, + output: ` + function foo() {} + `, + errors: [ + { + messageId: 'missingSpace', + column: 39, + line: 2, + }, + ], + }, + { + code: ` + function foo() {} + `, + output: ` + function foo() {} + `, + errors: [ + { + messageId: 'missingSpace', + column: 38, + line: 2, + }, + ], + }, + { + code: ` + function bar(): string &number {} + `, + output: ` + function bar(): string & number {} + `, + errors: [ + { + messageId: 'missingSpace', + column: 32, + line: 2, + }, + ], + }, + { + code: ` + function bar(): string& number {} + `, + output: ` + function bar(): string & number {} + `, + errors: [ + { + messageId: 'missingSpace', + column: 31, + line: 2, + }, + ], + }, + { + code: ` + function bar(): string |number {} + `, + output: ` + function bar(): string | number {} + `, + errors: [ + { + messageId: 'missingSpace', + column: 32, + line: 2, + }, + ], + }, + { + code: ` + function bar(): string| number {} + `, + output: ` + function bar(): string | number {} + `, + errors: [ + { + messageId: 'missingSpace', + column: 31, + line: 2, + }, + ], + }, ], }); 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 0d697ebb905d..c98102a1f173 100644 --- a/packages/eslint-plugin/tests/rules/strict-boolean-expressions.test.ts +++ b/packages/eslint-plugin/tests/rules/strict-boolean-expressions.test.ts @@ -1,13 +1,13 @@ import * as path from 'path'; import rule, { - Options, MessageId, + Options, } from '../../src/rules/strict-boolean-expressions'; import { batchedSingleLineTests, getFixturesRootDir, - RuleTester, noFormat, + RuleTester, } from '../RuleTester'; const rootPath = getFixturesRootDir(); @@ -133,6 +133,57 @@ if (x) { tsconfigRootDir: path.join(rootPath, 'unstrict'), }, }, + + ` +function f(arg: 'a' | null) { + if (arg) console.log(arg); +} + `, + ` +function f(arg: 'a' | 'b' | null) { + if (arg) console.log(arg); +} + `, + { + code: ` +declare const x: 1 | null; +declare const y: 1; +if (x) { +} +if (y) { +} + `, + options: [ + { + allowNumber: true, + }, + ], + }, + ` +function f(arg: 1 | null) { + if (arg) console.log(arg); +} + `, + ` +function f(arg: 1 | 2 | null) { + if (arg) console.log(arg); +} + `, + { + code: ` +declare const x: 'a' | null; +declare const y: 'a'; +if (x) { +} +if (y) { +} + `, + options: [ + { + allowString: true, + }, + ], + }, ], invalid: [ @@ -142,13 +193,49 @@ if (x) { { allowString: false, allowNumber: false, allowNullableObject: false }, ], code: noFormat` - if (true && 1) {} - while (false || "a") {} + if (true && (1 + 1)) {} + while (false || "a" + "b") {} (x: object) => true || false || x ? true : false; `, errors: [ - { messageId: 'conditionErrorNumber', line: 2, column: 13 }, - { messageId: 'conditionErrorString', line: 3, column: 25 }, + { + messageId: 'conditionErrorNumber', + line: 2, + column: 14, + suggestions: [ + { + messageId: 'conditionFixCompareZero', + output: 'if (true && ((1 + 1) !== 0)) {}', + }, + { + messageId: 'conditionFixCompareNaN', + output: 'if (true && (!Number.isNaN((1 + 1)))) {}', + }, + { + messageId: 'conditionFixCastBoolean', + output: 'if (true && (Boolean((1 + 1)))) {}', + }, + ], + }, + { + messageId: 'conditionErrorString', + line: 3, + column: 25, + suggestions: [ + { + messageId: 'conditionFixCompareStringLength', + output: ' while (false || (("a" + "b").length > 0)) {}', + }, + { + messageId: 'conditionFixCompareEmptyString', + output: ' while (false || (("a" + "b") !== "")) {}', + }, + { + messageId: 'conditionFixCastBoolean', + output: ' while (false || (Boolean(("a" + "b")))) {}', + }, + ], + }, { messageId: 'conditionErrorObject', line: 4, column: 41 }, ], }), @@ -158,15 +245,48 @@ if (x) { options: [ { allowString: false, allowNumber: false, allowNullableObject: false }, ], - code: ` - if (('' && {}) || (0 && void 0)) { - } - `, + code: noFormat`if (('' && {}) || (0 && void 0)) { }`, errors: [ - { messageId: 'conditionErrorString', line: 2, column: 14 }, - { messageId: 'conditionErrorObject', line: 2, column: 20 }, - { messageId: 'conditionErrorNumber', line: 2, column: 28 }, - { messageId: 'conditionErrorNullish', line: 2, column: 33 }, + { + messageId: 'conditionErrorString', + line: 1, + column: 6, + suggestions: [ + { + messageId: 'conditionFixCompareStringLength', + output: noFormat`if (((''.length > 0) && {}) || (0 && void 0)) { }`, + }, + { + messageId: 'conditionFixCompareEmptyString', + output: noFormat`if ((('' !== "") && {}) || (0 && void 0)) { }`, + }, + { + messageId: 'conditionFixCastBoolean', + output: noFormat`if (((Boolean('')) && {}) || (0 && void 0)) { }`, + }, + ], + }, + { messageId: 'conditionErrorObject', line: 1, column: 12 }, + { + messageId: 'conditionErrorNumber', + line: 1, + column: 20, + suggestions: [ + { + messageId: 'conditionFixCompareZero', + output: noFormat`if (('' && {}) || ((0 !== 0) && void 0)) { }`, + }, + { + messageId: 'conditionFixCompareNaN', + output: noFormat`if (('' && {}) || ((!Number.isNaN(0)) && void 0)) { }`, + }, + { + messageId: 'conditionFixCastBoolean', + output: noFormat`if (('' && {}) || ((Boolean(0)) && void 0)) { }`, + }, + ], + }, + { messageId: 'conditionErrorNullish', line: 1, column: 25 }, ], }, @@ -178,6 +298,8 @@ if (x) { declare const x: null; if (x) {} (x: undefined) => !x; (x: T) => x ? 1 : 0; + (x: T) => x ? 1 : 0; + (x: T) => x ? 1 : 0; `, errors: [ { messageId: 'conditionErrorNullish', line: 2, column: 1 }, @@ -185,6 +307,8 @@ if (x) { { messageId: 'conditionErrorNullish', line: 4, column: 36 }, { messageId: 'conditionErrorNullish', line: 5, column: 28 }, { messageId: 'conditionErrorNullish', line: 6, column: 47 }, + { messageId: 'conditionErrorNullish', line: 7, column: 35 }, + { messageId: 'conditionErrorNullish', line: 8, column: 40 }, ], }), @@ -196,6 +320,9 @@ if (x) { declare const x: symbol; if (x) {} (x: () => void) => !x; (x: T) => x ? 1 : 0; + (x: T) => x ? 1 : 0; + (x: T) => x ? 1 : 0; + void>(x: T) => x ? 1 : 0; `, errors: [ { messageId: 'conditionErrorObject', line: 2, column: 1 }, @@ -203,6 +330,9 @@ if (x) { { messageId: 'conditionErrorObject', line: 4, column: 38 }, { messageId: 'conditionErrorObject', line: 5, column: 29 }, { messageId: 'conditionErrorObject', line: 6, column: 37 }, + { messageId: 'conditionErrorObject', line: 7, column: 48 }, + { messageId: 'conditionErrorObject', line: 8, column: 44 }, + { messageId: 'conditionErrorObject', line: 9, column: 41 }, ], }), @@ -213,15 +343,105 @@ if (x) { while ("") {} for (; "foo";) {} declare const x: string; if (x) {} - (x: string) => !x; + (x: string) => (!x); (x: T) => x ? 1 : 0; `, errors: [ - { messageId: 'conditionErrorString', line: 2, column: 8 }, - { messageId: 'conditionErrorString', line: 3, column: 16 }, - { messageId: 'conditionErrorString', line: 4, column: 38 }, - { messageId: 'conditionErrorString', line: 5, column: 25 }, - { messageId: 'conditionErrorString', line: 6, column: 37 }, + { + messageId: 'conditionErrorString', + line: 2, + column: 8, + suggestions: [ + { + messageId: 'conditionFixCompareStringLength', + output: `while ("".length > 0) {}`, + }, + { + messageId: 'conditionFixCompareEmptyString', + output: `while ("" !== "") {}`, + }, + { + messageId: 'conditionFixCastBoolean', + output: `while (Boolean("")) {}`, + }, + ], + }, + { + messageId: 'conditionErrorString', + line: 3, + column: 16, + suggestions: [ + { + messageId: 'conditionFixCompareStringLength', + output: ` for (; "foo".length > 0;) {}`, + }, + { + messageId: 'conditionFixCompareEmptyString', + output: ` for (; "foo" !== "";) {}`, + }, + { + messageId: 'conditionFixCastBoolean', + output: ` for (; Boolean("foo");) {}`, + }, + ], + }, + { + messageId: 'conditionErrorString', + line: 4, + column: 38, + suggestions: [ + { + messageId: 'conditionFixCompareStringLength', + output: ` declare const x: string; if (x.length > 0) {}`, + }, + { + messageId: 'conditionFixCompareEmptyString', + output: ` declare const x: string; if (x !== "") {}`, + }, + { + messageId: 'conditionFixCastBoolean', + output: ` declare const x: string; if (Boolean(x)) {}`, + }, + ], + }, + { + messageId: 'conditionErrorString', + line: 5, + column: 26, + suggestions: [ + { + messageId: 'conditionFixCompareStringLength', + output: ` (x: string) => (x.length === 0);`, + }, + { + messageId: 'conditionFixCompareEmptyString', + output: ` (x: string) => (x === "");`, + }, + { + messageId: 'conditionFixCastBoolean', + output: ` (x: string) => (!Boolean(x));`, + }, + ], + }, + { + messageId: 'conditionErrorString', + line: 6, + column: 37, + suggestions: [ + { + messageId: 'conditionFixCompareStringLength', + output: ` (x: T) => (x.length > 0) ? 1 : 0;`, + }, + { + messageId: 'conditionFixCompareEmptyString', + output: ` (x: T) => (x !== "") ? 1 : 0;`, + }, + { + messageId: 'conditionFixCastBoolean', + output: ` (x: T) => (Boolean(x)) ? 1 : 0;`, + }, + ], + }, ], }), @@ -233,15 +453,169 @@ if (x) { for (; 123;) {} declare const x: number; if (x) {} (x: bigint) => !x; - (x: T) => x ? 1 : 0; + (x: T) => (x) ? 1 : 0; + ![]["length"]; // doesn't count as array.length when computed + declare const a: any[] & { notLength: number }; if (a.notLength) {} `, errors: [ - { messageId: 'conditionErrorNumber', line: 2, column: 8 }, - { messageId: 'conditionErrorNumber', line: 3, column: 16 }, - { messageId: 'conditionErrorNumber', line: 4, column: 38 }, - { messageId: 'conditionErrorNumber', line: 5, column: 25 }, - { messageId: 'conditionErrorNumber', line: 6, column: 37 }, + { + messageId: 'conditionErrorNumber', + line: 2, + column: 8, + suggestions: [ + { + messageId: 'conditionFixCompareZero', + // TODO: fix compare zero suggestion for bigint + output: `while (0n !== 0) {}`, + }, + { + // TODO: remove check NaN suggestion for bigint + messageId: 'conditionFixCompareNaN', + output: `while (!Number.isNaN(0n)) {}`, + }, + { + messageId: 'conditionFixCastBoolean', + output: `while (Boolean(0n)) {}`, + }, + ], + }, + { + messageId: 'conditionErrorNumber', + line: 3, + column: 16, + suggestions: [ + { + messageId: 'conditionFixCompareZero', + output: ` for (; 123 !== 0;) {}`, + }, + { + messageId: 'conditionFixCompareNaN', + output: ` for (; !Number.isNaN(123);) {}`, + }, + { + messageId: 'conditionFixCastBoolean', + output: ` for (; Boolean(123);) {}`, + }, + ], + }, + { + messageId: 'conditionErrorNumber', + line: 4, + column: 38, + suggestions: [ + { + messageId: 'conditionFixCompareZero', + output: ` declare const x: number; if (x !== 0) {}`, + }, + { + messageId: 'conditionFixCompareNaN', + output: ` declare const x: number; if (!Number.isNaN(x)) {}`, + }, + { + messageId: 'conditionFixCastBoolean', + output: ` declare const x: number; if (Boolean(x)) {}`, + }, + ], + }, + { + messageId: 'conditionErrorNumber', + line: 5, + column: 25, + suggestions: [ + { + messageId: 'conditionFixCompareZero', + // TODO: fix compare zero suggestion for bigint + output: ` (x: bigint) => x === 0;`, + }, + { + // TODO: remove check NaN suggestion for bigint + messageId: 'conditionFixCompareNaN', + output: ` (x: bigint) => Number.isNaN(x);`, + }, + { + messageId: 'conditionFixCastBoolean', + output: ` (x: bigint) => !Boolean(x);`, + }, + ], + }, + { + messageId: 'conditionErrorNumber', + line: 6, + column: 38, + suggestions: [ + { + messageId: 'conditionFixCompareZero', + output: ` (x: T) => (x !== 0) ? 1 : 0;`, + }, + { + messageId: 'conditionFixCompareNaN', + output: ` (x: T) => (!Number.isNaN(x)) ? 1 : 0;`, + }, + { + messageId: 'conditionFixCastBoolean', + output: ` (x: T) => (Boolean(x)) ? 1 : 0;`, + }, + ], + }, + { + messageId: 'conditionErrorNumber', + line: 7, + column: 10, + suggestions: [ + { + messageId: 'conditionFixCompareZero', + output: ` []["length"] === 0; // doesn't count as array.length when computed`, + }, + { + messageId: 'conditionFixCompareNaN', + output: ` Number.isNaN([]["length"]); // doesn't count as array.length when computed`, + }, + { + messageId: 'conditionFixCastBoolean', + output: ` !Boolean([]["length"]); // doesn't count as array.length when computed`, + }, + ], + }, + { + messageId: 'conditionErrorNumber', + line: 8, + column: 61, + suggestions: [ + { + messageId: 'conditionFixCompareZero', + output: ` declare const a: any[] & { notLength: number }; if (a.notLength !== 0) {}`, + }, + { + messageId: 'conditionFixCompareNaN', + output: ` declare const a: any[] & { notLength: number }; if (!Number.isNaN(a.notLength)) {}`, + }, + { + messageId: 'conditionFixCastBoolean', + output: ` declare const a: any[] & { notLength: number }; if (Boolean(a.notLength)) {}`, + }, + ], + }, + ], + }), + + // number (array.length) in boolean context + ...batchedSingleLineTests({ + options: [{ allowNumber: false }], + code: noFormat` + if (![].length) {} + (a: number[]) => a.length && "..." + (...a: T) => a.length || "empty"; + `, + errors: [ + { messageId: 'conditionErrorNumber', line: 2, column: 6 }, + { messageId: 'conditionErrorNumber', line: 3, column: 26 }, + { messageId: 'conditionErrorNumber', line: 4, column: 43 }, ], + output: noFormat` + if ([].length === 0) {} + (a: number[]) => (a.length > 0) && "..." + (...a: T) => (a.length > 0) || "empty"; + `, }), // mixed `string | number` value in boolean context @@ -268,9 +642,51 @@ if (x) { (x: T) => x ? 1 : 0; `, errors: [ - { messageId: 'conditionErrorNullableBoolean', line: 2, column: 38 }, - { messageId: 'conditionErrorNullableBoolean', line: 3, column: 27 }, - { messageId: 'conditionErrorNullableBoolean', line: 4, column: 57 }, + { + messageId: 'conditionErrorNullableBoolean', + line: 2, + column: 38, + suggestions: [ + { + messageId: 'conditionFixDefaultFalse', + output: `declare const x: boolean | null; if (x ?? false) {}`, + }, + { + messageId: 'conditionFixCompareTrue', + output: `declare const x: boolean | null; if (x === true) {}`, + }, + ], + }, + { + messageId: 'conditionErrorNullableBoolean', + line: 3, + column: 27, + suggestions: [ + { + messageId: 'conditionFixDefaultFalse', + output: ` (x?: boolean) => !(x ?? false);`, + }, + { + messageId: 'conditionFixCompareFalse', + output: ` (x?: boolean) => x === false;`, + }, + ], + }, + { + messageId: 'conditionErrorNullableBoolean', + line: 4, + column: 57, + suggestions: [ + { + messageId: 'conditionFixDefaultFalse', + output: ` (x: T) => (x ?? false) ? 1 : 0;`, + }, + { + messageId: 'conditionFixCompareTrue', + output: ` (x: T) => (x === true) ? 1 : 0;`, + }, + ], + }, ], }), @@ -287,6 +703,11 @@ if (x) { { messageId: 'conditionErrorNullableObject', line: 3, column: 33 }, { messageId: 'conditionErrorNullableObject', line: 4, column: 52 }, ], + output: noFormat` + declare const x: object | null; if (x != null) {} + (x?: { a: number }) => x == null; + (x: T) => (x != null) ? 1 : 0; + `, }), // nullable string in boolean context @@ -297,9 +718,66 @@ if (x) { (x: T) => x ? 1 : 0; `, errors: [ - { messageId: 'conditionErrorNullableString', line: 2, column: 37 }, - { messageId: 'conditionErrorNullableString', line: 3, column: 26 }, - { messageId: 'conditionErrorNullableString', line: 4, column: 56 }, + { + messageId: 'conditionErrorNullableString', + line: 2, + column: 37, + suggestions: [ + { + messageId: 'conditionFixCompareNullish', + output: 'declare const x: string | null; if (x != null) {}', + }, + { + messageId: 'conditionFixDefaultEmptyString', + output: 'declare const x: string | null; if (x ?? "") {}', + }, + { + messageId: 'conditionFixCastBoolean', + output: 'declare const x: string | null; if (Boolean(x)) {}', + }, + ], + }, + { + messageId: 'conditionErrorNullableString', + line: 3, + column: 26, + suggestions: [ + { + messageId: 'conditionFixCompareNullish', + output: ' (x?: string) => x == null;', + }, + { + messageId: 'conditionFixDefaultEmptyString', + output: ' (x?: string) => !(x ?? "");', + }, + { + messageId: 'conditionFixCastBoolean', + output: ' (x?: string) => !Boolean(x);', + }, + ], + }, + { + messageId: 'conditionErrorNullableString', + line: 4, + column: 56, + suggestions: [ + { + messageId: 'conditionFixCompareNullish', + output: + ' (x: T) => (x != null) ? 1 : 0;', + }, + { + messageId: 'conditionFixDefaultEmptyString', + output: + ' (x: T) => (x ?? "") ? 1 : 0;', + }, + { + messageId: 'conditionFixCastBoolean', + output: + ' (x: T) => (Boolean(x)) ? 1 : 0;', + }, + ], + }, ], }), @@ -311,26 +789,126 @@ if (x) { (x: T) => x ? 1 : 0; `, errors: [ - { messageId: 'conditionErrorNullableNumber', line: 2, column: 37 }, - { messageId: 'conditionErrorNullableNumber', line: 3, column: 26 }, - { messageId: 'conditionErrorNullableNumber', line: 4, column: 56 }, + { + messageId: 'conditionErrorNullableNumber', + line: 2, + column: 37, + suggestions: [ + { + messageId: 'conditionFixCompareNullish', + output: 'declare const x: number | null; if (x != null) {}', + }, + { + messageId: 'conditionFixDefaultZero', + output: 'declare const x: number | null; if (x ?? 0) {}', + }, + { + messageId: 'conditionFixCastBoolean', + output: 'declare const x: number | null; if (Boolean(x)) {}', + }, + ], + }, + { + messageId: 'conditionErrorNullableNumber', + line: 3, + column: 26, + suggestions: [ + { + messageId: 'conditionFixCompareNullish', + output: ' (x?: number) => x == null;', + }, + { + messageId: 'conditionFixDefaultZero', + output: ' (x?: number) => !(x ?? 0);', + }, + { + messageId: 'conditionFixCastBoolean', + output: ' (x?: number) => !Boolean(x);', + }, + ], + }, + { + messageId: 'conditionErrorNullableNumber', + line: 4, + column: 56, + suggestions: [ + { + messageId: 'conditionFixCompareNullish', + output: + ' (x: T) => (x != null) ? 1 : 0;', + }, + { + messageId: 'conditionFixDefaultZero', + output: + ' (x: T) => (x ?? 0) ? 1 : 0;', + }, + { + messageId: 'conditionFixCastBoolean', + output: + ' (x: T) => (Boolean(x)) ? 1 : 0;', + }, + ], + }, ], }), // any in boolean context - // TODO: when `T` is not `extends any` then the error is `conditionErrorObject` (says it's always truthy, which is false) ...batchedSingleLineTests({ code: noFormat` if (x) {} x => !x; (x: T) => x ? 1 : 0; + (x: T) => x ? 1 : 0; `, errors: [ - { messageId: 'conditionErrorAny', line: 2, column: 5 }, - { messageId: 'conditionErrorAny', line: 3, column: 15 }, - { messageId: 'conditionErrorAny', line: 4, column: 34 }, + { + messageId: 'conditionErrorAny', + line: 2, + column: 5, + suggestions: [ + { + messageId: 'conditionFixCastBoolean', + output: 'if (Boolean(x)) {}', + }, + ], + }, + { + messageId: 'conditionErrorAny', + line: 3, + column: 15, + suggestions: [ + { + messageId: 'conditionFixCastBoolean', + output: ' x => !(Boolean(x));', + }, + ], + }, + { + messageId: 'conditionErrorAny', + line: 4, + column: 34, + suggestions: [ + { + messageId: 'conditionFixCastBoolean', + output: ' (x: T) => (Boolean(x)) ? 1 : 0;', + }, + ], + }, + { + messageId: 'conditionErrorAny', + line: 5, + column: 22, + suggestions: [ + { + messageId: 'conditionFixCastBoolean', + output: ' (x: T) => (Boolean(x)) ? 1 : 0;', + }, + ], + }, ], }), + + // noStrictNullCheck { code: ` declare const x: string[] | null; @@ -353,5 +931,30 @@ if (x) { tsconfigRootDir: path.join(rootPath, 'unstrict'), }, }, + + // automatic semicolon insertion test + { + options: [{ allowNullableObject: false }], + code: noFormat` + declare const obj: { x: number } | null; + !obj ? 1 : 0 + !obj + obj || 0 + obj && 1 || 0 + `, + errors: [ + { messageId: 'conditionErrorNullableObject', line: 3, column: 10 }, + { messageId: 'conditionErrorNullableObject', line: 4, column: 10 }, + { messageId: 'conditionErrorNullableObject', line: 5, column: 9 }, + { messageId: 'conditionErrorNullableObject', line: 6, column: 9 }, + ], + output: noFormat` + declare const obj: { x: number } | null; + (obj == null) ? 1 : 0 + obj == null + ;(obj != null) || 0 + ;(obj != null) && 1 || 0 + `, + }, ], }); 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 de714cff43f4..19349a808898 100644 --- a/packages/eslint-plugin/tests/rules/type-annotation-spacing.test.ts +++ b/packages/eslint-plugin/tests/rules/type-annotation-spacing.test.ts @@ -4593,6 +4593,54 @@ type Bar = Record }, ], }, + { + code: 'function foo(a? : string) {}', + output: 'function foo(a?: string) {}', + errors: [ + { + messageId: 'unexpectedSpaceBetween', + data: { type: ':', previousToken: '?' }, + line: 1, + column: 17, + }, + ], + }, + { + code: 'function foo(a ? : string) {}', + output: 'function foo(a?: string) {}', + errors: [ + { + messageId: 'unexpectedSpaceBefore', + data: { type: '?:' }, + line: 1, + column: 16, + }, + { + messageId: 'unexpectedSpaceBetween', + data: { type: ':', previousToken: '?' }, + line: 1, + column: 18, + }, + ], + }, + { + code: 'function foo(a ? : string) {}', + output: 'function foo(a?: string) {}', + errors: [ + { + messageId: 'unexpectedSpaceBefore', + data: { type: '?:' }, + line: 1, + column: 16, + }, + { + messageId: 'unexpectedSpaceBetween', + data: { type: ':', previousToken: '?' }, + line: 1, + column: 19, + }, + ], + }, { code: ` class Foo { @@ -4635,6 +4683,32 @@ class Foo { }, { code: ` +class Foo { + constructor(message ? : string); +} + `, + output: ` +class Foo { + constructor(message?: string); +} + `, + errors: [ + { + messageId: 'unexpectedSpaceBefore', + data: { type: '?:' }, + line: 3, + column: 25, + }, + { + messageId: 'unexpectedSpaceBetween', + data: { type: ':', previousToken: '?' }, + line: 3, + column: 27, + }, + ], + }, + { + code: ` class Foo { greet(name ?: string) : string { return name; } } @@ -4681,6 +4755,32 @@ interface Foo { }, { code: ` +interface Foo { + name ? : string; +} + `, + output: ` +interface Foo { + name?: string; +} + `, + errors: [ + { + messageId: 'unexpectedSpaceBefore', + data: { type: '?:' }, + line: 3, + column: 10, + }, + { + messageId: 'unexpectedSpaceBetween', + data: { type: ':', previousToken: '?' }, + line: 3, + column: 12, + }, + ], + }, + { + code: ` interface Foo { greet(name ?: string) : string; } diff --git a/packages/eslint-plugin/tests/rules/typedef.test.ts b/packages/eslint-plugin/tests/rules/typedef.test.ts index 09a4764a0ba3..e237ff686367 100644 --- a/packages/eslint-plugin/tests/rules/typedef.test.ts +++ b/packages/eslint-plugin/tests/rules/typedef.test.ts @@ -442,6 +442,24 @@ class Foo { }, ], }, + // https://github.com/typescript-eslint/typescript-eslint/issues/4033 + { + code: ` +class ClassName { + public str: string = 'str'; + #num: number = 13; + + func: () => void = (): void => { + console.log(this.str); + }; +} + `, + options: [ + { + memberVariableDeclaration: true, + }, + ], + }, ], invalid: [ // Array destructuring diff --git a/packages/eslint-plugin/tests/rules/unbound-method.test.ts b/packages/eslint-plugin/tests/rules/unbound-method.test.ts index 911206b1f219..3075e93fe67a 100644 --- a/packages/eslint-plugin/tests/rules/unbound-method.test.ts +++ b/packages/eslint-plugin/tests/rules/unbound-method.test.ts @@ -42,7 +42,7 @@ function addContainsMethodsClassInvalid( errors: [ { line: 18, - messageId: 'unbound', + messageId: 'unboundWithoutThisAnnotation', }, ], })); @@ -298,7 +298,7 @@ Promise.resolve().then(console.log); errors: [ { line: 10, - messageId: 'unbound', + messageId: 'unboundWithoutThisAnnotation', }, ], }, @@ -310,7 +310,7 @@ const x = console.log; errors: [ { line: 3, - messageId: 'unbound', + messageId: 'unboundWithoutThisAnnotation', }, ], }, @@ -325,15 +325,15 @@ function foo(arg: ContainsMethods | null) { errors: [ { line: 20, - messageId: 'unbound', + messageId: 'unboundWithoutThisAnnotation', }, { line: 21, - messageId: 'unbound', + messageId: 'unboundWithoutThisAnnotation', }, { line: 22, - messageId: 'unbound', + messageId: 'unboundWithoutThisAnnotation', }, ], }, @@ -375,7 +375,7 @@ ContainsMethods.unboundStatic; errors: [ { line: 8, - messageId: 'unbound', + messageId: 'unboundWithoutThisAnnotation', }, ], }, @@ -390,7 +390,7 @@ const x = CommunicationError.prototype.foo; errors: [ { line: 5, - messageId: 'unbound', + messageId: 'unboundWithoutThisAnnotation', }, ], }, @@ -400,7 +400,7 @@ const x = CommunicationError.prototype.foo; errors: [ { line: 1, - messageId: 'unbound', + messageId: 'unboundWithoutThisAnnotation', }, ], }, @@ -419,7 +419,7 @@ instance.unbound = x; // THIS SHOULD NOT errors: [ { line: 9, - messageId: 'unbound', + messageId: 'unboundWithoutThisAnnotation', }, ], }, @@ -447,7 +447,7 @@ const { unbound } = new Foo(); errors: [ { line: 5, - messageId: 'unbound', + messageId: 'unboundWithoutThisAnnotation', }, ], }, @@ -476,7 +476,7 @@ let unbound; errors: [ { line: 6, - messageId: 'unbound', + messageId: 'unboundWithoutThisAnnotation', }, ], }, @@ -505,7 +505,7 @@ const { foo } = CommunicationError.prototype; errors: [ { line: 5, - messageId: 'unbound', + messageId: 'unboundWithoutThisAnnotation', }, ], }, @@ -520,7 +520,7 @@ let foo; errors: [ { line: 6, - messageId: 'unbound', + messageId: 'unboundWithoutThisAnnotation', }, ], }, @@ -532,7 +532,7 @@ const { log } = console; errors: [ { line: 3, - messageId: 'unbound', + messageId: 'unboundWithoutThisAnnotation', }, ], }, @@ -541,7 +541,7 @@ const { log } = console; errors: [ { line: 1, - messageId: 'unbound', + messageId: 'unboundWithoutThisAnnotation', }, ], }, @@ -562,7 +562,7 @@ class OtherClass extends BaseClass { { line: 8, column: 15, - messageId: 'unbound', + messageId: 'unboundWithoutThisAnnotation', }, ], }, @@ -584,7 +584,7 @@ class OtherClass extends BaseClass { { line: 9, column: 9, - messageId: 'unbound', + messageId: 'unboundWithoutThisAnnotation', }, ], }, diff --git a/packages/eslint-plugin/tests/util.test.ts b/packages/eslint-plugin/tests/util.test.ts index b98111d9a28a..9714ab5718c4 100644 --- a/packages/eslint-plugin/tests/util.test.ts +++ b/packages/eslint-plugin/tests/util.test.ts @@ -18,7 +18,7 @@ describe('isDefinitionFile', () => { ]; invalid.forEach(f => { - expect(util.isDefinitionFile(f)).toStrictEqual(false); + expect(util.isDefinitionFile(f)).toBe(false); }); }); @@ -26,13 +26,13 @@ describe('isDefinitionFile', () => { const valid = ['test.d.ts', 'test.d.tsx', 'test.D.TS', 'test.D.TSX']; valid.forEach(f => { - expect(util.isDefinitionFile(f)).toStrictEqual(true); + expect(util.isDefinitionFile(f)).toBe(true); }); }); }); describe('upperCaseFirst', () => { it('upper cases first', () => { - expect(util.upperCaseFirst('hello')).toStrictEqual('Hello'); + expect(util.upperCaseFirst('hello')).toBe('Hello'); }); }); diff --git a/packages/eslint-plugin/tests/util/getWrappingFixer.test.ts b/packages/eslint-plugin/tests/util/getWrappingFixer.test.ts new file mode 100644 index 000000000000..bcbb4c6d5fbb --- /dev/null +++ b/packages/eslint-plugin/tests/util/getWrappingFixer.test.ts @@ -0,0 +1,310 @@ +import { TSESTree } from '@typescript-eslint/experimental-utils'; +import { getFixturesRootDir, RuleTester } from '../RuleTester'; +import { createRule, getWrappingFixer } from '../../src/util'; + +const rule = createRule({ + name: 'void-everything', + defaultOptions: [], + meta: { + type: 'suggestion', + fixable: 'code', + docs: { + description: 'Add void operator in random places for test purposes.', + recommended: false, + }, + messages: { + addVoid: 'Please void this', + }, + schema: [], + }, + + create(context) { + const sourceCode = context.getSourceCode(); + + const report = (node: TSESTree.Node): void => { + context.report({ + node, + messageId: 'addVoid', + fix: getWrappingFixer({ + sourceCode, + node, + wrap: code => `void ${code}`, + }), + }); + }; + + return { + 'Identifier[name="wrapMe"]': report, + 'Literal[value="wrapMe"]': report, + 'ArrayExpression[elements.0.value="wrapArray"]': report, + 'ObjectExpression[properties.0.value.value="wrapObject"]': report, + 'FunctionExpression[id.name="wrapFunction"]': report, + 'ClassExpression[id.name="wrapClass"]': report, + }; + }, +}); + +const rootPath = getFixturesRootDir(); +const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', + parserOptions: { + tsconfigRootDir: rootPath, + project: './tsconfig.json', + }, +}); + +ruleTester.run('getWrappingFixer', rule, { + valid: [], + invalid: [ + // should add parens when inner expression might need them + { + code: '(function wrapFunction() {})', + errors: [{ messageId: 'addVoid' }], + output: '(void (function wrapFunction() {}))', + }, + { + code: '(class wrapClass {})', + errors: [{ messageId: 'addVoid' }], + output: '(void (class wrapClass {}))', + }, + + // shouldn't add inner parens when not necessary + { + code: 'wrapMe', + errors: [{ messageId: 'addVoid' }], + output: 'void wrapMe', + }, + { + code: '"wrapMe"', + errors: [{ messageId: 'addVoid' }], + output: 'void "wrapMe"', + }, + { + code: '["wrapArray"]', + errors: [{ messageId: 'addVoid' }], + output: 'void ["wrapArray"]', + }, + { + code: '({ x: "wrapObject" })', + errors: [{ messageId: 'addVoid' }], + output: '(void { x: "wrapObject" })', + }, + + // should add parens when the outer expression might need them + { + code: '!wrapMe', + errors: [{ messageId: 'addVoid' }], + output: '!(void wrapMe)', + }, + { + code: 'wrapMe++', + errors: [{ messageId: 'addVoid' }], + output: '(void wrapMe)++', + }, + { + code: '"wrapMe" + "dontWrap"', + errors: [{ messageId: 'addVoid' }], + output: '(void "wrapMe") + "dontWrap"', + }, + { + code: 'async () => await wrapMe', + errors: [{ messageId: 'addVoid' }], + output: 'async () => await (void wrapMe)', + }, + { + code: 'wrapMe(arg)', + errors: [{ messageId: 'addVoid' }], + output: '(void wrapMe)(arg)', + }, + { + code: 'new wrapMe(arg)', + errors: [{ messageId: 'addVoid' }], + output: 'new (void wrapMe)(arg)', + }, + { + code: 'wrapMe`arg`', + errors: [{ messageId: 'addVoid' }], + output: '(void wrapMe)`arg`', + }, + { + code: 'wrapMe.prop', + errors: [{ messageId: 'addVoid' }], + output: '(void wrapMe).prop', + }, + + // shouldn't add outer parens when not necessary + { + code: 'obj["wrapMe"]', + errors: [{ messageId: 'addVoid' }], + output: 'obj[void "wrapMe"]', + }, + { + code: 'fn(wrapMe)', + errors: [{ messageId: 'addVoid' }], + output: 'fn(void wrapMe)', + }, + { + code: 'new Cls(wrapMe)', + errors: [{ messageId: 'addVoid' }], + output: 'new Cls(void wrapMe)', + }, + { + code: '[wrapMe, ...wrapMe]', + errors: [{ messageId: 'addVoid' }, { messageId: 'addVoid' }], + output: '[void wrapMe, ...void wrapMe]', + }, + { + code: '`${wrapMe}`', + errors: [{ messageId: 'addVoid' }], + output: '`${void wrapMe}`', + }, + { + code: 'tpl`${wrapMe}`', + errors: [{ messageId: 'addVoid' }], + output: 'tpl`${void wrapMe}`', + }, + { + code: '({ ["wrapMe"]: wrapMe, ...wrapMe })', + errors: [ + { messageId: 'addVoid' }, + { messageId: 'addVoid' }, + { messageId: 'addVoid' }, + ], + output: '({ [void "wrapMe"]: void wrapMe, ...void wrapMe })', + }, + { + code: 'function fn() { return wrapMe }', + errors: [{ messageId: 'addVoid' }], + output: 'function fn() { return void wrapMe }', + }, + { + code: 'function* fn() { yield wrapMe }', + errors: [{ messageId: 'addVoid' }], + output: 'function* fn() { yield void wrapMe }', + }, + { + code: '() => wrapMe', + errors: [{ messageId: 'addVoid' }], + output: '() => void wrapMe', + }, + { + code: 'if (wrapMe) {}', + errors: [{ messageId: 'addVoid' }], + output: 'if (void wrapMe) {}', + }, + + // should detect parens at the beginning of a line and add a semi + { + code: ` + "dontWrap" + "wrapMe" + "!" + `, + errors: [{ messageId: 'addVoid' }], + output: ` + "dontWrap" + ;(void "wrapMe") + "!" + `, + }, + { + code: ` + dontWrap + wrapMe++ + `, + errors: [{ messageId: 'addVoid' }], + output: ` + dontWrap + ;(void wrapMe)++ + `, + }, + { + code: ` + dontWrap() + wrapMe() + `, + errors: [{ messageId: 'addVoid' }], + output: ` + dontWrap() + ;(void wrapMe)() + `, + }, + { + code: ` + dontWrap() + wrapMe\`\` + `, + errors: [{ messageId: 'addVoid' }], + output: ` + dontWrap() + ;(void wrapMe)\`\` + `, + }, + + // shouldn't add a semi when not necessary + { + code: ` + "dontWrap" + test() ? "wrapMe" : "dontWrap" + `, + errors: [{ messageId: 'addVoid' }], + output: ` + "dontWrap" + test() ? (void "wrapMe") : "dontWrap" + `, + }, + { + code: ` + "dontWrap"; + wrapMe && f() + `, + errors: [{ messageId: 'addVoid' }], + output: ` + "dontWrap"; + (void wrapMe) && f() + `, + }, + { + code: ` + new dontWrap + new wrapMe + `, + errors: [{ messageId: 'addVoid' }], + output: ` + new dontWrap + new (void wrapMe) + `, + }, + { + code: ` + wrapMe || f() + `, + errors: [{ messageId: 'addVoid' }], + output: ` + (void wrapMe) || f() + `, + }, + { + code: ` + if (true) wrapMe && f() + `, + errors: [{ messageId: 'addVoid' }], + output: ` + if (true) (void wrapMe) && f() + `, + }, + { + code: ` + dontWrap + if (true) { + wrapMe ?? f() + } + `, + errors: [{ messageId: 'addVoid' }], + output: ` + dontWrap + if (true) { + (void wrapMe) ?? f() + } + `, + }, + ], +}); diff --git a/packages/eslint-plugin/tests/util/isUnsafeAssignment.test.ts b/packages/eslint-plugin/tests/util/isUnsafeAssignment.test.ts index efe1fe9d1bad..1d4946a964de 100644 --- a/packages/eslint-plugin/tests/util/isUnsafeAssignment.test.ts +++ b/packages/eslint-plugin/tests/util/isUnsafeAssignment.test.ts @@ -8,9 +8,12 @@ import { isUnsafeAssignment } from '../../src/util/types'; describe('isUnsafeAssignment', () => { const rootDir = getFixturesRootDir(); - function getTypes( - code: string, - ): { sender: ts.Type; receiver: ts.Type; checker: ts.TypeChecker } { + function getTypes(code: string): { + sender: ts.Type; + senderNode: TSESTree.Node; + receiver: ts.Type; + checker: ts.TypeChecker; + } { const { ast, services } = parseForESLint(code, { project: './tsconfig.json', filePath: path.join(rootDir, 'file.ts'), @@ -28,6 +31,7 @@ describe('isUnsafeAssignment', () => { sender: checker.getTypeAtLocation( esTreeNodeToTSNodeMap.get(declarator.init!), ), + senderNode: declarator.init!, checker, }; } @@ -52,7 +56,7 @@ describe('isUnsafeAssignment', () => { ); expectTypesAre( - isUnsafeAssignment(sender, receiver, checker), + isUnsafeAssignment(sender, receiver, checker, null), checker, 'any', 'string', @@ -65,7 +69,7 @@ describe('isUnsafeAssignment', () => { ); expectTypesAre( - isUnsafeAssignment(sender, receiver, checker), + isUnsafeAssignment(sender, receiver, checker, null), checker, 'Set', 'Set', @@ -78,7 +82,7 @@ describe('isUnsafeAssignment', () => { ); expectTypesAre( - isUnsafeAssignment(sender, receiver, checker), + isUnsafeAssignment(sender, receiver, checker, null), checker, 'Map', 'Map', @@ -91,7 +95,7 @@ describe('isUnsafeAssignment', () => { ); expectTypesAre( - isUnsafeAssignment(sender, receiver, checker), + isUnsafeAssignment(sender, receiver, checker, null), checker, 'Set', 'Set', @@ -104,7 +108,7 @@ describe('isUnsafeAssignment', () => { ); expectTypesAre( - isUnsafeAssignment(sender, receiver, checker), + isUnsafeAssignment(sender, receiver, checker, null), checker, 'Set>>', 'Set>>', @@ -118,13 +122,13 @@ describe('isUnsafeAssignment', () => { 'const test: string = "";', ); - expect(isUnsafeAssignment(sender, receiver, checker)).toBeFalsy(); + expect(isUnsafeAssignment(sender, receiver, checker, null)).toBeFalsy(); }); it('non-any to a any', () => { const { sender, receiver, checker } = getTypes('const test: any = "";'); - expect(isUnsafeAssignment(sender, receiver, checker)).toBeFalsy(); + expect(isUnsafeAssignment(sender, receiver, checker, null)).toBeFalsy(); }); it('non-any in a generic position to a non-any', () => { @@ -132,7 +136,7 @@ describe('isUnsafeAssignment', () => { 'const test: Set = new Set();', ); - expect(isUnsafeAssignment(sender, receiver, checker)).toBeFalsy(); + expect(isUnsafeAssignment(sender, receiver, checker, null)).toBeFalsy(); }); it('non-any in a generic position to a non-any (multiple generics)', () => { @@ -140,7 +144,7 @@ describe('isUnsafeAssignment', () => { 'const test: Map = new Map();', ); - expect(isUnsafeAssignment(sender, receiver, checker)).toBeFalsy(); + expect(isUnsafeAssignment(sender, receiver, checker, null)).toBeFalsy(); }); it('non-any[] in a generic position to a non-any[]', () => { @@ -148,7 +152,7 @@ describe('isUnsafeAssignment', () => { 'const test: Set = new Set();', ); - expect(isUnsafeAssignment(sender, receiver, checker)).toBeFalsy(); + expect(isUnsafeAssignment(sender, receiver, checker, null)).toBeFalsy(); }); it('non-any in a generic position to a non-any (nested)', () => { @@ -156,7 +160,7 @@ describe('isUnsafeAssignment', () => { 'const test: Set>> = new Set>>();', ); - expect(isUnsafeAssignment(sender, receiver, checker)).toBeFalsy(); + expect(isUnsafeAssignment(sender, receiver, checker, null)).toBeFalsy(); }); it('non-any in a generic position to a any (nested)', () => { @@ -164,7 +168,7 @@ describe('isUnsafeAssignment', () => { 'const test: Set>> = new Set>>();', ); - expect(isUnsafeAssignment(sender, receiver, checker)).toBeFalsy(); + expect(isUnsafeAssignment(sender, receiver, checker, null)).toBeFalsy(); }); it('any to a unknown', () => { @@ -172,7 +176,7 @@ describe('isUnsafeAssignment', () => { 'const test: unknown = [] as any;', ); - expect(isUnsafeAssignment(sender, receiver, checker)).toBeFalsy(); + expect(isUnsafeAssignment(sender, receiver, checker, null)).toBeFalsy(); }); it('any[] in a generic position to a unknown[]', () => { @@ -180,7 +184,7 @@ describe('isUnsafeAssignment', () => { 'const test: unknown[] = [] as any[]', ); - expect(isUnsafeAssignment(sender, receiver, checker)).toBeFalsy(); + expect(isUnsafeAssignment(sender, receiver, checker, null)).toBeFalsy(); }); it('any in a generic position to a unknown (nested)', () => { @@ -188,7 +192,18 @@ describe('isUnsafeAssignment', () => { 'const test: Set>> = new Set>>();', ); - expect(isUnsafeAssignment(sender, receiver, checker)).toBeFalsy(); + expect(isUnsafeAssignment(sender, receiver, checker, null)).toBeFalsy(); + }); + + // https://github.com/typescript-eslint/typescript-eslint/issues/2109 + it('special cases the empty map constructor with no generics', () => { + const { sender, senderNode, receiver, checker } = getTypes( + 'const test: Map = new Map();', + ); + + expect( + isUnsafeAssignment(sender, receiver, checker, senderNode), + ).toBeFalsy(); }); }); }); diff --git a/packages/eslint-plugin/tests/util/misc.test.ts b/packages/eslint-plugin/tests/util/misc.test.ts new file mode 100644 index 000000000000..c4291f00d9f4 --- /dev/null +++ b/packages/eslint-plugin/tests/util/misc.test.ts @@ -0,0 +1,25 @@ +import * as misc from '../../src/util/misc'; + +describe('formatWordList', () => { + it('can format with no words', () => { + expect(misc.formatWordList([])).toBe(''); + }); + + it('can format with 1 word', () => { + expect(misc.formatWordList(['foo'])).toBe('foo'); + }); + + it('can format with 2 words', () => { + expect(misc.formatWordList(['foo', 'bar'])).toBe('foo and bar'); + }); + + it('can format with 3 words', () => { + expect(misc.formatWordList(['foo', 'bar', 'baz'])).toBe('foo, bar and baz'); + }); + + it('can format with 4 words', () => { + expect(misc.formatWordList(['foo', 'bar', 'baz', 'boz'])).toBe( + 'foo, bar, baz and boz', + ); + }); +}); diff --git a/packages/eslint-plugin/tools/generate-configs.ts b/packages/eslint-plugin/tools/generate-configs.ts index e78808aa4b1d..ed84f286496b 100644 --- a/packages/eslint-plugin/tools/generate-configs.ts +++ b/packages/eslint-plugin/tools/generate-configs.ts @@ -49,10 +49,8 @@ const BASE_RULES_TO_BE_OVERRIDDEN = new Map( ); const EXTENDS = ['./configs/base', './configs/eslint-recommended']; -const ruleEntries: [ - string, - TSESLint.RuleModule, -][] = Object.entries(rules).sort((a, b) => a[0].localeCompare(b[0])); +const ruleEntries: [string, TSESLint.RuleModule][] = + Object.entries(rules).sort((a, b) => a[0].localeCompare(b[0])); /** * Helper function reduces records to key - value pairs. diff --git a/packages/eslint-plugin/tools/generate-rules-lists.ts b/packages/eslint-plugin/tools/generate-rules-lists.ts index cffe400692c8..a4d3f3af8e72 100644 --- a/packages/eslint-plugin/tools/generate-rules-lists.ts +++ b/packages/eslint-plugin/tools/generate-rules-lists.ts @@ -19,13 +19,13 @@ interface RuleDetails { type RuleColumn = [ string, string, - ':heavy_check_mark:' | '', + ':white_check_mark:' | '', ':wrench:' | '', ':thought_balloon:' | '', ]; const emojiKey = { - recommended: ':heavy_check_mark:', + recommended: ':white_check_mark:', fixable: ':wrench:', requiresTypeChecking: ':thought_balloon:', } as const; @@ -43,7 +43,7 @@ const staticElements = { emojiKey.fixable, emojiKey.requiresTypeChecking, ], - listSpacerRow: Array(5).fill('-'), + listSpacerRow: Array(5).fill('-'), }; const returnEmojiIfTrue = ( diff --git a/packages/eslint-plugin/tsconfig.json b/packages/eslint-plugin/tsconfig.json index a0cdad048692..c7e9c4ecb2b7 100644 --- a/packages/eslint-plugin/tsconfig.json +++ b/packages/eslint-plugin/tsconfig.json @@ -4,7 +4,7 @@ "composite": false, "rootDir": "." }, - "include": ["src", "typings", "tests", "tools"], + "include": ["src", "typings", "tests", "tools", "index.d.ts"], "references": [ { "path": "../experimental-utils/tsconfig.build.json" }, { "path": "../parser/tsconfig.build.json" }, diff --git a/packages/eslint-plugin/typings/eslint-rules.d.ts b/packages/eslint-plugin/typings/eslint-rules.d.ts index 425956e1f256..44b679281fbd 100644 --- a/packages/eslint-plugin/typings/eslint-rules.d.ts +++ b/packages/eslint-plugin/typings/eslint-rules.d.ts @@ -230,7 +230,12 @@ declare module 'eslint/lib/rules/no-dupe-class-members' { Program(): void; ClassBody(): void; 'ClassBody:exit'(): void; - MethodDefinition(node: TSESTree.MethodDefinition): void; + // for ESLint <= v7 + MethodDefinition?: (node: TSESTree.MethodDefinition) => void; + // for ESLint v8 + 'MethodDefinition, PropertyDefinition'?: ( + node: TSESTree.MethodDefinition | TSESTree.PropertyDefinition, + ) => void; } >; export = rule; @@ -520,11 +525,11 @@ declare module 'eslint/lib/rules/no-extra-parens' { ClassExpression(node: TSESTree.ClassExpression): void; ConditionalExpression(node: TSESTree.ConditionalExpression): void; DoWhileStatement(node: TSESTree.DoWhileStatement): void; - // eslint < 7.19.0 + // -- eslint < 7.19.0 'ForInStatement, ForOfStatement'( node: TSESTree.ForInStatement | TSESTree.ForOfStatement, ): void; - // eslint >= 7.19.0 + // -- eslint >= 7.19.0 ForInStatement(node: TSESTree.ForInStatement): void; ForOfStatement(node: TSESTree.ForOfStatement): void; ForStatement(node: TSESTree.ForStatement): void; @@ -637,7 +642,12 @@ declare module 'eslint/lib/rules/no-extra-semi' { { EmptyStatement(node: TSESTree.EmptyStatement): void; ClassBody(node: TSESTree.ClassBody): void; - MethodDefinition(node: TSESTree.MethodDefinition): void; + // for ESLint <= v7 + MethodDefinition?: (node: TSESTree.MethodDefinition) => void; + // for ESLint v8 + 'MethodDefinition, PropertyDefinition'?: ( + node: TSESTree.MethodDefinition | TSESTree.PropertyDefinition, + ) => void; } >; export = rule; @@ -713,6 +723,7 @@ declare module 'eslint/lib/rules/dot-notation' { allowPattern?: string; allowPrivateClassPropertyAccess?: boolean; allowProtectedClassPropertyAccess?: boolean; + allowIndexSignaturePropertyAccess?: boolean; }, ], { @@ -859,3 +870,51 @@ declare module 'eslint/lib/rules/object-curly-spacing' { >; export = rule; } + +declare module 'eslint/lib/rules/no-restricted-imports' { + import { TSESLint, TSESTree } from '@typescript-eslint/experimental-utils'; + + namespace rule { + export type ArrayOfStringOrObject = ( + | string + | { + name: string; + message?: string; + importNames?: string[]; + // extended + allowTypeImports?: boolean; + } + )[]; + export type ArrayOfStringOrObjectPatterns = + | string[] + | { + group: string[]; + message?: string; + // extended + allowTypeImports?: boolean; + }[]; + } + + interface ObjectOfPathsAndPatterns { + paths?: rule.ArrayOfStringOrObject; + patterns?: rule.ArrayOfStringOrObjectPatterns; + } + + const rule: TSESLint.RuleModule< + | 'path' + | 'pathWithCustomMessage' + | 'patterns' + | 'patternWithCustomMessage' + | 'everything' + | 'everythingWithCustomMessage' + | 'importName' + | 'importNameWithCustomMessage', + rule.ArrayOfStringOrObject | [ObjectOfPathsAndPatterns], + { + ImportDeclaration(node: TSESTree.ImportDeclaration): void; + ExportNamedDeclaration(node: TSESTree.ExportNamedDeclaration): void; + ExportAllDeclaration(node: TSESTree.ExportAllDeclaration): void; + } + >; + export = rule; +} diff --git a/packages/experimental-utils/CHANGELOG.md b/packages/experimental-utils/CHANGELOG.md index 2776535130f6..a34dfcce822b 100644 --- a/packages/experimental-utils/CHANGELOG.md +++ b/packages/experimental-utils/CHANGELOG.md @@ -3,6 +3,349 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [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 diff --git a/packages/experimental-utils/jest.config.js b/packages/experimental-utils/jest.config.js index cce8d6c61baf..bf4e270e3760 100644 --- a/packages/experimental-utils/jest.config.js +++ b/packages/experimental-utils/jest.config.js @@ -3,6 +3,7 @@ // @ts-check /** @type {import('@jest/types').Config.InitialOptions} */ module.exports = { + resolver: '/../../tests/jest-resolver.js', globals: { 'ts-jest': { isolatedModules: true, diff --git a/packages/experimental-utils/package.json b/packages/experimental-utils/package.json index cb9baec6ed67..32fdeffd18ff 100644 --- a/packages/experimental-utils/package.json +++ b/packages/experimental-utils/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/experimental-utils", - "version": "4.16.1", + "version": "5.3.0", "description": "(Experimental) Utilities for working with TypeScript + ESLint together", "keywords": [ "eslint", @@ -8,7 +8,7 @@ "estree" ], "engines": { - "node": "^10.12.0 || >=12.0.0" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "files": [ "dist", @@ -32,19 +32,19 @@ "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", + "postclean": "rimraf dist && rimraf _ts3.4 && rimraf coverage", "format": "prettier --write \"./**/*.{ts,js,json,md}\" --ignore-path ../../.prettierignore", "lint": "eslint . --ext .js,.ts --ignore-path='../../.eslintignore'", "test": "jest --coverage", "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@types/json-schema": "^7.0.3", - "@typescript-eslint/scope-manager": "4.16.1", - "@typescript-eslint/types": "4.16.1", - "@typescript-eslint/typescript-estree": "4.16.1", - "eslint-scope": "^5.0.0", - "eslint-utils": "^2.0.0" + "@types/json-schema": "^7.0.9", + "@typescript-eslint/scope-manager": "5.3.0", + "@typescript-eslint/types": "5.3.0", + "@typescript-eslint/typescript-estree": "5.3.0", + "eslint-scope": "^5.1.1", + "eslint-utils": "^3.0.0" }, "peerDependencies": { "eslint": "*" diff --git a/packages/experimental-utils/project.json b/packages/experimental-utils/project.json new file mode 100644 index 000000000000..f8bd9117eeae --- /dev/null +++ b/packages/experimental-utils/project.json @@ -0,0 +1,5 @@ +{ + "root": "packages/experimental-utils", + "type": "library", + "implicitDependencies": [] +} diff --git a/packages/experimental-utils/src/ast-utils/eslint-utils/ReferenceTracker.ts b/packages/experimental-utils/src/ast-utils/eslint-utils/ReferenceTracker.ts index 2298ac1fb1b2..40e5fa7c1793 100644 --- a/packages/experimental-utils/src/ast-utils/eslint-utils/ReferenceTracker.ts +++ b/packages/experimental-utils/src/ast-utils/eslint-utils/ReferenceTracker.ts @@ -1,5 +1,4 @@ /* eslint-disable @typescript-eslint/no-namespace */ - import * as eslintUtils from 'eslint-utils'; import { TSESTree } from '../../ts-estree'; import * as TSESLint from '../../ts-eslint'; @@ -8,6 +7,7 @@ const ReferenceTrackerREAD: unique symbol = eslintUtils.ReferenceTracker.READ; const ReferenceTrackerCALL: unique symbol = eslintUtils.ReferenceTracker.CALL; const ReferenceTrackerCONSTRUCT: unique symbol = eslintUtils.ReferenceTracker.CONSTRUCT; +const ReferenceTrackerESM: unique symbol = eslintUtils.ReferenceTracker.ESM; interface ReferenceTracker { /** @@ -49,23 +49,25 @@ 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?: 'strict' | 'legacy'; /** * The name list of Global Object. Optional. Default is `["global", "globalThis", "self", "window"]`. */ - globalObjectNames: readonly string[]; + globalObjectNames?: readonly string[]; }, ): ReferenceTracker; readonly READ: typeof ReferenceTrackerREAD; readonly CALL: typeof ReferenceTrackerCALL; readonly CONSTRUCT: typeof ReferenceTrackerCONSTRUCT; + readonly ESM: typeof ReferenceTrackerESM; } namespace ReferenceTracker { export type READ = ReferenceTrackerStatic['READ']; export type CALL = ReferenceTrackerStatic['CALL']; export type CONSTRUCT = ReferenceTrackerStatic['CONSTRUCT']; + export type ESM = ReferenceTrackerStatic['ESM']; export type ReferenceType = READ | CALL | CONSTRUCT; // eslint-disable-next-line @typescript-eslint/no-explicit-any export type TraceMap = Record>; @@ -73,6 +75,7 @@ namespace ReferenceTracker { [ReferenceTrackerREAD]?: T; [ReferenceTrackerCALL]?: T; [ReferenceTrackerCONSTRUCT]?: T; + [ReferenceTrackerESM]?: true; [key: string]: TraceMapElement; } // eslint-disable-next-line @typescript-eslint/no-explicit-any diff --git a/packages/experimental-utils/src/ast-utils/eslint-utils/astUtilities.ts b/packages/experimental-utils/src/ast-utils/eslint-utils/astUtilities.ts index a7db43689a7b..8666ba8704de 100644 --- a/packages/experimental-utils/src/ast-utils/eslint-utils/astUtilities.ts +++ b/packages/experimental-utils/src/ast-utils/eslint-utils/astUtilities.ts @@ -1,6 +1,6 @@ import * as eslintUtils from 'eslint-utils'; -import { TSESTree } from '../../ts-estree'; import * as TSESLint from '../../ts-eslint'; +import { TSESTree } from '../../ts-estree'; /** * Get the proper location of a given function node to report. @@ -101,19 +101,23 @@ const hasSideEffect = eslintUtils.hasSideEffect as ( }, ) => boolean; -/** - * Check whether a given node is parenthesized or not. - * This function detects it correctly even if it's parenthesized by specific syntax. - * - * @see {@link https://eslint-utils.mysticatea.dev/api/ast-utils.html#isparenthesized} - * @returns `true` if the node is parenthesized. - * If `times` was given, it returns `true` only if the node is parenthesized the `times` times. - * For example, `isParenthesized(2, node, sourceCode)` returns true for `((foo))`, but not for `(foo)`. - */ -const isParenthesized = eslintUtils.isParenthesized as ( - node: TSESTree.Node, - sourceCode: TSESLint.SourceCode, -) => boolean; +const isParenthesized = eslintUtils.isParenthesized as { + /** + * Check whether a given node is parenthesized or not. + * This function detects it correctly even if it's parenthesized by specific syntax. + * + * @see {@link https://eslint-utils.mysticatea.dev/api/ast-utils.html#isparenthesized} + * @returns `true` if the node is parenthesized. + * If `times` was given, it returns `true` only if the node is parenthesized the `times` times. + * For example, `isParenthesized(2, node, sourceCode)` returns true for `((foo))`, but not for `(foo)`. + */ + (node: TSESTree.Node, sourceCode: TSESLint.SourceCode): boolean; + ( + times: number, + node: TSESTree.Node, + sourceCode: TSESLint.SourceCode, + ): boolean; +}; export { getFunctionHeadLocation, diff --git a/packages/experimental-utils/src/ast-utils/eslint-utils/predicates.ts b/packages/experimental-utils/src/ast-utils/eslint-utils/predicates.ts index cbf8377127c6..ad89e4730fcc 100644 --- a/packages/experimental-utils/src/ast-utils/eslint-utils/predicates.ts +++ b/packages/experimental-utils/src/ast-utils/eslint-utils/predicates.ts @@ -1,84 +1,75 @@ import * as eslintUtils from 'eslint-utils'; import { TSESTree } from '../../ts-estree'; -const isArrowToken = eslintUtils.isArrowToken as ( - token: TSESTree.Token | TSESTree.Comment, -) => token is TSESTree.PunctuatorToken & { value: '=>' }; -const isNotArrowToken = eslintUtils.isNotArrowToken as ( - token: TSESTree.Token | TSESTree.Comment, -) => boolean; +type IsSpecificTokenFunction = ( + token: TSESTree.Token, +) => token is SpecificToken; -const isClosingBraceToken = eslintUtils.isClosingBraceToken as ( - token: TSESTree.Token | TSESTree.Comment, -) => token is TSESTree.PunctuatorToken & { value: '}' }; -const isNotClosingBraceToken = eslintUtils.isNotClosingBraceToken as ( - token: TSESTree.Token | TSESTree.Comment, -) => boolean; +type IsNotSpecificTokenFunction = ( + token: TSESTree.Token, +) => token is Exclude; -const isClosingBracketToken = eslintUtils.isClosingBracketToken as ( - token: TSESTree.Token | TSESTree.Comment, -) => token is TSESTree.PunctuatorToken & { value: ']' }; -const isNotClosingBracketToken = eslintUtils.isNotClosingBracketToken as ( - token: TSESTree.Token | TSESTree.Comment, -) => boolean; +type PunctuatorTokenWithValue = + TSESTree.PunctuatorToken & { value: Value }; +type IsPunctuatorTokenWithValueFunction = + IsSpecificTokenFunction>; +type IsNotPunctuatorTokenWithValueFunction = + IsNotSpecificTokenFunction>; -const isClosingParenToken = eslintUtils.isClosingParenToken as ( - token: TSESTree.Token | TSESTree.Comment, -) => token is TSESTree.PunctuatorToken & { value: ')' }; -const isNotClosingParenToken = eslintUtils.isNotClosingParenToken as ( - token: TSESTree.Token | TSESTree.Comment, -) => boolean; +const isArrowToken = + eslintUtils.isArrowToken as IsPunctuatorTokenWithValueFunction<'=>'>; +const isNotArrowToken = + eslintUtils.isNotArrowToken as IsNotPunctuatorTokenWithValueFunction<'=>'>; -const isColonToken = eslintUtils.isColonToken as ( - token: TSESTree.Token | TSESTree.Comment, -) => token is TSESTree.PunctuatorToken & { value: ':' }; -const isNotColonToken = eslintUtils.isNotColonToken as ( - token: TSESTree.Token | TSESTree.Comment, -) => boolean; +const isClosingBraceToken = + eslintUtils.isClosingBraceToken as IsPunctuatorTokenWithValueFunction<'}'>; +const isNotClosingBraceToken = + eslintUtils.isNotClosingBraceToken as IsNotPunctuatorTokenWithValueFunction<'}'>; -const isCommaToken = eslintUtils.isCommaToken as ( - token: TSESTree.Token | TSESTree.Comment, -) => token is TSESTree.PunctuatorToken & { value: ',' }; -const isNotCommaToken = eslintUtils.isNotCommaToken as ( - token: TSESTree.Token | TSESTree.Comment, -) => boolean; +const isClosingBracketToken = + eslintUtils.isClosingBracketToken as IsPunctuatorTokenWithValueFunction<']'>; +const isNotClosingBracketToken = + eslintUtils.isNotClosingBracketToken as IsNotPunctuatorTokenWithValueFunction<']'>; -const isCommentToken = eslintUtils.isCommentToken as ( - token: TSESTree.Token | TSESTree.Comment, -) => token is TSESTree.Comment; -const isNotCommentToken = eslintUtils.isNotCommentToken as < - T extends TSESTree.Token | TSESTree.Comment ->( - token: T, -) => token is Exclude; +const isClosingParenToken = + eslintUtils.isClosingParenToken as IsPunctuatorTokenWithValueFunction<')'>; +const isNotClosingParenToken = + eslintUtils.isNotClosingParenToken as IsNotPunctuatorTokenWithValueFunction<')'>; -const isOpeningBraceToken = eslintUtils.isOpeningBraceToken as ( - token: TSESTree.Token | TSESTree.Comment, -) => token is TSESTree.PunctuatorToken & { value: '{' }; -const isNotOpeningBraceToken = eslintUtils.isNotOpeningBraceToken as ( - token: TSESTree.Token | TSESTree.Comment, -) => boolean; +const isColonToken = + eslintUtils.isColonToken as IsPunctuatorTokenWithValueFunction<':'>; +const isNotColonToken = + eslintUtils.isNotColonToken as IsNotPunctuatorTokenWithValueFunction<':'>; -const isOpeningBracketToken = eslintUtils.isOpeningBracketToken as ( - token: TSESTree.Token | TSESTree.Comment, -) => token is TSESTree.PunctuatorToken & { value: '[' }; -const isNotOpeningBracketToken = eslintUtils.isNotOpeningBracketToken as ( - token: TSESTree.Token | TSESTree.Comment, -) => boolean; +const isCommaToken = + eslintUtils.isCommaToken as IsPunctuatorTokenWithValueFunction<','>; +const isNotCommaToken = + eslintUtils.isNotCommaToken as IsNotPunctuatorTokenWithValueFunction<','>; -const isOpeningParenToken = eslintUtils.isOpeningParenToken as ( - token: TSESTree.Token | TSESTree.Comment, -) => token is TSESTree.PunctuatorToken & { value: '(' }; -const isNotOpeningParenToken = eslintUtils.isNotOpeningParenToken as ( - token: TSESTree.Token | TSESTree.Comment, -) => boolean; +const isCommentToken = + eslintUtils.isCommentToken as IsSpecificTokenFunction; +const isNotCommentToken = + eslintUtils.isNotCommentToken as IsNotSpecificTokenFunction; -const isSemicolonToken = eslintUtils.isSemicolonToken as ( - token: TSESTree.Token | TSESTree.Comment, -) => token is TSESTree.PunctuatorToken & { value: ';' }; -const isNotSemicolonToken = eslintUtils.isNotSemicolonToken as ( - token: TSESTree.Token | TSESTree.Comment, -) => boolean; +const isOpeningBraceToken = + eslintUtils.isOpeningBraceToken as IsPunctuatorTokenWithValueFunction<'{'>; +const isNotOpeningBraceToken = + eslintUtils.isNotOpeningBraceToken as IsNotPunctuatorTokenWithValueFunction<'{'>; + +const isOpeningBracketToken = + eslintUtils.isOpeningBracketToken as IsPunctuatorTokenWithValueFunction<'['>; +const isNotOpeningBracketToken = + eslintUtils.isNotOpeningBracketToken as IsNotPunctuatorTokenWithValueFunction<'['>; + +const isOpeningParenToken = + eslintUtils.isOpeningParenToken as IsPunctuatorTokenWithValueFunction<'('>; +const isNotOpeningParenToken = + eslintUtils.isNotOpeningParenToken as IsNotPunctuatorTokenWithValueFunction<'('>; + +const isSemicolonToken = + eslintUtils.isSemicolonToken as IsPunctuatorTokenWithValueFunction<';'>; +const isNotSemicolonToken = + eslintUtils.isNotSemicolonToken as IsNotPunctuatorTokenWithValueFunction<';'>; export { isArrowToken, diff --git a/packages/experimental-utils/src/ast-utils/eslint-utils/scopeAnalysis.ts b/packages/experimental-utils/src/ast-utils/eslint-utils/scopeAnalysis.ts index 15f9325a582f..fa3efc70a772 100644 --- a/packages/experimental-utils/src/ast-utils/eslint-utils/scopeAnalysis.ts +++ b/packages/experimental-utils/src/ast-utils/eslint-utils/scopeAnalysis.ts @@ -9,7 +9,7 @@ import * as TSESLint from '../../ts-eslint'; */ const findVariable = eslintUtils.findVariable as ( initialScope: TSESLint.Scope.Scope, - name: string, + nameOrNode: string | TSESTree.Identifier, ) => TSESLint.Scope.Variable | null; /** diff --git a/packages/experimental-utils/src/ast-utils/helpers.ts b/packages/experimental-utils/src/ast-utils/helpers.ts new file mode 100644 index 000000000000..f2a4ac2e2442 --- /dev/null +++ b/packages/experimental-utils/src/ast-utils/helpers.ts @@ -0,0 +1,58 @@ +import { AST_NODE_TYPES, AST_TOKEN_TYPES, TSESTree } from '../ts-estree'; + +type ObjectEntry = [keyof BaseType, BaseType[keyof BaseType]]; +type ObjectEntries = Array>; + +export const isNodeOfType = + (nodeType: NodeType) => + ( + node: TSESTree.Node | null | undefined, + ): node is TSESTree.Node & { type: NodeType } => + node?.type === nodeType; + +export const isNodeOfTypes = + (nodeTypes: NodeTypes) => + ( + node: TSESTree.Node | null | undefined, + ): node is TSESTree.Node & { type: NodeTypes[number] } => + !!node && nodeTypes.includes(node.type); + +export const isNodeOfTypeWithConditions = < + NodeType extends AST_NODE_TYPES, + Conditions extends Partial, +>( + nodeType: NodeType, + conditions: Conditions, +): (( + node: TSESTree.Node | null | undefined, +) => node is TSESTree.Node & { type: NodeType } & Conditions) => { + const entries = Object.entries(conditions) as ObjectEntries< + TSESTree.Node & { type: NodeType } + >; + + return ( + node: TSESTree.Node | null | undefined, + ): node is TSESTree.Node & { type: NodeType } & Conditions => + node?.type === nodeType && + entries.every(([key, value]) => node[key] === value); +}; + +export const isTokenOfTypeWithConditions = < + TokenType extends AST_TOKEN_TYPES, + Conditions extends Partial, +>( + tokenType: TokenType, + conditions: Conditions, +): (( + token: TSESTree.Token | null | undefined, +) => token is TSESTree.Token & { type: TokenType } & Conditions) => { + const entries = Object.entries(conditions) as ObjectEntries< + TSESTree.Token & { type: TokenType } + >; + + return ( + token: TSESTree.Token | null | undefined, + ): token is TSESTree.Token & { type: TokenType } & Conditions => + token?.type === tokenType && + entries.every(([key, value]) => token[key] === value); +}; diff --git a/packages/experimental-utils/src/ast-utils/misc.ts b/packages/experimental-utils/src/ast-utils/misc.ts index cf20f99a4cc4..923424d9f928 100644 --- a/packages/experimental-utils/src/ast-utils/misc.ts +++ b/packages/experimental-utils/src/ast-utils/misc.ts @@ -6,8 +6,8 @@ const LINEBREAK_MATCHER = /\r\n|[\r\n\u2028\u2029]/; * Determines whether two adjacent tokens are on the same line */ function isTokenOnSameLine( - left: TSESTree.Token | TSESTree.Comment, - right: TSESTree.Token | TSESTree.Comment, + left: TSESTree.Token, + right: TSESTree.Token, ): boolean { return left.loc.end.line === right.loc.start.line; } diff --git a/packages/experimental-utils/src/ast-utils/predicates.ts b/packages/experimental-utils/src/ast-utils/predicates.ts index bf62a6f77cb2..0038f092bbe0 100644 --- a/packages/experimental-utils/src/ast-utils/predicates.ts +++ b/packages/experimental-utils/src/ast-utils/predicates.ts @@ -1,51 +1,54 @@ import { AST_NODE_TYPES, AST_TOKEN_TYPES, TSESTree } from '../ts-estree'; -function isOptionalChainPunctuator( - token: TSESTree.Token | TSESTree.Comment, -): token is TSESTree.PunctuatorToken & { value: '?.' } { - return token.type === AST_TOKEN_TYPES.Punctuator && token.value === '?.'; -} +import { + isNodeOfType, + isNodeOfTypes, + isNodeOfTypeWithConditions, + isTokenOfTypeWithConditions, +} from './helpers'; + +const isOptionalChainPunctuator = isTokenOfTypeWithConditions( + AST_TOKEN_TYPES.Punctuator, + { value: '?.' }, +); + function isNotOptionalChainPunctuator( - token: TSESTree.Token | TSESTree.Comment, -): boolean { + token: TSESTree.Token, +): token is Exclude< + TSESTree.Token, + TSESTree.PunctuatorToken & { value: '?.' } +> { return !isOptionalChainPunctuator(token); } -function isNonNullAssertionPunctuator( - token: TSESTree.Token | TSESTree.Comment, -): token is TSESTree.PunctuatorToken & { value: '!' } { - return token.type === AST_TOKEN_TYPES.Punctuator && token.value === '!'; -} +const isNonNullAssertionPunctuator = isTokenOfTypeWithConditions( + AST_TOKEN_TYPES.Punctuator, + { value: '!' }, +); + function isNotNonNullAssertionPunctuator( - token: TSESTree.Token | TSESTree.Comment, -): boolean { + token: TSESTree.Token, +): token is Exclude { return !isNonNullAssertionPunctuator(token); } /** * Returns true if and only if the node represents: foo?.() or foo.bar?.() */ -function isOptionalCallExpression( - node: TSESTree.Node, -): node is TSESTree.CallExpression & { optional: true } { - return ( - node.type === AST_NODE_TYPES.CallExpression && - // this flag means the call expression itself is option - // i.e. it is foo.bar?.() and not foo?.bar() - node.optional - ); -} +const isOptionalCallExpression = isNodeOfTypeWithConditions( + AST_NODE_TYPES.CallExpression, + // this flag means the call expression itself is option + // i.e. it is foo.bar?.() and not foo?.bar() + { optional: true }, +); /** * Returns true if and only if the node represents logical OR */ -function isLogicalOrOperator( - node: TSESTree.Node, -): node is TSESTree.LogicalExpression & { operator: '||' } { - return ( - node.type === AST_NODE_TYPES.LogicalExpression && node.operator === '||' - ); -} +const isLogicalOrOperator = isNodeOfTypeWithConditions( + AST_NODE_TYPES.LogicalExpression, + { operator: '||' }, +); /** * Checks if a node is a type assertion: @@ -54,134 +57,70 @@ function isLogicalOrOperator( * x * ``` */ -function isTypeAssertion( - node: TSESTree.Node | undefined | null, -): node is TSESTree.TSAsExpression | TSESTree.TSTypeAssertion { - if (!node) { - return false; - } - return ( - node.type === AST_NODE_TYPES.TSAsExpression || - node.type === AST_NODE_TYPES.TSTypeAssertion - ); -} - -function isVariableDeclarator( - node: TSESTree.Node | undefined, -): node is TSESTree.VariableDeclarator { - return node?.type === AST_NODE_TYPES.VariableDeclarator; -} - -function isFunction( - node: TSESTree.Node | undefined, -): node is - | TSESTree.ArrowFunctionExpression - | TSESTree.FunctionDeclaration - | TSESTree.FunctionExpression { - if (!node) { - return false; - } - - return [ - AST_NODE_TYPES.ArrowFunctionExpression, - AST_NODE_TYPES.FunctionDeclaration, - AST_NODE_TYPES.FunctionExpression, - ].includes(node.type); -} - -function isFunctionType( - node: TSESTree.Node | undefined, -): node is - | TSESTree.TSCallSignatureDeclaration - | TSESTree.TSConstructorType - | TSESTree.TSConstructSignatureDeclaration - | TSESTree.TSEmptyBodyFunctionExpression - | TSESTree.TSFunctionType - | TSESTree.TSMethodSignature { - if (!node) { - return false; - } - - return [ - AST_NODE_TYPES.TSCallSignatureDeclaration, - AST_NODE_TYPES.TSConstructorType, - AST_NODE_TYPES.TSConstructSignatureDeclaration, - AST_NODE_TYPES.TSEmptyBodyFunctionExpression, - AST_NODE_TYPES.TSFunctionType, - AST_NODE_TYPES.TSMethodSignature, - ].includes(node.type); -} - -function isFunctionOrFunctionType( - node: TSESTree.Node | undefined, -): node is - | TSESTree.ArrowFunctionExpression - | TSESTree.FunctionDeclaration - | TSESTree.FunctionExpression - | TSESTree.TSCallSignatureDeclaration - | TSESTree.TSConstructorType - | TSESTree.TSConstructSignatureDeclaration - | TSESTree.TSEmptyBodyFunctionExpression - | TSESTree.TSFunctionType - | TSESTree.TSMethodSignature { - return isFunction(node) || isFunctionType(node); -} - -function isTSFunctionType( - node: TSESTree.Node | undefined, -): node is TSESTree.TSFunctionType { - return node?.type === AST_NODE_TYPES.TSFunctionType; -} - -function isTSConstructorType( - node: TSESTree.Node | undefined, -): node is TSESTree.TSConstructorType { - return node?.type === AST_NODE_TYPES.TSConstructorType; -} - -function isClassOrTypeElement( - node: TSESTree.Node | undefined, -): node is TSESTree.ClassElement | TSESTree.TypeElement { - if (!node) { - return false; - } - - return [ - // ClassElement - AST_NODE_TYPES.ClassProperty, - AST_NODE_TYPES.FunctionExpression, - AST_NODE_TYPES.MethodDefinition, - AST_NODE_TYPES.TSAbstractClassProperty, - AST_NODE_TYPES.TSAbstractMethodDefinition, - AST_NODE_TYPES.TSEmptyBodyFunctionExpression, - AST_NODE_TYPES.TSIndexSignature, - // TypeElement - AST_NODE_TYPES.TSCallSignatureDeclaration, - AST_NODE_TYPES.TSConstructSignatureDeclaration, - // AST_NODE_TYPES.TSIndexSignature, - AST_NODE_TYPES.TSMethodSignature, - AST_NODE_TYPES.TSPropertySignature, - ].includes(node.type); -} +const isTypeAssertion = isNodeOfTypes([ + AST_NODE_TYPES.TSAsExpression, + AST_NODE_TYPES.TSTypeAssertion, +] as const); + +const isVariableDeclarator = isNodeOfType(AST_NODE_TYPES.VariableDeclarator); + +const functionTypes = [ + AST_NODE_TYPES.ArrowFunctionExpression, + AST_NODE_TYPES.FunctionDeclaration, + AST_NODE_TYPES.FunctionExpression, +] as const; +const isFunction = isNodeOfTypes(functionTypes); + +const functionTypeTypes = [ + AST_NODE_TYPES.TSCallSignatureDeclaration, + AST_NODE_TYPES.TSConstructorType, + AST_NODE_TYPES.TSConstructSignatureDeclaration, + AST_NODE_TYPES.TSEmptyBodyFunctionExpression, + AST_NODE_TYPES.TSFunctionType, + AST_NODE_TYPES.TSMethodSignature, +] as const; +const isFunctionType = isNodeOfTypes(functionTypeTypes); + +const isFunctionOrFunctionType = isNodeOfTypes([ + ...functionTypes, + ...functionTypeTypes, +] as const); + +const isTSFunctionType = isNodeOfType(AST_NODE_TYPES.TSFunctionType); + +const isTSConstructorType = isNodeOfType(AST_NODE_TYPES.TSConstructorType); + +const isClassOrTypeElement = isNodeOfTypes([ + // ClassElement + AST_NODE_TYPES.PropertyDefinition, + AST_NODE_TYPES.FunctionExpression, + AST_NODE_TYPES.MethodDefinition, + AST_NODE_TYPES.TSAbstractPropertyDefinition, + AST_NODE_TYPES.TSAbstractMethodDefinition, + AST_NODE_TYPES.TSEmptyBodyFunctionExpression, + AST_NODE_TYPES.TSIndexSignature, + // TypeElement + AST_NODE_TYPES.TSCallSignatureDeclaration, + AST_NODE_TYPES.TSConstructSignatureDeclaration, + // AST_NODE_TYPES.TSIndexSignature, + AST_NODE_TYPES.TSMethodSignature, + AST_NODE_TYPES.TSPropertySignature, +] as const); /** * Checks if a node is a constructor method. */ -function isConstructor( - node: TSESTree.Node | undefined, -): node is TSESTree.MethodDefinition { - return ( - node?.type === AST_NODE_TYPES.MethodDefinition && - node.kind === 'constructor' - ); -} +const isConstructor = isNodeOfTypeWithConditions( + AST_NODE_TYPES.MethodDefinition, + { kind: 'constructor' }, +); /** * Checks if a node is a setter method. */ function isSetter( node: TSESTree.Node | undefined, -): node is TSESTree.MethodDefinition | TSESTree.Property { +): node is (TSESTree.MethodDefinition | TSESTree.Property) & { kind: 'set' } { return ( !!node && (node.type === AST_NODE_TYPES.MethodDefinition || @@ -190,50 +129,27 @@ function isSetter( ); } -function isIdentifier( - node: TSESTree.Node | undefined, -): node is TSESTree.Identifier { - return node?.type === AST_NODE_TYPES.Identifier; -} +const isIdentifier = isNodeOfType(AST_NODE_TYPES.Identifier); /** * Checks if a node represents an `await …` expression. */ -function isAwaitExpression( - node: TSESTree.Node | undefined | null, -): node is TSESTree.AwaitExpression { - return node?.type === AST_NODE_TYPES.AwaitExpression; -} +const isAwaitExpression = isNodeOfType(AST_NODE_TYPES.AwaitExpression); /** * Checks if a possible token is the `await` keyword. */ -function isAwaitKeyword( - node: TSESTree.Token | TSESTree.Comment | undefined | null, -): node is TSESTree.KeywordToken & { value: 'await' } { - return node?.type === AST_TOKEN_TYPES.Identifier && node.value === 'await'; -} - -function isLoop( - node: TSESTree.Node | undefined | null, -): node is - | TSESTree.DoWhileStatement - | TSESTree.ForStatement - | TSESTree.ForInStatement - | TSESTree.ForOfStatement - | TSESTree.WhileStatement { - if (!node) { - return false; - } - - return ( - node.type === AST_NODE_TYPES.DoWhileStatement || - node.type === AST_NODE_TYPES.ForStatement || - node.type === AST_NODE_TYPES.ForInStatement || - node.type === AST_NODE_TYPES.ForOfStatement || - node.type === AST_NODE_TYPES.WhileStatement - ); -} +const isAwaitKeyword = isTokenOfTypeWithConditions(AST_TOKEN_TYPES.Identifier, { + value: 'await', +}); + +const isLoop = isNodeOfTypes([ + AST_NODE_TYPES.DoWhileStatement, + AST_NODE_TYPES.ForStatement, + AST_NODE_TYPES.ForInStatement, + AST_NODE_TYPES.ForOfStatement, + AST_NODE_TYPES.WhileStatement, +] as const); export { isAwaitExpression, diff --git a/packages/experimental-utils/src/eslint-utils/RuleCreator.ts b/packages/experimental-utils/src/eslint-utils/RuleCreator.ts index ca1cfb3302e2..f02b7589862a 100644 --- a/packages/experimental-utils/src/eslint-utils/RuleCreator.ts +++ b/packages/experimental-utils/src/eslint-utils/RuleCreator.ts @@ -19,7 +19,7 @@ function RuleCreator(urlCreator: (ruleName: string) => string) { return function createRule< TOptions extends readonly unknown[], TMessageIds extends string, - TRuleListener extends RuleListener = RuleListener + TRuleListener extends RuleListener = RuleListener, >({ name, meta, diff --git a/packages/experimental-utils/src/eslint-utils/RuleTester.ts b/packages/experimental-utils/src/eslint-utils/RuleTester.ts index 50c3794328be..f2af7a290fd8 100644 --- a/packages/experimental-utils/src/eslint-utils/RuleTester.ts +++ b/packages/experimental-utils/src/eslint-utils/RuleTester.ts @@ -32,6 +32,7 @@ class RuleTester extends TSESLint.RuleTester { 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 + // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access require(parser).clearCaches(); } catch { // ignored diff --git a/packages/experimental-utils/src/eslint-utils/applyDefault.ts b/packages/experimental-utils/src/eslint-utils/applyDefault.ts index a9984b563a17..6b3282080a82 100644 --- a/packages/experimental-utils/src/eslint-utils/applyDefault.ts +++ b/packages/experimental-utils/src/eslint-utils/applyDefault.ts @@ -8,13 +8,13 @@ import { deepMerge, isObjectNotArray } from './deepMerge'; * @returns the options with defaults */ function applyDefault( - defaultOptions: TDefault, - userOptions: TUser | null, + defaultOptions: Readonly, + userOptions: Readonly | null, ): TDefault { // clone defaults - const options: AsMutable = JSON.parse( + const options = JSON.parse( JSON.stringify(defaultOptions), - ); + ) as AsMutable; if (userOptions === null || userOptions === undefined) { return options; diff --git a/packages/experimental-utils/src/eslint-utils/batchedSingleLineTests.ts b/packages/experimental-utils/src/eslint-utils/batchedSingleLineTests.ts index 6ed25e4a8ac4..8eaef6e3f5e9 100644 --- a/packages/experimental-utils/src/eslint-utils/batchedSingleLineTests.ts +++ b/packages/experimental-utils/src/eslint-utils/batchedSingleLineTests.ts @@ -24,17 +24,17 @@ function batchedSingleLineTests>( */ function batchedSingleLineTests< TMessageIds extends string, - TOptions extends Readonly + TOptions extends Readonly, >( test: InvalidTestCase, ): InvalidTestCase[]; function batchedSingleLineTests< TMessageIds extends string, - TOptions extends Readonly + TOptions extends Readonly, >( options: ValidTestCase | InvalidTestCase, ): (ValidTestCase | InvalidTestCase)[] { - // eslint counts lines from 1 + // -- eslint counts lines from 1 const lineOffset = options.code.startsWith('\n') ? 2 : 1; const output = 'output' in options && options.output diff --git a/packages/experimental-utils/src/eslint-utils/getParserServices.ts b/packages/experimental-utils/src/eslint-utils/getParserServices.ts index 925d49761522..27ad579272b9 100644 --- a/packages/experimental-utils/src/eslint-utils/getParserServices.ts +++ b/packages/experimental-utils/src/eslint-utils/getParserServices.ts @@ -9,7 +9,7 @@ const ERROR_MESSAGE = */ function getParserServices< TMessageIds extends string, - TOptions extends readonly unknown[] + TOptions extends readonly unknown[], >( context: Readonly>, allowWithoutFullTypeInformation = false, diff --git a/packages/experimental-utils/src/json-schema.ts b/packages/experimental-utils/src/json-schema.ts index 4b2b1abfe33d..8e11b8b3caa2 100644 --- a/packages/experimental-utils/src/json-schema.ts +++ b/packages/experimental-utils/src/json-schema.ts @@ -2,6 +2,7 @@ // 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, @@ -20,4 +21,4 @@ export { JSONSchema7Version, ValidationError, ValidationResult, -} from 'json-schema'; // eslint-disable-line import/no-extraneous-dependencies +} from 'json-schema'; diff --git a/packages/experimental-utils/src/ts-eslint-scope/Definition.ts b/packages/experimental-utils/src/ts-eslint-scope/Definition.ts index 15c69bbf86c3..1999c4f4863e 100644 --- a/packages/experimental-utils/src/ts-eslint-scope/Definition.ts +++ b/packages/experimental-utils/src/ts-eslint-scope/Definition.ts @@ -27,13 +27,14 @@ 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; -}; +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/experimental-utils/src/ts-eslint-scope/README.md b/packages/experimental-utils/src/ts-eslint-scope/README.md new file mode 100644 index 000000000000..6cabba14fbff --- /dev/null +++ b/packages/experimental-utils/src/ts-eslint-scope/README.md @@ -0,0 +1,3 @@ +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/experimental-utils/src/ts-eslint-scope/Scope.ts b/packages/experimental-utils/src/ts-eslint-scope/Scope.ts index 49f1e11c7955..9b2c711d2dc2 100644 --- a/packages/experimental-utils/src/ts-eslint-scope/Scope.ts +++ b/packages/experimental-utils/src/ts-eslint-scope/Scope.ts @@ -142,8 +142,9 @@ const ModuleScope = ESLintModuleScope as ScopeConstructor & ScopeChildConstructorWithUpperScope; interface FunctionExpressionNameScope extends Scope {} -const FunctionExpressionNameScope = ESLintFunctionExpressionNameScope as ScopeConstructor & - ScopeChildConstructorWithUpperScope; +const FunctionExpressionNameScope = + ESLintFunctionExpressionNameScope as ScopeConstructor & + ScopeChildConstructorWithUpperScope; interface CatchScope extends Scope {} const CatchScope = ESLintCatchScope as ScopeConstructor & diff --git a/packages/experimental-utils/src/ts-eslint-scope/index.ts b/packages/experimental-utils/src/ts-eslint-scope/index.ts index d713845f9f46..870c34fce1bb 100644 --- a/packages/experimental-utils/src/ts-eslint-scope/index.ts +++ b/packages/experimental-utils/src/ts-eslint-scope/index.ts @@ -9,4 +9,5 @@ export * from './Referencer'; export * from './Scope'; export * from './ScopeManager'; export * from './Variable'; + export const version: string = ESLintVersion; diff --git a/packages/experimental-utils/src/ts-eslint/CLIEngine.ts b/packages/experimental-utils/src/ts-eslint/CLIEngine.ts index fec56c17b410..9cc1c97b5c79 100644 --- a/packages/experimental-utils/src/ts-eslint/CLIEngine.ts +++ b/packages/experimental-utils/src/ts-eslint/CLIEngine.ts @@ -71,7 +71,7 @@ declare class CLIEngineBase { TMessageIds extends string = string, TOptions extends readonly unknown[] = unknown[], // for extending base rules - TRuleListener extends RuleListener = RuleListener + TRuleListener extends RuleListener = RuleListener, >(): Map>; //////////////////// @@ -175,6 +175,8 @@ namespace CLIEngine { * important information so you can deal with the output yourself. * @deprecated use the ESLint class instead */ -class CLIEngine extends (ESLintCLIEngine as typeof CLIEngineBase) {} +const CLIEngine = ESLintCLIEngine + ? class CLIEngine extends (ESLintCLIEngine as typeof CLIEngineBase) {} + : undefined; export { CLIEngine }; diff --git a/packages/experimental-utils/src/ts-eslint/Linter.ts b/packages/experimental-utils/src/ts-eslint/Linter.ts index 9abefbabe7d5..77c338f5a753 100644 --- a/packages/experimental-utils/src/ts-eslint/Linter.ts +++ b/packages/experimental-utils/src/ts-eslint/Linter.ts @@ -3,7 +3,12 @@ import { Linter as ESLintLinter } from 'eslint'; import { TSESTree, ParserServices } from '../ts-estree'; import { ParserOptions as TSParserOptions } from './ParserOptions'; -import { RuleCreateFunction, RuleFix, RuleModule } from './Rule'; +import { + RuleCreateFunction, + RuleFix, + RuleModule, + SharedConfigurationSettings, +} from './Rule'; import { Scope } from './Scope'; import { SourceCode } from './SourceCode'; @@ -114,6 +119,8 @@ namespace Linter { export type RuleEntry = RuleLevel | RuleLevelAndOptions; export type RulesRecord = Partial>; + export type GlobalVariableOption = 'readonly' | 'writable' | 'off' | boolean; + // https://github.com/eslint/eslint/blob/v6.8.0/conf/config-schema.js interface BaseConfig { $schema?: string; @@ -128,7 +135,7 @@ namespace Linter { /** * The global variable settings. */ - globals?: { [name: string]: boolean }; + globals?: { [name: string]: GlobalVariableOption }; /** * The flag that disables directive comments. */ @@ -164,7 +171,7 @@ namespace Linter { /** * The shared settings. */ - settings?: { [name: string]: unknown }; + settings?: SharedConfigurationSettings; } export interface ConfigOverride extends BaseConfig { diff --git a/packages/experimental-utils/src/ts-eslint/Rule.ts b/packages/experimental-utils/src/ts-eslint/Rule.ts index d74af833121e..7750d35dc68a 100644 --- a/packages/experimental-utils/src/ts-eslint/Rule.ts +++ b/packages/experimental-utils/src/ts-eslint/Rule.ts @@ -1,19 +1,11 @@ -import { JSONSchema4 } from '../json-schema'; -import { ParserServices, TSESTree } from '../ts-estree'; -import { AST } from './AST'; -import { Linter } from './Linter'; -import { Scope } from './Scope'; -import { SourceCode } from './SourceCode'; +import type { JSONSchema4 } from '../json-schema'; +import type { ParserServices, TSESTree } from '../ts-estree'; +import type { AST } from './AST'; +import type { Linter } from './Linter'; +import type { Scope } from './Scope'; +import type { SourceCode } from './SourceCode'; interface RuleMetaDataDocs { - /** - * The general category the rule falls within - */ - category: - | 'Best Practices' - | 'Stylistic Issues' - | 'Variables' - | 'Possible Errors'; /** * Concise description of the rule */ @@ -57,6 +49,10 @@ interface RuleMetaData { * The fixer category. Omit if there is no fixer */ fixable?: 'code' | 'whitespace'; + /** + * Specifies whether rules can return suggestions. Omit if there is no suggestions + */ + hasSuggestions?: boolean; /** * A map of messages which the rule can report. * The key is the messageId, and the string is the parameterised error string. @@ -112,12 +108,16 @@ interface RuleFixer { replaceTextRange(range: AST.Range, text: string): RuleFix; } +interface SuggestionReportDescriptor + extends Omit, 'fix'> { + readonly fix: ReportFixFunction; +} + type ReportFixFunction = ( fixer: RuleFixer, -) => null | RuleFix | RuleFix[] | IterableIterator; -type ReportSuggestionArray< - TMessageIds extends string -> = ReportDescriptorBase[]; +) => null | RuleFix | readonly RuleFix[] | IterableIterator; +type ReportSuggestionArray = + SuggestionReportDescriptor[]; interface ReportDescriptorBase { /** @@ -148,28 +148,35 @@ interface ReportDescriptorNodeOptionalLoc { /** * The Node or AST Token which the report is being attached to */ - readonly node: TSESTree.Node | TSESTree.Comment | TSESTree.Token; + readonly node: TSESTree.Node | TSESTree.Token; /** * An override of the location of the report */ readonly loc?: | Readonly - | Readonly; + | Readonly; } interface ReportDescriptorLocOnly { /** * An override of the location of the report */ - loc: Readonly | Readonly; + loc: Readonly | Readonly; +} +type ReportDescriptor = + ReportDescriptorWithSuggestion & + (ReportDescriptorNodeOptionalLoc | ReportDescriptorLocOnly); + +/** + * Plugins can add their settings using declaration + * merging against this interface. + */ +interface SharedConfigurationSettings { + [name: string]: unknown; } -type ReportDescriptor< - TMessageIds extends string -> = ReportDescriptorWithSuggestion & - (ReportDescriptorNodeOptionalLoc | ReportDescriptorLocOnly); interface RuleContext< TMessageIds extends string, - TOptions extends readonly unknown[] + TOptions extends readonly unknown[], > { /** * The rule ID. @@ -196,7 +203,7 @@ interface RuleContext< * The shared settings from configuration. * We do not have any shared settings in this plugin. */ - settings: Record; + settings: SharedConfigurationSettings; /** * Returns an array of the ancestors of the currently-traversed node, starting at @@ -211,11 +218,26 @@ interface RuleContext< */ getDeclaredVariables(node: TSESTree.Node): Scope.Variable[]; + /** + * Returns the current working directory passed to Linter. + * It is a path to a directory that should be considered as the current working directory. + * This was added in v6.6.0 + * @since 6.6.0 + */ + getCwd?(): string; + /** * Returns the filename associated with the source. */ getFilename(): string; + /** + * Returns the full path of the file on disk without any code block information (unlike `getFilename()`). + * This was added in v7.28.0 + * @since 7.28.0 + */ + getPhysicalFilename?(): string; + /** * Returns the scope of the currently-traversed node. * This information can be used track references to variables. @@ -249,8 +271,8 @@ interface RuleListener { ArrayExpression?: RuleFunction; ArrayPattern?: RuleFunction; ArrowFunctionExpression?: RuleFunction; - AssignmentPattern?: RuleFunction; AssignmentExpression?: RuleFunction; + AssignmentPattern?: RuleFunction; AwaitExpression?: RuleFunction; BigIntLiteral?: RuleFunction; BinaryExpression?: RuleFunction; @@ -262,8 +284,6 @@ interface RuleListener { ClassBody?: RuleFunction; ClassDeclaration?: RuleFunction; ClassExpression?: RuleFunction; - ClassProperty?: RuleFunction; - Comment?: RuleFunction; ConditionalExpression?: RuleFunction; ContinueStatement?: RuleFunction; DebuggerStatement?: RuleFunction; @@ -312,6 +332,7 @@ interface RuleListener { ObjectPattern?: RuleFunction; Program?: RuleFunction; Property?: RuleFunction; + PropertyDefinition?: RuleFunction; RestElement?: RuleFunction; ReturnStatement?: RuleFunction; SequenceExpression?: RuleFunction; @@ -324,11 +345,10 @@ interface RuleListener { TemplateLiteral?: RuleFunction; ThisExpression?: RuleFunction; ThrowStatement?: RuleFunction; - Token?: RuleFunction; TryStatement?: RuleFunction; - TSAbstractClassProperty?: RuleFunction; TSAbstractKeyword?: RuleFunction; TSAbstractMethodDefinition?: RuleFunction; + TSAbstractPropertyDefinition?: RuleFunction; TSAnyKeyword?: RuleFunction; TSArrayType?: RuleFunction; TSAsExpression?: RuleFunction; @@ -340,8 +360,8 @@ interface RuleListener { TSConditionalType?: RuleFunction; TSConstructorType?: RuleFunction; TSConstructSignatureDeclaration?: RuleFunction; - TSDeclareKeyword?: RuleFunction; TSDeclareFunction?: RuleFunction; + TSDeclareKeyword?: RuleFunction; TSEmptyBodyFunctionExpression?: RuleFunction; TSEnumDeclaration?: RuleFunction; TSEnumMember?: RuleFunction; @@ -371,7 +391,6 @@ interface RuleListener { TSObjectKeyword?: RuleFunction; TSOptionalType?: RuleFunction; TSParameterProperty?: RuleFunction; - TSParenthesizedType?: RuleFunction; TSPrivateKeyword?: RuleFunction; TSPropertySignature?: RuleFunction; TSProtectedKeyword?: RuleFunction; @@ -412,7 +431,7 @@ interface RuleModule< TMessageIds extends string, TOptions extends readonly unknown[], // for extending base rules - TRuleListener extends RuleListener = RuleListener + TRuleListener extends RuleListener = RuleListener, > { /** * Metadata about the rule @@ -430,7 +449,7 @@ type RuleCreateFunction< TMessageIds extends string = never, TOptions extends readonly unknown[] = unknown[], // for extending base rules - TRuleListener extends RuleListener = RuleListener + TRuleListener extends RuleListener = RuleListener, > = (context: Readonly>) => TRuleListener; export { @@ -446,4 +465,5 @@ export { RuleMetaData, RuleMetaDataDocs, RuleModule, + SharedConfigurationSettings, }; diff --git a/packages/experimental-utils/src/ts-eslint/RuleTester.ts b/packages/experimental-utils/src/ts-eslint/RuleTester.ts index 652567f6b9fd..2049d9f90e70 100644 --- a/packages/experimental-utils/src/ts-eslint/RuleTester.ts +++ b/packages/experimental-utils/src/ts-eslint/RuleTester.ts @@ -1,9 +1,18 @@ import { RuleTester as ESLintRuleTester } from 'eslint'; import { AST_NODE_TYPES, AST_TOKEN_TYPES } from '../ts-estree'; import { ParserOptions } from './ParserOptions'; -import { RuleCreateFunction, RuleModule } from './Rule'; +import { Linter } from './Linter'; +import { + RuleCreateFunction, + RuleModule, + SharedConfigurationSettings, +} from './Rule'; interface ValidTestCase> { + /** + * Name for the test case. + */ + readonly name?: string; /** * Code for the test case. */ @@ -35,7 +44,11 @@ interface ValidTestCase> { /** * Settings for the test case. */ - readonly settings?: Readonly>; + readonly settings?: Readonly; + /** + * Run this case exclusively for debugging in supported test frameworks. + */ + readonly only?: boolean; } interface SuggestionOutput { @@ -59,7 +72,7 @@ interface SuggestionOutput { interface InvalidTestCase< TMessageIds extends string, - TOptions extends Readonly + TOptions extends Readonly, > extends ValidTestCase { /** * Expected errors. @@ -111,13 +124,13 @@ interface TestCaseError { interface RunTests< TMessageIds extends string, - TOptions extends Readonly + TOptions extends Readonly, > { // RuleTester.run also accepts strings for valid cases readonly valid: readonly (ValidTestCase | string)[]; readonly invalid: readonly InvalidTestCase[]; } -interface RuleTesterConfig { +interface RuleTesterConfig extends Linter.Config { // should be require.resolve(parserPackageName) readonly parser: string; readonly parserOptions?: Readonly; diff --git a/packages/experimental-utils/src/ts-eslint/Scope.ts b/packages/experimental-utils/src/ts-eslint/Scope.ts index 6907e2290fd9..bc3db012216c 100644 --- a/packages/experimental-utils/src/ts-eslint/Scope.ts +++ b/packages/experimental-utils/src/ts-eslint/Scope.ts @@ -19,7 +19,8 @@ namespace Scope { export type CatchClauseDefinition = scopeManager.CatchClauseDefinition; export type ClassNameDefinition = scopeManager.ClassNameDefinition; export type FunctionNameDefinition = scopeManager.FunctionNameDefinition; - export type ImplicitGlobalVariableDefinition = scopeManager.ImplicitGlobalVariableDefinition; + export type ImplicitGlobalVariableDefinition = + scopeManager.ImplicitGlobalVariableDefinition; export type ImportBindingDefinition = scopeManager.ImportBindingDefinition; export type ParameterDefinition = scopeManager.ParameterDefinition; export type TSEnumMemberDefinition = scopeManager.TSEnumMemberDefinition; @@ -34,7 +35,8 @@ namespace Scope { export type ClassScope = scopeManager.ClassScope; export type ConditionalTypeScope = scopeManager.ConditionalTypeScope; export type ForScope = scopeManager.ForScope; - export type FunctionExpressionNameScope = scopeManager.FunctionExpressionNameScope; + export type FunctionExpressionNameScope = + scopeManager.FunctionExpressionNameScope; export type FunctionScope = scopeManager.FunctionScope; export type FunctionTypeScope = scopeManager.FunctionTypeScope; export type GlobalScope = scopeManager.GlobalScope; diff --git a/packages/experimental-utils/src/ts-eslint/SourceCode.ts b/packages/experimental-utils/src/ts-eslint/SourceCode.ts index 888892d825fa..682e2e52012c 100644 --- a/packages/experimental-utils/src/ts-eslint/SourceCode.ts +++ b/packages/experimental-utils/src/ts-eslint/SourceCode.ts @@ -55,8 +55,8 @@ declare class TokenStore { * @returns An object representing the token. */ getFirstTokenBetween( - left: TSESTree.Node | TSESTree.Token | TSESTree.Comment, - right: TSESTree.Node | TSESTree.Token | TSESTree.Comment, + left: TSESTree.Node | TSESTree.Token, + right: TSESTree.Node | TSESTree.Token, options?: T, ): SourceCode.ReturnTypeFromOptions | null; /** @@ -77,8 +77,8 @@ declare class TokenStore { * @returns Tokens between left and right. */ getFirstTokensBetween( - left: TSESTree.Node | TSESTree.Token | TSESTree.Comment, - right: TSESTree.Node | TSESTree.Token | TSESTree.Comment, + left: TSESTree.Node | TSESTree.Token, + right: TSESTree.Node | TSESTree.Token, options?: T, ): SourceCode.ReturnTypeFromOptions[]; /** @@ -99,8 +99,8 @@ declare class TokenStore { * @returns An object representing the token. */ getLastTokenBetween( - left: TSESTree.Node | TSESTree.Token | TSESTree.Comment, - right: TSESTree.Node | TSESTree.Token | TSESTree.Comment, + left: TSESTree.Node | TSESTree.Token, + right: TSESTree.Node | TSESTree.Token, options?: T, ): SourceCode.ReturnTypeFromOptions | null; /** @@ -121,8 +121,8 @@ declare class TokenStore { * @returns Tokens between left and right. */ getLastTokensBetween( - left: TSESTree.Node | TSESTree.Token | TSESTree.Comment, - right: TSESTree.Node | TSESTree.Token | TSESTree.Comment, + left: TSESTree.Node | TSESTree.Token, + right: TSESTree.Node | TSESTree.Token, options?: T, ): SourceCode.ReturnTypeFromOptions[]; /** @@ -132,7 +132,7 @@ declare class TokenStore { * @returns An object representing the token. */ getTokenAfter( - node: TSESTree.Node | TSESTree.Token | TSESTree.Comment, + node: TSESTree.Node | TSESTree.Token, options?: T, ): SourceCode.ReturnTypeFromOptions | null; /** @@ -142,7 +142,7 @@ declare class TokenStore { * @returns An object representing the token. */ getTokenBefore( - node: TSESTree.Node | TSESTree.Token | TSESTree.Comment, + node: TSESTree.Node | TSESTree.Token, options?: T, ): SourceCode.ReturnTypeFromOptions | null; /** @@ -184,7 +184,7 @@ declare class TokenStore { * @returns Tokens. */ getTokensAfter( - node: TSESTree.Node | TSESTree.Token | TSESTree.Comment, + node: TSESTree.Node | TSESTree.Token, options?: T, ): SourceCode.ReturnTypeFromOptions[]; /** @@ -194,7 +194,7 @@ declare class TokenStore { * @returns Tokens. */ getTokensBefore( - node: TSESTree.Node | TSESTree.Token | TSESTree.Comment, + node: TSESTree.Node | TSESTree.Token, options?: T, ): SourceCode.ReturnTypeFromOptions[]; /** @@ -205,8 +205,8 @@ declare class TokenStore { * @returns Tokens between left and right. */ getTokensBetween( - left: TSESTree.Node | TSESTree.Token | TSESTree.Comment, - right: TSESTree.Node | TSESTree.Token | TSESTree.Comment, + left: TSESTree.Node | TSESTree.Token, + right: TSESTree.Node | TSESTree.Token, padding?: T, ): SourceCode.ReturnTypeFromOptions[]; /** @@ -217,8 +217,8 @@ declare class TokenStore { * @returns Tokens between left and right. */ getTokensBetween( - left: TSESTree.Node | TSESTree.Token | TSESTree.Comment, - right: TSESTree.Node | TSESTree.Token | TSESTree.Comment, + left: TSESTree.Node | TSESTree.Token, + right: TSESTree.Node | TSESTree.Token, padding?: number, ): SourceCode.ReturnTypeFromOptions[]; } @@ -245,20 +245,12 @@ declare class SourceCodeBase extends TokenStore { * @returns An array of comment nodes. */ getAllComments(): TSESTree.Comment[]; - /** - * Gets all comments for the given node. - * @param node The AST node to get the comments for. - * @returns An object containing a leading and trailing array of comments indexed by their position. - */ - getComments( - node: TSESTree.Node, - ): { leading: TSESTree.Comment[]; trailing: TSESTree.Comment[] }; /** * Converts a (line, column) pair into a range index. * @param loc A line/column location * @returns The range index of the location in the file. */ - getIndexFromLoc(location: TSESTree.LineAndColumnData): number; + getIndexFromLoc(location: TSESTree.Position): number; /** * Gets the entire source text split into an array of lines. * @returns The source text as an array of lines. @@ -269,7 +261,7 @@ declare class SourceCodeBase extends TokenStore { * @param index The index of a character in a file * @returns A {line, column} location object with a 0-indexed column */ - getLocFromIndex(index: number): TSESTree.LineAndColumnData; + getLocFromIndex(index: number): TSESTree.Position; /** * Gets the deepest node containing a range index. * @param index Range index of the desired node. @@ -303,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.Comment | TSESTree.Node, - second: TSESTree.Token | TSESTree.Comment | TSESTree.Node, + first: TSESTree.Token | TSESTree.Node, + second: TSESTree.Token | TSESTree.Node, ): boolean; /** * Determines if two nodes or tokens have at least one whitespace character @@ -342,8 +334,10 @@ declare class SourceCodeBase extends TokenStore { text: string; /** * All of the tokens and comments in the AST. + * + * TODO: rename to 'tokens' */ - tokensAndComments: (TSESTree.Comment | TSESTree.Token)[]; + tokensAndComments: TSESTree.Token[]; /** * The visitor keys to traverse AST. */ @@ -394,9 +388,7 @@ namespace SourceCode { [nodeType: string]: string[]; } - export type FilterPredicate = ( - tokenOrComment: TSESTree.Token | TSESTree.Comment, - ) => boolean; + export type FilterPredicate = (token: TSESTree.Token) => boolean; export type ReturnTypeFromOptions = T extends { includeComments: true } ? TSESTree.Token diff --git a/packages/experimental-utils/tests/eslint-utils/RuleCreator.test.ts b/packages/experimental-utils/tests/eslint-utils/RuleCreator.test.ts index 343d5f0e1aad..5e1c14d68c48 100644 --- a/packages/experimental-utils/tests/eslint-utils/RuleCreator.test.ts +++ b/packages/experimental-utils/tests/eslint-utils/RuleCreator.test.ts @@ -4,7 +4,7 @@ describe('RuleCreator', () => { const createRule = ESLintUtils.RuleCreator(name => `test/${name}`); it('createRule should be a function', () => { - expect(typeof createRule).toEqual('function'); + expect(typeof createRule).toBe('function'); }); it('should create rule correctly', () => { @@ -13,7 +13,6 @@ describe('RuleCreator', () => { meta: { docs: { description: 'some description', - category: 'Best Practices', recommended: 'error', requiresTypeChecking: true, }, @@ -31,7 +30,6 @@ describe('RuleCreator', () => { expect(rule.meta).toEqual({ docs: { description: 'some description', - category: 'Best Practices', url: 'test/test', recommended: 'error', requiresTypeChecking: true, diff --git a/packages/experimental-utils/typings/eslint-scope.d.ts b/packages/experimental-utils/typings/eslint-scope.d.ts index 7b4d0bc1b2e9..e9af4b350f6f 100644 --- a/packages/experimental-utils/typings/eslint-scope.d.ts +++ b/packages/experimental-utils/typings/eslint-scope.d.ts @@ -57,7 +57,6 @@ declare module 'eslint-scope/lib/scope-manager' { export = ScopeManager; } declare module 'eslint-scope' { - const version: string; - const analyze: unknown; - export { analyze, version }; + export const version: string; + export const analyze: unknown; } diff --git a/packages/experimental-utils/typings/eslint-utils.d.ts b/packages/experimental-utils/typings/eslint-utils.d.ts index f12326c0b4ac..5843e99466f8 100644 --- a/packages/experimental-utils/typings/eslint-utils.d.ts +++ b/packages/experimental-utils/typings/eslint-utils.d.ts @@ -32,9 +32,10 @@ declare module 'eslint-utils' { export const isSemicolonToken: unknown; export const PatternMatcher: unknown; export const ReferenceTracker: { - READ: never; - CALL: never; - CONSTRUCT: never; + readonly READ: never; + readonly CALL: never; + readonly CONSTRUCT: never; + readonly ESM: never; new (): never; }; } diff --git a/packages/parser/CHANGELOG.md b/packages/parser/CHANGELOG.md index fc98f1371930..76239c9ee34c 100644 --- a/packages/parser/CHANGELOG.md +++ b/packages/parser/CHANGELOG.md @@ -3,6 +3,294 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.2.0...v5.3.0) (2021-11-01) + +**Note:** Version bump only for package @typescript-eslint/parser + + + + + +# [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/parser + + + + + +# [5.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.0.0...v5.1.0) (2021-10-18) + +**Note:** Version bump only for package @typescript-eslint/parser + + + + + +# [5.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.33.0...v5.0.0) (2021-10-11) + + +### Features + +* support ESLint v8 ([#3737](https://github.com/typescript-eslint/typescript-eslint/issues/3737)) ([4ca62ae](https://github.com/typescript-eslint/typescript-eslint/commit/4ca62aee6681d706e762a8db727541ca204364f2)) + + + + + +# [4.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.32.0...v4.33.0) (2021-10-04) + +**Note:** Version bump only for package @typescript-eslint/parser + + + + + +# [4.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.2...v4.32.0) (2021-09-27) + + +### Features + +* Support `'latest'` as `ecmaVersion` ([#3873](https://github.com/typescript-eslint/typescript-eslint/issues/3873)) ([25a42c0](https://github.com/typescript-eslint/typescript-eslint/commit/25a42c0bbe92d1ecbc2e8ff9ef3a3ef413f728b0)) + + + + + +## [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/parser + + + + + +## [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/parser + + + + + +# [4.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.30.0...v4.31.0) (2021-09-06) + +**Note:** Version bump only for package @typescript-eslint/parser + + + + + +# [4.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.3...v4.30.0) (2021-08-30) + + +### Features + +* **typescript-estree:** add support for class static blocks ([#3730](https://github.com/typescript-eslint/typescript-eslint/issues/3730)) ([f81831b](https://github.com/typescript-eslint/typescript-eslint/commit/f81831bd279a32da6dbab0f1c061053ea43965f6)) + + + + + +## [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/parser + + + + + +## [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/parser + + + + + +## [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/parser + + + + + +# [4.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.5...v4.29.0) (2021-08-02) + + +### Features + +* **eslint-plugin:** Catch unused React import with new JSX transform ([#3577](https://github.com/typescript-eslint/typescript-eslint/issues/3577)) ([02998ea](https://github.com/typescript-eslint/typescript-eslint/commit/02998eac510665758b9a093d43afc310f3ac980d)) +* **typescript-estree:** add support for custom module resolution ([#3516](https://github.com/typescript-eslint/typescript-eslint/issues/3516)) ([d48429d](https://github.com/typescript-eslint/typescript-eslint/commit/d48429d97326545bb727f88ce9056270b1599a31)) + + + + + +## [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/parser + + + + + +## [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/parser + + + + + +## [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/parser + + + + + +## [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/parser + + + + + +## [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/parser + + + + + +# [4.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.27.0...v4.28.0) (2021-06-21) + +**Note:** Version bump only for package @typescript-eslint/parser + + + + + +# [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)) + + +### Features + +* allow user to provide TS program instance in parser options ([#3484](https://github.com/typescript-eslint/typescript-eslint/issues/3484)) ([e855b18](https://github.com/typescript-eslint/typescript-eslint/commit/e855b18b8feee0edb5c617c11006861426a6f530)) + + + + + +## [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/parser + + + + + +# [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/parser + + + + + +# [4.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.24.0...v4.25.0) (2021-05-24) + +**Note:** Version bump only for package @typescript-eslint/parser + + + + + +# [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/parser + + + + + +# [4.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.1...v4.23.0) (2021-05-10) + + +### Features + +* 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/parser + + + + + +# [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/parser + + + + + +# [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/parser + + + + + +# [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/parser + + + + + +# [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/parser + + + + + +# [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/parser + + + + + +# [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/parser + + + + + ## [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/parser diff --git a/packages/parser/README.md b/packages/parser/README.md index 0599f61b2369..f928738ceb22 100644 --- a/packages/parser/README.md +++ b/packages/parser/README.md @@ -53,9 +53,9 @@ interface ParserOptions { jsx?: boolean; globalReturn?: boolean; }; - ecmaVersion?: number; + ecmaVersion?: number | 'latest'; - jsxPragma?: string; + jsxPragma?: string | null; jsxFragmentName?: string | null; lib?: string[]; @@ -64,6 +64,9 @@ interface ParserOptions { tsconfigRootDir?: string; extraFileExtensions?: string[]; warnOnUnsupportedTypeScriptVersion?: boolean; + + program?: import('typescript').Program; + moduleResolver?: string; } ``` @@ -94,12 +97,13 @@ This options allows you to tell the parser if you want to allow global `return` Default `2018`. -Accepts any valid ECMAScript version number: +Accepts any valid ECMAScript version number or `'latest'`: -- A version: es3, es5, es6, es7, es8, es9, es10, es11, ..., or -- A year: es2015, es2016, es2017, es2018, es2019, es2020, ... +- A version: es3, es5, es6, es7, es8, es9, es10, es11, es12, es13, ..., or +- A year: es2015, es2016, es2017, es2018, es2019, es2020, es2021, es2022, ..., or +- `'latest'` -The value **must** be a number - so do not include the `es` prefix. +When it's a version or a year, the value **must** be a number - so do not include the `es` prefix. Specifies the version of ECMAScript syntax you want to use. This is used by the parser to determine how to perform scope analysis, and it affects the default @@ -108,7 +112,7 @@ Specifies the version of ECMAScript syntax you want to use. This is used by the Default `'React'` The identifier that's used for JSX Elements creation (after transpilation). -If you're using a library other than React (like `preact`), then you should change this value. +If you're using a library other than React (like `preact`), then you should change this value. If you are using the [new JSX transform](https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html) you can set this to `null`. This should not be a member expression - just the root identifier (i.e. use `"React"` instead of `"React.createElement"`). @@ -211,6 +215,62 @@ Default `false`. This option allows you to request that when the `project` setting is specified, files will be allowed when not included in the projects defined by the provided `tsconfig.json` files. **Using this option will incur significant performance costs. This option is primarily included for backwards-compatibility.** See the **`project`** section above for more information. +### `parserOptions.programs` + +Default `undefined`. + +This option allows you to programmatically provide an array of one or more instances 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`. +All linted files must be part of the provided program(s). + +### `parserOptions.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)[]; +} +``` + +[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). + +Note that if you pass custom programs via `options.programs` this option will not have any effect over them (you can simply add the custom resolution on them directly). + +## Utilities + +### `createProgram(configFile, projectDirectory)` + +This serves as a utility method for users of the `parserOptions.programs` feature to create a TypeScript program instance from a config file. + +```ts +declare function createProgram( + configFile: string, + projectDirectory?: string, +): import('typescript').Program; +``` + +Example usage in .eslintrc.js: + +```js +const parser = require('@typescript-eslint/parser'); +const programs = [parser.createProgram('tsconfig.json')]; +module.exports = { + parserOptions: { + programs, + }, +}; +``` + ## Supported TypeScript Version Please see [`typescript-eslint`](https://github.com/typescript-eslint/typescript-eslint) for the supported TypeScript version. diff --git a/packages/parser/jest.config.js b/packages/parser/jest.config.js index 309c75f2fd3c..af3026d5c104 100644 --- a/packages/parser/jest.config.js +++ b/packages/parser/jest.config.js @@ -1,6 +1,9 @@ 'use strict'; +// @ts-check +/** @type {import('@jest/types').Config.InitialOptions} */ module.exports = { + resolver: '/../../tests/jest-resolver.js', globals: { 'ts-jest': { isolatedModules: true, diff --git a/packages/parser/package.json b/packages/parser/package.json index 4f306dd88b10..9021564e2cf8 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/parser", - "version": "4.16.1", + "version": "5.3.0", "description": "An ESLint custom parser which leverages TypeScript ESTree", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -10,7 +10,7 @@ "LICENSE" ], "engines": { - "node": "^10.12.0 || >=12.0.0" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "repository": { "type": "git", @@ -34,24 +34,24 @@ "build": "tsc -b tsconfig.build.json", "postbuild": "downlevel-dts dist _ts3.4/dist", "clean": "tsc -b tsconfig.build.json --clean", - "postclean": "rimraf dist", + "postclean": "rimraf dist && rimraf _ts3.4 && rimraf coverage", "format": "prettier --write \"./**/*.{ts,js,json,md}\" --ignore-path ../../.prettierignore", "lint": "eslint . --ext .js,.ts --ignore-path='../../.eslintignore'", "test": "jest --coverage", "typecheck": "tsc -p tsconfig.json --noEmit" }, "peerDependencies": { - "eslint": "^5.0.0 || ^6.0.0 || ^7.0.0" + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" }, "dependencies": { - "@typescript-eslint/scope-manager": "4.16.1", - "@typescript-eslint/types": "4.16.1", - "@typescript-eslint/typescript-estree": "4.16.1", - "debug": "^4.1.1" + "@typescript-eslint/scope-manager": "5.3.0", + "@typescript-eslint/types": "5.3.0", + "@typescript-eslint/typescript-estree": "5.3.0", + "debug": "^4.3.2" }, "devDependencies": { "@types/glob": "*", - "@typescript-eslint/experimental-utils": "4.16.1", + "@typescript-eslint/experimental-utils": "5.3.0", "glob": "*", "typescript": "*" }, diff --git a/packages/parser/project.json b/packages/parser/project.json new file mode 100644 index 000000000000..c9c9e3b6321b --- /dev/null +++ b/packages/parser/project.json @@ -0,0 +1,5 @@ +{ + "root": "packages/parser", + "type": "library", + "implicitDependencies": [] +} diff --git a/packages/parser/src/index.ts b/packages/parser/src/index.ts index 02b7568a692d..928671a3c5c1 100644 --- a/packages/parser/src/index.ts +++ b/packages/parser/src/index.ts @@ -2,7 +2,9 @@ export { parse, parseForESLint, ParserOptions } from './parser'; export { ParserServices, clearCaches, + createProgram, } from '@typescript-eslint/typescript-estree'; // 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/parser/src/parser.ts b/packages/parser/src/parser.ts index f304a837d8b6..bbb0e3a04d71 100644 --- a/packages/parser/src/parser.ts +++ b/packages/parser/src/parser.ts @@ -102,7 +102,7 @@ function parseForESLint( jsx: validateBoolean(options.ecmaFeatures.jsx), }); const analyzeOptions: AnalyzeOptions = { - ecmaVersion: options.ecmaVersion, + ecmaVersion: options.ecmaVersion === 'latest' ? 1e8 : options.ecmaVersion, globalReturn: options.ecmaFeatures.globalReturn, jsxPragma: options.jsxPragma, jsxFragmentName: options.jsxFragmentName, diff --git a/packages/parser/tests/lib/parser.ts b/packages/parser/tests/lib/parser.ts index 41e22a911f9b..0432c94252e5 100644 --- a/packages/parser/tests/lib/parser.ts +++ b/packages/parser/tests/lib/parser.ts @@ -18,6 +18,11 @@ 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'); diff --git a/packages/parser/tests/lib/services.ts b/packages/parser/tests/lib/services.ts index 28cada9d251d..4567f5f85a45 100644 --- a/packages/parser/tests/lib/services.ts +++ b/packages/parser/tests/lib/services.ts @@ -7,6 +7,7 @@ import { formatSnapshotName, testServices, } from '../tools/test-utils'; +import { createProgram } from '@typescript-eslint/typescript-estree'; //------------------------------------------------------------------------------ // Setup @@ -30,15 +31,17 @@ function createConfig(filename: string): ParserOptions { //------------------------------------------------------------------------------ describe('services', () => { + const program = createProgram(path.resolve(FIXTURES_DIR, 'tsconfig.json')); testFiles.forEach(filename => { const code = fs.readFileSync(path.join(FIXTURES_DIR, filename), 'utf8'); const config = createConfig(filename); - it( - formatSnapshotName(filename, FIXTURES_DIR, '.ts'), - createSnapshotTestBlock(code, config), - ); - it(`${formatSnapshotName(filename, FIXTURES_DIR, '.ts')} services`, () => { + const snapshotName = formatSnapshotName(filename, FIXTURES_DIR, '.ts'); + it(snapshotName, createSnapshotTestBlock(code, config)); + it(`${snapshotName} services`, () => { testServices(code, config); }); + it(`${snapshotName} services with provided program`, () => { + testServices(code, { ...config, program }); + }); }); }); diff --git a/packages/parser/tests/tools/test-utils.ts b/packages/parser/tests/tools/test-utils.ts index 0a14468fee0f..6dd679d1fea2 100644 --- a/packages/parser/tests/tools/test-utils.ts +++ b/packages/parser/tests/tools/test-utils.ts @@ -53,13 +53,13 @@ export function createSnapshotTestBlock( try { const result = parse(); expect(result).toMatchSnapshot(); - } catch (e) { + } catch (error) { /** * If we are deliberately throwing because of encountering an unknown * AST_NODE_TYPE, we rethrow to cause the test to fail */ - if (e.message.match('Unknown AST_NODE_TYPE')) { - throw new Error(e); + if (/Unknown AST_NODE_TYPE/.exec((error as Error).message)) { + throw error; } expect(parse).toThrowErrorMatchingSnapshot(); } diff --git a/packages/scope-manager/CHANGELOG.md b/packages/scope-manager/CHANGELOG.md index f3cfeed1d185..e3890cbc7932 100644 --- a/packages/scope-manager/CHANGELOG.md +++ b/packages/scope-manager/CHANGELOG.md @@ -3,6 +3,301 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.2.0...v5.3.0) (2021-11-01) + +**Note:** Version bump only for package @typescript-eslint/scope-manager + + + + + +# [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/scope-manager + + + + + +# [5.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.0.0...v5.1.0) (2021-10-18) + +**Note:** Version bump only for package @typescript-eslint/scope-manager + + + + + +# [5.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.33.0...v5.0.0) (2021-10-11) + + +### Features + +* 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) +* support `PrivateIdentifier` ([#3808](https://github.com/typescript-eslint/typescript-eslint/issues/3808)) ([0eefe5e](https://github.com/typescript-eslint/typescript-eslint/commit/0eefe5e49d21af3f1e3e2d9a90c2e49929863ac2)), closes [#3430](https://github.com/typescript-eslint/typescript-eslint/issues/3430) [#2933](https://github.com/typescript-eslint/typescript-eslint/issues/2933) +* **eslint-plugin:** removed value from abstract property nodes ([#3765](https://github.com/typescript-eslint/typescript-eslint/issues/3765)) ([5823524](https://github.com/typescript-eslint/typescript-eslint/commit/58235241714596b641a1e8b39c569e561e0039b4)), closes [#3748](https://github.com/typescript-eslint/typescript-eslint/issues/3748) + + + + + +# [4.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.32.0...v4.33.0) (2021-10-04) + +**Note:** Version bump only for package @typescript-eslint/scope-manager + + + + + +# [4.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.2...v4.32.0) (2021-09-27) + + +### Features + +* **eslint-plugin-internal:** [prefer-ast-types-enum] add `DefinitionType` enum ([#3916](https://github.com/typescript-eslint/typescript-eslint/issues/3916)) ([13b7de5](https://github.com/typescript-eslint/typescript-eslint/commit/13b7de508e0f8eac492879ff9ab99acd8d3e977e)) +* Support `'latest'` as `ecmaVersion` ([#3873](https://github.com/typescript-eslint/typescript-eslint/issues/3873)) ([25a42c0](https://github.com/typescript-eslint/typescript-eslint/commit/25a42c0bbe92d1ecbc2e8ff9ef3a3ef413f728b0)) + + + + + +## [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/scope-manager + + + + + +## [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/scope-manager + + + + + +# [4.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.30.0...v4.31.0) (2021-09-06) + +**Note:** Version bump only for package @typescript-eslint/scope-manager + + + + + +# [4.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.3...v4.30.0) (2021-08-30) + + +### Features + +* **typescript-estree:** add support for class static blocks ([#3730](https://github.com/typescript-eslint/typescript-eslint/issues/3730)) ([f81831b](https://github.com/typescript-eslint/typescript-eslint/commit/f81831bd279a32da6dbab0f1c061053ea43965f6)) + + + + + +## [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/scope-manager + + + + + +## [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/scope-manager + + + + + +## [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/scope-manager + + + + + +# [4.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.5...v4.29.0) (2021-08-02) + + +### Features + +* **eslint-plugin:** Catch unused React import with new JSX transform ([#3577](https://github.com/typescript-eslint/typescript-eslint/issues/3577)) ([02998ea](https://github.com/typescript-eslint/typescript-eslint/commit/02998eac510665758b9a093d43afc310f3ac980d)) + + + + + +## [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/scope-manager + + + + + +## [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/scope-manager + + + + + +## [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/scope-manager + + + + + +## [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/scope-manager + + + + + +## [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/scope-manager + + + + + +# [4.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.27.0...v4.28.0) (2021-06-21) + +**Note:** Version bump only for package @typescript-eslint/scope-manager + + + + + +# [4.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.1...v4.27.0) (2021-06-14) + +**Note:** Version bump only for package @typescript-eslint/scope-manager + + + + + +## [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/scope-manager + + + + + +# [4.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.25.0...v4.26.0) (2021-05-31) + + +### Bug Fixes + +* generate library types for TypeScript v4.3 ([#3460](https://github.com/typescript-eslint/typescript-eslint/issues/3460)) ([ed4776a](https://github.com/typescript-eslint/typescript-eslint/commit/ed4776afa1374279027b9b7d82aa4b453b334998)), closes [#3449](https://github.com/typescript-eslint/typescript-eslint/issues/3449) + + +### Features + +* **scope-manager:** reduce generated lib file size ([#3468](https://github.com/typescript-eslint/typescript-eslint/issues/3468)) ([258116b](https://github.com/typescript-eslint/typescript-eslint/commit/258116ba7b0dd4ac7a1cc3876fab12f2556bda74)) + + + + + +# [4.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.24.0...v4.25.0) (2021-05-24) + +**Note:** Version bump only for package @typescript-eslint/scope-manager + + + + + +# [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/scope-manager + + + + + +# [4.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.1...v4.23.0) (2021-05-10) + + +### Bug Fixes + +* **scope-manager:** fix visiting TSAsExpression in assignment ([#3355](https://github.com/typescript-eslint/typescript-eslint/issues/3355)) ([87521a0](https://github.com/typescript-eslint/typescript-eslint/commit/87521a024103bc5fc643861649bee9a288f55b7b)) + + +### Features + +* 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/scope-manager + + + + + +# [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/scope-manager + + + + + +# [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/scope-manager + + + + + +# [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/scope-manager + + + + + +# [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/scope-manager + + + + + +# [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/scope-manager + + + + + +# [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/scope-manager + + + + + ## [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/scope-manager diff --git a/packages/scope-manager/README.md b/packages/scope-manager/README.md index 7671214e8d7c..5e62019ba877 100644 --- a/packages/scope-manager/README.md +++ b/packages/scope-manager/README.md @@ -39,8 +39,9 @@ interface AnalyzeOptions { /** * Which ECMAScript version is considered. * Defaults to `2018`. + * `'latest'` is converted to 1e8 at parser. */ - ecmaVersion?: EcmaVersion; + ecmaVersion?: EcmaVersion | 1e8; /** * Whether the whole script is executed under node.js environment. diff --git a/packages/scope-manager/package.json b/packages/scope-manager/package.json index c38f88ed26cb..0c49d224fe15 100644 --- a/packages/scope-manager/package.json +++ b/packages/scope-manager/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/scope-manager", - "version": "4.16.1", + "version": "5.3.0", "description": "TypeScript scope analyser for ESLint", "keywords": [ "eslint", @@ -8,7 +8,7 @@ "estree" ], "engines": { - "node": "^8.10.0 || ^10.13.0 || >=11.10.1" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "files": [ "dist", @@ -31,7 +31,7 @@ "build": "tsc -b tsconfig.build.json", "postbuild": "downlevel-dts dist _ts3.4/dist", "clean": "tsc -b tsconfig.build.json --clean", - "postclean": "rimraf dist", + "postclean": "rimraf dist && rimraf _ts3.4 && rimraf coverage", "format": "prettier --write \"./**/*.{ts,js,json,md}\" --ignore-path ../../.prettierignore", "generate:lib": "../../node_modules/.bin/ts-node --files --transpile-only tools/generate-lib.ts", "lint": "eslint . --ext .js,.ts --ignore-path='../../.eslintignore'", @@ -39,17 +39,17 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/types": "4.16.1", - "@typescript-eslint/visitor-keys": "4.16.1" + "@typescript-eslint/types": "5.3.0", + "@typescript-eslint/visitor-keys": "5.3.0" }, "devDependencies": { "@types/glob": "*", - "@typescript-eslint/typescript-estree": "4.16.1", + "@typescript-eslint/typescript-estree": "5.3.0", "glob": "*", "jest-specific-snapshot": "*", "make-dir": "*", "prettier": "*", - "pretty-format": "^26.4.2", + "pretty-format": "*", "rimraf": "*", "typescript": "*" }, diff --git a/packages/scope-manager/project.json b/packages/scope-manager/project.json new file mode 100644 index 000000000000..702250b8421c --- /dev/null +++ b/packages/scope-manager/project.json @@ -0,0 +1,5 @@ +{ + "root": "packages/scope-manager", + "type": "library", + "implicitDependencies": [] +} diff --git a/packages/scope-manager/src/ScopeManager.ts b/packages/scope-manager/src/ScopeManager.ts index e4c9b4d3cdc4..3f360710cb0b 100644 --- a/packages/scope-manager/src/ScopeManager.ts +++ b/packages/scope-manager/src/ScopeManager.ts @@ -19,6 +19,7 @@ import { TypeScope, WithScope, } from './scope'; +import { ClassFieldInitializerScope } from './scope/ClassFieldInitializerScope'; import { Variable } from './variable'; @@ -168,6 +169,15 @@ class ScopeManager { return this.nestScope(new ClassScope(this, this.currentScope, node)); } + public nestClassFieldInitializerScope( + node: ClassFieldInitializerScope['block'], + ): ClassFieldInitializerScope { + assert(this.currentScope); + return this.nestScope( + new ClassFieldInitializerScope(this, this.currentScope, node), + ); + } + public nestConditionalTypeScope( node: ConditionalTypeScope['block'], ): ConditionalTypeScope { diff --git a/packages/scope-manager/src/analyze.ts b/packages/scope-manager/src/analyze.ts index 1aaf874049fc..febd7a26652f 100644 --- a/packages/scope-manager/src/analyze.ts +++ b/packages/scope-manager/src/analyze.ts @@ -17,8 +17,9 @@ interface AnalyzeOptions { /** * Which ECMAScript version is considered. * Defaults to `2018`. + * `'latest'` is converted to 1e8 at parser. */ - ecmaVersion?: EcmaVersion; + ecmaVersion?: EcmaVersion | 1e8; /** * Whether the whole script is executed under node.js environment. @@ -38,7 +39,7 @@ interface AnalyzeOptions { * This should not be a member expression - just the root identifier (i.e. use "React" instead of "React.createElement"). * Defaults to `"React"`. */ - jsxPragma?: string; + jsxPragma?: string | null; /** * The identifier that's used for JSX fragment elements (after transpilation). @@ -81,7 +82,11 @@ const DEFAULT_OPTIONS: Required = { emitDecoratorMetadata: false, }; -function mapEcmaVersion(version: EcmaVersion | undefined): Lib { +/** + * 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'; } @@ -108,7 +113,10 @@ function analyze( globalReturn: providedOptions?.globalReturn ?? DEFAULT_OPTIONS.globalReturn, impliedStrict: providedOptions?.impliedStrict ?? DEFAULT_OPTIONS.impliedStrict, - jsxPragma: providedOptions?.jsxPragma ?? DEFAULT_OPTIONS.jsxPragma, + jsxPragma: + providedOptions?.jsxPragma === undefined + ? DEFAULT_OPTIONS.jsxPragma + : providedOptions.jsxPragma, jsxFragmentName: providedOptions?.jsxFragmentName ?? DEFAULT_OPTIONS.jsxFragmentName, sourceType: providedOptions?.sourceType ?? DEFAULT_OPTIONS.sourceType, diff --git a/packages/scope-manager/src/definition/DefinitionBase.ts b/packages/scope-manager/src/definition/DefinitionBase.ts index ed25a72293d1..7147ebc60edc 100644 --- a/packages/scope-manager/src/definition/DefinitionBase.ts +++ b/packages/scope-manager/src/definition/DefinitionBase.ts @@ -8,7 +8,7 @@ abstract class DefinitionBase< TType extends DefinitionType, TNode extends TSESTree.Node, TParent extends TSESTree.Node | null, - TName extends TSESTree.Node = TSESTree.BindingName + TName extends TSESTree.Node = TSESTree.BindingName, > { /** * A unique ID for this instance - primarily used to help debugging and testing diff --git a/packages/scope-manager/src/definition/DefinitionType.ts b/packages/scope-manager/src/definition/DefinitionType.ts index 7f689d45ed54..5b01718ce7fa 100644 --- a/packages/scope-manager/src/definition/DefinitionType.ts +++ b/packages/scope-manager/src/definition/DefinitionType.ts @@ -1,5 +1,4 @@ enum DefinitionType { - // eslint-disable-next-line @typescript-eslint/internal/prefer-ast-types-enum CatchClause = 'CatchClause', ClassName = 'ClassName', FunctionName = 'FunctionName', diff --git a/packages/scope-manager/src/lib/base-config.ts b/packages/scope-manager/src/lib/base-config.ts new file mode 100644 index 000000000000..8a704c371018 --- /dev/null +++ b/packages/scope-manager/src/lib/base-config.ts @@ -0,0 +1,19 @@ +// THIS CODE WAS AUTOMATICALLY GENERATED +// DO NOT EDIT THIS CODE BY HAND +// YOU CAN REGENERATE IT USING yarn generate:lib + +export const TYPE = Object.freeze({ + eslintImplicitGlobalSetting: 'readonly', + isTypeVariable: true, + isValueVariable: false, +}); +export const VALUE = Object.freeze({ + eslintImplicitGlobalSetting: 'readonly', + isTypeVariable: false, + isValueVariable: true, +}); +export const TYPE_VALUE = Object.freeze({ + eslintImplicitGlobalSetting: 'readonly', + isTypeVariable: true, + isValueVariable: true, +}); diff --git a/packages/scope-manager/src/lib/dom.iterable.ts b/packages/scope-manager/src/lib/dom.iterable.ts index 582f11704e2b..fcd9388b5620 100644 --- a/packages/scope-manager/src/lib/dom.iterable.ts +++ b/packages/scope-manager/src/lib/dom.iterable.ts @@ -3,324 +3,59 @@ // YOU CAN REGENERATE IT USING yarn generate:lib import { ImplicitLibVariableOptions } from '../variable'; +import { TYPE } from './base-config'; export const dom_iterable = { - AudioParam: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AudioParam', - }, - AudioParamMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AudioParamMap', - }, - BaseAudioContext: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'BaseAudioContext', - }, - CSSRuleList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CSSRuleList', - }, - CSSStyleDeclaration: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CSSStyleDeclaration', - }, - Cache: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Cache', - }, - CanvasPathDrawingStyles: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CanvasPathDrawingStyles', - }, - ClientRectList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ClientRectList', - }, - DOMRectList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DOMRectList', - }, - DOMStringList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DOMStringList', - }, - DOMTokenList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DOMTokenList', - }, - DataTransferItemList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DataTransferItemList', - }, - FileList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'FileList', - }, - FormData: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'FormData', - }, - HTMLAllCollection: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'HTMLAllCollection', - }, - HTMLCollectionBase: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'HTMLCollectionBase', - }, - HTMLCollectionOf: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'HTMLCollectionOf', - }, - HTMLFormElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'HTMLFormElement', - }, - HTMLSelectElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'HTMLSelectElement', - }, - Headers: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Headers', - }, - IDBDatabase: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'IDBDatabase', - }, - IDBObjectStore: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'IDBObjectStore', - }, - MediaKeyStatusMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MediaKeyStatusMap', - }, - MediaList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MediaList', - }, - MimeTypeArray: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MimeTypeArray', - }, - NamedNodeMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'NamedNodeMap', - }, - Navigator: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Navigator', - }, - NodeList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'NodeList', - }, - NodeListOf: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'NodeListOf', - }, - Plugin: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Plugin', - }, - PluginArray: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PluginArray', - }, - RTCRtpTransceiver: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCRtpTransceiver', - }, - RTCStatsReport: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCStatsReport', - }, - SVGLengthList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'SVGLengthList', - }, - SVGNumberList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'SVGNumberList', - }, - SVGPointList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'SVGPointList', - }, - SVGStringList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'SVGStringList', - }, - SourceBufferList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'SourceBufferList', - }, - SpeechGrammarList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'SpeechGrammarList', - }, - SpeechRecognitionResult: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'SpeechRecognitionResult', - }, - SpeechRecognitionResultList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'SpeechRecognitionResultList', - }, - StyleSheetList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'StyleSheetList', - }, - TextTrackCueList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'TextTrackCueList', - }, - TextTrackList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'TextTrackList', - }, - TouchList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'TouchList', - }, - URLSearchParams: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'URLSearchParams', - }, - VRDisplay: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'VRDisplay', - }, - WEBGL_draw_buffers: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WEBGL_draw_buffers', - }, - WebAuthentication: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WebAuthentication', - }, - WebGL2RenderingContextBase: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WebGL2RenderingContextBase', - }, - WebGL2RenderingContextOverloads: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WebGL2RenderingContextOverloads', - }, - WebGLRenderingContextBase: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WebGLRenderingContextBase', - }, - WebGLRenderingContextOverloads: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WebGLRenderingContextOverloads', - }, + AudioParam: TYPE, + AudioParamMap: TYPE, + BaseAudioContext: TYPE, + CSSRuleList: TYPE, + CSSStyleDeclaration: TYPE, + Cache: TYPE, + CanvasPathDrawingStyles: TYPE, + ClientRectList: TYPE, + DOMRectList: TYPE, + DOMStringList: TYPE, + DOMTokenList: TYPE, + DataTransferItemList: TYPE, + FileList: TYPE, + FormData: TYPE, + HTMLAllCollection: TYPE, + HTMLCollectionBase: TYPE, + HTMLCollectionOf: TYPE, + HTMLFormElement: TYPE, + HTMLSelectElement: TYPE, + Headers: TYPE, + IDBDatabase: TYPE, + IDBObjectStore: TYPE, + MediaKeyStatusMap: TYPE, + MediaList: TYPE, + MimeTypeArray: TYPE, + NamedNodeMap: TYPE, + Navigator: TYPE, + NodeList: TYPE, + NodeListOf: TYPE, + Plugin: TYPE, + PluginArray: TYPE, + RTCRtpTransceiver: TYPE, + RTCStatsReport: TYPE, + SVGLengthList: TYPE, + SVGNumberList: TYPE, + SVGPointList: TYPE, + SVGStringList: TYPE, + SourceBufferList: TYPE, + SpeechGrammarList: TYPE, + SpeechRecognitionResult: TYPE, + SpeechRecognitionResultList: TYPE, + StyleSheetList: TYPE, + TextTrackCueList: TYPE, + TextTrackList: TYPE, + TouchList: TYPE, + URLSearchParams: TYPE, + VRDisplay: TYPE, + WEBGL_draw_buffers: TYPE, + WebGL2RenderingContextBase: TYPE, + WebGL2RenderingContextOverloads: TYPE, + WebGLRenderingContextBase: TYPE, + WebGLRenderingContextOverloads: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/dom.ts b/packages/scope-manager/src/lib/dom.ts index 9fc4c5106841..ca9edfe21919 100644 --- a/packages/scope-manager/src/lib/dom.ts +++ b/packages/scope-manager/src/lib/dom.ts @@ -3,7962 +3,1309 @@ // YOU CAN REGENERATE IT USING yarn generate:lib import { ImplicitLibVariableOptions } from '../variable'; +import { TYPE, TYPE_VALUE } from './base-config'; export const dom = { - Account: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Account', - }, - AddEventListenerOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AddEventListenerOptions', - }, - AesCbcParams: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AesCbcParams', - }, - AesCtrParams: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AesCtrParams', - }, - AesDerivedKeyParams: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AesDerivedKeyParams', - }, - AesGcmParams: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AesGcmParams', - }, - AesKeyAlgorithm: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AesKeyAlgorithm', - }, - AesKeyGenParams: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AesKeyGenParams', - }, - Algorithm: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Algorithm', - }, - AnalyserOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AnalyserOptions', - }, - AnimationEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AnimationEventInit', - }, - AnimationPlaybackEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AnimationPlaybackEventInit', - }, - AssertionOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AssertionOptions', - }, - AssignedNodesOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AssignedNodesOptions', - }, - AudioBufferOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AudioBufferOptions', - }, - AudioBufferSourceOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AudioBufferSourceOptions', - }, - AudioContextInfo: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AudioContextInfo', - }, - AudioContextOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AudioContextOptions', - }, - AudioNodeOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AudioNodeOptions', - }, - AudioParamDescriptor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AudioParamDescriptor', - }, - AudioProcessingEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AudioProcessingEventInit', - }, - AudioTimestamp: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AudioTimestamp', - }, - AudioWorkletNodeOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AudioWorkletNodeOptions', - }, - AuthenticationExtensionsClientInputs: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AuthenticationExtensionsClientInputs', - }, - AuthenticationExtensionsClientOutputs: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AuthenticationExtensionsClientOutputs', - }, - AuthenticatorSelectionCriteria: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AuthenticatorSelectionCriteria', - }, - BiquadFilterOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'BiquadFilterOptions', - }, - BlobPropertyBag: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'BlobPropertyBag', - }, - ByteLengthChunk: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ByteLengthChunk', - }, - CacheQueryOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CacheQueryOptions', - }, - CanvasRenderingContext2DSettings: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CanvasRenderingContext2DSettings', - }, - ChannelMergerOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ChannelMergerOptions', - }, - ChannelSplitterOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ChannelSplitterOptions', - }, - ClientData: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ClientData', - }, - ClientQueryOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ClientQueryOptions', - }, - ClipboardEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ClipboardEventInit', - }, - CloseEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CloseEventInit', - }, - CompositionEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CompositionEventInit', - }, - ComputedEffectTiming: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ComputedEffectTiming', - }, - ComputedKeyframe: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ComputedKeyframe', - }, - ConfirmSiteSpecificExceptionsInformation: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ConfirmSiteSpecificExceptionsInformation', - }, - ConstantSourceOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ConstantSourceOptions', - }, - ConstrainBooleanParameters: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ConstrainBooleanParameters', - }, - ConstrainDOMStringParameters: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ConstrainDOMStringParameters', - }, - ConstrainDoubleRange: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ConstrainDoubleRange', - }, - ConstrainULongRange: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ConstrainULongRange', - }, - ConstrainVideoFacingModeParameters: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ConstrainVideoFacingModeParameters', - }, - ConvolverOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ConvolverOptions', - }, - CredentialCreationOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CredentialCreationOptions', - }, - CredentialPropertiesOutput: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CredentialPropertiesOutput', - }, - CredentialRequestOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CredentialRequestOptions', - }, - CustomEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CustomEventInit', - }, - DOMMatrix2DInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DOMMatrix2DInit', - }, - DOMMatrixInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DOMMatrixInit', - }, - DOMPointInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DOMPointInit', - }, - DOMQuadInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DOMQuadInit', - }, - DOMRectInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DOMRectInit', - }, - DelayOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DelayOptions', - }, - DeviceLightEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DeviceLightEventInit', - }, - DeviceMotionEventAccelerationInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DeviceMotionEventAccelerationInit', - }, - DeviceMotionEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DeviceMotionEventInit', - }, - DeviceMotionEventRotationRateInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DeviceMotionEventRotationRateInit', - }, - DeviceOrientationEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DeviceOrientationEventInit', - }, - DevicePermissionDescriptor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DevicePermissionDescriptor', - }, - DocumentTimelineOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DocumentTimelineOptions', - }, - DoubleRange: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DoubleRange', - }, - DragEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DragEventInit', - }, - DynamicsCompressorOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DynamicsCompressorOptions', - }, - EcKeyAlgorithm: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'EcKeyAlgorithm', - }, - EcKeyGenParams: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'EcKeyGenParams', - }, - EcKeyImportParams: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'EcKeyImportParams', - }, - EcdhKeyDeriveParams: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'EcdhKeyDeriveParams', - }, - EcdsaParams: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'EcdsaParams', - }, - EffectTiming: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'EffectTiming', - }, - ElementCreationOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ElementCreationOptions', - }, - ElementDefinitionOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ElementDefinitionOptions', - }, - ErrorEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ErrorEventInit', - }, - EventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'EventInit', - }, - EventListenerOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'EventListenerOptions', - }, - EventModifierInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'EventModifierInit', - }, - EventSourceInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'EventSourceInit', - }, - ExceptionInformation: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ExceptionInformation', - }, - FilePropertyBag: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'FilePropertyBag', - }, - FocusEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'FocusEventInit', - }, - FocusNavigationEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'FocusNavigationEventInit', - }, - FocusNavigationOrigin: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'FocusNavigationOrigin', - }, - FocusOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'FocusOptions', - }, - FullscreenOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'FullscreenOptions', - }, - GainOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'GainOptions', - }, - GamepadEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'GamepadEventInit', - }, - GetNotificationOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'GetNotificationOptions', - }, - GetRootNodeOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'GetRootNodeOptions', - }, - HashChangeEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'HashChangeEventInit', - }, - HkdfParams: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'HkdfParams', - }, - HmacImportParams: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'HmacImportParams', - }, - HmacKeyAlgorithm: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'HmacKeyAlgorithm', - }, - HmacKeyGenParams: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'HmacKeyGenParams', - }, - IDBIndexParameters: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'IDBIndexParameters', - }, - IDBObjectStoreParameters: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'IDBObjectStoreParameters', - }, - IDBVersionChangeEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'IDBVersionChangeEventInit', - }, - IIRFilterOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'IIRFilterOptions', - }, - ImageBitmapOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ImageBitmapOptions', - }, - ImageBitmapRenderingContextSettings: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ImageBitmapRenderingContextSettings', - }, - ImageEncodeOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ImageEncodeOptions', - }, - ImportMeta: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ImportMeta', - }, - InputEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'InputEventInit', - }, - IntersectionObserverEntryInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'IntersectionObserverEntryInit', - }, - IntersectionObserverInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'IntersectionObserverInit', - }, - JsonWebKey: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'JsonWebKey', - }, - KeyAlgorithm: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'KeyAlgorithm', - }, - KeyboardEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'KeyboardEventInit', - }, - Keyframe: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Keyframe', - }, - KeyframeAnimationOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'KeyframeAnimationOptions', - }, - KeyframeEffectOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'KeyframeEffectOptions', - }, - MediaElementAudioSourceOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MediaElementAudioSourceOptions', - }, - MediaEncryptedEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MediaEncryptedEventInit', - }, - MediaKeyMessageEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MediaKeyMessageEventInit', - }, - MediaKeySystemConfiguration: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MediaKeySystemConfiguration', - }, - MediaKeySystemMediaCapability: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MediaKeySystemMediaCapability', - }, - MediaQueryListEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MediaQueryListEventInit', - }, - MediaStreamAudioSourceOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MediaStreamAudioSourceOptions', - }, - MediaStreamConstraints: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MediaStreamConstraints', - }, - MediaStreamErrorEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MediaStreamErrorEventInit', - }, - MediaStreamEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MediaStreamEventInit', - }, - MediaStreamTrackAudioSourceOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MediaStreamTrackAudioSourceOptions', - }, - MediaStreamTrackEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MediaStreamTrackEventInit', - }, - MediaTrackCapabilities: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MediaTrackCapabilities', - }, - MediaTrackConstraintSet: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MediaTrackConstraintSet', - }, - MediaTrackConstraints: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MediaTrackConstraints', - }, - MediaTrackSettings: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MediaTrackSettings', - }, - MediaTrackSupportedConstraints: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MediaTrackSupportedConstraints', - }, - MessageEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MessageEventInit', - }, - MidiPermissionDescriptor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MidiPermissionDescriptor', - }, - MouseEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MouseEventInit', - }, - MultiCacheQueryOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MultiCacheQueryOptions', - }, - MutationObserverInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MutationObserverInit', - }, - NavigationPreloadState: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'NavigationPreloadState', - }, - NotificationAction: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'NotificationAction', - }, - NotificationOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'NotificationOptions', - }, - OfflineAudioCompletionEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'OfflineAudioCompletionEventInit', - }, - OfflineAudioContextOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'OfflineAudioContextOptions', - }, - OptionalEffectTiming: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'OptionalEffectTiming', - }, - OscillatorOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'OscillatorOptions', - }, - PageTransitionEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PageTransitionEventInit', - }, - PannerOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PannerOptions', - }, - PaymentCurrencyAmount: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PaymentCurrencyAmount', - }, - PaymentDetailsBase: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PaymentDetailsBase', - }, - PaymentDetailsInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PaymentDetailsInit', - }, - PaymentDetailsModifier: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PaymentDetailsModifier', - }, - PaymentDetailsUpdate: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PaymentDetailsUpdate', - }, - PaymentItem: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PaymentItem', - }, - PaymentMethodData: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PaymentMethodData', - }, - PaymentOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PaymentOptions', - }, - PaymentRequestUpdateEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PaymentRequestUpdateEventInit', - }, - PaymentShippingOption: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PaymentShippingOption', - }, - Pbkdf2Params: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Pbkdf2Params', - }, - PerformanceObserverInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PerformanceObserverInit', - }, - PeriodicWaveConstraints: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PeriodicWaveConstraints', - }, - PeriodicWaveOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PeriodicWaveOptions', - }, - PermissionDescriptor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PermissionDescriptor', - }, - PointerEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PointerEventInit', - }, - PopStateEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PopStateEventInit', - }, - PositionOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PositionOptions', - }, - PostMessageOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PostMessageOptions', - }, - ProgressEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ProgressEventInit', - }, - PromiseRejectionEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PromiseRejectionEventInit', - }, - PropertyIndexedKeyframes: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PropertyIndexedKeyframes', - }, - PublicKeyCredentialCreationOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PublicKeyCredentialCreationOptions', - }, - PublicKeyCredentialDescriptor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PublicKeyCredentialDescriptor', - }, - PublicKeyCredentialEntity: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PublicKeyCredentialEntity', - }, - PublicKeyCredentialParameters: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PublicKeyCredentialParameters', - }, - PublicKeyCredentialRequestOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PublicKeyCredentialRequestOptions', - }, - PublicKeyCredentialRpEntity: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PublicKeyCredentialRpEntity', - }, - PublicKeyCredentialUserEntity: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PublicKeyCredentialUserEntity', - }, - PushPermissionDescriptor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PushPermissionDescriptor', - }, - PushSubscriptionJSON: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PushSubscriptionJSON', - }, - PushSubscriptionOptionsInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PushSubscriptionOptionsInit', - }, - QueuingStrategy: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'QueuingStrategy', - }, - QueuingStrategyInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'QueuingStrategyInit', - }, - RTCAnswerOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCAnswerOptions', - }, - RTCCertificateExpiration: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCCertificateExpiration', - }, - RTCConfiguration: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCConfiguration', - }, - RTCDTMFToneChangeEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCDTMFToneChangeEventInit', - }, - RTCDataChannelEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCDataChannelEventInit', - }, - RTCDataChannelInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCDataChannelInit', - }, - RTCDtlsFingerprint: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCDtlsFingerprint', - }, - RTCDtlsParameters: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCDtlsParameters', - }, - RTCErrorEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCErrorEventInit', - }, - RTCErrorInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCErrorInit', - }, - RTCIceCandidateAttributes: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCIceCandidateAttributes', - }, - RTCIceCandidateComplete: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCIceCandidateComplete', - }, - RTCIceCandidateDictionary: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCIceCandidateDictionary', - }, - RTCIceCandidateInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCIceCandidateInit', - }, - RTCIceCandidatePair: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCIceCandidatePair', - }, - RTCIceCandidatePairStats: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCIceCandidatePairStats', - }, - RTCIceGatherOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCIceGatherOptions', - }, - RTCIceParameters: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCIceParameters', - }, - RTCIceServer: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCIceServer', - }, - RTCIdentityProviderOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCIdentityProviderOptions', - }, - RTCInboundRTPStreamStats: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCInboundRTPStreamStats', - }, - RTCMediaStreamTrackStats: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCMediaStreamTrackStats', - }, - RTCOAuthCredential: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCOAuthCredential', - }, - RTCOfferAnswerOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCOfferAnswerOptions', - }, - RTCOfferOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCOfferOptions', - }, - RTCOutboundRTPStreamStats: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCOutboundRTPStreamStats', - }, - RTCPeerConnectionIceErrorEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCPeerConnectionIceErrorEventInit', - }, - RTCPeerConnectionIceEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCPeerConnectionIceEventInit', - }, - RTCRTPStreamStats: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCRTPStreamStats', - }, - RTCRtcpFeedback: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCRtcpFeedback', - }, - RTCRtcpParameters: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCRtcpParameters', - }, - RTCRtpCapabilities: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCRtpCapabilities', - }, - RTCRtpCodecCapability: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCRtpCodecCapability', - }, - RTCRtpCodecParameters: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCRtpCodecParameters', - }, - RTCRtpCodingParameters: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCRtpCodingParameters', - }, - RTCRtpContributingSource: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCRtpContributingSource', - }, - RTCRtpDecodingParameters: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCRtpDecodingParameters', - }, - RTCRtpEncodingParameters: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCRtpEncodingParameters', - }, - RTCRtpFecParameters: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCRtpFecParameters', - }, - RTCRtpHeaderExtension: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCRtpHeaderExtension', - }, - RTCRtpHeaderExtensionCapability: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCRtpHeaderExtensionCapability', - }, - RTCRtpHeaderExtensionParameters: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCRtpHeaderExtensionParameters', - }, - RTCRtpParameters: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCRtpParameters', - }, - RTCRtpReceiveParameters: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCRtpReceiveParameters', - }, - RTCRtpRtxParameters: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCRtpRtxParameters', - }, - RTCRtpSendParameters: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCRtpSendParameters', - }, - RTCRtpSynchronizationSource: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCRtpSynchronizationSource', - }, - RTCRtpTransceiverInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCRtpTransceiverInit', - }, - RTCRtpUnhandled: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCRtpUnhandled', - }, - RTCSessionDescriptionInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCSessionDescriptionInit', - }, - RTCSrtpKeyParam: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCSrtpKeyParam', - }, - RTCSrtpSdesParameters: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCSrtpSdesParameters', - }, - RTCSsrcRange: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCSsrcRange', - }, - RTCStats: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCStats', - }, - RTCStatsEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCStatsEventInit', - }, - RTCStatsReport: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'RTCStatsReport', - }, - RTCTrackEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCTrackEventInit', - }, - RTCTransportStats: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCTransportStats', - }, - ReadableStreamDefaultReadDoneResult: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ReadableStreamDefaultReadDoneResult', - }, - ReadableStreamDefaultReadValueResult: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ReadableStreamDefaultReadValueResult', - }, - ReadableWritablePair: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ReadableWritablePair', - }, - RegistrationOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RegistrationOptions', - }, - RequestInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RequestInit', - }, - ResizeObserverOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ResizeObserverOptions', - }, - ResponseInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ResponseInit', - }, - RsaHashedImportParams: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RsaHashedImportParams', - }, - RsaHashedKeyAlgorithm: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RsaHashedKeyAlgorithm', - }, - RsaHashedKeyGenParams: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RsaHashedKeyGenParams', - }, - RsaKeyAlgorithm: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RsaKeyAlgorithm', - }, - RsaKeyGenParams: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RsaKeyGenParams', - }, - RsaOaepParams: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RsaOaepParams', - }, - RsaOtherPrimesInfo: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RsaOtherPrimesInfo', - }, - RsaPssParams: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RsaPssParams', - }, - SVGBoundingBoxOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'SVGBoundingBoxOptions', - }, - ScopedCredentialDescriptor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ScopedCredentialDescriptor', - }, - ScopedCredentialOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ScopedCredentialOptions', - }, - ScopedCredentialParameters: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ScopedCredentialParameters', - }, - ScrollIntoViewOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ScrollIntoViewOptions', - }, - ScrollOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ScrollOptions', - }, - ScrollToOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ScrollToOptions', - }, - SecurityPolicyViolationEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'SecurityPolicyViolationEventInit', - }, - ServiceWorkerMessageEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ServiceWorkerMessageEventInit', - }, - ShadowRootInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ShadowRootInit', - }, - ShareData: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ShareData', - }, - SpeechRecognitionErrorEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'SpeechRecognitionErrorEventInit', - }, - SpeechRecognitionEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'SpeechRecognitionEventInit', - }, - SpeechSynthesisErrorEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'SpeechSynthesisErrorEventInit', - }, - SpeechSynthesisEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'SpeechSynthesisEventInit', - }, - StaticRangeInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'StaticRangeInit', - }, - StereoPannerOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'StereoPannerOptions', - }, - StorageEstimate: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'StorageEstimate', - }, - StorageEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'StorageEventInit', - }, - StoreExceptionsInformation: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'StoreExceptionsInformation', - }, - StoreSiteSpecificExceptionsInformation: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'StoreSiteSpecificExceptionsInformation', - }, - StreamPipeOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'StreamPipeOptions', - }, - TextDecodeOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'TextDecodeOptions', - }, - TextDecoderOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'TextDecoderOptions', - }, - TextEncoderEncodeIntoResult: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'TextEncoderEncodeIntoResult', - }, - TouchEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'TouchEventInit', - }, - TouchInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'TouchInit', - }, - TrackEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'TrackEventInit', - }, - Transformer: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Transformer', - }, - TransitionEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'TransitionEventInit', - }, - UIEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'UIEventInit', - }, - ULongRange: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ULongRange', - }, - UnderlyingSink: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'UnderlyingSink', - }, - UnderlyingSource: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'UnderlyingSource', - }, - VRDisplayEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'VRDisplayEventInit', - }, - VRLayer: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'VRLayer', - }, - VRStageParameters: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'VRStageParameters', - }, - WaveShaperOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WaveShaperOptions', - }, - WebAuthnExtensions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WebAuthnExtensions', - }, - WebGLContextAttributes: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WebGLContextAttributes', - }, - WebGLContextEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WebGLContextEventInit', - }, - WheelEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WheelEventInit', - }, - WorkerOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WorkerOptions', - }, - WorkletOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WorkletOptions', - }, - EventListener: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'EventListener', - }, - XPathNSResolver: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'XPathNSResolver', - }, - ANGLE_instanced_arrays: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ANGLE_instanced_arrays', - }, - AbortController: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'AbortController', - }, - AbortSignalEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AbortSignalEventMap', - }, - AbortSignal: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'AbortSignal', - }, - AbstractRange: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'AbstractRange', - }, - AbstractWorkerEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AbstractWorkerEventMap', - }, - AbstractWorker: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AbstractWorker', - }, - AesCfbParams: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AesCfbParams', - }, - AesCmacParams: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AesCmacParams', - }, - AnalyserNode: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'AnalyserNode', - }, - Animatable: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Animatable', - }, - AnimationEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AnimationEventMap', - }, - Animation: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Animation', - }, - AnimationEffect: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'AnimationEffect', - }, - AnimationEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'AnimationEvent', - }, - AnimationFrameProvider: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AnimationFrameProvider', - }, - AnimationPlaybackEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'AnimationPlaybackEvent', - }, - AnimationTimeline: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'AnimationTimeline', - }, - ApplicationCacheEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ApplicationCacheEventMap', - }, - ApplicationCache: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ApplicationCache', - }, - Attr: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Attr', - }, - AudioBuffer: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'AudioBuffer', - }, - AudioBufferSourceNode: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'AudioBufferSourceNode', - }, - AudioContext: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'AudioContext', - }, - AudioDestinationNode: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'AudioDestinationNode', - }, - AudioListener: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'AudioListener', - }, - AudioNode: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'AudioNode', - }, - AudioParam: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'AudioParam', - }, - AudioParamMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'AudioParamMap', - }, - AudioProcessingEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'AudioProcessingEvent', - }, - AudioScheduledSourceNodeEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AudioScheduledSourceNodeEventMap', - }, - AudioScheduledSourceNode: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'AudioScheduledSourceNode', - }, - AudioWorklet: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'AudioWorklet', - }, - AudioWorkletNodeEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AudioWorkletNodeEventMap', - }, - AudioWorkletNode: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'AudioWorkletNode', - }, - AuthenticatorAssertionResponse: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'AuthenticatorAssertionResponse', - }, - AuthenticatorAttestationResponse: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'AuthenticatorAttestationResponse', - }, - AuthenticatorResponse: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'AuthenticatorResponse', - }, - BarProp: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'BarProp', - }, - BaseAudioContextEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'BaseAudioContextEventMap', - }, - BaseAudioContext: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'BaseAudioContext', - }, - BeforeUnloadEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'BeforeUnloadEvent', - }, - BhxBrowser: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'BhxBrowser', - }, - BiquadFilterNode: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'BiquadFilterNode', - }, - Blob: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Blob', - }, - Body: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Body', - }, - BroadcastChannelEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'BroadcastChannelEventMap', - }, - BroadcastChannel: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'BroadcastChannel', - }, - ByteLengthQueuingStrategy: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ByteLengthQueuingStrategy', - }, - CDATASection: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'CDATASection', - }, - CSSConditionRule: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'CSSConditionRule', - }, - CSSFontFaceRule: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'CSSFontFaceRule', - }, - CSSGroupingRule: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'CSSGroupingRule', - }, - CSSImportRule: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'CSSImportRule', - }, - CSSKeyframeRule: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'CSSKeyframeRule', - }, - CSSKeyframesRule: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'CSSKeyframesRule', - }, - CSSMediaRule: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'CSSMediaRule', - }, - CSSNamespaceRule: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'CSSNamespaceRule', - }, - CSSPageRule: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'CSSPageRule', - }, - CSSRule: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'CSSRule', - }, - CSSRuleList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'CSSRuleList', - }, - CSSStyleDeclaration: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'CSSStyleDeclaration', - }, - CSSStyleRule: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'CSSStyleRule', - }, - CSSStyleSheet: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'CSSStyleSheet', - }, - CSSSupportsRule: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'CSSSupportsRule', - }, - Cache: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Cache', - }, - CacheStorage: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'CacheStorage', - }, - CanvasCompositing: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CanvasCompositing', - }, - CanvasDrawImage: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CanvasDrawImage', - }, - CanvasDrawPath: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CanvasDrawPath', - }, - CanvasFillStrokeStyles: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CanvasFillStrokeStyles', - }, - CanvasFilters: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CanvasFilters', - }, - CanvasGradient: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'CanvasGradient', - }, - CanvasImageData: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CanvasImageData', - }, - CanvasImageSmoothing: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CanvasImageSmoothing', - }, - CanvasPath: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CanvasPath', - }, - CanvasPathDrawingStyles: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CanvasPathDrawingStyles', - }, - CanvasPattern: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'CanvasPattern', - }, - CanvasRect: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CanvasRect', - }, - CanvasRenderingContext2D: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'CanvasRenderingContext2D', - }, - CanvasShadowStyles: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CanvasShadowStyles', - }, - CanvasState: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CanvasState', - }, - CanvasText: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CanvasText', - }, - CanvasTextDrawingStyles: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CanvasTextDrawingStyles', - }, - CanvasTransform: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CanvasTransform', - }, - CanvasUserInterface: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CanvasUserInterface', - }, - CaretPosition: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'CaretPosition', - }, - ChannelMergerNode: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ChannelMergerNode', - }, - ChannelSplitterNode: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ChannelSplitterNode', - }, - CharacterData: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'CharacterData', - }, - ChildNode: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ChildNode', - }, - ClientRect: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ClientRect', - }, - ClientRectList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ClientRectList', - }, - Clipboard: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Clipboard', - }, - ClipboardEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ClipboardEvent', - }, - CloseEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'CloseEvent', - }, - Comment: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Comment', - }, - CompositionEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'CompositionEvent', - }, - ConcatParams: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ConcatParams', - }, - ConstantSourceNode: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ConstantSourceNode', - }, - ConvolverNode: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ConvolverNode', - }, - CountQueuingStrategy: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'CountQueuingStrategy', - }, - Credential: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Credential', - }, - CredentialsContainer: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'CredentialsContainer', - }, - Crypto: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Crypto', - }, - CryptoKey: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'CryptoKey', - }, - CryptoKeyPair: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'CryptoKeyPair', - }, - CustomElementRegistry: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'CustomElementRegistry', - }, - CustomEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'CustomEvent', - }, - DOMError: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'DOMError', - }, - DOMException: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'DOMException', - }, - DOMImplementation: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'DOMImplementation', - }, - DOML2DeprecatedColorProperty: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DOML2DeprecatedColorProperty', - }, - DOMMatrix: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'DOMMatrix', - }, - SVGMatrix: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGMatrix', - }, - WebKitCSSMatrix: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WebKitCSSMatrix', - }, - DOMMatrixReadOnly: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'DOMMatrixReadOnly', - }, - DOMParser: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'DOMParser', - }, - DOMPoint: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'DOMPoint', - }, - SVGPoint: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGPoint', - }, - DOMPointReadOnly: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'DOMPointReadOnly', - }, - DOMQuad: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'DOMQuad', - }, - DOMRect: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'DOMRect', - }, - SVGRect: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGRect', - }, - DOMRectList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'DOMRectList', - }, - DOMRectReadOnly: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'DOMRectReadOnly', - }, - DOMSettableTokenList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'DOMSettableTokenList', - }, - DOMStringList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'DOMStringList', - }, - DOMStringMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'DOMStringMap', - }, - DOMTokenList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'DOMTokenList', - }, - DataCue: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'DataCue', - }, - DataTransfer: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'DataTransfer', - }, - DataTransferItem: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'DataTransferItem', - }, - DataTransferItemList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'DataTransferItemList', - }, - DeferredPermissionRequest: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'DeferredPermissionRequest', - }, - DelayNode: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'DelayNode', - }, - DeviceAcceleration: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'DeviceAcceleration', - }, - DeviceLightEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'DeviceLightEvent', - }, - DeviceMotionEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'DeviceMotionEvent', - }, - DeviceMotionEventAcceleration: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DeviceMotionEventAcceleration', - }, - DeviceMotionEventRotationRate: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DeviceMotionEventRotationRate', - }, - DeviceOrientationEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'DeviceOrientationEvent', - }, - DeviceRotationRate: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'DeviceRotationRate', - }, - DhImportKeyParams: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DhImportKeyParams', - }, - DhKeyAlgorithm: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DhKeyAlgorithm', - }, - DhKeyDeriveParams: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DhKeyDeriveParams', - }, - DhKeyGenParams: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DhKeyGenParams', - }, - DocumentEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DocumentEventMap', - }, - Document: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Document', - }, - DocumentAndElementEventHandlersEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DocumentAndElementEventHandlersEventMap', - }, - DocumentAndElementEventHandlers: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DocumentAndElementEventHandlers', - }, - DocumentEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DocumentEvent', - }, - DocumentFragment: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'DocumentFragment', - }, - DocumentOrShadowRoot: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DocumentOrShadowRoot', - }, - DocumentTimeline: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'DocumentTimeline', - }, - DocumentType: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'DocumentType', - }, - DragEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'DragEvent', - }, - DynamicsCompressorNode: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'DynamicsCompressorNode', - }, - EXT_blend_minmax: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'EXT_blend_minmax', - }, - EXT_frag_depth: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'EXT_frag_depth', - }, - EXT_sRGB: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'EXT_sRGB', - }, - EXT_shader_texture_lod: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'EXT_shader_texture_lod', - }, - EXT_texture_filter_anisotropic: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'EXT_texture_filter_anisotropic', - }, - ElementEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ElementEventMap', - }, - Element: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Element', - }, - ElementCSSInlineStyle: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ElementCSSInlineStyle', - }, - ElementContentEditable: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ElementContentEditable', - }, - ErrorEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ErrorEvent', - }, - Event: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Event', - }, - EventListenerObject: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'EventListenerObject', - }, - EventSourceEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'EventSourceEventMap', - }, - EventSource: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'EventSource', - }, - EventTarget: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'EventTarget', - }, - ExtensionScriptApis: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ExtensionScriptApis', - }, - External: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'External', - }, - File: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'File', - }, - FileList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'FileList', - }, - FileReaderEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'FileReaderEventMap', - }, - FileReader: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'FileReader', - }, - FocusEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'FocusEvent', - }, - FocusNavigationEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'FocusNavigationEvent', - }, - FormData: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'FormData', - }, - GainNode: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'GainNode', - }, - Gamepad: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Gamepad', - }, - GamepadButton: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'GamepadButton', - }, - GamepadEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'GamepadEvent', - }, - GamepadHapticActuator: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'GamepadHapticActuator', - }, - GamepadPose: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'GamepadPose', - }, - GenericTransformStream: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'GenericTransformStream', - }, - Geolocation: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Geolocation', - }, - GeolocationCoordinates: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'GeolocationCoordinates', - }, - GeolocationPosition: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'GeolocationPosition', - }, - GeolocationPositionError: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'GeolocationPositionError', - }, - GlobalEventHandlersEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'GlobalEventHandlersEventMap', - }, - GlobalEventHandlers: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'GlobalEventHandlers', - }, - HTMLAllCollection: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLAllCollection', - }, - HTMLAnchorElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLAnchorElement', - }, - HTMLAppletElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLAppletElement', - }, - HTMLAreaElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLAreaElement', - }, - HTMLAudioElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLAudioElement', - }, - HTMLBRElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLBRElement', - }, - HTMLBaseElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLBaseElement', - }, - HTMLBaseFontElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLBaseFontElement', - }, - HTMLBodyElementEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'HTMLBodyElementEventMap', - }, - HTMLBodyElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLBodyElement', - }, - HTMLButtonElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLButtonElement', - }, - HTMLCanvasElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLCanvasElement', - }, - HTMLCollectionBase: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'HTMLCollectionBase', - }, - HTMLCollection: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLCollection', - }, - HTMLCollectionOf: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'HTMLCollectionOf', - }, - HTMLDListElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLDListElement', - }, - HTMLDataElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLDataElement', - }, - HTMLDataListElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLDataListElement', - }, - HTMLDetailsElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLDetailsElement', - }, - HTMLDialogElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLDialogElement', - }, - HTMLDirectoryElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLDirectoryElement', - }, - HTMLDivElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLDivElement', - }, - HTMLDocument: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLDocument', - }, - HTMLElementEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'HTMLElementEventMap', - }, - HTMLElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLElement', - }, - HTMLEmbedElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLEmbedElement', - }, - HTMLFieldSetElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLFieldSetElement', - }, - HTMLFontElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLFontElement', - }, - HTMLFormControlsCollection: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLFormControlsCollection', - }, - HTMLFormElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLFormElement', - }, - HTMLFrameElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLFrameElement', - }, - HTMLFrameSetElementEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'HTMLFrameSetElementEventMap', - }, - HTMLFrameSetElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLFrameSetElement', - }, - HTMLHRElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLHRElement', - }, - HTMLHeadElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLHeadElement', - }, - HTMLHeadingElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLHeadingElement', - }, - HTMLHtmlElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLHtmlElement', - }, - HTMLHyperlinkElementUtils: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'HTMLHyperlinkElementUtils', - }, - HTMLIFrameElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLIFrameElement', - }, - HTMLImageElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLImageElement', - }, - HTMLInputElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLInputElement', - }, - HTMLLIElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLLIElement', - }, - HTMLLabelElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLLabelElement', - }, - HTMLLegendElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLLegendElement', - }, - HTMLLinkElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLLinkElement', - }, - HTMLMapElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLMapElement', - }, - HTMLMarqueeElementEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'HTMLMarqueeElementEventMap', - }, - HTMLMarqueeElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLMarqueeElement', - }, - HTMLMediaElementEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'HTMLMediaElementEventMap', - }, - HTMLMediaElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLMediaElement', - }, - HTMLMenuElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLMenuElement', - }, - HTMLMetaElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLMetaElement', - }, - HTMLMeterElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLMeterElement', - }, - HTMLModElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLModElement', - }, - HTMLOListElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLOListElement', - }, - HTMLObjectElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLObjectElement', - }, - HTMLOptGroupElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLOptGroupElement', - }, - HTMLOptionElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLOptionElement', - }, - HTMLOptionsCollection: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLOptionsCollection', - }, - HTMLOrSVGElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'HTMLOrSVGElement', - }, - HTMLOutputElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLOutputElement', - }, - HTMLParagraphElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLParagraphElement', - }, - HTMLParamElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLParamElement', - }, - HTMLPictureElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLPictureElement', - }, - HTMLPreElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLPreElement', - }, - HTMLProgressElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLProgressElement', - }, - HTMLQuoteElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLQuoteElement', - }, - HTMLScriptElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLScriptElement', - }, - HTMLSelectElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLSelectElement', - }, - HTMLSlotElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLSlotElement', - }, - HTMLSourceElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLSourceElement', - }, - HTMLSpanElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLSpanElement', - }, - HTMLStyleElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLStyleElement', - }, - HTMLTableCaptionElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLTableCaptionElement', - }, - HTMLTableCellElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLTableCellElement', - }, - HTMLTableColElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLTableColElement', - }, - HTMLTableDataCellElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLTableDataCellElement', - }, - HTMLTableElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLTableElement', - }, - HTMLTableHeaderCellElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLTableHeaderCellElement', - }, - HTMLTableRowElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLTableRowElement', - }, - HTMLTableSectionElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLTableSectionElement', - }, - HTMLTemplateElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLTemplateElement', - }, - HTMLTextAreaElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLTextAreaElement', - }, - HTMLTimeElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLTimeElement', - }, - HTMLTitleElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLTitleElement', - }, - HTMLTrackElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLTrackElement', - }, - HTMLUListElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLUListElement', - }, - HTMLUnknownElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLUnknownElement', - }, - HTMLVideoElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HTMLVideoElement', - }, - HashChangeEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'HashChangeEvent', - }, - Headers: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Headers', - }, - History: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'History', - }, - IDBArrayKey: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'IDBArrayKey', - }, - IDBCursor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'IDBCursor', - }, - IDBCursorWithValue: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'IDBCursorWithValue', - }, - IDBDatabaseEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'IDBDatabaseEventMap', - }, - IDBDatabase: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'IDBDatabase', - }, - IDBFactory: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'IDBFactory', - }, - IDBIndex: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'IDBIndex', - }, - IDBKeyRange: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'IDBKeyRange', - }, - IDBObjectStore: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'IDBObjectStore', - }, - IDBOpenDBRequestEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'IDBOpenDBRequestEventMap', - }, - IDBOpenDBRequest: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'IDBOpenDBRequest', - }, - IDBRequestEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'IDBRequestEventMap', - }, - IDBRequest: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'IDBRequest', - }, - IDBTransactionEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'IDBTransactionEventMap', - }, - IDBTransaction: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'IDBTransaction', - }, - IDBVersionChangeEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'IDBVersionChangeEvent', - }, - IIRFilterNode: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'IIRFilterNode', - }, - ImageBitmap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ImageBitmap', - }, - ImageBitmapRenderingContext: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ImageBitmapRenderingContext', - }, - ImageData: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ImageData', - }, - InnerHTML: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'InnerHTML', - }, - InputDeviceInfo: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'InputDeviceInfo', - }, - InputEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'InputEvent', - }, - IntersectionObserver: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'IntersectionObserver', - }, - IntersectionObserverEntry: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'IntersectionObserverEntry', - }, - KeyboardEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'KeyboardEvent', - }, - KeyframeEffect: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'KeyframeEffect', - }, - LinkStyle: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'LinkStyle', - }, - ListeningStateChangedEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ListeningStateChangedEvent', - }, - Location: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Location', - }, - MSAssertion: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MSAssertion', - }, - MSBlobBuilder: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MSBlobBuilder', - }, - MSFIDOCredentialAssertion: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MSFIDOCredentialAssertion', - }, - MSFIDOSignature: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MSFIDOSignature', - }, - MSFIDOSignatureAssertion: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MSFIDOSignatureAssertion', - }, - MSFileSaver: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MSFileSaver', - }, - MSGesture: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MSGesture', - }, - MSGestureEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MSGestureEvent', - }, - MSGraphicsTrust: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MSGraphicsTrust', - }, - MSInputMethodContextEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MSInputMethodContextEventMap', - }, - MSInputMethodContext: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MSInputMethodContext', - }, - MSMediaKeyError: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MSMediaKeyError', - }, - MSMediaKeyMessageEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MSMediaKeyMessageEvent', - }, - MSMediaKeyNeededEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MSMediaKeyNeededEvent', - }, - MSMediaKeySession: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MSMediaKeySession', - }, - MSMediaKeys: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MSMediaKeys', - }, - MSNavigatorDoNotTrack: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MSNavigatorDoNotTrack', - }, - MSPointerEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MSPointerEvent', - }, - MSStream: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MSStream', - }, - MediaDeviceInfo: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MediaDeviceInfo', - }, - MediaDevicesEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MediaDevicesEventMap', - }, - MediaDevices: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MediaDevices', - }, - MediaElementAudioSourceNode: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MediaElementAudioSourceNode', - }, - MediaEncryptedEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MediaEncryptedEvent', - }, - MediaError: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MediaError', - }, - MediaKeyMessageEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MediaKeyMessageEvent', - }, - MediaKeySessionEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MediaKeySessionEventMap', - }, - MediaKeySession: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MediaKeySession', - }, - MediaKeyStatusMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MediaKeyStatusMap', - }, - MediaKeySystemAccess: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MediaKeySystemAccess', - }, - MediaKeys: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MediaKeys', - }, - MediaList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MediaList', - }, - MediaQueryListEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MediaQueryListEventMap', - }, - MediaQueryList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MediaQueryList', - }, - MediaQueryListEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MediaQueryListEvent', - }, - MediaSourceEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MediaSourceEventMap', - }, - MediaSource: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MediaSource', - }, - MediaStreamEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MediaStreamEventMap', - }, - MediaStream: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MediaStream', - }, - MediaStreamAudioDestinationNode: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MediaStreamAudioDestinationNode', - }, - MediaStreamAudioSourceNode: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MediaStreamAudioSourceNode', - }, - MediaStreamError: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MediaStreamError', - }, - MediaStreamErrorEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MediaStreamErrorEvent', - }, - MediaStreamEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MediaStreamEvent', - }, - MediaStreamTrackEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MediaStreamTrackEventMap', - }, - MediaStreamTrack: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MediaStreamTrack', - }, - MediaStreamTrackAudioSourceNode: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MediaStreamTrackAudioSourceNode', - }, - MediaStreamTrackEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MediaStreamTrackEvent', - }, - MessageChannel: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MessageChannel', - }, - MessageEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MessageEvent', - }, - MessagePortEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MessagePortEventMap', - }, - MessagePort: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MessagePort', - }, - MimeType: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MimeType', - }, - MimeTypeArray: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MimeTypeArray', - }, - MouseEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MouseEvent', - }, - MutationEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MutationEvent', - }, - MutationObserver: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MutationObserver', - }, - MutationRecord: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MutationRecord', - }, - NamedNodeMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'NamedNodeMap', - }, - NavigationPreloadManager: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'NavigationPreloadManager', - }, - Navigator: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Navigator', - }, - NavigatorAutomationInformation: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'NavigatorAutomationInformation', - }, - NavigatorBeacon: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'NavigatorBeacon', - }, - NavigatorConcurrentHardware: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'NavigatorConcurrentHardware', - }, - NavigatorContentUtils: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'NavigatorContentUtils', - }, - NavigatorCookies: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'NavigatorCookies', - }, - NavigatorID: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'NavigatorID', - }, - NavigatorLanguage: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'NavigatorLanguage', - }, - NavigatorOnLine: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'NavigatorOnLine', - }, - NavigatorPlugins: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'NavigatorPlugins', - }, - NavigatorStorage: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'NavigatorStorage', - }, - Node: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Node', - }, - NodeFilter: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'NodeFilter', - }, - NodeIterator: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'NodeIterator', - }, - NodeList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'NodeList', - }, - NodeListOf: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'NodeListOf', - }, - NonDocumentTypeChildNode: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'NonDocumentTypeChildNode', - }, - NonElementParentNode: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'NonElementParentNode', - }, - NotificationEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'NotificationEventMap', - }, - Notification: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Notification', - }, - OES_element_index_uint: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'OES_element_index_uint', - }, - OES_standard_derivatives: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'OES_standard_derivatives', - }, - OES_texture_float: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'OES_texture_float', - }, - OES_texture_float_linear: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'OES_texture_float_linear', - }, - OES_texture_half_float: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'OES_texture_half_float', - }, - OES_texture_half_float_linear: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'OES_texture_half_float_linear', - }, - OES_vertex_array_object: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'OES_vertex_array_object', - }, - OfflineAudioCompletionEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'OfflineAudioCompletionEvent', - }, - OfflineAudioContextEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'OfflineAudioContextEventMap', - }, - OfflineAudioContext: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'OfflineAudioContext', - }, - OffscreenCanvas: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'OffscreenCanvas', - }, - OffscreenCanvasRenderingContext2D: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'OffscreenCanvasRenderingContext2D', - }, - OscillatorNode: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'OscillatorNode', - }, - OverconstrainedError: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'OverconstrainedError', - }, - OverflowEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'OverflowEvent', - }, - PageTransitionEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'PageTransitionEvent', - }, - PannerNode: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'PannerNode', - }, - ParentNode: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ParentNode', - }, - Path2D: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Path2D', - }, - PaymentAddress: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'PaymentAddress', - }, - PaymentRequestEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PaymentRequestEventMap', - }, - PaymentRequest: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'PaymentRequest', - }, - PaymentRequestUpdateEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'PaymentRequestUpdateEvent', - }, - PaymentResponse: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'PaymentResponse', - }, - PerfWidgetExternal: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'PerfWidgetExternal', - }, - PerformanceEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PerformanceEventMap', - }, - Performance: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Performance', - }, - PerformanceEntry: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'PerformanceEntry', - }, - PerformanceMark: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'PerformanceMark', - }, - PerformanceMeasure: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'PerformanceMeasure', - }, - PerformanceNavigation: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'PerformanceNavigation', - }, - PerformanceNavigationTiming: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'PerformanceNavigationTiming', - }, - PerformanceObserver: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'PerformanceObserver', - }, - PerformanceObserverEntryList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'PerformanceObserverEntryList', - }, - PerformanceResourceTiming: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'PerformanceResourceTiming', - }, - PerformanceTiming: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'PerformanceTiming', - }, - PeriodicWave: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'PeriodicWave', - }, - PermissionRequest: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'PermissionRequest', - }, - PermissionRequestedEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'PermissionRequestedEvent', - }, - PermissionStatusEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PermissionStatusEventMap', - }, - PermissionStatus: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'PermissionStatus', - }, - Permissions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Permissions', - }, - Plugin: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Plugin', - }, - PluginArray: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'PluginArray', - }, - PointerEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'PointerEvent', - }, - PopStateEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'PopStateEvent', - }, - ProcessingInstruction: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ProcessingInstruction', - }, - ProgressEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ProgressEvent', - }, - PromiseRejectionEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'PromiseRejectionEvent', - }, - PublicKeyCredential: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'PublicKeyCredential', - }, - PushManager: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'PushManager', - }, - PushSubscription: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'PushSubscription', - }, - PushSubscriptionOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'PushSubscriptionOptions', - }, - RTCCertificate: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'RTCCertificate', - }, - RTCDTMFSenderEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCDTMFSenderEventMap', - }, - RTCDTMFSender: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'RTCDTMFSender', - }, - RTCDTMFToneChangeEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'RTCDTMFToneChangeEvent', - }, - RTCDataChannelEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCDataChannelEventMap', - }, - RTCDataChannel: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'RTCDataChannel', - }, - RTCDataChannelEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'RTCDataChannelEvent', - }, - RTCDtlsTransportEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCDtlsTransportEventMap', - }, - RTCDtlsTransport: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'RTCDtlsTransport', - }, - RTCDtlsTransportStateChangedEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'RTCDtlsTransportStateChangedEvent', - }, - RTCDtmfSenderEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCDtmfSenderEventMap', - }, - RTCDtmfSender: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'RTCDtmfSender', - }, - RTCError: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'RTCError', - }, - RTCErrorEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'RTCErrorEvent', - }, - RTCIceCandidate: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'RTCIceCandidate', - }, - RTCIceCandidatePairChangedEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'RTCIceCandidatePairChangedEvent', - }, - RTCIceGathererEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCIceGathererEventMap', - }, - RTCIceGatherer: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'RTCIceGatherer', - }, - RTCIceGathererEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'RTCIceGathererEvent', - }, - RTCIceTransportEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCIceTransportEventMap', - }, - RTCIceTransport: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'RTCIceTransport', - }, - RTCIceTransportStateChangedEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'RTCIceTransportStateChangedEvent', - }, - RTCIdentityAssertion: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'RTCIdentityAssertion', - }, - RTCPeerConnectionEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCPeerConnectionEventMap', - }, - RTCPeerConnection: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'RTCPeerConnection', - }, - RTCPeerConnectionIceErrorEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'RTCPeerConnectionIceErrorEvent', - }, - RTCPeerConnectionIceEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'RTCPeerConnectionIceEvent', - }, - RTCRtpReceiver: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'RTCRtpReceiver', - }, - RTCRtpSender: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'RTCRtpSender', - }, - RTCRtpTransceiver: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'RTCRtpTransceiver', - }, - RTCSctpTransportEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCSctpTransportEventMap', - }, - RTCSctpTransport: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'RTCSctpTransport', - }, - RTCSessionDescription: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'RTCSessionDescription', - }, - RTCSrtpSdesTransportEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCSrtpSdesTransportEventMap', - }, - RTCSrtpSdesTransport: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'RTCSrtpSdesTransport', - }, - RTCSsrcConflictEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'RTCSsrcConflictEvent', - }, - RTCStatsEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'RTCStatsEvent', - }, - RTCStatsProvider: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'RTCStatsProvider', - }, - RTCTrackEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'RTCTrackEvent', - }, - RadioNodeList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'RadioNodeList', - }, - RandomSource: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'RandomSource', - }, - Range: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Range', - }, - ReadableStream: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ReadableStream', - }, - ReadableStreamDefaultController: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ReadableStreamDefaultController', - }, - ReadableStreamDefaultReader: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ReadableStreamDefaultReader', - }, - ReadableStreamGenericReader: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ReadableStreamGenericReader', - }, - Request: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Request', - }, - ResizeObserver: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ResizeObserver', - }, - ResizeObserverEntry: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ResizeObserverEntry', - }, - ResizeObserverSize: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ResizeObserverSize', - }, - Response: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Response', - }, - SVGAElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGAElement', - }, - SVGAngle: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGAngle', - }, - SVGAnimateElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGAnimateElement', - }, - SVGAnimateMotionElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGAnimateMotionElement', - }, - SVGAnimateTransformElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGAnimateTransformElement', - }, - SVGAnimatedAngle: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGAnimatedAngle', - }, - SVGAnimatedBoolean: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGAnimatedBoolean', - }, - SVGAnimatedEnumeration: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGAnimatedEnumeration', - }, - SVGAnimatedInteger: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGAnimatedInteger', - }, - SVGAnimatedLength: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGAnimatedLength', - }, - SVGAnimatedLengthList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGAnimatedLengthList', - }, - SVGAnimatedNumber: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGAnimatedNumber', - }, - SVGAnimatedNumberList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGAnimatedNumberList', - }, - SVGAnimatedPoints: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'SVGAnimatedPoints', - }, - SVGAnimatedPreserveAspectRatio: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGAnimatedPreserveAspectRatio', - }, - SVGAnimatedRect: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGAnimatedRect', - }, - SVGAnimatedString: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGAnimatedString', - }, - SVGAnimatedTransformList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGAnimatedTransformList', - }, - SVGAnimationElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGAnimationElement', - }, - SVGCircleElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGCircleElement', - }, - SVGClipPathElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGClipPathElement', - }, - SVGComponentTransferFunctionElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGComponentTransferFunctionElement', - }, - SVGCursorElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGCursorElement', - }, - SVGDefsElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGDefsElement', - }, - SVGDescElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGDescElement', - }, - SVGElementEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'SVGElementEventMap', - }, - SVGElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGElement', - }, - SVGElementInstance: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGElementInstance', - }, - SVGElementInstanceList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGElementInstanceList', - }, - SVGEllipseElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGEllipseElement', - }, - SVGFEBlendElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGFEBlendElement', - }, - SVGFEColorMatrixElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGFEColorMatrixElement', - }, - SVGFEComponentTransferElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGFEComponentTransferElement', - }, - SVGFECompositeElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGFECompositeElement', - }, - SVGFEConvolveMatrixElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGFEConvolveMatrixElement', - }, - SVGFEDiffuseLightingElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGFEDiffuseLightingElement', - }, - SVGFEDisplacementMapElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGFEDisplacementMapElement', - }, - SVGFEDistantLightElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGFEDistantLightElement', - }, - SVGFEDropShadowElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGFEDropShadowElement', - }, - SVGFEFloodElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGFEFloodElement', - }, - SVGFEFuncAElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGFEFuncAElement', - }, - SVGFEFuncBElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGFEFuncBElement', - }, - SVGFEFuncGElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGFEFuncGElement', - }, - SVGFEFuncRElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGFEFuncRElement', - }, - SVGFEGaussianBlurElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGFEGaussianBlurElement', - }, - SVGFEImageElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGFEImageElement', - }, - SVGFEMergeElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGFEMergeElement', - }, - SVGFEMergeNodeElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGFEMergeNodeElement', - }, - SVGFEMorphologyElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGFEMorphologyElement', - }, - SVGFEOffsetElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGFEOffsetElement', - }, - SVGFEPointLightElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGFEPointLightElement', - }, - SVGFESpecularLightingElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGFESpecularLightingElement', - }, - SVGFESpotLightElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGFESpotLightElement', - }, - SVGFETileElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGFETileElement', - }, - SVGFETurbulenceElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGFETurbulenceElement', - }, - SVGFilterElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGFilterElement', - }, - SVGFilterPrimitiveStandardAttributes: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'SVGFilterPrimitiveStandardAttributes', - }, - SVGFitToViewBox: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'SVGFitToViewBox', - }, - SVGForeignObjectElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGForeignObjectElement', - }, - SVGGElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGGElement', - }, - SVGGeometryElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGGeometryElement', - }, - SVGGradientElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGGradientElement', - }, - SVGGraphicsElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGGraphicsElement', - }, - SVGImageElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGImageElement', - }, - SVGLength: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGLength', - }, - SVGLengthList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGLengthList', - }, - SVGLineElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGLineElement', - }, - SVGLinearGradientElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGLinearGradientElement', - }, - SVGMarkerElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGMarkerElement', - }, - SVGMaskElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGMaskElement', - }, - SVGMetadataElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGMetadataElement', - }, - SVGNumber: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGNumber', - }, - SVGNumberList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGNumberList', - }, - SVGPathElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGPathElement', - }, - SVGPathSeg: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGPathSeg', - }, - SVGPathSegArcAbs: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGPathSegArcAbs', - }, - SVGPathSegArcRel: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGPathSegArcRel', - }, - SVGPathSegClosePath: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGPathSegClosePath', - }, - SVGPathSegCurvetoCubicAbs: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGPathSegCurvetoCubicAbs', - }, - SVGPathSegCurvetoCubicRel: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGPathSegCurvetoCubicRel', - }, - SVGPathSegCurvetoCubicSmoothAbs: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGPathSegCurvetoCubicSmoothAbs', - }, - SVGPathSegCurvetoCubicSmoothRel: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGPathSegCurvetoCubicSmoothRel', - }, - SVGPathSegCurvetoQuadraticAbs: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGPathSegCurvetoQuadraticAbs', - }, - SVGPathSegCurvetoQuadraticRel: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGPathSegCurvetoQuadraticRel', - }, - SVGPathSegCurvetoQuadraticSmoothAbs: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGPathSegCurvetoQuadraticSmoothAbs', - }, - SVGPathSegCurvetoQuadraticSmoothRel: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGPathSegCurvetoQuadraticSmoothRel', - }, - SVGPathSegLinetoAbs: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGPathSegLinetoAbs', - }, - SVGPathSegLinetoHorizontalAbs: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGPathSegLinetoHorizontalAbs', - }, - SVGPathSegLinetoHorizontalRel: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGPathSegLinetoHorizontalRel', - }, - SVGPathSegLinetoRel: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGPathSegLinetoRel', - }, - SVGPathSegLinetoVerticalAbs: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGPathSegLinetoVerticalAbs', - }, - SVGPathSegLinetoVerticalRel: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGPathSegLinetoVerticalRel', - }, - SVGPathSegList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGPathSegList', - }, - SVGPathSegMovetoAbs: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGPathSegMovetoAbs', - }, - SVGPathSegMovetoRel: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGPathSegMovetoRel', - }, - SVGPatternElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGPatternElement', - }, - SVGPointList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGPointList', - }, - SVGPolygonElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGPolygonElement', - }, - SVGPolylineElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGPolylineElement', - }, - SVGPreserveAspectRatio: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGPreserveAspectRatio', - }, - SVGRadialGradientElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGRadialGradientElement', - }, - SVGRectElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGRectElement', - }, - SVGSVGElementEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'SVGSVGElementEventMap', - }, - SVGSVGElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGSVGElement', - }, - SVGScriptElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGScriptElement', - }, - SVGStopElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGStopElement', - }, - SVGStringList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGStringList', - }, - SVGStyleElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGStyleElement', - }, - SVGSwitchElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGSwitchElement', - }, - SVGSymbolElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGSymbolElement', - }, - SVGTSpanElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGTSpanElement', - }, - SVGTests: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'SVGTests', - }, - SVGTextContentElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGTextContentElement', - }, - SVGTextElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGTextElement', - }, - SVGTextPathElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGTextPathElement', - }, - SVGTextPositioningElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGTextPositioningElement', - }, - SVGTitleElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGTitleElement', - }, - SVGTransform: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGTransform', - }, - SVGTransformList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGTransformList', - }, - SVGURIReference: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'SVGURIReference', - }, - SVGUnitTypes: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGUnitTypes', - }, - SVGUseElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGUseElement', - }, - SVGViewElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGViewElement', - }, - SVGZoomAndPan: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGZoomAndPan', - }, - SVGZoomEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SVGZoomEvent', - }, - ScopedCredential: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ScopedCredential', - }, - ScopedCredentialInfo: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ScopedCredentialInfo', - }, - Screen: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Screen', - }, - ScreenOrientationEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ScreenOrientationEventMap', - }, - ScreenOrientation: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ScreenOrientation', - }, - ScriptProcessorNodeEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ScriptProcessorNodeEventMap', - }, - ScriptProcessorNode: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ScriptProcessorNode', - }, - SecurityPolicyViolationEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SecurityPolicyViolationEvent', - }, - Selection: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Selection', - }, - ServiceUIFrameContext: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ServiceUIFrameContext', - }, - ServiceWorkerEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ServiceWorkerEventMap', - }, - ServiceWorker: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ServiceWorker', - }, - ServiceWorkerContainerEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ServiceWorkerContainerEventMap', - }, - ServiceWorkerContainer: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ServiceWorkerContainer', - }, - ServiceWorkerMessageEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ServiceWorkerMessageEvent', - }, - ServiceWorkerRegistrationEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ServiceWorkerRegistrationEventMap', - }, - ServiceWorkerRegistration: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ServiceWorkerRegistration', - }, - ShadowRoot: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ShadowRoot', - }, - SharedWorker: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SharedWorker', - }, - Slottable: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Slottable', - }, - SourceBufferEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'SourceBufferEventMap', - }, - SourceBuffer: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SourceBuffer', - }, - SourceBufferListEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'SourceBufferListEventMap', - }, - SourceBufferList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SourceBufferList', - }, - SpeechGrammar: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SpeechGrammar', - }, - SpeechGrammarList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SpeechGrammarList', - }, - SpeechRecognitionEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'SpeechRecognitionEventMap', - }, - SpeechRecognition: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SpeechRecognition', - }, - SpeechRecognitionAlternative: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SpeechRecognitionAlternative', - }, - SpeechRecognitionErrorEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SpeechRecognitionErrorEvent', - }, - SpeechRecognitionEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SpeechRecognitionEvent', - }, - SpeechRecognitionResult: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SpeechRecognitionResult', - }, - SpeechRecognitionResultList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SpeechRecognitionResultList', - }, - SpeechSynthesisEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'SpeechSynthesisEventMap', - }, - SpeechSynthesis: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SpeechSynthesis', - }, - SpeechSynthesisErrorEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SpeechSynthesisErrorEvent', - }, - SpeechSynthesisEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SpeechSynthesisEvent', - }, - SpeechSynthesisUtteranceEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'SpeechSynthesisUtteranceEventMap', - }, - SpeechSynthesisUtterance: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SpeechSynthesisUtterance', - }, - SpeechSynthesisVoice: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SpeechSynthesisVoice', - }, - StaticRange: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'StaticRange', - }, - StereoPannerNode: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'StereoPannerNode', - }, - Storage: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Storage', - }, - StorageEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'StorageEvent', - }, - StorageManager: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'StorageManager', - }, - StyleMedia: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'StyleMedia', - }, - StyleSheet: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'StyleSheet', - }, - StyleSheetList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'StyleSheetList', - }, - SubtleCrypto: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SubtleCrypto', - }, - SyncManager: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SyncManager', - }, - Text: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Text', - }, - TextDecoder: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'TextDecoder', - }, - TextDecoderCommon: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'TextDecoderCommon', - }, - TextDecoderStream: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'TextDecoderStream', - }, - TextEncoder: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'TextEncoder', - }, - TextEncoderCommon: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'TextEncoderCommon', - }, - TextEncoderStream: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'TextEncoderStream', - }, - TextEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'TextEvent', - }, - TextMetrics: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'TextMetrics', - }, - TextTrackEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'TextTrackEventMap', - }, - TextTrack: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'TextTrack', - }, - TextTrackCueEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'TextTrackCueEventMap', - }, - TextTrackCue: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'TextTrackCue', - }, - TextTrackCueList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'TextTrackCueList', - }, - TextTrackListEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'TextTrackListEventMap', - }, - TextTrackList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'TextTrackList', - }, - TimeRanges: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'TimeRanges', - }, - Touch: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Touch', - }, - TouchEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'TouchEvent', - }, - TouchList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'TouchList', - }, - TrackEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'TrackEvent', - }, - TransformStream: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'TransformStream', - }, - TransformStreamDefaultController: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'TransformStreamDefaultController', - }, - TransitionEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'TransitionEvent', - }, - TreeWalker: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'TreeWalker', - }, - UIEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'UIEvent', - }, - URL: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'URL', - }, - webkitURL: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'webkitURL', - }, - URLSearchParams: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'URLSearchParams', - }, - VRDisplay: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'VRDisplay', - }, - VRDisplayCapabilities: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'VRDisplayCapabilities', - }, - VRDisplayEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'VRDisplayEvent', - }, - VREyeParameters: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'VREyeParameters', - }, - VRFieldOfView: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'VRFieldOfView', - }, - VRFrameData: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'VRFrameData', - }, - VRPose: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'VRPose', - }, - VTTCue: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'VTTCue', - }, - VTTRegion: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'VTTRegion', - }, - ValidityState: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ValidityState', - }, - VideoPlaybackQuality: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'VideoPlaybackQuality', - }, - VisualViewportEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'VisualViewportEventMap', - }, - VisualViewport: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'VisualViewport', - }, - WEBGL_color_buffer_float: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WEBGL_color_buffer_float', - }, - WEBGL_compressed_texture_astc: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WEBGL_compressed_texture_astc', - }, - WEBGL_compressed_texture_s3tc: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WEBGL_compressed_texture_s3tc', - }, - WEBGL_compressed_texture_s3tc_srgb: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WEBGL_compressed_texture_s3tc_srgb', - }, - WEBGL_debug_renderer_info: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WEBGL_debug_renderer_info', - }, - WEBGL_debug_shaders: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WEBGL_debug_shaders', - }, - WEBGL_depth_texture: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WEBGL_depth_texture', - }, - WEBGL_draw_buffers: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WEBGL_draw_buffers', - }, - WEBGL_lose_context: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WEBGL_lose_context', - }, - WaveShaperNode: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WaveShaperNode', - }, - WebAuthentication: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WebAuthentication', - }, - WebAuthnAssertion: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WebAuthnAssertion', - }, - WebGL2RenderingContext: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WebGL2RenderingContext', - }, - WebGL2RenderingContextBase: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WebGL2RenderingContextBase', - }, - WebGL2RenderingContextOverloads: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WebGL2RenderingContextOverloads', - }, - WebGLActiveInfo: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WebGLActiveInfo', - }, - WebGLBuffer: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WebGLBuffer', - }, - WebGLContextEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WebGLContextEvent', - }, - WebGLFramebuffer: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WebGLFramebuffer', - }, - WebGLObject: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WebGLObject', - }, - WebGLProgram: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WebGLProgram', - }, - WebGLQuery: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WebGLQuery', - }, - WebGLRenderbuffer: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WebGLRenderbuffer', - }, - WebGLRenderingContext: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WebGLRenderingContext', - }, - WebGLRenderingContextBase: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WebGLRenderingContextBase', - }, - WebGLRenderingContextOverloads: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WebGLRenderingContextOverloads', - }, - WebGLSampler: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WebGLSampler', - }, - WebGLShader: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WebGLShader', - }, - WebGLShaderPrecisionFormat: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WebGLShaderPrecisionFormat', - }, - WebGLSync: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WebGLSync', - }, - WebGLTexture: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WebGLTexture', - }, - WebGLTransformFeedback: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WebGLTransformFeedback', - }, - WebGLUniformLocation: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WebGLUniformLocation', - }, - WebGLVertexArrayObject: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WebGLVertexArrayObject', - }, - WebGLVertexArrayObjectOES: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WebGLVertexArrayObjectOES', - }, - WebKitPoint: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WebKitPoint', - }, - WebSocketEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WebSocketEventMap', - }, - WebSocket: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WebSocket', - }, - WheelEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WheelEvent', - }, - WindowEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WindowEventMap', - }, - Window: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Window', - }, - WindowEventHandlersEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WindowEventHandlersEventMap', - }, - WindowEventHandlers: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WindowEventHandlers', - }, - WindowLocalStorage: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WindowLocalStorage', - }, - WindowOrWorkerGlobalScope: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WindowOrWorkerGlobalScope', - }, - WindowSessionStorage: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WindowSessionStorage', - }, - WorkerEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WorkerEventMap', - }, - Worker: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Worker', - }, - Worklet: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Worklet', - }, - WritableStream: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WritableStream', - }, - WritableStreamDefaultController: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WritableStreamDefaultController', - }, - WritableStreamDefaultWriter: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WritableStreamDefaultWriter', - }, - XMLDocument: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'XMLDocument', - }, - XMLHttpRequestEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'XMLHttpRequestEventMap', - }, - XMLHttpRequest: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'XMLHttpRequest', - }, - XMLHttpRequestEventTargetEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'XMLHttpRequestEventTargetEventMap', - }, - XMLHttpRequestEventTarget: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'XMLHttpRequestEventTarget', - }, - XMLHttpRequestUpload: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'XMLHttpRequestUpload', - }, - XMLSerializer: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'XMLSerializer', - }, - XPathEvaluator: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'XPathEvaluator', - }, - XPathEvaluatorBase: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'XPathEvaluatorBase', - }, - XPathExpression: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'XPathExpression', - }, - XPathResult: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'XPathResult', - }, - XSLTProcessor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'XSLTProcessor', - }, - webkitRTCPeerConnection: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'webkitRTCPeerConnection', - }, - EventListenerOrEventListenerObject: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'EventListenerOrEventListenerObject', - }, - Console: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Console', - }, - CSS: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'CSS', - }, - WebAssembly: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WebAssembly', - }, - BlobCallback: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'BlobCallback', - }, - CustomElementConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CustomElementConstructor', - }, - DecodeErrorCallback: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DecodeErrorCallback', - }, - DecodeSuccessCallback: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DecodeSuccessCallback', - }, - EventHandlerNonNull: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'EventHandlerNonNull', - }, - ForEachCallback: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ForEachCallback', - }, - FrameRequestCallback: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'FrameRequestCallback', - }, - FunctionStringCallback: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'FunctionStringCallback', - }, - IntersectionObserverCallback: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'IntersectionObserverCallback', - }, - MSLaunchUriCallback: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MSLaunchUriCallback', - }, - MutationCallback: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MutationCallback', - }, - NavigatorUserMediaErrorCallback: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'NavigatorUserMediaErrorCallback', - }, - NavigatorUserMediaSuccessCallback: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'NavigatorUserMediaSuccessCallback', - }, - NotificationPermissionCallback: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'NotificationPermissionCallback', - }, - OnBeforeUnloadEventHandlerNonNull: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'OnBeforeUnloadEventHandlerNonNull', - }, - OnErrorEventHandlerNonNull: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'OnErrorEventHandlerNonNull', - }, - PerformanceObserverCallback: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PerformanceObserverCallback', - }, - PositionCallback: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PositionCallback', - }, - PositionErrorCallback: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PositionErrorCallback', - }, - QueuingStrategySize: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'QueuingStrategySize', - }, - RTCPeerConnectionErrorCallback: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCPeerConnectionErrorCallback', - }, - RTCSessionDescriptionCallback: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCSessionDescriptionCallback', - }, - RTCStatsCallback: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCStatsCallback', - }, - ResizeObserverCallback: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ResizeObserverCallback', - }, - TransformerFlushCallback: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'TransformerFlushCallback', - }, - TransformerStartCallback: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'TransformerStartCallback', - }, - TransformerTransformCallback: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'TransformerTransformCallback', - }, - UnderlyingSinkAbortCallback: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'UnderlyingSinkAbortCallback', - }, - UnderlyingSinkCloseCallback: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'UnderlyingSinkCloseCallback', - }, - UnderlyingSinkStartCallback: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'UnderlyingSinkStartCallback', - }, - UnderlyingSinkWriteCallback: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'UnderlyingSinkWriteCallback', - }, - UnderlyingSourceCancelCallback: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'UnderlyingSourceCancelCallback', - }, - UnderlyingSourcePullCallback: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'UnderlyingSourcePullCallback', - }, - UnderlyingSourceStartCallback: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'UnderlyingSourceStartCallback', - }, - VoidFunction: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'VoidFunction', - }, - HTMLElementTagNameMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'HTMLElementTagNameMap', - }, - HTMLElementDeprecatedTagNameMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'HTMLElementDeprecatedTagNameMap', - }, - SVGElementTagNameMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'SVGElementTagNameMap', - }, - ElementTagNameMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ElementTagNameMap', - }, - HeadersInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'HeadersInit', - }, - BodyInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'BodyInit', - }, - RequestInfo: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RequestInfo', - }, - BlobPart: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'BlobPart', - }, - DOMHighResTimeStamp: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DOMHighResTimeStamp', - }, - RenderingContext: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RenderingContext', - }, - HTMLOrSVGImageElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'HTMLOrSVGImageElement', - }, - CanvasImageSource: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CanvasImageSource', - }, - OffscreenRenderingContext: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'OffscreenRenderingContext', - }, - MessageEventSource: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MessageEventSource', - }, - HTMLOrSVGScriptElement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'HTMLOrSVGScriptElement', - }, - ImageBitmapSource: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ImageBitmapSource', - }, - MediaProvider: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MediaProvider', - }, - OnErrorEventHandler: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'OnErrorEventHandler', - }, - OnBeforeUnloadEventHandler: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'OnBeforeUnloadEventHandler', - }, - TimerHandler: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'TimerHandler', - }, - ConstrainULong: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ConstrainULong', - }, - ConstrainDouble: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ConstrainDouble', - }, - ConstrainBoolean: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ConstrainBoolean', - }, - ConstrainDOMString: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ConstrainDOMString', - }, - PerformanceEntryList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PerformanceEntryList', - }, - ReadableStreamReader: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ReadableStreamReader', - }, - ReadableStreamController: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ReadableStreamController', - }, - VibratePattern: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'VibratePattern', - }, - COSEAlgorithmIdentifier: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'COSEAlgorithmIdentifier', - }, - UvmEntry: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'UvmEntry', - }, - UvmEntries: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'UvmEntries', - }, - AlgorithmIdentifier: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AlgorithmIdentifier', - }, - HashAlgorithmIdentifier: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'HashAlgorithmIdentifier', - }, - BigInteger: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'BigInteger', - }, - NamedCurve: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'NamedCurve', - }, - GLenum: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'GLenum', - }, - GLboolean: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'GLboolean', - }, - GLbitfield: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'GLbitfield', - }, - GLint: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'GLint', - }, - GLsizei: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'GLsizei', - }, - GLintptr: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'GLintptr', - }, - GLsizeiptr: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'GLsizeiptr', - }, - GLuint: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'GLuint', - }, - GLfloat: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'GLfloat', - }, - GLclampf: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'GLclampf', - }, - TexImageSource: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'TexImageSource', - }, - Float32List: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Float32List', - }, - Int32List: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Int32List', - }, - GLint64: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'GLint64', - }, - GLuint64: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'GLuint64', - }, - Uint32List: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Uint32List', - }, - BufferSource: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'BufferSource', - }, - DOMTimeStamp: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DOMTimeStamp', - }, - LineAndPositionSetting: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'LineAndPositionSetting', - }, - FormDataEntryValue: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'FormDataEntryValue', - }, - InsertPosition: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'InsertPosition', - }, - IDBValidKey: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'IDBValidKey', - }, - MutationRecordType: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MutationRecordType', - }, - IDBKeyPath: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'IDBKeyPath', - }, - Transferable: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Transferable', - }, - RTCIceGatherCandidate: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCIceGatherCandidate', - }, - RTCTransport: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCTransport', - }, - MouseWheelEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MouseWheelEvent', - }, - WindowProxy: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WindowProxy', - }, - ReadableStreamDefaultReadResult: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ReadableStreamDefaultReadResult', - }, - AlignSetting: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AlignSetting', - }, - AnimationPlayState: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AnimationPlayState', - }, - AppendMode: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AppendMode', - }, - AttestationConveyancePreference: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AttestationConveyancePreference', - }, - AudioContextLatencyCategory: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AudioContextLatencyCategory', - }, - AudioContextState: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AudioContextState', - }, - AuthenticatorAttachment: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AuthenticatorAttachment', - }, - AuthenticatorTransport: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AuthenticatorTransport', - }, - AutoKeyword: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AutoKeyword', - }, - AutomationRate: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AutomationRate', - }, - BinaryType: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'BinaryType', - }, - BiquadFilterType: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'BiquadFilterType', - }, - CanPlayTypeResult: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CanPlayTypeResult', - }, - CanvasDirection: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CanvasDirection', - }, - CanvasFillRule: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CanvasFillRule', - }, - CanvasLineCap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CanvasLineCap', - }, - CanvasLineJoin: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CanvasLineJoin', - }, - CanvasTextAlign: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CanvasTextAlign', - }, - CanvasTextBaseline: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CanvasTextBaseline', - }, - ChannelCountMode: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ChannelCountMode', - }, - ChannelInterpretation: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ChannelInterpretation', - }, - ClientTypes: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ClientTypes', - }, - ColorSpaceConversion: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ColorSpaceConversion', - }, - CompositeOperation: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CompositeOperation', - }, - CompositeOperationOrAuto: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CompositeOperationOrAuto', - }, - CredentialMediationRequirement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CredentialMediationRequirement', - }, - DOMParserSupportedType: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DOMParserSupportedType', - }, - DirectionSetting: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DirectionSetting', - }, - DisplayCaptureSurfaceType: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DisplayCaptureSurfaceType', - }, - DistanceModelType: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DistanceModelType', - }, - DocumentReadyState: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DocumentReadyState', - }, - EndOfStreamError: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'EndOfStreamError', - }, - EndingType: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'EndingType', - }, - FillMode: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'FillMode', - }, - FullscreenNavigationUI: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'FullscreenNavigationUI', - }, - GamepadHand: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'GamepadHand', - }, - GamepadHapticActuatorType: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'GamepadHapticActuatorType', - }, - GamepadMappingType: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'GamepadMappingType', - }, - IDBCursorDirection: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'IDBCursorDirection', - }, - IDBRequestReadyState: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'IDBRequestReadyState', - }, - IDBTransactionMode: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'IDBTransactionMode', - }, - ImageOrientation: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ImageOrientation', - }, - ImageSmoothingQuality: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ImageSmoothingQuality', - }, - IterationCompositeOperation: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'IterationCompositeOperation', - }, - KeyFormat: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'KeyFormat', - }, - KeyType: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'KeyType', - }, - KeyUsage: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'KeyUsage', - }, - LineAlignSetting: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'LineAlignSetting', - }, - ListeningState: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ListeningState', - }, - MSCredentialType: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MSCredentialType', - }, - MSTransportType: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MSTransportType', - }, - MSWebViewPermissionState: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MSWebViewPermissionState', - }, - MSWebViewPermissionType: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MSWebViewPermissionType', - }, - MediaDeviceKind: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MediaDeviceKind', - }, - MediaKeyMessageType: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MediaKeyMessageType', - }, - MediaKeySessionType: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MediaKeySessionType', - }, - MediaKeyStatus: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MediaKeyStatus', - }, - MediaKeysRequirement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MediaKeysRequirement', - }, - MediaStreamTrackState: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MediaStreamTrackState', - }, - NavigationReason: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'NavigationReason', - }, - NavigationType: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'NavigationType', - }, - NotificationDirection: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'NotificationDirection', - }, - NotificationPermission: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'NotificationPermission', - }, - OffscreenRenderingContextId: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'OffscreenRenderingContextId', - }, - OrientationLockType: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'OrientationLockType', - }, - OrientationType: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'OrientationType', - }, - OscillatorType: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'OscillatorType', - }, - OverSampleType: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'OverSampleType', - }, - PanningModelType: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PanningModelType', - }, - PaymentComplete: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PaymentComplete', - }, - PaymentShippingType: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PaymentShippingType', - }, - PermissionName: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PermissionName', - }, - PermissionState: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PermissionState', - }, - PlaybackDirection: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PlaybackDirection', - }, - PositionAlignSetting: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PositionAlignSetting', - }, - PremultiplyAlpha: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PremultiplyAlpha', - }, - PublicKeyCredentialType: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PublicKeyCredentialType', - }, - PushEncryptionKeyName: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PushEncryptionKeyName', - }, - PushPermissionState: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PushPermissionState', - }, - RTCBundlePolicy: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCBundlePolicy', - }, - RTCDataChannelState: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCDataChannelState', - }, - RTCDegradationPreference: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCDegradationPreference', - }, - RTCDtlsRole: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCDtlsRole', - }, - RTCDtlsTransportState: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCDtlsTransportState', - }, - RTCDtxStatus: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCDtxStatus', - }, - RTCErrorDetailType: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCErrorDetailType', - }, - RTCIceCandidateType: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCIceCandidateType', - }, - RTCIceComponent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCIceComponent', - }, - RTCIceConnectionState: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCIceConnectionState', - }, - RTCIceCredentialType: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCIceCredentialType', - }, - RTCIceGatherPolicy: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCIceGatherPolicy', - }, - RTCIceGathererState: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCIceGathererState', - }, - RTCIceGatheringState: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCIceGatheringState', - }, - RTCIceProtocol: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCIceProtocol', - }, - RTCIceRole: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCIceRole', - }, - RTCIceTcpCandidateType: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCIceTcpCandidateType', - }, - RTCIceTransportPolicy: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCIceTransportPolicy', - }, - RTCIceTransportState: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCIceTransportState', - }, - RTCPeerConnectionState: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCPeerConnectionState', - }, - RTCPriorityType: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCPriorityType', - }, - RTCRtcpMuxPolicy: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCRtcpMuxPolicy', - }, - RTCRtpTransceiverDirection: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCRtpTransceiverDirection', - }, - RTCSctpTransportState: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCSctpTransportState', - }, - RTCSdpType: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCSdpType', - }, - RTCSignalingState: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCSignalingState', - }, - RTCStatsIceCandidatePairState: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCStatsIceCandidatePairState', - }, - RTCStatsIceCandidateType: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCStatsIceCandidateType', - }, - RTCStatsType: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RTCStatsType', - }, - ReadyState: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ReadyState', - }, - ReferrerPolicy: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ReferrerPolicy', - }, - RequestCache: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RequestCache', - }, - RequestCredentials: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RequestCredentials', - }, - RequestDestination: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RequestDestination', - }, - RequestMode: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RequestMode', - }, - RequestRedirect: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RequestRedirect', - }, - ResidentKeyRequirement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ResidentKeyRequirement', - }, - ResizeObserverBoxOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ResizeObserverBoxOptions', - }, - ResizeQuality: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ResizeQuality', - }, - ResponseType: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ResponseType', - }, - ScopedCredentialType: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ScopedCredentialType', - }, - ScrollBehavior: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ScrollBehavior', - }, - ScrollLogicalPosition: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ScrollLogicalPosition', - }, - ScrollRestoration: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ScrollRestoration', - }, - ScrollSetting: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ScrollSetting', - }, - SelectionMode: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'SelectionMode', - }, - ServiceWorkerState: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ServiceWorkerState', - }, - ServiceWorkerUpdateViaCache: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ServiceWorkerUpdateViaCache', - }, - ShadowRootMode: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ShadowRootMode', - }, - SpeechRecognitionErrorCode: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'SpeechRecognitionErrorCode', - }, - SpeechSynthesisErrorCode: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'SpeechSynthesisErrorCode', - }, - TextTrackKind: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'TextTrackKind', - }, - TextTrackMode: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'TextTrackMode', - }, - TouchType: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'TouchType', - }, - Transport: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Transport', - }, - UserVerificationRequirement: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'UserVerificationRequirement', - }, - VRDisplayEventReason: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'VRDisplayEventReason', - }, - VideoFacingModeEnum: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'VideoFacingModeEnum', - }, - VisibilityState: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'VisibilityState', - }, - WebGLPowerPreference: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WebGLPowerPreference', - }, - WorkerType: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WorkerType', - }, - XMLHttpRequestResponseType: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'XMLHttpRequestResponseType', - }, + AddEventListenerOptions: TYPE, + AddressErrors: TYPE, + AesCbcParams: TYPE, + AesCtrParams: TYPE, + AesDerivedKeyParams: TYPE, + AesGcmParams: TYPE, + AesKeyAlgorithm: TYPE, + AesKeyGenParams: TYPE, + Algorithm: TYPE, + AnalyserOptions: TYPE, + AnimationEventInit: TYPE, + AnimationPlaybackEventInit: TYPE, + AssignedNodesOptions: TYPE, + AudioBufferOptions: TYPE, + AudioBufferSourceOptions: TYPE, + AudioContextInfo: TYPE, + AudioContextOptions: TYPE, + AudioNodeOptions: TYPE, + AudioParamDescriptor: TYPE, + AudioProcessingEventInit: TYPE, + AudioTimestamp: TYPE, + AudioWorkletNodeOptions: TYPE, + AuthenticationExtensionsClientInputs: TYPE, + AuthenticationExtensionsClientOutputs: TYPE, + AuthenticatorSelectionCriteria: TYPE, + BiquadFilterOptions: TYPE, + BlobPropertyBag: TYPE, + ByteLengthChunk: TYPE, + CacheQueryOptions: TYPE, + CanvasRenderingContext2DSettings: TYPE, + ChannelMergerOptions: TYPE, + ChannelSplitterOptions: TYPE, + ClientQueryOptions: TYPE, + ClipboardEventInit: TYPE, + CloseEventInit: TYPE, + CompositionEventInit: TYPE, + ComputedEffectTiming: TYPE, + ComputedKeyframe: TYPE, + ConfirmSiteSpecificExceptionsInformation: TYPE, + ConstantSourceOptions: TYPE, + ConstrainBooleanParameters: TYPE, + ConstrainDOMStringParameters: TYPE, + ConstrainDoubleRange: TYPE, + ConstrainULongRange: TYPE, + ConstrainVideoFacingModeParameters: TYPE, + ConvolverOptions: TYPE, + CredentialCreationOptions: TYPE, + CredentialPropertiesOutput: TYPE, + CredentialRequestOptions: TYPE, + CustomEventInit: TYPE, + DOMMatrix2DInit: TYPE, + DOMMatrixInit: TYPE, + DOMPointInit: TYPE, + DOMQuadInit: TYPE, + DOMRectInit: TYPE, + DelayOptions: TYPE, + DeviceMotionEventAccelerationInit: TYPE, + DeviceMotionEventInit: TYPE, + DeviceMotionEventRotationRateInit: TYPE, + DeviceOrientationEventInit: TYPE, + DevicePermissionDescriptor: TYPE, + DocumentTimelineOptions: TYPE, + DoubleRange: TYPE, + DragEventInit: TYPE, + DynamicsCompressorOptions: TYPE, + EcKeyAlgorithm: TYPE, + EcKeyGenParams: TYPE, + EcKeyImportParams: TYPE, + EcdhKeyDeriveParams: TYPE, + EcdsaParams: TYPE, + EffectTiming: TYPE, + ElementCreationOptions: TYPE, + ElementDefinitionOptions: TYPE, + ErrorEventInit: TYPE, + EventInit: TYPE, + EventListenerOptions: TYPE, + EventModifierInit: TYPE, + EventSourceInit: TYPE, + ExceptionInformation: TYPE, + FilePropertyBag: TYPE, + FocusEventInit: TYPE, + FocusNavigationEventInit: TYPE, + FocusNavigationOrigin: TYPE, + FocusOptions: TYPE, + FullscreenOptions: TYPE, + GainOptions: TYPE, + GamepadEventInit: TYPE, + GetNotificationOptions: TYPE, + GetRootNodeOptions: TYPE, + HashChangeEventInit: TYPE, + HkdfParams: TYPE, + HmacImportParams: TYPE, + HmacKeyAlgorithm: TYPE, + HmacKeyGenParams: TYPE, + IDBIndexParameters: TYPE, + IDBObjectStoreParameters: TYPE, + IDBVersionChangeEventInit: TYPE, + IIRFilterOptions: TYPE, + ImageBitmapOptions: TYPE, + ImageBitmapRenderingContextSettings: TYPE, + ImageEncodeOptions: TYPE, + ImportMeta: TYPE, + InputEventInit: TYPE, + IntersectionObserverEntryInit: TYPE, + IntersectionObserverInit: TYPE, + JsonWebKey: TYPE, + KeyAlgorithm: TYPE, + KeyboardEventInit: TYPE, + Keyframe: TYPE, + KeyframeAnimationOptions: TYPE, + KeyframeEffectOptions: TYPE, + MediaElementAudioSourceOptions: TYPE, + MediaEncryptedEventInit: TYPE, + MediaKeyMessageEventInit: TYPE, + MediaKeySystemConfiguration: TYPE, + MediaKeySystemMediaCapability: TYPE, + MediaQueryListEventInit: TYPE, + MediaStreamAudioSourceOptions: TYPE, + MediaStreamConstraints: TYPE, + MediaStreamErrorEventInit: TYPE, + MediaStreamEventInit: TYPE, + MediaStreamTrackAudioSourceOptions: TYPE, + MediaStreamTrackEventInit: TYPE, + MediaTrackCapabilities: TYPE, + MediaTrackConstraintSet: TYPE, + MediaTrackConstraints: TYPE, + MediaTrackSettings: TYPE, + MediaTrackSupportedConstraints: TYPE, + MessageEventInit: TYPE, + MidiPermissionDescriptor: TYPE, + MouseEventInit: TYPE, + MultiCacheQueryOptions: TYPE, + MutationObserverInit: TYPE, + NavigationPreloadState: TYPE, + NotificationAction: TYPE, + NotificationOptions: TYPE, + OfflineAudioCompletionEventInit: TYPE, + OfflineAudioContextOptions: TYPE, + OptionalEffectTiming: TYPE, + OscillatorOptions: TYPE, + PageTransitionEventInit: TYPE, + PannerOptions: TYPE, + PayerErrors: TYPE, + PaymentCurrencyAmount: TYPE, + PaymentDetailsBase: TYPE, + PaymentDetailsInit: TYPE, + PaymentDetailsModifier: TYPE, + PaymentDetailsUpdate: TYPE, + PaymentItem: TYPE, + PaymentMethodChangeEventInit: TYPE, + PaymentMethodData: TYPE, + PaymentOptions: TYPE, + PaymentRequestUpdateEventInit: TYPE, + PaymentShippingOption: TYPE, + PaymentValidationErrors: TYPE, + Pbkdf2Params: TYPE, + PerformanceObserverInit: TYPE, + PeriodicWaveConstraints: TYPE, + PeriodicWaveOptions: TYPE, + PermissionDescriptor: TYPE, + PointerEventInit: TYPE, + PopStateEventInit: TYPE, + PositionOptions: TYPE, + PostMessageOptions: TYPE, + ProgressEventInit: TYPE, + PromiseRejectionEventInit: TYPE, + PropertyIndexedKeyframes: TYPE, + PublicKeyCredentialCreationOptions: TYPE, + PublicKeyCredentialDescriptor: TYPE, + PublicKeyCredentialEntity: TYPE, + PublicKeyCredentialParameters: TYPE, + PublicKeyCredentialRequestOptions: TYPE, + PublicKeyCredentialRpEntity: TYPE, + PublicKeyCredentialUserEntity: TYPE, + PushPermissionDescriptor: TYPE, + PushSubscriptionJSON: TYPE, + PushSubscriptionOptionsInit: TYPE, + QueuingStrategy: TYPE, + QueuingStrategyInit: TYPE, + RTCAnswerOptions: TYPE, + RTCCertificateExpiration: TYPE, + RTCConfiguration: TYPE, + RTCDTMFToneChangeEventInit: TYPE, + RTCDataChannelEventInit: TYPE, + RTCDataChannelInit: TYPE, + RTCDtlsFingerprint: TYPE, + RTCDtlsParameters: TYPE, + RTCErrorEventInit: TYPE, + RTCErrorInit: TYPE, + RTCIceCandidateAttributes: TYPE, + RTCIceCandidateComplete: TYPE, + RTCIceCandidateDictionary: TYPE, + RTCIceCandidateInit: TYPE, + RTCIceCandidatePair: TYPE, + RTCIceCandidatePairStats: TYPE, + RTCIceGatherOptions: TYPE, + RTCIceParameters: TYPE, + RTCIceServer: TYPE, + RTCIdentityProviderOptions: TYPE, + RTCInboundRTPStreamStats: TYPE, + RTCLocalSessionDescriptionInit: TYPE, + RTCMediaStreamTrackStats: TYPE, + RTCOfferAnswerOptions: TYPE, + RTCOfferOptions: TYPE, + RTCOutboundRTPStreamStats: TYPE, + RTCPeerConnectionIceErrorEventInit: TYPE, + RTCPeerConnectionIceEventInit: TYPE, + RTCRTPStreamStats: TYPE, + RTCRtcpFeedback: TYPE, + RTCRtcpParameters: TYPE, + RTCRtpCapabilities: TYPE, + RTCRtpCodecCapability: TYPE, + RTCRtpCodecParameters: TYPE, + RTCRtpCodingParameters: TYPE, + RTCRtpContributingSource: TYPE, + RTCRtpEncodingParameters: TYPE, + RTCRtpFecParameters: TYPE, + RTCRtpHeaderExtension: TYPE, + RTCRtpHeaderExtensionCapability: TYPE, + RTCRtpHeaderExtensionParameters: TYPE, + RTCRtpParameters: TYPE, + RTCRtpReceiveParameters: TYPE, + RTCRtpRtxParameters: TYPE, + RTCRtpSendParameters: TYPE, + RTCRtpSynchronizationSource: TYPE, + RTCRtpTransceiverInit: TYPE, + RTCRtpUnhandled: TYPE, + RTCSessionDescriptionInit: TYPE, + RTCSrtpKeyParam: TYPE, + RTCSrtpSdesParameters: TYPE, + RTCSsrcRange: TYPE, + RTCStats: TYPE, + RTCStatsReport: TYPE_VALUE, + RTCTrackEventInit: TYPE, + RTCTransportStats: TYPE, + ReadableStreamDefaultReadDoneResult: TYPE, + ReadableStreamDefaultReadValueResult: TYPE, + ReadableWritablePair: TYPE, + RegistrationOptions: TYPE, + RequestInit: TYPE, + ResizeObserverOptions: TYPE, + ResponseInit: TYPE, + RsaHashedImportParams: TYPE, + RsaHashedKeyAlgorithm: TYPE, + RsaHashedKeyGenParams: TYPE, + RsaKeyAlgorithm: TYPE, + RsaKeyGenParams: TYPE, + RsaOaepParams: TYPE, + RsaOtherPrimesInfo: TYPE, + RsaPssParams: TYPE, + SVGBoundingBoxOptions: TYPE, + ScrollIntoViewOptions: TYPE, + ScrollOptions: TYPE, + ScrollToOptions: TYPE, + SecurityPolicyViolationEventInit: TYPE, + ShadowRootInit: TYPE, + ShareData: TYPE, + SpeechRecognitionErrorEventInit: TYPE, + SpeechRecognitionEventInit: TYPE, + SpeechSynthesisErrorEventInit: TYPE, + SpeechSynthesisEventInit: TYPE, + StaticRangeInit: TYPE, + StereoPannerOptions: TYPE, + StorageEstimate: TYPE, + StorageEventInit: TYPE, + StoreExceptionsInformation: TYPE, + StoreSiteSpecificExceptionsInformation: TYPE, + StreamPipeOptions: TYPE, + TextDecodeOptions: TYPE, + TextDecoderOptions: TYPE, + TextEncoderEncodeIntoResult: TYPE, + TouchEventInit: TYPE, + TouchInit: TYPE, + TrackEventInit: TYPE, + Transformer: TYPE, + TransitionEventInit: TYPE, + UIEventInit: TYPE, + ULongRange: TYPE, + UnderlyingSink: TYPE, + UnderlyingSource: TYPE, + VRDisplayEventInit: TYPE, + VRLayer: TYPE, + VRStageParameters: TYPE, + WaveShaperOptions: TYPE, + WebGLContextAttributes: TYPE, + WebGLContextEventInit: TYPE, + WheelEventInit: TYPE, + WorkerOptions: TYPE, + WorkletOptions: TYPE, + EventListener: TYPE, + XPathNSResolver: TYPE, + ANGLE_instanced_arrays: TYPE, + AbortController: TYPE_VALUE, + AbortSignalEventMap: TYPE, + AbortSignal: TYPE_VALUE, + AbstractRange: TYPE_VALUE, + AbstractWorkerEventMap: TYPE, + AbstractWorker: TYPE, + AesCfbParams: TYPE, + AesCmacParams: TYPE, + AnalyserNode: TYPE_VALUE, + Animatable: TYPE, + AnimationEventMap: TYPE, + Animation: TYPE_VALUE, + AnimationEffect: TYPE_VALUE, + AnimationEvent: TYPE_VALUE, + AnimationFrameProvider: TYPE, + AnimationPlaybackEvent: TYPE_VALUE, + AnimationTimeline: TYPE_VALUE, + ApplicationCacheEventMap: TYPE, + ApplicationCache: TYPE_VALUE, + Attr: TYPE_VALUE, + AudioBuffer: TYPE_VALUE, + AudioBufferSourceNode: TYPE_VALUE, + AudioContext: TYPE_VALUE, + AudioDestinationNode: TYPE_VALUE, + AudioListener: TYPE_VALUE, + AudioNode: TYPE_VALUE, + AudioParam: TYPE_VALUE, + AudioParamMap: TYPE_VALUE, + AudioProcessingEvent: TYPE_VALUE, + AudioScheduledSourceNodeEventMap: TYPE, + AudioScheduledSourceNode: TYPE_VALUE, + AudioWorklet: TYPE_VALUE, + AudioWorkletNodeEventMap: TYPE, + AudioWorkletNode: TYPE_VALUE, + AuthenticatorAssertionResponse: TYPE_VALUE, + AuthenticatorAttestationResponse: TYPE_VALUE, + AuthenticatorResponse: TYPE_VALUE, + BarProp: TYPE_VALUE, + BaseAudioContextEventMap: TYPE, + BaseAudioContext: TYPE_VALUE, + BeforeUnloadEvent: TYPE_VALUE, + BhxBrowser: TYPE_VALUE, + BiquadFilterNode: TYPE_VALUE, + Blob: TYPE_VALUE, + Body: TYPE, + BroadcastChannelEventMap: TYPE, + BroadcastChannel: TYPE_VALUE, + ByteLengthQueuingStrategy: TYPE_VALUE, + CDATASection: TYPE_VALUE, + CSSConditionRule: TYPE_VALUE, + CSSFontFaceRule: TYPE_VALUE, + CSSGroupingRule: TYPE_VALUE, + CSSImportRule: TYPE_VALUE, + CSSKeyframeRule: TYPE_VALUE, + CSSKeyframesRule: TYPE_VALUE, + CSSMediaRule: TYPE_VALUE, + CSSNamespaceRule: TYPE_VALUE, + CSSPageRule: TYPE_VALUE, + CSSRule: TYPE_VALUE, + CSSRuleList: TYPE_VALUE, + CSSStyleDeclaration: TYPE_VALUE, + CSSStyleRule: TYPE_VALUE, + CSSStyleSheet: TYPE_VALUE, + CSSSupportsRule: TYPE_VALUE, + Cache: TYPE_VALUE, + CacheStorage: TYPE_VALUE, + CanvasCompositing: TYPE, + CanvasDrawImage: TYPE, + CanvasDrawPath: TYPE, + CanvasFillStrokeStyles: TYPE, + CanvasFilters: TYPE, + CanvasGradient: TYPE_VALUE, + CanvasImageData: TYPE, + CanvasImageSmoothing: TYPE, + CanvasPath: TYPE, + CanvasPathDrawingStyles: TYPE, + CanvasPattern: TYPE_VALUE, + CanvasRect: TYPE, + CanvasRenderingContext2D: TYPE_VALUE, + CanvasShadowStyles: TYPE, + CanvasState: TYPE, + CanvasText: TYPE, + CanvasTextDrawingStyles: TYPE, + CanvasTransform: TYPE, + CanvasUserInterface: TYPE, + CaretPosition: TYPE_VALUE, + ChannelMergerNode: TYPE_VALUE, + ChannelSplitterNode: TYPE_VALUE, + CharacterData: TYPE_VALUE, + ChildNode: TYPE, + ClientRect: TYPE_VALUE, + ClientRectList: TYPE_VALUE, + Clipboard: TYPE_VALUE, + ClipboardEvent: TYPE_VALUE, + CloseEvent: TYPE_VALUE, + Comment: TYPE_VALUE, + CompositionEvent: TYPE_VALUE, + ConcatParams: TYPE, + ConstantSourceNode: TYPE_VALUE, + ConvolverNode: TYPE_VALUE, + CountQueuingStrategy: TYPE_VALUE, + Credential: TYPE_VALUE, + CredentialsContainer: TYPE_VALUE, + Crypto: TYPE_VALUE, + CryptoKey: TYPE_VALUE, + CryptoKeyPair: TYPE_VALUE, + CustomElementRegistry: TYPE_VALUE, + CustomEvent: TYPE_VALUE, + DOMError: TYPE_VALUE, + DOMException: TYPE_VALUE, + DOMImplementation: TYPE_VALUE, + DOMMatrix: TYPE_VALUE, + SVGMatrix: TYPE_VALUE, + WebKitCSSMatrix: TYPE_VALUE, + DOMMatrixReadOnly: TYPE_VALUE, + DOMParser: TYPE_VALUE, + DOMPoint: TYPE_VALUE, + SVGPoint: TYPE_VALUE, + DOMPointReadOnly: TYPE_VALUE, + DOMQuad: TYPE_VALUE, + DOMRect: TYPE_VALUE, + SVGRect: TYPE_VALUE, + DOMRectList: TYPE_VALUE, + DOMRectReadOnly: TYPE_VALUE, + DOMSettableTokenList: TYPE_VALUE, + DOMStringList: TYPE_VALUE, + DOMStringMap: TYPE_VALUE, + DOMTokenList: TYPE_VALUE, + DataCue: TYPE_VALUE, + DataTransfer: TYPE_VALUE, + DataTransferItem: TYPE_VALUE, + DataTransferItemList: TYPE_VALUE, + DeferredPermissionRequest: TYPE_VALUE, + DelayNode: TYPE_VALUE, + DeviceAcceleration: TYPE_VALUE, + DeviceMotionEvent: TYPE_VALUE, + DeviceMotionEventAcceleration: TYPE, + DeviceMotionEventRotationRate: TYPE, + DeviceOrientationEvent: TYPE_VALUE, + DeviceRotationRate: TYPE_VALUE, + DhImportKeyParams: TYPE, + DhKeyAlgorithm: TYPE, + DhKeyDeriveParams: TYPE, + DhKeyGenParams: TYPE, + DocumentEventMap: TYPE, + Document: TYPE_VALUE, + DocumentAndElementEventHandlersEventMap: TYPE, + DocumentAndElementEventHandlers: TYPE, + DocumentEvent: TYPE, + DocumentFragment: TYPE_VALUE, + DocumentOrShadowRoot: TYPE, + DocumentTimeline: TYPE_VALUE, + DocumentType: TYPE_VALUE, + DragEvent: TYPE_VALUE, + DynamicsCompressorNode: TYPE_VALUE, + EXT_blend_minmax: TYPE, + EXT_frag_depth: TYPE, + EXT_sRGB: TYPE, + EXT_shader_texture_lod: TYPE, + EXT_texture_filter_anisotropic: TYPE, + ElementEventMap: TYPE, + Element: TYPE_VALUE, + ElementCSSInlineStyle: TYPE, + ElementContentEditable: TYPE, + ErrorEvent: TYPE_VALUE, + Event: TYPE_VALUE, + EventListenerObject: TYPE, + EventSourceEventMap: TYPE, + EventSource: TYPE_VALUE, + EventTarget: TYPE_VALUE, + ExtensionScriptApis: TYPE_VALUE, + External: TYPE_VALUE, + File: TYPE_VALUE, + FileList: TYPE_VALUE, + FileReaderEventMap: TYPE, + FileReader: TYPE_VALUE, + FocusEvent: TYPE_VALUE, + FocusNavigationEvent: TYPE_VALUE, + FormData: TYPE_VALUE, + GainNode: TYPE_VALUE, + Gamepad: TYPE_VALUE, + GamepadButton: TYPE_VALUE, + GamepadEvent: TYPE_VALUE, + GamepadHapticActuator: TYPE_VALUE, + GamepadPose: TYPE_VALUE, + GenericTransformStream: TYPE, + Geolocation: TYPE_VALUE, + GeolocationCoordinates: TYPE_VALUE, + GeolocationPosition: TYPE_VALUE, + GeolocationPositionError: TYPE_VALUE, + GlobalEventHandlersEventMap: TYPE, + GlobalEventHandlers: TYPE, + HTMLAllCollection: TYPE_VALUE, + HTMLAnchorElement: TYPE_VALUE, + HTMLAppletElement: TYPE_VALUE, + HTMLAreaElement: TYPE_VALUE, + HTMLAudioElement: TYPE_VALUE, + HTMLBRElement: TYPE_VALUE, + HTMLBaseElement: TYPE_VALUE, + HTMLBodyElementEventMap: TYPE, + HTMLBodyElement: TYPE_VALUE, + HTMLButtonElement: TYPE_VALUE, + HTMLCanvasElement: TYPE_VALUE, + HTMLCollectionBase: TYPE, + HTMLCollection: TYPE_VALUE, + HTMLCollectionOf: TYPE, + HTMLDListElement: TYPE_VALUE, + HTMLDataElement: TYPE_VALUE, + HTMLDataListElement: TYPE_VALUE, + HTMLDetailsElement: TYPE_VALUE, + HTMLDialogElement: TYPE_VALUE, + HTMLDirectoryElement: TYPE_VALUE, + HTMLDivElement: TYPE_VALUE, + HTMLDocument: TYPE_VALUE, + HTMLElementEventMap: TYPE, + HTMLElement: TYPE_VALUE, + HTMLEmbedElement: TYPE_VALUE, + HTMLFieldSetElement: TYPE_VALUE, + HTMLFontElement: TYPE_VALUE, + HTMLFormControlsCollection: TYPE_VALUE, + HTMLFormElement: TYPE_VALUE, + HTMLFrameElement: TYPE_VALUE, + HTMLFrameSetElementEventMap: TYPE, + HTMLFrameSetElement: TYPE_VALUE, + HTMLHRElement: TYPE_VALUE, + HTMLHeadElement: TYPE_VALUE, + HTMLHeadingElement: TYPE_VALUE, + HTMLHtmlElement: TYPE_VALUE, + HTMLHyperlinkElementUtils: TYPE, + HTMLIFrameElement: TYPE_VALUE, + HTMLImageElement: TYPE_VALUE, + HTMLInputElement: TYPE_VALUE, + HTMLLIElement: TYPE_VALUE, + HTMLLabelElement: TYPE_VALUE, + HTMLLegendElement: TYPE_VALUE, + HTMLLinkElement: TYPE_VALUE, + HTMLMapElement: TYPE_VALUE, + HTMLMarqueeElementEventMap: TYPE, + HTMLMarqueeElement: TYPE_VALUE, + HTMLMediaElementEventMap: TYPE, + HTMLMediaElement: TYPE_VALUE, + HTMLMenuElement: TYPE_VALUE, + HTMLMetaElement: TYPE_VALUE, + HTMLMeterElement: TYPE_VALUE, + HTMLModElement: TYPE_VALUE, + HTMLOListElement: TYPE_VALUE, + HTMLObjectElement: TYPE_VALUE, + HTMLOptGroupElement: TYPE_VALUE, + HTMLOptionElement: TYPE_VALUE, + HTMLOptionsCollection: TYPE_VALUE, + HTMLOrSVGElement: TYPE, + HTMLOutputElement: TYPE_VALUE, + HTMLParagraphElement: TYPE_VALUE, + HTMLParamElement: TYPE_VALUE, + HTMLPictureElement: TYPE_VALUE, + HTMLPreElement: TYPE_VALUE, + HTMLProgressElement: TYPE_VALUE, + HTMLQuoteElement: TYPE_VALUE, + HTMLScriptElement: TYPE_VALUE, + HTMLSelectElement: TYPE_VALUE, + HTMLSlotElement: TYPE_VALUE, + HTMLSourceElement: TYPE_VALUE, + HTMLSpanElement: TYPE_VALUE, + HTMLStyleElement: TYPE_VALUE, + HTMLTableCaptionElement: TYPE_VALUE, + HTMLTableCellElement: TYPE_VALUE, + HTMLTableColElement: TYPE_VALUE, + HTMLTableDataCellElement: TYPE_VALUE, + HTMLTableElement: TYPE_VALUE, + HTMLTableHeaderCellElement: TYPE_VALUE, + HTMLTableRowElement: TYPE_VALUE, + HTMLTableSectionElement: TYPE_VALUE, + HTMLTemplateElement: TYPE_VALUE, + HTMLTextAreaElement: TYPE_VALUE, + HTMLTimeElement: TYPE_VALUE, + HTMLTitleElement: TYPE_VALUE, + HTMLTrackElement: TYPE_VALUE, + HTMLUListElement: TYPE_VALUE, + HTMLUnknownElement: TYPE_VALUE, + HTMLVideoElement: TYPE_VALUE, + HashChangeEvent: TYPE_VALUE, + Headers: TYPE_VALUE, + History: TYPE_VALUE, + IDBArrayKey: TYPE, + IDBCursor: TYPE_VALUE, + IDBCursorWithValue: TYPE_VALUE, + IDBDatabaseEventMap: TYPE, + IDBDatabase: TYPE_VALUE, + IDBFactory: TYPE_VALUE, + IDBIndex: TYPE_VALUE, + IDBKeyRange: TYPE_VALUE, + IDBObjectStore: TYPE_VALUE, + IDBOpenDBRequestEventMap: TYPE, + IDBOpenDBRequest: TYPE_VALUE, + IDBRequestEventMap: TYPE, + IDBRequest: TYPE_VALUE, + IDBTransactionEventMap: TYPE, + IDBTransaction: TYPE_VALUE, + IDBVersionChangeEvent: TYPE_VALUE, + IIRFilterNode: TYPE_VALUE, + ImageBitmap: TYPE_VALUE, + ImageBitmapRenderingContext: TYPE_VALUE, + ImageData: TYPE_VALUE, + InnerHTML: TYPE, + InputDeviceInfo: TYPE_VALUE, + InputEvent: TYPE_VALUE, + IntersectionObserver: TYPE_VALUE, + IntersectionObserverEntry: TYPE_VALUE, + KeyboardEvent: TYPE_VALUE, + KeyframeEffect: TYPE_VALUE, + LinkStyle: TYPE, + ListeningStateChangedEvent: TYPE_VALUE, + Location: TYPE_VALUE, + MSAssertion: TYPE_VALUE, + MSBlobBuilder: TYPE_VALUE, + MSFIDOCredentialAssertion: TYPE_VALUE, + MSFIDOSignature: TYPE_VALUE, + MSFIDOSignatureAssertion: TYPE_VALUE, + MSFileSaver: TYPE, + MSGesture: TYPE_VALUE, + MSGraphicsTrust: TYPE_VALUE, + MSInputMethodContextEventMap: TYPE, + MSInputMethodContext: TYPE_VALUE, + MSMediaKeyError: TYPE_VALUE, + MSMediaKeySession: TYPE_VALUE, + MSMediaKeys: TYPE_VALUE, + MSNavigatorDoNotTrack: TYPE, + MSStream: TYPE_VALUE, + MediaDeviceInfo: TYPE_VALUE, + MediaDevicesEventMap: TYPE, + MediaDevices: TYPE_VALUE, + MediaElementAudioSourceNode: TYPE_VALUE, + MediaEncryptedEvent: TYPE_VALUE, + MediaError: TYPE_VALUE, + MediaKeyMessageEvent: TYPE_VALUE, + MediaKeySessionEventMap: TYPE, + MediaKeySession: TYPE_VALUE, + MediaKeyStatusMap: TYPE_VALUE, + MediaKeySystemAccess: TYPE_VALUE, + MediaKeys: TYPE_VALUE, + MediaList: TYPE_VALUE, + MediaQueryListEventMap: TYPE, + MediaQueryList: TYPE_VALUE, + MediaQueryListEvent: TYPE_VALUE, + MediaSourceEventMap: TYPE, + MediaSource: TYPE_VALUE, + MediaStreamEventMap: TYPE, + MediaStream: TYPE_VALUE, + MediaStreamAudioDestinationNode: TYPE_VALUE, + MediaStreamAudioSourceNode: TYPE_VALUE, + MediaStreamError: TYPE_VALUE, + MediaStreamErrorEvent: TYPE_VALUE, + MediaStreamEvent: TYPE_VALUE, + MediaStreamTrackEventMap: TYPE, + MediaStreamTrack: TYPE_VALUE, + MediaStreamTrackAudioSourceNode: TYPE_VALUE, + MediaStreamTrackEvent: TYPE_VALUE, + MessageChannel: TYPE_VALUE, + MessageEvent: TYPE_VALUE, + MessagePortEventMap: TYPE, + MessagePort: TYPE_VALUE, + MimeType: TYPE_VALUE, + MimeTypeArray: TYPE_VALUE, + MouseEvent: TYPE_VALUE, + MutationEvent: TYPE_VALUE, + MutationObserver: TYPE_VALUE, + MutationRecord: TYPE_VALUE, + NamedNodeMap: TYPE_VALUE, + NavigationPreloadManager: TYPE_VALUE, + Navigator: TYPE_VALUE, + NavigatorAutomationInformation: TYPE, + NavigatorBeacon: TYPE, + NavigatorConcurrentHardware: TYPE, + NavigatorContentUtils: TYPE, + NavigatorCookies: TYPE, + NavigatorID: TYPE, + NavigatorLanguage: TYPE, + NavigatorOnLine: TYPE, + NavigatorPlugins: TYPE, + NavigatorStorage: TYPE, + Node: TYPE_VALUE, + NodeFilter: TYPE_VALUE, + NodeIterator: TYPE_VALUE, + NodeList: TYPE_VALUE, + NodeListOf: TYPE, + NonDocumentTypeChildNode: TYPE, + NonElementParentNode: TYPE, + NotificationEventMap: TYPE, + Notification: TYPE_VALUE, + OES_element_index_uint: TYPE, + OES_standard_derivatives: TYPE, + OES_texture_float: TYPE, + OES_texture_float_linear: TYPE, + OES_texture_half_float: TYPE, + OES_texture_half_float_linear: TYPE, + OES_vertex_array_object: TYPE, + OfflineAudioCompletionEvent: TYPE_VALUE, + OfflineAudioContextEventMap: TYPE, + OfflineAudioContext: TYPE_VALUE, + OffscreenCanvas: TYPE_VALUE, + OffscreenCanvasRenderingContext2D: TYPE_VALUE, + OscillatorNode: TYPE_VALUE, + OverconstrainedError: TYPE_VALUE, + OverflowEvent: TYPE_VALUE, + PageTransitionEvent: TYPE_VALUE, + PannerNode: TYPE_VALUE, + ParentNode: TYPE, + Path2D: TYPE_VALUE, + PaymentAddress: TYPE_VALUE, + PaymentMethodChangeEvent: TYPE_VALUE, + PaymentRequestEventMap: TYPE, + PaymentRequest: TYPE_VALUE, + PaymentRequestUpdateEvent: TYPE_VALUE, + PaymentResponseEventMap: TYPE, + PaymentResponse: TYPE_VALUE, + PerfWidgetExternal: TYPE_VALUE, + PerformanceEventMap: TYPE, + Performance: TYPE_VALUE, + PerformanceEntry: TYPE_VALUE, + PerformanceMark: TYPE_VALUE, + PerformanceMeasure: TYPE_VALUE, + PerformanceNavigation: TYPE_VALUE, + PerformanceNavigationTiming: TYPE_VALUE, + PerformanceObserver: TYPE_VALUE, + PerformanceObserverEntryList: TYPE_VALUE, + PerformanceResourceTiming: TYPE_VALUE, + PerformanceTiming: TYPE_VALUE, + PeriodicWave: TYPE_VALUE, + PermissionRequest: TYPE_VALUE, + PermissionRequestedEvent: TYPE_VALUE, + PermissionStatusEventMap: TYPE, + PermissionStatus: TYPE_VALUE, + Permissions: TYPE_VALUE, + Plugin: TYPE_VALUE, + PluginArray: TYPE_VALUE, + PointerEvent: TYPE_VALUE, + PopStateEvent: TYPE_VALUE, + ProcessingInstruction: TYPE_VALUE, + ProgressEvent: TYPE_VALUE, + PromiseRejectionEvent: TYPE_VALUE, + PublicKeyCredential: TYPE_VALUE, + PushManager: TYPE_VALUE, + PushSubscription: TYPE_VALUE, + PushSubscriptionOptions: TYPE_VALUE, + RTCCertificate: TYPE_VALUE, + RTCDTMFSenderEventMap: TYPE, + RTCDTMFSender: TYPE_VALUE, + RTCDTMFToneChangeEvent: TYPE_VALUE, + RTCDataChannelEventMap: TYPE, + RTCDataChannel: TYPE_VALUE, + RTCDataChannelEvent: TYPE_VALUE, + RTCDtlsTransportEventMap: TYPE, + RTCDtlsTransport: TYPE_VALUE, + RTCDtlsTransportStateChangedEvent: TYPE_VALUE, + RTCDtmfSenderEventMap: TYPE, + RTCDtmfSender: TYPE_VALUE, + RTCError: TYPE_VALUE, + RTCErrorEvent: TYPE_VALUE, + RTCIceCandidate: TYPE_VALUE, + RTCIceCandidatePairChangedEvent: TYPE_VALUE, + RTCIceGathererEventMap: TYPE, + RTCIceGatherer: TYPE_VALUE, + RTCIceGathererEvent: TYPE_VALUE, + RTCIceTransportEventMap: TYPE, + RTCIceTransport: TYPE_VALUE, + RTCIceTransportStateChangedEvent: TYPE_VALUE, + RTCIdentityAssertion: TYPE_VALUE, + RTCPeerConnectionEventMap: TYPE, + RTCPeerConnection: TYPE_VALUE, + RTCPeerConnectionIceErrorEvent: TYPE_VALUE, + RTCPeerConnectionIceEvent: TYPE_VALUE, + RTCRtpReceiver: TYPE_VALUE, + RTCRtpSender: TYPE_VALUE, + RTCRtpTransceiver: TYPE_VALUE, + RTCSctpTransportEventMap: TYPE, + RTCSctpTransport: TYPE_VALUE, + RTCSessionDescription: TYPE_VALUE, + RTCSrtpSdesTransportEventMap: TYPE, + RTCSrtpSdesTransport: TYPE_VALUE, + RTCSsrcConflictEvent: TYPE_VALUE, + RTCStatsProvider: TYPE_VALUE, + RTCTrackEvent: TYPE_VALUE, + RadioNodeList: TYPE_VALUE, + RandomSource: TYPE_VALUE, + Range: TYPE_VALUE, + ReadableStream: TYPE_VALUE, + ReadableStreamDefaultController: TYPE_VALUE, + ReadableStreamDefaultReader: TYPE_VALUE, + ReadableStreamGenericReader: TYPE, + Request: TYPE_VALUE, + ResizeObserver: TYPE_VALUE, + ResizeObserverEntry: TYPE_VALUE, + ResizeObserverSize: TYPE_VALUE, + Response: TYPE_VALUE, + SVGAElement: TYPE_VALUE, + SVGAngle: TYPE_VALUE, + SVGAnimateElement: TYPE_VALUE, + SVGAnimateMotionElement: TYPE_VALUE, + SVGAnimateTransformElement: TYPE_VALUE, + SVGAnimatedAngle: TYPE_VALUE, + SVGAnimatedBoolean: TYPE_VALUE, + SVGAnimatedEnumeration: TYPE_VALUE, + SVGAnimatedInteger: TYPE_VALUE, + SVGAnimatedLength: TYPE_VALUE, + SVGAnimatedLengthList: TYPE_VALUE, + SVGAnimatedNumber: TYPE_VALUE, + SVGAnimatedNumberList: TYPE_VALUE, + SVGAnimatedPoints: TYPE, + SVGAnimatedPreserveAspectRatio: TYPE_VALUE, + SVGAnimatedRect: TYPE_VALUE, + SVGAnimatedString: TYPE_VALUE, + SVGAnimatedTransformList: TYPE_VALUE, + SVGAnimationElement: TYPE_VALUE, + SVGCircleElement: TYPE_VALUE, + SVGClipPathElement: TYPE_VALUE, + SVGComponentTransferFunctionElement: TYPE_VALUE, + SVGCursorElement: TYPE_VALUE, + SVGDefsElement: TYPE_VALUE, + SVGDescElement: TYPE_VALUE, + SVGElementEventMap: TYPE, + SVGElement: TYPE_VALUE, + SVGElementInstance: TYPE_VALUE, + SVGElementInstanceList: TYPE_VALUE, + SVGEllipseElement: TYPE_VALUE, + SVGFEBlendElement: TYPE_VALUE, + SVGFEColorMatrixElement: TYPE_VALUE, + SVGFEComponentTransferElement: TYPE_VALUE, + SVGFECompositeElement: TYPE_VALUE, + SVGFEConvolveMatrixElement: TYPE_VALUE, + SVGFEDiffuseLightingElement: TYPE_VALUE, + SVGFEDisplacementMapElement: TYPE_VALUE, + SVGFEDistantLightElement: TYPE_VALUE, + SVGFEDropShadowElement: TYPE_VALUE, + SVGFEFloodElement: TYPE_VALUE, + SVGFEFuncAElement: TYPE_VALUE, + SVGFEFuncBElement: TYPE_VALUE, + SVGFEFuncGElement: TYPE_VALUE, + SVGFEFuncRElement: TYPE_VALUE, + SVGFEGaussianBlurElement: TYPE_VALUE, + SVGFEImageElement: TYPE_VALUE, + SVGFEMergeElement: TYPE_VALUE, + SVGFEMergeNodeElement: TYPE_VALUE, + SVGFEMorphologyElement: TYPE_VALUE, + SVGFEOffsetElement: TYPE_VALUE, + SVGFEPointLightElement: TYPE_VALUE, + SVGFESpecularLightingElement: TYPE_VALUE, + SVGFESpotLightElement: TYPE_VALUE, + SVGFETileElement: TYPE_VALUE, + SVGFETurbulenceElement: TYPE_VALUE, + SVGFilterElement: TYPE_VALUE, + SVGFilterPrimitiveStandardAttributes: TYPE, + SVGFitToViewBox: TYPE, + SVGForeignObjectElement: TYPE_VALUE, + SVGGElement: TYPE_VALUE, + SVGGeometryElement: TYPE_VALUE, + SVGGradientElement: TYPE_VALUE, + SVGGraphicsElement: TYPE_VALUE, + SVGImageElement: TYPE_VALUE, + SVGLength: TYPE_VALUE, + SVGLengthList: TYPE_VALUE, + SVGLineElement: TYPE_VALUE, + SVGLinearGradientElement: TYPE_VALUE, + SVGMarkerElement: TYPE_VALUE, + SVGMaskElement: TYPE_VALUE, + SVGMetadataElement: TYPE_VALUE, + SVGNumber: TYPE_VALUE, + SVGNumberList: TYPE_VALUE, + SVGPathElement: TYPE_VALUE, + SVGPathSeg: TYPE_VALUE, + SVGPathSegArcAbs: TYPE_VALUE, + SVGPathSegArcRel: TYPE_VALUE, + SVGPathSegClosePath: TYPE_VALUE, + SVGPathSegCurvetoCubicAbs: TYPE_VALUE, + SVGPathSegCurvetoCubicRel: TYPE_VALUE, + SVGPathSegCurvetoCubicSmoothAbs: TYPE_VALUE, + SVGPathSegCurvetoCubicSmoothRel: TYPE_VALUE, + SVGPathSegCurvetoQuadraticAbs: TYPE_VALUE, + SVGPathSegCurvetoQuadraticRel: TYPE_VALUE, + SVGPathSegCurvetoQuadraticSmoothAbs: TYPE_VALUE, + SVGPathSegCurvetoQuadraticSmoothRel: TYPE_VALUE, + SVGPathSegLinetoAbs: TYPE_VALUE, + SVGPathSegLinetoHorizontalAbs: TYPE_VALUE, + SVGPathSegLinetoHorizontalRel: TYPE_VALUE, + SVGPathSegLinetoRel: TYPE_VALUE, + SVGPathSegLinetoVerticalAbs: TYPE_VALUE, + SVGPathSegLinetoVerticalRel: TYPE_VALUE, + SVGPathSegList: TYPE_VALUE, + SVGPathSegMovetoAbs: TYPE_VALUE, + SVGPathSegMovetoRel: TYPE_VALUE, + SVGPatternElement: TYPE_VALUE, + SVGPointList: TYPE_VALUE, + SVGPolygonElement: TYPE_VALUE, + SVGPolylineElement: TYPE_VALUE, + SVGPreserveAspectRatio: TYPE_VALUE, + SVGRadialGradientElement: TYPE_VALUE, + SVGRectElement: TYPE_VALUE, + SVGSVGElementEventMap: TYPE, + SVGSVGElement: TYPE_VALUE, + SVGScriptElement: TYPE_VALUE, + SVGStopElement: TYPE_VALUE, + SVGStringList: TYPE_VALUE, + SVGStyleElement: TYPE_VALUE, + SVGSwitchElement: TYPE_VALUE, + SVGSymbolElement: TYPE_VALUE, + SVGTSpanElement: TYPE_VALUE, + SVGTests: TYPE, + SVGTextContentElement: TYPE_VALUE, + SVGTextElement: TYPE_VALUE, + SVGTextPathElement: TYPE_VALUE, + SVGTextPositioningElement: TYPE_VALUE, + SVGTitleElement: TYPE_VALUE, + SVGTransform: TYPE_VALUE, + SVGTransformList: TYPE_VALUE, + SVGURIReference: TYPE, + SVGUnitTypes: TYPE_VALUE, + SVGUseElement: TYPE_VALUE, + SVGViewElement: TYPE_VALUE, + SVGZoomAndPan: TYPE, + SVGZoomEvent: TYPE_VALUE, + Screen: TYPE_VALUE, + ScreenOrientationEventMap: TYPE, + ScreenOrientation: TYPE_VALUE, + ScriptProcessorNodeEventMap: TYPE, + ScriptProcessorNode: TYPE_VALUE, + SecurityPolicyViolationEvent: TYPE_VALUE, + Selection: TYPE_VALUE, + ServiceUIFrameContext: TYPE_VALUE, + ServiceWorkerEventMap: TYPE, + ServiceWorker: TYPE_VALUE, + ServiceWorkerContainerEventMap: TYPE, + ServiceWorkerContainer: TYPE_VALUE, + ServiceWorkerRegistrationEventMap: TYPE, + ServiceWorkerRegistration: TYPE_VALUE, + ShadowRoot: TYPE_VALUE, + SharedWorker: TYPE_VALUE, + Slottable: TYPE, + SourceBufferEventMap: TYPE, + SourceBuffer: TYPE_VALUE, + SourceBufferListEventMap: TYPE, + SourceBufferList: TYPE_VALUE, + SpeechGrammar: TYPE_VALUE, + SpeechGrammarList: TYPE_VALUE, + SpeechRecognitionEventMap: TYPE, + SpeechRecognition: TYPE_VALUE, + SpeechRecognitionAlternative: TYPE_VALUE, + SpeechRecognitionErrorEvent: TYPE_VALUE, + SpeechRecognitionEvent: TYPE_VALUE, + SpeechRecognitionResult: TYPE_VALUE, + SpeechRecognitionResultList: TYPE_VALUE, + SpeechSynthesisEventMap: TYPE, + SpeechSynthesis: TYPE_VALUE, + SpeechSynthesisErrorEvent: TYPE_VALUE, + SpeechSynthesisEvent: TYPE_VALUE, + SpeechSynthesisUtteranceEventMap: TYPE, + SpeechSynthesisUtterance: TYPE_VALUE, + SpeechSynthesisVoice: TYPE_VALUE, + StaticRange: TYPE_VALUE, + StereoPannerNode: TYPE_VALUE, + Storage: TYPE_VALUE, + StorageEvent: TYPE_VALUE, + StorageManager: TYPE_VALUE, + StyleMedia: TYPE_VALUE, + StyleSheet: TYPE_VALUE, + StyleSheetList: TYPE_VALUE, + SubtleCrypto: TYPE_VALUE, + SyncManager: TYPE_VALUE, + Text: TYPE_VALUE, + TextDecoder: TYPE_VALUE, + TextDecoderCommon: TYPE, + TextDecoderStream: TYPE_VALUE, + TextEncoder: TYPE_VALUE, + TextEncoderCommon: TYPE, + TextEncoderStream: TYPE_VALUE, + TextEvent: TYPE_VALUE, + TextMetrics: TYPE_VALUE, + TextTrackEventMap: TYPE, + TextTrack: TYPE_VALUE, + TextTrackCueEventMap: TYPE, + TextTrackCue: TYPE_VALUE, + TextTrackCueList: TYPE_VALUE, + TextTrackListEventMap: TYPE, + TextTrackList: TYPE_VALUE, + TimeRanges: TYPE_VALUE, + Touch: TYPE_VALUE, + TouchEvent: TYPE_VALUE, + TouchList: TYPE_VALUE, + TrackEvent: TYPE_VALUE, + TransformStream: TYPE_VALUE, + TransformStreamDefaultController: TYPE_VALUE, + TransitionEvent: TYPE_VALUE, + TreeWalker: TYPE_VALUE, + UIEvent: TYPE_VALUE, + URL: TYPE_VALUE, + webkitURL: TYPE_VALUE, + URLSearchParams: TYPE_VALUE, + VRDisplay: TYPE_VALUE, + VRDisplayCapabilities: TYPE_VALUE, + VRDisplayEvent: TYPE_VALUE, + VREyeParameters: TYPE_VALUE, + VRFieldOfView: TYPE_VALUE, + VRFrameData: TYPE_VALUE, + VRPose: TYPE_VALUE, + VTTCue: TYPE_VALUE, + VTTRegion: TYPE_VALUE, + ValidityState: TYPE_VALUE, + VideoPlaybackQuality: TYPE_VALUE, + VisualViewportEventMap: TYPE, + VisualViewport: TYPE_VALUE, + WEBGL_color_buffer_float: TYPE, + WEBGL_compressed_texture_astc: TYPE, + WEBGL_compressed_texture_s3tc: TYPE, + WEBGL_compressed_texture_s3tc_srgb: TYPE, + WEBGL_debug_renderer_info: TYPE, + WEBGL_debug_shaders: TYPE, + WEBGL_depth_texture: TYPE, + WEBGL_draw_buffers: TYPE, + WEBGL_lose_context: TYPE, + WaveShaperNode: TYPE_VALUE, + WebGL2RenderingContext: TYPE_VALUE, + WebGL2RenderingContextBase: TYPE, + WebGL2RenderingContextOverloads: TYPE, + WebGLActiveInfo: TYPE_VALUE, + WebGLBuffer: TYPE_VALUE, + WebGLContextEvent: TYPE_VALUE, + WebGLFramebuffer: TYPE_VALUE, + WebGLProgram: TYPE_VALUE, + WebGLQuery: TYPE_VALUE, + WebGLRenderbuffer: TYPE_VALUE, + WebGLRenderingContext: TYPE_VALUE, + WebGLRenderingContextBase: TYPE, + WebGLRenderingContextOverloads: TYPE, + WebGLSampler: TYPE_VALUE, + WebGLShader: TYPE_VALUE, + WebGLShaderPrecisionFormat: TYPE_VALUE, + WebGLSync: TYPE_VALUE, + WebGLTexture: TYPE_VALUE, + WebGLTransformFeedback: TYPE_VALUE, + WebGLUniformLocation: TYPE_VALUE, + WebGLVertexArrayObject: TYPE_VALUE, + WebGLVertexArrayObjectOES: TYPE, + WebKitPoint: TYPE_VALUE, + WebSocketEventMap: TYPE, + WebSocket: TYPE_VALUE, + WheelEvent: TYPE_VALUE, + WindowEventMap: TYPE, + Window: TYPE_VALUE, + WindowEventHandlersEventMap: TYPE, + WindowEventHandlers: TYPE, + WindowLocalStorage: TYPE, + WindowOrWorkerGlobalScope: TYPE, + WindowSessionStorage: TYPE, + WorkerEventMap: TYPE, + Worker: TYPE_VALUE, + Worklet: TYPE_VALUE, + WritableStream: TYPE_VALUE, + WritableStreamDefaultController: TYPE_VALUE, + WritableStreamDefaultWriter: TYPE_VALUE, + XMLDocument: TYPE_VALUE, + XMLHttpRequestEventMap: TYPE, + XMLHttpRequest: TYPE_VALUE, + XMLHttpRequestEventTargetEventMap: TYPE, + XMLHttpRequestEventTarget: TYPE_VALUE, + XMLHttpRequestUpload: TYPE_VALUE, + XMLSerializer: TYPE_VALUE, + XPathEvaluator: TYPE_VALUE, + XPathEvaluatorBase: TYPE, + XPathExpression: TYPE_VALUE, + XPathResult: TYPE_VALUE, + XSLTProcessor: TYPE_VALUE, + webkitRTCPeerConnection: TYPE_VALUE, + EventListenerOrEventListenerObject: TYPE, + Console: TYPE, + CSS: TYPE_VALUE, + WebAssembly: TYPE_VALUE, + BlobCallback: TYPE, + CustomElementConstructor: TYPE, + DecodeErrorCallback: TYPE, + DecodeSuccessCallback: TYPE, + EventHandlerNonNull: TYPE, + ForEachCallback: TYPE, + FrameRequestCallback: TYPE, + FunctionStringCallback: TYPE, + IntersectionObserverCallback: TYPE, + MSLaunchUriCallback: TYPE, + MutationCallback: TYPE, + NavigatorUserMediaErrorCallback: TYPE, + NavigatorUserMediaSuccessCallback: TYPE, + NotificationPermissionCallback: TYPE, + OnBeforeUnloadEventHandlerNonNull: TYPE, + OnErrorEventHandlerNonNull: TYPE, + PerformanceObserverCallback: TYPE, + PositionCallback: TYPE, + PositionErrorCallback: TYPE, + QueuingStrategySize: TYPE, + RTCPeerConnectionErrorCallback: TYPE, + RTCSessionDescriptionCallback: TYPE, + RTCStatsCallback: TYPE, + ResizeObserverCallback: TYPE, + TransformerFlushCallback: TYPE, + TransformerStartCallback: TYPE, + TransformerTransformCallback: TYPE, + UnderlyingSinkAbortCallback: TYPE, + UnderlyingSinkCloseCallback: TYPE, + UnderlyingSinkStartCallback: TYPE, + UnderlyingSinkWriteCallback: TYPE, + UnderlyingSourceCancelCallback: TYPE, + UnderlyingSourcePullCallback: TYPE, + UnderlyingSourceStartCallback: TYPE, + VoidFunction: TYPE, + HTMLElementTagNameMap: TYPE, + HTMLElementDeprecatedTagNameMap: TYPE, + SVGElementTagNameMap: TYPE, + ElementTagNameMap: TYPE, + HeadersInit: TYPE, + BodyInit: TYPE, + RequestInfo: TYPE, + BlobPart: TYPE, + DOMHighResTimeStamp: TYPE, + RenderingContext: TYPE, + HTMLOrSVGImageElement: TYPE, + CanvasImageSource: TYPE, + OffscreenRenderingContext: TYPE, + MessageEventSource: TYPE, + HTMLOrSVGScriptElement: TYPE, + ImageBitmapSource: TYPE, + MediaProvider: TYPE, + OnErrorEventHandler: TYPE, + OnBeforeUnloadEventHandler: TYPE, + TimerHandler: TYPE, + ConstrainULong: TYPE, + ConstrainDouble: TYPE, + ConstrainBoolean: TYPE, + ConstrainDOMString: TYPE, + PerformanceEntryList: TYPE, + ReadableStreamReader: TYPE, + ReadableStreamController: TYPE, + VibratePattern: TYPE, + COSEAlgorithmIdentifier: TYPE, + UvmEntry: TYPE, + UvmEntries: TYPE, + AlgorithmIdentifier: TYPE, + HashAlgorithmIdentifier: TYPE, + BigInteger: TYPE, + NamedCurve: TYPE, + GLenum: TYPE, + GLboolean: TYPE, + GLbitfield: TYPE, + GLint: TYPE, + GLsizei: TYPE, + GLintptr: TYPE, + GLsizeiptr: TYPE, + GLuint: TYPE, + GLfloat: TYPE, + GLclampf: TYPE, + TexImageSource: TYPE, + Float32List: TYPE, + Int32List: TYPE, + GLint64: TYPE, + GLuint64: TYPE, + Uint32List: TYPE, + BufferSource: TYPE, + DOMTimeStamp: TYPE, + LineAndPositionSetting: TYPE, + FormDataEntryValue: TYPE, + InsertPosition: TYPE, + IDBValidKey: TYPE, + MutationRecordType: TYPE, + IDBKeyPath: TYPE, + Transferable: TYPE, + RTCIceGatherCandidate: TYPE, + RTCTransport: TYPE, + MouseWheelEvent: TYPE, + WindowProxy: TYPE, + ReadableStreamDefaultReadResult: TYPE, + AlignSetting: TYPE, + AnimationPlayState: TYPE, + AppendMode: TYPE, + AttestationConveyancePreference: TYPE, + AudioContextLatencyCategory: TYPE, + AudioContextState: TYPE, + AuthenticatorAttachment: TYPE, + AuthenticatorTransport: TYPE, + AutoKeyword: TYPE, + AutomationRate: TYPE, + BinaryType: TYPE, + BiquadFilterType: TYPE, + CanPlayTypeResult: TYPE, + CanvasDirection: TYPE, + CanvasFillRule: TYPE, + CanvasLineCap: TYPE, + CanvasLineJoin: TYPE, + CanvasTextAlign: TYPE, + CanvasTextBaseline: TYPE, + ChannelCountMode: TYPE, + ChannelInterpretation: TYPE, + ClientTypes: TYPE, + ColorSpaceConversion: TYPE, + CompositeOperation: TYPE, + CompositeOperationOrAuto: TYPE, + CredentialMediationRequirement: TYPE, + DOMParserSupportedType: TYPE, + DirectionSetting: TYPE, + DisplayCaptureSurfaceType: TYPE, + DistanceModelType: TYPE, + DocumentReadyState: TYPE, + EndOfStreamError: TYPE, + EndingType: TYPE, + FillMode: TYPE, + FullscreenNavigationUI: TYPE, + GamepadHand: TYPE, + GamepadHapticActuatorType: TYPE, + GamepadMappingType: TYPE, + IDBCursorDirection: TYPE, + IDBRequestReadyState: TYPE, + IDBTransactionMode: TYPE, + ImageOrientation: TYPE, + ImageSmoothingQuality: TYPE, + IterationCompositeOperation: TYPE, + KeyFormat: TYPE, + KeyType: TYPE, + KeyUsage: TYPE, + LineAlignSetting: TYPE, + ListeningState: TYPE, + MSCredentialType: TYPE, + MSTransportType: TYPE, + MSWebViewPermissionState: TYPE, + MSWebViewPermissionType: TYPE, + MediaDeviceKind: TYPE, + MediaKeyMessageType: TYPE, + MediaKeySessionType: TYPE, + MediaKeyStatus: TYPE, + MediaKeysRequirement: TYPE, + MediaStreamTrackState: TYPE, + NavigationReason: TYPE, + NavigationType: TYPE, + NotificationDirection: TYPE, + NotificationPermission: TYPE, + OffscreenRenderingContextId: TYPE, + OrientationLockType: TYPE, + OrientationType: TYPE, + OscillatorType: TYPE, + OverSampleType: TYPE, + PanningModelType: TYPE, + PaymentComplete: TYPE, + PaymentShippingType: TYPE, + PermissionName: TYPE, + PermissionState: TYPE, + PlaybackDirection: TYPE, + PositionAlignSetting: TYPE, + PremultiplyAlpha: TYPE, + PublicKeyCredentialType: TYPE, + PushEncryptionKeyName: TYPE, + PushPermissionState: TYPE, + RTCBundlePolicy: TYPE, + RTCDataChannelState: TYPE, + RTCDtlsRole: TYPE, + RTCDtlsTransportState: TYPE, + RTCErrorDetailType: TYPE, + RTCIceCandidateType: TYPE, + RTCIceComponent: TYPE, + RTCIceConnectionState: TYPE, + RTCIceCredentialType: TYPE, + RTCIceGatherPolicy: TYPE, + RTCIceGathererState: TYPE, + RTCIceGatheringState: TYPE, + RTCIceProtocol: TYPE, + RTCIceRole: TYPE, + RTCIceTcpCandidateType: TYPE, + RTCIceTransportPolicy: TYPE, + RTCIceTransportState: TYPE, + RTCPeerConnectionState: TYPE, + RTCRtcpMuxPolicy: TYPE, + RTCRtpTransceiverDirection: TYPE, + RTCSctpTransportState: TYPE, + RTCSdpType: TYPE, + RTCSignalingState: TYPE, + RTCStatsIceCandidatePairState: TYPE, + RTCStatsIceCandidateType: TYPE, + RTCStatsType: TYPE, + ReadyState: TYPE, + ReferrerPolicy: TYPE, + RequestCache: TYPE, + RequestCredentials: TYPE, + RequestDestination: TYPE, + RequestMode: TYPE, + RequestRedirect: TYPE, + ResidentKeyRequirement: TYPE, + ResizeObserverBoxOptions: TYPE, + ResizeQuality: TYPE, + ResponseType: TYPE, + ScrollBehavior: TYPE, + ScrollLogicalPosition: TYPE, + ScrollRestoration: TYPE, + ScrollSetting: TYPE, + SelectionMode: TYPE, + ServiceWorkerState: TYPE, + ServiceWorkerUpdateViaCache: TYPE, + ShadowRootMode: TYPE, + SpeechRecognitionErrorCode: TYPE, + SpeechSynthesisErrorCode: TYPE, + TextTrackKind: TYPE, + TextTrackMode: TYPE, + TouchType: TYPE, + UserVerificationRequirement: TYPE, + VRDisplayEventReason: TYPE, + VideoFacingModeEnum: TYPE, + VisibilityState: TYPE, + WebGLPowerPreference: TYPE, + WorkerType: TYPE, + XMLHttpRequestResponseType: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/es2015.collection.ts b/packages/scope-manager/src/lib/es2015.collection.ts index bfe4b1671646..05c04cb013a0 100644 --- a/packages/scope-manager/src/lib/es2015.collection.ts +++ b/packages/scope-manager/src/lib/es2015.collection.ts @@ -3,66 +3,17 @@ // YOU CAN REGENERATE IT USING yarn generate:lib import { ImplicitLibVariableOptions } from '../variable'; +import { TYPE_VALUE, TYPE } from './base-config'; export const es2015_collection = { - Map: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Map', - }, - MapConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MapConstructor', - }, - ReadonlyMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ReadonlyMap', - }, - WeakMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WeakMap', - }, - WeakMapConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WeakMapConstructor', - }, - Set: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Set', - }, - SetConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'SetConstructor', - }, - ReadonlySet: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ReadonlySet', - }, - WeakSet: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WeakSet', - }, - WeakSetConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WeakSetConstructor', - }, + Map: TYPE_VALUE, + MapConstructor: TYPE, + ReadonlyMap: TYPE, + WeakMap: TYPE_VALUE, + WeakMapConstructor: TYPE, + Set: TYPE_VALUE, + SetConstructor: TYPE, + ReadonlySet: TYPE, + WeakSet: TYPE_VALUE, + WeakSetConstructor: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/es2015.core.ts b/packages/scope-manager/src/lib/es2015.core.ts index 1e55eac0ed10..586432018ca0 100644 --- a/packages/scope-manager/src/lib/es2015.core.ts +++ b/packages/scope-manager/src/lib/es2015.core.ts @@ -3,78 +3,19 @@ // YOU CAN REGENERATE IT USING yarn generate:lib import { ImplicitLibVariableOptions } from '../variable'; +import { TYPE } from './base-config'; export const es2015_core = { - Array: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Array', - }, - ArrayConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ArrayConstructor', - }, - DateConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DateConstructor', - }, - Function: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Function', - }, - Math: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Math', - }, - NumberConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'NumberConstructor', - }, - ObjectConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ObjectConstructor', - }, - ReadonlyArray: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ReadonlyArray', - }, - RegExp: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RegExp', - }, - RegExpConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RegExpConstructor', - }, - String: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'String', - }, - StringConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'StringConstructor', - }, + Array: TYPE, + ArrayConstructor: TYPE, + DateConstructor: TYPE, + Function: TYPE, + Math: TYPE, + NumberConstructor: TYPE, + ObjectConstructor: TYPE, + ReadonlyArray: TYPE, + RegExp: TYPE, + RegExpConstructor: TYPE, + String: TYPE, + StringConstructor: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/es2015.generator.ts b/packages/scope-manager/src/lib/es2015.generator.ts index 20ba0c067b66..4e4e3bc161e6 100644 --- a/packages/scope-manager/src/lib/es2015.generator.ts +++ b/packages/scope-manager/src/lib/es2015.generator.ts @@ -4,25 +4,11 @@ import { ImplicitLibVariableOptions } from '../variable'; import { es2015_iterable } from './es2015.iterable'; +import { TYPE } from './base-config'; export const es2015_generator = { ...es2015_iterable, - Generator: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Generator', - }, - GeneratorFunction: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'GeneratorFunction', - }, - GeneratorFunctionConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'GeneratorFunctionConstructor', - }, + Generator: TYPE, + GeneratorFunction: TYPE, + GeneratorFunctionConstructor: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/es2015.iterable.ts b/packages/scope-manager/src/lib/es2015.iterable.ts index 200317477303..2a3ee5b082be 100644 --- a/packages/scope-manager/src/lib/es2015.iterable.ts +++ b/packages/scope-manager/src/lib/es2015.iterable.ts @@ -4,259 +4,50 @@ import { ImplicitLibVariableOptions } from '../variable'; import { es2015_symbol } from './es2015.symbol'; +import { TYPE } from './base-config'; export const es2015_iterable = { ...es2015_symbol, - SymbolConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'SymbolConstructor', - }, - IteratorYieldResult: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'IteratorYieldResult', - }, - IteratorReturnResult: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'IteratorReturnResult', - }, - IteratorResult: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'IteratorResult', - }, - Iterator: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Iterator', - }, - Iterable: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Iterable', - }, - IterableIterator: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'IterableIterator', - }, - Array: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Array', - }, - ArrayConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ArrayConstructor', - }, - ReadonlyArray: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ReadonlyArray', - }, - IArguments: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'IArguments', - }, - Map: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Map', - }, - ReadonlyMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ReadonlyMap', - }, - MapConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MapConstructor', - }, - WeakMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WeakMap', - }, - WeakMapConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WeakMapConstructor', - }, - Set: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Set', - }, - ReadonlySet: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ReadonlySet', - }, - SetConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'SetConstructor', - }, - WeakSet: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WeakSet', - }, - WeakSetConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WeakSetConstructor', - }, - Promise: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Promise', - }, - PromiseConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PromiseConstructor', - }, - String: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'String', - }, - Int8Array: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Int8Array', - }, - Int8ArrayConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Int8ArrayConstructor', - }, - Uint8Array: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Uint8Array', - }, - Uint8ArrayConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Uint8ArrayConstructor', - }, - Uint8ClampedArray: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Uint8ClampedArray', - }, - Uint8ClampedArrayConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Uint8ClampedArrayConstructor', - }, - Int16Array: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Int16Array', - }, - Int16ArrayConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Int16ArrayConstructor', - }, - Uint16Array: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Uint16Array', - }, - Uint16ArrayConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Uint16ArrayConstructor', - }, - Int32Array: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Int32Array', - }, - Int32ArrayConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Int32ArrayConstructor', - }, - Uint32Array: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Uint32Array', - }, - Uint32ArrayConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Uint32ArrayConstructor', - }, - Float32Array: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Float32Array', - }, - Float32ArrayConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Float32ArrayConstructor', - }, - Float64Array: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Float64Array', - }, - Float64ArrayConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Float64ArrayConstructor', - }, + SymbolConstructor: TYPE, + IteratorYieldResult: TYPE, + IteratorReturnResult: TYPE, + IteratorResult: TYPE, + Iterator: TYPE, + Iterable: TYPE, + IterableIterator: TYPE, + Array: TYPE, + ArrayConstructor: TYPE, + ReadonlyArray: TYPE, + IArguments: TYPE, + Map: TYPE, + ReadonlyMap: TYPE, + MapConstructor: TYPE, + WeakMap: TYPE, + WeakMapConstructor: TYPE, + Set: TYPE, + ReadonlySet: TYPE, + SetConstructor: TYPE, + WeakSet: TYPE, + WeakSetConstructor: TYPE, + Promise: TYPE, + PromiseConstructor: TYPE, + String: TYPE, + Int8Array: TYPE, + Int8ArrayConstructor: TYPE, + Uint8Array: TYPE, + Uint8ArrayConstructor: TYPE, + Uint8ClampedArray: TYPE, + Uint8ClampedArrayConstructor: TYPE, + Int16Array: TYPE, + Int16ArrayConstructor: TYPE, + Uint16Array: TYPE, + Uint16ArrayConstructor: TYPE, + Int32Array: TYPE, + Int32ArrayConstructor: TYPE, + Uint32Array: TYPE, + Uint32ArrayConstructor: TYPE, + Float32Array: TYPE, + Float32ArrayConstructor: TYPE, + Float64Array: TYPE, + Float64ArrayConstructor: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/es2015.promise.ts b/packages/scope-manager/src/lib/es2015.promise.ts index 79c90f23b77d..fc5f298b1abf 100644 --- a/packages/scope-manager/src/lib/es2015.promise.ts +++ b/packages/scope-manager/src/lib/es2015.promise.ts @@ -3,12 +3,8 @@ // YOU CAN REGENERATE IT USING yarn generate:lib import { ImplicitLibVariableOptions } from '../variable'; +import { TYPE } from './base-config'; export const es2015_promise = { - PromiseConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PromiseConstructor', - }, + PromiseConstructor: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/es2015.proxy.ts b/packages/scope-manager/src/lib/es2015.proxy.ts index a57efe0b2b6a..226fa3953613 100644 --- a/packages/scope-manager/src/lib/es2015.proxy.ts +++ b/packages/scope-manager/src/lib/es2015.proxy.ts @@ -3,18 +3,9 @@ // YOU CAN REGENERATE IT USING yarn generate:lib import { ImplicitLibVariableOptions } from '../variable'; +import { TYPE } from './base-config'; export const es2015_proxy = { - ProxyHandler: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ProxyHandler', - }, - ProxyConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ProxyConstructor', - }, + ProxyHandler: TYPE, + ProxyConstructor: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/es2015.reflect.ts b/packages/scope-manager/src/lib/es2015.reflect.ts index 796c3fb78973..d9437942210c 100644 --- a/packages/scope-manager/src/lib/es2015.reflect.ts +++ b/packages/scope-manager/src/lib/es2015.reflect.ts @@ -3,12 +3,8 @@ // YOU CAN REGENERATE IT USING yarn generate:lib import { ImplicitLibVariableOptions } from '../variable'; +import { TYPE_VALUE } from './base-config'; export const es2015_reflect = { - Reflect: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Reflect', - }, + Reflect: TYPE_VALUE, } as Record; diff --git a/packages/scope-manager/src/lib/es2015.symbol.ts b/packages/scope-manager/src/lib/es2015.symbol.ts index 7f5a8acf7334..d0907293ca51 100644 --- a/packages/scope-manager/src/lib/es2015.symbol.ts +++ b/packages/scope-manager/src/lib/es2015.symbol.ts @@ -3,12 +3,8 @@ // YOU CAN REGENERATE IT USING yarn generate:lib import { ImplicitLibVariableOptions } from '../variable'; +import { TYPE } from './base-config'; export const es2015_symbol = { - SymbolConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'SymbolConstructor', - }, + SymbolConstructor: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/es2015.symbol.wellknown.ts b/packages/scope-manager/src/lib/es2015.symbol.wellknown.ts index ba99a6855f80..880535d8d905 100644 --- a/packages/scope-manager/src/lib/es2015.symbol.wellknown.ts +++ b/packages/scope-manager/src/lib/es2015.symbol.wellknown.ts @@ -4,199 +4,40 @@ import { ImplicitLibVariableOptions } from '../variable'; import { es2015_symbol } from './es2015.symbol'; +import { TYPE } from './base-config'; export const es2015_symbol_wellknown = { ...es2015_symbol, - SymbolConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'SymbolConstructor', - }, - Symbol: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Symbol', - }, - Array: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Array', - }, - Date: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Date', - }, - Map: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Map', - }, - WeakMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WeakMap', - }, - Set: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Set', - }, - WeakSet: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WeakSet', - }, - JSON: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'JSON', - }, - Function: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Function', - }, - GeneratorFunction: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'GeneratorFunction', - }, - Math: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Math', - }, - Promise: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Promise', - }, - PromiseConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PromiseConstructor', - }, - RegExp: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RegExp', - }, - RegExpConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RegExpConstructor', - }, - String: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'String', - }, - ArrayBuffer: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ArrayBuffer', - }, - DataView: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DataView', - }, - Int8Array: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Int8Array', - }, - Uint8Array: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Uint8Array', - }, - Uint8ClampedArray: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Uint8ClampedArray', - }, - Int16Array: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Int16Array', - }, - Uint16Array: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Uint16Array', - }, - Int32Array: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Int32Array', - }, - Uint32Array: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Uint32Array', - }, - Float32Array: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Float32Array', - }, - Float64Array: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Float64Array', - }, - ArrayConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ArrayConstructor', - }, - MapConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MapConstructor', - }, - SetConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'SetConstructor', - }, - ArrayBufferConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ArrayBufferConstructor', - }, + SymbolConstructor: TYPE, + Symbol: TYPE, + Array: TYPE, + Date: TYPE, + Map: TYPE, + WeakMap: TYPE, + Set: TYPE, + WeakSet: TYPE, + JSON: TYPE, + Function: TYPE, + GeneratorFunction: TYPE, + Math: TYPE, + Promise: TYPE, + PromiseConstructor: TYPE, + RegExp: TYPE, + RegExpConstructor: TYPE, + String: TYPE, + ArrayBuffer: TYPE, + DataView: TYPE, + Int8Array: TYPE, + Uint8Array: TYPE, + Uint8ClampedArray: TYPE, + Int16Array: TYPE, + Uint16Array: TYPE, + Int32Array: TYPE, + Uint32Array: TYPE, + Float32Array: TYPE, + Float64Array: TYPE, + ArrayConstructor: TYPE, + MapConstructor: TYPE, + SetConstructor: TYPE, + ArrayBufferConstructor: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/es2016.array.include.ts b/packages/scope-manager/src/lib/es2016.array.include.ts index 7a082df25f90..2058367f104f 100644 --- a/packages/scope-manager/src/lib/es2016.array.include.ts +++ b/packages/scope-manager/src/lib/es2016.array.include.ts @@ -3,72 +3,18 @@ // YOU CAN REGENERATE IT USING yarn generate:lib import { ImplicitLibVariableOptions } from '../variable'; +import { TYPE } from './base-config'; export const es2016_array_include = { - Array: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Array', - }, - ReadonlyArray: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ReadonlyArray', - }, - Int8Array: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Int8Array', - }, - Uint8Array: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Uint8Array', - }, - Uint8ClampedArray: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Uint8ClampedArray', - }, - Int16Array: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Int16Array', - }, - Uint16Array: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Uint16Array', - }, - Int32Array: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Int32Array', - }, - Uint32Array: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Uint32Array', - }, - Float32Array: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Float32Array', - }, - Float64Array: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Float64Array', - }, + Array: TYPE, + ReadonlyArray: TYPE, + Int8Array: TYPE, + Uint8Array: TYPE, + Uint8ClampedArray: TYPE, + Int16Array: TYPE, + Uint16Array: TYPE, + Int32Array: TYPE, + Uint32Array: TYPE, + Float32Array: TYPE, + Float64Array: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/es2017.intl.ts b/packages/scope-manager/src/lib/es2017.intl.ts index de836bee889e..1c66c843bd9c 100644 --- a/packages/scope-manager/src/lib/es2017.intl.ts +++ b/packages/scope-manager/src/lib/es2017.intl.ts @@ -3,12 +3,8 @@ // YOU CAN REGENERATE IT USING yarn generate:lib import { ImplicitLibVariableOptions } from '../variable'; +import { TYPE_VALUE } from './base-config'; export const es2017_intl = { - Intl: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Intl', - }, + Intl: TYPE_VALUE, } as Record; diff --git a/packages/scope-manager/src/lib/es2017.object.ts b/packages/scope-manager/src/lib/es2017.object.ts index cc6dadcb5c4b..7a5f5fe50d76 100644 --- a/packages/scope-manager/src/lib/es2017.object.ts +++ b/packages/scope-manager/src/lib/es2017.object.ts @@ -3,12 +3,8 @@ // YOU CAN REGENERATE IT USING yarn generate:lib import { ImplicitLibVariableOptions } from '../variable'; +import { TYPE } from './base-config'; export const es2017_object = { - ObjectConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ObjectConstructor', - }, + ObjectConstructor: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/es2017.sharedmemory.ts b/packages/scope-manager/src/lib/es2017.sharedmemory.ts index 316d52424b99..57fa84fa86b0 100644 --- a/packages/scope-manager/src/lib/es2017.sharedmemory.ts +++ b/packages/scope-manager/src/lib/es2017.sharedmemory.ts @@ -5,32 +5,13 @@ import { ImplicitLibVariableOptions } from '../variable'; import { es2015_symbol } from './es2015.symbol'; import { es2015_symbol_wellknown } from './es2015.symbol.wellknown'; +import { TYPE_VALUE, TYPE } from './base-config'; export const es2017_sharedmemory = { ...es2015_symbol, ...es2015_symbol_wellknown, - SharedArrayBuffer: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SharedArrayBuffer', - }, - SharedArrayBufferConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'SharedArrayBufferConstructor', - }, - ArrayBufferTypes: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ArrayBufferTypes', - }, - Atomics: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Atomics', - }, + SharedArrayBuffer: TYPE_VALUE, + SharedArrayBufferConstructor: TYPE, + ArrayBufferTypes: TYPE, + Atomics: TYPE_VALUE, } as Record; diff --git a/packages/scope-manager/src/lib/es2017.string.ts b/packages/scope-manager/src/lib/es2017.string.ts index 5b3ef5e7e264..ea0488e98328 100644 --- a/packages/scope-manager/src/lib/es2017.string.ts +++ b/packages/scope-manager/src/lib/es2017.string.ts @@ -3,12 +3,8 @@ // YOU CAN REGENERATE IT USING yarn generate:lib import { ImplicitLibVariableOptions } from '../variable'; +import { TYPE } from './base-config'; export const es2017_string = { - String: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'String', - }, + String: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/es2017.typedarrays.ts b/packages/scope-manager/src/lib/es2017.typedarrays.ts index dbe5dedfac36..4a59ace22c8c 100644 --- a/packages/scope-manager/src/lib/es2017.typedarrays.ts +++ b/packages/scope-manager/src/lib/es2017.typedarrays.ts @@ -3,60 +3,16 @@ // YOU CAN REGENERATE IT USING yarn generate:lib import { ImplicitLibVariableOptions } from '../variable'; +import { TYPE } from './base-config'; export const es2017_typedarrays = { - Int8ArrayConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Int8ArrayConstructor', - }, - Uint8ArrayConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Uint8ArrayConstructor', - }, - Uint8ClampedArrayConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Uint8ClampedArrayConstructor', - }, - Int16ArrayConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Int16ArrayConstructor', - }, - Uint16ArrayConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Uint16ArrayConstructor', - }, - Int32ArrayConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Int32ArrayConstructor', - }, - Uint32ArrayConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Uint32ArrayConstructor', - }, - Float32ArrayConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Float32ArrayConstructor', - }, - Float64ArrayConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Float64ArrayConstructor', - }, + Int8ArrayConstructor: TYPE, + Uint8ArrayConstructor: TYPE, + Uint8ClampedArrayConstructor: TYPE, + Int16ArrayConstructor: TYPE, + Uint16ArrayConstructor: TYPE, + Int32ArrayConstructor: TYPE, + Uint32ArrayConstructor: TYPE, + Float32ArrayConstructor: TYPE, + Float64ArrayConstructor: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/es2018.asyncgenerator.ts b/packages/scope-manager/src/lib/es2018.asyncgenerator.ts index 80752c2dca22..e319278df7ee 100644 --- a/packages/scope-manager/src/lib/es2018.asyncgenerator.ts +++ b/packages/scope-manager/src/lib/es2018.asyncgenerator.ts @@ -4,25 +4,11 @@ import { ImplicitLibVariableOptions } from '../variable'; import { es2018_asynciterable } from './es2018.asynciterable'; +import { TYPE } from './base-config'; export const es2018_asyncgenerator = { ...es2018_asynciterable, - AsyncGenerator: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AsyncGenerator', - }, - AsyncGeneratorFunction: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AsyncGeneratorFunction', - }, - AsyncGeneratorFunctionConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AsyncGeneratorFunctionConstructor', - }, + AsyncGenerator: TYPE, + AsyncGeneratorFunction: TYPE, + AsyncGeneratorFunctionConstructor: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/es2018.asynciterable.ts b/packages/scope-manager/src/lib/es2018.asynciterable.ts index fca209905022..0a22137e5981 100644 --- a/packages/scope-manager/src/lib/es2018.asynciterable.ts +++ b/packages/scope-manager/src/lib/es2018.asynciterable.ts @@ -5,32 +5,13 @@ import { ImplicitLibVariableOptions } from '../variable'; import { es2015_symbol } from './es2015.symbol'; import { es2015_iterable } from './es2015.iterable'; +import { TYPE } from './base-config'; export const es2018_asynciterable = { ...es2015_symbol, ...es2015_iterable, - SymbolConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'SymbolConstructor', - }, - AsyncIterator: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AsyncIterator', - }, - AsyncIterable: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AsyncIterable', - }, - AsyncIterableIterator: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AsyncIterableIterator', - }, + SymbolConstructor: TYPE, + AsyncIterator: TYPE, + AsyncIterable: TYPE, + AsyncIterableIterator: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/es2018.intl.ts b/packages/scope-manager/src/lib/es2018.intl.ts index 7bc68a428ff9..ce40891f1567 100644 --- a/packages/scope-manager/src/lib/es2018.intl.ts +++ b/packages/scope-manager/src/lib/es2018.intl.ts @@ -3,12 +3,8 @@ // YOU CAN REGENERATE IT USING yarn generate:lib import { ImplicitLibVariableOptions } from '../variable'; +import { TYPE_VALUE } from './base-config'; export const es2018_intl = { - Intl: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Intl', - }, + Intl: TYPE_VALUE, } as Record; diff --git a/packages/scope-manager/src/lib/es2018.promise.ts b/packages/scope-manager/src/lib/es2018.promise.ts index 908e47e2f53e..429661973479 100644 --- a/packages/scope-manager/src/lib/es2018.promise.ts +++ b/packages/scope-manager/src/lib/es2018.promise.ts @@ -3,12 +3,8 @@ // YOU CAN REGENERATE IT USING yarn generate:lib import { ImplicitLibVariableOptions } from '../variable'; +import { TYPE } from './base-config'; export const es2018_promise = { - Promise: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Promise', - }, + Promise: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/es2018.regexp.ts b/packages/scope-manager/src/lib/es2018.regexp.ts index e59e4849f2b3..39a8b4d7a079 100644 --- a/packages/scope-manager/src/lib/es2018.regexp.ts +++ b/packages/scope-manager/src/lib/es2018.regexp.ts @@ -3,24 +3,10 @@ // YOU CAN REGENERATE IT USING yarn generate:lib import { ImplicitLibVariableOptions } from '../variable'; +import { TYPE } from './base-config'; export const es2018_regexp = { - RegExpMatchArray: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RegExpMatchArray', - }, - RegExpExecArray: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RegExpExecArray', - }, - RegExp: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RegExp', - }, + RegExpMatchArray: TYPE, + RegExpExecArray: TYPE, + RegExp: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/es2019.array.ts b/packages/scope-manager/src/lib/es2019.array.ts index e3fb2ff62beb..73a459a5367f 100644 --- a/packages/scope-manager/src/lib/es2019.array.ts +++ b/packages/scope-manager/src/lib/es2019.array.ts @@ -3,24 +3,10 @@ // YOU CAN REGENERATE IT USING yarn generate:lib import { ImplicitLibVariableOptions } from '../variable'; +import { TYPE } from './base-config'; export const es2019_array = { - FlatArray: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'FlatArray', - }, - ReadonlyArray: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ReadonlyArray', - }, - Array: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Array', - }, + FlatArray: TYPE, + ReadonlyArray: TYPE, + Array: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/es2019.object.ts b/packages/scope-manager/src/lib/es2019.object.ts index 3db91f3f1d6c..70c12d3af78e 100644 --- a/packages/scope-manager/src/lib/es2019.object.ts +++ b/packages/scope-manager/src/lib/es2019.object.ts @@ -4,13 +4,9 @@ import { ImplicitLibVariableOptions } from '../variable'; import { es2015_iterable } from './es2015.iterable'; +import { TYPE } from './base-config'; export const es2019_object = { ...es2015_iterable, - ObjectConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ObjectConstructor', - }, + ObjectConstructor: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/es2019.string.ts b/packages/scope-manager/src/lib/es2019.string.ts index 113a34775587..4211425a6595 100644 --- a/packages/scope-manager/src/lib/es2019.string.ts +++ b/packages/scope-manager/src/lib/es2019.string.ts @@ -3,12 +3,8 @@ // YOU CAN REGENERATE IT USING yarn generate:lib import { ImplicitLibVariableOptions } from '../variable'; +import { TYPE } from './base-config'; export const es2019_string = { - String: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'String', - }, + String: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/es2019.symbol.ts b/packages/scope-manager/src/lib/es2019.symbol.ts index 36888f887cef..81e789e4d165 100644 --- a/packages/scope-manager/src/lib/es2019.symbol.ts +++ b/packages/scope-manager/src/lib/es2019.symbol.ts @@ -3,12 +3,8 @@ // YOU CAN REGENERATE IT USING yarn generate:lib import { ImplicitLibVariableOptions } from '../variable'; +import { TYPE } from './base-config'; export const es2019_symbol = { - Symbol: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Symbol', - }, + Symbol: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/es2020.bigint.ts b/packages/scope-manager/src/lib/es2020.bigint.ts index b31042e8d3ae..40dca31af844 100644 --- a/packages/scope-manager/src/lib/es2020.bigint.ts +++ b/packages/scope-manager/src/lib/es2020.bigint.ts @@ -3,60 +3,16 @@ // YOU CAN REGENERATE IT USING yarn generate:lib import { ImplicitLibVariableOptions } from '../variable'; +import { TYPE, TYPE_VALUE } from './base-config'; export const es2020_bigint = { - BigIntToLocaleStringOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'BigIntToLocaleStringOptions', - }, - BigInt: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'BigInt', - }, - BigIntConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'BigIntConstructor', - }, - BigInt64Array: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'BigInt64Array', - }, - BigInt64ArrayConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'BigInt64ArrayConstructor', - }, - BigUint64Array: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'BigUint64Array', - }, - BigUint64ArrayConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'BigUint64ArrayConstructor', - }, - DataView: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DataView', - }, - Intl: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Intl', - }, + BigIntToLocaleStringOptions: TYPE, + BigInt: TYPE_VALUE, + BigIntConstructor: TYPE, + BigInt64Array: TYPE_VALUE, + BigInt64ArrayConstructor: TYPE, + BigUint64Array: TYPE_VALUE, + BigUint64ArrayConstructor: TYPE, + DataView: TYPE, + Intl: TYPE_VALUE, } as Record; diff --git a/packages/scope-manager/src/lib/es2020.intl.ts b/packages/scope-manager/src/lib/es2020.intl.ts index d97db5a6aea2..d6ed5dd467b5 100644 --- a/packages/scope-manager/src/lib/es2020.intl.ts +++ b/packages/scope-manager/src/lib/es2020.intl.ts @@ -3,12 +3,8 @@ // YOU CAN REGENERATE IT USING yarn generate:lib import { ImplicitLibVariableOptions } from '../variable'; +import { TYPE_VALUE } from './base-config'; export const es2020_intl = { - Intl: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Intl', - }, + Intl: TYPE_VALUE, } as Record; diff --git a/packages/scope-manager/src/lib/es2020.promise.ts b/packages/scope-manager/src/lib/es2020.promise.ts index 4a3743f0e7e1..02f54152e185 100644 --- a/packages/scope-manager/src/lib/es2020.promise.ts +++ b/packages/scope-manager/src/lib/es2020.promise.ts @@ -3,30 +3,11 @@ // YOU CAN REGENERATE IT USING yarn generate:lib import { ImplicitLibVariableOptions } from '../variable'; +import { TYPE } from './base-config'; export const es2020_promise = { - PromiseFulfilledResult: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PromiseFulfilledResult', - }, - PromiseRejectedResult: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PromiseRejectedResult', - }, - PromiseSettledResult: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PromiseSettledResult', - }, - PromiseConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PromiseConstructor', - }, + PromiseFulfilledResult: TYPE, + PromiseRejectedResult: TYPE, + PromiseSettledResult: TYPE, + PromiseConstructor: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/es2020.sharedmemory.ts b/packages/scope-manager/src/lib/es2020.sharedmemory.ts index 83569efc09f3..0f666b766127 100644 --- a/packages/scope-manager/src/lib/es2020.sharedmemory.ts +++ b/packages/scope-manager/src/lib/es2020.sharedmemory.ts @@ -3,12 +3,8 @@ // YOU CAN REGENERATE IT USING yarn generate:lib import { ImplicitLibVariableOptions } from '../variable'; +import { TYPE } from './base-config'; export const es2020_sharedmemory = { - Atomics: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Atomics', - }, + Atomics: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/es2020.string.ts b/packages/scope-manager/src/lib/es2020.string.ts index 2f173d3fb5b8..2f9363cc56da 100644 --- a/packages/scope-manager/src/lib/es2020.string.ts +++ b/packages/scope-manager/src/lib/es2020.string.ts @@ -4,13 +4,9 @@ import { ImplicitLibVariableOptions } from '../variable'; import { es2015_iterable } from './es2015.iterable'; +import { TYPE } from './base-config'; export const es2020_string = { ...es2015_iterable, - String: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'String', - }, + String: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/es2020.symbol.wellknown.ts b/packages/scope-manager/src/lib/es2020.symbol.wellknown.ts index 9c452ca68979..e817c9d88d92 100644 --- a/packages/scope-manager/src/lib/es2020.symbol.wellknown.ts +++ b/packages/scope-manager/src/lib/es2020.symbol.wellknown.ts @@ -5,20 +5,11 @@ import { ImplicitLibVariableOptions } from '../variable'; import { es2015_iterable } from './es2015.iterable'; import { es2015_symbol } from './es2015.symbol'; +import { TYPE } from './base-config'; export const es2020_symbol_wellknown = { ...es2015_iterable, ...es2015_symbol, - SymbolConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'SymbolConstructor', - }, - RegExp: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RegExp', - }, + SymbolConstructor: TYPE, + RegExp: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/es2021.full.ts b/packages/scope-manager/src/lib/es2021.full.ts new file mode 100644 index 000000000000..f2f88f226be0 --- /dev/null +++ b/packages/scope-manager/src/lib/es2021.full.ts @@ -0,0 +1,18 @@ +// THIS CODE WAS AUTOMATICALLY GENERATED +// DO NOT EDIT THIS CODE BY HAND +// YOU CAN REGENERATE IT USING yarn generate:lib + +import { ImplicitLibVariableOptions } from '../variable'; +import { es2021 } from './es2021'; +import { dom } from './dom'; +import { webworker_importscripts } from './webworker.importscripts'; +import { scripthost } from './scripthost'; +import { dom_iterable } from './dom.iterable'; + +export const es2021_full = { + ...es2021, + ...dom, + ...webworker_importscripts, + ...scripthost, + ...dom_iterable, +} as Record; diff --git a/packages/scope-manager/src/lib/es2021.promise.ts b/packages/scope-manager/src/lib/es2021.promise.ts new file mode 100644 index 000000000000..5ab523683127 --- /dev/null +++ b/packages/scope-manager/src/lib/es2021.promise.ts @@ -0,0 +1,12 @@ +// THIS CODE WAS AUTOMATICALLY GENERATED +// DO NOT EDIT THIS CODE BY HAND +// YOU CAN REGENERATE IT USING yarn generate:lib + +import { ImplicitLibVariableOptions } from '../variable'; +import { TYPE_VALUE, TYPE } from './base-config'; + +export const es2021_promise = { + AggregateError: TYPE_VALUE, + AggregateErrorConstructor: TYPE, + PromiseConstructor: TYPE, +} as Record; diff --git a/packages/scope-manager/src/lib/es2021.string.ts b/packages/scope-manager/src/lib/es2021.string.ts new file mode 100644 index 000000000000..efe7173f859e --- /dev/null +++ b/packages/scope-manager/src/lib/es2021.string.ts @@ -0,0 +1,10 @@ +// THIS CODE WAS AUTOMATICALLY GENERATED +// DO NOT EDIT THIS CODE BY HAND +// YOU CAN REGENERATE IT USING yarn generate:lib + +import { ImplicitLibVariableOptions } from '../variable'; +import { TYPE } from './base-config'; + +export const es2021_string = { + String: TYPE, +} as Record; diff --git a/packages/scope-manager/src/lib/es2021.ts b/packages/scope-manager/src/lib/es2021.ts new file mode 100644 index 000000000000..027a2d6142da --- /dev/null +++ b/packages/scope-manager/src/lib/es2021.ts @@ -0,0 +1,16 @@ +// THIS CODE WAS AUTOMATICALLY GENERATED +// DO NOT EDIT THIS CODE BY HAND +// YOU CAN REGENERATE IT USING yarn generate:lib + +import { ImplicitLibVariableOptions } from '../variable'; +import { es2020 } from './es2020'; +import { es2021_promise } from './es2021.promise'; +import { es2021_string } from './es2021.string'; +import { es2021_weakref } from './es2021.weakref'; + +export const es2021 = { + ...es2020, + ...es2021_promise, + ...es2021_string, + ...es2021_weakref, +} as Record; diff --git a/packages/scope-manager/src/lib/es2021.weakref.ts b/packages/scope-manager/src/lib/es2021.weakref.ts new file mode 100644 index 000000000000..2ab59cf10108 --- /dev/null +++ b/packages/scope-manager/src/lib/es2021.weakref.ts @@ -0,0 +1,13 @@ +// THIS CODE WAS AUTOMATICALLY GENERATED +// DO NOT EDIT THIS CODE BY HAND +// YOU CAN REGENERATE IT USING yarn generate:lib + +import { ImplicitLibVariableOptions } from '../variable'; +import { TYPE_VALUE, TYPE } from './base-config'; + +export const es2021_weakref = { + WeakRef: TYPE_VALUE, + WeakRefConstructor: TYPE, + FinalizationRegistry: TYPE_VALUE, + FinalizationRegistryConstructor: TYPE, +} as Record; diff --git a/packages/scope-manager/src/lib/es5.ts b/packages/scope-manager/src/lib/es5.ts index 2141fc6ceee1..0fa14cdfccf2 100644 --- a/packages/scope-manager/src/lib/es5.ts +++ b/packages/scope-manager/src/lib/es5.ts @@ -3,606 +3,107 @@ // YOU CAN REGENERATE IT USING yarn generate:lib import { ImplicitLibVariableOptions } from '../variable'; +import { TYPE, TYPE_VALUE } from './base-config'; export const es5 = { - Symbol: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Symbol', - }, - PropertyKey: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PropertyKey', - }, - PropertyDescriptor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PropertyDescriptor', - }, - PropertyDescriptorMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PropertyDescriptorMap', - }, - Object: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Object', - }, - ObjectConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ObjectConstructor', - }, - Function: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Function', - }, - FunctionConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'FunctionConstructor', - }, - ThisParameterType: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ThisParameterType', - }, - OmitThisParameter: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'OmitThisParameter', - }, - CallableFunction: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CallableFunction', - }, - NewableFunction: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'NewableFunction', - }, - IArguments: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'IArguments', - }, - String: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'String', - }, - StringConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'StringConstructor', - }, - Boolean: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Boolean', - }, - BooleanConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'BooleanConstructor', - }, - Number: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Number', - }, - NumberConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'NumberConstructor', - }, - TemplateStringsArray: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'TemplateStringsArray', - }, - ImportMeta: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ImportMeta', - }, - Math: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Math', - }, - Date: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Date', - }, - DateConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DateConstructor', - }, - RegExpMatchArray: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RegExpMatchArray', - }, - RegExpExecArray: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RegExpExecArray', - }, - RegExp: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'RegExp', - }, - RegExpConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RegExpConstructor', - }, - Error: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Error', - }, - ErrorConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ErrorConstructor', - }, - EvalError: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'EvalError', - }, - EvalErrorConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'EvalErrorConstructor', - }, - RangeError: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'RangeError', - }, - RangeErrorConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RangeErrorConstructor', - }, - ReferenceError: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ReferenceError', - }, - ReferenceErrorConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ReferenceErrorConstructor', - }, - SyntaxError: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SyntaxError', - }, - SyntaxErrorConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'SyntaxErrorConstructor', - }, - TypeError: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'TypeError', - }, - TypeErrorConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'TypeErrorConstructor', - }, - URIError: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'URIError', - }, - URIErrorConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'URIErrorConstructor', - }, - JSON: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'JSON', - }, - ReadonlyArray: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ReadonlyArray', - }, - ConcatArray: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ConcatArray', - }, - Array: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Array', - }, - ArrayConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ArrayConstructor', - }, - TypedPropertyDescriptor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'TypedPropertyDescriptor', - }, - ClassDecorator: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ClassDecorator', - }, - PropertyDecorator: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PropertyDecorator', - }, - MethodDecorator: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MethodDecorator', - }, - ParameterDecorator: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ParameterDecorator', - }, - PromiseConstructorLike: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PromiseConstructorLike', - }, - PromiseLike: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PromiseLike', - }, - Promise: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Promise', - }, - ArrayLike: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ArrayLike', - }, - Partial: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Partial', - }, - Required: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Required', - }, - Readonly: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Readonly', - }, - Pick: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Pick', - }, - Record: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Record', - }, - Exclude: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Exclude', - }, - Extract: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Extract', - }, - Omit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Omit', - }, - NonNullable: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'NonNullable', - }, - Parameters: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Parameters', - }, - ConstructorParameters: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ConstructorParameters', - }, - ReturnType: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ReturnType', - }, - InstanceType: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'InstanceType', - }, - Uppercase: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Uppercase', - }, - Lowercase: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Lowercase', - }, - Capitalize: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Capitalize', - }, - Uncapitalize: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Uncapitalize', - }, - ThisType: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ThisType', - }, - ArrayBuffer: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ArrayBuffer', - }, - ArrayBufferTypes: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ArrayBufferTypes', - }, - ArrayBufferLike: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ArrayBufferLike', - }, - ArrayBufferConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ArrayBufferConstructor', - }, - ArrayBufferView: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ArrayBufferView', - }, - DataView: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'DataView', - }, - DataViewConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DataViewConstructor', - }, - Int8Array: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Int8Array', - }, - Int8ArrayConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Int8ArrayConstructor', - }, - Uint8Array: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Uint8Array', - }, - Uint8ArrayConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Uint8ArrayConstructor', - }, - Uint8ClampedArray: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Uint8ClampedArray', - }, - Uint8ClampedArrayConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Uint8ClampedArrayConstructor', - }, - Int16Array: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Int16Array', - }, - Int16ArrayConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Int16ArrayConstructor', - }, - Uint16Array: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Uint16Array', - }, - Uint16ArrayConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Uint16ArrayConstructor', - }, - Int32Array: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Int32Array', - }, - Int32ArrayConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Int32ArrayConstructor', - }, - Uint32Array: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Uint32Array', - }, - Uint32ArrayConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Uint32ArrayConstructor', - }, - Float32Array: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Float32Array', - }, - Float32ArrayConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Float32ArrayConstructor', - }, - Float64Array: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Float64Array', - }, - Float64ArrayConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Float64ArrayConstructor', - }, - Intl: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Intl', - }, + Symbol: TYPE, + PropertyKey: TYPE, + PropertyDescriptor: TYPE, + PropertyDescriptorMap: TYPE, + Object: TYPE_VALUE, + ObjectConstructor: TYPE, + Function: TYPE_VALUE, + FunctionConstructor: TYPE, + ThisParameterType: TYPE, + OmitThisParameter: TYPE, + CallableFunction: TYPE, + NewableFunction: TYPE, + IArguments: TYPE, + String: TYPE_VALUE, + StringConstructor: TYPE, + Boolean: TYPE_VALUE, + BooleanConstructor: TYPE, + Number: TYPE_VALUE, + NumberConstructor: TYPE, + TemplateStringsArray: TYPE, + ImportMeta: TYPE, + Math: TYPE_VALUE, + Date: TYPE_VALUE, + DateConstructor: TYPE, + RegExpMatchArray: TYPE, + RegExpExecArray: TYPE, + RegExp: TYPE_VALUE, + RegExpConstructor: TYPE, + Error: TYPE_VALUE, + ErrorConstructor: TYPE, + EvalError: TYPE_VALUE, + EvalErrorConstructor: TYPE, + RangeError: TYPE_VALUE, + RangeErrorConstructor: TYPE, + ReferenceError: TYPE_VALUE, + ReferenceErrorConstructor: TYPE, + SyntaxError: TYPE_VALUE, + SyntaxErrorConstructor: TYPE, + TypeError: TYPE_VALUE, + TypeErrorConstructor: TYPE, + URIError: TYPE_VALUE, + URIErrorConstructor: TYPE, + JSON: TYPE_VALUE, + ReadonlyArray: TYPE, + ConcatArray: TYPE, + Array: TYPE_VALUE, + ArrayConstructor: TYPE, + TypedPropertyDescriptor: TYPE, + ClassDecorator: TYPE, + PropertyDecorator: TYPE, + MethodDecorator: TYPE, + ParameterDecorator: TYPE, + PromiseConstructorLike: TYPE, + PromiseLike: TYPE, + Promise: TYPE, + ArrayLike: TYPE, + Partial: TYPE, + Required: TYPE, + Readonly: TYPE, + Pick: TYPE, + Record: TYPE, + Exclude: TYPE, + Extract: TYPE, + Omit: TYPE, + NonNullable: TYPE, + Parameters: TYPE, + ConstructorParameters: TYPE, + ReturnType: TYPE, + InstanceType: TYPE, + Uppercase: TYPE, + Lowercase: TYPE, + Capitalize: TYPE, + Uncapitalize: TYPE, + ThisType: TYPE, + ArrayBuffer: TYPE_VALUE, + ArrayBufferTypes: TYPE, + ArrayBufferLike: TYPE, + ArrayBufferConstructor: TYPE, + ArrayBufferView: TYPE, + DataView: TYPE_VALUE, + DataViewConstructor: TYPE, + Int8Array: TYPE_VALUE, + Int8ArrayConstructor: TYPE, + Uint8Array: TYPE_VALUE, + Uint8ArrayConstructor: TYPE, + Uint8ClampedArray: TYPE_VALUE, + Uint8ClampedArrayConstructor: TYPE, + Int16Array: TYPE_VALUE, + Int16ArrayConstructor: TYPE, + Uint16Array: TYPE_VALUE, + Uint16ArrayConstructor: TYPE, + Int32Array: TYPE_VALUE, + Int32ArrayConstructor: TYPE, + Uint32Array: TYPE_VALUE, + Uint32ArrayConstructor: TYPE, + Float32Array: TYPE_VALUE, + Float32ArrayConstructor: TYPE, + Float64Array: TYPE_VALUE, + Float64ArrayConstructor: TYPE, + Intl: TYPE_VALUE, } as Record; diff --git a/packages/scope-manager/src/lib/esnext.array.ts b/packages/scope-manager/src/lib/esnext.array.ts index b349f206e184..28e862220cf2 100644 --- a/packages/scope-manager/src/lib/esnext.array.ts +++ b/packages/scope-manager/src/lib/esnext.array.ts @@ -3,24 +3,10 @@ // YOU CAN REGENERATE IT USING yarn generate:lib import { ImplicitLibVariableOptions } from '../variable'; +import { TYPE } from './base-config'; export const esnext_array = { - FlatArray: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'FlatArray', - }, - ReadonlyArray: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ReadonlyArray', - }, - Array: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Array', - }, + FlatArray: TYPE, + ReadonlyArray: TYPE, + Array: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/esnext.asynciterable.ts b/packages/scope-manager/src/lib/esnext.asynciterable.ts index c78a7dc71fc4..98501212a957 100644 --- a/packages/scope-manager/src/lib/esnext.asynciterable.ts +++ b/packages/scope-manager/src/lib/esnext.asynciterable.ts @@ -5,32 +5,13 @@ import { ImplicitLibVariableOptions } from '../variable'; import { es2015_symbol } from './es2015.symbol'; import { es2015_iterable } from './es2015.iterable'; +import { TYPE } from './base-config'; export const esnext_asynciterable = { ...es2015_symbol, ...es2015_iterable, - SymbolConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'SymbolConstructor', - }, - AsyncIterator: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AsyncIterator', - }, - AsyncIterable: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AsyncIterable', - }, - AsyncIterableIterator: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AsyncIterableIterator', - }, + SymbolConstructor: TYPE, + AsyncIterator: TYPE, + AsyncIterable: TYPE, + AsyncIterableIterator: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/esnext.bigint.ts b/packages/scope-manager/src/lib/esnext.bigint.ts index 18985a9df06c..209b5e731d3b 100644 --- a/packages/scope-manager/src/lib/esnext.bigint.ts +++ b/packages/scope-manager/src/lib/esnext.bigint.ts @@ -3,60 +3,16 @@ // YOU CAN REGENERATE IT USING yarn generate:lib import { ImplicitLibVariableOptions } from '../variable'; +import { TYPE, TYPE_VALUE } from './base-config'; export const esnext_bigint = { - BigIntToLocaleStringOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'BigIntToLocaleStringOptions', - }, - BigInt: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'BigInt', - }, - BigIntConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'BigIntConstructor', - }, - BigInt64Array: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'BigInt64Array', - }, - BigInt64ArrayConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'BigInt64ArrayConstructor', - }, - BigUint64Array: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'BigUint64Array', - }, - BigUint64ArrayConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'BigUint64ArrayConstructor', - }, - DataView: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DataView', - }, - Intl: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Intl', - }, + BigIntToLocaleStringOptions: TYPE, + BigInt: TYPE_VALUE, + BigIntConstructor: TYPE, + BigInt64Array: TYPE_VALUE, + BigInt64ArrayConstructor: TYPE, + BigUint64Array: TYPE_VALUE, + BigUint64ArrayConstructor: TYPE, + DataView: TYPE, + Intl: TYPE_VALUE, } as Record; diff --git a/packages/scope-manager/src/lib/esnext.intl.ts b/packages/scope-manager/src/lib/esnext.intl.ts index e6a3fa9997ed..cf71e6878bf9 100644 --- a/packages/scope-manager/src/lib/esnext.intl.ts +++ b/packages/scope-manager/src/lib/esnext.intl.ts @@ -3,12 +3,8 @@ // YOU CAN REGENERATE IT USING yarn generate:lib import { ImplicitLibVariableOptions } from '../variable'; +import { TYPE_VALUE } from './base-config'; export const esnext_intl = { - Intl: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Intl', - }, + Intl: TYPE_VALUE, } as Record; diff --git a/packages/scope-manager/src/lib/esnext.promise.ts b/packages/scope-manager/src/lib/esnext.promise.ts index 53240da659eb..9aa6a130d2f8 100644 --- a/packages/scope-manager/src/lib/esnext.promise.ts +++ b/packages/scope-manager/src/lib/esnext.promise.ts @@ -3,24 +3,10 @@ // YOU CAN REGENERATE IT USING yarn generate:lib import { ImplicitLibVariableOptions } from '../variable'; +import { TYPE_VALUE, TYPE } from './base-config'; export const esnext_promise = { - AggregateError: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'AggregateError', - }, - AggregateErrorConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AggregateErrorConstructor', - }, - PromiseConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PromiseConstructor', - }, + AggregateError: TYPE_VALUE, + AggregateErrorConstructor: TYPE, + PromiseConstructor: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/esnext.string.ts b/packages/scope-manager/src/lib/esnext.string.ts index e1c3ab61f59a..429469351992 100644 --- a/packages/scope-manager/src/lib/esnext.string.ts +++ b/packages/scope-manager/src/lib/esnext.string.ts @@ -3,12 +3,8 @@ // YOU CAN REGENERATE IT USING yarn generate:lib import { ImplicitLibVariableOptions } from '../variable'; +import { TYPE } from './base-config'; export const esnext_string = { - String: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'String', - }, + String: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/esnext.symbol.ts b/packages/scope-manager/src/lib/esnext.symbol.ts index a7e3f7a15f21..39d7ed7be416 100644 --- a/packages/scope-manager/src/lib/esnext.symbol.ts +++ b/packages/scope-manager/src/lib/esnext.symbol.ts @@ -3,12 +3,8 @@ // YOU CAN REGENERATE IT USING yarn generate:lib import { ImplicitLibVariableOptions } from '../variable'; +import { TYPE } from './base-config'; export const esnext_symbol = { - Symbol: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Symbol', - }, + Symbol: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/esnext.ts b/packages/scope-manager/src/lib/esnext.ts index 347f63158c6e..fcb4fab6cfea 100644 --- a/packages/scope-manager/src/lib/esnext.ts +++ b/packages/scope-manager/src/lib/esnext.ts @@ -3,16 +3,10 @@ // YOU CAN REGENERATE IT USING yarn generate:lib import { ImplicitLibVariableOptions } from '../variable'; -import { es2020 } from './es2020'; +import { es2021 } from './es2021'; import { esnext_intl } from './esnext.intl'; -import { esnext_string } from './esnext.string'; -import { esnext_promise } from './esnext.promise'; -import { esnext_weakref } from './esnext.weakref'; export const esnext = { - ...es2020, + ...es2021, ...esnext_intl, - ...esnext_string, - ...esnext_promise, - ...esnext_weakref, } as Record; diff --git a/packages/scope-manager/src/lib/esnext.weakref.ts b/packages/scope-manager/src/lib/esnext.weakref.ts index 2ae60fb7230b..679fba61e9be 100644 --- a/packages/scope-manager/src/lib/esnext.weakref.ts +++ b/packages/scope-manager/src/lib/esnext.weakref.ts @@ -3,30 +3,11 @@ // YOU CAN REGENERATE IT USING yarn generate:lib import { ImplicitLibVariableOptions } from '../variable'; +import { TYPE_VALUE, TYPE } from './base-config'; export const esnext_weakref = { - WeakRef: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WeakRef', - }, - WeakRefConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WeakRefConstructor', - }, - FinalizationRegistry: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'FinalizationRegistry', - }, - FinalizationRegistryConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'FinalizationRegistryConstructor', - }, + WeakRef: TYPE_VALUE, + WeakRefConstructor: TYPE, + FinalizationRegistry: TYPE_VALUE, + FinalizationRegistryConstructor: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/index.ts b/packages/scope-manager/src/lib/index.ts index dfae31e07962..7ad94cf41a6d 100644 --- a/packages/scope-manager/src/lib/index.ts +++ b/packages/scope-manager/src/lib/index.ts @@ -11,6 +11,7 @@ import { es2017 } from './es2017'; import { es2018 } from './es2018'; import { es2019 } from './es2019'; import { es2020 } from './es2020'; +import { es2021 } from './es2021'; import { esnext } from './esnext'; import { dom } from './dom'; import { dom_iterable } from './dom.iterable'; @@ -48,6 +49,9 @@ import { es2020_sharedmemory } from './es2020.sharedmemory'; import { es2020_string } from './es2020.string'; import { es2020_symbol_wellknown } from './es2020.symbol.wellknown'; import { es2020_intl } from './es2020.intl'; +import { es2021_promise } from './es2021.promise'; +import { es2021_string } from './es2021.string'; +import { es2021_weakref } from './es2021.weakref'; import { esnext_array } from './esnext.array'; import { esnext_symbol } from './esnext.symbol'; import { esnext_asynciterable } from './esnext.asynciterable'; @@ -61,6 +65,7 @@ import { es2017_full } from './es2017.full'; import { es2018_full } from './es2018.full'; import { es2019_full } from './es2019.full'; import { es2020_full } from './es2020.full'; +import { es2021_full } from './es2021.full'; import { esnext_full } from './esnext.full'; import { lib as libBase } from './lib'; @@ -74,6 +79,7 @@ const lib = { es2018, es2019, es2020, + es2021, esnext, dom, 'dom.iterable': dom_iterable, @@ -111,6 +117,9 @@ const lib = { 'es2020.string': es2020_string, 'es2020.symbol.wellknown': es2020_symbol_wellknown, 'es2020.intl': es2020_intl, + 'es2021.promise': es2021_promise, + 'es2021.string': es2021_string, + 'es2021.weakref': es2021_weakref, 'esnext.array': esnext_array, 'esnext.symbol': esnext_symbol, 'esnext.asynciterable': esnext_asynciterable, @@ -124,6 +133,7 @@ const lib = { 'es2018.full': es2018_full, 'es2019.full': es2019_full, 'es2020.full': es2020_full, + 'es2021.full': es2021_full, 'esnext.full': esnext_full, lib: libBase, } as const; diff --git a/packages/scope-manager/src/lib/scripthost.ts b/packages/scope-manager/src/lib/scripthost.ts index 1ae99dcacac2..f582e52a5aae 100644 --- a/packages/scope-manager/src/lib/scripthost.ts +++ b/packages/scope-manager/src/lib/scripthost.ts @@ -3,84 +3,20 @@ // YOU CAN REGENERATE IT USING yarn generate:lib import { ImplicitLibVariableOptions } from '../variable'; +import { TYPE_VALUE, TYPE } from './base-config'; export const scripthost = { - ActiveXObject: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ActiveXObject', - }, - ITextWriter: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ITextWriter', - }, - TextStreamBase: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'TextStreamBase', - }, - TextStreamWriter: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'TextStreamWriter', - }, - TextStreamReader: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'TextStreamReader', - }, - SafeArray: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SafeArray', - }, - Enumerator: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Enumerator', - }, - EnumeratorConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'EnumeratorConstructor', - }, - VBArray: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'VBArray', - }, - VBArrayConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'VBArrayConstructor', - }, - VarDate: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'VarDate', - }, - DateConstructor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DateConstructor', - }, - Date: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Date', - }, + ActiveXObject: TYPE_VALUE, + ITextWriter: TYPE, + TextStreamBase: TYPE, + TextStreamWriter: TYPE, + TextStreamReader: TYPE, + SafeArray: TYPE_VALUE, + Enumerator: TYPE_VALUE, + EnumeratorConstructor: TYPE, + VBArray: TYPE_VALUE, + VBArrayConstructor: TYPE, + VarDate: TYPE_VALUE, + DateConstructor: TYPE, + Date: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/webworker.iterable.ts b/packages/scope-manager/src/lib/webworker.iterable.ts index e7f5e11cbe9e..11efc7c746fa 100644 --- a/packages/scope-manager/src/lib/webworker.iterable.ts +++ b/packages/scope-manager/src/lib/webworker.iterable.ts @@ -3,90 +3,21 @@ // YOU CAN REGENERATE IT USING yarn generate:lib import { ImplicitLibVariableOptions } from '../variable'; +import { TYPE } from './base-config'; export const webworker_iterable = { - Cache: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Cache', - }, - CanvasPathDrawingStyles: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CanvasPathDrawingStyles', - }, - DOMStringList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DOMStringList', - }, - FileList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'FileList', - }, - FormData: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'FormData', - }, - Headers: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Headers', - }, - IDBDatabase: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'IDBDatabase', - }, - IDBObjectStore: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'IDBObjectStore', - }, - URLSearchParams: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'URLSearchParams', - }, - WEBGL_draw_buffers: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WEBGL_draw_buffers', - }, - WebGL2RenderingContextBase: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WebGL2RenderingContextBase', - }, - WebGL2RenderingContextOverloads: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WebGL2RenderingContextOverloads', - }, - WebGLRenderingContextBase: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WebGLRenderingContextBase', - }, - WebGLRenderingContextOverloads: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WebGLRenderingContextOverloads', - }, + Cache: TYPE, + CanvasPathDrawingStyles: TYPE, + DOMStringList: TYPE, + FileList: TYPE, + FormData: TYPE, + Headers: TYPE, + IDBDatabase: TYPE, + IDBObjectStore: TYPE, + URLSearchParams: TYPE, + WEBGL_draw_buffers: TYPE, + WebGL2RenderingContextBase: TYPE, + WebGL2RenderingContextOverloads: TYPE, + WebGLRenderingContextBase: TYPE, + WebGLRenderingContextOverloads: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/webworker.ts b/packages/scope-manager/src/lib/webworker.ts index 3f76351c98f4..569e5ef31ccd 100644 --- a/packages/scope-manager/src/lib/webworker.ts +++ b/packages/scope-manager/src/lib/webworker.ts @@ -3,2484 +3,417 @@ // YOU CAN REGENERATE IT USING yarn generate:lib import { ImplicitLibVariableOptions } from '../variable'; +import { TYPE, TYPE_VALUE } from './base-config'; export const webworker = { - AddEventListenerOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AddEventListenerOptions', - }, - AesCbcParams: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AesCbcParams', - }, - AesCtrParams: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AesCtrParams', - }, - AesDerivedKeyParams: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AesDerivedKeyParams', - }, - AesGcmParams: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AesGcmParams', - }, - AesKeyAlgorithm: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AesKeyAlgorithm', - }, - AesKeyGenParams: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AesKeyGenParams', - }, - Algorithm: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Algorithm', - }, - BlobPropertyBag: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'BlobPropertyBag', - }, - CacheQueryOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CacheQueryOptions', - }, - CanvasRenderingContext2DSettings: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CanvasRenderingContext2DSettings', - }, - ClientQueryOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ClientQueryOptions', - }, - CloseEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CloseEventInit', - }, - CryptoKeyPair: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CryptoKeyPair', - }, - CustomEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CustomEventInit', - }, - DOMMatrix2DInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DOMMatrix2DInit', - }, - DOMMatrixInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DOMMatrixInit', - }, - DOMPointInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DOMPointInit', - }, - DOMQuadInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DOMQuadInit', - }, - DOMRectInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DOMRectInit', - }, - DevicePermissionDescriptor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DevicePermissionDescriptor', - }, - EcKeyGenParams: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'EcKeyGenParams', - }, - EcKeyImportParams: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'EcKeyImportParams', - }, - EcdhKeyDeriveParams: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'EcdhKeyDeriveParams', - }, - EcdsaParams: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'EcdsaParams', - }, - ErrorEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ErrorEventInit', - }, - EventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'EventInit', - }, - EventListenerOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'EventListenerOptions', - }, - EventSourceInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'EventSourceInit', - }, - ExtendableEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ExtendableEventInit', - }, - ExtendableMessageEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ExtendableMessageEventInit', - }, - FetchEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'FetchEventInit', - }, - FilePropertyBag: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'FilePropertyBag', - }, - GetNotificationOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'GetNotificationOptions', - }, - HkdfParams: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'HkdfParams', - }, - HmacImportParams: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'HmacImportParams', - }, - HmacKeyGenParams: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'HmacKeyGenParams', - }, - IDBIndexParameters: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'IDBIndexParameters', - }, - IDBObjectStoreParameters: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'IDBObjectStoreParameters', - }, - IDBVersionChangeEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'IDBVersionChangeEventInit', - }, - ImageBitmapOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ImageBitmapOptions', - }, - ImageBitmapRenderingContextSettings: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ImageBitmapRenderingContextSettings', - }, - ImageEncodeOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ImageEncodeOptions', - }, - ImportMeta: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ImportMeta', - }, - JsonWebKey: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'JsonWebKey', - }, - KeyAlgorithm: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'KeyAlgorithm', - }, - MessageEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MessageEventInit', - }, - MidiPermissionDescriptor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MidiPermissionDescriptor', - }, - MultiCacheQueryOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MultiCacheQueryOptions', - }, - NavigationPreloadState: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'NavigationPreloadState', - }, - NotificationAction: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'NotificationAction', - }, - NotificationEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'NotificationEventInit', - }, - NotificationOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'NotificationOptions', - }, - Pbkdf2Params: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Pbkdf2Params', - }, - PerformanceObserverInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PerformanceObserverInit', - }, - PermissionDescriptor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PermissionDescriptor', - }, - PostMessageOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PostMessageOptions', - }, - ProgressEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ProgressEventInit', - }, - PromiseRejectionEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PromiseRejectionEventInit', - }, - PushEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PushEventInit', - }, - PushPermissionDescriptor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PushPermissionDescriptor', - }, - PushSubscriptionChangeEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PushSubscriptionChangeEventInit', - }, - PushSubscriptionJSON: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PushSubscriptionJSON', - }, - PushSubscriptionOptionsInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PushSubscriptionOptionsInit', - }, - QueuingStrategy: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'QueuingStrategy', - }, - QueuingStrategyInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'QueuingStrategyInit', - }, - ReadableStreamDefaultReadDoneResult: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ReadableStreamDefaultReadDoneResult', - }, - ReadableStreamDefaultReadValueResult: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ReadableStreamDefaultReadValueResult', - }, - ReadableWritablePair: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ReadableWritablePair', - }, - RegistrationOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RegistrationOptions', - }, - RequestInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RequestInit', - }, - ResponseInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ResponseInit', - }, - RsaHashedImportParams: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RsaHashedImportParams', - }, - RsaHashedKeyGenParams: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RsaHashedKeyGenParams', - }, - RsaKeyGenParams: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RsaKeyGenParams', - }, - RsaOaepParams: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RsaOaepParams', - }, - RsaOtherPrimesInfo: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RsaOtherPrimesInfo', - }, - RsaPssParams: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RsaPssParams', - }, - StorageEstimate: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'StorageEstimate', - }, - StreamPipeOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'StreamPipeOptions', - }, - SyncEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'SyncEventInit', - }, - TextDecodeOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'TextDecodeOptions', - }, - TextDecoderOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'TextDecoderOptions', - }, - TextEncoderEncodeIntoResult: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'TextEncoderEncodeIntoResult', - }, - Transformer: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Transformer', - }, - UnderlyingSink: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'UnderlyingSink', - }, - UnderlyingSource: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'UnderlyingSource', - }, - WebGLContextAttributes: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WebGLContextAttributes', - }, - WebGLContextEventInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WebGLContextEventInit', - }, - WorkerOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WorkerOptions', - }, - EventListener: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'EventListener', - }, - ANGLE_instanced_arrays: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ANGLE_instanced_arrays', - }, - AbortController: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'AbortController', - }, - AbortSignalEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AbortSignalEventMap', - }, - AbortSignal: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'AbortSignal', - }, - AbstractWorkerEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AbstractWorkerEventMap', - }, - AbstractWorker: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AbstractWorker', - }, - AesCfbParams: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AesCfbParams', - }, - AesCmacParams: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AesCmacParams', - }, - AnimationFrameProvider: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AnimationFrameProvider', - }, - Blob: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Blob', - }, - Body: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Body', - }, - BroadcastChannelEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'BroadcastChannelEventMap', - }, - BroadcastChannel: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'BroadcastChannel', - }, - ByteLengthQueuingStrategy: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ByteLengthQueuingStrategy', - }, - Cache: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Cache', - }, - CacheStorage: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'CacheStorage', - }, - CanvasCompositing: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CanvasCompositing', - }, - CanvasDrawImage: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CanvasDrawImage', - }, - CanvasDrawPath: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CanvasDrawPath', - }, - CanvasFillStrokeStyles: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CanvasFillStrokeStyles', - }, - CanvasFilters: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CanvasFilters', - }, - CanvasGradient: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'CanvasGradient', - }, - CanvasImageData: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CanvasImageData', - }, - CanvasImageSmoothing: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CanvasImageSmoothing', - }, - CanvasPath: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CanvasPath', - }, - CanvasPathDrawingStyles: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CanvasPathDrawingStyles', - }, - CanvasPattern: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'CanvasPattern', - }, - CanvasRect: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CanvasRect', - }, - CanvasShadowStyles: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CanvasShadowStyles', - }, - CanvasState: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CanvasState', - }, - CanvasText: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CanvasText', - }, - CanvasTextDrawingStyles: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CanvasTextDrawingStyles', - }, - CanvasTransform: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CanvasTransform', - }, - Client: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Client', - }, - Clients: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Clients', - }, - CloseEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'CloseEvent', - }, - ConcatParams: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ConcatParams', - }, - CountQueuingStrategy: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'CountQueuingStrategy', - }, - Crypto: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Crypto', - }, - CryptoKey: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'CryptoKey', - }, - CustomEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'CustomEvent', - }, - DOMException: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'DOMException', - }, - DOMMatrix: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'DOMMatrix', - }, - DOMMatrixReadOnly: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'DOMMatrixReadOnly', - }, - DOMPoint: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'DOMPoint', - }, - DOMPointReadOnly: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'DOMPointReadOnly', - }, - DOMQuad: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'DOMQuad', - }, - DOMRect: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'DOMRect', - }, - DOMRectReadOnly: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'DOMRectReadOnly', - }, - DOMStringList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'DOMStringList', - }, - DedicatedWorkerGlobalScopeEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DedicatedWorkerGlobalScopeEventMap', - }, - DedicatedWorkerGlobalScope: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'DedicatedWorkerGlobalScope', - }, - DhImportKeyParams: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DhImportKeyParams', - }, - DhKeyAlgorithm: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DhKeyAlgorithm', - }, - DhKeyDeriveParams: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DhKeyDeriveParams', - }, - DhKeyGenParams: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DhKeyGenParams', - }, - EXT_blend_minmax: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'EXT_blend_minmax', - }, - EXT_frag_depth: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'EXT_frag_depth', - }, - EXT_sRGB: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'EXT_sRGB', - }, - EXT_shader_texture_lod: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'EXT_shader_texture_lod', - }, - EXT_texture_filter_anisotropic: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'EXT_texture_filter_anisotropic', - }, - ErrorEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ErrorEvent', - }, - Event: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Event', - }, - EventListenerObject: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'EventListenerObject', - }, - EventSourceEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'EventSourceEventMap', - }, - EventSource: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'EventSource', - }, - EventTarget: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'EventTarget', - }, - ExtendableEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ExtendableEvent', - }, - ExtendableMessageEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ExtendableMessageEvent', - }, - FetchEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'FetchEvent', - }, - File: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'File', - }, - FileList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'FileList', - }, - FileReaderEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'FileReaderEventMap', - }, - FileReader: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'FileReader', - }, - FileReaderSync: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'FileReaderSync', - }, - FormData: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'FormData', - }, - GenericTransformStream: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'GenericTransformStream', - }, - Headers: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Headers', - }, - IDBArrayKey: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'IDBArrayKey', - }, - IDBCursor: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'IDBCursor', - }, - IDBCursorWithValue: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'IDBCursorWithValue', - }, - IDBDatabaseEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'IDBDatabaseEventMap', - }, - IDBDatabase: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'IDBDatabase', - }, - IDBFactory: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'IDBFactory', - }, - IDBIndex: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'IDBIndex', - }, - IDBKeyRange: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'IDBKeyRange', - }, - IDBObjectStore: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'IDBObjectStore', - }, - IDBOpenDBRequestEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'IDBOpenDBRequestEventMap', - }, - IDBOpenDBRequest: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'IDBOpenDBRequest', - }, - IDBRequestEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'IDBRequestEventMap', - }, - IDBRequest: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'IDBRequest', - }, - IDBTransactionEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'IDBTransactionEventMap', - }, - IDBTransaction: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'IDBTransaction', - }, - IDBVersionChangeEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'IDBVersionChangeEvent', - }, - ImageBitmap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ImageBitmap', - }, - ImageBitmapRenderingContext: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ImageBitmapRenderingContext', - }, - ImageData: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ImageData', - }, - MessageChannel: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MessageChannel', - }, - MessageEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MessageEvent', - }, - MessagePortEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MessagePortEventMap', - }, - MessagePort: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'MessagePort', - }, - NavigationPreloadManager: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'NavigationPreloadManager', - }, - NavigatorConcurrentHardware: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'NavigatorConcurrentHardware', - }, - NavigatorID: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'NavigatorID', - }, - NavigatorLanguage: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'NavigatorLanguage', - }, - NavigatorOnLine: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'NavigatorOnLine', - }, - NavigatorStorage: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'NavigatorStorage', - }, - NotificationEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'NotificationEventMap', - }, - Notification: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Notification', - }, - NotificationEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'NotificationEvent', - }, - OES_element_index_uint: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'OES_element_index_uint', - }, - OES_standard_derivatives: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'OES_standard_derivatives', - }, - OES_texture_float: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'OES_texture_float', - }, - OES_texture_float_linear: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'OES_texture_float_linear', - }, - OES_texture_half_float: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'OES_texture_half_float', - }, - OES_texture_half_float_linear: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'OES_texture_half_float_linear', - }, - OES_vertex_array_object: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'OES_vertex_array_object', - }, - OffscreenCanvas: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'OffscreenCanvas', - }, - OffscreenCanvasRenderingContext2D: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'OffscreenCanvasRenderingContext2D', - }, - Path2D: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Path2D', - }, - PerformanceEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PerformanceEventMap', - }, - Performance: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Performance', - }, - PerformanceEntry: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'PerformanceEntry', - }, - PerformanceMark: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'PerformanceMark', - }, - PerformanceMeasure: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'PerformanceMeasure', - }, - PerformanceObserver: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'PerformanceObserver', - }, - PerformanceObserverEntryList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'PerformanceObserverEntryList', - }, - PerformanceResourceTiming: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'PerformanceResourceTiming', - }, - PermissionStatusEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PermissionStatusEventMap', - }, - PermissionStatus: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'PermissionStatus', - }, - Permissions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Permissions', - }, - ProgressEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ProgressEvent', - }, - PromiseRejectionEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'PromiseRejectionEvent', - }, - PushEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'PushEvent', - }, - PushManager: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'PushManager', - }, - PushMessageData: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'PushMessageData', - }, - PushSubscription: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'PushSubscription', - }, - PushSubscriptionChangeEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'PushSubscriptionChangeEvent', - }, - PushSubscriptionOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'PushSubscriptionOptions', - }, - ReadableStream: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ReadableStream', - }, - ReadableStreamDefaultController: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ReadableStreamDefaultController', - }, - ReadableStreamDefaultReader: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ReadableStreamDefaultReader', - }, - ReadableStreamGenericReader: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ReadableStreamGenericReader', - }, - Request: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Request', - }, - Response: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Response', - }, - ServiceWorkerEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ServiceWorkerEventMap', - }, - ServiceWorker: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ServiceWorker', - }, - ServiceWorkerContainerEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ServiceWorkerContainerEventMap', - }, - ServiceWorkerContainer: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ServiceWorkerContainer', - }, - ServiceWorkerGlobalScopeEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ServiceWorkerGlobalScopeEventMap', - }, - ServiceWorkerGlobalScope: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ServiceWorkerGlobalScope', - }, - ServiceWorkerRegistrationEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ServiceWorkerRegistrationEventMap', - }, - ServiceWorkerRegistration: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ServiceWorkerRegistration', - }, - SharedWorker: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SharedWorker', - }, - SharedWorkerGlobalScopeEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'SharedWorkerGlobalScopeEventMap', - }, - SharedWorkerGlobalScope: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SharedWorkerGlobalScope', - }, - StorageManager: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'StorageManager', - }, - SubtleCrypto: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SubtleCrypto', - }, - SyncEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SyncEvent', - }, - SyncManager: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'SyncManager', - }, - TextDecoder: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'TextDecoder', - }, - TextDecoderCommon: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'TextDecoderCommon', - }, - TextDecoderStream: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'TextDecoderStream', - }, - TextEncoder: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'TextEncoder', - }, - TextEncoderCommon: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'TextEncoderCommon', - }, - TextEncoderStream: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'TextEncoderStream', - }, - TextMetrics: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'TextMetrics', - }, - TransformStream: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'TransformStream', - }, - TransformStreamDefaultController: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'TransformStreamDefaultController', - }, - URL: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'URL', - }, - URLSearchParams: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'URLSearchParams', - }, - WEBGL_color_buffer_float: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WEBGL_color_buffer_float', - }, - WEBGL_compressed_texture_astc: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WEBGL_compressed_texture_astc', - }, - WEBGL_compressed_texture_s3tc: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WEBGL_compressed_texture_s3tc', - }, - WEBGL_compressed_texture_s3tc_srgb: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WEBGL_compressed_texture_s3tc_srgb', - }, - WEBGL_debug_renderer_info: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WEBGL_debug_renderer_info', - }, - WEBGL_debug_shaders: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WEBGL_debug_shaders', - }, - WEBGL_depth_texture: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WEBGL_depth_texture', - }, - WEBGL_draw_buffers: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WEBGL_draw_buffers', - }, - WEBGL_lose_context: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WEBGL_lose_context', - }, - WebGL2RenderingContext: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WebGL2RenderingContext', - }, - WebGL2RenderingContextBase: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WebGL2RenderingContextBase', - }, - WebGL2RenderingContextOverloads: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WebGL2RenderingContextOverloads', - }, - WebGLActiveInfo: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WebGLActiveInfo', - }, - WebGLBuffer: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WebGLBuffer', - }, - WebGLContextEvent: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WebGLContextEvent', - }, - WebGLFramebuffer: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WebGLFramebuffer', - }, - WebGLObject: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WebGLObject', - }, - WebGLProgram: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WebGLProgram', - }, - WebGLQuery: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WebGLQuery', - }, - WebGLRenderbuffer: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WebGLRenderbuffer', - }, - WebGLRenderingContext: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WebGLRenderingContext', - }, - WebGLRenderingContextBase: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WebGLRenderingContextBase', - }, - WebGLRenderingContextOverloads: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WebGLRenderingContextOverloads', - }, - WebGLSampler: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WebGLSampler', - }, - WebGLShader: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WebGLShader', - }, - WebGLShaderPrecisionFormat: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WebGLShaderPrecisionFormat', - }, - WebGLSync: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WebGLSync', - }, - WebGLTexture: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WebGLTexture', - }, - WebGLTransformFeedback: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WebGLTransformFeedback', - }, - WebGLUniformLocation: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WebGLUniformLocation', - }, - WebGLVertexArrayObject: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WebGLVertexArrayObject', - }, - WebGLVertexArrayObjectOES: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WebGLVertexArrayObjectOES', - }, - WebSocketEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WebSocketEventMap', - }, - WebSocket: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WebSocket', - }, - WindowClient: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WindowClient', - }, - WindowOrWorkerGlobalScope: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WindowOrWorkerGlobalScope', - }, - WorkerEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WorkerEventMap', - }, - Worker: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'Worker', - }, - WorkerGlobalScopeEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WorkerGlobalScopeEventMap', - }, - WorkerGlobalScope: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WorkerGlobalScope', - }, - WorkerLocation: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WorkerLocation', - }, - WorkerNavigator: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WorkerNavigator', - }, - WritableStream: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WritableStream', - }, - WritableStreamDefaultController: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WritableStreamDefaultController', - }, - WritableStreamDefaultWriter: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WritableStreamDefaultWriter', - }, - XMLHttpRequestEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'XMLHttpRequestEventMap', - }, - XMLHttpRequest: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'XMLHttpRequest', - }, - XMLHttpRequestEventTargetEventMap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'XMLHttpRequestEventTargetEventMap', - }, - XMLHttpRequestEventTarget: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'XMLHttpRequestEventTarget', - }, - XMLHttpRequestUpload: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'XMLHttpRequestUpload', - }, - EventListenerOrEventListenerObject: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'EventListenerOrEventListenerObject', - }, - Console: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Console', - }, - WebAssembly: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'WebAssembly', - }, - FrameRequestCallback: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'FrameRequestCallback', - }, - OnErrorEventHandlerNonNull: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'OnErrorEventHandlerNonNull', - }, - PerformanceObserverCallback: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PerformanceObserverCallback', - }, - QueuingStrategySize: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'QueuingStrategySize', - }, - TransformerFlushCallback: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'TransformerFlushCallback', - }, - TransformerStartCallback: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'TransformerStartCallback', - }, - TransformerTransformCallback: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'TransformerTransformCallback', - }, - UnderlyingSinkAbortCallback: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'UnderlyingSinkAbortCallback', - }, - UnderlyingSinkCloseCallback: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'UnderlyingSinkCloseCallback', - }, - UnderlyingSinkStartCallback: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'UnderlyingSinkStartCallback', - }, - UnderlyingSinkWriteCallback: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'UnderlyingSinkWriteCallback', - }, - UnderlyingSourceCancelCallback: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'UnderlyingSourceCancelCallback', - }, - UnderlyingSourcePullCallback: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'UnderlyingSourcePullCallback', - }, - UnderlyingSourceStartCallback: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'UnderlyingSourceStartCallback', - }, - VoidFunction: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'VoidFunction', - }, - HeadersInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'HeadersInit', - }, - BodyInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'BodyInit', - }, - RequestInfo: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RequestInfo', - }, - BlobPart: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'BlobPart', - }, - DOMHighResTimeStamp: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DOMHighResTimeStamp', - }, - CanvasImageSource: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CanvasImageSource', - }, - OffscreenRenderingContext: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'OffscreenRenderingContext', - }, - MessageEventSource: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'MessageEventSource', - }, - ImageBitmapSource: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ImageBitmapSource', - }, - OnErrorEventHandler: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'OnErrorEventHandler', - }, - TimerHandler: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'TimerHandler', - }, - PerformanceEntryList: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PerformanceEntryList', - }, - PushMessageDataInit: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PushMessageDataInit', - }, - ReadableStreamReader: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ReadableStreamReader', - }, - ReadableStreamController: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ReadableStreamController', - }, - VibratePattern: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'VibratePattern', - }, - AlgorithmIdentifier: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'AlgorithmIdentifier', - }, - HashAlgorithmIdentifier: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'HashAlgorithmIdentifier', - }, - BigInteger: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'BigInteger', - }, - NamedCurve: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'NamedCurve', - }, - GLenum: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'GLenum', - }, - GLboolean: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'GLboolean', - }, - GLbitfield: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'GLbitfield', - }, - GLint: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'GLint', - }, - GLsizei: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'GLsizei', - }, - GLintptr: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'GLintptr', - }, - GLsizeiptr: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'GLsizeiptr', - }, - GLuint: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'GLuint', - }, - GLfloat: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'GLfloat', - }, - GLclampf: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'GLclampf', - }, - TexImageSource: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'TexImageSource', - }, - Float32List: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Float32List', - }, - Int32List: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Int32List', - }, - GLint64: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'GLint64', - }, - GLuint64: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'GLuint64', - }, - Uint32List: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Uint32List', - }, - BufferSource: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'BufferSource', - }, - DOMTimeStamp: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'DOMTimeStamp', - }, - FormDataEntryValue: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'FormDataEntryValue', - }, - IDBValidKey: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'IDBValidKey', - }, - Transferable: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'Transferable', - }, - ReadableStreamDefaultReadResult: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ReadableStreamDefaultReadResult', - }, - BinaryType: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'BinaryType', - }, - CanvasDirection: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CanvasDirection', - }, - CanvasFillRule: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CanvasFillRule', - }, - CanvasLineCap: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CanvasLineCap', - }, - CanvasLineJoin: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CanvasLineJoin', - }, - CanvasTextAlign: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CanvasTextAlign', - }, - CanvasTextBaseline: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'CanvasTextBaseline', - }, - ClientTypes: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ClientTypes', - }, - ColorSpaceConversion: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ColorSpaceConversion', - }, - EndingType: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'EndingType', - }, - FrameType: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'FrameType', - }, - IDBCursorDirection: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'IDBCursorDirection', - }, - IDBRequestReadyState: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'IDBRequestReadyState', - }, - IDBTransactionMode: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'IDBTransactionMode', - }, - ImageOrientation: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ImageOrientation', - }, - ImageSmoothingQuality: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ImageSmoothingQuality', - }, - KeyFormat: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'KeyFormat', - }, - KeyType: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'KeyType', - }, - KeyUsage: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'KeyUsage', - }, - NotificationDirection: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'NotificationDirection', - }, - NotificationPermission: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'NotificationPermission', - }, - OffscreenRenderingContextId: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'OffscreenRenderingContextId', - }, - PermissionName: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PermissionName', - }, - PermissionState: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PermissionState', - }, - PremultiplyAlpha: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PremultiplyAlpha', - }, - PushEncryptionKeyName: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PushEncryptionKeyName', - }, - PushPermissionState: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PushPermissionState', - }, - ReferrerPolicy: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ReferrerPolicy', - }, - RequestCache: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RequestCache', - }, - RequestCredentials: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RequestCredentials', - }, - RequestDestination: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RequestDestination', - }, - RequestMode: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RequestMode', - }, - RequestRedirect: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'RequestRedirect', - }, - ResizeQuality: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ResizeQuality', - }, - ResponseType: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ResponseType', - }, - ServiceWorkerState: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ServiceWorkerState', - }, - ServiceWorkerUpdateViaCache: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'ServiceWorkerUpdateViaCache', - }, - VisibilityState: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'VisibilityState', - }, - WebGLPowerPreference: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WebGLPowerPreference', - }, - WorkerType: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'WorkerType', - }, - XMLHttpRequestResponseType: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'XMLHttpRequestResponseType', - }, + AddEventListenerOptions: TYPE, + AesCbcParams: TYPE, + AesCtrParams: TYPE, + AesDerivedKeyParams: TYPE, + AesGcmParams: TYPE, + AesKeyAlgorithm: TYPE, + AesKeyGenParams: TYPE, + Algorithm: TYPE, + BlobPropertyBag: TYPE, + CacheQueryOptions: TYPE, + CanvasRenderingContext2DSettings: TYPE, + ClientQueryOptions: TYPE, + CloseEventInit: TYPE, + CryptoKeyPair: TYPE, + CustomEventInit: TYPE, + DOMMatrix2DInit: TYPE, + DOMMatrixInit: TYPE, + DOMPointInit: TYPE, + DOMQuadInit: TYPE, + DOMRectInit: TYPE, + DevicePermissionDescriptor: TYPE, + EcKeyGenParams: TYPE, + EcKeyImportParams: TYPE, + EcdhKeyDeriveParams: TYPE, + EcdsaParams: TYPE, + ErrorEventInit: TYPE, + EventInit: TYPE, + EventListenerOptions: TYPE, + EventSourceInit: TYPE, + ExtendableEventInit: TYPE, + ExtendableMessageEventInit: TYPE, + FetchEventInit: TYPE, + FilePropertyBag: TYPE, + GetNotificationOptions: TYPE, + HkdfParams: TYPE, + HmacImportParams: TYPE, + HmacKeyGenParams: TYPE, + IDBIndexParameters: TYPE, + IDBObjectStoreParameters: TYPE, + IDBVersionChangeEventInit: TYPE, + ImageBitmapOptions: TYPE, + ImageBitmapRenderingContextSettings: TYPE, + ImageEncodeOptions: TYPE, + ImportMeta: TYPE, + JsonWebKey: TYPE, + KeyAlgorithm: TYPE, + MessageEventInit: TYPE, + MidiPermissionDescriptor: TYPE, + MultiCacheQueryOptions: TYPE, + NavigationPreloadState: TYPE, + NotificationAction: TYPE, + NotificationEventInit: TYPE, + NotificationOptions: TYPE, + Pbkdf2Params: TYPE, + PerformanceObserverInit: TYPE, + PermissionDescriptor: TYPE, + PostMessageOptions: TYPE, + ProgressEventInit: TYPE, + PromiseRejectionEventInit: TYPE, + PushEventInit: TYPE, + PushPermissionDescriptor: TYPE, + PushSubscriptionJSON: TYPE, + PushSubscriptionOptionsInit: TYPE, + QueuingStrategy: TYPE, + QueuingStrategyInit: TYPE, + ReadableStreamDefaultReadDoneResult: TYPE, + ReadableStreamDefaultReadValueResult: TYPE, + ReadableWritablePair: TYPE, + RegistrationOptions: TYPE, + RequestInit: TYPE, + ResponseInit: TYPE, + RsaHashedImportParams: TYPE, + RsaHashedKeyGenParams: TYPE, + RsaKeyGenParams: TYPE, + RsaOaepParams: TYPE, + RsaOtherPrimesInfo: TYPE, + RsaPssParams: TYPE, + StorageEstimate: TYPE, + StreamPipeOptions: TYPE, + SyncEventInit: TYPE, + TextDecodeOptions: TYPE, + TextDecoderOptions: TYPE, + TextEncoderEncodeIntoResult: TYPE, + Transformer: TYPE, + UnderlyingSink: TYPE, + UnderlyingSource: TYPE, + WebGLContextAttributes: TYPE, + WebGLContextEventInit: TYPE, + WorkerOptions: TYPE, + EventListener: TYPE, + ANGLE_instanced_arrays: TYPE, + AbortController: TYPE_VALUE, + AbortSignalEventMap: TYPE, + AbortSignal: TYPE_VALUE, + AbstractWorkerEventMap: TYPE, + AbstractWorker: TYPE, + AesCfbParams: TYPE, + AesCmacParams: TYPE, + AnimationFrameProvider: TYPE, + Blob: TYPE_VALUE, + Body: TYPE, + BroadcastChannelEventMap: TYPE, + BroadcastChannel: TYPE_VALUE, + ByteLengthQueuingStrategy: TYPE_VALUE, + Cache: TYPE_VALUE, + CacheStorage: TYPE_VALUE, + CanvasCompositing: TYPE, + CanvasDrawImage: TYPE, + CanvasDrawPath: TYPE, + CanvasFillStrokeStyles: TYPE, + CanvasFilters: TYPE, + CanvasGradient: TYPE_VALUE, + CanvasImageData: TYPE, + CanvasImageSmoothing: TYPE, + CanvasPath: TYPE, + CanvasPathDrawingStyles: TYPE, + CanvasPattern: TYPE_VALUE, + CanvasRect: TYPE, + CanvasShadowStyles: TYPE, + CanvasState: TYPE, + CanvasText: TYPE, + CanvasTextDrawingStyles: TYPE, + CanvasTransform: TYPE, + Client: TYPE_VALUE, + Clients: TYPE_VALUE, + CloseEvent: TYPE_VALUE, + ConcatParams: TYPE, + CountQueuingStrategy: TYPE_VALUE, + Crypto: TYPE_VALUE, + CryptoKey: TYPE_VALUE, + CustomEvent: TYPE_VALUE, + DOMException: TYPE_VALUE, + DOMMatrix: TYPE_VALUE, + DOMMatrixReadOnly: TYPE_VALUE, + DOMPoint: TYPE_VALUE, + DOMPointReadOnly: TYPE_VALUE, + DOMQuad: TYPE_VALUE, + DOMRect: TYPE_VALUE, + DOMRectReadOnly: TYPE_VALUE, + DOMStringList: TYPE_VALUE, + DedicatedWorkerGlobalScopeEventMap: TYPE, + DedicatedWorkerGlobalScope: TYPE_VALUE, + DhImportKeyParams: TYPE, + DhKeyAlgorithm: TYPE, + DhKeyDeriveParams: TYPE, + DhKeyGenParams: TYPE, + EXT_blend_minmax: TYPE, + EXT_frag_depth: TYPE, + EXT_sRGB: TYPE, + EXT_shader_texture_lod: TYPE, + EXT_texture_filter_anisotropic: TYPE, + ErrorEvent: TYPE_VALUE, + Event: TYPE_VALUE, + EventListenerObject: TYPE, + EventSourceEventMap: TYPE, + EventSource: TYPE_VALUE, + EventTarget: TYPE_VALUE, + ExtendableEvent: TYPE_VALUE, + ExtendableMessageEvent: TYPE_VALUE, + FetchEvent: TYPE_VALUE, + File: TYPE_VALUE, + FileList: TYPE_VALUE, + FileReaderEventMap: TYPE, + FileReader: TYPE_VALUE, + FileReaderSync: TYPE_VALUE, + FormData: TYPE_VALUE, + GenericTransformStream: TYPE, + Headers: TYPE_VALUE, + IDBArrayKey: TYPE, + IDBCursor: TYPE_VALUE, + IDBCursorWithValue: TYPE_VALUE, + IDBDatabaseEventMap: TYPE, + IDBDatabase: TYPE_VALUE, + IDBFactory: TYPE_VALUE, + IDBIndex: TYPE_VALUE, + IDBKeyRange: TYPE_VALUE, + IDBObjectStore: TYPE_VALUE, + IDBOpenDBRequestEventMap: TYPE, + IDBOpenDBRequest: TYPE_VALUE, + IDBRequestEventMap: TYPE, + IDBRequest: TYPE_VALUE, + IDBTransactionEventMap: TYPE, + IDBTransaction: TYPE_VALUE, + IDBVersionChangeEvent: TYPE_VALUE, + ImageBitmap: TYPE_VALUE, + ImageBitmapRenderingContext: TYPE_VALUE, + ImageData: TYPE_VALUE, + MessageChannel: TYPE_VALUE, + MessageEvent: TYPE_VALUE, + MessagePortEventMap: TYPE, + MessagePort: TYPE_VALUE, + NavigationPreloadManager: TYPE_VALUE, + NavigatorConcurrentHardware: TYPE, + NavigatorID: TYPE, + NavigatorLanguage: TYPE, + NavigatorOnLine: TYPE, + NavigatorStorage: TYPE, + NotificationEventMap: TYPE, + Notification: TYPE_VALUE, + NotificationEvent: TYPE_VALUE, + OES_element_index_uint: TYPE, + OES_standard_derivatives: TYPE, + OES_texture_float: TYPE, + OES_texture_float_linear: TYPE, + OES_texture_half_float: TYPE, + OES_texture_half_float_linear: TYPE, + OES_vertex_array_object: TYPE, + OffscreenCanvas: TYPE_VALUE, + OffscreenCanvasRenderingContext2D: TYPE_VALUE, + Path2D: TYPE_VALUE, + PerformanceEventMap: TYPE, + Performance: TYPE_VALUE, + PerformanceEntry: TYPE_VALUE, + PerformanceMark: TYPE_VALUE, + PerformanceMeasure: TYPE_VALUE, + PerformanceObserver: TYPE_VALUE, + PerformanceObserverEntryList: TYPE_VALUE, + PerformanceResourceTiming: TYPE_VALUE, + PermissionStatusEventMap: TYPE, + PermissionStatus: TYPE_VALUE, + Permissions: TYPE_VALUE, + ProgressEvent: TYPE_VALUE, + PromiseRejectionEvent: TYPE_VALUE, + PushEvent: TYPE_VALUE, + PushManager: TYPE_VALUE, + PushMessageData: TYPE_VALUE, + PushSubscription: TYPE_VALUE, + PushSubscriptionOptions: TYPE_VALUE, + ReadableStream: TYPE_VALUE, + ReadableStreamDefaultController: TYPE_VALUE, + ReadableStreamDefaultReader: TYPE_VALUE, + ReadableStreamGenericReader: TYPE, + Request: TYPE_VALUE, + Response: TYPE_VALUE, + ServiceWorkerEventMap: TYPE, + ServiceWorker: TYPE_VALUE, + ServiceWorkerContainerEventMap: TYPE, + ServiceWorkerContainer: TYPE_VALUE, + ServiceWorkerGlobalScopeEventMap: TYPE, + ServiceWorkerGlobalScope: TYPE_VALUE, + ServiceWorkerRegistrationEventMap: TYPE, + ServiceWorkerRegistration: TYPE_VALUE, + SharedWorker: TYPE_VALUE, + SharedWorkerGlobalScopeEventMap: TYPE, + SharedWorkerGlobalScope: TYPE_VALUE, + StorageManager: TYPE_VALUE, + SubtleCrypto: TYPE_VALUE, + SyncEvent: TYPE_VALUE, + SyncManager: TYPE_VALUE, + TextDecoder: TYPE_VALUE, + TextDecoderCommon: TYPE, + TextDecoderStream: TYPE_VALUE, + TextEncoder: TYPE_VALUE, + TextEncoderCommon: TYPE, + TextEncoderStream: TYPE_VALUE, + TextMetrics: TYPE_VALUE, + TransformStream: TYPE_VALUE, + TransformStreamDefaultController: TYPE_VALUE, + URL: TYPE_VALUE, + URLSearchParams: TYPE_VALUE, + WEBGL_color_buffer_float: TYPE, + WEBGL_compressed_texture_astc: TYPE, + WEBGL_compressed_texture_s3tc: TYPE, + WEBGL_compressed_texture_s3tc_srgb: TYPE, + WEBGL_debug_renderer_info: TYPE, + WEBGL_debug_shaders: TYPE, + WEBGL_depth_texture: TYPE, + WEBGL_draw_buffers: TYPE, + WEBGL_lose_context: TYPE, + WebGL2RenderingContext: TYPE_VALUE, + WebGL2RenderingContextBase: TYPE, + WebGL2RenderingContextOverloads: TYPE, + WebGLActiveInfo: TYPE_VALUE, + WebGLBuffer: TYPE_VALUE, + WebGLContextEvent: TYPE_VALUE, + WebGLFramebuffer: TYPE_VALUE, + WebGLProgram: TYPE_VALUE, + WebGLQuery: TYPE_VALUE, + WebGLRenderbuffer: TYPE_VALUE, + WebGLRenderingContext: TYPE_VALUE, + WebGLRenderingContextBase: TYPE, + WebGLRenderingContextOverloads: TYPE, + WebGLSampler: TYPE_VALUE, + WebGLShader: TYPE_VALUE, + WebGLShaderPrecisionFormat: TYPE_VALUE, + WebGLSync: TYPE_VALUE, + WebGLTexture: TYPE_VALUE, + WebGLTransformFeedback: TYPE_VALUE, + WebGLUniformLocation: TYPE_VALUE, + WebGLVertexArrayObject: TYPE_VALUE, + WebGLVertexArrayObjectOES: TYPE, + WebSocketEventMap: TYPE, + WebSocket: TYPE_VALUE, + WindowClient: TYPE_VALUE, + WindowOrWorkerGlobalScope: TYPE, + WorkerEventMap: TYPE, + Worker: TYPE_VALUE, + WorkerGlobalScopeEventMap: TYPE, + WorkerGlobalScope: TYPE_VALUE, + WorkerLocation: TYPE_VALUE, + WorkerNavigator: TYPE_VALUE, + WritableStream: TYPE_VALUE, + WritableStreamDefaultController: TYPE_VALUE, + WritableStreamDefaultWriter: TYPE_VALUE, + XMLHttpRequestEventMap: TYPE, + XMLHttpRequest: TYPE_VALUE, + XMLHttpRequestEventTargetEventMap: TYPE, + XMLHttpRequestEventTarget: TYPE_VALUE, + XMLHttpRequestUpload: TYPE_VALUE, + EventListenerOrEventListenerObject: TYPE, + Console: TYPE, + WebAssembly: TYPE_VALUE, + FrameRequestCallback: TYPE, + OnErrorEventHandlerNonNull: TYPE, + PerformanceObserverCallback: TYPE, + QueuingStrategySize: TYPE, + TransformerFlushCallback: TYPE, + TransformerStartCallback: TYPE, + TransformerTransformCallback: TYPE, + UnderlyingSinkAbortCallback: TYPE, + UnderlyingSinkCloseCallback: TYPE, + UnderlyingSinkStartCallback: TYPE, + UnderlyingSinkWriteCallback: TYPE, + UnderlyingSourceCancelCallback: TYPE, + UnderlyingSourcePullCallback: TYPE, + UnderlyingSourceStartCallback: TYPE, + VoidFunction: TYPE, + HeadersInit: TYPE, + BodyInit: TYPE, + RequestInfo: TYPE, + BlobPart: TYPE, + DOMHighResTimeStamp: TYPE, + CanvasImageSource: TYPE, + OffscreenRenderingContext: TYPE, + MessageEventSource: TYPE, + ImageBitmapSource: TYPE, + OnErrorEventHandler: TYPE, + TimerHandler: TYPE, + PerformanceEntryList: TYPE, + PushMessageDataInit: TYPE, + ReadableStreamReader: TYPE, + ReadableStreamController: TYPE, + VibratePattern: TYPE, + AlgorithmIdentifier: TYPE, + HashAlgorithmIdentifier: TYPE, + BigInteger: TYPE, + NamedCurve: TYPE, + GLenum: TYPE, + GLboolean: TYPE, + GLbitfield: TYPE, + GLint: TYPE, + GLsizei: TYPE, + GLintptr: TYPE, + GLsizeiptr: TYPE, + GLuint: TYPE, + GLfloat: TYPE, + GLclampf: TYPE, + TexImageSource: TYPE, + Float32List: TYPE, + Int32List: TYPE, + GLint64: TYPE, + GLuint64: TYPE, + Uint32List: TYPE, + BufferSource: TYPE, + DOMTimeStamp: TYPE, + FormDataEntryValue: TYPE, + IDBValidKey: TYPE, + Transferable: TYPE, + ReadableStreamDefaultReadResult: TYPE, + BinaryType: TYPE, + CanvasDirection: TYPE, + CanvasFillRule: TYPE, + CanvasLineCap: TYPE, + CanvasLineJoin: TYPE, + CanvasTextAlign: TYPE, + CanvasTextBaseline: TYPE, + ClientTypes: TYPE, + ColorSpaceConversion: TYPE, + EndingType: TYPE, + FrameType: TYPE, + IDBCursorDirection: TYPE, + IDBRequestReadyState: TYPE, + IDBTransactionMode: TYPE, + ImageOrientation: TYPE, + ImageSmoothingQuality: TYPE, + KeyFormat: TYPE, + KeyType: TYPE, + KeyUsage: TYPE, + NotificationDirection: TYPE, + NotificationPermission: TYPE, + OffscreenRenderingContextId: TYPE, + PermissionName: TYPE, + PermissionState: TYPE, + PremultiplyAlpha: TYPE, + PushEncryptionKeyName: TYPE, + PushPermissionState: TYPE, + ReferrerPolicy: TYPE, + RequestCache: TYPE, + RequestCredentials: TYPE, + RequestDestination: TYPE, + RequestMode: TYPE, + RequestRedirect: TYPE, + ResizeQuality: TYPE, + ResponseType: TYPE, + ServiceWorkerState: TYPE, + ServiceWorkerUpdateViaCache: TYPE, + VisibilityState: TYPE, + WebGLPowerPreference: TYPE, + WorkerType: TYPE, + XMLHttpRequestResponseType: TYPE, } as Record; diff --git a/packages/scope-manager/src/referencer/ClassVisitor.ts b/packages/scope-manager/src/referencer/ClassVisitor.ts index fff575831910..6f5050442138 100644 --- a/packages/scope-manager/src/referencer/ClassVisitor.ts +++ b/packages/scope-manager/src/referencer/ClassVisitor.ts @@ -80,8 +80,8 @@ class ClassVisitor extends Visitor { this.#referencer.close(node); } - protected visitClassProperty( - node: TSESTree.TSAbstractClassProperty | TSESTree.ClassProperty, + protected visitPropertyDefinition( + node: TSESTree.TSAbstractPropertyDefinition | TSESTree.PropertyDefinition, ): void { this.visitProperty(node); /** @@ -229,15 +229,27 @@ class ClassVisitor extends Visitor { protected visitProperty( node: - | TSESTree.ClassProperty - | TSESTree.TSAbstractClassProperty + | TSESTree.PropertyDefinition + | TSESTree.TSAbstractPropertyDefinition | TSESTree.TSAbstractMethodDefinition, ): void { if (node.computed) { this.#referencer.visit(node.key); } - this.#referencer.visit(node.value); + if (node.value) { + if (node.type === AST_NODE_TYPES.PropertyDefinition) { + this.#referencer.scopeManager.nestClassFieldInitializerScope( + node.value, + ); + } + + this.#referencer.visit(node.value); + + if (node.type === AST_NODE_TYPES.PropertyDefinition) { + this.#referencer.close(node.value); + } + } if ('decorators' in node) { node.decorators?.forEach(d => this.#referencer.visit(d)); @@ -318,18 +330,18 @@ class ClassVisitor extends Visitor { this.visitChildren(node); } - protected ClassProperty(node: TSESTree.ClassProperty): void { - this.visitClassProperty(node); + protected PropertyDefinition(node: TSESTree.PropertyDefinition): void { + this.visitPropertyDefinition(node); } protected MethodDefinition(node: TSESTree.MethodDefinition): void { this.visitMethod(node); } - protected TSAbstractClassProperty( - node: TSESTree.TSAbstractClassProperty, + protected TSAbstractPropertyDefinition( + node: TSESTree.TSAbstractPropertyDefinition, ): void { - this.visitClassProperty(node); + this.visitPropertyDefinition(node); } protected TSAbstractMethodDefinition( @@ -341,6 +353,10 @@ class ClassVisitor extends Visitor { protected Identifier(node: TSESTree.Identifier): void { this.#referencer.visit(node); } + + protected PrivateIdentifier(): void { + // intentionally skip + } } /** diff --git a/packages/scope-manager/src/referencer/Referencer.ts b/packages/scope-manager/src/referencer/Referencer.ts index b0e7557ee7eb..9109feb3edb4 100644 --- a/packages/scope-manager/src/referencer/Referencer.ts +++ b/packages/scope-manager/src/referencer/Referencer.ts @@ -22,7 +22,7 @@ import { lib as TSLibraries } from '../lib'; import { Scope, GlobalScope } from '../scope'; interface ReferencerOptions extends VisitorOptions { - jsxPragma: string; + jsxPragma: string | null; jsxFragmentName: string | null; lib: Lib[]; emitDecoratorMetadata: boolean; @@ -30,7 +30,7 @@ interface ReferencerOptions extends VisitorOptions { // Referencing variables and creating bindings. class Referencer extends Visitor { - #jsxPragma: string; + #jsxPragma: string | null; #jsxFragmentName: string | null; #hasReferencedJsxFactory = false; #hasReferencedJsxFragmentFactory = false; @@ -87,14 +87,13 @@ class Referencer extends Visitor { /* istanbul ignore if */ if (!variables) { throw new Error(`Invalid value for lib provided: ${lib}`); } - for (const variable of Object.values(variables)) { - globalScope.defineImplicitVariable(variable); + for (const [name, variable] of Object.entries(variables)) { + globalScope.defineImplicitVariable(name, variable); } } // for const assertions (`{} as const` / `{}`) - globalScope.defineImplicitVariable({ - name: 'const', + globalScope.defineImplicitVariable('const', { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, isValueVariable: false, @@ -121,7 +120,7 @@ class Referencer extends Visitor { } private referenceJsxPragma(): void { - if (this.#hasReferencedJsxFactory) { + if (this.#jsxPragma === null || this.#hasReferencedJsxFactory) { return; } this.#hasReferencedJsxFactory = this.referenceInSomeUpperScope( @@ -320,7 +319,7 @@ class Referencer extends Visitor { case AST_NODE_TYPES.TSAsExpression: case AST_NODE_TYPES.TSTypeAssertion: // explicitly visit the type annotation - this.visit(left.typeAnnotation); + this.visitType(left.typeAnnotation); // intentional fallthrough case AST_NODE_TYPES.TSNonNullExpression: // unwrap the expression @@ -552,6 +551,10 @@ class Referencer extends Visitor { this.visitType(node.typeParameters); } + protected PrivateIdentifier(): void { + // private identifiers are members on classes and thus have no variables to to reference + } + protected Program(node: TSESTree.Program): void { const globalScope = this.scopeManager.nestGlobalScope(node); this.populateGlobalsFromLib(globalScope); diff --git a/packages/scope-manager/src/scope/ClassFieldInitializerScope.ts b/packages/scope-manager/src/scope/ClassFieldInitializerScope.ts new file mode 100644 index 000000000000..b176fb2060fc --- /dev/null +++ b/packages/scope-manager/src/scope/ClassFieldInitializerScope.ts @@ -0,0 +1,28 @@ +import { TSESTree } from '@typescript-eslint/types'; +import { Scope } from './Scope'; +import { ScopeBase } from './ScopeBase'; +import { ScopeType } from './ScopeType'; +import { ScopeManager } from '../ScopeManager'; + +class ClassFieldInitializerScope extends ScopeBase< + ScopeType.classFieldInitializer, + // the value expression itself is the block + TSESTree.Expression, + Scope +> { + constructor( + scopeManager: ScopeManager, + upperScope: ClassFieldInitializerScope['upper'], + block: ClassFieldInitializerScope['block'], + ) { + super( + scopeManager, + ScopeType.classFieldInitializer, + upperScope, + block, + false, + ); + } +} + +export { ClassFieldInitializerScope }; diff --git a/packages/scope-manager/src/scope/GlobalScope.ts b/packages/scope-manager/src/scope/GlobalScope.ts index 3da909c1cee5..9dfb1e30284e 100644 --- a/packages/scope-manager/src/scope/GlobalScope.ts +++ b/packages/scope-manager/src/scope/GlobalScope.ts @@ -34,15 +34,18 @@ class GlobalScope extends ScopeBase< constructor(scopeManager: ScopeManager, block: GlobalScope['block']) { super(scopeManager, ScopeType.global, null, block, false); this.implicit = { - set: new Map(), + set: new Map(), variables: [], leftToBeResolved: [], }; } - public defineImplicitVariable(options: ImplicitLibVariableOptions): void { + public defineImplicitVariable( + name: string, + options: ImplicitLibVariableOptions, + ): void { this.defineVariable( - new ImplicitLibVariable(this, options), + new ImplicitLibVariable(this, name, options), this.set, this.variables, null, diff --git a/packages/scope-manager/src/scope/Scope.ts b/packages/scope-manager/src/scope/Scope.ts index 7df3f941629c..966e52a9456a 100644 --- a/packages/scope-manager/src/scope/Scope.ts +++ b/packages/scope-manager/src/scope/Scope.ts @@ -1,5 +1,6 @@ import { BlockScope } from './BlockScope'; import { CatchScope } from './CatchScope'; +import { ClassFieldInitializerScope } from './ClassFieldInitializerScope'; import { ClassScope } from './ClassScope'; import { ConditionalTypeScope } from './ConditionalTypeScope'; import { ForScope } from './ForScope'; @@ -19,6 +20,7 @@ type Scope = | BlockScope | CatchScope | ClassScope + | ClassFieldInitializerScope | ConditionalTypeScope | ForScope | FunctionExpressionNameScope diff --git a/packages/scope-manager/src/scope/ScopeBase.ts b/packages/scope-manager/src/scope/ScopeBase.ts index 04f38e8a65f3..34c9a338b5b1 100644 --- a/packages/scope-manager/src/scope/ScopeBase.ts +++ b/packages/scope-manager/src/scope/ScopeBase.ts @@ -87,22 +87,20 @@ function isStrictScope( if (stmt.type !== AST_NODE_TYPES.ExpressionStatement) { break; } - const expr = stmt.expression; - if ( - expr.type !== AST_NODE_TYPES.Literal || - typeof expr.value !== 'string' - ) { + if (stmt.directive === 'use strict') { + return true; + } + + const expr = stmt.expression; + if (expr.type !== AST_NODE_TYPES.Literal) { break; } - if (expr.raw !== null && expr.raw !== undefined) { - if (expr.raw === '"use strict"' || expr.raw === "'use strict'") { - return true; - } - } else { - if (expr.value === 'use strict') { - return true; - } + if (expr.raw === '"use strict"' || expr.raw === "'use strict'") { + return true; + } + if (expr.value === 'use strict') { + return true; } } return false; @@ -127,8 +125,9 @@ const generator = createIdGenerator(); type VariableScope = GlobalScope | FunctionScope | ModuleScope | TSModuleScope; const VARIABLE_SCOPE_TYPES = new Set([ - ScopeType.global, + ScopeType.classFieldInitializer, ScopeType.function, + ScopeType.global, ScopeType.module, ScopeType.tsModule, ]); @@ -137,7 +136,7 @@ type AnyScope = ScopeBase; abstract class ScopeBase< TType extends ScopeType, TBlock extends TSESTree.Node, - TUpper extends Scope | null + TUpper extends Scope | null, > { /** * A unique ID for this instance - primarily used to help debugging and testing @@ -389,7 +388,7 @@ abstract class ScopeBase< } protected delegateToUpperScope(ref: Reference): void { - const upper = (this.upper as Scope) as AnyScope; + const upper = this.upper as Scope as AnyScope; if (upper?.leftToResolve) { upper.leftToResolve.push(ref); } diff --git a/packages/scope-manager/src/scope/ScopeType.ts b/packages/scope-manager/src/scope/ScopeType.ts index 23d70fedbe80..8a63ffbdea7f 100644 --- a/packages/scope-manager/src/scope/ScopeType.ts +++ b/packages/scope-manager/src/scope/ScopeType.ts @@ -2,6 +2,7 @@ enum ScopeType { block = 'block', catch = 'catch', class = 'class', + classFieldInitializer = 'class-field-initializer', conditionalType = 'conditionalType', for = 'for', function = 'function', diff --git a/packages/scope-manager/src/scope/index.ts b/packages/scope-manager/src/scope/index.ts index 8e4683dbe68a..c94cc2982e1f 100644 --- a/packages/scope-manager/src/scope/index.ts +++ b/packages/scope-manager/src/scope/index.ts @@ -1,5 +1,6 @@ export * from './BlockScope'; export * from './CatchScope'; +export * from './ClassFieldInitializerScope'; export * from './ClassScope'; export * from './ConditionalTypeScope'; export * from './ForScope'; diff --git a/packages/scope-manager/src/variable/ImplicitLibVariable.ts b/packages/scope-manager/src/variable/ImplicitLibVariable.ts index ee3d69995d7a..898ee4a6fb7a 100644 --- a/packages/scope-manager/src/variable/ImplicitLibVariable.ts +++ b/packages/scope-manager/src/variable/ImplicitLibVariable.ts @@ -6,7 +6,6 @@ interface ImplicitLibVariableOptions { readonly eslintImplicitGlobalSetting?: ESLintScopeVariable['eslintImplicitGlobalSetting']; readonly isTypeVariable?: boolean; readonly isValueVariable?: boolean; - readonly name: string; readonly writeable?: boolean; } @@ -26,10 +25,10 @@ class ImplicitLibVariable extends ESLintScopeVariable implements Variable { public constructor( scope: Scope, + name: string, { isTypeVariable, isValueVariable, - name, writeable, eslintImplicitGlobalSetting, }: ImplicitLibVariableOptions, diff --git a/packages/scope-manager/tests/eslint-scope/class-fields.test.ts b/packages/scope-manager/tests/eslint-scope/class-fields.test.ts new file mode 100644 index 000000000000..541b46a2fff2 --- /dev/null +++ b/packages/scope-manager/tests/eslint-scope/class-fields.test.ts @@ -0,0 +1,101 @@ +import { + expectToBeClassFieldInitializerScope, + expectToBeIdentifier, +} from '../util'; +import { + expectToBeClassScope, + expectToBeGlobalScope, + parseAndAnalyze, +} from '../util'; + +describe('Class fields', () => { + it('class C { f = g }', () => { + const { scopeManager } = parseAndAnalyze('class C { f = g }'); + + const globalScope = scopeManager.scopes[0]; + expectToBeGlobalScope(globalScope); + + const classScope = globalScope.childScopes[0]; + // should create a class scope + expectToBeClassScope(classScope); + // The class scope has no references + expect(classScope.references).toHaveLength(0); + // The class scope has only the variable 'C'; it doesn't have the field name 'f'. + expect(classScope.variables).toHaveLength(1); + expect(classScope.variables[0].name).toBe('C'); + + const classFieldInitializerScope = classScope.childScopes[0]; + // The class scope has a class-field-initializer scope. + expectToBeClassFieldInitializerScope(classFieldInitializerScope); + // The class-field-initializer scope's block is the node of the field initializer. + expectToBeIdentifier(classFieldInitializerScope.block); + expect(classFieldInitializerScope.block.name).toBe('g'); + // The class-field-initializer scope's variableScope is itself. + expect(classFieldInitializerScope.variableScope).toBe( + classFieldInitializerScope, + ); + // The class-field-initializer scope has only the reference 'g'. + expect(classFieldInitializerScope.references).toHaveLength(1); + expect(classFieldInitializerScope.references[0].identifier.name).toBe('g'); + // The class-field-initializer scope has no variables. + expect(classFieldInitializerScope.variables).toHaveLength(0); + }); + + describe('class C { f }', () => { + const { scopeManager } = parseAndAnalyze('class C { f }'); + + const globalScope = scopeManager.scopes[0]; + expectToBeGlobalScope(globalScope); + + const classScope = globalScope.childScopes[0]; + // should create a class scope + expectToBeClassScope(classScope); + // The class scope has no references + expect(classScope.references).toHaveLength(0); + // The class scope has no child scopes; fields that don't have initializers don't create any class-field-initializer scopes. + expect(classScope.childScopes).toHaveLength(0); + // The class scope has only the variable 'C'; it doesn't have the field name 'f'. + expect(classScope.variables).toHaveLength(1); + expect(classScope.variables[0].name).toBe('C'); + }); + + describe('class C { [fname] }', () => { + const { scopeManager } = parseAndAnalyze('class C { [fname] }'); + + const globalScope = scopeManager.scopes[0]; + expectToBeGlobalScope(globalScope); + + const classScope = globalScope.childScopes[0]; + // should create a class scope + expectToBeClassScope(classScope); + // The class scope has only the reference `fname`. + expect(classScope.references).toHaveLength(1); + // The class scope has no child scopes; fields that don't have initializers don't create any class-field-initializer scopes. + expect(classScope.childScopes).toHaveLength(0); + }); + + describe('class C { [fname] = value }', () => { + const { scopeManager } = parseAndAnalyze('class C { [fname] = value }'); + + const globalScope = scopeManager.scopes[0]; + expectToBeGlobalScope(globalScope); + + const classScope = globalScope.childScopes[0]; + // should create a class scope + expectToBeClassScope(classScope); + // The class scope has only the reference `fname`; it doesn't have the reference 'value'. + expect(classScope.references).toHaveLength(1); + expect(classScope.references[0].identifier.name).toBe('fname'); + + const classFieldInitializerScope = classScope.childScopes[0]; + // The class scope has a class-field-initializer scope. + expectToBeClassFieldInitializerScope(classFieldInitializerScope); + // The class-field-initializer scope has the reference 'value'. + expect(classFieldInitializerScope.references).toHaveLength(1); + expect(classFieldInitializerScope.references[0].identifier.name).toBe( + 'value', + ); + // The class-field-initializer scope has no variables. + expect(classFieldInitializerScope.variables).toHaveLength(0); + }); +}); diff --git a/packages/scope-manager/tests/eslint-scope/es6-default-parameters.test.ts b/packages/scope-manager/tests/eslint-scope/es6-default-parameters.test.ts index 3134930f5d19..9fa61d522324 100644 --- a/packages/scope-manager/tests/eslint-scope/es6-default-parameters.test.ts +++ b/packages/scope-manager/tests/eslint-scope/es6-default-parameters.test.ts @@ -37,7 +37,7 @@ describe('ES6 default parameters:', () => { expect(reference.from).toBe(scope); expect(reference.identifier.name).toBe('b'); expect(reference.resolved).toBe(variables[numVars - 1]); - expect(reference.writeExpr).not.toBeUndefined(); + expect(reference.writeExpr).toBeDefined(); expect(reference.isWrite()).toBeTruthy(); expect(reference.isRead()).toBeFalsy(); }); 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 index 3a5957b7003a..9cf4cfab3d77 100644 --- a/packages/scope-manager/tests/eslint-scope/map-ecma-version.test.ts +++ b/packages/scope-manager/tests/eslint-scope/map-ecma-version.test.ts @@ -31,9 +31,14 @@ describe('ecma version mapping', () => { 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; +const fakeNode = {} as unknown as TSESTree.Node; function expectMapping(ecmaVersion: number | undefined, lib: Lib): void { (Referencer as jest.Mock).mockClear(); diff --git a/packages/scope-manager/tests/eslint-scope/references.test.ts b/packages/scope-manager/tests/eslint-scope/references.test.ts index 5f07dd671e93..15ed88c9a1ef 100644 --- a/packages/scope-manager/tests/eslint-scope/references.test.ts +++ b/packages/scope-manager/tests/eslint-scope/references.test.ts @@ -18,7 +18,7 @@ describe('References:', () => { expect(reference.from).toBe(scope); expect(reference.identifier.name).toBe('a'); expect(reference.resolved).toBe(variables[0]); - expect(reference.writeExpr).not.toBeUndefined(); + expect(reference.writeExpr).toBeDefined(); expect(reference.isWrite()).toBeTruthy(); expect(reference.isRead()).toBeFalsy(); }); @@ -96,7 +96,7 @@ describe('References:', () => { expect(reference.from).toBe(scope); expect(reference.identifier.name).toBe('a'); expect(reference.resolved).toBe(variables[0]); - expect(reference.writeExpr).not.toBeUndefined(); + expect(reference.writeExpr).toBeDefined(); expect(reference.isWrite()).toBeTruthy(); expect(reference.isRead()).toBeFalsy(); }); @@ -147,7 +147,7 @@ describe('References:', () => { expect(reference.from).toBe(scope); expect(reference.identifier.name).toBe('a'); expect(reference.resolved).toBeNull(); - expect(reference.writeExpr).not.toBeUndefined(); + expect(reference.writeExpr).toBeDefined(); expect(reference.isWrite()).toBeTruthy(); expect(reference.isRead()).toBeFalsy(); }); @@ -254,7 +254,7 @@ describe('References:', () => { expect(reference.from).toBe(scope); expect(reference.identifier.name).toBe('a'); expect(reference.resolved).toBe(variables[1]); - expect(reference.writeExpr).not.toBeUndefined(); + expect(reference.writeExpr).toBeDefined(); expect(reference.isWrite()).toBeTruthy(); expect(reference.isRead()).toBeFalsy(); }); @@ -311,7 +311,7 @@ describe('References:', () => { expect(reference.from).toBe(scope); expect(reference.identifier.name).toBe('a'); expect(reference.resolved).toBe(variables[1]); - expect(reference.writeExpr).not.toBeUndefined(); + expect(reference.writeExpr).toBeDefined(); expect(reference.isWrite()).toBeTruthy(); expect(reference.isRead()).toBeFalsy(); }); @@ -364,7 +364,7 @@ describe('References:', () => { expect(reference.from).toBe(scope); expect(reference.identifier.name).toBe('a'); expect(reference.resolved).toBe(variables[0]); - expect(reference.writeExpr).not.toBeUndefined(); + expect(reference.writeExpr).toBeDefined(); expect(reference.isWrite()).toBeTruthy(); expect(reference.isRead()).toBeFalsy(); }); @@ -385,7 +385,7 @@ describe('References:', () => { expect(reference.from).toBe(scope); expect(reference.identifier.name).toBe('a'); expect(reference.resolved).toBe(variables[0]); - expect(reference.writeExpr).not.toBeUndefined(); + expect(reference.writeExpr).toBeDefined(); expect(reference.isWrite()).toBeTruthy(); expect(reference.isRead()).toBeFalsy(); }); @@ -406,7 +406,7 @@ describe('References:', () => { expect(reference.from).toBe(scope); expect(reference.identifier.name).toBe('a'); expect(reference.resolved).toBe(variables[0]); - expect(reference.writeExpr).not.toBeUndefined(); + expect(reference.writeExpr).toBeDefined(); expect(reference.isWrite()).toBeTruthy(); expect(reference.isRead()).toBeFalsy(); }); @@ -643,6 +643,7 @@ describe('References:', () => { expect(constructorParamTypeRef1.isValueReference).toBe(true); const setterParamTypeRef3 = classBScope.childScopes[1].references[0]; + // eslint-disable-next-line @typescript-eslint/internal/prefer-ast-types-enum expect(setterParamTypeRef3.identifier.name).toBe('Type'); expect(setterParamTypeRef3.isTypeReference).toBe(true); expect(setterParamTypeRef3.isValueReference).toBe(false); diff --git a/packages/scope-manager/tests/fixtures.test.ts b/packages/scope-manager/tests/fixtures.test.ts index 69833caa7faa..b504710c4cfd 100644 --- a/packages/scope-manager/tests/fixtures.test.ts +++ b/packages/scope-manager/tests/fixtures.test.ts @@ -124,7 +124,7 @@ function nestDescribe( throw new Error( `Expected value for ${key} to be one of (${Array.from(type[1]).join( ' | ', - )}), but got ${value}`, + )}), but got ${value as string}`, ); } @@ -139,7 +139,10 @@ function nestDescribe( try { makeDir.sync(fixture.snapshotPath); - } catch (e) { + } catch ( + // eslint-disable-next-line @typescript-eslint/no-explicit-any + e: any + ) { if ('code' in e && e.code === 'EEXIST') { // already exists - ignored } else { diff --git a/packages/scope-manager/tests/fixtures/class/declaration/computed-member.ts.shot b/packages/scope-manager/tests/fixtures/class/declaration/computed-member.ts.shot index fa221e5e540d..87bcc27ae85a 100644 --- a/packages/scope-manager/tests/fixtures/class/declaration/computed-member.ts.shot +++ b/packages/scope-manager/tests/fixtures/class/declaration/computed-member.ts.shot @@ -137,8 +137,17 @@ ScopeManager { Variable$5, ], }, - FunctionScope$3 { - block: FunctionExpression$7, + ClassFieldInitializerScope$3 { + block: Literal$7, + isStrict: true, + references: Array [], + set: Map {}, + type: "class-field-initializer", + upper: ClassScope$2, + variables: Array [], + }, + FunctionScope$4 { + block: FunctionExpression$8, isStrict: true, references: Array [], set: Map { diff --git a/packages/scope-manager/tests/fixtures/class/declaration/private-identifier.ts b/packages/scope-manager/tests/fixtures/class/declaration/private-identifier.ts new file mode 100644 index 000000000000..13ab5d80c3e9 --- /dev/null +++ b/packages/scope-manager/tests/fixtures/class/declaration/private-identifier.ts @@ -0,0 +1,7 @@ +class Foo { + #bar; + + constructor() { + this.#bar = 1; + } +} diff --git a/packages/scope-manager/tests/fixtures/class/declaration/private-identifier.ts.shot b/packages/scope-manager/tests/fixtures/class/declaration/private-identifier.ts.shot new file mode 100644 index 000000000000..bed463a748a8 --- /dev/null +++ b/packages/scope-manager/tests/fixtures/class/declaration/private-identifier.ts.shot @@ -0,0 +1,83 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`class declaration private-identifier 1`] = ` +ScopeManager { + variables: Array [ + ImplicitGlobalConstTypeVariable, + Variable$2 { + defs: Array [ + ClassNameDefinition$1 { + name: Identifier<"Foo">, + node: ClassDeclaration$1, + }, + ], + name: "Foo", + references: Array [], + isValueVariable: true, + isTypeVariable: true, + }, + Variable$3 { + defs: Array [ + ClassNameDefinition$2 { + name: Identifier<"Foo">, + node: ClassDeclaration$1, + }, + ], + name: "Foo", + references: Array [], + isValueVariable: true, + isTypeVariable: true, + }, + Variable$4 { + defs: Array [], + name: "arguments", + references: Array [], + isValueVariable: true, + isTypeVariable: true, + }, + ], + scopes: Array [ + GlobalScope$1 { + block: Program$2, + isStrict: false, + references: Array [], + set: Map { + "const" => ImplicitGlobalConstTypeVariable, + "Foo" => Variable$2, + }, + type: "global", + upper: null, + variables: Array [ + ImplicitGlobalConstTypeVariable, + Variable$2, + ], + }, + ClassScope$2 { + block: ClassDeclaration$1, + isStrict: true, + references: Array [], + set: Map { + "Foo" => Variable$3, + }, + type: "class", + upper: GlobalScope$1, + variables: Array [ + Variable$3, + ], + }, + FunctionScope$3 { + block: FunctionExpression$3, + isStrict: true, + references: Array [], + set: Map { + "arguments" => Variable$4, + }, + type: "function", + upper: ClassScope$2, + variables: Array [ + Variable$4, + ], + }, + ], +} +`; diff --git a/packages/scope-manager/tests/fixtures/class/declaration/properties.ts b/packages/scope-manager/tests/fixtures/class/declaration/properties.ts index c047395435ad..e75d9def3e96 100644 --- a/packages/scope-manager/tests/fixtures/class/declaration/properties.ts +++ b/packages/scope-manager/tests/fixtures/class/declaration/properties.ts @@ -1,5 +1,7 @@ +const x = 1; class A { - prop = 1; + prop1 = 1; + prop2 = x; } -const unresolved = prop; +const unresolved = prop1; diff --git a/packages/scope-manager/tests/fixtures/class/declaration/properties.ts.shot b/packages/scope-manager/tests/fixtures/class/declaration/properties.ts.shot index 3592b97d80a5..180bf6246fb7 100644 --- a/packages/scope-manager/tests/fixtures/class/declaration/properties.ts.shot +++ b/packages/scope-manager/tests/fixtures/class/declaration/properties.ts.shot @@ -6,9 +6,40 @@ ScopeManager { ImplicitGlobalConstTypeVariable, Variable$2 { defs: Array [ - ClassNameDefinition$1 { + VariableDefinition$1 { + name: Identifier<"x">, + node: VariableDeclarator$1, + }, + ], + name: "x", + references: Array [ + Reference$1 { + identifier: Identifier<"x">, + init: true, + isRead: false, + isTypeReference: false, + isValueReference: true, + isWrite: true, + resolved: Variable$2, + writeExpr: Literal$2, + }, + Reference$2 { + identifier: Identifier<"x">, + isRead: true, + isTypeReference: false, + isValueReference: true, + isWrite: false, + resolved: Variable$2, + }, + ], + isValueVariable: true, + isTypeVariable: false, + }, + Variable$3 { + defs: Array [ + ClassNameDefinition$2 { name: Identifier<"A">, - node: ClassDeclaration$1, + node: ClassDeclaration$3, }, ], name: "A", @@ -16,11 +47,11 @@ ScopeManager { isValueVariable: true, isTypeVariable: true, }, - Variable$3 { + Variable$4 { defs: Array [ - ClassNameDefinition$2 { + ClassNameDefinition$3 { name: Identifier<"A">, - node: ClassDeclaration$1, + node: ClassDeclaration$3, }, ], name: "A", @@ -28,24 +59,24 @@ ScopeManager { isValueVariable: true, isTypeVariable: true, }, - Variable$4 { + Variable$5 { defs: Array [ - VariableDefinition$3 { + VariableDefinition$4 { name: Identifier<"unresolved">, - node: VariableDeclarator$2, + node: VariableDeclarator$4, }, ], name: "unresolved", references: Array [ - Reference$1 { + Reference$3 { identifier: Identifier<"unresolved">, init: true, isRead: false, isTypeReference: false, isValueReference: true, isWrite: true, - resolved: Variable$4, - writeExpr: Identifier<"prop">, + resolved: Variable$5, + writeExpr: Identifier<"prop1">, }, ], isValueVariable: true, @@ -54,12 +85,13 @@ ScopeManager { ], scopes: Array [ GlobalScope$1 { - block: Program$3, + block: Program$5, isStrict: false, references: Array [ Reference$1, - Reference$2 { - identifier: Identifier<"prop">, + Reference$3, + Reference$4 { + identifier: Identifier<"prop1">, isRead: true, isTypeReference: false, isValueReference: true, @@ -69,29 +101,51 @@ ScopeManager { ], set: Map { "const" => ImplicitGlobalConstTypeVariable, - "A" => Variable$2, - "unresolved" => Variable$4, + "x" => Variable$2, + "A" => Variable$3, + "unresolved" => Variable$5, }, type: "global", upper: null, variables: Array [ ImplicitGlobalConstTypeVariable, Variable$2, - Variable$4, + Variable$3, + Variable$5, ], }, ClassScope$2 { - block: ClassDeclaration$1, + block: ClassDeclaration$3, isStrict: true, references: Array [], set: Map { - "A" => Variable$3, + "A" => Variable$4, }, type: "class", upper: GlobalScope$1, variables: Array [ - Variable$3, + Variable$4, + ], + }, + ClassFieldInitializerScope$3 { + block: Literal$6, + isStrict: true, + references: Array [], + set: Map {}, + type: "class-field-initializer", + upper: ClassScope$2, + variables: Array [], + }, + ClassFieldInitializerScope$4 { + block: Identifier<"x">, + isStrict: true, + references: Array [ + Reference$2, ], + set: Map {}, + type: "class-field-initializer", + upper: ClassScope$2, + variables: Array [], }, ], } diff --git a/packages/scope-manager/tests/fixtures/class/expression/computed-member.ts.shot b/packages/scope-manager/tests/fixtures/class/expression/computed-member.ts.shot index 25e96169fc75..f9080b0c6ee2 100644 --- a/packages/scope-manager/tests/fixtures/class/expression/computed-member.ts.shot +++ b/packages/scope-manager/tests/fixtures/class/expression/computed-member.ts.shot @@ -133,8 +133,17 @@ ScopeManager { upper: GlobalScope$1, variables: Array [], }, - FunctionScope$3 { - block: FunctionExpression$8, + ClassFieldInitializerScope$3 { + block: Literal$8, + isStrict: true, + references: Array [], + set: Map {}, + type: "class-field-initializer", + upper: ClassScope$2, + variables: Array [], + }, + FunctionScope$4 { + block: FunctionExpression$9, isStrict: true, references: Array [], set: Map { diff --git a/packages/scope-manager/tests/fixtures/class/expression/private-identifier.ts b/packages/scope-manager/tests/fixtures/class/expression/private-identifier.ts new file mode 100644 index 000000000000..95d1cb660ad4 --- /dev/null +++ b/packages/scope-manager/tests/fixtures/class/expression/private-identifier.ts @@ -0,0 +1,7 @@ +const Foo = class { + #bar; + + constructor() { + this.#bar = 1; + } +}; diff --git a/packages/scope-manager/tests/fixtures/class/expression/private-identifier.ts.shot b/packages/scope-manager/tests/fixtures/class/expression/private-identifier.ts.shot new file mode 100644 index 000000000000..d9961a857634 --- /dev/null +++ b/packages/scope-manager/tests/fixtures/class/expression/private-identifier.ts.shot @@ -0,0 +1,80 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`class expression private-identifier 1`] = ` +ScopeManager { + variables: Array [ + ImplicitGlobalConstTypeVariable, + Variable$2 { + defs: Array [ + VariableDefinition$1 { + name: Identifier<"Foo">, + node: VariableDeclarator$1, + }, + ], + name: "Foo", + references: Array [ + Reference$1 { + identifier: Identifier<"Foo">, + init: true, + isRead: false, + isTypeReference: false, + isValueReference: true, + isWrite: true, + resolved: Variable$2, + writeExpr: ClassExpression$2, + }, + ], + isValueVariable: true, + isTypeVariable: false, + }, + Variable$3 { + defs: Array [], + name: "arguments", + references: Array [], + isValueVariable: true, + isTypeVariable: true, + }, + ], + scopes: Array [ + GlobalScope$1 { + block: Program$3, + isStrict: false, + references: Array [ + Reference$1, + ], + set: Map { + "const" => ImplicitGlobalConstTypeVariable, + "Foo" => Variable$2, + }, + type: "global", + upper: null, + variables: Array [ + ImplicitGlobalConstTypeVariable, + Variable$2, + ], + }, + ClassScope$2 { + block: ClassExpression$2, + isStrict: true, + references: Array [], + set: Map {}, + type: "class", + upper: GlobalScope$1, + variables: Array [], + }, + FunctionScope$3 { + block: FunctionExpression$4, + isStrict: true, + references: Array [], + set: Map { + "arguments" => Variable$3, + }, + type: "function", + upper: ClassScope$2, + variables: Array [ + Variable$3, + ], + }, + ], +} +`; diff --git a/packages/scope-manager/tests/fixtures/class/expression/properties.ts b/packages/scope-manager/tests/fixtures/class/expression/properties.ts index 49b1efe6297e..508292413246 100644 --- a/packages/scope-manager/tests/fixtures/class/expression/properties.ts +++ b/packages/scope-manager/tests/fixtures/class/expression/properties.ts @@ -1,5 +1,7 @@ +const x = 1; const A = class { - prop = 1; + prop1 = 1; + prop2 = x; }; const unresolved = prop; diff --git a/packages/scope-manager/tests/fixtures/class/expression/properties.ts.shot b/packages/scope-manager/tests/fixtures/class/expression/properties.ts.shot index 261a24a50ecc..b5f489d2502b 100644 --- a/packages/scope-manager/tests/fixtures/class/expression/properties.ts.shot +++ b/packages/scope-manager/tests/fixtures/class/expression/properties.ts.shot @@ -7,21 +7,29 @@ ScopeManager { Variable$2 { defs: Array [ VariableDefinition$1 { - name: Identifier<"A">, + name: Identifier<"x">, node: VariableDeclarator$1, }, ], - name: "A", + name: "x", references: Array [ Reference$1 { - identifier: Identifier<"A">, + identifier: Identifier<"x">, init: true, isRead: false, isTypeReference: false, isValueReference: true, isWrite: true, resolved: Variable$2, - writeExpr: ClassExpression$2, + writeExpr: Literal$2, + }, + Reference$3 { + identifier: Identifier<"x">, + isRead: true, + isTypeReference: false, + isValueReference: true, + isWrite: false, + resolved: Variable$2, }, ], isValueVariable: true, @@ -30,20 +38,43 @@ ScopeManager { Variable$3 { defs: Array [ VariableDefinition$2 { - name: Identifier<"unresolved">, + name: Identifier<"A">, node: VariableDeclarator$3, }, ], - name: "unresolved", + name: "A", references: Array [ Reference$2 { - identifier: Identifier<"unresolved">, + identifier: Identifier<"A">, init: true, isRead: false, isTypeReference: false, isValueReference: true, isWrite: true, resolved: Variable$3, + writeExpr: ClassExpression$4, + }, + ], + isValueVariable: true, + isTypeVariable: false, + }, + Variable$4 { + defs: Array [ + VariableDefinition$3 { + name: Identifier<"unresolved">, + node: VariableDeclarator$5, + }, + ], + name: "unresolved", + references: Array [ + Reference$4 { + identifier: Identifier<"unresolved">, + init: true, + isRead: false, + isTypeReference: false, + isValueReference: true, + isWrite: true, + resolved: Variable$4, writeExpr: Identifier<"prop">, }, ], @@ -53,12 +84,13 @@ ScopeManager { ], scopes: Array [ GlobalScope$1 { - block: Program$4, + block: Program$6, isStrict: false, references: Array [ Reference$1, Reference$2, - Reference$3 { + Reference$4, + Reference$5 { identifier: Identifier<"prop">, isRead: true, isTypeReference: false, @@ -69,8 +101,9 @@ ScopeManager { ], set: Map { "const" => ImplicitGlobalConstTypeVariable, - "A" => Variable$2, - "unresolved" => Variable$3, + "x" => Variable$2, + "A" => Variable$3, + "unresolved" => Variable$4, }, type: "global", upper: null, @@ -78,10 +111,11 @@ ScopeManager { ImplicitGlobalConstTypeVariable, Variable$2, Variable$3, + Variable$4, ], }, ClassScope$2 { - block: ClassExpression$2, + block: ClassExpression$4, isStrict: true, references: Array [], set: Map {}, @@ -89,6 +123,26 @@ ScopeManager { upper: GlobalScope$1, variables: Array [], }, + ClassFieldInitializerScope$3 { + block: Literal$7, + isStrict: true, + references: Array [], + set: Map {}, + type: "class-field-initializer", + upper: ClassScope$2, + variables: Array [], + }, + ClassFieldInitializerScope$4 { + block: Identifier<"x">, + isStrict: true, + references: Array [ + Reference$3, + ], + set: Map {}, + type: "class-field-initializer", + upper: ClassScope$2, + variables: Array [], + }, ], } `; diff --git a/packages/scope-manager/tests/util/expect.ts b/packages/scope-manager/tests/util/expect.ts index 0057af9f85c2..5609a923598b 100644 --- a/packages/scope-manager/tests/util/expect.ts +++ b/packages/scope-manager/tests/util/expect.ts @@ -14,6 +14,7 @@ import { BlockScope, CatchScope, ClassScope, + ClassFieldInitializerScope, ForScope, FunctionExpressionNameScope, FunctionScope, @@ -35,6 +36,11 @@ function expectToBeBlockScope(scope: Scope): asserts scope is BlockScope { function expectToBeCatchScope(scope: Scope): asserts scope is CatchScope { expect(scope.type).toBe(ScopeType.catch); } +function expectToBeClassFieldInitializerScope( + scope: Scope, +): asserts scope is ClassFieldInitializerScope { + expect(scope.type).toBe(ScopeType.classFieldInitializer); +} function expectToBeClassScope(scope: Scope): asserts scope is ClassScope { expect(scope.type).toBe(ScopeType.class); } @@ -65,6 +71,7 @@ function expectToBeWithScope(scope: Scope): asserts scope is WithScope { export { expectToBeBlockScope, expectToBeCatchScope, + expectToBeClassFieldInitializerScope, expectToBeClassScope, expectToBeForScope, expectToBeFunctionExpressionNameScope, diff --git a/packages/scope-manager/tests/util/getSpecificNode.ts b/packages/scope-manager/tests/util/getSpecificNode.ts index d20ab14ff580..8f04f4a88b49 100644 --- a/packages/scope-manager/tests/util/getSpecificNode.ts +++ b/packages/scope-manager/tests/util/getSpecificNode.ts @@ -3,11 +3,11 @@ import { simpleTraverse } from '@typescript-eslint/typescript-estree'; function getSpecificNode< TSelector extends AST_NODE_TYPES, - TNode extends Extract + TNode extends Extract, >(ast: TSESTree.Node, selector: TSelector): TNode; function getSpecificNode< TSelector extends AST_NODE_TYPES, - TNode extends Extract + TNode extends Extract, >( ast: TSESTree.Node, selector: TSelector, @@ -16,7 +16,7 @@ function getSpecificNode< function getSpecificNode< TSelector extends AST_NODE_TYPES, TNode extends Extract, - TReturnType extends TSESTree.Node + TReturnType extends TSESTree.Node, >( ast: TSESTree.Node, selector: TSelector, diff --git a/packages/scope-manager/tests/util/serializers/TSESTreeNode.ts b/packages/scope-manager/tests/util/serializers/TSESTreeNode.ts index 4611ddcce736..806ad70a8b2d 100644 --- a/packages/scope-manager/tests/util/serializers/TSESTreeNode.ts +++ b/packages/scope-manager/tests/util/serializers/TSESTreeNode.ts @@ -1,4 +1,4 @@ -import { AST_NODE_TYPES } from '@typescript-eslint/types'; +import { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/types'; import { NewPlugin } from 'pretty-format'; import { createIdGenerator } from '../../../src/ID'; @@ -14,22 +14,23 @@ const EXCLUDED_KEYS = new Set([ const generator = createIdGenerator(); type Node = Record & { type: AST_NODE_TYPES }; +type Identifier = Node & { name: string; type: AST_NODE_TYPES.Identifier }; const SEEN_NODES = new Map(); const serializer: NewPlugin = { test(val): boolean { - return ( + return !!( val && typeof val === 'object' && // make sure it's not one of the classes from the package Object.getPrototypeOf(val) === Object.prototype && 'type' in val && - val.type in AST_NODE_TYPES + (val as TSESTree.Node).type in AST_NODE_TYPES ); }, serialize(node: Node): string { if (node.type === AST_NODE_TYPES.Identifier) { - return `Identifier<"${node.name}">`; + return `Identifier<"${(node as Identifier).name}">`; } const keys = Object.keys(node).filter(k => !EXCLUDED_KEYS.has(k)); diff --git a/packages/scope-manager/tests/util/serializers/baseSerializer.ts b/packages/scope-manager/tests/util/serializers/baseSerializer.ts index d30ba31b1380..a5d11b2a9f33 100644 --- a/packages/scope-manager/tests/util/serializers/baseSerializer.ts +++ b/packages/scope-manager/tests/util/serializers/baseSerializer.ts @@ -33,7 +33,9 @@ function createSerializer( ): string { const id = thing.$id != null ? `$${thing.$id}` : ''; // If `type` is a base class, we should print out the name of the subclass - const constructorName = Object.getPrototypeOf(thing).constructor.name; + // eslint-disable-next-line @typescript-eslint/ban-types + const constructorName = (Object.getPrototypeOf(thing) as Object) + .constructor.name; if (constructorName === 'ImplicitLibVariable' && thing.name === 'const') { return 'ImplicitGlobalConstTypeVariable'; @@ -60,7 +62,7 @@ function createSerializer( } outputLines.push( - `${childIndentation}${key}: ${printer( + `${childIndentation}${key as string}: ${printer( value, config, childIndentation, diff --git a/packages/scope-manager/tools/generate-lib.ts b/packages/scope-manager/tools/generate-lib.ts index e1b33689f63c..eaa6faa85e63 100644 --- a/packages/scope-manager/tools/generate-lib.ts +++ b/packages/scope-manager/tools/generate-lib.ts @@ -51,6 +51,17 @@ const TYPES_FILE = path.resolve( 'lib.ts', ); +const BASE_CONFIG_MODULE_NAME = 'base-config'; +const SHARED_CONFIG_MODULE = path.resolve( + OUTPUT_FOLDER, + `${BASE_CONFIG_MODULE_NAME}.ts`, +); +enum BASE_CONFIG_EXPORT_NAMES { + TYPE = 'TYPE', + VALUE = 'VALUE', + TYPE_AND_VALUE = 'TYPE_VALUE', +} + function formatCode(code: string[]): string { return format(addAutoGeneratedComment(code), { parser: 'typescript', @@ -108,6 +119,35 @@ function main(): void { // ignored } + // the shared + fs.writeFileSync( + SHARED_CONFIG_MODULE, + formatCode([ + `export const ${ + BASE_CONFIG_EXPORT_NAMES.TYPE + } = Object.freeze(${JSON.stringify({ + eslintImplicitGlobalSetting: 'readonly', + isTypeVariable: true, + isValueVariable: false, + })});`, + `export const ${ + BASE_CONFIG_EXPORT_NAMES.VALUE + } = Object.freeze(${JSON.stringify({ + eslintImplicitGlobalSetting: 'readonly', + isTypeVariable: false, + isValueVariable: true, + })});`, + `export const ${ + BASE_CONFIG_EXPORT_NAMES.TYPE_AND_VALUE + } = Object.freeze(${JSON.stringify({ + eslintImplicitGlobalSetting: 'readonly', + isTypeVariable: true, + isValueVariable: true, + })});`, + '', + ]), + ); + for (const [libName, filename] of libMap) { const libPath = path.join(TS_LIB_FOLDER, filename); const { ast, scopeManager } = parseAndAnalyze( @@ -142,24 +182,42 @@ function main(): void { code.push(`...${name},`); } - if (imports.length > 0) { - code.unshift(...imports, ''); - } + const requiredBaseImports = new Set(); - // mark all of the variables + // add a declaration for each variable const variables = getVariablesFromScope(scopeManager); for (const variable of variables) { - code.push( - `'${variable.name}': ${JSON.stringify({ - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: variable.isTypeVariable, - isValueVariable: variable.isValueVariable, - name: variable.name, - })},`, - ); + const importName = ((): BASE_CONFIG_EXPORT_NAMES => { + if (variable.isTypeVariable && variable.isValueVariable) { + return BASE_CONFIG_EXPORT_NAMES.TYPE_AND_VALUE; + } else if (variable.isTypeVariable) { + return BASE_CONFIG_EXPORT_NAMES.TYPE; + } else if (variable.isValueVariable) { + return BASE_CONFIG_EXPORT_NAMES.VALUE; + } + // shouldn't happen + throw new Error( + "Unexpected variable that's is not a type or value variable", + ); + })(); + requiredBaseImports.add(importName); + + code.push(`'${variable.name}': ${importName},`); } code.push('} as Record;'); + if (requiredBaseImports.size > 0) { + imports.push( + `import {${Array.from(requiredBaseImports).join( + ',', + )}} from './${BASE_CONFIG_MODULE_NAME}';`, + ); + } + + if (imports.length > 0) { + code.unshift(...imports, ''); + } + const formattedCode = formatCode(code); fs.writeFileSync(path.join(OUTPUT_FOLDER, `${libName}.ts`), formattedCode); diff --git a/packages/shared-fixtures/CHANGELOG.md b/packages/shared-fixtures/CHANGELOG.md index 04637206ddeb..5710ecc6d806 100644 --- a/packages/shared-fixtures/CHANGELOG.md +++ b/packages/shared-fixtures/CHANGELOG.md @@ -3,6 +3,295 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.2.0...v5.3.0) (2021-11-01) + +**Note:** Version bump only for package @typescript-eslint/shared-fixtures + + + + + +# [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/shared-fixtures + + + + + +# [5.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.0.0...v5.1.0) (2021-10-18) + + +### Bug Fixes + +* **typescript-estree:** support private optional property definition ([#3997](https://github.com/typescript-eslint/typescript-eslint/issues/3997)) ([8605e08](https://github.com/typescript-eslint/typescript-eslint/commit/8605e080a4dac4a277e6108cd9ed1e5a707302fa)) + + + + + +# [5.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.33.0...v5.0.0) (2021-10-11) + + +### Bug Fixes + +* **typescript-estree:** change `source` of ExportNamedDeclaration to Literal from Expression ([#3763](https://github.com/typescript-eslint/typescript-eslint/issues/3763)) ([dc5a0f5](https://github.com/typescript-eslint/typescript-eslint/commit/dc5a0f5104b400f4422b8d67ecfc6cc7a32613a2)) + + +### Features + +* support `PrivateIdentifier` ([#3808](https://github.com/typescript-eslint/typescript-eslint/issues/3808)) ([0eefe5e](https://github.com/typescript-eslint/typescript-eslint/commit/0eefe5e49d21af3f1e3e2d9a90c2e49929863ac2)), closes [#3430](https://github.com/typescript-eslint/typescript-eslint/issues/3430) [#2933](https://github.com/typescript-eslint/typescript-eslint/issues/2933) +* **eslint-plugin:** removed value from abstract property nodes ([#3765](https://github.com/typescript-eslint/typescript-eslint/issues/3765)) ([5823524](https://github.com/typescript-eslint/typescript-eslint/commit/58235241714596b641a1e8b39c569e561e0039b4)), closes [#3748](https://github.com/typescript-eslint/typescript-eslint/issues/3748) + + + + + +# [4.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.32.0...v4.33.0) (2021-10-04) + +**Note:** Version bump only for package @typescript-eslint/shared-fixtures + + + + + +# [4.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.2...v4.32.0) (2021-09-27) + +**Note:** Version bump only for package @typescript-eslint/shared-fixtures + + + + + +## [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/shared-fixtures + + + + + +## [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/shared-fixtures + + + + + +# [4.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.30.0...v4.31.0) (2021-09-06) + +**Note:** Version bump only for package @typescript-eslint/shared-fixtures + + + + + +# [4.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.3...v4.30.0) (2021-08-30) + + +### Features + +* **typescript-estree:** add support for class static blocks ([#3730](https://github.com/typescript-eslint/typescript-eslint/issues/3730)) ([f81831b](https://github.com/typescript-eslint/typescript-eslint/commit/f81831bd279a32da6dbab0f1c061053ea43965f6)) + + + + + +## [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/shared-fixtures + + + + + +## [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/shared-fixtures + + + + + +## [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/shared-fixtures + + + + + +# [4.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.5...v4.29.0) (2021-08-02) + +**Note:** Version bump only for package @typescript-eslint/shared-fixtures + + + + + +## [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/shared-fixtures + + + + + +## [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/shared-fixtures + + + + + +## [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/shared-fixtures + + + + + +## [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/shared-fixtures + + + + + +## [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/shared-fixtures + + + + + +# [4.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.27.0...v4.28.0) (2021-06-21) + +**Note:** Version bump only for package @typescript-eslint/shared-fixtures + + + + + +# [4.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.1...v4.27.0) (2021-06-14) + + +### Bug Fixes + +* **typescript-estree:** support override modifier for parameter property ([#3485](https://github.com/typescript-eslint/typescript-eslint/issues/3485)) ([33b9f69](https://github.com/typescript-eslint/typescript-eslint/commit/33b9f69a681cd3219a2acca5b0b2fa67609f099e)) + + + + + +## [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/shared-fixtures + + + + + +# [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/shared-fixtures + + + + + +# [4.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.24.0...v4.25.0) (2021-05-24) + + +### Features + +* **typescript-estree:** [TS4.3] support overrides on class members ([#3429](https://github.com/typescript-eslint/typescript-eslint/issues/3429)) ([21d1b62](https://github.com/typescript-eslint/typescript-eslint/commit/21d1b62a0b84b502d2cf12674b3d141994a3ffd4)) +* **typescript-estree:** add support for getter/setter signatures on types ([#3427](https://github.com/typescript-eslint/typescript-eslint/issues/3427)) ([b830b7f](https://github.com/typescript-eslint/typescript-eslint/commit/b830b7f4e8a99affc8af8b53cb83371ef81d7032)), closes [#3272](https://github.com/typescript-eslint/typescript-eslint/issues/3272) [#3272](https://github.com/typescript-eslint/typescript-eslint/issues/3272) + + + + + +# [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/shared-fixtures + + + + + +# [4.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.1...v4.23.0) (2021-05-10) + +**Note:** Version bump only for package @typescript-eslint/shared-fixtures + + + + + +## [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/shared-fixtures + + + + + +# [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/shared-fixtures + + + + + +# [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/shared-fixtures + + + + + +# [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/shared-fixtures + + + + + +# [4.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.18.0...v4.19.0) (2021-03-22) + + +### Bug Fixes + +* **typescript-estree:** [ts 4.2] add support for import type equal declaration ([#3189](https://github.com/typescript-eslint/typescript-eslint/issues/3189)) ([6a25faf](https://github.com/typescript-eslint/typescript-eslint/commit/6a25faf5cfa4d21a7546d9866819f4e017308fb2)) + + + + + +# [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/shared-fixtures + + + + + +# [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/shared-fixtures + + + + + ## [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/shared-fixtures diff --git a/packages/shared-fixtures/fixtures/javascript/classes/class-private-identifier-accessor.src.js b/packages/shared-fixtures/fixtures/javascript/classes/class-private-identifier-accessor.src.js new file mode 100644 index 000000000000..6a8a89931955 --- /dev/null +++ b/packages/shared-fixtures/fixtures/javascript/classes/class-private-identifier-accessor.src.js @@ -0,0 +1,8 @@ +class Foo { + get #priv1() { return 1 } + set #priv1(value) { } + + constructor() { + this.#priv1 = 1; + } +} diff --git a/packages/shared-fixtures/fixtures/javascript/classes/class-private-identifier-field.src.js b/packages/shared-fixtures/fixtures/javascript/classes/class-private-identifier-field.src.js new file mode 100644 index 000000000000..4519b85cd975 --- /dev/null +++ b/packages/shared-fixtures/fixtures/javascript/classes/class-private-identifier-field.src.js @@ -0,0 +1,8 @@ +class Foo { + #priv1; + #priv2 = 1; + + constructor() { + this.#priv1 = 1; + } +} diff --git a/packages/shared-fixtures/fixtures/javascript/classes/class-private-identifier-method.src.js b/packages/shared-fixtures/fixtures/javascript/classes/class-private-identifier-method.src.js new file mode 100644 index 000000000000..f2694d08e36b --- /dev/null +++ b/packages/shared-fixtures/fixtures/javascript/classes/class-private-identifier-method.src.js @@ -0,0 +1,7 @@ +class Foo { + #bar() {} + + constructor() { + this.#bar(); + } +} diff --git a/packages/shared-fixtures/fixtures/javascript/modules/invalid-export-module-specifier.src.js b/packages/shared-fixtures/fixtures/javascript/modules/invalid-export-module-specifier.src.js new file mode 100644 index 000000000000..29faf851822c --- /dev/null +++ b/packages/shared-fixtures/fixtures/javascript/modules/invalid-export-module-specifier.src.js @@ -0,0 +1 @@ +export { foo } from bar; diff --git a/packages/shared-fixtures/fixtures/typescript/basics/abstract-class-with-abstract-properties.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/abstract-class-with-abstract-properties.src.ts index 42128953cb7d..223917818db9 100644 --- a/packages/shared-fixtures/fixtures/typescript/basics/abstract-class-with-abstract-properties.src.ts +++ b/packages/shared-fixtures/fixtures/typescript/basics/abstract-class-with-abstract-properties.src.ts @@ -1,4 +1,4 @@ abstract class Foo { abstract bar; - abstract baz = 3; + abstract baz: number; } diff --git a/packages/shared-fixtures/fixtures/typescript/basics/abstract-class-with-abstract-readonly-property.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/abstract-class-with-abstract-readonly-property.src.ts index 8c28567ce8e7..d00921ef4674 100644 --- a/packages/shared-fixtures/fixtures/typescript/basics/abstract-class-with-abstract-readonly-property.src.ts +++ b/packages/shared-fixtures/fixtures/typescript/basics/abstract-class-with-abstract-readonly-property.src.ts @@ -1,3 +1,3 @@ abstract class Foo { - public abstract readonly foo = 'string'; + public abstract readonly foo: string; } diff --git a/packages/shared-fixtures/fixtures/typescript/basics/abstract-class-with-override-method.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/abstract-class-with-override-method.src.ts new file mode 100644 index 000000000000..e6cecdc5ab8d --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/abstract-class-with-override-method.src.ts @@ -0,0 +1,3 @@ +abstract class SpecializedComponent extends SomeComponent { + abstract override show(); +} diff --git a/packages/shared-fixtures/fixtures/typescript/basics/abstract-class-with-override-property.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/abstract-class-with-override-property.src.ts new file mode 100644 index 000000000000..8839340d7aad --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/abstract-class-with-override-property.src.ts @@ -0,0 +1,3 @@ +abstract class SpecializedComponent extends SomeComponent { + abstract override foo = 1; +} diff --git a/packages/shared-fixtures/fixtures/typescript/basics/class-private-identifier-field-with-accessibility-error.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/class-private-identifier-field-with-accessibility-error.src.ts new file mode 100644 index 000000000000..554ea66635ae --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/class-private-identifier-field-with-accessibility-error.src.ts @@ -0,0 +1,5 @@ +class Foo { + private #priv1: string + public #priv2: string + static #priv3: string +} diff --git a/packages/shared-fixtures/fixtures/typescript/basics/class-private-identifier-field-with-annotation.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/class-private-identifier-field-with-annotation.src.ts new file mode 100644 index 000000000000..f771a81a83a4 --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/class-private-identifier-field-with-annotation.src.ts @@ -0,0 +1,8 @@ +class Foo { + #priv1: number; + #priv2: number = 1; + + constructor() { + this.#priv1 = 1; + } +} diff --git a/packages/shared-fixtures/fixtures/typescript/basics/class-private-identifier-readonly-field.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/class-private-identifier-readonly-field.src.ts new file mode 100644 index 000000000000..254995a222b1 --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/class-private-identifier-readonly-field.src.ts @@ -0,0 +1,3 @@ +class Foo { + readonly #priv: string +} diff --git a/packages/shared-fixtures/fixtures/typescript/basics/class-static-blocks.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/class-static-blocks.src.ts new file mode 100644 index 000000000000..21ae81c3aea1 --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/class-static-blocks.src.ts @@ -0,0 +1,8 @@ +class Foo { + static count = 0; + static { + if (someCondition()) { + count++; + } + } +} diff --git a/packages/shared-fixtures/fixtures/typescript/basics/class-with-constructor-and-parameter-property-with-modifiers.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/class-with-constructor-and-parameter-property-with-modifiers.src.ts new file mode 100644 index 000000000000..846318396d4e --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/class-with-constructor-and-parameter-property-with-modifiers.src.ts @@ -0,0 +1,3 @@ +class SpecializedComponent extends SomeComponent { + constructor(protected override readonly param: string) {} +} diff --git a/packages/shared-fixtures/fixtures/typescript/basics/class-with-constructor-and-parameter-proptery-with-override-modifier.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/class-with-constructor-and-parameter-proptery-with-override-modifier.src.ts new file mode 100644 index 000000000000..2c734ff5c607 --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/class-with-constructor-and-parameter-proptery-with-override-modifier.src.ts @@ -0,0 +1,5 @@ +class SpecializedComponent extends SomeComponent { + constructor(override param: string) { + super(); + } +} diff --git a/packages/shared-fixtures/fixtures/typescript/basics/class-with-override-method.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/class-with-override-method.src.ts new file mode 100644 index 000000000000..da3b89239d1f --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/class-with-override-method.src.ts @@ -0,0 +1,5 @@ +class SpecializedComponent extends SomeComponent { + override show() { + // ... + } +} diff --git a/packages/shared-fixtures/fixtures/typescript/basics/class-with-override-property.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/class-with-override-property.src.ts new file mode 100644 index 000000000000..fc5dc8e431ba --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/class-with-override-property.src.ts @@ -0,0 +1,3 @@ +class SpecializedComponent extends SomeComponent { + override foo = 1; +} diff --git a/packages/shared-fixtures/fixtures/typescript/basics/class-with-private-optional-property.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/class-with-private-optional-property.src.ts new file mode 100644 index 000000000000..bb3e79a9cb4d --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/class-with-private-optional-property.src.ts @@ -0,0 +1,5 @@ +class Foo { + #prop?: string; + #propExplicitWithValue?: string = ''; + #propImplicitWithValue? = ''; +} diff --git a/packages/shared-fixtures/fixtures/typescript/basics/import-equal-type-declaration.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/import-equal-type-declaration.src.ts new file mode 100644 index 000000000000..fca40db5fc03 --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/import-equal-type-declaration.src.ts @@ -0,0 +1 @@ +import type foo = require('bar'); diff --git a/packages/shared-fixtures/fixtures/typescript/basics/import-export-equal-type-declaration.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/import-export-equal-type-declaration.src.ts new file mode 100644 index 000000000000..98798d0c07ae --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/import-export-equal-type-declaration.src.ts @@ -0,0 +1 @@ +export import type foo = require('bar'); diff --git a/packages/shared-fixtures/fixtures/typescript/types/interface-with-accessors.src.ts b/packages/shared-fixtures/fixtures/typescript/types/interface-with-accessors.src.ts new file mode 100644 index 000000000000..d4eda64b2187 --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/types/interface-with-accessors.src.ts @@ -0,0 +1,4 @@ +interface Thing { + get size(): number; + set size(value: number | string | boolean); +} diff --git a/packages/shared-fixtures/fixtures/typescript/types/object-literal-type-with-accessors.src.ts b/packages/shared-fixtures/fixtures/typescript/types/object-literal-type-with-accessors.src.ts new file mode 100644 index 000000000000..61666608a103 --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/types/object-literal-type-with-accessors.src.ts @@ -0,0 +1,4 @@ +type Thing = { + get size(): number; + set size(value: number | string | boolean); +}; diff --git a/packages/shared-fixtures/package.json b/packages/shared-fixtures/package.json index f5558a30eb3f..84b82a7c58ab 100644 --- a/packages/shared-fixtures/package.json +++ b/packages/shared-fixtures/package.json @@ -1,5 +1,5 @@ { "name": "@typescript-eslint/shared-fixtures", - "version": "4.16.1", + "version": "5.3.0", "private": true } diff --git a/packages/shared-fixtures/project.json b/packages/shared-fixtures/project.json new file mode 100644 index 000000000000..b100b1e4ba75 --- /dev/null +++ b/packages/shared-fixtures/project.json @@ -0,0 +1,5 @@ +{ + "root": "packages/shared-fixtures", + "type": "library", + "implicitDependencies": [] +} diff --git a/packages/types/CHANGELOG.md b/packages/types/CHANGELOG.md index 627e088a3f67..4054d4a4f693 100644 --- a/packages/types/CHANGELOG.md +++ b/packages/types/CHANGELOG.md @@ -3,6 +3,292 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.2.0...v5.3.0) (2021-11-01) + +**Note:** Version bump only for package @typescript-eslint/types + + + + + +# [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/types + + + + + +# [5.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.0.0...v5.1.0) (2021-10-18) + +**Note:** Version bump only for package @typescript-eslint/types + + + + + +# [5.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.33.0...v5.0.0) (2021-10-11) + + +### Features + +* support `PrivateIdentifier` ([#3808](https://github.com/typescript-eslint/typescript-eslint/issues/3808)) ([0eefe5e](https://github.com/typescript-eslint/typescript-eslint/commit/0eefe5e49d21af3f1e3e2d9a90c2e49929863ac2)), closes [#3430](https://github.com/typescript-eslint/typescript-eslint/issues/3430) [#2933](https://github.com/typescript-eslint/typescript-eslint/issues/2933) + + + + + +# [4.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.32.0...v4.33.0) (2021-10-04) + +**Note:** Version bump only for package @typescript-eslint/types + + + + + +# [4.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.2...v4.32.0) (2021-09-27) + + +### Features + +* Support `'latest'` as `ecmaVersion` ([#3873](https://github.com/typescript-eslint/typescript-eslint/issues/3873)) ([25a42c0](https://github.com/typescript-eslint/typescript-eslint/commit/25a42c0bbe92d1ecbc2e8ff9ef3a3ef413f728b0)) + + + + + +## [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/types + + + + + +## [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/types + + + + + +# [4.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.30.0...v4.31.0) (2021-09-06) + +**Note:** Version bump only for package @typescript-eslint/types + + + + + +# [4.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.3...v4.30.0) (2021-08-30) + +**Note:** Version bump only for package @typescript-eslint/types + + + + + +## [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/types + + + + + +## [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/types + + + + + +## [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/types + + + + + +# [4.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.5...v4.29.0) (2021-08-02) + + +### Features + +* **eslint-plugin:** Catch unused React import with new JSX transform ([#3577](https://github.com/typescript-eslint/typescript-eslint/issues/3577)) ([02998ea](https://github.com/typescript-eslint/typescript-eslint/commit/02998eac510665758b9a093d43afc310f3ac980d)) +* **typescript-estree:** add support for custom module resolution ([#3516](https://github.com/typescript-eslint/typescript-eslint/issues/3516)) ([d48429d](https://github.com/typescript-eslint/typescript-eslint/commit/d48429d97326545bb727f88ce9056270b1599a31)) + + + + + +## [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/types + + + + + +## [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/types + + + + + +## [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/types + + + + + +## [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/types + + + + + +## [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/types + + + + + +# [4.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.27.0...v4.28.0) (2021-06-21) + +**Note:** Version bump only for package @typescript-eslint/types + + + + + +# [4.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.1...v4.27.0) (2021-06-14) + + +### Features + +* allow user to provide TS program instance in parser options ([#3484](https://github.com/typescript-eslint/typescript-eslint/issues/3484)) ([e855b18](https://github.com/typescript-eslint/typescript-eslint/commit/e855b18b8feee0edb5c617c11006861426a6f530)) + + + + + +## [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/types + + + + + +# [4.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.25.0...v4.26.0) (2021-05-31) + + +### Bug Fixes + +* generate library types for TypeScript v4.3 ([#3460](https://github.com/typescript-eslint/typescript-eslint/issues/3460)) ([ed4776a](https://github.com/typescript-eslint/typescript-eslint/commit/ed4776afa1374279027b9b7d82aa4b453b334998)), closes [#3449](https://github.com/typescript-eslint/typescript-eslint/issues/3449) + + + + + +# [4.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.24.0...v4.25.0) (2021-05-24) + +**Note:** Version bump only for package @typescript-eslint/types + + + + + +# [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/types + + + + + +# [4.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.1...v4.23.0) (2021-05-10) + + +### Features + +* 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/types + + + + + +# [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/types + + + + + +# [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/types + + + + + +# [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/types + + + + + +# [4.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.18.0...v4.19.0) (2021-03-22) + + +### Bug Fixes + +* **typescript-estree:** [ts 4.2] add support for import type equal declaration ([#3189](https://github.com/typescript-eslint/typescript-eslint/issues/3189)) ([6a25faf](https://github.com/typescript-eslint/typescript-eslint/commit/6a25faf5cfa4d21a7546d9866819f4e017308fb2)) + + + + + +# [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/types + + + + + +# [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/types + + + + + ## [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/types diff --git a/packages/types/package.json b/packages/types/package.json index 0d04bd8296f9..4ab50f039d36 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/types", - "version": "4.16.1", + "version": "5.3.0", "description": "Types for the TypeScript-ESTree AST spec", "keywords": [ "eslint", @@ -8,7 +8,7 @@ "estree" ], "engines": { - "node": "^8.10.0 || ^10.13.0 || >=11.10.1" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "files": [ "dist", @@ -19,7 +19,7 @@ "repository": { "type": "git", "url": "https://github.com/typescript-eslint/typescript-eslint.git", - "directory": "packages/visitor-keys" + "directory": "packages/types" }, "bugs": { "url": "https://github.com/typescript-eslint/typescript-eslint/issues" @@ -28,10 +28,11 @@ "main": "dist/index.js", "types": "dist/index.d.ts", "scripts": { + "prebuild": "yarn ts-node --transpile-only ./tools/copy-ast-spec.ts", "build": "tsc -b tsconfig.build.json", "postbuild": "downlevel-dts dist _ts3.4/dist", "clean": "tsc -b tsconfig.build.json --clean", - "postclean": "rimraf dist", + "postclean": "rimraf dist && rimraf _ts3.4 && rimraf coverage", "format": "prettier --write \"./**/*.{ts,js,json,md}\" --ignore-path ../../.prettierignore", "generate:lib": "../../node_modules/.bin/ts-node --files --transpile-only ../scope-manager/tools/generate-lib.ts", "lint": "eslint . --ext .js,.ts --ignore-path='../../.eslintignore'", @@ -47,5 +48,8 @@ "_ts3.4/*" ] } + }, + "devDependencies": { + "typescript": "*" } } diff --git a/packages/types/project.json b/packages/types/project.json new file mode 100644 index 000000000000..d0c5660433fe --- /dev/null +++ b/packages/types/project.json @@ -0,0 +1,5 @@ +{ + "root": "packages/types", + "type": "library", + "implicitDependencies": ["@typescript-eslint/ast-spec"] +} diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts index 59df48302df5..4bda24b13818 100644 --- a/packages/types/src/index.ts +++ b/packages/types/src/index.ts @@ -1,5 +1,5 @@ -export { AST_NODE_TYPES } from './ast-node-types'; -export { AST_TOKEN_TYPES } from './ast-token-types'; +export { AST_NODE_TYPES } from './ast-spec'; +export { AST_TOKEN_TYPES } from './ast-spec'; export * from './lib'; export * from './parser-options'; -export * as TSESTree from './ts-estree'; +export * from './ts-estree'; diff --git a/packages/types/src/lib.ts b/packages/types/src/lib.ts index 5f173893b589..06e8eaf2103c 100644 --- a/packages/types/src/lib.ts +++ b/packages/types/src/lib.ts @@ -12,6 +12,7 @@ type Lib = | 'es2018' | 'es2019' | 'es2020' + | 'es2021' | 'esnext' | 'dom' | 'dom.iterable' @@ -49,6 +50,9 @@ type Lib = | 'es2020.string' | 'es2020.symbol.wellknown' | 'es2020.intl' + | 'es2021.promise' + | 'es2021.string' + | 'es2021.weakref' | 'esnext.array' | 'esnext.symbol' | 'esnext.asynciterable' @@ -62,6 +66,7 @@ type Lib = | 'es2018.full' | 'es2019.full' | 'es2020.full' + | 'es2021.full' | 'esnext.full' | 'lib'; diff --git a/packages/types/src/parser-options.ts b/packages/types/src/parser-options.ts index 8f6632df9a42..18ecbee7943f 100644 --- a/packages/types/src/parser-options.ts +++ b/packages/types/src/parser-options.ts @@ -1,4 +1,5 @@ import { Lib } from './lib'; +import type { Program } from 'typescript'; type DebugLevel = boolean | ('typescript-eslint' | 'eslint' | 'typescript')[]; @@ -11,12 +12,16 @@ type EcmaVersion = | 9 | 10 | 11 + | 12 + | 13 | 2015 | 2016 | 2017 | 2018 | 2019 - | 2020; + | 2020 + | 2021 + | 2022; type SourceType = 'script' | 'module'; @@ -25,10 +30,10 @@ interface ParserOptions { globalReturn?: boolean; jsx?: boolean; }; - ecmaVersion?: EcmaVersion; + ecmaVersion?: EcmaVersion | 'latest'; // scope-manager specific - jsxPragma?: string; + jsxPragma?: string | null; jsxFragmentName?: string | null; lib?: Lib[]; @@ -41,6 +46,7 @@ interface ParserOptions { extraFileExtensions?: string[]; filePath?: string; loc?: boolean; + program?: Program; project?: string | string[]; projectFolderIgnoreList?: (string | RegExp)[]; range?: boolean; @@ -49,6 +55,7 @@ interface ParserOptions { tsconfigRootDir?: string; useJSXTextNode?: boolean; warnOnUnsupportedTypeScriptVersion?: boolean; + moduleResolver?: string; } export { DebugLevel, EcmaVersion, ParserOptions, SourceType }; diff --git a/packages/types/src/ts-estree.ts b/packages/types/src/ts-estree.ts index 9fee42b8ff9b..037bd3f92c97 100644 --- a/packages/types/src/ts-estree.ts +++ b/packages/types/src/ts-estree.ts @@ -1,1768 +1,21 @@ -import { AST_NODE_TYPES } from './ast-node-types'; -import { AST_TOKEN_TYPES } from './ast-token-types'; +import * as TSESTree from './ast-spec'; -export interface LineAndColumnData { - /** - * Line number (1-indexed) - */ - line: number; - /** - * Column number on the line (0-indexed) - */ - column: number; -} -export interface SourceLocation { - /** - * The position of the first character of the parsed source region - */ - start: LineAndColumnData; - /** - * The position of the first character after the parsed source region - */ - end: LineAndColumnData; -} -export type Range = [number, number]; - -export interface BaseNode { - /** - * The source location information of the node. - */ - loc: SourceLocation; - /** - * An array of two numbers. - * Both numbers are a 0-based index which is the position in the array of source code characters. - * The first is the start position of the node, the second is the end position of the node. - */ - range: Range; - /** - * The parent node of the current node - */ - parent?: Node; - - // every node *will* have a type, but let the nodes define their own exact string - // type: string; - - // we don't ever set this from within ts-estree - // source?: string | null; -} - -/* - * Token and Comment are pseudo-nodes to represent pieces of source code - * - * NOTE: - * They are not included in the `Node` union below on purpose because they - * are not ever included as part of the standard AST tree. - */ -interface BaseToken extends BaseNode { - value: string; -} - -export interface BooleanToken extends BaseToken { - type: AST_TOKEN_TYPES.Boolean; -} - -export interface IdentifierToken extends BaseToken { - type: AST_TOKEN_TYPES.Identifier; -} - -export interface JSXIdentifierToken extends BaseToken { - type: AST_TOKEN_TYPES.JSXIdentifier; -} - -export interface JSXTextToken extends BaseToken { - type: AST_TOKEN_TYPES.JSXText; -} - -export interface KeywordToken extends BaseToken { - type: AST_TOKEN_TYPES.Keyword; -} - -export interface NullToken extends BaseToken { - type: AST_TOKEN_TYPES.Null; -} - -export interface NumericToken extends BaseToken { - type: AST_TOKEN_TYPES.Numeric; -} - -export interface PunctuatorToken extends BaseToken { - type: AST_TOKEN_TYPES.Punctuator; -} - -export interface RegularExpressionToken extends BaseToken { - type: AST_TOKEN_TYPES.RegularExpression; - regex: { - pattern: string; - flags: string; - }; -} - -export interface StringToken extends BaseToken { - type: AST_TOKEN_TYPES.String; -} - -export interface TemplateToken extends BaseToken { - type: AST_TOKEN_TYPES.Template; -} - -export interface BlockComment extends BaseToken { - type: AST_TOKEN_TYPES.Block; -} - -export interface LineComment extends BaseToken { - type: AST_TOKEN_TYPES.Line; -} - -export type Comment = BlockComment | LineComment; -export type Token = - | BooleanToken - | Comment - | IdentifierToken - | JSXIdentifierToken - | JSXTextToken - | KeywordToken - | NullToken - | NumericToken - | PunctuatorToken - | RegularExpressionToken - | StringToken - | TemplateToken; - -export type OptionalRangeAndLoc = Pick< - T, - Exclude -> & { - range?: Range; - loc?: SourceLocation; -}; - -// Every single valid AST Node -// Please keep it sorted alphabetically. -export type Node = - | ArrayExpression - | ArrayPattern - | ArrowFunctionExpression - | AssignmentExpression - | AssignmentPattern - | AwaitExpression - | BigIntLiteral - | BinaryExpression - | BlockStatement - | BreakStatement - | CallExpression - | CatchClause - | ChainExpression - | ClassBody - | ClassDeclaration - | ClassExpression - | ClassProperty - | ConditionalExpression - | ContinueStatement - | DebuggerStatement - | Decorator - | DoWhileStatement - | EmptyStatement - | ExportAllDeclaration - | ExportDefaultDeclaration - | ExportNamedDeclaration - | ExportSpecifier - | ExpressionStatement - | ForInStatement - | ForOfStatement - | ForStatement - | FunctionDeclaration - | FunctionExpression - | Identifier - | IfStatement - | ImportDeclaration - | ImportDefaultSpecifier - | ImportExpression - | ImportNamespaceSpecifier - | ImportSpecifier - | JSXAttribute - | JSXClosingElement - | JSXClosingFragment - | JSXElement - | JSXEmptyExpression - | JSXExpressionContainer - | JSXFragment - | JSXIdentifier - | JSXMemberExpression - | JSXNamespacedName - | JSXOpeningElement - | JSXOpeningFragment - | JSXSpreadAttribute - | JSXSpreadChild - | JSXText - | LabeledStatement - | Literal - | LogicalExpression - | MemberExpression - | MetaProperty - | MethodDefinition - | NewExpression - | ObjectExpression - | ObjectPattern - | Program - | Property - | RestElement - | ReturnStatement - | SequenceExpression - | SpreadElement - | Super - | SwitchCase - | SwitchStatement - | TaggedTemplateExpression - | TemplateElement - | TemplateLiteral - | ThisExpression - | ThrowStatement - | TryStatement - | TSAbstractClassProperty - | TSAbstractKeyword - | TSAbstractMethodDefinition - | TSAnyKeyword - | TSArrayType - | TSAsExpression - | TSAsyncKeyword - | TSBigIntKeyword - | TSBooleanKeyword - | TSCallSignatureDeclaration - | TSClassImplements - | TSConditionalType - | TSConstructorType - | TSConstructSignatureDeclaration - | TSDeclareFunction - | TSDeclareKeyword - | TSEmptyBodyFunctionExpression - | TSEnumDeclaration - | TSEnumMember - | TSExportAssignment - | TSExportKeyword - | TSExternalModuleReference - | TSFunctionType - | TSImportEqualsDeclaration - | TSImportType - | TSIndexedAccessType - | TSIndexSignature - | TSInferType - | TSInterfaceBody - | TSInterfaceDeclaration - | TSInterfaceHeritage - | TSIntersectionType - | TSIntrinsicKeyword - | TSLiteralType - | TSMappedType - | TSMethodSignature - | TSModuleBlock - | TSModuleDeclaration - | TSNamedTupleMember - | TSNamespaceExportDeclaration - | TSNeverKeyword - | TSNonNullExpression - | TSNullKeyword - | TSNumberKeyword - | TSObjectKeyword - | TSOptionalType - | TSParameterProperty - | TSParenthesizedType - | TSPrivateKeyword - | TSPropertySignature - | TSProtectedKeyword - | TSPublicKeyword - | TSQualifiedName - | TSReadonlyKeyword - | TSRestType - | TSStaticKeyword - | TSStringKeyword - | TSSymbolKeyword - | TSTemplateLiteralType - | TSThisType - | TSTupleType - | TSTypeAliasDeclaration - | TSTypeAnnotation - | TSTypeAssertion - | TSTypeLiteral - | TSTypeOperator - | TSTypeParameter - | TSTypeParameterDeclaration - | TSTypeParameterInstantiation - | TSTypePredicate - | TSTypeQuery - | TSTypeReference - | TSUndefinedKeyword - | TSUnionType - | TSUnknownKeyword - | TSVoidKeyword - | UnaryExpression - | UpdateExpression - | VariableDeclaration - | VariableDeclarator - | WhileStatement - | WithStatement - | YieldExpression; - -////////// -// Reusable Unions -// These are based off of types used in the Typescript AST definitions -// **Ensure you sort the union members alphabetically** -////////// - -export type Accessibility = 'public' | 'protected' | 'private'; -export type BindingPattern = ArrayPattern | ObjectPattern; -export type BindingName = BindingPattern | Identifier; -export type ChainElement = - | CallExpression - | MemberExpression - | TSNonNullExpression; -export type ClassElement = - | ClassProperty - | MethodDefinition - | TSAbstractClassProperty - | TSAbstractMethodDefinition - | TSIndexSignature; -export type ClassProperty = - | ClassPropertyComputedName - | ClassPropertyNonComputedName; -export type DeclarationStatement = - | ClassDeclaration - | ClassExpression - | ExportDefaultDeclaration - | ExportAllDeclaration - | ExportNamedDeclaration - | FunctionDeclaration - | TSDeclareFunction - | TSImportEqualsDeclaration - | TSInterfaceDeclaration - | TSModuleDeclaration - | TSNamespaceExportDeclaration - | TSTypeAliasDeclaration - | TSEnumDeclaration; -export type DestructuringPattern = - | Identifier - | ObjectPattern - | ArrayPattern - | RestElement - | AssignmentPattern - | MemberExpression; -export type EntityName = Identifier | TSQualifiedName; -export type ExportDeclaration = - | ClassDeclaration - | ClassExpression - | FunctionDeclaration - | TSDeclareFunction - | TSEnumDeclaration - | TSInterfaceDeclaration - | TSModuleDeclaration - | TSTypeAliasDeclaration - | VariableDeclaration; -export type Expression = - | ArrowFunctionExpression - | AssignmentExpression - | BinaryExpression - | ChainExpression - | ConditionalExpression - | ImportExpression - | JSXClosingElement - | JSXClosingFragment - | JSXExpressionContainer - | JSXOpeningElement - | JSXOpeningFragment - | JSXSpreadChild - | LogicalExpression - | NewExpression - | RestElement - | SequenceExpression - | SpreadElement - | TSAsExpression - | TSTypeAssertion - | TSUnaryExpression - | YieldExpression; -export type ForInitialiser = Expression | VariableDeclaration; -export type FunctionLike = - | ArrowFunctionExpression - | FunctionDeclaration - | FunctionExpression - | TSDeclareFunction - | TSEmptyBodyFunctionExpression; -export type ImportClause = - | ImportDefaultSpecifier - | ImportNamespaceSpecifier - | ImportSpecifier; -export type IterationStatement = - | DoWhileStatement - | ForInStatement - | ForOfStatement - | ForStatement - | WhileStatement; -export type JSXChild = JSXElement | JSXExpression | JSXFragment | JSXText; -export type JSXExpression = - | JSXEmptyExpression - | JSXSpreadChild - | JSXExpressionContainer; -export type JSXTagNameExpression = - | JSXIdentifier - | JSXMemberExpression - | JSXNamespacedName; -export type LeftHandSideExpression = - | CallExpression - | ClassExpression - | ClassDeclaration - | FunctionExpression - | LiteralExpression - | MemberExpression - | PrimaryExpression - | TaggedTemplateExpression - | TSNonNullExpression - | TSAsExpression - | ArrowFunctionExpression; -export type Literal = - | BigIntLiteral - | BooleanLiteral - | NumberLiteral - | NullLiteral - | RegExpLiteral - | StringLiteral; -export type LiteralExpression = Literal | TemplateLiteral; -export type MemberExpression = - | MemberExpressionComputedName - | MemberExpressionNonComputedName; -export type MethodDefinition = - | MethodDefinitionComputedName - | MethodDefinitionNonComputedName; -export type Modifier = - | TSAbstractKeyword - | TSAsyncKeyword - | TSPrivateKeyword - | TSProtectedKeyword - | TSPublicKeyword - | TSReadonlyKeyword - | TSStaticKeyword; -export type ObjectLiteralElementLike = - | MethodDefinition - | Property - | SpreadElement - | TSAbstractMethodDefinition; -export type Parameter = - | ArrayPattern - | AssignmentPattern - | Identifier - | ObjectPattern - | RestElement - | TSParameterProperty; -export type PrimaryExpression = - | ArrayExpression - | ArrayPattern - | ClassExpression - | FunctionExpression - | Identifier - | JSXElement - | JSXFragment - | JSXOpeningElement - | Literal - | LiteralExpression - | MetaProperty - | ObjectExpression - | ObjectPattern - | Super - | TemplateLiteral - | ThisExpression - | TSNullKeyword; -/** TODO: re-align this with EStree spec in next major release */ -export type ProgramStatement = Statement; -export type Property = PropertyComputedName | PropertyNonComputedName; -export type PropertyName = PropertyNameComputed | PropertyNameNonComputed; -export type PropertyNameComputed = Expression; -export type PropertyNameNonComputed = - | Identifier - | StringLiteral - | NumberLiteral; -export type Statement = - | BlockStatement - | BreakStatement - | ClassDeclaration - | ContinueStatement - | DebuggerStatement - | DeclarationStatement - | EmptyStatement - | ExportAllDeclaration - | ExportDefaultDeclaration - | ExportNamedDeclaration - | ExpressionStatement - | IfStatement - | IterationStatement - | ImportDeclaration - | LabeledStatement - | TSDeclareFunction - | TSEnumDeclaration - | TSExportAssignment - | TSImportEqualsDeclaration - | TSInterfaceDeclaration - | TSModuleBlock - | TSNamespaceExportDeclaration - | TSTypeAliasDeclaration - | ReturnStatement - | SwitchStatement - | ThrowStatement - | TryStatement - | VariableDeclaration - | WithStatement; -export type TSAbstractClassProperty = - | TSAbstractClassPropertyComputedName - | TSAbstractClassPropertyNonComputedName; -export type TSAbstractMethodDefinition = - | TSAbstractMethodDefinitionComputedName - | TSAbstractMethodDefinitionNonComputedName; -export type TSMethodSignature = - | TSMethodSignatureComputedName - | TSMethodSignatureNonComputedName; -export type TSPropertySignature = - | TSPropertySignatureComputedName - | TSPropertySignatureNonComputedName; -export type TSEnumMember = - | TSEnumMemberComputedName - | TSEnumMemberNonComputedName; -export type TSUnaryExpression = - | AwaitExpression - | LeftHandSideExpression - | TSTypeAssertion - | UnaryExpression - | UpdateExpression; -export type TypeElement = - | TSCallSignatureDeclaration - | TSConstructSignatureDeclaration - | TSIndexSignature - | TSMethodSignature - | TSPropertySignature; -export type TypeNode = - | TSAnyKeyword - | TSArrayType - | TSBigIntKeyword - | TSBooleanKeyword - | TSConditionalType - | TSConstructorType - | TSFunctionType - | TSImportType - | TSIndexedAccessType - | TSInferType - | TSInterfaceHeritage - | TSIntersectionType - | TSIntrinsicKeyword - | TSLiteralType - | TSMappedType - | TSNamedTupleMember - | TSNeverKeyword - | TSNullKeyword - | TSNumberKeyword - | TSObjectKeyword - | TSOptionalType - | TSParenthesizedType - | TSRestType - | TSStringKeyword - | TSSymbolKeyword - | TSTemplateLiteralType - | TSThisType - | TSTupleType - | TSTypeLiteral - | TSTypeOperator - | TSTypePredicate - | TSTypeQuery - | TSTypeReference - | TSUndefinedKeyword - | TSUnionType - | TSUnknownKeyword - | TSVoidKeyword; - -/////////////// -// Base, common types -// **Ensure you sort the interfaces alphabetically** -/////////////// - -interface BinaryExpressionBase extends BaseNode { - operator: string; - left: Expression; - right: Expression; -} - -interface CallExpressionBase extends BaseNode { - callee: LeftHandSideExpression; - arguments: Expression[]; - typeParameters?: TSTypeParameterInstantiation; - optional: boolean; -} - -interface ClassDeclarationBase extends BaseNode { - typeParameters?: TSTypeParameterDeclaration; - superTypeParameters?: TSTypeParameterInstantiation; - id: Identifier | null; - body: ClassBody; - superClass: LeftHandSideExpression | null; - implements?: TSClassImplements[]; - abstract?: boolean; - declare?: boolean; - decorators?: Decorator[]; -} - -/** this should not be directly used - instead use ClassPropertyComputedNameBase or ClassPropertyNonComputedNameBase */ -interface ClassPropertyBase extends BaseNode { - key: PropertyName; - value: Expression | null; - computed: boolean; - static: boolean; - declare: boolean; - readonly?: boolean; - decorators?: Decorator[]; - accessibility?: Accessibility; - optional?: boolean; - definite?: boolean; - typeAnnotation?: TSTypeAnnotation; -} - -interface ClassPropertyComputedNameBase extends ClassPropertyBase { - key: PropertyNameComputed; - computed: true; -} - -interface ClassPropertyNonComputedNameBase extends ClassPropertyBase { - key: PropertyNameNonComputed; - computed: false; -} - -interface FunctionDeclarationBase extends BaseNode { - id: Identifier | null; - generator: boolean; - expression: boolean; - async: boolean; - params: Parameter[]; - body?: BlockStatement | null; - returnType?: TSTypeAnnotation; - typeParameters?: TSTypeParameterDeclaration; - declare?: boolean; -} +// augment to add the parent property, which isn't part of the spec +declare module './ast-spec' { + interface BaseNode { + parent?: TSESTree.Node; + } -interface FunctionSignatureBase extends BaseNode { - params: Parameter[]; - returnType?: TSTypeAnnotation; - typeParameters?: TSTypeParameterDeclaration; -} - -interface LiteralBase extends BaseNode { - raw: string; - value: string | boolean | null | number | RegExp | bigint; - regex?: { - pattern: string; - flags: string; - }; -} - -/** this should not be directly used - instead use MemberExpressionComputedNameBase or MemberExpressionNonComputedNameBase */ -interface MemberExpressionBase extends BaseNode { - object: LeftHandSideExpression; - property: Expression | Identifier; - computed: boolean; - optional: boolean; -} - -interface MemberExpressionComputedNameBase extends MemberExpressionBase { - property: Expression; - computed: true; -} - -interface MemberExpressionNonComputedNameBase extends MemberExpressionBase { - property: Identifier; - computed: false; -} - -/** this should not be directly used - instead use MethodDefinitionComputedNameBase or MethodDefinitionNonComputedNameBase */ -interface MethodDefinitionBase extends BaseNode { - key: PropertyName; - value: FunctionExpression | TSEmptyBodyFunctionExpression; - computed: boolean; - static: boolean; - kind: 'method' | 'get' | 'set' | 'constructor'; - optional?: boolean; - decorators?: Decorator[]; - accessibility?: Accessibility; - typeParameters?: TSTypeParameterDeclaration; -} - -interface MethodDefinitionComputedNameBase extends MethodDefinitionBase { - key: PropertyNameComputed; - computed: true; -} - -interface MethodDefinitionNonComputedNameBase extends MethodDefinitionBase { - key: PropertyNameNonComputed; - computed: false; -} - -interface PropertyBase extends BaseNode { - type: AST_NODE_TYPES.Property; - key: PropertyName; - value: - | Expression - | AssignmentPattern - | BindingName - | TSEmptyBodyFunctionExpression; - computed: boolean; - method: boolean; - shorthand: boolean; - optional?: boolean; - kind: 'init' | 'get' | 'set'; -} - -interface TSEnumMemberBase extends BaseNode { - type: AST_NODE_TYPES.TSEnumMember; - id: - | PropertyNameNonComputed - // this should only happen in semantically invalid code (ts error 1164) - | PropertyNameComputed; - initializer?: Expression; - computed?: boolean; -} - -interface TSHeritageBase extends BaseNode { - expression: Expression; - typeParameters?: TSTypeParameterInstantiation; -} - -interface TSMethodSignatureBase extends BaseNode { - type: AST_NODE_TYPES.TSMethodSignature; - key: PropertyName; - computed: boolean; - params: Parameter[]; - optional?: boolean; - returnType?: TSTypeAnnotation; - readonly?: boolean; - typeParameters?: TSTypeParameterDeclaration; - accessibility?: Accessibility; - export?: boolean; - static?: boolean; -} - -interface TSPropertySignatureBase extends BaseNode { - type: AST_NODE_TYPES.TSPropertySignature; - key: PropertyName; - optional?: boolean; - computed: boolean; - typeAnnotation?: TSTypeAnnotation; - initializer?: Expression; - readonly?: boolean; - static?: boolean; - export?: boolean; - accessibility?: Accessibility; -} - -interface UnaryExpressionBase extends BaseNode { - operator: string; - prefix: boolean; - argument: LeftHandSideExpression | Literal | UnaryExpression; -} - -/////////////// -// Typescript ESTree Nodes -// **Ensure you sort the interfaces alphabetically** -/////////////// - -export interface ArrayExpression extends BaseNode { - type: AST_NODE_TYPES.ArrayExpression; - elements: Expression[]; -} - -export interface ArrayPattern extends BaseNode { - type: AST_NODE_TYPES.ArrayPattern; - elements: (DestructuringPattern | null)[]; - typeAnnotation?: TSTypeAnnotation; - optional?: boolean; - decorators?: Decorator[]; -} - -export interface ArrowFunctionExpression extends BaseNode { - type: AST_NODE_TYPES.ArrowFunctionExpression; - generator: boolean; - id: null; - params: Parameter[]; - body: Expression | BlockStatement; - async: boolean; - expression: boolean; - returnType?: TSTypeAnnotation; - typeParameters?: TSTypeParameterDeclaration; -} - -export interface AssignmentExpression extends BinaryExpressionBase { - type: AST_NODE_TYPES.AssignmentExpression; - operator: - | '-=' - | '??=' - | '**=' - | '*=' - | '/=' - | '&&=' - | '&=' - | '%=' - | '^=' - | '+=' - | '<<=' - | '=' - | '>>=' - | '>>>=' - | '|=' - | '||='; -} - -export interface AssignmentPattern extends BaseNode { - type: AST_NODE_TYPES.AssignmentPattern; - left: BindingName; - right: Expression; - typeAnnotation?: TSTypeAnnotation; - optional?: boolean; - decorators?: Decorator[]; -} - -export interface AwaitExpression extends BaseNode { - type: AST_NODE_TYPES.AwaitExpression; - argument: TSUnaryExpression; -} - -export interface BigIntLiteral extends LiteralBase { - type: AST_NODE_TYPES.Literal; - value: bigint | null; - bigint: string; -} - -export interface BinaryExpression extends BinaryExpressionBase { - type: AST_NODE_TYPES.BinaryExpression; -} - -export interface BlockStatement extends BaseNode { - type: AST_NODE_TYPES.BlockStatement; - body: Statement[]; -} - -export interface BooleanLiteral extends LiteralBase { - type: AST_NODE_TYPES.Literal; - value: boolean; -} - -export interface BreakStatement extends BaseNode { - type: AST_NODE_TYPES.BreakStatement; - label: Identifier | null; -} - -export interface ChainExpression extends BaseNode { - type: AST_NODE_TYPES.ChainExpression; - expression: ChainElement; -} - -export interface CallExpression extends CallExpressionBase { - type: AST_NODE_TYPES.CallExpression; -} + // TODO - make this change as a breaking change + /* + interface BaseNode { + parent: TSESTree.Node; + } -export interface CatchClause extends BaseNode { - type: AST_NODE_TYPES.CatchClause; - param: BindingName | null; - body: BlockStatement; + interface Program { + parent?: undefined; + } + */ } -export interface ClassBody extends BaseNode { - type: AST_NODE_TYPES.ClassBody; - body: ClassElement[]; -} - -export interface ClassDeclaration extends ClassDeclarationBase { - type: AST_NODE_TYPES.ClassDeclaration; -} - -export interface ClassExpression extends ClassDeclarationBase { - type: AST_NODE_TYPES.ClassExpression; -} - -export interface ClassPropertyComputedName - extends ClassPropertyComputedNameBase { - type: AST_NODE_TYPES.ClassProperty; -} - -export interface ClassPropertyNonComputedName - extends ClassPropertyNonComputedNameBase { - type: AST_NODE_TYPES.ClassProperty; -} - -export interface ConditionalExpression extends BaseNode { - type: AST_NODE_TYPES.ConditionalExpression; - test: Expression; - consequent: Expression; - alternate: Expression; -} - -export interface ContinueStatement extends BaseNode { - type: AST_NODE_TYPES.ContinueStatement; - label: Identifier | null; -} - -export interface DebuggerStatement extends BaseNode { - type: AST_NODE_TYPES.DebuggerStatement; -} - -export interface Decorator extends BaseNode { - type: AST_NODE_TYPES.Decorator; - expression: LeftHandSideExpression; -} - -export interface DoWhileStatement extends BaseNode { - type: AST_NODE_TYPES.DoWhileStatement; - test: Expression; - body: Statement; -} - -export interface EmptyStatement extends BaseNode { - type: AST_NODE_TYPES.EmptyStatement; -} - -export interface ExportAllDeclaration extends BaseNode { - type: AST_NODE_TYPES.ExportAllDeclaration; - source: Expression | null; - exportKind: 'type' | 'value'; - exported: Identifier | null; -} - -export interface ExportDefaultDeclaration extends BaseNode { - type: AST_NODE_TYPES.ExportDefaultDeclaration; - declaration: ExportDeclaration | Expression; - exportKind: 'type' | 'value'; -} - -export interface ExportNamedDeclaration extends BaseNode { - type: AST_NODE_TYPES.ExportNamedDeclaration; - declaration: ExportDeclaration | null; - specifiers: ExportSpecifier[]; - source: Expression | null; - exportKind: 'type' | 'value'; -} - -export interface ExportSpecifier extends BaseNode { - type: AST_NODE_TYPES.ExportSpecifier; - local: Identifier; - exported: Identifier; -} - -export interface ExpressionStatement extends BaseNode { - type: AST_NODE_TYPES.ExpressionStatement; - expression: Expression; - directive?: string; -} - -export interface ForInStatement extends BaseNode { - type: AST_NODE_TYPES.ForInStatement; - left: ForInitialiser; - right: Expression; - body: Statement; -} - -export interface ForOfStatement extends BaseNode { - type: AST_NODE_TYPES.ForOfStatement; - left: ForInitialiser; - right: Expression; - body: Statement; - await: boolean; -} - -export interface ForStatement extends BaseNode { - type: AST_NODE_TYPES.ForStatement; - init: Expression | ForInitialiser | null; - test: Expression | null; - update: Expression | null; - body: Statement; -} - -export interface FunctionDeclaration extends FunctionDeclarationBase { - type: AST_NODE_TYPES.FunctionDeclaration; - body: BlockStatement; -} - -export interface FunctionExpression extends FunctionDeclarationBase { - type: AST_NODE_TYPES.FunctionExpression; - body: BlockStatement; -} - -export interface Identifier extends BaseNode { - type: AST_NODE_TYPES.Identifier; - name: string; - typeAnnotation?: TSTypeAnnotation; - optional?: boolean; - decorators?: Decorator[]; -} - -export interface IfStatement extends BaseNode { - type: AST_NODE_TYPES.IfStatement; - test: Expression; - consequent: Statement; - alternate: Statement | null; -} - -export interface ImportDeclaration extends BaseNode { - type: AST_NODE_TYPES.ImportDeclaration; - source: Literal; - specifiers: ImportClause[]; - importKind: 'type' | 'value'; -} - -export interface ImportDefaultSpecifier extends BaseNode { - type: AST_NODE_TYPES.ImportDefaultSpecifier; - local: Identifier; -} - -export interface ImportExpression extends BaseNode { - type: AST_NODE_TYPES.ImportExpression; - source: Expression; -} - -export interface ImportNamespaceSpecifier extends BaseNode { - type: AST_NODE_TYPES.ImportNamespaceSpecifier; - local: Identifier; -} - -export interface ImportSpecifier extends BaseNode { - type: AST_NODE_TYPES.ImportSpecifier; - local: Identifier; - imported: Identifier; -} - -export interface JSXAttribute extends BaseNode { - type: AST_NODE_TYPES.JSXAttribute; - name: JSXIdentifier | JSXNamespacedName; - value: Literal | JSXExpression | null; -} - -export interface JSXClosingElement extends BaseNode { - type: AST_NODE_TYPES.JSXClosingElement; - name: JSXTagNameExpression; -} - -export interface JSXClosingFragment extends BaseNode { - type: AST_NODE_TYPES.JSXClosingFragment; -} - -export interface JSXElement extends BaseNode { - type: AST_NODE_TYPES.JSXElement; - openingElement: JSXOpeningElement; - closingElement: JSXClosingElement | null; - children: JSXChild[]; -} - -export interface JSXEmptyExpression extends BaseNode { - type: AST_NODE_TYPES.JSXEmptyExpression; -} - -export interface JSXExpressionContainer extends BaseNode { - type: AST_NODE_TYPES.JSXExpressionContainer; - expression: Expression | JSXEmptyExpression; -} - -export interface JSXFragment extends BaseNode { - type: AST_NODE_TYPES.JSXFragment; - openingFragment: JSXOpeningFragment; - closingFragment: JSXClosingFragment; - children: JSXChild[]; -} - -export interface JSXIdentifier extends BaseNode { - type: AST_NODE_TYPES.JSXIdentifier; - name: string; -} - -export interface JSXMemberExpression extends BaseNode { - type: AST_NODE_TYPES.JSXMemberExpression; - object: JSXTagNameExpression; - property: JSXIdentifier; -} - -export interface JSXNamespacedName extends BaseNode { - type: AST_NODE_TYPES.JSXNamespacedName; - namespace: JSXIdentifier; - name: JSXIdentifier; -} - -export interface JSXOpeningElement extends BaseNode { - type: AST_NODE_TYPES.JSXOpeningElement; - typeParameters?: TSTypeParameterInstantiation; - selfClosing: boolean; - name: JSXTagNameExpression; - attributes: (JSXAttribute | JSXSpreadAttribute)[]; -} - -export interface JSXOpeningFragment extends BaseNode { - type: AST_NODE_TYPES.JSXOpeningFragment; -} - -export interface JSXSpreadAttribute extends BaseNode { - type: AST_NODE_TYPES.JSXSpreadAttribute; - argument: Expression; -} - -export interface JSXSpreadChild extends BaseNode { - type: AST_NODE_TYPES.JSXSpreadChild; - expression: Expression | JSXEmptyExpression; -} - -export interface JSXText extends BaseNode { - type: AST_NODE_TYPES.JSXText; - value: string; - raw: string; -} - -export interface LabeledStatement extends BaseNode { - type: AST_NODE_TYPES.LabeledStatement; - label: Identifier; - body: Statement; -} - -export interface LogicalExpression extends BinaryExpressionBase { - type: AST_NODE_TYPES.LogicalExpression; -} - -export interface MemberExpressionComputedName - extends MemberExpressionComputedNameBase { - type: AST_NODE_TYPES.MemberExpression; -} - -export interface MemberExpressionNonComputedName - extends MemberExpressionNonComputedNameBase { - type: AST_NODE_TYPES.MemberExpression; -} - -export interface MetaProperty extends BaseNode { - type: AST_NODE_TYPES.MetaProperty; - meta: Identifier; - property: Identifier; -} - -export interface MethodDefinitionComputedName - extends MethodDefinitionComputedNameBase { - type: AST_NODE_TYPES.MethodDefinition; -} - -export interface MethodDefinitionNonComputedName - extends MethodDefinitionNonComputedNameBase { - type: AST_NODE_TYPES.MethodDefinition; -} - -export interface NewExpression extends BaseNode { - type: AST_NODE_TYPES.NewExpression; - callee: LeftHandSideExpression; - arguments: Expression[]; - typeParameters?: TSTypeParameterInstantiation; -} - -export interface NumberLiteral extends LiteralBase { - type: AST_NODE_TYPES.Literal; - value: number; -} - -export interface NullLiteral extends LiteralBase { - type: AST_NODE_TYPES.Literal; - value: null; -} - -export interface ObjectExpression extends BaseNode { - type: AST_NODE_TYPES.ObjectExpression; - properties: ObjectLiteralElementLike[]; -} - -export interface ObjectPattern extends BaseNode { - type: AST_NODE_TYPES.ObjectPattern; - properties: (Property | RestElement)[]; - typeAnnotation?: TSTypeAnnotation; - optional?: boolean; - decorators?: Decorator[]; -} - -export interface Program extends BaseNode { - type: AST_NODE_TYPES.Program; - body: Statement[]; - sourceType: 'module' | 'script'; - comments?: Comment[]; - tokens?: Token[]; -} - -export interface PropertyComputedName extends PropertyBase { - key: PropertyNameComputed; - computed: true; -} - -export interface PropertyNonComputedName extends PropertyBase { - key: PropertyNameNonComputed; - computed: false; -} - -export interface RegExpLiteral extends LiteralBase { - type: AST_NODE_TYPES.Literal; - value: RegExp | null; -} - -export interface RestElement extends BaseNode { - type: AST_NODE_TYPES.RestElement; - argument: DestructuringPattern; - typeAnnotation?: TSTypeAnnotation; - optional?: boolean; - value?: AssignmentPattern; - decorators?: Decorator[]; -} - -export interface ReturnStatement extends BaseNode { - type: AST_NODE_TYPES.ReturnStatement; - argument: Expression | null; -} - -export interface SequenceExpression extends BaseNode { - type: AST_NODE_TYPES.SequenceExpression; - expressions: Expression[]; -} - -export interface SpreadElement extends BaseNode { - type: AST_NODE_TYPES.SpreadElement; - argument: Expression; -} - -export interface StringLiteral extends LiteralBase { - type: AST_NODE_TYPES.Literal; - value: string; -} - -export interface Super extends BaseNode { - type: AST_NODE_TYPES.Super; -} - -export interface SwitchCase extends BaseNode { - type: AST_NODE_TYPES.SwitchCase; - test: Expression | null; - consequent: Statement[]; -} - -export interface SwitchStatement extends BaseNode { - type: AST_NODE_TYPES.SwitchStatement; - discriminant: Expression; - cases: SwitchCase[]; -} - -export interface TaggedTemplateExpression extends BaseNode { - type: AST_NODE_TYPES.TaggedTemplateExpression; - typeParameters?: TSTypeParameterInstantiation; - tag: LeftHandSideExpression; - quasi: TemplateLiteral; -} - -export interface TemplateElement extends BaseNode { - type: AST_NODE_TYPES.TemplateElement; - value: { - raw: string; - cooked: string; - }; - tail: boolean; -} - -export interface TemplateLiteral extends BaseNode { - type: AST_NODE_TYPES.TemplateLiteral; - quasis: TemplateElement[]; - expressions: Expression[]; -} - -export interface ThisExpression extends BaseNode { - type: AST_NODE_TYPES.ThisExpression; -} - -export interface ThrowStatement extends BaseNode { - type: AST_NODE_TYPES.ThrowStatement; - argument: Statement | TSAsExpression | null; -} - -export interface TryStatement extends BaseNode { - type: AST_NODE_TYPES.TryStatement; - block: BlockStatement; - handler: CatchClause | null; - finalizer: BlockStatement | null; -} - -export interface TSAbstractClassPropertyComputedName - extends ClassPropertyComputedNameBase { - type: AST_NODE_TYPES.TSAbstractClassProperty; -} - -export interface TSAbstractClassPropertyNonComputedName - extends ClassPropertyNonComputedNameBase { - type: AST_NODE_TYPES.TSAbstractClassProperty; -} - -export interface TSAbstractKeyword extends BaseNode { - type: AST_NODE_TYPES.TSAbstractKeyword; -} - -export interface TSAbstractMethodDefinitionComputedName - extends MethodDefinitionComputedNameBase { - type: AST_NODE_TYPES.TSAbstractMethodDefinition; -} - -export interface TSAbstractMethodDefinitionNonComputedName - extends MethodDefinitionNonComputedNameBase { - type: AST_NODE_TYPES.TSAbstractMethodDefinition; -} - -export interface TSAnyKeyword extends BaseNode { - type: AST_NODE_TYPES.TSAnyKeyword; -} - -export interface TSArrayType extends BaseNode { - type: AST_NODE_TYPES.TSArrayType; - elementType: TypeNode; -} - -export interface TSAsExpression extends BaseNode { - type: AST_NODE_TYPES.TSAsExpression; - expression: Expression; - typeAnnotation: TypeNode; -} - -export interface TSAsyncKeyword extends BaseNode { - type: AST_NODE_TYPES.TSAsyncKeyword; -} - -export interface TSBigIntKeyword extends BaseNode { - type: AST_NODE_TYPES.TSBigIntKeyword; -} - -export interface TSBooleanKeyword extends BaseNode { - type: AST_NODE_TYPES.TSBooleanKeyword; -} - -export interface TSCallSignatureDeclaration extends FunctionSignatureBase { - type: AST_NODE_TYPES.TSCallSignatureDeclaration; -} - -export interface TSClassImplements extends TSHeritageBase { - type: AST_NODE_TYPES.TSClassImplements; -} - -export interface TSConditionalType extends BaseNode { - type: AST_NODE_TYPES.TSConditionalType; - checkType: TypeNode; - extendsType: TypeNode; - trueType: TypeNode; - falseType: TypeNode; -} - -export interface TSConstructorType extends FunctionSignatureBase { - type: AST_NODE_TYPES.TSConstructorType; - abstract: boolean; -} - -export interface TSConstructSignatureDeclaration extends FunctionSignatureBase { - type: AST_NODE_TYPES.TSConstructSignatureDeclaration; -} - -export interface TSDeclareFunction extends FunctionDeclarationBase { - type: AST_NODE_TYPES.TSDeclareFunction; -} - -export interface TSDeclareKeyword extends BaseNode { - type: AST_NODE_TYPES.TSDeclareKeyword; -} - -export interface TSEmptyBodyFunctionExpression extends FunctionDeclarationBase { - type: AST_NODE_TYPES.TSEmptyBodyFunctionExpression; - body: null; -} - -export interface TSEnumDeclaration extends BaseNode { - type: AST_NODE_TYPES.TSEnumDeclaration; - id: Identifier; - members: TSEnumMember[]; - const?: boolean; - declare?: boolean; - modifiers?: Modifier[]; -} - -/** - * this should only really happen in semantically invalid code (errors 1164 and 2452) - * - * VALID: - * enum Foo { ['a'] } - * - * INVALID: - * const x = 'a'; - * enum Foo { [x] } - * enum Bar { ['a' + 'b'] } - */ -export interface TSEnumMemberComputedName extends TSEnumMemberBase { - id: PropertyNameComputed; - computed: true; -} - -export interface TSEnumMemberNonComputedName extends TSEnumMemberBase { - id: PropertyNameNonComputed; - computed?: false; -} - -export interface TSExportAssignment extends BaseNode { - type: AST_NODE_TYPES.TSExportAssignment; - expression: Expression; -} - -export interface TSExportKeyword extends BaseNode { - type: AST_NODE_TYPES.TSExportKeyword; -} - -export interface TSExternalModuleReference extends BaseNode { - type: AST_NODE_TYPES.TSExternalModuleReference; - expression: Expression; -} - -export interface TSFunctionType extends FunctionSignatureBase { - type: AST_NODE_TYPES.TSFunctionType; -} - -export interface TSImportEqualsDeclaration extends BaseNode { - type: AST_NODE_TYPES.TSImportEqualsDeclaration; - id: Identifier; - moduleReference: EntityName | TSExternalModuleReference; - isExport: boolean; -} - -export interface TSImportType extends BaseNode { - type: AST_NODE_TYPES.TSImportType; - isTypeOf: boolean; - parameter: TypeNode; - qualifier: EntityName | null; - typeParameters: TSTypeParameterInstantiation | null; -} - -export interface TSIndexedAccessType extends BaseNode { - type: AST_NODE_TYPES.TSIndexedAccessType; - objectType: TypeNode; - indexType: TypeNode; -} - -export interface TSIndexSignature extends BaseNode { - type: AST_NODE_TYPES.TSIndexSignature; - parameters: Parameter[]; - typeAnnotation?: TSTypeAnnotation; - readonly?: boolean; - accessibility?: Accessibility; - export?: boolean; - static?: boolean; -} - -export interface TSInferType extends BaseNode { - type: AST_NODE_TYPES.TSInferType; - typeParameter: TSTypeParameter; -} - -export interface TSInterfaceDeclaration extends BaseNode { - type: AST_NODE_TYPES.TSInterfaceDeclaration; - body: TSInterfaceBody; - id: Identifier; - typeParameters?: TSTypeParameterDeclaration; - extends?: TSInterfaceHeritage[]; - implements?: TSInterfaceHeritage[]; - abstract?: boolean; - declare?: boolean; -} - -export interface TSInterfaceBody extends BaseNode { - type: AST_NODE_TYPES.TSInterfaceBody; - body: TypeElement[]; -} - -export interface TSInterfaceHeritage extends TSHeritageBase { - type: AST_NODE_TYPES.TSInterfaceHeritage; -} - -export interface TSIntersectionType extends BaseNode { - type: AST_NODE_TYPES.TSIntersectionType; - types: TypeNode[]; -} - -export interface TSIntrinsicKeyword extends BaseNode { - type: AST_NODE_TYPES.TSIntrinsicKeyword; -} - -export interface TSLiteralType extends BaseNode { - type: AST_NODE_TYPES.TSLiteralType; - literal: LiteralExpression | UnaryExpression | UpdateExpression; -} - -export interface TSMappedType extends BaseNode { - type: AST_NODE_TYPES.TSMappedType; - typeParameter: TSTypeParameter; - readonly?: boolean | '-' | '+'; - optional?: boolean | '-' | '+'; - typeAnnotation?: TypeNode; - nameType: TypeNode | null; -} - -export interface TSMethodSignatureComputedName extends TSMethodSignatureBase { - key: PropertyNameComputed; - computed: true; -} - -export interface TSMethodSignatureNonComputedName - extends TSMethodSignatureBase { - key: PropertyNameNonComputed; - computed: false; -} - -export interface TSModuleBlock extends BaseNode { - type: AST_NODE_TYPES.TSModuleBlock; - body: Statement[]; -} - -export interface TSModuleDeclaration extends BaseNode { - type: AST_NODE_TYPES.TSModuleDeclaration; - id: Identifier | Literal; - body?: TSModuleBlock | TSModuleDeclaration; - global?: boolean; - declare?: boolean; - modifiers?: Modifier[]; -} - -export interface TSNamedTupleMember extends BaseNode { - type: AST_NODE_TYPES.TSNamedTupleMember; - elementType: TypeNode; - label: Identifier; - optional: boolean; -} - -export interface TSNamespaceExportDeclaration extends BaseNode { - type: AST_NODE_TYPES.TSNamespaceExportDeclaration; - id: Identifier; -} - -export interface TSNeverKeyword extends BaseNode { - type: AST_NODE_TYPES.TSNeverKeyword; -} - -export interface TSNonNullExpression extends BaseNode { - type: AST_NODE_TYPES.TSNonNullExpression; - expression: Expression; -} - -export interface TSNullKeyword extends BaseNode { - type: AST_NODE_TYPES.TSNullKeyword; -} - -export interface TSNumberKeyword extends BaseNode { - type: AST_NODE_TYPES.TSNumberKeyword; -} - -export interface TSObjectKeyword extends BaseNode { - type: AST_NODE_TYPES.TSObjectKeyword; -} - -export interface TSOptionalType extends BaseNode { - type: AST_NODE_TYPES.TSOptionalType; - typeAnnotation: TypeNode; -} - -export interface TSParameterProperty extends BaseNode { - type: AST_NODE_TYPES.TSParameterProperty; - accessibility?: Accessibility; - readonly?: boolean; - static?: boolean; - export?: boolean; - parameter: AssignmentPattern | BindingName | RestElement; - decorators?: Decorator[]; -} - -export interface TSParenthesizedType extends BaseNode { - type: AST_NODE_TYPES.TSParenthesizedType; - typeAnnotation: TypeNode; -} - -export interface TSPropertySignatureComputedName - extends TSPropertySignatureBase { - key: PropertyNameComputed; - computed: true; -} - -export interface TSPropertySignatureNonComputedName - extends TSPropertySignatureBase { - key: PropertyNameNonComputed; - computed: false; -} - -export interface TSPublicKeyword extends BaseNode { - type: AST_NODE_TYPES.TSPublicKeyword; -} - -export interface TSPrivateKeyword extends BaseNode { - type: AST_NODE_TYPES.TSPrivateKeyword; -} - -export interface TSProtectedKeyword extends BaseNode { - type: AST_NODE_TYPES.TSProtectedKeyword; -} - -export interface TSQualifiedName extends BaseNode { - type: AST_NODE_TYPES.TSQualifiedName; - left: EntityName; - right: Identifier; -} - -export interface TSReadonlyKeyword extends BaseNode { - type: AST_NODE_TYPES.TSReadonlyKeyword; -} - -export interface TSRestType extends BaseNode { - type: AST_NODE_TYPES.TSRestType; - typeAnnotation: TypeNode; -} - -export interface TSStaticKeyword extends BaseNode { - type: AST_NODE_TYPES.TSStaticKeyword; -} - -export interface TSStringKeyword extends BaseNode { - type: AST_NODE_TYPES.TSStringKeyword; -} - -export interface TSSymbolKeyword extends BaseNode { - type: AST_NODE_TYPES.TSSymbolKeyword; -} - -export interface TSTemplateLiteralType extends BaseNode { - type: AST_NODE_TYPES.TSTemplateLiteralType; - quasis: TemplateElement[]; - types: TypeNode[]; -} - -export interface TSThisType extends BaseNode { - type: AST_NODE_TYPES.TSThisType; -} - -export interface TSTupleType extends BaseNode { - type: AST_NODE_TYPES.TSTupleType; - elementTypes: TypeNode[]; -} - -export interface TSTypeAliasDeclaration extends BaseNode { - type: AST_NODE_TYPES.TSTypeAliasDeclaration; - id: Identifier; - typeAnnotation: TypeNode; - declare?: boolean; - typeParameters?: TSTypeParameterDeclaration; -} - -export interface TSTypeAnnotation extends BaseNode { - type: AST_NODE_TYPES.TSTypeAnnotation; - typeAnnotation: TypeNode; -} - -export interface TSTypeAssertion extends BaseNode { - type: AST_NODE_TYPES.TSTypeAssertion; - typeAnnotation: TypeNode; - expression: Expression; -} - -export interface TSTypeLiteral extends BaseNode { - type: AST_NODE_TYPES.TSTypeLiteral; - members: TypeElement[]; -} - -export interface TSTypeOperator extends BaseNode { - type: AST_NODE_TYPES.TSTypeOperator; - operator: 'keyof' | 'unique' | 'readonly'; - typeAnnotation?: TypeNode; -} - -export interface TSTypeParameter extends BaseNode { - type: AST_NODE_TYPES.TSTypeParameter; - name: Identifier; - constraint?: TypeNode; - default?: TypeNode; -} - -export interface TSTypeParameterDeclaration extends BaseNode { - type: AST_NODE_TYPES.TSTypeParameterDeclaration; - params: TSTypeParameter[]; -} - -export interface TSTypeParameterInstantiation extends BaseNode { - type: AST_NODE_TYPES.TSTypeParameterInstantiation; - params: TypeNode[]; -} - -export interface TSTypePredicate extends BaseNode { - type: AST_NODE_TYPES.TSTypePredicate; - asserts: boolean; - parameterName: Identifier | TSThisType; - typeAnnotation: TSTypeAnnotation | null; -} - -export interface TSTypeQuery extends BaseNode { - type: AST_NODE_TYPES.TSTypeQuery; - exprName: EntityName; -} - -export interface TSTypeReference extends BaseNode { - type: AST_NODE_TYPES.TSTypeReference; - typeName: EntityName; - typeParameters?: TSTypeParameterInstantiation; -} - -export interface TSUndefinedKeyword extends BaseNode { - type: AST_NODE_TYPES.TSUndefinedKeyword; -} - -export interface TSUnionType extends BaseNode { - type: AST_NODE_TYPES.TSUnionType; - types: TypeNode[]; -} - -export interface TSUnknownKeyword extends BaseNode { - type: AST_NODE_TYPES.TSUnknownKeyword; -} - -export interface TSVoidKeyword extends BaseNode { - type: AST_NODE_TYPES.TSVoidKeyword; -} - -export interface UpdateExpression extends UnaryExpressionBase { - type: AST_NODE_TYPES.UpdateExpression; - operator: '++' | '--'; -} - -export interface UnaryExpression extends UnaryExpressionBase { - type: AST_NODE_TYPES.UnaryExpression; - operator: '+' | '-' | '!' | '~' | 'delete' | 'void' | 'typeof'; -} - -export interface VariableDeclaration extends BaseNode { - type: AST_NODE_TYPES.VariableDeclaration; - // NOTE - this is not guaranteed to have any elements in it. i.e. `const;` - declarations: VariableDeclarator[]; - kind: 'let' | 'const' | 'var'; - declare?: boolean; -} - -export interface VariableDeclarator extends BaseNode { - type: AST_NODE_TYPES.VariableDeclarator; - id: BindingName; - init: Expression | null; - definite?: boolean; -} - -export interface WhileStatement extends BaseNode { - type: AST_NODE_TYPES.WhileStatement; - test: Expression; - body: Statement; -} - -export interface WithStatement extends BaseNode { - type: AST_NODE_TYPES.WithStatement; - object: Expression; - body: Statement; -} - -export interface YieldExpression extends BaseNode { - type: AST_NODE_TYPES.YieldExpression; - delegate: boolean; - argument?: Expression; -} +export * as TSESTree from './ast-spec'; diff --git a/packages/types/tools/copy-ast-spec.ts b/packages/types/tools/copy-ast-spec.ts new file mode 100644 index 000000000000..0288453a3100 --- /dev/null +++ b/packages/types/tools/copy-ast-spec.ts @@ -0,0 +1,59 @@ +import chlidProcess from 'child_process'; +import fs from 'fs'; +import path from 'path'; +import { promisify } from 'util'; + +const readFile = promisify(fs.readFile); +const writeFile = promisify(fs.writeFile); +const execAsync = promisify(chlidProcess.exec); + +const AST_SPEC_PATH = path.resolve(__dirname, '../../ast-spec'); +const OUTPUT_PATH = path.join(path.resolve(__dirname, '../src/')); + +// ensure the package is built +chlidProcess.execSync('yarn build', { cwd: AST_SPEC_PATH, stdio: 'inherit' }); + +const HEADER = `\ +/********************************************** + * DO NOT MODIFY THIS FILE MANUALLY * + * * + * THIS FILE HAS BEEN COPIED FROM ast-spec. * + * ANY CHANGES WILL BE LOST ON THE NEXT BUILD * + * * + * MAKE CHANGES TO ast-spec AND THEN RUN * + * yarn build * + **********************************************/ + +`; + +async function copyFile( + folderName: string, + fileName: string, + transformer: (code: string) => string = (s): string => s, +): Promise { + const code = await readFile( + path.join(AST_SPEC_PATH, folderName, fileName), + 'utf-8', + ); + + const transformedCode = transformer(code); + + const outpath = path.join(OUTPUT_PATH, fileName); + await writeFile(outpath, HEADER + transformedCode, { + encoding: 'utf-8', + }); + + await execAsync(`yarn prettier --write ${outpath}`); + + console.log('Copied', fileName); +} + +async function main(): Promise { + await Promise.all([ + copyFile('dist', 'ast-spec.ts', code => + code.replace(/export declare enum/g, 'export enum'), + ), + ]); +} + +void main(); diff --git a/packages/types/tsconfig.build.json b/packages/types/tsconfig.build.json index 215a0282df2b..b9ac3e1b9770 100644 --- a/packages/types/tsconfig.build.json +++ b/packages/types/tsconfig.build.json @@ -6,5 +6,6 @@ "rootDir": "./src", "resolveJsonModule": true }, - "include": ["src", "typings"] + "include": ["src", "typings"], + "references": [] } diff --git a/packages/types/tsconfig.json b/packages/types/tsconfig.json index 9cea515ba6b2..d1305674c8bb 100644 --- a/packages/types/tsconfig.json +++ b/packages/types/tsconfig.json @@ -4,5 +4,6 @@ "composite": false, "rootDir": "." }, - "include": ["src", "typings", "tests", "tools"] + "include": ["src", "typings", "tests", "tools"], + "references": [] } diff --git a/packages/typescript-estree/CHANGELOG.md b/packages/typescript-estree/CHANGELOG.md index 5cee167088c2..d33e8663db7b 100644 --- a/packages/typescript-estree/CHANGELOG.md +++ b/packages/typescript-estree/CHANGELOG.md @@ -3,6 +3,324 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.2.0...v5.3.0) (2021-11-01) + +**Note:** Version bump only for package @typescript-eslint/typescript-estree + + + + + +# [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/typescript-estree + + + + + +# [5.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.0.0...v5.1.0) (2021-10-18) + + +### Bug Fixes + +* **typescript-estree:** support private optional property definition ([#3997](https://github.com/typescript-eslint/typescript-eslint/issues/3997)) ([8605e08](https://github.com/typescript-eslint/typescript-eslint/commit/8605e080a4dac4a277e6108cd9ed1e5a707302fa)) + + + + + +# [5.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.33.0...v5.0.0) (2021-10-11) + + +### Bug Fixes + +* **typescript-estree:** change `source` of ExportNamedDeclaration to Literal from Expression ([#3763](https://github.com/typescript-eslint/typescript-eslint/issues/3763)) ([dc5a0f5](https://github.com/typescript-eslint/typescript-eslint/commit/dc5a0f5104b400f4422b8d67ecfc6cc7a32613a2)) + + +### 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)) +* **eslint-plugin:** update recommended configs ([#3809](https://github.com/typescript-eslint/typescript-eslint/issues/3809)) ([deeb7bb](https://github.com/typescript-eslint/typescript-eslint/commit/deeb7bb9334d301c6af56aefd37d318231af11ef)) +* 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 `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 `PrivateIdentifier` ([#3808](https://github.com/typescript-eslint/typescript-eslint/issues/3808)) ([0eefe5e](https://github.com/typescript-eslint/typescript-eslint/commit/0eefe5e49d21af3f1e3e2d9a90c2e49929863ac2)), closes [#3430](https://github.com/typescript-eslint/typescript-eslint/issues/3430) [#2933](https://github.com/typescript-eslint/typescript-eslint/issues/2933) +* **eslint-plugin:** removed value from abstract property nodes ([#3765](https://github.com/typescript-eslint/typescript-eslint/issues/3765)) ([5823524](https://github.com/typescript-eslint/typescript-eslint/commit/58235241714596b641a1e8b39c569e561e0039b4)), closes [#3748](https://github.com/typescript-eslint/typescript-eslint/issues/3748) +* **typescript-estree:** remove legacy `useJSXTextNode` option ([#3109](https://github.com/typescript-eslint/typescript-eslint/issues/3109)) ([5b84b98](https://github.com/typescript-eslint/typescript-eslint/commit/5b84b98fb3cf68d944b7d4e970f39f4e88f0b2d5)) + + + + + +# [4.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.32.0...v4.33.0) (2021-10-04) + +**Note:** Version bump only for package @typescript-eslint/typescript-estree + + + + + +# [4.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.2...v4.32.0) (2021-09-27) + +**Note:** Version bump only for package @typescript-eslint/typescript-estree + + + + + +## [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/typescript-estree + + + + + +## [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/typescript-estree + + + + + +# [4.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.30.0...v4.31.0) (2021-09-06) + +**Note:** Version bump only for package @typescript-eslint/typescript-estree + + + + + +# [4.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.3...v4.30.0) (2021-08-30) + + +### Features + +* **typescript-estree:** add support for class static blocks ([#3730](https://github.com/typescript-eslint/typescript-eslint/issues/3730)) ([f81831b](https://github.com/typescript-eslint/typescript-eslint/commit/f81831bd279a32da6dbab0f1c061053ea43965f6)) + + + + + +## [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/typescript-estree + + + + + +## [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/typescript-estree + + + + + +## [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/typescript-estree + + + + + +# [4.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.5...v4.29.0) (2021-08-02) + + +### Bug Fixes + +* **typescript-estree:** correct tty check ([#3635](https://github.com/typescript-eslint/typescript-eslint/issues/3635)) ([62bcc93](https://github.com/typescript-eslint/typescript-eslint/commit/62bcc937f08cd18296ffbe96a3551ec1fb87aecd)) +* **typescript-estree:** ensure --fix works with singleRun mode ([#3655](https://github.com/typescript-eslint/typescript-eslint/issues/3655)) ([99eca0d](https://github.com/typescript-eslint/typescript-eslint/commit/99eca0d428187d4c29ded9ddd1b57b40ab463c01)) + + +### 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)) +* **typescript-estree:** add support for custom module resolution ([#3516](https://github.com/typescript-eslint/typescript-eslint/issues/3516)) ([d48429d](https://github.com/typescript-eslint/typescript-eslint/commit/d48429d97326545bb727f88ce9056270b1599a31)) + + + + + +## [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/typescript-estree + + + + + +## [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/typescript-estree + + + + + +## [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/typescript-estree + + + + + +## [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/typescript-estree + + + + + +## [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/typescript-estree + + + + + +# [4.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.27.0...v4.28.0) (2021-06-21) + +**Note:** Version bump only for package @typescript-eslint/typescript-estree + + + + + +# [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)) +* **typescript-estree:** support override modifier for parameter property ([#3485](https://github.com/typescript-eslint/typescript-eslint/issues/3485)) ([33b9f69](https://github.com/typescript-eslint/typescript-eslint/commit/33b9f69a681cd3219a2acca5b0b2fa67609f099e)) + + +### Features + +* **ast-spec:** specify `PunctuatorToken`'s `value` type ([#3496](https://github.com/typescript-eslint/typescript-eslint/issues/3496)) ([fdb1d81](https://github.com/typescript-eslint/typescript-eslint/commit/fdb1d81f0fcf75a9216e6a90469f18c24c91f718)) +* **typescript-estree:** add opt-in inference for single runs and create programs for projects up front ([#3512](https://github.com/typescript-eslint/typescript-eslint/issues/3512)) ([06c2d9b](https://github.com/typescript-eslint/typescript-eslint/commit/06c2d9ba5442330f56637ecb14fae7e41696699c)) +* allow user to provide TS program instance in parser options ([#3484](https://github.com/typescript-eslint/typescript-eslint/issues/3484)) ([e855b18](https://github.com/typescript-eslint/typescript-eslint/commit/e855b18b8feee0edb5c617c11006861426a6f530)) + + + + + +## [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/typescript-estree + + + + + +# [4.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.25.0...v4.26.0) (2021-05-31) + + +### Bug Fixes + +* generate library types for TypeScript v4.3 ([#3460](https://github.com/typescript-eslint/typescript-eslint/issues/3460)) ([ed4776a](https://github.com/typescript-eslint/typescript-eslint/commit/ed4776afa1374279027b9b7d82aa4b453b334998)), closes [#3449](https://github.com/typescript-eslint/typescript-eslint/issues/3449) + + + + + +# [4.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.24.0...v4.25.0) (2021-05-24) + + +### Features + +* **typescript-estree:** [TS4.3] support overrides on class members ([#3429](https://github.com/typescript-eslint/typescript-eslint/issues/3429)) ([21d1b62](https://github.com/typescript-eslint/typescript-eslint/commit/21d1b62a0b84b502d2cf12674b3d141994a3ffd4)) +* **typescript-estree:** add support for getter/setter signatures on types ([#3427](https://github.com/typescript-eslint/typescript-eslint/issues/3427)) ([b830b7f](https://github.com/typescript-eslint/typescript-eslint/commit/b830b7f4e8a99affc8af8b53cb83371ef81d7032)), closes [#3272](https://github.com/typescript-eslint/typescript-eslint/issues/3272) [#3272](https://github.com/typescript-eslint/typescript-eslint/issues/3272) + + + + + +# [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/typescript-estree + + + + + +# [4.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.1...v4.23.0) (2021-05-10) + + +### Features + +* 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/typescript-estree + + + + + +# [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/typescript-estree + + + + + +# [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/typescript-estree + + + + + +# [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/typescript-estree + + + + + +# [4.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.18.0...v4.19.0) (2021-03-22) + + +### Bug Fixes + +* **typescript-estree:** [ts 4.2] add support for import type equal declaration ([#3189](https://github.com/typescript-eslint/typescript-eslint/issues/3189)) ([6a25faf](https://github.com/typescript-eslint/typescript-eslint/commit/6a25faf5cfa4d21a7546d9866819f4e017308fb2)) + + + + + +# [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/typescript-estree + + + + + +# [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/typescript-estree + + + + + ## [4.16.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.16.0...v4.16.1) (2021-03-01) diff --git a/packages/typescript-estree/README.md b/packages/typescript-estree/README.md index b9d40fb1ec07..25eb1e928294 100644 --- a/packages/typescript-estree/README.md +++ b/packages/typescript-estree/README.md @@ -101,14 +101,6 @@ interface ParseOptions { * Set to true to create a top-level array containing all tokens from the file. */ tokens?: boolean; - - /* - * The JSX AST changed the node type for string literals - * inside a JSX Element from `Literal` to `JSXText`. - * When value is `true`, these nodes will be parsed as type `JSXText`. - * When value is `false`, these nodes will be parsed as type `Literal`. - */ - useJSXTextNode?: boolean; } const PARSE_DEFAULT_OPTIONS: ParseOptions = { @@ -120,7 +112,6 @@ const PARSE_DEFAULT_OPTIONS: ParseOptions = { loggerFn: undefined, range: false, tokens: false, - useJSXTextNode: false, }; declare function parse( @@ -208,6 +199,13 @@ interface ParseAndGenerateServicesOptions extends ParseOptions { */ tsconfigRootDir?: string; + /** + * An array of one or more instances of TypeScript Program objects to be used for type information. + * 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?: Program[]; + /** *************************************************************************************** * IT IS RECOMMENDED THAT YOU DO NOT USE THIS OPTION, AS IT CAUSES PERFORMANCE ISSUES. * @@ -218,6 +216,25 @@ interface ParseAndGenerateServicesOptions extends ParseOptions { * it will not error, but will instead parse the file and its dependencies in a new program. */ createDefaultProgram?: boolean; + + /** + * ESLint (and therefore typescript-eslint) is used in both "single run"/one-time contexts, + * such as an ESLint CLI invocation, and long-running sessions (such as continuous feedback + * on a file in an IDE). + * + * When typescript-eslint handles TypeScript Program management behind the scenes, this distinction + * is important because there is significant overhead to managing the so called Watch Programs + * needed for the long-running use-case. + * + * When allowAutomaticSingleRunInference is enabled, we will use common heuristics to infer + * whether or not ESLint is being used as part of a single run. + */ + allowAutomaticSingleRunInference?: boolean; + + /** + * Path to a file exporting a custom ModuleResolver. + */ + moduleResolver?: string; } interface ParserServices { @@ -303,6 +320,34 @@ Types for the AST produced by the parse functions. - `AST_NODE_TYPES` is an enum which provides the values for every single AST node's `type` property. - `AST_TOKEN_TYPES` is an enum which provides the values for every single AST token's `type` property. +### Utilities + +#### `createProgram(configFile, projectDirectory)` + +This serves as a utility method for users of the `ParseOptions.programs` feature to create a TypeScript program instance from a config file. + +```ts +declare function createProgram( + configFile: string, + projectDirectory: string = process.cwd(), +): import('typescript').Program; +``` + +Example usage: + +```js +const tsESTree = require('@typescript-eslint/typescript-estree'); + +const program = tsESTree.createProgram('tsconfig.json'); +const code = `const hello: string = 'world';`; +const { ast, services } = parseAndGenerateServices(code, { + filePath: '/some/path/to/file/foo.ts', + loc: true, + program, + range: true, +}); +``` + ## Supported TypeScript Version See the [Supported TypeScript Version](../../README.md#supported-typescript-version) section in the project root. diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index 784d2b788a9a..c77bd556e096 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/typescript-estree", - "version": "4.16.1", + "version": "5.3.0", "description": "A parser that converts TypeScript source code into an ESTree compatible form", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -10,7 +10,7 @@ "LICENSE" ], "engines": { - "node": "^10.12.0 || >=12.0.0" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "repository": { "type": "git", @@ -34,36 +34,36 @@ "build": "tsc -b tsconfig.build.json", "postbuild": "downlevel-dts dist _ts3.4/dist", "clean": "tsc -b tsconfig.build.json --clean", - "postclean": "rimraf dist", + "postclean": "rimraf dist && rimraf _ts3.4 && rimraf coverage", "format": "prettier --write \"./**/*.{ts,js,json,md}\" --ignore-path ../../.prettierignore", "lint": "eslint . --ext .js,.ts --ignore-path='../../.eslintignore'", "test": "jest --coverage", "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/types": "4.16.1", - "@typescript-eslint/visitor-keys": "4.16.1", - "debug": "^4.1.1", - "globby": "^11.0.1", - "is-glob": "^4.0.1", - "semver": "^7.3.2", - "tsutils": "^3.17.1" + "@typescript-eslint/types": "5.3.0", + "@typescript-eslint/visitor-keys": "5.3.0", + "debug": "^4.3.2", + "globby": "^11.0.4", + "is-glob": "^4.0.3", + "semver": "^7.3.5", + "tsutils": "^3.21.0" }, "devDependencies": { - "@babel/code-frame": "^7.12.13", - "@babel/parser": "^7.13.4", - "@babel/types": "^7.13.0", + "@babel/code-frame": "*", + "@babel/parser": "*", + "@babel/types": "*", "@types/babel__code-frame": "*", "@types/debug": "*", "@types/glob": "*", "@types/is-glob": "*", "@types/semver": "*", "@types/tmp": "*", - "@typescript-eslint/shared-fixtures": "4.16.1", + "@typescript-eslint/shared-fixtures": "5.3.0", "glob": "*", "jest-specific-snapshot": "*", "make-dir": "*", - "tmp": "^0.2.1", + "tmp": "*", "typescript": "*" }, "peerDependenciesMeta": { diff --git a/packages/typescript-estree/project.json b/packages/typescript-estree/project.json new file mode 100644 index 000000000000..a3e44b64373d --- /dev/null +++ b/packages/typescript-estree/project.json @@ -0,0 +1,5 @@ +{ + "root": "packages/typescript-estree", + "type": "library", + "implicitDependencies": [] +} diff --git a/packages/typescript-estree/src/ast-converter.ts b/packages/typescript-estree/src/ast-converter.ts index e42f722ff66d..49ffd28f479e 100644 --- a/packages/typescript-estree/src/ast-converter.ts +++ b/packages/typescript-estree/src/ast-converter.ts @@ -1,9 +1,9 @@ -import { SourceFile } from 'typescript'; +import type { SourceFile } from 'typescript'; import { convertError, Converter, ASTMaps } from './convert'; import { convertComments } from './convert-comments'; import { convertTokens } from './node-utils'; -import { Extra } from './parser-options'; -import { TSESTree } from './ts-estree'; +import type { Extra } from './parser-options'; +import type { TSESTree } from './ts-estree'; import { simpleTraverse } from './simple-traverse'; export function astConverter( @@ -15,9 +15,7 @@ export function astConverter( * The TypeScript compiler produced fundamental parse errors when parsing the * source. */ - // internal typescript api... - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const parseDiagnostics = (ast as any).parseDiagnostics; + const { parseDiagnostics } = ast; if (parseDiagnostics.length) { throw convertError(parseDiagnostics[0]); } @@ -27,7 +25,6 @@ export function astConverter( */ const instance = new Converter(ast, { errorOnUnknownASTType: extra.errorOnUnknownASTType || false, - useJSXTextNode: extra.useJSXTextNode || false, shouldPreserveNodeMaps, }); diff --git a/packages/typescript-estree/src/convert.ts b/packages/typescript-estree/src/convert.ts index 28442094c2cd..bd33d9a53e51 100644 --- a/packages/typescript-estree/src/convert.ts +++ b/packages/typescript-estree/src/convert.ts @@ -1,5 +1,5 @@ // There's lots of funny stuff due to the typing of ts.Node -/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-member-access */ import * as ts from 'typescript'; import { canContainDirective, @@ -23,7 +23,11 @@ import { TSError, unescapeStringLiteralText, } from './node-utils'; -import { ParserWeakMap, ParserWeakMapESTreeToTSNode } from './parser-options'; +import type { + ParserWeakMap, + ParserWeakMapESTreeToTSNode, +} from './parser-options'; +import type { SemanticOrSyntacticError } from './semantic-or-syntactic-errors'; import { AST_NODE_TYPES, TSESTree, @@ -31,12 +35,12 @@ import { TSNode, } from './ts-estree'; import { typescriptVersionIsAtLeast } from './version-check'; +import { Expression } from '@typescript-eslint/types/src/ast-spec'; const SyntaxKind = ts.SyntaxKind; interface ConverterOptions { errorOnUnknownASTType: boolean; - useJSXTextNode: boolean; shouldPreserveNodeMaps: boolean; } @@ -45,11 +49,13 @@ interface ConverterOptions { * @param error the error object * @returns converted error object */ -export function convertError(error: any): TSError { +export function convertError( + error: ts.DiagnosticWithLocation | SemanticOrSyntacticError, +): TSError { return createError( - error.file, - error.start, - error.message || error.messageText, + error.file!, + error.start!, + ('message' in error && error.message) || (error.messageText as string), ); } @@ -199,7 +205,7 @@ export class Converter { */ private registerTSNodeInNodeMap( node: ts.Node, - result: TSESTree.BaseNode | null, + result: TSESTree.Node | null, ): void { if (result && this.options.shouldPreserveNodeMaps) { if (!this.tsNodeToESTreeNodeMap.has(node)) { @@ -265,7 +271,7 @@ export class Converter { tsType: ts.TypeNode | undefined, parent?: ts.Node, ): TSESTree.BindingName { - const id = this.convertPattern(name); + const id = this.convertPattern(name) as TSESTree.BindingName; if (tsType) { id.typeAnnotation = this.convertTypeAnnotation(tsType, parent); @@ -311,7 +317,11 @@ export class Converter { */ private convertBodyExpressions( nodes: ts.NodeArray, - parent: ts.SourceFile | ts.Block | ts.ModuleBlock, + parent: + | ts.SourceFile + | ts.Block + | ts.ModuleBlock + | ts.ClassStaticBlockDeclaration, ): TSESTree.Statement[] { let allowDirectives = canContainDirective(parent); @@ -500,16 +510,16 @@ export class Converter { Object.entries(node) .filter( ([key]) => - !/^(?:_children|kind|parent|pos|end|flags|modifierFlagsCache|jsDoc|type|typeArguments|typeParameters|decorators)$/.test( + !/^(?:_children|kind|parent|pos|end|flags|modifierFlagsCache|jsDoc|type|typeArguments|typeParameters|decorators|transformFlags)$/.test( key, ), ) .forEach(([key, value]) => { if (Array.isArray(value)) { - result[key] = value.map(el => this.convertChild(el)); + result[key] = value.map(el => this.convertChild(el as TSNode)); } else if (value && typeof value === 'object' && value.kind) { // need to check node[key].kind to ensure we don't try to convert a symbol - result[key] = this.convertChild(value); + result[key] = this.convertChild(value as TSNode); } else { result[key] = value; } @@ -593,6 +603,66 @@ export class Converter { return result; } + private convertMethodSignature( + node: + | ts.MethodSignature + | ts.GetAccessorDeclaration + | ts.SetAccessorDeclaration, + ): TSESTree.TSMethodSignature { + const result = this.createNode(node, { + type: AST_NODE_TYPES.TSMethodSignature, + computed: isComputedProperty(node.name), + key: this.convertChild(node.name), + params: this.convertParameters(node.parameters), + kind: ((): 'get' | 'set' | 'method' => { + switch (node.kind) { + case SyntaxKind.GetAccessor: + return 'get'; + + case SyntaxKind.SetAccessor: + return 'set'; + + case SyntaxKind.MethodSignature: + 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 = + 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; + } + /** * Applies the given TS modifiers to the given result object. * @param result @@ -631,7 +701,9 @@ export class Converter { result.declare = true; break; default: - remainingModifiers.push(this.convertChild(modifier)); + remainingModifiers.push( + this.convertChild(modifier) as TSESTree.Modifier, + ); break; } } @@ -664,6 +736,21 @@ export class Converter { } } + private assertModuleSpecifier( + node: ts.ExportDeclaration | ts.ImportDeclaration, + ): void { + if ( + node.moduleSpecifier && + node.moduleSpecifier.kind !== SyntaxKind.StringLiteral + ) { + throw createError( + this.ast, + node.moduleSpecifier.pos, + 'Module specifier must be a string literal.', + ); + } + } + /** * Converts a TypeScript node into an ESTree node. * The core of the conversion logic: @@ -697,6 +784,14 @@ export class Converter { }); } + case SyntaxKind.PrivateIdentifier: { + return this.createNode(node, { + type: AST_NODE_TYPES.PrivateIdentifier, + // typescript includes the `#` in the text + name: node.text.slice(1), + }); + } + case SyntaxKind.WithStatement: return this.createNode(node, { type: AST_NODE_TYPES.WithStatement, @@ -868,9 +963,10 @@ export class Converter { // Process typeParameters if (node.typeParameters) { - result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration( - node.typeParameters, - ); + result.typeParameters = + this.convertTSTypeParametersToTypeParametersDeclaration( + node.typeParameters, + ); } // check for exports @@ -1024,17 +1120,18 @@ export class Converter { case SyntaxKind.PropertyDeclaration: { const isAbstract = hasModifier(SyntaxKind.AbstractKeyword, node); const result = this.createNode< - TSESTree.TSAbstractClassProperty | TSESTree.ClassProperty + TSESTree.TSAbstractPropertyDefinition | TSESTree.PropertyDefinition >(node, { type: isAbstract - ? AST_NODE_TYPES.TSAbstractClassProperty - : AST_NODE_TYPES.ClassProperty, + ? AST_NODE_TYPES.TSAbstractPropertyDefinition + : AST_NODE_TYPES.PropertyDefinition, key: this.convertChild(node.name), - value: this.convertChild(node.initializer), + value: isAbstract ? null : this.convertChild(node.initializer), computed: isComputedProperty(node.name), static: hasModifier(SyntaxKind.StaticKeyword, node), readonly: hasModifier(SyntaxKind.ReadonlyKeyword, node) || undefined, declare: hasModifier(SyntaxKind.DeclareKeyword, node), + override: hasModifier(SyntaxKind.OverrideKeyword, node), }); if (node.type) { @@ -1052,7 +1149,8 @@ export class Converter { if ( (node.name.kind === SyntaxKind.Identifier || - node.name.kind === SyntaxKind.ComputedPropertyName) && + node.name.kind === SyntaxKind.ComputedPropertyName || + node.name.kind === SyntaxKind.PrivateIdentifier) && node.questionToken ) { result.optional = true; @@ -1069,7 +1167,15 @@ export class Converter { } case SyntaxKind.GetAccessor: - case SyntaxKind.SetAccessor: + case SyntaxKind.SetAccessor: { + if ( + node.parent.kind === SyntaxKind.InterfaceDeclaration || + node.parent.kind === SyntaxKind.TypeLiteral + ) { + return this.convertMethodSignature(node); + } + } + // otherwise, it is a non-type accessor - intentional fallthrough case SyntaxKind.MethodDeclaration: { const method = this.createNode< TSESTree.TSEmptyBodyFunctionExpression | TSESTree.FunctionExpression @@ -1092,9 +1198,10 @@ export class Converter { // Process typeParameters if (node.typeParameters) { - method.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration( - node.typeParameters, - ); + method.typeParameters = + this.convertTSTypeParametersToTypeParametersDeclaration( + node.typeParameters, + ); this.fixParentLocation(method, method.typeParameters.range); } @@ -1142,6 +1249,7 @@ export class Converter { computed: isComputedProperty(node.name), static: hasModifier(SyntaxKind.StaticKeyword, node), kind: 'method', + override: hasModifier(SyntaxKind.OverrideKeyword, node), }); if (node.decorators) { @@ -1199,9 +1307,10 @@ export class Converter { // Process typeParameters if (node.typeParameters) { - constructor.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration( - node.typeParameters, - ); + constructor.typeParameters = + this.convertTSTypeParametersToTypeParametersDeclaration( + node.typeParameters, + ); this.fixParentLocation(constructor, constructor.typeParameters.range); } @@ -1228,6 +1337,7 @@ export class Converter { computed: false, static: isStatic, kind: isStatic ? 'method' : 'constructor', + override: false, }); const accessibility = getTSNodeAccessibility(node); @@ -1256,9 +1366,10 @@ export class Converter { // Process typeParameters if (node.typeParameters) { - result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration( - node.typeParameters, - ); + result.typeParameters = + this.convertTSTypeParametersToTypeParametersDeclaration( + node.typeParameters, + ); } return result; } @@ -1354,9 +1465,10 @@ export class Converter { // Process typeParameters if (node.typeParameters) { - result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration( - node.typeParameters, - ); + result.typeParameters = + this.convertTSTypeParametersToTypeParametersDeclaration( + node.typeParameters, + ); } return result; } @@ -1403,8 +1515,12 @@ export class Converter { }); node.templateSpans.forEach(templateSpan => { - result.expressions.push(this.convertChild(templateSpan.expression)); - result.quasis.push(this.convertChild(templateSpan.literal)); + result.expressions.push( + this.convertChild(templateSpan.expression) as TSESTree.Expression, + ); + result.quasis.push( + this.convertChild(templateSpan.literal) as TSESTree.TemplateElement, + ); }); return result; } @@ -1509,6 +1625,8 @@ export class Converter { hasModifier(SyntaxKind.ReadonlyKeyword, node) || undefined, static: hasModifier(SyntaxKind.StaticKeyword, node) || undefined, export: hasModifier(SyntaxKind.ExportKeyword, node) || undefined, + override: + hasModifier(SyntaxKind.OverrideKeyword, node) || undefined, parameter: result, }); } @@ -1558,17 +1676,19 @@ export class Converter { } if (superClass.types[0]?.typeArguments) { - result.superTypeParameters = this.convertTypeArgumentsToTypeParameters( - superClass.types[0].typeArguments, - superClass.types[0], - ); + result.superTypeParameters = + this.convertTypeArgumentsToTypeParameters( + superClass.types[0].typeArguments, + superClass.types[0], + ); } } if (node.typeParameters) { - result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration( - node.typeParameters, - ); + result.typeParameters = + this.convertTSTypeParametersToTypeParametersDeclaration( + node.typeParameters, + ); } if (implementsClause) { @@ -1610,6 +1730,8 @@ export class Converter { }); case SyntaxKind.ImportDeclaration: { + this.assertModuleSpecifier(node); + const result = this.createNode(node, { type: AST_NODE_TYPES.ImportDeclaration, source: this.convertChild(node.moduleSpecifier), @@ -1623,14 +1745,18 @@ export class Converter { } if (node.importClause.name) { - result.specifiers.push(this.convertChild(node.importClause)); + result.specifiers.push( + this.convertChild(node.importClause) as TSESTree.ImportClause, + ); } if (node.importClause.namedBindings) { switch (node.importClause.namedBindings.kind) { case SyntaxKind.NamespaceImport: result.specifiers.push( - this.convertChild(node.importClause.namedBindings), + this.convertChild( + node.importClause.namedBindings, + ) as TSESTree.ImportClause, ); break; case SyntaxKind.NamedImports: @@ -1668,7 +1794,8 @@ export class Converter { }); } - case SyntaxKind.ExportDeclaration: + case SyntaxKind.ExportDeclaration: { + this.assertModuleSpecifier(node); if (node.exportClause?.kind === SyntaxKind.NamedExports) { return this.createNode(node, { type: AST_NODE_TYPES.ExportNamedDeclaration, @@ -1695,6 +1822,7 @@ export class Converter { : null, }); } + } case SyntaxKind.ExportSpecifier: return this.createNode(node, { @@ -1783,7 +1911,7 @@ export class Converter { expressions: [], }); - const left = this.convertChild(node.left); + const left = this.convertChild(node.left) as Expression; if ( left.type === AST_NODE_TYPES.SequenceExpression && node.left.kind !== SyntaxKind.ParenthesizedExpression @@ -1793,7 +1921,9 @@ export class Converter { result.expressions.push(left); } - result.expressions.push(this.convertChild(node.right)); + result.expressions.push( + this.convertChild(node.right) as TSESTree.Expression, + ); return result; } else { const type = getBinaryExpressionType(node.operatorToken); @@ -1987,7 +2117,7 @@ export class Converter { let regex = null; try { regex = new RegExp(pattern, flags); - } catch (exception) { + } catch (exception: unknown) { regex = null; } @@ -2147,32 +2277,17 @@ export class Converter { }); } - /** - * The JSX AST changed the node type for string literals - * inside a JSX Element from `Literal` to `JSXText`. We - * provide a flag to support both types until `Literal` - * node type is deprecated in ESLint v5. - */ case SyntaxKind.JsxText: { const start = node.getFullStart(); const end = node.getEnd(); const text = this.ast.text.slice(start, end); - if (this.options.useJSXTextNode) { - return this.createNode(node, { - type: AST_NODE_TYPES.JSXText, - value: unescapeStringLiteralText(text), - raw: text, - range: [start, end], - }); - } else { - return this.createNode(node, { - type: AST_NODE_TYPES.Literal, - value: unescapeStringLiteralText(text), - raw: text, - range: [start, end], - }); - } + return this.createNode(node, { + type: AST_NODE_TYPES.JSXText, + value: unescapeStringLiteralText(text), + raw: text, + range: [start, end], + }); } case SyntaxKind.JsxSpreadAttribute: @@ -2330,9 +2445,10 @@ export class Converter { // Process typeParameters if (node.typeParameters) { - result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration( - node.typeParameters, - ); + result.typeParameters = + this.convertTSTypeParametersToTypeParametersDeclaration( + node.typeParameters, + ); } // check for exports @@ -2340,44 +2456,7 @@ export class Converter { } case SyntaxKind.MethodSignature: { - const result = this.createNode(node, { - type: AST_NODE_TYPES.TSMethodSignature, - computed: isComputedProperty(node.name), - key: this.convertChild(node.name), - params: this.convertParameters(node.parameters), - }); - - 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 = 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; + return this.convertMethodSignature(node); } case SyntaxKind.PropertySignature: { @@ -2441,9 +2520,10 @@ export class Converter { result.returnType = this.convertTypeAnnotation(node.type, node); } if (node.typeParameters) { - result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration( - node.typeParameters, - ); + result.typeParameters = + this.convertTSTypeParametersToTypeParametersDeclaration( + node.typeParameters, + ); } return result; } @@ -2470,9 +2550,10 @@ export class Converter { } if (node.typeParameters) { - result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration( - node.typeParameters, - ); + result.typeParameters = + this.convertTSTypeParametersToTypeParametersDeclaration( + node.typeParameters, + ); } return result; } @@ -2510,9 +2591,10 @@ export class Converter { }); if (node.typeParameters) { - result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration( - node.typeParameters, - ); + result.typeParameters = + this.convertTSTypeParametersToTypeParametersDeclaration( + node.typeParameters, + ); } if (interfaceHeritageClauses.length > 0) { @@ -2522,11 +2604,15 @@ export class Converter { for (const heritageClause of interfaceHeritageClauses) { if (heritageClause.token === SyntaxKind.ExtendsKeyword) { for (const n of heritageClause.types) { - interfaceExtends.push(this.convertChild(n, node)); + interfaceExtends.push( + this.convertChild(n, node) as TSESTree.TSInterfaceHeritage, + ); } } else { for (const n of heritageClause.types) { - interfaceImplements.push(this.convertChild(n, node)); + interfaceImplements.push( + this.convertChild(n, node) as TSESTree.TSInterfaceHeritage, + ); } } } @@ -2628,10 +2714,7 @@ export class Converter { // TypeScript specific types case SyntaxKind.ParenthesizedType: { - return this.createNode(node, { - type: AST_NODE_TYPES.TSParenthesizedType, - typeAnnotation: this.convertType(node.type), - }); + return this.convertType(node.type); } case SyntaxKind.UnionType: { return this.createNode(node, { @@ -2690,6 +2773,7 @@ export class Converter { 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), }); } @@ -2770,12 +2854,23 @@ export class Converter { }); node.templateSpans.forEach(templateSpan => { - result.types.push(this.convertChild(templateSpan.type)); - result.quasis.push(this.convertChild(templateSpan.literal)); + result.types.push( + this.convertChild(templateSpan.type) as TSESTree.TypeNode, + ); + result.quasis.push( + this.convertChild(templateSpan.literal) as TSESTree.TemplateElement, + ); }); return result; } + case SyntaxKind.ClassStaticBlockDeclaration: { + return this.createNode(node, { + type: AST_NODE_TYPES.StaticBlock, + body: this.convertBodyExpressions(node.body.statements, node), + }); + } + default: return this.deeplyCopy(node); } diff --git a/packages/typescript-estree/src/create-program/createDefaultProgram.ts b/packages/typescript-estree/src/create-program/createDefaultProgram.ts index c912a44418a0..6e8c21612501 100644 --- a/packages/typescript-estree/src/create-program/createDefaultProgram.ts +++ b/packages/typescript-estree/src/create-program/createDefaultProgram.ts @@ -6,6 +6,7 @@ import { ASTAndProgram, CanonicalPath, createDefaultCompilerOptionsFromExtra, + getModuleResolver, } from './shared'; const log = debug('typescript-eslint:typescript-estree:createDefaultProgram'); @@ -43,6 +44,13 @@ function createDefaultProgram( commandLine.options, /* setParentNodes */ true, ); + + if (extra.moduleResolver) { + compilerHost.resolveModuleNames = getModuleResolver( + extra.moduleResolver, + ).resolveModuleNames; + } + const oldReadFile = compilerHost.readFile; compilerHost.readFile = (fileName: string): string | undefined => path.normalize(fileName) === path.normalize(extra.filePath) diff --git a/packages/typescript-estree/src/create-program/createProjectProgram.ts b/packages/typescript-estree/src/create-program/createProjectProgram.ts index bca6fda10051..69903a5bcafc 100644 --- a/packages/typescript-estree/src/create-program/createProjectProgram.ts +++ b/packages/typescript-estree/src/create-program/createProjectProgram.ts @@ -3,19 +3,12 @@ import path from 'path'; import { getProgramsForProjects } from './createWatchProgram'; import { firstDefined } from '../node-utils'; import { Extra } from '../parser-options'; -import { ASTAndProgram } from './shared'; +import { ASTAndProgram, getAstFromProgram } from './shared'; const log = debug('typescript-eslint:typescript-estree:createProjectProgram'); const DEFAULT_EXTRA_FILE_EXTENSIONS = ['.ts', '.tsx', '.js', '.jsx']; -function getExtension(fileName: string | undefined): string | null { - if (!fileName) { - return null; - } - return fileName.endsWith('.d.ts') ? '.d.ts' : path.extname(fileName); -} - /** * @param code The code of the file being linted * @param createDefaultProgram True if the default program should be created @@ -31,18 +24,7 @@ function createProjectProgram( const astAndProgram = firstDefined( getProgramsForProjects(code, extra.filePath, extra), - currentProgram => { - const ast = currentProgram.getSourceFile(extra.filePath); - - // working around https://github.com/typescript-eslint/typescript-eslint/issues/1573 - const expectedExt = getExtension(extra.filePath); - const returnedExt = getExtension(ast?.fileName); - if (expectedExt !== returnedExt) { - return; - } - - return ast && { ast, program: currentProgram }; - }, + currentProgram => getAstFromProgram(currentProgram, extra), ); if (!astAndProgram && !createDefaultProgram) { diff --git a/packages/typescript-estree/src/create-program/createWatchProgram.ts b/packages/typescript-estree/src/create-program/createWatchProgram.ts index e00663a114ed..ae2dec4de514 100644 --- a/packages/typescript-estree/src/create-program/createWatchProgram.ts +++ b/packages/typescript-estree/src/create-program/createWatchProgram.ts @@ -9,6 +9,7 @@ import { CanonicalPath, createDefaultCompilerOptionsFromExtra, getCanonicalFileName, + getModuleResolver, } from './shared'; const log = debug('typescript-eslint:typescript-estree:createWatchProgram'); @@ -50,7 +51,7 @@ const parsedFilesSeenHash = new Map(); * Clear all of the parser caches. * This should only be used in testing to ensure the parser is clean between tests. */ -function clearCaches(): void { +function clearWatchCaches(): void { knownWatchProgramMap.clear(); fileWatchCallbackTrackingMap.clear(); folderWatchCallbackTrackingMap.clear(); @@ -269,6 +270,12 @@ function createWatchProgram( /*reportWatchStatus*/ () => {}, ) as WatchCompilerHostOfConfigFile; + if (extra.moduleResolver) { + watchCompilerHost.resolveModuleNames = getModuleResolver( + extra.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 => { @@ -363,7 +370,7 @@ function createWatchProgram( 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 => { + watchCompilerHost.setTimeout = (cb, _ms, ...args: unknown[]): unknown => { callback = cb.bind(/*this*/ undefined, ...args); return callback; }; @@ -388,9 +395,8 @@ function createWatchProgram( function hasTSConfigChanged(tsconfigPath: CanonicalPath): boolean { const stat = fs.statSync(tsconfigPath); const lastModifiedAt = stat.mtimeMs; - const cachedLastModifiedAt = tsconfigLastModifiedTimestampCache.get( - tsconfigPath, - ); + const cachedLastModifiedAt = + tsconfigLastModifiedTimestampCache.get(tsconfigPath); tsconfigLastModifiedTimestampCache.set(tsconfigPath, lastModifiedAt); @@ -531,4 +537,4 @@ function maybeInvalidateProgram( return null; } -export { clearCaches, createWatchProgram, getProgramsForProjects }; +export { clearWatchCaches, createWatchProgram, getProgramsForProjects }; diff --git a/packages/typescript-estree/src/create-program/shared.ts b/packages/typescript-estree/src/create-program/shared.ts index ae2962528040..a0e654c90979 100644 --- a/packages/typescript-estree/src/create-program/shared.ts +++ b/packages/typescript-estree/src/create-program/shared.ts @@ -1,6 +1,7 @@ import path from 'path'; import * as ts from 'typescript'; -import { Extra } from '../parser-options'; +import { Program } from 'typescript'; +import { Extra, ModuleResolver } from '../parser-options'; interface ASTAndProgram { ast: ts.SourceFile; @@ -8,14 +9,11 @@ interface ASTAndProgram { } /** - * Default compiler options for program generation from single root file + * Compiler options required to avoid critical functionality issues */ -const DEFAULT_COMPILER_OPTIONS: ts.CompilerOptions = { - allowNonTsExtensions: true, - allowJs: true, - checkJs: true, - noEmit: true, - // extendedDiagnostics: true, +const CORE_COMPILER_OPTIONS: ts.CompilerOptions = { + noEmit: true, // required to avoid parse from causing emit to occur + /** * Flags required to make no-unused-vars work */ @@ -23,6 +21,16 @@ const DEFAULT_COMPILER_OPTIONS: ts.CompilerOptions = { noUnusedParameters: true, }; +/** + * Default compiler options for program generation + */ +const DEFAULT_COMPILER_OPTIONS: ts.CompilerOptions = { + ...CORE_COMPILER_OPTIONS, + allowNonTsExtensions: true, + allowJs: true, + checkJs: true, +}; + function createDefaultCompilerOptionsFromExtra( extra: Extra, ): ts.CompilerOptions { @@ -93,12 +101,55 @@ function getScriptKind( } } +function getExtension(fileName: string | undefined): string | null { + if (!fileName) { + return null; + } + return fileName.endsWith('.d.ts') ? '.d.ts' : path.extname(fileName); +} + +function getAstFromProgram( + currentProgram: Program, + extra: Extra, +): ASTAndProgram | undefined { + const ast = currentProgram.getSourceFile(extra.filePath); + + // working around https://github.com/typescript-eslint/typescript-eslint/issues/1573 + const expectedExt = getExtension(extra.filePath); + const returnedExt = getExtension(ast?.fileName); + if (expectedExt !== returnedExt) { + return undefined; + } + + 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; +} + export { ASTAndProgram, + CORE_COMPILER_OPTIONS, canonicalDirname, CanonicalPath, createDefaultCompilerOptionsFromExtra, ensureAbsolutePath, getCanonicalFileName, getScriptKind, + getAstFromProgram, + getModuleResolver, }; diff --git a/packages/typescript-estree/src/create-program/useProvidedPrograms.ts b/packages/typescript-estree/src/create-program/useProvidedPrograms.ts new file mode 100644 index 000000000000..23b56497dc61 --- /dev/null +++ b/packages/typescript-estree/src/create-program/useProvidedPrograms.ts @@ -0,0 +1,97 @@ +import debug from 'debug'; +import * as fs from 'fs'; +import * as path from 'path'; +import * as ts from 'typescript'; +import { Extra } from '../parser-options'; +import { + ASTAndProgram, + CORE_COMPILER_OPTIONS, + getAstFromProgram, +} from './shared'; + +const log = debug('typescript-eslint:typescript-estree:useProvidedProgram'); + +function useProvidedPrograms( + programInstances: Iterable, + extra: Extra, +): ASTAndProgram | undefined { + log( + 'Retrieving ast for %s from provided program instance(s)', + extra.filePath, + ); + + let astAndProgram: ASTAndProgram | undefined; + for (const programInstance of programInstances) { + astAndProgram = getAstFromProgram(programInstance, extra); + // Stop at the first applicable program instance + if (astAndProgram) { + break; + } + } + + if (!astAndProgram) { + const relativeFilePath = path.relative( + extra.tsconfigRootDir || process.cwd(), + extra.filePath, + ); + const errorLines = [ + '"parserOptions.programs" has been provided for @typescript-eslint/parser.', + `The file was not found in any of the provided program instance(s): ${relativeFilePath}`, + ]; + + throw new Error(errorLines.join('\n')); + } + + astAndProgram.program.getTypeChecker(); // ensure parent pointers are set in source files + + return astAndProgram; +} + +/** + * Utility offered by parser to help consumers construct their own program instance. + * + * @param configFile the path to the tsconfig.json file, relative to `projectDirectory` + * @param projectDirectory the project directory to use as the CWD, defaults to `process.cwd()` + */ +function createProgramFromConfigFile( + configFile: string, + projectDirectory?: string, +): ts.Program { + if (ts.sys === undefined) { + throw new Error( + '`createProgramFromConfigFile` is only supported in a Node-like environment.', + ); + } + + const parsed = ts.getParsedCommandLineOfConfigFile( + configFile, + CORE_COMPILER_OPTIONS, + { + onUnRecoverableConfigFileDiagnostic: diag => { + throw new Error(formatDiagnostics([diag])); // ensures that `parsed` is defined. + }, + fileExists: fs.existsSync, + getCurrentDirectory: () => + (projectDirectory && path.resolve(projectDirectory)) || process.cwd(), + readDirectory: ts.sys.readDirectory, + readFile: file => fs.readFileSync(file, 'utf-8'), + useCaseSensitiveFileNames: ts.sys.useCaseSensitiveFileNames, + }, + ); + const result = parsed!; // parsed is not undefined, since we throw on failure. + if (result.errors.length) { + throw new Error(formatDiagnostics(result.errors)); + } + const host = ts.createCompilerHost(result.options, true); + return ts.createProgram(result.fileNames, result.options, host); +} + +function formatDiagnostics(diagnostics: ts.Diagnostic[]): string | undefined { + return ts.formatDiagnostics(diagnostics, { + getCanonicalFileName: f => f, + getCurrentDirectory: process.cwd, + getNewLine: () => '\n', + }); +} + +export { useProvidedPrograms, createProgramFromConfigFile }; diff --git a/packages/typescript-estree/src/index.ts b/packages/typescript-estree/src/index.ts index a619e48f679f..a922ef199cf7 100644 --- a/packages/typescript-estree/src/index.ts +++ b/packages/typescript-estree/src/index.ts @@ -1,11 +1,21 @@ -export * from './parser'; +export { + AST, + parse, + parseAndGenerateServices, + parseWithNodeMaps, + ParseAndGenerateServicesResult, + ParseWithNodeMapsResult, + clearProgramCache, +} from './parser'; export { ParserServices, TSESTreeOptions } from './parser-options'; export { simpleTraverse } from './simple-traverse'; export * from './ts-estree'; -export { clearCaches } from './create-program/createWatchProgram'; +export { clearWatchCaches as clearCaches } from './create-program/createWatchProgram'; +export { createProgramFromConfigFile as createProgram } from './create-program/useProvidedPrograms'; // 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 eb88660fdfa3..d8182aa5655e 100644 --- a/packages/typescript-estree/src/node-utils.ts +++ b/packages/typescript-estree/src/node-utils.ts @@ -13,73 +13,14 @@ const LOGICAL_OPERATORS: ( SyntaxKind.QuestionQuestionToken, ]; -interface TokenToText { - [SyntaxKind.OpenBraceToken]: '{'; - [SyntaxKind.CloseBraceToken]: '}'; - [SyntaxKind.OpenParenToken]: '('; - [SyntaxKind.CloseParenToken]: ')'; - [SyntaxKind.OpenBracketToken]: '['; - [SyntaxKind.CloseBracketToken]: ']'; - [SyntaxKind.DotToken]: '.'; - [SyntaxKind.DotDotDotToken]: '...'; - [SyntaxKind.SemicolonToken]: ';'; - [SyntaxKind.CommaToken]: ','; - [SyntaxKind.LessThanToken]: '<'; - [SyntaxKind.GreaterThanToken]: '>'; - [SyntaxKind.LessThanEqualsToken]: '<='; - [SyntaxKind.GreaterThanEqualsToken]: '>='; - [SyntaxKind.EqualsEqualsToken]: '=='; - [SyntaxKind.ExclamationEqualsToken]: '!='; - [SyntaxKind.EqualsEqualsEqualsToken]: '==='; - [SyntaxKind.InstanceOfKeyword]: 'instanceof'; - [SyntaxKind.ExclamationEqualsEqualsToken]: '!=='; - [SyntaxKind.EqualsGreaterThanToken]: '=>'; - [SyntaxKind.PlusToken]: '+'; - [SyntaxKind.MinusToken]: '-'; - [SyntaxKind.AsteriskToken]: '*'; - [SyntaxKind.AsteriskAsteriskToken]: '**'; - [SyntaxKind.SlashToken]: '/'; - [SyntaxKind.PercentToken]: '%'; - [SyntaxKind.PlusPlusToken]: '++'; - [SyntaxKind.MinusMinusToken]: '--'; - [SyntaxKind.LessThanLessThanToken]: '<<'; - [SyntaxKind.LessThanSlashToken]: '>'; - [SyntaxKind.GreaterThanGreaterThanGreaterThanToken]: '>>>'; - [SyntaxKind.AmpersandToken]: '&'; - [SyntaxKind.BarToken]: '|'; - [SyntaxKind.CaretToken]: '^'; - [SyntaxKind.ExclamationToken]: '!'; - [SyntaxKind.TildeToken]: '~'; - [SyntaxKind.AmpersandAmpersandToken]: '&&'; - [SyntaxKind.BarBarToken]: '||'; - [SyntaxKind.QuestionToken]: '?'; - [SyntaxKind.ColonToken]: ':'; - [SyntaxKind.EqualsToken]: '='; - [SyntaxKind.PlusEqualsToken]: '+='; - [SyntaxKind.MinusEqualsToken]: '-='; - [SyntaxKind.AsteriskEqualsToken]: '*='; - [SyntaxKind.AsteriskAsteriskEqualsToken]: '**='; - [SyntaxKind.SlashEqualsToken]: '/='; - [SyntaxKind.PercentEqualsToken]: '%='; - [SyntaxKind.LessThanLessThanEqualsToken]: '<<='; - [SyntaxKind.GreaterThanGreaterThanEqualsToken]: '>>='; - [SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken]: '>>>='; - [SyntaxKind.AmpersandEqualsToken]: '&='; - [SyntaxKind.AmpersandAmpersandEqualsToken]: '&&='; - [SyntaxKind.BarEqualsToken]: '|='; - [SyntaxKind.BarBarEqualsToken]: '||='; - [SyntaxKind.CaretEqualsToken]: '^='; - [SyntaxKind.QuestionQuestionEqualsToken]: '??='; - [SyntaxKind.AtToken]: '@'; +interface TokenToText extends TSESTree.PunctuatorTokenToText { + [SyntaxKind.ImportKeyword]: 'import'; [SyntaxKind.InKeyword]: 'in'; - [SyntaxKind.UniqueKeyword]: 'unique'; - [SyntaxKind.KeyOfKeyword]: 'keyof'; + [SyntaxKind.InstanceOfKeyword]: 'instanceof'; [SyntaxKind.NewKeyword]: 'new'; - [SyntaxKind.ImportKeyword]: 'import'; + [SyntaxKind.KeyOfKeyword]: 'keyof'; [SyntaxKind.ReadonlyKeyword]: 'readonly'; - [SyntaxKind.QuestionQuestionToken]: '??'; - [SyntaxKind.QuestionDotToken]: '?.'; + [SyntaxKind.UniqueKeyword]: 'unique'; } /** @@ -220,7 +161,7 @@ export function getBinaryExpressionType( export function getLineAndCharacterFor( pos: number, ast: ts.SourceFile, -): TSESTree.LineAndColumnData { +): TSESTree.Position { const loc = ast.getLineAndCharacterOfPosition(pos); return { line: loc.line + 1, @@ -253,7 +194,11 @@ export function getLocFor( * @returns returns true if node can contain directive */ export function canContainDirective( - node: ts.SourceFile | ts.Block | ts.ModuleBlock, + node: + | ts.SourceFile + | ts.Block + | ts.ModuleBlock + | ts.ClassStaticBlockDeclaration, ): boolean { if (node.kind === ts.SyntaxKind.Block) { switch (node.parent.kind) { @@ -518,7 +463,7 @@ export function getTokenType( if ( token.kind >= SyntaxKind.FirstPunctuation && - token.kind <= SyntaxKind.LastBinaryOperator + token.kind <= SyntaxKind.LastPunctuation ) { return AST_TOKEN_TYPES.Punctuator; } @@ -558,7 +503,7 @@ export function getTokenType( case SyntaxKind.GetKeyword: case SyntaxKind.SetKeyword: - // falls through + // intentional fallthrough default: } @@ -609,6 +554,8 @@ export function convertToken( }, }; } else { + // @ts-expect-error TS is complaining about `value` not being the correct + // type but it is return { type: tokenType, value, @@ -689,8 +636,7 @@ export function nodeHasTokens(n: ts.Node, ast: ts.SourceFile): boolean { // If we have a token or node that has a non-zero width, it must have tokens. // Note: getWidth() does not take trivia into account. return n.kind === SyntaxKind.EndOfFileToken - ? // eslint-disable-next-line @typescript-eslint/no-explicit-any - !!(n as any).jsDoc + ? !!(n as ts.JSDocContainer).jsDoc : n.getWidth(ast) !== 0; } diff --git a/packages/typescript-estree/src/parser-options.ts b/packages/typescript-estree/src/parser-options.ts index 36ca3f80cca3..fdd71cc55b55 100644 --- a/packages/typescript-estree/src/parser-options.ts +++ b/packages/typescript-estree/src/parser-options.ts @@ -1,7 +1,7 @@ import { DebugLevel } from '@typescript-eslint/types'; -import { Program } from 'typescript'; -import { TSESTree, TSNode, TSESTreeToTSNode, TSToken } from './ts-estree'; +import * as ts from 'typescript'; import { CanonicalPath } from './create-program/shared'; +import { TSESTree, TSESTreeToTSNode, TSNode, TSToken } from './ts-estree'; type DebugModule = 'typescript-eslint' | 'eslint' | 'typescript'; @@ -18,14 +18,16 @@ export interface Extra { filePath: string; jsx: boolean; loc: boolean; + singleRun: boolean; log: (message: string) => void; preserveNodeMaps?: boolean; + programs: null | Iterable; projects: CanonicalPath[]; range: boolean; strict: boolean; tokens: null | TSESTree.Token[]; tsconfigRootDir: string; - useJSXTextNode: boolean; + moduleResolver: string; } //////////////////////////////////////////////////// @@ -97,14 +99,6 @@ interface ParseOptions { * Set to true to create a top-level array containing all tokens from the file. */ tokens?: boolean; - - /* - * The JSX AST changed the node type for string literals - * inside a JSX Element from `Literal` to `JSXText`. - * When value is `true`, these nodes will be parsed as type `JSXText`. - * When value is `false`, these nodes will be parsed as type `Literal`. - */ - useJSXTextNode?: boolean; } interface ParseAndGenerateServicesOptions extends ParseOptions { @@ -169,6 +163,13 @@ interface ParseAndGenerateServicesOptions extends ParseOptions { */ tsconfigRootDir?: string; + /** + * An array of one or more instances of TypeScript Program objects to be used for type information. + * 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[]; + /** *************************************************************************************** * IT IS RECOMMENDED THAT YOU DO NOT USE THIS OPTION, AS IT CAUSES PERFORMANCE ISSUES. * @@ -179,6 +180,22 @@ interface ParseAndGenerateServicesOptions extends ParseOptions { * it will not error, but will instead parse the file and its dependencies in a new program. */ createDefaultProgram?: boolean; + + /** + * ESLint (and therefore typescript-eslint) is used in both "single run"/one-time contexts, + * such as an ESLint CLI invocation, and long-running sessions (such as continuous feedback + * on a file in an IDE). + * + * When typescript-eslint handles TypeScript Program management behind the scenes, this distinction + * is important because there is significant overhead to managing the so called Watch Programs + * needed for the long-running use-case. + * + * When allowAutomaticSingleRunInference is enabled, we will use common heuristics to infer + * whether or not ESLint is being used as part of a single run. + */ + allowAutomaticSingleRunInference?: boolean; + + moduleResolver?: string; } export type TSESTreeOptions = ParseAndGenerateServicesOptions; @@ -191,15 +208,26 @@ export interface ParserWeakMap { } export interface ParserWeakMapESTreeToTSNode< - TKey extends TSESTree.Node = TSESTree.Node + TKey extends TSESTree.Node = TSESTree.Node, > { get(key: TKeyBase): TSESTreeToTSNode; has(key: unknown): boolean; } export interface ParserServices { - program: Program; + program: ts.Program; 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)[]; +} diff --git a/packages/typescript-estree/src/parser.ts b/packages/typescript-estree/src/parser.ts index 300a73c6f1db..9a9dc04a771e 100644 --- a/packages/typescript-estree/src/parser.ts +++ b/packages/typescript-estree/src/parser.ts @@ -2,6 +2,7 @@ import debug from 'debug'; import { sync as globSync } from 'globby'; import isGlob from 'is-glob'; import semver from 'semver'; +import { normalize } from 'path'; import * as ts from 'typescript'; import { astConverter } from './ast-converter'; import { convertError } from './convert'; @@ -18,6 +19,10 @@ import { ensureAbsolutePath, getCanonicalFileName, } from './create-program/shared'; +import { + createProgramFromConfigFile, + useProvidedPrograms, +} from './create-program/useProvidedPrograms'; const log = debug('typescript-eslint:typescript-estree:parser'); @@ -25,12 +30,12 @@ const log = debug('typescript-eslint:typescript-estree:parser'); * This needs to be kept in sync with the top-level README.md in the * typescript-eslint monorepo */ -const SUPPORTED_TYPESCRIPT_VERSIONS = '>=3.3.1 <4.3.0'; +const SUPPORTED_TYPESCRIPT_VERSIONS = '>=3.3.1 <4.5.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[] = ['4.1.1-rc', '4.1.0-beta']; +const SUPPORTED_PRERELEASE_RANGES: string[] = ['4.4.0-beta', '4.4.1-rc']; const ACTIVE_TYPESCRIPT_VERSION = ts.version; const isRunningSupportedTypeScriptVersion = semver.satisfies( ACTIVE_TYPESCRIPT_VERSION, @@ -42,6 +47,16 @@ const isRunningSupportedTypeScriptVersion = semver.satisfies( let extra: Extra; let warnedAboutTSVersion = false; +/** + * Cache existing programs for the single run use-case. + * + * clearProgramCache() is only intended to be used in testing to ensure the parser is clean between tests. + */ +const existingPrograms = new Map(); +function clearProgramCache(): void { + existingPrograms.clear(); +} + function enforceString(code: unknown): string { /** * Ensure the source code is a string @@ -55,16 +70,19 @@ function enforceString(code: unknown): string { /** * @param code The code of the file being linted + * @param programInstances One or more (potentially lazily constructed) existing programs to use * @param shouldProvideParserServices True if the program should be attempted to be calculated from provided tsconfig files * @param shouldCreateDefaultProgram True if the program should be created from compiler host * @returns Returns a source file and program corresponding to the linted code */ function getProgramAndAST( code: string, + programInstances: Iterable | null, shouldProvideParserServices: boolean, shouldCreateDefaultProgram: boolean, ): ASTAndProgram { return ( + (programInstances && useProvidedPrograms(programInstances, extra)) || (shouldProvideParserServices && createProjectProgram(code, shouldCreateDefaultProgram, extra)) || (shouldProvideParserServices && @@ -105,12 +123,18 @@ function resetExtra(): void { loc: false, log: console.log, // eslint-disable-line no-console preserveNodeMaps: true, + programs: null, projects: [], range: false, strict: false, tokens: null, tsconfigRootDir: process.cwd(), - useJSXTextNode: false, + /** + * Unless we can reliably infer otherwise, we default to assuming that this run could be part + * of a long-running session (e.g. in an IDE) and watch programs will therefore be required + */ + singleRun: false, + moduleResolver: '', }; } @@ -226,17 +250,6 @@ function applyParserOptionsToExtra(options: TSESTreeOptions): void { extra.filePath = getFileName(extra); } - /** - * The JSX AST changed the node type for string literals - * inside a JSX Element from `Literal` to `JSXText`. - * - * When value is `true`, these nodes will be parsed as type `JSXText`. - * When value is `false`, these nodes will be parsed as type `Literal`. - */ - if (typeof options.useJSXTextNode === 'boolean' && options.useJSXTextNode) { - extra.useJSXTextNode = true; - } - /** * Allow the user to cause the parser to error if it encounters an unknown AST Node Type * (used in testing) @@ -264,22 +277,37 @@ function applyParserOptionsToExtra(options: TSESTreeOptions): void { // NOTE - ensureAbsolutePath relies upon having the correct tsconfigRootDir in extra extra.filePath = ensureAbsolutePath(extra.filePath, extra); - const projectFolderIgnoreList = ( - options.projectFolderIgnoreList ?? ['**/node_modules/**'] - ) - .reduce((acc, folder) => { - if (typeof folder === 'string') { - acc.push(folder); - } - return acc; - }, []) - // prefix with a ! for not match glob - .map(folder => (folder.startsWith('!') ? folder : `!${folder}`)); - // NOTE - prepareAndTransformProjects relies upon having the correct tsconfigRootDir in extra - extra.projects = prepareAndTransformProjects( - options.project, - projectFolderIgnoreList, - ); + if (Array.isArray(options.programs)) { + if (!options.programs.length) { + throw new Error( + `You have set parserOptions.programs to an empty array. This will cause all files to not be found in existing programs. Either provide one or more existing TypeScript Program instances in the array, or remove the parserOptions.programs setting.`, + ); + } + extra.programs = options.programs; + log( + 'parserOptions.programs was provided, so parserOptions.project will be ignored.', + ); + } + + if (!extra.programs) { + // providing a program overrides project resolution + const projectFolderIgnoreList = ( + options.projectFolderIgnoreList ?? ['**/node_modules/**'] + ) + .reduce((acc, folder) => { + if (typeof folder === 'string') { + acc.push(folder); + } + return acc; + }, []) + // prefix with a ! for not match glob + .map(folder => (folder.startsWith('!') ? folder : `!${folder}`)); + // NOTE - prepareAndTransformProjects relies upon having the correct tsconfigRootDir in extra + extra.projects = prepareAndTransformProjects( + options.project, + projectFolderIgnoreList, + ); + } if ( Array.isArray(options.extraFileExtensions) && @@ -303,11 +331,16 @@ function applyParserOptionsToExtra(options: TSESTreeOptions): void { extra.EXPERIMENTAL_useSourceOfProjectReferenceRedirect = typeof options.EXPERIMENTAL_useSourceOfProjectReferenceRedirect === 'boolean' && options.EXPERIMENTAL_useSourceOfProjectReferenceRedirect; + + if (typeof options.moduleResolver === 'string') { + extra.moduleResolver = options.moduleResolver; + } } function warnAboutTSVersion(): void { if (!isRunningSupportedTypeScriptVersion && !warnedAboutTSVersion) { - const isTTY = typeof process === undefined ? false : process.stdout?.isTTY; + const isTTY = + typeof process === 'undefined' ? false : process.stdout?.isTTY; if (isTTY) { const border = '============='; const versionWarning = [ @@ -325,6 +358,47 @@ function warnAboutTSVersion(): void { } } +/** + * ESLint (and therefore typescript-eslint) is used in both "single run"/one-time contexts, + * such as an ESLint CLI invocation, and long-running sessions (such as continuous feedback + * on a file in an IDE). + * + * When typescript-eslint handles TypeScript Program management behind the scenes, this distinction + * is important because there is significant overhead to managing the so called Watch Programs + * needed for the long-running use-case. We therefore use the following logic to figure out which + * of these contexts applies to the current execution. + */ +function inferSingleRun(options: TSESTreeOptions | undefined): void { + // Allow users to explicitly inform us of their intent to perform a single run (or not) with TSESTREE_SINGLE_RUN + if (process.env.TSESTREE_SINGLE_RUN === 'false') { + extra.singleRun = false; + return; + } + if (process.env.TSESTREE_SINGLE_RUN === 'true') { + extra.singleRun = true; + return; + } + + // Currently behind a flag while we gather real-world feedback + if (options?.allowAutomaticSingleRunInference) { + if ( + // Default to single runs for CI processes. CI=true is set by most CI providers by default. + process.env.CI === 'true' || + // This will be true for invocations such as `npx eslint ...` and `./node_modules/.bin/eslint ...` + process.argv[1].endsWith(normalize('node_modules/.bin/eslint')) + ) { + extra.singleRun = true; + return; + } + } + + /** + * We default to assuming that this run could be part of a long-running session (e.g. in an IDE) + * and watch programs will therefore be required + */ + extra.singleRun = false; +} + // eslint-disable-next-line @typescript-eslint/no-empty-interface interface EmptyObject {} type AST = TSESTree.Program & @@ -386,6 +460,11 @@ function parseWithNodeMapsInternal( */ warnAboutTSVersion(); + /** + * Figure out whether this is a single run or part of a long-running process + */ + inferSingleRun(options); + /** * Create a ts.SourceFile directly, no ts.Program is needed for a simple * parse @@ -411,6 +490,12 @@ function parseWithNodeMaps( 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 { + parseAndGenerateServicesCalls = {}; +} + function parseAndGenerateServices( code: string, options: T, @@ -446,16 +531,76 @@ function parseAndGenerateServices( warnAboutTSVersion(); /** - * Generate a full ts.Program in order to be able to provide parser - * services, such as type-checking + * Figure out whether this is a single run or part of a long-running process + */ + inferSingleRun(options); + + /** + * 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, + * create an Iterable which will lazily create the programs as needed by the iteration logic + */ + if (extra.singleRun && !extra.programs && extra.projects?.length > 0) { + extra.programs = { + *[Symbol.iterator](): Iterator { + for (const configFile of extra.projects) { + const existingProgram = existingPrograms.get(configFile); + if (existingProgram) { + yield existingProgram; + } else { + log( + 'Detected single-run/CLI usage, creating Program once ahead of time for project: %s', + configFile, + ); + const newProgram = createProgramFromConfigFile(configFile); + existingPrograms.set(configFile, newProgram); + yield newProgram; + } + } + }, + }; + } + + /** + * Generate a full ts.Program or offer provided instances in order to be able to provide parser services, such as type-checking */ const shouldProvideParserServices = - extra.projects && extra.projects.length > 0; - const { ast, program } = getProgramAndAST( - code, - shouldProvideParserServices, - extra.createDefaultProgram, - )!; + extra.programs != null || (extra.projects && extra.projects.length > 0); + + /** + * 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 + * 10 times in order to apply all possible fixes for the file). + * + * In this scenario we cannot rely upon the singleRun AOT compiled programs because the SourceFiles will not contain the source + * with the latest fixes applied. Therefore we fallback to creating the quickest possible isolated program from the updated source. + */ + let ast: ts.SourceFile; + let program: ts.Program; + + if (extra.singleRun && options.filePath) { + parseAndGenerateServicesCalls[options.filePath] = + (parseAndGenerateServicesCalls[options.filePath] || 0) + 1; + } + + if ( + extra.singleRun && + options.filePath && + parseAndGenerateServicesCalls[options.filePath] > 1 + ) { + const isolatedAstAndProgram = createIsolatedProgram(code, extra); + ast = isolatedAstAndProgram.ast; + program = isolatedAstAndProgram.program; + } else { + const astAndProgram = getProgramAndAST( + code, + extra.programs, + shouldProvideParserServices, + extra.createDefaultProgram, + )!; + ast = astAndProgram.ast; + program = astAndProgram.program; + } /** * Convert the TypeScript AST to an ESTree-compatible one, and optionally preserve @@ -497,4 +642,6 @@ export { 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 023d7e3faf8f..af6f33918df1 100644 --- a/packages/typescript-estree/src/semantic-or-syntactic-errors.ts +++ b/packages/typescript-estree/src/semantic-or-syntactic-errors.ts @@ -1,6 +1,12 @@ -import * as ts from 'typescript'; +import type { + Diagnostic, + DiagnosticWithLocation, + Program, + SourceFile, +} from 'typescript'; +import { flattenDiagnosticMessageText, sys } from 'typescript'; -interface SemanticOrSyntacticError extends ts.Diagnostic { +export interface SemanticOrSyntacticError extends Diagnostic { message: string; } @@ -12,8 +18,8 @@ interface SemanticOrSyntacticError extends ts.Diagnostic { * the user opts in to throwing errors on semantic issues. */ export function getFirstSemanticOrSyntacticError( - program: ts.Program, - ast: ts.SourceFile, + program: Program, + ast: SourceFile, ): SemanticOrSyntacticError | undefined { try { const supportedSyntacticDiagnostics = whitelistSupportedDiagnostics( @@ -45,15 +51,15 @@ export function getFirstSemanticOrSyntacticError( * and log a a warning. */ /* istanbul ignore next */ - console.warn(`Warning From TSC: "${e.message}`); // eslint-disable-line no-console + console.warn(`Warning From TSC: "${(e as Error).message}`); // eslint-disable-line no-console /* istanbul ignore next */ return undefined; } } function whitelistSupportedDiagnostics( - diagnostics: readonly (ts.DiagnosticWithLocation | ts.Diagnostic)[], -): readonly (ts.DiagnosticWithLocation | ts.Diagnostic)[] { + diagnostics: readonly (DiagnosticWithLocation | Diagnostic)[], +): readonly (DiagnosticWithLocation | Diagnostic)[] { return diagnostics.filter(diagnostic => { switch (diagnostic.code) { case 1013: // "A rest parameter or binding pattern may not have a trailing comma." @@ -103,13 +109,10 @@ function whitelistSupportedDiagnostics( } function convertDiagnosticToSemanticOrSyntacticError( - diagnostic: ts.Diagnostic, + diagnostic: Diagnostic, ): SemanticOrSyntacticError { return { ...diagnostic, - message: ts.flattenDiagnosticMessageText( - diagnostic.messageText, - ts.sys.newLine, - ), + message: flattenDiagnosticMessageText(diagnostic.messageText, sys.newLine), }; } diff --git a/packages/typescript-estree/src/simple-traverse.ts b/packages/typescript-estree/src/simple-traverse.ts index 4d4ddaa5f187..f513e54b14f1 100644 --- a/packages/typescript-estree/src/simple-traverse.ts +++ b/packages/typescript-estree/src/simple-traverse.ts @@ -3,6 +3,7 @@ import { 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'; } 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 92ef8c42e604..586aea269eea 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 @@ -28,7 +28,7 @@ export interface EstreeToTsNodeTypes { [AST_NODE_TYPES.ClassBody]: ts.ClassDeclaration | ts.ClassExpression; [AST_NODE_TYPES.ClassDeclaration]: ts.ClassDeclaration; [AST_NODE_TYPES.ClassExpression]: ts.ClassExpression; - [AST_NODE_TYPES.ClassProperty]: ts.PropertyDeclaration; + [AST_NODE_TYPES.PropertyDefinition]: ts.PropertyDeclaration; [AST_NODE_TYPES.ConditionalExpression]: ts.ConditionalExpression; [AST_NODE_TYPES.ContinueStatement]: ts.ContinueStatement; [AST_NODE_TYPES.DebuggerStatement]: ts.DebuggerStatement; @@ -72,6 +72,7 @@ export interface EstreeToTsNodeTypes { | ts.Identifier | ts.ConstructorDeclaration | ts.Token; + [AST_NODE_TYPES.PrivateIdentifier]: ts.PrivateIdentifier; [AST_NODE_TYPES.IfStatement]: ts.IfStatement; [AST_NODE_TYPES.ImportDeclaration]: ts.ImportDeclaration; [AST_NODE_TYPES.ImportDefaultSpecifier]: ts.ImportClause; @@ -100,7 +101,6 @@ export interface EstreeToTsNodeTypes { | ts.StringLiteral | ts.NumericLiteral | ts.RegularExpressionLiteral - | ts.JsxText | ts.NullLiteral | ts.BooleanLiteral | ts.BigIntLiteral; @@ -135,6 +135,7 @@ export interface EstreeToTsNodeTypes { [AST_NODE_TYPES.ReturnStatement]: ts.ReturnStatement; [AST_NODE_TYPES.SequenceExpression]: ts.BinaryExpression; [AST_NODE_TYPES.SpreadElement]: ts.SpreadElement | ts.SpreadAssignment; + [AST_NODE_TYPES.StaticBlock]: ts.ClassStaticBlockDeclaration; [AST_NODE_TYPES.Super]: ts.SuperExpression; [AST_NODE_TYPES.SwitchCase]: ts.CaseClause | ts.DefaultClause; [AST_NODE_TYPES.SwitchStatement]: ts.SwitchStatement; @@ -150,7 +151,7 @@ export interface EstreeToTsNodeTypes { [AST_NODE_TYPES.ThisExpression]: ts.ThisExpression | ts.KeywordTypeNode; [AST_NODE_TYPES.ThrowStatement]: ts.ThrowStatement; [AST_NODE_TYPES.TryStatement]: ts.TryStatement; - [AST_NODE_TYPES.TSAbstractClassProperty]: ts.PropertyDeclaration; + [AST_NODE_TYPES.TSAbstractPropertyDefinition]: ts.PropertyDeclaration; [AST_NODE_TYPES.TSAbstractMethodDefinition]: | ts.GetAccessorDeclaration | ts.SetAccessorDeclaration @@ -180,7 +181,10 @@ export interface EstreeToTsNodeTypes { [AST_NODE_TYPES.TSIntersectionType]: ts.IntersectionTypeNode; [AST_NODE_TYPES.TSLiteralType]: ts.LiteralTypeNode; [AST_NODE_TYPES.TSMappedType]: ts.MappedTypeNode; - [AST_NODE_TYPES.TSMethodSignature]: ts.MethodSignature; + [AST_NODE_TYPES.TSMethodSignature]: + | ts.MethodSignature + | ts.GetAccessorDeclaration + | ts.SetAccessorDeclaration; [AST_NODE_TYPES.TSModuleBlock]: ts.ModuleBlock; [AST_NODE_TYPES.TSModuleDeclaration]: ts.ModuleDeclaration; [AST_NODE_TYPES.TSNamedTupleMember]: ts.NamedTupleMember; @@ -188,7 +192,6 @@ export interface EstreeToTsNodeTypes { [AST_NODE_TYPES.TSNonNullExpression]: ts.NonNullExpression; [AST_NODE_TYPES.TSOptionalType]: ts.OptionalTypeNode; [AST_NODE_TYPES.TSParameterProperty]: ts.ParameterDeclaration; - [AST_NODE_TYPES.TSParenthesizedType]: ts.ParenthesizedTypeNode; [AST_NODE_TYPES.TSPropertySignature]: ts.PropertySignature; [AST_NODE_TYPES.TSQualifiedName]: ts.QualifiedName; [AST_NODE_TYPES.TSRestType]: diff --git a/packages/typescript-estree/src/ts-estree/ts-nodes.ts b/packages/typescript-estree/src/ts-estree/ts-nodes.ts index 80a7b34e0c8b..79756053e087 100644 --- a/packages/typescript-estree/src/ts-estree/ts-nodes.ts +++ b/packages/typescript-estree/src/ts-estree/ts-nodes.ts @@ -6,6 +6,8 @@ declare module 'typescript' { /* eslint-disable @typescript-eslint/no-empty-interface */ export interface NamedTupleMember extends ts.Node {} export interface TemplateLiteralTypeNode extends ts.Node {} + export interface PrivateIdentifier extends ts.Node {} + export interface ClassStaticBlockDeclaration extends ts.Node {} /* eslint-enable @typescript-eslint/no-empty-interface */ } @@ -14,6 +16,7 @@ export type TSToken = ts.Token; export type TSNode = | ts.Modifier | ts.Identifier + | ts.PrivateIdentifier | ts.QualifiedName | ts.ComputedPropertyName | ts.Decorator @@ -43,6 +46,7 @@ export type TSNode = | ts.KeywordTypeNode // TODO: This node is bad, maybe we should report this | ts.ImportTypeNode | ts.ThisTypeNode + | ts.ClassStaticBlockDeclaration // | ts.FunctionOrConstructorTypeNodeBase -> FunctionTypeNode, ConstructorTypeNode | ts.ConstructorTypeNode | ts.FunctionTypeNode diff --git a/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts b/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts index 4acae2c6a5bd..3f4246b037cc 100644 --- a/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts +++ b/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts @@ -181,6 +181,12 @@ tester.addFixturePatternConfig('javascript/classes', { * TS3.6 made computed constructors parse as actual constructors. */ 'class-two-methods-computed-constructor', + /** + * Babel emits a `PrivateName` instead of `PrivateIdentifier` + */ + 'class-private-identifier-accessor', + 'class-private-identifier-method', + 'class-private-identifier-field', ], }); @@ -386,6 +392,23 @@ tester.addFixturePatternConfig('typescript/basics', { * This is intentional; babel is not checking types */ 'catch-clause-with-invalid-annotation', + /** + * [BABEL ERRORED, BUT TS-ESTREE DID NOT] + * TODO: enforce that accessibility is not allowed on a private identifier + */ + 'class-private-identifier-field-with-accessibility-error', + /** + * Babel emits a `PrivateName` instead of `PrivateIdentifier` + */ + 'class-private-identifier-field-with-annotation', + /** + * [TS-ESTREE ERRORED, BUT BABEL DID NOT] + * TypeScript 4.4 new feature + * @see https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-4.html#abstract-properties-do-not-allow-initializers + */ + 'abstract-class-with-abstract-readonly-property', + 'abstract-class-with-abstract-properties', + 'abstract-class-with-override-property', ], ignoreSourceType: [ /** @@ -395,6 +418,8 @@ tester.addFixturePatternConfig('typescript/basics', { 'export-assignment', 'import-equal-declaration', 'import-export-equal-declaration', + 'import-equal-type-declaration', + 'import-export-equal-type-declaration', // babel treats declare and types as not a module 'export-declare-const-named-enum', 'export-declare-named-enum', diff --git a/packages/typescript-estree/tests/ast-alignment/parse.ts b/packages/typescript-estree/tests/ast-alignment/parse.ts index 46bef153a0f1..3429f338d77b 100644 --- a/packages/typescript-estree/tests/ast-alignment/parse.ts +++ b/packages/typescript-estree/tests/ast-alignment/parse.ts @@ -1,9 +1,11 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ - +/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access */ import type babelParser from '@babel/parser'; -import { ParserPlugin } from '@babel/parser'; +import type { ParserPlugin } from '@babel/parser'; import { codeFrameColumns } from '@babel/code-frame'; -import * as parser from '../../src/parser'; +import type { File } from '@babel/types'; +import type { TSESTree } from '@typescript-eslint/types'; +import { AST, parseAndGenerateServices } from '../../src/parser'; +import type { TSError } from '../../src/node-utils'; function createError( message: string, @@ -19,12 +21,18 @@ function createError( return error; } -function parseWithBabelParser(text: string, jsx = true): any { - const babel: typeof babelParser = require('@babel/parser'); +function parseWithBabelParser(text: string, jsx = true): File { + const babel = require('@babel/parser') as typeof babelParser; const plugins: ParserPlugin[] = [ - 'classProperties', + [ + 'estree', + { + // @ts-expect-error -- this isn't exposed in the types yet + classFeatures: true, + }, + ], 'decorators-legacy', - 'estree', + 'classStaticBlock', 'typescript', ]; if (jsx) { @@ -40,14 +48,13 @@ function parseWithBabelParser(text: string, jsx = true): any { }); } -function parseWithTypeScriptESTree(text: string, jsx = true): parser.AST { +function parseWithTypeScriptESTree(text: string, jsx = true): AST { try { - const result = parser.parseAndGenerateServices(text, { + const result = parseAndGenerateServices(text, { loc: true, range: true, tokens: false, comment: false, - useJSXTextNode: true, errorOnUnknownASTType: true, /** * Babel will always throw on these types of issues, so we enable @@ -59,8 +66,10 @@ function parseWithTypeScriptESTree(text: string, jsx = true): parser.AST { jsx, }); return result.ast; - } catch (e) { - throw createError(e.message, e.lineNumber, e.column); + } catch (e: unknown) { + const error = e as TSError; + + throw createError(error.message, error.lineNumber, error.column); } } @@ -95,8 +104,8 @@ export function parse( 'Please provide a valid parser: either "typescript-estree" or "@babel/parser"', ); } - } catch (error) { - const loc = error.loc; + } catch (error: any) { + const loc = error.loc as TSESTree.Position | undefined; if (loc) { error.codeFrame = codeFrameColumns( text, @@ -112,6 +121,7 @@ export function parse( ); error.message += `\n${error.codeFrame}`; } + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment result.parseError = error; } diff --git a/packages/typescript-estree/tests/ast-alignment/spec.ts b/packages/typescript-estree/tests/ast-alignment/spec.ts index 9e308b73c643..57ab33710bee 100644 --- a/packages/typescript-estree/tests/ast-alignment/spec.ts +++ b/packages/typescript-estree/tests/ast-alignment/spec.ts @@ -1,7 +1,12 @@ import fs from 'fs'; +import type { File } from '@babel/types'; import { fixturesToTest } from './fixtures-to-test'; import { parse } from './parse'; -import * as parseUtils from './utils'; +import { + preprocessBabylonAST, + preprocessTypescriptAST, + removeLocationDataAndSourceTypeFromProgramNode, +} from './utils'; fixturesToTest.forEach(fixture => { const filename = fixture.filename; @@ -43,7 +48,7 @@ fixturesToTest.forEach(fixture => { * E.g. Both must be a SyntaxError, or both must be a RangeError etc. */ it(`[Both parsers error as expected] - ${filename}`, () => { - expect(babelParserResult.parseError.name).toEqual( + expect(babelParserResult.parseError.name).toBe( typeScriptESTreeResult.parseError.name, ); }); @@ -72,13 +77,13 @@ fixturesToTest.forEach(fixture => { * Perform some extra formatting steps on the babel AST before comparing */ expect( - parseUtils.removeLocationDataAndSourceTypeFromProgramNode( - parseUtils.preprocessBabylonAST(babelParserResult.ast), + removeLocationDataAndSourceTypeFromProgramNode( + preprocessBabylonAST(babelParserResult.ast as File), fixture.ignoreSourceType, ), ).toEqual( - parseUtils.removeLocationDataAndSourceTypeFromProgramNode( - parseUtils.preprocessTypescriptAST(typeScriptESTreeResult.ast), + removeLocationDataAndSourceTypeFromProgramNode( + preprocessTypescriptAST(typeScriptESTreeResult.ast), fixture.ignoreSourceType, ), ); diff --git a/packages/typescript-estree/tests/ast-alignment/utils.ts b/packages/typescript-estree/tests/ast-alignment/utils.ts index a2c1d6f87f93..7066686303c3 100644 --- a/packages/typescript-estree/tests/ast-alignment/utils.ts +++ b/packages/typescript-estree/tests/ast-alignment/utils.ts @@ -1,8 +1,8 @@ // babel types are something we don't really care about -/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/restrict-plus-operands */ +import type { File, Program } from '@babel/types'; import { AST_NODE_TYPES, TSESTree } from '../../src/ts-estree'; import { deeplyCopy, omitDeep } from '../../tools/test-utils'; -import * as BabelTypes from '@babel/types'; /** * Common predicates for Babylon AST preprocessing @@ -18,8 +18,8 @@ const ifNumber = (val: unknown): boolean => typeof val === 'number'; * @param ast raw babylon AST * @returns processed babylon AST */ -export function preprocessBabylonAST(ast: BabelTypes.File): any { - return omitDeep( +export function preprocessBabylonAST(ast: File): any { + return omitDeep( ast.program, [ { @@ -151,11 +151,6 @@ export function preprocessBabylonAST(ast: BabelTypes.File): any { }; } }, - TSTypePredicate(node) { - if (!node.typeAnnotation) { - node.typeAnnotation = null; - } - }, MethodDefinition(node) { /** * Babel: MethodDefinition + abstract: true @@ -165,15 +160,25 @@ export function preprocessBabylonAST(ast: BabelTypes.File): any { node.type = AST_NODE_TYPES.TSAbstractMethodDefinition; delete node.abstract; } + /** + * TS 4.3: overrides on class members + * Babel doesn't ever emit a false override flag + */ + if (node.override == null) { + node.override = false; + } }, - ClassProperty(node) { + PropertyDefinition(node) { + // babel does not + // node.type = AST_NODE_TYPES.PropertyDefinition; /** * Babel: ClassProperty + abstract: true * ts-estree: TSAbstractClassProperty */ if (node.abstract) { - node.type = AST_NODE_TYPES.TSAbstractClassProperty; + node.type = AST_NODE_TYPES.TSAbstractPropertyDefinition; delete node.abstract; + node.value = null; } /** * TS 3.7: declare class properties @@ -183,6 +188,13 @@ export function preprocessBabylonAST(ast: BabelTypes.File): any { if (!node.declare) { node.declare = false; } + /** + * TS 4.3: overrides on class members + * Babel doesn't ever emit a false override flag + */ + if (node.override == null) { + node.override = false; + } }, TSExpressionWithTypeArguments(node, parent: any) { if (parent.type === AST_NODE_TYPES.TSInterfaceDeclaration) { @@ -225,7 +237,7 @@ export function preprocessBabylonAST(ast: BabelTypes.File): any { /** * Template strings seem to also be affected by the difference in opinion between different parsers in * @see https://github.com/babel/babel/issues/6681 - * @see https://github.com/babel/babel-eslint/blob/master/lib/babylon-to-espree/convertAST.js#L81-L96 + * @see https://github.com/babel/babel/blob/main/eslint/babel-eslint-parser/src/convert/convertAST.js#L64-L80 */ TemplateLiteral(node: any) { for (let j = 0; j < node.quasis.length; j++) { @@ -241,6 +253,16 @@ export function preprocessBabylonAST(ast: BabelTypes.File): any { } } }, + /** + * Remove TSParenthesizedType from babel AST. Babel 8 will stop generating the TSParenthesizedType. + * Once we use babel 8, this can be removed. + * @see https://github.com/babel/babel/pull/12608 + */ + TSParenthesizedType(node) { + const { typeAnnotation } = node; + Object.keys(node).forEach(key => delete node[key]); + Object.assign(node, typeAnnotation); + }, }, ); } diff --git a/packages/typescript-estree/tests/ast-fixtures.test.ts b/packages/typescript-estree/tests/ast-fixtures.test.ts index 613595e4f8aa..f3ffbabd8098 100644 --- a/packages/typescript-estree/tests/ast-fixtures.test.ts +++ b/packages/typescript-estree/tests/ast-fixtures.test.ts @@ -58,7 +58,10 @@ function nestDescribe( try { makeDir.sync(fixture.snapshotPath); - } catch (e) { + } catch ( + // eslint-disable-next-line @typescript-eslint/no-explicit-any + e: any + ) { if ('code' in e && e.code === 'EEXIST') { // already exists - ignored } else { diff --git a/packages/typescript-estree/tests/fixtures/moduleResolver/file.ts b/packages/typescript-estree/tests/fixtures/moduleResolver/file.ts new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/typescript-estree/tests/fixtures/moduleResolver/moduleResolver.js b/packages/typescript-estree/tests/fixtures/moduleResolver/moduleResolver.js new file mode 100644 index 000000000000..112df1b4b5f2 --- /dev/null +++ b/packages/typescript-estree/tests/fixtures/moduleResolver/moduleResolver.js @@ -0,0 +1,36 @@ +const ts = require('typescript'); + +module.exports = { + version: 1, + resolveModuleNames: ( + moduleNames, + containingFile, + _reusedNames, + _redirectedReferences, + compilerOptions, + ) => { + const resolvedModules = []; + + for (const moduleName of moduleNames) { + let parsedModuleName = moduleName; + + if (parsedModuleName === '__PLACEHOLDER__') { + parsedModuleName = './something'; + } + + const resolution = ts.resolveModuleName( + parsedModuleName, + containingFile, + compilerOptions, + { + fileExists: ts.sys.fileExists, + readFile: ts.sys.readFile, + }, + ); + + resolvedModules.push(resolution.resolvedModule); + } + + return resolvedModules; + } +} diff --git a/packages/typescript-estree/tests/fixtures/moduleResolver/something.ts b/packages/typescript-estree/tests/fixtures/moduleResolver/something.ts new file mode 100644 index 000000000000..c069798b6c26 --- /dev/null +++ b/packages/typescript-estree/tests/fixtures/moduleResolver/something.ts @@ -0,0 +1 @@ +export const something = () => true; diff --git a/packages/typescript-estree/tests/fixtures/moduleResolver/tsconfig.defaultProgram.json b/packages/typescript-estree/tests/fixtures/moduleResolver/tsconfig.defaultProgram.json new file mode 100644 index 000000000000..8de5ab303982 --- /dev/null +++ b/packages/typescript-estree/tests/fixtures/moduleResolver/tsconfig.defaultProgram.json @@ -0,0 +1,3 @@ +{ + "include": [] +} diff --git a/packages/typescript-estree/tests/fixtures/moduleResolver/tsconfig.json b/packages/typescript-estree/tests/fixtures/moduleResolver/tsconfig.json new file mode 100644 index 000000000000..e7f769a18418 --- /dev/null +++ b/packages/typescript-estree/tests/fixtures/moduleResolver/tsconfig.json @@ -0,0 +1,3 @@ +{ + "include": ["./file.ts", "./something.ts"] +} 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 7da28080eb36..ef7abcee4f4a 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/convert.test.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/convert.test.ts.snap @@ -22,7 +22,6 @@ Object { 12, 12, ], - "transformFlags": 0, "type": "TSEndOfFileToken", }, "externalModuleIndicator": undefined, @@ -170,7 +169,6 @@ Object { }, ], "text": "new foo()", - "transformFlags": 9, "type": "TSSourceFile", "typeReferenceDirectives": Array [], } @@ -210,7 +208,6 @@ Object { 5, 8, ], - "transformFlags": 0, "type": "TSUnparsedPrologue", }, "nextContainer": undefined, @@ -219,7 +216,6 @@ Object { 35, ], "symbol": undefined, - "transformFlags": 1, "type": "TSUnparsedPrologue", "typeAnnotation": null, "typeParameters": null, @@ -322,7 +318,6 @@ Object { 18, ], "symbol": undefined, - "transformFlags": 2305, "type": "TSClassDeclaration", "typeParameters": null, } @@ -363,7 +358,6 @@ Object { 0, 12, ], - "transformFlags": 9, "type": "TSNewExpression", "typeParameters": Object { "loc": Object { @@ -464,7 +458,6 @@ Object { 15, ], "symbol": undefined, - "transformFlags": 257, "type": "TSClassDeclaration", "typeParameters": Object { "loc": Object { diff --git a/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.test.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.test.ts.snap index eb7e5c687e68..f238afc849e7 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.test.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.test.ts.snap @@ -273,6 +273,12 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/class-one-method-super.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/class-private-identifier-accessor.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/class-private-identifier-field.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/class-private-identifier-method.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/class-static-method.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/class-static-method-named-prototype.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; @@ -908,6 +914,15 @@ TSError { } `; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-export-module-specifier.src 1`] = ` +TSError { + "column": 19, + "index": 19, + "lineNumber": 1, + "message": "Module specifier must be a string literal.", +} +`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-export-named-default.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-export-named-extra-comma.src 1`] = ` @@ -966,10 +981,10 @@ TSError { exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-import-default-module-specifier.src 1`] = ` TSError { - "column": 16, - "index": 16, + "column": 15, + "index": 15, "lineNumber": 1, - "message": "String literal expected.", + "message": "Module specifier must be a string literal.", } `; @@ -984,10 +999,10 @@ TSError { exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-import-module-specifier.src 1`] = ` TSError { - "column": 18, - "index": 18, + "column": 17, + "index": 17, "lineNumber": 1, - "message": "String literal expected.", + "message": "Module specifier must be a string literal.", } `; @@ -1408,8 +1423,8 @@ TSError { exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-mismatched-closing-tag.src 1`] = ` TSError { - "column": 3, - "index": 3, + "column": 5, + "index": 5, "lineNumber": 1, "message": "Expected corresponding JSX closing tag for 'a'.", } @@ -1426,8 +1441,8 @@ TSError { exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-mismatched-dot-tag-name.src 1`] = ` TSError { - "column": 7, - "index": 7, + "column": 9, + "index": 9, "lineNumber": 1, "message": "Expected corresponding JSX closing tag for 'a.b.c'.", } @@ -1435,8 +1450,8 @@ TSError { exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-mismatched-namespace-tag.src 1`] = ` TSError { - "column": 5, - "index": 5, + "column": 7, + "index": 7, "lineNumber": 1, "message": "Expected corresponding JSX closing tag for 'a:b'.", } @@ -1679,6 +1694,10 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/abstract-class-with-optional-method.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/abstract-class-with-override-method.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/abstract-class-with-override-property.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/abstract-interface.src 1`] = ` TSError { "column": 7, @@ -1738,10 +1757,22 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-multi-line-keyword-declare.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-private-identifier-field-with-accessibility-error.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-private-identifier-field-with-annotation.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-private-identifier-readonly-field.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-static-blocks.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-accessibility-modifiers.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-constructor-and-modifier.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-constructor-and-parameter-property-with-modifiers.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-constructor-and-parameter-proptery-with-override-modifier.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-constructor-and-return-type.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-constructor-and-type-parameters.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; @@ -1800,6 +1831,12 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-optional-property-undefined.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-override-method.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-override-property.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-private-optional-property.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-private-parameter-properties.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-property-function.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; @@ -1929,8 +1966,12 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/import-equal-declaration.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/import-equal-type-declaration.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/import-export-equal-declaration.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/import-export-equal-type-declaration.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/import-type-default.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/import-type-empty.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; @@ -2635,6 +2676,8 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/indexed.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/interface-with-accessors.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/intersection-type.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/literal-number.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; @@ -2657,6 +2700,8 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/nested-types.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/object-literal-type-with-accessors.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/parenthesized-type.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/reference.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; diff --git a/packages/typescript-estree/tests/lib/__snapshots__/semanticInfo.test.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/semanticInfo.test.ts.snap index c826bde0fbaa..ce899d6636cb 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/semanticInfo.test.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/semanticInfo.test.ts.snap @@ -1286,12 +1286,13 @@ Object { "line": 4, }, }, + "override": false, "range": Array [ 39, 56, ], "static": false, - "type": "ClassProperty", + "type": "PropertyDefinition", "typeAnnotation": Object { "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/lib/convert.test.ts b/packages/typescript-estree/tests/lib/convert.test.ts index 52bd377a5bfe..ad60019b2004 100644 --- a/packages/typescript-estree/tests/lib/convert.test.ts +++ b/packages/typescript-estree/tests/lib/convert.test.ts @@ -1,7 +1,8 @@ // deeplyCopy is private internal /* eslint-disable @typescript-eslint/no-explicit-any */ -import { Converter } from '../../src/convert'; import * as ts from 'typescript'; +import type { TSNode } from '../../src'; +import { Converter } from '../../src/convert'; describe('convert', () => { function convertCode(code: string): ts.SourceFile { @@ -19,8 +20,7 @@ describe('convert', () => { function fakeUnknownKind(node: ts.Node): void { ts.forEachChild(node, fakeUnknownKind); - // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- intentionally writing to a readonly field - // @ts-expect-error + // @ts-expect-error -- intentionally writing to a readonly field node.kind = ts.SyntaxKind.UnparsedPrologue; } @@ -28,7 +28,6 @@ describe('convert', () => { const instance = new Converter(ast, { errorOnUnknownASTType: false, - useJSXTextNode: false, shouldPreserveNodeMaps: false, }); expect(instance.convertProgram()).toMatchSnapshot(); @@ -39,7 +38,6 @@ describe('convert', () => { const instance = new Converter(ast, { errorOnUnknownASTType: false, - useJSXTextNode: false, shouldPreserveNodeMaps: false, }) as any; @@ -51,7 +49,6 @@ describe('convert', () => { const instance = new Converter(ast, { errorOnUnknownASTType: false, - useJSXTextNode: false, shouldPreserveNodeMaps: false, }) as any; @@ -63,7 +60,6 @@ describe('convert', () => { const instance = new Converter(ast, { errorOnUnknownASTType: false, - useJSXTextNode: false, shouldPreserveNodeMaps: false, }) as any; @@ -77,7 +73,6 @@ describe('convert', () => { const instance = new Converter(ast, { errorOnUnknownASTType: false, - useJSXTextNode: false, shouldPreserveNodeMaps: false, }) as any; expect(instance.deeplyCopy(ast)).toMatchSnapshot(); @@ -88,7 +83,6 @@ describe('convert', () => { const instance = new Converter(ast, { errorOnUnknownASTType: true, - useJSXTextNode: false, shouldPreserveNodeMaps: false, }) as any; @@ -107,7 +101,6 @@ describe('convert', () => { const instance = new Converter(ast, { errorOnUnknownASTType: false, - useJSXTextNode: false, shouldPreserveNodeMaps: true, }); instance.convertProgram(); @@ -122,7 +115,7 @@ describe('convert', () => { ) { expect(node).toBe( maps.esTreeNodeToTSNodeMap.get( - maps.tsNodeToESTreeNodeMap.get(node as any), + maps.tsNodeToESTreeNodeMap.get(node as TSNode), ), ); } @@ -141,7 +134,6 @@ describe('convert', () => { const instance = new Converter(ast, { errorOnUnknownASTType: false, - useJSXTextNode: false, shouldPreserveNodeMaps: true, }); instance.convertProgram(); @@ -155,7 +147,7 @@ describe('convert', () => { ) { expect(node).toBe( maps.esTreeNodeToTSNodeMap.get( - maps.tsNodeToESTreeNodeMap.get(node as any), + maps.tsNodeToESTreeNodeMap.get(node as TSNode), ), ); } @@ -174,7 +166,6 @@ describe('convert', () => { const instance = new Converter(ast, { errorOnUnknownASTType: false, - useJSXTextNode: false, shouldPreserveNodeMaps: true, }); const program = instance.convertProgram(); @@ -197,7 +188,7 @@ describe('convert', () => { expect(maps.esTreeNodeToTSNodeMap.get(program.body[0])).toBeDefined(); expect(program.body[0]).not.toBe( - maps.tsNodeToESTreeNodeMap.get(ast.statements[0] as any), + maps.tsNodeToESTreeNodeMap.get(ast.statements[0] as TSNode), ); checkMaps(ast); }); @@ -206,7 +197,6 @@ describe('convert', () => { const ast = convertCode(''); const instance = new Converter(ast, { errorOnUnknownASTType: false, - useJSXTextNode: false, shouldPreserveNodeMaps: true, }); @@ -251,7 +241,6 @@ describe('convert', () => { const instance = new Converter(ast, { errorOnUnknownASTType: false, - useJSXTextNode: false, shouldPreserveNodeMaps: false, }); expect(() => instance.convertProgram()).toThrow( diff --git a/packages/typescript-estree/tests/lib/node-utils.test.ts b/packages/typescript-estree/tests/lib/node-utils.test.ts index 04ef46c9f650..a315d44de3ab 100644 --- a/packages/typescript-estree/tests/lib/node-utils.test.ts +++ b/packages/typescript-estree/tests/lib/node-utils.test.ts @@ -3,42 +3,42 @@ import { unescapeStringLiteralText } from '../../src/node-utils'; describe('unescapeStringLiteralText()', () => { it('should not modify content', () => { let text = 'amp;'; - expect(unescapeStringLiteralText(text)).toEqual(text); + expect(unescapeStringLiteralText(text)).toBe(text); text = 'test'; - expect(unescapeStringLiteralText(text)).toEqual(text); + expect(unescapeStringLiteralText(text)).toBe(text); text = 'foo&bar&baz;'; - expect(unescapeStringLiteralText(text)).toEqual(text); + expect(unescapeStringLiteralText(text)).toBe(text); text = 'foo&bar&baz;'; - expect(unescapeStringLiteralText(text)).toEqual(text); + expect(unescapeStringLiteralText(text)).toBe(text); text = '¬listed;'; - expect(unescapeStringLiteralText(text)).toEqual(text); + expect(unescapeStringLiteralText(text)).toBe(text); text = '\u20ac'; - expect(unescapeStringLiteralText(text)).toEqual(text); + expect(unescapeStringLiteralText(text)).toBe(text); }); it('should handle empty string', () => { - expect(unescapeStringLiteralText('')).toEqual(''); + expect(unescapeStringLiteralText('')).toBe(''); }); it('should handle named entities followed by alphanumeric characters', () => { - expect(unescapeStringLiteralText('über')).toEqual('über'); + expect(unescapeStringLiteralText('über')).toBe('über'); }); it('should handle invalid code point modify content', () => { - expect(unescapeStringLiteralText('�')).toEqual('�'); + expect(unescapeStringLiteralText('�')).toBe('�'); }); it('should escape correctly', () => { - expect(unescapeStringLiteralText('&=123&lang=en&,&')).toEqual( + expect(unescapeStringLiteralText('&=123&lang=en&,&')).toBe( '&=123&lang=en&,&', ); - expect(unescapeStringLiteralText('')).toEqual('\u0001'); - expect(unescapeStringLiteralText('!')).toEqual(`!`); - expect(unescapeStringLiteralText('�')).toEqual('\u0000'); - expect(unescapeStringLiteralText('Œ')).toEqual('\u0152'); - expect(unescapeStringLiteralText('œ')).toEqual('\u0153'); - expect(unescapeStringLiteralText('∴')).toEqual('\u2234'); - expect(unescapeStringLiteralText('😂')).toEqual('😂'); + expect(unescapeStringLiteralText('')).toBe('\u0001'); + expect(unescapeStringLiteralText('!')).toBe('!'); + expect(unescapeStringLiteralText('�')).toBe('\u0000'); + expect(unescapeStringLiteralText('Œ')).toBe('\u0152'); + expect(unescapeStringLiteralText('œ')).toBe('\u0153'); + expect(unescapeStringLiteralText('∴')).toBe('\u2234'); + expect(unescapeStringLiteralText('😂')).toBe('😂'); expect( unescapeStringLiteralText( 'a\n<>"'&©∆℞😂�', ), - ).toEqual(`a\n<>"'&©∆℞😂\u0000\u0001`); + ).toBe(`a\n<>"'&©∆℞😂\u0000\u0001`); }); }); diff --git a/packages/typescript-estree/tests/lib/parse.test.ts b/packages/typescript-estree/tests/lib/parse.test.ts index 33b393670d09..f74bcc81794d 100644 --- a/packages/typescript-estree/tests/lib/parse.test.ts +++ b/packages/typescript-estree/tests/lib/parse.test.ts @@ -50,8 +50,11 @@ describe('parseWithNodeMaps()', () => { it('should have correct column number when strict mode error occurs', () => { try { parser.parseWithNodeMaps('function fn(a, a) {\n}'); - } catch (err) { - expect(err.column).toEqual(16); + } catch ( + // eslint-disable-next-line @typescript-eslint/no-explicit-any + err: any + ) { + expect(err.column).toBe(16); } }); }); @@ -90,7 +93,7 @@ describe('parseWithNodeMaps()', () => { 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 code = 12345 as any as string; const config: TSESTreeOptions = { comment: true, tokens: true, @@ -492,24 +495,26 @@ describe('parseAndGenerateServices', () => { 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) { - /** - * Aligns paths between environments, node for windows uses `\`, for linux and mac uses `/` - */ - error.message = error.message.replace(/\\(?!["])/gm, '/'); - throw error; - } - }; + const testParse = + (filePath: string, extraFileExtensions: string[] = ['.vue']) => + (): void => { + try { + parser.parseAndGenerateServices(code, { + ...config, + extraFileExtensions, + filePath: join(PROJECT_DIR, filePath), + }); + } catch (error) { + /** + * Aligns paths between environments, node for windows uses `\`, for linux and mac uses `/` + */ + (error as Error).message = (error as Error).message.replace( + /\\(?!["])/gm, + '/', + ); + throw error; + } + }; describe('project includes', () => { it("doesn't error for matched files", () => { @@ -647,16 +652,18 @@ describe('parseAndGenerateServices', () => { project: './**/tsconfig.json', }; - const testParse = ( - filePath: 'ignoreme' | 'includeme', - projectFolderIgnoreList?: TSESTreeOptions['projectFolderIgnoreList'], - ) => (): void => { - parser.parseAndGenerateServices(code, { - ...config, - projectFolderIgnoreList, - filePath: join(PROJECT_DIR, filePath, './file.ts'), - }); - }; + 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(); @@ -669,4 +676,94 @@ describe('parseAndGenerateServices', () => { expect(testParse('includeme', ignore)).not.toThrow(); }); }); + + describe('moduleResolver', () => { + beforeEach(() => { + parser.clearCaches(); + }); + + const PROJECT_DIR = resolve(FIXTURES_DIR, '../moduleResolver'); + const code = ` + import { something } from '__PLACEHOLDER__'; + + something(); + `; + const config: TSESTreeOptions = { + comment: true, + tokens: true, + range: true, + loc: true, + project: './tsconfig.json', + tsconfigRootDir: PROJECT_DIR, + filePath: resolve(PROJECT_DIR, 'file.ts'), + }; + const withDefaultProgramConfig: TSESTreeOptions = { + ...config, + project: './tsconfig.defaultProgram.json', + createDefaultProgram: true, + }; + + 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( + PROJECT_DIR, + './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." + `); + }); + + it('resolves __PLACEHOLDER__ correctly', () => { + expect( + parser + .parseAndGenerateServices(code, { + ...config, + moduleResolver: resolve(PROJECT_DIR, './moduleResolver.js'), + }) + .services.program.getSemanticDiagnostics(), + ).toHaveLength(0); + }); + }); + + 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.", + ); + }); + + it('resolves __PLACEHOLDER__ correctly', () => { + expect( + parser + .parseAndGenerateServices(code, { + ...withDefaultProgramConfig, + moduleResolver: resolve(PROJECT_DIR, './moduleResolver.js'), + }) + .services.program.getSemanticDiagnostics(), + ).toHaveLength(0); + }); + }); + }); }); diff --git a/packages/typescript-estree/tests/lib/persistentParse.test.ts b/packages/typescript-estree/tests/lib/persistentParse.test.ts index 7e751ed42489..b79f66aaa5c2 100644 --- a/packages/typescript-estree/tests/lib/persistentParse.test.ts +++ b/packages/typescript-estree/tests/lib/persistentParse.test.ts @@ -1,7 +1,8 @@ import fs from 'fs'; import path from 'path'; import tmp from 'tmp'; -import { clearCaches, parseAndGenerateServices } from '../../src'; +import { clearWatchCaches } from '../../src/create-program/createWatchProgram'; +import { parseAndGenerateServices } from '../../src/parser'; const CONTENTS = { foo: 'console.log("foo")', @@ -17,7 +18,7 @@ const cwdCopy = process.cwd(); const tmpDirs = new Set(); afterEach(() => { // stop watching the files and folders - clearCaches(); + clearWatchCaches(); // clean up the temporary files and folders tmpDirs.forEach(t => t.removeCallback()); @@ -192,7 +193,7 @@ function baseTests( writeFile(PROJECT_DIR, 'bar'); // make sure that file is correctly created - expect(existsSync('bar', PROJECT_DIR)).toEqual(true); + expect(existsSync('bar', PROJECT_DIR)).toBe(true); // both files should parse fine now expect(() => parseFile('foo', PROJECT_DIR, true)).not.toThrow(); @@ -212,8 +213,8 @@ function baseTests( writeFile(PROJECT_DIR, 'bar'); // make sure that file is correctly created - expect(existsSync('bar')).toEqual(true); - expect(existsSync('bar', PROJECT_DIR)).toEqual(true); + expect(existsSync('bar')).toBe(true); + expect(existsSync('bar', PROJECT_DIR)).toBe(true); // both files should parse fine now expect(() => parseFile('foo', PROJECT_DIR, true, true)).not.toThrow(); diff --git a/packages/typescript-estree/tests/lib/semanticInfo-singleRun.test.ts b/packages/typescript-estree/tests/lib/semanticInfo-singleRun.test.ts new file mode 100644 index 000000000000..62d7c3a841c9 --- /dev/null +++ b/packages/typescript-estree/tests/lib/semanticInfo-singleRun.test.ts @@ -0,0 +1,254 @@ +import glob from 'glob'; +import * as path from 'path'; +import { + clearProgramCache, + parseAndGenerateServices, + clearParseAndGenerateServicesCalls, +} from '../../src/parser'; +import { getCanonicalFileName } from '../../src/create-program/shared'; + +const mockProgram = { + getSourceFile(): void { + return; + }, + getTypeChecker(): void { + return; + }, +}; + +jest.mock('../../src/ast-converter', () => { + return { + astConverter(): unknown { + return { estree: {}, astMaps: {} }; + }, + }; +}); + +interface MockProgramWithConfigFile { + __FROM_CONFIG_FILE__?: string; +} + +jest.mock('../../src/create-program/shared.ts', () => { + return { + ...jest.requireActual('../../src/create-program/shared.ts'), + getAstFromProgram(program: MockProgramWithConfigFile): unknown { + if ( + program.__FROM_CONFIG_FILE__?.endsWith('non-matching-tsconfig.json') + ) { + return null; + } + // Remove temporary tracking value for the config added by mock createProgramFromConfigFile() below + delete program.__FROM_CONFIG_FILE__; + return { ast: {}, program }; + }, + }; +}); + +jest.mock('../../src/create-program/useProvidedPrograms.ts', () => { + return { + ...jest.requireActual('../../src/create-program/useProvidedPrograms.ts'), + createProgramFromConfigFile: jest + .fn() + .mockImplementation((configFile): MockProgramWithConfigFile => { + return { + // So we can differentiate our mock return values based on which tsconfig this is + __FROM_CONFIG_FILE__: configFile, + ...mockProgram, + }; + }), + }; +}); + +jest.mock('../../src/create-program/createWatchProgram', () => { + return { + ...jest.requireActual('../../src/create-program/createWatchProgram'), + getProgramsForProjects: jest.fn(() => [mockProgram]), + }; +}); + +const { + createProgramFromConfigFile, +} = require('../../src/create-program/useProvidedPrograms'); + +const FIXTURES_DIR = './tests/fixtures/semanticInfo'; +const testFiles = glob.sync(`**/*.src.ts`, { + cwd: FIXTURES_DIR, +}); + +const code = 'const foo = 5;'; +// File will not be found in the first Program, but will be in the second +const tsconfigs = ['./non-matching-tsconfig.json', './tsconfig.json']; +const options = { + filePath: testFiles[0], + tsconfigRootDir: path.join(process.cwd(), FIXTURES_DIR), + loggerFn: false, + project: tsconfigs, + allowAutomaticSingleRunInference: true, +} as const; + +const resolvedProject = (p: string): string => + getCanonicalFileName(path.resolve(path.join(process.cwd(), FIXTURES_DIR), p)); + +describe('semanticInfo - singleRun', () => { + beforeEach(() => { + // ensure caches are clean for each test + clearProgramCache(); + // ensure invocations of mock are clean for each test + (createProgramFromConfigFile as jest.Mock).mockClear(); + // Do not track invocations per file across tests + clearParseAndGenerateServicesCalls(); + }); + + it('should not create any programs ahead of time by default when there is no way to infer singleRun=true', () => { + // For when these tests themselves are running in CI, we need to ignore that for this particular spec + const originalEnvCI = process.env.CI; + process.env.CI = 'false'; + + /** + * At this point there is nothing to indicate it is a single run, so createProgramFromConfigFile should + * never be called + */ + parseAndGenerateServices(code, options); + expect(createProgramFromConfigFile).not.toHaveBeenCalled(); + + // Restore process data + process.env.CI = originalEnvCI; + }); + + it('should not create any programs ahead of time when when TSESTREE_SINGLE_RUN=false, even if other inferrence criteria apply', () => { + const originalTSESTreeSingleRun = process.env.TSESTREE_SINGLE_RUN; + process.env.TSESTREE_SINGLE_RUN = 'false'; + + // Normally CI=true would be used to infer singleRun=true, but TSESTREE_SINGLE_RUN is explicitly set to false + const originalEnvCI = process.env.CI; + process.env.CI = 'true'; + + parseAndGenerateServices(code, options); + expect(createProgramFromConfigFile).not.toHaveBeenCalled(); + + // Restore process data + process.env.TSESTREE_SINGLE_RUN = originalTSESTreeSingleRun; + 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 = ['', '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[0]), + ); + + // 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 36726ac1d528..c003d8d00466 100644 --- a/packages/typescript-estree/tests/lib/semanticInfo.test.ts +++ b/packages/typescript-estree/tests/lib/semanticInfo.test.ts @@ -1,19 +1,20 @@ -import { readFileSync } from 'fs'; +import * as fs from 'fs'; import glob from 'glob'; -import { extname, join, resolve } from 'path'; +import * as path from 'path'; import * as ts from 'typescript'; +import { clearWatchCaches } from '../../src/create-program/createWatchProgram'; +import { createProgramFromConfigFile as createProgram } from '../../src/create-program/useProvidedPrograms'; +import { + parseAndGenerateServices, + ParseAndGenerateServicesResult, +} from '../../src/parser'; import { TSESTreeOptions } from '../../src/parser-options'; +import { TSESTree } from '../../src/ts-estree'; import { createSnapshotTestBlock, formatSnapshotName, parseCodeAndGenerateServices, } from '../../tools/test-utils'; -import { - clearCaches, - parseAndGenerateServices, - ParseAndGenerateServicesResult, -} from '../../src'; -import { TSESTree } from '../../src/ts-estree'; const FIXTURES_DIR = './tests/fixtures/semanticInfo'; const testFiles = glob.sync(`**/*.src.ts`, { @@ -27,24 +28,23 @@ function createOptions(fileName: string): TSESTreeOptions & { cwd?: string } { tokens: true, comment: true, jsx: false, - useJSXTextNode: false, errorOnUnknownASTType: true, filePath: fileName, - tsconfigRootDir: join(process.cwd(), FIXTURES_DIR), + tsconfigRootDir: path.join(process.cwd(), FIXTURES_DIR), project: `./tsconfig.json`, loggerFn: false, }; } -// ensure tsconfig-parser caches are clean for each test -beforeEach(() => clearCaches()); +// ensure tsconfig-parser watch caches are clean for each test +beforeEach(() => clearWatchCaches()); describe('semanticInfo', () => { // test all AST snapshots testFiles.forEach(filename => { - const code = readFileSync(join(FIXTURES_DIR, filename), 'utf8'); + const code = fs.readFileSync(path.join(FIXTURES_DIR, filename), 'utf8'); it( - formatSnapshotName(filename, FIXTURES_DIR, extname(filename)), + formatSnapshotName(filename, FIXTURES_DIR, path.extname(filename)), createSnapshotTestBlock( code, createOptions(filename), @@ -55,7 +55,7 @@ describe('semanticInfo', () => { it(`should cache the created ts.program`, () => { const filename = testFiles[0]; - const code = readFileSync(join(FIXTURES_DIR, filename), 'utf8'); + const code = fs.readFileSync(path.join(FIXTURES_DIR, filename), 'utf8'); const options = createOptions(filename); const optionsProjectString = { ...options, @@ -70,7 +70,7 @@ describe('semanticInfo', () => { it(`should handle "project": "./tsconfig.json" and "project": ["./tsconfig.json"] the same`, () => { const filename = testFiles[0]; - const code = readFileSync(join(FIXTURES_DIR, filename), 'utf8'); + const code = fs.readFileSync(path.join(FIXTURES_DIR, filename), 'utf8'); const options = createOptions(filename); const optionsProjectString = { ...options, @@ -87,7 +87,7 @@ describe('semanticInfo', () => { it(`should resolve absolute and relative tsconfig paths the same`, () => { const filename = testFiles[0]; - const code = readFileSync(join(FIXTURES_DIR, filename), 'utf8'); + const code = fs.readFileSync(path.join(FIXTURES_DIR, filename), 'utf8'); const options = createOptions(filename); const optionsAbsolutePath = { ...options, @@ -119,9 +119,9 @@ describe('semanticInfo', () => { // case-specific tests it('isolated-file tests', () => { - const fileName = resolve(FIXTURES_DIR, 'isolated-file.src.ts'); + const fileName = path.resolve(FIXTURES_DIR, 'isolated-file.src.ts'); const parseResult = parseCodeAndGenerateServices( - readFileSync(fileName, 'utf8'), + fs.readFileSync(fileName, 'utf8'), createOptions(fileName), ); @@ -129,9 +129,9 @@ describe('semanticInfo', () => { }); it('isolated-vue-file tests', () => { - const fileName = resolve(FIXTURES_DIR, 'extra-file-extension.vue'); + const fileName = path.resolve(FIXTURES_DIR, 'extra-file-extension.vue'); const parseResult = parseCodeAndGenerateServices( - readFileSync(fileName, 'utf8'), + fs.readFileSync(fileName, 'utf8'), { ...createOptions(fileName), extraFileExtensions: ['.vue'], @@ -142,33 +142,36 @@ describe('semanticInfo', () => { }); it('non-existent-estree-nodes tests', () => { - const fileName = resolve(FIXTURES_DIR, 'non-existent-estree-nodes.src.ts'); + const fileName = path.resolve( + FIXTURES_DIR, + 'non-existent-estree-nodes.src.ts', + ); const parseResult = parseCodeAndGenerateServices( - readFileSync(fileName, 'utf8'), + fs.readFileSync(fileName, 'utf8'), createOptions(fileName), ); expect(parseResult).toHaveProperty('services.esTreeNodeToTSNodeMap'); - const binaryExpression = (parseResult.ast - .body[0] as TSESTree.VariableDeclaration).declarations[0].init!; - const tsBinaryExpression = parseResult.services.esTreeNodeToTSNodeMap.get( - binaryExpression, - ); + const binaryExpression = ( + parseResult.ast.body[0] as TSESTree.VariableDeclaration + ).declarations[0].init!; + const tsBinaryExpression = + parseResult.services.esTreeNodeToTSNodeMap.get(binaryExpression); expect(tsBinaryExpression.kind).toEqual(ts.SyntaxKind.BinaryExpression); - const computedPropertyString = ((parseResult.ast - .body[1] as TSESTree.ClassDeclaration).body - .body[0] as TSESTree.ClassProperty).key; - const tsComputedPropertyString = parseResult.services.esTreeNodeToTSNodeMap.get( - computedPropertyString, - ); + const computedPropertyString = ( + (parseResult.ast.body[1] as TSESTree.ClassDeclaration).body + .body[0] as TSESTree.PropertyDefinition + ).key; + const tsComputedPropertyString = + parseResult.services.esTreeNodeToTSNodeMap.get(computedPropertyString); expect(tsComputedPropertyString.kind).toEqual(ts.SyntaxKind.StringLiteral); }); it('imported-file tests', () => { - const fileName = resolve(FIXTURES_DIR, 'import-file.src.ts'); + const fileName = path.resolve(FIXTURES_DIR, 'import-file.src.ts'); const parseResult = parseCodeAndGenerateServices( - readFileSync(fileName, 'utf8'), + fs.readFileSync(fileName, 'utf8'), createOptions(fileName), ); @@ -178,16 +181,17 @@ describe('semanticInfo', () => { // get array node (ast shape validated by snapshot) // node is defined in other file than the parsed one - const arrayBoundName = (((parseResult.ast - .body[1] as TSESTree.ExpressionStatement) - .expression as TSESTree.CallExpression) - .callee as TSESTree.MemberExpression).object as TSESTree.Identifier; + const arrayBoundName = ( + ( + (parseResult.ast.body[1] as TSESTree.ExpressionStatement) + .expression as TSESTree.CallExpression + ).callee as TSESTree.MemberExpression + ).object as TSESTree.Identifier; expect(arrayBoundName.name).toBe('arr'); expect(parseResult).toHaveProperty('services.esTreeNodeToTSNodeMap'); - const tsArrayBoundName = parseResult.services.esTreeNodeToTSNodeMap.get( - arrayBoundName, - ); + const tsArrayBoundName = + parseResult.services.esTreeNodeToTSNodeMap.get(arrayBoundName); expect(tsArrayBoundName).toBeDefined(); checkNumberArrayType(checker, tsArrayBoundName); @@ -213,9 +217,8 @@ describe('semanticInfo', () => { .declarations[0].id as TSESTree.Identifier; expect(boundName.name).toBe('x'); - const tsBoundName = parseResult.services.esTreeNodeToTSNodeMap.get( - boundName, - ); + const tsBoundName = + parseResult.services.esTreeNodeToTSNodeMap.get(boundName); expect(tsBoundName).toBeDefined(); expect(parseResult.services.tsNodeToESTreeNodeMap.get(tsBoundName)).toBe( @@ -242,20 +245,26 @@ describe('semanticInfo', () => { }); it('non-existent project file', () => { - const fileName = resolve(FIXTURES_DIR, 'isolated-file.src.ts'); + const fileName = path.resolve(FIXTURES_DIR, 'isolated-file.src.ts'); const badConfig = createOptions(fileName); badConfig.project = './tsconfigs.json'; expect(() => - parseCodeAndGenerateServices(readFileSync(fileName, 'utf8'), badConfig), + parseCodeAndGenerateServices( + fs.readFileSync(fileName, 'utf8'), + badConfig, + ), ).toThrow(/Cannot read file .+tsconfigs\.json'/); }); it('fail to read project file', () => { - const fileName = resolve(FIXTURES_DIR, 'isolated-file.src.ts'); + const fileName = path.resolve(FIXTURES_DIR, 'isolated-file.src.ts'); const badConfig = createOptions(fileName); badConfig.project = '.'; expect(() => - parseCodeAndGenerateServices(readFileSync(fileName, 'utf8'), badConfig), + parseCodeAndGenerateServices( + fs.readFileSync(fileName, 'utf8'), + badConfig, + ), ).toThrow( // case insensitive because unix based systems are case insensitive /Cannot read file .+semanticInfo'./i, @@ -263,11 +272,14 @@ describe('semanticInfo', () => { }); it('malformed project file', () => { - const fileName = resolve(FIXTURES_DIR, 'isolated-file.src.ts'); + const fileName = path.resolve(FIXTURES_DIR, 'isolated-file.src.ts'); const badConfig = createOptions(fileName); badConfig.project = './badTSConfig/tsconfig.json'; expect(() => - parseCodeAndGenerateServices(readFileSync(fileName, 'utf8'), badConfig), + parseCodeAndGenerateServices( + fs.readFileSync(fileName, 'utf8'), + badConfig, + ), ).toThrowErrorMatchingSnapshot(); }); @@ -279,6 +291,66 @@ describe('semanticInfo', () => { expect(parseResult.services.program).toBeDefined(); }); + + it('empty programs array should throw', () => { + const fileName = path.resolve(FIXTURES_DIR, 'isolated-file.src.ts'); + const badConfig = createOptions(fileName); + badConfig.programs = []; + expect(() => parseAndGenerateServices('const foo = 5;', badConfig)).toThrow( + 'You have set parserOptions.programs to an empty array. This will cause all files to not be found in existing programs. Either provide one or more existing TypeScript Program instances in the array, or remove the parserOptions.programs setting.', + ); + }); + + 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'; + const program1 = createProgram(path.join(FIXTURES_DIR, 'tsconfig.json')); + const options = createOptions(filename); + const optionsWithSingleProgram = { + ...options, + programs: [program1], + }; + expect(() => + parseAndGenerateServices('const foo = 5;', optionsWithSingleProgram), + ).toThrow( + `The file was not found in any of the provided program instance(s): ${filename}`, + ); + + const program2 = createProgram(path.join(FIXTURES_DIR, 'tsconfig.json')); + const optionsWithMultiplePrograms = { + ...options, + programs: [program1, program2], + }; + expect(() => + parseAndGenerateServices('const foo = 5;', optionsWithMultiplePrograms), + ).toThrow( + `The file was not found in any of the provided program instance(s): ${filename}`, + ); + }); + + it('createProgram fails on non-existent file', () => { + expect(() => createProgram('tsconfig.non-existent.json')).toThrow(); + }); + + it('createProgram fails on tsconfig with errors', () => { + expect(() => + createProgram(path.join(FIXTURES_DIR, 'badTSConfig', 'tsconfig.json')), + ).toThrow(); + }); }); function testIsolatedFile( @@ -296,9 +368,8 @@ function testIsolatedFile( expect(parseResult).toHaveProperty('services.esTreeNodeToTSNodeMap'); // get corresponding TS node - const tsArrayMember = parseResult.services.esTreeNodeToTSNodeMap.get( - arrayMember, - ); + const tsArrayMember = + parseResult.services.esTreeNodeToTSNodeMap.get(arrayMember); expect(tsArrayMember).toBeDefined(); expect(tsArrayMember.kind).toBe(ts.SyntaxKind.NumericLiteral); expect((tsArrayMember as ts.NumericLiteral).text).toBe('3'); 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 bd0189e05aa0..dbeef2b24f98 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 @@ -38,6 +38,7 @@ Object { "line": 8, }, }, + "override": false, "range": Array [ 103, 119, 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 23e257d45f1d..0313f535de1d 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 @@ -42,7 +42,7 @@ Object { 61, ], "raw": "http://example.com", - "type": "Literal", + "type": "JSXText", "value": "http://example.com", }, ], 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 f4155967a745..851f8980ab51 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 @@ -48,7 +48,7 @@ Object { ], "raw": " ", - "type": "Literal", + "type": "JSXText", "value": " ", }, @@ -103,7 +103,7 @@ Object { ], "raw": " ", - "type": "Literal", + "type": "JSXText", "value": " ", }, 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 01c1a39e231f..cbf278f9ee7b 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 @@ -43,7 +43,7 @@ Object { ], "raw": " ", - "type": "Literal", + "type": "JSXText", "value": " ", }, @@ -190,7 +190,7 @@ Object { ], "raw": " ", - "type": "Literal", + "type": "JSXText", "value": " ", }, @@ -374,7 +374,7 @@ Object { ], "raw": " ", - "type": "Literal", + "type": "JSXText", "value": " ", }, @@ -558,7 +558,7 @@ Object { ], "raw": " ", - "type": "Literal", + "type": "JSXText", "value": " ", }, @@ -779,7 +779,7 @@ Object { "raw": " ", - "type": "Literal", + "type": "JSXText", "value": " ", @@ -927,7 +927,7 @@ Object { ], "raw": " ", - "type": "Literal", + "type": "JSXText", "value": " ", }, @@ -1111,7 +1111,7 @@ Object { ], "raw": " ", - "type": "Literal", + "type": "JSXText", "value": " ", }, @@ -1295,7 +1295,7 @@ Object { ], "raw": " ", - "type": "Literal", + "type": "JSXText", "value": " ", }, @@ -1515,7 +1515,7 @@ Object { ], "raw": " ", - "type": "Literal", + "type": "JSXText", "value": " ", }, 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 e14584d71e3f..177f12a16625 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 @@ -48,7 +48,7 @@ Object { ], "raw": " ", - "type": "Literal", + "type": "JSXText", "value": " ", }, 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 dce1129ff0f1..34ae0afe27e7 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 @@ -51,7 +51,7 @@ Object { * test */ ", - "type": "Literal", + "type": "JSXText", "value": " /** * test 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 c0b9bcc60388..b51fc4edf9ce 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 @@ -42,7 +42,7 @@ Object { 37, ], "raw": "http://example.com", - "type": "Literal", + "type": "JSXText", "value": "http://example.com", }, ], @@ -208,7 +208,7 @@ Object { 81, ], "raw": "http://example.com", - "type": "Literal", + "type": "JSXText", "value": "http://example.com", }, ], @@ -392,7 +392,7 @@ Object { 130, ], "raw": "http://example.com", - "type": "Literal", + "type": "JSXText", "value": "http://example.com", }, ], @@ -649,7 +649,7 @@ Object { 190, ], "raw": "http://example.com", - "type": "Literal", + "type": "JSXText", "value": "http://example.com", }, ], @@ -849,7 +849,7 @@ Object { 238, ], "raw": "http://example.com", - "type": "Literal", + "type": "JSXText", "value": "http://example.com", }, ], 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 b2ccc72ae26e..308c14521e5e 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 @@ -157,7 +157,7 @@ Object { 61, ], "raw": "//", - "type": "Literal", + "type": "JSXText", "value": "//", }, ], 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 623f6422eedb..2d5c27d4fe04 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 @@ -157,7 +157,7 @@ Object { 61, ], "raw": "//", - "type": "Literal", + "type": "JSXText", "value": "//", }, ], 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 fdacdc91cbdf..62aadc15acb6 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 @@ -37,6 +37,7 @@ Object { "line": 1, }, }, + "override": false, "range": Array [ 9, 18, @@ -115,6 +116,7 @@ Object { "line": 1, }, }, + "override": false, "range": Array [ 19, 29, 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 930ca6d8259f..5871d6c60c99 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 @@ -37,6 +37,7 @@ Object { "line": 1, }, }, + "override": false, "range": Array [ 9, 23, 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 1bea3845235d..c1ee0b82f958 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 @@ -37,6 +37,7 @@ Object { "line": 1, }, }, + "override": false, "range": Array [ 9, 22, 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 3283a8722a75..9b70760930b9 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 @@ -37,6 +37,7 @@ Object { "line": 1, }, }, + "override": false, "range": Array [ 9, 19, 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 f13e2fabc216..9e9a41ba3261 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 @@ -37,6 +37,7 @@ Object { "line": 1, }, }, + "override": false, "range": Array [ 9, 24, 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 7c807720ef86..1f39c5579980 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 @@ -37,6 +37,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 14, 41, 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 97a6831a8da1..ed28bce4faa2 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 @@ -37,6 +37,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 14, 19, diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-private-identifier-accessor.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-private-identifier-accessor.src.js.shot new file mode 100644 index 000000000000..07249d71dc9a --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-private-identifier-accessor.src.js.shot @@ -0,0 +1,1024 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript classes class-private-identifier-accessor.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "name": "priv1", + "range": Array [ + 18, + 24, + ], + "type": "PrivateIdentifier", + }, + "kind": "get", + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "override": false, + "range": Array [ + 14, + 39, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 29, + 37, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 27, + 39, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 24, + 39, + ], + "type": "FunctionExpression", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "name": "priv1", + "range": Array [ + 46, + 52, + ], + "type": "PrivateIdentifier", + }, + "kind": "set", + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "override": false, + "range": Array [ + 42, + 63, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "range": Array [ + 60, + 63, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "name": "value", + "range": Array [ + 53, + 58, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 52, + 63, + ], + "type": "FunctionExpression", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "name": "constructor", + "range": Array [ + 67, + 78, + ], + "type": "Identifier", + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "override": false, + "range": Array [ + 67, + 107, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 87, + 91, + ], + "type": "ThisExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "name": "priv1", + "range": Array [ + 92, + 98, + ], + "type": "PrivateIdentifier", + }, + "range": Array [ + 87, + 98, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "operator": "=", + "range": Array [ + 87, + 102, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 6, + }, + "start": Object { + "column": 18, + "line": 6, + }, + }, + "range": Array [ + 101, + 102, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 87, + 103, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "range": Array [ + 81, + 107, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "params": Array [], + "range": Array [ + 78, + 107, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 109, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 109, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 110, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 18, + 24, + ], + "type": "Identifier", + "value": "#priv1", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 29, + 35, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 42, + 45, + ], + "type": "Identifier", + "value": "set", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 46, + 52, + ], + "type": "Identifier", + "value": "#priv1", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 53, + 58, + ], + "type": "Identifier", + "value": "value", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "range": Array [ + 60, + 61, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 3, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 67, + 78, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "range": Array [ + 78, + 79, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "range": Array [ + 79, + 80, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "range": Array [ + 81, + 82, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 87, + 91, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 91, + 92, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "range": Array [ + 92, + 98, + ], + "type": "Identifier", + "value": "#priv1", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 16, + "line": 6, + }, + }, + "range": Array [ + 99, + 100, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 6, + }, + "start": Object { + "column": 18, + "line": 6, + }, + }, + "range": Array [ + 101, + 102, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 6, + }, + "start": Object { + "column": 19, + "line": 6, + }, + }, + "range": Array [ + 102, + 103, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 106, + 107, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 8, + }, + }, + "range": Array [ + 108, + 109, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-private-identifier-field.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-private-identifier-field.src.js.shot new file mode 100644 index 000000000000..63586a9fa6df --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-private-identifier-field.src.js.shot @@ -0,0 +1,748 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript classes class-private-identifier-field.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "declare": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "priv1", + "range": Array [ + 14, + 20, + ], + "type": "PrivateIdentifier", + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "override": false, + "range": Array [ + 14, + 21, + ], + "readonly": undefined, + "static": false, + "type": "PropertyDefinition", + "value": null, + }, + Object { + "computed": false, + "declare": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "name": "priv2", + "range": Array [ + 24, + 30, + ], + "type": "PrivateIdentifier", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "override": false, + "range": Array [ + 24, + 35, + ], + "readonly": undefined, + "static": false, + "type": "PropertyDefinition", + "value": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 33, + 34, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "name": "constructor", + "range": Array [ + 39, + 50, + ], + "type": "Identifier", + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "override": false, + "range": Array [ + 39, + 79, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 59, + 63, + ], + "type": "ThisExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "name": "priv1", + "range": Array [ + 64, + 70, + ], + "type": "PrivateIdentifier", + }, + "range": Array [ + 59, + 70, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "operator": "=", + "range": Array [ + 59, + 74, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 6, + }, + "start": Object { + "column": 18, + "line": 6, + }, + }, + "range": Array [ + 73, + 74, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 59, + 75, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "range": Array [ + 53, + 79, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "params": Array [], + "range": Array [ + 50, + 79, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 81, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 81, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 82, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 20, + ], + "type": "Identifier", + "value": "#priv1", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 24, + 30, + ], + "type": "Identifier", + "value": "#priv2", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 39, + 50, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 59, + 63, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 63, + 64, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "range": Array [ + 64, + 70, + ], + "type": "Identifier", + "value": "#priv1", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 16, + "line": 6, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 6, + }, + "start": Object { + "column": 18, + "line": 6, + }, + }, + "range": Array [ + 73, + 74, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 6, + }, + "start": Object { + "column": 19, + "line": 6, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 78, + 79, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 8, + }, + }, + "range": Array [ + 80, + 81, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-private-identifier-method.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-private-identifier-method.src.js.shot new file mode 100644 index 000000000000..099a48f546c5 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-private-identifier-method.src.js.shot @@ -0,0 +1,691 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript classes class-private-identifier-method.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 14, + 18, + ], + "type": "PrivateIdentifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "override": false, + "range": Array [ + 14, + 23, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 21, + 23, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 18, + 23, + ], + "type": "FunctionExpression", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "name": "constructor", + "range": Array [ + 27, + 38, + ], + "type": "Identifier", + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "override": false, + "range": Array [ + 27, + 63, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 47, + 51, + ], + "type": "ThisExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "name": "bar", + "range": Array [ + 52, + 56, + ], + "type": "PrivateIdentifier", + }, + "range": Array [ + 47, + 56, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "optional": false, + "range": Array [ + 47, + 58, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 47, + 59, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "range": Array [ + 41, + 63, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "params": Array [], + "range": Array [ + 38, + 63, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 65, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 65, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 66, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 18, + ], + "type": "Identifier", + "value": "#bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 27, + 38, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 47, + 51, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "range": Array [ + 52, + 56, + ], + "type": "Identifier", + "value": "#bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 15, + "line": 5, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-static-method-named-prototype.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-static-method-named-prototype.src.js.shot index eddc8fae7c6b..4f725a4e5361 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 @@ -38,6 +38,7 @@ Object { "line": 1, }, }, + "override": false, "range": Array [ 9, 33, 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 a0303a971a1a..b1756b4818dc 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 @@ -37,6 +37,7 @@ Object { "line": 1, }, }, + "override": false, "range": Array [ 9, 26, 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 52fe0b94216f..1cf9872e5897 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 @@ -37,6 +37,7 @@ Object { "line": 1, }, }, + "override": false, "range": Array [ 9, 21, 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 ba34c36db88b..0dda0b030892 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 @@ -37,6 +37,7 @@ Object { "line": 1, }, }, + "override": false, "range": Array [ 9, 21, @@ -115,6 +116,7 @@ Object { "line": 1, }, }, + "override": false, "range": Array [ 22, 38, @@ -193,6 +195,7 @@ Object { "line": 1, }, }, + "override": false, "range": Array [ 39, 56, 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 9e09fb35659a..f99bd40eb6ca 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 @@ -37,6 +37,7 @@ Object { "line": 1, }, }, + "override": false, "range": Array [ 9, 22, @@ -115,6 +116,7 @@ Object { "line": 1, }, }, + "override": false, "range": Array [ 24, 37, 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 c900a7f0214e..e104bce8c44d 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 @@ -37,6 +37,7 @@ Object { "line": 1, }, }, + "override": false, "range": Array [ 9, 26, @@ -116,6 +117,7 @@ Object { "line": 1, }, }, + "override": false, "range": Array [ 27, 46, 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 fc9e5c7b6fcc..6c78f5741667 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 @@ -37,6 +37,7 @@ Object { "line": 1, }, }, + "override": false, "range": Array [ 9, 14, @@ -115,6 +116,7 @@ Object { "line": 1, }, }, + "override": false, "range": Array [ 15, 20, 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 4d8285256422..5060c0584f90 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 @@ -37,6 +37,7 @@ Object { "line": 1, }, }, + "override": false, "range": Array [ 10, 15, @@ -115,6 +116,7 @@ Object { "line": 1, }, }, + "override": false, "range": Array [ 16, 21, 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 f1d6ca4f90eb..aeb53db18651 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 @@ -37,6 +37,7 @@ Object { "line": 1, }, }, + "override": false, "range": Array [ 9, 14, @@ -115,6 +116,7 @@ Object { "line": 1, }, }, + "override": false, "range": Array [ 15, 20, 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 dadd12488521..b8be5d7f17c7 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 @@ -37,6 +37,7 @@ Object { "line": 1, }, }, + "override": false, "range": Array [ 9, 14, @@ -115,6 +116,7 @@ Object { "line": 1, }, }, + "override": false, "range": Array [ 14, 19, 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 c6f00a3d4c46..9b9e4330f1b2 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 @@ -37,6 +37,7 @@ Object { "line": 1, }, }, + "override": false, "range": Array [ 9, 31, @@ -115,6 +116,7 @@ Object { "line": 1, }, }, + "override": false, "range": Array [ 32, 54, 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 af33584684a9..e736c7d3cc94 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 @@ -37,6 +37,7 @@ Object { "line": 1, }, }, + "override": false, "range": Array [ 9, 32, 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 4193a686d1cc..1356638c8621 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 @@ -37,6 +37,7 @@ Object { "line": 1, }, }, + "override": false, "range": Array [ 9, 25, 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 b40e348d921e..150efc9e0ac5 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 @@ -37,6 +37,7 @@ Object { "line": 1, }, }, + "override": false, "range": Array [ 9, 24, 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 f064c5f76293..8b505ede6155 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 @@ -37,6 +37,7 @@ Object { "line": 1, }, }, + "override": false, "range": Array [ 10, 22, 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 4a29a98df2df..a0f0e8f243e4 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 @@ -37,6 +37,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 14, 44, 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 04c434424069..e826cfb92f9f 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 @@ -37,6 +37,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 14, 36, 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 81adc7932099..1ce60cf6afe4 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 @@ -37,6 +37,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 14, 45, 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 06c6a6c36ba9..31e9b9c678ee 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 @@ -37,6 +37,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 14, 49, 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 37d5fc8f72e7..2fac40a23013 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 @@ -37,6 +37,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 14, 49, 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 058e26e7c075..2ce4b20aef57 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 @@ -37,6 +37,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 14, 45, 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 a592ad53b5e5..0788bd3e5900 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 @@ -37,6 +37,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 14, 37, 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 cb85570c27a5..09a9336e2029 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 @@ -37,6 +37,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 14, 41, 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 44a00400bfb8..bc5f1596e9b4 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 @@ -37,6 +37,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 14, 41, 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 439a20f2583f..3916e2523512 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 @@ -37,6 +37,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 14, 37, 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 5cd2bc9958d6..65f9143603d5 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 @@ -74,6 +74,7 @@ Object { "line": 4, }, }, + "override": false, "range": Array [ 31, 75, @@ -190,6 +191,7 @@ Object { "line": 8, }, }, + "override": false, "range": Array [ 81, 121, @@ -306,6 +308,7 @@ Object { "line": 12, }, }, + "override": false, "range": Array [ 127, 172, @@ -441,6 +444,7 @@ Object { "line": 16, }, }, + "override": false, "range": Array [ 178, 217, 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 9a90f9b39a69..9789490921d4 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 @@ -37,6 +37,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 14, 63, 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 new file mode 100644 index 000000000000..5467f678c18f --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-module-specifier.src.js.shot @@ -0,0 +1,10 @@ +// 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-import-default-module-specifier.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-default-module-specifier.src.js.shot index 11bb8f0abb0c..0754b716ae59 100644 --- 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 @@ -1,190 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`javascript modules invalid-import-default-module-specifier.src 1`] = ` -Object { - "body": Array [ - Object { - "importKind": "value", - "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": 16, - "line": 1, - }, - }, - "name": "bar", - "range": Array [ - 16, - 19, - ], - "type": "Identifier", - }, - "specifiers": Array [ - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "local": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 7, - 10, - ], - "type": "Identifier", - }, - "range": Array [ - 7, - 10, - ], - "type": "ImportDefaultSpecifier", - }, - ], - "type": "ImportDeclaration", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 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": "import", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 10, - ], - "type": "Identifier", - "value": "foo", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 15, - ], - "type": "Identifier", - "value": "from", - }, - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 19, - ], - "type": "Identifier", - "value": "bar", - }, - Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "range": Array [ - 19, - 20, - ], - "type": "Punctuator", - "value": ";", - }, - ], - "type": "Program", +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-module-specifier.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-module-specifier.src.js.shot index f810bb25d0c6..d456d2e46791 100644 --- 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 @@ -1,227 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`javascript modules invalid-import-module-specifier.src 1`] = ` -Object { - "body": Array [ - Object { - "declaration": null, - "exportKind": "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": 21, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "name": "bar", - "range": Array [ - 18, - 21, - ], - "type": "Identifier", - }, - "specifiers": Array [ - Object { - "exported": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 8, - 11, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "local": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 8, - 11, - ], - "type": "Identifier", - }, - "range": Array [ - 8, - 11, - ], - "type": "ExportSpecifier", - }, - ], - "type": "ExportNamedDeclaration", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 22, - ], - "sourceType": "module", - "tokens": Array [ - Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 6, - ], - "type": "Keyword", - "value": "export", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 8, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 11, - ], - "type": "Identifier", - "value": "foo", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 12, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "range": Array [ - 13, - 17, - ], - "type": "Identifier", - "value": "from", - }, - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "range": Array [ - 18, - 21, - ], - "type": "Identifier", - "value": "bar", - }, - ], - "type": "Program", +TSError { + "column": 17, + "index": 17, + "lineNumber": 1, + "message": "Module specifier must be a string literal.", } `; 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 bc5b0a73ebd3..6a702c700653 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 @@ -37,6 +37,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 14, 41, 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 d3e04abe08bd..9a269121cc64 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 @@ -37,6 +37,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 14, 33, 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 f19079709bf4..2e6300509975 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 @@ -23,7 +23,7 @@ Object { ], "raw": " ", - "type": "Literal", + "type": "JSXText", "value": " ", }, @@ -101,7 +101,7 @@ Object { ], "raw": " ", - "type": "Literal", + "type": "JSXText", "value": " ", }, 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 7a64b57e9dac..326c3194f956 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 @@ -22,7 +22,7 @@ Object { 18, ], "raw": "@test content", - "type": "Literal", + "type": "JSXText", "value": "@test content", }, ], 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 1c6978110358..0c7c49b765a7 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/attributes.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/attributes.src.js.shot @@ -22,7 +22,7 @@ Object { 39, ], "raw": "test", - "type": "Literal", + "type": "JSXText", "value": "test", }, ], 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 9a3ca8aae026..a1526ac3de67 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 @@ -23,7 +23,7 @@ Object { ], "raw": " ", - "type": "Literal", + "type": "JSXText", "value": " ", }, @@ -101,7 +101,7 @@ Object { ], "raw": " ", - "type": "Literal", + "type": "JSXText", "value": " ", }, @@ -179,7 +179,7 @@ Object { ], "raw": " ", - "type": "Literal", + "type": "JSXText", "value": " ", }, @@ -257,7 +257,7 @@ Object { ], "raw": " ", - "type": "Literal", + "type": "JSXText", "value": " ", }, 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 40d5fc4812c2..e67cf324a956 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 @@ -79,7 +79,7 @@ Object { 35, ], "raw": "7x invalid-js-identifier", - "type": "Literal", + "type": "JSXText", "value": "7x invalid-js-identifier", }, ], 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 25cd76ed83d8..141520e983f4 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 @@ -409,7 +409,7 @@ Object { 70, ], "raw": "&abc;", - "type": "Literal", + "type": "JSXText", "value": "&abc;", }, ], @@ -537,7 +537,7 @@ Object { 92, ], "raw": "¬anentity;", - "type": "Literal", + "type": "JSXText", "value": "¬anentity;", }, ], @@ -665,7 +665,7 @@ Object { 105, ], "raw": "&#x;", - "type": "Literal", + "type": "JSXText", "value": "&#x;", }, ], 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 2cc38d57adbe..1856270c740c 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 @@ -24,7 +24,7 @@ Object { "raw": "   ", - "type": "Literal", + "type": "JSXText", "value": "   ", 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 d3cff5df9bf9..cc3c38b714cd 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 @@ -22,7 +22,7 @@ Object { 44, ], "raw": "  test", - "type": "Literal", + "type": "JSXText", "value": "  test", }, ], 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 index a35f3afd7151..a8788896feb2 100644 --- 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 @@ -2,8 +2,8 @@ exports[`jsx invalid-mismatched-closing-tag.src 1`] = ` TSError { - "column": 3, - "index": 3, + "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-dot-tag-name.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-mismatched-dot-tag-name.src.js.shot index 77d7e4187c3b..560ee71e7f77 100644 --- 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 @@ -2,8 +2,8 @@ exports[`jsx invalid-mismatched-dot-tag-name.src 1`] = ` TSError { - "column": 7, - "index": 7, + "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 index 1dd65c521056..4e5bac634b93 100644 --- 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 @@ -2,8 +2,8 @@ exports[`jsx invalid-mismatched-namespace-tag.src 1`] = ` TSError { - "column": 5, - "index": 5, + "column": 7, + "index": 7, "lineNumber": 1, "message": "Expected corresponding JSX closing tag for 'a:b'.", } 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 9e5cd8c899c9..17fa0430b73c 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 @@ -22,7 +22,7 @@ Object { 7, ], "raw": " ", - "type": "Literal", + "type": "JSXText", "value": " ", }, ], 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 58e66b804b7e..46d670895846 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 @@ -163,7 +163,7 @@ Object { 1, 9, ], - "type": "Keyword", + "type": "JSXIdentifier", "value": "this:bar", }, Object { 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 647aa3f85b5e..cfb3f96c345d 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 @@ -22,7 +22,7 @@ Object { 16, ], "raw": " ", - "type": "Literal", + "type": "JSXText", "value": " ", }, Object { @@ -76,7 +76,7 @@ Object { 24, ], "raw": " ", - "type": "Literal", + "type": "JSXText", "value": " ", }, Object { 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 373468554f63..cfb82c9a414f 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 @@ -23,7 +23,7 @@ Object { ], "raw": " ", - "type": "Literal", + "type": "JSXText", "value": " ", }, @@ -101,7 +101,7 @@ Object { ], "raw": " ", - "type": "Literal", + "type": "JSXText", "value": " ", }, 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 9edf414fa882..7ef41034fc55 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 @@ -23,7 +23,7 @@ Object { ], "raw": " ", - "type": "Literal", + "type": "JSXText", "value": " ", }, @@ -345,7 +345,7 @@ Object { ], "raw": " ", - "type": "Literal", + "type": "JSXText", "value": " ", }, 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 b400dfee5ad0..4df5e2ed08b0 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 @@ -22,7 +22,7 @@ Object { 18, ], "raw": "@test content", - "type": "Literal", + "type": "JSXText", "value": "@test content", }, ], 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 52271fbad013..c526bcc9da4a 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 @@ -231,7 +231,7 @@ Object { ], "raw": " ", - "type": "Literal", + "type": "JSXText", "value": " ", }, @@ -324,7 +324,7 @@ Object { ], "raw": " ", - "type": "Literal", + "type": "JSXText", "value": " ", }, 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 89c324ae0445..8a5a6c7e8c66 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 @@ -39,6 +39,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 43, 66, 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 5852f8937d09..7604195da3ac 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 @@ -39,6 +39,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 43, 84, 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 866a63383cb9..34ca54e31bb1 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 @@ -38,13 +38,14 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 25, 38, ], "readonly": undefined, "static": false, - "type": "TSAbstractClassProperty", + "type": "TSAbstractPropertyDefinition", "value": null, }, Object { @@ -70,7 +71,7 @@ Object { }, "loc": Object { "end": Object { - "column": 21, + "column": 25, "line": 3, }, "start": Object { @@ -78,32 +79,49 @@ Object { "line": 3, }, }, + "override": false, "range": Array [ 43, - 60, + 64, ], "readonly": undefined, "static": false, - "type": "TSAbstractClassProperty", - "value": Object { + "type": "TSAbstractPropertyDefinition", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 20, + "column": 24, "line": 3, }, "start": Object { - "column": 19, + "column": 16, "line": 3, }, }, "range": Array [ - 58, - 59, + 55, + 63, ], - "raw": "3", - "type": "Literal", - "value": 3, + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 57, + 63, + ], + "type": "TSNumberKeyword", + }, }, + "value": null, }, ], "loc": Object { @@ -118,7 +136,7 @@ Object { }, "range": Array [ 19, - 62, + 66, ], "type": "ClassBody", }, @@ -152,7 +170,7 @@ Object { }, "range": Array [ 0, - 62, + 66, ], "superClass": null, "type": "ClassDeclaration", @@ -171,7 +189,7 @@ Object { }, "range": Array [ 0, - 63, + 67, ], "sourceType": "script", "tokens": Array [ @@ -340,53 +358,53 @@ Object { Object { "loc": Object { "end": Object { - "column": 18, + "column": 17, "line": 3, }, "start": Object { - "column": 17, + "column": 16, "line": 3, }, }, "range": Array [ + 55, 56, - 57, ], "type": "Punctuator", - "value": "=", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 24, "line": 3, }, "start": Object { - "column": 19, + "column": 18, "line": 3, }, }, "range": Array [ - 58, - 59, + 57, + 63, ], - "type": "Numeric", - "value": "3", + "type": "Identifier", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 25, "line": 3, }, "start": Object { - "column": 20, + "column": 24, "line": 3, }, }, "range": Array [ - 59, - 60, + 63, + 64, ], "type": "Punctuator", "value": ";", @@ -403,8 +421,8 @@ Object { }, }, "range": Array [ - 61, - 62, + 65, + 66, ], "type": "Punctuator", "value": "}", 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 d33336454ef4..66cc1ade4909 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 @@ -31,7 +31,7 @@ Object { }, "loc": Object { "end": Object { - "column": 42, + "column": 39, "line": 2, }, "start": Object { @@ -39,32 +39,49 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 23, - 63, + 60, ], "readonly": true, "static": false, - "type": "TSAbstractClassProperty", - "value": Object { + "type": "TSAbstractPropertyDefinition", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 41, + "column": 38, "line": 2, }, "start": Object { - "column": 33, + "column": 30, "line": 2, }, }, "range": Array [ - 54, - 62, + 51, + 59, ], - "raw": "'string'", - "type": "Literal", - "value": "string", + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 32, + "line": 2, + }, + }, + "range": Array [ + 53, + 59, + ], + "type": "TSStringKeyword", + }, }, + "value": null, }, ], "loc": Object { @@ -79,7 +96,7 @@ Object { }, "range": Array [ 19, - 65, + 62, ], "type": "ClassBody", }, @@ -113,7 +130,7 @@ Object { }, "range": Array [ 0, - 65, + 62, ], "superClass": null, "type": "ClassDeclaration", @@ -132,7 +149,7 @@ Object { }, "range": Array [ 0, - 66, + 63, ], "sourceType": "script", "tokens": Array [ @@ -283,53 +300,53 @@ Object { Object { "loc": Object { "end": Object { - "column": 32, + "column": 31, "line": 2, }, "start": Object { - "column": 31, + "column": 30, "line": 2, }, }, "range": Array [ + 51, 52, - 53, ], "type": "Punctuator", - "value": "=", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 41, + "column": 38, "line": 2, }, "start": Object { - "column": 33, + "column": 32, "line": 2, }, }, "range": Array [ - 54, - 62, + 53, + 59, ], - "type": "String", - "value": "'string'", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 42, + "column": 39, "line": 2, }, "start": Object { - "column": 41, + "column": 38, "line": 2, }, }, "range": Array [ - 62, - 63, + 59, + 60, ], "type": "Punctuator", "value": ";", @@ -346,8 +363,8 @@ Object { }, }, "range": Array [ - 64, - 65, + 61, + 62, ], "type": "Punctuator", "value": "}", 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 7e580cca84cd..6b0c9419bdfe 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 @@ -39,6 +39,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 41, 71, 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 0bdd47c223eb..2ba070b7a0bc 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 @@ -38,13 +38,14 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 37, 59, ], "readonly": undefined, "static": false, - "type": "ClassProperty", + "type": "PropertyDefinition", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -112,13 +113,14 @@ Object { "line": 3, }, }, + "override": false, "range": Array [ 62, 93, ], "readonly": undefined, "static": false, - "type": "TSAbstractClassProperty", + "type": "TSAbstractPropertyDefinition", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -187,13 +189,14 @@ Object { "line": 4, }, }, + "override": false, "range": Array [ 96, 134, ], "readonly": undefined, "static": false, - "type": "TSAbstractClassProperty", + "type": "TSAbstractPropertyDefinition", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -261,13 +264,14 @@ Object { "line": 5, }, }, + "override": false, "range": Array [ 137, 177, ], "readonly": true, "static": false, - "type": "TSAbstractClassProperty", + "type": "TSAbstractPropertyDefinition", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -336,13 +340,14 @@ Object { "line": 6, }, }, + "override": false, "range": Array [ 180, 227, ], "readonly": true, "static": false, - "type": "TSAbstractClassProperty", + "type": "TSAbstractPropertyDefinition", "typeAnnotation": Object { "loc": Object { "end": Object { 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 1cf4f4e8f16f..4c8d959632fe 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 @@ -40,6 +40,7 @@ Object { }, }, "optional": true, + "override": false, "range": Array [ 43, 76, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-override-method.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-override-method.src.ts.shot new file mode 100644 index 000000000000..32e9b1f00281 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-override-method.src.ts.shot @@ -0,0 +1,396 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics abstract-class-with-override-method.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": true, + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "name": "show", + "range": Array [ + 80, + 84, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "override": true, + "range": Array [ + 62, + 87, + ], + "static": false, + "type": "TSAbstractMethodDefinition", + "value": Object { + "async": false, + "body": null, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 84, + 87, + ], + "type": "TSEmptyBodyFunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 58, + "line": 1, + }, + }, + "range": Array [ + 58, + 89, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "SpecializedComponent", + "range": Array [ + 15, + 35, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 89, + ], + "superClass": Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "name": "SomeComponent", + "range": Array [ + 44, + 57, + ], + "type": "Identifier", + }, + "type": "ClassDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 90, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 14, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 35, + ], + "type": "Identifier", + "value": "SpecializedComponent", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 43, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 57, + ], + "type": "Identifier", + "value": "SomeComponent", + }, + Object { + "loc": Object { + "end": Object { + "column": 59, + "line": 1, + }, + "start": Object { + "column": 58, + "line": 1, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 62, + 70, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 71, + 79, + ], + "type": "Identifier", + "value": "override", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 80, + 84, + ], + "type": "Identifier", + "value": "show", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 84, + 85, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 85, + 86, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 86, + 87, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 88, + 89, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-override-property.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-override-property.src.ts.shot new file mode 100644 index 000000000000..d22f508108d0 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-override-property.src.ts.shot @@ -0,0 +1,375 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics abstract-class-with-override-property.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": true, + "body": Object { + "body": Array [ + Object { + "computed": false, + "declare": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 80, + 83, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "override": true, + "range": Array [ + 62, + 88, + ], + "readonly": undefined, + "static": false, + "type": "TSAbstractPropertyDefinition", + "value": null, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 58, + "line": 1, + }, + }, + "range": Array [ + 58, + 90, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "SpecializedComponent", + "range": Array [ + 15, + 35, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 90, + ], + "superClass": Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "name": "SomeComponent", + "range": Array [ + 44, + 57, + ], + "type": "Identifier", + }, + "type": "ClassDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 91, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 14, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 35, + ], + "type": "Identifier", + "value": "SpecializedComponent", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 43, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 57, + ], + "type": "Identifier", + "value": "SomeComponent", + }, + Object { + "loc": Object { + "end": Object { + "column": 59, + "line": 1, + }, + "start": Object { + "column": 58, + "line": 1, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 62, + 70, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 71, + 79, + ], + "type": "Identifier", + "value": "override", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 80, + 83, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 84, + 85, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 86, + 87, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 87, + 88, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 89, + 90, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-private-identifier-field-with-accessibility-error.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-private-identifier-field-with-accessibility-error.src.ts.shot new file mode 100644 index 000000000000..04b127b9d7e9 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-private-identifier-field-with-accessibility-error.src.ts.shot @@ -0,0 +1,597 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-private-identifier-field-with-accessibility-error.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": "private", + "computed": false, + "declare": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "name": "priv1", + "range": Array [ + 22, + 28, + ], + "type": "PrivateIdentifier", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "override": false, + "range": Array [ + 14, + 36, + ], + "readonly": undefined, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 28, + 36, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 30, + 36, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + Object { + "accessibility": "public", + "computed": false, + "declare": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "name": "priv2", + "range": Array [ + 46, + 52, + ], + "type": "PrivateIdentifier", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "override": false, + "range": Array [ + 39, + 60, + ], + "readonly": undefined, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 52, + 60, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 54, + 60, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + Object { + "computed": false, + "declare": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "name": "priv3", + "range": Array [ + 70, + 76, + ], + "type": "PrivateIdentifier", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "override": false, + "range": Array [ + 63, + 84, + ], + "readonly": undefined, + "static": true, + "type": "PropertyDefinition", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 4, + }, + }, + "range": Array [ + 76, + 84, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "range": Array [ + 78, + 84, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 86, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 86, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 87, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 21, + ], + "type": "Keyword", + "value": "private", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "Identifier", + "value": "#priv1", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 30, + 36, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 39, + 45, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 46, + 52, + ], + "type": "Identifier", + "value": "#priv2", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 54, + 60, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 63, + 69, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 70, + 76, + ], + "type": "Identifier", + "value": "#priv3", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 4, + }, + }, + "range": Array [ + 76, + 77, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "range": Array [ + 78, + 84, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 85, + 86, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-private-identifier-field-with-annotation.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-private-identifier-field-with-annotation.src.ts.shot new file mode 100644 index 000000000000..c75fc510111c --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-private-identifier-field-with-annotation.src.ts.shot @@ -0,0 +1,888 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-private-identifier-field-with-annotation.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "declare": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "priv1", + "range": Array [ + 14, + 20, + ], + "type": "PrivateIdentifier", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "override": false, + "range": Array [ + 14, + 29, + ], + "readonly": undefined, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 20, + 28, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "TSNumberKeyword", + }, + }, + "value": null, + }, + Object { + "computed": false, + "declare": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "name": "priv2", + "range": Array [ + 32, + 38, + ], + "type": "PrivateIdentifier", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "override": false, + "range": Array [ + 32, + 51, + ], + "readonly": undefined, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 38, + 46, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 40, + 46, + ], + "type": "TSNumberKeyword", + }, + }, + "value": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 49, + 50, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "name": "constructor", + "range": Array [ + 55, + 66, + ], + "type": "Identifier", + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "override": false, + "range": Array [ + 55, + 95, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 75, + 79, + ], + "type": "ThisExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "name": "priv1", + "range": Array [ + 80, + 86, + ], + "type": "PrivateIdentifier", + }, + "range": Array [ + 75, + 86, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "operator": "=", + "range": Array [ + 75, + 90, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 6, + }, + "start": Object { + "column": 18, + "line": 6, + }, + }, + "range": Array [ + 89, + 90, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 75, + 91, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "range": Array [ + 69, + 95, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "params": Array [], + "range": Array [ + 66, + 95, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 97, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 97, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 98, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 20, + ], + "type": "Identifier", + "value": "#priv1", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "Identifier", + "value": "#priv2", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 40, + 46, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 55, + 66, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "range": Array [ + 67, + 68, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 75, + 79, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 79, + 80, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "range": Array [ + 80, + 86, + ], + "type": "Identifier", + "value": "#priv1", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 16, + "line": 6, + }, + }, + "range": Array [ + 87, + 88, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 6, + }, + "start": Object { + "column": 18, + "line": 6, + }, + }, + "range": Array [ + 89, + 90, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 6, + }, + "start": Object { + "column": 19, + "line": 6, + }, + }, + "range": Array [ + 90, + 91, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 94, + 95, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 8, + }, + }, + "range": Array [ + 96, + 97, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-private-identifier-readonly-field.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-private-identifier-readonly-field.src.ts.shot new file mode 100644 index 000000000000..1131eb4ab21e --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-private-identifier-readonly-field.src.ts.shot @@ -0,0 +1,301 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-private-identifier-readonly-field.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "declare": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "priv", + "range": Array [ + 23, + 28, + ], + "type": "PrivateIdentifier", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "override": false, + "range": Array [ + 14, + 36, + ], + "readonly": true, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 28, + 36, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 30, + 36, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 38, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 38, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 39, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 22, + ], + "type": "Identifier", + "value": "readonly", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 23, + 28, + ], + "type": "Identifier", + "value": "#priv", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 30, + 36, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-static-blocks.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-static-blocks.src.ts.shot new file mode 100644 index 000000000000..761783ccd1d6 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-static-blocks.src.ts.shot @@ -0,0 +1,702 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-static-blocks.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "declare": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "count", + "range": Array [ + 21, + 26, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "override": false, + "range": Array [ + 14, + 31, + ], + "readonly": undefined, + "static": true, + "type": "PropertyDefinition", + "value": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "raw": "0", + "type": "Literal", + "value": 0, + }, + }, + Object { + "body": Array [ + Object { + "alternate": null, + "consequent": Object { + "body": Array [ + Object { + "expression": Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "name": "count", + "range": Array [ + 76, + 81, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "operator": "++", + "prefix": false, + "range": Array [ + 76, + 83, + ], + "type": "UpdateExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 76, + 84, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 25, + "line": 4, + }, + }, + "range": Array [ + 68, + 90, + ], + "type": "BlockStatement", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 47, + 90, + ], + "test": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "name": "someCondition", + "range": Array [ + 51, + 64, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "optional": false, + "range": Array [ + 51, + 66, + ], + "type": "CallExpression", + }, + "type": "IfStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 34, + 94, + ], + "type": "StaticBlock", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 96, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 96, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 97, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 20, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 21, + 26, + ], + "type": "Identifier", + "value": "count", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Numeric", + "value": "0", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 34, + 40, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 47, + 49, + ], + "type": "Keyword", + "value": "if", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 4, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 51, + 64, + ], + "type": "Identifier", + "value": "someCondition", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 4, + }, + "start": Object { + "column": 21, + "line": 4, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 22, + "line": 4, + }, + }, + "range": Array [ + 65, + 66, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 4, + }, + "start": Object { + "column": 25, + "line": 4, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 76, + 81, + ], + "type": "Identifier", + "value": "count", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 81, + 83, + ], + "type": "Punctuator", + "value": "++", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 89, + 90, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 93, + 94, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 8, + }, + }, + "range": Array [ + 95, + 96, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-accessibility-modifiers.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-accessibility-modifiers.src.ts.shot index c2e78c3d5fc3..72b6e487ad10 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 @@ -38,13 +38,14 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 14, 35, ], "readonly": undefined, "static": false, - "type": "ClassProperty", + "type": "PropertyDefinition", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -113,13 +114,14 @@ Object { "line": 3, }, }, + "override": false, "range": Array [ 38, 65, ], "readonly": undefined, "static": true, - "type": "ClassProperty", + "type": "PropertyDefinition", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -188,6 +190,7 @@ Object { "line": 4, }, }, + "override": false, "range": Array [ 68, 111, @@ -339,6 +342,7 @@ Object { "line": 7, }, }, + "override": false, "range": Array [ 114, 171, 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 73617426afb6..ed6760da000a 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 @@ -38,6 +38,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 12, 39, @@ -118,6 +119,7 @@ Object { "line": 4, }, }, + "override": false, "range": Array [ 43, 71, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-constructor-and-parameter-property-with-modifiers.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-constructor-and-parameter-property-with-modifiers.src.ts.shot new file mode 100644 index 000000000000..c05e61d23707 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-constructor-and-parameter-property-with-modifiers.src.ts.shot @@ -0,0 +1,559 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-with-constructor-and-parameter-property-with-modifiers.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "constructor", + "range": Array [ + 53, + 64, + ], + "type": "Identifier", + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 59, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "override": false, + "range": Array [ + 53, + 110, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 59, + "line": 2, + }, + "start": Object { + "column": 57, + "line": 2, + }, + }, + "range": Array [ + 108, + 110, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 59, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "params": Array [ + Object { + "accessibility": "protected", + "export": undefined, + "loc": Object { + "end": Object { + "column": 55, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "override": true, + "parameter": Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 2, + }, + "start": Object { + "column": 42, + "line": 2, + }, + }, + "name": "param", + "range": Array [ + 93, + 106, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 2, + }, + "start": Object { + "column": 47, + "line": 2, + }, + }, + "range": Array [ + 98, + 106, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 2, + }, + "start": Object { + "column": 49, + "line": 2, + }, + }, + "range": Array [ + 100, + 106, + ], + "type": "TSStringKeyword", + }, + }, + }, + "range": Array [ + 65, + 106, + ], + "readonly": true, + "static": undefined, + "type": "TSParameterProperty", + }, + ], + "range": Array [ + 64, + 110, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 49, + "line": 1, + }, + }, + "range": Array [ + 49, + 112, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "SpecializedComponent", + "range": Array [ + 6, + 26, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 112, + ], + "superClass": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "name": "SomeComponent", + "range": Array [ + 35, + 48, + ], + "type": "Identifier", + }, + "type": "ClassDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 113, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 26, + ], + "type": "Identifier", + "value": "SpecializedComponent", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 34, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 48, + ], + "type": "Identifier", + "value": "SomeComponent", + }, + Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 1, + }, + "start": Object { + "column": 49, + "line": 1, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 53, + 64, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 65, + 74, + ], + "type": "Keyword", + "value": "protected", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 75, + 83, + ], + "type": "Identifier", + "value": "override", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 33, + "line": 2, + }, + }, + "range": Array [ + 84, + 92, + ], + "type": "Identifier", + "value": "readonly", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 2, + }, + "start": Object { + "column": 42, + "line": 2, + }, + }, + "range": Array [ + 93, + 98, + ], + "type": "Identifier", + "value": "param", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 2, + }, + "start": Object { + "column": 47, + "line": 2, + }, + }, + "range": Array [ + 98, + 99, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 2, + }, + "start": Object { + "column": 49, + "line": 2, + }, + }, + "range": Array [ + 100, + 106, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 2, + }, + "start": Object { + "column": 55, + "line": 2, + }, + }, + "range": Array [ + 106, + 107, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 58, + "line": 2, + }, + "start": Object { + "column": 57, + "line": 2, + }, + }, + "range": Array [ + 108, + 109, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 59, + "line": 2, + }, + "start": Object { + "column": 58, + "line": 2, + }, + }, + "range": Array [ + 109, + 110, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 111, + 112, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-constructor-and-parameter-proptery-with-override-modifier.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-constructor-and-parameter-proptery-with-override-modifier.src.ts.shot new file mode 100644 index 000000000000..2ab13d8e51c6 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-constructor-and-parameter-proptery-with-override-modifier.src.ts.shot @@ -0,0 +1,649 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-with-constructor-and-parameter-proptery-with-override-modifier.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "constructor", + "range": Array [ + 53, + 64, + ], + "type": "Identifier", + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "override": false, + "range": Array [ + 53, + 109, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 97, + 102, + ], + "type": "Super", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "optional": false, + "range": Array [ + 97, + 104, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 97, + 105, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 38, + "line": 2, + }, + }, + "range": Array [ + 89, + 109, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "params": Array [ + Object { + "accessibility": undefined, + "export": undefined, + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "override": true, + "parameter": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "name": "param", + "range": Array [ + 74, + 87, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 79, + 87, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 81, + 87, + ], + "type": "TSStringKeyword", + }, + }, + }, + "range": Array [ + 65, + 87, + ], + "readonly": undefined, + "static": undefined, + "type": "TSParameterProperty", + }, + ], + "range": Array [ + 64, + 109, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 49, + "line": 1, + }, + }, + "range": Array [ + 49, + 111, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "SpecializedComponent", + "range": Array [ + 6, + 26, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 111, + ], + "superClass": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "name": "SomeComponent", + "range": Array [ + 35, + 48, + ], + "type": "Identifier", + }, + "type": "ClassDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 112, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 26, + ], + "type": "Identifier", + "value": "SpecializedComponent", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 34, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 48, + ], + "type": "Identifier", + "value": "SomeComponent", + }, + Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 1, + }, + "start": Object { + "column": 49, + "line": 1, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 53, + 64, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 65, + 73, + ], + "type": "Identifier", + "value": "override", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 74, + 79, + ], + "type": "Identifier", + "value": "param", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 79, + 80, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 81, + 87, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "range": Array [ + 87, + 88, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 2, + }, + "start": Object { + "column": 38, + "line": 2, + }, + }, + "range": Array [ + 89, + 90, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 97, + 102, + ], + "type": "Keyword", + "value": "super", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 102, + 103, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 103, + 104, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 104, + 105, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 108, + 109, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 110, + 111, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-constructor-and-return-type.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-constructor-and-return-type.src.ts.shot index 6039f0b88ca1..c3a17fbe6985 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 @@ -37,6 +37,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 12, 37, @@ -150,6 +151,7 @@ Object { "line": 4, }, }, + "override": false, "range": Array [ 41, 70, 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 41ec91f36db0..56353693fd68 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 @@ -37,6 +37,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 12, 32, @@ -172,6 +173,7 @@ Object { "line": 4, }, }, + "override": false, "range": Array [ 36, 60, 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 3fc4fa8a2887..d42896e1914c 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 @@ -37,13 +37,14 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 20, 42, ], "readonly": undefined, "static": false, - "type": "ClassProperty", + "type": "PropertyDefinition", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -112,13 +113,14 @@ Object { "line": 3, }, }, + "override": false, "range": Array [ 45, 74, ], "readonly": undefined, "static": false, - "type": "ClassProperty", + "type": "PropertyDefinition", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -186,13 +188,14 @@ Object { "line": 4, }, }, + "override": false, "range": Array [ 77, 106, ], "readonly": undefined, "static": true, - "type": "ClassProperty", + "type": "PropertyDefinition", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -260,13 +263,14 @@ Object { "line": 5, }, }, + "override": false, "range": Array [ 109, 140, ], "readonly": true, "static": false, - "type": "ClassProperty", + "type": "PropertyDefinition", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -335,13 +339,14 @@ Object { "line": 6, }, }, + "override": false, "range": Array [ 143, 181, ], "readonly": true, "static": false, - "type": "ClassProperty", + "type": "PropertyDefinition", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -410,13 +415,14 @@ Object { "line": 7, }, }, + "override": false, "range": Array [ 184, 220, ], "readonly": undefined, "static": true, - "type": "ClassProperty", + "type": "PropertyDefinition", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -485,13 +491,14 @@ Object { "line": 8, }, }, + "override": false, "range": Array [ 223, 268, ], "readonly": true, "static": true, - "type": "ClassProperty", + "type": "PropertyDefinition", "typeAnnotation": Object { "loc": Object { "end": Object { 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 175efb44864f..8c358d12d205 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 @@ -38,13 +38,14 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 12, 23, ], "readonly": undefined, "static": false, - "type": "ClassProperty", + "type": "PropertyDefinition", "typeAnnotation": Object { "loc": Object { "end": Object { 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 c74dc1277b74..274ac4ac7c7c 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 @@ -37,6 +37,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 16, 54, @@ -90,6 +91,7 @@ Object { "line": 2, }, }, + "override": undefined, "parameter": Object { "loc": Object { "end": Object { 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 83f8801a83f7..517d5dd3e62a 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 @@ -37,6 +37,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 14, 34, 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 046a4f06f730..504612e7858d 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 @@ -37,6 +37,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 14, 28, 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 cd01d383d9b4..84f1c8825bcb 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 @@ -37,6 +37,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 12, 29, @@ -149,6 +150,7 @@ Object { "line": 3, }, }, + "override": false, "range": Array [ 32, 44, @@ -283,6 +285,7 @@ Object { "line": 4, }, }, + "override": false, "range": Array [ 47, 55, 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 7b2f8e4f53c4..1fd54885c280 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 @@ -376,6 +376,7 @@ Object { }, }, "optional": true, + "override": false, "range": Array [ 123, 138, @@ -438,6 +439,7 @@ Object { }, }, "optional": true, + "override": false, "range": Array [ 141, 158, @@ -518,6 +520,7 @@ Object { }, }, "optional": true, + "override": false, "range": Array [ 162, 169, @@ -581,6 +584,7 @@ Object { }, }, "optional": true, + "override": false, "range": Array [ 172, 181, @@ -661,6 +665,7 @@ Object { }, }, "optional": true, + "override": false, "range": Array [ 185, 201, @@ -724,6 +729,7 @@ Object { }, }, "optional": true, + "override": false, "range": Array [ 204, 222, @@ -840,6 +846,7 @@ Object { }, }, "optional": true, + "override": false, "range": Array [ 226, 244, @@ -956,6 +963,7 @@ Object { }, }, "optional": true, + "override": false, "range": Array [ 248, 265, @@ -1037,6 +1045,7 @@ Object { }, }, "optional": true, + "override": false, "range": Array [ 268, 279, 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 6271f111aee6..13e6452c8591 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 @@ -40,13 +40,14 @@ Object { }, }, "optional": true, + "override": false, "range": Array [ 14, 43, ], "readonly": undefined, "static": false, - "type": "ClassProperty", + "type": "PropertyDefinition", "value": Object { "loc": Object { "end": Object { 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 d237d0e252e2..5ad7ce5d913b 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 @@ -38,6 +38,7 @@ Object { }, }, "optional": true, + "override": false, "range": Array [ 14, 21, @@ -100,6 +101,7 @@ Object { }, }, "optional": true, + "override": false, "range": Array [ 24, 39, @@ -197,6 +199,7 @@ Object { }, }, "optional": true, + "override": false, "range": Array [ 42, 65, 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 17ec5f652f82..048f000b9e2f 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 @@ -186,13 +186,14 @@ Object { }, }, "optional": true, + "override": false, "range": Array [ 65, 70, ], "readonly": undefined, "static": false, - "type": "ClassProperty", + "type": "PropertyDefinition", "value": null, }, Object { @@ -227,13 +228,14 @@ Object { }, }, "optional": true, + "override": false, "range": Array [ 73, 87, ], "readonly": undefined, "static": false, - "type": "ClassProperty", + "type": "PropertyDefinition", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -303,13 +305,14 @@ Object { }, }, "optional": true, + "override": false, "range": Array [ 90, 112, ], "readonly": undefined, "static": false, - "type": "ClassProperty", + "type": "PropertyDefinition", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -378,13 +381,14 @@ Object { }, }, "optional": true, + "override": false, "range": Array [ 115, 127, ], "readonly": undefined, "static": false, - "type": "ClassProperty", + "type": "PropertyDefinition", "value": null, }, Object { @@ -420,13 +424,14 @@ Object { }, }, "optional": true, + "override": false, "range": Array [ 130, 143, ], "readonly": undefined, "static": false, - "type": "ClassProperty", + "type": "PropertyDefinition", "value": null, }, Object { @@ -462,13 +467,14 @@ Object { }, }, "optional": true, + "override": false, "range": Array [ 146, 151, ], "readonly": undefined, "static": false, - "type": "ClassProperty", + "type": "PropertyDefinition", "value": null, }, Object { @@ -503,13 +509,14 @@ Object { }, }, "optional": true, + "override": false, "range": Array [ 154, 175, ], "readonly": undefined, "static": false, - "type": "ClassProperty", + "type": "PropertyDefinition", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -579,13 +586,14 @@ Object { }, }, "optional": true, + "override": false, "range": Array [ 178, 200, ], "readonly": undefined, "static": false, - "type": "ClassProperty", + "type": "PropertyDefinition", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -655,13 +663,14 @@ Object { }, }, "optional": true, + "override": false, "range": Array [ 203, 216, ], "readonly": undefined, "static": false, - "type": "ClassProperty", + "type": "PropertyDefinition", "typeAnnotation": Object { "loc": Object { "end": Object { 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 2476b7468c66..c5fd8a1fd1aa 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 @@ -39,13 +39,14 @@ Object { }, }, "optional": true, + "override": false, "range": Array [ 12, 37, ], "readonly": undefined, "static": false, - "type": "ClassProperty", + "type": "PropertyDefinition", "value": Object { "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-override-method.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-override-method.src.ts.shot new file mode 100644 index 000000000000..e600ab918a51 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-override-method.src.ts.shot @@ -0,0 +1,413 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-with-override-method.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "show", + "range": Array [ + 62, + 66, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "override": true, + "range": Array [ + 53, + 87, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 69, + 87, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 66, + 87, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 49, + "line": 1, + }, + }, + "range": Array [ + 49, + 89, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "SpecializedComponent", + "range": Array [ + 6, + 26, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 89, + ], + "superClass": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "name": "SomeComponent", + "range": Array [ + 35, + 48, + ], + "type": "Identifier", + }, + "type": "ClassDeclaration", + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 77, + 83, + ], + "type": "Line", + "value": " ...", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 90, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 26, + ], + "type": "Identifier", + "value": "SpecializedComponent", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 34, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 48, + ], + "type": "Identifier", + "value": "SomeComponent", + }, + Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 1, + }, + "start": Object { + "column": 49, + "line": 1, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 53, + 61, + ], + "type": "Identifier", + "value": "override", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 62, + 66, + ], + "type": "Identifier", + "value": "show", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 67, + 68, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 86, + 87, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 88, + 89, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-override-property.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-override-property.src.ts.shot new file mode 100644 index 000000000000..49a33895f9d4 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-override-property.src.ts.shot @@ -0,0 +1,356 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-with-override-property.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "declare": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 62, + 65, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "override": true, + "range": Array [ + 53, + 70, + ], + "readonly": undefined, + "static": false, + "type": "PropertyDefinition", + "value": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 68, + 69, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 49, + "line": 1, + }, + }, + "range": Array [ + 49, + 72, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "SpecializedComponent", + "range": Array [ + 6, + 26, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 72, + ], + "superClass": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "name": "SomeComponent", + "range": Array [ + 35, + 48, + ], + "type": "Identifier", + }, + "type": "ClassDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 73, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 26, + ], + "type": "Identifier", + "value": "SpecializedComponent", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 34, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 48, + ], + "type": "Identifier", + "value": "SomeComponent", + }, + Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 1, + }, + "start": Object { + "column": 49, + "line": 1, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 53, + 61, + ], + "type": "Identifier", + "value": "override", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 62, + 65, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-private-optional-property.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-private-optional-property.src.ts.shot new file mode 100644 index 000000000000..dfb9b9557cdc --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-private-optional-property.src.ts.shot @@ -0,0 +1,690 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-with-private-optional-property.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "declare": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "prop", + "range": Array [ + 14, + 19, + ], + "type": "PrivateIdentifier", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": true, + "override": false, + "range": Array [ + 14, + 29, + ], + "readonly": undefined, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 20, + 28, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + Object { + "computed": false, + "declare": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "name": "propExplicitWithValue", + "range": Array [ + 32, + 54, + ], + "type": "PrivateIdentifier", + }, + "loc": Object { + "end": Object { + "column": 39, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "optional": true, + "override": false, + "range": Array [ + 32, + 69, + ], + "readonly": undefined, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 3, + }, + "start": Object { + "column": 25, + "line": 3, + }, + }, + "range": Array [ + 55, + 63, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 3, + }, + "start": Object { + "column": 27, + "line": 3, + }, + }, + "range": Array [ + 57, + 63, + ], + "type": "TSStringKeyword", + }, + }, + "value": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 3, + }, + "start": Object { + "column": 36, + "line": 3, + }, + }, + "range": Array [ + 66, + 68, + ], + "raw": "''", + "type": "Literal", + "value": "", + }, + }, + Object { + "computed": false, + "declare": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "name": "propImplicitWithValue", + "range": Array [ + 72, + 94, + ], + "type": "PrivateIdentifier", + }, + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "optional": true, + "override": false, + "range": Array [ + 72, + 101, + ], + "readonly": undefined, + "static": false, + "type": "PropertyDefinition", + "value": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 4, + }, + "start": Object { + "column": 28, + "line": 4, + }, + }, + "range": Array [ + 98, + 100, + ], + "raw": "''", + "type": "Literal", + "value": "", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 103, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 103, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 104, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 19, + ], + "type": "Identifier", + "value": "#prop", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 32, + 54, + ], + "type": "Identifier", + "value": "#propExplicitWithValue", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 3, + }, + "start": Object { + "column": 25, + "line": 3, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 3, + }, + "start": Object { + "column": 27, + "line": 3, + }, + }, + "range": Array [ + 57, + 63, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 3, + }, + "start": Object { + "column": 34, + "line": 3, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 3, + }, + "start": Object { + "column": 36, + "line": 3, + }, + }, + "range": Array [ + 66, + 68, + ], + "type": "String", + "value": "''", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 3, + }, + "start": Object { + "column": 38, + "line": 3, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 72, + 94, + ], + "type": "Identifier", + "value": "#propImplicitWithValue", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 4, + }, + "start": Object { + "column": 24, + "line": 4, + }, + }, + "range": Array [ + 94, + 95, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 4, + }, + "start": Object { + "column": 26, + "line": 4, + }, + }, + "range": Array [ + 96, + 97, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 4, + }, + "start": Object { + "column": 28, + "line": 4, + }, + }, + "range": Array [ + 98, + 100, + ], + "type": "String", + "value": "''", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 30, + "line": 4, + }, + }, + "range": Array [ + 100, + 101, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 102, + 103, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-private-parameter-properties.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-private-parameter-properties.src.ts.shot index 7c4a92e3dafc..72e5749ba0f1 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 @@ -37,6 +37,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 14, 201, @@ -90,6 +91,7 @@ Object { "line": 2, }, }, + "override": undefined, "parameter": Object { "loc": Object { "end": Object { @@ -163,6 +165,7 @@ Object { "line": 3, }, }, + "override": undefined, "parameter": Object { "loc": Object { "end": Object { @@ -236,6 +239,7 @@ Object { "line": 4, }, }, + "override": undefined, "parameter": Object { "left": Object { "loc": Object { @@ -345,6 +349,7 @@ Object { "line": 5, }, }, + "override": undefined, "parameter": Object { "left": Object { "loc": Object { 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 595df343e1d0..1705e340f45f 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 @@ -37,13 +37,14 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 14, 55, ], "readonly": undefined, "static": false, - "type": "ClassProperty", + "type": "PropertyDefinition", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -220,13 +221,14 @@ Object { "line": 3, }, }, + "override": false, "range": Array [ 58, 83, ], "readonly": undefined, "static": false, - "type": "ClassProperty", + "type": "PropertyDefinition", "typeAnnotation": Object { "loc": Object { "end": Object { 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 a8ed19456ca1..a2238f57f0db 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 @@ -37,13 +37,14 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 14, 20, ], "readonly": undefined, "static": false, - "type": "ClassProperty", + "type": "PropertyDefinition", "value": Object { "loc": Object { "end": Object { @@ -95,13 +96,14 @@ Object { "line": 3, }, }, + "override": false, "range": Array [ 23, 30, ], "readonly": undefined, "static": false, - "type": "ClassProperty", + "type": "PropertyDefinition", "value": Object { "loc": Object { "end": Object { @@ -152,13 +154,14 @@ Object { "line": 4, }, }, + "override": false, "range": Array [ 33, 40, ], "readonly": undefined, "static": false, - "type": "ClassProperty", + "type": "PropertyDefinition", "value": Object { "elements": Array [], "loc": Object { @@ -209,13 +212,14 @@ Object { "line": 5, }, }, + "override": false, "range": Array [ 43, 50, ], "readonly": undefined, "static": false, - "type": "ClassProperty", + "type": "PropertyDefinition", "value": Object { "loc": Object { "end": Object { @@ -267,13 +271,14 @@ Object { "line": 6, }, }, + "override": false, "range": Array [ 53, 80, ], "readonly": undefined, "static": false, - "type": "ClassProperty", + "type": "PropertyDefinition", "value": Object { "arguments": Array [ Object { 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 346ba40bd7ad..7e87ef2df91e 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 @@ -37,6 +37,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 14, 209, @@ -90,6 +91,7 @@ Object { "line": 2, }, }, + "override": undefined, "parameter": Object { "loc": Object { "end": Object { @@ -163,6 +165,7 @@ Object { "line": 3, }, }, + "override": undefined, "parameter": Object { "loc": Object { "end": Object { @@ -236,6 +239,7 @@ Object { "line": 4, }, }, + "override": undefined, "parameter": Object { "left": Object { "loc": Object { @@ -345,6 +349,7 @@ Object { "line": 5, }, }, + "override": undefined, "parameter": Object { "left": Object { "loc": Object { 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 260d52aa88ba..363608735e5e 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 @@ -37,6 +37,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 14, 197, @@ -90,6 +91,7 @@ Object { "line": 2, }, }, + "override": undefined, "parameter": Object { "loc": Object { "end": Object { @@ -163,6 +165,7 @@ Object { "line": 3, }, }, + "override": undefined, "parameter": Object { "loc": Object { "end": Object { @@ -236,6 +239,7 @@ Object { "line": 4, }, }, + "override": undefined, "parameter": Object { "left": Object { "loc": Object { @@ -345,6 +349,7 @@ Object { "line": 5, }, }, + "override": undefined, "parameter": Object { "left": Object { "loc": Object { 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 7e14ba2d579a..225de104f5ed 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 @@ -37,6 +37,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 14, 107, @@ -90,6 +91,7 @@ Object { "line": 2, }, }, + "override": undefined, "parameter": Object { "loc": Object { "end": Object { @@ -163,6 +165,7 @@ Object { "line": 3, }, }, + "override": undefined, "parameter": Object { "left": Object { "loc": Object { 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 492e45c6ed15..c3fc1acb2af1 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 @@ -38,13 +38,14 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 16, 47, ], "readonly": true, "static": false, - "type": "ClassProperty", + "type": "PropertyDefinition", "value": Object { "loc": Object { "end": Object { 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 93e74b00c341..9287f9c1d21c 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 @@ -37,6 +37,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 16, 54, @@ -90,6 +91,7 @@ Object { "line": 2, }, }, + "override": undefined, "parameter": Object { "loc": Object { "end": Object { 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 f8804948fa08..abf1f5816b2e 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 @@ -38,6 +38,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 12, 44, @@ -207,6 +208,7 @@ Object { "line": 5, }, }, + "override": false, "range": Array [ 48, 82, 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 aae22750797f..134b75cb5fe4 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 @@ -38,6 +38,7 @@ Object { }, }, "optional": true, + "override": false, "range": Array [ 24, 36, 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 cfcdd7ad177e..d77785922709 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 @@ -27,6 +27,7 @@ Object { ], "type": "Identifier", }, + "kind": "method", "loc": Object { "end": Object { "column": 18, 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 9dd23441d108..99c14c70ea9b 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 @@ -22,6 +22,7 @@ Object { ], "type": "Identifier", }, + "importKind": "value", "isExport": false, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/import-equal-type-declaration.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/import-equal-type-declaration.src.ts.shot new file mode 100644 index 000000000000..1e5a56be081c --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/import-equal-type-declaration.src.ts.shot @@ -0,0 +1,262 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics import-equal-type-declaration.src 1`] = ` +Object { + "body": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + }, + "importKind": "type", + "isExport": false, + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "moduleReference": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 31, + ], + "raw": "'bar'", + "type": "Literal", + "value": "bar", + }, + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 32, + ], + "type": "TSExternalModuleReference", + }, + "range": Array [ + 0, + 33, + ], + "type": "TSImportEqualsDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 34, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 11, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 25, + ], + "type": "Identifier", + "value": "require", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 31, + ], + "type": "String", + "value": "'bar'", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/import-export-equal-declaration.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/import-export-equal-declaration.src.ts.shot index 7c39128056b5..ac4b760010d0 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 @@ -22,6 +22,7 @@ Object { ], "type": "Identifier", }, + "importKind": "value", "isExport": true, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/import-export-equal-type-declaration.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/import-export-equal-type-declaration.src.ts.shot new file mode 100644 index 000000000000..f5763d6fe01c --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/import-export-equal-type-declaration.src.ts.shot @@ -0,0 +1,280 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics import-export-equal-type-declaration.src 1`] = ` +Object { + "body": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + }, + "importKind": "type", + "isExport": true, + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "moduleReference": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 38, + ], + "raw": "'bar'", + "type": "Literal", + "value": "bar", + }, + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 39, + ], + "type": "TSExternalModuleReference", + }, + "range": Array [ + 0, + 40, + ], + "type": "TSImportEqualsDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 41, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 13, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 18, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 32, + ], + "type": "Identifier", + "value": "require", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 38, + ], + "type": "String", + "value": "'bar'", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/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 af58d87e382b..dece748c4b2d 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 @@ -431,6 +431,7 @@ Object { ], "type": "Identifier", }, + "kind": "method", "loc": Object { "end": Object { "column": 16, @@ -502,6 +503,7 @@ Object { ], "type": "Identifier", }, + "kind": "method", "loc": Object { "end": Object { "column": 24, @@ -629,6 +631,7 @@ Object { ], "type": "Identifier", }, + "kind": "method", "loc": Object { "end": Object { "column": 26, @@ -756,6 +759,7 @@ Object { ], "type": "Identifier", }, + "kind": "method", "loc": Object { "end": Object { "column": 26, 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 6f1327b0808f..75ad28bb7599 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 @@ -31,6 +31,7 @@ Object { "line": 2, }, }, + "override": undefined, "parameter": Object { "loc": Object { "end": Object { @@ -70,6 +71,7 @@ Object { "line": 2, }, }, + "override": undefined, "parameter": Object { "loc": Object { "end": Object { 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 c20b0a2d981f..c4299c7644cb 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 @@ -26,6 +26,7 @@ Object { ], "type": "Identifier", }, + "kind": "method", "loc": Object { "end": Object { "column": 13, 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 537cc8b236fb..f94e34982985 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 @@ -26,6 +26,7 @@ Object { ], "type": "Identifier", }, + "kind": "method", "loc": Object { "end": Object { "column": 23, @@ -150,6 +151,7 @@ Object { ], "type": "Identifier", }, + "kind": "method", "loc": Object { "end": Object { "column": 18, 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 df83385dd287..f0d57792836c 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 @@ -143,6 +143,7 @@ Object { ], "type": "Identifier", }, + "kind": "method", "loc": Object { "end": Object { "column": 34, 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 74d752f2a03d..d32cb99e1aab 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 @@ -4085,6 +4085,7 @@ Object { "line": 71, }, }, + "override": false, "range": Array [ 987, 1000, @@ -4164,6 +4165,7 @@ Object { "line": 72, }, }, + "override": false, "range": Array [ 1003, 1017, @@ -4243,6 +4245,7 @@ Object { "line": 73, }, }, + "override": false, "range": Array [ 1020, 1033, @@ -4322,6 +4325,7 @@ Object { "line": 74, }, }, + "override": false, "range": Array [ 1036, 1075, 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 1bf761bae134..4373bd4bb671 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 @@ -344,13 +344,14 @@ Object { "line": 7, }, }, + "override": false, "range": Array [ 68, 79, ], "readonly": undefined, "static": false, - "type": "ClassProperty", + "type": "PropertyDefinition", "value": Object { "loc": Object { "end": Object { 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 06266e5337e8..8cbbcfed1d51 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 @@ -26,6 +26,7 @@ Object { ], "type": "Identifier", }, + "kind": "method", "loc": Object { "end": Object { "column": 36, 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 c48954cc2b5f..8f61a28350af 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 @@ -37,6 +37,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 21, 60, @@ -187,13 +188,14 @@ Object { "line": 5, }, }, + "override": false, "range": Array [ 63, 108, ], "readonly": undefined, "static": false, - "type": "ClassProperty", + "type": "PropertyDefinition", "value": Object { "async": false, "body": Object { 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 eae142407996..a26782c10731 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 @@ -26,6 +26,7 @@ Object { ], "type": "Identifier", }, + "kind": "method", "loc": Object { "end": Object { "column": 46, 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 64d58b576c30..abfccafd6245 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 @@ -37,6 +37,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 21, 70, @@ -220,13 +221,14 @@ Object { "line": 5, }, }, + "override": false, "range": Array [ 73, 128, ], "readonly": undefined, "static": false, - "type": "ClassProperty", + "type": "PropertyDefinition", "value": Object { "async": false, "body": Object { 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 ff60f3be6e95..a7723369960b 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 @@ -26,6 +26,7 @@ Object { ], "type": "Identifier", }, + "kind": "method", "loc": Object { "end": Object { "column": 38, 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 d8cef033d200..9d4fe4c33ca7 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 @@ -37,6 +37,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 14, 75, @@ -272,13 +273,14 @@ Object { "line": 5, }, }, + "override": false, "range": Array [ 78, 145, ], "readonly": undefined, "static": false, - "type": "ClassProperty", + "type": "PropertyDefinition", "value": Object { "async": false, "body": Object { 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 80034787fcbe..50ce8ec40fd5 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 @@ -37,13 +37,14 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 26, 75, ], "readonly": undefined, "static": false, - "type": "ClassProperty", + "type": "PropertyDefinition", "typeAnnotation": Object { "loc": Object { "end": Object { 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 eefbf73554f3..a175d632669d 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 @@ -69,6 +69,7 @@ Object { ], "type": "Identifier", }, + "kind": "method", "loc": Object { "end": Object { "column": 23, @@ -193,6 +194,7 @@ Object { ], "type": "Identifier", }, + "kind": "method", "loc": Object { "end": Object { "column": 18, 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 10ab794d02d7..bfd4fd36e9e7 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 @@ -26,6 +26,7 @@ Object { ], "type": "Identifier", }, + "kind": "method", "loc": Object { "end": Object { "column": 65, 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 b077180d0075..805be00cc768 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 @@ -113,6 +113,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 18, 70, 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 a5af5b716047..e977890dec49 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 @@ -171,6 +171,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 18, 80, 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 915ef296e492..8eb7ac9e21ce 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 @@ -74,6 +74,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 14, 53, 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 495eb8857caa..604fffa67a52 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 @@ -74,6 +74,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 17, 76, 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 b61cfff3e6df..108b09f249c5 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 @@ -113,6 +113,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 14, 54, 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 57042fcf265c..c3429eb4f45a 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 @@ -113,6 +113,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 14, 54, 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 6aeafa9a643e..c73b273260c6 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 @@ -74,6 +74,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 14, 47, 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 1d859f1e6fb8..9afc61f6df0a 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 @@ -74,6 +74,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 14, 47, 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 77cd44fb8b1a..49db6673b5a6 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 @@ -37,6 +37,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 14, 49, 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 33b297d36cb5..400c54bbc485 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 @@ -37,6 +37,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 20, 113, 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 9412305d441b..237d94425218 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 @@ -37,6 +37,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 16, 50, 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 eb89d6731f66..6e982f368f31 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 @@ -37,6 +37,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 22, 63, 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 6fb2cba87e84..9e20b12a0952 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 @@ -37,6 +37,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 20, 95, 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 80d5d32e31b8..e12ff3fa8198 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 @@ -37,6 +37,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 26, 108, 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 f2713ac584ba..69ad340de2a9 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 @@ -37,6 +37,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 14, 49, 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 561cb43be3e7..7f77443e46db 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 @@ -37,6 +37,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 14, 48, 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 1b372fff159b..2dec783b8b49 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 @@ -93,13 +93,14 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 26, 40, ], "readonly": undefined, "static": false, - "type": "ClassProperty", + "type": "PropertyDefinition", "value": null, }, Object { @@ -189,13 +190,14 @@ Object { "line": 3, }, }, + "override": false, "range": Array [ 45, 86, ], "readonly": undefined, "static": false, - "type": "ClassProperty", + "type": "PropertyDefinition", "value": Object { "arguments": Array [], "callee": Object { 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 6b252b1c09d2..53043405565c 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 @@ -113,13 +113,14 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 14, 47, ], "readonly": undefined, "static": true, - "type": "ClassProperty", + "type": "PropertyDefinition", "value": null, }, Object { @@ -229,13 +230,14 @@ Object { "line": 4, }, }, + "override": false, "range": Array [ 53, 91, ], "readonly": undefined, "static": true, - "type": "ClassProperty", + "type": "PropertyDefinition", "value": null, }, ], 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 ba40f39773e9..95ccdf95a30a 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 @@ -74,13 +74,14 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 14, 21, ], "readonly": undefined, "static": false, - "type": "ClassProperty", + "type": "PropertyDefinition", "value": null, }, Object { @@ -151,13 +152,14 @@ Object { "line": 3, }, }, + "override": false, "range": Array [ 26, 37, ], "readonly": undefined, "static": false, - "type": "ClassProperty", + "type": "PropertyDefinition", "value": null, }, ], 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 5a73d6a5bb2e..60c9860bfd0b 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 @@ -74,13 +74,14 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 14, 28, ], "readonly": undefined, "static": true, - "type": "ClassProperty", + "type": "PropertyDefinition", "value": null, }, Object { @@ -151,13 +152,14 @@ Object { "line": 3, }, }, + "override": false, "range": Array [ 33, 51, ], "readonly": undefined, "static": true, - "type": "ClassProperty", + "type": "PropertyDefinition", "value": null, }, ], 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 772f87aee45b..235dee9fe7c3 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 @@ -37,6 +37,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 14, 32, 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 471b29c33cd9..bb110cf05755 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 @@ -26,6 +26,7 @@ Object { ], "type": "Identifier", }, + "kind": "method", "loc": Object { "end": Object { "column": 11, 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 0a3526674416..3233906e5cc4 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 @@ -37,6 +37,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 14, 25, 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 2a93eb27f3d4..8eb4625590f3 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 @@ -50,7 +50,6 @@ Object { 7, 14, ], - "transformFlags": 1, "type": "TSPrivateKeyword", }, Object { @@ -68,7 +67,6 @@ Object { 15, 21, ], - "transformFlags": 1, "type": "TSPublicKeyword", }, Object { @@ -86,7 +84,6 @@ Object { 22, 31, ], - "transformFlags": 1, "type": "TSProtectedKeyword", }, Object { @@ -104,7 +101,6 @@ Object { 32, 38, ], - "transformFlags": 256, "type": "TSStaticKeyword", }, Object { @@ -122,7 +118,6 @@ Object { 39, 47, ], - "transformFlags": 1, "type": "TSReadonlyKeyword", }, Object { @@ -157,7 +152,6 @@ Object { 57, 62, ], - "transformFlags": 96, "type": "TSAsyncKeyword", }, ], 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 2827b9747e8e..49552e632b94 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 @@ -27,6 +27,7 @@ Object { ], "type": "Identifier", }, + "kind": "method", "loc": Object { "end": Object { "column": 32, 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 6c4af2099000..0b2fc02bfd56 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 @@ -27,6 +27,7 @@ Object { ], "type": "Identifier", }, + "kind": "method", "loc": Object { "end": Object { "column": 33, 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 e5159f9940b8..1826aeadf4e4 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 @@ -27,6 +27,7 @@ Object { ], "type": "Identifier", }, + "kind": "method", "loc": Object { "end": Object { "column": 33, 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 5a2b17449608..114bd1a78112 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 @@ -27,6 +27,7 @@ Object { ], "type": "Identifier", }, + "kind": "method", "loc": Object { "end": Object { "column": 32, 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 521a3a4bcdc4..e1a82d8ecdaa 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 @@ -26,6 +26,7 @@ Object { ], "type": "Identifier", }, + "kind": "method", "loc": Object { "end": Object { "column": 32, 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 bdb4baa843a2..8aab33054a95 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 @@ -26,6 +26,7 @@ Object { ], "type": "Identifier", }, + "kind": "method", "loc": Object { "end": Object { "column": 30, 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 ccacf0893b45..70ff82a2ec71 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 @@ -41,6 +41,7 @@ Object { "line": 3, }, }, + "override": false, "range": Array [ 52, 66, 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 bd714fb2431e..c744f34b9000 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 @@ -135,6 +135,7 @@ Object { "line": 5, }, }, + "override": false, "range": Array [ 78, 129, @@ -188,6 +189,7 @@ Object { "line": 5, }, }, + "override": undefined, "parameter": Object { "loc": Object { "end": Object { @@ -261,6 +263,7 @@ Object { "line": 5, }, }, + "override": undefined, "parameter": Object { "loc": Object { "end": Object { 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 3c06676714fb..50f8f0f7ff82 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 @@ -78,38 +78,33 @@ Object { "elementType": Object { "loc": Object { "end": Object { - "column": 21, + "column": 20, "line": 2, }, "start": Object { - "column": 12, + "column": 13, "line": 2, }, }, "range": Array [ - 31, - 40, + 32, + 39, ], - "type": "TSParenthesizedType", - "typeAnnotation": Object { + "type": "TSInferType", + "typeParameter": Object { + "constraint": undefined, + "default": undefined, "loc": Object { "end": Object { "column": 20, "line": 2, }, "start": Object { - "column": 13, + "column": 19, "line": 2, }, }, - "range": Array [ - 32, - 39, - ], - "type": "TSInferType", - "typeParameter": Object { - "constraint": undefined, - "default": undefined, + "name": Object { "loc": Object { "end": Object { "column": 20, @@ -120,30 +115,18 @@ Object { "line": 2, }, }, - "name": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 19, - "line": 2, - }, - }, - "name": "U", - "range": Array [ - 38, - 39, - ], - "type": "Identifier", - }, + "name": "U", "range": Array [ 38, 39, ], - "type": "TSTypeParameter", + "type": "Identifier", }, + "range": Array [ + 38, + 39, + ], + "type": "TSTypeParameter", }, }, "loc": Object { 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 9054692bd03d..d55b6ac728e0 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 @@ -78,38 +78,33 @@ Object { "elementType": Object { "loc": Object { "end": Object { - "column": 37, + "column": 36, "line": 1, }, "start": Object { - "column": 28, + "column": 29, "line": 1, }, }, "range": Array [ - 28, - 37, + 29, + 36, ], - "type": "TSParenthesizedType", - "typeAnnotation": Object { + "type": "TSInferType", + "typeParameter": Object { + "constraint": undefined, + "default": undefined, "loc": Object { "end": Object { "column": 36, "line": 1, }, "start": Object { - "column": 29, + "column": 35, "line": 1, }, }, - "range": Array [ - 29, - 36, - ], - "type": "TSInferType", - "typeParameter": Object { - "constraint": undefined, - "default": undefined, + "name": Object { "loc": Object { "end": Object { "column": 36, @@ -120,30 +115,18 @@ Object { "line": 1, }, }, - "name": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - }, - "start": Object { - "column": 35, - "line": 1, - }, - }, - "name": "U", - "range": Array [ - 35, - 36, - ], - "type": "Identifier", - }, + "name": "U", "range": Array [ 35, 36, ], - "type": "TSTypeParameter", + "type": "Identifier", }, + "range": Array [ + 35, + 36, + ], + "type": "TSTypeParameter", }, }, "loc": 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 new file mode 100644 index 000000000000..02601964ea1b --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/interface-with-accessors.src.ts.shot @@ -0,0 +1,711 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types interface-with-accessors.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "name": "size", + "range": Array [ + 24, + 28, + ], + "type": "Identifier", + }, + "kind": "get", + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 20, + 39, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 30, + 38, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "TSNumberKeyword", + }, + }, + "type": "TSMethodSignature", + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "name": "size", + "range": Array [ + 46, + 50, + ], + "type": "Identifier", + }, + "kind": "set", + "loc": Object { + "end": Object { + "column": 45, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "name": "value", + "range": Array [ + 51, + 83, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 56, + 83, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 58, + 83, + ], + "type": "TSUnionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 58, + 64, + ], + "type": "TSNumberKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 3, + }, + "start": Object { + "column": 27, + "line": 3, + }, + }, + "range": Array [ + 67, + 73, + ], + "type": "TSStringKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 3, + }, + "start": Object { + "column": 36, + "line": 3, + }, + }, + "range": Array [ + 76, + 83, + ], + "type": "TSBooleanKeyword", + }, + ], + }, + }, + }, + ], + "range": Array [ + 42, + 85, + ], + "type": "TSMethodSignature", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 87, + ], + "type": "TSInterfaceBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Thing", + "range": Array [ + 10, + 15, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 87, + ], + "type": "TSInterfaceDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 88, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 15, + ], + "type": "Identifier", + "value": "Thing", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 20, + 23, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 24, + 28, + ], + "type": "Identifier", + "value": "size", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 42, + 45, + ], + "type": "Identifier", + "value": "set", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 46, + 50, + ], + "type": "Identifier", + "value": "size", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 51, + 56, + ], + "type": "Identifier", + "value": "value", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 58, + 64, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 3, + }, + "start": Object { + "column": 25, + "line": 3, + }, + }, + "range": Array [ + 65, + 66, + ], + "type": "Punctuator", + "value": "|", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 3, + }, + "start": Object { + "column": 27, + "line": 3, + }, + }, + "range": Array [ + 67, + 73, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 3, + }, + "start": Object { + "column": 34, + "line": 3, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "Punctuator", + "value": "|", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 3, + }, + "start": Object { + "column": 36, + "line": 3, + }, + }, + "range": Array [ + 76, + 83, + ], + "type": "Identifier", + "value": "boolean", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 3, + }, + "start": Object { + "column": 43, + "line": 3, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 3, + }, + "start": Object { + "column": 44, + "line": 3, + }, + }, + "range": Array [ + 84, + 85, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 86, + 87, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/object-literal-type-with-accessors.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/object-literal-type-with-accessors.src.ts.shot new file mode 100644 index 000000000000..df6ae88ba5d2 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/object-literal-type-with-accessors.src.ts.shot @@ -0,0 +1,747 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types object-literal-type-with-accessors.src 1`] = ` +Object { + "body": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Thing", + "range": Array [ + 5, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 2, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 85, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "members": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "name": "size", + "range": Array [ + 21, + 25, + ], + "type": "Identifier", + }, + "kind": "get", + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 17, + 36, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 27, + 35, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 29, + 35, + ], + "type": "TSNumberKeyword", + }, + }, + "type": "TSMethodSignature", + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "name": "size", + "range": Array [ + 43, + 47, + ], + "type": "Identifier", + }, + "kind": "set", + "loc": Object { + "end": Object { + "column": 45, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "name": "value", + "range": Array [ + 48, + 80, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 53, + 80, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 55, + 80, + ], + "type": "TSUnionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 55, + 61, + ], + "type": "TSNumberKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 3, + }, + "start": Object { + "column": 27, + "line": 3, + }, + }, + "range": Array [ + 64, + 70, + ], + "type": "TSStringKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 3, + }, + "start": Object { + "column": 36, + "line": 3, + }, + }, + "range": Array [ + 73, + 80, + ], + "type": "TSBooleanKeyword", + }, + ], + }, + }, + }, + ], + "range": Array [ + 39, + 82, + ], + "type": "TSMethodSignature", + }, + ], + "range": Array [ + 13, + 84, + ], + "type": "TSTypeLiteral", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 86, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 10, + ], + "type": "Identifier", + "value": "Thing", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 21, + 25, + ], + "type": "Identifier", + "value": "size", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 29, + 35, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 39, + 42, + ], + "type": "Identifier", + "value": "set", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 43, + 47, + ], + "type": "Identifier", + "value": "size", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 48, + 53, + ], + "type": "Identifier", + "value": "value", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 55, + 61, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 3, + }, + "start": Object { + "column": 25, + "line": 3, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": "|", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 3, + }, + "start": Object { + "column": 27, + "line": 3, + }, + }, + "range": Array [ + 64, + 70, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 3, + }, + "start": Object { + "column": 34, + "line": 3, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "Punctuator", + "value": "|", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 3, + }, + "start": Object { + "column": 36, + "line": 3, + }, + }, + "range": Array [ + 73, + 80, + ], + "type": "Identifier", + "value": "boolean", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 3, + }, + "start": Object { + "column": 43, + "line": 3, + }, + }, + "range": Array [ + 80, + 81, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 3, + }, + "start": Object { + "column": 44, + "line": 3, + }, + }, + "range": Array [ + 81, + 82, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 4, + }, + "start": Object { + "column": 1, + "line": 4, + }, + }, + "range": Array [ + 84, + 85, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/parenthesized-type.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/parenthesized-type.src.ts.shot index 7aa5ec4571d3..e029fb995167 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 @@ -40,72 +40,55 @@ Object { "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 28, + "column": 27, "line": 1, }, "start": Object { - "column": 11, + "column": 12, "line": 1, }, }, "range": Array [ - 11, - 28, + 12, + 27, ], - "type": "TSParenthesizedType", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, + "type": "TSUnionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, }, + "range": Array [ + 12, + 18, + ], + "type": "TSStringKeyword", }, - "range": Array [ - 12, - 27, - ], - "type": "TSUnionType", - "types": Array [ - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, }, - "range": Array [ - 12, - 18, - ], - "type": "TSStringKeyword", - }, - Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, + "start": Object { + "column": 21, + "line": 1, }, - "range": Array [ - 21, - 27, - ], - "type": "TSNumberKeyword", }, - ], - }, + "range": Array [ + 21, + 27, + ], + "type": "TSNumberKeyword", + }, + ], }, }, ], 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 4ae46a1f6155..5543bc1a3a01 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 @@ -38,13 +38,14 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 12, 29, ], "readonly": undefined, "static": false, - "type": "ClassProperty", + "type": "PropertyDefinition", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -113,6 +114,7 @@ Object { "line": 4, }, }, + "override": false, "range": Array [ 33, 91, @@ -351,6 +353,7 @@ Object { "line": 8, }, }, + "override": false, "range": Array [ 95, 149, @@ -608,6 +611,7 @@ Object { "line": 12, }, }, + "override": false, "range": Array [ 153, 237, @@ -960,6 +964,7 @@ Object { "line": 17, }, }, + "override": false, "range": Array [ 241, 322, @@ -1330,6 +1335,7 @@ Object { "line": 22, }, }, + "override": false, "range": Array [ 326, 387, @@ -1586,6 +1592,7 @@ Object { "line": 26, }, }, + "override": false, "range": Array [ 391, 449, 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 2709ff43b71d..d937da372065 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 @@ -37,6 +37,7 @@ Object { "line": 2, }, }, + "override": false, "range": Array [ 18, 54, 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 f07915f0394f..87f7351cba2a 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 @@ -151,72 +151,55 @@ Object { "elementType": Object { "loc": Object { "end": Object { - "column": 52, + "column": 51, "line": 1, }, "start": Object { - "column": 35, + "column": 36, "line": 1, }, }, "range": Array [ - 35, - 52, + 36, + 51, ], - "type": "TSParenthesizedType", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 51, - "line": 1, - }, - "start": Object { - "column": 36, - "line": 1, + "type": "TSUnionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, }, + "range": Array [ + 36, + 42, + ], + "type": "TSStringKeyword", }, - "range": Array [ - 36, - 51, - ], - "type": "TSUnionType", - "types": Array [ - Object { - "loc": Object { - "end": Object { - "column": 42, - "line": 1, - }, - "start": Object { - "column": 36, - "line": 1, - }, + Object { + "loc": Object { + "end": Object { + "column": 51, + "line": 1, }, - "range": Array [ - 36, - 42, - ], - "type": "TSStringKeyword", - }, - Object { - "loc": Object { - "end": Object { - "column": 51, - "line": 1, - }, - "start": Object { - "column": 45, - "line": 1, - }, + "start": Object { + "column": 45, + "line": 1, }, - "range": Array [ - 45, - 51, - ], - "type": "TSNumberKeyword", }, - ], - }, + "range": Array [ + 45, + 51, + ], + "type": "TSNumberKeyword", + }, + ], }, "label": Object { "loc": 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 55be898e6a54..b359d09d8895 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 @@ -111,72 +111,55 @@ Object { "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 42, + "column": 41, "line": 1, }, "start": Object { - "column": 25, + "column": 26, "line": 1, }, }, "range": Array [ - 25, - 42, + 26, + 41, ], - "type": "TSParenthesizedType", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 41, - "line": 1, - }, - "start": Object { - "column": 26, - "line": 1, + "type": "TSUnionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, }, + "range": Array [ + 26, + 32, + ], + "type": "TSStringKeyword", }, - "range": Array [ - 26, - 41, - ], - "type": "TSUnionType", - "types": Array [ - Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 1, - }, - "start": Object { - "column": 26, - "line": 1, - }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, }, - "range": Array [ - 26, - 32, - ], - "type": "TSStringKeyword", - }, - Object { - "loc": Object { - "end": Object { - "column": 41, - "line": 1, - }, - "start": Object { - "column": 35, - "line": 1, - }, + "start": Object { + "column": 35, + "line": 1, }, - "range": Array [ - 35, - 41, - ], - "type": "TSNumberKeyword", }, - ], - }, + "range": Array [ + 35, + 41, + ], + "type": "TSNumberKeyword", + }, + ], }, }, ], diff --git a/packages/typescript-estree/tools/test-utils.ts b/packages/typescript-estree/tools/test-utils.ts index 1b386be14498..65e1cb131e1d 100644 --- a/packages/typescript-estree/tools/test-utils.ts +++ b/packages/typescript-estree/tools/test-utils.ts @@ -1,11 +1,15 @@ -import * as parser from '../src'; -import { TSESTreeOptions } from '../src/parser-options'; +import type { + TSESTree, + TSESTreeOptions, + ParseAndGenerateServicesResult, +} from '../src'; +import { parse as parserParse, parseAndGenerateServices } from '../src'; export function parseCodeAndGenerateServices( code: string, config: TSESTreeOptions, -): parser.ParseAndGenerateServicesResult { - return parser.parseAndGenerateServices(code, config); +): ParseAndGenerateServicesResult { + return parseAndGenerateServices(code, config); } /** @@ -24,10 +28,10 @@ export function createSnapshotTestBlock( /** * @returns the AST object */ - function parse(): parser.TSESTree.Program { + function parse(): TSESTree.Program { const ast = generateServices - ? parser.parseAndGenerateServices(code, config).ast - : parser.parse(code, config); + ? parseAndGenerateServices(code, config).ast + : parserParse(code, config); return deeplyCopy(ast); } @@ -35,13 +39,13 @@ export function createSnapshotTestBlock( try { const result = parse(); expect(result).toMatchSnapshot(); - } catch (e) { + } catch (error) { /** * If we are deliberately throwing because of encountering an unknown * AST_NODE_TYPE, we rethrow to cause the test to fail */ - if (e.message.match('Unknown AST_NODE_TYPE')) { - throw new Error(e); + if (/Unknown AST_NODE_TYPE/.exec((error as Error).message)) { + throw error; } expect(parse).toThrowErrorMatchingSnapshot(); } @@ -127,7 +131,7 @@ export function omitDeep( continue; } - const child = node[prop]; + const child = node[prop] as UnknownObject | UnknownObject[]; if (Array.isArray(child)) { const value = []; for (const el of child) { diff --git a/packages/typescript-estree/typings/typescript.d.ts b/packages/typescript-estree/typings/typescript.d.ts index 5034447253b4..a247b2808841 100644 --- a/packages/typescript-estree/typings/typescript.d.ts +++ b/packages/typescript-estree/typings/typescript.d.ts @@ -1,8 +1,13 @@ import 'typescript'; +// these additions are marked as internal to typescript declare module 'typescript' { interface SourceFile { - // this is marked as internal to typescript externalModuleIndicator?: Node; + parseDiagnostics: DiagnosticWithLocation[]; + } + + interface JSDocContainer { + jsDoc?: JSDoc[]; } } diff --git a/packages/visitor-keys/CHANGELOG.md b/packages/visitor-keys/CHANGELOG.md index e0ecce16f417..27a7b5a9b4c1 100644 --- a/packages/visitor-keys/CHANGELOG.md +++ b/packages/visitor-keys/CHANGELOG.md @@ -3,6 +3,287 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.2.0...v5.3.0) (2021-11-01) + +**Note:** Version bump only for package @typescript-eslint/visitor-keys + + + + + +# [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/visitor-keys + + + + + +# [5.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.0.0...v5.1.0) (2021-10-18) + +**Note:** Version bump only for package @typescript-eslint/visitor-keys + + + + + +# [5.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.33.0...v5.0.0) (2021-10-11) + + +### Features + +* 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 `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 `PrivateIdentifier` ([#3808](https://github.com/typescript-eslint/typescript-eslint/issues/3808)) ([0eefe5e](https://github.com/typescript-eslint/typescript-eslint/commit/0eefe5e49d21af3f1e3e2d9a90c2e49929863ac2)), closes [#3430](https://github.com/typescript-eslint/typescript-eslint/issues/3430) [#2933](https://github.com/typescript-eslint/typescript-eslint/issues/2933) +* **eslint-plugin:** removed value from abstract property nodes ([#3765](https://github.com/typescript-eslint/typescript-eslint/issues/3765)) ([5823524](https://github.com/typescript-eslint/typescript-eslint/commit/58235241714596b641a1e8b39c569e561e0039b4)), closes [#3748](https://github.com/typescript-eslint/typescript-eslint/issues/3748) + + + + + +# [4.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.32.0...v4.33.0) (2021-10-04) + +**Note:** Version bump only for package @typescript-eslint/visitor-keys + + + + + +# [4.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.2...v4.32.0) (2021-09-27) + +**Note:** Version bump only for package @typescript-eslint/visitor-keys + + + + + +## [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/visitor-keys + + + + + +## [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/visitor-keys + + + + + +# [4.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.30.0...v4.31.0) (2021-09-06) + +**Note:** Version bump only for package @typescript-eslint/visitor-keys + + + + + +# [4.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.3...v4.30.0) (2021-08-30) + + +### Bug Fixes + +* **visitor-keys:** add key to StaticBlock (v5) ([#3812](https://github.com/typescript-eslint/typescript-eslint/issues/3812)) ([fa35e22](https://github.com/typescript-eslint/typescript-eslint/commit/fa35e22702207baf07acb3eec11d3383721bf6b6)) + + +### Features + +* **typescript-estree:** add support for class static blocks ([#3730](https://github.com/typescript-eslint/typescript-eslint/issues/3730)) ([f81831b](https://github.com/typescript-eslint/typescript-eslint/commit/f81831bd279a32da6dbab0f1c061053ea43965f6)) + + + + + +## [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/visitor-keys + + + + + +## [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/visitor-keys + + + + + +## [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/visitor-keys + + + + + +# [4.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.5...v4.29.0) (2021-08-02) + +**Note:** Version bump only for package @typescript-eslint/visitor-keys + + + + + +## [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/visitor-keys + + + + + +## [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/visitor-keys + + + + + +## [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/visitor-keys + + + + + +## [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/visitor-keys + + + + + +## [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/visitor-keys + + + + + +# [4.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.27.0...v4.28.0) (2021-06-21) + +**Note:** Version bump only for package @typescript-eslint/visitor-keys + + + + + +# [4.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.1...v4.27.0) (2021-06-14) + +**Note:** Version bump only for package @typescript-eslint/visitor-keys + + + + + +## [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/visitor-keys + + + + + +# [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/visitor-keys + + + + + +# [4.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.24.0...v4.25.0) (2021-05-24) + +**Note:** Version bump only for package @typescript-eslint/visitor-keys + + + + + +# [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/visitor-keys + + + + + +# [4.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.1...v4.23.0) (2021-05-10) + + +### Features + +* 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/visitor-keys + + + + + +# [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/visitor-keys + + + + + +# [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/visitor-keys + + + + + +# [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/visitor-keys + + + + + +# [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/visitor-keys + + + + + +# [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/visitor-keys + + + + + +# [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/visitor-keys + + + + + ## [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/visitor-keys diff --git a/packages/visitor-keys/package.json b/packages/visitor-keys/package.json index 4287d36b0c8f..7c95d675ac25 100644 --- a/packages/visitor-keys/package.json +++ b/packages/visitor-keys/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/visitor-keys", - "version": "4.16.1", + "version": "5.3.0", "description": "Visitor keys used to help traverse the TypeScript-ESTree AST", "keywords": [ "eslint", @@ -8,7 +8,7 @@ "estree" ], "engines": { - "node": "^8.10.0 || ^10.13.0 || >=11.10.1" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "files": [ "dist", @@ -31,15 +31,15 @@ "build": "tsc -b tsconfig.build.json", "postbuild": "downlevel-dts dist _ts3.4/dist", "clean": "tsc -b tsconfig.build.json --clean", - "postclean": "rimraf dist", + "postclean": "rimraf dist && rimraf _ts3.4 && rimraf coverage", "format": "prettier --write \"./**/*.{ts,js,json,md}\" --ignore-path ../../.prettierignore", "lint": "eslint . --ext .js,.ts --ignore-path='../../.eslintignore'", "test": "jest --coverage", "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/types": "4.16.1", - "eslint-visitor-keys": "^2.0.0" + "@typescript-eslint/types": "5.3.0", + "eslint-visitor-keys": "^3.0.0" }, "devDependencies": { "@types/eslint-visitor-keys": "*" diff --git a/packages/visitor-keys/project.json b/packages/visitor-keys/project.json new file mode 100644 index 000000000000..e531f19f69d2 --- /dev/null +++ b/packages/visitor-keys/project.json @@ -0,0 +1,5 @@ +{ + "root": "packages/visitor-keys", + "type": "library", + "implicitDependencies": [] +} diff --git a/packages/visitor-keys/src/visitor-keys.ts b/packages/visitor-keys/src/visitor-keys.ts index 1f2363e948ec..bd1f3186d839 100644 --- a/packages/visitor-keys/src/visitor-keys.ts +++ b/packages/visitor-keys/src/visitor-keys.ts @@ -48,8 +48,10 @@ const additionalKeys: AdditionalKeys = { MethodDefinition: ['decorators', 'key', 'value'], NewExpression: ['callee', 'typeParameters', 'arguments'], ObjectPattern: ['decorators', 'properties', 'typeAnnotation'], + PropertyDefinition: ['decorators', 'key', 'typeAnnotation', 'value'], RestElement: ['decorators', 'argument', 'typeAnnotation'], TaggedTemplateExpression: ['tag', 'typeParameters', 'quasi'], + StaticBlock: ['body'], // JSX JSXOpeningElement: ['name', 'typeParameters', 'attributes'], @@ -58,13 +60,12 @@ const additionalKeys: AdditionalKeys = { JSXSpreadChild: ['expression'], // Additional Nodes. - ClassProperty: ['decorators', 'key', 'typeAnnotation', 'value'], Decorator: ['expression'], // TS-prefixed nodes - TSAbstractClassProperty: ['decorators', 'key', 'typeAnnotation', 'value'], TSAbstractKeyword: [], TSAbstractMethodDefinition: ['key', 'value'], + TSAbstractPropertyDefinition: ['decorators', 'key', 'typeAnnotation'], TSAnyKeyword: [], TSArrayType: ['elementType'], TSAsExpression: ['expression', 'typeAnnotation'], @@ -114,7 +115,6 @@ const additionalKeys: AdditionalKeys = { TSObjectKeyword: [], TSOptionalType: ['typeAnnotation'], TSParameterProperty: ['decorators', 'parameter'], - TSParenthesizedType: ['typeAnnotation'], TSPrivateKeyword: [], TSPropertySignature: ['typeAnnotation', 'key', 'initializer'], TSProtectedKeyword: [], diff --git a/tests/integration/README.md b/tests/integration/README.md index a1f39ca6eb21..689dca292110 100644 --- a/tests/integration/README.md +++ b/tests/integration/README.md @@ -2,19 +2,30 @@ We have a set of integration tests defined in this project to help ensure we don't inadvertently break downstream packages that depend on us. -These tests are setup to run within docker containers to ensure that each test is completely isolated; we don't want them to affect our local environment, and similarly we don't want them to be effected by our local environment. +These tests are setup to run within temporary folders to ensure that each test is isolated from the project. ## Adding a new integration test -1. [Install docker for your platform](https://docs.docker.com/v17.09/engine/installation/#supported-platforms). 1. Add a new folder in `/tests/integration/fixtures` -1. Add a `.eslintrc.yml`, and a `tsconfig.json` to your folder, with the config required. +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. + - If you have no dependencies, just add `"devDependencies": {}`. +1. Add a `.eslintrc.js`, and a `tsconfig.json` to your folder, with all of the config required. 1. Create the necessary files to test the integration. -1. Copy+paste the `Dockerfile` from an existing fixture (they are all the same). -1. Copy+paste the `test.sh` from an existing fixture, and adjust the `eslint` command as required. -1. Add a new entry to `docker-compose.yml` by copy+pasting an existing section, and changing the name to match your new folder. -1. Add a new entry to `run-all-tests.sh` by copy+pasting an existing command, and changing the name to match your new folder. -1. Run your integration test by running the single command you copied in the previous step. - - If your test finishes successfully, a `test.js.snap` will be created. + - 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. Paste the following content into your test: -If you run your test and see the test fail with `Cannot find module './lint-output.json' from 'test.js'`, this means that ESLint errored whilst attempting to run the lint command. + ```ts + import { integrationTest } from '../integration-test-base'; + + integrationTest( + __filename, + '*.ts' /* UPDATE THIS TO THE EXTENSION(s) TO LINT */, + ); + ``` + +1. Run your integration test with `yarn test-integration ./tests/integration/tests/your-file.test.ts` + - This will generate your snapshot output for the lint run which is a JSON representation of your ESLint run. diff --git a/tests/integration/docker-compose.yml b/tests/integration/docker-compose.yml deleted file mode 100644 index abe82a67cfb6..000000000000 --- a/tests/integration/docker-compose.yml +++ /dev/null @@ -1,154 +0,0 @@ -version: '3' - -services: - typescript-and-tslint-plugins-together: - build: ./fixtures/typescript-and-tslint-plugins-together - container_name: 'typescript-and-tslint-plugins-together' - volumes: - # Runtime link to the relevant built @typescript-eslint packages and integration 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/experimental-utils/:/usr/experimental-utils - - /usr/experimental-utils/tests - - ../../packages/eslint-plugin/:/usr/eslint-plugin - - /usr/eslint-plugin/tests - - ../../packages/eslint-plugin-tslint/:/usr/eslint-plugin-tslint - - /usr/eslint-plugin-tslint/tests - - ../../packages/types/:/usr/types - - /usr/types/tests - - ../../packages/visitor-keys/:/usr/visitor-keys - - /usr/types/visitor-keys - - ../../packages/scope-manager/:/usr/scope-manager - - /usr/types/scope-manager - # Runtime link to all the specific integration test files, so that most updates don't require a rebuild. - - ./fixtures/typescript-and-tslint-plugins-together:/usr/linked - - vue-sfc: - build: ./fixtures/vue-sfc - container_name: 'vue-sfc' - volumes: - # Runtime link to the relevant built @typescript-eslint packages and integration 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/experimental-utils/:/usr/experimental-utils - - /usr/experimental-utils/tests - - ../../packages/eslint-plugin/:/usr/eslint-plugin - - /usr/eslint-plugin/tests - - ../../packages/types/:/usr/types - - /usr/types/tests - - ../../packages/visitor-keys/:/usr/visitor-keys - - /usr/types/visitor-keys - - ../../packages/scope-manager/:/usr/scope-manager - - /usr/types/scope-manager - # Runtime link to all the specific integration test files, so that most updates don't require a rebuild. - - ./fixtures/vue-sfc:/usr/linked - - vue-jsx: - build: ./fixtures/vue-jsx - container_name: 'vue-jsx' - volumes: - # Runtime link to the relevant built @typescript-eslint packages and integration 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/experimental-utils/:/usr/experimental-utils - - /usr/experimental-utils/tests - - ../../packages/eslint-plugin/:/usr/eslint-plugin - - /usr/eslint-plugin/tests - - ../../packages/types/:/usr/types - - /usr/types/tests - - ../../packages/visitor-keys/:/usr/visitor-keys - - /usr/types/visitor-keys - - ../../packages/scope-manager/:/usr/scope-manager - - /usr/types/scope-manager - # Runtime link to all the specific integration test files, so that most updates don't require a rebuild. - - ./fixtures/vue-jsx:/usr/linked - - recommended-does-not-require-program: - build: ./fixtures/recommended-does-not-require-program - container_name: 'recommended-does-not-require-program' - volumes: - # Runtime link to the relevant built @typescript-eslint packages and integration 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/experimental-utils/:/usr/experimental-utils - - /usr/experimental-utils/tests - - ../../packages/eslint-plugin/:/usr/eslint-plugin - - /usr/eslint-plugin/tests - - ../../packages/types/:/usr/types - - /usr/types/tests - - ../../packages/visitor-keys/:/usr/visitor-keys - - /usr/types/visitor-keys - - ../../packages/scope-manager/:/usr/scope-manager - - /usr/types/scope-manager - # Runtime link to all the specific integration test files, so that most updates don't require a rebuild. - - ./fixtures/recommended-does-not-require-program:/usr/linked - - markdown: - build: ./fixtures/markdown - container_name: 'markdown' - volumes: - # Runtime link to the relevant built @typescript-eslint packages and integration 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/experimental-utils/:/usr/experimental-utils - - /usr/experimental-utils/tests - - ../../packages/eslint-plugin/:/usr/eslint-plugin - - /usr/eslint-plugin/tests - - ../../packages/types/:/usr/types - - /usr/types/tests - - ../../packages/visitor-keys/:/usr/visitor-keys - - /usr/types/visitor-keys - - ../../packages/scope-manager/:/usr/scope-manager - - /usr/types/scope-manager - # Runtime link to all the specific integration test files, so that most updates don't require a rebuild. - - ./fixtures/markdown:/usr/linked - - eslint-v6: - build: ./fixtures/eslint-v6 - container_name: 'eslint-v6' - volumes: - # Runtime link to the relevant built @typescript-eslint packages and integration 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/experimental-utils/:/usr/experimental-utils - - /usr/experimental-utils/tests - - ../../packages/eslint-plugin/:/usr/eslint-plugin - - /usr/eslint-plugin/tests - - ../../packages/types/:/usr/types - - /usr/types/tests - - ../../packages/visitor-keys/:/usr/visitor-keys - - /usr/types/visitor-keys - - ../../packages/scope-manager/:/usr/scope-manager - - /usr/types/scope-manager - # Runtime link to all the specific integration test files, so that most updates don't require a rebuild. - - ./fixtures/eslint-v6:/usr/linked diff --git a/tests/integration/fixtures/eslint-v6/.eslintrc.js b/tests/integration/fixtures/eslint-v6/.eslintrc.js index ad9ed9402981..9b8c1133a0ee 100644 --- a/tests/integration/fixtures/eslint-v6/.eslintrc.js +++ b/tests/integration/fixtures/eslint-v6/.eslintrc.js @@ -1,11 +1,7 @@ module.exports = { root: true, - // Local version of @typescript-eslint/parser parser: '@typescript-eslint/parser', - plugins: [ - // Local version of @typescript-eslint/eslint-plugin - '@typescript-eslint', - ], + plugins: ['@typescript-eslint'], rules: { '@typescript-eslint/no-explicit-any': 'error', }, diff --git a/tests/integration/fixtures/eslint-v6/Dockerfile b/tests/integration/fixtures/eslint-v6/Dockerfile deleted file mode 100644 index 027ff085a6cf..000000000000 --- a/tests/integration/fixtures/eslint-v6/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -FROM node:erbium - -# Copy the test.sh into the container. Every other file will be linked, rather -# than copied to allow for changes without rebuilds wherever possible -WORKDIR /usr -COPY ./test.sh /usr/ - -# Create file which will be executed by jest -# to assert that the lint output is what we expect -RUN echo "const actualLintOutput = require('./lint-output.json');\n" \ - "\n" \ - "test('it should produce the expected lint ouput', () => {\n" \ - " expect(actualLintOutput).toMatchSnapshot();\n" \ - "});\n" > test.js - -# Run the integration test -CMD [ "./test.sh" ] diff --git a/tests/integration/fixtures/eslint-v6/package.json b/tests/integration/fixtures/eslint-v6/package.json new file mode 100644 index 000000000000..71c2f5590c5f --- /dev/null +++ b/tests/integration/fixtures/eslint-v6/package.json @@ -0,0 +1,5 @@ +{ + "devDependencies": { + "eslint": "6.0.0" + } +} diff --git a/tests/integration/fixtures/eslint-v6/test.sh b/tests/integration/fixtures/eslint-v6/test.sh deleted file mode 100755 index ab184f9ceb15..000000000000 --- a/tests/integration/fixtures/eslint-v6/test.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -set -exuo pipefail - -# Generate the package.json to use -node /usr/utils/generate-package-json.js - -# Install dependencies -npm install -npm install eslint@6.0.0 - -# Use the local volumes for our own packages -npm install $(npm pack /usr/types | tail -1) -npm install $(npm pack /usr/visitor-keys | tail -1) -npm install $(npm pack /usr/scope-manager | tail -1) -npm install $(npm pack /usr/typescript-estree | tail -1) -npm install $(npm pack /usr/parser | tail -1) -npm install $(npm pack /usr/experimental-utils | tail -1) -npm install $(npm pack /usr/eslint-plugin | tail -1) - -# Run the linting -# (the "|| true" helps make sure that we run our tests on failed linting runs as well) -npx eslint --format json --output-file /usr/lint-output.json --config /usr/linked/.eslintrc.js /usr/linked/**/*.ts || true - -# Run our assertions against the linting output -npx jest /usr/test.js --snapshotResolver=/usr/utils/jest-snapshot-resolver.js diff --git a/tests/integration/fixtures/markdown/.eslintrc.js b/tests/integration/fixtures/markdown/.eslintrc.js index 53f147f80d85..9dd8a5505b98 100644 --- a/tests/integration/fixtures/markdown/.eslintrc.js +++ b/tests/integration/fixtures/markdown/.eslintrc.js @@ -1,6 +1,5 @@ module.exports = { root: true, - // Local version of @typescript-eslint/parser parser: '@typescript-eslint/parser', env: { es6: true, @@ -13,13 +12,10 @@ module.exports = { jsx: true, }, }, - plugins: [ - 'markdown', - // Local version of @typescript-eslint/eslint-plugin - '@typescript-eslint', - ], + plugins: ['markdown', '@typescript-eslint'], overrides: [ { + // this will also ensure that eslint will force lint the markdown files files: ['**/*.md'], processor: 'markdown/markdown', }, diff --git a/tests/integration/fixtures/markdown/Dockerfile b/tests/integration/fixtures/markdown/Dockerfile deleted file mode 100644 index 027ff085a6cf..000000000000 --- a/tests/integration/fixtures/markdown/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -FROM node:erbium - -# Copy the test.sh into the container. Every other file will be linked, rather -# than copied to allow for changes without rebuilds wherever possible -WORKDIR /usr -COPY ./test.sh /usr/ - -# Create file which will be executed by jest -# to assert that the lint output is what we expect -RUN echo "const actualLintOutput = require('./lint-output.json');\n" \ - "\n" \ - "test('it should produce the expected lint ouput', () => {\n" \ - " expect(actualLintOutput).toMatchSnapshot();\n" \ - "});\n" > test.js - -# Run the integration test -CMD [ "./test.sh" ] diff --git a/tests/integration/fixtures/markdown/package.json b/tests/integration/fixtures/markdown/package.json new file mode 100644 index 000000000000..a0cb6620d6cb --- /dev/null +++ b/tests/integration/fixtures/markdown/package.json @@ -0,0 +1,5 @@ +{ + "devDependencies": { + "eslint-plugin-markdown": "latest" + } +} diff --git a/tests/integration/fixtures/markdown/test.sh b/tests/integration/fixtures/markdown/test.sh deleted file mode 100755 index 30cd435eaac7..000000000000 --- a/tests/integration/fixtures/markdown/test.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -set -exuo pipefail - -# Generate the package.json to use -node /usr/utils/generate-package-json.js - -# Install dependencies -npm install - -# Use the local volumes for our own packages -npm install $(npm pack /usr/types | tail -1) -npm install $(npm pack /usr/visitor-keys | tail -1) -npm install $(npm pack /usr/scope-manager | tail -1) -npm install $(npm pack /usr/typescript-estree | tail -1) -npm install $(npm pack /usr/parser | tail -1) -npm install $(npm pack /usr/experimental-utils | tail -1) -npm install $(npm pack /usr/eslint-plugin | tail -1) - -# Install the latest eslint-plugin-markdown (this may break us occassionally, but it's probably good to get that feedback early) -npm install eslint-plugin-markdown@latest - -# Run the linting -# (the "|| true" helps make sure that we run our tests on failed linting runs as well) -npx eslint --format json --output-file /usr/lint-output.json --config /usr/linked/.eslintrc.js /usr/linked/**/*.md || true - -# Run our assertions against the linting output -npx jest /usr/test.js --snapshotResolver=/usr/utils/jest-snapshot-resolver.js diff --git a/tests/integration/fixtures/recommended-does-not-require-program/.eslintrc.js b/tests/integration/fixtures/recommended-does-not-require-program/.eslintrc.js index 85a83dc6e91e..0f28905d8de8 100644 --- a/tests/integration/fixtures/recommended-does-not-require-program/.eslintrc.js +++ b/tests/integration/fixtures/recommended-does-not-require-program/.eslintrc.js @@ -4,15 +4,11 @@ // more expensive checks. module.exports = { root: true, - // Local version of @typescript-eslint/parser parser: '@typescript-eslint/parser', extends: [ 'eslint:recommended', 'plugin:@typescript-eslint/eslint-recommended', 'plugin:@typescript-eslint/recommended', ], - plugins: [ - // Local version of @typescript-eslint/eslint-plugin - '@typescript-eslint', - ], + plugins: ['@typescript-eslint'], }; diff --git a/tests/integration/fixtures/recommended-does-not-require-program/Dockerfile b/tests/integration/fixtures/recommended-does-not-require-program/Dockerfile deleted file mode 100644 index 027ff085a6cf..000000000000 --- a/tests/integration/fixtures/recommended-does-not-require-program/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -FROM node:erbium - -# Copy the test.sh into the container. Every other file will be linked, rather -# than copied to allow for changes without rebuilds wherever possible -WORKDIR /usr -COPY ./test.sh /usr/ - -# Create file which will be executed by jest -# to assert that the lint output is what we expect -RUN echo "const actualLintOutput = require('./lint-output.json');\n" \ - "\n" \ - "test('it should produce the expected lint ouput', () => {\n" \ - " expect(actualLintOutput).toMatchSnapshot();\n" \ - "});\n" > test.js - -# Run the integration test -CMD [ "./test.sh" ] diff --git a/tests/integration/fixtures/recommended-does-not-require-program/package.json b/tests/integration/fixtures/recommended-does-not-require-program/package.json new file mode 100644 index 000000000000..6ae64c0520b4 --- /dev/null +++ b/tests/integration/fixtures/recommended-does-not-require-program/package.json @@ -0,0 +1,3 @@ +{ + "devDependencies": {} +} diff --git a/tests/integration/fixtures/recommended-does-not-require-program/test.sh b/tests/integration/fixtures/recommended-does-not-require-program/test.sh deleted file mode 100755 index cfe4d0e6d570..000000000000 --- a/tests/integration/fixtures/recommended-does-not-require-program/test.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -set -exuo pipefail - -# Generate the package.json to use -node /usr/utils/generate-package-json.js - -# Install dependencies -npm install - -# Use the local volumes for our own packages -npm install $(npm pack /usr/types | tail -1) -npm install $(npm pack /usr/visitor-keys | tail -1) -npm install $(npm pack /usr/scope-manager | tail -1) -npm install $(npm pack /usr/typescript-estree | tail -1) -npm install $(npm pack /usr/parser | tail -1) -npm install $(npm pack /usr/experimental-utils | tail -1) -npm install $(npm pack /usr/eslint-plugin | tail -1) - -# Run the linting -# (the "|| true" helps make sure that we run our tests on failed linting runs as well) -npx eslint --format json --output-file /usr/lint-output.json --config /usr/linked/.eslintrc.js /usr/linked/**/*.ts || true - -# Run our assertions against the linting output -npx jest /usr/test.js --snapshotResolver=/usr/utils/jest-snapshot-resolver.js diff --git a/tests/integration/fixtures/typescript-and-tslint-plugins-together/.eslintrc.js b/tests/integration/fixtures/typescript-and-tslint-plugins-together/.eslintrc.js index 0409a42c42bb..c82da766e2c9 100644 --- a/tests/integration/fixtures/typescript-and-tslint-plugins-together/.eslintrc.js +++ b/tests/integration/fixtures/typescript-and-tslint-plugins-together/.eslintrc.js @@ -1,13 +1,7 @@ module.exports = { root: true, - // Local version of @typescript-eslint/parser parser: '@typescript-eslint/parser', - plugins: [ - // Local version of @typescript-eslint/eslint-plugin - '@typescript-eslint', - // Local version of @typescript-eslint/eslint-plugin-tslint - '@typescript-eslint/tslint', - ], + plugins: ['@typescript-eslint', '@typescript-eslint/tslint'], env: { es6: true, node: true, diff --git a/tests/integration/fixtures/typescript-and-tslint-plugins-together/Dockerfile b/tests/integration/fixtures/typescript-and-tslint-plugins-together/Dockerfile deleted file mode 100644 index 027ff085a6cf..000000000000 --- a/tests/integration/fixtures/typescript-and-tslint-plugins-together/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -FROM node:erbium - -# Copy the test.sh into the container. Every other file will be linked, rather -# than copied to allow for changes without rebuilds wherever possible -WORKDIR /usr -COPY ./test.sh /usr/ - -# Create file which will be executed by jest -# to assert that the lint output is what we expect -RUN echo "const actualLintOutput = require('./lint-output.json');\n" \ - "\n" \ - "test('it should produce the expected lint ouput', () => {\n" \ - " expect(actualLintOutput).toMatchSnapshot();\n" \ - "});\n" > test.js - -# Run the integration test -CMD [ "./test.sh" ] diff --git a/tests/integration/fixtures/typescript-and-tslint-plugins-together/package.json b/tests/integration/fixtures/typescript-and-tslint-plugins-together/package.json new file mode 100644 index 000000000000..576b100099e2 --- /dev/null +++ b/tests/integration/fixtures/typescript-and-tslint-plugins-together/package.json @@ -0,0 +1,5 @@ +{ + "devDependencies": { + "tslint": "*" + } +} diff --git a/tests/integration/fixtures/typescript-and-tslint-plugins-together/test.js.snap b/tests/integration/fixtures/typescript-and-tslint-plugins-together/test.js.snap deleted file mode 100644 index 23e113677ccd..000000000000 --- a/tests/integration/fixtures/typescript-and-tslint-plugins-together/test.js.snap +++ /dev/null @@ -1,48 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`it should produce the expected lint ouput 1`] = ` -Array [ - Object { - "errorCount": 1, - "filePath": "/usr/linked/index.ts", - "fixableErrorCount": 1, - "fixableWarningCount": 0, - "messages": Array [ - Object { - "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": 1, - }, - Object { - "column": 20, - "endColumn": 20, - "endLine": 2, - "fix": Object { - "range": Array [ - 38, - 38, - ], - "text": ";", - }, - "line": 2, - "message": "Missing semicolon (tslint:semicolon)", - "messageId": "failure", - "nodeType": null, - "ruleId": "@typescript-eslint/tslint/config", - "severity": 2, - }, - ], - "source": "// prettier-ignore -const noSemi = true -", - "usedDeprecatedRules": Array [], - "warningCount": 1, - }, -] -`; diff --git a/tests/integration/fixtures/typescript-and-tslint-plugins-together/test.sh b/tests/integration/fixtures/typescript-and-tslint-plugins-together/test.sh deleted file mode 100755 index 6abbeb42aa61..000000000000 --- a/tests/integration/fixtures/typescript-and-tslint-plugins-together/test.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -set -exuo pipefail - -# Generate the package.json to use -node /usr/utils/generate-package-json.js - -# Install dependencies -npm install - -# Use the local volumes for our own packages -npm install $(npm pack /usr/types | tail -1) -npm install $(npm pack /usr/visitor-keys | tail -1) -npm install $(npm pack /usr/scope-manager | tail -1) -npm install $(npm pack /usr/typescript-estree | tail -1) -npm install $(npm pack /usr/parser | tail -1) -npm install $(npm pack /usr/experimental-utils | tail -1) -npm install $(npm pack /usr/eslint-plugin-tslint | tail -1) -npm install $(npm pack /usr/eslint-plugin | tail -1) - -# Run the linting -# (the "|| true" helps make sure that we run our tests on failed linting runs as well) -npx eslint --format json --output-file /usr/lint-output.json --config /usr/linked/.eslintrc.js /usr/linked/**/*.ts || true - -# Run our assertions against the linting output -npx jest /usr/test.js --snapshotResolver=/usr/utils/jest-snapshot-resolver.js diff --git a/tests/integration/fixtures/vue-jsx/.eslintrc.js b/tests/integration/fixtures/vue-jsx/.eslintrc.js index 0881ee92835d..750fe39d0bdc 100644 --- a/tests/integration/fixtures/vue-jsx/.eslintrc.js +++ b/tests/integration/fixtures/vue-jsx/.eslintrc.js @@ -7,7 +7,6 @@ module.exports = { }, extends: ['plugin:vue/essential'], parserOptions: { - // Local version of @typescript-eslint/parser parser: '@typescript-eslint/parser', sourceType: 'module', extraFileExtensions: ['.vue'], @@ -15,10 +14,7 @@ module.exports = { jsx: true, }, }, - plugins: [ - // Local version of @typescript-eslint/eslint-plugin - '@typescript-eslint', - ], + plugins: ['@typescript-eslint'], rules: { '@typescript-eslint/no-explicit-any': 'error', }, diff --git a/tests/integration/fixtures/vue-jsx/Dockerfile b/tests/integration/fixtures/vue-jsx/Dockerfile deleted file mode 100644 index 027ff085a6cf..000000000000 --- a/tests/integration/fixtures/vue-jsx/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -FROM node:erbium - -# Copy the test.sh into the container. Every other file will be linked, rather -# than copied to allow for changes without rebuilds wherever possible -WORKDIR /usr -COPY ./test.sh /usr/ - -# Create file which will be executed by jest -# to assert that the lint output is what we expect -RUN echo "const actualLintOutput = require('./lint-output.json');\n" \ - "\n" \ - "test('it should produce the expected lint ouput', () => {\n" \ - " expect(actualLintOutput).toMatchSnapshot();\n" \ - "});\n" > test.js - -# Run the integration test -CMD [ "./test.sh" ] diff --git a/tests/integration/fixtures/vue-jsx/Jsx.vue b/tests/integration/fixtures/vue-jsx/Jsx.vue index c08599249c39..a0dd889a6d8a 100644 --- a/tests/integration/fixtures/vue-jsx/Jsx.vue +++ b/tests/integration/fixtures/vue-jsx/Jsx.vue @@ -1,36 +1,38 @@ diff --git a/tests/integration/fixtures/vue-jsx/package.json b/tests/integration/fixtures/vue-jsx/package.json new file mode 100644 index 000000000000..bef3a8935336 --- /dev/null +++ b/tests/integration/fixtures/vue-jsx/package.json @@ -0,0 +1,8 @@ +{ + "devDependencies": { + "vue-eslint-parser": "latest", + "eslint-plugin-vue": "latest", + "vuex": "latest", + "vue-property-decorator": "latest" + } +} diff --git a/tests/integration/fixtures/vue-jsx/test.sh b/tests/integration/fixtures/vue-jsx/test.sh deleted file mode 100755 index 96376fb0f83c..000000000000 --- a/tests/integration/fixtures/vue-jsx/test.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -set -exuo pipefail - -# Generate the package.json to use -node /usr/utils/generate-package-json.js - -# Install dependencies -npm install - -# Use the local volumes for our own packages -npm install $(npm pack /usr/types | tail -1) -npm install $(npm pack /usr/visitor-keys | tail -1) -npm install $(npm pack /usr/scope-manager | tail -1) -npm install $(npm pack /usr/typescript-estree | tail -1) -npm install $(npm pack /usr/parser | tail -1) -npm install $(npm pack /usr/experimental-utils | tail -1) -npm install $(npm pack /usr/eslint-plugin | tail -1) - -# Install the latest versions of dependencies (this may break us occassionally, but it's probably good to get that feedback early) -npm install vue-eslint-parser@latest eslint-plugin-vue@latest -# Install the latest some other vue utilities -npm install vuex@latest vue-property-decorator@latest - -# Run the linting -# (the "|| true" helps make sure that we run our tests on failed linting runs as well) -npx eslint --format json --output-file /usr/lint-output.json --config /usr/linked/.eslintrc.js /usr/linked/**/*.vue || true - -# Run our assertions against the linting output -npx jest /usr/test.js --snapshotResolver=/usr/utils/jest-snapshot-resolver.js diff --git a/tests/integration/fixtures/vue-sfc/.eslintrc.js b/tests/integration/fixtures/vue-sfc/.eslintrc.js index 465684ec3ef2..3306fe237555 100644 --- a/tests/integration/fixtures/vue-sfc/.eslintrc.js +++ b/tests/integration/fixtures/vue-sfc/.eslintrc.js @@ -7,16 +7,12 @@ module.exports = { }, extends: ['plugin:vue/essential'], parserOptions: { - // Local version of @typescript-eslint/parser parser: '@typescript-eslint/parser', project: '/usr/linked/tsconfig.json', sourceType: 'module', extraFileExtensions: ['.vue'], }, - plugins: [ - // Local version of @typescript-eslint/eslint-plugin - '@typescript-eslint', - ], + plugins: ['@typescript-eslint'], rules: { '@typescript-eslint/no-explicit-any': 'error', '@typescript-eslint/no-unnecessary-type-assertion': 'error', diff --git a/tests/integration/fixtures/vue-sfc/Dockerfile b/tests/integration/fixtures/vue-sfc/Dockerfile deleted file mode 100644 index 027ff085a6cf..000000000000 --- a/tests/integration/fixtures/vue-sfc/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -FROM node:erbium - -# Copy the test.sh into the container. Every other file will be linked, rather -# than copied to allow for changes without rebuilds wherever possible -WORKDIR /usr -COPY ./test.sh /usr/ - -# Create file which will be executed by jest -# to assert that the lint output is what we expect -RUN echo "const actualLintOutput = require('./lint-output.json');\n" \ - "\n" \ - "test('it should produce the expected lint ouput', () => {\n" \ - " expect(actualLintOutput).toMatchSnapshot();\n" \ - "});\n" > test.js - -# Run the integration test -CMD [ "./test.sh" ] diff --git a/tests/integration/fixtures/vue-sfc/Hello.vue b/tests/integration/fixtures/vue-sfc/Hello.vue index 1f5c59ed2dc0..1ee0282919b5 100644 --- a/tests/integration/fixtures/vue-sfc/Hello.vue +++ b/tests/integration/fixtures/vue-sfc/Hello.vue @@ -1,36 +1,39 @@ diff --git a/tests/integration/fixtures/vue-sfc/World.vue b/tests/integration/fixtures/vue-sfc/World.vue index ade2b409a3b6..12e63ca82ff7 100644 --- a/tests/integration/fixtures/vue-sfc/World.vue +++ b/tests/integration/fixtures/vue-sfc/World.vue @@ -1,30 +1,32 @@ diff --git a/tests/integration/fixtures/vue-sfc/package.json b/tests/integration/fixtures/vue-sfc/package.json new file mode 100644 index 000000000000..bef3a8935336 --- /dev/null +++ b/tests/integration/fixtures/vue-sfc/package.json @@ -0,0 +1,8 @@ +{ + "devDependencies": { + "vue-eslint-parser": "latest", + "eslint-plugin-vue": "latest", + "vuex": "latest", + "vue-property-decorator": "latest" + } +} diff --git a/tests/integration/fixtures/vue-sfc/test.js.snap b/tests/integration/fixtures/vue-sfc/test.js.snap deleted file mode 100644 index 8f7fc2c48e69..000000000000 --- a/tests/integration/fixtures/vue-sfc/test.js.snap +++ /dev/null @@ -1,122 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`it should produce the expected lint ouput 1`] = ` -Array [ - Object { - "errorCount": 1, - "filePath": "/usr/linked/Hello.vue", - "fixableErrorCount": 0, - "fixableWarningCount": 0, - "messages": Array [ - Object { - "column": 29, - "endColumn": 32, - "endLine": 31, - "line": 31, - "message": "Unexpected any. Specify a different type.", - "messageId": "unexpectedAny", - "nodeType": "TSAnyKeyword", - "ruleId": "@typescript-eslint/no-explicit-any", - "severity": 2, - "suggestions": Array [ - Object { - "desc": "Use \`unknown\` instead, this will force you to explicitly, and safely assert the type is correct.", - "fix": Object { - "range": Array [ - 708, - 711, - ], - "text": "unknown", - }, - "messageId": "suggestUnknown", - }, - Object { - "desc": "Use \`never\` instead, this is useful when instantiating generic type parameters that you don't need to know the type of.", - "fix": Object { - "range": Array [ - 708, - 711, - ], - "text": "never", - }, - "messageId": "suggestNever", - }, - ], - }, - ], - "source": " - - - -", - "usedDeprecatedRules": Array [], - "warningCount": 0, - }, - Object { - "errorCount": 0, - "filePath": "/usr/linked/Utility.vue", - "fixableErrorCount": 0, - "fixableWarningCount": 0, - "messages": Array [], - "output": " -", - "usedDeprecatedRules": Array [], - "warningCount": 0, - }, - Object { - "errorCount": 0, - "filePath": "/usr/linked/World.vue", - "fixableErrorCount": 0, - "fixableWarningCount": 0, - "messages": Array [], - "usedDeprecatedRules": Array [], - "warningCount": 0, - }, -] -`; diff --git a/tests/integration/fixtures/vue-sfc/test.sh b/tests/integration/fixtures/vue-sfc/test.sh deleted file mode 100755 index 80f7cfe4adf4..000000000000 --- a/tests/integration/fixtures/vue-sfc/test.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -set -exuo pipefail - -# Generate the package.json to use -node /usr/utils/generate-package-json.js - -# Install dependencies -npm install - -# Use the local volumes for our own packages -npm install $(npm pack /usr/types | tail -1) -npm install $(npm pack /usr/visitor-keys | tail -1) -npm install $(npm pack /usr/scope-manager | tail -1) -npm install $(npm pack /usr/typescript-estree | tail -1) -npm install $(npm pack /usr/parser | tail -1) -npm install $(npm pack /usr/experimental-utils | tail -1) -npm install $(npm pack /usr/eslint-plugin | tail -1) - -# Install the latest versions of dependencies (this may break us occassionally, but it's probably good to get that feedback early) -npm install vue-eslint-parser@latest eslint-plugin-vue@latest -# Install the latest some other vue utilities -npm install vuex@latest vue-property-decorator@latest - -# Run the linting -# (the "|| true" helps make sure that we run our tests on failed linting runs as well) -npx eslint --format json --output-file /usr/lint-output.json --config /usr/linked/.eslintrc.js /usr/linked/**/*.vue --fix-dry-run || true - -# Run our assertions against the linting output -npx jest /usr/test.js --snapshotResolver=/usr/utils/jest-snapshot-resolver.js diff --git a/tests/integration/integration-test-base.ts b/tests/integration/integration-test-base.ts new file mode 100644 index 000000000000..71c5934d9454 --- /dev/null +++ b/tests/integration/integration-test-base.ts @@ -0,0 +1,138 @@ +import childProcess from 'child_process'; +import fs from 'fs'; +import ncp from 'ncp'; +import path from 'path'; +import tmp from 'tmp'; +import { promisify } from 'util'; + +interface PackageJSON { + name: string; + private?: boolean; + devDependencies: Record; +} + +const rootPackageJson: PackageJSON = require('../../package.json'); + +tmp.setGracefulCleanup(); + +const copyDir = promisify(ncp.ncp); +const execFile = promisify(childProcess.execFile); +const readFile = promisify(fs.readFile); +const tmpDir = promisify(tmp.dir); +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'); + +// make sure that jest doesn't timeout the test +jest.setTimeout(60000); + +export function integrationTest(testFilename: string, filesGlob: string): void { + const fixture = path.parse(testFilename).name.replace('.test', ''); + describe(fixture, () => { + const fixtureDir = path.join(FIXTURES_DIR, fixture); + + it('should lint successfully', async () => { + const testFolder = await tmpDir(); + + // copy the fixture files to the temp folder + await copyDir(fixtureDir, testFolder); + + // build and write the package.json for the test + const fixturePackageJson: PackageJSON = await import( + path.join(fixtureDir, 'package.json') + ); + await writeFile( + path.join(testFolder, 'package.json'), + JSON.stringify({ + private: true, + devDependencies: { + ...BASE_DEPENDENCIES, + ...fixturePackageJson.devDependencies, + // install tslint with the base version if required + tslint: fixturePackageJson.devDependencies.tslint + ? rootPackageJson.devDependencies.tslint + : undefined, + }, + }), + ); + // console.log('package.json written.'); + + await new Promise((resolve, reject) => { + // we use the non-promise version so we can log everything on error + childProcess.execFile( + // we use yarn instead of npm as it will cache the remote packages and + // to make installs things faster + 'yarn', + ['install', '--no-lockfile', '--prefer-offline', '--no-progress'], + { + cwd: testFolder, + }, + (err, stdout, stderr) => { + if (err) { + if (stdout.length > 0) { + console.warn(stdout); + } + if (stderr.length > 0) { + console.error(stderr); + } + reject(err); + } else { + resolve(); + } + }, + ); + }); + // console.log('Install complete.'); + + // lint, outputting to a JSON file + const outFile = await tmpFile(); + try { + await execFile( + 'yarn', + [ + 'eslint', + '--format', + 'json', + '--output-file', + outFile, + '--config', + './.eslintrc.js', + '--fix-dry-run', + filesGlob, + ], + { + cwd: testFolder, + }, + ); + } catch (ex) { + // we expect eslint will "fail" because we have intentional lint errors + } + // console.log('Lint complete.'); + + // assert the linting state is consistent + const lintOutputRAW = (await readFile(outFile, 'utf8')) + // clean the output to remove any changing facets so tests are stable + .replace( + new RegExp(`"filePath": ?"(/private)?${testFolder}`, 'g'), + '"filePath": "', + ); + try { + const lintOutput = JSON.parse(lintOutputRAW); + expect(lintOutput).toMatchSnapshot(); + } catch { + throw lintOutputRAW; + } + }); + + afterAll(() => {}); + }); +} diff --git a/tests/integration/jest.config.js b/tests/integration/jest.config.js new file mode 100644 index 000000000000..cd6d67fdab01 --- /dev/null +++ b/tests/integration/jest.config.js @@ -0,0 +1,34 @@ +'use strict'; + +// pack the packages ahead of time and create a mapping for use in the tests +require('ts-node').register({ + transpileOnly: true, + files: ['./pack-packages.ts'], +}); +const { tseslintPackages } = require('./pack-packages'); + +module.exports = { + testEnvironment: 'node', + transform: { + ['^.+\\.tsx?$']: 'ts-jest', + }, + testRegex: ['/tests/[^/]+.test.ts$'], + collectCoverage: false, + moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], + globals: { + 'ts-jest': { + isolatedModules: true, + diagnostics: { + // ignore the diagnostic error for the invalidFileErrors fixtures + ignoreCodes: [5056], + }, + }, + tseslintPackages, + }, + rootDir: __dirname, + + // TODO(Brad Zacher) - for some reason if we run more than 1 test at a time + // yarn will error saying the tarballs are corrupt on just + // the first test. + maxWorkers: 1, +}; diff --git a/tests/integration/pack-packages.ts b/tests/integration/pack-packages.ts new file mode 100644 index 000000000000..6be072edb088 --- /dev/null +++ b/tests/integration/pack-packages.ts @@ -0,0 +1,52 @@ +/** + * Pack all of our packages so we can "install" them later. + * We do this here rather than per test so that we only have + * to do it once per test run as it takes a decent chunk of + * time to do. + * This also ensures all of the tests are guaranteed to run + * against the exact same version of the package. + */ + +import { spawnSync } from 'child_process'; +import fs from 'fs'; +import path from 'path'; +import tmp from 'tmp'; + +interface PackageJSON { + name: string; + private?: boolean; + devDependencies: Record; +} + +const PACKAGES_DIR = path.resolve(__dirname, '..', '..', 'packages'); +const PACKAGES = fs.readdirSync(PACKAGES_DIR); + +const tarFolder = tmp.dirSync({ + // because of how jest executes things, we need to ensure + // the temp files hang around + keep: true, +}).name; + +const tseslintPackages: PackageJSON['devDependencies'] = {}; +for (const pkg of PACKAGES) { + const packageDir = path.join(PACKAGES_DIR, pkg); + const packageJson: PackageJSON = require(path.join( + packageDir, + 'package.json', + )); + if (packageJson.private === true) { + continue; + } + + const result = spawnSync('npm', ['pack', packageDir], { + cwd: tarFolder, + encoding: 'utf-8', + }); + const stdoutLines = result.stdout.trim().split('\n'); + const tarball = stdoutLines[stdoutLines.length - 1]; + + tseslintPackages[packageJson.name] = `file:${path.join(tarFolder, tarball)}`; +} + +console.log('Finished packing local packages.'); +export { tseslintPackages }; diff --git a/tests/integration/run-all-tests.sh b/tests/integration/run-all-tests.sh deleted file mode 100755 index eccb4e2e157f..000000000000 --- a/tests/integration/run-all-tests.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -set -exuo pipefail - -# We run the services serially and in a non-detached state just that we can ensure predictable -# exit codes for all of our integration tests, and we can ensure CI builds pass or fail appropriately - -# typescript-and-tslint-plugins-together -docker-compose -f tests/integration/docker-compose.yml up --build --abort-on-container-exit typescript-and-tslint-plugins-together - -# vue-sfc -docker-compose -f tests/integration/docker-compose.yml up --build --abort-on-container-exit vue-sfc - -# vue-jsx -docker-compose -f tests/integration/docker-compose.yml up --build --abort-on-container-exit vue-jsx - -# recommended-does-not-require-program -docker-compose -f tests/integration/docker-compose.yml up --build --abort-on-container-exit recommended-does-not-require-program - -# markdown -docker-compose -f tests/integration/docker-compose.yml up --build --abort-on-container-exit markdown - -# eslint-v6 -docker-compose -f tests/integration/docker-compose.yml up --build --abort-on-container-exit eslint-v6 diff --git a/tests/integration/fixtures/eslint-v6/test.js.snap b/tests/integration/tests/__snapshots__/eslint-v6.test.ts.snap similarity index 85% rename from tests/integration/fixtures/eslint-v6/test.js.snap rename to tests/integration/tests/__snapshots__/eslint-v6.test.ts.snap index 350194ef759a..944108b5b194 100644 --- a/tests/integration/fixtures/eslint-v6/test.js.snap +++ b/tests/integration/tests/__snapshots__/eslint-v6.test.ts.snap @@ -1,10 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`it should produce the expected lint ouput 1`] = ` +exports[`eslint-v6 should lint successfully 1`] = ` Array [ Object { "errorCount": 1, - "filePath": "/usr/linked/index.ts", + "filePath": "/index.ts", "fixableErrorCount": 0, "fixableWarningCount": 0, "messages": Array [ diff --git a/tests/integration/fixtures/markdown/test.js.snap b/tests/integration/tests/__snapshots__/markdown.test.ts.snap similarity index 98% rename from tests/integration/fixtures/markdown/test.js.snap rename to tests/integration/tests/__snapshots__/markdown.test.ts.snap index 8663838f7edc..73ee869151ac 100644 --- a/tests/integration/fixtures/markdown/test.js.snap +++ b/tests/integration/tests/__snapshots__/markdown.test.ts.snap @@ -1,10 +1,11 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`it should produce the expected lint ouput 1`] = ` +exports[`markdown should lint successfully 1`] = ` Array [ Object { "errorCount": 10, - "filePath": "/usr/linked/Doc.md", + "fatalErrorCount": 0, + "filePath": "/Doc.md", "fixableErrorCount": 0, "fixableWarningCount": 0, "messages": Array [ diff --git a/tests/integration/fixtures/recommended-does-not-require-program/test.js.snap b/tests/integration/tests/__snapshots__/recommended-does-not-require-program.test.ts.snap similarity index 64% rename from tests/integration/fixtures/recommended-does-not-require-program/test.js.snap rename to tests/integration/tests/__snapshots__/recommended-does-not-require-program.test.ts.snap index b313deb408b7..5bb7f69f1b82 100644 --- a/tests/integration/fixtures/recommended-does-not-require-program/test.js.snap +++ b/tests/integration/tests/__snapshots__/recommended-does-not-require-program.test.ts.snap @@ -1,34 +1,17 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`it should produce the expected lint ouput 1`] = ` +exports[`recommended-does-not-require-program should lint successfully 1`] = ` Array [ Object { - "errorCount": 1, - "filePath": "/usr/linked/index.ts", - "fixableErrorCount": 1, + "errorCount": 0, + "fatalErrorCount": 0, + "filePath": "/index.ts", + "fixableErrorCount": 0, "fixableWarningCount": 0, "messages": Array [ Object { - "column": 1, - "endColumn": 21, - "endLine": 1, - "fix": Object { - "range": Array [ - 0, - 3, - ], - "text": "let", - }, - "line": 1, - "message": "Unexpected var, use let or const instead.", - "messageId": "unexpectedVar", - "nodeType": "VariableDeclaration", - "ruleId": "no-var", - "severity": 2, - }, - Object { - "column": 5, - "endColumn": 13, + "column": 7, + "endColumn": 15, "endLine": 1, "line": 1, "message": "'foo' is assigned a value but never used.", @@ -38,8 +21,8 @@ Array [ "severity": 1, }, Object { - "column": 10, - "endColumn": 13, + "column": 12, + "endColumn": 15, "endLine": 1, "line": 1, "message": "Unexpected any. Specify a different type.", @@ -52,8 +35,8 @@ Array [ "desc": "Use \`unknown\` instead, this will force you to explicitly, and safely assert the type is correct.", "fix": Object { "range": Array [ - 9, - 12, + 11, + 14, ], "text": "unknown", }, @@ -63,8 +46,8 @@ Array [ "desc": "Use \`never\` instead, this is useful when instantiating generic type parameters that you don't need to know the type of.", "fix": Object { "range": Array [ - 9, - 12, + 11, + 14, ], "text": "never", }, @@ -73,7 +56,7 @@ Array [ ], }, ], - "source": "var foo: any = true; + "output": "const foo: any = true; ", "usedDeprecatedRules": Array [], "warningCount": 2, diff --git a/tests/integration/tests/__snapshots__/typescript-and-tslint-plugins-together.test.ts.snap b/tests/integration/tests/__snapshots__/typescript-and-tslint-plugins-together.test.ts.snap new file mode 100644 index 000000000000..6febca576838 --- /dev/null +++ b/tests/integration/tests/__snapshots__/typescript-and-tslint-plugins-together.test.ts.snap @@ -0,0 +1,26 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript-and-tslint-plugins-together should lint successfully 1`] = ` +Array [ + Object { + "errorCount": 1, + "fatalErrorCount": 1, + "filePath": "/index.ts", + "fixableErrorCount": 0, + "fixableWarningCount": 0, + "messages": Array [ + Object { + "fatal": true, + "message": "Parsing error: Cannot read file '/usr/linked/tsconfig.json'.", + "ruleId": null, + "severity": 2, + }, + ], + "source": "// prettier-ignore +const noSemi = true +", + "usedDeprecatedRules": Array [], + "warningCount": 0, + }, +] +`; diff --git a/tests/integration/fixtures/vue-jsx/test.js.snap b/tests/integration/tests/__snapshots__/vue-jsx.test.ts.snap similarity index 74% rename from tests/integration/fixtures/vue-jsx/test.js.snap rename to tests/integration/tests/__snapshots__/vue-jsx.test.ts.snap index 23764ebfea91..8801c5eff7cb 100644 --- a/tests/integration/fixtures/vue-jsx/test.js.snap +++ b/tests/integration/tests/__snapshots__/vue-jsx.test.ts.snap @@ -1,10 +1,11 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`it should produce the expected lint ouput 1`] = ` +exports[`vue-jsx should lint successfully 1`] = ` Array [ Object { "errorCount": 1, - "filePath": "/usr/linked/Jsx.vue", + "fatalErrorCount": 0, + "filePath": "/Jsx.vue", "fixableErrorCount": 0, "fixableWarningCount": 0, "messages": Array [ @@ -23,8 +24,8 @@ Array [ "desc": "Use \`unknown\` instead, this will force you to explicitly, and safely assert the type is correct.", "fix": Object { "range": Array [ - 390, - 393, + 394, + 397, ], "text": "unknown", }, @@ -34,8 +35,8 @@ Array [ "desc": "Use \`never\` instead, this is useful when instantiating generic type parameters that you don't need to know the type of.", "fix": Object { "range": Array [ - 390, - 393, + 394, + 397, ], "text": "never", }, @@ -45,38 +46,40 @@ Array [ }, ], "source": " diff --git a/tests/integration/tests/__snapshots__/vue-sfc.test.ts.snap b/tests/integration/tests/__snapshots__/vue-sfc.test.ts.snap new file mode 100644 index 000000000000..38c6ba890f8e --- /dev/null +++ b/tests/integration/tests/__snapshots__/vue-sfc.test.ts.snap @@ -0,0 +1,146 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`vue-sfc should lint successfully 1`] = ` +Array [ + Object { + "errorCount": 1, + "fatalErrorCount": 1, + "filePath": "/Hello.vue", + "fixableErrorCount": 0, + "fixableWarningCount": 0, + "messages": Array [ + Object { + "fatal": true, + "message": "Parsing error: Cannot read file '/usr/linked/tsconfig.json'.", + "ruleId": null, + "severity": 2, + }, + ], + "source": " + + + +", + "usedDeprecatedRules": Array [], + "warningCount": 0, + }, + Object { + "errorCount": 1, + "fatalErrorCount": 1, + "filePath": "/Utility.vue", + "fixableErrorCount": 0, + "fixableWarningCount": 0, + "messages": Array [ + Object { + "fatal": true, + "message": "Parsing error: Cannot read file '/usr/linked/tsconfig.json'.", + "ruleId": null, + "severity": 2, + }, + ], + "source": " +", + "usedDeprecatedRules": Array [], + "warningCount": 0, + }, + Object { + "errorCount": 1, + "fatalErrorCount": 1, + "filePath": "/World.vue", + "fixableErrorCount": 0, + "fixableWarningCount": 0, + "messages": Array [ + Object { + "fatal": true, + "message": "Parsing error: Cannot read file '/usr/linked/tsconfig.json'.", + "ruleId": null, + "severity": 2, + }, + ], + "source": " + + + +", + "usedDeprecatedRules": Array [], + "warningCount": 0, + }, +] +`; diff --git a/tests/integration/tests/eslint-v6.test.ts b/tests/integration/tests/eslint-v6.test.ts new file mode 100644 index 000000000000..afcf9da3bc25 --- /dev/null +++ b/tests/integration/tests/eslint-v6.test.ts @@ -0,0 +1,3 @@ +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 new file mode 100644 index 000000000000..8ac7befb646b --- /dev/null +++ b/tests/integration/tests/markdown.test.ts @@ -0,0 +1,3 @@ +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 new file mode 100644 index 000000000000..afcf9da3bc25 --- /dev/null +++ b/tests/integration/tests/recommended-does-not-require-program.test.ts @@ -0,0 +1,3 @@ +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 new file mode 100644 index 000000000000..afcf9da3bc25 --- /dev/null +++ b/tests/integration/tests/typescript-and-tslint-plugins-together.test.ts @@ -0,0 +1,3 @@ +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 new file mode 100644 index 000000000000..18a482247acf --- /dev/null +++ b/tests/integration/tests/vue-jsx.test.ts @@ -0,0 +1,3 @@ +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 new file mode 100644 index 000000000000..18a482247acf --- /dev/null +++ b/tests/integration/tests/vue-sfc.test.ts @@ -0,0 +1,3 @@ +import { integrationTest } from '../integration-test-base'; + +integrationTest(__filename, '*.vue'); diff --git a/tests/integration/tsconfig.json b/tests/integration/tsconfig.json new file mode 100644 index 000000000000..e6c02e537a66 --- /dev/null +++ b/tests/integration/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "esModuleInterop": true, + "resolveJsonModule": true, + "rootDir": "." + }, + "include": ["./*.ts", "./tests/*.test.ts"], + "references": [] +} diff --git a/tests/integration/utils/.eslintrc.js b/tests/integration/utils/.eslintrc.js deleted file mode 100644 index 8ca32766a124..000000000000 --- a/tests/integration/utils/.eslintrc.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - parserOptions: { - project: `${__dirname}/jsconfig.json`, - }, -}; diff --git a/tests/integration/utils/generate-package-json.js b/tests/integration/utils/generate-package-json.js deleted file mode 100644 index 1f6af28df63e..000000000000 --- a/tests/integration/utils/generate-package-json.js +++ /dev/null @@ -1,19 +0,0 @@ -const fs = require('fs'); -// eslint-disable-next-line import/no-absolute-path -const rootPackageJSON = require('/usr/root-package.json'); - -/** - * Apply package versions based on what they are currently set to in the root package.json - * in the monorepo. - */ -const testPackageJSON = { - private: true, - devDependencies: { - eslint: rootPackageJSON.devDependencies.eslint, - typescript: rootPackageJSON.devDependencies.typescript, - tslint: rootPackageJSON.devDependencies.tslint, - jest: rootPackageJSON.devDependencies.jest, - }, -}; - -fs.writeFileSync('/usr/package.json', JSON.stringify(testPackageJSON, null, 2)); diff --git a/tests/integration/utils/jest-snapshot-resolver.js b/tests/integration/utils/jest-snapshot-resolver.js deleted file mode 100644 index 366a96118398..000000000000 --- a/tests/integration/utils/jest-snapshot-resolver.js +++ /dev/null @@ -1,20 +0,0 @@ -/* eslint-disable @typescript-eslint/explicit-function-return-type */ -/** - * Use a jest snapshotResolver to map the test snapshot output back to the - * linked volume. This means that even though we are running our tests inside - * the docker container, the resulting snapshots will get written back to disk - * on the host machine (i.e. your computer)! ✨ - */ -module.exports = { - // resolves from test to snapshot path - resolveSnapshotPath: (testPath, snapshotExtension) => { - return testPath.replace('/usr/', '/usr/linked/') + snapshotExtension; - }, - // resolves from snapshot to test path - resolveTestPath: (snapshotFilePath, snapshotExtension) => { - return snapshotFilePath - .replace('/usr/linked/', '/usr/') - .slice(0, -snapshotExtension.length); - }, - testPathForConsistencyCheck: '/usr/test.js', -}; diff --git a/tests/integration/utils/jsconfig.json b/tests/integration/utils/jsconfig.json deleted file mode 100644 index 984f1f4c0780..000000000000 --- a/tests/integration/utils/jsconfig.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "include": [ - ".eslintrc.js", - "jest-snapshot-resolver.js", - "generate-package-json.js" - ] -} diff --git a/tests/jest-resolver.js b/tests/jest-resolver.js new file mode 100644 index 000000000000..0636e2feee7e --- /dev/null +++ b/tests/jest-resolver.js @@ -0,0 +1,20 @@ +/* @ts-check */ + +// temporary workaround - https://github.com/facebook/jest/issues/9771#issuecomment-871585234 +const resolver = require('enhanced-resolve').create.sync({ + conditionNames: ['require', 'node', 'default'], + extensions: ['.js', '.json', '.node', '.ts', '.tsx'], +}); + +/** + * @param request {unknown} + * @param options {{ defaultResolver(...args: unknown[]): unknown, basedir: unknown }} + * @returns {unknown} + */ +module.exports = function (request, options) { + // list global module that must be resolved by defaultResolver here + if (['fs', 'http', 'path'].includes(request)) { + return options.defaultResolver(request, options); + } + return resolver(options.basedir, request); +}; diff --git a/tests/performance/docker-compose.yml b/tests/performance/docker-compose.yml index e47eb9581b7b..bf737b239a35 100644 --- a/tests/performance/docker-compose.yml +++ b/tests/performance/docker-compose.yml @@ -3,7 +3,7 @@ version: '3' services: lint-real-repo: build: ./fixtures/lint-real-repo - container_name: "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. diff --git a/tools/generate-contributors.ts b/tools/generate-contributors.ts index 38c3690cb0a4..c668ecf3da4a 100644 --- a/tools/generate-contributors.ts +++ b/tools/generate-contributors.ts @@ -3,7 +3,7 @@ // this endpoint returns a list of contributors sorted by number of contributions import * as fs from 'fs'; -import 'isomorphic-fetch'; +import fetch from 'node-fetch'; import * as path from 'path'; const IGNORED_USERS = new Set([ @@ -42,9 +42,9 @@ async function* fetchUsers(page = 1): AsyncIterableIterator { const response = await fetch(`${contributorsApiUrl}&page=${page}`, { method: 'GET', }); - const contributors: + const contributors = (await response.json()) as | Contributor[] - | { message: string } = await response.json(); + | { message: string }; if (!Array.isArray(contributors)) { throw new Error(contributors.message); @@ -78,9 +78,9 @@ async function main(): Promise { // fetch the user info const users = await Promise.all( - githubContributors.map>(async c => { + githubContributors.map(async c => { const response = await fetch(c.url, { method: 'GET' }); - return response.json(); + return (await response.json()) as User; }), ); @@ -114,4 +114,7 @@ async function main(): Promise { fs.writeFileSync(rcPath, JSON.stringify(allContributorsConfig, null, 2)); } -main(); +main().catch(error => { + console.error(error); + process.exitCode = 1; +}); diff --git a/tsconfig.base.json b/tsconfig.base.json index ee6c33f86e51..0c43c219c073 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -15,6 +15,7 @@ "sourceMap": true, "strict": true, "target": "es2017", - "lib": ["es2017"] + "lib": ["es2017"], + "paths": {} } } diff --git a/tsconfig.eslint.json b/tsconfig.eslint.json index 40defd4b3b8d..102bb2a44e3d 100644 --- a/tsconfig.eslint.json +++ b/tsconfig.eslint.json @@ -1,4 +1,9 @@ { + "compilerOptions": { + "types": ["@types/node"], + "noEmit": true, + "allowJs": true + }, "extends": "./tsconfig.base.json", - "include": ["tests/**/*.ts", "tools/**/*.ts", ".eslintrc.js"] + "include": ["tools/**/*.ts", ".eslintrc.js", "tests/jest-resolver.js"] } diff --git a/workspace.json b/workspace.json new file mode 100644 index 000000000000..c6dbc5b4b0f9 --- /dev/null +++ b/workspace.json @@ -0,0 +1,16 @@ +{ + "version": 2, + "projects": { + "@typescript-eslint/ast-spec": "packages/ast-spec", + "@typescript-eslint/eslint-plugin": "packages/eslint-plugin", + "@typescript-eslint/eslint-plugin-internal": "packages/eslint-plugin-internal", + "@typescript-eslint/eslint-plugin-tslint": "packages/eslint-plugin-tslint", + "@typescript-eslint/experimental-utils": "packages/experimental-utils", + "@typescript-eslint/parser": "packages/parser", + "@typescript-eslint/scope-manager": "packages/scope-manager", + "@typescript-eslint/shared-fixtures": "packages/shared-fixtures", + "@typescript-eslint/types": "packages/types", + "@typescript-eslint/typescript-estree": "packages/typescript-estree", + "@typescript-eslint/visitor-keys": "packages/visitor-keys" + } +} diff --git a/yarn.lock b/yarn.lock index 7391d1c4c005..9b76320d02b8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,6 +2,13 @@ # yarn lockfile v1 +"@babel/code-frame@*", "@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.14.5", "@babel/code-frame@^7.15.8": + version "7.15.8" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.15.8.tgz#45990c47adadb00c03677baa89221f7cc23d2503" + integrity sha512-2IAnmn8zbvC/jKYhq5Ki9I+DwjlrtMPUCH/CpHvqI4dNnlwHwsxoIhlc8WcYY5LSYknXQtAlFYuHfqAFCvQ4Wg== + dependencies: + "@babel/highlight" "^7.14.5" + "@babel/code-frame@7.12.11": version "7.12.11" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.12.11.tgz#f4ad435aa263db935b8f10f2c552d23fb716a63f" @@ -9,172 +16,170 @@ dependencies: "@babel/highlight" "^7.10.4" -"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13": - version "7.12.13" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.12.13.tgz#dcfc826beef65e75c50e21d3837d7d95798dd658" - integrity sha512-HV1Cm0Q3ZrpCR93tkWOYiuYIgLxZXZFVG2VgK+MBWjUqZTundupbfx2aXarXuw5Ko5aMcjtJgbSs4vUGBS5v6g== - dependencies: - "@babel/highlight" "^7.12.13" - -"@babel/compat-data@^7.13.0": - version "7.13.6" - resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.13.6.tgz#11972d07db4c2317afdbf41d6feb3a730301ef4e" - integrity sha512-VhgqKOWYVm7lQXlvbJnWOzwfAQATd2nV52koT0HZ/LdDH0m4DUDwkKYsH+IwpXb+bKPyBJzawA4I6nBKqZcpQw== - -"@babel/core@^7.1.0", "@babel/core@^7.7.5": - version "7.13.1" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.13.1.tgz#7ddd027176debe40f13bb88bac0c21218c5b1ecf" - integrity sha512-FzeKfFBG2rmFtGiiMdXZPFt/5R5DXubVi82uYhjGX4Msf+pgYQMCFIqFXZWs5vbIYbf14VeBIgdGI03CDOOM1w== - dependencies: - "@babel/code-frame" "^7.12.13" - "@babel/generator" "^7.13.0" - "@babel/helper-compilation-targets" "^7.13.0" - "@babel/helper-module-transforms" "^7.13.0" - "@babel/helpers" "^7.13.0" - "@babel/parser" "^7.13.0" - "@babel/template" "^7.12.13" - "@babel/traverse" "^7.13.0" - "@babel/types" "^7.13.0" +"@babel/compat-data@^7.15.0": + version "7.15.0" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.15.0.tgz#2dbaf8b85334796cafbb0f5793a90a2fc010b176" + integrity sha512-0NqAC1IJE0S0+lL1SWFMxMkz1pKCNCjI4tr2Zx4LJSXxCLAdr6KyArnY+sno5m3yH9g737ygOyPABDsnXkpxiA== + +"@babel/core@^7.1.0", "@babel/core@^7.7.2", "@babel/core@^7.7.5": + version "7.15.8" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.15.8.tgz#195b9f2bffe995d2c6c159e72fe525b4114e8c10" + integrity sha512-3UG9dsxvYBMYwRv+gS41WKHno4K60/9GPy1CJaH6xy3Elq8CTtvtjT5R5jmNhXfCYLX2mTw+7/aq5ak/gOE0og== + dependencies: + "@babel/code-frame" "^7.15.8" + "@babel/generator" "^7.15.8" + "@babel/helper-compilation-targets" "^7.15.4" + "@babel/helper-module-transforms" "^7.15.8" + "@babel/helpers" "^7.15.4" + "@babel/parser" "^7.15.8" + "@babel/template" "^7.15.4" + "@babel/traverse" "^7.15.4" + "@babel/types" "^7.15.6" convert-source-map "^1.7.0" debug "^4.1.0" gensync "^1.0.0-beta.2" json5 "^2.1.2" - lodash "^4.17.19" - semver "7.0.0" + semver "^6.3.0" source-map "^0.5.0" -"@babel/generator@^7.13.0": - version "7.13.0" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.13.0.tgz#bd00d4394ca22f220390c56a0b5b85568ec1ec0c" - integrity sha512-zBZfgvBB/ywjx0Rgc2+BwoH/3H+lDtlgD4hBOpEv5LxRnYsm/753iRuLepqnYlynpjC3AdQxtxsoeHJoEEwOAw== +"@babel/generator@^7.15.4", "@babel/generator@^7.15.8", "@babel/generator@^7.7.2": + version "7.15.8" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.15.8.tgz#fa56be6b596952ceb231048cf84ee499a19c0cd1" + integrity sha512-ECmAKstXbp1cvpTTZciZCgfOt6iN64lR0d+euv3UZisU5awfRawOvg07Utn/qBGuH4bRIEZKrA/4LzZyXhZr8g== dependencies: - "@babel/types" "^7.13.0" + "@babel/types" "^7.15.6" jsesc "^2.5.1" source-map "^0.5.0" -"@babel/helper-compilation-targets@^7.13.0": - version "7.13.0" - resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.13.0.tgz#c9cf29b82a76fd637f0faa35544c4ace60a155a1" - integrity sha512-SOWD0JK9+MMIhTQiUVd4ng8f3NXhPVQvTv7D3UN4wbp/6cAHnB2EmMaU1zZA2Hh1gwme+THBrVSqTFxHczTh0Q== - dependencies: - "@babel/compat-data" "^7.13.0" - "@babel/helper-validator-option" "^7.12.17" - browserslist "^4.14.5" - semver "7.0.0" - -"@babel/helper-function-name@^7.12.13": - version "7.12.13" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.12.13.tgz#93ad656db3c3c2232559fd7b2c3dbdcbe0eb377a" - integrity sha512-TZvmPn0UOqmvi5G4vvw0qZTpVptGkB1GL61R6lKvrSdIxGm5Pky7Q3fpKiIkQCAtRCBUwB0PaThlx9vebCDSwA== - dependencies: - "@babel/helper-get-function-arity" "^7.12.13" - "@babel/template" "^7.12.13" - "@babel/types" "^7.12.13" - -"@babel/helper-get-function-arity@^7.12.13": - version "7.12.13" - resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.12.13.tgz#bc63451d403a3b3082b97e1d8b3fe5bd4091e583" - integrity sha512-DjEVzQNz5LICkzN0REdpD5prGoidvbdYk1BVgRUOINaWJP2t6avB27X1guXK1kXNrX0WMfsrm1A/ZBthYuIMQg== - dependencies: - "@babel/types" "^7.12.13" - -"@babel/helper-member-expression-to-functions@^7.13.0": - version "7.13.0" - resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.13.0.tgz#6aa4bb678e0f8c22f58cdb79451d30494461b091" - integrity sha512-yvRf8Ivk62JwisqV1rFRMxiSMDGnN6KH1/mDMmIrij4jztpQNRoHqqMG3U6apYbGRPJpgPalhva9Yd06HlUxJQ== - dependencies: - "@babel/types" "^7.13.0" - -"@babel/helper-module-imports@^7.12.13": - version "7.12.13" - resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.12.13.tgz#ec67e4404f41750463e455cc3203f6a32e93fcb0" - integrity sha512-NGmfvRp9Rqxy0uHSSVP+SRIW1q31a7Ji10cLBcqSDUngGentY4FRiHOFZFE1CLU5eiL0oE8reH7Tg1y99TDM/g== - dependencies: - "@babel/types" "^7.12.13" - -"@babel/helper-module-transforms@^7.13.0": - version "7.13.0" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.13.0.tgz#42eb4bd8eea68bab46751212c357bfed8b40f6f1" - integrity sha512-Ls8/VBwH577+pw7Ku1QkUWIyRRNHpYlts7+qSqBBFCW3I8QteB9DxfcZ5YJpOwH6Ihe/wn8ch7fMGOP1OhEIvw== - dependencies: - "@babel/helper-module-imports" "^7.12.13" - "@babel/helper-replace-supers" "^7.13.0" - "@babel/helper-simple-access" "^7.12.13" - "@babel/helper-split-export-declaration" "^7.12.13" - "@babel/helper-validator-identifier" "^7.12.11" - "@babel/template" "^7.12.13" - "@babel/traverse" "^7.13.0" - "@babel/types" "^7.13.0" - lodash "^4.17.19" - -"@babel/helper-optimise-call-expression@^7.12.13": - version "7.12.13" - resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.12.13.tgz#5c02d171b4c8615b1e7163f888c1c81c30a2aaea" - integrity sha512-BdWQhoVJkp6nVjB7nkFWcn43dkprYauqtk++Py2eaf/GRDFm5BxRqEIZCiHlZUGAVmtwKcsVL1dC68WmzeFmiA== - dependencies: - "@babel/types" "^7.12.13" - -"@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.8.0": - version "7.13.0" - resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.13.0.tgz#806526ce125aed03373bc416a828321e3a6a33af" - integrity sha512-ZPafIPSwzUlAoWT8DKs1W2VyF2gOWthGd5NGFMsBcMMol+ZhK+EQY/e6V96poa6PA/Bh+C9plWN0hXO1uB8AfQ== - -"@babel/helper-replace-supers@^7.13.0": - version "7.13.0" - resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.13.0.tgz#6034b7b51943094cb41627848cb219cb02be1d24" - integrity sha512-Segd5me1+Pz+rmN/NFBOplMbZG3SqRJOBlY+mA0SxAv6rjj7zJqr1AVr3SfzUVTLCv7ZLU5FycOM/SBGuLPbZw== +"@babel/helper-compilation-targets@^7.15.4": + version "7.15.4" + resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.15.4.tgz#cf6d94f30fbefc139123e27dd6b02f65aeedb7b9" + integrity sha512-rMWPCirulnPSe4d+gwdWXLfAXTTBj8M3guAf5xFQJ0nvFY7tfNAFnWdqaHegHlgDZOCT4qvhF3BYlSJag8yhqQ== dependencies: - "@babel/helper-member-expression-to-functions" "^7.13.0" - "@babel/helper-optimise-call-expression" "^7.12.13" - "@babel/traverse" "^7.13.0" - "@babel/types" "^7.13.0" - -"@babel/helper-simple-access@^7.12.13": - version "7.12.13" - resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.12.13.tgz#8478bcc5cacf6aa1672b251c1d2dde5ccd61a6c4" - integrity sha512-0ski5dyYIHEfwpWGx5GPWhH35j342JaflmCeQmsPWcrOQDtCN6C1zKAVRFVbK53lPW2c9TsuLLSUDf0tIGJ5hA== - dependencies: - "@babel/types" "^7.12.13" - -"@babel/helper-split-export-declaration@^7.12.13": - version "7.12.13" - resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.12.13.tgz#e9430be00baf3e88b0e13e6f9d4eaf2136372b05" - integrity sha512-tCJDltF83htUtXx5NLcaDqRmknv652ZWCHyoTETf1CXYJdPC7nohZohjUgieXhv0hTJdRf2FjDueFehdNucpzg== - dependencies: - "@babel/types" "^7.12.13" - -"@babel/helper-validator-identifier@^7.12.11": - version "7.12.11" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz#c9a1f021917dcb5ccf0d4e453e399022981fc9ed" - integrity sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw== - -"@babel/helper-validator-option@^7.12.17": - version "7.12.17" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.12.17.tgz#d1fbf012e1a79b7eebbfdc6d270baaf8d9eb9831" - integrity sha512-TopkMDmLzq8ngChwRlyjR6raKD6gMSae4JdYDB8bByKreQgG0RBTuKe9LRxW3wFtUnjxOPRKBDwEH6Mg5KeDfw== - -"@babel/helpers@^7.13.0": - version "7.13.0" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.13.0.tgz#7647ae57377b4f0408bf4f8a7af01c42e41badc0" - integrity sha512-aan1MeFPxFacZeSz6Ld7YZo5aPuqnKlD7+HZY75xQsueczFccP9A7V05+oe0XpLwHK3oLorPe9eaAUljL7WEaQ== - dependencies: - "@babel/template" "^7.12.13" - "@babel/traverse" "^7.13.0" - "@babel/types" "^7.13.0" + "@babel/compat-data" "^7.15.0" + "@babel/helper-validator-option" "^7.14.5" + browserslist "^4.16.6" + semver "^6.3.0" -"@babel/highlight@^7.10.4", "@babel/highlight@^7.12.13": - version "7.12.13" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.12.13.tgz#8ab538393e00370b26271b01fa08f7f27f2e795c" - integrity sha512-kocDQvIbgMKlWxXe9fof3TQ+gkIPOUSEYhJjqUjvKMez3krV7vbzYCDq39Oj11UAVK7JqPVGQPlgE85dPNlQww== - dependencies: - "@babel/helper-validator-identifier" "^7.12.11" +"@babel/helper-function-name@^7.15.4": + version "7.15.4" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.15.4.tgz#845744dafc4381a4a5fb6afa6c3d36f98a787ebc" + integrity sha512-Z91cOMM4DseLIGOnog+Z8OI6YseR9bua+HpvLAQ2XayUGU+neTtX+97caALaLdyu53I/fjhbeCnWnRH1O3jFOw== + dependencies: + "@babel/helper-get-function-arity" "^7.15.4" + "@babel/template" "^7.15.4" + "@babel/types" "^7.15.4" + +"@babel/helper-get-function-arity@^7.15.4": + version "7.15.4" + resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.15.4.tgz#098818934a137fce78b536a3e015864be1e2879b" + integrity sha512-1/AlxSF92CmGZzHnC515hm4SirTxtpDnLEJ0UyEMgTMZN+6bxXKg04dKhiRx5Enel+SUA1G1t5Ed/yQia0efrA== + dependencies: + "@babel/types" "^7.15.4" + +"@babel/helper-hoist-variables@^7.15.4": + version "7.15.4" + resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.15.4.tgz#09993a3259c0e918f99d104261dfdfc033f178df" + integrity sha512-VTy085egb3jUGVK9ycIxQiPbquesq0HUQ+tPO0uv5mPEBZipk+5FkRKiWq5apuyTE9FUrjENB0rCf8y+n+UuhA== + dependencies: + "@babel/types" "^7.15.4" + +"@babel/helper-member-expression-to-functions@^7.15.4": + version "7.15.4" + resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.15.4.tgz#bfd34dc9bba9824a4658b0317ec2fd571a51e6ef" + integrity sha512-cokOMkxC/BTyNP1AlY25HuBWM32iCEsLPI4BHDpJCHHm1FU2E7dKWWIXJgQgSFiu4lp8q3bL1BIKwqkSUviqtA== + dependencies: + "@babel/types" "^7.15.4" + +"@babel/helper-module-imports@^7.15.4": + version "7.15.4" + resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.15.4.tgz#e18007d230632dea19b47853b984476e7b4e103f" + integrity sha512-jeAHZbzUwdW/xHgHQ3QmWR4Jg6j15q4w/gCfwZvtqOxoo5DKtLHk8Bsf4c5RZRC7NmLEs+ohkdq8jFefuvIxAA== + dependencies: + "@babel/types" "^7.15.4" + +"@babel/helper-module-transforms@^7.15.8": + version "7.15.8" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.15.8.tgz#d8c0e75a87a52e374a8f25f855174786a09498b2" + integrity sha512-DfAfA6PfpG8t4S6npwzLvTUpp0sS7JrcuaMiy1Y5645laRJIp/LiLGIBbQKaXSInK8tiGNI7FL7L8UvB8gdUZg== + dependencies: + "@babel/helper-module-imports" "^7.15.4" + "@babel/helper-replace-supers" "^7.15.4" + "@babel/helper-simple-access" "^7.15.4" + "@babel/helper-split-export-declaration" "^7.15.4" + "@babel/helper-validator-identifier" "^7.15.7" + "@babel/template" "^7.15.4" + "@babel/traverse" "^7.15.4" + "@babel/types" "^7.15.6" + +"@babel/helper-optimise-call-expression@^7.15.4": + version "7.15.4" + resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.15.4.tgz#f310a5121a3b9cc52d9ab19122bd729822dee171" + integrity sha512-E/z9rfbAOt1vDW1DR7k4SzhzotVV5+qMciWV6LaG1g4jeFrkDlJedjtV4h0i4Q/ITnUu+Pk08M7fczsB9GXBDw== + dependencies: + "@babel/types" "^7.15.4" + +"@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.8.0": + version "7.14.5" + resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.14.5.tgz#5ac822ce97eec46741ab70a517971e443a70c5a9" + integrity sha512-/37qQCE3K0vvZKwoK4XU/irIJQdIfCJuhU5eKnNxpFDsOkgFaUAwbv+RYw6eYgsC0E4hS7r5KqGULUogqui0fQ== + +"@babel/helper-replace-supers@^7.15.4": + version "7.15.4" + resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.15.4.tgz#52a8ab26ba918c7f6dee28628b07071ac7b7347a" + integrity sha512-/ztT6khaXF37MS47fufrKvIsiQkx1LBRvSJNzRqmbyeZnTwU9qBxXYLaaT/6KaxfKhjs2Wy8kG8ZdsFUuWBjzw== + dependencies: + "@babel/helper-member-expression-to-functions" "^7.15.4" + "@babel/helper-optimise-call-expression" "^7.15.4" + "@babel/traverse" "^7.15.4" + "@babel/types" "^7.15.4" + +"@babel/helper-simple-access@^7.15.4": + version "7.15.4" + resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.15.4.tgz#ac368905abf1de8e9781434b635d8f8674bcc13b" + integrity sha512-UzazrDoIVOZZcTeHHEPYrr1MvTR/K+wgLg6MY6e1CJyaRhbibftF6fR2KU2sFRtI/nERUZR9fBd6aKgBlIBaPg== + dependencies: + "@babel/types" "^7.15.4" + +"@babel/helper-split-export-declaration@^7.15.4": + version "7.15.4" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.15.4.tgz#aecab92dcdbef6a10aa3b62ab204b085f776e257" + integrity sha512-HsFqhLDZ08DxCpBdEVtKmywj6PQbwnF6HHybur0MAnkAKnlS6uHkwnmRIkElB2Owpfb4xL4NwDmDLFubueDXsw== + dependencies: + "@babel/types" "^7.15.4" + +"@babel/helper-validator-identifier@^7.14.5", "@babel/helper-validator-identifier@^7.14.9", "@babel/helper-validator-identifier@^7.15.7": + version "7.15.7" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.15.7.tgz#220df993bfe904a4a6b02ab4f3385a5ebf6e2389" + integrity sha512-K4JvCtQqad9OY2+yTU8w+E82ywk/fe+ELNlt1G8z3bVGlZfn/hOcQQsUhGhW/N+tb3fxK800wLtKOE/aM0m72w== + +"@babel/helper-validator-option@^7.14.5": + version "7.14.5" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.14.5.tgz#6e72a1fff18d5dfcb878e1e62f1a021c4b72d5a3" + integrity sha512-OX8D5eeX4XwcroVW45NMvoYaIuFI+GQpA2a8Gi+X/U/cDUIRsV37qQfF905F0htTRCREQIB4KqPeaveRJUl3Ow== + +"@babel/helpers@^7.15.4": + version "7.15.4" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.15.4.tgz#5f40f02050a3027121a3cf48d497c05c555eaf43" + integrity sha512-V45u6dqEJ3w2rlryYYXf6i9rQ5YMNu4FLS6ngs8ikblhu2VdR1AqAd6aJjBzmf2Qzh6KOLqKHxEN9+TFbAkAVQ== + dependencies: + "@babel/template" "^7.15.4" + "@babel/traverse" "^7.15.4" + "@babel/types" "^7.15.4" + +"@babel/highlight@^7.10.4", "@babel/highlight@^7.14.5": + version "7.14.5" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.14.5.tgz#6861a52f03966405001f6aa534a01a24d99e8cd9" + integrity sha512-qf9u2WFWVV0MppaL877j2dBtQIDgmidgjGk5VIMw3OadXvYaXn66U1BFlH2t4+t3i+8PhedppRv+i40ABzd+gg== + dependencies: + "@babel/helper-validator-identifier" "^7.14.5" chalk "^2.0.0" js-tokens "^4.0.0" -"@babel/parser@^7.1.0", "@babel/parser@^7.12.13", "@babel/parser@^7.13.0", "@babel/parser@^7.13.4": - version "7.13.4" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.13.4.tgz#340211b0da94a351a6f10e63671fa727333d13ab" - integrity sha512-uvoOulWHhI+0+1f9L4BoozY7U5cIkZ9PgJqvb041d6vypgUmtVPG4vmGm4pSggjl8BELzvHyUeJSUyEMY6b+qA== +"@babel/parser@*", "@babel/parser@^7.1.0", "@babel/parser@^7.15.4", "@babel/parser@^7.15.7", "@babel/parser@^7.15.8", "@babel/parser@^7.7.2": + version "7.15.8" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.15.8.tgz#7bacdcbe71bdc3ff936d510c15dcea7cf0b99016" + integrity sha512-BRYa3wcQnjS/nqI8Ac94pYYpJfojHVvVXJ97+IDCImX4Jc8W8Xv1+47enbruk+q1etOpsQNwnfFcNGw+gtPGxA== "@babel/plugin-syntax-async-generators@^7.8.4": version "7.8.4" @@ -254,50 +259,56 @@ "@babel/helper-plugin-utils" "^7.8.0" "@babel/plugin-syntax-top-level-await@^7.8.3": - version "7.12.13" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.12.13.tgz#c5f0fa6e249f5b739727f923540cf7a806130178" - integrity sha512-A81F9pDwyS7yM//KwbCSDqy3Uj4NMIurtplxphWxoYtNPov7cJsDkAFNNyVlIZ3jwGycVsurZ+LtOA8gZ376iQ== + version "7.14.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz#c1cfdadc35a646240001f06138247b741c34d94c" + integrity sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw== dependencies: - "@babel/helper-plugin-utils" "^7.12.13" + "@babel/helper-plugin-utils" "^7.14.5" -"@babel/runtime@^7.11.0", "@babel/runtime@^7.11.2", "@babel/runtime@^7.7.6": - version "7.13.6" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.13.6.tgz#86e0fad6cbb46a680e21c1aa4748717a058d345a" - integrity sha512-Y/DEVhSQ91u27rxq7D0EH/sewS6+x06p/MgO1VppbDHMzYXLZrAR5cFjCom78e9RUw1BQAq6qJg6fXc/ep7glA== +"@babel/plugin-syntax-typescript@^7.7.2": + version "7.14.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.14.5.tgz#b82c6ce471b165b5ce420cf92914d6fb46225716" + integrity sha512-u6OXzDaIXjEstBRRoBCQ/uKQKlbuaeE5in0RvWdA4pN6AhqxTIwUsnHPU1CFZA/amYObMsuWhYfRl3Ch90HD0Q== dependencies: - regenerator-runtime "^0.13.4" + "@babel/helper-plugin-utils" "^7.14.5" -"@babel/template@^7.12.13", "@babel/template@^7.3.3": - version "7.12.13" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.12.13.tgz#530265be8a2589dbb37523844c5bcb55947fb327" - integrity sha512-/7xxiGA57xMo/P2GVvdEumr8ONhFOhfgq2ihK3h1e6THqzTAkHbkXgB0xI9yeTfIUoH3+oAeHhqm/I43OTbbjA== +"@babel/runtime@^7.14.6", "@babel/runtime@^7.7.6": + version "7.15.4" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.15.4.tgz#fd17d16bfdf878e6dd02d19753a39fa8a8d9c84a" + integrity sha512-99catp6bHCaxr4sJ/DbTGgHS4+Rs2RVd2g7iOap6SLGPDknRK9ztKNsE/Fg6QhSeh1FGE5f6gHGQmvvn3I3xhw== dependencies: - "@babel/code-frame" "^7.12.13" - "@babel/parser" "^7.12.13" - "@babel/types" "^7.12.13" + regenerator-runtime "^0.13.4" -"@babel/traverse@^7.1.0", "@babel/traverse@^7.13.0": - version "7.13.0" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.13.0.tgz#6d95752475f86ee7ded06536de309a65fc8966cc" - integrity sha512-xys5xi5JEhzC3RzEmSGrs/b3pJW/o87SypZ+G/PhaE7uqVQNv/jlmVIBXuoh5atqQ434LfXV+sf23Oxj0bchJQ== - dependencies: - "@babel/code-frame" "^7.12.13" - "@babel/generator" "^7.13.0" - "@babel/helper-function-name" "^7.12.13" - "@babel/helper-split-export-declaration" "^7.12.13" - "@babel/parser" "^7.13.0" - "@babel/types" "^7.13.0" +"@babel/template@^7.15.4", "@babel/template@^7.3.3": + version "7.15.4" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.15.4.tgz#51898d35dcf3faa670c4ee6afcfd517ee139f194" + integrity sha512-UgBAfEa1oGuYgDIPM2G+aHa4Nlo9Lh6mGD2bDBGMTbYnc38vulXPuC1MGjYILIEmlwl6Rd+BPR9ee3gm20CBtg== + dependencies: + "@babel/code-frame" "^7.14.5" + "@babel/parser" "^7.15.4" + "@babel/types" "^7.15.4" + +"@babel/traverse@^7.1.0", "@babel/traverse@^7.15.4", "@babel/traverse@^7.7.2": + version "7.15.4" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.15.4.tgz#ff8510367a144bfbff552d9e18e28f3e2889c22d" + integrity sha512-W6lQD8l4rUbQR/vYgSuCAE75ADyyQvOpFVsvPPdkhf6lATXAsQIG9YdtOcu8BB1dZ0LKu+Zo3c1wEcbKeuhdlA== + dependencies: + "@babel/code-frame" "^7.14.5" + "@babel/generator" "^7.15.4" + "@babel/helper-function-name" "^7.15.4" + "@babel/helper-hoist-variables" "^7.15.4" + "@babel/helper-split-export-declaration" "^7.15.4" + "@babel/parser" "^7.15.4" + "@babel/types" "^7.15.4" debug "^4.1.0" globals "^11.1.0" - lodash "^4.17.19" -"@babel/types@^7.0.0", "@babel/types@^7.12.13", "@babel/types@^7.13.0", "@babel/types@^7.3.0", "@babel/types@^7.3.3": - version "7.13.0" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.13.0.tgz#74424d2816f0171b4100f0ab34e9a374efdf7f80" - integrity sha512-hE+HE8rnG1Z6Wzo+MhaKE5lM5eMx71T4EHJgku2E3xIfaULhDcxiiRxUYgwX8qwP1BBSlag+TdGOt6JAidIZTA== +"@babel/types@*", "@babel/types@^7.0.0", "@babel/types@^7.15.4", "@babel/types@^7.15.6", "@babel/types@^7.3.0", "@babel/types@^7.3.3": + version "7.15.6" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.15.6.tgz#99abdc48218b2881c058dd0a7ab05b99c9be758f" + integrity sha512-BPU+7QhqNjmWyDO0/vitH/CuhpV8ZmK1wpKva8nuyNF5MJfuRNWMc+hc14+u9xT93kvykMdncrJT19h74uB1Ig== dependencies: - "@babel/helper-validator-identifier" "^7.12.11" - lodash "^4.17.19" + "@babel/helper-validator-identifier" "^7.14.9" to-fast-properties "^2.0.0" "@bcoe/v8-coverage@^0.2.3": @@ -305,307 +316,311 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@cnakazawa/watch@^1.0.3": - version "1.0.4" - resolved "https://registry.yarnpkg.com/@cnakazawa/watch/-/watch-1.0.4.tgz#f864ae85004d0fcab6f50be9141c4da368d1656a" - integrity sha512-v9kIhKwjeZThiWrLmj0y17CWoyddASLj9O2yvbZkbvw/N3rWOYy9zkV66ursAoVr0mV15bL8g0c4QZUE6cdDoQ== +"@commitlint/cli@^13.1.0": + version "13.2.1" + resolved "https://registry.yarnpkg.com/@commitlint/cli/-/cli-13.2.1.tgz#80ebd46beef6ceed3bb0c0842bcda8d02a3c91de" + integrity sha512-JGzYk2ay5JkRS5w+FLQzr0u/Kih52ds4HPpa3vnwVOQN8Q+S1VYr8Nk/6kRm6uNYsAcC1nejtuDxRdLcLh/9TA== dependencies: - exec-sh "^0.3.2" - minimist "^1.2.0" - -"@commitlint/cli@^11.0.0": - version "11.0.0" - resolved "https://registry.yarnpkg.com/@commitlint/cli/-/cli-11.0.0.tgz#698199bc52afed50aa28169237758fa14a67b5d3" - integrity sha512-YWZWg1DuqqO5Zjh7vUOeSX76vm0FFyz4y0cpGMFhrhvUi5unc4IVfCXZ6337R9zxuBtmveiRuuhQqnRRer+13g== - dependencies: - "@babel/runtime" "^7.11.2" - "@commitlint/format" "^11.0.0" - "@commitlint/lint" "^11.0.0" - "@commitlint/load" "^11.0.0" - "@commitlint/read" "^11.0.0" - chalk "4.1.0" - core-js "^3.6.1" - get-stdin "8.0.0" + "@commitlint/format" "^13.2.0" + "@commitlint/lint" "^13.2.0" + "@commitlint/load" "^13.2.1" + "@commitlint/read" "^13.2.0" + "@commitlint/types" "^13.2.0" lodash "^4.17.19" resolve-from "5.0.0" resolve-global "1.0.0" - yargs "^15.1.0" + yargs "^17.0.0" -"@commitlint/config-conventional@^11.0.0": - version "11.0.0" - resolved "https://registry.yarnpkg.com/@commitlint/config-conventional/-/config-conventional-11.0.0.tgz#3fa300a1b639273946de3c3f15e1cda518333422" - integrity sha512-SNDRsb5gLuDd2PL83yCOQX6pE7gevC79UPFx+GLbLfw6jGnnbO9/tlL76MLD8MOViqGbo7ZicjChO9Gn+7tHhA== +"@commitlint/config-conventional@^13.1.0": + version "13.2.0" + resolved "https://registry.yarnpkg.com/@commitlint/config-conventional/-/config-conventional-13.2.0.tgz#2ad24fecc56ae9619dbe0934b98a98b18ace0bec" + integrity sha512-7u7DdOiF+3qSdDlbQGfpvCH8DCQdLFvnI2+VucYmmV7E92iD6t9PBj+UjIoSQCaMAzYp27Vkall78AkcXBh6Xw== dependencies: conventional-changelog-conventionalcommits "^4.3.1" -"@commitlint/config-lerna-scopes@^11.0.0": - version "11.0.0" - resolved "https://registry.yarnpkg.com/@commitlint/config-lerna-scopes/-/config-lerna-scopes-11.0.0.tgz#4152287c5d13ea844160507523b2f98b015adf4a" - integrity sha512-/PjLKefMlnG+Sk27MY3MZo+T/9/PrgDcLk1YCSPVHNkXibXiS2Hb5NEMuNHzPxwts4IvJo0WIOb0YOBx5GBsdA== +"@commitlint/config-lerna-scopes@^13.1.0": + version "13.2.0" + resolved "https://registry.yarnpkg.com/@commitlint/config-lerna-scopes/-/config-lerna-scopes-13.2.0.tgz#5382831c6562bb94ad889799fa24cf540a79a652" + integrity sha512-d2VqA1EX+G+XvEWIr3B37bydtMm+UHvmAWU6z0v5oOgUvBwZcNMzvTrwdZB6524YCmspi2q+kwgimMR+sBilXQ== dependencies: - import-from "3.0.0" + globby "^11.0.1" + import-from "4.0.0" resolve-pkg "2.0.0" - semver "7.3.2" + semver "7.3.5" -"@commitlint/ensure@^11.0.0": - version "11.0.0" - resolved "https://registry.yarnpkg.com/@commitlint/ensure/-/ensure-11.0.0.tgz#3e796b968ab5b72bc6f8a6040076406306c987fb" - integrity sha512-/T4tjseSwlirKZdnx4AuICMNNlFvRyPQimbZIOYujp9DSO6XRtOy9NrmvWujwHsq9F5Wb80QWi4WMW6HMaENug== +"@commitlint/ensure@^13.2.0": + version "13.2.0" + resolved "https://registry.yarnpkg.com/@commitlint/ensure/-/ensure-13.2.0.tgz#990c24f753781d1f14c1647c52d34a5730892e3d" + integrity sha512-rqhT62RehdLTRBu8OrPHnRCCd/7RmHEE4TiTlT4BLlr5ls5jlZhecOQWJ8np872uCNirrJ5NFjnjYYdbkNoW9Q== dependencies: - "@commitlint/types" "^11.0.0" + "@commitlint/types" "^13.2.0" lodash "^4.17.19" -"@commitlint/execute-rule@^11.0.0": - version "11.0.0" - resolved "https://registry.yarnpkg.com/@commitlint/execute-rule/-/execute-rule-11.0.0.tgz#3ed60ab7a33019e58d90e2d891b75d7df77b4b4d" - integrity sha512-g01p1g4BmYlZ2+tdotCavrMunnPFPhTzG1ZiLKTCYrooHRbmvqo42ZZn4QMStUEIcn+jfLb6BRZX3JzIwA1ezQ== +"@commitlint/execute-rule@^13.2.0": + version "13.2.0" + resolved "https://registry.yarnpkg.com/@commitlint/execute-rule/-/execute-rule-13.2.0.tgz#e112159d6647bc5afe2f77c2080ef0f615fd541f" + integrity sha512-6nPwpN0hwTYmsH3WM4hCdN+NrMopgRIuQ0aqZa+jnwMoS/g6ljliQNYfL+m5WO306BaIu1W3yYpbW5aI8gEr0g== -"@commitlint/format@^11.0.0": - version "11.0.0" - resolved "https://registry.yarnpkg.com/@commitlint/format/-/format-11.0.0.tgz#ac47b0b9ca46540c0082c721b290794e67bdc51b" - integrity sha512-bpBLWmG0wfZH/svzqD1hsGTpm79TKJWcf6EXZllh2J/LSSYKxGlv967lpw0hNojme0sZd4a/97R3qA2QHWWSLg== +"@commitlint/format@^13.2.0": + version "13.2.0" + resolved "https://registry.yarnpkg.com/@commitlint/format/-/format-13.2.0.tgz#eccfff0a09ced8533afb21b2b3a1e28176b109d5" + integrity sha512-yNBQJe6YFhM1pJAta4LvzQxccSKof6axJH7ALYjuhQqfT8AKlad7Y/2SuJ07ioyreNIqwOTuF2UfU8yJ7JzEIQ== dependencies: - "@commitlint/types" "^11.0.0" + "@commitlint/types" "^13.2.0" chalk "^4.0.0" -"@commitlint/is-ignored@^11.0.0": - version "11.0.0" - resolved "https://registry.yarnpkg.com/@commitlint/is-ignored/-/is-ignored-11.0.0.tgz#7b803eda56276dbe7fec51eb1510676198468f39" - integrity sha512-VLHOUBN+sOlkYC4tGuzE41yNPO2w09sQnOpfS+pSPnBFkNUUHawEuA44PLHtDvQgVuYrMAmSWFQpWabMoP5/Xg== - dependencies: - "@commitlint/types" "^11.0.0" - semver "7.3.2" - -"@commitlint/lint@^11.0.0": - version "11.0.0" - resolved "https://registry.yarnpkg.com/@commitlint/lint/-/lint-11.0.0.tgz#01e062cd1b0e7c3d756aa2c246462e0b6a3348a4" - integrity sha512-Q8IIqGIHfwKr8ecVZyYh6NtXFmKw4YSEWEr2GJTB/fTZXgaOGtGFZDWOesCZllQ63f1s/oWJYtVv5RAEuwN8BQ== - dependencies: - "@commitlint/is-ignored" "^11.0.0" - "@commitlint/parse" "^11.0.0" - "@commitlint/rules" "^11.0.0" - "@commitlint/types" "^11.0.0" - -"@commitlint/load@>6.1.1", "@commitlint/load@^11.0.0": - version "11.0.0" - resolved "https://registry.yarnpkg.com/@commitlint/load/-/load-11.0.0.tgz#f736562f0ffa7e773f8808fea93319042ee18211" - integrity sha512-t5ZBrtgvgCwPfxmG811FCp39/o3SJ7L+SNsxFL92OR4WQxPcu6c8taD0CG2lzOHGuRyuMxZ7ps3EbngT2WpiCg== - dependencies: - "@commitlint/execute-rule" "^11.0.0" - "@commitlint/resolve-extends" "^11.0.0" - "@commitlint/types" "^11.0.0" - chalk "4.1.0" +"@commitlint/is-ignored@^13.2.0": + version "13.2.0" + resolved "https://registry.yarnpkg.com/@commitlint/is-ignored/-/is-ignored-13.2.0.tgz#532ddfb5d62a489ff4d3ad88bcbee44e8c7d2c8f" + integrity sha512-onnx4WctHFPPkHGFFAZBIWRSaNwuhixIIfbwPhcZ6IewwQX5n4jpjwM1GokA7vhlOnQ57W7AavbKUGjzIVtnRQ== + dependencies: + "@commitlint/types" "^13.2.0" + semver "7.3.5" + +"@commitlint/lint@^13.2.0": + version "13.2.0" + resolved "https://registry.yarnpkg.com/@commitlint/lint/-/lint-13.2.0.tgz#b568c96bd21c8fa8eec359a5e21d22743206761f" + integrity sha512-5XYkh0e9ehHjA7BxAHFpjPgr1qqbFY8OFG1wpBiAhycbYBtJnQmculA2wcwqTM40YCUBqEvWFdq86jTG8fbkMw== + dependencies: + "@commitlint/is-ignored" "^13.2.0" + "@commitlint/parse" "^13.2.0" + "@commitlint/rules" "^13.2.0" + "@commitlint/types" "^13.2.0" + +"@commitlint/load@>6.1.1", "@commitlint/load@^13.2.1": + version "13.2.1" + resolved "https://registry.yarnpkg.com/@commitlint/load/-/load-13.2.1.tgz#d5d926dbd05021c02837c438ff1057025b28b745" + integrity sha512-qlaJkj0hfa9gtWRfCfbgFBTK3GYQRmjZhba4l9mUu4wV9lEZ4ICFlrLtd/8kaLXf/8xbrPhkAPkVFOAqM0YwUQ== + dependencies: + "@commitlint/execute-rule" "^13.2.0" + "@commitlint/resolve-extends" "^13.2.0" + "@commitlint/types" "^13.2.0" + "@endemolshinegroup/cosmiconfig-typescript-loader" "^3.0.2" + chalk "^4.0.0" cosmiconfig "^7.0.0" lodash "^4.17.19" resolve-from "^5.0.0" - -"@commitlint/message@^11.0.0": - version "11.0.0" - resolved "https://registry.yarnpkg.com/@commitlint/message/-/message-11.0.0.tgz#83554c3cbbc884fd07b473593bc3e94bcaa3ee05" - integrity sha512-01ObK/18JL7PEIE3dBRtoMmU6S3ecPYDTQWWhcO+ErA3Ai0KDYqV5VWWEijdcVafNpdeUNrEMigRkxXHQLbyJA== - -"@commitlint/parse@^11.0.0": - version "11.0.0" - resolved "https://registry.yarnpkg.com/@commitlint/parse/-/parse-11.0.0.tgz#d18b08cf67c35d02115207d7009306a2e8e7c901" - integrity sha512-DekKQAIYWAXIcyAZ6/PDBJylWJ1BROTfDIzr9PMVxZRxBPc1gW2TG8fLgjZfBP5mc0cuthPkVi91KQQKGri/7A== - dependencies: - conventional-changelog-angular "^5.0.0" - conventional-commits-parser "^3.0.0" - -"@commitlint/read@^11.0.0": - version "11.0.0" - resolved "https://registry.yarnpkg.com/@commitlint/read/-/read-11.0.0.tgz#f24240548c63587bba139fa5a364cab926077016" - integrity sha512-37V0V91GSv0aDzMzJioKpCoZw6l0shk7+tRG8RkW1GfZzUIytdg3XqJmM+IaIYpaop0m6BbZtfq+idzUwJnw7g== - dependencies: - "@commitlint/top-level" "^11.0.0" - fs-extra "^9.0.0" + typescript "^4.4.3" + +"@commitlint/message@^13.2.0": + version "13.2.0" + resolved "https://registry.yarnpkg.com/@commitlint/message/-/message-13.2.0.tgz#1a60f578551750a8d6b533be8a40541fc2e928a8" + integrity sha512-+LlErJj2F2AC86xJb33VJIvSt25xqSF1I0b0GApSgoUtQBeJhx4SxIj1BLvGcLVmbRmbgTzAFq/QylwLId7EhA== + +"@commitlint/parse@^13.2.0": + version "13.2.0" + resolved "https://registry.yarnpkg.com/@commitlint/parse/-/parse-13.2.0.tgz#48054602bd73dccbffee4f9ba8b2549c857ba0b7" + integrity sha512-AtfKSQJQADbDhW+kuC5PxOyBANsYCuuJlZRZ2PYslOz2rvWwZ93zt+nKjM4g7C9ETbz0uq4r7/EoOsTJ2nJqfQ== + dependencies: + "@commitlint/types" "^13.2.0" + conventional-changelog-angular "^5.0.11" + conventional-commits-parser "^3.2.2" + +"@commitlint/read@^13.2.0": + version "13.2.0" + resolved "https://registry.yarnpkg.com/@commitlint/read/-/read-13.2.0.tgz#2af580322ec6297478aba84fa8ec24fd27c35a54" + integrity sha512-7db5e1Bn3re6hQN0SqygTMF/QX6/MQauoJn3wJiUHE93lvwO6aFQxT3qAlYeyBPwfWsmDz/uSH454jtrSsv3Uw== + dependencies: + "@commitlint/top-level" "^13.2.0" + "@commitlint/types" "^13.2.0" + fs-extra "^10.0.0" git-raw-commits "^2.0.0" -"@commitlint/resolve-extends@^11.0.0": - version "11.0.0" - resolved "https://registry.yarnpkg.com/@commitlint/resolve-extends/-/resolve-extends-11.0.0.tgz#158ecbe27d4a2a51d426111a01478e216fbb1036" - integrity sha512-WinU6Uv6L7HDGLqn/To13KM1CWvZ09VHZqryqxXa1OY+EvJkfU734CwnOEeNlSCK7FVLrB4kmodLJtL1dkEpXw== +"@commitlint/resolve-extends@^13.2.0": + version "13.2.0" + resolved "https://registry.yarnpkg.com/@commitlint/resolve-extends/-/resolve-extends-13.2.0.tgz#74f48512eb1785abe07336a5208225fdf7fec327" + integrity sha512-HLCMkqMKtvl1yYLZ1Pm0UpFvd0kYjsm1meLOGZ7VkOd9G/XX+Fr1S2G5AT2zeiDw7WUVYK8lGVMNa319bnV+aw== dependencies: import-fresh "^3.0.0" lodash "^4.17.19" resolve-from "^5.0.0" resolve-global "^1.0.0" -"@commitlint/rules@^11.0.0": - version "11.0.0" - resolved "https://registry.yarnpkg.com/@commitlint/rules/-/rules-11.0.0.tgz#bdb310cc6fc55c9f8d7d917a22b69055c535c375" - integrity sha512-2hD9y9Ep5ZfoNxDDPkQadd2jJeocrwC4vJ98I0g8pNYn/W8hS9+/FuNpolREHN8PhmexXbkjrwyQrWbuC0DVaA== +"@commitlint/rules@^13.2.0": + version "13.2.0" + resolved "https://registry.yarnpkg.com/@commitlint/rules/-/rules-13.2.0.tgz#e272fbd4099c2fe98bca1277d7f8caa3578b8f43" + integrity sha512-O3A9S7blOzvHfzrJrUQe9JxdtGy154ol/GXHwvd8WfMJ10y5ryBB4b6+0YZ1XhItWzrEASOfOKbD++EdLV90dQ== dependencies: - "@commitlint/ensure" "^11.0.0" - "@commitlint/message" "^11.0.0" - "@commitlint/to-lines" "^11.0.0" - "@commitlint/types" "^11.0.0" + "@commitlint/ensure" "^13.2.0" + "@commitlint/message" "^13.2.0" + "@commitlint/to-lines" "^13.2.0" + "@commitlint/types" "^13.2.0" + execa "^5.0.0" -"@commitlint/to-lines@^11.0.0": - version "11.0.0" - resolved "https://registry.yarnpkg.com/@commitlint/to-lines/-/to-lines-11.0.0.tgz#86dea151c10eea41e39ea96fa4de07839258a7fe" - integrity sha512-TIDTB0Y23jlCNubDROUVokbJk6860idYB5cZkLWcRS9tlb6YSoeLn1NLafPlrhhkkkZzTYnlKYzCVrBNVes1iw== +"@commitlint/to-lines@^13.2.0": + version "13.2.0" + resolved "https://registry.yarnpkg.com/@commitlint/to-lines/-/to-lines-13.2.0.tgz#e65d16340f353b496e90609b452f23f4b0be0b6a" + integrity sha512-ZfWZix2y/CzewReCrj5g0nKOEfj5HW9eBMDrqjJJMPApve00CWv0tYrFCGXuGlv244lW4uvWJt6J/0HLRWsfyg== -"@commitlint/top-level@^11.0.0": - version "11.0.0" - resolved "https://registry.yarnpkg.com/@commitlint/top-level/-/top-level-11.0.0.tgz#bb2d1b6e5ed3be56874633b59e1f7de118c32783" - integrity sha512-O0nFU8o+Ws+py5pfMQIuyxOtfR/kwtr5ybqTvR+C2lUPer2x6lnQU+OnfD7hPM+A+COIUZWx10mYQvkR3MmtAA== +"@commitlint/top-level@^13.2.0": + version "13.2.0" + resolved "https://registry.yarnpkg.com/@commitlint/top-level/-/top-level-13.2.0.tgz#869814e8ac0fec6a6e1f2e9665a318e4dc979e1e" + integrity sha512-knBvWYbIq6VV6VPHrVeDsxDiJq4Zq6cv5NIYU3iesKAsmK2KlLfsZPa+Ig96Y4AqAPU3zNJwjHxYkz9qxdBbfA== dependencies: find-up "^5.0.0" -"@commitlint/types@^11.0.0": - version "11.0.0" - resolved "https://registry.yarnpkg.com/@commitlint/types/-/types-11.0.0.tgz#719cf05fcc1abb6533610a2e0f5dd1e61eac14fe" - integrity sha512-VoNqai1vR5anRF5Tuh/+SWDFk7xi7oMwHrHrbm1BprYXjB2RJsWLhUrStMssDxEl5lW/z3EUdg8RvH/IUBccSQ== +"@commitlint/types@^13.2.0": + version "13.2.0" + resolved "https://registry.yarnpkg.com/@commitlint/types/-/types-13.2.0.tgz#ed8128f9e41383f8f0ee1b0370c724826821e581" + integrity sha512-RRVHEqmk1qn/dIaSQhvuca6k/6Z54G+r/KyimZ8gnAFielGiGUpsFRhIY3qhd5rXClVxDaa3nlcyTWckSccotQ== + dependencies: + chalk "^4.0.0" -"@cspell/cspell-bundled-dicts@^5.2.4": - version "5.2.4" - resolved "https://registry.yarnpkg.com/@cspell/cspell-bundled-dicts/-/cspell-bundled-dicts-5.2.4.tgz#dd0e161bb2203f19a2dd9358c3eb9daaffb7a336" - integrity sha512-IVoTVdFIWnWmJYBwjbsYtFyH6fD8bClDZrFpUa/a84vXVopcH1ZjpwotDsHO+P3O1GCFTacT1Z2Lyh56xowmxw== +"@cspell/cspell-bundled-dicts@^5.12.3": + version "5.12.3" + resolved "https://registry.yarnpkg.com/@cspell/cspell-bundled-dicts/-/cspell-bundled-dicts-5.12.3.tgz#d4ae61d03c6f991f4b03b03ee718830522bf74d5" + integrity sha512-f3kyUHYxyGqNt2DTphpmP8hr38YTL48wr4Dq7pZDbqDjLkerq9T7ufX2CZ2OfydBEdIgduX2UXwiow7IfdwY/A== dependencies: - "@cspell/dict-aws" "^1.0.13" - "@cspell/dict-bash" "^1.0.11" - "@cspell/dict-companies" "^1.0.35" - "@cspell/dict-cpp" "^1.1.37" + "@cspell/dict-ada" "^1.1.2" + "@cspell/dict-aws" "^1.0.14" + "@cspell/dict-bash" "^1.0.15" + "@cspell/dict-companies" "^1.0.40" + "@cspell/dict-cpp" "^1.1.40" "@cspell/dict-cryptocurrencies" "^1.0.10" - "@cspell/dict-csharp" "^1.0.10" - "@cspell/dict-css" "^1.0.10" - "@cspell/dict-django" "^1.0.25" - "@cspell/dict-dotnet" "^1.0.24" - "@cspell/dict-elixir" "^1.0.23" - "@cspell/dict-en-gb" "^1.1.27" - "@cspell/dict-en_us" "^1.2.39" - "@cspell/dict-filetypes" "^1.1.5" + "@cspell/dict-csharp" "^1.0.11" + "@cspell/dict-css" "^1.0.12" + "@cspell/dict-django" "^1.0.26" + "@cspell/dict-dotnet" "^1.0.31" + "@cspell/dict-elixir" "^1.0.25" + "@cspell/dict-en-gb" "^1.1.33" + "@cspell/dict-en_us" "^2.1.1" + "@cspell/dict-filetypes" "^1.1.8" "@cspell/dict-fonts" "^1.0.14" - "@cspell/dict-fullstack" "^1.0.36" + "@cspell/dict-fullstack" "^1.0.38" "@cspell/dict-golang" "^1.1.24" - "@cspell/dict-haskell" "^1.0.12" - "@cspell/dict-html" "^1.1.5" + "@cspell/dict-haskell" "^1.0.13" + "@cspell/dict-html" "^1.1.9" "@cspell/dict-html-symbol-entities" "^1.0.23" - "@cspell/dict-java" "^1.0.22" - "@cspell/dict-latex" "^1.0.23" + "@cspell/dict-java" "^1.0.23" + "@cspell/dict-latex" "^1.0.25" "@cspell/dict-lorem-ipsum" "^1.0.22" "@cspell/dict-lua" "^1.0.16" - "@cspell/dict-node" "^1.0.10" - "@cspell/dict-npm" "^1.0.10" - "@cspell/dict-php" "^1.0.23" - "@cspell/dict-powershell" "^1.0.14" - "@cspell/dict-python" "^1.0.33" - "@cspell/dict-ruby" "^1.0.12" - "@cspell/dict-rust" "^1.0.22" + "@cspell/dict-node" "^1.0.12" + "@cspell/dict-npm" "^1.0.16" + "@cspell/dict-php" "^1.0.24" + "@cspell/dict-powershell" "^1.0.18" + "@cspell/dict-public-licenses" "^1.0.3" + "@cspell/dict-python" "^2.0.3" + "@cspell/dict-ruby" "^1.0.14" + "@cspell/dict-rust" "^1.0.23" "@cspell/dict-scala" "^1.0.21" - "@cspell/dict-software-terms" "^1.0.25" - "@cspell/dict-typescript" "^1.0.16" + "@cspell/dict-software-terms" "^1.0.47" + "@cspell/dict-typescript" "^1.0.19" -"@cspell/cspell-types@^5.2.4": - version "5.2.4" - resolved "https://registry.yarnpkg.com/@cspell/cspell-types/-/cspell-types-5.2.4.tgz#361fdc6c008b82a5c0dfd6c1fd2bee2cb7255b4b" - integrity sha512-luv2hzoKdDrNs2LPDHuS+r9hOniZlYiJJU8og8ftGyuwjytnSaTUvtY8SzFqquKQJ4+rty6AF2RS/foQ69s/2Q== +"@cspell/cspell-types@^5.12.3": + version "5.12.3" + resolved "https://registry.yarnpkg.com/@cspell/cspell-types/-/cspell-types-5.12.3.tgz#bfbebfa29d2f280d99785fdbc3e97bea60b47e5b" + integrity sha512-4l43apk3QGMkpszirKjrRGWmzZVuCyvoa0+kgWCl28dviLKsVonop8liBJaBzjmZbdpe27IKpMrNtj0fOus+fw== -"@cspell/dict-aws@^1.0.13": - version "1.0.13" - resolved "https://registry.yarnpkg.com/@cspell/dict-aws/-/dict-aws-1.0.13.tgz#5961c9764a2f731e488debee1c70fd488ee59727" - integrity sha512-9rq8BS5p418THq12PIkLQmGhg4kQ8tMH8vyB7gTF2lOrA+xMwV5HjZAepoYiJCxDQI5GAQJZlAaBi5DRG3AN2A== +"@cspell/dict-ada@^1.1.2": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@cspell/dict-ada/-/dict-ada-1.1.2.tgz#89556226c1d5f856ce1f7afa85543b04fa477092" + integrity sha512-UDrcYcKIVyXDz5mInJabRNQpJoehjBFvja5W+GQyu9pGcx3BS3cAU8mWENstGR0Qc/iFTxB010qwF8F3cHA/aA== -"@cspell/dict-bash@^1.0.11": - version "1.0.11" - resolved "https://registry.yarnpkg.com/@cspell/dict-bash/-/dict-bash-1.0.11.tgz#5ba56250e467d2c2ed3f2795081f4934af0c9afc" - integrity sha512-DTOugbPacEFIav5s+VniByouu4apD1SKS5inwiBndw0TH3Pkm4MFTPUwfT1y7Ki4HEIyfRI2ughig2045SBqRw== +"@cspell/dict-aws@^1.0.14": + version "1.0.14" + resolved "https://registry.yarnpkg.com/@cspell/dict-aws/-/dict-aws-1.0.14.tgz#beddede1053ce3622400e36c65da9fd2954e939d" + integrity sha512-K21CfB4ZpKYwwDQiPfic2zJA/uxkbsd4IQGejEvDAhE3z8wBs6g6BwwqdVO767M9NgZqc021yAVpr79N5pWe3w== + +"@cspell/dict-bash@^1.0.15": + version "1.0.15" + resolved "https://registry.yarnpkg.com/@cspell/dict-bash/-/dict-bash-1.0.15.tgz#ac70ab1572d9b8d0e3cf7777383b6caa2daad022" + integrity sha512-rY5Bq4RWTgJTioG8vqFbCmnalc/UEM+iBuAZBYvBfT3nU/6SN00Zjyvlh823ir2ODkUryT29CwRYwXcPnuM04w== -"@cspell/dict-companies@^1.0.35": - version "1.0.35" - resolved "https://registry.yarnpkg.com/@cspell/dict-companies/-/dict-companies-1.0.35.tgz#3f244e005afa533cdec8896ceaf866c82d77251a" - integrity sha512-lFoXFqXgAUjj14t7VJm+D/j9jU9kn4Eud+Q2gVQTKs6+oMivJ0hROpqZv/CEYHlm/4MpP5Livp0z0E6ARCE0kQ== +"@cspell/dict-companies@^1.0.40": + version "1.0.40" + resolved "https://registry.yarnpkg.com/@cspell/dict-companies/-/dict-companies-1.0.40.tgz#edd7f47fc683dfa1b02cd48fb12ad732d2eece61" + integrity sha512-Aw07qiTroqSST2P5joSrC4uOA05zTXzI2wMb+me3q4Davv1D9sCkzXY0TGoC2vzhNv5ooemRi9KATGaBSdU1sw== -"@cspell/dict-cpp@^1.1.37": - version "1.1.37" - resolved "https://registry.yarnpkg.com/@cspell/dict-cpp/-/dict-cpp-1.1.37.tgz#79b33a42ebc0d7bed19bd8d07559e95c8668a70a" - integrity sha512-1X48pxiOdAw5Q7zj0k8/L5B1YY2W0k4go4CB5rcsuGRzsWXsdnKXHQTeMTAw7epIe4lj+Ef9oWaU+ODQpDZOCQ== +"@cspell/dict-cpp@^1.1.40": + version "1.1.40" + resolved "https://registry.yarnpkg.com/@cspell/dict-cpp/-/dict-cpp-1.1.40.tgz#f9a859e19d31b83f07a106e4c3c8720a2d93595b" + integrity sha512-sscfB3woNDNj60/yGXAdwNtIRWZ89y35xnIaJVDMk5TPMMpaDvuk0a34iOPIq0g4V+Y8e3RyAg71SH6ADwSjGw== "@cspell/dict-cryptocurrencies@^1.0.10": version "1.0.10" resolved "https://registry.yarnpkg.com/@cspell/dict-cryptocurrencies/-/dict-cryptocurrencies-1.0.10.tgz#04426fdfee8752818b375686d34a154b2fb40c7d" integrity sha512-47ABvDJOkaST/rXipNMfNvneHUzASvmL6K/CbOFpYKfsd0x23Jc9k1yaOC7JAm82XSC/8a7+3Yu+Fk2jVJNnsA== -"@cspell/dict-csharp@^1.0.10": - version "1.0.10" - resolved "https://registry.yarnpkg.com/@cspell/dict-csharp/-/dict-csharp-1.0.10.tgz#3806ff6646764f720ac02a0eb65d6b97b99811fe" - integrity sha512-jAl4HeRTwbN2+tEqL8cjM7GLXSJr9Jde3k8CqfxKME7qwVRCoBW6RkhyDHfEyaQ1LomDhnr35uiHEVrw7xCHMw== +"@cspell/dict-csharp@^1.0.11": + version "1.0.11" + resolved "https://registry.yarnpkg.com/@cspell/dict-csharp/-/dict-csharp-1.0.11.tgz#cacdf477a31ca8326c2c91bee0b42b9f6b3c4a7c" + integrity sha512-nub+ZCiTgmT87O+swI+FIAzNwaZPWUGckJU4GN402wBq420V+F4ZFqNV7dVALJrGaWH7LvADRtJxi6cZVHJKeA== -"@cspell/dict-css@^1.0.10": - version "1.0.10" - resolved "https://registry.yarnpkg.com/@cspell/dict-css/-/dict-css-1.0.10.tgz#80ef4e89ec83a8386a69d9770b76184a2c26370e" - integrity sha512-QQbh+GBAyTVU8Wlf1xZPxZQQ3uRzb1lYE5RjE7hnRTSc4HtWYcb2+6XpO51QDl/dRhCmP3vEHzFF/swzHRa5hw== +"@cspell/dict-css@^1.0.12": + version "1.0.12" + resolved "https://registry.yarnpkg.com/@cspell/dict-css/-/dict-css-1.0.12.tgz#ec01cec102c8b128aad5e29c97dfb7a982887e12" + integrity sha512-K6yuxej7n454O7dwKG6lHacHrAOMZ0PhMEbmV6qH2JH0U4TtWXfBASYugHvXZCDDx1UObpiJP+3tQJiBqfGpHA== -"@cspell/dict-django@^1.0.25": - version "1.0.25" - resolved "https://registry.yarnpkg.com/@cspell/dict-django/-/dict-django-1.0.25.tgz#7f821e781b2ae35bc12491a663ca506185f6d008" - integrity sha512-kQfZhvjAodb5CNgryYoEKlUaHA+IVGhZIpON5ZJBuxrPUZ4SyklACPXKxDyXnKAibrERoi4zNL6pBbsljEL03w== +"@cspell/dict-django@^1.0.26": + version "1.0.26" + resolved "https://registry.yarnpkg.com/@cspell/dict-django/-/dict-django-1.0.26.tgz#b97ce0112fbe8c3c3ada0387c68971b5e27483ab" + integrity sha512-mn9bd7Et1L2zuibc08GVHTiD2Go3/hdjyX5KLukXDklBkq06r+tb0OtKtf1zKodtFDTIaYekGADhNhA6AnKLkg== -"@cspell/dict-dotnet@^1.0.24": - version "1.0.24" - resolved "https://registry.yarnpkg.com/@cspell/dict-dotnet/-/dict-dotnet-1.0.24.tgz#432a1f3bf6920860de86a6e7101639c1b4e348be" - integrity sha512-TxmMSh2T7C+DzF0rGTwVWFGCwqiwqLpyKar37kJt62bhadbxFKv+XxkLjOLVmgoqhA17BXM813hIjjZrICj4jg== +"@cspell/dict-dotnet@^1.0.31": + version "1.0.32" + resolved "https://registry.yarnpkg.com/@cspell/dict-dotnet/-/dict-dotnet-1.0.32.tgz#412af0bf1f65c5902c8ef8a4f1decae2892790e2" + integrity sha512-9H9vXrgJB4KF8xsyTToXO53cXD33iyfrpT4mhCds+YLUw3P3x3E9myszgJzshnrxYBvQZ+QMII57Qr6SjZVk4Q== -"@cspell/dict-elixir@^1.0.23": - version "1.0.23" - resolved "https://registry.yarnpkg.com/@cspell/dict-elixir/-/dict-elixir-1.0.23.tgz#1d341626467a2ca109b72c5368645af1f12417a4" - integrity sha512-UKDgNSZ36o31IX4NjCF/lCuOAoLEEsjSB2KwMD2ucT66MSFEPLk1womGY+iWblISeeBmB9EehfL1hjgoRwGlUw== +"@cspell/dict-elixir@^1.0.25": + version "1.0.25" + resolved "https://registry.yarnpkg.com/@cspell/dict-elixir/-/dict-elixir-1.0.25.tgz#bec4fd754c99f646e553184df12df88b54da1c04" + integrity sha512-ZmawoBYjM5k+8fNudRMkK+PpHjhyAFAZt2rUu1EGj2rbCvE3Fn2lhRbDjbreN7nWRvcLRTW+xuPXtKP11X0ahQ== -"@cspell/dict-en-gb@^1.1.27": - version "1.1.27" - resolved "https://registry.yarnpkg.com/@cspell/dict-en-gb/-/dict-en-gb-1.1.27.tgz#5c567fcc0f737e9ac8dc8fa76eb39928a6a2b35b" - integrity sha512-0tY939q0vzmsUotKQe/i8mDGqiiw4V3Kv/nkTvxFfVQAd6JRfpWBKlMbVV5Oy37nQkQiwkDLY4v90AbyqOvG8Q== +"@cspell/dict-en-gb@^1.1.33": + version "1.1.33" + 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@^1.2.39": - version "1.2.39" - resolved "https://registry.yarnpkg.com/@cspell/dict-en_us/-/dict-en_us-1.2.39.tgz#44e30abee9a20ec3cbddd2c91f21de7e3b4ca4ea" - integrity sha512-rMn5pIm3bl+t3Qxdf3WMkLZ2kzs/FDHSCDR9ha+JOtCJ1yrJTLdlZvokGDLwMScztbgooEvabsN8AUqPutOSog== +"@cspell/dict-en_us@^2.1.1": + version "2.1.1" + resolved "https://registry.yarnpkg.com/@cspell/dict-en_us/-/dict-en_us-2.1.1.tgz#3db0fec45a821ad66747e42d303d2448d37a158e" + integrity sha512-7kHOqve9DVFsb1e/wKME3CZhj48zOqvXNaA1Cd82ZkaHf3aL7pUBx3cxI7Xopj/dcK1ZkhUKh+2nBxPIWIibNg== -"@cspell/dict-filetypes@^1.1.5": - version "1.1.5" - resolved "https://registry.yarnpkg.com/@cspell/dict-filetypes/-/dict-filetypes-1.1.5.tgz#d1024eb0ae3b316e3e9411e2f36e624844345563" - integrity sha512-yfkB37J+hL6W8qa4AknFp7u6CGECrw2ql2/y0lUKruLQYid0ApK+bH+ll+Sqgl2YS5QAOhclskc72aQHAcRJIQ== +"@cspell/dict-filetypes@^1.1.8": + version "1.1.8" + resolved "https://registry.yarnpkg.com/@cspell/dict-filetypes/-/dict-filetypes-1.1.8.tgz#c161ab48667b6539cbc91a70ff0b037fa436a64e" + integrity sha512-EllahNkhzvLWo0ptwu0l3oEeAJOQSUpZnDfnKRIh6mJVehuSovNHwA9vrdZ8jBUjuqcfaN2e7c32zN0D/qvWJQ== "@cspell/dict-fonts@^1.0.14": version "1.0.14" resolved "https://registry.yarnpkg.com/@cspell/dict-fonts/-/dict-fonts-1.0.14.tgz#7b18129910d30bd23cd9187d0c0009dfc3fef4ba" integrity sha512-VhIX+FVYAnqQrOuoFEtya6+H72J82cIicz9QddgknsTqZQ3dvgp6lmVnsQXPM3EnzA8n1peTGpLDwHzT7ociLA== -"@cspell/dict-fullstack@^1.0.36": - version "1.0.36" - resolved "https://registry.yarnpkg.com/@cspell/dict-fullstack/-/dict-fullstack-1.0.36.tgz#47c9d1b515405751be40cc177608e1ea6d121c02" - integrity sha512-npScBMAoZsjVE5uC1I72vmM1FCYnqzHH1ujgiBkbKd6Dp73VZ1f6OtpSQgqq9/onb0mSmMVF2kw4gPj8BlwGHg== +"@cspell/dict-fullstack@^1.0.38": + version "1.0.38" + resolved "https://registry.yarnpkg.com/@cspell/dict-fullstack/-/dict-fullstack-1.0.38.tgz#a26d9db5fdc51e8743f57e51b0fa44a1d4791cf6" + integrity sha512-4reajWiUxwWrSyZaWm9e15kaWzjYcZbzlB+CVcxE1+0NqdIoqlEESDhbnrAjKPSq+jspKtes7nQ1CdZEOj1gCA== "@cspell/dict-golang@^1.1.24": version "1.1.24" resolved "https://registry.yarnpkg.com/@cspell/dict-golang/-/dict-golang-1.1.24.tgz#3830812aec816eca46a6d793fcc7710c09d4f5b9" integrity sha512-qq3Cjnx2U1jpeWAGJL1GL0ylEhUMqyaR36Xij6Y6Aq4bViCRp+HRRqk0x5/IHHbOrti45h3yy7ii1itRFo+Xkg== -"@cspell/dict-haskell@^1.0.12": - version "1.0.12" - resolved "https://registry.yarnpkg.com/@cspell/dict-haskell/-/dict-haskell-1.0.12.tgz#cc6ec4d0466b029683e9f861dea3d0e95c514606" - integrity sha512-JrSSuV2oY8Z1/qYi8j1w5M3eokiFkcpRtCrxpKlHYFXFEvmqTH9D8qvzVbAkrQpefMppy8uIUzknSzhwAc/MQA== +"@cspell/dict-haskell@^1.0.13": + version "1.0.13" + resolved "https://registry.yarnpkg.com/@cspell/dict-haskell/-/dict-haskell-1.0.13.tgz#bd159ef474ef427757dd4bc6a66cda977946c927" + integrity sha512-kvl8T84cnYRPpND/P3D86P6WRSqebsbk0FnMfy27zo15L5MLAb3d3MOiT1kW3vEWfQgzUD7uddX/vUiuroQ8TA== "@cspell/dict-html-symbol-entities@^1.0.23": version "1.0.23" resolved "https://registry.yarnpkg.com/@cspell/dict-html-symbol-entities/-/dict-html-symbol-entities-1.0.23.tgz#0efbdbc7712c9fbe545e14acac637226ac948f2d" integrity sha512-PV0UBgcBFbBLf/m1wfkVMM8w96kvfHoiCGLWO6BR3Q9v70IXoE4ae0+T+f0CkxcEkacMqEQk/I7vuE9MzrjaNw== -"@cspell/dict-html@^1.1.5": - version "1.1.5" - resolved "https://registry.yarnpkg.com/@cspell/dict-html/-/dict-html-1.1.5.tgz#45e7a3e23c27f248b4fab962ce71efdc23a0d9fd" - integrity sha512-ecwFDcponQgLpC9VJK7SRAbLu3CAlw6KUSlLtVOiN3zxlh27MDCCMp9jCD4UImZGACe0YQ1Zj0DW7PjXkHuKHg== - -"@cspell/dict-java@^1.0.22": - version "1.0.22" - resolved "https://registry.yarnpkg.com/@cspell/dict-java/-/dict-java-1.0.22.tgz#30e660803922755c314fb61e9c8cd58a1f4bd47e" - integrity sha512-CVAJ29dx1XwwutgsMgaj5eCl1Nc7X7qFhWL2KkAdu78A/NUIaS+1I9KS0hHhdZx/wLke9dH8TR7NyPQGpGxeAw== +"@cspell/dict-html@^1.1.9": + version "1.1.9" + resolved "https://registry.yarnpkg.com/@cspell/dict-html/-/dict-html-1.1.9.tgz#e506ca550ffcdad820ba0aa157a48be869f23bf2" + integrity sha512-vvnYia0tyIS5Fdoz+gEQm77MGZZE66kOJjuNpIYyRHCXFAhWdYz3SmkRm6YKJSWSvuO+WBJYTKDvkOxSh3Fx/w== -"@cspell/dict-latex@^1.0.23": +"@cspell/dict-java@^1.0.23": version "1.0.23" - resolved "https://registry.yarnpkg.com/@cspell/dict-latex/-/dict-latex-1.0.23.tgz#bb216e676c66b931bdfd1c8cb93e9625b5b66d45" - integrity sha512-xn9VvX5+q9xxELiOl5o8W/0nKympOc9i6Bq6PqX3fxhVWV4xURT18sp14OI9dNXxOSm5TRzL96vgLYvK/FYQVw== + resolved "https://registry.yarnpkg.com/@cspell/dict-java/-/dict-java-1.0.23.tgz#ec95ff2f2c34d5e8e08ba817980b37e387e608cb" + integrity sha512-LcOg9srYLDoNGd8n3kbfDBlZD+LOC9IVcnFCdua1b/luCHNVmlgBx7e677qPu7olpMYOD5TQIVW2OmM1+/6MFA== + +"@cspell/dict-latex@^1.0.25": + version "1.0.25" + resolved "https://registry.yarnpkg.com/@cspell/dict-latex/-/dict-latex-1.0.25.tgz#6ecf5b8b8fdf46cb8a0f070052dd687e25089e59" + integrity sha512-cEgg91Migqcp1SdVV7dUeMxbPDhxdNo6Fgq2eygAXQjIOFK520FFvh/qxyBvW90qdZbIRoU2AJpchyHfGuwZFA== "@cspell/dict-lorem-ipsum@^1.0.22": version "1.0.22" @@ -617,69 +632,110 @@ resolved "https://registry.yarnpkg.com/@cspell/dict-lua/-/dict-lua-1.0.16.tgz#c0ca43628f8927fc10731fd27cd9ee0af651bf6a" integrity sha512-YiHDt8kmHJ8nSBy0tHzaxiuitYp+oJ66ffCYuFWTNB3//Y0SI4OGHU3omLsQVeXIfCeVrO4DrVvRDoCls9B5zQ== -"@cspell/dict-node@^1.0.10": - version "1.0.10" - resolved "https://registry.yarnpkg.com/@cspell/dict-node/-/dict-node-1.0.10.tgz#ed78fd80cb99087a817bc7773e64f1e8431171b5" - integrity sha512-MnLy0pOcd+Zo8+M8VmumrIQN5SuAduZZrYKHhvXfxdVfX5vl5BfD6Gl25hzH0DrlAVlJOWAnkMZZFMYh4nGWRA== +"@cspell/dict-node@^1.0.12": + version "1.0.12" + resolved "https://registry.yarnpkg.com/@cspell/dict-node/-/dict-node-1.0.12.tgz#a7236be30340ff8fe365f62c8d13121fdbe7f51c" + integrity sha512-RPNn/7CSkflAWk0sbSoOkg0ORrgBARUjOW3QjB11KwV1gSu8f5W/ij/S50uIXtlrfoBLqd4OyE04jyON+g/Xfg== -"@cspell/dict-npm@^1.0.10": - version "1.0.10" - resolved "https://registry.yarnpkg.com/@cspell/dict-npm/-/dict-npm-1.0.10.tgz#327ad3855effcfbf6d2dbb6f655ed29e729dd7a8" - integrity sha512-LxLjMOyELWtVBHpive60G3MJseid30M9GR5Vodo9cT6lqT1CkbdsNP9j3oTwVXHTMKB3I+IOHNapuFG1ILcEew== +"@cspell/dict-npm@^1.0.16": + version "1.0.16" + resolved "https://registry.yarnpkg.com/@cspell/dict-npm/-/dict-npm-1.0.16.tgz#86870686cd0af6354a206ab297872db1d84e9c1b" + integrity sha512-RwkuZGcYBxL3Yux3cSG/IOWGlQ1e9HLCpHeyMtTVGYKAIkFAVUnGrz20l16/Q7zUG7IEktBz5O42kAozrEnqMQ== -"@cspell/dict-php@^1.0.23": - version "1.0.23" - resolved "https://registry.yarnpkg.com/@cspell/dict-php/-/dict-php-1.0.23.tgz#8ee85fec8416a88b71edb2a53e26a79f280c9fa7" - integrity sha512-rRLf/09rXDrzs0DJuNXNmFVTw2b2zLmZKNF4LIPrFHYHvdfsMvwVqxkr/SAyhF8C6zi5sW0XYC/J0S/3IE927w== +"@cspell/dict-php@^1.0.24": + version "1.0.24" + resolved "https://registry.yarnpkg.com/@cspell/dict-php/-/dict-php-1.0.24.tgz#40c15a4c5e1e2deba28841e2b498595b13f0ff88" + integrity sha512-vHCqETX1idT9tN1plkxUFnXMIHjbbrNOINZh1PYSvVlBrOdahSaL/g6dOJZC5QTaaidoU4WXUlgnNb/7JN4Plg== -"@cspell/dict-powershell@^1.0.14": - version "1.0.14" - resolved "https://registry.yarnpkg.com/@cspell/dict-powershell/-/dict-powershell-1.0.14.tgz#f8998f2f413b3b94e69a512117de89552cfa1834" - integrity sha512-hisOXXi5PBXB5YKtrJQIis2FIRHgSW1U0/sd4yI36lzb3ZMEvGJwdAdyhXN3IGiqRUNxMzJiXAeXfhnia4xPtQ== +"@cspell/dict-powershell@^1.0.18": + version "1.0.19" + resolved "https://registry.yarnpkg.com/@cspell/dict-powershell/-/dict-powershell-1.0.19.tgz#b50d14b3b20e33f86b80318ccd7ef986ecba2549" + integrity sha512-zF/raM/lkhXeHf4I43OtK0gP9rBeEJFArscTVwLWOCIvNk21MJcNoTYoaGw+c056+Q+hJL0psGLO7QN+mxYH1A== -"@cspell/dict-python@^1.0.33": - version "1.0.33" - resolved "https://registry.yarnpkg.com/@cspell/dict-python/-/dict-python-1.0.33.tgz#39ddf401f63ee9b0f95e606d70693e61976a073b" - integrity sha512-tRmE4TzHDFPs7sJ1a3XbfyFrvRHwefVz+z1wkm6tkXK9TPrCbIS+rV/T8xhj205q4lpZQ/TkNB3lT40eLB9O8A== +"@cspell/dict-public-licenses@^1.0.3": + version "1.0.3" + resolved "https://registry.yarnpkg.com/@cspell/dict-public-licenses/-/dict-public-licenses-1.0.3.tgz#d02ee79f7b7aecd696695e5aba135e6553e154ec" + integrity sha512-sXjxOHJ9Q4rZvE1UbwpwJQ8EXO3fadKBjJIWmz0z+dZAbvTrmz5Ln1Ef9ruJvLPfwAps8m3TCV6Diz60RAQqHg== -"@cspell/dict-ruby@^1.0.12": - version "1.0.12" - resolved "https://registry.yarnpkg.com/@cspell/dict-ruby/-/dict-ruby-1.0.12.tgz#85af4c0c7e0d03c39115d4a2d1944befe31e04f8" - integrity sha512-1qGZpVbfWfGLujKFyt2Nd9bc7rNXdkjYIRfpGmn/fwVDhWz/D4Q8GLMQPB2ixocSuF3pjfsRTh1D+rKK17WFjg== +"@cspell/dict-python@^2.0.3": + version "2.0.4" + resolved "https://registry.yarnpkg.com/@cspell/dict-python/-/dict-python-2.0.4.tgz#9c2dc78445ef731b618386628bec8ae9fafa63b7" + integrity sha512-71X/VnyFPm6OPEkqmoVXCJz28RvBgktxy6zF6D5TLt97LbWg2JyRrWSXaf2+seVoLnJQ5CHACxcs+jyEyLhBJA== -"@cspell/dict-rust@^1.0.22": - version "1.0.22" - resolved "https://registry.yarnpkg.com/@cspell/dict-rust/-/dict-rust-1.0.22.tgz#4558e528c1e1aa2b0f1677d5918fa822106013e5" - integrity sha512-7WOIzv0BPiU+MssZbbMk8K+HR/g9Bcvd0+jXJC3/AKT8L6l0Mx0Tr/oF7cJ4xvCYgA84nBz3PhMZkabGSz/Nkg== +"@cspell/dict-ruby@^1.0.14": + version "1.0.14" + resolved "https://registry.yarnpkg.com/@cspell/dict-ruby/-/dict-ruby-1.0.14.tgz#6ecbda6e0a01e4692abd4a14b64ff8f61d86e161" + integrity sha512-XHBGN4U1y9rjRuqrCA+3yIm2TCdhwwHXpOEcWkNeyXm8K03yPnIrKFS+kap8GTTrLpfNDuFsrmkkQTa7ssXLRA== + +"@cspell/dict-rust@^1.0.23": + version "1.0.23" + resolved "https://registry.yarnpkg.com/@cspell/dict-rust/-/dict-rust-1.0.23.tgz#bcef79f74932d90a07f86efa11a8696788079ad8" + integrity sha512-lR4boDzs79YD6+30mmiSGAMMdwh7HTBAPUFSB0obR3Kidibfc3GZ+MHWZXay5dxZ4nBKM06vyjtanF9VJ8q1Iw== "@cspell/dict-scala@^1.0.21": version "1.0.21" resolved "https://registry.yarnpkg.com/@cspell/dict-scala/-/dict-scala-1.0.21.tgz#bfda392329061e2352fbcd33d228617742c93831" integrity sha512-5V/R7PRbbminTpPS3ywgdAalI9BHzcEjEj9ug4kWYvBIGwSnS7T6QCFCiu+e9LvEGUqQC+NHgLY4zs1NaBj2vA== -"@cspell/dict-software-terms@^1.0.25": - version "1.0.25" - resolved "https://registry.yarnpkg.com/@cspell/dict-software-terms/-/dict-software-terms-1.0.25.tgz#a42c488ebf0169727386b5ea7981ac2e40212014" - integrity sha512-GOHfmGT/X7QsKXFKS8riPVXI7jOTfcjSz/mzoUP8t1kOTkp+8qw+hxsQ31Z4Ctz5ZI7sh0xpFFYDNFFzG5XWgw== +"@cspell/dict-software-terms@^1.0.47": + version "1.0.48" + resolved "https://registry.yarnpkg.com/@cspell/dict-software-terms/-/dict-software-terms-1.0.48.tgz#dc45a91c64f9f86df3a047879d9f34aa17435bd0" + integrity sha512-pfF3Ys2gRffu5ElqkH7FQMDMi/iZMyOzpGMb3FSH0PJ2AnRQ5rRNWght1h2L36YxvXl0mWVaFrrfwiOyRIc8ZQ== -"@cspell/dict-typescript@^1.0.16": - version "1.0.16" - resolved "https://registry.yarnpkg.com/@cspell/dict-typescript/-/dict-typescript-1.0.16.tgz#18d20a91c4caf52540c795921a50b0e4ce3bc50c" - integrity sha512-DEKi6vD605ebDhCC4Hrtz29k59TcijPVsmVKheTpMrL1MD/S96Ftb19gW0pEIVK9vwYZIljmGwgz4qYyuM5Liw== +"@cspell/dict-typescript@^1.0.19": + version "1.0.19" + resolved "https://registry.yarnpkg.com/@cspell/dict-typescript/-/dict-typescript-1.0.19.tgz#44f3ad1c93ffc89ebf98fa6964e1634e6612fc30" + integrity sha512-qmJApzoVskDeJnLZzZMaafEDGbEg5Elt4c3Mpg49SWzIHm1N4VXCp5CcFfHsOinJ30dGrs3ARAJGJZIw56kK6A== -"@eslint/eslintrc@^0.3.0": - version "0.3.0" - resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.3.0.tgz#d736d6963d7003b6514e6324bec9c602ac340318" - integrity sha512-1JTKgrOKAHVivSvOYw+sJOunkBjUOvjqWk1DPja7ZFhIS2mX/4EgTT8M7eTK9jrKhL/FvXXEbQwIs3pg1xp3dg== +"@cspotcode/source-map-consumer@0.8.0": + version "0.8.0" + resolved "https://registry.yarnpkg.com/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz#33bf4b7b39c178821606f669bbc447a6a629786b" + integrity sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg== + +"@cspotcode/source-map-support@0.7.0": + version "0.7.0" + resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz#4789840aa859e46d2f3173727ab707c66bf344f5" + integrity sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA== + dependencies: + "@cspotcode/source-map-consumer" "0.8.0" + +"@endemolshinegroup/cosmiconfig-typescript-loader@^3.0.2": + version "3.0.2" + resolved "https://registry.yarnpkg.com/@endemolshinegroup/cosmiconfig-typescript-loader/-/cosmiconfig-typescript-loader-3.0.2.tgz#eea4635828dde372838b0909693ebd9aafeec22d" + integrity sha512-QRVtqJuS1mcT56oHpVegkKBlgtWjXw/gHNWO3eL9oyB5Sc7HBoc2OLG/nYpVfT/Jejvo3NUrD0Udk7XgoyDKkA== + dependencies: + lodash.get "^4" + make-error "^1" + ts-node "^9" + tslib "^2" + +"@eslint/eslintrc@^0.4.3": + version "0.4.3" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.4.3.tgz#9e42981ef035beb3dd49add17acb96e8ff6f394c" + integrity sha512-J6KFFz5QCYUJq3pf0mjEcCJVERbzv71PUIDczuh9JkwGEzced6CO5ADLHB1rbf/+oPBtoPfMYNOpGDzCANlbXw== dependencies: ajv "^6.12.4" debug "^4.1.1" espree "^7.3.0" - globals "^12.1.0" + globals "^13.9.0" + ignore "^4.0.6" + import-fresh "^3.2.1" + js-yaml "^3.13.1" + minimatch "^3.0.4" + strip-json-comments "^3.1.1" + +"@eslint/eslintrc@^1.0.3": + version "1.0.3" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-1.0.3.tgz#41f08c597025605f672251dcc4e8be66b5ed7366" + integrity sha512-DHI1wDPoKCBPoLZA3qDR91+3te/wDSc1YhKg3jR8NxKKRJq2hwHwcWv31cSwSYvIBrmbENoYMWcenW8uproQqg== + dependencies: + ajv "^6.12.4" + debug "^4.3.2" + espree "^9.0.0" + globals "^13.9.0" ignore "^4.0.6" import-fresh "^3.2.1" js-yaml "^3.13.1" - lodash "^4.17.20" minimatch "^3.0.4" strip-json-comments "^3.1.1" @@ -757,6 +813,29 @@ unique-filename "^1.1.1" which "^1.3.1" +"@humanwhocodes/config-array@^0.5.0": + version "0.5.0" + resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.5.0.tgz#1407967d4c6eecd7388f83acf1eaf4d0c6e58ef9" + integrity sha512-FagtKFz74XrTl7y6HCzQpwDfXP0yhxe9lHLD1UZxjvZIcbyRz8zTFF/yYNfSfzU414eDwZ1SrO0Qvtyf+wFMQg== + dependencies: + "@humanwhocodes/object-schema" "^1.2.0" + debug "^4.1.1" + minimatch "^3.0.4" + +"@humanwhocodes/config-array@^0.6.0": + version "0.6.0" + resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.6.0.tgz#b5621fdb3b32309d2d16575456cbc277fa8f021a" + integrity sha512-JQlEKbcgEUjBFhLIF4iqM7u/9lwgHRBcpHrmUNCALK0Q3amXN6lxdoXLnF0sm11E9VqTmBALR87IlUg1bZ8A9A== + dependencies: + "@humanwhocodes/object-schema" "^1.2.0" + debug "^4.1.1" + minimatch "^3.0.4" + +"@humanwhocodes/object-schema@^1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.0.tgz#87de7af9c231826fdd68ac7258f77c429e0e5fcf" + integrity sha512-wdppn25U8z/2yiaT6YGquE6X8sSv7hNMWSXYSSU1jGv/yd6XqjXgTDJ8KP4NgjTXfJ3GbRjeeb8RTV7a/VpM+w== + "@istanbuljs/load-nyc-config@^1.0.0": version "1.1.0" resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced" @@ -769,97 +848,97 @@ resolve-from "^5.0.0" "@istanbuljs/schema@^0.1.2": - version "0.1.2" - resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.2.tgz#26520bf09abe4a5644cd5414e37125a8954241dd" - integrity sha512-tsAQNx32a8CoFhjhijUIhI4kccIAgmGhy8LZMZgGfmXcpMbPRUqn5LWmgRttILi6yeGmBJd2xsPkFMs0PzgPCw== + version "0.1.3" + resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.3.tgz#e45e384e4b8ec16bce2fd903af78450f6bf7ec98" + integrity sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA== -"@jest/console@^26.6.2": - version "26.6.2" - resolved "https://registry.yarnpkg.com/@jest/console/-/console-26.6.2.tgz#4e04bc464014358b03ab4937805ee36a0aeb98f2" - integrity sha512-IY1R2i2aLsLr7Id3S6p2BA82GNWryt4oSvEXLAKc+L2zdi89dSkE8xC1C+0kpATG4JhBJREnQOH7/zmccM2B0g== +"@jest/console@^27.2.2", "@jest/console@^27.3.1": + version "27.3.1" + resolved "https://registry.yarnpkg.com/@jest/console/-/console-27.3.1.tgz#e8ea3a475d3f8162f23d69efbfaa9cbe486bee93" + integrity sha512-RkFNWmv0iui+qsOr/29q9dyfKTTT5DCuP31kUwg7rmOKPT/ozLeGLKJKVIiOfbiKyleUZKIrHwhmiZWVe8IMdw== dependencies: - "@jest/types" "^26.6.2" + "@jest/types" "^27.2.5" "@types/node" "*" chalk "^4.0.0" - jest-message-util "^26.6.2" - jest-util "^26.6.2" + jest-message-util "^27.3.1" + jest-util "^27.3.1" slash "^3.0.0" -"@jest/core@^26.6.3": - version "26.6.3" - resolved "https://registry.yarnpkg.com/@jest/core/-/core-26.6.3.tgz#7639fcb3833d748a4656ada54bde193051e45fad" - integrity sha512-xvV1kKbhfUqFVuZ8Cyo+JPpipAHHAV3kcDBftiduK8EICXmTFddryy3P7NfZt8Pv37rA9nEJBKCCkglCPt/Xjw== +"@jest/core@^27.3.1": + version "27.3.1" + resolved "https://registry.yarnpkg.com/@jest/core/-/core-27.3.1.tgz#04992ef1b58b17c459afb87ab56d81e63d386925" + integrity sha512-DMNE90RR5QKx0EA+wqe3/TNEwiRpOkhshKNxtLxd4rt3IZpCt+RSL+FoJsGeblRZmqdK4upHA/mKKGPPRAifhg== dependencies: - "@jest/console" "^26.6.2" - "@jest/reporters" "^26.6.2" - "@jest/test-result" "^26.6.2" - "@jest/transform" "^26.6.2" - "@jest/types" "^26.6.2" + "@jest/console" "^27.3.1" + "@jest/reporters" "^27.3.1" + "@jest/test-result" "^27.3.1" + "@jest/transform" "^27.3.1" + "@jest/types" "^27.2.5" "@types/node" "*" ansi-escapes "^4.2.1" chalk "^4.0.0" + emittery "^0.8.1" exit "^0.1.2" graceful-fs "^4.2.4" - jest-changed-files "^26.6.2" - jest-config "^26.6.3" - jest-haste-map "^26.6.2" - jest-message-util "^26.6.2" - jest-regex-util "^26.0.0" - jest-resolve "^26.6.2" - jest-resolve-dependencies "^26.6.3" - jest-runner "^26.6.3" - jest-runtime "^26.6.3" - jest-snapshot "^26.6.2" - jest-util "^26.6.2" - jest-validate "^26.6.2" - jest-watcher "^26.6.2" - micromatch "^4.0.2" - p-each-series "^2.1.0" + jest-changed-files "^27.3.0" + jest-config "^27.3.1" + jest-haste-map "^27.3.1" + jest-message-util "^27.3.1" + jest-regex-util "^27.0.6" + jest-resolve "^27.3.1" + jest-resolve-dependencies "^27.3.1" + jest-runner "^27.3.1" + jest-runtime "^27.3.1" + jest-snapshot "^27.3.1" + jest-util "^27.3.1" + jest-validate "^27.3.1" + jest-watcher "^27.3.1" + micromatch "^4.0.4" rimraf "^3.0.0" slash "^3.0.0" strip-ansi "^6.0.0" -"@jest/environment@^26.6.2": - version "26.6.2" - resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-26.6.2.tgz#ba364cc72e221e79cc8f0a99555bf5d7577cf92c" - integrity sha512-nFy+fHl28zUrRsCeMB61VDThV1pVTtlEokBRgqPrcT1JNq4yRNIyTHfyht6PqtUvY9IsuLGTrbG8kPXjSZIZwA== +"@jest/environment@^27.3.1": + version "27.3.1" + resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-27.3.1.tgz#2182defbce8d385fd51c5e7c7050f510bd4c86b1" + integrity sha512-BCKCj4mOVLme6Tanoyc9k0ultp3pnmuyHw73UHRPeeZxirsU/7E3HC4le/VDb/SMzE1JcPnto+XBKFOcoiJzVw== dependencies: - "@jest/fake-timers" "^26.6.2" - "@jest/types" "^26.6.2" + "@jest/fake-timers" "^27.3.1" + "@jest/types" "^27.2.5" "@types/node" "*" - jest-mock "^26.6.2" + jest-mock "^27.3.0" -"@jest/fake-timers@^26.6.2": - version "26.6.2" - resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-26.6.2.tgz#459c329bcf70cee4af4d7e3f3e67848123535aad" - integrity sha512-14Uleatt7jdzefLPYM3KLcnUl1ZNikaKq34enpb5XG9i81JpppDb5muZvonvKyrl7ftEHkKS5L5/eB/kxJ+bvA== +"@jest/fake-timers@^27.3.1": + version "27.3.1" + resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-27.3.1.tgz#1fad860ee9b13034762cdb94266e95609dfce641" + integrity sha512-M3ZFgwwlqJtWZ+QkBG5NmC23A9w+A6ZxNsO5nJxJsKYt4yguBd3i8TpjQz5NfCX91nEve1KqD9RA2Q+Q1uWqoA== dependencies: - "@jest/types" "^26.6.2" - "@sinonjs/fake-timers" "^6.0.1" + "@jest/types" "^27.2.5" + "@sinonjs/fake-timers" "^8.0.1" "@types/node" "*" - jest-message-util "^26.6.2" - jest-mock "^26.6.2" - jest-util "^26.6.2" + jest-message-util "^27.3.1" + jest-mock "^27.3.0" + jest-util "^27.3.1" -"@jest/globals@^26.6.2": - version "26.6.2" - resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-26.6.2.tgz#5b613b78a1aa2655ae908eba638cc96a20df720a" - integrity sha512-85Ltnm7HlB/KesBUuALwQ68YTU72w9H2xW9FjZ1eL1U3lhtefjjl5c2MiUbpXt/i6LaPRvoOFJ22yCBSfQ0JIA== +"@jest/globals@^27.3.1": + version "27.3.1" + resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-27.3.1.tgz#ce1dfb03d379237a9da6c1b99ecfaca1922a5f9e" + integrity sha512-Q651FWiWQAIFiN+zS51xqhdZ8g9b88nGCobC87argAxA7nMfNQq0Q0i9zTfQYgLa6qFXk2cGANEqfK051CZ8Pg== dependencies: - "@jest/environment" "^26.6.2" - "@jest/types" "^26.6.2" - expect "^26.6.2" + "@jest/environment" "^27.3.1" + "@jest/types" "^27.2.5" + expect "^27.3.1" -"@jest/reporters@^26.6.2": - version "26.6.2" - resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-26.6.2.tgz#1f518b99637a5f18307bd3ecf9275f6882a667f6" - integrity sha512-h2bW53APG4HvkOnVMo8q3QXa6pcaNt1HkwVsOPMBV6LD/q9oSpxNSYZQYkAnjdMjrJ86UuYeLo+aEZClV6opnw== +"@jest/reporters@27.2.2": + version "27.2.2" + resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-27.2.2.tgz#e2d41cd9f8088676b81b9a9908cb1ba67bdbee78" + integrity sha512-ufwZ8XoLChEfPffDeVGroYbhbcYPom3zKDiv4Flhe97rr/o2IfUXoWkDUDoyJ3/V36RFIMjokSu0IJ/pbFtbHg== dependencies: "@bcoe/v8-coverage" "^0.2.3" - "@jest/console" "^26.6.2" - "@jest/test-result" "^26.6.2" - "@jest/transform" "^26.6.2" - "@jest/types" "^26.6.2" + "@jest/console" "^27.2.2" + "@jest/test-result" "^27.2.2" + "@jest/transform" "^27.2.2" + "@jest/types" "^27.1.1" chalk "^4.0.0" collect-v8-coverage "^1.0.0" exit "^0.1.2" @@ -870,78 +949,116 @@ istanbul-lib-report "^3.0.0" istanbul-lib-source-maps "^4.0.0" istanbul-reports "^3.0.2" - jest-haste-map "^26.6.2" - jest-resolve "^26.6.2" - jest-util "^26.6.2" - jest-worker "^26.6.2" + jest-haste-map "^27.2.2" + jest-resolve "^27.2.2" + jest-util "^27.2.0" + jest-worker "^27.2.2" slash "^3.0.0" source-map "^0.6.0" string-length "^4.0.1" terminal-link "^2.0.0" - v8-to-istanbul "^7.0.0" - optionalDependencies: - node-notifier "^8.0.0" + v8-to-istanbul "^8.0.0" -"@jest/source-map@^26.6.2": - version "26.6.2" - resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-26.6.2.tgz#29af5e1e2e324cafccc936f218309f54ab69d535" - integrity sha512-YwYcCwAnNmOVsZ8mr3GfnzdXDAl4LaenZP5z+G0c8bzC9/dugL8zRmxZzdoTl4IaS3CryS1uWnROLPFmb6lVvA== +"@jest/reporters@^27.3.1": + version "27.3.1" + resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-27.3.1.tgz#28b5c1f5789481e23788048fa822ed15486430b9" + integrity sha512-m2YxPmL9Qn1emFVgZGEiMwDntDxRRQ2D58tiDQlwYTg5GvbFOKseYCcHtn0WsI8CG4vzPglo3nqbOiT8ySBT/w== + dependencies: + "@bcoe/v8-coverage" "^0.2.3" + "@jest/console" "^27.3.1" + "@jest/test-result" "^27.3.1" + "@jest/transform" "^27.3.1" + "@jest/types" "^27.2.5" + "@types/node" "*" + chalk "^4.0.0" + collect-v8-coverage "^1.0.0" + exit "^0.1.2" + glob "^7.1.2" + graceful-fs "^4.2.4" + istanbul-lib-coverage "^3.0.0" + istanbul-lib-instrument "^4.0.3" + istanbul-lib-report "^3.0.0" + istanbul-lib-source-maps "^4.0.0" + istanbul-reports "^3.0.2" + jest-haste-map "^27.3.1" + jest-resolve "^27.3.1" + jest-util "^27.3.1" + jest-worker "^27.3.1" + slash "^3.0.0" + source-map "^0.6.0" + string-length "^4.0.1" + terminal-link "^2.0.0" + v8-to-istanbul "^8.1.0" + +"@jest/source-map@^27.0.6": + version "27.0.6" + resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-27.0.6.tgz#be9e9b93565d49b0548b86e232092491fb60551f" + integrity sha512-Fek4mi5KQrqmlY07T23JRi0e7Z9bXTOOD86V/uS0EIW4PClvPDqZOyFlLpNJheS6QI0FNX1CgmPjtJ4EA/2M+g== dependencies: callsites "^3.0.0" graceful-fs "^4.2.4" source-map "^0.6.0" -"@jest/test-result@^26.6.2": - version "26.6.2" - resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-26.6.2.tgz#55da58b62df134576cc95476efa5f7949e3f5f18" - integrity sha512-5O7H5c/7YlojphYNrK02LlDIV2GNPYisKwHm2QTKjNZeEzezCbwYs9swJySv2UfPMyZ0VdsmMv7jIlD/IKYQpQ== +"@jest/test-result@27.2.2": + version "27.2.2" + resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-27.2.2.tgz#cd4ba1ca9b0521e463bd4b32349ba1842277563b" + integrity sha512-yENoDEoWlEFI7l5z7UYyJb/y5Q8RqbPd4neAVhKr6l+vVaQOPKf8V/IseSMJI9+urDUIxgssA7RGNyCRhGjZvw== + dependencies: + "@jest/console" "^27.2.2" + "@jest/types" "^27.1.1" + "@types/istanbul-lib-coverage" "^2.0.0" + collect-v8-coverage "^1.0.0" + +"@jest/test-result@^27.2.2", "@jest/test-result@^27.3.1": + version "27.3.1" + resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-27.3.1.tgz#89adee8b771877c69b3b8d59f52f29dccc300194" + integrity sha512-mLn6Thm+w2yl0opM8J/QnPTqrfS4FoXsXF2WIWJb2O/GBSyResL71BRuMYbYRsGt7ELwS5JGcEcGb52BNrumgg== dependencies: - "@jest/console" "^26.6.2" - "@jest/types" "^26.6.2" + "@jest/console" "^27.3.1" + "@jest/types" "^27.2.5" "@types/istanbul-lib-coverage" "^2.0.0" collect-v8-coverage "^1.0.0" -"@jest/test-sequencer@^26.6.3": - version "26.6.3" - resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-26.6.3.tgz#98e8a45100863886d074205e8ffdc5a7eb582b17" - integrity sha512-YHlVIjP5nfEyjlrSr8t/YdNfU/1XEt7c5b4OxcXCjyRhjzLYu/rO69/WHPuYcbCWkz8kAeZVZp2N2+IOLLEPGw== +"@jest/test-sequencer@^27.2.2", "@jest/test-sequencer@^27.3.1": + version "27.3.1" + resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-27.3.1.tgz#4b3bde2dbb05ee74afdae608cf0768e3354683b1" + integrity sha512-siySLo07IMEdSjA4fqEnxfIX8lB/lWYsBPwNFtkOvsFQvmBrL3yj3k3uFNZv/JDyApTakRpxbKLJ3CT8UGVCrA== dependencies: - "@jest/test-result" "^26.6.2" + "@jest/test-result" "^27.3.1" graceful-fs "^4.2.4" - jest-haste-map "^26.6.2" - jest-runner "^26.6.3" - jest-runtime "^26.6.3" + jest-haste-map "^27.3.1" + jest-runtime "^27.3.1" -"@jest/transform@^26.6.2": - version "26.6.2" - resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-26.6.2.tgz#5ac57c5fa1ad17b2aae83e73e45813894dcf2e4b" - integrity sha512-E9JjhUgNzvuQ+vVAL21vlyfy12gP0GhazGgJC4h6qUt1jSdUXGWJ1wfu/X7Sd8etSgxV4ovT1pb9v5D6QW4XgA== +"@jest/transform@^27.2.2", "@jest/transform@^27.3.1": + version "27.3.1" + resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-27.3.1.tgz#ff80eafbeabe811e9025e4b6f452126718455220" + integrity sha512-3fSvQ02kuvjOI1C1ssqMVBKJpZf6nwoCiSu00zAKh5nrp3SptNtZy/8s5deayHnqxhjD9CWDJ+yqQwuQ0ZafXQ== dependencies: "@babel/core" "^7.1.0" - "@jest/types" "^26.6.2" + "@jest/types" "^27.2.5" babel-plugin-istanbul "^6.0.0" chalk "^4.0.0" convert-source-map "^1.4.0" fast-json-stable-stringify "^2.0.0" graceful-fs "^4.2.4" - jest-haste-map "^26.6.2" - jest-regex-util "^26.0.0" - jest-util "^26.6.2" - micromatch "^4.0.2" + jest-haste-map "^27.3.1" + jest-regex-util "^27.0.6" + jest-util "^27.3.1" + micromatch "^4.0.4" pirates "^4.0.1" slash "^3.0.0" source-map "^0.6.1" write-file-atomic "^3.0.0" -"@jest/types@^26.6.2": - version "26.6.2" - resolved "https://registry.yarnpkg.com/@jest/types/-/types-26.6.2.tgz#bef5a532030e1d88a2f5a6d933f84e97226ed48e" - integrity sha512-fC6QCp7Sc5sX6g8Tvbmj4XUTbyrik0akgRy03yjXbQaBWWNWGE7SGtJk98m0N8nzegD/7SggrUlivxo5ax4KWQ== +"@jest/types@^27.1.1", "@jest/types@^27.2.5": + version "27.2.5" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-27.2.5.tgz#420765c052605e75686982d24b061b4cbba22132" + integrity sha512-nmuM4VuDtCZcY+eTpw+0nvstwReMsjPoj7ZR80/BbixulhLaiX+fbv8oeLW8WZlJMcsGQsTmMKT/iTZu1Uy/lQ== dependencies: "@types/istanbul-lib-coverage" "^2.0.0" "@types/istanbul-reports" "^3.0.0" "@types/node" "*" - "@types/yargs" "^15.0.0" + "@types/yargs" "^16.0.0" chalk "^4.0.0" "@lerna/add@3.21.0": @@ -1629,6 +1746,48 @@ npmlog "^4.1.2" write-file-atomic "^2.3.0" +"@microsoft/api-extractor-model@7.13.13": + version "7.13.13" + resolved "https://registry.yarnpkg.com/@microsoft/api-extractor-model/-/api-extractor-model-7.13.13.tgz#5c1ac0fff0410b8f23478b15560b24096b8869c6" + integrity sha512-4Hz2TOL4TljsAfMQe7a8tm+Am8+AkrcgkbnH62S9YuaIC3Cw6jE4H2qP8WC2JJInWJP4pg/ZrUlHrtmtgrqn9Q== + dependencies: + "@microsoft/tsdoc" "0.13.2" + "@microsoft/tsdoc-config" "~0.15.2" + "@rushstack/node-core-library" "3.42.3" + +"@microsoft/api-extractor@^7.18.16": + version "7.18.16" + resolved "https://registry.yarnpkg.com/@microsoft/api-extractor/-/api-extractor-7.18.16.tgz#c5e077e417938da7e7026124c51d34a90868e7bd" + integrity sha512-f0EcjGgS8IToUHxfQIr4vxGpBhUdaDOhGyddZpZ5K9e/GcGkImfkGeHpYbK043f2bZV3aagTx6NcIawwE72BKA== + dependencies: + "@microsoft/api-extractor-model" "7.13.13" + "@microsoft/tsdoc" "0.13.2" + "@microsoft/tsdoc-config" "~0.15.2" + "@rushstack/node-core-library" "3.42.3" + "@rushstack/rig-package" "0.3.3" + "@rushstack/ts-command-line" "4.10.2" + colors "~1.2.1" + lodash "~4.17.15" + resolve "~1.17.0" + semver "~7.3.0" + source-map "~0.6.1" + typescript "~4.4.2" + +"@microsoft/tsdoc-config@~0.15.2": + version "0.15.2" + resolved "https://registry.yarnpkg.com/@microsoft/tsdoc-config/-/tsdoc-config-0.15.2.tgz#eb353c93f3b62ab74bdc9ab6f4a82bcf80140f14" + integrity sha512-mK19b2wJHSdNf8znXSMYVShAHktVr/ib0Ck2FA3lsVBSEhSI/TfXT7DJQkAYgcztTuwazGcg58ZjYdk0hTCVrA== + dependencies: + "@microsoft/tsdoc" "0.13.2" + ajv "~6.12.6" + jju "~1.4.0" + resolve "~1.19.0" + +"@microsoft/tsdoc@0.13.2": + version "0.13.2" + resolved "https://registry.yarnpkg.com/@microsoft/tsdoc/-/tsdoc-0.13.2.tgz#3b0efb6d3903bd49edb073696f60e90df08efb26" + integrity sha512-WrHvO8PDL8wd8T2+zBGKrMwVL5IyzR3ryWUsl0PXgEV0QHup4mTLi0QcATefGI6Gx9Anu7vthPyyyLpY0EpiQg== + "@mrmlnc/readdir-enhanced@^2.2.1": version "2.2.1" resolved "https://registry.yarnpkg.com/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz#524af240d1a360527b730475ecfa1344aa540dde" @@ -1637,18 +1796,18 @@ call-me-maybe "^1.0.1" glob-to-regexp "^0.3.0" -"@nodelib/fs.scandir@2.1.3": - version "2.1.3" - resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.3.tgz#3a582bdb53804c6ba6d146579c46e52130cf4a3b" - integrity sha512-eGmwYQn3gxo4r7jdQnkrrN6bY478C3P+a/y72IJukF8LjB6ZHeB3c+Ehacj3sYeSmUXGlnA67/PmbM9CVwL7Dw== +"@nodelib/fs.scandir@2.1.5": + version "2.1.5" + resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" + integrity sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g== dependencies: - "@nodelib/fs.stat" "2.0.3" + "@nodelib/fs.stat" "2.0.5" run-parallel "^1.1.9" -"@nodelib/fs.stat@2.0.3", "@nodelib/fs.stat@^2.0.2": - version "2.0.3" - resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.3.tgz#34dc5f4cabbc720f4e60f75a747e7ecd6c175bd3" - integrity sha512-bQBFruR2TAwoevBEd/NWMoAAtNGzTRgdrqnYCc7dhzfoNvqPzLyqlEQnzZ3kVnNrSp25iyxE00/3h2fqGAGArA== +"@nodelib/fs.stat@2.0.5", "@nodelib/fs.stat@^2.0.2": + version "2.0.5" + resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz#5bd262af94e9d25bd1e71b05deed44876a222e8b" + integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A== "@nodelib/fs.stat@^1.1.2": version "1.1.3" @@ -1656,29 +1815,147 @@ integrity sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw== "@nodelib/fs.walk@^1.2.3": - version "1.2.4" - resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.4.tgz#011b9202a70a6366e436ca5c065844528ab04976" - integrity sha512-1V9XOY4rDW0rehzbrcqAmHnz8e7SKvX27gh8Gt2WgB0+pdzdiLV83p72kZPU+jvMbS1qU5mauP2iOvO8rhmurQ== + version "1.2.8" + resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz#e95737e8bb6746ddedf69c556953494f196fe69a" + integrity sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg== dependencies: - "@nodelib/fs.scandir" "2.1.3" + "@nodelib/fs.scandir" "2.1.5" fastq "^1.6.0" +"@nrwl/cli@*", "@nrwl/cli@13.0.2": + version "13.0.2" + resolved "https://registry.yarnpkg.com/@nrwl/cli/-/cli-13.0.2.tgz#4306ebe09214f9337d05ff8bf87c38d606cb5e46" + integrity sha512-VUbkMxYDdMNZe3CP2AtQbSKyP1kwaebdJyCyQ4l7tsqcFyDAc+zDXbvM1MPYSsFi4DI5Sf11BEFMLfYxRLi6FA== + dependencies: + "@nrwl/tao" "13.0.2" + chalk "4.1.0" + enquirer "~2.3.6" + v8-compile-cache "2.3.0" + yargs "15.4.1" + yargs-parser "20.0.0" + +"@nrwl/devkit@13.0.2": + version "13.0.2" + resolved "https://registry.yarnpkg.com/@nrwl/devkit/-/devkit-13.0.2.tgz#7a22bb777894c8688545a36a113fa50e185fc80d" + integrity sha512-DLcdxcINC+efSxcMaIqKHo1wp1Fp6tb5QrFJ2bs8jihFazRU+r8N8kgthgp11pCnXXZdXsHOvpfdADM1OQMhlQ== + dependencies: + "@nrwl/tao" "13.0.2" + ejs "^3.1.5" + ignore "^5.0.4" + rxjs "^6.5.4" + semver "7.3.4" + tslib "^2.0.0" + +"@nrwl/jest@13.0.2": + version "13.0.2" + resolved "https://registry.yarnpkg.com/@nrwl/jest/-/jest-13.0.2.tgz#07219a35f2ec2fb91dcb2fb80bddab00d4b6fd8d" + integrity sha512-JOU2Nku3IT+phBM2U2Vp8WmJAJdKHe4Dw73Eex20fR/tGK8SO8zVm4T1PAaXrqSslW/ET6CXMWghaMT1ZhKcRA== + dependencies: + "@jest/reporters" "27.2.2" + "@jest/test-result" "27.2.2" + "@nrwl/devkit" "13.0.2" + chalk "4.1.0" + identity-obj-proxy "3.0.0" + jest-config "27.2.2" + jest-resolve "27.2.2" + jest-util "27.2.0" + rxjs "^6.5.4" + tslib "^2.0.0" + +"@nrwl/linter@13.0.2": + version "13.0.2" + resolved "https://registry.yarnpkg.com/@nrwl/linter/-/linter-13.0.2.tgz#99d1793f8f6e853f4ed440593ef4c27bb76f1373" + integrity sha512-M9UXbIe+Gdi7p5zPd+l35IvIhE6C0LE8dMw6wQpcF0XD6f3bA02ut7c6nKaYverV2j+JxViZ6YuwqCQS3JXwKA== + dependencies: + "@nrwl/devkit" "13.0.2" + "@nrwl/jest" "13.0.2" + eslint "7.32.0" + glob "7.1.4" + minimatch "3.0.4" + tmp "~0.2.1" + tslib "^2.0.0" + +"@nrwl/nx-cloud@12.5.1": + version "12.5.1" + resolved "https://registry.yarnpkg.com/@nrwl/nx-cloud/-/nx-cloud-12.5.1.tgz#3a73cc5f29eea83ad4d1c01df63e9cf3c742adc1" + integrity sha512-014+QYtQmNuKVB06Rrs7fpxob4sOi+3mKdyksNT6r7MY6mEiWETAIL4wursfpg9fUpD0yG6af/I/CxiCP3fsTQ== + dependencies: + axios "^0.21.1" + chalk "4.1.0" + node-machine-id "^1.1.12" + rxjs "6.5.5" + strip-json-comments "^3.1.1" + tar "6.1.11" + +"@nrwl/tao@13.0.2": + version "13.0.2" + resolved "https://registry.yarnpkg.com/@nrwl/tao/-/tao-13.0.2.tgz#43c428ae1e0938ccb73ed46aaa1b9f6fd8f98b96" + integrity sha512-OgcpJHYqqLzmTNxbhxzW3TCwG8EVaB1wiWZiXx+VZK7C6p/nPaJfyodxOiOQu8Uhp4eGjLBvxc6jXIytKEkyqA== + dependencies: + chalk "4.1.0" + enquirer "~2.3.6" + fs-extra "^9.1.0" + jsonc-parser "3.0.0" + nx "13.0.2" + rxjs "^6.5.4" + rxjs-for-await "0.0.2" + semver "7.3.4" + tmp "~0.2.1" + tslib "^2.0.0" + yargs-parser "20.0.0" + +"@nrwl/workspace@13.0.2": + version "13.0.2" + resolved "https://registry.yarnpkg.com/@nrwl/workspace/-/workspace-13.0.2.tgz#90d970c2053ad69eca28b2664154f6fe522b8729" + integrity sha512-yleaql1MmKnahXAoCoCEJN5AEuErH0BozEcgJ+3riI0KdVZingUBDddBplzkNJw28YS1F7cjp8JTQ69dV0VH/w== + dependencies: + "@nrwl/cli" "13.0.2" + "@nrwl/devkit" "13.0.2" + "@nrwl/jest" "13.0.2" + "@nrwl/linter" "13.0.2" + "@parcel/watcher" "2.0.0-alpha.11" + chalk "4.1.0" + chokidar "^3.5.1" + cosmiconfig "^4.0.0" + dotenv "~10.0.0" + enquirer "~2.3.6" + flat "^5.0.2" + fs-extra "^9.1.0" + glob "7.1.4" + ignore "^5.0.4" + minimatch "3.0.4" + npm-run-all "^4.1.5" + npm-run-path "^4.0.1" + open "^7.4.2" + rxjs "^6.5.4" + semver "7.3.4" + strip-ansi "6.0.0" + tmp "~0.2.1" + tslib "^2.0.0" + yargs "15.4.1" + yargs-parser "20.0.0" + "@octokit/auth-token@^2.4.0": - version "2.4.2" - resolved "https://registry.yarnpkg.com/@octokit/auth-token/-/auth-token-2.4.2.tgz#10d0ae979b100fa6b72fa0e8e63e27e6d0dbff8a" - integrity sha512-jE/lE/IKIz2v1+/P0u4fJqv0kYwXOTujKemJMFr6FeopsxlIK3+wKDCJGnysg81XID5TgZQbIfuJ5J0lnTiuyQ== + 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" "^5.0.0" + "@octokit/types" "^6.0.3" "@octokit/endpoint@^6.0.1": - version "6.0.5" - resolved "https://registry.yarnpkg.com/@octokit/endpoint/-/endpoint-6.0.5.tgz#43a6adee813c5ffd2f719e20cfd14a1fee7c193a" - integrity sha512-70K5u6zd45ItOny6aHQAsea8HHQjlQq85yqOMe+Aj8dkhN2qSJ9T+Q3YjUjEYfPRBcuUWNgMn62DQnP/4LAIiQ== + 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" "^5.0.0" - is-plain-object "^4.0.0" + "@octokit/types" "^6.0.3" + is-plain-object "^5.0.0" universal-user-agent "^6.0.0" +"@octokit/openapi-types@^11.2.0": + version "11.2.0" + resolved "https://registry.yarnpkg.com/@octokit/openapi-types/-/openapi-types-11.2.0.tgz#b38d7fc3736d52a1e96b230c1ccd4a58a2f400a6" + integrity sha512-PBsVO+15KSlGmiI8QAzaqvsNlZlrDlyAJYcrXBCvVUxCp7VnXjkwPoFHgjEJXx3WF9BAwkA6nfCUA7i9sODzKA== + "@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" @@ -1692,9 +1969,9 @@ "@octokit/types" "^2.0.1" "@octokit/plugin-request-log@^1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@octokit/plugin-request-log/-/plugin-request-log-1.0.0.tgz#eef87a431300f6148c39a7f75f8cfeb218b2547e" - integrity sha512-ywoxP68aOT3zHCLgWZgwUJatiENeHE7xJzYjfz8WI0goynp96wETBF+d95b8g/uL4QmS6owPVlaxiz3wyMAzcw== + 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@2.4.0": version "2.4.0" @@ -1713,27 +1990,25 @@ deprecation "^2.0.0" once "^1.4.0" -"@octokit/request-error@^2.0.0": - version "2.0.2" - resolved "https://registry.yarnpkg.com/@octokit/request-error/-/request-error-2.0.2.tgz#0e76b83f5d8fdda1db99027ea5f617c2e6ba9ed0" - integrity sha512-2BrmnvVSV1MXQvEkrb9zwzP0wXFNbPJij922kYBTLIlIafukrGOb+ABBT2+c6wZiuyWDH1K1zmjGQ0toN/wMWw== +"@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" "^5.0.1" + "@octokit/types" "^6.0.3" deprecation "^2.0.0" once "^1.4.0" "@octokit/request@^5.2.0": - version "5.4.7" - resolved "https://registry.yarnpkg.com/@octokit/request/-/request-5.4.7.tgz#fd703ee092e0463ceba49ff7a3e61cb4cf8a0fde" - integrity sha512-FN22xUDP0i0uF38YMbOfx6TotpcENP5W8yJM1e/LieGXn6IoRxDMnBf7tx5RKSW4xuUZ/1P04NFZy5iY3Rax1A== + version "5.6.2" + resolved "https://registry.yarnpkg.com/@octokit/request/-/request-5.6.2.tgz#1aa74d5da7b9e04ac60ef232edd9a7438dcf32d8" + integrity sha512-je66CvSEVf0jCpRISxkUcCa0UkxmFs6eGDRSbfJtAVwbLH5ceqF+YEyC8lj8ystKyZTy8adWr0qmkY52EfOeLA== dependencies: "@octokit/endpoint" "^6.0.1" - "@octokit/request-error" "^2.0.0" - "@octokit/types" "^5.0.0" - deprecation "^2.0.0" - is-plain-object "^4.0.0" - node-fetch "^2.3.0" - once "^1.4.0" + "@octokit/request-error" "^2.1.0" + "@octokit/types" "^6.16.1" + is-plain-object "^5.0.0" + node-fetch "^2.6.1" universal-user-agent "^6.0.0" "@octokit/rest@^16.28.4": @@ -1765,36 +2040,107 @@ dependencies: "@types/node" ">= 8" -"@octokit/types@^5.0.0", "@octokit/types@^5.0.1": - version "5.4.1" - resolved "https://registry.yarnpkg.com/@octokit/types/-/types-5.4.1.tgz#d5d5f2b70ffc0e3f89467c3db749fa87fc3b7031" - integrity sha512-OlMlSySBJoJ6uozkr/i03nO5dlYQyE05vmQNZhAh9MyO4DPBP88QlwsDVLmVjIMFssvIZB6WO0ctIGMRG+xsJQ== - dependencies: - "@types/node" ">= 8" +"@octokit/types@^6.0.3", "@octokit/types@^6.16.1": + version "6.34.0" + resolved "https://registry.yarnpkg.com/@octokit/types/-/types-6.34.0.tgz#c6021333334d1ecfb5d370a8798162ddf1ae8218" + integrity sha512-s1zLBjWhdEI2zwaoSgyOFoKSl109CUcVBCc7biPJ3aAf6LGLU6szDvi31JPU7bxfla2lqfhjbbg/5DdFNxOwHw== + dependencies: + "@octokit/openapi-types" "^11.2.0" + +"@parcel/watcher@2.0.0-alpha.11": + version "2.0.0-alpha.11" + resolved "https://registry.yarnpkg.com/@parcel/watcher/-/watcher-2.0.0-alpha.11.tgz#8d6233d4416880810438cd2628e6a35273241ab3" + integrity sha512-zMIAsFLcnB82kkk0kSOZ/zgyihb8sty0zVrsz+3ruoYXkchymWsCDsxiX4v+X2s8Jppk3JE8vlnD4DKs3QTOEQ== + dependencies: + node-addon-api "^3.0.2" + node-gyp-build "^4.2.3" + +"@rushstack/node-core-library@3.42.3": + version "3.42.3" + resolved "https://registry.yarnpkg.com/@rushstack/node-core-library/-/node-core-library-3.42.3.tgz#e9bc8aee4ba047d1858afcb7822b5aaf973b4fd8" + integrity sha512-xtiJsHtO4Sf/hVKyf/8d58p3zQh2JAZNs1mmDNCyIlgSRYGdqUkpadvvn5mz7EwF6lwn+xTTaTV5/a32xKjbdw== + dependencies: + "@types/node" "12.20.24" + colors "~1.2.1" + fs-extra "~7.0.1" + import-lazy "~4.0.0" + jju "~1.4.0" + resolve "~1.17.0" + semver "~7.3.0" + timsort "~0.3.0" + z-schema "~3.18.3" + +"@rushstack/rig-package@0.3.3": + version "0.3.3" + resolved "https://registry.yarnpkg.com/@rushstack/rig-package/-/rig-package-0.3.3.tgz#6e291d181b2b9b114dd8e806e8389d999142d137" + integrity sha512-ElPnChxIkUzcU3ywI0Cl7E1aM+2w6vFpAwM6X+oWk7Cyjf2ofItThje9e5qUBtKqvI9sc5jVsHY1bRC8rVwOqQ== + dependencies: + resolve "~1.17.0" + strip-json-comments "~3.1.1" + +"@rushstack/ts-command-line@4.10.2": + version "4.10.2" + resolved "https://registry.yarnpkg.com/@rushstack/ts-command-line/-/ts-command-line-4.10.2.tgz#019d43d8428e243031c66aeac1f088687f6730f3" + integrity sha512-Weq8B7oJeCQ4ITsaVLhOQombipyg+idpkdkhA6UqLtKvuzq8zTtPpAfhP5ff5L+RCmo1CFCVOBE3i+MvzUR5vA== + dependencies: + "@types/argparse" "1.0.38" + argparse "~1.0.9" + colors "~1.2.1" + string-argv "~0.3.1" "@sinonjs/commons@^1.7.0": - version "1.8.2" - resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.8.2.tgz#858f5c4b48d80778fde4b9d541f27edc0d56488b" - integrity sha512-sruwd86RJHdsVf/AtBoijDmUqJp3B6hF/DGC23C+JaegnDHaZyewCjoVGTdg3J0uz3Zs7NnIT05OBOmML72lQw== + version "1.8.3" + resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.8.3.tgz#3802ddd21a50a949b6721ddd72da36e67e7f1b2d" + integrity sha512-xkNcLAn/wZaX14RPlwizcKicDk9G3F8m2nU3L7Ukm5zBgTwiT0wsoFAHx9Jq56fJA1z/7uKGtCRu16sOUCLIHQ== dependencies: type-detect "4.0.8" -"@sinonjs/fake-timers@^6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@sinonjs/fake-timers/-/fake-timers-6.0.1.tgz#293674fccb3262ac782c7aadfdeca86b10c75c40" - integrity sha512-MZPUxrmFubI36XS1DI3qmI0YdN1gks62JtFZvxR67ljjSNCeK6U08Zx4msEWOXuofgqUt6zPHSi1H9fbjR/NRA== +"@sinonjs/fake-timers@^8.0.1": + version "8.0.1" + resolved "https://registry.yarnpkg.com/@sinonjs/fake-timers/-/fake-timers-8.0.1.tgz#1c1c9a91419f804e59ae8df316a07dd1c3a76b94" + integrity sha512-AU7kwFxreVd6OAXcAFlKSmZquiRUU0FvYm44k1Y1QbK7Co4m0aqfGMhjykIeQp/H6rcl+nFmj0zfdUcGVs9Dew== dependencies: "@sinonjs/commons" "^1.7.0" -"@types/babel__code-frame@*", "@types/babel__code-frame@^7.0.2": - version "7.0.2" - resolved "https://registry.yarnpkg.com/@types/babel__code-frame/-/babel__code-frame-7.0.2.tgz#e0c0f1648cbc09a9d4e5b4ed2ae9a6f7c8f5aeb0" - integrity sha512-imO+jT/yjOKOAS5GQZ8SDtwiIloAGGr6OaZDKB0V5JVaSfGZLat5K5/ZRtyKW6R60XHV3RHYPTFfhYb+wDKyKg== +"@tootallnate/once@1": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-1.1.2.tgz#ccb91445360179a04e7fe6aff78c00ffc1eeaf82" + integrity sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw== -"@types/babel__core@^7.0.0", "@types/babel__core@^7.1.7": - version "7.1.12" - resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.12.tgz#4d8e9e51eb265552a7e4f1ff2219ab6133bdfb2d" - integrity sha512-wMTHiiTiBAAPebqaPiPDLFA4LYPKr6Ph0Xq/6rq1Ur3v66HXyG+clfR9CNETkD7MQS8ZHvpQOtA53DLws5WAEQ== +"@tsconfig/node10@^1.0.7": + version "1.0.8" + resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.8.tgz#c1e4e80d6f964fbecb3359c43bd48b40f7cadad9" + integrity sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg== + +"@tsconfig/node12@^1.0.7": + version "1.0.9" + resolved "https://registry.yarnpkg.com/@tsconfig/node12/-/node12-1.0.9.tgz#62c1f6dee2ebd9aead80dc3afa56810e58e1a04c" + integrity sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw== + +"@tsconfig/node14@^1.0.0": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@tsconfig/node14/-/node14-1.0.1.tgz#95f2d167ffb9b8d2068b0b235302fafd4df711f2" + integrity sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg== + +"@tsconfig/node16@^1.0.2": + version "1.0.2" + resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.2.tgz#423c77877d0569db20e1fc80885ac4118314010e" + integrity sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA== + +"@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": + 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@^7.0.0", "@types/babel__core@^7.1.14": + version "7.1.16" + resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.16.tgz#bc12c74b7d65e82d29876b5d0baf5c625ac58702" + integrity sha512-EAEHtisTMM+KaKwfWdC3oyllIqswlznXCIVCt7/oRNrh+DhgT4UEBNC/jlADNjvw7UnfbcdkGQcPVZ1xYiLcrQ== dependencies: "@babel/parser" "^7.1.0" "@babel/types" "^7.0.0" @@ -1803,61 +2149,58 @@ "@types/babel__traverse" "*" "@types/babel__generator@*": - version "7.6.2" - resolved "https://registry.yarnpkg.com/@types/babel__generator/-/babel__generator-7.6.2.tgz#f3d71178e187858f7c45e30380f8f1b7415a12d8" - integrity sha512-MdSJnBjl+bdwkLskZ3NGFp9YcXGx5ggLpQQPqtgakVhsWK0hTtNYhjpZLlWQTviGTvF8at+Bvli3jV7faPdgeQ== + version "7.6.3" + resolved "https://registry.yarnpkg.com/@types/babel__generator/-/babel__generator-7.6.3.tgz#f456b4b2ce79137f768aa130d2423d2f0ccfaba5" + integrity sha512-/GWCmzJWqV7diQW54smJZzWbSFf4QYtF71WCKhcx6Ru/tFyQIY2eiiITcCAeuPbNSvT9YCGkVMqqvSk2Z0mXiA== dependencies: "@babel/types" "^7.0.0" "@types/babel__template@*": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@types/babel__template/-/babel__template-7.4.0.tgz#0c888dd70b3ee9eebb6e4f200e809da0076262be" - integrity sha512-NTPErx4/FiPCGScH7foPyr+/1Dkzkni+rHiYHHoTjvwou7AQzJkNeD60A9CXRy+ZEN2B1bggmkTMCDb+Mv5k+A== + version "7.4.1" + resolved "https://registry.yarnpkg.com/@types/babel__template/-/babel__template-7.4.1.tgz#3d1a48fd9d6c0edfd56f2ff578daed48f36c8969" + integrity sha512-azBFKemX6kMg5Io+/rdGT0dkGreboUVR0Cdm3fz9QJWpaQGJRQXl7C+6hOTCZcMll7KFyEQpgbYI2lHdsS4U7g== dependencies: "@babel/parser" "^7.1.0" "@babel/types" "^7.0.0" "@types/babel__traverse@*", "@types/babel__traverse@^7.0.4", "@types/babel__traverse@^7.0.6": - version "7.11.0" - resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.11.0.tgz#b9a1efa635201ba9bc850323a8793ee2d36c04a0" - integrity sha512-kSjgDMZONiIfSH1Nxcr5JIRMwUetDki63FSQfpTCz8ogF3Ulqm8+mr5f78dUYs6vMiB6gBusQqfQmBvHZj/lwg== + version "7.14.2" + resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.14.2.tgz#ffcd470bbb3f8bf30481678fb5502278ca833a43" + integrity sha512-K2waXdXBi2302XUdcHcR1jCeU0LL4TD9HRs/gk0N2Xvrht+G/BfJa4QObBQZfhMdxiCpV3COl5Nfq4uKTeTnJA== dependencies: "@babel/types" "^7.3.0" -"@types/color-name@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@types/color-name/-/color-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0" - integrity sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ== - -"@types/debug@*", "@types/debug@^4.1.5": - version "4.1.5" - resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.5.tgz#b14efa8852b7768d898906613c23f688713e02cd" - integrity sha512-Q1y515GcOdTHgagaVFhHnIFQ38ygs/kmxdNpvpou+raI9UO3YZcHDngBSYKQklcKlvA7iuQlmIKbzvmxcOE9CQ== +"@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== + dependencies: + "@types/ms" "*" "@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/glob@*", "@types/glob@^7.1.1", "@types/glob@^7.1.3": - version "7.1.3" - resolved "https://registry.yarnpkg.com/@types/glob/-/glob-7.1.3.tgz#e6ba80f36b7daad2c685acd9266382e68985c183" - integrity sha512-SEYeGAIQIQX8NN6LDKprLjbrd5dARM5EXsd8GI/A5l0apYI1fGMWgPHSe4ZKL4eozlAyI+doUE9XbYS4xCkQ1w== +"@types/glob@*", "@types/glob@^7.1.1", "@types/glob@^7.2.0": + 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.2": - version "4.1.3" - resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.3.tgz#039af35fe26bec35003e8d86d2ee9c586354348f" - integrity sha512-AiHRaEB50LQg0pZmm659vNBb9f4SJ0qrAnteuzhSeAUcJKxoYgEnprg/83kppCnc2zvtCKbdZry1a5pVY3lOTQ== + version "4.1.5" + resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.5.tgz#21ffba0d98da4350db64891f92a9e5db3cdb4e15" + integrity sha512-anKkLmZZ+xm4p8JWBf4hElkM4XR+EZeA2M9BAkkTldmcyDY4mbdIJnRghDJH3Ov5ooY7/UAoENtmdMSkaAd7Cw== dependencies: "@types/node" "*" -"@types/is-glob@*", "@types/is-glob@^4.0.1": - version "4.0.1" - resolved "https://registry.yarnpkg.com/@types/is-glob/-/is-glob-4.0.1.tgz#a93eec1714172c8eb3225a1cc5eb88c2477b7d00" - integrity sha512-k3RS5HyBPu4h+5hTmIEfPB2rl5P3LnGdQEZrV2b9OWTJVtsUQ2VBcedqYKGqxvZqle5UALUXdSfVA8nf3HfyWQ== +"@types/is-glob@*", "@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== "@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1": version "2.0.3" @@ -1872,9 +2215,9 @@ "@types/istanbul-lib-coverage" "*" "@types/istanbul-reports@^3.0.0": - version "3.0.0" - resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-3.0.0.tgz#508b13aa344fa4976234e75dddcc34925737d821" - integrity sha512-nwKNbvnwJ2/mndE9ItP/zc2TCzw6uuodnF4EHYWD+gCQDVBuRQL5UzbZD0/ezy1iKsFU2ZQiDqg4M9dN4+wZgA== + version "3.0.1" + resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz#9153fe98bba2bd565a63add9436d6f0d7f8468ff" + integrity sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw== dependencies: "@types/istanbul-lib-report" "*" @@ -1885,96 +2228,108 @@ dependencies: "@types/jest" "*" -"@types/jest@*", "@types/jest@26.x", "@types/jest@^26.0.20": - version "26.0.20" - resolved "https://registry.yarnpkg.com/@types/jest/-/jest-26.0.20.tgz#cd2f2702ecf69e86b586e1f5223a60e454056307" - integrity sha512-9zi2Y+5USJRxd0FsahERhBwlcvFh6D2GLQnY2FH2BzK8J9s9omvNHIbvABwIluXa0fD8XVKMLTO0aOEuUfACAA== +"@types/jest@*", "@types/jest@^27.0.2": + version "27.0.2" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-27.0.2.tgz#ac383c4d4aaddd29bbf2b916d8d105c304a5fcd7" + integrity sha512-4dRxkS/AFX0c5XW6IPMNOydLn2tEhNhJV7DnYK+0bjoJZ+QTmfucBlihX7aoEsh/ocYtkLC73UbnBXBXIxsULA== dependencies: - jest-diff "^26.0.0" - pretty-format "^26.0.0" + jest-diff "^27.0.0" + pretty-format "^27.0.0" -"@types/json-schema@^7.0.3": - version "7.0.7" - resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.7.tgz#98a993516c859eb0d5c4c8f098317a9ea68db9ad" - integrity sha512-cxWFQVseBm6O9Gbw1IWb8r6OS4OhSt3hPZLkFApLjM8TEXROBuQGLAH2i2gZpcXdLBIrpXuTDhH7Vbm1iXmNGA== +"@types/json-schema@^7.0.9": + version "7.0.9" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.9.tgz#97edc9037ea0c38585320b28964dde3b39e4660d" + integrity sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ== "@types/json5@^0.0.29": version "0.0.29" resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" integrity sha1-7ihweulOEdK4J7y+UnC86n8+ce4= -"@types/lodash@*", "@types/lodash@^4.14.149": - version "4.14.168" - resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.168.tgz#fe24632e79b7ade3f132891afff86caa5e5ce008" - integrity sha512-oVfRvqHV/V6D1yifJbVRU3TMp8OT6o6BG+U9MkwuJ3U8/CsDHvalRpsxBqivn71ztOFZBTfJMvETbqHiaNSj7Q== +"@types/lodash@*", "@types/lodash@^4.14.176": + version "4.14.176" + resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.176.tgz#641150fc1cda36fbfa329de603bbb175d7ee20c0" + integrity sha512-xZmuPTa3rlZoIbtDUyJKZQimJV3bxCmzMIO2c9Pz9afyDro6kr7R79GwcB6mRhuoPmV2p1Vb66WOJH7F886WKQ== -"@types/marked@*", "@types/marked@^1.1.0": - version "1.2.2" - resolved "https://registry.yarnpkg.com/@types/marked/-/marked-1.2.2.tgz#1f858a0e690247ecf3b2eef576f98f86e8d960d4" - integrity sha512-wLfw1hnuuDYrFz97IzJja0pdVsC0oedtS4QsKH1/inyW9qkLQbXgMUqEQT0MVtUBx3twjWeInUfjQbhBVLECXw== +"@types/marked@*", "@types/marked@^3.0.2": + version "3.0.2" + resolved "https://registry.yarnpkg.com/@types/marked/-/marked-3.0.2.tgz#4a639575542ae7715fabbe450b08118e9093eb35" + integrity sha512-mGYI9qFs+i5eYaytWKBbtEMbIkrXGKuhsDpDcj70ogKS2gk1NmgEy9Z3VEKz922Lfms6eITXXqv5idlX7C/irw== "@types/minimatch@*": - version "3.0.3" - resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d" - integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA== + 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": - version "1.2.0" - resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.0.tgz#69a23a3ad29caf0097f06eda59b361ee2f0639f6" - integrity sha1-aaI6OtKcrwCX8G7aWbNh7i8GOfY= + version "1.2.2" + resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.2.tgz#ee771e2ba4b3dc5b372935d549fd9617bf345b8c" + integrity sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ== + +"@types/ms@*": + version "0.7.31" + resolved "https://registry.yarnpkg.com/@types/ms/-/ms-0.7.31.tgz#31b7ca6407128a3d2bbc27fe2d21b345397f6197" + integrity sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA== + +"@types/ncp@^2.0.5": + version "2.0.5" + resolved "https://registry.yarnpkg.com/@types/ncp/-/ncp-2.0.5.tgz#5c53b229a321946102a188b603306162137f4fb9" + integrity sha512-ocK0p8JuFmX7UkMabFPjY0F7apPvQyLWt5qtdvuvQEBz9i4m2dbzV+6L1zNaUp042RfnL6pHnxDE53OH6XQ9VQ== + dependencies: + "@types/node" "*" -"@types/node@*", "@types/node@>= 8", "@types/node@^14.14.27": - version "14.14.31" - resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.31.tgz#72286bd33d137aa0d152d47ec7c1762563d34055" - integrity sha512-vFHy/ezP5qI0rFgJ7aQnjDXwAMrG0KqqIH7tQG5PPv3BWBayOPIQNBjVc/P6hhdZfMx51REc6tfDNXHUio893g== +"@types/node@*", "@types/node@12.20.24", "@types/node@>= 8", "@types/node@^16.11.4": + version "16.11.4" + resolved "https://registry.yarnpkg.com/@types/node/-/node-16.11.4.tgz#90771124822d6663814f7c1c9b45a6654d8fd964" + integrity sha512-TMgXmy0v2xWyuCSCJM6NCna2snndD8yvQF67J29ipdzMcsPa9u+o0tjF5+EQNdhcuZplYuouYqpc4zcd5I6amQ== "@types/normalize-package-data@^2.4.0": - version "2.4.0" - resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz#e486d0d97396d79beedd0a6e33f4534ff6b4973e" - integrity sha512-f5j5b/Gf71L+dbqxIpQ4Z2WlmI/mPJ0fOkGGmFgtb6sAu97EPczzbS3/tJKxmcYDj55OX6ssqwDAWOHIYDRDGA== + version "2.4.1" + resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.1.tgz#d3357479a0fdfdd5907fe67e17e0a85c906e1301" + integrity sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw== "@types/parse-json@^4.0.0": version "4.0.0" resolved "https://registry.yarnpkg.com/@types/parse-json/-/parse-json-4.0.0.tgz#2f8bb441434d163b35fb8ffdccd7138927ffb8c0" integrity sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA== -"@types/prettier@*", "@types/prettier@^2.0.0", "@types/prettier@^2.2.1": - version "2.2.1" - resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.2.1.tgz#374e31645d58cb18a07b3ecd8e9dede4deb2cccd" - integrity sha512-DxZZbyMAM9GWEzXL+BMZROWz9oo6A9EilwwOMET2UVu2uZTqMWS5S69KVtuVKaRjCUpcrOXRalet86/OpG4kqw== +"@types/prettier@*", "@types/prettier@^2.1.5", "@types/prettier@^2.3.2": + version "2.4.1" + resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.4.1.tgz#e1303048d5389563e130f5bdd89d37a99acb75eb" + integrity sha512-Fo79ojj3vdEZOHg3wR9ksAMRz4P3S5fDB5e/YWZiFnyFQI1WY2Vftu9XoXVVtJfxB7Bpce/QTqWSSntkz2Znrw== -"@types/rimraf@^3.0.0": - version "3.0.0" - resolved "https://registry.yarnpkg.com/@types/rimraf/-/rimraf-3.0.0.tgz#b9d03f090ece263671898d57bb7bb007023ac19f" - integrity sha512-7WhJ0MdpFgYQPXlF4Dx+DhgvlPCfz/x5mHaeDQAKhcenvQP1KCpLQ18JklAqeGMYSAT2PxLpzd0g2/HE7fj7hQ== +"@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/semver@*", "@types/semver@^7.3.4": - version "7.3.4" - resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.3.4.tgz#43d7168fec6fa0988bb1a513a697b29296721afb" - integrity sha512-+nVsLKlcUCeMzD2ufHEYuJ9a2ovstb6Dp52A5VsoKxDXgvE051XgHI/33I1EymwkRGQkwnA0LkhnUzituGs4EQ== +"@types/semver@*", "@types/semver@^7.3.9": + version "7.3.9" + resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.3.9.tgz#152c6c20a7688c30b967ec1841d31ace569863fc" + integrity sha512-L/TMpyURfBkf+o/526Zb6kd/tchUP3iBDEPjqjb+U2MAJhVRxxrmr2fwpe08E7QsV7YLcpq0tUaQ9O9x97ZIxQ== "@types/stack-utils@^2.0.0": - version "2.0.0" - resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.0.tgz#7036640b4e21cc2f259ae826ce843d277dad8cff" - integrity sha512-RJJrrySY7A8havqpGObOB4W92QXKJo63/jFLLgpvOtsGUqbQZ9Sbgl35KMm1DjC6j7AvmmU2bIno+3IyEaemaw== + version "2.0.1" + 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.0": - version "0.2.0" - resolved "https://registry.yarnpkg.com/@types/tmp/-/tmp-0.2.0.tgz#e3f52b4d7397eaa9193592ef3fdd44dc0af4298c" - integrity sha512-flgpHJjntpBAdJD43ShRosQvNC0ME97DCfGvZEDlAThQmnerRXrLbX6YgzRBQCZTthET9eAWFAMaYP0m0Y4HzQ== +"@types/tmp@*", "@types/tmp@^0.2.2": + version "0.2.2" + resolved "https://registry.yarnpkg.com/@types/tmp/-/tmp-0.2.2.tgz#424537a3b91828cb26aaf697f21ae3cd1b69f7e7" + integrity sha512-MhSa0yylXtVMsyT8qFpHA1DLHj4DvQGH5ntxrhHSh8PxUVNi35Wk+P5hVgqbO2qZqOotqr9jaoPRL+iRjWYm/A== "@types/yargs-parser@*": - version "15.0.0" - resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-15.0.0.tgz#cb3f9f741869e20cce330ffbeb9271590483882d" - integrity sha512-FA/BWv8t8ZWJ+gEOnLLd8ygxH/2UFbAvgEonyfN6yWGLKc7zVjbpl2Y4CTjid9h2RfgPP6SEt6uHwEOply00yw== + version "20.2.1" + resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-20.2.1.tgz#3b9ce2489919d9e4fea439b76916abc34b2df129" + integrity sha512-7tFImggNeNBVMsn0vLrpn1H1uPrUBdnARPTpZoitY37ZrdJREzf7I16tMrlK3hen349gr1NYh8CmZQa7CTG6Aw== -"@types/yargs@^15.0.0": - version "15.0.5" - resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-15.0.5.tgz#947e9a6561483bdee9adffc983e91a6902af8b79" - integrity sha512-Dk/IDOPtOgubt/IaevIUbTgV7doaKkoorvOyYM2CMwuDyP89bekI7H4xLIwunNYiK9jhCkmc6pUrJk3cj2AB9w== +"@types/yargs@^16.0.0": + version "16.0.4" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-16.0.4.tgz#26aad98dd2c2a38e421086ea9ad42b9e51642977" + integrity sha512-T8Yc9wt/5LbJyCaLiHPReJa0kApcIgJ7Bn735GjItUfh08Z1pJvu8QZqb9s+mMvKV6WUQRV7K2R46YbjMXTTJw== dependencies: "@types/yargs-parser" "*" @@ -1995,7 +2350,7 @@ JSONStream@^1.0.4, JSONStream@^1.3.4: jsonparse "^1.2.0" through ">=2.2.7 <3" -abab@^2.0.3: +abab@^2.0.3, abab@^2.0.5: version "2.0.5" resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.5.tgz#c0b678fb32d60fc1219c784d6a826fe385aeb79a" integrity sha512-9IK9EadsbHo6jLWIpxpR6pL0sazTXV6+SQv25ZB+F7Bj9mJNaOc4nCRabwd5M/JwmUa8idz6Eci6eKfJryPs6Q== @@ -2014,20 +2369,30 @@ acorn-globals@^6.0.0: acorn-walk "^7.1.1" acorn-jsx@^5.3.1: - version "5.3.1" - resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.1.tgz#fc8661e11b7ac1539c47dbfea2e72b3af34d267b" - integrity sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng== + version "5.3.2" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" + integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== acorn-walk@^7.1.1: version "7.2.0" resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-7.2.0.tgz#0de889a601203909b0fbe07b8938dc21d2e967bc" integrity sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA== +acorn-walk@^8.1.1: + version "8.2.0" + resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.2.0.tgz#741210f2e2426454508853a2f44d0ab83b7f69c1" + integrity sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA== + acorn@^7.1.1, acorn@^7.4.0: version "7.4.1" resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa" integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== +acorn@^8.2.4, acorn@^8.4.1, acorn@^8.5.0: + version "8.5.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.5.0.tgz#4512ccb99b3698c752591e9bb4472e38ad43cee2" + integrity sha512-yXbYeFy+jUuYd3/CDcg2NkIYE991XYX/bje7LmjJigUciaeO1JR4XxXgCIV1/Zc/dRuFEyw1L0pbA+qynJkW5Q== + agent-base@4, agent-base@^4.3.0: version "4.3.0" resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.3.0.tgz#8165f01c436009bccad0b1d122f05ed770efc6ee" @@ -2035,6 +2400,13 @@ agent-base@4, agent-base@^4.3.0: dependencies: es6-promisify "^5.0.0" +agent-base@6: + version "6.0.2" + resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.2.tgz#49fff58577cfee3f37176feab4c22e00f86d7f77" + integrity sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ== + dependencies: + debug "4" + agent-base@~4.2.1: version "4.2.1" resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.2.1.tgz#d89e5999f797875674c07d87f260fc41e83e8ca9" @@ -2057,17 +2429,7 @@ aggregate-error@^3.0.0: clean-stack "^2.0.0" indent-string "^4.0.0" -ajv@^6.10.0, ajv@^6.12.3: - version "6.12.4" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.4.tgz#0614facc4522127fa713445c6bfd3ebd376e2234" - integrity sha512-eienB2c9qVQs2KWexhkrdMLVDoIQCz5KSeLxwg9Lzk4DOfBtIK9PQwwufcsn1jjGuf9WZmqPMbGxOzfcuphJCQ== - dependencies: - fast-deep-equal "^3.1.1" - fast-json-stable-stringify "^2.0.0" - json-schema-traverse "^0.4.1" - uri-js "^4.2.2" - -ajv@^6.12.4: +ajv@^6.10.0, ajv@^6.12.3, ajv@^6.12.4, 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== @@ -2077,10 +2439,10 @@ ajv@^6.12.4: json-schema-traverse "^0.4.1" uri-js "^4.2.2" -ajv@^7.0.2: - version "7.1.0" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-7.1.0.tgz#f982ea7933dc7f1012eae9eec5a86687d805421b" - integrity sha512-svS9uILze/cXbH0z2myCK2Brqprx/+JJYK5pHicT/GQiBfzzhUVAIT6MwqJg8y4xV/zoGsUeuPuwtoiKSGE15g== +ajv@^8.0.1: + version "8.6.3" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.6.3.tgz#11a66527761dc3e9a3845ea775d2d3c0414e8764" + integrity sha512-SMJOdDP6LqTkD0Uq8qLi+gMwSt0imXLSV080qFVwJCpH9U6Mb+SUGHAXM0KNbcBPguytWyvFxcHgMLe2D2XSpw== dependencies: fast-deep-equal "^3.1.1" json-schema-traverse "^1.0.0" @@ -2114,11 +2476,11 @@ ansi-escapes@^3.2.0: integrity sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ== ansi-escapes@^4.2.1, ansi-escapes@^4.3.0: - version "4.3.1" - resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.1.tgz#a5c47cc43181f1f38ffd7076837700d395522a61" - integrity sha512-JWF7ocqNrp8u9oqpgV+wH5ftbt+cfvv+PTjOvKLT3AdYly/LmORARfEVT1iyjwN+4MqE5UmVKoAdIBqeoCHgLA== + version "4.3.2" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.2.tgz#6b2291d1db7d98b6521d5f1efa42d0f3a9feb65e" + integrity sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ== dependencies: - type-fest "^0.11.0" + type-fest "^0.21.3" ansi-regex@^2.0.0: version "2.1.1" @@ -2135,10 +2497,10 @@ ansi-regex@^4.1.0: resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997" integrity sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg== -ansi-regex@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75" - integrity sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg== +ansi-regex@^5.0.0, ansi-regex@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" + integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== ansi-styles@^3.2.0, ansi-styles@^3.2.1: version "3.2.1" @@ -2148,30 +2510,26 @@ ansi-styles@^3.2.0, ansi-styles@^3.2.1: color-convert "^1.9.0" ansi-styles@^4.0.0, ansi-styles@^4.1.0: - version "4.2.1" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.2.1.tgz#90ae75c424d008d2624c5bf29ead3177ebfcf359" - integrity sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA== + version "4.3.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" + integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== dependencies: - "@types/color-name" "^1.1.1" color-convert "^2.0.1" +ansi-styles@^5.0.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-5.2.0.tgz#07449690ad45777d1924ac2abb2fc8895dba836b" + integrity sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA== + any-promise@^1.0.0: version "1.3.0" resolved "https://registry.yarnpkg.com/any-promise/-/any-promise-1.3.0.tgz#abc6afeedcea52e809cdc0376aed3ce39635d17f" integrity sha1-q8av7tzqUugJzcA3au0845Y10X8= -anymatch@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-2.0.0.tgz#bcb24b4f37934d9aa7ac17b4adaf89e7c76ef2eb" - integrity sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw== - dependencies: - micromatch "^3.1.4" - normalize-path "^2.1.1" - -anymatch@^3.0.3: - version "3.1.1" - resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.1.tgz#c55ecf02185e2469259399310c173ce31233b142" - integrity sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg== +anymatch@^3.0.3, anymatch@~3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.2.tgz#c0557c096af32f106198f4f4e2a383537e378716" + integrity sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg== dependencies: normalize-path "^3.0.0" picomatch "^2.0.4" @@ -2187,9 +2545,9 @@ aproba@^2.0.0: integrity sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ== are-we-there-yet@~1.1.2: - version "1.1.5" - resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz#4b35c2944f062a8bfcda66410760350fe9ddfc21" - integrity sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w== + version "1.1.7" + resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.1.7.tgz#b15474a932adab4ff8a50d9adfa7e4e926f21146" + integrity sha512-nxwy40TuMiUGqMyRHgCSWZ9FM4VAoRP4xUYSTv5ImRog+h9yISPbVH7H8fASCIzYn9wlEv4zvFL7uKDMCFQm3g== dependencies: delegates "^1.0.0" readable-stream "^2.0.6" @@ -2199,7 +2557,7 @@ arg@^4.1.0: resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089" integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA== -argparse@^1.0.7: +argparse@^1.0.7, argparse@~1.0.9: version "1.0.10" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== @@ -2241,14 +2599,16 @@ array-ify@^1.0.0: resolved "https://registry.yarnpkg.com/array-ify/-/array-ify-1.0.0.tgz#9e528762b4a9066ad163a6962a364418e9626ece" integrity sha1-nlKHYrSpBmrRY6aWKjZEGOlibs4= -array-includes@^3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/array-includes/-/array-includes-3.1.1.tgz#cdd67e6852bdf9c1215460786732255ed2459348" - integrity sha512-c2VXaCHl7zPsvpkFsw4nxvFie4fh1ur9bpcgsVkIjqn0H/Xwdg+7fv3n2r/isyS8EBj5b06M9kHyZuIr4El6WQ== +array-includes@^3.1.4: + version "3.1.4" + resolved "https://registry.yarnpkg.com/array-includes/-/array-includes-3.1.4.tgz#f5b493162c760f3539631f005ba2bb46acb45ba9" + integrity sha512-ZTNSQkmWumEbiHO2GF4GmWxYVTiQyJy2XOTa15sdQSrvKn7l+180egQMqlrMOUMCyLMD7pmyQe4mMDUT6Behrw== dependencies: + call-bind "^1.0.2" define-properties "^1.1.3" - es-abstract "^1.17.0" - is-string "^1.0.5" + es-abstract "^1.19.1" + get-intrinsic "^1.1.1" + is-string "^1.0.7" array-timsort@^1.0.3: version "1.0.3" @@ -2277,13 +2637,14 @@ array-unique@^0.3.2: resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" integrity sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg= -array.prototype.flat@^1.2.3: - version "1.2.3" - resolved "https://registry.yarnpkg.com/array.prototype.flat/-/array.prototype.flat-1.2.3.tgz#0de82b426b0318dbfdb940089e38b043d37f6c7b" - integrity sha512-gBlRZV0VSmfPIeWfuuy56XZMvbVfbEUnOXUvt3F/eUUUSyzlgLxhEX4YAEpxNAogRGehPSnfXyPtYyKAhkzQhQ== +array.prototype.flat@^1.2.5: + version "1.2.5" + resolved "https://registry.yarnpkg.com/array.prototype.flat/-/array.prototype.flat-1.2.5.tgz#07e0975d84bbc7c48cd1879d609e682598d33e13" + integrity sha512-KaYU+S+ndVqyUnignHftkwc58o3uVU1jzczILJ1tN2YaIZpFIKBiP/x/j97E5MVPsaCloPbqWLB/8qCTVvT2qg== dependencies: + call-bind "^1.0.2" define-properties "^1.1.3" - es-abstract "^1.17.0-next.1" + es-abstract "^1.19.0" arrify@^1.0.1: version "1.0.1" @@ -2317,10 +2678,15 @@ astral-regex@^2.0.0: resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31" integrity sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ== +async@0.9.x: + version "0.9.2" + resolved "https://registry.yarnpkg.com/async/-/async-0.9.2.tgz#aea74d5e61c1f899613bf64bda66d4c78f2fd17d" + integrity sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0= + async@^3.0.1: - version "3.2.0" - resolved "https://registry.yarnpkg.com/async/-/async-3.2.0.tgz#b3a2685c5ebb641d3de02d161002c60fc9f85720" - integrity sha512-TR2mEZFVOj2pLStYxLht7TyfuRzaydfpxr3k9RpHIzMgw7A64dzsdqCxH1WJyQdoe8T10nDXd9wnEigmiuHIZw== + version "3.2.1" + resolved "https://registry.yarnpkg.com/async/-/async-3.2.1.tgz#d3274ec66d107a47476a4c49136aacdb00665fc8" + integrity sha512-XdD5lRO/87udXCMC9meWdYiR+Nq6ZjUfXidViUZGu2F1MO4T3XwZ1et0hb2++BgLfhyJwy44BGB/yx80ABx8hg== asynckit@^0.4.0: version "0.4.0" @@ -2348,20 +2714,27 @@ aws-sign2@~0.7.0: integrity sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg= aws4@^1.8.0: - version "1.10.1" - resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.10.1.tgz#e1e82e4f3e999e2cfd61b161280d16a111f86428" - integrity sha512-zg7Hz2k5lI8kb7U32998pRRFin7zJlkfezGJjUc2heaD4Pw2wObakCDVzkKztTm/Ln7eiVvYsjqak0Ed4LkMDA== - -babel-jest@^26.6.3: - version "26.6.3" - resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-26.6.3.tgz#d87d25cb0037577a0c89f82e5755c5d293c01056" - integrity sha512-pl4Q+GAVOHwvjrck6jKjvmGhnO3jHX/xuB9d27f+EJZ/6k+6nMuPjorrYp7s++bKKdANwzElBWnLWaObvTnaZA== - dependencies: - "@jest/transform" "^26.6.2" - "@jest/types" "^26.6.2" - "@types/babel__core" "^7.1.7" + version "1.11.0" + resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.11.0.tgz#d61f46d83b2519250e2784daf5b09479a8b41c59" + integrity sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA== + +axios@^0.21.1: + version "0.21.4" + resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.4.tgz#c67b90dc0568e5c1cf2b0b858c43ba28e2eda575" + integrity sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg== + dependencies: + follow-redirects "^1.14.0" + +babel-jest@^27.2.2, babel-jest@^27.3.1: + version "27.3.1" + resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-27.3.1.tgz#0636a3404c68e07001e434ac4956d82da8a80022" + integrity sha512-SjIF8hh/ir0peae2D6S6ZKRhUy7q/DnpH7k/V6fT4Bgs/LXXUztOpX4G2tCgq8mLo5HA9mN6NmlFMeYtKmIsTQ== + dependencies: + "@jest/transform" "^27.3.1" + "@jest/types" "^27.2.5" + "@types/babel__core" "^7.1.14" babel-plugin-istanbul "^6.0.0" - babel-preset-jest "^26.6.2" + babel-preset-jest "^27.2.0" chalk "^4.0.0" graceful-fs "^4.2.4" slash "^3.0.0" @@ -2377,10 +2750,10 @@ babel-plugin-istanbul@^6.0.0: istanbul-lib-instrument "^4.0.0" test-exclude "^6.0.0" -babel-plugin-jest-hoist@^26.6.2: - version "26.6.2" - resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-26.6.2.tgz#8185bd030348d254c6d7dd974355e6a28b21e62d" - integrity sha512-PO9t0697lNTmcEHH69mdtYiOIkkOlj9fySqfO3K1eCcdISevLAE0xY59VLLUj0SoiPiTX/JU2CYFpILydUa5Lw== +babel-plugin-jest-hoist@^27.2.0: + version "27.2.0" + resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-27.2.0.tgz#79f37d43f7e5c4fdc4b2ca3e10cc6cf545626277" + integrity sha512-TOux9khNKdi64mW+0OIhcmbAn75tTlzKhxmiNXevQaPbrBYK7YKjP1jl6NHTJ6XR5UgUrJbCnWlKVnJn29dfjw== dependencies: "@babel/template" "^7.3.3" "@babel/types" "^7.3.3" @@ -2405,18 +2778,18 @@ babel-preset-current-node-syntax@^1.0.0: "@babel/plugin-syntax-optional-chaining" "^7.8.3" "@babel/plugin-syntax-top-level-await" "^7.8.3" -babel-preset-jest@^26.6.2: - version "26.6.2" - resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-26.6.2.tgz#747872b1171df032252426586881d62d31798fee" - integrity sha512-YvdtlVm9t3k777c5NPQIv6cxFFFapys25HiUmuSgHwIZhfifweR5c5Sf5nwE3MAbfu327CYSvps8Yx6ANLyleQ== +babel-preset-jest@^27.2.0: + version "27.2.0" + resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-27.2.0.tgz#556bbbf340608fed5670ab0ea0c8ef2449fba885" + integrity sha512-z7MgQ3peBwN5L5aCqBKnF6iqdlvZvFUQynEhu0J+X9nHLU72jO3iY331lcYrg+AssJ8q7xsv5/3AICzVmJ/wvg== dependencies: - babel-plugin-jest-hoist "^26.6.2" + babel-plugin-jest-hoist "^27.2.0" babel-preset-current-node-syntax "^1.0.0" balanced-match@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" - integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= + version "1.0.2" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" + integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== base@^0.11.1: version "0.11.2" @@ -2439,9 +2812,14 @@ bcrypt-pbkdf@^1.0.0: tweetnacl "^0.14.3" before-after-hook@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/before-after-hook/-/before-after-hook-2.1.0.tgz#b6c03487f44e24200dd30ca5e6a1979c5d2fb635" - integrity sha512-IWIbu7pMqyw3EAJHzzHbWa85b6oud/yfKYg5rqB5hNE8CeMi3nX+2C2sj0HswfblST86hpVEOAb9x34NZd6P7A== + version "2.2.2" + resolved "https://registry.yarnpkg.com/before-after-hook/-/before-after-hook-2.2.2.tgz#a6e8ca41028d90ee2c24222f201c90956091613e" + integrity sha512-3pZEU3NT5BFUo/AD5ERPWOgQOCZITni6iavr5AUw5AUwQjMlI0kzu5btnyD39AF0gUEsDPwJT+oY1ORBJijPjQ== + +binary-extensions@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d" + integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA== bluebird@^3.5.1, bluebird@^3.5.3, bluebird@^3.5.5: version "3.7.2" @@ -2472,7 +2850,7 @@ braces@^2.3.1: split-string "^3.0.2" to-regex "^3.0.1" -braces@^3.0.1: +braces@^3.0.1, braces@~3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== @@ -2484,16 +2862,16 @@ browser-process-hrtime@^1.0.0: resolved "https://registry.yarnpkg.com/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz#3c9b4b7d782c8121e56f10106d84c0d0ffc94626" integrity sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow== -browserslist@^4.14.5: - version "4.16.3" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.16.3.tgz#340aa46940d7db878748567c5dea24a48ddf3717" - integrity sha512-vIyhWmIkULaq04Gt93txdh+j02yX/JzlyhLYbV3YQCn/zvES3JnY7TifHHvvr1w5hTDluNKMkV05cs4vy8Q7sw== +browserslist@^4.16.6: + version "4.17.4" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.17.4.tgz#72e2508af2a403aec0a49847ef31bd823c57ead4" + integrity sha512-Zg7RpbZpIJRW3am9Lyckue7PLytvVxxhJj1CaJVlCWENsGEAOlnlt8X0ZxGRPp7Bt9o8tIRM5SEXy4BCPMJjLQ== dependencies: - caniuse-lite "^1.0.30001181" - colorette "^1.2.1" - electron-to-chromium "^1.3.649" + caniuse-lite "^1.0.30001265" + electron-to-chromium "^1.3.867" escalade "^3.1.1" - node-releases "^1.1.70" + node-releases "^2.0.0" + picocolors "^1.0.0" bs-logger@0.x: version "0.2.6" @@ -2514,10 +2892,10 @@ btoa-lite@^1.0.0: resolved "https://registry.yarnpkg.com/btoa-lite/-/btoa-lite-1.0.0.tgz#337766da15801210fdd956c22e9c6891ab9d0337" integrity sha1-M3dm2hWAEhD92VbCLpxokaudAzc= -buffer-from@1.x, buffer-from@^1.0.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" - integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== +buffer-from@^1.0.0: + version "1.1.2" + resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" + integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== builtin-modules@^1.1.1: version "1.1.1" @@ -2580,6 +2958,14 @@ cachedir@2.2.0: resolved "https://registry.yarnpkg.com/cachedir/-/cachedir-2.2.0.tgz#19afa4305e05d79e417566882e0c8f960f62ff0e" integrity sha512-VvxA0xhNqIIfg0V9AmJkDg91DaJwryutH5rVEZAhcNi4iJFj9f+QxmAjgK1LT9I8OgToX27fypX6/MeCXVbBjQ== +call-bind@^1.0.0, call-bind@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.2.tgz#b1d4e89e688119c3c9a903ad30abb2f6a919be3c" + integrity sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA== + dependencies: + 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" @@ -2604,7 +2990,7 @@ callsites@^2.0.0: resolved "https://registry.yarnpkg.com/callsites/-/callsites-2.0.0.tgz#06eb84f00eea413da86affefacbffb36093b3c50" integrity sha1-BuuE8A7qQT2oav/vrL/7Ngk7PFA= -callsites@^3.0.0: +callsites@^3.0.0, callsites@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== @@ -2650,29 +3036,22 @@ camelcase@^5.0.0, camelcase@^5.3.1: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== -camelcase@^6.0.0: +camelcase@^6.2.0: version "6.2.0" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.2.0.tgz#924af881c9d525ac9d87f40d964e5cea982a1809" integrity sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg== -caniuse-lite@^1.0.30001181: - version "1.0.30001191" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001191.tgz#bacb432b6701f690c8c5f7c680166b9a9f0843d9" - integrity sha512-xJJqzyd+7GCJXkcoBiQ1GuxEiOBCLQ0aVW9HMekifZsAVGdj5eJ4mFB9fEhSHipq9IOk/QXFJUiIr9lZT+EsGw== - -capture-exit@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/capture-exit/-/capture-exit-2.0.0.tgz#fb953bfaebeb781f62898239dabb426d08a509a4" - integrity sha512-PiT/hQmTonHhl/HFGN+Lx3JJUznrVYJ3+AQsnthneZbvW7x+f08Tk7yLJTLEOUvBTbduLeeBkxEaYXUOUrRq6g== - dependencies: - rsvp "^4.8.4" +caniuse-lite@^1.0.30001265: + version "1.0.30001267" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001267.tgz#b1cf2937175afc0570e4615fc2d2f9069fa0ed30" + integrity sha512-r1mjTzAuJ9W8cPBGbbus8E0SKcUP7gn03R14Wk8FlAlqhH9hroy9nLqmpuXlfKEw/oILW+FGz47ipXV2O7x8lg== caseless@~0.12.0: version "0.12.0" resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw= -chalk@4.1.0, chalk@^4.0.0, chalk@^4.1.0: +chalk@4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.0.tgz#4e14870a618d9e2edd97dd8345fd9d9dc315646a" integrity sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A== @@ -2689,6 +3068,14 @@ chalk@^2.0.0, chalk@^2.3.0, chalk@^2.3.1, chalk@^2.4.1, chalk@^2.4.2: escape-string-regexp "^1.0.5" supports-color "^5.3.0" +chalk@^4.0.0, chalk@^4.1.0, chalk@^4.1.1, chalk@^4.1.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" + integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + char-regex@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/char-regex/-/char-regex-1.0.2.tgz#d744358226217f981ed58f479b1d6bcc29545dcf" @@ -2699,20 +3086,45 @@ chardet@^0.7.0: resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" integrity sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA== -chownr@^1.1.1, chownr@^1.1.2: +chokidar@^3.5.1: + version "3.5.2" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.2.tgz#dba3976fcadb016f66fd365021d91600d01c1e75" + integrity sha512-ekGhOnNVPgT77r4K/U3GDhu+FQ2S8TnK/s2KbIGXi0SZWuwkZ2QNyfWdZW+TVfn84DpEP7rLeCt2UI6bJ8GwbQ== + dependencies: + anymatch "~3.1.2" + braces "~3.0.2" + glob-parent "~5.1.2" + is-binary-path "~2.1.0" + is-glob "~4.0.1" + normalize-path "~3.0.0" + readdirp "~3.6.0" + optionalDependencies: + fsevents "~2.3.2" + +chownr@^1.1.1, chownr@^1.1.2, chownr@^1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.4.tgz#6fc9d7b42d32a583596337666e7d08084da2cc6b" integrity sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg== +chownr@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/chownr/-/chownr-2.0.0.tgz#15bfbe53d2eab4cf70f18a8cd68ebe5b3cb1dece" + integrity sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ== + ci-info@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46" integrity sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ== -cjs-module-lexer@^0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-0.6.0.tgz#4186fcca0eae175970aee870b9fe2d6cf8d5655f" - integrity sha512-uc2Vix1frTfnuzxxu1Hp4ktSvM3QaI4oXl4ZUqL1wjTu/BGki9TrCWoqLTg/drR1KwAEarXuRFCG2Svr1GxPFw== +ci-info@^3.1.1, ci-info@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.2.0.tgz#2876cb948a498797b5236f0095bc057d0dca38b6" + integrity sha512-dVqRX7fLUm8J6FgHJ418XuIgDLZDkYcDFTeL6TA2gt5WlIZUQrrH6EZrNClwT/H0FateUsZkGIOPRrLbP+PR9A== + +cjs-module-lexer@^1.0.0: + version "1.2.2" + resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-1.2.2.tgz#9f84ba3244a512f3a54e5277e8eef4c489864e40" + integrity sha512-cOU9usZw8/dXIXKtwa8pM0OTJQuJkxMN6w30csNRUerHfeQ5R6U3kkU/FtJeIf3M202OHfY2U8ccInBG7/xogA== class-utils@^0.3.5: version "0.3.6" @@ -2729,6 +3141,14 @@ clean-stack@^2.0.0: resolved "https://registry.yarnpkg.com/clean-stack/-/clean-stack-2.2.0.tgz#ee8472dbb129e727b31e8a10a427dee9dfe4008b" integrity sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A== +clear-module@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/clear-module/-/clear-module-4.1.1.tgz#bf8ba3b62eb70ee1e0adec90589741425cf32db8" + integrity sha512-ng0E7LeODcT3QkazOckzZqbca+JByQy/Q2Z6qO24YsTp+pLxCfohGz2gJYJqZS0CWTX3LEUiHOqe5KlYeUbEMw== + dependencies: + parent-module "^2.0.0" + resolve-from "^5.0.0" + cli-cursor@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5" @@ -2743,7 +3163,7 @@ cli-cursor@^3.1.0: dependencies: restore-cursor "^3.1.0" -cli-truncate@^2.1.0: +cli-truncate@2.1.0, cli-truncate@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/cli-truncate/-/cli-truncate-2.1.0.tgz#c39e28bf05edcde5be3b98992a22deed5a2b93c7" integrity sha512-n8fOixwDD6b/ObinzTrp1ZKFzbgvKZvuz/TvejnLn1aQfC6r52XEx85FmuC+3HI+JM7coBRXUvNqEU2PHVrHpg== @@ -2779,6 +3199,15 @@ cliui@^6.0.0: strip-ansi "^6.0.0" wrap-ansi "^6.2.0" +cliui@^7.0.2: + version "7.0.4" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-7.0.4.tgz#a0265ee655476fc807aea9df3df8df7783808b4f" + integrity sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ== + dependencies: + string-width "^4.2.0" + strip-ansi "^6.0.0" + wrap-ansi "^7.0.0" + clone-deep@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/clone-deep/-/clone-deep-4.0.1.tgz#c19fd9bdbbf85942b4fd979c84dcf7d5f07c2387" @@ -2840,10 +3269,15 @@ color-name@~1.1.4: resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== -colorette@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/colorette/-/colorette-1.2.1.tgz#4d0b921325c14faf92633086a536db6e89564b1b" - integrity sha512-puCDz0CzydiSYOrnXpz/PKd69zRrribezjtE9yd4zvytoRc8+RY/KJPvtPFKZS3E3wP6neGyMe0vOTlHO5L3Pw== +colorette@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/colorette/-/colorette-1.4.0.tgz#5190fbb87276259a86ad700bff2c6d6faa3fca40" + integrity sha512-Y2oEozpomLn7Q3HFP7dpww7AtMJplbM9lGZP6RDfHqmbeRjiwRg4n6VM6j4KLmRke85uWEI7JqF17f3pqdRA0g== + +colors@~1.2.1: + version "1.2.5" + resolved "https://registry.yarnpkg.com/colors/-/colors-1.2.5.tgz#89c7ad9a374bc030df8013241f68136ed8835afc" + integrity sha512-erNRLao/Y3Fv54qUa0LBB+//Uf3YwMUmdJinN20yMXm9zdKKqH9wt7R9IIVZ+K7ShzfpLV/Zg8+VyrBJYB4lpg== columnify@^1.5.4: version "1.5.4" @@ -2853,32 +3287,27 @@ columnify@^1.5.4: strip-ansi "^3.0.0" wcwidth "^1.0.0" -combined-stream@^1.0.6, combined-stream@~1.0.6: +combined-stream@^1.0.6, combined-stream@^1.0.8, combined-stream@~1.0.6: version "1.0.8" resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== dependencies: delayed-stream "~1.0.0" -commander@^2.12.1: +commander@^2.12.1, commander@^2.7.1: version "2.20.3" resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== -commander@^6.2.0, commander@~6.2.1: - version "6.2.1" - resolved "https://registry.yarnpkg.com/commander/-/commander-6.2.1.tgz#0792eb682dfbc325999bb2b84fddddba110ac73c" - integrity sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA== - -commander@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-7.0.0.tgz#3e2bbfd8bb6724760980988fb5b22b7ee6b71ab2" - integrity sha512-ovx/7NkTrnPuIV8sqk/GjUIIM1+iUQeqA3ye2VNpq9sVoiZsooObWlQy+OPWGI17GDaEoybuAGJm6U8yC077BA== +commander@^8.2.0, commander@~8.2.0: + version "8.2.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-8.2.0.tgz#37fe2bde301d87d47a53adeff8b5915db1381ca8" + integrity sha512-LLKxDvHeL91/8MIyTAD5BFMNtoIwztGPMiM/7Bl8rIPmHCZXRxmSWr91h57dpOpnQ6jIUqEWdXE/uBYMfiVZDA== -comment-json@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/comment-json/-/comment-json-4.1.0.tgz#09d08f0fbc4ad5eeccbac20f469adbb967dcbd2c" - integrity sha512-WEghmVYaNq9NlWbrkzQTSsya9ycLyxJxpTQfZEan6a5Jomnjw18zS3Podf8q1Zf9BvonvQd/+Z7Z39L7KKzzdQ== +comment-json@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/comment-json/-/comment-json-4.1.1.tgz#49df4948704bebb1cc0ffa6910e25669b668b7c5" + integrity sha512-v8gmtPvxhBlhdRBLwdHSjGy9BgA23t9H1FctdQKyUrErPjSrJcdDMqBq9B4Irtm7w3TNYLQJNH6ARKnpyag1sA== dependencies: array-timsort "^1.0.3" core-util-is "^1.0.2" @@ -2887,15 +3316,15 @@ comment-json@^4.1.0: repeat-string "^1.6.1" commitizen@^4.0.3: - version "4.2.1" - resolved "https://registry.yarnpkg.com/commitizen/-/commitizen-4.2.1.tgz#3b098b16c6b1a37f0d129018dff6751b20cd3103" - integrity sha512-nZsp8IThkDu7C+93BFD/mLShb9Gd6Wsaf90tpKE3x/6u5y/Q52kzanIJpGr0qvIsJ5bCMpgKtr3Lbu3miEJfaA== + version "4.2.4" + resolved "https://registry.yarnpkg.com/commitizen/-/commitizen-4.2.4.tgz#a3e5b36bd7575f6bf6e7aa19dbbf06b0d8f37165" + integrity sha512-LlZChbDzg3Ir3O2S7jSo/cgWp5/QwylQVr59K4xayVq8S4/RdKzSyJkghAiZZHfhh5t4pxunUoyeg0ml1q/7aw== dependencies: cachedir "2.2.0" cz-conventional-changelog "3.2.0" dedent "0.7.0" detect-indent "6.0.0" - find-node-modules "2.0.0" + find-node-modules "^2.1.2" find-root "1.1.0" fs-extra "8.1.0" glob "7.1.4" @@ -2945,9 +3374,9 @@ concat-stream@^2.0.0: typedarray "^0.0.6" config-chain@^1.1.11: - 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== + version "1.1.13" + resolved "https://registry.yarnpkg.com/config-chain/-/config-chain-1.1.13.tgz#fad0795aa6a6cdaff9ed1b68e9dff94372c232f4" + integrity sha512-qj+f8APARXHrM0hraqXYb2/bOVSV4PvJQlNZ/DVj0QrmNM2q2euizkeuVckQ57J+W0mRH6Hvi+k50M4Jul2VRQ== dependencies: ini "^1.3.4" proto-list "~1.2.1" @@ -2969,23 +3398,18 @@ console-control-strings@^1.0.0, 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= -contains-path@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/contains-path/-/contains-path-0.1.0.tgz#fe8cf184ff6670b6baef01a9d4861a5cbec4120a" - integrity sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo= - -conventional-changelog-angular@^5.0.0, conventional-changelog-angular@^5.0.3: - version "5.0.11" - resolved "https://registry.yarnpkg.com/conventional-changelog-angular/-/conventional-changelog-angular-5.0.11.tgz#99a3ca16e4a5305e0c2c2fae3ef74fd7631fc3fb" - integrity sha512-nSLypht/1yEflhuTogC03i7DX7sOrXGsRn14g131Potqi6cbGbGEE9PSDEHKldabB6N76HiSyw9Ph+kLmC04Qw== +conventional-changelog-angular@^5.0.11, conventional-changelog-angular@^5.0.3: + version "5.0.13" + resolved "https://registry.yarnpkg.com/conventional-changelog-angular/-/conventional-changelog-angular-5.0.13.tgz#896885d63b914a70d4934b59d2fe7bde1832b28c" + integrity sha512-i/gipMxs7s8L/QeuavPF2hLnJgH6pEZAttySB6aiQLWcX3puWDL3ACVmvBhJGxnAy52Qc15ua26BufY6KpmrVA== dependencies: compare-func "^2.0.0" q "^1.5.1" conventional-changelog-conventionalcommits@^4.3.1: - version "4.5.0" - resolved "https://registry.yarnpkg.com/conventional-changelog-conventionalcommits/-/conventional-changelog-conventionalcommits-4.5.0.tgz#a02e0b06d11d342fdc0f00c91d78265ed0bc0a62" - integrity sha512-buge9xDvjjOxJlyxUnar/+6i/aVEVGA7EEh4OafBCXPlLUQPGbRUBhBUveWRxzvR8TEjhKEP4BdepnpG2FSZXw== + version "4.6.1" + resolved "https://registry.yarnpkg.com/conventional-changelog-conventionalcommits/-/conventional-changelog-conventionalcommits-4.6.1.tgz#f4c0921937050674e578dc7875f908351ccf4014" + integrity sha512-lzWJpPZhbM1R0PIzkwzGBCnAkH5RKJzJfFQZcl/D+2lsJxAwGnDKBqn/F4C1RD31GJNn8NuKWQzAZDAVXPp2Mw== dependencies: compare-func "^2.0.0" lodash "^4.17.15" @@ -3016,46 +3440,45 @@ conventional-changelog-preset-loader@^2.1.1: integrity sha512-GEKRWkrSAZeTq5+YjUZOYxdHq+ci4dNwHvpaBC3+ENalzFWuCWa9EZXSuZBpkr72sMdKB+1fyDV4takK1Lf58g== conventional-changelog-writer@^4.0.6: - version "4.0.17" - resolved "https://registry.yarnpkg.com/conventional-changelog-writer/-/conventional-changelog-writer-4.0.17.tgz#4753aaa138bf5aa59c0b274cb5937efcd2722e21" - integrity sha512-IKQuK3bib/n032KWaSb8YlBFds+aLmzENtnKtxJy3+HqDq5kohu3g/UdNbIHeJWygfnEbZjnCKFxAW0y7ArZAw== + version "4.1.0" + resolved "https://registry.yarnpkg.com/conventional-changelog-writer/-/conventional-changelog-writer-4.1.0.tgz#1ca7880b75aa28695ad33312a1f2366f4b12659f" + integrity sha512-WwKcUp7WyXYGQmkLsX4QmU42AZ1lqlvRW9mqoyiQzdD+rJWbTepdWoKJuwXTS+yq79XKnQNa93/roViPQrAQgw== dependencies: compare-func "^2.0.0" - conventional-commits-filter "^2.0.6" + conventional-commits-filter "^2.0.7" dateformat "^3.0.0" handlebars "^4.7.6" json-stringify-safe "^5.0.1" lodash "^4.17.15" - meow "^7.0.0" + meow "^8.0.0" semver "^6.0.0" split "^1.0.0" - through2 "^3.0.0" + through2 "^4.0.0" conventional-commit-types@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/conventional-commit-types/-/conventional-commit-types-3.0.0.tgz#7c9214e58eae93e85dd66dbfbafe7e4fffa2365b" integrity sha512-SmmCYnOniSsAa9GqWOeLqc179lfr5TRu5b4QFDkbsrJ5TZjPJx85wtOr3zn+1dbeNiXDKGPbZ72IKbPhLXh/Lg== -conventional-commits-filter@^2.0.2, conventional-commits-filter@^2.0.6: - version "2.0.6" - resolved "https://registry.yarnpkg.com/conventional-commits-filter/-/conventional-commits-filter-2.0.6.tgz#0935e1240c5ca7698329affee1b6a46d33324c4c" - integrity sha512-4g+sw8+KA50/Qwzfr0hL5k5NWxqtrOVw4DDk3/h6L85a9Gz0/Eqp3oP+CWCNfesBvZZZEFHF7OTEbRe+yYSyKw== +conventional-commits-filter@^2.0.2, 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== dependencies: lodash.ismatch "^4.4.0" modify-values "^1.0.0" -conventional-commits-parser@^3.0.0, conventional-commits-parser@^3.0.3: - version "3.1.0" - resolved "https://registry.yarnpkg.com/conventional-commits-parser/-/conventional-commits-parser-3.1.0.tgz#10140673d5e7ef5572633791456c5d03b69e8be4" - integrity sha512-RSo5S0WIwXZiRxUGTPuYFbqvrR4vpJ1BDdTlthFgvHt5kEdnd1+pdvwWphWn57/oIl4V72NMmOocFqqJ8mFFhA== +conventional-commits-parser@^3.0.3, conventional-commits-parser@^3.2.2: + version "3.2.2" + resolved "https://registry.yarnpkg.com/conventional-commits-parser/-/conventional-commits-parser-3.2.2.tgz#190fb9900c6e02be0c0bca9b03d57e24982639fd" + integrity sha512-Jr9KAKgqAkwXMRHjxDwO/zOCDKod1XdAESHAGuJX38iZ7ZzVti/tvVoysO0suMsdAObp9NQ2rHSsSbnAqZ5f5g== dependencies: JSONStream "^1.0.4" is-text-path "^1.0.1" lodash "^4.17.15" - meow "^7.0.0" - split2 "^2.0.0" - through2 "^3.0.0" - trim-off-newlines "^1.0.0" + meow "^8.0.0" + split2 "^3.0.0" + through2 "^4.0.0" conventional-recommended-bump@^5.0.0: version "5.0.1" @@ -3072,9 +3495,9 @@ conventional-recommended-bump@^5.0.0: q "^1.5.1" convert-source-map@^1.4.0, convert-source-map@^1.6.0, convert-source-map@^1.7.0: - version "1.7.0" - resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.7.0.tgz#17a2cb882d7f77d3490585e2ce6c524424a3a442" - integrity sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA== + version "1.8.0" + resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.8.0.tgz#f3373c32d21b4d780dd8004514684fb791ca4369" + integrity sha512-+OQdjP49zViI/6i7nIJpA8rAl4sV/JdPfU9nZs3VqOwGIgizICvuN2ru6fMd+4llL0tar18UYJXfZ/TWtmhUjA== dependencies: safe-buffer "~5.1.1" @@ -3095,16 +3518,26 @@ copy-descriptor@^0.1.0: resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40= -core-js@^3.6.1: - version "3.6.5" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.6.5.tgz#7395dc273af37fb2e50e9bd3d9fe841285231d1a" - integrity sha512-vZVEEwZoIsI+vPEuoF9Iqf5H7/M3eeQqWlQnYa8FSKKePuYTf5MWnxb5SDAzCa60b3JBRS5g9b+Dq7b1y/RCrA== - -core-util-is@1.0.2, core-util-is@^1.0.2, core-util-is@~1.0.0: +core-util-is@1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= +core-util-is@^1.0.2, core-util-is@~1.0.0: + version "1.0.3" + resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.3.tgz#a6042d3634c2b27e9328f837b965fac83808db85" + integrity sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ== + +cosmiconfig@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-4.0.0.tgz#760391549580bbd2df1e562bc177b13c290972dc" + integrity sha512-6e5vDdrXZD+t5v0L8CrurPeybg4Fmf+FCSYxXKYVAqLUtyCSbuyqE059d0kDthTNRzKVjL7QMgNpEUlsoYH3iQ== + dependencies: + is-directory "^0.3.1" + js-yaml "^3.9.0" + parse-json "^4.0.0" + require-from-string "^2.0.1" + cosmiconfig@^5.1.0: version "5.2.1" resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-5.2.1.tgz#040f726809c591e77a17c0a3626ca45b4f168b1a" @@ -3115,10 +3548,10 @@ cosmiconfig@^5.1.0: js-yaml "^3.13.1" parse-json "^4.0.0" -cosmiconfig@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-7.0.0.tgz#ef9b44d773959cae63ddecd122de23853b60f8d3" - integrity sha512-pondGvTuVYDk++upghXJabWzL6Kxu6f26ljFw64Swq9v6sQPUL3EUlVDV56diOjpCayKihL6hVe8exIACU4XcA== +cosmiconfig@^7.0.0, cosmiconfig@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-7.0.1.tgz#714d756522cace867867ccb4474c5d01bbae5d6d" + integrity sha512-a1YWNUV2HwGimB7dU2s1wUMurNKjpx60HxBB6xUM8Re+2s1g1IIfJvFR0/iCF+XHdE0GMTKTuLR32UQff4TEyQ== dependencies: "@types/parse-json" "^4.0.0" import-fresh "^3.2.1" @@ -3131,7 +3564,7 @@ create-require@^1.1.0: resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== -cross-spawn@^6.0.0: +cross-spawn@^6.0.0, 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== @@ -3142,7 +3575,7 @@ cross-spawn@^6.0.0: shebang-command "^1.2.0" which "^1.2.9" -cross-spawn@^7.0.0, cross-spawn@^7.0.2: +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== @@ -3156,63 +3589,75 @@ 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-glob@^5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/cspell-glob/-/cspell-glob-5.2.0.tgz#19bf774562254d5bccd5491d2a904357c6f4a683" - integrity sha512-Zc80PsQ86Sfsl04+PjoImfrUnFcPJh78Beg/gFjeJ9+7oUk3oBlAcAczat0ZdfOAdQ3x/rWCH30SoefuaEfsiw== +cspell-gitignore@^5.12.3: + version "5.12.3" + resolved "https://registry.yarnpkg.com/cspell-gitignore/-/cspell-gitignore-5.12.3.tgz#cd0425064f048cc6f40ba791684f068ee0cc130d" + integrity sha512-oPqY6oCVNwFRqcE0FiWNPsyv0EjWiK2N66en6HDZR+pXLZ1CBh8PHcUbRAGt+XHckm27zxbl/sDCKd2m+5yyIA== dependencies: - micromatch "^4.0.2" + cspell-glob "^5.12.3" + find-up "^5.0.0" -cspell-io@^5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/cspell-io/-/cspell-io-5.2.0.tgz#a482cdaa165872445fdb0a68b973ff6dbe09efb0" - integrity sha512-8GFIa31vFtFleJ2ZC4Nb3QmG426aEglKu9OD3lcufNWSnFL1A6tbJJ0zGhuiYDpnyVRMKVkur/vh1FVNNvR83w== +cspell-glob@^5.12.3: + version "5.12.3" + resolved "https://registry.yarnpkg.com/cspell-glob/-/cspell-glob-5.12.3.tgz#31d1b3799f2ced60814730ef1c9332260df44755" + integrity sha512-2ZgzHr01Blch1I1C3jkzb3IIEE7peoFDDAM+MONQdf8JugWrexZsQ3A6nNUuUgtHZYbJC01ZKzB1JunmE84caA== dependencies: - iconv-lite "^0.6.2" - iterable-to-stream "^1.0.1" + micromatch "^4.0.4" + +cspell-io@^5.12.3: + version "5.12.3" + resolved "https://registry.yarnpkg.com/cspell-io/-/cspell-io-5.12.3.tgz#19bf52443ac964042b0a2e9103a8c12f3312d494" + integrity sha512-YqIsDPWj4OKyRYDZyZ9InvYBSGJAYbq/OMzCtJ1vCpgzGdm+7pWQkonGZMThPDW33EsSE8GPaT/XTGZbqZuDoA== -cspell-lib@^5.2.4: - version "5.2.4" - resolved "https://registry.yarnpkg.com/cspell-lib/-/cspell-lib-5.2.4.tgz#8296c5045fa7c4072dcd8b8995e1ae83949c5873" - integrity sha512-DR0ZSNCwurHCobO5QDYyEuCCmkXRutQvfoK18wICuiUElD4WkgksuWPItRr2s5901t/QvImh349U+2UuO9qwCA== +cspell-lib@^5.12.3: + version "5.12.3" + resolved "https://registry.yarnpkg.com/cspell-lib/-/cspell-lib-5.12.3.tgz#47b2ebffe535a82eeed27f539125fef2fcedbb01" + integrity sha512-wiS3X3inzkwr2d6UojVLjzGFxwhnE+HoQYg7cDyC2qqK1Q++36c5bHJGE8564lsVedeAMVbHh81bP7hibg/yUw== dependencies: - "@cspell/cspell-bundled-dicts" "^5.2.4" - "@cspell/cspell-types" "^5.2.4" - comment-json "^4.1.0" + "@cspell/cspell-bundled-dicts" "^5.12.3" + "@cspell/cspell-types" "^5.12.3" + clear-module "^4.1.1" + comment-json "^4.1.1" configstore "^5.0.1" - cosmiconfig "^7.0.0" - cspell-io "^5.2.0" - cspell-trie-lib "^5.2.2" - fs-extra "^9.1.0" + cosmiconfig "^7.0.1" + cspell-glob "^5.12.3" + cspell-io "^5.12.3" + cspell-trie-lib "^5.12.3" + find-up "^5.0.0" + fs-extra "^10.0.0" gensequence "^3.1.1" - minimatch "^3.0.4" + import-fresh "^3.3.0" resolve-from "^5.0.0" resolve-global "^1.0.0" vscode-uri "^3.0.2" -cspell-trie-lib@^5.2.2: - version "5.2.2" - resolved "https://registry.yarnpkg.com/cspell-trie-lib/-/cspell-trie-lib-5.2.2.tgz#5f8878dc09a630ce37a9e6a42f4b5cecaa003ce2" - integrity sha512-Zs4POqx8xPuNF8Cex3NnSv0Ti8sS5UiL5ruo6tKwQWJbpWvrBZ/FTlypG4l2y0BMEqd+/CqmjOv3GX8dDE2lBg== +cspell-trie-lib@^5.12.3: + version "5.12.3" + resolved "https://registry.yarnpkg.com/cspell-trie-lib/-/cspell-trie-lib-5.12.3.tgz#31a6fe7ed3016d77768fc4b1dfcfab1a9dd46a93" + integrity sha512-kck/fUcsBeskuHPFSW4tn4yseDWCDTSaXwxTB+G129anzk0w7mz4LliBBfoD8AHo+D102N7nWmcKXxwPUxAXUQ== dependencies: - fs-extra "^9.1.0" + fs-extra "^10.0.0" gensequence "^3.1.1" -cspell@^5.2.4: - version "5.2.4" - resolved "https://registry.yarnpkg.com/cspell/-/cspell-5.2.4.tgz#d28b6a6ff93d1824c560a2c6f5e4d9000227a12a" - integrity sha512-ONMoI2Yf9of662Ac8Azg+EKXWSDxZIjSWGtkg6FNQOCzD0AgO6ZJv2ti9mHuSZ9rovfaPJUocmiTJSl9TncK6g== - dependencies: - chalk "^4.1.0" - commander "^7.0.0" - comment-json "^4.1.0" - cspell-glob "^5.2.0" - cspell-lib "^5.2.4" - fs-extra "^9.1.0" +cspell@^5.12.3: + version "5.12.3" + resolved "https://registry.yarnpkg.com/cspell/-/cspell-5.12.3.tgz#1966eb6687f7cdf86e5f96a8c39a140ffac42d55" + integrity sha512-lPyWZHfdQh+xjUZDAQC0gnpjglMu2AEfxBWlziTm3XuYuPGTvNJQSUrkMcH180tA3fkj8q2XFwfxHkXXAxm68w== + dependencies: + chalk "^4.1.2" + commander "^8.2.0" + comment-json "^4.1.1" + cspell-gitignore "^5.12.3" + cspell-glob "^5.12.3" + cspell-lib "^5.12.3" + fast-json-stable-stringify "^2.1.0" + file-entry-cache "^6.0.1" + fs-extra "^10.0.0" get-stdin "^8.0.0" - glob "^7.1.6" - minimatch "^3.0.4" - strip-ansi "^6.0.0" + glob "^7.2.0" + imurmurhash "^0.1.4" + strip-ansi "^6.0.1" + vscode-uri "^3.0.2" cssom@^0.4.4: version "0.4.4" @@ -3224,7 +3669,7 @@ cssom@~0.3.6: resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.8.tgz#9f1276f5b2b463f2114d3f2c75250af8c1a36f4a" integrity sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg== -cssstyle@^2.2.0: +cssstyle@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-2.3.0.tgz#ff665a0ddbdc31864b09647f34163443d90b0852" integrity sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A== @@ -3290,6 +3735,11 @@ dashdash@^1.12.0: dependencies: assert-plus "^1.0.0" +data-uri-to-buffer@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/data-uri-to-buffer/-/data-uri-to-buffer-3.0.1.tgz#594b8973938c5bc2c33046535785341abc4f3636" + integrity sha512-WboRycPNsVw3B3TL559F7kuBUM4d8CgMEvk6xEJlOp7OBPjt6G7z8WMWlD2rOFZLk6OYfFIUGsCOWzcQH9K2og== + data-urls@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/data-urls/-/data-urls-2.0.0.tgz#156485a72963a970f5d5821aaf642bef2bf2db9b" @@ -3311,6 +3761,13 @@ debug@3.1.0: dependencies: ms "2.0.0" +debug@4, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.2: + version "4.3.2" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.2.tgz#f0a49c18ac8779e31d4a0c6029dfb76873c7428b" + integrity sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw== + dependencies: + ms "2.1.2" + debug@^2.2.0, debug@^2.3.3, debug@^2.6.9: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" @@ -3318,20 +3775,13 @@ debug@^2.2.0, debug@^2.3.3, debug@^2.6.9: dependencies: ms "2.0.0" -debug@^3.1.0: - version "3.2.6" - resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b" - integrity sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ== +debug@^3.1.0, debug@^3.2.7: + version "3.2.7" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.7.tgz#72580b7e9145fb39b6676f9c5e5fb100b934179a" + integrity sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ== dependencies: ms "^2.1.1" -debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.2.0: - version "4.3.1" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.1.tgz#f0d229c505e0c6d8c49ac553d1b13dc183f6b2ee" - integrity sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ== - dependencies: - ms "2.1.2" - debuglog@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492" @@ -3350,10 +3800,10 @@ decamelize@^1.1.0, decamelize@^1.1.2, decamelize@^1.2.0: resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA= -decimal.js@^10.2.0: - version "10.2.1" - resolved "https://registry.yarnpkg.com/decimal.js/-/decimal.js-10.2.1.tgz#238ae7b0f0c793d3e3cea410108b35a2c01426a3" - integrity sha512-KaL7+6Fw6i5A2XSnsbhm/6B+NuEA7TZ4vqxnd5tXz9sbKtrN9Srj8ab4vKVdK8YAqZO9P1kg45Y6YLoduPf+kw== +decimal.js@^10.2.1: + version "10.3.1" + resolved "https://registry.yarnpkg.com/decimal.js/-/decimal.js-10.3.1.tgz#d8c3a444a9c6774ba60ca6ad7261c3a94fd5e783" + integrity sha512-V0pfhfr8suzyPGOx3nmq4aHqabehUZn6Ch9kyFpV79TGDTWFmHqUqXdabR7QHqxzrYolF4+tVmJhUG4OURg5dQ== decode-uri-component@^0.2.0: version "0.2.0" @@ -3371,9 +3821,9 @@ deep-extend@^0.6.0, deep-extend@~0.6.0: integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== deep-is@^0.1.3, deep-is@~0.1.3: - version "0.1.3" - resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" - integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ= + version "0.1.4" + resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" + integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== deepmerge@^4.2.2: version "4.2.2" @@ -3387,7 +3837,7 @@ defaults@^1.0.3: dependencies: clone "^1.0.2" -define-properties@^1.1.2, define-properties@^1.1.3: +define-properties@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1" integrity sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ== @@ -3460,14 +3910,14 @@ dezalgo@^1.0.0: wrappy "1" didyoumean@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/didyoumean/-/didyoumean-1.2.1.tgz#e92edfdada6537d484d73c0172fd1eba0c4976ff" - integrity sha1-6S7f2tplN9SE1zwBcv0eugxJdv8= + version "1.2.2" + resolved "https://registry.yarnpkg.com/didyoumean/-/didyoumean-1.2.2.tgz#989346ffe9e839b4555ecf5666edea0d3e8ad037" + integrity sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw== -diff-sequences@^26.6.2: - version "26.6.2" - resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-26.6.2.tgz#48ba99157de1923412eed41db6b6d4aa9ca7c0b1" - integrity sha512-Mv/TDa3nZ9sbc5soK+OoA74BsS3mL37yixCvUAQkiuA4Wz6YtwP/K47n2rv2ovzHZvoiQeA5FTQOschKkEwB0Q== +diff-sequences@^27.0.6: + version "27.0.6" + resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-27.0.6.tgz#3305cb2e55a033924054695cc66019fd7f8e5723" + integrity sha512-ag6wfpBFyNXZ0p8pcuIDS//D8H062ZQJ3fzYxjpmeKjnz8W4pekL3AI8VohmyZmsWW2PWaHgjsmqR6L13101VQ== diff@^4.0.1: version "4.0.2" @@ -3488,13 +3938,12 @@ dir-glob@^3.0.1: dependencies: path-type "^4.0.0" -doctrine@1.5.0: - version "1.5.0" - resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-1.5.0.tgz#379dce730f6166f76cefa4e6707a159b02c5a6fa" - integrity sha1-N53Ocw9hZvds76TmcHoVmwLFpvo= +doctrine@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.1.0.tgz#5cd01fc101621b42c4cd7f5d1a66243716d3f39d" + integrity sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw== dependencies: esutils "^2.0.2" - isarray "^1.0.0" doctrine@^3.0.0: version "3.0.0" @@ -3518,12 +3967,17 @@ dot-prop@^4.2.0: is-obj "^1.0.0" dot-prop@^5.1.0, dot-prop@^5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-5.2.0.tgz#c34ecc29556dc45f1f4c22697b6f4904e0cc4fcb" - integrity sha512-uEUyaDKoSQ1M4Oq8l45hSE26SnTxL6snNnqvK/VWx5wJhmff5z0FUVJDKDanor/6w3kzE3i7XZOk+7wC0EXr1A== + version "5.3.0" + resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-5.3.0.tgz#90ccce708cd9cd82cc4dc8c3ddd9abdd55b20e88" + integrity sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q== dependencies: is-obj "^2.0.0" +dotenv@~10.0.0: + version "10.0.0" + resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-10.0.0.tgz#3d4227b8fb95f81096cdd2b66653fb2c7085ba81" + integrity sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q== + downlevel-dts@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/downlevel-dts/-/downlevel-dts-0.7.0.tgz#155c24310dad8a4820ad077e64b15a8c461aa932" @@ -3556,15 +4010,22 @@ ecc-jsbn@~0.1.1: jsbn "~0.1.0" safer-buffer "^2.1.0" -electron-to-chromium@^1.3.649: - version "1.3.672" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.672.tgz#3a6e335016dab4bc584d5292adc4f98f54541f6a" - integrity sha512-gFQe7HBb0lbOMqK2GAS5/1F+B0IMdYiAgB9OT/w1F4M7lgJK2aNOMNOM622aEax+nS1cTMytkiT0uMOkbtFmHw== +ejs@^3.1.5: + version "3.1.6" + resolved "https://registry.yarnpkg.com/ejs/-/ejs-3.1.6.tgz#5bfd0a0689743bb5268b3550cceeebbc1702822a" + integrity sha512-9lt9Zse4hPucPkoP7FHDF0LQAlGyF9JVpnClFLFH3aSSbxmyoqINRpp/9wePWJTUl4KOQwRL72Iw3InHPDkoGw== + dependencies: + jake "^10.6.1" + +electron-to-chromium@^1.3.867: + version "1.3.868" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.868.tgz#ed835023b57ecf0ba63dfe7d50e16b53758ab1da" + integrity sha512-kZYCHqwJ1ctGrYDlOcWQH+/AftAm/KD4lEnLDNwS0kKwx1x6dU4zv+GuDjsPPOGn/2TjnKBaZjDyjXaoix0q/A== -emittery@^0.7.1: - version "0.7.2" - resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.7.2.tgz#25595908e13af0f5674ab419396e2fb394cdfa82" - integrity sha512-A8OG5SR/ij3SsJdWDJdkkSYUjQdCUx6APQXem0SaEePBSRg4eymGYwBkKo1Y6DU+af/Jn2dBQqDBvjnr9Vi8nQ== +emittery@^0.8.1: + version "0.8.1" + resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.8.1.tgz#bb23cc86d03b30aa75a7f734819dee2e1ba70860" + integrity sha512-uDfvUjVrfGJJhymx/kz6prltenw1u7WrCg1oa94zYY8xxVpLLUu045LAT0dhDZdXG58/EpPL/5kA180fQ/qudg== emoji-regex@^7.0.1: version "7.0.3" @@ -3590,27 +4051,35 @@ end-of-stream@^1.0.0, end-of-stream@^1.1.0: dependencies: once "^1.4.0" -enquirer@^2.3.5, enquirer@^2.3.6: +enhanced-resolve@^5.8.3: + version "5.8.3" + resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.8.3.tgz#6d552d465cce0423f5b3d718511ea53826a7b2f0" + integrity sha512-EGAbGvH7j7Xt2nc0E7D99La1OiEs8LnyimkRgwExpUMScN6O+3x9tIWs7PLQZVNx4YD+00skHXPXi1yQHpAmZA== + dependencies: + graceful-fs "^4.2.4" + tapable "^2.2.0" + +enquirer@^2.3.5, enquirer@^2.3.6, enquirer@~2.3.6: version "2.3.6" resolved "https://registry.yarnpkg.com/enquirer/-/enquirer-2.3.6.tgz#2a7fe5dd634a1e4125a975ec994ff5456dc3734d" integrity sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg== dependencies: ansi-colors "^4.1.1" -entities@~2.0.0: - version "2.0.3" - resolved "https://registry.yarnpkg.com/entities/-/entities-2.0.3.tgz#5c487e5742ab93c15abb5da22759b8590ec03b7f" - integrity sha512-MyoZ0jgnLvB2X3Lg5HqpFmn1kybDiIfEQmKzTb5apr51Rb+T3KdmMiqa70T+bhGnyv7bQ6WMj2QMHpGMmlrUYQ== +entities@~2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/entities/-/entities-2.1.0.tgz#992d3129cf7df6870b96c57858c249a120f8b8b5" + integrity sha512-hCx1oky9PFrJ611mf0ifBLBRW8lUUVRlFolb5gWRfIELabBlbp9xZvrqZLZAs+NxFnbfQoeGd8wDkygjg7U85w== env-paths@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/env-paths/-/env-paths-2.2.0.tgz#cdca557dc009152917d6166e2febe1f039685e43" - integrity sha512-6u0VYSCo/OW6IoD5WCLLy9JUGARbamfSavcNXry/eu8aHVFei6CD3Sw+VGX5alea1i9pgPHW0mbu6Xj0uBh7gA== + version "2.2.1" + resolved "https://registry.yarnpkg.com/env-paths/-/env-paths-2.2.1.tgz#420399d416ce1fbe9bc0a07c62fa68d67fd0f8f2" + integrity sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A== envinfo@^7.3.1: - version "7.7.3" - resolved "https://registry.yarnpkg.com/envinfo/-/envinfo-7.7.3.tgz#4b2d8622e3e7366afb8091b23ed95569ea0208cc" - integrity sha512-46+j5QxbPWza0PB1i15nZx0xQ4I/EfQxg9J8Had3b408SV63nEtor2e+oiY63amTo9KTuh2a3XLObNwduxYwwA== + version "7.8.1" + resolved "https://registry.yarnpkg.com/envinfo/-/envinfo-7.8.1.tgz#06377e3e5f4d379fea7ac592d5ad8927e0c4d475" + integrity sha512-/o+BXHmB7ocbHEAs6F2EnG0ogybVVUdkRunTT2glZU9XAaGmhqskrvKwqXuDfNjEO0LZKWdejEEpnq8aM0tOaw== err-code@^1.0.0: version "1.1.2" @@ -3624,22 +4093,31 @@ error-ex@^1.2.0, error-ex@^1.3.1: dependencies: is-arrayish "^0.2.1" -es-abstract@^1.17.0, es-abstract@^1.17.0-next.1, es-abstract@^1.17.5: - version "1.17.6" - resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.17.6.tgz#9142071707857b2cacc7b89ecb670316c3e2d52a" - integrity sha512-Fr89bON3WFyUi5EvAeI48QTWX0AyekGgLA8H+c+7fbfCkJwRWRMLd8CQedNEyJuoYYhmtEqY92pgte1FAhBlhw== +es-abstract@^1.19.0, es-abstract@^1.19.1: + version "1.19.1" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.19.1.tgz#d4885796876916959de78edaa0df456627115ec3" + integrity sha512-2vJ6tjA/UfqLm2MPs7jxVybLoB8i1t1Jd9R3kISld20sIxPcTbLuggQOUxeWeAvIUkduv/CfMjuh4WmiXr2v9w== dependencies: + call-bind "^1.0.2" es-to-primitive "^1.2.1" function-bind "^1.1.1" + get-intrinsic "^1.1.1" + get-symbol-description "^1.0.0" has "^1.0.3" - has-symbols "^1.0.1" - is-callable "^1.2.0" - is-regex "^1.1.0" - object-inspect "^1.7.0" + has-symbols "^1.0.2" + internal-slot "^1.0.3" + is-callable "^1.2.4" + is-negative-zero "^2.0.1" + is-regex "^1.1.4" + is-shared-array-buffer "^1.0.1" + is-string "^1.0.7" + is-weakref "^1.0.1" + object-inspect "^1.11.0" object-keys "^1.1.1" - object.assign "^4.1.0" - string.prototype.trimend "^1.0.1" - string.prototype.trimstart "^1.0.1" + object.assign "^4.1.2" + string.prototype.trimend "^1.0.4" + string.prototype.trimstart "^1.0.4" + unbox-primitive "^1.0.1" es-to-primitive@^1.2.1: version "1.2.1" @@ -3677,32 +4155,38 @@ 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== -escodegen@^1.14.1: - version "1.14.3" - resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.14.3.tgz#4e7b81fba61581dc97582ed78cab7f0e8d63f503" - integrity sha512-qFcX0XJkdg+PB3xjZZG/wKSuT1PnQWx57+TVSjIMmILd2yC/6ByYElPwJnslDsuWuSAp4AwJGumarAAmJch5Kw== +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== + +escodegen@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-2.0.0.tgz#5e32b12833e8aa8fa35e1bf0befa89380484c7dd" + integrity sha512-mmHKys/C8BFUGI+MAWNcSYoORYLMdPzjrknd2Vc+bUsjN5bXcr8EhrNB+UTqfL1y3I9c4fw2ihgtMPQLBRiQxw== dependencies: esprima "^4.0.1" - estraverse "^4.2.0" + estraverse "^5.2.0" esutils "^2.0.2" optionator "^0.8.1" optionalDependencies: source-map "~0.6.1" -eslint-import-resolver-node@^0.3.4: - version "0.3.4" - resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.4.tgz#85ffa81942c25012d8231096ddf679c03042c717" - integrity sha512-ogtf+5AB/O+nM6DIeBUNr2fuT7ot9Qg/1harBfBtaP13ekEWFQEEMP94BCB7zaNW3gyY+8SHYF00rnqYwXKWOA== +eslint-import-resolver-node@^0.3.6: + version "0.3.6" + resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.6.tgz#4048b958395da89668252001dbd9eca6b83bacbd" + integrity sha512-0En0w03NRVMn9Uiyn8YRPDKvWjxCWkslUEhGNTdGx15RvPJYQ+lbOlqrlNI2vEAs4pDYK4f/HN2TbDmk5TP0iw== dependencies: - debug "^2.6.9" - resolve "^1.13.1" + debug "^3.2.7" + resolve "^1.20.0" -eslint-module-utils@^2.6.0: - version "2.6.0" - resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.6.0.tgz#579ebd094f56af7797d19c9866c9c9486629bfa6" - integrity sha512-6j9xxegbqe8/kZY8cYpcp0xhbK0EgJlg3g9mib3/miLaExuuwc3n5UEfSnU6hWMbT0FAYVvDbL9RrRgpUeQIvA== +eslint-module-utils@^2.7.0: + version "2.7.1" + resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.7.1.tgz#b435001c9f8dd4ab7f6d0efcae4b9696d4c24b7c" + integrity sha512-fjoetBXQZq2tSTWZ9yWVl2KuFrTZZH3V+9iD1V1RfpDgxzJR+mPd/KZmMiA8gbPqdBzpNiEHOuT7IYEWxrH0zQ== dependencies: - debug "^2.6.9" + debug "^3.2.7" + find-up "^2.1.0" pkg-dir "^2.0.0" eslint-plugin-eslint-comments@^3.2.0: @@ -3713,38 +4197,46 @@ eslint-plugin-eslint-comments@^3.2.0: escape-string-regexp "^1.0.5" ignore "^5.0.5" -eslint-plugin-eslint-plugin@^2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-eslint-plugin/-/eslint-plugin-eslint-plugin-2.3.0.tgz#1b6ffd13b74da5656e27106b79567b162984fc41" - integrity sha512-xER9XjfTLrAgoUzPguPKoreDGtXt2vUnwqAqdElNrkcSbl5K1rGtSOmhgbiqCb7UN4spnjNhIZplHMNWY6Kz/w== +eslint-plugin-eslint-plugin@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-eslint-plugin/-/eslint-plugin-eslint-plugin-4.0.1.tgz#9624f4d8aca75ab52aa5efff9d99889b318b6a06" + integrity sha512-ey21uE/uOanYAWakWNeFDXF4MEySczTyhdxbKYs5SCTa89MH5Z/TOZ/ui8OqSsAC+QR49iKNuh5kvVSoZhdc7Q== + dependencies: + eslint-utils "^3.0.0" + estraverse "^5.2.0" -eslint-plugin-import@^2.22.0: - version "2.22.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.22.1.tgz#0896c7e6a0cf44109a2d97b95903c2bb689d7702" - integrity sha512-8K7JjINHOpH64ozkAhpT3sd+FswIZTfMZTjdx052pnWrgRCVfp8op9tbjpAk3DdUeI/Ba4C8OjdC0r90erHEOw== +eslint-plugin-import@^2.25.2: + version "2.25.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.25.2.tgz#b3b9160efddb702fc1636659e71ba1d10adbe9e9" + integrity sha512-qCwQr9TYfoBHOFcVGKY9C9unq05uOxxdklmBXLVvcwo68y5Hta6/GzCZEMx2zQiu0woKNEER0LE7ZgaOfBU14g== dependencies: - array-includes "^3.1.1" - array.prototype.flat "^1.2.3" - contains-path "^0.1.0" + array-includes "^3.1.4" + array.prototype.flat "^1.2.5" debug "^2.6.9" - doctrine "1.5.0" - eslint-import-resolver-node "^0.3.4" - eslint-module-utils "^2.6.0" + doctrine "^2.1.0" + eslint-import-resolver-node "^0.3.6" + eslint-module-utils "^2.7.0" has "^1.0.3" + is-core-module "^2.7.0" + is-glob "^4.0.3" minimatch "^3.0.4" - object.values "^1.1.1" - read-pkg-up "^2.0.0" - resolve "^1.17.0" - tsconfig-paths "^3.9.0" + object.values "^1.1.5" + resolve "^1.20.0" + tsconfig-paths "^3.11.0" -eslint-plugin-jest@^24.1.3: - version "24.1.5" - resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-24.1.5.tgz#1e866a9f0deac587d0a3d5d7cefe99815a580de2" - integrity sha512-FIP3lwC8EzEG+rOs1y96cOJmMVpdFNreoDJv29B5vIupVssRi8zrSY3QadogT0K3h1Y8TMxJ6ZSAzYUmFCp2hg== +eslint-plugin-jest@^25.0.5: + version "25.2.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-25.2.2.tgz#aada85113268e79d4e7423f8ad4e1b740f112e71" + integrity sha512-frn5yhOF60U4kcqozO3zKTNZQUk+mfx037XOy2iiYL8FhorEkuCuL3/flzKcY1ECDP2WYT9ydmvlO3fRW9o4mg== dependencies: - "@typescript-eslint/experimental-utils" "^4.0.1" + "@typescript-eslint/experimental-utils" "^5.0.0" + +eslint-plugin-simple-import-sort@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-7.0.0.tgz#a1dad262f46d2184a90095a60c66fef74727f0f8" + integrity sha512-U3vEDB5zhYPNfxT5TYR7u01dboFZp+HNpnGhkDB2g/2E4wZ/g1Q9Ton8UwCLfRV9yAKyYqDh62oHOamvkFxsvw== -eslint-scope@^5.0.0, eslint-scope@^5.1.1: +eslint-scope@^5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c" integrity sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw== @@ -3752,46 +4244,69 @@ eslint-scope@^5.0.0, eslint-scope@^5.1.1: esrecurse "^4.3.0" estraverse "^4.1.1" -eslint-utils@^2.0.0, eslint-utils@^2.1.0: +eslint-scope@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-6.0.0.tgz#9cf45b13c5ac8f3d4c50f46a5121f61b3e318978" + integrity sha512-uRDL9MWmQCkaFus8RF5K9/L/2fn+80yoW3jkD53l4shjCh26fCtvJGasxjUqP5OT87SYTxCVA3BwTUzuELx9kA== + dependencies: + esrecurse "^4.3.0" + estraverse "^5.2.0" + +eslint-utils@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-2.1.0.tgz#d2de5e03424e707dc10c74068ddedae708741b27" integrity sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg== dependencies: eslint-visitor-keys "^1.1.0" +eslint-utils@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-3.0.0.tgz#8aebaface7345bb33559db0a1f13a1d2d48c3672" + integrity sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA== + dependencies: + eslint-visitor-keys "^2.0.0" + eslint-visitor-keys@^1.1.0, eslint-visitor-keys@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz#30ebd1ef7c2fdff01c3a4f151044af25fab0523e" integrity sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ== eslint-visitor-keys@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz#21fdc8fbcd9c795cc0321f0563702095751511a8" - integrity sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ== + 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@^7.20.0: - version "7.20.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.20.0.tgz#db07c4ca4eda2e2316e7aa57ac7fc91ec550bdc7" - integrity sha512-qGi0CTcOGP2OtCQBgWZlQjcTuP0XkIpYFj25XtRTQSHC+umNnp7UMshr2G8SLsRFYDdAPFeHOsiteadmMH02Yw== +eslint-visitor-keys@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.0.0.tgz#e32e99c6cdc2eb063f204eda5db67bfe58bb4186" + integrity sha512-mJOZa35trBTb3IyRmo8xmKBZlxf+N7OnUl4+ZhJHs/r+0770Wh/LEACE2pqMGMe27G/4y8P2bYGk4J70IC5k1Q== + +eslint@7.32.0: + version "7.32.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.32.0.tgz#c6d328a14be3fb08c8d1d21e12c02fdb7a2a812d" + integrity sha512-VHZ8gX+EDfz+97jGcgyGCyRia/dPOd6Xh9yPv8Bl1+SoaIwD+a/vlrOmGRUyOYu7MwUhc7CxqeaDZU13S4+EpA== dependencies: "@babel/code-frame" "7.12.11" - "@eslint/eslintrc" "^0.3.0" + "@eslint/eslintrc" "^0.4.3" + "@humanwhocodes/config-array" "^0.5.0" ajv "^6.10.0" chalk "^4.0.0" cross-spawn "^7.0.2" debug "^4.0.1" doctrine "^3.0.0" enquirer "^2.3.5" + escape-string-regexp "^4.0.0" eslint-scope "^5.1.1" eslint-utils "^2.1.0" eslint-visitor-keys "^2.0.0" espree "^7.3.1" esquery "^1.4.0" esutils "^2.0.2" - file-entry-cache "^6.0.0" + fast-deep-equal "^3.1.3" + file-entry-cache "^6.0.1" functional-red-black-tree "^1.0.1" - glob-parent "^5.0.0" - globals "^12.1.0" + glob-parent "^5.1.2" + globals "^13.6.0" ignore "^4.0.6" import-fresh "^3.0.0" imurmurhash "^0.1.4" @@ -3799,7 +4314,7 @@ eslint@^7.20.0: js-yaml "^3.13.1" json-stable-stringify-without-jsonify "^1.0.1" levn "^0.4.1" - lodash "^4.17.20" + lodash.merge "^4.6.2" minimatch "^3.0.4" natural-compare "^1.4.0" optionator "^0.9.1" @@ -3808,7 +4323,51 @@ eslint@^7.20.0: semver "^7.2.1" strip-ansi "^6.0.0" strip-json-comments "^3.1.0" - table "^6.0.4" + table "^6.0.9" + text-table "^0.2.0" + v8-compile-cache "^2.0.3" + +eslint@^8.1.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.1.0.tgz#00f1f7dbf4134f26588e6c9f2efe970760f64664" + integrity sha512-JZvNneArGSUsluHWJ8g8MMs3CfIEzwaLx9KyH4tZ2i+R2/rPWzL8c0zg3rHdwYVpN/1sB9gqnjHwz9HoeJpGHw== + dependencies: + "@eslint/eslintrc" "^1.0.3" + "@humanwhocodes/config-array" "^0.6.0" + ajv "^6.10.0" + chalk "^4.0.0" + cross-spawn "^7.0.2" + debug "^4.3.2" + doctrine "^3.0.0" + enquirer "^2.3.5" + escape-string-regexp "^4.0.0" + eslint-scope "^6.0.0" + eslint-utils "^3.0.0" + eslint-visitor-keys "^3.0.0" + espree "^9.0.0" + esquery "^1.4.0" + esutils "^2.0.2" + fast-deep-equal "^3.1.3" + file-entry-cache "^6.0.1" + functional-red-black-tree "^1.0.1" + glob-parent "^6.0.1" + globals "^13.6.0" + ignore "^4.0.6" + import-fresh "^3.0.0" + imurmurhash "^0.1.4" + is-glob "^4.0.0" + js-yaml "^4.1.0" + json-stable-stringify-without-jsonify "^1.0.1" + levn "^0.4.1" + lodash.merge "^4.6.2" + minimatch "^3.0.4" + natural-compare "^1.4.0" + optionator "^0.9.1" + progress "^2.0.0" + regexpp "^3.2.0" + semver "^7.2.1" + strip-ansi "^6.0.0" + strip-json-comments "^3.1.0" text-table "^0.2.0" v8-compile-cache "^2.0.3" @@ -3821,6 +4380,15 @@ espree@^7.3.0, espree@^7.3.1: acorn-jsx "^5.3.1" eslint-visitor-keys "^1.3.0" +espree@^9.0.0: + version "9.0.0" + resolved "https://registry.yarnpkg.com/espree/-/espree-9.0.0.tgz#e90a2965698228502e771c7a58489b1a9d107090" + integrity sha512-r5EQJcYZ2oaGbeR0jR0fFVijGOcwai07/690YRXLINuhmVeRY4UKSAsQPe/0BNuDgwP7Ophoc1PRsr2E3tkbdQ== + dependencies: + acorn "^8.5.0" + acorn-jsx "^5.3.1" + eslint-visitor-keys "^3.0.0" + esprima@^4.0.0, esprima@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" @@ -3840,7 +4408,7 @@ esrecurse@^4.3.0: dependencies: estraverse "^5.2.0" -estraverse@^4.1.1, estraverse@^4.2.0: +estraverse@^4.1.1: version "4.3.0" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== @@ -3860,11 +4428,6 @@ eventemitter3@^3.1.0: resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-3.1.2.tgz#2d3d48f9c346698fce83a85d7d664e98535df6e7" integrity sha512-tvtQIeLVHjDkJYnzf2dgVMxfuSGJeM/7UCG17TT4EumTfNtF+0nebF/4zWOIkCreAbtNqhGEboB6BWrwqNaw4Q== -exec-sh@^0.3.2: - version "0.3.4" - resolved "https://registry.yarnpkg.com/exec-sh/-/exec-sh-0.3.4.tgz#3a018ceb526cc6f6df2bb504b2bfe8e3a4934ec5" - integrity sha512-sEFIkc61v75sWeOe72qyrqg2Qg0OuLESziUDk/O/z2qgS15y2gWVFrI6f2Qn/qw/0/NCfCEsmNA4zOjkwEZT1A== - execa@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/execa/-/execa-1.0.0.tgz#c6236a5bb4df6d6f15e88e7f017798216749ddd8" @@ -3878,19 +4441,19 @@ execa@^1.0.0: signal-exit "^3.0.0" strip-eof "^1.0.0" -execa@^4.0.0, execa@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/execa/-/execa-4.1.0.tgz#4e5491ad1572f2f17a77d388c6c857135b22847a" - integrity sha512-j5W0//W7f8UxAn8hXVnwG8tLwdiUy4FJLcSupCg6maBYZDpyBvTApK7KyuI4bKj8KOh1r2YH+6ucuYtJv1bTZA== +execa@^5.0.0, execa@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/execa/-/execa-5.1.1.tgz#f80ad9cbf4298f7bd1d4c9555c21e93741c411dd" + integrity sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg== dependencies: - cross-spawn "^7.0.0" - get-stream "^5.0.0" - human-signals "^1.1.1" + cross-spawn "^7.0.3" + get-stream "^6.0.0" + human-signals "^2.1.0" is-stream "^2.0.0" merge-stream "^2.0.0" - npm-run-path "^4.0.0" - onetime "^5.1.0" - signal-exit "^3.0.2" + npm-run-path "^4.0.1" + onetime "^5.1.2" + signal-exit "^3.0.3" strip-final-newline "^2.0.0" exit@^0.1.2: @@ -3918,17 +4481,17 @@ expand-tilde@^2.0.0, expand-tilde@^2.0.2: dependencies: homedir-polyfill "^1.0.1" -expect@^26.6.2: - version "26.6.2" - resolved "https://registry.yarnpkg.com/expect/-/expect-26.6.2.tgz#c6b996bf26bf3fe18b67b2d0f51fc981ba934417" - integrity sha512-9/hlOBkQl2l/PLHJx6JjoDF6xPKcJEsUlWKb23rKE7KzeDqUZKXKNMW27KIue5JMdBV9HgmoJPcc8HtO85t9IA== +expect@^27.3.1: + version "27.3.1" + resolved "https://registry.yarnpkg.com/expect/-/expect-27.3.1.tgz#d0f170b1f5c8a2009bab0beffd4bb94f043e38e7" + integrity sha512-MrNXV2sL9iDRebWPGOGFdPQRl2eDQNu/uhxIMShjjx74T6kC6jFIkmQ6OqXDtevjGUkyB2IT56RzDBqXf/QPCg== dependencies: - "@jest/types" "^26.6.2" - ansi-styles "^4.0.0" - jest-get-type "^26.3.0" - jest-matcher-utils "^26.6.2" - jest-message-util "^26.6.2" - jest-regex-util "^26.0.0" + "@jest/types" "^27.2.5" + ansi-styles "^5.0.0" + jest-get-type "^27.3.1" + jest-matcher-utils "^27.3.1" + jest-message-util "^27.3.1" + jest-regex-util "^27.0.6" extend-shallow@^2.0.1: version "2.0.1" @@ -3983,7 +4546,7 @@ extsprintf@^1.2.0: resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f" integrity sha1-4mifjzVvrWLMplo6kcXfX5VRaS8= -fast-deep-equal@^3.1.1: +fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: version "3.1.3" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== @@ -4001,18 +4564,17 @@ fast-glob@^2.2.6: micromatch "^3.1.10" fast-glob@^3.1.1: - version "3.2.4" - resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.4.tgz#d20aefbf99579383e7f3cc66529158c9b98554d3" - integrity sha512-kr/Oo6PX51265qeuCYsyGypiO5uJFgBS0jksyG7FUeCyQzNwYnzrNIMR1NXfkZXsMYXYLRAHgISHBz8gQcxKHQ== + version "3.2.7" + resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.7.tgz#fd6cb7a2d7e9aa7a7846111e85a196d6b2f766a1" + integrity sha512-rYGMRwip6lUMvYD3BTScMwT1HtAs2d71SMv66Vrxs0IekGZEjhM0pcMfjQPnknBt2zeCwQMEupiN02ZP4DiT1Q== dependencies: "@nodelib/fs.stat" "^2.0.2" "@nodelib/fs.walk" "^1.2.3" - glob-parent "^5.1.0" + glob-parent "^5.1.2" merge2 "^1.3.0" - micromatch "^4.0.2" - picomatch "^2.2.1" + micromatch "^4.0.4" -fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.0.0: +fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.0.0, fast-json-stable-stringify@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== @@ -4023,9 +4585,9 @@ fast-levenshtein@^2.0.6, fast-levenshtein@~2.0.6: integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= fastq@^1.6.0: - version "1.8.0" - resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.8.0.tgz#550e1f9f59bbc65fe185cb6a9b4d95357107f481" - integrity sha512-SMIZoZdLh/fgofivvIkmknUXyPnvxRE3DhtZ5Me3Mrsk5gyPL42F0xr51TdRXskBxHfMp+07bcYzfsYEsSQA9Q== + version "1.13.0" + resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.13.0.tgz#616760f88a7526bdfc596b7cab8c18938c36b98c" + integrity sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw== dependencies: reusify "^1.0.4" @@ -4036,6 +4598,13 @@ fb-watchman@^2.0.0: dependencies: bser "2.1.1" +fetch-blob@^3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/fetch-blob/-/fetch-blob-3.1.2.tgz#6bc438675f3851ecea51758ac91f6a1cd1bacabd" + integrity sha512-hunJbvy/6OLjCD0uuhLdp0mMPzP/yd2ssd1t2FCJsaA7wkWhpbp9xfuNVpv7Ll4jFhzp6T4LAupSiV9uOeg0VQ== + dependencies: + web-streams-polyfill "^3.0.3" + figgy-pudding@^3.4.1, figgy-pudding@^3.5.1: version "3.5.2" resolved "https://registry.yarnpkg.com/figgy-pudding/-/figgy-pudding-3.5.2.tgz#b4eee8148abb01dcf1d1ac34367d59e12fa61d6e" @@ -4048,20 +4617,27 @@ figures@^2.0.0: dependencies: escape-string-regexp "^1.0.5" -figures@^3.0.0, figures@^3.2.0: +figures@^3.0.0: version "3.2.0" resolved "https://registry.yarnpkg.com/figures/-/figures-3.2.0.tgz#625c18bd293c604dc4a8ddb2febf0c88341746af" integrity sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg== dependencies: escape-string-regexp "^1.0.5" -file-entry-cache@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.0.tgz#7921a89c391c6d93efec2169ac6bf300c527ea0a" - integrity sha512-fqoO76jZ3ZnYrXLDRxBR1YvOvc0k844kcOg40bgsPrE25LAb/PDqTY+ho64Xh2c8ZXgIKldchCFHczG2UVRcWA== +file-entry-cache@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027" + integrity sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg== dependencies: flat-cache "^3.0.4" +filelist@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/filelist/-/filelist-1.0.2.tgz#80202f21462d4d1c2e214119b1807c1bc0380e5b" + integrity sha512-z7O0IS8Plc39rTCq6i6iHxk43duYOn8uFJiWSewIq0Bww1RNybVHSCjahmcC87ZqAm4OTvFzlzeGu3XAzG1ctQ== + dependencies: + minimatch "^3.0.4" + fill-range@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-4.0.0.tgz#d544811d428f98eb06a63dc402d2403c328c38f7" @@ -4079,13 +4655,18 @@ fill-range@^7.0.1: dependencies: to-regex-range "^5.0.1" -find-node-modules@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/find-node-modules/-/find-node-modules-2.0.0.tgz#5db1fb9e668a3d451db3d618cd167cdd59e41b69" - integrity sha512-8MWIBRgJi/WpjjfVXumjPKCtmQ10B+fjx6zmSA+770GMJirLhWIzg8l763rhjl9xaeaHbnxPNRQKq2mgMhr+aw== +filter-obj@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/filter-obj/-/filter-obj-1.1.0.tgz#9b311112bc6c6127a16e016c6c5d7f19e0805c5b" + integrity sha1-mzERErxsYSehbgFsbF1/GeCAXFs= + +find-node-modules@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/find-node-modules/-/find-node-modules-2.1.2.tgz#57565a3455baf671b835bc6b2134a9b938b9c53c" + integrity sha512-x+3P4mbtRPlSiVE1Qco0Z4YLU8WFiFcuWTf3m75OV9Uzcfs2Bg+O9N+r/K0AnmINBW06KpfqKwYJbFlFq4qNug== dependencies: - findup-sync "^3.0.0" - merge "^1.2.1" + findup-sync "^4.0.0" + merge "^2.1.0" find-root@1.1.0: version "1.1.0" @@ -4130,14 +4711,14 @@ find-up@^5.0.0: locate-path "^6.0.0" path-exists "^4.0.0" -findup-sync@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/findup-sync/-/findup-sync-3.0.0.tgz#17b108f9ee512dfb7a5c7f3c8b27ea9e1a9c08d1" - integrity sha512-YbffarhcicEhOrm4CtrwdKBdCuz576RLdhJDsIfvNtxUuhdRet1qZcsMjqbePtAseKdAnDyM/IyXbu7PRPRLYg== +findup-sync@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/findup-sync/-/findup-sync-4.0.0.tgz#956c9cdde804052b881b428512905c4a5f2cdef0" + integrity sha512-6jvvn/12IC4quLBL1KNokxC7wWTvYncaVUYSoxWw7YykPLuRrnv4qdHcSOywOI5RpkOVGeQRtWM8/q+G6W6qfQ== dependencies: detect-file "^1.0.0" is-glob "^4.0.0" - micromatch "^3.0.4" + micromatch "^4.0.2" resolve-dir "^1.0.1" flat-cache@^3.0.4: @@ -4148,10 +4729,15 @@ flat-cache@^3.0.4: flatted "^3.1.0" rimraf "^3.0.2" +flat@^5.0.2: + version "5.0.2" + resolved "https://registry.yarnpkg.com/flat/-/flat-5.0.2.tgz#8ca6fe332069ffa9d324c327198c598259ceb241" + integrity sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ== + flatted@^3.1.0: - version "3.1.1" - resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.1.1.tgz#c4b489e80096d9df1dfc97c79871aea7c617c469" - integrity sha512-zAoAQiudy+r5SvnSw3KJy5os/oRJYHzrzja/tBDqrZtNhUw8bt6y8OBzMWcjWr+8liV8Eb6yOhw8WZ7VFZ5ZzA== + version "3.2.2" + resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.2.tgz#64bfed5cb68fe3ca78b3eb214ad97b63bedce561" + integrity sha512-JaTY/wtrcSyvXJl4IMFHPKyFur1sE9AUqc0QnhOaJ0CxHtAoIV8pYDzeEfAaNEtGkOfq4gr3LBFmdXW5mOQFnA== flush-write-stream@^1.0.0: version "1.1.1" @@ -4161,6 +4747,11 @@ flush-write-stream@^1.0.0: inherits "^2.0.3" readable-stream "^2.3.6" +follow-redirects@^1.14.0: + version "1.14.4" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.4.tgz#838fdf48a8bbdd79e52ee51fb1c94e3ed98b9379" + integrity sha512-zwGkiSXC1MUJG/qmeIFH2HBJx9u0V46QGUe3YR1fXG8bXQxq7fLj0RjLZQ5nubr9qNJUZrH+xUcwXEoXNpfS+g== + for-in@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" @@ -4171,6 +4762,15 @@ forever-agent@~0.6.1: resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" integrity sha1-+8cfDEGt6zf5bFd60e1C2P2sypE= +form-data@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-3.0.1.tgz#ebd53791b78356a99af9a300d4282c4d5eb9755f" + integrity sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg== + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.8" + mime-types "^2.1.12" + form-data@~2.3.2: version "2.3.3" resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6" @@ -4204,7 +4804,16 @@ fs-extra@8.1.0, fs-extra@^8.1.0: jsonfile "^4.0.0" universalify "^0.1.0" -fs-extra@^9.0.0, fs-extra@^9.1.0: +fs-extra@^10.0.0: + version "10.0.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-10.0.0.tgz#9ff61b655dde53fb34a82df84bb214ce802e17c1" + integrity sha512-C5owb14u9eJwizKGdchcDUQeFtlSHHthBk8pbX9Vc1PFZrLombudjDnNns88aYslCyF6IY5SUw3Roz6xShcEIQ== + dependencies: + graceful-fs "^4.2.0" + jsonfile "^6.0.1" + universalify "^2.0.0" + +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== @@ -4214,13 +4823,29 @@ fs-extra@^9.0.0, fs-extra@^9.1.0: jsonfile "^6.0.1" universalify "^2.0.0" -fs-minipass@^1.2.5: +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== + dependencies: + graceful-fs "^4.1.2" + jsonfile "^4.0.0" + universalify "^0.1.0" + +fs-minipass@^1.2.7: version "1.2.7" resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-1.2.7.tgz#ccff8570841e7fe4265693da88936c55aed7f7c7" integrity sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA== dependencies: minipass "^2.6.0" +fs-minipass@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-2.1.0.tgz#7f5036fdbf12c63c169190cbe4199c852271f9fb" + integrity sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg== + dependencies: + minipass "^3.0.0" + fs-write-stream-atomic@^1.0.8: version "1.0.10" resolved "https://registry.yarnpkg.com/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz#b47df53493ef911df75731e70a9ded0189db40c9" @@ -4236,10 +4861,10 @@ fs.realpath@^1.0.0: resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= -fsevents@^2.1.2: - version "2.1.3" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.1.3.tgz#fb738703ae8d2f9fe900c33836ddebee8b97f23e" - integrity sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ== +fsevents@^2.3.2, 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== function-bind@^1.1.1: version "1.1.1" @@ -4280,11 +4905,20 @@ gensync@^1.0.0-beta.2: resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0" integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg== -get-caller-file@^2.0.1: +get-caller-file@^2.0.1, get-caller-file@^2.0.5: version "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-intrinsic@^1.0.2, get-intrinsic@^1.1.0, get-intrinsic@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.1.1.tgz#15f59f376f855c446963948f0d24cd3637b4abc6" + integrity sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q== + dependencies: + function-bind "^1.1.1" + has "^1.0.3" + has-symbols "^1.0.1" + get-own-enumerable-property-symbols@^3.0.0: version "3.0.2" resolved "https://registry.yarnpkg.com/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-3.0.2.tgz#b5fde77f22cbe35f390b4e089922c50bce6ef664" @@ -4311,16 +4945,16 @@ get-port@^4.2.0: resolved "https://registry.yarnpkg.com/get-port/-/get-port-4.2.0.tgz#e37368b1e863b7629c43c5a323625f95cf24b119" integrity sha512-/b3jarXkH8KJoOMQc3uVGHASwGLPq3gSFJ7tgJm2diza+bydJPTGOibin2steecKeOylE8oY2JERlVWkAJO6yw== -get-stdin@8.0.0, get-stdin@^8.0.0, get-stdin@~8.0.0: - version "8.0.0" - resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-8.0.0.tgz#cbad6a73feb75f6eeb22ba9e01f89aa28aa97a53" - integrity sha512-sY22aA6xchAzprjyqmSEQv4UbAAzRN0L2dQB0NlN5acTTK9Don6nhoc3eAbUnpZiCANAMfd/+40kVdKfFygohg== - get-stdin@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-4.0.1.tgz#b968c6b0a04384324902e8bf1a5df32579a450fe" integrity sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4= +get-stdin@^8.0.0, get-stdin@~8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-8.0.0.tgz#cbad6a73feb75f6eeb22ba9e01f89aa28aa97a53" + integrity sha512-sY22aA6xchAzprjyqmSEQv4UbAAzRN0L2dQB0NlN5acTTK9Don6nhoc3eAbUnpZiCANAMfd/+40kVdKfFygohg== + get-stream@^4.0.0, get-stream@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-4.1.0.tgz#c1b255575f3dc21d59bfc79cd3d2b46b1c3a54b5" @@ -4328,12 +4962,18 @@ get-stream@^4.0.0, get-stream@^4.1.0: dependencies: pump "^3.0.0" -get-stream@^5.0.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-5.2.0.tgz#4966a1795ee5ace65e706c4b7beb71257d6e22d3" - integrity sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA== +get-stream@^6.0.0: + version "6.0.1" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7" + integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg== + +get-symbol-description@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/get-symbol-description/-/get-symbol-description-1.0.0.tgz#7fdb81c900101fbd564dd5f1a30af5aadc1e58d6" + integrity sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw== dependencies: - pump "^3.0.0" + call-bind "^1.0.2" + get-intrinsic "^1.1.1" get-value@^2.0.3, get-value@^2.0.6: version "2.0.6" @@ -4359,15 +4999,15 @@ git-raw-commits@2.0.0: through2 "^2.0.0" git-raw-commits@^2.0.0: - version "2.0.7" - resolved "https://registry.yarnpkg.com/git-raw-commits/-/git-raw-commits-2.0.7.tgz#02e9357727a9755efa8e14dd5e59b381c29068fb" - integrity sha512-SkwrTqrDxw8y0G1uGJ9Zw13F7qu3LF8V4BifyDeiJCxSnjRGZD9SaoMiMqUvvXMXh6S3sOQ1DsBN7L2fMUZW/g== + 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== dependencies: dargs "^7.0.0" - lodash.template "^4.0.2" - meow "^7.0.0" - split2 "^2.0.0" - through2 "^3.0.0" + lodash "^4.17.15" + meow "^8.0.0" + split2 "^3.0.0" + through2 "^4.0.0" git-remote-origin-url@^2.0.0: version "2.0.0" @@ -4386,17 +5026,17 @@ git-semver-tags@^2.0.3: semver "^6.0.0" git-up@^4.0.0: - version "4.0.2" - resolved "https://registry.yarnpkg.com/git-up/-/git-up-4.0.2.tgz#10c3d731051b366dc19d3df454bfca3f77913a7c" - integrity sha512-kbuvus1dWQB2sSW4cbfTeGpCMd8ge9jx9RKnhXhuJ7tnvT+NIrTVfYZxjtflZddQYcmdOTlkAcjmx7bor+15AQ== + version "4.0.5" + resolved "https://registry.yarnpkg.com/git-up/-/git-up-4.0.5.tgz#e7bb70981a37ea2fb8fe049669800a1f9a01d759" + integrity sha512-YUvVDg/vX3d0syBsk/CKUTib0srcQME0JyHkL5BaYdwLsiCslPWmDSi8PUMo9pXYjrryMcmsCoCgsTpSCJEQaA== dependencies: is-ssh "^1.3.0" - parse-url "^5.0.0" + parse-url "^6.0.0" git-url-parse@^11.1.2: - version "11.1.3" - resolved "https://registry.yarnpkg.com/git-url-parse/-/git-url-parse-11.1.3.tgz#03625b6fc09905e9ad1da7bb2b84be1bf9123143" - integrity sha512-GPsfwticcu52WQ+eHp0IYkAyaOASgYdtsQDIt4rUp6GbiNt1P9ddrh3O0kQB0eD4UJZszVqNT3+9Zwcg40fywA== + version "11.6.0" + resolved "https://registry.yarnpkg.com/git-url-parse/-/git-url-parse-11.6.0.tgz#c634b8de7faa66498a2b88932df31702c67df605" + integrity sha512-WWUxvJs5HsyHL6L08wOusa/IXYtMuCAhrMmnTjQPpBU0TTHyDhnOATNH3xNQz7YOQUsqIIPTGr4xiVti1Hsk5g== dependencies: git-up "^4.0.0" @@ -4415,22 +5055,29 @@ glob-parent@^3.1.0: is-glob "^3.1.0" path-dirname "^1.0.0" -glob-parent@^5.0.0, glob-parent@^5.1.0: - version "5.1.1" - resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.1.tgz#b6c1ef417c4e5663ea498f1c45afac6916bbc229" - integrity sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ== +glob-parent@^5.0.0, glob-parent@^5.1.2, 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== dependencies: is-glob "^4.0.1" +glob-parent@^6.0.1: + version "6.0.2" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-6.0.2.tgz#6d237d99083950c79290f24c7642a3de9a28f9e3" + integrity sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A== + dependencies: + is-glob "^4.0.3" + glob-to-regexp@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz#8c5a1494d2066c570cc3bfe4496175acc4d502ab" integrity sha1-jFoUlNIGbFcMw7/kSWF1rMTVAqs= -glob@*, glob@^7.0.0, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6, glob@~7.1.6: - version "7.1.6" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" - integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== +glob@*, glob@^7.0.0, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.7, glob@^7.2.0, glob@~7.2.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.0.tgz#d15535af7732e02e948f4c41628bd910293f6023" + integrity sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q== dependencies: fs.realpath "^1.0.0" inflight "^1.0.4" @@ -4483,17 +5130,17 @@ globals@^11.1.0: resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== -globals@^12.1.0: - version "12.4.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-12.4.0.tgz#a18813576a41b00a24a97e7f815918c2e19925f8" - integrity sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg== +globals@^13.6.0, globals@^13.9.0: + version "13.11.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-13.11.0.tgz#40ef678da117fe7bd2e28f1fab24951bd0255be7" + integrity sha512-08/xrJ7wQjK9kkkRoI3OFUBbLx4f+6x3SGwcPvQ0QH6goFDrOU2oyAWrmh3dJezu65buo+HBMzAMQy6rovVC3g== dependencies: - type-fest "^0.8.1" + type-fest "^0.20.2" -globby@^11.0.1: - version "11.0.2" - resolved "https://registry.yarnpkg.com/globby/-/globby-11.0.2.tgz#1af538b766a3b540ebfb58a32b2e2d5897321d83" - integrity sha512-2ZThXDvvV8fYFRVIxnrMQBipZQDr7MxKAmQK1vujaj9/7eF0efG7BPUKJ7jP7G5SLF37xKDXvO4S/KKLj/Z0og== +globby@^11.0.1, globby@^11.0.4: + version "11.0.4" + resolved "https://registry.yarnpkg.com/globby/-/globby-11.0.4.tgz#2cbaff77c2f2a62e71e9b2813a67b97a3a3001a5" + integrity sha512-9O4MVG9ioZJ08ffbcyVYyLOJLk5JQ688pJ4eMGLpdWLHq/Wr1D9BlriLQyL0E+jbkuePVZXYFj47QM/v093wHg== dependencies: array-union "^2.1.0" dir-glob "^3.0.1" @@ -4517,19 +5164,14 @@ globby@^9.2.0: slash "^2.0.0" 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.2, graceful-fs@^4.2.4: - version "4.2.4" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.4.tgz#2256bde14d3632958c465ebc96dc467ca07a29fb" - integrity sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw== - -growly@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081" - integrity sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE= + version "4.2.8" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.8.tgz#e412b8d33f5e006593cbd3cee6df9f2cebbe802a" + integrity sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg== handlebars@^4.7.6: - version "4.7.6" - resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.7.6.tgz#d4c05c1baf90e9945f77aa68a7a219aa4a7df74e" - integrity sha512-1f2BACcBfiwAfStCKZNrUCgqNZkGsAT7UM3kkYtXuLo0KnaVfjKOyf7PRzB6++aK9STyT1Pd2ZCPe3EGOXleXA== + 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== dependencies: minimist "^1.2.5" neo-async "^2.6.0" @@ -4556,6 +5198,16 @@ hard-rejection@^2.1.0: resolved "https://registry.yarnpkg.com/hard-rejection/-/hard-rejection-2.1.0.tgz#1c6eda5c1685c63942766d79bb40ae773cecd883" integrity sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA== +harmony-reflect@^1.4.6: + version "1.6.2" + resolved "https://registry.yarnpkg.com/harmony-reflect/-/harmony-reflect-1.6.2.tgz#31ecbd32e648a34d030d86adb67d4d47547fe710" + integrity sha512-HIp/n38R9kQjDEziXyDTuW3vvoxxyxjxFzXLrBr18uB47GnSt+G9D29fqrpM5ZkspMcPICud3XsBJQ4Y2URg8g== + +has-bigints@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/has-bigints/-/has-bigints-1.0.1.tgz#64fe6acb020673e3b78db035a5af69aa9d07b113" + integrity sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA== + has-flag@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" @@ -4571,10 +5223,17 @@ has-own-prop@^2.0.0: resolved "https://registry.yarnpkg.com/has-own-prop/-/has-own-prop-2.0.0.tgz#f0f95d58f65804f5d218db32563bb85b8e0417af" integrity sha512-Pq0h+hvsVm6dDEa8x82GnLSYHOzNDt7f0ddFa3FqcQlgzEiptPqL+XrOJNavjOzSYiYWIrgeVYYgGlLmnxwilQ== -has-symbols@^1.0.0, has-symbols@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.1.tgz#9f5214758a44196c406d9bd76cebf81ec2dd31e8" - integrity sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg== +has-symbols@^1.0.1, has-symbols@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.2.tgz#165d3070c00309752a1236a479331e3ac56f1423" + integrity sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw== + +has-tostringtag@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-tostringtag/-/has-tostringtag-1.0.0.tgz#7e133818a7d394734f941e73c3d3f9291e658b25" + integrity sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ== + dependencies: + has-symbols "^1.0.2" has-unicode@^2.0.0, has-unicode@^2.0.1: version "2.0.1" @@ -4627,9 +5286,16 @@ homedir-polyfill@^1.0.1: parse-passwd "^1.0.0" hosted-git-info@^2.1.4, hosted-git-info@^2.7.1: - version "2.8.8" - resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.8.tgz#7539bd4bc1e0e0a895815a2e0262420b12858488" - integrity sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg== + version "2.8.9" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.9.tgz#dffc0bf9a21c02209090f2aa69429e1414daf3f9" + integrity sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw== + +hosted-git-info@^4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-4.0.2.tgz#5e425507eede4fea846b7262f0838456c4209961" + integrity sha512-c9OGXbZ3guC/xOlCg1Ci/VgWlwsqDv1yMQL1CWqXDL0hDjXuNcq0zuR4xqPSuasI3kqFDhqSyTjREz5gzq0fXg== + dependencies: + lru-cache "^6.0.0" html-encoding-sniffer@^2.0.1: version "2.0.1" @@ -4656,6 +5322,15 @@ http-proxy-agent@^2.1.0: agent-base "4" debug "3.1.0" +http-proxy-agent@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz#8a8c8ef7f5932ccf953c296ca8291b95aa74aa3a" + integrity sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg== + dependencies: + "@tootallnate/once" "1" + agent-base "6" + debug "4" + http-signature@~1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1" @@ -4673,10 +5348,18 @@ https-proxy-agent@^2.2.3: agent-base "^4.3.0" debug "^3.1.0" -human-signals@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-1.1.1.tgz#c5b1cd14f50aeae09ab6c59fe63ba3395fe4dfa3" - integrity sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw== +https-proxy-agent@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz#e2a90542abb68a762e0a0850f6c9edadfd8506b2" + integrity sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA== + dependencies: + agent-base "6" + debug "4" + +human-signals@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0" + integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw== humanize-ms@^1.2.1: version "1.2.1" @@ -4685,10 +5368,10 @@ humanize-ms@^1.2.1: dependencies: ms "^2.0.0" -husky@^5.0.9: - version "5.1.1" - resolved "https://registry.yarnpkg.com/husky/-/husky-5.1.1.tgz#8678953fd8deb86f387cbf1ad50bb2f7f96e83f2" - integrity sha512-80LZ736V0Nr4/st0c2COYaMbEQhHNmAbLMN8J/kLk7/mo0QdUkUGNDjv/7jVkhug377Wh8wfbWyaVXEJ/h2B/Q== +husky@^7.0.4: + version "7.0.4" + resolved "https://registry.yarnpkg.com/husky/-/husky-7.0.4.tgz#242048245dc49c8fb1bf0cc7cfb98dd722531535" + integrity sha512-vbaCKN2QLtP/vD4yvs6iz6hBEo6wkSzs8HpRah1Z6aGmF2KW5PdYuAd7uX5a+OyBZHBhd+TFLqgjUgytQr4RvQ== iconv-lite@0.4.24, iconv-lite@^0.4.24: version "0.4.24" @@ -4698,21 +5381,28 @@ iconv-lite@0.4.24, iconv-lite@^0.4.24: safer-buffer ">= 2.1.2 < 3" iconv-lite@^0.6.2: - version "0.6.2" - resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.6.2.tgz#ce13d1875b0c3a674bd6a04b7f76b01b1b6ded01" - integrity sha512-2y91h5OpQlolefMPmUlivelittSWy0rP+oYVpn6A7GwVHNE8AWzoYOBNmlwks3LobaJxgHCYZAnyNo2GgpNRNQ== + version "0.6.3" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.6.3.tgz#a52f80bf38da1952eb5c681790719871a1a72501" + integrity sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw== dependencies: safer-buffer ">= 2.1.2 < 3.0.0" +identity-obj-proxy@3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/identity-obj-proxy/-/identity-obj-proxy-3.0.0.tgz#94d2bda96084453ef36fbc5aaec37e0f79f1fc14" + integrity sha1-lNK9qWCERT7zb7xarsN+D3nx/BQ= + dependencies: + harmony-reflect "^1.4.6" + iferr@^0.1.5: version "0.1.5" resolved "https://registry.yarnpkg.com/iferr/-/iferr-0.1.5.tgz#c60eed69e6d8fdb6b3104a1fcbca1c192dc5b501" integrity sha1-xg7taebY/bazEEofy8ocGS3FtQE= ignore-walk@^3.0.1: - version "3.0.3" - resolved "https://registry.yarnpkg.com/ignore-walk/-/ignore-walk-3.0.3.tgz#017e2447184bfeade7c238e4aefdd1e8f95b1e37" - integrity sha512-m7o6xuOaT1aqheYHKf8W6J5pYH85ZI9w077erOzLje3JsB1gkafkAhHHY19dqjulgIZHFm32Cp5uNZgcQqdJKw== + version "3.0.4" + resolved "https://registry.yarnpkg.com/ignore-walk/-/ignore-walk-3.0.4.tgz#c9a09f69b7c7b479a5d74ac1a3c0d4236d2a6335" + integrity sha512-PY6Ii8o1jMRA1z4F2hRkH/xN59ox43DavKvD3oDpfurRlOJyAHpifIwpbdv1n4jt4ov0jSpw3kQ4GhJnpBL6WQ== dependencies: minimatch "^3.0.4" @@ -4721,7 +5411,7 @@ ignore@^4.0.3, ignore@^4.0.6: resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg== -ignore@^5.0.5, ignore@^5.1.4, ignore@~5.1.8: +ignore@^5.0.4, ignore@^5.0.5, ignore@^5.1.4, ignore@^5.1.8, ignore@~5.1.8: version "5.1.8" resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.8.tgz#f150a8b50a34289b33e22f5889abd4d8016f0e57" integrity sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw== @@ -4734,20 +5424,23 @@ import-fresh@^2.0.0: caller-path "^2.0.0" resolve-from "^3.0.0" -import-fresh@^3.0.0, import-fresh@^3.2.1: - version "3.2.1" - resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.2.1.tgz#633ff618506e793af5ac91bf48b72677e15cbe66" - integrity sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ== +import-fresh@^3.0.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== dependencies: parent-module "^1.0.0" resolve-from "^4.0.0" -import-from@3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/import-from/-/import-from-3.0.0.tgz#055cfec38cd5a27d8057ca51376d7d3bf0891966" - integrity sha512-CiuXOFFSzkU5x/CR0+z7T91Iht4CXgfCxVOFRhh2Zyhg5wOpWvvDLQUsWl+gcN+QscYBjez8hDCt85O7RLDttQ== - dependencies: - resolve-from "^5.0.0" +import-from@4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/import-from/-/import-from-4.0.0.tgz#2710b8d66817d232e16f4166e319248d3d5492e2" + integrity sha512-P9J71vT5nLlDeV8FHs5nNxaLbrpfAV5cF5srvbZfpwpcJoM/xZR3hiv+q+SAnuSmuGbXMWud063iIMx/V/EWZQ== + +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@^2.0.0: version "2.0.0" @@ -4758,9 +5451,9 @@ import-local@^2.0.0: resolve-cwd "^2.0.0" import-local@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/import-local/-/import-local-3.0.2.tgz#a8cfd0431d1de4a2199703d003e3e62364fa6db6" - integrity sha512-vjL3+w0oulAVZ0hBHnxa/Nm5TAurf9YLQJDhqRZyqb+VKGOB6LU8t9H1Nr5CIo16vh9XfJTOoHwU0B71S557gA== + version "3.0.3" + resolved "https://registry.yarnpkg.com/import-local/-/import-local-3.0.3.tgz#4d51c2c495ca9393da259ec66b62e022920211e0" + integrity sha512-bE9iaUY3CXH8Cwfan/abDKAxe1KGT9kyGsBPqf6DMK/z0a2OzAsrukeYNgIH6cH5Xr452jb1TUL8rSfCLjZ9uA== dependencies: pkg-dir "^4.2.0" resolve-cwd "^3.0.0" @@ -4805,11 +5498,16 @@ inherits@2, inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.3: resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== -ini@^1.3.2, ini@^1.3.4, ini@~1.3.0: +ini@^1.3.2, ini@^1.3.4: version "1.3.8" resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.8.tgz#a29da425b48806f34767a4efce397269af28432c" integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew== +ini@~2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ini/-/ini-2.0.0.tgz#e5fd556ecdd5726be978fa1001862eacb0a94bc5" + integrity sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA== + init-package-json@^1.10.3: version "1.10.3" resolved "https://registry.yarnpkg.com/init-package-json/-/init-package-json-1.10.3.tgz#45ffe2f610a8ca134f2bd1db5637b235070f6cbe" @@ -4862,16 +5560,20 @@ inquirer@^7.0.4: strip-ansi "^6.0.0" through "^2.3.6" +internal-slot@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/internal-slot/-/internal-slot-1.0.3.tgz#7347e307deeea2faac2ac6205d4bc7d34967f59c" + integrity sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA== + dependencies: + get-intrinsic "^1.1.0" + has "^1.0.3" + side-channel "^1.0.4" + interpret@^1.0.0: version "1.4.0" resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.4.0.tgz#665ab8bc4da27a774a40584e812e3e0fa45b1a1e" integrity sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA== -ip-regex@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/ip-regex/-/ip-regex-2.1.0.tgz#fa78bf5d2e6913c911ce9f819ee5146bb6d844e9" - integrity sha1-+ni/XS5pE8kRzp+BnuUUa7bYROk= - ip@1.1.5: version "1.1.5" resolved "https://registry.yarnpkg.com/ip/-/ip-1.1.5.tgz#bdded70114290828c0a039e72ef25f5aaec4354a" @@ -4896,15 +5598,37 @@ is-arrayish@^0.2.1: resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" integrity sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0= +is-bigint@^1.0.1: + version "1.0.4" + resolved "https://registry.yarnpkg.com/is-bigint/-/is-bigint-1.0.4.tgz#08147a1875bc2b32005d41ccd8291dffc6691df3" + integrity sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg== + dependencies: + has-bigints "^1.0.1" + +is-binary-path@~2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09" + integrity sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw== + dependencies: + binary-extensions "^2.0.0" + +is-boolean-object@^1.1.0: + version "1.1.2" + resolved "https://registry.yarnpkg.com/is-boolean-object/-/is-boolean-object-1.1.2.tgz#5c6dc200246dd9321ae4b885a114bb1f75f63719" + integrity sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA== + dependencies: + call-bind "^1.0.2" + has-tostringtag "^1.0.0" + is-buffer@^1.1.5: version "1.1.6" resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== -is-callable@^1.1.4, is-callable@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.0.tgz#83336560b54a38e35e3a2df7afd0454d691468bb" - integrity sha512-pyVD9AaGLxtg6srb2Ng6ynWJqkHU9bEM087AKck0w8QwDarTfNcpIYoU8x8Hv2Icm8u6kFJM18Dag8lyqGkviw== +is-callable@^1.1.4, is-callable@^1.2.4: + version "1.2.4" + resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.4.tgz#47301d58dd0259407865547853df6d61fe471945" + integrity sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w== is-ci@^2.0.0: version "2.0.0" @@ -4913,10 +5637,17 @@ is-ci@^2.0.0: dependencies: ci-info "^2.0.0" -is-core-module@^2.1.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.2.0.tgz#97037ef3d52224d85163f5597b2b63d9afed981a" - integrity sha512-XRAfAdyyY5F5cOXn7hYQDqh2Xmii+DEfIcQGxK/uNwMHhIkPWO0g8msXcbzLe+MpGoR951MlqM/2iIlU4vKDdQ== +is-ci@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-3.0.0.tgz#c7e7be3c9d8eef7d0fa144390bd1e4b88dc4c994" + integrity sha512-kDXyttuLeslKAHYL/K28F2YkM3x5jvFPEw3yXbRptXydjD9rpLEz+C5K5iutY9ZiUu6AP41JdvRQwF4Iqs4ZCQ== + dependencies: + ci-info "^3.1.1" + +is-core-module@^2.1.0, is-core-module@^2.2.0, is-core-module@^2.5.0, is-core-module@^2.7.0: + version "2.7.0" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.7.0.tgz#3c0ef7d31b4acfc574f80c58409d568a836848e3" + integrity sha512-ByY+tjCciCr+9nLryBYcSD50EOGWt95c7tIsKTG1J2ixKKXPvF7Ej3AVd+UfDydAJom3biBGDBALaO79ktwgEQ== dependencies: has "^1.0.3" @@ -4935,9 +5666,11 @@ is-data-descriptor@^1.0.0: kind-of "^6.0.0" is-date-object@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.2.tgz#bda736f2cd8fd06d32844e7743bfa7494c3bfd7e" - integrity sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g== + version "1.0.5" + resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.5.tgz#0841d5536e724c25597bf6ea62e1bd38298df31f" + integrity sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ== + dependencies: + has-tostringtag "^1.0.0" is-descriptor@^0.1.0: version "0.1.6" @@ -4963,9 +5696,9 @@ is-directory@^0.3.1: integrity sha1-YTObbyR1/Hcv2cnYP1yFddwVSuE= is-docker@^2.0.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/is-docker/-/is-docker-2.1.1.tgz#4125a88e44e450d384e09047ede71adc2d144156" - integrity sha512-ZOoqiXfEwtGknTiuDEy8pN2CfE3TxMHprvNer1mXiqwkOT77Rw3YVrUQ52EqAOU3QAWDQ+bQdx7HJzrv7LS2Hw== + version "2.2.1" + resolved "https://registry.yarnpkg.com/is-docker/-/is-docker-2.2.1.tgz#33eeabe23cfe86f14bde4408a02c0cfb853acdaa" + integrity sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ== is-extendable@^0.1.0, is-extendable@^0.1.1: version "0.1.1" @@ -5018,13 +5751,25 @@ is-glob@^3.1.0: dependencies: is-extglob "^2.1.0" -is-glob@^4.0.0, is-glob@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.1.tgz#7567dbe9f2f5e2467bc77ab83c4a29482407a5dc" - integrity sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg== +is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3, is-glob@~4.0.1: + version "4.0.3" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" + integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== dependencies: is-extglob "^2.1.1" +is-negative-zero@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/is-negative-zero/-/is-negative-zero-2.0.1.tgz#3de746c18dda2319241a53675908d8f766f11c24" + integrity sha512-2z6JzQvZRa9A2Y7xC6dQQm4FSTSTNWjKIYYTt4246eMTJmIo0Q+ZyOsU66X8lxK1AbB92dFeglPLrhwpeRKO6w== + +is-number-object@^1.0.4: + version "1.0.6" + resolved "https://registry.yarnpkg.com/is-number-object/-/is-number-object-1.0.6.tgz#6a7aaf838c7f0686a50b4553f7e54a96494e89f0" + integrity sha512-bEVOqiRcvo3zO1+G2lVMy+gkkEm9Yh7cDMRusKKu5ZJKPUYSJwICTKZrNKHA2EbSP0Tu0+6B/emsYNHZyn6K8g== + dependencies: + has-tostringtag "^1.0.0" + is-number@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" @@ -5059,32 +5804,38 @@ is-plain-object@^2.0.3, is-plain-object@^2.0.4: dependencies: isobject "^3.0.1" -is-plain-object@^4.0.0: - version "4.1.1" - resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-4.1.1.tgz#1a14d6452cbd50790edc7fdaa0aed5a40a35ebb5" - integrity sha512-5Aw8LLVsDlZsETVMhoMXzqsXwQqr/0vlnBYzIXJbYo2F4yYlhLHs+Ez7Bod7IIQKWkJbJfxrWD7pA1Dw1TKrwA== +is-plain-object@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-5.0.0.tgz#4427f50ab3429e9025ea7d52e9043a9ef4159344" + integrity sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q== -is-potential-custom-element-name@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.0.tgz#0c52e54bcca391bb2c494b21e8626d7336c6e397" - integrity sha1-DFLlS8yjkbssSUsh6GJtczbG45c= +is-potential-custom-element-name@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz#171ed6f19e3ac554394edf78caa05784a45bebb5" + integrity sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ== -is-regex@^1.1.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.1.1.tgz#c6f98aacc546f6cec5468a07b7b153ab564a57b9" - integrity sha512-1+QkEcxiLlB7VEyFtyBg94e08OAsvq7FUBgApTq/w2ymCLyKJgDPsybBENVtA7XCQEgEXxKPonG+mvYRxh/LIg== +is-regex@^1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.1.4.tgz#eef5663cd59fa4c0ae339505323df6854bb15958" + integrity sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg== dependencies: - has-symbols "^1.0.1" + call-bind "^1.0.2" + has-tostringtag "^1.0.0" is-regexp@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-regexp/-/is-regexp-1.0.0.tgz#fd2d883545c46bac5a633e7b9a09e87fa2cb5069" integrity sha1-/S2INUXEa6xaYz57mgnof6LLUGk= +is-shared-array-buffer@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-shared-array-buffer/-/is-shared-array-buffer-1.0.1.tgz#97b0c85fbdacb59c9c446fe653b82cf2b5b7cfe6" + integrity sha512-IU0NmyknYZN0rChcKhRO1X8LYz5Isj/Fsqh8NJOSf+N/hCOTwy29F32Ik7a+QszE63IdvmwdTPDd6cZ5pg4cwA== + is-ssh@^1.3.0: - version "1.3.2" - resolved "https://registry.yarnpkg.com/is-ssh/-/is-ssh-1.3.2.tgz#a4b82ab63d73976fd8263cceee27f99a88bdae2b" - integrity sha512-elEw0/0c2UscLrNG+OAorbP539E3rhliKPg+hDMWN9VwrDXfYK+4PBEykDPfxlYYtQvl84TascnQyobfQLHEhQ== + version "1.3.3" + resolved "https://registry.yarnpkg.com/is-ssh/-/is-ssh-1.3.3.tgz#7f133285ccd7f2c2c7fc897b771b53d95a2b2c7e" + integrity sha512-NKzJmQzJfEEma3w5cJNcUMxoXfDjz0Zj0eyCalHn2E6VOwlzjZo0yuO2fcBSf8zhFuVCL/82/r5gRcoi6aEPVQ== dependencies: protocols "^1.1.0" @@ -5094,21 +5845,23 @@ is-stream@^1.1.0: integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ= is-stream@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.0.tgz#bde9c32680d6fae04129d6ac9d921ce7815f78e3" - integrity sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw== + version "2.0.1" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077" + integrity sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg== -is-string@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.5.tgz#40493ed198ef3ff477b8c7f92f644ec82a5cd3a6" - integrity sha512-buY6VNRjhQMiF1qWDouloZlQbRhDPCebwxSjxMjxgemYT46YMd2NR0/H+fBhEfWX4A/w9TBJ+ol+okqJKFE6vQ== +is-string@^1.0.5, is-string@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.7.tgz#0dd12bf2006f255bb58f695110eff7491eebc0fd" + integrity sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg== + dependencies: + has-tostringtag "^1.0.0" -is-symbol@^1.0.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.3.tgz#38e1014b9e6329be0de9d24a414fd7441ec61937" - integrity sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ== +is-symbol@^1.0.2, is-symbol@^1.0.3: + version "1.0.4" + resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.4.tgz#a6dac93b635b063ca6872236de88910a57af139c" + integrity sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg== dependencies: - has-symbols "^1.0.1" + has-symbols "^1.0.2" is-text-path@^1.0.1: version "1.0.1" @@ -5127,19 +5880,26 @@ is-utf8@^0.2.0, is-utf8@^0.2.1: resolved "https://registry.yarnpkg.com/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72" integrity sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI= +is-weakref@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-weakref/-/is-weakref-1.0.1.tgz#842dba4ec17fa9ac9850df2d6efbc1737274f2a2" + integrity sha512-b2jKc2pQZjaeFYWEf7ScFj+Be1I+PXmlu572Q8coTXZ+LD/QQZ7ShPMst8h16riVgyXTQwUsFEl74mDvc/3MHQ== + dependencies: + call-bind "^1.0.0" + is-windows@^1.0.0, is-windows@^1.0.1, is-windows@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" integrity sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA== -is-wsl@^2.2.0: +is-wsl@^2.1.1: version "2.2.0" resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-2.2.0.tgz#74a4c76e77ca9fd3f932f290c17ea326cd157271" integrity sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww== dependencies: is-docker "^2.0.0" -isarray@1.0.0, isarray@^1.0.0, isarray@~1.0.0: +isarray@1.0.0, isarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= @@ -5161,23 +5921,15 @@ isobject@^3.0.0, isobject@^3.0.1: resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8= -isomorphic-fetch@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/isomorphic-fetch/-/isomorphic-fetch-3.0.0.tgz#0267b005049046d2421207215d45d6a262b8b8b4" - integrity sha512-qvUtwJ3j6qwsF3jLxkZ72qCgjMysPzDfeV240JHiGZsANBYd+EEuu35v7dfrJ9Up0Ak07D7GGSkGhCHTqg/5wA== - dependencies: - node-fetch "^2.6.1" - whatwg-fetch "^3.4.1" - isstream@~0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" integrity sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo= istanbul-lib-coverage@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-3.0.0.tgz#f5944a37c70b550b02a78a5c3b2055b280cec8ec" - integrity sha512-UiUIqxMgRDET6eR+o5HbfRYP1l0hqkWOs7vNxC/mggutCMUIhWMm8gAHb8tHlyfD3/l6rlgNA5cKdDzEAf6hEg== + version "3.0.2" + resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-3.0.2.tgz#36786d4d82aad2ea5911007e255e2da6b5f80d86" + integrity sha512-o5+eTUYzCJ11/+JhW5/FUCdfsdoYVdQ/8I/OveE2XsjehYn5DdeSnNQAbjYaO8gQ6hvGTN6GM6ddQqpTVG5j8g== istanbul-lib-instrument@^4.0.0, istanbul-lib-instrument@^4.0.3: version "4.0.3" @@ -5199,221 +5951,279 @@ istanbul-lib-report@^3.0.0: supports-color "^7.1.0" istanbul-lib-source-maps@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.0.tgz#75743ce6d96bb86dc7ee4352cf6366a23f0b1ad9" - integrity sha512-c16LpFRkR8vQXyHZ5nLpY35JZtzj1PQY1iZmesUbf1FZHbIupcWfjgOXBY9YHkLEQ6puz1u4Dgj6qmU/DisrZg== + version "4.0.1" + resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz#895f3a709fcfba34c6de5a42939022f3e4358551" + integrity sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw== dependencies: debug "^4.1.1" istanbul-lib-coverage "^3.0.0" source-map "^0.6.1" istanbul-reports@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-3.0.2.tgz#d593210e5000683750cb09fc0644e4b6e27fd53b" - integrity sha512-9tZvz7AiR3PEDNGiV9vIouQ/EAcqMXFmkcA1CDFTwOB98OZVDL0PH9glHotf5Ugp6GCOTypfzGWI/OqjWNCRUw== + version "3.0.5" + resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-3.0.5.tgz#a2580107e71279ea6d661ddede929ffc6d693384" + integrity sha512-5+19PlhnGabNWB7kOFnuxT8H3T/iIyQzIbQMxXsURmmvKg86P2sbkrGOT77VnHw0Qr0gc2XzRaRfMZYYbSQCJQ== dependencies: html-escaper "^2.0.0" istanbul-lib-report "^3.0.0" -iterable-to-stream@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/iterable-to-stream/-/iterable-to-stream-1.0.1.tgz#37e86baacf6b1a0e9233dad4eb526d0423d08bf3" - integrity sha512-O62gD5ADMUGtJoOoM9U6LQ7i4byPXUNoHJ6mqsmkQJcom331ZJGDApWgDESWyBMEHEJRjtHozgIiTzYo9RU4UA== - -jest-changed-files@^26.6.2: - version "26.6.2" - resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-26.6.2.tgz#f6198479e1cc66f22f9ae1e22acaa0b429c042d0" - integrity sha512-fDS7szLcY9sCtIip8Fjry9oGf3I2ht/QT21bAHm5Dmf0mD4X3ReNUf17y+bO6fR8WgbIZTlbyG1ak/53cbRzKQ== - dependencies: - "@jest/types" "^26.6.2" - execa "^4.0.0" - throat "^5.0.0" - -jest-cli@^26.6.3: - version "26.6.3" - resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-26.6.3.tgz#43117cfef24bc4cd691a174a8796a532e135e92a" - integrity sha512-GF9noBSa9t08pSyl3CY4frMrqp+aQXFGFkf5hEPbh/pIUFYWMK6ZLTfbmadxJVcJrdRoChlWQsA2VkJcDFK8hg== - dependencies: - "@jest/core" "^26.6.3" - "@jest/test-result" "^26.6.2" - "@jest/types" "^26.6.2" +jake@^10.6.1: + version "10.8.2" + resolved "https://registry.yarnpkg.com/jake/-/jake-10.8.2.tgz#ebc9de8558160a66d82d0eadc6a2e58fbc500a7b" + integrity sha512-eLpKyrfG3mzvGE2Du8VoPbeSkRry093+tyNjdYaBbJS9v17knImYGNXQCUV0gLxQtF82m3E8iRb/wdSQZLoq7A== + dependencies: + async "0.9.x" + chalk "^2.4.2" + filelist "^1.0.1" + minimatch "^3.0.4" + +jest-changed-files@^27.3.0: + version "27.3.0" + resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-27.3.0.tgz#22a02cc2b34583fc66e443171dc271c0529d263c" + integrity sha512-9DJs9garMHv4RhylUMZgbdCJ3+jHSkpL9aaVKp13xtXAD80qLTLrqcDZL1PHA9dYA0bCI86Nv2BhkLpLhrBcPg== + dependencies: + "@jest/types" "^27.2.5" + execa "^5.0.0" + throat "^6.0.1" + +jest-circus@^27.2.2, jest-circus@^27.3.1: + version "27.3.1" + resolved "https://registry.yarnpkg.com/jest-circus/-/jest-circus-27.3.1.tgz#1679e74387cbbf0c6a8b42de963250a6469e0797" + integrity sha512-v1dsM9II6gvXokgqq6Yh2jHCpfg7ZqV4jWY66u7npz24JnhP3NHxI0sKT7+ZMQ7IrOWHYAaeEllOySbDbWsiXw== + dependencies: + "@jest/environment" "^27.3.1" + "@jest/test-result" "^27.3.1" + "@jest/types" "^27.2.5" + "@types/node" "*" + chalk "^4.0.0" + co "^4.6.0" + dedent "^0.7.0" + expect "^27.3.1" + is-generator-fn "^2.0.0" + jest-each "^27.3.1" + jest-matcher-utils "^27.3.1" + jest-message-util "^27.3.1" + jest-runtime "^27.3.1" + jest-snapshot "^27.3.1" + jest-util "^27.3.1" + pretty-format "^27.3.1" + slash "^3.0.0" + stack-utils "^2.0.3" + throat "^6.0.1" + +jest-cli@^27.3.1: + version "27.3.1" + resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-27.3.1.tgz#b576f9d146ba6643ce0a162d782b40152b6b1d16" + integrity sha512-WHnCqpfK+6EvT62me6WVs8NhtbjAS4/6vZJnk7/2+oOr50cwAzG4Wxt6RXX0hu6m1169ZGMlhYYUNeKBXCph/Q== + dependencies: + "@jest/core" "^27.3.1" + "@jest/test-result" "^27.3.1" + "@jest/types" "^27.2.5" chalk "^4.0.0" exit "^0.1.2" graceful-fs "^4.2.4" import-local "^3.0.2" - is-ci "^2.0.0" - jest-config "^26.6.3" - jest-util "^26.6.2" - jest-validate "^26.6.2" + jest-config "^27.3.1" + jest-util "^27.3.1" + jest-validate "^27.3.1" prompts "^2.0.1" - yargs "^15.4.1" + yargs "^16.2.0" -jest-config@^26.6.3: - version "26.6.3" - resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-26.6.3.tgz#64f41444eef9eb03dc51d5c53b75c8c71f645349" - integrity sha512-t5qdIj/bCj2j7NFVHb2nFB4aUdfucDn3JRKgrZnplb8nieAirAzRSHP8uDEd+qV6ygzg9Pz4YG7UTJf94LPSyg== +jest-config@27.2.2: + version "27.2.2" + resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-27.2.2.tgz#970d8466c60ac106ac9d7d0b8dcf3ff150fa713a" + integrity sha512-2nhms3lp52ZpU0636bB6zIFHjDVtYxzFQIOHZjBFUeXcb6b41sEkWojbHaJ4FEIO44UbccTLa7tvNpiFCgPE7w== dependencies: "@babel/core" "^7.1.0" - "@jest/test-sequencer" "^26.6.3" - "@jest/types" "^26.6.2" - babel-jest "^26.6.3" + "@jest/test-sequencer" "^27.2.2" + "@jest/types" "^27.1.1" + babel-jest "^27.2.2" chalk "^4.0.0" deepmerge "^4.2.2" glob "^7.1.1" graceful-fs "^4.2.4" - jest-environment-jsdom "^26.6.2" - jest-environment-node "^26.6.2" - jest-get-type "^26.3.0" - jest-jasmine2 "^26.6.3" - jest-regex-util "^26.0.0" - jest-resolve "^26.6.2" - jest-util "^26.6.2" - jest-validate "^26.6.2" - micromatch "^4.0.2" - pretty-format "^26.6.2" - -jest-diff@^26.0.0, jest-diff@^26.6.2: - version "26.6.2" - resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-26.6.2.tgz#1aa7468b52c3a68d7d5c5fdcdfcd5e49bd164394" - integrity sha512-6m+9Z3Gv9wN0WFVasqjCL/06+EFCMTqDEUl/b87HYK2rAPTyfz4ZIuSlPhY51PIQRWx5TaxeF1qmXKe9gfN3sA== + is-ci "^3.0.0" + jest-circus "^27.2.2" + jest-environment-jsdom "^27.2.2" + jest-environment-node "^27.2.2" + jest-get-type "^27.0.6" + jest-jasmine2 "^27.2.2" + jest-regex-util "^27.0.6" + jest-resolve "^27.2.2" + jest-runner "^27.2.2" + jest-util "^27.2.0" + jest-validate "^27.2.2" + micromatch "^4.0.4" + pretty-format "^27.2.2" + +jest-config@^27.3.1: + version "27.3.1" + resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-27.3.1.tgz#cb3b7f6aaa8c0a7daad4f2b9573899ca7e09bbad" + integrity sha512-KY8xOIbIACZ/vdYCKSopL44I0xboxC751IX+DXL2+Wx6DKNycyEfV3rryC3BPm5Uq/BBqDoMrKuqLEUNJmMKKg== + dependencies: + "@babel/core" "^7.1.0" + "@jest/test-sequencer" "^27.3.1" + "@jest/types" "^27.2.5" + babel-jest "^27.3.1" + chalk "^4.0.0" + ci-info "^3.2.0" + deepmerge "^4.2.2" + glob "^7.1.1" + graceful-fs "^4.2.4" + jest-circus "^27.3.1" + jest-environment-jsdom "^27.3.1" + jest-environment-node "^27.3.1" + jest-get-type "^27.3.1" + jest-jasmine2 "^27.3.1" + jest-regex-util "^27.0.6" + jest-resolve "^27.3.1" + jest-runner "^27.3.1" + jest-util "^27.3.1" + jest-validate "^27.3.1" + micromatch "^4.0.4" + pretty-format "^27.3.1" + +jest-diff@^27.0.0, jest-diff@^27.3.1: + version "27.3.1" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-27.3.1.tgz#d2775fea15411f5f5aeda2a5e02c2f36440f6d55" + integrity sha512-PCeuAH4AWUo2O5+ksW4pL9v5xJAcIKPUPfIhZBcG1RKv/0+dvaWTQK1Nrau8d67dp65fOqbeMdoil+6PedyEPQ== dependencies: chalk "^4.0.0" - diff-sequences "^26.6.2" - jest-get-type "^26.3.0" - pretty-format "^26.6.2" + diff-sequences "^27.0.6" + jest-get-type "^27.3.1" + pretty-format "^27.3.1" -jest-docblock@^26.0.0: - version "26.0.0" - resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-26.0.0.tgz#3e2fa20899fc928cb13bd0ff68bd3711a36889b5" - integrity sha512-RDZ4Iz3QbtRWycd8bUEPxQsTlYazfYn/h5R65Fc6gOfwozFhoImx+affzky/FFBuqISPTqjXomoIGJVKBWoo0w== +jest-docblock@^27.0.6: + version "27.0.6" + resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-27.0.6.tgz#cc78266acf7fe693ca462cbbda0ea4e639e4e5f3" + integrity sha512-Fid6dPcjwepTFraz0YxIMCi7dejjJ/KL9FBjPYhBp4Sv1Y9PdhImlKZqYU555BlN4TQKaTc+F2Av1z+anVyGkA== dependencies: detect-newline "^3.0.0" -jest-each@^26.6.2: - version "26.6.2" - resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-26.6.2.tgz#02526438a77a67401c8a6382dfe5999952c167cb" - integrity sha512-Mer/f0KaATbjl8MCJ+0GEpNdqmnVmDYqCTJYTvoo7rqmRiDllmp2AYN+06F93nXcY3ur9ShIjS+CO/uD+BbH4A== +jest-each@^27.3.1: + version "27.3.1" + resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-27.3.1.tgz#14c56bb4f18dd18dc6bdd853919b5f16a17761ff" + integrity sha512-E4SwfzKJWYcvOYCjOxhZcxwL+AY0uFMvdCOwvzgutJiaiodFjkxQQDxHm8FQBeTqDnSmKsQWn7ldMRzTn2zJaQ== dependencies: - "@jest/types" "^26.6.2" + "@jest/types" "^27.2.5" chalk "^4.0.0" - jest-get-type "^26.3.0" - jest-util "^26.6.2" - pretty-format "^26.6.2" - -jest-environment-jsdom@^26.6.2: - version "26.6.2" - resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-26.6.2.tgz#78d09fe9cf019a357009b9b7e1f101d23bd1da3e" - integrity sha512-jgPqCruTlt3Kwqg5/WVFyHIOJHsiAvhcp2qiR2QQstuG9yWox5+iHpU3ZrcBxW14T4fe5Z68jAfLRh7joCSP2Q== - dependencies: - "@jest/environment" "^26.6.2" - "@jest/fake-timers" "^26.6.2" - "@jest/types" "^26.6.2" + jest-get-type "^27.3.1" + jest-util "^27.3.1" + pretty-format "^27.3.1" + +jest-environment-jsdom@^27.2.2, jest-environment-jsdom@^27.3.1: + version "27.3.1" + resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-27.3.1.tgz#63ac36d68f7a9303494df783494856222b57f73e" + integrity sha512-3MOy8qMzIkQlfb3W1TfrD7uZHj+xx8Olix5vMENkj5djPmRqndMaXtpnaZkxmxM+Qc3lo+yVzJjzuXbCcZjAlg== + dependencies: + "@jest/environment" "^27.3.1" + "@jest/fake-timers" "^27.3.1" + "@jest/types" "^27.2.5" "@types/node" "*" - jest-mock "^26.6.2" - jest-util "^26.6.2" - jsdom "^16.4.0" - -jest-environment-node@^26.6.2: - version "26.6.2" - resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-26.6.2.tgz#824e4c7fb4944646356f11ac75b229b0035f2b0c" - integrity sha512-zhtMio3Exty18dy8ee8eJ9kjnRyZC1N4C1Nt/VShN1apyXc8rWGtJ9lI7vqiWcyyXS4BVSEn9lxAM2D+07/Tag== - dependencies: - "@jest/environment" "^26.6.2" - "@jest/fake-timers" "^26.6.2" - "@jest/types" "^26.6.2" + jest-mock "^27.3.0" + jest-util "^27.3.1" + jsdom "^16.6.0" + +jest-environment-node@^27.2.2, jest-environment-node@^27.3.1: + version "27.3.1" + resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-27.3.1.tgz#af7d0eed04edafb740311b303f3fe7c8c27014bb" + integrity sha512-T89F/FgkE8waqrTSA7/ydMkcc52uYPgZZ6q8OaZgyiZkJb5QNNCF6oPZjH9IfPFfcc9uBWh1574N0kY0pSvTXw== + dependencies: + "@jest/environment" "^27.3.1" + "@jest/fake-timers" "^27.3.1" + "@jest/types" "^27.2.5" "@types/node" "*" - jest-mock "^26.6.2" - jest-util "^26.6.2" + jest-mock "^27.3.0" + jest-util "^27.3.1" -jest-get-type@^26.3.0: - version "26.3.0" - resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-26.3.0.tgz#e97dc3c3f53c2b406ca7afaed4493b1d099199e0" - integrity sha512-TpfaviN1R2pQWkIihlfEanwOXK0zcxrKEE4MlU6Tn7keoXdN6/3gK/xl0yEh8DOunn5pOVGKf8hB4R9gVh04ig== +jest-get-type@^27.0.6, jest-get-type@^27.3.1: + version "27.3.1" + resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-27.3.1.tgz#a8a2b0a12b50169773099eee60a0e6dd11423eff" + integrity sha512-+Ilqi8hgHSAdhlQ3s12CAVNd8H96ZkQBfYoXmArzZnOfAtVAJEiPDBirjByEblvG/4LPJmkL+nBqPO3A1YJAEg== -jest-haste-map@^26.6.2: - version "26.6.2" - resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-26.6.2.tgz#dd7e60fe7dc0e9f911a23d79c5ff7fb5c2cafeaa" - integrity sha512-easWIJXIw71B2RdR8kgqpjQrbMRWQBgiBwXYEhtGUTaX+doCjBheluShdDMeR8IMfJiTqH4+zfhtg29apJf/8w== +jest-haste-map@^27.2.2, jest-haste-map@^27.3.1: + version "27.3.1" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-27.3.1.tgz#7656fbd64bf48bda904e759fc9d93e2c807353ee" + integrity sha512-lYfNZIzwPccDJZIyk9Iz5iQMM/MH56NIIcGj7AFU1YyA4ewWFBl8z+YPJuSCRML/ee2cCt2y3W4K3VXPT6Nhzg== dependencies: - "@jest/types" "^26.6.2" + "@jest/types" "^27.2.5" "@types/graceful-fs" "^4.1.2" "@types/node" "*" anymatch "^3.0.3" fb-watchman "^2.0.0" graceful-fs "^4.2.4" - jest-regex-util "^26.0.0" - jest-serializer "^26.6.2" - jest-util "^26.6.2" - jest-worker "^26.6.2" - micromatch "^4.0.2" - sane "^4.0.3" + jest-regex-util "^27.0.6" + jest-serializer "^27.0.6" + jest-util "^27.3.1" + jest-worker "^27.3.1" + micromatch "^4.0.4" walker "^1.0.7" optionalDependencies: - fsevents "^2.1.2" + fsevents "^2.3.2" -jest-jasmine2@^26.6.3: - version "26.6.3" - resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-26.6.3.tgz#adc3cf915deacb5212c93b9f3547cd12958f2edd" - integrity sha512-kPKUrQtc8aYwBV7CqBg5pu+tmYXlvFlSFYn18ev4gPFtrRzB15N2gW/Roew3187q2w2eHuu0MU9TJz6w0/nPEg== +jest-jasmine2@^27.2.2, jest-jasmine2@^27.3.1: + version "27.3.1" + resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-27.3.1.tgz#df6d3d07c7dafc344feb43a0072a6f09458d32b0" + integrity sha512-WK11ZUetDQaC09w4/j7o4FZDUIp+4iYWH/Lik34Pv7ukL+DuXFGdnmmi7dT58J2ZYKFB5r13GyE0z3NPeyJmsg== dependencies: "@babel/traverse" "^7.1.0" - "@jest/environment" "^26.6.2" - "@jest/source-map" "^26.6.2" - "@jest/test-result" "^26.6.2" - "@jest/types" "^26.6.2" + "@jest/environment" "^27.3.1" + "@jest/source-map" "^27.0.6" + "@jest/test-result" "^27.3.1" + "@jest/types" "^27.2.5" "@types/node" "*" chalk "^4.0.0" co "^4.6.0" - expect "^26.6.2" + expect "^27.3.1" is-generator-fn "^2.0.0" - jest-each "^26.6.2" - jest-matcher-utils "^26.6.2" - jest-message-util "^26.6.2" - jest-runtime "^26.6.3" - jest-snapshot "^26.6.2" - jest-util "^26.6.2" - pretty-format "^26.6.2" - throat "^5.0.0" - -jest-leak-detector@^26.6.2: - version "26.6.2" - resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-26.6.2.tgz#7717cf118b92238f2eba65054c8a0c9c653a91af" - integrity sha512-i4xlXpsVSMeKvg2cEKdfhh0H39qlJlP5Ex1yQxwF9ubahboQYMgTtz5oML35AVA3B4Eu+YsmwaiKVev9KCvLxg== - dependencies: - jest-get-type "^26.3.0" - pretty-format "^26.6.2" - -jest-matcher-utils@^26.6.2: - version "26.6.2" - resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-26.6.2.tgz#8e6fd6e863c8b2d31ac6472eeb237bc595e53e7a" - integrity sha512-llnc8vQgYcNqDrqRDXWwMr9i7rS5XFiCwvh6DTP7Jqa2mqpcCBBlpCbn+trkG0KNhPu/h8rzyBkriOtBstvWhw== + jest-each "^27.3.1" + jest-matcher-utils "^27.3.1" + jest-message-util "^27.3.1" + jest-runtime "^27.3.1" + jest-snapshot "^27.3.1" + jest-util "^27.3.1" + pretty-format "^27.3.1" + throat "^6.0.1" + +jest-leak-detector@^27.3.1: + version "27.3.1" + resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-27.3.1.tgz#7fb632c2992ef707a1e73286e1e704f9cc1772b2" + integrity sha512-78QstU9tXbaHzwlRlKmTpjP9k4Pvre5l0r8Spo4SbFFVy/4Abg9I6ZjHwjg2QyKEAMg020XcjP+UgLZIY50yEg== + dependencies: + jest-get-type "^27.3.1" + pretty-format "^27.3.1" + +jest-matcher-utils@^27.3.1: + version "27.3.1" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-27.3.1.tgz#257ad61e54a6d4044e080d85dbdc4a08811e9c1c" + integrity sha512-hX8N7zXS4k+8bC1Aj0OWpGb7D3gIXxYvPNK1inP5xvE4ztbz3rc4AkI6jGVaerepBnfWB17FL5lWFJT3s7qo8w== dependencies: chalk "^4.0.0" - jest-diff "^26.6.2" - jest-get-type "^26.3.0" - pretty-format "^26.6.2" + jest-diff "^27.3.1" + jest-get-type "^27.3.1" + pretty-format "^27.3.1" -jest-message-util@^26.6.2: - version "26.6.2" - resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-26.6.2.tgz#58173744ad6fc0506b5d21150b9be56ef001ca07" - integrity sha512-rGiLePzQ3AzwUshu2+Rn+UMFk0pHN58sOG+IaJbk5Jxuqo3NYO1U2/MIR4S1sKgsoYSXSzdtSa0TgrmtUwEbmA== +jest-message-util@^27.3.1: + version "27.3.1" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-27.3.1.tgz#f7c25688ad3410ab10bcb862bcfe3152345c6436" + integrity sha512-bh3JEmxsTZ/9rTm0jQrPElbY2+y48Rw2t47uMfByNyUVR+OfPh4anuyKsGqsNkXk/TI4JbLRZx+7p7Hdt6q1yg== dependencies: - "@babel/code-frame" "^7.0.0" - "@jest/types" "^26.6.2" + "@babel/code-frame" "^7.12.13" + "@jest/types" "^27.2.5" "@types/stack-utils" "^2.0.0" chalk "^4.0.0" graceful-fs "^4.2.4" - micromatch "^4.0.2" - pretty-format "^26.6.2" + micromatch "^4.0.4" + pretty-format "^27.3.1" slash "^3.0.0" - stack-utils "^2.0.2" + stack-utils "^2.0.3" -jest-mock@^26.6.2: - version "26.6.2" - resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-26.6.2.tgz#d6cb712b041ed47fe0d9b6fc3474bc6543feb302" - integrity sha512-YyFjePHHp1LzpzYcmgqkJ0nm0gg/lJx2aZFzFy1S6eUqNjXsOqTK10zNRff2dNfssgokjkG65OlWNcIlgd3zew== +jest-mock@^27.3.0: + version "27.3.0" + resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-27.3.0.tgz#ddf0ec3cc3e68c8ccd489bef4d1f525571a1b867" + integrity sha512-ziZiLk0elZOQjD08bLkegBzv5hCABu/c8Ytx45nJKkysQwGaonvmTxwjLqEA4qGdasq9o2I8/HtdGMNnVsMTGw== dependencies: - "@jest/types" "^26.6.2" + "@jest/types" "^27.2.5" "@types/node" "*" jest-pnp-resolver@^1.2.2: @@ -5421,191 +6231,235 @@ jest-pnp-resolver@^1.2.2: resolved "https://registry.yarnpkg.com/jest-pnp-resolver/-/jest-pnp-resolver-1.2.2.tgz#b704ac0ae028a89108a4d040b3f919dfddc8e33c" integrity sha512-olV41bKSMm8BdnuMsewT4jqlZ8+3TCARAXjZGT9jcoSnrfUnRCqnMoF9XEeoWjbzObpqF9dRhHQj0Xb9QdF6/w== -jest-regex-util@^26.0.0: - version "26.0.0" - resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-26.0.0.tgz#d25e7184b36e39fd466c3bc41be0971e821fee28" - integrity sha512-Gv3ZIs/nA48/Zvjrl34bf+oD76JHiGDUxNOVgUjh3j890sblXryjY4rss71fPtD/njchl6PSE2hIhvyWa1eT0A== +jest-regex-util@^27.0.6: + version "27.0.6" + resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-27.0.6.tgz#02e112082935ae949ce5d13b2675db3d8c87d9c5" + integrity sha512-SUhPzBsGa1IKm8hx2F4NfTGGp+r7BXJ4CulsZ1k2kI+mGLG+lxGrs76veN2LF/aUdGosJBzKgXmNCw+BzFqBDQ== -jest-resolve-dependencies@^26.6.3: - version "26.6.3" - resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-26.6.3.tgz#6680859ee5d22ee5dcd961fe4871f59f4c784fb6" - integrity sha512-pVwUjJkxbhe4RY8QEWzN3vns2kqyuldKpxlxJlzEYfKSvY6/bMvxoFrYYzUO1Gx28yKWN37qyV7rIoIp2h8fTg== +jest-resolve-dependencies@^27.3.1: + version "27.3.1" + resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-27.3.1.tgz#85b99bdbdfa46e2c81c6228fc4c91076f624f6e2" + integrity sha512-X7iLzY8pCiYOnvYo2YrK3P9oSE8/3N2f4pUZMJ8IUcZnT81vlSonya1KTO9ZfKGuC+svE6FHK/XOb8SsoRUV1A== dependencies: - "@jest/types" "^26.6.2" - jest-regex-util "^26.0.0" - jest-snapshot "^26.6.2" + "@jest/types" "^27.2.5" + jest-regex-util "^27.0.6" + jest-snapshot "^27.3.1" -jest-resolve@^26.6.2: - version "26.6.2" - resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-26.6.2.tgz#a3ab1517217f469b504f1b56603c5bb541fbb507" - integrity sha512-sOxsZOq25mT1wRsfHcbtkInS+Ek7Q8jCHUB0ZUTP0tc/c41QHriU/NunqMfCUWsL4H3MHpvQD4QR9kSYhS7UvQ== +jest-resolve@27.2.2: + version "27.2.2" + resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-27.2.2.tgz#1bad93dbc6c20edb874e6720e82e4e48900b120b" + integrity sha512-tfbHcBs/hJTb3fPQ/3hLWR+TsLNTzzK98TU+zIAsrL9nNzWfWROwopUOmiSUqmHMZW5t9au/433kSF2/Af+tTw== dependencies: - "@jest/types" "^26.6.2" + "@jest/types" "^27.1.1" chalk "^4.0.0" + escalade "^3.1.1" graceful-fs "^4.2.4" + jest-haste-map "^27.2.2" jest-pnp-resolver "^1.2.2" - jest-util "^26.6.2" - read-pkg-up "^7.0.1" - resolve "^1.18.1" + jest-util "^27.2.0" + jest-validate "^27.2.2" + resolve "^1.20.0" + slash "^3.0.0" + +jest-resolve@^27.2.2, jest-resolve@^27.3.1: + version "27.3.1" + resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-27.3.1.tgz#0e5542172a1aa0270be6f66a65888647bdd74a3e" + integrity sha512-Dfzt25CFSPo3Y3GCbxynRBZzxq9AdyNN+x/v2IqYx6KVT5Z6me2Z/PsSGFSv3cOSUZqJ9pHxilao/I/m9FouLw== + dependencies: + "@jest/types" "^27.2.5" + chalk "^4.0.0" + graceful-fs "^4.2.4" + jest-haste-map "^27.3.1" + jest-pnp-resolver "^1.2.2" + jest-util "^27.3.1" + jest-validate "^27.3.1" + resolve "^1.20.0" + resolve.exports "^1.1.0" slash "^3.0.0" -jest-runner@^26.6.3: - version "26.6.3" - resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-26.6.3.tgz#2d1fed3d46e10f233fd1dbd3bfaa3fe8924be159" - integrity sha512-atgKpRHnaA2OvByG/HpGA4g6CSPS/1LK0jK3gATJAoptC1ojltpmVlYC3TYgdmGp+GLuhzpH30Gvs36szSL2JQ== +jest-runner@^27.2.2, jest-runner@^27.3.1: + version "27.3.1" + resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-27.3.1.tgz#1d594dcbf3bd8600a7e839e790384559eaf96e3e" + integrity sha512-r4W6kBn6sPr3TBwQNmqE94mPlYVn7fLBseeJfo4E2uCTmAyDFm2O5DYAQAFP7Q3YfiA/bMwg8TVsciP7k0xOww== dependencies: - "@jest/console" "^26.6.2" - "@jest/environment" "^26.6.2" - "@jest/test-result" "^26.6.2" - "@jest/types" "^26.6.2" + "@jest/console" "^27.3.1" + "@jest/environment" "^27.3.1" + "@jest/test-result" "^27.3.1" + "@jest/transform" "^27.3.1" + "@jest/types" "^27.2.5" "@types/node" "*" chalk "^4.0.0" - emittery "^0.7.1" + emittery "^0.8.1" exit "^0.1.2" graceful-fs "^4.2.4" - jest-config "^26.6.3" - jest-docblock "^26.0.0" - jest-haste-map "^26.6.2" - jest-leak-detector "^26.6.2" - jest-message-util "^26.6.2" - jest-resolve "^26.6.2" - jest-runtime "^26.6.3" - jest-util "^26.6.2" - jest-worker "^26.6.2" + jest-docblock "^27.0.6" + jest-environment-jsdom "^27.3.1" + jest-environment-node "^27.3.1" + jest-haste-map "^27.3.1" + jest-leak-detector "^27.3.1" + jest-message-util "^27.3.1" + jest-resolve "^27.3.1" + jest-runtime "^27.3.1" + jest-util "^27.3.1" + jest-worker "^27.3.1" source-map-support "^0.5.6" - throat "^5.0.0" - -jest-runtime@^26.6.3: - version "26.6.3" - resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-26.6.3.tgz#4f64efbcfac398331b74b4b3c82d27d401b8fa2b" - integrity sha512-lrzyR3N8sacTAMeonbqpnSka1dHNux2uk0qqDXVkMv2c/A3wYnvQ4EXuI013Y6+gSKSCxdaczvf4HF0mVXHRdw== - dependencies: - "@jest/console" "^26.6.2" - "@jest/environment" "^26.6.2" - "@jest/fake-timers" "^26.6.2" - "@jest/globals" "^26.6.2" - "@jest/source-map" "^26.6.2" - "@jest/test-result" "^26.6.2" - "@jest/transform" "^26.6.2" - "@jest/types" "^26.6.2" - "@types/yargs" "^15.0.0" + throat "^6.0.1" + +jest-runtime@^27.3.1: + version "27.3.1" + resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-27.3.1.tgz#80fa32eb85fe5af575865ddf379874777ee993d7" + integrity sha512-qtO6VxPbS8umqhEDpjA4pqTkKQ1Hy4ZSi9mDVeE9Za7LKBo2LdW2jmT+Iod3XFaJqINikZQsn2wEi0j9wPRbLg== + dependencies: + "@jest/console" "^27.3.1" + "@jest/environment" "^27.3.1" + "@jest/globals" "^27.3.1" + "@jest/source-map" "^27.0.6" + "@jest/test-result" "^27.3.1" + "@jest/transform" "^27.3.1" + "@jest/types" "^27.2.5" + "@types/yargs" "^16.0.0" chalk "^4.0.0" - cjs-module-lexer "^0.6.0" + cjs-module-lexer "^1.0.0" collect-v8-coverage "^1.0.0" + execa "^5.0.0" exit "^0.1.2" glob "^7.1.3" graceful-fs "^4.2.4" - jest-config "^26.6.3" - jest-haste-map "^26.6.2" - jest-message-util "^26.6.2" - jest-mock "^26.6.2" - jest-regex-util "^26.0.0" - jest-resolve "^26.6.2" - jest-snapshot "^26.6.2" - jest-util "^26.6.2" - jest-validate "^26.6.2" + jest-haste-map "^27.3.1" + jest-message-util "^27.3.1" + jest-mock "^27.3.0" + jest-regex-util "^27.0.6" + jest-resolve "^27.3.1" + jest-snapshot "^27.3.1" + jest-util "^27.3.1" + jest-validate "^27.3.1" slash "^3.0.0" strip-bom "^4.0.0" - yargs "^15.4.1" + yargs "^16.2.0" -jest-serializer@^26.6.2: - version "26.6.2" - resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-26.6.2.tgz#d139aafd46957d3a448f3a6cdabe2919ba0742d1" - integrity sha512-S5wqyz0DXnNJPd/xfIzZ5Xnp1HrJWBczg8mMfMpN78OJ5eDxXyf+Ygld9wX1DnUWbIbhM1YDY95NjR4CBXkb2g== +jest-serializer@^27.0.6: + version "27.0.6" + resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-27.0.6.tgz#93a6c74e0132b81a2d54623251c46c498bb5bec1" + integrity sha512-PtGdVK9EGC7dsaziskfqaAPib6wTViY3G8E5wz9tLVPhHyiDNTZn/xjZ4khAw+09QkoOVpn7vF5nPSN6dtBexA== dependencies: "@types/node" "*" graceful-fs "^4.2.4" -jest-snapshot@^26.3.0, jest-snapshot@^26.6.2: - version "26.6.2" - resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-26.6.2.tgz#f3b0af1acb223316850bd14e1beea9837fb39c84" - integrity sha512-OLhxz05EzUtsAmOMzuupt1lHYXCNib0ECyuZ/PZOx9TrZcC8vL0x+DUG3TL+GLX3yHG45e6YGjIm0XwDc3q3og== +jest-snapshot@^27.0.2, jest-snapshot@^27.3.1: + version "27.3.1" + resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-27.3.1.tgz#1da5c0712a252d70917d46c037054f5918c49ee4" + integrity sha512-APZyBvSgQgOT0XumwfFu7X3G5elj6TGhCBLbBdn3R1IzYustPGPE38F51dBWMQ8hRXa9je0vAdeVDtqHLvB6lg== dependencies: + "@babel/core" "^7.7.2" + "@babel/generator" "^7.7.2" + "@babel/parser" "^7.7.2" + "@babel/plugin-syntax-typescript" "^7.7.2" + "@babel/traverse" "^7.7.2" "@babel/types" "^7.0.0" - "@jest/types" "^26.6.2" + "@jest/transform" "^27.3.1" + "@jest/types" "^27.2.5" "@types/babel__traverse" "^7.0.4" - "@types/prettier" "^2.0.0" + "@types/prettier" "^2.1.5" + babel-preset-current-node-syntax "^1.0.0" chalk "^4.0.0" - expect "^26.6.2" + expect "^27.3.1" graceful-fs "^4.2.4" - jest-diff "^26.6.2" - jest-get-type "^26.3.0" - jest-haste-map "^26.6.2" - jest-matcher-utils "^26.6.2" - jest-message-util "^26.6.2" - jest-resolve "^26.6.2" + jest-diff "^27.3.1" + jest-get-type "^27.3.1" + jest-haste-map "^27.3.1" + jest-matcher-utils "^27.3.1" + jest-message-util "^27.3.1" + jest-resolve "^27.3.1" + jest-util "^27.3.1" natural-compare "^1.4.0" - pretty-format "^26.6.2" + pretty-format "^27.3.1" semver "^7.3.2" -jest-specific-snapshot@*, jest-specific-snapshot@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/jest-specific-snapshot/-/jest-specific-snapshot-4.0.0.tgz#a52a2e223e7576e610dbeaf341207c557ac20554" - integrity sha512-YdW5P/MVwOizWR0MJwURxdrjdXvdG2MMpXKVGr7dZ2YrBmE6E6Ab74UL3DOYmGmzaCnNAW1CL02pY5MTHE3ulQ== +jest-specific-snapshot@*, jest-specific-snapshot@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/jest-specific-snapshot/-/jest-specific-snapshot-5.0.0.tgz#48f72d5613af7f3e30df75b6b3534db6bab32ea0" + integrity sha512-V65vuPxZQExD3tGbv+Du5tbG1E3H3Dq/HFbsCEkPJP27w5vr/nATQJl61Dx5doBfu54OrJak0JaeYVSeZubDKg== dependencies: - jest-snapshot "^26.3.0" + jest-snapshot "^27.0.2" -jest-util@^26.1.0, jest-util@^26.6.2: - version "26.6.2" - resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-26.6.2.tgz#907535dbe4d5a6cb4c47ac9b926f6af29576cbc1" - integrity sha512-MDW0fKfsn0OI7MS7Euz6h8HNDXVQ0gaM9uW6RjfDmd1DAFcaxX9OqIakHIqhbnmF08Cf2DLDG+ulq8YQQ0Lp0Q== +jest-util@27.2.0: + version "27.2.0" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-27.2.0.tgz#bfccb85cfafae752257319e825a5b8d4ada470dc" + integrity sha512-T5ZJCNeFpqcLBpx+Hl9r9KoxBCUqeWlJ1Htli+vryigZVJ1vuLB9j35grEBASp4R13KFkV7jM52bBGnArpJN6A== dependencies: - "@jest/types" "^26.6.2" + "@jest/types" "^27.1.1" "@types/node" "*" chalk "^4.0.0" graceful-fs "^4.2.4" - is-ci "^2.0.0" - micromatch "^4.0.2" + is-ci "^3.0.0" + picomatch "^2.2.3" + +jest-util@^27.0.0, jest-util@^27.2.0, jest-util@^27.3.1: + version "27.3.1" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-27.3.1.tgz#a58cdc7b6c8a560caac9ed6bdfc4e4ff23f80429" + integrity sha512-8fg+ifEH3GDryLQf/eKZck1DEs2YuVPBCMOaHQxVVLmQwl/CDhWzrvChTX4efLZxGrw+AA0mSXv78cyytBt/uw== + dependencies: + "@jest/types" "^27.2.5" + "@types/node" "*" + chalk "^4.0.0" + ci-info "^3.2.0" + graceful-fs "^4.2.4" + picomatch "^2.2.3" -jest-validate@^26.6.2: - version "26.6.2" - resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-26.6.2.tgz#23d380971587150467342911c3d7b4ac57ab20ec" - integrity sha512-NEYZ9Aeyj0i5rQqbq+tpIOom0YS1u2MVu6+euBsvpgIme+FOfRmoC4R5p0JiAUpaFvFy24xgrpMknarR/93XjQ== +jest-validate@^27.2.2, jest-validate@^27.3.1: + version "27.3.1" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-27.3.1.tgz#3a395d61a19cd13ae9054af8cdaf299116ef8a24" + integrity sha512-3H0XCHDFLA9uDII67Bwi1Vy7AqwA5HqEEjyy934lgVhtJ3eisw6ShOF1MDmRPspyikef5MyExvIm0/TuLzZ86Q== dependencies: - "@jest/types" "^26.6.2" - camelcase "^6.0.0" + "@jest/types" "^27.2.5" + camelcase "^6.2.0" chalk "^4.0.0" - jest-get-type "^26.3.0" + jest-get-type "^27.3.1" leven "^3.1.0" - pretty-format "^26.6.2" + pretty-format "^27.3.1" -jest-watcher@^26.6.2: - version "26.6.2" - resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-26.6.2.tgz#a5b683b8f9d68dbcb1d7dae32172d2cca0592975" - integrity sha512-WKJob0P/Em2csiVthsI68p6aGKTIcsfjH9Gsx1f0A3Italz43e3ho0geSAVsmj09RWOELP1AZ/DXyJgOgDKxXQ== +jest-watcher@^27.3.1: + version "27.3.1" + resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-27.3.1.tgz#ba5e0bc6aa843612b54ddb7f009d1cbff7e05f3e" + integrity sha512-9/xbV6chABsGHWh9yPaAGYVVKurWoP3ZMCv6h+O1v9/+pkOroigs6WzZ0e9gLP/njokUwM7yQhr01LKJVMkaZA== dependencies: - "@jest/test-result" "^26.6.2" - "@jest/types" "^26.6.2" + "@jest/test-result" "^27.3.1" + "@jest/types" "^27.2.5" "@types/node" "*" ansi-escapes "^4.2.1" chalk "^4.0.0" - jest-util "^26.6.2" + jest-util "^27.3.1" string-length "^4.0.1" -jest-worker@^26.6.2: - version "26.6.2" - resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-26.6.2.tgz#7f72cbc4d643c365e27b9fd775f9d0eaa9c7a8ed" - integrity sha512-KWYVV1c4i+jbMpaBC+U++4Va0cp8OisU185o73T1vo99hqi7w8tSJfUXYswwqqrjzwxa6KpRK54WhPvwf5w6PQ== +jest-worker@^27.2.2, jest-worker@^27.3.1: + version "27.3.1" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-27.3.1.tgz#0def7feae5b8042be38479799aeb7b5facac24b2" + integrity sha512-ks3WCzsiZaOPJl/oMsDjaf0TRiSv7ctNgs0FqRr2nARsovz6AWWy4oLElwcquGSz692DzgZQrCLScPNs5YlC4g== dependencies: "@types/node" "*" merge-stream "^2.0.0" - supports-color "^7.0.0" + supports-color "^8.0.0" -jest@^26.6.3: - version "26.6.3" - resolved "https://registry.yarnpkg.com/jest/-/jest-26.6.3.tgz#40e8fdbe48f00dfa1f0ce8121ca74b88ac9148ef" - integrity sha512-lGS5PXGAzR4RF7V5+XObhqz2KZIDUA1yD0DG6pBVmy10eh0ZIXQImRuzocsI/N2XZ1GrLFwTS27In2i2jlpq1Q== +jest@^27.3.1: + version "27.3.1" + resolved "https://registry.yarnpkg.com/jest/-/jest-27.3.1.tgz#b5bab64e8f56b6f7e275ba1836898b0d9f1e5c8a" + integrity sha512-U2AX0AgQGd5EzMsiZpYt8HyZ+nSVIh5ujQ9CPp9EQZJMjXIiSZpJNweZl0swatKRoqHWgGKM3zaSwm4Zaz87ng== dependencies: - "@jest/core" "^26.6.3" + "@jest/core" "^27.3.1" import-local "^3.0.2" - jest-cli "^26.6.3" + jest-cli "^27.3.1" + +jju@~1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/jju/-/jju-1.4.0.tgz#a3abe2718af241a2b2904f84a625970f389ae32a" + integrity sha1-o6vicYryQaKykE+EpiWXDzia4yo= 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@^3.13.1, js-yaml@~3.14.1: +js-yaml@^3.13.1, js-yaml@^3.9.0: version "3.14.1" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.1.tgz#dae812fdb3825fa306609a8717383c50c36a0537" integrity sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g== @@ -5613,41 +6467,49 @@ js-yaml@^3.13.1, js-yaml@~3.14.1: argparse "^1.0.7" esprima "^4.0.0" +js-yaml@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" + integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== + dependencies: + argparse "^2.0.1" + jsbn@~0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" integrity sha1-peZUwuWi3rXyAdls77yoDA7y9RM= -jsdom@^16.4.0: - version "16.4.0" - resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-16.4.0.tgz#36005bde2d136f73eee1a830c6d45e55408edddb" - integrity sha512-lYMm3wYdgPhrl7pDcRmvzPhhrGVBeVhPIqeHjzeiHN3DFmD1RBpbExbi8vU7BJdH8VAZYovR8DMt0PNNDM7k8w== +jsdom@^16.6.0: + version "16.7.0" + resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-16.7.0.tgz#918ae71965424b197c819f8183a754e18977b710" + integrity sha512-u9Smc2G1USStM+s/x1ru5Sxrl6mPYCbByG1U/hUmqaVsm4tbNyS7CicOSRyuGQYZhTu0h84qkZZQ/I+dzizSVw== dependencies: - abab "^2.0.3" - acorn "^7.1.1" + abab "^2.0.5" + acorn "^8.2.4" acorn-globals "^6.0.0" cssom "^0.4.4" - cssstyle "^2.2.0" + cssstyle "^2.3.0" data-urls "^2.0.0" - decimal.js "^10.2.0" + decimal.js "^10.2.1" domexception "^2.0.1" - escodegen "^1.14.1" + escodegen "^2.0.0" + form-data "^3.0.0" html-encoding-sniffer "^2.0.1" - is-potential-custom-element-name "^1.0.0" + http-proxy-agent "^4.0.1" + https-proxy-agent "^5.0.0" + is-potential-custom-element-name "^1.0.1" nwsapi "^2.2.0" - parse5 "5.1.1" - request "^2.88.2" - request-promise-native "^1.0.8" - saxes "^5.0.0" + parse5 "6.0.1" + saxes "^5.0.1" symbol-tree "^3.2.4" - tough-cookie "^3.0.1" + tough-cookie "^4.0.0" w3c-hr-time "^1.0.2" w3c-xmlserializer "^2.0.0" webidl-conversions "^6.1.0" whatwg-encoding "^1.0.5" whatwg-mimetype "^2.3.0" - whatwg-url "^8.0.0" - ws "^7.2.3" + whatwg-url "^8.5.0" + ws "^7.4.6" xml-name-validator "^3.0.0" jsesc@^2.5.1: @@ -5656,12 +6518,12 @@ jsesc@^2.5.1: integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== json-fixer@^1.5.1: - version "1.6.3" - resolved "https://registry.yarnpkg.com/json-fixer/-/json-fixer-1.6.3.tgz#1beaf69b137ed3588b8fdb5a5a507f4b3f276fe4" - integrity sha512-JSjfJJaKCQpSNEh+Tw1lX2L8MnDjIxfBpPTWUO/XN0JUY87nHJiFBy5i0Tm8o7/841LWfMDbqhn7UjhkjrZKkw== + version "1.6.12" + resolved "https://registry.yarnpkg.com/json-fixer/-/json-fixer-1.6.12.tgz#352026c905c6366e214c9f10f77d6d7f93c48322" + integrity sha512-BGO9HExf0ZUVYvuWsps71Re513Ss0il1Wp7wYWkir2NthzincvNJEUu82KagEfAkGdjOMsypj3t2JB7drBKWnA== dependencies: - "@babel/runtime" "^7.11.0" - chalk "^4.1.0" + "@babel/runtime" "^7.14.6" + chalk "^4.1.1" pegjs "^0.10.0" json-parse-better-errors@^1.0.0, json-parse-better-errors@^1.0.1: @@ -5670,9 +6532,9 @@ json-parse-better-errors@^1.0.0, json-parse-better-errors@^1.0.1: integrity sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw== json-parse-even-better-errors@^2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.0.tgz#371873c5ffa44304a6ba12419bcfa95f404ae081" - integrity sha512-o3aP+RsWDJZayj1SbHNQAI8x0v3T3SKiGoZlNYfbUP1S3omJQ6i9CnqADqkSPaOAxwua4/1YWx5CM7oiChJt2Q== + version "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-traverse@^0.4.1: version "0.4.1" @@ -5713,7 +6575,7 @@ json5@^1.0.1: dependencies: minimist "^1.2.0" -jsonc-parser@~3.0.0: +jsonc-parser@3.0.0, jsonc-parser@~3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-3.0.0.tgz#abdd785701c7e7eaca8a9ec8cf070ca51a745a22" integrity sha512-fQzRfAbIBnR0IQvftw9FJveWiHp72Fg20giDrHz6TdfB12UH/uue0D3hm57UB5KgAVuniLMCaS8P1IMj9NR7cA== @@ -5726,11 +6588,11 @@ jsonfile@^4.0.0: graceful-fs "^4.1.6" jsonfile@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.0.1.tgz#98966cba214378c8c84b82e085907b40bf614179" - integrity sha512-jR2b5v7d2vIOust+w3wtFKZIfpC2pnRmFAhAC/BuweZFQR8qZzxH1OyrQ10HmdVYiXWkYUqPVsz91cG7EL2FBg== + version "6.1.0" + resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae" + integrity sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ== dependencies: - universalify "^1.0.0" + universalify "^2.0.0" optionalDependencies: graceful-fs "^4.1.6" @@ -5829,45 +6691,42 @@ lines-and-columns@^1.1.6: integrity sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA= linkify-it@^3.0.1: - version "3.0.2" - resolved "https://registry.yarnpkg.com/linkify-it/-/linkify-it-3.0.2.tgz#f55eeb8bc1d3ae754049e124ab3bb56d97797fb8" - integrity sha512-gDBO4aHNZS6coiZCKVhSNh43F9ioIL4JwRjLZPkoLIY4yZFwg264Y5lu2x6rb1Js42Gh6Yqm2f6L2AJcnkzinQ== + version "3.0.3" + resolved "https://registry.yarnpkg.com/linkify-it/-/linkify-it-3.0.3.tgz#a98baf44ce45a550efb4d49c769d07524cc2fa2e" + integrity sha512-ynTsyrFSdE5oZ/O9GEf00kPngmOfVwazR5GKDq6EYfhlpFug3J2zybX56a2PRRpc9P+FuSoGNAwjlbDs9jJBPQ== dependencies: uc.micro "^1.0.1" -lint-staged@^10.2.13: - version "10.5.4" - resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-10.5.4.tgz#cd153b5f0987d2371fc1d2847a409a2fe705b665" - integrity sha512-EechC3DdFic/TdOPgj/RB3FicqE6932LTHCUm0Y2fsD9KGlLB+RwJl2q1IYBIvEsKzDOgn0D4gll+YxG5RsrKg== +lint-staged@^11.1.2: + version "11.2.3" + resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-11.2.3.tgz#fc3f4569cc4f46553309dfc1447b8aef69f744fb" + integrity sha512-Tfmhk8O2XFMD25EswHPv+OYhUjsijy5D7liTdxeXvhG2rsadmOLFtyj8lmlfoFFXY8oXWAIOKpoI+lJe1DB1mw== dependencies: - chalk "^4.1.0" - cli-truncate "^2.1.0" - commander "^6.2.0" - cosmiconfig "^7.0.0" - debug "^4.2.0" - dedent "^0.7.0" + cli-truncate "2.1.0" + colorette "^1.4.0" + commander "^8.2.0" + cosmiconfig "^7.0.1" + debug "^4.3.2" enquirer "^2.3.6" - execa "^4.1.0" - listr2 "^3.2.2" - log-symbols "^4.0.0" - micromatch "^4.0.2" + execa "^5.1.1" + listr2 "^3.12.2" + micromatch "^4.0.4" normalize-path "^3.0.0" please-upgrade-node "^3.2.0" string-argv "0.3.1" - stringify-object "^3.3.0" + stringify-object "3.3.0" + supports-color "8.1.1" -listr2@^3.2.2: - version "3.3.1" - resolved "https://registry.yarnpkg.com/listr2/-/listr2-3.3.1.tgz#87b57cc0b8541fa794b814c8bcb76f1211cfbf5c" - integrity sha512-8Zoxe7s/8nNr4bJ8bdAduHD8uJce+exmMmUWTXlq0WuUdffnH3muisHPHPFtW2vvOfohIsq7FGCaguUxN/h3Iw== +listr2@^3.12.2: + version "3.12.2" + resolved "https://registry.yarnpkg.com/listr2/-/listr2-3.12.2.tgz#2d55cc627111603ad4768a9e87c9c7bb9b49997e" + integrity sha512-64xC2CJ/As/xgVI3wbhlPWVPx0wfTqbUAkpb7bjDi0thSWMqrf07UFhrfsGoo8YSXmF049Rp9C0cjLC8rZxK9A== dependencies: - chalk "^4.1.0" cli-truncate "^2.1.0" - figures "^3.2.0" - indent-string "^4.0.0" + colorette "^1.4.0" log-update "^4.0.0" p-map "^4.0.0" - rxjs "^6.6.3" + rxjs "^6.6.7" through "^2.3.8" wrap-ansi "^7.0.0" @@ -5882,16 +6741,6 @@ load-json-file@^1.0.0: pinkie-promise "^2.0.0" strip-bom "^2.0.0" -load-json-file@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-2.0.0.tgz#7947e42149af80d696cbf797bcaabcfe1fe29ca8" - integrity sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg= - dependencies: - graceful-fs "^4.1.2" - parse-json "^2.2.0" - pify "^2.0.0" - strip-bom "^3.0.0" - load-json-file@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-4.0.0.tgz#2f5f45ab91e33216234fd53adab668eb4ec0993b" @@ -5963,11 +6812,16 @@ lodash.flatten@~4.4.0: resolved "https://registry.yarnpkg.com/lodash.flatten/-/lodash.flatten-4.4.0.tgz#f31c22225a9632d2bbf8e4addbef240aa765a61f" integrity sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8= -lodash.get@^4.4.2: +lodash.get@^4, lodash.get@^4.0.0, lodash.get@^4.4.2: version "4.4.2" resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99" integrity sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk= +lodash.isequal@^4.0.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0" + integrity sha1-QVxEePK8wwEgwizhDtMib30+GOA= + lodash.ismatch@^4.4.0: version "4.4.0" resolved "https://registry.yarnpkg.com/lodash.ismatch/-/lodash.ismatch-4.4.0.tgz#756cb5150ca3ba6f11085a78849645f188f85f37" @@ -5978,6 +6832,16 @@ lodash.map@^4.5.1: resolved "https://registry.yarnpkg.com/lodash.map/-/lodash.map-4.6.0.tgz#771ec7839e3473d9c4cde28b19394c3562f4f6d3" integrity sha1-dx7Hg540c9nEzeKLGTlMNWL09tM= +lodash.memoize@4.x: + version "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: + version "4.6.2" + resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" + integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== + lodash.set@^4.3.2: version "4.3.2" resolved "https://registry.yarnpkg.com/lodash.set/-/lodash.set-4.3.2.tgz#d8757b1da807dde24816b0d6a84bea1a76230b23" @@ -6003,23 +6867,21 @@ lodash.templatesettings@^4.0.0: dependencies: lodash._reinterpolate "^3.0.0" +lodash.truncate@^4.4.2: + version "4.4.2" + resolved "https://registry.yarnpkg.com/lodash.truncate/-/lodash.truncate-4.4.2.tgz#5a350da0b1113b837ecfffd5812cbe58d6eae193" + integrity sha1-WjUNoLERO4N+z//VgSy+WNbq4ZM= + 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.x, lodash@^4.11.2, lodash@^4.17.12, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.2.1: +lodash@^4.11.2, lodash@^4.17.12, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.21, lodash@^4.2.1, lodash@^4.7.0, 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-update@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/log-update/-/log-update-4.0.0.tgz#589ecd352471f2a1c0c570287543a64dfd20e0a1" @@ -6058,9 +6920,9 @@ lru-cache@^6.0.0: yallist "^4.0.0" macos-release@^2.2.0: - version "2.4.1" - resolved "https://registry.yarnpkg.com/macos-release/-/macos-release-2.4.1.tgz#64033d0ec6a5e6375155a74b1a1eba8e509820ac" - integrity sha512-H/QHeBIN1fIGJX517pvK8IEK53yQOW7YcEI55oYtgjDdoCQQz7eJS94qt5kNrscReEyuD/JcdFCm2XBEcGOITg== + version "2.5.0" + resolved "https://registry.yarnpkg.com/macos-release/-/macos-release-2.5.0.tgz#067c2c88b5f3fb3c56a375b2ec93826220fa1ff2" + integrity sha512-EIgv+QZ9r+814gjJj0Bt5vSLJLzswGmSUbUpbi9AIr/fsN2IWFBl2NucV9PAiek+U1STK468tEkxmVYUtuAN3g== make-dir@*, make-dir@^3.0.0, make-dir@^3.1.0: version "3.1.0" @@ -6084,7 +6946,7 @@ make-dir@^2.1.0: pify "^4.0.1" semver "^5.6.0" -make-error@1.x, make-error@^1.1.1: +make-error@1.x, make-error@^1, make-error@^1.1.1: version "1.3.6" resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== @@ -6129,9 +6991,9 @@ map-obj@^2.0.0: integrity sha1-plzSkIepJZi4eRJXpSPgISIqwfk= map-obj@^4.0.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-4.1.0.tgz#b91221b542734b9f14256c0132c897c5d7256fd5" - integrity sha512-glc9y00wgtwcDmp7GaE/0b0OnxpNJsVf3ael/An6Fe2Q51LLwN1er6sdomLRzz5h0+yMpiYLhWYF5R7HeqVd4g== + version "4.3.0" + resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-4.3.0.tgz#9304f906e93faae70880da102a9f1df0ea8bb05a" + integrity sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ== map-visit@^1.0.0: version "1.0.0" @@ -6140,59 +7002,64 @@ map-visit@^1.0.0: dependencies: object-visit "^1.0.0" -markdown-it@12.0.2: - version "12.0.2" - resolved "https://registry.yarnpkg.com/markdown-it/-/markdown-it-12.0.2.tgz#4401beae8df8aa2221fc6565a7188e60a06ef0ed" - integrity sha512-4Lkvjbv2kK+moL9TbeV+6/NHx+1Q+R/NIdUlFlkqkkzUcTod4uiyTJRiBidKR9qXSdkNFkgv+AELY8KN9vSgVA== +markdown-it@12.2.0: + version "12.2.0" + resolved "https://registry.yarnpkg.com/markdown-it/-/markdown-it-12.2.0.tgz#091f720fd5db206f80de7a8d1f1a7035fd0d38db" + integrity sha512-Wjws+uCrVQRqOoJvze4HCqkKl1AsSh95iFAeQDwnyfxM09divCBSXlDR1uTvyUP3Grzpn4Ru8GeCxYPM8vkCQg== dependencies: argparse "^2.0.1" - entities "~2.0.0" + entities "~2.1.0" linkify-it "^3.0.1" mdurl "^1.0.1" uc.micro "^1.0.5" -markdownlint-cli@^0.26.0: - version "0.26.0" - resolved "https://registry.yarnpkg.com/markdownlint-cli/-/markdownlint-cli-0.26.0.tgz#cd89e3e39a049303ec125c8aa291da4f3325df29" - integrity sha512-biLfeGNZG9nw0yJbtFBzRlew2/P5w7JSseKwolSox3zejs7dLpGvPgqbC+iqJnqqGWcWLtXaXh8bBEKWmfl10A== +markdownlint-cli@^0.29.0: + version "0.29.0" + resolved "https://registry.yarnpkg.com/markdownlint-cli/-/markdownlint-cli-0.29.0.tgz#3c56686fd00ace4b68c9cfa3a34a7a9dfdef1417" + integrity sha512-SEXRUT1ri9sXV8xQK88vjGAgmz2X9rxEG2tXdDZMljzW8e++LNTO9zzBBStx3JQWrTDoGTPHNrcurbuiyF97gw== dependencies: - commander "~6.2.1" + commander "~8.2.0" deep-extend "~0.6.0" get-stdin "~8.0.0" - glob "~7.1.6" + glob "~7.2.0" ignore "~5.1.8" - js-yaml "~3.14.1" + js-yaml "^4.1.0" jsonc-parser "~3.0.0" lodash.differencewith "~4.5.0" lodash.flatten "~4.4.0" - markdownlint "~0.22.0" - markdownlint-rule-helpers "~0.13.0" + markdownlint "~0.24.0" + markdownlint-rule-helpers "~0.15.0" minimatch "~3.0.4" minimist "~1.2.5" - rc "~1.2.8" + run-con "~1.2.10" -markdownlint-rule-helpers@~0.13.0: - version "0.13.0" - resolved "https://registry.yarnpkg.com/markdownlint-rule-helpers/-/markdownlint-rule-helpers-0.13.0.tgz#7cc6553bc7f8c4c8a43cf66fb2a3a652124f46f9" - integrity sha512-rRY0itbcHG4e+ntz0bbY3AIceSJMKS0TafEMgEtKVHRZ54/JUSy6/4ypCL618RlJvYRej+xMLxX5nkJqIeTZaQ== +markdownlint-rule-helpers@~0.15.0: + version "0.15.0" + resolved "https://registry.yarnpkg.com/markdownlint-rule-helpers/-/markdownlint-rule-helpers-0.15.0.tgz#11434c573649b9235ae70b967314f5711f7d8fa8" + integrity sha512-A+9mswc3m/kkqpJCqntmte/1VKhDJ+tjZsERLz5L4h/Qr7ht2/BkGkgY5E7/wsxIhcpl+ctIfz+oS3PQrMOB2w== -markdownlint@~0.22.0: - version "0.22.0" - resolved "https://registry.yarnpkg.com/markdownlint/-/markdownlint-0.22.0.tgz#4ed95b61c17ae9f4dfca6a01f038c744846c0a72" - integrity sha512-J4B+iMc12pOdp/wfYi03W2qfAfEyiZzq3qvQh/8vOMNU8vXYY6Jg440EY7dWTBCqROhb1i4nAn3BTByJ5kdx1w== +markdownlint@~0.24.0: + version "0.24.0" + resolved "https://registry.yarnpkg.com/markdownlint/-/markdownlint-0.24.0.tgz#224b53f671367a237d40c8be1745c7be9a322671" + integrity sha512-OJIGsGFV/rC9irI5E1FMy6v9hdACSwaa+EN3224Y5KG8zj2EYzdHOw0pOJovIYmjNfEZ9BtxUY4P7uYHTSNnbQ== dependencies: - markdown-it "12.0.2" + markdown-it "12.2.0" -marked@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/marked/-/marked-2.0.0.tgz#9662bbcb77ebbded0662a7be66ff929a8611cee5" - integrity sha512-NqRSh2+LlN2NInpqTQnS614Y/3NkVMFFU6sJlRFEpxJ/LHuK/qJECH7/fXZjk4VZstPW/Pevjil/VtSONsLc7Q== +marked@^3.0.7: + version "3.0.7" + resolved "https://registry.yarnpkg.com/marked/-/marked-3.0.7.tgz#343aad9e91b96249b495c99c512ea09cfe06de1e" + integrity sha512-ctKqbnLuNbsHbI26cfMyOlKgXGfl1orOv1AvWWDX7AkgfMOwCWvmuYc+mVLeWhQ9W6hdWVBynOs96VkcscKo0Q== mdurl@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/mdurl/-/mdurl-1.0.1.tgz#fe85b2ec75a59037f2adfec100fd6c601761152e" integrity sha1-/oWy7HWlkDfyrf7BAP1sYBdhFS4= +memorystream@^0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/memorystream/-/memorystream-0.3.1.tgz#86d7090b30ce455d63fbae12dda51a47ddcaf9b2" + integrity sha1-htcJCzDORV1j+64S3aUaR93K+bI= + meow@^3.3.0: version "3.7.0" resolved "https://registry.yarnpkg.com/meow/-/meow-3.7.0.tgz#72cb668b425228290abbfa856892587308a801fb" @@ -6224,22 +7091,22 @@ meow@^4.0.0: redent "^2.0.0" trim-newlines "^2.0.0" -meow@^7.0.0: - version "7.1.1" - resolved "https://registry.yarnpkg.com/meow/-/meow-7.1.1.tgz#7c01595e3d337fcb0ec4e8eed1666ea95903d306" - integrity sha512-GWHvA5QOcS412WCo8vwKDlTelGLsCGBVevQB5Kva961rmNfun0PCbv5+xta2kUMFJyR8/oWnn7ddeKdosbAPbA== +meow@^8.0.0: + version "8.1.2" + resolved "https://registry.yarnpkg.com/meow/-/meow-8.1.2.tgz#bcbe45bda0ee1729d350c03cffc8395a36c4e897" + integrity sha512-r85E3NdZ+mpYk1C6RjPFEMSE+s1iZMuHtsHAqY0DT3jZczl0diWUZ8g6oU7h0M9cD2EL+PzaYghhCLzR0ZNn5Q== dependencies: "@types/minimist" "^1.2.0" camelcase-keys "^6.2.2" decamelize-keys "^1.1.0" hard-rejection "^2.1.0" minimist-options "4.1.0" - normalize-package-data "^2.5.0" + normalize-package-data "^3.0.0" read-pkg-up "^7.0.1" redent "^3.0.0" trim-newlines "^3.0.0" - type-fest "^0.13.1" - yargs-parser "^18.1.3" + type-fest "^0.18.0" + yargs-parser "^20.2.3" merge-stream@^2.0.0: version "2.0.0" @@ -6251,12 +7118,12 @@ merge2@^1.2.3, merge2@^1.3.0: resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== -merge@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/merge/-/merge-1.2.1.tgz#38bebf80c3220a8a487b6fcfb3941bb11720c145" - integrity sha512-VjFo4P5Whtj4vsLzsYBu5ayHhoHJ0UqNm7ibvShmbmoz7tGi0vXaoJbGdB+GmDMLUdg8DpQXEIeVDAe8MaABvQ== +merge@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/merge/-/merge-2.1.1.tgz#59ef4bf7e0b3e879186436e8481c06a6c162ca98" + integrity sha512-jz+Cfrg9GWOZbQAnDQ4hlVnQky+341Yk5ru8bZSe6sIDTCIg8n9i/u7hSQGSVOF3C7lH6mGtqjkiT9G4wFLL0w== -micromatch@^3.0.4, micromatch@^3.1.10, micromatch@^3.1.4: +micromatch@^3.1.10: version "3.1.10" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" integrity sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg== @@ -6275,25 +7142,25 @@ micromatch@^3.0.4, micromatch@^3.1.10, micromatch@^3.1.4: snapdragon "^0.8.1" to-regex "^3.0.2" -micromatch@^4.0.2: - version "4.0.2" - resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.2.tgz#4fcb0999bf9fbc2fcbdd212f6d629b9a56c39259" - integrity sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q== +micromatch@^4.0.2, micromatch@^4.0.4: + version "4.0.4" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.4.tgz#896d519dfe9db25fce94ceb7a500919bf881ebf9" + integrity sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg== dependencies: braces "^3.0.1" - picomatch "^2.0.5" + picomatch "^2.2.3" -mime-db@1.44.0: - version "1.44.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.44.0.tgz#fa11c5eb0aca1334b4233cb4d52f10c5a6272f92" - integrity sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg== +mime-db@1.50.0: + version "1.50.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.50.0.tgz#abd4ac94e98d3c0e185016c67ab45d5fde40c11f" + integrity sha512-9tMZCDlYHqeERXEHO9f/hKfNXhre5dK2eE/krIvUjZbS2KPcqGDfNShIWS1uW9XOTKQKqK6qbeOci18rbfW77A== mime-types@^2.1.12, mime-types@~2.1.19: - version "2.1.27" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.27.tgz#47949f98e279ea53119f5722e0f34e529bec009f" - integrity sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w== + version "2.1.33" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.33.tgz#1fa12a904472fafd068e48d9e8401f74d3f70edb" + integrity sha512-plLElXp7pRDd0bNZHw+nMd52vRYjLwQjygaNg7ddJ2uJtTlmnTCjWuPKxVu6//AdaRuME84SvLW91sIkBqGT0g== dependencies: - mime-db "1.44.0" + mime-db "1.50.0" mimic-fn@^1.0.0: version "1.2.0" @@ -6310,7 +7177,7 @@ min-indent@^1.0.0: resolved "https://registry.yarnpkg.com/min-indent/-/min-indent-1.0.1.tgz#a63f681673b30571fbe8bc25686ae746eefa9869" integrity sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg== -minimatch@^3.0.4, minimatch@~3.0.4: +minimatch@3.0.4, minimatch@^3.0.4, minimatch@~3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== @@ -6334,12 +7201,12 @@ minimist-options@^3.0.1: arrify "^1.0.1" is-plain-obj "^1.1.0" -minimist@1.2.5, minimist@^1.1.1, minimist@^1.1.3, minimist@^1.2.0, minimist@^1.2.5, minimist@~1.2.5: +minimist@1.2.5, minimist@^1.1.3, minimist@^1.2.0, minimist@^1.2.5, minimist@~1.2.5: version "1.2.5" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602" integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw== -minipass@^2.3.5, minipass@^2.6.0, minipass@^2.8.6, minipass@^2.9.0: +minipass@^2.3.5, minipass@^2.6.0, minipass@^2.9.0: version "2.9.0" resolved "https://registry.yarnpkg.com/minipass/-/minipass-2.9.0.tgz#e713762e7d3e32fed803115cf93e04bca9fcc9a6" integrity sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg== @@ -6347,13 +7214,28 @@ minipass@^2.3.5, minipass@^2.6.0, minipass@^2.8.6, minipass@^2.9.0: safe-buffer "^5.1.2" yallist "^3.0.0" -minizlib@^1.2.1: +minipass@^3.0.0: + version "3.1.5" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-3.1.5.tgz#71f6251b0a33a49c01b3cf97ff77eda030dff732" + integrity sha512-+8NzxD82XQoNKNrl1d/FSi+X8wAEWR+sbYAfIvub4Nz0d22plFG72CEVVaufV8PNf4qSslFTD8VMOxNVhHCjTw== + dependencies: + yallist "^4.0.0" + +minizlib@^1.3.3: version "1.3.3" resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-1.3.3.tgz#2290de96818a34c29551c8a8d301216bd65a861d" integrity sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q== dependencies: minipass "^2.9.0" +minizlib@^2.1.1: + version "2.1.2" + resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-2.1.2.tgz#e90d3466ba209b932451508a11ce3d3632145931" + integrity sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg== + dependencies: + minipass "^3.0.0" + yallist "^4.0.0" + mississippi@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/mississippi/-/mississippi-3.0.0.tgz#ea0a3291f97e0b5e8776b363d5f0a12d94c67022" @@ -6385,12 +7267,12 @@ mkdirp-promise@^5.0.1: dependencies: mkdirp "*" -mkdirp@*, mkdirp@1.x: +mkdirp@*, mkdirp@^1.0.3: version "1.0.4" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== -mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@^0.5.3: +mkdirp@^0.5.1, mkdirp@^0.5.3, mkdirp@^0.5.5: version "0.5.5" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.5.tgz#d91cefd62d1436ca0f41620e251288d420099def" integrity sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ== @@ -6419,11 +7301,16 @@ ms@2.0.0: resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= -ms@2.1.2, ms@^2.0.0, ms@^2.1.1: +ms@2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== +ms@^2.0.0, ms@^2.1.1: + version "2.1.3" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" + integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== + multimatch@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/multimatch/-/multimatch-3.0.0.tgz#0e2534cc6bc238d9ab67e1b9cd5fcd85a6dbf70b" @@ -6475,6 +7362,11 @@ natural-compare@^1.4.0: resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= +ncp@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ncp/-/ncp-2.0.0.tgz#195a21d6c46e361d2fb1281ba38b91e9df7bdbb3" + integrity sha1-GVoh1sRuNh0vsSgbo4uR6d9727M= + neo-async@^2.6.0: version "2.6.2" resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" @@ -6485,6 +7377,11 @@ nice-try@^1.0.4: resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ== +node-addon-api@^3.0.2: + version "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-fetch-npm@^2.0.2: version "2.0.4" resolved "https://registry.yarnpkg.com/node-fetch-npm/-/node-fetch-npm-2.0.4.tgz#6507d0e17a9ec0be3bec516958a497cec54bf5a4" @@ -6494,10 +7391,25 @@ node-fetch-npm@^2.0.2: json-parse-better-errors "^1.0.0" safe-buffer "^5.1.1" -node-fetch@^2.3.0, node-fetch@^2.5.0, node-fetch@^2.6.0, node-fetch@^2.6.1: - version "2.6.1" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052" - integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw== +node-fetch@^2.5.0, node-fetch@^2.6.0, node-fetch@^2.6.1: + version "2.6.5" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.5.tgz#42735537d7f080a7e5f78b6c549b7146be1742fd" + integrity sha512-mmlIVHJEu5rnIxgEgez6b9GgWXbkZj5YZ7fx+2r94a2E+Uirsp6HsPTPlomfdHtpt/B0cdKviwkoaM6pyvUOpQ== + dependencies: + whatwg-url "^5.0.0" + +node-fetch@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-3.0.0.tgz#79da7146a520036f2c5f644e4a26095f17e411ea" + integrity sha512-bKMI+C7/T/SPU1lKnbQbwxptpCrG9ashG+VkytmXCPZyuM9jB6VU+hY0oi4lC8LxTtAeWdckNCTa3nrGsAdA3Q== + dependencies: + data-uri-to-buffer "^3.0.1" + fetch-blob "^3.1.2" + +node-gyp-build@^4.2.3: + version "4.3.0" + resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.3.0.tgz#9f256b03e5826150be39c764bf51e993946d71a3" + integrity sha512-iWjXZvmboq0ja1pUGULQBexmxq8CV4xBhX7VDOTbL7ZR4FOowwY/VOtRxBN/yKxmdGoIp4j5ysNT4u3S2pDQ3Q== node-gyp@^5.0.2: version "5.1.1" @@ -6521,27 +7433,20 @@ node-int64@^0.4.0: resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" integrity sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs= +node-machine-id@^1.1.12: + version "1.1.12" + resolved "https://registry.yarnpkg.com/node-machine-id/-/node-machine-id-1.1.12.tgz#37904eee1e59b320bb9c5d6c0a59f3b469cb6267" + integrity sha512-QNABxbrPa3qEIfrE6GOJ7BYIuignnJw7iQ2YPbc3Nla1HzRJjXzZOiikfF8m7eAMfichLt3M4VgLOetqgDmgGQ== + node-modules-regexp@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz#8d9dbe28964a4ac5712e9131642107c71e90ec40" integrity sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA= -node-notifier@^8.0.0: - version "8.0.1" - resolved "https://registry.yarnpkg.com/node-notifier/-/node-notifier-8.0.1.tgz#f86e89bbc925f2b068784b31f382afdc6ca56be1" - integrity sha512-BvEXF+UmsnAfYfoapKM9nGxnP+Wn7P91YfXmrKnfcYCx6VBeoN5Ez5Ogck6I8Bi5k4RlpqRYaw75pAwzX9OphA== - dependencies: - growly "^1.3.0" - is-wsl "^2.2.0" - semver "^7.3.2" - shellwords "^0.1.1" - uuid "^8.3.0" - which "^2.0.2" - -node-releases@^1.1.70: - version "1.1.71" - resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.71.tgz#cb1334b179896b1c89ecfdd4b725fb7bbdfc7dbb" - integrity sha512-zR6HoT6LrLCRBwukmrVbHv0EpEQjksO6GmFcZQQuCAy139BEsoVKPYnf3jongYW83fAa1torLGYwxxky/p28sg== +node-releases@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.0.tgz#67dc74903100a7deb044037b8a2e5f453bb05400" + integrity sha512-aA87l0flFYMzCHpTM3DERFSYxc6lv/BltdbRTOMZuxZ0cwZCD3mejE5n9vLhSJCN++/eOqr77G1IO5uXxlQYWA== nopt@^4.0.1: version "4.0.3" @@ -6561,27 +7466,30 @@ normalize-package-data@^2.0.0, normalize-package-data@^2.3.0, normalize-package- semver "2 || 3 || 4 || 5" validate-npm-package-license "^3.0.1" -normalize-path@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9" - integrity sha1-GrKLVW4Zg2Oowab35vogE3/mrtk= +normalize-package-data@^3.0.0: + version "3.0.3" + resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-3.0.3.tgz#dbcc3e2da59509a0983422884cd172eefdfa525e" + integrity sha512-p2W1sgqij3zMMyRC067Dg16bfzVH+w7hyegmpIvZ4JNjqtGOVAIvLmjBx3yP7YTe9vKJgkoNOPjwQGogDoMXFA== dependencies: - remove-trailing-separator "^1.0.1" + hosted-git-info "^4.0.1" + is-core-module "^2.5.0" + semver "^7.3.4" + validate-npm-package-license "^3.0.1" -normalize-path@^3.0.0: +normalize-path@^3.0.0, normalize-path@~3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== -normalize-url@^3.3.0: - version "3.3.0" - resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-3.3.0.tgz#b2e1c4dc4f7c6d57743df733a4f5978d18650559" - integrity sha512-U+JJi7duF1o+u2pynbp2zXDW2/PADgC30f0GsHZtRh+HOcXHnw137TrNlyxxRvWW5fjKd3bcLHPxofWuCjaeZg== +normalize-url@^6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-6.1.0.tgz#40d0885b535deffe3f3147bec877d05fe4c5668a" + integrity sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A== npm-bundled@^1.0.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/npm-bundled/-/npm-bundled-1.1.1.tgz#1edd570865a94cdb1bc8220775e29466c9fb234b" - integrity sha512-gqkfgGePhTpAEgUsGEgcq1rqPXA+tv/aVBlgEzfXwA1yiUJF7xtEt3CtVwOjNYQOVknDk0F20w58Fnm3EtG0fA== + 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" @@ -6632,6 +7540,21 @@ npm-pick-manifest@^3.0.0: npm-package-arg "^6.0.0" semver "^5.4.1" +npm-run-all@^4.1.5: + version "4.1.5" + resolved "https://registry.yarnpkg.com/npm-run-all/-/npm-run-all-4.1.5.tgz#04476202a15ee0e2e214080861bff12a51d98fba" + integrity sha512-Oo82gJDAVcaMdi3nuoKFavkIHBRVqQ1qvMb+9LHk/cF4P6B2m8aP04hGf7oL6wZ9BuGwX1onlLhpuoofSyoQDQ== + dependencies: + ansi-styles "^3.2.1" + chalk "^2.4.1" + cross-spawn "^6.0.5" + memorystream "^0.3.1" + minimatch "^3.0.4" + pidtree "^0.3.0" + read-pkg "^3.0.0" + shell-quote "^1.6.1" + string.prototype.padend "^3.0.0" + npm-run-path@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" @@ -6639,7 +7562,7 @@ npm-run-path@^2.0.0: dependencies: path-key "^2.0.0" -npm-run-path@^4.0.0: +npm-run-path@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea" integrity sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw== @@ -6666,6 +7589,13 @@ nwsapi@^2.2.0: resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.2.0.tgz#204879a9e3d068ff2a55139c2c772780681a38b7" integrity sha512-h2AatdwYH+JHiZpv7pt/gSX1XoRGb7L/qSIeuqA6GwYoF9w1vP1cw42TO0aI2pNyshRK5893hNSl+1//vHK7hQ== +nx@13.0.2: + version "13.0.2" + resolved "https://registry.yarnpkg.com/nx/-/nx-13.0.2.tgz#257cdf7899dc46dec683814fcf28008db47849d6" + integrity sha512-8P+UWM1q6gMNZwAcCABNMl4IpHqYqWbC2HdCXAL10Y3oXmkDk0KcCp70UVuiVPouj+zSGnbqn9hc+8TizVukGw== + dependencies: + "@nrwl/cli" "*" + oauth-sign@~0.9.0: version "0.9.0" resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455" @@ -6685,12 +7615,12 @@ object-copy@^0.1.0: define-property "^0.2.5" kind-of "^3.0.3" -object-inspect@^1.7.0: - version "1.8.0" - resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.8.0.tgz#df807e5ecf53a609cc6bfe93eac3cc7be5b3a9d0" - integrity sha512-jLdtEOB112fORuypAyl/50VRVIBIdVQOSUUGQHzJ4xBSbit81zRarz7GThkEFZy1RceYrWYcPcBFPQwHyAc1gA== +object-inspect@^1.11.0, object-inspect@^1.9.0: + version "1.11.0" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.11.0.tgz#9dceb146cedd4148a0d9e51ab88d34cf509922b1" + integrity sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg== -object-keys@^1.0.11, object-keys@^1.0.12, object-keys@^1.1.1: +object-keys@^1.0.12, object-keys@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== @@ -6702,23 +7632,24 @@ object-visit@^1.0.0: dependencies: isobject "^3.0.0" -object.assign@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.0.tgz#968bf1100d7956bb3ca086f006f846b3bc4008da" - integrity sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w== +object.assign@^4.1.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.2.tgz#0ed54a342eceb37b38ff76eb831a0e788cb63940" + integrity sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ== dependencies: - define-properties "^1.1.2" - function-bind "^1.1.1" - has-symbols "^1.0.0" - object-keys "^1.0.11" + call-bind "^1.0.0" + define-properties "^1.1.3" + has-symbols "^1.0.1" + object-keys "^1.1.1" object.getownpropertydescriptors@^2.0.3: - version "2.1.0" - resolved "https://registry.yarnpkg.com/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.0.tgz#369bf1f9592d8ab89d712dced5cb81c7c5352649" - integrity sha512-Z53Oah9A3TdLoblT7VKJaTDdXdT+lQO+cNpKVnya5JDe9uLvzu1YyY1yFDFrcxrlRgWrEFH0jJtD/IbuwjcEVg== + version "2.1.3" + resolved "https://registry.yarnpkg.com/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.3.tgz#b223cf38e17fefb97a63c10c91df72ccb386df9e" + integrity sha512-VdDoCwvJI4QdC6ndjpqFmoL3/+HxffFBbcJzKi5hwLLqqx3mdbedRpfZDdK0SrOSauj8X4GzBvnDZl4vTN7dOw== dependencies: + call-bind "^1.0.2" define-properties "^1.1.3" - es-abstract "^1.17.0-next.1" + es-abstract "^1.19.1" object.pick@^1.3.0: version "1.3.0" @@ -6727,15 +7658,14 @@ object.pick@^1.3.0: dependencies: isobject "^3.0.1" -object.values@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/object.values/-/object.values-1.1.1.tgz#68a99ecde356b7e9295a3c5e0ce31dc8c953de5e" - integrity sha512-WTa54g2K8iu0kmS/us18jEmdv1a4Wi//BZ/DTVYEcH0XhLM5NYdpDHja3gt57VrZLcNAO2WGA+KpWsDBaHt6eA== +object.values@^1.1.5: + version "1.1.5" + resolved "https://registry.yarnpkg.com/object.values/-/object.values-1.1.5.tgz#959f63e3ce9ef108720333082131e4a459b716ac" + integrity sha512-QUZRW0ilQ3PnPpbNtgdNV1PDbEqLIiSFB3l+EnGtBQ/8SUTLj1PZwtQHABZtLgwpJZTSZhuGLOGk57Drx2IvYg== dependencies: + call-bind "^1.0.2" define-properties "^1.1.3" - es-abstract "^1.17.0-next.1" - function-bind "^1.1.1" - has "^1.0.3" + es-abstract "^1.19.1" octokit-pagination-methods@^1.1.0: version "1.1.0" @@ -6756,13 +7686,21 @@ onetime@^2.0.0: dependencies: mimic-fn "^1.0.0" -onetime@^5.1.0: +onetime@^5.1.0, onetime@^5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.2.tgz#d0e96ebb56b07476df1dd9c4806e5237985ca45e" integrity sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg== dependencies: mimic-fn "^2.1.0" +open@^7.4.2: + version "7.4.2" + resolved "https://registry.yarnpkg.com/open/-/open-7.4.2.tgz#b8147e26dcf3e426316c730089fd71edd29c2321" + integrity sha512-MVHddDVweXZF3awtlAS+6pgKLlm/JgxZ90+/NBurBoQctVOOB/zDdVjcyPzQ+0laDGbsWgrRkflI65sQeOgT9Q== + dependencies: + is-docker "^2.0.0" + is-wsl "^2.1.1" + optionator@^0.8.1: version "0.8.3" resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.3.tgz#84fa1d036fe9d3c7e21d99884b601167ec8fb495" @@ -6813,11 +7751,6 @@ osenv@^0.1.4, osenv@^0.1.5: os-homedir "^1.0.0" os-tmpdir "^1.0.0" -p-each-series@^2.1.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/p-each-series/-/p-each-series-2.2.0.tgz#105ab0357ce72b202a8a8b94933672657b5e2a9a" - integrity sha512-ycIL2+1V32th+8scbpTvyHNaHe02z0sjgh91XXjAk+ZeXoPN4Z46DVUnzdso0aX4KckKw0FNNFHdjZ2UsZvxiA== - p-finally@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" @@ -6941,6 +7874,13 @@ parent-module@^1.0.0: dependencies: callsites "^3.0.0" +parent-module@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-2.0.0.tgz#fa71f88ff1a50c27e15d8ff74e0e3a9523bf8708" + integrity sha512-uo0Z9JJeWzv8BG+tRcapBKNJ0dro9cLyczGzulS6EfeyAdeC9sbojtW6XwvYxJkEne9En+J2XEl4zyglVeIwFg== + dependencies: + callsites "^3.1.0" + parse-github-repo-url@^1.3.0: version "1.4.1" resolved "https://registry.yarnpkg.com/parse-github-repo-url/-/parse-github-repo-url-1.4.1.tgz#9e7d8bb252a6cb6ba42595060b7bf6df3dbc1f50" @@ -6962,9 +7902,9 @@ parse-json@^4.0.0: json-parse-better-errors "^1.0.1" parse-json@^5.0.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.1.0.tgz#f96088cdf24a8faa9aea9a009f2d9d942c999646" - integrity sha512-+mi/lmVVNKFNVyLXV31ERiy2CY5E1/F6QtJFEzoChPRwwngMNXRDQ9GJ5WdE2Z2P4AujsOi0/+2qHID68KwfIQ== + version "5.2.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.2.0.tgz#c76fc66dee54231c962b22bcc8a72cf2f99753cd" + integrity sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg== dependencies: "@babel/code-frame" "^7.0.0" error-ex "^1.3.1" @@ -6977,27 +7917,29 @@ parse-passwd@^1.0.0: integrity sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY= parse-path@^4.0.0: - version "4.0.2" - resolved "https://registry.yarnpkg.com/parse-path/-/parse-path-4.0.2.tgz#ef14f0d3d77bae8dd4bc66563a4c151aac9e65aa" - integrity sha512-HSqVz6iuXSiL8C1ku5Gl1Z5cwDd9Wo0q8CoffdAghP6bz8pJa1tcMC+m4N+z6VAS8QdksnIGq1TB6EgR4vPR6w== + version "4.0.3" + resolved "https://registry.yarnpkg.com/parse-path/-/parse-path-4.0.3.tgz#82d81ec3e071dcc4ab49aa9f2c9c0b8966bb22bf" + integrity sha512-9Cepbp2asKnWTJ9x2kpw6Fe8y9JDbqwahGCTvklzd/cEq5C5JC59x2Xb0Kx+x0QZ8bvNquGO8/BWP0cwBHzSAA== dependencies: is-ssh "^1.3.0" protocols "^1.4.0" + qs "^6.9.4" + query-string "^6.13.8" -parse-url@^5.0.0: - version "5.0.2" - resolved "https://registry.yarnpkg.com/parse-url/-/parse-url-5.0.2.tgz#856a3be1fcdf78dc93fc8b3791f169072d898b59" - integrity sha512-Czj+GIit4cdWtxo3ISZCvLiUjErSo0iI3wJ+q9Oi3QuMYTI6OZu+7cewMWZ+C1YAnKhYTk6/TLuhIgCypLthPA== +parse-url@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/parse-url/-/parse-url-6.0.0.tgz#f5dd262a7de9ec00914939220410b66cff09107d" + integrity sha512-cYyojeX7yIIwuJzledIHeLUBVJ6COVLeT4eF+2P6aKVzwvgKQPndCBv3+yQ7pcWjqToYwaligxzSYNNmGoMAvw== dependencies: is-ssh "^1.3.0" - normalize-url "^3.3.0" + normalize-url "^6.1.0" parse-path "^4.0.0" protocols "^1.4.0" -parse5@5.1.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/parse5/-/parse5-5.1.1.tgz#f68e4e5ba1852ac2cadc00f4555fff6c2abb6178" - integrity sha512-ugq4DFI0Ptb+WWjAdOK16+u/nHfiIrcE+sh8kZMaM0WllQKLI9rOUq6c2b7cwPkXdzfQESqvoqK6ug7U/Yyzug== +parse5@6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/parse5/-/parse5-6.0.1.tgz#e1a1c085c569b3dc08321184f19a39cc27f7c30b" + integrity sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw== pascalcase@^0.1.1: version "0.1.1" @@ -7042,9 +7984,9 @@ path-key@^3.0.0, path-key@^3.1.0: integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== path-parse@^1.0.6: - version "1.0.6" - resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" - integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw== + version "1.0.7" + resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" + integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== path-type@^1.0.0: version "1.1.0" @@ -7055,13 +7997,6 @@ path-type@^1.0.0: pify "^2.0.0" pinkie-promise "^2.0.0" -path-type@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/path-type/-/path-type-2.0.0.tgz#f012ccb8415b7096fc2daa1054c3d72389594c73" - integrity sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM= - dependencies: - pify "^2.0.0" - path-type@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/path-type/-/path-type-3.0.0.tgz#cef31dc8e0a1a3bb0d105c0cd97cf3bf47f4e36f" @@ -7084,10 +8019,20 @@ performance-now@^2.1.0: resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns= -picomatch@^2.0.4, picomatch@^2.0.5, picomatch@^2.2.1: - version "2.2.2" - resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.2.2.tgz#21f333e9b6b8eaff02468f5146ea406d345f4dad" - integrity sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg== +picocolors@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" + integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== + +picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.3: + version "2.3.0" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.0.tgz#f1f061de8f6a4bf022892e2d128234fb98302972" + integrity sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw== + +pidtree@^0.3.0: + version "0.3.1" + resolved "https://registry.yarnpkg.com/pidtree/-/pidtree-0.3.1.tgz#ef09ac2cc0533df1f3250ccf2c4d366b0d12114a" + integrity sha512-qQbW94hLHEqCg7nhby4yRC7G2+jYHY4Rguc2bjw7Uug4GIJuu1tvf2uHaZv5Q8zdt+WKJ6qK1FOI6amaWUo5FA== pify@^2.0.0, pify@^2.3.0: version "2.3.0" @@ -7171,19 +8116,19 @@ prelude-ls@~1.1.2: resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ= -prettier@*, prettier@^2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.2.1.tgz#795a1a78dd52f073da0cd42b21f9c91381923ff5" - integrity sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q== +prettier@*, prettier@2.4.1: + version "2.4.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.4.1.tgz#671e11c89c14a4cfc876ce564106c4a6726c9f5c" + integrity sha512-9fbDAXSBcc6Bs1mZrDYb3XKzDLm4EXXL9sC1LqKP5rZkT6KRr/rf9amVUcODVXgguK/isJz0d0hP72WeaKWsvA== -pretty-format@^26.0.0, pretty-format@^26.4.2, pretty-format@^26.6.2: - version "26.6.2" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-26.6.2.tgz#e35c2705f14cb7fe2fe94fa078345b444120fc93" - integrity sha512-7AeGuCYNGmycyQbCqd/3PWH4eOoX/OiCa0uphp57NVTeAGdJGaAliecxwBDHYQCIvrW7aDBZCYeNTP/WX69mkg== +pretty-format@*, pretty-format@^27.0.0, pretty-format@^27.2.2, pretty-format@^27.3.1: + version "27.3.1" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-27.3.1.tgz#7e9486365ccdd4a502061fa761d3ab9ca1b78df5" + integrity sha512-DR/c+pvFc52nLimLROYjnXPtolawm+uWDxr4FjuLDLUn+ktWnSN851KoHwHzzqq6rfCOjkzN8FLgDrSub6UDuA== dependencies: - "@jest/types" "^26.6.2" - ansi-regex "^5.0.0" - ansi-styles "^4.0.0" + "@jest/types" "^27.2.5" + ansi-regex "^5.0.1" + ansi-styles "^5.0.0" react-is "^17.0.1" process-nextick-args@~2.0.0: @@ -7210,9 +8155,9 @@ promise-retry@^1.1.1: retry "^0.10.0" prompts@^2.0.1: - version "2.4.0" - resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.4.0.tgz#4aa5de0723a231d1ee9121c40fdf663df73f61d7" - integrity sha512-awZAKrk3vN6CroQukBL+R9051a4R3zCZBlJm/HBfrSZ8iTpYix3VX1vU4mveiLpiwmOJT4wokTF9m6HUk4KqWQ== + version "2.4.2" + resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.4.2.tgz#7b57e73b3a48029ad10ebd44f74b01722a4cb069" + integrity sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q== dependencies: kleur "^3.0.3" sisteransi "^1.0.5" @@ -7241,7 +8186,7 @@ protoduck@^5.0.1: dependencies: genfun "^5.0.0" -psl@^1.1.28: +psl@^1.1.28, psl@^1.1.33: version "1.8.0" resolved "https://registry.yarnpkg.com/psl/-/psl-1.8.0.tgz#9326f8bcfb013adcc005fdff056acce020e51c24" integrity sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ== @@ -7281,11 +8226,33 @@ q@^1.5.1: resolved "https://registry.yarnpkg.com/q/-/q-1.5.1.tgz#7e32f75b41381291d04611f1bf14109ac00651d7" integrity sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc= +qs@^6.9.4: + version "6.10.1" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.10.1.tgz#4931482fa8d647a5aab799c5271d2133b981fb6a" + integrity sha512-M528Hph6wsSVOBiYUnGf+K/7w0hNshs/duGsNXPUCLH5XAqjEtiPGwNONLV0tBH8NoGb0mvD5JubnUTrujKDTg== + dependencies: + side-channel "^1.0.4" + qs@~6.5.2: version "6.5.2" resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA== +query-string@^6.13.8: + version "6.14.1" + resolved "https://registry.yarnpkg.com/query-string/-/query-string-6.14.1.tgz#7ac2dca46da7f309449ba0f86b1fd28255b0c86a" + integrity sha512-XDxAeVmpfu1/6IjyT/gXHOl+S0vQ9owggJ30hhWKdHAsNPOcasn5o9BW0eejZqL2e4vMjhAxoW3jVHcD6mbcYw== + dependencies: + decode-uri-component "^0.2.0" + filter-obj "^1.1.0" + split-on-first "^1.0.0" + strict-uri-encode "^2.0.0" + +queue-microtask@^1.2.2: + version "1.2.3" + resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" + integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A== + quick-lru@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-1.1.0.tgz#4360b17c61136ad38078397ff11416e186dcfbb8" @@ -7296,20 +8263,10 @@ quick-lru@^4.0.1: resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-4.0.1.tgz#5b8878f113a58217848c6482026c73e1ba57727f" integrity sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g== -rc@~1.2.8: - version "1.2.8" - resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" - integrity sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw== - dependencies: - deep-extend "^0.6.0" - ini "~1.3.0" - minimist "^1.2.0" - strip-json-comments "~2.0.1" - react-is@^17.0.1: - version "17.0.1" - resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.1.tgz#5b3531bd76a645a4c9fb6e693ed36419e3301339" - integrity sha512-NAnt2iGDXohE5LI7uBnLnqvLQMtzhkiAOLXTmv+qnF9Ky7xAPcX8Up/xWIhxvLVGJvuLiNc4xQLtuqDRzb4fSA== + version "17.0.2" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0" + integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w== read-cmd-shim@^1.0.1: version "1.0.5" @@ -7345,14 +8302,6 @@ read-pkg-up@^1.0.1: find-up "^1.0.0" read-pkg "^1.0.0" -read-pkg-up@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-2.0.0.tgz#6b72a8048984e0c41e79510fd5e9fa99b3b549be" - integrity sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4= - dependencies: - find-up "^2.0.0" - read-pkg "^2.0.0" - read-pkg-up@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-3.0.0.tgz#3ed496685dba0f8fe118d0691dc51f4a1ff96f07" @@ -7379,15 +8328,6 @@ read-pkg@^1.0.0: normalize-package-data "^2.3.2" path-type "^1.0.0" -read-pkg@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-2.0.0.tgz#8ef1c0623c6a6db0dc6713c4bfac46332b2368f8" - integrity sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg= - dependencies: - load-json-file "^2.0.0" - normalize-package-data "^2.3.2" - path-type "^2.0.0" - read-pkg@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-3.0.0.tgz#9cbc686978fee65d16c00e2b19c237fcf6e38389" @@ -7427,7 +8367,7 @@ read@1, read@~1.0.1: string_decoder "~1.1.1" util-deprecate "~1.0.1" -"readable-stream@2 || 3", readable-stream@^3.0.2: +"readable-stream@2 || 3", readable-stream@3, readable-stream@^3.0.0, readable-stream@^3.0.2: version "3.6.0" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198" integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== @@ -7446,6 +8386,13 @@ readdir-scoped-modules@^1.0.0: graceful-fs "^4.1.2" once "^1.3.0" +readdirp@~3.6.0: + version "3.6.0" + resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.6.0.tgz#74a370bd857116e245b29cc97340cd431a02a6c7" + integrity sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA== + dependencies: + picomatch "^2.2.1" + rechoir@^0.6.2: version "0.6.2" resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384" @@ -7478,9 +8425,9 @@ redent@^3.0.0: strip-indent "^3.0.0" regenerator-runtime@^0.13.4: - version "0.13.7" - resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.7.tgz#cac2dacc8a1ea675feaabaeb8ae833898ae46f55" - integrity sha512-a54FxoJDIr27pgf7IgeQGxmqUNYrcV338lf/6gH456HZ/PhX+5BcwHXG9ajESmwe6WRO0tAzRUrRmNONWgkrew== + version "0.13.9" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz#8925742a98ffd90814988d7566ad30ca3b263b52" + integrity sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA== regex-not@^1.0.0, regex-not@^1.0.2: version "1.0.2" @@ -7490,20 +8437,15 @@ regex-not@^1.0.0, regex-not@^1.0.2: extend-shallow "^3.0.2" safe-regex "^1.1.0" -regexpp@^3.0.0, regexpp@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.1.0.tgz#206d0ad0a5648cffbdb8ae46438f3dc51c9f78e2" - integrity sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q== - -remove-trailing-separator@^1.0.1: - version "1.1.0" - resolved "https://registry.yarnpkg.com/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz#c24bce2a283adad5bc3f58e0d48249b92379d8ef" - integrity sha1-wkvOKig62tW8P1jg1IJJuSN52O8= +regexpp@^3.1.0, regexpp@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.2.0.tgz#0425a2768d8f23bad70ca4b90461fa2f1213e1b2" + integrity sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg== repeat-element@^1.1.2: - version "1.1.3" - resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.3.tgz#782e0d825c0c5a3bb39731f84efee6b742e6b1ce" - integrity sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g== + version "1.1.4" + resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.4.tgz#be681520847ab58c7568ac75fbfad28ed42d39e9" + integrity sha512-LFiNfRcSu7KK3evMyYOuCzv3L10TW7yC1G2/+StMjK8Y6Vqd2MG7r/Qjw4ghtuCOjFvlnms/iMmLqpvW/ES/WQ== repeat-string@^1.6.1: version "1.6.1" @@ -7517,23 +8459,7 @@ repeating@^2.0.0: dependencies: is-finite "^1.0.0" -request-promise-core@1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/request-promise-core/-/request-promise-core-1.1.4.tgz#3eedd4223208d419867b78ce815167d10593a22f" - integrity sha512-TTbAfBBRdWD7aNNOoVOBH4pN/KigV6LyapYNNlAPA8JwbovRti1E88m3sYAwsLi5ryhPKsE9APwnjFTgdUjTpw== - dependencies: - lodash "^4.17.19" - -request-promise-native@^1.0.8: - version "1.0.9" - resolved "https://registry.yarnpkg.com/request-promise-native/-/request-promise-native-1.0.9.tgz#e407120526a5efdc9a39b28a5679bf47b9d9dc28" - integrity sha512-wcW+sIUiWnKgNY0dqCpOZkUbF/I+YPi+f09JZIDa39Ec+q82CpSYniDp+ISgTTbKmnpJWASeJBPZmoxH84wt3g== - dependencies: - request-promise-core "1.1.4" - stealthy-require "^1.1.1" - tough-cookie "^2.3.3" - -request@^2.88.0, request@^2.88.2: +request@^2.88.0: version "2.88.2" resolved "https://registry.yarnpkg.com/request/-/request-2.88.2.tgz#d73c918731cb5a87da047e207234146f664d12b3" integrity sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw== @@ -7564,7 +8490,7 @@ require-directory@^2.1.1: resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I= -require-from-string@^2.0.2: +require-from-string@^2.0.1, require-from-string@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909" integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw== @@ -7630,7 +8556,27 @@ resolve-url@^0.2.1: resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" integrity sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo= -resolve@^1.1.6, resolve@^1.10.0, resolve@^1.13.1, resolve@^1.17.0, resolve@^1.18.1, resolve@^1.3.2: +resolve.exports@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/resolve.exports/-/resolve.exports-1.1.0.tgz#5ce842b94b05146c0e03076985d1d0e7e48c90c9" + integrity sha512-J1l+Zxxp4XK3LUDZ9m60LRJF/mAe4z6a4xyabPHk7pvK5t35dACV32iIjJDFeWZFfZlO29w6SZ67knR0tHzJtQ== + +resolve@^1.1.6, resolve@^1.10.0, resolve@^1.20.0, resolve@^1.3.2: + version "1.20.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.20.0.tgz#629a013fb3f70755d6f0b7935cc1c2c5378b1975" + integrity sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A== + dependencies: + is-core-module "^2.2.0" + path-parse "^1.0.6" + +resolve@~1.17.0: + version "1.17.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.17.0.tgz#b25941b54968231cc2d1bb76a79cb7f2c0bf8444" + integrity sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w== + dependencies: + path-parse "^1.0.6" + +resolve@~1.19.0: version "1.19.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.19.0.tgz#1af5bf630409734a067cae29318aac7fa29a267c" integrity sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg== @@ -7683,20 +8629,27 @@ rimraf@^2.5.4, rimraf@^2.6.2, rimraf@^2.6.3: dependencies: glob "^7.1.3" -rsvp@^4.8.4: - version "4.8.5" - resolved "https://registry.yarnpkg.com/rsvp/-/rsvp-4.8.5.tgz#c8f155311d167f68f21e168df71ec5b083113734" - integrity sha512-nfMOlASu9OnRJo1mbEk2cz0D56a1MBNrJ7orjRZQG10XDyuvwksKbuXNp6qa+kbn839HwjwhBzhFmdsaEAfauA== - run-async@^2.2.0, run-async@^2.4.0: version "2.4.1" resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.4.1.tgz#8440eccf99ea3e70bd409d49aab88e10c189a455" integrity sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ== +run-con@~1.2.10: + version "1.2.10" + resolved "https://registry.yarnpkg.com/run-con/-/run-con-1.2.10.tgz#90de9d43d20274d00478f4c000495bd72f417d22" + integrity sha512-n7PZpYmMM26ZO21dd8y3Yw1TRtGABjRtgPSgFS/nhzfvbJMXFtJhJVyEgayMiP+w/23craJjsnfDvx4W4ue/HQ== + dependencies: + deep-extend "^0.6.0" + ini "~2.0.0" + minimist "^1.2.5" + strip-json-comments "~3.1.1" + run-parallel@^1.1.9: - version "1.1.9" - resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.1.9.tgz#c9dd3a7cf9f4b2c4b6244e173a6ed866e61dd679" - integrity sha512-DEqnSRTDw/Tc3FXf49zedI638Z9onwUotBMiUFKmrO2sdFKIbXamXGQ3Axd4qgphxKB4kw/qP1w5kTxnfU1B9Q== + version "1.2.0" + resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" + integrity sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA== + dependencies: + queue-microtask "^1.2.2" run-queue@^1.0.0, run-queue@^1.0.3: version "1.0.3" @@ -7705,14 +8658,26 @@ run-queue@^1.0.0, run-queue@^1.0.3: dependencies: aproba "^1.1.1" -rxjs@^6.4.0, rxjs@^6.6.0, rxjs@^6.6.3: - version "6.6.3" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.6.3.tgz#8ca84635c4daa900c0d3967a6ee7ac60271ee552" - integrity sha512-trsQc+xYYXZ3urjOiJOuCOa5N3jAZ3eiSpQB5hIT8zGlL2QfnHLJ2r7GMkBGuIausdJN1OneaI6gQlsqNHHmZQ== +rxjs-for-await@0.0.2: + version "0.0.2" + resolved "https://registry.yarnpkg.com/rxjs-for-await/-/rxjs-for-await-0.0.2.tgz#26598a1d6167147cc192172970e7eed4e620384b" + integrity sha512-IJ8R/ZCFMHOcDIqoABs82jal00VrZx8Xkgfe7TOKoaRPAW5nH/VFlG23bXpeGdrmtqI9UobFPgUKgCuFc7Lncw== + +rxjs@6.5.5: + version "6.5.5" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.5.5.tgz#c5c884e3094c8cfee31bf27eb87e54ccfc87f9ec" + integrity sha512-WfQI+1gohdf0Dai/Bbmk5L5ItH5tYqm3ki2c5GdWhKjalzjg93N3avFjVStyZZz+A2Em+ZxKH5bNghw9UeylGQ== + dependencies: + tslib "^1.9.0" + +rxjs@^6.4.0, rxjs@^6.5.4, rxjs@^6.6.0, rxjs@^6.6.7: + 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" -safe-buffer@^5.0.1, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@^5.2.0, safe-buffer@~5.2.0: +safe-buffer@^5.0.1, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@^5.2.0, safe-buffer@^5.2.1, safe-buffer@~5.2.0: version "5.2.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== @@ -7734,22 +8699,7 @@ safe-regex@^1.1.0: resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== -sane@^4.0.3: - version "4.1.0" - resolved "https://registry.yarnpkg.com/sane/-/sane-4.1.0.tgz#ed881fd922733a6c461bc189dc2b6c006f3ffded" - integrity sha512-hhbzAgTIX8O7SHfp2c8/kREfEn4qO/9q8C9beyY6+tvZ87EpoZ3i1RIEvp27YBswnNbY9mWd6paKVmKbAgLfZA== - dependencies: - "@cnakazawa/watch" "^1.0.3" - anymatch "^2.0.0" - capture-exit "^2.0.0" - exec-sh "^0.3.2" - execa "^1.0.0" - fb-watchman "^2.0.0" - micromatch "^3.1.4" - minimist "^1.1.1" - walker "~1.0.5" - -saxes@^5.0.0: +saxes@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/saxes/-/saxes-5.0.1.tgz#eebab953fa3b7608dbe94e5dadb15c888fa6696d" integrity sha512-5LBh1Tls8c9xgGjw3QrMwETmTMVk0oFgvrFSvWx62llR2hcEInrKNZ2GZCCuuy2lvWrdl5jhbpeqc5hRYKFOcw== @@ -7766,23 +8716,20 @@ semver-compare@^1.0.0: resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== -semver@7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.0.0.tgz#5f3ca35761e47e05b206c6daff2cf814f0316b8e" - integrity sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A== - -semver@7.3.2: - version "7.3.2" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.2.tgz#604962b052b81ed0786aae84389ffba70ffd3938" - integrity sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ== - -semver@7.x, semver@^7.2.1, semver@^7.3.2: +semver@7.3.4: version "7.3.4" resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.4.tgz#27aaa7d2e4ca76452f98d3add093a72c943edc97" integrity sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw== dependencies: lru-cache "^6.0.0" +semver@7.3.5, semver@7.x, semver@^7.2.1, semver@^7.3.2, semver@^7.3.4, semver@^7.3.5, semver@~7.3.0: + version "7.3.5" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.5.tgz#0b621c879348d8998e4b0e4be94b3f12e6018ef7" + integrity sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ== + dependencies: + lru-cache "^6.0.0" + semver@^6.0.0, semver@^6.2.0, semver@^6.3.0: version "6.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" @@ -7834,6 +8781,11 @@ shebang-regex@^3.0.0: resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== +shell-quote@^1.6.1: + version "1.7.2" + resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.7.2.tgz#67a7d02c76c9da24f99d20808fcaded0e0e04be2" + integrity sha512-mRz/m/JVscCrkMyPqHc/bczi3OQHkLTqXHEFu0zDhK/qfv3UcOA4SVmRCLmos4bhjr9ekVQubj/R7waKapmiQg== + shelljs@^0.8.3: version "0.8.4" resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.4.tgz#de7684feeb767f8716b326078a8a00875890e3c2" @@ -7843,15 +8795,19 @@ shelljs@^0.8.3: interpret "^1.0.0" rechoir "^0.6.2" -shellwords@^0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b" - integrity sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww== +side-channel@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.4.tgz#efce5c8fdc104ee751b25c58d4290011fa5ea2cf" + integrity sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw== + dependencies: + call-bind "^1.0.0" + get-intrinsic "^1.0.2" + object-inspect "^1.9.0" -signal-exit@^3.0.0, signal-exit@^3.0.2: - version "3.0.3" - resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.3.tgz#a1410c2edd8f077b08b4e253c8eacfcaf057461c" - integrity sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA== +signal-exit@^3.0.0, signal-exit@^3.0.2, signal-exit@^3.0.3: + version "3.0.5" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.5.tgz#9e3e8cc0c75a99472b44321033a7702e7738252f" + integrity sha512-KWcOiKeQj6ZyXx7zq4YxSMgHRlod4czeBQZrPb8OKcohcqAXShm7E20kEMle9WBt26hFcAf0qLOcp5zmY7kOqQ== sisteransi@^1.0.5: version "1.0.5" @@ -7892,9 +8848,9 @@ slide@^1.1.6: integrity sha1-VusCfWW00tzmyy4tMsTUr8nh1wc= smart-buffer@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/smart-buffer/-/smart-buffer-4.1.0.tgz#91605c25d91652f4661ea69ccf45f1b331ca21ba" - integrity sha512-iVICrxOzCynf/SNaBQCw34eM9jROU/s5rzIhpOvzhzuYHfJR/DhZfDkXiZSgKXfgv26HT3Yni3AV/DGw0cGnnw== + version "4.2.0" + resolved "https://registry.yarnpkg.com/smart-buffer/-/smart-buffer-4.2.0.tgz#6e1d71fa4f18c05f7d0ff216dd16a481d0e8d9ae" + integrity sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg== snapdragon-node@^2.0.1: version "2.1.1" @@ -7961,17 +8917,17 @@ source-map-resolve@^0.5.0: urix "^0.1.0" source-map-support@^0.5.17, source-map-support@^0.5.6: - 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== + version "0.5.20" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.20.tgz#12166089f8f5e5e8c56926b377633392dd2cb6c9" + integrity sha512-n1lZZ8Ve4ksRqizaBQgxXDgKwttHDhyfQjA6YZZn8+AroHbsIz+JjwxQDxbp+7y5OYCI8t1Yk7etjD9CRd2hIw== dependencies: buffer-from "^1.0.0" source-map "^0.6.0" source-map-url@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3" - integrity sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM= + version "0.4.1" + resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.1.tgz#0af66605a745a5a2f91cf1bbf8a7afbc283dec56" + integrity sha512-cPiFOTLUKvJFIg4SKVScy4ilPPW6rFgMgfuZJPNoDuMs3nC1HbMUycBoJw77xFIp6z1UJQJOfx6C9GMH80DiTw== source-map@^0.5.0, source-map@^0.5.6: version "0.5.7" @@ -8010,9 +8966,14 @@ spdx-expression-parse@^3.0.0: spdx-license-ids "^3.0.0" spdx-license-ids@^3.0.0: - version "3.0.5" - resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.5.tgz#3694b5804567a458d3c8045842a6358632f62654" - integrity sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q== + 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== + +split-on-first@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/split-on-first/-/split-on-first-1.1.0.tgz#f610afeee3b12bce1d0c30425e76398b78249a5f" + integrity sha512-43ZssAJaMusuKWL8sKUBQXHWOpq8d6CfN/u1p4gUzfJkM05C8rxTmYrkIPTXapZpORA6LkkzcUulJ8FqA7Uudw== split-string@^3.0.1, split-string@^3.0.2: version "3.1.0" @@ -8028,6 +8989,13 @@ split2@^2.0.0: dependencies: through2 "^2.0.2" +split2@^3.0.0: + 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: version "1.0.1" resolved "https://registry.yarnpkg.com/split/-/split-1.0.1.tgz#605bd9be303aa59fb35f9229fbea0ddec9ea07d9" @@ -8056,16 +9024,16 @@ sshpk@^1.7.0: tweetnacl "~0.14.0" ssri@^6.0.0, ssri@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/ssri/-/ssri-6.0.1.tgz#2a3c41b28dd45b62b63676ecb74001265ae9edd8" - integrity sha512-3Wge10hNcT1Kur4PDFwEieXSCMCJs/7WvSACcrMYrNp+b8kDL1/0wJch5Ni2WrtwEa2IO8OsVfeKIciKCDx/QA== + version "6.0.2" + resolved "https://registry.yarnpkg.com/ssri/-/ssri-6.0.2.tgz#157939134f20464e7301ddba3e90ffa8f7728ac5" + integrity sha512-cepbSq/neFK7xB6A50KHN0xHDotYzq58wWCa5LeWqnPrHG8GzfEjO/4O8kpmcGW+oaxkvhEJCWgbgNk4/ZV93Q== dependencies: figgy-pudding "^3.5.1" -stack-utils@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-2.0.2.tgz#5cf48b4557becb4638d0bc4f21d23f5d19586593" - integrity sha512-0H7QK2ECz3fyZMzQ8rH0j2ykpfbnd20BFtfg/SqVC2+sCTtcw0aDTGB7dk+de4U4uUeuz6nOtJcrkFFLG1B0Rg== +stack-utils@^2.0.3: + version "2.0.5" + resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-2.0.5.tgz#d25265fca995154659dbbfba3b49254778d2fdd5" + integrity sha512-xrQcmYhOsn/1kX+Vraq+7j4oE2j/6BFscZ0etmYg81xuM8Gq0022Pxb8+IqgOFUIaxHs0KaSb7T1+OegiNrNFA== dependencies: escape-string-regexp "^2.0.0" @@ -8077,11 +9045,6 @@ static-extend@^0.1.1: define-property "^0.2.5" object-copy "^0.1.0" -stealthy-require@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/stealthy-require/-/stealthy-require-1.1.1.tgz#35b09875b4ff49f26a777e509b3090a3226bf24b" - integrity sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks= - stream-each@^1.1.0: version "1.2.3" resolved "https://registry.yarnpkg.com/stream-each/-/stream-each-1.2.3.tgz#ebe27a0c389b04fbcc233642952e10731afa9bae" @@ -8095,15 +9058,20 @@ stream-shift@^1.0.0: resolved "https://registry.yarnpkg.com/stream-shift/-/stream-shift-1.0.1.tgz#d7088281559ab2778424279b0877da3c392d5a3d" integrity sha512-AiisoFqQ0vbGcZgQPY1cdP2I76glaVA/RauYR4G4thNFgkTqr90yXTo4LYX60Jl+sIlPNHHdGSwo01AvbKUSVQ== -string-argv@0.3.1: +strict-uri-encode@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz#b9c7330c7042862f6b142dc274bbcc5866ce3546" + integrity sha1-ucczDHBChi9rFC3CdLvMWGbONUY= + +string-argv@0.3.1, string-argv@~0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/string-argv/-/string-argv-0.3.1.tgz#95e2fbec0427ae19184935f816d74aaa4c5c19da" integrity sha512-a1uQGz7IyVy9YwhqjZIZu1c8JO8dNIe20xBmSS6qu9kv++k3JGzCVmprbNN5Kn+BgzD5E7YYwg1CcjuJMRNsvg== string-length@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/string-length/-/string-length-4.0.1.tgz#4a973bf31ef77c4edbceadd6af2611996985f8a1" - integrity sha512-PKyXUd0LK0ePjSOnWn34V2uD6acUWev9uy0Ft05k0E8xRW+SKcA0F7eMr7h5xlzfn+4O3N+55rduYyet3Jk+jw== + version "4.0.2" + resolved "https://registry.yarnpkg.com/string-length/-/string-length-4.0.2.tgz#a8a8dc7bd5c1a82b9b3c8b87e125f66871b6e57a" + integrity sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ== dependencies: char-regex "^1.0.2" strip-ansi "^6.0.0" @@ -8134,30 +9102,39 @@ string-width@^3.0.0, string-width@^3.1.0: is-fullwidth-code-point "^2.0.0" strip-ansi "^5.1.0" -string-width@^4.1.0, string-width@^4.2.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.0.tgz#952182c46cc7b2c313d1596e623992bd163b72b5" - integrity sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg== +string-width@^4.1.0, string-width@^4.2.0, 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== dependencies: emoji-regex "^8.0.0" is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.0" + strip-ansi "^6.0.1" -string.prototype.trimend@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.1.tgz#85812a6b847ac002270f5808146064c995fb6913" - integrity sha512-LRPxFUaTtpqYsTeNKaFOw3R4bxIzWOnbQ837QfBylo8jIxtcbK/A/sMV7Q+OAV/vWo+7s25pOE10KYSjaSO06g== +string.prototype.padend@^3.0.0: + version "3.1.3" + resolved "https://registry.yarnpkg.com/string.prototype.padend/-/string.prototype.padend-3.1.3.tgz#997a6de12c92c7cb34dc8a201a6c53d9bd88a5f1" + integrity sha512-jNIIeokznm8SD/TZISQsZKYu7RJyheFNt84DUPrh482GC8RVp2MKqm2O5oBRdGxbDQoXrhhWtPIWQOiy20svUg== dependencies: + call-bind "^1.0.2" define-properties "^1.1.3" - es-abstract "^1.17.5" + es-abstract "^1.19.1" -string.prototype.trimstart@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.1.tgz#14af6d9f34b053f7cfc89b72f8f2ee14b9039a54" - integrity sha512-XxZn+QpvrBI1FOcg6dIpxUPgWCPuNXvMD72aaRaUQv1eD4e/Qy8i/hFTe0BUmD60p/QA6bh1avmuPTfNjqVWRw== +string.prototype.trimend@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz#e75ae90c2942c63504686c18b287b4a0b1a45f80" + integrity sha512-y9xCjw1P23Awk8EvTpcyL2NIr1j7wJ39f+k6lvRnSMz+mz9CGz9NYPelDk42kOz6+ql8xjfK8oYzy3jAP5QU5A== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.3" + +string.prototype.trimstart@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz#b36399af4ab2999b4c9c648bd7a3fb2bb26feeed" + integrity sha512-jh6e984OBfvxS50tdY2nRZnoC5/mLFKOREQfw8t5yytkoUsJRNxvI/E39qu1sD0OtWI3OC0XgKSmcWwziwYuZw== dependencies: + call-bind "^1.0.2" define-properties "^1.1.3" - es-abstract "^1.17.5" string_decoder@^1.1.1: version "1.3.0" @@ -8173,7 +9150,7 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" -stringify-object@^3.3.0: +stringify-object@3.3.0: version "3.3.0" resolved "https://registry.yarnpkg.com/stringify-object/-/stringify-object-3.3.0.tgz#703065aefca19300d3ce88af4f5b3956d7556629" integrity sha512-rHqiFh1elqCQ9WPLIC8I0Q/g/wj5J1eMkyoiD6eoQApWHP0FtlK7rqnhmabL5VUY9JQCcqwwvlOaSuutekgyrw== @@ -8182,6 +9159,13 @@ stringify-object@^3.3.0: is-obj "^1.0.1" is-regexp "^1.0.0" +strip-ansi@6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.0.tgz#0b1571dd7669ccd4f3e06e14ef1eed26225ae532" + integrity sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w== + dependencies: + ansi-regex "^5.0.0" + strip-ansi@^3.0.0, strip-ansi@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" @@ -8203,12 +9187,12 @@ strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0: dependencies: ansi-regex "^4.1.0" -strip-ansi@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.0.tgz#0b1571dd7669ccd4f3e06e14ef1eed26225ae532" - integrity sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w== +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.0" + ansi-regex "^5.0.1" strip-bom@4.0.0, strip-bom@^4.0.0: version "4.0.0" @@ -8261,16 +9245,11 @@ strip-json-comments@3.0.1: resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.0.1.tgz#85713975a91fb87bf1b305cca77395e40d2a64a7" integrity sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw== -strip-json-comments@^3.1.0, strip-json-comments@^3.1.1: +strip-json-comments@^3.1.0, 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== -strip-json-comments@~2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" - integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= - strong-log-transformer@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/strong-log-transformer/-/strong-log-transformer-2.1.0.tgz#0f5ed78d325e0421ac6f90f7f10e691d6ae3ae10" @@ -8280,6 +9259,13 @@ strong-log-transformer@^2.0.0: minimist "^1.2.0" through "^2.3.4" +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" @@ -8295,9 +9281,9 @@ supports-color@^7.0.0, supports-color@^7.1.0: has-flag "^4.0.0" supports-hyperlinks@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/supports-hyperlinks/-/supports-hyperlinks-2.1.0.tgz#f663df252af5f37c5d49bbd7eeefa9e0b9e59e47" - integrity sha512-zoE5/e+dnEijk6ASB6/qrK+oYdm2do1hjoLWrqUC/8WEIW1gbxFcKuBof7sW8ArN6e+AYvsE8HBGiVRWL/F5CA== + version "2.2.0" + resolved "https://registry.yarnpkg.com/supports-hyperlinks/-/supports-hyperlinks-2.2.0.tgz#4f77b42488765891774b70c79babd87f9bd594bb" + integrity sha512-6sXEzV5+I5j8Bmq9/vUphGRM/RJNT9SCURJLjwfOg51heRtguGWDzcaBlgAzKhQa0EVNpPEKzQuBwZ8S8WaCeQ== dependencies: has-flag "^4.0.0" supports-color "^7.0.0" @@ -8307,28 +9293,47 @@ symbol-tree@^3.2.4: resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw== -table@^6.0.4: - version "6.0.7" - resolved "https://registry.yarnpkg.com/table/-/table-6.0.7.tgz#e45897ffbcc1bcf9e8a87bf420f2c9e5a7a52a34" - integrity sha512-rxZevLGTUzWna/qBLObOe16kB2RTnnbhciwgPbMMlazz1yZGVEgnZK762xyVdVznhqxrfCeBMmMkgOOaPwjH7g== +table@^6.0.9: + version "6.7.2" + resolved "https://registry.yarnpkg.com/table/-/table-6.7.2.tgz#a8d39b9f5966693ca8b0feba270a78722cbaf3b0" + integrity sha512-UFZK67uvyNivLeQbVtkiUs8Uuuxv24aSL4/Vil2PJVtMgU8Lx0CYkP12uCGa3kjyQzOSgV1+z9Wkb82fCGsO0g== dependencies: - ajv "^7.0.2" - lodash "^4.17.20" + ajv "^8.0.1" + lodash.clonedeep "^4.5.0" + lodash.truncate "^4.4.2" slice-ansi "^4.0.0" - string-width "^4.2.0" + string-width "^4.2.3" + strip-ansi "^6.0.1" + +tapable@^2.2.0: + version "2.2.1" + resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.1.tgz#1967a73ef4060a82f12ab96af86d52fdb76eeca0" + integrity sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ== + +tar@6.1.11: + version "6.1.11" + resolved "https://registry.yarnpkg.com/tar/-/tar-6.1.11.tgz#6760a38f003afa1b2ffd0ffe9e9abbd0eab3d621" + integrity sha512-an/KZQzQUkZCkuoAA64hM92X0Urb6VpRhAFllDzz44U2mcD5scmT3zBc4VgVpkugF580+DQn8eAFSyoQt0tznA== + dependencies: + chownr "^2.0.0" + fs-minipass "^2.0.0" + minipass "^3.0.0" + minizlib "^2.1.1" + mkdirp "^1.0.3" + yallist "^4.0.0" tar@^4.4.10, tar@^4.4.12, tar@^4.4.8: - version "4.4.13" - resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.13.tgz#43b364bc52888d555298637b10d60790254ab525" - integrity sha512-w2VwSrBoHa5BsSyH+KxEqeQBAllHhccyMFVHtGtdMpF4W7IRWfZjFiQceJPChOeTsSDVUpER2T8FA93pr0L+QA== + version "4.4.19" + resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.19.tgz#2e4d7263df26f2b914dee10c825ab132123742f3" + integrity sha512-a20gEsvHnWe0ygBY8JbxoM4w3SJdhc7ZAuxkLqh+nvNQN2IOt0B5lLgM490X5Hl8FF0dl0tOf2ewFYAlIFgzVA== dependencies: - chownr "^1.1.1" - fs-minipass "^1.2.5" - minipass "^2.8.6" - minizlib "^1.2.1" - mkdirp "^0.5.0" - safe-buffer "^5.1.2" - yallist "^3.0.3" + chownr "^1.1.4" + fs-minipass "^1.2.7" + minipass "^2.9.0" + minizlib "^1.3.3" + mkdirp "^0.5.5" + safe-buffer "^5.2.1" + yallist "^3.1.1" temp-dir@^1.0.0: version "1.0.0" @@ -8388,10 +9393,10 @@ thenify-all@^1.0.0: dependencies: any-promise "^1.0.0" -throat@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/throat/-/throat-5.0.0.tgz#c5199235803aad18754a667d659b5e72ce16764b" - integrity sha512-fcwX4mndzpLQKBS1DVYhGAcYaYt7vsHNIvQV+WXMvnow5cgjPphq5CaayLaGsjRdSCKZFNGt7/GYAuXaNOiYCA== +throat@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/throat/-/throat-6.0.1.tgz#d514fedad95740c12c2d7fc70ea863eb51ade375" + integrity sha512-8hmiGIJMDlwjg7dlJ4yKGLK8EsYqKgPWbG3b4wjJddKNwc7N7Dpn08Df4szr/sZdMVeOstrdYSsqzX6BYbcB+w== through2@^2.0.0, through2@^2.0.2: version "2.0.5" @@ -8409,29 +9414,41 @@ through2@^3.0.0: inherits "^2.0.4" readable-stream "2 || 3" +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" integrity sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU= -tmp@^0.0.33: - version "0.0.33" - resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" - integrity sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw== - dependencies: - os-tmpdir "~1.0.2" +timsort@~0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/timsort/-/timsort-0.3.0.tgz#405411a8e7e6339fe64db9a234de11dc31e02bd4" + integrity sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q= -tmp@^0.2.1: +tmp@*, tmp@^0.2.1, tmp@~0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.2.1.tgz#8457fc3037dcf4719c251367a1af6500ee1ccf14" integrity sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ== dependencies: rimraf "^3.0.0" +tmp@^0.0.33: + version "0.0.33" + resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" + integrity sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw== + dependencies: + os-tmpdir "~1.0.2" + tmpl@1.0.x: - version "1.0.4" - resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.4.tgz#23640dd7b42d00433911140820e5cf440e521dd1" - integrity sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE= + version "1.0.5" + resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.5.tgz#8683e0b902bb9c20c4f726e3c0b69f36518c07cc" + integrity sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw== to-fast-properties@^2.0.0: version "2.0.0" @@ -8470,20 +9487,20 @@ to-regex@^3.0.1, to-regex@^3.0.2: regex-not "^1.0.2" safe-regex "^1.1.0" -tough-cookie@^2.3.3, tough-cookie@~2.5.0: - version "2.5.0" - resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2" - integrity sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g== +tough-cookie@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-4.0.0.tgz#d822234eeca882f991f0f908824ad2622ddbece4" + integrity sha512-tHdtEpQCMrc1YLrMaqXXcj6AxhYi/xgit6mZu1+EDWUn+qhUf8wMQoFIy9NXuq23zAwtcB0t/MjACGR18pcRbg== dependencies: - psl "^1.1.28" + psl "^1.1.33" punycode "^2.1.1" + universalify "^0.1.2" -tough-cookie@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-3.0.1.tgz#9df4f57e739c26930a018184887f4adb7dca73b2" - integrity sha512-yQyJ0u4pZsv9D4clxO69OEjLWYw+jbgspjTue4lTQZLfV0c5l1VmK2y1JK8E9ahdpltPOaAThPcp5nKPUgSnsg== +tough-cookie@~2.5.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2" + integrity sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g== dependencies: - ip-regex "^2.1.0" psl "^1.1.28" punycode "^2.1.1" @@ -8494,13 +9511,18 @@ tr46@^1.0.1: dependencies: punycode "^2.1.0" -tr46@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/tr46/-/tr46-2.0.2.tgz#03273586def1595ae08fedb38d7733cee91d2479" - integrity sha512-3n1qG+/5kg+jrbTzwAykB5yRYtQCTqOGKq5U5PE3b0a1/mzo6snDhjGS0zJVJunO0NrT3Dg1MLy5TjWP/UJppg== +tr46@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/tr46/-/tr46-2.1.0.tgz#fa87aa81ca5d5941da8cbf1f9b749dc969a4e240" + integrity sha512-15Ih7phfcdP5YxqiB+iDtLoaTz4Nd35+IiAv0kQ5FNKHzXgdWqPoTIqEDDJmXceQt4JZk6lVPT8lnDlPpGDppw== dependencies: punycode "^2.1.1" +tr46@~0.0.3: + version "0.0.3" + resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" + integrity sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o= + trim-newlines@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-1.0.0.tgz#5887966bb582a4503a41eb524f7d35011815a613" @@ -8512,33 +9534,43 @@ trim-newlines@^2.0.0: integrity sha1-tAPQuRvlDDMd/EuC7s6yLD3hbSA= trim-newlines@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-3.0.0.tgz#79726304a6a898aa8373427298d54c2ee8b1cb30" - integrity sha512-C4+gOpvmxaSMKuEf9Qc134F1ZuOHVXKRbtEflf4NTtuuJDEIJ9p5PXsalL8SkeRw+qit1Mo+yuvMPAKwWg/1hA== - -trim-off-newlines@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/trim-off-newlines/-/trim-off-newlines-1.0.1.tgz#9f9ba9d9efa8764c387698bcbfeb2c848f11adb3" - integrity sha1-n5up2e+odkw4dpi8v+sshI8RrbM= + 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== -ts-jest@^26.5.1: - version "26.5.1" - resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-26.5.1.tgz#4d53ee4481552f57c1624f0bd3425c8b17996150" - integrity sha512-G7Rmo3OJMvlqE79amJX8VJKDiRcd7/r61wh9fnvvG8cAjhA9edklGw/dCxRSQmfZ/z8NDums5srSVgwZos1qfg== +ts-jest@^27.0.5: + version "27.0.7" + resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-27.0.7.tgz#fb7c8c8cb5526ab371bc1b23d06e745652cca2d0" + integrity sha512-O41shibMqzdafpuP+CkrOL7ykbmLh+FqQrXEmV9CydQ5JBk0Sj0uAEF5TNNe94fZWKm3yYvWa/IbyV4Yg1zK2Q== dependencies: - "@types/jest" "26.x" bs-logger "0.x" - buffer-from "1.x" fast-json-stable-stringify "2.x" - jest-util "^26.1.0" + jest-util "^27.0.0" json5 "2.x" - lodash "4.x" + lodash.memoize "4.x" make-error "1.x" - mkdirp "1.x" semver "7.x" yargs-parser "20.x" -ts-node@^9.0.0: +ts-node@^10.4.0: + version "10.4.0" + resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.4.0.tgz#680f88945885f4e6cf450e7f0d6223dd404895f7" + integrity sha512-g0FlPvvCXSIO1JDF6S232P5jPYqBkRL9qly81ZgAOSU7rwI0stphCgd2kLiCrU9DjQCrJMWEqcNSjQL02s6d8A== + dependencies: + "@cspotcode/source-map-support" "0.7.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" + yn "3.1.1" + +ts-node@^9: version "9.1.1" resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-9.1.1.tgz#51a9a450a3e959401bda5f004a72d54b936d376d" integrity sha512-hPlt7ZACERQGf03M253ytLY3dHbGNGrAq9qIHWUY9XHYl1z7wYngSr3OQ5xmui8o2AaxsONxIzjafLUiWBo1Fg== @@ -8550,10 +9582,10 @@ ts-node@^9.0.0: source-map-support "^0.5.17" yn "3.1.1" -tsconfig-paths@^3.9.0: - version "3.9.0" - resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.9.0.tgz#098547a6c4448807e8fcb8eae081064ee9a3c90b" - integrity sha512-dRcuzokWhajtZWkQsDVKbWyY+jgcLC5sqJhg2PSgf4ZkH2aHPvaOY8YWGhmjb68b5qqTfasSsDO9k7RUiEmZAw== +tsconfig-paths@^3.11.0: + version "3.11.0" + resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.11.0.tgz#954c1fe973da6339c78e06b03ce2e48810b65f36" + integrity sha512-7ecdYDnIdmv639mmDwslG6KQg1Z9STTz1j7Gcz0xa+nshh/gKDAHcPxRbWOsA3SPp0tXP2leTcY9Kw+NAkfZzA== dependencies: "@types/json5" "^0.0.29" json5 "^1.0.1" @@ -8561,9 +9593,14 @@ tsconfig-paths@^3.9.0: strip-bom "^3.0.0" tslib@^1.13.0, tslib@^1.8.1, tslib@^1.9.0: - version "1.13.0" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.13.0.tgz#c881e13cc7015894ed914862d276436fa9a47043" - integrity sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q== + version "1.14.1" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" + integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== + +tslib@^2, tslib@^2.0.0: + version "2.3.1" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.1.tgz#e8a335add5ceae51aa261d32a490158ef042ef01" + integrity sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw== tslint@^6.1.3: version "6.1.3" @@ -8591,10 +9628,10 @@ tsutils@^2.29.0: dependencies: tslib "^1.8.1" -tsutils@^3.17.1: - version "3.20.0" - resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.20.0.tgz#ea03ea45462e146b53d70ce0893de453ff24f698" - integrity sha512-RYbuQuvkhuqVeXweWT3tJLKOEJ/UUw9GjNEZGWdrLLlM+611o1gwLHBpxoFJKKl25fLprp2eVthtKs5JOrNeXg== +tsutils@^3.21.0: + version "3.21.0" + resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623" + integrity sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA== dependencies: tslib "^1.8.1" @@ -8629,15 +9666,20 @@ type-detect@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== -type-fest@^0.11.0: - version "0.11.0" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.11.0.tgz#97abf0872310fed88a5c466b25681576145e33f1" - integrity sha512-OdjXJxnCN1AvyLSzeKIgXTXxV+99ZuXl3Hpo9XpJAv9MBcHrrJOQ5kV7ypXOuQie+AmWG25hLbiKdwYTifzcfQ== +type-fest@^0.18.0: + version "0.18.1" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.18.1.tgz#db4bc151a4a2cf4eebf9add5db75508db6cc841f" + integrity sha512-OIAYXk8+ISY+qTOwkHtKqzAuxchoMiD9Udx+FSGQDuiRR+PJKJHc2NJAXlbhkGwTt/4/nKZxELY1w3ReWOL8mw== -type-fest@^0.13.1: - version "0.13.1" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.13.1.tgz#0172cb5bce80b0bd542ea348db50c7e21834d934" - integrity sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg== +type-fest@^0.20.2: + version "0.20.2" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4" + integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ== + +type-fest@^0.21.3: + version "0.21.3" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37" + integrity sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w== type-fest@^0.3.0: version "0.3.1" @@ -8666,10 +9708,10 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@*, typescript@4.2.2, "typescript@>=3.3.1 <4.3.0", typescript@^4.1.0-dev.20201026: - version "4.2.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.2.2.tgz#1450f020618f872db0ea17317d16d8da8ddb8c4c" - integrity sha512-tbb+NVrLfnsJy3M59lsDgrzWIflR4d4TIUjz+heUnHZwdF7YsrMTKoRERiIvI2lvBG95dfpLxB21WZhys1bgaQ== +typescript@*, typescript@4.4.4, "typescript@>=3.3.1 <4.5.0", typescript@^4.1.0-dev.20201026, typescript@^4.4.3, typescript@~4.4.2: + version "4.4.4" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.4.4.tgz#2cd01a1a1f160704d3101fd5a58ff0f9fcb8030c" + integrity sha512-DqGhF5IKoBl8WNf8C1gu8q0xZSInh9j1kJJMqT3a94w1JzVaBU4EXOSMrz9yDqMT0xt3selp83fuFMQ0uzv6qA== uc.micro@^1.0.1, uc.micro@^1.0.5: version "1.0.6" @@ -8677,9 +9719,9 @@ uc.micro@^1.0.1, uc.micro@^1.0.5: integrity sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA== uglify-js@^3.1.4: - version "3.10.2" - resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.10.2.tgz#8cfa1209fd04199cc8a7f9930ddedb30b0f1912d" - integrity sha512-GXCYNwqoo0MbLARghYjxVBxDCnU0tLqN7IPLdHHbibCb1NI5zBkU2EPcy/GaVxc0BtTjqyGXJCINe6JMR2Dpow== + version "3.14.2" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.14.2.tgz#d7dd6a46ca57214f54a2d0a43cad0f35db82ac99" + integrity sha512-rtPMlmcO4agTUfz10CbgJ1k6UAoXM2gWb3GoMPPZB/+/Ackf8lNWk11K4rYi2D0apgoFRLtQOZhb+/iGNJq26A== uid-number@0.0.6: version "0.0.6" @@ -8691,6 +9733,16 @@ umask@^1.1.0: resolved "https://registry.yarnpkg.com/umask/-/umask-1.1.0.tgz#f29cebf01df517912bb58ff9c4e50fde8e33320d" integrity sha1-8pzr8B31F5ErtY/5xOUP3o4zMg0= +unbox-primitive@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/unbox-primitive/-/unbox-primitive-1.0.1.tgz#085e215625ec3162574dc8859abee78a59b14471" + integrity sha512-tZU/3NqK3dA5gpE1KtyiJUrEB0lxnGkMFHptJ7q6ewdZ8s12QrODwNbhIJStmJkd1QDXa1NRA8aF2A1zk/Ypyw== + dependencies: + function-bind "^1.1.1" + has-bigints "^1.0.1" + has-symbols "^1.0.2" + which-boxed-primitive "^1.0.2" + union-value@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.1.tgz#0b6fe7b835aecda61c6ea4d4f02c14221e109847" @@ -8734,16 +9786,11 @@ universal-user-agent@^6.0.0: resolved "https://registry.yarnpkg.com/universal-user-agent/-/universal-user-agent-6.0.0.tgz#3381f8503b251c0d9cd21bc1de939ec9df5480ee" integrity sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w== -universalify@^0.1.0: +universalify@^0.1.0, universalify@^0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg== -universalify@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/universalify/-/universalify-1.0.0.tgz#b61a1da173e8435b2fe3c67d29b9adf8594bd16d" - integrity sha512-rb6X1W158d7pRQBg5gkR8uPaSfiids68LTJQYOtEUhoJUWBdaQHsuT/EUduxXYxcrt4r5PJ4fuHW1MHT6p0qug== - universalify@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.0.tgz#75a4984efedc4b08975c5aeb73f530d02df25717" @@ -8763,9 +9810,9 @@ upath@^1.2.0: integrity sha512-aZwGpamFO61g3OlfT7OQCHqhGnW43ieH9WZeP7QxN/G/jS4jfqUkZxoryvJgVPEcrl5NL/ggHsSmLMHuH64Lhg== uri-js@^4.2.2: - version "4.2.2" - resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0" - integrity sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ== + version "4.4.1" + resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" + integrity sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg== dependencies: punycode "^2.1.0" @@ -8796,20 +9843,15 @@ uuid@^3.0.1, uuid@^3.3.2: resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== -uuid@^8.3.0: - 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@^2.0.3: - version "2.2.0" - resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.2.0.tgz#9471efa3ef9128d2f7c6a7ca39c4dd6b5055b132" - integrity sha512-gTpR5XQNKFwOd4clxfnhaqvfqMpqEwr4tOtCyz4MtYZX2JYhfr1JvBFKdS+7K/9rfpZR3VLX+YWBbKoxCgS43Q== +v8-compile-cache@2.3.0, v8-compile-cache@^2.0.3: + version "2.3.0" + resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz#2de19618c66dc247dcfb6f99338035d8245a2cee" + integrity sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA== -v8-to-istanbul@^7.0.0: - version "7.1.0" - resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-7.1.0.tgz#5b95cef45c0f83217ec79f8fc7ee1c8b486aee07" - integrity sha512-uXUVqNUCLa0AH1vuVxzi+MI4RfxEOKt9pBgKwHbgH7st8Kv2P1m+jvWNnektzBh5QShF3ODgKmUFCf38LnVz1g== +v8-to-istanbul@^8.0.0, v8-to-istanbul@^8.1.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-8.1.0.tgz#0aeb763894f1a0a1676adf8a8b7612a38902446c" + integrity sha512-/PRhfd8aTNp9Ggr62HPzXg2XasNFGy5PBt0Rp04du7/8GNNSgxFL6WBTkgMKSL9bFjH+8kKEG3f37FmxiTqUUA== dependencies: "@types/istanbul-lib-coverage" "^2.0.1" convert-source-map "^1.6.0" @@ -8830,6 +9872,11 @@ validate-npm-package-name@^3.0.0: dependencies: builtins "^1.0.3" +validator@^8.0.0: + version "8.2.0" + resolved "https://registry.yarnpkg.com/validator/-/validator-8.2.0.tgz#3c1237290e37092355344fef78c231249dab77b9" + integrity sha512-Yw5wW34fSv5spzTXNkokD6S6/Oq92d8q/t14TqsS3fAiA1RYnxSFSIZ+CY3n6PGGRCq5HhJTSepQvFUS2QUDxA== + verror@1.10.0: version "1.10.0" resolved "https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400" @@ -8858,7 +9905,7 @@ w3c-xmlserializer@^2.0.0: dependencies: xml-name-validator "^3.0.0" -walker@^1.0.7, walker@~1.0.5: +walker@^1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.7.tgz#2f7f9b8fd10d677262b18a884e28d19618e028fb" integrity sha1-L3+bj9ENZ3JisYqITijRlhjgKPs= @@ -8872,6 +9919,16 @@ wcwidth@^1.0.0: dependencies: defaults "^1.0.3" +web-streams-polyfill@^3.0.3: + version "3.1.1" + resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.1.1.tgz#1516f2d4ea8f1bdbfed15eb65cb2df87098c8364" + integrity sha512-Czi3fG883e96T4DLEPRvufrF2ydhOOW1+1a6c3gNjH2aIh50DNFBdfwh2AKoOf1rXvpvavAoA11Qdq9+BKjE0Q== + +webidl-conversions@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" + integrity sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE= + webidl-conversions@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad" @@ -8894,16 +9951,19 @@ whatwg-encoding@^1.0.5: dependencies: iconv-lite "0.4.24" -whatwg-fetch@^3.4.1: - version "3.5.0" - resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-3.5.0.tgz#605a2cd0a7146e5db141e29d1c62ab84c0c4c868" - integrity sha512-jXkLtsR42xhXg7akoDKvKWE40eJeI+2KZqcp2h3NsOrRnDvtWX36KcKl30dy+hxECivdk2BVUHVNrPtoMBUx6A== - whatwg-mimetype@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz#3d4b1e0312d2079879f826aff18dbeeca5960fbf" integrity sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g== +whatwg-url@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" + integrity sha1-lmRU6HZUYuN2RNNib2dCzotwll0= + dependencies: + tr46 "~0.0.3" + webidl-conversions "^3.0.0" + whatwg-url@^7.0.0: version "7.1.0" resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-7.1.0.tgz#c2c492f1eca612988efd3d2266be1b9fc6170d06" @@ -8913,15 +9973,26 @@ whatwg-url@^7.0.0: tr46 "^1.0.1" webidl-conversions "^4.0.2" -whatwg-url@^8.0.0: - version "8.4.0" - resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-8.4.0.tgz#50fb9615b05469591d2b2bd6dfaed2942ed72837" - integrity sha512-vwTUFf6V4zhcPkWp/4CQPr1TW9Ml6SF4lVyaIMBdJw5i6qUUJ1QWM4Z6YYVkfka0OUIzVo/0aNtGVGk256IKWw== +whatwg-url@^8.0.0, whatwg-url@^8.5.0: + version "8.7.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-8.7.0.tgz#656a78e510ff8f3937bc0bcbe9f5c0ac35941b77" + integrity sha512-gAojqb/m9Q8a5IV96E3fHJM70AzCkgt4uXYX2O7EmuyOnLrViCQlsEBmF9UQIu3/aeAIp2U17rtbpZWNntQqdg== dependencies: - lodash.sortby "^4.7.0" - tr46 "^2.0.2" + lodash "^4.7.0" + tr46 "^2.1.0" webidl-conversions "^6.1.0" +which-boxed-primitive@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz#13757bc89b209b049fe5d86430e21cf40a89a8e6" + integrity sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg== + dependencies: + is-bigint "^1.0.1" + is-boolean-object "^1.1.0" + is-number-object "^1.0.4" + is-string "^1.0.5" + is-symbol "^1.0.3" + which-module@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" @@ -8934,7 +10005,7 @@ which@^1.2.14, which@^1.2.9, which@^1.3.1: dependencies: isexe "^2.0.0" -which@^2.0.1, which@^2.0.2: +which@^2.0.1: version "2.0.2" resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== @@ -9048,10 +10119,10 @@ write-pkg@^3.1.0: sort-keys "^2.0.0" write-json-file "^2.2.0" -ws@^7.2.3: - version "7.4.3" - resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.3.tgz#1f9643de34a543b8edb124bdcbc457ae55a6e5cd" - integrity sha512-hr6vCR76GsossIRsr8OLR9acVVm1jyfEWvhbNjtgPOrfvAlKzvyeg/P6r8RuDjRyrcQoPQT7K0DGEPc7Ae6jzA== +ws@^7.4.6: + version "7.5.5" + resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.5.tgz#8b4bc4af518cfabd0473ae4f99144287b33eb881" + integrity sha512-BAkMFcAzl8as1G/hArkxOxq3G7pjUqQ3gzYbLL0/5zNkph70e+lCoxBGnm6AW1+/aiNeV4fnKqZ8m4GZewmH2w== xdg-basedir@^4.0.0: version "4.0.0" @@ -9074,11 +10145,16 @@ xtend@~4.0.1: integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== y18n@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b" - integrity sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w== + version "4.0.3" + resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.3.tgz#b5f259c82cd6e336921efd7bfd8bf560de9eeedf" + integrity sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ== -yallist@^3.0.0, yallist@^3.0.2, yallist@^3.0.3: +y18n@^5.0.5: + version "5.0.8" + resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" + integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== + +yallist@^3.0.0, yallist@^3.0.2, yallist@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g== @@ -9089,24 +10165,29 @@ yallist@^4.0.0: integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== yaml@^1.10.0: - version "1.10.0" - resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.0.tgz#3b593add944876077d4d683fee01081bd9fff31e" - integrity sha512-yr2icI4glYaNG+KWONODapy2/jDdMSDnrONSjblABjD9B4Z5LgiircSt8m8sRZFNi08kG9Sm0uSHtEmP3zaEGg== + version "1.10.2" + resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b" + integrity sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg== -yargs-parser@20.x: - version "20.2.5" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.5.tgz#5d37729146d3f894f39fc94b6796f5b239513186" - integrity sha512-jYRGS3zWy20NtDtK2kBgo/TlAoy5YUuhD9/LZ7z7W4j1Fdw2cqD0xEEclf8fxc8xjD6X5Qr+qQQwCEsP8iRiYg== +yargs-parser@20.0.0: + version "20.0.0" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.0.0.tgz#c65a1daaa977ad63cebdd52159147b789a4e19a9" + integrity sha512-8eblPHTL7ZWRkyjIZJjnGf+TijiKJSwA24svzLRVvtgoi/RZiKa9fFQTrlx0OKLnyHSdt/enrdadji6WFfESVA== + +yargs-parser@20.x, yargs-parser@^20.2.2, yargs-parser@^20.2.3: + 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-parser@^15.0.1: - version "15.0.1" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-15.0.1.tgz#54786af40b820dcb2fb8025b11b4d659d76323b3" - integrity sha512-0OAMV2mAZQrs3FkNpDQcBk1x5HXb8X4twADss4S0Iuk+2dGnLOE/fRHrsYm542GduMveyA77OF4wrNJuanRCWw== + version "15.0.3" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-15.0.3.tgz#316e263d5febe8b38eef61ac092b33dfcc9b1115" + integrity sha512-/MVEVjTXy/cGAjdtQf8dW3V9b97bPN7rNn8ETj6BmAQL7ibC7O1Q9SPJbGjgh3SlwoBNXMzj/ZGIj8mBgl12YA== dependencies: camelcase "^5.0.0" decamelize "^1.2.0" -yargs-parser@^18.1.2, yargs-parser@^18.1.3: +yargs-parser@^18.1.2: version "18.1.3" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-18.1.3.tgz#be68c4975c6b2abf469236b0c870362fab09a7b0" integrity sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ== @@ -9114,6 +10195,23 @@ yargs-parser@^18.1.2, yargs-parser@^18.1.3: camelcase "^5.0.0" decamelize "^1.2.0" +yargs@15.4.1, yargs@^15.0.1: + version "15.4.1" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-15.4.1.tgz#0d87a16de01aee9d8bec2bfbf74f67851730f4f8" + integrity sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A== + dependencies: + cliui "^6.0.0" + decamelize "^1.2.0" + find-up "^4.1.0" + get-caller-file "^2.0.1" + require-directory "^2.1.1" + require-main-filename "^2.0.0" + set-blocking "^2.0.0" + string-width "^4.2.0" + which-module "^2.0.0" + y18n "^4.0.0" + yargs-parser "^18.1.2" + yargs@^14.2.2: version "14.2.3" resolved "https://registry.yarnpkg.com/yargs/-/yargs-14.2.3.tgz#1a1c3edced1afb2a2fea33604bc6d1d8d688a414" @@ -9131,22 +10229,31 @@ yargs@^14.2.2: y18n "^4.0.0" yargs-parser "^15.0.1" -yargs@^15.0.1, yargs@^15.1.0, yargs@^15.4.1: - version "15.4.1" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-15.4.1.tgz#0d87a16de01aee9d8bec2bfbf74f67851730f4f8" - integrity sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A== +yargs@^16.2.0: + version "16.2.0" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66" + integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw== dependencies: - cliui "^6.0.0" - decamelize "^1.2.0" - find-up "^4.1.0" - get-caller-file "^2.0.1" + cliui "^7.0.2" + escalade "^3.1.1" + get-caller-file "^2.0.5" require-directory "^2.1.1" - require-main-filename "^2.0.0" - set-blocking "^2.0.0" string-width "^4.2.0" - which-module "^2.0.0" - y18n "^4.0.0" - yargs-parser "^18.1.2" + y18n "^5.0.5" + yargs-parser "^20.2.2" + +yargs@^17.0.0: + version "17.2.1" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.2.1.tgz#e2c95b9796a0e1f7f3bf4427863b42e0418191ea" + integrity sha512-XfR8du6ua4K6uLGm5S6fA+FIJom/MdJcFNVY8geLlp2v8GYbOXD4EB1tPNZsRn4vBzKGMgb5DRZMeWuFc2GO8Q== + dependencies: + cliui "^7.0.2" + escalade "^3.1.1" + get-caller-file "^2.0.5" + require-directory "^2.1.1" + string-width "^4.2.0" + y18n "^5.0.5" + yargs-parser "^20.2.2" yn@3.1.1: version "3.1.1" @@ -9157,3 +10264,14 @@ yocto-queue@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== + +z-schema@~3.18.3: + version "3.18.4" + resolved "https://registry.yarnpkg.com/z-schema/-/z-schema-3.18.4.tgz#ea8132b279533ee60be2485a02f7e3e42541a9a2" + integrity sha512-DUOKC/IhbkdLKKiV89gw9DUauTV8U/8yJl1sjf6MtDmzevLKOF2duNJ495S3MFVjqZarr+qNGCPbkg4mu4PpLw== + dependencies: + lodash.get "^4.0.0" + lodash.isequal "^4.0.0" + validator "^8.0.0" + optionalDependencies: + commander "^2.7.1" pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy