diff --git a/.cspell.json b/.cspell.json index ec67987a3b5a..91dc7f910d0f 100644 --- a/.cspell.json +++ b/.cspell.json @@ -15,7 +15,6 @@ ".vscode/*.json", "**/*.{json,snap}", "**/**/CHANGELOG.md", - "**/**/CONTRIBUTORS.md", "**/**/TSLINT_RULE_ALTERNATIVES.md", "**/coverage/**", "**/dist/**", @@ -47,6 +46,7 @@ "\\(#.+?\\)" ], "words": [ + "AFAICT", "Airbnb", "Airbnb's", "allowdefaultproject", @@ -150,6 +150,7 @@ "oxlint", "packagespecifier", "parameterised", + "parenthesization", "performant", "pluggable", "postprocess", @@ -196,6 +197,7 @@ "tsconfigrootdir", "tsconfigs", "tseslint", + "tsgo", "tsvfs", "typedef", "typedefs", diff --git a/.gitattributes b/.gitattributes index b94bd55a2808..8090a19ef303 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,6 +1,4 @@ * text=auto eol=lf -# force github to treat out custom jest snapshot extension as normal jest snapshots -*.shot linguist-language=Jest-Snapshot *.shot linguist-generated packages/scope-manager/src/lib/**/* linguist-generated diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 000000000000..a1eb95ebcfbd --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,2 @@ +# All files in the .github directory require approval from core maintainers +.github/** @JamesHenry @bradzacher @JoshuaKGoldberg diff --git a/.github/ISSUE_TEMPLATE/06-bug-report-other.yaml b/.github/ISSUE_TEMPLATE/06-bug-report-other.yaml index 59b8783d1e75..d1d8b6fc4225 100644 --- a/.github/ISSUE_TEMPLATE/06-bug-report-other.yaml +++ b/.github/ISSUE_TEMPLATE/06-bug-report-other.yaml @@ -40,8 +40,11 @@ body: - ast-spec - eslint-plugin - parser + - project-service + - rule-schema-to-typescript-types - rule-tester - scope-manager + - tsconfig-utils - type-utils - types - typescript-eslint diff --git a/.github/ISSUE_TEMPLATE/07-enhancement-other.yaml b/.github/ISSUE_TEMPLATE/07-enhancement-other.yaml index 604ce5468161..de9f9324e4c0 100644 --- a/.github/ISSUE_TEMPLATE/07-enhancement-other.yaml +++ b/.github/ISSUE_TEMPLATE/07-enhancement-other.yaml @@ -26,8 +26,11 @@ body: - ast-spec - eslint-plugin - parser + - project-service + - rule-schema-to-typescript-types - rule-tester - scope-manager + - tsconfig-utils - type-utils - types - typescript-eslint diff --git a/.github/actions/breaking-pr-check/action.yml b/.github/actions/breaking-pr-check/action.yml deleted file mode 100644 index f54443a4f433..000000000000 --- a/.github/actions/breaking-pr-check/action.yml +++ /dev/null @@ -1,6 +0,0 @@ -name: Validate Breaking Change PR -description: Validate breaking change PR title and description - -runs: - using: node20 - main: index.js diff --git a/.github/actions/breaking-pr-check/index.js b/.github/actions/breaking-pr-check/index.js deleted file mode 100644 index 2aa900456a9c..000000000000 --- a/.github/actions/breaking-pr-check/index.js +++ /dev/null @@ -1,78 +0,0 @@ -// @ts-check -/* eslint-disable jsdoc/no-types, @typescript-eslint/no-require-imports */ - -const core = require('@actions/core'); -const github = require('@actions/github'); - -async function getPullRequest() { - const token = process.env.GITHUB_TOKEN; - if (!token) { - throw new Error( - 'The GITHUB_TOKEN environment variable is required to run this action.', - ); - } - const client = github.getOctokit(token); - - const pr = github.context.payload.pull_request; - if (!pr) { - throw new Error( - "This action can only be invoked in `pull_request_target` or `pull_request` events. Otherwise the pull request can't be inferred.", - ); - } - - const owner = pr.base.user.login; - const repo = pr.base.repo.name; - - const { data } = await client.rest.pulls.get({ - owner, - pull_number: pr.number, - repo, - }); - - return data; -} - -/** - * @param {string} title The PR title to check - */ -function checkTitle(title) { - if (/^[a-z]+(\([a-z-]+\))?!: /.test(title)) { - throw new Error( - `Do not use exclamation mark ('!') to indicate breaking change in the PR Title.`, - ); - } -} - -/** - * @param {string} body The body of the PR - * @param {any[]} labels The labels applied to the PR - */ -function checkDescription(body, labels) { - if (!labels.some(label => label.name === 'breaking change')) { - return; - } - const [firstLine, secondLine] = body.split(/\r?\n/); - - if (!firstLine || !/^BREAKING CHANGE:/.test(firstLine)) { - throw new Error( - `Breaking change PR body should start with "BREAKING CHANGE:". See https://typescript-eslint.io/maintenance/releases#2-merging-breaking-changes.`, - ); - } - if (!secondLine) { - throw new Error( - `The description of breaking change is missing. See https://typescript-eslint.io/maintenance/releases#2-merging-breaking-changes.`, - ); - } -} - -async function run() { - const pullRequest = await getPullRequest(); - try { - checkTitle(pullRequest.title); - checkDescription(pullRequest.body ?? '', pullRequest.labels); - } catch (/** @type {any} */ e) { - core.setFailed(e.message); - } -} - -run(); diff --git a/.github/actions/prepare-build/action.yml b/.github/actions/prepare-build/action.yml index e88bd2cfb93b..d191358d6503 100644 --- a/.github/actions/prepare-build/action.yml +++ b/.github/actions/prepare-build/action.yml @@ -22,7 +22,7 @@ runs: if: steps['build-cache'].outputs.cache-hit == 'true' shell: bash run: | - npx nx run types:build + yarn nx run types:build env: SKIP_AST_SPEC_REBUILD: true @@ -31,6 +31,6 @@ runs: shell: bash # Website will be built by the Netlify GitHub App run: | - npx nx run-many --target=build --parallel --exclude=website --exclude=website-eslint + yarn nx run-many --target=build --parallel --exclude=website --exclude=website-eslint env: SKIP_AST_SPEC_REBUILD: true diff --git a/.github/actions/prepare-install/action.yml b/.github/actions/prepare-install/action.yml index 2334ef0b406f..7686f9cd4de2 100644 --- a/.github/actions/prepare-install/action.yml +++ b/.github/actions/prepare-install/action.yml @@ -76,3 +76,4 @@ runs: YARN_INSTALL_STATE_PATH: .yarn/ci-cache/install-state.gz # Very small speedup when lock does not change # Other environment variables HUSKY: '0' # By default do not run HUSKY install + SKIP_POSTINSTALL: 'true' diff --git a/.github/workflows/a11y-alt-bot.yml b/.github/workflows/a11y-alt-bot.yml index 3ba37a7d9759..f59ac53a8dc6 100644 --- a/.github/workflows/a11y-alt-bot.yml +++ b/.github/workflows/a11y-alt-bot.yml @@ -2,11 +2,11 @@ name: Accessibility-alt-text-bot on: issues: types: [opened, edited] + # NOTE: Never use pull_request_target here because that would populate secrets for forks pull_request: types: [opened, edited] issue_comment: - # nx bot and netlify bot edit their comments regularly - # this floods our action queue with this action + # nx bot and netlify bot edit their comments regularly, this floods our action queue with this action # it's rare that someone edits a comment to add an image so to save our queue we ignore the edit types: [created] discussion: @@ -14,6 +14,7 @@ on: discussion_comment: types: [created, edited] +# IMPORTANT: Minimal permissions necessary for this workflow to function permissions: issues: write pull-requests: write diff --git a/.github/workflows/breaking-change-validation.yml b/.github/workflows/breaking-change-validation.yml new file mode 100644 index 000000000000..a441c68d250a --- /dev/null +++ b/.github/workflows/breaking-change-validation.yml @@ -0,0 +1,79 @@ +# IMPORTANT: Do not reuse old name of "Semantic Breaking Change PR Test" here +name: Breaking Change Validation + +on: + # WARNING: Using pull_request_target here because we want to validate PRs on forks + # pull_request_target can be UNSAFE because it runs in the TARGET repo context (not fork context). + # DO NOT CHECK OUT THE REPO IN THIS WORKFLOW + pull_request_target: + types: + - opened + - edited + - synchronize + - labeled + - unlabeled + +# IMPORTANT: Minimal permissions necessary for this workflow to function +permissions: + pull-requests: read + +jobs: + validate: + name: Validate Breaking Change PR + runs-on: ubuntu-latest + steps: + - name: Check PR title and body + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + async function getPullRequest() { + const pr = context.payload.pull_request; + if (!pr) { + throw new Error("This action can only be run on pull_request events."); + } + + const owner = pr.base.repo.owner.login; + const repo = pr.base.repo.name; + const pull_number = pr.number; + + const { data } = await github.rest.pulls.get({ + owner, + repo, + pull_number, + }); + + return data; + } + + function checkTitle(title) { + if (/^[a-z]+(\([a-z-]+\))?!: /.test(title)) { + throw new Error( + `Do not use exclamation mark ('!') to indicate breaking change in the PR Title.`, + ); + } + } + + function checkDescription(body, labels) { + if (!labels.some(label => label.name === 'breaking change')) { + return; + } + + const [firstLine, secondLine] = body.split(/\r?\n/); + + if (!firstLine || !/^BREAKING CHANGE:/.test(firstLine)) { + throw new Error( + `Breaking change PR body should start with "BREAKING CHANGE:". See https://typescript-eslint.io/maintenance/releases#2-merging-breaking-changes.`, + ); + } + + if (!secondLine) { + throw new Error( + `The description of breaking change is missing. See https://typescript-eslint.io/maintenance/releases#2-merging-breaking-changes.`, + ); + } + } + + const pr = await getPullRequest(); + checkTitle(pr.title); + checkDescription(pr.body ?? '', pr.labels); diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 398c05e17baa..38173f35a252 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,9 +1,11 @@ +# NOTE: The name of this workflow is significant - it is used as the identifier for the workflow_run trigger in the release workflow name: CI on: push: branches: - main + # NOTE: Never use pull_request_target here because that would populate secrets for forks pull_request: branches: - '**' @@ -15,8 +17,8 @@ concurrency: env: PRIMARY_NODE_VERSION: 20 - # Only set the read-write token if we are on the main branch - NX_CLOUD_ACCESS_TOKEN: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') && secrets.NX_CLOUD_ACCESS_TOKEN || '' }} + # Value will be controlled via GitHub environment (called "main") secret, will be read-write for main branch, read-only for other branches + NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} # This increases the verbosity of the logs for everything, including Nx Cloud, but will hopefully surface more info about recent lint failures NX_VERBOSE_LOGGING: false @@ -38,7 +40,10 @@ permissions: jobs: install: name: Checkout and Install + environment: ${{ (github.repository == 'typescript-eslint/typescript-eslint' && github.ref == 'refs/heads/main') && 'main' || '' }} # Have to specify per job runs-on: ubuntu-latest + env: + NX_CI_EXECUTION_ENV: 'ubuntu-latest' steps: - name: Checkout uses: actions/checkout@v4 @@ -49,8 +54,11 @@ jobs: build: name: Build All Packages + environment: ${{ (github.repository == 'typescript-eslint/typescript-eslint' && github.ref == 'refs/heads/main') && 'main' || '' }} # Have to specify per job needs: [install] runs-on: ubuntu-latest + env: + NX_CI_EXECUTION_ENV: 'ubuntu-latest' steps: - name: Checkout uses: actions/checkout@v4 @@ -63,8 +71,11 @@ jobs: generate_configs: name: Generate Configs + environment: ${{ (github.repository == 'typescript-eslint/typescript-eslint' && github.ref == 'refs/heads/main') && 'main' || '' }} # Have to specify per job needs: [build] runs-on: ubuntu-latest + env: + NX_CI_EXECUTION_ENV: 'ubuntu-latest' steps: - name: Checkout uses: actions/checkout@v4 @@ -72,18 +83,21 @@ jobs: uses: ./.github/actions/prepare-install with: node-version: ${{ env.PRIMARY_NODE_VERSION }} - - run: yarn generate-configs + - run: yarn nx run generate-configs - run: git status --porcelain - if: failure() run: echo "Outdated result detected from yarn generate-configs. Please check in any file changes." lint_without_build: name: Lint without build + environment: ${{ (github.repository == 'typescript-eslint/typescript-eslint' && github.ref == 'refs/heads/main') && 'main' || '' }} # Have to specify per job needs: [install] runs-on: ubuntu-latest strategy: matrix: lint-task: ['check-spelling', 'check-format', 'lint-markdown'] + env: + NX_CI_EXECUTION_ENV: 'ubuntu-latest' steps: - name: Checkout uses: actions/checkout@v4 @@ -97,12 +111,15 @@ jobs: lint_with_build: name: Lint with build + environment: ${{ (github.repository == 'typescript-eslint/typescript-eslint' && github.ref == 'refs/heads/main') && 'main' || '' }} # Have to specify per job # because we lint with our own tooling, we need to build needs: [build] runs-on: ubuntu-latest strategy: matrix: - lint-task: ['lint', 'typecheck', 'knip'] + lint-task: ['deduplicate', 'lint', 'typecheck', 'knip'] + env: + NX_CI_EXECUTION_ENV: 'ubuntu-latest' steps: - name: Checkout uses: actions/checkout@v4 @@ -120,8 +137,11 @@ jobs: stylelint: name: Stylelint + environment: ${{ (github.repository == 'typescript-eslint/typescript-eslint' && github.ref == 'refs/heads/main') && 'main' || '' }} # Have to specify per job needs: [install] runs-on: ubuntu-latest + env: + NX_CI_EXECUTION_ENV: 'ubuntu-latest' steps: - name: Checkout uses: actions/checkout@v4 @@ -135,8 +155,11 @@ jobs: integration_tests: name: Run integration tests on primary Node.js version + environment: ${{ (github.repository == 'typescript-eslint/typescript-eslint' && github.ref == 'refs/heads/main') && 'main' || '' }} # Have to specify per job needs: [build] runs-on: ubuntu-latest + env: + NX_CI_EXECUTION_ENV: 'ubuntu-latest' steps: - name: Checkout uses: actions/checkout@v4 @@ -154,6 +177,7 @@ jobs: unit_tests: name: Run Unit Tests + environment: ${{ (github.repository == 'typescript-eslint/typescript-eslint' && github.ref == 'refs/heads/main') && 'main' || '' }} # Have to specify per job needs: [build] runs-on: ${{ matrix.os }} strategy: @@ -170,8 +194,11 @@ jobs: 'eslint-plugin', 'eslint-plugin-internal', 'parser', + 'project-service', + 'rule-schema-to-typescript-types', 'rule-tester', 'scope-manager', + 'tsconfig-utils', 'type-utils', 'typescript-eslint', 'typescript-estree', @@ -179,8 +206,7 @@ jobs: 'visitor-keys', ] env: - # Added the - at the end to function as a separator to improve readability in the PR comment from the Nx cloud app - NX_CLOUD_ENV_NAME: 'Node ${{ matrix.node-version }} -' + NX_CI_EXECUTION_ENV: '${{ matrix.os }} - Node ${{ matrix.node-version }}' COLLECT_COVERAGE: false steps: - name: Checkout @@ -198,12 +224,12 @@ jobs: # we don't collect coverage on other node versions so they run faster - name: Run unit tests with coverage for ${{ matrix.package }} if: env.PRIMARY_NODE_VERSION == matrix.node-version && matrix.os == 'ubuntu-latest' - run: npx nx run ${{ matrix.package }}:test -- --coverage + run: yarn nx run ${{ matrix.package }}:test -- --coverage env: CI: true - name: Run unit tests for ${{ matrix.package }} if: env.PRIMARY_NODE_VERSION != matrix.node-version || matrix.os != 'ubuntu-latest' - run: npx nx test ${{ matrix.package }} + run: yarn nx test ${{ matrix.package }} env: CI: true @@ -218,6 +244,7 @@ jobs: unit_tests_project_service: name: Run Unit Tests with Project Service + environment: ${{ (github.repository == 'typescript-eslint/typescript-eslint' && github.ref == 'refs/heads/main') && 'main' || '' }} # Have to specify per job needs: [build] runs-on: ubuntu-latest strategy: @@ -225,7 +252,8 @@ jobs: package: ['eslint-plugin', 'eslint-plugin-internal', 'typescript-estree'] env: - COLLECT_COVERAGE: false + NX_CI_EXECUTION_ENV: 'ubuntu-latest' + COLLECT_COVERAGE: false, steps: - name: Checkout uses: actions/checkout@v4 @@ -238,13 +266,14 @@ jobs: - name: Build uses: ./.github/actions/prepare-build - name: Run unit tests for ${{ matrix.package }} - run: npx nx test ${{ matrix.package }} --coverage=false + run: yarn nx test ${{ matrix.package }} --coverage=false env: CI: true TYPESCRIPT_ESLINT_PROJECT_SERVICE: true upload_coverage: name: Upload Codecov Coverage + environment: ${{ (github.repository == 'typescript-eslint/typescript-eslint' && github.ref == 'refs/heads/main') && 'main' || '' }} # Have to specify per job needs: [unit_tests] runs-on: ubuntu-latest steps: @@ -263,36 +292,3 @@ jobs: files: coverage/**/lcov.info flags: unittest name: codecov - - publish_canary_version: - name: Publish the latest code as a canary version - runs-on: ubuntu-latest - permissions: - id-token: write - needs: [integration_tests, lint_with_build, lint_without_build, unit_tests] - if: github.repository == 'typescript-eslint/typescript-eslint' && github.ref == 'refs/heads/main' - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 # we need the tags to be available - - - name: Install - uses: ./.github/actions/prepare-install - with: - node-version: ${{ env.PRIMARY_NODE_VERSION }} - registry-url: 'https://registry.npmjs.org' - - - name: Build - uses: ./.github/actions/prepare-build - - - name: Figure out and apply the next canary version - run: npx tsx tools/release/apply-canary-version.mts - - - name: Publish all packages to npm with the canary tag - # NOTE: this needs to be npx, rather than yarn, to make sure the authenticated npm registry is used - run: npx nx release publish --tag canary --verbose - env: - NX_CLOUD_DISTRIBUTED_EXECUTION: false - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - NPM_CONFIG_PROVENANCE: true diff --git a/.github/workflows/cleanup-cache.yml b/.github/workflows/cleanup-cache.yml index 21cb7a3df7b0..b57bcabcb3fc 100644 --- a/.github/workflows/cleanup-cache.yml +++ b/.github/workflows/cleanup-cache.yml @@ -1,34 +1,35 @@ # https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#force-deleting-cache-entries -name: cleanup caches by a branch +name: Cleanup caches for the current PR branch on: + # NOTE: Never use pull_request_target here because that would populate secrets for forks pull_request: types: - closed +# IMPORTANT: Minimal permissions necessary for this workflow to function +permissions: + actions: write + contents: write + jobs: cleanup: runs-on: ubuntu-latest steps: - - name: Check out code - uses: actions/checkout@v4 - - name: Cleanup + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - gh extension install actions/gh-actions-cache - REPO=${{ github.repository }} BRANCH="refs/pull/${{ github.event.pull_request.number }}/merge" echo "Fetching list of cache key" - cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 ) + cacheKeysForPR=$(gh cache list -R $REPO --ref $BRANCH | cut -f 1) ## Setting this to not fail the workflow while deleting cache keys. set +e echo "Deleting caches..." for cacheKey in $cacheKeysForPR do - gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm + gh cache delete $cacheKey -R $REPO done echo "Done" - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/lock.yml b/.github/workflows/lock.yml deleted file mode 100644 index ae557bfdd433..000000000000 --- a/.github/workflows/lock.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: 'Lock threads' - -on: - schedule: - - cron: '0 0 * * *' - -permissions: {} - -jobs: - lock: - permissions: - issues: write # to lock issues (dessant/lock-threads) - pull-requests: write # to lock PRs (dessant/lock-threads) - - runs-on: ubuntu-latest - steps: - - uses: dessant/lock-threads@v5.0.1 - with: - add-issue-labels: 'locked due to age' - github-token: ${{ github.token }} - issue-inactive-days: '7' - issue-lock-reason: 'resolved' - issue-comment: '' - pr-inactive-days: '7' - pr-lock-reason: 'resolved' - pr-comment: '' diff --git a/.github/workflows/nx-migrate.yml b/.github/workflows/nx-migrate.yml index ee1b4da6e4bc..5b0d8db9f9d4 100644 --- a/.github/workflows/nx-migrate.yml +++ b/.github/workflows/nx-migrate.yml @@ -2,11 +2,13 @@ # `nx migrate` when renovate opens a PR to change the version of @nx/workspace. # # You will therefore also notice that in the renovate configuration, we ignore any packages which -# Nx will manage for us as part of `nx migrate` such as the remaining @nx/* packages and jest. +# Nx will manage for us as part of `nx migrate` such as the remaining @nx/* packages. name: Nx Migrate on: + # NOTE: Never use pull_request_target here because that would populate secrets for forks + # Renovate creates branches directly on the main repo and acts like a trusted contributor pull_request: branches: [main] paths: diff --git a/.github/workflows/pr-labels.yml b/.github/workflows/pr-labels.yml deleted file mode 100644 index 3f8770b799db..000000000000 --- a/.github/workflows/pr-labels.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Pull Request Labels - -on: - pull_request: - types: [labeled, opened, synchronize, unlabeled] - -jobs: - label: - runs-on: ubuntu-latest - permissions: - issues: write - pull-requests: write - # - # WARNING!!!!!!!!!!! - # - # THIS ACTION WAS COMPROMISED: https://www.stepsecurity.io/blog/harden-runner-detection-tj-actions-changed-files-action-is-compromised - # - # DO NOT RE-ENABLE THIS WORKFLOW WITH THIS IN USE!!!!! - # - # steps: - # - id: changed-stable-configs - # uses: tj-actions/changed-files@v44.5.2 - # with: - # files: packages/{eslint-plugin,typescript-eslint}/src/configs/{recommended,stylistic}* - # - if: steps.changed-stable-configs.outputs.any_changed == 'true' - # uses: mheap/github-action-required-labels@5.5.0 - # with: - # add_comment: true - # count: 1 - # labels: breaking change - # message: '🤖 Beep boop! PRs that change our stable preset configs must be labeled with `breaking change`.' - # mode: minimum diff --git a/.github/workflows/pr-review-requested.yml b/.github/workflows/pr-review-requested.yml index edfdbbdafb97..61c220e239cd 100644 --- a/.github/workflows/pr-review-requested.yml +++ b/.github/workflows/pr-review-requested.yml @@ -1,3 +1,17 @@ +name: PR Review Requested + +on: + # WARNING: Using pull_request_target here because we need write permissions to remove labels from fork PRs + # pull_request_target can be UNSAFE because it runs in the TARGET repo context (not fork context). + # DO NOT CHECK OUT THE REPO IN THIS WORKFLOW + pull_request_target: + types: + - review_requested + +# IMPORTANT: Minimal permissions necessary for this workflow to function +permissions: + pull-requests: write + jobs: pr_review_requested: runs-on: ubuntu-latest @@ -11,13 +25,3 @@ jobs: run: | echo "Don't worry if the previous step failed." echo "See https://github.com/actions-ecosystem/action-remove-labels/issues/221." - -name: PR Review Requested - -on: - pull_request_target: - types: - - review_requested - -permissions: - pull-requests: write diff --git a/.github/workflows/semantic-pr-titles.yml b/.github/workflows/pr-title-validation.yml similarity index 73% rename from .github/workflows/semantic-pr-titles.yml rename to .github/workflows/pr-title-validation.yml index 3a3c4a2c3164..a2a5e5e47a8a 100644 --- a/.github/workflows/semantic-pr-titles.yml +++ b/.github/workflows/pr-title-validation.yml @@ -1,14 +1,22 @@ -name: Semantic PR Titles +# IMPORTANT: Do not reuse old name of "Semantic PR Titles" here +name: PR Title Validation on: + # WARNING: Using pull_request_target here because we want to validate PRs on forks + # pull_request_target can be UNSAFE because it runs in the TARGET repo context (not fork context). + # DO NOT CHECK OUT THE REPO IN THIS WORKFLOW pull_request_target: types: - opened - edited - synchronize +# IMPORTANT: Minimal permissions necessary for this workflow to function +permissions: + pull-requests: read + jobs: - main: + validate: name: Validate PR title runs-on: ubuntu-latest steps: @@ -30,8 +38,11 @@ jobs: eslint-plugin eslint-plugin-internal parser + project-service + rule-schema-to-typescript-types rule-tester scope-manager + tsconfig-utils type-utils types typescript-eslint diff --git a/.github/workflows/prettier-update.yml b/.github/workflows/prettier-update.yml index 5cd44a2d7a13..bdfb4d9fd05e 100644 --- a/.github/workflows/prettier-update.yml +++ b/.github/workflows/prettier-update.yml @@ -4,6 +4,8 @@ name: Prettier Update on: + # NOTE: Never use pull_request_target here because that would populate secrets for forks + # Renovate creates branches directly on the main repo and acts like a trusted contributor pull_request: branches: [main] paths: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000000..0a23b7d8df4a --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,283 @@ +name: Release + +on: + # Triggered by completed CI runs (we check for successful status in the validate job) on main branch for canary releases + workflow_run: + workflows: ['CI'] + types: [completed] + branches: [main] + + schedule: + # Github actions do not currently support specifying a timezone. + # Run on Mondays at 5pm UTC (1pm Eastern (Summer) Time) + - cron: '0 17 * * 1' + + # Manual trigger for out of band releases and next major version prereleases + workflow_dispatch: + inputs: + release_type: + description: 'Type of release to perform' + required: true + type: choice + options: + - canary + - stable + default: 'canary' + override_major_version: + description: 'Override major version for canary releases' + required: false + type: string + dry_run: + description: 'Perform a dry run' + required: true + type: boolean + default: true + first_release: + description: 'Whether one or more packages are being released for the first time' + required: false + type: boolean + default: false + force_release_without_changes: + description: 'Whether to do a release regardless of if there have been changes' + required: false + type: boolean + default: false + +# Ensure only one release workflow runs at a time +concurrency: + group: release + cancel-in-progress: false + +env: + PRIMARY_NODE_VERSION: 20 + +# Minimal permissions by default +permissions: + contents: read + +jobs: + # Validation job to ensure secure inputs and determine release type + validate: + name: Validate Release Parameters + runs-on: ubuntu-latest + # Only run on the official repository to avoid wasted compute and unnecessary errors on forks (also an initial albeit weak first layer of protection against unauthorized releases) + if: github.repository == 'typescript-eslint/typescript-eslint' + outputs: + should_release: ${{ steps.validate.outputs.should_release }} + release_type: ${{ steps.validate.outputs.release_type }} + is_canary: ${{ steps.validate.outputs.is_canary }} + is_stable: ${{ steps.validate.outputs.is_stable }} + dry_run: ${{ steps.validate.outputs.dry_run }} + force_release_without_changes: ${{ steps.validate.outputs.force_release_without_changes }} + first_release: ${{ steps.validate.outputs.first_release }} + override_major_version: ${{ steps.validate.outputs.override_major_version }} + steps: + - name: Validate inputs and determine release type + id: validate + env: + # Ensure user input is treated as data by passing them as environment variables + INPUT_RELEASE_TYPE: ${{ inputs.release_type }} + INPUT_OVERRIDE_MAJOR: ${{ inputs.override_major_version }} + INPUT_DRY_RUN: ${{ inputs.dry_run }} + INPUT_FORCE_RELEASE: ${{ inputs.force_release_without_changes }} + INPUT_FIRST_RELEASE: ${{ inputs.first_release }} + run: | + SHOULD_RELEASE="false" + + # Determine release type based on trigger + if [[ "${{ github.event_name }}" == "schedule" ]]; then + RELEASE_TYPE="stable" + SHOULD_RELEASE="true" + elif [[ "${{ github.event_name }}" == "workflow_run" ]]; then + # Only release canary if the CI workflow succeeded + if [[ "${{ github.event.workflow_run.conclusion }}" == "success" ]]; then + RELEASE_TYPE="canary" + SHOULD_RELEASE="true" + else + echo "CI workflow did not succeed, skipping canary release" + RELEASE_TYPE="canary" + SHOULD_RELEASE="false" + fi + elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then + RELEASE_TYPE="$INPUT_RELEASE_TYPE" + SHOULD_RELEASE="true" + else + echo "::error::Unsupported trigger event: ${{ github.event_name }}" + exit 1 + fi + + # Validate release type + if [[ "$RELEASE_TYPE" != "canary" && "$RELEASE_TYPE" != "stable" ]]; then + echo "::error::Invalid release type: $RELEASE_TYPE. Must be 'canary' or 'stable'" + exit 1 + fi + + # Security: For manual triggers, only allow core maintainers to run releases + if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then + ALLOWED_ACTORS=("JamesHenry" "bradzacher" "JoshuaKGoldberg") + ACTOR="${{ github.actor }}" + IS_ALLOWED="false" + + for allowed in "${ALLOWED_ACTORS[@]}"; do + if [[ "$ACTOR" == "$allowed" ]]; then + IS_ALLOWED="true" + break + fi + done + + if [[ "$IS_ALLOWED" != "true" ]]; then + echo "::error::User '$ACTOR' is not authorized to trigger manual releases." + echo "::error::Only the following users can trigger manual releases: ${ALLOWED_ACTORS[*]}" + exit 1 + fi + + echo "✅ Authorized user '$ACTOR' triggering manual release" + fi + + # Set outputs + echo "should_release=$SHOULD_RELEASE" >> $GITHUB_OUTPUT + echo "release_type=$RELEASE_TYPE" >> $GITHUB_OUTPUT + echo "is_canary=$([[ "$RELEASE_TYPE" == "canary" ]] && echo "true" || echo "false")" >> $GITHUB_OUTPUT + echo "is_stable=$([[ "$RELEASE_TYPE" == "stable" ]] && echo "true" || echo "false")" >> $GITHUB_OUTPUT + + # Handle dry run for manual releases (defaults to true) + if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then + echo "dry_run=${INPUT_DRY_RUN:-true}" >> $GITHUB_OUTPUT + else + # Automated releases (schedule, workflow_run) are never dry runs + echo "dry_run=false" >> $GITHUB_OUTPUT + fi + + # Handle force release without changes for stable releases + if [[ "$RELEASE_TYPE" == "stable" && "${{ github.event_name }}" == "workflow_dispatch" ]]; then + echo "force_release_without_changes=${INPUT_FORCE_RELEASE:-false}" >> $GITHUB_OUTPUT + else + echo "force_release_without_changes=false" >> $GITHUB_OUTPUT + fi + + # Handle first release flag (only for manual releases) + if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then + echo "first_release=${INPUT_FIRST_RELEASE:-false}" >> $GITHUB_OUTPUT + else + echo "first_release=false" >> $GITHUB_OUTPUT + fi + + # Validate and handle override major version for canary releases + if [[ "$RELEASE_TYPE" == "canary" && "${{ github.event_name }}" == "workflow_dispatch" && -n "$INPUT_OVERRIDE_MAJOR" ]]; then + if [[ ! "$INPUT_OVERRIDE_MAJOR" =~ ^[0-9]+$ ]]; then + echo "::error::Invalid override major version format: $INPUT_OVERRIDE_MAJOR. Must be a positive integer." + exit 1 + fi + echo "override_major_version=$INPUT_OVERRIDE_MAJOR" >> $GITHUB_OUTPUT + else + echo "override_major_version=" >> $GITHUB_OUTPUT + fi + + echo "Validated release configuration:" + echo "- Should release: $SHOULD_RELEASE" + echo "- Release type: $RELEASE_TYPE" + echo "- Dry run: $INPUT_DRY_RUN" + echo "- Force release without changes: $INPUT_FORCE_RELEASE" + echo "- First release: $INPUT_FIRST_RELEASE" + echo "- Override major version (for canary only): $INPUT_OVERRIDE_MAJOR" + + canary_release: + name: Publish Canary Release + runs-on: ubuntu-latest + environment: npm-registry # This environment is required by the trusted publishing configuration on npm + needs: [validate] + # Only run on the official repository to avoid wasted compute and unnecessary errors on forks (also an initial albeit weak first layer of protection against unauthorized releases) + # Also ensure validation passed and we're releasing a canary version + if: github.repository == 'typescript-eslint/typescript-eslint' && needs.validate.outputs.should_release == 'true' && needs.validate.outputs.is_canary == 'true' + permissions: + contents: read # No need to write to the repository for canary releases + id-token: write # Required for trusted publishing + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + # We need the full history for version calculation + fetch-depth: 0 + + - name: Install dependencies + uses: ./.github/actions/prepare-install + with: + node-version: ${{ env.PRIMARY_NODE_VERSION }} + registry-url: 'https://registry.npmjs.org' + + # Use specific npm version required for trusted publishing + - name: Use npm 11.5.2 + run: npm install -g npm@11.5.2 + + - name: Build packages + uses: ./.github/actions/prepare-build + + - name: Calculate and apply canary version + run: yarn tsx tools/release/apply-canary-version.mts + env: + # Use the validated override major version from the validate job, if set + OVERRIDE_MAJOR_VERSION: ${{ needs.validate.outputs.override_major_version }} + + - name: Publish canary packages + run: yarn nx release publish --tag canary --verbose --dry-run=${{ needs.validate.outputs.dry_run }} --first-release=${{ needs.validate.outputs.first_release }} + env: + # Enable npm provenance + NPM_CONFIG_PROVENANCE: true + # Disable distributed execution here for predictability + NX_CLOUD_DISTRIBUTED_EXECUTION: false + + stable_release: + name: Publish Stable Release + runs-on: ubuntu-latest + environment: npm-registry # This environment is required by the trusted publishing configuration on npm + needs: [validate] + # Only run on the official repository to avoid wasted compute and unnecessary errors on forks (also an initial albeit weak first layer of protection against unauthorized releases) + # Also ensure validation passed and we're releasing a stable version + if: github.repository == 'typescript-eslint/typescript-eslint' && needs.validate.outputs.should_release == 'true' && needs.validate.outputs.is_stable == 'true' + permissions: + contents: read + id-token: write # Required for trusted publishing + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + # Need full history for changelog generation + fetch-depth: 0 + ref: main + # Check out the repo with a specific fine-grained PAT to allow pushing back to the repo + token: ${{ secrets.GH_FINE_GRAINED_PAT }} + + - name: Install dependencies + uses: ./.github/actions/prepare-install + with: + node-version: ${{ env.PRIMARY_NODE_VERSION }} + registry-url: 'https://registry.npmjs.org' + + # Use specific npm version required for trusted publishing + - name: Use npm 11.5.2 + run: npm install -g npm@11.5.2 + + - name: Build packages + uses: ./.github/actions/prepare-build + + - name: Configure git user for automated commits + run: | + git config --global user.email "typescript-eslint[bot]@users.noreply.github.com" + git config --global user.name "typescript-eslint[bot]" + + - name: Run stable release + run: yarn release --dry-run=${{ needs.validate.outputs.dry_run }} --force-release-without-changes=${{ needs.validate.outputs.force_release_without_changes }} --first-release=${{ needs.validate.outputs.first_release }} --verbose + env: + # Enable npm provenance + NPM_CONFIG_PROVENANCE: true + # Disable distributed execution here for predictability + NX_CLOUD_DISTRIBUTED_EXECUTION: false + # Use the specific fine-grained PAT to allow pushing back to the repo + GH_TOKEN: ${{ secrets.GH_FINE_GRAINED_PAT }} + + - name: Force update the website branch to match the latest release + # Only update the website branch if we're not doing a dry run + if: needs.validate.outputs.dry_run == 'false' + run: | + git branch -f website + git push -f origin website diff --git a/.github/workflows/semantic-breaking-change-pr.yml b/.github/workflows/semantic-breaking-change-pr.yml deleted file mode 100644 index dcae58270de1..000000000000 --- a/.github/workflows/semantic-breaking-change-pr.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: Semantic Breaking Change PR - -on: - pull_request_target: - types: - - opened - - edited - - synchronize - - labeled - - unlabeled - -jobs: - main: - name: Validate Breaking Change PR - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/prepare-install - - uses: ./.github/actions/breaking-pr-check - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index 20ab952ba246..94d644e2544a 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ docs/packages/*/generated packages/website/.docusaurus packages/website/.cache-loader packages/website/build +packages/website/data/recent-blog-posts.json packages/website/static/sandbox # Runtime data @@ -95,3 +96,8 @@ packages/**/.yarn # Vitest type tests tsconfig*.vitest-temp.json + +# Leave these AI agent files up to individual contributors for now +.cursor/mcp.json +.cursor/rules/nx-rules.mdc +.github/instructions/nx.instructions.md diff --git a/.prettierignore b/.prettierignore index 500bc3eaf91a..9a14c7180b0b 100644 --- a/.prettierignore +++ b/.prettierignore @@ -3,7 +3,6 @@ **/.vscode **/.nyc_output **/.vs -CONTRIBUTORS.md .yarn/plugins .yarn/releases @@ -13,21 +12,9 @@ packages/eslint-plugin/tests/fixtures/indent/ # ignore all error fixtures cos they often have intentional syntax errors packages/ast-spec/src/*/*/fixtures/_error_/*/fixture.ts -# TS 5.6 -- string literal import/export specifiers # TODO - remove this once prettier supports it -packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/braced-identifier-aliased-to-string-literal-with-source/fixture.ts -packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/braced-identifier-aliased-to-string-literal-without-source/fixture.ts -packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/braced-string-literal-aliased-to-identifier-with-source/fixture.ts -packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/braced-string-literal-many-with-source/fixture.ts -packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/braced-string-literal-with-source/fixture.ts -packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-string-literal-aliased-to-identifier/fixture.ts -packages/ast-spec/src/special/ExportSpecifier/fixtures/literal-specifier/fixture.ts -packages/ast-spec/src/special/ExportSpecifier/fixtures/value-export-specifier/fixture.ts - -# TODO - remove this once prettier supports it -# https://github.com/prettier/prettier/issues/16072 -packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-import-attributes-assert/fixture.ts -packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-import-attributes-with/fixture.ts +# https://github.com/prettier/prettier/issues/17405 +packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-trailing-comma-in-import-attributes/fixture.ts # Ignore CHANGELOG.md files to avoid issues with automated release job CHANGELOG.md @@ -35,8 +22,5 @@ CHANGELOG.md packages/website/.docusaurus packages/website/build -# see the file header in eslint-base.test.js for more info -packages/rule-tester/tests/eslint-base - /.nx/cache /.nx/workspace-data diff --git a/.vscode/extensions.json b/.vscode/extensions.json index d4d111dbe6e4..6b60d5d55159 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -5,8 +5,8 @@ "editorconfig.editorconfig", "esbenp.prettier-vscode", "streetsidesoftware.code-spell-checker", - "tlent.jest-snapshot-language-support", - "mrmlnc.vscode-json5" + "mrmlnc.vscode-json5", + "vitest.explorer" ], "unwantedRecommendations": ["hookyqr.beautify", "dbaeumer.jshint"] } diff --git a/.vscode/settings.json b/.vscode/settings.json index 896fbaebbb3a..b2472604617c 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -20,18 +20,5 @@ "javascript.preferences.quoteStyle": "single", "typescript.preferences.quoteStyle": "single", "editor.defaultFormatter": "esbenp.prettier-vscode", - - // make the .shot files from jest-specific-snapshot act like normal snapshots - "files.associations": { - "*.shot": "jest-snapshot" - }, - "vsicons.associations.files": [ - { - "icon": "jest_snapshot", - "extensions": [ - ".shot", - ], - "extends": "jest_snapshot" - }, - ], + "nxConsole.generateAiAgentRules": true, } diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c2483a9c2c3..36df7d48a5b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,433 @@ +## 8.46.4 (2025-11-10) + +### 🩹 Fixes + +- **eslint-plugin:** [no-deprecated] fix double-report on computed literal identifiers ([#11006](https://github.com/typescript-eslint/typescript-eslint/pull/11006), [#10958](https://github.com/typescript-eslint/typescript-eslint/issues/10958)) +- **eslint-plugin:** handle override modifier in promise-function-async fixer ([#11730](https://github.com/typescript-eslint/typescript-eslint/pull/11730)) +- **parser:** error when both `projectService` and `project` are set ([#11333](https://github.com/typescript-eslint/typescript-eslint/pull/11333)) + +### ❤️ Thank You + +- Evgeny Stepanovych @undsoft +- Kentaro Suzuki @sushichan044 +- Maria Solano @MariaSolOs + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.3 (2025-11-03) + +### 🩹 Fixes + +- **eslint-plugin:** [no-misused-promises] expand union type to retrieve target property ([#11706](https://github.com/typescript-eslint/typescript-eslint/pull/11706)) +- **eslint-plugin:** [no-duplicate-enum-values] support signed numbers ([#11722](https://github.com/typescript-eslint/typescript-eslint/pull/11722), [#11723](https://github.com/typescript-eslint/typescript-eslint/pull/11723)) + +### ❤️ Thank You + +- Evgeny Stepanovych @undsoft +- tao + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.2 (2025-10-20) + +### 🩹 Fixes + +- **eslint-plugin:** [prefer-optional-chain] skip optional chaining when it could change the result ([#11702](https://github.com/typescript-eslint/typescript-eslint/pull/11702)) +- **typescript-estree:** forbid invalid modifiers in object methods ([#11689](https://github.com/typescript-eslint/typescript-eslint/pull/11689)) + +### ❤️ Thank You + +- fisker Cheung @fisker +- mdm317 + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.1 (2025-10-13) + +### 🩹 Fixes + +- **ast-spec:** cleanup `TSLiteralType` ([#11624](https://github.com/typescript-eslint/typescript-eslint/pull/11624)) +- **eslint-plugin:** [prefer-optional-chain] include mixed "nullish comparison style" chains in checks ([#11533](https://github.com/typescript-eslint/typescript-eslint/pull/11533)) +- **eslint-plugin:** [no-misused-promises] special-case `.finally` not to report when a promise returning function is provided as an argument ([#11667](https://github.com/typescript-eslint/typescript-eslint/pull/11667)) + +### ❤️ Thank You + +- Abraham Guo +- mdm317 +- Ronen Amiel + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.0 (2025-10-06) + +### 🚀 Features + +- **eslint-plugin:** [no-unsafe-member-access] add allowOptionalChaining option ([#11659](https://github.com/typescript-eslint/typescript-eslint/pull/11659)) +- **eslint-plugin-internal:** [no-dynamic-tests] new internal Lint rule to ban dynamic syntax in generating tests ([#11323](https://github.com/typescript-eslint/typescript-eslint/pull/11323)) +- **rule-schema-to-typescript-types:** clean up and make public ([#11633](https://github.com/typescript-eslint/typescript-eslint/pull/11633)) +- **typescript-eslint:** export util types ([#10848](https://github.com/typescript-eslint/typescript-eslint/pull/10848), [#10849](https://github.com/typescript-eslint/typescript-eslint/pull/10849)) +- **typescript-estree:** mention file specifics in project service allowDefaultProject error ([#11635](https://github.com/typescript-eslint/typescript-eslint/pull/11635)) +- **typescript-estree:** private identifiers can only appear on LHS of in expressions ([#9232](https://github.com/typescript-eslint/typescript-eslint/pull/9232)) + +### 🩹 Fixes + +- **eslint-plugin:** [no-floating-promises] remove excess parentheses in suggestions ([#11487](https://github.com/typescript-eslint/typescript-eslint/pull/11487)) +- **eslint-plugin:** [unbound-method] improve wording around `this: void` and binding ([#11634](https://github.com/typescript-eslint/typescript-eslint/pull/11634)) +- **eslint-plugin:** [no-deprecated] ignore deprecated `export import`s ([#11603](https://github.com/typescript-eslint/typescript-eslint/pull/11603)) +- **eslint-plugin:** removed error type previously deprecated ([#11674](https://github.com/typescript-eslint/typescript-eslint/pull/11674)) +- **eslint-plugin:** [prefer-readonly-parameter-types] ignore tagged primitives ([#11660](https://github.com/typescript-eslint/typescript-eslint/pull/11660)) +- **rule-tester:** deprecate TestCaseError#type and LintMessage#nodeType ([#11628](https://github.com/typescript-eslint/typescript-eslint/pull/11628)) +- **typescript-estree:** forbid `abstract` modifier in object methods ([#11656](https://github.com/typescript-eslint/typescript-eslint/pull/11656)) +- **typescript-estree:** forbid abstract method and accessor to have implementation ([#11657](https://github.com/typescript-eslint/typescript-eslint/pull/11657)) + +### ❤️ Thank You + +- fisker Cheung @fisker +- Josh Goldberg ✨ +- Joshua Chen +- Kirk Waiblinger @kirkwaiblinger +- Mark de Dios @peanutenthusiast +- Mister-Hope @Mister-Hope +- Richard Torres @richardtorres314 +- Victor Genaev @mainframev +- Younsang Na @nayounsang + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.45.0 (2025-09-29) + +### 🚀 Features + +- **eslint-plugin:** expose rule name via RuleModule interface ([#11616](https://github.com/typescript-eslint/typescript-eslint/pull/11616)) + +### 🩹 Fixes + +- disable generating declaration maps ([#11627](https://github.com/typescript-eslint/typescript-eslint/pull/11627)) +- **ast-spec:** narrow ArrowFunctionExpression.generator to false ([#11636](https://github.com/typescript-eslint/typescript-eslint/pull/11636)) +- **eslint-plugin:** [no-base-to-string] check if superclass is ignored ([#11617](https://github.com/typescript-eslint/typescript-eslint/pull/11617)) +- **eslint-plugin:** [prefer-nullish-coalescing] ignoreBooleanCoercion should not apply to top-level ternary expressions ([#11614](https://github.com/typescript-eslint/typescript-eslint/pull/11614)) + +### ❤️ Thank You + +- Bjorn Lu +- Josh Goldberg ✨ +- mdm317 +- Moses Odutusin @thebolarin +- Yukihiro Hasegawa @y-hsgw + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.44.1 (2025-09-22) + +### 🩹 Fixes + +- **eslint-plugin:** [no-base-to-string] make ignoredTypeNames match type names without generics ([#11597](https://github.com/typescript-eslint/typescript-eslint/pull/11597)) +- **eslint-plugin:** [no-unsafe-enum-comparison] support unions of literals ([#11599](https://github.com/typescript-eslint/typescript-eslint/pull/11599)) +- **eslint-plugin:** [await-thenable] should not report passing values to promise aggregators which may be a promise in an array literal ([#11611](https://github.com/typescript-eslint/typescript-eslint/pull/11611)) +- **typescript-estree:** forbid class property with name `constructor` ([#11590](https://github.com/typescript-eslint/typescript-eslint/pull/11590)) + +### ❤️ Thank You + +- fisker Cheung @fisker +- Kirk Waiblinger @kirkwaiblinger +- mdm317 +- Ronen Amiel + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.44.0 (2025-09-15) + +### 🚀 Features + +- **eslint-plugin:** [await-thenable] report invalid (non-promise) values passed to promise aggregator methods ([#11267](https://github.com/typescript-eslint/typescript-eslint/pull/11267)) + +### 🩹 Fixes + +- **deps:** update dependency @eslint-community/eslint-utils to v4.8.0 ([#11589](https://github.com/typescript-eslint/typescript-eslint/pull/11589)) +- **eslint-plugin:** [no-unnecessary-type-conversion] ignore enum members ([#11490](https://github.com/typescript-eslint/typescript-eslint/pull/11490)) + +### ❤️ Thank You + +- Moses Odutusin @thebolarin +- Ronen Amiel + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.43.0 (2025-09-08) + +### 🚀 Features + +- **typescript-estree:** disallow empty type parameter/argument lists ([#11563](https://github.com/typescript-eslint/typescript-eslint/pull/11563)) + +### 🩹 Fixes + +- **eslint-plugin:** [no-non-null-assertion] do not suggest optional chain on LHS of assignment ([#11489](https://github.com/typescript-eslint/typescript-eslint/pull/11489)) +- **eslint-plugin:** [no-unnecessary-type-conversion] only report ~~ on integer literal types ([#11517](https://github.com/typescript-eslint/typescript-eslint/pull/11517)) +- **eslint-plugin:** [consistent-type-exports] fix declaration shadowing ([#11457](https://github.com/typescript-eslint/typescript-eslint/pull/11457)) +- **eslint-plugin:** [no-floating-promises] allowForKnownSafeCalls now supports function names ([#11423](https://github.com/typescript-eslint/typescript-eslint/pull/11423), [#11430](https://github.com/typescript-eslint/typescript-eslint/pull/11430)) +- **eslint-plugin:** [no-deprecated] should report deprecated exports and reexports ([#11359](https://github.com/typescript-eslint/typescript-eslint/pull/11359)) +- **eslint-plugin:** [prefer-return-this-type] don't report an error when returning a union type that includes a classType ([#11432](https://github.com/typescript-eslint/typescript-eslint/pull/11432)) +- **rule-tester:** normalize paths before checking if they escape cwd ([#11525](https://github.com/typescript-eslint/typescript-eslint/pull/11525)) +- **scope-manager:** exclude Program from DefinitionBase node types ([#11469](https://github.com/typescript-eslint/typescript-eslint/pull/11469)) +- **type-utils:** add union type support to TypeOrValueSpecifier ([#11526](https://github.com/typescript-eslint/typescript-eslint/pull/11526)) +- **typescript-estree:** match filenames starting with a period when using glob in allowDefaultProject / ([#11537](https://github.com/typescript-eslint/typescript-eslint/pull/11537)) + +### ❤️ Thank You + +- Dima @dbarabashh +- Kirk Waiblinger @kirkwaiblinger +- mdm317 +- Nicolas Le Cam +- tao +- Victor Genaev @mainframev +- Yukihiro Hasegawa @y-hsgw +- 민감자(Minji Kim) @mouse0429 +- 송재욱 + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.42.0 (2025-09-02) + +### 🚀 Features + +- deprecate tseslint.config() ([#11531](https://github.com/typescript-eslint/typescript-eslint/pull/11531)) + +### 🩹 Fixes + +- **deps:** update eslint monorepo to v9.33.0 ([#11482](https://github.com/typescript-eslint/typescript-eslint/pull/11482)) +- **typescript-eslint:** handle non-normalized windows paths produced by jiti ([#11546](https://github.com/typescript-eslint/typescript-eslint/pull/11546)) + +### ❤️ Thank You + +- Kirk Waiblinger @kirkwaiblinger + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.41.0 (2025-08-25) + +### 🚀 Features + +- tighten `tsconfigRootDir` validation ([#11463](https://github.com/typescript-eslint/typescript-eslint/pull/11463)) + +### 🩹 Fixes + +- resolve type error in eslint config ([#11500](https://github.com/typescript-eslint/typescript-eslint/pull/11500)) +- **deps:** update babel monorepo ([#11174](https://github.com/typescript-eslint/typescript-eslint/pull/11174)) +- **deps:** update dependency prettier to v3.6.2 ([#11496](https://github.com/typescript-eslint/typescript-eslint/pull/11496)) + +### ❤️ Thank You + +- Kirk Waiblinger @kirkwaiblinger + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.40.0 (2025-08-18) + +### 🚀 Features + +- **typescript-estree:** forbid invalid keys in `EnumMember` ([#11232](https://github.com/typescript-eslint/typescript-eslint/pull/11232)) + +### 🩹 Fixes + +- **typescript-eslint:** export `plugin`, `parser`, and `configs` that are compatible with both `defineConfig()` and `tseslint.config()` ([#11475](https://github.com/typescript-eslint/typescript-eslint/pull/11475)) +- **typescript-estree:** correct range of import assertion with trailing comma ([#11478](https://github.com/typescript-eslint/typescript-eslint/pull/11478)) +- **utils:** correct `calculateConfigForFile` return type ([#11451](https://github.com/typescript-eslint/typescript-eslint/pull/11451)) + +### ❤️ Thank You + +- fisker Cheung @fisker +- Kirk Waiblinger @kirkwaiblinger +- Nolan Gajdascz @Gajdascz + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.39.1 (2025-08-11) + +### 🩹 Fixes + +- **typescript-eslint:** handle `file://` urls in stack trace when inferring `tsconfigRootDir` ([#11464](https://github.com/typescript-eslint/typescript-eslint/pull/11464)) + +### ❤️ Thank You + +- Kirk Waiblinger @kirkwaiblinger + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.39.0 (2025-08-04) + +### 🚀 Features + +- update to TypeScript 5.9.2 ([#11445](https://github.com/typescript-eslint/typescript-eslint/pull/11445)) +- **eslint-plugin:** [naming-convention] add enumMember PascalCase default option ([#11127](https://github.com/typescript-eslint/typescript-eslint/pull/11127)) +- **eslint-plugin:** add no-unnecessary-type-conversion to strict-type-checked ruleset ([#11427](https://github.com/typescript-eslint/typescript-eslint/pull/11427)) +- **eslint-plugin:** [only-throw-error] support yield/await expressions ([#11417](https://github.com/typescript-eslint/typescript-eslint/pull/11417)) + +### 🩹 Fixes + +- **eslint-plugin:** [prefer-optional-chain] ignore `check` option for most RHS of a chain ([#11272](https://github.com/typescript-eslint/typescript-eslint/pull/11272)) +- **eslint-plugin:** [no-unsafe-assignment] add an `unsafeObjectPattern` message ([#11403](https://github.com/typescript-eslint/typescript-eslint/pull/11403)) + +### ❤️ Thank You + +- Brad Zacher @bradzacher +- James Garbutt @43081j +- Kim Sang Du @developer-bandi +- Sasha Kondrashov +- tao +- Younsang Na @nayounsang + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.38.0 (2025-07-21) + +### 🚀 Features + +- **typescript-estree:** forbid optional chain in `TemplateTaggedLiteral` ([#11391](https://github.com/typescript-eslint/typescript-eslint/pull/11391)) + +### 🩹 Fixes + +- disallow extra properties in rule options ([#11397](https://github.com/typescript-eslint/typescript-eslint/pull/11397)) +- **eslint-plugin:** [consistent-generic-constructors] resolve conflict with `isolatedDeclarations` if enabled in `constructor` option ([#11351](https://github.com/typescript-eslint/typescript-eslint/pull/11351)) +- **typescript-eslint:** infer tsconfigRootDir with v8 API ([#11412](https://github.com/typescript-eslint/typescript-eslint/pull/11412)) +- **typescript-eslint:** error on nested `extends` in `tseslint.config()` ([#11361](https://github.com/typescript-eslint/typescript-eslint/pull/11361)) +- **typescript-estree:** ensure the token type of the property name is Identifier ([#11329](https://github.com/typescript-eslint/typescript-eslint/pull/11329)) + +### ❤️ Thank You + +- Andrew Kazakov @andreww2012 +- Kirk Waiblinger @kirkwaiblinger +- MK @asdf93074 +- tao +- Younsang Na @nayounsang + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.37.0 (2025-07-14) + +### 🚀 Features + +- **typescript-estree:** infer tsconfigRootDir from call stack ([#11370](https://github.com/typescript-eslint/typescript-eslint/pull/11370)) + +### 🩹 Fixes + +- **eslint-plugin:** [unified-signatures] fix false positives for ignoreOverloadsWithDifferentJSDoc option ([#11381](https://github.com/typescript-eslint/typescript-eslint/pull/11381)) +- **type-utils:** add missing 'types' dependency to 'type-utils' ([#11383](https://github.com/typescript-eslint/typescript-eslint/pull/11383)) +- **type-utils:** handle namespaced exports in specifier matching ([#11380](https://github.com/typescript-eslint/typescript-eslint/pull/11380)) + +### ❤️ Thank You + +- Bill Collins +- Josh Goldberg ✨ +- René @Renegade334 +- Yukihiro Hasegawa @y-hsgw + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.36.0 (2025-07-07) + +### 🚀 Features + +- **typescript-eslint:** support `basePath` in `tseslint.config()` ([#11357](https://github.com/typescript-eslint/typescript-eslint/pull/11357)) + +### ❤️ Thank You + +- Kirk Waiblinger @kirkwaiblinger + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.35.1 (2025-06-30) + +### 🩹 Fixes + +- remove prettier from eslint-plugin ([#11339](https://github.com/typescript-eslint/typescript-eslint/pull/11339)) +- **website:** did not find a source file error if url hash doesn't contain fileType ([#11350](https://github.com/typescript-eslint/typescript-eslint/pull/11350)) + +### ❤️ Thank You + +- Abhijeet Singh @cseas +- mdm317 + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.35.0 (2025-06-23) + +### 🚀 Features + +- **eslint-plugin:** [no-base-to-string] add checkUnknown Option ([#11128](https://github.com/typescript-eslint/typescript-eslint/pull/11128)) + +### 🩹 Fixes + +- **website:** acquired types are shown in the editor but not reflected in linting ([#11198](https://github.com/typescript-eslint/typescript-eslint/pull/11198)) + +### ❤️ Thank You + +- Kim Sang Du @developer-bandi +- mdm317 + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.34.1 (2025-06-16) + +### 🩹 Fixes + +- **types:** add 2026/17 to EcmaVersion ([#11304](https://github.com/typescript-eslint/typescript-eslint/pull/11304)) +- **typescript-estree:** emit a Literal instead of Identifier for constructor when the identifier is a string ([#11299](https://github.com/typescript-eslint/typescript-eslint/pull/11299)) +- **visitor-keys:** bump `eslint-visitor-keys` dependency ([#11294](https://github.com/typescript-eslint/typescript-eslint/pull/11294)) + +### ❤️ Thank You + +- David Archibald +- overlookmotel +- Tao + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.34.0 (2025-06-09) + +### 🚀 Features + +- **type-utils:** deprecated getSourceFileOfNode function ([#11284](https://github.com/typescript-eslint/typescript-eslint/pull/11284)) + +### 🩹 Fixes + +- **typescript-estree:** change the token type of `null` from `Keyword` to `Null` ([#11283](https://github.com/typescript-eslint/typescript-eslint/pull/11283)) +- **typescript-estree:** add validation to interface extends ([#11271](https://github.com/typescript-eslint/typescript-eslint/pull/11271)) +- **visitor-keys:** fix visitor keys order ([#11279](https://github.com/typescript-eslint/typescript-eslint/pull/11279)) + +### ❤️ Thank You + +- Kim Sang Du @developer-bandi +- overlookmotel +- Tao + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.33.1 (2025-06-02) + +### 🩹 Fixes + +- exclude docs/ directory from eslint-plugin package ([#11251](https://github.com/typescript-eslint/typescript-eslint/pull/11251)) +- **project-service:** add missing `typescript` peer dependency ([#11265](https://github.com/typescript-eslint/typescript-eslint/pull/11265)) + +### ❤️ Thank You + +- JounQin +- roottool + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.33.0 (2025-05-26) + +### 🚀 Features + +- create standalone project-service, tsconfig-utils packages ([#11182](https://github.com/typescript-eslint/typescript-eslint/pull/11182)) + +### ❤️ Thank You + +- Josh Goldberg ✨ + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + ## 8.32.1 (2025-05-12) ### 🩹 Fixes diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md deleted file mode 100644 index 7c60ad27e4ce..000000000000 --- a/CONTRIBUTORS.md +++ /dev/null @@ -1,99 +0,0 @@ - - -# Contributors - -Thanks goes to these wonderful people: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Josh Goldberg ✨

Brad Zacher

James Henry

Armano

YeonJuan

Kirk Waiblinger

auvred

Abraham Guo

Joshua Chen

Oleksandr T.

Michaël De Boey

SUZUKI Sosuke

Reyad Attiyat

Gareth Jones

Patricio Trevino

Yukihiro Hasegawa

Nicholas C. Zakas

Kim Sang Du

Jed Fox

Arya Emami

Rafael Santana

fisker Cheung

Mark de Dios

Yosuke Ota

Bryan Mishkin

Emma

Simen Bekkhus

Flo Edelmann

JounQin

Jake Bailey

Danny Fritz

Tiger Oakes

Lauren Yim

Zzzen

Kanitkorn Sujautra

mdm317

kmin-jeong

Susisu

ldrick

Cparros

Arka Pratim Chaudhuri

Sukka

Niles Salter

Yuri Pieters

Tim Kraut

Yuya Yoshioka

zz

Anthony Fu

fregante

Ray

Daniel Cassidy

Dimitri Mitropoulos

Edwin Kofler

Hao Cheng

Ricardo Fernández Serrata
- - - - -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 1656a4bc2c6d..fde6040f8c7e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@

typescript-eslint

-

Monorepo for the tooling that enables ESLint and Prettier to support TypeScript

+

Monorepo for typescript-eslint: powerful static analysis for JavaScript and TypeScript

CI @@ -32,7 +32,7 @@ This project exists thanks to the awesome people who contribute code and documen Gallery of all contributors' profile photos -🙏 An extra special thanks goes out to the wonderful people listed in [`CONTRIBUTORS.md`](./CONTRIBUTORS.md) +🙏 An extra special thanks goes out to the wonderful people listed in . ## Financial Contributors diff --git a/docs/contributing/Issues.mdx b/docs/contributing/Issues.mdx index 5a1945127d0f..9735fccbfd94 100644 --- a/docs/contributing/Issues.mdx +++ b/docs/contributing/Issues.mdx @@ -41,6 +41,24 @@ Consider searching through: 1. [Unassigned user-facing marked as `accepting prs` and `good first issue`](https://github.com/typescript-eslint/typescript-eslint/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22+label%3A%22accepting+prs%22+-label%3A%22repo+maintenance%22+no%3Aassignee): to find issues marked as good for a first-timer 2. [Unassigned user-facing marked as `accepting prs` without `good first issue`](https://github.com/typescript-eslint/typescript-eslint/issues?q=is%3Aopen+is%3Aissue+label%3A%22accepting+prs%22+-label%3A%22good+first+issue%22+-label%3A%22repo+maintenance%22+no%3Aassignee): once you've finished a few issues, to find more intermediate-level issues +## "Evaluating Community Engagement" + +The typescript-eslint project has limited maintenance bandwidth and cannot commit to every potentially valid issue. +It can be difficult to tell if some issues' impacts would be worth taking bandwidth away from other, higher-impact issues. +For those issues, we will: + +1. Add an `evaluating community engagement` label to indicate the issue is under review +2. Wait at least 3-6 months +3. Either accept or decline the issue, depending on how much engagement the issue receives + +If your issue is marked as `evaluating community engagement`, we encourage you to: + +- Socialize the issue online to find other users who are in favor of it +- Try out the proposed changes in your own projects + - If the issue is for a new lint rule, consider using our [Building ESLint Plugins documentation](https://typescript-eslint.io/developers/eslint-plugins) to create a standalone plugin users can try + +See [Maintenance > Issues > Community Engagement Evaluation](https://typescript-eslint.io/maintenance/issues/#community-engagement-evaluation) for documentation on our corresponding maintenance practices. + ## Questions and Support Requests The issue tracker is not an appropriate place for questions or support requests. diff --git a/docs/contributing/Local_Development.mdx b/docs/contributing/Local_Development.mdx index 19b883286fab..705c95f8b2bf 100644 --- a/docs/contributing/Local_Development.mdx +++ b/docs/contributing/Local_Development.mdx @@ -59,7 +59,9 @@ Changes must pass two linters for documentation and naming, the commands for whi All code changes should ideally be unit tested if possible. You can run `yarn test` in any package to run its tests. -> [VS Code launch tasks](https://code.visualstudio.com/docs/editor/tasks) tasks are provided that allow [visual debugging](https://code.visualstudio.com/docs/editor/debugging) tests. +Oftentimes, you will only want to run one specific test related to the bug you are fixing or the feature you are implementing. To do this, you can add `only: true` to the test object definition. (Doing this will cause a new lint error for `eslint-plugin/no-only-tests`, but just ignore it while you work. The lint rule is only there so that you remember to delete the `only: true` once it comes time to make a pull request.) + +> The repository has [Visual Studio Code launch tasks](https://code.visualstudio.com/docs/editor/tasks) that allow for [visually debugging tests](https://code.visualstudio.com/docs/editor/debugging). ### Type Checking diff --git a/docs/contributing/Pull_Requests.mdx b/docs/contributing/Pull_Requests.mdx index ae2626cfcdfd..e1aa475654b7 100644 --- a/docs/contributing/Pull_Requests.mdx +++ b/docs/contributing/Pull_Requests.mdx @@ -48,16 +48,6 @@ For rule tests we recommend, when reasonable: AST tests belong in the `ast-spec` package, within `fixtures/` subfolders alongside the AST declarations. Each test has its own `/` folder, containing a `fixture.ts` file defining the test, and a `snapshots/` subfolder. Happy-path test folders are stored directly under `fixtures/`; error-path test folders go under `fixtures/_errors/`. You can check out the [`ClassDeclaration` fixtures folder](https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/ast-spec/src/declaration/ClassDeclaration/fixtures) for an example of both happy-path and unhappy-path test folders. -### Updating Snapshots - -[Jest snapshots](https://jestjs.io/docs/snapshot-testing) are generated for use in some tests, e.g. for [rule schemas](https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/eslint-plugin/tests/schema-snapshots) and [code examples in rule docs](https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/eslint-plugin/tests/docs-eslint-output-snapshots). You may need to re-generate these snapshots after adjusting a rule and/or its documentation, by running the relevant test suite(s) with the `-u` flag: - -```bash -cd packages/eslint-plugin -yarn test docs -u -yarn test schemas -u -``` - ## Raising the PR Once your changes are ready, you can raise a PR! 🙌 diff --git a/docs/getting-started/Quickstart.mdx b/docs/getting-started/Quickstart.mdx index 79e65c2b9915..c362a5978ffd 100644 --- a/docs/getting-started/Quickstart.mdx +++ b/docs/getting-started/Quickstart.mdx @@ -35,9 +35,10 @@ Next, create an `eslint.config.mjs` config file in the root of your project, and // @ts-check import eslint from '@eslint/js'; +import { defineConfig } from 'eslint/config'; import tseslint from 'typescript-eslint'; -export default tseslint.config( +export default defineConfig( eslint.configs.recommended, tseslint.configs.recommended, ); @@ -45,6 +46,12 @@ export default tseslint.config( This code will enable our [recommended configuration](../users/Shared_Configurations.mdx) for linting. +#### Details + +- `defineConfig(...)` is an optional helper function built in to current versions of ESLint. See [the ESLint configuration docs](https://eslint.org/docs/latest/use/configure/configuration-files) for more detail. +- `'@eslint/js'` / `eslint.configs.recommended` turns on [eslint's recommended config](https://www.npmjs.com/package/@eslint/js). +- `tseslint.configs.recommended` turns on [our recommended config](../users/Shared_Configurations.mdx#recommended). +

Aside on file extensions @@ -52,12 +59,6 @@ The `.mjs` extension makes the file use the [ES modules (ESM)](https://developer
-#### Details - -- `tseslint.config(...)` is an **_optional_** helper function — see [`typescript-eslint`'s `config(...)`](../packages/TypeScript_ESLint.mdx#config). -- `'@eslint/js'` / `eslint.configs.recommended` turns on [eslint's recommended config](https://www.npmjs.com/package/@eslint/js). -- `tseslint.configs.recommended` turns on [our recommended config](../users/Shared_Configurations.mdx#recommended). - ### Step 3: Running ESLint Open a terminal to the root of your project and run the following command: @@ -100,7 +101,7 @@ We recommend you consider enabling the following two configs: - [`stylistic`](../users/Shared_Configurations.mdx#stylistic): additional rules that enforce consistent styling without significantly catching bugs or changing logic. ```js title="eslint.config.mjs" -export default tseslint.config( +export default defineConfig( eslint.configs.recommended, // Remove this line tseslint.configs.recommended, diff --git a/docs/getting-started/Typed_Linting.mdx b/docs/getting-started/Typed_Linting.mdx index 3459ce890d42..066774382586 100644 --- a/docs/getting-started/Typed_Linting.mdx +++ b/docs/getting-started/Typed_Linting.mdx @@ -20,9 +20,10 @@ To enable typed linting, there are two small changes you need to make to your co ```js title="eslint.config.mjs" import eslint from '@eslint/js'; +import { defineConfig } from 'eslint/config'; import tseslint from 'typescript-eslint'; -export default tseslint.config( +export default defineConfig( eslint.configs.recommended, // Remove this line tseslint.configs.recommended, @@ -32,7 +33,6 @@ export default tseslint.config( languageOptions: { parserOptions: { projectService: true, - tsconfigRootDir: import.meta.dirname, }, }, }, @@ -40,11 +40,6 @@ export default tseslint.config( ); ``` -:::note -[`import.meta.dirname`](https://nodejs.org/api/esm.html#importmetadirname) is only present for ESM files in Node.js >=20.11.0 / >= 21.2.0.
-For CommonJS modules and/or older versions of Node.js, [use `__dirname` or an alternative](https://stackoverflow.com/questions/46745014/alternative-for-dirname-in-node-js-when-using-es6-modules). -::: - In more detail: - `tseslint.configs.recommendedTypeChecked` is a [shared configuration](../users/Shared_Configurations.mdx). It contains recommended rules that additionally require type information. @@ -82,7 +77,7 @@ module.exports = { In more detail: - `plugin:@typescript-eslint/recommended-type-checked` is a [shared configuration](../users/Shared_Configurations.mdx). It contains recommended rules that additionally require type information. -- `parserOptions.projectService: true` indicates to ask TypeScript's type checking service for each source file's type information (see [Parser > `projectService`](../packages/Parser.mdx#projectService)). +- `parserOptions.projectService: true` indicates to ask TypeScript's type checking service for each source file's type information (see [Parser > `projectService`](../packages/Parser.mdx#projectservice)). - `parserOptions.tsconfigRootDir` tells our parser the absolute path of your project's root directory (see [Parser > `tsconfigRootDir`](../packages/Parser.mdx#tsconfigrootdir)). @@ -104,7 +99,7 @@ If you enabled the [`strict` shared config](../users/Shared_Configurations.mdx#s ```js title="eslint.config.mjs" -export default tseslint.config( +export default defineConfig( eslint.configs.recommended, // Removed lines start tseslint.configs.strict, @@ -163,5 +158,5 @@ If you're having problems with typed linting, please see our [Troubleshooting FA For details on the parser options that enable typed linting, see: -- [Parser > `projectService`](../packages/Parser.mdx#projectService): our recommended option, with settings to customize TypeScript project information -- [Parser > `project`](../packages/Parser.mdx#projectService): an older option that can be used as an alternative +- [Parser > `projectService`](../packages/Parser.mdx#projectservice): our recommended option, with settings to customize TypeScript project information +- [Parser > `project`](../packages/Parser.mdx#project): an older option that can be used as an alternative diff --git a/docs/maintenance/Branding.mdx b/docs/maintenance/Branding.mdx index d4e84d90deae..5ab5af30f691 100644 --- a/docs/maintenance/Branding.mdx +++ b/docs/maintenance/Branding.mdx @@ -22,7 +22,7 @@ Combining lowercase with a dash helps differentiate us. ### Slogan -> The tooling that enables ESLint and Prettier to support TypeScript. +> Powerful static analysis for JavaScript and TypeScript. ## Visuals diff --git a/docs/maintenance/Contributor_Tiers.mdx b/docs/maintenance/Contributor_Tiers.mdx index 769d523b8e18..ada16278379b 100644 --- a/docs/maintenance/Contributor_Tiers.mdx +++ b/docs/maintenance/Contributor_Tiers.mdx @@ -76,6 +76,21 @@ We treat everything here as approximate numbers. We're a small enough team to informally discuss changes ad hoc and allow off-by-one-or-two months. ::: +## Advancement + +Are you looking to graduate from _contributor_ to _committer_? +Great! + +Roughly speaking, we're looking for folks who are interested in growing towards: + +- Being able to contribute to docs & ideation discussions, not just chores + rule fixes & features +- Being able to empathetically understand the needs of lint rule users (i.e. not just their own personal preferences) +- Consistently sending high-quality issues and PRs + - It's expected that some will have long rounds of discussion; we're more looking to avoid making "common" mistakes repeatedly (requesting review with failing builds, clear large gaps in logic, etc.) + +If you've been sending issues and pull requests to typescript-eslint for a few months and want to get more involved, please reach out to one of the maintainers over Discord or email. +We'd love to support you in joining the team. + ## Pointing Although it's impossible to accurately estimate software projects, we want to roughly establish expectations of effort+time spent on the tiers. diff --git a/docs/maintenance/Pull_Requests.mdx b/docs/maintenance/Pull_Requests.mdx index 04c1547f0cb7..ec1cfa24d2c4 100644 --- a/docs/maintenance/Pull_Requests.mdx +++ b/docs/maintenance/Pull_Requests.mdx @@ -80,7 +80,6 @@ If there's no backing issue: - Parenthesis and whitespace (see: `getWrappingFixer`). - Unions and intersections (see: `unionConstituents` and `intersectionConstituents`). - Unit tests: - - All lines are covered per the Codecov / `yarn jest path/to/impacted/file --coverage` report. - Both "positive" and "negative" ("valid" and "invalid") cases exist, if reasonably possible to test for. - Fixes and suggestions, if present, don't remove `//` or `/*` comments - `invalid` lint rule errors include line and column information diff --git a/docs/maintenance/Releases.mdx b/docs/maintenance/Releases.mdx index 4e8eb84a4876..5473869cf388 100644 --- a/docs/maintenance/Releases.mdx +++ b/docs/maintenance/Releases.mdx @@ -34,6 +34,7 @@ Per [Users > Releases > Major Releases](../users/Releases.mdx#major-releases), w - Its publish command should be `npx nx release publish --tag rc-v${major} --verbose`. - `README.md`: - Add a link to a `v${major}--typescript-eslint.netlify.app` preview deploy environment on Netlify that you create for the branch. + - `docusaurus.config.mts`: updating the `supportedMajorVersion` variable - Merge this into `main` once reviewed and rebase the `v${major}` branch. #### 1a. Shared Config Changes @@ -77,6 +78,7 @@ These should only be done for feedback that consistently comes up in community t - It is important to note that when merged the commit message must also include `BREAKING CHANGE:` as the first line in order for `nx release` to recognize it as a breaking change in the release notes. If you miss this it just means more manual work when writing the release documentation. 1. Write and share out a blog post announcing the new beta [example: [Docs: Blog post describing changes & migration strategy for v5->v6](https://github.com/typescript-eslint/typescript-eslint/issues/6466)]. - Keep this post up-to-date as changes land in the `v${major}` branch. +1. Send a PR to the `v${major}` branch that adds the old major version to [Users > Releases > Old Release Documentation](../users/Releases.mdx#old-release-documentation) 1. Wait until all required PRs have been merged 1. Write a blog post announcing the new release [example: [Docs: Release blog post for v6](https://github.com/typescript-eslint/typescript-eslint/issues/7153)], and land it in the `v${major}` branch. 1. Let the release wait for **at least 1 week** to allow time for early adopters to help test it and discuss the changes. @@ -93,6 +95,9 @@ They don't need any special treatment. 1. Discuss with the maintainers to be ready for an [out-of-band](#out-of-band-releases) release. Doing this manually helps ensure someone is on-hand to action any issues that might arise from the major release. 1. Prepare the release notes. `nx release` will automatically generate the release notes on GitHub, however this will be disorganized and unhelpful for users. We need to reorganize the release notes so that breaking changes are placed at the top to make them most visible. If any migrations are required, we must list the steps to make it easy for users. - Example release notes: [`v6.0.0`](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v6.0.0), [`v5.0.0`](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v5.0.0) +1. Update Netlify deploys for old sites: + 1. Update the `CURRENT_MAJOR_VERSION` environment variable to the new major version integer, such as `9` + 2. Re-deploy the `v${major}` branches listed in [Users > Releases > Old Release Documentation](../users/Releases.mdx#old-release-documentation) 1. Finally, post the release on social media with a link to the GitHub release. Make sure you include additional information about the highlights of the release! ## Out-of-Band Releases diff --git a/docs/maintenance/pull-requests/Dependency_Version_Upgrades.mdx b/docs/maintenance/pull-requests/Dependency_Version_Upgrades.mdx index 596c7ea0611e..a009e10aaa4b 100644 --- a/docs/maintenance/pull-requests/Dependency_Version_Upgrades.mdx +++ b/docs/maintenance/pull-requests/Dependency_Version_Upgrades.mdx @@ -112,7 +112,6 @@ See [feat: drop support for node v12](https://github.com/typescript-eslint/types We generally start the process of supporting a new TypeScript version just after the first beta release for that version is made available. 1. Create and pin an issue with a title like _TypeScript X.Y Support_, `accepting prs`, `AST`, `dependencies`, and `New TypeScript Version` labels, and the following contents: - 1. A link to the _TypeScript X.Y Iteration Plan_ issue from the Microsoft issue tracker 2. The following text: diff --git a/docs/packages/ESLint_Plugin.mdx b/docs/packages/ESLint_Plugin.mdx index 263d7e4123a5..d02afc4be7b0 100644 --- a/docs/packages/ESLint_Plugin.mdx +++ b/docs/packages/ESLint_Plugin.mdx @@ -11,6 +11,7 @@ sidebar_label: eslint-plugin :::info See [Getting Started](../getting-started/Quickstart.mdx) for documentation on how to lint your TypeScript code with ESLint. +If you're using ESLint's flat config (`eslint.config.*`), you don't need to install this package or `@typescript-eslint/parser` explicitly. ::: `@typescript-eslint/eslint-plugin` is an ESLint plugin used to load in custom rules and rule configurations lists from typescript-eslint. diff --git a/docs/packages/Parser.mdx b/docs/packages/Parser.mdx index cd2ecaa19cc0..28f5c7bee463 100644 --- a/docs/packages/Parser.mdx +++ b/docs/packages/Parser.mdx @@ -63,7 +63,7 @@ interface ParserOptions { ### `disallowAutomaticSingleRunInference` -> Default `process.env.TSESTREE_SINGLE_RUN` or `true`. +> Default: `process.env.TSESTREE_SINGLE_RUN` or `true`. Whether to stop using common heuristics to infer whether ESLint is being used as part of a single run (as opposed to `--fix` mode or in a persistent session such as an editor extension). In other words, typescript-eslint is faster by default, and this option disables an automatic performance optimization. @@ -94,7 +94,7 @@ Optional additional options to describe how to parse the raw syntax. #### `jsx` -> Default `false`. +> Default: `false`. Enable parsing JSX when `true`. More details can be found in the [TypeScript handbook's JSX docs](https://www.typescriptlang.org/docs/handbook/jsx.html). @@ -115,13 +115,13 @@ The exact behavior is as follows: #### `globalReturn` -> Default `false`. +> Default: `false`. This options allows you to tell the parser if you want to allow global `return` statements in your codebase. ### `ecmaVersion` -> Default `2018`. +> Default: `2018`. Accepts any valid ECMAScript version number or `'latest'`: @@ -135,19 +135,19 @@ Specifies the version of ECMAScript syntax you want to use. This is used by the ### `emitDecoratorMetadata` -> Default `undefined`. +> Default: `undefined`. This option allow you to tell parser to act as if `emitDecoratorMetadata: true` is set in `tsconfig.json`, but without [type-aware linting](../getting-started/Typed_Linting.mdx). In other words, you don't have to specify `parserOptions.project` in this case, making the linting process faster. ### `experimentalDecorators` -> Default `undefined`. +> Default: `undefined`. This option allow you to tell parser to act as if `experimentalDecorators: true` is set in `tsconfig.json`, but without [type-aware linting](../getting-started/Typed_Linting.mdx). In other words, you don't have to specify `parserOptions.project` in this case, making the linting process faster. ### `extraFileExtensions` -> Default `undefined`. +> Default: `undefined`. This option allows you to provide one or more additional file extensions which should be considered in the TypeScript Program compilation. The default extensions are `['.js', '.mjs', '.cjs', '.jsx', '.ts', '.mts', '.cts', '.tsx']`. @@ -159,7 +159,7 @@ See [Changes to `extraFileExtensions` with `projectService`](../troubleshooting/ ### `isolatedDeclarations` -> Default `undefined`. +> Default: `undefined`. This option allow you to tell parser to act as if `isolatedDeclarations: true` is set in `tsconfig.json`, but without [type-aware linting](../getting-started/Typed_Linting.mdx). In other words, you don't have to specify `parserOptions.project` in this case, making the linting process faster. @@ -181,7 +181,7 @@ If you do not use lint rules like `eslint-plugin-deprecation` that rely on TS's ### `jsxFragmentName` -> Default `null` +> Default: `null` The identifier that's used for JSX fragment elements (after transpilation). If `null`, assumes transpilation will always use a member of the configured `jsxPragma`. @@ -191,7 +191,7 @@ If you provide `parserOptions.project`, you do not need to set this, as it will ### `jsxPragma` -> Default `'React'` +> 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 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`. @@ -202,7 +202,7 @@ If you provide `parserOptions.project`, you do not need to set this, as it will ### `lib` -> Default `['es2018']` +> Default: `['es2018']` For valid options, see the [TypeScript compiler options](https://www.typescriptlang.org/tsconfig#lib). @@ -212,7 +212,7 @@ If you provide `parserOptions.project`, you do not need to set this, as it will ### `programs` -> Default `undefined`. +> Default: `undefined`. This option allows you to programmatically provide an instance of a TypeScript Program object that will provide type information to rules. This will override any programs that would have been computed from `parserOptions.project`. @@ -226,7 +226,7 @@ All linted files must be part of the provided program(s). We now recommend using [`projectService`](#projectservice) instead of `project` for easier configuration and faster linting. ::: -> Default `undefined`. +> Default: `undefined`. A path to your project's TSConfig. **This setting or [`projectService`](#projectservice) are required to use [rules which require type information](../getting-started/Typed_Linting.mdx)**. @@ -251,7 +251,6 @@ project: null; ``` - If `true`, each source file's parse will find the nearest `tsconfig.json` file to that source file. - - This is done by checking that source file's directory tree for the nearest `tsconfig.json`. - If you use project references, TypeScript will **not** automatically use project references to resolve files. This means that you will have to add each referenced tsconfig to the `project` field either separately, or via a glob. @@ -282,18 +281,20 @@ If this setting is specified, you must only lint files that are included in the } ``` -For an option that allows linting files outside of your TSConfig file(s), see [`projectService`](#projectService). +For an option that allows linting files outside of your TSConfig file(s), see [`projectService`](#projectservice). ### `projectService` -> Default `false`. +> Default: `false`. Specifies using TypeScript APIs to generate type information for rules. It will automatically use the nearest `tsconfig.json` for each file (like `project: true`). It can also be configured to also allow type information to be computed for JavaScript files without the `allowJs` compiler option (unlike `project: true`). +See [Typed Linting with `parserOptions.projectService`](/blog/project-service) for more context. + @@ -354,7 +355,7 @@ See [Troubleshooting & FAQs > Typed Linting > Project Service Issues](../trouble ##### `allowDefaultProject` -> Default `[]` _(none)_ +> Default: `[]` _(none)_ Globs of files to allow running with the default project compiler options despite not being matched by the project service. It takes in an array of string paths that will be resolved relative to the [`tsconfigRootDir`](#tsconfigrootdir). @@ -370,7 +371,7 @@ There are several restrictions on this option to prevent it from being overused: ##### `defaultProject` -> Default `'tsconfig.json'` +> Default: `'tsconfig.json'` Path to a TSConfig to use instead of TypeScript's default project configuration. It takes in a string path that will be resolved relative to the [`tsconfigRootDir`](#tsconfigrootdir). @@ -379,7 +380,7 @@ It takes in a string path that will be resolved relative to the [`tsconfigRootDi ##### `loadTypeScriptPlugins` -> Default `false` +> Default: `false` Whether the project service should be allowed to load [TypeScript plugins](https://www.typescriptlang.org/tsconfig/plugins.html). This is `false` by default to prevent plugins from registering persistent file watchers or other operations that might prevent ESLint processes from exiting when run on the command-line. @@ -404,7 +405,7 @@ Each file match slows down linting, so if you do need to use this, please file a ### `projectFolderIgnoreList` -> Default `["**/node_modules/**"]`. +> Default: `["**/node_modules/**"]`. This option allows you to ignore folders from being included in your provided list of `project`s. This is useful if you have configured glob patterns, but want to make sure you ignore certain folders. @@ -415,14 +416,25 @@ For example, by default it will ensure that a glob like `./**/tsconfig.json` wil ### `tsconfigRootDir` -> Default `undefined`. +> Default: the directory of the ESLint config file. This option allows you to provide the root directory for relative TSConfig paths specified in the `project` option above. Doing so ensures running ESLint from a directory other than the root will still be able to find your TSConfig. +`tsconfigRootDir` uses the call stack to determine the closest `eslint.config.*` ESLint config file. +In rare edge cases, that detection logic may be tricked by unusual paths and resolve to an incorrect value. +Manually specifying `tsconfigRootDir` to the directory of your ESLint config file will work around those issues: + +```js +parserOptions: { + tsconfigRootDir: import.meta.dirname, + // or, in CommonJS, __dirname +} +``` + ### `warnOnUnsupportedTypeScriptVersion` -> Default `true`. +> Default: `true`. This option allows you to toggle the warning that the parser will give you if you use a version of TypeScript which is not explicitly supported. The warning message would look like this: diff --git a/docs/packages/Project_Service.mdx b/docs/packages/Project_Service.mdx new file mode 100644 index 000000000000..7cfe65b67d93 --- /dev/null +++ b/docs/packages/Project_Service.mdx @@ -0,0 +1,39 @@ +--- +id: project-service +sidebar_label: project-service +toc_max_heading_level: 3 +--- + +import GeneratedDocs from './project-service/generated/index.md'; + +# `@typescript-eslint/project-service` + + + +> Standalone TypeScript project service wrapper for linting ✨ + +The typescript-eslint Project Service is a wrapper around TypeScript's "project service" APIs. +These APIs are what editors such as VS Code use to programmatically "open" files and generate TypeScript programs for type information. + +:::note +See [Blog > Typed Linting with Project Service](/blog/project-service) for more details on how lint users interact with the Project Service. +::: + +```ts +import { createProjectService } from '@typescript-eslint/project-service'; + +const filePathAbsolute = '/path/to/your/project/index.ts'; +const { service } = createProjectService(); + +service.openClientFile(filePathAbsolute); + +const scriptInfo = service.getScriptInfo(filePathAbsolute)!; +const program = service + .getDefaultProjectForFile(scriptInfo.fileName, true)! + .getLanguageService(true) + .getProgram()!; +``` + +The following documentation is auto-generated from source code. + + diff --git a/docs/packages/RuleSchemaToTypeScriptTypes.mdx b/docs/packages/RuleSchemaToTypeScriptTypes.mdx new file mode 100644 index 000000000000..c684c357c5f6 --- /dev/null +++ b/docs/packages/RuleSchemaToTypeScriptTypes.mdx @@ -0,0 +1,36 @@ +--- +id: rule-schema-to-typescript-types +sidebar_label: rule-schema-to-typescript-types +toc_max_heading_level: 3 +--- + +import GeneratedDocs from './rule-schema-to-typescript-types/generated/index.md'; + +# `@typescript-eslint/rule-schema-to-typescript-types` + + + +> Converts ESLint rule schemas to equivalent TypeScript type strings ✨ + +```ts +import { schemaToTypes } from '@typescript-eslint/rule-schema-to-typescript-types'; + +// " +// type Options = [ +// /** My great option! */ +// string[] +// ]; +// " +schemaToTypes({ + description: 'My great option!', + items: { type: 'string' }, + type: 'array', +}); +``` + +The following documentation is auto-generated from source code. + + diff --git a/docs/packages/TSConfig_Utils.mdx b/docs/packages/TSConfig_Utils.mdx new file mode 100644 index 000000000000..1ce3361c7fa4 --- /dev/null +++ b/docs/packages/TSConfig_Utils.mdx @@ -0,0 +1,17 @@ +--- +id: tsconfig-utils +sidebar_label: tsconfig-utils +toc_max_heading_level: 3 +--- + +import GeneratedDocs from './tsconfig-utils/generated/index.md'; + +# `@typescript-eslint/tsconfig-utils` + + + +> Utilities for collecting TSConfigs for linting scenarios ✨ + +The following documentation is auto-generated from source code. + + diff --git a/docs/packages/TypeScript_ESLint.mdx b/docs/packages/TypeScript_ESLint.mdx index f4e7106bf9ac..9533048caf83 100644 --- a/docs/packages/TypeScript_ESLint.mdx +++ b/docs/packages/TypeScript_ESLint.mdx @@ -16,12 +16,13 @@ This package is the main entrypoint that you can use to consume our tooling with This package exports the following: -| Name | Description | -| --------- | -------------------------------------------------------------------------------------- | -| `config` | A utility function for creating type-safe flat configs -- see [`config(...)`](#config) | -| `configs` | [Shared ESLint (flat) configs](../users/Shared_Configurations.mdx) | -| `parser` | A re-export of [`@typescript-eslint/parser`](./Parser.mdx) | -| `plugin` | A re-export of [`@typescript-eslint/eslint-plugin`](./ESLint_Plugin.mdx) | +| Name | Description | +| --------------------- | ------------------------------------------------------------------------------------------------- | +| `config` (deprecated) | A utility function for creating type-safe flat configs -- see [`config(...)`](#config-deprecated) | +| `configs` | [Shared ESLint (flat) configs](../users/Shared_Configurations.mdx) | +| `parser` | A re-export of [`@typescript-eslint/parser`](./Parser.mdx) | +| `plugin` | A re-export of [`@typescript-eslint/eslint-plugin`](./ESLint_Plugin.mdx) | +| `FlatConfig` | A re-export of the type from [`@typescript-eslint/utils`](./Utils.mdx) | ## Installation @@ -31,15 +32,16 @@ npm i typescript-eslint ## Usage -We recommend getting started by using `tseslint.config` helper function in your ESLint config: +We recommend getting started by using the default ESLint setup with our shared configs. ```js title="eslint.config.mjs" // @ts-check import eslint from '@eslint/js'; +import { defineConfig } from 'eslint/config'; import tseslint from 'typescript-eslint'; -export default tseslint.config( +export default defineConfig( eslint.configs.recommended, tseslint.configs.recommended, ); @@ -47,7 +49,16 @@ export default tseslint.config( This config file exports a flat config that enables both the [core ESLint recommended config](https://www.npmjs.com/package/@eslint/js) and [our recommended config](../users/Shared_Configurations.mdx#recommended). -### `config(...)` +### `config(...)` (deprecated) + +:::danger + +The `config(...)` utility function was deprecated in favor of ESLint core's [`defineConfig(...)`]() in [#10935](https://github.com/typescript-eslint/typescript-eslint/issues/10935). +See [the `defineConfig` migration guide later](#migrating-to-defineconfig) for more details. + +The documentation here is preserved for historical reference and migration purposes. + +::: `tseslint.config(...)` takes in any number of ESLint config objects, each of which may additionally include an `extends` array of configs to extend. `tseslint.config(...)` returns the equivalent ESLint config of applying the rest of the settings for each extension. @@ -105,7 +116,7 @@ Otherwise it _will not_ impact your ability to use our tooling. #### Flat config `extends` -The `tseslint.config` utility function also adds handling for the `extends` property on flat config objects. +The `tseslint.config(...)` utility function also adds handling for the `extends` property on flat config objects. This allows you to more easily extend shared configs for specific file patterns whilst also overriding rules/options provided by those configs: ```js @@ -159,9 +170,82 @@ export default tseslint.config({ }); ``` +#### Migrating to `defineConfig(...)` + +The core `defineConfig(...)` helper is a nearly exact clone of `tseslint.config(...)` that was [first released in ESLint v9.22.0](https://eslint.org/blog/2025/03/eslint-v9.22.0-released/). +See [the ESLint blog post](https://eslint.org/blog/2025/03/flat-config-extends-define-config-global-ignores/#support-for-older-eslint-versions) for info on how to use `defineConfig(...)` with older versions of ESLint. + +At the time of writing there are a small number of known edge cases in which the two have different functionality. + +{/* https://github.com/prettier/prettier/issues/17816 -- prettier has trouble with the code fences in the custom elements */} + +{/* prettier-ignore */} +1. Overriding `files` in `extends`. + When `files` is provided in both a base object and an extension, `tseslint.config(...)` _overrides_ the `files` property in the extension, whereas `defineConfig(...)` semantically intersects the two provided `files` specifiers. + + + + ```ts title="eslint.config.mjs" + import tseslint from 'typescript-eslint'; + + export default tseslint.config({ + files: ['a.ts'], + extends: [ + { + files: ['b.ts'], + rules: { + 'some-rule': 'error', + }, + }, + ], + }); + + // is equivalent to + + export default { + files: ['a.ts'], + rules: { 'some-rule': 'error' }, + }; + ``` + + + + + ```ts title="eslint.config.mjs" + import { defineConfig } from 'eslint/config'; + + export default defineConfig({ + files: ['a.ts'], + extends: [ + { + files: ['b.ts'], + rules: { + 'some-rule': 'error', + }, + }, + ], + }); + + // is equivalent to + + // The base config technically ensures that 'a.ts' is still included in + // the lint run, but otherwise the config has no effect, due to the + // intersection of 'a.ts' and 'b.ts' being empty. + export default { + files: ['a.ts'], + }; + ``` + + + + +2. Type declarations (only applies to users who typecheck their eslint configs). + There are slight differences in the way types are declared between the two functions, which may cause typechecking errors when you switch from `tseslint.config(...)` to `defineConfig(...)` in some cases (see [#10899](https://github.com/typescript-eslint/typescript-eslint/issues/10899) for an example that used to impact typescript-eslint's own configs). + Type errors such as these do not indicate a runtime problem and can safely be ignored. + ### Manual usage -[typescript-eslint's recommended and stylistic configurations](../users/configs) specify typescript-eslint `parser` and `plugin` options for you, so there is no need to manually provide those. +[typescript-eslint's recommended and stylistic configurations](../users/Shared_Configurations.mdx) specify typescript-eslint `parser` and `plugin` options for you, so there is no need to manually provide those. However, in complex ESLint configurations, you may find yourself manually specifying those options yourself. #### Manually configuring our plugin and parser @@ -172,10 +256,11 @@ You can declare our plugin and parser in your config via this package, for examp // @ts-check import eslint from '@eslint/js'; +import { defineConfig } from 'eslint/config'; import jestPlugin from 'eslint-plugin-jest'; import tseslint from 'typescript-eslint'; -export default tseslint.config({ +export default defineConfig({ plugins: { // highlight-next-line '@typescript-eslint': tseslint.plugin, @@ -185,7 +270,6 @@ export default tseslint.config({ parser: tseslint.parser, parserOptions: { projectService: true, - tsconfigRootDir: import.meta.dirname, }, }, rules: { @@ -217,10 +301,11 @@ This config: // @ts-check import eslint from '@eslint/js'; +import { defineConfig } from 'eslint/config'; import jestPlugin from 'eslint-plugin-jest'; import tseslint from 'typescript-eslint'; -export default tseslint.config( +export default defineConfig( { // config with just ignores is the replacement for `.eslintignore` ignores: ['**/build/**', '**/dist/**', 'src/some/file/to/ignore.ts'], diff --git a/docs/packages/type-utils/TypeOrValueSpecifier.mdx b/docs/packages/type-utils/TypeOrValueSpecifier.mdx index 7a21d16cf26d..fd04f70cb3bc 100644 --- a/docs/packages/type-utils/TypeOrValueSpecifier.mdx +++ b/docs/packages/type-utils/TypeOrValueSpecifier.mdx @@ -76,6 +76,12 @@ Lib types include `lib.dom.d.ts` globals such as `Window` and `lib.es*.ts` globa ### LibSpecifier Examples +Matching all strings: + +```json +{ "from": "lib", "name": "string" } +``` + Matching all array-typed values: ```json diff --git a/docs/troubleshooting/faqs/ESLint.mdx b/docs/troubleshooting/faqs/ESLint.mdx index d1a5cdf0d809..a07e16a2f798 100644 --- a/docs/troubleshooting/faqs/ESLint.mdx +++ b/docs/troubleshooting/faqs/ESLint.mdx @@ -49,9 +49,9 @@ Note, that for a mixed project including JavaScript and TypeScript, the `no-unde ```js title="eslint.config.mjs" -import tseslint from 'typescript-eslint'; +import { defineConfig } from 'eslint/config'; -export default tseslint.config( +export default defineConfig( // ... the rest of your config ... { files: ['**/*.{ts,tsx,mts,cts}'], diff --git a/docs/troubleshooting/faqs/Frameworks.mdx b/docs/troubleshooting/faqs/Frameworks.mdx index fc0e559b56fa..15de567c5533 100644 --- a/docs/troubleshooting/faqs/Frameworks.mdx +++ b/docs/troubleshooting/faqs/Frameworks.mdx @@ -19,7 +19,7 @@ See [Changes to `extraFileExtensions` with `projectService`](../typed-linting/Pe ```js title="eslint.config.mjs" -export default tseslint.config( +export default defineConfig( // ... the rest of your config ... { languageOptions: { @@ -27,7 +27,6 @@ export default tseslint.config( // Add this line extraFileExtensions: ['.vue'], projectService: true, - tsconfigRootDir: import.meta.dirname, }, }, }, @@ -61,10 +60,11 @@ If you are running into issues parsing .vue files, it might be because parsers l ```js title="eslint.config.mjs" import tseslint from 'typescript-eslint'; +import { defineConfig } from 'eslint/config'; // Add this line import vueParser from 'vue-eslint-parser'; -export default tseslint.config( +export default defineConfig( // ... the rest of your config ... { languageOptions: { diff --git a/docs/troubleshooting/faqs/General.mdx b/docs/troubleshooting/faqs/General.mdx index 53b752ab9b80..bf42e64c3ce9 100644 --- a/docs/troubleshooting/faqs/General.mdx +++ b/docs/troubleshooting/faqs/General.mdx @@ -36,7 +36,7 @@ Some examples ```js title="eslint.config.mjs" -export default tseslint.config( +export default defineConfig( // ... the rest of your config ... { rules: { @@ -242,15 +242,15 @@ For example, the following config enables only the recommended config's type-che {/* prettier-ignore */} ```js title="eslint.config.mjs" import eslint from '@eslint/js'; +import { defineConfig } from 'eslint/config'; import tseslint from 'typescript-eslint'; -export default tseslint.config( +export default defineConfig( tseslint.configs.recommendedTypeCheckedOnly, { languageOptions: { parserOptions: { projectService: true, - tsconfigRootDir: import.meta.dirname, }, }, }, diff --git a/docs/troubleshooting/faqs/JavaScript.mdx b/docs/troubleshooting/faqs/JavaScript.mdx index ac445281df3f..00e4acaf726c 100644 --- a/docs/troubleshooting/faqs/JavaScript.mdx +++ b/docs/troubleshooting/faqs/JavaScript.mdx @@ -11,7 +11,10 @@ import TabItem from '@theme/TabItem'; This is to be expected - ESLint rules do not check file extensions on purpose, as it causes issues in environments that use non-standard extensions (for example, a `.vue` and a `.md` file can both contain TypeScript code to be linted). -If you have some pure JavaScript code that you do not want to apply certain lint rules to, then you can use [ESLint's `overrides` configuration](https://eslint.org/docs/user-guide/configuring#configuration-based-on-glob-patterns) to turn off certain rules, or even change the parser based on glob patterns. +If you have some pure JavaScript code that you do not want to apply certain lint rules to, then you can use [ESLint's `files` configuration](https://eslint.org/docs/latest/use/configure/configuration-files#specifying-files-and-ignores) to either: + +- (recommended) only enable TypeScript-specific rules on TypeScript file extensions +- turn off TypeScript-specific rules on JavaScript-only file extensions ## Should I run ESLint on transpiled output JavaScript files? diff --git a/docs/troubleshooting/typed-linting/Monorepos.mdx b/docs/troubleshooting/typed-linting/Monorepos.mdx index 85cc6ef264db..49e118408adb 100644 --- a/docs/troubleshooting/typed-linting/Monorepos.mdx +++ b/docs/troubleshooting/typed-linting/Monorepos.mdx @@ -56,7 +56,7 @@ For each file being linted, the first matching project path will be used as its ```js title="eslint.config.mjs" -export default tseslint.config( +export default defineConfig( eslint.configs.recommended, tseslint.configs.recommendedTypeChecked, { @@ -66,7 +66,6 @@ export default tseslint.config( project: true, // Add this line project: ['./tsconfig.eslint.json', './packages/*/tsconfig.json'], - tsconfigRootDir: import.meta.dirname, }, }, }, @@ -89,7 +88,6 @@ module.exports = { project: true, // Add this line project: ['./tsconfig.eslint.json', './packages/*/tsconfig.json'], - tsconfigRootDir: import.meta.dirname, }, plugins: ['@typescript-eslint'], root: true, @@ -108,7 +106,7 @@ Instead of globs that use `**` to recursively check all folders, prefer paths th ```js title="eslint.config.mjs" -export default tseslint.config( +export default defineConfig( eslint.configs.recommended, tseslint.configs.recommendedTypeChecked, { @@ -118,7 +116,6 @@ export default tseslint.config( project: ['./tsconfig.eslint.json', './**/tsconfig.json'], // Add this line project: ['./tsconfig.eslint.json', './packages/*/tsconfig.json'], - tsconfigRootDir: import.meta.dirname, }, }, }, diff --git a/docs/troubleshooting/typed-linting/Performance.mdx b/docs/troubleshooting/typed-linting/Performance.mdx index f81eaaca22a5..9a3e0a3fbcc4 100644 --- a/docs/troubleshooting/typed-linting/Performance.mdx +++ b/docs/troubleshooting/typed-linting/Performance.mdx @@ -38,6 +38,14 @@ In particular for typed linting: - [Performance Tracing](https://github.com/microsoft/TypeScript/wiki/Performance#performance-tracing) can spotlight specific slow types within your project. - [Using Project References](https://github.com/microsoft/TypeScript/wiki/Performance#using-project-references) -which requires enabling the [new "project service" (`parserOptions.projectService`) in v8](/blog/announcing-typescript-eslint-v8-beta#project-service)- can be helpful to speed up type checking on larger projects. +If none of the above work, you can try adjusting the `--max-semi-space-size` of Node. Increasing the max size of a semi-space can improve performance at the cost of more memory consumption. You can [read more about setting space size in Node.js here](https://nodejs.org/api/cli.html#--max-semi-space-sizesize-in-mib). + +You can enable the setting by prepending your ESLint command like: + +```bash +NODE_OPTIONS=--max-semi-space-size=256 eslint +``` + ## Wide includes in your `tsconfig` When using type-aware linting, you provide us with one or more tsconfigs. @@ -172,13 +180,12 @@ Instead of globs that use `**` to recursively check all folders, prefer paths th import eslint from '@eslint/js'; import tseslint from 'typescript-eslint'; -export default tseslint.config( +export default defineConfig( eslint.configs.recommended, tseslint.configs.recommendedRequiringTypeChecking, { languageOptions: { parserOptions: { - tsconfigRootDir: import.meta.dirname, // Remove this line project: ['./**/tsconfig.json'], // Add this line @@ -218,7 +225,7 @@ See [Glob pattern in parser's option "project" slows down linting](https://githu ## Third-Party Plugins -### `@stylistic/ts/indent` and other stylistic rules rules +### `@stylistic/ts/indent` and other stylistic rules The [`@stylisic/ts/indent` rule](https://eslint.style/rules/ts/indent#ts-indent) helps ensure your codebase follows a consistent indentation pattern. However this involves a _lot_ of computations across every single token in a file. diff --git a/docs/troubleshooting/typed-linting/index.mdx b/docs/troubleshooting/typed-linting/index.mdx index 6681b1069b5d..c43b96d118a4 100644 --- a/docs/troubleshooting/typed-linting/index.mdx +++ b/docs/troubleshooting/typed-linting/index.mdx @@ -30,9 +30,10 @@ For example, to disable type-checked linting on all `.js` files: ```js title="eslint.config.mjs" +import defineConfig from 'eslint/config'; import tseslint from 'typescript-eslint'; -export default tseslint.config( +export default defineConfig( // ... the rest of your config ... { files: ['**/*.js'], @@ -69,7 +70,7 @@ You can combine ESLint's [overrides](https://eslint.org/docs/latest/use/configur ```js title="eslint.config.mjs" -export default tseslint.config( +export default defineConfig( eslint.configs.recommended, tseslint.configs.recommendedTypeChecked, tseslint.configs.stylisticTypeChecked, @@ -77,7 +78,6 @@ export default tseslint.config( languageOptions: { parserOptions: { projectService: true, - tsconfigRootDir: import.meta.dirname, }, }, }, @@ -297,12 +297,11 @@ For example, if you use a specific `tsconfig.eslint.json` for linting, you'd spe ```js title="eslint.config.mjs" -export default tseslint.config({ +export default defineConfig({ // ... languageOptions: { parserOptions: { project: './tsconfig.eslint.json', - tsconfigRootDir: import.meta.dirname, }, }, // ... diff --git a/docs/users/Releases.mdx b/docs/users/Releases.mdx index ad5625f70f33..58a4e5c6175d 100644 --- a/docs/users/Releases.mdx +++ b/docs/users/Releases.mdx @@ -8,13 +8,44 @@ import useIsBrowser from '@docusaurus/useIsBrowser'; export function LocalTimeOfRelease() { const isBrowser = useIsBrowser(); - // An arbitrary Monday at 17:00 UTC. - const date = new Date('1970-01-05T17:00Z'); - const formatted = date.toLocaleTimeString('en-US', { + if (!isBrowser) { + // An arbitrary Monday at 17:00 UTC. + const arbitraryMonday = new Date('1970-01-05T17:00Z'); + return arbitraryMonday.toLocaleTimeString('en-US', { + hour: 'numeric', + minute: '2-digit', + timeZoneName: 'short', + timeZone: 'UTC', + }); + } + const now = new Date(); + const daysAgoToMonday = (now.getUTCDay() + 6) % 7; + // Calculate the previous Monday at 17:00 UTC. + const previousReleaseDate = new Date( + Date.UTC( + now.getUTCFullYear(), + now.getUTCMonth(), + now.getUTCDate() - daysAgoToMonday, + 17, + ), + ); + // This will happen if the current time is before 17:00 UTC on Monday. + if (previousReleaseDate > now) { + previousReleaseDate.setUTCDate(previousReleaseDate.getUTCDate() - 7); + } + // Next release is 7 days later. + const nextReleaseDate = new Date(previousReleaseDate.getTime()); + nextReleaseDate.setUTCDate(previousReleaseDate.getUTCDate() + 7); + // If we're near a DST time change, we want to display the time of the release that has the same UTC offset as now. + // If, for some reason, neither does, just display the local time of the next release. + const releaseWithSameUtcOffset = + [nextReleaseDate, previousReleaseDate].find( + date => date.getTimezoneOffset() === now.getTimezoneOffset(), + ) ?? nextReleaseDate; + const formatted = releaseWithSameUtcOffset.toLocaleTimeString('en-US', { hour: 'numeric', minute: '2-digit', timeZoneName: 'short', - timeZone: isBrowser ? undefined : 'UTC', }); // Specify the day of week if it's not a Monday. const dayNames = [ @@ -26,8 +57,10 @@ export function LocalTimeOfRelease() { 'Friday', 'Saturday', ]; - if (date.getDay() !== date.getUTCDay()) { - return `${dayNames[date.getDay()]}s at ${formatted}`; + if ( + releaseWithSameUtcOffset.getDay() !== releaseWithSameUtcOffset.getUTCDay() + ) { + return `${dayNames[releaseWithSameUtcOffset.getDay()]}s at ${formatted}`; } return formatted; } @@ -98,7 +131,23 @@ We assess need on a case-by-case basis though generally an emergency is defined These releases are done manually by a maintainer with the required access privileges. -## Back-Porting Releases +## Older Versions + +Older major versions of typescript-eslint are never maintained or supported. +They may crash with the latest versions of TypeScript. +Using the latest version of typescript-eslint is strongly recommended for getting the latest rule features and fixes, supporting the latest TypeScript features and syntax, and continuous performance and stability improvements. + +### Back-Porting Releases We **_do not_** back port releases to previously released major/minor versions. We only ever release forward. + +### Old Release Documentation + +You can find the last version of some older major versions under their dedicated branch deploys: + +- v7: [v7--typescript-eslint.netlify.app](https://v7--typescript-eslint.netlify.app) +- v6: [v6--typescript-eslint.netlify.app](https://v6--typescript-eslint.netlify.app) + +Note that older documentation pages may contain outdated information and links. +We strongly recommend using the latest version of typescript-eslint and its documentation. diff --git a/docs/users/Shared_Configurations.mdx b/docs/users/Shared_Configurations.mdx index 5071a67d08fe..5d8cd232cc1a 100644 --- a/docs/users/Shared_Configurations.mdx +++ b/docs/users/Shared_Configurations.mdx @@ -21,9 +21,10 @@ See [Getting Started > Quickstart](../getting-started/Quickstart.mdx) first to s // @ts-check import eslint from '@eslint/js'; +import { defineConfig } from 'eslint/config'; import tseslint from 'typescript-eslint'; -export default tseslint.config( +export default defineConfig( eslint.configs.recommended, tseslint.configs.recommended, ); @@ -37,7 +38,7 @@ If your project does not enable [typed linting](../getting-started/Typed_Linting ```js title="eslint.config.mjs" -export default tseslint.config( +export default defineConfig( eslint.configs.recommended, tseslint.configs.recommended, tseslint.configs.stylistic, @@ -66,14 +67,21 @@ module.exports = { If your project enables [typed linting](../getting-started/Typed_Linting.mdx), we suggest enabling the [`recommended-type-checked`](#recommended-type-checked) and [`stylistic-type-checked`](#stylistic-type-checked) configurations to start: +:::note +To use type-checking, you also need to configure `languageOptions.parserOptions` as shown in [typed linting docs](../getting-started/Typed_Linting.mdx). +::: + ```js title="eslint.config.mjs" -export default tseslint.config( +export default defineConfig( eslint.configs.recommended, + // Added lines start tseslint.configs.recommendedTypeChecked, tseslint.configs.stylisticTypeChecked, + // Added lines end + // Other configuration... ); ``` @@ -84,9 +92,12 @@ export default tseslint.config( module.exports = { extends: [ 'eslint:recommended', + // Added lines start 'plugin:@typescript-eslint/recommended-type-checked', 'plugin:@typescript-eslint/stylistic-type-checked', + // Added lines end ], + // Other configuration... }; ``` @@ -127,7 +138,7 @@ These rules are those whose reports are almost always for a bad practice and/or {/* prettier-ignore */} ```js title="eslint.config.mjs" -export default tseslint.config( +export default defineConfig( tseslint.configs.recommended, ); ``` @@ -144,7 +155,7 @@ module.exports = { -See [`configs/recommended.ts`](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslintrc/recommended.ts) for the exact contents of this config. +See [the source code for the `recommended` config](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslintrc/recommended.ts) for the exact contents. ### `recommended-type-checked` @@ -156,7 +167,7 @@ Rules newly added in this configuration are similarly useful to those in `recomm {/* prettier-ignore */} ```js title="eslint.config.mjs" -export default tseslint.config( +export default defineConfig( tseslint.configs.recommendedTypeChecked, ); ``` @@ -173,7 +184,7 @@ module.exports = { -See [`configs/recommended-type-checked.ts`](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslintrc/recommended-type-checked.ts) for the exact contents of this config. +See [the source code for the `recommended-type-checked` config](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslintrc/recommended-type-checked.ts) for the exact contents. ### `strict` @@ -185,7 +196,7 @@ Rules added in `strict` are more opinionated than recommended rules and might no {/* prettier-ignore */} ```js title="eslint.config.mjs" -export default tseslint.config( +export default defineConfig( tseslint.configs.strict, ); ``` @@ -203,7 +214,7 @@ module.exports = { Some rules also enabled in `recommended` default to more strict settings in this configuration. -See [`configs/strict.ts`](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslintrc/strict.ts) for the exact contents of this config. +See [the source code for the `strict` config](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslintrc/strict.ts) for the exact contents. :::tip We recommend a TypeScript project extend from `plugin:@typescript-eslint/strict` only if a nontrivial percentage of its developers are highly proficient in TypeScript. @@ -224,7 +235,7 @@ Rules newly added in this configuration are similarly useful (and opinionated) t {/* prettier-ignore */} ```js title="eslint.config.mjs" -export default tseslint.config( +export default defineConfig( tseslint.configs.strictTypeChecked, ); ``` @@ -242,7 +253,7 @@ module.exports = { Some rules also enabled in `recommended-type-checked` default to more strict settings in this configuration. -See [`configs/strict-type-checked.ts`](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslintrc/strict-type-checked.ts) for the exact contents of this config. +See [the source code for the `strict-type-checked` config](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslintrc/strict-type-checked.ts) for the exact contents. :::tip We recommend a TypeScript project extend from `plugin:@typescript-eslint/strict-type-checked` only if a nontrivial percentage of its developers are highly proficient in TypeScript. @@ -263,7 +274,7 @@ These rules are generally opinionated about enforcing simpler code patterns. {/* prettier-ignore */} ```js title="eslint.config.mjs" -export default tseslint.config( +export default defineConfig( tseslint.configs.stylistic, ); ``` @@ -283,7 +294,7 @@ module.exports = { Note that `stylistic` does not replace `recommended` or `strict`. `stylistic` adds additional rules. -See [`configs/stylistic.ts`](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslintrc/stylistic.ts) for the exact contents of this config. +See [the source code for the `stylistic` config](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslintrc/stylistic.ts) for the exact contents. ### `stylistic-type-checked` @@ -295,7 +306,7 @@ Rules newly added in this configuration are similarly opinionated to those in `s {/* prettier-ignore */} ```js title="eslint.config.mjs" -export default tseslint.config( +export default defineConfig( tseslint.configs.stylisticTypeChecked, ); ``` @@ -315,7 +326,7 @@ module.exports = { Note that `stylistic-type-checked` does not replace `recommended-type-checked` or `strict-type-checked`. `stylistic-type-checked` adds additional rules. -See [`configs/stylistic-type-checked.ts`](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslintrc/stylistic-type-checked.ts) for the exact contents of this config. +See [the source code for the `stylistic-type-checked` config](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslintrc/stylistic-type-checked.ts) for the exact contents. ## Other Configurations @@ -326,7 +337,7 @@ typescript-eslint includes a few utility configurations. Enables each the rules provided as a part of typescript-eslint. Note that many rules are not applicable in all codebases, or are meant to be configured. -See [`configs/all.ts`](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslintrc/all.ts) for the exact contents of this config. +See [the source code for the `all` config](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslintrc/all.ts) for the exact contents. :::warning We do not recommend TypeScript projects extend from `plugin:@typescript-eslint/all`. @@ -345,14 +356,14 @@ We don't recommend using this directly; instead, extend from an earlier recommen This config is automatically included if you use any of the recommended configurations. -See [`configs/base.ts`](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslintrc/base.ts) for the exact contents of this config. +See [the source code for the `base` config](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslintrc/base.ts) for the exact contents. ### `disable-type-checked` A utility ruleset that will disable type-aware linting and all type-aware rules available in our project. This config is useful if you'd like to have your base config concerned with type-aware linting, and then conditionally use [overrides](https://eslint.org/docs/latest/use/configure/configuration-files#configuration-based-on-glob-patterns) to disable type-aware linting on specific subsets of your codebase. -See [`configs/disable-type-checked.ts`](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslintrc/disable-type-checked.ts) for the exact contents of this config. +See [the source code for the `disable-type-checked` config](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslintrc/disable-type-checked.ts) for the exact contents. :::info If you use type-aware rules from other plugins, you will need to manually disable these rules or use a premade config they provide to disable them. @@ -362,14 +373,13 @@ If you use type-aware rules from other plugins, you will need to manually disabl ```js title="eslint.config.mjs" -export default tseslint.config( +export default defineConfig( eslint.configs.recommended, tseslint.configs.recommendedTypeChecked, { languageOptions: { parserOptions: { projectService: true, - tsconfigRootDir: import.meta.dirname, }, }, }, @@ -426,7 +436,7 @@ Additionally, it enables rules that promote using the more modern constructs Typ ```js title="eslint.config.mjs" -export default tseslint.config( +export default defineConfig( eslint.configs.recommended, tseslint.configs.eslintRecommended, ); @@ -449,7 +459,7 @@ module.exports = { This config is automatically included if you use any of the recommended configurations. -See [`configs/eslint-recommended.ts`](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslintrc/eslint-recommended.ts) for the exact contents of this config. +See [the source code for the `eslint-recommended` config](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslint-recommended-raw.ts) for the exact contents. ### `recommended-type-checked-only` @@ -462,7 +472,7 @@ module.exports = { }; ``` -See [`configs/recommended-type-checked-only.ts`](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslintrc/recommended-type-checked-only.ts) for the exact contents of this config. +See [the source code for the `recommended-type-checked-only` config](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslintrc/recommended-type-checked-only.ts) for the exact contents. ### `strict-type-checked-only` @@ -475,7 +485,7 @@ module.exports = { }; ``` -See [`configs/strict-type-checked-only.ts`](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslintrc/strict-type-checked-only.ts) for the exact contents of this config. +See [the source code for the `strict-type-checked-only` config](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslintrc/strict-type-checked-only.ts) for the exact contents. :::warning This configuration is not considered "stable" under Semantic Versioning (semver). @@ -493,7 +503,7 @@ module.exports = { }; ``` -See [`configs/stylistic-type-checked-only.ts`](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslintrc/stylistic-type-checked-only.ts) for the exact contents of this config. +See [the source code for the `stylistic-type-checked-only` config](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslintrc/stylistic-type-checked-only.ts) for the exact contents. ## Suggesting Configuration Changes diff --git a/docs/users/What_About_Formatting.mdx b/docs/users/What_About_Formatting.mdx index a070fdfccfb2..ace2aa4ebd97 100644 --- a/docs/users/What_About_Formatting.mdx +++ b/docs/users/What_About_Formatting.mdx @@ -50,11 +50,12 @@ Using this config by adding it to the end of your `extends`: // @ts-check import eslint from '@eslint/js'; +import { defineConfig } from 'eslint/config'; import someOtherConfig from 'eslint-config-other-configuration-that-enables-formatting-rules'; import prettierConfig from 'eslint-config-prettier'; import tseslint from 'typescript-eslint'; -export default tseslint.config( +export default defineConfig( eslint.configs.recommended, tseslint.configs.recommended, someOtherConfig, diff --git a/eslint-suppressions.json b/eslint-suppressions.json new file mode 100644 index 000000000000..eddbd9cba3f6 --- /dev/null +++ b/eslint-suppressions.json @@ -0,0 +1,97 @@ +{ + "packages/eslint-plugin-internal/tests/rules/plugin-test-formatting.test.ts": { + "@typescript-eslint/internal/no-dynamic-tests": { + "count": 26 + } + }, + "packages/eslint-plugin/tests/rules/dot-notation.test.ts": { + "@typescript-eslint/internal/no-dynamic-tests": { + "count": 1 + } + }, + "packages/eslint-plugin/tests/rules/member-ordering/member-ordering-alphabetically-case-insensitive-order.test.ts": { + "@typescript-eslint/internal/no-dynamic-tests": { + "count": 4 + } + }, + "packages/eslint-plugin/tests/rules/member-ordering/member-ordering-alphabetically-order.test.ts": { + "@typescript-eslint/internal/no-dynamic-tests": { + "count": 4 + } + }, + "packages/eslint-plugin/tests/rules/naming-convention/naming-convention.test.ts": { + "@typescript-eslint/internal/no-dynamic-tests": { + "count": 12 + } + }, + "packages/eslint-plugin/tests/rules/no-extraneous-class.test.ts": { + "@typescript-eslint/internal/no-dynamic-tests": { + "count": 12 + } + }, + "packages/eslint-plugin/tests/rules/no-invalid-this.test.ts": { + "@typescript-eslint/internal/no-dynamic-tests": { + "count": 43 + } + }, + "packages/eslint-plugin/tests/rules/no-loop-func.test.ts": { + "@typescript-eslint/internal/no-dynamic-tests": { + "count": 2 + } + }, + "packages/eslint-plugin/tests/rules/no-this-alias.test.ts": { + "@typescript-eslint/internal/no-dynamic-tests": { + "count": 14 + } + }, + "packages/eslint-plugin/tests/rules/no-unnecessary-condition.test.ts": { + "@typescript-eslint/internal/no-dynamic-tests": { + "count": 44 + } + }, + "packages/eslint-plugin/tests/rules/no-unnecessary-template-expression.test.ts": { + "@typescript-eslint/internal/no-dynamic-tests": { + "count": 1 + } + }, + "packages/eslint-plugin/tests/rules/no-unsafe-enum-comparison.test.ts": { + "@typescript-eslint/internal/no-dynamic-tests": { + "count": 2 + } + }, + "packages/eslint-plugin/tests/rules/no-unused-vars/no-unused-vars-eslint.test.ts": { + "@typescript-eslint/internal/no-dynamic-tests": { + "count": 154 + } + }, + "packages/eslint-plugin/tests/rules/no-useless-empty-export.test.ts": { + "@typescript-eslint/internal/no-dynamic-tests": { + "count": 9 + } + }, + "packages/eslint-plugin/tests/rules/prefer-nullish-coalescing.test.ts": { + "@typescript-eslint/internal/no-dynamic-tests": { + "count": 42 + } + }, + "packages/eslint-plugin/tests/rules/prefer-optional-chain/prefer-optional-chain.test.ts": { + "@typescript-eslint/internal/no-dynamic-tests": { + "count": 17 + } + }, + "packages/eslint-plugin/tests/rules/return-await.test.ts": { + "@typescript-eslint/internal/no-dynamic-tests": { + "count": 1 + } + }, + "packages/eslint-plugin/tests/rules/sort-type-constituents.test.ts": { + "@typescript-eslint/internal/no-dynamic-tests": { + "count": 4 + } + }, + "packages/eslint-plugin/tests/rules/unbound-method.test.ts": { + "@typescript-eslint/internal/no-dynamic-tests": { + "count": 3 + } + } +} diff --git a/eslint.config.mjs b/eslint.config.mjs index 6ffdaa9831a3..f4c3143af22e 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,9 +1,9 @@ // @ts-check +import eslintCommentsPlugin from '@eslint-community/eslint-plugin-eslint-comments/configs'; import { fixupConfigRules, fixupPluginRules } from '@eslint/compat'; import { FlatCompat } from '@eslint/eslintrc'; import eslint from '@eslint/js'; -import eslintCommentsPlugin from '@eslint-community/eslint-plugin-eslint-comments/configs'; import tseslintInternalPlugin from '@typescript-eslint/eslint-plugin-internal'; import vitestPlugin from '@vitest/eslint-plugin'; import eslintPluginPlugin from 'eslint-plugin-eslint-plugin'; @@ -15,6 +15,7 @@ import reactPlugin from 'eslint-plugin-react'; import reactHooksPlugin from 'eslint-plugin-react-hooks'; import regexpPlugin from 'eslint-plugin-regexp'; import unicornPlugin from 'eslint-plugin-unicorn'; +import { defineConfig } from 'eslint/config'; import globals from 'globals'; import url from 'node:url'; import tseslint from 'typescript-eslint'; @@ -28,9 +29,10 @@ const restrictNamedDeclarations = { selector: 'ExportNamedDeclaration[declaration=null][source=null]', }; -export default tseslint.config( +export default defineConfig( // register all of the plugins up-front { + name: 'register-all-plugins', // note - intentionally uses computed syntax to make it easy to sort the keys /* eslint-disable no-useless-computed-key */ plugins: { @@ -82,14 +84,13 @@ export default tseslint.config( 'packages/types/src/generated/**/*.ts', // Playground types downloaded from the web 'packages/website/src/vendor/', - // see the file header in eslint-base.test.js for more info - 'packages/rule-tester/tests/eslint-base/', ], + name: 'global-ignores', }, // extends ... eslintCommentsPlugin.recommended, - eslint.configs.recommended, + { name: `${eslint.meta.name}/recommended`, ...eslint.configs.recommended }, tseslint.configs.strictTypeChecked, tseslint.configs.stylisticTypeChecked, jsdocPlugin.configs['flat/recommended-typescript-error'], @@ -108,6 +109,7 @@ export default tseslint.config( }, }, linterOptions: { reportUnusedDisableDirectives: 'error' }, + name: 'base-config', rules: { // // our plugin :D @@ -233,10 +235,13 @@ export default tseslint.config( 'no-lonely-if': 'error', 'no-mixed-operators': 'error', 'no-process-exit': 'error', + 'no-unassigned-vars': 'error', 'no-unreachable-loop': 'error', + 'no-useless-assignment': 'error', 'no-useless-call': 'error', 'no-useless-computed-key': 'error', 'no-useless-concat': 'error', + 'no-useless-rename': 'error', 'no-var': 'error', 'no-void': ['error', { allowAsStatement: true }], 'object-shorthand': 'error', @@ -316,6 +321,7 @@ export default tseslint.config( 'jsdoc/tag-lines': 'off', 'regexp/no-dupe-disjunctions': 'error', + 'regexp/no-missing-g-flag': 'error', 'regexp/no-useless-character-class': 'error', 'regexp/no-useless-flag': 'error', 'regexp/no-useless-lazy': 'error', @@ -345,6 +351,7 @@ export default tseslint.config( { extends: [tseslint.configs.disableTypeChecked], files: ['**/*.js'], + name: 'js-files-only', rules: { // turn off other type-aware rules '@typescript-eslint/internal/no-poorly-typed-ts-props': 'off', @@ -360,37 +367,44 @@ export default tseslint.config( // test file specific configuration { + extends: [ + vitestPlugin.configs.env, + { + rules: { + '@typescript-eslint/no-empty-function': [ + 'error', + { allow: ['arrowFunctions'] }, + ], + '@typescript-eslint/no-non-null-assertion': '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', + 'vitest/hoisted-apis-on-top': 'error', + 'vitest/no-alias-methods': 'error', + 'vitest/no-disabled-tests': 'error', + 'vitest/no-focused-tests': 'error', + 'vitest/no-identical-title': 'error', + 'vitest/no-test-prefixes': 'error', + 'vitest/no-test-return-statement': 'error', + 'vitest/prefer-describe-function-title': 'error', + 'vitest/prefer-each': 'error', + 'vitest/prefer-spy-on': 'error', + 'vitest/prefer-to-be': 'error', + 'vitest/prefer-to-contain': 'error', + 'vitest/prefer-to-have-length': 'error', + 'vitest/valid-expect': 'error', + }, + settings: { vitest: { typecheck: true } }, + }, + ], + files: [ - 'packages/*/tests/**/*.{ts,tsx,cts,mts}', + 'packages/*/tests/**/*.?(m|c)ts?(x)', 'packages/integration-tests/tools/**/*.ts', ], - ...vitestPlugin.configs.env, - rules: { - '@typescript-eslint/no-empty-function': [ - 'error', - { allow: ['arrowFunctions'] }, - ], - '@typescript-eslint/no-non-null-assertion': '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', - 'vitest/no-alias-methods': 'error', - 'vitest/no-disabled-tests': 'error', - 'vitest/no-focused-tests': 'error', - 'vitest/no-identical-title': 'error', - 'vitest/no-test-prefixes': 'error', - 'vitest/no-test-return-statement': 'error', - 'vitest/prefer-describe-function-title': 'error', - 'vitest/prefer-each': 'error', - 'vitest/prefer-spy-on': 'error', - 'vitest/prefer-to-be': 'error', - 'vitest/prefer-to-contain': 'error', - 'vitest/prefer-to-have-length': 'error', - 'vitest/valid-expect': 'error', - }, - settings: { vitest: { typecheck: true } }, }, + { files: ['packages/*/tests/**/vitest-custom-matchers.d.ts'], name: 'vitest-custom-matchers-declaration-files', @@ -403,15 +417,17 @@ export default tseslint.config( '@typescript-eslint/no-explicit-any': 'off', }, }, + // plugin rule tests { files: [ - 'packages/eslint-plugin-internal/tests/rules/**/*.test.{ts,tsx,cts,mts}', - 'packages/eslint-plugin-tslint/tests/rules/**/*.test.{ts,tsx,cts,mts}', - 'packages/eslint-plugin/tests/rules/**/*.test.{ts,tsx,cts,mts}', - 'packages/eslint-plugin/tests/eslint-rules/**/*.test.{ts,tsx,cts,mts}', + 'packages/eslint-plugin-internal/tests/rules/**/*.test.?(m|c)ts?(x)', + 'packages/eslint-plugin/tests/rules/**/*.test.?(m|c)ts?(x)', + 'packages/eslint-plugin/tests/eslint-rules/**/*.test.?(m|c)ts?(x)', ], + name: 'eslint-plugin-and-eslint-plugin-internal/test-files/rules', rules: { + '@typescript-eslint/internal/no-dynamic-tests': 'error', '@typescript-eslint/internal/plugin-test-formatting': 'error', }, }, @@ -421,10 +437,11 @@ export default tseslint.config( // { files: [ - '**/tools/**/*.{ts,tsx,cts,mts}', - '**/tests/**/*.{ts,tsx,cts,mts}', - 'packages/integration-tests/**/*.{ts,tsx,cts,mts}', + '**/tools/**/*.?(m|c)ts?(x)', + '**/tests/**/*.?(m|c)ts?(x)', + 'packages/integration-tests/**/*.?(m|c)ts?(x)', ], + name: 'tools-and-test-files', rules: { // allow console logs in tools and tests 'no-console': 'off', @@ -432,12 +449,13 @@ export default tseslint.config( }, { files: [ - 'eslint.config.{js,cjs,mjs}', + 'eslint.config.mjs', 'knip.ts', 'packages/*/src/index.ts', 'vitest.config.mts', 'packages/*/vitest.config.mts', ], + name: 'no-default-export', rules: { // requirement 'import/no-default-export': 'off', @@ -449,26 +467,28 @@ export default tseslint.config( // { - extends: [eslintPluginPlugin.configs['flat/recommended']], + extends: [eslintPluginPlugin.configs.recommended], files: [ - 'packages/eslint-plugin-internal/**/*.{ts,tsx,cts,mts}', - 'packages/eslint-plugin-tslint/**/*.{ts,tsx,cts,mts}', - 'packages/eslint-plugin/**/*.{ts,tsx,cts,mts}', + 'packages/eslint-plugin-internal/**/*.?(m|c)ts?(x)', + 'packages/eslint-plugin/**/*.?(m|c)ts?(x)', ], + name: 'eslint-plugin-and-eslint-plugin-internal', rules: { '@typescript-eslint/internal/no-typescript-estree-import': 'error', + // TODO (43081j): maybe enable these one day? + 'eslint-plugin/no-meta-replaced-by': 'off', + 'eslint-plugin/require-meta-default-options': 'off', }, }, { files: [ - 'packages/eslint-plugin-internal/src/rules/**/*.{ts,tsx,cts,mts}', - 'packages/eslint-plugin-tslint/src/rules/**/*.{ts,tsx,cts,mts}', - 'packages/eslint-plugin/src/configs/**/*.{ts,tsx,cts,mts}', - 'packages/typescript-eslint/src/configs/**/*.{ts,tsx,cts,mts}', - 'packages/core/src/configs/**/*.{ts,tsx,cts,mts}', - 'packages/eslint-plugin/src/rules/**/*.{ts,tsx,cts,mts}', + 'packages/eslint-plugin-internal/src/rules/**/*.?(m|c)ts?(x)', + 'packages/eslint-plugin/src/configs/**/*.?(m|c)ts?(x)', + 'packages/typescript-eslint/src/configs/**/*.?(m|c)ts?(x)', + 'packages/eslint-plugin/src/rules/**/*.?(m|c)ts?(x)', ], + name: 'configs-and-rules', rules: { 'eslint-plugin/no-property-in-node': [ 'error', @@ -500,6 +520,7 @@ export default tseslint.config( }, { files: ['packages/eslint-plugin/src/rules/index.ts'], + name: 'eslint-plugin/source-files/rules-index-file', rules: { // enforce alphabetical ordering 'import/order': ['error', { alphabetize: { order: 'asc' } }], @@ -513,10 +534,10 @@ export default tseslint.config( { files: [ - 'packages/scope-manager/src/lib/*.{ts,tsx,cts,mts}', - 'packages/eslint-plugin/src/configs/*.{ts,tsx,cts,mts}', - 'packages/core/src/configs/*.{ts,tsx,cts,mts}', + 'packages/scope-manager/src/lib/*.?(m|c)ts?(x)', + 'packages/eslint-plugin/src/configs/*.?(m|c)ts?(x)', ], + name: 'generated-files', rules: { '@typescript-eslint/internal/no-poorly-typed-ts-props': 'off', '@typescript-eslint/internal/no-typescript-default-import': 'off', @@ -529,15 +550,27 @@ export default tseslint.config( // { - files: ['packages/ast-spec/src/**/*.{ts,tsx,cts,mts}'], + files: ['packages/ast-spec/src/**/*.?(m|c)ts?(x)'], + name: 'ast-spec/source-files', rules: { // disallow ALL unused vars '@typescript-eslint/no-unused-vars': ['error', { caughtErrors: 'all' }], '@typescript-eslint/sort-type-constituents': 'error', + + 'perfectionist/sort-interfaces': [ + 'error', + { + customGroups: { + first: ['type'], + }, + groups: ['first', 'unknown'], + }, + ], }, }, { - files: ['packages/ast-spec/**/*.{ts,tsx,cts,mts}'], + files: ['packages/ast-spec/**/*.?(m|c)ts?(x)'], + name: 'ast-spec', rules: { 'no-restricted-imports': [ 'error', @@ -559,19 +592,25 @@ export default tseslint.config( jsxA11yPlugin.flatConfigs.recommended, // https://github.com/facebook/react/pull/30774 // @ts-expect-error -- Temporary types incompatibility pending flat config support - reactPlugin.configs.flat.recommended, - // https://github.com/facebook/react/pull/30774 - // @ts-expect-error -- Temporary types incompatibility pending flat config support - fixupConfigRules(compat.config(reactHooksPlugin.configs.recommended)), + { name: 'react/recommended', ...reactPlugin.configs.flat.recommended }, + fixupConfigRules([ + { + name: 'react-hooks/recommended', + // https://github.com/facebook/react/pull/30774 + // @ts-expect-error -- Temporary types incompatibility pending flat config support + ...compat.config(reactHooksPlugin.configs.recommended)[0], + }, + ]), ], - files: ['packages/website/**/*.{ts,tsx,mts,cts,js,jsx}'], + files: ['packages/website/**/*.?(c|m)[tj]s?(x)'], + name: 'website', rules: { '@typescript-eslint/internal/prefer-ast-types-enum': 'off', 'import/no-default-export': 'off', + 'react-hooks/exhaustive-deps': 'warn', // TODO: enable it later 'react/jsx-no-target-blank': 'off', 'react/no-unescaped-entities': 'off', 'react/prop-types': 'off', - 'react-hooks/exhaustive-deps': 'warn', // TODO: enable it later }, settings: { react: { @@ -580,7 +619,8 @@ export default tseslint.config( }, }, { - files: ['packages/website/src/**/*.{ts,tsx,cts,mts}'], + files: ['packages/website/src/**/*.?(m|c)ts?(x)'], + name: 'website/source-files', rules: { 'import/no-default-export': 'off', // allow console logs in the website to help with debugging things in production @@ -588,10 +628,8 @@ export default tseslint.config( }, }, { - files: [ - 'packages/website-eslint/src/mock/**/*.js', - '**/*.d.{ts,tsx,cts,mts}', - ], + files: ['packages/website-eslint/src/mock/**/*.js', '**/*.d.?(m|c)ts?(x)'], + name: 'website/source-files/mocks-and-declaration-files', rules: { // mocks and declaration files have to mirror their original package 'import/no-default-export': 'off', @@ -604,9 +642,29 @@ export default tseslint.config( 'packages/eslint-plugin/src/configs/flat/*', 'packages/scope-manager/src/configs/*', ], + name: 'all-files', rules: { '@typescript-eslint/sort-type-constituents': 'off', - 'perfectionist/sort-classes': 'error', + 'perfectionist/sort-classes': [ + 'error', + { + groups: [ + 'index-signature', + 'static-property', + 'static-block', + ['protected-property', 'protected-accessor-property'], + ['private-property', 'private-accessor-property'], + ['property', 'accessor-property'], + 'constructor', + 'static-method', + 'protected-method', + 'private-method', + 'method', + ['get-method', 'set-method'], + 'unknown', + ], + }, + ], 'perfectionist/sort-enums': 'off', 'perfectionist/sort-objects': 'error', 'perfectionist/sort-union-types': [ @@ -625,7 +683,7 @@ export default tseslint.config( 'error', { customGroups: { - first: ['type'], + first: ['^type$'], }, groups: ['first', 'unknown'], }, @@ -637,15 +695,16 @@ export default tseslint.config( 'packages/eslint-plugin/src/rules/*.ts', 'packages/eslint-plugin-internal/src/rules/*.ts', ], + name: 'eslint-plugin-and-eslint-plugin-internal/source-files/rules', rules: { 'perfectionist/sort-objects': [ 'error', { customGroups: { - first: ['loc', 'name', 'node', 'type'], - fourth: ['fix'], - second: ['meta', 'messageId', 'start'], - third: ['defaultOptions', 'data', 'end'], + first: ['^loc$', '^name$', '^node$', '^type$'], + fourth: ['^fix$'], + second: ['^meta$', '^messageId$', '^start$'], + third: ['^defaultOptions$', '^data$', '^end$'], }, groups: ['first', 'second', 'third', 'fourth', 'unknown'], }, @@ -654,25 +713,27 @@ export default tseslint.config( }, { files: ['packages/eslint-plugin/tests/rules/*.test.ts'], + name: 'eslint-plugin-rules-test-files', rules: { 'perfectionist/sort-objects': [ 'error', { - customGroups: { top: ['valid'] }, - groups: ['top', 'unknown'], + customGroups: { skip: ['^skip$'], top: ['^valid$'] }, + groups: ['top', 'skip', 'unknown'], }, ], }, }, { files: ['packages/typescript-estree/src/**/*.ts'], + name: 'typescript-estree/source-files', rules: { 'perfectionist/sort-objects': [ 'error', { customGroups: { - first: ['type'], - second: ['loc', 'range'], + first: ['^type$'], + second: ['^loc$', '^range$'], }, groups: ['first', 'second'], }, diff --git a/knip.ts b/knip.ts index 4ab6787999d8..517eedc8bd68 100644 --- a/knip.ts +++ b/knip.ts @@ -2,6 +2,7 @@ import type { KnipConfig } from 'knip' with { 'resolution-mode': 'import' }; export default { rules: { + binaries: 'off', classMembers: 'off', duplicates: 'off', enumMembers: 'off', @@ -22,14 +23,17 @@ export default { workspaces: { '.': { entry: ['tools/release/changelog-renderer.js', 'tools/scripts/**/*.mts'], - ignore: ['tools/scripts/typings/typescript.d.ts', 'typings/*.d.ts'], ignoreDependencies: [ - '@nx/js', '@nx/workspace', - 'make-dir', // imported for type purposes only 'website', ], + + project: [ + 'tools/scripts/**/*.mts', + '!tools/scripts/typings/typescript.d.ts', + '!typings/*.d.ts', + ], }, 'packages/ast-spec': { ignore: [ @@ -50,33 +54,40 @@ export default { ], }, }, + 'packages/eslint-plugin': { - ignore: [ - 'tests/fixtures/**', - 'typings/eslint-rules.d.ts', - 'typings/typescript.d.ts', - ], + ignore: ['typings/eslint-rules.d.ts', 'typings/typescript.d.ts'], + + project: ['src/**/*.ts!', 'tools/**/*.mts'], + + vitest: { + config: ['vitest.config.mts'], + entry: ['tests/**/*.{bench,test,test-d}.?(c|m)ts?(x)'], + project: ['tests/**', '!tests/fixtures/**'], + }, }, + 'packages/eslint-plugin-internal': { ignore: ['tests/fixtures/**'], }, 'packages/integration-tests': { ignore: ['fixtures/**'], }, - 'packages/parser': { - ignore: ['tests/fixtures/**'], + 'packages/parser': { vitest: { config: ['vitest.config.mts'], - entry: ['tests/lib/**/*.{bench,test,test-d}.?(c|m)ts?(x)'], + entry: [ + 'tests/lib/**/*.{bench,test,test-d}.?(c|m)ts?(x)', + 'tests/test-utils/test-utils.ts', + 'tests/test-utils/ts-error-serializer.ts', + ], + project: ['tests/**', '!tests/fixtures/**'], }, }, + 'packages/rule-tester': { ignore: ['typings/eslint.d.ts'], - - mocha: { - entry: ['tests/eslint-base/eslint-base.test.js'], - }, }, 'packages/scope-manager': { ignore: ['tests/fixtures/**'], @@ -103,6 +114,11 @@ export default { ], }, }, + + 'packages/types': { + project: ['src/**/*.ts!', '!src/generated/**/*.ts'], + }, + 'packages/typescript-estree': { entry: ['src/use-at-your-own-risk.ts'], ignore: ['tests/fixtures/**', 'typings/typescript.d.ts'], @@ -131,6 +147,7 @@ export default { 'src/components/**/*.tsx', // used by Docusaurus + 'plugins/recent-blog-posts/index.ts', 'src/theme/**/*.tsx', 'src/theme/prism-include-languages.js', ], @@ -158,7 +175,6 @@ export default { '@docusaurus/useDocusaurusContext', '@docusaurus/useBaseUrl', '@docusaurus/BrowserOnly', - '@docusaurus/module-type-aliases', '@generated/docusaurus.config', '^@site/.*', '^@theme/.*', @@ -182,7 +198,7 @@ export default { ], ignoreDependencies: [ // virtual module - 'vt', + 'vt:*', ], }, 'tools/dummypkg': {}, diff --git a/nx.json b/nx.json index af3c7dc74658..b0ac6867484c 100644 --- a/nx.json +++ b/nx.json @@ -1,10 +1,9 @@ { "$schema": "./node_modules/nx/schemas/nx-schema.json", - "nxCloudAccessToken": "YjIzMmMxMWItMjhiMS00NWY2LTk1NWYtYWU3YWQ0YjE4YjBlfHJlYWQ=", "plugins": [ { "plugin": "@nx/js/typescript", - "exclude": [".", "packages/integration-tests/fixtures/**"], + "exclude": ["packages/integration-tests/fixtures/**"], "options": { "typecheck": { "targetName": "typecheck" @@ -17,17 +16,10 @@ }, { "plugin": "@nx/vite/plugin", - "include": ["packages/*"], + "exclude": ["*"], "options": { - "buildTargetName": "vite:build", "testTargetName": "test", - "serveTargetName": "serve", - "devTargetName": "dev", - "previewTargetName": "preview", - "serveStaticTargetName": "serve-static", - "typecheckTargetName": "vite:typecheck", - "buildDepsTargetName": "vite:build-deps", - "watchDepsTargetName": "vite:watch-deps" + "typecheckTargetName": "vite:typecheck" } } ], @@ -52,59 +44,21 @@ } }, "targetDefaults": { - "build": { - "dependsOn": ["^build"], - "inputs": ["production", "^production"], - "outputs": ["{projectRoot}/dist"], + "lint": { + "cache": false, + "dependsOn": ["eslint-plugin-internal:build", "typescript-eslint:build"], "options": { - "cwd": "{projectRoot}" - }, - "cache": true + "cwd": "{workspaceRoot}", + "config": "{workspaceRoot}/eslint.config.mjs", + "args": ["{projectRoot}"] + } }, "test": { "dependsOn": ["^build"], - "outputs": ["{projectRoot}/coverage"], - "cache": true - }, - "@nx/vite:test": { - "dependsOn": ["^build"], - "inputs": [ - "default", - "^production", - "{workspaceRoot}/vitest.config.mts", - "{workspaceRoot}/vitest.config.base.mts", - "{projectRoot}/vitest.config.mts" - ], - "outputs": ["{projectRoot}/coverage"], - "cache": true, "options": { - "config": "{projectRoot}/vitest.config.mts", - "watch": false - } - }, - "lint": { - "executor": "@nx/eslint:lint", - "dependsOn": [ - "eslint-plugin:build", - "eslint-plugin-internal:build", - "typescript-eslint:build" - ], - "inputs": [ - "default", - "{workspaceRoot}/eslint.config.js", - "{workspaceRoot}/eslint.config.mjs", - { - "dependentTasksOutputFiles": "**/*.js", - "transitive": false - } - ], - "outputs": ["{options.outputFile}"], - "cache": true - }, - "typecheck": { - "dependsOn": ["types:copy-ast-spec"], - "outputs": ["{workspaceRoot}/dist"], - "cache": true + "config": "vitest.config.mts" + }, + "outputs": ["{projectRoot}/coverage"] } }, "namedInputs": { @@ -114,20 +68,21 @@ { "runtime": "node -v" }, - { - "runtime": "echo $NETLIFY" - }, { "runtime": "yarn -v" }, - "{workspaceRoot}/yarn.lock" + { + "runtime": "echo $NETLIFY" + } ], "production": [ "default", - "!{projectRoot}/**/?(*.)+(test).[jt]s?(x)?(.snap)", + "!{projectRoot}/**/?(*.)+(test).?(m|c)[jt]s?(x)?(.snap|.shot)", + "!{projectRoot}/tests", + "!{projectRoot}/tools", "!{projectRoot}/tsconfig.spec.json", - "!{projectRoot}/vitest.config.m[jt]s", - "!{projectRoot}/src/test-setup.[jt]s" + "!{projectRoot}/vitest.config.mts" ] - } + }, + "nxCloudId": "60b38765e74d975e3faae5ad" } diff --git a/package.json b/package.json index 2bbb81ccdede..fc18c47878f6 100644 --- a/package.json +++ b/package.json @@ -22,45 +22,44 @@ }, "homepage": "https://typescript-eslint.io", "scripts": { - "build": "npx nx run-many --target=build --exclude website --exclude website-eslint", + "build": "nx run-many -t build --exclude website website-eslint", "check-clean-workspace-after-install": "git diff --quiet --exit-code", "check-format": "prettier --check .", "check-spelling": "cspell --config=.cspell.json \"**/*.{md,mdx,ts,mts,cts,js,cjs,mjs,tsx,jsx}\" --no-progress --show-context --show-suggestions", - "clean": "npx nx run-many --target=clean", - "format": "prettier --write .", - "generate-breaking-changes": "npx nx run eslint-plugin:generate-breaking-changes", - "generate-configs": "npx nx generate-configs", - "generate-contributors": "npx nx generate-contributors", - "generate-lib": "npx nx generate-lib", - "generate-sponsors": "npx nx generate-sponsors", - "generate-website-dts": "npx nx run website:generate-website-dts", + "clean": "nx run-many -t clean --parallel=20", + "deduplicate": "yarn-berry-deduplicate", + "format": "prettier --ignore-path=$PROJECT_CWD/.prettierignore --config=$PROJECT_CWD/.prettierrc.json --write $INIT_CWD", + "generate-breaking-changes": "nx run eslint-plugin:generate-breaking-changes", + "generate-configs": "tsx tools/scripts/generate-configs.mts", + "generate-lib": "tsx tools/scripts/generate-lib.mts", + "generate-sponsors": "tsx tools/scripts/generate-sponsors.mts", + "generate-website-dts": "nx run website:generate-website-dts", "lint-fix": "yarn lint --fix", "lint-markdown-fix": "yarn lint-markdown --fix", "lint-markdown": "markdownlint \"**/*.md\" --config=.markdownlint.json --ignore-path=.markdownlintignore", - "lint-stylelint": "npx nx lint website stylelint", - "lint": "npx nx lint eslint-plugin --skip-nx-cache && npx nx run-many --target=lint --exclude eslint-plugin", + "lint-stylelint": "nx lint website stylelint", + "lint-prune-suppressions": "nx run-many -t lint --projects=eslint-plugin-internal,eslint-plugin --prune-suppressions", + "lint": "nx run-many -t lint", "postinstall": "tsx tools/scripts/postinstall.mts", - "pre-commit": "yarn lint-staged", + "pre-commit": "lint-staged", "release": "tsx tools/release/release.mts", - "start": "npx nx run website:start", - "test": "npx nx run-many --target=test --exclude integration-tests --exclude website --exclude website-eslint", - "test-integration": "npx nx run integration-tests:test", - "typecheck": "npx nx run-many --target=typecheck" + "start": "nx run website:start", + "test": "nx run-many -t test --exclude integration-tests website website-eslint", + "test-integration": "nx run integration-tests:test", + "typecheck": "nx run-many -t typecheck" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "devDependencies": { - "@actions/core": "^1.10.1", - "@actions/github": "^6.0.0", "@eslint-community/eslint-plugin-eslint-comments": "^4.4.1", "@eslint/compat": "^1.2.4", "@eslint/eslintrc": "^3.2.0", "@eslint/js": "^9.26.0", - "@nx/devkit": "20.7.2", - "@nx/eslint": "20.7.2", - "@nx/vite": "20.7.2", - "@nx/workspace": "20.7.2", + "@nx/devkit": "21.4.1", + "@nx/js": "21.4.1", + "@nx/vite": "21.4.1", + "@nx/workspace": "21.4.1", "@swc/core": "^1.4.12", "@types/debug": "^4.1.12", "@types/eslint-plugin-jsx-a11y": "^6.10.0", @@ -70,21 +69,22 @@ "@types/yargs": "^17.0.32", "@typescript-eslint/eslint-plugin": "workspace:^", "@typescript-eslint/eslint-plugin-internal": "workspace:^", + "@typescript-eslint/parser": "workspace:^", "@typescript-eslint/scope-manager": "workspace:^", "@typescript-eslint/types": "workspace:^", "@typescript-eslint/typescript-estree": "workspace:^", "@typescript-eslint/utils": "workspace:^", "@vitest/coverage-v8": "^3.1.3", - "@vitest/eslint-plugin": "^1.1.44", + "@vitest/eslint-plugin": "^1.3.9", "console-fail-test": "^0.5.0", "cross-fetch": "^4.0.0", "cspell": "^9.0.0", "eslint": "^9.26.0", - "eslint-plugin-eslint-plugin": "^6.3.1", - "eslint-plugin-import": "^2.31.0", + "eslint-plugin-eslint-plugin": "^7.0.0", + "eslint-plugin-import": "^2.32.0", "eslint-plugin-jsdoc": "^50.5.0", "eslint-plugin-jsx-a11y": "^6.10.2", - "eslint-plugin-perfectionist": "^3.9.1", + "eslint-plugin-perfectionist": "^4.12.3", "eslint-plugin-react": "^7.37.3", "eslint-plugin-react-hooks": "^5.0.0", "eslint-plugin-regexp": "^2.7.0", @@ -92,22 +92,20 @@ "execa": "7.2.0", "globals": "^16.0.0", "husky": "^9.1.4", - "jiti": "2.4.2", "knip": "^5.41.1", "lint-staged": "^15.2.2", - "make-dir": "^4.0.0", - "markdownlint-cli": "^0.44.0", - "nx": "20.7.2", - "prettier": "3.5.0", - "pretty-format": "^29.7.0", + "markdownlint-cli": "^0.45.0", + "nx": "21.4.1", + "prettier": "3.6.2", "rimraf": "^5.0.5", "semver": "7.7.0", "tsx": "*", - "typescript": ">=4.8.4 <5.9.0", + "typescript": ">=4.8.4 <6.0.0", "typescript-eslint": "workspace:^", "vite": "^6.3.5", "vitest": "^3.1.3", - "yargs": "17.7.2" + "yargs": "17.7.2", + "yarn-berry-deduplicate": "^6.1.3" }, "resolutions": { "@types/eslint-scope": "link:./tools/dummypkg", @@ -116,15 +114,52 @@ "@types/node": "^22.0.0", "@types/react": "^18.2.14", "eslint-plugin-eslint-plugin@^5.5.0": "patch:eslint-plugin-eslint-plugin@npm%3A5.5.1#./.yarn/patches/eslint-plugin-eslint-plugin-npm-5.5.1-4206c2506d.patch", - "prettier": "3.5.0", - "pretty-format": "^29", "react-split-pane@^0.1.92": "patch:react-split-pane@npm%3A0.1.92#./.yarn/patches/react-split-pane-npm-0.1.92-93dbf51dff.patch", - "tmp": "0.2.1", "tsx": "^4.7.2", - "typescript": "5.8.2" + "typescript": "5.9.2" }, "packageManager": "yarn@3.8.2", "nx": { - "includedScripts": [] + "name": "repo", + "includedScripts": [ + "generate-configs", + "generate-lib", + "generate-sponsors" + ], + "targets": { + "generate-configs": { + "dependsOn": [ + "eslint-plugin:build" + ] + }, + "generate-lib": { + "dependsOn": [ + "typescript-eslint:build", + "eslint-plugin-internal:build" + ] + }, + "// These targets are used for repo level utils and checking repo files which do not belong to specific published packages": {}, + "typecheck": { + "command": "tsc -b tsconfig.repo-config-files.json", + "dependsOn": [ + "types:copy-ast-spec" + ], + "outputs": [ + "{workspaceRoot}/dist" + ], + "cache": true + }, + "lint": { + "command": "eslint", + "options": { + "cache": true, + "ignore-pattern": "packages" + }, + "cache": false + }, + "clean": { + "command": "rimraf dist/ coverage/ .eslintcache" + } + } } } diff --git a/packages/ast-spec/CHANGELOG.md b/packages/ast-spec/CHANGELOG.md index 8ed2bd1083df..057df049c10e 100644 --- a/packages/ast-spec/CHANGELOG.md +++ b/packages/ast-spec/CHANGELOG.md @@ -1,3 +1,222 @@ +## 8.46.4 (2025-11-10) + +This was a version bump only for ast-spec to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.3 (2025-11-03) + +This was a version bump only for ast-spec to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.2 (2025-10-20) + +### 🩹 Fixes + +- **typescript-estree:** forbid invalid modifiers in object methods ([#11689](https://github.com/typescript-eslint/typescript-eslint/pull/11689)) + +### ❤️ Thank You + +- fisker Cheung @fisker + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.1 (2025-10-13) + +### 🩹 Fixes + +- **ast-spec:** cleanup `TSLiteralType` ([#11624](https://github.com/typescript-eslint/typescript-eslint/pull/11624)) + +### ❤️ Thank You + +- Abraham Guo + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.0 (2025-10-06) + +### 🚀 Features + +- **typescript-estree:** private identifiers can only appear on LHS of in expressions ([#9232](https://github.com/typescript-eslint/typescript-eslint/pull/9232)) + +### 🩹 Fixes + +- **typescript-estree:** forbid abstract method and accessor to have implementation ([#11657](https://github.com/typescript-eslint/typescript-eslint/pull/11657)) +- **typescript-estree:** forbid `abstract` modifier in object methods ([#11656](https://github.com/typescript-eslint/typescript-eslint/pull/11656)) + +### ❤️ Thank You + +- fisker Cheung @fisker +- Joshua Chen + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.45.0 (2025-09-29) + +### 🩹 Fixes + +- **ast-spec:** narrow ArrowFunctionExpression.generator to false ([#11636](https://github.com/typescript-eslint/typescript-eslint/pull/11636)) + +### ❤️ Thank You + +- Josh Goldberg ✨ + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.44.1 (2025-09-22) + +### 🩹 Fixes + +- **typescript-estree:** forbid class property with name `constructor` ([#11590](https://github.com/typescript-eslint/typescript-eslint/pull/11590)) + +### ❤️ Thank You + +- fisker Cheung @fisker + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.44.0 (2025-09-15) + +This was a version bump only for ast-spec to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.43.0 (2025-09-08) + +### 🚀 Features + +- **typescript-estree:** disallow empty type parameter/argument lists ([#11563](https://github.com/typescript-eslint/typescript-eslint/pull/11563)) + +### ❤️ Thank You + +- Kirk Waiblinger @kirkwaiblinger + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.42.0 (2025-09-02) + +This was a version bump only for ast-spec to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.41.0 (2025-08-25) + +### 🩹 Fixes + +- **deps:** update dependency prettier to v3.6.2 ([#11496](https://github.com/typescript-eslint/typescript-eslint/pull/11496)) +- **deps:** update babel monorepo ([#11174](https://github.com/typescript-eslint/typescript-eslint/pull/11174)) + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.40.0 (2025-08-18) + +### 🚀 Features + +- **typescript-estree:** forbid invalid keys in `EnumMember` ([#11232](https://github.com/typescript-eslint/typescript-eslint/pull/11232)) + +### 🩹 Fixes + +- **typescript-estree:** correct range of import assertion with trailing comma ([#11478](https://github.com/typescript-eslint/typescript-eslint/pull/11478)) + +### ❤️ Thank You + +- fisker Cheung @fisker +- Kirk Waiblinger @kirkwaiblinger + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.39.1 (2025-08-11) + +This was a version bump only for ast-spec to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.39.0 (2025-08-04) + +### 🚀 Features + +- update to TypeScript 5.9.2 ([#11445](https://github.com/typescript-eslint/typescript-eslint/pull/11445)) + +### ❤️ Thank You + +- Brad Zacher @bradzacher + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.38.0 (2025-07-21) + +### 🚀 Features + +- **typescript-estree:** forbid optional chain in `TemplateTaggedLiteral` ([#11391](https://github.com/typescript-eslint/typescript-eslint/pull/11391)) + +### ❤️ Thank You + +- MK @asdf93074 + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.37.0 (2025-07-14) + +This was a version bump only for ast-spec to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.36.0 (2025-07-07) + +This was a version bump only for ast-spec to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.35.1 (2025-06-30) + +This was a version bump only for ast-spec to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.35.0 (2025-06-23) + +This was a version bump only for ast-spec to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.34.1 (2025-06-16) + +### 🩹 Fixes + +- **typescript-estree:** emit a Literal instead of Identifier for constructor when the identifier is a string ([#11299](https://github.com/typescript-eslint/typescript-eslint/pull/11299)) + +### ❤️ Thank You + +- Tao + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.34.0 (2025-06-09) + +### 🩹 Fixes + +- **typescript-estree:** add validation to interface extends ([#11271](https://github.com/typescript-eslint/typescript-eslint/pull/11271)) +- **typescript-estree:** change the token type of `null` from `Keyword` to `Null` ([#11283](https://github.com/typescript-eslint/typescript-eslint/pull/11283)) + +### ❤️ Thank You + +- Tao + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.33.1 (2025-06-02) + +This was a version bump only for ast-spec to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.33.0 (2025-05-26) + +This was a version bump only for ast-spec to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + ## 8.32.1 (2025-05-12) This was a version bump only for ast-spec to align it with other projects, there were no code changes. diff --git a/packages/ast-spec/package.json b/packages/ast-spec/package.json index a2c017d52f42..98f50fdac96c 100644 --- a/packages/ast-spec/package.json +++ b/packages/ast-spec/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/ast-spec", - "version": "8.32.1", + "version": "8.46.4", "description": "Complete specification for the TypeScript-ESTree AST", "private": true, "keywords": [ @@ -31,13 +31,13 @@ "main": "dist/index.js", "types": "dist/index.d.ts", "scripts": { - "build": "tsc -b tsconfig.build.json && api-extractor run --local --config=$INIT_CWD/api-extractor.json", + "build": "yarn run -BT nx build", "clean": "rimraf dist/ coverage/", "clean-fixtures": "rimraf -g \"./src/**/fixtures/**/snapshots\"", - "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", - "lint": "npx nx lint", - "test": "vitest --run --config=$INIT_CWD/vitest.config.mts", - "check-types": "npx nx typecheck" + "format": "yarn run -T format", + "lint": "yarn run -BT nx lint", + "test": "yarn run -BT nx test", + "typecheck": "yarn run -BT nx typecheck" }, "funding": { "type": "opencollective", @@ -47,6 +47,7 @@ "@babel/code-frame": "^7.24.2", "@babel/core": "^7.24.4", "@babel/eslint-parser": "^7.24.1", + "@babel/parser": "^7.24.1", "@microsoft/api-extractor": "^7.47.11", "@types/babel__code-frame": "^7.0.6", "@types/babel__core": "^7.20.5", @@ -56,9 +57,47 @@ "@vitest/utils": "^3.1.3", "eslint": "*", "glob": "*", - "prettier": "^3.2.5", "rimraf": "*", "typescript": "*", "vitest": "^3.1.3" + }, + "nx": { + "name": "ast-spec", + "implicitDependencies": [ + "!typescript-estree" + ], + "includedScripts": [ + "clean", + "clean-fixtures" + ], + "targets": { + "build": { + "command": "tsc -b tsconfig.build.json && api-extractor run --local --config=api-extractor.json", + "options": { + "cwd": "{projectRoot}" + }, + "outputs": [ + "{projectRoot}/dist/**/*.ts" + ], + "cache": true + }, + "lint": { + "command": "eslint" + }, + "typecheck": { + "outputs": [ + "{workspaceRoot}/dist", + "{projectRoot}/dist" + ], + "dependsOn": [ + "typescript-estree:build" + ] + }, + "test": { + "dependsOn": [ + "typecheck" + ] + } + } } } diff --git a/packages/ast-spec/project.json b/packages/ast-spec/project.json deleted file mode 100644 index 5e0432b40f39..000000000000 --- a/packages/ast-spec/project.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "ast-spec", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "projectType": "library", - "implicitDependencies": ["!typescript-estree"], - "root": "packages/ast-spec", - "sourceRoot": "packages/ast-spec/src", - "targets": { - "build": { - "outputs": ["{projectRoot}/dist/**/*.ts"] - }, - "lint": { - "executor": "@nx/eslint:lint", - "outputs": ["{options.outputFile}"] - }, - "test": { - "executor": "@nx/vite:test", - "dependsOn": ["typecheck"] - }, - "typecheck": { - "dependsOn": ["typescript-estree:build"] - } - } -} diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/abstract-constructor/fixture.ts b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/abstract-constructor/fixture.ts new file mode 100644 index 000000000000..bd45e0a8a625 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/abstract-constructor/fixture.ts @@ -0,0 +1,3 @@ +abstract class Foo { + abstract constructor() { } +} diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/abstract-constructor/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/abstract-constructor/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..8a67121b79c1 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/abstract-constructor/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,9 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > declaration > ClassDeclaration > _error_ > abstract-constructor > TSESTree - Error`] +TSError + 1 | abstract class Foo { +> 2 | abstract constructor() { } + | ^^^^^^^^ 'abstract' modifier can only appear on a class, method, or property declaration. + 3 | } + 4 | diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/abstract-constructor/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/abstract-constructor/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..b78e289f0c55 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/abstract-constructor/snapshots/2-Babel-Error.shot @@ -0,0 +1,10 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > declaration > ClassDeclaration > _error_ > abstract-constructor > Babel - Error`] +BabelError + 1 | abstract class Foo { +> 2 | abstract constructor() { } + | ^ Method 'constructor' cannot have an implementation because it is marked abstract. (2:2) + 3 | } + 4 | + diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/abstract-constructor/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/abstract-constructor/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..dbd705849820 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/abstract-constructor/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > declaration > ClassDeclaration > _error_ > abstract-constructor > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/abstract-getter-with-implementation/fixture.ts b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/abstract-getter-with-implementation/fixture.ts new file mode 100644 index 000000000000..0ac2bfca1dfd --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/abstract-getter-with-implementation/fixture.ts @@ -0,0 +1,3 @@ +abstract class Foo { + abstract get getter() { } +} diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/abstract-getter-with-implementation/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/abstract-getter-with-implementation/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..d7c0c1bcc98a --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/abstract-getter-with-implementation/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,9 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > declaration > ClassDeclaration > _error_ > abstract-getter-with-implementation > TSESTree - Error`] +TSError + 1 | abstract class Foo { +> 2 | abstract get getter() { } + | ^^^^^^ An abstract accessor cannot have an implementation. + 3 | } + 4 | diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/abstract-getter-with-implementation/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/abstract-getter-with-implementation/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..fe0fe6660cf0 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/abstract-getter-with-implementation/snapshots/2-Babel-Error.shot @@ -0,0 +1,10 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > declaration > ClassDeclaration > _error_ > abstract-getter-with-implementation > Babel - Error`] +BabelError + 1 | abstract class Foo { +> 2 | abstract get getter() { } + | ^ Method 'getter' cannot have an implementation because it is marked abstract. (2:2) + 3 | } + 4 | + diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/abstract-getter-with-implementation/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/abstract-getter-with-implementation/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..748024e02a80 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/abstract-getter-with-implementation/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > declaration > ClassDeclaration > _error_ > abstract-getter-with-implementation > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/abstract-method-with-implementation/fixture.ts b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/abstract-method-with-implementation/fixture.ts new file mode 100644 index 000000000000..80fe821c5d29 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/abstract-method-with-implementation/fixture.ts @@ -0,0 +1,3 @@ +abstract class Foo { + abstract method() { } +} diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/abstract-method-with-implementation/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/abstract-method-with-implementation/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..a65c609416d4 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/abstract-method-with-implementation/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,9 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > declaration > ClassDeclaration > _error_ > abstract-method-with-implementation > TSESTree - Error`] +TSError + 1 | abstract class Foo { +> 2 | abstract method() { } + | ^^^^^^ Method 'method' cannot have an implementation because it is marked abstract. + 3 | } + 4 | diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/abstract-method-with-implementation/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/abstract-method-with-implementation/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..c345ce0399ec --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/abstract-method-with-implementation/snapshots/2-Babel-Error.shot @@ -0,0 +1,10 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > declaration > ClassDeclaration > _error_ > abstract-method-with-implementation > Babel - Error`] +BabelError + 1 | abstract class Foo { +> 2 | abstract method() { } + | ^ Method 'method' cannot have an implementation because it is marked abstract. (2:2) + 3 | } + 4 | + diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/abstract-method-with-implementation/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/abstract-method-with-implementation/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..fff6cbc7c6ce --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/abstract-method-with-implementation/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > declaration > ClassDeclaration > _error_ > abstract-method-with-implementation > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/abstract-setter-with-implementation/fixture.ts b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/abstract-setter-with-implementation/fixture.ts new file mode 100644 index 000000000000..fa7888c34cc9 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/abstract-setter-with-implementation/fixture.ts @@ -0,0 +1,3 @@ +abstract class Foo { + abstract set setter(v) { } +} diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/abstract-setter-with-implementation/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/abstract-setter-with-implementation/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..febb4fe5dcde --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/abstract-setter-with-implementation/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,9 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > declaration > ClassDeclaration > _error_ > abstract-setter-with-implementation > TSESTree - Error`] +TSError + 1 | abstract class Foo { +> 2 | abstract set setter(v) { } + | ^^^^^^ An abstract accessor cannot have an implementation. + 3 | } + 4 | diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/abstract-setter-with-implementation/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/abstract-setter-with-implementation/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..c45ee034b7c3 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/abstract-setter-with-implementation/snapshots/2-Babel-Error.shot @@ -0,0 +1,10 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > declaration > ClassDeclaration > _error_ > abstract-setter-with-implementation > Babel - Error`] +BabelError + 1 | abstract class Foo { +> 2 | abstract set setter(v) { } + | ^ Method 'setter' cannot have an implementation because it is marked abstract. (2:2) + 3 | } + 4 | + diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/abstract-setter-with-implementation/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/abstract-setter-with-implementation/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..1e222f7febc0 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/abstract-setter-with-implementation/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > declaration > ClassDeclaration > _error_ > abstract-setter-with-implementation > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/export-missing-name/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/export-missing-name/snapshots/2-Babel-Error.shot index 0e64270303c2..ac409fa55ba0 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/export-missing-name/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/export-missing-name/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ClassDeclaration > _error_ > export-missing-name > Babel - Error`] -SyntaxError: A class name is required. (1:13) +BabelError +> 1 | export class { } + | ^ A class name is required. (1:13) + 2 | + diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/implements-non-identifier/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/implements-non-identifier/snapshots/2-Babel-Error.shot index 56fdd942ce87..c5774c25f7ed 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/implements-non-identifier/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/implements-non-identifier/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ClassDeclaration > _error_ > implements-non-identifier > Babel - Error`] -SyntaxError: Unexpected token (1:21) +BabelError +> 1 | class Foo implements 'thing' {} + | ^ Unexpected token (1:21) + 2 | + diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-body/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-body/snapshots/2-Babel-Error.shot index 2dec9742a619..cc16e7c77a49 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-body/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-body/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ClassDeclaration > _error_ > missing-body > Babel - Error`] -SyntaxError: Unexpected token, expected "{" (1:9) +BabelError +> 1 | class Foo; + | ^ Unexpected token, expected "{" (1:9) + 2 | + diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-extends-type-param/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-extends-type-param/snapshots/1-TSESTree-Error.shot index 697d82b45d5b..1d0cd5a24a14 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-extends-type-param/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-extends-type-param/snapshots/1-TSESTree-Error.shot @@ -1,4 +1,7 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ClassDeclaration > _error_ > missing-extends-type-param > TSESTree - Error`] -NO ERROR +TSError +> 1 | class C extends D<> {} + | ^^ Type argument list cannot be empty. + 2 | diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-extends-type-param/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-extends-type-param/snapshots/2-Babel-Error.shot index a61921db5773..e3f5ef8b8219 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-extends-type-param/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-extends-type-param/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ClassDeclaration > _error_ > missing-extends-type-param > Babel - Error`] -SyntaxError: Type argument list cannot be empty. (1:17) +BabelError +> 1 | class C extends D<> {} + | ^ Type argument list cannot be empty. (1:17) + 2 | + diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-extends-type-param/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-extends-type-param/snapshots/3-Alignment-Error.shot index 5797ee061aed..773b51b14128 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-extends-type-param/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-extends-type-param/snapshots/3-Alignment-Error.shot @@ -1,4 +1,4 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ClassDeclaration > _error_ > missing-extends-type-param > Error Alignment`] -Babel errored but TSESTree didn't +Both errored diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-type-param-with-comment/fixture.ts b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-type-param-with-comment/fixture.ts new file mode 100644 index 000000000000..14098aa86e59 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-type-param-with-comment/fixture.ts @@ -0,0 +1 @@ +class C< /* empty */ > {} diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-type-param-with-comment/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-type-param-with-comment/snapshots/1-Babel-Error.shot new file mode 100644 index 000000000000..a14c3c54cac7 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-type-param-with-comment/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration _error_ missing-type-param Babel - Error 1`] = `[SyntaxError: Type parameter list cannot be empty. (1:7)]`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-type-param-with-comment/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-type-param-with-comment/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..25404a5d9562 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-type-param-with-comment/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,7 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > declaration > ClassDeclaration > _error_ > missing-type-param-with-comment > TSESTree - Error`] +TSError +> 1 | class C< /* empty */ > {} + | ^^^^^^^^^^^^^^^ Type parameter list cannot be empty. + 2 | diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-type-param-with-comment/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-type-param-with-comment/snapshots/2-Alignment-Error.shot new file mode 100644 index 000000000000..49567ea7a7b5 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-type-param-with-comment/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration _error_ missing-type-param Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-type-param-with-comment/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-type-param-with-comment/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..d50c7992d392 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-type-param-with-comment/snapshots/2-Babel-Error.shot @@ -0,0 +1,8 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > declaration > ClassDeclaration > _error_ > missing-type-param-with-comment > Babel - Error`] +BabelError +> 1 | class C< /* empty */ > {} + | ^ Type parameter list cannot be empty. (1:7) + 2 | + diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-type-param-with-comment/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-type-param-with-comment/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..0d5857532795 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-type-param-with-comment/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > declaration > ClassDeclaration > _error_ > missing-type-param-with-comment > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-type-param/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-type-param/snapshots/1-TSESTree-Error.shot index 656005eda876..241ee319116c 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-type-param/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-type-param/snapshots/1-TSESTree-Error.shot @@ -1,4 +1,7 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ClassDeclaration > _error_ > missing-type-param > TSESTree - Error`] -NO ERROR +TSError +> 1 | class C<> {} + | ^^ Type parameter list cannot be empty. + 2 | diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-type-param/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-type-param/snapshots/2-Babel-Error.shot index 2c265df14f59..c2f76a98fb66 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-type-param/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-type-param/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ClassDeclaration > _error_ > missing-type-param > Babel - Error`] -SyntaxError: Type parameter list cannot be empty. (1:7) +BabelError +> 1 | class C<> {} + | ^ Type parameter list cannot be empty. (1:7) + 2 | + diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-type-param/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-type-param/snapshots/3-Alignment-Error.shot index 1a694a67920e..9d29521b804d 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-type-param/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-type-param/snapshots/3-Alignment-Error.shot @@ -1,4 +1,4 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ClassDeclaration > _error_ > missing-type-param > Error Alignment`] -Babel errored but TSESTree didn't +Both errored diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Babel-Error.shot index dca1aa8e5e3c..c5b89c0e5107 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ClassDeclaration > _error_ > non-identifier-name > Babel - Error`] -SyntaxError: A class name is required. (1:6) +BabelError +> 1 | class 'Foo' {} + | ^ A class name is required. (1:6) + 2 | + diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/2-Babel-Error.shot index 2909d642ff49..2b75e5f4601f 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ClassDeclaration > _error_ > non-identifier-type-param > Babel - Error`] -SyntaxError: Unexpected token (1:8) +BabelError +> 1 | class C<1> {} + | ^ Unexpected token (1:8) + 2 | + diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/missing-source/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/missing-source/snapshots/2-Babel-Error.shot index 6efe9b3b7d81..3ec3216dc914 100644 --- a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/missing-source/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/missing-source/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ExportAllDeclaration > _error_ > missing-source > Babel - Error`] -SyntaxError: Unexpected token (1:13) +BabelError +> 1 | export * from; + | ^ Unexpected token (1:13) + 2 | + diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/non-string-source/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/non-string-source/snapshots/2-Babel-Error.shot index f0134190e9c9..00afdab72fba 100644 --- a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/non-string-source/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/non-string-source/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ExportAllDeclaration > _error_ > non-string-source > Babel - Error`] -SyntaxError: Unexpected token (1:14) +BabelError +> 1 | export * from module; + | ^ Unexpected token (1:14) + 2 | + diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/enum/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/enum/snapshots/2-Babel-Error.shot index 47bab5896cfe..491a0644ae9d 100644 --- a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/enum/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/enum/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ExportDefaultDeclaration > _error_ > enum > Babel - Error`] -SyntaxError: Unexpected reserved word 'enum'. (1:15) +BabelError +> 1 | export default enum Foo {} + | ^ Unexpected reserved word 'enum'. (1:15) + 2 | + diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/namespace/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/namespace/snapshots/2-Babel-Error.shot index 835d3e6b6496..c66fdce48dd5 100644 --- a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/namespace/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/namespace/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ExportDefaultDeclaration > _error_ > namespace > Babel - Error`] -SyntaxError: Missing semicolon. (1:24) +BabelError +> 1 | export default namespace Foo {} + | ^ Missing semicolon. (1:24) + 2 | + diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/type-alias/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/type-alias/snapshots/2-Babel-Error.shot index e9a8f373d0e6..ed1501e269f3 100644 --- a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/type-alias/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/type-alias/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ExportDefaultDeclaration > _error_ > type-alias > Babel - Error`] -SyntaxError: Missing semicolon. (1:19) +BabelError +> 1 | export default type Foo = 1; + | ^ Missing semicolon. (1:19) + 2 | + diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/variable-declaration/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/variable-declaration/snapshots/2-Babel-Error.shot index be123c950dde..3b031210e7bc 100644 --- a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/variable-declaration/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/variable-declaration/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ExportDefaultDeclaration > _error_ > variable-declaration > Babel - Error`] -SyntaxError: Only expressions, functions or classes are allowed as the `default` export. (1:15) +BabelError +> 1 | export default const x = 1; + | ^ Only expressions, functions or classes are allowed as the `default` export. (1:15) + 2 | + diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-class/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-class/snapshots/2-Babel-Error.shot index 30b0ef777673..c2035556e868 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-class/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-class/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ExportNamedDeclaration > _error_ > anonymous-class > Babel - Error`] -SyntaxError: A class name is required. (1:13) +BabelError +> 1 | export class {} + | ^ A class name is required. (1:13) + 2 | + diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-function-expression/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-function-expression/snapshots/2-Babel-Error.shot index ff3be5f420c9..1a9032ea5498 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-function-expression/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-function-expression/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ExportNamedDeclaration > _error_ > anonymous-function-expression > Babel - Error`] -SyntaxError: Unexpected token (1:16) +BabelError +> 1 | export function () {} + | ^ Unexpected token (1:16) + 2 | + diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/arrow-function/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/arrow-function/snapshots/2-Babel-Error.shot index f8f9efcc5de6..e475f632d493 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/arrow-function/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/arrow-function/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ExportNamedDeclaration > _error_ > arrow-function > Babel - Error`] -SyntaxError: Unexpected token, expected "{" (1:7) +BabelError +> 1 | export () => {}; + | ^ Unexpected token, expected "{" (1:7) + 2 | + diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/2-Babel-Error.shot index 89b0658efc67..75d9c00ff13a 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ExportNamedDeclaration > _error_ > assertion > Babel - Error`] -SyntaxError: A JSON module can only be imported with `default`. (1:9) +BabelError +> 1 | export { foo } from 'mod' assert { type: 'json' }; + | ^ A JSON module can only be imported with `default`. (1:9) + 2 | + diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/braced-identifier-aliased-to-number-literal-with-source/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/braced-identifier-aliased-to-number-literal-with-source/snapshots/2-Babel-Error.shot index d87d58c885c7..11121f10d40c 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/braced-identifier-aliased-to-number-literal-with-source/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/braced-identifier-aliased-to-number-literal-with-source/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ExportNamedDeclaration > _error_ > braced-identifier-aliased-to-number-literal-with-source > Babel - Error`] -SyntaxError: Unexpected token (1:14) +BabelError +> 1 | export { a as 1 } from 'mod'; + | ^ Unexpected token (1:14) + 2 | + diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/braced-identifier-aliased-to-number-literal-without-source/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/braced-identifier-aliased-to-number-literal-without-source/snapshots/2-Babel-Error.shot index 17bc155f8d2d..6d266bf43205 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/braced-identifier-aliased-to-number-literal-without-source/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/braced-identifier-aliased-to-number-literal-without-source/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ExportNamedDeclaration > _error_ > braced-identifier-aliased-to-number-literal-without-source > Babel - Error`] -SyntaxError: Unexpected token (1:14) +BabelError +> 1 | export { a as 1 }; + | ^ Unexpected token (1:14) + 2 | + diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/braced-number-literal-with-source/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/braced-number-literal-with-source/snapshots/2-Babel-Error.shot index c654860eb328..e749b5d25fe9 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/braced-number-literal-with-source/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/braced-number-literal-with-source/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ExportNamedDeclaration > _error_ > braced-number-literal-with-source > Babel - Error`] -SyntaxError: Unexpected token (1:9) +BabelError +> 1 | export { 1 } from 'mod'; + | ^ Unexpected token (1:9) + 2 | + diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/braced-number-literal-without-source/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/braced-number-literal-without-source/snapshots/2-Babel-Error.shot index 27316defb9b0..e81fcdad7e08 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/braced-number-literal-without-source/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/braced-number-literal-without-source/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ExportNamedDeclaration > _error_ > braced-number-literal-without-source > Babel - Error`] -SyntaxError: Unexpected token (1:9) +BabelError +> 1 | export { 1 }; + | ^ Unexpected token (1:9) + 2 | + diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/braced-string-literal-aliased-to-identifier-without-source/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/braced-string-literal-aliased-to-identifier-without-source/snapshots/2-Babel-Error.shot index eb3e40a2aa15..f201320ca0db 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/braced-string-literal-aliased-to-identifier-without-source/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/braced-string-literal-aliased-to-identifier-without-source/snapshots/2-Babel-Error.shot @@ -1,5 +1,9 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ExportNamedDeclaration > _error_ > braced-string-literal-aliased-to-identifier-without-source > Babel - Error`] -SyntaxError: A string literal cannot be used as an exported binding without `from`. +BabelError +> 1 | export { 'a a' as b }; + | ^ A string literal cannot be used as an exported binding without `from`. - Did you mean `export { 'a a' as 'b' } from 'some-module'`? (1:9) + 2 | + diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/braced-string-literal-aliased-to-number-literal-without-source/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/braced-string-literal-aliased-to-number-literal-without-source/snapshots/2-Babel-Error.shot index e91248efe601..8ab798e5cbab 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/braced-string-literal-aliased-to-number-literal-without-source/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/braced-string-literal-aliased-to-number-literal-without-source/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ExportNamedDeclaration > _error_ > braced-string-literal-aliased-to-number-literal-without-source > Babel - Error`] -SyntaxError: Unexpected token (1:18) +BabelError +> 1 | export { 'a a' as 1 }; + | ^ Unexpected token (1:18) + 2 | + diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/braced-string-literal-aliased-to-string-literal-without-source/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/braced-string-literal-aliased-to-string-literal-without-source/snapshots/2-Babel-Error.shot index 4ca061f40171..c8830b8a6fd3 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/braced-string-literal-aliased-to-string-literal-without-source/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/braced-string-literal-aliased-to-string-literal-without-source/snapshots/2-Babel-Error.shot @@ -1,5 +1,9 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ExportNamedDeclaration > _error_ > braced-string-literal-aliased-to-string-literal-without-source > Babel - Error`] -SyntaxError: A string literal cannot be used as an exported binding without `from`. +BabelError +> 1 | export { 'a a' as 'b b' }; + | ^ A string literal cannot be used as an exported binding without `from`. - Did you mean `export { 'a a' as 'b b' } from 'some-module'`? (1:9) + 2 | + diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/braced-string-literal-many-without-source/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/braced-string-literal-many-without-source/snapshots/2-Babel-Error.shot index 0a53b6d2d4df..6d73afe3c0f4 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/braced-string-literal-many-without-source/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/braced-string-literal-many-without-source/snapshots/2-Babel-Error.shot @@ -1,5 +1,9 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ExportNamedDeclaration > _error_ > braced-string-literal-many-without-source > Babel - Error`] -SyntaxError: A string literal cannot be used as an exported binding without `from`. +BabelError +> 1 | export { 'a a', 'b b' }; + | ^ A string literal cannot be used as an exported binding without `from`. - Did you mean `export { 'a a' as 'a a' } from 'some-module'`? (1:9) + 2 | + diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/braced-string-literal-without-source/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/braced-string-literal-without-source/snapshots/2-Babel-Error.shot index b494c222dfda..648bcec8e693 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/braced-string-literal-without-source/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/braced-string-literal-without-source/snapshots/2-Babel-Error.shot @@ -1,5 +1,9 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ExportNamedDeclaration > _error_ > braced-string-literal-without-source > Babel - Error`] -SyntaxError: A string literal cannot be used as an exported binding without `from`. +BabelError +> 1 | export { 'a a' }; + | ^ A string literal cannot be used as an exported binding without `from`. - Did you mean `export { 'a a' as 'a a' } from 'some-module'`? (1:9) + 2 | + diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/class-expression/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/class-expression/snapshots/2-Babel-Error.shot index 3859e1338fb1..7f9ff6798317 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/class-expression/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/class-expression/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ExportNamedDeclaration > _error_ > class-expression > Babel - Error`] -SyntaxError: Unexpected token, expected "{" (1:7) +BabelError +> 1 | export (class Foo {}); + | ^ Unexpected token, expected "{" (1:7) + 2 | + diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/identifier-direct/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/identifier-direct/snapshots/2-Babel-Error.shot index f25331d54178..38ab33ea3608 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/identifier-direct/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/identifier-direct/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ExportNamedDeclaration > _error_ > identifier-direct > Babel - Error`] -SyntaxError: Unexpected token, expected "{" (1:7) +BabelError +> 1 | export a; + | ^ Unexpected token, expected "{" (1:7) + 2 | + diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-direct/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-direct/snapshots/2-Babel-Error.shot index 1fd7baadc861..3d38c4f9e70e 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-direct/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-direct/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ExportNamedDeclaration > _error_ > literal-direct > Babel - Error`] -SyntaxError: Unexpected token, expected "{" (1:7) +BabelError +> 1 | export 'a'; + | ^ Unexpected token, expected "{" (1:7) + 2 | + diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-id-and-not-exported/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-id-and-not-exported/snapshots/2-Babel-Error.shot index 8a3517755f4f..ce11286822a7 100644 --- a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-id-and-not-exported/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-id-and-not-exported/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > FunctionDeclaration > _error_ > missing-id-and-not-exported > Babel - Error`] -SyntaxError: Unexpected token (1:9) +BabelError +> 1 | function () {} + | ^ Unexpected token (1:9) + 2 | + diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-type-param/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-type-param/snapshots/1-TSESTree-Error.shot index febea1b1603a..0e4268f529cf 100644 --- a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-type-param/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-type-param/snapshots/1-TSESTree-Error.shot @@ -1,4 +1,7 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > FunctionDeclaration > _error_ > missing-type-param > TSESTree - Error`] -NO ERROR +TSError +> 1 | function foo<>() {} + | ^^ Type parameter list cannot be empty. + 2 | diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-type-param/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-type-param/snapshots/2-Babel-Error.shot index 559cc556fbd3..6e7c4870ff8b 100644 --- a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-type-param/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-type-param/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > FunctionDeclaration > _error_ > missing-type-param > Babel - Error`] -SyntaxError: Type parameter list cannot be empty. (1:12) +BabelError +> 1 | function foo<>() {} + | ^ Type parameter list cannot be empty. (1:12) + 2 | + diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-type-param/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-type-param/snapshots/3-Alignment-Error.shot index 190ac10d0bdd..046a008ac8ee 100644 --- a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-type-param/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-type-param/snapshots/3-Alignment-Error.shot @@ -1,4 +1,4 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > FunctionDeclaration > _error_ > missing-type-param > Error Alignment`] -Babel errored but TSESTree didn't +Both errored diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Babel-Error.shot index 907fe7ab23ae..b172c076d322 100644 --- a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > FunctionDeclaration > _error_ > non-identifier-name > Babel - Error`] -SyntaxError: Unexpected token (1:9) +BabelError +> 1 | function 1() {} + | ^ Unexpected token (1:9) + 2 | + diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/2-Babel-Error.shot index 270e3399f309..700ebba3a301 100644 --- a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > FunctionDeclaration > _error_ > non-identifier-type-param > Babel - Error`] -SyntaxError: Unexpected token (1:13) +BabelError +> 1 | function foo<1>() {} + | ^ Unexpected token (1:13) + 2 | + diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/default-and-named-and-namespace/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/default-and-named-and-namespace/snapshots/2-Babel-Error.shot index 7f8ffa9ce43d..0e3a25550420 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/default-and-named-and-namespace/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/default-and-named-and-namespace/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ImportDeclaration > _error_ > default-and-named-and-namespace > Babel - Error`] -SyntaxError: Unexpected token, expected "from" (1:16) +BabelError +> 1 | import a, * as b, { c } from 'mod'; + | ^ Unexpected token, expected "from" (1:16) + 2 | + diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/default-number-literal/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/default-number-literal/snapshots/2-Babel-Error.shot index b2062a8fd6c9..43ab6d6cbb6e 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/default-number-literal/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/default-number-literal/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ImportDeclaration > _error_ > default-number-literal > Babel - Error`] -SyntaxError: Unexpected token, expected "{" (1:7) +BabelError +> 1 | import 1 from 'mod'; + | ^ Unexpected token, expected "{" (1:7) + 2 | + diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/default-string-literal/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/default-string-literal/snapshots/2-Babel-Error.shot index 6ef5744a9a28..6ac746b3158d 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/default-string-literal/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/default-string-literal/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ImportDeclaration > _error_ > default-string-literal > Babel - Error`] -SyntaxError: Missing semicolon. (1:12) +BabelError +> 1 | import 'a a' from 'mod'; + | ^ Missing semicolon. (1:12) + 2 | + diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-and-namespace/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-and-namespace/snapshots/2-Babel-Error.shot index acec1a57dfca..f0b67f5c7abb 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-and-namespace/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-and-namespace/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ImportDeclaration > _error_ > named-and-namespace > Babel - Error`] -SyntaxError: Unexpected token, expected "from" (1:12) +BabelError +> 1 | import { b }, * as a from 'a'; + | ^ Unexpected token, expected "from" (1:12) + 2 | + diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-identifier-aliased-to-number-literal/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-identifier-aliased-to-number-literal/snapshots/2-Babel-Error.shot index aaff744edc32..28b4fb532bbe 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-identifier-aliased-to-number-literal/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-identifier-aliased-to-number-literal/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ImportDeclaration > _error_ > named-identifier-aliased-to-number-literal > Babel - Error`] -SyntaxError: Unexpected token (1:14) +BabelError +> 1 | import { X as 1 } from 'mod'; + | ^ Unexpected token (1:14) + 2 | + diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-identifier-aliased-to-string-literal/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-identifier-aliased-to-string-literal/snapshots/2-Babel-Error.shot index 14d274da0ea3..f13d1ad86b72 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-identifier-aliased-to-string-literal/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-identifier-aliased-to-string-literal/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ImportDeclaration > _error_ > named-identifier-aliased-to-string-literal > Babel - Error`] -SyntaxError: Unexpected token (1:14) +BabelError +> 1 | import { X as 'a a' } from 'mod'; + | ^ Unexpected token (1:14) + 2 | + diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-number-literal-aliased-to-identifier/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-number-literal-aliased-to-identifier/snapshots/2-Babel-Error.shot index 6e9cc05e0006..cbce80d6b85d 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-number-literal-aliased-to-identifier/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-number-literal-aliased-to-identifier/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ImportDeclaration > _error_ > named-number-literal-aliased-to-identifier > Babel - Error`] -SyntaxError: Unexpected token (1:9) +BabelError +> 1 | import { 1 as X } from 'mod'; + | ^ Unexpected token (1:9) + 2 | + diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-number-literal-aliased-to-number-literal/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-number-literal-aliased-to-number-literal/snapshots/2-Babel-Error.shot index 1ce70d79982d..0dcbc46684f9 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-number-literal-aliased-to-number-literal/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-number-literal-aliased-to-number-literal/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ImportDeclaration > _error_ > named-number-literal-aliased-to-number-literal > Babel - Error`] -SyntaxError: Unexpected token (1:9) +BabelError +> 1 | import { 1 as 1 } from 'mod'; + | ^ Unexpected token (1:9) + 2 | + diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-number-literal-aliased-to-string-literal/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-number-literal-aliased-to-string-literal/snapshots/2-Babel-Error.shot index 5d0ee5c06f74..0346b41d38d4 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-number-literal-aliased-to-string-literal/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-number-literal-aliased-to-string-literal/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ImportDeclaration > _error_ > named-number-literal-aliased-to-string-literal > Babel - Error`] -SyntaxError: Unexpected token (1:9) +BabelError +> 1 | import { 1 as 'a a' } from 'mod'; + | ^ Unexpected token (1:9) + 2 | + diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-number-literal/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-number-literal/snapshots/2-Babel-Error.shot index 3ab2880006e0..b3307fa4f464 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-number-literal/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-number-literal/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ImportDeclaration > _error_ > named-number-literal > Babel - Error`] -SyntaxError: Unexpected token (1:9) +BabelError +> 1 | import { 1 } from 'mod'; + | ^ Unexpected token (1:9) + 2 | + diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-string-literal-aliased-to-number-literal/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-string-literal-aliased-to-number-literal/snapshots/2-Babel-Error.shot index ba56e25400c6..db49d74cedaa 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-string-literal-aliased-to-number-literal/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-string-literal-aliased-to-number-literal/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ImportDeclaration > _error_ > named-string-literal-aliased-to-number-literal > Babel - Error`] -SyntaxError: Unexpected token (1:17) +BabelError +> 1 | import { "😭" as 1 } from 'mod'; + | ^ Unexpected token (1:17) + 2 | + diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-string-literal-aliased-to-string-literal/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-string-literal-aliased-to-string-literal/snapshots/2-Babel-Error.shot index ef0d81834f4e..9294a60a3d0e 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-string-literal-aliased-to-string-literal/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-string-literal-aliased-to-string-literal/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ImportDeclaration > _error_ > named-string-literal-aliased-to-string-literal > Babel - Error`] -SyntaxError: Unexpected token (1:17) +BabelError +> 1 | import { "😭" as 'a a' } from 'mod'; + | ^ Unexpected token (1:17) + 2 | + diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-string-literal/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-string-literal/snapshots/2-Babel-Error.shot index 811ae5af3b35..d40da4301b86 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-string-literal/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-string-literal/snapshots/2-Babel-Error.shot @@ -1,5 +1,9 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ImportDeclaration > _error_ > named-string-literal > Babel - Error`] -SyntaxError: A string literal cannot be used as an imported binding. +BabelError +> 1 | import { "😭" } from 'mod'; + | ^ A string literal cannot be used as an imported binding. - Did you mean `import { "😭" as foo }`? (1:9) + 2 | + diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-default/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-default/snapshots/2-Babel-Error.shot index 370a42b15d95..bfbfc646d0d0 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-default/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-default/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ImportDeclaration > _error_ > namespace-and-default > Babel - Error`] -SyntaxError: Unexpected token, expected "from" (1:13) +BabelError +> 1 | import * as b, a from 'mod'; + | ^ Unexpected token, expected "from" (1:13) + 2 | + diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-named/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-named/snapshots/2-Babel-Error.shot index 2bfe0c35942c..c966103d9606 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-named/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-named/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ImportDeclaration > _error_ > namespace-and-named > Babel - Error`] -SyntaxError: Unexpected token, expected "from" (1:13) +BabelError +> 1 | import * as a, { b } from 'a'; + | ^ Unexpected token, expected "from" (1:13) + 2 | + diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-namespace/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-namespace/snapshots/2-Babel-Error.shot index 7020792b5fc4..84285d1c9a9a 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-namespace/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-namespace/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ImportDeclaration > _error_ > namespace-and-namespace > Babel - Error`] -SyntaxError: Unexpected token, expected "from" (1:13) +BabelError +> 1 | import * as a, * as b from 'a'; + | ^ Unexpected token, expected "from" (1:13) + 2 | + diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-non-identifier/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-non-identifier/snapshots/2-Babel-Error.shot index 4b27d2236cfa..444773331adc 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-non-identifier/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-non-identifier/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ImportDeclaration > _error_ > namespace-non-identifier > Babel - Error`] -SyntaxError: Unexpected token (1:12) +BabelError +> 1 | import * as 1 from 'mod'; + | ^ Unexpected token (1:12) + 2 | + diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/non-string-source/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/non-string-source/snapshots/2-Babel-Error.shot index b1be30149fd4..a4ab23c8f836 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/non-string-source/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/non-string-source/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > ImportDeclaration > _error_ > non-string-source > Babel - Error`] -SyntaxError: Unexpected token (1:19) +BabelError +> 1 | import * as x from module; + | ^ Unexpected token (1:19) + 2 | + diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/async/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/async/snapshots/2-Babel-Error.shot index b5d9b98f7eb0..ccb57192de34 100644 --- a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/async/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/async/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > TSDeclareFunction > _error_ > async > Babel - Error`] -SyntaxError: Missing semicolon. (1:7) +BabelError +> 1 | declare async function foo(); + | ^ Missing semicolon. (1:7) + 2 | + diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/declare-with-body/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/declare-with-body/snapshots/2-Babel-Error.shot index e7d1600ede23..8bd1dcb842a0 100644 --- a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/declare-with-body/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/declare-with-body/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > TSDeclareFunction > _error_ > declare-with-body > Babel - Error`] -SyntaxError: An implementation cannot be declared in ambient contexts. (1:0) +BabelError +> 1 | declare function foo(): void {}; + | ^ An implementation cannot be declared in ambient contexts. (1:0) + 2 | + diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/missing-id-and-not-exported/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/missing-id-and-not-exported/snapshots/2-Babel-Error.shot index b0f108c8f608..0ba263f88f09 100644 --- a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/missing-id-and-not-exported/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/missing-id-and-not-exported/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > TSDeclareFunction > _error_ > missing-id-and-not-exported > Babel - Error`] -SyntaxError: Unexpected token (1:17) +BabelError +> 1 | declare function (); + | ^ Unexpected token (1:17) + 2 | + diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/missing-type-param/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/missing-type-param/snapshots/1-TSESTree-Error.shot index 86e87930550c..1ce9f3a6510a 100644 --- a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/missing-type-param/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/missing-type-param/snapshots/1-TSESTree-Error.shot @@ -1,4 +1,7 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > TSDeclareFunction > _error_ > missing-type-param > TSESTree - Error`] -NO ERROR +TSError +> 1 | declare function foo<>(): void; + | ^^ Type parameter list cannot be empty. + 2 | diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/missing-type-param/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/missing-type-param/snapshots/2-Babel-Error.shot index f940ce76c084..541b20502249 100644 --- a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/missing-type-param/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/missing-type-param/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > TSDeclareFunction > _error_ > missing-type-param > Babel - Error`] -SyntaxError: Type parameter list cannot be empty. (1:20) +BabelError +> 1 | declare function foo<>(): void; + | ^ Type parameter list cannot be empty. (1:20) + 2 | + diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/missing-type-param/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/missing-type-param/snapshots/3-Alignment-Error.shot index 2bda9d5029bb..19cdf1fa465f 100644 --- a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/missing-type-param/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/missing-type-param/snapshots/3-Alignment-Error.shot @@ -1,4 +1,4 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > TSDeclareFunction > _error_ > missing-type-param > Error Alignment`] -Babel errored but TSESTree didn't +Both errored diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/non-identifier-name/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/non-identifier-name/snapshots/2-Babel-Error.shot index 835c21eb16a8..4444ecfc395a 100644 --- a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/non-identifier-name/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/non-identifier-name/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > TSDeclareFunction > _error_ > non-identifier-name > Babel - Error`] -SyntaxError: Unexpected token (1:17) +BabelError +> 1 | declare function 1(); + | ^ Unexpected token (1:17) + 2 | + diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/non-identifier-type-param/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/non-identifier-type-param/snapshots/2-Babel-Error.shot index 84802a911f35..d7a45581d36a 100644 --- a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/non-identifier-type-param/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/non-identifier-type-param/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > TSDeclareFunction > _error_ > non-identifier-type-param > Babel - Error`] -SyntaxError: Unexpected token (1:19) +BabelError +> 1 | declare function f<1>(): void; + | ^ Unexpected token (1:19) + 2 | + diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/decorator/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/decorator/snapshots/2-Babel-Error.shot index 3b8661db0c38..5daf5307227b 100644 --- a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/decorator/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/decorator/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > TSEnumDeclaration > _error_ > decorator > Babel - Error`] -SyntaxError: Leading decorators must be attached to a class declaration. (1:6) +BabelError +> 1 | @decl enum Test {} + | ^ Leading decorators must be attached to a class declaration. (1:6) + 2 | + diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/missing-body/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/missing-body/snapshots/2-Babel-Error.shot index dd8d595e57ec..a82bf4ed854d 100644 --- a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/missing-body/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/missing-body/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > TSEnumDeclaration > _error_ > missing-body > Babel - Error`] -SyntaxError: Unexpected token, expected "{" (1:8) +BabelError +> 1 | enum Foo; + | ^ Unexpected token, expected "{" (1:8) + 2 | + diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/missing-id/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/missing-id/snapshots/2-Babel-Error.shot index 4418c7a1e888..359f07219f1e 100644 --- a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/missing-id/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/missing-id/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > TSEnumDeclaration > _error_ > missing-id > Babel - Error`] -SyntaxError: Unexpected token (1:5) +BabelError +> 1 | enum {} + | ^ Unexpected token (1:5) + 2 | + diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Babel-Error.shot index 46552a854f62..cd61634a1671 100644 --- a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > TSEnumDeclaration > _error_ > non-identifier-name > Babel - Error`] -SyntaxError: Unexpected token (1:5) +BabelError +> 1 | enum 1 {} + | ^ Unexpected token (1:5) + 2 | + diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/1-TSESTree-AST.shot index ddd23006e5d0..9a5146151d36 100644 --- a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/1-TSESTree-AST.shot @@ -8,7 +8,6 @@ Program { members: [ TSEnumMember { type: "TSEnumMember", - computed: false, id: Identifier { type: "Identifier", decorators: [], diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/5-AST-Alignment-AST.shot index 90fb8dedf846..eeec47153937 100644 --- a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/5-AST-Alignment-AST.shot @@ -15,7 +15,6 @@ Snapshot Diff: - members: Array [ - TSEnumMember { - type: 'TSEnumMember', -- computed: false, - id: Identifier { - type: 'Identifier', - decorators: Array [], diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/entity-name-invalid/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/entity-name-invalid/snapshots/2-Babel-Error.shot index 617513c26619..44149a67c407 100644 --- a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/entity-name-invalid/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/entity-name-invalid/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > TSImportEqualsDeclaration > _error_ > entity-name-invalid > Babel - Error`] -SyntaxError: Unexpected token (1:11) +BabelError +> 1 | import F = 1; + | ^ Unexpected token (1:11) + 2 | + diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/external-module-ref-non-string-2/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/external-module-ref-non-string-2/snapshots/2-Babel-Error.shot index 8df50b7d4c15..bf2fbca1e9ff 100644 --- a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/external-module-ref-non-string-2/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/external-module-ref-non-string-2/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > TSImportEqualsDeclaration > _error_ > external-module-ref-non-string-2 > Babel - Error`] -SyntaxError: Unexpected token (1:19) +BabelError +> 1 | import F = require(1 + 1); + | ^ Unexpected token (1:19) + 2 | + diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/external-module-ref-non-string-3/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/external-module-ref-non-string-3/snapshots/2-Babel-Error.shot index 9bf1d048bb0e..fa619f841cad 100644 --- a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/external-module-ref-non-string-3/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/external-module-ref-non-string-3/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > TSImportEqualsDeclaration > _error_ > external-module-ref-non-string-3 > Babel - Error`] -SyntaxError: Unexpected token (1:19) +BabelError +> 1 | import F = require(`1`); + | ^ Unexpected token (1:19) + 2 | + diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/external-module-ref-non-string/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/external-module-ref-non-string/snapshots/2-Babel-Error.shot index d38a4d68b8cc..936a12f12e14 100644 --- a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/external-module-ref-non-string/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/external-module-ref-non-string/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > TSImportEqualsDeclaration > _error_ > external-module-ref-non-string > Babel - Error`] -SyntaxError: Unexpected token (1:19) +BabelError +> 1 | import F = require(1); + | ^ Unexpected token (1:19) + 2 | + diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/import-kind/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/import-kind/snapshots/2-Babel-Error.shot index 9421f645d99f..2423a59ece17 100644 --- a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/import-kind/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/import-kind/snapshots/2-Babel-Error.shot @@ -1,4 +1,9 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > TSImportEqualsDeclaration > _error_ > import-kind > Babel - Error`] -SyntaxError: An import alias can not use 'import type'. (2:16) +BabelError + 1 | type T = 1; +> 2 | import type F = T; + | ^ An import alias can not use 'import type'. (2:16) + 3 | + diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/missing-id/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/missing-id/snapshots/2-Babel-Error.shot index 4d8cd7ddc0cd..555339c64c79 100644 --- a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/missing-id/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/missing-id/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > TSImportEqualsDeclaration > _error_ > missing-id > Babel - Error`] -SyntaxError: Unexpected token, expected "{" (1:7) +BabelError +> 1 | import = A.B; + | ^ Unexpected token, expected "{" (1:7) + 2 | + diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/missing-reference/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/missing-reference/snapshots/2-Babel-Error.shot index 1b7acc81492b..dda3416a1214 100644 --- a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/missing-reference/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/missing-reference/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > TSImportEqualsDeclaration > _error_ > missing-reference > Babel - Error`] -SyntaxError: Unexpected token, expected "from" (1:8) +BabelError +> 1 | import F; + | ^ Unexpected token, expected "from" (1:8) + 2 | + diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/decorator/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/decorator/snapshots/2-Babel-Error.shot index 9713e325ea24..d628e241dec7 100644 --- a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/decorator/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/decorator/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > TSInterfaceDeclaration > _error_ > decorator > Babel - Error`] -SyntaxError: Leading decorators must be attached to a class declaration. (1:6) +BabelError +> 1 | @decl interface Test {} + | ^ Leading decorators must be attached to a class declaration. (1:6) + 2 | + diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-body/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-body/snapshots/2-Babel-Error.shot index e53fa56c6786..eb2cf802539b 100644 --- a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-body/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-body/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > TSInterfaceDeclaration > _error_ > missing-body > Babel - Error`] -SyntaxError: Unexpected token, expected "{" (1:11) +BabelError +> 1 | interface F; + | ^ Unexpected token, expected "{" (1:11) + 2 | + diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-extends/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-extends/snapshots/2-Babel-Error.shot index aebcf3e06ed4..d07294c49c41 100644 --- a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-extends/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-extends/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > TSInterfaceDeclaration > _error_ > missing-extends > Babel - Error`] -SyntaxError: 'extends' list cannot be empty. (1:20) +BabelError +> 1 | interface F extends {} + | ^ 'extends' list cannot be empty. (1:20) + 2 | + diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-id/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-id/snapshots/2-Babel-Error.shot index d6516a5c585d..311305cc57af 100644 --- a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-id/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-id/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > TSInterfaceDeclaration > _error_ > missing-id > Babel - Error`] -SyntaxError: 'interface' declarations must be followed by an identifier. (1:10) +BabelError +> 1 | interface {} + | ^ 'interface' declarations must be followed by an identifier. (1:10) + 2 | + diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-type-param/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-type-param/snapshots/1-TSESTree-Error.shot index 894a7a320645..906a02b805dc 100644 --- a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-type-param/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-type-param/snapshots/1-TSESTree-Error.shot @@ -1,4 +1,7 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > TSInterfaceDeclaration > _error_ > missing-type-param > TSESTree - Error`] -NO ERROR +TSError +> 1 | interface F<> {} + | ^^ Type parameter list cannot be empty. + 2 | diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-type-param/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-type-param/snapshots/2-Babel-Error.shot index 456d9b250c57..22e5cae199c7 100644 --- a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-type-param/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-type-param/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > TSInterfaceDeclaration > _error_ > missing-type-param > Babel - Error`] -SyntaxError: Type parameter list cannot be empty. (1:11) +BabelError +> 1 | interface F<> {} + | ^ Type parameter list cannot be empty. (1:11) + 2 | + diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-type-param/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-type-param/snapshots/3-Alignment-Error.shot index 79866f6f1284..59f909d1ef4f 100644 --- a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-type-param/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-type-param/snapshots/3-Alignment-Error.shot @@ -1,4 +1,4 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > TSInterfaceDeclaration > _error_ > missing-type-param > Error Alignment`] -Babel errored but TSESTree didn't +Both errored diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-extends/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-extends/snapshots/1-TSESTree-Error.shot index 3192c89d0208..70781ef9b372 100644 --- a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-extends/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-extends/snapshots/1-TSESTree-Error.shot @@ -1,4 +1,7 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > TSInterfaceDeclaration > _error_ > non-identifier-extends > TSESTree - Error`] -NO ERROR +TSError +> 1 | interface F extends 1 {} + | ^ Interface declaration can only extend an identifier/qualified name with optional type arguments. + 2 | diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-extends/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-extends/snapshots/2-Babel-Error.shot index b62fbf292fa0..65b6f8b67aed 100644 --- a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-extends/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-extends/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > TSInterfaceDeclaration > _error_ > non-identifier-extends > Babel - Error`] -SyntaxError: Unexpected token (1:20) +BabelError +> 1 | interface F extends 1 {} + | ^ Unexpected token (1:20) + 2 | + diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-extends/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-extends/snapshots/3-Alignment-Error.shot index 8b8a05459c4b..a0844838800f 100644 --- a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-extends/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-extends/snapshots/3-Alignment-Error.shot @@ -1,4 +1,4 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > TSInterfaceDeclaration > _error_ > non-identifier-extends > Error Alignment`] -Babel errored but TSESTree didn't +Both errored diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Babel-Error.shot index 5daa78ba69de..c9df50bbff86 100644 --- a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > TSInterfaceDeclaration > _error_ > non-identifier-name > Babel - Error`] -SyntaxError: 'interface' declarations must be followed by an identifier. (1:10) +BabelError +> 1 | interface 1 {} + | ^ 'interface' declarations must be followed by an identifier. (1:10) + 2 | + diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/2-Babel-Error.shot index 03d74ec17daa..1c7e4398f35a 100644 --- a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > TSInterfaceDeclaration > _error_ > non-identifier-type-param > Babel - Error`] -SyntaxError: Unexpected token (1:12) +BabelError +> 1 | interface F<1> {} + | ^ Unexpected token (1:12) + 2 | + diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/module-invalid-id/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/module-invalid-id/snapshots/2-Babel-Error.shot index 16fe0276b649..9a4e17520361 100644 --- a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/module-invalid-id/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/module-invalid-id/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > TSModuleDeclaration > _error_ > module-invalid-id > Babel - Error`] -SyntaxError: Missing semicolon. (1:6) +BabelError +> 1 | module 1 {} + | ^ Missing semicolon. (1:6) + 2 | + diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/module-missing-body/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/module-missing-body/snapshots/2-Babel-Error.shot index 9a5f13dad8e9..3c09b48c89e4 100644 --- a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/module-missing-body/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/module-missing-body/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > TSModuleDeclaration > _error_ > module-missing-body > Babel - Error`] -SyntaxError: Unexpected token, expected "{" (1:8) +BabelError +> 1 | module F; + | ^ Unexpected token, expected "{" (1:8) + 2 | + diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-declare-no-body/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-declare-no-body/snapshots/2-Babel-Error.shot index 38f3cc629b93..44e80efd9d15 100644 --- a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-declare-no-body/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-declare-no-body/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > TSModuleDeclaration > _error_ > namespace-declare-no-body > Babel - Error`] -SyntaxError: Unexpected token, expected "{" (1:19) +BabelError +> 1 | declare namespace F; + | ^ Unexpected token, expected "{" (1:19) + 2 | + diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-id-literal/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-id-literal/snapshots/2-Babel-Error.shot index 542fe6e7fcf6..77e6d42ec05f 100644 --- a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-id-literal/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-id-literal/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > TSModuleDeclaration > _error_ > namespace-id-literal > Babel - Error`] -SyntaxError: Missing semicolon. (1:9) +BabelError +> 1 | namespace 'a' {} + | ^ Missing semicolon. (1:9) + 2 | + diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-invalid-id/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-invalid-id/snapshots/2-Babel-Error.shot index 699035689429..f570ef75b13d 100644 --- a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-invalid-id/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-invalid-id/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > TSModuleDeclaration > _error_ > namespace-invalid-id > Babel - Error`] -SyntaxError: Missing semicolon. (1:9) +BabelError +> 1 | namespace 1 {} + | ^ Missing semicolon. (1:9) + 2 | + diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-no-body/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-no-body/snapshots/2-Babel-Error.shot index 516bca2e2d70..9eaea9131b54 100644 --- a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-no-body/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-no-body/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > TSModuleDeclaration > _error_ > namespace-no-body > Babel - Error`] -SyntaxError: Unexpected token, expected "{" (1:11) +BabelError +> 1 | namespace F; + | ^ Unexpected token, expected "{" (1:11) + 2 | + diff --git a/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/_error_/missing-id/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/_error_/missing-id/snapshots/2-Babel-Error.shot index 95f461ed4516..af94e2dca261 100644 --- a/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/_error_/missing-id/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/_error_/missing-id/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > TSNamespaceExportDeclaration > _error_ > missing-id > Babel - Error`] -SyntaxError: Unexpected token (1:19) +BabelError +> 1 | export as namespace; + | ^ Unexpected token (1:19) + 2 | + diff --git a/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Babel-Error.shot index ce1d4566a724..2604d4552462 100644 --- a/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > TSNamespaceExportDeclaration > _error_ > non-identifier-name > Babel - Error`] -SyntaxError: Unexpected token (1:20) +BabelError +> 1 | export as namespace 1; + | ^ Unexpected token (1:20) + 2 | + diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/decorator/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/decorator/snapshots/2-Babel-Error.shot index 726aeb6d7ce3..bd3effe3de20 100644 --- a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/decorator/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/decorator/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > TSTypeAliasDeclaration > _error_ > decorator > Babel - Error`] -SyntaxError: Leading decorators must be attached to a class declaration. (1:6) +BabelError +> 1 | @decl type Test = {}; + | ^ Leading decorators must be attached to a class declaration. (1:6) + 2 | + diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/missing-type-parameter/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/missing-type-parameter/snapshots/1-TSESTree-Error.shot index aa1e2269c016..c09a3a767483 100644 --- a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/missing-type-parameter/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/missing-type-parameter/snapshots/1-TSESTree-Error.shot @@ -1,4 +1,7 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > TSTypeAliasDeclaration > _error_ > missing-type-parameter > TSESTree - Error`] -NO ERROR +TSError +> 1 | type T<> = 1; + | ^^ Type parameter list cannot be empty. + 2 | diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/missing-type-parameter/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/missing-type-parameter/snapshots/2-Babel-Error.shot index 1f660ee4bb9e..0aa1adadcafb 100644 --- a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/missing-type-parameter/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/missing-type-parameter/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > TSTypeAliasDeclaration > _error_ > missing-type-parameter > Babel - Error`] -SyntaxError: Type parameter list cannot be empty. (1:6) +BabelError +> 1 | type T<> = 1; + | ^ Type parameter list cannot be empty. (1:6) + 2 | + diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/missing-type-parameter/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/missing-type-parameter/snapshots/3-Alignment-Error.shot index a4210c2854d7..513e0d5efdee 100644 --- a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/missing-type-parameter/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/missing-type-parameter/snapshots/3-Alignment-Error.shot @@ -1,4 +1,4 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > TSTypeAliasDeclaration > _error_ > missing-type-parameter > Error Alignment`] -Babel errored but TSESTree didn't +Both errored diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Babel-Error.shot index 4cad91910783..fe78642818bf 100644 --- a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > TSTypeAliasDeclaration > _error_ > non-identifier-name > Babel - Error`] -SyntaxError: Missing semicolon. (1:4) +BabelError +> 1 | type 1 = 2; + | ^ Missing semicolon. (1:4) + 2 | + diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/non-identifier-type-parameter/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/non-identifier-type-parameter/snapshots/2-Babel-Error.shot index f0022623ea80..bcf3c74735a2 100644 --- a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/non-identifier-type-parameter/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/non-identifier-type-parameter/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > TSTypeAliasDeclaration > _error_ > non-identifier-type-parameter > Babel - Error`] -SyntaxError: Unexpected token (1:7) +BabelError +> 1 | type T<1> = 2; + | ^ Unexpected token (1:7) + 2 | + diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-destructure-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-destructure-no-init/snapshots/2-Babel-Error.shot index 63d96fa8f413..c96b185741e0 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-destructure-no-init/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-destructure-no-init/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > VariableDeclaration > _error_ > const-destructure-no-init > Babel - Error`] -SyntaxError: Missing initializer in destructuring declaration. (1:13) +BabelError +> 1 | const { foo }; + | ^ Missing initializer in destructuring declaration. (1:13) + 2 | + diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-destructure-type-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-destructure-type-no-init/snapshots/2-Babel-Error.shot index f19c9134851b..f6c5fb6e9694 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-destructure-type-no-init/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-destructure-type-no-init/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > VariableDeclaration > _error_ > const-destructure-type-no-init > Babel - Error`] -SyntaxError: Missing initializer in destructuring declaration. (1:18) +BabelError +> 1 | const { foo }: any; + | ^ Missing initializer in destructuring declaration. (1:18) + 2 | + diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-no-init/snapshots/2-Babel-Error.shot index fbaf6994db12..0bdc8232084c 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-no-init/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-no-init/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > VariableDeclaration > _error_ > const-id-definite-no-init > Babel - Error`] -SyntaxError: Missing initializer in const declaration. (1:10) +BabelError +> 1 | const foo!; + | ^ Missing initializer in const declaration. (1:10) + 2 | + diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-type-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-type-no-init/snapshots/2-Babel-Error.shot index d6d04284fdb0..3a6191ee1fd1 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-type-no-init/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-type-no-init/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > VariableDeclaration > _error_ > const-id-definite-type-no-init > Babel - Error`] -SyntaxError: Missing initializer in const declaration. (1:15) +BabelError +> 1 | const foo!: any; + | ^ Missing initializer in const declaration. (1:15) + 2 | + diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-no-init/snapshots/2-Babel-Error.shot index 4778736de1c9..b6caba1e3a80 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-no-init/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-no-init/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > VariableDeclaration > _error_ > const-id-no-init > Babel - Error`] -SyntaxError: Missing initializer in const declaration. (1:9) +BabelError +> 1 | const foo; + | ^ Missing initializer in const declaration. (1:9) + 2 | + diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-type-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-type-no-init/snapshots/2-Babel-Error.shot index b114ab299fee..eb6f8b5c4c0c 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-type-no-init/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-type-no-init/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > VariableDeclaration > _error_ > const-id-type-no-init > Babel - Error`] -SyntaxError: Missing initializer in const declaration. (1:14) +BabelError +> 1 | const foo: any; + | ^ Missing initializer in const declaration. (1:14) + 2 | + diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-destructure-type-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-destructure-type-init/snapshots/2-Babel-Error.shot index a4077cb77749..5adb20d1948b 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-destructure-type-init/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-destructure-type-init/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > VariableDeclaration > _error_ > declare-const-destructure-type-init > Babel - Error`] -SyntaxError: Initializers are not allowed in ambient contexts. (1:29) +BabelError +> 1 | declare const { foo }: any = 1; + | ^ Initializers are not allowed in ambient contexts. (1:29) + 2 | + diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-type-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-type-init/snapshots/2-Babel-Error.shot index 97938c07e956..714b75ab5786 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-type-init/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-type-init/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > VariableDeclaration > _error_ > declare-const-id-definite-type-init > Babel - Error`] -SyntaxError: Initializers are not allowed in ambient contexts. (1:26) +BabelError +> 1 | declare const foo!: any = 1; + | ^ Initializers are not allowed in ambient contexts. (1:26) + 2 | + diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-type-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-type-init/snapshots/2-Babel-Error.shot index 6527f12080d1..a8c480413692 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-type-init/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-type-init/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > VariableDeclaration > _error_ > declare-const-id-type-init > Babel - Error`] -SyntaxError: Initializers are not allowed in ambient contexts. (1:25) +BabelError +> 1 | declare const foo: any = 1; + | ^ Initializers are not allowed in ambient contexts. (1:25) + 2 | + diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-destructure-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-destructure-init/snapshots/2-Babel-Error.shot index c602f4cb545e..61ea7c4c9b4f 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-destructure-init/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-destructure-init/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > VariableDeclaration > _error_ > declare-let-destructure-init > Babel - Error`] -SyntaxError: Initializers are not allowed in ambient contexts. (1:22) +BabelError +> 1 | declare let { foo } = 1; + | ^ Initializers are not allowed in ambient contexts. (1:22) + 2 | + diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-destructure-type-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-destructure-type-init/snapshots/2-Babel-Error.shot index ea40786b38d6..db2c7091e208 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-destructure-type-init/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-destructure-type-init/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > VariableDeclaration > _error_ > declare-let-destructure-type-init > Babel - Error`] -SyntaxError: Initializers are not allowed in ambient contexts. (1:27) +BabelError +> 1 | declare let { foo }: any = 1; + | ^ Initializers are not allowed in ambient contexts. (1:27) + 2 | + diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-init/snapshots/2-Babel-Error.shot index 1a4d52e5efb7..7dcf5ae87a8e 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-init/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-init/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > VariableDeclaration > _error_ > declare-let-id-definite-init > Babel - Error`] -SyntaxError: Initializers are not allowed in ambient contexts. (1:19) +BabelError +> 1 | declare let foo! = 1; + | ^ Initializers are not allowed in ambient contexts. (1:19) + 2 | + diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-type-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-type-init/snapshots/2-Babel-Error.shot index 2799404577f1..bb42e1891168 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-type-init/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-type-init/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > VariableDeclaration > _error_ > declare-let-id-definite-type-init > Babel - Error`] -SyntaxError: Initializers are not allowed in ambient contexts. (1:24) +BabelError +> 1 | declare let foo!: any = 1; + | ^ Initializers are not allowed in ambient contexts. (1:24) + 2 | + diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-init/snapshots/2-Babel-Error.shot index 9d1e1a93cb3c..79d191b1fea9 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-init/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-init/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > VariableDeclaration > _error_ > declare-let-id-init > Babel - Error`] -SyntaxError: Initializers are not allowed in ambient contexts. (1:18) +BabelError +> 1 | declare let foo = 1; + | ^ Initializers are not allowed in ambient contexts. (1:18) + 2 | + diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-type-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-type-init/snapshots/2-Babel-Error.shot index 7d3b4dbacd1d..89f962475274 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-type-init/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-type-init/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > VariableDeclaration > _error_ > declare-let-id-type-init > Babel - Error`] -SyntaxError: Initializers are not allowed in ambient contexts. (1:23) +BabelError +> 1 | declare let foo: any = 1; + | ^ Initializers are not allowed in ambient contexts. (1:23) + 2 | + diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-init/snapshots/2-Babel-Error.shot index 512c30b84f78..929b7944477c 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-init/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-init/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > VariableDeclaration > _error_ > declare-using-destructure-init > Babel - Error`] -SyntaxError: Missing semicolon. (1:7) +BabelError +> 1 | declare using { foo } = 1; + | ^ Missing semicolon. (1:7) + 2 | + diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-no-init/snapshots/2-Babel-Error.shot index 7b5830248706..4997023f0aa4 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-no-init/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-no-init/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > VariableDeclaration > _error_ > declare-using-destructure-no-init > Babel - Error`] -SyntaxError: Missing semicolon. (1:7) +BabelError +> 1 | declare using { foo }; + | ^ Missing semicolon. (1:7) + 2 | + diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-type-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-type-init/snapshots/2-Babel-Error.shot index ef81adfc0b85..c2cecbb8104d 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-type-init/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-type-init/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > VariableDeclaration > _error_ > declare-using-destructure-type-init > Babel - Error`] -SyntaxError: Missing semicolon. (1:7) +BabelError +> 1 | declare using { foo }: any = 1; + | ^ Missing semicolon. (1:7) + 2 | + diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-type-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-type-no-init/snapshots/2-Babel-Error.shot index 2cf637689700..f80c5fc88016 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-type-no-init/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-type-no-init/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > VariableDeclaration > _error_ > declare-using-destructure-type-no-init > Babel - Error`] -SyntaxError: Missing semicolon. (1:7) +BabelError +> 1 | declare using { foo }: any; + | ^ Missing semicolon. (1:7) + 2 | + diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-init/snapshots/2-Babel-Error.shot index c95370820204..90a0b63510ca 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-init/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-init/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > VariableDeclaration > _error_ > declare-using-id-definite-init > Babel - Error`] -SyntaxError: Missing semicolon. (1:7) +BabelError +> 1 | declare using foo! = 1; + | ^ 'declare' modifier cannot appear on a using declaration. (1:8) + 2 | + diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-no-init/snapshots/2-Babel-Error.shot index 69bbfebd9e0d..969cf36c0bbf 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-no-init/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-no-init/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > VariableDeclaration > _error_ > declare-using-id-definite-no-init > Babel - Error`] -SyntaxError: Missing semicolon. (1:7) +BabelError +> 1 | declare using foo!; + | ^ 'declare' modifier cannot appear on a using declaration. (1:8) + 2 | + diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-type-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-type-init/snapshots/2-Babel-Error.shot index d109f14d40f9..8260ff32d2ca 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-type-init/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-type-init/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > VariableDeclaration > _error_ > declare-using-id-definite-type-init > Babel - Error`] -SyntaxError: Missing semicolon. (1:7) +BabelError +> 1 | declare using foo!: any = 1; + | ^ 'declare' modifier cannot appear on a using declaration. (1:8) + 2 | + diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-type-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-type-no-init/snapshots/2-Babel-Error.shot index d41036eea117..02a7a6964314 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-type-no-init/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-type-no-init/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > VariableDeclaration > _error_ > declare-using-id-definite-type-no-init > Babel - Error`] -SyntaxError: Missing semicolon. (1:7) +BabelError +> 1 | declare using foo!: any; + | ^ 'declare' modifier cannot appear on a using declaration. (1:8) + 2 | + diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-init/snapshots/2-Babel-Error.shot index 9ffd885b9fb3..97094e711350 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-init/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-init/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > VariableDeclaration > _error_ > declare-using-id-init > Babel - Error`] -SyntaxError: Missing semicolon. (1:7) +BabelError +> 1 | declare using foo = 1; + | ^ 'declare' modifier cannot appear on a using declaration. (1:8) + 2 | + diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-no-init/snapshots/2-Babel-Error.shot index 50648d64ba1d..a8442943b6d0 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-no-init/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-no-init/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > VariableDeclaration > _error_ > declare-using-id-no-init > Babel - Error`] -SyntaxError: Missing semicolon. (1:7) +BabelError +> 1 | declare using foo; + | ^ 'declare' modifier cannot appear on a using declaration. (1:8) + 2 | + diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-type-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-type-init/snapshots/2-Babel-Error.shot index ccdb04651388..35ddd9daf071 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-type-init/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-type-init/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > VariableDeclaration > _error_ > declare-using-id-type-init > Babel - Error`] -SyntaxError: Missing semicolon. (1:7) +BabelError +> 1 | declare using foo: any = 1; + | ^ 'declare' modifier cannot appear on a using declaration. (1:8) + 2 | + diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-type-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-type-no-init/snapshots/2-Babel-Error.shot index a605c534f9f6..420a6845fbf9 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-type-no-init/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-type-no-init/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > VariableDeclaration > _error_ > declare-using-id-type-no-init > Babel - Error`] -SyntaxError: Missing semicolon. (1:7) +BabelError +> 1 | declare using foo: any; + | ^ 'declare' modifier cannot appear on a using declaration. (1:8) + 2 | + diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-destructure-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-destructure-init/snapshots/2-Babel-Error.shot index b81a030fdae0..6cf7effbdbfb 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-destructure-init/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-destructure-init/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > VariableDeclaration > _error_ > declare-var-destructure-init > Babel - Error`] -SyntaxError: Initializers are not allowed in ambient contexts. (1:22) +BabelError +> 1 | declare var { foo } = 1; + | ^ Initializers are not allowed in ambient contexts. (1:22) + 2 | + diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-destructure-type-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-destructure-type-init/snapshots/2-Babel-Error.shot index c716f5ee6e62..c5883210e4e9 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-destructure-type-init/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-destructure-type-init/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > VariableDeclaration > _error_ > declare-var-destructure-type-init > Babel - Error`] -SyntaxError: Initializers are not allowed in ambient contexts. (1:27) +BabelError +> 1 | declare var { foo }: any = 1; + | ^ Initializers are not allowed in ambient contexts. (1:27) + 2 | + diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-init/snapshots/2-Babel-Error.shot index 5599c8a79783..26b7602ac1d5 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-init/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-init/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > VariableDeclaration > _error_ > declare-var-id-definite-init > Babel - Error`] -SyntaxError: Initializers are not allowed in ambient contexts. (1:19) +BabelError +> 1 | declare var foo! = 1; + | ^ Initializers are not allowed in ambient contexts. (1:19) + 2 | + diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-type-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-type-init/snapshots/2-Babel-Error.shot index 4c73b29511d3..9b0332014fc4 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-type-init/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-type-init/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > VariableDeclaration > _error_ > declare-var-id-definite-type-init > Babel - Error`] -SyntaxError: Initializers are not allowed in ambient contexts. (1:24) +BabelError +> 1 | declare var foo!: any = 1; + | ^ Initializers are not allowed in ambient contexts. (1:24) + 2 | + diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-init/snapshots/2-Babel-Error.shot index 7c80c93c3a1d..d23db1eb32cf 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-init/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-init/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > VariableDeclaration > _error_ > declare-var-id-init > Babel - Error`] -SyntaxError: Initializers are not allowed in ambient contexts. (1:18) +BabelError +> 1 | declare var foo = 1; + | ^ Initializers are not allowed in ambient contexts. (1:18) + 2 | + diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-type-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-type-init/snapshots/2-Babel-Error.shot index 0eece7d22e74..c50e75b93a0e 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-type-init/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-type-init/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > VariableDeclaration > _error_ > declare-var-id-type-init > Babel - Error`] -SyntaxError: Initializers are not allowed in ambient contexts. (1:23) +BabelError +> 1 | declare var foo: any = 1; + | ^ Initializers are not allowed in ambient contexts. (1:23) + 2 | + diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/decorator/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/decorator/snapshots/2-Babel-Error.shot index ee1c40040dbb..70ea5eb9260e 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/decorator/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/decorator/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > VariableDeclaration > _error_ > decorator > Babel - Error`] -SyntaxError: Leading decorators must be attached to a class declaration. (1:6) +BabelError +> 1 | @decl type Test = {}; + | ^ Leading decorators must be attached to a class declaration. (1:6) + 2 | + diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-destructure-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-destructure-no-init/snapshots/2-Babel-Error.shot index d3dbedec0c5e..1118f9cce9a0 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-destructure-no-init/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-destructure-no-init/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > VariableDeclaration > _error_ > let-destructure-no-init > Babel - Error`] -SyntaxError: Missing initializer in destructuring declaration. (1:11) +BabelError +> 1 | let { foo }; + | ^ Missing initializer in destructuring declaration. (1:11) + 2 | + diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-destructure-type-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-destructure-type-no-init/snapshots/2-Babel-Error.shot index 90a0241d8eec..eac75eb96185 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-destructure-type-no-init/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-destructure-type-no-init/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > VariableDeclaration > _error_ > let-destructure-type-no-init > Babel - Error`] -SyntaxError: Missing initializer in destructuring declaration. (1:16) +BabelError +> 1 | let { foo }: any; + | ^ Missing initializer in destructuring declaration. (1:16) + 2 | + diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-with-value/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-with-value/snapshots/2-Babel-Error.shot index 2f8edbf36213..6217ca96ac49 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-with-value/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-with-value/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > VariableDeclaration > _error_ > missing-id-with-value > Babel - Error`] -SyntaxError: Unexpected token (1:6) +BabelError +> 1 | const = 1; + | ^ Unexpected token (1:6) + 2 | + diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/no-variables/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/no-variables/snapshots/2-Babel-Error.shot index 7be36c3bbd62..d58c5400eebf 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/no-variables/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/no-variables/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > VariableDeclaration > _error_ > no-variables > Babel - Error`] -SyntaxError: Unexpected token (1:5) +BabelError +> 1 | const; + | ^ Unexpected token (1:5) + 2 | + diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-init/snapshots/2-Babel-Error.shot index 3c5579d38485..a557bde70a73 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-init/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-init/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > VariableDeclaration > _error_ > using-destructure-init > Babel - Error`] -SyntaxError: Using declaration cannot have destructuring patterns. (1:6) +BabelError +> 1 | using { foo } = 1; + | ^ Using declaration cannot have destructuring patterns. (1:6) + 2 | + diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-no-init/snapshots/2-Babel-Error.shot index 9c6a4fd029be..8f9f395f5be7 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-no-init/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-no-init/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > VariableDeclaration > _error_ > using-destructure-no-init > Babel - Error`] -SyntaxError: Using declaration cannot have destructuring patterns. (1:6) +BabelError +> 1 | using { foo }; + | ^ Using declaration cannot have destructuring patterns. (1:6) + 2 | + diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-type-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-type-init/snapshots/2-Babel-Error.shot index 11639dfd0961..4bfa641b372d 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-type-init/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-type-init/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > VariableDeclaration > _error_ > using-destructure-type-init > Babel - Error`] -SyntaxError: Using declaration cannot have destructuring patterns. (1:6) +BabelError +> 1 | using { foo }: any = 1; + | ^ Using declaration cannot have destructuring patterns. (1:6) + 2 | + diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-type-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-type-no-init/snapshots/2-Babel-Error.shot index 2843f96cd215..5172befcf8ec 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-type-no-init/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-type-no-init/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > VariableDeclaration > _error_ > using-destructure-type-no-init > Babel - Error`] -SyntaxError: Using declaration cannot have destructuring patterns. (1:6) +BabelError +> 1 | using { foo }: any; + | ^ Using declaration cannot have destructuring patterns. (1:6) + 2 | + diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-no-init/snapshots/2-Babel-Error.shot index 8d285d2c268d..65f7136c6dd4 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-no-init/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-no-init/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > VariableDeclaration > _error_ > using-id-definite-no-init > Babel - Error`] -SyntaxError: Missing initializer in using declaration. (1:10) +BabelError +> 1 | using foo!; + | ^ Missing initializer in using declaration. (1:10) + 2 | + diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-type-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-type-no-init/snapshots/2-Babel-Error.shot index e9809e204145..4abda6a53640 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-type-no-init/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-type-no-init/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > VariableDeclaration > _error_ > using-id-definite-type-no-init > Babel - Error`] -SyntaxError: Missing initializer in using declaration. (1:15) +BabelError +> 1 | using foo!: any; + | ^ Missing initializer in using declaration. (1:15) + 2 | + diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-no-init/snapshots/2-Babel-Error.shot index 25a73d34c442..491e41264099 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-no-init/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-no-init/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > VariableDeclaration > _error_ > using-id-no-init > Babel - Error`] -SyntaxError: Missing initializer in using declaration. (1:9) +BabelError +> 1 | using foo; + | ^ Missing initializer in using declaration. (1:9) + 2 | + diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-type-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-type-no-init/snapshots/2-Babel-Error.shot index 269b21209e25..07af234b3468 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-type-no-init/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-type-no-init/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > VariableDeclaration > _error_ > using-id-type-no-init > Babel - Error`] -SyntaxError: Missing initializer in using declaration. (1:14) +BabelError +> 1 | using foo: any; + | ^ Missing initializer in using declaration. (1:14) + 2 | + diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-destructure-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-destructure-no-init/snapshots/2-Babel-Error.shot index e8b80abcf677..00f7eed3ebd2 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-destructure-no-init/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-destructure-no-init/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > VariableDeclaration > _error_ > var-destructure-no-init > Babel - Error`] -SyntaxError: Missing initializer in destructuring declaration. (1:11) +BabelError +> 1 | var { foo }; + | ^ Missing initializer in destructuring declaration. (1:11) + 2 | + diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-destructure-type-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-destructure-type-no-init/snapshots/2-Babel-Error.shot index 28b00d00ddee..9b74a4b499ec 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-destructure-type-no-init/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-destructure-type-no-init/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > declaration > VariableDeclaration > _error_ > var-destructure-type-no-init > Babel - Error`] -SyntaxError: Missing initializer in destructuring declaration. (1:16) +BabelError +> 1 | var { foo }: any; + | ^ Missing initializer in destructuring declaration. (1:16) + 2 | + diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-no-init/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-no-init/snapshots/4-Babel-Tokens.shot index 1e8aedb5a757..89f263da8a91 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-no-init/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-no-init/snapshots/4-Babel-Tokens.shot @@ -9,8 +9,8 @@ end: { column: 7, line: 1 }, }, }, - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [8, 11], diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-type-no-init/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-type-no-init/snapshots/4-Babel-Tokens.shot index de560945193b..e237405b6f8f 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-type-no-init/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-type-no-init/snapshots/4-Babel-Tokens.shot @@ -9,8 +9,8 @@ end: { column: 7, line: 1 }, }, }, - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [8, 11], diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-no-init/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-no-init/snapshots/4-Babel-Tokens.shot index b7868b340a2c..d946b523b795 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-no-init/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-no-init/snapshots/4-Babel-Tokens.shot @@ -9,8 +9,8 @@ end: { column: 7, line: 1 }, }, }, - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [8, 11], diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-type-no-init/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-type-no-init/snapshots/4-Babel-Tokens.shot index f25ebacc499a..802d9e8f933e 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-type-no-init/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-type-no-init/snapshots/4-Babel-Tokens.shot @@ -9,8 +9,8 @@ end: { column: 7, line: 1 }, }, }, - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [8, 11], diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-init/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-init/snapshots/4-Babel-Tokens.shot index f7b059c3e53e..370c22201c27 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-init/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-init/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ [ - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [0, 3], diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-type-init/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-type-init/snapshots/4-Babel-Tokens.shot index 8eb9db558757..fb2de915e0e2 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-type-init/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-type-init/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ [ - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [0, 3], diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-definite-type-no-init/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-definite-type-no-init/snapshots/4-Babel-Tokens.shot index 04367dd27c4f..858d88120216 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-definite-type-no-init/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-definite-type-no-init/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ [ - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [0, 3], diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-init/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-init/snapshots/4-Babel-Tokens.shot index ef80cf7131ed..c43ae8ec6cec 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-init/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-init/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ [ - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [0, 3], diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-no-init/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-no-init/snapshots/4-Babel-Tokens.shot index b6a6248914c3..b3be12441d9c 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-no-init/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-no-init/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ [ - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [0, 3], diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-init/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-init/snapshots/4-Babel-Tokens.shot index 447584b158d1..a7e85c35fe66 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-init/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-init/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ [ - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [0, 3], diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-no-init/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-no-init/snapshots/4-Babel-Tokens.shot index 5c5508c4addd..d978035e4a7c 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-no-init/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-no-init/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ [ - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [0, 3], diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/multiple-declarations/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/multiple-declarations/snapshots/4-Babel-Tokens.shot index 79072bfc8258..d08e8a6769b2 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/multiple-declarations/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/multiple-declarations/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ [ - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [0, 3], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string-escaped/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string-escaped/fixture.ts new file mode 100644 index 000000000000..bbf0ef59cee9 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string-escaped/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + accessor 'construct\u{6f}r' +} diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string-escaped/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string-escaped/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..bb514364efe2 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string-escaped/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,9 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > AccessorProperty > _error_ > key-constructor-string-escaped > TSESTree - Error`] +TSError + 1 | class Foo { +> 2 | accessor 'construct\u{6f}r' + | ^^^^^^^^^^^^^^^^^^ Classes may not have a field named 'constructor'. + 3 | } + 4 | diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string-escaped/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string-escaped/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..056333536528 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string-escaped/snapshots/2-Babel-Error.shot @@ -0,0 +1,10 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > AccessorProperty > _error_ > key-constructor-string-escaped > Babel - Error`] +BabelError + 1 | class Foo { +> 2 | accessor 'construct\u{6f}r' + | ^ Classes may not have a field named 'constructor'. (2:11) + 3 | } + 4 | + diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string-escaped/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string-escaped/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..1b975851c82a --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string-escaped/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > AccessorProperty > _error_ > key-constructor-string-escaped > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string/fixture.ts new file mode 100644 index 000000000000..15b65f9026f1 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + accessor 'constructor' +} diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..99225f26fe0f --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,9 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > AccessorProperty > _error_ > key-constructor-string > TSESTree - Error`] +TSError + 1 | class Foo { +> 2 | accessor 'constructor' + | ^^^^^^^^^^^^^ Classes may not have a field named 'constructor'. + 3 | } + 4 | diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..bb359842fe1e --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string/snapshots/2-Babel-Error.shot @@ -0,0 +1,10 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > AccessorProperty > _error_ > key-constructor-string > Babel - Error`] +BabelError + 1 | class Foo { +> 2 | accessor 'constructor' + | ^ Classes may not have a field named 'constructor'. (2:11) + 3 | } + 4 | + diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..d6b1cda3e19b --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > AccessorProperty > _error_ > key-constructor-string > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/2-Babel-Error.shot index af9f804ebc24..b099dd074fa8 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/2-Babel-Error.shot @@ -1,4 +1,10 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > element > AccessorProperty > _error_ > modifier-abstract-property-with-value > Babel - Error`] -SyntaxError: Property 'property' cannot have an initializer because it is marked abstract. (2:20) +BabelError + 1 | abstract class Foo { +> 2 | abstract property = 1; + | ^ Property 'property' cannot have an initializer because it is marked abstract. (2:20) + 3 | } + 4 | + diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/snapshots/2-Babel-Error.shot index 9efd284b0d93..848b03e5c5b9 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/snapshots/2-Babel-Error.shot @@ -1,4 +1,10 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > element > AccessorProperty > _error_ > modifier-override-with-no-extends > Babel - Error`] -SyntaxError: This member cannot have an 'override' modifier because its containing class does not extend another class. (2:2) +BabelError + 1 | class Foo { +> 2 | override accessor foo = 2; + | ^ This member cannot have an 'override' modifier because its containing class does not extend another class. (2:2) + 3 | } + 4 | + diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/fixture.ts new file mode 100644 index 000000000000..176558f7f971 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + accessor [constructor]; +} diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..0bd9d71a1338 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,79 @@ +Program { + type: "Program", + body: [ + ClassDeclaration { + type: "ClassDeclaration", + abstract: false, + body: ClassBody { + type: "ClassBody", + body: [ + AccessorProperty { + type: "AccessorProperty", + computed: true, + declare: false, + decorators: [], + definite: false, + key: Identifier { + type: "Identifier", + decorators: [], + name: "constructor", + optional: false, + + range: [24, 35], + loc: { + start: { column: 12, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + optional: false, + override: false, + readonly: false, + static: false, + value: null, + + range: [14, 37], + loc: { + start: { column: 2, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, + ], + + range: [10, 39], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + declare: false, + decorators: [], + id: Identifier { + type: "Identifier", + decorators: [], + name: "Foo", + optional: false, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + implements: [], + superClass: null, + + range: [0, 39], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 40], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} \ No newline at end of file diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..ced41a5029ae --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,92 @@ +[ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [14, 22], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [23, 24], + loc: { + start: { column: 11, line: 2 }, + end: { column: 12, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "constructor", + + range: [24, 35], + loc: { + start: { column: 12, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [35, 36], + loc: { + start: { column: 23, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [36, 37], + loc: { + start: { column: 24, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [38, 39], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] \ No newline at end of file diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..0bd9d71a1338 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/3-Babel-AST.shot @@ -0,0 +1,79 @@ +Program { + type: "Program", + body: [ + ClassDeclaration { + type: "ClassDeclaration", + abstract: false, + body: ClassBody { + type: "ClassBody", + body: [ + AccessorProperty { + type: "AccessorProperty", + computed: true, + declare: false, + decorators: [], + definite: false, + key: Identifier { + type: "Identifier", + decorators: [], + name: "constructor", + optional: false, + + range: [24, 35], + loc: { + start: { column: 12, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + optional: false, + override: false, + readonly: false, + static: false, + value: null, + + range: [14, 37], + loc: { + start: { column: 2, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, + ], + + range: [10, 39], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + declare: false, + decorators: [], + id: Identifier { + type: "Identifier", + decorators: [], + name: "Foo", + optional: false, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + implements: [], + superClass: null, + + range: [0, 39], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 40], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} \ No newline at end of file diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..ced41a5029ae --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,92 @@ +[ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [14, 22], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [23, 24], + loc: { + start: { column: 11, line: 2 }, + end: { column: 12, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "constructor", + + range: [24, 35], + loc: { + start: { column: 12, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [35, 36], + loc: { + start: { column: 23, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [36, 37], + loc: { + start: { column: 24, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [38, 39], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] \ No newline at end of file diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/fixture.ts new file mode 100644 index 000000000000..acc5cfe6398a --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + accessor ['constructor']; +} diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..5b9bbadd0d07 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,78 @@ +Program { + type: "Program", + body: [ + ClassDeclaration { + type: "ClassDeclaration", + abstract: false, + body: ClassBody { + type: "ClassBody", + body: [ + AccessorProperty { + type: "AccessorProperty", + computed: true, + declare: false, + decorators: [], + definite: false, + key: Literal { + type: "Literal", + raw: "'constructor'", + value: "constructor", + + range: [24, 37], + loc: { + start: { column: 12, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, + optional: false, + override: false, + readonly: false, + static: false, + value: null, + + range: [14, 39], + loc: { + start: { column: 2, line: 2 }, + end: { column: 27, line: 2 }, + }, + }, + ], + + range: [10, 41], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + declare: false, + decorators: [], + id: Identifier { + type: "Identifier", + decorators: [], + name: "Foo", + optional: false, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + implements: [], + superClass: null, + + range: [0, 41], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 42], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} \ No newline at end of file diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..30151a9636c9 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,92 @@ +[ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [14, 22], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [23, 24], + loc: { + start: { column: 11, line: 2 }, + end: { column: 12, line: 2 }, + }, + }, + String { + type: "String", + value: "'constructor'", + + range: [24, 37], + loc: { + start: { column: 12, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [37, 38], + loc: { + start: { column: 25, line: 2 }, + end: { column: 26, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [38, 39], + loc: { + start: { column: 26, line: 2 }, + end: { column: 27, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [40, 41], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] \ No newline at end of file diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..5b9bbadd0d07 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/snapshots/3-Babel-AST.shot @@ -0,0 +1,78 @@ +Program { + type: "Program", + body: [ + ClassDeclaration { + type: "ClassDeclaration", + abstract: false, + body: ClassBody { + type: "ClassBody", + body: [ + AccessorProperty { + type: "AccessorProperty", + computed: true, + declare: false, + decorators: [], + definite: false, + key: Literal { + type: "Literal", + raw: "'constructor'", + value: "constructor", + + range: [24, 37], + loc: { + start: { column: 12, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, + optional: false, + override: false, + readonly: false, + static: false, + value: null, + + range: [14, 39], + loc: { + start: { column: 2, line: 2 }, + end: { column: 27, line: 2 }, + }, + }, + ], + + range: [10, 41], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + declare: false, + decorators: [], + id: Identifier { + type: "Identifier", + decorators: [], + name: "Foo", + optional: false, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + implements: [], + superClass: null, + + range: [0, 41], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 42], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} \ No newline at end of file diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..30151a9636c9 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,92 @@ +[ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [14, 22], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [23, 24], + loc: { + start: { column: 11, line: 2 }, + end: { column: 12, line: 2 }, + }, + }, + String { + type: "String", + value: "'constructor'", + + range: [24, 37], + loc: { + start: { column: 12, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [37, 38], + loc: { + start: { column: 25, line: 2 }, + end: { column: 26, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [38, 39], + loc: { + start: { column: 26, line: 2 }, + end: { column: 27, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [40, 41], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] \ No newline at end of file diff --git a/packages/ast-spec/src/element/MethodDefinition/fixtures/_error_/duplicated-accessibility-modifiers/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/element/MethodDefinition/fixtures/_error_/duplicated-accessibility-modifiers/snapshots/2-Babel-Error.shot index e191f9064a5c..3243edaa376b 100644 --- a/packages/ast-spec/src/element/MethodDefinition/fixtures/_error_/duplicated-accessibility-modifiers/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/element/MethodDefinition/fixtures/_error_/duplicated-accessibility-modifiers/snapshots/2-Babel-Error.shot @@ -1,4 +1,10 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > element > MethodDefinition > _error_ > duplicated-accessibility-modifiers > Babel - Error`] -SyntaxError: Accessibility modifier already seen. (2:9) +BabelError + 1 | class Foo { +> 2 | public public bar() {}; + | ^ Accessibility modifier already seen: 'public'. (2:9) + 3 | } + 4 | + diff --git a/packages/ast-spec/src/element/MethodDefinition/fixtures/_error_/mixed-accessibility-modifiers/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/element/MethodDefinition/fixtures/_error_/mixed-accessibility-modifiers/snapshots/2-Babel-Error.shot index a29fa5ab09a0..013fb16531eb 100644 --- a/packages/ast-spec/src/element/MethodDefinition/fixtures/_error_/mixed-accessibility-modifiers/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/element/MethodDefinition/fixtures/_error_/mixed-accessibility-modifiers/snapshots/2-Babel-Error.shot @@ -1,4 +1,10 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > element > MethodDefinition > _error_ > mixed-accessibility-modifiers > Babel - Error`] -SyntaxError: Accessibility modifier already seen. (2:9) +BabelError + 1 | class Foo { +> 2 | public protected bar() {}; + | ^ Accessibility modifier already seen: 'protected'. (2:9) + 3 | } + 4 | + diff --git a/packages/ast-spec/src/element/MethodDefinition/fixtures/constructor-string-literal/fixture.ts b/packages/ast-spec/src/element/MethodDefinition/fixtures/constructor-string-literal/fixture.ts new file mode 100644 index 000000000000..4c180fec4267 --- /dev/null +++ b/packages/ast-spec/src/element/MethodDefinition/fixtures/constructor-string-literal/fixture.ts @@ -0,0 +1,4 @@ +class Foo { + // prettier-ignore + "constructor"() {} +} diff --git a/packages/ast-spec/src/element/MethodDefinition/fixtures/constructor-string-literal/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/MethodDefinition/fixtures/constructor-string-literal/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..c67c432e3f4e --- /dev/null +++ b/packages/ast-spec/src/element/MethodDefinition/fixtures/constructor-string-literal/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,100 @@ +Program { + type: "Program", + body: [ + ClassDeclaration { + type: "ClassDeclaration", + abstract: false, + body: ClassBody { + type: "ClassBody", + body: [ + MethodDefinition { + type: "MethodDefinition", + computed: false, + decorators: [], + key: Literal { + type: "Literal", + raw: ""constructor"", + value: "constructor", + + range: [35, 48], + loc: { + start: { column: 2, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, + kind: "constructor", + optional: false, + override: false, + static: false, + value: FunctionExpression { + type: "FunctionExpression", + async: false, + body: BlockStatement { + type: "BlockStatement", + body: [], + + range: [51, 53], + loc: { + start: { column: 18, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + declare: false, + expression: false, + generator: false, + id: null, + params: [], + + range: [48, 53], + loc: { + start: { column: 15, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + + range: [35, 53], + loc: { + start: { column: 2, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + ], + + range: [10, 55], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 4 }, + }, + }, + declare: false, + decorators: [], + id: Identifier { + type: "Identifier", + decorators: [], + name: "Foo", + optional: false, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + implements: [], + superClass: null, + + range: [0, 55], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 4 }, + }, + }, + ], + sourceType: "script", + + range: [0, 56], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 5 }, + }, +} \ No newline at end of file diff --git a/packages/ast-spec/src/element/MethodDefinition/fixtures/constructor-string-literal/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/MethodDefinition/fixtures/constructor-string-literal/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..d7b945f9e519 --- /dev/null +++ b/packages/ast-spec/src/element/MethodDefinition/fixtures/constructor-string-literal/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,92 @@ +[ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + String { + type: "String", + value: ""constructor"", + + range: [35, 48], + loc: { + start: { column: 2, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [48, 49], + loc: { + start: { column: 15, line: 3 }, + end: { column: 16, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [49, 50], + loc: { + start: { column: 16, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [51, 52], + loc: { + start: { column: 18, line: 3 }, + end: { column: 19, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [52, 53], + loc: { + start: { column: 19, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [54, 55], + loc: { + start: { column: 0, line: 4 }, + end: { column: 1, line: 4 }, + }, + }, +] \ No newline at end of file diff --git a/packages/ast-spec/src/element/MethodDefinition/fixtures/constructor-string-literal/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/MethodDefinition/fixtures/constructor-string-literal/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..c67c432e3f4e --- /dev/null +++ b/packages/ast-spec/src/element/MethodDefinition/fixtures/constructor-string-literal/snapshots/3-Babel-AST.shot @@ -0,0 +1,100 @@ +Program { + type: "Program", + body: [ + ClassDeclaration { + type: "ClassDeclaration", + abstract: false, + body: ClassBody { + type: "ClassBody", + body: [ + MethodDefinition { + type: "MethodDefinition", + computed: false, + decorators: [], + key: Literal { + type: "Literal", + raw: ""constructor"", + value: "constructor", + + range: [35, 48], + loc: { + start: { column: 2, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, + kind: "constructor", + optional: false, + override: false, + static: false, + value: FunctionExpression { + type: "FunctionExpression", + async: false, + body: BlockStatement { + type: "BlockStatement", + body: [], + + range: [51, 53], + loc: { + start: { column: 18, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + declare: false, + expression: false, + generator: false, + id: null, + params: [], + + range: [48, 53], + loc: { + start: { column: 15, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + + range: [35, 53], + loc: { + start: { column: 2, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + ], + + range: [10, 55], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 4 }, + }, + }, + declare: false, + decorators: [], + id: Identifier { + type: "Identifier", + decorators: [], + name: "Foo", + optional: false, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + implements: [], + superClass: null, + + range: [0, 55], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 4 }, + }, + }, + ], + sourceType: "script", + + range: [0, 56], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 5 }, + }, +} \ No newline at end of file diff --git a/packages/ast-spec/src/element/MethodDefinition/fixtures/constructor-string-literal/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/MethodDefinition/fixtures/constructor-string-literal/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..d7b945f9e519 --- /dev/null +++ b/packages/ast-spec/src/element/MethodDefinition/fixtures/constructor-string-literal/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,92 @@ +[ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + String { + type: "String", + value: ""constructor"", + + range: [35, 48], + loc: { + start: { column: 2, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [48, 49], + loc: { + start: { column: 15, line: 3 }, + end: { column: 16, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [49, 50], + loc: { + start: { column: 16, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [51, 52], + loc: { + start: { column: 18, line: 3 }, + end: { column: 19, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [52, 53], + loc: { + start: { column: 19, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [54, 55], + loc: { + start: { column: 0, line: 4 }, + end: { column: 1, line: 4 }, + }, + }, +] \ No newline at end of file diff --git a/packages/ast-spec/src/element/MethodDefinition/fixtures/constructor/fixture.ts b/packages/ast-spec/src/element/MethodDefinition/fixtures/constructor/fixture.ts new file mode 100644 index 000000000000..5e9e3c9272a2 --- /dev/null +++ b/packages/ast-spec/src/element/MethodDefinition/fixtures/constructor/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + constructor() {} +} diff --git a/packages/ast-spec/src/element/MethodDefinition/fixtures/constructor/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/MethodDefinition/fixtures/constructor/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..3eef72dde2c6 --- /dev/null +++ b/packages/ast-spec/src/element/MethodDefinition/fixtures/constructor/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,101 @@ +Program { + type: "Program", + body: [ + ClassDeclaration { + type: "ClassDeclaration", + abstract: false, + body: ClassBody { + type: "ClassBody", + body: [ + MethodDefinition { + type: "MethodDefinition", + computed: false, + decorators: [], + key: Identifier { + type: "Identifier", + decorators: [], + name: "constructor", + optional: false, + + range: [14, 25], + loc: { + start: { column: 2, line: 2 }, + end: { column: 13, line: 2 }, + }, + }, + kind: "constructor", + optional: false, + override: false, + static: false, + value: FunctionExpression { + type: "FunctionExpression", + async: false, + body: BlockStatement { + type: "BlockStatement", + body: [], + + range: [28, 30], + loc: { + start: { column: 16, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, + declare: false, + expression: false, + generator: false, + id: null, + params: [], + + range: [25, 30], + loc: { + start: { column: 13, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, + + range: [14, 30], + loc: { + start: { column: 2, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, + ], + + range: [10, 32], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + declare: false, + decorators: [], + id: Identifier { + type: "Identifier", + decorators: [], + name: "Foo", + optional: false, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + implements: [], + superClass: null, + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 33], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} \ No newline at end of file diff --git a/packages/ast-spec/src/element/MethodDefinition/fixtures/constructor/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/MethodDefinition/fixtures/constructor/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..dae0e3eb6ca1 --- /dev/null +++ b/packages/ast-spec/src/element/MethodDefinition/fixtures/constructor/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,92 @@ +[ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "constructor", + + range: [14, 25], + loc: { + start: { column: 2, line: 2 }, + end: { column: 13, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [25, 26], + loc: { + start: { column: 13, line: 2 }, + end: { column: 14, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [26, 27], + loc: { + start: { column: 14, line: 2 }, + end: { column: 15, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [28, 29], + loc: { + start: { column: 16, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [29, 30], + loc: { + start: { column: 17, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [31, 32], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] \ No newline at end of file diff --git a/packages/ast-spec/src/element/MethodDefinition/fixtures/constructor/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/MethodDefinition/fixtures/constructor/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..3eef72dde2c6 --- /dev/null +++ b/packages/ast-spec/src/element/MethodDefinition/fixtures/constructor/snapshots/3-Babel-AST.shot @@ -0,0 +1,101 @@ +Program { + type: "Program", + body: [ + ClassDeclaration { + type: "ClassDeclaration", + abstract: false, + body: ClassBody { + type: "ClassBody", + body: [ + MethodDefinition { + type: "MethodDefinition", + computed: false, + decorators: [], + key: Identifier { + type: "Identifier", + decorators: [], + name: "constructor", + optional: false, + + range: [14, 25], + loc: { + start: { column: 2, line: 2 }, + end: { column: 13, line: 2 }, + }, + }, + kind: "constructor", + optional: false, + override: false, + static: false, + value: FunctionExpression { + type: "FunctionExpression", + async: false, + body: BlockStatement { + type: "BlockStatement", + body: [], + + range: [28, 30], + loc: { + start: { column: 16, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, + declare: false, + expression: false, + generator: false, + id: null, + params: [], + + range: [25, 30], + loc: { + start: { column: 13, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, + + range: [14, 30], + loc: { + start: { column: 2, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, + ], + + range: [10, 32], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + declare: false, + decorators: [], + id: Identifier { + type: "Identifier", + decorators: [], + name: "Foo", + optional: false, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + implements: [], + superClass: null, + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 33], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} \ No newline at end of file diff --git a/packages/ast-spec/src/element/MethodDefinition/fixtures/constructor/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/MethodDefinition/fixtures/constructor/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..dae0e3eb6ca1 --- /dev/null +++ b/packages/ast-spec/src/element/MethodDefinition/fixtures/constructor/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,92 @@ +[ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "constructor", + + range: [14, 25], + loc: { + start: { column: 2, line: 2 }, + end: { column: 13, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [25, 26], + loc: { + start: { column: 13, line: 2 }, + end: { column: 14, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [26, 27], + loc: { + start: { column: 14, line: 2 }, + end: { column: 15, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [28, 29], + loc: { + start: { column: 16, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [29, 30], + loc: { + start: { column: 17, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [31, 32], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] \ No newline at end of file diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/duplicated-accessibility-modifiers/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/duplicated-accessibility-modifiers/snapshots/2-Babel-Error.shot index 8493e50d46c6..31592e35fd82 100644 --- a/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/duplicated-accessibility-modifiers/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/duplicated-accessibility-modifiers/snapshots/2-Babel-Error.shot @@ -1,4 +1,10 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > element > PropertyDefinition > _error_ > duplicated-accessibility-modifiers > Babel - Error`] -SyntaxError: Accessibility modifier already seen. (2:9) +BabelError + 1 | class Foo { +> 2 | public public bar; + | ^ Accessibility modifier already seen: 'public'. (2:9) + 3 | } + 4 | + diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-identifier/fixture.ts b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-identifier/fixture.ts new file mode 100644 index 000000000000..581943685ffe --- /dev/null +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-identifier/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + constructor +} diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-identifier/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-identifier/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..ed0ae4b78658 --- /dev/null +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-identifier/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,9 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > PropertyDefinition > _error_ > key-constructor-identifier > TSESTree - Error`] +TSError + 1 | class Foo { + 2 | constructor +> 3 | } + | ^ '(' expected. + 4 | diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-identifier/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-identifier/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..680ca51c5b1a --- /dev/null +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-identifier/snapshots/2-Babel-Error.shot @@ -0,0 +1,10 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > PropertyDefinition > _error_ > key-constructor-identifier > Babel - Error`] +BabelError + 1 | class Foo { +> 2 | constructor + | ^ Classes may not have a field named 'constructor'. (2:2) + 3 | } + 4 | + diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-identifier/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-identifier/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..dda789130572 --- /dev/null +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-identifier/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > PropertyDefinition > _error_ > key-constructor-identifier > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string-escaped/fixture.ts b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string-escaped/fixture.ts new file mode 100644 index 000000000000..3449ebe932d7 --- /dev/null +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string-escaped/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + 'construct\u{6f}r' +} diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string-escaped/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string-escaped/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..e7cc82f40aad --- /dev/null +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string-escaped/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,9 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > PropertyDefinition > _error_ > key-constructor-string-escaped > TSESTree - Error`] +TSError + 1 | class Foo { +> 2 | 'construct\u{6f}r' + | ^^^^^^^^^^^^^^^^^^ Classes may not have a field named 'constructor'. + 3 | } + 4 | diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string-escaped/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string-escaped/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..702bec4df14e --- /dev/null +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string-escaped/snapshots/2-Babel-Error.shot @@ -0,0 +1,10 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > PropertyDefinition > _error_ > key-constructor-string-escaped > Babel - Error`] +BabelError + 1 | class Foo { +> 2 | 'construct\u{6f}r' + | ^ Classes may not have a field named 'constructor'. (2:2) + 3 | } + 4 | + diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string-escaped/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string-escaped/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..b3922ac52bf5 --- /dev/null +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string-escaped/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > PropertyDefinition > _error_ > key-constructor-string-escaped > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string/fixture.ts b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string/fixture.ts new file mode 100644 index 000000000000..d29a35ffdbb7 --- /dev/null +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + 'constructor' +} diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..46f1efa8ad71 --- /dev/null +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,9 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > PropertyDefinition > _error_ > key-constructor-string > TSESTree - Error`] +TSError + 1 | class Foo { +> 2 | 'constructor' + | ^^^^^^^^^^^^^ Classes may not have a field named 'constructor'. + 3 | } + 4 | diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..eaac47437927 --- /dev/null +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string/snapshots/2-Babel-Error.shot @@ -0,0 +1,10 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > PropertyDefinition > _error_ > key-constructor-string > Babel - Error`] +BabelError + 1 | class Foo { +> 2 | 'constructor' + | ^ Classes may not have a field named 'constructor'. (2:2) + 3 | } + 4 | + diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..86e611b5b35d --- /dev/null +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > PropertyDefinition > _error_ > key-constructor-string > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/mixed-accessibility-modifiers/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/mixed-accessibility-modifiers/snapshots/2-Babel-Error.shot index 2ad65ba9c9fd..f62e3c0547b7 100644 --- a/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/mixed-accessibility-modifiers/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/mixed-accessibility-modifiers/snapshots/2-Babel-Error.shot @@ -1,4 +1,10 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > element > PropertyDefinition > _error_ > mixed-accessibility-modifiers > Babel - Error`] -SyntaxError: Accessibility modifier already seen. (2:9) +BabelError + 1 | class Foo { +> 2 | public protected bar; + | ^ Accessibility modifier already seen: 'protected'. (2:9) + 3 | } + 4 | + diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/fixture.ts b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/fixture.ts new file mode 100644 index 000000000000..8846529091d9 --- /dev/null +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + [constructor]; +} diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..036f1181e9b7 --- /dev/null +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,79 @@ +Program { + type: "Program", + body: [ + ClassDeclaration { + type: "ClassDeclaration", + abstract: false, + body: ClassBody { + type: "ClassBody", + body: [ + PropertyDefinition { + type: "PropertyDefinition", + computed: true, + declare: false, + decorators: [], + definite: false, + key: Identifier { + type: "Identifier", + decorators: [], + name: "constructor", + optional: false, + + range: [15, 26], + loc: { + start: { column: 3, line: 2 }, + end: { column: 14, line: 2 }, + }, + }, + optional: false, + override: false, + readonly: false, + static: false, + value: null, + + range: [14, 28], + loc: { + start: { column: 2, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + ], + + range: [10, 30], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + declare: false, + decorators: [], + id: Identifier { + type: "Identifier", + decorators: [], + name: "Foo", + optional: false, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + implements: [], + superClass: null, + + range: [0, 30], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} \ No newline at end of file diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..93100d49782c --- /dev/null +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,82 @@ +[ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [14, 15], + loc: { + start: { column: 2, line: 2 }, + end: { column: 3, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "constructor", + + range: [15, 26], + loc: { + start: { column: 3, line: 2 }, + end: { column: 14, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [26, 27], + loc: { + start: { column: 14, line: 2 }, + end: { column: 15, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [27, 28], + loc: { + start: { column: 15, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [29, 30], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] \ No newline at end of file diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..036f1181e9b7 --- /dev/null +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/3-Babel-AST.shot @@ -0,0 +1,79 @@ +Program { + type: "Program", + body: [ + ClassDeclaration { + type: "ClassDeclaration", + abstract: false, + body: ClassBody { + type: "ClassBody", + body: [ + PropertyDefinition { + type: "PropertyDefinition", + computed: true, + declare: false, + decorators: [], + definite: false, + key: Identifier { + type: "Identifier", + decorators: [], + name: "constructor", + optional: false, + + range: [15, 26], + loc: { + start: { column: 3, line: 2 }, + end: { column: 14, line: 2 }, + }, + }, + optional: false, + override: false, + readonly: false, + static: false, + value: null, + + range: [14, 28], + loc: { + start: { column: 2, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + ], + + range: [10, 30], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + declare: false, + decorators: [], + id: Identifier { + type: "Identifier", + decorators: [], + name: "Foo", + optional: false, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + implements: [], + superClass: null, + + range: [0, 30], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} \ No newline at end of file diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..93100d49782c --- /dev/null +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,82 @@ +[ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [14, 15], + loc: { + start: { column: 2, line: 2 }, + end: { column: 3, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "constructor", + + range: [15, 26], + loc: { + start: { column: 3, line: 2 }, + end: { column: 14, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [26, 27], + loc: { + start: { column: 14, line: 2 }, + end: { column: 15, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [27, 28], + loc: { + start: { column: 15, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [29, 30], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] \ No newline at end of file diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/fixture.ts b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/fixture.ts new file mode 100644 index 000000000000..955e0ccdd551 --- /dev/null +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + ['constructor']; +} diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..a35a705153a3 --- /dev/null +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,78 @@ +Program { + type: "Program", + body: [ + ClassDeclaration { + type: "ClassDeclaration", + abstract: false, + body: ClassBody { + type: "ClassBody", + body: [ + PropertyDefinition { + type: "PropertyDefinition", + computed: true, + declare: false, + decorators: [], + definite: false, + key: Literal { + type: "Literal", + raw: "'constructor'", + value: "constructor", + + range: [15, 28], + loc: { + start: { column: 3, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + optional: false, + override: false, + readonly: false, + static: false, + value: null, + + range: [14, 30], + loc: { + start: { column: 2, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, + ], + + range: [10, 32], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + declare: false, + decorators: [], + id: Identifier { + type: "Identifier", + decorators: [], + name: "Foo", + optional: false, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + implements: [], + superClass: null, + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 33], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} \ No newline at end of file diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..d587dd5c180d --- /dev/null +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,82 @@ +[ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [14, 15], + loc: { + start: { column: 2, line: 2 }, + end: { column: 3, line: 2 }, + }, + }, + String { + type: "String", + value: "'constructor'", + + range: [15, 28], + loc: { + start: { column: 3, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [28, 29], + loc: { + start: { column: 16, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [29, 30], + loc: { + start: { column: 17, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [31, 32], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] \ No newline at end of file diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..a35a705153a3 --- /dev/null +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/snapshots/3-Babel-AST.shot @@ -0,0 +1,78 @@ +Program { + type: "Program", + body: [ + ClassDeclaration { + type: "ClassDeclaration", + abstract: false, + body: ClassBody { + type: "ClassBody", + body: [ + PropertyDefinition { + type: "PropertyDefinition", + computed: true, + declare: false, + decorators: [], + definite: false, + key: Literal { + type: "Literal", + raw: "'constructor'", + value: "constructor", + + range: [15, 28], + loc: { + start: { column: 3, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + optional: false, + override: false, + readonly: false, + static: false, + value: null, + + range: [14, 30], + loc: { + start: { column: 2, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, + ], + + range: [10, 32], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + declare: false, + decorators: [], + id: Identifier { + type: "Identifier", + decorators: [], + name: "Foo", + optional: false, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + implements: [], + superClass: null, + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 33], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} \ No newline at end of file diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..d587dd5c180d --- /dev/null +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,82 @@ +[ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [14, 15], + loc: { + start: { column: 2, line: 2 }, + end: { column: 3, line: 2 }, + }, + }, + String { + type: "String", + value: "'constructor'", + + range: [15, 28], + loc: { + start: { column: 3, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [28, 29], + loc: { + start: { column: 16, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [29, 30], + loc: { + start: { column: 17, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [31, 32], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] \ No newline at end of file diff --git a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string-escaped/fixture.ts b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string-escaped/fixture.ts new file mode 100644 index 000000000000..cf5081dbe114 --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string-escaped/fixture.ts @@ -0,0 +1,3 @@ +abstract class Foo { + accessor 'construct\u{6f}r' +} diff --git a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string-escaped/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string-escaped/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..c852da13a3fa --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string-escaped/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,9 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > TSAbstractAccessorProperty > _error_ > key-constructor-string-escaped > TSESTree - Error`] +TSError + 1 | abstract class Foo { +> 2 | accessor 'construct\u{6f}r' + | ^^^^^^^^^^^^^^^^^^ Classes may not have a field named 'constructor'. + 3 | } + 4 | diff --git a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string-escaped/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string-escaped/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..8b2bdb1d6685 --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string-escaped/snapshots/2-Babel-Error.shot @@ -0,0 +1,10 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > TSAbstractAccessorProperty > _error_ > key-constructor-string-escaped > Babel - Error`] +BabelError + 1 | abstract class Foo { +> 2 | accessor 'construct\u{6f}r' + | ^ Classes may not have a field named 'constructor'. (2:11) + 3 | } + 4 | + diff --git a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string-escaped/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string-escaped/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..f4851859171d --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string-escaped/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > TSAbstractAccessorProperty > _error_ > key-constructor-string-escaped > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string/fixture.ts b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string/fixture.ts new file mode 100644 index 000000000000..84fb8c4caa3f --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string/fixture.ts @@ -0,0 +1,3 @@ +abstract class Foo { + accessor 'constructor' +} diff --git a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..97e1650fccca --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,9 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > TSAbstractAccessorProperty > _error_ > key-constructor-string > TSESTree - Error`] +TSError + 1 | abstract class Foo { +> 2 | accessor 'constructor' + | ^^^^^^^^^^^^^ Classes may not have a field named 'constructor'. + 3 | } + 4 | diff --git a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..9f0cd2ea63f0 --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string/snapshots/2-Babel-Error.shot @@ -0,0 +1,10 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > TSAbstractAccessorProperty > _error_ > key-constructor-string > Babel - Error`] +BabelError + 1 | abstract class Foo { +> 2 | accessor 'constructor' + | ^ Classes may not have a field named 'constructor'. (2:11) + 3 | } + 4 | + diff --git a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..c6bb852e8a96 --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > TSAbstractAccessorProperty > _error_ > key-constructor-string > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/fixture.ts b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/fixture.ts new file mode 100644 index 000000000000..e267f66d845d --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/fixture.ts @@ -0,0 +1,3 @@ +abstract class Foo { + accessor [constructor]; +} diff --git a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..82d28f21758a --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,79 @@ +Program { + type: "Program", + body: [ + ClassDeclaration { + type: "ClassDeclaration", + abstract: true, + body: ClassBody { + type: "ClassBody", + body: [ + AccessorProperty { + type: "AccessorProperty", + computed: true, + declare: false, + decorators: [], + definite: false, + key: Identifier { + type: "Identifier", + decorators: [], + name: "constructor", + optional: false, + + range: [33, 44], + loc: { + start: { column: 12, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + optional: false, + override: false, + readonly: false, + static: false, + value: null, + + range: [23, 46], + loc: { + start: { column: 2, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, + ], + + range: [19, 48], + loc: { + start: { column: 19, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + declare: false, + decorators: [], + id: Identifier { + type: "Identifier", + decorators: [], + name: "Foo", + optional: false, + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + implements: [], + superClass: null, + + range: [0, 48], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 49], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} \ No newline at end of file diff --git a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..4941bcdc220c --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,102 @@ +[ + Identifier { + type: "Identifier", + value: "abstract", + + range: [0, 8], + loc: { + start: { column: 0, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "class", + + range: [9, 14], + loc: { + start: { column: 9, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [23, 31], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [32, 33], + loc: { + start: { column: 11, line: 2 }, + end: { column: 12, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "constructor", + + range: [33, 44], + loc: { + start: { column: 12, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [44, 45], + loc: { + start: { column: 23, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [45, 46], + loc: { + start: { column: 24, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [47, 48], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] \ No newline at end of file diff --git a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..82d28f21758a --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/3-Babel-AST.shot @@ -0,0 +1,79 @@ +Program { + type: "Program", + body: [ + ClassDeclaration { + type: "ClassDeclaration", + abstract: true, + body: ClassBody { + type: "ClassBody", + body: [ + AccessorProperty { + type: "AccessorProperty", + computed: true, + declare: false, + decorators: [], + definite: false, + key: Identifier { + type: "Identifier", + decorators: [], + name: "constructor", + optional: false, + + range: [33, 44], + loc: { + start: { column: 12, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + optional: false, + override: false, + readonly: false, + static: false, + value: null, + + range: [23, 46], + loc: { + start: { column: 2, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, + ], + + range: [19, 48], + loc: { + start: { column: 19, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + declare: false, + decorators: [], + id: Identifier { + type: "Identifier", + decorators: [], + name: "Foo", + optional: false, + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + implements: [], + superClass: null, + + range: [0, 48], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 49], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} \ No newline at end of file diff --git a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..4941bcdc220c --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,102 @@ +[ + Identifier { + type: "Identifier", + value: "abstract", + + range: [0, 8], + loc: { + start: { column: 0, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "class", + + range: [9, 14], + loc: { + start: { column: 9, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [23, 31], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [32, 33], + loc: { + start: { column: 11, line: 2 }, + end: { column: 12, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "constructor", + + range: [33, 44], + loc: { + start: { column: 12, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [44, 45], + loc: { + start: { column: 23, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [45, 46], + loc: { + start: { column: 24, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [47, 48], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] \ No newline at end of file diff --git a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/fixture.ts b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/fixture.ts new file mode 100644 index 000000000000..dd4af2978b06 --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/fixture.ts @@ -0,0 +1,3 @@ +abstract class Foo { + accessor ['constructor']; +} diff --git a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..c1ef23b02e88 --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,78 @@ +Program { + type: "Program", + body: [ + ClassDeclaration { + type: "ClassDeclaration", + abstract: true, + body: ClassBody { + type: "ClassBody", + body: [ + AccessorProperty { + type: "AccessorProperty", + computed: true, + declare: false, + decorators: [], + definite: false, + key: Literal { + type: "Literal", + raw: "'constructor'", + value: "constructor", + + range: [33, 46], + loc: { + start: { column: 12, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, + optional: false, + override: false, + readonly: false, + static: false, + value: null, + + range: [23, 48], + loc: { + start: { column: 2, line: 2 }, + end: { column: 27, line: 2 }, + }, + }, + ], + + range: [19, 50], + loc: { + start: { column: 19, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + declare: false, + decorators: [], + id: Identifier { + type: "Identifier", + decorators: [], + name: "Foo", + optional: false, + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + implements: [], + superClass: null, + + range: [0, 50], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 51], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} \ No newline at end of file diff --git a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..b3c97ec3fd6c --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,102 @@ +[ + Identifier { + type: "Identifier", + value: "abstract", + + range: [0, 8], + loc: { + start: { column: 0, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "class", + + range: [9, 14], + loc: { + start: { column: 9, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [23, 31], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [32, 33], + loc: { + start: { column: 11, line: 2 }, + end: { column: 12, line: 2 }, + }, + }, + String { + type: "String", + value: "'constructor'", + + range: [33, 46], + loc: { + start: { column: 12, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [46, 47], + loc: { + start: { column: 25, line: 2 }, + end: { column: 26, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [47, 48], + loc: { + start: { column: 26, line: 2 }, + end: { column: 27, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [49, 50], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] \ No newline at end of file diff --git a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..c1ef23b02e88 --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/snapshots/3-Babel-AST.shot @@ -0,0 +1,78 @@ +Program { + type: "Program", + body: [ + ClassDeclaration { + type: "ClassDeclaration", + abstract: true, + body: ClassBody { + type: "ClassBody", + body: [ + AccessorProperty { + type: "AccessorProperty", + computed: true, + declare: false, + decorators: [], + definite: false, + key: Literal { + type: "Literal", + raw: "'constructor'", + value: "constructor", + + range: [33, 46], + loc: { + start: { column: 12, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, + optional: false, + override: false, + readonly: false, + static: false, + value: null, + + range: [23, 48], + loc: { + start: { column: 2, line: 2 }, + end: { column: 27, line: 2 }, + }, + }, + ], + + range: [19, 50], + loc: { + start: { column: 19, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + declare: false, + decorators: [], + id: Identifier { + type: "Identifier", + decorators: [], + name: "Foo", + optional: false, + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + implements: [], + superClass: null, + + range: [0, 50], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 51], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} \ No newline at end of file diff --git a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..b3c97ec3fd6c --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,102 @@ +[ + Identifier { + type: "Identifier", + value: "abstract", + + range: [0, 8], + loc: { + start: { column: 0, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "class", + + range: [9, 14], + loc: { + start: { column: 9, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [23, 31], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [32, 33], + loc: { + start: { column: 11, line: 2 }, + end: { column: 12, line: 2 }, + }, + }, + String { + type: "String", + value: "'constructor'", + + range: [33, 46], + loc: { + start: { column: 12, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [46, 47], + loc: { + start: { column: 25, line: 2 }, + end: { column: 26, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [47, 48], + loc: { + start: { column: 26, line: 2 }, + end: { column: 27, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [49, 50], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] \ No newline at end of file diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-identifier/fixture.ts b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-identifier/fixture.ts new file mode 100644 index 000000000000..a70cc4d0b84e --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-identifier/fixture.ts @@ -0,0 +1,3 @@ +abstract class Foo { + constructor +} diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-identifier/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-identifier/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..d4dac96c3819 --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-identifier/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,9 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > TSAbstractPropertyDefinition > _error_ > key-constructor-identifier > TSESTree - Error`] +TSError + 1 | abstract class Foo { + 2 | constructor +> 3 | } + | ^ '(' expected. + 4 | diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-identifier/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-identifier/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..40ef5d1ba178 --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-identifier/snapshots/2-Babel-Error.shot @@ -0,0 +1,10 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > TSAbstractPropertyDefinition > _error_ > key-constructor-identifier > Babel - Error`] +BabelError + 1 | abstract class Foo { +> 2 | constructor + | ^ Classes may not have a field named 'constructor'. (2:2) + 3 | } + 4 | + diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-identifier/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-identifier/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..c03db2425706 --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-identifier/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > TSAbstractPropertyDefinition > _error_ > key-constructor-identifier > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string-escaped/fixture.ts b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string-escaped/fixture.ts new file mode 100644 index 000000000000..59eeeb52941e --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string-escaped/fixture.ts @@ -0,0 +1,3 @@ +abstract class Foo { + 'construct\u{6f}r' +} diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string-escaped/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string-escaped/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..7db0a089389d --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string-escaped/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,9 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > TSAbstractPropertyDefinition > _error_ > key-constructor-string-escaped > TSESTree - Error`] +TSError + 1 | abstract class Foo { +> 2 | 'construct\u{6f}r' + | ^^^^^^^^^^^^^^^^^^ Classes may not have a field named 'constructor'. + 3 | } + 4 | diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string-escaped/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string-escaped/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..3d7fc01c39af --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string-escaped/snapshots/2-Babel-Error.shot @@ -0,0 +1,10 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > TSAbstractPropertyDefinition > _error_ > key-constructor-string-escaped > Babel - Error`] +BabelError + 1 | abstract class Foo { +> 2 | 'construct\u{6f}r' + | ^ Classes may not have a field named 'constructor'. (2:2) + 3 | } + 4 | + diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string-escaped/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string-escaped/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..c784e6ef8f7e --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string-escaped/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > TSAbstractPropertyDefinition > _error_ > key-constructor-string-escaped > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string/fixture.ts b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string/fixture.ts new file mode 100644 index 000000000000..773be1c59705 --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string/fixture.ts @@ -0,0 +1,3 @@ +abstract class Foo { + 'constructor' +} diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..e70630a8db65 --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,9 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > TSAbstractPropertyDefinition > _error_ > key-constructor-string > TSESTree - Error`] +TSError + 1 | abstract class Foo { +> 2 | 'constructor' + | ^^^^^^^^^^^^^ Classes may not have a field named 'constructor'. + 3 | } + 4 | diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..0b562418bd7a --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string/snapshots/2-Babel-Error.shot @@ -0,0 +1,10 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > TSAbstractPropertyDefinition > _error_ > key-constructor-string > Babel - Error`] +BabelError + 1 | abstract class Foo { +> 2 | 'constructor' + | ^ Classes may not have a field named 'constructor'. (2:2) + 3 | } + 4 | + diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..e72b64ca43be --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > TSAbstractPropertyDefinition > _error_ > key-constructor-string > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/fixture.ts b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/fixture.ts new file mode 100644 index 000000000000..0035d60f9a3b --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/fixture.ts @@ -0,0 +1,3 @@ +abstract class Foo { + [constructor]; +} diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..a84556365ffa --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,79 @@ +Program { + type: "Program", + body: [ + ClassDeclaration { + type: "ClassDeclaration", + abstract: true, + body: ClassBody { + type: "ClassBody", + body: [ + PropertyDefinition { + type: "PropertyDefinition", + computed: true, + declare: false, + decorators: [], + definite: false, + key: Identifier { + type: "Identifier", + decorators: [], + name: "constructor", + optional: false, + + range: [24, 35], + loc: { + start: { column: 3, line: 2 }, + end: { column: 14, line: 2 }, + }, + }, + optional: false, + override: false, + readonly: false, + static: false, + value: null, + + range: [23, 37], + loc: { + start: { column: 2, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + ], + + range: [19, 39], + loc: { + start: { column: 19, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + declare: false, + decorators: [], + id: Identifier { + type: "Identifier", + decorators: [], + name: "Foo", + optional: false, + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + implements: [], + superClass: null, + + range: [0, 39], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 40], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} \ No newline at end of file diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..f33b1b154313 --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,92 @@ +[ + Identifier { + type: "Identifier", + value: "abstract", + + range: [0, 8], + loc: { + start: { column: 0, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "class", + + range: [9, 14], + loc: { + start: { column: 9, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [23, 24], + loc: { + start: { column: 2, line: 2 }, + end: { column: 3, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "constructor", + + range: [24, 35], + loc: { + start: { column: 3, line: 2 }, + end: { column: 14, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [35, 36], + loc: { + start: { column: 14, line: 2 }, + end: { column: 15, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [36, 37], + loc: { + start: { column: 15, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [38, 39], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] \ No newline at end of file diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..a84556365ffa --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/3-Babel-AST.shot @@ -0,0 +1,79 @@ +Program { + type: "Program", + body: [ + ClassDeclaration { + type: "ClassDeclaration", + abstract: true, + body: ClassBody { + type: "ClassBody", + body: [ + PropertyDefinition { + type: "PropertyDefinition", + computed: true, + declare: false, + decorators: [], + definite: false, + key: Identifier { + type: "Identifier", + decorators: [], + name: "constructor", + optional: false, + + range: [24, 35], + loc: { + start: { column: 3, line: 2 }, + end: { column: 14, line: 2 }, + }, + }, + optional: false, + override: false, + readonly: false, + static: false, + value: null, + + range: [23, 37], + loc: { + start: { column: 2, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + ], + + range: [19, 39], + loc: { + start: { column: 19, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + declare: false, + decorators: [], + id: Identifier { + type: "Identifier", + decorators: [], + name: "Foo", + optional: false, + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + implements: [], + superClass: null, + + range: [0, 39], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 40], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} \ No newline at end of file diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..f33b1b154313 --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,92 @@ +[ + Identifier { + type: "Identifier", + value: "abstract", + + range: [0, 8], + loc: { + start: { column: 0, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "class", + + range: [9, 14], + loc: { + start: { column: 9, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [23, 24], + loc: { + start: { column: 2, line: 2 }, + end: { column: 3, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "constructor", + + range: [24, 35], + loc: { + start: { column: 3, line: 2 }, + end: { column: 14, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [35, 36], + loc: { + start: { column: 14, line: 2 }, + end: { column: 15, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [36, 37], + loc: { + start: { column: 15, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [38, 39], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] \ No newline at end of file diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/fixture.ts b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/fixture.ts new file mode 100644 index 000000000000..d7fa2a53c79b --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/fixture.ts @@ -0,0 +1,3 @@ +abstract class Foo { + ['constructor']; +} diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..880411e5b0a1 --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,78 @@ +Program { + type: "Program", + body: [ + ClassDeclaration { + type: "ClassDeclaration", + abstract: true, + body: ClassBody { + type: "ClassBody", + body: [ + PropertyDefinition { + type: "PropertyDefinition", + computed: true, + declare: false, + decorators: [], + definite: false, + key: Literal { + type: "Literal", + raw: "'constructor'", + value: "constructor", + + range: [24, 37], + loc: { + start: { column: 3, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + optional: false, + override: false, + readonly: false, + static: false, + value: null, + + range: [23, 39], + loc: { + start: { column: 2, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, + ], + + range: [19, 41], + loc: { + start: { column: 19, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + declare: false, + decorators: [], + id: Identifier { + type: "Identifier", + decorators: [], + name: "Foo", + optional: false, + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + implements: [], + superClass: null, + + range: [0, 41], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 42], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} \ No newline at end of file diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..a82ebf95ff87 --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,92 @@ +[ + Identifier { + type: "Identifier", + value: "abstract", + + range: [0, 8], + loc: { + start: { column: 0, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "class", + + range: [9, 14], + loc: { + start: { column: 9, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [23, 24], + loc: { + start: { column: 2, line: 2 }, + end: { column: 3, line: 2 }, + }, + }, + String { + type: "String", + value: "'constructor'", + + range: [24, 37], + loc: { + start: { column: 3, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [37, 38], + loc: { + start: { column: 16, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [38, 39], + loc: { + start: { column: 17, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [40, 41], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] \ No newline at end of file diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..880411e5b0a1 --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/snapshots/3-Babel-AST.shot @@ -0,0 +1,78 @@ +Program { + type: "Program", + body: [ + ClassDeclaration { + type: "ClassDeclaration", + abstract: true, + body: ClassBody { + type: "ClassBody", + body: [ + PropertyDefinition { + type: "PropertyDefinition", + computed: true, + declare: false, + decorators: [], + definite: false, + key: Literal { + type: "Literal", + raw: "'constructor'", + value: "constructor", + + range: [24, 37], + loc: { + start: { column: 3, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + optional: false, + override: false, + readonly: false, + static: false, + value: null, + + range: [23, 39], + loc: { + start: { column: 2, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, + ], + + range: [19, 41], + loc: { + start: { column: 19, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + declare: false, + decorators: [], + id: Identifier { + type: "Identifier", + decorators: [], + name: "Foo", + optional: false, + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + implements: [], + superClass: null, + + range: [0, 41], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 42], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} \ No newline at end of file diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..a82ebf95ff87 --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,92 @@ +[ + Identifier { + type: "Identifier", + value: "abstract", + + range: [0, 8], + loc: { + start: { column: 0, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "class", + + range: [9, 14], + loc: { + start: { column: 9, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [23, 24], + loc: { + start: { column: 2, line: 2 }, + end: { column: 3, line: 2 }, + }, + }, + String { + type: "String", + value: "'constructor'", + + range: [24, 37], + loc: { + start: { column: 3, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [37, 38], + loc: { + start: { column: 16, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [38, 39], + loc: { + start: { column: 17, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [40, 41], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] \ No newline at end of file diff --git a/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/bigint-name/fixture.ts b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/bigint-name/fixture.ts new file mode 100644 index 000000000000..3fcd08d2bc99 --- /dev/null +++ b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/bigint-name/fixture.ts @@ -0,0 +1,3 @@ +enum Foo { + 1n = 2 +} diff --git a/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/bigint-name/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/bigint-name/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..87ba241f5d40 --- /dev/null +++ b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/bigint-name/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,9 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > TSEnumMember > _error_ > bigint-name > TSESTree - Error`] +TSError + 1 | enum Foo { +> 2 | 1n = 2 + | ^^ An enum member cannot have a numeric name. + 3 | } + 4 | diff --git a/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/bigint-name/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/bigint-name/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..b3afe3afc96e --- /dev/null +++ b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/bigint-name/snapshots/2-Babel-Error.shot @@ -0,0 +1,10 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > TSEnumMember > _error_ > bigint-name > Babel - Error`] +BabelError + 1 | enum Foo { +> 2 | 1n = 2 + | ^ Unexpected token (2:2) + 3 | } + 4 | + diff --git a/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/bigint-name/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/bigint-name/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..083d80544d72 --- /dev/null +++ b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/bigint-name/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > TSEnumMember > _error_ > bigint-name > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/computed-string-name/fixture.ts b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/computed-string-name/fixture.ts new file mode 100644 index 000000000000..2e99a8d3766b --- /dev/null +++ b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/computed-string-name/fixture.ts @@ -0,0 +1,3 @@ +enum Foo { + ["A"] = 2 +} diff --git a/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/computed-string-name/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/computed-string-name/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..2079fad90f2e --- /dev/null +++ b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/computed-string-name/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,9 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > TSEnumMember > _error_ > computed-string-name > TSESTree - Error`] +TSError + 1 | enum Foo { +> 2 | ["A"] = 2 + | ^^^^^ Computed property names are not allowed in enums. + 3 | } + 4 | diff --git a/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/computed-string-name/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/computed-string-name/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..c68571c79318 --- /dev/null +++ b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/computed-string-name/snapshots/2-Babel-Error.shot @@ -0,0 +1,10 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > TSEnumMember > _error_ > computed-string-name > Babel - Error`] +BabelError + 1 | enum Foo { +> 2 | ["A"] = 2 + | ^ Unexpected token (2:2) + 3 | } + 4 | + diff --git a/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/computed-string-name/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/computed-string-name/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..1331cf0d18b9 --- /dev/null +++ b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/computed-string-name/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > TSEnumMember > _error_ > computed-string-name > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/number-name/fixture.ts b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/number-name/fixture.ts new file mode 100644 index 000000000000..174773e65995 --- /dev/null +++ b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/number-name/fixture.ts @@ -0,0 +1,3 @@ +enum Foo { + 1 = 2 +} diff --git a/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/number-name/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/number-name/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..8dfacb32e5b9 --- /dev/null +++ b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/number-name/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,9 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > TSEnumMember > _error_ > number-name > TSESTree - Error`] +TSError + 1 | enum Foo { +> 2 | 1 = 2 + | ^ An enum member cannot have a numeric name. + 3 | } + 4 | diff --git a/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/number-name/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/number-name/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..76b2f2b9c62e --- /dev/null +++ b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/number-name/snapshots/2-Babel-Error.shot @@ -0,0 +1,10 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > TSEnumMember > _error_ > number-name > Babel - Error`] +BabelError + 1 | enum Foo { +> 2 | 1 = 2 + | ^ Unexpected token (2:2) + 3 | } + 4 | + diff --git a/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/number-name/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/number-name/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..34e6cebc91e1 --- /dev/null +++ b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/number-name/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > TSEnumMember > _error_ > number-name > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/element/TSEnumMember/spec.ts b/packages/ast-spec/src/element/TSEnumMember/spec.ts index a80e963ad278..a4d1b836f951 100644 --- a/packages/ast-spec/src/element/TSEnumMember/spec.ts +++ b/packages/ast-spec/src/element/TSEnumMember/spec.ts @@ -1,44 +1,15 @@ 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 { Expression } from '../../unions/Expression'; -import type { - PropertyNameComputed, - PropertyNameNonComputed, -} from '../../unions/PropertyName'; -interface TSEnumMemberBase extends BaseNode { +export interface TSEnumMember extends BaseNode { type: AST_NODE_TYPES.TSEnumMember; - computed: boolean; - id: - | PropertyNameComputed // this should only happen in semantically invalid code (ts error 1164) - | PropertyNameNonComputed; + id: Identifier | StringLiteral; initializer: Expression | undefined; + /** + * @deprecated the enum member is always non-computed. + */ + computed: boolean; } - -/** - * this should only really happen in semantically invalid code (errors 1164 and 2452) - * - * @example - * ```ts - * // VALID: - * enum Foo { ['a'] } - * - * // INVALID: - * const x = 'a'; - * enum Foo { [x] } - * enum Bar { ['a' + 'b'] } - * ``` - */ -export interface TSEnumMemberComputedName extends TSEnumMemberBase { - computed: true; - id: PropertyNameComputed; -} - -export interface TSEnumMemberNonComputedName extends TSEnumMemberBase { - computed: false; - id: PropertyNameNonComputed; -} - -export type TSEnumMember = - | TSEnumMemberComputedName - | TSEnumMemberNonComputedName; diff --git a/packages/ast-spec/src/expression/ArrowFunctionExpression/spec.ts b/packages/ast-spec/src/expression/ArrowFunctionExpression/spec.ts index 271578f8f01f..f160bf5d23d0 100644 --- a/packages/ast-spec/src/expression/ArrowFunctionExpression/spec.ts +++ b/packages/ast-spec/src/expression/ArrowFunctionExpression/spec.ts @@ -11,7 +11,7 @@ export interface ArrowFunctionExpression extends BaseNode { async: boolean; body: BlockStatement | Expression; expression: boolean; - generator: boolean; + generator: false; id: null; params: Parameter[]; returnType: TSTypeAnnotation | undefined; diff --git a/packages/ast-spec/src/expression/BinaryExpression/fixtures/_error_/private-lhs-not-in/fixture.ts b/packages/ast-spec/src/expression/BinaryExpression/fixtures/_error_/private-lhs-not-in/fixture.ts new file mode 100644 index 000000000000..daafa9ccb62f --- /dev/null +++ b/packages/ast-spec/src/expression/BinaryExpression/fixtures/_error_/private-lhs-not-in/fixture.ts @@ -0,0 +1,4 @@ +class A { + #a; + b = #a + 1; +} diff --git a/packages/ast-spec/src/expression/BinaryExpression/fixtures/_error_/private-lhs-not-in/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/expression/BinaryExpression/fixtures/_error_/private-lhs-not-in/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..ec75deb33cff --- /dev/null +++ b/packages/ast-spec/src/expression/BinaryExpression/fixtures/_error_/private-lhs-not-in/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,10 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > BinaryExpression > _error_ > private-lhs-not-in > TSESTree - Error`] +TSError + 1 | class A { + 2 | #a; +> 3 | b = #a + 1; + | ^^ Private identifiers cannot appear on the right-hand-side of an 'in' expression. + 4 | } + 5 | diff --git a/packages/ast-spec/src/expression/BinaryExpression/fixtures/_error_/private-lhs-not-in/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/BinaryExpression/fixtures/_error_/private-lhs-not-in/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..453c15f5a66d --- /dev/null +++ b/packages/ast-spec/src/expression/BinaryExpression/fixtures/_error_/private-lhs-not-in/snapshots/2-Babel-Error.shot @@ -0,0 +1,11 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > BinaryExpression > _error_ > private-lhs-not-in > Babel - Error`] +BabelError + 1 | class A { + 2 | #a; +> 3 | b = #a + 1; + | ^ Private names are only allowed in property accesses (`obj.#a`) or in `in` expressions (`#a in obj`). (3:6) + 4 | } + 5 | + diff --git a/packages/ast-spec/src/expression/BinaryExpression/fixtures/_error_/private-lhs-not-in/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/expression/BinaryExpression/fixtures/_error_/private-lhs-not-in/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..c95813948827 --- /dev/null +++ b/packages/ast-spec/src/expression/BinaryExpression/fixtures/_error_/private-lhs-not-in/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > BinaryExpression > _error_ > private-lhs-not-in > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/expression/BinaryExpression/fixtures/_error_/private-rhs/fixture.ts b/packages/ast-spec/src/expression/BinaryExpression/fixtures/_error_/private-rhs/fixture.ts new file mode 100644 index 000000000000..ce0e507a49fd --- /dev/null +++ b/packages/ast-spec/src/expression/BinaryExpression/fixtures/_error_/private-rhs/fixture.ts @@ -0,0 +1,4 @@ +class A { + #a; + b = 1 in #a; +} diff --git a/packages/ast-spec/src/expression/BinaryExpression/fixtures/_error_/private-rhs/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/expression/BinaryExpression/fixtures/_error_/private-rhs/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..67636f0e09ec --- /dev/null +++ b/packages/ast-spec/src/expression/BinaryExpression/fixtures/_error_/private-rhs/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,10 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > BinaryExpression > _error_ > private-rhs > TSESTree - Error`] +TSError + 1 | class A { + 2 | #a; +> 3 | b = 1 in #a; + | ^^ Private identifiers are only allowed on the left-hand-side of an 'in' expression. + 4 | } + 5 | diff --git a/packages/ast-spec/src/expression/BinaryExpression/fixtures/_error_/private-rhs/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/BinaryExpression/fixtures/_error_/private-rhs/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..2014af3eb868 --- /dev/null +++ b/packages/ast-spec/src/expression/BinaryExpression/fixtures/_error_/private-rhs/snapshots/2-Babel-Error.shot @@ -0,0 +1,11 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > BinaryExpression > _error_ > private-rhs > Babel - Error`] +BabelError + 1 | class A { + 2 | #a; +> 3 | b = 1 in #a; + | ^ Private names are only allowed in property accesses (`obj.#a`) or in `in` expressions (`#a in obj`). (3:11) + 4 | } + 5 | + diff --git a/packages/ast-spec/src/expression/BinaryExpression/fixtures/_error_/private-rhs/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/expression/BinaryExpression/fixtures/_error_/private-rhs/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..802be146cc95 --- /dev/null +++ b/packages/ast-spec/src/expression/BinaryExpression/fixtures/_error_/private-rhs/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > BinaryExpression > _error_ > private-rhs > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/expression/BinaryExpression/fixtures/private-lhs-in/fixture.ts b/packages/ast-spec/src/expression/BinaryExpression/fixtures/private-lhs-in/fixture.ts new file mode 100644 index 000000000000..f17ec7e20d07 --- /dev/null +++ b/packages/ast-spec/src/expression/BinaryExpression/fixtures/private-lhs-in/fixture.ts @@ -0,0 +1,4 @@ +class A { + #a; + b = #a in A; +} diff --git a/packages/ast-spec/src/expression/BinaryExpression/fixtures/private-lhs-in/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/expression/BinaryExpression/fixtures/private-lhs-in/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..83deb39f58c9 --- /dev/null +++ b/packages/ast-spec/src/expression/BinaryExpression/fixtures/private-lhs-in/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,138 @@ +Program { + type: "Program", + body: [ + ClassDeclaration { + type: "ClassDeclaration", + abstract: false, + body: ClassBody { + type: "ClassBody", + body: [ + PropertyDefinition { + type: "PropertyDefinition", + computed: false, + declare: false, + decorators: [], + definite: false, + key: PrivateIdentifier { + type: "PrivateIdentifier", + name: "a", + + range: [12, 14], + loc: { + start: { column: 2, line: 2 }, + end: { column: 4, line: 2 }, + }, + }, + optional: false, + override: false, + readonly: false, + static: false, + value: null, + + range: [12, 15], + loc: { + start: { column: 2, line: 2 }, + end: { column: 5, line: 2 }, + }, + }, + PropertyDefinition { + type: "PropertyDefinition", + computed: false, + declare: false, + decorators: [], + definite: false, + key: Identifier { + type: "Identifier", + decorators: [], + name: "b", + optional: false, + + range: [18, 19], + loc: { + start: { column: 2, line: 3 }, + end: { column: 3, line: 3 }, + }, + }, + optional: false, + override: false, + readonly: false, + static: false, + value: BinaryExpression { + type: "BinaryExpression", + left: PrivateIdentifier { + type: "PrivateIdentifier", + name: "a", + + range: [22, 24], + loc: { + start: { column: 6, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + operator: "in", + right: Identifier { + type: "Identifier", + decorators: [], + name: "A", + optional: false, + + range: [28, 29], + loc: { + start: { column: 12, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + + range: [22, 29], + loc: { + start: { column: 6, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + + range: [18, 30], + loc: { + start: { column: 2, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + ], + + range: [8, 32], + loc: { + start: { column: 8, line: 1 }, + end: { column: 1, line: 4 }, + }, + }, + declare: false, + decorators: [], + id: Identifier { + type: "Identifier", + decorators: [], + name: "A", + optional: false, + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + implements: [], + superClass: null, + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 4 }, + }, + }, + ], + sourceType: "script", + + range: [0, 33], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 5 }, + }, +} \ No newline at end of file diff --git a/packages/ast-spec/src/expression/BinaryExpression/fixtures/private-lhs-in/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/expression/BinaryExpression/fixtures/private-lhs-in/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..b599e3a8bb83 --- /dev/null +++ b/packages/ast-spec/src/expression/BinaryExpression/fixtures/private-lhs-in/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,122 @@ +[ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "A", + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + PrivateIdentifier { + type: "PrivateIdentifier", + value: "a", + + range: [12, 14], + loc: { + start: { column: 2, line: 2 }, + end: { column: 4, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [14, 15], + loc: { + start: { column: 4, line: 2 }, + end: { column: 5, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "b", + + range: [18, 19], + loc: { + start: { column: 2, line: 3 }, + end: { column: 3, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [20, 21], + loc: { + start: { column: 4, line: 3 }, + end: { column: 5, line: 3 }, + }, + }, + PrivateIdentifier { + type: "PrivateIdentifier", + value: "a", + + range: [22, 24], + loc: { + start: { column: 6, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + Keyword { + type: "Keyword", + value: "in", + + range: [25, 27], + loc: { + start: { column: 9, line: 3 }, + end: { column: 11, line: 3 }, + }, + }, + Identifier { + type: "Identifier", + value: "A", + + range: [28, 29], + loc: { + start: { column: 12, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [29, 30], + loc: { + start: { column: 13, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [31, 32], + loc: { + start: { column: 0, line: 4 }, + end: { column: 1, line: 4 }, + }, + }, +] \ No newline at end of file diff --git a/packages/ast-spec/src/expression/BinaryExpression/fixtures/private-lhs-in/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/expression/BinaryExpression/fixtures/private-lhs-in/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..83deb39f58c9 --- /dev/null +++ b/packages/ast-spec/src/expression/BinaryExpression/fixtures/private-lhs-in/snapshots/3-Babel-AST.shot @@ -0,0 +1,138 @@ +Program { + type: "Program", + body: [ + ClassDeclaration { + type: "ClassDeclaration", + abstract: false, + body: ClassBody { + type: "ClassBody", + body: [ + PropertyDefinition { + type: "PropertyDefinition", + computed: false, + declare: false, + decorators: [], + definite: false, + key: PrivateIdentifier { + type: "PrivateIdentifier", + name: "a", + + range: [12, 14], + loc: { + start: { column: 2, line: 2 }, + end: { column: 4, line: 2 }, + }, + }, + optional: false, + override: false, + readonly: false, + static: false, + value: null, + + range: [12, 15], + loc: { + start: { column: 2, line: 2 }, + end: { column: 5, line: 2 }, + }, + }, + PropertyDefinition { + type: "PropertyDefinition", + computed: false, + declare: false, + decorators: [], + definite: false, + key: Identifier { + type: "Identifier", + decorators: [], + name: "b", + optional: false, + + range: [18, 19], + loc: { + start: { column: 2, line: 3 }, + end: { column: 3, line: 3 }, + }, + }, + optional: false, + override: false, + readonly: false, + static: false, + value: BinaryExpression { + type: "BinaryExpression", + left: PrivateIdentifier { + type: "PrivateIdentifier", + name: "a", + + range: [22, 24], + loc: { + start: { column: 6, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + operator: "in", + right: Identifier { + type: "Identifier", + decorators: [], + name: "A", + optional: false, + + range: [28, 29], + loc: { + start: { column: 12, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + + range: [22, 29], + loc: { + start: { column: 6, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + + range: [18, 30], + loc: { + start: { column: 2, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + ], + + range: [8, 32], + loc: { + start: { column: 8, line: 1 }, + end: { column: 1, line: 4 }, + }, + }, + declare: false, + decorators: [], + id: Identifier { + type: "Identifier", + decorators: [], + name: "A", + optional: false, + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + implements: [], + superClass: null, + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 4 }, + }, + }, + ], + sourceType: "script", + + range: [0, 33], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 5 }, + }, +} \ No newline at end of file diff --git a/packages/ast-spec/src/expression/BinaryExpression/fixtures/private-lhs-in/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/expression/BinaryExpression/fixtures/private-lhs-in/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..b599e3a8bb83 --- /dev/null +++ b/packages/ast-spec/src/expression/BinaryExpression/fixtures/private-lhs-in/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,122 @@ +[ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "A", + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + PrivateIdentifier { + type: "PrivateIdentifier", + value: "a", + + range: [12, 14], + loc: { + start: { column: 2, line: 2 }, + end: { column: 4, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [14, 15], + loc: { + start: { column: 4, line: 2 }, + end: { column: 5, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "b", + + range: [18, 19], + loc: { + start: { column: 2, line: 3 }, + end: { column: 3, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [20, 21], + loc: { + start: { column: 4, line: 3 }, + end: { column: 5, line: 3 }, + }, + }, + PrivateIdentifier { + type: "PrivateIdentifier", + value: "a", + + range: [22, 24], + loc: { + start: { column: 6, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + Keyword { + type: "Keyword", + value: "in", + + range: [25, 27], + loc: { + start: { column: 9, line: 3 }, + end: { column: 11, line: 3 }, + }, + }, + Identifier { + type: "Identifier", + value: "A", + + range: [28, 29], + loc: { + start: { column: 12, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [29, 30], + loc: { + start: { column: 13, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [31, 32], + loc: { + start: { column: 0, line: 4 }, + end: { column: 1, line: 4 }, + }, + }, +] \ No newline at end of file diff --git a/packages/ast-spec/src/expression/BinaryExpression/fixtures/private-lhs-in/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/expression/BinaryExpression/fixtures/private-lhs-in/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..be95b85d8e44 --- /dev/null +++ b/packages/ast-spec/src/expression/BinaryExpression/fixtures/private-lhs-in/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,146 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression BinaryExpression private-lhs-in AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', +- abstract: false, + body: ClassBody { + type: 'ClassBody', + body: Array [ + PropertyDefinition { + type: 'PropertyDefinition', + computed: false, +- declare: false, +- decorators: Array [], +- definite: false, + key: PrivateIdentifier { + type: 'PrivateIdentifier', + name: 'a', + + range: [12, 14], + loc: { + start: { column: 2, line: 2 }, + end: { column: 4, line: 2 }, + }, + }, +- optional: false, +- override: false, +- readonly: false, + static: false, + value: null, + + range: [12, 15], + loc: { + start: { column: 2, line: 2 }, + end: { column: 5, line: 2 }, + }, + }, + PropertyDefinition { + type: 'PropertyDefinition', + computed: false, +- declare: false, +- decorators: Array [], +- definite: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'b', +- optional: false, + + range: [18, 19], + loc: { + start: { column: 2, line: 3 }, + end: { column: 3, line: 3 }, + }, + }, +- optional: false, +- override: false, +- readonly: false, + static: false, + value: BinaryExpression { + type: 'BinaryExpression', + left: PrivateIdentifier { + type: 'PrivateIdentifier', + name: 'a', + + range: [22, 24], + loc: { + start: { column: 6, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + operator: 'in', + right: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'A', +- optional: false, + + range: [28, 29], + loc: { + start: { column: 12, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + + range: [22, 29], + loc: { + start: { column: 6, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + + range: [18, 30], + loc: { + start: { column: 2, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + ], + + range: [8, 32], + loc: { + start: { column: 8, line: 1 }, + end: { column: 1, line: 4 }, + }, + }, +- declare: false, +- decorators: Array [], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'A', +- optional: false, + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, +- implements: Array [], + superClass: null, + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 4 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 33], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 5 }, + }, + }" +`; diff --git a/packages/ast-spec/src/expression/BinaryExpression/fixtures/private-lhs-in/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/expression/BinaryExpression/fixtures/private-lhs-in/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..31764d700643 --- /dev/null +++ b/packages/ast-spec/src/expression/BinaryExpression/fixtures/private-lhs-in/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,136 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression BinaryExpression private-lhs-in AST Alignment - Token 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Array [ + Keyword { + type: 'Keyword', + value: 'class', + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'A', + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '{', + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, +- Identifier { +- type: 'Identifier', +- value: '#a', ++ PrivateIdentifier { ++ type: 'PrivateIdentifier', ++ value: 'a', + + range: [12, 14], + loc: { + start: { column: 2, line: 2 }, + end: { column: 4, line: 2 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ';', + + range: [14, 15], + loc: { + start: { column: 4, line: 2 }, + end: { column: 5, line: 2 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'b', + + range: [18, 19], + loc: { + start: { column: 2, line: 3 }, + end: { column: 3, line: 3 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '=', + + range: [20, 21], + loc: { + start: { column: 4, line: 3 }, + end: { column: 5, line: 3 }, + }, + }, +- Identifier { +- type: 'Identifier', +- value: '#a', ++ PrivateIdentifier { ++ type: 'PrivateIdentifier', ++ value: 'a', + + range: [22, 24], + loc: { + start: { column: 6, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + Keyword { + type: 'Keyword', + value: 'in', + + range: [25, 27], + loc: { + start: { column: 9, line: 3 }, + end: { column: 11, line: 3 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'A', + + range: [28, 29], + loc: { + start: { column: 12, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ';', + + range: [29, 30], + loc: { + start: { column: 13, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '}', + + range: [31, 32], + loc: { + start: { column: 0, line: 4 }, + end: { column: 1, line: 4 }, + }, + }, + ]" +`; diff --git a/packages/ast-spec/src/expression/BinaryExpression/spec.ts b/packages/ast-spec/src/expression/BinaryExpression/spec.ts index 6c262d443064..874df2c6d586 100644 --- a/packages/ast-spec/src/expression/BinaryExpression/spec.ts +++ b/packages/ast-spec/src/expression/BinaryExpression/spec.ts @@ -7,9 +7,18 @@ import type { BinaryOperatorToText } from './BinaryOperatorToText'; export * from './BinaryOperatorToText'; -export interface BinaryExpression extends BaseNode { +export interface PrivateInExpression extends BaseNode { type: AST_NODE_TYPES.BinaryExpression; - left: Expression | PrivateIdentifier; + left: PrivateIdentifier; + operator: 'in'; + right: Expression; +} + +export interface SymmetricBinaryExpression extends BaseNode { + type: AST_NODE_TYPES.BinaryExpression; + left: Expression; operator: ValueOf; right: Expression; } + +export type BinaryExpression = PrivateInExpression | SymmetricBinaryExpression; diff --git a/packages/ast-spec/src/expression/ImportExpression/fixtures/_error_/extra-arguments/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/ImportExpression/fixtures/_error_/extra-arguments/snapshots/2-Babel-Error.shot index e172a1d225d5..0cf17825f8a7 100644 --- a/packages/ast-spec/src/expression/ImportExpression/fixtures/_error_/extra-arguments/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/expression/ImportExpression/fixtures/_error_/extra-arguments/snapshots/2-Babel-Error.shot @@ -1,4 +1,10 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > expression > ImportExpression > _error_ > extra-arguments > Babel - Error`] -SyntaxError: `import()` requires exactly one or two arguments. (1:0) +BabelError +> 1 | import( + | ^ `import()` requires exactly one or two arguments. (1:0) + 2 | "./source.json", + 3 | {assert: {type: "json"}}, + 4 | extraArgument + diff --git a/packages/ast-spec/src/expression/ImportExpression/fixtures/_error_/no-arguments/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/ImportExpression/fixtures/_error_/no-arguments/snapshots/2-Babel-Error.shot index 6fb52dd6f0b0..24bd7006421a 100644 --- a/packages/ast-spec/src/expression/ImportExpression/fixtures/_error_/no-arguments/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/expression/ImportExpression/fixtures/_error_/no-arguments/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > expression > ImportExpression > _error_ > no-arguments > Babel - Error`] -SyntaxError: `import()` requires exactly one or two arguments. (1:0) +BabelError +> 1 | import(); + | ^ `import()` requires exactly one or two arguments. (1:0) + 2 | + diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-abstract/fixture.ts b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-abstract/fixture.ts new file mode 100644 index 000000000000..7da365aa96dc --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-abstract/fixture.ts @@ -0,0 +1 @@ +({abstract get getter(){}}) diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-abstract/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-abstract/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..c6b3818e424f --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-abstract/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,7 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > getter-modifier-abstract > TSESTree - Error`] +TSError +> 1 | ({abstract get getter(){}}) + | ^^^^^^ An abstract accessor cannot have an implementation. + 2 | diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-abstract/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-abstract/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..8c1fc8d18638 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-abstract/snapshots/2-Babel-Error.shot @@ -0,0 +1,8 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > getter-modifier-abstract > Babel - Error`] +BabelError +> 1 | ({abstract get getter(){}}) + | ^ Unexpected token, expected "," (1:11) + 2 | + diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-abstract/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-abstract/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..f5385a54f496 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-abstract/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > getter-modifier-abstract > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-async/fixture.ts b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-async/fixture.ts new file mode 100644 index 000000000000..503e02f960ae --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-async/fixture.ts @@ -0,0 +1 @@ +({async get getter(){}}) diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-async/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-async/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..469f62b8e05e --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-async/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,7 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > getter-modifier-async > TSESTree - Error`] +TSError +> 1 | ({async get getter(){}}) + | ^^^^^ 'async' modifier cannot be used here. + 2 | diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-async/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-async/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..21344f041c47 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-async/snapshots/2-Babel-Error.shot @@ -0,0 +1,8 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > getter-modifier-async > Babel - Error`] +BabelError +> 1 | ({async get getter(){}}) + | ^ Unexpected token, expected "(" (1:12) + 2 | + diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-async/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-async/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..f37cf0b5cb71 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-async/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > getter-modifier-async > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-declare/fixture.ts b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-declare/fixture.ts new file mode 100644 index 000000000000..c4665dca5599 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-declare/fixture.ts @@ -0,0 +1 @@ +({declare get getter(){}}) diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-declare/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-declare/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..3be473c2e955 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-declare/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > getter-modifier-declare > TSESTree - Error`] +NO ERROR diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-declare/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-declare/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..89aa85c1528a --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-declare/snapshots/2-Babel-Error.shot @@ -0,0 +1,8 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > getter-modifier-declare > Babel - Error`] +BabelError +> 1 | ({declare get getter(){}}) + | ^ Unexpected token, expected "," (1:10) + 2 | + diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-declare/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-declare/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..fe62478d60e3 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-declare/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > getter-modifier-declare > Error Alignment`] +Babel errored but TSESTree didn't diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-export/fixture.ts b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-export/fixture.ts new file mode 100644 index 000000000000..49c45b221289 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-export/fixture.ts @@ -0,0 +1 @@ +({export get getter(){}}) diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-export/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-export/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..04a140d4a86a --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-export/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > getter-modifier-export > TSESTree - Error`] +NO ERROR diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-export/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-export/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..43fd96f8211f --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-export/snapshots/2-Babel-Error.shot @@ -0,0 +1,8 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > getter-modifier-export > Babel - Error`] +BabelError +> 1 | ({export get getter(){}}) + | ^ Unexpected keyword 'export'. (1:2) + 2 | + diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-export/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-export/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..2630e9395407 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-export/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > getter-modifier-export > Error Alignment`] +Babel errored but TSESTree didn't diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-override/fixture.ts b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-override/fixture.ts new file mode 100644 index 000000000000..9c38112689a7 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-override/fixture.ts @@ -0,0 +1 @@ +({override get getter(){}}) diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-override/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-override/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..bd0dd27042de --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-override/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > getter-modifier-override > TSESTree - Error`] +NO ERROR diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-override/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-override/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..3cd034d0f848 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-override/snapshots/2-Babel-Error.shot @@ -0,0 +1,8 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > getter-modifier-override > Babel - Error`] +BabelError +> 1 | ({override get getter(){}}) + | ^ Unexpected token, expected "," (1:11) + 2 | + diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-override/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-override/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..67072b96a25f --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-override/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > getter-modifier-override > Error Alignment`] +Babel errored but TSESTree didn't diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-private/fixture.ts b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-private/fixture.ts new file mode 100644 index 000000000000..8c3c3f387734 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-private/fixture.ts @@ -0,0 +1 @@ +({private get getter(){}}) diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-private/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-private/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..2a95a795d410 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-private/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > getter-modifier-private > TSESTree - Error`] +NO ERROR diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-private/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-private/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..ad8f34751b30 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-private/snapshots/2-Babel-Error.shot @@ -0,0 +1,8 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > getter-modifier-private > Babel - Error`] +BabelError +> 1 | ({private get getter(){}}) + | ^ Unexpected reserved word 'private'. (1:2) + 2 | + diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-private/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-private/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..e5449cb3d436 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-private/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > getter-modifier-private > Error Alignment`] +Babel errored but TSESTree didn't diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-protected/fixture.ts b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-protected/fixture.ts new file mode 100644 index 000000000000..f6182886cf4b --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-protected/fixture.ts @@ -0,0 +1 @@ +({protected get getter(){}}) diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-protected/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-protected/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..5a842187ab8b --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-protected/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > getter-modifier-protected > TSESTree - Error`] +NO ERROR diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-protected/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-protected/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..f50ad9df0644 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-protected/snapshots/2-Babel-Error.shot @@ -0,0 +1,8 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > getter-modifier-protected > Babel - Error`] +BabelError +> 1 | ({protected get getter(){}}) + | ^ Unexpected reserved word 'protected'. (1:2) + 2 | + diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-protected/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-protected/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..d3a451a6f34a --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-protected/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > getter-modifier-protected > Error Alignment`] +Babel errored but TSESTree didn't diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-public/fixture.ts b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-public/fixture.ts new file mode 100644 index 000000000000..d168f83f4877 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-public/fixture.ts @@ -0,0 +1 @@ +({public get getter(){}}) diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-public/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-public/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..c77a8e8fcb1f --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-public/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > getter-modifier-public > TSESTree - Error`] +NO ERROR diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-public/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-public/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..a0bfd54c27b9 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-public/snapshots/2-Babel-Error.shot @@ -0,0 +1,8 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > getter-modifier-public > Babel - Error`] +BabelError +> 1 | ({public get getter(){}}) + | ^ Unexpected reserved word 'public'. (1:2) + 2 | + diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-public/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-public/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..b9cf0e7bb818 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-public/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > getter-modifier-public > Error Alignment`] +Babel errored but TSESTree didn't diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-static/fixture.ts b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-static/fixture.ts new file mode 100644 index 000000000000..f783949c9c17 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-static/fixture.ts @@ -0,0 +1 @@ +({static get getter(){}}) diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-static/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-static/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..e119aa3d2ea1 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-static/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > getter-modifier-static > TSESTree - Error`] +NO ERROR diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-static/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-static/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..7a4f79268aa6 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-static/snapshots/2-Babel-Error.shot @@ -0,0 +1,8 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > getter-modifier-static > Babel - Error`] +BabelError +> 1 | ({static get getter(){}}) + | ^ Unexpected reserved word 'static'. (1:2) + 2 | + diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-static/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-static/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..dbd2ec6c9b39 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/getter-modifier-static/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > getter-modifier-static > Error Alignment`] +Babel errored but TSESTree didn't diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-abstract/fixture.ts b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-abstract/fixture.ts new file mode 100644 index 000000000000..8d7ba0694b01 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-abstract/fixture.ts @@ -0,0 +1 @@ +({abstract method(){}}) diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-abstract/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-abstract/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..2a9157795088 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-abstract/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,7 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > method-modifier-abstract > TSESTree - Error`] +TSError +> 1 | ({abstract method(){}}) + | ^^^^^^^^ 'abstract' modifier cannot be used here. + 2 | diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-abstract/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-abstract/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..36577e2c3b93 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-abstract/snapshots/2-Babel-Error.shot @@ -0,0 +1,8 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > method-modifier-abstract > Babel - Error`] +BabelError +> 1 | ({abstract method(){}}) + | ^ Unexpected token, expected "," (1:11) + 2 | + diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-abstract/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-abstract/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..69159de758f3 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-abstract/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > method-modifier-abstract > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-declare/fixture.ts b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-declare/fixture.ts new file mode 100644 index 000000000000..d04b737ea44c --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-declare/fixture.ts @@ -0,0 +1 @@ +({declare method(){}}) diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-declare/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-declare/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..98198fa601fb --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-declare/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,7 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > method-modifier-declare > TSESTree - Error`] +TSError +> 1 | ({declare method(){}}) + | ^^^^^^^ 'declare' modifier cannot be used here. + 2 | diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-declare/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-declare/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..8a265181dc1b --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-declare/snapshots/2-Babel-Error.shot @@ -0,0 +1,8 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > method-modifier-declare > Babel - Error`] +BabelError +> 1 | ({declare method(){}}) + | ^ Unexpected token, expected "," (1:10) + 2 | + diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-declare/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-declare/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..cb8d4e5a8d3e --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-declare/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > method-modifier-declare > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-export/fixture.ts b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-export/fixture.ts new file mode 100644 index 000000000000..53ce4bbc923f --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-export/fixture.ts @@ -0,0 +1 @@ +({export method(){}}) diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-export/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-export/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..f5c77f873fcf --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-export/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,7 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > method-modifier-export > TSESTree - Error`] +TSError +> 1 | ({export method(){}}) + | ^^^^^^ 'export' modifier cannot be used here. + 2 | diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-export/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-export/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..40acbd491c03 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-export/snapshots/2-Babel-Error.shot @@ -0,0 +1,8 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > method-modifier-export > Babel - Error`] +BabelError +> 1 | ({export method(){}}) + | ^ Unexpected keyword 'export'. (1:2) + 2 | + diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-export/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-export/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..2af6c62d78e0 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-export/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > method-modifier-export > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-override/fixture.ts b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-override/fixture.ts new file mode 100644 index 000000000000..f4a1f8044de5 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-override/fixture.ts @@ -0,0 +1 @@ +({override method(){}}) diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-override/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-override/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..9132d6be3aa1 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-override/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,7 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > method-modifier-override > TSESTree - Error`] +TSError +> 1 | ({override method(){}}) + | ^^^^^^^^ 'override' modifier cannot be used here. + 2 | diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-override/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-override/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..dc144f96e410 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-override/snapshots/2-Babel-Error.shot @@ -0,0 +1,8 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > method-modifier-override > Babel - Error`] +BabelError +> 1 | ({override method(){}}) + | ^ Unexpected token, expected "," (1:11) + 2 | + diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-override/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-override/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..740638b17ca9 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-override/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > method-modifier-override > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-private/fixture.ts b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-private/fixture.ts new file mode 100644 index 000000000000..17216fafa6ba --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-private/fixture.ts @@ -0,0 +1 @@ +({private method(){}}) diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-private/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-private/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..94c0b2b78538 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-private/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,7 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > method-modifier-private > TSESTree - Error`] +TSError +> 1 | ({private method(){}}) + | ^^^^^^^ 'private' modifier cannot be used here. + 2 | diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-private/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-private/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..efc040b8e2b4 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-private/snapshots/2-Babel-Error.shot @@ -0,0 +1,8 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > method-modifier-private > Babel - Error`] +BabelError +> 1 | ({private method(){}}) + | ^ Unexpected reserved word 'private'. (1:2) + 2 | + diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-private/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-private/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..bf509a674a8c --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-private/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > method-modifier-private > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-protected/fixture.ts b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-protected/fixture.ts new file mode 100644 index 000000000000..d0b475ae7b53 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-protected/fixture.ts @@ -0,0 +1 @@ +({protected method(){}}) diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-protected/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-protected/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..537e86f8b7e8 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-protected/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,7 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > method-modifier-protected > TSESTree - Error`] +TSError +> 1 | ({protected method(){}}) + | ^^^^^^^^^ 'protected' modifier cannot be used here. + 2 | diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-protected/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-protected/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..1ada22fc7d6c --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-protected/snapshots/2-Babel-Error.shot @@ -0,0 +1,8 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > method-modifier-protected > Babel - Error`] +BabelError +> 1 | ({protected method(){}}) + | ^ Unexpected reserved word 'protected'. (1:2) + 2 | + diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-protected/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-protected/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..756b258562c3 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-protected/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > method-modifier-protected > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-public/fixture.ts b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-public/fixture.ts new file mode 100644 index 000000000000..71ae66b69227 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-public/fixture.ts @@ -0,0 +1 @@ +({public method(){}}) diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-public/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-public/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..3b0a6228b3bf --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-public/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,7 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > method-modifier-public > TSESTree - Error`] +TSError +> 1 | ({public method(){}}) + | ^^^^^^ 'public' modifier cannot be used here. + 2 | diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-public/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-public/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..0e7d870a4cdb --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-public/snapshots/2-Babel-Error.shot @@ -0,0 +1,8 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > method-modifier-public > Babel - Error`] +BabelError +> 1 | ({public method(){}}) + | ^ Unexpected reserved word 'public'. (1:2) + 2 | + diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-public/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-public/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..c4b3fe4fd6df --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-public/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > method-modifier-public > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-static/fixture.ts b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-static/fixture.ts new file mode 100644 index 000000000000..4327f0fc0277 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-static/fixture.ts @@ -0,0 +1 @@ +({static method(){}}) diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-static/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-static/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..462a18ebf56e --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-static/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,7 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > method-modifier-static > TSESTree - Error`] +TSError +> 1 | ({static method(){}}) + | ^^^^^^ 'static' modifier cannot be used here. + 2 | diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-static/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-static/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..ab26c91ba108 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-static/snapshots/2-Babel-Error.shot @@ -0,0 +1,8 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > method-modifier-static > Babel - Error`] +BabelError +> 1 | ({static method(){}}) + | ^ Unexpected reserved word 'static'. (1:2) + 2 | + diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-static/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-static/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..901470979766 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/method-modifier-static/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > method-modifier-static > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-getter-body/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-getter-body/snapshots/2-Babel-Error.shot index 75be7695d3c1..f008887400ca 100644 --- a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-getter-body/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-getter-body/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > expression > ObjectExpression > _error_ > missing-getter-body > Babel - Error`] -SyntaxError: Unexpected token, expected "{" (1:11) +BabelError +> 1 | ({get foo();}) + | ^ Unexpected token, expected "{" (1:11) + 2 | + diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-method-body/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-method-body/snapshots/2-Babel-Error.shot index 63c0979436ab..f88ac257cfaf 100644 --- a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-method-body/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-method-body/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > expression > ObjectExpression > _error_ > missing-method-body > Babel - Error`] -SyntaxError: Unexpected token, expected "{" (1:10) +BabelError +> 1 | ({method();}) + | ^ Unexpected token, expected "{" (1:10) + 2 | + diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-setter-body/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-setter-body/snapshots/2-Babel-Error.shot index 2f6b7b23b6b4..1414079b7aed 100644 --- a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-setter-body/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-setter-body/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > expression > ObjectExpression > _error_ > missing-setter-body > Babel - Error`] -SyntaxError: Unexpected token, expected "{" (1:16) +BabelError +> 1 | ({set foo(value);}) + | ^ Unexpected token, expected "{" (1:16) + 2 | + diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-abstract/fixture.ts b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-abstract/fixture.ts new file mode 100644 index 000000000000..5a91f9a97b8c --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-abstract/fixture.ts @@ -0,0 +1 @@ +({abstract property: 1}) diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-abstract/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-abstract/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..3fde78482148 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-abstract/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > property-modifier-abstract > TSESTree - Error`] +NO ERROR diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-abstract/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-abstract/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..7a92a736eb21 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-abstract/snapshots/2-Babel-Error.shot @@ -0,0 +1,8 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > property-modifier-abstract > Babel - Error`] +BabelError +> 1 | ({abstract property: 1}) + | ^ Unexpected token, expected "," (1:11) + 2 | + diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-abstract/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-abstract/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..7e13c1111604 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-abstract/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > property-modifier-abstract > Error Alignment`] +Babel errored but TSESTree didn't diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-async/fixture.ts b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-async/fixture.ts new file mode 100644 index 000000000000..9b6990e1578c --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-async/fixture.ts @@ -0,0 +1 @@ +({async property: 1}) diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-async/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-async/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..083a82058ab1 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-async/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > property-modifier-async > TSESTree - Error`] +NO ERROR diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-async/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-async/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..6e65e9380954 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-async/snapshots/2-Babel-Error.shot @@ -0,0 +1,8 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > property-modifier-async > Babel - Error`] +BabelError +> 1 | ({async property: 1}) + | ^ Unexpected token, expected "(" (1:16) + 2 | + diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-async/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-async/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..210d506718ef --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-async/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > property-modifier-async > Error Alignment`] +Babel errored but TSESTree didn't diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-declare/fixture.ts b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-declare/fixture.ts new file mode 100644 index 000000000000..ab759d58ee6b --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-declare/fixture.ts @@ -0,0 +1 @@ +({declare property: 1}) diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-declare/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-declare/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..db7a3ac5dc66 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-declare/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > property-modifier-declare > TSESTree - Error`] +NO ERROR diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-declare/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-declare/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..1566801a28d7 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-declare/snapshots/2-Babel-Error.shot @@ -0,0 +1,8 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > property-modifier-declare > Babel - Error`] +BabelError +> 1 | ({declare property: 1}) + | ^ Unexpected token, expected "," (1:10) + 2 | + diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-declare/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-declare/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..6c5dc1bac93d --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-declare/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > property-modifier-declare > Error Alignment`] +Babel errored but TSESTree didn't diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-export/fixture.ts b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-export/fixture.ts new file mode 100644 index 000000000000..de0b9ac7be0e --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-export/fixture.ts @@ -0,0 +1 @@ +({export property: 1}) diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-export/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-export/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..1763adeb0c88 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-export/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > property-modifier-export > TSESTree - Error`] +NO ERROR diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-export/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-export/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..791277f74ff2 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-export/snapshots/2-Babel-Error.shot @@ -0,0 +1,8 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > property-modifier-export > Babel - Error`] +BabelError +> 1 | ({export property: 1}) + | ^ Unexpected keyword 'export'. (1:2) + 2 | + diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-export/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-export/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..042904f5eb84 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-export/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > property-modifier-export > Error Alignment`] +Babel errored but TSESTree didn't diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-override/fixture.ts b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-override/fixture.ts new file mode 100644 index 000000000000..c31d3bf6e27a --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-override/fixture.ts @@ -0,0 +1 @@ +({override property: 1}) diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-override/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-override/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..1e13125b9002 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-override/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > property-modifier-override > TSESTree - Error`] +NO ERROR diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-override/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-override/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..1e14511997de --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-override/snapshots/2-Babel-Error.shot @@ -0,0 +1,8 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > property-modifier-override > Babel - Error`] +BabelError +> 1 | ({override property: 1}) + | ^ Unexpected token, expected "," (1:11) + 2 | + diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-override/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-override/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..ad900508147d --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-override/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > property-modifier-override > Error Alignment`] +Babel errored but TSESTree didn't diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-private/fixture.ts b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-private/fixture.ts new file mode 100644 index 000000000000..463b7c4ab593 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-private/fixture.ts @@ -0,0 +1 @@ +({private property: 1}) diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-private/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-private/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..3dfdac48c91f --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-private/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > property-modifier-private > TSESTree - Error`] +NO ERROR diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-private/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-private/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..490659356138 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-private/snapshots/2-Babel-Error.shot @@ -0,0 +1,8 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > property-modifier-private > Babel - Error`] +BabelError +> 1 | ({private property: 1}) + | ^ Unexpected reserved word 'private'. (1:2) + 2 | + diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-private/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-private/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..ac6b919842ba --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-private/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > property-modifier-private > Error Alignment`] +Babel errored but TSESTree didn't diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-protected/fixture.ts b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-protected/fixture.ts new file mode 100644 index 000000000000..bcffd32f4654 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-protected/fixture.ts @@ -0,0 +1 @@ +({protected property: 1}) diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-protected/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-protected/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..22fe1acfb0cb --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-protected/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > property-modifier-protected > TSESTree - Error`] +NO ERROR diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-protected/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-protected/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..d3c7faa9ff5c --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-protected/snapshots/2-Babel-Error.shot @@ -0,0 +1,8 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > property-modifier-protected > Babel - Error`] +BabelError +> 1 | ({protected property: 1}) + | ^ Unexpected reserved word 'protected'. (1:2) + 2 | + diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-protected/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-protected/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..d9b57268bc1f --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-protected/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > property-modifier-protected > Error Alignment`] +Babel errored but TSESTree didn't diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-public/fixture.ts b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-public/fixture.ts new file mode 100644 index 000000000000..d0bdb34d9222 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-public/fixture.ts @@ -0,0 +1 @@ +({public property: 1}) diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-public/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-public/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..ea015d3e6ff5 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-public/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > property-modifier-public > TSESTree - Error`] +NO ERROR diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-public/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-public/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..5bfdabbf290e --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-public/snapshots/2-Babel-Error.shot @@ -0,0 +1,8 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > property-modifier-public > Babel - Error`] +BabelError +> 1 | ({public property: 1}) + | ^ Unexpected reserved word 'public'. (1:2) + 2 | + diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-public/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-public/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..37db719aafbe --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-public/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > property-modifier-public > Error Alignment`] +Babel errored but TSESTree didn't diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-static/fixture.ts b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-static/fixture.ts new file mode 100644 index 000000000000..7b8844223f9d --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-static/fixture.ts @@ -0,0 +1 @@ +({static property: 1}) diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-static/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-static/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..9cddb615c99a --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-static/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > property-modifier-static > TSESTree - Error`] +NO ERROR diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-static/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-static/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..9f748a2d8d56 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-static/snapshots/2-Babel-Error.shot @@ -0,0 +1,8 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > property-modifier-static > Babel - Error`] +BabelError +> 1 | ({static property: 1}) + | ^ Unexpected reserved word 'static'. (1:2) + 2 | + diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-static/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-static/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..04df46c94c5c --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/property-modifier-static/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > property-modifier-static > Error Alignment`] +Babel errored but TSESTree didn't diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-abstract/fixture.ts b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-abstract/fixture.ts new file mode 100644 index 000000000000..b6ab4dcdf39b --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-abstract/fixture.ts @@ -0,0 +1 @@ +({abstract set setter(v){}}) diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-abstract/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-abstract/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..a8576b829681 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-abstract/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,7 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > setter-modifier-abstract > TSESTree - Error`] +TSError +> 1 | ({abstract set setter(v){}}) + | ^^^^^^ An abstract accessor cannot have an implementation. + 2 | diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-abstract/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-abstract/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..aa2f22b8ab88 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-abstract/snapshots/2-Babel-Error.shot @@ -0,0 +1,8 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > setter-modifier-abstract > Babel - Error`] +BabelError +> 1 | ({abstract set setter(v){}}) + | ^ Unexpected token, expected "," (1:11) + 2 | + diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-abstract/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-abstract/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..555eb1dcb596 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-abstract/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > setter-modifier-abstract > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-async/fixture.ts b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-async/fixture.ts new file mode 100644 index 000000000000..b7d58fc71cc9 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-async/fixture.ts @@ -0,0 +1 @@ +({async set setter(v){}}) diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-async/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-async/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..5040e61ae271 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-async/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,7 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > setter-modifier-async > TSESTree - Error`] +TSError +> 1 | ({async set setter(v){}}) + | ^^^^^ 'async' modifier cannot be used here. + 2 | diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-async/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-async/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..1ea7c6ed8f91 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-async/snapshots/2-Babel-Error.shot @@ -0,0 +1,8 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > setter-modifier-async > Babel - Error`] +BabelError +> 1 | ({async set setter(v){}}) + | ^ Unexpected token, expected "(" (1:12) + 2 | + diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-async/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-async/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..3e5b8ccf4efc --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-async/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > setter-modifier-async > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-declare/fixture.ts b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-declare/fixture.ts new file mode 100644 index 000000000000..6bcb875be849 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-declare/fixture.ts @@ -0,0 +1 @@ +({declare set setter(v){}}) diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-declare/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-declare/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..cf76a53db090 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-declare/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > setter-modifier-declare > TSESTree - Error`] +NO ERROR diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-declare/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-declare/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..067419e5adbb --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-declare/snapshots/2-Babel-Error.shot @@ -0,0 +1,8 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > setter-modifier-declare > Babel - Error`] +BabelError +> 1 | ({declare set setter(v){}}) + | ^ Unexpected token, expected "," (1:10) + 2 | + diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-declare/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-declare/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..48b461cd66d9 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-declare/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > setter-modifier-declare > Error Alignment`] +Babel errored but TSESTree didn't diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-export/fixture.ts b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-export/fixture.ts new file mode 100644 index 000000000000..f7d4ca9236af --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-export/fixture.ts @@ -0,0 +1 @@ +({export set setter(v){}}) diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-export/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-export/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..0683934ea344 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-export/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > setter-modifier-export > TSESTree - Error`] +NO ERROR diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-export/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-export/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..6cc5ed90ad4e --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-export/snapshots/2-Babel-Error.shot @@ -0,0 +1,8 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > setter-modifier-export > Babel - Error`] +BabelError +> 1 | ({export set setter(v){}}) + | ^ Unexpected keyword 'export'. (1:2) + 2 | + diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-export/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-export/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..3f52b9168036 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-export/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > setter-modifier-export > Error Alignment`] +Babel errored but TSESTree didn't diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-override/fixture.ts b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-override/fixture.ts new file mode 100644 index 000000000000..eeafc1fea1ad --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-override/fixture.ts @@ -0,0 +1 @@ +({override set setter(v){}}) diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-override/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-override/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..ab027e28bbfd --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-override/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > setter-modifier-override > TSESTree - Error`] +NO ERROR diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-override/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-override/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..f40423fb0984 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-override/snapshots/2-Babel-Error.shot @@ -0,0 +1,8 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > setter-modifier-override > Babel - Error`] +BabelError +> 1 | ({override set setter(v){}}) + | ^ Unexpected token, expected "," (1:11) + 2 | + diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-override/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-override/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..3c28691efdd0 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-override/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > setter-modifier-override > Error Alignment`] +Babel errored but TSESTree didn't diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-private/fixture.ts b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-private/fixture.ts new file mode 100644 index 000000000000..f81f8fa55022 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-private/fixture.ts @@ -0,0 +1 @@ +({private set setter(v){}}) diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-private/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-private/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..bad8df2cd939 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-private/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > setter-modifier-private > TSESTree - Error`] +NO ERROR diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-private/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-private/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..65345de45e99 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-private/snapshots/2-Babel-Error.shot @@ -0,0 +1,8 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > setter-modifier-private > Babel - Error`] +BabelError +> 1 | ({private set setter(v){}}) + | ^ Unexpected reserved word 'private'. (1:2) + 2 | + diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-private/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-private/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..5601896eea99 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-private/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > setter-modifier-private > Error Alignment`] +Babel errored but TSESTree didn't diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-protected/fixture.ts b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-protected/fixture.ts new file mode 100644 index 000000000000..32b267e2189a --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-protected/fixture.ts @@ -0,0 +1 @@ +({protected set setter(v){}}) diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-protected/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-protected/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..5e6e7e168fe2 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-protected/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > setter-modifier-protected > TSESTree - Error`] +NO ERROR diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-protected/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-protected/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..82cf31f6cf35 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-protected/snapshots/2-Babel-Error.shot @@ -0,0 +1,8 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > setter-modifier-protected > Babel - Error`] +BabelError +> 1 | ({protected set setter(v){}}) + | ^ Unexpected reserved word 'protected'. (1:2) + 2 | + diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-protected/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-protected/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..5085cb1873b3 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-protected/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > setter-modifier-protected > Error Alignment`] +Babel errored but TSESTree didn't diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-public/fixture.ts b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-public/fixture.ts new file mode 100644 index 000000000000..7949d3875d67 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-public/fixture.ts @@ -0,0 +1 @@ +({public set setter(v){}}) diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-public/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-public/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..efd2d846400f --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-public/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > setter-modifier-public > TSESTree - Error`] +NO ERROR diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-public/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-public/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..6be782e5749f --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-public/snapshots/2-Babel-Error.shot @@ -0,0 +1,8 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > setter-modifier-public > Babel - Error`] +BabelError +> 1 | ({public set setter(v){}}) + | ^ Unexpected reserved word 'public'. (1:2) + 2 | + diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-public/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-public/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..48db772cb684 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-public/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > setter-modifier-public > Error Alignment`] +Babel errored but TSESTree didn't diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-static/fixture.ts b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-static/fixture.ts new file mode 100644 index 000000000000..df98c494c04d --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-static/fixture.ts @@ -0,0 +1 @@ +({static set setter(v){}}) diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-static/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-static/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..9c69f633480d --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-static/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > setter-modifier-static > TSESTree - Error`] +NO ERROR diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-static/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-static/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..98ec583edf82 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-static/snapshots/2-Babel-Error.shot @@ -0,0 +1,8 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > setter-modifier-static > Babel - Error`] +BabelError +> 1 | ({static set setter(v){}}) + | ^ Unexpected reserved word 'static'. (1:2) + 2 | + diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-static/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-static/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..75f0064be033 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/setter-modifier-static/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > ObjectExpression > _error_ > setter-modifier-static > Error Alignment`] +Babel errored but TSESTree didn't diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/method-modifier-async/fixture.ts b/packages/ast-spec/src/expression/ObjectExpression/fixtures/method-modifier-async/fixture.ts new file mode 100644 index 000000000000..29ec8ac274e0 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/method-modifier-async/fixture.ts @@ -0,0 +1 @@ +({ async method() {} }); diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/method-modifier-async/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/method-modifier-async/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..c6ed369c1008 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/method-modifier-async/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,83 @@ +Program { + type: "Program", + body: [ + ExpressionStatement { + type: "ExpressionStatement", + expression: ObjectExpression { + type: "ObjectExpression", + properties: [ + Property { + type: "Property", + computed: false, + key: Identifier { + type: "Identifier", + decorators: [], + name: "method", + optional: false, + + range: [9, 15], + loc: { + start: { column: 9, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + kind: "init", + method: true, + optional: false, + shorthand: false, + value: FunctionExpression { + type: "FunctionExpression", + async: true, + body: BlockStatement { + type: "BlockStatement", + body: [], + + range: [18, 20], + loc: { + start: { column: 18, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + declare: false, + expression: false, + generator: false, + id: null, + params: [], + + range: [15, 20], + loc: { + start: { column: 15, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + + range: [3, 20], + loc: { + start: { column: 3, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + ], + + range: [1, 22], + loc: { + start: { column: 1, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 25], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} \ No newline at end of file diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/method-modifier-async/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/method-modifier-async/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..99aed7b8b364 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/method-modifier-async/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,112 @@ +[ + Punctuator { + type: "Punctuator", + value: "(", + + range: [0, 1], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [1, 2], + loc: { + start: { column: 1, line: 1 }, + end: { column: 2, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "async", + + range: [3, 8], + loc: { + start: { column: 3, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "method", + + range: [9, 15], + loc: { + start: { column: 9, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [16, 17], + loc: { + start: { column: 16, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [22, 23], + loc: { + start: { column: 22, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [23, 24], + loc: { + start: { column: 23, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, +] \ No newline at end of file diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/method-modifier-async/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/method-modifier-async/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..c6ed369c1008 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/method-modifier-async/snapshots/3-Babel-AST.shot @@ -0,0 +1,83 @@ +Program { + type: "Program", + body: [ + ExpressionStatement { + type: "ExpressionStatement", + expression: ObjectExpression { + type: "ObjectExpression", + properties: [ + Property { + type: "Property", + computed: false, + key: Identifier { + type: "Identifier", + decorators: [], + name: "method", + optional: false, + + range: [9, 15], + loc: { + start: { column: 9, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + kind: "init", + method: true, + optional: false, + shorthand: false, + value: FunctionExpression { + type: "FunctionExpression", + async: true, + body: BlockStatement { + type: "BlockStatement", + body: [], + + range: [18, 20], + loc: { + start: { column: 18, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + declare: false, + expression: false, + generator: false, + id: null, + params: [], + + range: [15, 20], + loc: { + start: { column: 15, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + + range: [3, 20], + loc: { + start: { column: 3, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + ], + + range: [1, 22], + loc: { + start: { column: 1, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 25], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} \ No newline at end of file diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/method-modifier-async/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/method-modifier-async/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..99aed7b8b364 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/method-modifier-async/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,112 @@ +[ + Punctuator { + type: "Punctuator", + value: "(", + + range: [0, 1], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [1, 2], + loc: { + start: { column: 1, line: 1 }, + end: { column: 2, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "async", + + range: [3, 8], + loc: { + start: { column: 3, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "method", + + range: [9, 15], + loc: { + start: { column: 9, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [16, 17], + loc: { + start: { column: 16, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [22, 23], + loc: { + start: { column: 22, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [23, 24], + loc: { + start: { column: 23, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, +] \ No newline at end of file diff --git a/packages/ast-spec/src/expression/SequenceExpression/fixtures/_error_/private-id-lhs/fixture.ts b/packages/ast-spec/src/expression/SequenceExpression/fixtures/_error_/private-id-lhs/fixture.ts new file mode 100644 index 000000000000..402329cc285f --- /dev/null +++ b/packages/ast-spec/src/expression/SequenceExpression/fixtures/_error_/private-id-lhs/fixture.ts @@ -0,0 +1,4 @@ +class A { + #a; + c = (#a, 1); +} diff --git a/packages/ast-spec/src/expression/SequenceExpression/fixtures/_error_/private-id-lhs/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/expression/SequenceExpression/fixtures/_error_/private-id-lhs/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..ba6e5a7a7e5f --- /dev/null +++ b/packages/ast-spec/src/expression/SequenceExpression/fixtures/_error_/private-id-lhs/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,10 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > SequenceExpression > _error_ > private-id-lhs > TSESTree - Error`] +TSError + 1 | class A { + 2 | #a; +> 3 | c = (#a, 1); + | ^^ Private identifiers cannot appear on the right-hand-side of an 'in' expression. + 4 | } + 5 | diff --git a/packages/ast-spec/src/expression/SequenceExpression/fixtures/_error_/private-id-lhs/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/SequenceExpression/fixtures/_error_/private-id-lhs/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..9006b349152b --- /dev/null +++ b/packages/ast-spec/src/expression/SequenceExpression/fixtures/_error_/private-id-lhs/snapshots/2-Babel-Error.shot @@ -0,0 +1,11 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > SequenceExpression > _error_ > private-id-lhs > Babel - Error`] +BabelError + 1 | class A { + 2 | #a; +> 3 | c = (#a, 1); + | ^ Private names are only allowed in property accesses (`obj.#a`) or in `in` expressions (`#a in obj`). (3:7) + 4 | } + 5 | + diff --git a/packages/ast-spec/src/expression/SequenceExpression/fixtures/_error_/private-id-lhs/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/expression/SequenceExpression/fixtures/_error_/private-id-lhs/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..15de730f25f8 --- /dev/null +++ b/packages/ast-spec/src/expression/SequenceExpression/fixtures/_error_/private-id-lhs/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > SequenceExpression > _error_ > private-id-lhs > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/expression/SequenceExpression/fixtures/_error_/private-id-rhs/fixture.ts b/packages/ast-spec/src/expression/SequenceExpression/fixtures/_error_/private-id-rhs/fixture.ts new file mode 100644 index 000000000000..9f1df9d73fa4 --- /dev/null +++ b/packages/ast-spec/src/expression/SequenceExpression/fixtures/_error_/private-id-rhs/fixture.ts @@ -0,0 +1,4 @@ +class A { + #a; + c = (1, #a); +} diff --git a/packages/ast-spec/src/expression/SequenceExpression/fixtures/_error_/private-id-rhs/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/expression/SequenceExpression/fixtures/_error_/private-id-rhs/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..da508ef53ff0 --- /dev/null +++ b/packages/ast-spec/src/expression/SequenceExpression/fixtures/_error_/private-id-rhs/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,10 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > SequenceExpression > _error_ > private-id-rhs > TSESTree - Error`] +TSError + 1 | class A { + 2 | #a; +> 3 | c = (1, #a); + | ^^ Private identifiers are only allowed on the left-hand-side of an 'in' expression. + 4 | } + 5 | diff --git a/packages/ast-spec/src/expression/SequenceExpression/fixtures/_error_/private-id-rhs/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/SequenceExpression/fixtures/_error_/private-id-rhs/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..4a6a0b8baf68 --- /dev/null +++ b/packages/ast-spec/src/expression/SequenceExpression/fixtures/_error_/private-id-rhs/snapshots/2-Babel-Error.shot @@ -0,0 +1,11 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > SequenceExpression > _error_ > private-id-rhs > Babel - Error`] +BabelError + 1 | class A { + 2 | #a; +> 3 | c = (1, #a); + | ^ Private names are only allowed in property accesses (`obj.#a`) or in `in` expressions (`#a in obj`). (3:10) + 4 | } + 5 | + diff --git a/packages/ast-spec/src/expression/SequenceExpression/fixtures/_error_/private-id-rhs/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/expression/SequenceExpression/fixtures/_error_/private-id-rhs/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..aeb556b36b22 --- /dev/null +++ b/packages/ast-spec/src/expression/SequenceExpression/fixtures/_error_/private-id-rhs/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > SequenceExpression > _error_ > private-id-rhs > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/expression/TaggedTemplateExpression/fixtures/_error_/optional-nested-function-tag/fixture.ts b/packages/ast-spec/src/expression/TaggedTemplateExpression/fixtures/_error_/optional-nested-function-tag/fixture.ts new file mode 100644 index 000000000000..7fc56660a355 --- /dev/null +++ b/packages/ast-spec/src/expression/TaggedTemplateExpression/fixtures/_error_/optional-nested-function-tag/fixture.ts @@ -0,0 +1 @@ +a?.b()`...` diff --git a/packages/ast-spec/src/expression/TaggedTemplateExpression/fixtures/_error_/optional-nested-function-tag/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/expression/TaggedTemplateExpression/fixtures/_error_/optional-nested-function-tag/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..e096b5f6d715 --- /dev/null +++ b/packages/ast-spec/src/expression/TaggedTemplateExpression/fixtures/_error_/optional-nested-function-tag/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,7 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > TaggedTemplateExpression > _error_ > optional-nested-function-tag > TSESTree - Error`] +TSError +> 1 | a?.b()`...` + | ^^^^^^^^^^^ Tagged template expressions are not permitted in an optional chain. + 2 | diff --git a/packages/ast-spec/src/expression/TaggedTemplateExpression/fixtures/_error_/optional-nested-function-tag/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/TaggedTemplateExpression/fixtures/_error_/optional-nested-function-tag/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..69c9ea2f84ea --- /dev/null +++ b/packages/ast-spec/src/expression/TaggedTemplateExpression/fixtures/_error_/optional-nested-function-tag/snapshots/2-Babel-Error.shot @@ -0,0 +1,8 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > TaggedTemplateExpression > _error_ > optional-nested-function-tag > Babel - Error`] +BabelError +> 1 | a?.b()`...` + | ^ Tagged Template Literals are not allowed in optionalChain. (1:0) + 2 | + diff --git a/packages/ast-spec/src/expression/TaggedTemplateExpression/fixtures/_error_/optional-nested-function-tag/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/expression/TaggedTemplateExpression/fixtures/_error_/optional-nested-function-tag/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..11aea0c55d48 --- /dev/null +++ b/packages/ast-spec/src/expression/TaggedTemplateExpression/fixtures/_error_/optional-nested-function-tag/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > TaggedTemplateExpression > _error_ > optional-nested-function-tag > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/expression/TaggedTemplateExpression/fixtures/_error_/optional-nested-tag/fixture.ts b/packages/ast-spec/src/expression/TaggedTemplateExpression/fixtures/_error_/optional-nested-tag/fixture.ts new file mode 100644 index 000000000000..d6e041652e3d --- /dev/null +++ b/packages/ast-spec/src/expression/TaggedTemplateExpression/fixtures/_error_/optional-nested-tag/fixture.ts @@ -0,0 +1 @@ +a?.b.c`...` diff --git a/packages/ast-spec/src/expression/TaggedTemplateExpression/fixtures/_error_/optional-nested-tag/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/expression/TaggedTemplateExpression/fixtures/_error_/optional-nested-tag/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..3be80a77ffb4 --- /dev/null +++ b/packages/ast-spec/src/expression/TaggedTemplateExpression/fixtures/_error_/optional-nested-tag/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,7 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > TaggedTemplateExpression > _error_ > optional-nested-tag > TSESTree - Error`] +TSError +> 1 | a?.b.c`...` + | ^^^^^^^^^^^ Tagged template expressions are not permitted in an optional chain. + 2 | diff --git a/packages/ast-spec/src/expression/TaggedTemplateExpression/fixtures/_error_/optional-nested-tag/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/TaggedTemplateExpression/fixtures/_error_/optional-nested-tag/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..e27266628424 --- /dev/null +++ b/packages/ast-spec/src/expression/TaggedTemplateExpression/fixtures/_error_/optional-nested-tag/snapshots/2-Babel-Error.shot @@ -0,0 +1,8 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > TaggedTemplateExpression > _error_ > optional-nested-tag > Babel - Error`] +BabelError +> 1 | a?.b.c`...` + | ^ Tagged Template Literals are not allowed in optionalChain. (1:0) + 2 | + diff --git a/packages/ast-spec/src/expression/TaggedTemplateExpression/fixtures/_error_/optional-nested-tag/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/expression/TaggedTemplateExpression/fixtures/_error_/optional-nested-tag/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..87a5ea5117c6 --- /dev/null +++ b/packages/ast-spec/src/expression/TaggedTemplateExpression/fixtures/_error_/optional-nested-tag/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > TaggedTemplateExpression > _error_ > optional-nested-tag > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/expression/TaggedTemplateExpression/fixtures/_error_/optional-tag/fixture.ts b/packages/ast-spec/src/expression/TaggedTemplateExpression/fixtures/_error_/optional-tag/fixture.ts new file mode 100644 index 000000000000..fb8c8604a1d5 --- /dev/null +++ b/packages/ast-spec/src/expression/TaggedTemplateExpression/fixtures/_error_/optional-tag/fixture.ts @@ -0,0 +1 @@ +a?.b`...` diff --git a/packages/ast-spec/src/expression/TaggedTemplateExpression/fixtures/_error_/optional-tag/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/expression/TaggedTemplateExpression/fixtures/_error_/optional-tag/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..b7909f67ed9e --- /dev/null +++ b/packages/ast-spec/src/expression/TaggedTemplateExpression/fixtures/_error_/optional-tag/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,7 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > TaggedTemplateExpression > _error_ > optional-tag > TSESTree - Error`] +TSError +> 1 | a?.b`...` + | ^^^^^^^^^ Tagged template expressions are not permitted in an optional chain. + 2 | diff --git a/packages/ast-spec/src/expression/TaggedTemplateExpression/fixtures/_error_/optional-tag/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/TaggedTemplateExpression/fixtures/_error_/optional-tag/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..23079d1b071e --- /dev/null +++ b/packages/ast-spec/src/expression/TaggedTemplateExpression/fixtures/_error_/optional-tag/snapshots/2-Babel-Error.shot @@ -0,0 +1,8 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > TaggedTemplateExpression > _error_ > optional-tag > Babel - Error`] +BabelError +> 1 | a?.b`...` + | ^ Tagged Template Literals are not allowed in optionalChain. (1:0) + 2 | + diff --git a/packages/ast-spec/src/expression/TaggedTemplateExpression/fixtures/_error_/optional-tag/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/expression/TaggedTemplateExpression/fixtures/_error_/optional-tag/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..d32839672fdb --- /dev/null +++ b/packages/ast-spec/src/expression/TaggedTemplateExpression/fixtures/_error_/optional-tag/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > expression > TaggedTemplateExpression > _error_ > optional-tag > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/expression/UnaryExpression/spec.ts b/packages/ast-spec/src/expression/UnaryExpression/spec.ts index 2d9f09f317b8..e68cc35047d0 100644 --- a/packages/ast-spec/src/expression/UnaryExpression/spec.ts +++ b/packages/ast-spec/src/expression/UnaryExpression/spec.ts @@ -1,7 +1,31 @@ import type { AST_NODE_TYPES } from '../../ast-node-types'; import type { UnaryExpressionBase } from '../../base/UnaryExpressionBase'; -export interface UnaryExpression extends UnaryExpressionBase { +interface UnaryExpressionSpecific + extends UnaryExpressionBase { type: AST_NODE_TYPES.UnaryExpression; - operator: '!' | '+' | '~' | '-' | 'delete' | 'typeof' | 'void'; + operator: T; } + +export type UnaryExpressionNot = UnaryExpressionSpecific<'!'>; + +export type UnaryExpressionPlus = UnaryExpressionSpecific<'+'>; + +export type UnaryExpressionMinus = UnaryExpressionSpecific<'-'>; + +export type UnaryExpressionDelete = UnaryExpressionSpecific<'delete'>; + +export type UnaryExpressionTypeof = UnaryExpressionSpecific<'typeof'>; + +export type UnaryExpressionVoid = UnaryExpressionSpecific<'void'>; + +export type UnaryExpressionBitwiseNot = UnaryExpressionSpecific<'~'>; + +export type UnaryExpression = + | UnaryExpressionBitwiseNot + | UnaryExpressionDelete + | UnaryExpressionMinus + | UnaryExpressionNot + | UnaryExpressionPlus + | UnaryExpressionTypeof + | UnaryExpressionVoid; diff --git a/packages/ast-spec/src/expression/UpdateExpression/fixtures/_error_/call-expr/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/UpdateExpression/fixtures/_error_/call-expr/snapshots/2-Babel-Error.shot index f254c274c881..11c9fa5deba0 100644 --- a/packages/ast-spec/src/expression/UpdateExpression/fixtures/_error_/call-expr/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/expression/UpdateExpression/fixtures/_error_/call-expr/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > expression > UpdateExpression > _error_ > call-expr > Babel - Error`] -SyntaxError: Invalid left-hand side in postfix operation. (1:0) +BabelError +> 1 | a()++; + | ^ Invalid left-hand side in postfix operation. (1:0) + 2 | + diff --git a/packages/ast-spec/src/expression/UpdateExpression/fixtures/_error_/literal/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/UpdateExpression/fixtures/_error_/literal/snapshots/2-Babel-Error.shot index 67b54975f662..c2766f769ac6 100644 --- a/packages/ast-spec/src/expression/UpdateExpression/fixtures/_error_/literal/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/expression/UpdateExpression/fixtures/_error_/literal/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > expression > UpdateExpression > _error_ > literal > Babel - Error`] -SyntaxError: Invalid left-hand side in postfix operation. (1:0) +BabelError +> 1 | 1++; + | ^ Invalid left-hand side in postfix operation. (1:0) + 2 | + diff --git a/packages/ast-spec/src/expression/UpdateExpression/fixtures/_error_/optional-chain/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/UpdateExpression/fixtures/_error_/optional-chain/snapshots/2-Babel-Error.shot index 91473dbcc636..7a3e4de5faf0 100644 --- a/packages/ast-spec/src/expression/UpdateExpression/fixtures/_error_/optional-chain/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/expression/UpdateExpression/fixtures/_error_/optional-chain/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > expression > UpdateExpression > _error_ > optional-chain > Babel - Error`] -SyntaxError: This experimental syntax requires enabling the parser plugin: "optionalChainingAssign". (1:0) +BabelError +> 1 | x?.y++; + | ^ This experimental syntax requires enabling the parser plugin: "optionalChainingAssign". (1:0) + 2 | + diff --git a/packages/ast-spec/src/expression/UpdateExpression/fixtures/_error_/optional-chain2/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/UpdateExpression/fixtures/_error_/optional-chain2/snapshots/2-Babel-Error.shot index 0ddfe456abaa..9dd7dbc9fb81 100644 --- a/packages/ast-spec/src/expression/UpdateExpression/fixtures/_error_/optional-chain2/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/expression/UpdateExpression/fixtures/_error_/optional-chain2/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > expression > UpdateExpression > _error_ > optional-chain2 > Babel - Error`] -SyntaxError: This experimental syntax requires enabling the parser plugin: "optionalChainingAssign". (1:0) +BabelError +> 1 | x?.y.z++; + | ^ This experimental syntax requires enabling the parser plugin: "optionalChainingAssign". (1:0) + 2 | + diff --git a/packages/ast-spec/src/expression/UpdateExpression/fixtures/_error_/optional-chain3/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/UpdateExpression/fixtures/_error_/optional-chain3/snapshots/2-Babel-Error.shot index 3c478bc81318..25bcdc744cb3 100644 --- a/packages/ast-spec/src/expression/UpdateExpression/fixtures/_error_/optional-chain3/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/expression/UpdateExpression/fixtures/_error_/optional-chain3/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > expression > UpdateExpression > _error_ > optional-chain3 > Babel - Error`] -SyntaxError: This experimental syntax requires enabling the parser plugin: "optionalChainingAssign". (1:0) +BabelError +> 1 | x?.y().z++; + | ^ This experimental syntax requires enabling the parser plugin: "optionalChainingAssign". (1:0) + 2 | + diff --git a/packages/ast-spec/src/expression/UpdateExpression/fixtures/_error_/paren-expr/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/UpdateExpression/fixtures/_error_/paren-expr/snapshots/2-Babel-Error.shot index 96d9daba8b0b..c99074e87e83 100644 --- a/packages/ast-spec/src/expression/UpdateExpression/fixtures/_error_/paren-expr/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/expression/UpdateExpression/fixtures/_error_/paren-expr/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > expression > UpdateExpression > _error_ > paren-expr > Babel - Error`] -SyntaxError: Invalid left-hand side in postfix operation. (1:1) +BabelError +> 1 | (a())++; + | ^ Invalid left-hand side in postfix operation. (1:1) + 2 | + diff --git a/packages/ast-spec/src/jsx/JSXAttribute/fixtures/element-non-self-closing/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/jsx/JSXAttribute/fixtures/element-non-self-closing/snapshots/2-TSESTree-Tokens.shot index 52c93eab8644..1d0b129b61d1 100644 --- a/packages/ast-spec/src/jsx/JSXAttribute/fixtures/element-non-self-closing/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/jsx/JSXAttribute/fixtures/element-non-self-closing/snapshots/2-TSESTree-Tokens.shot @@ -81,21 +81,11 @@ }, Punctuator { type: "Punctuator", - value: "<", + value: " jsx > JSXAttribute > element-non-self-closing > AST Alignment - Token`] Snapshot Diff: -Compared values have no visual difference. +- TSESTree ++ Babel + + Array [ + Punctuator { + type: 'Punctuator', + value: '<', + + range: [0, 1], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 1 }, + }, + }, + JSXIdentifier { + type: 'JSXIdentifier', + value: 'App', + + range: [1, 4], + loc: { + start: { column: 1, line: 1 }, + end: { column: 4, line: 1 }, + }, + }, + JSXIdentifier { + type: 'JSXIdentifier', + value: 'foo', + + range: [5, 8], + loc: { + start: { column: 5, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '=', + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '<', + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + JSXIdentifier { + type: 'JSXIdentifier', + value: 'div', + + range: [10, 13], + loc: { + start: { column: 10, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '>', + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + JSXText { + type: 'JSXText', + value: 'bar', + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', +- value: '', + + range: [22, 23], + loc: { + start: { column: 22, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '/', + + range: [24, 25], + loc: { + start: { column: 24, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '>', + + range: [25, 26], + loc: { + start: { column: 25, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ';', + + range: [26, 27], + loc: { + start: { column: 26, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + ] diff --git a/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/snapshots/2-TSESTree-Tokens.shot index 4b048a6998fe..559bb0197281 100644 --- a/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/snapshots/2-TSESTree-Tokens.shot @@ -521,21 +521,11 @@ }, Punctuator { type: "Punctuator", - value: "<", + value: " legacy-fixtures > basics > _error_ > abstract-class-with-abstract-static-constructor > Babel - Error`] -SyntaxError: 'static' modifier cannot be used with 'abstract' modifier. (4:11) +BabelError + 2 | + 3 | export abstract class AbstractSocket { +> 4 | abstract static constructor(); + | ^ 'static' modifier cannot be used with 'abstract' modifier. (4:11) + 5 | } + 6 | + diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-override-property/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-override-property/snapshots/2-Babel-Error.shot index 0b00b4cdf6c5..aa73011ad650 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-override-property/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-override-property/snapshots/2-Babel-Error.shot @@ -1,4 +1,11 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > basics > _error_ > abstract-class-with-override-property > Babel - Error`] -SyntaxError: Property 'foo' cannot have an initializer because it is marked abstract. (4:24) +BabelError + 2 | + 3 | abstract class SpecializedComponent extends SomeComponent { +> 4 | abstract override foo = 1; + | ^ Property 'foo' cannot have an initializer because it is marked abstract. (4:24) + 5 | } + 6 | + diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-interface/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-interface/snapshots/2-Babel-Error.shot index 4bb592375d4a..1af0e07eb087 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-interface/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-interface/snapshots/2-Babel-Error.shot @@ -1,4 +1,10 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > basics > _error_ > abstract-interface > Babel - Error`] -SyntaxError: 'abstract' modifier can only appear on a class, method, or property declaration. (3:7) +BabelError + 1 | // TODO: This fixture might be too large, and if so should be split up. + 2 | +> 3 | export abstract interface I { + | ^ 'abstract' modifier can only appear on a class, method, or property declaration. (3:7) + 4 | } + diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/await-without-async-function/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/await-without-async-function/snapshots/2-Babel-Error.shot index 06bf7d76b398..c36fee2891bf 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/await-without-async-function/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/await-without-async-function/snapshots/2-Babel-Error.shot @@ -1,4 +1,12 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > basics > _error_ > await-without-async-function > Babel - Error`] -SyntaxError: Unexpected reserved word 'await'. (4:14) +BabelError + 2 | + 3 | function foo() { +> 4 | const bar = await baz(); + | ^ Unexpected reserved word 'await'. (4:14) + 5 | return bar.qux; + 6 | } + 7 | + diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-private-identifier-field-with-accessibility-error/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-private-identifier-field-with-accessibility-error/snapshots/2-Babel-Error.shot index f33c24ea95a7..b4121cb4ae51 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-private-identifier-field-with-accessibility-error/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-private-identifier-field-with-accessibility-error/snapshots/2-Babel-Error.shot @@ -1,4 +1,12 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > basics > _error_ > class-private-identifier-field-with-accessibility-error > Babel - Error`] -SyntaxError: Private elements cannot have an accessibility modifier ('private'). (4:2) +BabelError + 2 | + 3 | class Foo { +> 4 | private #priv1: string + | ^ Private elements cannot have an accessibility modifier ('private'). (4:2) + 5 | public #priv2: string + 6 | static #priv3: string + 7 | } + diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-constructor-and-type-parameters/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-constructor-and-type-parameters/snapshots/2-Babel-Error.shot index db76a5bf8aa9..69f1445d8735 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-constructor-and-type-parameters/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-constructor-and-type-parameters/snapshots/2-Babel-Error.shot @@ -1,4 +1,12 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > basics > _error_ > class-with-constructor-and-type-parameters > Babel - Error`] -SyntaxError: Type parameters cannot appear on a constructor declaration. (4:13) +BabelError + 2 | + 3 | class C { +> 4 | constructor() { } + | ^ Type parameters cannot appear on a constructor declaration. (4:13) + 5 | + 6 | ['constructor']() { } + 7 | } + diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-export-parameter-properties/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-export-parameter-properties/snapshots/2-Babel-Error.shot index 4f49707b5721..448313d2ceb8 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-export-parameter-properties/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-export-parameter-properties/snapshots/2-Babel-Error.shot @@ -1,4 +1,12 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > basics > _error_ > class-with-export-parameter-properties > Babel - Error`] -SyntaxError: Unexpected keyword 'export'. (4:16) +BabelError + 2 | + 3 | class Foo { +> 4 | constructor(export a: string) { + | ^ Unexpected keyword 'export'. (4:16) + 5 | + 6 | } + 7 | } + diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-implements-and-extends/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-implements-and-extends/snapshots/2-Babel-Error.shot index f3b7c8370e86..6eecefc158d1 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-implements-and-extends/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-implements-and-extends/snapshots/2-Babel-Error.shot @@ -1,4 +1,10 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > basics > _error_ > class-with-implements-and-extends > Babel - Error`] -SyntaxError: Unexpected token, expected "," (3:57) +BabelError + 1 | // TODO: This fixture might be too large, and if so should be split up. + 2 | +> 3 | class ClassWithParentAndInterface implements MyInterface extends MyOtherClass {} + | ^ Unexpected token, expected "," (3:57) + 4 | + diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-static-parameter-properties/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-static-parameter-properties/snapshots/2-Babel-Error.shot index 93ba259b14c2..222ba46172fc 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-static-parameter-properties/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-static-parameter-properties/snapshots/2-Babel-Error.shot @@ -1,4 +1,12 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > basics > _error_ > class-with-static-parameter-properties > Babel - Error`] -SyntaxError: Unexpected reserved word 'static'. (4:16) +BabelError + 2 | + 3 | class Foo { +> 4 | constructor(static a: string) { + | ^ Unexpected reserved word 'static'. (4:16) + 5 | + 6 | } + 7 | } + diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-two-methods-computed-constructor/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-two-methods-computed-constructor/snapshots/2-Babel-Error.shot index e27b8241af48..c2de560d7935 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-two-methods-computed-constructor/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-two-methods-computed-constructor/snapshots/2-Babel-Error.shot @@ -1,4 +1,12 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > basics > _error_ > class-with-two-methods-computed-constructor > Babel - Error`] -SyntaxError: Type parameters cannot appear on a constructor declaration. (4:15) +BabelError + 2 | + 3 | class A { +> 4 | "constructor"(): number { + | ^ Type parameters cannot appear on a constructor declaration. (4:15) + 5 | } + 6 | + 7 | ["constructor"](): number { + diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/const-assertions/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/const-assertions/snapshots/2-Babel-Error.shot index d36815d31301..8627909786fd 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/const-assertions/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/const-assertions/snapshots/2-Babel-Error.shot @@ -1,4 +1,12 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > basics > _error_ > const-assertions > Babel - Error`] -SyntaxError: Identifier 'x' has already been declared. (13:4) +BabelError + 11 | + 12 | // Type '10' +> 13 | let x = 10; + | ^ Identifier 'x' has already been declared. (13:4) + 14 | + 15 | // Type 'readonly [10, 20]' + 16 | let y = [10, 20]; + diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-number/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-number/snapshots/1-TSESTree-Error.shot index c64aaae4a4d8..dc8d857908c8 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-number/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-number/snapshots/1-TSESTree-Error.shot @@ -1,4 +1,10 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > basics > _error_ > export-named-enum-computed-number > TSESTree - Error`] -NO ERROR +TSError + 2 | + 3 | export enum Foo { +> 4 | [1], + | ^^^ Computed property names are not allowed in enums. + 5 | } + 6 | diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-number/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-number/snapshots/2-Babel-Error.shot index e3ebeee984c1..2810528b926b 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-number/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-number/snapshots/2-Babel-Error.shot @@ -1,4 +1,11 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > basics > _error_ > export-named-enum-computed-number > Babel - Error`] -SyntaxError: Unexpected token (4:4) +BabelError + 2 | + 3 | export enum Foo { +> 4 | [1], + | ^ Unexpected token (4:4) + 5 | } + 6 | + diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-number/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-number/snapshots/3-Alignment-Error.shot index f5e14d5d4b27..f9ae118971e1 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-number/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-number/snapshots/3-Alignment-Error.shot @@ -1,4 +1,4 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > basics > _error_ > export-named-enum-computed-number > Error Alignment`] -Babel errored but TSESTree didn't +Both errored diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-string/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-string/snapshots/1-TSESTree-Error.shot index 866743a38587..90ef25fd26d8 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-string/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-string/snapshots/1-TSESTree-Error.shot @@ -1,4 +1,10 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > basics > _error_ > export-named-enum-computed-string > TSESTree - Error`] -NO ERROR +TSError + 2 | + 3 | export enum Foo { +> 4 | ['baz'], + | ^^^^^^^ Computed property names are not allowed in enums. + 5 | } + 6 | diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-string/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-string/snapshots/2-Babel-Error.shot index 30b625fd5ba4..d296e5c547da 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-string/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-string/snapshots/2-Babel-Error.shot @@ -1,4 +1,11 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > basics > _error_ > export-named-enum-computed-string > Babel - Error`] -SyntaxError: Unexpected token (4:4) +BabelError + 2 | + 3 | export enum Foo { +> 4 | ['baz'], + | ^ Unexpected token (4:4) + 5 | } + 6 | + diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-string/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-string/snapshots/3-Alignment-Error.shot index f58190aa21f3..2dc13fd3d5d2 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-string/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-string/snapshots/3-Alignment-Error.shot @@ -1,4 +1,4 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > basics > _error_ > export-named-enum-computed-string > Error Alignment`] -Babel errored but TSESTree didn't +Both errored diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-var-ref/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-var-ref/snapshots/1-TSESTree-Error.shot index 85b95f8e17d3..7e31fde5e0c7 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-var-ref/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-var-ref/snapshots/1-TSESTree-Error.shot @@ -1,4 +1,10 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > basics > _error_ > export-named-enum-computed-var-ref > TSESTree - Error`] -NO ERROR +TSError + 2 | + 3 | export enum Foo { +> 4 | [x], + | ^^^ Computed property names are not allowed in enums. + 5 | } + 6 | diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-var-ref/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-var-ref/snapshots/2-Babel-Error.shot index 2612787d1b85..f34477b53b70 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-var-ref/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-var-ref/snapshots/2-Babel-Error.shot @@ -1,4 +1,11 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > basics > _error_ > export-named-enum-computed-var-ref > Babel - Error`] -SyntaxError: Unexpected token (4:4) +BabelError + 2 | + 3 | export enum Foo { +> 4 | [x], + | ^ Unexpected token (4:4) + 5 | } + 6 | + diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-var-ref/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-var-ref/snapshots/3-Alignment-Error.shot index 006e3518ee1f..3909357acf22 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-var-ref/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-var-ref/snapshots/3-Alignment-Error.shot @@ -1,4 +1,4 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > basics > _error_ > export-named-enum-computed-var-ref > Error Alignment`] -Babel errored but TSESTree didn't +Both errored diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-with-import-assertions/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-with-import-assertions/snapshots/2-Babel-Error.shot index 580ccafe0581..55ec89897af8 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-with-import-assertions/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-with-import-assertions/snapshots/2-Babel-Error.shot @@ -1,4 +1,10 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > basics > _error_ > export-with-import-assertions > Babel - Error`] -SyntaxError: A JSON module can only be imported with `default`. (3:9) +BabelError + 1 | // TODO: This fixture might be too large, and if so should be split up. + 2 | +> 3 | export { foo } from "mod" assert { type: "json" }; + | ^ A JSON module can only be imported with `default`. (3:9) + 4 | + diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/import-type-error/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/import-type-error/snapshots/2-Babel-Error.shot index fbb578bcabad..3745c520879d 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/import-type-error/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/import-type-error/snapshots/2-Babel-Error.shot @@ -1,4 +1,10 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > basics > _error_ > import-type-error > Babel - Error`] -SyntaxError: A type-only import can specify a default import or named bindings, but not both. (3:0) +BabelError + 1 | // TODO: This fixture might be too large, and if so should be split up. + 2 | +> 3 | import type foo, { bar } from 'bar'; + | ^ A type-only import can specify a default import or named bindings, but not both. (3:0) + 4 | + diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/interface-with-construct-signature-with-parameter-accessibility/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/interface-with-construct-signature-with-parameter-accessibility/snapshots/2-Babel-Error.shot index 98c91ef49faf..227ecfb29f8c 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/interface-with-construct-signature-with-parameter-accessibility/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/interface-with-construct-signature-with-parameter-accessibility/snapshots/2-Babel-Error.shot @@ -1,4 +1,11 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > basics > _error_ > interface-with-construct-signature-with-parameter-accessibility > Babel - Error`] -SyntaxError: A parameter property is only allowed in a constructor implementation. (4:9) +BabelError + 2 | + 3 | interface Test { +> 4 | new (public x, private y); + | ^ A parameter property is only allowed in a constructor implementation. (4:9) + 5 | } + 6 | + diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/new-target-in-arrow-function-body/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/new-target-in-arrow-function-body/snapshots/2-Babel-Error.shot index 35034cb9ecdf..fa95c78a4f0c 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/new-target-in-arrow-function-body/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/new-target-in-arrow-function-body/snapshots/2-Babel-Error.shot @@ -1,4 +1,10 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > basics > _error_ > new-target-in-arrow-function-body > Babel - Error`] -SyntaxError: `new.target` can only be used in functions or class properties. (3:16) +BabelError + 1 | // TODO: This fixture might be too large, and if so should be split up. + 2 | +> 3 | const b = () => new.target; + | ^ `new.target` can only be used in functions or class properties. (3:16) + 4 | + diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/var-with-definite-assignment/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/var-with-definite-assignment/snapshots/2-Babel-Error.shot index 084bd81246e1..5b148e27fcc7 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/var-with-definite-assignment/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/var-with-definite-assignment/snapshots/2-Babel-Error.shot @@ -1,4 +1,12 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > basics > _error_ > var-with-definite-assignment > Babel - Error`] -SyntaxError: Missing initializer in const declaration. (3:16) +BabelError + 1 | // TODO: This fixture might be too large, and if so should be split up. + 2 | +> 3 | const x!: string; + | ^ Missing initializer in const declaration. (3:16) + 4 | var y!: number; + 5 | let z!: object; + 6 | + diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/async-function-with-var-declaration/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/async-function-with-var-declaration/snapshots/4-Babel-Tokens.shot index 794cf8cd318c..b2ba9113ed0e 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/async-function-with-var-declaration/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/async-function-with-var-declaration/snapshots/4-Babel-Tokens.shot @@ -109,8 +109,8 @@ end: { column: 18, line: 4 }, }, }, - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [118, 121], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/const-enum/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/const-enum/snapshots/1-TSESTree-AST.shot index 9187f52aade3..238113e5cc58 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/const-enum/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/const-enum/snapshots/1-TSESTree-AST.shot @@ -8,7 +8,6 @@ Program { members: [ TSEnumMember { type: "TSEnumMember", - computed: false, id: Identifier { type: "Identifier", decorators: [], @@ -41,7 +40,6 @@ Program { }, TSEnumMember { type: "TSEnumMember", - computed: false, id: Identifier { type: "Identifier", decorators: [], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/const-enum/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/const-enum/snapshots/5-AST-Alignment-AST.shot index 1c5c321a9cf2..20c84325ce31 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/const-enum/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/const-enum/snapshots/5-AST-Alignment-AST.shot @@ -15,7 +15,6 @@ Snapshot Diff: - members: Array [ - TSEnumMember { - type: 'TSEnumMember', -- computed: false, - id: Identifier { - type: 'Identifier', - decorators: Array [], @@ -81,7 +80,6 @@ Snapshot Diff: }, - TSEnumMember { - type: 'TSEnumMember', -- computed: false, - id: Identifier { - type: 'Identifier', - decorators: Array [], @@ -121,12 +119,7 @@ Snapshot Diff: - loc: { - start: { column: 15, line: 3 }, - end: { column: 1, line: 6 }, -+ range: [103, 106], -+ loc: { -+ start: { column: 2, line: 5 }, -+ end: { column: 5, line: 5 }, -+ }, - }, +- }, - }, - const: true, - declare: false, @@ -140,7 +133,12 @@ Snapshot Diff: - loc: { - start: { column: 11, line: 3 }, - end: { column: 14, line: 3 }, -- }, ++ range: [103, 106], ++ loc: { ++ start: { column: 2, line: 5 }, ++ end: { column: 5, line: 5 }, ++ }, + }, - }, + ], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-const-named-enum/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-const-named-enum/snapshots/1-TSESTree-AST.shot index 0a35e9756f00..01c4d100b383 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-const-named-enum/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-const-named-enum/snapshots/1-TSESTree-AST.shot @@ -11,7 +11,6 @@ Program { members: [ TSEnumMember { type: "TSEnumMember", - computed: false, id: Identifier { type: "Identifier", decorators: [], @@ -44,7 +43,6 @@ Program { }, TSEnumMember { type: "TSEnumMember", - computed: false, id: Identifier { type: "Identifier", decorators: [], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-const-named-enum/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-const-named-enum/snapshots/5-AST-Alignment-AST.shot index bc225b94ed0d..603938fb4270 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-const-named-enum/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-const-named-enum/snapshots/5-AST-Alignment-AST.shot @@ -19,7 +19,6 @@ Snapshot Diff: - members: Array [ - TSEnumMember { - type: 'TSEnumMember', -- computed: false, - id: Identifier { - type: 'Identifier', - decorators: Array [], @@ -85,7 +84,6 @@ Snapshot Diff: }, - TSEnumMember { - type: 'TSEnumMember', -- computed: false, - id: Identifier { - type: 'Identifier', - decorators: Array [], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-named-enum/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-named-enum/snapshots/1-TSESTree-AST.shot index 15279e8049d7..f946f794f043 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-named-enum/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-named-enum/snapshots/1-TSESTree-AST.shot @@ -11,7 +11,6 @@ Program { members: [ TSEnumMember { type: "TSEnumMember", - computed: false, id: Identifier { type: "Identifier", decorators: [], @@ -44,7 +43,6 @@ Program { }, TSEnumMember { type: "TSEnumMember", - computed: false, id: Identifier { type: "Identifier", decorators: [], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-named-enum/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-named-enum/snapshots/5-AST-Alignment-AST.shot index 695e866e0f98..eff7ba3226bd 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-named-enum/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-named-enum/snapshots/5-AST-Alignment-AST.shot @@ -19,7 +19,6 @@ Snapshot Diff: - members: Array [ - TSEnumMember { - type: 'TSEnumMember', -- computed: false, - id: Identifier { - type: 'Identifier', - decorators: Array [], @@ -85,7 +84,6 @@ Snapshot Diff: }, - TSEnumMember { - type: 'TSEnumMember', -- computed: false, - id: Identifier { - type: 'Identifier', - decorators: Array [], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-enum/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-enum/snapshots/1-TSESTree-AST.shot index b1554a6d0194..8f42d8de69bf 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-enum/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-enum/snapshots/1-TSESTree-AST.shot @@ -11,7 +11,6 @@ Program { members: [ TSEnumMember { type: "TSEnumMember", - computed: false, id: Identifier { type: "Identifier", decorators: [], @@ -44,7 +43,6 @@ Program { }, TSEnumMember { type: "TSEnumMember", - computed: false, id: Identifier { type: "Identifier", decorators: [], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-enum/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-enum/snapshots/5-AST-Alignment-AST.shot index b52051becdfb..10c5f8d572d1 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-enum/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-enum/snapshots/5-AST-Alignment-AST.shot @@ -19,7 +19,6 @@ Snapshot Diff: - members: Array [ - TSEnumMember { - type: 'TSEnumMember', -- computed: false, - id: Identifier { - type: 'Identifier', - decorators: Array [], @@ -85,7 +84,6 @@ Snapshot Diff: }, - TSEnumMember { - type: 'TSEnumMember', -- computed: false, - id: Identifier { - type: 'Identifier', - decorators: Array [], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/global-this/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/global-this/snapshots/4-Babel-Tokens.shot index 2b4bd47565ba..fb0b35f8e5f1 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/global-this/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/global-this/snapshots/4-Babel-Tokens.shot @@ -109,8 +109,8 @@ end: { column: 21, line: 8 }, }, }, - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [165, 168], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/keyword-variables/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/keyword-variables/snapshots/4-Babel-Tokens.shot index 65e2dfe0dc77..781a841d719c 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/keyword-variables/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/keyword-variables/snapshots/4-Babel-Tokens.shot @@ -2579,8 +2579,8 @@ end: { column: 18, line: 76 }, }, }, - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [1130, 1133], @@ -2609,8 +2609,8 @@ end: { column: 11, line: 77 }, }, }, - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "yield", range: [1138, 1143], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/keyword-variables/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/keyword-variables/snapshots/6-AST-Alignment-Tokens.shot index 358988f5d91b..89c5aca71c1a 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/keyword-variables/snapshots/6-AST-Alignment-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/keyword-variables/snapshots/6-AST-Alignment-Tokens.shot @@ -2596,10 +2596,8 @@ Snapshot Diff: end: { column: 18, line: 76 }, }, }, -- Keyword { -- type: 'Keyword', -+ Identifier { -+ type: 'Identifier', + Keyword { + type: 'Keyword', value: 'let', range: [1130, 1133], @@ -2628,10 +2626,8 @@ Snapshot Diff: end: { column: 11, line: 77 }, }, }, -- Keyword { -- type: 'Keyword', -+ Identifier { -+ type: 'Identifier', + Keyword { + type: 'Keyword', value: 'yield', range: [1138, 1143], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/non-null-assertion-operator/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/non-null-assertion-operator/snapshots/4-Babel-Tokens.shot index 0ebcd27bf8f3..d5d1ec3f7e5c 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/non-null-assertion-operator/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/non-null-assertion-operator/snapshots/4-Babel-Tokens.shot @@ -139,8 +139,8 @@ end: { column: 20, line: 4 }, }, }, - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [133, 136], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/null-and-undefined-type-annotations/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/null-and-undefined-type-annotations/snapshots/2-TSESTree-Tokens.shot index c0d2cc8c0600..d7da87a7a9d7 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/null-and-undefined-type-annotations/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/null-and-undefined-type-annotations/snapshots/2-TSESTree-Tokens.shot @@ -29,8 +29,8 @@ end: { column: 6, line: 3 }, }, }, - Keyword { - type: "Keyword", + Null { + type: "Null", value: "null", range: [80, 84], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/null-and-undefined-type-annotations/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/null-and-undefined-type-annotations/snapshots/4-Babel-Tokens.shot index cfe34f596563..d7da87a7a9d7 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/null-and-undefined-type-annotations/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/null-and-undefined-type-annotations/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ [ - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [73, 76], @@ -49,8 +49,8 @@ end: { column: 12, line: 3 }, }, }, - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [86, 89], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/null-and-undefined-type-annotations/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/null-and-undefined-type-annotations/snapshots/6-AST-Alignment-Tokens.shot index bfef506c822e..2fc7fb8f35c0 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/null-and-undefined-type-annotations/snapshots/6-AST-Alignment-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/null-and-undefined-type-annotations/snapshots/6-AST-Alignment-Tokens.shot @@ -38,10 +38,8 @@ Snapshot Diff: end: { column: 6, line: 3 }, }, }, -- Keyword { -- type: 'Keyword', -+ Null { -+ type: 'Null', + Null { + type: 'Null', value: 'null', range: [80, 84], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/nullish-coalescing/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/nullish-coalescing/snapshots/4-Babel-Tokens.shot index 7efe3d3c1a01..bc7b5325ce7b 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/nullish-coalescing/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/nullish-coalescing/snapshots/4-Babel-Tokens.shot @@ -89,8 +89,8 @@ end: { column: 45, line: 3 }, }, }, - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [121, 124], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/object-with-escaped-properties/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/object-with-escaped-properties/snapshots/2-TSESTree-Tokens.shot index c79f24defb00..2449e4574bc0 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/object-with-escaped-properties/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/object-with-escaped-properties/snapshots/2-TSESTree-Tokens.shot @@ -39,8 +39,8 @@ end: { column: 6, line: 3 }, }, }, - Keyword { - type: "Keyword", + Null { + type: "Null", value: "null", range: [80, 84], @@ -239,8 +239,8 @@ end: { column: 10, line: 7 }, }, }, - Keyword { - type: "Keyword", + Null { + type: "Null", value: "null", range: [117, 121], @@ -329,8 +329,8 @@ end: { column: 8, line: 10 }, }, }, - Keyword { - type: "Keyword", + Null { + type: "Null", value: "null", range: [146, 150], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-null/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-null/snapshots/2-TSESTree-Tokens.shot index f3c7150f41d1..fed3e2747887 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-null/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-null/snapshots/2-TSESTree-Tokens.shot @@ -29,8 +29,8 @@ end: { column: 10, line: 3 }, }, }, - Keyword { - type: "Keyword", + Null { + type: "Null", value: "null", range: [84, 88], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-this/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-this/snapshots/2-TSESTree-Tokens.shot index 573d00dfabbf..c7bbf886221e 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-this/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-this/snapshots/2-TSESTree-Tokens.shot @@ -79,8 +79,8 @@ end: { column: 29, line: 4 }, }, }, - Keyword { - type: "Keyword", + Identifier { + type: "Identifier", value: "this", range: [124, 128], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-this/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-this/snapshots/6-AST-Alignment-Tokens.shot index cf45b4578a48..e60f93635f64 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-this/snapshots/6-AST-Alignment-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-this/snapshots/6-AST-Alignment-Tokens.shot @@ -88,10 +88,8 @@ Snapshot Diff: end: { column: 29, line: 4 }, }, }, -- Keyword { -- type: 'Keyword', -+ Identifier { -+ type: 'Identifier', + Identifier { + type: 'Identifier', value: 'this', range: [124, 128], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/union-intersection/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/union-intersection/snapshots/2-TSESTree-Tokens.shot index d17773cf1d68..c5d1e3db16f5 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/union-intersection/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/union-intersection/snapshots/2-TSESTree-Tokens.shot @@ -49,8 +49,8 @@ end: { column: 19, line: 3 }, }, }, - Keyword { - type: "Keyword", + Null { + type: "Null", value: "null", range: [93, 97], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/union-intersection/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/union-intersection/snapshots/4-Babel-Tokens.shot index e8b74eb74e4b..c5d1e3db16f5 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/union-intersection/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/union-intersection/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ [ - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [73, 76], @@ -89,8 +89,8 @@ end: { column: 37, line: 3 }, }, }, - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [111, 114], @@ -159,8 +159,8 @@ end: { column: 34, line: 4 }, }, }, - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [146, 149], @@ -269,8 +269,8 @@ end: { column: 45, line: 5 }, }, }, - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [192, 195], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/union-intersection/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/union-intersection/snapshots/6-AST-Alignment-Tokens.shot index d746756b46c1..1270fb2681e8 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/union-intersection/snapshots/6-AST-Alignment-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/union-intersection/snapshots/6-AST-Alignment-Tokens.shot @@ -58,10 +58,8 @@ Snapshot Diff: end: { column: 19, line: 3 }, }, }, -- Keyword { -- type: 'Keyword', -+ Null { -+ type: 'Null', + Null { + type: 'Null', value: 'null', range: [93, 97], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/unknown-type-annotation/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/unknown-type-annotation/snapshots/4-Babel-Tokens.shot index 81c2b521b7d5..693b4c9de7a5 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/unknown-type-annotation/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/unknown-type-annotation/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ [ - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [73, 76], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/variable-declaration-type-annotation-spacing/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/variable-declaration-type-annotation-spacing/snapshots/4-Babel-Tokens.shot index 35f693b45343..efe446c91415 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/variable-declaration-type-annotation-spacing/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/variable-declaration-type-annotation-spacing/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ [ - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [73, 76], diff --git a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/enum/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/enum/snapshots/1-TSESTree-AST.shot index 513eb9bcd84c..e483a20f2a29 100644 --- a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/enum/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/enum/snapshots/1-TSESTree-AST.shot @@ -8,7 +8,6 @@ Program { members: [ TSEnumMember { type: "TSEnumMember", - computed: false, id: Identifier { type: "Identifier", decorators: [], @@ -30,7 +29,6 @@ Program { }, TSEnumMember { type: "TSEnumMember", - computed: false, id: Identifier { type: "Identifier", decorators: [], diff --git a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/enum/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/enum/snapshots/5-AST-Alignment-AST.shot index 3c1cbd1bc2a0..544b72e407c8 100644 --- a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/enum/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/enum/snapshots/5-AST-Alignment-AST.shot @@ -15,7 +15,6 @@ Snapshot Diff: - members: Array [ - TSEnumMember { - type: 'TSEnumMember', -- computed: false, - id: Identifier { - type: 'Identifier', - decorators: Array [], @@ -59,7 +58,6 @@ Snapshot Diff: }, - TSEnumMember { - type: 'TSEnumMember', -- computed: false, - id: Identifier { - type: 'Identifier', - decorators: Array [], diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-empty-extends-implements/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-empty-extends-implements/snapshots/2-Babel-Error.shot index a7759221c36d..c2a01fb21025 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-empty-extends-implements/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-empty-extends-implements/snapshots/2-Babel-Error.shot @@ -1,4 +1,12 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > class-empty-extends-implements > Babel - Error`] -SyntaxError: Unexpected reserved word 'implements'. (3:18) +BabelError + 1 | // TODO: This fixture might be too large, and if so should be split up. + 2 | +> 3 | class Foo extends implements Bar { + | ^ Unexpected reserved word 'implements'. (3:18) + 4 | + 5 | } + 6 | + diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-empty-extends/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-empty-extends/snapshots/2-Babel-Error.shot index 4ec40f4b3b0e..d66d7ee5ec1a 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-empty-extends/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-empty-extends/snapshots/2-Babel-Error.shot @@ -1,4 +1,9 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > class-empty-extends > Babel - Error`] -SyntaxError: Unexpected token, expected "{" (6:0) +BabelError + 4 | + 5 | } +> 6 | + | ^ Unexpected token, expected "{" (6:0) + diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-extends-empty-implements/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-extends-empty-implements/snapshots/2-Babel-Error.shot index 8e3eea6c1131..d9a512c232d2 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-extends-empty-implements/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-extends-empty-implements/snapshots/2-Babel-Error.shot @@ -1,4 +1,12 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > class-extends-empty-implements > Babel - Error`] -SyntaxError: 'implements' list cannot be empty. (3:33) +BabelError + 1 | // TODO: This fixture might be too large, and if so should be split up. + 2 | +> 3 | class Foo extends Bar implements { + | ^ 'implements' list cannot be empty. (3:33) + 4 | + 5 | } + 6 | + diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-multiple-implements/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-multiple-implements/snapshots/2-Babel-Error.shot index 9bc9aef71f23..b3835b41371c 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-multiple-implements/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-multiple-implements/snapshots/2-Babel-Error.shot @@ -1,4 +1,10 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > class-multiple-implements > Babel - Error`] -SyntaxError: Unexpected token, expected "," (3:21) +BabelError + 1 | // TODO: This fixture might be too large, and if so should be split up. + 2 | +> 3 | class a implements b implements c {} + | ^ Unexpected token, expected "," (3:21) + 4 | + diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-enum-declaration/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-enum-declaration/snapshots/2-Babel-Error.shot index 78f8c4703d14..49920535e977 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-enum-declaration/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-enum-declaration/snapshots/2-Babel-Error.shot @@ -1,4 +1,9 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > decorator-on-enum-declaration > Babel - Error`] -SyntaxError: Leading decorators must be attached to a class declaration. (3:5) +BabelError + 1 | // TODO: This fixture might be too large, and if so should be split up. + 2 | +> 3 | @dec enum E {} + | ^ Leading decorators must be attached to a class declaration. (3:5) + diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-function/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-function/snapshots/2-Babel-Error.shot index 0e2ce63ec8c7..c21fbbfa8050 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-function/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-function/snapshots/2-Babel-Error.shot @@ -1,4 +1,10 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > decorator-on-function > Babel - Error`] -SyntaxError: Leading decorators must be attached to a class declaration. (4:0) +BabelError + 2 | + 3 | @dec +> 4 | function b(){} + | ^ Leading decorators must be attached to a class declaration. (4:0) + 5 | + diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-interface-declaration/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-interface-declaration/snapshots/2-Babel-Error.shot index 6c236792b4cf..cd433bb6eff6 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-interface-declaration/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-interface-declaration/snapshots/2-Babel-Error.shot @@ -1,4 +1,9 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > decorator-on-interface-declaration > Babel - Error`] -SyntaxError: Leading decorators must be attached to a class declaration. (4:0) +BabelError + 2 | + 3 | @deco() +> 4 | interface M {} + | ^ Leading decorators must be attached to a class declaration. (4:0) + diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-variable/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-variable/snapshots/2-Babel-Error.shot index de18083b45ff..2de8a9c2e651 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-variable/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-variable/snapshots/2-Babel-Error.shot @@ -1,4 +1,10 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > decorator-on-variable > Babel - Error`] -SyntaxError: Leading decorators must be attached to a class declaration. (4:0) +BabelError + 2 | + 3 | @deco() +> 4 | const a = 1 + | ^ Leading decorators must be attached to a class declaration. (4:0) + 5 | + diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters/fixture.ts b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-call-expression-with-comment/fixture.ts similarity index 76% rename from packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters/fixture.ts rename to packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-call-expression-with-comment/fixture.ts index add9711e2f79..1b6ae87f6359 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters/fixture.ts +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-call-expression-with-comment/fixture.ts @@ -1,3 +1,3 @@ // TODO: This fixture might be too large, and if so should be split up. -function f1<>() {} +foo< /* empty */ >(); diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-call-expression-with-comment/snapshots/1-Babel-Error.shot similarity index 51% rename from packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters/snapshots/1-Babel-Error.shot rename to packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-call-expression-with-comment/snapshots/1-Babel-Error.shot index ae64111c78c0..4992c1bda8ba 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters/snapshots/1-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-call-expression-with-comment/snapshots/1-Babel-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ empty-type-parameters Babel - Error 1`] = `[SyntaxError: Type parameter list cannot be empty. (3:11)]`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ empty-type-arguments-in-call-expression Babel - Error 1`] = `[SyntaxError: Unexpected token (3:4)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-call-expression-with-comment/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-call-expression-with-comment/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..33b566c2ad26 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-call-expression-with-comment/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,9 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > empty-type-arguments-in-call-expression-with-comment > TSESTree - Error`] +TSError + 1 | // TODO: This fixture might be too large, and if so should be split up. + 2 | +> 3 | foo< /* empty */ >(); + | ^^^^^^^^^^^^^^^ Type argument list cannot be empty. + 4 | diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-call-expression-with-comment/snapshots/2-Alignment-Error.shot similarity index 52% rename from packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters/snapshots/2-Alignment-Error.shot rename to packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-call-expression-with-comment/snapshots/2-Alignment-Error.shot index 14e18802b751..c7ddaf4d3507 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters/snapshots/2-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-call-expression-with-comment/snapshots/2-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ empty-type-parameters Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ empty-type-arguments-in-call-expression Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-call-expression-with-comment/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-call-expression-with-comment/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..8ea146fad19d --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-call-expression-with-comment/snapshots/2-Babel-Error.shot @@ -0,0 +1,10 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > empty-type-arguments-in-call-expression-with-comment > Babel - Error`] +BabelError + 1 | // TODO: This fixture might be too large, and if so should be split up. + 2 | +> 3 | foo< /* empty */ >(); + | ^ Unexpected token (3:17) + 4 | + diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-call-expression-with-comment/snapshots/3-Alignment-Error.shot similarity index 58% rename from packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters/snapshots/1-TSESTree-Error.shot rename to packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-call-expression-with-comment/snapshots/3-Alignment-Error.shot index c1b25cba23a7..6e7b21bf1776 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-call-expression-with-comment/snapshots/3-Alignment-Error.shot @@ -1,4 +1,4 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > empty-type-parameters > TSESTree - Error`] -NO ERROR +exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > empty-type-arguments-in-call-expression-with-comment > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-call-expression/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-call-expression/snapshots/1-TSESTree-Error.shot index fa76bcceec4c..2bc9a5f6b7c7 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-call-expression/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-call-expression/snapshots/1-TSESTree-Error.shot @@ -1,4 +1,9 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > empty-type-arguments-in-call-expression > TSESTree - Error`] -NO ERROR +TSError + 1 | // TODO: This fixture might be too large, and if so should be split up. + 2 | +> 3 | foo<>(); + | ^^ Type argument list cannot be empty. + 4 | diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-call-expression/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-call-expression/snapshots/2-Babel-Error.shot index f59176307e6a..91534ecc195a 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-call-expression/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-call-expression/snapshots/2-Babel-Error.shot @@ -1,4 +1,10 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > empty-type-arguments-in-call-expression > Babel - Error`] -SyntaxError: Unexpected token (3:4) +BabelError + 1 | // TODO: This fixture might be too large, and if so should be split up. + 2 | +> 3 | foo<>(); + | ^ Unexpected token (3:4) + 4 | + diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-call-expression/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-call-expression/snapshots/3-Alignment-Error.shot index 6cd8bffbdf9b..e42614b0c09e 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-call-expression/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-call-expression/snapshots/3-Alignment-Error.shot @@ -1,4 +1,4 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > empty-type-arguments-in-call-expression > Error Alignment`] -Babel errored but TSESTree didn't +Both errored diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-new-expression/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-new-expression/snapshots/1-TSESTree-Error.shot index 04397c1ad1f6..398387294483 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-new-expression/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-new-expression/snapshots/1-TSESTree-Error.shot @@ -1,4 +1,9 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > empty-type-arguments-in-new-expression > TSESTree - Error`] -NO ERROR +TSError + 1 | // TODO: This fixture might be too large, and if so should be split up. + 2 | +> 3 | new Foo<>() + | ^^ Type argument list cannot be empty. + 4 | diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-new-expression/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-new-expression/snapshots/2-Babel-Error.shot index 93efdda3f71f..14594e627a49 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-new-expression/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-new-expression/snapshots/2-Babel-Error.shot @@ -1,4 +1,10 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > empty-type-arguments-in-new-expression > Babel - Error`] -SyntaxError: Unexpected token (3:8) +BabelError + 1 | // TODO: This fixture might be too large, and if so should be split up. + 2 | +> 3 | new Foo<>() + | ^ Unexpected token (3:8) + 4 | + diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-new-expression/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-new-expression/snapshots/3-Alignment-Error.shot index d2b55f055473..704d3be4ffe4 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-new-expression/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-new-expression/snapshots/3-Alignment-Error.shot @@ -1,4 +1,4 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > empty-type-arguments-in-new-expression > Error Alignment`] -Babel errored but TSESTree didn't +Both errored diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments/snapshots/1-TSESTree-Error.shot index e49d52208b33..ca475faf4bcb 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments/snapshots/1-TSESTree-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > empty-type-arguments > TSESTree - Error`] -NO ERROR +TSError + 1 | // TODO: This fixture might be too large, and if so should be split up. + 2 | +> 3 | const foo: Foo<> + | ^^ Type argument list cannot be empty. diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments/snapshots/2-Babel-Error.shot index ada9518aae7f..50d06d9aa9bd 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments/snapshots/2-Babel-Error.shot @@ -1,4 +1,9 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > empty-type-arguments > Babel - Error`] -SyntaxError: Type argument list cannot be empty. (3:14) +BabelError + 1 | // TODO: This fixture might be too large, and if so should be split up. + 2 | +> 3 | const foo: Foo<> + | ^ Type argument list cannot be empty. (3:14) + diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments/snapshots/3-Alignment-Error.shot index 85b0b7246e10..7e8871022446 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments/snapshots/3-Alignment-Error.shot @@ -1,4 +1,4 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > empty-type-arguments > Error Alignment`] -Babel errored but TSESTree didn't +Both errored diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-arrow-function/fixture.ts b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-arrow-function/fixture.ts index add9711e2f79..0367dc4b8cad 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-arrow-function/fixture.ts +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-arrow-function/fixture.ts @@ -1,3 +1 @@ -// TODO: This fixture might be too large, and if so should be split up. - -function f1<>() {} +const arrowFunction = < /* empty */ >() => {}; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-arrow-function/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-arrow-function/snapshots/1-TSESTree-Error.shot index f77a6fda39cf..5c7d9964c1b8 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-arrow-function/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-arrow-function/snapshots/1-TSESTree-Error.shot @@ -1,4 +1,7 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > empty-type-parameters-in-arrow-function > TSESTree - Error`] -NO ERROR +TSError +> 1 | const arrowFunction = < /* empty */ >() => {}; + | ^ Type expected. + 2 | diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-arrow-function/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-arrow-function/snapshots/2-Babel-Error.shot index bea6f602ef56..536bb927ec57 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-arrow-function/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-arrow-function/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > empty-type-parameters-in-arrow-function > Babel - Error`] -SyntaxError: Type parameter list cannot be empty. (3:11) +BabelError +> 1 | const arrowFunction = < /* empty */ >() => {}; + | ^ Type parameter list cannot be empty. (1:22) + 2 | + diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-arrow-function/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-arrow-function/snapshots/3-Alignment-Error.shot index ff94d062b9d7..84a2d786eff3 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-arrow-function/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-arrow-function/snapshots/3-Alignment-Error.shot @@ -1,4 +1,4 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > empty-type-parameters-in-arrow-function > Error Alignment`] -Babel errored but TSESTree didn't +Both errored diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-constructor/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-constructor/snapshots/1-TSESTree-Error.shot index 2546fb018409..b9c00c6592d0 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-constructor/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-constructor/snapshots/1-TSESTree-Error.shot @@ -1,4 +1,10 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > empty-type-parameters-in-constructor > TSESTree - Error`] -NO ERROR +TSError + 2 | + 3 | class foo { +> 4 | constructor<>() {} + | ^^ Type parameter list cannot be empty. + 5 | } + 6 | diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-constructor/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-constructor/snapshots/2-Babel-Error.shot index 690ef1aa63bb..16a2f804505e 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-constructor/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-constructor/snapshots/2-Babel-Error.shot @@ -1,4 +1,11 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > empty-type-parameters-in-constructor > Babel - Error`] -SyntaxError: Type parameter list cannot be empty. (4:13) +BabelError + 2 | + 3 | class foo { +> 4 | constructor<>() {} + | ^ Type parameter list cannot be empty. (4:13) + 5 | } + 6 | + diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-constructor/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-constructor/snapshots/3-Alignment-Error.shot index 958c1dec19b5..99acc7c21d77 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-constructor/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-constructor/snapshots/3-Alignment-Error.shot @@ -1,4 +1,4 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > empty-type-parameters-in-constructor > Error Alignment`] -Babel errored but TSESTree didn't +Both errored diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-function-declaration/fixture.ts b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-function-declaration/fixture.ts new file mode 100644 index 000000000000..1dbabedb798c --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-function-declaration/fixture.ts @@ -0,0 +1 @@ +function f1<>() {} diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-function-declaration/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-function-declaration/snapshots/1-Babel-Error.shot new file mode 100644 index 000000000000..12440d8874fa --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-function-declaration/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ empty-type-parameters-in-arrow-function Babel - Error 1`] = `[SyntaxError: Type parameter list cannot be empty. (3:11)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-function-declaration/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-function-declaration/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..57bcc54e2635 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-function-declaration/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,7 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > empty-type-parameters-in-function-declaration > TSESTree - Error`] +TSError +> 1 | function f1<>() {} + | ^^ Type parameter list cannot be empty. + 2 | diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-function-declaration/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-function-declaration/snapshots/2-Alignment-Error.shot new file mode 100644 index 000000000000..04350071ad74 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-function-declaration/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ empty-type-parameters-in-arrow-function Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-function-declaration/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-function-declaration/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..e9932497ceaa --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-function-declaration/snapshots/2-Babel-Error.shot @@ -0,0 +1,8 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > empty-type-parameters-in-function-declaration > Babel - Error`] +BabelError +> 1 | function f1<>() {} + | ^ Type parameter list cannot be empty. (1:11) + 2 | + diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-function-declaration/snapshots/3-Alignment-Error.shot similarity index 60% rename from packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters/snapshots/3-Alignment-Error.shot rename to packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-function-declaration/snapshots/3-Alignment-Error.shot index 4fd1ec55af88..8c7aff64046a 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-function-declaration/snapshots/3-Alignment-Error.shot @@ -1,4 +1,4 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > empty-type-parameters > Error Alignment`] -Babel errored but TSESTree didn't +exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > empty-type-parameters-in-function-declaration > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-function-expression/fixture.ts b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-function-expression/fixture.ts index 43d8a0629438..97b3b1bd5b97 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-function-expression/fixture.ts +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-function-expression/fixture.ts @@ -1,3 +1 @@ -// TODO: This fixture might be too large, and if so should be split up. - const foo = function<>() {} diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-function-expression/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-function-expression/snapshots/1-TSESTree-Error.shot index 40cee72976cb..baeead551b4b 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-function-expression/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-function-expression/snapshots/1-TSESTree-Error.shot @@ -1,4 +1,7 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > empty-type-parameters-in-function-expression > TSESTree - Error`] -NO ERROR +TSError +> 1 | const foo = function<>() {} + | ^^ Type parameter list cannot be empty. + 2 | diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-function-expression/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-function-expression/snapshots/2-Babel-Error.shot index 8865ff0be4c9..3dff8a44c1db 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-function-expression/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-function-expression/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > empty-type-parameters-in-function-expression > Babel - Error`] -SyntaxError: Type parameter list cannot be empty. (3:20) +BabelError +> 1 | const foo = function<>() {} + | ^ Type parameter list cannot be empty. (1:20) + 2 | + diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-function-expression/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-function-expression/snapshots/3-Alignment-Error.shot index defbf77fcf62..1b64cd4e9668 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-function-expression/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-function-expression/snapshots/3-Alignment-Error.shot @@ -1,4 +1,4 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > empty-type-parameters-in-function-expression > Error Alignment`] -Babel errored but TSESTree didn't +Both errored diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-method-signature/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-method-signature/snapshots/1-TSESTree-Error.shot index 3f66104ff937..bcc1d1c1ea7d 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-method-signature/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-method-signature/snapshots/1-TSESTree-Error.shot @@ -1,4 +1,10 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > empty-type-parameters-in-method-signature > TSESTree - Error`] -NO ERROR +TSError + 2 | + 3 | interface foo { +> 4 | test<>(); + | ^^ Type parameter list cannot be empty. + 5 | } + 6 | diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-method-signature/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-method-signature/snapshots/2-Babel-Error.shot index 78845bb622fc..e64d189f57d3 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-method-signature/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-method-signature/snapshots/2-Babel-Error.shot @@ -1,4 +1,11 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > empty-type-parameters-in-method-signature > Babel - Error`] -SyntaxError: Type parameter list cannot be empty. (4:6) +BabelError + 2 | + 3 | interface foo { +> 4 | test<>(); + | ^ Type parameter list cannot be empty. (4:6) + 5 | } + 6 | + diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-method-signature/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-method-signature/snapshots/3-Alignment-Error.shot index 78a1922357aa..42b81315e508 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-method-signature/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-method-signature/snapshots/3-Alignment-Error.shot @@ -1,4 +1,4 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > empty-type-parameters-in-method-signature > Error Alignment`] -Babel errored but TSESTree didn't +Both errored diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-method/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-method/snapshots/1-TSESTree-Error.shot index 6cdb099d73e4..ceec3f99b420 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-method/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-method/snapshots/1-TSESTree-Error.shot @@ -1,4 +1,10 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > empty-type-parameters-in-method > TSESTree - Error`] -NO ERROR +TSError + 2 | + 3 | class foo { +> 4 | test<>() {} + | ^^ Type parameter list cannot be empty. + 5 | } + 6 | diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-method/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-method/snapshots/2-Babel-Error.shot index 8edfff6a61ee..3094f70c4dea 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-method/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-method/snapshots/2-Babel-Error.shot @@ -1,4 +1,11 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > empty-type-parameters-in-method > Babel - Error`] -SyntaxError: Type parameter list cannot be empty. (4:6) +BabelError + 2 | + 3 | class foo { +> 4 | test<>() {} + | ^ Type parameter list cannot be empty. (4:6) + 5 | } + 6 | + diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-method/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-method/snapshots/3-Alignment-Error.shot index 5c8dfc4b3d35..d6d8837d6520 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-method/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-method/snapshots/3-Alignment-Error.shot @@ -1,4 +1,4 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > empty-type-parameters-in-method > Error Alignment`] -Babel errored but TSESTree didn't +Both errored diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters/snapshots/2-Babel-Error.shot deleted file mode 100644 index 18c13853083c..000000000000 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters/snapshots/2-Babel-Error.shot +++ /dev/null @@ -1,4 +0,0 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - -exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > empty-type-parameters > Babel - Error`] -SyntaxError: Type parameter list cannot be empty. (3:11) diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/enum-with-keywords/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/enum-with-keywords/snapshots/2-Babel-Error.shot index 4a5bede8b8ba..8fc83f6a5be4 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/enum-with-keywords/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/enum-with-keywords/snapshots/2-Babel-Error.shot @@ -1,4 +1,9 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > enum-with-keywords > Babel - Error`] -SyntaxError: Unexpected token, expected "{" (3:7) +BabelError + 1 | // TODO: This fixture might be too large, and if so should be split up. + 2 | +> 3 | export private public protected static readonly abstract async enum X {} + | ^ Unexpected token, expected "{" (3:7) + diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/index-signature-parameters/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/index-signature-parameters/snapshots/2-Babel-Error.shot index 2cc0c09a7eaf..554c009cecd0 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/index-signature-parameters/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/index-signature-parameters/snapshots/2-Babel-Error.shot @@ -1,4 +1,11 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > index-signature-parameters > Babel - Error`] -SyntaxError: Unexpected token, expected "]" (4:12) +BabelError + 2 | + 3 | type foo = { +> 4 | [a: string, b: string]: string; + | ^ Unexpected token, expected "]" (4:12) + 5 | } + 6 | + diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-empty-extends/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-empty-extends/snapshots/2-Babel-Error.shot index c8fd8337e295..0c7e138c8054 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-empty-extends/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-empty-extends/snapshots/2-Babel-Error.shot @@ -1,4 +1,12 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > interface-empty-extends > Babel - Error`] -SyntaxError: 'extends' list cannot be empty. (3:22) +BabelError + 1 | // TODO: This fixture might be too large, and if so should be split up. + 2 | +> 3 | interface Foo extends { + | ^ 'extends' list cannot be empty. (3:22) + 4 | + 5 | } + 6 | + diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-implements/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-implements/snapshots/2-Babel-Error.shot index 363365dcf16d..c422799a230e 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-implements/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-implements/snapshots/2-Babel-Error.shot @@ -1,4 +1,10 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > interface-implements > Babel - Error`] -SyntaxError: Unexpected token, expected "{" (3:12) +BabelError + 1 | // TODO: This fixture might be too large, and if so should be split up. + 2 | +> 3 | interface d implements e {} + | ^ Unexpected token, expected "{" (3:12) + 4 | + diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-export/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-export/snapshots/2-Babel-Error.shot index 68489300cc2e..08b5aa8c4257 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-export/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-export/snapshots/2-Babel-Error.shot @@ -1,4 +1,12 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > interface-index-signature-export > Babel - Error`] -SyntaxError: Unexpected token, expected ";" (4:9) +BabelError + 2 | + 3 | interface Foo { +> 4 | export [baz: string]: string; + | ^ Unexpected token, expected ";" (4:9) + 5 | } + 6 | + 7 | + diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-private/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-private/snapshots/2-Babel-Error.shot index 1647b535967c..86a7acc9b701 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-private/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-private/snapshots/2-Babel-Error.shot @@ -1,4 +1,12 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > interface-index-signature-private > Babel - Error`] -SyntaxError: 'private' modifier cannot appear on a type member. (4:2) +BabelError + 2 | + 3 | interface Foo { +> 4 | private [baz: string]: string; + | ^ 'private' modifier cannot appear on a type member. (4:2) + 5 | } + 6 | + 7 | + diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-protected/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-protected/snapshots/2-Babel-Error.shot index 2950f6174dcf..aa422f5e065f 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-protected/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-protected/snapshots/2-Babel-Error.shot @@ -1,4 +1,12 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > interface-index-signature-protected > Babel - Error`] -SyntaxError: 'protected' modifier cannot appear on a type member. (4:2) +BabelError + 2 | + 3 | interface Foo { +> 4 | protected [baz: string]: string; + | ^ 'protected' modifier cannot appear on a type member. (4:2) + 5 | } + 6 | + 7 | + diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-public/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-public/snapshots/2-Babel-Error.shot index 1d027ab3288d..7a6f073d84c1 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-public/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-public/snapshots/2-Babel-Error.shot @@ -1,4 +1,12 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > interface-index-signature-public > Babel - Error`] -SyntaxError: 'public' modifier cannot appear on a type member. (4:2) +BabelError + 2 | + 3 | interface Foo { +> 4 | public [baz: string]: string; + | ^ 'public' modifier cannot appear on a type member. (4:2) + 5 | } + 6 | + 7 | + diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-static/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-static/snapshots/2-Babel-Error.shot index d29363a7d59a..12fd7616e919 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-static/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-static/snapshots/2-Babel-Error.shot @@ -1,4 +1,12 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > interface-index-signature-static > Babel - Error`] -SyntaxError: 'static' modifier cannot appear on a type member. (4:2) +BabelError + 2 | + 3 | interface Foo { +> 4 | static [baz: string]: string; + | ^ 'static' modifier cannot appear on a type member. (4:2) + 5 | } + 6 | + 7 | + diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-export/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-export/snapshots/2-Babel-Error.shot index a0bf025bfd18..fa5282c6d766 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-export/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-export/snapshots/2-Babel-Error.shot @@ -1,4 +1,12 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > interface-method-export > Babel - Error`] -SyntaxError: Unexpected token, expected ";" (4:11) +BabelError + 2 | + 3 | interface Foo { +> 4 | export g(bar: string): void; + | ^ Unexpected token, expected ";" (4:11) + 5 | } + 6 | + 7 | + diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-private/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-private/snapshots/2-Babel-Error.shot index 4f4403185561..d5dbbcdfca6d 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-private/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-private/snapshots/2-Babel-Error.shot @@ -1,4 +1,12 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > interface-method-private > Babel - Error`] -SyntaxError: 'private' modifier cannot appear on a type member. (4:4) +BabelError + 2 | + 3 | interface Foo { +> 4 | private g(bar: string): void; + | ^ 'private' modifier cannot appear on a type member. (4:4) + 5 | } + 6 | + 7 | + diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-protected/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-protected/snapshots/2-Babel-Error.shot index 7c6aea8cbc42..567f70c03ab5 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-protected/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-protected/snapshots/2-Babel-Error.shot @@ -1,4 +1,12 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > interface-method-protected > Babel - Error`] -SyntaxError: 'protected' modifier cannot appear on a type member. (4:2) +BabelError + 2 | + 3 | interface Foo { +> 4 | protected g(bar: string): void; + | ^ 'protected' modifier cannot appear on a type member. (4:2) + 5 | } + 6 | + 7 | + diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-public/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-public/snapshots/2-Babel-Error.shot index 67adc051ce12..9d0c9ab867f4 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-public/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-public/snapshots/2-Babel-Error.shot @@ -1,4 +1,12 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > interface-method-public > Babel - Error`] -SyntaxError: 'public' modifier cannot appear on a type member. (4:4) +BabelError + 2 | + 3 | interface Foo { +> 4 | public g(bar: string): void; + | ^ 'public' modifier cannot appear on a type member. (4:4) + 5 | } + 6 | + 7 | + diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-readonly/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-readonly/snapshots/2-Babel-Error.shot index e1d86c915bec..c6663365d284 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-readonly/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-readonly/snapshots/2-Babel-Error.shot @@ -1,4 +1,11 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > interface-method-readonly > Babel - Error`] -SyntaxError: 'readonly' modifier can only appear on a property declaration or index signature. (4:2) +BabelError + 2 | + 3 | interface Foo { +> 4 | readonly g(bar: string): void; + | ^ 'readonly' modifier can only appear on a property declaration or index signature. (4:2) + 5 | } + 6 | + diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-static/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-static/snapshots/2-Babel-Error.shot index 9c86c96dcf2c..f3ef64ea4040 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-static/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-static/snapshots/2-Babel-Error.shot @@ -1,4 +1,12 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > interface-method-static > Babel - Error`] -SyntaxError: 'static' modifier cannot appear on a type member. (4:2) +BabelError + 2 | + 3 | interface Foo { +> 4 | static g(bar: string): void; + | ^ 'static' modifier cannot appear on a type member. (4:2) + 5 | } + 6 | + 7 | + diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-multiple-extends/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-multiple-extends/snapshots/1-TSESTree-Error.shot index b9716b289515..f57a1b692cd1 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-multiple-extends/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-multiple-extends/snapshots/1-TSESTree-Error.shot @@ -1,4 +1,9 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > interface-multiple-extends > TSESTree - Error`] -NO ERROR +TSError + 1 | // TODO: This fixture might be too large, and if so should be split up. + 2 | +> 3 | interface foo extends bar extends baz {} + | ^^^^^^^^^^^ 'extends' clause already seen. + 4 | diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-multiple-extends/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-multiple-extends/snapshots/2-Babel-Error.shot index 5ce932646399..d2a84ab002b5 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-multiple-extends/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-multiple-extends/snapshots/2-Babel-Error.shot @@ -1,4 +1,10 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > interface-multiple-extends > Babel - Error`] -SyntaxError: Unexpected token, expected "," (3:26) +BabelError + 1 | // TODO: This fixture might be too large, and if so should be split up. + 2 | +> 3 | interface foo extends bar extends baz {} + | ^ Unexpected token, expected "," (3:26) + 4 | + diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-multiple-extends/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-multiple-extends/snapshots/3-Alignment-Error.shot index 8c05c9ec9327..2b5ef310d7cd 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-multiple-extends/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-multiple-extends/snapshots/3-Alignment-Error.shot @@ -1,4 +1,4 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > interface-multiple-extends > Error Alignment`] -Babel errored but TSESTree didn't +Both errored diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-export/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-export/snapshots/2-Babel-Error.shot index 91b39c29c98a..6518ef2afcf9 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-export/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-export/snapshots/2-Babel-Error.shot @@ -1,4 +1,12 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > interface-property-export > Babel - Error`] -SyntaxError: Unexpected token, expected ";" (4:9) +BabelError + 2 | + 3 | interface Foo { +> 4 | export a: string; + | ^ Unexpected token, expected ";" (4:9) + 5 | } + 6 | + 7 | + diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-private/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-private/snapshots/2-Babel-Error.shot index 2f122b91e44a..504c0e300be5 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-private/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-private/snapshots/2-Babel-Error.shot @@ -1,4 +1,12 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > interface-property-private > Babel - Error`] -SyntaxError: 'private' modifier cannot appear on a type member. (4:2) +BabelError + 2 | + 3 | interface Foo { +> 4 | private b: string; + | ^ 'private' modifier cannot appear on a type member. (4:2) + 5 | } + 6 | + 7 | + diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-protected/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-protected/snapshots/2-Babel-Error.shot index 3f79550c6121..09ee6837fbc8 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-protected/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-protected/snapshots/2-Babel-Error.shot @@ -1,4 +1,12 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > interface-property-protected > Babel - Error`] -SyntaxError: 'protected' modifier cannot appear on a type member. (4:2) +BabelError + 2 | + 3 | interface Foo { +> 4 | protected a: string; + | ^ 'protected' modifier cannot appear on a type member. (4:2) + 5 | } + 6 | + 7 | + diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-public/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-public/snapshots/2-Babel-Error.shot index 57ead1416304..29882083cc96 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-public/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-public/snapshots/2-Babel-Error.shot @@ -1,4 +1,12 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > interface-property-public > Babel - Error`] -SyntaxError: 'public' modifier cannot appear on a type member. (4:4) +BabelError + 2 | + 3 | interface Foo { +> 4 | public a: string; + | ^ 'public' modifier cannot appear on a type member. (4:4) + 5 | } + 6 | + 7 | + diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-static/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-static/snapshots/2-Babel-Error.shot index b2a5dab697a4..cf0246ca09ed 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-static/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-static/snapshots/2-Babel-Error.shot @@ -1,4 +1,12 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > interface-property-static > Babel - Error`] -SyntaxError: 'static' modifier cannot appear on a type member. (4:2) +BabelError + 2 | + 3 | interface Foo { +> 4 | static a: string; + | ^ 'static' modifier cannot appear on a type member. (4:2) + 5 | } + 6 | + 7 | + diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-with-default-value/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-with-default-value/snapshots/2-Babel-Error.shot index 5fa027e9cf4e..c05e5ad7cfa0 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-with-default-value/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-with-default-value/snapshots/2-Babel-Error.shot @@ -1,4 +1,11 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > interface-property-with-default-value > Babel - Error`] -SyntaxError: Unexpected token, expected ";" (4:14) +BabelError + 2 | + 3 | interface Foo { +> 4 | bar: string = 'a'; + | ^ Unexpected token, expected ";" (4:14) + 5 | } + 6 | + diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-with-no-body/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-with-no-body/snapshots/2-Babel-Error.shot index ae893daf528c..ecc6c39a7e58 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-with-no-body/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-with-no-body/snapshots/2-Babel-Error.shot @@ -1,4 +1,9 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > interface-with-no-body > Babel - Error`] -SyntaxError: Unexpected token, expected "{" (4:0) +BabelError + 2 | + 3 | interface Foo +> 4 | + | ^ Unexpected token, expected "{" (4:0) + diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-with-optional-index-signature/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-with-optional-index-signature/snapshots/2-Babel-Error.shot index 38311897df43..532294b0ddfa 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-with-optional-index-signature/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-with-optional-index-signature/snapshots/2-Babel-Error.shot @@ -1,4 +1,11 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > interface-with-optional-index-signature > Babel - Error`] -SyntaxError: Unexpected token (4:7) +BabelError + 2 | + 3 | interface Foo { +> 4 | [fff?: number]: string; + | ^ Unexpected token (4:7) + 5 | } + 6 | + diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/object-assertion-not-allowed/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/object-assertion-not-allowed/snapshots/2-Babel-Error.shot index e15c3c0564bd..00507051d9c1 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/object-assertion-not-allowed/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/object-assertion-not-allowed/snapshots/2-Babel-Error.shot @@ -1,4 +1,10 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > object-assertion-not-allowed > Babel - Error`] -SyntaxError: Unexpected token, expected "," (3:3) +BabelError + 1 | // TODO: This fixture might be too large, and if so should be split up. + 2 | +> 3 | ({a!} = {}) + | ^ Unexpected token, expected "," (3:3) + 4 | + diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/object-optional-not-allowed/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/object-optional-not-allowed/snapshots/2-Babel-Error.shot index 4008e062d595..e1f5b59abe76 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/object-optional-not-allowed/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/object-optional-not-allowed/snapshots/2-Babel-Error.shot @@ -1,4 +1,10 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > object-optional-not-allowed > Babel - Error`] -SyntaxError: Unexpected token, expected "," (3:3) +BabelError + 1 | // TODO: This fixture might be too large, and if so should be split up. + 2 | +> 3 | ({a?} = {}) + | ^ Unexpected token, expected "," (3:3) + 4 | + diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/solo-const/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/solo-const/snapshots/2-Babel-Error.shot index 84f2232f20d1..f02a6ac4f0b2 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/solo-const/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/solo-const/snapshots/2-Babel-Error.shot @@ -1,4 +1,9 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > errorRecovery > _error_ > solo-const > Babel - Error`] -SyntaxError: Unexpected token (3:5) +BabelError + 1 | // TODO: This fixture might be too large, and if so should be split up. + 2 | +> 3 | const + | ^ Unexpected token (3:5) + diff --git a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/_error_/instantiation-expression/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/_error_/instantiation-expression/snapshots/2-Babel-Error.shot index 77fa78f82897..a1b2396cef0c 100644 --- a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/_error_/instantiation-expression/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/_error_/instantiation-expression/snapshots/2-Babel-Error.shot @@ -1,4 +1,12 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > expressions > _error_ > instantiation-expression > Babel - Error`] -SyntaxError: Unexpected token (5:7) +BabelError + 3 | a; + 4 | +> 5 | a; + | ^ Unexpected token (5:7) + 6 | a(); + 7 | a?.(); + 8 | a?.b(); + diff --git a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/_error_/parameter-array-pattern-decorator/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/_error_/parameter-array-pattern-decorator/snapshots/2-Babel-Error.shot index b4627fafc300..99340a2f665a 100644 --- a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/_error_/parameter-array-pattern-decorator/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/_error_/parameter-array-pattern-decorator/snapshots/2-Babel-Error.shot @@ -1,4 +1,11 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > parameter-decorators > _error_ > parameter-array-pattern-decorator > Babel - Error`] -SyntaxError: Unexpected token (4:28) +BabelError + 2 | + 3 | class Foo { +> 4 | bar(@special(true) [ bar ]: any) {} + | ^ Unexpected token (4:28) + 5 | } + 6 | + diff --git a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/_error_/parameter-rest-element-decorator/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/_error_/parameter-rest-element-decorator/snapshots/2-Babel-Error.shot index 6d7c60703ac4..646af8ded572 100644 --- a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/_error_/parameter-rest-element-decorator/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/_error_/parameter-rest-element-decorator/snapshots/2-Babel-Error.shot @@ -1,4 +1,11 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > parameter-decorators > _error_ > parameter-rest-element-decorator > Babel - Error`] -SyntaxError: Unexpected token (4:21) +BabelError + 2 | + 3 | class Foo { +> 4 | bar(@special(true) ...foo: any) {} + | ^ Unexpected token (4:21) + 5 | } + 6 | + diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-with-null/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-with-null/snapshots/2-TSESTree-Tokens.shot index 19f272b4f0a1..8e7e2549262f 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-with-null/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-with-null/snapshots/2-TSESTree-Tokens.shot @@ -89,8 +89,8 @@ end: { column: 40, line: 3 }, }, }, - Keyword { - type: "Keyword", + Null { + type: "Null", value: "null", range: [114, 118], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-with-null/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-with-null/snapshots/4-Babel-Tokens.shot index 9c14b6f29d0d..8e7e2549262f 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-with-null/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-with-null/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ [ - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [73, 76], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-with-null/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-with-null/snapshots/6-AST-Alignment-Tokens.shot index 56c8590cf6bb..56f0dedb193b 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-with-null/snapshots/6-AST-Alignment-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-with-null/snapshots/6-AST-Alignment-Tokens.shot @@ -98,10 +98,8 @@ Snapshot Diff: end: { column: 40, line: 3 }, }, }, -- Keyword { -- type: 'Keyword', -+ Null { -+ type: 'Null', + Null { + type: 'Null', value: 'null', range: [114, 118], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional/snapshots/4-Babel-Tokens.shot index 220fe9555e9b..f95f0ec5e899 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ [ - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [73, 76], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-generic/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-generic/snapshots/4-Babel-Tokens.shot index c96f24501f5e..1526af3e6f08 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-generic/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-generic/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ [ - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [73, 76], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-in-generic/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-in-generic/snapshots/4-Babel-Tokens.shot index d8b85c337844..308ede1f966f 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-in-generic/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-in-generic/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ [ - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [73, 76], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-with-rest/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-with-rest/snapshots/4-Babel-Tokens.shot index 1177bc6d5393..749b397d0672 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-with-rest/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-with-rest/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ [ - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [73, 76], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor/snapshots/4-Babel-Tokens.shot index e74a4370243b..e2cb259df540 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ [ - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [73, 76], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-generic/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-generic/snapshots/4-Babel-Tokens.shot index 9e9481a35684..8333ead4d538 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-generic/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-generic/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ [ - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [73, 76], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-in-generic/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-in-generic/snapshots/4-Babel-Tokens.shot index fc203602a9ed..7f92e37fb63e 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-in-generic/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-in-generic/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ [ - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [73, 76], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-rest/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-rest/snapshots/4-Babel-Tokens.shot index a5b6a00a1418..d82ffedb7ebe 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-rest/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-rest/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ [ - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [73, 76], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-this/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-this/snapshots/2-TSESTree-Tokens.shot index 4ed3f2a15270..7384c5b71f9c 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-this/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-this/snapshots/2-TSESTree-Tokens.shot @@ -39,8 +39,8 @@ end: { column: 8, line: 3 }, }, }, - Keyword { - type: "Keyword", + Identifier { + type: "Identifier", value: "this", range: [81, 85], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-this/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-this/snapshots/4-Babel-Tokens.shot index 111a3921015f..7384c5b71f9c 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-this/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-this/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ [ - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [73, 76], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-this/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-this/snapshots/6-AST-Alignment-Tokens.shot index 4dd08bd918b5..f2753dc6195f 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-this/snapshots/6-AST-Alignment-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-this/snapshots/6-AST-Alignment-Tokens.shot @@ -48,10 +48,8 @@ Snapshot Diff: end: { column: 8, line: 3 }, }, }, -- Keyword { -- type: 'Keyword', -+ Identifier { -+ type: 'Identifier', + Identifier { + type: 'Identifier', value: 'this', range: [81, 85], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function/snapshots/4-Babel-Tokens.shot index ba1f21afcd61..cb4f94fecb64 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ [ - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [73, 76], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/indexed/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/indexed/snapshots/4-Babel-Tokens.shot index 5b981eedef46..b988bba0f56f 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/indexed/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/indexed/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ [ - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [73, 76], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-number-negative/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-number-negative/snapshots/4-Babel-Tokens.shot index 508a7be90987..52f735fd8160 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-number-negative/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-number-negative/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ [ - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [73, 76], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-number/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-number/snapshots/4-Babel-Tokens.shot index b3fa4f40d2cf..9289da650dcb 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-number/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-number/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ [ - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [73, 76], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-string/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-string/snapshots/4-Babel-Tokens.shot index b56d0a990e99..0aee0dcb8696 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-string/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-string/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ [ - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [73, 76], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly-minus/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly-minus/snapshots/4-Babel-Tokens.shot index bd73b0295988..b0602909de5d 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly-minus/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly-minus/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ [ - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [73, 76], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly-plus/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly-plus/snapshots/4-Babel-Tokens.shot index 68b91afce98a..142b15bfa8cb 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly-plus/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly-plus/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ [ - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [73, 76], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly/snapshots/4-Babel-Tokens.shot index c3ffd41f1daa..b28d19369e69 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ [ - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [73, 76], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-untypped/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-untypped/snapshots/4-Babel-Tokens.shot index 79a0ab7f3906..294fd82c0101 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-untypped/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-untypped/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ [ - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [73, 76], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped/snapshots/4-Babel-Tokens.shot index 340b5d51db47..4487279ef14f 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ [ - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [73, 76], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/nested-types/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/nested-types/snapshots/2-TSESTree-Tokens.shot index a22433f5c8ca..f33dd4aed51b 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/nested-types/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/nested-types/snapshots/2-TSESTree-Tokens.shot @@ -249,8 +249,8 @@ end: { column: 23, line: 5 }, }, }, - Keyword { - type: "Keyword", + Null { + type: "Null", value: "null", range: [139, 143], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic-nested/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic-nested/snapshots/4-Babel-Tokens.shot index a3de1c4a3b65..29e683c4011f 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic-nested/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic-nested/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ [ - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [73, 76], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic/snapshots/4-Babel-Tokens.shot index 4beddd730692..c2b1215eabc2 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ [ - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [73, 76], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference/snapshots/4-Babel-Tokens.shot index 474ccbd9551e..c83935cd8d50 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ [ - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [73, 76], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/this-type-expanded/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/this-type-expanded/snapshots/2-TSESTree-Tokens.shot index 1deb60e039ac..f41521a4d6ef 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/this-type-expanded/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/this-type-expanded/snapshots/2-TSESTree-Tokens.shot @@ -109,8 +109,8 @@ end: { column: 16, line: 6 }, }, }, - Keyword { - type: "Keyword", + Identifier { + type: "Identifier", value: "this", range: [120, 124], @@ -269,8 +269,8 @@ end: { column: 17, line: 10 }, }, }, - Keyword { - type: "Keyword", + Identifier { + type: "Identifier", value: "this", range: [183, 187], @@ -429,8 +429,8 @@ end: { column: 17, line: 14 }, }, }, - Keyword { - type: "Keyword", + Identifier { + type: "Identifier", value: "this", range: [241, 245], @@ -689,8 +689,8 @@ end: { column: 17, line: 19 }, }, }, - Keyword { - type: "Keyword", + Identifier { + type: "Identifier", value: "this", range: [329, 333], @@ -949,8 +949,8 @@ end: { column: 22, line: 24 }, }, }, - Keyword { - type: "Keyword", + Identifier { + type: "Identifier", value: "this", range: [419, 423], @@ -1089,8 +1089,8 @@ end: { column: 8, line: 28 }, }, }, - Keyword { - type: "Keyword", + Identifier { + type: "Identifier", value: "typeof", range: [471, 477], @@ -1109,8 +1109,8 @@ end: { column: 16, line: 28 }, }, }, - Keyword { - type: "Keyword", + Identifier { + type: "Identifier", value: "this", range: [478, 482], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/this-type-expanded/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/this-type-expanded/snapshots/6-AST-Alignment-Tokens.shot index a00c84b46b57..3abc427e91f4 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/this-type-expanded/snapshots/6-AST-Alignment-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/this-type-expanded/snapshots/6-AST-Alignment-Tokens.shot @@ -120,10 +120,8 @@ Snapshot Diff: end: { column: 16, line: 6 }, }, }, -- Keyword { -- type: 'Keyword', -+ Identifier { -+ type: 'Identifier', + Identifier { + type: 'Identifier', value: 'this', range: [120, 124], @@ -284,10 +282,8 @@ Snapshot Diff: end: { column: 17, line: 10 }, }, }, -- Keyword { -- type: 'Keyword', -+ Identifier { -+ type: 'Identifier', + Identifier { + type: 'Identifier', value: 'this', range: [183, 187], @@ -448,10 +444,8 @@ Snapshot Diff: end: { column: 17, line: 14 }, }, }, -- Keyword { -- type: 'Keyword', -+ Identifier { -+ type: 'Identifier', + Identifier { + type: 'Identifier', value: 'this', range: [241, 245], @@ -712,10 +706,8 @@ Snapshot Diff: end: { column: 17, line: 19 }, }, }, -- Keyword { -- type: 'Keyword', -+ Identifier { -+ type: 'Identifier', + Identifier { + type: 'Identifier', value: 'this', range: [329, 333], @@ -974,10 +966,8 @@ Snapshot Diff: end: { column: 22, line: 24 }, }, }, -- Keyword { -- type: 'Keyword', -+ Identifier { -+ type: 'Identifier', + Identifier { + type: 'Identifier', value: 'this', range: [419, 423], @@ -1116,10 +1106,8 @@ Snapshot Diff: end: { column: 8, line: 28 }, }, }, -- Keyword { -- type: 'Keyword', -+ Identifier { -+ type: 'Identifier', + Identifier { + type: 'Identifier', value: 'typeof', range: [471, 477], @@ -1138,10 +1126,8 @@ Snapshot Diff: end: { column: 16, line: 28 }, }, }, -- Keyword { -- type: 'Keyword', -+ Identifier { -+ type: 'Identifier', + Identifier { + type: 'Identifier', value: 'this', range: [478, 482], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-empty/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-empty/snapshots/4-Babel-Tokens.shot index 41031c9068b0..5fb2042b7470 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-empty/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-empty/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ [ - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [73, 76], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-optional/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-optional/snapshots/4-Babel-Tokens.shot index 7b3c79ba1164..0e6c24dc58d9 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-optional/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-optional/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ [ - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [73, 76], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-rest/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-rest/snapshots/4-Babel-Tokens.shot index 1936dc9a2c28..c2b21dcd7402 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-rest/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-rest/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ [ - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [73, 76], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named/snapshots/4-Babel-Tokens.shot index b696dfd5b340..55c76af54c68 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ [ - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [73, 76], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-optional/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-optional/snapshots/4-Babel-Tokens.shot index f27109984826..3dfe6687ff52 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-optional/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-optional/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ [ - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [73, 76], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-rest/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-rest/snapshots/4-Babel-Tokens.shot index 788399b58467..9ed540fb2ebe 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-rest/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-rest/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ [ - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [73, 76], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple/snapshots/4-Babel-Tokens.shot index 0728f53a8a9a..c00e485c9228 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ [ - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [73, 76], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/type-literal/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/type-literal/snapshots/4-Babel-Tokens.shot index e3baed46299d..5ea169be4a42 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/type-literal/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/type-literal/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ [ - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [73, 76], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/type-operator/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/type-operator/snapshots/4-Babel-Tokens.shot index 3a5d505e2e8a..82cfb8838ccd 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/type-operator/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/type-operator/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ [ - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [73, 76], @@ -59,8 +59,8 @@ end: { column: 15, line: 3 }, }, }, - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [89, 92], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-this/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-this/snapshots/2-TSESTree-Tokens.shot index accecbdf3e6c..9257d8476df2 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-this/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-this/snapshots/2-TSESTree-Tokens.shot @@ -39,8 +39,8 @@ end: { column: 16, line: 3 }, }, }, - Keyword { - type: "Keyword", + Identifier { + type: "Identifier", value: "this", range: [90, 94], @@ -99,8 +99,8 @@ end: { column: 15, line: 4 }, }, }, - Keyword { - type: "Keyword", + Identifier { + type: "Identifier", value: "this", range: [112, 116], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-this/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-this/snapshots/4-Babel-Tokens.shot index db8464f05758..9257d8476df2 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-this/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-this/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ [ - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [73, 76], @@ -59,8 +59,8 @@ end: { column: 22, line: 3 }, }, }, - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [96, 99], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-this/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-this/snapshots/6-AST-Alignment-Tokens.shot index c76669826b20..fdcc7a211dbb 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-this/snapshots/6-AST-Alignment-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-this/snapshots/6-AST-Alignment-Tokens.shot @@ -48,10 +48,8 @@ Snapshot Diff: end: { column: 16, line: 3 }, }, }, -- Keyword { -- type: 'Keyword', -+ Identifier { -+ type: 'Identifier', + Identifier { + type: 'Identifier', value: 'this', range: [90, 94], @@ -112,10 +110,8 @@ Snapshot Diff: end: { column: 15, line: 4 }, }, }, -- Keyword { -- type: 'Keyword', -+ Identifier { -+ type: 'Identifier', + Identifier { + type: 'Identifier', value: 'this', range: [112, 116], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-with-type-parameters/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-with-type-parameters/snapshots/4-Babel-Tokens.shot index 6afaf9bc864a..5a00a924380e 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-with-type-parameters/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-with-type-parameters/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ [ - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [73, 76], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof/snapshots/4-Babel-Tokens.shot index baf361175501..1dd2f34f58fe 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ [ - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [73, 76], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-intersection/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-intersection/snapshots/2-TSESTree-Tokens.shot index c5159511416e..547dd756f9d3 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-intersection/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-intersection/snapshots/2-TSESTree-Tokens.shot @@ -49,8 +49,8 @@ end: { column: 19, line: 3 }, }, }, - Keyword { - type: "Keyword", + Null { + type: "Null", value: "null", range: [93, 97], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-intersection/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-intersection/snapshots/4-Babel-Tokens.shot index a5c2e0f37f4e..547dd756f9d3 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-intersection/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-intersection/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ [ - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [73, 76], @@ -89,8 +89,8 @@ end: { column: 37, line: 3 }, }, }, - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [111, 114], @@ -159,8 +159,8 @@ end: { column: 34, line: 4 }, }, }, - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [146, 149], @@ -269,8 +269,8 @@ end: { column: 45, line: 5 }, }, }, - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [192, 195], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-intersection/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-intersection/snapshots/6-AST-Alignment-Tokens.shot index f8ff003d5c8e..0f245d08a17f 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-intersection/snapshots/6-AST-Alignment-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-intersection/snapshots/6-AST-Alignment-Tokens.shot @@ -58,10 +58,8 @@ Snapshot Diff: end: { column: 19, line: 3 }, }, }, -- Keyword { -- type: 'Keyword', -+ Null { -+ type: 'Null', + Null { + type: 'Null', value: 'null', range: [93, 97], diff --git a/packages/ast-spec/src/parameter/TSParameterProperty/fixtures/_error_/override-function-parameter/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/parameter/TSParameterProperty/fixtures/_error_/override-function-parameter/snapshots/2-Babel-Error.shot index 746f2d00e0bb..330f905389c4 100644 --- a/packages/ast-spec/src/parameter/TSParameterProperty/fixtures/_error_/override-function-parameter/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/parameter/TSParameterProperty/fixtures/_error_/override-function-parameter/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > parameter > TSParameterProperty > _error_ > override-function-parameter > Babel - Error`] -SyntaxError: A parameter property is only allowed in a constructor implementation. (1:13) +BabelError +> 1 | function foo(override parameter) {} + | ^ A parameter property is only allowed in a constructor implementation. (1:13) + 2 | + diff --git a/packages/ast-spec/src/parameter/TSParameterProperty/fixtures/_error_/override-method-parameter/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/parameter/TSParameterProperty/fixtures/_error_/override-method-parameter/snapshots/2-Babel-Error.shot index c01c6423d57f..56ac32bf65b0 100644 --- a/packages/ast-spec/src/parameter/TSParameterProperty/fixtures/_error_/override-method-parameter/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/parameter/TSParameterProperty/fixtures/_error_/override-method-parameter/snapshots/2-Babel-Error.shot @@ -1,4 +1,10 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > parameter > TSParameterProperty > _error_ > override-method-parameter > Babel - Error`] -SyntaxError: A parameter property is only allowed in a constructor implementation. (2:9) +BabelError + 1 | class Foo { +> 2 | method(override parameter) {} + | ^ A parameter property is only allowed in a constructor implementation. (2:9) + 3 | } + 4 | + diff --git a/packages/ast-spec/src/special/CatchClause/fixtures/_error_/with-initializer/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/special/CatchClause/fixtures/_error_/with-initializer/snapshots/2-Babel-Error.shot index 45304cec97a8..49ba046f48b7 100644 --- a/packages/ast-spec/src/special/CatchClause/fixtures/_error_/with-initializer/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/special/CatchClause/fixtures/_error_/with-initializer/snapshots/2-Babel-Error.shot @@ -1,4 +1,11 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > special > CatchClause > _error_ > with-initializer > Babel - Error`] -SyntaxError: Unexpected token, expected ")" (3:9) +BabelError + 1 | try { + 2 | } +> 3 | catch (e = 1) { + | ^ Unexpected token, expected ")" (3:9) + 4 | } + 5 | + diff --git a/packages/ast-spec/src/special/ExportSpecifier/fixtures/_error_/literal-specifier/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/special/ExportSpecifier/fixtures/_error_/literal-specifier/snapshots/2-Babel-Error.shot index 14ba1326d51f..8066f19648c0 100644 --- a/packages/ast-spec/src/special/ExportSpecifier/fixtures/_error_/literal-specifier/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/special/ExportSpecifier/fixtures/_error_/literal-specifier/snapshots/2-Babel-Error.shot @@ -1,5 +1,9 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > special > ExportSpecifier > _error_ > literal-specifier > Babel - Error`] -SyntaxError: A string literal cannot be used as an exported binding without `from`. +BabelError +> 1 | export { 'A' as A }; + | ^ A string literal cannot be used as an exported binding without `from`. - Did you mean `export { 'A' as 'A' } from 'some-module'`? (1:9) + 2 | + diff --git a/packages/ast-spec/src/statement/ForInStatement/fixtures/_error_/using-initializer/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/statement/ForInStatement/fixtures/_error_/using-initializer/snapshots/2-Babel-Error.shot index de1d87cc292d..155a5df05e1c 100644 --- a/packages/ast-spec/src/statement/ForInStatement/fixtures/_error_/using-initializer/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/statement/ForInStatement/fixtures/_error_/using-initializer/snapshots/2-Babel-Error.shot @@ -1,4 +1,7 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > statement > ForInStatement > _error_ > using-initializer > Babel - Error`] -SyntaxError: For-in loop may not start with 'using' declaration. (1:4) +BabelError +> 1 | for(using foo in {}); + | ^ For-in loop may not start with 'using' declaration. (1:4) + diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-init/snapshots/2-Babel-Error.shot index 7cee4dc26990..f9f88b371b57 100644 --- a/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-init/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-init/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > statement > ForOfStatement > _error_ > decl-init > Babel - Error`] -SyntaxError: 'for-of' loop variable declaration may not have an initializer. (1:5) +BabelError +> 1 | for (const x = 1 of []) {} + | ^ 'for-of' loop variable declaration may not have an initializer. (1:5) + 2 | + diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-multi/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-multi/snapshots/2-Babel-Error.shot index 415f6f6fc038..fff804c7ba6b 100644 --- a/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-multi/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-multi/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > statement > ForOfStatement > _error_ > decl-multi > Babel - Error`] -SyntaxError: Missing initializer in const declaration. (1:12) +BabelError +> 1 | for (const x, y of []) {} + | ^ Missing initializer in const declaration. (1:12) + 2 | + diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/expr-not-assignment-target/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/expr-not-assignment-target/snapshots/2-Babel-Error.shot index fab92480a170..3cd37f4376f4 100644 --- a/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/expr-not-assignment-target/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/expr-not-assignment-target/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > statement > ForOfStatement > _error_ > expr-not-assignment-target > Babel - Error`] -SyntaxError: Invalid left-hand side in for-of statement. (1:5) +BabelError +> 1 | for (1 of []) {} + | ^ Invalid left-hand side in for-of statement. (1:5) + 2 | + diff --git a/packages/ast-spec/src/statement/SwitchStatement/fixtures/_error_/multiple-default-cases/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/statement/SwitchStatement/fixtures/_error_/multiple-default-cases/snapshots/2-Babel-Error.shot index 2c9a2de70deb..b96cae72438d 100644 --- a/packages/ast-spec/src/statement/SwitchStatement/fixtures/_error_/multiple-default-cases/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/statement/SwitchStatement/fixtures/_error_/multiple-default-cases/snapshots/2-Babel-Error.shot @@ -1,4 +1,10 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > statement > SwitchStatement > _error_ > multiple-default-cases > Babel - Error`] -SyntaxError: Multiple default clauses. (2:10) +BabelError + 1 | switch (true) { +> 2 | default: default: + | ^ Multiple default clauses. (2:10) + 3 | } + 4 | + diff --git a/packages/ast-spec/src/statement/ThrowStatement/fixtures/_error_/missing-argument/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/statement/ThrowStatement/fixtures/_error_/missing-argument/snapshots/2-Babel-Error.shot index 7ae654c72d7a..164119608484 100644 --- a/packages/ast-spec/src/statement/ThrowStatement/fixtures/_error_/missing-argument/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/statement/ThrowStatement/fixtures/_error_/missing-argument/snapshots/2-Babel-Error.shot @@ -1,4 +1,10 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > statement > ThrowStatement > _error_ > missing-argument > Babel - Error`] -SyntaxError: Illegal newline after throw. (2:9) +BabelError + 1 | { +> 2 | throw + | ^ Illegal newline after throw. (2:9) + 3 | } + 4 | + diff --git a/packages/ast-spec/src/type/TSImportType/fixtures/_error_/type-import-type-with-import-attributes-assert/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/type/TSImportType/fixtures/_error_/type-import-type-with-import-attributes-assert/snapshots/2-Babel-Error.shot index ff33d238cf32..dd4ad391b99f 100644 --- a/packages/ast-spec/src/type/TSImportType/fixtures/_error_/type-import-type-with-import-attributes-assert/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/type/TSImportType/fixtures/_error_/type-import-type-with-import-attributes-assert/snapshots/2-Babel-Error.shot @@ -1,4 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > type > TSImportType > _error_ > type-import-type-with-import-attributes-assert > Babel - Error`] -SyntaxError: Unexpected token, expected "with" (1:23) +BabelError +> 1 | type A = import("A", { assert: { type: "json" } }); + | ^ Unexpected token, expected "with" (1:23) + 2 | + diff --git a/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-import-attributes-with/fixture.ts b/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-import-attributes-with/fixture.ts index 79df9dadf881..25af9fe33ec6 100644 --- a/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-import-attributes-with/fixture.ts +++ b/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-import-attributes-with/fixture.ts @@ -1 +1 @@ -type A = import("A", { with: { type: "json" } }); +type A = import('A', { with: { type: 'json' } }); diff --git a/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-import-attributes-with/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-import-attributes-with/snapshots/1-TSESTree-AST.shot index 225e77e8303a..e20487325971 100644 --- a/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-import-attributes-with/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-import-attributes-with/snapshots/1-TSESTree-AST.shot @@ -22,7 +22,7 @@ Program { type: "TSLiteralType", literal: Literal { type: "Literal", - raw: ""A"", + raw: "'A'", value: "A", range: [16, 19], @@ -84,7 +84,7 @@ Program { shorthand: false, value: Literal { type: "Literal", - raw: ""json"", + raw: "'json'", value: "json", range: [37, 43], diff --git a/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-import-attributes-with/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-import-attributes-with/snapshots/2-TSESTree-Tokens.shot index d9a618899217..4aa87f31f614 100644 --- a/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-import-attributes-with/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-import-attributes-with/snapshots/2-TSESTree-Tokens.shot @@ -51,7 +51,7 @@ }, String { type: "String", - value: ""A"", + value: "'A'", range: [16, 19], loc: { @@ -131,7 +131,7 @@ }, String { type: "String", - value: ""json"", + value: "'json'", range: [37, 43], loc: { diff --git a/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-import-attributes-with/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-import-attributes-with/snapshots/3-Babel-AST.shot index 76cbe3e5d77c..79fdc1382198 100644 --- a/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-import-attributes-with/snapshots/3-Babel-AST.shot +++ b/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-import-attributes-with/snapshots/3-Babel-AST.shot @@ -20,7 +20,7 @@ Program { type: "TSImportType", argument: Literal { type: "Literal", - raw: ""A"", + raw: "'A'", value: "A", range: [16, 19], @@ -75,7 +75,7 @@ Program { shorthand: false, value: Literal { type: "Literal", - raw: ""json"", + raw: "'json'", value: "json", range: [37, 43], diff --git a/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-import-attributes-with/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-import-attributes-with/snapshots/4-Babel-Tokens.shot index 91cd1f711197..352ef98a8d93 100644 --- a/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-import-attributes-with/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-import-attributes-with/snapshots/4-Babel-Tokens.shot @@ -51,7 +51,7 @@ }, String { type: "String", - value: ""A"", + value: "'A'", range: [16, 19], loc: { @@ -131,7 +131,7 @@ }, String { type: "String", - value: ""json"", + value: "'json'", range: [37, 43], loc: { diff --git a/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-import-attributes-with/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-import-attributes-with/snapshots/5-AST-Alignment-AST.shot index 31b5f49ee553..668b4bceacd6 100644 --- a/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-import-attributes-with/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-import-attributes-with/snapshots/5-AST-Alignment-AST.shot @@ -29,11 +29,11 @@ Snapshot Diff: - type: 'TSLiteralType', - literal: Literal { - type: 'Literal', -- raw: '"A"', +- raw: '\'A\'', - value: 'A', + argument: Literal { + type: 'Literal', -+ raw: '"A"', ++ raw: '\'A\'', + value: 'A', - range: [16, 19], @@ -95,7 +95,7 @@ Snapshot Diff: shorthand: false, value: Literal { type: 'Literal', - raw: '"json"', + raw: '\'json\'', value: 'json', range: [37, 43], diff --git a/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-import-attributes-with/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-import-attributes-with/snapshots/6-AST-Alignment-Tokens.shot index 87fdac962d79..bbd22a21ad7c 100644 --- a/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-import-attributes-with/snapshots/6-AST-Alignment-Tokens.shot +++ b/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-import-attributes-with/snapshots/6-AST-Alignment-Tokens.shot @@ -58,7 +58,7 @@ Snapshot Diff: }, String { type: 'String', - value: '"A"', + value: '\'A\'', range: [16, 19], loc: { @@ -140,7 +140,7 @@ Snapshot Diff: }, String { type: 'String', - value: '"json"', + value: '\'json\'', range: [37, 43], loc: { diff --git a/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-trailing-comma-in-import-attributes/fixture.ts b/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-trailing-comma-in-import-attributes/fixture.ts new file mode 100644 index 000000000000..f5ad318ad5f4 --- /dev/null +++ b/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-trailing-comma-in-import-attributes/fixture.ts @@ -0,0 +1 @@ +type TrailingComma = import("A", { with: { "resolution-mode": "import", }, } ); diff --git a/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-trailing-comma-in-import-attributes/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-trailing-comma-in-import-attributes/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..f1f332ffa5de --- /dev/null +++ b/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-trailing-comma-in-import-attributes/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,149 @@ +Program { + type: "Program", + body: [ + TSTypeAliasDeclaration { + type: "TSTypeAliasDeclaration", + declare: false, + id: Identifier { + type: "Identifier", + decorators: [], + name: "TrailingComma", + optional: false, + + range: [5, 18], + loc: { + start: { column: 5, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + typeAnnotation: TSImportType { + type: "TSImportType", + argument: TSLiteralType { + type: "TSLiteralType", + literal: Literal { + type: "Literal", + raw: ""A"", + value: "A", + + range: [28, 31], + loc: { + start: { column: 28, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + + range: [28, 31], + loc: { + start: { column: 28, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + options: ObjectExpression { + type: "ObjectExpression", + properties: [ + Property { + type: "Property", + computed: false, + key: Identifier { + type: "Identifier", + decorators: [], + name: "with", + optional: false, + + range: [35, 39], + loc: { + start: { column: 35, line: 1 }, + end: { column: 39, line: 1 }, + }, + }, + kind: "init", + method: false, + optional: false, + shorthand: false, + value: ObjectExpression { + type: "ObjectExpression", + properties: [ + Property { + type: "Property", + computed: false, + key: Literal { + type: "Literal", + raw: ""resolution-mode"", + value: "resolution-mode", + + range: [43, 60], + loc: { + start: { column: 43, line: 1 }, + end: { column: 60, line: 1 }, + }, + }, + kind: "init", + method: false, + optional: false, + shorthand: false, + value: Literal { + type: "Literal", + raw: ""import"", + value: "import", + + range: [62, 70], + loc: { + start: { column: 62, line: 1 }, + end: { column: 70, line: 1 }, + }, + }, + + range: [43, 70], + loc: { + start: { column: 43, line: 1 }, + end: { column: 70, line: 1 }, + }, + }, + ], + + range: [41, 73], + loc: { + start: { column: 41, line: 1 }, + end: { column: 73, line: 1 }, + }, + }, + + range: [35, 73], + loc: { + start: { column: 35, line: 1 }, + end: { column: 73, line: 1 }, + }, + }, + ], + + range: [33, 76], + loc: { + start: { column: 33, line: 1 }, + end: { column: 76, line: 1 }, + }, + }, + qualifier: null, + typeArguments: null, + + range: [21, 78], + loc: { + start: { column: 21, line: 1 }, + end: { column: 78, line: 1 }, + }, + }, + + range: [0, 79], + loc: { + start: { column: 0, line: 1 }, + end: { column: 79, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 80], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} \ No newline at end of file diff --git a/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-trailing-comma-in-import-attributes/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-trailing-comma-in-import-attributes/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..cae5e0bcfd9e --- /dev/null +++ b/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-trailing-comma-in-import-attributes/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,202 @@ +[ + Identifier { + type: "Identifier", + value: "type", + + range: [0, 4], + loc: { + start: { column: 0, line: 1 }, + end: { column: 4, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "TrailingComma", + + range: [5, 18], + loc: { + start: { column: 5, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "import", + + range: [21, 27], + loc: { + start: { column: 21, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [27, 28], + loc: { + start: { column: 27, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + String { + type: "String", + value: ""A"", + + range: [28, 31], + loc: { + start: { column: 28, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [31, 32], + loc: { + start: { column: 31, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [33, 34], + loc: { + start: { column: 33, line: 1 }, + end: { column: 34, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "with", + + range: [35, 39], + loc: { + start: { column: 35, line: 1 }, + end: { column: 39, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [39, 40], + loc: { + start: { column: 39, line: 1 }, + end: { column: 40, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [41, 42], + loc: { + start: { column: 41, line: 1 }, + end: { column: 42, line: 1 }, + }, + }, + String { + type: "String", + value: ""resolution-mode"", + + range: [43, 60], + loc: { + start: { column: 43, line: 1 }, + end: { column: 60, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [60, 61], + loc: { + start: { column: 60, line: 1 }, + end: { column: 61, line: 1 }, + }, + }, + String { + type: "String", + value: ""import"", + + range: [62, 70], + loc: { + start: { column: 62, line: 1 }, + end: { column: 70, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [70, 71], + loc: { + start: { column: 70, line: 1 }, + end: { column: 71, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [72, 73], + loc: { + start: { column: 72, line: 1 }, + end: { column: 73, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [73, 74], + loc: { + start: { column: 73, line: 1 }, + end: { column: 74, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [75, 76], + loc: { + start: { column: 75, line: 1 }, + end: { column: 76, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [77, 78], + loc: { + start: { column: 77, line: 1 }, + end: { column: 78, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [78, 79], + loc: { + start: { column: 78, line: 1 }, + end: { column: 79, line: 1 }, + }, + }, +] \ No newline at end of file diff --git a/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-trailing-comma-in-import-attributes/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-trailing-comma-in-import-attributes/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..b667343abacf --- /dev/null +++ b/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-trailing-comma-in-import-attributes/snapshots/3-Babel-AST.shot @@ -0,0 +1,139 @@ +Program { + type: "Program", + body: [ + TSTypeAliasDeclaration { + type: "TSTypeAliasDeclaration", + declare: false, + id: Identifier { + type: "Identifier", + decorators: [], + name: "TrailingComma", + optional: false, + + range: [5, 18], + loc: { + start: { column: 5, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + typeAnnotation: TSImportType { + type: "TSImportType", + argument: Literal { + type: "Literal", + raw: ""A"", + value: "A", + + range: [28, 31], + loc: { + start: { column: 28, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + options: ObjectExpression { + type: "ObjectExpression", + properties: [ + Property { + type: "Property", + computed: false, + key: Identifier { + type: "Identifier", + decorators: [], + name: "with", + optional: false, + + range: [35, 39], + loc: { + start: { column: 35, line: 1 }, + end: { column: 39, line: 1 }, + }, + }, + kind: "init", + method: false, + optional: false, + shorthand: false, + value: ObjectExpression { + type: "ObjectExpression", + properties: [ + Property { + type: "Property", + computed: false, + key: Literal { + type: "Literal", + raw: ""resolution-mode"", + value: "resolution-mode", + + range: [43, 60], + loc: { + start: { column: 43, line: 1 }, + end: { column: 60, line: 1 }, + }, + }, + kind: "init", + method: false, + optional: false, + shorthand: false, + value: Literal { + type: "Literal", + raw: ""import"", + value: "import", + + range: [62, 70], + loc: { + start: { column: 62, line: 1 }, + end: { column: 70, line: 1 }, + }, + }, + + range: [43, 70], + loc: { + start: { column: 43, line: 1 }, + end: { column: 70, line: 1 }, + }, + }, + ], + + range: [41, 73], + loc: { + start: { column: 41, line: 1 }, + end: { column: 73, line: 1 }, + }, + }, + + range: [35, 73], + loc: { + start: { column: 35, line: 1 }, + end: { column: 73, line: 1 }, + }, + }, + ], + + range: [33, 76], + loc: { + start: { column: 33, line: 1 }, + end: { column: 76, line: 1 }, + }, + }, + qualifier: null, + + range: [21, 78], + loc: { + start: { column: 21, line: 1 }, + end: { column: 78, line: 1 }, + }, + }, + + range: [0, 79], + loc: { + start: { column: 0, line: 1 }, + end: { column: 79, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 80], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} \ No newline at end of file diff --git a/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-trailing-comma-in-import-attributes/snapshots/3-Babel-Error.shot b/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-trailing-comma-in-import-attributes/snapshots/3-Babel-Error.shot new file mode 100644 index 000000000000..0c1ff0965afa --- /dev/null +++ b/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-trailing-comma-in-import-attributes/snapshots/3-Babel-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > type > TSImportType > type-import-type-with-trailing-comma-in-import-attributes > Babel - Error`] +NO ERROR diff --git a/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-trailing-comma-in-import-attributes/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-trailing-comma-in-import-attributes/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..1c38f78693d0 --- /dev/null +++ b/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-trailing-comma-in-import-attributes/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,202 @@ +[ + Identifier { + type: "Identifier", + value: "type", + + range: [0, 4], + loc: { + start: { column: 0, line: 1 }, + end: { column: 4, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "TrailingComma", + + range: [5, 18], + loc: { + start: { column: 5, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "import", + + range: [21, 27], + loc: { + start: { column: 21, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [27, 28], + loc: { + start: { column: 27, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + String { + type: "String", + value: ""A"", + + range: [28, 31], + loc: { + start: { column: 28, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [31, 32], + loc: { + start: { column: 31, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [33, 34], + loc: { + start: { column: 33, line: 1 }, + end: { column: 34, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "with", + + range: [35, 39], + loc: { + start: { column: 35, line: 1 }, + end: { column: 39, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [39, 40], + loc: { + start: { column: 39, line: 1 }, + end: { column: 40, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [41, 42], + loc: { + start: { column: 41, line: 1 }, + end: { column: 42, line: 1 }, + }, + }, + String { + type: "String", + value: ""resolution-mode"", + + range: [43, 60], + loc: { + start: { column: 43, line: 1 }, + end: { column: 60, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [60, 61], + loc: { + start: { column: 60, line: 1 }, + end: { column: 61, line: 1 }, + }, + }, + String { + type: "String", + value: ""import"", + + range: [62, 70], + loc: { + start: { column: 62, line: 1 }, + end: { column: 70, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [70, 71], + loc: { + start: { column: 70, line: 1 }, + end: { column: 71, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [72, 73], + loc: { + start: { column: 72, line: 1 }, + end: { column: 73, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [73, 74], + loc: { + start: { column: 73, line: 1 }, + end: { column: 74, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [75, 76], + loc: { + start: { column: 75, line: 1 }, + end: { column: 76, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [77, 78], + loc: { + start: { column: 77, line: 1 }, + end: { column: 78, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [78, 79], + loc: { + start: { column: 78, line: 1 }, + end: { column: 79, line: 1 }, + }, + }, +] \ No newline at end of file diff --git a/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-trailing-comma-in-import-attributes/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-trailing-comma-in-import-attributes/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..4cf4abde9c9f --- /dev/null +++ b/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-trailing-comma-in-import-attributes/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,160 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > type > TSImportType > type-import-type-with-trailing-comma-in-import-attributes > AST Alignment - AST`] +Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', + declare: false, + id: Identifier { + type: 'Identifier', + decorators: Array [], + name: 'TrailingComma', + optional: false, + + range: [5, 18], + loc: { + start: { column: 5, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + typeAnnotation: TSImportType { + type: 'TSImportType', +- argument: TSLiteralType { +- type: 'TSLiteralType', +- literal: Literal { +- type: 'Literal', +- raw: '"A"', +- value: 'A', ++ argument: Literal { ++ type: 'Literal', ++ raw: '"A"', ++ value: 'A', + +- range: [28, 31], +- loc: { +- start: { column: 28, line: 1 }, +- end: { column: 31, line: 1 }, +- }, +- }, +- + range: [28, 31], + loc: { + start: { column: 28, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + options: ObjectExpression { + type: 'ObjectExpression', + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', + decorators: Array [], + name: 'with', + optional: false, + + range: [35, 39], + loc: { + start: { column: 35, line: 1 }, + end: { column: 39, line: 1 }, + }, + }, + kind: 'init', + method: false, + optional: false, + shorthand: false, + value: ObjectExpression { + type: 'ObjectExpression', + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Literal { + type: 'Literal', + raw: '"resolution-mode"', + value: 'resolution-mode', + + range: [43, 60], + loc: { + start: { column: 43, line: 1 }, + end: { column: 60, line: 1 }, + }, + }, + kind: 'init', + method: false, + optional: false, + shorthand: false, + value: Literal { + type: 'Literal', + raw: '"import"', + value: 'import', + + range: [62, 70], + loc: { + start: { column: 62, line: 1 }, + end: { column: 70, line: 1 }, + }, + }, + + range: [43, 70], + loc: { + start: { column: 43, line: 1 }, + end: { column: 70, line: 1 }, + }, + }, + ], + + range: [41, 73], + loc: { + start: { column: 41, line: 1 }, + end: { column: 73, line: 1 }, + }, + }, + + range: [35, 73], + loc: { + start: { column: 35, line: 1 }, + end: { column: 73, line: 1 }, + }, + }, + ], + + range: [33, 76], + loc: { + start: { column: 33, line: 1 }, + end: { column: 76, line: 1 }, + }, + }, + qualifier: null, +- typeArguments: null, + + range: [21, 78], + loc: { + start: { column: 21, line: 1 }, + end: { column: 78, line: 1 }, + }, + }, + + range: [0, 79], + loc: { + start: { column: 0, line: 1 }, + end: { column: 79, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 80], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + } diff --git a/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-trailing-comma-in-import-attributes/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-trailing-comma-in-import-attributes/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..548e27a14f2b --- /dev/null +++ b/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-trailing-comma-in-import-attributes/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,211 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > type > TSImportType > type-import-type-with-trailing-comma-in-import-attributes > AST Alignment - Token`] +Snapshot Diff: +- TSESTree ++ Babel + + Array [ + Identifier { + type: 'Identifier', + value: 'type', + + range: [0, 4], + loc: { + start: { column: 0, line: 1 }, + end: { column: 4, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'TrailingComma', + + range: [5, 18], + loc: { + start: { column: 5, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '=', + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Keyword { + type: 'Keyword', + value: 'import', + + range: [21, 27], + loc: { + start: { column: 21, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '(', + + range: [27, 28], + loc: { + start: { column: 27, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + String { + type: 'String', + value: '"A"', + + range: [28, 31], + loc: { + start: { column: 28, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ',', + + range: [31, 32], + loc: { + start: { column: 31, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '{', + + range: [33, 34], + loc: { + start: { column: 33, line: 1 }, + end: { column: 34, line: 1 }, + }, + }, +- Keyword { +- type: 'Keyword', ++ Identifier { ++ type: 'Identifier', + value: 'with', + + range: [35, 39], + loc: { + start: { column: 35, line: 1 }, + end: { column: 39, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ':', + + range: [39, 40], + loc: { + start: { column: 39, line: 1 }, + end: { column: 40, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '{', + + range: [41, 42], + loc: { + start: { column: 41, line: 1 }, + end: { column: 42, line: 1 }, + }, + }, + String { + type: 'String', + value: '"resolution-mode"', + + range: [43, 60], + loc: { + start: { column: 43, line: 1 }, + end: { column: 60, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ':', + + range: [60, 61], + loc: { + start: { column: 60, line: 1 }, + end: { column: 61, line: 1 }, + }, + }, + String { + type: 'String', + value: '"import"', + + range: [62, 70], + loc: { + start: { column: 62, line: 1 }, + end: { column: 70, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ',', + + range: [70, 71], + loc: { + start: { column: 70, line: 1 }, + end: { column: 71, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '}', + + range: [72, 73], + loc: { + start: { column: 72, line: 1 }, + end: { column: 73, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ',', + + range: [73, 74], + loc: { + start: { column: 73, line: 1 }, + end: { column: 74, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '}', + + range: [75, 76], + loc: { + start: { column: 75, line: 1 }, + end: { column: 76, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ')', + + range: [77, 78], + loc: { + start: { column: 77, line: 1 }, + end: { column: 78, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ';', + + range: [78, 79], + loc: { + start: { column: 78, line: 1 }, + end: { column: 79, line: 1 }, + }, + }, + ] diff --git a/packages/ast-spec/src/type/TSLiteralType/spec.ts b/packages/ast-spec/src/type/TSLiteralType/spec.ts index 39f6ae0d2961..7eca3ee2d9e5 100644 --- a/packages/ast-spec/src/type/TSLiteralType/spec.ts +++ b/packages/ast-spec/src/type/TSLiteralType/spec.ts @@ -1,10 +1,17 @@ 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 { NullLiteral } from '../../expression/literal/NullLiteral/spec'; +import type { RegExpLiteral } from '../../expression/literal/RegExpLiteral/spec'; +import type { + UnaryExpressionMinus, + UnaryExpressionPlus, +} from '../../expression/UnaryExpression/spec'; import type { LiteralExpression } from '../../unions/LiteralExpression'; export interface TSLiteralType extends BaseNode { type: AST_NODE_TYPES.TSLiteralType; - literal: LiteralExpression | UnaryExpression | UpdateExpression; + literal: + | Exclude + | UnaryExpressionMinus + | UnaryExpressionPlus; } diff --git a/packages/ast-spec/src/type/TSMappedType/fixtures/_error_/with-member-after/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/type/TSMappedType/fixtures/_error_/with-member-after/snapshots/2-Babel-Error.shot index 9f5f417fcabd..0d9adec2645d 100644 --- a/packages/ast-spec/src/type/TSMappedType/fixtures/_error_/with-member-after/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/type/TSMappedType/fixtures/_error_/with-member-after/snapshots/2-Babel-Error.shot @@ -1,4 +1,11 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > type > TSMappedType > _error_ > with-member-after > Babel - Error`] -SyntaxError: Unexpected token, expected "}" (3:2) +BabelError + 1 | type Mapped = { + 2 | [key in keyof O]: number; +> 3 | member: member; + | ^ Unexpected token, expected "}" (3:2) + 4 | }; + 5 | + diff --git a/packages/ast-spec/src/type/TSMappedType/fixtures/_error_/with-member-before/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/type/TSMappedType/fixtures/_error_/with-member-before/snapshots/2-Babel-Error.shot index c1f120be3d57..5b1a1229034e 100644 --- a/packages/ast-spec/src/type/TSMappedType/fixtures/_error_/with-member-before/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/type/TSMappedType/fixtures/_error_/with-member-before/snapshots/2-Babel-Error.shot @@ -1,4 +1,11 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > type > TSMappedType > _error_ > with-member-before > Babel - Error`] -SyntaxError: Unexpected token, expected "]" (3:16) +BabelError + 1 | type Mapped = { + 2 | member: member; +> 3 | [key in keyof O]: number; + | ^ Unexpected token, expected "]" (3:16) + 4 | }; + 5 | + diff --git a/packages/ast-spec/tests/fixtures-with-differences-ast.shot b/packages/ast-spec/tests/fixtures-with-differences-ast.shot index a64da89a8106..b1e1785390dd 100644 --- a/packages/ast-spec/tests/fixtures-with-differences-ast.shot +++ b/packages/ast-spec/tests/fixtures-with-differences-ast.shot @@ -253,6 +253,7 @@ exports[`AST Fixtures > List fixtures with AST differences`] "special/TSTypeParameter/fixtures/interface-in-const-modifier-multiple/fixture.ts", "special/TSTypeParameter/fixtures/method-const-modifiers/fixture.ts", "type/TSImportType/fixtures/type-import-type-with-import-attributes-with/fixture.ts", + "type/TSImportType/fixtures/type-import-type-with-trailing-comma-in-import-attributes/fixture.ts", "type/TSMappedType/fixtures/no-modifiers/fixture.ts", "type/TSMappedType/fixtures/optional-minus/fixture.ts", "type/TSMappedType/fixtures/optional-plus/fixture.ts", diff --git a/packages/ast-spec/tests/fixtures-with-differences-errors.shot b/packages/ast-spec/tests/fixtures-with-differences-errors.shot index ef7f47117298..cb157b9d2bb9 100644 --- a/packages/ast-spec/tests/fixtures-with-differences-errors.shot +++ b/packages/ast-spec/tests/fixtures-with-differences-errors.shot @@ -4,16 +4,9 @@ exports[`AST Fixtures > List fixtures with Error differences`] { "Babel errored but TSESTree didn't": [ "declaration/ClassDeclaration/fixtures/_error_/implements-non-identifier/fixture.ts", - "declaration/ClassDeclaration/fixtures/_error_/missing-extends-type-param/fixture.ts", - "declaration/ClassDeclaration/fixtures/_error_/missing-type-param/fixture.ts", "declaration/ExportNamedDeclaration/fixtures/_error_/assertion/fixture.ts", - "declaration/FunctionDeclaration/fixtures/_error_/missing-type-param/fixture.ts", - "declaration/TSDeclareFunction/fixtures/_error_/missing-type-param/fixture.ts", "declaration/TSImportEqualsDeclaration/fixtures/_error_/import-kind/fixture.ts", "declaration/TSInterfaceDeclaration/fixtures/_error_/missing-extends/fixture.ts", - "declaration/TSInterfaceDeclaration/fixtures/_error_/missing-type-param/fixture.ts", - "declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-extends/fixture.ts", - "declaration/TSTypeAliasDeclaration/fixtures/_error_/missing-type-parameter/fixture.ts", "declaration/VariableDeclaration/fixtures/_error_/const-destructure-no-init/fixture.ts", "declaration/VariableDeclaration/fixtures/_error_/const-destructure-type-no-init/fixture.ts", "declaration/VariableDeclaration/fixtures/_error_/const-id-no-init/fixture.ts", @@ -23,29 +16,39 @@ exports[`AST Fixtures > List fixtures with Error differences`] "declaration/VariableDeclaration/fixtures/_error_/var-destructure-no-init/fixture.ts", "declaration/VariableDeclaration/fixtures/_error_/var-destructure-type-no-init/fixture.ts", "element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/fixture.ts", + "expression/ObjectExpression/fixtures/_error_/getter-modifier-declare/fixture.ts", + "expression/ObjectExpression/fixtures/_error_/getter-modifier-export/fixture.ts", + "expression/ObjectExpression/fixtures/_error_/getter-modifier-override/fixture.ts", + "expression/ObjectExpression/fixtures/_error_/getter-modifier-private/fixture.ts", + "expression/ObjectExpression/fixtures/_error_/getter-modifier-protected/fixture.ts", + "expression/ObjectExpression/fixtures/_error_/getter-modifier-public/fixture.ts", + "expression/ObjectExpression/fixtures/_error_/getter-modifier-static/fixture.ts", + "expression/ObjectExpression/fixtures/_error_/property-modifier-abstract/fixture.ts", + "expression/ObjectExpression/fixtures/_error_/property-modifier-async/fixture.ts", + "expression/ObjectExpression/fixtures/_error_/property-modifier-declare/fixture.ts", + "expression/ObjectExpression/fixtures/_error_/property-modifier-export/fixture.ts", + "expression/ObjectExpression/fixtures/_error_/property-modifier-override/fixture.ts", + "expression/ObjectExpression/fixtures/_error_/property-modifier-private/fixture.ts", + "expression/ObjectExpression/fixtures/_error_/property-modifier-protected/fixture.ts", + "expression/ObjectExpression/fixtures/_error_/property-modifier-public/fixture.ts", + "expression/ObjectExpression/fixtures/_error_/property-modifier-static/fixture.ts", + "expression/ObjectExpression/fixtures/_error_/setter-modifier-declare/fixture.ts", + "expression/ObjectExpression/fixtures/_error_/setter-modifier-export/fixture.ts", + "expression/ObjectExpression/fixtures/_error_/setter-modifier-override/fixture.ts", + "expression/ObjectExpression/fixtures/_error_/setter-modifier-private/fixture.ts", + "expression/ObjectExpression/fixtures/_error_/setter-modifier-protected/fixture.ts", + "expression/ObjectExpression/fixtures/_error_/setter-modifier-public/fixture.ts", + "expression/ObjectExpression/fixtures/_error_/setter-modifier-static/fixture.ts", "legacy-fixtures/basics/fixtures/_error_/await-without-async-function/fixture.ts", "legacy-fixtures/basics/fixtures/_error_/class-private-identifier-field-with-accessibility-error/fixture.ts", "legacy-fixtures/basics/fixtures/_error_/class-with-constructor-and-type-parameters/fixture.ts", "legacy-fixtures/basics/fixtures/_error_/class-with-two-methods-computed-constructor/fixture.ts", "legacy-fixtures/basics/fixtures/_error_/const-assertions/fixture.ts", - "legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-number/fixture.ts", - "legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-string/fixture.ts", - "legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-var-ref/fixture.ts", "legacy-fixtures/basics/fixtures/_error_/export-with-import-assertions/fixture.ts", "legacy-fixtures/basics/fixtures/_error_/import-type-error/fixture.ts", "legacy-fixtures/basics/fixtures/_error_/new-target-in-arrow-function-body/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-call-expression/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-new-expression/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-arrow-function/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-constructor/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-function-expression/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-method-signature/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-method/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters/fixture.ts", "legacy-fixtures/errorRecovery/fixtures/_error_/index-signature-parameters/fixture.ts", "legacy-fixtures/errorRecovery/fixtures/_error_/interface-empty-extends/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/interface-multiple-extends/fixture.ts", "legacy-fixtures/errorRecovery/fixtures/_error_/interface-with-optional-index-signature/fixture.ts", "legacy-fixtures/parameter-decorators/fixtures/_error_/parameter-array-pattern-decorator/fixture.ts", "legacy-fixtures/parameter-decorators/fixtures/_error_/parameter-rest-element-decorator/fixture.ts", diff --git a/packages/ast-spec/tests/fixtures-with-differences-tokens.shot b/packages/ast-spec/tests/fixtures-with-differences-tokens.shot index fc6544193cf1..3b8639027419 100644 --- a/packages/ast-spec/tests/fixtures-with-differences-tokens.shot +++ b/packages/ast-spec/tests/fixtures-with-differences-tokens.shot @@ -18,26 +18,14 @@ exports[`AST Fixtures > List fixtures with Token differences`] "declaration/TSInterfaceDeclaration/fixtures/type-param-many/fixture.ts", "declaration/TSInterfaceDeclaration/fixtures/type-param-one/fixture.ts", "declaration/TSInterfaceDeclaration/fixtures/with-member-one/fixture.ts", - "declaration/VariableDeclaration/fixtures/declare-let-destructure-no-init/fixture.ts", - "declaration/VariableDeclaration/fixtures/declare-let-destructure-type-no-init/fixture.ts", - "declaration/VariableDeclaration/fixtures/declare-let-id-no-init/fixture.ts", - "declaration/VariableDeclaration/fixtures/declare-let-id-type-no-init/fixture.ts", - "declaration/VariableDeclaration/fixtures/let-destructure-init/fixture.ts", - "declaration/VariableDeclaration/fixtures/let-destructure-type-init/fixture.ts", - "declaration/VariableDeclaration/fixtures/let-id-definite-type-no-init/fixture.ts", - "declaration/VariableDeclaration/fixtures/let-id-init/fixture.ts", - "declaration/VariableDeclaration/fixtures/let-id-no-init/fixture.ts", - "declaration/VariableDeclaration/fixtures/let-id-type-init/fixture.ts", - "declaration/VariableDeclaration/fixtures/let-id-type-no-init/fixture.ts", - "declaration/VariableDeclaration/fixtures/multiple-declarations/fixture.ts", "element/AccessorProperty/fixtures/modifier-private/fixture.ts", "element/AccessorProperty/fixtures/modifier-protected/fixture.ts", "element/AccessorProperty/fixtures/modifier-public/fixture.ts", + "jsx/JSXAttribute/fixtures/element-non-self-closing/fixture.tsx", "jsx/JSXNamespacedName/fixtures/component-dashed/fixture.tsx", "jsx/JSXNamespacedName/fixtures/component/fixture.tsx", "legacy-fixtures/basics/fixtures/abstract-class-with-abstract-readonly-property/fixture.ts", "legacy-fixtures/basics/fixtures/abstract-class-with-declare-properties/fixture.ts", - "legacy-fixtures/basics/fixtures/async-function-with-var-declaration/fixture.ts", "legacy-fixtures/basics/fixtures/class-with-accessibility-modifiers/fixture.ts", "legacy-fixtures/basics/fixtures/class-with-constructor-and-modifier/fixture.ts", "legacy-fixtures/basics/fixtures/class-with-constructor-and-parameter-property-with-modifiers/fixture.ts", @@ -60,7 +48,6 @@ exports[`AST Fixtures > List fixtures with Token differences`] "legacy-fixtures/basics/fixtures/export-declare-named-enum/fixture.ts", "legacy-fixtures/basics/fixtures/export-default-interface/fixture.ts", "legacy-fixtures/basics/fixtures/export-named-enum/fixture.ts", - "legacy-fixtures/basics/fixtures/global-this/fixture.ts", "legacy-fixtures/basics/fixtures/interface-extends-multiple/fixture.ts", "legacy-fixtures/basics/fixtures/interface-extends/fixture.ts", "legacy-fixtures/basics/fixtures/interface-type-parameters/fixture.ts", @@ -73,66 +60,22 @@ exports[`AST Fixtures > List fixtures with Token differences`] "legacy-fixtures/basics/fixtures/interface-with-optional-properties/fixture.ts", "legacy-fixtures/basics/fixtures/interface-without-type-annotation/fixture.ts", "legacy-fixtures/basics/fixtures/keyword-variables/fixture.ts", - "legacy-fixtures/basics/fixtures/non-null-assertion-operator/fixture.ts", - "legacy-fixtures/basics/fixtures/null-and-undefined-type-annotations/fixture.ts", - "legacy-fixtures/basics/fixtures/nullish-coalescing/fixture.ts", - "legacy-fixtures/basics/fixtures/object-with-escaped-properties/fixture.ts", "legacy-fixtures/basics/fixtures/type-assertion-in-interface/fixture.ts", "legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-interface/fixture.ts", "legacy-fixtures/basics/fixtures/type-guard-in-interface/fixture.ts", "legacy-fixtures/basics/fixtures/type-parameters-comments-heritage/fixture.ts", - "legacy-fixtures/basics/fixtures/typed-keyword-null/fixture.ts", "legacy-fixtures/basics/fixtures/typed-this/fixture.ts", - "legacy-fixtures/basics/fixtures/union-intersection/fixture.ts", - "legacy-fixtures/basics/fixtures/unknown-type-annotation/fixture.ts", - "legacy-fixtures/basics/fixtures/variable-declaration-type-annotation-spacing/fixture.ts", "legacy-fixtures/class-decorators/fixtures/class-parameter-property/fixture.ts", "legacy-fixtures/declare/fixtures/enum/fixture.ts", "legacy-fixtures/declare/fixtures/interface/fixture.ts", "legacy-fixtures/namespaces-and-modules/fixtures/nested-internal-module/fixture.ts", - "legacy-fixtures/types/fixtures/conditional-with-null/fixture.ts", - "legacy-fixtures/types/fixtures/conditional/fixture.ts", - "legacy-fixtures/types/fixtures/constructor-generic/fixture.ts", - "legacy-fixtures/types/fixtures/constructor-in-generic/fixture.ts", - "legacy-fixtures/types/fixtures/constructor-with-rest/fixture.ts", - "legacy-fixtures/types/fixtures/constructor/fixture.ts", - "legacy-fixtures/types/fixtures/function-generic/fixture.ts", - "legacy-fixtures/types/fixtures/function-in-generic/fixture.ts", - "legacy-fixtures/types/fixtures/function-with-rest/fixture.ts", - "legacy-fixtures/types/fixtures/function-with-this/fixture.ts", - "legacy-fixtures/types/fixtures/function/fixture.ts", - "legacy-fixtures/types/fixtures/indexed/fixture.ts", "legacy-fixtures/types/fixtures/interface-with-accessors/fixture.ts", - "legacy-fixtures/types/fixtures/literal-number-negative/fixture.ts", - "legacy-fixtures/types/fixtures/literal-number/fixture.ts", - "legacy-fixtures/types/fixtures/literal-string/fixture.ts", - "legacy-fixtures/types/fixtures/mapped-readonly-minus/fixture.ts", - "legacy-fixtures/types/fixtures/mapped-readonly-plus/fixture.ts", - "legacy-fixtures/types/fixtures/mapped-readonly/fixture.ts", - "legacy-fixtures/types/fixtures/mapped-untypped/fixture.ts", - "legacy-fixtures/types/fixtures/mapped/fixture.ts", - "legacy-fixtures/types/fixtures/nested-types/fixture.ts", - "legacy-fixtures/types/fixtures/reference-generic-nested/fixture.ts", - "legacy-fixtures/types/fixtures/reference-generic/fixture.ts", - "legacy-fixtures/types/fixtures/reference/fixture.ts", "legacy-fixtures/types/fixtures/this-type-expanded/fixture.ts", - "legacy-fixtures/types/fixtures/tuple-empty/fixture.ts", - "legacy-fixtures/types/fixtures/tuple-named-optional/fixture.ts", - "legacy-fixtures/types/fixtures/tuple-named-rest/fixture.ts", - "legacy-fixtures/types/fixtures/tuple-named/fixture.ts", - "legacy-fixtures/types/fixtures/tuple-optional/fixture.ts", - "legacy-fixtures/types/fixtures/tuple-rest/fixture.ts", - "legacy-fixtures/types/fixtures/tuple/fixture.ts", - "legacy-fixtures/types/fixtures/type-literal/fixture.ts", - "legacy-fixtures/types/fixtures/type-operator/fixture.ts", - "legacy-fixtures/types/fixtures/typeof-this/fixture.ts", - "legacy-fixtures/types/fixtures/typeof-with-type-parameters/fixture.ts", - "legacy-fixtures/types/fixtures/typeof/fixture.ts", - "legacy-fixtures/types/fixtures/union-intersection/fixture.ts", "special/TSTypeParameter/fixtures/interface-const-in-modifier-multiple/fixture.ts", "special/TSTypeParameter/fixtures/interface-const-modifier-extends/fixture.ts", "special/TSTypeParameter/fixtures/interface-const-modifier-multiple/fixture.ts", "special/TSTypeParameter/fixtures/interface-const-modifier/fixture.ts", "special/TSTypeParameter/fixtures/interface-in-const-modifier-multiple/fixture.ts", - "type/TSImportType/fixtures/type-import-type-with-import-attributes-with/fixture.ts" + "type/TSImportType/fixtures/type-import-type-with-import-attributes-with/fixture.ts", + "type/TSImportType/fixtures/type-import-type-with-trailing-comma-in-import-attributes/fixture.ts" ] diff --git a/packages/ast-spec/tests/fixtures.test.ts b/packages/ast-spec/tests/fixtures.test.ts index 0660b3df3a7c..b6400540425c 100644 --- a/packages/ast-spec/tests/fixtures.test.ts +++ b/packages/ast-spec/tests/fixtures.test.ts @@ -4,7 +4,7 @@ import * as path from 'node:path'; import { pathToFileURL } from 'node:url'; import { VitestSnapshotEnvironment } from 'vitest/snapshot'; -import type { ASTFixtureConfig, Fixture } from './util/parsers/parser-types.js'; +import type { Fixture } from './util/parsers/parser-types.js'; import { getErrorLabel } from './util/getErrorLabel.js'; import { parseBabel } from './util/parsers/babel.js'; @@ -231,7 +231,7 @@ describe('AST Fixtures', async () => { await expect( [ `${vitestSnapshotHeader}\n\nexports[\`${expect.getState().currentTestName}\`]`, - babelParsed.error, + serializeError(babelParsed.error, contents), '', ].join('\n'), ).toMatchFileSnapshot(snapshotFiles.error.babel(2)); diff --git a/packages/ast-spec/tests/util/parsers/parser-types.ts b/packages/ast-spec/tests/util/parsers/parser-types.ts index e1d382876654..e95a648c6f24 100644 --- a/packages/ast-spec/tests/util/parsers/parser-types.ts +++ b/packages/ast-spec/tests/util/parsers/parser-types.ts @@ -5,27 +5,6 @@ interface SuccessSnapshotPaths { readonly tokens: SnapshotPathFn; } -/** - * We define this as a global type to make it easier to consume from fixtures. - * It saves us having to import the type into `src` files from a test utils folder. - * This is a convenient property because it saves us from a lot of `../`! - */ -export interface ASTFixtureConfig { - /** - * Prevents the parser from throwing an error if it receives an invalid AST from TypeScript. - * This case only usually occurs when attempting to lint invalid code. - */ - readonly allowInvalidAST?: boolean; - - /** - * Specifies that we expect that babel doesn't yet support the code in this fixture, so we expect that it will error. - * This should not be used if we expect babel to throw for this feature due to a valid parser error! - * - * The value should be a description of why there isn't support - for example a github issue URL. - */ - readonly expectBabelToNotSupport?: string; -} - export interface Fixture { readonly absolute: string; readonly babelParsed: ParserResponse; diff --git a/packages/ast-spec/tests/util/serialize-error.ts b/packages/ast-spec/tests/util/serialize-error.ts index 8a54fe232230..564f76f4cf0c 100644 --- a/packages/ast-spec/tests/util/serialize-error.ts +++ b/packages/ast-spec/tests/util/serialize-error.ts @@ -1,12 +1,10 @@ +import type { ParseError as BabelParseError } from '@babel/parser'; + import { codeFrameColumns } from '@babel/code-frame'; import { TSError } from './parsers/typescript-estree-import'; -export function serializeError(error: unknown, contents: string): unknown { - if (!(error instanceof TSError)) { - return error; - } - +function serializeTSError(error: TSError, contents: string): string { const { location: { end, start }, message, @@ -23,3 +21,38 @@ ${codeFrameColumns( { highlightCode: false, message }, )}`; } + +type BabelError = SyntaxError & + BabelParseError & { loc: { column: number; line: number } }; + +const isBabelError = (error: unknown): error is BabelError => + error instanceof SyntaxError && + 'code' in error && + 'reasonCode' in error && + 'loc' in error; + +function serializeBabelError(error: BabelError, contents: string): string { + const { loc, message } = error; + + return `BabelError +${codeFrameColumns( + contents, + { + start: { column: loc.column + 1, line: loc.line }, + }, + { highlightCode: false, message }, +)} + `; +} + +export function serializeError(error: unknown, contents: string): unknown { + if (error instanceof TSError) { + return serializeTSError(error, contents); + } + + if (isBabelError(error)) { + return serializeBabelError(error, contents); + } + + return error; +} diff --git a/packages/ast-spec/tsconfig.spec.json b/packages/ast-spec/tsconfig.spec.json index fa52d4c4e988..0f776aea58e3 100644 --- a/packages/ast-spec/tsconfig.spec.json +++ b/packages/ast-spec/tsconfig.spec.json @@ -3,6 +3,14 @@ "compilerOptions": { "outDir": "../../dist/packages/ast-spec" }, + "include": [ + "tests", + "typings", + "**/fixtures/**/config.ts", + "vitest.config.mts", + "package.json" + ], + "exclude": ["**/fixtures/**/fixture.ts"], "references": [ { "path": "../typescript-estree/tsconfig.build.json" diff --git a/packages/ast-spec/typings/global.d.ts b/packages/ast-spec/typings/global.d.ts new file mode 100644 index 000000000000..7dd0713ea5d4 --- /dev/null +++ b/packages/ast-spec/typings/global.d.ts @@ -0,0 +1,20 @@ +/** + * We define this as a global type to make it easier to consume from fixtures. + * It saves us having to import the type into `src` files from a test utils folder. + * This is a convenient property because it saves us from a lot of `../`! + */ +interface ASTFixtureConfig { + /** + * Prevents the parser from throwing an error if it receives an invalid AST from TypeScript. + * This case only usually occurs when attempting to lint invalid code. + */ + readonly allowInvalidAST?: boolean; + + /** + * Specifies that we expect that babel doesn't yet support the code in this fixture, so we expect that it will error. + * This should not be used if we expect babel to throw for this feature due to a valid parser error! + * + * The value should be a description of why there isn't support - for example a github issue URL. + */ + readonly expectBabelToNotSupport?: string; +} diff --git a/packages/eslint-plugin-internal/index.d.ts b/packages/eslint-plugin-internal/index.d.ts index 8c2962c75da3..68fc87c70ca0 100644 --- a/packages/eslint-plugin-internal/index.d.ts +++ b/packages/eslint-plugin-internal/index.d.ts @@ -2,8 +2,8 @@ import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint'; import type rules from './rules'; -declare const cjsExport: { +declare const defaultExport: { meta: FlatConfig.PluginMeta; rules: typeof rules; }; -export = cjsExport; +export default defaultExport; diff --git a/packages/eslint-plugin-internal/package.json b/packages/eslint-plugin-internal/package.json index 458bee57df6a..a6e86293d069 100644 --- a/packages/eslint-plugin-internal/package.json +++ b/packages/eslint-plugin-internal/package.json @@ -3,6 +3,7 @@ "private": true, "main": "dist/index.js", "types": "index.d.ts", + "type": "module", "repository": { "type": "git", "url": "https://github.com/typescript-eslint/typescript-eslint.git", @@ -14,25 +15,36 @@ "homepage": "https://typescript-eslint.io", "license": "MIT", "scripts": { - "build": "npx tsc -b tsconfig.build.json", - "clean": "npx tsc -b tsconfig.build.json --clean", - "postclean": "rimraf dist/ coverage/", - "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", - "lint": "npx nx lint", - "test": "vitest --run --config=$INIT_CWD/vitest.config.mts", - "check-types": "npx nx typecheck" + "build": "yarn run -BT nx build", + "clean": "rimraf dist/ coverage/", + "format": "yarn run -T format", + "lint": "yarn run -BT nx lint", + "test": "yarn run -BT nx test", + "typecheck": "yarn run -BT nx typecheck" }, "dependencies": { - "@prettier/sync": "^0.5.1", + "@prettier/sync": "^0.6.1", "@typescript-eslint/rule-tester": "workspace:*", "@typescript-eslint/scope-manager": "workspace:*", "@typescript-eslint/type-utils": "workspace:*", "@typescript-eslint/utils": "workspace:*", - "prettier": "^3.2.5" + "prettier": "3.6.2" }, "devDependencies": { "@vitest/coverage-v8": "^3.1.3", + "eslint": "*", "rimraf": "*", "vitest": "^3.1.3" + }, + "nx": { + "name": "eslint-plugin-internal", + "includedScripts": [ + "clean" + ], + "targets": { + "lint": { + "command": "eslint" + } + } } } diff --git a/packages/eslint-plugin-internal/project.json b/packages/eslint-plugin-internal/project.json deleted file mode 100644 index e7e8fe15571b..000000000000 --- a/packages/eslint-plugin-internal/project.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "eslint-plugin-internal", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "projectType": "library", - "root": "packages/eslint-plugin-internal", - "sourceRoot": "packages/eslint-plugin-internal/src", - "targets": { - "lint": { - "executor": "@nx/eslint:lint", - "outputs": ["{options.outputFile}"] - }, - "test": { - "executor": "@nx/vite:test" - } - } -} diff --git a/packages/eslint-plugin-internal/src/index.ts b/packages/eslint-plugin-internal/src/index.ts index 68991268506a..a299b00ec525 100644 --- a/packages/eslint-plugin-internal/src/index.ts +++ b/packages/eslint-plugin-internal/src/index.ts @@ -1,17 +1,12 @@ import type { Linter } from '@typescript-eslint/utils/ts-eslint'; -import rules from './rules'; +import rules from './rules/index.js'; +import packageJson from './util/packagejson.js'; -// note - cannot migrate this to an import statement because it will make TSC copy the package.json to the dist folder -const { name, version } = require('../package.json') as { - name: string; - version: string; -}; - -export = { +export default { meta: { - name, - version, + name: packageJson.name, + version: packageJson.version, }, rules, } satisfies Linter.Plugin; diff --git a/packages/eslint-plugin-internal/src/rules/debug-namespace.ts b/packages/eslint-plugin-internal/src/rules/debug-namespace.ts index ca76f5e1870f..9852edbb961f 100755 --- a/packages/eslint-plugin-internal/src/rules/debug-namespace.ts +++ b/packages/eslint-plugin-internal/src/rules/debug-namespace.ts @@ -2,7 +2,7 @@ import type { TSESTree } from '@typescript-eslint/utils'; import { getStaticValue } from '@typescript-eslint/utils/ast-utils'; -import { createRule } from '../util'; +import { createRule } from '../util/index.js'; function filePathToNamespace(filePath: string) { const relativePath = filePath @@ -20,7 +20,7 @@ function filePathToNamespace(filePath: string) { } export default createRule({ - name: __filename, + name: 'debug-namespace', meta: { type: 'problem', docs: { diff --git a/packages/eslint-plugin-internal/src/rules/eqeq-nullish.ts b/packages/eslint-plugin-internal/src/rules/eqeq-nullish.ts index f118b1c10cfc..0680b631102c 100644 --- a/packages/eslint-plugin-internal/src/rules/eqeq-nullish.ts +++ b/packages/eslint-plugin-internal/src/rules/eqeq-nullish.ts @@ -4,10 +4,10 @@ import { NullThrowsReasons, } from '@typescript-eslint/utils/eslint-utils'; -import { createRule } from '../util'; +import { createRule } from '../util/index.js'; export default createRule({ - name: __filename, + name: 'eqeq-nullish', meta: { type: 'suggestion', docs: { diff --git a/packages/eslint-plugin-internal/src/rules/index.ts b/packages/eslint-plugin-internal/src/rules/index.ts index 806618f909e4..7381fa1f11af 100644 --- a/packages/eslint-plugin-internal/src/rules/index.ts +++ b/packages/eslint-plugin-internal/src/rules/index.ts @@ -1,17 +1,19 @@ import type { Linter } from '@typescript-eslint/utils/ts-eslint'; -import debugNamespace from './debug-namespace'; -import eqeqNullish from './eqeq-nullish'; -import noPoorlyTypedTsProps from './no-poorly-typed-ts-props'; -import noRelativePathsToInternalPackages from './no-relative-paths-to-internal-packages'; -import noTypescriptDefaultImport from './no-typescript-default-import'; -import noTypescriptEstreeImport from './no-typescript-estree-import'; -import pluginTestFormatting from './plugin-test-formatting'; -import preferASTTypesEnum from './prefer-ast-types-enum'; +import debugNamespace from './debug-namespace.js'; +import eqeqNullish from './eqeq-nullish.js'; +import noDynamicTests from './no-dynamic-tests.js'; +import noPoorlyTypedTsProps from './no-poorly-typed-ts-props.js'; +import noRelativePathsToInternalPackages from './no-relative-paths-to-internal-packages.js'; +import noTypescriptDefaultImport from './no-typescript-default-import.js'; +import noTypescriptEstreeImport from './no-typescript-estree-import.js'; +import pluginTestFormatting from './plugin-test-formatting.js'; +import preferASTTypesEnum from './prefer-ast-types-enum.js'; export default { 'debug-namespace': debugNamespace, 'eqeq-nullish': eqeqNullish, + 'no-dynamic-tests': noDynamicTests, 'no-poorly-typed-ts-props': noPoorlyTypedTsProps, 'no-relative-paths-to-internal-packages': noRelativePathsToInternalPackages, 'no-typescript-default-import': noTypescriptDefaultImport, diff --git a/packages/eslint-plugin-internal/src/rules/no-dynamic-tests.ts b/packages/eslint-plugin-internal/src/rules/no-dynamic-tests.ts new file mode 100644 index 000000000000..bee236413868 --- /dev/null +++ b/packages/eslint-plugin-internal/src/rules/no-dynamic-tests.ts @@ -0,0 +1,140 @@ +import type { InvalidTestCase } from '@typescript-eslint/rule-tester'; +import type { TSESTree } from '@typescript-eslint/utils'; + +import { AST_NODE_TYPES } from '@typescript-eslint/utils'; + +import { createRule } from '../util/index.js'; + +export default createRule({ + name: 'no-dynamic-tests', + meta: { + type: 'problem', + docs: { + description: 'Disallow dynamic syntax in RuleTester test arrays', + }, + messages: { + noDynamicTests: + 'Dynamic syntax is not allowed in RuleTester test arrays. Use static values only.', + }, + schema: [], + }, + defaultOptions: [], + create(context) { + function isRuleTesterCall(node: TSESTree.Node): boolean { + return ( + node.type === AST_NODE_TYPES.CallExpression && + node.callee.type === AST_NODE_TYPES.MemberExpression && + node.callee.object.type === AST_NODE_TYPES.Identifier && + node.callee.object.name === 'ruleTester' && + node.callee.property.type === AST_NODE_TYPES.Identifier && + node.callee.property.name === 'run' + ); + } + + function reportDynamicElements(node: TSESTree.Node): void { + switch (node.type) { + case AST_NODE_TYPES.CallExpression: + case AST_NODE_TYPES.SpreadElement: + case AST_NODE_TYPES.Identifier: + case AST_NODE_TYPES.BinaryExpression: + case AST_NODE_TYPES.ConditionalExpression: + case AST_NODE_TYPES.MemberExpression: + context.report({ + node, + messageId: 'noDynamicTests', + }); + break; + case AST_NODE_TYPES.TemplateLiteral: + node.expressions.forEach(expr => { + reportDynamicElements(expr); + }); + break; + case AST_NODE_TYPES.ArrayExpression: + node.elements.forEach(element => { + if (element) { + reportDynamicElements(element); + } + }); + break; + case AST_NODE_TYPES.ObjectExpression: + node.properties.forEach(prop => { + if (prop.type === AST_NODE_TYPES.SpreadElement) { + context.report({ + node: prop, + messageId: 'noDynamicTests', + }); + } else { + // InvalidTestCase extends ValidTestCase + type TestCaseKey = keyof InvalidTestCase; + const keyToValidate: TestCaseKey[] = ['code', 'errors']; + + if ( + prop.key.type === AST_NODE_TYPES.Identifier && + keyToValidate.includes(prop.key.name as TestCaseKey) + ) { + reportDynamicElements(prop.value); + } else if ( + prop.key.type === AST_NODE_TYPES.Literal && + keyToValidate.includes(prop.key.value as TestCaseKey) + ) { + reportDynamicElements(prop.value); + } + } + }); + break; + case AST_NODE_TYPES.TaggedTemplateExpression: + if ( + !( + node.tag.type === AST_NODE_TYPES.Identifier && + node.tag.name === 'noFormat' + ) + ) { + context.report({ + node: node.tag, + messageId: 'noDynamicTests', + }); + } + break; + case AST_NODE_TYPES.Literal: + default: + break; + } + } + + return { + CallExpression(node) { + if (isRuleTesterCall(node)) { + // If valid code, arg length is always 3 but we need to avoid conflict while dev + if (node.arguments.length < 3) { + return; + } + const testObject = node.arguments[2]; + + if (testObject.type === AST_NODE_TYPES.ObjectExpression) { + for (const prop of testObject.properties) { + const isTestCases = + prop.type === AST_NODE_TYPES.Property && + prop.key.type === AST_NODE_TYPES.Identifier && + (prop.key.name === 'valid' || prop.key.name === 'invalid'); + + if (isTestCases) { + if (prop.value.type === AST_NODE_TYPES.ArrayExpression) { + prop.value.elements.forEach(element => { + if (element) { + reportDynamicElements(element); + } + }); + } else { + context.report({ + node: prop.value, + messageId: 'noDynamicTests', + }); + } + } + } + } + } + }, + }; + }, +}); 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 2da006d07bd9..ac537777b070 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 @@ -2,7 +2,7 @@ import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; import { ESLintUtils } from '@typescript-eslint/utils'; -import { createRule } from '../util'; +import { createRule } from '../util/index.js'; /* TypeScript declares some bad types for certain properties. diff --git a/packages/eslint-plugin-internal/src/rules/no-relative-paths-to-internal-packages.ts b/packages/eslint-plugin-internal/src/rules/no-relative-paths-to-internal-packages.ts index b366ee764fcb..b2eaa1d0d2f4 100644 --- a/packages/eslint-plugin-internal/src/rules/no-relative-paths-to-internal-packages.ts +++ b/packages/eslint-plugin-internal/src/rules/no-relative-paths-to-internal-packages.ts @@ -1,12 +1,17 @@ import path from 'node:path'; +import { fileURLToPath } from 'node:url'; -import { createRule } from '../util'; +import { createRule } from '../util/index.js'; + +// Replace with import.meta.dirname when minimum node version supports it +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); export const REPO_ROOT = path.resolve(__dirname, '../../../..'); export const PACKAGES_DIR = path.join(REPO_ROOT, 'packages'); export default createRule({ - name: __filename, + name: 'no-relative-paths-to-internal-packages', meta: { type: 'problem', docs: { 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 bddfbe1f7955..c5937ac0c7d3 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 @@ -1,6 +1,6 @@ import type { TSESTree } from '@typescript-eslint/utils'; -import { createRule } from '../util'; +import { createRule } from '../util/index.js'; /* We have `allowSyntheticDefaultImports` turned on in this project, so there are two problems that arise: 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 27d0ce54852d..e598a6faf9d0 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 @@ -1,4 +1,4 @@ -import { createRule } from '../util'; +import { createRule } from '../util/index.js'; const TSESTREE_NAME = '@typescript-eslint/typescript-estree'; const TYPES_NAME = '@typescript-eslint/types'; 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 26fcc60d8d2b..aaf4296ca3bf 100644 --- a/packages/eslint-plugin-internal/src/rules/plugin-test-formatting.ts +++ b/packages/eslint-plugin-internal/src/rules/plugin-test-formatting.ts @@ -3,8 +3,14 @@ import type { TSESTree } from '@typescript-eslint/utils'; import prettier from '@prettier/sync'; import { getContextualType } from '@typescript-eslint/type-utils'; import { AST_NODE_TYPES, ESLintUtils } from '@typescript-eslint/utils'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; -import { createRule } from '../util'; +import { createRule } from '../util/index.js'; + +// Replace with import.meta.dirname when minimum node version supports it +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); /* The strings that are used for eslint plugins will not be checked for formatting. @@ -145,6 +151,8 @@ export default createRule({ properties: { formatWithPrettier: { type: 'boolean', + description: + 'Whether to enforce formatting of code snippets using Prettier.', }, }, }, @@ -411,7 +419,7 @@ export default createRule({ if (isNoFormatTagged) { if (literal.parent.type === AST_NODE_TYPES.TaggedTemplateExpression) { - checkForUnnecesaryNoFormat(code, literal.parent); + checkForUnnecessaryNoFormat(code, literal.parent); } return; } @@ -447,7 +455,7 @@ export default createRule({ return tag.type === AST_NODE_TYPES.Identifier && tag.name === 'noFormat'; } - function checkForUnnecesaryNoFormat( + function checkForUnnecessaryNoFormat( text: string, expr: TSESTree.TaggedTemplateExpression, ): void { @@ -472,7 +480,7 @@ export default createRule({ ): void { if (isNoFormatTemplateTag(expr.tag)) { const { cooked } = expr.quasi.quasis[0].value; - checkForUnnecesaryNoFormat(cooked, expr); + checkForUnnecessaryNoFormat(cooked, expr); } else { return; } @@ -553,10 +561,6 @@ export default createRule({ AST_NODE_TYPES.ArrayExpression, AST_NODE_TYPES.ObjectExpression, ].join(' > ')]: checkInvalidTest, - // special case for our batchedSingleLineTests utility - 'CallExpression[callee.name = "batchedSingleLineTests"] > ObjectExpression': - checkInvalidTest, - /** * generic, type-aware handling for any old object * this is a fallback to handle random variables people declare or object 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 d6005443a50e..edf2bbf842f3 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,14 +3,14 @@ import type { TSESTree } from '@typescript-eslint/utils'; import { DefinitionType } from '@typescript-eslint/scope-manager'; import { AST_NODE_TYPES, AST_TOKEN_TYPES } from '@typescript-eslint/utils'; -import { createRule } from '../util'; +import { createRule } from '../util/index.js'; const isStringLiteral = ( node: TSESTree.Literal, ): node is TSESTree.StringLiteral => typeof node.value === 'string'; export default createRule({ - name: __filename, + name: 'prefer-ast-types-enum', meta: { type: 'problem', docs: { diff --git a/packages/eslint-plugin-internal/src/util/createRule.ts b/packages/eslint-plugin-internal/src/util/createRule.ts index 628498d08dad..ed6bcbca5198 100644 --- a/packages/eslint-plugin-internal/src/util/createRule.ts +++ b/packages/eslint-plugin-internal/src/util/createRule.ts @@ -1,8 +1,8 @@ import { ESLintUtils } from '@typescript-eslint/utils'; -// note - cannot migrate this to an import statement because it will make TSC copy the package.json to the dist folder -// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -const { version }: { version: string } = require('../../package.json'); +import packageJson from './packagejson.js'; + +const { version } = packageJson; export interface ESLintPluginInternalDocs { requiresTypeChecking?: true; diff --git a/packages/eslint-plugin-internal/src/util/index.ts b/packages/eslint-plugin-internal/src/util/index.ts index cd13da0f5cd3..71f5bf4fab22 100644 --- a/packages/eslint-plugin-internal/src/util/index.ts +++ b/packages/eslint-plugin-internal/src/util/index.ts @@ -1 +1 @@ -export * from './createRule'; +export * from './createRule.js'; diff --git a/packages/eslint-plugin-internal/src/util/packagejson.ts b/packages/eslint-plugin-internal/src/util/packagejson.ts new file mode 100644 index 000000000000..2b2aa40efceb --- /dev/null +++ b/packages/eslint-plugin-internal/src/util/packagejson.ts @@ -0,0 +1,17 @@ +import fs from 'node:fs'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; + +// Replace with import.meta.dirname when minimum node version supports it +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + +const packageJsonPath = path.join(__dirname, '../../package.json'); +const packageJsonContents = fs.readFileSync(packageJsonPath, 'utf-8'); +const packageJsonValue = JSON.parse(packageJsonContents) as { + name: string; + version: string; +}; + +// eslint-disable-next-line import/no-default-export +export default packageJsonValue; diff --git a/packages/eslint-plugin-internal/tests/RuleTester.ts b/packages/eslint-plugin-internal/tests/RuleTester.ts index 1c7e60f12d4b..15d182f0310d 100644 --- a/packages/eslint-plugin-internal/tests/RuleTester.ts +++ b/packages/eslint-plugin-internal/tests/RuleTester.ts @@ -1,4 +1,9 @@ import path from 'node:path'; +import { fileURLToPath } from 'node:url'; + +// Replace with import.meta.dirname when minimum node version supports it +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); export function getFixturesRootDir(): string { return path.join(__dirname, 'fixtures'); diff --git a/packages/eslint-plugin-internal/tests/rules/debug-namespace.test.ts b/packages/eslint-plugin-internal/tests/rules/debug-namespace.test.ts index 53e7ea81da15..8482087448ac 100644 --- a/packages/eslint-plugin-internal/tests/rules/debug-namespace.test.ts +++ b/packages/eslint-plugin-internal/tests/rules/debug-namespace.test.ts @@ -1,6 +1,6 @@ import { RuleTester } from '@typescript-eslint/rule-tester'; -import rule from '../../src/rules/debug-namespace'; +import rule from '../../src/rules/debug-namespace.js'; const ruleTester = new RuleTester(); diff --git a/packages/eslint-plugin-internal/tests/rules/eqeq-nullish.test.ts b/packages/eslint-plugin-internal/tests/rules/eqeq-nullish.test.ts index 663270002e45..10aca8c45955 100644 --- a/packages/eslint-plugin-internal/tests/rules/eqeq-nullish.test.ts +++ b/packages/eslint-plugin-internal/tests/rules/eqeq-nullish.test.ts @@ -1,6 +1,6 @@ import { RuleTester } from '@typescript-eslint/rule-tester'; -import rule from '../../src/rules/eqeq-nullish'; +import rule from '../../src/rules/eqeq-nullish.js'; const ruleTester = new RuleTester(); diff --git a/packages/eslint-plugin-internal/tests/rules/no-dynamic-tests.test.ts b/packages/eslint-plugin-internal/tests/rules/no-dynamic-tests.test.ts new file mode 100644 index 000000000000..dcb2ddbd007c --- /dev/null +++ b/packages/eslint-plugin-internal/tests/rules/no-dynamic-tests.test.ts @@ -0,0 +1,289 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + +import rule from '../../src/rules/no-dynamic-tests.js'; + +const ruleTester = new RuleTester({ + languageOptions: { + parserOptions: { + ecmaFeatures: {}, + ecmaVersion: 6, + sourceType: 'module', + }, + }, +}); + +ruleTester.run('no-dynamic-tests', rule, { + invalid: [ + // Function calls in test arrays + { + code: ` +ruleTester.run('test', rule, { + valid: [generateTestCases()], + invalid: [], +}); + `, + errors: [ + { + column: 11, + line: 3, + messageId: 'noDynamicTests', + }, + ], + }, + { + code: ` +ruleTester.run('test', rule, { + valid: [], + invalid: [...getInvalidCases()], +}); + `, + errors: [ + { + column: 13, + line: 4, + messageId: 'noDynamicTests', + }, + ], + }, + // Spread operator in test arrays + { + code: ` +ruleTester.run('test', rule, { + valid: [...validTestCases], + invalid: [], +}); + `, + errors: [ + { + column: 11, + line: 3, + messageId: 'noDynamicTests', + }, + ], + }, + { + code: ` +ruleTester.run('test', rule, { + valid: [...validTestCases.map(t => t.code)], + invalid: [], +}); + `, + errors: [ + { + column: 11, + line: 3, + messageId: 'noDynamicTests', + }, + ], + }, + // Simple identifiers in test arrays + { + code: ` +ruleTester.run('test', rule, { + valid: [testCase], + invalid: [], +}); + `, + errors: [ + { + column: 11, + line: 3, + messageId: 'noDynamicTests', + }, + ], + }, + // Template literals in test arrays + { + code: ` +ruleTester.run('test', rule, { + valid: [\`\${getTest()}\`], + invalid: [], +}); + `, + errors: [ + { + column: 14, + line: 3, + messageId: 'noDynamicTests', + }, + ], + }, + // Binary expressions in test arrays + { + code: ` +ruleTester.run('test', rule, { + valid: ['test' + getSuffix()], + invalid: [], +}); + `, + errors: [ + { + column: 11, + line: 3, + messageId: 'noDynamicTests', + }, + ], + }, + // Conditional expressions in test arrays + { + code: ` +ruleTester.run('test', rule, { + valid: [shouldTest ? 'test1' : 'test2'], + invalid: [], +}); + `, + errors: [ + { + column: 11, + line: 3, + messageId: 'noDynamicTests', + }, + ], + }, + // Member expressions in test arrays + { + code: ` +ruleTester.run('test', rule, { + valid: [testConfig.cases], + invalid: [], +}); + `, + errors: [ + { + column: 11, + line: 3, + messageId: 'noDynamicTests', + }, + ], + }, + // Object spread + { + code: ` +ruleTester.run('test', rule, { + valid: [{ ...testConfig }], + invalid: [], +}); + `, + errors: [ + { + column: 13, + line: 3, + messageId: 'noDynamicTests', + }, + ], + }, + // Tag + { + code: ` +ruleTester.run('test', rule, { + valid: [foo\`const x = 1;\`], + invalid: [], +}); + `, + errors: [ + { + column: 11, + line: 3, + messageId: 'noDynamicTests', + }, + ], + }, + // Object Value + { + code: ` +ruleTester.run('test', rule, { + valid: [{ code: foo }], + invalid: [], +}); + `, + errors: [ + { + column: 19, + line: 3, + messageId: 'noDynamicTests', + }, + ], + }, + { + code: ` +ruleTester.run('test', rule, { + valid: [{ errors: [...getErrors()] }], + invalid: [], +}); + `, + errors: [ + { + column: 22, + line: 3, + messageId: 'noDynamicTests', + }, + ], + }, + // assign directly + { + code: ` +ruleTester.run('test', rule, { + valid: foo, + invalid: [], +}); + `, + errors: [ + { + column: 10, + line: 3, + messageId: 'noDynamicTests', + }, + ], + }, + ], + valid: [ + { + code: ` +ruleTester.run('test', rule, { + valid: ['const x = 1;'], + invalid: [], +}); + `, + }, + { + code: ` +ruleTester.run('test', rule, { + valid: ['const x = 1;', 'let y = 2;'], + invalid: [ + { + code: 'var z = 3;', + errors: [{ messageId: 'error' }], + }, + ], +}); + `, + }, + { + code: ` +ruleTester.run('test', rule, { + valid: [{ code: 'const x = 1;' }, { code: 'let y = 2;' }], + invalid: [], +}); + `, + }, + { + code: ` +ruleTester.run('test', rule, { + valid: [noFormat\`const x = 1;\`], + invalid: [], +}); + `, + }, + { + code: ` +ruleTester.run('test', rule, { + code: "import type { ValueOf } from './utils';", + filename: path.resolve( + PACKAGES_DIR, + 'ast-spec/src/expression/AssignmentExpression/spec.ts', + ), +}); + `, + }, + ], +}); 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 cee60c1a8675..3a70101eb7d5 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,13 +1,14 @@ /* eslint-disable @typescript-eslint/internal/prefer-ast-types-enum */ import { RuleTester } from '@typescript-eslint/rule-tester'; -import rule from '../../src/rules/no-poorly-typed-ts-props'; -import { getFixturesRootDir } from '../RuleTester'; +import rule from '../../src/rules/no-poorly-typed-ts-props.js'; +import { getFixturesRootDir } from '../RuleTester.js'; const ruleTester = new RuleTester({ languageOptions: { parserOptions: { project: './tsconfig.json', + projectService: false, tsconfigRootDir: getFixturesRootDir(), }, }, diff --git a/packages/eslint-plugin-internal/tests/rules/no-relative-paths-to-internal-packages.test.ts b/packages/eslint-plugin-internal/tests/rules/no-relative-paths-to-internal-packages.test.ts index b67fc8b64224..36b966725f79 100644 --- a/packages/eslint-plugin-internal/tests/rules/no-relative-paths-to-internal-packages.test.ts +++ b/packages/eslint-plugin-internal/tests/rules/no-relative-paths-to-internal-packages.test.ts @@ -3,7 +3,7 @@ import path from 'node:path'; import rule, { PACKAGES_DIR, -} from '../../src/rules/no-relative-paths-to-internal-packages'; +} from '../../src/rules/no-relative-paths-to-internal-packages.js'; const ruleTester = new RuleTester({ languageOptions: { diff --git a/packages/eslint-plugin-internal/tests/rules/no-typescript-default-import.test.ts b/packages/eslint-plugin-internal/tests/rules/no-typescript-default-import.test.ts index 7284c154e458..83c1f7349a8e 100644 --- a/packages/eslint-plugin-internal/tests/rules/no-typescript-default-import.test.ts +++ b/packages/eslint-plugin-internal/tests/rules/no-typescript-default-import.test.ts @@ -1,6 +1,6 @@ import { RuleTester } from '@typescript-eslint/rule-tester'; -import rule from '../../src/rules/no-typescript-default-import'; +import rule from '../../src/rules/no-typescript-default-import.js'; const ruleTester = new RuleTester(); diff --git a/packages/eslint-plugin-internal/tests/rules/no-typescript-estree.test.ts b/packages/eslint-plugin-internal/tests/rules/no-typescript-estree.test.ts index a727f98d0d61..077169eb7dde 100644 --- a/packages/eslint-plugin-internal/tests/rules/no-typescript-estree.test.ts +++ b/packages/eslint-plugin-internal/tests/rules/no-typescript-estree.test.ts @@ -1,6 +1,6 @@ import { RuleTester } from '@typescript-eslint/rule-tester'; -import rule from '../../src/rules/no-typescript-estree-import'; +import rule from '../../src/rules/no-typescript-estree-import.js'; const ruleTester = new RuleTester(); diff --git a/packages/eslint-plugin-internal/tests/rules/plugin-test-formatting.test.ts b/packages/eslint-plugin-internal/tests/rules/plugin-test-formatting.test.ts index 29ee7dde5168..084eadd9b6c0 100644 --- a/packages/eslint-plugin-internal/tests/rules/plugin-test-formatting.test.ts +++ b/packages/eslint-plugin-internal/tests/rules/plugin-test-formatting.test.ts @@ -1,12 +1,13 @@ import { RuleTester } from '@typescript-eslint/rule-tester'; -import rule from '../../src/rules/plugin-test-formatting'; -import { getFixturesRootDir } from '../RuleTester'; +import rule from '../../src/rules/plugin-test-formatting.js'; +import { getFixturesRootDir } from '../RuleTester.js'; const ruleTester = new RuleTester({ languageOptions: { parserOptions: { project: './tsconfig.json', + projectService: false, tsconfigRootDir: getFixturesRootDir(), }, }, 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 c9273578ef0e..0c3ca98fbaad 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,7 +2,7 @@ import { RuleTester } from '@typescript-eslint/rule-tester'; import { DefinitionType } from '@typescript-eslint/scope-manager'; import { AST_NODE_TYPES, AST_TOKEN_TYPES } from '@typescript-eslint/utils'; -import rule from '../../src/rules/prefer-ast-types-enum'; +import rule from '../../src/rules/prefer-ast-types-enum.js'; const ruleTester = new RuleTester(); diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index 7b9fa13639b0..53995954dd83 100644 --- a/packages/eslint-plugin/CHANGELOG.md +++ b/packages/eslint-plugin/CHANGELOG.md @@ -1,3 +1,320 @@ +## 8.46.4 (2025-11-10) + +### 🩹 Fixes + +- **parser:** error when both `projectService` and `project` are set ([#11333](https://github.com/typescript-eslint/typescript-eslint/pull/11333)) +- **eslint-plugin:** handle override modifier in promise-function-async fixer ([#11730](https://github.com/typescript-eslint/typescript-eslint/pull/11730)) +- **eslint-plugin:** [no-deprecated] fix double-report on computed literal identifiers ([#11006](https://github.com/typescript-eslint/typescript-eslint/pull/11006), [#10958](https://github.com/typescript-eslint/typescript-eslint/issues/10958)) + +### ❤️ Thank You + +- Evgeny Stepanovych @undsoft +- Kentaro Suzuki @sushichan044 +- Maria Solano @MariaSolOs + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.3 (2025-11-03) + +### 🩹 Fixes + +- **eslint-plugin:** [no-duplicate-enum-values] support signed numbers ([#11722](https://github.com/typescript-eslint/typescript-eslint/pull/11722), [#11723](https://github.com/typescript-eslint/typescript-eslint/pull/11723)) +- **eslint-plugin:** [no-misused-promises] expand union type to retrieve target property ([#11706](https://github.com/typescript-eslint/typescript-eslint/pull/11706)) + +### ❤️ Thank You + +- Evgeny Stepanovych @undsoft +- tao + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.2 (2025-10-20) + +### 🩹 Fixes + +- **eslint-plugin:** [prefer-optional-chain] skip optional chaining when it could change the result ([#11702](https://github.com/typescript-eslint/typescript-eslint/pull/11702)) + +### ❤️ Thank You + +- mdm317 + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.1 (2025-10-13) + +### 🩹 Fixes + +- **eslint-plugin:** [no-misused-promises] special-case `.finally` not to report when a promise returning function is provided as an argument ([#11667](https://github.com/typescript-eslint/typescript-eslint/pull/11667)) +- **eslint-plugin:** [prefer-optional-chain] include mixed "nullish comparison style" chains in checks ([#11533](https://github.com/typescript-eslint/typescript-eslint/pull/11533)) + +### ❤️ Thank You + +- mdm317 +- Ronen Amiel + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.0 (2025-10-06) + +### 🚀 Features + +- **eslint-plugin:** [no-unsafe-member-access] add allowOptionalChaining option ([#11659](https://github.com/typescript-eslint/typescript-eslint/pull/11659)) +- **rule-schema-to-typescript-types:** clean up and make public ([#11633](https://github.com/typescript-eslint/typescript-eslint/pull/11633)) + +### 🩹 Fixes + +- **eslint-plugin:** [prefer-readonly-parameter-types] ignore tagged primitives ([#11660](https://github.com/typescript-eslint/typescript-eslint/pull/11660)) +- **typescript-estree:** forbid abstract method and accessor to have implementation ([#11657](https://github.com/typescript-eslint/typescript-eslint/pull/11657)) +- **eslint-plugin:** removed error type previously deprecated ([#11674](https://github.com/typescript-eslint/typescript-eslint/pull/11674)) +- **eslint-plugin:** [no-deprecated] ignore deprecated `export import`s ([#11603](https://github.com/typescript-eslint/typescript-eslint/pull/11603)) +- **eslint-plugin:** [unbound-method] improve wording around `this: void` and binding ([#11634](https://github.com/typescript-eslint/typescript-eslint/pull/11634)) +- **rule-tester:** deprecate TestCaseError#type and LintMessage#nodeType ([#11628](https://github.com/typescript-eslint/typescript-eslint/pull/11628)) +- **eslint-plugin:** [no-floating-promises] remove excess parentheses in suggestions ([#11487](https://github.com/typescript-eslint/typescript-eslint/pull/11487)) + +### ❤️ Thank You + +- fisker Cheung @fisker +- Josh Goldberg ✨ +- Kirk Waiblinger @kirkwaiblinger +- Mark de Dios @peanutenthusiast +- Richard Torres @richardtorres314 +- Victor Genaev @mainframev + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.45.0 (2025-09-29) + +### 🚀 Features + +- **eslint-plugin:** expose rule name via RuleModule interface ([#11616](https://github.com/typescript-eslint/typescript-eslint/pull/11616)) + +### 🩹 Fixes + +- **eslint-plugin:** [prefer-nullish-coalescing] ignoreBooleanCoercion should not apply to top-level ternary expressions ([#11614](https://github.com/typescript-eslint/typescript-eslint/pull/11614)) +- **eslint-plugin:** [no-base-to-string] check if superclass is ignored ([#11617](https://github.com/typescript-eslint/typescript-eslint/pull/11617)) + +### ❤️ Thank You + +- mdm317 +- Moses Odutusin @thebolarin +- Yukihiro Hasegawa @y-hsgw + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.44.1 (2025-09-22) + +### 🩹 Fixes + +- **eslint-plugin:** [await-thenable] should not report passing values to promise aggregators which may be a promise in an array literal ([#11611](https://github.com/typescript-eslint/typescript-eslint/pull/11611)) +- **eslint-plugin:** [no-unsafe-enum-comparison] support unions of literals ([#11599](https://github.com/typescript-eslint/typescript-eslint/pull/11599)) +- **eslint-plugin:** [no-base-to-string] make ignoredTypeNames match type names without generics ([#11597](https://github.com/typescript-eslint/typescript-eslint/pull/11597)) + +### ❤️ Thank You + +- Kirk Waiblinger @kirkwaiblinger +- mdm317 +- Ronen Amiel + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.44.0 (2025-09-15) + +### 🚀 Features + +- **eslint-plugin:** [await-thenable] report invalid (non-promise) values passed to promise aggregator methods ([#11267](https://github.com/typescript-eslint/typescript-eslint/pull/11267)) + +### 🩹 Fixes + +- **eslint-plugin:** [no-unnecessary-type-conversion] ignore enum members ([#11490](https://github.com/typescript-eslint/typescript-eslint/pull/11490)) + +### ❤️ Thank You + +- Moses Odutusin @thebolarin +- Ronen Amiel + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.43.0 (2025-09-08) + +### 🚀 Features + +- **typescript-estree:** disallow empty type parameter/argument lists ([#11563](https://github.com/typescript-eslint/typescript-eslint/pull/11563)) + +### 🩹 Fixes + +- **eslint-plugin:** [prefer-return-this-type] don't report an error when returning a union type that includes a classType ([#11432](https://github.com/typescript-eslint/typescript-eslint/pull/11432)) +- **eslint-plugin:** [no-deprecated] should report deprecated exports and reexports ([#11359](https://github.com/typescript-eslint/typescript-eslint/pull/11359)) +- **eslint-plugin:** [no-floating-promises] allowForKnownSafeCalls now supports function names ([#11423](https://github.com/typescript-eslint/typescript-eslint/pull/11423), [#11430](https://github.com/typescript-eslint/typescript-eslint/pull/11430)) +- **eslint-plugin:** [consistent-type-exports] fix declaration shadowing ([#11457](https://github.com/typescript-eslint/typescript-eslint/pull/11457)) +- **eslint-plugin:** [no-unnecessary-type-conversion] only report ~~ on integer literal types ([#11517](https://github.com/typescript-eslint/typescript-eslint/pull/11517)) +- **scope-manager:** exclude Program from DefinitionBase node types ([#11469](https://github.com/typescript-eslint/typescript-eslint/pull/11469)) +- **eslint-plugin:** [no-non-null-assertion] do not suggest optional chain on LHS of assignment ([#11489](https://github.com/typescript-eslint/typescript-eslint/pull/11489)) +- **type-utils:** add union type support to TypeOrValueSpecifier ([#11526](https://github.com/typescript-eslint/typescript-eslint/pull/11526)) + +### ❤️ Thank You + +- Dima @dbarabashh +- Kirk Waiblinger @kirkwaiblinger +- mdm317 +- tao +- Victor Genaev @mainframev +- Yukihiro Hasegawa @y-hsgw +- 민감자(Minji Kim) @mouse0429 +- 송재욱 + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.42.0 (2025-09-02) + +### 🩹 Fixes + +- **deps:** update eslint monorepo to v9.33.0 ([#11482](https://github.com/typescript-eslint/typescript-eslint/pull/11482)) + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.41.0 (2025-08-25) + +### 🩹 Fixes + +- **deps:** update dependency prettier to v3.6.2 ([#11496](https://github.com/typescript-eslint/typescript-eslint/pull/11496)) + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.40.0 (2025-08-18) + +### 🚀 Features + +- **typescript-estree:** forbid invalid keys in `EnumMember` ([#11232](https://github.com/typescript-eslint/typescript-eslint/pull/11232)) + +### ❤️ Thank You + +- fisker Cheung @fisker + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.39.1 (2025-08-11) + +This was a version bump only for eslint-plugin to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.39.0 (2025-08-04) + +### 🚀 Features + +- **eslint-plugin:** [only-throw-error] support yield/await expressions ([#11417](https://github.com/typescript-eslint/typescript-eslint/pull/11417)) +- **eslint-plugin:** add no-unnecessary-type-conversion to strict-type-checked ruleset ([#11427](https://github.com/typescript-eslint/typescript-eslint/pull/11427)) +- update to TypeScript 5.9.2 ([#11445](https://github.com/typescript-eslint/typescript-eslint/pull/11445)) +- **eslint-plugin:** [naming-convention] add enumMember PascalCase default option ([#11127](https://github.com/typescript-eslint/typescript-eslint/pull/11127)) + +### 🩹 Fixes + +- **eslint-plugin:** [no-unsafe-assignment] add an `unsafeObjectPattern` message ([#11403](https://github.com/typescript-eslint/typescript-eslint/pull/11403)) +- **eslint-plugin:** [prefer-optional-chain] ignore `check` option for most RHS of a chain ([#11272](https://github.com/typescript-eslint/typescript-eslint/pull/11272)) + +### ❤️ Thank You + +- Brad Zacher @bradzacher +- James Garbutt @43081j +- Kim Sang Du @developer-bandi +- Sasha Kondrashov +- tao +- Younsang Na @nayounsang + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.38.0 (2025-07-21) + +### 🩹 Fixes + +- disallow extra properties in rule options ([#11397](https://github.com/typescript-eslint/typescript-eslint/pull/11397)) +- **eslint-plugin:** [consistent-generic-constructors] resolve conflict with `isolatedDeclarations` if enabled in `constructor` option ([#11351](https://github.com/typescript-eslint/typescript-eslint/pull/11351)) + +### ❤️ Thank You + +- Andrew Kazakov @andreww2012 +- Younsang Na @nayounsang + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.37.0 (2025-07-14) + +### 🩹 Fixes + +- **eslint-plugin:** [unified-signatures] fix false positives for ignoreOverloadsWithDifferentJSDoc option ([#11381](https://github.com/typescript-eslint/typescript-eslint/pull/11381)) + +### ❤️ Thank You + +- Yukihiro Hasegawa @y-hsgw + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.36.0 (2025-07-07) + +This was a version bump only for eslint-plugin to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.35.1 (2025-06-30) + +### 🩹 Fixes + +- remove prettier from eslint-plugin ([#11339](https://github.com/typescript-eslint/typescript-eslint/pull/11339)) + +### ❤️ Thank You + +- Abhijeet Singh @cseas + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.35.0 (2025-06-23) + +### 🚀 Features + +- **eslint-plugin:** [no-base-to-string] add checkUnknown Option ([#11128](https://github.com/typescript-eslint/typescript-eslint/pull/11128)) + +### ❤️ Thank You + +- Kim Sang Du @developer-bandi + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.34.1 (2025-06-16) + +This was a version bump only for eslint-plugin to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.34.0 (2025-06-09) + +### 🩹 Fixes + +- **typescript-estree:** add validation to interface extends ([#11271](https://github.com/typescript-eslint/typescript-eslint/pull/11271)) + +### ❤️ Thank You + +- Tao + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.33.1 (2025-06-02) + +### 🩹 Fixes + +- exclude docs/ directory from eslint-plugin package ([#11251](https://github.com/typescript-eslint/typescript-eslint/pull/11251)) + +### ❤️ Thank You + +- roottool + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.33.0 (2025-05-26) + +This was a version bump only for eslint-plugin to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + ## 8.32.1 (2025-05-12) ### 🩹 Fixes diff --git a/packages/eslint-plugin/docs/rules/README.md b/packages/eslint-plugin/docs/rules/README.md index 75c5723d748a..1cb9c5435fa1 100644 --- a/packages/eslint-plugin/docs/rules/README.md +++ b/packages/eslint-plugin/docs/rules/README.md @@ -55,3 +55,16 @@ module.exports = { ``` [Search for `🧱 extension rule`s](?=extension#rules) in this page to see all extension rules. + +## Frozen Rules + +When rules are feature complete, they are marked as frozen (indicated with ❄️ in the documentation). This applies to standalone rules that are complete, as well as [extension rules](#extension-rules) whose underlying core ESLint rules are frozen. After that point, we expect users to use [disable comments](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments-1) when they find an edge case that isn’t covered. + +When a rule is frozen, it means: + +- **Bug fixes**: We will still fix confirmed bugs. +- **New ECMAScript features**: We will ensure compatibility with new ECMAScript features, meaning the rule will not break on new syntax. +- **TypeScript support**: We will ensure compatibility with TypeScript syntax, meaning the rule will not break on TypeScript syntax and violations are appropriate for TypeScript. +- **New options**: We will not add any new options unless an option is the only way to fix a bug or support a newly-added ECMAScript feature. + +If you find that a frozen rule would work better for you with a change, we recommend copying the rule source code and modifying it to fit your needs. diff --git a/packages/eslint-plugin/docs/rules/ban-ts-comment.mdx b/packages/eslint-plugin/docs/rules/ban-ts-comment.mdx index e2338747b707..0f162f5ee57f 100644 --- a/packages/eslint-plugin/docs/rules/ban-ts-comment.mdx +++ b/packages/eslint-plugin/docs/rules/ban-ts-comment.mdx @@ -9,11 +9,11 @@ import TabItem from '@theme/TabItem'; > > See **https://typescript-eslint.io/rules/ban-ts-comment** for documentation. -TypeScript provides several directive comments that can be used to alter how it processes files. +TypeScript provides several comment directives that can be used to alter how it processes files. Using these to suppress TypeScript compiler errors reduces the effectiveness of TypeScript overall. Instead, it's generally better to correct the types of code, to make directives unnecessary. -The directive comments supported by TypeScript are: +The comment directives supported by TypeScript are: ```ts // @ts-expect-error @@ -22,7 +22,7 @@ The directive comments supported by TypeScript are: // @ts-check ``` -This rule lets you set which directive comments you want to allow in your codebase. +This rule lets you set which comment directives you want to allow in your codebase. ## Options diff --git a/packages/eslint-plugin/docs/rules/no-base-to-string.mdx b/packages/eslint-plugin/docs/rules/no-base-to-string.mdx index 8097ca8b7f41..d1927bf69b5b 100644 --- a/packages/eslint-plugin/docs/rules/no-base-to-string.mdx +++ b/packages/eslint-plugin/docs/rules/no-base-to-string.mdx @@ -99,6 +99,17 @@ let text = `${value}`; String(/regex/); ``` +### `checkUnknown` + +{/* insert option description */} + +The following patterns are considered incorrect with the options `{ checkUnknown: true }`: + +```ts option='{ "checkUnknown": true }' showPlaygroundButton +declare const x: unknown; +String(x); +``` + ## When Not To Use It If you don't mind a risk of `"[object Object]"` or incorrect type coercions in your values, then you will not need this rule. diff --git a/packages/eslint-plugin/docs/rules/no-explicit-any.mdx b/packages/eslint-plugin/docs/rules/no-explicit-any.mdx index f0c8c20c6dec..6b9a06f7538e 100644 --- a/packages/eslint-plugin/docs/rules/no-explicit-any.mdx +++ b/packages/eslint-plugin/docs/rules/no-explicit-any.mdx @@ -145,6 +145,86 @@ interface Garply { } ``` +## Alternatives to `any` + +If you do know the properties that exist on an object value, it's generally best to use an `interface` or `type` to describe those properties. +If a straightforward object type isn't sufficient, then you can choose between several strategies instead of `any`. +The following headings describe some of the more common strategies. + +### `unknown` + +If you don't know the data shape of a value, the `unknown` type is safer than `any`. +Like `any`, `unknown` indicates the value might be any kind of data with any properties. +Unlike `any`, `unknown` doesn't allow arbitrary property accesses: it requires the value be narrowed to a more specific type before being used. +See [The `unknown` type in TypeScript](https://mariusschulz.com/blog/the-unknown-type-in-typescript) for more information on `unknown`. + +### Index Signatures + +Some objects are used with arbitrary keys, especially in code that predates [`Map`s](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) and [`Set`s](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set). +TypeScript interfaces may be given an _"index signature"_ to indicate arbitrary keys are allowed on objects. + +For example, this type defines an object that must have an `apple` property with a `number` value, and may have any other string keys with `number | undefined` values: + +```ts +interface AllowsAnyStrings { + apple: number; + [i: string]: number | undefined; +} + +let fruits: AllowsAnyStrings; + +fruits = { apple: 0 }; // Ok +fruits.banana = 1; // Ok +fruits.cherry = undefined; // Ok +``` + +See [What does a TypeScript index signature actually mean?](https://stackoverflow.com/questions/58458308/what-does-a-typescript-index-signature-actually-mean) for more information on index signatures. + +### Union Types + +Some values can be one of multiple types. +TypeScript allows representing these with _"union"_ types: types that include a list of possible shapes for data. + +Union types are often used to describe "nullable" values: those that can either be a data type or `null` and/or `undefined`. +For example, the following `StringLike` type describes data that is either a `string` or `undefined`: + +```ts +type StringLike = string | undefined; + +let fruit: StringLike; + +fruit = 'apple'; // Ok +fruit = undefined; // Ok +``` + +See [TypeScript Handbook: Everyday Types > Union Types](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types) for more information on union types. + +### Type Parameter Constraints + +"Generic" type parameters are often used to represent a value of an unknown type. +It can be tempting to use `any` as a type parameter constraint, but this is not recommended. + +First, `extends any` on its own does nothing: `` is equivalent to ``. +See [`@typescript-eslint/no-unnecessary-type-constraint`](./no-unnecessary-type-constraint.mdx) for more information. + +Within type parameters, `never` and `unknown` otherwise can generally be used instead. +For example, the following code uses those two types in `AnyFunction` instead of `any`s to constrain `Callback` to any function type: + +```ts +type AnyFunction = (...args: never[]) => unknown; + +function curry(greeter: Greeter, prefix: string) { + return (...args: Parameters) => `${prefix}: ${greeter(...args)}`; +} + +const greet = (name: string) => `Hello, ${name}!`; +const greetWithDate = curry(greet, 'Logged: '); + +greetWithDate('linter'); // => "Logged: Hello, linter!" +``` + +See [When to use `never` and `unknown` in TypeScript](https://blog.logrocket.com/when-to-use-never-unknown-typescript) for more information on those types. + ## When Not To Use It `any` is always a dangerous escape hatch. diff --git a/packages/eslint-plugin/docs/rules/no-floating-promises.mdx b/packages/eslint-plugin/docs/rules/no-floating-promises.mdx index 12bf7465b537..977b10b2a078 100644 --- a/packages/eslint-plugin/docs/rules/no-floating-promises.mdx +++ b/packages/eslint-plugin/docs/rules/no-floating-promises.mdx @@ -258,7 +258,7 @@ unsafe('...', () => {}); -```ts option='{"allowForKnownSafeCalls":[{"from":"file","name":"safe","path":"input.ts"}]}' skipValidation +```ts option='{"allowForKnownSafeCalls":[{"from":"file","name":"safe","path":"input.ts"}]}' declare function safe(...args: unknown[]): Promise; safe('...', () => {}); diff --git a/packages/eslint-plugin/docs/rules/no-misused-spread.mdx b/packages/eslint-plugin/docs/rules/no-misused-spread.mdx index 5b3320e1e314..2748d7cce73f 100644 --- a/packages/eslint-plugin/docs/rules/no-misused-spread.mdx +++ b/packages/eslint-plugin/docs/rules/no-misused-spread.mdx @@ -37,7 +37,7 @@ That includes the following cases: declare const promise: Promise; const spreadPromise = { ...promise }; -declare function getObject(): Record; +declare function getObject(): Record; const getObjectSpread = { ...getObject }; declare const map: Map; @@ -64,7 +64,7 @@ const instanceSpread = { ...instance }; declare const promise: Promise; const spreadPromise = { ...(await promise) }; -declare function getObject(): Record; +declare function getObject(): Record; const getObjectSpread = { ...getObject() }; declare const map: Map; @@ -121,6 +121,19 @@ const spreadBrandedString = [...brandedString]; +#### Examples + +If you intentionally spread over strings, you can use `allow` to explicitly allowlist them: + +```ts option='{"allow":[{ "from": "lib", "name": "string" }]}' +/* eslint @typescript-eslint/no-misused-spread: {"allow":[{ "from": "lib", "name": "string" }]} */ +declare const unbrandedString: string; + +const spreadUnbrandedString = [...unbrandedString]; +``` + +See the shared [`TypeOrValueSpecifier` format](/packages/type-utils/type-or-value-specifier) for more information. + ## When Not To Use It If your application intentionally works with raw data in unusual ways, such as directly manipulating class prototype chains, you might not want this rule. diff --git a/packages/eslint-plugin/docs/rules/no-unnecessary-condition.mdx b/packages/eslint-plugin/docs/rules/no-unnecessary-condition.mdx index 55ed0d531a1e..ab7871fdcba8 100644 --- a/packages/eslint-plugin/docs/rules/no-unnecessary-condition.mdx +++ b/packages/eslint-plugin/docs/rules/no-unnecessary-condition.mdx @@ -12,13 +12,6 @@ import TabItem from '@theme/TabItem'; Any expression being used as a condition must be able to evaluate as truthy or falsy in order to be considered "necessary". Conversely, any expression that always evaluates to truthy or always evaluates to falsy, as determined by the type of the expression, is considered unnecessary and will be flagged by this rule. -The following expressions are checked: - -- Arguments to the `&&`, `||` and `?:` (ternary) operators -- Conditions for `if`, `for`, `while`, and `do-while` statements -- `case`s in `switch` statements -- Base values of optional chain expressions - ## Examples diff --git a/packages/eslint-plugin/docs/rules/no-unsafe-member-access.mdx b/packages/eslint-plugin/docs/rules/no-unsafe-member-access.mdx index 2f1eb0edbf0f..f96138fc93eb 100644 --- a/packages/eslint-plugin/docs/rules/no-unsafe-member-access.mdx +++ b/packages/eslint-plugin/docs/rules/no-unsafe-member-access.mdx @@ -65,6 +65,43 @@ arr[idx++]; +## Options + +### `allowOptionalChaining` + +{/* insert option description */} + +Examples of code for this rule with `{ allowOptionalChaining: true }`: + + + + +```ts +declare const outer: any; + +outer.inner; +outer.middle.inner; +``` + + + + +```ts option='{ "allowOptionalChaining": true }' +declare const outer: any; + +outer?.inner; +outer?.middle?.inner; +``` + + + + +:::caution +We only recommend using `allowOptionalChaining` to help transition an existing project towards fully enabling `no-unsafe-member-access`. +Optional chaining makes it safer than normal property accesses in that you won't get a runtime error if the parent value is `null` or `undefined`. +However, it still results in an `any`-typed value, which is unsafe. +::: + ## When Not To Use It If your codebase has many existing `any`s or areas of unsafe code, it may be difficult to enable this rule. diff --git a/packages/eslint-plugin/docs/rules/no-unused-vars.mdx b/packages/eslint-plugin/docs/rules/no-unused-vars.mdx index 461cf3d93817..ea0a336a011f 100644 --- a/packages/eslint-plugin/docs/rules/no-unused-vars.mdx +++ b/packages/eslint-plugin/docs/rules/no-unused-vars.mdx @@ -118,3 +118,19 @@ export interface Box { If you find yourself writing runtime values only for types, consider refactoring your code to declare types directly. + +### Why are variables reported as unused despite being referenced by @link in JSDoc? + +JSDoc references are not supported by typescript-eslint. +You can use a rule such as [`jsdoc/no-undefined-types`](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-undefined-types.md) to resolve variables as used in JSDoc comments. + +```ts +import type { Box } from './Box'; +// ~~~ +// 'Box' is defined but never used. + +/** + * @see {@link Box} + */ +export function getBox() {} +``` diff --git a/packages/eslint-plugin/docs/rules/only-throw-error.mdx b/packages/eslint-plugin/docs/rules/only-throw-error.mdx index e30f67a0869b..f3b97a91a625 100644 --- a/packages/eslint-plugin/docs/rules/only-throw-error.mdx +++ b/packages/eslint-plugin/docs/rules/only-throw-error.mdx @@ -23,7 +23,7 @@ The new name is a drop-in replacement with identical functionality. ## Examples -This rule is aimed at maintaining consistency when throwing exception by disallowing to throw literals and other expressions which cannot possibly be an `Error` object. +This rule is aimed at maintaining consistency when throwing exceptions by disallowing throwing values that are not `Error` objects. @@ -35,26 +35,20 @@ throw 0; throw undefined; -throw null; - -const err = new Error(); -throw 'an ' + err; - -const err = new Error(); -throw `${err}`; - -const err = ''; -throw err; - -function getError() { +function getErrorString(): string { return ''; } -throw getError(); +throw getErrorString(); const foo = { - bar: '', + bar: 'error string', }; throw foo.bar; + +class SomeClass { + // ... +} +throw new SomeClass(); ``` @@ -68,15 +62,6 @@ throw new Error('error'); const e = new Error('error'); throw e; -try { - throw new Error('error'); -} catch (e) { - throw e; -} - -const err = new Error(); -throw err; - function getError() { return new Error(); } @@ -108,16 +93,16 @@ interface Options { allow?: ( | { from: 'file'; - name: [string, ...string[]] | string; + name: string[] | string; path?: string; } | { from: 'lib'; - name: [string, ...string[]] | string; + name: string[] | string; } | { from: 'package'; - name: [string, ...string[]] | string; + name: string[] | string; package: string; } | string @@ -141,10 +126,126 @@ interface Options { const defaultOptions: Options = { allow: [], - allowRethrowing: false, + allowRethrowing: true, allowThrowingAny: true, allowThrowingUnknown: true, }; ``` +### allowThrowingAny + +When set to `true`, this option allows throwing values typed as `any`. + +Examples of **correct** code with `{ allowThrowingAny: true }`: + +```ts option='{ "allowThrowingAny": true }' showPlaygroundButton +function throwAny(value: any) { + throw value; +} +``` + +### allowThrowingUnknown + +When set to `true`, this option allows throwing values typed as `unknown`. + +Examples of **correct** code with `{ allowThrowingUnknown: true }`: + +```ts option='{ "allowThrowingUnknown": true }' showPlaygroundButton +function throwUnknown(value: unknown) { + throw value; +} +``` + +### allowRethrowing + +When set to `true`, this option allows throwing caught values. +This is intended to be used in order to make patterns involving rethrowing exceptions less painful for users who set `allowThrowingAny`/`allowThrowingUnknown` to `false`. + +Examples of **correct** code with `{ allowRethrowing: true, allowThrowingAny: false, allowThrowingUnknown: false }`: + +```ts option='{ "allowRethrowing": true, "allowThrowingAny": false, "allowThrowingUnknown": false }' showPlaygroundButton +declare function mightThrow(): void; +declare class SomeSpecificError extends Error { + // ... +} + +function foo() { + try { + mightThrow(); + } catch (e) { + if (e instanceof SomeSpecificError) { + // handle specific error ... + return; + } + + // unexpected error that we shouldn't catch. + throw e; + } +} + +declare function mightReject(): Promise; + +mightReject().catch(e => { + if (e instanceof SomeSpecificError) { + // handle specific error ... + return; + } + + // unexpected error that we can't handle + throw e; +}); + +declare function log(message: string): void; + +function bar() { + log('starting bar()'); + let wasError = false; + try { + // ... + } catch (e) { + wasError = true; + throw e; + } finally { + log(`completed bar() ${wasError ? 'with error' : 'successfully'}`); + } +} +``` + +:::note + +While it makes sense to rethrow errors in some cases, it is likely more common that one would want to create a new `Error` and set its [`cause`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/cause) appropriately. + +```ts +function foo() { + try { + // ... + } catch (e) { + throw new Error('Could not complete foo()', { cause: e }); + } +} +``` + +::: + +### allow + +This option takes the shared [`TypeOrValueSpecifier` format](/packages/type-utils/type-or-value-specifier) to allow throwing values that are not `Error` objects. +While we strongly recommend that you only create custom error classes that extend `Error`, this option can be useful for throwing errors defined by libraries that do not follow this convention. + +Examples of code for this rule with: + +```jsonc +{ + "allow": [{ "from": "file", "name": "CustomError" }], +} +``` + +```ts option='{ "allow": [{ "from": "file", "name": "CustomError" }] }' showPlaygroundButton +class CustomError /* does NOT extend Error */ { + // ... +} + +throw new CustomError(); +``` + {/* Intentionally Omitted: When Not To Use It */} diff --git a/packages/eslint-plugin/docs/rules/prefer-for-of.mdx b/packages/eslint-plugin/docs/rules/prefer-for-of.mdx index 0399c781ddd7..668023249c9c 100644 --- a/packages/eslint-plugin/docs/rules/prefer-for-of.mdx +++ b/packages/eslint-plugin/docs/rules/prefer-for-of.mdx @@ -47,4 +47,24 @@ for (let i = 0; i < array.length; i++) { -{/* Intentionally Omitted: When Not To Use It */} +## DOM Elements + +By default, TypeScript's type checking only allows `for-of` loops over DOM iterables such as `HTMLCollectionOf` when the `dom.iterable` `lib` option is enabled. +If you are using this rule in a project that works with DOM elements, be sure to enable `dom.iterable` in your TSConfig `lib`. +See [aka.ms/tsconfig#lib](http://aka.ms/tsconfig#lib) for more information. + +```json +{ + "compilerOptions": { + "strict": true, + "lib": ["esnext", "dom", "dom.iterable"] + } +} +``` + +## When Not To Use It + +Note that this rule does not use type information to determine whether iterated elements are arrays. +It only checks if a `.length` property is used in a loop. +If your project loops over objects that happen to have `.length`, this rule may report false positives. +You might consider using [ESLint disable comments](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments-1) for those specific situations instead of completely disabling this rule. diff --git a/packages/eslint-plugin/docs/rules/prefer-optional-chain.mdx b/packages/eslint-plugin/docs/rules/prefer-optional-chain.mdx index 777c80068e69..e63c2d819939 100644 --- a/packages/eslint-plugin/docs/rules/prefer-optional-chain.mdx +++ b/packages/eslint-plugin/docs/rules/prefer-optional-chain.mdx @@ -35,12 +35,7 @@ foo && foo.a && foo.a.b && foo.a.b.method && foo.a.b.method(); !foo || !foo.bar || !foo.bar.baz || !foo.bar.baz(); // this rule also supports converting chained strict nullish checks: -foo && - foo.a != null && - foo.a.b !== null && - foo.a.b.c != undefined && - foo.a.b.c.d !== undefined && - foo.a.b.c.d.e; +foo.a !== null && foo.a !== undefined && foo.a.b; ``` @@ -56,6 +51,8 @@ foo?.a?.b?.c?.d?.e; !foo?.bar; !foo?.[bar]; !foo?.bar?.baz?.(); + +foo?.a != null; ``` diff --git a/packages/eslint-plugin/docs/rules/typedef.mdx b/packages/eslint-plugin/docs/rules/typedef.mdx index 8af5c045244a..827936d63329 100644 --- a/packages/eslint-plugin/docs/rules/typedef.mdx +++ b/packages/eslint-plugin/docs/rules/typedef.mdx @@ -9,6 +9,18 @@ import TabItem from '@theme/TabItem'; > > See **https://typescript-eslint.io/rules/typedef** for documentation. +:::caution + +This is an old, deprecated rule. +It will be removed in a future major version of typescript-eslint. + +Requiring type annotations unnecessarily can be cumbersome to maintain and generally reduces code readability. +TypeScript is often better at inferring types than easily written type annotations would allow. + +**Instead of enabling `typedef`, it is generally recommended to use the `--noImplicitAny` and `--strictPropertyInitialization` compiler options to enforce type annotations only when useful.** + +::: + TypeScript cannot always infer types for all places in code. Some locations require type annotations for their types to be inferred. @@ -30,15 +42,6 @@ class ContainsText { > To enforce type definitions existing on call signatures, use [`explicit-function-return-type`](./explicit-function-return-type.mdx), or [`explicit-module-boundary-types`](./explicit-module-boundary-types.mdx). -:::caution - -Requiring type annotations unnecessarily can be cumbersome to maintain and generally reduces code readability. -TypeScript is often better at inferring types than easily written type annotations would allow. - -**Instead of enabling `typedef`, it is generally recommended to use the `--noImplicitAny` and `--strictPropertyInitialization` compiler options to enforce type annotations only when useful.** - -::: - ## Options For example, with the following configuration: diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index c27d09067eab..14aab4ecfd9b 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -1,16 +1,15 @@ { "name": "@typescript-eslint/eslint-plugin", - "version": "8.32.1", + "version": "8.46.4", "description": "TypeScript plugin for ESLint", "files": [ "dist", "!*.tsbuildinfo", - "docs", "index.d.ts", "raw-plugin.d.ts", "rules.d.ts", "package.json", - "README.md", + "./README.md", "LICENSE" ], "type": "commonjs", @@ -49,22 +48,21 @@ "typescript" ], "scripts": { - "build": "tsc -b tsconfig.build.json", + "build": "yarn run -BT nx build", "clean": "rimraf dist/ coverage/", - "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", - "generate:breaking-changes": "tsx tools/generate-breaking-changes.mts", - "generate:configs": "npx nx generate-configs repo", - "lint": "npx nx lint", - "test": "vitest --run --config=$INIT_CWD/vitest.config.mts", - "test-single": "vitest --run --config=$INIT_CWD/vitest.config.mts --no-coverage", - "check-types": "npx nx typecheck" + "format": "yarn run -T format", + "generate-breaking-changes": "yarn run -BT nx generate-breaking-changes", + "generate-configs": "yarn run -BT nx generate-configs repo", + "lint": "yarn run -BT nx lint", + "test": "yarn run -BT nx test", + "typecheck": "yarn run -BT nx typecheck" }, "dependencies": { "@eslint-community/regexpp": "^4.10.0", - "@typescript-eslint/scope-manager": "8.32.1", - "@typescript-eslint/type-utils": "8.32.1", - "@typescript-eslint/utils": "8.32.1", - "@typescript-eslint/visitor-keys": "8.32.1", + "@typescript-eslint/scope-manager": "8.46.4", + "@typescript-eslint/type-utils": "8.46.4", + "@typescript-eslint/utils": "8.46.4", + "@typescript-eslint/visitor-keys": "8.46.4", "graphemer": "^1.4.0", "ignore": "^7.0.0", "natural-compare": "^1.4.0", @@ -73,8 +71,8 @@ "devDependencies": { "@types/mdast": "^4.0.3", "@types/natural-compare": "*", - "@typescript-eslint/rule-schema-to-typescript-types": "8.32.1", - "@typescript-eslint/rule-tester": "8.32.1", + "@typescript-eslint/rule-schema-to-typescript-types": "8.46.4", + "@typescript-eslint/rule-tester": "8.46.4", "@vitest/coverage-v8": "^3.1.3", "ajv": "^6.12.6", "cross-fetch": "*", @@ -85,7 +83,7 @@ "mdast-util-from-markdown": "^2.0.0", "mdast-util-mdx": "^3.0.0", "micromark-extension-mdxjs": "^3.0.0", - "prettier": "^3.2.5", + "prettier": "3.6.2", "rimraf": "*", "title-case": "^4.0.0", "tsx": "*", @@ -94,12 +92,32 @@ "vitest": "^3.1.3" }, "peerDependencies": { - "@typescript-eslint/parser": "^8.0.0 || ^8.0.0-alpha.0", + "@typescript-eslint/parser": "^8.46.4", "eslint": "^8.57.0 || ^9.0.0", - "typescript": ">=4.8.4 <5.9.0" + "typescript": ">=4.8.4 <6.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" + }, + "nx": { + "name": "eslint-plugin", + "includedScripts": [ + "clean" + ], + "targets": { + "generate-breaking-changes": { + "command": "tsx tools/generate-breaking-changes.mts", + "options": { + "cwd": "{projectRoot}" + }, + "dependsOn": [ + "type-utils:build" + ] + }, + "lint": { + "command": "eslint" + } + } } } diff --git a/packages/eslint-plugin/project.json b/packages/eslint-plugin/project.json deleted file mode 100644 index 3dbae67d7435..000000000000 --- a/packages/eslint-plugin/project.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "eslint-plugin", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "projectType": "library", - "root": "packages/eslint-plugin", - "sourceRoot": "packages/eslint-plugin/src", - "targets": { - "lint": { - "executor": "@nx/eslint:lint" - }, - "test-single": { - "executor": "@nx/vite:test", - "cache": false, - "options": { - "coverage": false - } - }, - "test": { - "executor": "@nx/vite:test" - }, - "generate-breaking-changes": { - "executor": "nx:run-script", - "options": { - "script": "generate:breaking-changes" - } - } - } -} diff --git a/packages/eslint-plugin/src/configs/eslintrc/all.ts b/packages/eslint-plugin/src/configs/eslintrc/all.ts index 3d25e79e33db..34f7fd540450 100644 --- a/packages/eslint-plugin/src/configs/eslintrc/all.ts +++ b/packages/eslint-plugin/src/configs/eslintrc/all.ts @@ -3,7 +3,7 @@ // SEE https://typescript-eslint.io/users/configs // // For developers working in the typescript-eslint monorepo: -// You can regenerate it using `yarn generate:configs` +// You can regenerate it using `yarn generate-configs` import type { ClassicConfig } from '@typescript-eslint/utils/ts-eslint'; @@ -156,7 +156,6 @@ export = { '@typescript-eslint/strict-boolean-expressions': 'error', '@typescript-eslint/switch-exhaustiveness-check': 'error', '@typescript-eslint/triple-slash-reference': 'error', - '@typescript-eslint/typedef': 'error', '@typescript-eslint/unbound-method': 'error', '@typescript-eslint/unified-signatures': 'error', '@typescript-eslint/use-unknown-in-catch-callback-variable': 'error', diff --git a/packages/eslint-plugin/src/configs/eslintrc/disable-type-checked.ts b/packages/eslint-plugin/src/configs/eslintrc/disable-type-checked.ts index 9dd6c95c929e..6853a151722d 100644 --- a/packages/eslint-plugin/src/configs/eslintrc/disable-type-checked.ts +++ b/packages/eslint-plugin/src/configs/eslintrc/disable-type-checked.ts @@ -3,7 +3,7 @@ // SEE https://typescript-eslint.io/users/configs // // For developers working in the typescript-eslint monorepo: -// You can regenerate it using `yarn generate:configs` +// You can regenerate it using `yarn generate-configs` import type { ClassicConfig } from '@typescript-eslint/utils/ts-eslint'; diff --git a/packages/eslint-plugin/src/configs/eslintrc/recommended-type-checked-only.ts b/packages/eslint-plugin/src/configs/eslintrc/recommended-type-checked-only.ts index 0936657b5d23..ba352ceb281b 100644 --- a/packages/eslint-plugin/src/configs/eslintrc/recommended-type-checked-only.ts +++ b/packages/eslint-plugin/src/configs/eslintrc/recommended-type-checked-only.ts @@ -3,7 +3,7 @@ // SEE https://typescript-eslint.io/users/configs // // For developers working in the typescript-eslint monorepo: -// You can regenerate it using `yarn generate:configs` +// You can regenerate it using `yarn generate-configs` import type { ClassicConfig } from '@typescript-eslint/utils/ts-eslint'; diff --git a/packages/eslint-plugin/src/configs/eslintrc/recommended-type-checked.ts b/packages/eslint-plugin/src/configs/eslintrc/recommended-type-checked.ts index 73eda5db7b43..bae9c46a5c3f 100644 --- a/packages/eslint-plugin/src/configs/eslintrc/recommended-type-checked.ts +++ b/packages/eslint-plugin/src/configs/eslintrc/recommended-type-checked.ts @@ -3,7 +3,7 @@ // SEE https://typescript-eslint.io/users/configs // // For developers working in the typescript-eslint monorepo: -// You can regenerate it using `yarn generate:configs` +// You can regenerate it using `yarn generate-configs` import type { ClassicConfig } from '@typescript-eslint/utils/ts-eslint'; diff --git a/packages/eslint-plugin/src/configs/eslintrc/recommended.ts b/packages/eslint-plugin/src/configs/eslintrc/recommended.ts index c5476c5ec6e0..8b3f99dbfd59 100644 --- a/packages/eslint-plugin/src/configs/eslintrc/recommended.ts +++ b/packages/eslint-plugin/src/configs/eslintrc/recommended.ts @@ -3,7 +3,7 @@ // SEE https://typescript-eslint.io/users/configs // // For developers working in the typescript-eslint monorepo: -// You can regenerate it using `yarn generate:configs` +// You can regenerate it using `yarn generate-configs` import type { ClassicConfig } from '@typescript-eslint/utils/ts-eslint'; diff --git a/packages/eslint-plugin/src/configs/eslintrc/strict-type-checked-only.ts b/packages/eslint-plugin/src/configs/eslintrc/strict-type-checked-only.ts index 00e4ca12f8a4..a2b5b457d01e 100644 --- a/packages/eslint-plugin/src/configs/eslintrc/strict-type-checked-only.ts +++ b/packages/eslint-plugin/src/configs/eslintrc/strict-type-checked-only.ts @@ -3,7 +3,7 @@ // SEE https://typescript-eslint.io/users/configs // // For developers working in the typescript-eslint monorepo: -// You can regenerate it using `yarn generate:configs` +// You can regenerate it using `yarn generate-configs` import type { ClassicConfig } from '@typescript-eslint/utils/ts-eslint'; @@ -30,6 +30,7 @@ export = { '@typescript-eslint/no-unnecessary-template-expression': 'error', '@typescript-eslint/no-unnecessary-type-arguments': 'error', '@typescript-eslint/no-unnecessary-type-assertion': 'error', + '@typescript-eslint/no-unnecessary-type-conversion': 'error', '@typescript-eslint/no-unnecessary-type-parameters': 'error', '@typescript-eslint/no-unsafe-argument': 'error', '@typescript-eslint/no-unsafe-assignment': 'error', diff --git a/packages/eslint-plugin/src/configs/eslintrc/strict-type-checked.ts b/packages/eslint-plugin/src/configs/eslintrc/strict-type-checked.ts index 43d1df44b53b..ec1523d8b48e 100644 --- a/packages/eslint-plugin/src/configs/eslintrc/strict-type-checked.ts +++ b/packages/eslint-plugin/src/configs/eslintrc/strict-type-checked.ts @@ -3,7 +3,7 @@ // SEE https://typescript-eslint.io/users/configs // // For developers working in the typescript-eslint monorepo: -// You can regenerate it using `yarn generate:configs` +// You can regenerate it using `yarn generate-configs` import type { ClassicConfig } from '@typescript-eslint/utils/ts-eslint'; @@ -51,6 +51,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-unnecessary-type-conversion': 'error', '@typescript-eslint/no-unnecessary-type-parameters': 'error', '@typescript-eslint/no-unsafe-argument': 'error', '@typescript-eslint/no-unsafe-assignment': 'error', diff --git a/packages/eslint-plugin/src/configs/eslintrc/strict.ts b/packages/eslint-plugin/src/configs/eslintrc/strict.ts index 1677fdabffb6..9e081af8a85e 100644 --- a/packages/eslint-plugin/src/configs/eslintrc/strict.ts +++ b/packages/eslint-plugin/src/configs/eslintrc/strict.ts @@ -3,7 +3,7 @@ // SEE https://typescript-eslint.io/users/configs // // For developers working in the typescript-eslint monorepo: -// You can regenerate it using `yarn generate:configs` +// You can regenerate it using `yarn generate-configs` import type { ClassicConfig } from '@typescript-eslint/utils/ts-eslint'; diff --git a/packages/eslint-plugin/src/configs/eslintrc/stylistic-type-checked-only.ts b/packages/eslint-plugin/src/configs/eslintrc/stylistic-type-checked-only.ts index d3cbbfc3ea9a..eb4765a87b3a 100644 --- a/packages/eslint-plugin/src/configs/eslintrc/stylistic-type-checked-only.ts +++ b/packages/eslint-plugin/src/configs/eslintrc/stylistic-type-checked-only.ts @@ -3,7 +3,7 @@ // SEE https://typescript-eslint.io/users/configs // // For developers working in the typescript-eslint monorepo: -// You can regenerate it using `yarn generate:configs` +// You can regenerate it using `yarn generate-configs` import type { ClassicConfig } from '@typescript-eslint/utils/ts-eslint'; diff --git a/packages/eslint-plugin/src/configs/eslintrc/stylistic-type-checked.ts b/packages/eslint-plugin/src/configs/eslintrc/stylistic-type-checked.ts index b77f94794f2f..7a6759d8032d 100644 --- a/packages/eslint-plugin/src/configs/eslintrc/stylistic-type-checked.ts +++ b/packages/eslint-plugin/src/configs/eslintrc/stylistic-type-checked.ts @@ -3,7 +3,7 @@ // SEE https://typescript-eslint.io/users/configs // // For developers working in the typescript-eslint monorepo: -// You can regenerate it using `yarn generate:configs` +// You can regenerate it using `yarn generate-configs` import type { ClassicConfig } from '@typescript-eslint/utils/ts-eslint'; diff --git a/packages/eslint-plugin/src/configs/eslintrc/stylistic.ts b/packages/eslint-plugin/src/configs/eslintrc/stylistic.ts index fe4a00ffe7c1..e81313ee0185 100644 --- a/packages/eslint-plugin/src/configs/eslintrc/stylistic.ts +++ b/packages/eslint-plugin/src/configs/eslintrc/stylistic.ts @@ -3,7 +3,7 @@ // SEE https://typescript-eslint.io/users/configs // // For developers working in the typescript-eslint monorepo: -// You can regenerate it using `yarn generate:configs` +// You can regenerate it using `yarn generate-configs` import type { ClassicConfig } from '@typescript-eslint/utils/ts-eslint'; diff --git a/packages/eslint-plugin/src/configs/flat/all.ts b/packages/eslint-plugin/src/configs/flat/all.ts index dc40d391e4fd..777028d8580c 100644 --- a/packages/eslint-plugin/src/configs/flat/all.ts +++ b/packages/eslint-plugin/src/configs/flat/all.ts @@ -3,7 +3,7 @@ // SEE https://typescript-eslint.io/users/configs // // For developers working in the typescript-eslint monorepo: -// You can regenerate it using `yarn generate:configs` +// You can regenerate it using `yarn generate-configs` import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint'; @@ -170,7 +170,6 @@ export default ( '@typescript-eslint/strict-boolean-expressions': 'error', '@typescript-eslint/switch-exhaustiveness-check': 'error', '@typescript-eslint/triple-slash-reference': 'error', - '@typescript-eslint/typedef': 'error', '@typescript-eslint/unbound-method': 'error', '@typescript-eslint/unified-signatures': 'error', '@typescript-eslint/use-unknown-in-catch-callback-variable': 'error', diff --git a/packages/eslint-plugin/src/configs/flat/disable-type-checked.ts b/packages/eslint-plugin/src/configs/flat/disable-type-checked.ts index 15c5bb0e3dcf..5a48e1722775 100644 --- a/packages/eslint-plugin/src/configs/flat/disable-type-checked.ts +++ b/packages/eslint-plugin/src/configs/flat/disable-type-checked.ts @@ -3,7 +3,7 @@ // SEE https://typescript-eslint.io/users/configs // // For developers working in the typescript-eslint monorepo: -// You can regenerate it using `yarn generate:configs` +// You can regenerate it using `yarn generate-configs` import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint'; diff --git a/packages/eslint-plugin/src/configs/flat/recommended-type-checked-only.ts b/packages/eslint-plugin/src/configs/flat/recommended-type-checked-only.ts index 0e417f24e0a5..fc985169efc6 100644 --- a/packages/eslint-plugin/src/configs/flat/recommended-type-checked-only.ts +++ b/packages/eslint-plugin/src/configs/flat/recommended-type-checked-only.ts @@ -3,7 +3,7 @@ // SEE https://typescript-eslint.io/users/configs // // For developers working in the typescript-eslint monorepo: -// You can regenerate it using `yarn generate:configs` +// You can regenerate it using `yarn generate-configs` import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint'; diff --git a/packages/eslint-plugin/src/configs/flat/recommended-type-checked.ts b/packages/eslint-plugin/src/configs/flat/recommended-type-checked.ts index bb46e4cb4238..c92de2abf739 100644 --- a/packages/eslint-plugin/src/configs/flat/recommended-type-checked.ts +++ b/packages/eslint-plugin/src/configs/flat/recommended-type-checked.ts @@ -3,7 +3,7 @@ // SEE https://typescript-eslint.io/users/configs // // For developers working in the typescript-eslint monorepo: -// You can regenerate it using `yarn generate:configs` +// You can regenerate it using `yarn generate-configs` import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint'; diff --git a/packages/eslint-plugin/src/configs/flat/recommended.ts b/packages/eslint-plugin/src/configs/flat/recommended.ts index f94d6606637d..51f845362835 100644 --- a/packages/eslint-plugin/src/configs/flat/recommended.ts +++ b/packages/eslint-plugin/src/configs/flat/recommended.ts @@ -3,7 +3,7 @@ // SEE https://typescript-eslint.io/users/configs // // For developers working in the typescript-eslint monorepo: -// You can regenerate it using `yarn generate:configs` +// You can regenerate it using `yarn generate-configs` import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint'; diff --git a/packages/eslint-plugin/src/configs/flat/strict-type-checked-only.ts b/packages/eslint-plugin/src/configs/flat/strict-type-checked-only.ts index 4d424ec0968f..043f1aad0cd5 100644 --- a/packages/eslint-plugin/src/configs/flat/strict-type-checked-only.ts +++ b/packages/eslint-plugin/src/configs/flat/strict-type-checked-only.ts @@ -3,7 +3,7 @@ // SEE https://typescript-eslint.io/users/configs // // For developers working in the typescript-eslint monorepo: -// You can regenerate it using `yarn generate:configs` +// You can regenerate it using `yarn generate-configs` import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint'; @@ -43,6 +43,7 @@ export default ( '@typescript-eslint/no-unnecessary-template-expression': 'error', '@typescript-eslint/no-unnecessary-type-arguments': 'error', '@typescript-eslint/no-unnecessary-type-assertion': 'error', + '@typescript-eslint/no-unnecessary-type-conversion': 'error', '@typescript-eslint/no-unnecessary-type-parameters': 'error', '@typescript-eslint/no-unsafe-argument': 'error', '@typescript-eslint/no-unsafe-assignment': 'error', diff --git a/packages/eslint-plugin/src/configs/flat/strict-type-checked.ts b/packages/eslint-plugin/src/configs/flat/strict-type-checked.ts index 8753687ce006..b3c0a2391178 100644 --- a/packages/eslint-plugin/src/configs/flat/strict-type-checked.ts +++ b/packages/eslint-plugin/src/configs/flat/strict-type-checked.ts @@ -3,7 +3,7 @@ // SEE https://typescript-eslint.io/users/configs // // For developers working in the typescript-eslint monorepo: -// You can regenerate it using `yarn generate:configs` +// You can regenerate it using `yarn generate-configs` import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint'; @@ -64,6 +64,7 @@ export default ( '@typescript-eslint/no-unnecessary-type-arguments': 'error', '@typescript-eslint/no-unnecessary-type-assertion': 'error', '@typescript-eslint/no-unnecessary-type-constraint': 'error', + '@typescript-eslint/no-unnecessary-type-conversion': 'error', '@typescript-eslint/no-unnecessary-type-parameters': 'error', '@typescript-eslint/no-unsafe-argument': 'error', '@typescript-eslint/no-unsafe-assignment': 'error', diff --git a/packages/eslint-plugin/src/configs/flat/strict.ts b/packages/eslint-plugin/src/configs/flat/strict.ts index 0afa85b9f088..0d942ad5b86b 100644 --- a/packages/eslint-plugin/src/configs/flat/strict.ts +++ b/packages/eslint-plugin/src/configs/flat/strict.ts @@ -3,7 +3,7 @@ // SEE https://typescript-eslint.io/users/configs // // For developers working in the typescript-eslint monorepo: -// You can regenerate it using `yarn generate:configs` +// You can regenerate it using `yarn generate-configs` import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint'; diff --git a/packages/eslint-plugin/src/configs/flat/stylistic-type-checked-only.ts b/packages/eslint-plugin/src/configs/flat/stylistic-type-checked-only.ts index 2c132123f0ba..cc8a23f738ea 100644 --- a/packages/eslint-plugin/src/configs/flat/stylistic-type-checked-only.ts +++ b/packages/eslint-plugin/src/configs/flat/stylistic-type-checked-only.ts @@ -3,7 +3,7 @@ // SEE https://typescript-eslint.io/users/configs // // For developers working in the typescript-eslint monorepo: -// You can regenerate it using `yarn generate:configs` +// You can regenerate it using `yarn generate-configs` import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint'; diff --git a/packages/eslint-plugin/src/configs/flat/stylistic-type-checked.ts b/packages/eslint-plugin/src/configs/flat/stylistic-type-checked.ts index 22113f880802..c3b76192bb57 100644 --- a/packages/eslint-plugin/src/configs/flat/stylistic-type-checked.ts +++ b/packages/eslint-plugin/src/configs/flat/stylistic-type-checked.ts @@ -3,7 +3,7 @@ // SEE https://typescript-eslint.io/users/configs // // For developers working in the typescript-eslint monorepo: -// You can regenerate it using `yarn generate:configs` +// You can regenerate it using `yarn generate-configs` import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint'; diff --git a/packages/eslint-plugin/src/configs/flat/stylistic.ts b/packages/eslint-plugin/src/configs/flat/stylistic.ts index 26771ce80895..b336aeebcfe8 100644 --- a/packages/eslint-plugin/src/configs/flat/stylistic.ts +++ b/packages/eslint-plugin/src/configs/flat/stylistic.ts @@ -3,7 +3,7 @@ // SEE https://typescript-eslint.io/users/configs // // For developers working in the typescript-eslint monorepo: -// You can regenerate it using `yarn generate:configs` +// You can regenerate it using `yarn generate-configs` import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint'; diff --git a/packages/eslint-plugin/src/rules/array-type.ts b/packages/eslint-plugin/src/rules/array-type.ts index 2375138d17fc..f53b61ce5bbe 100644 --- a/packages/eslint-plugin/src/rules/array-type.ts +++ b/packages/eslint-plugin/src/rules/array-type.ts @@ -242,7 +242,7 @@ export default createRule({ ? 'errorStringArraySimpleReadonly' : 'errorStringArraySimple'; - if (!typeParams || typeParams.length === 0) { + if (!typeParams) { // Create an 'any' array context.report({ node, diff --git a/packages/eslint-plugin/src/rules/await-thenable.ts b/packages/eslint-plugin/src/rules/await-thenable.ts index 2ba4efbd0b06..70c87cc5d918 100644 --- a/packages/eslint-plugin/src/rules/await-thenable.ts +++ b/packages/eslint-plugin/src/rules/await-thenable.ts @@ -1,10 +1,13 @@ -import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; +import type { TSESLint } from '@typescript-eslint/utils'; +import type * as ts from 'typescript'; +import { TSESTree } from '@typescript-eslint/utils'; import * as tsutils from 'ts-api-utils'; import { Awaitable, createRule, + getConstrainedTypeAtLocation, getFixOrSuggest, getParserServices, isAwaitKeyword, @@ -14,12 +17,14 @@ import { NullThrowsReasons, } from '../util'; import { getForStatementHeadLoc } from '../util/getForStatementHeadLoc'; +import { isPromiseAggregatorMethod } from '../util/isPromiseAggregatorMethod'; export type MessageId = | 'await' | 'awaitUsingOfNonAsyncDisposable' | 'convertToOrdinaryFor' | 'forAwaitOfNonAsyncIterable' + | 'invalidPromiseAggregatorInput' | 'removeAwait'; export default createRule<[], MessageId>({ @@ -39,6 +44,8 @@ export default createRule<[], MessageId>({ convertToOrdinaryFor: 'Convert to an ordinary `for...of` loop.', forAwaitOfNonAsyncIterable: 'Unexpected `for await...of` of a value that is not async iterable.', + invalidPromiseAggregatorInput: + 'Unexpected iterable of non-Promise (non-"Thenable") values passed to promise aggregator.', removeAwait: 'Remove unnecessary `await`.', }, schema: [], @@ -84,6 +91,53 @@ export default createRule<[], MessageId>({ } }, + CallExpression(node: TSESTree.CallExpression): void { + if (!isPromiseAggregatorMethod(context, services, node)) { + return; + } + + const argument = node.arguments.at(0); + + if (argument == null) { + return; + } + + if (argument.type === TSESTree.AST_NODE_TYPES.ArrayExpression) { + for (const element of argument.elements) { + if (element == null) { + continue; + } + + const type = getConstrainedTypeAtLocation(services, element); + const tsNode = services.esTreeNodeToTSNodeMap.get(element); + + if (isAlwaysNonAwaitableType(type, tsNode, checker)) { + context.report({ + node: element, + messageId: 'invalidPromiseAggregatorInput', + }); + } + } + + return; + } + + const type = getConstrainedTypeAtLocation(services, argument); + + if ( + isInvalidPromiseAggregatorInput( + checker, + services.esTreeNodeToTSNodeMap.get(argument), + type, + ) + ) { + context.report({ + node: argument, + messageId: 'invalidPromiseAggregatorInput', + }); + } + }, + 'ForOfStatement[await=true]'(node: TSESTree.ForOfStatement): void { const type = services.getTypeAtLocation(node.right); if (isTypeAnyType(type)) { @@ -176,3 +230,88 @@ export default createRule<[], MessageId>({ }; }, }); + +function isInvalidPromiseAggregatorInput( + checker: ts.TypeChecker, + node: ts.Node, + type: ts.Type, +): boolean { + // non array/tuple/iterable types already show up as a type error + if (!isIterable(type, checker)) { + return false; + } + + for (const part of tsutils.unionConstituents(type)) { + const valueTypes = getValueTypesOfArrayLike(part, checker); + + if (valueTypes != null) { + for (const typeArgument of valueTypes) { + if (containsNonAwaitableType(typeArgument, node, checker)) { + return true; + } + } + } + } + + return false; +} + +function getValueTypesOfArrayLike( + type: ts.Type, + checker: ts.TypeChecker, +): readonly ts.Type[] | null { + if (checker.isTupleType(type)) { + return checker.getTypeArguments(type); + } + + if (checker.isArrayLikeType(type)) { + return [ + nullThrows( + type.getNumberIndexType(), + 'number index type should exist on an array-like', + ), + ]; + } + + // `Iterable<...>` + if (tsutils.isTypeReference(type)) { + return checker.getTypeArguments(type).slice(0, 1); + } + + return null; +} + +function isAlwaysNonAwaitableType( + type: ts.Type, + node: ts.Node, + checker: ts.TypeChecker, +): boolean { + return tsutils + .unionConstituents(type) + .every( + typeArgumentPart => + needsToBeAwaited(checker, node, typeArgumentPart) === Awaitable.Never, + ); +} + +function containsNonAwaitableType( + type: ts.Type, + node: ts.Node, + checker: ts.TypeChecker, +): boolean { + return tsutils + .unionConstituents(type) + .some( + typeArgumentPart => + needsToBeAwaited(checker, node, typeArgumentPart) === Awaitable.Never, + ); +} + +function isIterable(type: ts.Type, checker: ts.TypeChecker): boolean { + return tsutils + .unionConstituents(type) + .every( + part => + !!tsutils.getWellKnownSymbolPropertyOfType(part, 'iterator', checker), + ); +} diff --git a/packages/eslint-plugin/src/rules/ban-ts-comment.ts b/packages/eslint-plugin/src/rules/ban-ts-comment.ts index d041e34266af..7cd707ed742b 100644 --- a/packages/eslint-plugin/src/rules/ban-ts-comment.ts +++ b/packages/eslint-plugin/src/rules/ban-ts-comment.ts @@ -86,14 +86,29 @@ export default createRule({ properties: { minimumDescriptionLength: { type: 'number', - default: defaultMinimumDescriptionLength, description: 'A minimum character length for descriptions when `allow-with-description` is enabled.', }, - 'ts-check': { $ref: '#/items/0/$defs/directiveConfigSchema' }, - 'ts-expect-error': { $ref: '#/items/0/$defs/directiveConfigSchema' }, - 'ts-ignore': { $ref: '#/items/0/$defs/directiveConfigSchema' }, - 'ts-nocheck': { $ref: '#/items/0/$defs/directiveConfigSchema' }, + 'ts-check': { + $ref: '#/items/0/$defs/directiveConfigSchema', + description: + 'Whether allow ts-check directives, and with which restrictions.', + }, + 'ts-expect-error': { + $ref: '#/items/0/$defs/directiveConfigSchema', + description: + 'Whether and when expect-error directives, and with which restrictions.', + }, + 'ts-ignore': { + $ref: '#/items/0/$defs/directiveConfigSchema', + description: + 'Whether allow ts-ignore directives, and with which restrictions.', + }, + 'ts-nocheck': { + $ref: '#/items/0/$defs/directiveConfigSchema', + description: + 'Whether allow ts-nocheck directives, and with which restrictions.', + }, }, }, ], diff --git a/packages/eslint-plugin/src/rules/class-methods-use-this.ts b/packages/eslint-plugin/src/rules/class-methods-use-this.ts index 773a658ef133..f0757f628af1 100644 --- a/packages/eslint-plugin/src/rules/class-methods-use-this.ts +++ b/packages/eslint-plugin/src/rules/class-methods-use-this.ts @@ -38,7 +38,6 @@ export default createRule({ properties: { enforceForClassFields: { type: 'boolean', - default: true, description: 'Enforces that functions used as instance field initializers utilize `this`.', }, diff --git a/packages/eslint-plugin/src/rules/consistent-generic-constructors.ts b/packages/eslint-plugin/src/rules/consistent-generic-constructors.ts index f2a4808d25dd..a26f1422460e 100644 --- a/packages/eslint-plugin/src/rules/consistent-generic-constructors.ts +++ b/packages/eslint-plugin/src/rules/consistent-generic-constructors.ts @@ -123,7 +123,8 @@ export default createRule({ return; } - if (lhs?.typeArguments && !rhs.typeArguments) { + const isolatedDeclarations = context.parserOptions.isolatedDeclarations; + if (!isolatedDeclarations && lhs?.typeArguments && !rhs.typeArguments) { const hasParens = context.sourceCode.getTokenAfter(rhs.callee)?.value === '('; const extraComments = new Set( diff --git a/packages/eslint-plugin/src/rules/consistent-type-exports.ts b/packages/eslint-plugin/src/rules/consistent-type-exports.ts index 324a622255d7..f70d59618514 100644 --- a/packages/eslint-plugin/src/rules/consistent-type-exports.ts +++ b/packages/eslint-plugin/src/rules/consistent-type-exports.ts @@ -1,7 +1,6 @@ import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES, AST_TOKEN_TYPES } from '@typescript-eslint/utils'; -import * as tsutils from 'ts-api-utils'; import * as ts from 'typescript'; import { @@ -91,22 +90,18 @@ export default createRule({ function isSymbolTypeBased( symbol: ts.Symbol | undefined, ): boolean | undefined { - if (!symbol) { - return undefined; + while (symbol && symbol.flags & ts.SymbolFlags.Alias) { + symbol = checker.getAliasedSymbol(symbol); + if ( + symbol.getDeclarations()?.find(ts.isTypeOnlyImportOrExportDeclaration) + ) { + return true; + } } - - const aliasedSymbol = tsutils.isSymbolFlagSet( - symbol, - ts.SymbolFlags.Alias, - ) - ? checker.getAliasedSymbol(symbol) - : symbol; - - if (checker.isUnknownSymbol(aliasedSymbol)) { + if (!symbol || checker.isUnknownSymbol(symbol)) { return undefined; } - - return !(aliasedSymbol.flags & ts.SymbolFlags.Value); + return !(symbol.flags & ts.SymbolFlags.Value); } return { diff --git a/packages/eslint-plugin/src/rules/default-param-last.ts b/packages/eslint-plugin/src/rules/default-param-last.ts index 1d120720d26c..edfa85842df8 100644 --- a/packages/eslint-plugin/src/rules/default-param-last.ts +++ b/packages/eslint-plugin/src/rules/default-param-last.ts @@ -11,6 +11,7 @@ export default createRule({ docs: { description: 'Enforce default parameters to be last', extendsBaseRule: true, + frozen: true, }, messages: { shouldBeLast: 'Default parameters should be last.', diff --git a/packages/eslint-plugin/src/rules/dot-notation.ts b/packages/eslint-plugin/src/rules/dot-notation.ts index 69d53170c70e..98caa79f7328 100644 --- a/packages/eslint-plugin/src/rules/dot-notation.ts +++ b/packages/eslint-plugin/src/rules/dot-notation.ts @@ -35,6 +35,7 @@ export default createRule({ docs: { description: 'Enforce dot notation whenever possible', extendsBaseRule: true, + frozen: true, recommended: 'stylistic', requiresTypeChecking: true, }, @@ -48,29 +49,24 @@ export default createRule({ properties: { allowIndexSignaturePropertyAccess: { type: 'boolean', - default: false, description: 'Whether to allow accessing properties matching an index signature with array notation.', }, allowKeywords: { type: 'boolean', - default: true, description: 'Whether to allow keywords such as ["class"]`.', }, allowPattern: { type: 'string', - default: '', description: 'Regular expression of names to allow.', }, allowPrivateClassPropertyAccess: { type: 'boolean', - default: false, description: 'Whether to allow accessing class members marked as `private` with array notation.', }, allowProtectedClassPropertyAccess: { type: 'boolean', - default: false, description: 'Whether to allow accessing class members marked as `protected` with array notation.', }, diff --git a/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts b/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts index a7c8b991ed53..d1b6f8ea3422 100644 --- a/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts +++ b/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts @@ -100,13 +100,31 @@ export default createRule({ description: 'Changes to required accessibility modifiers for specific kinds of class members.', properties: { - accessors: { $ref: '#/items/0/$defs/accessibilityLevel' }, - constructors: { $ref: '#/items/0/$defs/accessibilityLevel' }, - methods: { $ref: '#/items/0/$defs/accessibilityLevel' }, + accessors: { + $ref: '#/items/0/$defs/accessibilityLevel', + description: + 'Which member accessibility modifier requirements to apply for accessors.', + }, + constructors: { + $ref: '#/items/0/$defs/accessibilityLevel', + description: + 'Which member accessibility modifier requirements to apply for constructors.', + }, + methods: { + $ref: '#/items/0/$defs/accessibilityLevel', + description: + 'Which member accessibility modifier requirements to apply for methods.', + }, parameterProperties: { $ref: '#/items/0/$defs/accessibilityLevel', + description: + 'Which member accessibility modifier requirements to apply for parameterProperties.', + }, + properties: { + $ref: '#/items/0/$defs/accessibilityLevel', + description: + 'Which member accessibility modifier requirements to apply for properties.', }, - properties: { $ref: '#/items/0/$defs/accessibilityLevel' }, }, }, }, @@ -214,14 +232,14 @@ export default createRule({ token.value === 'public' ) { keywordRange = structuredClone(token.range); - const commensAfterPublicKeyword = + const commentsAfterPublicKeyword = context.sourceCode.getCommentsAfter(token); - if (commensAfterPublicKeyword.length) { + if (commentsAfterPublicKeyword.length) { // public /* Hi there! */ static foo() // ^^^^^^^ rangeToRemove = [ token.range[0], - commensAfterPublicKeyword[0].range[0], + commentsAfterPublicKeyword[0].range[0], ]; break; } else { diff --git a/packages/eslint-plugin/src/rules/init-declarations.ts b/packages/eslint-plugin/src/rules/init-declarations.ts index 16b3f87e713c..fafc9a404f12 100644 --- a/packages/eslint-plugin/src/rules/init-declarations.ts +++ b/packages/eslint-plugin/src/rules/init-declarations.ts @@ -24,6 +24,7 @@ export default createRule({ description: 'Require or disallow initialization in variable declarations', extendsBaseRule: true, + frozen: true, }, hasSuggestions: baseRule.meta.hasSuggestions, messages: baseRule.meta.messages, diff --git a/packages/eslint-plugin/src/rules/member-ordering.ts b/packages/eslint-plugin/src/rules/member-ordering.ts index 7ae9ec7627cf..e0d1d387baed 100644 --- a/packages/eslint-plugin/src/rules/member-ordering.ts +++ b/packages/eslint-plugin/src/rules/member-ordering.ts @@ -728,6 +728,7 @@ export default createRule({ type: 'suggestion', docs: { description: 'Require a consistent member declaration order', + frozen: true, }, messages: { incorrectGroupOrder: @@ -789,18 +790,23 @@ export default createRule({ properties: { classes: { $ref: '#/items/0/$defs/baseConfig', + description: 'Which ordering to enforce for classes.', }, classExpressions: { $ref: '#/items/0/$defs/baseConfig', + description: 'Which ordering to enforce for classExpressions.', }, default: { $ref: '#/items/0/$defs/baseConfig', + description: 'Which ordering to enforce for default.', }, interfaces: { $ref: '#/items/0/$defs/typesConfig', + description: 'Which ordering to enforce for interfaces.', }, typeLiterals: { $ref: '#/items/0/$defs/typesConfig', + description: 'Which ordering to enforce for typeLiterals.', }, }, }, diff --git a/packages/eslint-plugin/src/rules/method-signature-style.ts b/packages/eslint-plugin/src/rules/method-signature-style.ts index 1d7826402d3f..c4e76b0593a4 100644 --- a/packages/eslint-plugin/src/rules/method-signature-style.ts +++ b/packages/eslint-plugin/src/rules/method-signature-style.ts @@ -31,6 +31,7 @@ export default createRule({ schema: [ { type: 'string', + description: 'The method signature style to enforce using.', enum: ['property', 'method'], }, ], 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 83bf51a0ecfb..669f44e12f86 100644 --- a/packages/eslint-plugin/src/rules/naming-convention-utils/validator.ts +++ b/packages/eslint-plugin/src/rules/naming-convention-utils/validator.ts @@ -4,7 +4,7 @@ import type * as ts from 'typescript'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import type { SelectorsString } from './enums'; -import type { Context, NormalizedSelector } from './types'; +import type { Context, NormalizedSelector, ValidatorFunction } from './types'; import { getParserServices } from '../../util'; import { @@ -26,9 +26,7 @@ export function createValidator( type: SelectorsString, context: Context, allConfigs: NormalizedSelector[], -): ( - node: TSESTree.Identifier | TSESTree.Literal | TSESTree.PrivateIdentifier, -) => void { +): ValidatorFunction { // make sure the "highest priority" configs are checked first const selectorType = Selectors[type]; const configs = allConfigs @@ -72,10 +70,7 @@ export function createValidator( return b.selector - a.selector; }); - return ( - node: TSESTree.Identifier | TSESTree.Literal | TSESTree.PrivateIdentifier, - modifiers: Set = new Set(), - ): void => { + return (node, modifiers = new Set()): void => { const originalName = node.type === AST_NODE_TYPES.Identifier || node.type === AST_NODE_TYPES.PrivateIdentifier diff --git a/packages/eslint-plugin/src/rules/naming-convention.ts b/packages/eslint-plugin/src/rules/naming-convention.ts index 03500d825163..17ba46233b45 100644 --- a/packages/eslint-plugin/src/rules/naming-convention.ts +++ b/packages/eslint-plugin/src/rules/naming-convention.ts @@ -70,6 +70,7 @@ export default createRule({ description: 'Enforce naming conventions for everything across a codebase', // technically only requires type checking if the user uses "type" modifiers + frozen: true, requiresTypeChecking: true, }, messages: { @@ -631,11 +632,8 @@ export default createRule({ // #region interface - 'TSEnumMember[computed != true]': { - handler: ( - node: TSESTree.TSEnumMemberNonComputedName, - validator, - ): void => { + TSEnumMember: { + handler: (node: TSESTree.TSEnumMember, validator): void => { const id = node.id; const modifiers = new Set(); 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 6617c8d1dea2..48fca65676ed 100644 --- a/packages/eslint-plugin/src/rules/no-base-to-string.ts +++ b/packages/eslint-plugin/src/rules/no-base-to-string.ts @@ -21,9 +21,17 @@ enum Usefulness { export type Options = [ { ignoredTypeNames?: string[]; + checkUnknown?: boolean; }, ]; export type MessageIds = 'baseArrayJoin' | 'baseToString'; +const canHaveTypeParameters = (declaration: ts.Declaration) => { + return ( + ts.isTypeAliasDeclaration(declaration) || + ts.isInterfaceDeclaration(declaration) || + ts.isClassDeclaration(declaration) + ); +}; export default createRule({ name: 'no-base-to-string', @@ -46,10 +54,13 @@ export default createRule({ type: 'object', additionalProperties: false, properties: { + checkUnknown: { + type: 'boolean', + description: 'Whether to also check values of type `unknown`', + }, ignoredTypeNames: { type: 'array', - description: - 'Stringified regular expressions of type names to ignore.', + description: 'Stringified type names to ignore.', items: { type: 'string', }, @@ -60,6 +71,7 @@ export default createRule({ }, defaultOptions: [ { + checkUnknown: false, ignoredTypeNames: ['Error', 'RegExp', 'URL', 'URLSearchParams'], }, ], @@ -76,6 +88,7 @@ export default createRule({ type ?? services.getTypeAtLocation(node), new Set(), ); + if (certainty === Usefulness.Always) { return; } @@ -198,6 +211,36 @@ export default createRule({ return Usefulness.Always; } + function hasBaseTypes(type: ts.Type): type is ts.InterfaceType { + return ( + tsutils.isObjectType(type) && + tsutils.isObjectFlagSet( + type, + ts.ObjectFlags.Interface | ts.ObjectFlags.Class, + ) + ); + } + + function isIgnoredTypeOrBase( + type: ts.Type, + seen = new Set(), + ): boolean { + if (seen.has(type)) { + return false; + } + + seen.add(type); + + const typeName = getTypeName(checker, type); + return ( + ignoredTypeNames.includes(typeName) || + (hasBaseTypes(type) && + checker + .getBaseTypes(type) + .some(base => isIgnoredTypeOrBase(base, seen))) + ); + } + function collectToStringCertainty( type: ts.Type, visited: Set, @@ -213,7 +256,7 @@ export default createRule({ return collectToStringCertainty(constraint, visited); } // unconstrained generic means `unknown` - return Usefulness.Always; + return option.checkUnknown ? Usefulness.Sometimes : Usefulness.Always; } // the Boolean type definition missing toString() @@ -224,7 +267,18 @@ export default createRule({ return Usefulness.Always; } - if (ignoredTypeNames.includes(getTypeName(checker, type))) { + const symbol = type.aliasSymbol ?? type.getSymbol(); + const decl = symbol?.getDeclarations()?.[0]; + if ( + decl && + canHaveTypeParameters(decl) && + decl.typeParameters && + ignoredTypeNames.includes(symbol.name) + ) { + return Usefulness.Always; + } + + if (isIgnoredTypeOrBase(type)) { return Usefulness.Always; } @@ -251,13 +305,19 @@ export default createRule({ const toString = checker.getPropertyOfType(type, 'toString') ?? checker.getPropertyOfType(type, 'toLocaleString'); + if (!toString) { - // e.g. any/unknown + // unknown + if (option.checkUnknown && type.flags === ts.TypeFlags.Unknown) { + return Usefulness.Sometimes; + } + // e.g. any return Usefulness.Always; } const declarations = toString.getDeclarations(); + // eslint-disable-next-line @typescript-eslint/prefer-optional-chain if (declarations == null || declarations.length !== 1) { // If there are multiple declarations, at least one of them must not be // the default object toString. 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 1efacdaf5ae1..9534acef8ee2 100644 --- a/packages/eslint-plugin/src/rules/no-confusing-void-expression.ts +++ b/packages/eslint-plugin/src/rules/no-confusing-void-expression.ts @@ -1,4 +1,8 @@ -import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; +import type { + NodeWithParent, + TSESLint, + TSESTree, +} from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import * as tsutils from 'ts-api-utils'; @@ -300,8 +304,8 @@ export default createRule({ * @param node The void expression node to check. * @returns Invalid ancestor node if it was found. `null` otherwise. */ - function findInvalidAncestor(node: TSESTree.Node): InvalidAncestor | null { - const parent = nullThrows(node.parent, NullThrowsReasons.MissingParent); + function findInvalidAncestor(node: NodeWithParent): InvalidAncestor | null { + const parent = node.parent; if ( parent.type === AST_NODE_TYPES.SequenceExpression && node !== parent.expressions[parent.expressions.length - 1] @@ -365,17 +369,14 @@ export default createRule({ /** Checks whether the return statement is the last statement in a function body. */ function isFinalReturn(node: TSESTree.ReturnStatement): boolean { // the parent must be a block - const block = nullThrows(node.parent, NullThrowsReasons.MissingParent); + const block = node.parent; if (block.type !== AST_NODE_TYPES.BlockStatement) { // e.g. `if (cond) return;` (not in a block) return false; } // the block's parent must be a function - const blockParent = nullThrows( - block.parent, - NullThrowsReasons.MissingParent, - ); + const blockParent = block.parent; if ( ![ AST_NODE_TYPES.ArrowFunctionExpression, diff --git a/packages/eslint-plugin/src/rules/no-deprecated.ts b/packages/eslint-plugin/src/rules/no-deprecated.ts index 725ddaf3fce9..cc6bb70be9c4 100644 --- a/packages/eslint-plugin/src/rules/no-deprecated.ts +++ b/packages/eslint-plugin/src/rules/no-deprecated.ts @@ -12,6 +12,7 @@ import { nullThrows, typeOrValueSpecifiersSchema, typeMatchesSomeSpecifier, + valueMatchesSomeSpecifier, } from '../util'; type IdentifierLike = @@ -156,22 +157,26 @@ export default createRule({ case AST_NODE_TYPES.TSTypeParameter: return true; + // treat `export import Bar = Foo;` (and `import Foo = require('...')`) as declarations + case AST_NODE_TYPES.TSImportEqualsDeclaration: + return parent.id === node; + default: return false; } } - function isInsideExportOrImport(node: TSESTree.Node): boolean { + function isInsideImport(node: TSESTree.Node): boolean { let current = node; while (true) { switch (current.type) { - case AST_NODE_TYPES.ExportAllDeclaration: - case AST_NODE_TYPES.ExportNamedDeclaration: case AST_NODE_TYPES.ImportDeclaration: return true; case AST_NODE_TYPES.ArrowFunctionExpression: + case AST_NODE_TYPES.ExportAllDeclaration: + case AST_NODE_TYPES.ExportNamedDeclaration: case AST_NODE_TYPES.BlockStatement: case AST_NODE_TYPES.ClassDeclaration: case AST_NODE_TYPES.TSInterfaceDeclaration: @@ -365,17 +370,21 @@ export default createRule({ } function checkIdentifier(node: IdentifierLike): void { - if (isDeclaration(node) || isInsideExportOrImport(node)) { + if (isDeclaration(node) || isInsideImport(node)) { return; } const reason = getDeprecationReason(node); + if (reason == null) { return; } const type = services.getTypeAtLocation(node); - if (typeMatchesSomeSpecifier(type, allow, services.program)) { + if ( + typeMatchesSomeSpecifier(type, allow, services.program) || + valueMatchesSomeSpecifier(node, allow, services.program, type) + ) { return; } @@ -436,7 +445,42 @@ export default createRule({ } return { - Identifier: checkIdentifier, + Identifier(node): void { + const { parent } = node; + + if ( + parent.type === AST_NODE_TYPES.ExportNamedDeclaration || + parent.type === AST_NODE_TYPES.ExportAllDeclaration + ) { + return; + } + + // Computed identifier expressions are handled by checkMemberExpression + if ( + parent.type === AST_NODE_TYPES.MemberExpression && + parent.computed && + parent.property === node + ) { + return; + } + + if (parent.type === AST_NODE_TYPES.ExportSpecifier) { + // only deal with the alias (exported) side, not the local binding + if (parent.exported !== node) { + return; + } + + const symbol = services.getSymbolAtLocation(node); + const aliasDeprecation = getJsDocDeprecation(symbol); + + if (aliasDeprecation != null) { + return; + } + } + + // whether it's a plain identifier or the exported alias + checkIdentifier(node); + }, JSXIdentifier(node): void { if (node.parent.type !== AST_NODE_TYPES.JSXClosingElement) { checkIdentifier(node); diff --git a/packages/eslint-plugin/src/rules/no-duplicate-enum-values.ts b/packages/eslint-plugin/src/rules/no-duplicate-enum-values.ts index c5a858dbdcaa..b9c6fe08d6e6 100644 --- a/packages/eslint-plugin/src/rules/no-duplicate-enum-values.ts +++ b/packages/eslint-plugin/src/rules/no-duplicate-enum-values.ts @@ -36,6 +36,15 @@ export default createRule({ ); } + function isSupportedUnary( + node: TSESTree.Expression, + ): node is TSESTree.UnaryExpression { + return ( + node.type === AST_NODE_TYPES.UnaryExpression && + ['-', '+'].includes(node.operator) + ); + } + function isStaticTemplateLiteral( node: TSESTree.Expression, ): node is TSESTree.TemplateLiteral { @@ -46,30 +55,47 @@ export default createRule({ ); } + function getMemberValue( + initializer: TSESTree.Expression, + ): number | string | undefined { + switch (true) { + case isStringLiteral(initializer): + case isNumberLiteral(initializer): + return initializer.value; + case isSupportedUnary(initializer): { + const inner = Number(getMemberValue(initializer.argument)); + if (Number.isNaN(inner)) { + return undefined; + } + + return initializer.operator === '-' ? -inner : inner; + } + case isStaticTemplateLiteral(initializer): + return initializer.quasis[0].value.cooked; + default: + return undefined; + } + } + return { TSEnumDeclaration(node: TSESTree.TSEnumDeclaration): void { const enumMembers = node.body.members; - const seenValues = new Set(); + const seenValues: (number | string)[] = []; enumMembers.forEach(member => { if (member.initializer == null) { return; } - let value: number | string | undefined; - if (isStringLiteral(member.initializer)) { - value = member.initializer.value; - } else if (isNumberLiteral(member.initializer)) { - value = member.initializer.value; - } else if (isStaticTemplateLiteral(member.initializer)) { - value = member.initializer.quasis[0].value.cooked; - } - + const value = getMemberValue(member.initializer); if (value == null) { return; } - if (seenValues.has(value)) { + const isAlreadyPresent = seenValues.some(seenValue => + Object.is(seenValue, value), + ); + if (isAlreadyPresent) { context.report({ node: member, messageId: 'duplicateValue', @@ -78,7 +104,7 @@ export default createRule({ }, }); } else { - seenValues.add(value); + seenValues.push(value); } }); }, diff --git a/packages/eslint-plugin/src/rules/no-floating-promises.ts b/packages/eslint-plugin/src/rules/no-floating-promises.ts index 50965093ee98..b040d1c82122 100644 --- a/packages/eslint-plugin/src/rules/no-floating-promises.ts +++ b/packages/eslint-plugin/src/rules/no-floating-promises.ts @@ -1,21 +1,23 @@ import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; +import type * as ts from 'typescript'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import * as tsutils from 'ts-api-utils'; -import * as ts from 'typescript'; import type { TypeOrValueSpecifier } from '../util'; import { createRule, - getOperatorPrecedence, + getOperatorPrecedenceForNode, getParserServices, isBuiltinSymbolLike, + isParenthesized, OperatorPrecedence, readonlynessOptionsDefaults, readonlynessOptionsSchema, skipChainExpression, typeMatchesSomeSpecifier, + valueMatchesSomeSpecifier, } from '../util'; import { parseCatchCall, @@ -142,7 +144,7 @@ export default createRule({ const expression = skipChainExpression(node.expression); - if (isKnownSafePromiseReturn(expression)) { + if (isKnownSafePromiseCall(expression)) { return; } @@ -167,10 +169,11 @@ export default createRule({ { messageId: 'floatingFixVoid', fix(fixer): TSESLint.RuleFix | TSESLint.RuleFix[] { - const tsNode = services.esTreeNodeToTSNodeMap.get( - node.expression, - ); - if (isHigherPrecedenceThanUnary(tsNode)) { + if ( + isParenthesized(expression, context.sourceCode) || + getOperatorPrecedenceForNode(expression) > + OperatorPrecedence.Unary + ) { return fixer.insertTextBefore(node, 'void '); } return [ @@ -222,8 +225,10 @@ export default createRule({ 'await', ); } - const tsNode = services.esTreeNodeToTSNodeMap.get(node.expression); - if (isHigherPrecedenceThanUnary(tsNode)) { + if ( + isParenthesized(expression, context.sourceCode) || + getOperatorPrecedenceForNode(expression) > OperatorPrecedence.Unary + ) { return fixer.insertTextBefore(node, 'await '); } return [ @@ -235,13 +240,24 @@ export default createRule({ ]; } - function isKnownSafePromiseReturn(node: TSESTree.Node): boolean { + function isKnownSafePromiseCall(node: TSESTree.Node): boolean { if (node.type !== AST_NODE_TYPES.CallExpression) { return false; } const type = services.getTypeAtLocation(node.callee); + if ( + valueMatchesSomeSpecifier( + node.callee, + allowForKnownSafeCalls, + services.program, + type, + ) + ) { + return true; + } + return typeMatchesSomeSpecifier( type, allowForKnownSafeCalls, @@ -249,14 +265,6 @@ export default createRule({ ); } - function isHigherPrecedenceThanUnary(node: ts.Node): boolean { - const operator = ts.isBinaryExpression(node) - ? node.operatorToken.kind - : ts.SyntaxKind.Unknown; - const nodePrecedence = getOperatorPrecedence(node.kind, operator); - return nodePrecedence > OperatorPrecedence.Unary; - } - function isAsyncIife(node: TSESTree.ExpressionStatement): boolean { if (node.expression.type !== AST_NODE_TYPES.CallExpression) { return false; diff --git a/packages/eslint-plugin/src/rules/no-magic-numbers.ts b/packages/eslint-plugin/src/rules/no-magic-numbers.ts index 6ecddefd0645..04b48b3a1daa 100644 --- a/packages/eslint-plugin/src/rules/no-magic-numbers.ts +++ b/packages/eslint-plugin/src/rules/no-magic-numbers.ts @@ -53,6 +53,7 @@ export default createRule({ docs: { description: 'Disallow magic numbers', extendsBaseRule: true, + frozen: true, }, messages: baseRule.meta.messages, schema: [schema], diff --git a/packages/eslint-plugin/src/rules/no-meaningless-void-operator.ts b/packages/eslint-plugin/src/rules/no-meaningless-void-operator.ts index 68cc840fa84b..6ad9d40c58b1 100644 --- a/packages/eslint-plugin/src/rules/no-meaningless-void-operator.ts +++ b/packages/eslint-plugin/src/rules/no-meaningless-void-operator.ts @@ -36,7 +36,6 @@ export default createRule({ properties: { checkNever: { type: 'boolean', - default: false, description: 'Whether to suggest removing `void` when the argument has type `never`.', }, diff --git a/packages/eslint-plugin/src/rules/no-misused-promises.ts b/packages/eslint-plugin/src/rules/no-misused-promises.ts index aa225d4e0aa2..d491da6227d4 100644 --- a/packages/eslint-plugin/src/rules/no-misused-promises.ts +++ b/packages/eslint-plugin/src/rules/no-misused-promises.ts @@ -6,14 +6,17 @@ import * as ts from 'typescript'; import { createRule, + getConstrainedTypeAtLocation, getFunctionHeadLoc, getParserServices, isArrayMethodCallWithPredicate, isFunction, + isPromiseLike, isRestParameterDeclaration, nullThrows, NullThrowsReasons, } from '../util'; +import { parseFinallyCall } from '../util/promiseUtils'; export type Options = [ { @@ -85,7 +88,7 @@ export default createRule({ messages: { conditional: 'Expected non-Promise value in a boolean conditional.', predicate: 'Expected a non-Promise value to be returned.', - spread: 'Expected a non-Promise value to be spreaded in an object.', + spread: 'Expected a non-Promise value to be spread in an object.', voidReturnArgument: 'Promise returned in function argument where a void return was expected.', voidReturnAttribute: @@ -360,6 +363,13 @@ export default createRule({ function checkArguments( node: TSESTree.CallExpression | TSESTree.NewExpression, ): void { + if ( + node.type === AST_NODE_TYPES.CallExpression && + isPromiseFinallyMethod(node) + ) { + return; + } + const tsNode = services.esTreeNodeToTSNodeMap.get(node); const voidArgs = voidFunctionArguments(checker, tsNode); if (voidArgs.size === 0) { @@ -492,10 +502,10 @@ export default createRule({ if (objType == null) { return; } - const propertySymbol = checker.getPropertyOfType( - objType, - tsNode.name.text, - ); + const propertySymbol = tsutils + .unionConstituents(objType) + .map(t => checker.getPropertyOfType(t, tsNode.name.getText())) + .find(p => p); if (propertySymbol == null) { return; } @@ -563,6 +573,18 @@ export default createRule({ } } + function isPromiseFinallyMethod(node: TSESTree.CallExpression): boolean { + const promiseFinallyCall = parseFinallyCall(node, context); + + return ( + promiseFinallyCall != null && + isPromiseLike( + services.program, + getConstrainedTypeAtLocation(services, promiseFinallyCall.object), + ) + ); + } + function checkClassLikeOrInterfaceNode( node: | TSESTree.ClassDeclaration diff --git a/packages/eslint-plugin/src/rules/no-misused-spread.ts b/packages/eslint-plugin/src/rules/no-misused-spread.ts index fab84902e9e1..34ce3fa9db52 100644 --- a/packages/eslint-plugin/src/rules/no-misused-spread.ts +++ b/packages/eslint-plugin/src/rules/no-misused-spread.ts @@ -154,7 +154,7 @@ export default createRule({ function getPromiseSpreadSuggestions( node: TSESTree.Expression, ): TSESLint.ReportSuggestionArray { - const isHighPrecendence = isHigherPrecedenceThanAwait( + const isHighPrecedence = isHigherPrecedenceThanAwait( services.esTreeNodeToTSNodeMap.get(node), ); @@ -162,7 +162,7 @@ export default createRule({ { messageId: 'addAwait', fix: fixer => - isHighPrecendence + isHighPrecedence ? fixer.insertTextBefore(node, 'await ') : [ fixer.insertTextBefore(node, 'await ('), 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 fd66c1cef9b0..bc7c9ecf226e 100644 --- a/packages/eslint-plugin/src/rules/no-non-null-assertion.ts +++ b/packages/eslint-plugin/src/rules/no-non-null-assertion.ts @@ -4,6 +4,7 @@ import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import { createRule, + isAssignee, isNonNullAssertionPunctuator, nullThrows, NullThrowsReasons, @@ -53,7 +54,8 @@ export default createRule<[], MessageIds>({ if ( node.parent.type === AST_NODE_TYPES.MemberExpression && - node.parent.object === node + node.parent.object === node && + !isAssignee(node.parent) ) { if (!node.parent.optional) { if (node.parent.computed) { diff --git a/packages/eslint-plugin/src/rules/no-restricted-types.ts b/packages/eslint-plugin/src/rules/no-restricted-types.ts index b4d9e427c07f..2901ac5a9cf5 100644 --- a/packages/eslint-plugin/src/rules/no-restricted-types.ts +++ b/packages/eslint-plugin/src/rules/no-restricted-types.ts @@ -36,7 +36,7 @@ function stringifyNode( } function getCustomMessage( - bannedType: string | { fixWith?: string; message?: string } | true | null, + bannedType: string | true | { fixWith?: string; message?: string } | null, ): string { if (!bannedType || bannedType === true) { return ''; diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts b/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts index 387bf5f2da33..b9a1ebb9a4bf 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts @@ -200,9 +200,12 @@ export default createRule({ oneOf: [ { type: 'boolean', + description: 'Always ignore or not ignore the loop conditions', }, { type: 'string', + description: + 'Which situations to ignore constant conditions in.', enum: ['always', 'never', 'only-allowed-literals'], }, ], diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-template-expression.ts b/packages/eslint-plugin/src/rules/no-unnecessary-template-expression.ts index 4f184af39f15..361300e1e3a1 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-template-expression.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-template-expression.ts @@ -193,7 +193,7 @@ export default createRule<[], MessageId>({ }); } - function isUnncessaryValueInterpolation({ + function isUnnecessaryValueInterpolation({ interpolation, nextQuasi, prevQuasi, @@ -432,7 +432,7 @@ export default createRule<[], MessageId>({ } const infos = getInterpolationInfos(node).filter( - isUnncessaryValueInterpolation, + isUnnecessaryValueInterpolation, ); for (const reportDescriptor of getReportDescriptors(infos)) { 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 945614ae618f..708879be502f 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-type-arguments.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-type-arguments.ts @@ -169,11 +169,11 @@ function getTypeParametersFromType( return undefined; } - const sortedDeclaraions = sortDeclarationsByTypeValueContext( + const sortedDeclarations = sortDeclarationsByTypeValueContext( node, declarations, ); - return findFirstResult(sortedDeclaraions, decl => { + return findFirstResult(sortedDeclarations, decl => { if ( ts.isTypeAliasDeclaration(decl) || ts.isInterfaceDeclaration(decl) || diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-type-conversion.ts b/packages/eslint-plugin/src/rules/no-unnecessary-type-conversion.ts index b9471c87d2bd..d18f7617acfc 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-type-conversion.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-type-conversion.ts @@ -19,6 +19,18 @@ type MessageIds = | 'suggestSatisfies' | 'unnecessaryTypeConversion'; +function isEnumType(type: ts.Type): boolean { + return (type.getFlags() & ts.TypeFlags.EnumLike) !== 0; +} + +function isEnumMemberType(type: ts.Type): boolean { + const symbol = type.getSymbol(); + if (!symbol) { + return false; + } + return (symbol.flags & ts.SymbolFlags.EnumMember) !== 0; +} + export default createRule({ name: 'no-unnecessary-type-conversion', meta: { @@ -26,6 +38,7 @@ export default createRule({ docs: { description: 'Disallow conversion idioms when they do not change the type or value of the expression', + recommended: 'strict', requiresTypeChecking: true, }, hasSuggestions: true, @@ -56,7 +69,7 @@ export default createRule({ typeFlag: ts.TypeFlags, typeString: 'boolean' | 'number', violation: string, - isDoubleOperator: boolean, // !! or ~~ + isDoubleOperator: boolean, // !! ) { const outerNode = isDoubleOperator ? node.parent : node; const type = services.getTypeAtLocation(node.argument); @@ -293,6 +306,11 @@ export default createRule({ ): void { const memberExpr = node.parent as TSESTree.MemberExpression; const type = getConstrainedTypeAtLocation(services, memberExpr.object); + + if (isEnumType(type) || isEnumMemberType(type)) { + return; + } + if (doesUnderlyingTypeMatchFlag(type, ts.TypeFlags.StringLike)) { const wrappingFixerParams = { node: memberExpr.parent, @@ -350,13 +368,49 @@ export default createRule({ 'UnaryExpression[operator = "~"] > UnaryExpression[operator = "~"]'( node: TSESTree.UnaryExpression, ): void { - handleUnaryOperator( - node, - ts.TypeFlags.NumberLike, - 'number', - 'Using ~~ on a number', - true, - ); + const outerNode = node.parent; + const type = services.getTypeAtLocation(node.argument); + + if ( + tsutils.unionConstituents(type).every(t => { + return ( + isTypeFlagSet(t, ts.TypeFlags.NumberLiteral) && + Number.isInteger((t as ts.NumberLiteralType).value) + ); + }) + ) { + const wrappingFixerParams = { + node: outerNode, + innerNode: [node.argument], + sourceCode: context.sourceCode, + }; + + context.report({ + loc: { + start: outerNode.loc.start, + end: { + column: node.loc.start.column + 1, + line: node.loc.start.line, + }, + }, + messageId: 'unnecessaryTypeConversion', + data: { type: 'number', violation: 'Using ~~ on an integer' }, + suggest: [ + { + messageId: 'suggestRemove', + fix: getWrappingFixer(wrappingFixerParams), + }, + { + messageId: 'suggestSatisfies', + data: { type: 'number' }, + fix: getWrappingFixer({ + ...wrappingFixerParams, + wrap: expr => `${expr} satisfies number`, + }), + }, + ], + }); + } }, }; }, diff --git a/packages/eslint-plugin/src/rules/no-unsafe-assignment.ts b/packages/eslint-plugin/src/rules/no-unsafe-assignment.ts index 2dd9ca6b5d2e..6b3e47e3a3b4 100644 --- a/packages/eslint-plugin/src/rules/no-unsafe-assignment.ts +++ b/packages/eslint-plugin/src/rules/no-unsafe-assignment.ts @@ -50,6 +50,8 @@ export default createRule({ unsafeArraySpread: 'Unsafe spread of an {{sender}} value in an array.', unsafeAssignment: 'Unsafe assignment of type {{sender}} to a variable of type {{receiver}}.', + unsafeObjectPattern: + 'Unsafe object destructuring of a property with an {{sender}} value.', }, schema: [], }, @@ -215,7 +217,7 @@ export default createRule({ if (isTypeAnyType(senderType)) { context.report({ node: receiverProperty.value, - messageId: 'unsafeArrayPatternFromTuple', + messageId: 'unsafeObjectPattern', data: createData(senderType), }); didReport = true; diff --git a/packages/eslint-plugin/src/rules/no-unsafe-enum-comparison.ts b/packages/eslint-plugin/src/rules/no-unsafe-enum-comparison.ts index c5f457db3618..051a827ee720 100644 --- a/packages/eslint-plugin/src/rules/no-unsafe-enum-comparison.ts +++ b/packages/eslint-plugin/src/rules/no-unsafe-enum-comparison.ts @@ -23,25 +23,33 @@ function typeViolates(leftTypeParts: ts.Type[], rightType: ts.Type): boolean { } function isNumberLike(type: ts.Type): boolean { - const typeParts = tsutils.intersectionConstituents(type); - - return typeParts.some(typePart => { - return tsutils.isTypeFlagSet( - typePart, - ts.TypeFlags.Number | ts.TypeFlags.NumberLike, + return tsutils + .unionConstituents(type) + .every(unionPart => + tsutils + .intersectionConstituents(unionPart) + .some(intersectionPart => + tsutils.isTypeFlagSet( + intersectionPart, + ts.TypeFlags.Number | ts.TypeFlags.NumberLike, + ), + ), ); - }); } function isStringLike(type: ts.Type): boolean { - const typeParts = tsutils.intersectionConstituents(type); - - return typeParts.some(typePart => { - return tsutils.isTypeFlagSet( - typePart, - ts.TypeFlags.String | ts.TypeFlags.StringLike, + return tsutils + .unionConstituents(type) + .every(unionPart => + tsutils + .intersectionConstituents(unionPart) + .some(intersectionPart => + tsutils.isTypeFlagSet( + intersectionPart, + ts.TypeFlags.String | ts.TypeFlags.StringLike, + ), + ), ); - }); } /** 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 6cf16d5211e4..510d53c5e3e3 100644 --- a/packages/eslint-plugin/src/rules/no-unsafe-member-access.ts +++ b/packages/eslint-plugin/src/rules/no-unsafe-member-access.ts @@ -15,6 +15,7 @@ import { const enum State { Unsafe = 1, Safe = 2, + Chained = 3, } function createDataType(type: ts.Type): '`any`' | '`error` typed' { @@ -22,7 +23,18 @@ function createDataType(type: ts.Type): '`any`' | '`error` typed' { return isErrorType ? '`error` typed' : '`any`'; } -export default createRule({ +export type Options = [ + { + allowOptionalChaining?: boolean; + }, +]; + +export type MessageIds = + | 'unsafeComputedMemberAccess' + | 'unsafeMemberExpression' + | 'unsafeThisMemberExpression'; + +export default createRule({ name: 'no-unsafe-member-access', meta: { type: 'problem', @@ -41,10 +53,26 @@ export default createRule({ 'You can try to fix this by turning on the `noImplicitThis` compiler option, or adding a `this` parameter to the function.', ].join('\n'), }, - schema: [], + schema: [ + { + type: 'object', + additionalProperties: false, + properties: { + allowOptionalChaining: { + type: 'boolean', + description: + 'Whether to allow `?.` optional chains on `any` values.', + }, + }, + }, + ], }, - defaultOptions: [], - create(context) { + defaultOptions: [ + { + allowOptionalChaining: false, + }, + ], + create(context, [{ allowOptionalChaining }]) { const services = getParserServices(context); const compilerOptions = services.program.getCompilerOptions(); const isNoImplicitThis = tsutils.isStrictCompilerOptionEnabled( @@ -54,7 +82,20 @@ export default createRule({ const stateCache = new Map(); + // Case notes: + // value?.outer.middle.inner + // The ChainExpression is a child of the root expression, and a parent of all the MemberExpressions. + // But the left-most expression is what we want to report on: the inner-most expressions. + // In fact, this is true even if the chain is on the inside! + // value.outer.middle?.inner; + // It was already true that every `object` (MemberExpression) has optional: boolean + function checkMemberExpression(node: TSESTree.MemberExpression): State { + if (allowOptionalChaining && node.optional) { + stateCache.set(node, State.Chained); + return State.Chained; + } + const cachedState = stateCache.get(node); if (cachedState) { return cachedState; @@ -77,8 +118,7 @@ export default createRule({ if (state === State.Unsafe) { const propertyName = context.sourceCode.getText(node.property); - let messageId: 'unsafeMemberExpression' | 'unsafeThisMemberExpression' = - 'unsafeMemberExpression'; + let messageId: MessageIds = 'unsafeMemberExpression'; if (!isNoImplicitThis) { // `this.foo` or `this.foo[bar]` @@ -114,6 +154,13 @@ export default createRule({ 'MemberExpression[computed = true] > *.property'( node: TSESTree.Expression, ): void { + if ( + allowOptionalChaining && + (node.parent as TSESTree.MemberExpression).optional + ) { + return; + } + if ( // x[1] node.type === AST_NODE_TYPES.Literal || diff --git a/packages/eslint-plugin/src/rules/no-unused-vars.ts b/packages/eslint-plugin/src/rules/no-unused-vars.ts index f2bfa26bb1a8..ce8e0abc3340 100644 --- a/packages/eslint-plugin/src/rules/no-unused-vars.ts +++ b/packages/eslint-plugin/src/rules/no-unused-vars.ts @@ -35,6 +35,7 @@ export type Options = [ destructuredArrayIgnorePattern?: string; ignoreClassWithStaticInitBlock?: boolean; ignoreRestSiblings?: boolean; + ignoreUsingDeclarations?: boolean; reportUsedIgnorePattern?: boolean; vars?: 'all' | 'local'; varsIgnorePattern?: string; @@ -49,6 +50,7 @@ interface TranslatedOptions { destructuredArrayIgnorePattern?: RegExp; ignoreClassWithStaticInitBlock: boolean; ignoreRestSiblings: boolean; + ignoreUsingDeclarations: boolean; reportUsedIgnorePattern: boolean; vars: 'all' | 'local'; varsIgnorePattern?: RegExp; @@ -86,6 +88,7 @@ export default createRule({ oneOf: [ { type: 'string', + description: 'Broad setting for unused variables to target.', enum: ['all', 'local'], }, { @@ -127,6 +130,11 @@ export default createRule({ description: 'Whether to ignore sibling properties in `...` destructurings.', }, + ignoreUsingDeclarations: { + type: 'boolean', + description: + 'Whether to ignore using or await using declarations.', + }, reportUsedIgnorePattern: { type: 'boolean', description: @@ -162,6 +170,7 @@ export default createRule({ caughtErrors: 'all', ignoreClassWithStaticInitBlock: false, ignoreRestSiblings: false, + ignoreUsingDeclarations: false, reportUsedIgnorePattern: false, vars: 'all', }; @@ -173,6 +182,9 @@ export default createRule({ options.args = firstOption.args ?? options.args; options.ignoreRestSiblings = firstOption.ignoreRestSiblings ?? options.ignoreRestSiblings; + options.ignoreUsingDeclarations = + firstOption.ignoreUsingDeclarations ?? + options.ignoreUsingDeclarations; options.caughtErrors = firstOption.caughtErrors ?? options.caughtErrors; options.ignoreClassWithStaticInitBlock = firstOption.ignoreClassWithStaticInitBlock ?? @@ -548,6 +560,14 @@ export default createRule({ continue; } + if ( + def.type === TSESLint.Scope.DefinitionType.Variable && + options.ignoreUsingDeclarations && + (def.parent.kind === 'await using' || def.parent.kind === 'using') + ) { + continue; + } + if (hasRestSpreadSibling(variable)) { continue; } 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 e0dcef814cc7..11e51f0d5ee5 100644 --- a/packages/eslint-plugin/src/rules/no-use-before-define.ts +++ b/packages/eslint-plugin/src/rules/no-use-before-define.ts @@ -231,6 +231,8 @@ export default createRule({ oneOf: [ { type: 'string', + description: + 'Broadly set functions and allowNamedExports to false.', enum: ['nofunc'], }, { diff --git a/packages/eslint-plugin/src/rules/only-throw-error.ts b/packages/eslint-plugin/src/rules/only-throw-error.ts index 187e6ac5e5b1..ec5de09d13f0 100644 --- a/packages/eslint-plugin/src/rules/only-throw-error.ts +++ b/packages/eslint-plugin/src/rules/only-throw-error.ts @@ -143,13 +143,6 @@ export default createRule({ } function checkThrowArgument(node: TSESTree.Node): void { - if ( - node.type === AST_NODE_TYPES.AwaitExpression || - node.type === AST_NODE_TYPES.YieldExpression - ) { - return; - } - if (options.allowRethrowing && isRethrownError(node)) { return; } diff --git a/packages/eslint-plugin/src/rules/prefer-destructuring.ts b/packages/eslint-plugin/src/rules/prefer-destructuring.ts index 5934573e3350..40c0de88ba40 100644 --- a/packages/eslint-plugin/src/rules/prefer-destructuring.ts +++ b/packages/eslint-plugin/src/rules/prefer-destructuring.ts @@ -52,6 +52,7 @@ const schema: readonly JSONSchema4[] = [ }, { type: 'object', + additionalProperties: false, properties: { enforceForDeclarationWithTypeAnnotation: { type: 'boolean', @@ -75,6 +76,7 @@ export default createRule({ docs: { description: 'Require destructuring from arrays and/or objects', extendsBaseRule: true, + frozen: true, requiresTypeChecking: true, }, fixable: baseRule.meta.fixable, diff --git a/packages/eslint-plugin/src/rules/prefer-includes.ts b/packages/eslint-plugin/src/rules/prefer-includes.ts index 6825fc042a6d..4da95f8f9866 100644 --- a/packages/eslint-plugin/src/rules/prefer-includes.ts +++ b/packages/eslint-plugin/src/rules/prefer-includes.ts @@ -39,7 +39,7 @@ export default createRule({ function isNumber(node: TSESTree.Node, value: number): boolean { const evaluated = getStaticValue(node, globalScope); - return evaluated != null && evaluated.value === value; + return evaluated?.value === value; } function isPositiveCheck(node: TSESTree.BinaryExpression): boolean { diff --git a/packages/eslint-plugin/src/rules/prefer-nullish-coalescing.ts b/packages/eslint-plugin/src/rules/prefer-nullish-coalescing.ts index d846b0bbc59b..0956b558b10a 100644 --- a/packages/eslint-plugin/src/rules/prefer-nullish-coalescing.ts +++ b/packages/eslint-plugin/src/rules/prefer-nullish-coalescing.ts @@ -47,13 +47,13 @@ export type Options = [ ignoreIfStatements?: boolean; ignoreMixedLogicalExpressions?: boolean; ignorePrimitives?: + | true | { bigint?: boolean; boolean?: boolean; number?: boolean; string?: boolean; - } - | true; + }; ignoreTernaryTests?: boolean; }, ]; @@ -123,6 +123,7 @@ export default createRule({ oneOf: [ { type: 'object', + additionalProperties: false, description: 'Which primitives types may be ignored.', properties: { bigint: { @@ -300,7 +301,11 @@ export default createRule({ if ( ignoreBooleanCoercion === true && - isBooleanConstructorContext(node, context) + isBooleanConstructorContext(node, context) && + !( + node.type === AST_NODE_TYPES.ConditionalExpression && + node.parent.type === AST_NODE_TYPES.CallExpression + ) ) { return false; } diff --git a/packages/eslint-plugin/src/rules/prefer-optional-chain-utils/analyzeChain.ts b/packages/eslint-plugin/src/rules/prefer-optional-chain-utils/analyzeChain.ts index c4364765f92c..a2b11134e540 100644 --- a/packages/eslint-plugin/src/rules/prefer-optional-chain-utils/analyzeChain.ts +++ b/packages/eslint-plugin/src/rules/prefer-optional-chain-utils/analyzeChain.ts @@ -13,7 +13,7 @@ import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import { unionConstituents } from 'ts-api-utils'; import * as ts from 'typescript'; -import type { ValidOperand } from './gatherLogicalOperands'; +import type { LastChainOperand, ValidOperand } from './gatherLogicalOperands'; import type { PreferOptionalChainMessageIds, PreferOptionalChainOptions, @@ -31,7 +31,7 @@ import { } from '../../util'; import { checkNullishAndReport } from './checkNullishAndReport'; import { compareNodes, NodeComparisonResult } from './compareNodes'; -import { NullishComparisonType } from './gatherLogicalOperands'; +import { ComparisonType, NullishComparisonType } from './gatherLogicalOperands'; function includesType( parserServices: ParserServicesWithTypeInformation, @@ -48,6 +48,75 @@ function includesType( return false; } +function isValidAndLastChainOperand( + ComparisonValueType: TSESTree.Node, + comparisonType: ComparisonType, + parserServices: ParserServicesWithTypeInformation, +) { + const type = parserServices.getTypeAtLocation(ComparisonValueType); + const ANY_UNKNOWN_FLAGS = ts.TypeFlags.Any | ts.TypeFlags.Unknown; + + const types = unionConstituents(type); + switch (comparisonType) { + case ComparisonType.Equal: { + const isNullish = types.some(t => + isTypeFlagSet( + t, + ANY_UNKNOWN_FLAGS | ts.TypeFlags.Null | ts.TypeFlags.Undefined, + ), + ); + return !isNullish; + } + case ComparisonType.StrictEqual: { + const isUndefined = types.some(t => + isTypeFlagSet(t, ANY_UNKNOWN_FLAGS | ts.TypeFlags.Undefined), + ); + return !isUndefined; + } + case ComparisonType.NotStrictEqual: { + return types.every(t => isTypeFlagSet(t, ts.TypeFlags.Undefined)); + } + case ComparisonType.NotEqual: { + return types.every(t => + isTypeFlagSet(t, ts.TypeFlags.Undefined | ts.TypeFlags.Null), + ); + } + } +} +function isValidOrLastChainOperand( + ComparisonValueType: TSESTree.Node, + comparisonType: ComparisonType, + parserServices: ParserServicesWithTypeInformation, +) { + const type = parserServices.getTypeAtLocation(ComparisonValueType); + const ANY_UNKNOWN_FLAGS = ts.TypeFlags.Any | ts.TypeFlags.Unknown; + + const types = unionConstituents(type); + switch (comparisonType) { + case ComparisonType.NotEqual: { + const isNullish = types.some(t => + isTypeFlagSet( + t, + ANY_UNKNOWN_FLAGS | ts.TypeFlags.Null | ts.TypeFlags.Undefined, + ), + ); + return !isNullish; + } + case ComparisonType.NotStrictEqual: { + const isUndefined = types.some(t => + isTypeFlagSet(t, ANY_UNKNOWN_FLAGS | ts.TypeFlags.Undefined), + ); + return !isUndefined; + } + case ComparisonType.Equal: + return types.every(t => + isTypeFlagSet(t, ts.TypeFlags.Undefined | ts.TypeFlags.Null), + ); + case ComparisonType.StrictEqual: + return types.every(t => isTypeFlagSet(t, ts.TypeFlags.Undefined)); + } +} + // I hate that these functions are identical aside from the enum values used // I can't think of a good way to reuse the code here in a way that will preserve // the type safety and simplicity. @@ -65,18 +134,7 @@ const analyzeAndChainOperand: OperandAnalyzer = ( chain, ) => { switch (operand.comparisonType) { - case NullishComparisonType.Boolean: { - const nextOperand = chain.at(index + 1); - if ( - nextOperand?.comparisonType === - NullishComparisonType.NotStrictEqualNull && - operand.comparedName.type === AST_NODE_TYPES.Identifier - ) { - return null; - } - return [operand]; - } - + case NullishComparisonType.Boolean: case NullishComparisonType.NotEqualNullOrUndefined: return [operand]; @@ -92,7 +150,8 @@ const analyzeAndChainOperand: OperandAnalyzer = ( return [operand, nextOperand]; } if ( - includesType( + nextOperand && + !includesType( parserServices, operand.comparedName, ts.TypeFlags.Undefined, @@ -101,10 +160,9 @@ const analyzeAndChainOperand: OperandAnalyzer = ( // we know the next operand is not an `undefined` check and that this // operand includes `undefined` - which means that making this an // optional chain would change the runtime behavior of the expression - return null; + return [operand]; } - - return [operand]; + return null; } case NullishComparisonType.NotStrictEqualUndefined: { @@ -156,6 +214,7 @@ const analyzeOrChainOperand: OperandAnalyzer = ( ) { return [operand, nextOperand]; } + if ( includesType( parserServices, @@ -168,7 +227,6 @@ const analyzeOrChainOperand: OperandAnalyzer = ( // optional chain would change the runtime behavior of the expression return null; } - return [operand]; } @@ -207,7 +265,7 @@ const analyzeOrChainOperand: OperandAnalyzer = ( * @returns The range to report. */ function getReportRange( - chain: ValidOperand[], + chain: { node: TSESTree.Expression }[], boundary: TSESTree.Range, sourceCode: SourceCode, ): TSESTree.Range { @@ -247,8 +305,10 @@ function getReportDescriptor( node: TSESTree.Node, operator: '&&' | '||', options: PreferOptionalChainOptions, - chain: ValidOperand[], + subChain: ValidOperand[], + lastChain: (LastChainOperand | ValidOperand) | undefined, ): ReportDescriptor { + const chain = lastChain ? [...subChain, lastChain] : subChain; const lastOperand = chain[chain.length - 1]; let useSuggestionFixer: boolean; @@ -264,6 +324,7 @@ function getReportDescriptor( // `undefined`, or else we're going to change the final type - which is // unsafe and might cause downstream type errors. else if ( + lastChain || lastOperand.comparisonType === NullishComparisonType.EqualNullOrUndefined || lastOperand.comparisonType === NullishComparisonType.NotEqualNullOrUndefined || @@ -521,10 +582,11 @@ export function analyzeChain( node: TSESTree.Node, operator: TSESTree.LogicalExpression['operator'], chain: ValidOperand[], + lastChainOperand?: LastChainOperand, ): void { // need at least 2 operands in a chain for it to be a chain if ( - chain.length <= 1 || + chain.length + (lastChainOperand ? 1 : 0) <= 1 || /* istanbul ignore next -- previous checks make this unreachable, but keep it for exhaustiveness check */ operator === '??' ) { @@ -544,16 +606,20 @@ export function analyzeChain( // Things like x !== null && x !== undefined have two nodes, but they are // one logical unit here, so we'll allow them to be grouped. let subChain: (readonly ValidOperand[] | ValidOperand)[] = []; + let lastChain: LastChainOperand | ValidOperand | undefined = undefined; const maybeReportThenReset = ( newChainSeed?: readonly [ValidOperand, ...ValidOperand[]], ): void => { - if (subChain.length > 1) { + if (subChain.length + (lastChain ? 1 : 0) > 1) { const subChainFlat = subChain.flat(); + const maybeNullishNodes = lastChain + ? subChainFlat.map(({ node }) => node) + : subChainFlat.slice(0, -1).map(({ node }) => node); checkNullishAndReport( context, parserServices, options, - subChainFlat.slice(0, -1).map(({ node }) => node), + maybeNullishNodes, getReportDescriptor( context.sourceCode, parserServices, @@ -561,6 +627,7 @@ export function analyzeChain( operator, options, subChainFlat, + lastChain, ), ); } @@ -578,6 +645,7 @@ export function analyzeChain( // ^^^^^^^^^^^ newChainSeed // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ second chain subChain = newChainSeed ? [newChainSeed] : []; + lastChain = undefined; }; for (let i = 0; i < chain.length; i += 1) { @@ -595,6 +663,21 @@ export function analyzeChain( // ^^^^^^^ invalid OR chain logical, but still part of // the chain for combination purposes + if (lastOperand) { + const comparisonResult = compareNodes( + lastOperand.comparedName, + operand.comparedName, + ); + switch (operand.comparisonType) { + case NullishComparisonType.StrictEqualUndefined: + case NullishComparisonType.NotStrictEqualUndefined: { + if (comparisonResult === NodeComparisonResult.Subset) { + lastChain = operand; + } + break; + } + } + } maybeReportThenReset(); continue; } @@ -624,7 +707,28 @@ export function analyzeChain( subChain.push(currentOperand); } } + const lastOperand = subChain.flat().at(-1); + if (lastOperand && lastChainOperand) { + const comparisonResult = compareNodes( + lastOperand.comparedName, + lastChainOperand.comparedName, + ); + const isValidLastChainOperand = + operator === '&&' + ? isValidAndLastChainOperand + : isValidOrLastChainOperand; + if ( + comparisonResult === NodeComparisonResult.Subset && + isValidLastChainOperand( + lastChainOperand.comparisonValue, + lastChainOperand.comparisonType, + parserServices, + ) + ) { + lastChain = lastChainOperand; + } + } // check the leftovers maybeReportThenReset(); } diff --git a/packages/eslint-plugin/src/rules/prefer-optional-chain-utils/gatherLogicalOperands.ts b/packages/eslint-plugin/src/rules/prefer-optional-chain-utils/gatherLogicalOperands.ts index 174f8982cad8..9092e1e67a75 100644 --- a/packages/eslint-plugin/src/rules/prefer-optional-chain-utils/gatherLogicalOperands.ts +++ b/packages/eslint-plugin/src/rules/prefer-optional-chain-utils/gatherLogicalOperands.ts @@ -25,6 +25,7 @@ const enum ComparisonValueType { } export const enum OperandValidity { Valid = 'Valid', + Last = 'Last', Invalid = 'Invalid', } export const enum NullishComparisonType { @@ -48,6 +49,12 @@ export const enum NullishComparisonType { /** `x` */ Boolean = 'Boolean', // eslint-disable-line @typescript-eslint/internal/prefer-ast-types-enum } +export const enum ComparisonType { + NotEqual = 'NotEqual', + Equal = 'Equal', + NotStrictEqual = 'NotStrictEqual', + StrictEqual = 'StrictEqual', +} export interface ValidOperand { comparedName: TSESTree.Node; comparisonType: NullishComparisonType; @@ -55,10 +62,18 @@ export interface ValidOperand { node: TSESTree.Expression; type: OperandValidity.Valid; } +export interface LastChainOperand { + comparedName: TSESTree.Node; + comparisonType: ComparisonType; + comparisonValue: TSESTree.Node; + isYoda: boolean; + node: TSESTree.BinaryExpression; + type: OperandValidity.Last; +} export interface InvalidOperand { type: OperandValidity.Invalid; } -type Operand = InvalidOperand | ValidOperand; +type Operand = InvalidOperand | LastChainOperand | ValidOperand; const NULLISH_FLAGS = ts.TypeFlags.Null | ts.TypeFlags.Undefined; function isValidFalseBooleanCheckType( @@ -182,61 +197,101 @@ export function gatherLogicalOperands( continue; } - switch (operand.operator) { - case '!=': - case '==': - if ( - comparedValue === ComparisonValueType.Null || - comparedValue === ComparisonValueType.Undefined - ) { - // x == null, x == undefined - result.push({ - comparedName: comparedExpression, - comparisonType: operand.operator.startsWith('!') - ? NullishComparisonType.NotEqualNullOrUndefined - : NullishComparisonType.EqualNullOrUndefined, - isYoda, - node: operand, - type: OperandValidity.Valid, - }); - continue; - } - // x == something :( - result.push({ type: OperandValidity.Invalid }); - continue; - - case '!==': - case '===': { - const comparedName = comparedExpression; - switch (comparedValue) { - case ComparisonValueType.Null: + if (operand.operator.startsWith('!') !== (node.operator === '||')) { + switch (operand.operator) { + case '!=': + case '==': + if ( + comparedValue === ComparisonValueType.Null || + comparedValue === ComparisonValueType.Undefined + ) { + // x == null, x == undefined result.push({ - comparedName, + comparedName: comparedExpression, comparisonType: operand.operator.startsWith('!') - ? NullishComparisonType.NotStrictEqualNull - : NullishComparisonType.StrictEqualNull, + ? NullishComparisonType.NotEqualNullOrUndefined + : NullishComparisonType.EqualNullOrUndefined, isYoda, node: operand, type: OperandValidity.Valid, }); continue; + } + break; + + case '!==': + case '===': { + const comparedName = comparedExpression; + switch (comparedValue) { + case ComparisonValueType.Null: + result.push({ + comparedName, + comparisonType: operand.operator.startsWith('!') + ? NullishComparisonType.NotStrictEqualNull + : NullishComparisonType.StrictEqualNull, + isYoda, + node: operand, + type: OperandValidity.Valid, + }); + continue; + + case ComparisonValueType.Undefined: + result.push({ + comparedName, + comparisonType: operand.operator.startsWith('!') + ? NullishComparisonType.NotStrictEqualUndefined + : NullishComparisonType.StrictEqualUndefined, + isYoda, + node: operand, + type: OperandValidity.Valid, + }); + continue; + } + } + } + } - case ComparisonValueType.Undefined: - result.push({ - comparedName, - comparisonType: operand.operator.startsWith('!') - ? NullishComparisonType.NotStrictEqualUndefined - : NullishComparisonType.StrictEqualUndefined, - isYoda, - node: operand, - type: OperandValidity.Valid, - }); - continue; + // x == something :( + // x === something :( + // x != something :( + // x !== something :( + const binaryComparisonChain = getBinaryComparisonChain(operand); + if (binaryComparisonChain) { + const { comparedName, comparedValue, isYoda } = binaryComparisonChain; + + switch (operand.operator) { + case '==': + case '===': { + const comparisonType = + operand.operator === '==' + ? ComparisonType.Equal + : ComparisonType.StrictEqual; + result.push({ + comparedName, + comparisonType, + comparisonValue: comparedValue, + isYoda, + node: operand, + type: OperandValidity.Last, + }); + continue; + } - default: - // x === something :( - result.push({ type: OperandValidity.Invalid }); - continue; + case '!=': + case '!==': { + const comparisonType = + operand.operator === '!=' + ? ComparisonType.NotEqual + : ComparisonType.NotStrictEqual; + result.push({ + comparedName, + comparisonType, + comparisonValue: comparedValue, + isYoda, + node: operand, + type: OperandValidity.Last, + }); + continue; } } } @@ -248,12 +303,13 @@ export function gatherLogicalOperands( case AST_NODE_TYPES.UnaryExpression: if ( operand.operator === '!' && - isValidFalseBooleanCheckType( - operand.argument, - areMoreOperands && node.operator === '||', - parserServices, - options, - ) + (!areMoreOperands || + isValidFalseBooleanCheckType( + operand.argument, + node.operator === '||', + parserServices, + options, + )) ) { result.push({ comparedName: operand.argument, @@ -274,9 +330,10 @@ export function gatherLogicalOperands( default: if ( + !areMoreOperands || isValidFalseBooleanCheckType( operand, - areMoreOperands && node.operator === '&&', + node.operator === '&&', parserServices, options, ) @@ -372,4 +429,32 @@ export function gatherLogicalOperands( return null; } + + function getBinaryComparisonChain(node: TSESTree.BinaryExpression) { + const { left, right } = node; + let isYoda = false; + const isLeftMemberExpression = + left.type === AST_NODE_TYPES.MemberExpression; + const isRightMemberExpression = + right.type === AST_NODE_TYPES.MemberExpression; + if (isLeftMemberExpression && !isRightMemberExpression) { + const [comparedName, comparedValue] = [left, right]; + return { + comparedName, + comparedValue, + isYoda, + }; + } + if (!isLeftMemberExpression && isRightMemberExpression) { + const [comparedName, comparedValue] = [right, left]; + + isYoda = true; + return { + comparedName, + comparedValue, + isYoda, + }; + } + return null; + } } diff --git a/packages/eslint-plugin/src/rules/prefer-optional-chain.ts b/packages/eslint-plugin/src/rules/prefer-optional-chain.ts index ffbcd213fedd..c3d61c0f0f70 100644 --- a/packages/eslint-plugin/src/rules/prefer-optional-chain.ts +++ b/packages/eslint-plugin/src/rules/prefer-optional-chain.ts @@ -109,7 +109,6 @@ export default createRule< const seenLogicals = new Set(); return { - // specific handling for `(foo ?? {}).bar` / `(foo || {}).bar` 'LogicalExpression[operator!="??"]'( node: TSESTree.LogicalExpression, ): void { @@ -139,6 +138,17 @@ export default createRule< currentChain, ); currentChain = []; + } else if (operand.type === OperandValidity.Last) { + analyzeChain( + context, + parserServices, + options, + node, + node.operator, + currentChain, + operand, + ); + currentChain = []; } else { currentChain.push(operand); } @@ -157,6 +167,7 @@ export default createRule< } }, + // specific handling for `(foo ?? {}).bar` / `(foo || {}).bar` 'LogicalExpression[operator="||"], LogicalExpression[operator="??"]'( node: TSESTree.LogicalExpression, ): void { @@ -186,6 +197,7 @@ export default createRule< return leftPrecedence < OperatorPrecedence.LeftHandSide; } + checkNullishAndReport(context, parserServices, options, [leftNode], { node: parentNode, messageId: 'preferOptionalChain', 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 71e5efe2f74d..47c4dfaa023b 100644 --- a/packages/eslint-plugin/src/rules/prefer-readonly-parameter-types.ts +++ b/packages/eslint-plugin/src/rules/prefer-readonly-parameter-types.ts @@ -7,6 +7,7 @@ import type { TypeOrValueSpecifier } from '../util'; import { createRule, getParserServices, + isTypeBrandedLiteralLike, isTypeReadonly, readonlynessOptionsDefaults, readonlynessOptionsSchema, @@ -129,7 +130,7 @@ export default createRule({ treatMethodsAsReadonly: !!treatMethodsAsReadonly, }); - if (!isReadOnly) { + if (!isReadOnly && !isTypeBrandedLiteralLike(type)) { context.report({ node: actualParam, messageId: 'shouldBeReadonly', diff --git a/packages/eslint-plugin/src/rules/prefer-return-this-type.ts b/packages/eslint-plugin/src/rules/prefer-return-this-type.ts index 7d7b14044cfb..ef5733fd47ff 100644 --- a/packages/eslint-plugin/src/rules/prefer-return-this-type.ts +++ b/packages/eslint-plugin/src/rules/prefer-return-this-type.ts @@ -1,6 +1,7 @@ import type { TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; +import { isUnionType } from 'ts-api-utils'; import * as ts from 'typescript'; import { createRule, forEachReturnStatement, getParserServices } from '../util'; @@ -116,6 +117,14 @@ export default createRule({ return; } + if ( + isUnionType(type) && + type.types.some(typePart => typePart === classType) + ) { + hasReturnClassType = true; + return true; + } + return; }); 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 ee946a4f85a0..8d15ad78e574 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 @@ -1,4 +1,8 @@ -import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; +import type { + NodeWithParent, + TSESLint, + TSESTree, +} from '@typescript-eslint/utils'; import { RegExpParser } from '@eslint-community/regexpp'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; @@ -96,7 +100,7 @@ export default createRule({ value: number, ): node is TSESTree.Literal { const evaluated = getStaticValue(node, globalScope); - return evaluated != null && evaluated.value === value; + return evaluated?.value === value; } /** @@ -376,13 +380,10 @@ export default createRule({ yield fixer.removeRange([callNode.range[1], node.range[1]]); } - function getParent(node: TSESTree.Node): TSESTree.Node { - return nullThrows( - node.parent?.type === AST_NODE_TYPES.ChainExpression - ? node.parent.parent - : node.parent, - NullThrowsReasons.MissingParent, - ); + function getParent(node: NodeWithParent): TSESTree.Node { + return node.parent.type === AST_NODE_TYPES.ChainExpression + ? node.parent.parent + : node.parent; } return { diff --git a/packages/eslint-plugin/src/rules/promise-function-async.ts b/packages/eslint-plugin/src/rules/promise-function-async.ts index 1739e1508937..aca8a2f924f7 100644 --- a/packages/eslint-plugin/src/rules/promise-function-async.ts +++ b/packages/eslint-plugin/src/rules/promise-function-async.ts @@ -208,14 +208,16 @@ export default createRule({ ); } - // if current token is a keyword like `static` or `public` then skip it + // if current token is a keyword like `static` or `public`, or the `override` modifier, then skip it while ( - keyToken.type === AST_TOKEN_TYPES.Keyword && + (keyToken.type === AST_TOKEN_TYPES.Keyword || + (keyToken.type === AST_TOKEN_TYPES.Identifier && + keyToken.value === 'override')) && keyToken.range[0] < method.key.range[0] ) { keyToken = nullThrows( context.sourceCode.getTokenAfter(keyToken), - NullThrowsReasons.MissingToken('token', 'keyword'), + NullThrowsReasons.MissingToken('token', 'modifier keyword'), ); } diff --git a/packages/eslint-plugin/src/rules/return-await.ts b/packages/eslint-plugin/src/rules/return-await.ts index 0ee20eea92a8..f1312c9915f5 100644 --- a/packages/eslint-plugin/src/rules/return-await.ts +++ b/packages/eslint-plugin/src/rules/return-await.ts @@ -267,9 +267,9 @@ export default createRule({ function insertAwait( fixer: TSESLint.RuleFixer, node: TSESTree.Expression, - isHighPrecendence: boolean, + isHighPrecedence: boolean, ): TSESLint.RuleFix | TSESLint.RuleFix[] { - if (isHighPrecendence) { + if (isHighPrecedence) { return fixer.insertTextBefore(node, 'await '); } return [ diff --git a/packages/eslint-plugin/src/rules/typedef.ts b/packages/eslint-plugin/src/rules/typedef.ts index c46ec9ff1e76..a952ef44fd24 100644 --- a/packages/eslint-plugin/src/rules/typedef.ts +++ b/packages/eslint-plugin/src/rules/typedef.ts @@ -23,6 +23,10 @@ export default createRule({ name: 'typedef', meta: { type: 'suggestion', + deprecated: { + deprecatedSince: '8.33.0', + message: 'This is an old rule that is no longer recommended for use.', + }, docs: { description: 'Require type annotations in certain places', }, diff --git a/packages/eslint-plugin/src/rules/unbound-method.ts b/packages/eslint-plugin/src/rules/unbound-method.ts index f92061f148d4..49f8dbe23802 100644 --- a/packages/eslint-plugin/src/rules/unbound-method.ts +++ b/packages/eslint-plugin/src/rules/unbound-method.ts @@ -100,8 +100,10 @@ const isNotImported = ( ); }; -const BASE_MESSAGE = - 'Avoid referencing unbound methods which may cause unintentional scoping of `this`.'; +const BASE_MESSAGE = [ + `A method that is not declared with \`this: void\` may cause unintentional scoping of \`this\` when separated from its object.`, + `Consider using an arrow function or explicitly \`.bind()\`ing the method to avoid calling the method with an unintended \`this\` value. `, +].join('\n'); export default createRule({ name: 'unbound-method', @@ -115,7 +117,7 @@ export default createRule({ }, messages: { unbound: BASE_MESSAGE, - unboundWithoutThisAnnotation: `${BASE_MESSAGE}\nIf your function does not access \`this\`, you can annotate it with \`this: void\`, or consider using an arrow function instead.`, + unboundWithoutThisAnnotation: `${BASE_MESSAGE}\nIf a function does not access \`this\`, it can be annotated with \`this: void\`.`, }, schema: [ { diff --git a/packages/eslint-plugin/src/rules/unified-signatures.ts b/packages/eslint-plugin/src/rules/unified-signatures.ts index 809b19dd1aa6..47e148197f1b 100644 --- a/packages/eslint-plugin/src/rules/unified-signatures.ts +++ b/packages/eslint-plugin/src/rules/unified-signatures.ts @@ -241,9 +241,8 @@ export default createRule({ } if (ignoreOverloadsWithDifferentJSDoc) { - const aComment = getBlockCommentForNode(getExportingNode(a) ?? a); - const bComment = getBlockCommentForNode(getExportingNode(b) ?? b); - + const aComment = getBlockCommentForNode(getCommentTargetNode(a)); + const bComment = getBlockCommentForNode(getCommentTargetNode(b)); if (aComment?.value !== bComment?.value) { return false; } @@ -657,6 +656,14 @@ export default createRule({ }, }); +function getCommentTargetNode(node: SignatureDefinition) { + if (node.type === AST_NODE_TYPES.TSEmptyBodyFunctionExpression) { + return node.parent; + } + + return getExportingNode(node) ?? node; +} + function getExportingNode( node: SignatureDefinition, ): diff --git a/packages/eslint-plugin/src/util/astUtils.ts b/packages/eslint-plugin/src/util/astUtils.ts index c2450ae30130..1d8500052634 100644 --- a/packages/eslint-plugin/src/util/astUtils.ts +++ b/packages/eslint-plugin/src/util/astUtils.ts @@ -11,9 +11,9 @@ export * from '@typescript-eslint/utils/ast-utils'; // https://github.com/eslint/eslint/blob/145aec1ab9052fbca96a44d04927c595951b1536/lib/rules/utils/ast-utils.js#L1751-L1779 // Could be export { getNameLocationInGlobalDirectiveComment } from 'eslint/lib/rules/utils/ast-utils' /** - * Get the `loc` object of a given name in a `/*globals` directive comment. + * Get the `loc` object of a given name in a `/*globals` comment directive. * @param sourceCode The source code to convert index to loc. - * @param comment The `/*globals` directive comment which include the name. + * @param comment The `/*globals` comment directive which include the name. * @param name The name to find. * @returns The `loc` object. */ diff --git a/packages/eslint-plugin/src/util/collectUnusedVariables.ts b/packages/eslint-plugin/src/util/collectUnusedVariables.ts index d61b121fa5ba..c98529f68a63 100644 --- a/packages/eslint-plugin/src/util/collectUnusedVariables.ts +++ b/packages/eslint-plugin/src/util/collectUnusedVariables.ts @@ -188,7 +188,7 @@ class UnusedVarsVisitor extends Visitor { // basic exported variables isExported(variable) || // variables implicitly exported via a merged declaration - isMergableExported(variable) || + isMergeableExported(variable) || // used variables isUsedVariable(variable) ) { @@ -230,9 +230,7 @@ class UnusedVarsVisitor extends Visitor { private markVariableAsUsed( variableOrIdentifier: ScopeVariable | TSESTree.Identifier, ): void; - private markVariableAsUsed(name: string, parent: TSESTree.Node): void; - private markVariableAsUsed( variableOrIdentifierOrName: string | ScopeVariable | TSESTree.Identifier, parent?: TSESTree.Node, @@ -417,7 +415,7 @@ function isSelfReference( return false; } -const MERGABLE_TYPES = new Set([ +const MERGEABLE_TYPES = new Set([ AST_NODE_TYPES.ClassDeclaration, AST_NODE_TYPES.FunctionDeclaration, AST_NODE_TYPES.TSInterfaceDeclaration, @@ -428,7 +426,7 @@ const MERGABLE_TYPES = new Set([ * Determine if the variable is directly exported * @param variable the variable to check */ -function isMergableExported(variable: ScopeVariable): boolean { +function isMergeableExported(variable: ScopeVariable): boolean { // If all of the merged things are of the same type, TS will error if not all of them are exported - so we only need to find one for (const def of variable.defs) { // parameters can never be exported. @@ -439,9 +437,9 @@ function isMergableExported(variable: ScopeVariable): boolean { } if ( - (MERGABLE_TYPES.has(def.node.type) && - def.node.parent?.type === AST_NODE_TYPES.ExportNamedDeclaration) || - def.node.parent?.type === AST_NODE_TYPES.ExportDefaultDeclaration + (MERGEABLE_TYPES.has(def.node.type) && + def.node.parent.type === AST_NODE_TYPES.ExportNamedDeclaration) || + def.node.parent.type === AST_NODE_TYPES.ExportDefaultDeclaration ) { return true; } @@ -460,14 +458,12 @@ function isExported(variable: ScopeVariable): boolean { let node = definition.node; if (node.type === AST_NODE_TYPES.VariableDeclarator) { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - node = node.parent!; + node = node.parent; } else if (definition.type === TSESLint.Scope.DefinitionType.Parameter) { return false; } - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - return node.parent!.type.startsWith('Export'); + return node.parent.type.startsWith('Export'); }); } diff --git a/packages/eslint-plugin/src/util/explicitReturnTypeUtils.ts b/packages/eslint-plugin/src/util/explicitReturnTypeUtils.ts index 0e3b98ef7657..b9aeb65dbede 100644 --- a/packages/eslint-plugin/src/util/explicitReturnTypeUtils.ts +++ b/packages/eslint-plugin/src/util/explicitReturnTypeUtils.ts @@ -1,10 +1,6 @@ import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; -import { - AST_NODE_TYPES, - ASTUtils, - ESLintUtils, -} from '@typescript-eslint/utils'; +import { AST_NODE_TYPES, ASTUtils } from '@typescript-eslint/utils'; import { isConstructor, isSetter, isTypeAssertion } from './astUtils'; import { getFunctionHeadLoc } from './getFunctionHeadLoc'; @@ -210,19 +206,14 @@ export function isTypedFunctionExpression( node: FunctionExpression, options: Options, ): boolean { - const parent = ESLintUtils.nullThrows( - node.parent, - ESLintUtils.NullThrowsReasons.MissingParent, - ); - if (!options.allowTypedFunctionExpressions) { return false; } return ( - isTypedParent(parent, node) || - isPropertyOfObjectWithType(parent) || - isConstructorArgument(parent) + isTypedParent(node.parent, node) || + isPropertyOfObjectWithType(node.parent) || + isConstructorArgument(node.parent) ); } @@ -238,16 +229,12 @@ export function isValidFunctionExpressionReturnType( return true; } - const parent = ESLintUtils.nullThrows( - node.parent, - ESLintUtils.NullThrowsReasons.MissingParent, - ); if ( options.allowExpressions && - parent.type !== AST_NODE_TYPES.VariableDeclarator && - parent.type !== AST_NODE_TYPES.MethodDefinition && - parent.type !== AST_NODE_TYPES.ExportDefaultDeclaration && - parent.type !== AST_NODE_TYPES.PropertyDefinition + node.parent.type !== AST_NODE_TYPES.VariableDeclarator && + node.parent.type !== AST_NODE_TYPES.MethodDefinition && + node.parent.type !== AST_NODE_TYPES.ExportDefaultDeclaration && + node.parent.type !== AST_NODE_TYPES.PropertyDefinition ) { return true; } diff --git a/packages/eslint-plugin/src/util/getFunctionHeadLoc.ts b/packages/eslint-plugin/src/util/getFunctionHeadLoc.ts index 49ab2b742dd9..53987cddc37b 100644 --- a/packages/eslint-plugin/src/util/getFunctionHeadLoc.ts +++ b/packages/eslint-plugin/src/util/getFunctionHeadLoc.ts @@ -154,8 +154,8 @@ export function getFunctionHeadLoc( sourceCode: TSESLint.SourceCode, ): TSESTree.SourceLocation { const parent = node.parent; - let start: TSESTree.Position | null = null; - let end: TSESTree.Position | null = null; + let start: TSESTree.Position; + let end: TSESTree.Position; if ( parent.type === AST_NODE_TYPES.MethodDefinition || diff --git a/packages/eslint-plugin/src/util/getOperatorPrecedence.ts b/packages/eslint-plugin/src/util/getOperatorPrecedence.ts index 950708015d89..54b40af26e28 100644 --- a/packages/eslint-plugin/src/util/getOperatorPrecedence.ts +++ b/packages/eslint-plugin/src/util/getOperatorPrecedence.ts @@ -198,6 +198,10 @@ export enum OperatorPrecedence { Invalid = -1, } +/** + * Note that this does not take into account parenthesization. You should check + * for parenthesization separately if it's relevant to your usage. + */ export function getOperatorPrecedenceForNode( node: TSESTree.Node, ): OperatorPrecedence { diff --git a/packages/eslint-plugin/src/util/isPromiseAggregatorMethod.ts b/packages/eslint-plugin/src/util/isPromiseAggregatorMethod.ts new file mode 100644 index 000000000000..e5f9e67617d6 --- /dev/null +++ b/packages/eslint-plugin/src/util/isPromiseAggregatorMethod.ts @@ -0,0 +1,41 @@ +import type { + ParserServicesWithTypeInformation, + TSESTree, +} from '@typescript-eslint/utils'; +import type { RuleContext } from '@typescript-eslint/utils/ts-eslint'; + +import { + getConstrainedTypeAtLocation, + isPromiseConstructorLike, +} from '@typescript-eslint/type-utils'; +import { AST_NODE_TYPES } from '@typescript-eslint/utils'; + +import { getStaticMemberAccessValue } from './misc'; + +const PROMISE_CONSTRUCTOR_ARRAY_METHODS = new Set([ + 'all', + 'allSettled', + 'race', + 'any', +]); + +export function isPromiseAggregatorMethod( + context: RuleContext, + services: ParserServicesWithTypeInformation, + node: TSESTree.CallExpression, +): boolean { + if (node.callee.type !== AST_NODE_TYPES.MemberExpression) { + return false; + } + + const staticAccessValue = getStaticMemberAccessValue(node.callee, context); + + if (!PROMISE_CONSTRUCTOR_ARRAY_METHODS.has(staticAccessValue)) { + return false; + } + + return isPromiseConstructorLike( + services.program, + getConstrainedTypeAtLocation(services, node.callee.object), + ); +} diff --git a/packages/eslint-plugin/tests/RuleTester.ts b/packages/eslint-plugin/tests/RuleTester.ts index bc0317c8a466..c2e314860ae3 100644 --- a/packages/eslint-plugin/tests/RuleTester.ts +++ b/packages/eslint-plugin/tests/RuleTester.ts @@ -1,85 +1,37 @@ -import type { - InvalidTestCase, - ValidTestCase, -} from '@typescript-eslint/rule-tester'; +import type { ParserOptions } from '@typescript-eslint/utils/ts-eslint'; +import { RuleTester } from '@typescript-eslint/rule-tester'; import * as path from 'node:path'; -export function getFixturesRootDir(): string { - return path.join(__dirname, 'fixtures'); +export function createRuleTesterWithTypes( + providedParserOptions: ParserOptions | undefined = {}, +): RuleTester { + const parserOptions = { + ...providedParserOptions, + tsconfigRootDir: + providedParserOptions.tsconfigRootDir ?? getFixturesRootDir(), + }; + + // If the test has requested a specific project, disable projectService + // (regardless of whether it's being switched to by TYPESCRIPT_ESLINT_PROJECT_SERVICE) + if (parserOptions.project) { + parserOptions.projectService = false; + } + // Otherwise, use the project service for types if requested in the env + else if (process.env.TYPESCRIPT_ESLINT_PROJECT_SERVICE) { + parserOptions.projectService = true; + } + // Finally, default to project: true as the standard (legacy) behavior + // See: https://github.com/typescript-eslint/typescript-eslint/issues/11676 + else { + parserOptions.project = true; + } + + return new RuleTester({ + languageOptions: { parserOptions }, + }); } -/** - * Converts a batch of single line tests into a number of separate test cases. - * This makes it easier to write tests which use the same options. - * - * Why wouldn't you just leave them as one test? - * Because it makes the test error messages harder to decipher. - * This way each line will fail separately, instead of them all failing together. - * - * @deprecated - DO NOT USE THIS FOR NEW RULES - */ -export function batchedSingleLineTests( - test: ValidTestCase, -): ValidTestCase[]; -/** - * Converts a batch of single line tests into a number of separate test cases. - * This makes it easier to write tests which use the same options. - * - * Why wouldn't you just leave them as one test? - * Because it makes the test error messages harder to decipher. - * This way each line will fail separately, instead of them all failing together. - * - * Make sure you have your line numbers correct for error reporting, as it will match - * the line numbers up with the split tests! - * - * @deprecated - DO NOT USE THIS FOR NEW RULES - */ -export function batchedSingleLineTests< - MessageIds extends string, - Options extends readonly unknown[], ->( - test: InvalidTestCase, -): InvalidTestCase[]; -export function batchedSingleLineTests< - MessageIds extends string, - Options extends readonly unknown[], ->( - options: - | ({ - output?: string | null; - } & Omit, 'output'>) - | ValidTestCase, -): (InvalidTestCase | ValidTestCase)[] { - // -- eslint counts lines from 1 - const lineOffset = options.code.startsWith('\n') ? 2 : 1; - const output = - 'output' in options && options.output - ? options.output.trim().split('\n') - : null; - return options.code - .trim() - .split('\n') - .map((code, i) => { - const lineNum = i + lineOffset; - const errors = - 'errors' in options - ? options.errors.filter(e => e.line === lineNum) - : []; - const returnVal = { - ...options, - code, - errors: errors.map(e => ({ - ...e, - line: 1, - })), - }; - if (output?.[i]) { - return { - ...returnVal, - output: output[i], - }; - } - return returnVal; - }); +export function getFixturesRootDir(): string { + return path.join(__dirname, 'fixtures'); } diff --git a/packages/eslint-plugin/tests/docs-eslint-output-snapshots/no-base-to-string.shot b/packages/eslint-plugin/tests/docs-eslint-output-snapshots/no-base-to-string.shot index ac8bfaecc474..ae8614ebe762 100644 --- a/packages/eslint-plugin/tests/docs-eslint-output-snapshots/no-base-to-string.shot +++ b/packages/eslint-plugin/tests/docs-eslint-output-snapshots/no-base-to-string.shot @@ -56,3 +56,9 @@ let value = /regex/; value.toString(); let text = `${value}`; String(/regex/); + +Options: { "checkUnknown": true } + +declare const x: unknown; +String(x); + ~ 'x' may use Object's default stringification format ('[object Object]') when stringified. diff --git a/packages/eslint-plugin/tests/docs-eslint-output-snapshots/no-floating-promises.shot b/packages/eslint-plugin/tests/docs-eslint-output-snapshots/no-floating-promises.shot index 8cdd60d375d6..9a5130ce0c07 100644 --- a/packages/eslint-plugin/tests/docs-eslint-output-snapshots/no-floating-promises.shot +++ b/packages/eslint-plugin/tests/docs-eslint-output-snapshots/no-floating-promises.shot @@ -135,4 +135,3 @@ Options: {"allowForKnownSafeCalls":[{"from":"file","name":"safe","path":"input.t declare function safe(...args: unknown[]): Promise; safe('...', () => {}); -~~~~~~~~~~~~~~~~~~~~~~ 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. diff --git a/packages/eslint-plugin/tests/docs-eslint-output-snapshots/no-misused-promises.shot b/packages/eslint-plugin/tests/docs-eslint-output-snapshots/no-misused-promises.shot index 3d0a679af53c..4eca533783eb 100644 --- a/packages/eslint-plugin/tests/docs-eslint-output-snapshots/no-misused-promises.shot +++ b/packages/eslint-plugin/tests/docs-eslint-output-snapshots/no-misused-promises.shot @@ -130,14 +130,14 @@ Options: { "checksSpreads": true } const getData = () => fetch('/'); console.log({ foo: 42, ...getData() }); - ~~~~~~~~~ Expected a non-Promise value to be spreaded in an object. + ~~~~~~~~~ Expected a non-Promise value to be spread in an object. const awaitData = async () => { await fetch('/'); }; console.log({ foo: 42, ...awaitData() }); - ~~~~~~~~~~~ Expected a non-Promise value to be spreaded in an object. + ~~~~~~~~~~~ Expected a non-Promise value to be spread in an object. Correct Options: { "checksSpreads": true } diff --git a/packages/eslint-plugin/tests/docs-eslint-output-snapshots/no-misused-spread.shot b/packages/eslint-plugin/tests/docs-eslint-output-snapshots/no-misused-spread.shot index 591c08061e87..78c83f38a361 100644 --- a/packages/eslint-plugin/tests/docs-eslint-output-snapshots/no-misused-spread.shot +++ b/packages/eslint-plugin/tests/docs-eslint-output-snapshots/no-misused-spread.shot @@ -4,7 +4,7 @@ declare const promise: Promise; const spreadPromise = { ...promise }; ~~~~~~~~~~ Using the spread operator on Promise in an object can cause unexpected behavior. Did you forget to await the promise? -declare function getObject(): Record; +declare function getObject(): Record; const getObjectSpread = { ...getObject }; ~~~~~~~~~~~~ Using the spread operator on a function without additional properties can cause unexpected behavior. Did you forget to call the function? @@ -37,7 +37,7 @@ Correct declare const promise: Promise; const spreadPromise = { ...(await promise) }; -declare function getObject(): Record; +declare function getObject(): Record; const getObjectSpread = { ...getObject() }; declare const map: Map; diff --git a/packages/eslint-plugin/tests/docs-eslint-output-snapshots/no-unnecessary-type-conversion.shot b/packages/eslint-plugin/tests/docs-eslint-output-snapshots/no-unnecessary-type-conversion.shot index 1231d273a43f..7d55981cea0f 100644 --- a/packages/eslint-plugin/tests/docs-eslint-output-snapshots/no-unnecessary-type-conversion.shot +++ b/packages/eslint-plugin/tests/docs-eslint-output-snapshots/no-unnecessary-type-conversion.shot @@ -14,7 +14,7 @@ Number(123); +123; ~ Using the unary + operator on a number does not change the type or value of the number. ~~123; -~~ Using ~~ on a number does not change the type or value of the number. +~~ Using ~~ on an integer does not change the type or value of the number. Boolean(true); ~~~~~~~ Passing a boolean to Boolean() does not change the type or value of the boolean. diff --git a/packages/eslint-plugin/tests/docs-eslint-output-snapshots/no-unsafe-member-access.shot b/packages/eslint-plugin/tests/docs-eslint-output-snapshots/no-unsafe-member-access.shot index fee1bc00f418..91a7260593f1 100644 --- a/packages/eslint-plugin/tests/docs-eslint-output-snapshots/no-unsafe-member-access.shot +++ b/packages/eslint-plugin/tests/docs-eslint-output-snapshots/no-unsafe-member-access.shot @@ -43,3 +43,20 @@ arr[1]; let idx = 1; arr[idx]; arr[idx++]; + +Incorrect + +declare const outer: any; + +outer.inner; + ~~~~~ Unsafe member access .inner on an `any` value. +outer.middle.inner; + ~~~~~~ Unsafe member access .middle on an `any` value. + +Correct +Options: { "allowOptionalChaining": true } + +declare const outer: any; + +outer?.inner; +outer?.middle?.inner; diff --git a/packages/eslint-plugin/tests/docs-eslint-output-snapshots/only-throw-error.shot b/packages/eslint-plugin/tests/docs-eslint-output-snapshots/only-throw-error.shot index a80221b72f8e..b91ec3c08a90 100644 --- a/packages/eslint-plugin/tests/docs-eslint-output-snapshots/only-throw-error.shot +++ b/packages/eslint-plugin/tests/docs-eslint-output-snapshots/only-throw-error.shot @@ -9,32 +9,24 @@ throw 0; throw undefined; ~~~~~~~~~ Do not throw undefined. -throw null; - ~~~~ Expected an error object to be thrown. - -const err = new Error(); -throw 'an ' + err; - ~~~~~~~~~~~ Expected an error object to be thrown. - -const err = new Error(); -throw `${err}`; - ~~~~~~~~ Expected an error object to be thrown. - -const err = ''; -throw err; - -function getError() { +function getErrorString(): string { return ''; } -throw getError(); - ~~~~~~~~~~ Expected an error object to be thrown. +throw getErrorString(); + ~~~~~~~~~~~~~~~~ Expected an error object to be thrown. const foo = { - bar: '', + bar: 'error string', }; throw foo.bar; ~~~~~~~ Expected an error object to be thrown. +class SomeClass { + // ... +} +throw new SomeClass(); + ~~~~~~~~~~~~~~~ Expected an error object to be thrown. + Correct throw new Error(); @@ -44,15 +36,6 @@ throw new Error('error'); const e = new Error('error'); throw e; -try { - throw new Error('error'); -} catch (e) { - throw e; -} - -const err = new Error(); -throw err; - function getError() { return new Error(); } @@ -67,3 +50,71 @@ class CustomError extends Error { // ... } throw new CustomError(); + +Options: { "allowThrowingAny": true } + +function throwAny(value: any) { + throw value; +} + +Options: { "allowThrowingUnknown": true } + +function throwUnknown(value: unknown) { + throw value; +} + +Options: { "allowRethrowing": true, "allowThrowingAny": false, "allowThrowingUnknown": false } + +declare function mightThrow(): void; +declare class SomeSpecificError extends Error { + // ... +} + +function foo() { + try { + mightThrow(); + } catch (e) { + if (e instanceof SomeSpecificError) { + // handle specific error ... + return; + } + + // unexpected error that we shouldn't catch. + throw e; + } +} + +declare function mightReject(): Promise; + +mightReject().catch(e => { + if (e instanceof SomeSpecificError) { + // handle specific error ... + return; + } + + // unexpected error that we can't handle + throw e; +}); + +declare function log(message: string): void; + +function bar() { + log('starting bar()'); + let wasError = false; + try { + // ... + } catch (e) { + wasError = true; + throw e; + } finally { + log(`completed bar() ${wasError ? 'with error' : 'successfully'}`); + } +} + +Options: { "allow": [{ "from": "file", "name": "CustomError" }] } + +class CustomError /* does NOT extend Error */ { + // ... +} + +throw new CustomError(); diff --git a/packages/eslint-plugin/tests/docs-eslint-output-snapshots/prefer-optional-chain.shot b/packages/eslint-plugin/tests/docs-eslint-output-snapshots/prefer-optional-chain.shot index 8607ddca5bca..657b431aa542 100644 --- a/packages/eslint-plugin/tests/docs-eslint-output-snapshots/prefer-optional-chain.shot +++ b/packages/eslint-plugin/tests/docs-eslint-output-snapshots/prefer-optional-chain.shot @@ -26,14 +26,8 @@ foo && foo.a && foo.a.b && foo.a.b.method && foo.a.b.method(); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Prefer using an optional chain expression instead, as it's more concise and easier to read. // this rule also supports converting chained strict nullish checks: -foo && -~~~~~~ Prefer using an optional chain expression instead, as it's more concise and easier to read. - foo.a != null && -~~~~~~~~~~~~~~~ - foo.a.b !== null && - foo.a.b.c != undefined && - foo.a.b.c.d !== undefined && - foo.a.b.c.d.e; +foo.a !== null && foo.a !== undefined && foo.a.b; +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Prefer using an optional chain expression instead, as it's more concise and easier to read. Correct @@ -47,6 +41,8 @@ foo?.a?.b?.c?.d?.e; !foo?.[bar]; !foo?.bar?.baz?.(); +foo?.a != null; + Options: { "allowPotentiallyUnsafeFixesThatModifyTheReturnTypeIKnowWhatImDoing": true } declare const foo: { bar: boolean } | null | undefined; diff --git a/packages/eslint-plugin/tests/docs-eslint-output-snapshots/unbound-method.shot b/packages/eslint-plugin/tests/docs-eslint-output-snapshots/unbound-method.shot index 13afc36a6e62..54db9a5b5cb7 100644 --- a/packages/eslint-plugin/tests/docs-eslint-output-snapshots/unbound-method.shot +++ b/packages/eslint-plugin/tests/docs-eslint-output-snapshots/unbound-method.shot @@ -10,14 +10,16 @@ const instance = new MyClass(); // This logs the global scope (`window`/`global`), not the class instance const myLog = instance.log; - ~~~~~~~~~~~~ Avoid referencing unbound methods which may cause unintentional scoping of `this`. - If your function does not access `this`, you can annotate it with `this: void`, or consider using an arrow function instead. + ~~~~~~~~~~~~ A method that is not declared with `this: void` may cause unintentional scoping of `this` when separated from its object. + Consider using an arrow function or explicitly `.bind()`ing the method to avoid calling the method with an unintended `this` value. + If a function does not access `this`, it can be annotated with `this: void`. myLog(); // This log might later be called with an incorrect scope const { log } = instance; - ~~~ Avoid referencing unbound methods which may cause unintentional scoping of `this`. - If your function does not access `this`, you can annotate it with `this: void`, or consider using an arrow function instead. + ~~~ A method that is not declared with `this: void` may cause unintentional scoping of `this` when separated from its object. + Consider using an arrow function or explicitly `.bind()`ing the method to avoid calling the method with an unintended `this` value. + If a function does not access `this`, it can be annotated with `this: void`. // arith.double may refer to `this` internally const arith = { @@ -26,8 +28,9 @@ const arith = { }, }; const { double } = arith; - ~~~~~~ Avoid referencing unbound methods which may cause unintentional scoping of `this`. - If your function does not access `this`, you can annotate it with `this: void`, or consider using an arrow function instead. + ~~~~~~ A method that is not declared with `this: void` may cause unintentional scoping of `this` when separated from its object. + Consider using an arrow function or explicitly `.bind()`ing the method to avoid calling the method with an unintended `this` value. + If a function does not access `this`, it can be annotated with `this: void`. Correct diff --git a/packages/eslint-plugin/tests/docs.test.mts b/packages/eslint-plugin/tests/docs.test.mts index ea12c3e02179..20693dd21762 100644 --- a/packages/eslint-plugin/tests/docs.test.mts +++ b/packages/eslint-plugin/tests/docs.test.mts @@ -428,6 +428,7 @@ describe('Validating rule docs', () => { parserOptions: { disallowAutomaticSingleRunInference: true, project: './tsconfig.json', + projectService: false, tsconfigRootDir: FIXTURES_DIR, }, rules: Object.fromEntries(ruleEntries), diff --git a/packages/eslint-plugin/tests/fixtures/deprecated.ts b/packages/eslint-plugin/tests/fixtures/deprecated.ts index 2302eabd3f54..b8dc49fcf16d 100644 --- a/packages/eslint-plugin/tests/fixtures/deprecated.ts +++ b/packages/eslint-plugin/tests/fixtures/deprecated.ts @@ -36,6 +36,11 @@ export { ClassWithDeprecatedConstructor as ReexportedClassWithDeprecatedConstructor, }; +/** @deprecated Reason */ +export type T = { a: string }; + +export type U = { b: string }; + /** @deprecated */ export default { foo: 1, diff --git a/packages/eslint-plugin/tests/rules/array-type.test.ts b/packages/eslint-plugin/tests/rules/array-type.test.ts index 0293bb97763b..65714e2928ea 100644 --- a/packages/eslint-plugin/tests/rules/array-type.test.ts +++ b/packages/eslint-plugin/tests/rules/array-type.test.ts @@ -1648,19 +1648,6 @@ function fooFunction(foo: ArrayClass[]) { options: [{ default: 'array' }], output: 'let x: any[];', }, - { - code: 'let x: Array<>;', - errors: [ - { - column: 8, - data: { className: 'Array', readonlyPrefix: '', type: 'any' }, - line: 1, - messageId: 'errorStringArray', - }, - ], - options: [{ default: 'array' }], - output: 'let x: any[];', - }, { code: 'let x: Array;', errors: [ @@ -1674,18 +1661,6 @@ function fooFunction(foo: ArrayClass[]) { options: [{ default: 'array-simple' }], output: 'let x: any[];', }, - { - code: 'let x: Array<>;', - errors: [ - { - column: 8, - line: 1, - messageId: 'errorStringArraySimple', - }, - ], - options: [{ default: 'array-simple' }], - output: 'let x: any[];', - }, { code: 'let x: Array = [1] as number[];', errors: [ @@ -2125,7 +2100,6 @@ type BrokenArray = { 'let yy: number[][] = [[4, 5], [6]];', 'let yy: Array> = [[4, 5], [6]];', ); - testOutput('array', 'let a: Array<>[] = [];', 'let a: any[][] = [];'); testOutput('array', 'let a: Array = [];', 'let a: any[][] = [];'); testOutput( 'array', @@ -2133,11 +2107,6 @@ type BrokenArray = { 'let a: any[][][] = [];', ); - testOutput( - 'generic', - 'let a: Array<>[] = [];', - 'let a: Array> = [];', - ); testOutput( 'generic', 'let a: Array = [];', diff --git a/packages/eslint-plugin/tests/rules/await-thenable.test.ts b/packages/eslint-plugin/tests/rules/await-thenable.test.ts index e64f0a5f1f3c..f0dca2e02f5f 100644 --- a/packages/eslint-plugin/tests/rules/await-thenable.test.ts +++ b/packages/eslint-plugin/tests/rules/await-thenable.test.ts @@ -1,18 +1,9 @@ -import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; +import { noFormat } from '@typescript-eslint/rule-tester'; import rule from '../../src/rules/await-thenable'; -import { getFixturesRootDir } from '../RuleTester'; +import { createRuleTesterWithTypes } from '../RuleTester'; -const rootDir = getFixturesRootDir(); - -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootDir, - }, - }, -}); +const ruleTester = createRuleTesterWithTypes(); ruleTester.run('await-thenable', rule, { valid: [ @@ -339,6 +330,365 @@ class C { } `, }, + + { + code: ` +// @ts-expect-error +Promise.all(); + `, + }, + { + code: ` +Promise.all([,]); + `, + }, + { + code: ` +declare const x: unknown; + +// @ts-expect-error +Promise.all(x); + `, + }, + { + code: ` +declare const x: any; +Promise.all(x); + `, + }, + + { + code: ` +declare const x: Array>; +Promise.all(x); + `, + }, + { + code: ` +declare const x: Array> | Array>; +Promise.all(x); + `, + }, + { + code: ` +declare const x: Array | Promise>; +Promise.all(x); + `, + }, + { + code: ` +function f(x: Array>) { + Promise.all(x); +} + `, + }, + { + code: ` +function f>(x: Array) { + Promise.all(x); +} + `, + }, + { + code: ` +declare const x: Array; +Promise.all(x); + `, + }, + { + code: ` +declare const x: Array; +Promise.all(x); + `, + }, + { + code: ` +declare const x: number | Array>; + +// @ts-expect-error +Promise.all(x); + `, + }, + + { + code: ` +declare const x: [Promise, Promise]; +Promise.all(x); + `, + }, + { + code: ` +declare const x: [Promise] | [Promise]; +Promise.all(x); + `, + }, + { + code: ` +declare const x: [Promise | Promise]; +Promise.all(x); + `, + }, + { + code: ` +function f(x: [Promise]) { + Promise.all(x); +} + `, + }, + { + code: ` +function f>(x: [T]) { + Promise.all(x); +} + `, + }, + { + code: ` +declare const x: [unknown, any]; +Promise.all(x); + `, + }, + { + code: ` +declare const x: number | [Promise]; + +// @ts-expect-error +Promise.all(x); + `, + }, + + { + code: ` +declare const x: Iterable>; +Promise.all(x); + `, + }, + { + code: ` +declare const x: Iterable> | Iterable>; + +// @ts-expect-error +Promise.all(x); + `, + }, + { + code: ` +declare const x: Iterable>; +Promise.all(x); + `, + }, + { + code: ` +function f(x: Iterable>) { + Promise.all(x); +} + `, + }, + { + code: ` +function f>(x: Iterable) { + Promise.all(x); +} + `, + }, + { + code: ` +declare const x: Iterable; +Promise.all(x); + `, + }, + { + code: ` +declare const x: Iterable; +Promise.all(x); + `, + }, + { + code: ` +declare const x: number | Iterable>; + +// @ts-expect-error +Promise.all(x); + `, + }, + { + code: ` +declare const x: Iterable, number>; +Promise.all(x); + `, + }, + + { + code: ` +declare const x: Iterable> | Array>; +Promise.all(x); + `, + }, + { + code: ` +declare const x: + | Iterable> + | [Promise, Promise]; +Promise.all(x); + `, + }, + { + code: ` +declare const x: Array> | [Promise, Promise]; +Promise.all(x); + `, + }, + + { + code: ` +// @ts-expect-error +Promise.all(1); + `, + }, + { + code: ` +declare const x: Promise; + +// @ts-expect-error +Promise.all(x); + `, + }, + { + code: ` +interface MyArray extends Array {} +declare const x: MyArray>; + +Promise.all(x); + `, + }, + { + code: ` +function* x() { + yield Promise.resolve(1); + yield Promise.resolve(2); + yield Promise.resolve(3); +} + +Promise.all(x()); + `, + }, + { + code: ` +function* x() { + yield 1 as unknown; +} + +Promise.all(x()); + `, + }, + { + code: ` +function* x() { + yield 1 as any; +} + +Promise.all(x()); + `, + }, + { + code: ` +declare const x: Generator>; +Promise.all(x); + `, + }, + { + code: ` +declare const x: Generator; +Promise.all(x); + `, + }, + { + code: ` +declare const x: Generator; +Promise.all(x); + `, + }, + { + code: ` +declare const x: ReadonlyArray>; +Promise.all(x); + `, + }, + { + code: ` +declare const x: ReadonlyArray; +Promise.all(x); + `, + }, + { + code: ` +declare const x: ReadonlyArray; +Promise.all(x); + `, + }, + { + code: ` +Promise.all([Promise.resolve(1), Promise.resolve(2), Promise.resolve(3)]); + `, + }, + { + code: ` +declare const _unknown_: unknown; + +Promise.all([ + _unknown_, + Promise.resolve(1), + Promise.resolve(2), + Promise.resolve(3), +]); + `, + }, + { + code: ` +declare const _any_: any; + +Promise.all([ + _any_, + Promise.resolve(1), + Promise.resolve(2), + Promise.resolve(3), +]); + `, + }, + { + code: ` +declare const _promise_: Promise; + +Promise.all([ + _promise_, + Promise.resolve(1), + Promise.resolve(2), + Promise.resolve(3), +]); + `, + }, + { + code: ` +Promise.all([ + Promise.resolve(1), + Promise.resolve(2), + Promise.resolve(3), + ...[Promise.resolve(4), Promise.resolve(5), Promise.resolve(6)], +]); + `, + }, + { + code: ` +declare const maybePromise: Promise | number; + +Promise.all([ + maybePromise, + Promise.resolve(1), + Promise.resolve(2), + Promise.resolve(3), +]); + `, + }, ], invalid: [ @@ -786,5 +1136,309 @@ class C { }, ], }, + + { + code: ` +declare const x: Array; +Promise.all(x); + `, + errors: [ + { + messageId: 'invalidPromiseAggregatorInput', + }, + ], + }, + { + code: ` +declare const x: Array | Array>; +Promise.race(x); + `, + errors: [ + { + messageId: 'invalidPromiseAggregatorInput', + }, + ], + }, + { + code: ` +declare const x: Array | Array; +Promise.allSettled(x); + `, + errors: [ + { + messageId: 'invalidPromiseAggregatorInput', + }, + ], + }, + { + code: ` +declare const x: Array>; +Promise.any(x); + `, + errors: [ + { + messageId: 'invalidPromiseAggregatorInput', + }, + ], + }, + + { + code: ` +declare const x: [number]; +Promise.all(x); + `, + errors: [ + { + messageId: 'invalidPromiseAggregatorInput', + }, + ], + }, + { + code: ` +declare const x: [number] | [Promise]; +Promise.all(x); + `, + errors: [ + { + messageId: 'invalidPromiseAggregatorInput', + }, + ], + }, + { + code: ` +declare const x: [number | Promise]; +Promise.all(x); + `, + errors: [ + { + messageId: 'invalidPromiseAggregatorInput', + }, + ], + }, + { + code: ` +declare const x: [Promise, number]; +Promise.all(x); + `, + errors: [ + { + messageId: 'invalidPromiseAggregatorInput', + }, + ], + }, + + { + code: ` +declare const x: Iterable; +Promise.all(x); + `, + errors: [ + { + messageId: 'invalidPromiseAggregatorInput', + }, + ], + }, + { + code: ` +declare const x: Iterable | Iterable>; +Promise.all(x); + `, + errors: [ + { + messageId: 'invalidPromiseAggregatorInput', + }, + ], + }, + { + code: ` +declare const x: Iterable>; +Promise.all(x); + `, + errors: [ + { + messageId: 'invalidPromiseAggregatorInput', + }, + ], + }, + + { + code: ` +declare const x: Iterable | Array>; +Promise.all(x); + `, + errors: [ + { + messageId: 'invalidPromiseAggregatorInput', + }, + ], + }, + { + code: ` +declare const x: Iterable> | [string, Promise]; +Promise.all(x); + `, + errors: [ + { + messageId: 'invalidPromiseAggregatorInput', + }, + ], + }, + { + code: ` +declare const x: Array | [Promise, Promise]; +Promise.all(x); + `, + errors: [ + { + messageId: 'invalidPromiseAggregatorInput', + }, + ], + }, + { + code: ` +declare const x: Array>>; +Promise.all(x); + `, + errors: [ + { + messageId: 'invalidPromiseAggregatorInput', + }, + ], + }, + { + code: ` +interface MyArray extends Array {} +declare const x: MyArray, null>; + +Promise.all(x); + `, + errors: [ + { + messageId: 'invalidPromiseAggregatorInput', + }, + ], + }, + { + code: ` +function* x() { + yield 1; + yield 2; + yield 3; +} + +Promise.all(x()); + `, + errors: [ + { + messageId: 'invalidPromiseAggregatorInput', + }, + ], + }, + { + code: ` +function* x() { + yield 1 as number; +} + +Promise.all(x()); + `, + errors: [ + { + messageId: 'invalidPromiseAggregatorInput', + }, + ], + }, + { + code: ` +function* x() { + yield 1 as number | Promise; +} + +Promise.all(x()); + `, + errors: [ + { + messageId: 'invalidPromiseAggregatorInput', + }, + ], + }, + { + code: ` +declare const x: Generator; +Promise.all(x); + `, + errors: [ + { + messageId: 'invalidPromiseAggregatorInput', + }, + ], + }, + { + code: ` +declare const x: ReadonlyArray; +Promise.all(x); + `, + errors: [ + { + messageId: 'invalidPromiseAggregatorInput', + }, + ], + }, + { + code: ` +declare const x: ReadonlyArray>; +Promise.all(x); + `, + errors: [ + { + messageId: 'invalidPromiseAggregatorInput', + }, + ], + }, + { + code: ` +Promise.all([Promise.resolve(1), 2, Promise.resolve(3)]); + `, + errors: [ + { + column: 34, + endColumn: 35, + line: 2, + messageId: 'invalidPromiseAggregatorInput', + }, + ], + }, + { + code: ` +Promise.all([1, 2, Promise.resolve(3)]); + `, + errors: [ + { + column: 14, + endColumn: 15, + line: 2, + messageId: 'invalidPromiseAggregatorInput', + }, + { + column: 17, + endColumn: 18, + line: 2, + messageId: 'invalidPromiseAggregatorInput', + }, + ], + }, + { + code: ` +Promise.all([...[1, 2, 3]]); + `, + errors: [ + { + column: 14, + endColumn: 26, + line: 2, + messageId: 'invalidPromiseAggregatorInput', + }, + ], + }, ], }); diff --git a/packages/eslint-plugin/tests/rules/ban-tslint-comment.test.ts b/packages/eslint-plugin/tests/rules/ban-tslint-comment.test.ts index 70ebf3d6f107..227d4f3ab3d8 100644 --- a/packages/eslint-plugin/tests/rules/ban-tslint-comment.test.ts +++ b/packages/eslint-plugin/tests/rules/ban-tslint-comment.test.ts @@ -2,50 +2,6 @@ import { RuleTester } from '@typescript-eslint/rule-tester'; import rule from '../../src/rules/ban-tslint-comment'; -interface Testable { - code: string; - column?: number; - line?: number; - output?: string; - text?: string; -} - -const PALANTIR_EXAMPLES: Testable[] = [ - { code: '/* tslint:disable */' }, // Disable all rules for the rest of the file - { code: '/* tslint:enable */' }, // Enable all rules for the rest of the file - { - code: '/* tslint:disable:rule1 rule2 rule3... */', - }, // Disable the listed rules for the rest of the file - { - code: '/* tslint:enable:rule1 rule2 rule3... */', - }, // Enable the listed rules for the rest of the file - { code: '// tslint:disable-next-line' }, // Disables all rules for the following line - { - code: 'someCode(); // tslint:disable-line', - column: 13, - output: 'someCode();', - text: '// tslint:disable-line', - }, // Disables all rules for the current line - { - code: '// tslint:disable-next-line:rule1 rule2 rule3...', - }, // Disables the listed rules for the next line -]; - -// prettier-ignore -const MORE_EXAMPLES: Testable[] = [ - { - code: `const woah = doSomeStuff(); -// tslint:disable-line -console.log(woah); -`, - line: 2, - output: `const woah = doSomeStuff(); -console.log(woah); -`, - text: '// tslint:disable-line', - }, -] - const ruleTester = new RuleTester(); ruleTester.run('ban-tslint-comment', rule, { @@ -66,18 +22,123 @@ ruleTester.run('ban-tslint-comment', rule, { code: '/* another comment that mentions tslint */', }, ], - invalid: [...PALANTIR_EXAMPLES, ...MORE_EXAMPLES].map( - ({ code, column, line, output, text }) => ({ - code, + invalid: [ + { + code: '/* tslint:disable */', + errors: [ + { + column: 1, + data: { + text: '/* tslint:disable */', + }, + line: 1, + messageId: 'commentDetected', + }, + ], + output: '', + }, + { + code: '/* tslint:enable */', + errors: [ + { + column: 1, + data: { + text: '/* tslint:enable */', + }, + line: 1, + messageId: 'commentDetected', + }, + ], + output: '', + }, + { + code: '/* tslint:disable:rule1 rule2 rule3... */', + errors: [ + { + column: 1, + data: { + text: '/* tslint:disable:rule1 rule2 rule3... */', + }, + line: 1, + messageId: 'commentDetected', + }, + ], + output: '', + }, + { + code: '/* tslint:enable:rule1 rule2 rule3... */', + errors: [ + { + column: 1, + data: { + text: '/* tslint:enable:rule1 rule2 rule3... */', + }, + line: 1, + messageId: 'commentDetected', + }, + ], + output: '', + }, + { + code: '// tslint:disable-next-line', + errors: [ + { + column: 1, + data: { + text: '// tslint:disable-next-line', + }, + line: 1, + messageId: 'commentDetected', + }, + ], + output: '', + }, + { + code: 'someCode(); // tslint:disable-line', errors: [ { - column: column ?? 1, - data: { text: text ?? code }, - line: line ?? 1, - messageId: 'commentDetected' as const, + column: 13, + data: { + text: '// tslint:disable-line', + }, + line: 1, + messageId: 'commentDetected', }, ], - output: output ?? '', - }), - ), + output: 'someCode();', + }, + { + code: '// tslint:disable-next-line:rule1 rule2 rule3...', + errors: [ + { + column: 1, + data: { text: '// tslint:disable-next-line:rule1 rule2 rule3...' }, + line: 1, + messageId: 'commentDetected', + }, + ], + output: '', + }, + { + code: ` +const woah = doSomeStuff(); +// tslint:disable-line +console.log(woah); + `, + errors: [ + { + column: 1, + data: { + text: '// tslint:disable-line', + }, + line: 3, + messageId: 'commentDetected', + }, + ], + output: ` +const woah = doSomeStuff(); +console.log(woah); + `, + }, + ], }); diff --git a/packages/eslint-plugin/tests/rules/class-methods-use-this/class-methods-use-this-core.test.ts b/packages/eslint-plugin/tests/rules/class-methods-use-this/class-methods-use-this-core.test.ts index d0193efdc99d..e07263df6e98 100644 --- a/packages/eslint-plugin/tests/rules/class-methods-use-this/class-methods-use-this-core.test.ts +++ b/packages/eslint-plugin/tests/rules/class-methods-use-this/class-methods-use-this-core.test.ts @@ -1,7 +1,6 @@ /* eslint-disable @typescript-eslint/internal/plugin-test-formatting -- keeping eslint core formatting on purpose to make upstream diffing easier and so we don't need to edit line/cols */ import { RuleTester } from '@typescript-eslint/rule-tester'; -import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import rule from '../../../src/rules/class-methods-use-this'; @@ -17,7 +16,6 @@ ruleTester.run('class-methods-use-this', rule, { data: { name: "method 'foo'" }, line: 1, messageId: 'missingThis', - type: AST_NODE_TYPES.FunctionExpression, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -30,7 +28,6 @@ ruleTester.run('class-methods-use-this', rule, { data: { name: "method 'foo'" }, line: 1, messageId: 'missingThis', - type: AST_NODE_TYPES.FunctionExpression, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -43,7 +40,6 @@ ruleTester.run('class-methods-use-this', rule, { data: { name: "method 'foo'" }, line: 1, messageId: 'missingThis', - type: AST_NODE_TYPES.FunctionExpression, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -56,7 +52,6 @@ ruleTester.run('class-methods-use-this', rule, { data: { name: "method 'foo'" }, line: 1, messageId: 'missingThis', - type: AST_NODE_TYPES.FunctionExpression, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -69,7 +64,6 @@ ruleTester.run('class-methods-use-this', rule, { data: { name: "method 'foo'" }, line: 1, messageId: 'missingThis', - type: AST_NODE_TYPES.FunctionExpression, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -82,7 +76,6 @@ ruleTester.run('class-methods-use-this', rule, { data: { name: "method 'foo'" }, line: 1, messageId: 'missingThis', - type: AST_NODE_TYPES.FunctionExpression, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -95,7 +88,6 @@ ruleTester.run('class-methods-use-this', rule, { data: { name: "method 'foo'" }, line: 1, messageId: 'missingThis', - type: AST_NODE_TYPES.FunctionExpression, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -108,7 +100,6 @@ ruleTester.run('class-methods-use-this', rule, { data: { name: "method 'foo'" }, line: 1, messageId: 'missingThis', - type: AST_NODE_TYPES.FunctionExpression, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -122,7 +113,6 @@ ruleTester.run('class-methods-use-this', rule, { data: { name: "method 'hasOwnProperty'" }, line: 1, messageId: 'missingThis', - type: AST_NODE_TYPES.FunctionExpression, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -136,7 +126,6 @@ ruleTester.run('class-methods-use-this', rule, { data: { name: 'method' }, line: 1, messageId: 'missingThis', - type: AST_NODE_TYPES.FunctionExpression, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -150,14 +139,12 @@ ruleTester.run('class-methods-use-this', rule, { data: { name: "method 'foo'" }, line: 1, messageId: 'missingThis', - type: AST_NODE_TYPES.FunctionExpression, }, { column: 31, data: { name: 'private method #bar' }, line: 1, messageId: 'missingThis', - type: AST_NODE_TYPES.FunctionExpression, }, ], languageOptions: { parserOptions: { ecmaVersion: 2022 } }, @@ -170,55 +157,46 @@ ruleTester.run('class-methods-use-this', rule, { column: 11, data: { name: "method 'foo'" }, messageId: 'missingThis', - type: AST_NODE_TYPES.FunctionExpression, }, { column: 19, data: { name: "method 'bar'" }, messageId: 'missingThis', - type: AST_NODE_TYPES.FunctionExpression, }, { column: 29, data: { name: "method '123'" }, messageId: 'missingThis', - type: AST_NODE_TYPES.FunctionExpression, }, { column: 37, data: { name: "method 'baz'" }, messageId: 'missingThis', - type: AST_NODE_TYPES.FunctionExpression, }, { column: 49, data: { name: 'method' }, messageId: 'missingThis', - type: AST_NODE_TYPES.FunctionExpression, }, { column: 57, data: { name: 'method' }, messageId: 'missingThis', - type: AST_NODE_TYPES.FunctionExpression, }, { column: 68, data: { name: "getter 'quux'" }, messageId: 'missingThis', - type: AST_NODE_TYPES.FunctionExpression, }, { column: 81, data: { name: 'setter' }, messageId: 'missingThis', - type: AST_NODE_TYPES.FunctionExpression, }, { column: 93, data: { name: "generator method 'quuux'" }, messageId: 'missingThis', - type: AST_NODE_TYPES.FunctionExpression, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, diff --git a/packages/eslint-plugin/tests/rules/consistent-generic-constructors.test.ts b/packages/eslint-plugin/tests/rules/consistent-generic-constructors.test.ts index 4d0403a85a87..1a573186b1ae 100644 --- a/packages/eslint-plugin/tests/rules/consistent-generic-constructors.test.ts +++ b/packages/eslint-plugin/tests/rules/consistent-generic-constructors.test.ts @@ -45,6 +45,16 @@ class A { ` const a = function (a: Foo = new Foo()) {}; `, + { + code: ` +const foo: Foo = new Foo(); + `, + languageOptions: { + parserOptions: { + isolatedDeclarations: true, + }, + }, + }, // type-annotation { code: 'const a = new Foo();', diff --git a/packages/eslint-plugin/tests/rules/consistent-return.test.ts b/packages/eslint-plugin/tests/rules/consistent-return.test.ts index e62345932396..0ee2908ef5b0 100644 --- a/packages/eslint-plugin/tests/rules/consistent-return.test.ts +++ b/packages/eslint-plugin/tests/rules/consistent-return.test.ts @@ -1,18 +1,7 @@ -import { RuleTester } from '@typescript-eslint/rule-tester'; -import { AST_NODE_TYPES } from '@typescript-eslint/utils'; - import rule from '../../src/rules/consistent-return'; -import { getFixturesRootDir } from '../RuleTester'; +import { createRuleTesterWithTypes } from '../RuleTester'; -const rootDir = getFixturesRootDir(); -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootDir, - }, - }, -}); +const ruleTester = createRuleTesterWithTypes(); ruleTester.run('consistent-return', rule, { valid: [ @@ -226,7 +215,6 @@ ruleTester.run('consistent-return', rule, { endLine: 4, line: 4, messageId: 'missingReturnValue', - type: AST_NODE_TYPES.ReturnStatement, }, ], }, @@ -246,7 +234,6 @@ ruleTester.run('consistent-return', rule, { endLine: 5, line: 5, messageId: 'missingReturnValue', - type: AST_NODE_TYPES.ReturnStatement, }, ], }, @@ -270,7 +257,6 @@ ruleTester.run('consistent-return', rule, { endLine: 6, line: 6, messageId: 'unexpectedReturnValue', - type: AST_NODE_TYPES.ReturnStatement, }, { column: 11, @@ -279,7 +265,6 @@ ruleTester.run('consistent-return', rule, { endLine: 9, line: 9, messageId: 'missingReturnValue', - type: AST_NODE_TYPES.ReturnStatement, }, ], }, @@ -298,7 +283,6 @@ ruleTester.run('consistent-return', rule, { endLine: 4, line: 4, messageId: 'missingReturnValue', - type: AST_NODE_TYPES.ReturnStatement, }, ], }, @@ -317,7 +301,6 @@ ruleTester.run('consistent-return', rule, { endLine: 4, line: 4, messageId: 'unexpectedReturnValue', - type: AST_NODE_TYPES.ReturnStatement, }, ], }, @@ -336,7 +319,6 @@ ruleTester.run('consistent-return', rule, { endLine: 4, line: 4, messageId: 'missingReturnValue', - type: AST_NODE_TYPES.ReturnStatement, }, ], }, @@ -355,7 +337,6 @@ ruleTester.run('consistent-return', rule, { endLine: 4, line: 4, messageId: 'unexpectedReturnValue', - type: AST_NODE_TYPES.ReturnStatement, }, ], }, @@ -374,7 +355,6 @@ ruleTester.run('consistent-return', rule, { endLine: 4, line: 4, messageId: 'unexpectedReturnValue', - type: AST_NODE_TYPES.ReturnStatement, }, ], }, @@ -396,7 +376,6 @@ ruleTester.run('consistent-return', rule, { endLine: 7, line: 7, messageId: 'missingReturnValue', - type: AST_NODE_TYPES.ReturnStatement, }, ], }, @@ -417,7 +396,6 @@ ruleTester.run('consistent-return', rule, { endLine: 6, line: 6, messageId: 'unexpectedReturnValue', - type: AST_NODE_TYPES.ReturnStatement, }, ], options: [ @@ -444,7 +422,6 @@ ruleTester.run('consistent-return', rule, { endLine: 7, line: 7, messageId: 'unexpectedReturnValue', - type: AST_NODE_TYPES.ReturnStatement, }, ], options: [ diff --git a/packages/eslint-plugin/tests/rules/consistent-type-assertions.test.ts b/packages/eslint-plugin/tests/rules/consistent-type-assertions.test.ts index bbefaa06f4c3..c11949c1e39c 100644 --- a/packages/eslint-plugin/tests/rules/consistent-type-assertions.test.ts +++ b/packages/eslint-plugin/tests/rules/consistent-type-assertions.test.ts @@ -1,322 +1,405 @@ -/* eslint-disable @typescript-eslint/no-deprecated -- TODO - migrate this test away from `batchedSingleLineTests` */ - import type { TSESTree } from '@typescript-eslint/utils'; import * as parser from '@typescript-eslint/parser'; import { RuleTester } from '@typescript-eslint/rule-tester'; -import type { - MessageIds, - Options, -} from '../../src/rules/consistent-type-assertions'; - import rule from '../../src/rules/consistent-type-assertions'; -import { dedupeTestCases } from '../dedupeTestCases'; -import { batchedSingleLineTests } from '../RuleTester'; const ruleTester = new RuleTester(); -const ANGLE_BRACKET_TESTS_EXCEPT_CONST_CASE = ` -const x = new Generic(); -const x = b; -const x = [1]; -const x = ('string'); -const x = !'string'; -const x = a + b; -const x = <(A)>a + (b); -const x = (new Generic()); -const x = new (Generic)(); -const x = new (Generic)('string'); -const x = () => { bar: 5 }; -const x = () => ({ bar: 5 }); -const x = () => bar; -const x = bar\`\${"baz"}\`;`; - -const ANGLE_BRACKET_TESTS = `${ANGLE_BRACKET_TESTS_EXCEPT_CONST_CASE} -const x = { key: 'value' }; -`; - -// Intentionally contains a duplicate in order to mirror ANGLE_BRACKET_TESTS_EXCEPT_CONST_CASE -const AS_TESTS_EXCEPT_CONST_CASE = ` -const x = new Generic() as Foo; -const x = b as A; -const x = [1] as readonly number[]; -const x = 'string' as a | b; -const x = !'string' as A; -const x = (a as A) + b; -const x = (a as A) + (b); -const x = new Generic() as Foo; -const x = new ((Generic) as Foo)(); -const x = new ((Generic) as Foo)('string'); -const x = () => ({ bar: 5 } as Foo); -const x = () => ({ bar: 5 } as Foo); -const x = () => (bar as Foo); -const x = bar\`\${"baz"}\` as Foo;`; - -const AS_TESTS = `${AS_TESTS_EXCEPT_CONST_CASE} -const x = { key: 'value' } as const; -`; - -const OBJECT_LITERAL_AS_CASTS = ` -const x = {} as Foo; -const x = ({}) as a | b; -const x = {} as A + b; -`; -const OBJECT_LITERAL_ANGLE_BRACKET_CASTS = ` -const x = >{}; -const x = ({}); -const x = {} + b; -`; -const OBJECT_LITERAL_ARGUMENT_AS_CASTS = ` -print({ bar: 5 } as Foo) -new print({ bar: 5 } as Foo) -function foo() { throw { bar: 5 } as Foo } -function b(x = {} as Foo.Bar) {} -function c(x = {} as Foo) {} -print?.({ bar: 5 } as Foo) -print?.call({ bar: 5 } as Foo) -print\`\${{ bar: 5 } as Foo}\` -`; -const OBJECT_LITERAL_ARGUMENT_ANGLE_BRACKET_CASTS = ` -print({ bar: 5 }) -new print({ bar: 5 }) -function foo() { throw { bar: 5 } } -print?.({ bar: 5 }) -print?.call({ bar: 5 }) -print\`\${{ bar: 5 }}\` -`; - ruleTester.run('consistent-type-assertions', rule, { valid: [ - ...dedupeTestCases( - batchedSingleLineTests({ - code: AS_TESTS, - options: [ - { assertionStyle: 'as', objectLiteralTypeAssertions: 'allow' }, - ], - }), - ), - ...batchedSingleLineTests({ - code: ANGLE_BRACKET_TESTS, + { + code: 'const x = new Generic() as Foo;', options: [ { - assertionStyle: 'angle-bracket', + assertionStyle: 'as', objectLiteralTypeAssertions: 'allow', }, ], - }), - ...batchedSingleLineTests({ - code: `${OBJECT_LITERAL_AS_CASTS.trimEnd()}${OBJECT_LITERAL_ARGUMENT_AS_CASTS}`, - options: [{ assertionStyle: 'as', objectLiteralTypeAssertions: 'allow' }], - }), - ...batchedSingleLineTests({ - code: `${OBJECT_LITERAL_ANGLE_BRACKET_CASTS.trimEnd()}${OBJECT_LITERAL_ARGUMENT_ANGLE_BRACKET_CASTS}`, + }, + { + code: 'const x = b as A;', options: [ { - assertionStyle: 'angle-bracket', + assertionStyle: 'as', objectLiteralTypeAssertions: 'allow', }, ], - }), - ...batchedSingleLineTests({ - code: OBJECT_LITERAL_ARGUMENT_AS_CASTS, + }, + { + code: 'const x = [1] as readonly number[];', options: [ { assertionStyle: 'as', - objectLiteralTypeAssertions: 'allow-as-parameter', + objectLiteralTypeAssertions: 'allow', }, ], - }), - ...batchedSingleLineTests({ - code: OBJECT_LITERAL_ARGUMENT_ANGLE_BRACKET_CASTS, + }, + { + code: "const x = 'string' as a | b;", options: [ { - assertionStyle: 'angle-bracket', - objectLiteralTypeAssertions: 'allow-as-parameter', + assertionStyle: 'as', + objectLiteralTypeAssertions: 'allow', }, ], - }), + }, { - code: 'const x = [] as string[];', + code: "const x = !'string' as A;", options: [ { assertionStyle: 'as', + objectLiteralTypeAssertions: 'allow', }, ], }, { - code: "const x = ['a'] as Array;", + code: 'const x = (a as A) + b;', options: [ { assertionStyle: 'as', + objectLiteralTypeAssertions: 'allow', }, ], }, { - code: 'const x = [];', + code: 'const x = new Generic() as Foo;', options: [ { - assertionStyle: 'angle-bracket', + assertionStyle: 'as', + objectLiteralTypeAssertions: 'allow', }, ], }, { - code: 'const x = >[];', + code: 'const x = new (Generic as Foo)();', options: [ { - assertionStyle: 'angle-bracket', + assertionStyle: 'as', + objectLiteralTypeAssertions: 'allow', }, ], }, { - code: 'print([5] as Foo);', + code: "const x = new (Generic as Foo)('string');", options: [ { - arrayLiteralTypeAssertions: 'allow-as-parameter', assertionStyle: 'as', + objectLiteralTypeAssertions: 'allow', }, ], }, { - code: ` -function foo() { - throw [5] as Foo; -} - `, + code: 'const x = () => ({ bar: 5 }) as Foo;', options: [ { - arrayLiteralTypeAssertions: 'allow-as-parameter', assertionStyle: 'as', + objectLiteralTypeAssertions: 'allow', }, ], }, { - code: 'function b(x = [5] as Foo.Bar) {}', + code: 'const x = () => bar as Foo;', options: [ { - arrayLiteralTypeAssertions: 'allow-as-parameter', assertionStyle: 'as', + objectLiteralTypeAssertions: 'allow', }, ], }, { - code: 'print?.([5] as Foo);', + code: "const x = bar`${'baz'}` as Foo;", options: [ { - arrayLiteralTypeAssertions: 'allow-as-parameter', assertionStyle: 'as', + objectLiteralTypeAssertions: 'allow', }, ], }, { - code: 'print?.call([5] as Foo);', + code: "const x = { key: 'value' } as const;", options: [ { - arrayLiteralTypeAssertions: 'allow-as-parameter', assertionStyle: 'as', + objectLiteralTypeAssertions: 'allow', }, ], }, { - code: 'print`${[5] as Foo}`;', + code: 'const x = new Generic();', options: [ { - arrayLiteralTypeAssertions: 'allow-as-parameter', - assertionStyle: 'as', + assertionStyle: 'angle-bracket', + objectLiteralTypeAssertions: 'allow', }, ], }, { - code: 'new Print([5] as Foo);', + code: 'const x = b;', options: [ { - arrayLiteralTypeAssertions: 'allow-as-parameter', - assertionStyle: 'as', + assertionStyle: 'angle-bracket', + objectLiteralTypeAssertions: 'allow', }, ], }, { - code: 'const bar = ;', - languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } }, + code: 'const x = [1];', options: [ { - arrayLiteralTypeAssertions: 'allow-as-parameter', - assertionStyle: 'as', + assertionStyle: 'angle-bracket', + objectLiteralTypeAssertions: 'allow', }, ], }, { - code: 'print([5]);', + code: "const x = 'string';", + options: [ + { + assertionStyle: 'angle-bracket', + objectLiteralTypeAssertions: 'allow', + }, + ], + }, + { + code: "const x = !'string';", + options: [ + { + assertionStyle: 'angle-bracket', + objectLiteralTypeAssertions: 'allow', + }, + ], + }, + { + code: 'const x = a + b;', + options: [ + { + assertionStyle: 'angle-bracket', + objectLiteralTypeAssertions: 'allow', + }, + ], + }, + { + code: 'const x = new Generic();', + options: [ + { + assertionStyle: 'angle-bracket', + objectLiteralTypeAssertions: 'allow', + }, + ], + }, + { + code: 'const x = new (Generic)();', + options: [ + { + assertionStyle: 'angle-bracket', + objectLiteralTypeAssertions: 'allow', + }, + ], + }, + { + code: "const x = new (Generic)('string');", + options: [ + { + assertionStyle: 'angle-bracket', + objectLiteralTypeAssertions: 'allow', + }, + ], + }, + { + code: 'const x = () => { bar: 5 };', + options: [ + { + assertionStyle: 'angle-bracket', + objectLiteralTypeAssertions: 'allow', + }, + ], + }, + { + code: 'const x = () => bar;', + options: [ + { + assertionStyle: 'angle-bracket', + objectLiteralTypeAssertions: 'allow', + }, + ], + }, + { + code: "const x = bar`${'baz'}`;", + options: [ + { + assertionStyle: 'angle-bracket', + objectLiteralTypeAssertions: 'allow', + }, + ], + }, + { + code: "const x = { key: 'value' };", options: [ { - arrayLiteralTypeAssertions: 'allow-as-parameter', assertionStyle: 'angle-bracket', + objectLiteralTypeAssertions: 'allow', }, ], }, + { + code: 'const x = {} as Foo;', + options: [{ assertionStyle: 'as', objectLiteralTypeAssertions: 'allow' }], + }, + { + code: 'const x = {} as a | b;', + options: [{ assertionStyle: 'as', objectLiteralTypeAssertions: 'allow' }], + }, + { + code: 'const x = ({} as A) + b;', + options: [{ assertionStyle: 'as', objectLiteralTypeAssertions: 'allow' }], + }, + { + code: 'print({ bar: 5 } as Foo);', + options: [{ assertionStyle: 'as', objectLiteralTypeAssertions: 'allow' }], + }, + { + code: 'new print({ bar: 5 } as Foo);', + options: [{ assertionStyle: 'as', objectLiteralTypeAssertions: 'allow' }], + }, { code: ` function foo() { - throw [5]; + throw { bar: 5 } as Foo; } `, + options: [{ assertionStyle: 'as', objectLiteralTypeAssertions: 'allow' }], + }, + { + code: 'function b(x = {} as Foo.Bar) {}', + options: [{ assertionStyle: 'as', objectLiteralTypeAssertions: 'allow' }], + }, + { + code: 'function c(x = {} as Foo) {}', + options: [{ assertionStyle: 'as', objectLiteralTypeAssertions: 'allow' }], + }, + { + code: 'print?.({ bar: 5 } as Foo);', + options: [{ assertionStyle: 'as', objectLiteralTypeAssertions: 'allow' }], + }, + { + code: 'print?.call({ bar: 5 } as Foo);', + options: [{ assertionStyle: 'as', objectLiteralTypeAssertions: 'allow' }], + }, + { + code: 'print`${{ bar: 5 } as Foo}`;', + options: [{ assertionStyle: 'as', objectLiteralTypeAssertions: 'allow' }], + }, + { + code: 'const x = >{};', options: [ { - arrayLiteralTypeAssertions: 'allow-as-parameter', assertionStyle: 'angle-bracket', + objectLiteralTypeAssertions: 'allow', }, ], }, { - code: 'function b(x = [5]) {}', + code: 'const x = {};', options: [ { - arrayLiteralTypeAssertions: 'allow-as-parameter', assertionStyle: 'angle-bracket', + objectLiteralTypeAssertions: 'allow', }, ], }, { - code: 'print?.([5]);', + code: 'const x = {} + b;', options: [ { - arrayLiteralTypeAssertions: 'allow-as-parameter', assertionStyle: 'angle-bracket', + objectLiteralTypeAssertions: 'allow', }, ], }, { - code: 'print?.call([5]);', + code: 'print({ bar: 5 });', options: [ { - arrayLiteralTypeAssertions: 'allow-as-parameter', assertionStyle: 'angle-bracket', + objectLiteralTypeAssertions: 'allow', }, ], }, { - code: 'print`${[5]}`;', + code: 'new print({ bar: 5 });', options: [ { - arrayLiteralTypeAssertions: 'allow-as-parameter', assertionStyle: 'angle-bracket', + objectLiteralTypeAssertions: 'allow', }, ], }, { - code: 'new Print([5]);', + code: ` +function foo() { + throw { bar: 5 }; +} + `, options: [ { - arrayLiteralTypeAssertions: 'allow-as-parameter', assertionStyle: 'angle-bracket', + objectLiteralTypeAssertions: 'allow', }, ], }, - { code: 'const x = [1];', options: [{ assertionStyle: 'never' }] }, - { code: 'const x = [1] as const;', options: [{ assertionStyle: 'never' }] }, { - code: 'const bar = ;', - languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } }, + code: 'print?.({ bar: 5 });', + options: [ + { + assertionStyle: 'angle-bracket', + objectLiteralTypeAssertions: 'allow', + }, + ], + }, + { + code: 'print?.call({ bar: 5 });', + options: [ + { + assertionStyle: 'angle-bracket', + objectLiteralTypeAssertions: 'allow', + }, + ], + }, + { + code: 'print`${{ bar: 5 }}`;', + options: [ + { + assertionStyle: 'angle-bracket', + objectLiteralTypeAssertions: 'allow', + }, + ], + }, + { + code: 'print({ bar: 5 } as Foo);', + options: [ + { + assertionStyle: 'as', + objectLiteralTypeAssertions: 'allow-as-parameter', + }, + ], + }, + { + code: 'new print({ bar: 5 } as Foo);', + options: [ + { + assertionStyle: 'as', + objectLiteralTypeAssertions: 'allow-as-parameter', + }, + ], + }, + { + code: ` +function foo() { + throw { bar: 5 } as Foo; +} + `, options: [ { assertionStyle: 'as', @@ -325,52 +408,838 @@ function foo() { ], }, { - code: '123;', - languageOptions: { - // simulate a 3rd party parser that doesn't provide parser services - parser: { - parse: (): TSESTree.Program => parser.parse('123;'), + code: 'function b(x = {} as Foo.Bar) {}', + options: [ + { + assertionStyle: 'as', + objectLiteralTypeAssertions: 'allow-as-parameter', + }, + ], + }, + { + code: 'function c(x = {} as Foo) {}', + options: [ + { + assertionStyle: 'as', + objectLiteralTypeAssertions: 'allow-as-parameter', + }, + ], + }, + { + code: 'print?.({ bar: 5 } as Foo);', + options: [ + { + assertionStyle: 'as', + objectLiteralTypeAssertions: 'allow-as-parameter', + }, + ], + }, + { + code: 'print?.call({ bar: 5 } as Foo);', + options: [ + { + assertionStyle: 'as', + objectLiteralTypeAssertions: 'allow-as-parameter', + }, + ], + }, + { + code: 'print`${{ bar: 5 } as Foo}`;', + options: [ + { + assertionStyle: 'as', + objectLiteralTypeAssertions: 'allow-as-parameter', + }, + ], + }, + { + code: 'print({ bar: 5 });', + options: [ + { + assertionStyle: 'angle-bracket', + objectLiteralTypeAssertions: 'allow-as-parameter', + }, + ], + }, + { + code: 'new print({ bar: 5 });', + options: [ + { + assertionStyle: 'angle-bracket', + objectLiteralTypeAssertions: 'allow-as-parameter', + }, + ], + }, + { + code: ` +function foo() { + throw { bar: 5 }; +} + `, + options: [ + { + assertionStyle: 'angle-bracket', + objectLiteralTypeAssertions: 'allow-as-parameter', + }, + ], + }, + { + code: 'print?.({ bar: 5 });', + options: [ + { + assertionStyle: 'angle-bracket', + objectLiteralTypeAssertions: 'allow-as-parameter', + }, + ], + }, + { + code: 'print?.call({ bar: 5 });', + options: [ + { + assertionStyle: 'angle-bracket', + objectLiteralTypeAssertions: 'allow-as-parameter', + }, + ], + }, + { + code: 'print`${{ bar: 5 }}`;', + options: [ + { + assertionStyle: 'angle-bracket', + objectLiteralTypeAssertions: 'allow-as-parameter', + }, + ], + }, + + { + code: 'const x = [] as string[];', + options: [ + { + assertionStyle: 'as', + }, + ], + }, + { + code: "const x = ['a'] as Array;", + options: [ + { + assertionStyle: 'as', + }, + ], + }, + { + code: 'const x = [];', + options: [ + { + assertionStyle: 'angle-bracket', + }, + ], + }, + { + code: 'const x = >[];', + options: [ + { + assertionStyle: 'angle-bracket', + }, + ], + }, + { + code: 'print([5] as Foo);', + options: [ + { + arrayLiteralTypeAssertions: 'allow-as-parameter', + assertionStyle: 'as', + }, + ], + }, + { + code: ` +function foo() { + throw [5] as Foo; +} + `, + options: [ + { + arrayLiteralTypeAssertions: 'allow-as-parameter', + assertionStyle: 'as', + }, + ], + }, + { + code: 'function b(x = [5] as Foo.Bar) {}', + options: [ + { + arrayLiteralTypeAssertions: 'allow-as-parameter', + assertionStyle: 'as', + }, + ], + }, + { + code: 'print?.([5] as Foo);', + options: [ + { + arrayLiteralTypeAssertions: 'allow-as-parameter', + assertionStyle: 'as', + }, + ], + }, + { + code: 'print?.call([5] as Foo);', + options: [ + { + arrayLiteralTypeAssertions: 'allow-as-parameter', + assertionStyle: 'as', + }, + ], + }, + { + code: 'print`${[5] as Foo}`;', + options: [ + { + arrayLiteralTypeAssertions: 'allow-as-parameter', + assertionStyle: 'as', + }, + ], + }, + { + code: 'new Print([5] as Foo);', + options: [ + { + arrayLiteralTypeAssertions: 'allow-as-parameter', + assertionStyle: 'as', + }, + ], + }, + { + code: 'const bar = ;', + languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } }, + options: [ + { + arrayLiteralTypeAssertions: 'allow-as-parameter', + assertionStyle: 'as', + }, + ], + }, + { + code: 'print([5]);', + options: [ + { + arrayLiteralTypeAssertions: 'allow-as-parameter', + assertionStyle: 'angle-bracket', + }, + ], + }, + { + code: ` +function foo() { + throw [5]; +} + `, + options: [ + { + arrayLiteralTypeAssertions: 'allow-as-parameter', + assertionStyle: 'angle-bracket', + }, + ], + }, + { + code: 'function b(x = [5]) {}', + options: [ + { + arrayLiteralTypeAssertions: 'allow-as-parameter', + assertionStyle: 'angle-bracket', + }, + ], + }, + { + code: 'print?.([5]);', + options: [ + { + arrayLiteralTypeAssertions: 'allow-as-parameter', + assertionStyle: 'angle-bracket', + }, + ], + }, + { + code: 'print?.call([5]);', + options: [ + { + arrayLiteralTypeAssertions: 'allow-as-parameter', + assertionStyle: 'angle-bracket', + }, + ], + }, + { + code: 'print`${[5]}`;', + options: [ + { + arrayLiteralTypeAssertions: 'allow-as-parameter', + assertionStyle: 'angle-bracket', + }, + ], + }, + { + code: 'new Print([5]);', + options: [ + { + arrayLiteralTypeAssertions: 'allow-as-parameter', + assertionStyle: 'angle-bracket', + }, + ], + }, + { code: 'const x = [1];', options: [{ assertionStyle: 'never' }] }, + { code: 'const x = [1] as const;', options: [{ assertionStyle: 'never' }] }, + { + code: 'const bar = ;', + languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } }, + options: [ + { + assertionStyle: 'as', + objectLiteralTypeAssertions: 'allow-as-parameter', + }, + ], + }, + { + code: '123;', + languageOptions: { + // simulate a 3rd party parser that doesn't provide parser services + parser: { + parse: (): TSESTree.Program => parser.parse('123;'), + }, + }, + }, + { + code: ` +const x = { key: 'value' } as any; + `, + options: [{ assertionStyle: 'as', objectLiteralTypeAssertions: 'never' }], + }, + { + code: ` +const x = { key: 'value' } as unknown; + `, + options: [{ assertionStyle: 'as', objectLiteralTypeAssertions: 'never' }], + }, + ], + invalid: [ + { + code: 'const x = new Generic() as Foo;', + errors: [ + { + line: 1, + messageId: 'angle-bracket', + }, + ], + options: [{ assertionStyle: 'angle-bracket' }], + }, + { + code: 'const x = b as A;', + errors: [ + { + line: 1, + messageId: 'angle-bracket', + }, + ], + options: [{ assertionStyle: 'angle-bracket' }], + }, + { + code: 'const x = [1] as readonly number[];', + errors: [ + { + line: 1, + messageId: 'angle-bracket', + }, + ], + options: [{ assertionStyle: 'angle-bracket' }], + }, + { + code: "const x = 'string' as a | b;", + errors: [ + { + line: 1, + messageId: 'angle-bracket', + }, + ], + options: [{ assertionStyle: 'angle-bracket' }], + }, + { + code: "const x = !'string' as A;", + errors: [ + { + line: 1, + messageId: 'angle-bracket', + }, + ], + options: [{ assertionStyle: 'angle-bracket' }], + }, + { + code: 'const x = (a as A) + b;', + errors: [ + { + line: 1, + messageId: 'angle-bracket', + }, + ], + options: [{ assertionStyle: 'angle-bracket' }], + }, + { + code: 'const x = new Generic() as Foo;', + errors: [ + { + line: 1, + messageId: 'angle-bracket', + }, + ], + options: [{ assertionStyle: 'angle-bracket' }], + }, + { + code: 'const x = new (Generic as Foo)();', + errors: [ + { + line: 1, + messageId: 'angle-bracket', + }, + ], + options: [{ assertionStyle: 'angle-bracket' }], + }, + { + code: "const x = new (Generic as Foo)('string');", + errors: [ + { + line: 1, + messageId: 'angle-bracket', + }, + ], + options: [{ assertionStyle: 'angle-bracket' }], + }, + { + code: 'const x = () => ({ bar: 5 }) as Foo;', + errors: [ + { + line: 1, + messageId: 'angle-bracket', + }, + ], + options: [{ assertionStyle: 'angle-bracket' }], + }, + { + code: 'const x = () => bar as Foo;', + errors: [ + { + line: 1, + messageId: 'angle-bracket', + }, + ], + options: [{ assertionStyle: 'angle-bracket' }], + }, + { + code: "const x = bar`${'baz'}` as Foo;", + errors: [ + { + line: 1, + messageId: 'angle-bracket', + }, + ], + options: [{ assertionStyle: 'angle-bracket' }], + }, + { + code: "const x = { key: 'value' } as const;", + errors: [ + { + line: 1, + messageId: 'angle-bracket', + }, + ], + options: [{ assertionStyle: 'angle-bracket' }], + }, + { + code: 'const x = new Generic();', + errors: [ + { + line: 1, + messageId: 'as', + }, + ], + options: [{ assertionStyle: 'as' }], + output: 'const x = new Generic() as Foo;', + }, + { + code: 'const x = b;', + errors: [ + { + line: 1, + messageId: 'as', + }, + ], + options: [{ assertionStyle: 'as' }], + output: 'const x = b as A;', + }, + { + code: 'const x = [1];', + errors: [ + { + line: 1, + messageId: 'as', + }, + ], + options: [{ assertionStyle: 'as' }], + output: 'const x = [1] as readonly number[];', + }, + { + code: "const x = 'string';", + errors: [ + { + line: 1, + messageId: 'as', + }, + ], + options: [{ assertionStyle: 'as' }], + output: "const x = 'string' as a | b;", + }, + { + code: "const x = !'string';", + errors: [ + { + line: 1, + messageId: 'as', + }, + ], + options: [{ assertionStyle: 'as' }], + output: "const x = !'string' as A;", + }, + { + code: 'const x = a + b;', + errors: [ + { + line: 1, + messageId: 'as', + }, + ], + options: [{ assertionStyle: 'as' }], + output: 'const x = (a as A) + b;', + }, + { + code: 'const x = new Generic();', + errors: [ + { + line: 1, + messageId: 'as', + }, + ], + options: [{ assertionStyle: 'as' }], + output: 'const x = new Generic() as Foo;', + }, + { + code: 'const x = new (Generic)();', + errors: [ + { + line: 1, + messageId: 'as', + }, + ], + options: [{ assertionStyle: 'as' }], + output: 'const x = new ((Generic) as Foo)();', + }, + { + code: "const x = new (Generic)('string');", + errors: [ + { + line: 1, + messageId: 'as', + }, + ], + options: [{ assertionStyle: 'as' }], + output: "const x = new ((Generic) as Foo)('string');", + }, + { + code: 'const x = () => { bar: 5 };', + errors: [ + { + line: 1, + messageId: 'as', + }, + ], + options: [{ assertionStyle: 'as' }], + output: 'const x = () => ({ bar: 5 } as Foo);', + }, + { + code: 'const x = () => bar;', + errors: [ + { + line: 1, + messageId: 'as', + }, + ], + options: [{ assertionStyle: 'as' }], + output: 'const x = () => (bar as Foo);', + }, + { + code: "const x = bar`${'baz'}`;", + errors: [ + { + line: 1, + messageId: 'as', + }, + ], + options: [{ assertionStyle: 'as' }], + output: "const x = bar`${'baz'}` as Foo;", + }, + { + code: "const x = { key: 'value' };", + errors: [ + { + line: 1, + messageId: 'as', + }, + ], + options: [{ assertionStyle: 'as' }], + output: "const x = { key: 'value' } as const;", + }, + { + code: 'const x = new Generic() as Foo;', + errors: [ + { + line: 1, + messageId: 'never', + }, + ], + options: [{ assertionStyle: 'never' }], + }, + { + code: 'const x = b as A;', + errors: [ + { + line: 1, + messageId: 'never', + }, + ], + options: [{ assertionStyle: 'never' }], + }, + { + code: 'const x = [1] as readonly number[];', + errors: [ + { + line: 1, + messageId: 'never', + }, + ], + options: [{ assertionStyle: 'never' }], + }, + { + code: "const x = 'string' as a | b;", + errors: [ + { + line: 1, + messageId: 'never', + }, + ], + options: [{ assertionStyle: 'never' }], + }, + { + code: "const x = !'string' as A;", + errors: [ + { + line: 1, + messageId: 'never', + }, + ], + options: [{ assertionStyle: 'never' }], + }, + { + code: 'const x = (a as A) + b;', + errors: [ + { + line: 1, + messageId: 'never', + }, + ], + options: [{ assertionStyle: 'never' }], + }, + { + code: 'const x = new Generic() as Foo;', + errors: [ + { + line: 1, + messageId: 'never', + }, + ], + options: [{ assertionStyle: 'never' }], + }, + { + code: 'const x = new (Generic as Foo)();', + errors: [ + { + line: 1, + messageId: 'never', + }, + ], + options: [{ assertionStyle: 'never' }], + }, + { + code: "const x = new (Generic as Foo)('string');", + errors: [ + { + line: 1, + messageId: 'never', + }, + ], + options: [{ assertionStyle: 'never' }], + }, + { + code: 'const x = () => ({ bar: 5 }) as Foo;', + errors: [ + { + line: 1, + messageId: 'never', + }, + ], + options: [{ assertionStyle: 'never' }], + }, + { + code: 'const x = () => bar as Foo;', + errors: [ + { + line: 1, + messageId: 'never', + }, + ], + options: [{ assertionStyle: 'never' }], + }, + { + code: "const x = bar`${'baz'}` as Foo;", + errors: [ + { + line: 1, + messageId: 'never', + }, + ], + options: [{ assertionStyle: 'never' }], + }, + { + code: 'const x = new Generic();', + errors: [ + { + line: 1, + messageId: 'never', + }, + ], + options: [{ assertionStyle: 'never' }], + }, + { + code: 'const x = b;', + errors: [ + { + line: 1, + messageId: 'never', + }, + ], + options: [{ assertionStyle: 'never' }], + }, + { + code: 'const x = [1];', + errors: [ + { + line: 1, + messageId: 'never', + }, + ], + options: [{ assertionStyle: 'never' }], + }, + { + code: "const x = 'string';", + errors: [ + { + line: 1, + messageId: 'never', + }, + ], + options: [{ assertionStyle: 'never' }], + }, + { + code: "const x = !'string';", + errors: [ + { + line: 1, + messageId: 'never', + }, + ], + options: [{ assertionStyle: 'never' }], + }, + { + code: 'const x = a + b;', + errors: [ + { + line: 1, + messageId: 'never', + }, + ], + options: [{ assertionStyle: 'never' }], + }, + { + code: 'const x = new Generic();', + errors: [ + { + line: 1, + messageId: 'never', + }, + ], + options: [{ assertionStyle: 'never' }], + }, + { + code: 'const x = new (Generic)();', + errors: [ + { + line: 1, + messageId: 'never', + }, + ], + options: [{ assertionStyle: 'never' }], + }, + { + code: "const x = new (Generic)('string');", + errors: [ + { + line: 1, + messageId: 'never', + }, + ], + options: [{ assertionStyle: 'never' }], + }, + { + code: 'const x = () => { bar: 5 };', + errors: [ + { + line: 1, + messageId: 'never', + }, + ], + options: [{ assertionStyle: 'never' }], + }, + { + code: 'const x = () => bar;', + errors: [ + { + line: 1, + messageId: 'never', + }, + ], + options: [{ assertionStyle: 'never' }], + }, + { + code: "const x = bar`${'baz'}`;", + errors: [ + { + line: 1, + messageId: 'never', }, - }, - }, - { - code: ` -const x = { key: 'value' } as any; - `, - options: [{ assertionStyle: 'as', objectLiteralTypeAssertions: 'never' }], + ], + options: [{ assertionStyle: 'never' }], }, { - code: ` -const x = { key: 'value' } as unknown; - `, - options: [{ assertionStyle: 'as', objectLiteralTypeAssertions: 'never' }], - }, - ], - invalid: [ - ...dedupeTestCases( - ( - [ - ['angle-bracket', AS_TESTS], - ['as', ANGLE_BRACKET_TESTS, AS_TESTS], - ['never', AS_TESTS_EXCEPT_CONST_CASE], - ['never', ANGLE_BRACKET_TESTS_EXCEPT_CONST_CASE], - ] as const - ).flatMap(([assertionStyle, code, output]) => - batchedSingleLineTests({ - code, - errors: code - .split(`\n`) - .map((_, i) => ({ line: i + 1, messageId: assertionStyle })), - options: [{ assertionStyle }], - output, - }), - ), - ), - ...batchedSingleLineTests({ - code: OBJECT_LITERAL_AS_CASTS, - errors: [ - { - line: 2, + code: 'const x = {} as Foo;', + errors: [ + { + line: 1, messageId: 'unexpectedObjectTypeAssertion', suggestions: [ { @@ -385,30 +1254,52 @@ const x = { key: 'value' } as unknown; }, ], }, + ], + options: [ { - line: 3, + assertionStyle: 'as', + objectLiteralTypeAssertions: 'allow-as-parameter', + }, + ], + }, + { + code: 'const x = {} as a | b;', + errors: [ + { + line: 1, messageId: 'unexpectedObjectTypeAssertion', suggestions: [ { data: { cast: 'a | b' }, messageId: 'replaceObjectTypeAssertionWithAnnotation', - output: 'const x: a | b = ({});', + output: 'const x: a | b = {};', }, { data: { cast: 'a | b' }, messageId: 'replaceObjectTypeAssertionWithSatisfies', - output: 'const x = ({}) satisfies a | b;', + output: 'const x = {} satisfies a | b;', }, ], }, + ], + options: [ + { + assertionStyle: 'as', + objectLiteralTypeAssertions: 'allow-as-parameter', + }, + ], + }, + { + code: 'const x = ({} as A) + b;', + errors: [ { - line: 4, + line: 1, messageId: 'unexpectedObjectTypeAssertion', suggestions: [ { data: { cast: 'A' }, messageId: 'replaceObjectTypeAssertionWithSatisfies', - output: 'const x = {} satisfies A + b;', + output: 'const x = ({} satisfies A) + b;', }, ], }, @@ -419,12 +1310,12 @@ const x = { key: 'value' } as unknown; objectLiteralTypeAssertions: 'allow-as-parameter', }, ], - }), - ...batchedSingleLineTests({ - code: OBJECT_LITERAL_ANGLE_BRACKET_CASTS, + }, + { + code: 'const x = >{};', errors: [ { - line: 2, + line: 1, messageId: 'unexpectedObjectTypeAssertion', suggestions: [ { @@ -439,24 +1330,46 @@ const x = { key: 'value' } as unknown; }, ], }, + ], + options: [ { - line: 3, + assertionStyle: 'angle-bracket', + objectLiteralTypeAssertions: 'allow-as-parameter', + }, + ], + }, + { + code: 'const x = {};', + errors: [ + { + line: 1, messageId: 'unexpectedObjectTypeAssertion', suggestions: [ { data: { cast: 'a | b' }, messageId: 'replaceObjectTypeAssertionWithAnnotation', - output: 'const x: a | b = ({});', + output: 'const x: a | b = {};', }, { data: { cast: 'a | b' }, messageId: 'replaceObjectTypeAssertionWithSatisfies', - output: 'const x = ({}) satisfies a | b;', + output: 'const x = {} satisfies a | b;', }, ], }, + ], + options: [ + { + assertionStyle: 'angle-bracket', + objectLiteralTypeAssertions: 'allow-as-parameter', + }, + ], + }, + { + code: 'const x = {} + b;', + errors: [ { - line: 4, + line: 1, messageId: 'unexpectedObjectTypeAssertion', suggestions: [ { @@ -473,12 +1386,12 @@ const x = { key: 'value' } as unknown; objectLiteralTypeAssertions: 'allow-as-parameter', }, ], - }), - ...batchedSingleLineTests({ - code: `${OBJECT_LITERAL_AS_CASTS.trimEnd()}${OBJECT_LITERAL_ARGUMENT_AS_CASTS}`, + }, + { + code: 'const x = {} as Foo;', errors: [ { - line: 2, + line: 1, messageId: 'unexpectedObjectTypeAssertion', suggestions: [ { @@ -493,68 +1406,112 @@ const x = { key: 'value' } as unknown; }, ], }, + ], + options: [{ assertionStyle: 'as', objectLiteralTypeAssertions: 'never' }], + }, + { + code: 'const x = {} as a | b;', + errors: [ { - line: 3, + line: 1, messageId: 'unexpectedObjectTypeAssertion', suggestions: [ { data: { cast: 'a | b' }, messageId: 'replaceObjectTypeAssertionWithAnnotation', - output: 'const x: a | b = ({});', + output: 'const x: a | b = {};', }, { data: { cast: 'a | b' }, messageId: 'replaceObjectTypeAssertionWithSatisfies', - output: 'const x = ({}) satisfies a | b;', + output: 'const x = {} satisfies a | b;', }, ], }, + ], + options: [{ assertionStyle: 'as', objectLiteralTypeAssertions: 'never' }], + }, + { + code: 'const x = ({} as A) + b;', + errors: [ { - line: 4, + line: 1, messageId: 'unexpectedObjectTypeAssertion', suggestions: [ { data: { cast: 'A' }, messageId: 'replaceObjectTypeAssertionWithSatisfies', - output: 'const x = {} satisfies A + b;', + output: 'const x = ({} satisfies A) + b;', }, ], }, + ], + options: [{ assertionStyle: 'as', objectLiteralTypeAssertions: 'never' }], + }, + { + code: 'print({ bar: 5 } as Foo);', + errors: [ { - line: 5, + line: 1, messageId: 'unexpectedObjectTypeAssertion', suggestions: [ { data: { cast: 'Foo' }, messageId: 'replaceObjectTypeAssertionWithSatisfies', - output: 'print({ bar: 5 } satisfies Foo)', + output: 'print({ bar: 5 } satisfies Foo);', }, ], }, + ], + options: [{ assertionStyle: 'as', objectLiteralTypeAssertions: 'never' }], + }, + { + code: 'new print({ bar: 5 } as Foo);', + errors: [ { - line: 6, + line: 1, messageId: 'unexpectedObjectTypeAssertion', suggestions: [ { data: { cast: 'Foo' }, messageId: 'replaceObjectTypeAssertionWithSatisfies', - output: 'new print({ bar: 5 } satisfies Foo)', + output: 'new print({ bar: 5 } satisfies Foo);', }, ], }, + ], + options: [{ assertionStyle: 'as', objectLiteralTypeAssertions: 'never' }], + }, + { + code: ` +function foo() { + throw { bar: 5 } as Foo; +} + `, + errors: [ { - line: 7, + line: 3, messageId: 'unexpectedObjectTypeAssertion', suggestions: [ { data: { cast: 'Foo' }, messageId: 'replaceObjectTypeAssertionWithSatisfies', - output: 'function foo() { throw { bar: 5 } satisfies Foo }', + output: ` +function foo() { + throw { bar: 5 } satisfies Foo; +} + `, }, ], }, + ], + options: [{ assertionStyle: 'as', objectLiteralTypeAssertions: 'never' }], + }, + { + code: 'function b(x = {} as Foo.Bar) {}', + errors: [ { - line: 8, + line: 1, messageId: 'unexpectedObjectTypeAssertion', suggestions: [ { @@ -564,8 +1521,14 @@ const x = { key: 'value' } as unknown; }, ], }, + ], + options: [{ assertionStyle: 'as', objectLiteralTypeAssertions: 'never' }], + }, + { + code: 'function c(x = {} as Foo) {}', + errors: [ { - line: 9, + line: 1, messageId: 'unexpectedObjectTypeAssertion', suggestions: [ { @@ -575,47 +1538,65 @@ const x = { key: 'value' } as unknown; }, ], }, + ], + options: [{ assertionStyle: 'as', objectLiteralTypeAssertions: 'never' }], + }, + { + code: 'print?.({ bar: 5 } as Foo);', + errors: [ { - line: 10, + line: 1, messageId: 'unexpectedObjectTypeAssertion', suggestions: [ { data: { cast: 'Foo' }, messageId: 'replaceObjectTypeAssertionWithSatisfies', - output: 'print?.({ bar: 5 } satisfies Foo)', + output: 'print?.({ bar: 5 } satisfies Foo);', }, ], }, + ], + options: [{ assertionStyle: 'as', objectLiteralTypeAssertions: 'never' }], + }, + { + code: 'print?.call({ bar: 5 } as Foo);', + errors: [ { - line: 11, + line: 1, messageId: 'unexpectedObjectTypeAssertion', suggestions: [ { data: { cast: 'Foo' }, messageId: 'replaceObjectTypeAssertionWithSatisfies', - output: 'print?.call({ bar: 5 } satisfies Foo)', + output: 'print?.call({ bar: 5 } satisfies Foo);', }, ], }, + ], + options: [{ assertionStyle: 'as', objectLiteralTypeAssertions: 'never' }], + }, + { + code: 'print`${{ bar: 5 } as Foo}`;', + errors: [ { - line: 12, + line: 1, messageId: 'unexpectedObjectTypeAssertion', suggestions: [ { data: { cast: 'Foo' }, messageId: 'replaceObjectTypeAssertionWithSatisfies', - output: `print\`\${{ bar: 5 } satisfies Foo}\``, + output: 'print`${{ bar: 5 } satisfies Foo}`;', }, ], }, ], options: [{ assertionStyle: 'as', objectLiteralTypeAssertions: 'never' }], - }), - ...batchedSingleLineTests({ - code: `${OBJECT_LITERAL_ANGLE_BRACKET_CASTS.trimEnd()}${OBJECT_LITERAL_ARGUMENT_ANGLE_BRACKET_CASTS}`, + }, + { + code: 'const x = >{};', errors: [ { - line: 2, + line: 1, messageId: 'unexpectedObjectTypeAssertion', suggestions: [ { @@ -630,24 +1611,46 @@ const x = { key: 'value' } as unknown; }, ], }, + ], + options: [ + { + assertionStyle: 'angle-bracket', + objectLiteralTypeAssertions: 'never', + }, + ], + }, + { + code: 'const x = {};', + errors: [ { - line: 3, + line: 1, messageId: 'unexpectedObjectTypeAssertion', suggestions: [ { data: { cast: 'a | b' }, messageId: 'replaceObjectTypeAssertionWithAnnotation', - output: 'const x: a | b = ({});', + output: 'const x: a | b = {};', }, { data: { cast: 'a | b' }, messageId: 'replaceObjectTypeAssertionWithSatisfies', - output: 'const x = ({}) satisfies a | b;', + output: 'const x = {} satisfies a | b;', }, ], }, + ], + options: [ + { + assertionStyle: 'angle-bracket', + objectLiteralTypeAssertions: 'never', + }, + ], + }, + { + code: 'const x = {} + b;', + errors: [ { - line: 4, + line: 1, messageId: 'unexpectedObjectTypeAssertion', suggestions: [ { @@ -657,69 +1660,143 @@ const x = { key: 'value' } as unknown; }, ], }, + ], + options: [ + { + assertionStyle: 'angle-bracket', + objectLiteralTypeAssertions: 'never', + }, + ], + }, + { + code: 'print({ bar: 5 });', + errors: [ { - line: 5, + line: 1, messageId: 'unexpectedObjectTypeAssertion', suggestions: [ { data: { cast: 'Foo' }, messageId: 'replaceObjectTypeAssertionWithSatisfies', - output: 'print({ bar: 5 } satisfies Foo)', + output: 'print({ bar: 5 } satisfies Foo);', }, ], }, + ], + options: [ + { + assertionStyle: 'angle-bracket', + objectLiteralTypeAssertions: 'never', + }, + ], + }, + { + code: 'new print({ bar: 5 });', + errors: [ { - line: 6, + line: 1, messageId: 'unexpectedObjectTypeAssertion', suggestions: [ { data: { cast: 'Foo' }, messageId: 'replaceObjectTypeAssertionWithSatisfies', - output: 'new print({ bar: 5 } satisfies Foo)', + output: 'new print({ bar: 5 } satisfies Foo);', }, ], }, + ], + options: [ + { + assertionStyle: 'angle-bracket', + objectLiteralTypeAssertions: 'never', + }, + ], + }, + { + code: ` +function foo() { + throw { bar: 5 }; +} + `, + errors: [ { - line: 7, + line: 3, messageId: 'unexpectedObjectTypeAssertion', suggestions: [ { data: { cast: 'Foo' }, messageId: 'replaceObjectTypeAssertionWithSatisfies', - output: 'function foo() { throw { bar: 5 } satisfies Foo }', + output: ` +function foo() { + throw { bar: 5 } satisfies Foo; +} + `, }, ], }, + ], + options: [ + { + assertionStyle: 'angle-bracket', + objectLiteralTypeAssertions: 'never', + }, + ], + }, + { + code: 'print?.({ bar: 5 });', + errors: [ { - line: 8, + line: 1, messageId: 'unexpectedObjectTypeAssertion', suggestions: [ { data: { cast: 'Foo' }, messageId: 'replaceObjectTypeAssertionWithSatisfies', - output: 'print?.({ bar: 5 } satisfies Foo)', + output: 'print?.({ bar: 5 } satisfies Foo);', }, ], }, + ], + options: [ + { + assertionStyle: 'angle-bracket', + objectLiteralTypeAssertions: 'never', + }, + ], + }, + { + code: 'print?.call({ bar: 5 });', + errors: [ { - line: 9, + line: 1, messageId: 'unexpectedObjectTypeAssertion', suggestions: [ { data: { cast: 'Foo' }, messageId: 'replaceObjectTypeAssertionWithSatisfies', - output: 'print?.call({ bar: 5 } satisfies Foo)', + output: 'print?.call({ bar: 5 } satisfies Foo);', }, ], }, + ], + options: [ + { + assertionStyle: 'angle-bracket', + objectLiteralTypeAssertions: 'never', + }, + ], + }, + { + code: 'print`${{ bar: 5 }}`;', + errors: [ { - line: 10, + line: 1, messageId: 'unexpectedObjectTypeAssertion', suggestions: [ { data: { cast: 'Foo' }, messageId: 'replaceObjectTypeAssertionWithSatisfies', - output: `print\`\${{ bar: 5 } satisfies Foo}\``, + output: 'print`${{ bar: 5 } satisfies Foo}`;', }, ], }, @@ -730,7 +1807,7 @@ const x = { key: 'value' } as unknown; objectLiteralTypeAssertions: 'never', }, ], - }), + }, { code: 'const foo = ;', errors: [{ line: 1, messageId: 'never' }], diff --git a/packages/eslint-plugin/tests/rules/consistent-type-exports.test.ts b/packages/eslint-plugin/tests/rules/consistent-type-exports.test.ts index 8508cd75ae77..6226405f4ebb 100644 --- a/packages/eslint-plugin/tests/rules/consistent-type-exports.test.ts +++ b/packages/eslint-plugin/tests/rules/consistent-type-exports.test.ts @@ -1,18 +1,11 @@ /* eslint-disable @typescript-eslint/internal/plugin-test-formatting -- Prettier doesn't yet support TS 5.6 string literal module identifiers */ -import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; +import { noFormat } from '@typescript-eslint/rule-tester'; import rule from '../../src/rules/consistent-type-exports'; -import { getFixturesRootDir } from '../RuleTester'; +import { createRuleTesterWithTypes } from '../RuleTester'; -const rootDir = getFixturesRootDir(); - -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootDir, - }, - }, +const ruleTester = createRuleTesterWithTypes({ + project: './tsconfig.json', }); ruleTester.run('consistent-type-exports', rule, { @@ -64,6 +57,11 @@ export { NonTypeNS }; "export type * as foo from './consistent-type-exports/type-only-exports';", "export type * as foo from './consistent-type-exports/type-only-reexport';", "export * as foo from './consistent-type-exports/value-reexport';", + ` +import * as Foo from './consistent-type-exports'; +type Foo = 1; +export { Foo } + `, ], invalid: [ { @@ -483,5 +481,26 @@ export { export type * as foo from './consistent-type-exports/type-only-reexport'; `, }, + { + code: ` + import type * as Foo from './consistent-type-exports'; + type Foo = 1; + export { Foo }; + `, + errors: [ + { + column: 9, + endColumn: 24, + endLine: 4, + line: 4, + messageId: 'typeOverValue', + }, + ], + output: ` + import type * as Foo from './consistent-type-exports'; + type Foo = 1; + export type { Foo }; + `, + }, ], }); diff --git a/packages/eslint-plugin/tests/rules/dot-notation.test.ts b/packages/eslint-plugin/tests/rules/dot-notation.test.ts index 0a14e1036383..1a077b1b0527 100644 --- a/packages/eslint-plugin/tests/rules/dot-notation.test.ts +++ b/packages/eslint-plugin/tests/rules/dot-notation.test.ts @@ -1,18 +1,10 @@ -import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; +import { noFormat } from '@typescript-eslint/rule-tester'; import rule from '../../src/rules/dot-notation'; -import { getFixturesRootDir } from '../RuleTester'; +import { createRuleTesterWithTypes, getFixturesRootDir } from '../RuleTester'; -const rootPath = getFixturesRootDir(); - -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootPath, - }, - }, -}); +const rootDir = getFixturesRootDir(); +const ruleTester = createRuleTesterWithTypes(); /** * Quote a string in "double quotes" because it’s painful @@ -163,7 +155,7 @@ foo['key_baz']; parserOptions: { project: './tsconfig.noPropertyAccessFromIndexSignature.json', projectService: false, - tsconfigRootDir: rootPath, + tsconfigRootDir: rootDir, }, }, }, @@ -181,7 +173,7 @@ foo['bar']; parserOptions: { project: './tsconfig.noPropertyAccessFromIndexSignature.json', projectService: false, - tsconfigRootDir: rootPath, + tsconfigRootDir: rootDir, }, }, }, @@ -202,7 +194,7 @@ function f(x: T) { parserOptions: { project: './tsconfig.noPropertyAccessFromIndexSignature.json', projectService: false, - tsconfigRootDir: rootPath, + tsconfigRootDir: rootDir, }, }, }, diff --git a/packages/eslint-plugin/tests/rules/init-declarations.test.ts b/packages/eslint-plugin/tests/rules/init-declarations.test.ts index 3d02f77a2f18..276ba3e9f2bd 100644 --- a/packages/eslint-plugin/tests/rules/init-declarations.test.ts +++ b/packages/eslint-plugin/tests/rules/init-declarations.test.ts @@ -251,7 +251,7 @@ var bar: string = function (): string { }, { code: ` -var bar: string = function (arg1: stirng): string { +var bar: string = function (arg1: string): string { return 'string'; }; `, diff --git a/packages/eslint-plugin/tests/rules/member-ordering.test.ts b/packages/eslint-plugin/tests/rules/member-ordering.test.ts index d53fe04d6d22..f885b156163c 100644 --- a/packages/eslint-plugin/tests/rules/member-ordering.test.ts +++ b/packages/eslint-plugin/tests/rules/member-ordering.test.ts @@ -4465,7 +4465,7 @@ abstract class Foo { B: string; public C() {} private D() {} - abstract E() {} + E() {} } `, errors: [ @@ -4478,6 +4478,15 @@ abstract class Foo { line: 4, messageId: 'incorrectGroupOrder', }, + { + column: 3, + data: { + name: 'E', + rank: 'private instance method', + }, + line: 7, + messageId: 'incorrectGroupOrder', + }, ], }, { diff --git a/packages/eslint-plugin/tests/rules/method-signature-style.test.ts b/packages/eslint-plugin/tests/rules/method-signature-style.test.ts index 2e60818a6064..9a7ab2b345c2 100644 --- a/packages/eslint-plugin/tests/rules/method-signature-style.test.ts +++ b/packages/eslint-plugin/tests/rules/method-signature-style.test.ts @@ -28,7 +28,7 @@ interface Test { `, ` interface Test { - 'f!': (/* b */ x: any /* c */) => void; + 'f!': (/* b */ x: any /* c */) => void; } `, ` @@ -82,7 +82,7 @@ interface Test { { code: ` interface Test { - 'f!'(/* b */ x: any /* c */): void; + 'f!'(/* b */ x: any /* c */): void; } `, options: ['method'], @@ -190,13 +190,13 @@ interface Test { { code: ` interface Test { - 'f!'(/* b */ x: any /* c */): void; + 'f!'(/* b */ x: any /* c */): void; } `, errors: [{ messageId: 'errorMethod' }], output: ` interface Test { - 'f!': (/* b */ x: any /* c */) => void; + 'f!': (/* b */ x: any /* c */) => void; } `, }, @@ -295,14 +295,14 @@ interface Test { { code: ` interface Test { - 'f!': (/* b */ x: any /* c */) => void; + 'f!': (/* b */ x: any /* c */) => void; } `, errors: [{ messageId: 'errorProperty' }], options: ['method'], output: ` interface Test { - 'f!'(/* b */ x: any /* c */): void; + 'f!'(/* b */ x: any /* c */): void; } `, }, diff --git a/packages/eslint-plugin/tests/rules/naming-convention/naming-convention.test.ts b/packages/eslint-plugin/tests/rules/naming-convention/naming-convention.test.ts index c43b293c686e..5c4391b20ca6 100644 --- a/packages/eslint-plugin/tests/rules/naming-convention/naming-convention.test.ts +++ b/packages/eslint-plugin/tests/rules/naming-convention/naming-convention.test.ts @@ -11,6 +11,7 @@ const ruleTester = new RuleTester(); const rootDir = getFixturesRootDir(); const parserOptions = { project: './tsconfig.json', + projectService: false, tsconfigRootDir: rootDir, }; @@ -632,7 +633,7 @@ ruleTester.run('naming-convention', rule, { { code: ` class Ignored { - private static abstract some_name() {} + private static some_name() {} IgnoredDueToModifiers() {} } `, @@ -644,7 +645,7 @@ ruleTester.run('naming-convention', rule, { }, { format: ['UPPER_CASE'], - modifiers: ['abstract', 'static'], + modifiers: ['static'], selector: 'classMethod', }, ], @@ -1875,7 +1876,7 @@ ruleTester.run('naming-convention', rule, { { code: ` class Ignored { - private static abstract some_name() {} + private static some_name() {} IgnoredDueToModifiers() {} } `, @@ -1886,7 +1887,7 @@ ruleTester.run('naming-convention', rule, { }, { format: ['snake_case'], - modifiers: ['abstract', 'static'], + modifiers: ['static'], selector: 'classMethod', }, ], @@ -2058,7 +2059,7 @@ ruleTester.run('naming-convention', rule, { 'enumMember', ], }, - // making sure the `requoresQuotes` modifier appropriately overrides this + // making sure the `requiresQuotes` modifier appropriately overrides this { format: ['PascalCase'], selector: [ @@ -2118,10 +2119,10 @@ ruleTester.run('naming-convention', rule, { } } abstract class foo { - public abstract Bar() { + public Bar() { return 42; } - public abstract async async_bar() { + public async async_bar() { return 42; } } diff --git a/packages/eslint-plugin/tests/rules/no-array-constructor.test.ts b/packages/eslint-plugin/tests/rules/no-array-constructor.test.ts index ce97e7e6a8a2..8ddff69ff3ab 100644 --- a/packages/eslint-plugin/tests/rules/no-array-constructor.test.ts +++ b/packages/eslint-plugin/tests/rules/no-array-constructor.test.ts @@ -1,5 +1,4 @@ import { RuleTester } from '@typescript-eslint/rule-tester'; -import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import rule from '../../src/rules/no-array-constructor'; @@ -39,7 +38,6 @@ ruleTester.run('no-array-constructor', rule, { errors: [ { messageId: 'useLiteral', - type: AST_NODE_TYPES.NewExpression, }, ], output: '[];', @@ -49,7 +47,6 @@ ruleTester.run('no-array-constructor', rule, { errors: [ { messageId: 'useLiteral', - type: AST_NODE_TYPES.CallExpression, }, ], output: '[];', @@ -59,7 +56,6 @@ ruleTester.run('no-array-constructor', rule, { errors: [ { messageId: 'useLiteral', - type: AST_NODE_TYPES.CallExpression, }, ], output: '[];', @@ -69,7 +65,6 @@ ruleTester.run('no-array-constructor', rule, { errors: [ { messageId: 'useLiteral', - type: AST_NODE_TYPES.CallExpression, }, ], output: '/* a */ /* b */ []; /* g */ /* h */', @@ -79,7 +74,6 @@ ruleTester.run('no-array-constructor', rule, { errors: [ { messageId: 'useLiteral', - type: AST_NODE_TYPES.NewExpression, }, ], output: '[x, y];', @@ -89,7 +83,6 @@ ruleTester.run('no-array-constructor', rule, { errors: [ { messageId: 'useLiteral', - type: AST_NODE_TYPES.CallExpression, }, ], output: '[x, y];', @@ -99,7 +92,6 @@ ruleTester.run('no-array-constructor', rule, { errors: [ { messageId: 'useLiteral', - type: AST_NODE_TYPES.CallExpression, }, ], output: '[x, y];', @@ -109,7 +101,6 @@ ruleTester.run('no-array-constructor', rule, { errors: [ { messageId: 'useLiteral', - type: AST_NODE_TYPES.CallExpression, }, ], output: '/* a */ /* b */ [x, y]; /* g */ /* h */', @@ -119,7 +110,6 @@ ruleTester.run('no-array-constructor', rule, { errors: [ { messageId: 'useLiteral', - type: AST_NODE_TYPES.NewExpression, }, ], output: '[0, 1, 2];', @@ -129,7 +119,6 @@ ruleTester.run('no-array-constructor', rule, { errors: [ { messageId: 'useLiteral', - type: AST_NODE_TYPES.CallExpression, }, ], output: '[0, 1, 2];', @@ -139,7 +128,6 @@ ruleTester.run('no-array-constructor', rule, { errors: [ { messageId: 'useLiteral', - type: AST_NODE_TYPES.CallExpression, }, ], output: '[0, 1, 2];', @@ -155,7 +143,6 @@ ruleTester.run('no-array-constructor', rule, { errors: [ { messageId: 'useLiteral', - type: AST_NODE_TYPES.CallExpression, }, ], output: ` @@ -173,7 +160,6 @@ new Array(0, 1, 2); errors: [ { messageId: 'useLiteral', - type: AST_NODE_TYPES.NewExpression, }, ], output: ` diff --git a/packages/eslint-plugin/tests/rules/no-array-delete.test.ts b/packages/eslint-plugin/tests/rules/no-array-delete.test.ts index be9700385a91..c8d25e7ebf84 100644 --- a/packages/eslint-plugin/tests/rules/no-array-delete.test.ts +++ b/packages/eslint-plugin/tests/rules/no-array-delete.test.ts @@ -1,18 +1,9 @@ -import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; +import { noFormat } from '@typescript-eslint/rule-tester'; import rule from '../../src/rules/no-array-delete'; -import { getFixturesRootDir } from '../RuleTester'; +import { createRuleTesterWithTypes } from '../RuleTester'; -const rootPath = getFixturesRootDir(); - -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootPath, - }, - }, -}); +const ruleTester = createRuleTesterWithTypes(); ruleTester.run('no-array-delete', rule, { valid: [ diff --git a/packages/eslint-plugin/tests/rules/no-base-to-string.test.ts b/packages/eslint-plugin/tests/rules/no-base-to-string.test.ts index f0fe39979c4d..cab11e9ce5ec 100644 --- a/packages/eslint-plugin/tests/rules/no-base-to-string.test.ts +++ b/packages/eslint-plugin/tests/rules/no-base-to-string.test.ts @@ -1,19 +1,16 @@ -import { RuleTester } from '@typescript-eslint/rule-tester'; - import rule from '../../src/rules/no-base-to-string'; -import { getFixturesRootDir } from '../RuleTester'; +import { createRuleTesterWithTypes, getFixturesRootDir } from '../RuleTester'; const rootDir = getFixturesRootDir(); -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootDir, - }, - }, -}); +const ruleTester = createRuleTesterWithTypes(); -const literalListBasic: string[] = [ +/** + * ref: https://github.com/typescript-eslint/typescript-eslint/issues/11043 + * Be careful with dynamic test case generation. + * Iterate based on the following cases: + * 1. literalListBasic + * ``` +[ "''", "'text'", 'true', @@ -23,45 +20,190 @@ const literalListBasic: string[] = [ '[]', '/regex/', ]; - -const literalListNeedParen: string[] = [ + * ``` + * 2. literalListNeedParen + * ``` +[ "__dirname === 'foobar'", '{}.constructor()', '() => {}', 'function() {}', ]; - -const literalList = [...literalListBasic, ...literalListNeedParen]; - -const literalListWrapped = [ - ...literalListBasic, - ...literalListNeedParen.map(i => `(${i})`), -]; - + * ``` + */ ruleTester.run('no-base-to-string', rule, { valid: [ // template - ...literalList.map(i => `\`\${${i}}\`;`), + "`${''}`;", + "`${'text'}`;", + '`${true}`;', + '`${false}`;', + '`${1}`;', + '`${1n}`;', + '`${[]}`;', + '`${/regex/}`;', + "`${__dirname === 'foobar'}`;", + '`${{}.constructor()}`;', + '`${() => {}}`;', + '`${function () {}}`;', // operator + += - ...literalListWrapped.flatMap(l => - literalListWrapped.map(r => `${l} + ${r};`), - ), + "'' + 'text';", + "'' + true;", + "'' + false;", + "'' + 1;", + "'' + 1n;", + "'' + [];", + "'' + /regex/;", + "'' + (__dirname === 'foobar');", + "'' + {}.constructor();", + "'' + (() => {});", + "'' + function () {};", + "'text' + true;", + "'text' + false;", + "'text' + 1;", + "'text' + 1n;", + "'text' + [];", + "'text' + /regex/;", + "'text' + (__dirname === 'foobar');", + "'text' + {}.constructor();", + "'text' + (() => {});", + "'text' + function () {};", + 'true + false;', + 'true + 1;', + 'true + 1n;', + 'true + [];', + 'true + /regex/;', + "true + (__dirname === 'foobar');", + 'true + {}.constructor();', + 'true + (() => {});', + 'true + function () {};', + 'false + 1;', + 'false + 1n;', + 'false + [];', + 'false + /regex/;', + "false + (__dirname === 'foobar');", + 'false + {}.constructor();', + 'false + (() => {});', + 'false + function () {};', + '1 + 1n;', + '1 + [];', + '1 + /regex/;', + "1 + (__dirname === 'foobar');", + '1 + {}.constructor();', + '1 + (() => {});', + '1 + function () {};', + '1n + [];', + '1n + /regex/;', + "1n + (__dirname === 'foobar');", + '1n + {}.constructor();', + '1n + (() => {});', + '1n + function () {};', + '[] + /regex/;', + "[] + (__dirname === 'foobar');", + '[] + {}.constructor();', + '[] + (() => {});', + '[] + function () {};', + "/regex/ + (__dirname === 'foobar');", + '/regex/ + {}.constructor();', + '/regex/ + (() => {});', + '/regex/ + function () {};', + "(__dirname === 'foobar') + {}.constructor();", + "(__dirname === 'foobar') + (() => {});", + "(__dirname === 'foobar') + function () {};", + '({}).constructor() + (() => {});', + '({}).constructor() + function () {};', + '(() => {}) + function () {};', // toString() - ...literalListWrapped.map(i => `${i === '1' ? `(${i})` : i}.toString();`), + "''.toString();", + "'text'.toString();", + 'true.toString();', + 'false.toString();', + '(1).toString();', + '1n.toString();', + '[].toString();', + '/regex/.toString();', + "(__dirname === 'foobar').toString();", + '({}).constructor().toString();', + '(() => {}).toString();', + '(function () {}).toString();', // variable toString() and template - ...literalList.map( - i => ` - let value = ${i}; - value.toString(); - let text = \`\${value}\`; - `, - ), + ` + let value = ''; + value.toString(); + let text = \`\${value}\`; + `, + ` + let value = 'text'; + value.toString(); + let text = \`\${value}\`; + `, + ` + let value = true; + value.toString(); + let text = \`\${value}\`; + `, + ` + let value = false; + value.toString(); + let text = \`\${value}\`; + `, + ` + let value = 1; + value.toString(); + let text = \`\${value}\`; + `, + ` + let value = 1n; + value.toString(); + let text = \`\${value}\`; + `, + ` + let value = []; + value.toString(); + let text = \`\${value}\`; + `, + ` + let value = /regex/; + value.toString(); + let text = \`\${value}\`; + `, + ` + let value = __dirname === 'foobar'; + value.toString(); + let text = \`\${value}\`; + `, + ` + let value = {}.constructor(); + value.toString(); + let text = \`\${value}\`; + `, + ` + let value = () => {}; + value.toString(); + let text = \`\${value}\`; + `, + ` + let value = function () {}; + value.toString(); + let text = \`\${value}\`; + `, // String() - ...literalList.map(i => `String(${i});`), + "String('');", + "String('text');", + 'String(true);', + 'String(false);', + 'String(1);', + 'String(1n);', + 'String([]);', + 'String(/regex/);', + "String(__dirname === 'foobar');", + 'String({}.constructor());', + 'String(() => {});', + 'String(function () {});', ` function someFunction() {} someFunction.toString(); @@ -149,6 +291,71 @@ String(foo); `, options: [{ ignoredTypeNames: ['Foo'] }], }, + { + code: ` +interface MyError {} +declare const error: MyError; +error.toString(); + `, + options: [{ ignoredTypeNames: ['MyError'] }], + }, + { + code: ` +type MyError = {}; +declare const error: MyError; +error.toString(); + `, + options: [{ ignoredTypeNames: ['MyError'] }], + }, + { + code: ` +class MyError {} +declare const error: MyError; +error.toString(); + `, + options: [{ ignoredTypeNames: ['MyError'] }], + }, + { + code: ` +interface Animal {} +interface Serializable {} +interface Cat extends Animal, Serializable {} + +declare const whiskers: Cat; +whiskers.toString(); + `, + options: [{ ignoredTypeNames: ['Animal'] }], + }, + { + code: ` +interface MyError extends Error {} + +declare const error: MyError; +error.toString(); + `, + }, + { + code: ` +class UnknownBase {} +class CustomError extends UnknownBase {} + +declare const err: CustomError; +err.toString(); + `, + options: [{ ignoredTypeNames: ['UnknownBase'] }], + }, + { + code: ` +interface Animal {} +interface Dog extends Animal {} +interface Cat extends Animal {} + +declare const dog: Dog; +declare const cat: Cat; +cat.toString(); + `, + options: [{ ignoredTypeNames: ['Animal'] }], + }, ` function String(value) { return value; @@ -475,15 +682,6 @@ declare const bb: ExtendedGuildChannel; bb.toString(); `, ` -function foo(x: T) { - String(x); -} - `, - ` -declare const u: unknown; -String(u); - `, - ` type Value = string | Value[]; declare const v: Value; @@ -511,8 +709,202 @@ String(v); declare const v: ('foo' | 'bar')[][]; String(v); `, + ` +declare const x: unknown; +\`\${x})\`; + `, + ` +declare const x: unknown; +x.toString(); + `, + ` +declare const x: unknown; +x.toLocaleString(); + `, + ` +declare const x: unknown; +'' + x; + `, + ` +declare const x: unknown; +String(x); + `, + ` +declare const x: unknown; +'' += x; + `, + ` +function foo(x: T) { + String(x); +} + `, + ` +declare const x: any; +\`\${x})\`; + `, + ` +declare const x: any; +x.toString(); + `, + ` +declare const x: any; +x.toLocaleString(); + `, + ` +declare const x: any; +'' + x; + `, + ` +declare const x: any; +String(x); + `, + ` +declare const x: any; +'' += x; + `, ], invalid: [ + { + code: ` +declare const x: unknown; +\`\${x})\`; + `, + errors: [ + { + data: { + certainty: 'may', + name: 'x', + }, + messageId: 'baseToString', + }, + ], + options: [ + { + checkUnknown: true, + }, + ], + }, + { + code: ` +declare const x: unknown; +x.toString(); + `, + errors: [ + { + data: { + certainty: 'may', + name: 'x', + }, + messageId: 'baseToString', + }, + ], + options: [ + { + checkUnknown: true, + }, + ], + }, + { + code: ` +declare const x: unknown; +x.toLocaleString(); + `, + errors: [ + { + data: { + certainty: 'may', + name: 'x', + }, + messageId: 'baseToString', + }, + ], + options: [ + { + checkUnknown: true, + }, + ], + }, + { + code: ` +declare const x: unknown; +'' + x; + `, + errors: [ + { + data: { + certainty: 'may', + name: 'x', + }, + messageId: 'baseToString', + }, + ], + options: [ + { + checkUnknown: true, + }, + ], + }, + { + code: ` +declare const x: unknown; +String(x); + `, + errors: [ + { + data: { + certainty: 'may', + name: 'x', + }, + messageId: 'baseToString', + }, + ], + options: [ + { + checkUnknown: true, + }, + ], + }, + { + code: ` +declare const x: unknown; +'' += x; + `, + errors: [ + { + data: { + certainty: 'may', + name: 'x', + }, + messageId: 'baseToString', + }, + ], + options: [ + { + checkUnknown: true, + }, + ], + }, + { + code: ` +function foo(x: T) { + String(x); +} + `, + errors: [ + { + data: { + certainty: 'may', + name: 'x', + }, + messageId: 'baseToString', + }, + ], + options: [ + { + checkUnknown: true, + }, + ], + }, { code: '`${{}})`;', errors: [ @@ -981,6 +1373,7 @@ declare const foo: Bar & Foo; languageOptions: { parserOptions: { project: './tsconfig.noUncheckedIndexedAccess.json', + projectService: false, tsconfigRootDir: rootDir, }, }, @@ -1231,6 +1624,7 @@ declare const foo: Bar & Foo; languageOptions: { parserOptions: { project: './tsconfig.noUncheckedIndexedAccess.json', + projectService: false, tsconfigRootDir: rootDir, }, }, @@ -1481,6 +1875,7 @@ declare const foo: Bar & Foo; languageOptions: { parserOptions: { project: './tsconfig.noUncheckedIndexedAccess.json', + projectService: false, tsconfigRootDir: rootDir, }, }, @@ -1731,6 +2126,7 @@ declare const foo: Bar & Foo; languageOptions: { parserOptions: { project: './tsconfig.noUncheckedIndexedAccess.json', + projectService: false, tsconfigRootDir: rootDir, }, }, @@ -1905,5 +2301,60 @@ v.join(); }, ], }, + { + code: ` +interface Dog extends Animal {} + +declare const labrador: Dog; +labrador.toString(); + `, + errors: [ + { + data: { + certainty: 'will', + name: 'labrador', + }, + messageId: 'baseToString', + }, + ], + }, + { + code: ` +interface A extends B {} +interface B extends A {} + +declare const a: A; +a.toString(); + `, + errors: [ + { + data: { + certainty: 'will', + name: 'a', + }, + messageId: 'baseToString', + }, + ], + }, + { + code: ` + interface Base {} + interface Left extends Base {} + interface Right extends Base {} + interface Diamond extends Left, Right {} + + declare const d: Diamond; + d.toString(); + `, + errors: [ + { + data: { + certainty: 'will', + name: 'd', + }, + messageId: 'baseToString', + }, + ], + }, ], }); 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 4fcb1b8b6865..6e63c73be460 100644 --- a/packages/eslint-plugin/tests/rules/no-confusing-void-expression.test.ts +++ b/packages/eslint-plugin/tests/rules/no-confusing-void-expression.test.ts @@ -1,17 +1,9 @@ -import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; +import { noFormat } from '@typescript-eslint/rule-tester'; import rule from '../../src/rules/no-confusing-void-expression'; -import { getFixturesRootDir } from '../RuleTester'; +import { createRuleTesterWithTypes } from '../RuleTester'; -const rootPath = getFixturesRootDir(); -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootPath, - }, - }, -}); +const ruleTester = createRuleTesterWithTypes(); ruleTester.run('no-confusing-void-expression', rule, { valid: [ @@ -110,13 +102,13 @@ ruleTester.run('no-confusing-void-expression', rule, { ` function cool(input: string) { - return console.log(input), input; + return (console.log(input), input); } `, { code: ` function cool(input: string) { - return input, console.log(input), input; + return (input, console.log(input), input); } `, }, @@ -487,10 +479,10 @@ test((() => { { code: ` function notcool(input: string) { - return input, console.log(input); + return (input, console.log(input)); } `, - errors: [{ column: 17, line: 3, messageId: 'invalidVoidExpr' }], + errors: [{ column: 18, line: 3, messageId: 'invalidVoidExpr' }], output: null, }, { diff --git a/packages/eslint-plugin/tests/rules/no-deprecated.test.ts b/packages/eslint-plugin/tests/rules/no-deprecated.test.ts index 1c8f354886df..529d6e999cfa 100644 --- a/packages/eslint-plugin/tests/rules/no-deprecated.test.ts +++ b/packages/eslint-plugin/tests/rules/no-deprecated.test.ts @@ -1,19 +1,12 @@ -import { RuleTester } from '@typescript-eslint/rule-tester'; - import rule from '../../src/rules/no-deprecated'; -import { getFixturesRootDir } from '../RuleTester'; +import { getFixturesRootDir, createRuleTesterWithTypes } from '../RuleTester'; const rootDir = getFixturesRootDir(); -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - ecmaFeatures: { - jsx: true, - }, - project: './tsconfig.json', - tsconfigRootDir: rootDir, - }, +const ruleTester = createRuleTesterWithTypes({ + ecmaFeatures: { + jsx: true, }, + project: './tsconfig.json', }); ruleTester.run('no-deprecated', rule, { @@ -45,8 +38,42 @@ ruleTester.run('no-deprecated', rule, { /** @deprecated */ c: 2, }; + a['b']; + `, + ` + const a = { + b: 1, + /** @deprecated */ c: 2, + }; + + a['b' + 'c']; + `, + ` + const a = { + b: 1, + /** @deprecated */ c: 2, + }; + + const key = 'b'; + + a[key]; + `, + ` + const a = { + b: 1, + /** @deprecated */ c: 2, + }; + a?.b; `, + ` + const a = { + b: 1, + /** @deprecated */ c: 2, + }; + + a?.['b']; + `, ` declare const a: { b: 1; @@ -55,6 +82,52 @@ ruleTester.run('no-deprecated', rule, { a.b; `, + ` + declare const a: { + b: 1; + /** @deprecated */ c: 2; + }; + + a['b']; + `, + ` + declare const a: { + b: 1; + /** @deprecated */ c: 2; + }; + + a[\`\${'b'}\`]; + `, + ` + declare const a: { + b: 1; + /** @deprecated */ c: 2; + }; + + const key = 'b'; + + a[\`\${key}\`]; + `, + ` + declare const a: { + /** @deprecated */ c: 1; + cc: 2; + }; + + const key = 'c'; + + a[\`\${key + key}\`]; + `, + ` + declare const a: { + /** @deprecated */ c: 1; + cc: 2; + }; + + const key = 'c'; + + a[\`\${key}\${key}\`]; + `, ` class A { b: 1; @@ -63,6 +136,41 @@ ruleTester.run('no-deprecated', rule, { new A().b; `, + ` + class A { + b: 1; + /** @deprecated */ c: 2; + } + + new A()['b']; + `, + ` + class A { + b: 1; + /** @deprecated */ c: 2; + } + const key = 'b'; + + new A()[b]; + `, + ` + class A { + c: 1; + } + class B { + /** @deprecated */ c: 2; + } + + new A()['c']; + `, + ` + class A { + b: () => {}; + /** @deprecated */ c: () => {}; + } + + new A()['b'](); + `, ` class A { accessor b: 1; @@ -71,6 +179,14 @@ ruleTester.run('no-deprecated', rule, { new A().b; `, + ` + class A { + accessor b: 1; + /** @deprecated */ accessor c: 2; + } + + new A()['b']; + `, ` declare class A { /** @deprecated */ @@ -80,6 +196,15 @@ ruleTester.run('no-deprecated', rule, { A.c; `, + ` + declare class A { + /** @deprecated */ + static b: string; + static c: string; + } + + A['c']; + `, ` declare class A { /** @deprecated */ @@ -89,6 +214,15 @@ ruleTester.run('no-deprecated', rule, { A.c; `, + ` + declare class A { + /** @deprecated */ + static accessor b: string; + static accessor c: string; + } + + A['c']; + `, ` namespace A { /** @deprecated */ @@ -98,6 +232,15 @@ ruleTester.run('no-deprecated', rule, { A.c; `, + ` + namespace A { + /** @deprecated */ + export const b = ''; + export const c = ''; + } + + A['c']; + `, ` enum A { /** @deprecated */ @@ -107,6 +250,15 @@ ruleTester.run('no-deprecated', rule, { A.c; `, + ` + enum A { + /** @deprecated */ + b = 'b', + c = 'c', + } + + A['c']; + `, ` function a(value: 'b' | undefined): void; /** @deprecated */ @@ -222,6 +374,12 @@ ruleTester.run('no-deprecated', rule, { default as ts, } from 'typescript'; `, + ` + export { deprecatedFunction as 'bur' } from './deprecated'; + `, + ` + export { 'deprecatedFunction' } from './deprecated'; + `, ` namespace A { /** @deprecated */ @@ -239,6 +397,21 @@ ruleTester.run('no-deprecated', rule, { declare const x: Props; const { anchor = '' } = x; `, + ` + namespace Foo {} + + /** + * @deprecated + */ + export import Bar = Foo; + `, + ` + /** + * @deprecated + */ + export import Bar = require('./deprecated'); + `, + ` interface Props { anchor: 'foo'; @@ -329,6 +502,27 @@ ruleTester.run('no-deprecated', rule, { } ; `, + ` + export { + /** @deprecated */ + foo, + }; + `, + { + code: ` +/** @deprecated */ +function A() { + return
; +} + +const a = ; + `, + options: [ + { + allow: [{ from: 'file', name: 'A' }], + }, + ], + }, { code: ` /** @deprecated */ @@ -344,7 +538,62 @@ new A(); }, { code: ` +/** @deprecated */ +const deprecatedValue = 45; +const bar = deprecatedValue; + `, + options: [ + { + allow: [{ from: 'file', name: 'deprecatedValue' }], + }, + ], + }, + { + code: ` +class MyClass { + /** @deprecated */ + #privateProp = 42; + value = this.#privateProp; +} + `, + options: [ + { + allow: [{ from: 'file', name: 'privateProp' }], + }, + ], + }, + { + code: ` +/** @deprecated */ +const deprecatedValue = 45; +const bar = deprecatedValue; + `, + options: [ + { + allow: ['deprecatedValue'], + }, + ], + }, + { + code: ` import { exists } from 'fs'; +exists('/foo'); + `, + options: [ + { + allow: [ + { + from: 'package', + name: 'exists', + package: 'fs', + }, + ], + }, + ], + }, + { + code: ` +const { exists } = import('fs'); exists('/foo'); `, options: [ @@ -379,30 +628,6 @@ exists('/foo'); const c = a['b']; `, - { - code: ` - interface AllowedType { - /** @deprecated */ - prop: string; - } - - const obj: AllowedType = { - prop: 'test', - }; - - const value = obj['prop']; - `, - options: [ - { - allow: [ - { - from: 'file', - name: 'AllowedType', - }, - ], - }, - ], - }, ` const a = { /** @deprecated */ @@ -658,13 +883,13 @@ exists('/foo'); { code: ` /** @deprecated */ const a = { b: 1 }; - console.log(a); + a; `, errors: [ { - column: 21, + column: 9, data: { name: 'a' }, - endColumn: 22, + endColumn: 10, endLine: 3, line: 3, messageId: 'deprecated', @@ -709,13 +934,13 @@ exists('/foo'); { code: ` /** @deprecated */ const a = { b: 1 }; - console.log(a.b); + a.b; `, errors: [ { - column: 21, + column: 9, data: { name: 'a' }, - endColumn: 22, + endColumn: 10, endLine: 3, line: 3, messageId: 'deprecated', @@ -725,13 +950,13 @@ exists('/foo'); { code: ` /** @deprecated */ const a = { b: 1 }; - console.log(a?.b); + a['b']; `, errors: [ { - column: 21, + column: 9, data: { name: 'a' }, - endColumn: 22, + endColumn: 10, endLine: 3, line: 3, messageId: 'deprecated', @@ -740,8 +965,8 @@ exists('/foo'); }, { code: ` - /** @deprecated */ const a = { b: { c: 1 } }; - a.b.c; + /** @deprecated */ const a = { b: 1 }; + a?.b; `, errors: [ { @@ -756,8 +981,8 @@ exists('/foo'); }, { code: ` - /** @deprecated */ const a = { b: { c: 1 } }; - a.b?.c; + /** @deprecated */ const a = { b: 1 }; + a?.['b']; `, errors: [ { @@ -773,7 +998,7 @@ exists('/foo'); { code: ` /** @deprecated */ const a = { b: { c: 1 } }; - a?.b?.c; + a.b.c; `, errors: [ { @@ -788,22 +1013,107 @@ exists('/foo'); }, { code: ` - const a = { - /** @deprecated */ b: { c: 1 }, - }; - a.b.c; + /** @deprecated */ const a = { b: { c: 1 } }; + a.b?.c; `, errors: [ { - column: 11, - data: { name: 'b' }, - endColumn: 12, - endLine: 5, - line: 5, - messageId: 'deprecated', - }, - ], - }, + column: 9, + data: { name: 'a' }, + endColumn: 10, + endLine: 3, + line: 3, + messageId: 'deprecated', + }, + ], + }, + { + code: ` + /** @deprecated */ const a = { b: { c: 1 } }; + a?.b?.c; + `, + errors: [ + { + column: 9, + data: { name: 'a' }, + endColumn: 10, + endLine: 3, + line: 3, + messageId: 'deprecated', + }, + ], + }, + { + code: ` + /** @deprecated */ const a = { b: { c: 1 } }; + a?.['b']?.['c']; + `, + errors: [ + { + column: 9, + data: { name: 'a' }, + endColumn: 10, + endLine: 3, + line: 3, + messageId: 'deprecated', + }, + ], + }, + { + code: ` + const a = { + /** @deprecated */ b: { c: 1 }, + }; + a.b.c; + `, + errors: [ + { + column: 11, + data: { name: 'b' }, + endColumn: 12, + endLine: 5, + line: 5, + messageId: 'deprecated', + }, + ], + }, + { + code: ` + const a = { + /** @deprecated */ b: 1, + }; + const key = 'b'; + a[key]; + `, + errors: [ + { + column: 11, + data: { name: 'b' }, + endColumn: 14, + endLine: 6, + line: 6, + messageId: 'deprecated', + }, + ], + }, + { + code: ` + const a = { + /** @deprecated */ b: { c: 1 }, + }; + a['b']['c']; + `, + errors: [ + { + column: 11, + data: { name: 'b' }, + endColumn: 14, + endLine: 5, + line: 5, + messageId: 'deprecated', + }, + ], + }, { code: ` declare const a: { @@ -1157,6 +1467,53 @@ exists('/foo'); b(): string; } + declare const a: A; + const key = 'b'; + + a[key]; + `, + errors: [ + { + column: 11, + data: { name: 'b' }, + endColumn: 14, + endLine: 10, + line: 10, + messageId: 'deprecated', + }, + ], + }, + { + // only: true, + code: ` + declare class A { + /** @deprecated */ + b(): string; + } + + declare const a: A; + const key = 'b'; + + a[key](); + `, + errors: [ + { + column: 11, + data: { name: 'b' }, + endColumn: 14, + endLine: 10, + line: 10, + messageId: 'deprecated', + }, + ], + }, + { + code: ` + declare class A { + /** @deprecated */ + b(): string; + } + declare const a: A; a.b(); @@ -1203,6 +1560,96 @@ exists('/foo'); declare const a: A; + a['b']; + `, + errors: [ + { + column: 11, + data: { name: 'b' }, + endColumn: 14, + endLine: 9, + line: 9, + messageId: 'deprecated', + }, + ], + }, + { + code: ` + declare class A { + /** @deprecated */ + b(): string; + } + + declare const a: A; + const key = 'b'; + + a[\`\${key}\`]; + `, + errors: [ + { + column: 11, + data: { name: 'b' }, + endColumn: 19, + endLine: 10, + line: 10, + messageId: 'deprecated', + }, + ], + }, + { + code: ` + declare class A { + /** @deprecated */ + computed(): string; + } + + declare const a: A; + const k1 = 'comp'; + const k2 = 'uted'; + + a[\`\${k1}\${k2}\`]; + `, + errors: [ + { + column: 11, + data: { name: 'computed' }, + endColumn: 23, + endLine: 11, + line: 11, + messageId: 'deprecated', + }, + ], + }, + { + code: ` + declare class A { + /** @deprecated */ + b(): string; + } + + declare const a: A; + const c = \`\${a.b}\`; + `, + errors: [ + { + column: 24, + data: { name: 'b' }, + endColumn: 25, + endLine: 8, + line: 8, + messageId: 'deprecated', + }, + ], + }, + { + code: ` + declare class A { + /** @deprecated */ + b: () => string; + } + + declare const a: A; + a.b(); `, errors: [ @@ -1216,6 +1663,28 @@ exists('/foo'); }, ], }, + { + code: ` + declare class A { + /** @deprecated */ + b: () => string; + } + + declare const a: A; + + a['b'](); + `, + errors: [ + { + column: 11, + data: { name: 'b' }, + endColumn: 14, + endLine: 9, + line: 9, + messageId: 'deprecated', + }, + ], + }, { code: ` interface A { @@ -1238,6 +1707,74 @@ exists('/foo'); }, ], }, + { + code: ` + interface A { + /** @deprecated */ + b: () => string; + } + + declare const a: A; + const key = 'b'; + + a[key]; + `, + errors: [ + { + column: 11, + data: { name: 'b' }, + endColumn: 14, + endLine: 10, + line: 10, + messageId: 'deprecated', + }, + ], + }, + { + code: ` + interface A { + /** @deprecated */ + b: () => string; + } + + declare const a: A; + const key = 'b'; + + a[key](); + `, + errors: [ + { + column: 11, + data: { name: 'b' }, + endColumn: 14, + endLine: 10, + line: 10, + messageId: 'deprecated', + }, + ], + }, + { + code: ` + interface A { + /** @deprecated */ + b: () => string; + } + + declare const a: A; + + a['b'](); + `, + errors: [ + { + column: 11, + data: { name: 'b' }, + endColumn: 14, + endLine: 9, + line: 9, + messageId: 'deprecated', + }, + ], + }, { code: ` class A { @@ -1305,6 +1842,26 @@ exists('/foo'); }, ], }, + { + code: ` + declare class A { + /** @deprecated */ + static b: string; + } + + A['b']; + `, + errors: [ + { + column: 11, + data: { name: 'b' }, + endColumn: 14, + endLine: 7, + line: 7, + messageId: 'deprecated', + }, + ], + }, { code: ` declare const a: { @@ -1325,6 +1882,26 @@ exists('/foo'); }, ], }, + { + code: ` + declare const a: { + /** @deprecated */ + b: string; + }; + + a['b']; + `, + errors: [ + { + column: 11, + data: { name: 'b' }, + endColumn: 14, + endLine: 7, + line: 7, + messageId: 'deprecated', + }, + ], + }, { code: ` interface A { @@ -1459,27 +2036,67 @@ exists('/foo'); }, { code: ` - /** @deprecated */ - type A = string[]; - - declare const a: A; + /** @deprecated */ + type A = string[]; + + declare const a: A; + + const [b] = a; + `, + errors: [ + { + column: 26, + data: { name: 'A' }, + endColumn: 27, + endLine: 5, + line: 5, + messageId: 'deprecated', + }, + ], + }, + { + code: ` + namespace A { + /** @deprecated */ + export const b = ''; + } + + A.b; + `, + errors: [ + { + column: 11, + data: { name: 'b' }, + endColumn: 12, + endLine: 7, + line: 7, + messageId: 'deprecated', + }, + ], + }, + { + code: ` + namespace A { + /** @deprecated */ + export const b = ''; + } - const [b] = a; + A['b']; `, errors: [ { - column: 26, - data: { name: 'A' }, - endColumn: 27, - endLine: 5, - line: 5, + column: 11, + data: { name: 'b' }, + endColumn: 14, + endLine: 7, + line: 7, messageId: 'deprecated', }, ], }, { code: ` - namespace A { + export namespace A { /** @deprecated */ export const b = ''; } @@ -1499,12 +2116,12 @@ exists('/foo'); }, { code: ` - export namespace A { + namespace A { /** @deprecated */ - export const b = ''; + export function b() {} } - A.b; + A.b(); `, errors: [ { @@ -1524,13 +2141,13 @@ exists('/foo'); export function b() {} } - A.b(); + A['b'](); `, errors: [ { column: 11, data: { name: 'b' }, - endColumn: 12, + endColumn: 14, endLine: 7, line: 7, messageId: 'deprecated', @@ -1623,6 +2240,48 @@ exists('/foo'); }, ], }, + { + code: ` + enum A { + /** @deprecated */ + a, + } + + const key = 'a'; + + A[key]; + `, + errors: [ + { + column: 11, + data: { name: 'a' }, + endColumn: 14, + endLine: 9, + line: 9, + messageId: 'deprecated', + }, + ], + }, + { + code: ` + enum A { + /** @deprecated */ + a, + } + + A['a']; + `, + errors: [ + { + column: 11, + data: { name: 'a' }, + endColumn: 14, + endLine: 7, + line: 7, + messageId: 'deprecated', + }, + ], + }, { code: ` /** @deprecated */ @@ -2915,6 +3574,37 @@ class B extends A { }, ], }, + { + code: ` +import { exists } from 'fs'; +exists('/foo'); + `, + errors: [ + { + column: 1, + data: { + name: 'exists', + reason: + 'Since v1.0.0 - Use {@link stat} or {@link access} instead.', + }, + endColumn: 7, + endLine: 3, + line: 3, + messageId: 'deprecatedWithReason', + }, + ], + options: [ + { + allow: [ + { + from: 'package', + name: 'exists', + package: 'hoge', + }, + ], + }, + ], + }, { code: ` declare class A { @@ -2946,6 +3636,28 @@ class B extends A { declare const a: A; + a['b']; + `, + errors: [ + { + column: 11, + data: { name: 'b' }, + endColumn: 14, + endLine: 9, + line: 9, + messageId: 'deprecated', + }, + ], + }, + { + code: ` + declare class A { + /** @deprecated */ + accessor b: () => string; + } + + declare const a: A; + a.b(); `, errors: [ @@ -2959,6 +3671,28 @@ class B extends A { }, ], }, + { + code: ` + declare class A { + /** @deprecated */ + accessor b: () => string; + } + + declare const a: A; + + a['b'](); + `, + errors: [ + { + column: 11, + data: { name: 'b' }, + endColumn: 14, + endLine: 9, + line: 9, + messageId: 'deprecated', + }, + ], + }, { code: ` class A { @@ -3132,6 +3866,31 @@ class B extends A { }, ], }, + { + code: ` + declare const Keys: { + a: 1; + }; + + const a = { + /** @deprecated reason for deprecation */ + [1]: 'string', + }; + + const key = Keys.a; + const c = a[key]; + `, + errors: [ + { + column: 21, + data: { name: '1', reason: 'reason for deprecation' }, + endColumn: 24, + endLine: 12, + line: 12, + messageId: 'deprecatedWithReason', + }, + ], + }, { code: ` const a = { @@ -3173,5 +3932,121 @@ class B extends A { }, ], }, + { + code: ` + declare function x(): 'b'; + + const a = { + /** @deprecated */ + b: 'string', + }; + + const c = a[x()]; + `, + errors: [ + { + column: 21, + data: { name: 'b' }, + endColumn: 24, + endLine: 9, + line: 9, + messageId: 'deprecated', + }, + ], + }, + { + code: ` + declare const x: { y: 'b' }; + + const a = { + /** @deprecated */ + b: 'string', + }; + + const c = a[x.y]; + `, + errors: [ + { + column: 21, + data: { name: 'b' }, + endColumn: 24, + endLine: 9, + line: 9, + messageId: 'deprecated', + }, + ], + }, + { + code: ` + import { deprecatedFunction } from './deprecated'; + + export { deprecatedFunction }; + `, + errors: [ + { + column: 18, + endColumn: 36, + endLine: 4, + line: 4, + messageId: 'deprecated', + }, + ], + }, + { + code: ` + export { deprecatedFunction } from './deprecated'; + `, + errors: [ + { + column: 18, + endColumn: 36, + endLine: 2, + line: 2, + messageId: 'deprecated', + }, + ], + }, + { + code: ` + export type { T, U } from './deprecated'; + `, + errors: [ + { + column: 23, + endColumn: 24, + endLine: 2, + line: 2, + messageId: 'deprecatedWithReason', + }, + ], + }, + { + code: ` + export { default as foo } from './deprecated'; + `, + errors: [ + { + column: 29, + endColumn: 32, + endLine: 2, + line: 2, + messageId: 'deprecated', + }, + ], + }, + { + code: ` + export { deprecatedFunction as bar } from './deprecated'; + `, + errors: [ + { + column: 40, + endColumn: 43, + endLine: 2, + line: 2, + messageId: 'deprecated', + }, + ], + }, ], }); diff --git a/packages/eslint-plugin/tests/rules/no-duplicate-enum-values.test.ts b/packages/eslint-plugin/tests/rules/no-duplicate-enum-values.test.ts index a2e00872bd7c..81840e8cfcb8 100644 --- a/packages/eslint-plugin/tests/rules/no-duplicate-enum-values.test.ts +++ b/packages/eslint-plugin/tests/rules/no-duplicate-enum-values.test.ts @@ -25,6 +25,54 @@ enum E { } `, ` +enum E { + A = -1, + B = -2, +} + `, + ` +enum E { + A = +1, + B = +2, +} + `, + ` +enum E { + A = +1, + B = -1, +} + `, + ` +enum E { + A = 1, + B = -1, +} + `, + ` +enum E { + A = -0, + B = +0, +} + `, + ` +enum E { + A = -0, + B = 0, +} + `, + ` +enum E { + A = 1, + B = '1', +} + `, + ` +enum E { + A = -1, + B = '-1', +} + `, + ` enum E { A = 'A', B = 'B', @@ -74,6 +122,42 @@ enum E { } `, ` +enum E { + A = NaN, + B = NaN, +} + `, + ` +enum E { + A = NaN, + B = -NaN, +} + `, + ` +enum E { + A = 'NaN', + B = NaN, +} + `, + ` +enum E { + A = -+-0, + B = +-+0, +} + `, + ` +enum E { + A = -'', + B = 0, +} + `, + ` +enum E { + A = Infinity, + B = Infinity, +} + `, + ` const A = 'A'; enum E { A = 'A', @@ -100,6 +184,166 @@ enum E { }, { code: ` +enum E { + A = -1, + B = -1, +} + `, + errors: [ + { + column: 3, + data: { value: -1 }, + line: 4, + messageId: 'duplicateValue', + }, + ], + }, + { + code: ` +enum E { + A = +1, + B = +1, +} + `, + errors: [ + { + column: 3, + data: { value: 1 }, + line: 4, + messageId: 'duplicateValue', + }, + ], + }, + { + code: ` +enum E { + A = +0, + B = 0, +} + `, + errors: [ + { + column: 3, + data: { value: 0 }, + line: 4, + messageId: 'duplicateValue', + }, + ], + }, + { + code: ` +enum E { + A = -0, + B = -0, +} + `, + errors: [ + { + column: 3, + data: { value: -0 }, + line: 4, + messageId: 'duplicateValue', + }, + ], + }, + { + code: ` +enum E { + A = +'0', + B = 0, +} + `, + errors: [ + { + column: 3, + data: { value: 0 }, + line: 4, + messageId: 'duplicateValue', + }, + ], + }, + { + code: ` +enum E { + A = 0x10, + B = 16, +} + `, + errors: [ + { + column: 3, + data: { value: 0x10 }, + line: 4, + messageId: 'duplicateValue', + }, + ], + }, + { + code: ` +enum E { + A = +'1e2', + B = 100, +} + `, + errors: [ + { + column: 3, + data: { value: 1e2 }, + line: 4, + messageId: 'duplicateValue', + }, + ], + }, + { + code: ` +enum E { + A = +'', + B = 0, +} + `, + errors: [ + { + column: 3, + data: { value: 0 }, + line: 4, + messageId: 'duplicateValue', + }, + ], + }, + { + code: ` +enum E { + A = -+1, + B = +-1, +} + `, + errors: [ + { + column: 3, + data: { value: -1 }, + line: 4, + messageId: 'duplicateValue', + }, + ], + }, + { + code: ` +enum E { + A = -\`0\`, + B = -0, +} + `, + errors: [ + { + column: 3, + data: { value: -0 }, + line: 4, + messageId: 'duplicateValue', + }, + ], + }, + { + code: ` enum E { A = 'A', B = 'A', diff --git a/packages/eslint-plugin/tests/rules/no-duplicate-type-constituents.test.ts b/packages/eslint-plugin/tests/rules/no-duplicate-type-constituents.test.ts index 90d32bf0010f..7cbae0db756a 100644 --- a/packages/eslint-plugin/tests/rules/no-duplicate-type-constituents.test.ts +++ b/packages/eslint-plugin/tests/rules/no-duplicate-type-constituents.test.ts @@ -1,18 +1,7 @@ -import { RuleTester } from '@typescript-eslint/rule-tester'; - import rule from '../../src/rules/no-duplicate-type-constituents'; -import { getFixturesRootDir } from '../RuleTester'; - -const rootPath = getFixturesRootDir(); +import { createRuleTesterWithTypes } from '../RuleTester'; -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootPath, - }, - }, -}); +const ruleTester = createRuleTesterWithTypes(); ruleTester.run('no-duplicate-type-constituents', rule, { valid: [ diff --git a/packages/eslint-plugin/tests/rules/no-dynamic-delete.test.ts b/packages/eslint-plugin/tests/rules/no-dynamic-delete.test.ts index 09fc5af480d5..00e32626e2bb 100644 --- a/packages/eslint-plugin/tests/rules/no-dynamic-delete.test.ts +++ b/packages/eslint-plugin/tests/rules/no-dynamic-delete.test.ts @@ -1,18 +1,7 @@ -import { RuleTester } from '@typescript-eslint/rule-tester'; - import rule from '../../src/rules/no-dynamic-delete'; -import { getFixturesRootDir } from '../RuleTester'; - -const rootPath = getFixturesRootDir(); +import { createRuleTesterWithTypes } from '../RuleTester'; -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootPath, - }, - }, -}); +const ruleTester = createRuleTesterWithTypes(); ruleTester.run('no-dynamic-delete', rule, { valid: [ diff --git a/packages/eslint-plugin/tests/rules/no-empty-function.test.ts b/packages/eslint-plugin/tests/rules/no-empty-function.test.ts index e3e5e39ccb90..4f36f96e584a 100644 --- a/packages/eslint-plugin/tests/rules/no-empty-function.test.ts +++ b/packages/eslint-plugin/tests/rules/no-empty-function.test.ts @@ -96,6 +96,16 @@ class Person { }, line: 3, messageId: 'unexpected', + suggestions: [ + { + messageId: 'suggestComment', + output: ` +class Person { + constructor(name: string) { /* empty */ } +} + `, + }, + ], }, ], }, @@ -113,6 +123,16 @@ class Person { }, line: 3, messageId: 'unexpected', + suggestions: [ + { + messageId: 'suggestComment', + output: ` +class Person { + otherMethod(name: string) { /* empty */ } +} + `, + }, + ], }, ], }, @@ -130,6 +150,16 @@ class Foo { }, line: 3, messageId: 'unexpected', + suggestions: [ + { + messageId: 'suggestComment', + output: ` +class Foo { + private constructor() { /* empty */ } +} + `, + }, + ], }, ], }, @@ -147,6 +177,16 @@ class Foo { }, line: 3, messageId: 'unexpected', + suggestions: [ + { + messageId: 'suggestComment', + output: ` +class Foo { + protected constructor() { /* empty */ } +} + `, + }, + ], }, ], }, @@ -162,6 +202,14 @@ function foo() {} }, line: 2, messageId: 'unexpected', + suggestions: [ + { + messageId: 'suggestComment', + output: ` +function foo() { /* empty */ } + `, + }, + ], }, ], }, @@ -180,6 +228,17 @@ class Foo { }, line: 4, messageId: 'unexpected', + suggestions: [ + { + messageId: 'suggestComment', + output: ` +class Foo { + @decorator() + foo() { /* empty */ } +} + `, + }, + ], }, ], }, @@ -197,6 +256,16 @@ class Foo extends Base { }, line: 3, messageId: 'unexpected', + suggestions: [ + { + messageId: 'suggestComment', + output: ` +class Foo extends Base { + override foo() { /* empty */ } +} + `, + }, + ], }, ], }, 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 19d501a347b8..b04a60d2ad06 100644 --- a/packages/eslint-plugin/tests/rules/no-extraneous-class.test.ts +++ b/packages/eslint-plugin/tests/rules/no-extraneous-class.test.ts @@ -1,5 +1,4 @@ import { RuleTester } from '@typescript-eslint/rule-tester'; -import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import rule from '../../src/rules/no-extraneous-class'; @@ -176,12 +175,7 @@ export default class { static hello() {} } `, - errors: [ - { - ...onlyStatic, - type: AST_NODE_TYPES.ClassDeclaration, - }, - ], + errors: [onlyStatic], }, { code: ` diff --git a/packages/eslint-plugin/tests/rules/no-floating-promises.test.ts b/packages/eslint-plugin/tests/rules/no-floating-promises.test.ts index 4835087e7cb6..0ed85d5b7cef 100644 --- a/packages/eslint-plugin/tests/rules/no-floating-promises.test.ts +++ b/packages/eslint-plugin/tests/rules/no-floating-promises.test.ts @@ -1,19 +1,10 @@ -import { RuleTester } from '@typescript-eslint/rule-tester'; import * as path from 'node:path'; import rule from '../../src/rules/no-floating-promises'; -import { getFixturesRootDir } from '../RuleTester'; +import { createRuleTesterWithTypes, getFixturesRootDir } from '../RuleTester'; const rootDir = getFixturesRootDir(); - -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootDir, - }, - }, -}); +const ruleTester = createRuleTesterWithTypes(); ruleTester.run('no-floating-promises', rule, { valid: [ @@ -112,18 +103,18 @@ async function test() { `, ` async function test() { - Promise.resolve().catch(() => {}), 123; - 123, + (Promise.resolve().catch(() => {}), 123); + (123, Promise.resolve().then( () => {}, () => {}, - ); - 123, + )); + (123, Promise.resolve().then( () => {}, () => {}, ), - 123; + 123); } `, ` @@ -512,7 +503,7 @@ interface SafeThenable { ): SafeThenable; } let promise: SafeThenable = Promise.resolve(5); -0, promise; +(0, promise); `, options: [ { @@ -594,7 +585,7 @@ interface SafeThenable { ): SafeThenable; } let promise: () => SafeThenable = () => Promise.resolve(5); -0, promise(); +(0, promise()); `, options: [ { @@ -824,6 +815,8 @@ promise().then(() => {}); ], }, { + // TODO: Skipped pending resolution of https://github.com/typescript-eslint/typescript-eslint/issues/11504 + skip: true, code: ` import { it } from 'node:test'; @@ -866,6 +859,34 @@ declare function createMyThenable(): MyThenable; createMyThenable(); `, + { + code: ` +const randomAsyncFunction = async () => { + return Promise.resolve(true); +}; + +randomAsyncFunction(); + `, + options: [ + { + allowForKnownSafeCalls: ['randomAsyncFunction'], + }, + ], + }, + { + code: ` +async function myAsyncFunction() { + return Promise.resolve('test'); +} + +myAsyncFunction(); + `, + options: [ + { + allowForKnownSafeCalls: ['myAsyncFunction'], + }, + ], + }, ], invalid: [ @@ -2000,9 +2021,9 @@ async function test() { { code: ` async function test() { - Promise.resolve(), 123; - 123, Promise.resolve(); - 123, Promise.resolve(), 123; + (Promise.resolve(), 123); + (123, Promise.resolve()); + (123, Promise.resolve(), 123); } `, errors: [ @@ -2015,8 +2036,8 @@ async function test() { output: ` async function test() { void (Promise.resolve(), 123); - 123, Promise.resolve(); - 123, Promise.resolve(), 123; + (123, Promise.resolve()); + (123, Promise.resolve(), 123); } `, }, @@ -2025,8 +2046,8 @@ async function test() { output: ` async function test() { await (Promise.resolve(), 123); - 123, Promise.resolve(); - 123, Promise.resolve(), 123; + (123, Promise.resolve()); + (123, Promise.resolve(), 123); } `, }, @@ -2040,9 +2061,9 @@ async function test() { messageId: 'floatingFixVoid', output: ` async function test() { - Promise.resolve(), 123; + (Promise.resolve(), 123); void (123, Promise.resolve()); - 123, Promise.resolve(), 123; + (123, Promise.resolve(), 123); } `, }, @@ -2050,9 +2071,9 @@ async function test() { messageId: 'floatingFixAwait', output: ` async function test() { - Promise.resolve(), 123; + (Promise.resolve(), 123); await (123, Promise.resolve()); - 123, Promise.resolve(), 123; + (123, Promise.resolve(), 123); } `, }, @@ -2066,8 +2087,8 @@ async function test() { messageId: 'floatingFixVoid', output: ` async function test() { - Promise.resolve(), 123; - 123, Promise.resolve(); + (Promise.resolve(), 123); + (123, Promise.resolve()); void (123, Promise.resolve(), 123); } `, @@ -2076,8 +2097,8 @@ async function test() { messageId: 'floatingFixAwait', output: ` async function test() { - Promise.resolve(), 123; - 123, Promise.resolve(); + (Promise.resolve(), 123); + (123, Promise.resolve()); await (123, Promise.resolve(), 123); } `, @@ -2194,7 +2215,7 @@ await /* ... */ returnsPromise(); async function returnsPromise() { return 'value'; } -1, returnsPromise(); +(1, returnsPromise()); `, errors: [ { @@ -4516,7 +4537,7 @@ await promiseIntersection.finally(() => {}); }, { code: ` -Promise.resolve().finally(() => {}), 123; +(Promise.resolve().finally(() => {}), 123); `, errors: [ { diff --git a/packages/eslint-plugin/tests/rules/no-for-in-array.test.ts b/packages/eslint-plugin/tests/rules/no-for-in-array.test.ts index 7721006b1d75..f781d049ebf2 100644 --- a/packages/eslint-plugin/tests/rules/no-for-in-array.test.ts +++ b/packages/eslint-plugin/tests/rules/no-for-in-array.test.ts @@ -1,17 +1,10 @@ -import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; +import { noFormat } from '@typescript-eslint/rule-tester'; import rule from '../../src/rules/no-for-in-array'; -import { getFixturesRootDir } from '../RuleTester'; +import { createRuleTesterWithTypes, getFixturesRootDir } from '../RuleTester'; const rootDir = getFixturesRootDir(); -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootDir, - }, - }, -}); +const ruleTester = createRuleTesterWithTypes(); ruleTester.run('no-for-in-array', rule, { valid: [ 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 5ba0001aaa79..19cb5297a85a 100644 --- a/packages/eslint-plugin/tests/rules/no-implied-eval.test.ts +++ b/packages/eslint-plugin/tests/rules/no-implied-eval.test.ts @@ -1,17 +1,7 @@ -import { RuleTester } from '@typescript-eslint/rule-tester'; - import rule from '../../src/rules/no-implied-eval'; -import { getFixturesRootDir } from '../RuleTester'; - -const rootDir = getFixturesRootDir(); -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootDir, - }, - }, -}); +import { createRuleTesterWithTypes } from '../RuleTester'; + +const ruleTester = createRuleTesterWithTypes(); ruleTester.run('no-implied-eval', rule, { valid: [ 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 79304307ea3d..5cb60d8f6c85 100644 --- a/packages/eslint-plugin/tests/rules/no-inferrable-types.test.ts +++ b/packages/eslint-plugin/tests/rules/no-inferrable-types.test.ts @@ -1,100 +1,50 @@ -import type { InvalidTestCase } from '@typescript-eslint/rule-tester'; - import { RuleTester } from '@typescript-eslint/rule-tester'; -import type { - InferMessageIdsTypeFromRule, - InferOptionsTypeFromRule, -} from '../../src/util'; - import rule from '../../src/rules/no-inferrable-types'; -type MessageIds = InferMessageIdsTypeFromRule; -type Options = InferOptionsTypeFromRule; - -const testCases = [ - { - code: [ - '10n', - '-10n', - 'BigInt(10)', - '-BigInt(10)', - 'BigInt?.(10)', - '-BigInt?.(10)', - ], - type: 'bigint', - }, - { - code: ['false', 'true', 'Boolean(null)', 'Boolean?.(null)', '!0'], - type: 'boolean', - }, - { - code: [ - '10', - '+10', - '-10', - 'Number("1")', - '+Number("1")', - '-Number("1")', - 'Number?.("1")', - '+Number?.("1")', - '-Number?.("1")', - 'Infinity', - '+Infinity', - '-Infinity', - 'NaN', - '+NaN', - '-NaN', - ], - type: 'number', - }, - { - code: ['null'], - type: 'null', - }, - { - code: ['/a/', 'RegExp("a")', 'RegExp?.("a")', 'new RegExp("a")'], - type: 'RegExp', - }, - { - code: ['"str"', "'str'", '`str`', 'String(1)', 'String?.(1)'], - type: 'string', - }, - { - code: ['Symbol("a")', 'Symbol?.("a")'], - type: 'symbol', - }, - { - code: ['undefined', 'void someValue'], - type: 'undefined', - }, -]; -const validTestCases = testCases.flatMap(c => - c.code.map(code => `const a = ${code}`), -); -const invalidTestCases: InvalidTestCase[] = - testCases.flatMap(cas => - cas.code.map(code => ({ - code: `const a: ${cas.type} = ${code}`, - errors: [ - { - column: 7, - data: { - type: cas.type, - }, - line: 1, - messageId: 'noInferrableType', - }, - ], - output: `const a = ${code}`, - })), - ); - const ruleTester = new RuleTester(); ruleTester.run('no-inferrable-types', rule, { valid: [ - ...validTestCases, + 'const a = 10n;', + 'const a = -10n;', + 'const a = BigInt(10);', + 'const a = -BigInt(10);', + 'const a = BigInt?.(10);', + 'const a = -BigInt?.(10);', + 'const a = false;', + 'const a = true;', + 'const a = Boolean(null);', + 'const a = Boolean?.(null);', + 'const a = !0;', + 'const a = 10;', + 'const a = +10;', + 'const a = -10;', + "const a = Number('1');", + "const a = +Number('1');", + "const a = -Number('1');", + "const a = Number?.('1');", + "const a = +Number?.('1');", + "const a = -Number?.('1');", + 'const a = Infinity;', + 'const a = +Infinity;', + 'const a = -Infinity;', + 'const a = NaN;', + 'const a = +NaN;', + 'const a = -NaN;', + 'const a = null;', + 'const a = /a/;', + "const a = RegExp('a');", + "const a = RegExp?.('a');", + "const a = new RegExp('a');", + "const a = 'str';", + 'const a = `str`;', + 'const a = String(1);', + 'const a = String?.(1);', + "const a = Symbol('a');", + "const a = Symbol?.('a');", + 'const a = undefined;', + 'const a = void someValue;', "const fn = (a = 5, b = true, c = 'foo') => {};", "const fn = function (a = 5, b = true, c = 'foo') {};", @@ -171,7 +121,553 @@ class Foo { ], invalid: [ - ...invalidTestCases, + { + code: 'const a: bigint = 10n;', + errors: [ + { + column: 7, + data: { + type: 'bigint', + }, + line: 1, + messageId: 'noInferrableType', + }, + ], + output: 'const a = 10n;', + }, + { + code: 'const a: bigint = -10n;', + errors: [ + { + column: 7, + data: { + type: 'bigint', + }, + line: 1, + messageId: 'noInferrableType', + }, + ], + output: 'const a = -10n;', + }, + { + code: 'const a: bigint = BigInt(10);', + errors: [ + { + column: 7, + data: { + type: 'bigint', + }, + line: 1, + messageId: 'noInferrableType', + }, + ], + output: 'const a = BigInt(10);', + }, + { + code: 'const a: bigint = -BigInt(10);', + errors: [ + { + column: 7, + data: { + type: 'bigint', + }, + line: 1, + messageId: 'noInferrableType', + }, + ], + output: 'const a = -BigInt(10);', + }, + { + code: 'const a: bigint = BigInt?.(10);', + errors: [ + { + column: 7, + data: { + type: 'bigint', + }, + line: 1, + messageId: 'noInferrableType', + }, + ], + output: 'const a = BigInt?.(10);', + }, + { + code: 'const a: bigint = -BigInt?.(10);', + errors: [ + { + column: 7, + data: { + type: 'bigint', + }, + line: 1, + messageId: 'noInferrableType', + }, + ], + output: 'const a = -BigInt?.(10);', + }, + { + code: 'const a: boolean = false;', + errors: [ + { + column: 7, + data: { + type: 'boolean', + }, + line: 1, + messageId: 'noInferrableType', + }, + ], + output: 'const a = false;', + }, + { + code: 'const a: boolean = true;', + errors: [ + { + column: 7, + data: { + type: 'boolean', + }, + line: 1, + messageId: 'noInferrableType', + }, + ], + output: 'const a = true;', + }, + { + code: 'const a: boolean = Boolean(null);', + errors: [ + { + column: 7, + data: { + type: 'boolean', + }, + line: 1, + messageId: 'noInferrableType', + }, + ], + output: 'const a = Boolean(null);', + }, + { + code: 'const a: boolean = Boolean?.(null);', + errors: [ + { + column: 7, + data: { + type: 'boolean', + }, + line: 1, + messageId: 'noInferrableType', + }, + ], + output: 'const a = Boolean?.(null);', + }, + { + code: 'const a: boolean = !0;', + errors: [ + { + column: 7, + data: { + type: 'boolean', + }, + line: 1, + messageId: 'noInferrableType', + }, + ], + output: 'const a = !0;', + }, + { + code: 'const a: number = 10;', + errors: [ + { + column: 7, + data: { + type: 'number', + }, + line: 1, + messageId: 'noInferrableType', + }, + ], + output: 'const a = 10;', + }, + { + code: 'const a: number = +10;', + errors: [ + { + column: 7, + data: { + type: 'number', + }, + line: 1, + messageId: 'noInferrableType', + }, + ], + output: 'const a = +10;', + }, + { + code: 'const a: number = -10;', + errors: [ + { + column: 7, + data: { + type: 'number', + }, + line: 1, + messageId: 'noInferrableType', + }, + ], + output: 'const a = -10;', + }, + { + code: "const a: number = Number('1');", + errors: [ + { + column: 7, + data: { + type: 'number', + }, + line: 1, + messageId: 'noInferrableType', + }, + ], + output: "const a = Number('1');", + }, + { + code: "const a: number = +Number('1');", + errors: [ + { + column: 7, + data: { + type: 'number', + }, + line: 1, + messageId: 'noInferrableType', + }, + ], + output: "const a = +Number('1');", + }, + { + code: "const a: number = -Number('1');", + errors: [ + { + column: 7, + data: { + type: 'number', + }, + line: 1, + messageId: 'noInferrableType', + }, + ], + output: "const a = -Number('1');", + }, + { + code: "const a: number = Number?.('1');", + errors: [ + { + column: 7, + data: { + type: 'number', + }, + line: 1, + messageId: 'noInferrableType', + }, + ], + output: "const a = Number?.('1');", + }, + { + code: "const a: number = +Number?.('1');", + errors: [ + { + column: 7, + data: { + type: 'number', + }, + line: 1, + messageId: 'noInferrableType', + }, + ], + output: "const a = +Number?.('1');", + }, + { + code: "const a: number = -Number?.('1');", + errors: [ + { + column: 7, + data: { + type: 'number', + }, + line: 1, + messageId: 'noInferrableType', + }, + ], + output: "const a = -Number?.('1');", + }, + { + code: 'const a: number = Infinity;', + errors: [ + { + column: 7, + data: { + type: 'number', + }, + line: 1, + messageId: 'noInferrableType', + }, + ], + output: 'const a = Infinity;', + }, + { + code: 'const a: number = +Infinity;', + errors: [ + { + column: 7, + data: { + type: 'number', + }, + line: 1, + messageId: 'noInferrableType', + }, + ], + output: 'const a = +Infinity;', + }, + { + code: 'const a: number = -Infinity;', + errors: [ + { + column: 7, + data: { + type: 'number', + }, + line: 1, + messageId: 'noInferrableType', + }, + ], + output: 'const a = -Infinity;', + }, + { + code: 'const a: number = NaN;', + errors: [ + { + column: 7, + data: { + type: 'number', + }, + line: 1, + messageId: 'noInferrableType', + }, + ], + output: 'const a = NaN;', + }, + { + code: 'const a: number = +NaN;', + errors: [ + { + column: 7, + data: { + type: 'number', + }, + line: 1, + messageId: 'noInferrableType', + }, + ], + output: 'const a = +NaN;', + }, + { + code: 'const a: number = -NaN;', + errors: [ + { + column: 7, + data: { + type: 'number', + }, + line: 1, + messageId: 'noInferrableType', + }, + ], + output: 'const a = -NaN;', + }, + { + code: 'const a: null = null;', + errors: [ + { + column: 7, + data: { + type: 'null', + }, + line: 1, + messageId: 'noInferrableType', + }, + ], + output: 'const a = null;', + }, + { + code: 'const a: RegExp = /a/;', + errors: [ + { + column: 7, + data: { + type: 'RegExp', + }, + line: 1, + messageId: 'noInferrableType', + }, + ], + output: 'const a = /a/;', + }, + { + code: "const a: RegExp = RegExp('a');", + errors: [ + { + column: 7, + data: { + type: 'RegExp', + }, + line: 1, + messageId: 'noInferrableType', + }, + ], + output: "const a = RegExp('a');", + }, + { + code: "const a: RegExp = RegExp?.('a');", + errors: [ + { + column: 7, + data: { + type: 'RegExp', + }, + line: 1, + messageId: 'noInferrableType', + }, + ], + output: "const a = RegExp?.('a');", + }, + { + code: "const a: RegExp = new RegExp('a');", + errors: [ + { + column: 7, + data: { + type: 'RegExp', + }, + line: 1, + messageId: 'noInferrableType', + }, + ], + output: "const a = new RegExp('a');", + }, + { + code: "const a: string = 'str';", + errors: [ + { + column: 7, + data: { + type: 'string', + }, + line: 1, + messageId: 'noInferrableType', + }, + ], + output: "const a = 'str';", + }, + { + code: 'const a: string = `str`;', + errors: [ + { + column: 7, + data: { + type: 'string', + }, + line: 1, + messageId: 'noInferrableType', + }, + ], + output: 'const a = `str`;', + }, + { + code: 'const a: string = String(1);', + errors: [ + { + column: 7, + data: { + type: 'string', + }, + line: 1, + messageId: 'noInferrableType', + }, + ], + output: 'const a = String(1);', + }, + { + code: 'const a: string = String?.(1);', + errors: [ + { + column: 7, + data: { + type: 'string', + }, + line: 1, + messageId: 'noInferrableType', + }, + ], + output: 'const a = String?.(1);', + }, + { + code: "const a: symbol = Symbol('a');", + errors: [ + { + column: 7, + data: { + type: 'symbol', + }, + line: 1, + messageId: 'noInferrableType', + }, + ], + output: "const a = Symbol('a');", + }, + { + code: "const a: symbol = Symbol?.('a');", + errors: [ + { + column: 7, + data: { + type: 'symbol', + }, + line: 1, + messageId: 'noInferrableType', + }, + ], + output: "const a = Symbol?.('a');", + }, + { + code: 'const a: undefined = undefined;', + errors: [ + { + column: 7, + data: { + type: 'undefined', + }, + line: 1, + messageId: 'noInferrableType', + }, + ], + output: 'const a = undefined;', + }, + { + code: 'const a: undefined = void someValue;', + errors: [ + { + column: 7, + data: { + type: 'undefined', + }, + line: 1, + messageId: 'noInferrableType', + }, + ], + output: 'const a = void someValue;', + }, + { // This is invalid TS semantic, but it's trivial to make valid anyway code: 'const fn = (a?: number = 5) => {};', diff --git a/packages/eslint-plugin/tests/rules/no-loop-func.test.ts b/packages/eslint-plugin/tests/rules/no-loop-func.test.ts index 8b22f6a4ce8a..6075aec1b4ad 100644 --- a/packages/eslint-plugin/tests/rules/no-loop-func.test.ts +++ b/packages/eslint-plugin/tests/rules/no-loop-func.test.ts @@ -1,5 +1,4 @@ import { RuleTester } from '@typescript-eslint/rule-tester'; -import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import rule from '../../src/rules/no-loop-func'; @@ -479,7 +478,6 @@ for (var i = 0; i < l; i++) { { data: { varNames: "'i'" }, messageId: 'unsafeRefs', - type: AST_NODE_TYPES.FunctionExpression, }, ], }, @@ -497,7 +495,6 @@ for (var i = 0; i < l; i++) { { data: { varNames: "'i', 'j'" }, messageId: 'unsafeRefs', - type: AST_NODE_TYPES.FunctionExpression, }, ], }, @@ -513,7 +510,6 @@ for (var i in {}) { { data: { varNames: "'i'" }, messageId: 'unsafeRefs', - type: AST_NODE_TYPES.FunctionExpression, }, ], }, @@ -529,7 +525,6 @@ for (var i of {}) { { data: { varNames: "'i'" }, messageId: 'unsafeRefs', - type: AST_NODE_TYPES.FunctionExpression, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -546,7 +541,6 @@ for (var i = 0; i < l; i++) { { data: { varNames: "'i'" }, messageId: 'unsafeRefs', - type: AST_NODE_TYPES.ArrowFunctionExpression, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -563,7 +557,6 @@ for (var i = 0; i < l; i++) { { data: { varNames: "'i'" }, messageId: 'unsafeRefs', - type: AST_NODE_TYPES.FunctionExpression, }, ], }, @@ -580,7 +573,6 @@ for (var i = 0; i < l; i++) { { data: { varNames: "'i'" }, messageId: 'unsafeRefs', - type: AST_NODE_TYPES.FunctionDeclaration, }, ], }, @@ -600,7 +592,6 @@ for (let i = 0; i < l; i++) { { data: { varNames: "'a'" }, messageId: 'unsafeRefs', - type: AST_NODE_TYPES.FunctionExpression, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -619,7 +610,6 @@ for (let i in {}) { { data: { varNames: "'a'" }, messageId: 'unsafeRefs', - type: AST_NODE_TYPES.FunctionExpression, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -638,7 +628,6 @@ a = 1; { data: { varNames: "'a'" }, messageId: 'unsafeRefs', - type: AST_NODE_TYPES.FunctionExpression, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -659,7 +648,6 @@ for (let i = 0; i < l; i++) { { data: { varNames: "'a'" }, messageId: 'unsafeRefs', - type: AST_NODE_TYPES.FunctionExpression, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -680,7 +668,6 @@ for (let i in {}) { { data: { varNames: "'a'" }, messageId: 'unsafeRefs', - type: AST_NODE_TYPES.FunctionDeclaration, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -701,7 +688,6 @@ a = 1; { data: { varNames: "'a'" }, messageId: 'unsafeRefs', - type: AST_NODE_TYPES.ArrowFunctionExpression, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -717,7 +703,6 @@ for (var i = 0; i < 10; ++i) { { data: { varNames: "'i'" }, messageId: 'unsafeRefs', - type: AST_NODE_TYPES.ArrowFunctionExpression, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -738,7 +723,6 @@ for (let x of xs) { { data: { varNames: "'a'" }, messageId: 'unsafeRefs', - type: AST_NODE_TYPES.FunctionExpression, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -757,7 +741,6 @@ for (var x of xs) { { data: { varNames: "'x'" }, messageId: 'unsafeRefs', - type: AST_NODE_TYPES.FunctionExpression, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -774,7 +757,6 @@ for (var x of xs) { { data: { varNames: "'x'" }, messageId: 'unsafeRefs', - type: AST_NODE_TYPES.FunctionExpression, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -793,7 +775,6 @@ for (let x of xs) { { data: { varNames: "'a'" }, messageId: 'unsafeRefs', - type: AST_NODE_TYPES.FunctionExpression, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -812,7 +793,6 @@ for (let x of xs) { { data: { varNames: "'a'" }, messageId: 'unsafeRefs', - type: AST_NODE_TYPES.FunctionExpression, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -834,7 +814,6 @@ foo(); { data: { varNames: "'a'" }, messageId: 'unsafeRefs', - type: AST_NODE_TYPES.FunctionExpression, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -856,7 +835,6 @@ foo(); { data: { varNames: "'a'" }, messageId: 'unsafeRefs', - type: AST_NODE_TYPES.FunctionExpression, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, diff --git a/packages/eslint-plugin/tests/rules/no-meaningless-void-operator.test.ts b/packages/eslint-plugin/tests/rules/no-meaningless-void-operator.test.ts index 38c5a239740a..15c6d69a34d8 100644 --- a/packages/eslint-plugin/tests/rules/no-meaningless-void-operator.test.ts +++ b/packages/eslint-plugin/tests/rules/no-meaningless-void-operator.test.ts @@ -1,18 +1,7 @@ -import { RuleTester } from '@typescript-eslint/rule-tester'; - import rule from '../../src/rules/no-meaningless-void-operator'; -import { getFixturesRootDir } from '../RuleTester'; - -const rootDir = getFixturesRootDir(); +import { createRuleTesterWithTypes } from '../RuleTester'; -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootDir, - }, - }, -}); +const ruleTester = createRuleTesterWithTypes(); ruleTester.run('no-meaningless-void-operator', rule, { valid: [ diff --git a/packages/eslint-plugin/tests/rules/no-misused-promises.test.ts b/packages/eslint-plugin/tests/rules/no-misused-promises.test.ts index 5f7f1faf8bb4..089a28c9004c 100644 --- a/packages/eslint-plugin/tests/rules/no-misused-promises.test.ts +++ b/packages/eslint-plugin/tests/rules/no-misused-promises.test.ts @@ -1,18 +1,7 @@ -import { RuleTester } from '@typescript-eslint/rule-tester'; - import rule from '../../src/rules/no-misused-promises'; -import { getFixturesRootDir } from '../RuleTester'; - -const rootDir = getFixturesRootDir(); +import { createRuleTesterWithTypes } from '../RuleTester'; -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootDir, - }, - }, -}); +const ruleTester = createRuleTesterWithTypes(); ruleTester.run('no-misused-promises', rule, { valid: [ @@ -146,7 +135,7 @@ if (returnsPromise?.call()) { `, 'Promise.resolve() ?? false;', ` -function test(a: Promise | undefinded) { +function test(a: Promise | undefined) { const foo = a ?? Promise.reject(); } `, @@ -1096,6 +1085,13 @@ declare const useCallback: unknown>( ) => T; useCallback(async () => {}); `, + ` +Promise.reject(3).finally(async () => {}); + `, + ` +const f = 'finally'; +Promise.reject(3)[f](async () => {}); + `, ], invalid: [ @@ -2646,5 +2642,22 @@ const obj: O = { }, ], }, + { + code: ` +type A = { f: () => void } | undefined; +const a: A = { + async f() {}, +}; + `, + errors: [ + { + column: 3, + endColumn: 10, + endLine: 4, + line: 4, + messageId: 'voidReturnProperty', + }, + ], + }, ], }); diff --git a/packages/eslint-plugin/tests/rules/no-misused-spread.test.ts b/packages/eslint-plugin/tests/rules/no-misused-spread.test.ts index e187a85a1975..3a7f950fd8e6 100644 --- a/packages/eslint-plugin/tests/rules/no-misused-spread.test.ts +++ b/packages/eslint-plugin/tests/rules/no-misused-spread.test.ts @@ -1,17 +1,10 @@ -import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; +import { noFormat } from '@typescript-eslint/rule-tester'; import rule from '../../src/rules/no-misused-spread'; -import { getFixturesRootDir } from '../RuleTester'; +import { createRuleTesterWithTypes } from '../RuleTester'; -const rootPath = getFixturesRootDir(); - -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig-with-dom.json', - tsconfigRootDir: rootPath, - }, - }, +const ruleTester = createRuleTesterWithTypes({ + project: './tsconfig-with-dom.json', }); ruleTester.run('no-misused-spread', rule, { diff --git a/packages/eslint-plugin/tests/rules/no-mixed-enums.test.ts b/packages/eslint-plugin/tests/rules/no-mixed-enums.test.ts index 603afa4fc0d5..4bd17db5e284 100644 --- a/packages/eslint-plugin/tests/rules/no-mixed-enums.test.ts +++ b/packages/eslint-plugin/tests/rules/no-mixed-enums.test.ts @@ -1,17 +1,7 @@ -import { RuleTester } from '@typescript-eslint/rule-tester'; - import rule from '../../src/rules/no-mixed-enums'; -import { getFixturesRootDir } from '../RuleTester'; +import { createRuleTesterWithTypes } from '../RuleTester'; -const rootDir = getFixturesRootDir(); -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootDir, - }, - }, -}); +const ruleTester = createRuleTesterWithTypes(); ruleTester.run('no-mixed-enums', rule, { valid: [ diff --git a/packages/eslint-plugin/tests/rules/no-non-null-assertion.test.ts b/packages/eslint-plugin/tests/rules/no-non-null-assertion.test.ts index 98dde42f9943..137effe702cc 100644 --- a/packages/eslint-plugin/tests/rules/no-non-null-assertion.test.ts +++ b/packages/eslint-plugin/tests/rules/no-non-null-assertion.test.ts @@ -387,5 +387,39 @@ x?. }, ], }, + { + code: ` +document.querySelector('input')!.files = new FileList(); + `, + errors: [ + { + column: 1, + endColumn: 33, + line: 2, + messageId: 'noNonNull', + }, + ], + }, + { + code: ` +hoge.files = document.querySelector('input')!.files; + `, + errors: [ + { + column: 14, + endColumn: 46, + line: 2, + messageId: 'noNonNull', + suggestions: [ + { + messageId: 'suggestOptionalChain', + output: ` +hoge.files = document.querySelector('input')?.files; + `, + }, + ], + }, + ], + }, ], }); diff --git a/packages/eslint-plugin/tests/rules/no-redeclare.test.ts b/packages/eslint-plugin/tests/rules/no-redeclare.test.ts index 3d2f55e1d4e1..2b99a6168246 100644 --- a/packages/eslint-plugin/tests/rules/no-redeclare.test.ts +++ b/packages/eslint-plugin/tests/rules/no-redeclare.test.ts @@ -1,5 +1,4 @@ import { RuleTester } from '@typescript-eslint/rule-tester'; -import { AST_NODE_TYPES, AST_TOKEN_TYPES } from '@typescript-eslint/utils'; import rule from '../../src/rules/no-redeclare'; @@ -155,7 +154,6 @@ var a = 10; id: 'a', }, messageId: 'redeclared', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -175,7 +173,6 @@ switch (foo) { id: 'b', }, messageId: 'redeclared', - type: AST_NODE_TYPES.Identifier, }, ], }, @@ -190,7 +187,6 @@ var a = 10; id: 'a', }, messageId: 'redeclared', - type: AST_NODE_TYPES.Identifier, }, ], }, @@ -205,7 +201,6 @@ var a = []; id: 'a', }, messageId: 'redeclared', - type: AST_NODE_TYPES.Identifier, }, ], }, @@ -220,7 +215,6 @@ function a() {} id: 'a', }, messageId: 'redeclared', - type: AST_NODE_TYPES.Identifier, }, ], }, @@ -235,7 +229,6 @@ function a() {} id: 'a', }, messageId: 'redeclared', - type: AST_NODE_TYPES.Identifier, }, ], }, @@ -250,7 +243,6 @@ var a = function () {}; id: 'a', }, messageId: 'redeclared', - type: AST_NODE_TYPES.Identifier, }, ], }, @@ -265,7 +257,6 @@ var a = new Date(); id: 'a', }, messageId: 'redeclared', - type: AST_NODE_TYPES.Identifier, }, ], }, @@ -281,14 +272,12 @@ var a = 15; id: 'a', }, messageId: 'redeclared', - type: AST_NODE_TYPES.Identifier, }, { data: { id: 'a', }, messageId: 'redeclared', - type: AST_NODE_TYPES.Identifier, }, ], }, @@ -303,7 +292,6 @@ var a; id: 'a', }, messageId: 'redeclared', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions: { sourceType: 'module' } }, @@ -319,7 +307,6 @@ var a; id: 'a', }, messageId: 'redeclared', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions: { sourceType: 'module' } }, @@ -332,7 +319,6 @@ var a; id: 'Object', }, messageId: 'redeclaredAsBuiltin', - type: AST_NODE_TYPES.Identifier, }, ], options: [{ builtinGlobals: true }], @@ -345,7 +331,6 @@ var a; id: 'top', }, messageId: 'redeclaredAsBuiltin', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { @@ -364,14 +349,12 @@ var { a = 0, b: Object = 0 } = {}; id: 'a', }, messageId: 'redeclared', - type: AST_NODE_TYPES.Identifier, }, { data: { id: 'Object', }, messageId: 'redeclaredAsBuiltin', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -388,7 +371,6 @@ var { a = 0, b: Object = 0 } = {}; id: 'a', }, messageId: 'redeclared', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { @@ -407,7 +389,6 @@ var { a = 0, b: Object = 0 } = {}; id: 'a', }, messageId: 'redeclared', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { @@ -426,7 +407,6 @@ var { a = 0, b: Object = 0 } = {}; id: 'a', }, messageId: 'redeclared', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -442,7 +422,6 @@ var { a = 0, b: Object = 0 } = {}; id: 'b', }, messageId: 'redeclaredBySyntax', - type: AST_TOKEN_TYPES.Identifier, }, ], options: [{ builtinGlobals: true }], diff --git a/packages/eslint-plugin/tests/rules/no-redundant-type-constituents.test.ts b/packages/eslint-plugin/tests/rules/no-redundant-type-constituents.test.ts index 96afce33ac4e..ce51eb308044 100644 --- a/packages/eslint-plugin/tests/rules/no-redundant-type-constituents.test.ts +++ b/packages/eslint-plugin/tests/rules/no-redundant-type-constituents.test.ts @@ -1,17 +1,7 @@ -import { RuleTester } from '@typescript-eslint/rule-tester'; - import rule from '../../src/rules/no-redundant-type-constituents'; -import { getFixturesRootDir } from '../RuleTester'; +import { createRuleTesterWithTypes } from '../RuleTester'; -const rootDir = getFixturesRootDir(); -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootDir, - }, - }, -}); +const ruleTester = createRuleTesterWithTypes(); ruleTester.run('no-redundant-type-constituents', rule, { valid: [ diff --git a/packages/eslint-plugin/tests/rules/no-restricted-imports.test.ts b/packages/eslint-plugin/tests/rules/no-restricted-imports.test.ts index b43a52ef8d71..c7f04a16db35 100644 --- a/packages/eslint-plugin/tests/rules/no-restricted-imports.test.ts +++ b/packages/eslint-plugin/tests/rules/no-restricted-imports.test.ts @@ -1,5 +1,4 @@ import { RuleTester } from '@typescript-eslint/rule-tester'; -import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import rule from '../../src/rules/no-restricted-imports'; @@ -393,7 +392,6 @@ import type { foo } from 'import2/private/bar'; errors: [ { messageId: 'path', - type: AST_NODE_TYPES.ImportDeclaration, }, ], options: ['import1', 'import2'], @@ -412,7 +410,6 @@ import type { foo } from 'import2/private/bar'; errors: [ { messageId: 'path', - type: AST_NODE_TYPES.ExportNamedDeclaration, }, ], options: ['import1', 'import2'], @@ -422,7 +419,6 @@ import type { foo } from 'import2/private/bar'; errors: [ { messageId: 'path', - type: AST_NODE_TYPES.ImportDeclaration, }, ], options: [{ paths: ['import1', 'import2'] }], @@ -432,7 +428,6 @@ import type { foo } from 'import2/private/bar'; errors: [ { messageId: 'path', - type: AST_NODE_TYPES.ExportNamedDeclaration, }, ], options: [{ paths: ['import1', 'import2'] }], @@ -442,7 +437,6 @@ import type { foo } from 'import2/private/bar'; errors: [ { messageId: 'patterns', - type: AST_NODE_TYPES.ImportDeclaration, }, ], options: [ @@ -457,7 +451,6 @@ import type { foo } from 'import2/private/bar'; errors: [ { messageId: 'patterns', - type: AST_NODE_TYPES.ExportNamedDeclaration, }, ], options: [ @@ -472,7 +465,6 @@ import type { foo } from 'import2/private/bar'; errors: [ { messageId: 'pathWithCustomMessage', - type: AST_NODE_TYPES.ImportDeclaration, }, ], options: [ @@ -495,7 +487,6 @@ import type { foo } from 'import2/private/bar'; errors: [ { messageId: 'pathWithCustomMessage', - type: AST_NODE_TYPES.ExportNamedDeclaration, }, ], options: [ @@ -518,7 +509,6 @@ import type { foo } from 'import2/private/bar'; errors: [ { messageId: 'importNameWithCustomMessage', - type: AST_NODE_TYPES.ImportDeclaration, }, ], options: [ @@ -538,7 +528,6 @@ import type { foo } from 'import2/private/bar'; errors: [ { messageId: 'importNameWithCustomMessage', - type: AST_NODE_TYPES.ExportNamedDeclaration, }, ], options: [ @@ -558,7 +547,6 @@ import type { foo } from 'import2/private/bar'; errors: [ { messageId: 'patternWithCustomMessage', - type: AST_NODE_TYPES.ImportDeclaration, }, ], options: [ @@ -582,7 +570,6 @@ import type { foo } from 'import2/private/bar'; errors: [ { messageId: 'patternWithCustomMessage', - type: AST_NODE_TYPES.ExportNamedDeclaration, }, ], options: [ @@ -606,7 +593,6 @@ import type { foo } from 'import2/private/bar'; errors: [ { messageId: 'path', - type: AST_NODE_TYPES.ImportDeclaration, }, ], options: [ @@ -624,7 +610,6 @@ import type { foo } from 'import2/private/bar'; errors: [ { messageId: 'path', - type: AST_NODE_TYPES.ImportDeclaration, }, ], options: [ @@ -643,7 +628,6 @@ import type { foo } from 'import2/private/bar'; errors: [ { messageId: 'pathWithCustomMessage', - type: AST_NODE_TYPES.ImportDeclaration, }, ], options: [ @@ -682,7 +666,6 @@ import type { foo } from 'import2/private/bar'; errors: [ { messageId: 'importNameWithCustomMessage', - type: AST_NODE_TYPES.ImportDeclaration, }, ], options: [ @@ -703,7 +686,6 @@ import type { foo } from 'import2/private/bar'; errors: [ { messageId: 'importNameWithCustomMessage', - type: AST_NODE_TYPES.ExportNamedDeclaration, }, ], options: [ @@ -724,7 +706,6 @@ import type { foo } from 'import2/private/bar'; errors: [ { messageId: 'patternWithCustomMessage', - type: AST_NODE_TYPES.ImportDeclaration, }, ], options: [ @@ -744,7 +725,6 @@ import type { foo } from 'import2/private/bar'; errors: [ { messageId: 'patternWithCustomMessage', - type: AST_NODE_TYPES.ExportNamedDeclaration, }, ], options: [ @@ -764,7 +744,6 @@ import type { foo } from 'import2/private/bar'; errors: [ { messageId: 'patternWithCustomMessage', - type: AST_NODE_TYPES.ExportNamedDeclaration, }, ], options: [ @@ -784,7 +763,6 @@ import type { foo } from 'import2/private/bar'; errors: [ { messageId: 'patternWithCustomMessage', - type: AST_NODE_TYPES.ImportDeclaration, }, ], options: [ @@ -805,7 +783,6 @@ import type { foo } from 'import2/private/bar'; errors: [ { messageId: 'path', - type: AST_NODE_TYPES.ExportAllDeclaration, }, ], options: ['import1'], @@ -815,7 +792,6 @@ import type { foo } from 'import2/private/bar'; errors: [ { messageId: 'patterns', - type: AST_NODE_TYPES.ImportDeclaration, }, ], options: [ @@ -829,11 +805,9 @@ import type { foo } from 'import2/private/bar'; errors: [ { messageId: 'importNameWithCustomMessage', - type: AST_NODE_TYPES.ImportDeclaration, }, { messageId: 'importNameWithCustomMessage', - type: AST_NODE_TYPES.ImportDeclaration, }, ], options: [ @@ -854,11 +828,9 @@ import type { foo } from 'import2/private/bar'; errors: [ { messageId: 'importNameWithCustomMessage', - type: AST_NODE_TYPES.ExportNamedDeclaration, }, { messageId: 'importNameWithCustomMessage', - type: AST_NODE_TYPES.ExportNamedDeclaration, }, ], options: [ diff --git a/packages/eslint-plugin/tests/rules/no-shadow/no-shadow-eslint.test.ts b/packages/eslint-plugin/tests/rules/no-shadow/no-shadow-eslint.test.ts index c7c8fcbab3c5..1b009461ac9f 100644 --- a/packages/eslint-plugin/tests/rules/no-shadow/no-shadow-eslint.test.ts +++ b/packages/eslint-plugin/tests/rules/no-shadow/no-shadow-eslint.test.ts @@ -3,7 +3,6 @@ // License : https://github.com/eslint/eslint/blob/c4a70499720f48e27734068074fbeee4f48fb460/LICENSE import { RuleTester } from '@typescript-eslint/rule-tester'; -import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import rule from '../../../src/rules/no-shadow'; @@ -27,7 +26,6 @@ function a(x) { shadowedLine: 2, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], }, @@ -47,7 +45,6 @@ var a = x => { shadowedLine: 2, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -68,7 +65,6 @@ function a(x) { shadowedLine: 2, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], }, @@ -87,7 +83,6 @@ function a(x) { shadowedLine: 2, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], }, @@ -106,7 +101,6 @@ function b() { shadowedLine: 2, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], }, @@ -128,7 +122,6 @@ setTimeout(function () { shadowedLine: 2, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], }, @@ -151,7 +144,6 @@ setTimeout(function () { shadowedLine: 2, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, { data: { @@ -160,7 +152,6 @@ setTimeout(function () { shadowedLine: 3, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], }, @@ -179,7 +170,6 @@ var x = 1; shadowedLine: 2, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -199,7 +189,6 @@ let x = 1; shadowedLine: 2, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -219,7 +208,6 @@ function a() {} shadowedLine: 5, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -239,7 +227,6 @@ function a() {} shadowedLine: 5, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -259,7 +246,6 @@ function a() {} shadowedLine: 5, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -279,7 +265,6 @@ function a() {} shadowedLine: 5, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -297,7 +282,6 @@ function a() {} shadowedLine: 3, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -317,7 +301,6 @@ let a; shadowedLine: 5, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -338,7 +321,6 @@ var a; shadowedLine: 5, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -359,7 +341,6 @@ function a() {} shadowedLine: 5, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -380,7 +361,6 @@ const a = 1; shadowedLine: 5, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -401,7 +381,6 @@ var a; shadowedLine: 5, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -422,7 +401,6 @@ function a() {} shadowedLine: 5, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -443,7 +421,6 @@ let a; shadowedLine: 5, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -464,7 +441,6 @@ var a; shadowedLine: 5, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -485,7 +461,6 @@ function a() {} shadowedLine: 5, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -506,7 +481,6 @@ let a; shadowedLine: 5, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -527,7 +501,6 @@ var a; shadowedLine: 5, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -548,7 +521,6 @@ function a() {} shadowedLine: 5, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -567,7 +539,6 @@ let a; shadowedLine: 3, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -586,7 +557,6 @@ var a; shadowedLine: 3, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -605,7 +575,6 @@ function a() {} shadowedLine: 3, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -625,7 +594,6 @@ function a() {} shadowedLine: 2, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], }, @@ -643,7 +611,6 @@ function a() {} shadowedLine: 2, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -662,7 +629,6 @@ function a() {} shadowedLine: 2, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], }, @@ -680,7 +646,6 @@ function a() {} shadowedLine: 2, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -699,7 +664,6 @@ function a() {} shadowedLine: 3, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], }, @@ -719,7 +683,6 @@ function a() {} shadowedLine: 3, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], }, @@ -739,7 +702,6 @@ function a() {} shadowedLine: 3, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -760,7 +722,6 @@ function a() {} shadowedLine: 3, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], }, @@ -780,7 +741,6 @@ function a() {} shadowedLine: 3, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -803,7 +763,6 @@ function a() {} shadowedLine: 3, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -824,7 +783,6 @@ class A { shadowedLine: 2, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -845,7 +803,6 @@ class A { shadowedLine: 2, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, { data: { @@ -854,7 +811,6 @@ class A { shadowedLine: 3, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], }, @@ -870,7 +826,6 @@ function foo() { name: 'Object', }, messageId: 'noShadowGlobal', - type: AST_NODE_TYPES.Identifier, }, ], options: [{ builtinGlobals: true }], @@ -887,7 +842,6 @@ function foo() { name: 'top', }, messageId: 'noShadowGlobal', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { globals: { top: 'readonly' } }, @@ -901,12 +855,9 @@ function foo() { name: 'Object', }, messageId: 'noShadowGlobal', - type: AST_NODE_TYPES.Identifier, }, ], - languageOptions: { - parserOptions: { ecmaVersion: 6, sourceType: 'module' }, - }, + languageOptions: {}, options: [{ builtinGlobals: true }], }, { @@ -917,12 +868,10 @@ function foo() { name: 'top', }, messageId: 'noShadowGlobal', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { globals: { top: 'readonly' }, - parserOptions: { ecmaVersion: 6, sourceType: 'module' }, }, options: [{ builtinGlobals: true }], }, @@ -934,7 +883,6 @@ function foo() { name: 'Object', }, messageId: 'noShadowGlobal', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { @@ -950,7 +898,6 @@ function foo() { name: 'top', }, messageId: 'noShadowGlobal', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { @@ -975,7 +922,6 @@ function foo(cb) { shadowedLine: 2, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], }, diff --git a/packages/eslint-plugin/tests/rules/no-shadow/no-shadow.test.ts b/packages/eslint-plugin/tests/rules/no-shadow/no-shadow.test.ts index 1378a1785ae2..4d5b84ad3d81 100644 --- a/packages/eslint-plugin/tests/rules/no-shadow/no-shadow.test.ts +++ b/packages/eslint-plugin/tests/rules/no-shadow/no-shadow.test.ts @@ -1,5 +1,4 @@ import { RuleTester } from '@typescript-eslint/rule-tester'; -import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import rule from '../../../src/rules/no-shadow'; @@ -328,7 +327,6 @@ function doThing(foo: number) {} shadowedLine: 2, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], options: [{ ignoreTypeValueShadow: false }], @@ -346,7 +344,6 @@ function doThing(foo: number) {} shadowedLine: 2, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], options: [{ ignoreTypeValueShadow: false }], @@ -364,7 +361,6 @@ function doThing(foo: number, bar: number) {} shadowedLine: 2, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], options: [{ ignoreTypeValueShadow: true }], @@ -387,7 +383,6 @@ declare module 'bar' { shadowedLine: 2, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], }, @@ -409,7 +404,6 @@ declare module 'baz' { shadowedLine: 2, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], }, @@ -431,7 +425,6 @@ declare module 'baz' { shadowedLine: 2, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], }, @@ -448,7 +441,6 @@ let y; shadowedLine: 2, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, { data: { @@ -457,7 +449,6 @@ let y; shadowedLine: 3, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -476,7 +467,6 @@ let y; shadowedLine: 2, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, @@ -495,7 +485,6 @@ type A = 1; shadowedLine: 3, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], options: [{ hoist: 'types' }], @@ -513,7 +502,6 @@ type A = 1; shadowedLine: 3, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], options: [{ hoist: 'types' }], @@ -531,7 +519,6 @@ interface A {} shadowedLine: 3, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], options: [{ hoist: 'types' }], @@ -549,7 +536,6 @@ interface A {} shadowedLine: 3, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], options: [{ hoist: 'types' }], @@ -569,7 +555,6 @@ type A = 1; shadowedLine: 5, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], options: [{ hoist: 'types' }], @@ -589,7 +574,6 @@ type A = 1; shadowedLine: 5, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], options: [{ hoist: 'types' }], @@ -608,7 +592,6 @@ type A = 1; shadowedLine: 3, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], options: [{ hoist: 'all' }], @@ -626,7 +609,6 @@ type A = 1; shadowedLine: 3, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], options: [{ hoist: 'all' }], @@ -644,7 +626,6 @@ interface A {} shadowedLine: 3, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], options: [{ hoist: 'all' }], @@ -662,7 +643,6 @@ interface A {} shadowedLine: 3, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], options: [{ hoist: 'all' }], @@ -682,7 +662,6 @@ type A = 1; shadowedLine: 5, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], options: [{ hoist: 'all' }], @@ -702,7 +681,6 @@ type A = 1; shadowedLine: 5, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], options: [{ hoist: 'all' }], @@ -721,7 +699,6 @@ type A = 1; shadowedLine: 3, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], options: [{ hoist: 'functions-and-types' }], @@ -739,7 +716,6 @@ type A = 1; shadowedLine: 3, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], options: [{ hoist: 'functions-and-types' }], @@ -757,7 +733,6 @@ interface A {} shadowedLine: 3, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], options: [{ hoist: 'functions-and-types' }], @@ -775,7 +750,6 @@ interface A {} shadowedLine: 3, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], options: [{ hoist: 'functions-and-types' }], @@ -795,7 +769,6 @@ type A = 1; shadowedLine: 5, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], options: [{ hoist: 'functions-and-types' }], @@ -815,7 +788,6 @@ type A = 1; shadowedLine: 5, }, messageId: 'noShadow', - type: AST_NODE_TYPES.Identifier, }, ], options: [{ hoist: 'functions-and-types' }], diff --git a/packages/eslint-plugin/tests/rules/no-this-alias.test.ts b/packages/eslint-plugin/tests/rules/no-this-alias.test.ts index 810092f744b2..0ad0667512c6 100644 --- a/packages/eslint-plugin/tests/rules/no-this-alias.test.ts +++ b/packages/eslint-plugin/tests/rules/no-this-alias.test.ts @@ -1,19 +1,15 @@ import { RuleTester } from '@typescript-eslint/rule-tester'; -import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import rule from '../../src/rules/no-this-alias'; const idError = { messageId: 'thisAssignment' as const, - type: AST_NODE_TYPES.Identifier, }; const destructureError = { messageId: 'thisDestructure' as const, - type: AST_NODE_TYPES.ObjectPattern, }; const arrayDestructureError = { messageId: 'thisDestructure' as const, - type: AST_NODE_TYPES.ArrayPattern, }; const ruleTester = new RuleTester(); 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 ef3107357a77..5f27869ee7a0 100644 --- a/packages/eslint-plugin/tests/rules/no-unnecessary-boolean-literal-compare.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unnecessary-boolean-literal-compare.test.ts @@ -1,18 +1,11 @@ -import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; +import { noFormat } from '@typescript-eslint/rule-tester'; import * as path from 'node:path'; import rule from '../../src/rules/no-unnecessary-boolean-literal-compare'; -import { getFixturesRootDir } from '../RuleTester'; +import { createRuleTesterWithTypes, getFixturesRootDir } from '../RuleTester'; const rootDir = getFixturesRootDir(); -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootDir, - }, - }, -}); +const ruleTester = createRuleTesterWithTypes(); ruleTester.run('no-unnecessary-boolean-literal-compare', rule, { valid: [ 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 22bb2f46c152..80d81bce079c 100644 --- a/packages/eslint-plugin/tests/rules/no-unnecessary-condition.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unnecessary-condition.test.ts @@ -1,6 +1,6 @@ import type { InvalidTestCase } from '@typescript-eslint/rule-tester'; -import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; +import { noFormat } from '@typescript-eslint/rule-tester'; import * as path from 'node:path'; import type { @@ -9,28 +9,21 @@ import type { } from '../../src/rules/no-unnecessary-condition'; import rule from '../../src/rules/no-unnecessary-condition'; -import { getFixturesRootDir } from '../RuleTester'; +import { createRuleTesterWithTypes, getFixturesRootDir } from '../RuleTester'; -const rootPath = getFixturesRootDir(); - -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootPath, - }, - }, -}); +const rootDir = getFixturesRootDir(); +const ruleTester = createRuleTesterWithTypes(); const optionsWithExactOptionalPropertyTypes = { project: './tsconfig.exactOptionalPropertyTypes.json', - tsconfigRootDir: rootPath, + projectService: false, + tsconfigRootDir: rootDir, }; const optionsWithNoUncheckedIndexedAccess = { project: './tsconfig.noUncheckedIndexedAccess.json', projectService: false, - tsconfigRootDir: getFixturesRootDir(), + tsconfigRootDir: rootDir, }; const necessaryConditionTest = (condition: string): string => ` @@ -883,7 +876,7 @@ if (x) { `, languageOptions: { parserOptions: { - tsconfigRootDir: path.join(rootPath, 'unstrict'), + tsconfigRootDir: path.join(rootDir, 'unstrict'), }, }, options: [ @@ -3059,7 +3052,7 @@ if (x) { ], languageOptions: { parserOptions: { - tsconfigRootDir: path.join(rootPath, 'unstrict'), + tsconfigRootDir: path.join(rootDir, 'unstrict'), }, }, }, diff --git a/packages/eslint-plugin/tests/rules/no-unnecessary-qualifier.test.ts b/packages/eslint-plugin/tests/rules/no-unnecessary-qualifier.test.ts index 91a153d7dd33..27bf0da8852a 100644 --- a/packages/eslint-plugin/tests/rules/no-unnecessary-qualifier.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unnecessary-qualifier.test.ts @@ -1,19 +1,7 @@ -import { RuleTester } from '@typescript-eslint/rule-tester'; -import { AST_NODE_TYPES } from '@typescript-eslint/utils'; - import rule from '../../src/rules/no-unnecessary-qualifier'; -import { getFixturesRootDir } from '../RuleTester'; - -const rootPath = getFixturesRootDir(); +import { createRuleTesterWithTypes } from '../RuleTester'; -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootPath, - }, - }, -}); +const ruleTester = createRuleTesterWithTypes(); ruleTester.run('no-unnecessary-qualifier', rule, { valid: [ @@ -94,7 +82,6 @@ namespace A { errors: [ { messageId: 'unnecessaryQualifier', - type: AST_NODE_TYPES.Identifier, }, ], output: ` @@ -114,7 +101,6 @@ namespace A { errors: [ { messageId: 'unnecessaryQualifier', - type: AST_NODE_TYPES.Identifier, }, ], output: ` @@ -136,7 +122,6 @@ namespace A { errors: [ { messageId: 'unnecessaryQualifier', - type: AST_NODE_TYPES.Identifier, }, ], output: ` @@ -160,7 +145,6 @@ namespace A { errors: [ { messageId: 'unnecessaryQualifier', - type: AST_NODE_TYPES.TSQualifiedName, }, ], output: ` @@ -184,7 +168,6 @@ namespace A { errors: [ { messageId: 'unnecessaryQualifier', - type: AST_NODE_TYPES.TSQualifiedName, }, ], output: ` @@ -208,7 +191,6 @@ namespace A { errors: [ { messageId: 'unnecessaryQualifier', - type: AST_NODE_TYPES.MemberExpression, }, ], output: ` @@ -230,7 +212,6 @@ enum A { errors: [ { messageId: 'unnecessaryQualifier', - type: AST_NODE_TYPES.Identifier, }, ], output: ` @@ -252,7 +233,6 @@ namespace Foo { errors: [ { messageId: 'unnecessaryQualifier', - type: AST_NODE_TYPES.MemberExpression, }, ], output: ` @@ -274,7 +254,6 @@ declare module './foo' { errors: [ { messageId: 'unnecessaryQualifier', - type: AST_NODE_TYPES.Identifier, }, ], output: ` diff --git a/packages/eslint-plugin/tests/rules/no-unnecessary-template-expression.test.ts b/packages/eslint-plugin/tests/rules/no-unnecessary-template-expression.test.ts index 907cf64f7763..693d55ae6907 100644 --- a/packages/eslint-plugin/tests/rules/no-unnecessary-template-expression.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unnecessary-template-expression.test.ts @@ -1,20 +1,11 @@ import type { InvalidTestCase } from '@typescript-eslint/rule-tester'; -import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; +import { noFormat } from '@typescript-eslint/rule-tester'; import rule from '../../src/rules/no-unnecessary-template-expression'; -import { getFixturesRootDir } from '../RuleTester'; +import { createRuleTesterWithTypes } from '../RuleTester'; -const rootPath = getFixturesRootDir(); - -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootPath, - }, - }, -}); +const ruleTester = createRuleTesterWithTypes(); const invalidCases = [ { diff --git a/packages/eslint-plugin/tests/rules/no-unnecessary-type-arguments.test.ts b/packages/eslint-plugin/tests/rules/no-unnecessary-type-arguments.test.ts index 18e74325d7b6..84e90c9f95f5 100644 --- a/packages/eslint-plugin/tests/rules/no-unnecessary-type-arguments.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unnecessary-type-arguments.test.ts @@ -1,27 +1,15 @@ -import { RuleTester } from '@typescript-eslint/rule-tester'; - import rule from '../../src/rules/no-unnecessary-type-arguments'; -import { getFixturesRootDir } from '../RuleTester'; - -const rootPath = getFixturesRootDir(); +import { createRuleTesterWithTypes } from '../RuleTester'; -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootPath, - }, - }, -}); +const ruleTester = createRuleTesterWithTypes(); ruleTester.run('no-unnecessary-type-arguments', rule, { valid: [ - 'f<>();', + 'f();', 'f();', - 'expect().toBe<>();', - 'class Foo extends Bar<> {}', + 'class Foo extends Bar {}', 'class Foo extends Bar {}', - 'class Foo implements Bar<> {}', + 'class Foo implements Bar {}', 'class Foo implements Bar {}', ` function f() {} 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 16bfe40b7eb2..b2ef78d4500a 100644 --- a/packages/eslint-plugin/tests/rules/no-unnecessary-type-assertion.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unnecessary-type-assertion.test.ts @@ -1,17 +1,12 @@ -import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; -import path from 'node:path'; +import { noFormat } from '@typescript-eslint/rule-tester'; import rule from '../../src/rules/no-unnecessary-type-assertion'; +import { getFixturesRootDir, createRuleTesterWithTypes } from '../RuleTester'; -const rootDir = path.join(__dirname, '..', 'fixtures'); -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - projectService: false, - tsconfigRootDir: rootDir, - }, - }, +const rootDir = getFixturesRootDir(); + +const ruleTester = createRuleTesterWithTypes({ + project: './tsconfig.json', }); const optionsWithOnUncheckedIndexedAccess = { diff --git a/packages/eslint-plugin/tests/rules/no-unnecessary-type-conversion.test.ts b/packages/eslint-plugin/tests/rules/no-unnecessary-type-conversion.test.ts index e0aaadacee2d..1bf2ae83cb1b 100644 --- a/packages/eslint-plugin/tests/rules/no-unnecessary-type-conversion.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unnecessary-type-conversion.test.ts @@ -1,18 +1,7 @@ -import { RuleTester } from '@typescript-eslint/rule-tester'; - import rule from '../../src/rules/no-unnecessary-type-conversion'; -import { getFixturesRootDir } from '../RuleTester'; - -const rootDir = getFixturesRootDir(); +import { createRuleTesterWithTypes } from '../RuleTester'; -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootDir, - }, - }, -}); +const ruleTester = createRuleTesterWithTypes(); ruleTester.run('no-unnecessary-type-conversion', rule, { valid: [ @@ -29,6 +18,10 @@ ruleTester.run('no-unnecessary-type-conversion', rule, { "Number('2');", "+'2';", "~~'2';", + '~~1.1;', + '~~-1.1;', + '~~(1.5 + 2.3);', + '~~(1 / 3);', 'Boolean(0);', '!!0;', 'BigInt(3);', @@ -93,6 +86,14 @@ ruleTester.run('no-unnecessary-type-conversion', rule, { '~~new Number();', 'Boolean(new Boolean());', '!!new Boolean();', + ` + enum CustomIds { + Id1 = 'id1', + Id2 = 'id2', + } + const customId = 'id1'; + const compareWithToString = customId === CustomIds.Id1.toString(); + `, ], invalid: [ @@ -578,26 +579,6 @@ let str = 'asdf'; }, ], }, - { - code: '2 * ~~(2 + 2);', - errors: [ - { - column: 5, - endColumn: 7, - messageId: 'unnecessaryTypeConversion', - suggestions: [ - { - messageId: 'suggestRemove', - output: '2 * (2 + 2);', - }, - { - messageId: 'suggestSatisfies', - output: '2 * ((2 + 2) satisfies number);', - }, - ], - }, - ], - }, { code: 'false && !!(false || true);', errors: [ @@ -720,5 +701,75 @@ let str = 'asdf'; }, ], }, + { + code: '~~1;', + errors: [ + { + column: 1, + endColumn: 3, + messageId: 'unnecessaryTypeConversion', + suggestions: [ + { + messageId: 'suggestRemove', + output: '1;', + }, + { + messageId: 'suggestSatisfies', + output: '1 satisfies number;', + }, + ], + }, + ], + }, + { + code: '~~-1;', + errors: [ + { + column: 1, + endColumn: 3, + messageId: 'unnecessaryTypeConversion', + suggestions: [ + { + messageId: 'suggestRemove', + output: '(-1);', + }, + { + messageId: 'suggestSatisfies', + output: '(-1) satisfies number;', + }, + ], + }, + ], + }, + { + code: ` + declare const threeOrFour: 3 | 4; + ~~threeOrFour; + `, + errors: [ + { + column: 9, + endColumn: 11, + line: 3, + messageId: 'unnecessaryTypeConversion', + suggestions: [ + { + messageId: 'suggestRemove', + output: ` + declare const threeOrFour: 3 | 4; + threeOrFour; + `, + }, + { + messageId: 'suggestSatisfies', + output: ` + declare const threeOrFour: 3 | 4; + threeOrFour satisfies number; + `, + }, + ], + }, + ], + }, ], }); diff --git a/packages/eslint-plugin/tests/rules/no-unnecessary-type-parameters.test.ts b/packages/eslint-plugin/tests/rules/no-unnecessary-type-parameters.test.ts index 9f8f05479c9c..0b98cbd20dd9 100644 --- a/packages/eslint-plugin/tests/rules/no-unnecessary-type-parameters.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unnecessary-type-parameters.test.ts @@ -1,18 +1,9 @@ -import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; +import { noFormat } from '@typescript-eslint/rule-tester'; import rule from '../../src/rules/no-unnecessary-type-parameters'; -import { getFixturesRootDir } from '../RuleTester'; +import { createRuleTesterWithTypes } from '../RuleTester'; -const rootPath = getFixturesRootDir(); - -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootPath, - }, - }, -}); +const ruleTester = createRuleTesterWithTypes(); ruleTester.run('no-unnecessary-type-parameters', rule, { valid: [ diff --git a/packages/eslint-plugin/tests/rules/no-unsafe-argument.test.ts b/packages/eslint-plugin/tests/rules/no-unsafe-argument.test.ts index 9669d9c3b045..46fc5f32118d 100644 --- a/packages/eslint-plugin/tests/rules/no-unsafe-argument.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unsafe-argument.test.ts @@ -1,16 +1,7 @@ -import { RuleTester } from '@typescript-eslint/rule-tester'; - import rule from '../../src/rules/no-unsafe-argument'; -import { getFixturesRootDir } from '../RuleTester'; +import { createRuleTesterWithTypes } from '../RuleTester'; -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: getFixturesRootDir(), - }, - }, -}); +const ruleTester = createRuleTesterWithTypes(); ruleTester.run('no-unsafe-argument', rule, { valid: [ 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 0f2654f22279..537ce85284e7 100644 --- a/packages/eslint-plugin/tests/rules/no-unsafe-assignment.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unsafe-assignment.test.ts @@ -1,73 +1,10 @@ -import type { InvalidTestCase } from '@typescript-eslint/rule-tester'; - -import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; - -import type { - InferMessageIdsTypeFromRule, - InferOptionsTypeFromRule, -} from '../../src/util'; +import { noFormat } from '@typescript-eslint/rule-tester'; import rule from '../../src/rules/no-unsafe-assignment'; -import { getFixturesRootDir } from '../RuleTester'; - -type Options = InferOptionsTypeFromRule; -type MessageIds = InferMessageIdsTypeFromRule; -type InvalidTest = InvalidTestCase; - -const assignmentTest = ( - tests: [string, number, number, boolean?][], -): InvalidTest[] => - tests.flatMap(([assignment, column, endColumn, skipAssignmentExpression]) => [ - // VariableDeclaration - { - code: `const ${assignment}`, - errors: [ - { - column: column + 6, - endColumn: endColumn + 6, - line: 1, - messageId: 'unsafeArrayPatternFromTuple', - }, - ], - }, - // AssignmentPattern - { - code: `function foo(${assignment}) {}`, - errors: [ - { - column: column + 13, - endColumn: endColumn + 13, - line: 1, - messageId: 'unsafeArrayPatternFromTuple', - }, - ], - }, - // AssignmentExpression - ...(skipAssignmentExpression - ? [] - : [ - { - code: `(${assignment})`, - errors: [ - { - column: column + 1, - endColumn: endColumn + 1, - line: 1, - messageId: 'unsafeArrayPatternFromTuple' as const, - }, - ], - }, - ]), - ]); +import { createRuleTesterWithTypes } from '../RuleTester'; -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.noImplicitThis.json', - projectService: false, - tsconfigRootDir: getFixturesRootDir(), - }, - }, +const ruleTester = createRuleTesterWithTypes({ + project: './tsconfig.noImplicitThis.json', }); ruleTester.run('no-unsafe-assignment', rule, { @@ -245,7 +182,7 @@ const { errors: [ { data: { receiver: 'error typed', sender: 'error typed' }, - messageId: 'unsafeArrayPatternFromTuple', + messageId: 'unsafeObjectPattern', }, { data: { receiver: 'error typed', sender: 'error typed' }, @@ -330,14 +267,193 @@ const [x] = [] as any[]; ], }, - ...assignmentTest([ - ['[x] = [1] as [any]', 2, 3], - ['[[[[x]]]] = [[[[1 as any]]]]', 5, 6], - ['[[[[x]]]] = [1 as any]', 2, 9, true], - ['[{x}] = [{x: 1}] as [{x: any}]', 3, 4], - ['[{["x"]: x}] = [{["x"]: 1}] as [{["x"]: any}]', 10, 11], - ['[{[`x`]: x}] = [{[`x`]: 1}] as [{[`x`]: any}]', 10, 11], - ]), + { + code: 'const [x] = [1] as [any];', + errors: [ + { + column: 8, + endColumn: 9, + line: 1, + messageId: 'unsafeArrayPatternFromTuple', + }, + ], + }, + { + code: 'function foo([x] = [1] as [any]) {}', + errors: [ + { + column: 15, + endColumn: 16, + line: 1, + messageId: 'unsafeArrayPatternFromTuple', + }, + ], + }, + { + code: '[x] = [1] as [any];', + errors: [ + { + column: 2, + endColumn: 3, + line: 1, + messageId: 'unsafeArrayPatternFromTuple', + }, + ], + }, + { + code: 'const [[[[x]]]] = [[[[1 as any]]]];', + errors: [ + { + column: 11, + endColumn: 12, + line: 1, + messageId: 'unsafeArrayPatternFromTuple', + }, + ], + }, + { + code: 'function foo([[[[x]]]] = [[[[1 as any]]]]) {}', + errors: [ + { + column: 18, + endColumn: 19, + line: 1, + messageId: 'unsafeArrayPatternFromTuple', + }, + ], + }, + { + code: '[[[[x]]]] = [[[[1 as any]]]];', + errors: [ + { + column: 5, + endColumn: 6, + line: 1, + messageId: 'unsafeArrayPatternFromTuple', + }, + ], + }, + { + code: 'const [[[[x]]]] = [1 as any];', + errors: [ + { + column: 8, + endColumn: 15, + line: 1, + messageId: 'unsafeArrayPatternFromTuple', + }, + ], + }, + { + code: 'function foo([[[[x]]]] = [1 as any]) {}', + errors: [ + { + column: 15, + endColumn: 22, + line: 1, + messageId: 'unsafeArrayPatternFromTuple', + }, + ], + }, + { + code: 'const [{ x }] = [{ x: 1 }] as [{ x: any }];', + errors: [ + { + column: 10, + endColumn: 11, + line: 1, + messageId: 'unsafeObjectPattern', + }, + ], + }, + { + code: 'function foo([{ x }] = [{ x: 1 }] as [{ x: any }]) {}', + errors: [ + { + column: 17, + endColumn: 18, + line: 1, + messageId: 'unsafeObjectPattern', + }, + ], + }, + { + code: '[{ x }] = [{ x: 1 }] as [{ x: any }];', + errors: [ + { + column: 4, + endColumn: 5, + line: 1, + messageId: 'unsafeObjectPattern', + }, + ], + }, + { + code: "const [{ ['x']: x }] = [{ ['x']: 1 }] as [{ ['x']: any }];", + errors: [ + { + column: 17, + endColumn: 18, + line: 1, + messageId: 'unsafeObjectPattern', + }, + ], + }, + { + code: "function foo([{ ['x']: x }] = [{ ['x']: 1 }] as [{ ['x']: any }]) {}", + errors: [ + { + column: 24, + endColumn: 25, + line: 1, + messageId: 'unsafeObjectPattern', + }, + ], + }, + { + code: "[{ ['x']: x }] = [{ ['x']: 1 }] as [{ ['x']: any }];", + errors: [ + { + column: 11, + endColumn: 12, + line: 1, + messageId: 'unsafeObjectPattern', + }, + ], + }, + { + code: 'const [{ [`x`]: x }] = [{ [`x`]: 1 }] as [{ [`x`]: any }];', + errors: [ + { + column: 17, + endColumn: 18, + line: 1, + messageId: 'unsafeObjectPattern', + }, + ], + }, + { + code: 'function foo([{ [`x`]: x }] = [{ [`x`]: 1 }] as [{ [`x`]: any }]) {}', + errors: [ + { + column: 24, + endColumn: 25, + line: 1, + messageId: 'unsafeObjectPattern', + }, + ], + }, + { + code: '[{ [`x`]: x }] = [{ [`x`]: 1 }] as [{ [`x`]: any }];', + errors: [ + { + column: 11, + endColumn: 12, + line: 1, + messageId: 'unsafeObjectPattern', + }, + ], + }, { // TS treats the assignment pattern weirdly in this case code: '[[[[x]]]] = [1 as any];', @@ -364,12 +480,154 @@ const x = [...([] as any[])]; errors: [{ messageId: 'unsafeArraySpread' }], }, - ...assignmentTest([ - ['{x} = {x: 1} as {x: any}', 2, 3], - ['{x: y} = {x: 1} as {x: any}', 5, 6], - ['{x: {y}} = {x: {y: 1}} as {x: {y: any}}', 6, 7], - ['{x: [y]} = {x: {y: 1}} as {x: [any]}', 6, 7], - ]), + { + code: 'const { x } = { x: 1 } as { x: any };', + errors: [ + { + column: 9, + endColumn: 10, + line: 1, + messageId: 'unsafeObjectPattern', + }, + ], + }, + { + code: 'function foo({ x } = { x: 1 } as { x: any }) {}', + errors: [ + { + column: 16, + endColumn: 17, + line: 1, + messageId: 'unsafeObjectPattern', + }, + ], + }, + { + code: '({ x } = { x: 1 } as { x: any });', + errors: [ + { + column: 4, + endColumn: 5, + line: 1, + messageId: 'unsafeObjectPattern', + }, + ], + }, + { + code: 'const { x: y } = { x: 1 } as { x: any };', + errors: [ + { + column: 12, + endColumn: 13, + line: 1, + messageId: 'unsafeObjectPattern', + }, + ], + }, + { + code: 'function foo({ x: y } = { x: 1 } as { x: any }) {}', + errors: [ + { + column: 19, + endColumn: 20, + line: 1, + messageId: 'unsafeObjectPattern', + }, + ], + }, + { + code: '({ x: y } = { x: 1 } as { x: any });', + errors: [ + { + column: 7, + endColumn: 8, + line: 1, + messageId: 'unsafeObjectPattern', + }, + ], + }, + { + code: ` +const { + x: { y }, +} = { x: { y: 1 } } as { x: { y: any } }; + `, + errors: [ + { + column: 8, + endColumn: 9, + line: 3, + messageId: 'unsafeObjectPattern', + }, + ], + }, + { + code: 'function foo({ x: { y } } = { x: { y: 1 } } as { x: { y: any } }) {}', + errors: [ + { + column: 21, + endColumn: 22, + line: 1, + messageId: 'unsafeObjectPattern', + }, + ], + }, + { + code: ` +({ + x: { y }, +} = { x: { y: 1 } } as { x: { y: any } }); + `, + errors: [ + { + column: 8, + endColumn: 9, + line: 3, + messageId: 'unsafeObjectPattern', + }, + ], + }, + { + code: ` +const { + x: [y], +} = { x: { y: 1 } } as { x: [any] }; + `, + errors: [ + { + column: 7, + endColumn: 8, + line: 3, + messageId: 'unsafeArrayPatternFromTuple', + }, + ], + }, + { + code: 'function foo({ x: [y] } = { x: { y: 1 } } as { x: [any] }) {}', + errors: [ + { + column: 20, + endColumn: 21, + line: 1, + messageId: 'unsafeArrayPatternFromTuple', + }, + ], + }, + { + code: ` +({ + x: [y], +} = { x: { y: 1 } } as { x: [any] }); + `, + errors: [ + { + column: 7, + endColumn: 8, + line: 3, + messageId: 'unsafeArrayPatternFromTuple', + }, + ], + }, { code: 'const x = { y: 1 as any };', 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 279534b83f96..8522ecca83b1 100644 --- a/packages/eslint-plugin/tests/rules/no-unsafe-call.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unsafe-call.test.ts @@ -1,16 +1,10 @@ -import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; +import { noFormat } from '@typescript-eslint/rule-tester'; import rule from '../../src/rules/no-unsafe-call'; -import { getFixturesRootDir } from '../RuleTester'; +import { createRuleTesterWithTypes } from '../RuleTester'; -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.noImplicitThis.json', - projectService: false, - tsconfigRootDir: getFixturesRootDir(), - }, - }, +const ruleTester = createRuleTesterWithTypes({ + project: './tsconfig.noImplicitThis.json', }); ruleTester.run('no-unsafe-call', rule, { diff --git a/packages/eslint-plugin/tests/rules/no-unsafe-declaration-merging.test.ts b/packages/eslint-plugin/tests/rules/no-unsafe-declaration-merging.test.ts index fbaadb553e66..3837b38eb499 100644 --- a/packages/eslint-plugin/tests/rules/no-unsafe-declaration-merging.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unsafe-declaration-merging.test.ts @@ -1,18 +1,7 @@ -import { RuleTester } from '@typescript-eslint/rule-tester'; - import rule from '../../src/rules/no-unsafe-declaration-merging'; -import { getFixturesRootDir } from '../RuleTester'; - -const rootPath = getFixturesRootDir(); +import { createRuleTesterWithTypes } from '../RuleTester'; -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootPath, - }, - }, -}); +const ruleTester = createRuleTesterWithTypes(); ruleTester.run('no-unsafe-declaration-merging', rule, { valid: [ diff --git a/packages/eslint-plugin/tests/rules/no-unsafe-enum-comparison.test.ts b/packages/eslint-plugin/tests/rules/no-unsafe-enum-comparison.test.ts index b592b7fe513d..c1e84f7c5884 100644 --- a/packages/eslint-plugin/tests/rules/no-unsafe-enum-comparison.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unsafe-enum-comparison.test.ts @@ -1,18 +1,7 @@ -import { RuleTester } from '@typescript-eslint/rule-tester'; - import rule from '../../src/rules/no-unsafe-enum-comparison'; -import { getFixturesRootDir } from '../RuleTester'; - -const rootDir = getFixturesRootDir(); +import { createRuleTesterWithTypes } from '../RuleTester'; -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootDir, - }, - }, -}); +const ruleTester = createRuleTesterWithTypes(); ruleTester.run('no-unsafe-enum-comparison', rule, { valid: [ @@ -1121,87 +1110,6 @@ ruleTester.run('no-unsafe-enum-comparison', rule, { }, ], }, - { - code: ` - enum ComputedKey { - ['test-key' /* with comment */] = 1, - } - declare const computedKey: ComputedKey; - computedKey === 1; - `, - errors: [ - { - messageId: 'mismatchedCondition', - suggestions: [ - { - messageId: 'replaceValueWithEnum', - output: ` - enum ComputedKey { - ['test-key' /* with comment */] = 1, - } - declare const computedKey: ComputedKey; - computedKey === ComputedKey['test-key']; - `, - }, - ], - }, - ], - }, - { - code: ` - enum ComputedKey { - [\`test-key\` /* with comment */] = 1, - } - declare const computedKey: ComputedKey; - computedKey === 1; - `, - errors: [ - { - messageId: 'mismatchedCondition', - suggestions: [ - { - messageId: 'replaceValueWithEnum', - output: ` - enum ComputedKey { - [\`test-key\` /* with comment */] = 1, - } - declare const computedKey: ComputedKey; - computedKey === ComputedKey[\`test-key\`]; - `, - }, - ], - }, - ], - }, - { - code: ` - enum ComputedKey { - [\`test- - key\` /* with comment */] = 1, - } - declare const computedKey: ComputedKey; - computedKey === 1; - `, - errors: [ - { - messageId: 'mismatchedCondition', - suggestions: [ - { - messageId: 'replaceValueWithEnum', - output: ` - enum ComputedKey { - [\`test- - key\` /* with comment */] = 1, - } - declare const computedKey: ComputedKey; - computedKey === ComputedKey[\`test- - key\`]; - `, - }, - ], - }, - ], - }, { code: ` enum Fruit { @@ -1246,5 +1154,81 @@ ruleTester.run('no-unsafe-enum-comparison', rule, { `, errors: [{ messageId: 'mismatchedCondition' }], }, + { + code: ` +enum NUMBER_ENUM { + First = 0, + Second = 1, +} + +type NumberUnion = 0 | 1; + +declare const numberUnion: NumberUnion; + +switch (numberUnion) { + case NUMBER_ENUM.First: + case NUMBER_ENUM.Second: + break; +} + `, + errors: [ + { + line: 12, + messageId: 'mismatchedCase', + }, + { + line: 13, + messageId: 'mismatchedCase', + }, + ], + }, + { + code: ` +enum STRING_ENUM { + First = 'one', + Second = 'two', +} + +type StringUnion = 'one' | 'two'; + +declare const stringUnion: StringUnion; + +switch (stringUnion) { + case STRING_ENUM.First: + case STRING_ENUM.Second: + break; +} + `, + errors: [ + { + line: 12, + messageId: 'mismatchedCase', + }, + { + line: 13, + messageId: 'mismatchedCase', + }, + ], + }, + { + code: ` +declare const stringUnion: 'foo' | 'bar'; + +enum StringEnum { + FOO = 'foo', + BAR = 'bar', +} + +declare const stringEnum: StringEnum; + +stringUnion === stringEnum; + `, + errors: [ + { + line: 11, + messageId: 'mismatchedCondition', + }, + ], + }, ], }); 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 089d20ee6e19..b300edf5bb0e 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 @@ -67,6 +67,38 @@ class B implements F.S.T.A {} ` interface B extends F.S.T.A {} `, + { + code: ` +function foo(x?: { a: number }) { + x?.a; +} + `, + options: [{ allowOptionalChaining: true }], + }, + { + code: ` +function foo(x?: { a: number }, y: string) { + x?.[y]; +} + `, + options: [{ allowOptionalChaining: true }], + }, + { + code: ` +function foo(x: { a: number }, y: 'a') { + x?.[y]; +} + `, + options: [{ allowOptionalChaining: true }], + }, + { + code: ` +function foo(x: { a: number }, y: NotKnown) { + x?.[y]; +} + `, + options: [{ allowOptionalChaining: true }], + }, ], invalid: [ { @@ -382,5 +414,115 @@ class C { }, ], }, + { + code: ` +let value: any; + +value?.middle.inner; + `, + errors: [ + { + column: 15, + data: { + property: '.inner', + type: '`any`', + }, + endColumn: 20, + line: 4, + messageId: 'unsafeMemberExpression', + }, + ], + options: [{ allowOptionalChaining: true }], + }, + { + code: ` +let value: any; + +value?.outer.middle.inner; + `, + errors: [ + { + column: 14, + data: { + property: '.middle', + type: '`any`', + }, + endColumn: 20, + line: 4, + messageId: 'unsafeMemberExpression', + }, + ], + options: [{ allowOptionalChaining: true }], + }, + { + code: ` +let value: any; + +value.outer?.middle.inner; + `, + errors: [ + { + column: 7, + data: { + property: '.outer', + type: '`any`', + }, + endColumn: 12, + line: 4, + messageId: 'unsafeMemberExpression', + }, + { + column: 21, + data: { + property: '.inner', + type: '`any`', + }, + endColumn: 26, + line: 4, + messageId: 'unsafeMemberExpression', + }, + ], + options: [{ allowOptionalChaining: true }], + }, + { + code: ` +let value: any; + +value.outer.middle?.inner; + `, + errors: [ + { + column: 7, + data: { + property: '.outer', + type: '`any`', + }, + endColumn: 12, + line: 4, + messageId: 'unsafeMemberExpression', + }, + ], + options: [{ allowOptionalChaining: true }], + }, + { + code: ` +function foo(x: { a: number }, y: NotKnown) { + x[y]; +} + `, + errors: [ + { + column: 5, + data: { + property: '[y]', + type: '`error` typed', + }, + endColumn: 6, + line: 3, + messageId: 'unsafeComputedMemberAccess', + }, + ], + options: [{ allowOptionalChaining: true }], + }, ], }); diff --git a/packages/eslint-plugin/tests/rules/no-unsafe-type-assertion.test.ts b/packages/eslint-plugin/tests/rules/no-unsafe-type-assertion.test.ts index 0c40f2996676..0b0815f37250 100644 --- a/packages/eslint-plugin/tests/rules/no-unsafe-type-assertion.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unsafe-type-assertion.test.ts @@ -1,18 +1,7 @@ -import { RuleTester } from '@typescript-eslint/rule-tester'; - import rule from '../../src/rules/no-unsafe-type-assertion'; -import { getFixturesRootDir } from '../RuleTester'; - -const rootPath = getFixturesRootDir(); +import { createRuleTesterWithTypes } from '../RuleTester'; -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootPath, - }, - }, -}); +const ruleTester = createRuleTesterWithTypes(); describe('basic assertions', () => { ruleTester.run('no-unsafe-type-assertion', rule, { diff --git a/packages/eslint-plugin/tests/rules/no-unsafe-unary-minus.test.ts b/packages/eslint-plugin/tests/rules/no-unsafe-unary-minus.test.ts index 0aea759ca375..28ab97b62b44 100644 --- a/packages/eslint-plugin/tests/rules/no-unsafe-unary-minus.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unsafe-unary-minus.test.ts @@ -1,17 +1,7 @@ -import { RuleTester } from '@typescript-eslint/rule-tester'; - import rule from '../../src/rules/no-unsafe-unary-minus'; -import { getFixturesRootDir } from '../RuleTester'; +import { createRuleTesterWithTypes } from '../RuleTester'; -const rootDir = getFixturesRootDir(); -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootDir, - }, - }, -}); +const ruleTester = createRuleTesterWithTypes(); ruleTester.run('no-unsafe-unary-minus', rule, { valid: [ diff --git a/packages/eslint-plugin/tests/rules/no-unused-expressions.test.ts b/packages/eslint-plugin/tests/rules/no-unused-expressions.test.ts index 567b206a42ad..ca860a304a9d 100644 --- a/packages/eslint-plugin/tests/rules/no-unused-expressions.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unused-expressions.test.ts @@ -1,6 +1,4 @@ -import type { TestCaseError } from '@typescript-eslint/rule-tester'; - -import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; +import { RuleTester } from '@typescript-eslint/rule-tester'; import rule from '../../src/rules/no-unused-expressions'; @@ -12,20 +10,6 @@ const ruleTester = new RuleTester({ }, }); -type RuleTestCaseError = Omit, 'messageId'>; - -// the base rule doesn't have messageIds -function error( - messages: RuleTestCaseError[], - // eslint-disable-next-line @typescript-eslint/no-explicit-any -): any[] { - return messages.map(message => ({ - ...message, - message: - 'Expected an assignment or function call and instead saw an expression.', - })); -} - ruleTester.run('no-unused-expressions', rule, { valid: [ ` @@ -91,37 +75,40 @@ ruleTester.run('no-unused-expressions', rule, { ], invalid: [ { - code: ` -if (0) 0; - `, - errors: error([ + code: 'if (0) 0;', + errors: [ { column: 8, - line: 2, + endColumn: 10, + endLine: 1, + line: 1, + messageId: 'unusedExpression', }, - ]), + ], }, { - code: ` -f(0), {}; - `, - errors: error([ + code: '(f(0), {});', + errors: [ { column: 1, - line: 2, + endColumn: 12, + endLine: 1, + line: 1, + messageId: 'unusedExpression', }, - ]), + ], }, { - code: ` -a, b(); - `, - errors: error([ + code: '(a, b());', + errors: [ { column: 1, - line: 2, + endColumn: 10, + endLine: 1, + line: 1, + messageId: 'unusedExpression', }, - ]), + ], }, { code: ` @@ -130,100 +117,111 @@ a() && f(); }; `, - errors: error([ + errors: [ { column: 1, + endColumn: 5, + endLine: 5, line: 2, + messageId: 'unusedExpression', }, - ]), + ], }, { - code: ` -a?.b; - `, - errors: error([ + code: 'a?.b;', + errors: [ { column: 1, - line: 2, + endColumn: 6, + endLine: 1, + line: 1, + messageId: 'unusedExpression', }, - ]), + ], }, { - code: ` -(a?.b).c; - `, - errors: error([ + code: '(a?.b).c;', + errors: [ { column: 1, - line: 2, + endColumn: 10, + endLine: 1, + line: 1, + messageId: 'unusedExpression', }, - ]), + ], }, { - code: ` -a?.['b']; - `, - errors: error([ + code: "a?.['b'];", + errors: [ { column: 1, - line: 2, + endColumn: 10, + endLine: 1, + line: 1, + messageId: 'unusedExpression', }, - ]), + ], }, { - code: ` -(a?.['b']).c; - `, - errors: error([ + code: "(a?.['b']).c;", + errors: [ { column: 1, - line: 2, + endColumn: 14, + endLine: 1, + line: 1, + messageId: 'unusedExpression', }, - ]), + ], }, { - code: ` -a?.b()?.c; - `, - errors: error([ + code: 'a?.b()?.c;', + errors: [ { column: 1, - line: 2, + endColumn: 11, + endLine: 1, + line: 1, + messageId: 'unusedExpression', }, - ]), + ], }, { - code: ` -(a?.b()).c; - `, - errors: error([ + code: '(a?.b()).c;', + errors: [ { column: 1, - line: 2, + endColumn: 12, + endLine: 1, + line: 1, + messageId: 'unusedExpression', }, - ]), + ], }, { - code: ` -one[2]?.[3][4]; - `, - errors: error([ + code: 'one[2]?.[3][4];', + errors: [ { column: 1, - line: 2, + endColumn: 16, + endLine: 1, + line: 1, + messageId: 'unusedExpression', }, - ]), + ], }, { - code: ` -one.two?.three.four; - `, - errors: error([ + code: 'one.two?.three.four;', + errors: [ { column: 1, - line: 2, + endColumn: 21, + endLine: 1, + line: 1, + messageId: 'unusedExpression', }, - ]), + ], }, { code: ` @@ -232,14 +230,15 @@ module Foo { 'use strict'; } `, - errors: error([ + errors: [ { column: 3, endColumn: 16, endLine: 4, line: 4, + messageId: 'unusedExpression', }, - ]), + ], }, { code: ` @@ -250,54 +249,58 @@ namespace Foo { 'use strict'; } `, - errors: error([ + errors: [ { column: 3, endColumn: 16, endLine: 6, line: 6, + messageId: 'unusedExpression', }, - ]), + ], }, { - code: noFormat` + code: ` function foo() { const foo = true; - 'use strict'; + ('use strict'); } `, - errors: error([ + errors: [ { column: 3, - endColumn: 16, + endColumn: 18, endLine: 5, line: 5, + messageId: 'unusedExpression', }, - ]), + ], }, { code: 'foo && foo?.bar;', - errors: error([ + errors: [ { column: 1, endColumn: 17, endLine: 1, line: 1, + messageId: 'unusedExpression', }, - ]), + ], options: [{ allowShortCircuit: true }], }, { code: 'foo ? foo?.bar : bar.baz;', - errors: error([ + errors: [ { column: 1, endColumn: 26, endLine: 1, line: 1, + messageId: 'unusedExpression', }, - ]), + ], options: [{ allowTernary: true }], }, { @@ -305,81 +308,87 @@ function foo() { class Foo {} Foo; `, - errors: error([ + errors: [ { column: 1, endColumn: 13, endLine: 3, line: 3, + messageId: 'unusedExpression', }, - ]), + ], }, { code: 'Map;', - errors: error([ + errors: [ { column: 1, endColumn: 21, endLine: 1, line: 1, + messageId: 'unusedExpression', }, - ]), + ], }, { code: ` declare const foo: number | undefined; foo; `, - errors: error([ + errors: [ { column: 1, endColumn: 5, endLine: 3, line: 3, + messageId: 'unusedExpression', }, - ]), + ], }, { code: ` declare const foo: number | undefined; foo as any; `, - errors: error([ + errors: [ { column: 1, endColumn: 12, endLine: 3, line: 3, + messageId: 'unusedExpression', }, - ]), + ], }, { code: ` declare const foo: number | undefined; foo; `, - errors: error([ + errors: [ { column: 1, endColumn: 10, endLine: 3, line: 3, + messageId: 'unusedExpression', }, - ]), + ], }, { code: ` declare const foo: number | undefined; foo!; `, - errors: error([ + errors: [ { column: 1, endColumn: 6, endLine: 3, line: 3, + messageId: 'unusedExpression', }, - ]), + ], }, ], }); diff --git a/packages/eslint-plugin/tests/rules/no-unused-vars/no-unused-vars-eslint.test.ts b/packages/eslint-plugin/tests/rules/no-unused-vars/no-unused-vars-eslint.test.ts index c9048412d8c0..4573260c3271 100644 --- a/packages/eslint-plugin/tests/rules/no-unused-vars/no-unused-vars-eslint.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unused-vars/no-unused-vars-eslint.test.ts @@ -6,7 +6,6 @@ import type { TestCaseError } from '@typescript-eslint/rule-tester'; import type { TSESTree } from '@typescript-eslint/utils'; import { RuleTester } from '@typescript-eslint/rule-tester'; -import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import type { MessageIds } from '../../../src/rules/no-unused-vars'; @@ -88,13 +87,11 @@ function assignedError( * Returns an expected error for used-but-ignored variables. * @param varName The name of the variable * @param [additional] The additional text for the message data - * @param [type] The node type (defaults to "Identifier") * @returns An expected error object */ function usedIgnoredError( varName: string, additional = '', - type = AST_NODE_TYPES.Identifier, ): TestCaseError { return { data: { @@ -102,7 +99,6 @@ function usedIgnoredError( varName, }, messageId: 'usedIgnoredVar', - type, }; } @@ -1566,15 +1562,15 @@ foo*/ { code: ` let x = 0; -x++, (x = 0); +(x++, (x = 0)); `, - errors: [{ ...assignedError('x'), column: 7, line: 3 }], + errors: [{ ...assignedError('x'), column: 8, line: 3 }], languageOptions: { parserOptions: { ecmaVersion: 2015 } }, }, { code: ` let x = 0; -x++, (x = 0); +(x++, (x = 0)); x = 3; `, errors: [{ ...assignedError('x'), column: 1, line: 4 }], @@ -1583,25 +1579,25 @@ x = 3; { code: ` let x = 0; -x++, 0; +(x++, 0); `, - errors: [{ ...assignedError('x'), column: 1, line: 3 }], + errors: [{ ...assignedError('x'), column: 2, line: 3 }], languageOptions: { parserOptions: { ecmaVersion: 2015 } }, }, { code: ` let x = 0; -0, x++; +(0, x++); `, - errors: [{ ...assignedError('x'), column: 4, line: 3 }], + errors: [{ ...assignedError('x'), column: 5, line: 3 }], languageOptions: { parserOptions: { ecmaVersion: 2015 } }, }, { code: ` let x = 0; -0, (1, x++); +(0, (1, x++)); `, - errors: [{ ...assignedError('x'), column: 8, line: 3 }], + errors: [{ ...assignedError('x'), column: 9, line: 3 }], languageOptions: { parserOptions: { ecmaVersion: 2015 } }, }, { @@ -1623,25 +1619,25 @@ foo = ((0, x++), 0); { code: ` let x = 0; -(x += 1), 0; +((x += 1), 0); `, - errors: [{ ...assignedError('x'), column: 2, line: 3 }], + errors: [{ ...assignedError('x'), column: 3, line: 3 }], languageOptions: { parserOptions: { ecmaVersion: 2015 } }, }, { code: ` let x = 0; -0, (x += 1); +(0, (x += 1)); `, - errors: [{ ...assignedError('x'), column: 5, line: 3 }], + errors: [{ ...assignedError('x'), column: 6, line: 3 }], languageOptions: { parserOptions: { ecmaVersion: 2015 } }, }, { code: ` let x = 0; -0, (1, (x += 1)); +(0, (1, (x += 1))); `, - errors: [{ ...assignedError('x'), column: 9, line: 3 }], + errors: [{ ...assignedError('x'), column: 10, line: 3 }], languageOptions: { parserOptions: { ecmaVersion: 2015 } }, }, { @@ -1665,15 +1661,15 @@ foo = ((0, (x += 1)), 0); { code: ` let z = 0; -(z = z + 1), (z = 2); +((z = z + 1), (z = 2)); `, - errors: [{ ...assignedError('z'), column: 15, line: 3 }], + errors: [{ ...assignedError('z'), column: 16, line: 3 }], languageOptions: { parserOptions: { ecmaVersion: 2020 } }, }, { code: ` let z = 0; -(z = z + 1), (z = 2); +((z = z + 1), (z = 2)); z = 3; `, errors: [{ ...assignedError('z'), column: 1, line: 4 }], @@ -1682,7 +1678,7 @@ z = 3; { code: ` let z = 0; -(z = z + 1), (z = 2); +((z = z + 1), (z = 2)); z = z + 3; `, errors: [{ ...assignedError('z'), column: 1, line: 4 }], @@ -1691,17 +1687,17 @@ z = z + 3; { code: ` let x = 0; -0, (x = x + 1); +(0, (x = x + 1)); `, - errors: [{ ...assignedError('x'), column: 5, line: 3 }], + errors: [{ ...assignedError('x'), column: 6, line: 3 }], languageOptions: { parserOptions: { ecmaVersion: 2020 } }, }, { code: ` let x = 0; -(x = x + 1), 0; +((x = x + 1), 0); `, - errors: [{ ...assignedError('x'), column: 2, line: 3 }], + errors: [{ ...assignedError('x'), column: 3, line: 3 }], languageOptions: { parserOptions: { ecmaVersion: 2020 } }, }, { @@ -1723,9 +1719,9 @@ foo = ((x = x + 1), 0); { code: ` let x = 0; -0, (1, (x = x + 1)); +(0, (1, (x = x + 1))); `, - errors: [{ ...assignedError('x'), column: 9, line: 3 }], + errors: [{ ...assignedError('x'), column: 10, line: 3 }], languageOptions: { parserOptions: { ecmaVersion: 2020 } }, }, { @@ -1972,7 +1968,11 @@ const _b = _a + 5; errors: [usedIgnoredError('_a', '. Used vars must not match /^_/u')], languageOptions: { parserOptions: { ecmaVersion: 6 } }, options: [ - { args: 'all', reportUsedIgnorePattern: true, varsIgnorePattern: '^_' }, + { + args: 'all', + reportUsedIgnorePattern: true, + varsIgnorePattern: '^_', + }, ], }, { @@ -1983,7 +1983,11 @@ foo(() => _a); errors: [usedIgnoredError('_a', '. Used vars must not match /^_/u')], languageOptions: { parserOptions: { ecmaVersion: 6 } }, options: [ - { args: 'all', reportUsedIgnorePattern: true, varsIgnorePattern: '^_' }, + { + args: 'all', + reportUsedIgnorePattern: true, + varsIgnorePattern: '^_', + }, ], }, { @@ -1994,7 +1998,11 @@ foo(() => _a); `, errors: [usedIgnoredError('_a', '. Used args must not match /^_/u')], options: [ - { args: 'all', argsIgnorePattern: '^_', reportUsedIgnorePattern: true }, + { + args: 'all', + argsIgnorePattern: '^_', + reportUsedIgnorePattern: true, + }, ], }, { @@ -2010,7 +2018,10 @@ console.log(a + _b); ], languageOptions: { parserOptions: { ecmaVersion: 6 } }, options: [ - { destructuredArrayIgnorePattern: '^_', reportUsedIgnorePattern: true }, + { + destructuredArrayIgnorePattern: '^_', + reportUsedIgnorePattern: true, + }, ], }, { @@ -3449,7 +3460,11 @@ const _c = a + 5; `, languageOptions: { parserOptions: { ecmaVersion: 6 } }, options: [ - { args: 'all', reportUsedIgnorePattern: true, varsIgnorePattern: '^_' }, + { + args: 'all', + reportUsedIgnorePattern: true, + varsIgnorePattern: '^_', + }, ], }, { @@ -3459,7 +3474,11 @@ const _c = a + 5; })(5); `, options: [ - { args: 'all', argsIgnorePattern: '^_', reportUsedIgnorePattern: true }, + { + args: 'all', + argsIgnorePattern: '^_', + reportUsedIgnorePattern: true, + }, ], }, { @@ -3469,7 +3488,10 @@ console.log(a + c); `, languageOptions: { parserOptions: { ecmaVersion: 6 } }, options: [ - { destructuredArrayIgnorePattern: '^_', reportUsedIgnorePattern: true }, + { + destructuredArrayIgnorePattern: '^_', + reportUsedIgnorePattern: true, + }, ], }, ], 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 5ebc8d9a406b..75dbb87439a7 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 @@ -360,25 +360,6 @@ export interface Bar extends baz.test {} code: ` import test from 'test'; import baz from 'baz'; -export interface Bar extends baz().test {} - `, - errors: [ - { - column: 8, - data: { - action: 'defined', - additional: '', - varName: 'test', - }, - line: 2, - messageId: 'unusedVar', - }, - ], - }, - { - code: ` -import test from 'test'; -import baz from 'baz'; export class Bar implements baz.test {} `, errors: [ @@ -1734,6 +1715,48 @@ export {}; ], filename: 'foo.d.ts', }, + { + code: ` +using resource = getResource(); + `, + errors: [ + { + data: { + action: 'assigned a value', + additional: '', + varName: 'resource', + }, + line: 2, + messageId: 'unusedVar', + }, + ], + languageOptions: { + parserOptions: { + ecmaVersion: 2026, + }, + }, + }, + { + code: ` +await using resource = getResource(); + `, + errors: [ + { + data: { + action: 'assigned a value', + additional: '', + varName: 'resource', + }, + line: 2, + messageId: 'unusedVar', + }, + ], + languageOptions: { + parserOptions: { + ecmaVersion: 2026, + }, + }, + }, ], valid: [ @@ -3037,5 +3060,38 @@ declare class Bar {} `, filename: 'foo.d.ts', }, + { + code: ` +using resource = getResource(); +resource; + `, + languageOptions: { + parserOptions: { + ecmaVersion: 2026, + }, + }, + }, + { + code: ` +using resource = getResource(); + `, + languageOptions: { + parserOptions: { + ecmaVersion: 2026, + }, + }, + options: [{ ignoreUsingDeclarations: true }], + }, + { + code: ` +await using resource = getResource(); + `, + languageOptions: { + parserOptions: { + ecmaVersion: 2026, + }, + }, + options: [{ ignoreUsingDeclarations: true }], + }, ], }); diff --git a/packages/eslint-plugin/tests/rules/no-use-before-define.test.ts b/packages/eslint-plugin/tests/rules/no-use-before-define.test.ts index a08b8de812a9..8494eb33e658 100644 --- a/packages/eslint-plugin/tests/rules/no-use-before-define.test.ts +++ b/packages/eslint-plugin/tests/rules/no-use-before-define.test.ts @@ -1,5 +1,4 @@ import { RuleTester } from '@typescript-eslint/rule-tester'; -import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import rule from '../../src/rules/no-use-before-define'; @@ -601,7 +600,6 @@ var a = 19; { data: { name: 'a' }, messageId: 'noUseBeforeDefine', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { @@ -617,7 +615,6 @@ var a = 19; { data: { name: 'a' }, messageId: 'noUseBeforeDefine', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions }, @@ -631,7 +628,6 @@ var a = 19; { data: { name: 'a' }, messageId: 'noUseBeforeDefine', - type: AST_NODE_TYPES.Identifier, }, ], }, @@ -644,7 +640,6 @@ var a = function () {}; { data: { name: 'a' }, messageId: 'noUseBeforeDefine', - type: AST_NODE_TYPES.Identifier, }, ], }, @@ -657,7 +652,6 @@ var a = [1, 3]; { data: { name: 'a' }, messageId: 'noUseBeforeDefine', - type: AST_NODE_TYPES.Identifier, }, ], }, @@ -674,12 +668,10 @@ function a() { { data: { name: 'a' }, messageId: 'noUseBeforeDefine', - type: AST_NODE_TYPES.Identifier, }, { data: { name: 'b' }, messageId: 'noUseBeforeDefine', - type: AST_NODE_TYPES.Identifier, }, ], }, @@ -692,7 +684,6 @@ var a = function () {}; { data: { name: 'a' }, messageId: 'noUseBeforeDefine', - type: AST_NODE_TYPES.Identifier, }, ], options: ['nofunc'], @@ -708,7 +699,6 @@ var a = function () {}; { data: { name: 'a' }, messageId: 'noUseBeforeDefine', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions }, @@ -722,7 +712,6 @@ function a() {} { data: { name: 'a' }, messageId: 'noUseBeforeDefine', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions }, @@ -740,7 +729,6 @@ try { { data: { name: 'a' }, messageId: 'noUseBeforeDefine', - type: AST_NODE_TYPES.Identifier, }, ], }, @@ -753,7 +741,6 @@ var a; { data: { name: 'a' }, messageId: 'noUseBeforeDefine', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions }, @@ -767,7 +754,6 @@ class A {} { data: { name: 'A' }, messageId: 'noUseBeforeDefine', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions }, @@ -783,7 +769,6 @@ class A {} { data: { name: 'A' }, messageId: 'noUseBeforeDefine', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions }, @@ -797,7 +782,6 @@ var A = class {}; { data: { name: 'A' }, messageId: 'noUseBeforeDefine', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions }, @@ -813,7 +797,6 @@ var A = class {}; { data: { name: 'A' }, messageId: 'noUseBeforeDefine', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions }, @@ -831,7 +814,6 @@ a++; { data: { name: 'a' }, messageId: 'noUseBeforeDefine', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions }, @@ -848,7 +830,6 @@ a++; { data: { name: 'a' }, messageId: 'noUseBeforeDefine', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions }, @@ -864,7 +845,6 @@ a++; { data: { name: 'a' }, messageId: 'noUseBeforeDefine', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions }, @@ -882,7 +862,6 @@ switch (foo) { { data: { name: 'a' }, messageId: 'noUseBeforeDefine', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions }, @@ -900,7 +879,6 @@ if (true) { { data: { name: 'a' }, messageId: 'noUseBeforeDefine', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions }, @@ -916,7 +894,6 @@ var a = function () {}; { data: { name: 'a' }, messageId: 'noUseBeforeDefine', - type: AST_NODE_TYPES.Identifier, }, ], options: [{ classes: false, functions: false }], @@ -930,7 +907,6 @@ var A = class {}; { data: { name: 'A' }, messageId: 'noUseBeforeDefine', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions }, @@ -947,7 +923,6 @@ var A = class {}; { data: { name: 'A' }, messageId: 'noUseBeforeDefine', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions }, @@ -961,7 +936,6 @@ var A = class {}; { data: { name: 'a' }, messageId: 'noUseBeforeDefine', - type: AST_NODE_TYPES.Identifier, }, ], }, @@ -971,7 +945,6 @@ var A = class {}; { data: { name: 'a' }, messageId: 'noUseBeforeDefine', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions }, @@ -982,7 +955,6 @@ var A = class {}; { data: { name: 'a' }, messageId: 'noUseBeforeDefine', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions }, @@ -993,7 +965,6 @@ var A = class {}; { data: { name: 'a' }, messageId: 'noUseBeforeDefine', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions }, @@ -1004,7 +975,6 @@ var A = class {}; { data: { name: 'a' }, messageId: 'noUseBeforeDefine', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions }, @@ -1015,7 +985,6 @@ var A = class {}; { data: { name: 'a' }, messageId: 'noUseBeforeDefine', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions }, @@ -1026,7 +995,6 @@ var A = class {}; { data: { name: 'a' }, messageId: 'noUseBeforeDefine', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions }, @@ -1037,7 +1005,6 @@ var A = class {}; { data: { name: 'a' }, messageId: 'noUseBeforeDefine', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions }, @@ -1048,7 +1015,6 @@ var A = class {}; { data: { name: 'a' }, messageId: 'noUseBeforeDefine', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions }, @@ -1059,7 +1025,6 @@ var A = class {}; { data: { name: 'a' }, messageId: 'noUseBeforeDefine', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions }, @@ -1073,7 +1038,6 @@ for (var a in a) { { data: { name: 'a' }, messageId: 'noUseBeforeDefine', - type: AST_NODE_TYPES.Identifier, }, ], }, @@ -1086,7 +1050,6 @@ for (var a of a) { { data: { name: 'a' }, messageId: 'noUseBeforeDefine', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions }, @@ -1105,7 +1068,6 @@ const Foo = 2; { data: { name: 'Foo' }, messageId: 'noUseBeforeDefine', - type: AST_NODE_TYPES.Identifier, }, ], options: [{ ignoreTypeReferences: false }], @@ -1124,7 +1086,6 @@ class Foo { { data: { name: 'Foo' }, messageId: 'noUseBeforeDefine', - type: AST_NODE_TYPES.Identifier, }, ], options: [{ ignoreTypeReferences: false }], @@ -1145,7 +1106,6 @@ const Foo = { { data: { name: 'Foo' }, messageId: 'noUseBeforeDefine', - type: AST_NODE_TYPES.Identifier, }, ], options: [{ ignoreTypeReferences: false }], @@ -1164,7 +1124,6 @@ const baz = ''; { data: { name: 'baz' }, messageId: 'noUseBeforeDefine', - type: AST_NODE_TYPES.Identifier, }, ], options: [{ ignoreTypeReferences: false }], @@ -1183,7 +1142,6 @@ var bar; { data: { name: 'bar' }, messageId: 'noUseBeforeDefine', - type: AST_NODE_TYPES.Identifier, }, ], languageOptions: { parserOptions }, diff --git a/packages/eslint-plugin/tests/rules/no-useless-constructor.test.ts b/packages/eslint-plugin/tests/rules/no-useless-constructor.test.ts index 3d792dca4c7e..7eb57f812d2b 100644 --- a/packages/eslint-plugin/tests/rules/no-useless-constructor.test.ts +++ b/packages/eslint-plugin/tests/rules/no-useless-constructor.test.ts @@ -1,5 +1,4 @@ import { RuleTester } from '@typescript-eslint/rule-tester'; -import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import rule from '../../src/rules/no-useless-constructor'; @@ -228,7 +227,6 @@ ${' '} `, }, ], - type: AST_NODE_TYPES.MethodDefinition, }, ], }, @@ -253,7 +251,6 @@ ${' '} `, }, ], - type: AST_NODE_TYPES.MethodDefinition, }, ], }, @@ -278,7 +275,6 @@ ${' '} `, }, ], - type: AST_NODE_TYPES.MethodDefinition, }, ], }, @@ -303,7 +299,6 @@ ${' '} `, }, ], - type: AST_NODE_TYPES.MethodDefinition, }, ], }, @@ -328,7 +323,6 @@ ${' '} `, }, ], - type: AST_NODE_TYPES.MethodDefinition, }, ], }, @@ -353,7 +347,6 @@ ${' '} `, }, ], - type: AST_NODE_TYPES.MethodDefinition, }, ], }, @@ -378,7 +371,6 @@ ${' '} `, }, ], - type: AST_NODE_TYPES.MethodDefinition, }, ], }, @@ -403,7 +395,6 @@ ${' '} `, }, ], - type: AST_NODE_TYPES.MethodDefinition, }, ], }, @@ -426,7 +417,6 @@ ${' '} `, }, ], - type: AST_NODE_TYPES.MethodDefinition, }, ], }, 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 500fe0e5a1db..6c02bb0b1875 100644 --- a/packages/eslint-plugin/tests/rules/non-nullable-type-assertion-style.test.ts +++ b/packages/eslint-plugin/tests/rules/non-nullable-type-assertion-style.test.ts @@ -1,16 +1,7 @@ -import { RuleTester } from '@typescript-eslint/rule-tester'; - import rule from '../../src/rules/non-nullable-type-assertion-style'; -import { getFixturesRootDir } from '../RuleTester'; +import { createRuleTesterWithTypes } from '../RuleTester'; -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: getFixturesRootDir(), - }, - }, -}); +const ruleTester = createRuleTesterWithTypes(); ruleTester.run('non-nullable-type-assertion-style', rule, { valid: [ @@ -244,15 +235,8 @@ const b = (a || undefined)!; ], }); -const ruleTesterWithNoUncheckedIndexAccess = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.noUncheckedIndexedAccess.json', - projectService: false, - sourceType: 'module', - tsconfigRootDir: getFixturesRootDir(), - }, - }, +const ruleTesterWithNoUncheckedIndexAccess = createRuleTesterWithTypes({ + project: './tsconfig.noUncheckedIndexedAccess.json', }); ruleTesterWithNoUncheckedIndexAccess.run( diff --git a/packages/eslint-plugin/tests/rules/only-throw-error.test.ts b/packages/eslint-plugin/tests/rules/only-throw-error.test.ts index a85d65cd85e5..aeaf3f392220 100644 --- a/packages/eslint-plugin/tests/rules/only-throw-error.test.ts +++ b/packages/eslint-plugin/tests/rules/only-throw-error.test.ts @@ -1,16 +1,7 @@ -import { RuleTester } from '@typescript-eslint/rule-tester'; - import rule from '../../src/rules/only-throw-error'; -import { getFixturesRootDir } from '../RuleTester'; +import { createRuleTesterWithTypes } from '../RuleTester'; -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: getFixturesRootDir(), - }, - }, -}); +const ruleTester = createRuleTesterWithTypes(); ruleTester.run('only-throw-error', rule, { valid: [ @@ -191,6 +182,19 @@ throw new Map(); }, { code: ` +function func() { + let err: Promise | Promise; + throw err; +} + `, + options: [ + { + allow: ['Promise'], + }, + ], + }, + { + code: ` try { } catch (e) { throw e; @@ -243,6 +247,30 @@ Promise.reject('foo').catch(e => { }, ], }, + { + code: ` +async function foo() { + throw await Promise.resolve(new Error('error')); +} + `, + options: [ + { + allowThrowingAny: false, + }, + ], + }, + { + code: ` +function* foo(): Generator { + throw yield 303; +} + `, + options: [ + { + allowThrowingAny: false, + }, + ], + }, ], invalid: [ { @@ -591,6 +619,24 @@ function fun(t: T): void { }, { code: ` +function func() { + let err: Promise | Promise | void; + throw err; +} + `, + errors: [ + { + messageId: 'object', + }, + ], + options: [ + { + allow: ['Promise'], + }, + ], + }, + { + code: ` class UnknownError implements Error {} throw new UnknownError(); `, @@ -745,5 +791,39 @@ Promise.reject('foo').then(e => { }, ], }, + { + code: ` +async function foo() { + throw await bar; +} + `, + errors: [ + { + messageId: 'object', + }, + ], + options: [ + { + allowThrowingAny: false, + }, + ], + }, + { + code: ` +async function foo() { + throw await Promise.resolve(303); +} + `, + errors: [ + { + messageId: 'object', + }, + ], + options: [ + { + allowThrowingAny: false, + }, + ], + }, ], }); diff --git a/packages/eslint-plugin/tests/rules/prefer-destructuring.test.ts b/packages/eslint-plugin/tests/rules/prefer-destructuring.test.ts index 452990eadbcd..66c0097daf79 100644 --- a/packages/eslint-plugin/tests/rules/prefer-destructuring.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-destructuring.test.ts @@ -1,19 +1,7 @@ -import { RuleTester } from '@typescript-eslint/rule-tester'; -import { AST_NODE_TYPES } from '@typescript-eslint/utils'; - import rule from '../../src/rules/prefer-destructuring'; -import { getFixturesRootDir } from '../RuleTester'; - -const rootPath = getFixturesRootDir(); +import { createRuleTesterWithTypes } from '../RuleTester'; -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootPath, - }, - }, -}); +const ruleTester = createRuleTesterWithTypes(); ruleTester.run('prefer-destructuring', rule, { valid: [ @@ -482,7 +470,6 @@ ruleTester.run('prefer-destructuring', rule, { { data: { type: 'object' }, messageId: 'preferDestructuring', - type: AST_NODE_TYPES.VariableDeclarator, }, ], options: [ @@ -497,7 +484,6 @@ ruleTester.run('prefer-destructuring', rule, { { data: { type: 'array' }, messageId: 'preferDestructuring', - type: AST_NODE_TYPES.VariableDeclarator, }, ], options: [ @@ -512,7 +498,6 @@ ruleTester.run('prefer-destructuring', rule, { { data: { type: 'object' }, messageId: 'preferDestructuring', - type: AST_NODE_TYPES.VariableDeclarator, }, ], options: [ @@ -535,7 +520,6 @@ ruleTester.run('prefer-destructuring', rule, { { data: { type: 'array' }, messageId: 'preferDestructuring', - type: AST_NODE_TYPES.VariableDeclarator, }, ], output: null, @@ -549,7 +533,6 @@ ruleTester.run('prefer-destructuring', rule, { { data: { type: 'array' }, messageId: 'preferDestructuring', - type: AST_NODE_TYPES.AssignmentExpression, }, ], output: null, @@ -563,7 +546,6 @@ ruleTester.run('prefer-destructuring', rule, { { data: { type: 'array' }, messageId: 'preferDestructuring', - type: AST_NODE_TYPES.VariableDeclarator, }, ], output: null, @@ -577,7 +559,6 @@ ruleTester.run('prefer-destructuring', rule, { { data: { type: 'array' }, messageId: 'preferDestructuring', - type: AST_NODE_TYPES.AssignmentExpression, }, ], output: null, @@ -593,7 +574,6 @@ ruleTester.run('prefer-destructuring', rule, { { data: { type: 'array' }, messageId: 'preferDestructuring', - type: AST_NODE_TYPES.VariableDeclarator, }, ], output: null, @@ -609,7 +589,6 @@ ruleTester.run('prefer-destructuring', rule, { { data: { type: 'array' }, messageId: 'preferDestructuring', - type: AST_NODE_TYPES.AssignmentExpression, }, ], output: null, @@ -623,7 +602,6 @@ ruleTester.run('prefer-destructuring', rule, { { data: { type: 'array' }, messageId: 'preferDestructuring', - type: AST_NODE_TYPES.VariableDeclarator, }, ], output: null, @@ -637,7 +615,6 @@ ruleTester.run('prefer-destructuring', rule, { { data: { type: 'array' }, messageId: 'preferDestructuring', - type: AST_NODE_TYPES.AssignmentExpression, }, ], output: null, @@ -651,7 +628,6 @@ ruleTester.run('prefer-destructuring', rule, { { data: { type: 'array' }, messageId: 'preferDestructuring', - type: AST_NODE_TYPES.VariableDeclarator, }, ], output: null, @@ -665,7 +641,6 @@ ruleTester.run('prefer-destructuring', rule, { { data: { type: 'array' }, messageId: 'preferDestructuring', - type: AST_NODE_TYPES.AssignmentExpression, }, ], output: null, @@ -679,7 +654,6 @@ ruleTester.run('prefer-destructuring', rule, { { data: { type: 'array' }, messageId: 'preferDestructuring', - type: AST_NODE_TYPES.VariableDeclarator, }, ], output: null, @@ -693,7 +667,6 @@ ruleTester.run('prefer-destructuring', rule, { { data: { type: 'array' }, messageId: 'preferDestructuring', - type: AST_NODE_TYPES.AssignmentExpression, }, ], output: null, @@ -707,7 +680,6 @@ ruleTester.run('prefer-destructuring', rule, { { data: { type: 'object' }, messageId: 'preferDestructuring', - type: AST_NODE_TYPES.VariableDeclarator, }, ], options: [{ object: true }, { enforceForRenamedProperties: true }], @@ -722,7 +694,6 @@ ruleTester.run('prefer-destructuring', rule, { { data: { type: 'object' }, messageId: 'preferDestructuring', - type: AST_NODE_TYPES.AssignmentExpression, }, ], options: [{ object: true }, { enforceForRenamedProperties: true }], @@ -737,7 +708,6 @@ ruleTester.run('prefer-destructuring', rule, { { data: { type: 'object' }, messageId: 'preferDestructuring', - type: AST_NODE_TYPES.VariableDeclarator, }, ], options: [ @@ -758,7 +728,6 @@ ruleTester.run('prefer-destructuring', rule, { { data: { type: 'object' }, messageId: 'preferDestructuring', - type: AST_NODE_TYPES.AssignmentExpression, }, ], options: [ @@ -780,7 +749,6 @@ ruleTester.run('prefer-destructuring', rule, { { data: { type: 'object' }, messageId: 'preferDestructuring', - type: AST_NODE_TYPES.AssignmentExpression, }, ], options: [ @@ -799,7 +767,6 @@ ruleTester.run('prefer-destructuring', rule, { { data: { type: 'object' }, messageId: 'preferDestructuring', - type: AST_NODE_TYPES.AssignmentExpression, }, ], options: [ @@ -818,7 +785,6 @@ ruleTester.run('prefer-destructuring', rule, { { data: { type: 'object' }, messageId: 'preferDestructuring', - type: AST_NODE_TYPES.AssignmentExpression, }, ], options: [ @@ -837,7 +803,6 @@ ruleTester.run('prefer-destructuring', rule, { { data: { type: 'object' }, messageId: 'preferDestructuring', - type: AST_NODE_TYPES.AssignmentExpression, }, ], options: [ @@ -856,7 +821,6 @@ ruleTester.run('prefer-destructuring', rule, { { data: { type: 'object' }, messageId: 'preferDestructuring', - type: AST_NODE_TYPES.AssignmentExpression, }, ], options: [ @@ -875,7 +839,6 @@ ruleTester.run('prefer-destructuring', rule, { { data: { type: 'object' }, messageId: 'preferDestructuring', - type: AST_NODE_TYPES.AssignmentExpression, }, ], options: [ @@ -893,7 +856,6 @@ ruleTester.run('prefer-destructuring', rule, { { data: { type: 'object' }, messageId: 'preferDestructuring', - type: AST_NODE_TYPES.VariableDeclarator, }, ], options: [{ object: true }, { enforceForRenamedProperties: true }], @@ -908,7 +870,6 @@ ruleTester.run('prefer-destructuring', rule, { { data: { type: 'object' }, messageId: 'preferDestructuring', - type: AST_NODE_TYPES.AssignmentExpression, }, ], options: [{ object: true }, { enforceForRenamedProperties: true }], @@ -925,7 +886,6 @@ ruleTester.run('prefer-destructuring', rule, { { data: { type: 'object' }, messageId: 'preferDestructuring', - type: AST_NODE_TYPES.VariableDeclarator, }, ], output: ` @@ -943,7 +903,6 @@ ruleTester.run('prefer-destructuring', rule, { { data: { type: 'object' }, messageId: 'preferDestructuring', - type: AST_NODE_TYPES.VariableDeclarator, }, ], output: ` @@ -958,7 +917,6 @@ ruleTester.run('prefer-destructuring', rule, { { data: { type: 'object' }, messageId: 'preferDestructuring', - type: AST_NODE_TYPES.VariableDeclarator, }, ], output: 'const {call} = () => null;', @@ -973,7 +931,6 @@ ruleTester.run('prefer-destructuring', rule, { { data: { type: 'object' }, messageId: 'preferDestructuring', - type: AST_NODE_TYPES.VariableDeclarator, }, ], output: ` @@ -991,7 +948,6 @@ ruleTester.run('prefer-destructuring', rule, { { data: { type: 'object' }, messageId: 'preferDestructuring', - type: AST_NODE_TYPES.VariableDeclarator, }, ], output: ` @@ -1008,7 +964,6 @@ ruleTester.run('prefer-destructuring', rule, { { data: { type: 'object' }, messageId: 'preferDestructuring', - type: AST_NODE_TYPES.VariableDeclarator, }, ], output: ` @@ -1027,7 +982,6 @@ ruleTester.run('prefer-destructuring', rule, { { data: { type: 'object' }, messageId: 'preferDestructuring', - type: AST_NODE_TYPES.VariableDeclarator, }, ], options: [{ object: true }, { enforceForRenamedProperties: true }], @@ -1043,7 +997,6 @@ ruleTester.run('prefer-destructuring', rule, { { data: { type: 'object' }, messageId: 'preferDestructuring', - type: AST_NODE_TYPES.AssignmentExpression, }, ], options: [{ object: true }, { enforceForRenamedProperties: true }], @@ -1059,7 +1012,6 @@ ruleTester.run('prefer-destructuring', rule, { { data: { type: 'object' }, messageId: 'preferDestructuring', - type: AST_NODE_TYPES.VariableDeclarator, }, ], options: [{ object: true }, { enforceForRenamedProperties: true }], @@ -1076,7 +1028,6 @@ ruleTester.run('prefer-destructuring', rule, { { data: { type: 'object' }, messageId: 'preferDestructuring', - type: AST_NODE_TYPES.AssignmentExpression, }, ], options: [{ object: true }, { enforceForRenamedProperties: true }], diff --git a/packages/eslint-plugin/tests/rules/prefer-find.test.ts b/packages/eslint-plugin/tests/rules/prefer-find.test.ts index 0c17c69dd5f2..5c88cb62000e 100644 --- a/packages/eslint-plugin/tests/rules/prefer-find.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-find.test.ts @@ -1,18 +1,9 @@ -import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; +import { noFormat } from '@typescript-eslint/rule-tester'; import rule from '../../src/rules/prefer-find'; -import { getFixturesRootDir } from '../RuleTester'; +import { createRuleTesterWithTypes } from '../RuleTester'; -const rootDir = getFixturesRootDir(); - -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootDir, - }, - }, -}); +const ruleTester = createRuleTesterWithTypes(); ruleTester.run('prefer-find', rule, { valid: [ diff --git a/packages/eslint-plugin/tests/rules/prefer-function-type.test.ts b/packages/eslint-plugin/tests/rules/prefer-function-type.test.ts index 12f1bb333689..64109ab7e180 100644 --- a/packages/eslint-plugin/tests/rules/prefer-function-type.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-function-type.test.ts @@ -55,7 +55,6 @@ interface Foo { literalOrInterface: phrases[AST_NODE_TYPES.TSInterfaceDeclaration], }, messageId: 'functionTypeOverCallableType', - type: AST_NODE_TYPES.TSCallSignatureDeclaration, }, ], output: ` @@ -76,7 +75,6 @@ export default interface Foo { literalOrInterface: phrases[AST_NODE_TYPES.TSInterfaceDeclaration], }, messageId: 'functionTypeOverCallableType', - type: AST_NODE_TYPES.TSCallSignatureDeclaration, }, ], output: null, @@ -94,7 +92,6 @@ interface Foo { literalOrInterface: phrases[AST_NODE_TYPES.TSInterfaceDeclaration], }, messageId: 'functionTypeOverCallableType', - type: AST_NODE_TYPES.TSCallSignatureDeclaration, }, ], output: ` @@ -115,7 +112,6 @@ export interface Foo { literalOrInterface: phrases[AST_NODE_TYPES.TSInterfaceDeclaration], }, messageId: 'functionTypeOverCallableType', - type: AST_NODE_TYPES.TSCallSignatureDeclaration, }, ], output: ` @@ -136,7 +132,6 @@ export interface Foo { literalOrInterface: phrases[AST_NODE_TYPES.TSInterfaceDeclaration], }, messageId: 'functionTypeOverCallableType', - type: AST_NODE_TYPES.TSCallSignatureDeclaration, }, ], output: ` @@ -156,7 +151,6 @@ function foo(bar: { /* comment */ (s: string): number } | undefined): number { literalOrInterface: phrases[AST_NODE_TYPES.TSTypeLiteral], }, messageId: 'functionTypeOverCallableType', - type: AST_NODE_TYPES.TSCallSignatureDeclaration, }, ], output: ` @@ -177,7 +171,6 @@ type Foo = { literalOrInterface: phrases[AST_NODE_TYPES.TSTypeLiteral], }, messageId: 'functionTypeOverCallableType', - type: AST_NODE_TYPES.TSCallSignatureDeclaration, }, ], output: ` @@ -196,7 +189,6 @@ function foo(bar: { (s: string): number }): number { literalOrInterface: phrases[AST_NODE_TYPES.TSTypeLiteral], }, messageId: 'functionTypeOverCallableType', - type: AST_NODE_TYPES.TSCallSignatureDeclaration, }, ], output: ` @@ -217,7 +209,6 @@ function foo(bar: { (s: string): number } | undefined): number { literalOrInterface: phrases[AST_NODE_TYPES.TSTypeLiteral], }, messageId: 'functionTypeOverCallableType', - type: AST_NODE_TYPES.TSCallSignatureDeclaration, }, ], output: ` @@ -238,7 +229,6 @@ interface Foo extends Function { literalOrInterface: phrases[AST_NODE_TYPES.TSInterfaceDeclaration], }, messageId: 'functionTypeOverCallableType', - type: AST_NODE_TYPES.TSCallSignatureDeclaration, }, ], output: ` @@ -257,7 +247,6 @@ interface Foo { literalOrInterface: phrases[AST_NODE_TYPES.TSInterfaceDeclaration], }, messageId: 'functionTypeOverCallableType', - type: AST_NODE_TYPES.TSCallSignatureDeclaration, }, ], output: ` @@ -276,7 +265,6 @@ interface Foo { literalOrInterface: phrases[AST_NODE_TYPES.TSInterfaceDeclaration], }, messageId: 'functionTypeOverCallableType', - type: AST_NODE_TYPES.TSCallSignatureDeclaration, }, ], output: ` @@ -293,7 +281,6 @@ type Foo = { (this: string): T }; literalOrInterface: phrases[AST_NODE_TYPES.TSTypeLiteral], }, messageId: 'functionTypeOverCallableType', - type: AST_NODE_TYPES.TSCallSignatureDeclaration, }, ], output: ` @@ -312,7 +299,6 @@ interface Foo { interfaceName: 'Foo', }, messageId: 'unexpectedThisOnFunctionOnlyInterface', - type: AST_NODE_TYPES.TSThisType, }, ], output: null, @@ -329,7 +315,6 @@ interface Foo { interfaceName: 'Foo', }, messageId: 'unexpectedThisOnFunctionOnlyInterface', - type: AST_NODE_TYPES.TSThisType, }, ], output: null, @@ -355,7 +340,6 @@ interface Foo { literalOrInterface: phrases[AST_NODE_TYPES.TSInterfaceDeclaration], }, messageId: 'functionTypeOverCallableType', - type: AST_NODE_TYPES.TSCallSignatureDeclaration, }, ], output: ` @@ -381,7 +365,6 @@ type X = {} | { (): void; } literalOrInterface: phrases[AST_NODE_TYPES.TSTypeLiteral], }, messageId: 'functionTypeOverCallableType', - type: AST_NODE_TYPES.TSCallSignatureDeclaration, }, ], output: ` @@ -398,7 +381,6 @@ type X = {} & { (): void; }; literalOrInterface: phrases[AST_NODE_TYPES.TSTypeLiteral], }, messageId: 'functionTypeOverCallableType', - type: AST_NODE_TYPES.TSCallSignatureDeclaration, }, ], output: ` diff --git a/packages/eslint-plugin/tests/rules/prefer-includes.test.ts b/packages/eslint-plugin/tests/rules/prefer-includes.test.ts index 35830c45ad9d..a56cd9ded45a 100644 --- a/packages/eslint-plugin/tests/rules/prefer-includes.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-includes.test.ts @@ -1,18 +1,7 @@ -import { RuleTester } from '@typescript-eslint/rule-tester'; - import rule from '../../src/rules/prefer-includes'; -import { getFixturesRootDir } from '../RuleTester'; - -const rootPath = getFixturesRootDir(); +import { createRuleTesterWithTypes } from '../RuleTester'; -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootPath, - }, - }, -}); +const ruleTester = createRuleTesterWithTypes(); ruleTester.run('prefer-includes', rule, { valid: [ 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 ea670139ccb3..f655c87e9ce2 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 @@ -54,11 +54,6 @@ enum ValidQuotedKey { ` enum ValidQuotedKeyWithAssignment { 'a' = 1, -} - `, - ` -enum ValidKeyWithComputedSyntaxButNoComputedKey { - ['a'], } `, { @@ -107,15 +102,6 @@ enum Foo { }, { code: ` -enum Foo { - ['A-1'] = 1 << 0, - C = ~Foo['A-1'], -} - `, - options: [{ allowBitwiseExpressions: true }], - }, - { - code: ` enum Foo { A = 1 << 0, B = 1 << 1, diff --git a/packages/eslint-plugin/tests/rules/prefer-nullish-coalescing.test.ts b/packages/eslint-plugin/tests/rules/prefer-nullish-coalescing.test.ts index 618d1c244414..26de39970467 100644 --- a/packages/eslint-plugin/tests/rules/prefer-nullish-coalescing.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-nullish-coalescing.test.ts @@ -3,7 +3,7 @@ import type { ValidTestCase, } from '@typescript-eslint/rule-tester'; -import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; +import { noFormat } from '@typescript-eslint/rule-tester'; import * as path from 'node:path'; import type { @@ -12,18 +12,10 @@ import type { } from '../../src/rules/prefer-nullish-coalescing'; import rule from '../../src/rules/prefer-nullish-coalescing'; -import { getFixturesRootDir } from '../RuleTester'; +import { createRuleTesterWithTypes, getFixturesRootDir } from '../RuleTester'; -const rootPath = getFixturesRootDir(); - -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootPath, - }, - }, -}); +const rootDir = getFixturesRootDir(); +const ruleTester = createRuleTesterWithTypes(); const types = ['string', 'number', 'boolean', 'object']; const nullishTypes = ['null', 'undefined', 'null | undefined']; @@ -1253,32 +1245,6 @@ const test = Boolean(((a = b), b || c)); }, { code: ` -let a: string | true | undefined; -let b: string | boolean | undefined; - -const x = Boolean(a ? a : b); - `, - options: [ - { - ignoreBooleanCoercion: true, - }, - ], - }, - { - code: ` -let a: string | boolean | undefined; -let b: string | boolean | undefined; - -const test = Boolean(!a ? b : a); - `, - options: [ - { - ignoreBooleanCoercion: true, - }, - ], - }, - { - code: ` let a: string | boolean | undefined; let b: string | boolean | undefined; let c: string | boolean | undefined; @@ -2521,7 +2487,7 @@ if (x) { ], languageOptions: { parserOptions: { - tsconfigRootDir: path.join(rootPath, 'unstrict'), + tsconfigRootDir: path.join(rootDir, 'unstrict'), }, }, output: null, @@ -5089,6 +5055,64 @@ const x = Boolean(1 + (a ?? b)); let a: string | true | undefined; let b: string | boolean | undefined; +const x = Boolean(a ? a : b); + `, + errors: [ + { + messageId: 'preferNullishOverTernary', + suggestions: [ + { + messageId: 'suggestNullish', + output: ` +let a: string | true | undefined; +let b: string | boolean | undefined; + +const x = Boolean(a ?? b); + `, + }, + ], + }, + ], + options: [ + { + ignoreBooleanCoercion: true, + }, + ], + }, + { + code: ` +let a: string | boolean | undefined; +let b: string | boolean | undefined; + +const test = Boolean(!a ? b : a); + `, + errors: [ + { + messageId: 'preferNullishOverTernary', + suggestions: [ + { + messageId: 'suggestNullish', + output: ` +let a: string | boolean | undefined; +let b: string | boolean | undefined; + +const test = Boolean(a ?? b); + `, + }, + ], + }, + ], + options: [ + { + ignoreBooleanCoercion: true, + }, + ], + }, + { + code: ` +let a: string | true | undefined; +let b: string | boolean | undefined; + declare function f(x: unknown): unknown; if (f(a || b)) { diff --git a/packages/eslint-plugin/tests/rules/prefer-optional-chain/prefer-optional-chain.test.ts b/packages/eslint-plugin/tests/rules/prefer-optional-chain/prefer-optional-chain.test.ts index c05f6218b24c..6639951b66e4 100644 --- a/packages/eslint-plugin/tests/rules/prefer-optional-chain/prefer-optional-chain.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-optional-chain/prefer-optional-chain.test.ts @@ -1,18 +1,11 @@ -import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; +import { noFormat } from '@typescript-eslint/rule-tester'; import rule from '../../../src/rules/prefer-optional-chain'; import { dedupeTestCases } from '../../dedupeTestCases'; -import { getFixturesRootDir } from '../../RuleTester'; +import { createRuleTesterWithTypes } from '../../RuleTester'; import { BaseCases, identity } from './base-cases'; -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: getFixturesRootDir(), - }, - }, -}); +const ruleTester = createRuleTesterWithTypes(); describe('|| {}', () => { ruleTester.run('prefer-optional-chain', rule, { @@ -667,32 +660,1223 @@ describe('|| {}', () => { 'foo ||= bar ?? {};', // https://github.com/typescript-eslint/typescript-eslint/issues/8380 ` - const a = null; - const b = 0; - a === undefined || b === null || b === undefined; + const a = null; + const b = 0; + a === undefined || b === null || b === undefined; + `, + // https://github.com/typescript-eslint/typescript-eslint/issues/8380 + ` + const a = 0; + const b = 0; + a === undefined || b === undefined || b === null; + `, + // https://github.com/typescript-eslint/typescript-eslint/issues/8380 + ` + const a = 0; + const b = 0; + b === null || a === undefined || b === undefined; + `, + // https://github.com/typescript-eslint/typescript-eslint/issues/8380 + ` + const b = 0; + b === null || b === undefined; + `, + // https://github.com/typescript-eslint/typescript-eslint/issues/8380 + ` + const a = 0; + const b = 0; + b != null && a !== null && a !== undefined; + `, + ], + }); +}); + +describe('chain ending with comparison', () => { + ruleTester.run('prefer-optional-chain', rule, { + invalid: [ + { + code: 'foo && foo.bar == 0;', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar == 0;`, + }, + { + code: 'foo && foo.bar == 1;', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar == 1;`, + }, + { + code: "foo && foo.bar == '123';", + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar == '123';`, + }, + { + code: 'foo && foo.bar == {};', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar == {};`, + }, + { + code: 'foo && foo.bar == false;', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar == false;`, + }, + { + code: 'foo && foo.bar == true;', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar == true;`, + }, + { + code: 'foo && foo.bar === 0;', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar === 0;`, + }, + { + code: 'foo && foo.bar === 1;', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar === 1;`, + }, + { + code: "foo && foo.bar === '123';", + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar === '123';`, + }, + { + code: 'foo && foo.bar === {};', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar === {};`, + }, + { + code: 'foo && foo.bar === false;', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar === false;`, + }, + { + code: 'foo && foo.bar === true;', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar === true;`, + }, + { + code: 'foo && foo.bar === null;', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar === null;`, + }, + { + code: 'foo && foo.bar !== undefined;', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar !== undefined;`, + }, + { + code: 'foo && foo.bar != undefined;', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar != undefined;`, + }, + { + code: 'foo && foo.bar != null;', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar != null;`, + }, + { + code: 'foo != null && foo.bar == 0;', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar == 0;`, + }, + { + code: 'foo != null && foo.bar == 1;', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar == 1;`, + }, + { + code: "foo != null && foo.bar == '123';", + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar == '123';`, + }, + { + code: 'foo != null && foo.bar == {};', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar == {};`, + }, + { + code: 'foo != null && foo.bar == false;', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar == false;`, + }, + { + code: 'foo != null && foo.bar == true;', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar == true;`, + }, + { + code: 'foo != null && foo.bar === 0;', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar === 0;`, + }, + { + code: 'foo != null && foo.bar === 1;', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar === 1;`, + }, + { + code: "foo != null && foo.bar === '123';", + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar === '123';`, + }, + { + code: 'foo != null && foo.bar === {};', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar === {};`, + }, + { + code: 'foo != null && foo.bar === false;', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar === false;`, + }, + { + code: 'foo != null && foo.bar === true;', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar === true;`, + }, + { + code: 'foo != null && foo.bar === null;', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar === null;`, + }, + { + code: 'foo != null && foo.bar !== undefined;', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar !== undefined;`, + }, + { + code: 'foo != null && foo.bar != undefined;', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar != undefined;`, + }, + { + code: 'foo != null && foo.bar != null;', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar != null;`, + }, + { + code: ` + declare const foo: { bar: number }; + foo && foo.bar != null; + `, + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: ` + declare const foo: { bar: number }; + foo?.bar != null; + `, + }, + { + code: ` + declare const foo: { bar: number }; + foo != null && foo.bar != null; + `, + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: ` + declare const foo: { bar: number }; + foo?.bar != null; + `, + }, + { + code: '!foo || foo.bar != 0;', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar != 0;`, + }, + { + code: '!foo || foo.bar != 1;', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar != 1;`, + }, + { + code: "!foo || foo.bar != '123';", + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar != '123';`, + }, + { + code: '!foo || foo.bar != {};', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar != {};`, + }, + { + code: '!foo || foo.bar != false;', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar != false;`, + }, + { + code: '!foo || foo.bar != true;', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar != true;`, + }, + { + code: '!foo || foo.bar === undefined;', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar === undefined;`, + }, + { + code: '!foo || foo.bar == undefined;', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar == undefined;`, + }, + { + code: '!foo || foo.bar == null;', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar == null;`, + }, + { + code: '!foo || foo.bar !== 0;', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar !== 0;`, + }, + { + code: '!foo || foo.bar !== 1;', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar !== 1;`, + }, + { + code: "!foo || foo.bar !== '123';", + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar !== '123';`, + }, + { + code: '!foo || foo.bar !== {};', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar !== {};`, + }, + { + code: '!foo || foo.bar !== false;', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar !== false;`, + }, + { + code: '!foo || foo.bar !== true;', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar !== true;`, + }, + { + code: '!foo || foo.bar !== null;', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar !== null;`, + }, + { + code: 'foo == null || foo.bar != 0;', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar != 0;`, + }, + { + code: 'foo == null || foo.bar != 1;', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar != 1;`, + }, + { + code: "foo == null || foo.bar != '123';", + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar != '123';`, + }, + { + code: 'foo == null || foo.bar != {};', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar != {};`, + }, + { + code: 'foo == null || foo.bar != false;', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar != false;`, + }, + { + code: 'foo == null || foo.bar != true;', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar != true;`, + }, + { + code: 'foo == null || foo.bar === undefined;', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar === undefined;`, + }, + { + code: 'foo == null || foo.bar == undefined;', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar == undefined;`, + }, + { + code: 'foo == null || foo.bar == null;', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar == null;`, + }, + { + code: 'foo == null || foo.bar !== 0;', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar !== 0;`, + }, + { + code: 'foo == null || foo.bar !== 1;', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar !== 1;`, + }, + { + code: "foo == null || foo.bar !== '123';", + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar !== '123';`, + }, + { + code: 'foo == null || foo.bar !== {};', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar !== {};`, + }, + { + code: 'foo == null || foo.bar !== false;', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar !== false;`, + }, + { + code: 'foo == null || foo.bar !== true;', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar !== true;`, + }, + { + code: 'foo == null || foo.bar !== null;', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `foo?.bar !== null;`, + }, + { + code: ` + declare const foo: { bar: number }; + !foo || foo.bar == null; + `, + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: ` + declare const foo: { bar: number }; + foo?.bar == null; + `, + }, + { + code: ` + declare const foo: { bar: number }; + !foo || foo.bar == undefined; + `, + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: ` + declare const foo: { bar: number }; + foo?.bar == undefined; + `, + }, + { + code: ` + declare const foo: { bar: number }; + !foo || foo.bar === undefined; + `, + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: ` + declare const foo: { bar: number }; + foo?.bar === undefined; + `, + }, + { + code: ` + declare const foo: { bar: number }; + !foo || foo.bar !== 0; + `, + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: ` + declare const foo: { bar: number }; + foo?.bar !== 0; + `, + }, + { + code: ` + declare const foo: { bar: number }; + !foo || foo.bar !== 1; + `, + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: ` + declare const foo: { bar: number }; + foo?.bar !== 1; + `, + }, + { + code: ` + declare const foo: { bar: number }; + !foo || foo.bar !== '123'; + `, + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: ` + declare const foo: { bar: number }; + foo?.bar !== '123'; + `, + }, + { + code: ` + declare const foo: { bar: number }; + !foo || foo.bar !== {}; + `, + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: ` + declare const foo: { bar: number }; + foo?.bar !== {}; + `, + }, + { + code: ` + declare const foo: { bar: number }; + !foo || foo.bar !== false; + `, + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: ` + declare const foo: { bar: number }; + foo?.bar !== false; + `, + }, + { + code: ` + declare const foo: { bar: number }; + !foo || foo.bar !== true; + `, + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: ` + declare const foo: { bar: number }; + foo?.bar !== true; + `, + }, + { + code: ` + declare const foo: { bar: number }; + !foo || foo.bar !== null; + `, + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: ` + declare const foo: { bar: number }; + foo?.bar !== null; + `, + }, + { + code: ` + declare const foo: { bar: number }; + !foo || foo.bar != 0; + `, + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: ` + declare const foo: { bar: number }; + foo?.bar != 0; + `, + }, + { + code: ` + declare const foo: { bar: number }; + !foo || foo.bar != 1; + `, + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: ` + declare const foo: { bar: number }; + foo?.bar != 1; + `, + }, + { + code: ` + declare const foo: { bar: number }; + !foo || foo.bar != '123'; + `, + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: ` + declare const foo: { bar: number }; + foo?.bar != '123'; + `, + }, + { + code: ` + declare const foo: { bar: number }; + !foo || foo.bar != {}; + `, + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: ` + declare const foo: { bar: number }; + foo?.bar != {}; + `, + }, + { + code: ` + declare const foo: { bar: number }; + !foo || foo.bar != false; + `, + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: ` + declare const foo: { bar: number }; + foo?.bar != false; + `, + }, + { + code: ` + declare const foo: { bar: number }; + !foo || foo.bar != true; + `, + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: ` + declare const foo: { bar: number }; + foo?.bar != true; + `, + }, + { + code: ` + declare const foo: { bar: number }; + foo == null || foo.bar == null; + `, + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: ` + declare const foo: { bar: number }; + foo?.bar == null; + `, + }, + { + code: ` + declare const foo: { bar: number }; + foo == null || foo.bar == undefined; + `, + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: ` + declare const foo: { bar: number }; + foo?.bar == undefined; + `, + }, + { + code: ` + declare const foo: { bar: number }; + foo == null || foo.bar === undefined; + `, + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: ` + declare const foo: { bar: number }; + foo?.bar === undefined; + `, + }, + { + code: ` + declare const foo: { bar: number }; + foo == null || foo.bar !== 0; + `, + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: ` + declare const foo: { bar: number }; + foo?.bar !== 0; + `, + }, + { + code: ` + declare const foo: { bar: number }; + foo == null || foo.bar !== 1; + `, + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: ` + declare const foo: { bar: number }; + foo?.bar !== 1; + `, + }, + { + code: ` + declare const foo: { bar: number }; + foo == null || foo.bar !== '123'; + `, + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: ` + declare const foo: { bar: number }; + foo?.bar !== '123'; + `, + }, + { + code: ` + declare const foo: { bar: number }; + foo == null || foo.bar !== {}; + `, + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: ` + declare const foo: { bar: number }; + foo?.bar !== {}; + `, + }, + { + code: ` + declare const foo: { bar: number }; + foo == null || foo.bar !== false; + `, + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: ` + declare const foo: { bar: number }; + foo?.bar !== false; + `, + }, + { + code: ` + declare const foo: { bar: number }; + foo == null || foo.bar !== true; + `, + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: ` + declare const foo: { bar: number }; + foo?.bar !== true; + `, + }, + { + code: ` + declare const foo: { bar: number }; + foo == null || foo.bar !== null; + `, + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: ` + declare const foo: { bar: number }; + foo?.bar !== null; + `, + }, + // yoda case + { + code: "foo != null && null != foo.bar && '123' == foo.bar.baz;", + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `'123' == foo?.bar?.baz;`, + }, + { + code: "foo != null && null != foo.bar && '123' === foo.bar.baz;", + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `'123' === foo?.bar?.baz;`, + }, + { + code: 'foo != null && null != foo.bar && undefined !== foo.bar.baz;', + errors: [{ messageId: 'preferOptionalChain', suggestions: null }], + output: `undefined !== foo?.bar?.baz;`, + }, + ], + valid: [ + 'foo && foo.bar == undeclaredVar;', + 'foo && foo.bar == null;', + 'foo && foo.bar == undefined;', + 'foo && foo.bar === undeclaredVar;', + 'foo && foo.bar === undefined;', + 'foo && foo.bar !== 0;', + 'foo && foo.bar !== 1;', + "foo && foo.bar !== '123';", + 'foo && foo.bar !== {};', + 'foo && foo.bar !== false;', + 'foo && foo.bar !== true;', + 'foo && foo.bar !== null;', + 'foo && foo.bar !== undeclaredVar;', + 'foo && foo.bar != 0;', + 'foo && foo.bar != 1;', + "foo && foo.bar != '123';", + 'foo && foo.bar != {};', + 'foo && foo.bar != false;', + 'foo && foo.bar != true;', + 'foo && foo.bar != undeclaredVar;', + 'foo != null && foo.bar == undeclaredVar;', + 'foo != null && foo.bar == null;', + 'foo != null && foo.bar == undefined;', + 'foo != null && foo.bar === undeclaredVar;', + 'foo != null && foo.bar === undefined;', + 'foo != null && foo.bar !== 0;', + 'foo != null && foo.bar !== 1;', + "foo != null && foo.bar !== '123';", + 'foo != null && foo.bar !== {};', + 'foo != null && foo.bar !== false;', + 'foo != null && foo.bar !== true;', + 'foo != null && foo.bar !== null;', + 'foo != null && foo.bar !== undeclaredVar;', + 'foo != null && foo.bar != 0;', + 'foo != null && foo.bar != 1;', + "foo != null && foo.bar != '123';", + 'foo != null && foo.bar != {};', + 'foo != null && foo.bar != false;', + 'foo != null && foo.bar != true;', + 'foo != null && foo.bar != undeclaredVar;', + ` + declare const foo: { bar: number }; + foo && foo.bar == undeclaredVar; + `, + ` + declare const foo: { bar: number }; + foo && foo.bar == null; + `, + ` + declare const foo: { bar: number }; + foo && foo.bar == undefined; + `, + ` + declare const foo: { bar: number }; + foo && foo.bar === undeclaredVar; + `, + ` + declare const foo: { bar: number }; + foo && foo.bar === undefined; + `, + ` + declare const foo: { bar: number }; + foo && foo.bar !== 0; + `, + ` + declare const foo: { bar: number }; + foo && foo.bar !== 1; + `, + ` + declare const foo: { bar: number }; + foo && foo.bar !== '123'; + `, + ` + declare const foo: { bar: number }; + foo && foo.bar !== {}; + `, + ` + declare const foo: { bar: number }; + foo && foo.bar !== false; + `, + ` + declare const foo: { bar: number }; + foo && foo.bar !== true; + `, + ` + declare const foo: { bar: number }; + foo && foo.bar !== null; + `, + ` + declare const foo: { bar: number }; + foo && foo.bar !== undeclaredVar; + `, + ` + declare const foo: { bar: number }; + foo && foo.bar != 0; + `, + ` + declare const foo: { bar: number }; + foo && foo.bar != 1; + `, + ` + declare const foo: { bar: number }; + foo && foo.bar != '123'; + `, + ` + declare const foo: { bar: number }; + foo && foo.bar != {}; + `, + ` + declare const foo: { bar: number }; + foo && foo.bar != false; + `, + ` + declare const foo: { bar: number }; + foo && foo.bar != true; + `, + ` + declare const foo: { bar: number }; + foo && foo.bar != undeclaredVar; + `, + ` + declare const foo: { bar: number }; + foo != null && foo.bar == undeclaredVar; + `, + ` + declare const foo: { bar: number }; + foo != null && foo.bar == null; + `, + ` + declare const foo: { bar: number }; + foo != null && foo.bar == undefined; + `, + ` + declare const foo: { bar: number }; + foo != null && foo.bar === undeclaredVar; + `, + ` + declare const foo: { bar: number }; + foo != null && foo.bar === undefined; + `, + ` + declare const foo: { bar: number }; + foo != null && foo.bar !== 0; `, - // https://github.com/typescript-eslint/typescript-eslint/issues/8380 ` - const a = 0; - const b = 0; - a === undefined || b === undefined || b === null; + declare const foo: { bar: number }; + foo != null && foo.bar !== 1; `, - // https://github.com/typescript-eslint/typescript-eslint/issues/8380 ` - const a = 0; - const b = 0; - b === null || a === undefined || b === undefined; + declare const foo: { bar: number }; + foo != null && foo.bar !== '123'; `, - // https://github.com/typescript-eslint/typescript-eslint/issues/8380 ` - const b = 0; - b === null || b === undefined; + declare const foo: { bar: number }; + foo != null && foo.bar !== {}; `, - // https://github.com/typescript-eslint/typescript-eslint/issues/8380 ` - const a = 0; - const b = 0; - b != null && a !== null && a !== undefined; + declare const foo: { bar: number }; + foo != null && foo.bar !== false; + `, + ` + declare const foo: { bar: number }; + foo != null && foo.bar !== true; + `, + ` + declare const foo: { bar: number }; + foo != null && foo.bar !== null; + `, + ` + declare const foo: { bar: number }; + foo != null && foo.bar !== undeclaredVar; + `, + ` + declare const foo: { bar: number }; + foo != null && foo.bar != 0; + `, + ` + declare const foo: { bar: number }; + foo != null && foo.bar != 1; + `, + ` + declare const foo: { bar: number }; + foo != null && foo.bar != '123'; + `, + ` + declare const foo: { bar: number }; + foo != null && foo.bar != {}; + `, + ` + declare const foo: { bar: number }; + foo != null && foo.bar != false; + `, + ` + declare const foo: { bar: number }; + foo != null && foo.bar != true; + `, + ` + declare const foo: { bar: number }; + foo != null && foo.bar != undeclaredVar; + `, + ` + declare const foo: { bar: number } | 1; + foo && foo.bar == undeclaredVar; + `, + ` + declare const foo: { bar: number } | 0; + foo != null && foo.bar == undeclaredVar; + `, + ` + declare const foo: { bar: number } | null; + foo && foo.bar == undeclaredVar; + `, + ` + declare const foo: { bar: number } | null; + foo && foo.bar == null; + `, + ` + declare const foo: { bar: number } | null; + foo && foo.bar == undefined; + `, + ` + declare const foo: { bar: number } | null; + foo && foo.bar === undeclaredVar; + `, + ` + declare const foo: { bar: number } | null; + foo && foo.bar === undefined; + `, + ` + declare const foo: { bar: number } | null; + foo && foo.bar !== 0; + `, + ` + declare const foo: { bar: number } | null; + foo && foo.bar !== 1; + `, + ` + declare const foo: { bar: number } | null; + foo && foo.bar !== '123'; + `, + ` + declare const foo: { bar: number } | null; + foo && foo.bar !== {}; + `, + ` + declare const foo: { bar: number } | null; + foo && foo.bar !== false; + `, + ` + declare const foo: { bar: number } | null; + foo && foo.bar !== true; + `, + ` + declare const foo: { bar: number } | null; + foo && foo.bar !== null; + `, + ` + declare const foo: { bar: number } | null; + foo && foo.bar !== undeclaredVar; + `, + ` + declare const foo: { bar: number } | null; + foo != null && foo.bar == undeclaredVar; + `, + ` + declare const foo: { bar: number } | null; + foo != null && foo.bar == null; + `, + ` + declare const foo: { bar: number } | null; + foo != null && foo.bar == undefined; + `, + ` + declare const foo: { bar: number } | null; + foo != null && foo.bar === undeclaredVar; + `, + ` + declare const foo: { bar: number } | null; + foo != null && foo.bar === undefined; + `, + ` + declare const foo: { bar: number } | null; + foo != null && foo.bar !== 0; + `, + ` + declare const foo: { bar: number } | null; + foo != null && foo.bar !== 1; + `, + ` + declare const foo: { bar: number } | null; + foo != null && foo.bar !== '123'; + `, + ` + declare const foo: { bar: number } | null; + foo != null && foo.bar !== {}; + `, + ` + declare const foo: { bar: number } | null; + foo != null && foo.bar !== false; + `, + ` + declare const foo: { bar: number } | null; + foo != null && foo.bar !== true; + `, + ` + declare const foo: { bar: number } | null; + foo != null && foo.bar !== null; + `, + ` + declare const foo: { bar: number } | null; + foo != null && foo.bar !== undeclaredVar; + `, + ` + declare const foo: { bar: number } | null; + foo !== null && foo !== undefined && foo.bar == null; + `, + ` + declare const foo: { bar: number } | null; + foo !== null && foo !== undefined && foo.bar === undefined; + `, + ` + declare const foo: { bar: number } | null; + foo !== null && foo !== undefined && foo.bar !== 1; + `, + ` + declare const foo: { bar: number } | null; + foo !== null && foo !== undefined && foo.bar != 1; + `, + + ` + declare const foo: { bar: number } | undefined; + foo !== null && foo !== undefined && foo.bar == null; + `, + ` + declare const foo: { bar: number } | undefined; + foo !== null && foo !== undefined && foo.bar === undefined; + `, + ` + declare const foo: { bar: number } | undefined; + foo !== null && foo !== undefined && foo.bar !== 1; + `, + ` + declare const foo: { bar: number } | undefined; + foo !== null && foo !== undefined && foo.bar != 1; + `, + ` + declare const foo: { bar: number } | null; + foo !== undefined && foo !== undefined && foo.bar == null; + `, + ` + declare const foo: { bar: number } | null; + foo !== undefined && foo !== undefined && foo.bar === undefined; + `, + ` + declare const foo: { bar: number } | null; + foo !== undefined && foo !== undefined && foo.bar !== 1; + `, + ` + declare const foo: { bar: number } | null; + foo !== undefined && foo !== undefined && foo.bar != 1; + `, + + ` + declare const foo: { bar: number } | undefined; + foo !== undefined && foo !== undefined && foo.bar == null; + `, + ` + declare const foo: { bar: number } | undefined; + foo !== undefined && foo !== undefined && foo.bar === undefined; + `, + ` + declare const foo: { bar: number } | undefined; + foo !== undefined && foo !== undefined && foo.bar !== 1; + `, + ` + declare const foo: { bar: number } | undefined; + foo !== undefined && foo !== undefined && foo.bar != 1; + `, + ` + declare const foo: { bar: number }; + !foo || foo.bar == undeclaredVar; + `, + ` + declare const foo: { bar: number }; + !foo || foo.bar === undeclaredVar; + `, + ` + declare const foo: { bar: number }; + !foo || foo.bar !== undeclaredVar; + `, + ` + declare const foo: { bar: number }; + !foo || foo.bar != null; + `, + ` + declare const foo: { bar: number }; + !foo || foo.bar != undeclaredVar; + `, + '!foo && foo.bar == 0;', + '!foo && foo.bar == 1;', + "!foo && foo.bar == '123';", + '!foo && foo.bar == {};', + '!foo && foo.bar == false;', + '!foo && foo.bar == true;', + '!foo && foo.bar === 0;', + '!foo && foo.bar === 1;', + "!foo && foo.bar === '123';", + '!foo && foo.bar === {};', + '!foo && foo.bar === false;', + '!foo && foo.bar === true;', + '!foo && foo.bar === null;', + '!foo && foo.bar !== undefined;', + '!foo && foo.bar != undefined;', + '!foo && foo.bar != null;', + 'foo == null && foo.bar == 0;', + 'foo == null && foo.bar == 1;', + "foo == null && foo.bar == '123';", + 'foo == null && foo.bar == {};', + 'foo == null && foo.bar == false;', + 'foo == null && foo.bar == true;', + 'foo == null && foo.bar === 0;', + 'foo == null && foo.bar === 1;', + "foo == null && foo.bar === '123';", + 'foo == null && foo.bar === {};', + 'foo == null && foo.bar === false;', + 'foo == null && foo.bar === true;', + 'foo == null && foo.bar === null;', + 'foo == null && foo.bar !== undefined;', + 'foo == null && foo.bar != null;', + 'foo == null && foo.bar != undefined;', + ` + declare const foo: false | { a: string }; + foo && foo.a == undeclaredVar; + `, + ` + declare const foo: '' | { a: string }; + foo && foo.a == undeclaredVar; + `, + ` + declare const foo: 0 | { a: string }; + foo && foo.a == undeclaredVar; + `, + ` + declare const foo: 0n | { a: string }; + foo && foo.a; + `, + '!foo || foo.bar != undeclaredVar;', + '!foo || foo.bar != null;', + '!foo || foo.bar != undefined;', + '!foo || foo.bar === 0;', + '!foo || foo.bar === 1;', + "!foo || foo.bar === '123';", + '!foo || foo.bar === {};', + '!foo || foo.bar === false;', + '!foo || foo.bar === true;', + '!foo || foo.bar === null;', + '!foo || foo.bar === undeclaredVar;', + '!foo || foo.bar == 0;', + '!foo || foo.bar == 1;', + "!foo || foo.bar == '123';", + '!foo || foo.bar == {};', + '!foo || foo.bar == false;', + '!foo || foo.bar == true;', + '!foo || foo.bar == undeclaredVar;', + '!foo || foo.bar !== undeclaredVar;', + '!foo || foo.bar !== undefined;', + ` + declare const foo: { bar: number }; + foo == null || foo.bar == undeclaredVar; + `, + ` + declare const foo: { bar: number }; + foo == null || foo.bar === undeclaredVar; + `, + ` + declare const foo: { bar: number }; + foo == null || foo.bar !== undeclaredVar; + `, + 'foo == null || foo.bar != undeclaredVar;', + 'foo == null || foo.bar != null;', + 'foo == null || foo.bar != undefined;', + 'foo == null || foo.bar === 0;', + 'foo == null || foo.bar === 1;', + "foo == null || foo.bar === '123';", + 'foo == null || foo.bar === {};', + 'foo == null || foo.bar === false;', + 'foo == null || foo.bar === true;', + 'foo == null || foo.bar === null;', + 'foo == null || foo.bar === undeclaredVar;', + 'foo == null || foo.bar == 0;', + 'foo == null || foo.bar == 1;', + "foo == null || foo.bar == '123';", + 'foo == null || foo.bar == {};', + 'foo == null || foo.bar == false;', + 'foo == null || foo.bar == true;', + 'foo == null || foo.bar == undeclaredVar;', + 'foo == null || foo.bar !== undeclaredVar;', + 'foo == null || foo.bar !== undefined;', + 'foo || foo.bar != 0;', + 'foo || foo.bar != 1;', + "foo || foo.bar != '123';", + 'foo || foo.bar != {};', + 'foo || foo.bar != false;', + 'foo || foo.bar != true;', + 'foo || foo.bar === undefined;', + 'foo || foo.bar == undefined;', + 'foo || foo.bar == null;', + 'foo || foo.bar !== 0;', + 'foo || foo.bar !== 1;', + "foo || foo.bar !== '123';", + 'foo || foo.bar !== {};', + 'foo || foo.bar !== false;', + 'foo || foo.bar !== true;', + 'foo || foo.bar !== null;', + 'foo != null || foo.bar != 0;', + 'foo != null || foo.bar != 1;', + "foo != null || foo.bar != '123';", + 'foo != null || foo.bar != {};', + 'foo != null || foo.bar != false;', + 'foo != null || foo.bar != true;', + 'foo != null || foo.bar === undefined;', + 'foo != null || foo.bar == undefined;', + 'foo != null || foo.bar == null;', + 'foo != null || foo.bar !== 0;', + 'foo != null || foo.bar !== 1;', + "foo != null || foo.bar !== '123';", + 'foo != null || foo.bar !== {};', + 'foo != null || foo.bar !== false;', + 'foo != null || foo.bar !== true;', + 'foo != null || foo.bar !== null;', + ` + declare const record: Record; + record['key'] && record['key'].kind !== '1'; + `, + ` + declare const array: { b?: string }[]; + !array[1] || array[1].b === 'foo'; `, ], }); @@ -714,8 +1898,7 @@ describe('hand-crafted cases', () => { { code: 'foo && foo.bar != null && foo.bar.baz !== undefined && foo.bar.baz.buzz;', errors: [{ messageId: 'preferOptionalChain', suggestions: null }], - output: - 'foo?.bar != null && foo.bar.baz !== undefined && foo.bar.baz.buzz;', + output: 'foo?.bar?.baz !== undefined && foo.bar.baz.buzz;', }, { code: ` @@ -726,8 +1909,7 @@ describe('hand-crafted cases', () => { `, errors: [{ messageId: 'preferOptionalChain', suggestions: null }], output: ` - foo.bar?.baz != null && - foo.bar.baz.qux !== undefined && + foo.bar?.baz?.qux !== undefined && foo.bar.baz.qux.buzz; `, }, @@ -956,53 +2138,11 @@ describe('hand-crafted cases', () => { errors: [{ messageId: 'preferOptionalChain', suggestions: null }], output: '!foo.bar!.baz?.paz;', }, - { - code: ` - declare const foo: { bar: string } | null; - foo !== null && foo.bar !== null; - `, - errors: [ - { - messageId: 'preferOptionalChain', - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: ` - declare const foo: { bar: string } | null; - foo?.bar !== null; - `, - }, - ], - }, - ], - output: null, - }, { code: 'foo != null && foo.bar != null;', errors: [{ messageId: 'preferOptionalChain', suggestions: null }], output: 'foo?.bar != null;', }, - { - code: ` - declare const foo: { bar: string | null } | null; - foo != null && foo.bar !== null; - `, - errors: [ - { - messageId: 'preferOptionalChain', - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: ` - declare const foo: { bar: string | null } | null; - foo?.bar !== null; - `, - }, - ], - }, - ], - output: null, - }, { code: ` declare const foo: { bar: string | null } | null; @@ -1515,8 +2655,7 @@ describe('hand-crafted cases', () => { errors: [{ messageId: 'preferOptionalChain', suggestions: null }], options: [ { - allowPotentiallyUnsafeFixesThatModifyTheReturnTypeIKnowWhatImDoing: - true, + allowPotentiallyUnsafeFixesThatModifyTheReturnTypeIKnowWhatImDoing: true, }, ], output: ` @@ -1545,8 +2684,7 @@ describe('hand-crafted cases', () => { ], options: [ { - allowPotentiallyUnsafeFixesThatModifyTheReturnTypeIKnowWhatImDoing: - false, + allowPotentiallyUnsafeFixesThatModifyTheReturnTypeIKnowWhatImDoing: false, }, ], output: null, @@ -1560,8 +2698,7 @@ describe('hand-crafted cases', () => { errors: [{ messageId: 'preferOptionalChain' }], options: [ { - allowPotentiallyUnsafeFixesThatModifyTheReturnTypeIKnowWhatImDoing: - true, + allowPotentiallyUnsafeFixesThatModifyTheReturnTypeIKnowWhatImDoing: true, }, ], output: ` @@ -1680,6 +2817,46 @@ describe('hand-crafted cases', () => { ], output: 'a?.prop;', }, + { + code: ` +declare const foo: { + bar: undefined | (() => void); +}; + +foo.bar && foo.bar(); + `, + errors: [{ messageId: 'preferOptionalChain' }], + output: ` +declare const foo: { + bar: undefined | (() => void); +}; + +foo.bar?.(); + `, + }, + { + code: ` +declare const foo: { bar: string }; + +const baz = foo && foo.bar; + `, + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: ` +declare const foo: { bar: string }; + +const baz = foo?.bar; + `, + }, + ], + }, + ], + options: [{ checkString: false }], + }, ], valid: [ '!a || !b;', @@ -1772,6 +2949,14 @@ describe('hand-crafted cases', () => { '(x || y) != null && (x || y).foo;', // TODO - should we handle this? '(await foo) && (await foo).bar;', + ` + declare const foo: { bar: string } | null; + foo !== null && foo.bar !== null; + `, + ` + declare const foo: { bar: string | null } | null; + foo != null && foo.bar !== null; + `, { code: ` declare const x: string; @@ -1917,6 +3102,10 @@ describe('hand-crafted cases', () => { !x || x.a; `, "typeof globalThis !== 'undefined' && globalThis.Array();", + ` + declare const x: void | (() => void); + x && x(); + `, ], }); }); @@ -1953,13 +3142,15 @@ describe('base cases', () => { }), // but if the type is just `| null` - then it covers the cases and is // a valid conversion - invalid: BaseCases({ - mutateCode: c => c.replaceAll('&&', '!== null &&'), - mutateDeclaration: c => c.replaceAll('| undefined', ''), - mutateOutput: identity, - operator: '&&', - useSuggestionFixer: true, - }), + invalid: [ + ...BaseCases({ + mutateCode: c => c.replaceAll('&&', '!== null &&'), + mutateDeclaration: c => c.replaceAll('| undefined', ''), + mutateOutput: identity, + operator: '&&', + useSuggestionFixer: true, + }), + ], }); }); @@ -1983,16 +3174,58 @@ describe('base cases', () => { mutateCode: c => c.replaceAll('&&', '!== undefined &&'), mutateOutput: identity, operator: '&&', + skipIds: [20, 26], }), // but if the type is just `| undefined` - then it covers the cases and is // a valid conversion - invalid: BaseCases({ - mutateCode: c => c.replaceAll('&&', '!== undefined &&'), - mutateDeclaration: c => c.replaceAll('| null', ''), - mutateOutput: identity, - operator: '&&', - useSuggestionFixer: true, - }), + invalid: [ + ...BaseCases({ + mutateCode: c => c.replaceAll('&&', '!== undefined &&'), + mutateDeclaration: c => c.replaceAll('| null', ''), + mutateOutput: identity, + operator: '&&', + useSuggestionFixer: true, + }), + { + code: ` + declare const foo: { + bar: () => + | { baz: { buzz: (() => number) | null | undefined } | null | undefined } + | null + | undefined; + }; + foo.bar !== undefined && + foo.bar() !== undefined && + foo.bar().baz !== undefined && + foo.bar().baz.buzz !== undefined && + foo.bar().baz.buzz(); + `, + errors: [{ messageId: 'preferOptionalChain' }], + output: ` + declare const foo: { + bar: () => + | { baz: { buzz: (() => number) | null | undefined } | null | undefined } + | null + | undefined; + }; + foo.bar?.() !== undefined && + foo.bar().baz !== undefined && + foo.bar().baz.buzz !== undefined && + foo.bar().baz.buzz(); + `, + }, + { + code: ` + declare const foo: { bar: () => { baz: number } | null | undefined }; + foo.bar !== undefined && foo.bar?.() !== undefined && foo.bar?.().baz; + `, + errors: [{ messageId: 'preferOptionalChain' }], + output: ` + declare const foo: { bar: () => { baz: number } | null | undefined }; + foo.bar?.() !== undefined && foo.bar?.().baz; + `, + }, + ], }); }); @@ -2034,18 +3267,20 @@ describe('base cases', () => { }), // but if the type is just `| null` - then it covers the cases and is // a valid conversion - invalid: BaseCases({ - mutateCode: c => - c - .replaceAll('||', '=== null ||') - // SEE TODO AT THE BOTTOM OF THE RULE - // We need to ensure the final operand is also a "valid" `||` check - .replace(/;$/, ' === null;'), - mutateDeclaration: c => c.replaceAll('| undefined', ''), - mutateOutput: c => c.replace(/;$/, ' === null;'), - operator: '||', - useSuggestionFixer: true, - }), + invalid: [ + ...BaseCases({ + mutateCode: c => + c + .replaceAll('||', '=== null ||') + // SEE TODO AT THE BOTTOM OF THE RULE + // We need to ensure the final operand is also a "valid" `||` check + .replace(/;$/, ' === null;'), + mutateDeclaration: c => c.replaceAll('| undefined', ''), + mutateOutput: c => c.replace(/;$/, ' === null;'), + operator: '||', + useSuggestionFixer: true, + }), + ], }); }); @@ -2073,20 +3308,62 @@ describe('base cases', () => { mutateCode: c => c.replaceAll('||', '=== undefined ||'), mutateOutput: identity, operator: '||', + skipIds: [20, 26], }), // but if the type is just `| undefined` - then it covers the cases and is // a valid conversion - invalid: BaseCases({ - mutateCode: c => - c - .replaceAll('||', '=== undefined ||') - // SEE TODO AT THE BOTTOM OF THE RULE - // We need to ensure the final operand is also a "valid" `||` check - .replace(/;$/, ' === undefined;'), - mutateDeclaration: c => c.replaceAll('| null', ''), - mutateOutput: c => c.replace(/;$/, ' === undefined;'), - operator: '||', - }), + invalid: [ + ...BaseCases({ + mutateCode: c => + c + .replaceAll('||', '=== undefined ||') + // SEE TODO AT THE BOTTOM OF THE RULE + // We need to ensure the final operand is also a "valid" `||` check + .replace(/;$/, ' === undefined;'), + mutateDeclaration: c => c.replaceAll('| null', ''), + mutateOutput: c => c.replace(/;$/, ' === undefined;'), + operator: '||', + }), + { + code: ` + declare const foo: { + bar: () => + | { baz: { buzz: (() => number) | null | undefined } | null | undefined } + | null + | undefined; + }; + foo.bar === undefined || + foo.bar() === undefined || + foo.bar().baz === undefined || + foo.bar().baz.buzz === undefined || + foo.bar().baz.buzz(); + `, + errors: [{ messageId: 'preferOptionalChain' }], + output: ` + declare const foo: { + bar: () => + | { baz: { buzz: (() => number) | null | undefined } | null | undefined } + | null + | undefined; + }; + foo.bar?.() === undefined || + foo.bar().baz === undefined || + foo.bar().baz.buzz === undefined || + foo.bar().baz.buzz(); + `, + }, + { + code: ` + declare const foo: { bar: () => { baz: number } | null | undefined }; + foo.bar === undefined || foo.bar?.() === undefined || foo.bar?.().baz; + `, + errors: [{ messageId: 'preferOptionalChain' }], + output: ` + declare const foo: { bar: () => { baz: number } | null | undefined }; + foo.bar?.() === undefined || foo.bar?.().baz; + `, + }, + ], }); }); diff --git a/packages/eslint-plugin/tests/rules/prefer-promise-reject-errors.test.ts b/packages/eslint-plugin/tests/rules/prefer-promise-reject-errors.test.ts index 09aa8d7e460e..a2ba8d12c801 100644 --- a/packages/eslint-plugin/tests/rules/prefer-promise-reject-errors.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-promise-reject-errors.test.ts @@ -1,18 +1,9 @@ -import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; -import { AST_NODE_TYPES } from '@typescript-eslint/utils'; +import { noFormat } from '@typescript-eslint/rule-tester'; import rule from '../../src/rules/prefer-promise-reject-errors'; -import { getFixturesRootDir } from '../RuleTester'; +import { createRuleTesterWithTypes } from '../RuleTester'; -const rootDir = getFixturesRootDir(); -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootDir, - }, - }, -}); +const ruleTester = createRuleTesterWithTypes(); ruleTester.run('prefer-promise-reject-errors', rule, { valid: [ @@ -320,7 +311,6 @@ ruleTester.run('prefer-promise-reject-errors', rule, { endLine: 1, line: 1, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -333,7 +323,6 @@ ruleTester.run('prefer-promise-reject-errors', rule, { endLine: 1, line: 1, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -346,7 +335,6 @@ ruleTester.run('prefer-promise-reject-errors', rule, { endLine: 1, line: 1, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -359,7 +347,6 @@ ruleTester.run('prefer-promise-reject-errors', rule, { endLine: 1, line: 1, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -372,7 +359,6 @@ ruleTester.run('prefer-promise-reject-errors', rule, { endLine: 1, line: 1, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -385,7 +371,6 @@ ruleTester.run('prefer-promise-reject-errors', rule, { endLine: 1, line: 1, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -398,7 +383,6 @@ ruleTester.run('prefer-promise-reject-errors', rule, { endLine: 1, line: 1, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -411,7 +395,6 @@ ruleTester.run('prefer-promise-reject-errors', rule, { endLine: 1, line: 1, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -424,7 +407,6 @@ ruleTester.run('prefer-promise-reject-errors', rule, { endLine: 1, line: 1, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], options: [{ allowEmptyReject: true }], @@ -438,7 +420,6 @@ ruleTester.run('prefer-promise-reject-errors', rule, { endLine: 1, line: 1, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -451,7 +432,6 @@ ruleTester.run('prefer-promise-reject-errors', rule, { endLine: 1, line: 1, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -464,7 +444,6 @@ ruleTester.run('prefer-promise-reject-errors', rule, { endLine: 1, line: 1, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -480,7 +459,6 @@ Promise.reject(foo); endLine: 3, line: 3, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -496,7 +474,6 @@ Promise.reject(await foo()); endLine: 3, line: 3, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -512,7 +489,6 @@ Promise.reject(foo && new Error()); endLine: 3, line: 3, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -528,7 +504,6 @@ foo.reject(); endLine: 3, line: 3, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -542,7 +517,6 @@ foo.reject(); endLine: 1, line: 1, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -555,7 +529,6 @@ foo.reject(); endLine: 1, line: 1, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -568,7 +541,6 @@ foo.reject(); endLine: 1, line: 1, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -581,7 +553,6 @@ foo.reject(); endLine: 1, line: 1, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -594,7 +565,6 @@ foo.reject(); endLine: 1, line: 1, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -607,7 +577,6 @@ foo.reject(); endLine: 1, line: 1, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -622,7 +591,6 @@ foo.reject(); endLine: 1, line: 1, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -635,7 +603,6 @@ foo.reject(); endLine: 1, line: 1, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -648,7 +615,6 @@ foo.reject(); endLine: 1, line: 1, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -661,7 +627,6 @@ foo.reject(); endLine: 1, line: 1, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -674,7 +639,6 @@ foo.reject(); endLine: 1, line: 1, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -687,7 +651,6 @@ foo.reject(); endLine: 1, line: 1, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -703,7 +666,6 @@ Promise.reject(foo); endLine: 3, line: 3, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -719,7 +681,6 @@ Promise.reject(foo); endLine: 3, line: 3, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -736,7 +697,6 @@ Promise.reject(foo); endLine: 4, line: 4, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -752,7 +712,6 @@ Promise.reject(foo); endLine: 3, line: 3, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -768,7 +727,6 @@ Promise.reject(foo); endLine: 3, line: 3, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -784,7 +742,6 @@ Promise.reject(foo); endLine: 3, line: 3, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -800,7 +757,6 @@ Promise.reject(foo); endLine: 3, line: 3, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -816,7 +772,6 @@ Promise.reject(foo); endLine: 3, line: 3, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -832,7 +787,6 @@ Promise.reject(foo); endLine: 3, line: 3, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -848,7 +802,6 @@ Promise.reject(foo); endLine: 3, line: 3, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -864,7 +817,6 @@ Promise.reject(foo); endLine: 3, line: 3, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -881,7 +833,6 @@ Promise.reject(foo); endLine: 4, line: 4, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -897,7 +848,6 @@ Promise.reject(foo); endLine: 3, line: 3, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -913,7 +863,6 @@ Promise.reject(foo); endLine: 3, line: 3, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -929,7 +878,6 @@ Promise.reject(foo); endLine: 3, line: 3, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -947,7 +895,6 @@ new Promise(function (resolve, reject) { endLine: 3, line: 3, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -964,7 +911,6 @@ new Promise(function (resolve, reject) { endLine: 3, line: 3, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -981,7 +927,6 @@ new Promise((resolve, reject) => { endLine: 3, line: 3, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -994,7 +939,6 @@ new Promise((resolve, reject) => { endLine: 1, line: 1, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -1014,7 +958,6 @@ new Promise((resolve, reject) => { endLine: 4, line: 4, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -1027,7 +970,6 @@ new Promise((resolve, reject) => { endLine: 1, line: 1, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -1040,7 +982,6 @@ new Promise((resolve, reject) => { endLine: 1, line: 1, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -1057,7 +998,6 @@ new Promise(function (reject, reject) { endLine: 3, line: 3, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -1074,7 +1014,6 @@ new Promise(function (foo, arguments) { endLine: 3, line: 3, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -1087,7 +1026,6 @@ new Promise(function (foo, arguments) { endLine: 1, line: 1, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -1104,7 +1042,6 @@ new Promise(function ({}, reject) { endLine: 3, line: 3, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -1117,7 +1054,6 @@ new Promise(function ({}, reject) { endLine: 1, line: 1, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -1130,7 +1066,6 @@ new Promise(function ({}, reject) { endLine: 1, line: 1, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -1148,7 +1083,6 @@ new foo.bar((resolve, reject) => reject(5)); endLine: 5, line: 5, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -1166,7 +1100,6 @@ new (foo?.bar)((resolve, reject) => reject(5)); endLine: 5, line: 5, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -1182,7 +1115,6 @@ new foo((resolve, reject) => reject(5)); endLine: 3, line: 3, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -1198,7 +1130,6 @@ new Promise((resolve, reject) => reject(foo)); endLine: 3, line: 3, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -1214,7 +1145,6 @@ new Promise((resolve, reject) => reject(foo)); endLine: 3, line: 3, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -1231,7 +1161,6 @@ new Promise((resolve, reject) => reject(foo)); endLine: 4, line: 4, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -1247,7 +1176,6 @@ new Promise((resolve, reject) => reject(foo)); endLine: 3, line: 3, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -1263,7 +1191,6 @@ new Promise((resolve, reject) => reject(foo)); endLine: 3, line: 3, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -1279,7 +1206,6 @@ new Promise((resolve, reject) => reject(foo)); endLine: 3, line: 3, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -1295,7 +1221,6 @@ new Promise((resolve, reject) => reject(foo)); endLine: 3, line: 3, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -1311,7 +1236,6 @@ new Promise((resolve, reject) => reject(foo)); endLine: 3, line: 3, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -1327,7 +1251,6 @@ new Promise((resolve, reject) => reject(foo)); endLine: 3, line: 3, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -1343,7 +1266,6 @@ new Promise((resolve, reject) => reject(foo)); endLine: 3, line: 3, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -1359,7 +1281,6 @@ new Promise((resolve, reject) => reject(foo)); endLine: 3, line: 3, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -1376,7 +1297,6 @@ new Promise((resolve, reject) => reject(foo)); endLine: 4, line: 4, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -1392,7 +1312,6 @@ new Promise((resolve, reject) => reject(foo)); endLine: 3, line: 3, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -1408,7 +1327,6 @@ new Promise((resolve, reject) => reject(foo)); endLine: 3, line: 3, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -1424,7 +1342,6 @@ new Promise((resolve, reject) => reject(foo)); endLine: 3, line: 3, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -1440,7 +1357,6 @@ Foo.reject(5); endLine: 3, line: 3, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -1456,7 +1372,6 @@ foo.reject(5); endLine: 3, line: 3, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -1473,7 +1388,6 @@ Bar.reject(5); endLine: 4, line: 4, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -1491,7 +1405,6 @@ function fun(t: T): void { endLine: 4, line: 4, messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -1503,7 +1416,6 @@ function fun(t: T): void { errors: [ { messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], options: [{ allowThrowingAny: false, allowThrowingUnknown: true }], @@ -1516,7 +1428,6 @@ function fun(t: T): void { errors: [ { messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], options: [{ allowThrowingAny: true, allowThrowingUnknown: false }], @@ -1529,7 +1440,6 @@ function fun(t: T): void { errors: [ { messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, @@ -1541,7 +1451,6 @@ function fun(t: T): void { errors: [ { messageId: 'rejectAnError', - type: AST_NODE_TYPES.CallExpression, }, ], }, 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 12df0c7928c3..4cc30efb6b26 100644 --- a/packages/eslint-plugin/tests/rules/prefer-readonly-parameter-types.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-readonly-parameter-types.test.ts @@ -1,80 +1,29 @@ -import type { InvalidTestCase } from '@typescript-eslint/rule-tester'; - -import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; +import { noFormat } from '@typescript-eslint/rule-tester'; import * as path from 'node:path'; -import type { - InferMessageIdsTypeFromRule, - InferOptionsTypeFromRule, -} from '../../src/util'; - import rule from '../../src/rules/prefer-readonly-parameter-types'; import { readonlynessOptionsDefaults } from '../../src/util'; -import { dedupeTestCases } from '../dedupeTestCases'; -import { getFixturesRootDir } from '../RuleTester'; - -type MessageIds = InferMessageIdsTypeFromRule; -type Options = InferOptionsTypeFromRule; +import { createRuleTesterWithTypes } from '../RuleTester'; -const rootPath = getFixturesRootDir(); - -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootPath, - }, - }, -}); - -const primitives = [ - 'boolean', - 'true', - 'string', - "'a'", - 'number', - '1', - 'symbol', - 'any', - 'unknown', - 'never', - 'null', - 'undefined', -]; -const arrays = [ - 'readonly string[]', - 'Readonly', - 'ReadonlyArray', - 'readonly [string]', - 'Readonly<[string]>', -]; -const objects = [ - '{ foo: "" }', - '{ foo: readonly string[] }', - '{ foo(): void }', -]; -const weirdIntersections = [ - ` - interface Test { - (): void - readonly property: boolean - } - function foo(arg: Test) {} - `, - ` - type Test = (() => void) & { - readonly property: boolean - }; - function foo(arg: Test) {} - `, -]; +const ruleTester = createRuleTesterWithTypes(); ruleTester.run('prefer-readonly-parameter-types', rule, { valid: [ 'function foo() {}', // primitives - ...primitives.map(type => `function foo(arg: ${type}) {}`), + 'function foo(arg: boolean) {}', + 'function foo(arg: true) {}', + 'function foo(arg: string) {}', + "function foo(arg: 'a') {}", + 'function foo(arg: number) {}', + 'function foo(arg: 1) {}', + 'function foo(arg: symbol) {}', + 'function foo(arg: any) {}', + 'function foo(arg: unknown) {}', + 'function foo(arg: never) {}', + 'function foo(arg: null) {}', + 'function foo(arg: undefined) {}', ` const symb = Symbol('a'); function foo(arg: typeof symb) {} @@ -88,7 +37,12 @@ ruleTester.run('prefer-readonly-parameter-types', rule, { `, // arrays - ...arrays.map(type => `function foo(arg: ${type}) {}`), + 'function foo(arg: readonly string[]) {}', + 'function foo(arg: Readonly) {}', + 'function foo(arg: ReadonlyArray) {}', + 'function foo(arg: readonly [string]) {}', + 'function foo(arg: Readonly<[string]>) {}', + // nested arrays 'function foo(arg: readonly (readonly string[])[]) {}', 'function foo(arg: Readonly[]>) {}', @@ -104,7 +58,9 @@ ruleTester.run('prefer-readonly-parameter-types', rule, { 'function foo(arg: ReadonlyArray | ReadonlyArray) {}', // objects - ...objects.map(type => `function foo(arg: Readonly<${type}>) {}`), + "function foo(arg: Readonly<{ foo: '' }>) {}", + 'function foo(arg: Readonly<{ foo: readonly string[] }>) {}', + 'function foo(arg: Readonly<{ foo(): void }>) {}', ` function foo(arg: { readonly foo: { @@ -124,7 +80,19 @@ ruleTester.run('prefer-readonly-parameter-types', rule, { `, // weird other cases - ...weirdIntersections.map(code => code), + ` +interface Test { + (): void; + readonly property: boolean; +} +function foo(arg: Test) {} + `, + ` +type Test = (() => void) & { + readonly property: boolean; +}; +function foo(arg: Test) {} + `, ` interface Test extends ReadonlyArray { readonly property: boolean; @@ -343,6 +311,114 @@ ruleTester.run('prefer-readonly-parameter-types', rule, { const willNotCrash = (foo: Readonly) => {}; `, + ` +type TaggedBigInt = bigint & { + readonly __tag: unique symbol; +}; +function custom1(arg: TaggedBigInt) {} + `, + ` +type TaggedNumber = number & { + readonly __tag: unique symbol; +}; +function custom1(arg: TaggedNumber) {} + `, + ` +type TaggedString = string & { + readonly __tag: unique symbol; +}; +function custom1(arg: TaggedString) {} + `, + ` +type TaggedString = string & { + readonly __tagA: unique symbol; + readonly __tagB: unique symbol; +}; +function custom1(arg: TaggedString) {} + `, + ` +type TaggedString = string & { + readonly __tag: unique symbol; +}; + +type OtherSpecialString = string & { + readonly ' __other_tag': unique symbol; +}; + +function custom1(arg: TaggedString | OtherSpecialString) {} + `, + ` +type TaggedTemplateLiteral = \`\${string}-\${string}\` & { + readonly __tag: unique symbol; +}; +function custom1(arg: TaggedTemplateLiteral) {} + `, + ` +type TaggedNumber = 1 & { + readonly __tag: unique symbol; +}; + +function custom1(arg: TaggedNumber) {} + `, + ` +type TaggedNumber = (1 | 2) & { + readonly __tag: unique symbol; +}; + +function custom1(arg: TaggedNumber) {} + `, + ` +type TaggedString = ('a' | 'b') & { + readonly __tag: unique symbol; +}; + +function custom1(arg: TaggedString) {} + `, + ` +type Strings = 'one' | 'two' | 'three'; + +type TaggedString = Strings & { + readonly __tag: unique symbol; +}; + +function custom1(arg: TaggedString) {} + `, + ` +type Strings = 'one' | 'two' | 'three'; + +type TaggedString = Strings & { + __tag: unique symbol; +}; + +function custom1(arg: TaggedString) {} + `, + ` +type TaggedString = string & { + __tag: unique symbol; +} & { + __tag: unique symbol; +}; +function custom1(arg: TaggedString) {} + `, + ` +type TaggedString = string & { + __tagA: unique symbol; +} & { + __tagB: unique symbol; +}; +function custom1(arg: TaggedString) {} + `, + ` +type TaggedString = string & + ({ __tag: unique symbol } | { __tag: unique symbol }); +function custom1(arg: TaggedString) {} + `, + ` +type TaggedFunction = (() => void) & { + readonly __tag: unique symbol; +}; +function custom1(arg: TaggedFunction) {} + `, { code: ` type Callback = (options: T) => void; @@ -480,24 +556,36 @@ ruleTester.run('prefer-readonly-parameter-types', rule, { invalid: [ // arrays // Removing readonly causes duplicates - ...dedupeTestCases( - arrays.map>(baseType => { - const type = baseType - .replaceAll('readonly ', '') - .replaceAll(/Readonly<(.+?)>/g, '$1') - .replaceAll('ReadonlyArray', 'Array'); - return { - code: `function foo(arg: ${type}) {}`, - errors: [ - { - column: 14, - endColumn: 19 + type.length, - messageId: 'shouldBeReadonly', - }, - ], - }; - }), - ), + { + code: 'function foo(arg: string[]) {}', + errors: [ + { + column: 14, + endColumn: 27, + messageId: 'shouldBeReadonly', + }, + ], + }, + { + code: 'function foo(arg: Array) {}', + errors: [ + { + column: 14, + endColumn: 32, + messageId: 'shouldBeReadonly', + }, + ], + }, + { + code: 'function foo(arg: [string]) {}', + errors: [ + { + column: 14, + endColumn: 27, + messageId: 'shouldBeReadonly', + }, + ], + }, // nested arrays { code: 'function foo(arg: readonly string[][]) {}', @@ -531,18 +619,36 @@ ruleTester.run('prefer-readonly-parameter-types', rule, { }, // objects - ...objects.map>(type => { - return { - code: `function foo(arg: ${type}) {}`, - errors: [ - { - column: 14, - endColumn: 19 + type.length, - messageId: 'shouldBeReadonly', - }, - ], - }; - }), + { + code: "function foo(arg: { foo: '' }) {}", + errors: [ + { + column: 14, + endColumn: 30, + messageId: 'shouldBeReadonly', + }, + ], + }, + { + code: 'function foo(arg: { foo: readonly string[] }) {}', + errors: [ + { + column: 14, + endColumn: 45, + messageId: 'shouldBeReadonly', + }, + ], + }, + { + code: 'function foo(arg: { foo(): void }) {}', + errors: [ + { + column: 14, + endColumn: 34, + messageId: 'shouldBeReadonly', + }, + ], + }, { code: ` function foo(arg: { @@ -592,15 +698,41 @@ ruleTester.run('prefer-readonly-parameter-types', rule, { }, // weird intersections - ...weirdIntersections.map>( - baseCode => { - const code = baseCode.replaceAll('readonly ', ''); - return { - code, - errors: [{ messageId: 'shouldBeReadonly' }], - }; - }, - ), + { + code: ` +interface Test { + (): void; + property: boolean; +} +function foo(arg: Test) {} + `, + errors: [ + { + column: 14, + endColumn: 23, + endLine: 6, + line: 6, + messageId: 'shouldBeReadonly', + }, + ], + }, + { + code: ` +type Test = (() => void) & { + property: boolean; +}; +function foo(arg: Test) {} + `, + errors: [ + { + column: 14, + endColumn: 23, + endLine: 5, + line: 5, + messageId: 'shouldBeReadonly', + }, + ], + }, { code: ` interface Test extends Array { @@ -876,6 +1008,23 @@ ruleTester.run('prefer-readonly-parameter-types', rule, { }, ], }, + { + code: ` +class ClassExample {} +type Test = typeof ClassExample & { + readonly property: boolean; +}; +function foo(arg: Test) {} + `, + errors: [ + { + column: 14, + endColumn: 23, + line: 6, + messageId: 'shouldBeReadonly', + }, + ], + }, { code: ` const sym = Symbol('sym'); diff --git a/packages/eslint-plugin/tests/rules/prefer-readonly.test.ts b/packages/eslint-plugin/tests/rules/prefer-readonly.test.ts index 1e2289d65d1e..4b85f6ae7240 100644 --- a/packages/eslint-plugin/tests/rules/prefer-readonly.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-readonly.test.ts @@ -1,17 +1,7 @@ -import { RuleTester } from '@typescript-eslint/rule-tester'; - import rule from '../../src/rules/prefer-readonly'; -import { getFixturesRootDir } from '../RuleTester'; +import { createRuleTesterWithTypes } from '../RuleTester'; -const rootDir = getFixturesRootDir(); -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootDir, - }, - }, -}); +const ruleTester = createRuleTesterWithTypes(); ruleTester.run('prefer-readonly', rule, { valid: [ 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 f26ccb53350f..a158bfa685fb 100644 --- a/packages/eslint-plugin/tests/rules/prefer-reduce-type-parameter.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-reduce-type-parameter.test.ts @@ -1,18 +1,7 @@ -import { RuleTester } from '@typescript-eslint/rule-tester'; - import rule from '../../src/rules/prefer-reduce-type-parameter'; -import { getFixturesRootDir } from '../RuleTester'; - -const rootPath = getFixturesRootDir(); +import { createRuleTesterWithTypes } from '../RuleTester'; -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootPath, - }, - }, -}); +const ruleTester = createRuleTesterWithTypes(); ruleTester.run('prefer-reduce-type-parameter', rule, { valid: [ 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 e107208a9a3d..c5a501f69887 100644 --- a/packages/eslint-plugin/tests/rules/prefer-regexp-exec.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-regexp-exec.test.ts @@ -1,18 +1,7 @@ -import { RuleTester } from '@typescript-eslint/rule-tester'; - import rule from '../../src/rules/prefer-regexp-exec'; -import { getFixturesRootDir } from '../RuleTester'; - -const rootPath = getFixturesRootDir(); +import { createRuleTesterWithTypes } from '../RuleTester'; -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootPath, - }, - }, -}); +const ruleTester = createRuleTesterWithTypes(); ruleTester.run('prefer-regexp-exec', rule, { valid: [ diff --git a/packages/eslint-plugin/tests/rules/prefer-return-this-type.test.ts b/packages/eslint-plugin/tests/rules/prefer-return-this-type.test.ts index 5b372350059f..df31a2c9f987 100644 --- a/packages/eslint-plugin/tests/rules/prefer-return-this-type.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-return-this-type.test.ts @@ -1,18 +1,7 @@ -import { RuleTester } from '@typescript-eslint/rule-tester'; - import rule from '../../src/rules/prefer-return-this-type'; -import { getFixturesRootDir } from '../RuleTester'; +import { createRuleTesterWithTypes } from '../RuleTester'; -const rootPath = getFixturesRootDir(); - -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootPath, - }, - }, -}); +const ruleTester = createRuleTesterWithTypes(); ruleTester.run('prefer-return-this-type', rule, { valid: [ @@ -98,6 +87,19 @@ class Foo { ` class Foo { f?: string; +} + `, + ` +declare const valueUnion: BaseUnion | string; + +class BaseUnion { + f(): BaseUnion | string { + if (Math.random()) { + return this; + } + + return valueUnion; + } } `, ], @@ -395,6 +397,42 @@ class Animal { console.log("I'm moving!"); return this; } +} + `, + }, + { + code: ` +declare const valueUnion: number | string; + +class BaseUnion { + f(): BaseUnion | string { + if (Math.random()) { + return this; + } + + return valueUnion; + } +} + `, + errors: [ + { + column: 8, + endColumn: 17, + line: 5, + messageId: 'useThisType', + }, + ], + output: ` +declare const valueUnion: number | string; + +class BaseUnion { + f(): this | string { + if (Math.random()) { + return this; + } + + return valueUnion; + } } `, }, 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 798d26cb3916..1b6a91ea03b2 100644 --- a/packages/eslint-plugin/tests/rules/prefer-string-starts-ends-with.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-string-starts-ends-with.test.ts @@ -1,18 +1,9 @@ -import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; +import { noFormat } from '@typescript-eslint/rule-tester'; import rule from '../../src/rules/prefer-string-starts-ends-with'; -import { getFixturesRootDir } from '../RuleTester'; +import { createRuleTesterWithTypes } from '../RuleTester'; -const rootPath = getFixturesRootDir(); - -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootPath, - }, - }, -}); +const ruleTester = createRuleTesterWithTypes(); ruleTester.run('prefer-string-starts-ends-with', rule, { valid: [ 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 2b6ddbdb9870..c922c0f1024f 100644 --- a/packages/eslint-plugin/tests/rules/promise-function-async.test.ts +++ b/packages/eslint-plugin/tests/rules/promise-function-async.test.ts @@ -1,18 +1,9 @@ -import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; +import { noFormat } from '@typescript-eslint/rule-tester'; import rule from '../../src/rules/promise-function-async'; -import { getFixturesRootDir } from '../RuleTester'; +import { createRuleTesterWithTypes } from '../RuleTester'; -const rootDir = getFixturesRootDir(); - -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootDir, - }, - }, -}); +const ruleTester = createRuleTesterWithTypes(); ruleTester.run('promise-function-async', rule, { valid: [ @@ -156,11 +147,6 @@ function foo(): Promise | boolean { code: ` abstract class Test { abstract test1(): Promise; - - // abstract method with body is always an error but it still parses into valid AST - abstract test2(): Promise { - return Promise.resolve(1); - } } `, }, @@ -227,6 +213,26 @@ function overloadingThatIncludeAny(a?: boolean): any | number { `, options: [{ allowAny: true }], }, + ` +class Base { + async foo() { + return Promise.resolve(42); + } +} + +class Derived extends Base { + override async foo() { + return Promise.resolve(2000); + } +} + `, + ` +class Test { + public override async method() { + return Promise.resolve(1); + } +} + `, ], invalid: [ { @@ -947,5 +953,62 @@ function overloadingThatIncludeUnknown(a?: boolean): unknown | number { ], options: [{ allowAny: false }], }, + // https://github.com/typescript-eslint/typescript-eslint/issues/11729 + { + code: ` +class Base { + async foo() { + return Promise.resolve(42); + } +} + +class Derived extends Base { + override foo() { + return Promise.resolve(2000); + } +} + `, + errors: [ + { + line: 9, + messageId: 'missingAsync', + }, + ], + output: ` +class Base { + async foo() { + return Promise.resolve(42); + } +} + +class Derived extends Base { + override async foo() { + return Promise.resolve(2000); + } +} + `, + }, + { + code: ` +class Test { + public override method() { + return Promise.resolve(1); + } +} + `, + errors: [ + { + line: 3, + messageId: 'missingAsync', + }, + ], + output: ` +class Test { + public override async method() { + return Promise.resolve(1); + } +} + `, + }, ], }); diff --git a/packages/eslint-plugin/tests/rules/related-getter-setter-pairs.test.ts b/packages/eslint-plugin/tests/rules/related-getter-setter-pairs.test.ts index ec7e22385052..e31e9b1cde0e 100644 --- a/packages/eslint-plugin/tests/rules/related-getter-setter-pairs.test.ts +++ b/packages/eslint-plugin/tests/rules/related-getter-setter-pairs.test.ts @@ -1,17 +1,7 @@ -import { RuleTester } from '@typescript-eslint/rule-tester'; - import rule from '../../src/rules/related-getter-setter-pairs'; -import { getFixturesRootDir } from '../RuleTester'; +import { createRuleTesterWithTypes } from '../RuleTester'; -const rootDir = getFixturesRootDir(); -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootDir, - }, - }, -}); +const ruleTester = createRuleTesterWithTypes(); ruleTester.run('related-getter-setter-pairs', rule, { valid: [ diff --git a/packages/eslint-plugin/tests/rules/require-array-sort-compare.test.ts b/packages/eslint-plugin/tests/rules/require-array-sort-compare.test.ts index d4735efe231d..786c321194f1 100644 --- a/packages/eslint-plugin/tests/rules/require-array-sort-compare.test.ts +++ b/packages/eslint-plugin/tests/rules/require-array-sort-compare.test.ts @@ -1,18 +1,7 @@ -import { RuleTester } from '@typescript-eslint/rule-tester'; - import rule from '../../src/rules/require-array-sort-compare'; -import { getFixturesRootDir } from '../RuleTester'; - -const rootPath = getFixturesRootDir(); +import { createRuleTesterWithTypes } from '../RuleTester'; -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootPath, - }, - }, -}); +const ruleTester = createRuleTesterWithTypes(); ruleTester.run('require-array-sort-compare', rule, { valid: [ diff --git a/packages/eslint-plugin/tests/rules/require-await.test.ts b/packages/eslint-plugin/tests/rules/require-await.test.ts index d9fca8c12f61..4fc229f27295 100644 --- a/packages/eslint-plugin/tests/rules/require-await.test.ts +++ b/packages/eslint-plugin/tests/rules/require-await.test.ts @@ -1,18 +1,9 @@ -import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; +import { noFormat } from '@typescript-eslint/rule-tester'; import rule from '../../src/rules/require-await'; -import { getFixturesRootDir } from '../RuleTester'; +import { createRuleTesterWithTypes } from '../RuleTester'; -const rootDir = getFixturesRootDir(); - -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootDir, - }, - }, -}); +const ruleTester = createRuleTesterWithTypes(); ruleTester.run('require-await', rule, { valid: [ 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 d1bf99b34800..a60f49e09f86 100644 --- a/packages/eslint-plugin/tests/rules/restrict-plus-operands.test.ts +++ b/packages/eslint-plugin/tests/rules/restrict-plus-operands.test.ts @@ -1,18 +1,7 @@ -import { RuleTester } from '@typescript-eslint/rule-tester'; - import rule from '../../src/rules/restrict-plus-operands'; -import { getFixturesRootDir } from '../RuleTester'; - -const rootPath = getFixturesRootDir(); +import { createRuleTesterWithTypes } from '../RuleTester'; -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootPath, - }, - }, -}); +const ruleTester = createRuleTesterWithTypes(); ruleTester.run('restrict-plus-operands', rule, { valid: [ 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 e43335aecd04..aa88c8276cdf 100644 --- a/packages/eslint-plugin/tests/rules/restrict-template-expressions.test.ts +++ b/packages/eslint-plugin/tests/rules/restrict-template-expressions.test.ts @@ -1,18 +1,7 @@ -import { RuleTester } from '@typescript-eslint/rule-tester'; - import rule from '../../src/rules/restrict-template-expressions'; -import { getFixturesRootDir } from '../RuleTester'; - -const rootPath = getFixturesRootDir(); +import { createRuleTesterWithTypes } from '../RuleTester'; -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootPath, - }, - }, -}); +const ruleTester = createRuleTesterWithTypes(); ruleTester.run('restrict-template-expressions', rule, { valid: [ diff --git a/packages/eslint-plugin/tests/rules/return-await.test.ts b/packages/eslint-plugin/tests/rules/return-await.test.ts index 9a44a5954d66..33f3f330e92a 100644 --- a/packages/eslint-plugin/tests/rules/return-await.test.ts +++ b/packages/eslint-plugin/tests/rules/return-await.test.ts @@ -1,20 +1,11 @@ import type { InvalidTestCase } from '@typescript-eslint/rule-tester'; -import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; +import { noFormat } from '@typescript-eslint/rule-tester'; import rule from '../../src/rules/return-await'; -import { getFixturesRootDir } from '../RuleTester'; +import { createRuleTesterWithTypes } from '../RuleTester'; -const rootDir = getFixturesRootDir(); - -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootDir, - }, - }, -}); +const ruleTester = createRuleTesterWithTypes(); // default rule is in-try-catch ruleTester.run('return-await', rule, { 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 87bade1d7fc3..5f451c3f07e4 100644 --- a/packages/eslint-plugin/tests/rules/strict-boolean-expressions.test.ts +++ b/packages/eslint-plugin/tests/rules/strict-boolean-expressions.test.ts @@ -1,25 +1,11 @@ -/* eslint-disable @typescript-eslint/no-deprecated -- TODO - migrate this test away from `batchedSingleLineTests` */ - -import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; +import { noFormat } from '@typescript-eslint/rule-tester'; import * as path from 'node:path'; -import type { - MessageId, - Options, -} from '../../src/rules/strict-boolean-expressions'; - import rule from '../../src/rules/strict-boolean-expressions'; -import { batchedSingleLineTests, getFixturesRootDir } from '../RuleTester'; +import { createRuleTesterWithTypes, getFixturesRootDir } from '../RuleTester'; -const rootPath = getFixturesRootDir(); -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootPath, - }, - }, -}); +const rootDir = getFixturesRootDir(); +const ruleTester = createRuleTesterWithTypes(); ruleTester.run('strict-boolean-expressions', rule, { valid: [ @@ -392,7 +378,7 @@ if (x) { `, languageOptions: { parserOptions: { - tsconfigRootDir: path.join(rootPath, 'unstrict'), + tsconfigRootDir: path.join(rootDir, 'unstrict'), }, }, options: [ @@ -645,67 +631,99 @@ declare function f(x: string | null): boolean; invalid: [ // non-boolean in RHS of test expression - ...batchedSingleLineTests({ - code: noFormat` - if (true && (1 + 1)) {} - while (false || "a" + "b") {} - (x: object) => true || false || x ? true : false; + { + code: ` +if (true && 1 + 1) { +} `, errors: [ { - column: 14, - data: { - context: 'conditional', - }, + column: 13, + data: { context: 'conditional' }, line: 2, messageId: 'conditionErrorNumber', suggestions: [ { messageId: 'conditionFixCompareZero', - output: 'if (true && ((1 + 1) !== 0)) {}', + output: ` +if (true && ((1 + 1) !== 0)) { +} + `, }, { messageId: 'conditionFixCompareNaN', - output: 'if (true && (!Number.isNaN((1 + 1)))) {}', + output: ` +if (true && (!Number.isNaN((1 + 1)))) { +} + `, }, { messageId: 'conditionFixCastBoolean', - output: 'if (true && (Boolean((1 + 1)))) {}', + output: ` +if (true && (Boolean((1 + 1)))) { +} + `, }, ], }, + ], + options: [ { - column: 25, - line: 3, + allowNullableObject: false, + allowNumber: false, + allowString: false, + }, + ], + }, + { + code: "while (false || 'a' + 'b') {}", + errors: [ + { + column: 17, + line: 1, messageId: 'conditionErrorString', suggestions: [ { messageId: 'conditionFixCompareStringLength', - output: ' while (false || (("a" + "b").length > 0)) {}', + output: "while (false || (('a' + 'b').length > 0)) {}", }, { messageId: 'conditionFixCompareEmptyString', - output: ' while (false || (("a" + "b") !== "")) {}', + output: `while (false || (('a' + 'b') !== "")) {}`, }, { messageId: 'conditionFixCastBoolean', - output: ' while (false || (Boolean(("a" + "b")))) {}', + output: "while (false || (Boolean(('a' + 'b')))) {}", }, ], }, + ], + options: [ { - column: 41, - data: { - context: 'conditional', - }, - line: 4, + allowNullableObject: false, + allowNumber: false, + allowString: false, + }, + ], + }, + { + code: '(x: object) => (true || false || x ? true : false);', + errors: [ + { + column: 34, + data: { context: 'conditional' }, + line: 1, messageId: 'conditionErrorObject', }, ], options: [ - { allowNullableObject: false, allowNumber: false, allowString: false }, + { + allowNullableObject: false, + allowNumber: false, + allowString: false, + }, ], - }), + }, // check if all and only the outermost operands are checked { @@ -1538,404 +1556,632 @@ if (((Boolean('')) && {}) || (foo && void 0)) { } }, // nullish in boolean context - ...batchedSingleLineTests({ - code: noFormat` - null || {}; - undefined && []; - declare const x: null; if (x) {} - (x: undefined) => !x; - (x: T) => x ? 1 : 0; - (x: T) => x ? 1 : 0; - (x: T) => x ? 1 : 0; + { + code: 'null || {};', + errors: [ + { + column: 1, + line: 1, + messageId: 'conditionErrorNullish', + }, + ], + }, + { + code: 'undefined && [];', + errors: [ + { + column: 1, + line: 1, + messageId: 'conditionErrorNullish', + }, + ], + }, + { + code: ` +declare const x: null; +if (x) { +} `, errors: [ - { column: 1, line: 2, messageId: 'conditionErrorNullish' }, - { column: 9, line: 3, messageId: 'conditionErrorNullish' }, - { column: 36, line: 4, messageId: 'conditionErrorNullish' }, - { column: 28, line: 5, messageId: 'conditionErrorNullish' }, - { column: 47, line: 6, messageId: 'conditionErrorNullish' }, - { column: 35, line: 7, messageId: 'conditionErrorNullish' }, - { column: 40, line: 8, messageId: 'conditionErrorNullish' }, - ], - }), + { + column: 5, + line: 3, + messageId: 'conditionErrorNullish', + }, + ], + }, + { + code: '(x: undefined) => !x;', + errors: [ + { + column: 20, + line: 1, + messageId: 'conditionErrorNullish', + }, + ], + }, + { + code: '(x: T) => (x ? 1 : 0);', + errors: [ + { + column: 40, + line: 1, + messageId: 'conditionErrorNullish', + }, + ], + }, + { + code: '(x: T) => (x ? 1 : 0);', + errors: [ + { + column: 28, + line: 1, + messageId: 'conditionErrorNullish', + }, + ], + }, + { + code: '(x: T) => (x ? 1 : 0);', + errors: [ + { + column: 33, + line: 1, + messageId: 'conditionErrorNullish', + }, + ], + }, // object in boolean context - ...batchedSingleLineTests({ - code: noFormat` - [] || 1; - ({}) && "a"; - 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; - `, + { + code: '[] || 1;', errors: [ { column: 1, data: { context: 'conditional', }, - line: 2, + line: 1, messageId: 'conditionErrorObject', }, + ], + }, + { + code: "({}) && 'a';", + errors: [ { - column: 10, + column: 2, data: { context: 'conditional', }, - line: 3, + line: 1, messageId: 'conditionErrorObject', }, + ], + }, + { + code: ` +declare const x: symbol; +if (x) { +} + `, + errors: [ { - column: 38, + column: 5, data: { context: 'conditional', }, - line: 4, + line: 3, messageId: 'conditionErrorObject', }, + ], + }, + { + code: '(x: () => void) => !x;', + errors: [ { - column: 29, + column: 21, data: { context: 'conditional', }, - line: 5, + line: 1, messageId: 'conditionErrorObject', }, + ], + }, + { + code: '(x: T) => (x ? 1 : 0);', + errors: [ { - column: 37, + column: 30, data: { context: 'conditional', }, - line: 6, + line: 1, messageId: 'conditionErrorObject', }, + ], + }, + { + code: '(x: T) => (x ? 1 : 0);', + errors: [ { - column: 48, + column: 41, data: { context: 'conditional', }, - line: 7, + line: 1, messageId: 'conditionErrorObject', }, + ], + }, + { + code: '(x: T) => (x ? 1 : 0);', + errors: [ { - column: 44, + column: 37, data: { context: 'conditional', }, - line: 8, + line: 1, messageId: 'conditionErrorObject', }, + ], + }, + { + code: ' void>(x: T) => (x ? 1 : 0);', + errors: [ { - column: 41, + column: 34, data: { context: 'conditional', }, - line: 9, + line: 1, messageId: 'conditionErrorObject', }, ], - }), + }, // string in boolean context - ...batchedSingleLineTests({ - code: noFormat` - while ("") {} - for (; "foo";) {} - declare const x: string; if (x) {} - (x: string) => (!x); - (x: T) => x ? 1 : 0; - `, + { + code: "while ('') {}", errors: [ { column: 8, data: { context: 'conditional', }, - line: 2, + line: 1, messageId: 'conditionErrorString', suggestions: [ { messageId: 'conditionFixCompareStringLength', - output: `while ("".length > 0) {}`, + output: "while (''.length > 0) {}", }, { messageId: 'conditionFixCompareEmptyString', - output: `while ("" !== "") {}`, + output: `while ('' !== "") {}`, }, { messageId: 'conditionFixCastBoolean', - output: `while (Boolean("")) {}`, + output: "while (Boolean('')) {}", }, ], }, + ], + options: [ { - column: 16, + allowString: false, + }, + ], + }, + { + code: "for (; 'foo'; ) {}", + errors: [ + { + column: 8, data: { context: 'conditional', }, - line: 3, + line: 1, messageId: 'conditionErrorString', suggestions: [ { messageId: 'conditionFixCompareStringLength', - output: ` for (; "foo".length > 0;) {}`, + output: "for (; 'foo'.length > 0; ) {}", }, { messageId: 'conditionFixCompareEmptyString', - output: ` for (; "foo" !== "";) {}`, + output: `for (; 'foo' !== ""; ) {}`, }, { messageId: 'conditionFixCastBoolean', - output: ` for (; Boolean("foo");) {}`, + output: "for (; Boolean('foo'); ) {}", }, ], }, + ], + options: [ + { + allowString: false, + }, + ], + }, + { + code: ` +declare const x: string; +if (x) { +} + `, + errors: [ { - column: 38, + column: 5, data: { context: 'conditional', }, - line: 4, + line: 3, messageId: 'conditionErrorString', suggestions: [ { messageId: 'conditionFixCompareStringLength', - output: ` declare const x: string; if (x.length > 0) {}`, + output: ` +declare const x: string; +if (x.length > 0) { +} + `, }, { messageId: 'conditionFixCompareEmptyString', - output: ` declare const x: string; if (x !== "") {}`, + output: ` +declare const x: string; +if (x !== "") { +} + `, }, { messageId: 'conditionFixCastBoolean', - output: ` declare const x: string; if (Boolean(x)) {}`, + output: ` +declare const x: string; +if (Boolean(x)) { +} + `, }, ], }, + ], + options: [ { - column: 26, + allowString: false, + }, + ], + }, + { + code: '(x: string) => !x;', + errors: [ + { + column: 17, data: { context: 'conditional', }, - line: 5, + line: 1, messageId: 'conditionErrorString', suggestions: [ { messageId: 'conditionFixCompareStringLength', - output: ` (x: string) => (x.length === 0);`, + output: '(x: string) => x.length === 0;', }, { messageId: 'conditionFixCompareEmptyString', - output: ` (x: string) => (x === "");`, + output: '(x: string) => x === "";', }, { messageId: 'conditionFixCastBoolean', - output: ` (x: string) => (!Boolean(x));`, + output: '(x: string) => !Boolean(x);', }, ], }, + ], + options: [ + { + allowString: false, + }, + ], + }, + { + code: '(x: T) => (x ? 1 : 0);', + errors: [ { - column: 37, + column: 30, data: { context: 'conditional', }, - line: 6, + line: 1, messageId: 'conditionErrorString', suggestions: [ { messageId: 'conditionFixCompareStringLength', - output: ` (x: T) => (x.length > 0) ? 1 : 0;`, + output: '(x: T) => ((x.length > 0) ? 1 : 0);', }, { messageId: 'conditionFixCompareEmptyString', - output: ` (x: T) => (x !== "") ? 1 : 0;`, + output: '(x: T) => ((x !== "") ? 1 : 0);', }, { messageId: 'conditionFixCastBoolean', - output: ` (x: T) => (Boolean(x)) ? 1 : 0;`, + output: '(x: T) => ((Boolean(x)) ? 1 : 0);', }, ], }, ], - options: [{ allowString: false }], - }), - - // number in boolean context - ...batchedSingleLineTests({ - code: noFormat` - while (0n) {} - for (; 123;) {} - declare const x: number; if (x) {} - (x: bigint) => !x; - (x: T) => (x) ? 1 : 0; - ![]["length"]; // doesn't count as array.length when computed - declare const a: any[] & { notLength: number }; if (a.notLength) {} - `, + options: [ + { + allowString: false, + }, + ], + }, + + // number in boolean context + { + code: 'while (0n) {}', errors: [ { column: 8, data: { context: 'conditional', }, - line: 2, + line: 1, messageId: 'conditionErrorNumber', suggestions: [ { messageId: 'conditionFixCompareZero', // TODO: fix compare zero suggestion for bigint - output: `while (0n !== 0) {}`, + output: 'while (0n !== 0) {}', }, { // TODO: remove check NaN suggestion for bigint messageId: 'conditionFixCompareNaN', - output: `while (!Number.isNaN(0n)) {}`, + output: 'while (!Number.isNaN(0n)) {}', }, { messageId: 'conditionFixCastBoolean', - output: `while (Boolean(0n)) {}`, + output: 'while (Boolean(0n)) {}', }, ], }, + ], + options: [ { - column: 16, + allowNumber: false, + }, + ], + }, + { + code: 'for (; 123; ) {}', + errors: [ + { + column: 8, data: { context: 'conditional', }, - line: 3, + line: 1, messageId: 'conditionErrorNumber', suggestions: [ { messageId: 'conditionFixCompareZero', - output: ` for (; 123 !== 0;) {}`, + output: 'for (; 123 !== 0; ) {}', }, { messageId: 'conditionFixCompareNaN', - output: ` for (; !Number.isNaN(123);) {}`, + output: 'for (; !Number.isNaN(123); ) {}', }, { messageId: 'conditionFixCastBoolean', - output: ` for (; Boolean(123);) {}`, + output: 'for (; Boolean(123); ) {}', }, ], }, + ], + options: [ { - column: 38, + allowNumber: false, + }, + ], + }, + { + code: ` +declare const x: number; +if (x) { +} + `, + errors: [ + { + column: 5, data: { context: 'conditional', }, - line: 4, + line: 3, messageId: 'conditionErrorNumber', suggestions: [ { messageId: 'conditionFixCompareZero', - output: ` declare const x: number; if (x !== 0) {}`, + output: ` +declare const x: number; +if (x !== 0) { +} + `, }, { messageId: 'conditionFixCompareNaN', - output: ` declare const x: number; if (!Number.isNaN(x)) {}`, + output: ` +declare const x: number; +if (!Number.isNaN(x)) { +} + `, }, { messageId: 'conditionFixCastBoolean', - output: ` declare const x: number; if (Boolean(x)) {}`, + output: ` +declare const x: number; +if (Boolean(x)) { +} + `, }, ], }, + ], + options: [ { - column: 25, + allowNumber: false, + }, + ], + }, + { + code: '(x: bigint) => !x;', + errors: [ + { + column: 17, data: { context: 'conditional', }, - line: 5, + line: 1, messageId: 'conditionErrorNumber', suggestions: [ { - messageId: 'conditionFixCompareZero', // TODO: fix compare zero suggestion for bigint - output: ` (x: bigint) => x === 0;`, + messageId: 'conditionFixCompareZero', + output: '(x: bigint) => x === 0;', }, { // TODO: remove check NaN suggestion for bigint messageId: 'conditionFixCompareNaN', - output: ` (x: bigint) => Number.isNaN(x);`, + output: '(x: bigint) => Number.isNaN(x);', }, { messageId: 'conditionFixCastBoolean', - output: ` (x: bigint) => !Boolean(x);`, + output: '(x: bigint) => !Boolean(x);', }, ], }, + ], + options: [ + { + allowNumber: false, + }, + ], + }, + { + code: '(x: T) => (x ? 1 : 0);', + errors: [ { - column: 38, + column: 30, data: { context: 'conditional', }, - line: 6, + line: 1, messageId: 'conditionErrorNumber', suggestions: [ { messageId: 'conditionFixCompareZero', - output: ` (x: T) => (x !== 0) ? 1 : 0;`, + output: '(x: T) => ((x !== 0) ? 1 : 0);', }, { messageId: 'conditionFixCompareNaN', - output: ` (x: T) => (!Number.isNaN(x)) ? 1 : 0;`, + output: + '(x: T) => ((!Number.isNaN(x)) ? 1 : 0);', }, { messageId: 'conditionFixCastBoolean', - output: ` (x: T) => (Boolean(x)) ? 1 : 0;`, + output: '(x: T) => ((Boolean(x)) ? 1 : 0);', }, ], }, + ], + options: [ { - column: 10, + allowNumber: false, + }, + ], + }, + { + code: "![]['length']; // doesn't count as array.length when computed", + errors: [ + { + column: 2, data: { context: 'conditional', }, - line: 7, + line: 1, messageId: 'conditionErrorNumber', suggestions: [ { messageId: 'conditionFixCompareZero', - output: ` []["length"] === 0; // doesn't count as array.length when computed`, + 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`, + 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`, + output: + "!Boolean([]['length']); // doesn't count as array.length when computed", }, ], }, + ], + options: [ { - column: 61, - data: { - context: 'conditional', - }, - line: 8, + allowNumber: false, + }, + ], + }, + { + code: ` +declare const a: any[] & { notLength: number }; +if (a.notLength) { +} + `, + errors: [ + { + column: 5, + data: { context: 'conditional' }, + line: 3, messageId: 'conditionErrorNumber', suggestions: [ { messageId: 'conditionFixCompareZero', - output: ` declare const a: any[] & { notLength: number }; if (a.notLength !== 0) {}`, + 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)) {}`, + 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)) {}`, + output: ` +declare const a: any[] & { notLength: number }; +if (Boolean(a.notLength)) { +} + `, }, ], }, ], - options: [{ allowNumber: false }], - }), + options: [ + { + allowNumber: false, + }, + ], + }, // number (array.length) in boolean context @@ -2017,342 +2263,487 @@ if ([].length === 0) { }, // mixed `string | number` value in boolean context - ...batchedSingleLineTests({ - code: noFormat` - declare const x: string | number; if (x) {} - (x: bigint | string) => !x; - (x: T) => x ? 1 : 0; + { + code: ` +declare const x: string | number; +if (x) { +} `, errors: [ - { column: 39, line: 2, messageId: 'conditionErrorOther' }, - { column: 34, line: 3, messageId: 'conditionErrorOther' }, - { column: 55, line: 4, messageId: 'conditionErrorOther' }, + { + column: 5, + line: 3, + messageId: 'conditionErrorOther', + }, + ], + options: [{ allowNumber: true, allowString: true }], + }, + { + code: '(x: bigint | string) => !x;', + errors: [ + { + column: 26, + line: 1, + messageId: 'conditionErrorOther', + }, + ], + options: [{ allowNumber: true, allowString: true }], + }, + { + code: '(x: T) => (x ? 1 : 0);', + errors: [ + { + column: 48, + line: 1, + messageId: 'conditionErrorOther', + }, ], options: [{ allowNumber: true, allowString: true }], - }), + }, // nullable boolean in boolean context - ...batchedSingleLineTests({ - code: noFormat` - declare const x: boolean | null; if (x) {} - (x?: boolean) => !x; - (x: T) => x ? 1 : 0; + { + code: ` +declare const x: boolean | null; +if (x) { +} `, errors: [ { - column: 38, + column: 5, data: { context: 'conditional', }, - line: 2, + line: 3, messageId: 'conditionErrorNullableBoolean', suggestions: [ { messageId: 'conditionFixDefaultFalse', - output: `declare const x: boolean | null; if (x ?? false) {}`, + output: ` +declare const x: boolean | null; +if (x ?? false) { +} + `, }, { messageId: 'conditionFixCompareTrue', - output: `declare const x: boolean | null; if (x === true) {}`, + output: ` +declare const x: boolean | null; +if (x === true) { +} + `, }, ], }, + ], + options: [{ allowNullableBoolean: false }], + }, + { + code: '(x?: boolean) => !x;', + errors: [ { - column: 27, + column: 19, data: { context: 'conditional', }, - line: 3, + line: 1, messageId: 'conditionErrorNullableBoolean', suggestions: [ { messageId: 'conditionFixDefaultFalse', - output: ` (x?: boolean) => !(x ?? false);`, + output: '(x?: boolean) => !(x ?? false);', }, { messageId: 'conditionFixCompareFalse', - output: ` (x?: boolean) => x === false;`, + output: '(x?: boolean) => x === false;', }, ], }, + ], + options: [{ allowNullableBoolean: false }], + }, + { + code: '(x: T) => (x ? 1 : 0);', + errors: [ { - column: 57, + column: 50, data: { context: 'conditional', }, - line: 4, + line: 1, messageId: 'conditionErrorNullableBoolean', suggestions: [ { messageId: 'conditionFixDefaultFalse', - output: ` (x: T) => (x ?? false) ? 1 : 0;`, + output: + '(x: T) => ((x ?? false) ? 1 : 0);', }, { messageId: 'conditionFixCompareTrue', - output: ` (x: T) => (x === true) ? 1 : 0;`, + output: + '(x: T) => ((x === true) ? 1 : 0);', }, ], }, ], options: [{ allowNullableBoolean: false }], - }), + }, // nullable object in boolean context - ...batchedSingleLineTests({ - code: noFormat` - declare const x: object | null; if (x) {} - (x?: { a: number }) => !x; - (x: T) => x ? 1 : 0; + { + code: ` +declare const x: object | null; +if (x) { +} `, errors: [ { - column: 37, - line: 2, + column: 5, + line: 3, messageId: 'conditionErrorNullableObject', suggestions: [ { messageId: 'conditionFixCompareNullish', - output: 'declare const x: object | null; if (x != null) {}', + output: ` +declare const x: object | null; +if (x != null) { +} + `, }, ], }, + ], + options: [{ allowNullableObject: false }], + }, + { + code: '(x?: { a: number }) => !x;', + errors: [ { - column: 33, - line: 3, + column: 25, + line: 1, messageId: 'conditionErrorNullableObject', suggestions: [ { messageId: 'conditionFixCompareNullish', - output: ` (x?: { a: number }) => x == null;`, + output: '(x?: { a: number }) => x == null;', }, ], }, + ], + options: [{ allowNullableObject: false }], + }, + { + code: '(x: T) => (x ? 1 : 0);', + errors: [ { - column: 52, - line: 4, + column: 45, + line: 1, messageId: 'conditionErrorNullableObject', suggestions: [ { messageId: 'conditionFixCompareNullish', - output: ` (x: T) => (x != null) ? 1 : 0;`, + output: + '(x: T) => ((x != null) ? 1 : 0);', }, ], }, ], options: [{ allowNullableObject: false }], - }), + }, // nullable string in boolean context - ...batchedSingleLineTests({ - code: noFormat` - declare const x: string | null; if (x) {} - (x?: string) => !x; - (x: T) => x ? 1 : 0; - function foo(x: '' | 'bar' | null) { if (!x) {} } + { + code: ` +declare const x: string | null; +if (x) { +} `, errors: [ { - column: 37, + column: 5, data: { context: 'conditional', }, - line: 2, + line: 3, messageId: 'conditionErrorNullableString', suggestions: [ { messageId: 'conditionFixCompareNullish', - output: 'declare const x: string | null; if (x != null) {}', + output: ` +declare const x: string | null; +if (x != null) { +} + `, }, { messageId: 'conditionFixDefaultEmptyString', - output: 'declare const x: string | null; if (x ?? "") {}', + output: ` +declare const x: string | null; +if (x ?? "") { +} + `, }, { messageId: 'conditionFixCastBoolean', - output: 'declare const x: string | null; if (Boolean(x)) {}', + output: ` +declare const x: string | null; +if (Boolean(x)) { +} + `, }, ], }, + ], + }, + { + code: '(x?: string) => !x;', + errors: [ { - column: 26, + column: 18, data: { context: 'conditional', }, - line: 3, + line: 1, messageId: 'conditionErrorNullableString', suggestions: [ { messageId: 'conditionFixCompareNullish', - output: ' (x?: string) => x == null;', + output: '(x?: string) => x == null;', }, { messageId: 'conditionFixDefaultEmptyString', - output: ' (x?: string) => !(x ?? "");', + output: '(x?: string) => !(x ?? "");', }, { messageId: 'conditionFixCastBoolean', - output: ' (x?: string) => !Boolean(x);', + output: '(x?: string) => !Boolean(x);', }, ], }, + ], + }, + { + code: '(x: T) => (x ? 1 : 0);', + errors: [ { - column: 56, - data: { - context: 'conditional', - }, - line: 4, + column: 49, + data: { context: 'conditional' }, + line: 1, messageId: 'conditionErrorNullableString', suggestions: [ { messageId: 'conditionFixCompareNullish', output: - ' (x: T) => (x != null) ? 1 : 0;', + '(x: T) => ((x != null) ? 1 : 0);', }, { messageId: 'conditionFixDefaultEmptyString', output: - ' (x: T) => (x ?? "") ? 1 : 0;', + '(x: T) => ((x ?? "") ? 1 : 0);', }, { messageId: 'conditionFixCastBoolean', output: - ' (x: T) => (Boolean(x)) ? 1 : 0;', + '(x: T) => ((Boolean(x)) ? 1 : 0);', }, ], }, + ], + }, + { + code: ` +function foo(x: '' | 'bar' | null) { + if (!x) { + } +} + `, + errors: [ { - column: 51, - data: { - context: 'conditional', - }, - line: 5, + column: 8, + data: { context: 'conditional' }, + line: 3, messageId: 'conditionErrorNullableString', suggestions: [ { messageId: 'conditionFixCompareNullish', - output: - " function foo(x: '' | 'bar' | null) { if (x == null) {} }", + output: ` +function foo(x: '' | 'bar' | null) { + if (x == null) { + } +} + `, }, { messageId: 'conditionFixDefaultEmptyString', - output: - " function foo(x: '' | 'bar' | null) { if (!(x ?? \"\")) {} }", + output: ` +function foo(x: '' | 'bar' | null) { + if (!(x ?? "")) { + } +} + `, }, { messageId: 'conditionFixCastBoolean', - output: - " function foo(x: '' | 'bar' | null) { if (!Boolean(x)) {} }", + output: ` +function foo(x: '' | 'bar' | null) { + if (!Boolean(x)) { + } +} + `, }, ], }, ], - }), + }, // nullable number in boolean context - ...batchedSingleLineTests({ - code: noFormat` - declare const x: number | null; if (x) {} - (x?: number) => !x; - (x: T) => x ? 1 : 0; - function foo(x: 0 | 1 | null) { if (!x) {} } + { + code: ` +declare const x: number | null; +if (x) { +} `, errors: [ { - column: 37, + column: 5, data: { context: 'conditional', }, - line: 2, + line: 3, messageId: 'conditionErrorNullableNumber', suggestions: [ { messageId: 'conditionFixCompareNullish', - output: 'declare const x: number | null; if (x != null) {}', + output: ` +declare const x: number | null; +if (x != null) { +} + `, }, { messageId: 'conditionFixDefaultZero', - output: 'declare const x: number | null; if (x ?? 0) {}', + output: ` +declare const x: number | null; +if (x ?? 0) { +} + `, }, { messageId: 'conditionFixCastBoolean', - output: 'declare const x: number | null; if (Boolean(x)) {}', + output: ` +declare const x: number | null; +if (Boolean(x)) { +} + `, }, ], }, + ], + }, + { + code: '(x?: number) => !x;', + errors: [ { - column: 26, + column: 18, data: { context: 'conditional', }, - line: 3, + line: 1, messageId: 'conditionErrorNullableNumber', suggestions: [ { messageId: 'conditionFixCompareNullish', - output: ' (x?: number) => x == null;', + output: '(x?: number) => x == null;', }, { messageId: 'conditionFixDefaultZero', - output: ' (x?: number) => !(x ?? 0);', + output: '(x?: number) => !(x ?? 0);', }, { messageId: 'conditionFixCastBoolean', - output: ' (x?: number) => !Boolean(x);', + output: '(x?: number) => !Boolean(x);', }, ], }, + ], + }, + { + code: '(x: T) => (x ? 1 : 0);', + errors: [ { - column: 56, + column: 49, data: { context: 'conditional', }, - line: 4, + line: 1, messageId: 'conditionErrorNullableNumber', suggestions: [ { messageId: 'conditionFixCompareNullish', output: - ' (x: T) => (x != null) ? 1 : 0;', + '(x: T) => ((x != null) ? 1 : 0);', }, { messageId: 'conditionFixDefaultZero', output: - ' (x: T) => (x ?? 0) ? 1 : 0;', + '(x: T) => ((x ?? 0) ? 1 : 0);', }, { messageId: 'conditionFixCastBoolean', output: - ' (x: T) => (Boolean(x)) ? 1 : 0;', + '(x: T) => ((Boolean(x)) ? 1 : 0);', }, ], }, + ], + }, + { + code: ` +function foo(x: 0 | 1 | null) { + if (!x) { + } +} + `, + errors: [ { - column: 46, + column: 8, data: { context: 'conditional', }, - line: 5, + line: 3, messageId: 'conditionErrorNullableNumber', suggestions: [ { messageId: 'conditionFixCompareNullish', - output: - ' function foo(x: 0 | 1 | null) { if (x == null) {} }', + output: ` +function foo(x: 0 | 1 | null) { + if (x == null) { + } +} + `, }, { messageId: 'conditionFixDefaultZero', - output: - ' function foo(x: 0 | 1 | null) { if (!(x ?? 0)) {} }', + output: ` +function foo(x: 0 | 1 | null) { + if (!(x ?? 0)) { + } +} + `, }, { messageId: 'conditionFixCastBoolean', - output: - ' function foo(x: 0 | 1 | null) { if (!Boolean(x)) {} }', + output: ` +function foo(x: 0 | 1 | null) { + if (!Boolean(x)) { + } +} + `, }, ], }, ], - }), + }, // nullable enum in boolean context { @@ -2765,12 +3156,10 @@ if ([].length === 0) { }, // any in boolean context - ...batchedSingleLineTests({ - code: noFormat` - if (x) {} - x => !x; - (x: T) => x ? 1 : 0; - (x: T) => x ? 1 : 0; + { + code: ` +if (x) { +} `, errors: [ { @@ -2783,54 +3172,72 @@ if ([].length === 0) { suggestions: [ { messageId: 'conditionFixCastBoolean', - output: 'if (Boolean(x)) {}', + output: ` +if (Boolean(x)) { +} + `, }, ], }, + ], + }, + { + code: 'x => !x;', + errors: [ { - column: 15, + column: 7, data: { context: 'conditional', }, - line: 3, + line: 1, messageId: 'conditionErrorAny', suggestions: [ { messageId: 'conditionFixCastBoolean', - output: ' x => !(Boolean(x));', + output: 'x => !(Boolean(x));', }, ], }, + ], + }, + { + code: '(x: T) => (x ? 1 : 0);', + errors: [ { - column: 34, + column: 27, data: { context: 'conditional', }, - line: 4, + line: 1, messageId: 'conditionErrorAny', suggestions: [ { messageId: 'conditionFixCastBoolean', - output: ' (x: T) => (Boolean(x)) ? 1 : 0;', + output: '(x: T) => ((Boolean(x)) ? 1 : 0);', }, ], }, + ], + }, + { + code: '(x: T) => (x ? 1 : 0);', + errors: [ { - column: 22, + column: 16, data: { context: 'conditional', }, - line: 5, + line: 1, messageId: 'conditionErrorAny', suggestions: [ { messageId: 'conditionFixCastBoolean', - output: ' (x: T) => (Boolean(x)) ? 1 : 0;', + output: '(x: T) => ((Boolean(x)) ? 1 : 0);', }, ], }, ], - }), + }, // noStrictNullCheck { @@ -2856,7 +3263,7 @@ if (x) { ], languageOptions: { parserOptions: { - tsconfigRootDir: path.join(rootPath, 'unstrict'), + tsconfigRootDir: path.join(rootDir, 'unstrict'), }, }, output: null, @@ -3130,6 +3537,7 @@ assert(foo, Boolean(nullableString)); // a bug. // // See https://github.com/microsoft/TypeScript/issues/59707 + skip: true, code: ` function asserts1(x: string | number | undefined): asserts x {} function asserts2(x: string | number | undefined): asserts x {} @@ -3194,7 +3602,6 @@ someAssert(Boolean(maybeString)); }, ], output: null, - skip: true, }, { // The implementation signature doesn't count towards the call signatures diff --git a/packages/eslint-plugin/tests/rules/switch-exhaustiveness-check.test.ts b/packages/eslint-plugin/tests/rules/switch-exhaustiveness-check.test.ts index da5b65c8177f..11392f2ca353 100644 --- a/packages/eslint-plugin/tests/rules/switch-exhaustiveness-check.test.ts +++ b/packages/eslint-plugin/tests/rules/switch-exhaustiveness-check.test.ts @@ -1,18 +1,10 @@ -import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; -import path from 'node:path'; +import { noFormat } from '@typescript-eslint/rule-tester'; import switchExhaustivenessCheck from '../../src/rules/switch-exhaustiveness-check'; +import { getFixturesRootDir, createRuleTesterWithTypes } from '../RuleTester'; -const rootPath = path.join(__dirname, '..', 'fixtures'); - -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootPath, - }, - }, -}); +const rootDir = getFixturesRootDir(); +const ruleTester = createRuleTesterWithTypes(); ruleTester.run('switch-exhaustiveness-check', switchExhaustivenessCheck, { valid: [ @@ -928,7 +920,7 @@ function foo(x: string[]) { parserOptions: { project: './tsconfig.noUncheckedIndexedAccess.json', projectService: false, - tsconfigRootDir: rootPath, + tsconfigRootDir: rootDir, }, }, }, @@ -951,7 +943,7 @@ function foo(x: string[], y: string | undefined) { parserOptions: { project: './tsconfig.noUncheckedIndexedAccess.json', projectService: false, - tsconfigRootDir: rootPath, + tsconfigRootDir: rootDir, }, }, }, @@ -2281,46 +2273,6 @@ switch (value) { }, ], }, - { - code: ` - enum Enum { - 'a' = 1, - [\`key-with - - new-line\`] = 2, - } - - declare const a: Enum; - - switch (a) { - } - `, - errors: [ - { - messageId: 'switchIsNotExhaustive', - suggestions: [ - { - messageId: 'addMissingCases', - output: ` - enum Enum { - 'a' = 1, - [\`key-with - - new-line\`] = 2, - } - - declare const a: Enum; - - switch (a) { - case Enum.a: { throw new Error('Not implemented yet: Enum.a case') } - case Enum['key-with\\n\\n new-line']: { throw new Error('Not implemented yet: Enum[\\'key-with\\\\n\\\\n new-line\\'] case') } - } - `, - }, - ], - }, - ], - }, { code: noFormat` enum Enum { @@ -2842,7 +2794,7 @@ function foo(x: string[]) { parserOptions: { project: './tsconfig.noUncheckedIndexedAccess.json', projectService: false, - tsconfigRootDir: rootPath, + tsconfigRootDir: rootDir, }, }, }, diff --git a/packages/eslint-plugin/tests/rules/typedef.test.ts b/packages/eslint-plugin/tests/rules/typedef.test.ts index 129fcc5320c0..152cc1beeecf 100644 --- a/packages/eslint-plugin/tests/rules/typedef.test.ts +++ b/packages/eslint-plugin/tests/rules/typedef.test.ts @@ -1,17 +1,7 @@ -import { RuleTester } from '@typescript-eslint/rule-tester'; - import rule from '../../src/rules/typedef'; -import { getFixturesRootDir } from '../RuleTester'; +import { createRuleTesterWithTypes } from '../RuleTester'; -const rootDir = getFixturesRootDir(); -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootDir, - }, - }, -}); +const ruleTester = createRuleTesterWithTypes(); ruleTester.run('typedef', rule, { valid: [ diff --git a/packages/eslint-plugin/tests/rules/unbound-method.test.ts b/packages/eslint-plugin/tests/rules/unbound-method.test.ts index aeca1a171d50..92fc2cc48188 100644 --- a/packages/eslint-plugin/tests/rules/unbound-method.test.ts +++ b/packages/eslint-plugin/tests/rules/unbound-method.test.ts @@ -1,22 +1,11 @@ import type { InvalidTestCase } from '@typescript-eslint/rule-tester'; -import { RuleTester } from '@typescript-eslint/rule-tester'; - import type { MessageIds, Options } from '../../src/rules/unbound-method'; import rule from '../../src/rules/unbound-method'; -import { getFixturesRootDir } from '../RuleTester'; - -const rootPath = getFixturesRootDir(); +import { createRuleTesterWithTypes } from '../RuleTester'; -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootPath, - }, - }, -}); +const ruleTester = createRuleTesterWithTypes(); function addContainsMethodsClass(code: string): string { return ` diff --git a/packages/eslint-plugin/tests/rules/unified-signatures.test.ts b/packages/eslint-plugin/tests/rules/unified-signatures.test.ts index 30952ddebb0f..871507e24ad2 100644 --- a/packages/eslint-plugin/tests/rules/unified-signatures.test.ts +++ b/packages/eslint-plugin/tests/rules/unified-signatures.test.ts @@ -378,6 +378,19 @@ declare function f(x: boolean): unknown; declare function f(x: number): unknown; declare function f(x: boolean): unknown; `, + + options: [{ ignoreOverloadsWithDifferentJSDoc: true }], + }, + { + code: ` +class C { + a(b: string): void; + /** + * @deprecate + */ + a(b: number): void; +} + `, options: [{ ignoreOverloadsWithDifferentJSDoc: true }], }, ` @@ -833,6 +846,30 @@ abstract class Foo { }, ], }, + { + code: ` +abstract class C { + a(b: string): void; + /** + * @deprecate + */ + a(b: number): void; +} + `, + errors: [ + { + column: 5, + data: { + failureStringStart: + 'These overloads can be combined into one signature', + type1: 'string', + type2: 'number', + }, + line: 7, + messageId: 'singleParameterDifference', + }, + ], + }, { // Works with literals code: ` diff --git a/packages/eslint-plugin/tests/rules/use-unknown-in-catch-callback-variable.test.ts b/packages/eslint-plugin/tests/rules/use-unknown-in-catch-callback-variable.test.ts index 4100fba8b702..e0ba5f76d4fa 100644 --- a/packages/eslint-plugin/tests/rules/use-unknown-in-catch-callback-variable.test.ts +++ b/packages/eslint-plugin/tests/rules/use-unknown-in-catch-callback-variable.test.ts @@ -1,18 +1,9 @@ -import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; +import { noFormat } from '@typescript-eslint/rule-tester'; import rule from '../../src/rules/use-unknown-in-catch-callback-variable'; -import { getFixturesRootDir } from '../RuleTester'; +import { createRuleTesterWithTypes } from '../RuleTester'; -const rootDir = getFixturesRootDir(); - -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootDir, - }, - }, -}); +const ruleTester = createRuleTesterWithTypes(); ruleTester.run('use-unknown-in-catch-callback-variable', rule, { valid: [ diff --git a/packages/eslint-plugin/tests/schema-snapshots/adjacent-overload-signatures.shot b/packages/eslint-plugin/tests/schema-snapshots/adjacent-overload-signatures.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/adjacent-overload-signatures.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/adjacent-overload-signatures.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/await-thenable.shot b/packages/eslint-plugin/tests/schema-snapshots/await-thenable.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/await-thenable.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/await-thenable.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/ban-ts-comment.shot b/packages/eslint-plugin/tests/schema-snapshots/ban-ts-comment.shot index c7127300a580..9c5d8cf6deba 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/ban-ts-comment.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/ban-ts-comment.shot @@ -29,21 +29,24 @@ "additionalProperties": false, "properties": { "minimumDescriptionLength": { - "default": 3, "description": "A minimum character length for descriptions when `allow-with-description` is enabled.", "type": "number" }, "ts-check": { - "$ref": "#/items/0/$defs/directiveConfigSchema" + "$ref": "#/items/0/$defs/directiveConfigSchema", + "description": "Whether allow ts-check directives, and with which restrictions." }, "ts-expect-error": { - "$ref": "#/items/0/$defs/directiveConfigSchema" + "$ref": "#/items/0/$defs/directiveConfigSchema", + "description": "Whether and when expect-error directives, and with which restrictions." }, "ts-ignore": { - "$ref": "#/items/0/$defs/directiveConfigSchema" + "$ref": "#/items/0/$defs/directiveConfigSchema", + "description": "Whether allow ts-ignore directives, and with which restrictions." }, "ts-nocheck": { - "$ref": "#/items/0/$defs/directiveConfigSchema" + "$ref": "#/items/0/$defs/directiveConfigSchema", + "description": "Whether allow ts-nocheck directives, and with which restrictions." } }, "type": "object" @@ -62,9 +65,13 @@ type DirectiveConfigSchema = type Options = [ { + /** Whether allow ts-check directives, and with which restrictions. */ 'ts-check'?: DirectiveConfigSchema; + /** Whether and when expect-error directives, and with which restrictions. */ 'ts-expect-error'?: DirectiveConfigSchema; + /** Whether allow ts-ignore directives, and with which restrictions. */ 'ts-ignore'?: DirectiveConfigSchema; + /** Whether allow ts-nocheck directives, and with which restrictions. */ 'ts-nocheck'?: DirectiveConfigSchema; /** A minimum character length for descriptions when `allow-with-description` is enabled. */ minimumDescriptionLength?: number; diff --git a/packages/eslint-plugin/tests/schema-snapshots/ban-tslint-comment.shot b/packages/eslint-plugin/tests/schema-snapshots/ban-tslint-comment.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/ban-tslint-comment.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/ban-tslint-comment.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/class-methods-use-this.shot b/packages/eslint-plugin/tests/schema-snapshots/class-methods-use-this.shot index 26c76ab0cffb..75bfbbbb7c79 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/class-methods-use-this.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/class-methods-use-this.shot @@ -6,7 +6,6 @@ "additionalProperties": false, "properties": { "enforceForClassFields": { - "default": true, "description": "Enforces that functions used as instance field initializers utilize `this`.", "type": "boolean" }, diff --git a/packages/eslint-plugin/tests/schema-snapshots/default-param-last.shot b/packages/eslint-plugin/tests/schema-snapshots/default-param-last.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/default-param-last.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/default-param-last.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/dot-notation.shot b/packages/eslint-plugin/tests/schema-snapshots/dot-notation.shot index e5839641aa64..90b1c7beead3 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/dot-notation.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/dot-notation.shot @@ -6,27 +6,22 @@ "additionalProperties": false, "properties": { "allowIndexSignaturePropertyAccess": { - "default": false, "description": "Whether to allow accessing properties matching an index signature with array notation.", "type": "boolean" }, "allowKeywords": { - "default": true, "description": "Whether to allow keywords such as [\"class\"]`.", "type": "boolean" }, "allowPattern": { - "default": "", "description": "Regular expression of names to allow.", "type": "string" }, "allowPrivateClassPropertyAccess": { - "default": false, "description": "Whether to allow accessing class members marked as `private` with array notation.", "type": "boolean" }, "allowProtectedClassPropertyAccess": { - "default": false, "description": "Whether to allow accessing class members marked as `protected` with array notation.", "type": "boolean" } diff --git a/packages/eslint-plugin/tests/schema-snapshots/explicit-member-accessibility.shot b/packages/eslint-plugin/tests/schema-snapshots/explicit-member-accessibility.shot index ebdf7f52fabd..09e140871eb6 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/explicit-member-accessibility.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/explicit-member-accessibility.shot @@ -42,19 +42,24 @@ "description": "Changes to required accessibility modifiers for specific kinds of class members.", "properties": { "accessors": { - "$ref": "#/items/0/$defs/accessibilityLevel" + "$ref": "#/items/0/$defs/accessibilityLevel", + "description": "Which member accessibility modifier requirements to apply for accessors." }, "constructors": { - "$ref": "#/items/0/$defs/accessibilityLevel" + "$ref": "#/items/0/$defs/accessibilityLevel", + "description": "Which member accessibility modifier requirements to apply for constructors." }, "methods": { - "$ref": "#/items/0/$defs/accessibilityLevel" + "$ref": "#/items/0/$defs/accessibilityLevel", + "description": "Which member accessibility modifier requirements to apply for methods." }, "parameterProperties": { - "$ref": "#/items/0/$defs/accessibilityLevel" + "$ref": "#/items/0/$defs/accessibilityLevel", + "description": "Which member accessibility modifier requirements to apply for parameterProperties." }, "properties": { - "$ref": "#/items/0/$defs/accessibilityLevel" + "$ref": "#/items/0/$defs/accessibilityLevel", + "description": "Which member accessibility modifier requirements to apply for properties." } }, "type": "object" @@ -83,10 +88,15 @@ type Options = [ ignoredMethodNames?: string[]; /** Changes to required accessibility modifiers for specific kinds of class members. */ overrides?: { + /** Which member accessibility modifier requirements to apply for accessors. */ accessors?: AccessibilityLevel; + /** Which member accessibility modifier requirements to apply for constructors. */ constructors?: AccessibilityLevel; + /** Which member accessibility modifier requirements to apply for methods. */ methods?: AccessibilityLevel; + /** Which member accessibility modifier requirements to apply for parameterProperties. */ parameterProperties?: AccessibilityLevel; + /** Which member accessibility modifier requirements to apply for properties. */ properties?: AccessibilityLevel; }; }, diff --git a/packages/eslint-plugin/tests/schema-snapshots/member-ordering.shot b/packages/eslint-plugin/tests/schema-snapshots/member-ordering.shot index 4da3214b15d1..e9d92a53bd03 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/member-ordering.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/member-ordering.shot @@ -311,19 +311,24 @@ "additionalProperties": false, "properties": { "classes": { - "$ref": "#/items/0/$defs/baseConfig" + "$ref": "#/items/0/$defs/baseConfig", + "description": "Which ordering to enforce for classes." }, "classExpressions": { - "$ref": "#/items/0/$defs/baseConfig" + "$ref": "#/items/0/$defs/baseConfig", + "description": "Which ordering to enforce for classExpressions." }, "default": { - "$ref": "#/items/0/$defs/baseConfig" + "$ref": "#/items/0/$defs/baseConfig", + "description": "Which ordering to enforce for default." }, "interfaces": { - "$ref": "#/items/0/$defs/typesConfig" + "$ref": "#/items/0/$defs/typesConfig", + "description": "Which ordering to enforce for interfaces." }, "typeLiterals": { - "$ref": "#/items/0/$defs/typesConfig" + "$ref": "#/items/0/$defs/typesConfig", + "description": "Which ordering to enforce for typeLiterals." } }, "type": "object" @@ -525,10 +530,15 @@ type TypesConfig = type Options = [ { + /** Which ordering to enforce for classExpressions. */ classExpressions?: BaseConfig; + /** Which ordering to enforce for classes. */ classes?: BaseConfig; + /** Which ordering to enforce for default. */ default?: BaseConfig; + /** Which ordering to enforce for interfaces. */ interfaces?: TypesConfig; + /** Which ordering to enforce for typeLiterals. */ typeLiterals?: TypesConfig; }, ]; diff --git a/packages/eslint-plugin/tests/schema-snapshots/method-signature-style.shot b/packages/eslint-plugin/tests/schema-snapshots/method-signature-style.shot index 53587bcf325b..42b7d652fd2b 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/method-signature-style.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/method-signature-style.shot @@ -3,6 +3,7 @@ [ { + "description": "The method signature style to enforce using.", "enum": ["method", "property"], "type": "string" } @@ -11,4 +12,9 @@ # TYPES: -type Options = ['method' | 'property']; +type Options = [ + /** The method signature style to enforce using. */ + | 'property' + /** The method signature style to enforce using. */ + | 'method', +]; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-array-constructor.shot b/packages/eslint-plugin/tests/schema-snapshots/no-array-constructor.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-array-constructor.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-array-constructor.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-array-delete.shot b/packages/eslint-plugin/tests/schema-snapshots/no-array-delete.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-array-delete.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-array-delete.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-base-to-string.shot b/packages/eslint-plugin/tests/schema-snapshots/no-base-to-string.shot index fe2577cd6329..20ae8b227f21 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-base-to-string.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-base-to-string.shot @@ -5,8 +5,12 @@ { "additionalProperties": false, "properties": { + "checkUnknown": { + "description": "Whether to also check values of type `unknown`", + "type": "boolean" + }, "ignoredTypeNames": { - "description": "Stringified regular expressions of type names to ignore.", + "description": "Stringified type names to ignore.", "items": { "type": "string" }, @@ -22,7 +26,9 @@ type Options = [ { - /** Stringified regular expressions of type names to ignore. */ + /** Whether to also check values of type `unknown` */ + checkUnknown?: boolean; + /** Stringified type names to ignore. */ ignoredTypeNames?: string[]; }, ]; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-confusing-non-null-assertion.shot b/packages/eslint-plugin/tests/schema-snapshots/no-confusing-non-null-assertion.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-confusing-non-null-assertion.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-confusing-non-null-assertion.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-dupe-class-members.shot b/packages/eslint-plugin/tests/schema-snapshots/no-dupe-class-members.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-dupe-class-members.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-dupe-class-members.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-duplicate-enum-values.shot b/packages/eslint-plugin/tests/schema-snapshots/no-duplicate-enum-values.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-duplicate-enum-values.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-duplicate-enum-values.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-dynamic-delete.shot b/packages/eslint-plugin/tests/schema-snapshots/no-dynamic-delete.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-dynamic-delete.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-dynamic-delete.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-extra-non-null-assertion.shot b/packages/eslint-plugin/tests/schema-snapshots/no-extra-non-null-assertion.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-extra-non-null-assertion.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-extra-non-null-assertion.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-for-in-array.shot b/packages/eslint-plugin/tests/schema-snapshots/no-for-in-array.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-for-in-array.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-for-in-array.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-implied-eval.shot b/packages/eslint-plugin/tests/schema-snapshots/no-implied-eval.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-implied-eval.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-implied-eval.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-import-type-side-effects.shot b/packages/eslint-plugin/tests/schema-snapshots/no-import-type-side-effects.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-import-type-side-effects.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-import-type-side-effects.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-loop-func.shot b/packages/eslint-plugin/tests/schema-snapshots/no-loop-func.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-loop-func.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-loop-func.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-loss-of-precision.shot b/packages/eslint-plugin/tests/schema-snapshots/no-loss-of-precision.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-loss-of-precision.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-loss-of-precision.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-magic-numbers.shot b/packages/eslint-plugin/tests/schema-snapshots/no-magic-numbers.shot index 6a0d430f638e..394890924c13 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-magic-numbers.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-magic-numbers.shot @@ -41,18 +41,22 @@ "type": "boolean" }, "ignoreEnums": { + "default": false, "description": "Whether enums used in TypeScript are considered okay.", "type": "boolean" }, "ignoreNumericLiteralTypes": { + "default": false, "description": "Whether numbers used in TypeScript numeric literal types are considered okay.", "type": "boolean" }, "ignoreReadonlyClassProperties": { + "default": false, "description": "Whether `readonly` class properties are considered okay.", "type": "boolean" }, "ignoreTypeIndexes": { + "default": false, "description": "Whether numbers used to index types are okay.", "type": "boolean" } diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-meaningless-void-operator.shot b/packages/eslint-plugin/tests/schema-snapshots/no-meaningless-void-operator.shot index 350098bd0a9a..650eb8dc1aad 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-meaningless-void-operator.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-meaningless-void-operator.shot @@ -6,7 +6,6 @@ "additionalProperties": false, "properties": { "checkNever": { - "default": false, "description": "Whether to suggest removing `void` when the argument has type `never`.", "type": "boolean" } diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-misused-new.shot b/packages/eslint-plugin/tests/schema-snapshots/no-misused-new.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-misused-new.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-misused-new.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-mixed-enums.shot b/packages/eslint-plugin/tests/schema-snapshots/no-mixed-enums.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-mixed-enums.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-mixed-enums.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-non-null-asserted-nullish-coalescing.shot b/packages/eslint-plugin/tests/schema-snapshots/no-non-null-asserted-nullish-coalescing.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-non-null-asserted-nullish-coalescing.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-non-null-asserted-nullish-coalescing.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-non-null-asserted-optional-chain.shot b/packages/eslint-plugin/tests/schema-snapshots/no-non-null-asserted-optional-chain.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-non-null-asserted-optional-chain.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-non-null-asserted-optional-chain.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-non-null-assertion.shot b/packages/eslint-plugin/tests/schema-snapshots/no-non-null-assertion.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-non-null-assertion.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-non-null-assertion.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-redundant-type-constituents.shot b/packages/eslint-plugin/tests/schema-snapshots/no-redundant-type-constituents.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-redundant-type-constituents.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-redundant-type-constituents.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-condition.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-condition.shot index 44388c6bd694..2f59fc5bdb8c 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-condition.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-condition.shot @@ -9,9 +9,11 @@ "description": "Whether to ignore constant loop conditions, such as `while (true)`.", "oneOf": [ { + "description": "Always ignore or not ignore the loop conditions", "type": "boolean" }, { + "description": "Which situations to ignore constant conditions in.", "enum": ["always", "never", "only-allowed-literals"], "type": "string" } @@ -37,11 +39,15 @@ type Options = [ { /** Whether to ignore constant loop conditions, such as `while (true)`. */ allowConstantLoopConditions?: - | 'always' | 'never' | 'only-allowed-literals' - /** Whether to ignore constant loop conditions, such as `while (true)`. */ - | boolean; + /** + * Whether to ignore constant loop conditions, such as `while (true)`. + * Always ignore or not ignore the loop conditions + */ + | boolean + /** Which situations to ignore constant conditions in. */ + | 'always'; /** Whether to not error when running with a tsconfig that has strictNullChecks turned. */ allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing?: boolean; /** Whether to check the asserted argument of a type predicate function for unnecessary conditions */ diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-parameter-property-assignment.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-parameter-property-assignment.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-parameter-property-assignment.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-parameter-property-assignment.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-qualifier.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-qualifier.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-qualifier.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-qualifier.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-template-expression.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-template-expression.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-template-expression.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-template-expression.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-type-arguments.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-type-arguments.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-type-arguments.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-type-arguments.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-type-constraint.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-type-constraint.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-type-constraint.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-type-constraint.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-type-conversion.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-type-conversion.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-type-conversion.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-type-conversion.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-type-parameters.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-type-parameters.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-type-parameters.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-type-parameters.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-argument.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-argument.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-argument.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-argument.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-assignment.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-assignment.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-assignment.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-assignment.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-call.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-call.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-call.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-call.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-declaration-merging.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-declaration-merging.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-declaration-merging.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-declaration-merging.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-enum-comparison.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-enum-comparison.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-enum-comparison.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-enum-comparison.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-function-type.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-function-type.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-function-type.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-function-type.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-member-access.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-member-access.shot index 42f81875ed94..254c8f5ff07e 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-member-access.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-member-access.shot @@ -1,10 +1,25 @@ # SCHEMA: -[] +[ + { + "additionalProperties": false, + "properties": { + "allowOptionalChaining": { + "description": "Whether to allow `?.` optional chains on `any` values.", + "type": "boolean" + } + }, + "type": "object" + } +] # TYPES: -/** No options declared */ -type Options = []; \ No newline at end of file +type Options = [ + { + /** Whether to allow `?.` optional chains on `any` values. */ + allowOptionalChaining?: boolean; + }, +]; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-return.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-return.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-return.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-return.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-type-assertion.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-type-assertion.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-type-assertion.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-type-assertion.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-unary-minus.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-unary-minus.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-unary-minus.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-unary-minus.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unused-vars.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unused-vars.shot index 0d9872aa6a11..fa83b7e42e8e 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-unused-vars.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unused-vars.shot @@ -5,6 +5,7 @@ { "oneOf": [ { + "description": "Broad setting for unused variables to target.", "enum": ["all", "local"], "type": "string" }, @@ -41,6 +42,10 @@ "description": "Whether to ignore sibling properties in `...` destructurings.", "type": "boolean" }, + "ignoreUsingDeclarations": { + "description": "Whether to ignore using or await using declarations.", + "type": "boolean" + }, "reportUsedIgnorePattern": { "description": "Whether to report variables that match any of the valid ignore pattern options if they have been used.", "type": "boolean" @@ -65,7 +70,6 @@ # TYPES: type Options = [ - | 'all' | 'local' | { /** Whether to check all, some, or no arguments. */ @@ -89,6 +93,8 @@ type Options = [ ignoreClassWithStaticInitBlock?: boolean; /** Whether to ignore sibling properties in `...` destructurings. */ ignoreRestSiblings?: boolean; + /** Whether to ignore using or await using declarations. */ + ignoreUsingDeclarations?: boolean; /** Whether to report variables that match any of the valid ignore pattern options if they have been used. */ reportUsedIgnorePattern?: boolean; /** Whether to check all variables or only locally-declared variables. */ @@ -98,5 +104,7 @@ type Options = [ | 'all'; /** Regular expressions of variable names to not check for usage. */ varsIgnorePattern?: string; - }, + } + /** Broad setting for unused variables to target. */ + | 'all', ]; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-use-before-define.shot b/packages/eslint-plugin/tests/schema-snapshots/no-use-before-define.shot index f3864668838f..1aace09f842c 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-use-before-define.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-use-before-define.shot @@ -5,6 +5,7 @@ { "oneOf": [ { + "description": "Broadly set functions and allowNamedExports to false.", "enum": ["nofunc"], "type": "string" }, @@ -50,7 +51,6 @@ # TYPES: type Options = [ - | 'nofunc' | { /** Whether to ignore named exports. */ allowNamedExports?: boolean; @@ -66,5 +66,7 @@ type Options = [ typedefs?: boolean; /** Whether to ignore references to variables. */ variables?: boolean; - }, + } + /** Broadly set functions and allowNamedExports to false. */ + | 'nofunc', ]; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-useless-constructor.shot b/packages/eslint-plugin/tests/schema-snapshots/no-useless-constructor.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-useless-constructor.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-useless-constructor.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-useless-empty-export.shot b/packages/eslint-plugin/tests/schema-snapshots/no-useless-empty-export.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-useless-empty-export.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-useless-empty-export.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-wrapper-object-types.shot b/packages/eslint-plugin/tests/schema-snapshots/no-wrapper-object-types.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-wrapper-object-types.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-wrapper-object-types.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/non-nullable-type-assertion-style.shot b/packages/eslint-plugin/tests/schema-snapshots/non-nullable-type-assertion-style.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/non-nullable-type-assertion-style.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/non-nullable-type-assertion-style.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-as-const.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-as-const.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/prefer-as-const.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-as-const.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-destructuring.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-destructuring.shot index 61036ced3fda..d99ed3d30301 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/prefer-destructuring.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-destructuring.shot @@ -49,6 +49,7 @@ ] }, { + "additionalProperties": false, "properties": { "enforceForDeclarationWithTypeAnnotation": { "description": "Whether to enforce destructuring on variable declarations with type annotations.", @@ -88,6 +89,5 @@ type Options = [ enforceForDeclarationWithTypeAnnotation?: boolean; /** Whether to enforce destructuring that use a different variable name than the property name. */ enforceForRenamedProperties?: boolean; - [k: string]: unknown; }, ]; diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-enum-initializers.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-enum-initializers.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/prefer-enum-initializers.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-enum-initializers.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-find.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-find.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/prefer-find.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-find.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-for-of.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-for-of.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/prefer-for-of.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-for-of.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-function-type.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-function-type.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/prefer-function-type.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-function-type.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-includes.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-includes.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/prefer-includes.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-includes.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-namespace-keyword.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-namespace-keyword.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/prefer-namespace-keyword.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-namespace-keyword.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-nullish-coalescing.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-nullish-coalescing.shot index 18b7da68ac53..5a8ea93c4ed6 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/prefer-nullish-coalescing.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-nullish-coalescing.shot @@ -29,6 +29,7 @@ "description": "Whether to ignore all (`true`) or some (an object with properties) primitive types.", "oneOf": [ { + "additionalProperties": false, "description": "Which primitives types may be ignored.", "properties": { "bigint": { @@ -95,7 +96,6 @@ type Options = [ number?: boolean; /** Ignore string primitive types. */ string?: boolean; - [k: string]: unknown; } /** Ignore all primitive types. */ | true; diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-reduce-type-parameter.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-reduce-type-parameter.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/prefer-reduce-type-parameter.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-reduce-type-parameter.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-regexp-exec.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-regexp-exec.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/prefer-regexp-exec.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-regexp-exec.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-return-this-type.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-return-this-type.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/prefer-return-this-type.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-return-this-type.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-ts-expect-error.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-ts-expect-error.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/prefer-ts-expect-error.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-ts-expect-error.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/related-getter-setter-pairs.shot b/packages/eslint-plugin/tests/schema-snapshots/related-getter-setter-pairs.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/related-getter-setter-pairs.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/related-getter-setter-pairs.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/require-await.shot b/packages/eslint-plugin/tests/schema-snapshots/require-await.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/require-await.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/require-await.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schema-snapshots/use-unknown-in-catch-callback-variable.shot b/packages/eslint-plugin/tests/schema-snapshots/use-unknown-in-catch-callback-variable.shot index 42f81875ed94..cdd9f8375858 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/use-unknown-in-catch-callback-variable.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/use-unknown-in-catch-callback-variable.shot @@ -7,4 +7,4 @@ # TYPES: /** No options declared */ -type Options = []; \ No newline at end of file +type Options = []; diff --git a/packages/eslint-plugin/tests/schemas.test.ts b/packages/eslint-plugin/tests/schemas.test.ts index 14380218c9e8..4d4e5c9b2ac3 100644 --- a/packages/eslint-plugin/tests/schemas.test.ts +++ b/packages/eslint-plugin/tests/schemas.test.ts @@ -1,4 +1,4 @@ -import { compile } from '@typescript-eslint/rule-schema-to-typescript-types'; +import { schemaToTypes } from '@typescript-eslint/rule-schema-to-typescript-types'; import * as fs from 'node:fs/promises'; import * as path from 'node:path'; import prettier from 'prettier'; @@ -41,7 +41,7 @@ const ruleEntries = Object.entries(rules); describe('Rule schemas should be convertible to TS types for documentation purposes', async () => { const PRETTIER_CONFIG = { schema: await getPrettierConfig(SCHEMA_FILEPATH), - tsType: getPrettierConfig(TS_TYPE_FILEPATH), + tsType: await getPrettierConfig(TS_TYPE_FILEPATH), }; beforeAll(async () => { @@ -83,8 +83,8 @@ describe('Rule schemas should be convertible to TS types for documentation purpo ), PRETTIER_CONFIG.schema, ); - const compilationResult = await compile( - ruleDef.meta.schema, + const compilationResult = await prettier.format( + schemaToTypes(ruleDef.meta.schema), PRETTIER_CONFIG.tsType, ); diff --git a/packages/eslint-plugin/tests/util/getConstraintInfo.test.ts b/packages/eslint-plugin/tests/util/getConstraintInfo.test.ts index 332b0373c092..c491a3a1a8e3 100644 --- a/packages/eslint-plugin/tests/util/getConstraintInfo.test.ts +++ b/packages/eslint-plugin/tests/util/getConstraintInfo.test.ts @@ -14,6 +14,7 @@ const DEFAULT_PARSER_OPTIONS = { disallowAutomaticSingleRunInference: true, filePath: path.join(FIXTURES_DIR, 'file.ts'), project: './tsconfig.json', + projectService: false, tsconfigRootDir: FIXTURES_DIR, } as const satisfies ParserOptions; diff --git a/packages/eslint-plugin/tests/util/getWrappedCode.test.ts b/packages/eslint-plugin/tests/util/getWrappedCode.test.ts index c22f9f9a3216..ecfada71d23b 100644 --- a/packages/eslint-plugin/tests/util/getWrappedCode.test.ts +++ b/packages/eslint-plugin/tests/util/getWrappedCode.test.ts @@ -1,6 +1,5 @@ import type { TSESTree } from '@typescript-eslint/utils'; -import { RuleTester } from '@typescript-eslint/rule-tester'; import * as ts from 'typescript'; import { @@ -9,16 +8,10 @@ import { getParserServices, } from '../../src/util'; import { getWrappedCode } from '../../src/util/getWrappedCode'; -import { getFixturesRootDir } from '../RuleTester'; +import { createRuleTesterWithTypes } from '../RuleTester'; -const rootPath = getFixturesRootDir(); -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootPath, - }, - }, +const ruleTester = createRuleTesterWithTypes({ + project: './tsconfig.json', }); const removeFunctionRule = createRule({ diff --git a/packages/eslint-plugin/tests/util/getWrappingFixer.test.ts b/packages/eslint-plugin/tests/util/getWrappingFixer.test.ts index 1dd7a2b929e8..e04a8725b65d 100644 --- a/packages/eslint-plugin/tests/util/getWrappingFixer.test.ts +++ b/packages/eslint-plugin/tests/util/getWrappingFixer.test.ts @@ -1,18 +1,10 @@ import type { TSESTree } from '@typescript-eslint/utils'; -import { RuleTester } from '@typescript-eslint/rule-tester'; - import { createRule, getWrappingFixer } from '../../src/util'; -import { getFixturesRootDir } from '../RuleTester'; +import { createRuleTesterWithTypes } from '../RuleTester'; -const rootPath = getFixturesRootDir(); -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootPath, - }, - }, +const ruleTester = createRuleTesterWithTypes({ + project: './tsconfig.json', }); const voidEverythingRule = createRule({ diff --git a/packages/eslint-plugin/tests/util/isNodeEqual.test.ts b/packages/eslint-plugin/tests/util/isNodeEqual.test.ts index 1177b1ac44bb..2ff8cd2baa72 100644 --- a/packages/eslint-plugin/tests/util/isNodeEqual.test.ts +++ b/packages/eslint-plugin/tests/util/isNodeEqual.test.ts @@ -1,9 +1,7 @@ import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; -import { RuleTester } from '@typescript-eslint/rule-tester'; - import { createRule, isNodeEqual } from '../../src/util'; -import { getFixturesRootDir } from '../RuleTester'; +import { createRuleTesterWithTypes } from '../RuleTester'; const rule = createRule({ create(context) { @@ -43,14 +41,8 @@ const rule = createRule({ name: 'no-useless-expression', }); -const rootPath = getFixturesRootDir(); -const ruleTester = new RuleTester({ - languageOptions: { - parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: rootPath, - }, - }, +const ruleTester = createRuleTesterWithTypes({ + project: './tsconfig.json', }); ruleTester.run('isNodeEqual', rule, { diff --git a/packages/eslint-plugin/tests/util/misc.test.ts b/packages/eslint-plugin/tests/util/misc.test.ts index 19867077e2fb..e94bca7d05f4 100644 --- a/packages/eslint-plugin/tests/util/misc.test.ts +++ b/packages/eslint-plugin/tests/util/misc.test.ts @@ -65,7 +65,7 @@ describe(misc.findLastIndex, () => { expect(misc.findLastIndex([1, 2, 3], () => true)).toBe(2); }); - it('returns the index of the last occurance of a duplicate element', () => { + it('returns the index of the last occurrence of a duplicate element', () => { expect(misc.findLastIndex([1, 2, 3, 3, 5], n => n === 3)).toBe(3); }); }); diff --git a/packages/eslint-plugin/tools/generate-breaking-changes.mts b/packages/eslint-plugin/tools/generate-breaking-changes.mts index be38bd7b1022..0d3d0b4a6b1f 100644 --- a/packages/eslint-plugin/tools/generate-breaking-changes.mts +++ b/packages/eslint-plugin/tools/generate-breaking-changes.mts @@ -1,57 +1,43 @@ -import type { - ESLintPluginRuleModule, - TypeScriptESLintRules, -} from '@typescript-eslint/eslint-plugin/use-at-your-own-risk/rules'; +import type { TypeScriptESLintRules } from '@typescript-eslint/eslint-plugin/use-at-your-own-risk/rules'; import { fetch } from 'cross-fetch'; -// markdown-table is ESM, hence this file needs to be `.mts` import { markdownTable } from 'markdown-table'; -async function main(): Promise { - const rulesImport = await import('../src/rules/index.js'); - /* - weird TS resolution which adds an additional default layer in the type like: - { default: { default: Rules }} - instead of just - { default: Rules } - */ - const rules = rulesImport.default as unknown as Record< - string, - ESLintPluginRuleModule - >; +import rulesImport from '../src/rules/index.js'; - // Annotate which rules are new since the last version - async function getNewRulesAsOfMajorVersion( - oldVersion: string, - ): Promise> { - // 1. Get the current list of rules (already done) - const newRuleNames = Object.keys(rules); +// Annotate which rules are new since the last version +async function getNewRulesAsOfMajorVersion( + oldVersion: string, +): Promise> { + // 1. Get the current list of rules (already done) + const newRuleNames = Object.keys(rulesImport); - // 2. Retrieve the old version of typescript-eslint from unpkg - const oldUrl = `https://unpkg.com/@typescript-eslint/eslint-plugin@${oldVersion}/dist/configs/all.js`; - const oldFileText = await (await fetch(oldUrl)).text(); - const oldObjectText = oldFileText.substring( - oldFileText.indexOf('{'), - oldFileText.lastIndexOf('}') + 1, - ); - // Normally we wouldn't condone using the 'eval' API... - // But this is an internal-only script and it's the easiest way to convert - // the JS raw text into a runtime object. 🤷 - let oldRulesObject!: { rules: TypeScriptESLintRules }; - eval(`oldRulesObject = ${oldObjectText}`); - const oldRuleNames = new Set(Object.keys(oldRulesObject.rules)); + // 2. Retrieve the old version of typescript-eslint from unpkg + const oldUrl = `https://unpkg.com/@typescript-eslint/eslint-plugin@${oldVersion}/dist/configs/all.js`; + const oldFileText = await (await fetch(oldUrl)).text(); + const oldObjectText = oldFileText.substring( + oldFileText.indexOf('{'), + oldFileText.lastIndexOf('}') + 1, + ); + // Normally we wouldn't condone using the 'eval' API... + // But this is an internal-only script and it's the easiest way to convert + // the JS raw text into a runtime object. 🤷 + // eslint-disable-next-line no-unassigned-vars -- assigned by eval + let oldRulesObject!: { rules: TypeScriptESLintRules }; + eval(`oldRulesObject = ${oldObjectText}`); + const oldRuleNames = new Set(Object.keys(oldRulesObject.rules)); - // 3. Get the keys that exist in (1) (new version) and not (2) (old version) - return new Set( - newRuleNames.filter( - newRuleName => !oldRuleNames.has(`@typescript-eslint/${newRuleName}`), - ), - ); - } + // 3. Get the keys that exist in (1) (new version) and not (2) (old version) + return new Set( + newRuleNames.filter( + newRuleName => !oldRuleNames.has(`@typescript-eslint/${newRuleName}`), + ), + ); +} - const newRuleNames = await getNewRulesAsOfMajorVersion('5.0.0'); +const newRuleNames = await getNewRulesAsOfMajorVersion('5.0.0'); - console.log(`## Table Key +console.log(`## Table Key @@ -132,28 +118,23 @@ async function main(): Promise { > Hint: search for 🆕 to find newly added rules, and ➕ or ➖ to see config changes. `); - console.log( - markdownTable([ - ['Rule', 'Status', 'TC', 'Ext', "Rec'd", 'Strict', 'Style'], - ...Object.entries(rules).map(([ruleName, { meta }]) => { - const { deprecated } = meta; - const { extendsBaseRule, recommended, requiresTypeChecking } = - meta.docs; - - return [ - `[\`${ruleName}\`](https://typescript-eslint.io/rules/${ruleName})`, - newRuleNames.has(ruleName) ? '🆕' : deprecated ? '💀' : '', - requiresTypeChecking ? '💭' : '', - extendsBaseRule ? '🧱' : '', - recommended === 'recommended' ? '🟩' : '', - recommended === 'strict' ? '🔵' : '', - recommended === 'stylistic' ? '🔸' : '', - ]; - }), - ]), - ); -} +console.log( + markdownTable([ + ['Rule', 'Status', 'TC', 'Ext', "Rec'd", 'Strict', 'Style'], + ...Object.entries(rulesImport).map(([ruleName, { meta }]) => { + const { deprecated } = meta; + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- all of our rules have meta.docs + const { extendsBaseRule, recommended, requiresTypeChecking } = meta.docs!; -main().catch((error: unknown) => { - console.error(error); -}); + return [ + `[\`${ruleName}\`](https://typescript-eslint.io/rules/${ruleName})`, + newRuleNames.has(ruleName) ? '🆕' : deprecated ? '💀' : '', + requiresTypeChecking ? '💭' : '', + extendsBaseRule ? '🧱' : '', + recommended === 'recommended' ? '🟩' : '', + recommended === 'strict' ? '🔵' : '', + recommended === 'stylistic' ? '🔸' : '', + ]; + }), + ]), +); diff --git a/packages/eslint-plugin/typings/eslint-rules.d.ts b/packages/eslint-plugin/typings/eslint-rules.d.ts index 5a70229dd33f..589e2a8e4fb8 100644 --- a/packages/eslint-plugin/typings/eslint-rules.d.ts +++ b/packages/eslint-plugin/typings/eslint-rules.d.ts @@ -163,7 +163,7 @@ declare module 'eslint/lib/rules/no-empty-function' { import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; const rule: TSESLint.RuleModule< - 'unexpected', + 'suggestComment' | 'unexpected', [ { allow?: string[]; @@ -345,7 +345,7 @@ declare module 'eslint/lib/rules/no-unused-expressions' { import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; const rule: TSESLint.RuleModule< - 'expected', + 'unusedExpression', [ { allowShortCircuit?: boolean; @@ -520,11 +520,11 @@ declare module 'eslint/lib/rules/prefer-destructuring' { object?: boolean; } type Option0 = + | DestructuringTypeConfig | { AssignmentExpression?: DestructuringTypeConfig; VariableDeclarator?: DestructuringTypeConfig; - } - | DestructuringTypeConfig; + }; export interface Option1 { enforceForRenamedProperties?: boolean; } @@ -554,6 +554,7 @@ declare module 'eslint/lib/rules/no-restricted-imports' { } )[]; export type ArrayOfStringOrObjectPatterns = + | string[] | { // extended allowTypeImports?: boolean; @@ -561,15 +562,14 @@ declare module 'eslint/lib/rules/no-restricted-imports' { group?: string[]; regex?: string; message?: string; - }[] - | string[]; + }[]; export type RuleListener = + | Record | { ExportAllDeclaration(node: TSESTree.ExportAllDeclaration): void; ExportNamedDeclaration(node: TSESTree.ExportNamedDeclaration): void; ImportDeclaration(node: TSESTree.ImportDeclaration): void; - } - | Record; + }; } export interface ObjectOfPathsAndPatterns { diff --git a/packages/integration-tests/fixtures/flat-config-types-@types__eslint-v9/eslint.config.js b/packages/integration-tests/fixtures/flat-config-types-@types__eslint-v9/eslint.config.js index 2a31589bc03c..6df54219e488 100644 --- a/packages/integration-tests/fixtures/flat-config-types-@types__eslint-v9/eslint.config.js +++ b/packages/integration-tests/fixtures/flat-config-types-@types__eslint-v9/eslint.config.js @@ -31,7 +31,7 @@ export default tseslint.config( }, eslint.configs.recommended, ...tseslint.configs.recommended, - stylisticPlugin.configs['recommended-flat'], + stylisticPlugin.configs.recommended, ); // wrapped in a function so they aren't executed at lint time @@ -48,7 +48,7 @@ function _otherCases() { tseslint.config( eslint.configs.recommended, ...tseslint.configs.recommended, - stylisticPlugin.configs['recommended-flat'], + stylisticPlugin.configs.recommended, vitestPlugin.configs.recommended, ); tseslint.config( diff --git a/packages/integration-tests/package.json b/packages/integration-tests/package.json index 602d44d36f8f..885cf10496e9 100644 --- a/packages/integration-tests/package.json +++ b/packages/integration-tests/package.json @@ -12,13 +12,33 @@ "homepage": "https://typescript-eslint.io", "license": "MIT", "scripts": { - "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", - "lint": "npx nx lint", - "test": "vitest --run --config=$INIT_CWD/vitest.config.mts", - "check-types": "npx nx typecheck" + "format": "yarn run -T format", + "lint": "yarn run -BT nx lint", + "test": "yarn run -BT nx test", + "typecheck": "yarn run -BT nx typecheck" }, "devDependencies": { "@vitest/coverage-v8": "^3.1.3", + "eslint": "*", "vitest": "^3.1.3" + }, + "nx": { + "name": "integration-tests", + "includedScripts": [], + "targets": { + "test": { + "dependsOn": [ + { + "projects": [ + "tag:npm:public" + ], + "target": "build" + } + ] + }, + "lint": { + "command": "eslint" + } + } } } diff --git a/packages/integration-tests/project.json b/packages/integration-tests/project.json deleted file mode 100644 index a34197dff37d..000000000000 --- a/packages/integration-tests/project.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "integration-tests", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "projectType": "library", - "root": "packages/integration-tests", - "sourceRoot": "packages/integration-tests/tools", - "implicitDependencies": ["typescript-eslint"], - "targets": { - "lint": { - "executor": "@nx/eslint:lint", - "outputs": ["{options.outputFile}"] - }, - "test": { - "executor": "@nx/vite:test" - } - } -} diff --git a/packages/integration-tests/tests/__snapshots__/flat-config-types-@types__eslint-v9.test.ts.snap b/packages/integration-tests/tests/__snapshots__/flat-config-types-@types__eslint-v9.test.ts.snap index fa2a75464d2c..6360f2c81c8b 100644 --- a/packages/integration-tests/tests/__snapshots__/flat-config-types-@types__eslint-v9.test.ts.snap +++ b/packages/integration-tests/tests/__snapshots__/flat-config-types-@types__eslint-v9.test.ts.snap @@ -76,7 +76,7 @@ export default tseslint.config( }, eslint.configs.recommended, ...tseslint.configs.recommended, - stylisticPlugin.configs['recommended-flat'], + stylisticPlugin.configs.recommended, ) // wrapped in a function so they aren't executed at lint time @@ -93,7 +93,7 @@ function _otherCases() { tseslint.config( eslint.configs.recommended, ...tseslint.configs.recommended, - stylisticPlugin.configs['recommended-flat'], + stylisticPlugin.configs.recommended, vitestPlugin.configs.recommended, ) tseslint.config( diff --git a/packages/integration-tests/tests/__snapshots__/vue-sfc.test.ts.snap b/packages/integration-tests/tests/__snapshots__/vue-sfc.test.ts.snap index 2eeb2fa46f59..47834e83db29 100644 --- a/packages/integration-tests/tests/__snapshots__/vue-sfc.test.ts.snap +++ b/packages/integration-tests/tests/__snapshots__/vue-sfc.test.ts.snap @@ -61,19 +61,19 @@ export default Vue.extend({ "usedDeprecatedRules": [ { "info": { - "availableUntil": "10.0.0", + "availableUntil": "11.0.0", "deprecatedSince": "8.53.0", "message": "Formatting rules are being moved out of ESLint core.", "replacedBy": [ { "message": "ESLint Stylistic now maintains deprecated stylistic core rules.", "plugin": { - "name": "@stylistic/eslint-plugin-js", - "url": "https://eslint.style/packages/js", + "name": "@stylistic/eslint-plugin", + "url": "https://eslint.style", }, "rule": { "name": "semi-spacing", - "url": "https://eslint.style/rules/js/semi-spacing", + "url": "https://eslint.style/rules/semi-spacing", }, "url": "https://eslint.style/guide/migration", }, @@ -81,7 +81,7 @@ export default Vue.extend({ "url": "https://eslint.org/blog/2023/10/deprecating-formatting-rules/", }, "replacedBy": [ - "@stylistic/js/semi-spacing", + "@stylistic/semi-spacing", ], "ruleId": "semi-spacing", }, @@ -123,19 +123,19 @@ export default class Utility { "usedDeprecatedRules": [ { "info": { - "availableUntil": "10.0.0", + "availableUntil": "11.0.0", "deprecatedSince": "8.53.0", "message": "Formatting rules are being moved out of ESLint core.", "replacedBy": [ { "message": "ESLint Stylistic now maintains deprecated stylistic core rules.", "plugin": { - "name": "@stylistic/eslint-plugin-js", - "url": "https://eslint.style/packages/js", + "name": "@stylistic/eslint-plugin", + "url": "https://eslint.style", }, "rule": { "name": "semi-spacing", - "url": "https://eslint.style/rules/js/semi-spacing", + "url": "https://eslint.style/rules/semi-spacing", }, "url": "https://eslint.style/guide/migration", }, @@ -143,7 +143,7 @@ export default class Utility { "url": "https://eslint.org/blog/2023/10/deprecating-formatting-rules/", }, "replacedBy": [ - "@stylistic/js/semi-spacing", + "@stylistic/semi-spacing", ], "ruleId": "semi-spacing", }, @@ -202,19 +202,19 @@ export default Vue.extend({ "usedDeprecatedRules": [ { "info": { - "availableUntil": "10.0.0", + "availableUntil": "11.0.0", "deprecatedSince": "8.53.0", "message": "Formatting rules are being moved out of ESLint core.", "replacedBy": [ { "message": "ESLint Stylistic now maintains deprecated stylistic core rules.", "plugin": { - "name": "@stylistic/eslint-plugin-js", - "url": "https://eslint.style/packages/js", + "name": "@stylistic/eslint-plugin", + "url": "https://eslint.style", }, "rule": { "name": "semi-spacing", - "url": "https://eslint.style/rules/js/semi-spacing", + "url": "https://eslint.style/rules/semi-spacing", }, "url": "https://eslint.style/guide/migration", }, @@ -222,7 +222,7 @@ export default Vue.extend({ "url": "https://eslint.org/blog/2023/10/deprecating-formatting-rules/", }, "replacedBy": [ - "@stylistic/js/semi-spacing", + "@stylistic/semi-spacing", ], "ruleId": "semi-spacing", }, diff --git a/packages/integration-tests/tools/integration-test-base.ts b/packages/integration-tests/tools/integration-test-base.ts index 8951c11c54e4..bde6a82c8ab7 100644 --- a/packages/integration-tests/tools/integration-test-base.ts +++ b/packages/integration-tests/tools/integration-test-base.ts @@ -74,14 +74,15 @@ export function eslintIntegrationTest( `"filePath": "/${path.relative(testFolder, testFile)}"`, ) .replaceAll(/C:\\\\(usr)\\\\(linked)\\\\(tsconfig.json)/g, '/$1/$2/$3'); + let lintOutput: unknown; try { - const lintOutput = JSON.parse(lintOutputRAW); - expect(lintOutput).toMatchSnapshot(); + lintOutput = JSON.parse(lintOutputRAW); } catch { throw new Error( `Lint output could not be parsed as JSON: \`${lintOutputRAW}\`.`, ); } + expect(lintOutput).toMatchSnapshot(); }); } diff --git a/packages/parser/CHANGELOG.md b/packages/parser/CHANGELOG.md index b532ad0f1e7b..c9063221465a 100644 --- a/packages/parser/CHANGELOG.md +++ b/packages/parser/CHANGELOG.md @@ -1,3 +1,147 @@ +## 8.46.4 (2025-11-10) + +This was a version bump only for parser to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.3 (2025-11-03) + +This was a version bump only for parser to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.2 (2025-10-20) + +This was a version bump only for parser to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.1 (2025-10-13) + +This was a version bump only for parser to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.0 (2025-10-06) + +This was a version bump only for parser to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.45.0 (2025-09-29) + +This was a version bump only for parser to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.44.1 (2025-09-22) + +This was a version bump only for parser to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.44.0 (2025-09-15) + +This was a version bump only for parser to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.43.0 (2025-09-08) + +This was a version bump only for parser to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.42.0 (2025-09-02) + +This was a version bump only for parser to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.41.0 (2025-08-25) + +This was a version bump only for parser to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.40.0 (2025-08-18) + +This was a version bump only for parser to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.39.1 (2025-08-11) + +This was a version bump only for parser to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.39.0 (2025-08-04) + +### 🚀 Features + +- update to TypeScript 5.9.2 ([#11445](https://github.com/typescript-eslint/typescript-eslint/pull/11445)) + +### ❤️ Thank You + +- Brad Zacher @bradzacher + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.38.0 (2025-07-21) + +This was a version bump only for parser to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.37.0 (2025-07-14) + +This was a version bump only for parser to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.36.0 (2025-07-07) + +This was a version bump only for parser to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.35.1 (2025-06-30) + +This was a version bump only for parser to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.35.0 (2025-06-23) + +This was a version bump only for parser to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.34.1 (2025-06-16) + +This was a version bump only for parser to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.34.0 (2025-06-09) + +This was a version bump only for parser to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.33.1 (2025-06-02) + +This was a version bump only for parser to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.33.0 (2025-05-26) + +This was a version bump only for parser to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + ## 8.32.1 (2025-05-12) This was a version bump only for parser to align it with other projects, there were no code changes. diff --git a/packages/parser/package.json b/packages/parser/package.json index 6fb66eac1ae8..ab5e4f8e997f 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/parser", - "version": "8.32.1", + "version": "8.46.4", "description": "An ESLint custom parser which leverages TypeScript ESTree", "files": [ "dist", @@ -39,29 +39,28 @@ "eslint" ], "scripts": { - "build": "tsc -b tsconfig.build.json", - "clean": "tsc -b tsconfig.build.json --clean", - "postclean": "rimraf dist/ coverage/", - "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", - "lint": "npx nx lint", - "test": "vitest --run --config=$INIT_CWD/vitest.config.mts", - "check-types": "npx nx typecheck" + "build": "yarn run -BT nx build", + "clean": "rimraf dist/ coverage/", + "format": "yarn run -T format", + "lint": "yarn run -BT nx lint", + "test": "yarn run -BT nx test", + "typecheck": "yarn run -BT nx typecheck" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0", - "typescript": ">=4.8.4 <5.9.0" + "typescript": ">=4.8.4 <6.0.0" }, "dependencies": { - "@typescript-eslint/scope-manager": "8.32.1", - "@typescript-eslint/types": "8.32.1", - "@typescript-eslint/typescript-estree": "8.32.1", - "@typescript-eslint/visitor-keys": "8.32.1", + "@typescript-eslint/scope-manager": "8.46.4", + "@typescript-eslint/types": "8.46.4", + "@typescript-eslint/typescript-estree": "8.46.4", + "@typescript-eslint/visitor-keys": "8.46.4", "debug": "^4.3.4" }, "devDependencies": { "@vitest/coverage-v8": "^3.1.3", + "eslint": "*", "glob": "*", - "prettier": "^3.2.5", "rimraf": "*", "typescript": "*", "vitest": "^3.1.3" @@ -69,5 +68,16 @@ "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" + }, + "nx": { + "name": "parser", + "includedScripts": [ + "clean" + ], + "targets": { + "lint": { + "command": "eslint" + } + } } } diff --git a/packages/parser/project.json b/packages/parser/project.json deleted file mode 100644 index 6b9e1efe5f09..000000000000 --- a/packages/parser/project.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "parser", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "projectType": "library", - "root": "packages/parser", - "sourceRoot": "packages/parser/src", - "targets": { - "lint": { - "executor": "@nx/eslint:lint", - "outputs": ["{options.outputFile}"] - }, - "test": { - "executor": "@nx/vite:test" - } - } -} diff --git a/packages/parser/tests/lib/parser.test.ts b/packages/parser/tests/lib/parser.test.ts index 39c072a8d42e..a36d76c11edd 100644 --- a/packages/parser/tests/lib/parser.test.ts +++ b/packages/parser/tests/lib/parser.test.ts @@ -2,24 +2,30 @@ import type { ParserOptions } from '@typescript-eslint/types'; import * as scopeManager from '@typescript-eslint/scope-manager'; import * as typescriptESTree from '@typescript-eslint/typescript-estree'; -import path from 'node:path'; import { ScriptTarget } from 'typescript'; -import { parse, parseForESLint } from '../../src/parser'; +import { parse, parseForESLint } from '../../src/parser.js'; +import { FIXTURES_DIR } from '../test-utils/test-utils.js'; describe('parser', () => { - beforeEach(() => { + afterEach(() => { vi.clearAllMocks(); }); + afterAll(() => { + vi.restoreAllMocks(); + }); + it('parse() should return just the AST from parseForESLint()', () => { const code = 'const valid = true;'; - expect(parse(code)).toEqual(parseForESLint(code).ast); + expect(parse(code)).toStrictEqual(parseForESLint(code).ast); }); it('parseForESLint() should work if options are `null`', () => { const code = 'const valid = true;'; - expect(() => parseForESLint(code, null)).not.toThrow(); + expect(() => { + parseForESLint(code, null); + }).not.toThrow(); }); it('parseAndGenerateServices() should be called with options', () => { @@ -36,7 +42,7 @@ describe('parser', () => { extraFileExtensions: ['.foo'], filePath: './isolated-file.src.ts', project: 'tsconfig.json', - tsconfigRootDir: path.join(__dirname, '..', 'fixtures', 'services'), + tsconfigRootDir: FIXTURES_DIR, }; parseForESLint(code, config); expect(spy).toHaveBeenCalledExactlyOnceWith(code, { @@ -107,7 +113,7 @@ describe('parser', () => { errorOnTypeScriptSyntacticAndSemanticIssues: false, filePath: 'isolated-file.src.ts', project: 'tsconfig.json', - tsconfigRootDir: path.join(__dirname, '..', 'fixtures', 'services'), + tsconfigRootDir: FIXTURES_DIR, }; parseForESLint(code, config); @@ -141,7 +147,7 @@ describe('parser', () => { const config: ParserOptions = { filePath: 'isolated-file.src.ts', project: 'tsconfig.json', - tsconfigRootDir: path.join(__dirname, '..', 'fixtures', 'services'), + tsconfigRootDir: FIXTURES_DIR, }; vi.spyOn( @@ -185,7 +191,7 @@ describe('parser', () => { extraFileExtensions: ['.foo'], filePath: 'isolated-file.src.ts', project: 'tsconfig.json', - tsconfigRootDir: path.join(__dirname, '..', 'fixtures', 'services'), + tsconfigRootDir: FIXTURES_DIR, }; parseForESLint(code, config); diff --git a/packages/parser/tests/lib/services.test.ts b/packages/parser/tests/lib/services.test.ts index 3719c7127e82..5db0a81f44fb 100644 --- a/packages/parser/tests/lib/services.test.ts +++ b/packages/parser/tests/lib/services.test.ts @@ -1,57 +1,58 @@ import { createProgram } from '@typescript-eslint/typescript-estree'; import * as glob from 'glob'; -import fs from 'node:fs/promises'; -import path from 'node:path'; - -import type { ParserOptions } from '../../src/parser'; +import * as fs from 'node:fs/promises'; +import * as path from 'node:path'; +import { parseForESLint } from '../../src/index.js'; import { - createSnapshotTestBlock, - formatSnapshotName, - testServices, -} from '../test-utils/test-utils'; + createConfig, + FIXTURES_DIR, + getRaw, +} from '../test-utils/test-utils.js'; //------------------------------------------------------------------------------ // Setup //------------------------------------------------------------------------------ -const FIXTURES_DIR = path.join( - __dirname, - '..', - '..', - 'tests', - 'fixtures', - 'services', -); -const testFiles = glob.sync(`**/*.src.ts`, { +const testFiles = glob.sync('**/*.src.ts', { + absolute: true, cwd: FIXTURES_DIR, }); -function createConfig(filename: string): ParserOptions { - return { - filePath: filename, - project: './tsconfig.json', - tsconfigRootDir: path.resolve(FIXTURES_DIR), - }; -} - //------------------------------------------------------------------------------ // Tests //------------------------------------------------------------------------------ -const program = createProgram(path.resolve(FIXTURES_DIR, 'tsconfig.json')); +const program = createProgram(path.join(FIXTURES_DIR, 'tsconfig.json')); describe.for(testFiles)('services', async filename => { - const code = await fs.readFile(path.join(FIXTURES_DIR, filename), { + const code = await fs.readFile(filename, { encoding: 'utf-8', }); - const config = createConfig(filename); - const snapshotName = formatSnapshotName(filename, FIXTURES_DIR, '.ts'); - it(snapshotName, createSnapshotTestBlock(code, config)); + + const { base, name } = path.parse(filename); + + const config = createConfig(base); + + const snapshotName = path.posix.join('fixtures', name); + + it(snapshotName, () => { + const { ast } = parseForESLint(code, config); + + const result = getRaw(ast); + + expect(result).toMatchSnapshot(); + }); + it(`${snapshotName} services`, () => { - testServices(code, config); + const { services } = parseForESLint(code, config); + + assert.isNotNull(services.program); }); + it(`${snapshotName} services with provided program`, () => { - testServices(code, { ...config, program }); + const { services } = parseForESLint(code, { ...config, program }); + + assert.isNotNull(services.program); }); }); diff --git a/packages/parser/tests/lib/tsx.test.ts b/packages/parser/tests/lib/tsx.test.ts index f58a859f41f7..ad7d5c8fd7f3 100644 --- a/packages/parser/tests/lib/tsx.test.ts +++ b/packages/parser/tests/lib/tsx.test.ts @@ -1,5 +1,5 @@ -import { parseForESLint } from '../../src/parser'; -import { serializer } from '../test-utils/ts-error-serializer'; +import { parseForESLint } from '../../src/index.js'; +import { serializer } from '../test-utils/ts-error-serializer.js'; //------------------------------------------------------------------------------ // Tests @@ -12,7 +12,9 @@ describe('TSX', () => { it('filePath was not provided', () => { const code = 'const element = '; - expect(() => parseForESLint(code)).toThrowErrorMatchingInlineSnapshot(` + expect(() => { + parseForESLint(code); + }).toThrowErrorMatchingInlineSnapshot(` TSError { "column": 18, "index": 18, @@ -24,22 +26,22 @@ describe('TSX', () => { it("filePath was not provided and 'jsx:true' option", () => { const code = 'const element = '; - expect(() => + expect(() => { parseForESLint(code, { ecmaFeatures: { jsx: true, }, - }), - ).not.toThrow(); + }); + }).not.toThrow(); }); it('test.ts', () => { const code = 'const element = '; - expect(() => + expect(() => { parseForESLint(code, { filePath: 'test.ts', - }), - ).toThrowErrorMatchingInlineSnapshot(` + }); + }).toThrowErrorMatchingInlineSnapshot(` TSError { "column": 18, "index": 18, @@ -52,14 +54,14 @@ describe('TSX', () => { it("test.ts with 'jsx:true' option", () => { const code = 'const element = '; - expect(() => + expect(() => { parseForESLint(code, { ecmaFeatures: { jsx: true, }, filePath: 'test.ts', - }), - ).toThrowErrorMatchingInlineSnapshot(` + }); + }).toThrowErrorMatchingInlineSnapshot(` TSError { "column": 18, "index": 18, @@ -71,23 +73,23 @@ describe('TSX', () => { it('test.tsx', () => { const code = 'const element = '; - expect(() => + expect(() => { parseForESLint(code, { filePath: 'test.tsx', - }), - ).not.toThrow(); + }); + }).not.toThrow(); }); it("test.tsx with 'jsx:false' option", () => { const code = 'const element = '; - expect(() => + expect(() => { parseForESLint(code, { ecmaFeatures: { jsx: false, }, filePath: 'test.tsx', - }), - ).not.toThrow(); + }); + }).not.toThrow(); }); }); }); diff --git a/packages/parser/tests/test-utils/test-utils.ts b/packages/parser/tests/test-utils/test-utils.ts index a286f9df4a86..1177c5923236 100644 --- a/packages/parser/tests/test-utils/test-utils.ts +++ b/packages/parser/tests/test-utils/test-utils.ts @@ -1,25 +1,35 @@ +import type { ParserOptions } from '@typescript-eslint/types'; import type { TSESTree } from '@typescript-eslint/typescript-estree'; -import type { ParserOptions } from '../../src/parser'; +import * as path from 'node:path'; -import * as parser from '../../src/parser'; +export const FIXTURES_DIR = path.join(__dirname, '..', 'fixtures', 'services'); -const defaultConfig = { +const DEFAULT_PARSER_OPTIONS = { comment: true, errorOnUnknownASTType: true, loc: true, range: true, raw: true, - sourceType: 'module' as const, + sourceType: 'module', tokens: true, -}; +} as const satisfies ParserOptions; + +export function createConfig(filename: string): ParserOptions { + return { + ...DEFAULT_PARSER_OPTIONS, + filePath: filename, + project: './tsconfig.json', + tsconfigRootDir: FIXTURES_DIR, + }; +} /** * Returns a raw copy of the given AST * @param ast the AST object * @returns copy of the AST object */ -function getRaw(ast: TSESTree.Program): TSESTree.Program { +export function getRaw(ast: TSESTree.Program): TSESTree.Program { return JSON.parse( JSON.stringify(ast, (key, value) => { if ((key === 'start' || key === 'end') && typeof value === 'number') { @@ -29,65 +39,3 @@ function getRaw(ast: TSESTree.Program): TSESTree.Program { }), ); } - -/** - * Returns a function which can be used as the callback of a Jest test() block, - * and which performs an assertion on the snapshot for the given code and config. - * @param code The source code to parse - * @param config the parser configuration - * @returns callback for Jest test() block - */ -export function createSnapshotTestBlock( - code: string, - config: ParserOptions = {}, -): () => void { - config = { ...defaultConfig, ...config }; - - /** - * @returns the AST object - */ - function parse(): TSESTree.Program { - const ast = parser.parseForESLint(code, config).ast; - return getRaw(ast); - } - - return (): void => { - try { - const result = parse(); - expect(result).toMatchSnapshot(); - } catch (error) { - /** - * If we are deliberately throwing because of encountering an unknown - * AST_NODE_TYPE, we rethrow to cause the test to fail - */ - if ((error as Error).message.includes('Unknown AST_NODE_TYPE')) { - throw error; - } - expect(parse).toThrowErrorMatchingSnapshot(); - } - }; -} - -/** - * @param code The code being parsed - * @param config The configuration object for the parser - */ -export function testServices(code: string, config: ParserOptions = {}): void { - config = { ...defaultConfig, ...config }; - - const services = parser.parseForESLint(code, config).services; - expect(services).toBeDefined(); - expect(services.program).toBeDefined(); - expect(services.esTreeNodeToTSNodeMap).toBeDefined(); - expect(services.tsNodeToESTreeNodeMap).toBeDefined(); -} - -export function formatSnapshotName( - filename: string, - fixturesDir: string, - fileExtension = '.js', -): string { - return `fixtures/${filename - .replace(`${fixturesDir}/`, '') - .replace(fileExtension, '')}`; -} diff --git a/packages/parser/tests/test-utils/ts-error-serializer.ts b/packages/parser/tests/test-utils/ts-error-serializer.ts index 9c9acca97eee..98eb146ce27d 100644 --- a/packages/parser/tests/test-utils/ts-error-serializer.ts +++ b/packages/parser/tests/test-utils/ts-error-serializer.ts @@ -1,8 +1,8 @@ -import type { Plugin } from 'pretty-format'; +import type { SnapshotSerializer } from 'vitest'; import { TSError } from '@typescript-eslint/typescript-estree'; -export const serializer: Plugin = { +export const serializer: SnapshotSerializer = { serialize(val: TSError, config, indentation, depth, refs, printer) { const format = (value: unknown): string => printer(value, config, indentation, depth + 1, refs); diff --git a/packages/project-service/CHANGELOG.md b/packages/project-service/CHANGELOG.md new file mode 100644 index 000000000000..bf9d4d7e5704 --- /dev/null +++ b/packages/project-service/CHANGELOG.md @@ -0,0 +1,155 @@ +## 8.46.4 (2025-11-10) + +This was a version bump only for project-service to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.3 (2025-11-03) + +This was a version bump only for project-service to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.2 (2025-10-20) + +This was a version bump only for project-service to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.1 (2025-10-13) + +This was a version bump only for project-service to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.0 (2025-10-06) + +This was a version bump only for project-service to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.45.0 (2025-09-29) + +This was a version bump only for project-service to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.44.1 (2025-09-22) + +This was a version bump only for project-service to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.44.0 (2025-09-15) + +This was a version bump only for project-service to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.43.0 (2025-09-08) + +This was a version bump only for project-service to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.42.0 (2025-09-02) + +This was a version bump only for project-service to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.41.0 (2025-08-25) + +This was a version bump only for project-service to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.40.0 (2025-08-18) + +This was a version bump only for project-service to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.39.1 (2025-08-11) + +This was a version bump only for project-service to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.39.0 (2025-08-04) + +### 🚀 Features + +- update to TypeScript 5.9.2 ([#11445](https://github.com/typescript-eslint/typescript-eslint/pull/11445)) + +### ❤️ Thank You + +- Brad Zacher @bradzacher + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.38.0 (2025-07-21) + +This was a version bump only for project-service to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.37.0 (2025-07-14) + +This was a version bump only for project-service to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.36.0 (2025-07-07) + +This was a version bump only for project-service to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.35.1 (2025-06-30) + +This was a version bump only for project-service to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.35.0 (2025-06-23) + +This was a version bump only for project-service to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.34.1 (2025-06-16) + +This was a version bump only for project-service to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.34.0 (2025-06-09) + +This was a version bump only for project-service to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.33.1 (2025-06-02) + +### 🩹 Fixes + +- **project-service:** add missing `typescript` peer dependency ([#11265](https://github.com/typescript-eslint/typescript-eslint/pull/11265)) + +### ❤️ Thank You + +- JounQin + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.33.0 (2025-05-26) + +### 🚀 Features + +- create standalone project-service, tsconfig-utils packages ([#11182](https://github.com/typescript-eslint/typescript-eslint/pull/11182)) + +### ❤️ Thank You + +- Josh Goldberg ✨ + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. \ No newline at end of file diff --git a/packages/project-service/LICENSE b/packages/project-service/LICENSE new file mode 100644 index 000000000000..310a18f8a6cb --- /dev/null +++ b/packages/project-service/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 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/project-service/README.md b/packages/project-service/README.md new file mode 100644 index 000000000000..cf1a671681d6 --- /dev/null +++ b/packages/project-service/README.md @@ -0,0 +1,12 @@ +# `@typescript-eslint/project-service` + +> Standalone TypeScript project service wrapper for linting. + +[![NPM Version](https://img.shields.io/npm/v/@typescript-eslint/project-service.svg?style=flat-square)](https://www.npmjs.com/package/@typescript-eslint/project-service) +[![NPM Downloads](https://img.shields.io/npm/dm/@typescript-eslint/project-service.svg?style=flat-square)](https://www.npmjs.com/package/@typescript-eslint/project-service) + +A standalone export of the "Project Service" that powers typed linting for typescript-eslint. + +> See https://typescript-eslint.io for general documentation on typescript-eslint, the tooling that allows you to run ESLint and Prettier on TypeScript code. + + diff --git a/packages/project-service/package.json b/packages/project-service/package.json new file mode 100644 index 000000000000..cff8b0af692c --- /dev/null +++ b/packages/project-service/package.json @@ -0,0 +1,75 @@ +{ + "name": "@typescript-eslint/project-service", + "version": "8.46.4", + "description": "Standalone TypeScript project service wrapper for linting.", + "files": [ + "dist", + "!*.tsbuildinfo", + "package.json", + "README.md", + "LICENSE" + ], + "type": "commonjs", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + }, + "./package.json": "./package.json" + }, + "types": "./dist/index.d.ts", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "repository": { + "type": "git", + "url": "https://github.com/typescript-eslint/typescript-eslint.git", + "directory": "packages/project-service" + }, + "bugs": { + "url": "https://github.com/typescript-eslint/typescript-eslint/issues" + }, + "homepage": "https://typescript-eslint.io", + "license": "MIT", + "keywords": [ + "eslint", + "typescript", + "estree" + ], + "scripts": { + "//": "These package scripts are mostly here for convenience. Task running is handled by Nx at the root level.", + "build": "yarn run -BT nx build", + "clean": "rimraf dist/ coverage/", + "format": "yarn run -T format", + "lint": "yarn run -BT nx lint", + "test": "yarn run -BT nx test", + "typecheck": "yarn run -BT nx typecheck" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.0.0" + }, + "dependencies": { + "@typescript-eslint/tsconfig-utils": "^8.46.4", + "@typescript-eslint/types": "^8.46.4", + "debug": "^4.3.4" + }, + "devDependencies": { + "@vitest/coverage-v8": "^3.1.3", + "rimraf": "*", + "typescript": "*", + "vitest": "^3.1.3" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "publishConfig": { + "access": "public" + }, + "nx": { + "name": "project-service", + "includedScripts": [ + "clean" + ] + } +} diff --git a/packages/typescript-estree/src/create-program/createProjectService.ts b/packages/project-service/src/createProjectService.ts similarity index 62% rename from packages/typescript-estree/src/create-program/createProjectService.ts rename to packages/project-service/src/createProjectService.ts index 26b2c5421612..ecf075ef7c5f 100644 --- a/packages/typescript-estree/src/create-program/createProjectService.ts +++ b/packages/project-service/src/createProjectService.ts @@ -1,57 +1,104 @@ -/* eslint-disable @typescript-eslint/no-empty-function -- for TypeScript APIs*/ +import type { ProjectServiceOptions } from '@typescript-eslint/types'; import type * as ts from 'typescript/lib/tsserverlibrary'; import debug from 'debug'; -import type { ProjectServiceOptions } from '../parser-options'; - -import { getParsedConfigFile } from './getParsedConfigFile'; -import { validateDefaultProjectForFilesGlob } from './validateDefaultProjectForFilesGlob'; +import { getParsedConfigFileFromTSServer } from './getParsedConfigFileFromTSServer.js'; const DEFAULT_PROJECT_MATCHED_FILES_THRESHOLD = 8; -const log = debug( - 'typescript-eslint:typescript-estree:create-program:createProjectService', -); -const logTsserverErr = debug( - 'typescript-eslint:typescript-estree:tsserver:err', -); +const log = debug('typescript-eslint:project-service:createProjectService'); +const logTsserverErr = debug('typescript-eslint:project-service:tsserver:err'); const logTsserverInfo = debug( - 'typescript-eslint:typescript-estree:tsserver:info', + 'typescript-eslint:project-service:tsserver:info', ); const logTsserverPerf = debug( - 'typescript-eslint:typescript-estree:tsserver:perf', + 'typescript-eslint:project-service:tsserver:perf', ); const logTsserverEvent = debug( - 'typescript-eslint:typescript-estree:tsserver:event', + 'typescript-eslint:project-service:tsserver:event', ); +// For TypeScript APIs that expect a function to be passed in +// eslint-disable-next-line @typescript-eslint/no-empty-function const doNothing = (): void => {}; const createStubFileWatcher = (): ts.FileWatcher => ({ close: doNothing, }); +/** + * Shortcut type to refer to TypeScript's server ProjectService. + */ export type TypeScriptProjectService = ts.server.ProjectService; -export interface ProjectServiceSettings { +/** + * A created Project Service instance, as well as metadata on its creation. + */ +export interface ProjectServiceAndMetadata { + /** + * Files allowed to be loaded from the default project, if any were specified. + */ allowDefaultProject: string[] | undefined; + + /** + * The performance.now() timestamp of the last reload of the project service. + */ lastReloadTimestamp: number; + + /** + * The maximum number of files that can be matched by the default project. + */ maximumDefaultProjectFileMatchCount: number; + + /** + * The created TypeScript Project Service instance. + */ service: TypeScriptProjectService; } -export function createProjectService( - optionsRaw: boolean | ProjectServiceOptions | undefined, - jsDocParsingMode: ts.JSDocParsingMode | undefined, - tsconfigRootDir: string | undefined, -): ProjectServiceSettings { - const optionsRawObject = typeof optionsRaw === 'object' ? optionsRaw : {}; +/** + * Settings to create a new Project Service instance with {@link createProjectService}. + */ +export interface CreateProjectServiceSettings { + /** + * Granular options to configure the project service. + */ + options?: ProjectServiceOptions; + + /** + * How aggressively (and slowly) to parse JSDoc comments. + */ + jsDocParsingMode?: ts.JSDocParsingMode; + + /** + * Root directory for the tsconfig.json file, if not the current directory. + */ + tsconfigRootDir?: string; +} + +/** + * Creates a new Project Service instance, as well as metadata on its creation. + * @param settings Settings to create a new Project Service instance. + * @returns A new Project Service instance, as well as metadata on its creation. + * @example + * ```ts + * import { createProjectService } from '@typescript-eslint/project-service'; + * + * const { service } = createProjectService(); + * + * service.openClientFile('index.ts'); + * ``` + */ +export function createProjectService({ + jsDocParsingMode, + options: optionsRaw = {}, + tsconfigRootDir, +}: CreateProjectServiceSettings = {}): ProjectServiceAndMetadata { const options = { defaultProject: 'tsconfig.json', - ...optionsRawObject, + ...optionsRaw, }; - validateDefaultProjectForFilesGlob(options.allowDefaultProject); // We import this lazily to avoid its cost for users who don't use the service // TODO: Once we drop support for TS<5.3 we can import from "typescript" directly @@ -119,7 +166,7 @@ export function createProjectService( startGroup: doNothing, }; - log('Creating project service with: %o', options); + log('Creating Project Service with: %o', options); const service = new tsserver.server.ProjectService({ cancellationToken: { isCancellationRequested: (): boolean => false }, @@ -143,26 +190,18 @@ export function createProjectService( }); log('Enabling default project: %s', options.defaultProject); - let configFile: ts.ParsedCommandLine | undefined; - try { - configFile = getParsedConfigFile( - tsserver, - options.defaultProject, - tsconfigRootDir, - ); - } catch (error) { - if (optionsRawObject.defaultProject) { - throw new Error( - `Could not read project service default project '${options.defaultProject}': ${(error as Error).message}`, - ); - } - } + const configFile = getParsedConfigFileFromTSServer( + tsserver, + options.defaultProject, + !!optionsRaw.defaultProject, + tsconfigRootDir, + ); if (configFile) { service.setCompilerOptionsForInferredProjects( // NOTE: The inferred projects API is not intended for source files when a tsconfig - // exists. There is no API that generates an InferredProjectCompilerOptions suggesting + // exists. There is no API that generates an InferredProjectCompilerOptions suggesting // it is meant for hard coded options passed in. Hard asserting as a work around. // See https://github.com/microsoft/TypeScript/blob/27bcd4cb5a98bce46c9cdd749752703ead021a4b/src/server/protocol.ts#L1904 configFile.options as ts.server.protocol.InferredProjectCompilerOptions, @@ -178,3 +217,5 @@ export function createProjectService( service, }; } + +export { type ProjectServiceOptions } from '@typescript-eslint/types'; diff --git a/packages/project-service/src/getParsedConfigFileFromTSServer.ts b/packages/project-service/src/getParsedConfigFileFromTSServer.ts new file mode 100644 index 000000000000..c2e2f83612c4 --- /dev/null +++ b/packages/project-service/src/getParsedConfigFileFromTSServer.ts @@ -0,0 +1,22 @@ +import type * as ts from 'typescript/lib/tsserverlibrary'; + +import { getParsedConfigFile } from '@typescript-eslint/tsconfig-utils'; + +export function getParsedConfigFileFromTSServer( + tsserver: typeof ts, + defaultProject: string, + throwOnFailure: boolean, + tsconfigRootDir?: string, +): ts.ParsedCommandLine | undefined { + try { + return getParsedConfigFile(tsserver, defaultProject, tsconfigRootDir); + } catch (error) { + if (throwOnFailure) { + throw new Error( + `Could not read Project Service default project '${defaultProject}': ${(error as Error).message}`, + ); + } + } + + return undefined; +} diff --git a/packages/project-service/src/index.ts b/packages/project-service/src/index.ts new file mode 100644 index 000000000000..943c04088b69 --- /dev/null +++ b/packages/project-service/src/index.ts @@ -0,0 +1 @@ +export * from './createProjectService'; diff --git a/packages/project-service/tests/createProjectService.test.ts b/packages/project-service/tests/createProjectService.test.ts new file mode 100644 index 000000000000..32fd4e971d85 --- /dev/null +++ b/packages/project-service/tests/createProjectService.test.ts @@ -0,0 +1,277 @@ +import debug from 'debug'; +import * as ts from 'typescript'; + +import { createProjectService } from '../src/createProjectService.js'; + +const mockGetParsedConfigFileFromTSServer = vi.fn(); + +vi.mock('../src/getParsedConfigFileFromTSServer.js', () => ({ + get getParsedConfigFileFromTSServer() { + return mockGetParsedConfigFileFromTSServer; + }, +})); + +const mockSetCompilerOptionsForInferredProjects = vi.fn(); +const mockSetHostConfiguration = vi.fn(); + +vi.mock(import('../src/createProjectService.js'), async importOriginal => { + const actual = await importOriginal(); + + return { + ...actual, + createProjectService: vi + .fn(actual.createProjectService) + .mockImplementation((...args) => { + const projectServiceSettings = actual.createProjectService(...args); + const service = + projectServiceSettings.service as typeof projectServiceSettings.service & { + eventHandler: ts.server.ProjectServiceEventHandler | undefined; + }; + + if (service.eventHandler) { + service.eventHandler({ + eventName: ts.server.ProjectLoadingStartEvent, + } as ts.server.ProjectLoadingStartEvent); + } + + return projectServiceSettings; + }), + }; +}); + +describe(createProjectService, () => { + const processStderrWriteSpy = vi + .spyOn(process.stderr, 'write') + .mockImplementation(() => true); + + beforeEach(() => { + // eslint-disable-next-line @typescript-eslint/no-require-imports + const { ProjectService } = require('typescript/lib/tsserverlibrary').server; + + ProjectService.prototype.setCompilerOptionsForInferredProjects = + mockSetCompilerOptionsForInferredProjects; + ProjectService.prototype.setHostConfiguration = mockSetHostConfiguration; + }); + + afterEach(() => { + debug.disable(); + vi.clearAllMocks(); + }); + + describe('defaultProject', () => { + it('sets allowDefaultProject when options.allowDefaultProject is defined', () => { + const allowDefaultProject = ['./*.js']; + + const settings = createProjectService({ + options: { allowDefaultProject }, + }); + + expect(settings.allowDefaultProject).toBe(allowDefaultProject); + }); + + it('does not set allowDefaultProject when options.allowDefaultProject is not defined', () => { + const settings = createProjectService(); + + assert.isUndefined(settings.allowDefaultProject); + }); + + it('uses the default project compiler options when options.defaultProject is set', () => { + const compilerOptions: ts.CompilerOptions = { strict: true }; + mockGetParsedConfigFileFromTSServer.mockReturnValueOnce({ + errors: [], + fileNames: [], + options: compilerOptions, + }); + + const defaultProject = 'tsconfig.eslint.json'; + + createProjectService({ + options: { + allowDefaultProject: ['file.js'], + defaultProject, + }, + }); + + expect(mockSetCompilerOptionsForInferredProjects).toHaveBeenCalledWith( + compilerOptions, + ); + + expect(mockGetParsedConfigFileFromTSServer).toHaveBeenCalledWith( + expect.any(Object), + defaultProject, + true, + undefined, + ); + }); + }); + + it('uses tsconfigRootDir as getParsedConfigFile projectDirectory when provided', async () => { + const compilerOptions: ts.CompilerOptions = { strict: true }; + const tsconfigRootDir = 'path/to/repo'; + mockGetParsedConfigFileFromTSServer.mockReturnValueOnce({ + errors: [], + fileNames: [], + options: compilerOptions, + }); + + const { service } = createProjectService({ + options: { allowDefaultProject: ['file.js'] }, + tsconfigRootDir, + }); + + expect(service.setCompilerOptionsForInferredProjects).toHaveBeenCalledWith( + compilerOptions, + ); + + expect(mockGetParsedConfigFileFromTSServer).toHaveBeenCalledWith( + (await import('typescript/lib/tsserverlibrary.js')).default, + 'tsconfig.json', + false, + tsconfigRootDir, + ); + }); + + it('uses the default projects error debugger for error messages when enabled', () => { + debug.enable('typescript-eslint:project-service:tsserver:err'); + const { service } = createProjectService(); + + service.logger.msg('foo', ts.server.Msg.Err); + + const newLocal = service.logger.loggingEnabled(); + expect(newLocal).toBe(true); + expect(processStderrWriteSpy).toHaveBeenCalledWith( + expect.stringMatching( + /^.*typescript-eslint:project-service:tsserver:err foo\n$/, + ), + ); + }); + + it('does not use the default projects error debugger for error messages when disabled', () => { + const { service } = createProjectService(); + + service.logger.msg('foo', ts.server.Msg.Err); + + expect(service.logger.loggingEnabled()).toBe(false); + expect(processStderrWriteSpy).not.toHaveBeenCalled(); + }); + + it('uses the default projects info debugger for info messages when enabled', () => { + debug.enable('typescript-eslint:project-service:tsserver:info'); + + const { service } = createProjectService(); + + service.logger.info('foo'); + + expect(service.logger.loggingEnabled()).toBe(true); + expect(processStderrWriteSpy).toHaveBeenCalledWith( + expect.stringMatching( + /^.*typescript-eslint:project-service:tsserver:info foo\n$/, + ), + ); + }); + + it('does not use the default projects info debugger for info messages when disabled', () => { + const { service } = createProjectService(); + + service.logger.info('foo'); + + expect(service.logger.loggingEnabled()).toBe(false); + expect(processStderrWriteSpy).not.toHaveBeenCalled(); + }); + + it('uses the default projects perf debugger for perf messages when enabled', () => { + debug.enable('typescript-eslint:project-service:tsserver:perf'); + const { service } = createProjectService(); + + service.logger.perftrc('foo'); + + expect(service.logger.loggingEnabled()).toBe(true); + expect(processStderrWriteSpy).toHaveBeenCalledWith( + expect.stringMatching( + /^.*typescript-eslint:project-service:tsserver:perf foo\n$/, + ), + ); + }); + + it('does not use the default projects perf debugger for perf messages when disabled', () => { + const { service } = createProjectService(); + + service.logger.perftrc('foo'); + + expect(service.logger.loggingEnabled()).toBe(false); + expect(processStderrWriteSpy).not.toHaveBeenCalled(); + }); + + it('enables all log levels for the default projects logger', () => { + const { service } = createProjectService(); + + expect(service.logger.hasLevel(ts.server.LogLevel.terse)).toBe(true); + expect(service.logger.hasLevel(ts.server.LogLevel.normal)).toBe(true); + expect(service.logger.hasLevel(ts.server.LogLevel.requestTime)).toBe(true); + expect(service.logger.hasLevel(ts.server.LogLevel.verbose)).toBe(true); + }); + + it('does not return a log filename with the default projects logger', () => { + const { service } = createProjectService(); + + assert.isUndefined(service.logger.getLogFileName()); + }); + + it('uses the default projects event debugger for event handling when enabled', () => { + debug.enable('typescript-eslint:project-service:tsserver:event'); + + createProjectService(); + + expect(processStderrWriteSpy).toHaveBeenCalledWith( + expect.stringMatching( + /^.*typescript-eslint:project-service:tsserver:event { eventName: 'projectLoadingStart' }\n$/, + ), + ); + }); + + it('does not use the default projects event debugger for event handling when disabled', () => { + createProjectService(); + + expect(processStderrWriteSpy).not.toHaveBeenCalled(); + }); + + it('provides a stub require to the host system when loadTypeScriptPlugins is falsy', () => { + const { service } = createProjectService({}); + + const required = service.host.require?.('', ''); + + expect(required).toStrictEqual({ + error: { + message: + 'TypeScript plugins are not required when using parserOptions.projectService.', + }, + module: undefined, + }); + }); + + it('does not provide a require to the host system when loadTypeScriptPlugins is truthy', async () => { + const { service } = createProjectService({ + options: { loadTypeScriptPlugins: true }, + }); + + expect(service.host.require).toBe( + ( + await vi.importActual>>( + 'typescript/lib/tsserverlibrary.js', + ) + ).sys.require, + ); + }); + + it('sets a host configuration', () => { + createProjectService({ + options: { allowDefaultProject: ['file.js'] }, + }); + + expect(mockSetHostConfiguration).toHaveBeenCalledWith({ + preferences: { + includePackageJsonAutoImports: 'off', + }, + }); + }); +}); diff --git a/packages/project-service/tests/getParsedConfigFileFromTSServer.test.ts b/packages/project-service/tests/getParsedConfigFileFromTSServer.test.ts new file mode 100644 index 000000000000..422ac4e743e5 --- /dev/null +++ b/packages/project-service/tests/getParsedConfigFileFromTSServer.test.ts @@ -0,0 +1,61 @@ +import type * as ts from 'typescript/lib/tsserverlibrary'; + +import { getParsedConfigFileFromTSServer } from '../src/getParsedConfigFileFromTSServer.js'; + +const mockGetParsedConfigFile = vi.fn(); + +vi.mock('@typescript-eslint/tsconfig-utils', () => ({ + get getParsedConfigFile() { + return mockGetParsedConfigFile; + }, +})); + +const mockConfigFile = { + fileNames: [], +}; + +const mockTSServer = {} as unknown as typeof ts; +const mockTSConfigRootDir = '/mock/tsconfig/root/dir'; + +describe(getParsedConfigFileFromTSServer, () => { + it('returns the parsed config file when getParsedConfigFile succeeds', () => { + mockGetParsedConfigFile.mockReturnValueOnce(mockConfigFile); + + const actual = getParsedConfigFileFromTSServer( + mockTSServer, + 'tsconfig.json', + false, + mockTSConfigRootDir, + ); + + expect(actual).toBe(mockConfigFile); + }); + + it('returns undefined when getParsedConfigFile fails and throwOnFailure is false', () => { + mockGetParsedConfigFile.mockImplementationOnce(() => { + throw new Error('Oh no!'); + }); + + const actual = getParsedConfigFileFromTSServer( + mockTSServer, + 'tsconfig.json', + false, + ); + + expect(actual).toBeUndefined(); + }); + + it('throws the error when getParsedConfigFile fails and throwOnFailure is true', () => { + mockGetParsedConfigFile.mockImplementationOnce(() => { + throw new Error('Oh no!'); + }); + + expect(() => + getParsedConfigFileFromTSServer(mockTSServer, 'tsconfig.json', true), + ).toThrow( + new Error( + `Could not read Project Service default project 'tsconfig.json': Oh no!`, + ), + ); + }); +}); diff --git a/packages/project-service/tsconfig.build.json b/packages/project-service/tsconfig.build.json new file mode 100644 index 000000000000..d42ee3d2bef0 --- /dev/null +++ b/packages/project-service/tsconfig.build.json @@ -0,0 +1,12 @@ +{ + "extends": "../../tsconfig.build.json", + "compilerOptions": {}, + "references": [ + { + "path": "../tsconfig-utils/tsconfig.build.json" + }, + { + "path": "../types/tsconfig.build.json" + } + ] +} diff --git a/packages/project-service/tsconfig.json b/packages/project-service/tsconfig.json new file mode 100644 index 000000000000..8029bc0ac19d --- /dev/null +++ b/packages/project-service/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "../../tsconfig.base.json", + "files": [], + "include": [], + "references": [ + { + "path": "../tsconfig-utils" + }, + { + "path": "../types" + }, + { + "path": "./tsconfig.build.json" + }, + { + "path": "./tsconfig.spec.json" + } + ] +} diff --git a/packages/project-service/tsconfig.spec.json b/packages/project-service/tsconfig.spec.json new file mode 100644 index 000000000000..ea9b824aaa01 --- /dev/null +++ b/packages/project-service/tsconfig.spec.json @@ -0,0 +1,14 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "outDir": "../../dist/packages/project-service" + }, + "references": [ + { + "path": "./tsconfig.build.json" + }, + { + "path": "../../tsconfig.spec.json" + } + ] +} diff --git a/packages/project-service/vitest.config.mts b/packages/project-service/vitest.config.mts new file mode 100644 index 000000000000..e2307404d05d --- /dev/null +++ b/packages/project-service/vitest.config.mts @@ -0,0 +1,21 @@ +import * as path from 'node:path'; +import { defineConfig, mergeConfig } from 'vitest/config'; + +import { vitestBaseConfig } from '../../vitest.config.base.mjs'; +import packageJson from './package.json' with { type: 'json' }; + +const vitestConfig = mergeConfig( + vitestBaseConfig, + + defineConfig({ + root: import.meta.dirname, + + test: { + dir: path.join(import.meta.dirname, 'tests'), + name: packageJson.name.replace('@typescript-eslint/', ''), + root: import.meta.dirname, + }, + }), +); + +export default vitestConfig; diff --git a/packages/rule-schema-to-typescript-types/CHANGELOG.md b/packages/rule-schema-to-typescript-types/CHANGELOG.md index dbf54e916065..d240d23a74b3 100644 --- a/packages/rule-schema-to-typescript-types/CHANGELOG.md +++ b/packages/rule-schema-to-typescript-types/CHANGELOG.md @@ -1,3 +1,149 @@ +## 8.46.4 (2025-11-10) + +This was a version bump only for rule-schema-to-typescript-types to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.3 (2025-11-03) + +This was a version bump only for rule-schema-to-typescript-types to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.2 (2025-10-20) + +This was a version bump only for rule-schema-to-typescript-types to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.1 (2025-10-13) + +This was a version bump only for rule-schema-to-typescript-types to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.0 (2025-10-06) + +### 🚀 Features + +- **rule-schema-to-typescript-types:** clean up and make public ([#11633](https://github.com/typescript-eslint/typescript-eslint/pull/11633)) + +### ❤️ Thank You + +- Josh Goldberg ✨ + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.45.0 (2025-09-29) + +This was a version bump only for rule-schema-to-typescript-types to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.44.1 (2025-09-22) + +This was a version bump only for rule-schema-to-typescript-types to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.44.0 (2025-09-15) + +This was a version bump only for rule-schema-to-typescript-types to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.43.0 (2025-09-08) + +This was a version bump only for rule-schema-to-typescript-types to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.42.0 (2025-09-02) + +This was a version bump only for rule-schema-to-typescript-types to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.41.0 (2025-08-25) + +### 🩹 Fixes + +- **deps:** update dependency prettier to v3.6.2 ([#11496](https://github.com/typescript-eslint/typescript-eslint/pull/11496)) + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.40.0 (2025-08-18) + +This was a version bump only for rule-schema-to-typescript-types to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.39.1 (2025-08-11) + +This was a version bump only for rule-schema-to-typescript-types to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.39.0 (2025-08-04) + +This was a version bump only for rule-schema-to-typescript-types to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.38.0 (2025-07-21) + +This was a version bump only for rule-schema-to-typescript-types to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.37.0 (2025-07-14) + +This was a version bump only for rule-schema-to-typescript-types to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.36.0 (2025-07-07) + +This was a version bump only for rule-schema-to-typescript-types to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.35.1 (2025-06-30) + +This was a version bump only for rule-schema-to-typescript-types to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.35.0 (2025-06-23) + +This was a version bump only for rule-schema-to-typescript-types to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.34.1 (2025-06-16) + +This was a version bump only for rule-schema-to-typescript-types to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.34.0 (2025-06-09) + +This was a version bump only for rule-schema-to-typescript-types to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.33.1 (2025-06-02) + +This was a version bump only for rule-schema-to-typescript-types to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.33.0 (2025-05-26) + +This was a version bump only for rule-schema-to-typescript-types to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + ## 8.32.1 (2025-05-12) This was a version bump only for rule-schema-to-typescript-types to align it with other projects, there were no code changes. diff --git a/packages/rule-schema-to-typescript-types/package.json b/packages/rule-schema-to-typescript-types/package.json index 513496d1e58e..e6313346d319 100644 --- a/packages/rule-schema-to-typescript-types/package.json +++ b/packages/rule-schema-to-typescript-types/package.json @@ -1,8 +1,8 @@ { "name": "@typescript-eslint/rule-schema-to-typescript-types", - "version": "8.32.1", - "private": true, - "type": "commonjs", + "version": "8.46.4", + "description": "Converts ESLint rule schemas to equivalent TypeScript type strings.", + "type": "module", "exports": { ".": { "types": "./index.d.ts", @@ -24,25 +24,41 @@ "homepage": "https://typescript-eslint.io", "license": "MIT", "scripts": { - "build": "tsc -b tsconfig.build.json", - "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", - "lint": "npx nx lint", - "test": "vitest --run --config=$INIT_CWD/vitest.config.mts", - "check-types": "npx nx typecheck" + "build": "yarn run -BT nx build", + "clean": "rimraf dist/ coverage/", + "format": "yarn run -T format", + "lint": "yarn run -BT nx lint", + "test": "yarn run -BT nx test", + "typecheck": "yarn run -BT nx typecheck" }, "dependencies": { - "@typescript-eslint/type-utils": "8.32.1", - "@typescript-eslint/utils": "8.32.1", - "natural-compare": "^1.4.0", - "prettier": "^3.2.5" + "@typescript-eslint/type-utils": "8.46.4", + "@typescript-eslint/utils": "8.46.4", + "natural-compare": "^1.4.0" }, "devDependencies": { "@vitest/coverage-v8": "^3.1.3", + "eslint": "*", + "rimraf": "*", "typescript": "*", "vitest": "^3.1.3" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" + }, + "publishConfig": { + "access": "public" + }, + "nx": { + "name": "rule-schema-to-typescript-types", + "includedScripts": [ + "clean" + ], + "targets": { + "lint": { + "command": "eslint" + } + } } } diff --git a/packages/rule-schema-to-typescript-types/project.json b/packages/rule-schema-to-typescript-types/project.json deleted file mode 100644 index 283f31ed4538..000000000000 --- a/packages/rule-schema-to-typescript-types/project.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name": "rule-schema-to-typescript-types", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "projectType": "library", - "root": "packages/rule-schema-to-typescript-types", - "sourceRoot": "packages/rule-schema-to-typescript-types/src", - "targets": { - "lint": { - "executor": "@nx/eslint:lint", - "outputs": ["{options.outputFile}"] - } - } -} diff --git a/packages/rule-schema-to-typescript-types/src/generateArrayType.ts b/packages/rule-schema-to-typescript-types/src/generateArrayType.ts index 54c1499f8a6c..e86e51f72dce 100644 --- a/packages/rule-schema-to-typescript-types/src/generateArrayType.ts +++ b/packages/rule-schema-to-typescript-types/src/generateArrayType.ts @@ -5,11 +5,17 @@ import type { import { TSUtils } from '@typescript-eslint/utils'; -import type { ArrayAST, AST, RefMap, TupleAST, UnionAST } from './types'; +import type { + ArrayAST, + SchemaAST, + RefMap, + TupleAST, + UnionAST, +} from './types.js'; -import { NotSupportedError, UnexpectedError } from './errors'; -import { generateType } from './generateType'; -import { getCommentLines } from './getCommentLines'; +import { NotSupportedError, UnexpectedError } from './errors.js'; +import { generateType } from './generateType.js'; +import { getCommentLines } from './getCommentLines.js'; /** * If there are more than 20 tuple items then we will not make it a tuple type @@ -95,7 +101,7 @@ export function generateArrayType( const b: B = ['a', undefined, 'c'] // TS error */ const cumulativeTypesList = itemTypes.slice(0, minItems); - const typesToUnion: AST[] = []; + const typesToUnion: SchemaAST[] = []; if (cumulativeTypesList.length > 0) { // actually has minItems, so add the initial state typesToUnion.push(createTupleType(cumulativeTypesList)); @@ -131,8 +137,8 @@ export function generateArrayType( } function createTupleType( - elements: AST[], - spreadType: AST | null = null, + elements: SchemaAST[], + spreadType: SchemaAST | null = null, ): TupleAST { return { type: 'tuple', diff --git a/packages/rule-schema-to-typescript-types/src/generateObjectType.ts b/packages/rule-schema-to-typescript-types/src/generateObjectType.ts index 61a88a4f1e8c..1d2592f62aff 100644 --- a/packages/rule-schema-to-typescript-types/src/generateObjectType.ts +++ b/packages/rule-schema-to-typescript-types/src/generateObjectType.ts @@ -3,10 +3,10 @@ import type { JSONSchema4ObjectSchema } from '@typescript-eslint/utils/json-sche import { requiresQuoting } from '@typescript-eslint/type-utils'; import { TSUtils } from '@typescript-eslint/utils'; -import type { AST, ObjectAST, RefMap } from './types'; +import type { SchemaAST, ObjectAST, RefMap } from './types.js'; -import { generateType } from './generateType'; -import { getCommentLines } from './getCommentLines'; +import { generateType } from './generateType.js'; +import { getCommentLines } from './getCommentLines.js'; export function generateObjectType( schema: JSONSchema4ObjectSchema, @@ -14,7 +14,7 @@ export function generateObjectType( ): ObjectAST { const commentLines = getCommentLines(schema); - let indexSignature: AST | null = null; + let indexSignature: SchemaAST | null = null; if ( schema.additionalProperties === true || // eslint-disable-next-line @typescript-eslint/internal/eqeq-nullish diff --git a/packages/rule-schema-to-typescript-types/src/generateType.ts b/packages/rule-schema-to-typescript-types/src/generateType.ts index 00d4e0d6e9c0..f5ef138ce3a0 100644 --- a/packages/rule-schema-to-typescript-types/src/generateType.ts +++ b/packages/rule-schema-to-typescript-types/src/generateType.ts @@ -2,13 +2,13 @@ import type { JSONSchema4 } from '@typescript-eslint/utils/json-schema'; import { TSUtils } from '@typescript-eslint/utils'; -import type { AST, RefMap } from './types'; +import type { SchemaAST, RefMap } from './types.js'; -import { NotSupportedError, UnexpectedError } from './errors'; -import { generateArrayType } from './generateArrayType'; -import { generateObjectType } from './generateObjectType'; -import { generateUnionType } from './generateUnionType'; -import { getCommentLines } from './getCommentLines'; +import { NotSupportedError, UnexpectedError } from './errors.js'; +import { generateArrayType } from './generateArrayType.js'; +import { generateObjectType } from './generateObjectType.js'; +import { generateUnionType } from './generateUnionType.js'; +import { getCommentLines } from './getCommentLines.js'; // keywords we probably should support but currently do not support const UNSUPPORTED_KEYWORDS = new Set([ @@ -22,7 +22,7 @@ const UNSUPPORTED_KEYWORDS = new Set([ 'patternProperties', ]); -export function generateType(schema: JSONSchema4, refMap: RefMap): AST { +export function generateType(schema: JSONSchema4, refMap: RefMap): SchemaAST { const unsupportedProps = Object.keys(schema).filter(key => UNSUPPORTED_KEYWORDS.has(key), ); diff --git a/packages/rule-schema-to-typescript-types/src/generateUnionType.ts b/packages/rule-schema-to-typescript-types/src/generateUnionType.ts index ced5d9bf63aa..6370abf3a8e1 100644 --- a/packages/rule-schema-to-typescript-types/src/generateUnionType.ts +++ b/packages/rule-schema-to-typescript-types/src/generateUnionType.ts @@ -3,20 +3,20 @@ import type { JSONSchema4Type, } from '@typescript-eslint/utils/json-schema'; -import type { AST, RefMap, UnionAST } from './types'; +import type { SchemaAST, RefMap, UnionAST } from './types.js'; -import { NotSupportedError } from './errors'; -import { generateType } from './generateType'; +import { NotSupportedError } from './errors.js'; +import { generateType } from './generateType.js'; export function generateUnionType( members: (JSONSchema4 | JSONSchema4Type)[], refMap: RefMap, ): UnionAST { - const elements: AST[] = []; + const elements: SchemaAST[] = []; for (const memberSchema of members) { elements.push( - ((): AST => { + ((): SchemaAST => { switch (typeof memberSchema) { case 'string': return { diff --git a/packages/rule-schema-to-typescript-types/src/index.ts b/packages/rule-schema-to-typescript-types/src/index.ts index e046d9ced2c6..d61da632a371 100644 --- a/packages/rule-schema-to-typescript-types/src/index.ts +++ b/packages/rule-schema-to-typescript-types/src/index.ts @@ -1,39 +1,34 @@ import type { JSONSchema4 } from '@typescript-eslint/utils/json-schema'; import { TSUtils } from '@typescript-eslint/utils'; -import prettier from 'prettier'; -import type { AST } from './types'; +import type { SchemaAST } from './types.js'; -import { generateType } from './generateType'; -import { optimizeAST } from './optimizeAST'; -import { printTypeAlias } from './printAST'; +import { generateType } from './generateType.js'; +import { optimizeAST } from './optimizeAST.js'; +import { printTypeAlias } from './printAST.js'; -export async function compile( - schemaIn: JSONSchema4 | readonly JSONSchema4[], - prettierConfig: Promise, -): Promise { - const { isArraySchema, schema } = (() => { - if (TSUtils.isArray(schemaIn)) { - return { - isArraySchema: true, - schema: schemaIn, - }; - } - return { - isArraySchema: false, - schema: [schemaIn], - }; - })(); +/** + * Converts rule options schema(s) to the equivalent TypeScript type string. + * + * @param schema Original rule schema(s) as declared in `meta.schema`. + * @returns Stringified TypeScript type(s) equivalent to the options schema(s). + */ +export function schemaToTypes( + schema: JSONSchema4 | readonly JSONSchema4[], +): string { + const [isArraySchema, schemaNormalized] = TSUtils.isArray(schema) + ? [true, schema] + : [false, [schema]]; - if (schema.length === 0) { + if (schemaNormalized.length === 0) { return ['/** No options declared */', 'type Options = [];'].join('\n'); } const refTypes: string[] = []; - const types: AST[] = []; - for (let i = 0; i < schema.length; i += 1) { - const result = compileSchema(schema[i], i); + const types: SchemaAST[] = []; + for (let i = 0; i < schemaNormalized.length; i += 1) { + const result = compileSchema(schemaNormalized[i], i); refTypes.push(...result.refTypes); types.push(result.type); } @@ -47,21 +42,13 @@ export async function compile( }) : printTypeAlias('Options', types[0]); - const unformattedCode = [...refTypes, optionsType].join('\n\n'); - try { - return await prettier.format(unformattedCode, await prettierConfig); - } catch (e) { - if (e instanceof Error) { - e.message += `\n\nUnformatted Code:\n${unformattedCode}`; - } - throw e; - } + return [...refTypes, optionsType].join('\n\n'); } function compileSchema( schema: JSONSchema4, index: number, -): { refTypes: string[]; type: AST } { +): { refTypes: string[]; type: SchemaAST } { const refTypes: string[] = []; const refMap = new Map(); diff --git a/packages/rule-schema-to-typescript-types/src/optimizeAST.ts b/packages/rule-schema-to-typescript-types/src/optimizeAST.ts index 14a0fd1c778a..0ec3626a46cd 100644 --- a/packages/rule-schema-to-typescript-types/src/optimizeAST.ts +++ b/packages/rule-schema-to-typescript-types/src/optimizeAST.ts @@ -1,6 +1,6 @@ -import type { AST, UnionAST } from './types'; +import type { SchemaAST, UnionAST } from './types.js'; -export function optimizeAST(ast: AST | null): void { +export function optimizeAST(ast: SchemaAST | null): void { if (ast == null) { return; } @@ -40,7 +40,7 @@ export function optimizeAST(ast: AST | null): void { } // hacky way to deduplicate union members - const uniqueElementsMap = new Map(); + const uniqueElementsMap = new Map(); for (const element of elements) { uniqueElementsMap.set(JSON.stringify(element), element); } @@ -53,8 +53,8 @@ export function optimizeAST(ast: AST | null): void { } } -function unwrapUnions(union: UnionAST): AST[] { - const elements: AST[] = []; +function unwrapUnions(union: UnionAST): SchemaAST[] { + const elements: SchemaAST[] = []; for (const element of union.elements) { if (element.type === 'union') { elements.push(...unwrapUnions(element)); diff --git a/packages/rule-schema-to-typescript-types/src/printAST.ts b/packages/rule-schema-to-typescript-types/src/printAST.ts index 746d0b850b0c..a618b903a5d0 100644 --- a/packages/rule-schema-to-typescript-types/src/printAST.ts +++ b/packages/rule-schema-to-typescript-types/src/printAST.ts @@ -1,12 +1,12 @@ import naturalCompare from 'natural-compare'; -import type { AST, TupleAST } from './types'; +import type { SchemaAST, TupleAST } from './types.js'; -export function printTypeAlias(aliasName: string, ast: AST): string { +export function printTypeAlias(aliasName: string, ast: SchemaAST): string { return `${printComment(ast)}type ${aliasName} = ${printAST(ast).code}`; } -export function printASTWithComment(ast: AST): string { +export function printASTWithComment(ast: SchemaAST): string { const result = printAST(ast); return `${printComment(result)}${result.code}`; } @@ -36,7 +36,7 @@ interface CodeWithComments { code: string; commentLines: string[]; } -function printAST(ast: AST): CodeWithComments { +function printAST(ast: SchemaAST): CodeWithComments { switch (ast.type) { case 'array': { const code = printAndMaybeParenthesise(ast.elementType); @@ -124,7 +124,7 @@ function printAST(ast: AST): CodeWithComments { interface Element { code: string; - element: AST; + element: SchemaAST; } function compareElements(a: Element, b: Element): number { if (a.element.type !== b.element.type) { @@ -153,7 +153,7 @@ function compareElements(a: Element, b: Element): number { } } -function printAndMaybeParenthesise(ast: AST): CodeWithComments { +function printAndMaybeParenthesise(ast: SchemaAST): CodeWithComments { const printed = printAST(ast); if (ast.type === 'union') { return { diff --git a/packages/rule-schema-to-typescript-types/src/types.ts b/packages/rule-schema-to-typescript-types/src/types.ts index 9edcbf0b404c..e2026a4e8917 100644 --- a/packages/rule-schema-to-typescript-types/src/types.ts +++ b/packages/rule-schema-to-typescript-types/src/types.ts @@ -1,3 +1,6 @@ +/** + * Maps ref paths to generated type names. + */ export type RefMap = ReadonlyMap< // ref path string, @@ -5,7 +8,10 @@ export type RefMap = ReadonlyMap< string >; -export type AST = +/** + * Minimal representation of the nodes in a schema being compiled to types. + */ +export type SchemaAST = | ArrayAST | LiteralAST | ObjectAST @@ -13,37 +19,37 @@ export type AST = | TypeReferenceAST | UnionAST; -interface BaseASTNode { +export interface BaseSchemaASTNode { readonly commentLines: string[]; } -export interface ArrayAST extends BaseASTNode { - readonly elementType: AST; +export interface ArrayAST extends BaseSchemaASTNode { + readonly elementType: SchemaAST; readonly type: 'array'; } -export interface LiteralAST extends BaseASTNode { +export interface LiteralAST extends BaseSchemaASTNode { readonly code: string; readonly type: 'literal'; } -export interface ObjectAST extends BaseASTNode { - readonly indexSignature: AST | null; +export interface ObjectAST extends BaseSchemaASTNode { + readonly indexSignature: SchemaAST | null; readonly properties: { readonly name: string; readonly optional: boolean; - readonly type: AST; + readonly type: SchemaAST; }[]; readonly type: 'object'; } -export interface TupleAST extends BaseASTNode { - readonly elements: AST[]; - readonly spreadType: AST | null; +export interface TupleAST extends BaseSchemaASTNode { + readonly elements: SchemaAST[]; + readonly spreadType: SchemaAST | null; readonly type: 'tuple'; } -export interface TypeReferenceAST extends BaseASTNode { +export interface TypeReferenceAST extends BaseSchemaASTNode { readonly type: 'type-reference'; readonly typeName: string; } -export interface UnionAST extends BaseASTNode { - readonly elements: AST[]; +export interface UnionAST extends BaseSchemaASTNode { + readonly elements: SchemaAST[]; readonly type: 'union'; } diff --git a/packages/rule-schema-to-typescript-types/tests/index.test.ts b/packages/rule-schema-to-typescript-types/tests/index.test.ts new file mode 100644 index 000000000000..49db40f209f7 --- /dev/null +++ b/packages/rule-schema-to-typescript-types/tests/index.test.ts @@ -0,0 +1,148 @@ +import { schemaToTypes } from '../src/index.js'; + +describe(schemaToTypes, () => { + it('returns a [] type when the schema is an empty array', () => { + const actual = schemaToTypes([]); + + expect(actual).toMatchInlineSnapshot(` + "/** No options declared */ + type Options = [];" + `); + }); + + it('returns a single Options type when the schema is not an array', () => { + const actual = schemaToTypes({ type: 'string' }); + + expect(actual).toMatchInlineSnapshot(`"type Options = string"`); + }); + + it('returns an array Options type when the schema is an array', () => { + const actual = schemaToTypes([{ type: 'string' }]); + + expect(actual).toMatchInlineSnapshot(`"type Options = [string]"`); + }); + + it('returns a complex Options type when the schema contains an array of items', () => { + const actual = schemaToTypes([ + { + items: [{ type: 'string' }], + type: 'array', + }, + ]); + + expect(actual).toMatchInlineSnapshot(` + "type Options = [ | [] + | [string]]" + `); + }); + + it('returns a complex Options type when the schema is nested', () => { + const actual = schemaToTypes([ + { + description: 'My schema items.', + items: { type: 'string' }, + type: 'array', + }, + ]); + + expect(actual).toMatchInlineSnapshot(` + "type Options = [/** My schema items. */ + string[]]" + `); + }); + + it('factors in one $ref property when a $defs property exists at the top level', () => { + const actual = schemaToTypes([ + { + $defs: { + defOption: { + enum: ['a', 'b'], + type: 'string', + }, + }, + additionalProperties: false, + properties: { + one: { + $ref: '#/items/0/$defs/defOption', + }, + }, + type: 'object', + }, + ]); + + expect(actual).toMatchInlineSnapshot(` + "type DefOption = | 'a' + | 'b' + + type Options = [{ + one?: DefOption}]" + `); + }); + + it('factors in one $ref property when a definitions property exists at the top level', () => { + const actual = schemaToTypes([ + { + additionalProperties: false, + definitions: { + defOption: { + enum: ['a', 'b'], + type: 'string', + }, + }, + properties: { + one: { + $ref: '#/items/0/$defs/defOption', + }, + }, + type: 'object', + }, + ]); + + expect(actual).toMatchInlineSnapshot(` + "type DefOption = | 'a' + | 'b' + + type Options = [{ + one?: DefOption}]" + `); + }); + + it('factors in two $ref properties when two $defs properties exist at the top level', () => { + const actual = schemaToTypes([ + { + $defs: { + defOptionOne: { + enum: ['a', 'b'], + type: 'string', + }, + defOptionTwo: { + enum: ['c', 'd'], + type: 'string', + }, + }, + additionalProperties: false, + properties: { + one: { + $ref: '#/items/0/$defs/defOptionOne', + }, + two: { + $ref: '#/items/0/$defs/defOptionTwo', + }, + }, + type: 'object', + }, + ]); + + expect(actual).toMatchInlineSnapshot(` + "type DefOptionOne = | 'a' + | 'b' + + type DefOptionTwo = | 'c' + | 'd' + + type Options = [{ + one?: DefOptionOne; + two?: DefOptionTwo}]" + `); + }); +}); diff --git a/packages/rule-tester/CHANGELOG.md b/packages/rule-tester/CHANGELOG.md index 74caa908f29f..2ceadf00ab3c 100644 --- a/packages/rule-tester/CHANGELOG.md +++ b/packages/rule-tester/CHANGELOG.md @@ -1,3 +1,165 @@ +## 8.46.4 (2025-11-10) + +This was a version bump only for rule-tester to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.3 (2025-11-03) + +This was a version bump only for rule-tester to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.2 (2025-10-20) + +This was a version bump only for rule-tester to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.1 (2025-10-13) + +This was a version bump only for rule-tester to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.0 (2025-10-06) + +### 🩹 Fixes + +- **rule-tester:** deprecate TestCaseError#type and LintMessage#nodeType ([#11628](https://github.com/typescript-eslint/typescript-eslint/pull/11628)) + +### ❤️ Thank You + +- Mark de Dios @peanutenthusiast + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.45.0 (2025-09-29) + +### 🚀 Features + +- **eslint-plugin:** expose rule name via RuleModule interface ([#11616](https://github.com/typescript-eslint/typescript-eslint/pull/11616)) + +### ❤️ Thank You + +- Yukihiro Hasegawa @y-hsgw + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.44.1 (2025-09-22) + +This was a version bump only for rule-tester to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.44.0 (2025-09-15) + +This was a version bump only for rule-tester to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.43.0 (2025-09-08) + +### 🩹 Fixes + +- **rule-tester:** normalize paths before checking if they escape cwd ([#11525](https://github.com/typescript-eslint/typescript-eslint/pull/11525)) + +### ❤️ Thank You + +- Dima @dbarabashh + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.42.0 (2025-09-02) + +This was a version bump only for rule-tester to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.41.0 (2025-08-25) + +### 🚀 Features + +- tighten `tsconfigRootDir` validation ([#11463](https://github.com/typescript-eslint/typescript-eslint/pull/11463)) + +### ❤️ Thank You + +- Kirk Waiblinger @kirkwaiblinger + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.40.0 (2025-08-18) + +This was a version bump only for rule-tester to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.39.1 (2025-08-11) + +This was a version bump only for rule-tester to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.39.0 (2025-08-04) + +This was a version bump only for rule-tester to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.38.0 (2025-07-21) + +This was a version bump only for rule-tester to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.37.0 (2025-07-14) + +This was a version bump only for rule-tester to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.36.0 (2025-07-07) + +This was a version bump only for rule-tester to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.35.1 (2025-06-30) + +This was a version bump only for rule-tester to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.35.0 (2025-06-23) + +This was a version bump only for rule-tester to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.34.1 (2025-06-16) + +This was a version bump only for rule-tester to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.34.0 (2025-06-09) + +This was a version bump only for rule-tester to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.33.1 (2025-06-02) + +This was a version bump only for rule-tester to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.33.0 (2025-05-26) + +This was a version bump only for rule-tester to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + ## 8.32.1 (2025-05-12) This was a version bump only for rule-tester to align it with other projects, there were no code changes. diff --git a/packages/rule-tester/package.json b/packages/rule-tester/package.json index 90a565184644..b63e19e2b7d5 100644 --- a/packages/rule-tester/package.json +++ b/packages/rule-tester/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/rule-tester", - "version": "8.32.1", + "version": "8.46.4", "description": "Tooling to test ESLint rules", "files": [ "dist", @@ -35,21 +35,18 @@ "estree" ], "scripts": { - "build": "tsc -b tsconfig.build.json", - "clean": "tsc -b tsconfig.build.json --clean", - "postclean": "rimraf dist/ coverage/", - "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", - "lint": "npx nx lint", - "pretest-eslint-base": "tsc -b tsconfig.build.json", - "test-eslint-base": "mocha --require source-map-support/register ./tests/eslint-base/eslint-base.test.js", - "test": "vitest --run --config=$INIT_CWD/vitest.config.mts", - "check-types": "npx nx typecheck" + "build": "yarn run -BT nx build", + "clean": "rimraf dist/ coverage/", + "format": "yarn run -T format", + "lint": "yarn run -BT nx lint", + "test": "yarn run -BT nx test", + "typecheck": "yarn run -BT nx typecheck" }, "//": "NOTE - AJV is out-of-date, but it's intentionally synced with ESLint - https://github.com/eslint/eslint/blob/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/package.json#L70", "dependencies": { - "@typescript-eslint/parser": "8.32.1", - "@typescript-eslint/typescript-estree": "8.32.1", - "@typescript-eslint/utils": "8.32.1", + "@typescript-eslint/parser": "8.46.4", + "@typescript-eslint/typescript-estree": "8.46.4", + "@typescript-eslint/utils": "8.46.4", "ajv": "^6.12.6", "json-stable-stringify-without-jsonify": "^1.0.1", "lodash.merge": "4.6.2", @@ -62,13 +59,8 @@ "@types/json-stable-stringify-without-jsonify": "^1.0.2", "@types/lodash.merge": "4.6.9", "@vitest/coverage-v8": "^3.1.3", - "chai": "^5.2.0", - "eslint-visitor-keys": "^4.2.0", - "espree": "^10.3.0", - "esprima": "^4.0.1", - "mocha": "^11.0.0", - "sinon": "^20.0.0", - "source-map-support": "^0.5.21", + "eslint": "*", + "rimraf": "*", "typescript": "*", "vitest": "^3.1.3" }, @@ -78,5 +70,16 @@ }, "publishConfig": { "access": "public" + }, + "nx": { + "name": "rule-tester", + "includedScripts": [ + "clean" + ], + "targets": { + "lint": { + "command": "eslint" + } + } } } diff --git a/packages/rule-tester/project.json b/packages/rule-tester/project.json deleted file mode 100644 index cbcfa8914c33..000000000000 --- a/packages/rule-tester/project.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "rule-tester", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "projectType": "library", - "root": "packages/rule-tester", - "sourceRoot": "packages/rule-tester/src", - "targets": { - "lint": { - "executor": "@nx/eslint:lint", - "outputs": ["{options.outputFile}"] - }, - "test": { - "executor": "@nx/vite:test" - } - } -} diff --git a/packages/rule-tester/src/RuleTester.ts b/packages/rule-tester/src/RuleTester.ts index c81f7296e189..723bc6b17227 100644 --- a/packages/rule-tester/src/RuleTester.ts +++ b/packages/rule-tester/src/RuleTester.ts @@ -210,7 +210,7 @@ export class RuleTester extends TestFramework { // file name (`foo.ts`), don't change the base path. if ( filename != null && - (path.isAbsolute(filename) || filename.startsWith('..')) + (path.isAbsolute(filename) || path.normalize(filename).startsWith('..')) ) { basePath = path.parse( path.resolve(basePath ?? process.cwd(), filename), @@ -761,8 +761,8 @@ export class RuleTester extends TestFramework { // Verify the code. let initialMessages: Linter.LintMessage[] | null = null; - let messages: Linter.LintMessage[] | null = null; - let fixedResult: SourceCodeFixer.AppliedFixes | null = null; + let messages: Linter.LintMessage[]; + let fixedResult: SourceCodeFixer.AppliedFixes; let passNumber = 0; const outputs: string[] = []; const configWithoutCustomKeys = omitCustomConfigProperties(config); @@ -1102,14 +1102,6 @@ export class RuleTester extends TestFramework { ); } - if (error.type) { - assert.strictEqual( - message.nodeType, - error.type, - `Error type should be ${error.type}, found ${message.nodeType}`, - ); - } - if (hasOwnProperty(error, 'line')) { assert.strictEqual( message.line, diff --git a/packages/rule-tester/src/types/DependencyConstraint.ts b/packages/rule-tester/src/types/DependencyConstraint.ts index c271e8bba3ff..e4ab6824000f 100644 --- a/packages/rule-tester/src/types/DependencyConstraint.ts +++ b/packages/rule-tester/src/types/DependencyConstraint.ts @@ -10,8 +10,8 @@ export interface SemverVersionConstraint { readonly range: string; } export type AtLeastVersionConstraint = - | `${number}.${number}.${number}` | `${number}.${number}.${number}-${string}` + | `${number}.${number}.${number}` | `${number}.${number}` | `${number}`; export type VersionConstraint = diff --git a/packages/rule-tester/src/types/InvalidTestCase.ts b/packages/rule-tester/src/types/InvalidTestCase.ts index 73e8f48a6771..f5ba876c8510 100644 --- a/packages/rule-tester/src/types/InvalidTestCase.ts +++ b/packages/rule-tester/src/types/InvalidTestCase.ts @@ -53,7 +53,7 @@ export interface TestCaseError { */ readonly suggestions?: readonly SuggestionOutput[] | null; /** - * The type of the reported AST node. + * @deprecated `type` is deprecated and will be removed in the next major version. */ readonly type?: AST_NODE_TYPES | AST_TOKEN_TYPES; diff --git a/packages/rule-tester/tests/RuleTester.test.ts b/packages/rule-tester/tests/RuleTester.test.ts index 594dd3c7e5a1..83d57fd3eb32 100644 --- a/packages/rule-tester/tests/RuleTester.test.ts +++ b/packages/rule-tester/tests/RuleTester.test.ts @@ -4,6 +4,7 @@ import type { MockInstance } from 'vitest'; import * as parser from '@typescript-eslint/parser'; import { AST_NODE_TYPES } from '@typescript-eslint/typescript-estree'; +import path from 'node:path'; import type { InvalidTestCase, RuleTesterConfig, ValidTestCase } from '../src'; import type { RuleTesterTestFrameworkFunctionBase } from '../src/TestFramework'; @@ -95,6 +96,19 @@ const NOOP_RULE: RuleModule<'error'> = { }, }; +function windowsToPosixPath(p: string): string { + if (process.platform !== 'win32') { + return p; + } + const parsed = path.parse(p); + const hasDriveLetter = /^[a-zA-Z]:/.test(parsed.root); + let rv = p; + if (hasDriveLetter) { + rv = rv.substring(2); + } + return rv.replaceAll('\\', '/'); +} + describe(RuleTester, () => { const runRuleForItemSpy: MockInstance< ( @@ -130,7 +144,6 @@ describe(RuleTester, () => { line: 0, message: 'error', messageId: 'error', - nodeType: AST_NODE_TYPES.Program, ruleId: 'my-rule', severity: 2, source: null, @@ -143,7 +156,20 @@ describe(RuleTester, () => { function getTestConfigFromCall(): unknown[] { return runRuleForItemSpy.mock.calls.map(c => { - return { ...c[2], filename: c[2].filename?.replaceAll('\\', '/') }; + const copy = structuredClone(c[2]); + if (copy.filename) { + // @ts-expect-error -- readonly-ness + copy.filename = windowsToPosixPath(copy.filename); + } + + if (copy.languageOptions?.parserOptions?.tsconfigRootDir) { + // @ts-expect-error -- readonly-ness + copy.languageOptions.parserOptions.tsconfigRootDir = windowsToPosixPath( + copy.languageOptions.parserOptions.tsconfigRootDir, + ); + } + + return copy; }); } @@ -277,7 +303,7 @@ describe(RuleTester, () => { parser, parserOptions: { project: 'tsconfig.json', - tsconfigRootDir: '/some/path/that/totally/exists/', + tsconfigRootDir: path.resolve('/some/path/that/totally/exists/'), }, }, }); @@ -337,7 +363,7 @@ describe(RuleTester, () => { parser, parserOptions: { project: 'tsconfig.json', - tsconfigRootDir: '/some/path/that/totally/exists/', + tsconfigRootDir: path.resolve('/some/path/that/totally/exists/'), }, }, }); @@ -375,7 +401,7 @@ describe(RuleTester, () => { parser, parserOptions: { project: 'tsconfig.json', - tsconfigRootDir: '/some/path/that/totally/exists/', + tsconfigRootDir: path.resolve('/some/path/that/totally/exists/'), }, }, }); @@ -939,7 +965,7 @@ describe(RuleTester, () => { }); describe('constructor constraints', () => { - it('skips all tests if a constructor constraint is not satisifed', () => { + it('skips all tests if a constructor constraint is not satisfied', () => { satisfiesAllDependencyConstraintsMock.mockReturnValueOnce(false); const ruleTester = new RuleTester({ dependencyConstraints: { @@ -972,7 +998,7 @@ describe(RuleTester, () => { `); }); - it('does not skip all tests if a constructor constraint is satisifed', () => { + it('does not skip all tests if a constructor constraint is satisfied', () => { satisfiesAllDependencyConstraintsMock.mockReturnValueOnce(true); const ruleTester = new RuleTester({ dependencyConstraints: { @@ -1327,6 +1353,7 @@ describe('RuleTester - multipass fixer', () => { { code: 'foo', errors: [{ messageId: 'error' }], + output: null, }, ], valid: [], @@ -1619,7 +1646,7 @@ describe('RuleTester - run types', () => { }; describe('infer from `rule` parameter', () => { - it('should correctly infer `options` or `messageIds` types from the `rule` paramter', () => { + it('should correctly infer `options` or `messageIds` types from the `rule` parameter', () => { expect(() => ruleTester.run('my-rule', ruleModule, { invalid: [], diff --git a/packages/rule-tester/tests/eslint-base/eslint-base.test.js b/packages/rule-tester/tests/eslint-base/eslint-base.test.js deleted file mode 100644 index e87ece634534..000000000000 --- a/packages/rule-tester/tests/eslint-base/eslint-base.test.js +++ /dev/null @@ -1,3536 +0,0 @@ -/** - * This file intentionally does not match the standards in the rest of our codebase. - * It's intended to exactly match the test in ESLint core so we can ensure we - * have compatibility. - * It's tempting to switch this to be strictly typed in TS and to use jest - but - * it's too easy to introduce subtle changes into the test by doing that. It also - * makes it much harder to merge upstream changes into this test. - * - * The only edits we have made are to update the paths for our rep - * - * Forked from https://github.com/eslint/eslint/blob/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/lib/rule-tester/rule-tester.js - * - * @noformat - */ -/* eslint-disable */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ -const sinon = require("sinon"), - EventEmitter = require("events"), - { RuleTester } = require("../../dist/RuleTester"), - assert = require("chai").assert, - nodeAssert = require("assert"), - espree = require("espree"); - -const NODE_ASSERT_STRICT_EQUAL_OPERATOR = (() => { - try { - nodeAssert.strictEqual(1, 2); - } catch (err) { - return err.operator; - } - throw new Error("unexpected successful assertion"); -})(); - -/** - * Do nothing. - * @returns {void} - */ -function noop() { - - // do nothing. -} - -//------------------------------------------------------------------------------ -// Rewire Things -//------------------------------------------------------------------------------ - -/* - * So here's the situation. Because RuleTester uses it() and describe() from - * Mocha, any failures would show up in the output of this test file. That means - * when we tested that a failure is thrown, that would also count as a failure - * in the testing for RuleTester. In order to remove those results from the - * results of this file, we need to overwrite it() and describe() just in - * RuleTester to do nothing but run code. Effectively, it() and describe() - * just become regular functions inside of index.js, not at all related to Mocha. - * That allows the results of this file to be untainted and therefore accurate. - * - * To assert that the right arguments are passed to RuleTester.describe/it, an - * event emitter is used which emits the arguments. - */ - -const ruleTesterTestEmitter = new EventEmitter(); - -//------------------------------------------------------------------------------ -// Tests -//------------------------------------------------------------------------------ - -describe("RuleTester", () => { - - // Stub `describe()` and `it()` while this test suite. - before(() => { - RuleTester.describe = function(text, method) { - ruleTesterTestEmitter.emit("describe", text, method); - return method.call(this); - }; - RuleTester.it = function(text, method) { - ruleTesterTestEmitter.emit("it", text, method); - return method.call(this); - }; - }); - after(() => { - RuleTester.describe = null; - RuleTester.it = null; - }); - - let ruleTester; - - /** - * A helper function to verify Node.js core error messages. - * @param {string} actual The actual input - * @param {string} expected The expected input - * @returns {Function} Error callback to verify that the message is correct - * for the actual and expected input. - */ - function assertErrorMatches(actual, expected) { - const err = new nodeAssert.AssertionError({ - actual, - expected, - operator: NODE_ASSERT_STRICT_EQUAL_OPERATOR - }); - - return err.message; - } - - beforeEach(() => { - RuleTester.resetDefaultConfig(); - ruleTester = new RuleTester(); - }); - - describe("only", () => { - describe("`itOnly` accessor", () => { - describe("when `itOnly` is set", () => { - before(() => { - RuleTester.itOnly = sinon.spy(); - }); - after(() => { - RuleTester.itOnly = void 0; - }); - beforeEach(() => { - RuleTester.itOnly.resetHistory(); - ruleTester = new RuleTester(); - }); - - it("is called by exclusive tests", () => { - ruleTester.run("no-var", require("./fixtures/no-var"), { - valid: [{ - code: "const notVar = 42;", - only: true - }], - invalid: [] - }); - - sinon.assert.calledWith(RuleTester.itOnly, "const notVar = 42;"); - }); - }); - - describe("when `it` is set and has an `only()` method", () => { - before(() => { - RuleTester.it.only = () => {}; - sinon.spy(RuleTester.it, "only"); - }); - after(() => { - RuleTester.it.only = void 0; - }); - beforeEach(() => { - RuleTester.it.only.resetHistory(); - ruleTester = new RuleTester(); - }); - - it("is called by tests with `only` set", () => { - ruleTester.run("no-var", require("./fixtures/no-var"), { - valid: [{ - code: "const notVar = 42;", - only: true - }], - invalid: [] - }); - - sinon.assert.calledWith(RuleTester.it.only, "const notVar = 42;"); - }); - }); - - describe("when global `it` is a function that has an `only()` method", () => { - let originalGlobalItOnly; - - before(() => { - - /* - * We run tests with `--forbid-only`, so we have to override - * `it.only` to prevent the real one from being called. - */ - originalGlobalItOnly = it.only; - it.only = () => {}; - sinon.spy(it, "only"); - }); - after(() => { - it.only = originalGlobalItOnly; - }); - beforeEach(() => { - it.only.resetHistory(); - ruleTester = new RuleTester(); - }); - - it("is called by tests with `only` set", () => { - ruleTester.run("no-var", require("./fixtures/no-var"), { - valid: [{ - code: "const notVar = 42;", - only: true - }], - invalid: [] - }); - - sinon.assert.calledWith(it.only, "const notVar = 42;"); - }); - }); - - describe("when `describe` and `it` are overridden without `itOnly`", () => { - let originalGlobalItOnly; - - before(() => { - - /* - * These tests override `describe` and `it` already, so we - * don't need to override them here. We do, however, need to - * remove `only` from the global `it` to prevent it from - * being used instead. - */ - originalGlobalItOnly = it.only; - it.only = void 0; - }); - after(() => { - it.only = originalGlobalItOnly; - }); - beforeEach(() => { - ruleTester = new RuleTester(); - }); - - it("throws an error recommending overriding `itOnly`", () => { - assert.throws(() => { - ruleTester.run("no-var", require("./fixtures/no-var"), { - valid: [{ - code: "const notVar = 42;", - only: true - }], - invalid: [] - }); - }, "Set `RuleTester.itOnly` to use `only` with a custom test framework."); - }); - }); - - describe("when global `it` is a function that does not have an `only()` method", () => { - let originalGlobalIt; - let originalRuleTesterDescribe; - let originalRuleTesterIt; - - before(() => { - originalGlobalIt = global.it; - - // eslint-disable-next-line no-global-assign -- Temporarily override Mocha global - it = () => {}; - - /* - * These tests override `describe` and `it`, so we need to - * un-override them here so they won't interfere. - */ - originalRuleTesterDescribe = RuleTester.describe; - RuleTester.describe = void 0; - originalRuleTesterIt = RuleTester.it; - RuleTester.it = void 0; - }); - after(() => { - - // eslint-disable-next-line no-global-assign -- Restore Mocha global - it = originalGlobalIt; - RuleTester.describe = originalRuleTesterDescribe; - RuleTester.it = originalRuleTesterIt; - }); - beforeEach(() => { - ruleTester = new RuleTester(); - }); - - it("throws an error explaining that the current test framework does not support `only`", () => { - assert.throws(() => { - ruleTester.run("no-var", require("./fixtures/no-var"), { - valid: [{ - code: "const notVar = 42;", - only: true - }], - invalid: [] - }); - }, "The current test framework does not support exclusive tests with `only`."); - }); - }); - }); - - describe("test cases", () => { - const ruleName = "no-var"; - const rule = require("./fixtures/no-var"); - - let originalRuleTesterIt; - let spyRuleTesterIt; - let originalRuleTesterItOnly; - let spyRuleTesterItOnly; - - before(() => { - originalRuleTesterIt = RuleTester.it; - spyRuleTesterIt = sinon.spy(); - RuleTester.it = spyRuleTesterIt; - originalRuleTesterItOnly = RuleTester.itOnly; - spyRuleTesterItOnly = sinon.spy(); - RuleTester.itOnly = spyRuleTesterItOnly; - }); - after(() => { - RuleTester.it = originalRuleTesterIt; - RuleTester.itOnly = originalRuleTesterItOnly; - }); - beforeEach(() => { - spyRuleTesterIt.resetHistory(); - spyRuleTesterItOnly.resetHistory(); - ruleTester = new RuleTester(); - }); - - it("isn't called for normal tests", () => { - ruleTester.run(ruleName, rule, { - valid: ["const notVar = 42;"], - invalid: [] - }); - sinon.assert.calledWith(spyRuleTesterIt, "const notVar = 42;"); - sinon.assert.notCalled(spyRuleTesterItOnly); - }); - - it("calls it or itOnly for every test case", () => { - - /* - * `RuleTester` doesn't implement test case exclusivity itself. - * Setting `only: true` just causes `RuleTester` to call - * whatever `only()` function is provided by the test framework - * instead of the regular `it()` function. - */ - - ruleTester.run(ruleName, rule, { - valid: [ - "const valid = 42;", - { - code: "const onlyValid = 42;", - only: true - } - ], - invalid: [ - { - code: "var invalid = 42;", - errors: [/^Bad var/u] - }, - { - code: "var onlyInvalid = 42;", - errors: [/^Bad var/u], - only: true - } - ] - }); - - sinon.assert.calledWith(spyRuleTesterIt, "const valid = 42;"); - sinon.assert.calledWith(spyRuleTesterItOnly, "const onlyValid = 42;"); - sinon.assert.calledWith(spyRuleTesterIt, "var invalid = 42;"); - sinon.assert.calledWith(spyRuleTesterItOnly, "var onlyInvalid = 42;"); - }); - }); - - describe("static helper wrapper", () => { - it("adds `only` to string test cases", () => { - const test = RuleTester.only("const valid = 42;"); - - assert.deepStrictEqual(test, { - code: "const valid = 42;", - only: true - }); - }); - - it("adds `only` to object test cases", () => { - const test = RuleTester.only({ code: "const valid = 42;" }); - - assert.deepStrictEqual(test, { - code: "const valid = 42;", - only: true - }); - }); - }); - }); - - it("should not throw an error when everything passes", () => { - ruleTester.run("no-eval", require("./fixtures/no-eval"), { - valid: [ - "Eval(foo)" - ], - invalid: [ - { code: "eval(foo)", errors: [{ message: "eval sucks.", type: "CallExpression" }] } - ] - }); - }); - - it("should throw an error when valid code is invalid", () => { - - assert.throws(() => { - ruleTester.run("no-eval", require("./fixtures/no-eval"), { - valid: [ - "eval(foo)" - ], - invalid: [ - { code: "eval(foo)", errors: [{ message: "eval sucks.", type: "CallExpression" }] } - ] - }); - }, /Should have no errors but had 1/u); - }); - - it("should throw an error when valid code is invalid", () => { - - assert.throws(() => { - ruleTester.run("no-eval", require("./fixtures/no-eval"), { - valid: [ - { code: "eval(foo)" } - ], - invalid: [ - { code: "eval(foo)", errors: [{ message: "eval sucks.", type: "CallExpression" }] } - ] - }); - }, /Should have no errors but had 1/u); - }); - - it("should throw an error if invalid code is valid", () => { - - assert.throws(() => { - ruleTester.run("no-eval", require("./fixtures/no-eval"), { - valid: [ - "Eval(foo)" - ], - invalid: [ - { code: "Eval(foo)", errors: [{ message: "eval sucks.", type: "CallExpression" }] } - ] - }); - }, /Should have 1 error but had 0/u); - }); - - it("should throw an error when the error message is wrong", () => { - assert.throws(() => { - ruleTester.run("no-var", require("./fixtures/no-var"), { - - // Only the invalid test matters here - valid: [ - "bar = baz;" - ], - invalid: [ - { code: "var foo = bar;", errors: [{ message: "Bad error message." }] } - ] - }); - }, assertErrorMatches("Bad var.", "Bad error message.")); - }); - - it("should throw an error when the error message regex does not match", () => { - assert.throws(() => { - ruleTester.run("no-var", require("./fixtures/no-var"), { - valid: [], - invalid: [ - { code: "var foo = bar;", errors: [{ message: /Bad error message/u }] } - ] - }); - }, /Expected 'Bad var.' to match \/Bad error message\//u); - }); - - it("should throw an error when the error is not a supported type", () => { - assert.throws(() => { - ruleTester.run("no-var", require("./fixtures/no-var"), { - - // Only the invalid test matters here - valid: [ - "bar = baz;" - ], - invalid: [ - { code: "var foo = bar;", errors: [42] } - ] - }); - }, /Error should be a string, object, or RegExp/u); - }); - - it("should throw an error when any of the errors is not a supported type", () => { - assert.throws(() => { - ruleTester.run("no-var", require("./fixtures/no-var"), { - - // Only the invalid test matters here - valid: [ - "bar = baz;" - ], - invalid: [ - { code: "var foo = bar; var baz = quux", errors: [{ message: "Bad var.", type: "VariableDeclaration" }, null] } - ] - }); - }, /Error should be a string, object, or RegExp/u); - }); - - it("should throw an error when the error is a string and it does not match error message", () => { - assert.throws(() => { - ruleTester.run("no-var", require("./fixtures/no-var"), { - - // Only the invalid test matters here - valid: [ - "bar = baz;" - ], - invalid: [ - { code: "var foo = bar;", errors: ["Bad error message."] } - ] - }); - }, assertErrorMatches("Bad var.", "Bad error message.")); - }); - - it("should throw an error when the error is a string and it does not match error message", () => { - assert.throws(() => { - ruleTester.run("no-var", require("./fixtures/no-var"), { - - valid: [ - ], - invalid: [ - { code: "var foo = bar;", errors: [/Bad error message/u] } - ] - }); - }, /Expected 'Bad var.' to match \/Bad error message\//u); - }); - - it("should not throw an error when the error is a string and it matches error message", () => { - ruleTester.run("no-var", require("./fixtures/no-var"), { - - // Only the invalid test matters here - valid: [ - "bar = baz;" - ], - invalid: [ - { code: "var foo = bar;", output: " foo = bar;", errors: ["Bad var."] } - ] - }); - }); - - it("should not throw an error when the error is a regex and it matches error message", () => { - ruleTester.run("no-var", require("./fixtures/no-var"), { - valid: [], - invalid: [ - { code: "var foo = bar;", output: " foo = bar;", errors: [/^Bad var/u] } - ] - }); - }); - - it("should not throw an error when the error is a string and the suggestion fixer is failing", () => { - ruleTester.run("no-var", require("./fixtures/suggestions").withFailingFixer, { - valid: [], - invalid: [ - { code: "foo", errors: ["some message"] } - ] - }); - }); - - it("throws an error when the error is a string and the suggestion fixer provides a fix", () => { - assert.throws(() => { - ruleTester.run("no-var", require("./fixtures/suggestions").basic, { - valid: [], - invalid: [ - { code: "foo", errors: ["Avoid using identifiers named 'foo'."] } - ] - }); - }, "Error at index 0 has suggestions. Please convert the test error into an object and specify 'suggestions' property on it to test suggestions."); - }); - - it("should throw an error when the error is an object with an unknown property name", () => { - assert.throws(() => { - ruleTester.run("no-var", require("./fixtures/no-var"), { - valid: [ - "bar = baz;" - ], - invalid: [ - { code: "var foo = bar;", errors: [{ Message: "Bad var." }] } - ] - }); - }, /Invalid error property name 'Message'/u); - }); - - it("should throw an error when any of the errors is an object with an unknown property name", () => { - assert.throws(() => { - ruleTester.run("no-var", require("./fixtures/no-var"), { - valid: [ - "bar = baz;" - ], - invalid: [ - { - code: "var foo = bar; var baz = quux", - errors: [ - { message: "Bad var.", type: "VariableDeclaration" }, - { message: "Bad var.", typo: "VariableDeclaration" } - ] - } - ] - }); - }, /Invalid error property name 'typo'/u); - }); - - it("should not throw an error when the error is a regex in an object and it matches error message", () => { - ruleTester.run("no-var", require("./fixtures/no-var"), { - valid: [], - invalid: [ - { code: "var foo = bar;", output: " foo = bar;", errors: [{ message: /^Bad var/u }] } - ] - }); - }); - - it("should throw an error when the expected output doesn't match", () => { - assert.throws(() => { - ruleTester.run("no-var", require("./fixtures/no-var"), { - valid: [ - "bar = baz;" - ], - invalid: [ - { code: "var foo = bar;", output: "foo = bar", errors: [{ message: "Bad var.", type: "VariableDeclaration" }] } - ] - }); - }, /Output is incorrect/u); - }); - - it("should use strict equality to compare output", () => { - const replaceProgramWith5Rule = { - meta: { - fixable: "code" - }, - - create: context => ({ - Program(node) { - context.report({ node, message: "bad", fix: fixer => fixer.replaceText(node, "5") }); - } - }) - }; - - // Should not throw. - ruleTester.run("foo", replaceProgramWith5Rule, { - valid: [], - invalid: [ - { code: "var foo = bar;", output: "5", errors: 1 } - ] - }); - - assert.throws(() => { - ruleTester.run("foo", replaceProgramWith5Rule, { - valid: [], - invalid: [ - { code: "var foo = bar;", output: 5, errors: 1 } - ] - }); - }, /Output is incorrect/u); - }); - - it("should throw an error when the expected output doesn't match and errors is just a number", () => { - assert.throws(() => { - ruleTester.run("no-var", require("./fixtures/no-var"), { - valid: [ - "bar = baz;" - ], - invalid: [ - { code: "var foo = bar;", output: "foo = bar", errors: 1 } - ] - }); - }, /Output is incorrect/u); - }); - - it("should not throw an error when the expected output is null and no errors produce output", () => { - ruleTester.run("no-eval", require("./fixtures/no-eval"), { - valid: [ - "bar = baz;" - ], - invalid: [ - { code: "eval(x)", errors: 1, output: null }, - { code: "eval(x); eval(y);", errors: 2, output: null } - ] - }); - }); - - it("should throw an error when the expected output is null and problems produce output", () => { - assert.throws(() => { - ruleTester.run("no-var", require("./fixtures/no-var"), { - valid: [ - "bar = baz;" - ], - invalid: [ - { code: "var foo = bar;", output: null, errors: 1 } - ] - }); - }, /Expected no autofixes to be suggested/u); - - assert.throws(() => { - ruleTester.run("no-var", require("./fixtures/no-var"), { - valid: [ - "bar = baz;" - ], - invalid: [ - { - code: "var foo = bar; var qux = boop;", - output: null, - errors: 2 - } - ] - }); - }, /Expected no autofixes to be suggested/u); - }); - - it("should throw an error when the expected output is null and only some problems produce output", () => { - assert.throws(() => { - ruleTester.run("fixes-one-problem", require("./fixtures/fixes-one-problem"), { - valid: [], - invalid: [ - { code: "foo", output: null, errors: 2 } - ] - }); - }, /Expected no autofixes to be suggested/u); - }); - - it("should throw an error when the expected output is not null and the output does not differ from the code", () => { - assert.throws(() => { - ruleTester.run("no-var", require("./fixtures/no-eval"), { - valid: [], - invalid: [ - { code: "eval('')", output: "eval('')", errors: 1 } - ] - }); - }, "Test property 'output' matches 'code'. If no autofix is expected, then omit the 'output' property or set it to null."); - }); - - it("should throw an error when the expected output isn't specified and problems produce output", () => { - assert.throws(() => { - ruleTester.run("no-var", require("./fixtures/no-var"), { - valid: [ - "bar = baz;" - ], - invalid: [ - { code: "var foo = bar;", errors: 1 } - ] - }); - }, "The rule fixed the code. Please add 'output' property."); - }); - - it("should throw an error if invalid code specifies wrong type", () => { - assert.throws(() => { - ruleTester.run("no-eval", require("./fixtures/no-eval"), { - valid: [ - "Eval(foo)" - ], - invalid: [ - { code: "eval(foo)", errors: [{ message: "eval sucks.", type: "CallExpression2" }] } - ] - }); - }, /Error type should be CallExpression2, found CallExpression/u); - }); - - it("should throw an error if invalid code specifies wrong line", () => { - assert.throws(() => { - ruleTester.run("no-eval", require("./fixtures/no-eval"), { - valid: [ - "Eval(foo)" - ], - invalid: [ - { code: "eval(foo)", errors: [{ message: "eval sucks.", type: "CallExpression", line: 5 }] } - ] - }); - }, /Error line should be 5/u); - }); - - it("should not skip line assertion if line is a falsy value", () => { - assert.throws(() => { - ruleTester.run("no-eval", require("./fixtures/no-eval"), { - valid: [ - "Eval(foo)" - ], - invalid: [ - { code: "\neval(foo)", errors: [{ message: "eval sucks.", type: "CallExpression", line: 0 }] } - ] - }); - }, /Error line should be 0/u); - }); - - it("should throw an error if invalid code specifies wrong column", () => { - const wrongColumn = 10, - expectedErrorMessage = "Error column should be 1"; - - assert.throws(() => { - ruleTester.run("no-eval", require("./fixtures/no-eval"), { - valid: ["Eval(foo)"], - invalid: [{ - code: "eval(foo)", - errors: [{ - message: "eval sucks.", - column: wrongColumn - }] - }] - }); - }, expectedErrorMessage); - }); - - it("should throw error for empty error array", () => { - assert.throws(() => { - ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [] - }] - }); - }, /Invalid cases must have at least one error/u); - }); - - it("should throw error for errors : 0", () => { - assert.throws(() => { - ruleTester.run( - "suggestions-messageIds", - require("./fixtures/suggestions") - .withMessageIds, - { - valid: [], - invalid: [ - { - code: "var foo;", - errors: 0 - } - ] - } - ); - }, /Invalid cases must have 'error' value greater than 0/u); - }); - - it("should not skip column assertion if column is a falsy value", () => { - assert.throws(() => { - ruleTester.run("no-eval", require("./fixtures/no-eval"), { - valid: ["Eval(foo)"], - invalid: [{ - code: "var foo; eval(foo)", - errors: [{ message: "eval sucks.", column: 0 }] - }] - }); - }, /Error column should be 0/u); - }); - - it("should throw an error if invalid code specifies wrong endLine", () => { - assert.throws(() => { - ruleTester.run("no-var", require("./fixtures/no-var"), { - valid: [ - "bar = baz;" - ], - invalid: [ - { code: "var foo = bar;", output: "foo = bar", errors: [{ message: "Bad var.", type: "VariableDeclaration", endLine: 10 }] } - ] - }); - }, "Error endLine should be 10"); - }); - - it("should throw an error if invalid code specifies wrong endColumn", () => { - assert.throws(() => { - ruleTester.run("no-var", require("./fixtures/no-var"), { - valid: [ - "bar = baz;" - ], - invalid: [ - { code: "var foo = bar;", output: "foo = bar", errors: [{ message: "Bad var.", type: "VariableDeclaration", endColumn: 10 }] } - ] - }); - }, "Error endColumn should be 10"); - }); - - it("should throw an error if invalid code has the wrong number of errors", () => { - assert.throws(() => { - ruleTester.run("no-eval", require("./fixtures/no-eval"), { - valid: [ - "Eval(foo)" - ], - invalid: [ - { - code: "eval(foo)", - errors: [ - { message: "eval sucks.", type: "CallExpression" }, - { message: "eval sucks.", type: "CallExpression" } - ] - } - ] - }); - }, /Should have 2 errors but had 1/u); - }); - - it("should throw an error if invalid code does not have errors", () => { - assert.throws(() => { - ruleTester.run("no-eval", require("./fixtures/no-eval"), { - valid: [ - "Eval(foo)" - ], - invalid: [ - { code: "eval(foo)" } - ] - }); - }, /Did not specify errors for an invalid test of no-eval/u); - }); - - it("should throw an error if invalid code has the wrong explicit number of errors", () => { - assert.throws(() => { - ruleTester.run("no-eval", require("./fixtures/no-eval"), { - valid: [ - "Eval(foo)" - ], - invalid: [ - { code: "eval(foo)", errors: 2 } - ] - }); - }, /Should have 2 errors but had 1/u); - }); - - it("should throw an error if there's a parsing error in a valid test", () => { - assert.throws(() => { - ruleTester.run("no-eval", require("./fixtures/no-eval"), { - valid: [ - "1eval('foo')" - ], - invalid: [ - { code: "eval('foo')", errors: [{}] } - ] - }); - }, /fatal parsing error/iu); - }); - - it("should throw an error if there's a parsing error in an invalid test", () => { - assert.throws(() => { - ruleTester.run("no-eval", require("./fixtures/no-eval"), { - valid: [ - "noeval('foo')" - ], - invalid: [ - { code: "1eval('foo')", errors: [{}] } - ] - }); - }, /fatal parsing error/iu); - }); - - it("should throw an error if there's a parsing error in an invalid test and errors is just a number", () => { - assert.throws(() => { - ruleTester.run("no-eval", require("./fixtures/no-eval"), { - valid: [ - "noeval('foo')" - ], - invalid: [ - { code: "1eval('foo')", errors: 1 } - ] - }); - }, /fatal parsing error/iu); - }); - - // https://github.com/eslint/eslint/issues/4779 - it("should throw an error if there's a parsing error and output doesn't match", () => { - assert.throws(() => { - ruleTester.run("no-eval", require("./fixtures/no-eval"), { - valid: [], - invalid: [ - { code: "obvious parser error", output: "string that doesnt match", errors: [{}] } - ] - }); - }, /fatal parsing error/iu); - }); - - it("should throw an error if an error object has no properties", () => { - assert.throws(() => { - ruleTester.run("no-eval", require("./fixtures/no-eval"), { - valid: ["Eval(foo)"], - invalid: [{ - code: "eval(foo)", - errors: [{}] - }] - }); - }, "Test error must specify either a 'messageId' or 'message'."); - }); - - it("should throw an error if an error has a property besides message or messageId", () => { - assert.throws(() => { - ruleTester.run("no-eval", require("./fixtures/no-eval"), { - valid: ["Eval(foo)"], - invalid: [{ - code: "eval(foo)", - errors: [{ line: 1 }] - }] - }); - }, "Test error must specify either a 'messageId' or 'message'."); - }); - - it("should pass-through the globals config of valid tests to the to rule", () => { - ruleTester.run("no-test-global", require("./fixtures/no-test-global"), { - valid: [ - "var test = 'foo'", - { - code: "var test2 = 'bar'", - globals: { test: true } - } - ], - invalid: [{ code: "bar", errors: 1 }] - }); - }); - - it("should pass-through the globals config of invalid tests to the to rule", () => { - ruleTester.run("no-test-global", require("./fixtures/no-test-global"), { - valid: ["var test = 'foo'"], - invalid: [ - { - code: "var test = 'foo'; var foo = 'bar'", - errors: 1 - }, - { - code: "var test = 'foo'", - globals: { foo: true }, - errors: [{ message: "Global variable foo should not be used." }] - } - ] - }); - }); - - it("should pass-through the settings config to rules", () => { - ruleTester.run("no-test-settings", require("./fixtures/no-test-settings"), { - valid: [ - { - code: "var test = 'bar'", settings: { test: 1 } - } - ], - invalid: [ - { - code: "var test = 'bar'", settings: { "no-test": 22 }, errors: 1 - } - ] - }); - }); - - it("should pass-through the filename to the rule", () => { - (function() { - ruleTester.run("", require("./fixtures/no-test-filename"), { - valid: [ - { - code: "var foo = 'bar'", - filename: "somefile.js" - } - ], - invalid: [ - { - code: "var foo = 'bar'", - errors: [ - { message: "Filename test was not defined." } - ] - } - ] - }); - }()); - }); - - it("should pass-through the options to the rule", () => { - ruleTester.run("no-invalid-args", require("./fixtures/no-invalid-args"), { - valid: [ - { - code: "var foo = 'bar'", - options: [false] - } - ], - invalid: [ - { - code: "var foo = 'bar'", - options: [true], - errors: [{ message: "Invalid args" }] - } - ] - }); - }); - - it("should throw an error if the options are an object", () => { - assert.throws(() => { - ruleTester.run("no-invalid-args", require("./fixtures/no-invalid-args"), { - valid: [ - { - code: "foo", - options: { ok: true } - } - ], - invalid: [] - }); - }, /options must be an array/u); - }); - - it("should throw an error if the options are a number", () => { - assert.throws(() => { - ruleTester.run("no-invalid-args", require("./fixtures/no-invalid-args"), { - valid: [ - { - code: "foo", - options: 0 - } - ], - invalid: [] - }); - }, /options must be an array/u); - }); - - it("should pass-through the parser to the rule", () => { - const spy = sinon.spy(ruleTester.linter, "verify"); - - ruleTester.run("no-eval", require("./fixtures/no-eval"), { - valid: [ - { - code: "Eval(foo)" - } - ], - invalid: [ - { - code: "eval(foo)", - parser: require.resolve("esprima"), - errors: [{ message: "eval sucks.", line: 1 }] - } - ] - }); - assert.strictEqual(spy.args[1][1].parser, require.resolve("esprima")); - }); - - // skipping because it's not something our parser cares about - it.skip("should pass normalized ecmaVersion to the rule", () => { - const reportEcmaVersionRule = { - meta: { - messages: { - ecmaVersionMessage: "context.parserOptions.ecmaVersion is {{type}} {{ecmaVersion}}." - } - }, - create: context => ({ - Program(node) { - const { ecmaVersion } = context.parserOptions; - - context.report({ - node, - messageId: "ecmaVersionMessage", - data: { type: typeof ecmaVersion, ecmaVersion } - }); - } - }) - }; - - const notEspree = require.resolve("./fixtures/empty-program-parser"); - - ruleTester.run("report-ecma-version", reportEcmaVersionRule, { - valid: [], - invalid: [ - { - code: "", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "undefined", ecmaVersion: "undefined" } }] - }, - { - code: "", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "undefined", ecmaVersion: "undefined" } }], - parserOptions: {} - }, - { - code: "
", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "undefined", ecmaVersion: "undefined" } }], - parserOptions: { ecmaFeatures: { jsx: true } } - }, - { - code: "", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "undefined", ecmaVersion: "undefined" } }], - parser: require.resolve("espree") - }, - { - code: "", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: "6" } }], - parserOptions: { ecmaVersion: 6 } - }, - { - code: "", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: "6" } }], - parserOptions: { ecmaVersion: 2015 } - }, - { - code: "", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "undefined", ecmaVersion: "undefined" } }], - env: { browser: true } - }, - { - code: "", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "undefined", ecmaVersion: "undefined" } }], - env: { es6: false } - }, - { - code: "", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: "6" } }], - env: { es6: true } - }, - { - code: "", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: "8" } }], - env: { es6: false, es2017: true } - }, - { - code: "let x", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: "6" } }], - env: { es6: "truthy" } - }, - { - code: "", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: "8" } }], - env: { es2017: true } - }, - { - code: "", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: "11" } }], - env: { es2020: true } - }, - { - code: "", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: "12" } }], - env: { es2021: true } - }, - { - code: "", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: String(espree.latestEcmaVersion) } }], - parserOptions: { ecmaVersion: "latest" } - }, - { - code: "", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: String(espree.latestEcmaVersion) } }], - parser: require.resolve("espree"), - parserOptions: { ecmaVersion: "latest" } - }, - { - code: "
", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: String(espree.latestEcmaVersion) } }], - parserOptions: { ecmaVersion: "latest", ecmaFeatures: { jsx: true } } - }, - { - code: "import 'foo'", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: String(espree.latestEcmaVersion) } }], - parserOptions: { ecmaVersion: "latest", sourceType: "module" } - }, - { - code: "", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: String(espree.latestEcmaVersion) } }], - parserOptions: { ecmaVersion: "latest" }, - env: { es6: true } - }, - { - code: "", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: String(espree.latestEcmaVersion) } }], - parserOptions: { ecmaVersion: "latest" }, - env: { es2020: true } - }, - - // Non-Espree parsers normalize ecmaVersion if it's not "latest" - { - code: "", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "undefined", ecmaVersion: "undefined" } }], - parser: notEspree - }, - { - code: "", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "undefined", ecmaVersion: "undefined" } }], - parser: notEspree, - parserOptions: {} - }, - { - code: "", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: "5" } }], - parser: notEspree, - parserOptions: { ecmaVersion: 5 } - }, - { - code: "", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: "6" } }], - parser: notEspree, - parserOptions: { ecmaVersion: 6 } - }, - { - code: "", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: 6 } }], - parser: notEspree, - parserOptions: { ecmaVersion: 2015 } - }, - { - code: "", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "string", ecmaVersion: "latest" } }], - parser: notEspree, - parserOptions: { ecmaVersion: "latest" } - } - ] - }); - - [{ parserOptions: { ecmaVersion: 6 } }, { env: { es6: true } }].forEach(options => { - new RuleTester(options).run("report-ecma-version", reportEcmaVersionRule, { - valid: [], - invalid: [ - { - code: "", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: "6" } }] - }, - { - code: "", - parserOptions: {}, - errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: "6" } }] - } - ] - }); - }); - - new RuleTester({ parser: notEspree }).run("report-ecma-version", reportEcmaVersionRule, { - valid: [], - invalid: [ - { - code: "", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "undefined", ecmaVersion: "undefined" } }] - }, - { - code: "", - parserOptions: { ecmaVersion: "latest" }, - errors: [{ messageId: "ecmaVersionMessage", data: { type: "string", ecmaVersion: "latest" } }] - } - ] - }); - }); - - it("should pass-through services from parseForESLint to the rule", () => { - const enhancedParserPath = require.resolve("./fixtures/enhanced-parser"); - const disallowHiRule = { - create: context => ({ - Literal(node) { - const disallowed = context.parserServices.test.getMessage(); // returns "Hi!" - - if (node.value === disallowed) { - context.report({ node, message: `Don't use '${disallowed}'` }); - } - } - }) - }; - - ruleTester.run("no-hi", disallowHiRule, { - valid: [ - { - code: "'Hello!'", - parser: enhancedParserPath - } - ], - invalid: [ - { - code: "'Hi!'", - parser: enhancedParserPath, - errors: [{ message: "Don't use 'Hi!'" }] - } - ] - }); - }); - - it("should prevent invalid options schemas", () => { - assert.throws(() => { - ruleTester.run("no-invalid-schema", require("./fixtures/no-invalid-schema"), { - valid: [ - "var answer = 6 * 7;", - { code: "var answer = 6 * 7;", options: [] } - ], - invalid: [ - { code: "var answer = 6 * 7;", options: ["bar"], errors: [{ message: "Expected nothing." }] } - ] - }); - }, "Schema for rule no-invalid-schema is invalid:,\titems: should be object\n\titems[0].enum: should NOT have fewer than 1 items\n\titems: should match some schema in anyOf"); - - }); - - it("should prevent schema violations in options", () => { - assert.throws(() => { - ruleTester.run("no-schema-violation", require("./fixtures/no-schema-violation"), { - valid: [ - "var answer = 6 * 7;", - { code: "var answer = 6 * 7;", options: ["foo"] } - ], - invalid: [ - { code: "var answer = 6 * 7;", options: ["bar"], errors: [{ message: "Expected foo." }] } - ] - }); - }, /Value "bar" should be equal to one of the allowed values./u); - - }); - - it("should disallow invalid defaults in rules", () => { - const ruleWithInvalidDefaults = { - meta: { - schema: [ - { - oneOf: [ - { enum: ["foo"] }, - { - type: "object", - properties: { - foo: { - enum: ["foo", "bar"], - default: "foo" - } - }, - additionalProperties: false - } - ] - } - ] - }, - create: () => ({}) - }; - - assert.throws(() => { - ruleTester.run("invalid-defaults", ruleWithInvalidDefaults, { - valid: [ - { - code: "foo", - options: [{}] - } - ], - invalid: [] - }); - }, /Schema for rule invalid-defaults is invalid: default is ignored for: data1\.foo/u); - }); - - it("throw an error when an unknown config option is included", () => { - assert.throws(() => { - ruleTester.run("no-eval", require("./fixtures/no-eval"), { - valid: [ - { code: "Eval(foo)", foo: "bar" } - ], - invalid: [] - }); - }, /ESLint configuration in rule-tester is invalid./u); - }); - - it("throw an error when an invalid config value is included", () => { - assert.throws(() => { - ruleTester.run("no-eval", require("./fixtures/no-eval"), { - valid: [ - { code: "Eval(foo)", env: ["es6"] } - ], - invalid: [] - }); - }, /Property "env" is the wrong type./u); - }); - - it("should pass-through the tester config to the rule", () => { - ruleTester = new RuleTester({ - globals: { test: true } - }); - - ruleTester.run("no-test-global", require("./fixtures/no-test-global"), { - valid: [ - "var test = 'foo'", - "var test2 = test" - ], - invalid: [{ code: "bar", errors: 1, globals: { foo: true } }] - }); - }); - - it("should correctly set the globals configuration", () => { - const config = { globals: { test: true } }; - - RuleTester.setDefaultConfig(config); - assert( - RuleTester.getDefaultConfig().globals.test, - "The default config object is incorrect" - ); - }); - - it("should correctly reset the global configuration", () => { - const config = { globals: { test: true } }; - - RuleTester.setDefaultConfig(config); - RuleTester.resetDefaultConfig(); - assert.deepStrictEqual( - RuleTester.getDefaultConfig(), - { parser: require.resolve('@typescript-eslint/parser'), rules: {} }, - "The default configuration has not reset correctly" - ); - }); - - it("should enforce the global configuration to be an object", () => { - - /** - * Set the default config for the rules tester - * @param {Object} config configuration object - * @returns {Function} Function to be executed - * @private - */ - function setConfig(config) { - return function() { - RuleTester.setDefaultConfig(config); - }; - } - assert.throw(setConfig()); - assert.throw(setConfig(1)); - assert.throw(setConfig(3.14)); - assert.throw(setConfig("foo")); - assert.throw(setConfig(null)); - assert.throw(setConfig(true)); - }); - - it("should pass-through the globals config to the tester then to the to rule", () => { - const config = { globals: { test: true } }; - - RuleTester.setDefaultConfig(config); - ruleTester = new RuleTester(); - - ruleTester.run("no-test-global", require("./fixtures/no-test-global"), { - valid: [ - "var test = 'foo'", - "var test2 = test" - ], - invalid: [{ code: "bar", errors: 1, globals: { foo: true } }] - }); - }); - - it("should throw an error if AST was modified", () => { - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/modify-ast"), { - valid: [ - "var foo = 0;" - ], - invalid: [] - }); - }, "Rule should not modify AST."); - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/modify-ast"), { - valid: [], - invalid: [ - { code: "var bar = 0;", errors: ["error"] } - ] - }); - }, "Rule should not modify AST."); - }); - - it("should throw an error if AST was modified (at Program)", () => { - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/modify-ast-at-first"), { - valid: [ - "var foo = 0;" - ], - invalid: [] - }); - }, "Rule should not modify AST."); - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/modify-ast-at-first"), { - valid: [], - invalid: [ - { code: "var bar = 0;", errors: ["error"] } - ] - }); - }, "Rule should not modify AST."); - }); - - it("should throw an error if AST was modified (at Program:exit)", () => { - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/modify-ast-at-last"), { - valid: [ - "var foo = 0;" - ], - invalid: [] - }); - }, "Rule should not modify AST."); - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/modify-ast-at-last"), { - valid: [], - invalid: [ - { code: "var bar = 0;", errors: ["error"] } - ] - }); - }, "Rule should not modify AST."); - }); - - it("should throw an error if rule uses start and end properties on nodes, tokens or comments", () => { - const usesStartEndRule = { - create(context) { - return { - CallExpression(node) { - noop(node.arguments[1].start); - }, - "BinaryExpression[operator='+']"(node) { - noop(node.end); - }, - "UnaryExpression[operator='-']"(node) { - noop(context.sourceCode.getFirstToken(node).start); - }, - ConditionalExpression(node) { - noop(context.sourceCode.getFirstToken(node).end); - }, - BlockStatement(node) { - noop(context.sourceCode.getCommentsInside(node)[0].start); - }, - ObjectExpression(node) { - noop(context.sourceCode.getCommentsInside(node)[0].end); - }, - Decorator(node) { - noop(node.start); - } - }; - } - }; - - assert.throws(() => { - ruleTester.run("uses-start-end", usesStartEndRule, { - valid: ["foo(a, b)"], - invalid: [] - }); - }, "Use node.range[0] instead of node.start"); - assert.throws(() => { - ruleTester.run("uses-start-end", usesStartEndRule, { - valid: [], - invalid: [{ code: "var a = b * (c + d) / e;", errors: 1 }] - }); - }, "Use node.range[1] instead of node.end"); - assert.throws(() => { - ruleTester.run("uses-start-end", usesStartEndRule, { - valid: [], - invalid: [{ code: "var a = -b * c;", errors: 1 }] - }); - }, "Use token.range[0] instead of token.start"); - assert.throws(() => { - ruleTester.run("uses-start-end", usesStartEndRule, { - valid: ["var a = b ? c : d;"], - invalid: [] - }); - }, "Use token.range[1] instead of token.end"); - assert.throws(() => { - ruleTester.run("uses-start-end", usesStartEndRule, { - valid: ["function f() { /* comment */ }"], - invalid: [] - }); - }, "Use token.range[0] instead of token.start"); - assert.throws(() => { - ruleTester.run("uses-start-end", usesStartEndRule, { - valid: [], - invalid: [{ code: "var x = //\n {\n //comment\n //\n}", errors: 1 }] - }); - }, "Use token.range[1] instead of token.end"); - - const enhancedParserPath = require.resolve("./fixtures/enhanced-parser"); - - assert.throws(() => { - ruleTester.run("uses-start-end", usesStartEndRule, { - valid: [{ code: "foo(a, b)", parser: enhancedParserPath }], - invalid: [] - }); - }, "Use node.range[0] instead of node.start"); - assert.throws(() => { - ruleTester.run("uses-start-end", usesStartEndRule, { - valid: [], - invalid: [{ code: "var a = b * (c + d) / e;", parser: enhancedParserPath, errors: 1 }] - }); - }, "Use node.range[1] instead of node.end"); - assert.throws(() => { - ruleTester.run("uses-start-end", usesStartEndRule, { - valid: [], - invalid: [{ code: "var a = -b * c;", parser: enhancedParserPath, errors: 1 }] - }); - }, "Use token.range[0] instead of token.start"); - assert.throws(() => { - ruleTester.run("uses-start-end", usesStartEndRule, { - valid: [{ code: "var a = b ? c : d;", parser: enhancedParserPath }], - invalid: [] - }); - }, "Use token.range[1] instead of token.end"); - assert.throws(() => { - ruleTester.run("uses-start-end", usesStartEndRule, { - valid: [{ code: "function f() { /* comment */ }", parser: enhancedParserPath }], - invalid: [] - }); - }, "Use token.range[0] instead of token.start"); - assert.throws(() => { - ruleTester.run("uses-start-end", usesStartEndRule, { - valid: [], - invalid: [{ code: "var x = //\n {\n //comment\n //\n}", parser: enhancedParserPath, errors: 1 }] - }); - }, "Use token.range[1] instead of token.end"); - - assert.throws(() => { - ruleTester.run("uses-start-end", usesStartEndRule, { - valid: [{ code: "@foo class A {}", parser: require.resolve("./fixtures/enhanced-parser2") }], - invalid: [] - }); - }, "Use node.range[0] instead of node.start"); - }); - - it("should throw an error if no test scenarios given", () => { - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/modify-ast-at-last")); - }, "Test Scenarios for rule foo : Could not find test scenario object"); - }); - - it("should throw an error if no acceptable test scenario object is given", () => { - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/modify-ast-at-last"), []); - }, "Test Scenarios for rule foo is invalid:\nCould not find any valid test scenarios\nCould not find any invalid test scenarios"); - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/modify-ast-at-last"), ""); - }, "Test Scenarios for rule foo : Could not find test scenario object"); - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/modify-ast-at-last"), 2); - }, "Test Scenarios for rule foo : Could not find test scenario object"); - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/modify-ast-at-last"), {}); - }, "Test Scenarios for rule foo is invalid:\nCould not find any valid test scenarios\nCould not find any invalid test scenarios"); - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/modify-ast-at-last"), { - valid: [] - }); - }, "Test Scenarios for rule foo is invalid:\nCould not find any invalid test scenarios"); - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/modify-ast-at-last"), { - invalid: [] - }); - }, "Test Scenarios for rule foo is invalid:\nCould not find any valid test scenarios"); - }); - - // Nominal message/messageId use cases - it("should assert match if message provided in both test and result.", () => { - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/messageId").withMessageOnly, { - valid: [], - invalid: [{ code: "foo", errors: [{ message: "something" }] }] - }); - }, /Avoid using variables named/u); - - ruleTester.run("foo", require("./fixtures/messageId").withMessageOnly, { - valid: [], - invalid: [{ code: "foo", errors: [{ message: "Avoid using variables named 'foo'." }] }] - }); - }); - - it("should assert match between messageId if provided in both test and result.", () => { - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/messageId").withMetaWithData, { - valid: [], - invalid: [{ code: "foo", errors: [{ messageId: "unused" }] }] - }); - }, "messageId 'avoidFoo' does not match expected messageId 'unused'."); - - ruleTester.run("foo", require("./fixtures/messageId").withMetaWithData, { - valid: [], - invalid: [{ code: "foo", errors: [{ messageId: "avoidFoo" }] }] - }); - }); - it("should assert match between resulting message output if messageId and data provided in both test and result", () => { - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/messageId").withMetaWithData, { - valid: [], - invalid: [{ code: "foo", errors: [{ messageId: "avoidFoo", data: { name: "notFoo" } }] }] - }); - }, "Hydrated message \"Avoid using variables named 'notFoo'.\" does not match \"Avoid using variables named 'foo'.\""); - }); - - it("should throw if the message has a single unsubstituted placeholder when data is not specified", () => { - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/messageId").withMissingData, { - valid: [], - invalid: [{ code: "foo", errors: [{ messageId: "avoidFoo" }] }] - }); - }, "The reported message has an unsubstituted placeholder 'name'. Please provide the missing value via the 'data' property in the context.report() call."); - }); - - it("should throw if the message has a single unsubstituted placeholders when data is specified", () => { - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/messageId").withMissingData, { - valid: [], - invalid: [{ code: "foo", errors: [{ messageId: "avoidFoo", data: { name: "name" } }] }] - }); - }, "Hydrated message \"Avoid using variables named 'name'.\" does not match \"Avoid using variables named '{{ name }}'."); - }); - - it("should throw if the message has multiple unsubstituted placeholders when data is not specified", () => { - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/messageId").withMultipleMissingDataProperties, { - valid: [], - invalid: [{ code: "foo", errors: [{ messageId: "avoidFoo" }] }] - }); - }, "The reported message has unsubstituted placeholders: 'type', 'name'. Please provide the missing values via the 'data' property in the context.report() call."); - }); - - it("should not throw if the data in the message contains placeholders not present in the raw message", () => { - ruleTester.run("foo", require("./fixtures/messageId").withPlaceholdersInData, { - valid: [], - invalid: [{ code: "foo", errors: [{ messageId: "avoidFoo" }] }] - }); - }); - - it("should throw if the data in the message contains the same placeholder and data is not specified", () => { - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/messageId").withSamePlaceholdersInData, { - valid: [], - invalid: [{ code: "foo", errors: [{ messageId: "avoidFoo" }] }] - }); - }, "The reported message has an unsubstituted placeholder 'name'. Please provide the missing value via the 'data' property in the context.report() call."); - }); - - it("should not throw if the data in the message contains the same placeholder and data is specified", () => { - ruleTester.run("foo", require("./fixtures/messageId").withSamePlaceholdersInData, { - valid: [], - invalid: [{ code: "foo", errors: [{ messageId: "avoidFoo", data: { name: "{{ name }}" } }] }] - }); - }); - - it("should not throw an error for specifying non-string data values", () => { - ruleTester.run("foo", require("./fixtures/messageId").withNonStringData, { - valid: [], - invalid: [{ code: "0", errors: [{ messageId: "avoid", data: { value: 0 } }] }] - }); - }); - - // messageId/message misconfiguration cases - it("should throw if user tests for both message and messageId", () => { - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/messageId").withMetaWithData, { - valid: [], - invalid: [{ code: "foo", errors: [{ message: "something", messageId: "avoidFoo" }] }] - }); - }, "Error should not specify both 'message' and a 'messageId'."); - }); - it("should throw if user tests for messageId but the rule doesn't use the messageId meta syntax.", () => { - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/messageId").withMessageOnly, { - valid: [], - invalid: [{ code: "foo", errors: [{ messageId: "avoidFoo" }] }] - }); - }, "Error can not use 'messageId' if rule under test doesn't define 'meta.messages'"); - }); - it("should throw if user tests for messageId not listed in the rule's meta syntax.", () => { - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/messageId").withMetaWithData, { - valid: [], - invalid: [{ code: "foo", errors: [{ messageId: "useFoo" }] }] - }); - }, /Invalid messageId 'useFoo'/u); - }); - it("should throw if data provided without messageId.", () => { - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/messageId").withMetaWithData, { - valid: [], - invalid: [{ code: "foo", errors: [{ data: "something" }] }] - }); - }, "Test error must specify either a 'messageId' or 'message'."); - }); - - describe("suggestions", () => { - it("should throw if suggestions are available but not specified", () => { - assert.throw(() => { - ruleTester.run("suggestions-basic", require("./fixtures/suggestions").basic, { - valid: [ - "var boo;" - ], - invalid: [{ - code: "var foo;", - errors: [{ message: "Avoid using identifiers named 'foo'." }] - }] - }); - }, "Error at index 0 has suggestions. Please specify 'suggestions' property on the test error object."); - }); - - it("should pass with valid suggestions (tested using desc)", () => { - ruleTester.run("suggestions-basic", require("./fixtures/suggestions").basic, { - valid: [ - "var boo;" - ], - invalid: [{ - code: "var foo;", - errors: [{ - message: "Avoid using identifiers named 'foo'.", - suggestions: [{ - desc: "Rename identifier 'foo' to 'bar'", - output: "var bar;" - }] - }] - }] - }); - }); - - it("should pass with suggestions on multiple lines", () => { - ruleTester.run("suggestions-basic", require("./fixtures/suggestions").basic, { - valid: [], - invalid: [ - { - code: "function foo() {\n var foo = 1;\n}", - errors: [{ - message: "Avoid using identifiers named 'foo'.", - suggestions: [{ - desc: "Rename identifier 'foo' to 'bar'", - output: "function bar() {\n var foo = 1;\n}" - }] - }, { - message: "Avoid using identifiers named 'foo'.", - suggestions: [{ - desc: "Rename identifier 'foo' to 'bar'", - output: "function foo() {\n var bar = 1;\n}" - }] - }] - } - ] - }); - }); - - it("should pass with valid suggestions (tested using messageIds)", () => { - ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - message: "Avoid using identifiers named 'foo'.", - suggestions: [{ - messageId: "renameFoo", - output: "var bar;" - }, { - messageId: "renameFoo", - output: "var baz;" - }] - }] - }] - }); - }); - - it("should pass with valid suggestions (one tested using messageIds, the other using desc)", () => { - ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - message: "Avoid using identifiers named 'foo'.", - suggestions: [{ - messageId: "renameFoo", - output: "var bar;" - }, { - desc: "Rename identifier 'foo' to 'baz'", - output: "var baz;" - }] - }] - }] - }); - }); - - it("should fail with valid suggestions when testing using both desc and messageIds for the same suggestion", () => { - assert.throw(() => { - ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - messageId: "avoidFoo", - suggestions: [{ - desc: "Rename identifier 'foo' to 'bar'", - messageId: "renameFoo", - output: "var bar;" - }, { - desc: "Rename identifier 'foo' to 'baz'", - messageId: "renameFoo", - output: "var baz;" - }] - }] - }] - }); - }, "Error Suggestion at index 0: Test should not specify both 'desc' and 'messageId'."); - }); - - it("should pass with valid suggestions (tested using only desc on a rule that utilizes meta.messages)", () => { - ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - messageId: "avoidFoo", - suggestions: [{ - desc: "Rename identifier 'foo' to 'bar'", - output: "var bar;" - }, { - desc: "Rename identifier 'foo' to 'baz'", - output: "var baz;" - }] - }] - }] - }); - }); - - it("should pass with valid suggestions (tested using messageIds and data)", () => { - ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - messageId: "avoidFoo", - suggestions: [{ - messageId: "renameFoo", - data: { newName: "bar" }, - output: "var bar;" - }, { - messageId: "renameFoo", - data: { newName: "baz" }, - output: "var baz;" - }] - }] - }] - }); - }); - - it("should fail with a single missing data placeholder when data is not specified", () => { - assert.throws(() => { - ruleTester.run("suggestions-messageIds", require("../../fixtures/testers/rule-tester/suggestions").withMissingPlaceholderData, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - messageId: "avoidFoo", - suggestions: [{ - messageId: "renameFoo", - output: "var bar;" - }] - }] - }] - }); - }, "The message of the suggestion has an unsubstituted placeholder 'newName'. Please provide the missing value via the 'data' property for the suggestion in the context.report() call."); - }); - - it("should fail with a single missing data placeholder when data is specified", () => { - assert.throws(() => { - ruleTester.run("suggestions-messageIds", require("../../fixtures/testers/rule-tester/suggestions").withMissingPlaceholderData, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - messageId: "avoidFoo", - suggestions: [{ - messageId: "renameFoo", - data: { other: "name" }, - output: "var bar;" - }] - }] - }] - }); - }, "The message of the suggestion has an unsubstituted placeholder 'newName'. Please provide the missing value via the 'data' property for the suggestion in the context.report() call."); - }); - - it("should fail with multiple missing data placeholders when data is not specified", () => { - assert.throws(() => { - ruleTester.run("suggestions-messageIds", require("../../fixtures/testers/rule-tester/suggestions").withMultipleMissingPlaceholderDataProperties, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - messageId: "avoidFoo", - suggestions: [{ - messageId: "rename", - output: "var bar;" - }] - }] - }] - }); - }, "The message of the suggestion has unsubstituted placeholders: 'currentName', 'newName'. Please provide the missing values via the 'data' property for the suggestion in the context.report() call."); - }); - - - it("should fail when tested using empty suggestion test objects even if the array length is correct", () => { - assert.throw(() => { - ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - messageId: "avoidFoo", - suggestions: [{}, {}] - }] - }] - }); - }, "Error Suggestion at index 0: Test must specify either 'messageId' or 'desc'"); - }); - - it("should fail when tested using non-empty suggestion test objects without an output property", () => { - assert.throw(() => { - ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - messageId: "avoidFoo", - suggestions: [{ messageId: "renameFoo" }, {}] - }] - }] - }); - }, 'Error Suggestion at index 0: The "output" property is required.'); - }); - - it("should support explicitly expecting no suggestions", () => { - [void 0, null, false, []].forEach(suggestions => { - ruleTester.run("suggestions-basic", require("./fixtures/no-eval"), { - valid: [], - invalid: [{ - code: "eval('var foo');", - errors: [{ - message: "eval sucks.", - suggestions - }] - }] - }); - }); - }); - - it("should fail when expecting no suggestions and there are suggestions", () => { - [void 0, null, false, []].forEach(suggestions => { - assert.throws(() => { - ruleTester.run("suggestions-basic", require("./fixtures/suggestions").basic, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - message: "Avoid using identifiers named 'foo'.", - suggestions - }] - }] - }); - }, "Error should have no suggestions on error with message: \"Avoid using identifiers named 'foo'.\""); - }); - }); - - it("should fail when testing for suggestions that don't exist", () => { - assert.throws(() => { - ruleTester.run("no-var", require("./fixtures/no-var"), { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - suggestions: [{ - message: "Bad var.", - messageId: "this-does-not-exist" - }] - }] - }] - }); - }, 'Error should have suggestions on error with message: "Bad var."'); - }); - - it("should support specifying only the amount of suggestions", () => { - ruleTester.run("suggestions-basic", require("./fixtures/suggestions").basic, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - message: "Avoid using identifiers named 'foo'.", - suggestions: 1 - }] - }] - }); - }); - - it("should fail when there are a different number of suggestions", () => { - assert.throws(() => { - ruleTester.run("suggestions-basic", require("./fixtures/suggestions").basic, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - message: "Avoid using identifiers named 'foo'.", - suggestions: 2 - }] - }] - }); - }, "Error should have 2 suggestions. Instead found 1 suggestions"); - }); - - it("should fail when there are a different number of suggestions for arrays", () => { - assert.throws(() => { - ruleTester.run("suggestions-basic", require("./fixtures/suggestions").basic, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - message: "Avoid using identifiers named 'foo'.", - suggestions: [{ - desc: "Rename identifier 'foo' to 'bar'", - output: "var bar;" - }, { - desc: "Rename identifier 'foo' to 'baz'", - output: "var baz;" - }] - }] - }] - }); - }, "Error should have 2 suggestions. Instead found 1 suggestions"); - }); - - it("should fail when the suggestion property is neither a number nor an array", () => { - assert.throws(() => { - ruleTester.run("suggestions-basic", require("./fixtures/suggestions").basic, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - message: "Avoid using identifiers named 'foo'.", - suggestions: "1" - }] - }] - }); - }, "Test error object property 'suggestions' should be an array or a number"); - }); - - it("should throw if suggestion fix made a syntax error.", () => { - assert.throw(() => { - ruleTester.run( - "foo", - { - meta: { hasSuggestions: true }, - create(context) { - return { - Identifier(node) { - context.report({ - node, - message: "make a syntax error", - suggest: [ - { - desc: "make a syntax error", - fix(fixer) { - return fixer.replaceText(node, "one two"); - } - } - ] - }); - } - }; - } - }, - { - valid: [""], - invalid: [{ - code: "one()", - errors: [{ - message: "make a syntax error", - suggestions: [{ - desc: "make a syntax error", - output: "one two()" - }] - }] - }] - } - ); - }, /A fatal parsing error occurred in suggestion fix\.\nError: .+\nSuggestion output:\n.+/u); - }); - - it("should throw if the suggestion description doesn't match", () => { - assert.throws(() => { - ruleTester.run("suggestions-basic", require("./fixtures/suggestions").basic, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - suggestions: [{ - desc: "not right", - output: "var baz;" - }] - }] - }] - }); - }, "Error Suggestion at index 0 : desc should be \"not right\" but got \"Rename identifier 'foo' to 'bar'\" instead."); - }); - - it("should pass when different suggestion matchers use desc and messageId", () => { - ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - messageId: "avoidFoo", - suggestions: [{ - desc: "Rename identifier 'foo' to 'bar'", - output: "var bar;" - }, { - messageId: "renameFoo", - output: "var baz;" - }] - }] - }] - }); - }); - - it("should throw if the suggestion messageId doesn't match", () => { - assert.throws(() => { - ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - messageId: "avoidFoo", - suggestions: [{ - messageId: "unused", - output: "var bar;" - }, { - messageId: "renameFoo", - output: "var baz;" - }] - }] - }] - }); - }, "Error Suggestion at index 0: messageId should be 'unused' but got 'renameFoo' instead."); - }); - - it("should throw if test specifies messageId for a rule that doesn't have meta.messages", () => { - assert.throws(() => { - ruleTester.run("suggestions-basic", require("./fixtures/suggestions").basic, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - message: "Avoid using identifiers named 'foo'.", - suggestions: [{ - messageId: "renameFoo", - output: "var bar;" - }] - }] - }] - }); - }, "Error Suggestion at index 0: Test can not use 'messageId' if rule under test doesn't define 'meta.messages'."); - }); - - it("should throw if test specifies messageId that doesn't exist in the rule's meta.messages", () => { - assert.throws(() => { - ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - messageId: "avoidFoo", - suggestions: [{ - messageId: "renameFoo", - output: "var bar;" - }, { - messageId: "removeFoo", - output: "var baz;" - }] - }] - }] - }); - }, "Error Suggestion at index 1: Test has invalid messageId 'removeFoo', the rule under test allows only one of ['avoidFoo', 'unused', 'renameFoo']."); - }); - - it("should throw if hydrated desc doesn't match (wrong data value)", () => { - assert.throws(() => { - ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - messageId: "avoidFoo", - suggestions: [{ - messageId: "renameFoo", - data: { newName: "car" }, - output: "var bar;" - }, { - messageId: "renameFoo", - data: { newName: "baz" }, - output: "var baz;" - }] - }] - }] - }); - }, "Error Suggestion at index 0: Hydrated test desc \"Rename identifier 'foo' to 'car'\" does not match received desc \"Rename identifier 'foo' to 'bar'\"."); - }); - - it("should throw if hydrated desc doesn't match (wrong data key)", () => { - assert.throws(() => { - ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - messageId: "avoidFoo", - suggestions: [{ - messageId: "renameFoo", - data: { newName: "bar" }, - output: "var bar;" - }, { - messageId: "renameFoo", - data: { name: "baz" }, - output: "var baz;" - }] - }] - }] - }); - }, "Error Suggestion at index 1: Hydrated test desc \"Rename identifier 'foo' to '{{ newName }}'\" does not match received desc \"Rename identifier 'foo' to 'baz'\"."); - }); - - it("should throw if test specifies both desc and data", () => { - assert.throws(() => { - ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - messageId: "avoidFoo", - suggestions: [{ - desc: "Rename identifier 'foo' to 'bar'", - messageId: "renameFoo", - data: { newName: "bar" }, - output: "var bar;" - }, { - messageId: "renameFoo", - data: { newName: "baz" }, - output: "var baz;" - }] - }] - }] - }); - }, "Error Suggestion at index 0: Test should not specify both 'desc' and 'data'."); - }); - - it("should throw if test uses data but doesn't specify messageId", () => { - assert.throws(() => { - ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - messageId: "avoidFoo", - suggestions: [{ - messageId: "renameFoo", - data: { newName: "bar" }, - output: "var bar;" - }, { - data: { newName: "baz" }, - output: "var baz;" - }] - }] - }] - }); - }, "Error Suggestion at index 1: Test must specify 'messageId' if 'data' is used."); - }); - - it("should throw if the resulting suggestion output doesn't match", () => { - assert.throws(() => { - ruleTester.run("suggestions-basic", require("./fixtures/suggestions").basic, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - message: "Avoid using identifiers named 'foo'.", - suggestions: [{ - desc: "Rename identifier 'foo' to 'bar'", - output: "var baz;" - }] - }] - }] - }); - }, "Expected the applied suggestion fix to match the test suggestion output"); - }); - - it("should throw if the resulting suggestion output is the same as the original source code", () => { - assert.throws(() => { - ruleTester.run("suggestions-basic", require("./fixtures/suggestions").withFixerWithoutChanges, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - message: "Avoid using identifiers named 'foo'.", - suggestions: [{ - desc: "Rename identifier 'foo' to 'bar'", - output: "var foo;" - }] - }] - }] - }); - }, "The output of a suggestion should differ from the original source code for suggestion at index: 0 on error with message: \"Avoid using identifiers named 'foo'.\""); - }); - - it("should fail when specified suggestion isn't an object", () => { - assert.throws(() => { - ruleTester.run("suggestions-basic", require("./fixtures/suggestions").basic, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - message: "Avoid using identifiers named 'foo'.", - suggestions: [null] - }] - }] - }); - }, "Test suggestion in 'suggestions' array must be an object."); - - assert.throws(() => { - ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - message: "avoidFoo", - suggestions: [ - { - messageId: "renameFoo", - output: "var bar;" - }, - "Rename identifier 'foo' to 'baz'" - ] - }] - }] - }); - }, "Test suggestion in 'suggestions' array must be an object."); - }); - - it("should fail when the suggestion is an object with an unknown property name", () => { - assert.throws(() => { - ruleTester.run("suggestions-basic", require("./fixtures/suggestions").basic, { - valid: [ - "var boo;" - ], - invalid: [{ - code: "var foo;", - errors: [{ - message: "avoidFoo", - suggestions: [{ - message: "Rename identifier 'foo' to 'bar'" - }] - }] - }] - }); - }, /Invalid suggestion property name 'message'/u); - }); - - it("should fail when any of the suggestions is an object with an unknown property name", () => { - assert.throws(() => { - ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - suggestions: [{ - messageId: "renameFoo", - output: "var bar;" - }, { - messageId: "renameFoo", - outpt: "var baz;" - }] - }] - }] - }); - }, /Invalid suggestion property name 'outpt'/u); - }); - - it("should fail if a rule produces two suggestions with the same description", () => { - assert.throws(() => { - ruleTester.run("suggestions-with-duplicate-descriptions", require("../../fixtures/testers/rule-tester/suggestions").withDuplicateDescriptions, { - valid: [], - invalid: [ - { code: "var foo = bar;", errors: 1 } - ] - }); - }, "Suggestion message 'Rename 'foo' to 'bar'' reported from suggestion 1 was previously reported by suggestion 0. Suggestion messages should be unique within an error."); - }); - - it("should fail if a rule produces two suggestions with the same messageId without data", () => { - assert.throws(() => { - ruleTester.run("suggestions-with-duplicate-messageids-no-data", require("../../fixtures/testers/rule-tester/suggestions").withDuplicateMessageIdsNoData, { - valid: [], - invalid: [ - { code: "var foo = bar;", errors: 1 } - ] - }); - }, "Suggestion message 'Rename identifier' reported from suggestion 1 was previously reported by suggestion 0. Suggestion messages should be unique within an error."); - }); - - it("should fail if a rule produces two suggestions with the same messageId with data", () => { - assert.throws(() => { - ruleTester.run("suggestions-with-duplicate-messageids-with-data", require("../../fixtures/testers/rule-tester/suggestions").withDuplicateMessageIdsWithData, { - valid: [], - invalid: [ - { code: "var foo = bar;", errors: 1 } - ] - }); - }, "Suggestion message 'Rename identifier 'foo' to 'bar'' reported from suggestion 1 was previously reported by suggestion 0. Suggestion messages should be unique within an error."); - }); - - it("should throw an error if a rule that doesn't have `meta.hasSuggestions` enabled produces suggestions", () => { - assert.throws(() => { - ruleTester.run("suggestions-missing-hasSuggestions-property", require("./fixtures/suggestions").withoutHasSuggestionsProperty, { - valid: [], - invalid: [ - { code: "var foo = bar;", output: "5", errors: 1 } - ] - }); - }, "Rules with suggestions must set the `meta.hasSuggestions` property to `true`."); - }); - }); - - describe("deprecations", () => { - let processStub; - const ruleWithNoSchema = { - meta: { - type: "suggestion" - }, - create(context) { - return { - Program(node) { - context.report({ node, message: "bad" }); - } - }; - } - }; - const ruleWithNoMeta = { - create(context) { - return { - Program(node) { - context.report({ node, message: "bad" }); - } - }; - } - }; - - beforeEach(() => { - processStub = sinon.stub(process, "emitWarning"); - }); - - afterEach(() => { - processStub.restore(); - }); - - it("should log a deprecation warning when using the legacy function-style API for rule", () => { - - /** - * Legacy-format rule (a function instead of an object with `create` method). - * @param {RuleContext} context The ESLint rule context object. - * @returns {Object} Listeners. - */ - function functionStyleRule(context) { - return { - Program(node) { - context.report({ node, message: "bad" }); - } - }; - } - - ruleTester.run("function-style-rule", functionStyleRule, { - valid: [], - invalid: [ - { code: "var foo = bar;", errors: 1 } - ] - }); - - assert.strictEqual(processStub.callCount, 1, "calls `process.emitWarning()` once"); - assert.deepStrictEqual( - processStub.getCall(0).args, - [ - "\"function-style-rule\" rule is using the deprecated function-style format and will stop working in ESLint v9. Please use object-style format: https://eslint.org/docs/latest/extend/custom-rules", - "DeprecationWarning" - ] - ); - }); - - it("should log a deprecation warning when meta is not defined for the rule", () => { - ruleTester.run("rule-with-no-meta-1", ruleWithNoMeta, { - valid: [], - invalid: [ - { code: "var foo = bar;", options: [{ foo: true }], errors: 1 } - ] - }); - - assert.strictEqual(processStub.callCount, 1, "calls `process.emitWarning()` once"); - assert.deepStrictEqual( - processStub.getCall(0).args, - [ - "\"rule-with-no-meta-1\" rule has options but is missing the \"meta.schema\" property and will stop working in ESLint v9. Please add a schema: https://eslint.org/docs/latest/extend/custom-rules#options-schemas", - "DeprecationWarning" - ] - ); - }); - - it("should log a deprecation warning when schema is not defined for the rule", () => { - ruleTester.run("rule-with-no-schema-1", ruleWithNoSchema, { - valid: [], - invalid: [ - { code: "var foo = bar;", options: [{ foo: true }], errors: 1 } - ] - }); - - assert.strictEqual(processStub.callCount, 1, "calls `process.emitWarning()` once"); - assert.deepStrictEqual( - processStub.getCall(0).args, - [ - "\"rule-with-no-schema-1\" rule has options but is missing the \"meta.schema\" property and will stop working in ESLint v9. Please add a schema: https://eslint.org/docs/latest/extend/custom-rules#options-schemas", - "DeprecationWarning" - ] - ); - }); - - it("should log a deprecation warning when schema is `undefined`", () => { - const ruleWithUndefinedSchema = { - meta: { - type: "problem", - // eslint-disable-next-line no-undefined -- intentionally added for test case - schema: undefined - }, - create(context) { - return { - Program(node) { - context.report({ node, message: "bad" }); - } - }; - } - }; - - ruleTester.run("rule-with-undefined-schema", ruleWithUndefinedSchema, { - valid: [], - invalid: [ - { code: "var foo = bar;", options: [{ foo: true }], errors: 1 } - ] - }); - - assert.strictEqual(processStub.callCount, 1, "calls `process.emitWarning()` once"); - assert.deepStrictEqual( - processStub.getCall(0).args, - [ - "\"rule-with-undefined-schema\" rule has options but is missing the \"meta.schema\" property and will stop working in ESLint v9. Please add a schema: https://eslint.org/docs/latest/extend/custom-rules#options-schemas", - "DeprecationWarning" - ] - ); - }); - - it("should log a deprecation warning when schema is `null`", () => { - const ruleWithNullSchema = { - meta: { - type: "problem", - schema: null - }, - create(context) { - return { - Program(node) { - context.report({ node, message: "bad" }); - } - }; - } - }; - - ruleTester.run("rule-with-null-schema", ruleWithNullSchema, { - valid: [], - invalid: [ - { code: "var foo = bar;", options: [{ foo: true }], errors: 1 } - ] - }); - - assert.strictEqual(processStub.callCount, 1, "calls `process.emitWarning()` once"); - assert.deepStrictEqual( - processStub.getCall(0).args, - [ - "\"rule-with-null-schema\" rule has options but is missing the \"meta.schema\" property and will stop working in ESLint v9. Please add a schema: https://eslint.org/docs/latest/extend/custom-rules#options-schemas", - "DeprecationWarning" - ] - ); - }); - - it("should not log a deprecation warning when schema is an empty array", () => { - const ruleWithEmptySchema = { - meta: { - type: "suggestion", - schema: [] - }, - create(context) { - return { - Program(node) { - context.report({ node, message: "bad" }); - } - }; - } - }; - - ruleTester.run("rule-with-no-options", ruleWithEmptySchema, { - valid: [], - invalid: [{ code: "var foo = bar;", errors: 1 }] - }); - - assert.strictEqual(processStub.callCount, 0, "never calls `process.emitWarning()`"); - }); - - it("When the rule is an object-style rule, the legacy rule API warning is not emitted", () => { - ruleTester.run("rule-with-no-schema-2", ruleWithNoSchema, { - valid: [], - invalid: [ - { code: "var foo = bar;", errors: 1 } - ] - }); - - assert.strictEqual(processStub.callCount, 0, "never calls `process.emitWarning()`"); - }); - - it("When the rule has meta.schema and there are test cases with options, the missing schema warning is not emitted", () => { - const ruleWithSchema = { - meta: { - type: "suggestion", - schema: [{ - type: "boolean" - }] - }, - create(context) { - return { - Program(node) { - context.report({ node, message: "bad" }); - } - }; - } - }; - - ruleTester.run("rule-with-schema", ruleWithSchema, { - valid: [], - invalid: [ - { code: "var foo = bar;", options: [true], errors: 1 } - ] - }); - - assert.strictEqual(processStub.callCount, 0, "never calls `process.emitWarning()`"); - }); - - it("When the rule does not have meta, but there are no test cases with options, the missing schema warning is not emitted", () => { - ruleTester.run("rule-with-no-meta-2", ruleWithNoMeta, { - valid: [], - invalid: [ - { code: "var foo = bar;", errors: 1 } - ] - }); - - assert.strictEqual(processStub.callCount, 0, "never calls `process.emitWarning()`"); - }); - - it("When the rule has meta without meta.schema, but there are no test cases with options, the missing schema warning is not emitted", () => { - ruleTester.run("rule-with-no-schema-3", ruleWithNoSchema, { - valid: [], - invalid: [ - { code: "var foo = bar;", errors: 1 } - ] - }); - - assert.strictEqual(processStub.callCount, 0, "never calls `process.emitWarning()`"); - }); - it("When the rule has meta without meta.schema, and some test cases have options property but it's an empty array, the missing schema warning is not emitted", () => { - ruleTester.run("rule-with-no-schema-4", ruleWithNoSchema, { - valid: [], - invalid: [ - { code: "var foo = bar;", options: [], errors: 1 } - ] - }); - - assert.strictEqual(processStub.callCount, 0, "never calls `process.emitWarning()`"); - }); - }); - - /** - * Asserts that a particular value will be emitted from an EventEmitter. - * @param {EventEmitter} emitter The emitter that should emit a value - * @param {string} emitType The type of emission to listen for - * @param {any} expectedValue The value that should be emitted - * @returns {Promise} A Promise that fulfills if the value is emitted, and rejects if something else is emitted. - * The Promise will be indefinitely pending if no value is emitted. - */ - function assertEmitted(emitter, emitType, expectedValue) { - return new Promise((resolve, reject) => { - emitter.once(emitType, emittedValue => { - if (emittedValue === expectedValue) { - resolve(); - } else { - reject(new Error(`Expected ${expectedValue} to be emitted but ${emittedValue} was emitted instead.`)); - } - }); - }); - } - - describe("naming test cases", () => { - - it("should use the first argument as the name of the test suite", () => { - const assertion = assertEmitted(ruleTesterTestEmitter, "describe", "this-is-a-rule-name"); - - ruleTester.run("this-is-a-rule-name", require("./fixtures/no-var"), { - valid: [], - invalid: [] - }); - - return assertion; - }); - - it("should use the test code as the name of the tests for valid code (string form)", () => { - const assertion = assertEmitted(ruleTesterTestEmitter, "it", "valid(code);"); - - ruleTester.run("foo", require("./fixtures/no-var"), { - valid: [ - "valid(code);" - ], - invalid: [] - }); - - return assertion; - }); - - it("should use the test code as the name of the tests for valid code (object form)", () => { - const assertion = assertEmitted(ruleTesterTestEmitter, "it", "valid(code);"); - - ruleTester.run("foo", require("./fixtures/no-var"), { - valid: [ - { - code: "valid(code);" - } - ], - invalid: [] - }); - - return assertion; - }); - - it("should use the test code as the name of the tests for invalid code", () => { - const assertion = assertEmitted(ruleTesterTestEmitter, "it", "var x = invalid(code);"); - - ruleTester.run("foo", require("./fixtures/no-var"), { - valid: [], - invalid: [ - { - code: "var x = invalid(code);", - output: " x = invalid(code);", - errors: 1 - } - ] - }); - - return assertion; - }); - - // https://github.com/eslint/eslint/issues/8142 - it("should use the empty string as the name of the test if the test case is an empty string", () => { - const assertion = assertEmitted(ruleTesterTestEmitter, "it", ""); - - ruleTester.run("foo", require("./fixtures/no-var"), { - valid: [ - { - code: "" - } - ], - invalid: [] - }); - - return assertion; - }); - - it('should use the "name" property if set to a non-empty string', () => { - const assertion = assertEmitted(ruleTesterTestEmitter, "it", "my test"); - - ruleTester.run("foo", require("./fixtures/no-var"), { - valid: [], - invalid: [ - { - name: "my test", - code: "var x = invalid(code);", - output: " x = invalid(code);", - errors: 1 - } - ] - }); - - return assertion; - }); - - it('should use the "name" property if set to a non-empty string for valid cases too', () => { - const assertion = assertEmitted(ruleTesterTestEmitter, "it", "my test"); - - ruleTester.run("foo", require("./fixtures/no-var"), { - valid: [ - { - name: "my test", - code: "valid(code);" - } - ], - invalid: [] - }); - - return assertion; - }); - - - it('should use the test code as the name if the "name" property is set to an empty string', () => { - const assertion = assertEmitted(ruleTesterTestEmitter, "it", "var x = invalid(code);"); - - ruleTester.run("foo", require("./fixtures/no-var"), { - valid: [], - invalid: [ - { - name: "", - code: "var x = invalid(code);", - output: " x = invalid(code);", - errors: 1 - } - ] - }); - - return assertion; - }); - - it('should throw if "name" property is not a string', () => { - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/no-var"), { - valid: [{ code: "foo", name: 123 }], - invalid: [{ code: "foo" }] - - }); - }, /Optional test case property 'name' must be a string/u); - - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/no-var"), { - valid: ["foo"], - invalid: [{ code: "foo", name: 123 }] - }); - }, /Optional test case property 'name' must be a string/u); - }); - - it('should throw if "code" property is not a string', () => { - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/no-var"), { - valid: [{ code: 123 }], - invalid: [{ code: "foo" }] - - }); - }, /Test case must specify a string value for 'code'/u); - - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/no-var"), { - valid: [123], - invalid: [{ code: "foo" }] - - }); - }, /Test case must specify a string value for 'code'/u); - - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/no-var"), { - valid: ["foo"], - invalid: [{ code: 123 }] - }); - }, /Test case must specify a string value for 'code'/u); - }); - - it('should throw if "code" property is missing', () => { - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/no-var"), { - valid: [{ }], - invalid: [{ code: "foo" }] - - }); - }, /Test case must specify a string value for 'code'/u); - - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/no-var"), { - valid: ["foo"], - invalid: [{ }] - }); - }, /Test case must specify a string value for 'code'/u); - }); - }); - - // https://github.com/eslint/eslint/issues/11615 - it("should fail the case if autofix made a syntax error.", () => { - assert.throw(() => { - ruleTester.run( - "foo", - { - meta: { - fixable: "code" - }, - create(context) { - return { - Identifier(node) { - context.report({ - node, - message: "make a syntax error", - fix(fixer) { - return fixer.replaceText(node, "one two"); - } - }); - } - }; - } - }, - { - valid: ["one()"], - invalid: [] - } - ); - }, /A fatal parsing error occurred in autofix.\nError: .+\nAutofix output:\n.+/u); - }); - - describe("type checking", () => { - it('should throw if "only" property is not a boolean', () => { - - // "only" has to be falsy as itOnly is not mocked for all test cases - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/no-var"), { - valid: [{ code: "foo", only: "" }], - invalid: [] - }); - }, /Optional test case property 'only' must be a boolean/u); - - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/no-var"), { - valid: [], - invalid: [{ code: "foo", only: 0, errors: 1 }] - }); - }, /Optional test case property 'only' must be a boolean/u); - }); - - it('should throw if "filename" property is not a string', () => { - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/no-var"), { - valid: [{ code: "foo", filename: false }], - invalid: [] - - }); - }, /Optional test case property 'filename' must be a string/u); - - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/no-var"), { - valid: ["foo"], - invalid: [{ code: "foo", errors: 1, filename: 0 }] - }); - }, /Optional test case property 'filename' must be a string/u); - }); - }); - - describe("sanitize test cases", () => { - let originalRuleTesterIt; - let spyRuleTesterIt; - - before(() => { - originalRuleTesterIt = RuleTester.it; - spyRuleTesterIt = sinon.spy(); - RuleTester.it = spyRuleTesterIt; - }); - after(() => { - RuleTester.it = originalRuleTesterIt; - }); - beforeEach(() => { - spyRuleTesterIt.resetHistory(); - ruleTester = new RuleTester(); - }); - it("should present newline when using back-tick as new line", () => { - const code = ` - var foo = bar;`; - - ruleTester.run("no-var", require("./fixtures/no-var"), { - valid: [], - invalid: [ - { - code, - errors: [/^Bad var/u] - } - ] - }); - sinon.assert.calledWith(spyRuleTesterIt, code); - }); - it("should present \\u0000 as a string", () => { - const code = "\u0000"; - - ruleTester.run("no-var", require("./fixtures/no-var"), { - valid: [], - invalid: [ - { - code, - errors: [/^Bad var/u] - } - ] - }); - sinon.assert.calledWith(spyRuleTesterIt, "\\u0000"); - }); - it("should present the pipe character correctly", () => { - const code = "var foo = bar || baz;"; - - ruleTester.run("no-var", require("./fixtures/no-var"), { - valid: [], - invalid: [ - { - code, - errors: [/^Bad var/u] - } - ] - }); - sinon.assert.calledWith(spyRuleTesterIt, code); - }); - - }); - - describe("SourceCode#getComments()", () => { - const useGetCommentsRule = { - create: context => ({ - Program(node) { - const sourceCode = context.getSourceCode(); - - sourceCode.getComments(node); - } - }) - }; - - it("should throw if called from a valid test case", () => { - assert.throws(() => { - ruleTester.run("use-get-comments", useGetCommentsRule, { - valid: [""], - invalid: [] - }); - }, /`SourceCode#getComments\(\)` is deprecated/u); - }); - - it("should throw if called from an invalid test case", () => { - assert.throws(() => { - ruleTester.run("use-get-comments", useGetCommentsRule, { - valid: [], - invalid: [{ - code: "", - errors: [{}] - }] - }); - }, /`SourceCode#getComments\(\)` is deprecated/u); - }); - }); - - describe("Subclassing", () => { - - it("should allow subclasses to set the describe/it/itOnly statics and should correctly use those values", () => { - const assertionDescribe = assertEmitted(ruleTesterTestEmitter, "custom describe", "this-is-a-rule-name"); - const assertionIt = assertEmitted(ruleTesterTestEmitter, "custom it", "valid(code);"); - const assertionItOnly = assertEmitted(ruleTesterTestEmitter, "custom itOnly", "validOnly(code);"); - - /** - * Subclass for testing - */ - class RuleTesterSubclass extends RuleTester { } - RuleTesterSubclass.describe = function(text, method) { - ruleTesterTestEmitter.emit("custom describe", text, method); - return method.call(this); - }; - RuleTesterSubclass.it = function(text, method) { - ruleTesterTestEmitter.emit("custom it", text, method); - return method.call(this); - }; - RuleTesterSubclass.itOnly = function(text, method) { - ruleTesterTestEmitter.emit("custom itOnly", text, method); - return method.call(this); - }; - - const ruleTesterSubclass = new RuleTesterSubclass(); - - ruleTesterSubclass.run("this-is-a-rule-name", require("./fixtures/no-var"), { - valid: [ - "valid(code);", - { - code: "validOnly(code);", - only: true - } - ], - invalid: [] - }); - - return Promise.all([ - assertionDescribe, - assertionIt, - assertionItOnly - ]); - }); - - }); - - describe("duplicate test cases", () => { - describe("valid test cases", () => { - it("throws with duplicate string test cases", () => { - assert.throws(() => { - ruleTester.run("foo", { - meta: {}, - create() { - return {}; - } - }, { - valid: ["foo", "foo"], - invalid: [] - }); - }, "detected duplicate test case"); - }); - - it("throws with duplicate object test cases", () => { - assert.throws(() => { - ruleTester.run("foo", { - meta: {}, - create() { - return {}; - } - }, { - valid: [{ code: "foo" }, { code: "foo" }], - invalid: [] - }); - }, "detected duplicate test case"); - }); - - it("throws with string and object test cases", () => { - assert.throws(() => { - ruleTester.run("foo", { - meta: {}, - create() { - return {}; - } - }, { - valid: ["foo", { code: "foo" }], - invalid: [] - }); - }, "detected duplicate test case"); - }); - - it("ignores the name property", () => { - assert.throws(() => { - ruleTester.run("foo", { - meta: {}, - create() { - return {}; - } - }, { - valid: [{ code: "foo" }, { name: "bar", code: "foo" }], - invalid: [] - }); - }, "detected duplicate test case"); - }); - - it("does not ignore top level test case properties nested in other test case properties", () => { - ruleTester.run("foo", { - meta: { schema: [{ type: "object" }] }, - create() { - return {}; - } - }, { - valid: [{ options: [{ name: "foo" }], name: "foo", code: "same" }, { options: [{ name: "bar" }], name: "bar", code: "same" }], - invalid: [] - }); - }); - - it("does not throw an error for defining the same test case in different run calls", () => { - const rule = { - meta: {}, - create() { - return {}; - } - }; - - ruleTester.run("foo", rule, { - valid: ["foo"], - invalid: [] - }); - - ruleTester.run("foo", rule, { - valid: ["foo"], - invalid: [] - }); - }); - }); - - describe("invalid test cases", () => { - it("throws with duplicate object test cases", () => { - assert.throws(() => { - ruleTester.run("foo", { - meta: {}, - create(context) { - return { - VariableDeclaration(node) { - context.report(node, "foo bar"); - } - }; - } - }, { - valid: ["foo"], - invalid: [ - { code: "const x = 123;", errors: [{ message: "foo bar" }] }, - { code: "const x = 123;", errors: [{ message: "foo bar" }] } - ] - }); - }, "detected duplicate test case"); - }); - - it("throws with duplicate object test cases when options is a primitive", () => { - assert.throws(() => { - ruleTester.run("foo", { - meta: { schema: false }, - create(context) { - return { - VariableDeclaration(node) { - context.report(node, "foo bar"); - } - }; - } - }, { - valid: ["foo"], - invalid: [ - { code: "const x = 123;", errors: [{ message: "foo bar" }], options: ["abc"] }, - { code: "const x = 123;", errors: [{ message: "foo bar" }], options: ["abc"] } - ] - }); - }, "detected duplicate test case"); - }); - - it("throws with duplicate object test cases when options is a nested serializable object", () => { - assert.throws(() => { - ruleTester.run("foo", { - meta: { schema: false }, - create(context) { - return { - VariableDeclaration(node) { - context.report(node, "foo bar"); - } - }; - } - }, { - valid: ["foo"], - invalid: [ - { code: "const x = 123;", errors: [{ message: "foo bar" }], options: [{ foo: [{ a: true, b: [1, 2, 3] }] }] }, - { code: "const x = 123;", errors: [{ message: "foo bar" }], options: [{ foo: [{ a: true, b: [1, 2, 3] }] }] } - ] - }); - }, "detected duplicate test case"); - }); - - it("throws with duplicate object test cases even when property order differs", () => { - assert.throws(() => { - ruleTester.run("foo", { - meta: {}, - create(context) { - return { - VariableDeclaration(node) { - context.report(node, "foo bar"); - } - }; - } - }, { - valid: ["foo"], - invalid: [ - { code: "const x = 123;", errors: [{ message: "foo bar" }] }, - { errors: [{ message: "foo bar" }], code: "const x = 123;" } - ] - }); - }, "detected duplicate test case"); - }); - - it("ignores duplicate test case when non-serializable property present (settings)", () => { - ruleTester.run("foo", { - meta: {}, - create(context) { - return { - VariableDeclaration(node) { - context.report(node, "foo bar"); - } - }; - } - }, { - valid: ["foo"], - invalid: [ - { code: "const x = 123;", errors: [{ message: "foo bar" }], settings: { foo: /abc/u } }, - { code: "const x = 123;", errors: [{ message: "foo bar" }], settings: { foo: /abc/u } } - ] - }); - }); - - it("ignores duplicate test case when non-serializable property present (languageOptions.parserOptions)", () => { - ruleTester.run("foo", { - meta: {}, - create(context) { - return { - VariableDeclaration(node) { - context.report(node, "foo bar"); - } - }; - } - }, { - valid: ["foo"], - invalid: [ - { code: "const x = 123;", errors: [{ message: "foo bar" }], languageOptions: { parserOptions: { foo: /abc/u } } }, - { code: "const x = 123;", errors: [{ message: "foo bar" }], languageOptions: { parserOptions: { foo: /abc/u } } } - ] - }); - }); - - it("ignores duplicate test case when non-serializable property present (plugins)", () => { - ruleTester.run("foo", { - meta: {}, - create(context) { - return { - VariableDeclaration(node) { - context.report(node, "foo bar"); - } - }; - } - }, { - valid: ["foo"], - invalid: [ - { code: "const x = 123;", errors: [{ message: "foo bar" }], plugins: { foo: /abc/u } }, - { code: "const x = 123;", errors: [{ message: "foo bar" }], plugins: { foo: /abc/u } } - ] - }); - }); - - it("ignores duplicate test case when non-serializable property present (options)", () => { - ruleTester.run("foo", { - meta: { schema: false }, - create(context) { - return { - VariableDeclaration(node) { - context.report(node, "foo bar"); - } - }; - } - }, { - valid: ["foo"], - invalid: [ - { code: "const x = 123;", errors: [{ message: "foo bar" }], options: [{ foo: /abc/u }] }, - { code: "const x = 123;", errors: [{ message: "foo bar" }], options: [{ foo: /abc/u }] } - ] - }); - }); - - it("detects duplicate test cases even if the error matchers differ", () => { - assert.throws(() => { - ruleTester.run("foo", { - meta: { schema: false }, - create(context) { - return { - VariableDeclaration(node) { - context.report(node, "foo bar"); - } - }; - } - }, { - valid: [], - invalid: [ - { code: "const x = 123;", errors: [{ message: "foo bar" }] }, - { code: "const x = 123;", errors: 1 } - ] - }); - }, "detected duplicate test case"); - }); - - it("detects duplicate test cases even if the presence of the output property differs", () => { - assert.throws(() => { - ruleTester.run("foo", { - meta: { schema: false }, - create(context) { - return { - VariableDeclaration(node) { - context.report(node, "foo bar"); - } - }; - } - }, { - valid: [], - invalid: [ - { code: "const x = 123;", errors: 1 }, - { code: "const x = 123;", errors: 1, output: null } - ] - }); - }, "detected duplicate test case"); - }); - }); - }); - -}); diff --git a/packages/rule-tester/tests/eslint-base/fixtures/empty-program-parser.js b/packages/rule-tester/tests/eslint-base/fixtures/empty-program-parser.js deleted file mode 100644 index 06a87c90dcde..000000000000 --- a/packages/rule-tester/tests/eslint-base/fixtures/empty-program-parser.js +++ /dev/null @@ -1,29 +0,0 @@ -// Forked from https://github.com/eslint/eslint/blob/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/fixtures/parsers/empty-program-parser.js - -"use strict"; - -exports.parse = function (text, parserOptions) { - return { - "type": "Program", - "start": 0, - "end": 0, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 0 - } - }, - "range": [ - 0, - 0 - ], - "body": [], - "sourceType": "script", - "comments": [], - "tokens": [] - }; -}; diff --git a/packages/rule-tester/tests/eslint-base/fixtures/enhanced-parser.js b/packages/rule-tester/tests/eslint-base/fixtures/enhanced-parser.js deleted file mode 100644 index 9aef71554d3d..000000000000 --- a/packages/rule-tester/tests/eslint-base/fixtures/enhanced-parser.js +++ /dev/null @@ -1,20 +0,0 @@ -// Forked from https://github.com/eslint/eslint/blob/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/fixtures/parsers/enhanced-parser.js - -var espree = require("espree"); - -exports.parseForESLint = function(code, options) { - return { - ast: espree.parse(code, options), - services: { - test: { - getMessage() { - return "Hi!"; - } - } - } - }; -}; - -exports.parse = function() { - throw new Error("Use parseForESLint() instead."); -}; diff --git a/packages/rule-tester/tests/eslint-base/fixtures/enhanced-parser2.js b/packages/rule-tester/tests/eslint-base/fixtures/enhanced-parser2.js deleted file mode 100644 index bd91282a38c6..000000000000 --- a/packages/rule-tester/tests/eslint-base/fixtures/enhanced-parser2.js +++ /dev/null @@ -1,25 +0,0 @@ -// Forked from https://github.com/eslint/eslint/blob/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/fixtures/parsers/enhanced-parser2.js - -"use strict"; - -const assert = require("assert"); -const vk = require("eslint-visitor-keys"); -const KEYS = vk.unionWith({ - ClassDeclaration: ["experimentalDecorators"], - ClassExpression: ["experimentalDecorators"] -}) - -exports.parseForESLint = (code, options) => { - assert(code === "@foo class A {}"); - assert(options.eslintVisitorKeys === true); - assert(options.eslintScopeManager === true); - - return { - ast: { type: "Program", start: 0, end: 15, loc: { start: { line: 1, column: 0 }, end: { line: 1, column: 15 } }, comments: [], tokens: [{ type: "Punctuator", value: "@", start: 0, end: 1, loc: { start: { line: 1, column: 0 }, end: { line: 1, column: 1 } }, range: [0, 1] }, { type: "Identifier", value: "foo", start: 1, end: 4, loc: { start: { line: 1, column: 1 }, end: { line: 1, column: 4 } }, range: [1, 4] }, { type: "Keyword", value: "class", start: 5, end: 10, loc: { start: { line: 1, column: 5 }, end: { line: 1, column: 10 } }, range: [5, 10] }, { type: "Identifier", value: "A", start: 11, end: 12, loc: { start: { line: 1, column: 11 }, end: { line: 1, column: 12 } }, range: [11, 12] }, { type: "Punctuator", value: "{", start: 13, end: 14, loc: { start: { line: 1, column: 13 }, end: { line: 1, column: 14 } }, range: [13, 14] }, { type: "Punctuator", value: "}", start: 14, end: 15, loc: { start: { line: 1, column: 14 }, end: { line: 1, column: 15 } }, range: [14, 15] }], range: [5, 15], sourceType: "module", body: [{ type: "ClassDeclaration", start: 5, end: 15, loc: { start: { line: 1, column: 5 }, end: { line: 1, column: 15 } }, experimentalDecorators: [{ type: "Decorator", start: 0, end: 4, loc: { start: { line: 1, column: 0 }, end: { line: 1, column: 4 } }, expression: { type: "Identifier", start: 1, end: 4, loc: { start: { line: 1, column: 1 }, end: { line: 1, column: 4 }, identifierName: "foo" }, name: "foo", range: [1, 4], _babelType: "Identifier" }, range: [0, 4], _babelType: "Decorator" }], id: { type: "Identifier", start: 11, end: 12, loc: { start: { line: 1, column: 11 }, end: { line: 1, column: 12 }, identifierName: "A" }, name: "A", range: [11, 12], _babelType: "Identifier" }, superClass: null, body: { type: "ClassBody", start: 13, end: 15, loc: { start: { line: 1, column: 13 }, end: { line: 1, column: 15 } }, body: [], range: [13, 15], _babelType: "ClassBody" }, range: [5, 15], _babelType: "ClassDeclaration" }] }, - visitorKeys: KEYS - }; -}; - -exports.parse = function () { - throw new Error("Use parseForESLint() instead."); -}; diff --git a/packages/rule-tester/tests/eslint-base/fixtures/fixes-one-problem.js b/packages/rule-tester/tests/eslint-base/fixtures/fixes-one-problem.js deleted file mode 100644 index adde04196c95..000000000000 --- a/packages/rule-tester/tests/eslint-base/fixtures/fixes-one-problem.js +++ /dev/null @@ -1,25 +0,0 @@ -// Forked from https://github.com/eslint/eslint/tree/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/fixtures/testers/rule-tester/fixes-one-problem.js - -"use strict"; - -module.exports = { - meta: { - fixable: "code" - }, - create(context) { - return { - Program(node) { - context.report({ - node, - message: "No programs allowed." - }); - - context.report({ - node, - message: "Seriously, no programs allowed.", - fix: fixer => fixer.remove(node) - }); - } - } - } -}; diff --git a/packages/rule-tester/tests/eslint-base/fixtures/messageId.js b/packages/rule-tester/tests/eslint-base/fixtures/messageId.js deleted file mode 100644 index 3813b878edc6..000000000000 --- a/packages/rule-tester/tests/eslint-base/fixtures/messageId.js +++ /dev/null @@ -1,146 +0,0 @@ -// Forked from https://github.com/eslint/eslint/tree/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/fixtures/testers/rule-tester/messageId.js - -"use strict"; - -module.exports.withMetaWithData = { - meta: { - messages: { - avoidFoo: "Avoid using variables named '{{ name }}'.", - unused: "An unused key" - } - }, - create(context) { - return { - Identifier(node) { - if (node.name === "foo") { - context.report({ - node, - messageId: "avoidFoo", - data: { - name: "foo" - } - }); - } - } - }; - } -}; - -module.exports.withMessageOnly = { - create(context) { - return { - Identifier(node) { - if (node.name === "foo") { - context.report({ node, message: "Avoid using variables named 'foo'."}); - } - } - }; - } -}; - -module.exports.withMissingData = { - meta: { - messages: { - avoidFoo: "Avoid using variables named '{{ name }}'.", - unused: "An unused key" - } - }, - create(context) { - return { - Identifier(node) { - if (node.name === "foo") { - context.report({ - node, - messageId: "avoidFoo", - }); - } - } - }; - } -}; - -module.exports.withMultipleMissingDataProperties = { - meta: { - messages: { - avoidFoo: "Avoid using {{ type }} named '{{ name }}'.", - unused: "An unused key" - } - }, - create(context) { - return { - Identifier(node) { - if (node.name === "foo") { - context.report({ - node, - messageId: "avoidFoo", - }); - } - } - }; - } -}; - -module.exports.withPlaceholdersInData = { - meta: { - messages: { - avoidFoo: "Avoid using variables named '{{ name }}'.", - unused: "An unused key" - } - }, - create(context) { - return { - Identifier(node) { - if (node.name === "foo") { - context.report({ - node, - messageId: "avoidFoo", - data: { name: '{{ placeholder }}' }, - }); - } - } - }; - } -}; - -module.exports.withSamePlaceholdersInData = { - meta: { - messages: { - avoidFoo: "Avoid using variables named '{{ name }}'.", - unused: "An unused key" - } - }, - create(context) { - return { - Identifier(node) { - if (node.name === "foo") { - context.report({ - node, - messageId: "avoidFoo", - data: { name: '{{ name }}' }, - }); - } - } - }; - } -}; - -module.exports.withNonStringData = { - meta: { - messages: { - avoid: "Avoid using the value '{{ value }}'.", - } - }, - create(context) { - return { - Literal(node) { - if (node.value === 0) { - context.report({ - node, - messageId: "avoid", - data: { value: 0 }, - }); - } - } - }; - } -}; diff --git a/packages/rule-tester/tests/eslint-base/fixtures/modify-ast-at-first.js b/packages/rule-tester/tests/eslint-base/fixtures/modify-ast-at-first.js deleted file mode 100644 index 53ddcd28847e..000000000000 --- a/packages/rule-tester/tests/eslint-base/fixtures/modify-ast-at-first.js +++ /dev/null @@ -1,37 +0,0 @@ -// Forked from https://github.com/eslint/eslint/tree/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/fixtures/testers/rule-tester/modify-ast-at-first.js - -"use strict"; - -module.exports = { - meta: { - type: "problem", - schema: [] - }, - create(context) { - return { - "Program": function(node) { - node.body.push({ - "type": "Identifier", - "name": "modified", - "range": [0, 8], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }); - }, - - "Identifier": function(node) { - if (node.name === "bar") { - context.report({message: "error", node: node}); - } - } - }; - }, -}; diff --git a/packages/rule-tester/tests/eslint-base/fixtures/modify-ast-at-last.js b/packages/rule-tester/tests/eslint-base/fixtures/modify-ast-at-last.js deleted file mode 100644 index 9fda56d02609..000000000000 --- a/packages/rule-tester/tests/eslint-base/fixtures/modify-ast-at-last.js +++ /dev/null @@ -1,37 +0,0 @@ -// Forked from https://github.com/eslint/eslint/tree/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/fixtures/testers/rule-tester/modify-ast-at-last.js - -"use strict"; - -module.exports = { - meta: { - type: "problem", - schema: [] - }, - create(context) { - return { - "Program:exit": function(node) { - node.body.push({ - "type": "Identifier", - "name": "modified", - "range": [0, 8], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }); - }, - - "Identifier": function(node) { - if (node.name === "bar") { - context.report({message: "error", node: node}); - } - } - }; - }, -}; diff --git a/packages/rule-tester/tests/eslint-base/fixtures/modify-ast.js b/packages/rule-tester/tests/eslint-base/fixtures/modify-ast.js deleted file mode 100644 index 3b8a879920aa..000000000000 --- a/packages/rule-tester/tests/eslint-base/fixtures/modify-ast.js +++ /dev/null @@ -1,21 +0,0 @@ -// Forked from https://github.com/eslint/eslint/tree/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/fixtures/testers/rule-tester/modify-ast.js - -"use strict"; - -module.exports = { - meta: { - type: "problem", - schema: [] - }, - create(context) { - return { - "Identifier": function(node) { - node.name += "!"; - - if (node.name === "bar!") { - context.report({message: "error", node: node}); - } - } - }; - }, -}; diff --git a/packages/rule-tester/tests/eslint-base/fixtures/no-eval.js b/packages/rule-tester/tests/eslint-base/fixtures/no-eval.js deleted file mode 100644 index a7cba23f6128..000000000000 --- a/packages/rule-tester/tests/eslint-base/fixtures/no-eval.js +++ /dev/null @@ -1,19 +0,0 @@ -// Forked from https://github.com/eslint/eslint/tree/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/fixtures/testers/rule-tester/no-eval.js - -"use strict"; - -module.exports = { - meta: { - type: "problem", - schema: [], - }, - create(context) { - return { - CallExpression: function (node) { - if (node.callee.name === "eval") { - context.report(node, "eval sucks."); - } - }, - }; - }, -}; diff --git a/packages/rule-tester/tests/eslint-base/fixtures/no-invalid-args.js b/packages/rule-tester/tests/eslint-base/fixtures/no-invalid-args.js deleted file mode 100644 index 7f9a1683aa07..000000000000 --- a/packages/rule-tester/tests/eslint-base/fixtures/no-invalid-args.js +++ /dev/null @@ -1,23 +0,0 @@ -// Forked from https://github.com/eslint/eslint/tree/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/fixtures/testers/rule-tester/no-invalid-args.js - -"use strict"; - -module.exports = { - meta: { - type: "problem", - schema: [{ - type: "boolean" - }] - }, - create(context) { - var config = context.options[0]; - - return { - "Program": function(node) { - if (config === true) { - context.report(node, "Invalid args"); - } - } - }; - } -}; diff --git a/packages/rule-tester/tests/eslint-base/fixtures/no-invalid-schema.js b/packages/rule-tester/tests/eslint-base/fixtures/no-invalid-schema.js deleted file mode 100644 index fd691f11a961..000000000000 --- a/packages/rule-tester/tests/eslint-base/fixtures/no-invalid-schema.js +++ /dev/null @@ -1,21 +0,0 @@ -// Forked from https://github.com/eslint/eslint/tree/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/fixtures/testers/rule-tester/no-invalid-schema.js - -"use strict"; - -module.exports = { - meta: { - type: "problem", - schema: [{ - "enum": [] - }] - }, - create(context) { - return { - "Program": function(node) { - if (config) { - context.report(node, "Expected nothing."); - } - } - }; - }, -}; diff --git a/packages/rule-tester/tests/eslint-base/fixtures/no-schema-violation.js b/packages/rule-tester/tests/eslint-base/fixtures/no-schema-violation.js deleted file mode 100644 index 1e12913c2287..000000000000 --- a/packages/rule-tester/tests/eslint-base/fixtures/no-schema-violation.js +++ /dev/null @@ -1,22 +0,0 @@ -// Forked from https://github.com/eslint/eslint/tree/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/fixtures/testers/rule-tester/no-schema-violation.js - -"use strict"; - -module.exports = { - meta: { - type: "problem", - schema: [{ - "enum": ["foo"] - }] - }, - create(context) { - const config = context.options[0]; - return { - "Program": function(node) { - if (config && config !== "foo") { - context.report(node, "Expected foo."); - } - } - }; - }, -}; diff --git a/packages/rule-tester/tests/eslint-base/fixtures/no-test-filename b/packages/rule-tester/tests/eslint-base/fixtures/no-test-filename deleted file mode 100644 index 795bd0ac7af3..000000000000 --- a/packages/rule-tester/tests/eslint-base/fixtures/no-test-filename +++ /dev/null @@ -1,19 +0,0 @@ -// Forked from https://github.com/eslint/eslint/tree/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/fixtures/testers/rule-tester/no-test-filename - -"use strict"; - -module.exports = { - meta: { - type: "problem", - schema: [] - }, - create(context) { - return { - "Program": function(node) { - if (context.getFilename() === '') { - context.report(node, "Filename test was not defined."); - } - } - }; - } -}; diff --git a/packages/rule-tester/tests/eslint-base/fixtures/no-test-global.js b/packages/rule-tester/tests/eslint-base/fixtures/no-test-global.js deleted file mode 100644 index 94834189376a..000000000000 --- a/packages/rule-tester/tests/eslint-base/fixtures/no-test-global.js +++ /dev/null @@ -1,26 +0,0 @@ -// Forked from https://github.com/eslint/eslint/tree/1665c029acb92bf8812267f1647ad1a7054cbcb4/tests/fixtures/testers/rule-tester/no-test-global.js - -"use strict"; - -module.exports = { - meta: { - type: "problem", - schema: [], - }, - create(context) { - return { - "Program": function(node) { - var globals = context.getScope().variables.map(function (variable) { - return variable.name; - }); - - if (globals.indexOf("test") === -1) { - context.report(node, "Global variable test was not defined."); - } - if (globals.indexOf("foo") !== -1) { - context.report(node, "Global variable foo should not be used."); - } - } - }; - }, -}; diff --git a/packages/rule-tester/tests/eslint-base/fixtures/no-test-settings.js b/packages/rule-tester/tests/eslint-base/fixtures/no-test-settings.js deleted file mode 100644 index 291b81b105f5..000000000000 --- a/packages/rule-tester/tests/eslint-base/fixtures/no-test-settings.js +++ /dev/null @@ -1,22 +0,0 @@ -// Forked from https://github.com/eslint/eslint/tree/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/fixtures/testers/rule-tester/no-test-settings.js - -"use strict"; - -module.exports = { - meta: { - type: "problem", - schema: [], - }, - create(context) { - return { - Program: function (node) { - if (!context.settings || !context.settings.test) { - context.report( - node, - "Global settings test was not defined." - ); - } - }, - }; - }, -}; diff --git a/packages/rule-tester/tests/eslint-base/fixtures/no-var.js b/packages/rule-tester/tests/eslint-base/fixtures/no-var.js deleted file mode 100644 index 58530de4e1d0..000000000000 --- a/packages/rule-tester/tests/eslint-base/fixtures/no-var.js +++ /dev/null @@ -1,26 +0,0 @@ -// Forked from https://github.com/eslint/eslint/tree/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/fixtures/testers/rule-tester/no-var.js - -"use strict"; - -module.exports = { - meta: { - fixable: "code", - schema: [] - }, - create(context) { - return { - "VariableDeclaration": function(node) { - if (node.kind === "var") { - context.report({ - node: node, - loc: sourceCode.getFirstToken(node).loc, - message: "Bad var.", - fix: function(fixer) { - return fixer.remove(context.sourceCode.getFirstToken(node)); - } - }) - } - } - }; - } -}; diff --git a/packages/rule-tester/tests/eslint-base/fixtures/suggestions.js b/packages/rule-tester/tests/eslint-base/fixtures/suggestions.js deleted file mode 100644 index 6310d0a2104a..000000000000 --- a/packages/rule-tester/tests/eslint-base/fixtures/suggestions.js +++ /dev/null @@ -1,260 +0,0 @@ -// Forked from https://github.com/eslint/eslint/tree/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/fixtures/testers/rule-tester/suggestions.js - -"use strict"; - -module.exports.basic = { - meta: { hasSuggestions: true }, - create(context) { - return { - Identifier(node) { - if (node.name === "foo") { - context.report({ - node, - message: "Avoid using identifiers named 'foo'.", - suggest: [{ - desc: "Rename identifier 'foo' to 'bar'", - fix: fixer => fixer.replaceText(node, 'bar') - }] - }); - } - } - }; - } -}; - -module.exports.withMessageIds = { - meta: { - messages: { - avoidFoo: "Avoid using identifiers named '{{ name }}'.", - unused: "An unused key", - renameFoo: "Rename identifier 'foo' to '{{ newName }}'" - }, - hasSuggestions: true - }, - create(context) { - return { - Identifier(node) { - if (node.name === "foo") { - context.report({ - node, - messageId: "avoidFoo", - data: { - name: "foo" - }, - suggest: [{ - messageId: "renameFoo", - data: { - newName: "bar" - }, - fix: fixer => fixer.replaceText(node, "bar") - }, { - messageId: "renameFoo", - data: { - newName: "baz" - }, - fix: fixer => fixer.replaceText(node, "baz") - }] - }); - } - } - }; - } -}; - -module.exports.withDuplicateDescriptions = { - meta: { - hasSuggestions: true - }, - create(context) { - return { - Identifier(node) { - if (node.name === "foo") { - context.report({ - node, - message: "Avoid using identifiers name 'foo'.", - suggest: [{ - desc: "Rename 'foo' to 'bar'", - fix: fixer => fixer.replaceText(node, "bar") - }, { - desc: "Rename 'foo' to 'bar'", - fix: fixer => fixer.replaceText(node, "baz") - }] - }); - } - } - }; - } -}; - -module.exports.withDuplicateMessageIdsNoData = { - meta: { - messages: { - avoidFoo: "Avoid using identifiers named '{{ name }}'.", - renameFoo: "Rename identifier" - }, - hasSuggestions: true - }, - create(context) { - return { - Identifier(node) { - if (node.name === "foo") { - context.report({ - node, - messageId: "avoidFoo", - data: { - name: "foo" - }, - suggest: [{ - messageId: "renameFoo", - fix: fixer => fixer.replaceText(node, "bar") - }, { - messageId: "renameFoo", - fix: fixer => fixer.replaceText(node, "baz") - }] - }); - } - } - }; - } -}; - -module.exports.withDuplicateMessageIdsWithData = { - meta: { - messages: { - avoidFoo: "Avoid using identifiers named foo.", - renameFoo: "Rename identifier 'foo' to '{{ newName }}'" - }, - hasSuggestions: true - }, - create(context) { - return { - Identifier(node) { - if (node.name === "foo") { - context.report({ - node, - messageId: "avoidFoo", - suggest: [{ - messageId: "renameFoo", - data: { - newName: "bar" - }, - fix: fixer => fixer.replaceText(node, "bar") - }, { - messageId: "renameFoo", - data: { - newName: "bar" - }, - fix: fixer => fixer.replaceText(node, "baz") - }] - }); - } - } - }; - } -}; - -module.exports.withoutHasSuggestionsProperty = { - create(context) { - return { - Identifier(node) { - context.report({ - node, - message: "some message", - suggest: [{ desc: "some suggestion", fix: fixer => fixer.replaceText(node, 'bar') }] - }); - } - }; - } -}; - -module.exports.withFixerWithoutChanges = { - meta: { hasSuggestions: true }, - create(context) { - return { - Identifier(node) { - if (node.name === "foo") { - context.report({ - node, - message: "Avoid using identifiers named 'foo'.", - suggest: [{ - desc: "Rename identifier 'foo' to 'bar'", - fix: fixer => fixer.replaceText(node, 'foo') - }] - }); - } - } - }; - } -}; - -module.exports.withFailingFixer = { - create(context) { - return { - Identifier(node) { - context.report({ - node, - message: "some message", - suggest: [{ desc: "some suggestion", fix: fixer => null }] - }); - } - }; - } -}; - -module.exports.withMissingPlaceholderData = { - meta: { - messages: { - avoidFoo: "Avoid using identifiers named '{{ name }}'.", - renameFoo: "Rename identifier 'foo' to '{{ newName }}'" - }, - hasSuggestions: true - }, - create(context) { - return { - Identifier(node) { - if (node.name === "foo") { - context.report({ - node, - messageId: "avoidFoo", - data: { - name: "foo" - }, - suggest: [{ - messageId: "renameFoo", - fix: fixer => fixer.replaceText(node, "bar") - }] - }); - } - } - }; - } -}; - -module.exports.withMultipleMissingPlaceholderDataProperties = { - meta: { - messages: { - avoidFoo: "Avoid using identifiers named '{{ name }}'.", - rename: "Rename identifier '{{ currentName }}' to '{{ newName }}'" - }, - hasSuggestions: true - }, - create(context) { - return { - Identifier(node) { - if (node.name === "foo") { - context.report({ - node, - messageId: "avoidFoo", - data: { - name: "foo" - }, - suggest: [{ - messageId: "rename", - fix: fixer => fixer.replaceText(node, "bar") - }] - }); - } - } - }; - } -}; diff --git a/packages/rule-tester/tests/filename.test.ts b/packages/rule-tester/tests/filename.test.ts index 7068aa7fd3b5..8f3442cf670a 100644 --- a/packages/rule-tester/tests/filename.test.ts +++ b/packages/rule-tester/tests/filename.test.ts @@ -2,6 +2,7 @@ import type { TSESLint } from '@typescript-eslint/utils'; import { AST_NODE_TYPES, ESLintUtils } from '@typescript-eslint/utils'; +import path from 'node:path'; import { RuleTester } from '../src/RuleTester'; @@ -56,13 +57,51 @@ describe('rule tester filename', () => { errors: [{ messageId: 'foo' }], filename: '../foo.js', }, + { + name: 'non-normalized relative path starting with ./', + code: '_', + errors: [{ messageId: 'foo' }], + filename: './../../escaped/cwd/file.ts', + }, + { + name: 'non-normalized relative path ./../', + code: '_', + errors: [{ messageId: 'foo' }], + filename: './../foo.js', + }, + { + name: 'non-normalized relative path with multiple ./', + code: '_', + errors: [{ messageId: 'foo' }], + filename: '././../foo.js', + }, + { + name: 'non-normalized path a/../../', + code: '_', + errors: [{ messageId: 'foo' }], + filename: 'a/../../file.ts', + }, + { + name: 'non-normalized path a/b/../c', + code: '_', + errors: [{ messageId: 'foo' }], + filename: 'a/b/../c', + }, + { + name: 'non-normalized path with multiple slashes', + code: '_', + errors: [{ messageId: 'foo' }], + filename: 'a/////////////../../../b', + }, ], valid: [], }); new RuleTester({ languageOptions: { - parserOptions: { tsconfigRootDir: '/some/path/that/totally/exists/' }, + parserOptions: { + tsconfigRootDir: path.resolve('/some/path/that/totally/exists/'), + }, }, }).run('with tsconfigRootDir', rule, { invalid: [ @@ -78,6 +117,42 @@ describe('rule tester filename', () => { errors: [{ messageId: 'foo' }], filename: '../foo.js', }, + { + name: 'non-normalized relative path starting with ./', + code: '_', + errors: [{ messageId: 'foo' }], + filename: './../../escaped/cwd/file.ts', + }, + { + name: 'non-normalized relative path ./../', + code: '_', + errors: [{ messageId: 'foo' }], + filename: './../foo.js', + }, + { + name: 'non-normalized relative path with multiple ./', + code: '_', + errors: [{ messageId: 'foo' }], + filename: '././../foo.js', + }, + { + name: 'non-normalized path a/../../', + code: '_', + errors: [{ messageId: 'foo' }], + filename: 'a/../../file.ts', + }, + { + name: 'non-normalized path a/b/../c', + code: '_', + errors: [{ messageId: 'foo' }], + filename: 'a/b/../c', + }, + { + name: 'non-normalized path with multiple slashes', + code: '_', + errors: [{ messageId: 'foo' }], + filename: 'a/////////////../../../b', + }, ], valid: [], }); diff --git a/packages/rule-tester/vitest.config.mts b/packages/rule-tester/vitest.config.mts index 2c5138157942..4c66e879f846 100644 --- a/packages/rule-tester/vitest.config.mts +++ b/packages/rule-tester/vitest.config.mts @@ -1,5 +1,5 @@ import * as path from 'node:path'; -import { defaultExclude, defineProject, mergeConfig } from 'vitest/config'; +import { defineProject, mergeConfig } from 'vitest/config'; import { vitestBaseConfig } from '../../vitest.config.base.mjs'; import packageJson from './package.json' with { type: 'json' }; @@ -61,7 +61,6 @@ const vitestConfig = mergeConfig( test: { dir: path.join(import.meta.dirname, 'tests'), - exclude: [...defaultExclude, 'eslint-base/eslint-base.test.js'], name: packageJson.name.replace('@typescript-eslint/', ''), root: import.meta.dirname, }, diff --git a/packages/scope-manager/CHANGELOG.md b/packages/scope-manager/CHANGELOG.md index 9d183fed0d04..de5fd4f62be6 100644 --- a/packages/scope-manager/CHANGELOG.md +++ b/packages/scope-manager/CHANGELOG.md @@ -1,3 +1,165 @@ +## 8.46.4 (2025-11-10) + +This was a version bump only for scope-manager to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.3 (2025-11-03) + +This was a version bump only for scope-manager to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.2 (2025-10-20) + +This was a version bump only for scope-manager to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.1 (2025-10-13) + +This was a version bump only for scope-manager to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.0 (2025-10-06) + +This was a version bump only for scope-manager to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.45.0 (2025-09-29) + +This was a version bump only for scope-manager to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.44.1 (2025-09-22) + +This was a version bump only for scope-manager to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.44.0 (2025-09-15) + +This was a version bump only for scope-manager to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.43.0 (2025-09-08) + +### 🩹 Fixes + +- **scope-manager:** exclude Program from DefinitionBase node types ([#11469](https://github.com/typescript-eslint/typescript-eslint/pull/11469)) + +### ❤️ Thank You + +- Dima @dbarabashh + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.42.0 (2025-09-02) + +This was a version bump only for scope-manager to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.41.0 (2025-08-25) + +This was a version bump only for scope-manager to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.40.0 (2025-08-18) + +### 🚀 Features + +- **typescript-estree:** forbid invalid keys in `EnumMember` ([#11232](https://github.com/typescript-eslint/typescript-eslint/pull/11232)) + +### ❤️ Thank You + +- fisker Cheung @fisker + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.39.1 (2025-08-11) + +This was a version bump only for scope-manager to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.39.0 (2025-08-04) + +### 🚀 Features + +- update to TypeScript 5.9.2 ([#11445](https://github.com/typescript-eslint/typescript-eslint/pull/11445)) + +### ❤️ Thank You + +- Brad Zacher @bradzacher + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.38.0 (2025-07-21) + +This was a version bump only for scope-manager to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.37.0 (2025-07-14) + +This was a version bump only for scope-manager to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.36.0 (2025-07-07) + +This was a version bump only for scope-manager to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.35.1 (2025-06-30) + +This was a version bump only for scope-manager to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.35.0 (2025-06-23) + +This was a version bump only for scope-manager to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.34.1 (2025-06-16) + +This was a version bump only for scope-manager to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.34.0 (2025-06-09) + +### 🩹 Fixes + +- **visitor-keys:** fix visitor keys order ([#11279](https://github.com/typescript-eslint/typescript-eslint/pull/11279)) + +### ❤️ Thank You + +- overlookmotel + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.33.1 (2025-06-02) + +This was a version bump only for scope-manager to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.33.0 (2025-05-26) + +This was a version bump only for scope-manager to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + ## 8.32.1 (2025-05-12) This was a version bump only for scope-manager to align it with other projects, there were no code changes. diff --git a/packages/scope-manager/package.json b/packages/scope-manager/package.json index 4f586adc78a2..5214090600a6 100644 --- a/packages/scope-manager/package.json +++ b/packages/scope-manager/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/scope-manager", - "version": "8.32.1", + "version": "8.46.4", "description": "TypeScript scope analyser for ESLint", "files": [ "dist", @@ -37,25 +37,25 @@ "estree" ], "scripts": { - "build": "tsc -b tsconfig.build.json", + "build": "yarn run -BT nx build", "clean": "rimraf dist/ coverage/", "clean-fixtures": "rimraf -g \"./src/**/fixtures/**/snapshots\"", - "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", - "generate-lib": "npx nx generate-lib repo", - "lint": "npx nx lint", - "test": "vitest --run --config=$INIT_CWD/vitest.config.mts", - "check-types": "npx nx typecheck" + "format": "yarn run -T format", + "generate-lib": "yarn run -BT nx generate-lib repo", + "lint": "yarn run -BT nx lint", + "test": "yarn run -BT nx test", + "typecheck": "yarn run -BT nx typecheck" }, "dependencies": { - "@typescript-eslint/types": "8.32.1", - "@typescript-eslint/visitor-keys": "8.32.1" + "@typescript-eslint/types": "8.46.4", + "@typescript-eslint/visitor-keys": "8.46.4" }, "devDependencies": { - "@typescript-eslint/typescript-estree": "8.32.1", + "@typescript-eslint/typescript-estree": "8.46.4", "@vitest/coverage-v8": "^3.1.3", "@vitest/pretty-format": "^3.1.3", + "eslint": "*", "glob": "*", - "prettier": "^3.2.5", "rimraf": "*", "typescript": "*", "vitest": "^3.1.3" @@ -63,5 +63,17 @@ "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" + }, + "nx": { + "name": "scope-manager", + "includedScripts": [ + "clean", + "clean-fixtures" + ], + "targets": { + "lint": { + "command": "eslint" + } + } } } diff --git a/packages/scope-manager/project.json b/packages/scope-manager/project.json deleted file mode 100644 index 059f34126073..000000000000 --- a/packages/scope-manager/project.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "scope-manager", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "root": "packages/scope-manager", - "sourceRoot": "packages/scope-manager/src", - "projectType": "library", - "targets": { - "lint": { - "executor": "@nx/eslint:lint", - "outputs": ["{options.outputFile}"] - }, - "test": { - "executor": "@nx/vite:test" - } - } -} diff --git a/packages/scope-manager/src/definition/DefinitionBase.ts b/packages/scope-manager/src/definition/DefinitionBase.ts index de4260ea888d..87b9cfb0eea4 100644 --- a/packages/scope-manager/src/definition/DefinitionBase.ts +++ b/packages/scope-manager/src/definition/DefinitionBase.ts @@ -1,4 +1,4 @@ -import type { TSESTree } from '@typescript-eslint/types'; +import type { NodeWithParent, TSESTree } from '@typescript-eslint/types'; import type { DefinitionType } from './DefinitionType'; @@ -8,7 +8,7 @@ const generator = createIdGenerator(); export abstract class DefinitionBase< Type extends DefinitionType, - Node extends TSESTree.Node, + Node extends NodeWithParent, Parent extends TSESTree.Node | null, Name extends TSESTree.Node, > { diff --git a/packages/scope-manager/src/definition/ImplicitGlobalVariableDefinition.ts b/packages/scope-manager/src/definition/ImplicitGlobalVariableDefinition.ts index fa36527502c4..23bc4dedfd30 100644 --- a/packages/scope-manager/src/definition/ImplicitGlobalVariableDefinition.ts +++ b/packages/scope-manager/src/definition/ImplicitGlobalVariableDefinition.ts @@ -1,11 +1,11 @@ -import type { TSESTree } from '@typescript-eslint/types'; +import type { NodeWithParent, TSESTree } from '@typescript-eslint/types'; import { DefinitionBase } from './DefinitionBase'; import { DefinitionType } from './DefinitionType'; export class ImplicitGlobalVariableDefinition extends DefinitionBase< DefinitionType.ImplicitGlobalVariable, - TSESTree.Node, + NodeWithParent, null, TSESTree.BindingName > { diff --git a/packages/scope-manager/src/lib/dom.iterable.ts b/packages/scope-manager/src/lib/dom.iterable.ts index 2ccd538bc593..e5109bdf2d4b 100644 --- a/packages/scope-manager/src/lib/dom.iterable.ts +++ b/packages/scope-manager/src/lib/dom.iterable.ts @@ -22,6 +22,7 @@ export const dom_iterable: LibDefinition = { ['Cache', TYPE], ['CanvasPath', TYPE], ['CanvasPathDrawingStyles', TYPE], + ['CookieStoreManager', TYPE], ['CustomStateSet', TYPE], ['DOMRectList', TYPE], ['DOMStringList', TYPE], diff --git a/packages/scope-manager/src/lib/dom.ts b/packages/scope-manager/src/lib/dom.ts index 469c43a48f7c..c6d054c1b6bc 100644 --- a/packages/scope-manager/src/lib/dom.ts +++ b/packages/scope-manager/src/lib/dom.ts @@ -42,9 +42,14 @@ export const dom: LibDefinition = { ['AuthenticationExtensionsClientInputs', TYPE], ['AuthenticationExtensionsClientInputsJSON', TYPE], ['AuthenticationExtensionsClientOutputs', TYPE], + ['AuthenticationExtensionsLargeBlobInputs', TYPE], + ['AuthenticationExtensionsLargeBlobInputsJSON', TYPE], + ['AuthenticationExtensionsLargeBlobOutputs', TYPE], ['AuthenticationExtensionsPRFInputs', TYPE], + ['AuthenticationExtensionsPRFInputsJSON', TYPE], ['AuthenticationExtensionsPRFOutputs', TYPE], ['AuthenticationExtensionsPRFValues', TYPE], + ['AuthenticationExtensionsPRFValuesJSON', TYPE], ['AuthenticatorSelectionCriteria', TYPE], ['AvcEncoderConfig', TYPE], ['BiquadFilterOptions', TYPE], @@ -73,6 +78,11 @@ export const dom: LibDefinition = { ['ConstrainULongRange', TYPE], ['ContentVisibilityAutoStateChangeEventInit', TYPE], ['ConvolverOptions', TYPE], + ['CookieChangeEventInit', TYPE], + ['CookieInit', TYPE], + ['CookieListItem', TYPE], + ['CookieStoreDeleteOptions', TYPE], + ['CookieStoreGetOptions', TYPE], ['CredentialCreationOptions', TYPE], ['CredentialPropertiesOutput', TYPE], ['CredentialRequestOptions', TYPE], @@ -126,6 +136,7 @@ export const dom: LibDefinition = { ['GamepadEffectParameters', TYPE], ['GamepadEventInit', TYPE], ['GetAnimationsOptions', TYPE], + ['GetComposedRangesOptions', TYPE], ['GetHTMLOptions', TYPE], ['GetNotificationOptions', TYPE], ['GetRootNodeOptions', TYPE], @@ -148,10 +159,12 @@ export const dom: LibDefinition = { ['ImageDecodeResult', TYPE], ['ImageDecoderInit', TYPE], ['ImageEncodeOptions', TYPE], + ['ImportNodeOptions', TYPE], ['InputEventInit', TYPE], ['IntersectionObserverInit', TYPE], ['JsonWebKey', TYPE], ['KeyAlgorithm', TYPE], + ['KeySystemTrackConfiguration', TYPE], ['KeyboardEventInit', TYPE], ['Keyframe', TYPE], ['KeyframeAnimationOptions', TYPE], @@ -165,6 +178,7 @@ export const dom: LibDefinition = { ['MediaCapabilitiesDecodingInfo', TYPE], ['MediaCapabilitiesEncodingInfo', TYPE], ['MediaCapabilitiesInfo', TYPE], + ['MediaCapabilitiesKeySystemConfiguration', TYPE], ['MediaConfiguration', TYPE], ['MediaDecodingConfiguration', TYPE], ['MediaElementAudioSourceOptions', TYPE], @@ -180,6 +194,7 @@ export const dom: LibDefinition = { ['MediaQueryListEventInit', TYPE], ['MediaRecorderOptions', TYPE], ['MediaSessionActionDetails', TYPE], + ['MediaSettingsRange', TYPE], ['MediaStreamAudioSourceOptions', TYPE], ['MediaStreamConstraints', TYPE], ['MediaStreamTrackEventInit', TYPE], @@ -223,6 +238,8 @@ export const dom: LibDefinition = { ['PeriodicWaveConstraints', TYPE], ['PeriodicWaveOptions', TYPE], ['PermissionDescriptor', TYPE], + ['PhotoCapabilities', TYPE], + ['PhotoSettings', TYPE], ['PictureInPictureEventInit', TYPE], ['PlaneLayout', TYPE], ['PointerEventInit', TYPE], @@ -256,6 +273,7 @@ export const dom: LibDefinition = { ['RTCDataChannelInit', TYPE], ['RTCDtlsFingerprint', TYPE], ['RTCEncodedAudioFrameMetadata', TYPE], + ['RTCEncodedFrameMetadata', TYPE], ['RTCEncodedVideoFrameMetadata', TYPE], ['RTCErrorEventInit', TYPE], ['RTCErrorInit', TYPE], @@ -263,6 +281,7 @@ export const dom: LibDefinition = { ['RTCIceCandidatePairStats', TYPE], ['RTCIceServer', TYPE], ['RTCInboundRtpStreamStats', TYPE], + ['RTCLocalIceCandidateInit', TYPE], ['RTCLocalSessionDescriptionInit', TYPE], ['RTCOfferAnswerOptions', TYPE], ['RTCOfferOptions', TYPE], @@ -318,6 +337,7 @@ export const dom: LibDefinition = { ['ShareData', TYPE], ['SpeechSynthesisErrorEventInit', TYPE], ['SpeechSynthesisEventInit', TYPE], + ['StartViewTransitionOptions', TYPE], ['StaticRangeInit', TYPE], ['StereoPannerOptions', TYPE], ['StorageEstimate', TYPE], @@ -362,6 +382,7 @@ export const dom: LibDefinition = { ['WebTransportErrorOptions', TYPE], ['WebTransportHash', TYPE], ['WebTransportOptions', TYPE], + ['WebTransportSendOptions', TYPE], ['WebTransportSendStreamOptions', TYPE], ['WheelEventInit', TYPE], ['WindowPostMessageOptions', TYPE], @@ -422,6 +443,7 @@ export const dom: LibDefinition = { ['BroadcastChannel', TYPE_VALUE], ['ByteLengthQueuingStrategy', TYPE_VALUE], ['CDATASection', TYPE_VALUE], + ['CSPViolationReportBody', TYPE_VALUE], ['CSSAnimation', TYPE_VALUE], ['CSSConditionRule', TYPE_VALUE], ['CSSContainerRule', TYPE_VALUE], @@ -515,6 +537,10 @@ export const dom: LibDefinition = { ['ConstantSourceNode', TYPE_VALUE], ['ContentVisibilityAutoStateChangeEvent', TYPE_VALUE], ['ConvolverNode', TYPE_VALUE], + ['CookieChangeEvent', TYPE_VALUE], + ['CookieStoreEventMap', TYPE], + ['CookieStore', TYPE_VALUE], + ['CookieStoreManager', TYPE_VALUE], ['CountQueuingStrategy', TYPE_VALUE], ['Credential', TYPE_VALUE], ['CredentialsContainer', TYPE_VALUE], @@ -731,6 +757,7 @@ export const dom: LibDefinition = { ['IdleDeadline', TYPE_VALUE], ['ImageBitmap', TYPE_VALUE], ['ImageBitmapRenderingContext', TYPE_VALUE], + ['ImageCapture', TYPE_VALUE], ['ImageData', TYPE_VALUE], ['ImageDecoder', TYPE_VALUE], ['ImageTrack', TYPE_VALUE], @@ -817,6 +844,7 @@ export const dom: LibDefinition = { ['NavigatorID', TYPE], ['NavigatorLanguage', TYPE], ['NavigatorLocks', TYPE], + ['NavigatorLogin', TYPE_VALUE], ['NavigatorOnLine', TYPE], ['NavigatorPlugins', TYPE], ['NavigatorStorage', TYPE], @@ -1201,9 +1229,9 @@ export const dom: LibDefinition = { ['XPathExpression', TYPE_VALUE], ['XPathResult', TYPE_VALUE], ['XSLTProcessor', TYPE_VALUE], - ['Console', TYPE], ['CSS', TYPE_VALUE], ['WebAssembly', TYPE_VALUE], + ['Console', TYPE], ['AudioDataOutputCallback', TYPE], ['BlobCallback', TYPE], ['CustomElementConstructor', TYPE], @@ -1276,6 +1304,7 @@ export const dom: LibDefinition = { ['ConstrainDOMString', TYPE], ['ConstrainDouble', TYPE], ['ConstrainULong', TYPE], + ['CookieList', TYPE], ['DOMHighResTimeStamp', TYPE], ['EpochTimeStamp', TYPE], ['EventListenerOrEventListenerObject', TYPE], @@ -1301,6 +1330,7 @@ export const dom: LibDefinition = { ['IDBValidKey', TYPE], ['ImageBitmapSource', TYPE], ['ImageBufferSource', TYPE], + ['ImageDataArray', TYPE], ['Int32List', TYPE], ['LineAndPositionSetting', TYPE], ['MediaProvider', TYPE], @@ -1374,6 +1404,7 @@ export const dom: LibDefinition = { ['CompositeOperation', TYPE], ['CompositeOperationOrAuto', TYPE], ['CompressionFormat', TYPE], + ['CookieSameSite', TYPE], ['CredentialMediationRequirement', TYPE], ['DOMParserSupportedType', TYPE], ['DirectionSetting', TYPE], @@ -1386,6 +1417,7 @@ export const dom: LibDefinition = { ['EndOfStreamError', TYPE], ['EndingType', TYPE], ['FileSystemHandleKind', TYPE], + ['FillLightMode', TYPE], ['FillMode', TYPE], ['FontDisplay', TYPE], ['FontFaceLoadStatus', TYPE], @@ -1412,6 +1444,7 @@ export const dom: LibDefinition = { ['LatencyMode', TYPE], ['LineAlignSetting', TYPE], ['LockMode', TYPE], + ['LoginStatus', TYPE], ['MIDIPortConnectionState', TYPE], ['MIDIPortDeviceState', TYPE], ['MIDIPortType', TYPE], @@ -1478,6 +1511,7 @@ export const dom: LibDefinition = { ['ReadableStreamType', TYPE], ['ReadyState', TYPE], ['RecordingState', TYPE], + ['RedEyeReduction', TYPE], ['ReferrerPolicy', TYPE], ['RemotePlaybackState', TYPE], ['RequestCache', TYPE], diff --git a/packages/scope-manager/src/lib/esnext.error.ts b/packages/scope-manager/src/lib/esnext.error.ts new file mode 100644 index 000000000000..fdf38f4d7120 --- /dev/null +++ b/packages/scope-manager/src/lib/esnext.error.ts @@ -0,0 +1,13 @@ +// THIS CODE WAS AUTOMATICALLY GENERATED +// DO NOT EDIT THIS CODE BY HAND +// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: +// npx nx generate-lib repo + +import type { LibDefinition } from '../variable'; + +import { TYPE } from './base-config'; + +export const esnext_error: LibDefinition = { + libs: [], + variables: [['ErrorConstructor', TYPE]], +}; diff --git a/packages/scope-manager/src/lib/esnext.sharedmemory.ts b/packages/scope-manager/src/lib/esnext.sharedmemory.ts new file mode 100644 index 000000000000..05c530843e70 --- /dev/null +++ b/packages/scope-manager/src/lib/esnext.sharedmemory.ts @@ -0,0 +1,13 @@ +// THIS CODE WAS AUTOMATICALLY GENERATED +// DO NOT EDIT THIS CODE BY HAND +// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: +// npx nx generate-lib repo + +import type { LibDefinition } from '../variable'; + +import { TYPE } from './base-config'; + +export const esnext_sharedmemory: LibDefinition = { + libs: [], + variables: [['Atomics', TYPE]], +}; diff --git a/packages/scope-manager/src/lib/esnext.ts b/packages/scope-manager/src/lib/esnext.ts index 8288f8c9308c..4caeb5d5de7f 100644 --- a/packages/scope-manager/src/lib/esnext.ts +++ b/packages/scope-manager/src/lib/esnext.ts @@ -10,10 +10,12 @@ import { esnext_array } from './esnext.array'; import { esnext_collection } from './esnext.collection'; import { esnext_decorators } from './esnext.decorators'; import { esnext_disposable } from './esnext.disposable'; +import { esnext_error } from './esnext.error'; import { esnext_float16 } from './esnext.float16'; import { esnext_intl } from './esnext.intl'; import { esnext_iterator } from './esnext.iterator'; import { esnext_promise } from './esnext.promise'; +import { esnext_sharedmemory } from './esnext.sharedmemory'; export const esnext: LibDefinition = { libs: [ @@ -26,6 +28,8 @@ export const esnext: LibDefinition = { esnext_iterator, esnext_promise, esnext_float16, + esnext_error, + esnext_sharedmemory, ], variables: [], }; diff --git a/packages/scope-manager/src/lib/index.ts b/packages/scope-manager/src/lib/index.ts index 2b51fe7b2335..b3baf6d6fede 100644 --- a/packages/scope-manager/src/lib/index.ts +++ b/packages/scope-manager/src/lib/index.ts @@ -95,6 +95,7 @@ import { esnext_bigint } from './esnext.bigint'; import { esnext_collection } from './esnext.collection'; import { esnext_decorators } from './esnext.decorators'; import { esnext_disposable } from './esnext.disposable'; +import { esnext_error } from './esnext.error'; import { esnext_float16 } from './esnext.float16'; import { esnext_full } from './esnext.full'; import { esnext_intl } from './esnext.intl'; @@ -102,6 +103,7 @@ import { esnext_iterator } from './esnext.iterator'; import { esnext_object } from './esnext.object'; import { esnext_promise } from './esnext.promise'; import { esnext_regexp } from './esnext.regexp'; +import { esnext_sharedmemory } from './esnext.sharedmemory'; import { esnext_string } from './esnext.string'; import { esnext_symbol } from './esnext.symbol'; import { esnext_weakref } from './esnext.weakref'; @@ -209,6 +211,8 @@ export const lib: ReadonlyMap = new Map< ['esnext.regexp', esnext_regexp], ['esnext.iterator', esnext_iterator], ['esnext.float16', esnext_float16], + ['esnext.error', esnext_error], + ['esnext.sharedmemory', esnext_sharedmemory], ['decorators', decorators], ['decorators.legacy', decorators_legacy], ['es2016.full', es2016_full], diff --git a/packages/scope-manager/src/lib/webworker.iterable.ts b/packages/scope-manager/src/lib/webworker.iterable.ts index 1e02a18e42bf..e42417f0d48e 100644 --- a/packages/scope-manager/src/lib/webworker.iterable.ts +++ b/packages/scope-manager/src/lib/webworker.iterable.ts @@ -16,6 +16,7 @@ export const webworker_iterable: LibDefinition = { ['Cache', TYPE], ['CanvasPath', TYPE], ['CanvasPathDrawingStyles', TYPE], + ['CookieStoreManager', TYPE], ['DOMStringList', TYPE], ['FileList', TYPE], ['FontFaceSet', TYPE], diff --git a/packages/scope-manager/src/lib/webworker.ts b/packages/scope-manager/src/lib/webworker.ts index 17df7198988e..d0c8891975de 100644 --- a/packages/scope-manager/src/lib/webworker.ts +++ b/packages/scope-manager/src/lib/webworker.ts @@ -34,6 +34,10 @@ export const webworker: LibDefinition = { ['CacheQueryOptions', TYPE], ['ClientQueryOptions', TYPE], ['CloseEventInit', TYPE], + ['CookieInit', TYPE], + ['CookieListItem', TYPE], + ['CookieStoreDeleteOptions', TYPE], + ['CookieStoreGetOptions', TYPE], ['CryptoKeyPair', TYPE], ['CustomEventInit', TYPE], ['DOMMatrix2DInit', TYPE], @@ -53,6 +57,7 @@ export const webworker: LibDefinition = { ['EventInit', TYPE], ['EventListenerOptions', TYPE], ['EventSourceInit', TYPE], + ['ExtendableCookieChangeEventInit', TYPE], ['ExtendableEventInit', TYPE], ['ExtendableMessageEventInit', TYPE], ['FetchEventInit', TYPE], @@ -82,12 +87,14 @@ export const webworker: LibDefinition = { ['ImageEncodeOptions', TYPE], ['JsonWebKey', TYPE], ['KeyAlgorithm', TYPE], + ['KeySystemTrackConfiguration', TYPE], ['LockInfo', TYPE], ['LockManagerSnapshot', TYPE], ['LockOptions', TYPE], ['MediaCapabilitiesDecodingInfo', TYPE], ['MediaCapabilitiesEncodingInfo', TYPE], ['MediaCapabilitiesInfo', TYPE], + ['MediaCapabilitiesKeySystemConfiguration', TYPE], ['MediaConfiguration', TYPE], ['MediaDecodingConfiguration', TYPE], ['MediaEncodingConfiguration', TYPE], @@ -107,11 +114,13 @@ export const webworker: LibDefinition = { ['ProgressEventInit', TYPE], ['PromiseRejectionEventInit', TYPE], ['PushEventInit', TYPE], + ['PushSubscriptionChangeEventInit', TYPE], ['PushSubscriptionJSON', TYPE], ['PushSubscriptionOptionsInit', TYPE], ['QueuingStrategy', TYPE], ['QueuingStrategyInit', TYPE], ['RTCEncodedAudioFrameMetadata', TYPE], + ['RTCEncodedFrameMetadata', TYPE], ['RTCEncodedVideoFrameMetadata', TYPE], ['ReadableStreamGetReaderOptions', TYPE], ['ReadableStreamIteratorOptions', TYPE], @@ -159,6 +168,7 @@ export const webworker: LibDefinition = { ['WebTransportErrorOptions', TYPE], ['WebTransportHash', TYPE], ['WebTransportOptions', TYPE], + ['WebTransportSendOptions', TYPE], ['WebTransportSendStreamOptions', TYPE], ['WorkerOptions', TYPE], ['WriteParams', TYPE], @@ -228,6 +238,8 @@ export const webworker: LibDefinition = { ['Clients', TYPE_VALUE], ['CloseEvent', TYPE_VALUE], ['CompressionStream', TYPE_VALUE], + ['CookieStore', TYPE_VALUE], + ['CookieStoreManager', TYPE_VALUE], ['CountQueuingStrategy', TYPE_VALUE], ['Crypto', TYPE_VALUE], ['CryptoKey', TYPE_VALUE], @@ -264,6 +276,7 @@ export const webworker: LibDefinition = { ['EventSourceEventMap', TYPE], ['EventSource', TYPE_VALUE], ['EventTarget', TYPE_VALUE], + ['ExtendableCookieChangeEvent', TYPE_VALUE], ['ExtendableEvent', TYPE_VALUE], ['ExtendableMessageEvent', TYPE_VALUE], ['FetchEvent', TYPE_VALUE], @@ -363,6 +376,7 @@ export const webworker: LibDefinition = { ['PushManager', TYPE_VALUE], ['PushMessageData', TYPE_VALUE], ['PushSubscription', TYPE_VALUE], + ['PushSubscriptionChangeEvent', TYPE_VALUE], ['PushSubscriptionOptions', TYPE_VALUE], ['RTCDataChannelEventMap', TYPE], ['RTCDataChannel', TYPE_VALUE], @@ -470,8 +484,8 @@ export const webworker: LibDefinition = { ['XMLHttpRequestEventTargetEventMap', TYPE], ['XMLHttpRequestEventTarget', TYPE_VALUE], ['XMLHttpRequestUpload', TYPE_VALUE], - ['Console', TYPE], ['WebAssembly', TYPE_VALUE], + ['Console', TYPE], ['AudioDataOutputCallback', TYPE], ['EncodedAudioChunkOutputCallback', TYPE], ['EncodedVideoChunkOutputCallback', TYPE], @@ -505,6 +519,7 @@ export const webworker: LibDefinition = { ['CSSPerspectiveValue', TYPE], ['CSSUnparsedSegment', TYPE], ['CanvasImageSource', TYPE], + ['CookieList', TYPE], ['DOMHighResTimeStamp', TYPE], ['EpochTimeStamp', TYPE], ['EventListenerOrEventListenerObject', TYPE], @@ -528,6 +543,7 @@ export const webworker: LibDefinition = { ['IDBValidKey', TYPE], ['ImageBitmapSource', TYPE], ['ImageBufferSource', TYPE], + ['ImageDataArray', TYPE], ['Int32List', TYPE], ['MessageEventSource', TYPE], ['NamedCurve', TYPE], @@ -567,6 +583,7 @@ export const webworker: LibDefinition = { ['ColorGamut', TYPE], ['ColorSpaceConversion', TYPE], ['CompressionFormat', TYPE], + ['CookieSameSite', TYPE], ['DocumentVisibilityState', TYPE], ['EncodedAudioChunkType', TYPE], ['EncodedVideoChunkType', TYPE], @@ -592,6 +609,7 @@ export const webworker: LibDefinition = { ['LockMode', TYPE], ['MediaDecodingType', TYPE], ['MediaEncodingType', TYPE], + ['MediaKeysRequirement', TYPE], ['NotificationDirection', TYPE], ['NotificationPermission', TYPE], ['OffscreenRenderingContextId', TYPE], diff --git a/packages/scope-manager/src/referencer/ClassVisitor.ts b/packages/scope-manager/src/referencer/ClassVisitor.ts index 0a8d0b9cf82c..83f44ccc5f33 100644 --- a/packages/scope-manager/src/referencer/ClassVisitor.ts +++ b/packages/scope-manager/src/referencer/ClassVisitor.ts @@ -9,23 +9,18 @@ import { TypeVisitor } from './TypeVisitor'; import { Visitor } from './Visitor'; export class ClassVisitor extends Visitor { - readonly #classNode: TSESTree.ClassDeclaration | TSESTree.ClassExpression; readonly #referencer: Referencer; - constructor( - referencer: Referencer, - node: TSESTree.ClassDeclaration | TSESTree.ClassExpression, - ) { + constructor(referencer: Referencer) { super(referencer); this.#referencer = referencer; - this.#classNode = node; } static visit( referencer: Referencer, node: TSESTree.ClassDeclaration | TSESTree.ClassExpression, ): void { - const classVisitor = new ClassVisitor(referencer, node); + const classVisitor = new ClassVisitor(referencer); classVisitor.visitClass(node); } @@ -97,7 +92,7 @@ export class ClassVisitor extends Visitor { } if (node.value.type === AST_NODE_TYPES.FunctionExpression) { - this.visitMethodFunction(node.value, node); + this.visitMethodFunction(node.value); } else { this.#referencer.visit(node.value); } @@ -105,10 +100,7 @@ export class ClassVisitor extends Visitor { node.decorators.forEach(d => this.#referencer.visit(d)); } - protected visitMethodFunction( - node: TSESTree.FunctionExpression, - methodNode: TSESTree.MethodDefinition, - ): void { + protected visitMethodFunction(node: TSESTree.FunctionExpression): void { if (node.id) { // FunctionExpression with name creates its special scope; // FunctionExpressionNameScope. @@ -122,71 +114,6 @@ export class ClassVisitor extends Visitor { // Consider this function is in the MethodDefinition. this.#referencer.scopeManager.nestFunctionScope(node, true); - /** - * class A { - * @meta // <--- check this - * foo(a: Type) {} - * - * @meta // <--- check this - * foo(): Type {} - * } - */ - let withMethodDecorators = !!methodNode.decorators.length; - /** - * class A { - * foo( - * @meta // <--- check this - * a: Type - * ) {} - * - * set foo( - * @meta // <--- EXCEPT this. TS do nothing for this - * a: Type - * ) {} - * } - */ - withMethodDecorators ||= - methodNode.kind !== 'set' && - node.params.some(param => param.decorators.length); - if (!withMethodDecorators && methodNode.kind === 'set') { - const keyName = getLiteralMethodKeyName(methodNode); - - /** - * class A { - * @meta // <--- check this - * get a() {} - * set ['a'](v: Type) {} - * } - */ - if ( - keyName != null && - this.#classNode.body.body.find( - (node): node is TSESTree.MethodDefinition => - node !== methodNode && - node.type === AST_NODE_TYPES.MethodDefinition && - // Node must both be static or not - node.static === methodNode.static && - getLiteralMethodKeyName(node) === keyName, - )?.decorators.length - ) { - withMethodDecorators = true; - } - } - - /** - * @meta // <--- check this - * class A { - * constructor(a: Type) {} - * } - */ - if ( - !withMethodDecorators && - methodNode.kind === 'constructor' && - this.#classNode.decorators.length - ) { - withMethodDecorators = true; - } - // Process parameter declarations. for (const param of node.params) { this.visitPattern( @@ -337,39 +264,3 @@ export class ClassVisitor extends Visitor { this.visitType(node); } } - -/** - * Only if key is one of [identifier, string, number], ts will combine metadata of accessors . - * class A { - * get a() {} - * set ['a'](v: Type) {} - * - * get [1]() {} - * set [1](v: Type) {} - * - * // Following won't be combined - * get [key]() {} - * set [key](v: Type) {} - * - * get [true]() {} - * set [true](v: Type) {} - * - * get ['a'+'b']() {} - * set ['a'+'b']() {} - * } - */ -function getLiteralMethodKeyName( - node: TSESTree.MethodDefinition, -): number | string | null { - if (node.computed && node.key.type === AST_NODE_TYPES.Literal) { - if ( - typeof node.key.value === 'string' || - typeof node.key.value === 'number' - ) { - return node.key.value; - } - } else if (!node.computed && node.key.type === AST_NODE_TYPES.Identifier) { - return node.key.name; - } - return null; -} diff --git a/packages/scope-manager/src/referencer/Reference.ts b/packages/scope-manager/src/referencer/Reference.ts index 6487f8ff36e4..f5d1d3549d9e 100644 --- a/packages/scope-manager/src/referencer/Reference.ts +++ b/packages/scope-manager/src/referencer/Reference.ts @@ -1,4 +1,4 @@ -import type { TSESTree } from '@typescript-eslint/types'; +import type { NodeWithParent, TSESTree } from '@typescript-eslint/types'; import type { Scope } from '../scope'; import type { Variable } from '../variable'; @@ -12,7 +12,7 @@ export enum ReferenceFlag { } export interface ReferenceImplicitGlobal { - node: TSESTree.Node; + node: NodeWithParent; pattern: TSESTree.BindingName; ref?: Reference; } diff --git a/packages/scope-manager/src/referencer/Referencer.ts b/packages/scope-manager/src/referencer/Referencer.ts index 0d1231c611c5..562921170751 100644 --- a/packages/scope-manager/src/referencer/Referencer.ts +++ b/packages/scope-manager/src/referencer/Referencer.ts @@ -90,9 +90,7 @@ export class Referencer extends Visitor { } } public currentScope(): Scope; - public currentScope(throwOnNull: true): Scope | null; - public currentScope(dontThrowOnNull?: true): Scope | null { if (!dontThrowOnNull) { assert(this.scopeManager.currentScope, 'aaa'); @@ -670,10 +668,7 @@ export class Referencer extends Visitor { name, new TSEnumMemberDefinition(name, member), ); - } else if ( - !member.computed && - member.id.type === AST_NODE_TYPES.Identifier - ) { + } else if (member.id.type === AST_NODE_TYPES.Identifier) { this.currentScope().defineIdentifier( member.id, new TSEnumMemberDefinition(member.id, member), diff --git a/packages/scope-manager/src/variable/ESLintScopeVariable.ts b/packages/scope-manager/src/variable/ESLintScopeVariable.ts index be5a95acec89..a51995f27ec7 100644 --- a/packages/scope-manager/src/variable/ESLintScopeVariable.ts +++ b/packages/scope-manager/src/variable/ESLintScopeVariable.ts @@ -17,21 +17,21 @@ export class ESLintScopeVariable extends VariableBase { /** * Written to by ESLint. - * This property is undefined if there are no globals directive comments. - * The array of globals directive comments which defined this global variable in the source code file. + * This property is undefined if there are no globals comment directives. + * The array of globals comment directives which defined this global variable in the source code file. */ public eslintExplicitGlobal?: boolean; /** * Written to by ESLint. - * The configured value in config files. This can be different from `variable.writeable` if there are globals directive comments. + * The configured value in config files. This can be different from `variable.writeable` if there are globals comment directives. */ public eslintImplicitGlobalSetting?: 'readonly' | 'writable'; /** * Written to by ESLint. * If this key exists, it is a global variable added by ESLint. - * If `true`, this global variable was defined by a globals directive comment in the source code file. + * If `true`, this global variable was defined by a globals comment directive in the source code file. */ public eslintExplicitGlobalComments?: TSESTree.Comment[]; } diff --git a/packages/scope-manager/tests/eslint-scope/README.md b/packages/scope-manager/tests/eslint-scope/README.md index 1397ce3cd76a..cbd9986a840d 100644 --- a/packages/scope-manager/tests/eslint-scope/README.md +++ b/packages/scope-manager/tests/eslint-scope/README.md @@ -6,7 +6,6 @@ The intention is to help us ensure we do not regress functionality compared to t They have been modified to: - be written in TypeScript -- work with jest - work with our folder structure - adhere to our formatting and linting style diff --git a/packages/scope-manager/tests/eslint-scope/es6-block-scope.test.ts b/packages/scope-manager/tests/eslint-scope/es6-block-scope.test.ts index fae666eae759..e3aabdfdcfc6 100644 --- a/packages/scope-manager/tests/eslint-scope/es6-block-scope.test.ts +++ b/packages/scope-manager/tests/eslint-scope/es6-block-scope.test.ts @@ -27,7 +27,7 @@ describe('ES6 block scope', () => { expect(scope.references[1].identifier.name).toBe('i'); }); - it('function delaration is materialized in ES6 block scope', () => { + it('function declaration is materialized in ES6 block scope', () => { const { scopeManager } = parseAndAnalyze(` { function test() { diff --git a/packages/scope-manager/tests/eslint-scope/es6-class.test.ts b/packages/scope-manager/tests/eslint-scope/es6-class.test.ts index c7ab81d99077..eaae8dd0210b 100644 --- a/packages/scope-manager/tests/eslint-scope/es6-class.test.ts +++ b/packages/scope-manager/tests/eslint-scope/es6-class.test.ts @@ -140,6 +140,7 @@ describe('ES6 class', () => { assert.isScopeOfType(scope, ScopeType.global); expect(scope.block.type).toBe(AST_NODE_TYPES.Program); expect(scope.isStrict).toBe(false); + expect(variables).toHaveLength(0); scope = scopeManager.scopes[1]; variables = getRealVariables(scope.variables); diff --git a/packages/scope-manager/tests/eslint-scope/es6-object.test.ts b/packages/scope-manager/tests/eslint-scope/es6-object.test.ts index 7f26c43ff780..ffdc8541978d 100644 --- a/packages/scope-manager/tests/eslint-scope/es6-object.test.ts +++ b/packages/scope-manager/tests/eslint-scope/es6-object.test.ts @@ -19,6 +19,7 @@ describe('ES6 object', () => { assert.isScopeOfType(scope, ScopeType.global); expect(scope.block.type).toBe(AST_NODE_TYPES.Program); expect(scope.isStrict).toBe(false); + expect(variables).toHaveLength(0); scope = scopeManager.scopes[1]; variables = getRealVariables(scope.variables); @@ -51,6 +52,7 @@ describe('ES6 object', () => { assert.isScopeOfType(scope, ScopeType.global); expect(scope.block.type).toBe(AST_NODE_TYPES.Program); expect(scope.isStrict).toBe(false); + expect(variables).toHaveLength(0); scope = scopeManager.scopes[1]; variables = getRealVariables(scope.variables); diff --git a/packages/scope-manager/tests/eslint-scope/global-return.test.ts b/packages/scope-manager/tests/eslint-scope/global-return.test.ts index 6125d4ccf1e8..4c04f61a63b8 100644 --- a/packages/scope-manager/tests/eslint-scope/global-return.test.ts +++ b/packages/scope-manager/tests/eslint-scope/global-return.test.ts @@ -3,7 +3,7 @@ import { AST_NODE_TYPES } from '@typescript-eslint/types'; import { DefinitionType, ScopeType } from '../../src/index.js'; import { getRealVariables, parseAndAnalyze } from '../test-utils/index.js'; -describe('gloablReturn option', () => { +describe('globalReturn option', () => { it('creates a function scope following the global scope immediately', () => { const { scopeManager } = parseAndAnalyze( ` diff --git a/packages/scope-manager/tests/fixtures/type-declaration/index-access2.ts.shot b/packages/scope-manager/tests/fixtures/type-declaration/index-access2.ts.shot index cf446d378a40..815710f93125 100644 --- a/packages/scope-manager/tests/fixtures/type-declaration/index-access2.ts.shot +++ b/packages/scope-manager/tests/fixtures/type-declaration/index-access2.ts.shot @@ -10,7 +10,7 @@ ScopeManager { ], name: "T", references: [ - Reference$2 { + Reference$1 { identifier: Identifier<"T">, isRead: true, isTypeReference: true, @@ -31,7 +31,7 @@ ScopeManager { ], name: "K", references: [ - Reference$1 { + Reference$2 { identifier: Identifier<"K">, isRead: true, isTypeReference: true, diff --git a/packages/scope-manager/tests/fixtures/type-declaration/index-access3.ts.shot b/packages/scope-manager/tests/fixtures/type-declaration/index-access3.ts.shot index 95e5ef75c6c2..d6665e50476b 100644 --- a/packages/scope-manager/tests/fixtures/type-declaration/index-access3.ts.shot +++ b/packages/scope-manager/tests/fixtures/type-declaration/index-access3.ts.shot @@ -10,7 +10,7 @@ ScopeManager { ], name: "T", references: [ - Reference$3 { + Reference$2 { identifier: Identifier<"T">, isRead: true, isTypeReference: true, @@ -41,7 +41,7 @@ ScopeManager { resolved: Variable$3, writeExpr: Literal$3, }, - Reference$2 { + Reference$3 { identifier: Identifier<"k">, isRead: true, isTypeReference: false, diff --git a/packages/scope-manager/tests/fixtures/type-declaration/mapped-named.ts.shot b/packages/scope-manager/tests/fixtures/type-declaration/mapped-named.ts.shot index 526c1a55b9a4..8899edb1db89 100644 --- a/packages/scope-manager/tests/fixtures/type-declaration/mapped-named.ts.shot +++ b/packages/scope-manager/tests/fixtures/type-declaration/mapped-named.ts.shot @@ -10,7 +10,7 @@ ScopeManager { ], name: "T", references: [ - Reference$4 { + Reference$3 { identifier: Identifier<"T">, isRead: true, isTypeReference: true, @@ -51,7 +51,7 @@ ScopeManager { isWrite: false, resolved: Variable$4, }, - Reference$3 { + Reference$4 { identifier: Identifier<"k">, isRead: true, isTypeReference: true, diff --git a/packages/scope-manager/tests/fixtures/type-declaration/mapped.ts.shot b/packages/scope-manager/tests/fixtures/type-declaration/mapped.ts.shot index 3f0c6e23cd71..4cc942930bd4 100644 --- a/packages/scope-manager/tests/fixtures/type-declaration/mapped.ts.shot +++ b/packages/scope-manager/tests/fixtures/type-declaration/mapped.ts.shot @@ -10,7 +10,7 @@ ScopeManager { ], name: "T", references: [ - Reference$3 { + Reference$2 { identifier: Identifier<"T">, isRead: true, isTypeReference: true, @@ -43,7 +43,7 @@ ScopeManager { ], name: "k", references: [ - Reference$2 { + Reference$3 { identifier: Identifier<"k">, isRead: true, isTypeReference: true, diff --git a/packages/tsconfig-utils/CHANGELOG.md b/packages/tsconfig-utils/CHANGELOG.md new file mode 100644 index 000000000000..eccf448aa899 --- /dev/null +++ b/packages/tsconfig-utils/CHANGELOG.md @@ -0,0 +1,149 @@ +## 8.46.4 (2025-11-10) + +This was a version bump only for tsconfig-utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.3 (2025-11-03) + +This was a version bump only for tsconfig-utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.2 (2025-10-20) + +This was a version bump only for tsconfig-utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.1 (2025-10-13) + +This was a version bump only for tsconfig-utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.0 (2025-10-06) + +This was a version bump only for tsconfig-utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.45.0 (2025-09-29) + +This was a version bump only for tsconfig-utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.44.1 (2025-09-22) + +This was a version bump only for tsconfig-utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.44.0 (2025-09-15) + +This was a version bump only for tsconfig-utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.43.0 (2025-09-08) + +This was a version bump only for tsconfig-utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.42.0 (2025-09-02) + +This was a version bump only for tsconfig-utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.41.0 (2025-08-25) + +This was a version bump only for tsconfig-utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.40.0 (2025-08-18) + +This was a version bump only for tsconfig-utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.39.1 (2025-08-11) + +This was a version bump only for tsconfig-utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.39.0 (2025-08-04) + +### 🚀 Features + +- update to TypeScript 5.9.2 ([#11445](https://github.com/typescript-eslint/typescript-eslint/pull/11445)) + +### ❤️ Thank You + +- Brad Zacher @bradzacher + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.38.0 (2025-07-21) + +This was a version bump only for tsconfig-utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.37.0 (2025-07-14) + +This was a version bump only for tsconfig-utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.36.0 (2025-07-07) + +This was a version bump only for tsconfig-utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.35.1 (2025-06-30) + +This was a version bump only for tsconfig-utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.35.0 (2025-06-23) + +This was a version bump only for tsconfig-utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.34.1 (2025-06-16) + +This was a version bump only for tsconfig-utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.34.0 (2025-06-09) + +This was a version bump only for tsconfig-utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.33.1 (2025-06-02) + +This was a version bump only for tsconfig-utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.33.0 (2025-05-26) + +### 🚀 Features + +- create standalone project-service, tsconfig-utils packages ([#11182](https://github.com/typescript-eslint/typescript-eslint/pull/11182)) + +### ❤️ Thank You + +- Josh Goldberg ✨ + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. \ No newline at end of file diff --git a/packages/tsconfig-utils/LICENSE b/packages/tsconfig-utils/LICENSE new file mode 100644 index 000000000000..310a18f8a6cb --- /dev/null +++ b/packages/tsconfig-utils/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 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/tsconfig-utils/README.md b/packages/tsconfig-utils/README.md new file mode 100644 index 000000000000..075c3fbb7315 --- /dev/null +++ b/packages/tsconfig-utils/README.md @@ -0,0 +1,12 @@ +# `@typescript-eslint/tsconfig-utils` + +> Utilities for collecting TSConfigs for linting scenarios. + +[![NPM Version](https://img.shields.io/npm/v/@typescript-eslint/tsconfig-utils.svg?style=flat-square)](https://www.npmjs.com/package/@typescript-eslint/tsconfig-utils) +[![NPM Downloads](https://img.shields.io/npm/dm/@typescript-eslint/tsconfig-utils.svg?style=flat-square)](https://www.npmjs.com/package/@typescript-eslint/tsconfig-utils) + +The utilities in this package are separated from `@typescript-eslint/utils` so that they do not have a dependency on `eslint` or `@typescript-eslint/typescript-estree`. + +> See https://typescript-eslint.io for general documentation on typescript-eslint, the tooling that allows you to run ESLint and Prettier on TypeScript code. + + diff --git a/packages/tsconfig-utils/package.json b/packages/tsconfig-utils/package.json new file mode 100644 index 000000000000..8fbaa26d1dfb --- /dev/null +++ b/packages/tsconfig-utils/package.json @@ -0,0 +1,69 @@ +{ + "name": "@typescript-eslint/tsconfig-utils", + "version": "8.46.4", + "description": "Utilities for collecting TSConfigs for linting scenarios.", + "files": [ + "dist", + "!*.tsbuildinfo", + "package.json", + "README.md", + "LICENSE" + ], + "type": "commonjs", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + }, + "./package.json": "./package.json" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "repository": { + "type": "git", + "url": "https://github.com/typescript-eslint/typescript-eslint.git", + "directory": "packages/tsconfig-utils" + }, + "bugs": { + "url": "https://github.com/typescript-eslint/typescript-eslint/issues" + }, + "homepage": "https://typescript-eslint.io", + "license": "MIT", + "keywords": [ + "eslint", + "typescript", + "estree" + ], + "scripts": { + "//": "These package scripts are mostly here for convenience. Task running is handled by Nx at the root level.", + "build": "yarn run -BT nx build", + "clean": "rimraf dist/ coverage/", + "format": "yarn run -T format", + "lint": "yarn run -BT nx lint", + "test": "yarn run -BT nx test", + "typecheck": "yarn run -BT nx typecheck" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.0.0" + }, + "devDependencies": { + "@vitest/coverage-v8": "^3.1.3", + "rimraf": "*", + "typescript": "*", + "vitest": "^3.1.3" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "publishConfig": { + "access": "public" + }, + "nx": { + "name": "tsconfig-utils", + "includedScripts": [ + "clean" + ] + } +} diff --git a/packages/tsconfig-utils/src/compilerOptions.ts b/packages/tsconfig-utils/src/compilerOptions.ts new file mode 100644 index 000000000000..1183ce149911 --- /dev/null +++ b/packages/tsconfig-utils/src/compilerOptions.ts @@ -0,0 +1,13 @@ +import type * as ts from 'typescript'; + +/** + * Compiler options required to avoid critical functionality issues + */ +export const CORE_COMPILER_OPTIONS = { + // Required to avoid parse from causing emit to occur + noEmit: true, + + // Flags required to make no-unused-vars work + noUnusedLocals: true, + noUnusedParameters: true, +} satisfies ts.CompilerOptions; diff --git a/packages/typescript-estree/src/create-program/getParsedConfigFile.ts b/packages/tsconfig-utils/src/getParsedConfigFile.ts similarity index 94% rename from packages/typescript-estree/src/create-program/getParsedConfigFile.ts rename to packages/tsconfig-utils/src/getParsedConfigFile.ts index 6efebadf48d2..a6dafe5b1daa 100644 --- a/packages/typescript-estree/src/create-program/getParsedConfigFile.ts +++ b/packages/tsconfig-utils/src/getParsedConfigFile.ts @@ -3,10 +3,10 @@ import type * as ts from 'typescript/lib/tsserverlibrary'; import * as fs from 'node:fs'; import * as path from 'node:path'; -import { CORE_COMPILER_OPTIONS } from './shared'; +import { CORE_COMPILER_OPTIONS } from './compilerOptions'; /** - * Utility offered by parser to help consumers parse a config file. + * Parses a TSConfig file using the same logic as tsserver. * * @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()` diff --git a/packages/tsconfig-utils/src/index.ts b/packages/tsconfig-utils/src/index.ts new file mode 100644 index 000000000000..3213fc4e40a1 --- /dev/null +++ b/packages/tsconfig-utils/src/index.ts @@ -0,0 +1,2 @@ +export * from './compilerOptions'; +export * from './getParsedConfigFile'; diff --git a/packages/typescript-estree/tests/lib/getParsedConfigFile.test.ts b/packages/tsconfig-utils/tests/getParsedConfigFile.test.ts similarity index 88% rename from packages/typescript-estree/tests/lib/getParsedConfigFile.test.ts rename to packages/tsconfig-utils/tests/getParsedConfigFile.test.ts index aa013abef444..661c84dcb6b0 100644 --- a/packages/typescript-estree/tests/lib/getParsedConfigFile.test.ts +++ b/packages/tsconfig-utils/tests/getParsedConfigFile.test.ts @@ -1,7 +1,7 @@ -import path from 'node:path'; +import * as path from 'node:path'; import * as ts from 'typescript'; -import { getParsedConfigFile } from '../../src/create-program/getParsedConfigFile'; +import { getParsedConfigFile } from '../src/getParsedConfigFile.js'; const mockGetParsedCommandLineOfConfigFile = vi.fn(); @@ -22,9 +22,9 @@ describe(getParsedConfigFile, () => { }); it('throws an error when tsserver.sys is undefined', () => { - expect(() => - getParsedConfigFile({} as typeof ts, './tsconfig.json'), - ).toThrow( + expect(() => { + getParsedConfigFile({} as typeof ts, './tsconfig.json'); + }).toThrow( '`getParsedConfigFile` is only supported in a Node-like environment.', ); }); @@ -72,9 +72,9 @@ describe(getParsedConfigFile, () => { }, ] satisfies ts.Diagnostic[], }); - expect(() => getParsedConfigFile(mockTsserver, './tsconfig.json')).toThrow( - /.+ error TS1234: Oh no!/, - ); + expect(() => { + getParsedConfigFile(mockTsserver, './tsconfig.json'); + }).toThrow(/.+ error TS1234: Oh no!/); }); it('throws a diagnostic error when getParsedCommandLineOfConfigFile throws an error', () => { @@ -96,9 +96,9 @@ describe(getParsedConfigFile, () => { } satisfies ts.Diagnostic); }, ); - expect(() => getParsedConfigFile(mockTsserver, './tsconfig.json')).toThrow( - /.+ error TS1234: Oh no!/, - ); + expect(() => { + getParsedConfigFile(mockTsserver, './tsconfig.json'); + }).toThrow(/.+ error TS1234: Oh no!/); }); it('uses compiler options when parsing a config file succeeds', () => { diff --git a/packages/tsconfig-utils/tsconfig.build.json b/packages/tsconfig-utils/tsconfig.build.json new file mode 100644 index 000000000000..4a1f19accacd --- /dev/null +++ b/packages/tsconfig-utils/tsconfig.build.json @@ -0,0 +1,5 @@ +{ + "extends": "../../tsconfig.build.json", + "compilerOptions": {}, + "references": [] +} diff --git a/packages/tsconfig-utils/tsconfig.json b/packages/tsconfig-utils/tsconfig.json new file mode 100644 index 000000000000..d4d0929e1955 --- /dev/null +++ b/packages/tsconfig-utils/tsconfig.json @@ -0,0 +1,13 @@ +{ + "extends": "../../tsconfig.base.json", + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.build.json" + }, + { + "path": "./tsconfig.spec.json" + } + ] +} diff --git a/packages/tsconfig-utils/tsconfig.spec.json b/packages/tsconfig-utils/tsconfig.spec.json new file mode 100644 index 000000000000..29124fc697d3 --- /dev/null +++ b/packages/tsconfig-utils/tsconfig.spec.json @@ -0,0 +1,14 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "outDir": "../../dist/packages/tsconfig-utils" + }, + "references": [ + { + "path": "./tsconfig.build.json" + }, + { + "path": "../../tsconfig.spec.json" + } + ] +} diff --git a/packages/tsconfig-utils/vitest.config.mts b/packages/tsconfig-utils/vitest.config.mts new file mode 100644 index 000000000000..ddc038f86b56 --- /dev/null +++ b/packages/tsconfig-utils/vitest.config.mts @@ -0,0 +1,21 @@ +import * as path from 'node:path'; +import { defineProject, mergeConfig } from 'vitest/config'; + +import { vitestBaseConfig } from '../../vitest.config.base.mjs'; +import packageJson from './package.json' with { type: 'json' }; + +const vitestConfig = mergeConfig( + vitestBaseConfig, + + defineProject({ + root: import.meta.dirname, + + test: { + dir: path.join(import.meta.dirname, 'tests'), + name: packageJson.name.replace('@typescript-eslint/', ''), + root: import.meta.dirname, + }, + }), +); + +export default vitestConfig; diff --git a/packages/type-utils/CHANGELOG.md b/packages/type-utils/CHANGELOG.md index 219d98d9b64c..9257f2c6b57e 100644 --- a/packages/type-utils/CHANGELOG.md +++ b/packages/type-utils/CHANGELOG.md @@ -1,3 +1,173 @@ +## 8.46.4 (2025-11-10) + +This was a version bump only for type-utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.3 (2025-11-03) + +This was a version bump only for type-utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.2 (2025-10-20) + +This was a version bump only for type-utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.1 (2025-10-13) + +This was a version bump only for type-utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.0 (2025-10-06) + +### 🩹 Fixes + +- **eslint-plugin:** [prefer-readonly-parameter-types] ignore tagged primitives ([#11660](https://github.com/typescript-eslint/typescript-eslint/pull/11660)) + +### ❤️ Thank You + +- Josh Goldberg ✨ + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.45.0 (2025-09-29) + +This was a version bump only for type-utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.44.1 (2025-09-22) + +This was a version bump only for type-utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.44.0 (2025-09-15) + +This was a version bump only for type-utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.43.0 (2025-09-08) + +### 🩹 Fixes + +- **type-utils:** add union type support to TypeOrValueSpecifier ([#11526](https://github.com/typescript-eslint/typescript-eslint/pull/11526)) + +### ❤️ Thank You + +- Yukihiro Hasegawa @y-hsgw + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.42.0 (2025-09-02) + +This was a version bump only for type-utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.41.0 (2025-08-25) + +This was a version bump only for type-utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.40.0 (2025-08-18) + +This was a version bump only for type-utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.39.1 (2025-08-11) + +This was a version bump only for type-utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.39.0 (2025-08-04) + +### 🚀 Features + +- update to TypeScript 5.9.2 ([#11445](https://github.com/typescript-eslint/typescript-eslint/pull/11445)) + +### ❤️ Thank You + +- Brad Zacher @bradzacher + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.38.0 (2025-07-21) + +This was a version bump only for type-utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.37.0 (2025-07-14) + +### 🩹 Fixes + +- **type-utils:** handle namespaced exports in specifier matching ([#11380](https://github.com/typescript-eslint/typescript-eslint/pull/11380)) +- **type-utils:** add missing 'types' dependency to 'type-utils' ([#11383](https://github.com/typescript-eslint/typescript-eslint/pull/11383)) + +### ❤️ Thank You + +- Bill Collins +- René @Renegade334 + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.36.0 (2025-07-07) + +This was a version bump only for type-utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.35.1 (2025-06-30) + +This was a version bump only for type-utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.35.0 (2025-06-23) + +This was a version bump only for type-utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.34.1 (2025-06-16) + +This was a version bump only for type-utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.34.0 (2025-06-09) + +### 🚀 Features + +- **type-utils:** deprecated getSourceFileOfNode function ([#11284](https://github.com/typescript-eslint/typescript-eslint/pull/11284)) + +### ❤️ Thank You + +- Kim Sang Du @developer-bandi + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.33.1 (2025-06-02) + +This was a version bump only for type-utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.33.0 (2025-05-26) + +This was a version bump only for type-utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + ## 8.32.1 (2025-05-12) This was a version bump only for type-utils to align it with other projects, there were no code changes. diff --git a/packages/type-utils/package.json b/packages/type-utils/package.json index d6bb070d6cfd..59271a4bb535 100644 --- a/packages/type-utils/package.json +++ b/packages/type-utils/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/type-utils", - "version": "8.32.1", + "version": "8.46.4", "description": "Type utilities for working with TypeScript + ESLint together", "files": [ "dist", @@ -36,29 +36,29 @@ "estree" ], "scripts": { - "build": "tsc -b tsconfig.build.json", + "build": "yarn run -BT nx build", "clean": "rimraf dist/ coverage/", - "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", - "lint": "npx nx lint", - "test": "vitest --run --config=$INIT_CWD/vitest.config.mts", - "check-types": "npx nx typecheck" + "format": "yarn run -T format", + "lint": "yarn run -BT nx lint", + "test": "yarn run -BT nx test", + "typecheck": "yarn run -BT nx typecheck" }, "dependencies": { - "@typescript-eslint/typescript-estree": "8.32.1", - "@typescript-eslint/utils": "8.32.1", + "@typescript-eslint/types": "8.46.4", + "@typescript-eslint/typescript-estree": "8.46.4", + "@typescript-eslint/utils": "8.46.4", "debug": "^4.3.4", "ts-api-utils": "^2.1.0" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0", - "typescript": ">=4.8.4 <5.9.0" + "typescript": ">=4.8.4 <6.0.0" }, "devDependencies": { - "@typescript-eslint/parser": "8.32.1", + "@typescript-eslint/parser": "8.46.4", "@vitest/coverage-v8": "^3.1.3", "ajv": "^6.12.6", "eslint": "*", - "prettier": "^3.2.5", "rimraf": "*", "typescript": "*", "vitest": "^3.1.3" @@ -66,5 +66,16 @@ "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" + }, + "nx": { + "name": "type-utils", + "includedScripts": [ + "clean" + ], + "targets": { + "lint": { + "command": "eslint" + } + } } } diff --git a/packages/type-utils/project.json b/packages/type-utils/project.json deleted file mode 100644 index 8c91c0ace943..000000000000 --- a/packages/type-utils/project.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "type-utils", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "projectType": "library", - "root": "packages/type-utils", - "sourceRoot": "packages/type-utils/src", - "targets": { - "lint": { - "executor": "@nx/eslint:lint", - "outputs": ["{options.outputFile}"] - }, - "test": { - "executor": "@nx/vite:test" - } - } -} diff --git a/packages/type-utils/src/TypeOrValueSpecifier.ts b/packages/type-utils/src/TypeOrValueSpecifier.ts index 4c8f1211a8be..553c8a4225bf 100644 --- a/packages/type-utils/src/TypeOrValueSpecifier.ts +++ b/packages/type-utils/src/TypeOrValueSpecifier.ts @@ -1,6 +1,8 @@ +import type { TSESTree } from '@typescript-eslint/types'; import type { JSONSchema4 } from '@typescript-eslint/utils/json-schema'; import type * as ts from 'typescript'; +import { AST_NODE_TYPES } from '@typescript-eslint/types'; import * as tsutils from 'ts-api-utils'; import { specifierNameMatches } from './typeOrValueSpecifiers/specifierNameMatches'; @@ -167,6 +169,10 @@ export function typeMatchesSpecifier( specifier: TypeOrValueSpecifier, program: ts.Program, ): boolean { + if (tsutils.isUnionType(type)) { + return type.types.every(t => typeMatchesSpecifier(t, specifier, program)); + } + const wholeTypeMatches = ((): boolean => { if (tsutils.isIntrinsicErrorType(type)) { return false; @@ -219,3 +225,69 @@ export const typeMatchesSomeSpecifier = ( program: ts.Program, ): boolean => specifiers.some(specifier => typeMatchesSpecifier(type, specifier, program)); + +const getSpecifierNames = (specifierName: string | string[]): string[] => { + return typeof specifierName === 'string' ? [specifierName] : specifierName; +}; + +const getStaticName = (node: TSESTree.Node): string | undefined => { + if ( + node.type === AST_NODE_TYPES.Identifier || + node.type === AST_NODE_TYPES.JSXIdentifier || + node.type === AST_NODE_TYPES.PrivateIdentifier + ) { + return node.name; + } + + if (node.type === AST_NODE_TYPES.Literal && typeof node.value === 'string') { + return node.value; + } + + return undefined; +}; + +export function valueMatchesSpecifier( + node: TSESTree.Node, + specifier: TypeOrValueSpecifier, + program: ts.Program, + type: ts.Type, +): boolean { + const staticName = getStaticName(node); + if (!staticName) { + return false; + } + + if (typeof specifier === 'string') { + return specifier === staticName; + } + + if (!getSpecifierNames(specifier.name).includes(staticName)) { + return false; + } + + if (specifier.from === 'package') { + const symbol = type.getSymbol() ?? type.aliasSymbol; + const declarations = symbol?.getDeclarations() ?? []; + const declarationFiles = declarations.map(declaration => + declaration.getSourceFile(), + ); + return typeDeclaredInPackageDeclarationFile( + specifier.package, + declarations, + declarationFiles, + program, + ); + } + + return true; +} + +export const valueMatchesSomeSpecifier = ( + node: TSESTree.Node, + specifiers: TypeOrValueSpecifier[] = [], + program: ts.Program, + type: ts.Type, +): boolean => + specifiers.some(specifier => + valueMatchesSpecifier(node, specifier, program, type), + ); diff --git a/packages/type-utils/src/getSourceFileOfNode.ts b/packages/type-utils/src/getSourceFileOfNode.ts index 18e7ca27ecde..ffad3631a25a 100644 --- a/packages/type-utils/src/getSourceFileOfNode.ts +++ b/packages/type-utils/src/getSourceFileOfNode.ts @@ -1,6 +1,7 @@ import * as ts from 'typescript'; /** + * @deprecated * Gets the source file for a given node */ export function getSourceFileOfNode(node: ts.Node): ts.SourceFile { diff --git a/packages/type-utils/src/index.ts b/packages/type-utils/src/index.ts index 8435b4e1f429..8b83a1931405 100644 --- a/packages/type-utils/src/index.ts +++ b/packages/type-utils/src/index.ts @@ -6,6 +6,7 @@ export * from './getDeclaration'; export * from './getSourceFileOfNode'; export * from './getTypeName'; export * from './isSymbolFromDefaultLibrary'; +export * from './isTypeBrandedLiteralLike'; export * from './isTypeReadonly'; export * from './isUnsafeAssignment'; export * from './predicates'; diff --git a/packages/type-utils/src/isTypeBrandedLiteralLike.ts b/packages/type-utils/src/isTypeBrandedLiteralLike.ts new file mode 100644 index 000000000000..93852c95fbc4 --- /dev/null +++ b/packages/type-utils/src/isTypeBrandedLiteralLike.ts @@ -0,0 +1,50 @@ +import * as tsutils from 'ts-api-utils'; +import * as ts from 'typescript'; + +function isLiteralOrTaggablePrimitiveLike(type: ts.Type): boolean { + return ( + type.isLiteral() || + tsutils.isTypeFlagSet( + type, + ts.TypeFlags.BigInt | + ts.TypeFlags.Number | + ts.TypeFlags.String | + ts.TypeFlags.TemplateLiteral, + ) + ); +} + +function isObjectLiteralLike(type: ts.Type): boolean { + return ( + !type.getCallSignatures().length && + !type.getConstructSignatures().length && + tsutils.isObjectType(type) + ); +} + +function isTypeBrandedLiteral(type: ts.Type): boolean { + if (!type.isIntersection()) { + return false; + } + + let hadObjectLike = false; + let hadPrimitiveLike = false; + + for (const constituent of type.types) { + if (isObjectLiteralLike(constituent)) { + hadPrimitiveLike = true; + } else if (isLiteralOrTaggablePrimitiveLike(constituent)) { + hadObjectLike = true; + } else { + return false; + } + } + + return hadPrimitiveLike && hadObjectLike; +} + +export function isTypeBrandedLiteralLike(type: ts.Type): boolean { + return type.isUnion() + ? type.types.every(isTypeBrandedLiteral) + : isTypeBrandedLiteral(type); +} diff --git a/packages/type-utils/src/isUnsafeAssignment.ts b/packages/type-utils/src/isUnsafeAssignment.ts index 41fcc8aab1c1..c54f7ef5b7c6 100644 --- a/packages/type-utils/src/isUnsafeAssignment.ts +++ b/packages/type-utils/src/isUnsafeAssignment.ts @@ -21,7 +21,7 @@ export function isUnsafeAssignment( receiver: ts.Type, checker: ts.TypeChecker, senderNode: TSESTree.Node | null, -): { receiver: ts.Type; sender: ts.Type } | false { +): false | { receiver: ts.Type; sender: ts.Type } { return isUnsafeAssignmentWorker( type, receiver, @@ -37,7 +37,7 @@ function isUnsafeAssignmentWorker( checker: ts.TypeChecker, senderNode: TSESTree.Node | null, visited: Map>, -): { receiver: ts.Type; sender: ts.Type } | false { +): false | { receiver: ts.Type; sender: ts.Type } { if (isTypeAnyType(type)) { // Allow assignment of any ==> unknown. if (isTypeUnknownType(receiver)) { diff --git a/packages/type-utils/src/typeOrValueSpecifiers/typeDeclaredInPackageDeclarationFile.ts b/packages/type-utils/src/typeOrValueSpecifiers/typeDeclaredInPackageDeclarationFile.ts index cb0b303bafac..e0da69700a83 100644 --- a/packages/type-utils/src/typeOrValueSpecifiers/typeDeclaredInPackageDeclarationFile.ts +++ b/packages/type-utils/src/typeOrValueSpecifiers/typeDeclaredInPackageDeclarationFile.ts @@ -5,14 +5,17 @@ function findParentModuleDeclaration( ): ts.ModuleDeclaration | undefined { switch (node.kind) { case ts.SyntaxKind.ModuleDeclaration: + // "namespace x {...}" should be ignored here + if (node.flags & ts.NodeFlags.Namespace) { + break; + } return ts.isStringLiteral((node as ts.ModuleDeclaration).name) ? (node as ts.ModuleDeclaration) : undefined; case ts.SyntaxKind.SourceFile: return undefined; - default: - return findParentModuleDeclaration(node.parent); } + return findParentModuleDeclaration(node.parent); } function typeDeclaredInDeclareModule( diff --git a/packages/type-utils/tests/TypeOrValueSpecifier.test.ts b/packages/type-utils/tests/TypeOrValueSpecifier.test.ts index 8aee949efb37..3d3429fbb3d1 100644 --- a/packages/type-utils/tests/TypeOrValueSpecifier.test.ts +++ b/packages/type-utils/tests/TypeOrValueSpecifier.test.ts @@ -1,8 +1,17 @@ +import type { TSESTree } from '@typescript-eslint/utils'; + +import { parseForESLint } from '@typescript-eslint/parser'; +import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import * as path from 'node:path'; import type { TypeOrValueSpecifier } from '../src/index.js'; -import { typeMatchesSpecifier } from '../src/index.js'; +import { + typeMatchesSomeSpecifier, + typeMatchesSpecifier, + valueMatchesSomeSpecifier, + valueMatchesSpecifier, +} from '../src/index.js'; const ROOT_DIR = path.posix.join( ...path.relative(process.cwd(), path.join(__dirname, '..')).split(path.sep), @@ -170,6 +179,7 @@ describe('TypeOrValueSpecifier', () => { ['interface Foo {prop: string}; type Test = Foo;', 'RegExp'], ['type Test = RegExp;', 'Foo'], ['type Test = RegExp;', 'BigInt'], + ['type Test = RegExp | BigInt;', 'BigInt'], ] as const satisfies [string, TypeOrValueSpecifier][])( "doesn't match a mismatched universal string specifier: %s\n\t%s", ([code, typeOrValueSpecifier], { expect }) => { @@ -258,6 +268,10 @@ describe('TypeOrValueSpecifier', () => { 'interface Foo {prop: string}; type Test = Foo;', { from: 'file', name: 'Bar' }, ], + [ + 'interface Foo {prop: string}; type Test = Foo | string;', + { from: 'file', name: 'Foo' }, + ], [ 'interface Foo {prop: string}; type Test = Foo;', { from: 'file', name: ['Bar', 'Baz'] }, @@ -297,6 +311,7 @@ describe('TypeOrValueSpecifier', () => { it.for([ ['type Test = RegExp;', { from: 'lib', name: 'BigInt' }], + ['type Test = RegExp | BigInt;', { from: 'lib', name: 'BigInt' }], ['type Test = RegExp;', { from: 'lib', name: ['BigInt', 'Date'] }], ] as const satisfies [string, TypeOrValueSpecifier][])( "doesn't match a mismatched lib specifier: %s\n\t%s", @@ -317,6 +332,7 @@ describe('TypeOrValueSpecifier', () => { it.for([ ['type Test = string;', { from: 'lib', name: 'number' }], + ['type Test = string | number;', { from: 'lib', name: 'number' }], ['type Test = string;', { from: 'lib', name: ['number', 'boolean'] }], ] as const satisfies [string, TypeOrValueSpecifier][])( "doesn't match a mismatched intrinsic type specifier: %s\n\t%s", @@ -380,29 +396,39 @@ describe('TypeOrValueSpecifier', () => { package: '@babel/code-frame', }, ], + // TODO: Skipped pending resolution of https://github.com/typescript-eslint/typescript-eslint/issues/11504 + // // The following type is available from the multi-file @types/node package. - [ - 'import { it } from "node:test"; type Test = typeof it;', - { - from: 'package', - name: 'it', - package: 'node:test', - }, - ], - [ - ` - declare module "node:test" { - export function it(): void; - } - - import { it } from "node:test"; - - type Test = typeof it; - `, + // [ + // 'import { it } from "node:test"; type Test = typeof it;', + // { + // from: 'package', + // name: 'it', + // package: 'node:test', + // }, + // ], + // [ + // ` + // declare module "node:test" { + // export function it(): void; + // } + // + // import { it } from "node:test"; + // + // type Test = typeof it; + // `, + // { + // from: 'package', + // name: 'it', + // package: 'node:test', + // }, + // ], + [ + 'import { fail } from "node:assert"; type Test = typeof fail;', { from: 'package', - name: 'it', - package: 'node:test', + name: 'fail', + package: 'assert', }, ], ] as const satisfies [string, TypeOrValueSpecifier][])( @@ -526,6 +552,10 @@ describe('TypeOrValueSpecifier', () => { 'import type {Node} from "typescript"; type Test = Node;', { from: 'package', name: 'Symbol', package: 'typescript' }, ], + [ + 'import type {Node} from "typescript"; type Test = Node | Symbol;', + { from: 'package', name: 'Node', package: 'typescript' }, + ], [ 'import type {Node} from "typescript"; type Test = Node;', { from: 'package', name: ['Symbol', 'Checker'], package: 'typescript' }, @@ -628,4 +658,313 @@ describe('TypeOrValueSpecifier', () => { }, ); }); + + describe(valueMatchesSpecifier, () => { + function parseCode(code: string) { + const rootDir = path.join(__dirname, 'fixtures'); + const { ast, services } = parseForESLint(code, { + disallowAutomaticSingleRunInference: true, + filePath: path.join(rootDir, 'file.ts'), + project: './tsconfig.json', + tsconfigRootDir: rootDir, + }); + assert.isNotNull(services.program); + + return { ast, services }; + } + + describe(AST_NODE_TYPES.VariableDeclaration, () => { + function runTests( + code: string, + specifier: TypeOrValueSpecifier, + expected: boolean, + ) { + const { ast, services } = parseCode(code); + const declaration = ast.body.at(-1) as TSESTree.VariableDeclaration; + const { id, init } = declaration.declarations[0]; + const type = services.getTypeAtLocation(id); + expect( + valueMatchesSpecifier(init!, specifier, services.program, type), + ).toBe(expected); + } + + function runTestPositive( + code: string, + specifier: TypeOrValueSpecifier, + ): void { + runTests(code, specifier, true); + } + + function runTestNegative( + code: string, + specifier: TypeOrValueSpecifier, + ): void { + runTests(code, specifier, false); + } + + it.each<[string, TypeOrValueSpecifier]>([ + ['const value = 45;', 'value'], + ['let value = 45;', 'value'], + ['var value = 45;', 'value'], + ])( + 'does not match for non-Identifier or non-JSXIdentifier node: %s', + runTestNegative, + ); + + it.each<[string, TypeOrValueSpecifier]>([ + ['const value = 45; const hoge = value;', 'value'], + ['let value = 45; const hoge = value;', 'value'], + ['var value = 45; const hoge = value;', 'value'], + ])('matches a matching universal string specifier: %s', runTestPositive); + + it.each<[string, TypeOrValueSpecifier]>([ + ['const value = 45; const hoge = value;', 'incorrect'], + ])( + "doesn't match a mismatched universal string specifier: %s", + runTestNegative, + ); + + it.each<[string, TypeOrValueSpecifier]>([ + [ + 'const value = 45; const hoge = value;', + { from: 'file', name: 'value' }, + ], + [ + 'const value = 45; const hoge = value;', + { from: 'file', name: ['value', 'hoge'] }, + ], + [ + 'let value = 45; const hoge = value;', + { from: 'file', name: 'value' }, + ], + [ + 'var value = 45; const hoge = value;', + { from: 'file', name: 'value' }, + ], + ])('matches a matching file specifier: %s', runTestPositive); + + it.each<[string, TypeOrValueSpecifier]>([ + [ + 'const value = 45; const hoge = value;', + { from: 'file', name: 'incorrect' }, + ], + [ + 'const value = 45; const hoge = value;', + { from: 'file', name: ['incorrect', 'invalid'] }, + ], + ])("doesn't match a mismatched file specifier: %s", runTestNegative); + + it.each<[string, TypeOrValueSpecifier]>([ + ['const value = console', { from: 'lib', name: 'console' }], + ['const value = console', { from: 'lib', name: ['console', 'hoge'] }], + ['let value = console', { from: 'lib', name: 'console' }], + ['var value = console', { from: 'lib', name: 'console' }], + ])('matches a matching lib specifier: %s', runTestPositive); + + it.each<[string, TypeOrValueSpecifier]>([ + ['const value = console', { from: 'lib', name: 'incorrect' }], + [ + 'const value = console', + { from: 'lib', name: ['incorrect', 'window'] }, + ], + ])("doesn't match a mismatched lib specifier: %s", runTestNegative); + + it.each<[string, TypeOrValueSpecifier]>([ + [ + 'import { mock } from "node:test"; const hoge = mock;', + { from: 'package', name: 'mock', package: 'node:test' }, + ], + [ + 'import { mock } from "node:test"; const hoge = mock;', + { from: 'package', name: ['mock', 'hoge'], package: 'node:test' }, + ], + [ + `const fs: typeof import("fs"); const module = fs;`, + { from: 'package', name: 'fs', package: 'fs' }, + ], + ])('matches a matching package specifier: %s', runTestPositive); + + it.each<[string, TypeOrValueSpecifier]>([ + [ + 'import { mock } from "node:test"; const hoge = mock;', + { from: 'package', name: 'hoge', package: 'node:test' }, + ], + [ + 'import { mock } from "node"; const hoge = mock;', + { from: 'package', name: 'mock', package: 'node:test' }, + ], + [ + 'const mock = 42; const hoge = mock;', + { from: 'package', name: 'mock', package: 'node:test' }, + ], + ])("doesn't match a mismatched package specifier: %s", runTestNegative); + }); + + describe(AST_NODE_TYPES.ClassDeclaration, () => { + function runTests( + code: string, + specifier: TypeOrValueSpecifier, + expected: boolean, + ) { + const { ast, services } = parseCode(code); + const declaration = ast.body.at(-1) as TSESTree.ClassDeclaration; + const definition = declaration.body.body.at( + -1, + ) as TSESTree.PropertyDefinition; + const { property } = definition.value as TSESTree.MemberExpression; + const type = services.getTypeAtLocation(property); + expect( + valueMatchesSpecifier(property, specifier, services.program, type), + ).toBe(expected); + } + + function runTestPositive( + code: string, + specifier: TypeOrValueSpecifier, + ): void { + runTests(code, specifier, true); + } + + function runTestNegative( + code: string, + specifier: TypeOrValueSpecifier, + ): void { + runTests(code, specifier, false); + } + + it.each<[string, TypeOrValueSpecifier]>([ + [ + `class MyClass { + #privateProp = 42; + value = this.#privateProp; + }`, + 'privateProp', + ], + [ + ` + class MyClass { + ['computed prop'] = 42; + value = this['computed prop']; + }`, + `computed prop`, + ], + ])('matches a matching universal string specifier: %s', runTestPositive); + + it.each<[string, TypeOrValueSpecifier]>([ + [ + `class MyClass { + #privateProp = 42; + value = this.#privateProp; + }`, + 'incorrect', + ], + ])('matches a matching universal string specifier: %s', runTestNegative); + }); + }); + + describe(typeMatchesSomeSpecifier, () => { + function runTests( + code: string, + specifiers: TypeOrValueSpecifier[], + expected: boolean, + ): void { + const rootDir = path.join(__dirname, 'fixtures'); + const { ast, services } = parseForESLint(code, { + disallowAutomaticSingleRunInference: true, + filePath: path.join(rootDir, 'file.ts'), + project: './tsconfig.json', + tsconfigRootDir: rootDir, + }); + const type = services + .program!.getTypeChecker() + .getTypeAtLocation( + services.esTreeNodeToTSNodeMap.get( + (ast.body[ast.body.length - 1] as TSESTree.TSTypeAliasDeclaration) + .id, + ), + ); + expect( + typeMatchesSomeSpecifier(type, specifiers, services.program!), + ).toBe(expected); + } + + function runTestPositive( + code: string, + specifiers: TypeOrValueSpecifier[], + ): void { + runTests(code, specifiers, true); + } + + function runTestNegative( + code: string, + specifiers: TypeOrValueSpecifier[], + ): void { + runTests(code, specifiers, false); + } + + it.each<[string, TypeOrValueSpecifier[]]>([ + ['interface Foo {prop: string}; type Test = Foo;', ['Foo', 'Hoge']], + ['type Test = RegExp;', ['RegExp', 'BigInt']], + ])('matches a matching universal string specifiers', runTestPositive); + + it.each<[string, TypeOrValueSpecifier[]]>([ + ['interface Foo {prop: string}; type Test = Foo;', ['Bar', 'Hoge']], + ['type Test = RegExp;', ['Foo', 'BigInt']], + ])( + "doesn't match a mismatched universal string specifiers", + runTestNegative, + ); + }); + + describe(valueMatchesSomeSpecifier, () => { + function runTests( + code: string, + specifiers: TypeOrValueSpecifier[] | undefined, + expected: boolean, + ): void { + const rootDir = path.join(__dirname, 'fixtures'); + const { ast, services } = parseForESLint(code, { + disallowAutomaticSingleRunInference: true, + filePath: path.join(rootDir, 'file.ts'), + project: './tsconfig.json', + tsconfigRootDir: rootDir, + }); + assert.isNotNull(services.program); + + const declaration = ast.body.at(-1) as TSESTree.VariableDeclaration; + const { id, init } = declaration.declarations[0]; + const type = services.getTypeAtLocation(id); + expect( + valueMatchesSomeSpecifier(init!, specifiers, services.program, type), + ).toBe(expected); + } + + function runTestPositive( + code: string, + specifiers: TypeOrValueSpecifier[], + ): void { + runTests(code, specifiers, true); + } + + function runTestNegative( + code: string, + specifiers: TypeOrValueSpecifier[] | undefined, + ): void { + runTests(code, specifiers, false); + } + + it.each<[string, TypeOrValueSpecifier[]]>([ + ['const value = 45; const hoge = value;', ['value', 'hoge']], + ['let value = 45; const hoge = value;', ['value', 'hoge']], + ['var value = 45; const hoge = value;', ['value', 'hoge']], + ])('matches a matching universal string specifiers: %s', runTestPositive); + + it.each<[string, TypeOrValueSpecifier[] | undefined]>([ + ['const value = 45; const hoge = value;', ['incorrect', 'invalid']], + ['const value = 45; const hoge = value;', undefined], + ])( + "doesn't match a mismatched universal string specifiers: %s", + runTestNegative, + ); + }); }); diff --git a/packages/type-utils/tests/requiresQuoting.test.ts b/packages/type-utils/tests/requiresQuoting.test.ts index ce7c7c0cdcc3..2c71ebf51352 100644 --- a/packages/type-utils/tests/requiresQuoting.test.ts +++ b/packages/type-utils/tests/requiresQuoting.test.ts @@ -14,12 +14,12 @@ describe(requiresQuoting, () => { expect(result).toBe(false); }); - it('start with dollorSign', () => { + it('start with dollarSign', () => { const name = '$bar'; const result = requiresQuoting(name); expect(result).toBe(false); }); - it('include dollorSign not start position', () => { + it('include dollarSign not start position', () => { const name = 'foo$bar'; const result = requiresQuoting(name); expect(result).toBe(false); diff --git a/packages/types/CHANGELOG.md b/packages/types/CHANGELOG.md index f8d27218edad..7085c62c42b4 100644 --- a/packages/types/CHANGELOG.md +++ b/packages/types/CHANGELOG.md @@ -1,3 +1,159 @@ +## 8.46.4 (2025-11-10) + +This was a version bump only for types to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.3 (2025-11-03) + +This was a version bump only for types to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.2 (2025-10-20) + +This was a version bump only for types to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.1 (2025-10-13) + +This was a version bump only for types to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.0 (2025-10-06) + +This was a version bump only for types to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.45.0 (2025-09-29) + +This was a version bump only for types to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.44.1 (2025-09-22) + +This was a version bump only for types to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.44.0 (2025-09-15) + +This was a version bump only for types to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.43.0 (2025-09-08) + +### 🩹 Fixes + +- **scope-manager:** exclude Program from DefinitionBase node types ([#11469](https://github.com/typescript-eslint/typescript-eslint/pull/11469)) + +### ❤️ Thank You + +- Dima @dbarabashh + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.42.0 (2025-09-02) + +This was a version bump only for types to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.41.0 (2025-08-25) + +This was a version bump only for types to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.40.0 (2025-08-18) + +This was a version bump only for types to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.39.1 (2025-08-11) + +This was a version bump only for types to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.39.0 (2025-08-04) + +### 🚀 Features + +- update to TypeScript 5.9.2 ([#11445](https://github.com/typescript-eslint/typescript-eslint/pull/11445)) + +### ❤️ Thank You + +- Brad Zacher @bradzacher + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.38.0 (2025-07-21) + +This was a version bump only for types to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.37.0 (2025-07-14) + +This was a version bump only for types to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.36.0 (2025-07-07) + +This was a version bump only for types to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.35.1 (2025-06-30) + +This was a version bump only for types to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.35.0 (2025-06-23) + +This was a version bump only for types to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.34.1 (2025-06-16) + +### 🩹 Fixes + +- **types:** add 2026/17 to EcmaVersion ([#11304](https://github.com/typescript-eslint/typescript-eslint/pull/11304)) + +### ❤️ Thank You + +- David Archibald + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.34.0 (2025-06-09) + +This was a version bump only for types to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.33.1 (2025-06-02) + +This was a version bump only for types to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.33.0 (2025-05-26) + +This was a version bump only for types to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + ## 8.32.1 (2025-05-12) This was a version bump only for types to align it with other projects, there were no code changes. diff --git a/packages/types/package.json b/packages/types/package.json index b64cbdeb108f..961fec65b815 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/types", - "version": "8.32.1", + "version": "8.46.4", "description": "Types for the TypeScript-ESTree AST spec", "files": [ "dist", @@ -37,45 +37,58 @@ "estree" ], "scripts": { - "copy-ast-spec": "tsx ./tools/copy-ast-spec.mts", - "build": "tsc -b tsconfig.build.json", - "clean": "tsc -b tsconfig.build.json --clean", - "postclean": "rimraf dist/ src/generated/ coverage/", - "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", - "generate-lib": "npx nx run scope-manager:generate-lib", - "lint": "npx nx lint", - "test": "vitest --run --config=$INIT_CWD/vitest.config.mts", - "check-types": "npx nx typecheck" + "build": "yarn run -BT nx build", + "clean": "rimraf dist/ src/generated/ coverage/", + "copy-ast-spec": "yarn run -BT nx copy-ast-spec", + "format": "yarn run -T format", + "generate-lib": "yarn run -BT nx generate-lib repo", + "lint": "yarn run -BT nx lint", + "test": "yarn run -BT nx test", + "typecheck": "yarn run -BT nx typecheck" + }, + "devDependencies": { + "@vitest/coverage-v8": "^3.1.3", + "eslint": "*", + "rimraf": "*", + "tsx": "*", + "typescript": "*", + "vitest": "^3.1.3" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" }, "nx": { + "name": "types", + "includedScripts": [ + "clean" + ], "targets": { + "build": { + "dependsOn": [ + "copy-ast-spec" + ] + }, "copy-ast-spec": { + "cache": false, + "command": "tsx tools/copy-ast-spec.mts", "dependsOn": [ - "^build" + "ast-spec:build" ], + "options": { + "cwd": "{projectRoot}" + }, "outputs": [ "{projectRoot}/src/generated" - ], - "cache": true + ] }, - "build": { + "lint": { + "command": "eslint", "dependsOn": [ - "^build", - "copy-ast-spec" + "typescript-eslint:build", + "eslint-plugin-internal:build" ] } } - }, - "devDependencies": { - "@vitest/coverage-v8": "^3.1.3", - "prettier": "^3.2.5", - "rimraf": "*", - "tsx": "*", - "typescript": "*", - "vitest": "^3.1.3" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" } } diff --git a/packages/types/project.json b/packages/types/project.json deleted file mode 100644 index da87602e0a30..000000000000 --- a/packages/types/project.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "types", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "projectType": "library", - "root": "packages/types", - "sourceRoot": "packages/types/src", - "implicitDependencies": ["ast-spec"], - "targets": { - "lint": { - "executor": "@nx/eslint:lint", - "outputs": ["{options.outputFile}"] - } - } -} diff --git a/packages/types/src/lib.ts b/packages/types/src/lib.ts index 73ca1fe943fc..d68fd407c1d4 100644 --- a/packages/types/src/lib.ts +++ b/packages/types/src/lib.ts @@ -94,6 +94,7 @@ export type Lib = | 'esnext.collection' | 'esnext.decorators' | 'esnext.disposable' + | 'esnext.error' | 'esnext.float16' | 'esnext.full' | 'esnext.intl' @@ -101,6 +102,7 @@ export type Lib = | 'esnext.object' | 'esnext.promise' | 'esnext.regexp' + | 'esnext.sharedmemory' | 'esnext.string' | 'esnext.symbol' | 'esnext.weakref' diff --git a/packages/types/src/parser-options.ts b/packages/types/src/parser-options.ts index 6cf485d9653f..c9ed6b106d3d 100644 --- a/packages/types/src/parser-options.ts +++ b/packages/types/src/parser-options.ts @@ -8,7 +8,6 @@ export type DebugLevel = export type CacheDurationSeconds = number | 'Infinity'; export type EcmaVersion = - | 'latest' | 3 | 5 | 6 @@ -22,6 +21,7 @@ export type EcmaVersion = | 14 | 15 | 16 + | 17 | 2015 | 2016 | 2017 @@ -33,6 +33,8 @@ export type EcmaVersion = | 2023 | 2024 | 2025 + | 2026 + | 'latest' | undefined; export type SourceTypeClassic = 'module' | 'script'; diff --git a/packages/types/src/ts-estree.ts b/packages/types/src/ts-estree.ts index b1a5928a5d2b..33092006c987 100644 --- a/packages/types/src/ts-estree.ts +++ b/packages/types/src/ts-estree.ts @@ -194,10 +194,7 @@ declare module './generated/ast-spec' { parent: TSESTree.TSEnumDeclaration; } - interface TSEnumMemberComputedName { - parent: TSESTree.TSEnumBody; - } - interface TSEnumMemberNonComputedName { + interface TSEnumMember { parent: TSESTree.TSEnumBody; } @@ -254,3 +251,4 @@ declare module './generated/ast-spec' { } export * as TSESTree from './generated/ast-spec'; +export type NodeWithParent = Exclude; diff --git a/packages/types/tools/copy-ast-spec.mts b/packages/types/tools/copy-ast-spec.mts index f3ab39fdba7d..110a92854422 100644 --- a/packages/types/tools/copy-ast-spec.mts +++ b/packages/types/tools/copy-ast-spec.mts @@ -72,18 +72,11 @@ async function copyFile( console.log('Copied', fileName); } -async function main(): Promise { - if (process.env.SKIP_AST_SPEC_REBUILD) { - // ensure the package is built - await execAsync('yarn', ['build'], { cwd: AST_SPEC_PATH }); - } - - await copyFile('dist', 'ast-spec.ts', code => - code.replaceAll('export declare enum', 'export enum'), - ); +if (process.env.SKIP_AST_SPEC_REBUILD) { + // ensure the package is built + await execAsync('yarn', ['build'], { cwd: AST_SPEC_PATH }); } -main().catch((error: unknown) => { - console.error(error); - process.exitCode = 1; -}); +await copyFile('dist', 'ast-spec.ts', code => + code.replaceAll('export declare enum', 'export enum'), +); diff --git a/packages/typescript-eslint/CHANGELOG.md b/packages/typescript-eslint/CHANGELOG.md index 1212ca5a6fad..f26f3626d103 100644 --- a/packages/typescript-eslint/CHANGELOG.md +++ b/packages/typescript-eslint/CHANGELOG.md @@ -1,3 +1,200 @@ +## 8.46.4 (2025-11-10) + +This was a version bump only for typescript-eslint to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.3 (2025-11-03) + +This was a version bump only for typescript-eslint to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.2 (2025-10-20) + +This was a version bump only for typescript-eslint to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.1 (2025-10-13) + +This was a version bump only for typescript-eslint to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.0 (2025-10-06) + +### 🚀 Features + +- **typescript-eslint:** export util types ([#10848](https://github.com/typescript-eslint/typescript-eslint/pull/10848), [#10849](https://github.com/typescript-eslint/typescript-eslint/pull/10849)) + +### ❤️ Thank You + +- Mister-Hope @Mister-Hope + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.45.0 (2025-09-29) + +This was a version bump only for typescript-eslint to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.44.1 (2025-09-22) + +This was a version bump only for typescript-eslint to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.44.0 (2025-09-15) + +This was a version bump only for typescript-eslint to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.43.0 (2025-09-08) + +### 🩹 Fixes + +- **eslint-plugin:** [no-deprecated] should report deprecated exports and reexports ([#11359](https://github.com/typescript-eslint/typescript-eslint/pull/11359)) + +### ❤️ Thank You + +- Victor Genaev @mainframev + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.42.0 (2025-09-02) + +### 🚀 Features + +- deprecate tseslint.config() ([#11531](https://github.com/typescript-eslint/typescript-eslint/pull/11531)) + +### 🩹 Fixes + +- **typescript-eslint:** handle non-normalized windows paths produced by jiti ([#11546](https://github.com/typescript-eslint/typescript-eslint/pull/11546)) + +### ❤️ Thank You + +- Kirk Waiblinger @kirkwaiblinger + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.41.0 (2025-08-25) + +This was a version bump only for typescript-eslint to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.40.0 (2025-08-18) + +### 🩹 Fixes + +- **typescript-eslint:** export `plugin`, `parser`, and `configs` that are compatible with both `defineConfig()` and `tseslint.config()` ([#11475](https://github.com/typescript-eslint/typescript-eslint/pull/11475)) + +### ❤️ Thank You + +- Kirk Waiblinger @kirkwaiblinger + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.39.1 (2025-08-11) + +### 🩹 Fixes + +- **typescript-eslint:** handle `file://` urls in stack trace when inferring `tsconfigRootDir` ([#11464](https://github.com/typescript-eslint/typescript-eslint/pull/11464)) + +### ❤️ Thank You + +- Kirk Waiblinger @kirkwaiblinger + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.39.0 (2025-08-04) + +### 🚀 Features + +- update to TypeScript 5.9.2 ([#11445](https://github.com/typescript-eslint/typescript-eslint/pull/11445)) + +### ❤️ Thank You + +- Brad Zacher @bradzacher + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.38.0 (2025-07-21) + +### 🩹 Fixes + +- **typescript-eslint:** error on nested `extends` in `tseslint.config()` ([#11361](https://github.com/typescript-eslint/typescript-eslint/pull/11361)) +- **typescript-eslint:** infer tsconfigRootDir with v8 API ([#11412](https://github.com/typescript-eslint/typescript-eslint/pull/11412)) + +### ❤️ Thank You + +- Kirk Waiblinger @kirkwaiblinger + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.37.0 (2025-07-14) + +### 🚀 Features + +- **typescript-estree:** infer tsconfigRootDir from call stack ([#11370](https://github.com/typescript-eslint/typescript-eslint/pull/11370)) + +### ❤️ Thank You + +- Josh Goldberg ✨ + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.36.0 (2025-07-07) + +### 🚀 Features + +- **typescript-eslint:** support `basePath` in `tseslint.config()` ([#11357](https://github.com/typescript-eslint/typescript-eslint/pull/11357)) + +### ❤️ Thank You + +- Kirk Waiblinger @kirkwaiblinger + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.35.1 (2025-06-30) + +This was a version bump only for typescript-eslint to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.35.0 (2025-06-23) + +This was a version bump only for typescript-eslint to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.34.1 (2025-06-16) + +This was a version bump only for typescript-eslint to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.34.0 (2025-06-09) + +This was a version bump only for typescript-eslint to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.33.1 (2025-06-02) + +This was a version bump only for typescript-eslint to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.33.0 (2025-05-26) + +This was a version bump only for typescript-eslint to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + ## 8.32.1 (2025-05-12) This was a version bump only for typescript-eslint to align it with other projects, there were no code changes. diff --git a/packages/typescript-eslint/package.json b/packages/typescript-eslint/package.json index e59a531f543a..ff1414887fc1 100644 --- a/packages/typescript-eslint/package.json +++ b/packages/typescript-eslint/package.json @@ -1,6 +1,6 @@ { "name": "typescript-eslint", - "version": "8.32.1", + "version": "8.46.4", "description": "Tooling which enables you to use TypeScript with ESLint", "files": [ "dist", @@ -42,26 +42,26 @@ "eslint-plugin" ], "scripts": { - "build": "tsc -b tsconfig.build.json", - "clean": "tsc -b tsconfig.build.json --clean", - "postclean": "rimraf dist/ coverage/", - "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", - "lint": "nx lint", - "test": "vitest --run --config=$INIT_CWD/vitest.config.mts", - "check-types": "npx nx typecheck" + "build": "yarn run -BT nx build", + "clean": "rimraf dist/ coverage/", + "format": "yarn run -T format", + "lint": "yarn run -BT nx lint", + "test": "yarn run -BT nx test", + "typecheck": "yarn run -BT nx typecheck" }, "dependencies": { - "@typescript-eslint/eslint-plugin": "8.32.1", - "@typescript-eslint/parser": "8.32.1", - "@typescript-eslint/utils": "8.32.1" + "@typescript-eslint/eslint-plugin": "8.46.4", + "@typescript-eslint/parser": "8.46.4", + "@typescript-eslint/typescript-estree": "8.46.4", + "@typescript-eslint/utils": "8.46.4" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0", - "typescript": ">=4.8.4 <5.9.0" + "typescript": ">=4.8.4 <6.0.0" }, "devDependencies": { "@vitest/coverage-v8": "^3.1.3", - "prettier": "^3.2.5", + "eslint": "*", "rimraf": "*", "typescript": "*", "vitest": "^3.1.3" @@ -69,5 +69,28 @@ "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" + }, + "nx": { + "name": "typescript-eslint", + "includedScripts": [ + "clean" + ], + "targets": { + "lint": { + "command": "eslint" + }, + "typecheck": { + "outputs": [ + "{workspaceRoot}/dist", + "{projectRoot}/dist" + ] + }, + "test": { + "dependsOn": [ + "^build", + "typecheck" + ] + } + } } } diff --git a/packages/typescript-eslint/project.json b/packages/typescript-eslint/project.json deleted file mode 100644 index 121581ef2b13..000000000000 --- a/packages/typescript-eslint/project.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "typescript-eslint", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "projectType": "library", - "root": "packages/typescript-eslint", - "sourceRoot": "packages/typescript-eslint/src", - "targets": { - "lint": { - "executor": "@nx/eslint:lint", - "outputs": ["{options.outputFile}"] - }, - "test": { - "executor": "@nx/vite:test" - } - } -} diff --git a/packages/typescript-eslint/src/compatibility-types.ts b/packages/typescript-eslint/src/compatibility-types.ts new file mode 100644 index 000000000000..10357e93accf --- /dev/null +++ b/packages/typescript-eslint/src/compatibility-types.ts @@ -0,0 +1,25 @@ +/* + * This file contains types that are intentionally wide/inaccurate, that exist + * for the purpose of satisfying both `defineConfig()` and `tseslint.config()`. + * See https://github.com/typescript-eslint/typescript-eslint/issues/10899 + */ + +export interface CompatibleParser { + parseForESLint(text: string): { + ast: unknown; + scopeManager: unknown; + }; +} + +export interface CompatibleConfig { + name?: string; + rules?: object; +} + +export type CompatibleConfigArray = CompatibleConfig[]; + +export interface CompatiblePlugin { + meta: { + name: string; + }; +} diff --git a/packages/typescript-eslint/src/config-helper.ts b/packages/typescript-eslint/src/config-helper.ts index ce5d4ea806ed..758052c62f56 100644 --- a/packages/typescript-eslint/src/config-helper.ts +++ b/packages/typescript-eslint/src/config-helper.ts @@ -88,6 +88,9 @@ export type ConfigArray = TSESLint.FlatConfig.ConfigArray; * }, * ); * ``` + * + * @deprecated ESLint core now provides this functionality via `defineConfig()`, + * which we now recommend instead. See {@link https://typescript-eslint.io/packages/typescript-eslint/#config-deprecated}. */ export function config( ...configs: InfiniteDepthConfigWithExtends[] @@ -120,6 +123,7 @@ function configImpl(...configs: unknown[]): ConfigArray { extends?: unknown; files?: unknown; ignores?: unknown; + basePath?: unknown; }; if (extendsArr == null) { @@ -163,11 +167,27 @@ function configImpl(...configs: unknown[]): ConfigArray { } if (extension == null || typeof extension !== 'object') { nonObjectExtensions.push(extensionIndex); + continue; + } + + // https://github.com/eslint/rewrite/blob/82d07fd0e8e06780b552a41f8bcbe2a4f8741d42/packages/config-helpers/src/define-config.js#L448-L450 + if ('basePath' in extension) { + throw new TypeError( + `tseslint.config(): Config at index ${configIndex}${nameErrorPhrase} has an 'extends' array that contains a config with a 'basePath' property at index ${extensionIndex}.` + + ` 'basePath' in 'extends' is not allowed.`, + ); + } + + if ('extends' in extension) { + throw new TypeError( + `tseslint.config(): Config at index ${configIndex}${nameErrorPhrase} has an 'extends' array that contains a config with an 'extends' property at index ${extensionIndex}.` + + ` Nested 'extends' is not allowed.`, + ); } } if (nonObjectExtensions.length > 0) { const extensionIndices = nonObjectExtensions.join(', '); - throw new Error( + throw new TypeError( `tseslint.config(): Config at index ${configIndex}${nameErrorPhrase} contains non-object` + ` extensions at the following indices: ${extensionIndices}.`, ); @@ -181,6 +201,7 @@ function configImpl(...configs: unknown[]): ConfigArray { files?: unknown; ignores?: unknown; }; + const resolvedConfigName = [name, extension.name] .filter(Boolean) .join('__'); @@ -195,6 +216,7 @@ function configImpl(...configs: unknown[]): ConfigArray { ...extension, ...(config.files ? { files: config.files } : {}), ...(config.ignores ? { ignores: config.ignores } : {}), + ...(config.basePath ? { basePath: config.basePath } : {}), ...(resolvedConfigName !== '' ? { name: resolvedConfigName } : {}), }); } @@ -218,5 +240,7 @@ function configImpl(...configs: unknown[]): ConfigArray { * the return value can still be true. */ function isPossiblyGlobalIgnores(config: object): boolean { - return Object.keys(config).every(key => ['name', 'ignores'].includes(key)); + return Object.keys(config).every(key => + ['name', 'ignores', 'basePath'].includes(key), + ); } diff --git a/packages/typescript-eslint/src/getTSConfigRootDirFromStack.ts b/packages/typescript-eslint/src/getTSConfigRootDirFromStack.ts new file mode 100644 index 000000000000..7e3da09e4ec5 --- /dev/null +++ b/packages/typescript-eslint/src/getTSConfigRootDirFromStack.ts @@ -0,0 +1,54 @@ +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; + +/** + * Infers the `tsconfigRootDir` from the current call stack, using the V8 API. + * + * See https://v8.dev/docs/stack-trace-api + * + * This API is implemented in Deno and Bun as well. + */ +export function getTSConfigRootDirFromStack(): string | undefined { + function getStack(): NodeJS.CallSite[] { + const stackTraceLimit = Error.stackTraceLimit; + Error.stackTraceLimit = Infinity; + const prepareStackTrace = Error.prepareStackTrace; + Error.prepareStackTrace = (_, structuredStackTrace) => structuredStackTrace; + + const dummyObject: { stack?: NodeJS.CallSite[] } = {}; + Error.captureStackTrace(dummyObject, getTSConfigRootDirFromStack); + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- stack is set by captureStackTrace + const rv = dummyObject.stack!; + + Error.prepareStackTrace = prepareStackTrace; + Error.stackTraceLimit = stackTraceLimit; + + return rv; + } + + for (const callSite of getStack()) { + const stackFrameFilePathOrUrl = callSite.getFileName(); + if (!stackFrameFilePathOrUrl) { + continue; + } + + // ESM seem to return a file URL, so we'll convert it to a file path. + // AFAICT this isn't documented in the v8 API docs, but it seems to be the case. + // See https://github.com/typescript-eslint/typescript-eslint/issues/11429 + const stackFrameFilePath = stackFrameFilePathOrUrl.startsWith('file://') + ? fileURLToPath(stackFrameFilePathOrUrl) + : stackFrameFilePathOrUrl; + + const parsedPath = path.parse(stackFrameFilePath); + if (/^eslint\.config\.(c|m)?(j|t)s$/.test(parsedPath.base)) { + if (process.platform === 'win32') { + // workaround for https://github.com/typescript-eslint/typescript-eslint/issues/11530 + // (caused by https://github.com/unjs/jiti/issues/397) + return parsedPath.dir.replaceAll('/', path.sep); + } + return parsedPath.dir; + } + } + + return undefined; +} diff --git a/packages/typescript-eslint/src/index.ts b/packages/typescript-eslint/src/index.ts index 86870c855cd0..04ec5b3094cc 100644 --- a/packages/typescript-eslint/src/index.ts +++ b/packages/typescript-eslint/src/index.ts @@ -1,12 +1,25 @@ // see the comment in config-helper.ts for why this doesn't use /ts-eslint import type { TSESLint } from '@typescript-eslint/utils'; +import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint'; import pluginBase from '@typescript-eslint/eslint-plugin'; import rawPlugin from '@typescript-eslint/eslint-plugin/use-at-your-own-risk/raw-plugin'; +import { addCandidateTSConfigRootDir } from '@typescript-eslint/typescript-estree'; + +import type { + CompatibleConfig, + CompatibleConfigArray, + CompatibleParser, + CompatiblePlugin, +} from './compatibility-types'; import { config } from './config-helper'; +import { getTSConfigRootDirFromStack } from './getTSConfigRootDirFromStack'; + +export type { FlatConfig } from '@typescript-eslint/utils/ts-eslint'; -export const parser: TSESLint.FlatConfig.Parser = rawPlugin.parser; +export const parser: CompatibleParser = + rawPlugin.parser as CompatibleParser satisfies FlatConfig.Parser; /* we could build a plugin object here without the `configs` key - but if we do @@ -17,7 +30,7 @@ require('typescript-eslint').plugin !== require('@typescript-eslint/eslint-plugi This is bad because it means that 3rd party configs would be required to use `typescript-eslint` or else they would break a user's config if the user either -used `tseslint.configs.recomended` et al or +used `tseslint.configs.recommended` et al or ``` { plugins: { @@ -31,30 +44,30 @@ use our new package); however legacy configs consumed via `@eslint/eslintrc` would never be able to satisfy this constraint and thus users would be blocked from using them. */ -export const plugin: TSESLint.FlatConfig.Plugin = pluginBase as Omit< - typeof pluginBase, - 'configs' ->; +export const plugin: CompatiblePlugin = + pluginBase satisfies FlatConfig.Plugins['string']; -export const configs = { +export const configs = createConfigsGetters({ /** * Enables each the rules provided as a part of typescript-eslint. Note that many rules are not applicable in all codebases, or are meant to be configured. * @see {@link https://typescript-eslint.io/users/configs#all} */ - all: rawPlugin.flatConfigs['flat/all'], + all: rawPlugin.flatConfigs['flat/all'] as CompatibleConfigArray, /** * A minimal ruleset that sets only the required parser and plugin options needed to run typescript-eslint. * We don't recommend using this directly; instead, extend from an earlier recommended rule. * @see {@link https://typescript-eslint.io/users/configs#base} */ - base: rawPlugin.flatConfigs['flat/base'], + base: rawPlugin.flatConfigs['flat/base'] as CompatibleConfig, /** * A utility ruleset that will disable type-aware linting and all type-aware rules available in our project. * @see {@link https://typescript-eslint.io/users/configs#disable-type-checked} */ - disableTypeChecked: rawPlugin.flatConfigs['flat/disable-type-checked'], + disableTypeChecked: rawPlugin.flatConfigs[ + 'flat/disable-type-checked' + ] as CompatibleConfig, /** * This is a compatibility ruleset that: @@ -62,65 +75,104 @@ export const configs = { * - enables rules that make sense due to TS's typechecking / transpilation. * @see {@link https://typescript-eslint.io/users/configs/#eslint-recommended} */ - eslintRecommended: rawPlugin.flatConfigs['flat/eslint-recommended'], + eslintRecommended: rawPlugin.flatConfigs[ + 'flat/eslint-recommended' + ] as CompatibleConfig, /** * Recommended rules for code correctness that you can drop in without additional configuration. * @see {@link https://typescript-eslint.io/users/configs#recommended} */ - recommended: rawPlugin.flatConfigs['flat/recommended'], + recommended: rawPlugin.flatConfigs[ + 'flat/recommended' + ] as CompatibleConfigArray, /** * Contains all of `recommended` along with additional recommended rules that require type information. * @see {@link https://typescript-eslint.io/users/configs#recommended-type-checked} */ - recommendedTypeChecked: - rawPlugin.flatConfigs['flat/recommended-type-checked'], + recommendedTypeChecked: rawPlugin.flatConfigs[ + 'flat/recommended-type-checked' + ] as CompatibleConfigArray, /** * A version of `recommended` that only contains type-checked rules and disables of any corresponding core ESLint rules. * @see {@link https://typescript-eslint.io/users/configs#recommended-type-checked-only} */ - recommendedTypeCheckedOnly: - rawPlugin.flatConfigs['flat/recommended-type-checked-only'], + recommendedTypeCheckedOnly: rawPlugin.flatConfigs[ + 'flat/recommended-type-checked-only' + ] as CompatibleConfigArray, /** * Contains all of `recommended`, as well as additional strict rules that can also catch bugs. * @see {@link https://typescript-eslint.io/users/configs#strict} */ - strict: rawPlugin.flatConfigs['flat/strict'], + strict: rawPlugin.flatConfigs['flat/strict'] as CompatibleConfigArray, /** * Contains all of `recommended`, `recommended-type-checked`, and `strict`, along with additional strict rules that require type information. * @see {@link https://typescript-eslint.io/users/configs#strict-type-checked} */ - strictTypeChecked: rawPlugin.flatConfigs['flat/strict-type-checked'], + strictTypeChecked: rawPlugin.flatConfigs[ + 'flat/strict-type-checked' + ] as CompatibleConfigArray, /** * A version of `strict` that only contains type-checked rules and disables of any corresponding core ESLint rules. * @see {@link https://typescript-eslint.io/users/configs#strict-type-checked-only} */ - strictTypeCheckedOnly: rawPlugin.flatConfigs['flat/strict-type-checked-only'], + strictTypeCheckedOnly: rawPlugin.flatConfigs[ + 'flat/strict-type-checked-only' + ] as CompatibleConfigArray, /** * Rules considered to be best practice for modern TypeScript codebases, but that do not impact program logic. * @see {@link https://typescript-eslint.io/users/configs#stylistic} */ - stylistic: rawPlugin.flatConfigs['flat/stylistic'], + stylistic: rawPlugin.flatConfigs['flat/stylistic'] as CompatibleConfigArray, /** * Contains all of `stylistic`, along with additional stylistic rules that require type information. * @see {@link https://typescript-eslint.io/users/configs#stylistic-type-checked} */ - stylisticTypeChecked: rawPlugin.flatConfigs['flat/stylistic-type-checked'], + stylisticTypeChecked: rawPlugin.flatConfigs[ + 'flat/stylistic-type-checked' + ] as CompatibleConfigArray, /** * A version of `stylistic` that only contains type-checked rules and disables of any corresponding core ESLint rules. * @see {@link https://typescript-eslint.io/users/configs#stylistic-type-checked-only} */ - stylisticTypeCheckedOnly: - rawPlugin.flatConfigs['flat/stylistic-type-checked-only'], -}; + stylisticTypeCheckedOnly: rawPlugin.flatConfigs[ + 'flat/stylistic-type-checked-only' + ] as CompatibleConfigArray, +}) satisfies Record; + +function createConfigsGetters(values: T): T { + const configs = {}; + + Object.defineProperties( + configs, + Object.fromEntries( + Object.entries(values).map(([key, value]: [string, unknown]) => [ + key, + { + enumerable: true, + get: () => { + const candidateRootDir = getTSConfigRootDirFromStack(); + if (candidateRootDir) { + addCandidateTSConfigRootDir(candidateRootDir); + } + + return value; + }, + }, + ]), + ), + ); + + return configs as T; +} export type Config = TSESLint.FlatConfig.ConfigFile; @@ -173,6 +225,7 @@ export default { }; export { + // eslint-disable-next-line @typescript-eslint/no-deprecated config, type ConfigWithExtends, type InfiniteDepthConfigWithExtends, diff --git a/packages/typescript-eslint/tests/config-helper.test.ts b/packages/typescript-eslint/tests/config-helper.test.ts index 2def1d4256c4..7b3288df295f 100644 --- a/packages/typescript-eslint/tests/config-helper.test.ts +++ b/packages/typescript-eslint/tests/config-helper.test.ts @@ -1,6 +1,8 @@ import type { TSESLint } from '@typescript-eslint/utils'; -import tseslint from '../src/index'; +import tseslint from '../src/index.js'; + +/* eslint @typescript-eslint/no-deprecated: ["error", { "allow": [{ "from": "file", "name": "config", "path": "packages/typescript-eslint/src/config-helper.ts" }] }] */ describe('config helper', () => { it('works without extends', () => { @@ -10,7 +12,7 @@ describe('config helper', () => { ignores: ['ignored'], rules: { rule: 'error' }, }), - ).toEqual([ + ).toStrictEqual([ { files: ['file'], ignores: ['ignored'], @@ -25,7 +27,7 @@ describe('config helper', () => { extends: [{ rules: { rule1: 'error' } }, { rules: { rule2: 'error' } }], rules: { rule: 'error' }, }), - ).toEqual([ + ).toStrictEqual([ { rules: { rule1: 'error' } }, { rules: { rule2: 'error' } }, { rules: { rule: 'error' } }, @@ -40,7 +42,7 @@ describe('config helper', () => { ignores: ['common-ignored'], rules: { rule: 'error' }, }), - ).toEqual([ + ).toStrictEqual([ { files: ['common-file'], ignores: ['common-ignored'], @@ -62,7 +64,7 @@ describe('config helper', () => { it('throws error containing config name when some extensions are undefined', () => { const extension: TSESLint.FlatConfig.Config = { rules: { rule1: 'error' } }; - expect(() => + expect(() => { tseslint.config( { extends: [extension], @@ -79,8 +81,8 @@ describe('config helper', () => { name: 'my-config-2', rules: { rule: 'error' }, }, - ), - ).toThrow( + ); + }).toThrow( 'tseslint.config(): Config at index 1, named "my-config-2", contains non-object ' + 'extensions at the following indices: 0, 2', ); @@ -89,7 +91,7 @@ describe('config helper', () => { it('throws error without config name when some extensions are undefined', () => { const extension: TSESLint.FlatConfig.Config = { rules: { rule1: 'error' } }; - expect(() => + expect(() => { tseslint.config( { extends: [extension], @@ -105,8 +107,8 @@ describe('config helper', () => { ignores: ['common-ignored'], rules: { rule: 'error' }, }, - ), - ).toThrow( + ); + }).toThrow( 'tseslint.config(): Config at index 1 (anonymous) contains non-object extensions at ' + 'the following indices: 0, 2', ); @@ -121,7 +123,7 @@ describe('config helper', () => { name: 'my-config', rules: { rule: 'error' }, }), - ).toEqual([ + ).toStrictEqual([ { files: ['common-file'], ignores: ['common-ignored'], @@ -154,7 +156,7 @@ describe('config helper', () => { ignores: ['common-ignored'], rules: { rule: 'error' }, }), - ).toEqual([ + ).toStrictEqual([ { files: ['common-file'], ignores: ['common-ignored'], @@ -186,7 +188,7 @@ describe('config helper', () => { name: 'my-config', rules: { rule: 'error' }, }), - ).toEqual([ + ).toStrictEqual([ { files: ['common-file'], ignores: ['common-ignored'], @@ -217,7 +219,7 @@ describe('config helper', () => { [[[{ rules: { rule4: 'error' } }]]], [[[[{ rules: { rule5: 'error' } }]]]], ), - ).toEqual([ + ).toStrictEqual([ { rules: { rule1: 'error' } }, { rules: { rule2: 'error' } }, { rules: { rule3: 'error' } }, @@ -238,7 +240,7 @@ describe('config helper', () => { ], rules: { rule: 'error' }, }), - ).toEqual([ + ).toStrictEqual([ { rules: { rule1: 'error' } }, { rules: { rule2: 'error' } }, { rules: { rule3: 'error' } }, @@ -254,7 +256,7 @@ describe('config helper', () => { ignores: ['ignored'], }); - expect(configWithIgnores).toEqual([ + expect(configWithIgnores).toStrictEqual([ { ignores: ['ignored'], rules: { rule1: 'error' } }, { ignores: ['ignored'], rules: { rule2: 'error' } }, ]); @@ -272,7 +274,7 @@ describe('config helper', () => { name: 'my-config', }); - expect(configWithMetadata).toEqual([ + expect(configWithMetadata).toStrictEqual([ { files: ['file'], ignores: ['ignored'], @@ -301,7 +303,7 @@ describe('config helper', () => { extends: [{ rules: { rule1: 'error' } }, {}], ignores: ['ignored'], }), - ).toEqual([ + ).toStrictEqual([ { ignores: ['ignored'], rules: { rule1: 'error' } }, // Should not create global ignores {}, @@ -314,23 +316,23 @@ describe('config helper', () => { extends: [{ ignores: ['files/**/*'], name: 'global-ignore-stuff' }], ignores: ['ignored'], }), - ).toEqual([{ ignores: ['files/**/*'], name: 'global-ignore-stuff' }]); + ).toStrictEqual([{ ignores: ['files/**/*'], name: 'global-ignore-stuff' }]); }); it('throws error when extends is not an array', () => { - expect(() => + expect(() => { tseslint.config({ // @ts-expect-error purposely testing invalid values extends: 42, - }), - ).toThrow( + }); + }).toThrow( "tseslint.config(): Config at index 0 (anonymous) has an 'extends' property that is not an array.", ); }); - it.each([undefined, null, 'not a config object', 42])( + it.for([[undefined], [null], ['not a config object'], [42]] as const)( 'passes invalid arguments through unchanged', - config => { + ([config], { expect }) => { expect( tseslint.config( // @ts-expect-error purposely testing invalid values @@ -341,12 +343,12 @@ describe('config helper', () => { ); it('gives a special error message for string extends', () => { - expect(() => + expect(() => { tseslint.config({ // @ts-expect-error purposely testing invalid values extends: ['some-string'], - }), - ).toThrow( + }); + }).toThrow( 'tseslint.config(): Config at index 0 (anonymous) has an \'extends\' array that contains a string ("some-string") at index 0. ' + "This is a feature of eslint's `defineConfig()` helper and is not supported by typescript-eslint. " + 'Please provide a config object instead.', @@ -360,18 +362,75 @@ describe('config helper', () => { extends: null, files: ['files'], }), - ).toEqual([{ files: ['files'] }]); + ).toStrictEqual([{ files: ['files'] }]); }); it('complains when given an object with an invalid name', () => { - expect(() => + expect(() => { tseslint.config({ extends: [], // @ts-expect-error purposely testing invalid values name: 42, - }), - ).toThrow( + }); + }).toThrow( "tseslint.config(): Config at index 0 has a 'name' property that is not a string.", ); }); + + it('basePath works with unextended config', () => { + expect( + tseslint.config({ + basePath: 'base/path', + rules: { rule1: 'error' }, + }), + ).toStrictEqual([ + { + basePath: 'base/path', + rules: { rule1: 'error' }, + }, + ]); + }); + + it('basePath works with extended config', () => { + expect( + tseslint.config({ + basePath: 'base/path', + extends: [{ rules: { rule1: 'error' } }, { rules: { rule2: 'error' } }], + }), + ).toStrictEqual([ + { + basePath: 'base/path', + rules: { rule1: 'error' }, + }, + { + basePath: 'base/path', + rules: { rule2: 'error' }, + }, + ]); + }); + + it('basePath cannot be used in an extension', () => { + expect(() => { + tseslint.config({ + extends: [{ basePath: 'base/path', rules: { rule1: 'error' } }], + }); + }).toThrow( + "tseslint.config(): Config at index 0 (anonymous) has an 'extends' array that contains a config with a 'basePath' property at index 0. 'basePath' in 'extends' is not allowed.", + ); + }); + + it('should error when trying to use nested extends', () => { + expect(() => { + tseslint.config({ + extends: [ + { + extends: [ + { rules: { rule1: 'error' } }, + { rules: { rule2: 'error' } }, + ], + }, + ], + }); + }).toThrow(); + }); }); diff --git a/packages/typescript-eslint/tests/configs.test.ts b/packages/typescript-eslint/tests/configs.test.ts index 3be135ea1e57..cac7e4f46bd6 100644 --- a/packages/typescript-eslint/tests/configs.test.ts +++ b/packages/typescript-eslint/tests/configs.test.ts @@ -4,8 +4,24 @@ import type { } from '@typescript-eslint/utils/ts-eslint'; import rules from '@typescript-eslint/eslint-plugin/use-at-your-own-risk/rules'; +import { clearCandidateTSConfigRootDirs } from '@typescript-eslint/typescript-estree'; -import tseslint from '../src/index'; +import tseslint from '../src/index.js'; + +vi.mock('@typescript-eslint/typescript-estree', async () => ({ + ...(await vi.importActual('@typescript-eslint/typescript-estree')), + get addCandidateTSConfigRootDir() { + return mockAddCandidateTSConfigRootDir; + }, +})); + +const mockGetTSConfigRootDirFromStack = vi.fn(); + +vi.mock('../src/getTSConfigRootDirFromStack', () => ({ + get getTSConfigRootDirFromStack() { + return mockGetTSConfigRootDirFromStack; + }, +})); const RULE_NAME_PREFIX = '@typescript-eslint/'; const EXTENSION_RULES = Object.entries(rules) @@ -23,8 +39,9 @@ const EXTENSION_RULES = Object.entries(rules) function filterRules( values: FlatConfig.Rules | undefined, ): [string, FlatConfig.RuleEntry][] { - expect(values).toBeDefined(); - return Object.entries(values!) + assert.isDefined(values); + + return Object.entries(values) .filter((pair): pair is [string, FlatConfig.RuleEntry] => pair[1] != null) .filter(([name]) => name.startsWith(RULE_NAME_PREFIX)); } @@ -88,227 +105,331 @@ function filterAndMapRuleConfigs({ }); } -function itHasBaseRulesOverriden( - unfilteredConfigRules: FlatConfig.Rules | undefined, -): void { - it('has the base rules overriden by the appropriate extension rules', () => { - expect(unfilteredConfigRules).toBeDefined(); - const ruleNames = new Set(Object.keys(unfilteredConfigRules!)); - EXTENSION_RULES.forEach(([ruleName, extRuleName]) => { - if (ruleNames.has(ruleName)) { - // this looks a little weird, but it provides the cleanest test output style - expect(unfilteredConfigRules).toMatchObject({ - ...unfilteredConfigRules, - [extRuleName]: 'off', - }); - } - }); - }); -} +const localTest = test.extend<{ + unfilteredConfigRules: FlatConfig.Rules | undefined; + expectedOverrides: Record; + configRulesObject: Record; +}>({ + configRulesObject: [ + async ({ unfilteredConfigRules }, use) => { + const configRules = filterRules(unfilteredConfigRules); -describe('all.ts', () => { - const unfilteredConfigRules = tseslint.configs.all[2]?.rules; + const configRulesObject = Object.fromEntries(configRules); + + await use(configRulesObject); + }, + { auto: false }, + ], + + expectedOverrides: [ + async ({ unfilteredConfigRules }, use) => { + assert.isDefined(unfilteredConfigRules); + + const ruleNames = new Set(Object.keys(unfilteredConfigRules)); + + const expectedOverrides = Object.fromEntries( + EXTENSION_RULES.filter(([ruleName]) => ruleNames.has(ruleName)).map( + ([, extRuleName]) => [extRuleName, 'off'] as const, + ), + ); - it('contains all of the rules', () => { - const configRules = filterRules(unfilteredConfigRules); + await use(expectedOverrides); + }, + { auto: false }, + ], + + unfilteredConfigRules: [tseslint.configs.all[2]?.rules, { auto: true }], +}); + +describe('all.ts', () => { + localTest('contains all of the rules', ({ configRulesObject }) => { // note: exclude deprecated rules, this config is allowed to change between minor versions const ruleConfigs = filterAndMapRuleConfigs({ excludeDeprecated: true, }); - expect(Object.fromEntries(ruleConfigs)).toEqual( - Object.fromEntries(configRules), - ); + expect(Object.fromEntries(ruleConfigs)).toStrictEqual(configRulesObject); }); - itHasBaseRulesOverriden(unfilteredConfigRules); + localTest( + 'has the base rules overridden by the appropriate extension rules', + ({ expectedOverrides, unfilteredConfigRules }) => { + expect(unfilteredConfigRules).toMatchObject(expectedOverrides); + }, + ); }); describe('disable-type-checked.ts', () => { - const unfilteredConfigRules = tseslint.configs.disableTypeChecked.rules; - - it('disables all type checked rules', () => { - const configRules = filterRules(unfilteredConfigRules); + localTest.scoped({ + unfilteredConfigRules: tseslint.configs.disableTypeChecked.rules, + }); - const ruleConfigs: [string, string][] = Object.entries(rules) + localTest('disables all type checked rules', ({ configRulesObject }) => { + const ruleConfigs = Object.entries(rules) .filter(([, rule]) => rule.meta.docs.requiresTypeChecking) - .map(([name]) => [`${RULE_NAME_PREFIX}${name}`, 'off']); + .map(([name]) => [`${RULE_NAME_PREFIX}${name}`, 'off'] as const); - expect(Object.fromEntries(ruleConfigs)).toEqual( - Object.fromEntries(configRules), - ); + expect(Object.fromEntries(ruleConfigs)).toStrictEqual(configRulesObject); }); }); describe('recommended.ts', () => { - const unfilteredConfigRules = tseslint.configs.recommended[2]?.rules; - - it('contains all recommended rules, excluding type checked ones', () => { - const configRules = filterRules(unfilteredConfigRules); - // note: include deprecated rules so that the config doesn't change between major bumps - const ruleConfigs = filterAndMapRuleConfigs({ - recommendations: ['recommended'], - typeChecked: 'exclude', - }); - - expect(Object.fromEntries(ruleConfigs)).toEqual( - Object.fromEntries(configRules), - ); + localTest.scoped({ + unfilteredConfigRules: tseslint.configs.recommended[2]?.rules, }); - itHasBaseRulesOverriden(unfilteredConfigRules); + localTest( + 'contains all recommended rules, excluding type checked ones', + ({ configRulesObject }) => { + // note: include deprecated rules so that the config doesn't change between major bumps + const ruleConfigs = filterAndMapRuleConfigs({ + recommendations: ['recommended'], + typeChecked: 'exclude', + }); + + expect(Object.fromEntries(ruleConfigs)).toStrictEqual(configRulesObject); + }, + ); + + localTest( + 'has the base rules overridden by the appropriate extension rules', + ({ expectedOverrides, unfilteredConfigRules }) => { + expect(unfilteredConfigRules).toMatchObject(expectedOverrides); + }, + ); }); describe('recommended-type-checked.ts', () => { - const unfilteredConfigRules = - tseslint.configs.recommendedTypeChecked[2]?.rules; + localTest.scoped({ + unfilteredConfigRules: tseslint.configs.recommendedTypeChecked[2]?.rules, + }); - it('contains all recommended rules', () => { - const configRules = filterRules(unfilteredConfigRules); + localTest('contains all recommended rules', ({ configRulesObject }) => { // note: include deprecated rules so that the config doesn't change between major bumps const ruleConfigs = filterAndMapRuleConfigs({ recommendations: ['recommended'], }); - expect(Object.fromEntries(ruleConfigs)).toEqual( - Object.fromEntries(configRules), - ); + expect(Object.fromEntries(ruleConfigs)).toStrictEqual(configRulesObject); }); - itHasBaseRulesOverriden(unfilteredConfigRules); + localTest( + 'has the base rules overridden by the appropriate extension rules', + ({ expectedOverrides, unfilteredConfigRules }) => { + expect(unfilteredConfigRules).toMatchObject(expectedOverrides); + }, + ); }); describe('recommended-type-checked-only.ts', () => { - const unfilteredConfigRules = - tseslint.configs.recommendedTypeCheckedOnly[2]?.rules; - - it('contains only type-checked recommended rules', () => { - const configRules = filterRules(unfilteredConfigRules); - // note: include deprecated rules so that the config doesn't change between major bumps - const ruleConfigs = filterAndMapRuleConfigs({ - recommendations: ['recommended'], - typeChecked: 'include-only', - }).filter(([ruleName]) => ruleName); - - expect(Object.fromEntries(ruleConfigs)).toEqual( - Object.fromEntries(configRules), - ); + localTest.scoped({ + unfilteredConfigRules: + tseslint.configs.recommendedTypeCheckedOnly[2]?.rules, }); - itHasBaseRulesOverriden(unfilteredConfigRules); + localTest( + 'contains only type-checked recommended rules', + ({ configRulesObject }) => { + // note: include deprecated rules so that the config doesn't change between major bumps + const ruleConfigs = filterAndMapRuleConfigs({ + recommendations: ['recommended'], + typeChecked: 'include-only', + }).filter(([ruleName]) => ruleName); + + expect(Object.fromEntries(ruleConfigs)).toStrictEqual(configRulesObject); + }, + ); + + localTest( + 'has the base rules overridden by the appropriate extension rules', + ({ expectedOverrides, unfilteredConfigRules }) => { + expect(unfilteredConfigRules).toMatchObject(expectedOverrides); + }, + ); }); describe('strict.ts', () => { - const unfilteredConfigRules = tseslint.configs.strict[2]?.rules; - - it('contains all strict rules, excluding type checked ones', () => { - const configRules = filterRules(unfilteredConfigRules); - // note: exclude deprecated rules, this config is allowed to change between minor versions - const ruleConfigs = filterAndMapRuleConfigs({ - excludeDeprecated: true, - recommendations: ['recommended', 'strict'], - typeChecked: 'exclude', - }); - - expect(Object.fromEntries(ruleConfigs)).toEqual( - Object.fromEntries(configRules), - ); + localTest.scoped({ + unfilteredConfigRules: tseslint.configs.strict[2]?.rules, }); - itHasBaseRulesOverriden(unfilteredConfigRules); + localTest( + 'contains all strict rules, excluding type checked ones', + ({ configRulesObject }) => { + // note: exclude deprecated rules, this config is allowed to change between minor versions + const ruleConfigs = filterAndMapRuleConfigs({ + excludeDeprecated: true, + recommendations: ['recommended', 'strict'], + typeChecked: 'exclude', + }); + + expect(Object.fromEntries(ruleConfigs)).toStrictEqual(configRulesObject); + }, + ); + + localTest( + 'has the base rules overridden by the appropriate extension rules', + ({ expectedOverrides, unfilteredConfigRules }) => { + expect(unfilteredConfigRules).toMatchObject(expectedOverrides); + }, + ); }); describe('strict-type-checked.ts', () => { - const unfilteredConfigRules = tseslint.configs.strictTypeChecked[2]?.rules; + localTest.scoped({ + unfilteredConfigRules: tseslint.configs.strictTypeChecked[2]?.rules, + }); - it('contains all strict rules', () => { - const configRules = filterRules(unfilteredConfigRules); + localTest('contains all strict rules', ({ configRulesObject }) => { // note: exclude deprecated rules, this config is allowed to change between minor versions const ruleConfigs = filterAndMapRuleConfigs({ excludeDeprecated: true, recommendations: ['recommended', 'strict'], }); - expect(Object.fromEntries(ruleConfigs)).toEqual( - Object.fromEntries(configRules), - ); + expect(Object.fromEntries(ruleConfigs)).toStrictEqual(configRulesObject); }); - itHasBaseRulesOverriden(unfilteredConfigRules); + localTest( + 'has the base rules overridden by the appropriate extension rules', + ({ expectedOverrides, unfilteredConfigRules }) => { + expect(unfilteredConfigRules).toMatchObject(expectedOverrides); + }, + ); }); describe('strict-type-checked-only.ts', () => { - const unfilteredConfigRules = - tseslint.configs.strictTypeCheckedOnly[2]?.rules; - - it('contains only type-checked strict rules', () => { - const configRules = filterRules(unfilteredConfigRules); - // note: exclude deprecated rules, this config is allowed to change between minor versions - const ruleConfigs = filterAndMapRuleConfigs({ - excludeDeprecated: true, - recommendations: ['recommended', 'strict'], - typeChecked: 'include-only', - }).filter(([ruleName]) => ruleName); - - expect(Object.fromEntries(ruleConfigs)).toEqual( - Object.fromEntries(configRules), - ); + localTest.scoped({ + unfilteredConfigRules: tseslint.configs.strictTypeCheckedOnly[2]?.rules, }); - itHasBaseRulesOverriden(unfilteredConfigRules); + localTest( + 'contains only type-checked strict rules', + ({ configRulesObject }) => { + // note: exclude deprecated rules, this config is allowed to change between minor versions + const ruleConfigs = filterAndMapRuleConfigs({ + excludeDeprecated: true, + recommendations: ['recommended', 'strict'], + typeChecked: 'include-only', + }).filter(([ruleName]) => ruleName); + + expect(Object.fromEntries(ruleConfigs)).toStrictEqual(configRulesObject); + }, + ); + + localTest( + 'has the base rules overridden by the appropriate extension rules', + ({ expectedOverrides, unfilteredConfigRules }) => { + expect(unfilteredConfigRules).toMatchObject(expectedOverrides); + }, + ); }); describe('stylistic.ts', () => { - const unfilteredConfigRules = tseslint.configs.stylistic[2]?.rules; - - it('contains all stylistic rules, excluding deprecated or type checked ones', () => { - const configRules = filterRules(unfilteredConfigRules); - // note: include deprecated rules so that the config doesn't change between major bumps - const ruleConfigs = filterAndMapRuleConfigs({ - recommendations: ['stylistic'], - typeChecked: 'exclude', - }); - - expect(Object.fromEntries(ruleConfigs)).toEqual( - Object.fromEntries(configRules), - ); + localTest.scoped({ + unfilteredConfigRules: tseslint.configs.stylistic[2]?.rules, }); - itHasBaseRulesOverriden(unfilteredConfigRules); + localTest( + 'contains all stylistic rules, excluding deprecated or type checked ones', + ({ configRulesObject }) => { + // note: include deprecated rules so that the config doesn't change between major bumps + const ruleConfigs = filterAndMapRuleConfigs({ + recommendations: ['stylistic'], + typeChecked: 'exclude', + }); + + expect(Object.fromEntries(ruleConfigs)).toStrictEqual(configRulesObject); + }, + ); + + localTest( + 'has the base rules overridden by the appropriate extension rules', + ({ expectedOverrides, unfilteredConfigRules }) => { + expect(unfilteredConfigRules).toMatchObject(expectedOverrides); + }, + ); }); describe('stylistic-type-checked.ts', () => { - const unfilteredConfigRules = tseslint.configs.stylisticTypeChecked[2]?.rules; - const configRules = filterRules(unfilteredConfigRules); - // note: include deprecated rules so that the config doesn't change between major bumps - const ruleConfigs = filterAndMapRuleConfigs({ - recommendations: ['stylistic'], + localTest.scoped({ + unfilteredConfigRules: tseslint.configs.stylisticTypeChecked[2]?.rules, }); - it('contains all stylistic rules, excluding deprecated ones', () => { - expect(Object.fromEntries(ruleConfigs)).toEqual( - Object.fromEntries(configRules), - ); - }); + localTest( + 'contains all stylistic rules, excluding deprecated ones', + ({ configRulesObject }) => { + // note: include deprecated rules so that the config doesn't change between major bumps + const ruleConfigs = filterAndMapRuleConfigs({ + recommendations: ['stylistic'], + }); - itHasBaseRulesOverriden(unfilteredConfigRules); + expect(Object.fromEntries(ruleConfigs)).toStrictEqual(configRulesObject); + }, + ); + + localTest( + 'has the base rules overridden by the appropriate extension rules', + ({ expectedOverrides, unfilteredConfigRules }) => { + expect(unfilteredConfigRules).toMatchObject(expectedOverrides); + }, + ); }); describe('stylistic-type-checked-only.ts', () => { - const unfilteredConfigRules = - tseslint.configs.stylisticTypeCheckedOnly[2]?.rules; + localTest.scoped({ + unfilteredConfigRules: tseslint.configs.stylisticTypeCheckedOnly[2]?.rules, + }); - it('contains only type-checked stylistic rules', () => { - const configRules = filterRules(unfilteredConfigRules); - // note: include deprecated rules so that the config doesn't change between major bumps - const ruleConfigs = filterAndMapRuleConfigs({ - recommendations: ['stylistic'], - typeChecked: 'include-only', - }).filter(([ruleName]) => ruleName); + localTest( + 'contains only type-checked stylistic rules', + ({ configRulesObject }) => { + // note: include deprecated rules so that the config doesn't change between major bumps + const ruleConfigs = filterAndMapRuleConfigs({ + recommendations: ['stylistic'], + typeChecked: 'include-only', + }).filter(([ruleName]) => ruleName); + + expect(Object.fromEntries(ruleConfigs)).toStrictEqual(configRulesObject); + }, + ); - expect(Object.fromEntries(ruleConfigs)).toEqual( - Object.fromEntries(configRules), - ); + localTest( + 'has the base rules overridden by the appropriate extension rules', + ({ expectedOverrides, unfilteredConfigRules }) => { + expect(unfilteredConfigRules).toMatchObject(expectedOverrides); + }, + ); +}); + +const mockAddCandidateTSConfigRootDir = vi.fn(); + +describe('Candidate tsconfigRootDirs', () => { + beforeEach(() => { + clearCandidateTSConfigRootDirs(); + mockAddCandidateTSConfigRootDir.mockClear(); }); - itHasBaseRulesOverriden(unfilteredConfigRules); + describe.each(Object.keys(tseslint.configs))('%s', configKey => { + it('does not populate a candidate tsconfigRootDir when accessed and one cannot be inferred from the stack', () => { + mockGetTSConfigRootDirFromStack.mockReturnValue(undefined); + + // eslint-disable-next-line @typescript-eslint/no-unused-expressions + tseslint.configs[configKey as keyof typeof tseslint.configs]; + + expect(mockAddCandidateTSConfigRootDir).not.toHaveBeenCalled(); + }); + + it('populates a candidate tsconfigRootDir when accessed and one can be inferred from the stack', () => { + const tsconfigRootDir = 'a/b/c/'; + + mockGetTSConfigRootDirFromStack.mockReturnValue(tsconfigRootDir); + + // eslint-disable-next-line @typescript-eslint/no-unused-expressions + tseslint.configs[configKey as keyof typeof tseslint.configs]; + + expect(mockAddCandidateTSConfigRootDir).toHaveBeenCalledWith( + tsconfigRootDir, + ); + }); + }); }); diff --git a/packages/typescript-eslint/tests/getTsconfigRootDirFromStack.test.ts b/packages/typescript-eslint/tests/getTsconfigRootDirFromStack.test.ts new file mode 100644 index 000000000000..92139b45896a --- /dev/null +++ b/packages/typescript-eslint/tests/getTsconfigRootDirFromStack.test.ts @@ -0,0 +1,73 @@ +import { getTSConfigRootDirFromStack } from '../src/getTSConfigRootDirFromStack'; +import * as normalFolder from './path-test-fixtures/tsconfigRootDirInference-normal/normal-folder/eslint.config.cjs'; +import * as notEslintConfig from './path-test-fixtures/tsconfigRootDirInference-not-eslint-config/not-an-eslint.config.cjs'; +import * as folderThatHasASpace from './path-test-fixtures/tsconfigRootDirInference-space/folder that has a space/eslint.config.cjs'; + +const isWindows = process.platform === 'win32'; + +describe(getTSConfigRootDirFromStack, () => { + it('does stack analysis right for normal folder', () => { + expect(normalFolder.get()).toBe(normalFolder.dirname()); + }); + + it('does stack analysis right for a file that gives a file:// URL as its name', () => { + vi.spyOn(Error, 'captureStackTrace').mockImplementationOnce( + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (target: any, _constructorOpt) => { + target.stack = [ + { + getFileName() { + return !isWindows + ? 'file:///a/b/eslint.config.mts' + : 'file:///F:/a/b/eslint.config.mts'; + }, + }, + ]; + }, + ); + + const inferredTsconfigRootDir = getTSConfigRootDirFromStack(); + + expect(inferredTsconfigRootDir).toBe(!isWindows ? '/a/b' : 'F:\\a\\b'); + }); + + it('does stack analysis right for folder that has a space', () => { + expect(folderThatHasASpace.get()).toBe(folderThatHasASpace.dirname()); + }); + + it("doesn't get tricked by a file that is not an ESLint config", () => { + expect(notEslintConfig.get()).toBeUndefined(); + }); + + it('should work in the presence of a messed up strack trace string', () => { + const prepareStackTrace = Error.prepareStackTrace; + const dummyFunction = () => {}; + Error.prepareStackTrace = dummyFunction; + expect(new Error().stack).toBeUndefined(); + expect(normalFolder.get()).toBe(normalFolder.dirname()); + expect(Error.prepareStackTrace).toBe(dummyFunction); + Error.prepareStackTrace = prepareStackTrace; + }); + + it.runIf(isWindows)( + 'works when jiti gives non-normalized stack traces on windows', + () => { + vi.spyOn(Error, 'captureStackTrace').mockImplementationOnce( + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (target: any, _constructorOpt) => { + target.stack = [ + { + getFileName() { + return 'F:/a/b/eslint.config.ts'; + }, + }, + ]; + }, + ); + + const inferredTsconfigRootDir = getTSConfigRootDirFromStack(); + + expect(inferredTsconfigRootDir).toBe('F:\\a\\b'); + }, + ); +}); diff --git a/packages/typescript-eslint/tests/path-test-fixtures/tsconfigRootDirInference-normal/normal-folder/eslint.config.cts b/packages/typescript-eslint/tests/path-test-fixtures/tsconfigRootDirInference-normal/normal-folder/eslint.config.cts new file mode 100644 index 000000000000..39678798c6dc --- /dev/null +++ b/packages/typescript-eslint/tests/path-test-fixtures/tsconfigRootDirInference-normal/normal-folder/eslint.config.cts @@ -0,0 +1,10 @@ +/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ +import { getTSConfigRootDirFromStack } from './../../../../src/getTSConfigRootDirFromStack'; + +export function get() { + return getTSConfigRootDirFromStack(); +} + +export function dirname() { + return __dirname; +} diff --git a/packages/typescript-eslint/tests/path-test-fixtures/tsconfigRootDirInference-not-eslint-config/not-an-eslint.config.cts b/packages/typescript-eslint/tests/path-test-fixtures/tsconfigRootDirInference-not-eslint-config/not-an-eslint.config.cts new file mode 100644 index 000000000000..16f159971d9e --- /dev/null +++ b/packages/typescript-eslint/tests/path-test-fixtures/tsconfigRootDirInference-not-eslint-config/not-an-eslint.config.cts @@ -0,0 +1,10 @@ +/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ +import { getTSConfigRootDirFromStack } from '../../../src/getTSConfigRootDirFromStack'; + +export function get() { + return getTSConfigRootDirFromStack(); +} + +export function dirname() { + return __dirname; +} diff --git a/packages/typescript-eslint/tests/path-test-fixtures/tsconfigRootDirInference-space/folder that has a space/eslint.config.cts b/packages/typescript-eslint/tests/path-test-fixtures/tsconfigRootDirInference-space/folder that has a space/eslint.config.cts new file mode 100644 index 000000000000..ba723627ffad --- /dev/null +++ b/packages/typescript-eslint/tests/path-test-fixtures/tsconfigRootDirInference-space/folder that has a space/eslint.config.cts @@ -0,0 +1,10 @@ +/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ +import { getTSConfigRootDirFromStack } from '../../../../src/getTSConfigRootDirFromStack'; + +export function get() { + return getTSConfigRootDirFromStack(); +} + +export function dirname() { + return __dirname; +} diff --git a/packages/typescript-eslint/tests/type-compatibility.test-d.ts b/packages/typescript-eslint/tests/type-compatibility.test-d.ts new file mode 100644 index 000000000000..dfcf11cbd2f3 --- /dev/null +++ b/packages/typescript-eslint/tests/type-compatibility.test-d.ts @@ -0,0 +1,51 @@ +import { defineConfig } from 'eslint/config'; + +import tseslint from '../src/index'; + +/* eslint @typescript-eslint/no-deprecated: ["error", { "allow": [{ "from": "file", "name": "config", "path": "packages/typescript-eslint/src/config-helper.ts" }] }] */ + +describe('test for compatibility with config helpers', () => { + test('exported plugin is compatible with tseslint.config()', () => { + tseslint.config({ + plugins: { + '@typescript-eslint': tseslint.plugin, + }, + }); + }); + + test('exported plugin is compatible with defineConfig()', () => { + defineConfig({ + plugins: { + '@typescript-eslint': tseslint.plugin, + }, + }); + }); + + test('exported parser is compatible with tseslint.config()', () => { + tseslint.config({ + languageOptions: { + parser: tseslint.parser, + }, + }); + }); + + test('exported parser is compatible with defineConfig()', () => { + defineConfig({ + languageOptions: { + parser: tseslint.parser, + }, + }); + }); + + test('exported configs are compatible with tseslint.config()', () => { + tseslint.config(tseslint.configs.recommendedTypeChecked); + tseslint.config(tseslint.configs.strict); + tseslint.config(tseslint.configs.eslintRecommended); + }); + + test('exported configs are compatible with defineConfig()', () => { + defineConfig(tseslint.configs.recommendedTypeChecked); + defineConfig(tseslint.configs.strict); + defineConfig(tseslint.configs.eslintRecommended); + }); +}); diff --git a/packages/typescript-eslint/tsconfig.build.json b/packages/typescript-eslint/tsconfig.build.json index c41d1d4c30ed..8f377becd3cd 100644 --- a/packages/typescript-eslint/tsconfig.build.json +++ b/packages/typescript-eslint/tsconfig.build.json @@ -2,6 +2,9 @@ "extends": "../../tsconfig.build.json", "compilerOptions": {}, "references": [ + { + "path": "../typescript-estree/tsconfig.build.json" + }, { "path": "../utils/tsconfig.build.json" }, diff --git a/packages/typescript-eslint/tsconfig.json b/packages/typescript-eslint/tsconfig.json index d12794a533bf..f94f467e0b00 100644 --- a/packages/typescript-eslint/tsconfig.json +++ b/packages/typescript-eslint/tsconfig.json @@ -3,6 +3,9 @@ "files": [], "include": [], "references": [ + { + "path": "../typescript-estree" + }, { "path": "../utils" }, diff --git a/packages/typescript-eslint/vitest.config.mts b/packages/typescript-eslint/vitest.config.mts index 7d1cc31b83d7..a527ce206583 100644 --- a/packages/typescript-eslint/vitest.config.mts +++ b/packages/typescript-eslint/vitest.config.mts @@ -14,6 +14,10 @@ const vitestConfig = mergeConfig( dir: path.join(import.meta.dirname, 'tests'), name: packageJson.name, root: import.meta.dirname, + typecheck: { + enabled: true, + tsconfig: path.join(import.meta.dirname, 'tsconfig.spec.json'), + }, }, }), ); diff --git a/packages/typescript-estree/CHANGELOG.md b/packages/typescript-estree/CHANGELOG.md index bdff669307ce..0406f93e5141 100644 --- a/packages/typescript-estree/CHANGELOG.md +++ b/packages/typescript-estree/CHANGELOG.md @@ -1,3 +1,243 @@ +## 8.46.4 (2025-11-10) + +### 🩹 Fixes + +- **parser:** error when both `projectService` and `project` are set ([#11333](https://github.com/typescript-eslint/typescript-eslint/pull/11333)) + +### ❤️ Thank You + +- Maria Solano @MariaSolOs + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.3 (2025-11-03) + +This was a version bump only for typescript-estree to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.2 (2025-10-20) + +### 🩹 Fixes + +- **typescript-estree:** forbid invalid modifiers in object methods ([#11689](https://github.com/typescript-eslint/typescript-eslint/pull/11689)) + +### ❤️ Thank You + +- fisker Cheung @fisker + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.1 (2025-10-13) + +This was a version bump only for typescript-estree to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.0 (2025-10-06) + +### 🚀 Features + +- **typescript-estree:** private identifiers can only appear on LHS of in expressions ([#9232](https://github.com/typescript-eslint/typescript-eslint/pull/9232)) +- **typescript-estree:** mention file specifics in project service allowDefaultProject error ([#11635](https://github.com/typescript-eslint/typescript-eslint/pull/11635)) + +### 🩹 Fixes + +- **typescript-estree:** forbid abstract method and accessor to have implementation ([#11657](https://github.com/typescript-eslint/typescript-eslint/pull/11657)) +- **typescript-estree:** forbid `abstract` modifier in object methods ([#11656](https://github.com/typescript-eslint/typescript-eslint/pull/11656)) + +### ❤️ Thank You + +- fisker Cheung @fisker +- Josh Goldberg ✨ +- Joshua Chen + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.45.0 (2025-09-29) + +This was a version bump only for typescript-estree to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.44.1 (2025-09-22) + +### 🩹 Fixes + +- **typescript-estree:** forbid class property with name `constructor` ([#11590](https://github.com/typescript-eslint/typescript-eslint/pull/11590)) + +### ❤️ Thank You + +- fisker Cheung @fisker + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.44.0 (2025-09-15) + +This was a version bump only for typescript-estree to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.43.0 (2025-09-08) + +### 🚀 Features + +- **typescript-estree:** disallow empty type parameter/argument lists ([#11563](https://github.com/typescript-eslint/typescript-eslint/pull/11563)) + +### 🩹 Fixes + +- **typescript-estree:** match filenames starting with a period when using glob in allowDefaultProject / ([#11537](https://github.com/typescript-eslint/typescript-eslint/pull/11537)) + +### ❤️ Thank You + +- Kirk Waiblinger @kirkwaiblinger +- Nicolas Le Cam + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.42.0 (2025-09-02) + +This was a version bump only for typescript-estree to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.41.0 (2025-08-25) + +### 🚀 Features + +- tighten `tsconfigRootDir` validation ([#11463](https://github.com/typescript-eslint/typescript-eslint/pull/11463)) + +### ❤️ Thank You + +- Kirk Waiblinger @kirkwaiblinger + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.40.0 (2025-08-18) + +### 🚀 Features + +- **typescript-estree:** forbid invalid keys in `EnumMember` ([#11232](https://github.com/typescript-eslint/typescript-eslint/pull/11232)) + +### 🩹 Fixes + +- **typescript-estree:** correct range of import assertion with trailing comma ([#11478](https://github.com/typescript-eslint/typescript-eslint/pull/11478)) + +### ❤️ Thank You + +- fisker Cheung @fisker +- Kirk Waiblinger @kirkwaiblinger + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.39.1 (2025-08-11) + +This was a version bump only for typescript-estree to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.39.0 (2025-08-04) + +### 🚀 Features + +- update to TypeScript 5.9.2 ([#11445](https://github.com/typescript-eslint/typescript-eslint/pull/11445)) + +### ❤️ Thank You + +- Brad Zacher @bradzacher + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.38.0 (2025-07-21) + +### 🚀 Features + +- **typescript-estree:** forbid optional chain in `TemplateTaggedLiteral` ([#11391](https://github.com/typescript-eslint/typescript-eslint/pull/11391)) + +### 🩹 Fixes + +- **typescript-estree:** ensure the token type of the property name is Identifier ([#11329](https://github.com/typescript-eslint/typescript-eslint/pull/11329)) + +### ❤️ Thank You + +- MK @asdf93074 +- tao + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.37.0 (2025-07-14) + +### 🚀 Features + +- **typescript-estree:** infer tsconfigRootDir from call stack ([#11370](https://github.com/typescript-eslint/typescript-eslint/pull/11370)) + +### ❤️ Thank You + +- Josh Goldberg ✨ + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.36.0 (2025-07-07) + +This was a version bump only for typescript-estree to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.35.1 (2025-06-30) + +This was a version bump only for typescript-estree to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.35.0 (2025-06-23) + +This was a version bump only for typescript-estree to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.34.1 (2025-06-16) + +### 🩹 Fixes + +- **typescript-estree:** emit a Literal instead of Identifier for constructor when the identifier is a string ([#11299](https://github.com/typescript-eslint/typescript-eslint/pull/11299)) + +### ❤️ Thank You + +- Tao + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.34.0 (2025-06-09) + +### 🩹 Fixes + +- **typescript-estree:** add validation to interface extends ([#11271](https://github.com/typescript-eslint/typescript-eslint/pull/11271)) +- **typescript-estree:** change the token type of `null` from `Keyword` to `Null` ([#11283](https://github.com/typescript-eslint/typescript-eslint/pull/11283)) + +### ❤️ Thank You + +- Tao + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.33.1 (2025-06-02) + +This was a version bump only for typescript-estree to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.33.0 (2025-05-26) + +### 🚀 Features + +- create standalone project-service, tsconfig-utils packages ([#11182](https://github.com/typescript-eslint/typescript-eslint/pull/11182)) + +### ❤️ Thank You + +- Josh Goldberg ✨ + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + ## 8.32.1 (2025-05-12) This was a version bump only for typescript-estree to align it with other projects, there were no code changes. diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index 958ba78b17ae..e3a732a412ab 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/typescript-estree", - "version": "8.32.1", + "version": "8.46.4", "description": "A parser that converts TypeScript source code into an ESTree compatible form", "files": [ "dist", @@ -44,16 +44,18 @@ "syntax" ], "scripts": { - "build": "tsc -b tsconfig.build.json", + "build": "yarn run -BT nx build", "clean": "rimraf dist/ coverage/", - "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", - "lint": "npx nx lint", - "test": "vitest --run --config=$INIT_CWD/vitest.config.mts", - "check-types": "npx nx typecheck" + "format": "yarn run -T format", + "lint": "yarn run -BT nx lint", + "test": "yarn run -BT nx test", + "typecheck": "yarn run -BT nx typecheck" }, "dependencies": { - "@typescript-eslint/types": "8.32.1", - "@typescript-eslint/visitor-keys": "8.32.1", + "@typescript-eslint/project-service": "8.46.4", + "@typescript-eslint/tsconfig-utils": "8.46.4", + "@typescript-eslint/types": "8.46.4", + "@typescript-eslint/visitor-keys": "8.46.4", "debug": "^4.3.4", "fast-glob": "^3.3.2", "is-glob": "^4.0.3", @@ -64,17 +66,28 @@ "devDependencies": { "@types/is-glob": "^4.0.4", "@vitest/coverage-v8": "^3.1.3", + "eslint": "*", "glob": "*", - "prettier": "^3.2.5", "rimraf": "*", "typescript": "*", "vitest": "^3.1.3" }, "peerDependencies": { - "typescript": ">=4.8.4 <5.9.0" + "typescript": ">=4.8.4 <6.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" + }, + "nx": { + "name": "typescript-estree", + "includedScripts": [ + "clean" + ], + "targets": { + "lint": { + "command": "eslint" + } + } } } diff --git a/packages/typescript-estree/project.json b/packages/typescript-estree/project.json deleted file mode 100644 index f0c767ee7c9a..000000000000 --- a/packages/typescript-estree/project.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "typescript-estree", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "projectType": "library", - "root": "packages/typescript-estree", - "sourceRoot": "packages/typescript-estree/src", - "targets": { - "lint": { - "executor": "@nx/eslint:lint", - "outputs": ["{options.outputFile}"] - }, - "test": { - "executor": "@nx/vite:test" - } - } -} diff --git a/packages/typescript-estree/src/check-modifiers.ts b/packages/typescript-estree/src/check-modifiers.ts new file mode 100644 index 000000000000..423604a70e01 --- /dev/null +++ b/packages/typescript-estree/src/check-modifiers.ts @@ -0,0 +1,388 @@ +import * as ts from 'typescript'; + +import type { TSNode } from './ts-estree'; + +import { getDecorators, getModifiers } from './getModifiers'; +import { + getDeclarationKind, + hasModifier, + isThisIdentifier, + createError, +} from './node-utils'; + +const SyntaxKind = ts.SyntaxKind; + +// `ts.nodeIsMissing` +function nodeIsMissing(node: ts.Node | undefined): boolean { + if (node == null) { + return true; + } + return ( + node.pos === node.end && + node.pos >= 0 && + node.kind !== SyntaxKind.EndOfFileToken + ); +} + +// `ts.nodeIsPresent` +function nodeIsPresent(node: ts.Node | undefined): node is ts.Node { + return !nodeIsMissing(node); +} + +// `ts.hasAbstractModifier` +function hasAbstractModifier(node: ts.Node): boolean { + return hasModifier(SyntaxKind.AbstractKeyword, node); +} + +// `ts.getThisParameter` +function getThisParameter( + signature: ts.SignatureDeclaration, +): ts.ParameterDeclaration | null { + if (signature.parameters.length && !ts.isJSDocSignature(signature)) { + const thisParameter = signature.parameters[0]; + if (parameterIsThisKeyword(thisParameter)) { + return thisParameter; + } + } + + return null; +} + +// `ts.parameterIsThisKeyword` +function parameterIsThisKeyword(parameter: ts.ParameterDeclaration): boolean { + return isThisIdentifier(parameter.name); +} + +// `ts.getContainingFunction` +function getContainingFunction( + node: ts.Node, +): ts.SignatureDeclaration | undefined { + return ts.findAncestor(node.parent, ts.isFunctionLike); +} + +// Rewrite version of `ts.nodeCanBeDecorated` +// Returns `true` for both `useLegacyDecorators: true` and `useLegacyDecorators: false` +function nodeCanBeDecorated(node: TSNode): boolean { + switch (node.kind) { + case SyntaxKind.ClassDeclaration: + return true; + case SyntaxKind.ClassExpression: + // `ts.nodeCanBeDecorated` returns `false` if `useLegacyDecorators: true` + return true; + case SyntaxKind.PropertyDeclaration: { + const { parent } = node; + + // `ts.nodeCanBeDecorated` uses this if `useLegacyDecorators: true` + if (ts.isClassDeclaration(parent)) { + return true; + } + + // `ts.nodeCanBeDecorated` uses this if `useLegacyDecorators: false` + if (ts.isClassLike(parent) && !hasAbstractModifier(node)) { + return true; + } + + return false; + } + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + case SyntaxKind.MethodDeclaration: { + const { parent } = node; + // In `ts.nodeCanBeDecorated` + // when `useLegacyDecorators: true` uses `ts.isClassDeclaration` + // when `useLegacyDecorators: true` uses `ts.isClassLike` + return ( + Boolean(node.body) && + (ts.isClassDeclaration(parent) || ts.isClassLike(parent)) + ); + } + case SyntaxKind.Parameter: { + // `ts.nodeCanBeDecorated` returns `false` if `useLegacyDecorators: false` + + const { parent } = node; + const grandparent = parent.parent; + + return ( + Boolean(parent) && + 'body' in parent && + Boolean(parent.body) && + (parent.kind === SyntaxKind.Constructor || + parent.kind === SyntaxKind.MethodDeclaration || + parent.kind === SyntaxKind.SetAccessor) && + getThisParameter(parent) !== node && + Boolean(grandparent) && + grandparent.kind === SyntaxKind.ClassDeclaration + ); + } + } + + return false; +} + +function nodeHasIllegalDecorators( + node: ts.Node, +): node is { illegalDecorators: ts.Node[] } & ts.Node { + return !!( + 'illegalDecorators' in node && + (node.illegalDecorators as unknown[] | undefined)?.length + ); +} + +function throwError(node: ts.Node, message: string): never { + const ast = node.getSourceFile(); + const start = node.getStart(ast); + const end = node.getEnd(); + + throw createError(message, ast, start, end); +} + +export function checkModifiers(node: ts.Node): void { + // typescript<5.0.0 + if (nodeHasIllegalDecorators(node)) { + throwError(node.illegalDecorators[0], 'Decorators are not valid here.'); + } + + for (const decorator of getDecorators( + node, + /* includeIllegalDecorators */ true, + ) ?? []) { + // `checkGrammarModifiers` function in typescript + if (!nodeCanBeDecorated(node as TSNode)) { + if (ts.isMethodDeclaration(node) && !nodeIsPresent(node.body)) { + throwError( + decorator, + 'A decorator can only decorate a method implementation, not an overload.', + ); + } else { + throwError(decorator, 'Decorators are not valid here.'); + } + } + } + + for (const modifier of getModifiers( + node, + /* includeIllegalModifiers */ true, + ) ?? []) { + if (modifier.kind !== SyntaxKind.ReadonlyKeyword) { + if ( + node.kind === SyntaxKind.PropertySignature || + node.kind === SyntaxKind.MethodSignature + ) { + throwError( + modifier, + `'${ts.tokenToString( + modifier.kind, + )}' modifier cannot appear on a type member`, + ); + } + + if ( + node.kind === SyntaxKind.IndexSignature && + (modifier.kind !== SyntaxKind.StaticKeyword || + !ts.isClassLike(node.parent)) + ) { + throwError( + modifier, + `'${ts.tokenToString( + modifier.kind, + )}' modifier cannot appear on an index signature`, + ); + } + } + + if ( + modifier.kind !== SyntaxKind.InKeyword && + modifier.kind !== SyntaxKind.OutKeyword && + modifier.kind !== SyntaxKind.ConstKeyword && + node.kind === SyntaxKind.TypeParameter + ) { + throwError( + modifier, + `'${ts.tokenToString( + modifier.kind, + )}' modifier cannot appear on a type parameter`, + ); + } + + if ( + (modifier.kind === SyntaxKind.InKeyword || + modifier.kind === SyntaxKind.OutKeyword) && + (node.kind !== SyntaxKind.TypeParameter || + !( + ts.isInterfaceDeclaration(node.parent) || + ts.isClassLike(node.parent) || + ts.isTypeAliasDeclaration(node.parent) + )) + ) { + throwError( + modifier, + `'${ts.tokenToString( + modifier.kind, + )}' modifier can only appear on a type parameter of a class, interface or type alias`, + ); + } + + if ( + modifier.kind === SyntaxKind.ReadonlyKeyword && + node.kind !== SyntaxKind.PropertyDeclaration && + node.kind !== SyntaxKind.PropertySignature && + node.kind !== SyntaxKind.IndexSignature && + node.kind !== SyntaxKind.Parameter + ) { + throwError( + modifier, + "'readonly' modifier can only appear on a property declaration or index signature.", + ); + } + + if ( + modifier.kind === SyntaxKind.DeclareKeyword && + ts.isClassLike(node.parent) && + !ts.isPropertyDeclaration(node) + ) { + throwError( + modifier, + `'${ts.tokenToString( + modifier.kind, + )}' modifier cannot appear on class elements of this kind.`, + ); + } + + if ( + modifier.kind === SyntaxKind.DeclareKeyword && + ts.isVariableStatement(node) + ) { + const declarationKind = getDeclarationKind(node.declarationList); + if (declarationKind === 'using' || declarationKind === 'await using') { + throwError( + modifier, + `'declare' modifier cannot appear on a '${declarationKind}' declaration.`, + ); + } + } + + if ( + modifier.kind === SyntaxKind.AbstractKeyword && + node.kind !== SyntaxKind.ClassDeclaration && + node.kind !== SyntaxKind.ConstructorType && + node.kind !== SyntaxKind.MethodDeclaration && + node.kind !== SyntaxKind.PropertyDeclaration && + node.kind !== SyntaxKind.GetAccessor && + node.kind !== SyntaxKind.SetAccessor + ) { + throwError( + modifier, + `'${ts.tokenToString( + modifier.kind, + )}' modifier can only appear on a class, method, or property declaration.`, + ); + } + + if ( + (modifier.kind === SyntaxKind.StaticKeyword || + modifier.kind === SyntaxKind.PublicKeyword || + modifier.kind === SyntaxKind.ProtectedKeyword || + modifier.kind === SyntaxKind.PrivateKeyword) && + (node.parent.kind === SyntaxKind.ModuleBlock || + node.parent.kind === SyntaxKind.SourceFile) + ) { + throwError( + modifier, + `'${ts.tokenToString( + modifier.kind, + )}' modifier cannot appear on a module or namespace element.`, + ); + } + + if ( + modifier.kind === SyntaxKind.AccessorKeyword && + node.kind !== SyntaxKind.PropertyDeclaration + ) { + throwError( + modifier, + "'accessor' modifier can only appear on a property declaration.", + ); + } + + // `checkGrammarAsyncModifier` function in `typescript` + if ( + modifier.kind === SyntaxKind.AsyncKeyword && + node.kind !== SyntaxKind.MethodDeclaration && + node.kind !== SyntaxKind.FunctionDeclaration && + node.kind !== SyntaxKind.FunctionExpression && + node.kind !== SyntaxKind.ArrowFunction + ) { + throwError(modifier, "'async' modifier cannot be used here."); + } + + // `checkGrammarModifiers` function in `typescript` + if ( + node.kind === SyntaxKind.Parameter && + (modifier.kind === SyntaxKind.StaticKeyword || + modifier.kind === SyntaxKind.ExportKeyword || + modifier.kind === SyntaxKind.DeclareKeyword || + modifier.kind === SyntaxKind.AsyncKeyword) + ) { + throwError( + modifier, + `'${ts.tokenToString( + modifier.kind, + )}' modifier cannot appear on a parameter.`, + ); + } + + // `checkGrammarModifiers` function in `typescript` + if ( + modifier.kind === SyntaxKind.PublicKeyword || + modifier.kind === SyntaxKind.ProtectedKeyword || + modifier.kind === SyntaxKind.PrivateKeyword + ) { + for (const anotherModifier of getModifiers(node) ?? []) { + if ( + anotherModifier !== modifier && + (anotherModifier.kind === SyntaxKind.PublicKeyword || + anotherModifier.kind === SyntaxKind.ProtectedKeyword || + anotherModifier.kind === SyntaxKind.PrivateKeyword) + ) { + throwError(anotherModifier, `Accessibility modifier already seen.`); + } + } + } + + // `checkParameter` function in `typescript` + if ( + node.kind === SyntaxKind.Parameter && + // In `typescript` package, it's `ts.hasSyntacticModifier(node, ts.ModifierFlags.ParameterPropertyModifier)` + // https://github.com/typescript-eslint/typescript-eslint/pull/6615#discussion_r1136489935 + (modifier.kind === SyntaxKind.PublicKeyword || + modifier.kind === SyntaxKind.PrivateKeyword || + modifier.kind === SyntaxKind.ProtectedKeyword || + modifier.kind === SyntaxKind.ReadonlyKeyword || + modifier.kind === SyntaxKind.OverrideKeyword) + ) { + const func = getContainingFunction(node); + + if ( + !(func?.kind === SyntaxKind.Constructor && nodeIsPresent(func.body)) + ) { + throwError( + modifier, + 'A parameter property is only allowed in a constructor implementation.', + ); + } + } + + // There are more cases in `checkGrammarObjectLiteralExpression` in TypeScript. + // We may add more validations for them here in the future. + if ( + modifier.kind !== SyntaxKind.AsyncKeyword && + node.kind === SyntaxKind.MethodDeclaration && + node.parent.kind === SyntaxKind.ObjectLiteralExpression + ) { + throwError( + modifier, + `'${ts.tokenToString(modifier.kind)}' modifier cannot be used here.`, + ); + } + } +} diff --git a/packages/typescript-estree/src/clear-caches.ts b/packages/typescript-estree/src/clear-caches.ts index 5e9867d3beab..3d5897953b70 100644 --- a/packages/typescript-estree/src/clear-caches.ts +++ b/packages/typescript-estree/src/clear-caches.ts @@ -3,6 +3,7 @@ import { clearDefaultProjectMatchedFiles, clearProgramCache as clearProgramCacheOriginal, } from './parser'; +import { clearCandidateTSConfigRootDirs } from './parseSettings/candidateTSConfigRootDirs'; import { clearTSConfigMatchCache, clearTSServerProjectService, @@ -17,6 +18,7 @@ import { clearGlobCache } from './parseSettings/resolveProjectList'; * - In custom lint tooling that iteratively lints one project at a time to prevent OOMs. */ export function clearCaches(): void { + clearCandidateTSConfigRootDirs(); clearDefaultProjectMatchedFiles(); clearProgramCacheOriginal(); clearWatchCaches(); diff --git a/packages/typescript-estree/src/convert-comments.ts b/packages/typescript-estree/src/convert-comments.ts index 234f62ec802c..c1d6a6e05121 100644 --- a/packages/typescript-estree/src/convert-comments.ts +++ b/packages/typescript-estree/src/convert-comments.ts @@ -34,14 +34,14 @@ export function convertComments( const textEnd = comment.kind === ts.SyntaxKind.SingleLineCommentTrivia ? // single line comments end at the end - range[1] - textStart + range[1] : // multiline comments end 2 characters early - range[1] - textStart - 2; + range[1] - 2; comments.push({ type, loc, range, - value: code.slice(textStart, textStart + textEnd), + value: code.slice(textStart, textEnd), }); }, ast, diff --git a/packages/typescript-estree/src/convert.ts b/packages/typescript-estree/src/convert.ts index 22c0257505a2..3facbe34af20 100644 --- a/packages/typescript-estree/src/convert.ts +++ b/packages/typescript-estree/src/convert.ts @@ -10,13 +10,14 @@ import type { import type { SemanticOrSyntacticError } from './semantic-or-syntactic-errors'; import type { TSESTree, TSESTreeToTSNode, TSNode } from './ts-estree'; +import { checkModifiers } from './check-modifiers'; import { getDecorators, getModifiers } from './getModifiers'; import { canContainDirective, createError, + declarationNameToString, findNextToken, getBinaryExpressionType, - getContainingFunction, getDeclarationKind, getLastModifier, getLineAndCharacterFor, @@ -34,9 +35,6 @@ import { isOptional, isThisInTypeQuery, isValidAssignmentTarget, - nodeCanBeDecorated, - nodeHasIllegalDecorators, - nodeIsPresent, unescapeStringLiteralText, } from './node-utils'; import { AST_NODE_TYPES } from './ts-estree'; @@ -70,6 +68,25 @@ export interface ASTMaps { tsNodeToESTreeNodeMap: ParserWeakMap; } +function isPropertyAccessEntityNameExpression( + node: ts.Node, +): node is ts.PropertyAccessEntityNameExpression { + return ( + ts.isPropertyAccessExpression(node) && + ts.isIdentifier(node.name) && + isEntityNameExpression(node.expression) + ); +} + +function isEntityNameExpression( + node: ts.Node, +): node is ts.EntityNameExpression { + return ( + node.kind === SyntaxKind.Identifier || + isPropertyAccessEntityNameExpression(node) + ); +} + export class Converter { private allowPattern = false; private readonly ast: ts.SourceFile; @@ -139,253 +156,15 @@ export class Converter { return; } - // typescript<5.0.0 - if (nodeHasIllegalDecorators(node)) { - this.#throwError( - node.illegalDecorators[0], - 'Decorators are not valid here.', - ); - } - - for (const decorator of getDecorators( - node, - /* includeIllegalDecorators */ true, - ) ?? []) { - // `checkGrammarModifiers` function in typescript - if (!nodeCanBeDecorated(node as TSNode)) { - if (ts.isMethodDeclaration(node) && !nodeIsPresent(node.body)) { - this.#throwError( - decorator, - 'A decorator can only decorate a method implementation, not an overload.', - ); - } else { - this.#throwError(decorator, 'Decorators are not valid here.'); - } - } - } - - for (const modifier of getModifiers( - node, - /* includeIllegalModifiers */ true, - ) ?? []) { - if (modifier.kind !== SyntaxKind.ReadonlyKeyword) { - if ( - node.kind === SyntaxKind.PropertySignature || - node.kind === SyntaxKind.MethodSignature - ) { - this.#throwError( - modifier, - `'${ts.tokenToString( - modifier.kind, - )}' modifier cannot appear on a type member`, - ); - } - - if ( - node.kind === SyntaxKind.IndexSignature && - (modifier.kind !== SyntaxKind.StaticKeyword || - !ts.isClassLike(node.parent)) - ) { - this.#throwError( - modifier, - `'${ts.tokenToString( - modifier.kind, - )}' modifier cannot appear on an index signature`, - ); - } - } - - if ( - modifier.kind !== SyntaxKind.InKeyword && - modifier.kind !== SyntaxKind.OutKeyword && - modifier.kind !== SyntaxKind.ConstKeyword && - node.kind === SyntaxKind.TypeParameter - ) { - this.#throwError( - modifier, - `'${ts.tokenToString( - modifier.kind, - )}' modifier cannot appear on a type parameter`, - ); - } - - if ( - (modifier.kind === SyntaxKind.InKeyword || - modifier.kind === SyntaxKind.OutKeyword) && - (node.kind !== SyntaxKind.TypeParameter || - !( - ts.isInterfaceDeclaration(node.parent) || - ts.isClassLike(node.parent) || - ts.isTypeAliasDeclaration(node.parent) - )) - ) { - this.#throwError( - modifier, - `'${ts.tokenToString( - modifier.kind, - )}' modifier can only appear on a type parameter of a class, interface or type alias`, - ); - } - - if ( - modifier.kind === SyntaxKind.ReadonlyKeyword && - node.kind !== SyntaxKind.PropertyDeclaration && - node.kind !== SyntaxKind.PropertySignature && - node.kind !== SyntaxKind.IndexSignature && - node.kind !== SyntaxKind.Parameter - ) { - this.#throwError( - modifier, - "'readonly' modifier can only appear on a property declaration or index signature.", - ); - } - - if ( - modifier.kind === SyntaxKind.DeclareKeyword && - ts.isClassLike(node.parent) && - !ts.isPropertyDeclaration(node) - ) { - this.#throwError( - modifier, - `'${ts.tokenToString( - modifier.kind, - )}' modifier cannot appear on class elements of this kind.`, - ); - } - - if ( - modifier.kind === SyntaxKind.DeclareKeyword && - ts.isVariableStatement(node) - ) { - const declarationKind = getDeclarationKind(node.declarationList); - if (declarationKind === 'using' || declarationKind === 'await using') { - this.#throwError( - modifier, - `'declare' modifier cannot appear on a '${declarationKind}' declaration.`, - ); - } - } - - if ( - modifier.kind === SyntaxKind.AbstractKeyword && - node.kind !== SyntaxKind.ClassDeclaration && - node.kind !== SyntaxKind.ConstructorType && - node.kind !== SyntaxKind.MethodDeclaration && - node.kind !== SyntaxKind.PropertyDeclaration && - node.kind !== SyntaxKind.GetAccessor && - node.kind !== SyntaxKind.SetAccessor - ) { - this.#throwError( - modifier, - `'${ts.tokenToString( - modifier.kind, - )}' modifier can only appear on a class, method, or property declaration.`, - ); - } - - if ( - (modifier.kind === SyntaxKind.StaticKeyword || - modifier.kind === SyntaxKind.PublicKeyword || - modifier.kind === SyntaxKind.ProtectedKeyword || - modifier.kind === SyntaxKind.PrivateKeyword) && - (node.parent.kind === SyntaxKind.ModuleBlock || - node.parent.kind === SyntaxKind.SourceFile) - ) { - this.#throwError( - modifier, - `'${ts.tokenToString( - modifier.kind, - )}' modifier cannot appear on a module or namespace element.`, - ); - } - - if ( - modifier.kind === SyntaxKind.AccessorKeyword && - node.kind !== SyntaxKind.PropertyDeclaration - ) { - this.#throwError( - modifier, - "'accessor' modifier can only appear on a property declaration.", - ); - } - - // `checkGrammarAsyncModifier` function in `typescript` - if ( - modifier.kind === SyntaxKind.AsyncKeyword && - node.kind !== SyntaxKind.MethodDeclaration && - node.kind !== SyntaxKind.FunctionDeclaration && - node.kind !== SyntaxKind.FunctionExpression && - node.kind !== SyntaxKind.ArrowFunction - ) { - this.#throwError(modifier, "'async' modifier cannot be used here."); - } - - // `checkGrammarModifiers` function in `typescript` - if ( - node.kind === SyntaxKind.Parameter && - (modifier.kind === SyntaxKind.StaticKeyword || - modifier.kind === SyntaxKind.ExportKeyword || - modifier.kind === SyntaxKind.DeclareKeyword || - modifier.kind === SyntaxKind.AsyncKeyword) - ) { - this.#throwError( - modifier, - `'${ts.tokenToString( - modifier.kind, - )}' modifier cannot appear on a parameter.`, - ); - } - - // `checkGrammarModifiers` function in `typescript` - if ( - modifier.kind === SyntaxKind.PublicKeyword || - modifier.kind === SyntaxKind.ProtectedKeyword || - modifier.kind === SyntaxKind.PrivateKeyword - ) { - for (const anotherModifier of getModifiers(node) ?? []) { - if ( - anotherModifier !== modifier && - (anotherModifier.kind === SyntaxKind.PublicKeyword || - anotherModifier.kind === SyntaxKind.ProtectedKeyword || - anotherModifier.kind === SyntaxKind.PrivateKeyword) - ) { - this.#throwError( - anotherModifier, - `Accessibility modifier already seen.`, - ); - } - } - } - - // `checkParameter` function in `typescript` - if ( - node.kind === SyntaxKind.Parameter && - // In `typescript` package, it's `ts.hasSyntacticModifier(node, ts.ModifierFlags.ParameterPropertyModifier)` - // https://github.com/typescript-eslint/typescript-eslint/pull/6615#discussion_r1136489935 - (modifier.kind === SyntaxKind.PublicKeyword || - modifier.kind === SyntaxKind.PrivateKeyword || - modifier.kind === SyntaxKind.ProtectedKeyword || - modifier.kind === SyntaxKind.ReadonlyKeyword || - modifier.kind === SyntaxKind.OverrideKeyword) - ) { - const func = getContainingFunction(node)!; - - if ( - !(func.kind === SyntaxKind.Constructor && nodeIsPresent(func.body)) - ) { - this.#throwError( - modifier, - 'A parameter property is only allowed in a constructor implementation.', - ); - } - } - } + checkModifiers(node); } - #throwError(node: number | ts.Node, message: string): asserts node is never { + #throwError(node: number | ts.Node | TSESTree.Range, message: string): never { let start; let end; - if (typeof node === 'number') { + if (Array.isArray(node)) { + [start, end] = node; + } else if (typeof node === 'number') { start = end = node; } else { start = node.getStart(this.ast); @@ -396,7 +175,7 @@ export class Converter { } #throwUnlessAllowInvalidAST( - node: number | ts.Node, + node: number | ts.Node | TSESTree.Range, message: string, ): asserts node is never { if (!this.options.allowInvalidAST) { @@ -457,7 +236,7 @@ export class Converter { >( node: Properties, deprecatedKey: Key, - preferredKey: string, + preferredKey: string | undefined, value: Value, ): Properties & Record { let warned = false; @@ -468,10 +247,13 @@ export class Converter { ? (): Value => value : (): Value => { if (!warned) { - process.emitWarning( - `The '${deprecatedKey}' property is deprecated on ${node.type} nodes. Use ${preferredKey} instead. See https://typescript-eslint.io/troubleshooting/faqs/general#the-key-property-is-deprecated-on-type-nodes-use-key-instead-warnings.`, - 'DeprecationWarning', - ); + let message = `The '${deprecatedKey}' property is deprecated on ${node.type} nodes.`; + if (preferredKey) { + message += ` Use ${preferredKey} instead.`; + } + message += + ' See https://typescript-eslint.io/troubleshooting/faqs/general#the-key-property-is-deprecated-on-type-nodes-use-key-instead-warnings.'; + process.emitWarning(message, 'DeprecationWarning'); warned = true; } @@ -619,6 +401,19 @@ export class Converter { return this.converter(child, parent, false); } + /** + * Converts TypeScript node array into an ESTree node list. + * @param children the child `ts.NodeArray` or `ts.Node[]` + * @param parent parentNode + * @returns the converted ESTree node list + */ + private convertChildren( + children: ts.Node[] | ts.NodeArray, + parent?: ts.Node, + ): any[] { + return children.map(child => this.converter(child, parent, false)); + } + /** * Converts a TypeScript node into an ESTree node. * @param child the child ts.Node @@ -669,13 +464,16 @@ export class Converter { node: TSESTreeToTSNode, ): TSESTree.TSTypeParameterInstantiation { const greaterThanToken = findNextToken(typeArguments, this.ast, this.ast)!; + const range: TSESTree.Range = [typeArguments.pos - 1, greaterThanToken.end]; + + if (typeArguments.length === 0) { + this.#throwError(range, 'Type argument list cannot be empty.'); + } return this.createNode(node, { type: AST_NODE_TYPES.TSTypeParameterInstantiation, - range: [typeArguments.pos - 1, greaterThanToken.end], - params: typeArguments.map(typeArgument => - this.convertChild(typeArgument), - ), + range, + params: this.convertChildren(typeArguments), }); } @@ -693,13 +491,15 @@ export class Converter { greaterThanToken.end, ]; + if (typeParameters.length === 0) { + this.#throwError(range, 'Type parameter list cannot be empty.'); + } + return { type: AST_NODE_TYPES.TSTypeParameterDeclaration, loc: getLocFor(range, this.ast), range, - params: typeParameters.map(typeParameter => - this.convertChild(typeParameter), - ), + params: this.convertChildren(typeParameters), } as TSESTree.TSTypeParameterDeclaration; } @@ -717,8 +517,9 @@ export class Converter { return parameters.map(param => { const convertedParam = this.convertChild(param) as TSESTree.Parameter; - convertedParam.decorators = - getDecorators(param)?.map(el => this.convertChild(el)) ?? []; + convertedParam.decorators = this.convertChildren( + getDecorators(param) ?? [], + ); return convertedParam; }); @@ -762,11 +563,11 @@ export class Converter { } private convertImportAttributes( - node: ts.ImportAttributes | undefined, + node: ts.ExportDeclaration | ts.ImportDeclaration, ): TSESTree.ImportAttribute[] { - return node == null - ? [] - : node.elements.map(element => this.convertChild(element)); + // eslint-disable-next-line @typescript-eslint/no-deprecated + const attributes = node.attributes ?? node.assertClause; + return this.convertChildren(attributes?.elements ?? []); } private convertJSXIdentifier( @@ -1027,7 +828,7 @@ export class Converter { return this.createNode(node, { type: AST_NODE_TYPES.SwitchStatement, - cases: node.caseBlock.clauses.map(el => this.convertChild(el)), + cases: this.convertChildren(node.caseBlock.clauses), discriminant: this.convertChild(node.expression), }); @@ -1036,7 +837,7 @@ export class Converter { return this.createNode(node, { type: AST_NODE_TYPES.SwitchCase, // expression is present in case only - consequent: node.statements.map(el => this.convertChild(el)), + consequent: this.convertChildren(node.statements), test: node.kind === SyntaxKind.CaseClause ? this.convertChild(node.expression) @@ -1226,9 +1027,7 @@ export class Converter { case SyntaxKind.VariableStatement: { const result = this.createNode(node, { type: AST_NODE_TYPES.VariableDeclaration, - declarations: node.declarationList.declarations.map(el => - this.convertChild(el), - ), + declarations: this.convertChildren(node.declarationList.declarations), declare: hasModifier(SyntaxKind.DeclareKeyword, node), kind: getDeclarationKind(node.declarationList), }); @@ -1305,7 +1104,7 @@ export class Converter { case SyntaxKind.VariableDeclarationList: { const result = this.createNode(node, { type: AST_NODE_TYPES.VariableDeclaration, - declarations: node.declarations.map(el => this.convertChild(el)), + declarations: this.convertChildren(node.declarations), declare: false, kind: getDeclarationKind(node), }); @@ -1356,7 +1155,7 @@ export class Converter { } return this.createNode(node, { type: AST_NODE_TYPES.ArrayExpression, - elements: node.elements.map(el => this.convertChild(el)), + elements: this.convertChildren(node.elements), }); } @@ -1491,6 +1290,16 @@ export class Converter { ); } + if ( + node.name.kind === SyntaxKind.StringLiteral && + node.name.text === 'constructor' + ) { + this.#throwError( + node.name, + "Classes may not have a field named 'constructor'.", + ); + } + const isAccessor = hasModifier(SyntaxKind.AccessorKeyword, node); const type = (() => { if (isAccessor) { @@ -1518,8 +1327,7 @@ export class Converter { accessibility: getTSNodeAccessibility(node), computed: isComputedProperty(node.name), declare: hasModifier(SyntaxKind.DeclareKeyword, node), - decorators: - getDecorators(node)?.map(el => this.convertChild(el)) ?? [], + decorators: this.convertChildren(getDecorators(node) ?? []), definite: !!node.exclamationToken, key, optional: @@ -1549,6 +1357,18 @@ export class Converter { } // otherwise, it is a non-type accessor - intentional fallthrough case SyntaxKind.MethodDeclaration: { + const isAbstract = hasModifier(SyntaxKind.AbstractKeyword, node); + + if (isAbstract && node.body) { + this.#throwError( + node.name, + node.kind === SyntaxKind.GetAccessor || + node.kind === SyntaxKind.SetAccessor + ? 'An abstract accessor cannot have an implementation.' + : `Method '${declarationNameToString(node.name, this.ast)}' cannot have an implementation because it is marked abstract.`, + ); + } + const method = this.createNode< TSESTree.FunctionExpression | TSESTree.TSEmptyBodyFunctionExpression >(node, { @@ -1581,7 +1401,7 @@ export class Converter { | TSESTree.TSAbstractMethodDefinition; if (parent.kind === SyntaxKind.ObjectLiteralExpression) { - method.params = node.parameters.map(el => this.convertChild(el)); + method.params = this.convertChildren(node.parameters); result = this.createNode(node, { type: AST_NODE_TYPES.Property, @@ -1604,10 +1424,7 @@ export class Converter { /** * TypeScript class methods can be defined as "abstract" */ - const methodDefinitionType = hasModifier( - SyntaxKind.AbstractKeyword, - node, - ) + const methodDefinitionType = isAbstract ? AST_NODE_TYPES.TSAbstractMethodDefinition : AST_NODE_TYPES.MethodDefinition; @@ -1617,8 +1434,7 @@ export class Converter { type: methodDefinitionType, accessibility: getTSNodeAccessibility(node), computed: isComputedProperty(node.name), - decorators: - getDecorators(node)?.map(el => this.convertChild(el)) ?? [], + decorators: this.convertChildren(getDecorators(node) ?? []), key: this.convertChild(node.name), kind: 'method', optional: !!node.questionToken, @@ -1676,14 +1492,24 @@ export class Converter { this.fixParentLocation(constructor, constructor.typeParameters.range); } - const constructorKey = this.createNode(node, { - type: AST_NODE_TYPES.Identifier, - range: [constructorToken.getStart(this.ast), constructorToken.end], - decorators: [], - name: 'constructor', - optional: false, - typeAnnotation: undefined, - }); + const constructorKey = + constructorToken.kind === SyntaxKind.StringLiteral + ? this.createNode(constructorToken, { + type: AST_NODE_TYPES.Literal, + raw: constructorToken.getText(), + value: 'constructor', + }) + : this.createNode(node, { + type: AST_NODE_TYPES.Identifier, + range: [ + constructorToken.getStart(this.ast), + constructorToken.end, + ], + decorators: [], + name: 'constructor', + optional: false, + typeAnnotation: undefined, + }); const isStatic = hasModifier(SyntaxKind.StaticKeyword, node); @@ -1888,7 +1714,13 @@ export class Converter { return result; } - case SyntaxKind.TaggedTemplateExpression: + case SyntaxKind.TaggedTemplateExpression: { + if (node.tag.flags & ts.NodeFlags.OptionalChain) { + this.#throwError( + node, + 'Tagged template expressions are not permitted in an optional chain.', + ); + } return this.createNode(node, { type: AST_NODE_TYPES.TaggedTemplateExpression, quasi: this.convertChild(node.template), @@ -1900,6 +1732,7 @@ export class Converter { node, ), }); + } case SyntaxKind.TemplateHead: case SyntaxKind.TemplateMiddle: @@ -2083,16 +1916,14 @@ export class Converter { body: this.createNode(node, { type: AST_NODE_TYPES.ClassBody, range: [node.members.pos - 1, node.end], - body: node.members - .filter(isESTreeClassMember) - .map(el => this.convertChild(el)), + body: this.convertChildren( + node.members.filter(isESTreeClassMember), + ), }), declare: hasModifier(SyntaxKind.DeclareKeyword, node), - decorators: - getDecorators(node)?.map(el => this.convertChild(el)) ?? [], + decorators: this.convertChildren(getDecorators(node) ?? []), id: this.convertChild(node.name), - implements: - implementsClause?.types.map(el => this.convertChild(el)) ?? [], + implements: this.convertChildren(implementsClause?.types ?? []), superClass: extendsClause?.types[0] ? this.convertChild(extendsClause.types[0].expression) : null, @@ -2130,10 +1961,7 @@ export class Converter { this.#withDeprecatedAliasGetter( { type: AST_NODE_TYPES.ImportDeclaration, - attributes: this.convertImportAttributes( - // eslint-disable-next-line @typescript-eslint/no-deprecated - node.attributes ?? node.assertClause, - ), + attributes: this.convertImportAttributes(node), importKind: 'value', source: this.convertChild(node.moduleSpecifier), specifiers: [], @@ -2145,6 +1973,9 @@ export class Converter { ); if (node.importClause) { + // TODO(bradzacher) swap to `phaseModifier` once we add support for `import defer` + // https://github.com/estree/estree/issues/328 + // eslint-disable-next-line @typescript-eslint/no-deprecated if (node.importClause.isTypeOnly) { result.importKind = 'type'; } @@ -2166,9 +1997,9 @@ export class Converter { break; case SyntaxKind.NamedImports: result.specifiers.push( - ...node.importClause.namedBindings.elements.map( - el => this.convertChild(el) as TSESTree.ImportClause, - ), + ...(this.convertChildren( + node.importClause.namedBindings.elements, + ) as TSESTree.ImportClause[]), ); break; } @@ -2208,15 +2039,13 @@ export class Converter { this.#withDeprecatedAliasGetter( { type: AST_NODE_TYPES.ExportNamedDeclaration, - attributes: this.convertImportAttributes( - // eslint-disable-next-line @typescript-eslint/no-deprecated - node.attributes ?? node.assertClause, - ), + attributes: this.convertImportAttributes(node), declaration: null, exportKind: node.isTypeOnly ? 'type' : 'value', source: this.convertChild(node.moduleSpecifier), - specifiers: node.exportClause.elements.map(el => - this.convertChild(el, node), + specifiers: this.convertChildren( + node.exportClause.elements, + node, ), }, 'assertions', @@ -2231,10 +2060,7 @@ export class Converter { this.#withDeprecatedAliasGetter( { type: AST_NODE_TYPES.ExportAllDeclaration, - attributes: this.convertImportAttributes( - // eslint-disable-next-line @typescript-eslint/no-deprecated - node.attributes ?? node.assertClause, - ), + attributes: this.convertImportAttributes(node), exported: node.exportClause?.kind === SyntaxKind.NamespaceExport ? this.convertChild(node.exportClause.name) @@ -2346,6 +2172,21 @@ export class Converter { // Binary Operations case SyntaxKind.BinaryExpression: { + if ( + node.operatorToken.kind !== SyntaxKind.InKeyword && + node.left.kind === SyntaxKind.PrivateIdentifier + ) { + this.#throwError( + node.left, + "Private identifiers cannot appear on the right-hand-side of an 'in' expression.", + ); + } else if (node.right.kind === SyntaxKind.PrivateIdentifier) { + this.#throwError( + node.right, + "Private identifiers are only allowed on the left-hand-side of an 'in' expression.", + ); + } + // TypeScript uses BinaryExpression for sequences as well if (isComma(node.operatorToken)) { const result = this.createNode(node, { @@ -2455,7 +2296,7 @@ export class Converter { } const callee = this.convertChild(node.expression); - const args = node.arguments.map(el => this.convertChild(el)); + const args = this.convertChildren(node.arguments); const typeArguments = node.typeArguments && this.convertTypeArgumentsToTypeParameterInstantiation( @@ -2485,9 +2326,7 @@ export class Converter { // NOTE - NewExpression cannot have an optional chain in it return this.createNode(node, { type: AST_NODE_TYPES.NewExpression, - arguments: node.arguments - ? node.arguments.map(el => this.convertChild(el)) - : [], + arguments: this.convertChildren(node.arguments ?? []), callee: this.convertChild(node.expression), typeArguments, }); @@ -2625,7 +2464,7 @@ export class Converter { case SyntaxKind.JsxElement: return this.createNode(node, { type: AST_NODE_TYPES.JSXElement, - children: node.children.map(el => this.convertChild(el)), + children: this.convertChildren(node.children), closingElement: this.convertChild(node.closingElement), openingElement: this.convertChild(node.openingElement), }); @@ -2633,7 +2472,7 @@ export class Converter { case SyntaxKind.JsxFragment: return this.createNode(node, { type: AST_NODE_TYPES.JSXFragment, - children: node.children.map(el => this.convertChild(el)), + children: this.convertChildren(node.children), closingFragment: this.convertChild(node.closingFragment), openingFragment: this.convertChild(node.openingFragment), }); @@ -2650,9 +2489,7 @@ export class Converter { openingElement: this.createNode(node, { type: AST_NODE_TYPES.JSXOpeningElement, range: getRange(node, this.ast), - attributes: node.attributes.properties.map(el => - this.convertChild(el), - ), + attributes: this.convertChildren(node.attributes.properties), name: this.convertJSXTagName(node.tagName, node), selfClosing: true, typeArguments: node.typeArguments @@ -2668,9 +2505,7 @@ export class Converter { case SyntaxKind.JsxOpeningElement: { return this.createNode(node, { type: AST_NODE_TYPES.JSXOpeningElement, - attributes: node.attributes.properties.map(el => - this.convertChild(el), - ), + attributes: this.convertChildren(node.attributes.properties), name: this.convertJSXTagName(node.tagName, node), selfClosing: false, typeArguments: @@ -2813,7 +2648,7 @@ export class Converter { case SyntaxKind.TypeLiteral: { return this.createNode(node, { type: AST_NODE_TYPES.TSTypeLiteral, - members: node.members.map(el => this.convertChild(el)), + members: this.convertChildren(node.members), }); } @@ -2937,7 +2772,7 @@ export class Converter { return this.createNode(node, { type: AST_NODE_TYPES.TSIndexSignature, accessibility: getTSNodeAccessibility(node), - parameters: node.parameters.map(el => this.convertChild(el)), + parameters: this.convertChildren(node.parameters), readonly: hasModifier(SyntaxKind.ReadonlyKeyword, node), static: hasModifier(SyntaxKind.StaticKeyword, node), typeAnnotation: @@ -3024,6 +2859,7 @@ export class Converter { const interfaceHeritageClauses = node.heritageClauses ?? []; const interfaceExtends: TSESTree.TSInterfaceHeritage[] = []; + let seenExtendsClause = false; for (const heritageClause of interfaceHeritageClauses) { if (heritageClause.token !== SyntaxKind.ExtendsKeyword) { this.#throwError( @@ -3033,8 +2869,21 @@ export class Converter { : 'Unexpected token.', ); } + if (seenExtendsClause) { + this.#throwError(heritageClause, "'extends' clause already seen."); + } + seenExtendsClause = true; for (const heritageType of heritageClause.types) { + if ( + !isEntityNameExpression(heritageType.expression) || + ts.isOptionalChain(heritageType.expression) + ) { + this.#throwError( + heritageType, + 'Interface declaration can only extend an identifier/qualified name with optional type arguments.', + ); + } interfaceExtends.push( this.convertChild( heritageType, @@ -3049,7 +2898,7 @@ export class Converter { body: this.createNode(node, { type: AST_NODE_TYPES.TSInterfaceBody, range: [node.members.pos - 1, node.end], - body: node.members.map(member => this.convertChild(member)), + body: this.convertChildren(node.members), }), declare: hasModifier(SyntaxKind.DeclareKeyword, node), extends: interfaceExtends, @@ -3113,11 +2962,16 @@ export class Converter { const commaToken = findNextToken(node.argument, node, this.ast)!; const openBraceToken = findNextToken(commaToken, node, this.ast)!; - const closeBraceToken = findNextToken( + const tokenAfterAttributes = findNextToken( node.attributes, node, this.ast, )!; + // Since TS 5.9, there could be a trailing comma, i.e. `{ with: { ... }, }` + const closeBraceToken = + tokenAfterAttributes.kind === ts.SyntaxKind.CommaToken + ? findNextToken(tokenAfterAttributes, node, this.ast)! + : tokenAfterAttributes; const withOrAssertToken = findNextToken( openBraceToken, node, @@ -3180,7 +3034,7 @@ export class Converter { } case SyntaxKind.EnumDeclaration: { - const members = node.members.map(el => this.convertChild(el)); + const members = this.convertChildren(node.members); const result = this.createNode( node, this.#withDeprecatedGetter( @@ -3197,7 +3051,7 @@ export class Converter { }, 'members', `'body.members'`, - node.members.map(el => this.convertChild(el)), + this.convertChildren(node.members), ), ); @@ -3205,12 +3059,38 @@ export class Converter { } case SyntaxKind.EnumMember: { - return this.createNode(node, { - type: AST_NODE_TYPES.TSEnumMember, - computed: node.name.kind === ts.SyntaxKind.ComputedPropertyName, - id: this.convertChild(node.name), - initializer: node.initializer && this.convertChild(node.initializer), - }); + const computed = node.name.kind === ts.SyntaxKind.ComputedPropertyName; + if (computed) { + this.#throwUnlessAllowInvalidAST( + node.name, + 'Computed property names are not allowed in enums.', + ); + } + + if ( + node.name.kind === SyntaxKind.NumericLiteral || + node.name.kind === SyntaxKind.BigIntLiteral + ) { + this.#throwUnlessAllowInvalidAST( + node.name, + 'An enum member cannot have a numeric name.', + ); + } + + return this.createNode( + node, + this.#withDeprecatedGetter( + { + type: AST_NODE_TYPES.TSEnumMember, + id: this.convertChild(node.name), + initializer: + node.initializer && this.convertChild(node.initializer), + }, + 'computed', + undefined, + computed, + ), + ); } case SyntaxKind.ModuleDeclaration: { @@ -3348,13 +3228,13 @@ export class Converter { case SyntaxKind.UnionType: { return this.createNode(node, { type: AST_NODE_TYPES.TSUnionType, - types: node.types.map(el => this.convertChild(el)), + types: this.convertChildren(node.types), }); } case SyntaxKind.IntersectionType: { return this.createNode(node, { type: AST_NODE_TYPES.TSIntersectionType, - types: node.types.map(el => this.convertChild(el)), + types: this.convertChildren(node.types), }); } case SyntaxKind.AsExpression: { @@ -3428,7 +3308,7 @@ export class Converter { // Tuple case SyntaxKind.TupleType: { - const elementTypes = node.elements.map(el => this.convertChild(el)); + const elementTypes = this.convertChildren(node.elements); return this.createNode(node, { type: AST_NODE_TYPES.TSTupleType, @@ -3587,7 +3467,7 @@ export class Converter { } const decorators = getDecorators(node); if (decorators?.length) { - result.decorators = decorators.map(el => this.convertChild(el)); + result.decorators = this.convertChildren(decorators); } // keys we never want to clone from the base typescript node as they @@ -3619,7 +3499,7 @@ export class Converter { .filter(([key]) => !KEYS_TO_NOT_COPY.has(key)) .forEach(([key, value]) => { if (Array.isArray(value)) { - result[key] = value.map(el => this.convertChild(el as TSNode)); + result[key] = this.convertChildren(value); } 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 as TSNode); diff --git a/packages/typescript-estree/src/create-program/shared.ts b/packages/typescript-estree/src/create-program/shared.ts index 07a67cbb9b38..68d8a4e0e0d8 100644 --- a/packages/typescript-estree/src/create-program/shared.ts +++ b/packages/typescript-estree/src/create-program/shared.ts @@ -1,5 +1,6 @@ import type { Program } from 'typescript'; +import { CORE_COMPILER_OPTIONS } from '@typescript-eslint/tsconfig-utils'; import path from 'node:path'; import * as ts from 'typescript'; @@ -15,19 +16,6 @@ export interface ASTAndDefiniteProgram { } export type ASTAndProgram = ASTAndDefiniteProgram | ASTAndNoProgram; -/** - * Compiler options required to avoid critical functionality issues - */ -export 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 - */ - noUnusedLocals: true, - noUnusedParameters: true, -}; - /** * Default compiler options for program generation */ @@ -82,9 +70,7 @@ export function getCanonicalFileName(filePath: string): CanonicalPath { } export function ensureAbsolutePath(p: string, tsconfigRootDir: string): string { - return path.isAbsolute(p) - ? p - : path.join(tsconfigRootDir || process.cwd(), p); + return path.resolve(tsconfigRootDir, p); } export function canonicalDirname(p: CanonicalPath): CanonicalPath { diff --git a/packages/typescript-estree/src/create-program/useProvidedPrograms.ts b/packages/typescript-estree/src/create-program/useProvidedPrograms.ts index f84767ea19c7..cd51c92100d2 100644 --- a/packages/typescript-estree/src/create-program/useProvidedPrograms.ts +++ b/packages/typescript-estree/src/create-program/useProvidedPrograms.ts @@ -1,3 +1,4 @@ +import { getParsedConfigFile } from '@typescript-eslint/tsconfig-utils'; import debug from 'debug'; import * as path from 'node:path'; import * as ts from 'typescript'; @@ -5,7 +6,6 @@ import * as ts from 'typescript'; import type { ParseSettings } from '../parseSettings'; import type { ASTAndDefiniteProgram } from './shared'; -import { getParsedConfigFile } from './getParsedConfigFile'; import { getAstFromProgram } from './shared'; const log = debug( @@ -15,7 +15,7 @@ const log = debug( export function useProvidedPrograms( programInstances: Iterable, parseSettings: ParseSettings, -): ASTAndDefiniteProgram | undefined { +): ASTAndDefiniteProgram { log( 'Retrieving ast for %s from provided program instance(s)', parseSettings.filePath, diff --git a/packages/typescript-estree/src/index.ts b/packages/typescript-estree/src/index.ts index 39e921e8762a..654ea73982d2 100644 --- a/packages/typescript-estree/src/index.ts +++ b/packages/typescript-estree/src/index.ts @@ -16,6 +16,10 @@ export type { ParserServicesWithTypeInformation, TSESTreeOptions, } from './parser-options'; +export { + addCandidateTSConfigRootDir, + clearCandidateTSConfigRootDirs, +} from './parseSettings/candidateTSConfigRootDirs'; export { simpleTraverse } from './simple-traverse'; export * from './ts-estree'; export { typescriptVersionIsAtLeast } from './version-check'; diff --git a/packages/typescript-estree/src/node-utils.ts b/packages/typescript-estree/src/node-utils.ts index f2f60c777bd1..b5990014e589 100644 --- a/packages/typescript-estree/src/node-utils.ts +++ b/packages/typescript-estree/src/node-utils.ts @@ -1,6 +1,6 @@ import * as ts from 'typescript'; -import type { TSESTree, TSNode } from './ts-estree'; +import type { TSESTree } from './ts-estree'; import { getModifiers } from './getModifiers'; import { xhtmlEntities } from './jsx/xhtml-entities'; @@ -477,24 +477,8 @@ export function isChildUnwrappableOptionalChain( export function getTokenType( token: ts.Identifier | ts.Token, ): Exclude { - let keywordKind: ts.SyntaxKind | undefined; - if (isAtLeast50 && token.kind === SyntaxKind.Identifier) { - keywordKind = ts.identifierToKeywordKind(token as ts.Identifier); - } else if ('originalKeywordKind' in token) { - // @ts-expect-error -- intentional fallback for older TS versions <=4.9 - keywordKind = token.originalKeywordKind; - } - if (keywordKind) { - if (keywordKind === SyntaxKind.NullKeyword) { - return AST_TOKEN_TYPES.Null; - } - if ( - keywordKind >= SyntaxKind.FirstFutureReservedWord && - keywordKind <= SyntaxKind.LastKeyword - ) { - return AST_TOKEN_TYPES.Identifier; - } - return AST_TOKEN_TYPES.Keyword; + if (token.kind === SyntaxKind.NullKeyword) { + return AST_TOKEN_TYPES.Null; } if ( @@ -708,15 +692,6 @@ export function createError( return new TSError(message, ast.fileName, { end, start }); } -export function nodeHasIllegalDecorators( - node: ts.Node, -): node is { illegalDecorators: ts.Node[] } & ts.Node { - return !!( - 'illegalDecorators' in node && - (node.illegalDecorators as unknown[] | undefined)?.length - ); -} - 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. @@ -778,113 +753,6 @@ export function isThisInTypeQuery(node: ts.Node): boolean { return node.parent.kind === SyntaxKind.TypeQuery; } -// `ts.nodeIsMissing` -function nodeIsMissing(node: ts.Node | undefined): boolean { - if (node == null) { - return true; - } - return ( - node.pos === node.end && - node.pos >= 0 && - node.kind !== SyntaxKind.EndOfFileToken - ); -} - -// `ts.nodeIsPresent` -export function nodeIsPresent(node: ts.Node | undefined): node is ts.Node { - return !nodeIsMissing(node); -} - -// `ts.getContainingFunction` -export function getContainingFunction( - node: ts.Node, -): ts.SignatureDeclaration | undefined { - return ts.findAncestor(node.parent, ts.isFunctionLike); -} - -// `ts.hasAbstractModifier` -function hasAbstractModifier(node: ts.Node): boolean { - return hasModifier(SyntaxKind.AbstractKeyword, node); -} - -// `ts.getThisParameter` -function getThisParameter( - signature: ts.SignatureDeclaration, -): ts.ParameterDeclaration | null { - if (signature.parameters.length && !ts.isJSDocSignature(signature)) { - const thisParameter = signature.parameters[0]; - if (parameterIsThisKeyword(thisParameter)) { - return thisParameter; - } - } - - return null; -} - -// `ts.parameterIsThisKeyword` -function parameterIsThisKeyword(parameter: ts.ParameterDeclaration): boolean { - return isThisIdentifier(parameter.name); -} - -// Rewrite version of `ts.nodeCanBeDecorated` -// Returns `true` for both `useLegacyDecorators: true` and `useLegacyDecorators: false` -export function nodeCanBeDecorated(node: TSNode): boolean { - switch (node.kind) { - case SyntaxKind.ClassDeclaration: - return true; - case SyntaxKind.ClassExpression: - // `ts.nodeCanBeDecorated` returns `false` if `useLegacyDecorators: true` - return true; - case SyntaxKind.PropertyDeclaration: { - const { parent } = node; - - // `ts.nodeCanBeDecorated` uses this if `useLegacyDecorators: true` - if (ts.isClassDeclaration(parent)) { - return true; - } - - // `ts.nodeCanBeDecorated` uses this if `useLegacyDecorators: false` - if (ts.isClassLike(parent) && !hasAbstractModifier(node)) { - return true; - } - - return false; - } - case SyntaxKind.GetAccessor: - case SyntaxKind.SetAccessor: - case SyntaxKind.MethodDeclaration: { - const { parent } = node; - // In `ts.nodeCanBeDecorated` - // when `useLegacyDecorators: true` uses `ts.isClassDeclaration` - // when `useLegacyDecorators: true` uses `ts.isClassLike` - return ( - Boolean(node.body) && - (ts.isClassDeclaration(parent) || ts.isClassLike(parent)) - ); - } - case SyntaxKind.Parameter: { - // `ts.nodeCanBeDecorated` returns `false` if `useLegacyDecorators: false` - - const { parent } = node; - const grandparent = parent.parent; - - return ( - Boolean(parent) && - 'body' in parent && - Boolean(parent.body) && - (parent.kind === SyntaxKind.Constructor || - parent.kind === SyntaxKind.MethodDeclaration || - parent.kind === SyntaxKind.SetAccessor) && - getThisParameter(parent) !== node && - Boolean(grandparent) && - grandparent.kind === SyntaxKind.ClassDeclaration - ); - } - } - - return false; -} - export function isValidAssignmentTarget(node: ts.Node): boolean { switch (node.kind) { case SyntaxKind.Identifier: @@ -935,3 +803,12 @@ export function getNamespaceModifiers( } return modifiers; } + +// `ts.declarationNameToString` +export function declarationNameToString( + name: ts.Node, + ast: ts.SourceFile, +): string { + const text = ast.text.slice(name.pos, name.end).trimStart(); + return text || '(Missing)'; +} diff --git a/packages/typescript-estree/src/parseSettings/candidateTSConfigRootDirs.ts b/packages/typescript-estree/src/parseSettings/candidateTSConfigRootDirs.ts new file mode 100644 index 000000000000..13e19c8aac8a --- /dev/null +++ b/packages/typescript-estree/src/parseSettings/candidateTSConfigRootDirs.ts @@ -0,0 +1,31 @@ +const candidateTSConfigRootDirs = new Set(); + +export function addCandidateTSConfigRootDir(candidate: string): void { + candidateTSConfigRootDirs.add(candidate); +} + +export function clearCandidateTSConfigRootDirs(): void { + candidateTSConfigRootDirs.clear(); +} + +export function getInferredTSConfigRootDir(): string { + const entries = [...candidateTSConfigRootDirs]; + + switch (entries.length) { + case 0: + return process.cwd(); + + case 1: + return entries[0]; + + default: + throw new Error( + [ + 'No tsconfigRootDir was set, and multiple candidate TSConfigRootDirs are present:', + ...entries.map(candidate => ` - ${candidate}`), + "You'll need to explicitly set tsconfigRootDir in your parser options.", + 'See: https://typescript-eslint.io/packages/parser/#tsconfigrootdir', + ].join('\n'), + ); + } +} diff --git a/packages/typescript-estree/src/parseSettings/createParseSettings.ts b/packages/typescript-estree/src/parseSettings/createParseSettings.ts index 6a1c42008c6b..15bd7840a4e9 100644 --- a/packages/typescript-estree/src/parseSettings/createParseSettings.ts +++ b/packages/typescript-estree/src/parseSettings/createParseSettings.ts @@ -1,14 +1,21 @@ +import type { + CreateProjectServiceSettings, + ProjectServiceAndMetadata, +} from '@typescript-eslint/project-service'; +import type { ProjectServiceOptions } from '@typescript-eslint/types'; + +import { createProjectService } from '@typescript-eslint/project-service'; import debug from 'debug'; import path from 'node:path'; import * as ts from 'typescript'; -import type { ProjectServiceSettings } from '../create-program/createProjectService'; import type { TSESTreeOptions } from '../parser-options'; import type { MutableParseSettings } from './index'; -import { createProjectService } from '../create-program/createProjectService'; import { ensureAbsolutePath } from '../create-program/shared'; +import { validateDefaultProjectForFilesGlob } from '../create-program/validateDefaultProjectForFilesGlob'; import { isSourceFile } from '../source-files'; +import { getInferredTSConfigRootDir } from './candidateTSConfigRootDirs'; import { DEFAULT_TSCONFIG_CACHE_DURATION_SECONDS, ExpiringCache, @@ -23,7 +30,7 @@ const log = debug( ); let TSCONFIG_MATCH_CACHE: ExpiringCache | null; -let TSSERVER_PROJECT_SERVICE: ProjectServiceSettings | null = null; +let TSSERVER_PROJECT_SERVICE: ProjectServiceAndMetadata | null = null; // NOTE - we intentionally use "unnecessary" `?.` here because in TS<5.3 this enum doesn't exist // This object exists so we can centralize these for tracking and so we don't proliferate these across the file @@ -43,10 +50,44 @@ export function createParseSettings( ): MutableParseSettings { const codeFullText = enforceCodeString(code); const singleRun = inferSingleRun(tsestreeOptions); - const tsconfigRootDir = - typeof tsestreeOptions.tsconfigRootDir === 'string' - ? tsestreeOptions.tsconfigRootDir - : process.cwd(); + + const tsconfigRootDir = (() => { + if (tsestreeOptions.tsconfigRootDir == null) { + const inferredTsconfigRootDir = getInferredTSConfigRootDir(); + if (path.resolve(inferredTsconfigRootDir) !== inferredTsconfigRootDir) { + throw new Error( + `inferred tsconfigRootDir should be a resolved absolute path, but received: ${JSON.stringify( + inferredTsconfigRootDir, + )}. This is a bug in typescript-eslint! Please report it to us at https://github.com/typescript-eslint/typescript-eslint/issues/new/choose.`, + ); + } + return inferredTsconfigRootDir; + } + + if (typeof tsestreeOptions.tsconfigRootDir === 'string') { + const userProvidedTsconfigRootDir = tsestreeOptions.tsconfigRootDir; + if ( + !path.isAbsolute(userProvidedTsconfigRootDir) || + // Ensure it's fully absolute with a drive letter if windows + (process.platform === 'win32' && + !/^[a-zA-Z]:/.test(userProvidedTsconfigRootDir)) + ) { + throw new Error( + `parserOptions.tsconfigRootDir must be an absolute path, but received: ${JSON.stringify( + userProvidedTsconfigRootDir, + )}. This is a bug in your configuration; please supply an absolute path.`, + ); + } + // Deal with any funny business around trailing path separators (a/b/) or relative path segments (/a/b/../c) + // Since we already know it's absolute, we can safely use path.resolve here. + return path.resolve(userProvidedTsconfigRootDir); + } + + throw new Error( + `If provided, parserOptions.tsconfigRootDir must be a string, but received a value of type "${typeof tsestreeOptions.tsconfigRootDir}"`, + ); + })(); + const passedLoggerFn = typeof tsestreeOptions.loggerFn === 'function'; const filePath = ensureAbsolutePath( typeof tsestreeOptions.filePath === 'string' && @@ -112,11 +153,10 @@ export function createParseSettings( (tsestreeOptions.project && tsestreeOptions.projectService !== false && process.env.TYPESCRIPT_ESLINT_PROJECT_SERVICE === 'true') - ? (TSSERVER_PROJECT_SERVICE ??= createProjectService( - tsestreeOptions.projectService, + ? populateProjectService(tsestreeOptions.projectService, { jsDocParsingMode, tsconfigRootDir, - )) + }) : undefined, setExternalModuleIndicator: tsestreeOptions.sourceType === 'module' || @@ -140,6 +180,19 @@ export function createParseSettings( tsconfigRootDir, }; + // TODO: Eventually, parse settings will be validated more thoroughly. + // https://github.com/typescript-eslint/typescript-eslint/issues/6403 + if ( + parseSettings.projectService && + tsestreeOptions.project && + process.env.TYPESCRIPT_ESLINT_IGNORE_PROJECT_AND_PROJECT_SERVICE_ERROR !== + 'true' + ) { + throw new Error( + 'Enabling "project" does nothing when "projectService" is enabled. You can remove the "project" setting.', + ); + } + // debug doesn't support multiple `enable` calls, so have to do it all at once if (parseSettings.debugLevel.size > 0) { const namespaces = []; @@ -223,3 +276,19 @@ function enforceCodeString(code: unknown): string { function getFileName(jsx?: boolean): string { return jsx ? 'estree.tsx' : 'estree.ts'; } + +function populateProjectService( + optionsRaw: ProjectServiceOptions | true | undefined, + settings: CreateProjectServiceSettings, +) { + const options = typeof optionsRaw === 'object' ? optionsRaw : {}; + + validateDefaultProjectForFilesGlob(options.allowDefaultProject); + + TSSERVER_PROJECT_SERVICE ??= createProjectService({ + options, + ...settings, + }); + + return TSSERVER_PROJECT_SERVICE; +} diff --git a/packages/typescript-estree/src/parseSettings/index.ts b/packages/typescript-estree/src/parseSettings/index.ts index 1ea208210e0a..f4d771a8a4bb 100644 --- a/packages/typescript-estree/src/parseSettings/index.ts +++ b/packages/typescript-estree/src/parseSettings/index.ts @@ -1,6 +1,6 @@ +import type { ProjectServiceAndMetadata } from '@typescript-eslint/project-service'; import type * as ts from 'typescript'; -import type { ProjectServiceSettings } from '../create-program/createProjectService'; import type { CanonicalPath } from '../create-program/shared'; import type { TSESTree } from '../ts-estree'; import type { CacheLike } from './ExpiringCache'; @@ -120,7 +120,7 @@ export interface MutableParseSettings { /** * TypeScript server to power program creation. */ - projectService: ProjectServiceSettings | undefined; + projectService: ProjectServiceAndMetadata | undefined; /** * Whether to add the `range` property to AST nodes. diff --git a/packages/typescript-estree/src/parseSettings/warnAboutTSVersion.ts b/packages/typescript-estree/src/parseSettings/warnAboutTSVersion.ts index 8ac2801476bd..2d8f42d52540 100644 --- a/packages/typescript-estree/src/parseSettings/warnAboutTSVersion.ts +++ b/packages/typescript-estree/src/parseSettings/warnAboutTSVersion.ts @@ -8,7 +8,7 @@ import { version as TYPESCRIPT_ESTREE_VERSION } from '../version'; /** * This needs to be kept in sync with package.json in the typescript-eslint monorepo */ -export const SUPPORTED_TYPESCRIPT_VERSIONS = '>=4.8.4 <5.9.0'; +export const SUPPORTED_TYPESCRIPT_VERSIONS = '>=4.8.4 <6.0.0'; /* * The semver package will ignore prerelease ranges, and we don't want to explicitly document every one diff --git a/packages/typescript-estree/src/parser-options.ts b/packages/typescript-estree/src/parser-options.ts index d3f8c8649fc5..a1841a828d48 100644 --- a/packages/typescript-estree/src/parser-options.ts +++ b/packages/typescript-estree/src/parser-options.ts @@ -9,8 +9,6 @@ import type * as ts from 'typescript'; import type { TSESTree, TSESTreeToTSNode, TSNode, TSToken } from './ts-estree'; -export type { ProjectServiceOptions } from '@typescript-eslint/types'; - ////////////////////////////////////////////////////////// // MAKE SURE THIS IS KEPT IN SYNC WITH THE WEBSITE DOCS // ////////////////////////////////////////////////////////// diff --git a/packages/typescript-estree/src/parser.ts b/packages/typescript-estree/src/parser.ts index 1c0c6e42aa83..2841d1b1bc39 100644 --- a/packages/typescript-estree/src/parser.ts +++ b/packages/typescript-estree/src/parser.ts @@ -68,13 +68,7 @@ function getProgramAndAST( } if (parseSettings.programs) { - const fromProvidedPrograms = useProvidedPrograms( - parseSettings.programs, - parseSettings, - ); - if (fromProvidedPrograms) { - return fromProvidedPrograms; - } + return useProvidedPrograms(parseSettings.programs, parseSettings); } // no need to waste time creating a program as the caller didn't want parser services diff --git a/packages/typescript-estree/src/useProgramFromProjectService.ts b/packages/typescript-estree/src/useProgramFromProjectService.ts index cf98e5523921..fec277ce4ea6 100644 --- a/packages/typescript-estree/src/useProgramFromProjectService.ts +++ b/packages/typescript-estree/src/useProgramFromProjectService.ts @@ -1,10 +1,11 @@ +import type { ProjectServiceAndMetadata } from '@typescript-eslint/project-service'; + import debug from 'debug'; import { minimatch } from 'minimatch'; import path from 'node:path'; import util from 'node:util'; import * as ts from 'typescript'; -import type { ProjectServiceSettings } from './create-program/createProjectService'; import type { ASTAndDefiniteProgram, ASTAndNoProgram, @@ -55,7 +56,7 @@ function openClientFileFromProjectService( isDefaultProjectAllowed: boolean, filePathAbsolute: string, parseSettings: Readonly, - serviceSettings: ProjectServiceSettings, + serviceAndSettings: ProjectServiceAndMetadata, ): ts.server.OpenConfiguredProjectResult { const opened = openClientFileAndMaybeReload(); @@ -95,8 +96,24 @@ function openClientFileFromProjectService( } if (!isDefaultProjectAllowed) { + const baseMessage = `${wasNotFound}. Consider either including it in the tsconfig.json or including it in allowDefaultProject.`; + const allowDefaultProject = + parseSettings.projectService?.allowDefaultProject; + + if (!allowDefaultProject) { + throw new Error(baseMessage); + } + + const relativeFilePath = path.relative( + parseSettings.tsconfigRootDir, + filePathAbsolute, + ); + throw new Error( - `${wasNotFound}. Consider either including it in the tsconfig.json or including it in allowDefaultProject.`, + [ + baseMessage, + `allowDefaultProject is set to ${JSON.stringify(allowDefaultProject)}, which does not match '${relativeFilePath}'.`, + ].join('\n'), ); } } @@ -107,7 +124,7 @@ function openClientFileFromProjectService( defaultProjectMatchedFiles.add(filePathAbsolute); if ( defaultProjectMatchedFiles.size > - serviceSettings.maximumDefaultProjectFileMatchCount + serviceAndSettings.maximumDefaultProjectFileMatchCount ) { const filePrintLimit = 20; const filesToPrint = [...defaultProjectMatchedFiles].slice( @@ -118,7 +135,7 @@ function openClientFileFromProjectService( defaultProjectMatchedFiles.size - filesToPrint.length; throw new Error( - `Too many files (>${serviceSettings.maximumDefaultProjectFileMatchCount}) have matched the default project.${DEFAULT_PROJECT_FILES_ERROR_EXPLANATION} + `Too many files (>${serviceAndSettings.maximumDefaultProjectFileMatchCount}) have matched the default project.${DEFAULT_PROJECT_FILES_ERROR_EXPLANATION} Matching files: ${filesToPrint.map(file => `- ${file}`).join('\n')} ${truncatedFileCount ? `...and ${truncatedFileCount} more files\n` : ''} @@ -131,7 +148,7 @@ If you absolutely need more files included, set parserOptions.projectService.max return opened; function openClientFile(): ts.server.OpenConfiguredProjectResult { - return serviceSettings.service.openClientFile( + return serviceAndSettings.service.openClientFile( filePathAbsolute, parseSettings.codeFullText, /* scriptKind */ undefined, @@ -152,13 +169,13 @@ If you absolutely need more files included, set parserOptions.projectService.max !opened.configFileName && !parseSettings.singleRun && !isDefaultProjectAllowed && - performance.now() - serviceSettings.lastReloadTimestamp > + performance.now() - serviceAndSettings.lastReloadTimestamp > RELOAD_THROTTLE_MS ) { log('No config file found; reloading project service and retrying.'); - serviceSettings.service.reloadProjects(); + serviceAndSettings.service.reloadProjects(); opened = openClientFile(); - serviceSettings.lastReloadTimestamp = performance.now(); + serviceAndSettings.lastReloadTimestamp = performance.now(); } return opened; @@ -192,13 +209,13 @@ function createNoProgramWithProjectService( function retrieveASTAndProgramFor( filePathAbsolute: string, parseSettings: Readonly, - serviceSettings: ProjectServiceSettings, + serviceAndSettings: ProjectServiceAndMetadata, ): ASTAndDefiniteProgram | undefined { log('Retrieving script info and then program for: %s', filePathAbsolute); - const scriptInfo = serviceSettings.service.getScriptInfo(filePathAbsolute); + const scriptInfo = serviceAndSettings.service.getScriptInfo(filePathAbsolute); /* eslint-disable @typescript-eslint/no-non-null-assertion */ - const program = serviceSettings.service + const program = serviceAndSettings.service .getDefaultProjectForFile(scriptInfo!.fileName, true)! .getLanguageService(/*ensureSynchronized*/ true) .getProgram(); @@ -215,38 +232,41 @@ function retrieveASTAndProgramFor( } export function useProgramFromProjectService( - settings: ProjectServiceSettings, + serviceAndSettings: ProjectServiceAndMetadata, parseSettings: Readonly, hasFullTypeInformation: boolean, defaultProjectMatchedFiles: Set, ): ASTAndProgram | undefined; export function useProgramFromProjectService( - settings: ProjectServiceSettings, + serviceAndSettings: ProjectServiceAndMetadata, parseSettings: Readonly, hasFullTypeInformation: true, defaultProjectMatchedFiles: Set, ): ASTAndDefiniteProgram | undefined; export function useProgramFromProjectService( - settings: ProjectServiceSettings, + serviceAndSettings: ProjectServiceAndMetadata, parseSettings: Readonly, hasFullTypeInformation: false, defaultProjectMatchedFiles: Set, ): ASTAndNoProgram | undefined; export function useProgramFromProjectService( - serviceSettings: ProjectServiceSettings, + serviceAndSettings: ProjectServiceAndMetadata, parseSettings: Readonly, hasFullTypeInformation: boolean, defaultProjectMatchedFiles: Set, ): ASTAndProgram | undefined { // NOTE: triggers a full project reload when changes are detected updateExtraFileExtensions( - serviceSettings.service, + serviceAndSettings.service, parseSettings.extraFileExtensions, ); // We don't canonicalize the filename because it caused a performance regression. // See https://github.com/typescript-eslint/typescript-eslint/issues/8519 - const filePathAbsolute = absolutify(parseSettings.filePath, serviceSettings); + const filePathAbsolute = absolutify( + parseSettings.filePath, + serviceAndSettings, + ); log( 'Opening project service file for: %s at absolute path %s', parseSettings.filePath, @@ -259,7 +279,7 @@ export function useProgramFromProjectService( ); const isDefaultProjectAllowed = filePathMatchedBy( filePathRelative, - serviceSettings.allowDefaultProject, + serviceAndSettings.allowDefaultProject, ); // Type-aware linting is disabled for this file. @@ -268,7 +288,7 @@ export function useProgramFromProjectService( return createNoProgramWithProjectService( filePathAbsolute, parseSettings, - serviceSettings.service, + serviceAndSettings.service, ); } @@ -284,7 +304,7 @@ export function useProgramFromProjectService( isDefaultProjectAllowed, filePathAbsolute, parseSettings, - serviceSettings, + serviceAndSettings, ); log('Opened project service file: %o', opened); @@ -292,22 +312,27 @@ export function useProgramFromProjectService( return retrieveASTAndProgramFor( filePathAbsolute, parseSettings, - serviceSettings, + serviceAndSettings, ); } function absolutify( filePath: string, - serviceSettings: ProjectServiceSettings, + serviceAndSettings: ProjectServiceAndMetadata, ): string { return path.isAbsolute(filePath) ? filePath - : path.join(serviceSettings.service.host.getCurrentDirectory(), filePath); + : path.join( + serviceAndSettings.service.host.getCurrentDirectory(), + filePath, + ); } function filePathMatchedBy( filePath: string, allowDefaultProject: string[] | undefined, ): boolean { - return !!allowDefaultProject?.some(pattern => minimatch(filePath, pattern)); + return !!allowDefaultProject?.some(pattern => + minimatch(filePath, pattern, { dot: true }), + ); } 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 88b6ecabdead..e1699f2c49ec 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/convert.test.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/convert.test.ts.snap @@ -274,7 +274,7 @@ exports[`convert > deeplyCopy > should convert node correctly 1`] = ` "imports": undefined, "isDeclarationFile": false, "jsDocParsingMode": 0, - "kind": 307, + "kind": 308, "languageVariant": 1, "languageVersion": 99, "libReferenceDirectives": [], diff --git a/packages/typescript-estree/tests/lib/candidateTSConfigRootDirs.test.ts b/packages/typescript-estree/tests/lib/candidateTSConfigRootDirs.test.ts new file mode 100644 index 000000000000..7536d56a205d --- /dev/null +++ b/packages/typescript-estree/tests/lib/candidateTSConfigRootDirs.test.ts @@ -0,0 +1,40 @@ +import { addCandidateTSConfigRootDir } from '../../src'; +import { + clearCandidateTSConfigRootDirs, + getInferredTSConfigRootDir, +} from '../../src/parseSettings/candidateTSConfigRootDirs'; + +describe(getInferredTSConfigRootDir, () => { + beforeEach(() => { + clearCandidateTSConfigRootDirs(); + }); + + it('returns process.cwd() when there are no candidates', () => { + const actual = getInferredTSConfigRootDir(); + + expect(actual).toBe(process.cwd()); + }); + + it('returns the candidate when there is one candidate', () => { + const candidate = 'a/b/c'; + addCandidateTSConfigRootDir(candidate); + + const actual = getInferredTSConfigRootDir(); + + expect(actual).toBe(candidate); + }); + + it('throws an error when there are multiple candidates', () => { + addCandidateTSConfigRootDir('a'); + addCandidateTSConfigRootDir('b'); + + expect(() => getInferredTSConfigRootDir()) + .toThrowErrorMatchingInlineSnapshot(` + [Error: No tsconfigRootDir was set, and multiple candidate TSConfigRootDirs are present: + - a + - b + You'll need to explicitly set tsconfigRootDir in your parser options. + See: https://typescript-eslint.io/packages/parser/#tsconfigrootdir] + `); + }); +}); diff --git a/packages/typescript-estree/tests/lib/createParseSettings.test.ts b/packages/typescript-estree/tests/lib/createParseSettings.test.ts index 846210391076..ddb9c17cbc2b 100644 --- a/packages/typescript-estree/tests/lib/createParseSettings.test.ts +++ b/packages/typescript-estree/tests/lib/createParseSettings.test.ts @@ -1,9 +1,15 @@ +import { + addCandidateTSConfigRootDir, + clearCandidateTSConfigRootDirs, +} from '../../src/parseSettings/candidateTSConfigRootDirs'; import { createParseSettings } from '../../src/parseSettings/createParseSettings'; const projectService = { service: true }; -vi.mock('../../src/create-program/createProjectService.js', () => ({ - createProjectService: (): typeof projectService => projectService, +const isWindows = process.platform === 'win32'; + +vi.mock('@typescript-eslint/project-service', () => ({ + createProjectService: () => projectService, })); describe(createParseSettings, () => { @@ -20,6 +26,10 @@ describe(createParseSettings, () => { it('is created when options.projectService is undefined, options.project is true, and process.env.TYPESCRIPT_ESLINT_PROJECT_SERVICE is true', () => { vi.stubEnv('TYPESCRIPT_ESLINT_PROJECT_SERVICE', 'true'); + vi.stubEnv( + 'TYPESCRIPT_ESLINT_IGNORE_PROJECT_AND_PROJECT_SERVICE_ERROR', + 'true', + ); const parseSettings = createParseSettings('', { project: true, @@ -29,6 +39,17 @@ describe(createParseSettings, () => { expect(parseSettings.projectService).toBe(projectService); }); + it('complains when options.projectService is true, options.project is true, and process.env.TYPESCRIPT_ESLINT_IGNORE_PROJECT_AND_PROJECT_SERVICE_ERROR is not set', () => { + expect(() => + createParseSettings('', { + project: true, + projectService: true, + }), + ).toThrowErrorMatchingInlineSnapshot( + `[Error: Enabling "project" does nothing when "projectService" is enabled. You can remove the "project" setting.]`, + ); + }); + it('is not created when options.projectService is undefined, options.project is falsy, and process.env.TYPESCRIPT_ESLINT_PROJECT_SERVICE is true', () => { vi.stubEnv('TYPESCRIPT_ESLINT_PROJECT_SERVICE', 'true'); @@ -61,4 +82,86 @@ describe(createParseSettings, () => { ); }); }); + + describe('tsconfigRootDir', () => { + beforeEach(() => { + clearCandidateTSConfigRootDirs(); + }); + + it('errors on non-absolute path', () => { + expect(() => + createParseSettings('', { tsconfigRootDir: 'a/b/c' }), + ).toThrowErrorMatchingInlineSnapshot( + `[Error: parserOptions.tsconfigRootDir must be an absolute path, but received: "a/b/c". This is a bug in your configuration; please supply an absolute path.]`, + ); + }); + + it.runIf(isWindows)( + 'complains about missing drive letter on windows', + () => { + expect(() => + createParseSettings('', { tsconfigRootDir: '\\a\\b\\c' }), + ).toThrowErrorMatchingInlineSnapshot( + `[Error: parserOptions.tsconfigRootDir must be an absolute path, but received: "\\\\a\\\\b\\\\c". This is a bug in your configuration; please supply an absolute path.]`, + ); + }, + ); + + it('normalizes crazy tsconfigRootDir', () => { + const parseSettings = createParseSettings('', { + tsconfigRootDir: !isWindows + ? '/a/b////..//c///' + : 'E:\\a\\b\\\\\\\\..\\\\c\\\\\\', + }); + + expect(parseSettings.tsconfigRootDir).toBe( + !isWindows ? '/a/c' : 'E:\\a\\c', + ); + }); + + it('errors on invalid tsconfigRootDir', () => { + expect(() => + createParseSettings('', { + // @ts-expect-error -- testing invalid input + tsconfigRootDir: 42, + }), + ).toThrowErrorMatchingInlineSnapshot( + `[Error: If provided, parserOptions.tsconfigRootDir must be a string, but received a value of type "number"]`, + ); + }); + + it('uses the provided tsconfigRootDir when it exists and no candidates exist', () => { + const tsconfigRootDir = !isWindows ? '/a/b/c' : 'F:\\b\\c'; + + const parseSettings = createParseSettings('', { tsconfigRootDir }); + + expect(parseSettings.tsconfigRootDir).toBe(tsconfigRootDir); + }); + + it('uses the provided tsconfigRootDir when it exists and a candidate exists', () => { + addCandidateTSConfigRootDir('candidate'); + const tsconfigRootDir = !isWindows ? '/a/b/c' : 'F:\\a\\b\\c'; + + const parseSettings = createParseSettings('', { tsconfigRootDir }); + + expect(parseSettings.tsconfigRootDir).toBe(tsconfigRootDir); + }); + + it('uses the inferred candidate when no tsconfigRootDir is provided and a candidate exists', () => { + const tsconfigRootDir = !isWindows ? '/a/b/c' : 'G:\\a\\b\\c'; + addCandidateTSConfigRootDir(tsconfigRootDir); + + const parseSettings = createParseSettings(''); + + expect(parseSettings.tsconfigRootDir).toBe(tsconfigRootDir); + }); + + it('should error if inferred tsconfig is not clean', () => { + addCandidateTSConfigRootDir('a/b/c'); + + expect(() => createParseSettings('')).toThrowErrorMatchingInlineSnapshot( + `[Error: inferred tsconfigRootDir should be a resolved absolute path, but received: "a/b/c". This is a bug in typescript-eslint! Please report it to us at https://github.com/typescript-eslint/typescript-eslint/issues/new/choose.]`, + ); + }); + }); }); diff --git a/packages/typescript-estree/tests/lib/createProjectService.test.ts b/packages/typescript-estree/tests/lib/createProjectService.test.ts deleted file mode 100644 index af67dd38a024..000000000000 --- a/packages/typescript-estree/tests/lib/createProjectService.test.ts +++ /dev/null @@ -1,379 +0,0 @@ -import debug from 'debug'; -import * as ts from 'typescript'; - -import { createProjectService } from '../../src/create-program/createProjectService.js'; -import { getParsedConfigFile } from '../../src/create-program/getParsedConfigFile.js'; - -const mockGetParsedConfigFile = vi.mocked(getParsedConfigFile); - -vi.mock( - import('../../src/create-program/getParsedConfigFile.js'), - async importOriginal => { - const actual = await importOriginal(); - - return { - ...actual, - getParsedConfigFile: vi.fn(actual.getParsedConfigFile), - }; - }, -); - -vi.mock( - import('../../src/create-program/createProjectService.js'), - async importOriginal => { - const actual = await importOriginal(); - - vi.spyOn( - ts.server.ProjectService.prototype, - 'setCompilerOptionsForInferredProjects', - ); - - vi.spyOn(ts.server.ProjectService.prototype, 'setHostConfiguration'); - - return { - ...actual, - createProjectService: vi - .fn(actual.createProjectService) - .mockImplementation((...args) => { - const projectServiceSettings = actual.createProjectService(...args); - const service = - projectServiceSettings.service as typeof projectServiceSettings.service & { - eventHandler: ts.server.ProjectServiceEventHandler | undefined; - }; - - if (service.eventHandler) { - service.eventHandler({ - eventName: ts.server.ProjectLoadingStartEvent, - } as ts.server.ProjectLoadingStartEvent); - } - - return projectServiceSettings; - }), - }; - }, -); - -describe(createProjectService, () => { - const processStderrWriteSpy = vi - .spyOn(process.stderr, 'write') - .mockImplementation(() => true); - - beforeEach(() => { - mockGetParsedConfigFile.mockReturnValue({ - errors: [], - fileNames: [], - options: {}, - }); - }); - - afterEach(() => { - vi.clearAllMocks(); - }); - - afterAll(() => { - vi.restoreAllMocks(); - }); - - it('sets allowDefaultProject when options.allowDefaultProject is defined', () => { - const allowDefaultProject = ['./*.js']; - const settings = createProjectService( - { allowDefaultProject }, - undefined, - undefined, - ); - - expect(settings.allowDefaultProject).toBe(allowDefaultProject); - }); - - it('does not set allowDefaultProject when options.allowDefaultProject is not defined', () => { - const settings = createProjectService(undefined, undefined, undefined); - - assert.isUndefined(settings.allowDefaultProject); - }); - - it('does not throw an error when options.defaultProject is not provided and getParsedConfigFile throws a diagnostic error', () => { - mockGetParsedConfigFile.mockImplementation(() => { - throw new Error('tsconfig.json(1,1): error TS1234: Oh no!'); - }); - - expect(() => - createProjectService( - { - allowDefaultProject: ['file.js'], - }, - undefined, - undefined, - ), - ).not.toThrow(); - }); - - it('throws an error with a relative path when options.defaultProject is set to a relative path and getParsedConfigFile throws a diagnostic error', () => { - mockGetParsedConfigFile.mockImplementation(() => { - throw new Error('./tsconfig.eslint.json(1,1): error TS1234: Oh no!'); - }); - - expect(() => - createProjectService( - { - allowDefaultProject: ['file.js'], - defaultProject: './tsconfig.eslint.json', - }, - undefined, - undefined, - ), - ).toThrow( - /Could not read project service default project '\.\/tsconfig.eslint.json': .+ error TS1234: Oh no!/, - ); - }); - - it('throws an error with a local path when options.defaultProject is set to a local path and getParsedConfigFile throws a diagnostic error', () => { - mockGetParsedConfigFile.mockImplementation(() => { - throw new Error('./tsconfig.eslint.json(1,1): error TS1234: Oh no!'); - }); - - expect(() => - createProjectService( - { - allowDefaultProject: ['file.js'], - defaultProject: 'tsconfig.eslint.json', - }, - undefined, - undefined, - ), - ).toThrow( - /Could not read project service default project 'tsconfig.eslint.json': .+ error TS1234: Oh no!/, - ); - }); - - it('throws an error when options.defaultProject is set and getParsedConfigFile throws an environment error', () => { - mockGetParsedConfigFile.mockImplementation(() => { - throw new Error( - '`getParsedConfigFile` is only supported in a Node-like environment.', - ); - }); - - expect(() => - createProjectService( - { - allowDefaultProject: ['file.js'], - defaultProject: 'tsconfig.json', - }, - undefined, - undefined, - ), - ).toThrow( - "Could not read project service default project 'tsconfig.json': `getParsedConfigFile` is only supported in a Node-like environment.", - ); - }); - - it('uses the default project compiler options when options.defaultProject is set and getParsedConfigFile succeeds', async () => { - const compilerOptions: ts.CompilerOptions = { strict: true }; - mockGetParsedConfigFile.mockReturnValueOnce({ - errors: [], - fileNames: [], - options: compilerOptions, - }); - - const defaultProject = 'tsconfig.eslint.json'; - - const { service } = createProjectService( - { - allowDefaultProject: ['file.js'], - defaultProject, - }, - undefined, - undefined, - ); - - expect( - service.setCompilerOptionsForInferredProjects, - ).toHaveBeenCalledExactlyOnceWith(compilerOptions); - - expect(mockGetParsedConfigFile).toHaveBeenCalledExactlyOnceWith( - (await import('typescript/lib/tsserverlibrary.js')).default, - defaultProject, - undefined, - ); - }); - - it('uses tsconfigRootDir as getParsedConfigFile projectDirectory when provided', async () => { - const compilerOptions: ts.CompilerOptions = { strict: true }; - const tsconfigRootDir = 'path/to/repo'; - mockGetParsedConfigFile.mockReturnValueOnce({ - errors: [], - fileNames: [], - options: compilerOptions, - }); - - const { service } = createProjectService( - { - allowDefaultProject: ['file.js'], - }, - undefined, - tsconfigRootDir, - ); - - expect( - service.setCompilerOptionsForInferredProjects, - ).toHaveBeenCalledExactlyOnceWith(compilerOptions); - - expect(mockGetParsedConfigFile).toHaveBeenCalledExactlyOnceWith( - (await import('typescript/lib/tsserverlibrary.js')).default, - 'tsconfig.json', - tsconfigRootDir, - ); - }); - - it('uses the default projects error debugger for error messages when enabled', () => { - const { service } = createProjectService(undefined, undefined, undefined); - debug.enable('typescript-eslint:typescript-estree:tsserver:err'); - const enabled = service.logger.loggingEnabled(); - service.logger.msg('foo', ts.server.Msg.Err); - debug.disable(); - - expect(enabled).toBe(true); - expect(processStderrWriteSpy).toHaveBeenCalledExactlyOnceWith( - expect.stringMatching( - /^.*typescript-eslint:typescript-estree:tsserver:err foo\n$/, - ), - ); - }); - - it('does not use the default projects error debugger for error messages when disabled', () => { - const { service } = createProjectService(undefined, undefined, undefined); - const enabled = service.logger.loggingEnabled(); - service.logger.msg('foo', ts.server.Msg.Err); - - expect(enabled).toBe(false); - expect(processStderrWriteSpy).not.toHaveBeenCalled(); - }); - - it('uses the default projects info debugger for info messages when enabled', () => { - const { service } = createProjectService(undefined, undefined, undefined); - debug.enable('typescript-eslint:typescript-estree:tsserver:info'); - const enabled = service.logger.loggingEnabled(); - service.logger.info('foo'); - debug.disable(); - - expect(enabled).toBe(true); - expect(processStderrWriteSpy).toHaveBeenCalledExactlyOnceWith( - expect.stringMatching( - /^.*typescript-eslint:typescript-estree:tsserver:info foo\n$/, - ), - ); - }); - - it('does not use the default projects info debugger for info messages when disabled', () => { - const { service } = createProjectService(undefined, undefined, undefined); - const enabled = service.logger.loggingEnabled(); - service.logger.info('foo'); - - expect(enabled).toBe(false); - expect(processStderrWriteSpy).not.toHaveBeenCalled(); - }); - - it('uses the default projects perf debugger for perf messages when enabled', () => { - const { service } = createProjectService(undefined, undefined, undefined); - debug.enable('typescript-eslint:typescript-estree:tsserver:perf'); - const enabled = service.logger.loggingEnabled(); - service.logger.perftrc('foo'); - debug.disable(); - - expect(enabled).toBe(true); - expect(processStderrWriteSpy).toHaveBeenCalledExactlyOnceWith( - expect.stringMatching( - /^.*typescript-eslint:typescript-estree:tsserver:perf foo\n$/, - ), - ); - }); - - it('does not use the default projects perf debugger for perf messages when disabled', () => { - const { service } = createProjectService(undefined, undefined, undefined); - const enabled = service.logger.loggingEnabled(); - service.logger.perftrc('foo'); - - expect(enabled).toBe(false); - expect(processStderrWriteSpy).not.toHaveBeenCalled(); - }); - - it('enables all log levels for the default projects logger', () => { - const { service } = createProjectService(undefined, undefined, undefined); - - expect(service.logger.hasLevel(ts.server.LogLevel.terse)).toBe(true); - expect(service.logger.hasLevel(ts.server.LogLevel.normal)).toBe(true); - expect(service.logger.hasLevel(ts.server.LogLevel.requestTime)).toBe(true); - expect(service.logger.hasLevel(ts.server.LogLevel.verbose)).toBe(true); - }); - - it('does not return a log filename with the default projects logger', () => { - const { service } = createProjectService(undefined, undefined, undefined); - - assert.isUndefined(service.logger.getLogFileName()); - }); - - it('uses the default projects event debugger for event handling when enabled', () => { - debug.enable('typescript-eslint:typescript-estree:tsserver:event'); - createProjectService(undefined, undefined, undefined); - debug.disable(); - - expect(processStderrWriteSpy).toHaveBeenCalledExactlyOnceWith( - expect.stringMatching( - /^.*typescript-eslint:typescript-estree:tsserver:event { eventName: 'projectLoadingStart' }\n$/, - ), - ); - }); - - it('does not use the default projects event debugger for event handling when disabled', () => { - createProjectService(undefined, undefined, undefined); - - expect(processStderrWriteSpy).not.toHaveBeenCalled(); - }); - - it('provides a stub require to the host system when loadTypeScriptPlugins is falsy', () => { - const { service } = createProjectService({}, undefined, undefined); - - const required = service.host.require?.('', ''); - - expect(required).toStrictEqual({ - error: { - message: - 'TypeScript plugins are not required when using parserOptions.projectService.', - }, - module: undefined, - }); - }); - - it('does not provide a require to the host system when loadTypeScriptPlugins is truthy', async () => { - const { service } = createProjectService( - { - loadTypeScriptPlugins: true, - }, - undefined, - undefined, - ); - - expect(service.host.require).toBe( - ( - await vi.importActual>>( - 'typescript/lib/tsserverlibrary.js', - ) - ).sys.require, - ); - }); - - it('sets a host configuration', () => { - const { service } = createProjectService( - { - allowDefaultProject: ['file.js'], - }, - undefined, - undefined, - ); - - expect(service.setHostConfiguration).toHaveBeenCalledExactlyOnceWith({ - preferences: { - includePackageJsonAutoImports: 'off', - }, - }); - }); -}); diff --git a/packages/typescript-estree/tests/lib/getProjectConfigFiles.test.ts b/packages/typescript-estree/tests/lib/getProjectConfigFiles.test.ts index 8e464eb746fc..525cd8e2acdf 100644 --- a/packages/typescript-estree/tests/lib/getProjectConfigFiles.test.ts +++ b/packages/typescript-estree/tests/lib/getProjectConfigFiles.test.ts @@ -1,9 +1,12 @@ import { existsSync } from 'node:fs'; -import path from 'node:path'; + +import type { ParseSettings } from '../../src/parseSettings'; import { ExpiringCache } from '../../src/parseSettings/ExpiringCache'; import { getProjectConfigFiles } from '../../src/parseSettings/getProjectConfigFiles'; +const isWindows = process.platform === 'win32'; + const mockExistsSync = vi.mocked(existsSync); vi.mock(import('node:fs'), async importOriginal => { @@ -11,21 +14,36 @@ vi.mock(import('node:fs'), async importOriginal => { return { ...actual, - default: actual.default, existsSync: vi.fn(actual.existsSync), }; }); -const parseSettings = { - filePath: './repos/repo/packages/package/file.ts', +type TestParseSettings = Pick< + ParseSettings, + 'filePath' | 'tsconfigMatchCache' | 'tsconfigRootDir' +> & { tsconfigMatchCache: ExpiringCache }; + +const parseSettingsWindows: TestParseSettings = { + filePath: 'H:\\repos\\repo\\packages\\package\\file.ts', + tsconfigMatchCache: new ExpiringCache(1), + tsconfigRootDir: 'H:\\repos\\repo', +}; + +const parseSettingsPosix: TestParseSettings = { + filePath: '/repos/repo/packages/package/file.ts', tsconfigMatchCache: new ExpiringCache(1), - tsconfigRootDir: './repos/repo', + tsconfigRootDir: '/repos/repo', }; +const parseSettings: TestParseSettings = !isWindows + ? parseSettingsPosix + : parseSettingsWindows; + describe(getProjectConfigFiles, () => { beforeEach(() => { parseSettings.tsconfigMatchCache.clear(); vi.clearAllMocks(); + vi.resetModules(); }); afterAll(() => { @@ -66,14 +84,17 @@ describe(getProjectConfigFiles, () => { const actual = getProjectConfigFiles(parseSettings, true); expect(actual).toStrictEqual([ - path.normalize('repos/repo/packages/package/tsconfig.json'), + !isWindows + ? '/repos/repo/packages/package/tsconfig.json' + : 'H:\\repos\\repo\\packages\\package\\tsconfig.json', ]); expect(mockExistsSync).toHaveBeenCalledOnce(); }); it('returns a nearby parent tsconfig.json when it was previously cached by a different directory search', () => { mockExistsSync.mockImplementation( - input => input === path.normalize('a/tsconfig.json'), + input => + input === (!isWindows ? '/a/tsconfig.json' : 'H:\\a\\tsconfig.json'), ); const tsconfigMatchCache = new ExpiringCache(1); @@ -81,9 +102,9 @@ describe(getProjectConfigFiles, () => { // This should call to fs.existsSync three times: c, b, a getProjectConfigFiles( { - filePath: './a/b/c/d.ts', + filePath: !isWindows ? '/a/b/c/d.ts' : 'H:\\a\\b\\c\\d.ts', tsconfigMatchCache, - tsconfigRootDir: './a', + tsconfigRootDir: !isWindows ? '/a' : 'H:\\a', }, true, ); @@ -92,20 +113,23 @@ describe(getProjectConfigFiles, () => { // Then it should retrieve c from cache, pointing to a const actual = getProjectConfigFiles( { - filePath: './a/b/c/e/f.ts', + filePath: !isWindows ? '/a/b/c/e/f.ts' : 'H:\\a\\b\\c\\e\\f.ts', tsconfigMatchCache, - tsconfigRootDir: './a', + tsconfigRootDir: !isWindows ? '/a' : 'H:\\a', }, true, ); - expect(actual).toStrictEqual([path.normalize('a/tsconfig.json')]); + expect(actual).toStrictEqual([ + !isWindows ? '/a/tsconfig.json' : 'H:\\a\\tsconfig.json', + ]); expect(mockExistsSync).toHaveBeenCalledTimes(4); }); it('returns a distant parent tsconfig.json when it was previously cached by a different directory search', () => { mockExistsSync.mockImplementation( - input => input === path.normalize('a/tsconfig.json'), + input => + input === (!isWindows ? '/a/tsconfig.json' : 'H:\\a\\tsconfig.json'), ); const tsconfigMatchCache = new ExpiringCache(1); @@ -113,9 +137,9 @@ describe(getProjectConfigFiles, () => { // This should call to fs.existsSync 4 times: d, c, b, a getProjectConfigFiles( { - filePath: './a/b/c/d/e.ts', + filePath: !isWindows ? '/a/b/c/d/e.ts' : 'H:\\a\\b\\c\\d\\e.ts', tsconfigMatchCache, - tsconfigRootDir: './a', + tsconfigRootDir: !isWindows ? '/a' : 'H:\\a', }, true, ); @@ -124,14 +148,16 @@ describe(getProjectConfigFiles, () => { // Then it should retrieve b from cache, pointing to a const actual = getProjectConfigFiles( { - filePath: './a/b/f/g/h.ts', + filePath: !isWindows ? '/a/b/f/g/h.ts' : 'H:\\a\\b\\f\\g\\h.ts', tsconfigMatchCache, - tsconfigRootDir: './a', + tsconfigRootDir: !isWindows ? '/a' : 'H:\\a', }, true, ); - expect(actual).toStrictEqual([path.normalize('a/tsconfig.json')]); + expect(actual).toStrictEqual([ + !isWindows ? '/a/tsconfig.json' : 'H:\\a\\tsconfig.json', + ]); expect(mockExistsSync).toHaveBeenCalledTimes(6); }); }); @@ -143,40 +169,81 @@ describe(getProjectConfigFiles, () => { const actual = getProjectConfigFiles(parseSettings, true); expect(actual).toStrictEqual([ - path.normalize('repos/repo/packages/package/tsconfig.json'), + !isWindows + ? '/repos/repo/packages/package/tsconfig.json' + : 'H:\\repos\\repo\\packages\\package\\tsconfig.json', ]); }); it('returns a parent tsconfig.json when matched', () => { mockExistsSync.mockImplementation( - filePath => filePath === path.normalize('repos/repo/tsconfig.json'), + filePath => + filePath === + (!isWindows + ? '/repos/repo/tsconfig.json' + : 'H:\\repos\\repo\\tsconfig.json'), ); const actual = getProjectConfigFiles(parseSettings, true); expect(actual).toStrictEqual([ - path.normalize('repos/repo/tsconfig.json'), + !isWindows + ? '/repos/repo/tsconfig.json' + : 'H:\\repos\\repo\\tsconfig.json', ]); }); - it('throws when searching hits .', () => { - mockExistsSync.mockReturnValue(false); - - expect(() => - getProjectConfigFiles(parseSettings, true), - ).toThrowErrorMatchingInlineSnapshot( - `[Error: project was set to \`true\` but couldn't find any tsconfig.json relative to './repos/repo/packages/package/file.ts' within './repos/repo'.]`, - ); + it('throws when searching hits .', async () => { + // ensure posix-style paths are used for consistent snapshot. + vi.doMock(import('node:path'), async importActual => { + const actualPath = await importActual(); + return { + ...actualPath.posix, + default: actualPath.posix, + }; + }); + + try { + const { getProjectConfigFiles } = await import( + '../../src/parseSettings/getProjectConfigFiles.js' + ); + + mockExistsSync.mockReturnValue(false); + + expect(() => + getProjectConfigFiles(parseSettingsPosix, true), + ).toThrowErrorMatchingInlineSnapshot( + `[Error: project was set to \`true\` but couldn't find any tsconfig.json relative to '/repos/repo/packages/package/file.ts' within '/repos/repo'.]`, + ); + } finally { + vi.doUnmock(import('node:path')); + } }); - it('throws when searching passes the tsconfigRootDir', () => { - mockExistsSync.mockReturnValue(false); - - expect(() => - getProjectConfigFiles({ ...parseSettings, tsconfigRootDir: '/' }, true), - ).toThrowErrorMatchingInlineSnapshot( - `[Error: project was set to \`true\` but couldn't find any tsconfig.json relative to './repos/repo/packages/package/file.ts' within '/'.]`, - ); + it('throws when searching passes the tsconfigRootDir', async () => { + // ensure posix-style paths are used for consistent snapshot. + vi.doMock(import('node:path'), async importActual => { + const actualPath = await importActual(); + return { ...actualPath.posix, default: actualPath.posix }; + }); + try { + const { getProjectConfigFiles } = await import( + '../../src/parseSettings/getProjectConfigFiles.js' + ); + + mockExistsSync.mockReturnValue(false); + + expect(() => + getProjectConfigFiles( + { ...parseSettingsPosix, tsconfigRootDir: '/' }, + true, + ), + ).toThrowErrorMatchingInlineSnapshot( + `[Error: project was set to \`true\` but couldn't find any tsconfig.json relative to '/repos/repo/packages/package/file.ts' within '/'.]`, + ); + } finally { + vi.doUnmock(import('node:path')); + } }); }); }); diff --git a/packages/typescript-estree/tests/lib/parse.test.ts b/packages/typescript-estree/tests/lib/parse.test.ts index c371a6e9e7ac..421287ff182b 100644 --- a/packages/typescript-estree/tests/lib/parse.test.ts +++ b/packages/typescript-estree/tests/lib/parse.test.ts @@ -68,6 +68,10 @@ describe(parser.parseAndGenerateServices, () => { beforeEach(() => { vi.clearAllMocks(); clearGlobResolutionCache(); + vi.stubEnv( + 'TYPESCRIPT_ESLINT_IGNORE_PROJECT_AND_PROJECT_SERVICE_ERROR', + 'true', + ); }); afterAll(() => { diff --git a/packages/typescript-estree/tests/lib/persistentParse.test.ts b/packages/typescript-estree/tests/lib/persistentParse.test.ts index d7283f412330..b8916bb6eb08 100644 --- a/packages/typescript-estree/tests/lib/persistentParse.test.ts +++ b/packages/typescript-estree/tests/lib/persistentParse.test.ts @@ -38,6 +38,13 @@ afterEach(() => { process.chdir(cwdCopy); }); +beforeEach(() => { + vi.stubEnv( + 'TYPESCRIPT_ESLINT_IGNORE_PROJECT_AND_PROJECT_SERVICE_ERROR', + 'true', + ); +}); + beforeAll(async () => { await fs.mkdir(tmpDirsParentDirectory, { recursive: true, diff --git a/packages/typescript-estree/tests/lib/semanticInfo-singleRun.test.ts b/packages/typescript-estree/tests/lib/semanticInfo-singleRun.test.ts index 69789fa2dc3e..a82406b3b0b0 100644 --- a/packages/typescript-estree/tests/lib/semanticInfo-singleRun.test.ts +++ b/packages/typescript-estree/tests/lib/semanticInfo-singleRun.test.ts @@ -114,6 +114,11 @@ describe('semanticInfo - singleRun', () => { createProgramFromConfigFile.mockClear(); // Do not track invocations per file across tests clearParseAndGenerateServicesCalls(); + + vi.stubEnv( + 'TYPESCRIPT_ESLINT_IGNORE_PROJECT_AND_PROJECT_SERVICE_ERROR', + 'true', + ); }); it('should not create any programs ahead of time by default when there is no way to infer singleRun=true', () => { @@ -128,7 +133,7 @@ describe('semanticInfo - singleRun', () => { expect(createProgramFromConfigFile).not.toHaveBeenCalled(); }); - it('should not create any programs ahead of time when when TSESTREE_SINGLE_RUN=false, even if other inferrence criteria apply', () => { + it('should not create any programs ahead of time when when TSESTREE_SINGLE_RUN=false, even if other inference criteria apply', () => { vi.stubEnv('TSESTREE_SINGLE_RUN', 'false'); // Normally CI=true would be used to infer singleRun=true, but TSESTREE_SINGLE_RUN is explicitly set to false diff --git a/packages/typescript-estree/tests/lib/semanticInfo.test.ts b/packages/typescript-estree/tests/lib/semanticInfo.test.ts index 9f4aa21fbd5d..0d4285e396d0 100644 --- a/packages/typescript-estree/tests/lib/semanticInfo.test.ts +++ b/packages/typescript-estree/tests/lib/semanticInfo.test.ts @@ -41,8 +41,17 @@ describe('semanticInfo', async () => { clearCaches(); vi.stubEnv('TSESTREE_SINGLE_RUN', ''); + vi.stubEnv( + 'TYPESCRIPT_ESLINT_IGNORE_PROJECT_AND_PROJECT_SERVICE_ERROR', + 'true', + ); }); + vi.stubEnv( + 'TYPESCRIPT_ESLINT_IGNORE_PROJECT_AND_PROJECT_SERVICE_ERROR', + 'true', + ); + // test all AST snapshots const testCases = await Promise.all( testFiles.map(async filename => { diff --git a/packages/typescript-estree/tests/lib/useProgramFromProjectService.test.ts b/packages/typescript-estree/tests/lib/useProgramFromProjectService.test.ts index c156392d3693..3e0a30a52940 100644 --- a/packages/typescript-estree/tests/lib/useProgramFromProjectService.test.ts +++ b/packages/typescript-estree/tests/lib/useProgramFromProjectService.test.ts @@ -1,10 +1,11 @@ +import type { + ProjectServiceAndMetadata, + TypeScriptProjectService, +} from '@typescript-eslint/project-service'; + import path from 'node:path'; import * as ts from 'typescript'; -import type { - ProjectServiceSettings, - TypeScriptProjectService, -} from '../../src/create-program/createProjectService'; import type { ParseSettings } from '../../src/parseSettings'; import { useProgramFromProjectService } from '../../src/useProgramFromProjectService'; @@ -65,7 +66,7 @@ const mockParseSettings = { } as ParseSettings; const createProjectServiceSettings = < - T extends Partial, + T extends Partial, >( settings: T, ) => ({ @@ -166,7 +167,7 @@ describe(useProgramFromProjectService, () => { expect(service.reloadProjects).not.toHaveBeenCalled(); }); - it('throws an error after reloading projects when hasFullTypeInformation is enabled, the file is neither in the project service nor allowDefaultProject, and the last reload was recent', () => { + it('throws a non-file-specific error after reloading projects when hasFullTypeInformation is enabled, the file is neither in the project service nor an empty allowDefaultProject, and the last reload was recent', () => { const { service } = createMockProjectService(); service.openClientFile.mockReturnValueOnce({}).mockReturnValueOnce({}); @@ -188,6 +189,40 @@ describe(useProgramFromProjectService, () => { expect(service.reloadProjects).toHaveBeenCalledOnce(); }); + it('throws a file-specific error after reloading projects when hasFullTypeInformation is enabled, the file is neither in the project service nor a populated allowDefaultProject, and the last reload was recent', () => { + const { service } = createMockProjectService(); + const allowDefaultProject = ['a.js', 'b.js']; + + service.openClientFile.mockReturnValueOnce({}).mockReturnValueOnce({}); + + expect(() => + useProgramFromProjectService( + createProjectServiceSettings({ + allowDefaultProject, + lastReloadTimestamp: 0, + service, + }), + { + ...mockParseSettings, + projectService: { + allowDefaultProject, + lastReloadTimestamp: 0, + maximumDefaultProjectFileMatchCount: 8, + service, + }, + }, + true, + new Set(), + ), + ).toThrow( + [ + `${mockParseSettings.filePath} was not found by the project service. Consider either including it in the tsconfig.json or including it in allowDefaultProject.`, + `allowDefaultProject is set to ["a.js","b.js"], which does not match '${path.normalize('path/PascalCaseDirectory/camelCaseFile.ts')}'.`, + ].join('\n'), + ); + expect(service.reloadProjects).toHaveBeenCalledOnce(); + }); + it('returns a created program after reloading projects when hasFullTypeInformation is enabled, the file is only in the project service after reload, and the last reload was recent', () => { const { service } = createMockProjectService(); const program = { getSourceFile: vi.fn() }; @@ -623,4 +658,31 @@ If you absolutely need more files included, set parserOptions.projectService.max )}\`) is non-standard. It should be added to your existing \`parserOptions.extraFileExtensions\`.`, ); }); + + it('matches filenames starting with a period', () => { + const { service } = createMockProjectService(); + + const filePath = `.prettierrc.js`; + + const program = { getSourceFile: vi.fn() }; + + mockGetProgram.mockReturnValueOnce(program); + + service.openClientFile.mockReturnValueOnce({ + configFileName: 'tsconfig.json', + }); + mockCreateProjectProgram.mockReturnValueOnce(program); + + const actual = useProgramFromProjectService( + createProjectServiceSettings({ + allowDefaultProject: ['*.js'], + service, + }), + { ...mockParseSettings, filePath }, + false, + new Set(), + ); + + expect(actual).toBe(program); + }); }); diff --git a/packages/typescript-estree/tests/lib/validateDefaultProjectForFilesGlob.test.ts b/packages/typescript-estree/tests/lib/validateDefaultProjectForFilesGlob.test.ts index 9eccb60f8cc1..043724755b7b 100644 --- a/packages/typescript-estree/tests/lib/validateDefaultProjectForFilesGlob.test.ts +++ b/packages/typescript-estree/tests/lib/validateDefaultProjectForFilesGlob.test.ts @@ -1,4 +1,4 @@ -import { validateDefaultProjectForFilesGlob } from '../../src/create-program/validateDefaultProjectForFilesGlob'; +import { validateDefaultProjectForFilesGlob } from '../../src/create-program/validateDefaultProjectForFilesGlob.js'; describe(validateDefaultProjectForFilesGlob, () => { it('does not throw when options.allowDefaultProject is an empty array', () => { diff --git a/packages/typescript-estree/tsconfig.build.json b/packages/typescript-estree/tsconfig.build.json index e935e6c4e028..53a73a2cf5ec 100644 --- a/packages/typescript-estree/tsconfig.build.json +++ b/packages/typescript-estree/tsconfig.build.json @@ -2,6 +2,12 @@ "extends": "../../tsconfig.build.json", "compilerOptions": {}, "references": [ + { + "path": "../project-service/tsconfig.build.json" + }, + { + "path": "../tsconfig-utils/tsconfig.build.json" + }, { "path": "../visitor-keys/tsconfig.build.json" }, diff --git a/packages/typescript-estree/tsconfig.json b/packages/typescript-estree/tsconfig.json index 7b899170369f..77cec8e6ba10 100644 --- a/packages/typescript-estree/tsconfig.json +++ b/packages/typescript-estree/tsconfig.json @@ -3,6 +3,12 @@ "files": [], "include": [], "references": [ + { + "path": "../project-service" + }, + { + "path": "../tsconfig-utils" + }, { "path": "../visitor-keys" }, diff --git a/packages/utils/CHANGELOG.md b/packages/utils/CHANGELOG.md index 04ab1821c337..4e097649dc91 100644 --- a/packages/utils/CHANGELOG.md +++ b/packages/utils/CHANGELOG.md @@ -1,3 +1,177 @@ +## 8.46.4 (2025-11-10) + +This was a version bump only for utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.3 (2025-11-03) + +This was a version bump only for utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.2 (2025-10-20) + +This was a version bump only for utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.1 (2025-10-13) + +This was a version bump only for utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.0 (2025-10-06) + +### 🩹 Fixes + +- **rule-tester:** deprecate TestCaseError#type and LintMessage#nodeType ([#11628](https://github.com/typescript-eslint/typescript-eslint/pull/11628)) + +### ❤️ Thank You + +- Mark de Dios @peanutenthusiast + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.45.0 (2025-09-29) + +### 🚀 Features + +- **eslint-plugin:** expose rule name via RuleModule interface ([#11616](https://github.com/typescript-eslint/typescript-eslint/pull/11616)) + +### ❤️ Thank You + +- Yukihiro Hasegawa @y-hsgw + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.44.1 (2025-09-22) + +This was a version bump only for utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.44.0 (2025-09-15) + +This was a version bump only for utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.43.0 (2025-09-08) + +### 🩹 Fixes + +- **scope-manager:** exclude Program from DefinitionBase node types ([#11469](https://github.com/typescript-eslint/typescript-eslint/pull/11469)) + +### ❤️ Thank You + +- Dima @dbarabashh + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.42.0 (2025-09-02) + +This was a version bump only for utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.41.0 (2025-08-25) + +This was a version bump only for utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.40.0 (2025-08-18) + +### 🩹 Fixes + +- **utils:** correct `calculateConfigForFile` return type ([#11451](https://github.com/typescript-eslint/typescript-eslint/pull/11451)) + +### ❤️ Thank You + +- Nolan Gajdascz @Gajdascz + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.39.1 (2025-08-11) + +This was a version bump only for utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.39.0 (2025-08-04) + +### 🚀 Features + +- update to TypeScript 5.9.2 ([#11445](https://github.com/typescript-eslint/typescript-eslint/pull/11445)) + +### ❤️ Thank You + +- Brad Zacher @bradzacher + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.38.0 (2025-07-21) + +This was a version bump only for utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.37.0 (2025-07-14) + +This was a version bump only for utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.36.0 (2025-07-07) + +### 🚀 Features + +- **typescript-eslint:** support `basePath` in `tseslint.config()` ([#11357](https://github.com/typescript-eslint/typescript-eslint/pull/11357)) + +### ❤️ Thank You + +- Kirk Waiblinger @kirkwaiblinger + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.35.1 (2025-06-30) + +This was a version bump only for utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.35.0 (2025-06-23) + +This was a version bump only for utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.34.1 (2025-06-16) + +This was a version bump only for utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.34.0 (2025-06-09) + +This was a version bump only for utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.33.1 (2025-06-02) + +This was a version bump only for utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.33.0 (2025-05-26) + +This was a version bump only for utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + ## 8.32.1 (2025-05-12) This was a version bump only for utils to align it with other projects, there were no code changes. diff --git a/packages/utils/package.json b/packages/utils/package.json index 59cc23f0ad5a..8b569c25913c 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/utils", - "version": "8.32.1", + "version": "8.46.4", "description": "Utilities for working with TypeScript + ESLint together", "files": [ "dist", @@ -53,27 +53,26 @@ "estree" ], "scripts": { - "build": "tsc -b tsconfig.build.json", - "clean": "tsc -b tsconfig.build.json --clean", - "postclean": "rimraf dist/ coverage/", - "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", - "lint": "npx nx lint", - "test": "vitest --run --config=$INIT_CWD/vitest.config.mts", - "check-types": "npx nx typecheck" + "build": "yarn run -BT nx build", + "clean": "rimraf dist/ coverage/", + "format": "yarn run -T format", + "lint": "yarn run -BT nx lint", + "test": "yarn run -BT nx test", + "typecheck": "yarn run -BT nx typecheck" }, "dependencies": { "@eslint-community/eslint-utils": "^4.7.0", - "@typescript-eslint/scope-manager": "8.32.1", - "@typescript-eslint/types": "8.32.1", - "@typescript-eslint/typescript-estree": "8.32.1" + "@typescript-eslint/scope-manager": "8.46.4", + "@typescript-eslint/types": "8.46.4", + "@typescript-eslint/typescript-estree": "8.46.4" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0", - "typescript": ">=4.8.4 <5.9.0" + "typescript": ">=4.8.4 <6.0.0" }, "devDependencies": { "@vitest/coverage-v8": "^3.1.3", - "prettier": "^3.2.5", + "eslint": "*", "rimraf": "*", "typescript": "*", "vitest": "^3.1.3" @@ -81,5 +80,28 @@ "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" + }, + "nx": { + "name": "utils", + "includedScripts": [ + "clean" + ], + "targets": { + "lint": { + "command": "eslint" + }, + "typecheck": { + "outputs": [ + "{workspaceRoot}/dist", + "{projectRoot}/dist" + ] + }, + "test": { + "dependsOn": [ + "^build", + "typecheck" + ] + } + } } } diff --git a/packages/utils/project.json b/packages/utils/project.json deleted file mode 100644 index b5a83f94b080..000000000000 --- a/packages/utils/project.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "utils", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "projectType": "library", - "root": "packages/utils", - "sourceRoot": "packages/utils/src", - "targets": { - "lint": { - "executor": "@nx/eslint:lint", - "outputs": ["{options.outputFile}"] - }, - "test": { - "executor": "@nx/vite:test", - "dependsOn": ["^build", "typecheck"] - } - } -} diff --git a/packages/utils/src/ts-eslint/Config.ts b/packages/utils/src/ts-eslint/Config.ts index b80646756e35..95ab05d9f2f2 100644 --- a/packages/utils/src/ts-eslint/Config.ts +++ b/packages/utils/src/ts-eslint/Config.ts @@ -79,7 +79,7 @@ export namespace ClassicConfig { */ globals?: GlobalsConfig; /** - * The flag that disables directive comments. + * The flag that disables comment directives. */ noInlineConfig?: boolean; /** @@ -194,7 +194,7 @@ export namespace FlatConfig { * A severity string indicating if and how unused disable and enable * directives should be tracked and reported. For legacy compatibility, `true` * is equivalent to `"warn"` and `false` is equivalent to `"off"`. - * @default "off" + * @default "warn" */ reportUnusedDisableDirectives?: | boolean @@ -255,6 +255,15 @@ export namespace FlatConfig { // it's not a json schema so it's nowhere near as nice to read and convert... // https://github.com/eslint/eslint/blob/v8.45.0/lib/config/flat-config-schema.js export interface Config { + /** + * The base path for files and ignores. + * + * Note that this is not permitted inside an `extends` array. + * + * Since ESLint 9.30.0 + */ + basePath?: string; + /** * An array of glob patterns indicating the files that the configuration object should apply to. * If not specified, the configuration object applies to all files matched by any other configuration object. diff --git a/packages/utils/src/ts-eslint/Linter.ts b/packages/utils/src/ts-eslint/Linter.ts index 499213d95f3b..7bbb2b316445 100644 --- a/packages/utils/src/ts-eslint/Linter.ts +++ b/packages/utils/src/ts-eslint/Linter.ts @@ -229,7 +229,10 @@ namespace Linter { */ message: string; messageId?: string; - nodeType: string; + /** + * @deprecated `nodeType` is deprecated and will be removed in the next major version. + */ + nodeType?: string; /** * The ID of the rule which makes this message. */ diff --git a/packages/utils/src/ts-eslint/Rule.ts b/packages/utils/src/ts-eslint/Rule.ts index 35cd1c7f7a0c..1a4920a3e79e 100644 --- a/packages/utils/src/ts-eslint/Rule.ts +++ b/packages/utils/src/ts-eslint/Rule.ts @@ -25,6 +25,11 @@ export interface RuleMetaDataDocs { * The URL of the rule's docs. */ url?: string; + + /** + * Mark this rule as feature-frozen. + */ + frozen?: boolean; } export interface ExternalSpecifier { @@ -133,7 +138,7 @@ export interface RuleMetaData< /** * Specifies default options for the rule. If present, any user-provided options in their config will be merged on top of them recursively. * This merging will be applied directly to `context.options`. - * If you want backwards-compatible support for earlier ESLint version; consider using the top-level `defaultOptions` instead. + * If you want backwards-compatible support for earlier ESLint version, consider using the top-level `defaultOptions` instead. * * since ESLint 9.15.0 */ @@ -766,11 +771,11 @@ export type AnyRuleModuleWithMetaDocs = RuleModuleWithMetaDocs< */ export type LooseRuleDefinition = // TODO - remove RuleCreateFunction once we no longer support ESLint 8 + | LooseRuleCreateFunction | { create: LooseRuleCreateFunction; meta?: object | undefined; - } - | LooseRuleCreateFunction; + }; /* eslint-disable-next-line @typescript-eslint/no-explicit-any -- intentionally using `any` to allow bi-directional assignment (unknown and diff --git a/packages/utils/src/ts-eslint/SourceCode.ts b/packages/utils/src/ts-eslint/SourceCode.ts index f4afb79f2dad..7d932a7eeff0 100644 --- a/packages/utils/src/ts-eslint/SourceCode.ts +++ b/packages/utils/src/ts-eslint/SourceCode.ts @@ -416,6 +416,7 @@ namespace SourceCode { export type CursorWithSkipOptions = | number + | FilterPredicate | { /** * The predicate function to choose tokens. @@ -429,11 +430,11 @@ namespace SourceCode { * The count of tokens the cursor skips. */ skip?: number; - } - | FilterPredicate; + }; export type CursorWithCountOptions = | number + | FilterPredicate | { /** * The maximum count of tokens the cursor iterates. @@ -447,8 +448,7 @@ namespace SourceCode { * The flag to iterate comments as well. */ includeComments?: boolean; - } - | FilterPredicate; + }; } class SourceCode extends (ESLintSourceCode as typeof SourceCodeBase) {} diff --git a/packages/utils/src/ts-eslint/eslint/ESLintShared.ts b/packages/utils/src/ts-eslint/eslint/ESLintShared.ts index db6e5b4de20d..54a79d150bd1 100644 --- a/packages/utils/src/ts-eslint/eslint/ESLintShared.ts +++ b/packages/utils/src/ts-eslint/eslint/ESLintShared.ts @@ -104,7 +104,7 @@ export declare class ESLintBase< } export interface ESLintOptions { /** - * If false is present, ESLint suppresses directive comments in source code. + * If false is present, ESLint suppresses comment directives in source code. * If this option is false, it overrides the noInlineConfig setting in your configurations. * @default true */ diff --git a/packages/utils/src/ts-eslint/eslint/FlatESLint.ts b/packages/utils/src/ts-eslint/eslint/FlatESLint.ts index 085a9e0fdfa9..db140a033163 100644 --- a/packages/utils/src/ts-eslint/eslint/FlatESLint.ts +++ b/packages/utils/src/ts-eslint/eslint/FlatESLint.ts @@ -6,7 +6,7 @@ import type * as Shared from './ESLintShared'; // eslint-disable-next-line @typescript-eslint/no-unused-vars declare class FlatESLintBase extends Shared.ESLintBase< - FlatConfig.ConfigArray, + FlatConfig.Config | FlatConfig.ConfigArray, FlatESLint.ESLintOptions > { static readonly configType: 'flat'; @@ -18,7 +18,7 @@ declare class FlatESLintBase extends Shared.ESLintBase< * @param filePath The path of the file to retrieve a config object for. * @returns A configuration object for the file or `undefined` if there is no configuration data for the object. */ - calculateConfigForFile(filePath: string): Promise; + calculateConfigForFile(filePath: string): Promise; /** * Finds the config file being used by this instance based on the options @@ -49,9 +49,13 @@ export namespace FlatESLint { */ ignorePatterns?: string[] | null; /** - * The path to a configuration file, overrides all configurations used with this instance. + * The path to a configuration file. Overrides all configurations used with this instance. * The options.overrideConfig option is applied after this option is applied. - * Searches for default config file when falsy; doesn't do any config file lookup when `true`; considered to be a config filename when a string. + * + * - When falsy, searches for default config file. + * - When `true`, does not do any config file lookup. + * - When a string, considered to be a config file name. + * * @default false */ overrideConfigFile?: boolean | string; diff --git a/packages/utils/src/ts-estree.ts b/packages/utils/src/ts-estree.ts index 6c61253a1f05..41cb2bf119b9 100644 --- a/packages/utils/src/ts-estree.ts +++ b/packages/utils/src/ts-estree.ts @@ -1,11 +1,11 @@ // for convenience's sake - export the types directly from here so consumers // don't need to reference/install both packages in their code - export { AST_NODE_TYPES, AST_TOKEN_TYPES, TSESTree, } from '@typescript-eslint/types'; +export type { NodeWithParent } from '@typescript-eslint/types'; export type { ParserServices, diff --git a/packages/utils/tests/ts-eslint/ESLint.test.ts b/packages/utils/tests/ts-eslint/ESLint.test.ts index cce64f5a743e..1abf895cfafa 100644 --- a/packages/utils/tests/ts-eslint/ESLint.test.ts +++ b/packages/utils/tests/ts-eslint/ESLint.test.ts @@ -1,5 +1,7 @@ import { FlatESLint, LegacyESLint } from 'eslint/use-at-your-own-risk'; +import type { FlatConfig } from '../../src/ts-eslint'; + import * as ESLint from '../../src/ts-eslint/ESLint'; describe('ESLint', () => { @@ -12,6 +14,7 @@ describe('ESLint', () => { }); expect(eslint).toBeInstanceOf(FlatESLint); }); + it('legacy', () => { // eslint-disable-next-line @typescript-eslint/no-deprecated const eslint = new ESLint.LegacyESLint({ @@ -27,5 +30,11 @@ describe('ESLint', () => { }); expect(eslint).toBeInstanceOf(LegacyESLint); }); + + it('config type permits basePath (type test)', () => { + const __config: FlatConfig.Config = { + basePath: 'some/path', + }; + }); }); }); diff --git a/packages/visitor-keys/CHANGELOG.md b/packages/visitor-keys/CHANGELOG.md index 927444b2f21c..f5c5a0aec14c 100644 --- a/packages/visitor-keys/CHANGELOG.md +++ b/packages/visitor-keys/CHANGELOG.md @@ -1,3 +1,153 @@ +## 8.46.4 (2025-11-10) + +This was a version bump only for visitor-keys to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.3 (2025-11-03) + +This was a version bump only for visitor-keys to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.2 (2025-10-20) + +This was a version bump only for visitor-keys to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.1 (2025-10-13) + +This was a version bump only for visitor-keys to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.46.0 (2025-10-06) + +This was a version bump only for visitor-keys to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.45.0 (2025-09-29) + +This was a version bump only for visitor-keys to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.44.1 (2025-09-22) + +This was a version bump only for visitor-keys to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.44.0 (2025-09-15) + +This was a version bump only for visitor-keys to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.43.0 (2025-09-08) + +This was a version bump only for visitor-keys to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.42.0 (2025-09-02) + +This was a version bump only for visitor-keys to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website. + +## 8.41.0 (2025-08-25) + +This was a version bump only for visitor-keys to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.40.0 (2025-08-18) + +This was a version bump only for visitor-keys to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.39.1 (2025-08-11) + +This was a version bump only for visitor-keys to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.39.0 (2025-08-04) + +This was a version bump only for visitor-keys to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.38.0 (2025-07-21) + +This was a version bump only for visitor-keys to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.37.0 (2025-07-14) + +This was a version bump only for visitor-keys to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.36.0 (2025-07-07) + +This was a version bump only for visitor-keys to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.35.1 (2025-06-30) + +This was a version bump only for visitor-keys to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.35.0 (2025-06-23) + +This was a version bump only for visitor-keys to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.34.1 (2025-06-16) + +### 🩹 Fixes + +- **visitor-keys:** bump `eslint-visitor-keys` dependency ([#11294](https://github.com/typescript-eslint/typescript-eslint/pull/11294)) + +### ❤️ Thank You + +- overlookmotel + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.34.0 (2025-06-09) + +### 🩹 Fixes + +- **visitor-keys:** fix visitor keys order ([#11279](https://github.com/typescript-eslint/typescript-eslint/pull/11279)) + +### ❤️ Thank You + +- overlookmotel + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.33.1 (2025-06-02) + +This was a version bump only for visitor-keys to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + +## 8.33.0 (2025-05-26) + +This was a version bump only for visitor-keys to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + ## 8.32.1 (2025-05-12) This was a version bump only for visitor-keys to align it with other projects, there were no code changes. diff --git a/packages/visitor-keys/package.json b/packages/visitor-keys/package.json index 612ce782ef59..6ac04b9ebd70 100644 --- a/packages/visitor-keys/package.json +++ b/packages/visitor-keys/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/visitor-keys", - "version": "8.32.1", + "version": "8.46.4", "description": "Visitor keys used to help traverse the TypeScript-ESTree AST", "files": [ "dist", @@ -37,21 +37,20 @@ "estree" ], "scripts": { - "build": "tsc -b tsconfig.build.json", - "clean": "tsc -b tsconfig.build.json --clean", - "postclean": "rimraf dist/ coverage/", - "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", - "lint": "npx nx lint", - "test": "vitest --run --config=$INIT_CWD/vitest.config.mts", - "check-types": "npx nx typecheck" + "build": "yarn run -BT nx build", + "clean": "rimraf dist/ coverage/", + "format": "yarn run -T format", + "lint": "yarn run -BT nx lint", + "test": "yarn run -BT nx test", + "typecheck": "yarn run -BT nx typecheck" }, "dependencies": { - "@typescript-eslint/types": "8.32.1", - "eslint-visitor-keys": "^4.2.0" + "@typescript-eslint/types": "8.46.4", + "eslint-visitor-keys": "^4.2.1" }, "devDependencies": { "@vitest/coverage-v8": "^3.1.3", - "prettier": "^3.2.5", + "eslint": "*", "rimraf": "*", "typescript": "*", "vitest": "^3.1.3" @@ -59,5 +58,16 @@ "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" + }, + "nx": { + "name": "visitor-keys", + "includedScripts": [ + "clean" + ], + "targets": { + "lint": { + "command": "eslint" + } + } } } diff --git a/packages/visitor-keys/project.json b/packages/visitor-keys/project.json deleted file mode 100644 index 208a8c73ee21..000000000000 --- a/packages/visitor-keys/project.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "visitor-keys", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "projectType": "library", - "root": "packages/visitor-keys", - "sourceRoot": "packages/visitor-keys/src", - "targets": { - "lint": { - "executor": "@nx/eslint:lint", - "outputs": ["{options.outputFile}"] - }, - "test": { - "executor": "@nx/vite:test" - } - } -} diff --git a/packages/visitor-keys/src/visitor-keys.ts b/packages/visitor-keys/src/visitor-keys.ts index 283d2f36e389..8fd0d512ac98 100644 --- a/packages/visitor-keys/src/visitor-keys.ts +++ b/packages/visitor-keys/src/visitor-keys.ts @@ -213,8 +213,8 @@ const additionalKeys: AdditionalKeys = { TSExternalModuleReference: ['expression'], TSFunctionType: SharedVisitorKeys.FunctionType, TSImportEqualsDeclaration: ['id', 'moduleReference'], - TSImportType: ['argument', 'qualifier', 'typeArguments', 'options'], - TSIndexedAccessType: ['indexType', 'objectType'], + TSImportType: ['argument', 'options', 'qualifier', 'typeArguments'], + TSIndexedAccessType: ['objectType', 'indexType'], TSIndexSignature: ['parameters', 'typeAnnotation'], TSInferType: ['typeParameter'], TSInstantiationExpression: ['expression', 'typeArguments'], @@ -225,7 +225,7 @@ const additionalKeys: AdditionalKeys = { TSIntrinsicKeyword: [], TSLiteralType: ['literal'], TSMappedType: ['key', 'constraint', 'nameType', 'typeAnnotation'], - TSMethodSignature: ['typeParameters', 'key', 'params', 'returnType'], + TSMethodSignature: ['key', 'typeParameters', 'params', 'returnType'], TSModuleBlock: ['body'], TSModuleDeclaration: ['id', 'body'], TSNamedTupleMember: ['label', 'elementType'], @@ -238,7 +238,7 @@ const additionalKeys: AdditionalKeys = { TSOptionalType: ['typeAnnotation'], TSParameterProperty: ['decorators', 'parameter'], TSPrivateKeyword: [], - TSPropertySignature: ['typeAnnotation', 'key'], + TSPropertySignature: ['key', 'typeAnnotation'], TSProtectedKeyword: [], TSPublicKeyword: [], TSQualifiedName: ['left', 'right'], @@ -259,7 +259,7 @@ const additionalKeys: AdditionalKeys = { TSTypeParameter: ['name', 'constraint', 'default'], TSTypeParameterDeclaration: ['params'], TSTypeParameterInstantiation: ['params'], - TSTypePredicate: ['typeAnnotation', 'parameterName'], + TSTypePredicate: ['parameterName', 'typeAnnotation'], TSTypeQuery: ['exprName', 'typeArguments'], TSTypeReference: ['typeName', 'typeArguments'], TSUndefinedKeyword: [], diff --git a/packages/website-eslint/build.mts b/packages/website-eslint/build.mts index 4c445e809ff5..ccb6606e34d8 100644 --- a/packages/website-eslint/build.mts +++ b/packages/website-eslint/build.mts @@ -1,4 +1,4 @@ -/* eslint-disable no-process-exit, no-console */ +/* eslint-disable no-console */ import * as esbuild from 'esbuild'; import * as fs from 'node:fs/promises'; @@ -93,6 +93,7 @@ async function buildPackage(name: string, file: string): Promise { setup(build): void { build.onLoad( makeFilter([ + '/getParsedConfigFile.ts', '/ts-eslint/ESLint.ts', '/ts-eslint/RuleTester.ts', '/ts-eslint/CLIEngine.ts', @@ -170,12 +171,5 @@ async function buildPackage(name: string, file: string): Promise { } console.time('building eslint for web'); - -buildPackage('index', './src/index.js') - .then(() => { - console.timeEnd('building eslint for web'); - }) - .catch((e: unknown) => { - console.error(String(e)); - process.exit(1); - }); +await buildPackage('index', './src/index.js'); +console.timeEnd('building eslint for web'); diff --git a/packages/website-eslint/package.json b/packages/website-eslint/package.json index 3a85f9c3b20b..149eb9cf736e 100644 --- a/packages/website-eslint/package.json +++ b/packages/website-eslint/package.json @@ -27,10 +27,11 @@ "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "scripts": { - "build": "tsx ./build.mts", - "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", - "lint": "npx nx lint", - "check-types": "npx nx typecheck" + "build": "yarn run -BT nx build", + "clean": "rimraf dist/", + "format": "yarn run -T format", + "lint": "yarn run -BT nx lint", + "typecheck": "yarn run -BT nx typecheck" }, "devDependencies": { "@eslint/js": "*", @@ -42,7 +43,27 @@ "esbuild": "~0.25.0", "eslint": "*", "esquery": "*", - "prettier": "^3.2.5", + "rimraf": "*", "tsx": "*" + }, + "nx": { + "name": "website-eslint", + "includedScripts": [ + "clean" + ], + "targets": { + "build": { + "command": "tsx build.mts", + "dependsOn": [ + "types:copy-ast-spec" + ], + "options": { + "cwd": "{projectRoot}" + } + }, + "lint": { + "command": "eslint" + } + } } } diff --git a/packages/website-eslint/project.json b/packages/website-eslint/project.json deleted file mode 100644 index 52ed1e539c3e..000000000000 --- a/packages/website-eslint/project.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "website-eslint", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "type": "library", - "implicitDependencies": [], - "targets": { - "lint": { - "executor": "@nx/eslint:lint", - "outputs": ["{options.outputFile}"] - } - } -} diff --git a/packages/website/blog/2025-05-29-project-service.mdx b/packages/website/blog/2025-05-29-project-service.mdx new file mode 100644 index 000000000000..eb64c4fc6754 --- /dev/null +++ b/packages/website/blog/2025-05-29-project-service.mdx @@ -0,0 +1,232 @@ +--- +authors: joshuakgoldberg +description: How typescript-eslint's new "Project Service" makes typed linting easier to configure, especially for large projects. +slug: project-service +tags: [parser, parser options, project, project service, tsconfig] +title: Typed Linting with Project Service +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +["Typed linting"](/blog/typed-linting), or enabling ESLint rules to understand TypeScript types, is one of the best parts of typescript-eslint. +It enables a slew of [more powerful lint rules](/rules/?=recommended-typeInformation) that check for nuanced bugs, best practice violations, and other code issues that can only be detected using type information. + +Typed linting hasn't always been straightforward to configure or performant at runtime. +We've seen users have to manage separate `tsconfig.eslint.json` files to enable typed linting — sometimes with different compiler options than the rest of the project. +Not ideal. + +In typescript-eslint 8.0, we stabilized a **`parserOptions.projectService`** option that uses more powerful, streamlined TypeScript APIs than before. +The "Project Service" brings several benefits: + +- ✍️ **Configuration**: simpler ESLint configs for typed linting with no ESLint-specific TSConfig files +- 🧠 **Predictability**: uses the same type information services as editors, including more reliability +- 🚀 **Scalability**: supporting TypeScript project references for larger repositories (i.e. monorepos) + +This blog post will cover how `parserOptions.projectService` simplifies configurations and aligns linting type information to what editors such as VS Code run with. + +:::tip +See [Getting Started](/getting-started) to learn how to lint JavaScript and TypeScript code with typescript-eslint, then [Linting with Type Information](/getting-started/typed-linting) to onboard to typed linting. +::: + + + +## Introducing the Project Service + +Back in [Relative TSConfig Projects with `parserOptions.project = true` > Project Services](2023-09-18-parser-options-project-true.md#project-services), we'd mentioned a replacement for `parserOptions.project`: + +> The downside of having users specify `parserOptions.project` at all is that `@typescript-eslint/parser` needs manual logic to create TypeScript Programs and associate them with linted files. +> Manual Program creation logic comes with a few issues: ... +> +> We're working on an option to instead call the same TypeScript "Project Service" APIs that editors such as VS Code use to create Programs for us instead. +> Project Services will automatically detect the TSConfig for each file (like `project: true`), and will also allow type information to be computed for JavaScript files without the `allowJs` compiler option (unlike `project: true`). + +Following a year of discussion and beta testing in typescript-eslint v6 and v7, we believe the new Project Service API is ready to be used by real-world projects. +We therefore promoted the `parserOptions.EXPERIMENTAL_useProjectService` option to the stable name **`parserOptions.projectService`** in typescript-eslint v8. + +:::note +See [Announcing typescript-eslint v8 > Project Service](/blog/announcing-typescript-eslint-v8#project-service) for the original announcement. +::: + +## Configuration + +You can change over to the new Project Service API by replacing `project` with `projectService` in your ESLint configuration: + + + + +```js title="eslint.config.js" +export default tseslint.config({ + // ... + languageOptions: { + parserOptions: { + // Remove this line + project: true, + // Add this line + projectService: true, + tsconfigRootDir: import.meta.dirname, + }, + }, + // ... +}); +``` + + + + +```js title=".eslintrc.cjs" +module.exports = { + // ... + parser: '@typescript-eslint/parser', + parserOptions: { + // Remove this line + project: true, + // Add this line + projectService: true, + tsconfigRootDir: __dirname, + }, + // ... +}; +``` + + + + +That's it! + +Other settings, including how you run ESLint and configure rules, should work the same. + +:::tip +See [Packages > Parser > `projectService`](/packages/parser#projectservice) for more details on granular configuration options. +::: + +### Additional Files + +One long-standing pain point of typed linting was enabling typed linting for files not included in the project's `tsconfig.json`. +Common solutions in the traditional Program API were to either skip typed linting for those files or to create a `tsconfig.eslint.json` enabling the `allowJs` compiler option. + +The new Project Service API allows for a configuration object specifying `allowDefaultProject`: a glob of "out-of-project" files to lint with type information. +That means you can lint those files without any new configuration files or TypeScript compiler options! + +For example, the following config solves the common case of projects that have root-level files like `eslint.config.js` or `vitest.config.ts`: + + + + +```js title="eslint.config.js" +export default tseslint.config({ + // ... + languageOptions: { + parserOptions: { + projectService: { + allowDefaultProject: ['*.js'], + }, + tsconfigRootDir: import.meta.dirname, + }, + }, + // ... +}); +``` + + + + +```js title=".eslintrc.cjs" +module.exports = { + // ... + parser: '@typescript-eslint/parser', + parserOptions: { + projectService: { + allowDefaultProject: ['*.js'], + tsconfigRootDir: __dirname, + }, + }, + // ... +}; +``` + + + + +This means most projects should be able to remove all `tsconfig.eslint.json` files! +🥳 + +:::tip +See [Packages > Parser > `projectService` > `ProjectServiceOptions`](/packages/parser#projectserviceoptions) for more details on out-of-project files and other granular configuration options. +::: + +## Predictability + +We've found configuring `tsconfig.eslint.json` files to be a common source of confusion with the traditional Program APIs. +They can result in the type information used for _linting_ accidentally being different from the type information used for _type checking_. +Unifying TypeScript configurations to the same `tsconfig.json` file(s) altogether avoids potential divergent types. + +Another benefit of using the new Project Service API is that typed linting requires no additional work in typescript-eslint for more difficult uses of ESLint and/or TypeScript. +We sometimes had to de-optimize the traditional Program API to support use cases: + +- CLI `--fix` mode would lose type information after the first pass ([#9577](https://github.com/typescript-eslint/typescript-eslint/pull/9577)) +- Extra file extensions such as `.svelte` and `.vue` were not supported at all ([#9504](https://github.com/typescript-eslint/typescript-eslint/issues/9504)) + +The new Project Service API does not suffer from these issues. +It supports extra file extensions out-of-the-box and does not slow down when used with ESLint's `--fix`. + +## Scalability + +[TypeScript's project references](https://www.typescriptlang.org/docs/handbook/project-references.html) are how many larger projects, in particular monorepos, scale TypeScript type checking. +They allow delineating discrete projects with their own `tsconfig.json` files and annotating which projects depend on which other projects. +TypeScript is able to cache type information and only recheck projects that have changed in builds based on those project references. + +The traditional `parserOptions.project` API did not support project references for typed linting. +We had experimented with adding support, but using the manual built-in TypeScript APIs would have been a significant maintenance investment with an unclear payoff. + +The new Project Service API does support project references out-of-the-box. +This is a huge win for monorepos, as it means you can lint all of your projects with type information without needing to create a separate `tsconfig.eslint.json` file for each project. + +## Performance + +Supporting project references allows the new Project Service API to be significantly faster than the traditional `parserOptions.project` API in many monorepo cases. +We've observed improvements for typed linting speed in real-world repositories [^babel-conversion] [^create-t3-app-conversion] [^sveltekit-conversion]. +For smaller projects, the performance of the new Project Service API is similar to the traditional `parserOptions.project` API. + +When we first started working with the new project service API, it outperformed equivalent `parserOptions.project` setups by ~10-15%. +Since then, we have observed regressions in performance that have brought it down in some cases to be slightly slower. + +We believe the new Project Service API should be faster than the traditional API, and are treating the lack of significant improvement as a bug. +See [⚡ Performance: parserOptions.projectService sometimes no longer outperforms parserOptions.project](https://github.com/typescript-eslint/typescript-eslint/issues/9571) for more information. + +## Next Steps + +The new Project Service API is available in typescript-eslint v8.0.0 and later. +We've been using it in our monorepo for over a year and have been thrilled to see many community repositories adopt it as well. + +### Giving Feedback + +We'd love to hear from you on how this option works for you. +Does it live up to what we've promised, and/or does it have bugs we haven't fixed yet? +Please do send us GitHub issues for any bugs you encounter or suggestions for how to improve the API. + +The [typescript-eslint Discord](https://discord.gg/FSxKq8Tdyg) is a great place to ask questions and engage with us more casually. +For support in onboarding, feel free to ask in its `#help` channel. +We'd be happy to help you try out `parserOptions.projectService` and learn more about how you use typescript-eslint. + +### Long Term Vision + +The new Project Service API is a great step towards making typed linting easier and more straightforward to configure. +Our priority for the next year will be to improve the new Project Service API so that it works in all places the traditional Program API does. +We won't remove the traditional project program behavior unless and until the new Project Service API is able to fully replace it. + +As of typescript-eslint@8.33.0, we've also extracted most of the Project Service code into a standalone [`@typescript-eslint/project-service`](/packages/project-service) package. +It has no dependencies on ESLint and is designed to be usable for any linter to enable TypeScript's Project Service API for typed linting. +See [Packages > Project Service](/packages/project-service) for more details. + +We're also looking forward to investigating support for [TypeScript's 10x faster Go port](https://github.com/typescript-eslint/typescript-eslint/issues/10940). +Abstracting configuration details into the Project Service API means it will be much easier for typescript-eslint to support typed linting using "tsgo" without any additional user configuration. + +So, please, try out the new Project Service API. +We're excited to hear how it works for you and what we can do to improve it. 💜 + +[^babel-conversion]: https://github.com/babel/babel/pull/16192#issue-2054613116 + +[^create-t3-app-conversion]: https://github.com/t3-oss/create-t3-app/pull/1936/#discussion_r1667389041 + +[^sveltekit-conversion]: https://github.com/sveltejs/kit/pull/13839 diff --git a/packages/website/data/sponsors.json b/packages/website/data/sponsors.json index e68c673c6f43..8079458ea4bb 100644 --- a/packages/website/data/sponsors.json +++ b/packages/website/data/sponsors.json @@ -3,7 +3,7 @@ "id": "ESLint", "image": "https://images.opencollective.com/eslint/48a2e5d/logo.png", "name": "ESLint", - "totalDonations": 3330000, + "totalDonations": 3360000, "website": "https://eslint.org/" }, { @@ -17,21 +17,21 @@ "id": "Nx (by Nrwl)", "image": "https://images.opencollective.com/nx/0efbe42/logo.png", "name": "Nx (by Nrwl)", - "totalDonations": 1250000, + "totalDonations": 1275000, "website": "https://nx.dev" }, { "id": "JetBrains", "image": "https://images.opencollective.com/jetbrains/fe76f99/logo.png", "name": "JetBrains", - "totalDonations": 850000, + "totalDonations": 900000, "website": "https://www.jetbrains.com/" }, { "id": "Cybozu", "image": "https://images.opencollective.com/cybozu/933e46d/logo.png", "name": "Cybozu", - "totalDonations": 685000, + "totalDonations": 710000, "website": "https://cybozu.co.jp/" }, { @@ -45,21 +45,21 @@ "id": "Codecademy", "image": "https://images.opencollective.com/codecademy/d56a48d/logo.png", "name": "Codecademy", - "totalDonations": 400000, + "totalDonations": 410000, "website": "https://codecademy.com" }, { "id": "Sourcegraph", "image": "https://images.opencollective.com/sourcegraph/f67b621/logo.png", "name": "Sourcegraph", - "totalDonations": 350000, + "totalDonations": 360000, "website": "https://about.sourcegraph.com" }, { "id": "Vite", "image": "https://images.opencollective.com/vite/e6d15e1/logo.png", "name": "Vite", - "totalDonations": 300000, + "totalDonations": 360000, "website": "https://vite.dev/" }, { @@ -69,6 +69,13 @@ "totalDonations": 300000, "website": "https://www.canva.com" }, + { + "id": "Airbnb", + "image": "https://images.opencollective.com/airbnb/d327d66/logo.png", + "name": "Airbnb", + "totalDonations": 295800, + "website": "https://www.airbnb.com/" + }, { "id": "THANKS.DEV", "image": "https://images.opencollective.com/thanks-dev/ed78b39/logo.png", @@ -76,18 +83,11 @@ "totalDonations": 293153, "website": "https://thanks.dev" }, - { - "id": "Airbnb", - "image": "https://images.opencollective.com/airbnb/d327d66/logo.png", - "name": "Airbnb", - "totalDonations": 290800, - "website": "https://www.airbnb.com/" - }, { "id": "GitBook", "image": "https://images.opencollective.com/gitbook/820419f/logo.png", "name": "GitBook", - "totalDonations": 230000, + "totalDonations": 240000, "website": "https://www.gitbook.com" }, { @@ -122,7 +122,7 @@ "id": "STORIS", "image": "https://images.opencollective.com/storis/dfb0e13/logo.png", "name": "STORIS", - "totalDonations": 106000, + "totalDonations": 109500, "website": "https://www.storis.com/" }, { @@ -157,9 +157,16 @@ "id": "WebdriverIO", "image": "https://images.opencollective.com/webdriverio/bbdd5c3/logo.png", "name": "WebdriverIO", - "totalDonations": 56000, + "totalDonations": 59500, "website": "https://webdriver.io/" }, + { + "id": "Torutek", + "image": "https://images.opencollective.com/torutek/logo.png", + "name": "Torutek", + "totalDonations": 55000, + "website": "https://torutek.com" + }, { "id": "Future Processing", "image": "https://images.opencollective.com/future-processing/1410d26/logo.png", @@ -174,6 +181,13 @@ "totalDonations": 50000, "website": "https://www.cryptonewsz.com/" }, + { + "id": "Defined Networking", + "image": "https://images.opencollective.com/defined-networking/072920e/logo.png", + "name": "Defined Networking", + "totalDonations": 50000, + "website": "https://www.defined.net" + }, { "id": "Skunk Team", "image": "https://images.opencollective.com/skunk-team/3ddba2f/logo.png", @@ -181,13 +195,6 @@ "totalDonations": 50000, "website": "https://skunk.team" }, - { - "id": "Torutek", - "image": "https://images.opencollective.com/torutek/logo.png", - "name": "Torutek", - "totalDonations": 50000, - "website": "https://torutek.com" - }, { "id": "vlt", "image": "https://images.opencollective.com/vlt/33d4066/logo.png", @@ -202,13 +209,6 @@ "totalDonations": 48000, "website": "https://joealden.com/" }, - { - "id": "Defined Networking", - "image": "https://images.opencollective.com/defined-networking/072920e/logo.png", - "name": "Defined Networking", - "totalDonations": 47500, - "website": "https://www.defined.net" - }, { "id": "Quicko", "image": "https://images.opencollective.com/quicko/7bd1dc9/logo.png", @@ -227,16 +227,9 @@ "id": "syntaxfm", "image": "https://avatars.githubusercontent.com/u/130389858?v=4", "name": "Syntax", - "totalDonations": 34399, + "totalDonations": 39473, "website": "https://syntax.fm" }, - { - "id": "frontendmasters", - "image": "https://avatars.githubusercontent.com/u/5613852?v=4", - "name": "Frontend Masters", - "totalDonations": 32379, - "website": "https://FrontendMasters.com" - }, { "id": "Monito", "image": "https://images.opencollective.com/monito/50fc878/logo.png", @@ -255,30 +248,37 @@ "id": "0+X", "image": "https://images.opencollective.com/0-x/707287f/logo.png", "name": "0+X", - "totalDonations": 29000, + "totalDonations": 30000, "website": "https://www.0x.se" }, { "id": "Trevor Burnham", "image": "https://images.opencollective.com/trevorburnham/016f6da/avatar.png", "name": "Trevor Burnham", - "totalDonations": 28000, + "totalDonations": 29000, "website": "https://trevorburnham.com" }, { "id": "Corellium", "image": "https://images.opencollective.com/corellium/aa8c228/logo.png", "name": "Corellium", - "totalDonations": 25200, + "totalDonations": 25800, "website": "https://www.corellium.com" }, { "id": "Evil Martians", "image": "https://images.opencollective.com/evilmartians/707ab4d/logo.png", "name": "Evil Martians", - "totalDonations": 25000, + "totalDonations": 25500, "website": "https://evilmartians.com/" }, + { + "id": "frontendmasters", + "image": "https://avatars.githubusercontent.com/u/5613852?v=4", + "name": "Frontend Masters", + "totalDonations": 24758, + "website": "https://FrontendMasters.com" + }, { "id": "revo.js", "image": "https://images.opencollective.com/revojsro/82623a7/logo.png", @@ -321,6 +321,13 @@ "totalDonations": 17000, "website": "https://balsa.com/" }, + { + "id": "getsentry", + "image": "https://avatars.githubusercontent.com/u/1396951?v=4", + "name": "Sentry", + "totalDonations": 15455, + "website": "https://sentry.io" + }, { "id": "THE PADDING", "image": "https://images.opencollective.com/thepadding/55e79ad/logo.png", @@ -328,26 +335,19 @@ "totalDonations": 15000, "website": "https://paddn.com/" }, - { - "id": "Now4real", - "image": "https://images.opencollective.com/now4real/54ca7d9/logo.png", - "name": "Now4real", - "totalDonations": 14500, - "website": "https://now4real.com/" - }, { "id": "codecov", "image": "https://avatars.githubusercontent.com/u/8226205?v=4", "name": "Codecov", - "totalDonations": 13431, + "totalDonations": 14501, "website": "https://codecov.io/" }, { - "id": "getsentry", - "image": "https://avatars.githubusercontent.com/u/1396951?v=4", - "name": "Sentry", - "totalDonations": 13394, - "website": "https://sentry.io" + "id": "Now4real", + "image": "https://images.opencollective.com/now4real/54ca7d9/logo.png", + "name": "Now4real", + "totalDonations": 14500, + "website": "https://now4real.com/" }, { "id": "gitbutlerapp", @@ -363,6 +363,13 @@ "totalDonations": 11200, "website": "https://kwork.studio/" }, + { + "id": "charmed-kubernetes", + "image": "https://avatars.githubusercontent.com/u/49082977?v=4", + "name": "Charmed Kubernetes", + "totalDonations": 10488, + "website": "https://www.ubuntu.com/kubernetes" + }, { "id": "Gianfranco Palumbo", "image": "https://images.opencollective.com/gianpaj/5d62d25/avatar.png", diff --git a/packages/website/docusaurus.config.mts b/packages/website/docusaurus.config.mts index 338a013d947e..9a51ea074f54 100644 --- a/packages/website/docusaurus.config.mts +++ b/packages/website/docusaurus.config.mts @@ -18,6 +18,10 @@ const remarkPlugins: MDXPlugin[] = [[npm2yarnPlugin, { sync: true }]]; const githubUrl = 'https://github.com/typescript-eslint/typescript-eslint'; +const currentMajorVersion = + process.env.CURRENT_MAJOR_VERSION && + Number(process.env.CURRENT_MAJOR_VERSION); + const presetClassicOptions: PresetClassicOptions = { blog: { blogSidebarCount: 'ALL', @@ -60,6 +64,26 @@ const themeConfig: AlgoliaThemeConfig & ThemeCommonConfig = { appId: 'N1HUB2TU6A', indexName: 'typescript-eslint', }, + announcementBar: + currentMajorVersion && + Number(version[0].split('.')[0]) < currentMajorVersion + ? { + content: [ + 'This documentation is for an older major version of typescript-eslint.', + '
', + 'It is no longer maintained or supported. It may crash with the latest versions of TypeScript.', + '
', + 'Using the latest version of typescript-eslint is strongly recommended for', + 'getting the latest rule features and fixes, ', + 'supporting the latest TypeScript features and syntax, and', + 'continuous performance and stability improvements.', + '
', + 'Please visit typescript-eslint.io for the latest version\'s documentation.', + ].join('\n'), + id: 'old-version-announcement', + isCloseable: false, + } + : undefined, colorMode: { respectPrefersColorScheme: true, }, @@ -327,8 +351,7 @@ const redirects: PluginRedirectOptions = { const config: Config = { baseUrl: '/', - tagline: - 'The tooling that enables ESLint and Prettier to support TypeScript.', + tagline: 'Powerful static analysis for JavaScript and TypeScript.', title: 'typescript-eslint', url: 'https://typescript-eslint.io', @@ -344,7 +367,14 @@ const config: Config = { onBrokenMarkdownLinks: 'throw', organizationName: 'typescript-eslint', plugins: [ - ...['ast-spec', 'type-utils'].map(packageName => [ + './plugins/recent-blog-posts/index.ts', + ...[ + 'ast-spec', + 'project-service', + 'rule-schema-to-typescript-types', + 'tsconfig-utils', + 'type-utils', + ].map(packageName => [ 'docusaurus-plugin-typedoc', { entryPoints: [`../${packageName}/src/index.ts`], diff --git a/packages/website/package.json b/packages/website/package.json index 9fdb887577ce..91c2467d7f8e 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -12,51 +12,52 @@ "homepage": "https://typescript-eslint.io", "license": "MIT", "scripts": { - "build": "docusaurus build", + "build": "yarn run -BT nx build", "clear": "docusaurus clear", - "format": "prettier --write \"./**/*.{md,mdx,ts,js,tsx,jsx}\" --ignore-path ../../.prettierignore", + "clean": "rimraf dist/ build/ .docusaurus/ && yarn run clear", + "format": "yarn run -T format", "generate-website-dts": "tsx ./tools/generate-website-dts.mts", "stylelint": "stylelint \"src/**/*.css\"", "stylelint:fix": "stylelint \"src/**/*.css\" --fix", - "lint": "npx nx lint", + "lint": "yarn run -BT nx lint", "serve": "docusaurus serve", - "start": "npx nx start", + "start": "yarn run -BT nx start", "swizzle": "docusaurus swizzle", - "check-types": "npx nx typecheck" + "typecheck": "yarn run -BT nx typecheck" }, "dependencies": { "@babel/runtime": "^7.24.4", - "@docusaurus/core": "^3.2.1", - "@docusaurus/plugin-client-redirects": "^3.2.1", - "@docusaurus/plugin-pwa": "^3.2.1", - "@docusaurus/preset-classic": "^3.2.1", - "@docusaurus/remark-plugin-npm2yarn": "^3.2.1", - "@docusaurus/theme-common": "^3.2.1", + "@docusaurus/core": "~3.7.0", + "@docusaurus/plugin-client-redirects": "~3.7.0", + "@docusaurus/plugin-pwa": "~3.7.0", + "@docusaurus/preset-classic": "~3.7.0", + "@docusaurus/remark-plugin-npm2yarn": "~3.7.0", + "@docusaurus/theme-common": "~3.7.0", "@typescript-eslint/parser": "workspace:*", "@typescript-eslint/website-eslint": "workspace:*", "@uiw/react-shields": "2.0.1", "clsx": "^2.1.0", "docusaurus-plugin-typedoc": "^1.4.0", "eslint": "^9.15.0", + "gray-matter": "^4.0.3", "json5": "^2.2.3", "konamimojisplosion": "^0.5.2", "lz-string": "^1.5.0", - "prettier": "^3.2.5", + "prettier": "3.6.2", "prism-react-renderer": "^2.3.1", "react": "^18.2.0", "react-dom": "^18.2.0", "react-markdown": "^10.0.0", "react-resizable-panels": "^3.0.0", + "reading-time": "^1.5.0", "semver": "^7.6.0", "typedoc": "^0.28.4", "typedoc-plugin-markdown": "^4.6.3", - "typescript": "*" - }, - "resolutions": { - "react": "^18.2.0" + "typescript": "*", + "zod": "^3.25.67" }, "devDependencies": { - "@docusaurus/module-type-aliases": "^3.2.1", + "@docusaurus/module-type-aliases": "~3.7.0", "@types/mdast": "^4.0.3", "@types/react": "*", "@types/unist": "^3.0.2", @@ -72,7 +73,7 @@ "make-dir": "*", "mdast-util-from-markdown": "^2.0.1", "mdast-util-mdx": "^3.0.0", - "monaco-editor": "~0.52.0", + "monaco-editor": "~0.54.0", "raw-loader": "^4.0.2", "rimraf": "*", "stylelint": "^16.3.1", @@ -95,5 +96,37 @@ "last 1 firefox version", "last 1 safari version" ] + }, + "nx": { + "name": "website", + "includedScripts": [ + "clean" + ], + "targets": { + "build": { + "command": "docusaurus build", + "dependsOn": [ + "^build" + ], + "options": { + "cwd": "{projectRoot}" + } + }, + "lint": { + "command": "eslint", + "dependsOn": [ + "build" + ] + }, + "start": { + "command": "docusaurus start", + "dependsOn": [ + "^build" + ], + "options": { + "cwd": "{projectRoot}" + } + } + } } } diff --git a/packages/website/plugins/generated-rule-docs/insertions/insertNewRuleReferences.ts b/packages/website/plugins/generated-rule-docs/insertions/insertNewRuleReferences.ts index 5c934e2f025e..2154ca000f61 100644 --- a/packages/website/plugins/generated-rule-docs/insertions/insertNewRuleReferences.ts +++ b/packages/website/plugins/generated-rule-docs/insertions/insertNewRuleReferences.ts @@ -2,7 +2,7 @@ import type { ESLintPluginDocs } from '@typescript-eslint/eslint-plugin/use-at-y import type * as mdast from 'mdast'; import type { MdxJsxFlowElement } from 'mdast-util-mdx'; -import { compile } from '@typescript-eslint/rule-schema-to-typescript-types'; +import { schemaToTypes } from '@typescript-eslint/rule-schema-to-typescript-types'; import { EOL } from 'node:os'; import * as path from 'node:path'; import prettier from 'prettier'; @@ -32,7 +32,7 @@ const PRETTIER_CONFIG_PATH = path.resolve( '..', '.prettierrc.json', ); -const prettierConfig = (async () => { +const lazyPrettierConfig = (async () => { const filepath = path.join(__dirname, 'file.ts'); const config = await prettier.resolveConfig(filepath, { config: PRETTIER_CONFIG_PATH, @@ -149,6 +149,7 @@ export async function insertNewRuleReferences( 'This rule is not configurable.', ); } else if (!COMPLICATED_RULE_OPTIONS.has(page.file.stem)) { + const prettierConfig = await lazyPrettierConfig; page.spliceChildren( page.headingIndices.options + 1, 0, @@ -159,11 +160,11 @@ export async function insertNewRuleReferences( lang: 'ts', type: 'code', value: [ - await compile(page.rule.meta.schema, prettierConfig), await prettier.format( - getRuleDefaultOptions(page), - await prettierConfig, + schemaToTypes(page.rule.meta.schema), + prettierConfig, ), + await prettier.format(getRuleDefaultOptions(page), prettierConfig), ] .join(EOL) .trim(), @@ -190,9 +191,13 @@ function getRuleDefaultOptions(page: RuleDocsPage): string { return typeof recommended === 'object' ? [ - `const defaultOptionsRecommended: Options = ${defaults};`, - '', - '// These options are merged on top of the recommended defaults', + ...(recommended.recommended + ? [ + `const defaultOptionsRecommended: Options = ${defaults};`, + '', + '// These options are merged on top of the recommended defaults', + ] + : []), `const defaultOptionsStrict: Options = ${JSON.stringify(recommended.strict)};`, ].join('\n') : `const defaultOptions: Options = ${defaults};`; diff --git a/packages/website/plugins/recent-blog-posts/index.ts b/packages/website/plugins/recent-blog-posts/index.ts new file mode 100644 index 000000000000..a3f37b8b0d27 --- /dev/null +++ b/packages/website/plugins/recent-blog-posts/index.ts @@ -0,0 +1,46 @@ +import type { Plugin } from '@docusaurus/types'; + +import matter from 'gray-matter'; +import * as fs from 'node:fs/promises'; +import readingTime from 'reading-time'; +import { z } from 'zod'; + +const storageFile = `data/recent-blog-posts.json`; + +const matterSchema = z.object({ + description: z.string(), + slug: z.string(), + title: z.string(), +}); + +export default async function blogPluginEnhanced(): Promise { + const blogHandles = (await fs.readdir('blog', { withFileTypes: true })) + .filter(handle => handle.isFile() && /.mdx?$/.test(handle.name)) + .map(handle => ({ + date: new Date(/\d+-\d+-\d+/.exec(handle.name)?.[0] || '1970-01-01'), + handle, + })) + .sort((a, b) => b.date.getTime() - a.date.getTime()) + .slice(0, 3); + + const blogPosts = await Promise.all( + blogHandles.map(async ({ date, handle }) => { + const content = await fs.readFile(`blog/${handle.name}`, 'utf-8'); + const data = matterSchema.parse(matter(content).data); + + return { + date, + description: data.description, + readingTime: Math.round(readingTime(content).minutes), + slug: data.slug, + title: data.title, + }; + }), + ); + + await fs.writeFile(storageFile, JSON.stringify(blogPosts, null, 2)); + + return { + name: 'recent-blog-posts', + }; +} diff --git a/packages/website/project.json b/packages/website/project.json deleted file mode 100644 index c9b3f62d96f5..000000000000 --- a/packages/website/project.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "website", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "type": "library", - "implicitDependencies": [], - "targets": { - "start": { - "dependsOn": ["website-eslint:build"], - "executor": "nx:run-commands", - "options": { - "cwd": "packages/website", - "command": "docusaurus start" - } - }, - "lint": { - "executor": "@nx/eslint:lint", - "outputs": ["{options.outputFile}"] - } - } -} diff --git a/packages/website/sidebars/sidebar.base.js b/packages/website/sidebars/sidebar.base.js index b0d55ed91ffb..a6d6e196d9e0 100644 --- a/packages/website/sidebars/sidebar.base.js +++ b/packages/website/sidebars/sidebar.base.js @@ -103,8 +103,11 @@ module.exports = { 'packages/eslint-plugin', 'packages/eslint-plugin-tslint', 'packages/parser', + 'packages/project-service', + 'packages/rule-schema-to-typescript-types', 'packages/rule-tester', 'packages/scope-manager', + 'packages/tsconfig-utils', { collapsible: false, items: ['packages/type-utils/type-or-value-specifier'], diff --git a/packages/website/src/components/ErrorsViewer.tsx b/packages/website/src/components/ErrorsViewer.tsx index b9f6528672be..b37597f69483 100644 --- a/packages/website/src/components/ErrorsViewer.tsx +++ b/packages/website/src/components/ErrorsViewer.tsx @@ -86,7 +86,7 @@ function ErrorBlock({ )}
- {item.suggestions.length > 0 && ( + {item.suggestions && item.suggestions.length > 0 && (
{item.suggestions.map((fixer, index) => (
-

- The typescript-eslint project would not be possible without the generous - support of our financial contributors. -

-
- - - -
-
- - Become a financial sponsor - -
- - See all financial sponsors - - - Docs - -
-
- - ); -} diff --git a/packages/website/src/components/Playground.tsx b/packages/website/src/components/Playground.tsx index f3c13bee498b..4b2f6f91c6ad 100644 --- a/packages/website/src/components/Playground.tsx +++ b/packages/website/src/components/Playground.tsx @@ -33,7 +33,11 @@ function Playground(): React.JSX.Element { const windowSize = useWindowSize(); const [state, setState] = useHashState(defaultConfig); const [astModel, setAstModel] = useState(); - const [markers, setMarkers] = useState(); + const [markers, setMarkers] = useState>({ + code: [], + eslintrc: [], + tsconfig: [], + }); const [ruleNames, setRuleNames] = useState([]); const [isLoading, setIsLoading] = useState(true); const [tsVersions, setTSVersion] = useState([]); @@ -165,8 +169,10 @@ function Playground(): React.JSX.Element { active={state.showAST ?? false} additionalTabsInfo={{ Errors: - markers?.reduce((prev, cur) => prev + cur.items.length, 0) || - 0, + markers[activeTab].reduce( + (prev, cur) => prev + cur.items.length, + 0, + ) || 0, }} change={showAST => setState({ showAST })} tabs={detailTabs} @@ -216,7 +222,7 @@ function Playground(): React.JSX.Element { /> ) ) : ( - + )}
diff --git a/packages/website/src/components/RulesTable/index.tsx b/packages/website/src/components/RulesTable/index.tsx index 1825fefcb02d..68315eb926c9 100644 --- a/packages/website/src/components/RulesTable/index.tsx +++ b/packages/website/src/components/RulesTable/index.tsx @@ -10,6 +10,7 @@ import React, { useMemo } from 'react'; import type { HistorySelector } from '../../hooks/useHistorySelector'; import { useHistorySelector } from '../../hooks/useHistorySelector'; +import { getRecommendationWithEmoji } from '../../theme/MDXComponents/RuleAttributes'; import { CONFIG_EMOJI, DEPRECATED_RULE_EMOJI, @@ -35,9 +36,9 @@ function interpolateCode( function getActualRecommended({ docs, -}: RulesMeta[number]): RuleRecommendation | undefined { +}: RulesMeta[number]): ['', ''] | [string, RuleRecommendation] { const recommended = docs.recommended; - return typeof recommended === 'object' ? 'recommended' : recommended; + return recommended ? getRecommendationWithEmoji(recommended) : ['', '']; } function RuleRow({ @@ -50,31 +51,21 @@ function RuleRow({ } const { deprecated, fixable, hasSuggestions } = rule; const { extendsBaseRule, requiresTypeChecking } = rule.docs; - const actualRecommended = getActualRecommended(rule); + const [emoji, actualRecommended] = getActualRecommended(rule); return (
- - @typescript-eslint/{rule.name} - +
+ + @typescript-eslint/{rule.name} + + {rule.docs.frozen && ❄️} +

{interpolateCode(rule.docs.description)}
- {(() => { - switch (actualRecommended) { - case 'recommended': - return RECOMMENDED_CONFIG_EMOJI; - case 'strict': - return STRICT_CONFIG_EMOJI; - case 'stylistic': - return STYLISTIC_CONFIG_EMOJI; - default: - // for some reason the current version of babel loader won't elide - // this correctly recommended satisfies undefined; - return ''; - } - })()} + {emoji} rules.filter(r => { - const actualRecommended = getActualRecommended(r); + const actualRecommended = getActualRecommended(r)[1]; const opinions = [ match(filters.recommended, actualRecommended === 'recommended'), match( diff --git a/packages/website/src/components/RulesTable/styles.module.css b/packages/website/src/components/RulesTable/styles.module.css index 3ffcec037609..606453e07ac6 100644 --- a/packages/website/src/components/RulesTable/styles.module.css +++ b/packages/website/src/components/RulesTable/styles.module.css @@ -145,3 +145,9 @@ text-align: center; cursor: default; } + +.ruleNameWrapper { + display: inline-flex; + align-items: center; + gap: 0.5rem; +} diff --git a/packages/website/src/components/editor/LoadedEditor.tsx b/packages/website/src/components/editor/LoadedEditor.tsx index 0cc5dbe16299..1b7937e5244a 100644 --- a/packages/website/src/components/editor/LoadedEditor.tsx +++ b/packages/website/src/components/editor/LoadedEditor.tsx @@ -83,8 +83,23 @@ export const LoadedEditor: React.FC = ({ const markers = monaco.editor.getModelMarkers({ resource: model.uri, }); - onMarkersChange(parseMarkers(markers, codeActions, editor)); - }, [codeActions, onMarkersChange, editor, monaco.editor]); + + const errors = parseMarkers(markers, codeActions, editor); + + onMarkersChange(prev => { + const tsconfigErrors = + activeTab === 'tsconfig' && + !errors.length && + Object.values(prev[activeTab]).filter( + error => error.group === 'TypeScript', + ); + + return { + ...prev, + [activeTab]: tsconfigErrors || errors, + }; + }); + }, [activeTab, codeActions, onMarkersChange, editor, monaco.editor]); useEffect(() => { webLinter.updateParserOptions(sourceType); diff --git a/packages/website/src/components/editor/createProvideTwoslashInlay.ts b/packages/website/src/components/editor/createProvideTwoslashInlay.ts index e775e80e519a..89f3c7bb26ce 100644 --- a/packages/website/src/components/editor/createProvideTwoslashInlay.ts +++ b/packages/website/src/components/editor/createProvideTwoslashInlay.ts @@ -8,14 +8,9 @@ import type * as ts from 'typescript'; import type { SandboxInstance } from './useSandboxServices'; function findTwoshashQueries(code: string): RegExpExecArray[] { - let match: RegExpExecArray | null = null; - const matches: RegExpExecArray[] = []; // RegExp that matches '^//?$' const twoslashQueryRegex = /^(\s*\/\/\s*\^\?)\s*$/gm; - while ((match = twoslashQueryRegex.exec(code))) { - matches.push(match); - } - return matches; + return [...code.matchAll(twoslashQueryRegex)]; } export function createTwoslashInlayProvider( diff --git a/packages/website/src/components/editor/types.ts b/packages/website/src/components/editor/types.ts index 3b8b41a67944..932f7cf5d9ad 100644 --- a/packages/website/src/components/editor/types.ts +++ b/packages/website/src/components/editor/types.ts @@ -5,7 +5,9 @@ export interface CommonEditorProps extends ConfigModel { readonly activeTab: TabType; readonly onASTChange: (value: UpdateModel | undefined) => void; readonly onChange: (cfg: Partial) => void; - readonly onMarkersChange: (value: ErrorGroup[]) => void; + readonly onMarkersChange: React.Dispatch< + React.SetStateAction> + >; readonly onSelect: (position?: number) => void; readonly selectedRange?: SelectedRange; } diff --git a/packages/website/src/components/editor/useSandboxServices.ts b/packages/website/src/components/editor/useSandboxServices.ts index d3a6e7fc00e3..0e46551a2350 100644 --- a/packages/website/src/components/editor/useSandboxServices.ts +++ b/packages/website/src/components/editor/useSandboxServices.ts @@ -6,12 +6,13 @@ import semverSatisfies from 'semver/functions/satisfies'; import type { createTypeScriptSandbox } from '../../vendor/sandbox'; import type { CreateLinter } from '../linter/createLinter'; -import type { PlaygroundSystem } from '../linter/types'; +import type { PlaygroundSystem, RegisterFile } from '../linter/types'; import type { RuleDetails } from '../types'; import type { CommonEditorProps } from './types'; import rootPackageJson from '../../../../../package.json'; import { createCompilerOptions } from '../lib/createCompilerOptions'; +import { createEventsBinder } from '../lib/createEventsBinder'; import { createFileSystem } from '../linter/bridge'; import { createLinter } from '../linter/createLinter'; import { createTwoslashInlayProvider } from './createProvideTwoslashInlay'; @@ -79,6 +80,7 @@ export const useSandboxServices = ( sandboxInstance.language, createTwoslashInlayProvider(sandboxInstance), ); + const onModelCreate = createEventsBinder(); const system = createFileSystem(props, sandboxInstance.tsvfs); @@ -89,6 +91,7 @@ export const useSandboxServices = ( } const path = model.uri.path.replace('/file:///', '/'); system.writeFile(path, model.getValue()); + onModelCreate.trigger(path, model.getValue()); }); // Delete files in vfs when a model is disposed in the editor (this is used only for ATA types) sandboxInstance.monaco.editor.onWillDisposeModel(model => { @@ -116,7 +119,9 @@ export const useSandboxServices = ( system, lintUtils, sandboxInstance.tsvfs, + props.onMarkersChange, ); + onModelCreate.register(webLinter.registerFile); onLoaded( [...webLinter.rules.values()], diff --git a/packages/website/src/components/home/ExplainerSpotlight/index.tsx b/packages/website/src/components/home/ExplainerSpotlight/index.tsx new file mode 100644 index 000000000000..56fc2b5874a1 --- /dev/null +++ b/packages/website/src/components/home/ExplainerSpotlight/index.tsx @@ -0,0 +1,26 @@ +import Heading from '@theme/Heading'; +import React from 'react'; + +import styles from './styles.module.css'; + +export interface ExplainerSpotlightProps extends React.PropsWithChildren { + header: string; + emoji: string; + href: string; +} + +export function ExplainerSpotlight({ + children, + emoji, + header, + href, +}: ExplainerSpotlightProps): React.JSX.Element { + return ( + + + {header} {emoji} + +
{children}
+
+ ); +} diff --git a/packages/website/src/components/home/ExplainerSpotlight/styles.module.css b/packages/website/src/components/home/ExplainerSpotlight/styles.module.css new file mode 100644 index 000000000000..97d9bb447a70 --- /dev/null +++ b/packages/website/src/components/home/ExplainerSpotlight/styles.module.css @@ -0,0 +1,28 @@ +.explainerSpotlight { + background: var(--ifm-color-emphasis-100); + border-radius: var(--ifm-global-radius); + color: var(--ifm-heading-color); + padding: 1rem 1.5rem; + text-decoration: none; + transition: box-shadow 0.3s ease; + width: 100%; +} + +[data-theme='dark'] .explainerSpotlight { + background: var(--ifm-color-emphasis-200); +} + +.explainerSpotlight:hover { + color: var(--ifm-heading-color); + text-decoration: none; + box-shadow: 0 3px 3px 0 var(--gray-border-shadow); +} + +.heading { + display: flex; + justify-content: space-between; +} + +.emoji { + user-select: none; +} diff --git a/packages/website/src/components/home/Explainers/index.tsx b/packages/website/src/components/home/Explainers/index.tsx new file mode 100644 index 000000000000..9545ebc6552c --- /dev/null +++ b/packages/website/src/components/home/Explainers/index.tsx @@ -0,0 +1,83 @@ +import Link from '@docusaurus/Link'; +import useBaseUrl from '@docusaurus/useBaseUrl'; +import Heading from '@theme/Heading'; +import clsx from 'clsx'; +import React from 'react'; + +import { ExplainerSpotlight } from '../ExplainerSpotlight'; +import styles from './styles.module.css'; + +const explanations = [ + { + children: + 'The parser and services for linting TypeScript code with ESLint, as well as how tools such as Prettier read TypeScript code.', + emoji: '⚙️', + header: 'Language Support', + href: '/getting-started', + }, + { + children: + 'Over 100 rules that check for best practices, likely bugs, and stylistic consistency in modern JavaScript and TypeScript codebases.', + emoji: '🧠', + header: 'Standard Rules', + href: '/rules', + }, + { + children: + "Industry-leading services that use TypeScript's type APIs to make a more powerful breed of lint rules for deeper insights into code.", + emoji: '⚡️', + header: 'Typed Linting', + href: '/getting-started/typed-linting', + }, +]; + +export function Explainers(): React.JSX.Element { + return ( +
+ + typescript-eslint enables ESLint, Prettier, and more to + support TypeScript code. + +
    + {explanations.map(({ header, ...rest }) => ( + + ))} +
+
+

+ ESLint is a linter. It runs a set of rules to find + likely problems and suggested fixes to improve your code. +

+

+ TypeScript is a language and a type checker. The + language adds syntax for types to JavaScript. +
+ The type checker analyzes code to find mismatches between uses of + values and types. +

+

+ typescript-eslint is necessary for JavaScript tools + such as ESLint to work with TypeScript's new syntax. +
+ It also adds lint rules for TypeScript, including many that use the + power of types to better analyze code. +

+
+ +
+ + Learn More + + + See the Rules + +
+
+ ); +} diff --git a/packages/website/src/components/home/Explainers/styles.module.css b/packages/website/src/components/home/Explainers/styles.module.css new file mode 100644 index 000000000000..6e7e07c7488a --- /dev/null +++ b/packages/website/src/components/home/Explainers/styles.module.css @@ -0,0 +1,56 @@ +.explainers { + --ifm-button-size-multiplier: 1.3; + + align-items: center; + display: flex; + flex-direction: column; + margin: 1rem; +} + +.explainerTexts { + font-size: 1.1rem; + margin: 1rem 2rem; + text-align: left; + display: flex; + gap: 1rem; + flex-direction: column; +} + +.explainerTexts p { + margin: 0; +} + +.explainerSpotlights { + display: flex; + flex-direction: column; + gap: 1rem; + margin: 2rem auto 2.5rem; +} + +.buttons { + margin: 1rem auto 0; + display: flex; + flex-direction: column; + gap: 1rem; +} + +@media (width >= 996px) { + .explainers { + margin-bottom: 2rem; + } + + .explainerSpotlights { + flex-direction: row; + max-width: var(--ifm-container-width); + } + + .explainerTexts { + margin: 0.5rem 2rem 2rem; + text-align: center; + } + + .buttons { + flex-direction: row; + gap: 2rem; + } +} diff --git a/packages/website/src/components/home/Feature.module.css b/packages/website/src/components/home/Feature.module.css new file mode 100644 index 000000000000..e807de939ad6 --- /dev/null +++ b/packages/website/src/components/home/Feature.module.css @@ -0,0 +1,6 @@ +.buttons { + align-items: center; + display: flex; + width: 100%; + justify-content: center; +} diff --git a/packages/website/src/components/home/FinancialContributors/index.tsx b/packages/website/src/components/home/FinancialContributors/index.tsx new file mode 100644 index 000000000000..2efdc0976fe2 --- /dev/null +++ b/packages/website/src/components/home/FinancialContributors/index.tsx @@ -0,0 +1,77 @@ +import Link from '@docusaurus/Link'; +import sponsors from '@site/data/sponsors.json'; +import Heading from '@theme/Heading'; +import clsx from 'clsx'; +import React from 'react'; + +import { Sponsors } from '../Sponsors'; +import styles from './styles.module.css'; + +export function FinancialContributors(): React.JSX.Element { + return ( +
+
+ + Financial Contributors + +

+ The typescript-eslint project would not be possible without the + generous support of our financial contributors. +

+
+ + + +
+

+ Financial sponsors allow us to keep development of typescript-eslint + going, including maintaining and improving the project, providing + support to users, and pushing web ecosystem static analysis forward + with advances in typed linting. +

+
+ + Become a financial sponsor + +
+ + All sponsors + + + Sponsorship docs + +
+
+
+
+ ); +} diff --git a/packages/website/src/components/FinancialContributors/styles.module.css b/packages/website/src/components/home/FinancialContributors/styles.module.css similarity index 78% rename from packages/website/src/components/FinancialContributors/styles.module.css rename to packages/website/src/components/home/FinancialContributors/styles.module.css index c30c1163c341..95fee5fd1f69 100644 --- a/packages/website/src/components/FinancialContributors/styles.module.css +++ b/packages/website/src/components/home/FinancialContributors/styles.module.css @@ -1,8 +1,15 @@ -.sponsorLink { - display: inline-flex; - flex-direction: column; - gap: 8px; - height: 100%; +.financialContributors { + align-items: center; + background: var(--ifm-color-emphasis-0); + display: flex; + text-align: center; + width: 100%; +} + +.details { + font-size: 1.2rem; + max-width: min(70vw, 70rem); + margin: 2rem auto; } .linksArea { @@ -57,10 +64,6 @@ grid-area: 2 / 2 / 3 / 3; } - .sponsorLink { - display: flex; - } - .linksArea { margin: 24px; } diff --git a/packages/website/src/components/FinancialContributors/types.ts b/packages/website/src/components/home/FinancialContributors/types.ts similarity index 100% rename from packages/website/src/components/FinancialContributors/types.ts rename to packages/website/src/components/home/FinancialContributors/types.ts diff --git a/packages/website/src/components/home/RecentBlogPosts/index.tsx b/packages/website/src/components/home/RecentBlogPosts/index.tsx new file mode 100644 index 000000000000..94ccd1929217 --- /dev/null +++ b/packages/website/src/components/home/RecentBlogPosts/index.tsx @@ -0,0 +1,48 @@ +import Link from '@docusaurus/Link'; +import recentPosts from '@site/data/recent-blog-posts.json'; +import Heading from '@theme/Heading'; +import clsx from 'clsx'; +import React from 'react'; +import Markdown from 'react-markdown'; + +import styles from './styles.module.css'; + +export function RecentBlogPosts(): React.JSX.Element { + return ( +
+ +
+ ); +} diff --git a/packages/website/src/components/home/RecentBlogPosts/styles.module.css b/packages/website/src/components/home/RecentBlogPosts/styles.module.css new file mode 100644 index 000000000000..26478b682905 --- /dev/null +++ b/packages/website/src/components/home/RecentBlogPosts/styles.module.css @@ -0,0 +1,84 @@ +.blogPosts { + background: var(--ifm-color-emphasis-100); + padding: 1rem 0; +} + +.postsList { + display: flex; + flex-direction: column; + gap: 1rem; + list-style: none; + margin: 2.5rem 0 1.5rem; + padding-left: 0; +} + +.post { + background: var(--ifm-color-emphasis-0); + border-radius: var(--ifm-global-radius); + display: flex; + flex-direction: column; + flex: 1; + padding: 1rem; + text-align: left; + transition: box-shadow 0.3s ease; +} + +[data-theme='dark'] .post { + background: var(--ifm-color-emphasis-200); +} + +.post:hover { + color: var(--ifm-heading-color); + text-decoration: none; + box-shadow: 0 3px 3px 0 var(--gray-border-shadow); +} + +.postLink, +.postLink:focus, +.postLink:hover { + color: initial; + text-decoration: none; + display: contents; +} + +.post p { + margin: 0; +} + +.postTitle { + font-weight: bold; + font-size: 1.2rem; + line-height: 1.25; + margin-bottom: 0.5rem; +} + +.postTiming { + align-items: flex-end; + display: flex; + flex-grow: 2; + font-size: 0.75rem; + font-style: italic; + gap: 0.35rem; + margin-top: 0.5rem; +} + +.seeAll { + font-size: 1.25rem; + padding: 0.75rem 1.75rem; + margin-top: 1.5rem; +} + +@media (width >= 996px) { + .blogPosts { + padding: 1rem 0 2rem; + } + + .postsList { + flex-direction: row; + gap: 2rem; + } + + .postTitle { + margin-bottom: 1rem; + } +} diff --git a/packages/website/src/components/FinancialContributors/Sponsor.tsx b/packages/website/src/components/home/Sponsor/index.tsx similarity index 90% rename from packages/website/src/components/FinancialContributors/Sponsor.tsx rename to packages/website/src/components/home/Sponsor/index.tsx index 3f3ce6d8036f..a2c90f871b02 100644 --- a/packages/website/src/components/FinancialContributors/Sponsor.tsx +++ b/packages/website/src/components/home/Sponsor/index.tsx @@ -1,7 +1,7 @@ import Link from '@docusaurus/Link'; import React from 'react'; -import type { SponsorData } from './types'; +import type { SponsorData } from '../FinancialContributors/types'; import styles from './styles.module.css'; diff --git a/packages/website/src/components/home/Sponsor/styles.module.css b/packages/website/src/components/home/Sponsor/styles.module.css new file mode 100644 index 000000000000..c722560fd076 --- /dev/null +++ b/packages/website/src/components/home/Sponsor/styles.module.css @@ -0,0 +1,12 @@ +.sponsorLink { + display: inline-flex; + flex-direction: column; + gap: 8px; + height: 100%; +} + +@media screen and (width >= 1150px) { + .sponsorLink { + display: flex; + } +} diff --git a/packages/website/src/components/FinancialContributors/Sponsors/index.tsx b/packages/website/src/components/home/Sponsors/index.tsx similarity index 91% rename from packages/website/src/components/FinancialContributors/Sponsors/index.tsx rename to packages/website/src/components/home/Sponsors/index.tsx index 68fc7cac4bfe..b3cf28471467 100644 --- a/packages/website/src/components/FinancialContributors/Sponsors/index.tsx +++ b/packages/website/src/components/home/Sponsors/index.tsx @@ -1,7 +1,7 @@ import clsx from 'clsx'; import React from 'react'; -import type { SponsorData } from '../types'; +import type { SponsorData } from '../FinancialContributors/types'; import { Sponsor } from '../Sponsor'; import styles from './styles.module.css'; diff --git a/packages/website/src/components/FinancialContributors/Sponsors/styles.module.css b/packages/website/src/components/home/Sponsors/styles.module.css similarity index 100% rename from packages/website/src/components/FinancialContributors/Sponsors/styles.module.css rename to packages/website/src/components/home/Sponsors/styles.module.css diff --git a/packages/website/src/components/layout/EditorTabs.tsx b/packages/website/src/components/layout/EditorTabs.tsx index a093a57791c7..50f11a9b9f78 100644 --- a/packages/website/src/components/layout/EditorTabs.tsx +++ b/packages/website/src/components/layout/EditorTabs.tsx @@ -10,7 +10,7 @@ export interface EditorTabsProps { readonly change: (name: T) => void; readonly showModal?: (name: T) => void; readonly showVisualEditor?: boolean; - readonly tabs: ({ label: string; value: T } | T)[]; + readonly tabs: (T | { label: string; value: T })[]; } function EditorTabs({ diff --git a/packages/website/src/components/linter/bridge.ts b/packages/website/src/components/linter/bridge.ts index 414873484c1a..1f1dec771aa7 100644 --- a/packages/website/src/components/linter/bridge.ts +++ b/packages/website/src/components/linter/bridge.ts @@ -14,7 +14,9 @@ export function createFileSystem( const files = new Map(); files.set(`/.eslintrc`, config.eslintrc); files.set(`/tsconfig.json`, config.tsconfig); - files.set(`/input${config.fileType}`, config.code); + if (config.code !== '') { + files.set(`/input${config.fileType}`, config.code); + } const fileWatcherCallbacks = new Map>(); @@ -78,6 +80,10 @@ export function createFileSystem( const expPath = getPathRegExp(path); return [...files.keys()].filter(fileName => expPath.test(fileName)); }; - + system.getScriptFileNames = (): string[] => { + return [...files.keys()] + .filter(fileName => !fileName.startsWith('/lib.')) + .filter(f => !f.endsWith('/.eslintrc') && !f.endsWith('.json')); + }; return system; } diff --git a/packages/website/src/components/linter/createLinter.ts b/packages/website/src/components/linter/createLinter.ts index 78f001439d87..c9c83aa2a34f 100644 --- a/packages/website/src/components/linter/createLinter.ts +++ b/packages/website/src/components/linter/createLinter.ts @@ -7,10 +7,15 @@ import type { } from '@typescript-eslint/utils/ts-eslint'; import type * as ts from 'typescript'; +import type { + ErrorGroup, + TabType, +} from '../../../../website/src/components/types'; import type { LinterOnLint, LinterOnParse, PlaygroundSystem, + RegisterFile, WebLinterModule, } from './types'; @@ -36,12 +41,16 @@ export interface CreateLinter { triggerFix(filename: string): Linter.FixReport | undefined; triggerLint(filename: string): void; updateParserOptions(sourceType?: SourceType): void; + registerFile: RegisterFile; } export function createLinter( system: PlaygroundSystem, webLinterModule: WebLinterModule, vfs: typeof tsvfs, + onMarkersChange: React.Dispatch< + React.SetStateAction> + >, ): CreateLinter { const rules: CreateLinter['rules'] = new Map(); const configs = new Map(Object.entries(webLinterModule.configs)); @@ -85,7 +94,6 @@ export function createLinter( column: 1, line: 1, message: String(e instanceof Error ? e.stack : e), - nodeType: '', ruleId: '', severity: 2, source: 'eslint', @@ -153,6 +161,8 @@ export function createLinter( }; const applyTSConfig = (fileName: string): void => { + let error: ErrorGroup | null = null; + try { const file = system.readFile(fileName) ?? '{}'; const parsed = parseTSConfig(file).compilerOptions; @@ -160,10 +170,46 @@ export function createLinter( console.log('[Editor] Updating', fileName, compilerOptions); parser.updateConfig(compilerOptions); } catch (e) { - console.error(e); + if (e instanceof Error) { + error = { + group: 'TypeScript', + items: e.message + .trim() + .split('\n') + .map((message: string) => { + return { + message, + severity: 8, // MarkerSeverity.Error + }; + }), + uri: undefined, + }; + } + } finally { + onMarkersChange(prev => { + const activeTabErrors = Object.fromEntries( + prev.tsconfig.map(error => [error.group, error]), + ); + + if (error) { + activeTabErrors.TypeScript = error; + } else { + delete activeTabErrors.TypeScript; + } + + return { + ...prev, + tsconfig: Object.values(activeTabErrors), + }; + }); } }; + const registerFile = (fileName: string, code: string) => { + parser.registerFile(fileName, code); + triggerLintAll(); + }; + const triggerLintAll = (): void => { system.searchFiles('/input.*').forEach(triggerLint); }; @@ -185,6 +231,7 @@ export function createLinter( configs: [...configs.keys()], onLint: onLint.register, onParse: onParse.register, + registerFile, rules, triggerFix, triggerLint, diff --git a/packages/website/src/components/linter/createParser.ts b/packages/website/src/components/linter/createParser.ts index 89bc7a44735e..8305d8ae8d88 100644 --- a/packages/website/src/components/linter/createParser.ts +++ b/packages/website/src/components/linter/createParser.ts @@ -6,6 +6,7 @@ import type * as ts from 'typescript'; import type { ParseSettings, PlaygroundSystem, + RegisterFile, UpdateModel, WebLinterModule, } from './types'; @@ -20,15 +21,14 @@ export function createParser( vfs: typeof tsvfs, ): { updateConfig: (compilerOptions: ts.CompilerOptions) => void; + registerFile: RegisterFile; } & Parser.ParserModule { - const registeredFiles = new Set(); - const createEnv = ( compilerOptions: ts.CompilerOptions, ): tsvfs.VirtualTypeScriptEnvironment => { return vfs.createVirtualTypeScriptEnvironment( system, - [...registeredFiles], + system.getScriptFileNames(), window.ts, compilerOptions, ); @@ -46,10 +46,9 @@ export function createParser( // if text is empty use empty line to avoid error const code = text || '\n'; - if (registeredFiles.has(filePath)) { + if (compilerHost.getSourceFile(filePath)) { compilerHost.updateFile(filePath, code); } else { - registeredFiles.add(filePath); compilerHost.createFile(filePath, code); } @@ -108,6 +107,9 @@ export function createParser( visitorKeys: utils.visitorKeys, }; }, + registerFile(filePath: string, code: string): void { + compilerHost.createFile(filePath, code); + }, updateConfig(compilerOptions): void { compilerHost = createEnv(compilerOptions); }, diff --git a/packages/website/src/components/linter/types.ts b/packages/website/src/components/linter/types.ts index 6e8a046733b7..1bd08c8dc50e 100644 --- a/packages/website/src/components/linter/types.ts +++ b/packages/website/src/components/linter/types.ts @@ -30,6 +30,7 @@ export interface WebLinterModule { export type PlaygroundSystem = { removeFile: (fileName: string) => void; searchFiles: (path: string) => string[]; + getScriptFileNames: () => string[]; } & Required> & ts.System; @@ -39,3 +40,5 @@ export type LinterOnLint = ( ) => void; export type LinterOnParse = (fileName: string, model: UpdateModel) => void; + +export type RegisterFile = (fileName: string, code: string) => void; diff --git a/packages/website/src/components/types.ts b/packages/website/src/components/types.ts index 181e1e5de39b..7dc1e913b1f1 100644 --- a/packages/website/src/components/types.ts +++ b/packages/website/src/components/types.ts @@ -40,10 +40,10 @@ export type SelectedRange = [number, number]; export interface ErrorItem { fixer?: { fix(): void; message: string }; - location: string; + location?: string; message: string; severity: number; - suggestions: { fix(): void; message: string }[]; + suggestions?: { fix(): void; message: string }[]; } export interface ErrorGroup { diff --git a/packages/website/src/css/custom.css b/packages/website/src/css/custom.css index 8c8ec55addf8..8e7f1f195d90 100644 --- a/packages/website/src/css/custom.css +++ b/packages/website/src/css/custom.css @@ -219,3 +219,18 @@ td > p:last-child { h5 { font-weight: bold; } + +/* stylelint-disable-next-line selector-id-pattern */ +#__docusaurus > div[role='banner'] { + font-size: 150%; + height: initial; + position: sticky; + padding: 1rem 1.5rem; + margin: auto; + max-width: max(60%, 70rem); +} + +/* stylelint-disable-next-line selector-id-pattern */ +#__docusaurus > div[role='banner'] a { + font-weight: bold; +} diff --git a/packages/website/src/pages/index.tsx b/packages/website/src/pages/index.tsx index 68befd7f8db2..5fd5fb883df0 100644 --- a/packages/website/src/pages/index.tsx +++ b/packages/website/src/pages/index.tsx @@ -1,188 +1,55 @@ import Link from '@docusaurus/Link'; import useBaseUrl from '@docusaurus/useBaseUrl'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; -import Heading from '@theme/Heading'; import Layout from '@theme/Layout'; import clsx from 'clsx'; import React from 'react'; -import { FinancialContributors } from '../components/FinancialContributors'; +import { Explainers } from '../components/home/Explainers'; +import { FinancialContributors } from '../components/home/FinancialContributors'; +import { RecentBlogPosts } from '../components/home/RecentBlogPosts'; import styles from './styles.module.css'; -interface FeatureItem { - description: React.JSX.Element; - imageUrl?: string; - title: string; -} - -const features: FeatureItem[] = [ - { - description: ( - <> -
-
- eslint -
-
-

- ESLint is an awesome linter for JavaScript code. -

-

- ESLint statically analyzes your code to quickly find problems. It - allows creating a series of assertions called lint rules around - what your code should look or behave like, as well as auto-fixer - suggestions to improve your code for you, and loading in lint - rules from shared plugins. -

-
-
-
-
- TypeScript -
-
-

- TypeScript is a strongly typed programming language that - builds on JavaScript. -

-

- TypeScript adds additional syntax to JavaScript that allows you to - declare the shapes of objects and functions in code. It provides a - set of language services that allow for running powerful - inferences and automations with that type information. -

-
-
- - ), - title: 'What are ESLint and TypeScript, and how do they compare?', - }, - { - description: ( -
-
-

- - typescript-eslint enables ESLint to run on TypeScript code. - {' '} - It brings in the best of both tools to help you write the best - JavaScript or TypeScript code you possibly can. -

-
-
-

- ESLint and TypeScript represent code differently internally. - ESLint's default JavaScript parser cannot natively read in - TypeScript-specific syntax and its rules don't natively have access - to TypeScript's type information. -

-
-
- typescript-eslint: -
    -
  • allows ESLint to parse TypeScript syntax
  • -
  • - creates a set of tools for ESLint rules to be able to use - TypeScript's type information -
  • -
  • - provides a large list of lint rules that are specific to - TypeScript and/or use that type information -
  • -
-
-
- ), - title: 'Why does this project exist?', - }, -]; - -function Feature({ description, title }: FeatureItem): React.JSX.Element { - return ( -
-
- - {title} - -
- {description} -
- - Get Started - -
-
- ); -} - function Home(): React.JSX.Element { const { siteConfig } = useDocusaurusContext(); return (
-
- Hero Logo -

{siteConfig.title}

-

{siteConfig.tagline}

-
- - Get Started - - - Playground - +
+
+

{siteConfig.title}

+

+ {siteConfig.tagline.replace(' code', '')} +

+
+ + Get Started + + + Playground + +
+
+
+ Hero Logo
- {features.map((props, idx) => ( -
-
-
- -
-
-
- ))} -
-
- - Financial Contributors - - -
-
+ + +
); diff --git a/packages/website/src/pages/styles.module.css b/packages/website/src/pages/styles.module.css index ee93e62557c6..2198015cabf8 100644 --- a/packages/website/src/pages/styles.module.css +++ b/packages/website/src/pages/styles.module.css @@ -18,9 +18,13 @@ text-align: center; } -.hero__logo { - height: 10rem; - width: 10rem; +.heroContainer { + display: flex; + justify-content: center; +} + +.heroRight { + display: none; } .hero__subtitle { @@ -34,17 +38,12 @@ flex-wrap: wrap; align-items: center; justify-content: center; + gap: 1rem; } .buttons a { --ifm-font-color-base: var(--ifm-color-white); --ifm-button-color: var(--ifm-color-white); - - margin: 1rem; -} - -.buttonCentered { - margin: auto; } .buttonPrimary { @@ -59,22 +58,33 @@ border: var(--ifm-button-border-width) solid var(--ifm-button-color); } -.lightBackground { - background: var(--ifm-color-emphasis-100); -} - -.features, -.sponsors { - display: flex; - align-items: center; - width: 100%; -} - -.sponsors { - text-align: center; -} - -.featureImage { - height: 7rem; - width: 7rem; +@media (width >= 996px) { + .heroContainer { + flex-direction: row; + gap: clamp(1rem, 10vw, 6rem); + } + + .heroLeft { + display: flex; + flex-direction: column; + justify-content: center; + text-align: left; + padding-bottom: 1rem; + } + + .buttons { + justify-content: flex-start; + } + + .heroRight { + display: initial; + } + + .heroLogo { + --hero-logo-size: clamp(5rem, 15vw, 15rem); + + height: var(--hero-logo-size); + user-select: none; + width: var(--hero-logo-size); + } } diff --git a/packages/website/src/theme/MDXComponents/RuleAttributes.tsx b/packages/website/src/theme/MDXComponents/RuleAttributes.tsx index 32e1f91af462..ec1aa2d1d7d0 100644 --- a/packages/website/src/theme/MDXComponents/RuleAttributes.tsx +++ b/packages/website/src/theme/MDXComponents/RuleAttributes.tsx @@ -20,7 +20,10 @@ import { import { Feature } from './Feature'; import styles from './RuleAttributes.module.css'; -const recommendations = { +const recommendations: Record< + RuleRecommendation, + [string, RuleRecommendation] +> = { recommended: [RECOMMENDED_CONFIG_EMOJI, 'recommended'], strict: [STRICT_CONFIG_EMOJI, 'strict'], stylistic: [STYLISTIC_CONFIG_EMOJI, 'stylistic'], @@ -45,19 +48,23 @@ const resolveRecommendation = ( }; const getRecommendation = (docs: RecommendedRuleMetaDataDocs): string[] => { - const recommended = docs.recommended; - const recommendation = - recommendations[ - typeof recommended === 'object' - ? resolveRecommendation(recommended) - : recommended - ]; + const recommendation = getRecommendationWithEmoji(docs.recommended); return docs.requiresTypeChecking ? [recommendation[0], `${recommendation[1]}-type-checked`] : recommendation; }; +export function getRecommendationWithEmoji( + recommended: RecommendedRuleMetaDataDocs['recommended'], +): [string, RuleRecommendation] { + const recommendationKey = + typeof recommended === 'object' + ? resolveRecommendation(recommended) + : recommended; + return recommendations[recommendationKey]; +} + export function RuleAttributes({ name }: { name: string }): React.ReactNode { const rules = useRulesMeta(); const rule = rules.find(rule => rule.name === name); @@ -148,6 +155,18 @@ export function RuleAttributes({ name }: { name: string }): React.ReactNode { }); } + if (rule.docs.frozen) { + features.push({ + children: ( + <> + This rule is currently frozen{' '} + and is not accepting feature requests. + + ), + emoji: '❄️', + }); + } + return (
{features.map(feature => ( diff --git a/packages/website/src/theme/MDXComponents/index.tsx b/packages/website/src/theme/MDXComponents/index.tsx index 3efbee2d2408..624cdea67c10 100644 --- a/packages/website/src/theme/MDXComponents/index.tsx +++ b/packages/website/src/theme/MDXComponents/index.tsx @@ -1,5 +1,5 @@ -import Admonition from '@theme/Admonition'; import MDXComponents from '@theme-original/MDXComponents'; +import Admonition from '@theme/Admonition'; import { BaseRuleReference } from './BaseRuleReference'; import { HiddenHeading } from './HiddenHeading'; diff --git a/packages/website/static/manifest.json b/packages/website/static/manifest.json index 3eccbd4b2369..1b482ca36b80 100644 --- a/packages/website/static/manifest.json +++ b/packages/website/static/manifest.json @@ -1,6 +1,6 @@ { "background_color": "#443FD4", - "description": "Documentation for typescript-eslint: the tooling that enables ESLint to support TypeScript.", + "description": "Documentation for typescript-eslint: powerful static analysis for JavaScript and TypeScript.", "display": "standalone", "icons": [ { diff --git a/packages/website/tools/generate-website-dts.mts b/packages/website/tools/generate-website-dts.mts index 9a6071ac4e7e..37744792cd1f 100644 --- a/packages/website/tools/generate-website-dts.mts +++ b/packages/website/tools/generate-website-dts.mts @@ -1,5 +1,5 @@ import fetch from 'cross-fetch'; -import { makeDirectory } from 'make-dir'; +import makeDirectory from 'make-dir'; import * as fs from 'node:fs/promises'; import * as path from 'node:path'; import { fileURLToPath } from 'node:url'; @@ -79,29 +79,22 @@ function processFiles(text: string): string { return result; } -async function main(): Promise { - const vendor = path.join(__dirname, '..', 'src', 'vendor'); +const vendor = path.join(__dirname, '..', 'src', 'vendor'); - console.log('Cleaning...'); - await rimraf(vendor); - await makeDirectory(vendor); +console.log('Cleaning...'); +await rimraf(vendor); +await makeDirectory(vendor); - // TS-VFS - await getFileAndStoreLocally( - '/js/sandbox/vendor/typescript-vfs.d.ts', - path.join(vendor, 'typescript-vfs.d.ts'), - processFiles, - ); - - // Sandbox - await getFileAndStoreLocally( - '/js/sandbox/index.d.ts', - path.join(vendor, 'sandbox.d.ts'), - processFiles, - ); -} +// TS-VFS +await getFileAndStoreLocally( + '/js/sandbox/vendor/typescript-vfs.d.ts', + path.join(vendor, 'typescript-vfs.d.ts'), + processFiles, +); -main().catch((error: unknown) => { - console.error(error); - process.exitCode = 1; -}); +// Sandbox +await getFileAndStoreLocally( + '/js/sandbox/index.d.ts', + path.join(vendor, 'sandbox.d.ts'), + processFiles, +); diff --git a/packages/website/webpack.plugin.js b/packages/website/webpack.plugin.js index c49dee7706af..be18ae1179a2 100644 --- a/packages/website/webpack.plugin.js +++ b/packages/website/webpack.plugin.js @@ -1,9 +1,9 @@ // eslint-disable-next-line @typescript-eslint/no-require-imports -const webpack = require('webpack'); +const CopyPlugin = require('copy-webpack-plugin'); // eslint-disable-next-line @typescript-eslint/no-require-imports const path = require('node:path'); // eslint-disable-next-line @typescript-eslint/no-require-imports -const CopyPlugin = require('copy-webpack-plugin'); +const webpack = require('webpack'); module.exports = function (/*context, options*/) { return { diff --git a/project.json b/project.json deleted file mode 100644 index f51e50b1493a..000000000000 --- a/project.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "$schema": "node_modules/nx/schemas/project-schema.json", - "name": "repo", - "// These targets are used for repo level utils and checking repo files which do not belong to specific published packages": {}, - "targets": { - "typecheck": { - "command": "tsc -b ./tsconfig.repo-config-files.json", - "dependsOn": ["types:copy-ast-spec"], - "outputs": ["{workspaceRoot}/dist"] - }, - "lint": { - "command": "eslint . --ignore-pattern=packages --cache" - }, - "generate-configs": { - "command": "tsx tools/scripts/generate-configs.mts" - }, - "generate-contributors": { - "command": "tsx tools/scripts/generate-contributors.mts" - }, - "generate-lib": { - "command": "tsx tools/scripts/generate-lib.mts" - }, - "generate-sponsors": { - "command": "tsx tools/scripts/generate-sponsors.mts" - } - } -} diff --git a/tools/release/apply-canary-version.mts b/tools/release/apply-canary-version.mts index 049dd3b06d96..523a56536367 100644 --- a/tools/release/apply-canary-version.mts +++ b/tools/release/apply-canary-version.mts @@ -4,6 +4,7 @@ import semver from 'semver'; // We are either releasing a canary version of the latest major version, or one for the next major. const overrideMajorVersion = process.env.OVERRIDE_MAJOR_VERSION; +const isDryRun = process.env.DRY_RUN === 'true'; const preid = 'alpha'; @@ -83,7 +84,7 @@ if (!nextCanaryVersion) { console.log(`\nApplying next canary version with Nx`); -const command = `nx release version ${nextCanaryVersion}`; +const command = `nx release version ${nextCanaryVersion}${isDryRun ? ' --dry-run' : ''}`; console.log(`\n> ${command}\n`); diff --git a/tools/release/changelog-renderer.js b/tools/release/changelog-renderer.js index c12c0711aad8..16e3f5deff7b 100644 --- a/tools/release/changelog-renderer.js +++ b/tools/release/changelog-renderer.js @@ -11,6 +11,6 @@ module.exports = class CustomChangelogRenderer extends ( async render() { const defaultChangelog = await super.render(); // Append our custom messaging to the generated changelog entry - return `${defaultChangelog}\n\nYou can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website.`; + return `${defaultChangelog}\n\nYou can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.`; } }; diff --git a/tools/release/release.mts b/tools/release/release.mts index 43544c261523..6c6e1f7d799b 100644 --- a/tools/release/release.mts +++ b/tools/release/release.mts @@ -6,6 +6,12 @@ import { } from 'nx/release/index.js'; import yargs from 'yargs'; +if (process.env.CI !== 'true') { + throw new Error( + 'Releases cannot be run outside of CI, we use trusted publishing which requires an authenticated GitHub Actions environment', + ); +} + const options = await yargs(process.argv.slice(2)) .version(false) .option('version', { @@ -31,12 +37,19 @@ const options = await yargs(process.argv.slice(2)) description: 'Whether or not to enable verbose logging, defaults to false', type: 'boolean', }) + .option('firstRelease', { + default: false, + description: + 'Whether or not one of more of the packages are being released for the first time', + type: 'boolean', + }) .parseAsync(); const { projectsVersionData, workspaceVersion } = await releaseVersion({ specifier: options.version, // stage package.json updates to be committed later by the changelog command dryRun: options.dryRun, + firstRelease: options.firstRelease, stageChanges: true, verbose: options.verbose, }); @@ -54,6 +67,7 @@ if (!options.dryRun) { // This will create a release on GitHub await releaseChangelog({ dryRun: options.dryRun, + firstRelease: options.firstRelease, verbose: options.verbose, version: workspaceVersion, versionData: projectsVersionData, @@ -69,11 +83,45 @@ if (!options.forceReleaseWithoutChanges && workspaceVersion === null) { process.exit(0); } +/** + * In order for the `npm publish --dry-run` to produce any kind of valuable output, we have to + * modify the package versions on disk to a unique version before running it, otherwise it will + * simply print `You cannot publish over the previously published versions: X.X.X`. + * + * Therefore we will leverage our apply-canary-version.mts script to do this for us in this case. + */ +if (options.dryRun) { + console.log( + '⚠️ NOTE: Applying canary version to package.json files so that dry-run publishing produces useful output...', + ); + execaSync('yarn', ['tsx', 'tools/release/apply-canary-version.mts']); + console.log( + '✅ Applied canary version to package.json files so that dry-run publishing produces useful output\n', + ); +} + const publishProjectsResult = await releasePublish({ dryRun: options.dryRun, + firstRelease: options.firstRelease, verbose: options.verbose, }); +// Revert all temporary changes +if (options.dryRun) { + console.log( + '⚠️ NOTE: Reverting temporary package.json changes related to dry-run publishing...', + ); + execaSync('git', [ + 'checkout', + 'packages/**/package.json', + 'package.json', + 'yarn.lock', + ]); + console.log( + '✅ Reverted temporary package.json changes related to dry-run publishing\n', + ); +} + // eslint-disable-next-line no-process-exit process.exit( // If any of the individual project publish tasks returned a non-zero exit code, exit with code 1 diff --git a/tools/scripts/generate-configs.mts b/tools/scripts/generate-configs.mts index 6b0971a7104d..e6892c71b647 100644 --- a/tools/scripts/generate-configs.mts +++ b/tools/scripts/generate-configs.mts @@ -28,7 +28,7 @@ const AUTO_GENERATED_COMMENT_LINES = [ '// SEE https://typescript-eslint.io/users/configs', '//', '// For developers working in the typescript-eslint monorepo:', - '// You can regenerate it using `yarn generate:configs`', + '// You can regenerate it using `yarn generate-configs`', '', ] as const; @@ -48,413 +48,407 @@ const CLASSIC_EXTENDS: readonly string[] = EXTENDS_MODULES.map( mod => mod.packageRelativePath, ); -async function main(): Promise { - function addAutoGeneratedComment(code?: string): string { - return [...AUTO_GENERATED_COMMENT_LINES, code].join('\n'); - } +function addAutoGeneratedComment(code?: string): string { + return [...AUTO_GENERATED_COMMENT_LINES, code].join('\n'); +} - const prettierConfig = await prettier.resolveConfig('file.ts', { - config: PRETTIER_CONFIG_PATH, - }); +const prettierConfig = await prettier.resolveConfig('file.ts', { + config: PRETTIER_CONFIG_PATH, +}); - type LinterConfigRules = Record< - string, - [ClassicConfig.RuleLevel, ...unknown[]] | ClassicConfig.RuleLevel - >; +type LinterConfigRules = Record< + string, + [ClassicConfig.RuleLevel, ...unknown[]] | ClassicConfig.RuleLevel +>; - interface LinterConfig extends ClassicConfig.Config { - extends?: string | string[]; - plugins?: string[]; - } +interface LinterConfig extends ClassicConfig.Config { + extends?: string | string[]; + plugins?: string[]; +} - const RULE_NAME_PREFIX = '@typescript-eslint/'; - const MAX_RULE_NAME_LENGTH = Math.max( - ...Object.keys(eslintPlugin.rules).map(name => name.length), - ); - const BASE_RULES_TO_BE_OVERRIDDEN = new Map( - Object.entries(eslintPlugin.rules) - .filter(([, rule]) => rule.meta.docs.extendsBaseRule) - .map( - ([ruleName, rule]) => - [ - ruleName, - typeof rule.meta.docs.extendsBaseRule === 'string' - ? rule.meta.docs.extendsBaseRule - : ruleName, - ] as const, - ), - ); +const RULE_NAME_PREFIX = '@typescript-eslint/'; +const MAX_RULE_NAME_LENGTH = Math.max( + ...Object.keys(eslintPlugin.rules).map(name => name.length), +); +const BASE_RULES_TO_BE_OVERRIDDEN = new Map( + Object.entries(eslintPlugin.rules) + .filter(([, rule]) => rule.meta.docs.extendsBaseRule) + .map( + ([ruleName, rule]) => + [ + ruleName, + typeof rule.meta.docs.extendsBaseRule === 'string' + ? rule.meta.docs.extendsBaseRule + : ruleName, + ] as const, + ), +); - // special case - return-await used to be an extension, but no longer is. - // See https://github.com/typescript-eslint/typescript-eslint/issues/9517 - BASE_RULES_TO_BE_OVERRIDDEN.set('return-await', 'no-return-await'); +// special case - return-await used to be an extension, but no longer is. +// See https://github.com/typescript-eslint/typescript-eslint/issues/9517 +BASE_RULES_TO_BE_OVERRIDDEN.set('return-await', 'no-return-await'); - type RuleEntry = [string, ESLintPluginRuleModule]; +type RuleEntry = [string, ESLintPluginRuleModule]; - const allRuleEntries: RuleEntry[] = Object.entries(eslintPlugin.rules).sort( - (a, b) => a[0].localeCompare(b[0]), - ); +const allRuleEntries: RuleEntry[] = Object.entries(eslintPlugin.rules).sort( + (a, b) => a[0].localeCompare(b[0]), +); - type GetRuleOptions = ( - rule: ESLintPluginRuleModule, - ) => readonly unknown[] | true | undefined; +type GetRuleOptions = ( + rule: ESLintPluginRuleModule, +) => readonly unknown[] | true | undefined; - interface ConfigRuleSettings { - baseRuleForExtensionRule?: 'exclude'; - deprecated?: 'exclude'; - forcedRuleLevel?: Linter.RuleLevel; - getOptions?: GetRuleOptions | undefined; - typeChecked?: 'exclude' | 'include-only'; - } +interface ConfigRuleSettings { + baseRuleForExtensionRule?: 'exclude'; + deprecated?: 'exclude'; + forcedRuleLevel?: Linter.RuleLevel; + getOptions?: GetRuleOptions | undefined; + typeChecked?: 'exclude' | 'include-only'; +} - /** - * Helper function reduces records to key - value pairs. - */ - function reducer( - config: LinterConfigRules, - [key, value]: RuleEntry, - settings: ConfigRuleSettings = {}, - ): LinterConfigRules { - if (value.meta.deprecated) { - if (value.meta.docs.recommended) { - throw new Error(`${key} is both deprecated and recommended.`); - } - if (settings.deprecated) { - return config; - } +/** + * Helper function reduces records to key - value pairs. + */ +function reducer( + config: LinterConfigRules, + [key, value]: RuleEntry, + settings: ConfigRuleSettings = {}, +): LinterConfigRules { + if (value.meta.deprecated) { + if (value.meta.docs.recommended) { + throw new Error(`${key} is both deprecated and recommended.`); } - - // Explicitly exclude rules requiring type-checking - if ( - settings.typeChecked === 'exclude' && - value.meta.docs.requiresTypeChecking === true - ) { + if (settings.deprecated) { return config; } + } - if ( - settings.typeChecked === 'include-only' && - value.meta.docs.requiresTypeChecking !== true - ) { - return config; - } + // Explicitly exclude rules requiring type-checking + if ( + settings.typeChecked === 'exclude' && + value.meta.docs.requiresTypeChecking === true + ) { + return config; + } - const ruleName = `${RULE_NAME_PREFIX}${key}`; - - if ( - settings.baseRuleForExtensionRule !== 'exclude' && - BASE_RULES_TO_BE_OVERRIDDEN.has(key) - ) { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - const baseRuleName = BASE_RULES_TO_BE_OVERRIDDEN.get(key)!; - console.log( - baseRuleName - .padStart(RULE_NAME_PREFIX.length + baseRuleName.length) - .padEnd(RULE_NAME_PREFIX.length + MAX_RULE_NAME_LENGTH), - '=', - chalk.green('off'), - ); - config[baseRuleName] = 'off'; - } + if ( + settings.typeChecked === 'include-only' && + value.meta.docs.requiresTypeChecking !== true + ) { + return config; + } + + const ruleName = `${RULE_NAME_PREFIX}${key}`; + + if ( + settings.baseRuleForExtensionRule !== 'exclude' && + BASE_RULES_TO_BE_OVERRIDDEN.has(key) + ) { + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + const baseRuleName = BASE_RULES_TO_BE_OVERRIDDEN.get(key)!; console.log( - `${chalk.dim(RULE_NAME_PREFIX)}${key.padEnd(MAX_RULE_NAME_LENGTH)}`, + baseRuleName + .padStart(RULE_NAME_PREFIX.length + baseRuleName.length) + .padEnd(RULE_NAME_PREFIX.length + MAX_RULE_NAME_LENGTH), '=', - chalk.red('error'), + chalk.green('off'), ); + config[baseRuleName] = 'off'; + } + console.log( + `${chalk.dim(RULE_NAME_PREFIX)}${key.padEnd(MAX_RULE_NAME_LENGTH)}`, + '=', + chalk.red('error'), + ); - const ruleLevel = settings.forcedRuleLevel ?? 'error'; - const ruleOptions = settings.getOptions?.(value); + const ruleLevel = settings.forcedRuleLevel ?? 'error'; + const ruleOptions = settings.getOptions?.(value); - config[ruleName] = - ruleOptions && ruleOptions !== true - ? [ruleLevel, ...ruleOptions] - : ruleLevel; + config[ruleName] = + ruleOptions && ruleOptions !== true + ? [ruleLevel, ...ruleOptions] + : ruleLevel; - return config; - } + return config; +} - interface WriteConfigSettings { - description: string; - getConfig: () => LinterConfig; - name: string; - } +interface WriteConfigSettings { + description: string; + getConfig: () => LinterConfig; + name: string; +} - /** - * Helper function that writes configuration. - */ - async function writeConfig({ - description, - getConfig, - name, - }: WriteConfigSettings): Promise { - const hyphens = '-'.repeat(35 - Math.ceil(name.length / 2)); - console.log(chalk.blueBright(`\n${hyphens} ${name}.ts ${hyphens}`)); - - const config = getConfig(); - - // - // 1. Classic Config - written to eslint-plugin/src/configs/eslintrc - // These configs are just JSON blobs that we write as TS files - // - - // note: we use `export =` because ESLint will import these configs via a commonjs import - const classicCode = [ - "import type { ClassicConfig } from '@typescript-eslint/utils/ts-eslint';", - '', - `export = ${JSON.stringify(config)} satisfies ClassicConfig.Config;`, - ].join('\n'); - const classicConfigStr = await prettier.format( - addAutoGeneratedComment(classicCode), - { - parser: 'typescript', - ...prettierConfig, - }, - ); - fs.writeFileSync( - path.join( - PACKAGES_ESLINT_PLUGIN, - 'src', - 'configs', - 'eslintrc', - `${name}.ts`, - ), - classicConfigStr, - ); +/** + * Helper function that writes configuration. + */ +async function writeConfig({ + description, + getConfig, + name, +}: WriteConfigSettings): Promise { + const hyphens = '-'.repeat(35 - Math.ceil(name.length / 2)); + console.log(chalk.blueBright(`\n${hyphens} ${name}.ts ${hyphens}`)); + + const config = getConfig(); + + // + // 1. Classic Config - written to eslint-plugin/src/configs/eslintrc + // These configs are just JSON blobs that we write as TS files + // + + // note: we use `export =` because ESLint will import these configs via a commonjs import + const classicCode = [ + "import type { ClassicConfig } from '@typescript-eslint/utils/ts-eslint';", + '', + `export = ${JSON.stringify(config)} satisfies ClassicConfig.Config;`, + ].join('\n'); + const classicConfigStr = await prettier.format( + addAutoGeneratedComment(classicCode), + { + parser: 'typescript', + ...prettierConfig, + }, + ); + fs.writeFileSync( + path.join( + PACKAGES_ESLINT_PLUGIN, + 'src', + 'configs', + 'eslintrc', + `${name}.ts`, + ), + classicConfigStr, + ); - // - // 2. Flat Config - written to eslint-plugin/src/configs/flat - // These configs are actual TS modules that import other configs - // - const flatCode: string[] = [ - ...AUTO_GENERATED_COMMENT_LINES, - "import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint';", - '', - ]; - const flatExtends: string[] = []; - const flatConfig: FlatConfig.Config = { - name: `typescript-eslint/${name}`, - rules: config.rules, - }; - if (config.extends) { - for (const extendPath of config.extends) { - const config = EXTENDS_MODULES.find( - mod => mod.packageRelativePath === extendPath, - ); - if (config == null) { - throw new Error("Couldn't find config"); - } - flatCode.push( - `import ${config.name} from '${config.moduleRelativePath}';`, - ); - flatExtends.push(config.name); + // + // 2. Flat Config - written to eslint-plugin/src/configs/flat + // These configs are actual TS modules that import other configs + // + const flatCode: string[] = [ + ...AUTO_GENERATED_COMMENT_LINES, + "import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint';", + '', + ]; + const flatExtends: string[] = []; + const flatConfig: FlatConfig.Config = { + name: `typescript-eslint/${name}`, + rules: config.rules, + }; + if (config.extends) { + for (const extendPath of config.extends) { + const config = EXTENDS_MODULES.find( + mod => mod.packageRelativePath === extendPath, + ); + if (config == null) { + throw new Error("Couldn't find config"); } - flatCode.push(''); - } - if (config.parserOptions) { - flatConfig.languageOptions ??= {}; - flatConfig.languageOptions.parserOptions = config.parserOptions; + flatCode.push( + `import ${config.name} from '${config.moduleRelativePath}';`, + ); + flatExtends.push(config.name); } + flatCode.push(''); + } + if (config.parserOptions) { + flatConfig.languageOptions ??= {}; + flatConfig.languageOptions.parserOptions = config.parserOptions; + } - const docComment = `/** + const docComment = `/** * ${description} * @see {@link https://typescript-eslint.io/users/configs#${name}} */`; - const flatConfigJson = JSON.stringify(flatConfig); - if (flatExtends.length > 0) { - flatCode.push( - docComment, - 'export default (plugin: FlatConfig.Plugin, parser: FlatConfig.Parser): FlatConfig.ConfigArray => [', - ...flatExtends.map(ext => `${ext}(plugin, parser),`), - flatConfigJson, - '];', - ); - } else { - flatCode.push( - docComment, - `export default (_plugin: FlatConfig.Plugin, _parser: FlatConfig.Parser): FlatConfig.Config => (${flatConfigJson});`, - ); - } - const flatConfigStr = await prettier.format(flatCode.join('\n'), { - parser: 'typescript', - ...prettierConfig, - }); - fs.writeFileSync( - path.join(PACKAGES_ESLINT_PLUGIN, 'src', 'configs', 'flat', `${name}.ts`), - flatConfigStr, + const flatConfigJson = JSON.stringify(flatConfig); + if (flatExtends.length > 0) { + flatCode.push( + docComment, + 'export default (plugin: FlatConfig.Plugin, parser: FlatConfig.Parser): FlatConfig.ConfigArray => [', + ...flatExtends.map(ext => `${ext}(plugin, parser),`), + flatConfigJson, + '];', + ); + } else { + flatCode.push( + docComment, + `export default (_plugin: FlatConfig.Plugin, _parser: FlatConfig.Parser): FlatConfig.Config => (${flatConfigJson});`, ); } + const flatConfigStr = await prettier.format(flatCode.join('\n'), { + parser: 'typescript', + ...prettierConfig, + }); + fs.writeFileSync( + path.join(PACKAGES_ESLINT_PLUGIN, 'src', 'configs', 'flat', `${name}.ts`), + flatConfigStr, + ); +} - interface ExtendedConfigSettings { - description: string; - name: string; - ruleEntries: readonly RuleEntry[]; - settings?: ConfigRuleSettings; - } +interface ExtendedConfigSettings { + description: string; + name: string; + ruleEntries: readonly RuleEntry[]; + settings?: ConfigRuleSettings; +} - async function writeExtendedConfig({ +async function writeExtendedConfig({ + description, + name, + ruleEntries, + settings, +}: ExtendedConfigSettings): Promise { + await writeConfig({ description, + getConfig: () => ({ + extends: [...CLASSIC_EXTENDS], + rules: ruleEntries.reduce( + (config, entry) => reducer(config, entry, settings), + {}, + ), + }), name, - ruleEntries, - settings, - }: ExtendedConfigSettings): Promise { - await writeConfig({ - description, - getConfig: () => ({ - extends: [...CLASSIC_EXTENDS], - rules: ruleEntries.reduce( - (config, entry) => reducer(config, entry, settings), - {}, - ), - }), - name, - }); - } - - function filterRuleEntriesTo( - ...recommendations: (RuleRecommendation | undefined)[] - ): RuleEntry[] { - return allRuleEntries.filter(([, rule]) => - typeof rule.meta.docs.recommended === 'object' - ? Object.keys(rule.meta.docs.recommended).some(level => - recommendations.includes(level as RuleRecommendation), - ) - : recommendations.includes(rule.meta.docs.recommended), - ); - } + }); +} - function createGetOptionsForLevel( - level: 'recommended' | 'strict', - ): GetRuleOptions { - return rule => - typeof rule.meta.docs.recommended === 'object' - ? rule.meta.docs.recommended[level] - : undefined; - } +function filterRuleEntriesTo( + ...recommendations: (RuleRecommendation | undefined)[] +): RuleEntry[] { + return allRuleEntries.filter(([, rule]) => + typeof rule.meta.docs.recommended === 'object' + ? Object.keys(rule.meta.docs.recommended).some(level => + recommendations.includes(level as RuleRecommendation), + ) + : recommendations.includes(rule.meta.docs.recommended), + ); +} - await writeExtendedConfig({ - description: - 'Enables each the rules provided as a part of typescript-eslint. Note that many rules are not applicable in all codebases, or are meant to be configured.', - name: 'all', - ruleEntries: allRuleEntries, - settings: { - deprecated: 'exclude', - }, - }); +function createGetOptionsForLevel( + level: 'recommended' | 'strict', +): GetRuleOptions { + return rule => + typeof rule.meta.docs.recommended === 'object' + ? rule.meta.docs.recommended[level] + : undefined; +} - await writeExtendedConfig({ - description: - 'Recommended rules for code correctness that you can drop in without additional configuration.', - name: 'recommended', - ruleEntries: filterRuleEntriesTo('recommended'), - settings: { - getOptions: createGetOptionsForLevel('recommended'), - typeChecked: 'exclude', - }, - }); +await writeExtendedConfig({ + description: + 'Enables each the rules provided as a part of typescript-eslint. Note that many rules are not applicable in all codebases, or are meant to be configured.', + name: 'all', + ruleEntries: allRuleEntries, + settings: { + deprecated: 'exclude', + }, +}); - await writeExtendedConfig({ - description: - 'Contains all of `recommended` along with additional recommended rules that require type information.', - name: 'recommended-type-checked', - ruleEntries: filterRuleEntriesTo('recommended'), - settings: { - getOptions: createGetOptionsForLevel('recommended'), - }, - }); +await writeExtendedConfig({ + description: + 'Recommended rules for code correctness that you can drop in without additional configuration.', + name: 'recommended', + ruleEntries: filterRuleEntriesTo('recommended'), + settings: { + getOptions: createGetOptionsForLevel('recommended'), + typeChecked: 'exclude', + }, +}); - await writeExtendedConfig({ - description: - 'A version of `recommended` that only contains type-checked rules and disables of any corresponding core ESLint rules.', - name: 'recommended-type-checked-only', - ruleEntries: filterRuleEntriesTo('recommended'), - settings: { - getOptions: createGetOptionsForLevel('recommended'), - typeChecked: 'include-only', - }, - }); +await writeExtendedConfig({ + description: + 'Contains all of `recommended` along with additional recommended rules that require type information.', + name: 'recommended-type-checked', + ruleEntries: filterRuleEntriesTo('recommended'), + settings: { + getOptions: createGetOptionsForLevel('recommended'), + }, +}); - await writeExtendedConfig({ - description: - 'Contains all of `recommended`, as well as additional strict rules that can also catch bugs. ', - name: 'strict', - ruleEntries: filterRuleEntriesTo('recommended', 'strict'), - settings: { - getOptions: createGetOptionsForLevel('strict'), - typeChecked: 'exclude', - }, - }); +await writeExtendedConfig({ + description: + 'A version of `recommended` that only contains type-checked rules and disables of any corresponding core ESLint rules.', + name: 'recommended-type-checked-only', + ruleEntries: filterRuleEntriesTo('recommended'), + settings: { + getOptions: createGetOptionsForLevel('recommended'), + typeChecked: 'include-only', + }, +}); - await writeExtendedConfig({ - description: - 'Contains all of `recommended`, `recommended-type-checked`, and `strict`, along with additional strict rules that require type information.', - name: 'strict-type-checked', - ruleEntries: filterRuleEntriesTo('recommended', 'strict'), - settings: { - getOptions: createGetOptionsForLevel('strict'), - }, - }); +await writeExtendedConfig({ + description: + 'Contains all of `recommended`, as well as additional strict rules that can also catch bugs. ', + name: 'strict', + ruleEntries: filterRuleEntriesTo('recommended', 'strict'), + settings: { + getOptions: createGetOptionsForLevel('strict'), + typeChecked: 'exclude', + }, +}); - await writeExtendedConfig({ - description: - 'A version of `strict` that only contains type-checked rules and disables of any corresponding core ESLint rules.', - name: 'strict-type-checked-only', - ruleEntries: filterRuleEntriesTo('recommended', 'strict'), - settings: { - getOptions: createGetOptionsForLevel('strict'), - typeChecked: 'include-only', - }, - }); +await writeExtendedConfig({ + description: + 'Contains all of `recommended`, `recommended-type-checked`, and `strict`, along with additional strict rules that require type information.', + name: 'strict-type-checked', + ruleEntries: filterRuleEntriesTo('recommended', 'strict'), + settings: { + getOptions: createGetOptionsForLevel('strict'), + }, +}); - await writeExtendedConfig({ - description: - 'Rules considered to be best practice for modern TypeScript codebases, but that do not impact program logic.', - name: 'stylistic', - ruleEntries: filterRuleEntriesTo('stylistic'), - settings: { - typeChecked: 'exclude', - }, - }); +await writeExtendedConfig({ + description: + 'A version of `strict` that only contains type-checked rules and disables of any corresponding core ESLint rules.', + name: 'strict-type-checked-only', + ruleEntries: filterRuleEntriesTo('recommended', 'strict'), + settings: { + getOptions: createGetOptionsForLevel('strict'), + typeChecked: 'include-only', + }, +}); - await writeExtendedConfig({ - description: - 'Contains all of `stylistic`, along with additional stylistic rules that require type information.', - name: 'stylistic-type-checked', - ruleEntries: filterRuleEntriesTo('stylistic'), - }); +await writeExtendedConfig({ + description: + 'Rules considered to be best practice for modern TypeScript codebases, but that do not impact program logic.', + name: 'stylistic', + ruleEntries: filterRuleEntriesTo('stylistic'), + settings: { + typeChecked: 'exclude', + }, +}); - await writeExtendedConfig({ - description: - 'A version of `stylistic` that only contains type-checked rules and disables of any corresponding core ESLint rules.', - name: 'stylistic-type-checked-only', - ruleEntries: filterRuleEntriesTo('stylistic'), - settings: { - typeChecked: 'include-only', - }, - }); +await writeExtendedConfig({ + description: + 'Contains all of `stylistic`, along with additional stylistic rules that require type information.', + name: 'stylistic-type-checked', + ruleEntries: filterRuleEntriesTo('stylistic'), +}); - await writeConfig({ - description: - 'A utility ruleset that will disable type-aware linting and all type-aware rules available in our project.', - getConfig: () => ({ - parserOptions: { - program: null, - project: false, - projectService: false, - }, - rules: allRuleEntries.reduce( - (config, entry) => - reducer(config, entry, { - baseRuleForExtensionRule: 'exclude', - forcedRuleLevel: 'off', - typeChecked: 'include-only', - }), - {}, - ), - }), - name: 'disable-type-checked', - }); -} +await writeExtendedConfig({ + description: + 'A version of `stylistic` that only contains type-checked rules and disables of any corresponding core ESLint rules.', + name: 'stylistic-type-checked-only', + ruleEntries: filterRuleEntriesTo('stylistic'), + settings: { + typeChecked: 'include-only', + }, +}); -main().catch((error: unknown) => { - console.error(error); +await writeConfig({ + description: + 'A utility ruleset that will disable type-aware linting and all type-aware rules available in our project.', + getConfig: () => ({ + parserOptions: { + program: null, + project: false, + projectService: false, + }, + rules: allRuleEntries.reduce( + (config, entry) => + reducer(config, entry, { + baseRuleForExtensionRule: 'exclude', + forcedRuleLevel: 'off', + typeChecked: 'include-only', + }), + {}, + ), + }), + name: 'disable-type-checked', }); diff --git a/tools/scripts/generate-contributors.mts b/tools/scripts/generate-contributors.mts deleted file mode 100644 index d380f0382012..000000000000 --- a/tools/scripts/generate-contributors.mts +++ /dev/null @@ -1,193 +0,0 @@ -// this script uses the github api to fetch a list of contributors -// https://developer.github.com/v3/repos/#list-contributors -// this endpoint returns a list of contributors sorted by number of contributions - -import fetch from 'cross-fetch'; -import fs from 'node:fs'; -import path from 'node:path'; - -import { REPO_ROOT } from './paths.mts'; - -const IGNORED_USERS = new Set([ - 'dependabot[bot]', - 'eslint[bot]', - 'greenkeeper[bot]', - 'semantic-release-bot', -]); - -const COMPLETELY_ARBITRARY_CONTRIBUTION_COUNT = 3; -const PAGE_LIMIT = 100; -// arbitrary limit -- this means we can only fetch 10*100=1000 contributors but it means we don't ever loop forever -const MATCH_PAGE_NUMBER = 10; -const contributorsApiUrl = `https://api.github.com/repos/typescript-eslint/typescript-eslint/contributors?per_page=${PAGE_LIMIT}`; - -interface Contributor { - avatar_url?: string; - contributions: number; - html_url?: string; - login?: string; - type: string; - url?: string; -} -interface User { - avatar_url: string; - html_url: string; - login: string; - name: string; -} - -// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters -- intentional 'unsafe' single generic in return type -async function getData( - url: string, -): Promise<{ body: T; linkHeader: string | null }>; -// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters -- intentional 'unsafe' single generic in return type -async function getData( - url: string | undefined, -): Promise<{ body: T; linkHeader: string | null } | null>; -async function getData( - url: string | undefined, -): Promise<{ body: T; linkHeader: string | null } | null> { - if (url == null) { - return null; - } - - const response = await fetch(url, { - headers: { - Accept: 'application/vnd.github.v3+json', - // Authorization: 'token ghp_xxxx', // if needed, replace this with your token - }, - method: 'GET', - }); - - const linkHeader = response.headers.get('link'); - - return { - body: (await response.json()) as T, - linkHeader, - }; -} - -async function* fetchUsers(page = 1): AsyncIterableIterator { - while (page <= MATCH_PAGE_NUMBER) { - console.log(`Fetching page ${page} of contributors...`); - const contributors = await getData<{ message: string } | Contributor[]>( - `${contributorsApiUrl}&page=${page}`, - ); - - if (!Array.isArray(contributors.body)) { - throw new Error(contributors.body.message); - } - - const thresholdedContributors = contributors.body.filter( - user => user.contributions >= COMPLETELY_ARBITRARY_CONTRIBUTION_COUNT, - ); - yield thresholdedContributors; - - if ( - // https://docs.github.com/en/rest/using-the-rest-api/using-pagination-in-the-rest-api?apiVersion=2022-11-28#using-link-headers - // > The URL for the next page is followed by rel="next". - // > the link to the last page won't be included if it can't be calculated. - // i.e. if there's no "next" link then there's no next page and we're at the end - !contributors.linkHeader?.includes('rel="next"') - ) { - break; - } - - page += 1; - } -} - -function writeTable(contributors: User[], perLine = 5): void { - const columns = contributors.length > perLine ? perLine : contributors.length; - - const lines = [ - '', - '', - '# Contributors', - '', - 'Thanks goes to these wonderful people:', - '', - '', - '', - '', - ]; - - let i = 0; - for (const usr of contributors) { - if (i % columns === 0) { - if (i !== 0) { - lines.push(' '); - } - lines.push(' '); - } - - const image = ``; - const name = `${usr.name || usr.login}`; - - lines.push( - ` `, - ); - ++i; - } - if (i % columns !== 0) { - lines.push(' '); - } - - lines.push(' '); - lines.push('
${image}
${name}
'); - lines.push(''); - lines.push(''); - lines.push(''); - lines.push(''); - lines.push( - `This list is auto-generated using \`yarn generate-contributors\`. It shows the top ${PAGE_LIMIT} contributors with > ${COMPLETELY_ARBITRARY_CONTRIBUTION_COUNT} contributions.`, - ); - lines.push(''); - - fs.writeFileSync(path.join(REPO_ROOT, 'CONTRIBUTORS.md'), lines.join('\n')); -} - -async function main(): Promise { - const githubContributors: Contributor[] = []; - - // fetch all of the contributor info - for await (const lastUsers of fetchUsers()) { - githubContributors.push(...lastUsers); - } - - // fetch the user info - console.log(`Fetching user information...`); - const users = await Promise.allSettled( - githubContributors - // remove ignored users and bots - .filter( - usr => usr.login && usr.type !== 'Bot' && !IGNORED_USERS.has(usr.login), - ) - // fetch the in-depth information for each user - .map(c => getData(c.url)), - ); - - writeTable( - users - .map(result => { - if (result.status === 'fulfilled') { - return result.value?.body; - } - return null; - }) - .filter((c): c is User => c?.login != null), - 5, - ); -} - -main().catch((error: unknown) => { - console.error(error); - process.exitCode = 1; -}); diff --git a/tools/scripts/generate-lib.mts b/tools/scripts/generate-lib.mts index 599313dbdeb6..7efbb6e536e3 100644 --- a/tools/scripts/generate-lib.mts +++ b/tools/scripts/generate-lib.mts @@ -14,7 +14,7 @@ import fs from 'node:fs'; import path from 'node:path'; import prettier from 'prettier'; import { rimraf } from 'rimraf'; -import ts from 'typescript'; +import * as ts from 'typescript'; import { PACKAGES_SCOPE_MANAGER, @@ -37,9 +37,11 @@ function parseAndAnalyze( return { ast, scopeManager }; } -const libMap = new Map(ts.libMap); +// @ts-expect-error - libMap is private and not typed +const tsLibMap = ts.libMap as Map; +const libMap = new Map(tsLibMap); // add the "full" libs as well - these are used by the default config resolution system -for (const [lib] of ts.libMap) { +for (const [lib] of tsLibMap) { if ( (/^es2\d{3}$/.test(lib) || lib === 'esnext') && // there's no "full" lib for es2015 @@ -123,187 +125,175 @@ function getReferences( return references; } -async function main(): Promise { - try { - rimraf.sync(OUTPUT_FOLDER); - } catch { - // ignored - } - try { - fs.mkdirSync(OUTPUT_FOLDER); - } catch { - // ignored - } +try { + rimraf.sync(OUTPUT_FOLDER); +} catch { + // ignored +} +try { + fs.mkdirSync(OUTPUT_FOLDER); +} catch { + // ignored +} - const filesWritten: string[] = [ - SHARED_CONFIG_MODULE, - TYPES_FILE, - BARREL_PATH, - ]; - - // the shared - fs.writeFileSync( - SHARED_CONFIG_MODULE, - await formatCode([ - `export const TYPE = Object.freeze(${JSON.stringify({ - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - })});`, - `export const VALUE = Object.freeze(${JSON.stringify({ - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: false, - isValueVariable: true, - })});`, - `export const TYPE_VALUE = Object.freeze(${JSON.stringify({ - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - })});`, - '', - ]), - ); +const filesWritten: string[] = [SHARED_CONFIG_MODULE, TYPES_FILE, BARREL_PATH]; + +// the shared +fs.writeFileSync( + SHARED_CONFIG_MODULE, + await formatCode([ + `export const TYPE = Object.freeze(${JSON.stringify({ + eslintImplicitGlobalSetting: 'readonly', + isTypeVariable: true, + isValueVariable: false, + })});`, + `export const VALUE = Object.freeze(${JSON.stringify({ + eslintImplicitGlobalSetting: 'readonly', + isTypeVariable: false, + isValueVariable: true, + })});`, + `export const TYPE_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( - fs.readFileSync(libPath, 'utf8'), - { - // we don't want any libs - lib: [], - sourceType: 'module', - }, - { - comment: true, - loc: true, - range: true, - }, - ) as { - // https://github.com/typescript-eslint/typescript-eslint/issues/8347 - ast: { comments: TSESTree.Comment[] } & TSESTree.Program; - } & ReturnType; - - const code = [`export const ${sanitize(libName)}: LibDefinition = {`]; - - const references = getReferences(ast); - if (references.size > 0) { - // add a newline before the export - code.unshift(''); - } +for (const [libName, filename] of libMap) { + const libPath = path.join(TS_LIB_FOLDER, filename); + const { ast, scopeManager } = parseAndAnalyze( + fs.readFileSync(libPath, 'utf8'), + { + // we don't want any libs + lib: [], + sourceType: 'module', + }, + { + comment: true, + loc: true, + range: true, + }, + ) as { + // https://github.com/typescript-eslint/typescript-eslint/issues/8347 + ast: { comments: TSESTree.Comment[] } & TSESTree.Program; + } & ReturnType; + + const code = [`export const ${sanitize(libName)}: LibDefinition = {`]; + + const references = getReferences(ast); + if (references.size > 0) { + // add a newline before the export + code.unshift(''); + } - // import and spread all of the references - const imports = ["import type { LibDefinition } from '../variable';"]; - code.push('libs: ['); - for (const reference of references) { - const name = sanitize(reference); - imports.push(`import { ${name} } from './${reference}'`); - code.push(`${name},`); - } - code.push('],'); - - const requiredBaseImports = new Set(); - - // add a declaration for each variable - const variables = getVariablesFromScope(scopeManager); - code.push('variables: ['); - for (const variable of variables) { - const importName = ((): BASE_CONFIG_EXPORT_NAMES => { - if (variable.isTypeVariable && variable.isValueVariable) { - return 'TYPE_VALUE'; - } - if (variable.isTypeVariable) { - return 'TYPE'; - } - if (variable.isValueVariable) { - return '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('],'); - code.push('};'); - - if (requiredBaseImports.size > 0) { - imports.push( - `import {${[...requiredBaseImports] - .sort() - .join(',')}} from './${BASE_CONFIG_MODULE_NAME}';`, + // import and spread all of the references + const imports = ["import type { LibDefinition } from '../variable';"]; + code.push('libs: ['); + for (const reference of references) { + const name = sanitize(reference); + imports.push(`import { ${name} } from './${reference}'`); + code.push(`${name},`); + } + code.push('],'); + + const requiredBaseImports = new Set(); + + // add a declaration for each variable + const variables = getVariablesFromScope(scopeManager); + code.push('variables: ['); + for (const variable of variables) { + const importName = ((): BASE_CONFIG_EXPORT_NAMES => { + if (variable.isTypeVariable && variable.isValueVariable) { + return 'TYPE_VALUE'; + } + if (variable.isTypeVariable) { + return 'TYPE'; + } + if (variable.isValueVariable) { + return 'VALUE'; + } + // shouldn't happen + throw new Error( + "Unexpected variable that's is not a type or value variable", ); - } + })(); + requiredBaseImports.add(importName); - if (imports.length > 0) { - code.unshift(...imports, ''); - } - - const formattedCode = await formatCode(code); - const writePath = path.join(OUTPUT_FOLDER, `${libName}.ts`); - fs.writeFileSync(writePath, formattedCode); - filesWritten.push(writePath); - - console.log( - 'Wrote', - variables.length, - 'variables, and', - references.size, - 'references for', - libName, + code.push(`['${variable.name}', ${importName}],`); + } + code.push('],'); + code.push('};'); + + if (requiredBaseImports.size > 0) { + imports.push( + `import {${[...requiredBaseImports] + .sort() + .join(',')}} from './${BASE_CONFIG_MODULE_NAME}';`, ); } - // generate and write a barrel file - const barrelImports = []; // use a separate way so everything is in the same order - const barrelCode = [ - '', - `export const lib: ReadonlyMap =`, - `new Map([`, - ]; - // Call `Object.entries` during barrel construction to avoid redundantly calling - // and allocating a new array on every reference - for (const lib of libMap.keys()) { - const name = sanitize(lib); - if (name === 'lib') { - barrelImports.push(`import { lib as libBase } from './${lib}'`); - barrelCode.push(`['${lib}', libBase],`); - } else { - barrelImports.push(`import { ${name} } from './${lib}'`); - barrelCode.push(`['${lib}', ${name}],`); - } + if (imports.length > 0) { + code.unshift(...imports, ''); } - barrelCode.unshift(...barrelImports); - barrelCode.unshift('', `import type { LibDefinition } from '../variable';`); - barrelCode.push(']);'); - const formattedBarrelCode = await formatCode(barrelCode); + const formattedCode = await formatCode(code); + const writePath = path.join(OUTPUT_FOLDER, `${libName}.ts`); + fs.writeFileSync(writePath, formattedCode); + filesWritten.push(writePath); + + console.log( + 'Wrote', + variables.length, + 'variables, and', + references.size, + 'references for', + libName, + ); +} + +// generate and write a barrel file +const barrelImports = []; // use a separate way so everything is in the same order +const barrelCode = [ + '', + `export const lib: ReadonlyMap =`, + `new Map([`, +]; +// Call `Object.entries` during barrel construction to avoid redundantly calling +// and allocating a new array on every reference +for (const lib of libMap.keys()) { + const name = sanitize(lib); + if (name === 'lib') { + barrelImports.push(`import { lib as libBase } from './${lib}'`); + barrelCode.push(`['${lib}', libBase],`); + } else { + barrelImports.push(`import { ${name} } from './${lib}'`); + barrelCode.push(`['${lib}', ${name}],`); + } +} +barrelCode.unshift(...barrelImports); +barrelCode.unshift('', `import type { LibDefinition } from '../variable';`); +barrelCode.push(']);'); - fs.writeFileSync(BARREL_PATH, formattedBarrelCode); - console.log('Wrote barrel file'); +const formattedBarrelCode = await formatCode(barrelCode); - // generate a string union type for the lib names +fs.writeFileSync(BARREL_PATH, formattedBarrelCode); +console.log('Wrote barrel file'); - const libUnionCode = [ - `export type Lib = ${[...libMap.keys()].map(k => `'${k}'`).join(' | ')};`, - ]; - const formattedLibUnionCode = await formatCode(libUnionCode); +// generate a string union type for the lib names - fs.writeFileSync(TYPES_FILE, formattedLibUnionCode); - console.log('Wrote Lib union type file'); +const libUnionCode = [ + `export type Lib = ${[...libMap.keys()].map(k => `'${k}'`).join(' | ')};`, +]; +const formattedLibUnionCode = await formatCode(libUnionCode); - const lint = new FlatESLint({ - fix: true, - }); - const results = await lint.lintFiles(filesWritten); - await FlatESLint.outputFixes(results); - console.log('Autofixed lint errors'); -} +fs.writeFileSync(TYPES_FILE, formattedLibUnionCode); +console.log('Wrote Lib union type file'); -main().catch((e: unknown) => { - console.error(e); - // eslint-disable-next-line no-process-exit - process.exit(1); +const lint = new FlatESLint({ + fix: true, }); +const results = await lint.lintFiles(filesWritten); +await FlatESLint.outputFixes(results); +console.log('Autofixed lint errors'); diff --git a/tools/scripts/generate-sponsors.mts b/tools/scripts/generate-sponsors.mts index 1bdb3b094c4c..f56d128d27dc 100644 --- a/tools/scripts/generate-sponsors.mts +++ b/tools/scripts/generate-sponsors.mts @@ -1,4 +1,4 @@ -import type { SponsorData } from 'website/src/components/FinancialContributors/types.ts'; +import type { SponsorData } from 'website/src/components/home/FinancialContributors/types.ts'; import fetch from 'cross-fetch'; import * as fs from 'node:fs'; diff --git a/tools/scripts/postinstall.mts b/tools/scripts/postinstall.mts index 5d123b1991d5..e64af26d08fa 100644 --- a/tools/scripts/postinstall.mts +++ b/tools/scripts/postinstall.mts @@ -20,7 +20,7 @@ const $ = $_config({ * We therefore use an env var for this. */ -if (process.env.SKIP_POSTINSTALL) { +if (process.env.SKIP_POSTINSTALL || process.env.MEND_HOSTED === 'true') { console.log( '\nSkipping postinstall script because $SKIP_POSTINSTALL is set...\n', ); @@ -28,22 +28,20 @@ if (process.env.SKIP_POSTINSTALL) { process.exit(0); } -void (async function (): Promise { - // make sure we're running from the workspace root - const { - default: { workspaceRoot }, - } = await import('@nx/devkit'); - process.chdir(workspaceRoot); +// make sure we're running from the workspace root +const { + default: { workspaceRoot }, +} = await import('@nx/devkit'); +process.chdir(workspaceRoot); - // Install git hooks - await $`yarn husky`; +// Install git hooks +await $`yarn husky`; - if (!process.env.SKIP_POSTINSTALL_BUILD) { - // Clean any caches that may be invalid now - await $`yarn clean`; +if (!process.env.SKIP_POSTINSTALL_BUILD) { + // Clean any caches that may be invalid now + await $`yarn clean`; - // Build all the packages ready for use - await $`yarn build`; - await $`yarn nx typecheck ast-spec`; - } -})(); + // Build all the packages ready for use + await $`yarn build`; + await $`yarn nx typecheck ast-spec`; +} diff --git a/tools/scripts/typings/typescript.d.ts b/tools/scripts/typings/typescript.d.ts deleted file mode 100644 index 354cbeefda46..000000000000 --- a/tools/scripts/typings/typescript.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import 'typescript'; - -// aliasing because the TS namespace annoyingly declares its own Map type -type StringMap = Map; -declare module 'typescript' { - /** - * Map of available libraries - * - * The key is the key used in compilerOptions.lib - * The value is the file name - */ - const libMap: StringMap; -} diff --git a/tsconfig.base.json b/tsconfig.base.json index ccc53afa64d9..1f6b9987bb96 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -4,7 +4,7 @@ "allowSyntheticDefaultImports": true, "composite": true, "declaration": true, - "declarationMap": true, + "declarationMap": false, "emitDeclarationOnly": true, "emitDecoratorMetadata": false, "esModuleInterop": true, diff --git a/tsconfig.json b/tsconfig.json index 5a3d4d28b9e8..ef9f265fd580 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,6 +11,7 @@ { "path": "./packages/eslint-plugin-internal" }, { "path": "./packages/integration-tests" }, { "path": "./packages/parser" }, + { "path": "./packages/project-service" }, { "path": "./packages/rule-schema-to-typescript-types" }, { "path": "./packages/rule-tester" }, { "path": "./packages/scope-manager" }, @@ -22,6 +23,7 @@ { "path": "./packages/visitor-keys" }, { "path": "./packages/website" }, { "path": "./packages/website-eslint" }, + { "path": "./packages/tsconfig-utils" }, { "path": "./tsconfig.repo-config-files.json" } ] } diff --git a/typings/eslint-plugin-eslint-plugin.d.ts b/typings/eslint-plugin-eslint-plugin.d.ts deleted file mode 100644 index 8496db0e5667..000000000000 --- a/typings/eslint-plugin-eslint-plugin.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -// TODO: Move this to DefinitelyTyped -declare module 'eslint-plugin-eslint-plugin' { - import type { FlatConfig, Linter } from '@typescript-eslint/utils/ts-eslint'; - - declare const exprt: { - configs: { - 'flat/all': FlatConfig.Config; - 'flat/recommended': FlatConfig.Config; - 'flat/rules': FlatConfig.Config; - 'flat/rules-recommended': FlatConfig.Config; - 'flat/tests': FlatConfig.Config; - 'flat/tests-recommended': FlatConfig.Config; - }; - rules: NonNullable; - }; - export = exprt; -} diff --git a/typings/eslint-plugin-import.d.ts b/typings/eslint-plugin-import.d.ts deleted file mode 100644 index 82819b7a4d37..000000000000 --- a/typings/eslint-plugin-import.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -// TODO: Move this to DefinitelyTyped -declare module 'eslint-plugin-import' { - import type { - ClassicConfig, - Linter, - } from '@typescript-eslint/utils/ts-eslint'; - - declare const exprt: { - configs: { - electron: ClassicConfig.Config; - errors: ClassicConfig.Config; - react: ClassicConfig.Config; - 'react-native': ClassicConfig.Config; - recommended: ClassicConfig.Config; - 'stage-0': ClassicConfig.Config; - typescript: ClassicConfig.Config; - warnings: ClassicConfig.Config; - }; - rules: NonNullable; - }; - export = exprt; -} diff --git a/yarn.lock b/yarn.lock index e87ed9ec5358..dd7f79df6a26 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12,174 +12,125 @@ __metadata: languageName: node linkType: hard -"@actions/core@npm:^1.10.1": - version: 1.11.1 - resolution: "@actions/core@npm:1.11.1" - dependencies: - "@actions/exec": ^1.1.1 - "@actions/http-client": ^2.0.1 - checksum: 9ac7a3e0b478bfefd862dcb4ddaa1d8c3f9076bb1931d3d280918d1749e7783480c6a009c1b009c8bf5093e2d77d9f4e023d70416145bf246f0071736d4ef839 - languageName: node - linkType: hard - -"@actions/exec@npm:^1.1.1": - version: 1.1.1 - resolution: "@actions/exec@npm:1.1.1" - dependencies: - "@actions/io": ^1.0.1 - checksum: d976e66dd51ab03d76a143da8e1406daa1bcdee06046168e6e0bec681c87a12999eefaad7a81cb81f28e4190610f55a58b8458ae4b82cbaaba13200490f4e8c2 - languageName: node - linkType: hard - -"@actions/github@npm:^6.0.0": - version: 6.0.0 - resolution: "@actions/github@npm:6.0.0" - dependencies: - "@actions/http-client": ^2.2.0 - "@octokit/core": ^5.0.1 - "@octokit/plugin-paginate-rest": ^9.0.0 - "@octokit/plugin-rest-endpoint-methods": ^10.0.0 - checksum: 81831a78377175d8825fc0b94247ff366c0e87ad1dfa48df9b30b8659506f216dcf1e2d3124fcd318839b92c24ba20165e238b3cc11a34db89c69c40825e9ccf - languageName: node - linkType: hard - -"@actions/http-client@npm:^2.0.1, @actions/http-client@npm:^2.2.0": - version: 2.2.0 - resolution: "@actions/http-client@npm:2.2.0" - dependencies: - tunnel: ^0.0.6 - undici: ^5.25.4 - checksum: 075fc21e8c05e865239bfc5cc91ce42aff7ac7877a5828145545cb27c572f74af8f96f90233f3ba2376525a9032bb8eadebd7221c007ce62459b99d5d2362f94 - languageName: node - linkType: hard - -"@actions/io@npm:^1.0.1": - version: 1.1.3 - resolution: "@actions/io@npm:1.1.3" - checksum: 42841ac2b8a7afb29456b9edb5534dbe00148893c794bdbc17d29166847c51c884e2a7c087a489a428250a78e7b54bc761ba3b55eb2f97d9600e9193b60caf0b - languageName: node - linkType: hard - -"@algolia/autocomplete-core@npm:1.9.3": - version: 1.9.3 - resolution: "@algolia/autocomplete-core@npm:1.9.3" +"@algolia/autocomplete-core@npm:1.17.9": + version: 1.17.9 + resolution: "@algolia/autocomplete-core@npm:1.17.9" dependencies: - "@algolia/autocomplete-plugin-algolia-insights": 1.9.3 - "@algolia/autocomplete-shared": 1.9.3 - checksum: ce78048568660184a4fa3c6548f344a7f5ce0ba45d4cfc233f9756b6d4f360afd5ae3a18efefcd27a626d3a0d6cf22d9cba3e21b217afae62b8e9d11bc4960da + "@algolia/autocomplete-plugin-algolia-insights": 1.17.9 + "@algolia/autocomplete-shared": 1.17.9 + checksum: dde242b1a2d8485e6c7bc94d00e25d707aa66dcd276ee1dde13213f1620bf6a1d289a61c657e40c707ca726a8aa009ab5e8229f92ae5cf22266de490b0634d20 languageName: node linkType: hard -"@algolia/autocomplete-plugin-algolia-insights@npm:1.9.3": - version: 1.9.3 - resolution: "@algolia/autocomplete-plugin-algolia-insights@npm:1.9.3" +"@algolia/autocomplete-plugin-algolia-insights@npm:1.17.9": + version: 1.17.9 + resolution: "@algolia/autocomplete-plugin-algolia-insights@npm:1.17.9" dependencies: - "@algolia/autocomplete-shared": 1.9.3 + "@algolia/autocomplete-shared": 1.17.9 peerDependencies: search-insights: ">= 1 < 3" - checksum: 030695bf692021c27f52a3d4931efed23032796e326d4ae7957ae91b51c36a10dc2d885fb043909e853f961c994b8e9ff087f50bb918cfa075370562251a199f + checksum: 32761d44a407d7c5ecfae98bb78b45a1ca85c59f44167ea36057315fb357c49684e9126bb7a67a513a27bda60a9661cecd6215f2daa903288860201b0b18c745 languageName: node linkType: hard -"@algolia/autocomplete-preset-algolia@npm:1.9.3": - version: 1.9.3 - resolution: "@algolia/autocomplete-preset-algolia@npm:1.9.3" +"@algolia/autocomplete-preset-algolia@npm:1.17.9": + version: 1.17.9 + resolution: "@algolia/autocomplete-preset-algolia@npm:1.17.9" dependencies: - "@algolia/autocomplete-shared": 1.9.3 + "@algolia/autocomplete-shared": 1.17.9 peerDependencies: "@algolia/client-search": ">= 4.9.1 < 6" algoliasearch: ">= 4.9.1 < 6" - checksum: 1ab3273d3054b348eed286ad1a54b21807846326485507b872477b827dc688006d4f14233cebd0bf49b2932ec8e29eca6d76e48a3c9e9e963b25153b987549c0 + checksum: 0dac2aae02121d37466b4ce1ca533420b25cd70e218a9e645e6194bd84a6012a0e94c22125437adb89599ecf14e4488882f91da382c6c9a8d9447e929b317522 languageName: node linkType: hard -"@algolia/autocomplete-shared@npm:1.9.3": - version: 1.9.3 - resolution: "@algolia/autocomplete-shared@npm:1.9.3" +"@algolia/autocomplete-shared@npm:1.17.9": + version: 1.17.9 + resolution: "@algolia/autocomplete-shared@npm:1.17.9" peerDependencies: "@algolia/client-search": ">= 4.9.1 < 6" algoliasearch: ">= 4.9.1 < 6" - checksum: 06014c8b08d30c452de079f48c0235d8fa09904bf511da8dc1b7e491819940fd4ff36b9bf65340242b2e157a26799a3b9aea01feee9c5bf67be3c48d7dff43d7 + checksum: f16223f5995db0deb014a066e3587ec2da76e62b861aa21411be92cb255b7023507803283803d8c960b396a2c6b690951337c32fef34f68c59ecfb3822dee577 languageName: node linkType: hard -"@algolia/cache-browser-local-storage@npm:4.22.1": - version: 4.22.1 - resolution: "@algolia/cache-browser-local-storage@npm:4.22.1" +"@algolia/client-abtesting@npm:5.25.0": + version: 5.25.0 + resolution: "@algolia/client-abtesting@npm:5.25.0" dependencies: - "@algolia/cache-common": 4.22.1 - checksum: 82e65c0dbc015d55bf17842757d21c3769fde95c10235d038062ccb41f2f64b3b1efd953df0f1b4892f352d83cdf2b8374a8f1b4e06b4ba42b35c3a449d316e7 + "@algolia/client-common": 5.25.0 + "@algolia/requester-browser-xhr": 5.25.0 + "@algolia/requester-fetch": 5.25.0 + "@algolia/requester-node-http": 5.25.0 + checksum: 104b680681eae79e6e38f60f1c57eb7e6172305c8d1b1bca3ca15e19c74c9a502bbce0cb83371d2a5824775c7c023be71d3f355f9617208ed592ff0b557e90c6 languageName: node linkType: hard -"@algolia/cache-common@npm:4.22.1": - version: 4.22.1 - resolution: "@algolia/cache-common@npm:4.22.1" - checksum: b57b195fdf75ca53417541fd03b48fa2351c18261f21ddc462ca4e76adef4750a35df9db707e9acc9f7a67fb465757d7f254423b4f8b0661056e4d2ec07392c1 - languageName: node - linkType: hard - -"@algolia/cache-in-memory@npm:4.22.1": - version: 4.22.1 - resolution: "@algolia/cache-in-memory@npm:4.22.1" +"@algolia/client-analytics@npm:5.25.0": + version: 5.25.0 + resolution: "@algolia/client-analytics@npm:5.25.0" dependencies: - "@algolia/cache-common": 4.22.1 - checksum: 83dfe0e3360f5dd03ead8165f6e92e5a414d9e43eee2dd2fb682d418ddcf8c2cb176d040f57ac75018f62ab805518991157bf8572625f1420515f1959f4fdcaa + "@algolia/client-common": 5.25.0 + "@algolia/requester-browser-xhr": 5.25.0 + "@algolia/requester-fetch": 5.25.0 + "@algolia/requester-node-http": 5.25.0 + checksum: ddc0feed1203e9fdd23a799110162b33fe134248020ea6887f24502d73462ab6cc39de30b7a9f1e6e4187d857323468d3f43997c93438e5ac536b9952cefaa8f languageName: node linkType: hard -"@algolia/client-account@npm:4.22.1": - version: 4.22.1 - resolution: "@algolia/client-account@npm:4.22.1" - dependencies: - "@algolia/client-common": 4.22.1 - "@algolia/client-search": 4.22.1 - "@algolia/transporter": 4.22.1 - checksum: 85f3f7f9fa8e9d5b723e128f3b801583d73e4dc529086d57adfc1ac1718c3e13c0660c0d3f3a43a033d5aa231962ed405912826ae74a5c996929943fc575e7ed +"@algolia/client-common@npm:5.25.0": + version: 5.25.0 + resolution: "@algolia/client-common@npm:5.25.0" + checksum: c9d1dc65ec4504a276e7150a0f82aa451aff779662bc9f975aa461f729a4ea250e693791115cd51c5aeeef3e0320af97b585fa7356142c12dbf92ddf97d6c655 languageName: node linkType: hard -"@algolia/client-analytics@npm:4.22.1": - version: 4.22.1 - resolution: "@algolia/client-analytics@npm:4.22.1" +"@algolia/client-insights@npm:5.25.0": + version: 5.25.0 + resolution: "@algolia/client-insights@npm:5.25.0" dependencies: - "@algolia/client-common": 4.22.1 - "@algolia/client-search": 4.22.1 - "@algolia/requester-common": 4.22.1 - "@algolia/transporter": 4.22.1 - checksum: 8a352ae6bbddeba86fbf12de6bdd4f48d7331c5d8cdf803af803f5957a10d0a09ead58e75e364d25a7becdf68e9d5252377e307c055cbfbd6bc2048557bd75f6 + "@algolia/client-common": 5.25.0 + "@algolia/requester-browser-xhr": 5.25.0 + "@algolia/requester-fetch": 5.25.0 + "@algolia/requester-node-http": 5.25.0 + checksum: 1ce9b03d9a50c89f6b64713c3cca6fa388fee3bb605e6e5aa4ce9775eeac6288469b2f63cc5dc66f0d828f560fb3924819136db9bd5013b4642c3ac4393c7a24 languageName: node linkType: hard -"@algolia/client-common@npm:4.22.1": - version: 4.22.1 - resolution: "@algolia/client-common@npm:4.22.1" +"@algolia/client-personalization@npm:5.25.0": + version: 5.25.0 + resolution: "@algolia/client-personalization@npm:5.25.0" dependencies: - "@algolia/requester-common": 4.22.1 - "@algolia/transporter": 4.22.1 - checksum: 848225464bf62972eee80faed400b6e9666678e724c5ddd3ecedc6fb57db1cd5c47c4a06a4cba90f83db38353ea8dcbf53b51d1423164a0258bce7bbe417e7f8 + "@algolia/client-common": 5.25.0 + "@algolia/requester-browser-xhr": 5.25.0 + "@algolia/requester-fetch": 5.25.0 + "@algolia/requester-node-http": 5.25.0 + checksum: 096453dbb4d79ef994f6f1974bb809bf12232b1446fc4bd57873a044feee022fe64bec595036c9789d06a963361a6449fd0c9119e359edc92f5698ad00a60b16 languageName: node linkType: hard -"@algolia/client-personalization@npm:4.22.1": - version: 4.22.1 - resolution: "@algolia/client-personalization@npm:4.22.1" +"@algolia/client-query-suggestions@npm:5.25.0": + version: 5.25.0 + resolution: "@algolia/client-query-suggestions@npm:5.25.0" dependencies: - "@algolia/client-common": 4.22.1 - "@algolia/requester-common": 4.22.1 - "@algolia/transporter": 4.22.1 - checksum: 64c359c12d2722dfcc821a3bacfed2c49f94159060776fba871b66e4961757732d9696840f415b45bbe5ad1dbd39e2c512a81851a9cfeeec8511975396dad245 + "@algolia/client-common": 5.25.0 + "@algolia/requester-browser-xhr": 5.25.0 + "@algolia/requester-fetch": 5.25.0 + "@algolia/requester-node-http": 5.25.0 + checksum: 26445be4bbfaf1ea939339fb365c2f62211803670dc2e8d821ccb36266fc2f99e5b08109c3befdb937e904dee313981ad7b0af8c20ba7e2954d1fcccce792942 languageName: node linkType: hard -"@algolia/client-search@npm:4.22.1": - version: 4.22.1 - resolution: "@algolia/client-search@npm:4.22.1" +"@algolia/client-search@npm:5.25.0": + version: 5.25.0 + resolution: "@algolia/client-search@npm:5.25.0" dependencies: - "@algolia/client-common": 4.22.1 - "@algolia/requester-common": 4.22.1 - "@algolia/transporter": 4.22.1 - checksum: 0477f003c19cf1dbb6190fd491136927bc7174fa9d5a27dead218a51807da9c519be114000bd035265c018682fd8654d110cab07f74004c8c8d069db19800c3d + "@algolia/client-common": 5.25.0 + "@algolia/requester-browser-xhr": 5.25.0 + "@algolia/requester-fetch": 5.25.0 + "@algolia/requester-node-http": 5.25.0 + checksum: fbad54f129a465210398d3995884fedbe16433eb460496fd8279212c8c41ad9b5fa6ec7b86bea73bc57b01c6e4650fc6449533c5ae4dcbaabb842b8dddeb0b41 languageName: node linkType: hard @@ -190,55 +141,66 @@ __metadata: languageName: node linkType: hard -"@algolia/logger-common@npm:4.22.1": - version: 4.22.1 - resolution: "@algolia/logger-common@npm:4.22.1" - checksum: 3ac5430f73e8eabb4e7561b271d38151fb7f128491437c202dac3d54f7c3a83ebc96818532746422ea4abdf9d68a6ccb716dc8b97f69101ff642afaff12057e5 +"@algolia/ingestion@npm:1.25.0": + version: 1.25.0 + resolution: "@algolia/ingestion@npm:1.25.0" + dependencies: + "@algolia/client-common": 5.25.0 + "@algolia/requester-browser-xhr": 5.25.0 + "@algolia/requester-fetch": 5.25.0 + "@algolia/requester-node-http": 5.25.0 + checksum: 802ea840fe5cd6cdd113428c18d038a7e2e431cf70c3306c1ed32f03b7ca023d849b04c62640c75818e40547524fb190a65601fd1840bbe8f593fbc7542820e1 languageName: node linkType: hard -"@algolia/logger-console@npm:4.22.1": - version: 4.22.1 - resolution: "@algolia/logger-console@npm:4.22.1" +"@algolia/monitoring@npm:1.25.0": + version: 1.25.0 + resolution: "@algolia/monitoring@npm:1.25.0" dependencies: - "@algolia/logger-common": 4.22.1 - checksum: fc6ea0623b257420f4e10ca1a78875dfb4c55841a0db5712150344d742ca457038f209b63c4e25848338c652e5ca5ea052a4143c87c3dc1203eedc5bff0c54f3 + "@algolia/client-common": 5.25.0 + "@algolia/requester-browser-xhr": 5.25.0 + "@algolia/requester-fetch": 5.25.0 + "@algolia/requester-node-http": 5.25.0 + checksum: 4b268201719cc6f56f89e0aa5ab97e764c9d204ab07b202de550d48280e69c5d95cece8e9a7f8247c8e7ac5c89957f98efe48a90f7c07b8aaabc50e895a0e97e languageName: node linkType: hard -"@algolia/requester-browser-xhr@npm:4.22.1": - version: 4.22.1 - resolution: "@algolia/requester-browser-xhr@npm:4.22.1" +"@algolia/recommend@npm:5.25.0": + version: 5.25.0 + resolution: "@algolia/recommend@npm:5.25.0" dependencies: - "@algolia/requester-common": 4.22.1 - checksum: 825cf73fdc6aa8b159cd35ebb1facbeccb9fe27c4360661b7c9287d830d92409baaa38ad78f6c6f72bcdebc6e9d6ae8a5c8648e998fd34617b7f1eb7a59ea83b + "@algolia/client-common": 5.25.0 + "@algolia/requester-browser-xhr": 5.25.0 + "@algolia/requester-fetch": 5.25.0 + "@algolia/requester-node-http": 5.25.0 + checksum: b462e360abe2e58c6d6cd39c61b8dc6f9b26a056c308b8289b35c49d43e82d06c631d0936332cd43f9d277964fbf765898d783845f8b4ea458edda6398c76e74 languageName: node linkType: hard -"@algolia/requester-common@npm:4.22.1": - version: 4.22.1 - resolution: "@algolia/requester-common@npm:4.22.1" - checksum: 7caae4924efccabefd6b1a1d4e7090ed2f6dd4ab53dedf2f2095d5c1ef016c841129331c79791f7ded8072e174204503814f11119ac8bc75f5e10ae2eb42a85b +"@algolia/requester-browser-xhr@npm:5.25.0": + version: 5.25.0 + resolution: "@algolia/requester-browser-xhr@npm:5.25.0" + dependencies: + "@algolia/client-common": 5.25.0 + checksum: cbe78d3ffc5d60571b459735cd6b6115c3d96a8f6fac07256d1765e499b9d24941e0e39ce18bd9b3dc46faa1cb1380fb8487154c36a6acbf534d1bb7d3ac3867 languageName: node linkType: hard -"@algolia/requester-node-http@npm:4.22.1": - version: 4.22.1 - resolution: "@algolia/requester-node-http@npm:4.22.1" +"@algolia/requester-fetch@npm:5.25.0": + version: 5.25.0 + resolution: "@algolia/requester-fetch@npm:5.25.0" dependencies: - "@algolia/requester-common": 4.22.1 - checksum: 511348954b7747006875132ed0bc922ec3cfcf0187f41a665fc45426982479dd5cd55fab1de592ac9a71180539ff2e4c7457eea3bdab0e56bce27de2de1ba677 + "@algolia/client-common": 5.25.0 + checksum: 795ddbc4c9a50c64088ae2745d8270a9b5275f6f9bb13f53ccaa4e9193666bcbcb514ca5c2e82138698c2c194995c97ce6386927c75e5aaf116e5663cb47657d languageName: node linkType: hard -"@algolia/transporter@npm:4.22.1": - version: 4.22.1 - resolution: "@algolia/transporter@npm:4.22.1" +"@algolia/requester-node-http@npm:5.25.0": + version: 5.25.0 + resolution: "@algolia/requester-node-http@npm:5.25.0" dependencies: - "@algolia/cache-common": 4.22.1 - "@algolia/logger-common": 4.22.1 - "@algolia/requester-common": 4.22.1 - checksum: 737e787ac77215f30db54ebab3431e06cfee1790ab7cf45222546470546ecb276eedfaa0aedf78b2c95efa9d5550ea7d47c947535f143d7002a22f781d8721ce + "@algolia/client-common": 5.25.0 + checksum: 24231761720f059311d753abea5328038417e36c458acdff06d22e287d75e11b23ddb93011a86c4381a28e903622835f0b73a28160bfec7a69bea26c5b1d5942 languageName: node linkType: hard @@ -265,50 +227,59 @@ __metadata: languageName: node linkType: hard -"@babel/code-frame@npm:^7.0.0, @babel/code-frame@npm:^7.10.4, @babel/code-frame@npm:^7.16.0, @babel/code-frame@npm:^7.24.2, @babel/code-frame@npm:^7.25.9, @babel/code-frame@npm:^7.26.0, @babel/code-frame@npm:^7.8.3": - version: 7.26.2 - resolution: "@babel/code-frame@npm:7.26.2" +"@arcanis/slice-ansi@npm:^1.1.1": + version: 1.1.1 + resolution: "@arcanis/slice-ansi@npm:1.1.1" dependencies: - "@babel/helper-validator-identifier": ^7.25.9 + grapheme-splitter: ^1.0.4 + checksum: 14ed60cb45750d386c64229ac7bab20e10eedc193503fa4decff764162d329d6d3363ed2cd3debec833186ee54affe4f824f6e8eff531295117fd1ebda200270 + languageName: node + linkType: hard + +"@babel/code-frame@npm:^7.0.0, @babel/code-frame@npm:^7.10.4, @babel/code-frame@npm:^7.16.0, @babel/code-frame@npm:^7.24.2, @babel/code-frame@npm:^7.27.1, @babel/code-frame@npm:^7.8.3": + version: 7.27.1 + resolution: "@babel/code-frame@npm:7.27.1" + dependencies: + "@babel/helper-validator-identifier": ^7.27.1 js-tokens: ^4.0.0 - picocolors: ^1.0.0 - checksum: db13f5c42d54b76c1480916485e6900748bbcb0014a8aca87f50a091f70ff4e0d0a6db63cade75eb41fcc3d2b6ba0a7f89e343def4f96f00269b41b8ab8dd7b8 + picocolors: ^1.1.1 + checksum: 5874edc5d37406c4a0bb14cf79c8e51ad412fb0423d176775ac14fc0259831be1bf95bdda9c2aa651126990505e09a9f0ed85deaa99893bc316d2682c5115bdc languageName: node linkType: hard -"@babel/compat-data@npm:^7.22.6, @babel/compat-data@npm:^7.25.9, @babel/compat-data@npm:^7.26.0": - version: 7.26.2 - resolution: "@babel/compat-data@npm:7.26.2" - checksum: d52fae9b0dc59b409d6005ae6b172e89329f46d68136130065ebe923a156fc633e0f1c8600b3e319b9e0f99fd948f64991a5419e2e9431d00d9d235d5f7a7618 +"@babel/compat-data@npm:^7.22.6, @babel/compat-data@npm:^7.26.0, @babel/compat-data@npm:^7.27.2": + version: 7.28.0 + resolution: "@babel/compat-data@npm:7.28.0" + checksum: 37a40d4ea10a32783bc24c4ad374200f5db864c8dfa42f82e76f02b8e84e4c65e6a017fc014d165b08833f89333dff4cb635fce30f03c333ea3525ea7e20f0a2 languageName: node linkType: hard "@babel/core@npm:^7.11.1, @babel/core@npm:^7.21.3, @babel/core@npm:^7.23.2, @babel/core@npm:^7.24.4, @babel/core@npm:^7.25.9": - version: 7.26.0 - resolution: "@babel/core@npm:7.26.0" + version: 7.28.3 + resolution: "@babel/core@npm:7.28.3" dependencies: "@ampproject/remapping": ^2.2.0 - "@babel/code-frame": ^7.26.0 - "@babel/generator": ^7.26.0 - "@babel/helper-compilation-targets": ^7.25.9 - "@babel/helper-module-transforms": ^7.26.0 - "@babel/helpers": ^7.26.0 - "@babel/parser": ^7.26.0 - "@babel/template": ^7.25.9 - "@babel/traverse": ^7.25.9 - "@babel/types": ^7.26.0 + "@babel/code-frame": ^7.27.1 + "@babel/generator": ^7.28.3 + "@babel/helper-compilation-targets": ^7.27.2 + "@babel/helper-module-transforms": ^7.28.3 + "@babel/helpers": ^7.28.3 + "@babel/parser": ^7.28.3 + "@babel/template": ^7.27.2 + "@babel/traverse": ^7.28.3 + "@babel/types": ^7.28.2 convert-source-map: ^2.0.0 debug: ^4.1.0 gensync: ^1.0.0-beta.2 json5: ^2.2.3 semver: ^6.3.1 - checksum: b296084cfd818bed8079526af93b5dfa0ba70282532d2132caf71d4060ab190ba26d3184832a45accd82c3c54016985a4109ab9118674347a7e5e9bc464894e6 + checksum: d09132cd752730d219bdd29dbd65cb647151105bef6e615cfb6d57249f71a3d1aaf8a5beaa1c7ec54ad927962e4913ebc660f7f0c3e65c39bc171bc386285e50 languageName: node linkType: hard "@babel/eslint-parser@npm:^7.24.1": - version: 7.26.8 - resolution: "@babel/eslint-parser@npm:7.26.8" + version: 7.28.0 + resolution: "@babel/eslint-parser@npm:7.28.0" dependencies: "@nicolo-ribaudo/eslint-scope-5-internals": 5.1.1-v1 eslint-visitor-keys: ^2.1.0 @@ -316,20 +287,20 @@ __metadata: peerDependencies: "@babel/core": ^7.11.0 eslint: ^7.5.0 || ^8.0.0 || ^9.0.0 - checksum: a434da9e3099e5f77911baa4eaa21f2ec64768703be1fde2858e8ffdb8be6cb78ff67c611c8c17fe1ece54d925b65487a7455cca93103b017443a51b76320751 + checksum: ccfc4b9b9fdca2b8df95da3827b70231e9588a71447ff7b2de76c4f36710e4e0a7dc5e2e98623f398a737c2429c46500cb11d4ccdfeb98271e067d0bf0eec9b5 languageName: node linkType: hard -"@babel/generator@npm:^7.25.9, @babel/generator@npm:^7.26.0": - version: 7.26.2 - resolution: "@babel/generator@npm:7.26.2" +"@babel/generator@npm:^7.25.9, @babel/generator@npm:^7.28.3": + version: 7.28.3 + resolution: "@babel/generator@npm:7.28.3" dependencies: - "@babel/parser": ^7.26.2 - "@babel/types": ^7.26.0 - "@jridgewell/gen-mapping": ^0.3.5 - "@jridgewell/trace-mapping": ^0.3.25 + "@babel/parser": ^7.28.3 + "@babel/types": ^7.28.2 + "@jridgewell/gen-mapping": ^0.3.12 + "@jridgewell/trace-mapping": ^0.3.28 jsesc: ^3.0.2 - checksum: 6ff850b7d6082619f8c2f518d993cf7254cfbaa20b026282cbef5c9b2197686d076a432b18e36c4d1a42721c016df4f77a8f62c67600775d9683621d534b91b4 + checksum: e2202bf2b9c8a94f7e7a0a049fda0ee037d055c46922e85afa3bbc53309113f859b8193894f991045d7865226028b8f4f06152ed315ab414451932016dba5e42 languageName: node linkType: hard @@ -352,16 +323,16 @@ __metadata: languageName: node linkType: hard -"@babel/helper-compilation-targets@npm:^7.22.6, @babel/helper-compilation-targets@npm:^7.25.9": - version: 7.25.9 - resolution: "@babel/helper-compilation-targets@npm:7.25.9" +"@babel/helper-compilation-targets@npm:^7.22.6, @babel/helper-compilation-targets@npm:^7.25.9, @babel/helper-compilation-targets@npm:^7.27.2": + version: 7.27.2 + resolution: "@babel/helper-compilation-targets@npm:7.27.2" dependencies: - "@babel/compat-data": ^7.25.9 - "@babel/helper-validator-option": ^7.25.9 + "@babel/compat-data": ^7.27.2 + "@babel/helper-validator-option": ^7.27.1 browserslist: ^4.24.0 lru-cache: ^5.1.1 semver: ^6.3.1 - checksum: 3af536e2db358b38f968abdf7d512d425d1018fef2f485d6f131a57a7bcaed32c606b4e148bb230e1508fa42b5b2ac281855a68eb78270f54698c48a83201b9b + checksum: 7b95328237de85d7af1dea010a4daa28e79f961dda48b652860d5893ce9b136fc8b9ea1f126d8e0a24963b09ba5c6631dcb907b4ce109b04452d34a6ae979807 languageName: node linkType: hard @@ -410,6 +381,13 @@ __metadata: languageName: node linkType: hard +"@babel/helper-globals@npm:^7.28.0": + version: 7.28.0 + resolution: "@babel/helper-globals@npm:7.28.0" + checksum: d8d7b91c12dad1ee747968af0cb73baf91053b2bcf78634da2c2c4991fb45ede9bd0c8f9b5f3254881242bc0921218fcb7c28ae885477c25177147e978ce4397 + languageName: node + linkType: hard + "@babel/helper-member-expression-to-functions@npm:^7.25.9": version: 7.25.9 resolution: "@babel/helper-member-expression-to-functions@npm:7.25.9" @@ -420,26 +398,26 @@ __metadata: languageName: node linkType: hard -"@babel/helper-module-imports@npm:^7.10.4, @babel/helper-module-imports@npm:^7.25.9": - version: 7.25.9 - resolution: "@babel/helper-module-imports@npm:7.25.9" +"@babel/helper-module-imports@npm:^7.10.4, @babel/helper-module-imports@npm:^7.25.9, @babel/helper-module-imports@npm:^7.27.1": + version: 7.27.1 + resolution: "@babel/helper-module-imports@npm:7.27.1" dependencies: - "@babel/traverse": ^7.25.9 - "@babel/types": ^7.25.9 - checksum: 1b411ce4ca825422ef7065dffae7d8acef52023e51ad096351e3e2c05837e9bf9fca2af9ca7f28dc26d596a588863d0fedd40711a88e350b736c619a80e704e6 + "@babel/traverse": ^7.27.1 + "@babel/types": ^7.27.1 + checksum: 92d01c71c0e4aacdc2babce418a9a1a27a8f7d770a210ffa0f3933f321befab18b655bc1241bebc40767516731de0b85639140c42e45a8210abe1e792f115b28 languageName: node linkType: hard -"@babel/helper-module-transforms@npm:^7.25.9, @babel/helper-module-transforms@npm:^7.26.0": - version: 7.26.0 - resolution: "@babel/helper-module-transforms@npm:7.26.0" +"@babel/helper-module-transforms@npm:^7.25.9, @babel/helper-module-transforms@npm:^7.28.3": + version: 7.28.3 + resolution: "@babel/helper-module-transforms@npm:7.28.3" dependencies: - "@babel/helper-module-imports": ^7.25.9 - "@babel/helper-validator-identifier": ^7.25.9 - "@babel/traverse": ^7.25.9 + "@babel/helper-module-imports": ^7.27.1 + "@babel/helper-validator-identifier": ^7.27.1 + "@babel/traverse": ^7.28.3 peerDependencies: "@babel/core": ^7.0.0 - checksum: 942eee3adf2b387443c247a2c190c17c4fd45ba92a23087abab4c804f40541790d51ad5277e4b5b1ed8d5ba5b62de73857446b7742f835c18ebd350384e63917 + checksum: 7cf7b79da0fa626d6c84bfc7b35c079a2559caecaa2ff645b0f1db0d741507aa4df6b5b98a3283e8ac4e89094af271d805bf5701e5c4f916e622797b7c8cbb18 languageName: node linkType: hard @@ -505,7 +483,7 @@ __metadata: languageName: node linkType: hard -"@babel/helper-string-parser@npm:^7.25.9, @babel/helper-string-parser@npm:^7.27.1": +"@babel/helper-string-parser@npm:^7.27.1": version: 7.27.1 resolution: "@babel/helper-string-parser@npm:7.27.1" checksum: 0a8464adc4b39b138aedcb443b09f4005d86207d7126e5e079177e05c3116107d856ec08282b365e9a79a9872f40f4092a6127f8d74c8a01c1ef789dacfc25d6 @@ -519,10 +497,10 @@ __metadata: languageName: node linkType: hard -"@babel/helper-validator-option@npm:^7.25.9": - version: 7.25.9 - resolution: "@babel/helper-validator-option@npm:7.25.9" - checksum: 9491b2755948ebbdd68f87da907283698e663b5af2d2b1b02a2765761974b1120d5d8d49e9175b167f16f72748ffceec8c9cf62acfbee73f4904507b246e2b3d +"@babel/helper-validator-option@npm:^7.25.9, @babel/helper-validator-option@npm:^7.27.1": + version: 7.27.1 + resolution: "@babel/helper-validator-option@npm:7.27.1" + checksum: db73e6a308092531c629ee5de7f0d04390835b21a263be2644276cb27da2384b64676cab9f22cd8d8dbd854c92b1d7d56fc8517cf0070c35d1c14a8c828b0903 languageName: node linkType: hard @@ -537,24 +515,24 @@ __metadata: languageName: node linkType: hard -"@babel/helpers@npm:^7.26.0": - version: 7.26.0 - resolution: "@babel/helpers@npm:7.26.0" +"@babel/helpers@npm:^7.28.3": + version: 7.28.3 + resolution: "@babel/helpers@npm:7.28.3" dependencies: - "@babel/template": ^7.25.9 - "@babel/types": ^7.26.0 - checksum: d77fe8d45033d6007eadfa440355c1355eed57902d5a302f450827ad3d530343430a21210584d32eef2f216ae463d4591184c6fc60cf205bbf3a884561469200 + "@babel/template": ^7.27.2 + "@babel/types": ^7.28.2 + checksum: 16c7f259dbd23834740ebc1c7e5a32d9424615eacd324ee067b585ab40eaafab37e2e50f50c84183a7e7a31251dc5a65a2ec4f8395f049001bbe6e14d0d3e9d4 languageName: node linkType: hard -"@babel/parser@npm:^7.1.0, @babel/parser@npm:^7.20.7, @babel/parser@npm:^7.25.4, @babel/parser@npm:^7.25.9, @babel/parser@npm:^7.26.0, @babel/parser@npm:^7.26.2": - version: 7.27.2 - resolution: "@babel/parser@npm:7.27.2" +"@babel/parser@npm:^7.1.0, @babel/parser@npm:^7.20.7, @babel/parser@npm:^7.24.1, @babel/parser@npm:^7.25.4, @babel/parser@npm:^7.27.2, @babel/parser@npm:^7.28.3": + version: 7.28.3 + resolution: "@babel/parser@npm:7.28.3" dependencies: - "@babel/types": ^7.27.1 + "@babel/types": ^7.28.2 bin: parser: ./bin/babel-parser.js - checksum: 1ac70a75028f1cc10eefb10ed2d83cf700ca3e1ddb4cf556a003fc5c4ca53ae83350bbb8065020fcc70d476fcf7bf1c17191b72384f719614ae18397142289cf + checksum: 5aa5ea0683a4056f98cd9cd61650870d5d44ec1654da14f72a8a06fabe7b2a35bf6cef9605f3740b5ded1e68f64ec45ce1aabf7691047a13a1ff2babe126acf9 languageName: node linkType: hard @@ -1531,57 +1509,45 @@ __metadata: linkType: hard "@babel/runtime@npm:^7.1.2, @babel/runtime@npm:^7.10.3, @babel/runtime@npm:^7.11.2, @babel/runtime@npm:^7.12.13, @babel/runtime@npm:^7.12.5, @babel/runtime@npm:^7.22.6, @babel/runtime@npm:^7.24.4, @babel/runtime@npm:^7.25.9, @babel/runtime@npm:^7.8.4": - version: 7.26.0 - resolution: "@babel/runtime@npm:7.26.0" - dependencies: - regenerator-runtime: ^0.14.0 - checksum: c8e2c0504ab271b3467a261a8f119bf2603eb857a0d71e37791f4e3fae00f681365073cc79f141ddaa90c6077c60ba56448004ad5429d07ac73532be9f7cf28a + version: 7.28.3 + resolution: "@babel/runtime@npm:7.28.3" + checksum: dd22662b9e02b6e66cfb061d6f9730eb0aa3b3a390a7bd70fe9a64116d86a3704df6d54ab978cb4acc13b58dbf63a3d7dd4616b0b87030eb14a22835e0aa602d languageName: node linkType: hard -"@babel/template@npm:^7.25.9": - version: 7.25.9 - resolution: "@babel/template@npm:7.25.9" +"@babel/template@npm:^7.25.9, @babel/template@npm:^7.27.2": + version: 7.27.2 + resolution: "@babel/template@npm:7.27.2" dependencies: - "@babel/code-frame": ^7.25.9 - "@babel/parser": ^7.25.9 - "@babel/types": ^7.25.9 - checksum: 103641fea19c7f4e82dc913aa6b6ac157112a96d7c724d513288f538b84bae04fb87b1f1e495ac1736367b1bc30e10f058b30208fb25f66038e1f1eb4e426472 + "@babel/code-frame": ^7.27.1 + "@babel/parser": ^7.27.2 + "@babel/types": ^7.27.1 + checksum: ff5628bc066060624afd970616090e5bba91c6240c2e4b458d13267a523572cbfcbf549391eec8217b94b064cf96571c6273f0c04b28a8567b96edc675c28e27 languageName: node linkType: hard -"@babel/traverse@npm:^7.16.0, @babel/traverse@npm:^7.25.9": - version: 7.25.9 - resolution: "@babel/traverse@npm:7.25.9" +"@babel/traverse@npm:^7.16.0, @babel/traverse@npm:^7.25.9, @babel/traverse@npm:^7.27.1, @babel/traverse@npm:^7.28.3": + version: 7.28.3 + resolution: "@babel/traverse@npm:7.28.3" dependencies: - "@babel/code-frame": ^7.25.9 - "@babel/generator": ^7.25.9 - "@babel/parser": ^7.25.9 - "@babel/template": ^7.25.9 - "@babel/types": ^7.25.9 + "@babel/code-frame": ^7.27.1 + "@babel/generator": ^7.28.3 + "@babel/helper-globals": ^7.28.0 + "@babel/parser": ^7.28.3 + "@babel/template": ^7.27.2 + "@babel/types": ^7.28.2 debug: ^4.3.1 - globals: ^11.1.0 - checksum: 901d325662ff1dd9bc51de00862e01055fa6bc374f5297d7e3731f2f0e268bbb1d2141f53fa82860aa308ee44afdcf186a948f16c83153927925804b95a9594d - languageName: node - linkType: hard - -"@babel/types@npm:^7.0.0, @babel/types@npm:^7.20.7, @babel/types@npm:^7.21.3, @babel/types@npm:^7.25.9, @babel/types@npm:^7.26.0, @babel/types@npm:^7.4.4": - version: 7.26.0 - resolution: "@babel/types@npm:7.26.0" - dependencies: - "@babel/helper-string-parser": ^7.25.9 - "@babel/helper-validator-identifier": ^7.25.9 - checksum: a3dd37dabac693018872da96edb8c1843a605c1bfacde6c3f504fba79b972426a6f24df70aa646356c0c1b19bdd2c722c623c684a996c002381071680602280d + checksum: 5f5ce477adc99ebdd6e8c9b7ba2e0a162bef39a1d3c5860c730c1674e57f9cb057c7e3dfdd652ce890bd79331a70f6cd310902414697787578e68167d52d96e7 languageName: node linkType: hard -"@babel/types@npm:^7.25.4, @babel/types@npm:^7.27.1": - version: 7.27.1 - resolution: "@babel/types@npm:7.27.1" +"@babel/types@npm:^7.0.0, @babel/types@npm:^7.20.7, @babel/types@npm:^7.21.3, @babel/types@npm:^7.25.4, @babel/types@npm:^7.25.9, @babel/types@npm:^7.27.1, @babel/types@npm:^7.28.2, @babel/types@npm:^7.4.4": + version: 7.28.2 + resolution: "@babel/types@npm:7.28.2" dependencies: "@babel/helper-string-parser": ^7.27.1 "@babel/helper-validator-identifier": ^7.27.1 - checksum: 357c13f37aaa2f2e2cfcdb63f986d5f7abc9f38df20182b620ace34387d2460620415770fe5856eb54d70c9f0ba2f71230d29465e789188635a948476b830ae4 + checksum: 2218f0996d5fbadc4e3428c4c38f4ed403f0e2634e3089beba2c89783268c0c1d796a23e65f9f1ff8547b9061ae1a67691c76dc27d0b457e5fa9f2dd4e022e49 languageName: node linkType: hard @@ -1599,666 +1565,1135 @@ __metadata: languageName: node linkType: hard -"@cspell/cspell-bundled-dicts@npm:9.0.0": - version: 9.0.0 - resolution: "@cspell/cspell-bundled-dicts@npm:9.0.0" - dependencies: - "@cspell/dict-ada": ^4.1.0 - "@cspell/dict-al": ^1.1.0 - "@cspell/dict-aws": ^4.0.10 - "@cspell/dict-bash": ^4.2.0 - "@cspell/dict-companies": ^3.2.1 - "@cspell/dict-cpp": ^6.0.8 - "@cspell/dict-cryptocurrencies": ^5.0.4 - "@cspell/dict-csharp": ^4.0.6 - "@cspell/dict-css": ^4.0.17 - "@cspell/dict-dart": ^2.3.0 - "@cspell/dict-data-science": ^2.0.8 - "@cspell/dict-django": ^4.1.4 - "@cspell/dict-docker": ^1.1.14 - "@cspell/dict-dotnet": ^5.0.9 - "@cspell/dict-elixir": ^4.0.7 - "@cspell/dict-en-common-misspellings": ^2.0.10 - "@cspell/dict-en-gb-mit": ^3.0.3 - "@cspell/dict-en_us": ^4.4.6 - "@cspell/dict-filetypes": ^3.0.12 - "@cspell/dict-flutter": ^1.1.0 - "@cspell/dict-fonts": ^4.0.4 - "@cspell/dict-fsharp": ^1.1.0 - "@cspell/dict-fullstack": ^3.2.6 - "@cspell/dict-gaming-terms": ^1.1.1 - "@cspell/dict-git": ^3.0.4 - "@cspell/dict-golang": ^6.0.20 - "@cspell/dict-google": ^1.0.8 - "@cspell/dict-haskell": ^4.0.5 - "@cspell/dict-html": ^4.0.11 - "@cspell/dict-html-symbol-entities": ^4.0.3 - "@cspell/dict-java": ^5.0.11 - "@cspell/dict-julia": ^1.1.0 - "@cspell/dict-k8s": ^1.0.10 - "@cspell/dict-kotlin": ^1.1.0 - "@cspell/dict-latex": ^4.0.3 - "@cspell/dict-lorem-ipsum": ^4.0.4 - "@cspell/dict-lua": ^4.0.7 - "@cspell/dict-makefile": ^1.0.4 - "@cspell/dict-markdown": ^2.0.10 - "@cspell/dict-monkeyc": ^1.0.10 - "@cspell/dict-node": ^5.0.7 - "@cspell/dict-npm": ^5.2.3 - "@cspell/dict-php": ^4.0.14 - "@cspell/dict-powershell": ^5.0.14 - "@cspell/dict-public-licenses": ^2.0.13 - "@cspell/dict-python": ^4.2.18 - "@cspell/dict-r": ^2.1.0 - "@cspell/dict-ruby": ^5.0.8 - "@cspell/dict-rust": ^4.0.11 - "@cspell/dict-scala": ^5.0.7 - "@cspell/dict-shell": ^1.1.0 - "@cspell/dict-software-terms": ^5.0.7 - "@cspell/dict-sql": ^2.2.0 - "@cspell/dict-svelte": ^1.0.6 - "@cspell/dict-swift": ^2.0.5 - "@cspell/dict-terraform": ^1.1.1 - "@cspell/dict-typescript": ^3.2.1 - "@cspell/dict-vue": ^3.0.4 - checksum: 7d1b4db97d35816958ddc8581b8f106e8542fc711e73f306f91382665b141aa20e24cca529c31e5126437e464c5bb61b22c6425a18f1a6ce2e058af482dfc7af - languageName: node - linkType: hard - -"@cspell/cspell-json-reporter@npm:9.0.0": - version: 9.0.0 - resolution: "@cspell/cspell-json-reporter@npm:9.0.0" +"@cspell/cspell-bundled-dicts@npm:9.2.0": + version: 9.2.0 + resolution: "@cspell/cspell-bundled-dicts@npm:9.2.0" + dependencies: + "@cspell/dict-ada": ^4.1.1 + "@cspell/dict-al": ^1.1.1 + "@cspell/dict-aws": ^4.0.12 + "@cspell/dict-bash": ^4.2.1 + "@cspell/dict-companies": ^3.2.2 + "@cspell/dict-cpp": ^6.0.9 + "@cspell/dict-cryptocurrencies": ^5.0.5 + "@cspell/dict-csharp": ^4.0.7 + "@cspell/dict-css": ^4.0.18 + "@cspell/dict-dart": ^2.3.1 + "@cspell/dict-data-science": ^2.0.9 + "@cspell/dict-django": ^4.1.5 + "@cspell/dict-docker": ^1.1.15 + "@cspell/dict-dotnet": ^5.0.10 + "@cspell/dict-elixir": ^4.0.8 + "@cspell/dict-en-common-misspellings": ^2.1.3 + "@cspell/dict-en-gb-mit": ^3.1.5 + "@cspell/dict-en_us": ^4.4.15 + "@cspell/dict-filetypes": ^3.0.13 + "@cspell/dict-flutter": ^1.1.1 + "@cspell/dict-fonts": ^4.0.5 + "@cspell/dict-fsharp": ^1.1.1 + "@cspell/dict-fullstack": ^3.2.7 + "@cspell/dict-gaming-terms": ^1.1.2 + "@cspell/dict-git": ^3.0.7 + "@cspell/dict-golang": ^6.0.23 + "@cspell/dict-google": ^1.0.9 + "@cspell/dict-haskell": ^4.0.6 + "@cspell/dict-html": ^4.0.12 + "@cspell/dict-html-symbol-entities": ^4.0.4 + "@cspell/dict-java": ^5.0.12 + "@cspell/dict-julia": ^1.1.1 + "@cspell/dict-k8s": ^1.0.12 + "@cspell/dict-kotlin": ^1.1.1 + "@cspell/dict-latex": ^4.0.4 + "@cspell/dict-lorem-ipsum": ^4.0.5 + "@cspell/dict-lua": ^4.0.8 + "@cspell/dict-makefile": ^1.0.5 + "@cspell/dict-markdown": ^2.0.12 + "@cspell/dict-monkeyc": ^1.0.11 + "@cspell/dict-node": ^5.0.8 + "@cspell/dict-npm": ^5.2.12 + "@cspell/dict-php": ^4.0.15 + "@cspell/dict-powershell": ^5.0.15 + "@cspell/dict-public-licenses": ^2.0.14 + "@cspell/dict-python": ^4.2.19 + "@cspell/dict-r": ^2.1.1 + "@cspell/dict-ruby": ^5.0.9 + "@cspell/dict-rust": ^4.0.12 + "@cspell/dict-scala": ^5.0.8 + "@cspell/dict-shell": ^1.1.1 + "@cspell/dict-software-terms": ^5.1.4 + "@cspell/dict-sql": ^2.2.1 + "@cspell/dict-svelte": ^1.0.7 + "@cspell/dict-swift": ^2.0.6 + "@cspell/dict-terraform": ^1.1.3 + "@cspell/dict-typescript": ^3.2.3 + "@cspell/dict-vue": ^3.0.5 + checksum: 82de44ecf01637f065f8a5db7fa947918f0d3758725bb8b4f26215219e9b4b5f36d9588432b4dd9bb211d23beb12048b58f02f31111e4a4bba2acca4d0c73099 + languageName: node + linkType: hard + +"@cspell/cspell-json-reporter@npm:9.2.0": + version: 9.2.0 + resolution: "@cspell/cspell-json-reporter@npm:9.2.0" + dependencies: + "@cspell/cspell-types": 9.2.0 + checksum: dd6b5e7184edd43e02e986416b6e6300b9fb987fdf6757fdada763115b1b7792181a5e976cdf16658f6dcad0ce6f2fd587ba93f96a2e6084fe0b8d96aba34d0b + languageName: node + linkType: hard + +"@cspell/cspell-pipe@npm:9.2.0": + version: 9.2.0 + resolution: "@cspell/cspell-pipe@npm:9.2.0" + checksum: fceb9b6d6df117d73bfcd08be9121ccb9828a27c1813651d6c24dcae8c89d467b24cba7df927b326c77a6b91b1bae8ec7a9558a6039335656be673132fee9469 + languageName: node + linkType: hard + +"@cspell/cspell-resolver@npm:9.2.0": + version: 9.2.0 + resolution: "@cspell/cspell-resolver@npm:9.2.0" dependencies: - "@cspell/cspell-types": 9.0.0 - checksum: 4cda5ab00e93f334de47eb0868a0fdc6509d7b173a7a7a48e182a4136591a8505bf24729c7aba1b9efa82432159450abd1fa4ac6103b727602c5372ad07140dd + global-directory: ^4.0.1 + checksum: 8435d5d8da9ac5e67f9365986e245083703d82f23f04256808e0283885857401d88481672061eba5192447ca0155cc2fbfd3ac324dd14102135fe327a753ea0f languageName: node linkType: hard -"@cspell/cspell-pipe@npm:9.0.0": - version: 9.0.0 - resolution: "@cspell/cspell-pipe@npm:9.0.0" - checksum: 38ec91fe75dcee18e1f19b7d5696468d7813568c269c4a7bfed6bfc943b7a2b618d81ca1cc6a5007f7e93edbcba09e8fa0bab8fee55f8f3d76879d40aec89d3b +"@cspell/cspell-service-bus@npm:9.2.0": + version: 9.2.0 + resolution: "@cspell/cspell-service-bus@npm:9.2.0" + checksum: 0e9e84319980cb02cbbb33786458dc923f2936f1a74276b6fee470361eea86c5d1c2e28a1408dbd0efa309a3d5a58350c6c9f18736cb8a1f684322841ea77950 languageName: node linkType: hard -"@cspell/cspell-resolver@npm:9.0.0": - version: 9.0.0 - resolution: "@cspell/cspell-resolver@npm:9.0.0" - dependencies: - global-directory: ^4.0.1 - checksum: af8d73d28ada52b38be4345dfe7aefac61ce68cda382f65b966f32c7f4ec418e7e7e1f52ac2cd771d9a26fbb042289567d80175c4a3a1359b7ac66ecda927717 +"@cspell/cspell-types@npm:9.2.0": + version: 9.2.0 + resolution: "@cspell/cspell-types@npm:9.2.0" + checksum: 7ed6fe3c2f5be94b8a2439fcfaaff4389253f5f5a300d38ca05ef5460841731baf3ed0c347af56984fa56d911e73cd484bdc3b796fe5634fb6b6f383c0b21ed4 languageName: node linkType: hard -"@cspell/cspell-service-bus@npm:9.0.0": - version: 9.0.0 - resolution: "@cspell/cspell-service-bus@npm:9.0.0" - checksum: 1c057012cadb1db1a2a168f8aa6c1b8436075cb7947069059c497a3c7241db1ec72a85a509f970faadaa86374ccfc90070f116abf191ea132fdf97c9086efaf4 +"@cspell/dict-ada@npm:^4.1.1": + version: 4.1.1 + resolution: "@cspell/dict-ada@npm:4.1.1" + checksum: 47be2954a30463947048caece4653008ca039903761b91703950a6c9f1f4d267cc4a49aa90b94415f029f49b2a38c591ad0b4b7e7bdc916977f0cfb0c777b2cd languageName: node linkType: hard -"@cspell/cspell-types@npm:9.0.0": - version: 9.0.0 - resolution: "@cspell/cspell-types@npm:9.0.0" - checksum: b3d2ce73ac503dd0c13778743dbf3eeb95dc9857a8a4c91bfd2f57c718058a3e220d9cf34f37b0d40034bfe1cb1b81ad6d22cc48fe46b992f605271aaf6f473b +"@cspell/dict-al@npm:^1.1.1": + version: 1.1.1 + resolution: "@cspell/dict-al@npm:1.1.1" + checksum: fff74e3cf3a69dcebb0ca3a3508c82aca81096813bfe13de8c689c17ed253ca044e84cc2bc7e8f9c9abda4c06e2c09a22b4b01d013a00353cdaa111a0c1ddb7f languageName: node linkType: hard -"@cspell/dict-ada@npm:^4.1.0": - version: 4.1.0 - resolution: "@cspell/dict-ada@npm:4.1.0" - checksum: 9e961e7e38b77a8abdb5df82b96e5e4619aedb662b22d971d4808252a1da7ef041c5e4e75ecc72ac9da9f36de8f461495a1f6dbeb751e903efa3626d571a0ddb +"@cspell/dict-aws@npm:^4.0.12": + version: 4.0.14 + resolution: "@cspell/dict-aws@npm:4.0.14" + checksum: 9c5cf416c8d17bebd7555bb450068582d47c803dff738f5a92d3457942da4ebf6ac6400359359aeaeacac86a270c7971979a0d03cfa9decf9262342a6a56bb97 languageName: node linkType: hard -"@cspell/dict-al@npm:^1.1.0": - version: 1.1.0 - resolution: "@cspell/dict-al@npm:1.1.0" - checksum: 219961cd60c91d43e20f6384df3d2d6b7b208fc6e9a34316e08826fe2ffd9890905d2a3b3fdbea28990989f22f1ddf094b3c635781089d9a04ee2d2b4023457d +"@cspell/dict-bash@npm:^4.2.1": + version: 4.2.1 + resolution: "@cspell/dict-bash@npm:4.2.1" + dependencies: + "@cspell/dict-shell": 1.1.1 + checksum: 607611fcbcc0609ddfb7afec91472876301346cd7dafe13d9afed653ef714cd2ac83d6d68e5218426edc135c085217ab1e0927654aa83b170cc1685248df4b80 languageName: node linkType: hard -"@cspell/dict-aws@npm:^4.0.10": - version: 4.0.10 - resolution: "@cspell/dict-aws@npm:4.0.10" - checksum: 01bb3b9f34a16688dcdbfccef1d7162d445f3edd8fd7deba823ed4346a8302d98799367b55f7de3e6dbb80218da7d75c442012552606b44dcc49ad52e013081c +"@cspell/dict-companies@npm:^3.2.2": + version: 3.2.4 + resolution: "@cspell/dict-companies@npm:3.2.4" + checksum: 7d7c1e0936f4000b5865d920e8d57e5d865d1d69c9acca8aac32d1d3fb118b772a6099f7c0e12b78db1aa9fc787b1a44a271757da37af8a6f569b6543f30e06d languageName: node linkType: hard -"@cspell/dict-bash@npm:^4.2.0": - version: 4.2.0 - resolution: "@cspell/dict-bash@npm:4.2.0" - dependencies: - "@cspell/dict-shell": 1.1.0 - checksum: 2a87ebb5f0b1140ceeab0991411ebfe03a05cebb296d30812a3e9f78cf0a56622484fbda5212d5811e59f1b1ca4dacae77341c1f3c0c5fc2efdb19393fddd766 +"@cspell/dict-cpp@npm:^6.0.9": + version: 6.0.9 + resolution: "@cspell/dict-cpp@npm:6.0.9" + checksum: 743bf1f12d8e70aebec525f648c657abe0bbad637c515ac27f16e3eee4ac258741cafd4997fe1021b1f9a14e1983bc91e7de38fe95b889675e317581b22b0b48 languageName: node linkType: hard -"@cspell/dict-companies@npm:^3.2.1": - version: 3.2.1 - resolution: "@cspell/dict-companies@npm:3.2.1" - checksum: 075b288d26058fc6048ecc3860feffff4f2b819ccca439b73e6e367bf56b166308b51180c0a519f8ca965f03caf5c3adab8becba30c3ab0ff641c2e3b14e79cc +"@cspell/dict-cryptocurrencies@npm:^5.0.5": + version: 5.0.5 + resolution: "@cspell/dict-cryptocurrencies@npm:5.0.5" + checksum: 93dd23accb42b384fc3153e1423d39f14f88d141f7eabdc68231785b2b352125cbab3a5b6ae2532d2007bf48d70f45887cf22873b5b4654766aa22e1b6fd97a0 languageName: node linkType: hard -"@cspell/dict-cpp@npm:^6.0.8": - version: 6.0.8 - resolution: "@cspell/dict-cpp@npm:6.0.8" - checksum: aaba5ce7e152f676ba4cc3ac02ce3cb32545e20412abad59cbb4a41419fcd8b7cdef72da86c3a47eb5c20b6960eb6499195b51d805d830c88dbf2d4bbe68109c +"@cspell/dict-csharp@npm:^4.0.7": + version: 4.0.7 + resolution: "@cspell/dict-csharp@npm:4.0.7" + checksum: bfc429fc40585905a1b8754eaf1c70fd59911250364bc8ec5f1ce81dfb38cfb27421a8ed4052d81b40832dfb26de8d4e63656a200c5a6459ad0fa9da8e8bb6ae languageName: node linkType: hard -"@cspell/dict-cryptocurrencies@npm:^5.0.4": - version: 5.0.4 - resolution: "@cspell/dict-cryptocurrencies@npm:5.0.4" - checksum: 54229c432f70320aa060c5c101a242e64f40f1f5b8404d1e2a5afc867e2f1cb862e1d84b3383c4bdfa3768302cca49f51bf8ea78c5509113b4a1e18ff00abfae +"@cspell/dict-css@npm:^4.0.18": + version: 4.0.18 + resolution: "@cspell/dict-css@npm:4.0.18" + checksum: 9c3ebe4d7c99068ea41a27b574d1d7fc5befc01dfdb82879b3dfa3457e07bef49975252ca80a1d4f0701ae038cae6fdb99306c1606d0e18ff0b93a5d8ad806ce languageName: node linkType: hard -"@cspell/dict-csharp@npm:^4.0.6": - version: 4.0.6 - resolution: "@cspell/dict-csharp@npm:4.0.6" - checksum: b86a3c0da979bbc9e0de9d4e9a83158190ac4bd454534ace3d2e48e4162eb1915e1f2f70e017e6df25eb3c017053d745897ad46a3c8d1357fdb4a2723e545154 +"@cspell/dict-dart@npm:^2.3.1": + version: 2.3.1 + resolution: "@cspell/dict-dart@npm:2.3.1" + checksum: 79764a0499a0267c34febc368ae8dfb47ebe58a79373e48070581a3a8095102a71e8cb88711b7dd431ca559d0d0554803ca2d53051e325903459a670f56c984f languageName: node linkType: hard -"@cspell/dict-css@npm:^4.0.17": - version: 4.0.17 - resolution: "@cspell/dict-css@npm:4.0.17" - checksum: 5ace777f44962b3a155a5194c17cfc81f79701d7e52fa626064902d33821f1f15e277a779355c08153aa7b8118178d96d6b004349492e630b94264070549492d +"@cspell/dict-data-science@npm:^2.0.9": + version: 2.0.9 + resolution: "@cspell/dict-data-science@npm:2.0.9" + checksum: f5c02e9be57093993e6764ac74c940003beaff67637bf69051f3a6c9c27fee9ed58e01b2f4134297aa75c1f4d24ca09d15f5e94b87b7f3dce05532dfbd6e030a languageName: node linkType: hard -"@cspell/dict-dart@npm:^2.3.0": - version: 2.3.0 - resolution: "@cspell/dict-dart@npm:2.3.0" - checksum: 9ae3c33585959bcdf2886bd2cbf81a05d36872d8d3a7bdfa72ab3c97549735abf9b82e1aa47c3590953a4621c0250b04fb1330b23d8030a1ae86ac3a6d68b26f +"@cspell/dict-django@npm:^4.1.5": + version: 4.1.5 + resolution: "@cspell/dict-django@npm:4.1.5" + checksum: 873d287d70f65070fddd9fa46ee8a48240f50d14c2f0cb141abd941524ac3223569e610e0e6c9fba5768d0f09d60b8b467ebb91411c49caf4e2f82625913d084 languageName: node linkType: hard -"@cspell/dict-data-science@npm:^2.0.8": - version: 2.0.8 - resolution: "@cspell/dict-data-science@npm:2.0.8" - checksum: bfafb9cf0892a207eb0aa00aac25a4c88387791530adf87e5d34ad6609c29ed250cceb0774ea126723310e16a2aacf31fa56992da0ceab6f7e40c6963905a8b0 +"@cspell/dict-docker@npm:^1.1.15": + version: 1.1.16 + resolution: "@cspell/dict-docker@npm:1.1.16" + checksum: dc126d94203fa23c0a9d1466fa634b1ee4b4770d5762dbbbc868198318cf8d860de26d1632700a3e613eb81d27d0e46c72cbf74ba0cca5cca0032dbf056ae472 languageName: node linkType: hard -"@cspell/dict-django@npm:^4.1.4": - version: 4.1.4 - resolution: "@cspell/dict-django@npm:4.1.4" - checksum: 70dca29f5dc7a774a4a64bc1ce70c677108cde6364520b58fab8ff0fb944632b024d5904339063a08a879a1b396b98d7e6a46ead18bf901b35651199ea0bbfe3 +"@cspell/dict-dotnet@npm:^5.0.10": + version: 5.0.10 + resolution: "@cspell/dict-dotnet@npm:5.0.10" + checksum: 9bb78164917a9e72a1f3f44dd3b00bb30b3daff618ba5b55588653a655b5dc2ae56c77c1dd250c74e8f534a9fa8d2c56f5552115ebca05955e4f012d58f9694e languageName: node linkType: hard -"@cspell/dict-docker@npm:^1.1.14": - version: 1.1.14 - resolution: "@cspell/dict-docker@npm:1.1.14" - checksum: 4eb96da9d9912bbbc8b3522ac58e5f65b77b72aa2e5b2bdffbc604b6ece9dedfa7a4643beb71ede9e15e78735f9c13ff705b7243872eaedb11a83f4f06a3d6cd +"@cspell/dict-elixir@npm:^4.0.8": + version: 4.0.8 + resolution: "@cspell/dict-elixir@npm:4.0.8" + checksum: fad21bd31eb5826b18fbf11a4ff7d9e600cb662c1c2f70306212d8a95bf76f50af1cd74ba880fbb0c813537bfe29477b8a52bc67a6c136557fd909713f0ca664 languageName: node linkType: hard -"@cspell/dict-dotnet@npm:^5.0.9": - version: 5.0.9 - resolution: "@cspell/dict-dotnet@npm:5.0.9" - checksum: 2fefb4593b2621cdf5bc3413aa364b788abc6a3693e629833d74c230a4fa7b7b2dd5c4245165231aedf59f75db29b081ecf15beb5a96c18242042298411ffcac +"@cspell/dict-en-common-misspellings@npm:^2.1.3": + version: 2.1.3 + resolution: "@cspell/dict-en-common-misspellings@npm:2.1.3" + checksum: af56e0bf00629fc1d9e1b81f3019facd85837db3de7df6ed9cd1838e81822d6545f5e74ccb27d157221ed1a08e12dfedaa404ee4f499f8faf80a90ab86860613 languageName: node linkType: hard -"@cspell/dict-elixir@npm:^4.0.7": - version: 4.0.7 - resolution: "@cspell/dict-elixir@npm:4.0.7" - checksum: c4b717617603eb6b0b9d3d785f4917b34d187fe1f97e4a65147907da440df2b0a878f6382b621914e3a40336d613d24f011fa17c32aab31ad7183e0f065d8721 +"@cspell/dict-en-gb-mit@npm:^3.1.5": + version: 3.1.6 + resolution: "@cspell/dict-en-gb-mit@npm:3.1.6" + checksum: cdfb51de8d344221b257b696f3d437beadd73b423129b3840f9b6ef6f7c37447bf71ce524f0716ec4052a15a7ad259f9cbd7e9c99ce11ba1bf413ea7d0694579 languageName: node linkType: hard -"@cspell/dict-en-common-misspellings@npm:^2.0.10": - version: 2.0.10 - resolution: "@cspell/dict-en-common-misspellings@npm:2.0.10" - checksum: 3307bb6740b024857a000e2226809c979db88251691a9706ddb72dd55d18b4bb376dabdbd0c466e8878f236b75cbe2c62cde3223abab8e56ae766944f2e0a5ce +"@cspell/dict-en_us@npm:^4.4.15": + version: 4.4.16 + resolution: "@cspell/dict-en_us@npm:4.4.16" + checksum: 2790f892d62f43ca9abe5a3b0b23b5688eef34f4359335cd4f9b2df7a309b4be1657f632a8a5fb3a49c4e477a30db3199457bd20c1b0b15e2267a41cd4b6fe34 languageName: node linkType: hard -"@cspell/dict-en-gb-mit@npm:^3.0.3": - version: 3.0.3 - resolution: "@cspell/dict-en-gb-mit@npm:3.0.3" - checksum: 5625de2615ac2be8c048dde8169ccbe5bb1c5fde531f77b8d8ff4d9031737db605aa089be264a86dcf7bd632a8d1a3643c5224b478cb0f32801d22ea136ac13b +"@cspell/dict-filetypes@npm:^3.0.13": + version: 3.0.13 + resolution: "@cspell/dict-filetypes@npm:3.0.13" + checksum: d8ffa9e72b82dc0ee8fc05440175c898d363552fa769b4b6cb5c5544f47bcbc50b4761a97c9b835e182aaade0ca86df64984058342e46f41a4225dfc45502b6c languageName: node linkType: hard -"@cspell/dict-en_us@npm:^4.4.6": - version: 4.4.6 - resolution: "@cspell/dict-en_us@npm:4.4.6" - checksum: defd5bd0799f7d32507083b4b411a903ad85ad154d9bbbb9006018edfcedd5da9d4ff41cda242692a39bf66109cad4374aabe29100940963e80ff241dab53724 +"@cspell/dict-flutter@npm:^1.1.1": + version: 1.1.1 + resolution: "@cspell/dict-flutter@npm:1.1.1" + checksum: 1ba1539d740093da234606ae3110498669ef230fbbfdc3c97ca5560008619ce8a757442846b594900a5d85d0a4e68263bf7f2d4949cab930361fa1056a237d3f languageName: node linkType: hard -"@cspell/dict-filetypes@npm:^3.0.12": - version: 3.0.12 - resolution: "@cspell/dict-filetypes@npm:3.0.12" - checksum: f60959e7b72e9a4d5e2cd0cffe80cf3335184d2a303a41aaef046905097deab627ed1e30a93b92040e1ddcb53e4bb24cd7c1547c4ae906ab1af2840d8d44d2f9 +"@cspell/dict-fonts@npm:^4.0.5": + version: 4.0.5 + resolution: "@cspell/dict-fonts@npm:4.0.5" + checksum: e7f1ae6bd64f93812ef849a0d8efaa7716127262bb47f54c2b600f7b15dc0e02c54b63fbb066150046b15acbedafe431b7504d1851b8e3c1083ae492ac3c228e languageName: node linkType: hard -"@cspell/dict-flutter@npm:^1.1.0": - version: 1.1.0 - resolution: "@cspell/dict-flutter@npm:1.1.0" - checksum: b8944d7c91b8617727dcca2191e2bdea4e97a3c2e76e6b8e015805f31dac99040da8ef74035c917c77646dfb19f1efe916d51e5171c54209850daf4be0db046c +"@cspell/dict-fsharp@npm:^1.1.1": + version: 1.1.1 + resolution: "@cspell/dict-fsharp@npm:1.1.1" + checksum: f83b49083cfa6101ebb5bef67f3128c5c14f7d5005d6981e41c4a317bebaa5672431fcb0699b3f345c69057921b2b59bc34721ce5a63b481b4f6300ca7f77868 languageName: node linkType: hard -"@cspell/dict-fonts@npm:^4.0.4": - version: 4.0.4 - resolution: "@cspell/dict-fonts@npm:4.0.4" - checksum: a339339f80c40256d53a7ca4c85f58e31b8d32c9dc2b25564f45c11e258da2435933e00b52066ee8543ff3e12469d8e2ab6a3d7b1684850c2f1c4c58d9d9a239 +"@cspell/dict-fullstack@npm:^3.2.7": + version: 3.2.7 + resolution: "@cspell/dict-fullstack@npm:3.2.7" + checksum: 2743f2d07f8336e18c0a18a2f8e274d97b50122bfcaa5d536ba78cfdde41fc894eb7e42fe7474692a34a61a39afe8e7a818bb9a5586e1b721e660751f444cf39 languageName: node linkType: hard -"@cspell/dict-fsharp@npm:^1.1.0": - version: 1.1.0 - resolution: "@cspell/dict-fsharp@npm:1.1.0" - checksum: 2f667bc9ef55034a603147404f9e55a29b68210acd84938695404d12ede34a060202d109a8c2deada5c863b75b8b5946c2f74e583be18c2e9727423563d914db +"@cspell/dict-gaming-terms@npm:^1.1.2": + version: 1.1.2 + resolution: "@cspell/dict-gaming-terms@npm:1.1.2" + checksum: 023a2f819dfdeddf879e7fb4b68a1db9728da1aa1a87e14f2b08f624c28d0915d2722d2a46f7ad8cbc32c7be0e42966ad6192f6c75e0f2053a9a15fc95fa34af languageName: node linkType: hard -"@cspell/dict-fullstack@npm:^3.2.6": - version: 3.2.6 - resolution: "@cspell/dict-fullstack@npm:3.2.6" - checksum: 10d562bf2126a660542a2e82f684240791a9064e50b4de8150f9e3d478791314e41422e3fee2e38596154e71dd963ca4088f2c730575b5959d758c27186c2c67 +"@cspell/dict-git@npm:^3.0.7": + version: 3.0.7 + resolution: "@cspell/dict-git@npm:3.0.7" + checksum: bf88770be43c1bd4c2bea6737edd20939a78b7c0e9ff28e06490394f056637a27f49a6716e0f6ed845eaf2fc1afa85d4bd7cfafb56e3d4dfeb491b49669fd376 languageName: node linkType: hard -"@cspell/dict-gaming-terms@npm:^1.1.1": - version: 1.1.1 - resolution: "@cspell/dict-gaming-terms@npm:1.1.1" - checksum: 9ca5a3b319924a4dd0eb53aeaa691cf2002c58a990c981a87ddbc64b0b95d1145b1b0aafca749f25f2bc0e2071efa95fe623ea17f587a79b2399da444abfce91 +"@cspell/dict-golang@npm:^6.0.23": + version: 6.0.23 + resolution: "@cspell/dict-golang@npm:6.0.23" + checksum: 0cdfe3ed9245b9e0d5a26c72371b38dca86d4de7e016dc37e499ea98147626184c211dd4dd9efe3a533444391ce45259783d640ef8f2daf7d75c964ba53ab697 languageName: node linkType: hard -"@cspell/dict-git@npm:^3.0.4": - version: 3.0.4 - resolution: "@cspell/dict-git@npm:3.0.4" - checksum: 23519344e5873acbae47fbc60b3cbdf60ff350ea1dc09518f5b66605cd7409d854cd692127243e9d6912503cd644307e9c7ccbb0730becd9871fa52ce0f7c3b6 +"@cspell/dict-google@npm:^1.0.9": + version: 1.0.9 + resolution: "@cspell/dict-google@npm:1.0.9" + checksum: 61a0ed9ca85151163aaf95f866b2fd53b21edb585c082f38bc81e7db839b3c6bb7f69c82da490c53f7d06099783cc88e4591e1c17416f200d6cf5e73e6b827da languageName: node linkType: hard -"@cspell/dict-golang@npm:^6.0.20": - version: 6.0.20 - resolution: "@cspell/dict-golang@npm:6.0.20" - checksum: cf8e459deef3a137676103cb460cdcc5de8b5d6695b8b6f2761b8d8a7aceef262e1d6c5b5eb052740900c92e7c42059a27696ac0b42714d6360ab07a590d996f +"@cspell/dict-haskell@npm:^4.0.6": + version: 4.0.6 + resolution: "@cspell/dict-haskell@npm:4.0.6" + checksum: 510ce26a6d34dfa829278a59bedea4c4712b3a0c9430f19b7101597f0a9f26302dd6266a6ab938bfc2d67d08a04148beda68bfcd0589d1c990075a21d52816de languageName: node linkType: hard -"@cspell/dict-google@npm:^1.0.8": - version: 1.0.8 - resolution: "@cspell/dict-google@npm:1.0.8" - checksum: ca6def5dd777e9a23e0236c134abbe800e6d1df3721512147ca30516bc097d6b7ddbe0e9f351c1cf85b4ca11ab7148686cc20c3f24e9f82984dc98e698a13401 +"@cspell/dict-html-symbol-entities@npm:^4.0.4": + version: 4.0.4 + resolution: "@cspell/dict-html-symbol-entities@npm:4.0.4" + checksum: 1898fc84496526e9c54e125369f3c87412839aee3e00da8aee3fee1c1165d4f2e7944833398b08f07ee58e817999af462f254e9ce06b06323fd665cbe6d01a3e languageName: node linkType: hard -"@cspell/dict-haskell@npm:^4.0.5": - version: 4.0.5 - resolution: "@cspell/dict-haskell@npm:4.0.5" - checksum: 4f663d904c17f760e10f457669665e2a4c205ef27389e82e61b4017c1bfd1e446db7401ee5fcca74a9441135ae17130e8f92601bdd6b0837850f0636ea170088 +"@cspell/dict-html@npm:^4.0.12": + version: 4.0.12 + resolution: "@cspell/dict-html@npm:4.0.12" + checksum: 5441fa727bf6fc49039c9051d40b8fe4c05712f5a21cfa267affb0537f02400ffd23dff12a4bff69702996d1038c331f13a2071ebcf1235b1a5679ae2c527d0b languageName: node linkType: hard -"@cspell/dict-html-symbol-entities@npm:^4.0.3": - version: 4.0.3 - resolution: "@cspell/dict-html-symbol-entities@npm:4.0.3" - checksum: 0cef821bf2400a3f8b0d3c94eb8c5de531cbf3ed409d95faf5aaa7f272774ab1e6fa0f315c0902cc661d81bf52075f134b7687bec9c9f1184d176517b3781671 +"@cspell/dict-java@npm:^5.0.12": + version: 5.0.12 + resolution: "@cspell/dict-java@npm:5.0.12" + checksum: bcbb2b92aa2c2703db5a2de8990733dbcf4c0febefc9e438f4c71677298806c46ed9bdaab61533b4c8665c82441cbb7a740e124128a346c13d8d9fd48d67599d languageName: node linkType: hard -"@cspell/dict-html@npm:^4.0.11": - version: 4.0.11 - resolution: "@cspell/dict-html@npm:4.0.11" - checksum: b3e5b17c3e3d014b79c324fbe297ed24043695c6defe2d9359d3fde2430b035e916c107b63c8b76ba579a61045b0cd5fe2e856288b70d9b5f5db955a91ce55ea +"@cspell/dict-julia@npm:^1.1.1": + version: 1.1.1 + resolution: "@cspell/dict-julia@npm:1.1.1" + checksum: 1dac60ea3a13dfaef5670812a8fd2e224225e9ca595a18a8b886eb29c86adc0645e234931af8a0110a4a5c08706e3c42c69b15f3e253c4305332268cfa414f36 languageName: node linkType: hard -"@cspell/dict-java@npm:^5.0.11": - version: 5.0.11 - resolution: "@cspell/dict-java@npm:5.0.11" - checksum: 0fa2f3ae5c9e9d61c38d550cc55c933f6e75ef4a340c9fcc39ce99ce0844121dc2cdc8436f4e53707eb7aff6a43693766e47d6aa127800bf986c5de143e8bb30 +"@cspell/dict-k8s@npm:^1.0.12": + version: 1.0.12 + resolution: "@cspell/dict-k8s@npm:1.0.12" + checksum: 742e068d64e83ce9948b1551e400a99d642fc8d83992736235769ee6d3ebc5af838a99d9ed435544a31d31e0a54a190aa442cc41abad80e896917ee1277e577d languageName: node linkType: hard -"@cspell/dict-julia@npm:^1.1.0": - version: 1.1.0 - resolution: "@cspell/dict-julia@npm:1.1.0" - checksum: 2a978c8ffdd98339c45ed666818a65a367f4af3190fa7ea807a37f55bc8a9b41b19d707b6e7b438f58faaa4e29444f871a1c8df5af546f77303ba7fc2d0f4d78 +"@cspell/dict-kotlin@npm:^1.1.1": + version: 1.1.1 + resolution: "@cspell/dict-kotlin@npm:1.1.1" + checksum: 8822138c76a1f6bb54ec33e470fbd403086a20532101bd9adf4e59464772266da0e379758a490d9ab87a9e0b89ca13e968f48f71334dd0b6881b4ab05bf6cc9d languageName: node linkType: hard -"@cspell/dict-k8s@npm:^1.0.10": - version: 1.0.10 - resolution: "@cspell/dict-k8s@npm:1.0.10" - checksum: 7cc4eb5f9de33b956ab8203a020cd3322d9107b1732069afc77a54ceb3c7fcfc9ea9de4cc28ac14670f36d78278afd749292e64f2642a2d96f7cea11eea0ffa7 +"@cspell/dict-latex@npm:^4.0.4": + version: 4.0.4 + resolution: "@cspell/dict-latex@npm:4.0.4" + checksum: bca63e4a3fa1137d40892f0bbc05db12be3f99ea482f2b9d46db4119be040e9a0462c3c71515319d97fe728243d85a51ab15430f2914ec9d41de4ebc23eac0a1 languageName: node linkType: hard -"@cspell/dict-kotlin@npm:^1.1.0": - version: 1.1.0 - resolution: "@cspell/dict-kotlin@npm:1.1.0" - checksum: 6127b64037e9c4f0be49fd9be3435c999361001cf52dcf6f47f0467add55df4ca95c0a0056b4bfdcdd1363132892087a30475a664e2176bc487311346a22474e +"@cspell/dict-lorem-ipsum@npm:^4.0.5": + version: 4.0.5 + resolution: "@cspell/dict-lorem-ipsum@npm:4.0.5" + checksum: 7f4be03a7d2bfe9128f4f7d1f04b5cf5d525db2ffa86f1c3ca9ae7b2ccd774cd56dee9ede23d0291c502e365d7de925f5bf210ab4b5b745b0459fce13fd38820 languageName: node linkType: hard -"@cspell/dict-latex@npm:^4.0.3": - version: 4.0.3 - resolution: "@cspell/dict-latex@npm:4.0.3" - checksum: 948f74d411d76dea1180e66576ce6297cf520fe7eea12b6fce46f07844229750917e42c538929d8be62d04e1ff4cbeeb7c770999327f179cfeef68eb373d3586 +"@cspell/dict-lua@npm:^4.0.8": + version: 4.0.8 + resolution: "@cspell/dict-lua@npm:4.0.8" + checksum: 3e0255147637c2df83e5eea7da70e5ccddd0be873123c79da1f12b9f590b1e516a27448be3cba31529ffdea769a5de866caa5d55f9d9a49026f0ceacebd9b3ba languageName: node linkType: hard -"@cspell/dict-lorem-ipsum@npm:^4.0.4": - version: 4.0.4 - resolution: "@cspell/dict-lorem-ipsum@npm:4.0.4" - checksum: f75cca35d89aa407a21875b2c58b5c959c0a06aed1aaea4a8b91a7e42e3d83ae1604a735e184cc7b4b3c294189013be5f46888ee46526284f99b21da391a8ef6 +"@cspell/dict-makefile@npm:^1.0.5": + version: 1.0.5 + resolution: "@cspell/dict-makefile@npm:1.0.5" + checksum: bde75e635750234aa4e47e6904c5c5ffd9ede4c503daa015b085830414edf40860cfdbd04b1aa81b7b433f11abaab7d244093ba667e1124e7595777cc5dccf96 languageName: node linkType: hard -"@cspell/dict-lua@npm:^4.0.7": - version: 4.0.7 - resolution: "@cspell/dict-lua@npm:4.0.7" - checksum: ef1ad0f059f5e2c99e6741633c75ed59640bd4c3b421c8c7af124facafc9c4ecb578e1bfe2a180d63e0063c508dec31db2615a864744c2737ed0d47fa4daaaad +"@cspell/dict-markdown@npm:^2.0.12": + version: 2.0.12 + resolution: "@cspell/dict-markdown@npm:2.0.12" + peerDependencies: + "@cspell/dict-css": ^4.0.18 + "@cspell/dict-html": ^4.0.12 + "@cspell/dict-html-symbol-entities": ^4.0.4 + "@cspell/dict-typescript": ^3.2.3 + checksum: 20f9510b808a2b394ebae83257569c76ce23883f3902e32ffea5ef83d645052b7fba500e2c4ab96e669c93c250158327330a34453657bf2b6162e9d303148c44 languageName: node linkType: hard -"@cspell/dict-makefile@npm:^1.0.4": - version: 1.0.4 - resolution: "@cspell/dict-makefile@npm:1.0.4" - checksum: 1aece9d61e21aabaad8cd8048f7647739d6a48ab532b4637b72b53d4360dc6780dc4be35a14de541a3dd05b076efd9f106af83fa0e7ca3ae149c86143a72b96b +"@cspell/dict-monkeyc@npm:^1.0.11": + version: 1.0.11 + resolution: "@cspell/dict-monkeyc@npm:1.0.11" + checksum: 6e896fd9596261ece639cdad4d03291f4faf92ed27d9257aae1f34f075b13a865287734d170a2e9ea228ac2b7de03eaaec795284b945c8a96ac24684ad56ba7a languageName: node linkType: hard -"@cspell/dict-markdown@npm:^2.0.10": - version: 2.0.10 - resolution: "@cspell/dict-markdown@npm:2.0.10" - peerDependencies: - "@cspell/dict-css": ^4.0.17 - "@cspell/dict-html": ^4.0.11 - "@cspell/dict-html-symbol-entities": ^4.0.3 - "@cspell/dict-typescript": ^3.2.1 - checksum: a43a64a7c44c92572142ce5bb9efa08d4303d9e54e7141d46aa238e7b105fb022adba840ec7facbdb7d9f195a344793e98a16553c3070ef6b0f0916430814abb +"@cspell/dict-node@npm:^5.0.8": + version: 5.0.8 + resolution: "@cspell/dict-node@npm:5.0.8" + checksum: 0f6e09a50b432386a09d79ebdfa7d6281279fc8c1ce5bdb6e3f6939a38265ffa2899b57811c3673d0aa31187f57eee9c7bfbf059a2b1d1d6d98f5e4495fcdf93 languageName: node linkType: hard -"@cspell/dict-monkeyc@npm:^1.0.10": - version: 1.0.10 - resolution: "@cspell/dict-monkeyc@npm:1.0.10" - checksum: 670443bfc5be5d69a5b4bc22330191f586bbfd29220c00d69473eea4f2c0c94321b42d83c74e98fde6fc0fe4e933425dcffa2941b62111326b50effd101fb2d7 +"@cspell/dict-npm@npm:^5.2.12": + version: 5.2.14 + resolution: "@cspell/dict-npm@npm:5.2.14" + checksum: 59ef1f0d0f1401246d0b2824bb8ff3fa494ceecbd7cf085d56136af9de74fe0d9bc3f209b2e423ad7490db86f9be5e09a6711905c59ebdf961b413b48d22c9fb languageName: node linkType: hard -"@cspell/dict-node@npm:^5.0.7": - version: 5.0.7 - resolution: "@cspell/dict-node@npm:5.0.7" - checksum: 14d4dbec893a57d2c25478ea5a9b649576f9f67a7de7dac93f82b80142c10eba5bca8c6b9608ff167d54a3086f24342398a3dc952e2180adfdf0406ebd5f6c05 +"@cspell/dict-php@npm:^4.0.15": + version: 4.0.15 + resolution: "@cspell/dict-php@npm:4.0.15" + checksum: 45c25abae5262d2acf03d79914ee6bd82e80fe60c36d6e39b6a403575b5ca902e07a7737f87816d146135cabf2df56262a5fd8ec6dedb573504f116a627e3f83 languageName: node linkType: hard -"@cspell/dict-npm@npm:^5.2.3": - version: 5.2.3 - resolution: "@cspell/dict-npm@npm:5.2.3" - checksum: 86beecc3e409ed8d2f977bfc9d9341f8b6764ca9dba6c342d1c25b9948c90accc757f24b6da955eaeddd104a6493f087271fb4e4ce298074ff511d82d2401402 +"@cspell/dict-powershell@npm:^5.0.15": + version: 5.0.15 + resolution: "@cspell/dict-powershell@npm:5.0.15" + checksum: 3e46e0e98d92e42d34eb297d6e1626bea15e4ad6774b3f855f07e02aa1f458e9e77ae33602a0ed604f8009a2b842d4fffe5a2ee6b9884c2b63b45799003120b9 languageName: node linkType: hard -"@cspell/dict-php@npm:^4.0.14": - version: 4.0.14 - resolution: "@cspell/dict-php@npm:4.0.14" - checksum: b079e928c00e187cd1ac242ab3ff88a09d12f726ee590d01205c829c417c1c6803e3453ce3174546c25e66aef8c4512e46b3ea55a1f907e684f9a5488a454204 +"@cspell/dict-public-licenses@npm:^2.0.14": + version: 2.0.15 + resolution: "@cspell/dict-public-licenses@npm:2.0.15" + checksum: a8580441c964a8c3ce4c4fed74189fa5752eb98e56baeb2608753e4deefb202c8f9d9f1869e17c5f2f1fc7bb1976854525ac50750109bb377b4cfa0a4eb12fe2 languageName: node linkType: hard -"@cspell/dict-powershell@npm:^5.0.14": - version: 5.0.14 - resolution: "@cspell/dict-powershell@npm:5.0.14" - checksum: 7d527250933e8597ee2b694e70d7abf094b3ba5a2058b37934423cb2cb13384f7d79ca660ff723bea2c80390d5a30948e065369bfd2de1cc4281172b703d711f +"@cspell/dict-python@npm:^4.2.19": + version: 4.2.19 + resolution: "@cspell/dict-python@npm:4.2.19" + dependencies: + "@cspell/dict-data-science": ^2.0.9 + checksum: b46d9d608bc57a0e0564c052290309604ddcd9b9b764d77b70d29860c89e76e548bd9d97553fd34ac7af635c393908be2d16b2e5743f70b1b180b51b3116926b languageName: node linkType: hard -"@cspell/dict-public-licenses@npm:^2.0.13": - version: 2.0.13 - resolution: "@cspell/dict-public-licenses@npm:2.0.13" - checksum: f3aee5da76fca275c139a4a08b46cbfcb41e14cfb2c0933e413b2b3ef116f0421b34f8bd478d6fae69b199ea19ab3f46353c9aae4231492169fdf09823bcba32 +"@cspell/dict-r@npm:^2.1.1": + version: 2.1.1 + resolution: "@cspell/dict-r@npm:2.1.1" + checksum: 70ac0a26fdd753633e2e1817f3ac0c475a5a0d92641ce2032fd5745d8fe32ca9f1d87b6d1318302b87e8a699229f2593db75f9618d0bdfb7809f0b331516efbf languageName: node linkType: hard -"@cspell/dict-python@npm:^4.2.18": - version: 4.2.18 - resolution: "@cspell/dict-python@npm:4.2.18" - dependencies: - "@cspell/dict-data-science": ^2.0.8 - checksum: aaef8f52f7d805956748cf82c07bb99f39f2bfdf87b652b76546a8f87aba9b395f3943a7630a30c4605e7220e437be70dc0023842f6d646b79a9037a047ca9fd +"@cspell/dict-ruby@npm:^5.0.9": + version: 5.0.9 + resolution: "@cspell/dict-ruby@npm:5.0.9" + checksum: 57a752ff19f9484a042e859254eb6d487b46266f374faeb17e257b3583d94fbd908c0bd308e2a7d3b0169839cdd5a6d9fc12563955b69f26e8667acc43fbfd53 languageName: node linkType: hard -"@cspell/dict-r@npm:^2.1.0": - version: 2.1.0 - resolution: "@cspell/dict-r@npm:2.1.0" - checksum: 5ba48ac82578feade56196fa6c236a2bbea5555ce9cade2966a0c2bbd676b37aeac06556079ca7a306189ff8e9f811ca4c1b01c58ddbcdda447a9434277792c9 +"@cspell/dict-rust@npm:^4.0.12": + version: 4.0.12 + resolution: "@cspell/dict-rust@npm:4.0.12" + checksum: ba928f5538e09887f715713a6899d09ed7b1663c85d33c766adbaf22a95e01fa71d3736d5ff17c3c0f0a387c43756702fb1529e62e714ddec0df6cde9617ad20 languageName: node linkType: hard -"@cspell/dict-ruby@npm:^5.0.8": +"@cspell/dict-scala@npm:^5.0.8": version: 5.0.8 - resolution: "@cspell/dict-ruby@npm:5.0.8" - checksum: 62734eb3a5178e6dee5feeff8e4a59b8da42e64f895191e765a2ec134c9da54480967e355766ee4440f5a912eecdfb37d97c377351c526fab7a07bc38a03659f + resolution: "@cspell/dict-scala@npm:5.0.8" + checksum: f105f3fe9bca5bdeb71fcb0050ebd7a1156f321d21e0d67d428ea4d285d378d0d0b4911e407796676eb49ac39b38075fcf64eec6169caf0e242cec111c3924cd languageName: node linkType: hard -"@cspell/dict-rust@npm:^4.0.11": - version: 4.0.11 - resolution: "@cspell/dict-rust@npm:4.0.11" - checksum: e336ad35129660bfde98efa9498a0b7237374ee9026baf7366a52f73f5c1a85cd0ed9dffcead7af2350155456ba8f1157d63dd17061a6187d1eabedaf33372ef +"@cspell/dict-shell@npm:1.1.1, @cspell/dict-shell@npm:^1.1.1": + version: 1.1.1 + resolution: "@cspell/dict-shell@npm:1.1.1" + checksum: 4fdd6c2fb623b3a72f4e46bfc55113799fbe79141bbbc85384cc1b0e9ae7699d2bbedbfc2749dd8bad977da856f0dda10c5e08fedf3d0822a2eccfeee9e4116c languageName: node linkType: hard -"@cspell/dict-scala@npm:^5.0.7": - version: 5.0.7 - resolution: "@cspell/dict-scala@npm:5.0.7" - checksum: 2eed66e8fc079995c5c7d47ce81e02b2a0312a33aa941253c727cf2ee3da8e43efc335b995f497277b919293545d8b9f71bc3181dfa694cacd9ebe79b5312cf0 +"@cspell/dict-software-terms@npm:^5.1.4": + version: 5.1.5 + resolution: "@cspell/dict-software-terms@npm:5.1.5" + checksum: 8aa3a101f7656bde09d301bcb1a4a620aeaa38eb8ff8fe65d64198e11e6857d8eb7265414f4084177941385a601f72794154fec66fbeff272ecbca891642861e languageName: node linkType: hard -"@cspell/dict-shell@npm:1.1.0, @cspell/dict-shell@npm:^1.1.0": - version: 1.1.0 - resolution: "@cspell/dict-shell@npm:1.1.0" - checksum: bb583a25cc955d89b7f0523fa46cd10b5ac0f3395addb2592f59e7e2fdfa03df4c3eb485c4c36fd79d58578711e083ea22f8ab794a4deb9ae31a186eef959eb0 +"@cspell/dict-sql@npm:^2.2.1": + version: 2.2.1 + resolution: "@cspell/dict-sql@npm:2.2.1" + checksum: c898c8f23e613ad1708dd92a8fbe5dac10e048ae8584a42c570697046c8841aa0518e10435fff34b9bdc84bb0cfd6a5307c990ed16f36253a0f2c31f739d3dce languageName: node linkType: hard -"@cspell/dict-software-terms@npm:^5.0.7": - version: 5.0.7 - resolution: "@cspell/dict-software-terms@npm:5.0.7" - checksum: 1b64c5fe8f70b239afa604537505ff129f88f15c023f240afbb8763614117cbc7073edeeb1aa48b8e0b249b3a79afdebab9c75e68b72eab33fce88a77ee5378f +"@cspell/dict-svelte@npm:^1.0.7": + version: 1.0.7 + resolution: "@cspell/dict-svelte@npm:1.0.7" + checksum: ca739512b762731f7840243e0833bd135328cbef529d07803bc7b49a2452b1592ed318b80e55bb38caf807d51dd949029c7586a80529c6b942ce6a33842ca586 languageName: node linkType: hard -"@cspell/dict-sql@npm:^2.2.0": - version: 2.2.0 - resolution: "@cspell/dict-sql@npm:2.2.0" - checksum: 46a02b2a8086802aaf5b81d7570c56a73f4bbb59ffc97823c41041521a33d85d6f0b065753bbc11776f670fc98846c28ee9496cb03c79f0b87f361f9ffd3c03d +"@cspell/dict-swift@npm:^2.0.6": + version: 2.0.6 + resolution: "@cspell/dict-swift@npm:2.0.6" + checksum: 89ba40dcc7b54cc1af07560b69a9418a8c8c275da9cf64e0cf94e1052930bf360706575db59eb3237c8210073fa0ff87511012958d355f67ff3735138782f26d languageName: node linkType: hard -"@cspell/dict-svelte@npm:^1.0.6": - version: 1.0.6 - resolution: "@cspell/dict-svelte@npm:1.0.6" - checksum: b6c4fb7738cc3070d3d6aa843e9a0ef9783a8e64368d0d4e0689e4680f6640760feb03db6c20e3a997d72381938cf669359e1d2730a1d14a6daa014c324ad160 +"@cspell/dict-terraform@npm:^1.1.3": + version: 1.1.3 + resolution: "@cspell/dict-terraform@npm:1.1.3" + checksum: d815557fde66895e14c6e9408dbcb17f46e4d56fd6c75f74fac48d5b4425f05fd9a60b8e874e2192e908e20f01ead382352842f4326355f7adf096dc23f8eaf7 languageName: node linkType: hard -"@cspell/dict-swift@npm:^2.0.5": - version: 2.0.5 - resolution: "@cspell/dict-swift@npm:2.0.5" - checksum: 09c84f12840f1ef000c0a775ba94ee49e7726d552744be4f21000a8fd45ac7608d4142f8cd9e28a111ac9afd0c0a657183cad35ff899178c02254c27593c3704 +"@cspell/dict-typescript@npm:^3.2.3": + version: 3.2.3 + resolution: "@cspell/dict-typescript@npm:3.2.3" + checksum: bd797308fd117737ca2be8c33c81603ffd948466782fdca1eaf0bf0a665673b0addfdf207d25e3e814f995399e3b5628048d4bea25bc652e37931003f0e785cb languageName: node linkType: hard -"@cspell/dict-terraform@npm:^1.1.1": - version: 1.1.1 - resolution: "@cspell/dict-terraform@npm:1.1.1" - checksum: 0843bbb0e3142caa6f878bde7850683913ffc7501a7c468ba6c0ff14e98c6938c86da04d1ed9a4be161b5b0a22d16bdc7947aa2a02b6e0268939defb9ae96529 +"@cspell/dict-vue@npm:^3.0.5": + version: 3.0.5 + resolution: "@cspell/dict-vue@npm:3.0.5" + checksum: 3288b44c0362d5a67a090ebe667fba577c32c422090ba8935cf7c994e0444495eafeb1be8cc64cc4f2e23788794f70a85b243ba924c6d73ca5a734a21f978cbc languageName: node linkType: hard -"@cspell/dict-typescript@npm:^3.2.1": - version: 3.2.1 - resolution: "@cspell/dict-typescript@npm:3.2.1" - checksum: 41eee4fca447c87fe261901975e270df04d803d7188057769c4fbd0c42c00d9cee6581f51f688cd9b6972d9a1d86dc4679535f828198db6c638c9a25eb85cad4 +"@cspell/dynamic-import@npm:9.2.0": + version: 9.2.0 + resolution: "@cspell/dynamic-import@npm:9.2.0" + dependencies: + "@cspell/url": 9.2.0 + import-meta-resolve: ^4.1.0 + checksum: 2f0e9c4a351021be52baea297f6f4ff734a37e47bdd50b283e77028a49b4e0e0302b75fd78c1954426ceb7e4a37ed71284160c83aedc703e5ac1891d80fc36d5 languageName: node linkType: hard -"@cspell/dict-vue@npm:^3.0.4": - version: 3.0.4 - resolution: "@cspell/dict-vue@npm:3.0.4" - checksum: 53904dcaf74ac5e20814ebc2aa484ad6cc607091312c8eeaefb81ada060869c20625accda5e35939e53c148261c67c4129f859fbf50da28cfa5b30d70290ee15 +"@cspell/filetypes@npm:9.2.0": + version: 9.2.0 + resolution: "@cspell/filetypes@npm:9.2.0" + checksum: 631ace9f62085ad8178499f0045d16da7314068e45d126f91ec6f28a54f8638413a45e6162f301a190dd62127090a3057c3424b2af248a247a3db47f43ef36d8 languageName: node linkType: hard -"@cspell/dynamic-import@npm:9.0.0": - version: 9.0.0 - resolution: "@cspell/dynamic-import@npm:9.0.0" - dependencies: - "@cspell/url": 9.0.0 - import-meta-resolve: ^4.1.0 - checksum: 62814274f366171211650dd01df8d696751dff6dd206044cd6b28d508a02570365191fa9bf0e54d77a5820f85062178951d9c0ea1c9907359292fd03cf7e5c7b +"@cspell/strong-weak-map@npm:9.2.0": + version: 9.2.0 + resolution: "@cspell/strong-weak-map@npm:9.2.0" + checksum: 3a9faecdc164d425a65e7a0ea4e6847feab537056b6d8b1506d14b1363f35390d866412f14cdbb066b26cc2acafd8fe55d7969e3b2b6e46fffc58485b18616c8 languageName: node linkType: hard -"@cspell/filetypes@npm:9.0.0": - version: 9.0.0 - resolution: "@cspell/filetypes@npm:9.0.0" - checksum: 64ae36179086f1a750242dd0a0563f959f828ee6946708df5e7ba3c9808a5b57efbfaad58f67170c9df9014af19056570c6f7f54be832b91b4381dcd0e0f93c7 +"@cspell/url@npm:9.2.0": + version: 9.2.0 + resolution: "@cspell/url@npm:9.2.0" + checksum: 0dc83ea7e51458f4065083bc65316b822bf6db644ad91ad88bb6693738b521ccece7cb56f71358e50794a9506ac753d958add96b935777d28cda5952dbaaaec3 languageName: node linkType: hard -"@cspell/strong-weak-map@npm:9.0.0": - version: 9.0.0 - resolution: "@cspell/strong-weak-map@npm:9.0.0" - checksum: 939805cab278ed577af94f7a404b5cdbc2941ff6a7c047d7f8617c0acee03a15513c068786a103a17dfbf509e8a5fd368727a2cf0a94b49b716240e4db343f83 +"@csstools/cascade-layer-name-parser@npm:^2.0.5": + version: 2.0.5 + resolution: "@csstools/cascade-layer-name-parser@npm:2.0.5" + peerDependencies: + "@csstools/css-parser-algorithms": ^3.0.5 + "@csstools/css-tokenizer": ^3.0.4 + checksum: fb26ae1db6f7a71ee0c3fdaea89f5325f88d7a0b2505fcf4b75e94f2c816ef1edb2961eecbc397df06f67d696ccc6bc99588ea9ee07dd7632bf10febf6b67ed9 languageName: node linkType: hard -"@cspell/url@npm:9.0.0": - version: 9.0.0 - resolution: "@cspell/url@npm:9.0.0" - checksum: 05d603585092d40b426076a03ffbbe72eb053513b44340cfabb42dade1243e4e00d1675a91e33103688605a1e13527af8ac63e0e52f06ed6ed334529272eec9f +"@csstools/color-helpers@npm:^5.0.2": + version: 5.0.2 + resolution: "@csstools/color-helpers@npm:5.0.2" + checksum: 76753f9823579af959630be5f7682e1abe5ae13b75621532927cfc1ff601cc1e31b78547fe387699980820bb7353e20e8cab258fab590aac9d19aa44984283d5 languageName: node linkType: hard -"@csstools/css-parser-algorithms@npm:^3.0.4": - version: 3.0.4 - resolution: "@csstools/css-parser-algorithms@npm:3.0.4" +"@csstools/css-calc@npm:^2.1.4": + version: 2.1.4 + resolution: "@csstools/css-calc@npm:2.1.4" peerDependencies: - "@csstools/css-tokenizer": ^3.0.3 - checksum: 5b6b2b97fbe0a0c5652e44613bcf62ec89a93f64069a48f6cd63b5757c7dc227970c54c50a8212b9feb90aff399490636a58366df3ca733d490d911768eaddaf + "@csstools/css-parser-algorithms": ^3.0.5 + "@csstools/css-tokenizer": ^3.0.4 + checksum: b833d1a031dfb3e3268655aa384121b864fce9bad05f111a3cf2a343eed69ba5d723f3f7cd0793fd7b7a28de2f8141f94568828f48de41d86cefa452eee06390 languageName: node linkType: hard -"@csstools/css-tokenizer@npm:^3.0.3": - version: 3.0.3 - resolution: "@csstools/css-tokenizer@npm:3.0.3" - checksum: 6b300beba1b29c546b720887be18a40bafded5dc96550fb87d61fbc2c550e9632e7baafa2bf34a66e0f25fb6b70558ee67ef3b45856aa5e621febc2124cf5039 +"@csstools/css-color-parser@npm:^3.0.10": + version: 3.0.10 + resolution: "@csstools/css-color-parser@npm:3.0.10" + dependencies: + "@csstools/color-helpers": ^5.0.2 + "@csstools/css-calc": ^2.1.4 + peerDependencies: + "@csstools/css-parser-algorithms": ^3.0.5 + "@csstools/css-tokenizer": ^3.0.4 + checksum: 53741dd054b5347c1c5fc51efdff336f9ac4398ef9402603eabd95cf046e8a7c1eae67dfe2497af77b6bfae3dcd5f5ae23aaa37e7d6329210e1768a9c8e8fc90 languageName: node linkType: hard -"@csstools/media-query-list-parser@npm:^4.0.2": - version: 4.0.2 - resolution: "@csstools/media-query-list-parser@npm:4.0.2" +"@csstools/css-parser-algorithms@npm:^3.0.5": + version: 3.0.5 + resolution: "@csstools/css-parser-algorithms@npm:3.0.5" peerDependencies: - "@csstools/css-parser-algorithms": ^3.0.4 - "@csstools/css-tokenizer": ^3.0.3 - checksum: 5265675655ffe2242c272c344bdb77932d44fa7bf45d4de26793406cc287047b64a007d26f32c40db242bc9866dc4020da308a3b590a9a3dc7561089ca18cdea + "@csstools/css-tokenizer": ^3.0.4 + checksum: 80647139574431071e4664ad3c3e141deef4368f0ca536a63b3872487db68cf0d908fb76000f967deb1866963a90e6357fc6b9b00fdfa032f3321cebfcc66cd7 languageName: node linkType: hard -"@csstools/selector-specificity@npm:^5.0.0": - version: 5.0.0 - resolution: "@csstools/selector-specificity@npm:5.0.0" +"@csstools/css-tokenizer@npm:^3.0.4": + version: 3.0.4 + resolution: "@csstools/css-tokenizer@npm:3.0.4" + checksum: adc6681d3a0d7a75dc8e5ee0488c99ad4509e4810ae45dd6549a2e64a996e8d75512e70bb244778dc0c6ee85723e20eaeea8c083bf65b51eb19034e182554243 + languageName: node + linkType: hard + +"@csstools/media-query-list-parser@npm:^4.0.3": + version: 4.0.3 + resolution: "@csstools/media-query-list-parser@npm:4.0.3" peerDependencies: + "@csstools/css-parser-algorithms": ^3.0.5 + "@csstools/css-tokenizer": ^3.0.4 + checksum: dd7dc015a94e0832e5289794f6ab730d1c3fdc85fbd92433eb608dceb91e4977d345c08fe90c487359ce3ba39185fe15789d09c321c799f5c18c6aec7bd8da09 + languageName: node + linkType: hard + +"@csstools/postcss-cascade-layers@npm:^5.0.1": + version: 5.0.1 + resolution: "@csstools/postcss-cascade-layers@npm:5.0.1" + dependencies: + "@csstools/selector-specificity": ^5.0.0 postcss-selector-parser: ^7.0.0 - checksum: 8df1a01a1fa52b66c7ba0286e1c77d1faff45009876f09ddcac542a1c4bca9f34ee92a10acf056b8e7b7ac93679c1635496c6cdfd7d88dbaff2b6afd1eb823ec + peerDependencies: + postcss: ^8.4 + checksum: 5181c56823791ad43763b6daed225b4da290bea950f4cfb38be1961383a8366a47f67fb0098d7adb0b63ac84a7912295383452f1b05ab53bd681d9d13e91f97a languageName: node linkType: hard -"@discoveryjs/json-ext@npm:0.5.7": - version: 0.5.7 - resolution: "@discoveryjs/json-ext@npm:0.5.7" - checksum: 2176d301cc258ea5c2324402997cf8134ebb212469c0d397591636cea8d3c02f2b3cf9fd58dcb748c7a0dade77ebdc1b10284fa63e608c033a1db52fddc69918 +"@csstools/postcss-color-function@npm:^4.0.10": + version: 4.0.10 + resolution: "@csstools/postcss-color-function@npm:4.0.10" + dependencies: + "@csstools/css-color-parser": ^3.0.10 + "@csstools/css-parser-algorithms": ^3.0.5 + "@csstools/css-tokenizer": ^3.0.4 + "@csstools/postcss-progressive-custom-properties": ^4.1.0 + "@csstools/utilities": ^2.0.0 + peerDependencies: + postcss: ^8.4 + checksum: bf7650eab21784bfd3ed5618e1df081a989cedccf54b80accc72819dd463c4c57d99b9c4e5479cac5d889f39d09cc8ad610b82148300591e6bc547b238464056 languageName: node linkType: hard -"@docsearch/css@npm:3.5.2": - version: 3.5.2 - resolution: "@docsearch/css@npm:3.5.2" - checksum: d1d60dd230dd48f896755f21bd20b59583ba844212d7d336953ae48d389baaf868bdf83320fb734a4ed679c3f95b15d620cf3764cd538f6941cae239f8c9d35d +"@csstools/postcss-color-mix-function@npm:^3.0.10": + version: 3.0.10 + resolution: "@csstools/postcss-color-mix-function@npm:3.0.10" + dependencies: + "@csstools/css-color-parser": ^3.0.10 + "@csstools/css-parser-algorithms": ^3.0.5 + "@csstools/css-tokenizer": ^3.0.4 + "@csstools/postcss-progressive-custom-properties": ^4.1.0 + "@csstools/utilities": ^2.0.0 + peerDependencies: + postcss: ^8.4 + checksum: ea52be6f45979297de77310a095d2df105e0da064300f489572cb9b78e4906e9e6bbbe8fdfc82cf2e01a8bdb2473c36a234852ad5c5ea1eda580b9bc222159b4 languageName: node linkType: hard -"@docsearch/react@npm:^3.5.2": - version: 3.5.2 - resolution: "@docsearch/react@npm:3.5.2" +"@csstools/postcss-color-mix-variadic-function-arguments@npm:^1.0.0": + version: 1.0.0 + resolution: "@csstools/postcss-color-mix-variadic-function-arguments@npm:1.0.0" dependencies: - "@algolia/autocomplete-core": 1.9.3 - "@algolia/autocomplete-preset-algolia": 1.9.3 - "@docsearch/css": 3.5.2 - algoliasearch: ^4.19.1 + "@csstools/css-color-parser": ^3.0.10 + "@csstools/css-parser-algorithms": ^3.0.5 + "@csstools/css-tokenizer": ^3.0.4 + "@csstools/postcss-progressive-custom-properties": ^4.1.0 + "@csstools/utilities": ^2.0.0 peerDependencies: - "@types/react": ">= 16.8.0 < 19.0.0" - react: ">= 16.8.0 < 19.0.0" - react-dom: ">= 16.8.0 < 19.0.0" - search-insights: ">= 1 < 3" - peerDependenciesMeta: - "@types/react": - optional: true - react: - optional: true - react-dom: - optional: true - search-insights: - optional: true - checksum: 4b4584c2c73fc18cbd599047538896450974e134c2c74f19eb202db0ce8e6c3c49c6f65ed6ade61c796d476d3cbb55d6be58df62bc9568a0c72d88e42fca1d16 + postcss: ^8.4 + checksum: f12bf1d63eaf348ebe2ef9c79ddb1a63df3370a556f02d11cbe3ab8540016bd47fd7384948a426207f92131e0f5981d3695fbd046b5768c0ec63e45cc92e31a7 languageName: node linkType: hard -"@docusaurus/babel@npm:3.6.1": - version: 3.6.1 - resolution: "@docusaurus/babel@npm:3.6.1" +"@csstools/postcss-content-alt-text@npm:^2.0.6": + version: 2.0.6 + resolution: "@csstools/postcss-content-alt-text@npm:2.0.6" dependencies: - "@babel/core": ^7.25.9 - "@babel/generator": ^7.25.9 - "@babel/plugin-syntax-dynamic-import": ^7.8.3 - "@babel/plugin-transform-runtime": ^7.25.9 - "@babel/preset-env": ^7.25.9 - "@babel/preset-react": ^7.25.9 - "@babel/preset-typescript": ^7.25.9 - "@babel/runtime": ^7.25.9 - "@babel/runtime-corejs3": ^7.25.9 - "@babel/traverse": ^7.25.9 - "@docusaurus/logger": 3.6.1 - "@docusaurus/utils": 3.6.1 - babel-plugin-dynamic-import-node: ^2.3.3 - fs-extra: ^11.1.1 - tslib: ^2.6.0 - checksum: fcd6420fe2df051c353f5b651de1874841ccbd5d1e1fd26e77f312fcb46a3bc4cb9cc916789d59b99730bd2fbea77e05689f86abada163b26a67f17624f075a5 + "@csstools/css-parser-algorithms": ^3.0.5 + "@csstools/css-tokenizer": ^3.0.4 + "@csstools/postcss-progressive-custom-properties": ^4.1.0 + "@csstools/utilities": ^2.0.0 + peerDependencies: + postcss: ^8.4 + checksum: 2edca1f35b9d59cc3933a318db8cdeaed435169c35d1b0e9fb394349d4633c544ca03243b21be849c8d9f0986a9b10125635e7ed33ef89c28c1346cdb05fdab6 languageName: node linkType: hard -"@docusaurus/bundler@npm:3.6.1": - version: 3.6.1 - resolution: "@docusaurus/bundler@npm:3.6.1" +"@csstools/postcss-exponential-functions@npm:^2.0.9": + version: 2.0.9 + resolution: "@csstools/postcss-exponential-functions@npm:2.0.9" + dependencies: + "@csstools/css-calc": ^2.1.4 + "@csstools/css-parser-algorithms": ^3.0.5 + "@csstools/css-tokenizer": ^3.0.4 + peerDependencies: + postcss: ^8.4 + checksum: 80d5847d747fc67c32ee3ba49f9c9290654fb086c58b2f13256b14124b7349dac68ba8e107f631248cef2448ca57ef18adbbbc816dd63a54ba91826345373f39 + languageName: node + linkType: hard + +"@csstools/postcss-font-format-keywords@npm:^4.0.0": + version: 4.0.0 + resolution: "@csstools/postcss-font-format-keywords@npm:4.0.0" + dependencies: + "@csstools/utilities": ^2.0.0 + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.4 + checksum: 63091d4748cfc5a51e3c288cd620f058a4e776ba15da6180edaee94aaad9c4e92076f575d064dabc00b28966b33dd1e59f84a6ca6a66aed59556ef92a0dfed45 + languageName: node + linkType: hard + +"@csstools/postcss-gamut-mapping@npm:^2.0.10": + version: 2.0.10 + resolution: "@csstools/postcss-gamut-mapping@npm:2.0.10" + dependencies: + "@csstools/css-color-parser": ^3.0.10 + "@csstools/css-parser-algorithms": ^3.0.5 + "@csstools/css-tokenizer": ^3.0.4 + peerDependencies: + postcss: ^8.4 + checksum: 371449cc8c3db29a27b75afeb500777150f9f9e4edca71f63f2de12bc2c68f4157450ed6a6fdddfaa5596f4a17922176b862d14458a7ce6c15c81d06a0e9fc12 + languageName: node + linkType: hard + +"@csstools/postcss-gradients-interpolation-method@npm:^5.0.10": + version: 5.0.10 + resolution: "@csstools/postcss-gradients-interpolation-method@npm:5.0.10" + dependencies: + "@csstools/css-color-parser": ^3.0.10 + "@csstools/css-parser-algorithms": ^3.0.5 + "@csstools/css-tokenizer": ^3.0.4 + "@csstools/postcss-progressive-custom-properties": ^4.1.0 + "@csstools/utilities": ^2.0.0 + peerDependencies: + postcss: ^8.4 + checksum: ed639018eddd83ebcb96f1c09573c052ebaad153d87abc5f5fa3c0b6dc2a4ed151e25da91c173b87b7b087688c9ec3239210eba2dbc4b9d6bc624a05209e2d33 + languageName: node + linkType: hard + +"@csstools/postcss-hwb-function@npm:^4.0.10": + version: 4.0.10 + resolution: "@csstools/postcss-hwb-function@npm:4.0.10" + dependencies: + "@csstools/css-color-parser": ^3.0.10 + "@csstools/css-parser-algorithms": ^3.0.5 + "@csstools/css-tokenizer": ^3.0.4 + "@csstools/postcss-progressive-custom-properties": ^4.1.0 + "@csstools/utilities": ^2.0.0 + peerDependencies: + postcss: ^8.4 + checksum: b2a003fe844b0d5b44a1ba46754afdb298be94a771e2b4109391e774b07a04bfad0bc8d9e833bb862567bed533f54cdc146cdc5b869b69bdd3e5526e2651c200 + languageName: node + linkType: hard + +"@csstools/postcss-ic-unit@npm:^4.0.2": + version: 4.0.2 + resolution: "@csstools/postcss-ic-unit@npm:4.0.2" + dependencies: + "@csstools/postcss-progressive-custom-properties": ^4.1.0 + "@csstools/utilities": ^2.0.0 + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.4 + checksum: 4242221d9c1ed5f6062b6816a5cbbfb121aa919a0468bb786ff84e8eaf4e7656754b4587c51e9b2ae5bc6a7e53ac17ce05297b095866c8a02edb3b31ce74e18e + languageName: node + linkType: hard + +"@csstools/postcss-initial@npm:^2.0.1": + version: 2.0.1 + resolution: "@csstools/postcss-initial@npm:2.0.1" + peerDependencies: + postcss: ^8.4 + checksum: 914e9f56faf4e69757b0c905c4808dd39b1de30d151db5817da04510b89cb19b570a405ac2ca070941a42d5ce3f48682329de5ac21ac76416a0a98fee2de2d0d + languageName: node + linkType: hard + +"@csstools/postcss-is-pseudo-class@npm:^5.0.1": + version: 5.0.1 + resolution: "@csstools/postcss-is-pseudo-class@npm:5.0.1" + dependencies: + "@csstools/selector-specificity": ^5.0.0 + postcss-selector-parser: ^7.0.0 + peerDependencies: + postcss: ^8.4 + checksum: 6f9fa0815d762a3eee703d14ab992b1e653d0b7abfe0422755daf659fa0d360a015c624357a0b75dc660054acf54997171ce723740f96441cef540d00b60be7d + languageName: node + linkType: hard + +"@csstools/postcss-light-dark-function@npm:^2.0.9": + version: 2.0.9 + resolution: "@csstools/postcss-light-dark-function@npm:2.0.9" + dependencies: + "@csstools/css-parser-algorithms": ^3.0.5 + "@csstools/css-tokenizer": ^3.0.4 + "@csstools/postcss-progressive-custom-properties": ^4.1.0 + "@csstools/utilities": ^2.0.0 + peerDependencies: + postcss: ^8.4 + checksum: 98a68dc44dfc053b8afddf96bcf8790703d58455bc36475908255f716b88a1e87e49807ff7ae8ecf9c7345ee88524eadd2a872c8ab347348dee1a37f58c58bc4 + languageName: node + linkType: hard + +"@csstools/postcss-logical-float-and-clear@npm:^3.0.0": + version: 3.0.0 + resolution: "@csstools/postcss-logical-float-and-clear@npm:3.0.0" + peerDependencies: + postcss: ^8.4 + checksum: 793d9a89c28d4809a83b6111d321f60947a59f119d61046e5c4023ce2caedbb221298e69b6df38995e51b763545807db7b03da47e47461622f32928fec92b65f + languageName: node + linkType: hard + +"@csstools/postcss-logical-overflow@npm:^2.0.0": + version: 2.0.0 + resolution: "@csstools/postcss-logical-overflow@npm:2.0.0" + peerDependencies: + postcss: ^8.4 + checksum: bf73ea1d7754f59773af5a7b434e9eaa2ce05c8fe7aa26a726dce8f2a42abb0f5686fbf9672d25912250226174c35f2c5737ca072d21f8b68420500b7449fe58 + languageName: node + linkType: hard + +"@csstools/postcss-logical-overscroll-behavior@npm:^2.0.0": + version: 2.0.0 + resolution: "@csstools/postcss-logical-overscroll-behavior@npm:2.0.0" + peerDependencies: + postcss: ^8.4 + checksum: bf043fdad02b9578fc2dcddb409b014a15dee65a9813ceb583237dff1caf807e18101f68bde2b0d8b685139d823114ab8deed6da3027878d11a945755824d3b1 + languageName: node + linkType: hard + +"@csstools/postcss-logical-resize@npm:^3.0.0": + version: 3.0.0 + resolution: "@csstools/postcss-logical-resize@npm:3.0.0" + dependencies: + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.4 + checksum: 3be1133a9ac27e0a0d73b19d573adc00ad78a697522eaf6c9de90260882ba8ff0904c7ab3e68379ee7724e28661c4b497cb665e258214bc8355f4a0d91021c46 + languageName: node + linkType: hard + +"@csstools/postcss-logical-viewport-units@npm:^3.0.4": + version: 3.0.4 + resolution: "@csstools/postcss-logical-viewport-units@npm:3.0.4" + dependencies: + "@csstools/css-tokenizer": ^3.0.4 + "@csstools/utilities": ^2.0.0 + peerDependencies: + postcss: ^8.4 + checksum: ddb8d9b473c55cce1c1261652d657d33d9306d80112eac578d53b05dd48a5607ea2064fcf6bc298ccc1e63143e11517d35230bad6063dae14d445530c45a81ec + languageName: node + linkType: hard + +"@csstools/postcss-media-minmax@npm:^2.0.9": + version: 2.0.9 + resolution: "@csstools/postcss-media-minmax@npm:2.0.9" + dependencies: + "@csstools/css-calc": ^2.1.4 + "@csstools/css-parser-algorithms": ^3.0.5 + "@csstools/css-tokenizer": ^3.0.4 + "@csstools/media-query-list-parser": ^4.0.3 + peerDependencies: + postcss: ^8.4 + checksum: 24da18a5a41daef2ea4cf7d85f459b5b425085501324a3f0546309ba13f682ab57d9aabc4e639a724cd1d91a0ead046b9ab8164adad31d89c9e39ca918f5494b + languageName: node + linkType: hard + +"@csstools/postcss-media-queries-aspect-ratio-number-values@npm:^3.0.5": + version: 3.0.5 + resolution: "@csstools/postcss-media-queries-aspect-ratio-number-values@npm:3.0.5" + dependencies: + "@csstools/css-parser-algorithms": ^3.0.5 + "@csstools/css-tokenizer": ^3.0.4 + "@csstools/media-query-list-parser": ^4.0.3 + peerDependencies: + postcss: ^8.4 + checksum: 5a316f59c3d422eef942d01c4007d14fad8f85ce85efce080a90d8d3eb3257dc6fcce612c5ee57cf4665993a03bc5ccb538dac8e25041242ecf74f5c348a3c5a + languageName: node + linkType: hard + +"@csstools/postcss-nested-calc@npm:^4.0.0": + version: 4.0.0 + resolution: "@csstools/postcss-nested-calc@npm:4.0.0" + dependencies: + "@csstools/utilities": ^2.0.0 + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.4 + checksum: f334861687d7e3a4b9c26940e767a06f07e0095cab405a5b086fca407d6f743c57b552d4504ba7d5b1700a97da3507a41bf3bc2d126a26028b79f96ea38b6af5 + languageName: node + linkType: hard + +"@csstools/postcss-normalize-display-values@npm:^4.0.0": + version: 4.0.0 + resolution: "@csstools/postcss-normalize-display-values@npm:4.0.0" + dependencies: + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.4 + checksum: 750093837486da6dd0cc66183fe9909a18485f23610669806b708ab9942c721a773997cde37fd7ee085aca3d6de065ffd5609c77df5e2f303d67af106e53726e + languageName: node + linkType: hard + +"@csstools/postcss-oklab-function@npm:^4.0.10": + version: 4.0.10 + resolution: "@csstools/postcss-oklab-function@npm:4.0.10" + dependencies: + "@csstools/css-color-parser": ^3.0.10 + "@csstools/css-parser-algorithms": ^3.0.5 + "@csstools/css-tokenizer": ^3.0.4 + "@csstools/postcss-progressive-custom-properties": ^4.1.0 + "@csstools/utilities": ^2.0.0 + peerDependencies: + postcss: ^8.4 + checksum: 5d715a58e821aa5f5d30efe69b4b0a3dde301c75343d30c7b6a1a39ce3f6b7d060c10d063cda1c6424d58e4efeebee187f910fe7c011a701d623b71d3444b603 + languageName: node + linkType: hard + +"@csstools/postcss-progressive-custom-properties@npm:^4.1.0": + version: 4.1.0 + resolution: "@csstools/postcss-progressive-custom-properties@npm:4.1.0" + dependencies: + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.4 + checksum: ac60f683d25e224a15e5b2c06b1b0e29f51f72cc9f2704b82565e489d7f0f8532267a4b9300396ae402a93590bc9c35d5002ffda446f430e2c1c61a6cffcfd5c + languageName: node + linkType: hard + +"@csstools/postcss-random-function@npm:^2.0.1": + version: 2.0.1 + resolution: "@csstools/postcss-random-function@npm:2.0.1" + dependencies: + "@csstools/css-calc": ^2.1.4 + "@csstools/css-parser-algorithms": ^3.0.5 + "@csstools/css-tokenizer": ^3.0.4 + peerDependencies: + postcss: ^8.4 + checksum: d421a790b11675edf493f3e48259636beca164c494ed2883042118b35674d26f04e1a46f9e89203a179e20acc2a1f5912078ec81b330a2c1a1abef7e7387e587 + languageName: node + linkType: hard + +"@csstools/postcss-relative-color-syntax@npm:^3.0.10": + version: 3.0.10 + resolution: "@csstools/postcss-relative-color-syntax@npm:3.0.10" + dependencies: + "@csstools/css-color-parser": ^3.0.10 + "@csstools/css-parser-algorithms": ^3.0.5 + "@csstools/css-tokenizer": ^3.0.4 + "@csstools/postcss-progressive-custom-properties": ^4.1.0 + "@csstools/utilities": ^2.0.0 + peerDependencies: + postcss: ^8.4 + checksum: d09d0e559a538f3e0c120f1c660de799ada6f9f77423b945faf6648d914f8c6a3a6d8647ab6c895e5edaade4dfcceb207d6a44ff5e7e63998330677bf304cb08 + languageName: node + linkType: hard + +"@csstools/postcss-scope-pseudo-class@npm:^4.0.1": + version: 4.0.1 + resolution: "@csstools/postcss-scope-pseudo-class@npm:4.0.1" + dependencies: + postcss-selector-parser: ^7.0.0 + peerDependencies: + postcss: ^8.4 + checksum: 043667ad54b3a26e619d6c16129c1f4d8f8c7cd1c52443475aa7782dbc411390c23bd2fe41ea9c6a3f280594abbcdd9d4117a3d7c27cd2a77e31e6fd11e29fc0 + languageName: node + linkType: hard + +"@csstools/postcss-sign-functions@npm:^1.1.4": + version: 1.1.4 + resolution: "@csstools/postcss-sign-functions@npm:1.1.4" + dependencies: + "@csstools/css-calc": ^2.1.4 + "@csstools/css-parser-algorithms": ^3.0.5 + "@csstools/css-tokenizer": ^3.0.4 + peerDependencies: + postcss: ^8.4 + checksum: 0afcb008142a0a41df51267d79cf950f4f314394dca7c041e3a0be87df56517ac5400861630a979b5bef49f01c296025106622110384039e3c8f82802d6adcde + languageName: node + linkType: hard + +"@csstools/postcss-stepped-value-functions@npm:^4.0.9": + version: 4.0.9 + resolution: "@csstools/postcss-stepped-value-functions@npm:4.0.9" + dependencies: + "@csstools/css-calc": ^2.1.4 + "@csstools/css-parser-algorithms": ^3.0.5 + "@csstools/css-tokenizer": ^3.0.4 + peerDependencies: + postcss: ^8.4 + checksum: 6465a883be42d4cc4a4e83be2626a1351de4bfe84a63641c53e7c39d3c0e109152489ca2d8235625cdf6726341c676b9fbbca18fe80bb5eae8d488a0e42fc5e4 + languageName: node + linkType: hard + +"@csstools/postcss-text-decoration-shorthand@npm:^4.0.2": + version: 4.0.2 + resolution: "@csstools/postcss-text-decoration-shorthand@npm:4.0.2" + dependencies: + "@csstools/color-helpers": ^5.0.2 + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.4 + checksum: c67b9c6582f7cd05d8a0df5ba98531ca07721c80f3ddf8ec69d1b9da5c6e1fd9313e25ce9ed378bbdf11c6dcd37367f3ebf1d4fabb6af99232e11bb662bfa1f9 + languageName: node + linkType: hard + +"@csstools/postcss-trigonometric-functions@npm:^4.0.9": + version: 4.0.9 + resolution: "@csstools/postcss-trigonometric-functions@npm:4.0.9" + dependencies: + "@csstools/css-calc": ^2.1.4 + "@csstools/css-parser-algorithms": ^3.0.5 + "@csstools/css-tokenizer": ^3.0.4 + peerDependencies: + postcss: ^8.4 + checksum: c746cd986df061a87de4f2d0129aa2d2e98a2948e5005fe6fe419a9e9ec7a0f7382461847cbd3f67f8f66169bdf23a1d7f53ca6b9922ddd235ec45f2867a8825 + languageName: node + linkType: hard + +"@csstools/postcss-unset-value@npm:^4.0.0": + version: 4.0.0 + resolution: "@csstools/postcss-unset-value@npm:4.0.0" + peerDependencies: + postcss: ^8.4 + checksum: 3d194feea11f80ba82e19733d1531546abeba0af9fe6fc105acdf10452d699661da4e1bce45101f90bcb624a30570e469cee945c5a62b9ffe1445959a0b782d1 + languageName: node + linkType: hard + +"@csstools/selector-resolve-nested@npm:^3.0.0": + version: 3.0.0 + resolution: "@csstools/selector-resolve-nested@npm:3.0.0" + peerDependencies: + postcss-selector-parser: ^7.0.0 + checksum: 2059b6d1931d157162fb4a79ebdea614cf2b0024609f5e5cba4aa44a80367b25503c22c49bff99de4fa5fa921ce713cc642fa8aa562f3535e8d0126e6b41778e + languageName: node + linkType: hard + +"@csstools/selector-specificity@npm:^5.0.0": + version: 5.0.0 + resolution: "@csstools/selector-specificity@npm:5.0.0" + peerDependencies: + postcss-selector-parser: ^7.0.0 + checksum: 8df1a01a1fa52b66c7ba0286e1c77d1faff45009876f09ddcac542a1c4bca9f34ee92a10acf056b8e7b7ac93679c1635496c6cdfd7d88dbaff2b6afd1eb823ec + languageName: node + linkType: hard + +"@csstools/utilities@npm:^2.0.0": + version: 2.0.0 + resolution: "@csstools/utilities@npm:2.0.0" + peerDependencies: + postcss: ^8.4 + checksum: c9c8d82063ec5156d56b056c9124fed95714f05d7c1a64043174b0559aa099989f17a826579f22045384defe152e32d6355b7a9660cfed96819f43fccf277941 + languageName: node + linkType: hard + +"@discoveryjs/json-ext@npm:0.5.7": + version: 0.5.7 + resolution: "@discoveryjs/json-ext@npm:0.5.7" + checksum: 2176d301cc258ea5c2324402997cf8134ebb212469c0d397591636cea8d3c02f2b3cf9fd58dcb748c7a0dade77ebdc1b10284fa63e608c033a1db52fddc69918 + languageName: node + linkType: hard + +"@docsearch/css@npm:3.9.0": + version: 3.9.0 + resolution: "@docsearch/css@npm:3.9.0" + checksum: 8e6f5a995d17881c76b31e5364274b3387917ccbc417ba183009f2655dd507244f7009d27807675f09011efcd8e13d80505e7e17eff1a5d93bcd71324a5fc262 + languageName: node + linkType: hard + +"@docsearch/react@npm:^3.8.1": + version: 3.9.0 + resolution: "@docsearch/react@npm:3.9.0" + dependencies: + "@algolia/autocomplete-core": 1.17.9 + "@algolia/autocomplete-preset-algolia": 1.17.9 + "@docsearch/css": 3.9.0 + algoliasearch: ^5.14.2 + peerDependencies: + "@types/react": ">= 16.8.0 < 20.0.0" + react: ">= 16.8.0 < 20.0.0" + react-dom: ">= 16.8.0 < 20.0.0" + search-insights: ">= 1 < 3" + peerDependenciesMeta: + "@types/react": + optional: true + react: + optional: true + react-dom: + optional: true + search-insights: + optional: true + checksum: af6c531af5f4c10fb57d4d29ae47fe297e4201c5130492e2c73c34306348bf87ab05b7eeae2cb83a6c33dbe8da3754b82275b86ae0116df65f34a9e51f9291bc + languageName: node + linkType: hard + +"@docusaurus/babel@npm:3.7.0": + version: 3.7.0 + resolution: "@docusaurus/babel@npm:3.7.0" dependencies: "@babel/core": ^7.25.9 - "@docusaurus/babel": 3.6.1 - "@docusaurus/cssnano-preset": 3.6.1 - "@docusaurus/logger": 3.6.1 - "@docusaurus/types": 3.6.1 - "@docusaurus/utils": 3.6.1 - autoprefixer: ^10.4.14 + "@babel/generator": ^7.25.9 + "@babel/plugin-syntax-dynamic-import": ^7.8.3 + "@babel/plugin-transform-runtime": ^7.25.9 + "@babel/preset-env": ^7.25.9 + "@babel/preset-react": ^7.25.9 + "@babel/preset-typescript": ^7.25.9 + "@babel/runtime": ^7.25.9 + "@babel/runtime-corejs3": ^7.25.9 + "@babel/traverse": ^7.25.9 + "@docusaurus/logger": 3.7.0 + "@docusaurus/utils": 3.7.0 + babel-plugin-dynamic-import-node: ^2.3.3 + fs-extra: ^11.1.1 + tslib: ^2.6.0 + checksum: 1a620722de3e6090a409e2e14c8d5f779b735ad33961b12ec0e53f48b04bacb6a49b48de73a5a3f5f9f8c4487e032ec5f8a354c50fcb429445d7df9949e5491d + languageName: node + linkType: hard + +"@docusaurus/bundler@npm:3.7.0": + version: 3.7.0 + resolution: "@docusaurus/bundler@npm:3.7.0" + dependencies: + "@babel/core": ^7.25.9 + "@docusaurus/babel": 3.7.0 + "@docusaurus/cssnano-preset": 3.7.0 + "@docusaurus/logger": 3.7.0 + "@docusaurus/types": 3.7.0 + "@docusaurus/utils": 3.7.0 babel-loader: ^9.2.1 clean-css: ^5.3.2 copy-webpack-plugin: ^11.0.0 @@ -2271,6 +2706,7 @@ __metadata: null-loader: ^4.0.1 postcss: ^8.4.26 postcss-loader: ^7.3.3 + postcss-preset-env: ^10.1.0 react-dev-utils: ^12.0.1 terser-webpack-plugin: ^5.3.9 tslib: ^2.6.0 @@ -2282,21 +2718,21 @@ __metadata: peerDependenciesMeta: "@docusaurus/faster": optional: true - checksum: 996bf2dc8ece4287cb26eedb49089c524d3ba616ac56de9b434041eccb0dfb8fe38051dab3916cf730da4820cf4a4846c2c4955729d17fc6c84deadc114478b7 + checksum: a4278095ff7480d2ed63dd66a96f9913284dc8cae05d489bee9964fdf22a34fc4c5ddb4712f544aaed6e6bb60dac0701a27437f37040895fc6504f8432eb1c64 languageName: node linkType: hard -"@docusaurus/core@npm:3.6.1, @docusaurus/core@npm:^3.2.1": - version: 3.6.1 - resolution: "@docusaurus/core@npm:3.6.1" +"@docusaurus/core@npm:3.7.0, @docusaurus/core@npm:~3.7.0": + version: 3.7.0 + resolution: "@docusaurus/core@npm:3.7.0" dependencies: - "@docusaurus/babel": 3.6.1 - "@docusaurus/bundler": 3.6.1 - "@docusaurus/logger": 3.6.1 - "@docusaurus/mdx-loader": 3.6.1 - "@docusaurus/utils": 3.6.1 - "@docusaurus/utils-common": 3.6.1 - "@docusaurus/utils-validation": 3.6.1 + "@docusaurus/babel": 3.7.0 + "@docusaurus/bundler": 3.7.0 + "@docusaurus/logger": 3.7.0 + "@docusaurus/mdx-loader": 3.7.0 + "@docusaurus/utils": 3.7.0 + "@docusaurus/utils-common": 3.7.0 + "@docusaurus/utils-validation": 3.7.0 boxen: ^6.2.1 chalk: ^4.1.2 chokidar: ^3.5.3 @@ -2317,13 +2753,12 @@ __metadata: p-map: ^4.0.0 prompts: ^2.4.2 react-dev-utils: ^12.0.1 - react-helmet-async: ^1.3.0 + react-helmet-async: "npm:@slorber/react-helmet-async@1.3.0" react-loadable: "npm:@docusaurus/react-loadable@6.0.0" react-loadable-ssr-addon-v5-slorber: ^1.0.1 react-router: ^5.3.4 react-router-config: ^5.1.1 react-router-dom: ^5.3.4 - rtl-detect: ^1.0.4 semver: ^7.5.4 serve-handler: ^6.1.6 shelljs: ^0.8.5 @@ -2335,43 +2770,43 @@ __metadata: webpack-merge: ^6.0.1 peerDependencies: "@mdx-js/react": ^3.0.0 - react: ^18.0.0 - react-dom: ^18.0.0 + react: ^18.0.0 || ^19.0.0 + react-dom: ^18.0.0 || ^19.0.0 bin: docusaurus: bin/docusaurus.mjs - checksum: 5a12e4b57fad44e0107896450995c79c565c24201efb1341f3522fc74ec2739ce5a23b52ef8dd301b5cd383aa49d647f86e1e2e7f94d8beda97ffc4582572efe + checksum: 6f9dafa3f615e518786203e6ee1cc21cd990bcea47cb11727b2d02e555d9744d977dda7b42d0486e36936401116069117b8edebbaa18855399391dbf4ac44268 languageName: node linkType: hard -"@docusaurus/cssnano-preset@npm:3.6.1": - version: 3.6.1 - resolution: "@docusaurus/cssnano-preset@npm:3.6.1" +"@docusaurus/cssnano-preset@npm:3.7.0": + version: 3.7.0 + resolution: "@docusaurus/cssnano-preset@npm:3.7.0" dependencies: cssnano-preset-advanced: ^6.1.2 postcss: ^8.4.38 postcss-sort-media-queries: ^5.2.0 tslib: ^2.6.0 - checksum: ab1cd28815b88d8b5ff3e23e9d60f233a70f2613c4471d6b1b7db0a1e7bc1c360bf3b2e2b2ec9dad55f38c4ffc731bba22c4deb795b063f989300afc57ef93fb + checksum: 3d2af3abddbe32777d0dcbffd5d8858ed5934d08cd48b0ff3c81e8d328c7895287c0c0c7a823b3ecdf9f2582ac38aad3a8ca9fa53010dba4ff59ce1a259265a5 languageName: node linkType: hard -"@docusaurus/logger@npm:3.6.1": - version: 3.6.1 - resolution: "@docusaurus/logger@npm:3.6.1" +"@docusaurus/logger@npm:3.7.0": + version: 3.7.0 + resolution: "@docusaurus/logger@npm:3.7.0" dependencies: chalk: ^4.1.2 tslib: ^2.6.0 - checksum: b4e3ea7df30411d2c0f5a288f96d16ded76864fc2f114c6cd6ddf2f73ef858fe734dfa29a8ef68d71507783dbb6f0b2cf5e2329e6353e15cdf1d9077f244e775 + checksum: 22e0cfbaf2775bb813d424385b17cc72343dae2e10c9a3bd43cb8e6ab929322313b4a00cadfa3b1f0589003dd561c49fa523f87a31ed02a8f27d17a677d19d8a languageName: node linkType: hard -"@docusaurus/mdx-loader@npm:3.6.1": - version: 3.6.1 - resolution: "@docusaurus/mdx-loader@npm:3.6.1" +"@docusaurus/mdx-loader@npm:3.7.0": + version: 3.7.0 + resolution: "@docusaurus/mdx-loader@npm:3.7.0" dependencies: - "@docusaurus/logger": 3.6.1 - "@docusaurus/utils": 3.6.1 - "@docusaurus/utils-validation": 3.6.1 + "@docusaurus/logger": 3.7.0 + "@docusaurus/utils": 3.7.0 + "@docusaurus/utils-validation": 3.7.0 "@mdx-js/mdx": ^3.0.0 "@slorber/remark-comment": ^1.0.0 escape-html: ^1.0.3 @@ -2394,62 +2829,62 @@ __metadata: vfile: ^6.0.1 webpack: ^5.88.1 peerDependencies: - react: ^18.0.0 - react-dom: ^18.0.0 - checksum: 9498e35e12b53b476ab7382b5e8bd33db70a54bae98839b2c589f6651a8f9cee3bd16fe34032bbae6e6fc11383ffd2a78a98d9a0d707e0dcaaa162d29ccec3e2 + react: ^18.0.0 || ^19.0.0 + react-dom: ^18.0.0 || ^19.0.0 + checksum: be3307029f2c3f96c4caf72e71746676c065f376037d6d869fe4ce5fb5c41cdd41515a4b780e112e428b91e2873409115dbfa3f00894c8e24f261bdd1dbe91af languageName: node linkType: hard -"@docusaurus/module-type-aliases@npm:3.6.1, @docusaurus/module-type-aliases@npm:^3.2.1": - version: 3.6.1 - resolution: "@docusaurus/module-type-aliases@npm:3.6.1" +"@docusaurus/module-type-aliases@npm:3.7.0, @docusaurus/module-type-aliases@npm:~3.7.0": + version: 3.7.0 + resolution: "@docusaurus/module-type-aliases@npm:3.7.0" dependencies: - "@docusaurus/types": 3.6.1 + "@docusaurus/types": 3.7.0 "@types/history": ^4.7.11 "@types/react": "*" "@types/react-router-config": "*" "@types/react-router-dom": "*" - react-helmet-async: "*" + react-helmet-async: "npm:@slorber/react-helmet-async@*" react-loadable: "npm:@docusaurus/react-loadable@6.0.0" peerDependencies: react: "*" react-dom: "*" - checksum: ad151a3ee4799b66fc623f76bc88009815e8420bbfd70a176eb4484ba9b54e98016cdfcd13fc04f5257355d65a7c0a959671e7a3ba8942ad12abe9e733ca6f41 + checksum: 6fa31e416e81b0763c42ec5593f06e48950223ae4df47060a60baa84a70f5e955987f028d04087e8ecd0ce12e831087b00fc435c375536a8665440bd13a74e6a languageName: node linkType: hard -"@docusaurus/plugin-client-redirects@npm:^3.2.1": - version: 3.6.1 - resolution: "@docusaurus/plugin-client-redirects@npm:3.6.1" +"@docusaurus/plugin-client-redirects@npm:~3.7.0": + version: 3.7.0 + resolution: "@docusaurus/plugin-client-redirects@npm:3.7.0" dependencies: - "@docusaurus/core": 3.6.1 - "@docusaurus/logger": 3.6.1 - "@docusaurus/utils": 3.6.1 - "@docusaurus/utils-common": 3.6.1 - "@docusaurus/utils-validation": 3.6.1 + "@docusaurus/core": 3.7.0 + "@docusaurus/logger": 3.7.0 + "@docusaurus/utils": 3.7.0 + "@docusaurus/utils-common": 3.7.0 + "@docusaurus/utils-validation": 3.7.0 eta: ^2.2.0 fs-extra: ^11.1.1 lodash: ^4.17.21 tslib: ^2.6.0 peerDependencies: - react: ^18.0.0 - react-dom: ^18.0.0 - checksum: 530ba9fab4b532cc0aed5f8bdd8389f5aaaba51722987e936c3e2531f28dc384c87c5ca9ad62e70679a41e2265b9fae90afb67444f889b5f5228829ff3c76314 + react: ^18.0.0 || ^19.0.0 + react-dom: ^18.0.0 || ^19.0.0 + checksum: d5a803ce42ae1d54a8b39912b64a02d36770457345150f3ef3892e48fa875d2537cd92fafc02226ae1a0de173d05936a3524483956a5b523cc66205667f46f14 languageName: node linkType: hard -"@docusaurus/plugin-content-blog@npm:3.6.1": - version: 3.6.1 - resolution: "@docusaurus/plugin-content-blog@npm:3.6.1" +"@docusaurus/plugin-content-blog@npm:3.7.0": + version: 3.7.0 + resolution: "@docusaurus/plugin-content-blog@npm:3.7.0" dependencies: - "@docusaurus/core": 3.6.1 - "@docusaurus/logger": 3.6.1 - "@docusaurus/mdx-loader": 3.6.1 - "@docusaurus/theme-common": 3.6.1 - "@docusaurus/types": 3.6.1 - "@docusaurus/utils": 3.6.1 - "@docusaurus/utils-common": 3.6.1 - "@docusaurus/utils-validation": 3.6.1 + "@docusaurus/core": 3.7.0 + "@docusaurus/logger": 3.7.0 + "@docusaurus/mdx-loader": 3.7.0 + "@docusaurus/theme-common": 3.7.0 + "@docusaurus/types": 3.7.0 + "@docusaurus/utils": 3.7.0 + "@docusaurus/utils-common": 3.7.0 + "@docusaurus/utils-validation": 3.7.0 cheerio: 1.0.0-rc.12 feed: ^4.2.2 fs-extra: ^11.1.1 @@ -2462,25 +2897,25 @@ __metadata: webpack: ^5.88.1 peerDependencies: "@docusaurus/plugin-content-docs": "*" - react: ^18.0.0 - react-dom: ^18.0.0 - checksum: 684b61ab003c39c8e313f2c7dafcadbaad81df33253e21b7c2768c27e40434d36e377c53f1521e0b7c7b5794fe601b0d7b00587f63ccd7cf028f4891fefb14b2 + react: ^18.0.0 || ^19.0.0 + react-dom: ^18.0.0 || ^19.0.0 + checksum: 2a36adc80a9f9d6de472cb2844445084f58ac08f222f5037dfcb8b2beddc524c4cef63f4a3926f750539f36b53337159121d744b68a4a9d2d301c064bded03c6 languageName: node linkType: hard -"@docusaurus/plugin-content-docs@npm:3.6.1": - version: 3.6.1 - resolution: "@docusaurus/plugin-content-docs@npm:3.6.1" +"@docusaurus/plugin-content-docs@npm:3.7.0": + version: 3.7.0 + resolution: "@docusaurus/plugin-content-docs@npm:3.7.0" dependencies: - "@docusaurus/core": 3.6.1 - "@docusaurus/logger": 3.6.1 - "@docusaurus/mdx-loader": 3.6.1 - "@docusaurus/module-type-aliases": 3.6.1 - "@docusaurus/theme-common": 3.6.1 - "@docusaurus/types": 3.6.1 - "@docusaurus/utils": 3.6.1 - "@docusaurus/utils-common": 3.6.1 - "@docusaurus/utils-validation": 3.6.1 + "@docusaurus/core": 3.7.0 + "@docusaurus/logger": 3.7.0 + "@docusaurus/mdx-loader": 3.7.0 + "@docusaurus/module-type-aliases": 3.7.0 + "@docusaurus/theme-common": 3.7.0 + "@docusaurus/types": 3.7.0 + "@docusaurus/utils": 3.7.0 + "@docusaurus/utils-common": 3.7.0 + "@docusaurus/utils-validation": 3.7.0 "@types/react-router-config": ^5.0.7 combine-promises: ^1.1.0 fs-extra: ^11.1.1 @@ -2490,108 +2925,108 @@ __metadata: utility-types: ^3.10.0 webpack: ^5.88.1 peerDependencies: - react: ^18.0.0 - react-dom: ^18.0.0 - checksum: 0c64903e14f27903e56454971e170ded55c004179764a4aee165e0fee1251c41a5ec4c17a7053243b2da3c99d15d5ceeb7de82e6edb5ce09c182700f89cb4a6d + react: ^18.0.0 || ^19.0.0 + react-dom: ^18.0.0 || ^19.0.0 + checksum: 933936fcbfd8552f775443e93daf0e05ac233b458e574d05214949970731b1ca0e6b9cb919fd63648f54af3a7395f713c3c0e25dfdece2a4bfc599ad2de5e21c languageName: node linkType: hard -"@docusaurus/plugin-content-pages@npm:3.6.1": - version: 3.6.1 - resolution: "@docusaurus/plugin-content-pages@npm:3.6.1" +"@docusaurus/plugin-content-pages@npm:3.7.0": + version: 3.7.0 + resolution: "@docusaurus/plugin-content-pages@npm:3.7.0" dependencies: - "@docusaurus/core": 3.6.1 - "@docusaurus/mdx-loader": 3.6.1 - "@docusaurus/types": 3.6.1 - "@docusaurus/utils": 3.6.1 - "@docusaurus/utils-validation": 3.6.1 + "@docusaurus/core": 3.7.0 + "@docusaurus/mdx-loader": 3.7.0 + "@docusaurus/types": 3.7.0 + "@docusaurus/utils": 3.7.0 + "@docusaurus/utils-validation": 3.7.0 fs-extra: ^11.1.1 tslib: ^2.6.0 webpack: ^5.88.1 peerDependencies: - react: ^18.0.0 - react-dom: ^18.0.0 - checksum: 6c1cea84c753ba994431c6de3ee8af3c427f132b99be321a7942ff6e9466ec8b518f949abb50b687554671d3da5d6e592adb52c8bf929339e4674e363aaaf6f3 + react: ^18.0.0 || ^19.0.0 + react-dom: ^18.0.0 || ^19.0.0 + checksum: bdb2a4655e1067262075503e80fc2302addbe3f15f3fa3cd41df49ecf5bbf5f6df282263a0f340e405a2859369b0fda5e4a4c494b6a82c7f345d06e916be168f languageName: node linkType: hard -"@docusaurus/plugin-debug@npm:3.6.1": - version: 3.6.1 - resolution: "@docusaurus/plugin-debug@npm:3.6.1" +"@docusaurus/plugin-debug@npm:3.7.0": + version: 3.7.0 + resolution: "@docusaurus/plugin-debug@npm:3.7.0" dependencies: - "@docusaurus/core": 3.6.1 - "@docusaurus/types": 3.6.1 - "@docusaurus/utils": 3.6.1 + "@docusaurus/core": 3.7.0 + "@docusaurus/types": 3.7.0 + "@docusaurus/utils": 3.7.0 fs-extra: ^11.1.1 react-json-view-lite: ^1.2.0 tslib: ^2.6.0 peerDependencies: - react: ^18.0.0 - react-dom: ^18.0.0 - checksum: daa7cc8944a99d3fa75e6694aa786b204dec36ff7f7eef8ea1426e188bb27445ff1e9ec9906d8e6042cb5cb7fb20f051aa97da9923614c43aa35f4f68853ad87 + react: ^18.0.0 || ^19.0.0 + react-dom: ^18.0.0 || ^19.0.0 + checksum: 5daca21e8162060742c9656bebab59bff4e519a260a21c40f4a024d509a08d6505eb60663953e5382787bd1104a43c2deea8fffb47f1f4dd3e1205cfa6bb4670 languageName: node linkType: hard -"@docusaurus/plugin-google-analytics@npm:3.6.1": - version: 3.6.1 - resolution: "@docusaurus/plugin-google-analytics@npm:3.6.1" +"@docusaurus/plugin-google-analytics@npm:3.7.0": + version: 3.7.0 + resolution: "@docusaurus/plugin-google-analytics@npm:3.7.0" dependencies: - "@docusaurus/core": 3.6.1 - "@docusaurus/types": 3.6.1 - "@docusaurus/utils-validation": 3.6.1 + "@docusaurus/core": 3.7.0 + "@docusaurus/types": 3.7.0 + "@docusaurus/utils-validation": 3.7.0 tslib: ^2.6.0 peerDependencies: - react: ^18.0.0 - react-dom: ^18.0.0 - checksum: 41566b48487f7aace54d34742dc684532a6be2539d019f6a01770872243e34c123d3ecc34fd0dc62ea01798300f9b5525c0563f8f3062033705b226cdecd9ba5 + react: ^18.0.0 || ^19.0.0 + react-dom: ^18.0.0 || ^19.0.0 + checksum: 09eda2b1fbf577f70fee4bbe22683208fb77fc5a402cd70c06236a1a97d10f48c7fdce91cc4d489eb1f8a44adc56c8fd7dcd3b3d2cefc76a1d86cf7fc1213166 languageName: node linkType: hard -"@docusaurus/plugin-google-gtag@npm:3.6.1": - version: 3.6.1 - resolution: "@docusaurus/plugin-google-gtag@npm:3.6.1" +"@docusaurus/plugin-google-gtag@npm:3.7.0": + version: 3.7.0 + resolution: "@docusaurus/plugin-google-gtag@npm:3.7.0" dependencies: - "@docusaurus/core": 3.6.1 - "@docusaurus/types": 3.6.1 - "@docusaurus/utils-validation": 3.6.1 + "@docusaurus/core": 3.7.0 + "@docusaurus/types": 3.7.0 + "@docusaurus/utils-validation": 3.7.0 "@types/gtag.js": ^0.0.12 tslib: ^2.6.0 peerDependencies: - react: ^18.0.0 - react-dom: ^18.0.0 - checksum: 0465e0758172464dff0cad284bfc56a5493ce0f1e06543f4786f514d35661d3f7cdb94df67301d1227bc4b588b4dd4a4d261e950e117b8961599c7573fdab67d + react: ^18.0.0 || ^19.0.0 + react-dom: ^18.0.0 || ^19.0.0 + checksum: d09eb00798c8091581fe670a9a15ea5de933afee54e5ed66e1d283812adf001062a7e14f1106fc3b6dd264048df56aa2a5cc066c647c7456788f814a81788b42 languageName: node linkType: hard -"@docusaurus/plugin-google-tag-manager@npm:3.6.1": - version: 3.6.1 - resolution: "@docusaurus/plugin-google-tag-manager@npm:3.6.1" +"@docusaurus/plugin-google-tag-manager@npm:3.7.0": + version: 3.7.0 + resolution: "@docusaurus/plugin-google-tag-manager@npm:3.7.0" dependencies: - "@docusaurus/core": 3.6.1 - "@docusaurus/types": 3.6.1 - "@docusaurus/utils-validation": 3.6.1 + "@docusaurus/core": 3.7.0 + "@docusaurus/types": 3.7.0 + "@docusaurus/utils-validation": 3.7.0 tslib: ^2.6.0 peerDependencies: - react: ^18.0.0 - react-dom: ^18.0.0 - checksum: 9eba5bac300c33b129210bc18546e3d9b51648f4843c36f36a2fef2beac3af6d9e26d543ff21d29fb92bad51ef442a32993e4cb0becfbbe47173ece586c51bad + react: ^18.0.0 || ^19.0.0 + react-dom: ^18.0.0 || ^19.0.0 + checksum: 83906f1fd7e00869de53917ba881ec1e3fb68a7c8e04aeae40d9e5f03a172186ef77754182d1ccba1065616ffac31dbc9d572ee0b6ba3750c5aaead08cf0db4d languageName: node linkType: hard -"@docusaurus/plugin-pwa@npm:^3.2.1": - version: 3.6.1 - resolution: "@docusaurus/plugin-pwa@npm:3.6.1" +"@docusaurus/plugin-pwa@npm:~3.7.0": + version: 3.7.0 + resolution: "@docusaurus/plugin-pwa@npm:3.7.0" dependencies: "@babel/core": ^7.25.9 "@babel/preset-env": ^7.25.9 - "@docusaurus/bundler": 3.6.1 - "@docusaurus/core": 3.6.1 - "@docusaurus/logger": 3.6.1 - "@docusaurus/theme-common": 3.6.1 - "@docusaurus/theme-translations": 3.6.1 - "@docusaurus/types": 3.6.1 - "@docusaurus/utils": 3.6.1 - "@docusaurus/utils-validation": 3.6.1 + "@docusaurus/bundler": 3.7.0 + "@docusaurus/core": 3.7.0 + "@docusaurus/logger": 3.7.0 + "@docusaurus/theme-common": 3.7.0 + "@docusaurus/theme-translations": 3.7.0 + "@docusaurus/types": 3.7.0 + "@docusaurus/utils": 3.7.0 + "@docusaurus/utils-validation": 3.7.0 babel-loader: ^9.2.1 clsx: ^2.0.0 core-js: ^3.31.1 @@ -2602,86 +3037,106 @@ __metadata: workbox-precaching: ^7.0.0 workbox-window: ^7.0.0 peerDependencies: - react: ^18.0.0 - react-dom: ^18.0.0 - checksum: 43e451f90500f1732544da10b8bd961843d982b1a17f2c519eb962e33e996eb937e78a42b0f0ad860e2d4c925a843ef197aaaa020738c7799d1756aaade07e15 + react: ^18.0.0 || ^19.0.0 + react-dom: ^18.0.0 || ^19.0.0 + checksum: 2e98b131e5819e40e6e917f02653af76662c6a5d51f354e942553708c567a6db17d5c3f1e4dd775574a32be34036d0ef7854ac59f1e621b1a85ee2f45c76e0a1 languageName: node linkType: hard -"@docusaurus/plugin-sitemap@npm:3.6.1": - version: 3.6.1 - resolution: "@docusaurus/plugin-sitemap@npm:3.6.1" +"@docusaurus/plugin-sitemap@npm:3.7.0": + version: 3.7.0 + resolution: "@docusaurus/plugin-sitemap@npm:3.7.0" dependencies: - "@docusaurus/core": 3.6.1 - "@docusaurus/logger": 3.6.1 - "@docusaurus/types": 3.6.1 - "@docusaurus/utils": 3.6.1 - "@docusaurus/utils-common": 3.6.1 - "@docusaurus/utils-validation": 3.6.1 + "@docusaurus/core": 3.7.0 + "@docusaurus/logger": 3.7.0 + "@docusaurus/types": 3.7.0 + "@docusaurus/utils": 3.7.0 + "@docusaurus/utils-common": 3.7.0 + "@docusaurus/utils-validation": 3.7.0 fs-extra: ^11.1.1 sitemap: ^7.1.1 tslib: ^2.6.0 peerDependencies: - react: ^18.0.0 - react-dom: ^18.0.0 - checksum: be1568448b233a390c096a44edba14a368ffb37b984542ad4ae1bfc7207143ce2f19a01e5f0421d67827721617c5dc906dd72658dada7ee5a6a1ebfa7cb696c9 + react: ^18.0.0 || ^19.0.0 + react-dom: ^18.0.0 || ^19.0.0 + checksum: ed03a2d306642ed099305ae8c1b8f40a52dc36f5a82ac57df14216eeec04214b5e85985aabcce41d4e422fbb77ee67719d07df103d72f864eda1cec65c478a96 languageName: node linkType: hard -"@docusaurus/preset-classic@npm:^3.2.1": - version: 3.6.1 - resolution: "@docusaurus/preset-classic@npm:3.6.1" +"@docusaurus/plugin-svgr@npm:3.7.0": + version: 3.7.0 + resolution: "@docusaurus/plugin-svgr@npm:3.7.0" dependencies: - "@docusaurus/core": 3.6.1 - "@docusaurus/plugin-content-blog": 3.6.1 - "@docusaurus/plugin-content-docs": 3.6.1 - "@docusaurus/plugin-content-pages": 3.6.1 - "@docusaurus/plugin-debug": 3.6.1 - "@docusaurus/plugin-google-analytics": 3.6.1 - "@docusaurus/plugin-google-gtag": 3.6.1 - "@docusaurus/plugin-google-tag-manager": 3.6.1 - "@docusaurus/plugin-sitemap": 3.6.1 - "@docusaurus/theme-classic": 3.6.1 - "@docusaurus/theme-common": 3.6.1 - "@docusaurus/theme-search-algolia": 3.6.1 - "@docusaurus/types": 3.6.1 + "@docusaurus/core": 3.7.0 + "@docusaurus/types": 3.7.0 + "@docusaurus/utils": 3.7.0 + "@docusaurus/utils-validation": 3.7.0 + "@svgr/core": 8.1.0 + "@svgr/webpack": ^8.1.0 + tslib: ^2.6.0 + webpack: ^5.88.1 + peerDependencies: + react: ^18.0.0 || ^19.0.0 + react-dom: ^18.0.0 || ^19.0.0 + checksum: 2ada44b314f21ff824b9df9a9872cb5fdc942133151111c214d7d47ff1a8c271c5e02f35fe6d6ff9768c35fd5f797e8a7e3e26e7467066271143c9988fd2cbce + languageName: node + linkType: hard + +"@docusaurus/preset-classic@npm:~3.7.0": + version: 3.7.0 + resolution: "@docusaurus/preset-classic@npm:3.7.0" + dependencies: + "@docusaurus/core": 3.7.0 + "@docusaurus/plugin-content-blog": 3.7.0 + "@docusaurus/plugin-content-docs": 3.7.0 + "@docusaurus/plugin-content-pages": 3.7.0 + "@docusaurus/plugin-debug": 3.7.0 + "@docusaurus/plugin-google-analytics": 3.7.0 + "@docusaurus/plugin-google-gtag": 3.7.0 + "@docusaurus/plugin-google-tag-manager": 3.7.0 + "@docusaurus/plugin-sitemap": 3.7.0 + "@docusaurus/plugin-svgr": 3.7.0 + "@docusaurus/theme-classic": 3.7.0 + "@docusaurus/theme-common": 3.7.0 + "@docusaurus/theme-search-algolia": 3.7.0 + "@docusaurus/types": 3.7.0 peerDependencies: - react: ^18.0.0 - react-dom: ^18.0.0 - checksum: 505b1adcc9f73ab992bfa8cbbc5c43ac9829630996df7d995a63529578bddf22fbdbd4d20f8e8f939e1be3957d20c6c8426ca4751c23c1dbeb0922a115dc210b + react: ^18.0.0 || ^19.0.0 + react-dom: ^18.0.0 || ^19.0.0 + checksum: 560205e072dc983705b6794e22d546ced4a2a4589bc93c8be8c3962b37279e33f2580a72c7a3d2a4db74c955dffca1ece66c01645c3dea6287c2870bdbf005a0 languageName: node linkType: hard -"@docusaurus/remark-plugin-npm2yarn@npm:^3.2.1": - version: 3.6.1 - resolution: "@docusaurus/remark-plugin-npm2yarn@npm:3.6.1" +"@docusaurus/remark-plugin-npm2yarn@npm:~3.7.0": + version: 3.7.0 + resolution: "@docusaurus/remark-plugin-npm2yarn@npm:3.7.0" dependencies: mdast-util-mdx: ^3.0.0 npm-to-yarn: ^3.0.0 tslib: ^2.6.0 unified: ^11.0.3 unist-util-visit: ^5.0.0 - checksum: 5df3aa21cda38cc586ebd9261249856f7f0d64857682b732b4e1b7c9955ce0e61b78ba052d5736e6434275b19ecb7e2a519b57b8b987ebe190ae6531d93d3665 - languageName: node - linkType: hard - -"@docusaurus/theme-classic@npm:3.6.1": - version: 3.6.1 - resolution: "@docusaurus/theme-classic@npm:3.6.1" - dependencies: - "@docusaurus/core": 3.6.1 - "@docusaurus/logger": 3.6.1 - "@docusaurus/mdx-loader": 3.6.1 - "@docusaurus/module-type-aliases": 3.6.1 - "@docusaurus/plugin-content-blog": 3.6.1 - "@docusaurus/plugin-content-docs": 3.6.1 - "@docusaurus/plugin-content-pages": 3.6.1 - "@docusaurus/theme-common": 3.6.1 - "@docusaurus/theme-translations": 3.6.1 - "@docusaurus/types": 3.6.1 - "@docusaurus/utils": 3.6.1 - "@docusaurus/utils-common": 3.6.1 - "@docusaurus/utils-validation": 3.6.1 + checksum: 30c87a41b7ca67d10f983adb83c3a53d78f3a6d637a8d60e433f3899d5e1af754e91dab4405ac86a153232725b6307b08e217b7afe50ce45e88bc7c264711eb7 + languageName: node + linkType: hard + +"@docusaurus/theme-classic@npm:3.7.0": + version: 3.7.0 + resolution: "@docusaurus/theme-classic@npm:3.7.0" + dependencies: + "@docusaurus/core": 3.7.0 + "@docusaurus/logger": 3.7.0 + "@docusaurus/mdx-loader": 3.7.0 + "@docusaurus/module-type-aliases": 3.7.0 + "@docusaurus/plugin-content-blog": 3.7.0 + "@docusaurus/plugin-content-docs": 3.7.0 + "@docusaurus/plugin-content-pages": 3.7.0 + "@docusaurus/theme-common": 3.7.0 + "@docusaurus/theme-translations": 3.7.0 + "@docusaurus/types": 3.7.0 + "@docusaurus/utils": 3.7.0 + "@docusaurus/utils-common": 3.7.0 + "@docusaurus/utils-validation": 3.7.0 "@mdx-js/react": ^3.0.0 clsx: ^2.0.0 copy-text-to-clipboard: ^3.2.0 @@ -2696,20 +3151,20 @@ __metadata: tslib: ^2.6.0 utility-types: ^3.10.0 peerDependencies: - react: ^18.0.0 - react-dom: ^18.0.0 - checksum: ce9d10911163db2da3ed0c5e0de721e47b4fbd5e3254a14a899a789b4c4e0242f3417b84ae3054c80c495c85c6e05cba95d0dcad1c2c05a5f4a187b808224703 + react: ^18.0.0 || ^19.0.0 + react-dom: ^18.0.0 || ^19.0.0 + checksum: 2a6029657e4f0221adfe53ed44f770a48bcccf4cf7668af6b51e0e18d7b330d5bfe32865fbf86bd9c793a2598be4a4e65693c929f17a66ac3f555e0ce6d14992 languageName: node linkType: hard -"@docusaurus/theme-common@npm:3.6.1, @docusaurus/theme-common@npm:^3.2.1": - version: 3.6.1 - resolution: "@docusaurus/theme-common@npm:3.6.1" +"@docusaurus/theme-common@npm:3.7.0, @docusaurus/theme-common@npm:~3.7.0": + version: 3.7.0 + resolution: "@docusaurus/theme-common@npm:3.7.0" dependencies: - "@docusaurus/mdx-loader": 3.6.1 - "@docusaurus/module-type-aliases": 3.6.1 - "@docusaurus/utils": 3.6.1 - "@docusaurus/utils-common": 3.6.1 + "@docusaurus/mdx-loader": 3.7.0 + "@docusaurus/module-type-aliases": 3.7.0 + "@docusaurus/utils": 3.7.0 + "@docusaurus/utils-common": 3.7.0 "@types/history": ^4.7.11 "@types/react": "*" "@types/react-router-config": "*" @@ -2720,26 +3175,26 @@ __metadata: utility-types: ^3.10.0 peerDependencies: "@docusaurus/plugin-content-docs": "*" - react: ^18.0.0 - react-dom: ^18.0.0 - checksum: 60421104901a49f3e795894337ccd85a04d41bd406385e13dfef63e2485e390fe63e4f89f076b27ff7c61bea64ac464872a6e6f6edc695a5fb2be8709f7e6b2d - languageName: node - linkType: hard - -"@docusaurus/theme-search-algolia@npm:3.6.1": - version: 3.6.1 - resolution: "@docusaurus/theme-search-algolia@npm:3.6.1" - dependencies: - "@docsearch/react": ^3.5.2 - "@docusaurus/core": 3.6.1 - "@docusaurus/logger": 3.6.1 - "@docusaurus/plugin-content-docs": 3.6.1 - "@docusaurus/theme-common": 3.6.1 - "@docusaurus/theme-translations": 3.6.1 - "@docusaurus/utils": 3.6.1 - "@docusaurus/utils-validation": 3.6.1 - algoliasearch: ^4.18.0 - algoliasearch-helper: ^3.13.3 + react: ^18.0.0 || ^19.0.0 + react-dom: ^18.0.0 || ^19.0.0 + checksum: 7b5c7db66185066b1b4f8394595bcb7b3869b925199def22b382ebb0fbb44e4d40c293abdd8fb719fc299169d6e0fa3f305c6f25af1b5839ab8186f7383eb749 + languageName: node + linkType: hard + +"@docusaurus/theme-search-algolia@npm:3.7.0": + version: 3.7.0 + resolution: "@docusaurus/theme-search-algolia@npm:3.7.0" + dependencies: + "@docsearch/react": ^3.8.1 + "@docusaurus/core": 3.7.0 + "@docusaurus/logger": 3.7.0 + "@docusaurus/plugin-content-docs": 3.7.0 + "@docusaurus/theme-common": 3.7.0 + "@docusaurus/theme-translations": 3.7.0 + "@docusaurus/utils": 3.7.0 + "@docusaurus/utils-validation": 3.7.0 + algoliasearch: ^5.17.1 + algoliasearch-helper: ^3.22.6 clsx: ^2.0.0 eta: ^2.2.0 fs-extra: ^11.1.1 @@ -2747,76 +3202,75 @@ __metadata: tslib: ^2.6.0 utility-types: ^3.10.0 peerDependencies: - react: ^18.0.0 - react-dom: ^18.0.0 - checksum: 48bf03f57b7f6f1ccdf949691a6d897a38fb289fe4cefd3e0af25ce961543ca5566f5e91369da31749445a0397ef0e4092b61aca52ede9d31540f5a0c3a21411 + react: ^18.0.0 || ^19.0.0 + react-dom: ^18.0.0 || ^19.0.0 + checksum: 9910c63abadcce7a1fc05c45a91560c9f792e724ad5a78a26c13d0ba37dab6f306daa8be5be63ae5d3f26f941b059777c0901519c84fe42ad42042f6fcaa7e65 languageName: node linkType: hard -"@docusaurus/theme-translations@npm:3.6.1": - version: 3.6.1 - resolution: "@docusaurus/theme-translations@npm:3.6.1" +"@docusaurus/theme-translations@npm:3.7.0": + version: 3.7.0 + resolution: "@docusaurus/theme-translations@npm:3.7.0" dependencies: fs-extra: ^11.1.1 tslib: ^2.6.0 - checksum: 8a784297b5d9abbad1841b6ff64f5f5a5066be45742316f71f2862d76f72230307a3fa2efd75256bb47cba3ed14d84a26c6625205dab2b945803cf7b48ac09ec + checksum: 800166bc415efd5be73e268de2a3da040a477ce47b296684fecc698f61a1175a971c196a418934f663db5892a1aa217e47351959f443e647092fae00798f994d languageName: node linkType: hard -"@docusaurus/types@npm:3.6.1": - version: 3.6.1 - resolution: "@docusaurus/types@npm:3.6.1" +"@docusaurus/types@npm:3.7.0": + version: 3.7.0 + resolution: "@docusaurus/types@npm:3.7.0" dependencies: "@mdx-js/mdx": ^3.0.0 "@types/history": ^4.7.11 "@types/react": "*" commander: ^5.1.0 joi: ^17.9.2 - react-helmet-async: ^1.3.0 + react-helmet-async: "npm:@slorber/react-helmet-async@1.3.0" utility-types: ^3.10.0 webpack: ^5.95.0 webpack-merge: ^5.9.0 peerDependencies: - react: ^18.0.0 - react-dom: ^18.0.0 - checksum: 17f667d4f64021fabe019277965b18878dc588852c4d11cf275afdad05aeee5ef482fe0ab993764a2779b9be4bf861c9e32fcd535fe2e65f7d9112746674a369 + react: ^18.0.0 || ^19.0.0 + react-dom: ^18.0.0 || ^19.0.0 + checksum: 0757f6dd1879a25cb60ffdf1886746d03a30d7dc01d5adb036a18da3977f4a0a2bcbbc057f0db43cb60f0412179d31eaba5073004880a146fa3fcb2ce10ad99d languageName: node linkType: hard -"@docusaurus/utils-common@npm:3.6.1": - version: 3.6.1 - resolution: "@docusaurus/utils-common@npm:3.6.1" +"@docusaurus/utils-common@npm:3.7.0": + version: 3.7.0 + resolution: "@docusaurus/utils-common@npm:3.7.0" dependencies: - "@docusaurus/types": 3.6.1 + "@docusaurus/types": 3.7.0 tslib: ^2.6.0 - checksum: 822b8be36fc05a239e0336d8b2deba4f92f52407e63bbdcf50e424dc89d33cad4254b1da4d4ceadff530faa6e2916258e4c061c9791d77584bdd525971670b1f + checksum: 3938f9fada19a641009c3a5517b754a1ba4e9f8aa3edaff27ba24cfd927c234fb0e598ab076c4abf82537fc09976a547d18a00b7e97e9b704d7784102dc500a5 languageName: node linkType: hard -"@docusaurus/utils-validation@npm:3.6.1": - version: 3.6.1 - resolution: "@docusaurus/utils-validation@npm:3.6.1" +"@docusaurus/utils-validation@npm:3.7.0": + version: 3.7.0 + resolution: "@docusaurus/utils-validation@npm:3.7.0" dependencies: - "@docusaurus/logger": 3.6.1 - "@docusaurus/utils": 3.6.1 - "@docusaurus/utils-common": 3.6.1 + "@docusaurus/logger": 3.7.0 + "@docusaurus/utils": 3.7.0 + "@docusaurus/utils-common": 3.7.0 fs-extra: ^11.2.0 joi: ^17.9.2 js-yaml: ^4.1.0 lodash: ^4.17.21 tslib: ^2.6.0 - checksum: 45b8e1341ec053fc9daca50534f89306940933dd663a151b04e699feeb109e46b612f85edcf269d67df221dcdedc35dc7ad911b092a0bcb0248d80333fe03eb2 + checksum: b5f1e4ce126e5f08ad190b2e09504f4530408ad06f33798625827fa635199a5c781cb89edafba5402aefc0001a1896d949013b46d1d37d6506e82eaa1353abdf languageName: node linkType: hard -"@docusaurus/utils@npm:3.6.1": - version: 3.6.1 - resolution: "@docusaurus/utils@npm:3.6.1" +"@docusaurus/utils@npm:3.7.0": + version: 3.7.0 + resolution: "@docusaurus/utils@npm:3.7.0" dependencies: - "@docusaurus/logger": 3.6.1 - "@docusaurus/types": 3.6.1 - "@docusaurus/utils-common": 3.6.1 - "@svgr/webpack": ^8.1.0 + "@docusaurus/logger": 3.7.0 + "@docusaurus/types": 3.7.0 + "@docusaurus/utils-common": 3.7.0 escape-string-regexp: ^4.0.0 file-loader: ^6.2.0 fs-extra: ^11.1.1 @@ -2834,53 +3288,55 @@ __metadata: url-loader: ^4.1.1 utility-types: ^3.10.0 webpack: ^5.88.1 - checksum: 82c5806880351623f7347f5419e4eff407f22bea9bda53b3f88275a2437632bf381158f58f2569bd58a7373e764bfea45a26c0f7b0bcfc676db3c815d80cdef7 + checksum: c488addc4e605200149976f95695fd0a567d502b1bcc8d0c0b042cdee5860223f2e46df6b0f2d13aa349c15a1c28c3dcb9eef5e6e0758e6881c70102f967acb2 languageName: node linkType: hard -"@dual-bundle/import-meta-resolve@npm:^4.1.0": - version: 4.1.0 - resolution: "@dual-bundle/import-meta-resolve@npm:4.1.0" - checksum: 8a79576624d66f3ee578cb4cd7f7dac9282dc4c6f757c7c1f4c364fdbabc99584e1407e49e1ef00c0b42dab01d1f8490ec1d08a02c1238bad657a7335303d462 +"@dual-bundle/import-meta-resolve@npm:^4.2.1": + version: 4.2.1 + resolution: "@dual-bundle/import-meta-resolve@npm:4.2.1" + checksum: ac1021d2200fe67234d7916a25cd525c2fa323a7bc535d22b7917521f53c4cea70c50e0aeea3bdafb796824281c03f83bea017454b4623a0a0b048ca82161067 languageName: node linkType: hard -"@emnapi/core@npm:^1.1.0": - version: 1.2.0 - resolution: "@emnapi/core@npm:1.2.0" +"@emnapi/core@npm:^1.1.0, @emnapi/core@npm:^1.5.0": + version: 1.5.0 + resolution: "@emnapi/core@npm:1.5.0" dependencies: - "@emnapi/wasi-threads": 1.0.1 + "@emnapi/wasi-threads": 1.1.0 tslib: ^2.4.0 - checksum: b3b61bd01de93346f05803151eee9dc308262065034d835db95a46842ea75867c43745c227577f19fa0542fcb3883a752477eb012bf9e4b72f540f4e23f63cbe + checksum: 089a506a4f6a2416b9917050802c20ac76b350b1160116482c3542cf89cd707c832ca18c163ddac4e9cb1df06f02e6cd324cadc60b82aed27d51e0baca1f4b4f languageName: node linkType: hard -"@emnapi/runtime@npm:^1.1.0": - version: 1.2.0 - resolution: "@emnapi/runtime@npm:1.2.0" +"@emnapi/runtime@npm:^1.1.0, @emnapi/runtime@npm:^1.5.0": + version: 1.5.0 + resolution: "@emnapi/runtime@npm:1.5.0" dependencies: tslib: ^2.4.0 - checksum: c9f5814f65a7851eda3fae96320b7ebfaf3b7e0db4e1ac2d77b55f5c0785e56b459a029413dbfc0abb1b23f059b850169888f92833150a28cdf24b9a53e535c5 + checksum: 03b23bdc0bb72bce4d8967ca29d623c2599af18977975c10532577db2ec89a57d97d2c76c5c4bde856c7c29302b9f7af357e921c42bd952bdda206972185819a languageName: node linkType: hard -"@emnapi/wasi-threads@npm:1.0.1": - version: 1.0.1 - resolution: "@emnapi/wasi-threads@npm:1.0.1" +"@emnapi/wasi-threads@npm:1.1.0": + version: 1.1.0 + resolution: "@emnapi/wasi-threads@npm:1.1.0" dependencies: tslib: ^2.4.0 - checksum: e154880440ff9bfe67b417f30134f0ff6fee28913dbf4a22de2e67dda5bf5b51055647c5d1565281df17ef5dfcc89256546bdf9b8ccfd07e07566617e7ce1498 + checksum: 6cffe35f3e407ae26236092991786db5968b4265e6e55f4664bf6f2ce0508e2a02a44ce6ebb16f2acd2f6589efb293f4f9d09cc9fbf80c00fc1a203accc94196 languageName: node linkType: hard -"@es-joy/jsdoccomment@npm:~0.49.0": - version: 0.49.0 - resolution: "@es-joy/jsdoccomment@npm:0.49.0" +"@es-joy/jsdoccomment@npm:~0.50.2": + version: 0.50.2 + resolution: "@es-joy/jsdoccomment@npm:0.50.2" dependencies: + "@types/estree": ^1.0.6 + "@typescript-eslint/types": ^8.11.0 comment-parser: 1.4.1 esquery: ^1.6.0 jsdoc-type-pratt-parser: ~4.1.0 - checksum: 19f99097ceb5a3495843c3276d598cfb4e3287c5d1d809817fb28fc8352b16ef23eaa8d964fd7b0379c6466d0a591f579e51d25434ab709ff59f6650fa166dbf + checksum: 5bbbc4e6f85a729c3353d3cb395a4b4766a405ce6228994b662cb2c755060f07ee45e507c091b8f8d6c4fdc805d017f1ff6ec2686afa54c8bd4e91c480ab932b languageName: node linkType: hard @@ -2891,16 +3347,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/aix-ppc64@npm:0.25.3": - version: 0.25.3 - resolution: "@esbuild/aix-ppc64@npm:0.25.3" - conditions: os=aix & cpu=ppc64 - languageName: node - linkType: hard - -"@esbuild/aix-ppc64@npm:0.25.4": - version: 0.25.4 - resolution: "@esbuild/aix-ppc64@npm:0.25.4" +"@esbuild/aix-ppc64@npm:0.25.5": + version: 0.25.5 + resolution: "@esbuild/aix-ppc64@npm:0.25.5" conditions: os=aix & cpu=ppc64 languageName: node linkType: hard @@ -2912,16 +3361,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/android-arm64@npm:0.25.3": - version: 0.25.3 - resolution: "@esbuild/android-arm64@npm:0.25.3" - conditions: os=android & cpu=arm64 - languageName: node - linkType: hard - -"@esbuild/android-arm64@npm:0.25.4": - version: 0.25.4 - resolution: "@esbuild/android-arm64@npm:0.25.4" +"@esbuild/android-arm64@npm:0.25.5": + version: 0.25.5 + resolution: "@esbuild/android-arm64@npm:0.25.5" conditions: os=android & cpu=arm64 languageName: node linkType: hard @@ -2933,16 +3375,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/android-arm@npm:0.25.3": - version: 0.25.3 - resolution: "@esbuild/android-arm@npm:0.25.3" - conditions: os=android & cpu=arm - languageName: node - linkType: hard - -"@esbuild/android-arm@npm:0.25.4": - version: 0.25.4 - resolution: "@esbuild/android-arm@npm:0.25.4" +"@esbuild/android-arm@npm:0.25.5": + version: 0.25.5 + resolution: "@esbuild/android-arm@npm:0.25.5" conditions: os=android & cpu=arm languageName: node linkType: hard @@ -2954,16 +3389,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/android-x64@npm:0.25.3": - version: 0.25.3 - resolution: "@esbuild/android-x64@npm:0.25.3" - conditions: os=android & cpu=x64 - languageName: node - linkType: hard - -"@esbuild/android-x64@npm:0.25.4": - version: 0.25.4 - resolution: "@esbuild/android-x64@npm:0.25.4" +"@esbuild/android-x64@npm:0.25.5": + version: 0.25.5 + resolution: "@esbuild/android-x64@npm:0.25.5" conditions: os=android & cpu=x64 languageName: node linkType: hard @@ -2975,16 +3403,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/darwin-arm64@npm:0.25.3": - version: 0.25.3 - resolution: "@esbuild/darwin-arm64@npm:0.25.3" - conditions: os=darwin & cpu=arm64 - languageName: node - linkType: hard - -"@esbuild/darwin-arm64@npm:0.25.4": - version: 0.25.4 - resolution: "@esbuild/darwin-arm64@npm:0.25.4" +"@esbuild/darwin-arm64@npm:0.25.5": + version: 0.25.5 + resolution: "@esbuild/darwin-arm64@npm:0.25.5" conditions: os=darwin & cpu=arm64 languageName: node linkType: hard @@ -2996,16 +3417,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/darwin-x64@npm:0.25.3": - version: 0.25.3 - resolution: "@esbuild/darwin-x64@npm:0.25.3" - conditions: os=darwin & cpu=x64 - languageName: node - linkType: hard - -"@esbuild/darwin-x64@npm:0.25.4": - version: 0.25.4 - resolution: "@esbuild/darwin-x64@npm:0.25.4" +"@esbuild/darwin-x64@npm:0.25.5": + version: 0.25.5 + resolution: "@esbuild/darwin-x64@npm:0.25.5" conditions: os=darwin & cpu=x64 languageName: node linkType: hard @@ -3017,16 +3431,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/freebsd-arm64@npm:0.25.3": - version: 0.25.3 - resolution: "@esbuild/freebsd-arm64@npm:0.25.3" - conditions: os=freebsd & cpu=arm64 - languageName: node - linkType: hard - -"@esbuild/freebsd-arm64@npm:0.25.4": - version: 0.25.4 - resolution: "@esbuild/freebsd-arm64@npm:0.25.4" +"@esbuild/freebsd-arm64@npm:0.25.5": + version: 0.25.5 + resolution: "@esbuild/freebsd-arm64@npm:0.25.5" conditions: os=freebsd & cpu=arm64 languageName: node linkType: hard @@ -3038,16 +3445,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/freebsd-x64@npm:0.25.3": - version: 0.25.3 - resolution: "@esbuild/freebsd-x64@npm:0.25.3" - conditions: os=freebsd & cpu=x64 - languageName: node - linkType: hard - -"@esbuild/freebsd-x64@npm:0.25.4": - version: 0.25.4 - resolution: "@esbuild/freebsd-x64@npm:0.25.4" +"@esbuild/freebsd-x64@npm:0.25.5": + version: 0.25.5 + resolution: "@esbuild/freebsd-x64@npm:0.25.5" conditions: os=freebsd & cpu=x64 languageName: node linkType: hard @@ -3059,16 +3459,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/linux-arm64@npm:0.25.3": - version: 0.25.3 - resolution: "@esbuild/linux-arm64@npm:0.25.3" - conditions: os=linux & cpu=arm64 - languageName: node - linkType: hard - -"@esbuild/linux-arm64@npm:0.25.4": - version: 0.25.4 - resolution: "@esbuild/linux-arm64@npm:0.25.4" +"@esbuild/linux-arm64@npm:0.25.5": + version: 0.25.5 + resolution: "@esbuild/linux-arm64@npm:0.25.5" conditions: os=linux & cpu=arm64 languageName: node linkType: hard @@ -3080,16 +3473,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/linux-arm@npm:0.25.3": - version: 0.25.3 - resolution: "@esbuild/linux-arm@npm:0.25.3" - conditions: os=linux & cpu=arm - languageName: node - linkType: hard - -"@esbuild/linux-arm@npm:0.25.4": - version: 0.25.4 - resolution: "@esbuild/linux-arm@npm:0.25.4" +"@esbuild/linux-arm@npm:0.25.5": + version: 0.25.5 + resolution: "@esbuild/linux-arm@npm:0.25.5" conditions: os=linux & cpu=arm languageName: node linkType: hard @@ -3101,16 +3487,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/linux-ia32@npm:0.25.3": - version: 0.25.3 - resolution: "@esbuild/linux-ia32@npm:0.25.3" - conditions: os=linux & cpu=ia32 - languageName: node - linkType: hard - -"@esbuild/linux-ia32@npm:0.25.4": - version: 0.25.4 - resolution: "@esbuild/linux-ia32@npm:0.25.4" +"@esbuild/linux-ia32@npm:0.25.5": + version: 0.25.5 + resolution: "@esbuild/linux-ia32@npm:0.25.5" conditions: os=linux & cpu=ia32 languageName: node linkType: hard @@ -3122,16 +3501,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/linux-loong64@npm:0.25.3": - version: 0.25.3 - resolution: "@esbuild/linux-loong64@npm:0.25.3" - conditions: os=linux & cpu=loong64 - languageName: node - linkType: hard - -"@esbuild/linux-loong64@npm:0.25.4": - version: 0.25.4 - resolution: "@esbuild/linux-loong64@npm:0.25.4" +"@esbuild/linux-loong64@npm:0.25.5": + version: 0.25.5 + resolution: "@esbuild/linux-loong64@npm:0.25.5" conditions: os=linux & cpu=loong64 languageName: node linkType: hard @@ -3143,16 +3515,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/linux-mips64el@npm:0.25.3": - version: 0.25.3 - resolution: "@esbuild/linux-mips64el@npm:0.25.3" - conditions: os=linux & cpu=mips64el - languageName: node - linkType: hard - -"@esbuild/linux-mips64el@npm:0.25.4": - version: 0.25.4 - resolution: "@esbuild/linux-mips64el@npm:0.25.4" +"@esbuild/linux-mips64el@npm:0.25.5": + version: 0.25.5 + resolution: "@esbuild/linux-mips64el@npm:0.25.5" conditions: os=linux & cpu=mips64el languageName: node linkType: hard @@ -3164,16 +3529,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/linux-ppc64@npm:0.25.3": - version: 0.25.3 - resolution: "@esbuild/linux-ppc64@npm:0.25.3" - conditions: os=linux & cpu=ppc64 - languageName: node - linkType: hard - -"@esbuild/linux-ppc64@npm:0.25.4": - version: 0.25.4 - resolution: "@esbuild/linux-ppc64@npm:0.25.4" +"@esbuild/linux-ppc64@npm:0.25.5": + version: 0.25.5 + resolution: "@esbuild/linux-ppc64@npm:0.25.5" conditions: os=linux & cpu=ppc64 languageName: node linkType: hard @@ -3185,16 +3543,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/linux-riscv64@npm:0.25.3": - version: 0.25.3 - resolution: "@esbuild/linux-riscv64@npm:0.25.3" - conditions: os=linux & cpu=riscv64 - languageName: node - linkType: hard - -"@esbuild/linux-riscv64@npm:0.25.4": - version: 0.25.4 - resolution: "@esbuild/linux-riscv64@npm:0.25.4" +"@esbuild/linux-riscv64@npm:0.25.5": + version: 0.25.5 + resolution: "@esbuild/linux-riscv64@npm:0.25.5" conditions: os=linux & cpu=riscv64 languageName: node linkType: hard @@ -3206,16 +3557,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/linux-s390x@npm:0.25.3": - version: 0.25.3 - resolution: "@esbuild/linux-s390x@npm:0.25.3" - conditions: os=linux & cpu=s390x - languageName: node - linkType: hard - -"@esbuild/linux-s390x@npm:0.25.4": - version: 0.25.4 - resolution: "@esbuild/linux-s390x@npm:0.25.4" +"@esbuild/linux-s390x@npm:0.25.5": + version: 0.25.5 + resolution: "@esbuild/linux-s390x@npm:0.25.5" conditions: os=linux & cpu=s390x languageName: node linkType: hard @@ -3227,30 +3571,16 @@ __metadata: languageName: node linkType: hard -"@esbuild/linux-x64@npm:0.25.3": - version: 0.25.3 - resolution: "@esbuild/linux-x64@npm:0.25.3" - conditions: os=linux & cpu=x64 - languageName: node - linkType: hard - -"@esbuild/linux-x64@npm:0.25.4": - version: 0.25.4 - resolution: "@esbuild/linux-x64@npm:0.25.4" +"@esbuild/linux-x64@npm:0.25.5": + version: 0.25.5 + resolution: "@esbuild/linux-x64@npm:0.25.5" conditions: os=linux & cpu=x64 languageName: node linkType: hard -"@esbuild/netbsd-arm64@npm:0.25.3": - version: 0.25.3 - resolution: "@esbuild/netbsd-arm64@npm:0.25.3" - conditions: os=netbsd & cpu=arm64 - languageName: node - linkType: hard - -"@esbuild/netbsd-arm64@npm:0.25.4": - version: 0.25.4 - resolution: "@esbuild/netbsd-arm64@npm:0.25.4" +"@esbuild/netbsd-arm64@npm:0.25.5": + version: 0.25.5 + resolution: "@esbuild/netbsd-arm64@npm:0.25.5" conditions: os=netbsd & cpu=arm64 languageName: node linkType: hard @@ -3262,30 +3592,16 @@ __metadata: languageName: node linkType: hard -"@esbuild/netbsd-x64@npm:0.25.3": - version: 0.25.3 - resolution: "@esbuild/netbsd-x64@npm:0.25.3" +"@esbuild/netbsd-x64@npm:0.25.5": + version: 0.25.5 + resolution: "@esbuild/netbsd-x64@npm:0.25.5" conditions: os=netbsd & cpu=x64 languageName: node linkType: hard -"@esbuild/netbsd-x64@npm:0.25.4": - version: 0.25.4 - resolution: "@esbuild/netbsd-x64@npm:0.25.4" - conditions: os=netbsd & cpu=x64 - languageName: node - linkType: hard - -"@esbuild/openbsd-arm64@npm:0.25.3": - version: 0.25.3 - resolution: "@esbuild/openbsd-arm64@npm:0.25.3" - conditions: os=openbsd & cpu=arm64 - languageName: node - linkType: hard - -"@esbuild/openbsd-arm64@npm:0.25.4": - version: 0.25.4 - resolution: "@esbuild/openbsd-arm64@npm:0.25.4" +"@esbuild/openbsd-arm64@npm:0.25.5": + version: 0.25.5 + resolution: "@esbuild/openbsd-arm64@npm:0.25.5" conditions: os=openbsd & cpu=arm64 languageName: node linkType: hard @@ -3297,16 +3613,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/openbsd-x64@npm:0.25.3": - version: 0.25.3 - resolution: "@esbuild/openbsd-x64@npm:0.25.3" - conditions: os=openbsd & cpu=x64 - languageName: node - linkType: hard - -"@esbuild/openbsd-x64@npm:0.25.4": - version: 0.25.4 - resolution: "@esbuild/openbsd-x64@npm:0.25.4" +"@esbuild/openbsd-x64@npm:0.25.5": + version: 0.25.5 + resolution: "@esbuild/openbsd-x64@npm:0.25.5" conditions: os=openbsd & cpu=x64 languageName: node linkType: hard @@ -3318,16 +3627,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/sunos-x64@npm:0.25.3": - version: 0.25.3 - resolution: "@esbuild/sunos-x64@npm:0.25.3" - conditions: os=sunos & cpu=x64 - languageName: node - linkType: hard - -"@esbuild/sunos-x64@npm:0.25.4": - version: 0.25.4 - resolution: "@esbuild/sunos-x64@npm:0.25.4" +"@esbuild/sunos-x64@npm:0.25.5": + version: 0.25.5 + resolution: "@esbuild/sunos-x64@npm:0.25.5" conditions: os=sunos & cpu=x64 languageName: node linkType: hard @@ -3339,16 +3641,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/win32-arm64@npm:0.25.3": - version: 0.25.3 - resolution: "@esbuild/win32-arm64@npm:0.25.3" - conditions: os=win32 & cpu=arm64 - languageName: node - linkType: hard - -"@esbuild/win32-arm64@npm:0.25.4": - version: 0.25.4 - resolution: "@esbuild/win32-arm64@npm:0.25.4" +"@esbuild/win32-arm64@npm:0.25.5": + version: 0.25.5 + resolution: "@esbuild/win32-arm64@npm:0.25.5" conditions: os=win32 & cpu=arm64 languageName: node linkType: hard @@ -3360,16 +3655,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/win32-ia32@npm:0.25.3": - version: 0.25.3 - resolution: "@esbuild/win32-ia32@npm:0.25.3" - conditions: os=win32 & cpu=ia32 - languageName: node - linkType: hard - -"@esbuild/win32-ia32@npm:0.25.4": - version: 0.25.4 - resolution: "@esbuild/win32-ia32@npm:0.25.4" +"@esbuild/win32-ia32@npm:0.25.5": + version: 0.25.5 + resolution: "@esbuild/win32-ia32@npm:0.25.5" conditions: os=win32 & cpu=ia32 languageName: node linkType: hard @@ -3381,16 +3669,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/win32-x64@npm:0.25.3": - version: 0.25.3 - resolution: "@esbuild/win32-x64@npm:0.25.3" - conditions: os=win32 & cpu=x64 - languageName: node - linkType: hard - -"@esbuild/win32-x64@npm:0.25.4": - version: 0.25.4 - resolution: "@esbuild/win32-x64@npm:0.25.4" +"@esbuild/win32-x64@npm:0.25.5": + version: 0.25.5 + resolution: "@esbuild/win32-x64@npm:0.25.5" conditions: os=win32 & cpu=x64 languageName: node linkType: hard @@ -3407,14 +3688,14 @@ __metadata: languageName: node linkType: hard -"@eslint-community/eslint-utils@npm:^4.2.0, @eslint-community/eslint-utils@npm:^4.4.0, @eslint-community/eslint-utils@npm:^4.5.1, @eslint-community/eslint-utils@npm:^4.7.0": - version: 4.7.0 - resolution: "@eslint-community/eslint-utils@npm:4.7.0" +"@eslint-community/eslint-utils@npm:^4.2.0, @eslint-community/eslint-utils@npm:^4.4.0, @eslint-community/eslint-utils@npm:^4.5.1, @eslint-community/eslint-utils@npm:^4.7.0, @eslint-community/eslint-utils@npm:^4.8.0": + version: 4.9.0 + resolution: "@eslint-community/eslint-utils@npm:4.9.0" dependencies: eslint-visitor-keys: ^3.4.3 peerDependencies: eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 - checksum: b177e3b75c0b8d0e5d71f1c532edb7e40b31313db61f0c879f9bf19c3abb2783c6c372b5deb2396dab4432f2946b9972122ac682e77010376c029dfd0149c681 + checksum: ae9b98eea006d1354368804b0116b8b45017a4e47b486d1b9cfa048a8ed3dc69b9b074eb2b2acb14034e6897c24048fd42b6a6816d9dc8bb9daad79db7d478d2 languageName: node linkType: hard @@ -3426,32 +3707,34 @@ __metadata: linkType: hard "@eslint/compat@npm:^1.2.4": - version: 1.2.4 - resolution: "@eslint/compat@npm:1.2.4" + version: 1.4.0 + resolution: "@eslint/compat@npm:1.4.0" + dependencies: + "@eslint/core": ^0.16.0 peerDependencies: - eslint: ^9.10.0 + eslint: ^8.40 || 9 peerDependenciesMeta: eslint: optional: true - checksum: d68b0e5d4f2890c86b439cd2e4c0f9c6e7eae09230a69cf80a0b647f7242ed5c662cc286a06d6eb06d95e3def62ed26e9e1eac494538d58b4e2cfc355d37c176 + checksum: 090882a61e3c8fa1911ff796f9cf13ed645139760cdecb2444dcb6c75a0d2f2a379e62b1e83586a13ece2280ed8a3acea9cc125acb99bc68012575918ac8f26d languageName: node linkType: hard -"@eslint/config-array@npm:^0.20.0": - version: 0.20.0 - resolution: "@eslint/config-array@npm:0.20.0" +"@eslint/config-array@npm:^0.21.0": + version: 0.21.0 + resolution: "@eslint/config-array@npm:0.21.0" dependencies: "@eslint/object-schema": ^2.1.6 debug: ^4.3.1 minimatch: ^3.1.2 - checksum: 55824ea31f0502166a6fea97176c9c25089a0354474cdc72a5f739b1cf6925f44f667bf8f4f3a9dabf1112ab0fa671778ca3f96f1499f31ec42caf84cae55005 + checksum: 84d3ae7cb755af94dc158a74389f4c560757b13f2bb908f598f927b87b70a38e8152015ea2e9557c1b4afc5130ee1356f6cad682050d67aae0468bbef98bc3a8 languageName: node linkType: hard -"@eslint/config-helpers@npm:^0.2.1": - version: 0.2.2 - resolution: "@eslint/config-helpers@npm:0.2.2" - checksum: 8a4091a2c8af5366513647ccad720f184c1b723f04c086755797a3a5cac69dc9013bc8a75453d9fc188fc4364460f0eae9f1584b77b28082e0d26bf48356ae8f +"@eslint/config-helpers@npm:^0.3.1": + version: 0.3.1 + resolution: "@eslint/config-helpers@npm:0.3.1" + checksum: b95c239264078a430761afb344402d517134289a7d8b69a6ff1378ebe5eec9da6ad22b5e6d193b9e02899aeda30817ac47178d5927247092cc6d73a52f8d07c9 languageName: node linkType: hard @@ -3464,6 +3747,24 @@ __metadata: languageName: node linkType: hard +"@eslint/core@npm:^0.15.2": + version: 0.15.2 + resolution: "@eslint/core@npm:0.15.2" + dependencies: + "@types/json-schema": ^7.0.15 + checksum: 535fc4e657760851826ceae325a72dde664b99189bd975715de3526db655c66d7a35b72dbb1c7641ab9201ed4e2130f79c5be51f96c820b5407c3766dcf94f23 + languageName: node + linkType: hard + +"@eslint/core@npm:^0.16.0": + version: 0.16.0 + resolution: "@eslint/core@npm:0.16.0" + dependencies: + "@types/json-schema": ^7.0.15 + checksum: 5c08dbf08aa27a6e057003a05a29f483038b70e59f9ac7af26938d0fa4627383c95768e2154835260607de34975e8f407c10762af9a005ed348cd8039cc6aede + languageName: node + linkType: hard + "@eslint/eslintrc@npm:^3.2.0, @eslint/eslintrc@npm:^3.3.1": version: 3.3.1 resolution: "@eslint/eslintrc@npm:3.3.1" @@ -3481,10 +3782,10 @@ __metadata: languageName: node linkType: hard -"@eslint/js@npm:*, @eslint/js@npm:9.26.0, @eslint/js@npm:^9.26.0": - version: 9.26.0 - resolution: "@eslint/js@npm:9.26.0" - checksum: 40d30f7e5c1585168fc552f953b824f822847d496340e9251e8812b5f401cee129799b3337386f0ea402048b66378c607889d6edf018e19453ae2bcdfc0e2de9 +"@eslint/js@npm:*, @eslint/js@npm:9.36.0, @eslint/js@npm:^9.26.0": + version: 9.36.0 + resolution: "@eslint/js@npm:9.36.0" + checksum: 17ff28272337357783b55e76417e61306e528dced99bb49d49e06298023b4071cb30f4aeb0bf30a337817d3eb3132784db6b8edd3a90118c5217833136712713 languageName: node linkType: hard @@ -3495,7 +3796,7 @@ __metadata: languageName: node linkType: hard -"@eslint/plugin-kit@npm:^0.2.7, @eslint/plugin-kit@npm:^0.2.8": +"@eslint/plugin-kit@npm:^0.2.7": version: 0.2.8 resolution: "@eslint/plugin-kit@npm:0.2.8" dependencies: @@ -3505,10 +3806,13 @@ __metadata: languageName: node linkType: hard -"@fastify/busboy@npm:^2.0.0": - version: 2.0.0 - resolution: "@fastify/busboy@npm:2.0.0" - checksum: 41879937ce1dee6421ef9cd4da53239830617e1f0bb7a0e843940772cd72827205d05e518af6adabe6e1ea19301285fff432b9d11bad01a531e698bea95c781b +"@eslint/plugin-kit@npm:^0.3.5": + version: 0.3.5 + resolution: "@eslint/plugin-kit@npm:0.3.5" + dependencies: + "@eslint/core": ^0.15.2 + levn: ^0.4.1 + checksum: 1808d7e2538335b8e4536ef372840e93468ecc6f4a5bf72ad665795290b6a8a72f51ef4ffd8bcfc601b133a5d5f67b59ab256d945f8c825c5c307aad29efaf86 languageName: node linkType: hard @@ -3579,6 +3883,22 @@ __metadata: languageName: node linkType: hard +"@isaacs/balanced-match@npm:^4.0.1": + version: 4.0.1 + resolution: "@isaacs/balanced-match@npm:4.0.1" + checksum: 102fbc6d2c0d5edf8f6dbf2b3feb21695a21bc850f11bc47c4f06aa83bd8884fde3fe9d6d797d619901d96865fdcb4569ac2a54c937992c48885c5e3d9967fe8 + languageName: node + linkType: hard + +"@isaacs/brace-expansion@npm:^5.0.0": + version: 5.0.0 + resolution: "@isaacs/brace-expansion@npm:5.0.0" + dependencies: + "@isaacs/balanced-match": ^4.0.1 + checksum: d7a3b8b0ddbf0ccd8eeb1300e29dd0a0c02147e823d8138f248375a365682360620895c66d113e05ee02389318c654379b0e538b996345b83c914941786705b1 + languageName: node + linkType: hard + "@isaacs/cliui@npm:^8.0.2": version: 8.0.2 resolution: "@isaacs/cliui@npm:8.0.2" @@ -3600,6 +3920,29 @@ __metadata: languageName: node linkType: hard +"@jest/diff-sequences@npm:30.0.1": + version: 30.0.1 + resolution: "@jest/diff-sequences@npm:30.0.1" + checksum: e5f931ca69c15a9b3a9b23b723f51ffc97f031b2f3ca37f901333dab99bd4dfa1ad4192a5cd893cd1272f7602eb09b9cfb5fc6bb62a0232c96fb8b5e96094970 + languageName: node + linkType: hard + +"@jest/get-type@npm:30.1.0": + version: 30.1.0 + resolution: "@jest/get-type@npm:30.1.0" + checksum: e2a95fbb49ce2d15547db8af5602626caf9b05f62a5e583b4a2de9bd93a2bfe7175f9bbb2b8a5c3909ce261d467b6991d7265bb1d547cb60e7e97f571f361a70 + languageName: node + linkType: hard + +"@jest/schemas@npm:30.0.5": + version: 30.0.5 + resolution: "@jest/schemas@npm:30.0.5" + dependencies: + "@sinclair/typebox": ^0.34.0 + checksum: 7a4fc4166f688947c22d81e61aaf2cb22f178dbf6ee806b0931b75136899d426a72a8330762f27f0cf6f79da0d2a56f49a22fe09f5f80df95a683ed237a0f3b0 + languageName: node + linkType: hard + "@jest/schemas@npm:^29.6.3": version: 29.6.3 resolution: "@jest/schemas@npm:29.6.3" @@ -3623,14 +3966,13 @@ __metadata: languageName: node linkType: hard -"@jridgewell/gen-mapping@npm:^0.3.0, @jridgewell/gen-mapping@npm:^0.3.5": - version: 0.3.5 - resolution: "@jridgewell/gen-mapping@npm:0.3.5" +"@jridgewell/gen-mapping@npm:^0.3.0, @jridgewell/gen-mapping@npm:^0.3.12, @jridgewell/gen-mapping@npm:^0.3.5": + version: 0.3.13 + resolution: "@jridgewell/gen-mapping@npm:0.3.13" dependencies: - "@jridgewell/set-array": ^1.2.1 - "@jridgewell/sourcemap-codec": ^1.4.10 + "@jridgewell/sourcemap-codec": ^1.5.0 "@jridgewell/trace-mapping": ^0.3.24 - checksum: ff7a1764ebd76a5e129c8890aa3e2f46045109dabde62b0b6c6a250152227647178ff2069ea234753a690d8f3c4ac8b5e7b267bbee272bffb7f3b0a370ab6e52 + checksum: f2105acefc433337145caa3c84bba286de954f61c0bc46279bbd85a9e6a02871089717fa060413cfb6a9d44189fe8313b2d1cabf3a2eb3284d208fd5f75c54ff languageName: node linkType: hard @@ -3641,13 +3983,6 @@ __metadata: languageName: node linkType: hard -"@jridgewell/set-array@npm:^1.2.1": - version: 1.2.1 - resolution: "@jridgewell/set-array@npm:1.2.1" - checksum: 832e513a85a588f8ed4f27d1279420d8547743cc37fcad5a5a76fc74bb895b013dfe614d0eed9cb860048e6546b798f8f2652020b4b2ba0561b05caa8c654b10 - languageName: node - linkType: hard - "@jridgewell/source-map@npm:^0.3.3": version: 0.3.3 resolution: "@jridgewell/source-map@npm:0.3.3" @@ -3658,29 +3993,27 @@ __metadata: languageName: node linkType: hard -"@jridgewell/sourcemap-codec@npm:^1.4.10, @jridgewell/sourcemap-codec@npm:^1.4.14, @jridgewell/sourcemap-codec@npm:^1.5.0": +"@jridgewell/sourcemap-codec@npm:^1.4.14, @jridgewell/sourcemap-codec@npm:^1.5.0": version: 1.5.0 resolution: "@jridgewell/sourcemap-codec@npm:1.5.0" checksum: 05df4f2538b3b0f998ea4c1cd34574d0feba216fa5d4ccaef0187d12abf82eafe6021cec8b49f9bb4d90f2ba4582ccc581e72986a5fcf4176ae0cfeb04cf52ec languageName: node linkType: hard -"@jridgewell/trace-mapping@npm:^0.3.18, @jridgewell/trace-mapping@npm:^0.3.23, @jridgewell/trace-mapping@npm:^0.3.24, @jridgewell/trace-mapping@npm:^0.3.25, @jridgewell/trace-mapping@npm:^0.3.9": - version: 0.3.25 - resolution: "@jridgewell/trace-mapping@npm:0.3.25" +"@jridgewell/trace-mapping@npm:^0.3.18, @jridgewell/trace-mapping@npm:^0.3.23, @jridgewell/trace-mapping@npm:^0.3.24, @jridgewell/trace-mapping@npm:^0.3.25, @jridgewell/trace-mapping@npm:^0.3.28, @jridgewell/trace-mapping@npm:^0.3.29, @jridgewell/trace-mapping@npm:^0.3.9": + version: 0.3.30 + resolution: "@jridgewell/trace-mapping@npm:0.3.30" dependencies: "@jridgewell/resolve-uri": ^3.1.0 "@jridgewell/sourcemap-codec": ^1.4.14 - checksum: 9d3c40d225e139987b50c48988f8717a54a8c994d8a948ee42e1412e08988761d0754d7d10b803061cc3aebf35f92a5dbbab493bd0e1a9ef9e89a2130e83ba34 + checksum: 26edb94faf6f02df346e3657deff9df3f2f083195cbda62a6cf60204d548a0a6134454cbc3af8437392206a89dfb3e72782eaf78f49cbd8924400e55a6575e72 languageName: node linkType: hard -"@keyv/serialize@npm:^1.0.3": - version: 1.0.3 - resolution: "@keyv/serialize@npm:1.0.3" - dependencies: - buffer: ^6.0.3 - checksum: 5f7b90e8ae76d2a1850a1982cf382aea3ff7cef1f82bea793657e47d8f700609597f317607de07245b40c30b764a19fc7d4efa177d4dc42f6ed4d0a7b5f4e173 +"@keyv/serialize@npm:^1.1.0": + version: 1.1.0 + resolution: "@keyv/serialize@npm:1.1.0" + checksum: 84533dc994ff1b9585fb7593542f1d7a9746b843c13c9341a8d2feb2e1fc0136d42e0146f8ff751ad9decc64da4792538e270b95a126f6d0dbb48e349ee462ab languageName: node linkType: hard @@ -3734,37 +4067,37 @@ __metadata: languageName: node linkType: hard -"@microsoft/api-extractor-model@npm:7.30.6": - version: 7.30.6 - resolution: "@microsoft/api-extractor-model@npm:7.30.6" +"@microsoft/api-extractor-model@npm:7.31.1": + version: 7.31.1 + resolution: "@microsoft/api-extractor-model@npm:7.31.1" dependencies: "@microsoft/tsdoc": ~0.15.1 "@microsoft/tsdoc-config": ~0.17.1 - "@rushstack/node-core-library": 5.13.1 - checksum: a32873a942bab369aa3e7ee8842df8d91285f1a73e78278b650d7c23fb6edcf2cd067b7ff75cc79e873d6c09fff9cf3f144a69e967c053d93ae2da36026c2d77 + "@rushstack/node-core-library": 5.17.0 + checksum: 8d70dbc73822c97bf678686b40ce7fb2dd2e2a5151e4a96a5fe59bc33b3b4e53c43fb1543bd7af1ab8157ee81bb069554d37849916842fde355e22b02a514194 languageName: node linkType: hard "@microsoft/api-extractor@npm:^7.47.11": - version: 7.52.7 - resolution: "@microsoft/api-extractor@npm:7.52.7" + version: 7.53.1 + resolution: "@microsoft/api-extractor@npm:7.53.1" dependencies: - "@microsoft/api-extractor-model": 7.30.6 + "@microsoft/api-extractor-model": 7.31.1 "@microsoft/tsdoc": ~0.15.1 "@microsoft/tsdoc-config": ~0.17.1 - "@rushstack/node-core-library": 5.13.1 - "@rushstack/rig-package": 0.5.3 - "@rushstack/terminal": 0.15.3 - "@rushstack/ts-command-line": 5.0.1 + "@rushstack/node-core-library": 5.17.0 + "@rushstack/rig-package": 0.6.0 + "@rushstack/terminal": 0.19.1 + "@rushstack/ts-command-line": 5.1.1 lodash: ~4.17.15 - minimatch: ~3.0.3 + minimatch: 10.0.3 resolve: ~1.22.1 semver: ~7.5.4 source-map: ~0.6.1 typescript: 5.8.2 bin: api-extractor: bin/api-extractor - checksum: 1daf0d72e471f5934385b2f656016b23e3a9ca93287c1159d3422cdd9e9af5f4ffaf1f122cd77fa7622eff5d520f35e7426cb8f2430def1ad4cd88ecf52475d8 + checksum: 6111b26fd9340876eafaaf45f8676530de96e98b0a27adba7fc2818574244b8299519c7197f57f31340d750c784fa40bf6ec39741798c696b0a49de7caf6ea6f languageName: node linkType: hard @@ -3787,24 +4120,6 @@ __metadata: languageName: node linkType: hard -"@modelcontextprotocol/sdk@npm:^1.8.0": - version: 1.11.0 - resolution: "@modelcontextprotocol/sdk@npm:1.11.0" - dependencies: - content-type: ^1.0.5 - cors: ^2.8.5 - cross-spawn: ^7.0.3 - eventsource: ^3.0.2 - express: ^5.0.1 - express-rate-limit: ^7.5.0 - pkce-challenge: ^5.0.0 - raw-body: ^3.0.0 - zod: ^3.23.8 - zod-to-json-schema: ^3.24.1 - checksum: d0ab5cfac6eedc1c2a2bf63fec97021f174a8eb265e8f4189cfa353d4c267cd94359a819b8012e64f4e93ebc283546c2ecc3cb8034a3924b483b85595c5d24a0 - languageName: node - linkType: hard - "@napi-rs/wasm-runtime@npm:0.2.4": version: 0.2.4 resolution: "@napi-rs/wasm-runtime@npm:0.2.4" @@ -3816,6 +4131,17 @@ __metadata: languageName: node linkType: hard +"@napi-rs/wasm-runtime@npm:^1.0.7": + version: 1.0.7 + resolution: "@napi-rs/wasm-runtime@npm:1.0.7" + dependencies: + "@emnapi/core": ^1.5.0 + "@emnapi/runtime": ^1.5.0 + "@tybys/wasm-util": ^0.10.1 + checksum: 9b59bd8b7310936ed163935befae0613dfffd563e7ff021d4f1b62b419fb0e3395f7206b17460a91db555bea6c471408f3472455e4e2ca9f5a0bff4468fa38d0 + languageName: node + linkType: hard + "@nicolo-ribaudo/eslint-scope-5-internals@npm:5.1.1-v1": version: 5.1.1-v1 resolution: "@nicolo-ribaudo/eslint-scope-5-internals@npm:5.1.1-v1" @@ -3861,46 +4187,28 @@ __metadata: languageName: node linkType: hard -"@nx/devkit@npm:20.7.2": - version: 20.7.2 - resolution: "@nx/devkit@npm:20.7.2" +"@nx/devkit@npm:21.4.1": + version: 21.4.1 + resolution: "@nx/devkit@npm:21.4.1" dependencies: ejs: ^3.1.7 enquirer: ~2.3.6 ignore: ^5.0.4 minimatch: 9.0.3 + nx: 21.4.1 semver: ^7.5.3 tmp: ~0.2.1 tslib: ^2.3.0 yargs-parser: 21.1.1 peerDependencies: - nx: ">= 19 <= 21" - checksum: 178299551b1859deccb2ba3c561e064681f6b929eb4d50f2281e6790dc7abe6e9fb17917980fd66a2c769b3575fb0a3c906a414b7e5b86755f3265f7c574be22 + nx: ">= 20 <= 22" + checksum: 37797c3d785de1068b6ae5a646d8ac1e716ce691c4b05fba489b9c89f432ce1ab716a3e27fe262f8d75cdcdec0a576594b34bee7d61c6b1a94d2ca9f9cfe83ed languageName: node linkType: hard -"@nx/eslint@npm:20.7.2": - version: 20.7.2 - resolution: "@nx/eslint@npm:20.7.2" - dependencies: - "@nx/devkit": 20.7.2 - "@nx/js": 20.7.2 - semver: ^7.5.3 - tslib: ^2.3.0 - typescript: ~5.7.2 - peerDependencies: - "@zkochan/js-yaml": 0.0.7 - eslint: ^8.0.0 || ^9.0.0 - peerDependenciesMeta: - "@zkochan/js-yaml": - optional: true - checksum: 5a926f39bd51fa356d9a3bdc37f99057103de54f0a727afa1f891589fa7f1f0df4272e644fb174877f7fe43a559368a5e1cbf200630d2a89587a5869ba88accd - languageName: node - linkType: hard - -"@nx/js@npm:20.7.2": - version: 20.7.2 - resolution: "@nx/js@npm:20.7.2" +"@nx/js@npm:21.4.1": + version: 21.4.1 + resolution: "@nx/js@npm:21.4.1" dependencies: "@babel/core": ^7.23.2 "@babel/plugin-proposal-decorators": ^7.22.7 @@ -3909,8 +4217,8 @@ __metadata: "@babel/preset-env": ^7.23.2 "@babel/preset-typescript": ^7.22.5 "@babel/runtime": ^7.22.6 - "@nx/devkit": 20.7.2 - "@nx/workspace": 20.7.2 + "@nx/devkit": 21.4.1 + "@nx/workspace": 21.4.1 "@zkochan/js-yaml": 0.0.7 babel-plugin-const-enum: ^1.0.1 babel-plugin-macros: ^3.1.0 @@ -3936,218 +4244,249 @@ __metadata: peerDependenciesMeta: verdaccio: optional: true - checksum: 05253f77916d8f524c3cef7295f1e44e1aa99514ebbffea06bff832b9055fccc9aa35a1b2ee477803513c829985c8891bbf305d14993c1a1579d74fc4a5be798 + checksum: 5fc495473f2c522da73c7be62f0f59824bbf321dc6f151e2e3d9d23271a496c4a9f9f978c518843899046218334d3b44e2072277661572f952c8bc0a0b2f2674 languageName: node linkType: hard -"@nx/nx-darwin-arm64@npm:20.7.2": - version: 20.7.2 - resolution: "@nx/nx-darwin-arm64@npm:20.7.2" +"@nx/nx-darwin-arm64@npm:21.4.1": + version: 21.4.1 + resolution: "@nx/nx-darwin-arm64@npm:21.4.1" conditions: os=darwin & cpu=arm64 languageName: node linkType: hard -"@nx/nx-darwin-x64@npm:20.7.2": - version: 20.7.2 - resolution: "@nx/nx-darwin-x64@npm:20.7.2" +"@nx/nx-darwin-x64@npm:21.4.1": + version: 21.4.1 + resolution: "@nx/nx-darwin-x64@npm:21.4.1" conditions: os=darwin & cpu=x64 languageName: node linkType: hard -"@nx/nx-freebsd-x64@npm:20.7.2": - version: 20.7.2 - resolution: "@nx/nx-freebsd-x64@npm:20.7.2" +"@nx/nx-freebsd-x64@npm:21.4.1": + version: 21.4.1 + resolution: "@nx/nx-freebsd-x64@npm:21.4.1" conditions: os=freebsd & cpu=x64 languageName: node linkType: hard -"@nx/nx-linux-arm-gnueabihf@npm:20.7.2": - version: 20.7.2 - resolution: "@nx/nx-linux-arm-gnueabihf@npm:20.7.2" +"@nx/nx-linux-arm-gnueabihf@npm:21.4.1": + version: 21.4.1 + resolution: "@nx/nx-linux-arm-gnueabihf@npm:21.4.1" conditions: os=linux & cpu=arm languageName: node linkType: hard -"@nx/nx-linux-arm64-gnu@npm:20.7.2": - version: 20.7.2 - resolution: "@nx/nx-linux-arm64-gnu@npm:20.7.2" +"@nx/nx-linux-arm64-gnu@npm:21.4.1": + version: 21.4.1 + resolution: "@nx/nx-linux-arm64-gnu@npm:21.4.1" conditions: os=linux & cpu=arm64 & libc=glibc languageName: node linkType: hard -"@nx/nx-linux-arm64-musl@npm:20.7.2": - version: 20.7.2 - resolution: "@nx/nx-linux-arm64-musl@npm:20.7.2" +"@nx/nx-linux-arm64-musl@npm:21.4.1": + version: 21.4.1 + resolution: "@nx/nx-linux-arm64-musl@npm:21.4.1" conditions: os=linux & cpu=arm64 & libc=musl languageName: node linkType: hard -"@nx/nx-linux-x64-gnu@npm:20.7.2": - version: 20.7.2 - resolution: "@nx/nx-linux-x64-gnu@npm:20.7.2" +"@nx/nx-linux-x64-gnu@npm:21.4.1": + version: 21.4.1 + resolution: "@nx/nx-linux-x64-gnu@npm:21.4.1" conditions: os=linux & cpu=x64 & libc=glibc languageName: node linkType: hard -"@nx/nx-linux-x64-musl@npm:20.7.2": - version: 20.7.2 - resolution: "@nx/nx-linux-x64-musl@npm:20.7.2" +"@nx/nx-linux-x64-musl@npm:21.4.1": + version: 21.4.1 + resolution: "@nx/nx-linux-x64-musl@npm:21.4.1" conditions: os=linux & cpu=x64 & libc=musl languageName: node linkType: hard -"@nx/nx-win32-arm64-msvc@npm:20.7.2": - version: 20.7.2 - resolution: "@nx/nx-win32-arm64-msvc@npm:20.7.2" +"@nx/nx-win32-arm64-msvc@npm:21.4.1": + version: 21.4.1 + resolution: "@nx/nx-win32-arm64-msvc@npm:21.4.1" conditions: os=win32 & cpu=arm64 languageName: node linkType: hard -"@nx/nx-win32-x64-msvc@npm:20.7.2": - version: 20.7.2 - resolution: "@nx/nx-win32-x64-msvc@npm:20.7.2" +"@nx/nx-win32-x64-msvc@npm:21.4.1": + version: 21.4.1 + resolution: "@nx/nx-win32-x64-msvc@npm:21.4.1" conditions: os=win32 & cpu=x64 languageName: node linkType: hard -"@nx/vite@npm:20.7.2": - version: 20.7.2 - resolution: "@nx/vite@npm:20.7.2" +"@nx/vite@npm:21.4.1": + version: 21.4.1 + resolution: "@nx/vite@npm:21.4.1" dependencies: - "@nx/devkit": 20.7.2 - "@nx/js": 20.7.2 + "@nx/devkit": 21.4.1 + "@nx/js": 21.4.1 "@phenomnomnominal/tsquery": ~5.0.1 - "@swc/helpers": ~0.5.0 + ajv: ^8.0.0 enquirer: ~2.3.6 - minimatch: 9.0.3 + picomatch: 4.0.2 semver: ^7.6.3 tsconfig-paths: ^4.1.2 + tslib: ^2.3.0 peerDependencies: vite: ^5.0.0 || ^6.0.0 vitest: ^1.3.1 || ^2.0.0 || ^3.0.0 - checksum: 978cc4e8039177ad78bbf305df733c437ea5c74530f6b1efa173e8dce2ca2d781c5ab824ad11ed78a1d6da7959f02a0b8ce0ff42c405a451867247acae595548 + checksum: 40311ee8134f484d32785087c3bfc5bec250e956b6098bd42613add7342b0fe2fa385286e427e120f744835daf58bbf7b7dff32dcb07ee046ed2b11ea8eadc46 + languageName: node + linkType: hard + +"@nx/workspace@npm:21.4.1": + version: 21.4.1 + resolution: "@nx/workspace@npm:21.4.1" + dependencies: + "@nx/devkit": 21.4.1 + "@zkochan/js-yaml": 0.0.7 + chalk: ^4.1.0 + enquirer: ~2.3.6 + nx: 21.4.1 + picomatch: 4.0.2 + semver: ^7.6.3 + tslib: ^2.3.0 + yargs-parser: 21.1.1 + checksum: fab3ca1f4c780191e5b8855df7a36dd687a6413de89677f11d4b89517421288db26a3d01d2d76fc1ceb551171a6cb72706dfa780ad408ec038d94311e4bb75eb + languageName: node + linkType: hard + +"@oxc-resolver/binding-android-arm-eabi@npm:11.13.1": + version: 11.13.1 + resolution: "@oxc-resolver/binding-android-arm-eabi@npm:11.13.1" + conditions: os=android & cpu=arm + languageName: node + linkType: hard + +"@oxc-resolver/binding-android-arm64@npm:11.13.1": + version: 11.13.1 + resolution: "@oxc-resolver/binding-android-arm64@npm:11.13.1" + conditions: os=android & cpu=arm64 + languageName: node + linkType: hard + +"@oxc-resolver/binding-darwin-arm64@npm:11.13.1": + version: 11.13.1 + resolution: "@oxc-resolver/binding-darwin-arm64@npm:11.13.1" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + +"@oxc-resolver/binding-darwin-x64@npm:11.13.1": + version: 11.13.1 + resolution: "@oxc-resolver/binding-darwin-x64@npm:11.13.1" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + +"@oxc-resolver/binding-freebsd-x64@npm:11.13.1": + version: 11.13.1 + resolution: "@oxc-resolver/binding-freebsd-x64@npm:11.13.1" + conditions: os=freebsd & cpu=x64 + languageName: node + linkType: hard + +"@oxc-resolver/binding-linux-arm-gnueabihf@npm:11.13.1": + version: 11.13.1 + resolution: "@oxc-resolver/binding-linux-arm-gnueabihf@npm:11.13.1" + conditions: os=linux & cpu=arm + languageName: node + linkType: hard + +"@oxc-resolver/binding-linux-arm-musleabihf@npm:11.13.1": + version: 11.13.1 + resolution: "@oxc-resolver/binding-linux-arm-musleabihf@npm:11.13.1" + conditions: os=linux & cpu=arm + languageName: node + linkType: hard + +"@oxc-resolver/binding-linux-arm64-gnu@npm:11.13.1": + version: 11.13.1 + resolution: "@oxc-resolver/binding-linux-arm64-gnu@npm:11.13.1" + conditions: os=linux & cpu=arm64 & libc=glibc languageName: node linkType: hard -"@nx/workspace@npm:20.7.2": - version: 20.7.2 - resolution: "@nx/workspace@npm:20.7.2" - dependencies: - "@nx/devkit": 20.7.2 - "@zkochan/js-yaml": 0.0.7 - chalk: ^4.1.0 - enquirer: ~2.3.6 - nx: 20.7.2 - picomatch: 4.0.2 - tslib: ^2.3.0 - yargs-parser: 21.1.1 - checksum: aeecc9dbbb864d64b3745a8ddb88ef5677b473b21cc8c308e3fbc7e2f064636fba75005df204b6306a4cbf22a733b82304e77655269a76ff8a445a962c369dc2 +"@oxc-resolver/binding-linux-arm64-musl@npm:11.13.1": + version: 11.13.1 + resolution: "@oxc-resolver/binding-linux-arm64-musl@npm:11.13.1" + conditions: os=linux & cpu=arm64 & libc=musl languageName: node linkType: hard -"@octokit/auth-token@npm:^4.0.0": - version: 4.0.0 - resolution: "@octokit/auth-token@npm:4.0.0" - checksum: d78f4dc48b214d374aeb39caec4fdbf5c1e4fd8b9fcb18f630b1fe2cbd5a880fca05445f32b4561f41262cb551746aeb0b49e89c95c6dd99299706684d0cae2f +"@oxc-resolver/binding-linux-ppc64-gnu@npm:11.13.1": + version: 11.13.1 + resolution: "@oxc-resolver/binding-linux-ppc64-gnu@npm:11.13.1" + conditions: os=linux & cpu=ppc64 & libc=glibc languageName: node linkType: hard -"@octokit/core@npm:^5.0.1": - version: 5.0.1 - resolution: "@octokit/core@npm:5.0.1" - dependencies: - "@octokit/auth-token": ^4.0.0 - "@octokit/graphql": ^7.0.0 - "@octokit/request": ^8.0.2 - "@octokit/request-error": ^5.0.0 - "@octokit/types": ^12.0.0 - before-after-hook: ^2.2.0 - universal-user-agent: ^6.0.0 - checksum: 257c5954074f9a1477e25014ce4ac96d73123744b1bfaf28eecb15fea306e2b8454bc6ffec3a0476dd02f76d2ac156b4f7c6aec7d3f7fac955d01f0d62d31e5d +"@oxc-resolver/binding-linux-riscv64-gnu@npm:11.13.1": + version: 11.13.1 + resolution: "@oxc-resolver/binding-linux-riscv64-gnu@npm:11.13.1" + conditions: os=linux & cpu=riscv64 & libc=glibc languageName: node linkType: hard -"@octokit/endpoint@npm:^9.0.0": - version: 9.0.1 - resolution: "@octokit/endpoint@npm:9.0.1" - dependencies: - "@octokit/types": ^12.0.0 - is-plain-object: ^5.0.0 - universal-user-agent: ^6.0.0 - checksum: 4f700c66829ed0b5ced3c0d018d63de1ecf1a267064095e450b6cfeb6abddecc704947d3f04e4921ac0d4d73595d81d52802d3306945ba7a642f1386fd8db68b +"@oxc-resolver/binding-linux-riscv64-musl@npm:11.13.1": + version: 11.13.1 + resolution: "@oxc-resolver/binding-linux-riscv64-musl@npm:11.13.1" + conditions: os=linux & cpu=riscv64 & libc=musl languageName: node linkType: hard -"@octokit/graphql@npm:^7.0.0": - version: 7.0.2 - resolution: "@octokit/graphql@npm:7.0.2" - dependencies: - "@octokit/request": ^8.0.1 - "@octokit/types": ^12.0.0 - universal-user-agent: ^6.0.0 - checksum: 05a752c4c2d84fc2900d8e32e1c2d1ee98a5a14349e651cb1109d0741e821e7417a048b1bb40918534ed90a472314aabbda35688868016f248098925f82a3bfa +"@oxc-resolver/binding-linux-s390x-gnu@npm:11.13.1": + version: 11.13.1 + resolution: "@oxc-resolver/binding-linux-s390x-gnu@npm:11.13.1" + conditions: os=linux & cpu=s390x & libc=glibc languageName: node linkType: hard -"@octokit/openapi-types@npm:^19.0.0": - version: 19.0.0 - resolution: "@octokit/openapi-types@npm:19.0.0" - checksum: 9a8125ab4e1651ca4b2f734cfa15ca52fe9fa0edd87696e4f57dfa2bcd472767f0f8a99b9324be21f863e6cd91afee423982189f97ac018f3c78a83560e616f5 +"@oxc-resolver/binding-linux-x64-gnu@npm:11.13.1": + version: 11.13.1 + resolution: "@oxc-resolver/binding-linux-x64-gnu@npm:11.13.1" + conditions: os=linux & cpu=x64 & libc=glibc languageName: node linkType: hard -"@octokit/plugin-paginate-rest@npm:^9.0.0": - version: 9.0.0 - resolution: "@octokit/plugin-paginate-rest@npm:9.0.0" - dependencies: - "@octokit/types": ^12.0.0 - peerDependencies: - "@octokit/core": ">=5" - checksum: 4a8543f3e45c4916f94edc57d66106ee60da9fd4edccd7c3a2ddd00da1fc4eb2e1b2bcb3d6cb981a050edf883100c5004d0b81497568d4ac9138310a2188a458 +"@oxc-resolver/binding-linux-x64-musl@npm:11.13.1": + version: 11.13.1 + resolution: "@oxc-resolver/binding-linux-x64-musl@npm:11.13.1" + conditions: os=linux & cpu=x64 & libc=musl languageName: node linkType: hard -"@octokit/plugin-rest-endpoint-methods@npm:^10.0.0": - version: 10.0.1 - resolution: "@octokit/plugin-rest-endpoint-methods@npm:10.0.1" +"@oxc-resolver/binding-wasm32-wasi@npm:11.13.1": + version: 11.13.1 + resolution: "@oxc-resolver/binding-wasm32-wasi@npm:11.13.1" dependencies: - "@octokit/types": ^12.0.0 - peerDependencies: - "@octokit/core": ">=5" - checksum: 4873a76976308dac3a6426d7f4fdd680568f05a3b511dbc47225b7f80feda39771f0cd104ef769dbb7c6fadd2af21a4eab0709f2547fa7f1b55cb9019d93b8e5 + "@napi-rs/wasm-runtime": ^1.0.7 + conditions: cpu=wasm32 languageName: node linkType: hard -"@octokit/request-error@npm:^5.0.0": - version: 5.0.1 - resolution: "@octokit/request-error@npm:5.0.1" - dependencies: - "@octokit/types": ^12.0.0 - deprecation: ^2.0.0 - once: ^1.4.0 - checksum: a681341e43b4da7a8acb19e1a6ba0355b1af146fa0191f2554a98950cf85f898af6ae3ab0b0287d6c871f5465ec57cb38363b96b5019f9f77ba6f30eca39ede5 +"@oxc-resolver/binding-win32-arm64-msvc@npm:11.13.1": + version: 11.13.1 + resolution: "@oxc-resolver/binding-win32-arm64-msvc@npm:11.13.1" + conditions: os=win32 & cpu=arm64 languageName: node linkType: hard -"@octokit/request@npm:^8.0.1, @octokit/request@npm:^8.0.2": - version: 8.1.4 - resolution: "@octokit/request@npm:8.1.4" - dependencies: - "@octokit/endpoint": ^9.0.0 - "@octokit/request-error": ^5.0.0 - "@octokit/types": ^12.0.0 - is-plain-object: ^5.0.0 - universal-user-agent: ^6.0.0 - checksum: 6a88389b45342c8d773fb157a24a4b06bda6f883e5e91923ea05bf417e1b211e006898c50cdd69c4bd054b65b10a6ca8862cf9eee9c0b07f9a1de8ef43d7d70d +"@oxc-resolver/binding-win32-ia32-msvc@npm:11.13.1": + version: 11.13.1 + resolution: "@oxc-resolver/binding-win32-ia32-msvc@npm:11.13.1" + conditions: os=win32 & cpu=ia32 languageName: node linkType: hard -"@octokit/types@npm:^12.0.0": - version: 12.0.0 - resolution: "@octokit/types@npm:12.0.0" - dependencies: - "@octokit/openapi-types": ^19.0.0 - checksum: ad55e13cbeef96a63d0088df2ed0a8f3ca764db3f877aa2ecb1693de40b03c1f8e392603bd7fddaaaa74138970ea39f46e4b830d15eeeba74be1671f36440129 +"@oxc-resolver/binding-win32-x64-msvc@npm:11.13.1": + version: 11.13.1 + resolution: "@oxc-resolver/binding-win32-x64-msvc@npm:11.13.1" + conditions: os=win32 & cpu=x64 languageName: node linkType: hard @@ -4169,13 +4508,6 @@ __metadata: languageName: node linkType: hard -"@pkgr/core@npm:^0.1.0": - version: 0.1.1 - resolution: "@pkgr/core@npm:0.1.1" - checksum: 6f25fd2e3008f259c77207ac9915b02f1628420403b2630c92a07ff963129238c9262afc9e84344c7a23b5cc1f3965e2cd17e3798219f5fd78a63d144d3cceba - languageName: node - linkType: hard - "@pnpm/config.env-replace@npm:^1.1.0": version: 1.1.0 resolution: "@pnpm/config.env-replace@npm:1.1.0" @@ -4210,14 +4542,14 @@ __metadata: languageName: node linkType: hard -"@prettier/sync@npm:^0.5.1": - version: 0.5.2 - resolution: "@prettier/sync@npm:0.5.2" +"@prettier/sync@npm:^0.6.1": + version: 0.6.1 + resolution: "@prettier/sync@npm:0.6.1" dependencies: - make-synchronized: ^0.2.8 + make-synchronized: ^0.8.0 peerDependencies: prettier: "*" - checksum: 172cdc62f4103b022f8e8d0a63839350d97bc51468ea476594bce651c2cda311e4810417f16a3c967941a8493a68468a5df27beea4c85eaeaa37e84be3acf399 + checksum: 2c53cd4ee718e2ebd2fb31aa5ec4773f743b9c29fcc6db6794dc3553bc87aa8fe7db47b51add6809cab655520b7550329d1cce2ca837f6f4643991eff44abad1 languageName: node linkType: hard @@ -4279,142 +4611,156 @@ __metadata: languageName: node linkType: hard -"@rollup/rollup-android-arm-eabi@npm:4.40.2": - version: 4.40.2 - resolution: "@rollup/rollup-android-arm-eabi@npm:4.40.2" +"@rollup/rollup-android-arm-eabi@npm:4.52.5": + version: 4.52.5 + resolution: "@rollup/rollup-android-arm-eabi@npm:4.52.5" conditions: os=android & cpu=arm languageName: node linkType: hard -"@rollup/rollup-android-arm64@npm:4.40.2": - version: 4.40.2 - resolution: "@rollup/rollup-android-arm64@npm:4.40.2" +"@rollup/rollup-android-arm64@npm:4.52.5": + version: 4.52.5 + resolution: "@rollup/rollup-android-arm64@npm:4.52.5" conditions: os=android & cpu=arm64 languageName: node linkType: hard -"@rollup/rollup-darwin-arm64@npm:4.40.2": - version: 4.40.2 - resolution: "@rollup/rollup-darwin-arm64@npm:4.40.2" +"@rollup/rollup-darwin-arm64@npm:4.52.5": + version: 4.52.5 + resolution: "@rollup/rollup-darwin-arm64@npm:4.52.5" conditions: os=darwin & cpu=arm64 languageName: node linkType: hard -"@rollup/rollup-darwin-x64@npm:4.40.2": - version: 4.40.2 - resolution: "@rollup/rollup-darwin-x64@npm:4.40.2" +"@rollup/rollup-darwin-x64@npm:4.52.5": + version: 4.52.5 + resolution: "@rollup/rollup-darwin-x64@npm:4.52.5" conditions: os=darwin & cpu=x64 languageName: node linkType: hard -"@rollup/rollup-freebsd-arm64@npm:4.40.2": - version: 4.40.2 - resolution: "@rollup/rollup-freebsd-arm64@npm:4.40.2" +"@rollup/rollup-freebsd-arm64@npm:4.52.5": + version: 4.52.5 + resolution: "@rollup/rollup-freebsd-arm64@npm:4.52.5" conditions: os=freebsd & cpu=arm64 languageName: node linkType: hard -"@rollup/rollup-freebsd-x64@npm:4.40.2": - version: 4.40.2 - resolution: "@rollup/rollup-freebsd-x64@npm:4.40.2" +"@rollup/rollup-freebsd-x64@npm:4.52.5": + version: 4.52.5 + resolution: "@rollup/rollup-freebsd-x64@npm:4.52.5" conditions: os=freebsd & cpu=x64 languageName: node linkType: hard -"@rollup/rollup-linux-arm-gnueabihf@npm:4.40.2": - version: 4.40.2 - resolution: "@rollup/rollup-linux-arm-gnueabihf@npm:4.40.2" +"@rollup/rollup-linux-arm-gnueabihf@npm:4.52.5": + version: 4.52.5 + resolution: "@rollup/rollup-linux-arm-gnueabihf@npm:4.52.5" conditions: os=linux & cpu=arm & libc=glibc languageName: node linkType: hard -"@rollup/rollup-linux-arm-musleabihf@npm:4.40.2": - version: 4.40.2 - resolution: "@rollup/rollup-linux-arm-musleabihf@npm:4.40.2" +"@rollup/rollup-linux-arm-musleabihf@npm:4.52.5": + version: 4.52.5 + resolution: "@rollup/rollup-linux-arm-musleabihf@npm:4.52.5" conditions: os=linux & cpu=arm & libc=musl languageName: node linkType: hard -"@rollup/rollup-linux-arm64-gnu@npm:4.40.2": - version: 4.40.2 - resolution: "@rollup/rollup-linux-arm64-gnu@npm:4.40.2" +"@rollup/rollup-linux-arm64-gnu@npm:4.52.5": + version: 4.52.5 + resolution: "@rollup/rollup-linux-arm64-gnu@npm:4.52.5" conditions: os=linux & cpu=arm64 & libc=glibc languageName: node linkType: hard -"@rollup/rollup-linux-arm64-musl@npm:4.40.2": - version: 4.40.2 - resolution: "@rollup/rollup-linux-arm64-musl@npm:4.40.2" +"@rollup/rollup-linux-arm64-musl@npm:4.52.5": + version: 4.52.5 + resolution: "@rollup/rollup-linux-arm64-musl@npm:4.52.5" conditions: os=linux & cpu=arm64 & libc=musl languageName: node linkType: hard -"@rollup/rollup-linux-loongarch64-gnu@npm:4.40.2": - version: 4.40.2 - resolution: "@rollup/rollup-linux-loongarch64-gnu@npm:4.40.2" +"@rollup/rollup-linux-loong64-gnu@npm:4.52.5": + version: 4.52.5 + resolution: "@rollup/rollup-linux-loong64-gnu@npm:4.52.5" conditions: os=linux & cpu=loong64 & libc=glibc languageName: node linkType: hard -"@rollup/rollup-linux-powerpc64le-gnu@npm:4.40.2": - version: 4.40.2 - resolution: "@rollup/rollup-linux-powerpc64le-gnu@npm:4.40.2" +"@rollup/rollup-linux-ppc64-gnu@npm:4.52.5": + version: 4.52.5 + resolution: "@rollup/rollup-linux-ppc64-gnu@npm:4.52.5" conditions: os=linux & cpu=ppc64 & libc=glibc languageName: node linkType: hard -"@rollup/rollup-linux-riscv64-gnu@npm:4.40.2": - version: 4.40.2 - resolution: "@rollup/rollup-linux-riscv64-gnu@npm:4.40.2" +"@rollup/rollup-linux-riscv64-gnu@npm:4.52.5": + version: 4.52.5 + resolution: "@rollup/rollup-linux-riscv64-gnu@npm:4.52.5" conditions: os=linux & cpu=riscv64 & libc=glibc languageName: node linkType: hard -"@rollup/rollup-linux-riscv64-musl@npm:4.40.2": - version: 4.40.2 - resolution: "@rollup/rollup-linux-riscv64-musl@npm:4.40.2" +"@rollup/rollup-linux-riscv64-musl@npm:4.52.5": + version: 4.52.5 + resolution: "@rollup/rollup-linux-riscv64-musl@npm:4.52.5" conditions: os=linux & cpu=riscv64 & libc=musl languageName: node linkType: hard -"@rollup/rollup-linux-s390x-gnu@npm:4.40.2": - version: 4.40.2 - resolution: "@rollup/rollup-linux-s390x-gnu@npm:4.40.2" +"@rollup/rollup-linux-s390x-gnu@npm:4.52.5": + version: 4.52.5 + resolution: "@rollup/rollup-linux-s390x-gnu@npm:4.52.5" conditions: os=linux & cpu=s390x & libc=glibc languageName: node linkType: hard -"@rollup/rollup-linux-x64-gnu@npm:4.40.2": - version: 4.40.2 - resolution: "@rollup/rollup-linux-x64-gnu@npm:4.40.2" +"@rollup/rollup-linux-x64-gnu@npm:4.52.5": + version: 4.52.5 + resolution: "@rollup/rollup-linux-x64-gnu@npm:4.52.5" conditions: os=linux & cpu=x64 & libc=glibc languageName: node linkType: hard -"@rollup/rollup-linux-x64-musl@npm:4.40.2": - version: 4.40.2 - resolution: "@rollup/rollup-linux-x64-musl@npm:4.40.2" +"@rollup/rollup-linux-x64-musl@npm:4.52.5": + version: 4.52.5 + resolution: "@rollup/rollup-linux-x64-musl@npm:4.52.5" conditions: os=linux & cpu=x64 & libc=musl languageName: node linkType: hard -"@rollup/rollup-win32-arm64-msvc@npm:4.40.2": - version: 4.40.2 - resolution: "@rollup/rollup-win32-arm64-msvc@npm:4.40.2" +"@rollup/rollup-openharmony-arm64@npm:4.52.5": + version: 4.52.5 + resolution: "@rollup/rollup-openharmony-arm64@npm:4.52.5" + conditions: os=openharmony & cpu=arm64 + languageName: node + linkType: hard + +"@rollup/rollup-win32-arm64-msvc@npm:4.52.5": + version: 4.52.5 + resolution: "@rollup/rollup-win32-arm64-msvc@npm:4.52.5" conditions: os=win32 & cpu=arm64 languageName: node linkType: hard -"@rollup/rollup-win32-ia32-msvc@npm:4.40.2": - version: 4.40.2 - resolution: "@rollup/rollup-win32-ia32-msvc@npm:4.40.2" +"@rollup/rollup-win32-ia32-msvc@npm:4.52.5": + version: 4.52.5 + resolution: "@rollup/rollup-win32-ia32-msvc@npm:4.52.5" conditions: os=win32 & cpu=ia32 languageName: node linkType: hard -"@rollup/rollup-win32-x64-msvc@npm:4.40.2": - version: 4.40.2 - resolution: "@rollup/rollup-win32-x64-msvc@npm:4.40.2" +"@rollup/rollup-win32-x64-gnu@npm:4.52.5": + version: 4.52.5 + resolution: "@rollup/rollup-win32-x64-gnu@npm:4.52.5" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + +"@rollup/rollup-win32-x64-msvc@npm:4.52.5": + version: 4.52.5 + resolution: "@rollup/rollup-win32-x64-msvc@npm:4.52.5" conditions: os=win32 & cpu=x64 languageName: node linkType: hard @@ -4426,9 +4772,9 @@ __metadata: languageName: node linkType: hard -"@rushstack/node-core-library@npm:5.13.1": - version: 5.13.1 - resolution: "@rushstack/node-core-library@npm:5.13.1" +"@rushstack/node-core-library@npm:5.17.0": + version: 5.17.0 + resolution: "@rushstack/node-core-library@npm:5.17.0" dependencies: ajv: ~8.13.0 ajv-draft-04: ~1.0.0 @@ -4443,44 +4789,57 @@ __metadata: peerDependenciesMeta: "@types/node": optional: true - checksum: 14ff5ddd4a43deeadfbcd5ec7288f2b5d2c56a17ca3ef1e94d0cad2095955294ca237c684f3f5d5a479885431601a79a865a04d51cbf6c09061dfc0db08a698d + checksum: 375c07898cc4684b2232119e4aa06924df5ce990a6a835915acc1310f047535f583a96d025c6fddb865c71ab8e5e3610b96c393cff0b3ec83058f06ff4113592 languageName: node linkType: hard -"@rushstack/rig-package@npm:0.5.3": - version: 0.5.3 - resolution: "@rushstack/rig-package@npm:0.5.3" +"@rushstack/problem-matcher@npm:0.1.1": + version: 0.1.1 + resolution: "@rushstack/problem-matcher@npm:0.1.1" + peerDependencies: + "@types/node": "*" + peerDependenciesMeta: + "@types/node": + optional: true + checksum: 0e4a6ec4e7fecb8942ca3bc513732cb0d18a1b24dc2017a39a284c7f065542133a17d86a8b9caf40035fca5d8eef2b22c4bee7b3da117ae48783c44456fef012 + languageName: node + linkType: hard + +"@rushstack/rig-package@npm:0.6.0": + version: 0.6.0 + resolution: "@rushstack/rig-package@npm:0.6.0" dependencies: resolve: ~1.22.1 strip-json-comments: ~3.1.1 - checksum: bf3eadfc434bff273893efd22b319fe159d0e3b95729cb32ce3ad9f4ab4b6fabe3c4dd7f03ee0ddc7b480f0d989e908349eae6d6dce3500f896728a085af7aab + checksum: ba3c860fc749a847ce50f18a83cdef50909f84c4e945306978bab22eae79e57d47411ab3f46835bd9fb55591d20773b4d1a438489897a3071e0f583633b624c6 languageName: node linkType: hard -"@rushstack/terminal@npm:0.15.3": - version: 0.15.3 - resolution: "@rushstack/terminal@npm:0.15.3" +"@rushstack/terminal@npm:0.19.1": + version: 0.19.1 + resolution: "@rushstack/terminal@npm:0.19.1" dependencies: - "@rushstack/node-core-library": 5.13.1 + "@rushstack/node-core-library": 5.17.0 + "@rushstack/problem-matcher": 0.1.1 supports-color: ~8.1.1 peerDependencies: "@types/node": "*" peerDependenciesMeta: "@types/node": optional: true - checksum: a87960058965cb6941120ae5a1e4efa0373fdbcb724ba8beddfb584d6c972baf917485f3bc25e3280fb283f0e80d857293cbf5a9c6d15475ec8dcb086ff0be48 + checksum: 106a55eef7336e74f2e98b0e4f7e04792e6ba03f263f9da9ee9fc9552926dd390947a29313e49d2162fd5617ea7f7e49fdf0394e4ea65727c7e9ac2cc537d408 languageName: node linkType: hard -"@rushstack/ts-command-line@npm:5.0.1": - version: 5.0.1 - resolution: "@rushstack/ts-command-line@npm:5.0.1" +"@rushstack/ts-command-line@npm:5.1.1": + version: 5.1.1 + resolution: "@rushstack/ts-command-line@npm:5.1.1" dependencies: - "@rushstack/terminal": 0.15.3 + "@rushstack/terminal": 0.19.1 "@types/argparse": 1.0.38 argparse: ~1.0.9 string-argv: ~0.3.1 - checksum: dd9fea3e0635b37736e424ab4b757214fcf8dd573064faa3e6ca889d90cff6ac57ca9c23c3834a6f56748b94d8ad336098e7911ead22148a9290dfa64f90f6ad + checksum: 7298df112849dd9c4da0b1363416d0a14908ff346205093f38be0bf1b38e5c0d94ec5f57912744bd3062f1958c86cb308c8acbe4c7829f47e42b65744416b478 languageName: node linkType: hard @@ -4559,7 +4918,14 @@ __metadata: languageName: node linkType: hard -"@sindresorhus/is@npm:^4.6.0": +"@sinclair/typebox@npm:^0.34.0": + version: 0.34.41 + resolution: "@sinclair/typebox@npm:0.34.41" + checksum: dbcfdc55caef47ef5b728c2bc6979e50d00ee943b63eaaf604551be9a039187cdd256d810b790e61fdf63131df54b236149aef739d83bfe9a594a9863ac28115 + languageName: node + linkType: hard + +"@sindresorhus/is@npm:^4.0.0, @sindresorhus/is@npm:^4.6.0": version: 4.6.0 resolution: "@sindresorhus/is@npm:4.6.0" checksum: 83839f13da2c29d55c97abc3bc2c55b250d33a0447554997a85c539e058e57b8da092da396e252b11ec24a0279a0bed1f537fa26302209327060643e327f81d2 @@ -4573,35 +4939,6 @@ __metadata: languageName: node linkType: hard -"@sinonjs/commons@npm:^3.0.1": - version: 3.0.1 - resolution: "@sinonjs/commons@npm:3.0.1" - dependencies: - type-detect: 4.0.8 - checksum: a7c3e7cc612352f4004873747d9d8b2d4d90b13a6d483f685598c945a70e734e255f1ca5dc49702515533c403b32725defff148177453b3f3915bcb60e9d4601 - languageName: node - linkType: hard - -"@sinonjs/fake-timers@npm:^13.0.5": - version: 13.0.5 - resolution: "@sinonjs/fake-timers@npm:13.0.5" - dependencies: - "@sinonjs/commons": ^3.0.1 - checksum: b1c6ba87fadb7666d3aa126c9e8b4ac32b2d9e84c9e5fd074aa24cab3c8342fd655459de014b08e603be1e6c24c9f9716d76d6d2a36c50f59bb0091be61601dd - languageName: node - linkType: hard - -"@sinonjs/samsam@npm:^8.0.1": - version: 8.0.2 - resolution: "@sinonjs/samsam@npm:8.0.2" - dependencies: - "@sinonjs/commons": ^3.0.1 - lodash.get: ^4.4.2 - type-detect: ^4.1.0 - checksum: 7dc24a388ea108e513c88edaaacf98cf4ebcbda8c715551b02954ce50db0e26d6071d98ba9594e737da7fe750079a2af94633d7d46ff1481cb940383b441f29b - languageName: node - linkType: hard - "@slorber/remark-comment@npm:^1.0.0": version: 1.0.0 resolution: "@slorber/remark-comment@npm:1.0.0" @@ -4781,94 +5118,94 @@ __metadata: languageName: node linkType: hard -"@swc/core-darwin-arm64@npm:1.11.7": - version: 1.11.7 - resolution: "@swc/core-darwin-arm64@npm:1.11.7" +"@swc/core-darwin-arm64@npm:1.15.0": + version: 1.15.0 + resolution: "@swc/core-darwin-arm64@npm:1.15.0" conditions: os=darwin & cpu=arm64 languageName: node linkType: hard -"@swc/core-darwin-x64@npm:1.11.7": - version: 1.11.7 - resolution: "@swc/core-darwin-x64@npm:1.11.7" +"@swc/core-darwin-x64@npm:1.15.0": + version: 1.15.0 + resolution: "@swc/core-darwin-x64@npm:1.15.0" conditions: os=darwin & cpu=x64 languageName: node linkType: hard -"@swc/core-linux-arm-gnueabihf@npm:1.11.7": - version: 1.11.7 - resolution: "@swc/core-linux-arm-gnueabihf@npm:1.11.7" +"@swc/core-linux-arm-gnueabihf@npm:1.15.0": + version: 1.15.0 + resolution: "@swc/core-linux-arm-gnueabihf@npm:1.15.0" conditions: os=linux & cpu=arm languageName: node linkType: hard -"@swc/core-linux-arm64-gnu@npm:1.11.7": - version: 1.11.7 - resolution: "@swc/core-linux-arm64-gnu@npm:1.11.7" +"@swc/core-linux-arm64-gnu@npm:1.15.0": + version: 1.15.0 + resolution: "@swc/core-linux-arm64-gnu@npm:1.15.0" conditions: os=linux & cpu=arm64 & libc=glibc languageName: node linkType: hard -"@swc/core-linux-arm64-musl@npm:1.11.7": - version: 1.11.7 - resolution: "@swc/core-linux-arm64-musl@npm:1.11.7" +"@swc/core-linux-arm64-musl@npm:1.15.0": + version: 1.15.0 + resolution: "@swc/core-linux-arm64-musl@npm:1.15.0" conditions: os=linux & cpu=arm64 & libc=musl languageName: node linkType: hard -"@swc/core-linux-x64-gnu@npm:1.11.7": - version: 1.11.7 - resolution: "@swc/core-linux-x64-gnu@npm:1.11.7" +"@swc/core-linux-x64-gnu@npm:1.15.0": + version: 1.15.0 + resolution: "@swc/core-linux-x64-gnu@npm:1.15.0" conditions: os=linux & cpu=x64 & libc=glibc languageName: node linkType: hard -"@swc/core-linux-x64-musl@npm:1.11.7": - version: 1.11.7 - resolution: "@swc/core-linux-x64-musl@npm:1.11.7" +"@swc/core-linux-x64-musl@npm:1.15.0": + version: 1.15.0 + resolution: "@swc/core-linux-x64-musl@npm:1.15.0" conditions: os=linux & cpu=x64 & libc=musl languageName: node linkType: hard -"@swc/core-win32-arm64-msvc@npm:1.11.7": - version: 1.11.7 - resolution: "@swc/core-win32-arm64-msvc@npm:1.11.7" +"@swc/core-win32-arm64-msvc@npm:1.15.0": + version: 1.15.0 + resolution: "@swc/core-win32-arm64-msvc@npm:1.15.0" conditions: os=win32 & cpu=arm64 languageName: node linkType: hard -"@swc/core-win32-ia32-msvc@npm:1.11.7": - version: 1.11.7 - resolution: "@swc/core-win32-ia32-msvc@npm:1.11.7" +"@swc/core-win32-ia32-msvc@npm:1.15.0": + version: 1.15.0 + resolution: "@swc/core-win32-ia32-msvc@npm:1.15.0" conditions: os=win32 & cpu=ia32 languageName: node linkType: hard -"@swc/core-win32-x64-msvc@npm:1.11.7": - version: 1.11.7 - resolution: "@swc/core-win32-x64-msvc@npm:1.11.7" +"@swc/core-win32-x64-msvc@npm:1.15.0": + version: 1.15.0 + resolution: "@swc/core-win32-x64-msvc@npm:1.15.0" conditions: os=win32 & cpu=x64 languageName: node linkType: hard "@swc/core@npm:^1.4.12": - version: 1.11.7 - resolution: "@swc/core@npm:1.11.7" - dependencies: - "@swc/core-darwin-arm64": 1.11.7 - "@swc/core-darwin-x64": 1.11.7 - "@swc/core-linux-arm-gnueabihf": 1.11.7 - "@swc/core-linux-arm64-gnu": 1.11.7 - "@swc/core-linux-arm64-musl": 1.11.7 - "@swc/core-linux-x64-gnu": 1.11.7 - "@swc/core-linux-x64-musl": 1.11.7 - "@swc/core-win32-arm64-msvc": 1.11.7 - "@swc/core-win32-ia32-msvc": 1.11.7 - "@swc/core-win32-x64-msvc": 1.11.7 + version: 1.15.0 + resolution: "@swc/core@npm:1.15.0" + dependencies: + "@swc/core-darwin-arm64": 1.15.0 + "@swc/core-darwin-x64": 1.15.0 + "@swc/core-linux-arm-gnueabihf": 1.15.0 + "@swc/core-linux-arm64-gnu": 1.15.0 + "@swc/core-linux-arm64-musl": 1.15.0 + "@swc/core-linux-x64-gnu": 1.15.0 + "@swc/core-linux-x64-musl": 1.15.0 + "@swc/core-win32-arm64-msvc": 1.15.0 + "@swc/core-win32-ia32-msvc": 1.15.0 + "@swc/core-win32-x64-msvc": 1.15.0 "@swc/counter": ^0.1.3 - "@swc/types": ^0.1.19 + "@swc/types": ^0.1.25 peerDependencies: - "@swc/helpers": "*" + "@swc/helpers": ">=0.5.17" dependenciesMeta: "@swc/core-darwin-arm64": optional: true @@ -4893,7 +5230,7 @@ __metadata: peerDependenciesMeta: "@swc/helpers": optional: true - checksum: 8c44fd46db23d468643a7bde65c3308f128fd1e460fa0307301e28cc75ab66760cbc81ff3548ac19e4c901d2194db5cee15b106db4cb70a1b44c592b8b5c0030 + checksum: eeb25e554526e8d19c509aa541c773f6eedfdc6a290b7bf0769b2847b4a35a4cc8a6dd31cc5b4153a2cfbcb40bd507ca902143528c3e453b236c19b52af03fa9 languageName: node linkType: hard @@ -4904,21 +5241,21 @@ __metadata: languageName: node linkType: hard -"@swc/helpers@npm:~0.5.0": - version: 0.5.17 - resolution: "@swc/helpers@npm:0.5.17" +"@swc/types@npm:^0.1.25": + version: 0.1.25 + resolution: "@swc/types@npm:0.1.25" dependencies: - tslib: ^2.8.0 - checksum: 085e13b536323945dfc3a270debf270bda6dfc80a1c68fd2ed08f7cbdfcbdaeead402650b5b10722e54e4a24193afc8a3c6f63d3d6d719974e7470557fb415bd + "@swc/counter": ^0.1.3 + checksum: 8e8ec73913aa42ee574c2a5a95fb6a95f19c5f011e66ed3faf773aa26f731e3f9a8b8e4d9e1887124166504253ee9e16d87f292e0ea1411d6170a4d1b327ba25 languageName: node linkType: hard -"@swc/types@npm:^0.1.19": - version: 0.1.19 - resolution: "@swc/types@npm:0.1.19" +"@szmarczak/http-timer@npm:^4.0.5": + version: 4.0.6 + resolution: "@szmarczak/http-timer@npm:4.0.6" dependencies: - "@swc/counter": ^0.1.3 - checksum: 167c64b6f7e0c595ba78e3d451215f1ed18eae11681703d3ae75e5b92a2198bbb1bf46824b6be2fe60a66d064316ab5d1e3487f8ef47db97362d96871962bf31 + defer-to-connect: ^2.0.0 + checksum: c29df3bcec6fc3bdec2b17981d89d9c9fc9bd7d0c9bcfe92821dc533f4440bc890ccde79971838b4ceed1921d456973c4180d7175ee1d0023ad0562240a58d95 languageName: node linkType: hard @@ -4945,6 +5282,15 @@ __metadata: languageName: node linkType: hard +"@tybys/wasm-util@npm:^0.10.1": + version: 0.10.1 + resolution: "@tybys/wasm-util@npm:0.10.1" + dependencies: + tslib: ^2.4.0 + checksum: b8b281ffa9cd01cb6d45a4dddca2e28fd0cb6ad67cf091ba4a73ac87c0d6bd6ce188c332c489e87c20b0750b0b6fe3b99e30e1cd2227ec16da692f51c778944e + languageName: node + linkType: hard + "@tybys/wasm-util@npm:^0.9.0": version: 0.9.0 resolution: "@tybys/wasm-util@npm:0.9.0" @@ -5037,6 +5383,27 @@ __metadata: languageName: node linkType: hard +"@types/cacheable-request@npm:^6.0.1": + version: 6.0.3 + resolution: "@types/cacheable-request@npm:6.0.3" + dependencies: + "@types/http-cache-semantics": "*" + "@types/keyv": ^3.1.4 + "@types/node": "*" + "@types/responselike": ^1.0.0 + checksum: d9b26403fe65ce6b0cb3720b7030104c352bcb37e4fac2a7089a25a97de59c355fa08940658751f2f347a8512aa9d18fdb66ab3ade835975b2f454f2d5befbd9 + languageName: node + linkType: hard + +"@types/chai@npm:^5.2.2": + version: 5.2.2 + resolution: "@types/chai@npm:5.2.2" + dependencies: + "@types/deep-eql": "*" + checksum: 386887bd55ba684572cececd833ed91aba6cce2edd8cc1d8cefa78800b3a74db6dbf5c5c41af041d1d1f3ce672ea30b45c9520f948cdc75431eb7df3fbba8405 + languageName: node + linkType: hard + "@types/connect-history-api-fallback@npm:^1.3.5": version: 1.3.5 resolution: "@types/connect-history-api-fallback@npm:1.3.5" @@ -5065,6 +5432,20 @@ __metadata: languageName: node linkType: hard +"@types/deep-eql@npm:*": + version: 4.0.2 + resolution: "@types/deep-eql@npm:4.0.2" + checksum: 249a27b0bb22f6aa28461db56afa21ec044fa0e303221a62dff81831b20c8530502175f1a49060f7099e7be06181078548ac47c668de79ff9880241968d43d0c + languageName: node + linkType: hard + +"@types/emscripten@npm:^1.39.6": + version: 1.41.2 + resolution: "@types/emscripten@npm:1.41.2" + checksum: b0321eb7211f23801e886a7fbbd12e105b357eea5bb32ab13617d8cd04946a48a80b34ee7fe075344e76859753af2279969f7a322dda23bfd328bcfdf339a100 + languageName: node + linkType: hard + "@types/eslint-plugin-jsx-a11y@npm:^6.10.0": version: 6.10.0 resolution: "@types/eslint-plugin-jsx-a11y@npm:6.10.0" @@ -5154,7 +5535,7 @@ __metadata: languageName: node linkType: hard -"@types/http-cache-semantics@npm:^4.0.2": +"@types/http-cache-semantics@npm:*, @types/http-cache-semantics@npm:^4.0.2": version: 4.0.4 resolution: "@types/http-cache-semantics@npm:4.0.4" checksum: 7f4dd832e618bc1e271be49717d7b4066d77c2d4eed5b81198eb987e532bb3e1c7e02f45d77918185bad936f884b700c10cebe06305f50400f382ab75055f9e8 @@ -5230,6 +5611,15 @@ __metadata: languageName: node linkType: hard +"@types/keyv@npm:^3.1.4": + version: 3.1.4 + resolution: "@types/keyv@npm:3.1.4" + dependencies: + "@types/node": "*" + checksum: e009a2bfb50e90ca9b7c6e8f648f8464067271fd99116f881073fa6fa76dc8d0133181dd65e6614d5fb1220d671d67b0124aef7d97dc02d7e342ab143a47779d + languageName: node + linkType: hard + "@types/lodash.merge@npm:4.6.9": version: 4.6.9 resolution: "@types/lodash.merge@npm:4.6.9" @@ -5293,11 +5683,11 @@ __metadata: linkType: hard "@types/node@npm:^22.0.0": - version: 22.15.3 - resolution: "@types/node@npm:22.15.3" + version: 22.18.0 + resolution: "@types/node@npm:22.18.0" dependencies: undici-types: ~6.21.0 - checksum: 26618a9fdfb84de3841e898b7c5fd372e1c0bdb9adc3ec71c12c38dd07d4e73da14681924919d27ff509ebf3714b8de941a21f51c26146cc8aaae31561ca7a5c + checksum: a110b66f079ea882be1e300e72978cd3a5e7be8217b362b72152e09f64087731a235a0557fca72d621912a8ba1347d9ba49468c35755dd2581edb7f3f6e016e2 languageName: node linkType: hard @@ -5387,6 +5777,15 @@ __metadata: languageName: node linkType: hard +"@types/responselike@npm:^1.0.0": + version: 1.0.3 + resolution: "@types/responselike@npm:1.0.3" + dependencies: + "@types/node": "*" + checksum: 6ac4b35723429b11b117e813c7acc42c3af8b5554caaf1fc750404c1ae59f9b7376bc69b9e9e194a5a97357a597c2228b7173d317320f0360d617b6425212f58 + languageName: node + linkType: hard + "@types/retry@npm:^0.12.0": version: 0.12.1 resolution: "@types/retry@npm:0.12.1" @@ -5403,10 +5802,10 @@ __metadata: languageName: node linkType: hard -"@types/semver@npm:^7.5.8": - version: 7.7.0 - resolution: "@types/semver@npm:7.7.0" - checksum: d488eaeddb23879a0a8a759bed667e1a76cb0dd4d23e3255538e24c189db387357953ca9e7a3bda2bb7f95e84cac8fe0db4fbe6b3456e893043337732d1d23cc +"@types/semver@npm:^7.1.0, @types/semver@npm:^7.5.8": + version: 7.7.1 + resolution: "@types/semver@npm:7.7.1" + checksum: 76d218e414482a398148d5c28f2bfa017108869f3fc18cda379c9d8d062348f8b9653ae2fa8642d3b5b52e211928fe8be34f22da4e1f08245c84e0e51e040673 languageName: node linkType: hard @@ -5438,6 +5837,13 @@ __metadata: languageName: node linkType: hard +"@types/treeify@npm:^1.0.0": + version: 1.0.3 + resolution: "@types/treeify@npm:1.0.3" + checksum: 777e579b30a916a781e7cbad2b7a76bc5473ff7bfe7167dd6de47f80f4386df5bf3d0dc34170afb75d52e75f6ed61cc109abf2324e093c1f9ecd4e79fec58d0c + languageName: node + linkType: hard + "@types/trusted-types@npm:^2.0.2": version: 2.0.2 resolution: "@types/trusted-types@npm:2.0.2" @@ -5491,6 +5897,7 @@ __metadata: "@babel/code-frame": ^7.24.2 "@babel/core": ^7.24.4 "@babel/eslint-parser": ^7.24.1 + "@babel/parser": ^7.24.1 "@microsoft/api-extractor": ^7.47.11 "@types/babel__code-frame": ^7.0.6 "@types/babel__core": ^7.20.5 @@ -5500,7 +5907,6 @@ __metadata: "@vitest/utils": ^3.1.3 eslint: "*" glob: "*" - prettier: ^3.2.5 rimraf: "*" typescript: "*" vitest: ^3.1.3 @@ -5511,31 +5917,32 @@ __metadata: version: 0.0.0-use.local resolution: "@typescript-eslint/eslint-plugin-internal@workspace:packages/eslint-plugin-internal" dependencies: - "@prettier/sync": ^0.5.1 + "@prettier/sync": ^0.6.1 "@typescript-eslint/rule-tester": "workspace:*" "@typescript-eslint/scope-manager": "workspace:*" "@typescript-eslint/type-utils": "workspace:*" "@typescript-eslint/utils": "workspace:*" "@vitest/coverage-v8": ^3.1.3 - prettier: ^3.2.5 + eslint: "*" + prettier: 3.6.2 rimraf: "*" vitest: ^3.1.3 languageName: unknown linkType: soft -"@typescript-eslint/eslint-plugin@8.32.1, @typescript-eslint/eslint-plugin@workspace:*, @typescript-eslint/eslint-plugin@workspace:^, @typescript-eslint/eslint-plugin@workspace:packages/eslint-plugin": +"@typescript-eslint/eslint-plugin@8.46.4, @typescript-eslint/eslint-plugin@workspace:*, @typescript-eslint/eslint-plugin@workspace:^, @typescript-eslint/eslint-plugin@workspace:packages/eslint-plugin": version: 0.0.0-use.local resolution: "@typescript-eslint/eslint-plugin@workspace:packages/eslint-plugin" dependencies: "@eslint-community/regexpp": ^4.10.0 "@types/mdast": ^4.0.3 "@types/natural-compare": "*" - "@typescript-eslint/rule-schema-to-typescript-types": 8.32.1 - "@typescript-eslint/rule-tester": 8.32.1 - "@typescript-eslint/scope-manager": 8.32.1 - "@typescript-eslint/type-utils": 8.32.1 - "@typescript-eslint/utils": 8.32.1 - "@typescript-eslint/visitor-keys": 8.32.1 + "@typescript-eslint/rule-schema-to-typescript-types": 8.46.4 + "@typescript-eslint/rule-tester": 8.46.4 + "@typescript-eslint/scope-manager": 8.46.4 + "@typescript-eslint/type-utils": 8.46.4 + "@typescript-eslint/utils": 8.46.4 + "@typescript-eslint/visitor-keys": 8.46.4 "@vitest/coverage-v8": ^3.1.3 ajv: ^6.12.6 cross-fetch: "*" @@ -5549,7 +5956,7 @@ __metadata: mdast-util-mdx: ^3.0.0 micromark-extension-mdxjs: ^3.0.0 natural-compare: ^1.4.0 - prettier: ^3.2.5 + prettier: 3.6.2 rimraf: "*" title-case: ^4.0.0 ts-api-utils: ^2.1.0 @@ -5558,9 +5965,9 @@ __metadata: unist-util-visit: ^5.0.0 vitest: ^3.1.3 peerDependencies: - "@typescript-eslint/parser": ^8.0.0 || ^8.0.0-alpha.0 + "@typescript-eslint/parser": ^8.46.4 eslint: ^8.57.0 || ^9.0.0 - typescript: ">=4.8.4 <5.9.0" + typescript: ">=4.8.4 <6.0.0" languageName: unknown linkType: soft @@ -5569,66 +5976,79 @@ __metadata: resolution: "@typescript-eslint/integration-tests@workspace:packages/integration-tests" dependencies: "@vitest/coverage-v8": ^3.1.3 + eslint: "*" vitest: ^3.1.3 languageName: unknown linkType: soft -"@typescript-eslint/parser@8.32.1, @typescript-eslint/parser@workspace:*, @typescript-eslint/parser@workspace:packages/parser": +"@typescript-eslint/parser@8.46.4, @typescript-eslint/parser@workspace:*, @typescript-eslint/parser@workspace:^, @typescript-eslint/parser@workspace:packages/parser": version: 0.0.0-use.local resolution: "@typescript-eslint/parser@workspace:packages/parser" dependencies: - "@typescript-eslint/scope-manager": 8.32.1 - "@typescript-eslint/types": 8.32.1 - "@typescript-eslint/typescript-estree": 8.32.1 - "@typescript-eslint/visitor-keys": 8.32.1 + "@typescript-eslint/scope-manager": 8.46.4 + "@typescript-eslint/types": 8.46.4 + "@typescript-eslint/typescript-estree": 8.46.4 + "@typescript-eslint/visitor-keys": 8.46.4 "@vitest/coverage-v8": ^3.1.3 debug: ^4.3.4 + eslint: "*" glob: "*" - prettier: ^3.2.5 rimraf: "*" typescript: "*" vitest: ^3.1.3 peerDependencies: eslint: ^8.57.0 || ^9.0.0 - typescript: ">=4.8.4 <5.9.0" + typescript: ">=4.8.4 <6.0.0" + languageName: unknown + linkType: soft + +"@typescript-eslint/project-service@8.46.4, @typescript-eslint/project-service@workspace:packages/project-service": + version: 0.0.0-use.local + resolution: "@typescript-eslint/project-service@workspace:packages/project-service" + dependencies: + "@typescript-eslint/tsconfig-utils": ^8.46.4 + "@typescript-eslint/types": ^8.46.4 + "@vitest/coverage-v8": ^3.1.3 + debug: ^4.3.4 + rimraf: "*" + typescript: "*" + vitest: ^3.1.3 + peerDependencies: + typescript: ">=4.8.4 <6.0.0" languageName: unknown linkType: soft -"@typescript-eslint/rule-schema-to-typescript-types@8.32.1, @typescript-eslint/rule-schema-to-typescript-types@workspace:*, @typescript-eslint/rule-schema-to-typescript-types@workspace:packages/rule-schema-to-typescript-types": +"@typescript-eslint/rule-schema-to-typescript-types@8.46.4, @typescript-eslint/rule-schema-to-typescript-types@workspace:*, @typescript-eslint/rule-schema-to-typescript-types@workspace:packages/rule-schema-to-typescript-types": version: 0.0.0-use.local resolution: "@typescript-eslint/rule-schema-to-typescript-types@workspace:packages/rule-schema-to-typescript-types" dependencies: - "@typescript-eslint/type-utils": 8.32.1 - "@typescript-eslint/utils": 8.32.1 + "@typescript-eslint/type-utils": 8.46.4 + "@typescript-eslint/utils": 8.46.4 "@vitest/coverage-v8": ^3.1.3 + eslint: "*" natural-compare: ^1.4.0 - prettier: ^3.2.5 + rimraf: "*" typescript: "*" vitest: ^3.1.3 languageName: unknown linkType: soft -"@typescript-eslint/rule-tester@8.32.1, @typescript-eslint/rule-tester@workspace:*, @typescript-eslint/rule-tester@workspace:packages/rule-tester": +"@typescript-eslint/rule-tester@8.46.4, @typescript-eslint/rule-tester@workspace:*, @typescript-eslint/rule-tester@workspace:packages/rule-tester": version: 0.0.0-use.local resolution: "@typescript-eslint/rule-tester@workspace:packages/rule-tester" dependencies: "@types/json-stable-stringify-without-jsonify": ^1.0.2 "@types/lodash.merge": 4.6.9 - "@typescript-eslint/parser": 8.32.1 - "@typescript-eslint/typescript-estree": 8.32.1 - "@typescript-eslint/utils": 8.32.1 + "@typescript-eslint/parser": 8.46.4 + "@typescript-eslint/typescript-estree": 8.46.4 + "@typescript-eslint/utils": 8.46.4 "@vitest/coverage-v8": ^3.1.3 ajv: ^6.12.6 - chai: ^5.2.0 - eslint-visitor-keys: ^4.2.0 - espree: ^10.3.0 - esprima: ^4.0.1 + eslint: "*" json-stable-stringify-without-jsonify: ^1.0.1 lodash.merge: 4.6.2 - mocha: ^11.0.0 + rimraf: "*" semver: ^7.6.0 - sinon: ^20.0.0 - source-map-support: ^0.5.21 typescript: "*" vitest: ^3.1.3 peerDependencies: @@ -5636,51 +6056,64 @@ __metadata: languageName: unknown linkType: soft -"@typescript-eslint/scope-manager@8.32.1, @typescript-eslint/scope-manager@workspace:*, @typescript-eslint/scope-manager@workspace:^, @typescript-eslint/scope-manager@workspace:packages/scope-manager": +"@typescript-eslint/scope-manager@8.46.4, @typescript-eslint/scope-manager@^8.46.1, @typescript-eslint/scope-manager@workspace:*, @typescript-eslint/scope-manager@workspace:^, @typescript-eslint/scope-manager@workspace:packages/scope-manager": version: 0.0.0-use.local resolution: "@typescript-eslint/scope-manager@workspace:packages/scope-manager" dependencies: - "@typescript-eslint/types": 8.32.1 - "@typescript-eslint/typescript-estree": 8.32.1 - "@typescript-eslint/visitor-keys": 8.32.1 + "@typescript-eslint/types": 8.46.4 + "@typescript-eslint/typescript-estree": 8.46.4 + "@typescript-eslint/visitor-keys": 8.46.4 "@vitest/coverage-v8": ^3.1.3 "@vitest/pretty-format": ^3.1.3 + eslint: "*" glob: "*" - prettier: ^3.2.5 rimraf: "*" typescript: "*" vitest: ^3.1.3 languageName: unknown linkType: soft -"@typescript-eslint/type-utils@8.32.1, @typescript-eslint/type-utils@workspace:*, @typescript-eslint/type-utils@workspace:packages/type-utils": +"@typescript-eslint/tsconfig-utils@8.46.4, @typescript-eslint/tsconfig-utils@^8.46.4, @typescript-eslint/tsconfig-utils@workspace:packages/tsconfig-utils": + version: 0.0.0-use.local + resolution: "@typescript-eslint/tsconfig-utils@workspace:packages/tsconfig-utils" + dependencies: + "@vitest/coverage-v8": ^3.1.3 + rimraf: "*" + typescript: "*" + vitest: ^3.1.3 + peerDependencies: + typescript: ">=4.8.4 <6.0.0" + languageName: unknown + linkType: soft + +"@typescript-eslint/type-utils@8.46.4, @typescript-eslint/type-utils@workspace:*, @typescript-eslint/type-utils@workspace:packages/type-utils": version: 0.0.0-use.local resolution: "@typescript-eslint/type-utils@workspace:packages/type-utils" dependencies: - "@typescript-eslint/parser": 8.32.1 - "@typescript-eslint/typescript-estree": 8.32.1 - "@typescript-eslint/utils": 8.32.1 + "@typescript-eslint/parser": 8.46.4 + "@typescript-eslint/types": 8.46.4 + "@typescript-eslint/typescript-estree": 8.46.4 + "@typescript-eslint/utils": 8.46.4 "@vitest/coverage-v8": ^3.1.3 ajv: ^6.12.6 debug: ^4.3.4 eslint: "*" - prettier: ^3.2.5 rimraf: "*" ts-api-utils: ^2.1.0 typescript: "*" vitest: ^3.1.3 peerDependencies: eslint: ^8.57.0 || ^9.0.0 - typescript: ">=4.8.4 <5.9.0" + typescript: ">=4.8.4 <6.0.0" languageName: unknown linkType: soft -"@typescript-eslint/types@8.32.1, @typescript-eslint/types@^8.9.0, @typescript-eslint/types@workspace:*, @typescript-eslint/types@workspace:^, @typescript-eslint/types@workspace:packages/types": +"@typescript-eslint/types@8.46.4, @typescript-eslint/types@^8.11.0, @typescript-eslint/types@^8.34.1, @typescript-eslint/types@^8.46.4, @typescript-eslint/types@workspace:*, @typescript-eslint/types@workspace:^, @typescript-eslint/types@workspace:packages/types": version: 0.0.0-use.local resolution: "@typescript-eslint/types@workspace:packages/types" dependencies: "@vitest/coverage-v8": ^3.1.3 - prettier: ^3.2.5 + eslint: "*" rimraf: "*" tsx: "*" typescript: "*" @@ -5692,16 +6125,14 @@ __metadata: version: 0.0.0-use.local resolution: "@typescript-eslint/typescript-eslint@workspace:." dependencies: - "@actions/core": ^1.10.1 - "@actions/github": ^6.0.0 "@eslint-community/eslint-plugin-eslint-comments": ^4.4.1 "@eslint/compat": ^1.2.4 "@eslint/eslintrc": ^3.2.0 "@eslint/js": ^9.26.0 - "@nx/devkit": 20.7.2 - "@nx/eslint": 20.7.2 - "@nx/vite": 20.7.2 - "@nx/workspace": 20.7.2 + "@nx/devkit": 21.4.1 + "@nx/js": 21.4.1 + "@nx/vite": 21.4.1 + "@nx/workspace": 21.4.1 "@swc/core": ^1.4.12 "@types/debug": ^4.1.12 "@types/eslint-plugin-jsx-a11y": ^6.10.0 @@ -5711,21 +6142,22 @@ __metadata: "@types/yargs": ^17.0.32 "@typescript-eslint/eslint-plugin": "workspace:^" "@typescript-eslint/eslint-plugin-internal": "workspace:^" + "@typescript-eslint/parser": "workspace:^" "@typescript-eslint/scope-manager": "workspace:^" "@typescript-eslint/types": "workspace:^" "@typescript-eslint/typescript-estree": "workspace:^" "@typescript-eslint/utils": "workspace:^" "@vitest/coverage-v8": ^3.1.3 - "@vitest/eslint-plugin": ^1.1.44 + "@vitest/eslint-plugin": ^1.3.9 console-fail-test: ^0.5.0 cross-fetch: ^4.0.0 cspell: ^9.0.0 eslint: ^9.26.0 - eslint-plugin-eslint-plugin: ^6.3.1 - eslint-plugin-import: ^2.31.0 + eslint-plugin-eslint-plugin: ^7.0.0 + eslint-plugin-import: ^2.32.0 eslint-plugin-jsdoc: ^50.5.0 eslint-plugin-jsx-a11y: ^6.10.2 - eslint-plugin-perfectionist: ^3.9.1 + eslint-plugin-perfectionist: ^4.12.3 eslint-plugin-react: ^7.37.3 eslint-plugin-react-hooks: ^5.0.0 eslint-plugin-regexp: ^2.7.0 @@ -5733,76 +6165,76 @@ __metadata: execa: 7.2.0 globals: ^16.0.0 husky: ^9.1.4 - jiti: 2.4.2 knip: ^5.41.1 lint-staged: ^15.2.2 - make-dir: ^4.0.0 - markdownlint-cli: ^0.44.0 - nx: 20.7.2 - prettier: 3.5.0 - pretty-format: ^29.7.0 + markdownlint-cli: ^0.45.0 + nx: 21.4.1 + prettier: 3.6.2 rimraf: ^5.0.5 semver: 7.7.0 tsx: "*" - typescript: ">=4.8.4 <5.9.0" + typescript: ">=4.8.4 <6.0.0" typescript-eslint: "workspace:^" vite: ^6.3.5 vitest: ^3.1.3 yargs: 17.7.2 + yarn-berry-deduplicate: ^6.1.3 languageName: unknown linkType: soft -"@typescript-eslint/typescript-estree@8.32.1, @typescript-eslint/typescript-estree@workspace:*, @typescript-eslint/typescript-estree@workspace:^, @typescript-eslint/typescript-estree@workspace:packages/typescript-estree": +"@typescript-eslint/typescript-estree@8.46.4, @typescript-eslint/typescript-estree@workspace:*, @typescript-eslint/typescript-estree@workspace:^, @typescript-eslint/typescript-estree@workspace:packages/typescript-estree": version: 0.0.0-use.local resolution: "@typescript-eslint/typescript-estree@workspace:packages/typescript-estree" dependencies: "@types/is-glob": ^4.0.4 - "@typescript-eslint/types": 8.32.1 - "@typescript-eslint/visitor-keys": 8.32.1 + "@typescript-eslint/project-service": 8.46.4 + "@typescript-eslint/tsconfig-utils": 8.46.4 + "@typescript-eslint/types": 8.46.4 + "@typescript-eslint/visitor-keys": 8.46.4 "@vitest/coverage-v8": ^3.1.3 debug: ^4.3.4 + eslint: "*" fast-glob: ^3.3.2 glob: "*" is-glob: ^4.0.3 minimatch: ^9.0.4 - prettier: ^3.2.5 rimraf: "*" semver: ^7.6.0 ts-api-utils: ^2.1.0 typescript: "*" vitest: ^3.1.3 peerDependencies: - typescript: ">=4.8.4 <5.9.0" + typescript: ">=4.8.4 <6.0.0" languageName: unknown linkType: soft -"@typescript-eslint/utils@8.32.1, @typescript-eslint/utils@^8.9.0, @typescript-eslint/utils@workspace:*, @typescript-eslint/utils@workspace:^, @typescript-eslint/utils@workspace:packages/utils": +"@typescript-eslint/utils@8.46.4, @typescript-eslint/utils@^8.34.1, @typescript-eslint/utils@^8.46.1, @typescript-eslint/utils@workspace:*, @typescript-eslint/utils@workspace:^, @typescript-eslint/utils@workspace:packages/utils": version: 0.0.0-use.local resolution: "@typescript-eslint/utils@workspace:packages/utils" dependencies: "@eslint-community/eslint-utils": ^4.7.0 - "@typescript-eslint/scope-manager": 8.32.1 - "@typescript-eslint/types": 8.32.1 - "@typescript-eslint/typescript-estree": 8.32.1 + "@typescript-eslint/scope-manager": 8.46.4 + "@typescript-eslint/types": 8.46.4 + "@typescript-eslint/typescript-estree": 8.46.4 "@vitest/coverage-v8": ^3.1.3 - prettier: ^3.2.5 + eslint: "*" rimraf: "*" typescript: "*" vitest: ^3.1.3 peerDependencies: eslint: ^8.57.0 || ^9.0.0 - typescript: ">=4.8.4 <5.9.0" + typescript: ">=4.8.4 <6.0.0" languageName: unknown linkType: soft -"@typescript-eslint/visitor-keys@8.32.1, @typescript-eslint/visitor-keys@workspace:*, @typescript-eslint/visitor-keys@workspace:packages/visitor-keys": +"@typescript-eslint/visitor-keys@8.46.4, @typescript-eslint/visitor-keys@workspace:*, @typescript-eslint/visitor-keys@workspace:packages/visitor-keys": version: 0.0.0-use.local resolution: "@typescript-eslint/visitor-keys@workspace:packages/visitor-keys" dependencies: - "@typescript-eslint/types": 8.32.1 + "@typescript-eslint/types": 8.46.4 "@vitest/coverage-v8": ^3.1.3 - eslint-visitor-keys: ^4.2.0 - prettier: ^3.2.5 + eslint: "*" + eslint-visitor-keys: ^4.2.1 rimraf: "*" typescript: "*" vitest: ^3.1.3 @@ -5822,7 +6254,7 @@ __metadata: esbuild: ~0.25.0 eslint: "*" esquery: "*" - prettier: ^3.2.5 + rimraf: "*" tsx: "*" languageName: unknown linkType: soft @@ -5848,12 +6280,13 @@ __metadata: linkType: hard "@vitest/coverage-v8@npm:^3.1.3": - version: 3.1.3 - resolution: "@vitest/coverage-v8@npm:3.1.3" + version: 3.2.4 + resolution: "@vitest/coverage-v8@npm:3.2.4" dependencies: "@ampproject/remapping": ^2.3.0 "@bcoe/v8-coverage": ^1.0.2 - debug: ^4.4.0 + ast-v8-to-istanbul: ^0.3.3 + debug: ^4.4.1 istanbul-lib-coverage: ^3.2.2 istanbul-lib-report: ^3.0.1 istanbul-lib-source-maps: ^5.0.6 @@ -5864,110 +6297,114 @@ __metadata: test-exclude: ^7.0.1 tinyrainbow: ^2.0.0 peerDependencies: - "@vitest/browser": 3.1.3 - vitest: 3.1.3 + "@vitest/browser": 3.2.4 + vitest: 3.2.4 peerDependenciesMeta: "@vitest/browser": optional: true - checksum: 647d9d43335349db076b507eb374a364e96e4367f00ed610afff357b6d00d49ea22d30a00f046f088392c68bb3968a5f780ce8ee9a39f14e968b35fcc7fc7e69 + checksum: b33d4abb32216c793b1da122254bf70578c4acddbf2011c377818cbfc9506383398a5a2eaeb70045120dac1f86a1a2511fd624050dd92ef7387b9469929ceb33 languageName: node linkType: hard -"@vitest/eslint-plugin@npm:^1.1.44": - version: 1.1.44 - resolution: "@vitest/eslint-plugin@npm:1.1.44" +"@vitest/eslint-plugin@npm:^1.3.9": + version: 1.4.1 + resolution: "@vitest/eslint-plugin@npm:1.4.1" + dependencies: + "@typescript-eslint/scope-manager": ^8.46.1 + "@typescript-eslint/utils": ^8.46.1 peerDependencies: - "@typescript-eslint/utils": ">= 8.24.0" - eslint: ">= 8.57.0" - typescript: ">= 5.0.0" + eslint: ">=8.57.0" + typescript: ">=5.0.0" vitest: "*" peerDependenciesMeta: typescript: optional: true vitest: optional: true - checksum: bd78c75c01cb964888b0fb8c468469bbef3a4dcc25ed9618b82fd6b83c236ac54fad9dd9aa67d3da892796d4c982b9bcee37fa16a412744f50fc9a27ece3bb1f + checksum: 142a1c166d4223773478620974b86d7783012d27149318c4c60cddab9b9b11f7721a6ff3b2bc2491f47d53444020f2a330c7e633040968ba7c0f65d6a1e039b3 languageName: node linkType: hard -"@vitest/expect@npm:3.1.3": - version: 3.1.3 - resolution: "@vitest/expect@npm:3.1.3" +"@vitest/expect@npm:3.2.4": + version: 3.2.4 + resolution: "@vitest/expect@npm:3.2.4" dependencies: - "@vitest/spy": 3.1.3 - "@vitest/utils": 3.1.3 + "@types/chai": ^5.2.2 + "@vitest/spy": 3.2.4 + "@vitest/utils": 3.2.4 chai: ^5.2.0 tinyrainbow: ^2.0.0 - checksum: 5c83ed7c7b429217363be15e361fe5128684aed422f3424b9a994f5a1116b06293d4c4bf117a9670c311e73e8a9d55b99adafdf63dfce88e15417814087d1eec + checksum: 57627ee2b47555f47a15843fda05267816e9767e5a769179acac224b8682844e662fa77fbeeb04adcb0874779f3aca861f54e9fc630c1d256d5ea8211c223120 languageName: node linkType: hard -"@vitest/mocker@npm:3.1.3": - version: 3.1.3 - resolution: "@vitest/mocker@npm:3.1.3" +"@vitest/mocker@npm:3.2.4": + version: 3.2.4 + resolution: "@vitest/mocker@npm:3.2.4" dependencies: - "@vitest/spy": 3.1.3 + "@vitest/spy": 3.2.4 estree-walker: ^3.0.3 magic-string: ^0.30.17 peerDependencies: msw: ^2.4.9 - vite: ^5.0.0 || ^6.0.0 + vite: ^5.0.0 || ^6.0.0 || ^7.0.0-0 peerDependenciesMeta: msw: optional: true vite: optional: true - checksum: f4550db48d9e3f009db56af4c8bb3d15de5eb26bdcfa1a19b703deb284f3a4c04b89c4ac0d6ad139cc70a3d893260852742b1ad1eb8af0e7f11711bed4427ee4 + checksum: 2c8ba286fc714036b645a7a72bfbbd6b243baa65320dd71009f5ed1115f70f69c0209e2e213a05202c172e09a408821a33f9df5bc7979900e91cde5d302976e0 languageName: node linkType: hard -"@vitest/pretty-format@npm:3.1.3, @vitest/pretty-format@npm:^3.1.3": - version: 3.1.3 - resolution: "@vitest/pretty-format@npm:3.1.3" +"@vitest/pretty-format@npm:3.2.4, @vitest/pretty-format@npm:^3.1.3, @vitest/pretty-format@npm:^3.2.4": + version: 3.2.4 + resolution: "@vitest/pretty-format@npm:3.2.4" dependencies: tinyrainbow: ^2.0.0 - checksum: c27594a4c33e27d4c16ed73940d9c2399a71dfbcd3e70d459152853c051097d72414af1449226250b5be039d859565b278584d42a4ac088c9e4b5e7a929e86fc + checksum: 68a196e4bdfce6fd03c3958b76cddb71bec65a62ab5aff05ba743a44853b03a95c2809b4e5733d21abff25c4d070dd64f60c81ac973a9fd21a840ff8f8a8d184 languageName: node linkType: hard -"@vitest/runner@npm:3.1.3": - version: 3.1.3 - resolution: "@vitest/runner@npm:3.1.3" +"@vitest/runner@npm:3.2.4": + version: 3.2.4 + resolution: "@vitest/runner@npm:3.2.4" dependencies: - "@vitest/utils": 3.1.3 + "@vitest/utils": 3.2.4 pathe: ^2.0.3 - checksum: 263363ffaa4102361ac94c1c0cec88e63511ecab3b995f1bdbe307493d4b991c41528afaea0a4dbbd8d880fb35deb30c0b9bf2178deacda15c7ea15ad28a284d + strip-literal: ^3.0.0 + checksum: c8b08365818f408eec2fe3acbffa0cc7279939a43c02074cd03b853fa37bc68aa181c8f8c2175513a4c5aa4dd3e52a0573d5897a16846d55b2ff4f3577e6c7c8 languageName: node linkType: hard -"@vitest/snapshot@npm:3.1.3": - version: 3.1.3 - resolution: "@vitest/snapshot@npm:3.1.3" +"@vitest/snapshot@npm:3.2.4": + version: 3.2.4 + resolution: "@vitest/snapshot@npm:3.2.4" dependencies: - "@vitest/pretty-format": 3.1.3 + "@vitest/pretty-format": 3.2.4 magic-string: ^0.30.17 pathe: ^2.0.3 - checksum: d128f8fba53e8703f4453e461bb53ca5e3f2deb48c43a37e9489f85bbef693e0daafec44611c1449ed0d2eb370a8fd0dabf16538c74325e760bda4c01e8443b9 + checksum: 2f00fb83d5c9ed1f2a79323db3993403bd34265314846cb1bcf1cb9b68f56dfde5ee5a4a8dcb6d95317835bc203662e333da6841e50800c6707e0d22e48ebe6e languageName: node linkType: hard -"@vitest/spy@npm:3.1.3": - version: 3.1.3 - resolution: "@vitest/spy@npm:3.1.3" +"@vitest/spy@npm:3.2.4": + version: 3.2.4 + resolution: "@vitest/spy@npm:3.2.4" dependencies: - tinyspy: ^3.0.2 - checksum: 89093542e1677c37c4ef8f86fb30abafd61d98e1fa908fb403acd7dfaf03e3ab67a84ef3b4b8f75685ba68aa2c8b6eb7b1274938822c7c19c3250cdadfb45457 + tinyspy: ^4.0.3 + checksum: 0e3b591e0c67275b747c5aa67946d6496cd6759dd9b8e05c524426207ca9631fe2cae8ac85a8ba22acec4a593393cd97d825f88a42597fc65441f0b633986f49 languageName: node linkType: hard -"@vitest/utils@npm:3.1.3, @vitest/utils@npm:^3.1.3": - version: 3.1.3 - resolution: "@vitest/utils@npm:3.1.3" +"@vitest/utils@npm:3.2.4, @vitest/utils@npm:^3.1.3": + version: 3.2.4 + resolution: "@vitest/utils@npm:3.2.4" dependencies: - "@vitest/pretty-format": 3.1.3 - loupe: ^3.1.3 + "@vitest/pretty-format": 3.2.4 + loupe: ^3.1.4 tinyrainbow: ^2.0.0 - checksum: ba6bfa548e96c1f3493e47c027c03d1e800127446a7c60663817c67bb97f54d83ac9f4133b2c4334bce32925765d2db89f4d6c8b58b4d355d4107100b59e6603 + checksum: 6b0fd0075c23b8e3f17ecf315adc1e565e5a9e7d1b8ad78bbccf2505e399855d176254d974587c00bc4396a0e348bae1380e780a1e7f6b97ea6399a9ab665ba7 languageName: node linkType: hard @@ -6136,6 +6573,62 @@ __metadata: languageName: node linkType: hard +"@yarnpkg/core@npm:^4.4.1": + version: 4.4.4 + resolution: "@yarnpkg/core@npm:4.4.4" + dependencies: + "@arcanis/slice-ansi": ^1.1.1 + "@types/semver": ^7.1.0 + "@types/treeify": ^1.0.0 + "@yarnpkg/fslib": ^3.1.3 + "@yarnpkg/libzip": ^3.2.2 + "@yarnpkg/parsers": ^3.0.3 + "@yarnpkg/shell": ^4.1.3 + camelcase: ^5.3.1 + chalk: ^4.1.2 + ci-info: ^4.0.0 + clipanion: ^4.0.0-rc.2 + cross-spawn: ^7.0.3 + diff: ^5.1.0 + dotenv: ^16.3.1 + es-toolkit: ^1.39.7 + fast-glob: ^3.2.2 + got: ^11.7.0 + hpagent: ^1.2.0 + micromatch: ^4.0.2 + p-limit: ^2.2.0 + semver: ^7.1.2 + strip-ansi: ^6.0.0 + tar: ^6.0.5 + tinylogic: ^2.0.0 + treeify: ^1.1.0 + tslib: ^2.4.0 + checksum: 0ed1c0fa9cb590de700b26c50ee021af19a29c7b4d04a0d121864ca1a47ce09280c56619eb947a28454731a0d7eec4ab08b7dda6eba68782f12a5e88e05bebc6 + languageName: node + linkType: hard + +"@yarnpkg/fslib@npm:^3.1.2, @yarnpkg/fslib@npm:^3.1.3": + version: 3.1.3 + resolution: "@yarnpkg/fslib@npm:3.1.3" + dependencies: + tslib: ^2.4.0 + checksum: 8d9bc2f40bf49d2bec1e0218b142a5504e5bbe1dec6b36000f58c0b0a048c8b00785370a19f0563d8a50d9c7ca6b09df6e7c68900d35ebb127734d65faa31618 + languageName: node + linkType: hard + +"@yarnpkg/libzip@npm:^3.2.2": + version: 3.2.2 + resolution: "@yarnpkg/libzip@npm:3.2.2" + dependencies: + "@types/emscripten": ^1.39.6 + "@yarnpkg/fslib": ^3.1.3 + tslib: ^2.4.0 + peerDependencies: + "@yarnpkg/fslib": ^3.1.3 + checksum: 68736d731ef18f54720ed0b26e24dd0a69adcf26ef5d1f1a2e7ac89c096e2fc50373ff7467158b3a3b3cc7579bbb8ab7e72ee79f2c9044bda0dac52fbf40819b + languageName: node + linkType: hard + "@yarnpkg/lockfile@npm:^1.1.0": version: 1.1.0 resolution: "@yarnpkg/lockfile@npm:1.1.0" @@ -6153,6 +6646,34 @@ __metadata: languageName: node linkType: hard +"@yarnpkg/parsers@npm:^3.0.3": + version: 3.0.3 + resolution: "@yarnpkg/parsers@npm:3.0.3" + dependencies: + js-yaml: ^3.10.0 + tslib: ^2.4.0 + checksum: d6f78ec15b36732a88aeb090d012756d03a855a301a29f0f4f725ac05186f2d2e26400ea5636016481bdca7d4a013f70d61141bc1add2048cf1c2e5132b9ecf8 + languageName: node + linkType: hard + +"@yarnpkg/shell@npm:^4.1.3": + version: 4.1.3 + resolution: "@yarnpkg/shell@npm:4.1.3" + dependencies: + "@yarnpkg/fslib": ^3.1.2 + "@yarnpkg/parsers": ^3.0.3 + chalk: ^4.1.2 + clipanion: ^4.0.0-rc.2 + cross-spawn: ^7.0.3 + fast-glob: ^3.2.2 + micromatch: ^4.0.2 + tslib: ^2.4.0 + bin: + shell: ./lib/cli.js + checksum: bb5a122b157d6a1652331542b26d07f63b1f796f264708b0126b3c5a87877150927e8e838bcf631f80469799c4b331b02c62b7ecb19325276590e28e2fe45557 + languageName: node + linkType: hard + "@zkochan/js-yaml@npm:0.0.7": version: 0.0.7 resolution: "@zkochan/js-yaml@npm:0.0.7" @@ -6171,16 +6692,6 @@ __metadata: languageName: node linkType: hard -"accepts@npm:^2.0.0": - version: 2.0.0 - resolution: "accepts@npm:2.0.0" - dependencies: - mime-types: ^3.0.0 - negotiator: ^1.0.0 - checksum: 49fe6c050cb6f6ff4e771b4d88324fca4d3127865f2473872e818dca127d809ba3aa8fdfc7acb51dd3c5bade7311ca6b8cfff7015ea6db2f7eb9c8444d223a4f - languageName: node - linkType: hard - "accepts@npm:~1.3.4, accepts@npm:~1.3.5, accepts@npm:~1.3.8": version: 1.3.8 resolution: "accepts@npm:1.3.8" @@ -6191,6 +6702,15 @@ __metadata: languageName: node linkType: hard +"acorn-import-phases@npm:^1.0.3": + version: 1.0.4 + resolution: "acorn-import-phases@npm:1.0.4" + peerDependencies: + acorn: ^8.14.0 + checksum: e669cccfb6711af305150fcbfddcf4485fffdc4547a0ecabebe94103b47124cc02bfd186240061c00ac954cfb0461b4ecc3e203e138e43042b7af32063fa9510 + languageName: node + linkType: hard + "acorn-jsx@npm:^5.0.0, acorn-jsx@npm:^5.3.2": version: 5.3.2 resolution: "acorn-jsx@npm:5.3.2" @@ -6207,12 +6727,12 @@ __metadata: languageName: node linkType: hard -"acorn@npm:^8.0.0, acorn@npm:^8.0.4, acorn@npm:^8.14.0, acorn@npm:^8.8.2": - version: 8.14.0 - resolution: "acorn@npm:8.14.0" +"acorn@npm:^8.0.0, acorn@npm:^8.0.4, acorn@npm:^8.15.0, acorn@npm:^8.8.2": + version: 8.15.0 + resolution: "acorn@npm:8.15.0" bin: acorn: bin/acorn - checksum: 8755074ba55fff94e84e81c72f1013c2d9c78e973c31231c8ae505a5f966859baf654bddd75046bffd73ce816b149298977fff5077a3033dedba0ae2aad152d4 + checksum: 309c6b49aedf1a2e34aaf266de06de04aab6eb097c02375c66fdeb0f64556a6a823540409914fb364d9a11bc30d79d485a2eba29af47992d3490e9886c4391c3 languageName: node linkType: hard @@ -6349,36 +6869,35 @@ __metadata: languageName: node linkType: hard -"algoliasearch-helper@npm:^3.13.3": - version: 3.16.3 - resolution: "algoliasearch-helper@npm:3.16.3" +"algoliasearch-helper@npm:^3.22.6": + version: 3.25.0 + resolution: "algoliasearch-helper@npm:3.25.0" dependencies: "@algolia/events": ^4.0.1 peerDependencies: algoliasearch: ">= 3.1 < 6" - checksum: b4664168e2900628e274508dbf4a7f366fa1397468ba49bd0a5c4f2b0d2d1f7ed8bd137ca218a6d142fec49963b7c0774e8929371e1906416bf0d82bcbb61fc1 + checksum: 424db7021a5939a0de0c659313483bbce895c21f5d9841cabd2495300e86db2ebbd3e050c6bfaa88723068ea87c2e5e9710f59187e640db8602f022924402863 languageName: node linkType: hard -"algoliasearch@npm:^4.18.0, algoliasearch@npm:^4.19.1": - version: 4.22.1 - resolution: "algoliasearch@npm:4.22.1" +"algoliasearch@npm:^5.14.2, algoliasearch@npm:^5.17.1": + version: 5.25.0 + resolution: "algoliasearch@npm:5.25.0" dependencies: - "@algolia/cache-browser-local-storage": 4.22.1 - "@algolia/cache-common": 4.22.1 - "@algolia/cache-in-memory": 4.22.1 - "@algolia/client-account": 4.22.1 - "@algolia/client-analytics": 4.22.1 - "@algolia/client-common": 4.22.1 - "@algolia/client-personalization": 4.22.1 - "@algolia/client-search": 4.22.1 - "@algolia/logger-common": 4.22.1 - "@algolia/logger-console": 4.22.1 - "@algolia/requester-browser-xhr": 4.22.1 - "@algolia/requester-common": 4.22.1 - "@algolia/requester-node-http": 4.22.1 - "@algolia/transporter": 4.22.1 - checksum: 65226e7ac081fd2dccd2a949b211a67010d933e86572be7cc714b3f5ca07edf099e8a2fd328e8c4a772d971d06ec49779c2b8670196c811faede5b78765cb5bf + "@algolia/client-abtesting": 5.25.0 + "@algolia/client-analytics": 5.25.0 + "@algolia/client-common": 5.25.0 + "@algolia/client-insights": 5.25.0 + "@algolia/client-personalization": 5.25.0 + "@algolia/client-query-suggestions": 5.25.0 + "@algolia/client-search": 5.25.0 + "@algolia/ingestion": 1.25.0 + "@algolia/monitoring": 1.25.0 + "@algolia/recommend": 5.25.0 + "@algolia/requester-browser-xhr": 5.25.0 + "@algolia/requester-fetch": 5.25.0 + "@algolia/requester-node-http": 5.25.0 + checksum: bf3a3e8eabb3f13fed03d8f96c5fd828cb07659402931bfbd25b31cebd90aa35679e234b801cf033b6fe1b400609850d1202df6505b1b4a38474a18ca24e684b languageName: node linkType: hard @@ -6448,7 +6967,7 @@ __metadata: languageName: node linkType: hard -"ansi-styles@npm:^5.0.0": +"ansi-styles@npm:^5.2.0": version: 5.2.0 resolution: "ansi-styles@npm:5.2.0" checksum: d7f4e97ce0623aea6bc0d90dcd28881ee04cba06c570b97fd3391bd7a268eedfd9d5e2dd4fdcbdd82b8105df5faf6f24aaedc08eaf3da898e702db5948f63469 @@ -6550,17 +7069,19 @@ __metadata: languageName: node linkType: hard -"array-includes@npm:^3.1.6, array-includes@npm:^3.1.8": - version: 3.1.8 - resolution: "array-includes@npm:3.1.8" +"array-includes@npm:^3.1.6, array-includes@npm:^3.1.8, array-includes@npm:^3.1.9": + version: 3.1.9 + resolution: "array-includes@npm:3.1.9" dependencies: - call-bind: ^1.0.7 + call-bind: ^1.0.8 + call-bound: ^1.0.4 define-properties: ^1.2.1 - es-abstract: ^1.23.2 - es-object-atoms: ^1.0.0 - get-intrinsic: ^1.2.4 - is-string: ^1.0.7 - checksum: eb39ba5530f64e4d8acab39297c11c1c5be2a4ea188ab2b34aba5fb7224d918f77717a9d57a3e2900caaa8440e59431bdaf5c974d5212ef65d97f132e38e2d91 + es-abstract: ^1.24.0 + es-object-atoms: ^1.1.1 + get-intrinsic: ^1.3.0 + is-string: ^1.1.1 + math-intrinsics: ^1.1.0 + checksum: b58dc526fe415252e50319eaf88336e06e75aa673e3b58d252414739a4612dbe56e7b613fdcc7c90561dc9cf9202bbe5ca029ccd8c08362746459475ae5a8f3e languageName: node linkType: hard @@ -6592,29 +7113,30 @@ __metadata: languageName: node linkType: hard -"array.prototype.findlastindex@npm:^1.2.5": - version: 1.2.5 - resolution: "array.prototype.findlastindex@npm:1.2.5" +"array.prototype.findlastindex@npm:^1.2.6": + version: 1.2.6 + resolution: "array.prototype.findlastindex@npm:1.2.6" dependencies: - call-bind: ^1.0.7 + call-bind: ^1.0.8 + call-bound: ^1.0.4 define-properties: ^1.2.1 - es-abstract: ^1.23.2 + es-abstract: ^1.23.9 es-errors: ^1.3.0 - es-object-atoms: ^1.0.0 - es-shim-unscopables: ^1.0.2 - checksum: 2c81cff2a75deb95bf1ed89b6f5f2bfbfb882211e3b7cc59c3d6b87df774cd9d6b36949a8ae39ac476e092c1d4a4905f5ee11a86a456abb10f35f8211ae4e710 + es-object-atoms: ^1.1.1 + es-shim-unscopables: ^1.1.0 + checksum: bd2665bd51f674d4e1588ce5d5848a8adb255f414070e8e652585598b801480516df2c6cef2c60b6ea1a9189140411c49157a3f112d52e9eabb4e9fc80936ea6 languageName: node linkType: hard -"array.prototype.flat@npm:^1.3.1, array.prototype.flat@npm:^1.3.2": - version: 1.3.2 - resolution: "array.prototype.flat@npm:1.3.2" +"array.prototype.flat@npm:^1.3.1, array.prototype.flat@npm:^1.3.3": + version: 1.3.3 + resolution: "array.prototype.flat@npm:1.3.3" dependencies: - call-bind: ^1.0.2 - define-properties: ^1.2.0 - es-abstract: ^1.22.1 - es-shim-unscopables: ^1.0.0 - checksum: 5d6b4bf102065fb3f43764bfff6feb3295d372ce89591e6005df3d0ce388527a9f03c909af6f2a973969a4d178ab232ffc9236654149173e0e187ec3a1a6b87b + call-bind: ^1.0.8 + define-properties: ^1.2.1 + es-abstract: ^1.23.5 + es-shim-unscopables: ^1.0.2 + checksum: 5d5a7829ab2bb271a8d30a1c91e6271cef0ec534593c0fe6d2fb9ebf8bb62c1e5326e2fddcbbcbbe5872ca04f5e6b54a1ecf092e0af704fb538da9b2bfd95b40 languageName: node linkType: hard @@ -6672,6 +7194,17 @@ __metadata: languageName: node linkType: hard +"ast-v8-to-istanbul@npm:^0.3.3": + version: 0.3.4 + resolution: "ast-v8-to-istanbul@npm:0.3.4" + dependencies: + "@jridgewell/trace-mapping": ^0.3.29 + estree-walker: ^3.0.3 + js-tokens: ^9.0.1 + checksum: dec6f5d9cc2b238132054a50be0da85d138902a130744bfd83067e5694d4434d379febf7e6fd81d22f5f1e2983bbfcf600684f20da411703f5faed0b6d714e5c + languageName: node + linkType: hard + "astral-regex@npm:^2.0.0": version: 2.0.0 resolution: "astral-regex@npm:2.0.0" @@ -6709,21 +7242,21 @@ __metadata: languageName: node linkType: hard -"autoprefixer@npm:^10.4.14, autoprefixer@npm:^10.4.19": - version: 10.4.19 - resolution: "autoprefixer@npm:10.4.19" +"autoprefixer@npm:^10.4.19, autoprefixer@npm:^10.4.21": + version: 10.4.21 + resolution: "autoprefixer@npm:10.4.21" dependencies: - browserslist: ^4.23.0 - caniuse-lite: ^1.0.30001599 + browserslist: ^4.24.4 + caniuse-lite: ^1.0.30001702 fraction.js: ^4.3.7 normalize-range: ^0.1.2 - picocolors: ^1.0.0 + picocolors: ^1.1.1 postcss-value-parser: ^4.2.0 peerDependencies: postcss: ^8.1.0 bin: autoprefixer: bin/autoprefixer - checksum: 3a4bc5bace05e057396dca2b306503efc175e90e8f2abf5472d3130b72da1d54d97c0ee05df21bf04fe66a7df93fd8c8ec0f1aca72a165f4701a02531abcbf11 + checksum: 11770ce635a0520e457eaf2ff89056cd57094796a9f5d6d9375513388a5a016cd947333dcfd213b822fdd8a0b43ce68ae4958e79c6f077c41d87444c8cca0235 languageName: node linkType: hard @@ -6887,13 +7420,6 @@ __metadata: languageName: node linkType: hard -"before-after-hook@npm:^2.2.0": - version: 2.2.2 - resolution: "before-after-hook@npm:2.2.2" - checksum: dc2e1ffe389e5afbef2a46790b1b5a50247ed57aba67649cfa9ec2552d248cc9278f222e72fb5a8ff59bbb39d78fbaa97e7234ead0c6b5e8418b67a8644ce207 - languageName: node - linkType: hard - "big.js@npm:^5.2.2": version: 5.2.2 resolution: "big.js@npm:5.2.2" @@ -6939,23 +7465,6 @@ __metadata: languageName: node linkType: hard -"body-parser@npm:^2.2.0": - version: 2.2.0 - resolution: "body-parser@npm:2.2.0" - dependencies: - bytes: ^3.1.2 - content-type: ^1.0.5 - debug: ^4.4.0 - http-errors: ^2.0.0 - iconv-lite: ^0.6.3 - on-finished: ^2.4.1 - qs: ^6.14.0 - raw-body: ^3.0.0 - type-is: ^2.0.0 - checksum: 7fe3a2d288f0b632528d6ccb90052d1a9492c5b79d5716d32c8de1f5fb8237b0d31ee5050e1d0b7ff143a492ff151804612c6e2686a222a1d4c9e2e6531b8fb2 - languageName: node - linkType: hard - "bonjour-service@npm:^1.0.11": version: 1.0.12 resolution: "bonjour-service@npm:1.0.12" @@ -7035,24 +7544,17 @@ __metadata: languageName: node linkType: hard -"browser-stdout@npm:^1.3.1": - version: 1.3.1 - resolution: "browser-stdout@npm:1.3.1" - checksum: b717b19b25952dd6af483e368f9bcd6b14b87740c3d226c2977a65e84666ffd67000bddea7d911f111a9b6ddc822b234de42d52ab6507bce4119a4cc003ef7b3 - languageName: node - linkType: hard - -"browserslist@npm:^4.0.0, browserslist@npm:^4.18.1, browserslist@npm:^4.23.0, browserslist@npm:^4.24.0, browserslist@npm:^4.24.4": - version: 4.24.5 - resolution: "browserslist@npm:4.24.5" +"browserslist@npm:^4.0.0, browserslist@npm:^4.18.1, browserslist@npm:^4.23.0, browserslist@npm:^4.24.0, browserslist@npm:^4.24.4, browserslist@npm:^4.24.5": + version: 4.25.0 + resolution: "browserslist@npm:4.25.0" dependencies: - caniuse-lite: ^1.0.30001716 - electron-to-chromium: ^1.5.149 + caniuse-lite: ^1.0.30001718 + electron-to-chromium: ^1.5.160 node-releases: ^2.0.19 update-browserslist-db: ^1.1.3 bin: browserslist: cli.js - checksum: 69310ade58b0cb2b2871022fdaba8388902f9a2d17a6fa05f383d046d6da87fd9f83018a66fe1c6296648ca7d52e3208c3fc68c82f17a0fd4bf12a452c036247 + checksum: 0d34fa0c6e23e962598ba68ee9f4566a4b575ec550ff7e9e7287c5e94a6e0f208f75f4f7d578ccd060f843167e0e495bde8f6d278f353f0da783cd50f758e5c7 languageName: node linkType: hard @@ -7073,16 +7575,6 @@ __metadata: languageName: node linkType: hard -"buffer@npm:^6.0.3": - version: 6.0.3 - resolution: "buffer@npm:6.0.3" - dependencies: - base64-js: ^1.3.1 - ieee754: ^1.2.1 - checksum: 5ad23293d9a731e4318e420025800b42bf0d264004c0286c8cc010af7a270c7a0f6522e84f54b9ad65cbd6db20b8badbfd8d2ebf4f80fa03dab093b89e68c3f9 - languageName: node - linkType: hard - "builtin-modules@npm:^3.1.0": version: 3.3.0 resolution: "builtin-modules@npm:3.3.0" @@ -7113,7 +7605,7 @@ __metadata: languageName: node linkType: hard -"bytes@npm:3.1.2, bytes@npm:^3.1.2": +"bytes@npm:3.1.2": version: 3.1.2 resolution: "bytes@npm:3.1.2" checksum: e4bcd3948d289c5127591fbedf10c0b639ccbf00243504e4e127374a15c3bc8eed0d28d4aaab08ff6f1cf2abc0cce6ba3085ed32f4f90e82a5683ce0014e1b6e @@ -7148,6 +7640,13 @@ __metadata: languageName: node linkType: hard +"cacheable-lookup@npm:^5.0.3": + version: 5.0.4 + resolution: "cacheable-lookup@npm:5.0.4" + checksum: 763e02cf9196bc9afccacd8c418d942fc2677f22261969a4c2c2e760fa44a2351a81557bd908291c3921fe9beb10b976ba8fa50c5ca837c5a0dd945f16468f2d + languageName: node + linkType: hard + "cacheable-lookup@npm:^7.0.0": version: 7.0.0 resolution: "cacheable-lookup@npm:7.0.0" @@ -7170,27 +7669,42 @@ __metadata: languageName: node linkType: hard -"cacheable@npm:^1.8.9": - version: 1.8.9 - resolution: "cacheable@npm:1.8.9" +"cacheable-request@npm:^7.0.2": + version: 7.0.4 + resolution: "cacheable-request@npm:7.0.4" dependencies: - hookified: ^1.7.1 - keyv: ^5.3.1 - checksum: aabfab7106df5c73948471f2b053e713edba69dfd3c01ff6df4b07ba8d53f631d8101d55edc782e3b2c7060cdcbc625af7d6f66b6bd8b4b7a14c392647e31f93 + clone-response: ^1.0.2 + get-stream: ^5.1.0 + http-cache-semantics: ^4.0.0 + keyv: ^4.0.0 + lowercase-keys: ^2.0.0 + normalize-url: ^6.0.1 + responselike: ^2.0.0 + checksum: 0de9df773fd4e7dd9bd118959878f8f2163867e2e1ab3575ffbecbe6e75e80513dd0c68ba30005e5e5a7b377cc6162bbc00ab1db019bb4e9cb3c2f3f7a6f1ee4 languageName: node linkType: hard -"call-bind-apply-helpers@npm:^1.0.0, call-bind-apply-helpers@npm:^1.0.1": - version: 1.0.1 - resolution: "call-bind-apply-helpers@npm:1.0.1" +"cacheable@npm:^1.10.4": + version: 1.10.4 + resolution: "cacheable@npm:1.10.4" + dependencies: + hookified: ^1.11.0 + keyv: ^5.5.0 + checksum: b146ed94ecb8f8b7d5eabb29bde5f0d10541305e52cae01c44d1ec643969d6afa92d47c9918afea402c5e87ba1f96cb4336cc1030f33d59d2b470e7c4221efb3 + languageName: node + linkType: hard + +"call-bind-apply-helpers@npm:^1.0.0, call-bind-apply-helpers@npm:^1.0.1, call-bind-apply-helpers@npm:^1.0.2": + version: 1.0.2 + resolution: "call-bind-apply-helpers@npm:1.0.2" dependencies: es-errors: ^1.3.0 function-bind: ^1.1.2 - checksum: 3c55343261bb387c58a4762d15ad9d42053659a62681ec5eb50690c6b52a4a666302a01d557133ce6533e8bd04530ee3b209f23dd06c9577a1925556f8fcccdf + checksum: b2863d74fcf2a6948221f65d95b91b4b2d90cfe8927650b506141e669f7d5de65cea191bf788838bc40d13846b7886c5bc5c84ab96c3adbcf88ad69a72fcdc6b languageName: node linkType: hard -"call-bind@npm:^1.0.2, call-bind@npm:^1.0.7, call-bind@npm:^1.0.8": +"call-bind@npm:^1.0.7, call-bind@npm:^1.0.8": version: 1.0.8 resolution: "call-bind@npm:1.0.8" dependencies: @@ -7202,13 +7716,13 @@ __metadata: languageName: node linkType: hard -"call-bound@npm:^1.0.2, call-bound@npm:^1.0.3": - version: 1.0.3 - resolution: "call-bound@npm:1.0.3" +"call-bound@npm:^1.0.2, call-bound@npm:^1.0.3, call-bound@npm:^1.0.4": + version: 1.0.4 + resolution: "call-bound@npm:1.0.4" dependencies: - call-bind-apply-helpers: ^1.0.1 - get-intrinsic: ^1.2.6 - checksum: a93bbe0f2d0a2d6c144a4349ccd0593d5d0d5d9309b69101710644af8964286420062f2cc3114dca120b9bc8cc07507952d4b1b3ea7672e0d7f6f1675efedb32 + call-bind-apply-helpers: ^1.0.2 + get-intrinsic: ^1.3.0 + checksum: 2f6399488d1c272f56306ca60ff696575e2b7f31daf23bc11574798c84d9f2759dceb0cb1f471a85b77f28962a7ac6411f51d283ea2e45319009a19b6ccab3b2 languageName: node linkType: hard @@ -7229,7 +7743,14 @@ __metadata: languageName: node linkType: hard -"camelcase@npm:^6.0.0, camelcase@npm:^6.2.0": +"camelcase@npm:^5.3.1": + version: 5.3.1 + resolution: "camelcase@npm:5.3.1" + checksum: e6effce26b9404e3c0f301498184f243811c30dfe6d0b9051863bd8e4034d09c8c2923794f280d6827e5aa055f6c434115ff97864a16a963366fb35fd673024b + languageName: node + linkType: hard + +"camelcase@npm:^6.2.0": version: 6.3.0 resolution: "camelcase@npm:6.3.0" checksum: 8c96818a9076434998511251dcb2761a94817ea17dbdc37f47ac080bd088fc62c7369429a19e2178b993497132c8cbcf5cc1f44ba963e76782ba469c0474938d @@ -7255,10 +7776,10 @@ __metadata: languageName: node linkType: hard -"caniuse-lite@npm:^1.0.0, caniuse-lite@npm:^1.0.30001599, caniuse-lite@npm:^1.0.30001716": - version: 1.0.30001717 - resolution: "caniuse-lite@npm:1.0.30001717" - checksum: 357fbb230d86d28c0f7005d0c19a2274059ad4f1ed419ebe8754737ec908b567c9745abf0d16eda93417f40913221adc6290eb2f0432bc5bb5364f95bd7eabfa +"caniuse-lite@npm:^1.0.0, caniuse-lite@npm:^1.0.30001702, caniuse-lite@npm:^1.0.30001718": + version: 1.0.30001720 + resolution: "caniuse-lite@npm:1.0.30001720" + checksum: 97b9f9de842595ff9674001abb9c5bc093c03bb985d481ed97617ea48fc248bfb2cc1f1afe19da2bf20016f28793e495fa2f339e22080d8da3c9714fb7950926 languageName: node linkType: hard @@ -7398,15 +7919,6 @@ __metadata: languageName: node linkType: hard -"chokidar@npm:^4.0.1": - version: 4.0.3 - resolution: "chokidar@npm:4.0.3" - dependencies: - readdirp: ^4.0.1 - checksum: a8765e452bbafd04f3f2fad79f04222dd65f43161488bb6014a41099e6ca18d166af613d59a90771908c1c823efa3f46ba36b86ac50b701c20c1b9908c5fe36e - languageName: node - linkType: hard - "chownr@npm:^2.0.0": version: 2.0.0 resolution: "chownr@npm:2.0.0" @@ -7428,10 +7940,10 @@ __metadata: languageName: node linkType: hard -"ci-info@npm:^4.2.0": - version: 4.2.0 - resolution: "ci-info@npm:4.2.0" - checksum: 0e3726721526f54c5b17cf44ab2ed69b842c756bcb4d2b26ce279e595a80a856aec9fb38a2986a2baca3de73d15895f3a01d2771c4aad93c898aae7e3ca0ceb1 +"ci-info@npm:^4.0.0, ci-info@npm:^4.2.0": + version: 4.3.0 + resolution: "ci-info@npm:4.3.0" + checksum: 77a851ec826e1fbcd993e0e3ef402e6a5e499c733c475af056b7808dea9c9ede53e560ed433020489a8efea2d824fd68ca203446c9988a0bac8475210b0d4491 languageName: node linkType: hard @@ -7495,20 +8007,13 @@ __metadata: languageName: node linkType: hard -"cli-spinners@npm:2.6.1": +"cli-spinners@npm:2.6.1, cli-spinners@npm:^2.5.0": version: 2.6.1 resolution: "cli-spinners@npm:2.6.1" checksum: 423409baaa7a58e5104b46ca1745fbfc5888bbd0b0c5a626e052ae1387060839c8efd512fb127e25769b3dc9562db1dc1b5add6e0b93b7ef64f477feb6416a45 languageName: node linkType: hard -"cli-spinners@npm:^2.5.0": - version: 2.7.0 - resolution: "cli-spinners@npm:2.7.0" - checksum: a9afaf73f58d1f951fb23742f503631b3cf513f43f4c7acb1b640100eb76bfa16efbcd1994d149ffc6603a6d75dd3d4a516a76f125f90dce437de9b16fd0ee6f - languageName: node - linkType: hard - "cli-table3@npm:^0.6.3": version: 0.6.3 resolution: "cli-table3@npm:0.6.3" @@ -7532,6 +8037,17 @@ __metadata: languageName: node linkType: hard +"clipanion@npm:^4.0.0-rc.2": + version: 4.0.0-rc.4 + resolution: "clipanion@npm:4.0.0-rc.4" + dependencies: + typanion: ^3.8.0 + peerDependencies: + typanion: "*" + checksum: a92aa03b24eb89292b7bda570973c164fff16a1c5ba4c4abdd1b0dd6110a57651752114ec9f5cfc29e2040213e514b3220142a2316c4fc4e659ba423caa296c7 + languageName: node + linkType: hard + "cliui@npm:^8.0.1": version: 8.0.1 resolution: "cliui@npm:8.0.1" @@ -7554,6 +8070,15 @@ __metadata: languageName: node linkType: hard +"clone-response@npm:^1.0.2": + version: 1.0.3 + resolution: "clone-response@npm:1.0.3" + dependencies: + mimic-response: ^1.0.0 + checksum: 4e671cac39b11c60aa8ba0a450657194a5d6504df51bca3fac5b3bd0145c4f8e8464898f87c8406b83232e3bc5cca555f51c1f9c8ac023969ebfbf7f6bdabb2e + languageName: node + linkType: hard + "clone@npm:^1.0.2": version: 1.0.4 resolution: "clone@npm:1.0.4" @@ -7661,6 +8186,13 @@ __metadata: languageName: node linkType: hard +"commander@npm:^14.0.0": + version: 14.0.0 + resolution: "commander@npm:14.0.0" + checksum: 6e9bdaf2e8e4f512855ffc10579eeae2e84c4a7697a91b1a5f62aab3c9849182207855268dd7c3952ae7a2334312a7138f58e929e4b428aef5bf8af862685c9b + languageName: node + linkType: hard + "commander@npm:^2.20.0": version: 2.20.3 resolution: "commander@npm:2.20.3" @@ -7689,6 +8221,13 @@ __metadata: languageName: node linkType: hard +"commander@npm:^9.4.1": + version: 9.5.0 + resolution: "commander@npm:9.5.0" + checksum: c7a3e27aa59e913b54a1bafd366b88650bc41d6651f0cbe258d4ff09d43d6a7394232a4dadd0bf518b3e696fdf595db1028a0d82c785b88bd61f8a440cecfade + languageName: node + linkType: hard + "comment-json@npm:^4.2.5": version: 4.2.5 resolution: "comment-json@npm:4.2.5" @@ -7821,16 +8360,7 @@ __metadata: languageName: node linkType: hard -"content-disposition@npm:^1.0.0": - version: 1.0.0 - resolution: "content-disposition@npm:1.0.0" - dependencies: - safe-buffer: 5.2.1 - checksum: b27e2579fefe0ecf78238bb652fbc750671efce8344f0c6f05235b12433e6a965adb40906df1ac1fdde23e8f9f0e58385e44640e633165420f3f47d830ae0398 - languageName: node - linkType: hard - -"content-type@npm:^1.0.5, content-type@npm:~1.0.4": +"content-type@npm:~1.0.4": version: 1.0.5 resolution: "content-type@npm:1.0.5" checksum: 566271e0a251642254cde0f845f9dd4f9856e52d988f4eb0d0dcffbb7a1f8ec98de7a5215fc628f3bce30fe2fb6fd2bc064b562d721658c59b544e2d34ea2766 @@ -7851,13 +8381,6 @@ __metadata: languageName: node linkType: hard -"cookie-signature@npm:^1.2.1": - version: 1.2.2 - resolution: "cookie-signature@npm:1.2.2" - checksum: 1ad4f9b3907c9f3673a0f0a07c0a23da7909ac6c9204c5d80a0ec102fe50ccc45f27fdf496361840d6c132c5bb0037122c0a381f856d070183d1ebe3e5e041ff - languageName: node - linkType: hard - "cookie@npm:0.5.0": version: 0.5.0 resolution: "cookie@npm:0.5.0" @@ -7865,13 +8388,6 @@ __metadata: languageName: node linkType: hard -"cookie@npm:^0.7.1": - version: 0.7.2 - resolution: "cookie@npm:0.7.2" - checksum: 9bf8555e33530affd571ea37b615ccad9b9a34febbf2c950c86787088eb00a8973690833b0f8ebd6b69b753c62669ea60cec89178c1fb007bf0749abed74f93e - languageName: node - linkType: hard - "copy-text-to-clipboard@npm:^3.2.0": version: 3.2.0 resolution: "copy-text-to-clipboard@npm:3.2.0" @@ -7940,16 +8456,6 @@ __metadata: languageName: node linkType: hard -"cors@npm:^2.8.5": - version: 2.8.5 - resolution: "cors@npm:2.8.5" - dependencies: - object-assign: ^4 - vary: ^1 - checksum: ced838404ccd184f61ab4fdc5847035b681c90db7ac17e428f3d81d69e2989d2b680cc254da0e2554f5ed4f8a341820a1ce3d1c16b499f6e2f47a1b9b07b5006 - languageName: node - linkType: hard - "cosmiconfig@npm:^6.0.0": version: 6.0.0 resolution: "cosmiconfig@npm:6.0.0" @@ -8019,7 +8525,7 @@ __metadata: languageName: node linkType: hard -"cross-spawn@npm:^7.0.0, cross-spawn@npm:^7.0.3, cross-spawn@npm:^7.0.6": +"cross-spawn@npm:^7.0.3, cross-spawn@npm:^7.0.6": version: 7.0.6 resolution: "cross-spawn@npm:7.0.6" dependencies: @@ -8046,94 +8552,95 @@ __metadata: languageName: node linkType: hard -"cspell-config-lib@npm:9.0.0": - version: 9.0.0 - resolution: "cspell-config-lib@npm:9.0.0" +"cspell-config-lib@npm:9.2.0": + version: 9.2.0 + resolution: "cspell-config-lib@npm:9.2.0" dependencies: - "@cspell/cspell-types": 9.0.0 + "@cspell/cspell-types": 9.2.0 comment-json: ^4.2.5 - yaml: ^2.7.1 - checksum: e8b07432420af878eee710aa91fe813cb85140660210a079264a33e8293110d3a10671bd2bfea7f008e8f6b8f95db3e0832ecf48ce28709431fe7321ac940b6f + smol-toml: ^1.4.1 + yaml: ^2.8.0 + checksum: 6d355d379f374ed49fcd87f26865fa9232090f328d58072e747b0b06a71f2428afef98e9823bcc2528e06d09406d18f2958743fc28ccbc3ff71a897e5f9f66f4 languageName: node linkType: hard -"cspell-dictionary@npm:9.0.0": - version: 9.0.0 - resolution: "cspell-dictionary@npm:9.0.0" +"cspell-dictionary@npm:9.2.0": + version: 9.2.0 + resolution: "cspell-dictionary@npm:9.2.0" dependencies: - "@cspell/cspell-pipe": 9.0.0 - "@cspell/cspell-types": 9.0.0 - cspell-trie-lib: 9.0.0 + "@cspell/cspell-pipe": 9.2.0 + "@cspell/cspell-types": 9.2.0 + cspell-trie-lib: 9.2.0 fast-equals: ^5.2.2 - checksum: d1663846a15803714a485d267db25b98024c5ffae0ebecd7c0fd642351e0d5cac7b7335ae6bfa4dc87c45da3f1a90d6f7789b0538fa69da1a057382be9d356ea + checksum: 4677e036376b4fc83cf72f4e9e7d08c81883f90ea9c98608db7aa39f2e296e63de15866e9c7c97517721afacbbcc089d4d6394ccf784d85d75ab6d0aff8e7b0c languageName: node linkType: hard -"cspell-gitignore@npm:9.0.0": - version: 9.0.0 - resolution: "cspell-gitignore@npm:9.0.0" +"cspell-gitignore@npm:9.2.0": + version: 9.2.0 + resolution: "cspell-gitignore@npm:9.2.0" dependencies: - "@cspell/url": 9.0.0 - cspell-glob: 9.0.0 - cspell-io: 9.0.0 + "@cspell/url": 9.2.0 + cspell-glob: 9.2.0 + cspell-io: 9.2.0 bin: cspell-gitignore: bin.mjs - checksum: 495d81b6f9110aeb41e2cdde94ceead451a917c9047d6fefb5786e5e23d5e2ffa2c28d9b5073e747d23c506f5589dcba8f17a93913ef7472a85bb9539e7a6965 + checksum: fadd4948839276630d07a94243778192359c23a4fc86dcf800be0185ee9fe007d0bff8fa70b4c18efc04387d0438342cd345aa19bb16b3ce63d64af4ff0d51a3 languageName: node linkType: hard -"cspell-glob@npm:9.0.0": - version: 9.0.0 - resolution: "cspell-glob@npm:9.0.0" +"cspell-glob@npm:9.2.0": + version: 9.2.0 + resolution: "cspell-glob@npm:9.2.0" dependencies: - "@cspell/url": 9.0.0 - picomatch: ^4.0.2 - checksum: 44acd46989e91a8a2c8391f3ec9d1555aeed1794808cd408492b1f6b74ee38a85f5f9e82d646e375bd149263607edcd123e93371087aed022b3ce797620809e2 + "@cspell/url": 9.2.0 + picomatch: ^4.0.3 + checksum: 4e339dd10c6201d6c4e7d97f6a36848af13fc6e550e09518bae1b28434f918e1057c8cff8e9437d7b885117c40c20b506d211bf240ffe75fa346f6c7e5db97db languageName: node linkType: hard -"cspell-grammar@npm:9.0.0": - version: 9.0.0 - resolution: "cspell-grammar@npm:9.0.0" +"cspell-grammar@npm:9.2.0": + version: 9.2.0 + resolution: "cspell-grammar@npm:9.2.0" dependencies: - "@cspell/cspell-pipe": 9.0.0 - "@cspell/cspell-types": 9.0.0 + "@cspell/cspell-pipe": 9.2.0 + "@cspell/cspell-types": 9.2.0 bin: cspell-grammar: bin.mjs - checksum: 5883687ad47c3a59fe5d3c80cd97207677e7af22479823e30c7284258267238bb2b411b0d7016ce5610d18cdaef5f93de71906821c55d5aa1631f576ae5c4950 + checksum: 51bc5df067ac87ce3ce0bf9a128e6737d4f87a1d754d7bac260f95ed3d96510ac56818245aa327844edfae57a672d413430ab48b2dc026730e6e090cd20a2ac5 languageName: node linkType: hard -"cspell-io@npm:9.0.0": - version: 9.0.0 - resolution: "cspell-io@npm:9.0.0" +"cspell-io@npm:9.2.0": + version: 9.2.0 + resolution: "cspell-io@npm:9.2.0" dependencies: - "@cspell/cspell-service-bus": 9.0.0 - "@cspell/url": 9.0.0 - checksum: 2b1eaaeaf51b339ea7b5f97d4073b99d0f8530cdaa77a751bca3e276d3fba1dbc4894012dbd4cff5e5ea2cccad0a8fb42990712e35443cb5bbd305777de0f959 + "@cspell/cspell-service-bus": 9.2.0 + "@cspell/url": 9.2.0 + checksum: 1b25bace27a5308cc5e7898d9a0463f2ffbba00592442007ac36760010915add5f2bc2d1aebc858d0d5f718235137d16e3320cd4d49dd7a93d2ae102cf51b296 languageName: node linkType: hard -"cspell-lib@npm:9.0.0": - version: 9.0.0 - resolution: "cspell-lib@npm:9.0.0" - dependencies: - "@cspell/cspell-bundled-dicts": 9.0.0 - "@cspell/cspell-pipe": 9.0.0 - "@cspell/cspell-resolver": 9.0.0 - "@cspell/cspell-types": 9.0.0 - "@cspell/dynamic-import": 9.0.0 - "@cspell/filetypes": 9.0.0 - "@cspell/strong-weak-map": 9.0.0 - "@cspell/url": 9.0.0 +"cspell-lib@npm:9.2.0": + version: 9.2.0 + resolution: "cspell-lib@npm:9.2.0" + dependencies: + "@cspell/cspell-bundled-dicts": 9.2.0 + "@cspell/cspell-pipe": 9.2.0 + "@cspell/cspell-resolver": 9.2.0 + "@cspell/cspell-types": 9.2.0 + "@cspell/dynamic-import": 9.2.0 + "@cspell/filetypes": 9.2.0 + "@cspell/strong-weak-map": 9.2.0 + "@cspell/url": 9.2.0 clear-module: ^4.1.2 comment-json: ^4.2.5 - cspell-config-lib: 9.0.0 - cspell-dictionary: 9.0.0 - cspell-glob: 9.0.0 - cspell-grammar: 9.0.0 - cspell-io: 9.0.0 - cspell-trie-lib: 9.0.0 + cspell-config-lib: 9.2.0 + cspell-dictionary: 9.2.0 + cspell-glob: 9.2.0 + cspell-grammar: 9.2.0 + cspell-io: 9.2.0 + cspell-trie-lib: 9.2.0 env-paths: ^3.0.0 fast-equals: ^5.2.2 gensequence: ^7.0.0 @@ -8142,46 +8649,58 @@ __metadata: vscode-languageserver-textdocument: ^1.0.12 vscode-uri: ^3.1.0 xdg-basedir: ^5.1.0 - checksum: d81d3f95353f0c331e6c0c7c076552f7fd7830918b1cd29bb74e32f7533eae7147800abeeefab46983e2b471a44414f3bf8efb6c5c375f19e258e02c58037d65 + checksum: 48de0fa29594886613ea273d0bdbc70bdd5e8a9b9f8e7297755b1d4585f131cfc0589367e8ad275b93811a23ea7a9a055265bd7dae29b08dc05998144ac1fb1d languageName: node linkType: hard -"cspell-trie-lib@npm:9.0.0": - version: 9.0.0 - resolution: "cspell-trie-lib@npm:9.0.0" +"cspell-trie-lib@npm:9.2.0": + version: 9.2.0 + resolution: "cspell-trie-lib@npm:9.2.0" dependencies: - "@cspell/cspell-pipe": 9.0.0 - "@cspell/cspell-types": 9.0.0 + "@cspell/cspell-pipe": 9.2.0 + "@cspell/cspell-types": 9.2.0 gensequence: ^7.0.0 - checksum: 28d6d34fb5a3b217ab58116efb3d30db0f745d00a800f6f6dd6b23637ffed0e2f10dc7058264be7cafcf8ae2a7c449ab9a83fc100fa4278234c388cc8debdbc5 + checksum: 8a5907d9b787a4c16ef05f46a897eed9ed686a8e897da939ee5e4cb6d8d0423623fe5528bc76c049816f52b6c6fe6d2c8e82907ccbb67031e8dd1d9879eab844 languageName: node linkType: hard "cspell@npm:^9.0.0": - version: 9.0.0 - resolution: "cspell@npm:9.0.0" - dependencies: - "@cspell/cspell-json-reporter": 9.0.0 - "@cspell/cspell-pipe": 9.0.0 - "@cspell/cspell-types": 9.0.0 - "@cspell/dynamic-import": 9.0.0 - "@cspell/url": 9.0.0 + version: 9.2.0 + resolution: "cspell@npm:9.2.0" + dependencies: + "@cspell/cspell-json-reporter": 9.2.0 + "@cspell/cspell-pipe": 9.2.0 + "@cspell/cspell-types": 9.2.0 + "@cspell/dynamic-import": 9.2.0 + "@cspell/url": 9.2.0 chalk: ^5.4.1 chalk-template: ^1.1.0 - commander: ^13.1.0 - cspell-dictionary: 9.0.0 - cspell-gitignore: 9.0.0 - cspell-glob: 9.0.0 - cspell-io: 9.0.0 - cspell-lib: 9.0.0 + commander: ^14.0.0 + cspell-config-lib: 9.2.0 + cspell-dictionary: 9.2.0 + cspell-gitignore: 9.2.0 + cspell-glob: 9.2.0 + cspell-io: 9.2.0 + cspell-lib: 9.2.0 fast-json-stable-stringify: ^2.1.0 - file-entry-cache: ^9.1.0 - semver: ^7.7.1 - tinyglobby: ^0.2.13 + flatted: ^3.3.3 + semver: ^7.7.2 + tinyglobby: ^0.2.14 bin: cspell: bin.mjs cspell-esm: bin.mjs - checksum: 22d586992565486f8d58f693be120b3871c24a7bb4b3642fff40f2fee78c40a9924540ee4329aaf1182cea0b6de96f2868bb3f09281b9b778a48b5e29ad5ff13 + checksum: 2b30b950606adb56ccbcec151a08a440e62b50581b0a4818dfe6b55d46a1885a8340814406c18da29f5ce0343d546ce9fc1b66e7ed101087c3a96a9e7fbcc2a0 + languageName: node + linkType: hard + +"css-blank-pseudo@npm:^7.0.1": + version: 7.0.1 + resolution: "css-blank-pseudo@npm:7.0.1" + dependencies: + postcss-selector-parser: ^7.0.0 + peerDependencies: + postcss: ^8.4 + checksum: 0720f013394141e129f757ffadb780a47be37fae71d195a1e8fbd02b038001bc2c3b62be83e397fe1fb1282ba656b7fce4e972d583defb6f8163e0d791c816a4 languageName: node linkType: hard @@ -8201,6 +8720,19 @@ __metadata: languageName: node linkType: hard +"css-has-pseudo@npm:^7.0.2": + version: 7.0.2 + resolution: "css-has-pseudo@npm:7.0.2" + dependencies: + "@csstools/selector-specificity": ^5.0.0 + postcss-selector-parser: ^7.0.0 + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.4 + checksum: 422ae6eb59982dcd7a9e2ccfe1471070c71764d7f7167d3541ed91c938791e66d3def93dcb25affb1f7ee366f221ddeffddb45c87a7ce7195d77d6d67e52be0e + languageName: node + linkType: hard + "css-loader@npm:^6.8.1": version: 6.10.0 resolution: "css-loader@npm:6.10.0" @@ -8254,6 +8786,15 @@ __metadata: languageName: node linkType: hard +"css-prefers-color-scheme@npm:^10.0.0": + version: 10.0.0 + resolution: "css-prefers-color-scheme@npm:10.0.0" + peerDependencies: + postcss: ^8.4 + checksum: 02b634aac859f5b07482563e39fc415544f8b35064b6b73e93408892dccb86fbb2eff407df4ae666780ee06350601fc6cd3ca42bc05900c7062f52589723d350 + languageName: node + linkType: hard + "css-select@npm:^4.1.3": version: 4.1.3 resolution: "css-select@npm:4.1.3" @@ -8324,6 +8865,13 @@ __metadata: languageName: node linkType: hard +"cssdb@npm:^8.3.0": + version: 8.3.0 + resolution: "cssdb@npm:8.3.0" + checksum: 1da768bfaa4ed1fa06251e3dd4d790b6611586d3a84fa8fb9f8f6be6acb430bbd3857e43fbea208c65f6c5f45d977691d256f5c6b4f4dfea218e85e2aa1b2adf + languageName: node + linkType: hard + "cssesc@npm:^3.0.0": version: 3.0.0 resolution: "cssesc@npm:3.0.0" @@ -8483,15 +9031,15 @@ __metadata: languageName: node linkType: hard -"debug@npm:4, debug@npm:^4.0.0, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.3.1, debug@npm:^4.3.2, debug@npm:^4.3.3, debug@npm:^4.3.4, debug@npm:^4.3.5, debug@npm:^4.3.6, debug@npm:^4.3.7, debug@npm:^4.4.0": - version: 4.4.0 - resolution: "debug@npm:4.4.0" +"debug@npm:4, debug@npm:^4.0.0, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.3.1, debug@npm:^4.3.2, debug@npm:^4.3.3, debug@npm:^4.3.4, debug@npm:^4.4.0, debug@npm:^4.4.1, debug@npm:^4.4.3": + version: 4.4.3 + resolution: "debug@npm:4.4.3" dependencies: ms: ^2.1.3 peerDependenciesMeta: supports-color: optional: true - checksum: fb42df878dd0e22816fc56e1fdca9da73caa85212fbe40c868b1295a6878f9101ae684f4eeef516c13acfc700f5ea07f1136954f43d4cd2d477a811144136479 + checksum: 4805abd570e601acdca85b6aa3757186084a45cff9b2fa6eee1f3b173caa776b45f478b2a71a572d616d2010cea9211d0ac4a02a610e4c18ac4324bde3760834 languageName: node linkType: hard @@ -8504,13 +9052,6 @@ __metadata: languageName: node linkType: hard -"decamelize@npm:^4.0.0": - version: 4.0.0 - resolution: "decamelize@npm:4.0.0" - checksum: b7d09b82652c39eead4d6678bb578e3bebd848add894b76d0f6b395bc45b2d692fb88d977e7cfb93c4ed6c119b05a1347cef261174916c2e75c0a8ca57da1809 - languageName: node - linkType: hard - "decode-named-character-reference@npm:^1.0.0": version: 1.0.2 resolution: "decode-named-character-reference@npm:1.0.2" @@ -8575,7 +9116,7 @@ __metadata: languageName: node linkType: hard -"defer-to-connect@npm:^2.0.1": +"defer-to-connect@npm:^2.0.0, defer-to-connect@npm:^2.0.1": version: 2.0.1 resolution: "defer-to-connect@npm:2.0.1" checksum: 8a9b50d2f25446c0bfefb55a48e90afd58f85b21bcf78e9207cd7b804354f6409032a1705c2491686e202e64fc05f147aa5aa45f9aa82627563f045937f5791b @@ -8600,7 +9141,7 @@ __metadata: languageName: node linkType: hard -"define-properties@npm:^1.1.3, define-properties@npm:^1.2.0, define-properties@npm:^1.2.1": +"define-properties@npm:^1.1.3, define-properties@npm:^1.2.1": version: 1.2.1 resolution: "define-properties@npm:1.2.1" dependencies: @@ -8641,7 +9182,7 @@ __metadata: languageName: node linkType: hard -"depd@npm:2.0.0, depd@npm:^2.0.0": +"depd@npm:2.0.0": version: 2.0.0 resolution: "depd@npm:2.0.0" checksum: abbe19c768c97ee2eed6282d8ce3031126662252c58d711f646921c9623f9052e3e1906443066beec1095832f534e57c523b7333f8e7e0d93051ab6baef5ab3a @@ -8655,13 +9196,6 @@ __metadata: languageName: node linkType: hard -"deprecation@npm:^2.0.0": - version: 2.3.1 - resolution: "deprecation@npm:2.3.1" - checksum: f56a05e182c2c195071385455956b0c4106fe14e36245b00c689ceef8e8ab639235176a96977ba7c74afb173317fac2e0ec6ec7a1c6d1e6eaa401c586c714132 - languageName: node - linkType: hard - "dequal@npm:^2.0.0": version: 2.0.3 resolution: "dequal@npm:2.0.3" @@ -8718,27 +9252,13 @@ __metadata: languageName: node linkType: hard -"diff-sequences@npm:^29.6.3": - version: 29.6.3 - resolution: "diff-sequences@npm:29.6.3" - checksum: f4914158e1f2276343d98ff5b31fc004e7304f5470bf0f1adb2ac6955d85a531a6458d33e87667f98f6ae52ebd3891bb47d420bb48a5bd8b7a27ee25b20e33aa - languageName: node - linkType: hard - -"diff@npm:^5.2.0": +"diff@npm:^5.1.0": version: 5.2.0 resolution: "diff@npm:5.2.0" checksum: 12b63ca9c36c72bafa3effa77121f0581b4015df18bc16bac1f8e263597735649f1a173c26f7eba17fb4162b073fee61788abe49610e6c70a2641fe1895443fd languageName: node linkType: hard -"diff@npm:^7.0.0": - version: 7.0.0 - resolution: "diff@npm:7.0.0" - checksum: 5db0d339476b18dfbc8a08a7504fbcc74789eec626c8d20cf2cdd1871f1448962888128f4447c8f50a1e41a80decfe5e8489c375843b8cf1d42b7c2b611da4e1 - languageName: node - linkType: hard - "dir-glob@npm:^3.0.1": version: 3.0.1 resolution: "dir-glob@npm:3.0.1" @@ -8840,6 +9360,13 @@ __metadata: languageName: node linkType: hard +"dompurify@npm:3.1.7": + version: 3.1.7 + resolution: "dompurify@npm:3.1.7" + checksum: 0a9b811bbc94f3dba60cf6486962362b0f1a5b4ab789f5e1cbd4749b6ba1a1fad190a677a962dc8850ce28764424765fe425e9d6508e4e93ba648ef15d54bc24 + languageName: node + linkType: hard + "domutils@npm:^2.5.2, domutils@npm:^2.6.0": version: 2.8.0 resolution: "domutils@npm:2.8.0" @@ -8890,7 +9417,7 @@ __metadata: languageName: node linkType: hard -"dotenv@npm:^16.4.4, dotenv@npm:~16.4.5": +"dotenv@npm:^16.3.1, dotenv@npm:^16.4.4, dotenv@npm:~16.4.5": version: 16.4.5 resolution: "dotenv@npm:16.4.5" checksum: 301a12c3d44fd49888b74eb9ccf9f07a1f5df43f489e7fcb89647a2edcd84c42d6bc349dc8df099cd18f07c35c7b04685c1a4f3e6a6a9e6b30f8d48c15b7f49c @@ -8940,10 +9467,10 @@ __metadata: languageName: node linkType: hard -"electron-to-chromium@npm:^1.5.149": - version: 1.5.149 - resolution: "electron-to-chromium@npm:1.5.149" - checksum: 7f91d8293a48fab7dabb15c4569f8704e56320ccf7039f71134f03d601bada089393852e257cf7639233fc3fd2a558664ccca9e530287d40f94d64d107f3acab +"electron-to-chromium@npm:^1.5.160": + version: 1.5.161 + resolution: "electron-to-chromium@npm:1.5.161" + checksum: 80cbed2237eec0349878692600971c57a099d08c1928ae812aa8f7e96cc0220088a4f1854b8bdcb464ec5cb553805bcc69373b49157776ca9828c58539a534d6 languageName: node linkType: hard @@ -8996,13 +9523,6 @@ __metadata: languageName: node linkType: hard -"encodeurl@npm:^2.0.0": - version: 2.0.0 - resolution: "encodeurl@npm:2.0.0" - checksum: abf5cd51b78082cf8af7be6785813c33b6df2068ce5191a40ca8b1afe6a86f9230af9a9ce694a5ce4665955e5c1120871826df9c128a642e09c58d592e2807fe - languageName: node - linkType: hard - "encodeurl@npm:~1.0.2": version: 1.0.2 resolution: "encodeurl@npm:1.0.2" @@ -9019,22 +9539,22 @@ __metadata: languageName: node linkType: hard -"end-of-stream@npm:^1.4.1": - version: 1.4.4 - resolution: "end-of-stream@npm:1.4.4" +"end-of-stream@npm:^1.1.0, end-of-stream@npm:^1.4.1": + version: 1.4.5 + resolution: "end-of-stream@npm:1.4.5" dependencies: once: ^1.4.0 - checksum: 530a5a5a1e517e962854a31693dbb5c0b2fc40b46dad2a56a2deec656ca040631124f4795823acc68238147805f8b021abbe221f4afed5ef3c8e8efc2024908b + checksum: 1e0cfa6e7f49887544e03314f9dfc56a8cb6dde910cbb445983ecc2ff426fc05946df9d75d8a21a3a64f2cecfe1bf88f773952029f46756b2ed64a24e95b1fb8 languageName: node linkType: hard -"enhanced-resolve@npm:^5.17.1, enhanced-resolve@npm:^5.18.1": - version: 5.18.1 - resolution: "enhanced-resolve@npm:5.18.1" +"enhanced-resolve@npm:^5.17.3": + version: 5.18.3 + resolution: "enhanced-resolve@npm:5.18.3" dependencies: graceful-fs: ^4.2.4 tapable: ^2.2.0 - checksum: de5bea7debe3576e78173bcc409c4aee7fcb56580c602d5c47c533b92952e55d7da3d9f53b864846ba62c8bd3efb0f9ecfe5f865e57de2f3e9b6e5cda03b4e7e + checksum: e2b2188a7f9b68616984b5ce1f43b97bef3c5fde4d193c24ea4cfdb4eb784a700093f049f14155733a3cb3ae1204550590aa37dda7e742022c8f447f618a4816 languageName: node linkType: hard @@ -9098,25 +9618,26 @@ __metadata: languageName: node linkType: hard -"es-abstract@npm:^1.17.5, es-abstract@npm:^1.22.1, es-abstract@npm:^1.23.2, es-abstract@npm:^1.23.3, es-abstract@npm:^1.23.5, es-abstract@npm:^1.23.6": - version: 1.23.8 - resolution: "es-abstract@npm:1.23.8" +"es-abstract@npm:^1.17.5, es-abstract@npm:^1.23.2, es-abstract@npm:^1.23.3, es-abstract@npm:^1.23.5, es-abstract@npm:^1.23.6, es-abstract@npm:^1.23.9, es-abstract@npm:^1.24.0": + version: 1.24.0 + resolution: "es-abstract@npm:1.24.0" dependencies: array-buffer-byte-length: ^1.0.2 arraybuffer.prototype.slice: ^1.0.4 available-typed-arrays: ^1.0.7 call-bind: ^1.0.8 - call-bound: ^1.0.3 + call-bound: ^1.0.4 data-view-buffer: ^1.0.2 data-view-byte-length: ^1.0.2 data-view-byte-offset: ^1.0.1 es-define-property: ^1.0.1 es-errors: ^1.3.0 - es-object-atoms: ^1.0.0 - es-set-tostringtag: ^2.0.3 + es-object-atoms: ^1.1.1 + es-set-tostringtag: ^2.1.0 es-to-primitive: ^1.3.0 function.prototype.name: ^1.1.8 - get-intrinsic: ^1.2.6 + get-intrinsic: ^1.3.0 + get-proto: ^1.0.1 get-symbol-description: ^1.1.0 globalthis: ^1.0.4 gopd: ^1.2.0 @@ -9128,20 +9649,24 @@ __metadata: is-array-buffer: ^3.0.5 is-callable: ^1.2.7 is-data-view: ^1.0.2 + is-negative-zero: ^2.0.3 is-regex: ^1.2.1 + is-set: ^2.0.3 is-shared-array-buffer: ^1.0.4 is-string: ^1.1.1 is-typed-array: ^1.1.15 - is-weakref: ^1.1.0 + is-weakref: ^1.1.1 math-intrinsics: ^1.1.0 - object-inspect: ^1.13.3 + object-inspect: ^1.13.4 object-keys: ^1.1.1 object.assign: ^4.1.7 - own-keys: ^1.0.0 - regexp.prototype.flags: ^1.5.3 + own-keys: ^1.0.1 + regexp.prototype.flags: ^1.5.4 safe-array-concat: ^1.1.3 safe-push-apply: ^1.0.0 safe-regex-test: ^1.1.0 + set-proto: ^1.0.0 + stop-iteration-iterator: ^1.1.0 string.prototype.trim: ^1.2.10 string.prototype.trimend: ^1.0.9 string.prototype.trimstart: ^1.0.8 @@ -9150,8 +9675,8 @@ __metadata: typed-array-byte-offset: ^1.0.4 typed-array-length: ^1.0.7 unbox-primitive: ^1.1.0 - which-typed-array: ^1.1.18 - checksum: b91916702b8147bf3f2ed35c83a7c3f19ba09641364ebce8351d60358fa49ac66da353fe4a991de72502bb4853f52e51e3f2f93920c7c8d5dc01ab2b30d77b17 + which-typed-array: ^1.1.19 + checksum: 06b3d605e56e3da9d16d4db2629a42dac1ca31f2961a41d15c860422a266115e865b43e82d6b9da81a0fabbbb65ebc12fb68b0b755bc9dbddacb6bf7450e96df languageName: node linkType: hard @@ -9193,39 +9718,40 @@ __metadata: languageName: node linkType: hard -"es-module-lexer@npm:^1.2.1, es-module-lexer@npm:^1.5.3, es-module-lexer@npm:^1.7.0": +"es-module-lexer@npm:^1.2.1, es-module-lexer@npm:^1.7.0": version: 1.7.0 resolution: "es-module-lexer@npm:1.7.0" checksum: 7858bb76ae387fdbf8a6fccc951bf18919768309850587553eca34698b9193fbc65fab03d3d9f69163d860321fbf66adf89d5821e7f4148c7cb7d7b997259211 languageName: node linkType: hard -"es-object-atoms@npm:^1.0.0": - version: 1.0.0 - resolution: "es-object-atoms@npm:1.0.0" +"es-object-atoms@npm:^1.0.0, es-object-atoms@npm:^1.1.1": + version: 1.1.1 + resolution: "es-object-atoms@npm:1.1.1" dependencies: es-errors: ^1.3.0 - checksum: 26f0ff78ab93b63394e8403c353842b2272836968de4eafe97656adfb8a7c84b9099bf0fe96ed58f4a4cddc860f6e34c77f91649a58a5daa4a9c40b902744e3c + checksum: 214d3767287b12f36d3d7267ef342bbbe1e89f899cfd67040309fc65032372a8e60201410a99a1645f2f90c1912c8c49c8668066f6bdd954bcd614dda2e3da97 languageName: node linkType: hard -"es-set-tostringtag@npm:^2.0.3": - version: 2.0.3 - resolution: "es-set-tostringtag@npm:2.0.3" +"es-set-tostringtag@npm:^2.0.3, es-set-tostringtag@npm:^2.1.0": + version: 2.1.0 + resolution: "es-set-tostringtag@npm:2.1.0" dependencies: - get-intrinsic: ^1.2.4 + es-errors: ^1.3.0 + get-intrinsic: ^1.2.6 has-tostringtag: ^1.0.2 - hasown: ^2.0.1 - checksum: 7227fa48a41c0ce83e0377b11130d324ac797390688135b8da5c28994c0165be8b252e15cd1de41e1325e5a5412511586960213e88f9ab4a5e7d028895db5129 + hasown: ^2.0.2 + checksum: 789f35de4be3dc8d11fdcb91bc26af4ae3e6d602caa93299a8c45cf05d36cc5081454ae2a6d3afa09cceca214b76c046e4f8151e092e6fc7feeb5efb9e794fc6 languageName: node linkType: hard -"es-shim-unscopables@npm:^1.0.0, es-shim-unscopables@npm:^1.0.2": - version: 1.0.2 - resolution: "es-shim-unscopables@npm:1.0.2" +"es-shim-unscopables@npm:^1.0.2, es-shim-unscopables@npm:^1.1.0": + version: 1.1.0 + resolution: "es-shim-unscopables@npm:1.1.0" dependencies: - hasown: ^2.0.0 - checksum: 432bd527c62065da09ed1d37a3f8e623c423683285e6188108286f4a1e8e164a5bcbfbc0051557c7d14633cd2a41ce24c7048e6bbb66a985413fd32f1be72626 + hasown: ^2.0.2 + checksum: 33cfb1ebcb2f869f0bf528be1a8660b4fe8b6cec8fc641f330e508db2284b58ee2980fad6d0828882d22858c759c0806076427a3673b6daa60f753e3b558ee15 languageName: node linkType: hard @@ -9240,35 +9766,47 @@ __metadata: languageName: node linkType: hard -"esbuild@npm:^0.25.0": - version: 0.25.4 - resolution: "esbuild@npm:0.25.4" - dependencies: - "@esbuild/aix-ppc64": 0.25.4 - "@esbuild/android-arm": 0.25.4 - "@esbuild/android-arm64": 0.25.4 - "@esbuild/android-x64": 0.25.4 - "@esbuild/darwin-arm64": 0.25.4 - "@esbuild/darwin-x64": 0.25.4 - "@esbuild/freebsd-arm64": 0.25.4 - "@esbuild/freebsd-x64": 0.25.4 - "@esbuild/linux-arm": 0.25.4 - "@esbuild/linux-arm64": 0.25.4 - "@esbuild/linux-ia32": 0.25.4 - "@esbuild/linux-loong64": 0.25.4 - "@esbuild/linux-mips64el": 0.25.4 - "@esbuild/linux-ppc64": 0.25.4 - "@esbuild/linux-riscv64": 0.25.4 - "@esbuild/linux-s390x": 0.25.4 - "@esbuild/linux-x64": 0.25.4 - "@esbuild/netbsd-arm64": 0.25.4 - "@esbuild/netbsd-x64": 0.25.4 - "@esbuild/openbsd-arm64": 0.25.4 - "@esbuild/openbsd-x64": 0.25.4 - "@esbuild/sunos-x64": 0.25.4 - "@esbuild/win32-arm64": 0.25.4 - "@esbuild/win32-ia32": 0.25.4 - "@esbuild/win32-x64": 0.25.4 +"es-toolkit@npm:^1.39.7": + version: 1.39.10 + resolution: "es-toolkit@npm:1.39.10" + dependenciesMeta: + "@trivago/prettier-plugin-sort-imports@4.3.0": + unplugged: true + prettier-plugin-sort-re-exports@0.0.1: + unplugged: true + checksum: 128d018238487ac58da9447c629943178498a4378737aaca3acc6b1948c0b45eb3d5f5a5c0487247b6b7b3d89b44dfd2977f531512dff7c31ec6b12485c9230d + languageName: node + linkType: hard + +"esbuild@npm:^0.25.0, esbuild@npm:~0.25.0": + version: 0.25.5 + resolution: "esbuild@npm:0.25.5" + dependencies: + "@esbuild/aix-ppc64": 0.25.5 + "@esbuild/android-arm": 0.25.5 + "@esbuild/android-arm64": 0.25.5 + "@esbuild/android-x64": 0.25.5 + "@esbuild/darwin-arm64": 0.25.5 + "@esbuild/darwin-x64": 0.25.5 + "@esbuild/freebsd-arm64": 0.25.5 + "@esbuild/freebsd-x64": 0.25.5 + "@esbuild/linux-arm": 0.25.5 + "@esbuild/linux-arm64": 0.25.5 + "@esbuild/linux-ia32": 0.25.5 + "@esbuild/linux-loong64": 0.25.5 + "@esbuild/linux-mips64el": 0.25.5 + "@esbuild/linux-ppc64": 0.25.5 + "@esbuild/linux-riscv64": 0.25.5 + "@esbuild/linux-s390x": 0.25.5 + "@esbuild/linux-x64": 0.25.5 + "@esbuild/netbsd-arm64": 0.25.5 + "@esbuild/netbsd-x64": 0.25.5 + "@esbuild/openbsd-arm64": 0.25.5 + "@esbuild/openbsd-x64": 0.25.5 + "@esbuild/sunos-x64": 0.25.5 + "@esbuild/win32-arm64": 0.25.5 + "@esbuild/win32-ia32": 0.25.5 + "@esbuild/win32-x64": 0.25.5 dependenciesMeta: "@esbuild/aix-ppc64": optional: true @@ -9322,119 +9860,37 @@ __metadata: optional: true bin: esbuild: bin/esbuild - checksum: cd39e0236ba9ab39d28e5ba0aab9b63b3f7f3fdcd449422bfcaff087aedcf4fa0e754cb89fba37d96c67874e995e3c02634ef392f09928cdf4a5daf4dddd0171 - languageName: node - linkType: hard - -"esbuild@npm:~0.20.2": - version: 0.20.2 - resolution: "esbuild@npm:0.20.2" - dependencies: - "@esbuild/aix-ppc64": 0.20.2 - "@esbuild/android-arm": 0.20.2 - "@esbuild/android-arm64": 0.20.2 - "@esbuild/android-x64": 0.20.2 - "@esbuild/darwin-arm64": 0.20.2 - "@esbuild/darwin-x64": 0.20.2 - "@esbuild/freebsd-arm64": 0.20.2 - "@esbuild/freebsd-x64": 0.20.2 - "@esbuild/linux-arm": 0.20.2 - "@esbuild/linux-arm64": 0.20.2 - "@esbuild/linux-ia32": 0.20.2 - "@esbuild/linux-loong64": 0.20.2 - "@esbuild/linux-mips64el": 0.20.2 - "@esbuild/linux-ppc64": 0.20.2 - "@esbuild/linux-riscv64": 0.20.2 - "@esbuild/linux-s390x": 0.20.2 - "@esbuild/linux-x64": 0.20.2 - "@esbuild/netbsd-x64": 0.20.2 - "@esbuild/openbsd-x64": 0.20.2 - "@esbuild/sunos-x64": 0.20.2 - "@esbuild/win32-arm64": 0.20.2 - "@esbuild/win32-ia32": 0.20.2 - "@esbuild/win32-x64": 0.20.2 - dependenciesMeta: - "@esbuild/aix-ppc64": - optional: true - "@esbuild/android-arm": - optional: true - "@esbuild/android-arm64": - optional: true - "@esbuild/android-x64": - optional: true - "@esbuild/darwin-arm64": - optional: true - "@esbuild/darwin-x64": - optional: true - "@esbuild/freebsd-arm64": - optional: true - "@esbuild/freebsd-x64": - optional: true - "@esbuild/linux-arm": - optional: true - "@esbuild/linux-arm64": - optional: true - "@esbuild/linux-ia32": - optional: true - "@esbuild/linux-loong64": - optional: true - "@esbuild/linux-mips64el": - optional: true - "@esbuild/linux-ppc64": - optional: true - "@esbuild/linux-riscv64": - optional: true - "@esbuild/linux-s390x": - optional: true - "@esbuild/linux-x64": - optional: true - "@esbuild/netbsd-x64": - optional: true - "@esbuild/openbsd-x64": - optional: true - "@esbuild/sunos-x64": - optional: true - "@esbuild/win32-arm64": - optional: true - "@esbuild/win32-ia32": - optional: true - "@esbuild/win32-x64": - optional: true - bin: - esbuild: bin/esbuild - checksum: bc88050fc1ca5c1bd03648f9979e514bdefb956a63aa3974373bb7b9cbac0b3aac9b9da1b5bdca0b3490e39d6b451c72815dbd6b7d7f978c91fbe9c9e9aa4e4c + checksum: 2aa6f47c27a2f0fbf1e2eeed1df6c5449750ef598b9b49c95d8b654ec04423b70064de4f85a9e879c363402eb4f2fad59f37c996c329df1dc514b10f8ae76dd0 languageName: node linkType: hard -"esbuild@npm:~0.25.0": - version: 0.25.3 - resolution: "esbuild@npm:0.25.3" - dependencies: - "@esbuild/aix-ppc64": 0.25.3 - "@esbuild/android-arm": 0.25.3 - "@esbuild/android-arm64": 0.25.3 - "@esbuild/android-x64": 0.25.3 - "@esbuild/darwin-arm64": 0.25.3 - "@esbuild/darwin-x64": 0.25.3 - "@esbuild/freebsd-arm64": 0.25.3 - "@esbuild/freebsd-x64": 0.25.3 - "@esbuild/linux-arm": 0.25.3 - "@esbuild/linux-arm64": 0.25.3 - "@esbuild/linux-ia32": 0.25.3 - "@esbuild/linux-loong64": 0.25.3 - "@esbuild/linux-mips64el": 0.25.3 - "@esbuild/linux-ppc64": 0.25.3 - "@esbuild/linux-riscv64": 0.25.3 - "@esbuild/linux-s390x": 0.25.3 - "@esbuild/linux-x64": 0.25.3 - "@esbuild/netbsd-arm64": 0.25.3 - "@esbuild/netbsd-x64": 0.25.3 - "@esbuild/openbsd-arm64": 0.25.3 - "@esbuild/openbsd-x64": 0.25.3 - "@esbuild/sunos-x64": 0.25.3 - "@esbuild/win32-arm64": 0.25.3 - "@esbuild/win32-ia32": 0.25.3 - "@esbuild/win32-x64": 0.25.3 +"esbuild@npm:~0.20.2": + version: 0.20.2 + resolution: "esbuild@npm:0.20.2" + dependencies: + "@esbuild/aix-ppc64": 0.20.2 + "@esbuild/android-arm": 0.20.2 + "@esbuild/android-arm64": 0.20.2 + "@esbuild/android-x64": 0.20.2 + "@esbuild/darwin-arm64": 0.20.2 + "@esbuild/darwin-x64": 0.20.2 + "@esbuild/freebsd-arm64": 0.20.2 + "@esbuild/freebsd-x64": 0.20.2 + "@esbuild/linux-arm": 0.20.2 + "@esbuild/linux-arm64": 0.20.2 + "@esbuild/linux-ia32": 0.20.2 + "@esbuild/linux-loong64": 0.20.2 + "@esbuild/linux-mips64el": 0.20.2 + "@esbuild/linux-ppc64": 0.20.2 + "@esbuild/linux-riscv64": 0.20.2 + "@esbuild/linux-s390x": 0.20.2 + "@esbuild/linux-x64": 0.20.2 + "@esbuild/netbsd-x64": 0.20.2 + "@esbuild/openbsd-x64": 0.20.2 + "@esbuild/sunos-x64": 0.20.2 + "@esbuild/win32-arm64": 0.20.2 + "@esbuild/win32-ia32": 0.20.2 + "@esbuild/win32-x64": 0.20.2 dependenciesMeta: "@esbuild/aix-ppc64": optional: true @@ -9470,12 +9926,8 @@ __metadata: optional: true "@esbuild/linux-x64": optional: true - "@esbuild/netbsd-arm64": - optional: true "@esbuild/netbsd-x64": optional: true - "@esbuild/openbsd-arm64": - optional: true "@esbuild/openbsd-x64": optional: true "@esbuild/sunos-x64": @@ -9488,7 +9940,7 @@ __metadata: optional: true bin: esbuild: bin/esbuild - checksum: 1f9af51aa1d7d1f57e7294823d19ed69b0f6da413b7b0e8123abcebd1bb4011ef19961e2e6679c07301fcd00a85c4d102160fc40a91c25ceeaf594932509d84d + checksum: bc88050fc1ca5c1bd03648f9979e514bdefb956a63aa3974373bb7b9cbac0b3aac9b9da1b5bdca0b3490e39d6b451c72815dbd6b7d7f978c91fbe9c9e9aa4e4c languageName: node linkType: hard @@ -9545,77 +9997,76 @@ __metadata: languageName: node linkType: hard -"eslint-module-utils@npm:^2.12.0": - version: 2.12.0 - resolution: "eslint-module-utils@npm:2.12.0" +"eslint-module-utils@npm:^2.12.1": + version: 2.12.1 + resolution: "eslint-module-utils@npm:2.12.1" dependencies: debug: ^3.2.7 peerDependenciesMeta: eslint: optional: true - checksum: be3ac52e0971c6f46daeb1a7e760e45c7c45f820c8cc211799f85f10f04ccbf7afc17039165d56cb2da7f7ca9cec2b3a777013cddf0b976784b37eb9efa24180 + checksum: 2f074670d8c934687820a83140048776b28bbaf35fc37f35623f63cc9c438d496d11f0683b4feabb9a120435435d4a69604b1c6c567f118be2c9a0aba6760fc1 languageName: node linkType: hard -"eslint-plugin-eslint-plugin@npm:^6.3.1": - version: 6.4.0 - resolution: "eslint-plugin-eslint-plugin@npm:6.4.0" +"eslint-plugin-eslint-plugin@npm:^7.0.0": + version: 7.0.0 + resolution: "eslint-plugin-eslint-plugin@npm:7.0.0" dependencies: "@eslint-community/eslint-utils": ^4.4.0 estraverse: ^5.3.0 peerDependencies: - eslint: ">=8.23.0" - checksum: 8cf4e4928c207fec5fd5ae025a0ec3c11e8d7d147aee1732a0eff4c3d258a279981ca26d3d4b35df22dcc61db0da8973d51466f1c783d5e03785c78e167ba03c + eslint: ">=9.0.0" + checksum: b67099bbb56a2abc28e09f296ae9b04e23401c72cf2f611c50010644f8a5ab732801c7367f1784c6522ca4e727e1144d4590878065c84b384bb634b70c4d0f5e languageName: node linkType: hard -"eslint-plugin-import@npm:^2.31.0": - version: 2.31.0 - resolution: "eslint-plugin-import@npm:2.31.0" +"eslint-plugin-import@npm:^2.32.0": + version: 2.32.0 + resolution: "eslint-plugin-import@npm:2.32.0" dependencies: "@rtsao/scc": ^1.1.0 - array-includes: ^3.1.8 - array.prototype.findlastindex: ^1.2.5 - array.prototype.flat: ^1.3.2 - array.prototype.flatmap: ^1.3.2 + array-includes: ^3.1.9 + array.prototype.findlastindex: ^1.2.6 + array.prototype.flat: ^1.3.3 + array.prototype.flatmap: ^1.3.3 debug: ^3.2.7 doctrine: ^2.1.0 eslint-import-resolver-node: ^0.3.9 - eslint-module-utils: ^2.12.0 + eslint-module-utils: ^2.12.1 hasown: ^2.0.2 - is-core-module: ^2.15.1 + is-core-module: ^2.16.1 is-glob: ^4.0.3 minimatch: ^3.1.2 object.fromentries: ^2.0.8 object.groupby: ^1.0.3 - object.values: ^1.2.0 + object.values: ^1.2.1 semver: ^6.3.1 - string.prototype.trimend: ^1.0.8 + string.prototype.trimend: ^1.0.9 tsconfig-paths: ^3.15.0 peerDependencies: eslint: ^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8 || ^9 - checksum: b1d2ac268b3582ff1af2a72a2c476eae4d250c100f2e335b6e102036e4a35efa530b80ec578dfc36761fabb34a635b9bf5ab071abe9d4404a4bb054fdf22d415 + checksum: 8cd40595b5e4346d3698eb577014b4b6d0ba57b7b9edf975be4f052a89330ec202d0cc5c3861d37ebeafa151b6264821410243889b0c31710911a6b625bcf76b languageName: node linkType: hard "eslint-plugin-jsdoc@npm:^50.5.0": - version: 50.6.0 - resolution: "eslint-plugin-jsdoc@npm:50.6.0" + version: 50.8.0 + resolution: "eslint-plugin-jsdoc@npm:50.8.0" dependencies: - "@es-joy/jsdoccomment": ~0.49.0 + "@es-joy/jsdoccomment": ~0.50.2 are-docs-informative: ^0.0.2 comment-parser: 1.4.1 - debug: ^4.3.6 + debug: ^4.4.1 escape-string-regexp: ^4.0.0 - espree: ^10.1.0 + espree: ^10.3.0 esquery: ^1.6.0 - parse-imports: ^2.1.1 - semver: ^7.6.3 + parse-imports-exports: ^0.2.4 + semver: ^7.7.2 spdx-expression-parse: ^4.0.0 - synckit: ^0.9.1 peerDependencies: eslint: ^7.0.0 || ^8.0.0 || ^9.0.0 - checksum: 012528306fa67cf76ef6d202d59d1c1834aa33f450950a30eae50805d244d90c4d8a3a2887a508be32f07992239d96fab880b7f5123e6dd1a05239759b5af00e + checksum: 79512f79f0d707c998ff24b74db3e87594bb2716f30e30c0e67941f71a0ab47114a5f792b5fa00d33d97ef349e1c276898e8bfed28e068695623db81c8114b77 languageName: node linkType: hard @@ -9644,30 +10095,16 @@ __metadata: languageName: node linkType: hard -"eslint-plugin-perfectionist@npm:^3.9.1": - version: 3.9.1 - resolution: "eslint-plugin-perfectionist@npm:3.9.1" +"eslint-plugin-perfectionist@npm:^4.12.3": + version: 4.15.0 + resolution: "eslint-plugin-perfectionist@npm:4.15.0" dependencies: - "@typescript-eslint/types": ^8.9.0 - "@typescript-eslint/utils": ^8.9.0 - minimatch: ^9.0.5 - natural-compare-lite: ^1.4.0 + "@typescript-eslint/types": ^8.34.1 + "@typescript-eslint/utils": ^8.34.1 + natural-orderby: ^5.0.0 peerDependencies: - astro-eslint-parser: ^1.0.2 - eslint: ">=8.0.0" - svelte: ">=3.0.0" - svelte-eslint-parser: ^0.41.1 - vue-eslint-parser: ">=9.0.0" - peerDependenciesMeta: - astro-eslint-parser: - optional: true - svelte: - optional: true - svelte-eslint-parser: - optional: true - vue-eslint-parser: - optional: true - checksum: 12bdc52586dd379bb174cb90c11d280173da88c079a3100eb2676ba9e8abf02e3989706fb06fc774331dc61909be27a0ba5c7ac591e9a777c793d7f8e5eb187d + eslint: ">=8.45.0" + checksum: 84a7ff19a18afc08d3b992e89a9af646b83c7ae925b62e689832d311931abcb1e531793de150ac15609b9819e157f85b155070f471c40ae65821e326f287ec4f languageName: node linkType: hard @@ -9709,8 +10146,8 @@ __metadata: linkType: hard "eslint-plugin-regexp@npm:^2.7.0": - version: 2.7.0 - resolution: "eslint-plugin-regexp@npm:2.7.0" + version: 2.10.0 + resolution: "eslint-plugin-regexp@npm:2.10.0" dependencies: "@eslint-community/eslint-utils": ^4.2.0 "@eslint-community/regexpp": ^4.11.0 @@ -9721,7 +10158,7 @@ __metadata: scslre: ^0.3.0 peerDependencies: eslint: ">=8.44.0" - checksum: 8df259c085288e887d5b832cb4c3295cc863e7a917029069930c6ff9228fdc2c4d5252d7bc9bcfda8a87501ce9ccfb08b211547397c5888a32152afbe80718b5 + checksum: 427889ab02e2f51e6d2068309c2cd9cca4462dbedc7ed421e321bd67fee347e8fed188045b9dabb11189899289f265c44a2ed35c3f5787bd8a3421c1947bb8d1 languageName: node linkType: hard @@ -9762,13 +10199,13 @@ __metadata: languageName: node linkType: hard -"eslint-scope@npm:^8.3.0": - version: 8.3.0 - resolution: "eslint-scope@npm:8.3.0" +"eslint-scope@npm:^8.4.0": + version: 8.4.0 + resolution: "eslint-scope@npm:8.4.0" dependencies: esrecurse: ^4.3.0 estraverse: ^5.2.0 - checksum: 57a58b6716533e25d527089826c4add89a047aecf75e4a88fee05f113ef5a72b85392b304a69bf670646cc3e068354aec70361b9718c2453949a05fc4d9bfe73 + checksum: cf88f42cd5e81490d549dc6d350fe01e6fe420f9d9ea34f134bb359b030e3c4ef888d36667632e448937fe52449f7181501df48c08200e3d3b0fee250d05364e languageName: node linkType: hard @@ -9786,29 +10223,28 @@ __metadata: languageName: node linkType: hard -"eslint-visitor-keys@npm:^4.2.0": - version: 4.2.0 - resolution: "eslint-visitor-keys@npm:4.2.0" - checksum: 779c604672b570bb4da84cef32f6abb085ac78379779c1122d7879eade8bb38ae715645324597cf23232d03cef06032c9844d25c73625bc282a5bfd30247e5b5 +"eslint-visitor-keys@npm:^4.2.1": + version: 4.2.1 + resolution: "eslint-visitor-keys@npm:4.2.1" + checksum: 3a77e3f99a49109f6fb2c5b7784bc78f9743b834d238cdba4d66c602c6b52f19ed7bcd0a5c5dbbeae3a8689fd785e76c001799f53d2228b278282cf9f699fff5 languageName: node linkType: hard "eslint@npm:*, eslint@npm:^9.15.0, eslint@npm:^9.26.0": - version: 9.26.0 - resolution: "eslint@npm:9.26.0" + version: 9.36.0 + resolution: "eslint@npm:9.36.0" dependencies: - "@eslint-community/eslint-utils": ^4.2.0 + "@eslint-community/eslint-utils": ^4.8.0 "@eslint-community/regexpp": ^4.12.1 - "@eslint/config-array": ^0.20.0 - "@eslint/config-helpers": ^0.2.1 - "@eslint/core": ^0.13.0 + "@eslint/config-array": ^0.21.0 + "@eslint/config-helpers": ^0.3.1 + "@eslint/core": ^0.15.2 "@eslint/eslintrc": ^3.3.1 - "@eslint/js": 9.26.0 - "@eslint/plugin-kit": ^0.2.8 + "@eslint/js": 9.36.0 + "@eslint/plugin-kit": ^0.3.5 "@humanfs/node": ^0.16.6 "@humanwhocodes/module-importer": ^1.0.1 "@humanwhocodes/retry": ^0.4.2 - "@modelcontextprotocol/sdk": ^1.8.0 "@types/estree": ^1.0.6 "@types/json-schema": ^7.0.15 ajv: ^6.12.4 @@ -9816,9 +10252,9 @@ __metadata: cross-spawn: ^7.0.6 debug: ^4.3.2 escape-string-regexp: ^4.0.0 - eslint-scope: ^8.3.0 - eslint-visitor-keys: ^4.2.0 - espree: ^10.3.0 + eslint-scope: ^8.4.0 + eslint-visitor-keys: ^4.2.1 + espree: ^10.4.0 esquery: ^1.5.0 esutils: ^2.0.2 fast-deep-equal: ^3.1.3 @@ -9833,7 +10269,6 @@ __metadata: minimatch: ^3.1.2 natural-compare: ^1.4.0 optionator: ^0.9.3 - zod: ^3.24.2 peerDependencies: jiti: "*" peerDependenciesMeta: @@ -9841,18 +10276,18 @@ __metadata: optional: true bin: eslint: bin/eslint.js - checksum: 9f17db3a3b759ca2435a19ced30f77354761fe159bb357bc7edcc716f4985fd2b8b84e667a85f9ee9ea3cb0f9718e029a822f97ae6b70421c5880c8b3b2214be + checksum: 08a02a1d474cf7ea63ef9328e638751c939a1c08b99f7812f0f44a96e3b8346ab3bbca3af57da8b3e74cbc6619e41645fd3dcb3adda94d1cb826f02664e2d44c languageName: node linkType: hard -"espree@npm:^10.0.1, espree@npm:^10.1.0, espree@npm:^10.3.0": - version: 10.3.0 - resolution: "espree@npm:10.3.0" +"espree@npm:^10.0.1, espree@npm:^10.3.0, espree@npm:^10.4.0": + version: 10.4.0 + resolution: "espree@npm:10.4.0" dependencies: - acorn: ^8.14.0 + acorn: ^8.15.0 acorn-jsx: ^5.3.2 - eslint-visitor-keys: ^4.2.0 - checksum: 63e8030ff5a98cea7f8b3e3a1487c998665e28d674af08b9b3100ed991670eb3cbb0e308c4548c79e03762753838fbe530c783f17309450d6b47a889fee72bef + eslint-visitor-keys: ^4.2.1 + checksum: 5f9d0d7c81c1bca4bfd29a55270067ff9d575adb8c729a5d7f779c2c7b910bfc68ccf8ec19b29844b707440fc159a83868f22c8e87bbf7cbcb225ed067df6c85 languageName: node linkType: hard @@ -9987,7 +10422,7 @@ __metadata: languageName: node linkType: hard -"etag@npm:^1.8.1, etag@npm:~1.8.1": +"etag@npm:~1.8.1": version: 1.8.1 resolution: "etag@npm:1.8.1" checksum: 571aeb3dbe0f2bbd4e4fadbdb44f325fc75335cd5f6f6b6a091e6a06a9f25ed5392f0863c5442acb0646787446e816f13cbfc6edce5b07658541dff573cab1ff @@ -10025,22 +10460,6 @@ __metadata: languageName: node linkType: hard -"eventsource-parser@npm:^3.0.1": - version: 3.0.1 - resolution: "eventsource-parser@npm:3.0.1" - checksum: 737f78d1330d7c257125c6b2bd374bb50c5588ac81eb83c05cd6af81fce295bd40fd3d3bb3357ba028a688267363f07912a7e6044656033cde7e8f836d840e40 - languageName: node - linkType: hard - -"eventsource@npm:^3.0.2": - version: 3.0.6 - resolution: "eventsource@npm:3.0.6" - dependencies: - eventsource-parser: ^3.0.1 - checksum: ac3bc3cc339b03c46688fde0a340957b8efd7a4d90592ac25b0cd497de2c8ee77259f1162d1beade6e7b37e932d31b5daec323a96215e392c4f5c535a29db36f - languageName: node - linkType: hard - "execa@npm:7.2.0": version: 7.2.0 resolution: "execa@npm:7.2.0" @@ -10106,15 +10525,6 @@ __metadata: languageName: node linkType: hard -"express-rate-limit@npm:^7.5.0": - version: 7.5.0 - resolution: "express-rate-limit@npm:7.5.0" - peerDependencies: - express: ^4.11 || 5 || ^5.0.0-beta.1 - checksum: 2807341039c111eed292e28768aff3c69515cb96ff15799976a44ead776c41931d6947fe3da3cea021fa0490700b1ab468b4832bbed7d231bed63c195d22b959 - languageName: node - linkType: hard - "express@npm:^4.17.3": version: 4.18.1 resolution: "express@npm:4.18.1" @@ -10154,41 +10564,6 @@ __metadata: languageName: node linkType: hard -"express@npm:^5.0.1": - version: 5.1.0 - resolution: "express@npm:5.1.0" - dependencies: - accepts: ^2.0.0 - body-parser: ^2.2.0 - content-disposition: ^1.0.0 - content-type: ^1.0.5 - cookie: ^0.7.1 - cookie-signature: ^1.2.1 - debug: ^4.4.0 - encodeurl: ^2.0.0 - escape-html: ^1.0.3 - etag: ^1.8.1 - finalhandler: ^2.1.0 - fresh: ^2.0.0 - http-errors: ^2.0.0 - merge-descriptors: ^2.0.0 - mime-types: ^3.0.0 - on-finished: ^2.4.1 - once: ^1.4.0 - parseurl: ^1.3.3 - proxy-addr: ^2.0.7 - qs: ^6.14.0 - range-parser: ^1.2.1 - router: ^2.2.0 - send: ^1.1.0 - serve-static: ^2.2.0 - statuses: ^2.0.1 - type-is: ^2.0.1 - vary: ^1.1.2 - checksum: 06e6141780c6c4780111f971ce062c83d4cf4862c40b43caf1d95afcbb58d7422c560503b8c9d04c7271511525d09cbdbe940bcaad63970fd4c1b9f6fd713bdb - languageName: node - linkType: hard - "extend-shallow@npm:^2.0.1": version: 2.0.1 resolution: "extend-shallow@npm:2.0.1" @@ -10219,7 +10594,7 @@ __metadata: languageName: node linkType: hard -"fast-glob@npm:^3.2.11, fast-glob@npm:^3.2.9, fast-glob@npm:^3.3.2, fast-glob@npm:^3.3.3": +"fast-glob@npm:^3.2.11, fast-glob@npm:^3.2.2, fast-glob@npm:^3.2.9, fast-glob@npm:^3.3.2, fast-glob@npm:^3.3.3": version: 3.3.3 resolution: "fast-glob@npm:3.3.3" dependencies: @@ -10280,15 +10655,24 @@ __metadata: languageName: node linkType: hard -"fdir@npm:^6.4.4": - version: 6.4.4 - resolution: "fdir@npm:6.4.4" +"fd-package-json@npm:^2.0.0": + version: 2.0.0 + resolution: "fd-package-json@npm:2.0.0" + dependencies: + walk-up-path: ^4.0.0 + checksum: e595a1a23f8e208815cdcf26c92218240da00acce80468324408dc4a5cb6c26b6efb5076f0458a02f044562a1e60253731187a627d5416b4961468ddfc0ae426 + languageName: node + linkType: hard + +"fdir@npm:^6.4.4, fdir@npm:^6.5.0": + version: 6.5.0 + resolution: "fdir@npm:6.5.0" peerDependencies: picomatch: ^3 || ^4 peerDependenciesMeta: picomatch: optional: true - checksum: 79043610236579ffbd0647c508b43bd030a2d034a17c43cf96813a00e8e92e51acdb115c6ddecef3b5812cc2692b976155b4f6413e51e3761f1e772fa019a321 + checksum: bd537daa9d3cd53887eed35efa0eab2dbb1ca408790e10e024120e7a36c6e9ae2b33710cb8381e35def01bc9c1d7eaba746f886338413e68ff6ebaee07b9a6e8 languageName: node linkType: hard @@ -10310,12 +10694,12 @@ __metadata: languageName: node linkType: hard -"file-entry-cache@npm:^10.0.8": - version: 10.0.8 - resolution: "file-entry-cache@npm:10.0.8" +"file-entry-cache@npm:^10.1.4": + version: 10.1.4 + resolution: "file-entry-cache@npm:10.1.4" dependencies: - flat-cache: ^6.1.8 - checksum: 832e9394c05b1484a38431a1061cbda6bef7597a0b3d9ddefd7ae9aa5f935cdb720e98066bd7e29cf2395b88d4ff42ce24860e808b74fb3a87dab07b8b98f04a + flat-cache: ^6.1.13 + checksum: b0fbc1522c62d060a0e17604074f32b68bc964d4dc1a40e1f75d5c731d0e104ffbb39bf61c37a836e0ce1cabb92c121f03ae2da0ee29a3885546937e1962b862 languageName: node linkType: hard @@ -10328,15 +10712,6 @@ __metadata: languageName: node linkType: hard -"file-entry-cache@npm:^9.1.0": - version: 9.1.0 - resolution: "file-entry-cache@npm:9.1.0" - dependencies: - flat-cache: ^5.0.0 - checksum: 9f2345505677fa83767c55aa3667c52b62c409bd6f2b5408999d635f1d8cc6ecab868f0a5fdfb2fadf64a0d2e92374c02ddd0c9eaea9651cfbcead56fd640099 - languageName: node - linkType: hard - "file-loader@npm:^6.2.0": version: 6.2.0 resolution: "file-loader@npm:6.2.0" @@ -10389,20 +10764,6 @@ __metadata: languageName: node linkType: hard -"finalhandler@npm:^2.1.0": - version: 2.1.0 - resolution: "finalhandler@npm:2.1.0" - dependencies: - debug: ^4.4.0 - encodeurl: ^2.0.0 - escape-html: ^1.0.3 - on-finished: ^2.4.1 - parseurl: ^1.3.3 - statuses: ^2.0.1 - checksum: 27ca9cc83b1384ba37959eb95bc7e62bc0bf4d6f6af63f6d38821cf7499b113e34b23f96a2a031616817f73986f94deea67c2f558de9daf406790c181a2501df - languageName: node - linkType: hard - "find-cache-dir@npm:^4.0.0": version: 4.0.0 resolution: "find-cache-dir@npm:4.0.0" @@ -10459,24 +10820,14 @@ __metadata: languageName: node linkType: hard -"flat-cache@npm:^5.0.0": - version: 5.0.0 - resolution: "flat-cache@npm:5.0.0" - dependencies: - flatted: ^3.3.1 - keyv: ^4.5.4 - checksum: a7d03de79b603f5621009f75d84d2c5cd8fb762911df93c0ed16cd1cd4f7b8d2357d4aaed8806b5943ce71ebcd4fc4998faf061f33879c56c5294b3f5c3698ef - languageName: node - linkType: hard - -"flat-cache@npm:^6.1.8": - version: 6.1.8 - resolution: "flat-cache@npm:6.1.8" +"flat-cache@npm:^6.1.13": + version: 6.1.13 + resolution: "flat-cache@npm:6.1.13" dependencies: - cacheable: ^1.8.9 + cacheable: ^1.10.4 flatted: ^3.3.3 - hookified: ^1.8.1 - checksum: 7c26d536f21249e487eed8f21829b13eb114d4e07de239ce7300c995c80c3e704f78e4a63d7e75a63c28dc47b02c05e670c3fc745bbfd2b238d4aea0e4e4b3d2 + hookified: ^1.11.0 + checksum: 9a2b402a1e0a0802b5fdb94f4a3d4f2755bdeb2a81927be5fefd93fd7317b0e73b11812239bcc82d29ea36e54b376a5d4a6312edd97e515c45eb5f1d2a2f6659 languageName: node linkType: hard @@ -10489,7 +10840,7 @@ __metadata: languageName: node linkType: hard -"flatted@npm:^3.2.9, flatted@npm:^3.3.1, flatted@npm:^3.3.3": +"flatted@npm:^3.2.9, flatted@npm:^3.3.3": version: 3.3.3 resolution: "flatted@npm:3.3.3" checksum: 8c96c02fbeadcf4e8ffd0fa24983241e27698b0781295622591fc13585e2f226609d95e422bcf2ef044146ffacb6b68b1f20871454eddf75ab3caa6ee5f4a1fe @@ -10506,22 +10857,22 @@ __metadata: languageName: node linkType: hard -"for-each@npm:^0.3.3": - version: 0.3.3 - resolution: "for-each@npm:0.3.3" +"for-each@npm:^0.3.3, for-each@npm:^0.3.5": + version: 0.3.5 + resolution: "for-each@npm:0.3.5" dependencies: - is-callable: ^1.1.3 - checksum: 6c48ff2bc63362319c65e2edca4a8e1e3483a2fabc72fbe7feaf8c73db94fc7861bd53bc02c8a66a0c1dd709da6b04eec42e0abdd6b40ce47305ae92a25e5d28 + is-callable: ^1.2.7 + checksum: 3c986d7e11f4381237cc98baa0a2f87eabe74719eee65ed7bed275163082b940ede19268c61d04c6260e0215983b12f8d885e3c8f9aa8c2113bf07c37051745c languageName: node linkType: hard -"foreground-child@npm:^3.1.0": - version: 3.1.1 - resolution: "foreground-child@npm:3.1.1" +"foreground-child@npm:^3.1.0, foreground-child@npm:^3.3.1": + version: 3.3.1 + resolution: "foreground-child@npm:3.3.1" dependencies: - cross-spawn: ^7.0.0 + cross-spawn: ^7.0.6 signal-exit: ^4.0.1 - checksum: 139d270bc82dc9e6f8bc045fe2aae4001dc2472157044fdfad376d0a3457f77857fa883c1c8b21b491c6caade9a926a4bed3d3d2e8d3c9202b151a4cbbd0bcd5 + checksum: b2c1a6fc0bf0233d645d9fefdfa999abf37db1b33e5dab172b3cbfb0662b88bfbd2c9e7ab853533d199050ec6b65c03fcf078fc212d26e4990220e98c6930eef languageName: node linkType: hard @@ -10581,6 +10932,17 @@ __metadata: languageName: node linkType: hard +"formatly@npm:^0.3.0": + version: 0.3.0 + resolution: "formatly@npm:0.3.0" + dependencies: + fd-package-json: ^2.0.0 + bin: + formatly: bin/index.mjs + checksum: ef2bf133c048195fc30ced2a20e9acb5251a2a7cf7c2bf67afc71f6bbad78a3f8816b814ee22ec6db1bca7b339fb0d1eddbf168c7d36cc53459c664ff73e8d0d + languageName: node + linkType: hard + "forwarded@npm:0.2.0": version: 0.2.0 resolution: "forwarded@npm:0.2.0" @@ -10602,13 +10964,6 @@ __metadata: languageName: node linkType: hard -"fresh@npm:^2.0.0": - version: 2.0.0 - resolution: "fresh@npm:2.0.0" - checksum: 38b9828352c6271e2a0dd8bdd985d0100dbbc4eb8b6a03286071dd6f7d96cfaacd06d7735701ad9a95870eb3f4555e67c08db1dcfe24c2e7bb87383c72fae1d2 - languageName: node - linkType: hard - "front-matter@npm:^4.0.2": version: 4.0.2 resolution: "front-matter@npm:4.0.2" @@ -10771,21 +11126,21 @@ __metadata: languageName: node linkType: hard -"get-intrinsic@npm:^1.2.4, get-intrinsic@npm:^1.2.5, get-intrinsic@npm:^1.2.6": - version: 1.2.6 - resolution: "get-intrinsic@npm:1.2.6" +"get-intrinsic@npm:^1.2.4, get-intrinsic@npm:^1.2.5, get-intrinsic@npm:^1.2.6, get-intrinsic@npm:^1.3.0": + version: 1.3.0 + resolution: "get-intrinsic@npm:1.3.0" dependencies: - call-bind-apply-helpers: ^1.0.1 - dunder-proto: ^1.0.0 + call-bind-apply-helpers: ^1.0.2 es-define-property: ^1.0.1 es-errors: ^1.3.0 - es-object-atoms: ^1.0.0 + es-object-atoms: ^1.1.1 function-bind: ^1.1.2 + get-proto: ^1.0.1 gopd: ^1.2.0 has-symbols: ^1.1.0 hasown: ^2.0.2 - math-intrinsics: ^1.0.0 - checksum: a7592a0b7f023a2e83c0121fa9449ca83780e370a5feeebe8452119474d148016e43b455049134ae7a683b9b11b93d3f65eac199a0ad452ab740d5f0c299de47 + math-intrinsics: ^1.1.0 + checksum: 301008e4482bb9a9cb49e132b88fee093bff373b4e6def8ba219b1e96b60158a6084f273ef5cafe832e42cd93462f4accb46a618d35fe59a2b507f2388c5b79d languageName: node linkType: hard @@ -10796,6 +11151,25 @@ __metadata: languageName: node linkType: hard +"get-proto@npm:^1.0.1": + version: 1.0.1 + resolution: "get-proto@npm:1.0.1" + dependencies: + dunder-proto: ^1.0.1 + es-object-atoms: ^1.0.0 + checksum: 4fc96afdb58ced9a67558698b91433e6b037aaa6f1493af77498d7c85b141382cf223c0e5946f334fb328ee85dfe6edd06d218eaf09556f4bc4ec6005d7f5f7b + languageName: node + linkType: hard + +"get-stream@npm:^5.1.0": + version: 5.2.0 + resolution: "get-stream@npm:5.2.0" + dependencies: + pump: ^3.0.0 + checksum: 8bc1a23174a06b2b4ce600df38d6c98d2ef6d84e020c1ddad632ad75bac4e092eeb40e4c09e0761c35fc2dbc5e7fff5dab5e763a383582c4a167dd69a905bd12 + languageName: node + linkType: hard + "get-stream@npm:^6.0.0, get-stream@npm:^6.0.1": version: 6.0.1 resolution: "get-stream@npm:6.0.1" @@ -10862,23 +11236,23 @@ __metadata: languageName: node linkType: hard -"glob@npm:*, glob@npm:^11.0.0": - version: 11.0.2 - resolution: "glob@npm:11.0.2" +"glob@npm:*, glob@npm:~11.0.2": + version: 11.0.3 + resolution: "glob@npm:11.0.3" dependencies: - foreground-child: ^3.1.0 - jackspeak: ^4.0.1 - minimatch: ^10.0.0 + foreground-child: ^3.3.1 + jackspeak: ^4.1.1 + minimatch: ^10.0.3 minipass: ^7.1.2 package-json-from-dist: ^1.0.0 path-scurry: ^2.0.0 bin: glob: dist/esm/bin.mjs - checksum: e936aa9b26d5c9687ec1cad53ead521122a7297528856f0c909bfff5a5af16be791d7da8289ab0cfe583470328287adff8f455c1fbf4fa2d8a040a55f9c8c50a + checksum: 65ddc1e3c969e87999880580048763cc8b5bdd375930dd43b8100a5ba481d2e2563e4553de42875790800c602522a98aa8d3ed1c5bd4d27621609e6471eb371d languageName: node linkType: hard -"glob@npm:^10.3.7, glob@npm:^10.4.1, glob@npm:^10.4.5, glob@npm:~10.4.5": +"glob@npm:^10.3.7, glob@npm:^10.4.1": version: 10.4.5 resolution: "glob@npm:10.4.5" dependencies: @@ -10973,9 +11347,9 @@ __metadata: linkType: hard "globals@npm:^16.0.0": - version: 16.0.0 - resolution: "globals@npm:16.0.0" - checksum: 41df1cb6f86c36dfdf8fb6c270247105c85cc3aec8d8238c5e691b0d2aad9eed8ff390d1035f4b5a27ee24bf75b095c7b84717e9d2050d2122e61f37d9c6131a + version: 16.5.0 + resolution: "globals@npm:16.5.0" + checksum: e0363245cfc6e36ac6bf940415160a05d66e7985fa3856d5383ad49292b6d249d80fd03759e09d6491109648a121849b23b77c7391a11862923e6995268a7cd6 languageName: node linkType: hard @@ -11030,6 +11404,25 @@ __metadata: languageName: node linkType: hard +"got@npm:^11.7.0": + version: 11.8.6 + resolution: "got@npm:11.8.6" + dependencies: + "@sindresorhus/is": ^4.0.0 + "@szmarczak/http-timer": ^4.0.5 + "@types/cacheable-request": ^6.0.1 + "@types/responselike": ^1.0.0 + cacheable-lookup: ^5.0.3 + cacheable-request: ^7.0.2 + decompress-response: ^6.0.0 + http2-wrapper: ^1.0.0-beta.5.2 + lowercase-keys: ^2.0.0 + p-cancelable: ^2.0.0 + responselike: ^2.0.0 + checksum: bbc783578a8d5030c8164ef7f57ce41b5ad7db2ed13371e1944bef157eeca5a7475530e07c0aaa71610d7085474d0d96222c9f4268d41db333a17e39b463f45d + languageName: node + linkType: hard + "got@npm:^12.1.0": version: 12.6.1 resolution: "got@npm:12.6.1" @@ -11063,6 +11456,13 @@ __metadata: languageName: node linkType: hard +"grapheme-splitter@npm:^1.0.4": + version: 1.0.4 + resolution: "grapheme-splitter@npm:1.0.4" + checksum: 0c22ec54dee1b05cd480f78cf14f732cb5b108edc073572c4ec205df4cd63f30f8db8025afc5debc8835a8ddeacf648a1c7992fe3dcd6ad38f9a476d84906620 + languageName: node + linkType: hard + "graphemer@npm:^1.4.0": version: 1.4.0 resolution: "graphemer@npm:1.4.0" @@ -11167,7 +11567,7 @@ __metadata: languageName: node linkType: hard -"hasown@npm:^2.0.0, hasown@npm:^2.0.1, hasown@npm:^2.0.2": +"hasown@npm:^2.0.2": version: 2.0.2 resolution: "hasown@npm:2.0.2" dependencies: @@ -11338,10 +11738,10 @@ __metadata: languageName: node linkType: hard -"hookified@npm:^1.7.1, hookified@npm:^1.8.1": - version: 1.8.2 - resolution: "hookified@npm:1.8.2" - checksum: b7415e94f742e7bd0da5f3653a0f10f2021e1b39f92f20a03f27027ca308f6bf84a958b296abd1e15ee9e0d589d887687ec16745b7a0cdb488ba5f38e3ff524d +"hookified@npm:^1.11.0": + version: 1.11.0 + resolution: "hookified@npm:1.11.0" + checksum: 237189d87d3ebafacdb3b27ecdbb7060d359a16ccf6d27896920e6f8b53890c831ff5bafc2224bfcd6562a1effdca28a3edf819af46cf30cc58c142f1ce9b67d languageName: node linkType: hard @@ -11366,6 +11766,13 @@ __metadata: languageName: node linkType: hard +"hpagent@npm:^1.2.0": + version: 1.2.0 + resolution: "hpagent@npm:1.2.0" + checksum: b029da695edae438cee4da2a437386f9db4ac27b3ceb7306d02e1b586c9c194741ed2e943c8a222e0cfefaf27ee3f863aca7ba1721b0950a2a19bf25bc0d85e2 + languageName: node + linkType: hard + "html-entities@npm:^2.3.2": version: 2.3.2 resolution: "html-entities@npm:2.3.2" @@ -11480,10 +11887,10 @@ __metadata: languageName: node linkType: hard -"http-cache-semantics@npm:^4.1.1": - version: 4.1.1 - resolution: "http-cache-semantics@npm:4.1.1" - checksum: 83ac0bc60b17a3a36f9953e7be55e5c8f41acc61b22583060e8dedc9dd5e3607c823a88d0926f9150e571f90946835c7fe150732801010845c72cd8bbff1a236 +"http-cache-semantics@npm:^4.0.0, http-cache-semantics@npm:^4.1.1": + version: 4.2.0 + resolution: "http-cache-semantics@npm:4.2.0" + checksum: 7a7246ddfce629f96832791176fd643589d954e6f3b49548dadb4290451961237fab8fcea41cd2008fe819d95b41c1e8b97f47d088afc0a1c81705287b4ddbcc languageName: node linkType: hard @@ -11494,7 +11901,7 @@ __metadata: languageName: node linkType: hard -"http-errors@npm:2.0.0, http-errors@npm:^2.0.0": +"http-errors@npm:2.0.0": version: 2.0.0 resolution: "http-errors@npm:2.0.0" dependencies: @@ -11566,6 +11973,16 @@ __metadata: languageName: node linkType: hard +"http2-wrapper@npm:^1.0.0-beta.5.2": + version: 1.0.3 + resolution: "http2-wrapper@npm:1.0.3" + dependencies: + quick-lru: ^5.1.1 + resolve-alpn: ^1.0.0 + checksum: 74160b862ec699e3f859739101ff592d52ce1cb207b7950295bf7962e4aa1597ef709b4292c673bece9c9b300efad0559fc86c71b1409c7a1e02b7229456003e + languageName: node + linkType: hard + "http2-wrapper@npm:^2.1.10": version: 2.2.1 resolution: "http2-wrapper@npm:2.2.1" @@ -11634,7 +12051,7 @@ __metadata: languageName: node linkType: hard -"iconv-lite@npm:0.6.3, iconv-lite@npm:^0.6.2, iconv-lite@npm:^0.6.3": +"iconv-lite@npm:^0.6.2": version: 0.6.3 resolution: "iconv-lite@npm:0.6.3" dependencies: @@ -11659,7 +12076,7 @@ __metadata: languageName: node linkType: hard -"ieee754@npm:^1.1.13, ieee754@npm:^1.2.1": +"ieee754@npm:^1.1.13": version: 1.2.1 resolution: "ieee754@npm:1.2.1" checksum: 5144c0c9815e54ada181d80a0b810221a253562422e7c6c3a60b1901154184f49326ec239d618c416c1c5945a2e197107aee8d986a3dd836b53dffefd99b5e7e @@ -11673,10 +12090,10 @@ __metadata: languageName: node linkType: hard -"ignore@npm:^7.0.0, ignore@npm:^7.0.3, ignore@npm:~7.0.3": - version: 7.0.4 - resolution: "ignore@npm:7.0.4" - checksum: 09b4d69192355ac066f7d99c0fdb26f52035d2eaae423bfb5f7389091d75a93bf9c105e1fbf51f557098f6d446726f29a63cef3a7d26722dc696dd345224719b +"ignore@npm:^7.0.0, ignore@npm:^7.0.5, ignore@npm:~7.0.4": + version: 7.0.5 + resolution: "ignore@npm:7.0.5" + checksum: d0862bf64d3d58bf34d5fb0a9f725bec9ca5ce8cd1aecc8f28034269e8f69b8009ffd79ca3eda96962a6a444687781cd5efdb8c7c8ddc0a6996e36d31c217f14 languageName: node linkType: hard @@ -11938,7 +12355,7 @@ __metadata: languageName: node linkType: hard -"is-callable@npm:^1.1.3, is-callable@npm:^1.2.7": +"is-callable@npm:^1.2.7": version: 1.2.7 resolution: "is-callable@npm:1.2.7" checksum: 61fd57d03b0d984e2ed3720fb1c7a897827ea174bd44402878e059542ea8c4aeedee0ea0985998aa5cc2736b2fa6e271c08587addb5b3959ac52cf665173d1ac @@ -11956,12 +12373,12 @@ __metadata: languageName: node linkType: hard -"is-core-module@npm:^2.13.0, is-core-module@npm:^2.15.1": - version: 2.15.1 - resolution: "is-core-module@npm:2.15.1" +"is-core-module@npm:^2.13.0, is-core-module@npm:^2.16.1": + version: 2.16.1 + resolution: "is-core-module@npm:2.16.1" dependencies: hasown: ^2.0.2 - checksum: df134c168115690724b62018c37b2f5bba0d5745fa16960b329c5a00883a8bea6a5632fdb1e3efcce237c201826ba09f93197b7cd95577ea56b0df335be23633 + checksum: 6ec5b3c42d9cbf1ac23f164b16b8a140c3cec338bf8f884c076ca89950c7cc04c33e78f02b8cae7ff4751f3247e3174b2330f1fe4de194c7210deb8b1ea316a7 languageName: node linkType: hard @@ -12111,6 +12528,13 @@ __metadata: languageName: node linkType: hard +"is-negative-zero@npm:^2.0.3": + version: 2.0.3 + resolution: "is-negative-zero@npm:2.0.3" + checksum: c1e6b23d2070c0539d7b36022d5a94407132411d01aba39ec549af824231f3804b1aea90b5e4e58e807a65d23ceb538ed6e355ce76b267bdd86edb757ffcbdcd + languageName: node + linkType: hard + "is-npm@npm:^6.0.0": version: 6.0.0 resolution: "is-npm@npm:6.0.0" @@ -12163,13 +12587,6 @@ __metadata: languageName: node linkType: hard -"is-plain-obj@npm:^2.1.0": - version: 2.1.0 - resolution: "is-plain-obj@npm:2.1.0" - checksum: cec9100678b0a9fe0248a81743041ed990c2d4c99f893d935545cfbc42876cbe86d207f3b895700c690ad2fa520e568c44afc1605044b535a7820c1d40e38daa - languageName: node - linkType: hard - "is-plain-obj@npm:^3.0.0": version: 3.0.0 resolution: "is-plain-obj@npm:3.0.0" @@ -12200,13 +12617,6 @@ __metadata: languageName: node linkType: hard -"is-promise@npm:^4.0.0": - version: 4.0.0 - resolution: "is-promise@npm:4.0.0" - checksum: 0b46517ad47b00b6358fd6553c83ec1f6ba9acd7ffb3d30a0bf519c5c69e7147c132430452351b8a9fc198f8dd6c4f76f8e6f5a7f100f8c77d57d9e0f4261a8a - languageName: node - linkType: hard - "is-reference@npm:^3.0.0": version: 3.0.2 resolution: "is-reference@npm:3.0.2" @@ -12272,7 +12682,7 @@ __metadata: languageName: node linkType: hard -"is-string@npm:^1.0.7, is-string@npm:^1.1.1": +"is-string@npm:^1.1.1": version: 1.1.1 resolution: "is-string@npm:1.1.1" dependencies: @@ -12323,12 +12733,12 @@ __metadata: languageName: node linkType: hard -"is-weakref@npm:^1.0.2, is-weakref@npm:^1.1.0": - version: 1.1.0 - resolution: "is-weakref@npm:1.1.0" +"is-weakref@npm:^1.0.2, is-weakref@npm:^1.1.1": + version: 1.1.1 + resolution: "is-weakref@npm:1.1.1" dependencies: - call-bound: ^1.0.2 - checksum: 2a2f3a1746ee1baecf9ac6483d903cd3f8ef3cca88e2baa42f2e85ea064bd246d218eed5f6d479fc1c76dae2231e71133b6b86160e821d176932be9fae3da4da + call-bound: ^1.0.3 + checksum: 1769b9aed5d435a3a989ffc18fc4ad1947d2acdaf530eb2bd6af844861b545047ea51102f75901f89043bed0267ed61d914ee21e6e8b9aa734ec201cdfc0726f languageName: node linkType: hard @@ -12459,12 +12869,12 @@ __metadata: languageName: node linkType: hard -"jackspeak@npm:^4.0.1": - version: 4.0.2 - resolution: "jackspeak@npm:4.0.2" +"jackspeak@npm:^4.1.1": + version: 4.1.1 + resolution: "jackspeak@npm:4.1.1" dependencies: "@isaacs/cliui": ^8.0.2 - checksum: 210030029edfa1658328799ad88c3d0fc057c4cb8a069fc4137cc8d2cc4b65c9721c6e749e890f9ca77a954bb54f200f715b8896e50d330e5f3e902e72b40974 + checksum: daca714c5adebfb80932c0b0334025307b68602765098d73d52ec546bc4defdb083292893384261c052742255d0a77d8fcf96f4c669bcb4a99b498b94a74955e languageName: node linkType: hard @@ -12482,22 +12892,15 @@ __metadata: languageName: node linkType: hard -"jest-diff@npm:^29.4.1": - version: 29.7.0 - resolution: "jest-diff@npm:29.7.0" +"jest-diff@npm:^30.0.2": + version: 30.1.2 + resolution: "jest-diff@npm:30.1.2" dependencies: - chalk: ^4.0.0 - diff-sequences: ^29.6.3 - jest-get-type: ^29.6.3 - pretty-format: ^29.7.0 - checksum: 08e24a9dd43bfba1ef07a6374e5af138f53137b79ec3d5cc71a2303515335898888fa5409959172e1e05de966c9e714368d15e8994b0af7441f0721ee8e1bb77 - languageName: node - linkType: hard - -"jest-get-type@npm:^29.6.3": - version: 29.6.3 - resolution: "jest-get-type@npm:29.6.3" - checksum: 88ac9102d4679d768accae29f1e75f592b760b44277df288ad76ce5bf038c3f5ce3719dea8aa0f035dac30e9eb034b848ce716b9183ad7cc222d029f03e92205 + "@jest/diff-sequences": 30.0.1 + "@jest/get-type": 30.1.0 + chalk: ^4.1.2 + pretty-format: 30.0.5 + checksum: 15f350b664f5fe00190cbd36dbe2fd477010bf471b9fb3b2b0b1a40ce4241b10595a05203fcb86aea7720d2be225419efc3d1afa921966b0371d33120c563eec languageName: node linkType: hard @@ -12549,15 +12952,6 @@ __metadata: languageName: node linkType: hard -"jiti@npm:2.4.2, jiti@npm:^2.4.2": - version: 2.4.2 - resolution: "jiti@npm:2.4.2" - bin: - jiti: lib/jiti-cli.mjs - checksum: c6c30c7b6b293e9f26addfb332b63d964a9f143cdd2cf5e946dbe5143db89f7c1b50ad9223b77fb1f6ddb0b9c5ecef995fea024ecf7d2861d285d779cde66e1e - languageName: node - linkType: hard - "jiti@npm:^1.20.0": version: 1.21.6 resolution: "jiti@npm:1.21.6" @@ -12567,6 +12961,15 @@ __metadata: languageName: node linkType: hard +"jiti@npm:^2.6.0": + version: 2.6.0 + resolution: "jiti@npm:2.6.0" + bin: + jiti: lib/jiti-cli.mjs + checksum: 2bd869527bfbb23b5210344881b4f2f5fd86b7c9c703001036544762411af73fe0f95097ba025a738874085143939664173360aafea7d7cbc4ca3bbc325774a9 + languageName: node + linkType: hard + "jju@npm:~1.4.0": version: 1.4.0 resolution: "jju@npm:1.4.0" @@ -12594,6 +12997,13 @@ __metadata: languageName: node linkType: hard +"js-tokens@npm:^9.0.1": + version: 9.0.1 + resolution: "js-tokens@npm:9.0.1" + checksum: 8b604020b1a550e575404bfdde4d12c11a7991ffe0c58a2cf3515b9a512992dc7010af788f0d8b7485e403d462d9e3d3b96c4ff03201550fdbb09e17c811e054 + languageName: node + linkType: hard + "js-yaml@npm:^3.10.0, js-yaml@npm:^3.13.1": version: 3.14.1 resolution: "js-yaml@npm:3.14.1" @@ -12761,7 +13171,7 @@ __metadata: languageName: node linkType: hard -"keyv@npm:^4.5.3, keyv@npm:^4.5.4": +"keyv@npm:^4.0.0, keyv@npm:^4.5.3, keyv@npm:^4.5.4": version: 4.5.4 resolution: "keyv@npm:4.5.4" dependencies: @@ -12770,12 +13180,12 @@ __metadata: languageName: node linkType: hard -"keyv@npm:^5.3.1": - version: 5.3.1 - resolution: "keyv@npm:5.3.1" +"keyv@npm:^5.5.0": + version: 5.5.0 + resolution: "keyv@npm:5.5.0" dependencies: - "@keyv/serialize": ^1.0.3 - checksum: 493c0e3965a3354ba6f719c7a70ed07adf7c0a299bfd9712126c547148067b7621bc008ba51abcac5fe0b7462f3e7cdaa58fb422db9022a3d34a20d30f03a0cb + "@keyv/serialize": ^1.1.0 + checksum: 7ab64dbcd6f14995f93baf33a82ca1b35c7c7b810f5c59239772904637546eb7ed9695e535420b50bcd5d2ff365cf7ba3a4f1613920249572c5a2a07e1053820 languageName: node linkType: hard @@ -12794,35 +13204,35 @@ __metadata: linkType: hard "knip@npm:^5.41.1": - version: 5.53.0 - resolution: "knip@npm:5.53.0" + version: 5.68.0 + resolution: "knip@npm:5.68.0" dependencies: "@nodelib/fs.walk": ^1.2.3 - enhanced-resolve: ^5.18.1 fast-glob: ^3.3.3 - jiti: ^2.4.2 + formatly: ^0.3.0 + jiti: ^2.6.0 js-yaml: ^4.1.0 minimist: ^1.2.8 - picocolors: ^1.1.0 + oxc-resolver: ^11.12.0 + picocolors: ^1.1.1 picomatch: ^4.0.1 - smol-toml: ^1.3.1 - strip-json-comments: 5.0.1 - zod: ^3.22.4 - zod-validation-error: ^3.0.3 + smol-toml: ^1.4.1 + strip-json-comments: 5.0.2 + zod: ^4.1.11 peerDependencies: "@types/node": ">=18" - typescript: ">=5.0.4" + typescript: ">=5.0.4 <7" bin: knip: bin/knip.js knip-bun: bin/knip-bun.js - checksum: f963a3c72f96dfb01e1913f089af48ce97ec0c5d7900508d0e60f9a9733fdc227aab7264483c3168e022bac9ff1ed4426dbcc2090bfe16c784c822dedb75d56f + checksum: a5ab5ae05c0f72f6dc5992908f252fa60cf7ba53aaa45af970f7882175de20ae98cec8f1813543a63cc0bd5353a701c37b20d47d80da62c3edb77a12234168ef languageName: node linkType: hard -"known-css-properties@npm:^0.36.0": - version: 0.36.0 - resolution: "known-css-properties@npm:0.36.0" - checksum: 2b231ae0ef90a9825f3798a585077c6948c119e091df8900ae07f52e5928122835ac1ad0b50629fe1e2357a608b17428181d5c63d02a623ffe84de5204f5f4fa +"known-css-properties@npm:^0.37.0": + version: 0.37.0 + resolution: "known-css-properties@npm:0.37.0" + checksum: 8a0f8a85abd45b22c048b64b9e841dd395367715ecd9b04d8b882e147b150f2f58b09364bc24bf516a6d713871edb02d7a01db046c0c616eecc73007d2abc7ec languageName: node linkType: hard @@ -13019,13 +13429,6 @@ __metadata: languageName: node linkType: hard -"lodash.get@npm:^4.4.2": - version: 4.4.2 - resolution: "lodash.get@npm:4.4.2" - checksum: e403047ddb03181c9d0e92df9556570e2b67e0f0a930fcbbbd779370972368f5568e914f913e93f3b08f6d492abc71e14d4e9b7a18916c31fa04bd2306efe545 - languageName: node - linkType: hard - "lodash.memoize@npm:^4.1.2": version: 4.1.2 resolution: "lodash.memoize@npm:4.1.2" @@ -13068,7 +13471,7 @@ __metadata: languageName: node linkType: hard -"log-symbols@npm:^4.0.0, log-symbols@npm:^4.1.0": +"log-symbols@npm:^4.0.0": version: 4.1.0 resolution: "log-symbols@npm:4.1.0" dependencies: @@ -13109,10 +13512,10 @@ __metadata: languageName: node linkType: hard -"loupe@npm:^3.1.0, loupe@npm:^3.1.3": - version: 3.1.3 - resolution: "loupe@npm:3.1.3" - checksum: 9b2530b1d5a44d2c9fc5241f97ea00296dca257173c535b4832bc31f9516e10387991feb5b3fff23df116c8fcf907ce3980f82b215dcc5d19cde17ce9b9ec3e1 +"loupe@npm:^3.1.0, loupe@npm:^3.1.4": + version: 3.2.0 + resolution: "loupe@npm:3.2.0" + checksum: 4bfb4d9cf9e482b7f8c2f1d245cf0a14dd690b08d85356b0f0f6da94787c005ead7d2e4812a77ccddae42b86212b168beb1f65da711dc1709e9bf972beb51213 languageName: node linkType: hard @@ -13125,6 +13528,13 @@ __metadata: languageName: node linkType: hard +"lowercase-keys@npm:^2.0.0": + version: 2.0.0 + resolution: "lowercase-keys@npm:2.0.0" + checksum: 24d7ebd56ccdf15ff529ca9e08863f3c54b0b9d1edb97a3ae1af34940ae666c01a1e6d200707bce730a8ef76cb57cc10e65f245ecaaf7e6bc8639f2fb460ac23 + languageName: node + linkType: hard + "lowercase-keys@npm:^3.0.0": version: 3.0.0 resolution: "lowercase-keys@npm:3.0.0" @@ -13216,14 +13626,7 @@ __metadata: languageName: node linkType: hard -"make-dir@npm:*": - version: 5.0.0 - resolution: "make-dir@npm:5.0.0" - checksum: 9f40f4756af5138ca3b138f9e8af144b0420516e96b0e079d816a173d2f69b2ef3425abf20e25764d222c0939a9fd2bce91dd26c22002a559cd6beaea5c994d2 - languageName: node - linkType: hard - -"make-dir@npm:^4.0.0": +"make-dir@npm:*, make-dir@npm:^4.0.0": version: 4.0.0 resolution: "make-dir@npm:4.0.0" dependencies: @@ -13255,10 +13658,10 @@ __metadata: languageName: node linkType: hard -"make-synchronized@npm:^0.2.8": - version: 0.2.8 - resolution: "make-synchronized@npm:0.2.8" - checksum: fa5e0a7dadbf03c9b0b00707acf6ef6379d5926c7ba2b2c8e9a60163bf4195e3acafbdabdc09e88a87fe1cb611927d9808c5a9b8a8c97a8973f74554b9434f1e +"make-synchronized@npm:^0.8.0": + version: 0.8.0 + resolution: "make-synchronized@npm:0.8.0" + checksum: 303cb607ec555e297763bda44893f6ceb1a23fc2776d5d5d838c7f51a3ad339b2b7d922a8c7d9e515c161acf18829a1d9d5792224e418ee11c8d1bafac21a4ca languageName: node linkType: hard @@ -13269,7 +13672,7 @@ __metadata: languageName: node linkType: hard -"markdown-it@npm:14.1.0, markdown-it@npm:^14.1.0": +"markdown-it@npm:^14.1.0, markdown-it@npm:~14.1.0": version: 14.1.0 resolution: "markdown-it@npm:14.1.0" dependencies: @@ -13301,40 +13704,49 @@ __metadata: languageName: node linkType: hard -"markdownlint-cli@npm:^0.44.0": - version: 0.44.0 - resolution: "markdownlint-cli@npm:0.44.0" +"markdownlint-cli@npm:^0.45.0": + version: 0.45.0 + resolution: "markdownlint-cli@npm:0.45.0" dependencies: commander: ~13.1.0 - glob: ~10.4.5 - ignore: ~7.0.3 + glob: ~11.0.2 + ignore: ~7.0.4 js-yaml: ~4.1.0 jsonc-parser: ~3.3.1 jsonpointer: ~5.0.1 - markdownlint: ~0.37.4 - minimatch: ~9.0.5 + markdown-it: ~14.1.0 + markdownlint: ~0.38.0 + minimatch: ~10.0.1 run-con: ~1.3.2 - smol-toml: ~1.3.1 + smol-toml: ~1.3.4 bin: markdownlint: markdownlint.js - checksum: bb50c28ab11b6677c75332cf18f8513545a30f1e58dd5b4be4351c0ad3566850286276efa938451e1fb64eb2d958b3a73dd119b915999512dbbdc0b61d676c5a + checksum: 41de5e3dd3129e1dd2d136e1a5ed1258c2d5456fb4592c085e76319f3792901e7b910e825e43440df09927769c9259f6f9e79cbaa1047d281b8526cb7b5ca819 languageName: node linkType: hard -"markdownlint@npm:~0.37.4": - version: 0.37.4 - resolution: "markdownlint@npm:0.37.4" +"markdownlint@npm:~0.38.0": + version: 0.38.0 + resolution: "markdownlint@npm:0.38.0" dependencies: - markdown-it: 14.1.0 - micromark: 4.0.1 - micromark-core-commonmark: 2.0.2 - micromark-extension-directive: 3.0.2 + micromark: 4.0.2 + micromark-core-commonmark: 2.0.3 + micromark-extension-directive: 4.0.0 micromark-extension-gfm-autolink-literal: 2.1.0 micromark-extension-gfm-footnote: 2.1.0 - micromark-extension-gfm-table: 2.1.0 + micromark-extension-gfm-table: 2.1.1 micromark-extension-math: 3.1.0 - micromark-util-types: 2.0.1 - checksum: 74ae9a0821c98d56177600a0735e8a332a3a6ac378516befbea63b06fbcd17e655508b1d20476da1916f3678ad77a81caa37facaee0ee3651e84fd01f01f1104 + micromark-util-types: 2.0.2 + checksum: ea684eb78cbc71ebb2d9f79f343e763c627935a1e4ad7524ff08c110b56e4f11ba9c5d7b469441dbb732028ddd7ff6dbe77b460f922506ea78fd8bb248e353d3 + languageName: node + linkType: hard + +"marked@npm:14.0.0": + version: 14.0.0 + resolution: "marked@npm:14.0.0" + bin: + marked: bin/marked.js + checksum: 965405cde11d180e5da78cf51074b1947f1e5483ed99691d3ec990a078aa6ca9113cf19bbd44da45473d0e7eec7298255e7d860a650dd5e7aed78ca5a8e0161b languageName: node linkType: hard @@ -13347,7 +13759,7 @@ __metadata: languageName: node linkType: hard -"math-intrinsics@npm:^1.0.0, math-intrinsics@npm:^1.1.0": +"math-intrinsics@npm:^1.1.0": version: 1.1.0 resolution: "math-intrinsics@npm:1.1.0" checksum: 0e513b29d120f478c85a70f49da0b8b19bc638975eca466f2eeae0071f3ad00454c621bf66e16dd435896c208e719fc91ad79bbfba4e400fe0b372e7c1c9c9a2 @@ -13649,13 +14061,6 @@ __metadata: languageName: node linkType: hard -"media-typer@npm:^1.1.0": - version: 1.1.0 - resolution: "media-typer@npm:1.1.0" - checksum: a58dd60804df73c672942a7253ccc06815612326dc1c0827984b1a21704466d7cde351394f47649e56cf7415e6ee2e26e000e81b51b3eebb5a93540e8bf93cbd - languageName: node - linkType: hard - "memfs@npm:^3.1.2, memfs@npm:^3.4.3": version: 3.5.3 resolution: "memfs@npm:3.5.3" @@ -13679,13 +14084,6 @@ __metadata: languageName: node linkType: hard -"merge-descriptors@npm:^2.0.0": - version: 2.0.0 - resolution: "merge-descriptors@npm:2.0.0" - checksum: e383332e700a94682d0125a36c8be761142a1320fc9feeb18e6e36647c9edf064271645f5669b2c21cf352116e561914fd8aa831b651f34db15ef4038c86696a - languageName: node - linkType: hard - "merge-stream@npm:^2.0.0": version: 2.0.0 resolution: "merge-stream@npm:2.0.0" @@ -13707,9 +14105,9 @@ __metadata: languageName: node linkType: hard -"micromark-core-commonmark@npm:2.0.2, micromark-core-commonmark@npm:^2.0.0": - version: 2.0.2 - resolution: "micromark-core-commonmark@npm:2.0.2" +"micromark-core-commonmark@npm:2.0.3, micromark-core-commonmark@npm:^2.0.0": + version: 2.0.3 + resolution: "micromark-core-commonmark@npm:2.0.3" dependencies: decode-named-character-reference: ^1.0.0 devlop: ^1.0.0 @@ -13727,11 +14125,26 @@ __metadata: micromark-util-subtokenize: ^2.0.0 micromark-util-symbol: ^2.0.0 micromark-util-types: ^2.0.0 - checksum: e49d78429baf72533a02d06ae83e5a24d4d547bc832173547ffbae93c0960a7dbf0d8896058301498fa4297f280070a5a66891e0e6160040d6c5ef9bc5d9cd51 + checksum: cfb0fd9c895f86a4e9344f7f0344fe6bd1018945798222835248146a42430b8c7bc0b2857af574cf4e1b4ce4e5c1a35a1479942421492e37baddde8de85814dc + languageName: node + linkType: hard + +"micromark-extension-directive@npm:4.0.0": + version: 4.0.0 + resolution: "micromark-extension-directive@npm:4.0.0" + dependencies: + devlop: ^1.0.0 + micromark-factory-space: ^2.0.0 + micromark-factory-whitespace: ^2.0.0 + micromark-util-character: ^2.0.0 + micromark-util-symbol: ^2.0.0 + micromark-util-types: ^2.0.0 + parse-entities: ^4.0.0 + checksum: c58ee727c4b87647508977e3af186e6efbdd8453ae0a72322779f8dea768ba7e4983804843ff66f81e32efd56a971f7256fb5bda4c401542145b4f0a1ad16396 languageName: node linkType: hard -"micromark-extension-directive@npm:3.0.2, micromark-extension-directive@npm:^3.0.0": +"micromark-extension-directive@npm:^3.0.0": version: 3.0.2 resolution: "micromark-extension-directive@npm:3.0.2" dependencies: @@ -13800,16 +14213,16 @@ __metadata: languageName: node linkType: hard -"micromark-extension-gfm-table@npm:2.1.0, micromark-extension-gfm-table@npm:^2.0.0": - version: 2.1.0 - resolution: "micromark-extension-gfm-table@npm:2.1.0" +"micromark-extension-gfm-table@npm:2.1.1, micromark-extension-gfm-table@npm:^2.0.0": + version: 2.1.1 + resolution: "micromark-extension-gfm-table@npm:2.1.1" dependencies: devlop: ^1.0.0 micromark-factory-space: ^2.0.0 micromark-util-character: ^2.0.0 micromark-util-symbol: ^2.0.0 micromark-util-types: ^2.0.0 - checksum: 249d695f5f8bd222a0d8a774ec78ea2a2d624cb50a4d008092a54aa87dad1f9d540e151d29696cf849eb1cee380113c4df722aebb3b425a214832a2de5dea1d7 + checksum: 16a59c8c2381c8418d9cf36c605abb0b66cfebaad07e09c4c9b113298d13e0c517b652885529fcb74d149afec3f6e8ab065fd27a900073d5ec0a1d8f0c51b593 languageName: node linkType: hard @@ -14181,10 +14594,10 @@ __metadata: languageName: node linkType: hard -"micromark-util-types@npm:2.0.1, micromark-util-types@npm:^2.0.0": - version: 2.0.1 - resolution: "micromark-util-types@npm:2.0.1" - checksum: 630aac466628a360962f478f69421599c53ff8b3080765201b7be3b3a4be7f4c5b73632b9a6dd426b9e06035353c18acccee637d6c43d9b0bf1c31111bbb88a7 +"micromark-util-types@npm:2.0.2, micromark-util-types@npm:^2.0.0": + version: 2.0.2 + resolution: "micromark-util-types@npm:2.0.2" + checksum: 884f7974839e4bc6d2bd662e57c973a9164fd5c0d8fe16cddf07472b86a7e6726747c00674952c0321d17685d700cd3295e9f58a842a53acdf6c6d55ab051aab languageName: node linkType: hard @@ -14195,9 +14608,9 @@ __metadata: languageName: node linkType: hard -"micromark@npm:4.0.1, micromark@npm:^4.0.0": - version: 4.0.1 - resolution: "micromark@npm:4.0.1" +"micromark@npm:4.0.2, micromark@npm:^4.0.0": + version: 4.0.2 + resolution: "micromark@npm:4.0.2" dependencies: "@types/debug": ^4.0.0 debug: ^4.0.0 @@ -14216,7 +14629,7 @@ __metadata: micromark-util-subtokenize: ^2.0.0 micromark-util-symbol: ^2.0.0 micromark-util-types: ^2.0.0 - checksum: 83ea084e8bf84442cc70c1207e916df11f0fde0ebd9daf978c895a1466c47a1dd4ed42b21b6e65bcc0d268fcbec24b4b1b28bc59c548940fe690929b8e0e7732 + checksum: 5306c15dd12f543755bc627fc361d4255dfc430e7af6069a07ac0eacc338fbd761fe8e93f02a8bfab6097bab12ee903192fe31389222459d5029242a5aaba3b8 languageName: node linkType: hard @@ -14230,20 +14643,13 @@ __metadata: languageName: node linkType: hard -"mime-db@npm:1.52.0": +"mime-db@npm:1.52.0, mime-db@npm:>= 1.43.0 < 2": version: 1.52.0 resolution: "mime-db@npm:1.52.0" checksum: 0d99a03585f8b39d68182803b12ac601d9c01abfa28ec56204fa330bc9f3d1c5e14beb049bafadb3dbdf646dfb94b87e24d4ec7b31b7279ef906a8ea9b6a513f languageName: node linkType: hard -"mime-db@npm:>= 1.43.0 < 2, mime-db@npm:^1.54.0": - version: 1.54.0 - resolution: "mime-db@npm:1.54.0" - checksum: e99aaf2f23f5bd607deb08c83faba5dd25cf2fec90a7cc5b92d8260867ee08dab65312e1a589e60093dc7796d41e5fae013268418482f1db4c7d52d0a0960ac9 - languageName: node - linkType: hard - "mime-db@npm:~1.33.0": version: 1.33.0 resolution: "mime-db@npm:1.33.0" @@ -14269,15 +14675,6 @@ __metadata: languageName: node linkType: hard -"mime-types@npm:^3.0.0, mime-types@npm:^3.0.1": - version: 3.0.1 - resolution: "mime-types@npm:3.0.1" - dependencies: - mime-db: ^1.54.0 - checksum: 8d497ad5cb2dd1210ac7d049b5de94af0b24b45a314961e145b44389344604d54752f03bc00bf880c0da60a214be6fb6d423d318104f02c28d95dd8ebeea4fb4 - languageName: node - linkType: hard - "mime@npm:1.6.0": version: 1.6.0 resolution: "mime@npm:1.6.0" @@ -14308,6 +14705,13 @@ __metadata: languageName: node linkType: hard +"mimic-response@npm:^1.0.0": + version: 1.0.1 + resolution: "mimic-response@npm:1.0.1" + checksum: 034c78753b0e622bc03c983663b1cdf66d03861050e0c8606563d149bc2b02d63f62ce4d32be4ab50d0553ae0ffe647fc34d1f5281184c6e1e8cf4d85e8d9823 + languageName: node + linkType: hard + "mimic-response@npm:^3.1.0": version: 3.1.0 resolution: "mimic-response@npm:3.1.0" @@ -14348,6 +14752,15 @@ __metadata: languageName: node linkType: hard +"minimatch@npm:10.0.3, minimatch@npm:^10.0.3, minimatch@npm:~10.0.1": + version: 10.0.3 + resolution: "minimatch@npm:10.0.3" + dependencies: + "@isaacs/brace-expansion": ^5.0.0 + checksum: 20bfb708095a321cb43c20b78254e484cb7d23aad992e15ca3234a3331a70fa9cd7a50bc1a7c7b2b9c9890c37ff0685f8380028fcc28ea5e6de75b1d4f9374aa + languageName: node + linkType: hard + "minimatch@npm:3.0.4": version: 3.0.4 resolution: "minimatch@npm:3.0.4" @@ -14375,16 +14788,7 @@ __metadata: languageName: node linkType: hard -"minimatch@npm:^10.0.0": - version: 10.0.1 - resolution: "minimatch@npm:10.0.1" - dependencies: - brace-expansion: ^2.0.1 - checksum: f5b63c2f30606091a057c5f679b067f84a2cd0ffbd2dbc9143bda850afd353c7be81949ff11ae0c86988f07390eeca64efd7143ee05a0dab37f6c6b38a2ebb6c - languageName: node - linkType: hard - -"minimatch@npm:^5.0.1, minimatch@npm:^5.1.6": +"minimatch@npm:^5.0.1": version: 5.1.6 resolution: "minimatch@npm:5.1.6" dependencies: @@ -14402,7 +14806,7 @@ __metadata: languageName: node linkType: hard -"minimatch@npm:^9.0.4, minimatch@npm:^9.0.5, minimatch@npm:~9.0.5": +"minimatch@npm:^9.0.4, minimatch@npm:^9.0.5": version: 9.0.5 resolution: "minimatch@npm:9.0.5" dependencies: @@ -14411,15 +14815,6 @@ __metadata: languageName: node linkType: hard -"minimatch@npm:~3.0.3": - version: 3.0.8 - resolution: "minimatch@npm:3.0.8" - dependencies: - brace-expansion: ^1.1.7 - checksum: 850cca179cad715133132693e6963b0db64ab0988c4d211415b087fc23a3e46321e2c5376a01bf5623d8782aba8bdf43c571e2e902e51fdce7175c7215c29f8b - languageName: node - linkType: hard - "minimist@npm:^1.2.0, minimist@npm:^1.2.6, minimist@npm:^1.2.8": version: 1.2.8 resolution: "minimist@npm:1.2.8" @@ -14527,41 +14922,13 @@ __metadata: languageName: node linkType: hard -"mocha@npm:^11.0.0": - version: 11.2.2 - resolution: "mocha@npm:11.2.2" +"monaco-editor@npm:~0.54.0": + version: 0.54.0 + resolution: "monaco-editor@npm:0.54.0" dependencies: - browser-stdout: ^1.3.1 - chokidar: ^4.0.1 - debug: ^4.3.5 - diff: ^5.2.0 - escape-string-regexp: ^4.0.0 - find-up: ^5.0.0 - glob: ^10.4.5 - he: ^1.2.0 - js-yaml: ^4.1.0 - log-symbols: ^4.1.0 - minimatch: ^5.1.6 - ms: ^2.1.3 - picocolors: ^1.1.1 - serialize-javascript: ^6.0.2 - strip-json-comments: ^3.1.1 - supports-color: ^8.1.1 - workerpool: ^6.5.1 - yargs: ^17.7.2 - yargs-parser: ^21.1.1 - yargs-unparser: ^2.0.0 - bin: - _mocha: bin/_mocha - mocha: bin/mocha.js - checksum: ac012ac2413e1705077a30e9b7d0172095ccc027fea54da0d84688754b42c2bca32dc24aaff2502ea869f53901d2b970b5a0697cf32b19433f350f89196d6e47 - languageName: node - linkType: hard - -"monaco-editor@npm:~0.52.0": - version: 0.52.0 - resolution: "monaco-editor@npm:0.52.0" - checksum: 76ab4ea38dfd2bc5687a2d777d7fc14fd7182ac6ed1ed6819b76a47924434bf3a08bcb75c68cd5aff20db86a7633ac46b335a6971ae21a8723a7dcf3e8289931 + dompurify: 3.1.7 + marked: 14.0.0 + checksum: 27bda0afafe5bbce693be9c72531e772bf71cfce6362a8358acd28815ddb95113cc1738ddccb28359a9d9def00da4dd928c1f32514dc0d1611ba0251758c3e2a languageName: node linkType: hard @@ -14598,19 +14965,12 @@ __metadata: languageName: node linkType: hard -"nanoid@npm:^3.3.8": - version: 3.3.8 - resolution: "nanoid@npm:3.3.8" +"nanoid@npm:^3.3.11": + version: 3.3.11 + resolution: "nanoid@npm:3.3.11" bin: nanoid: bin/nanoid.cjs - checksum: dfe0adbc0c77e9655b550c333075f51bb28cfc7568afbf3237249904f9c86c9aaaed1f113f0fddddba75673ee31c758c30c43d4414f014a52a7a626efc5958c9 - languageName: node - linkType: hard - -"natural-compare-lite@npm:^1.4.0": - version: 1.4.0 - resolution: "natural-compare-lite@npm:1.4.0" - checksum: 5222ac3986a2b78dd6069ac62cbb52a7bf8ffc90d972ab76dfe7b01892485d229530ed20d0c62e79a6b363a663b273db3bde195a1358ce9e5f779d4453887225 + checksum: 3be20d8866a57a6b6d218e82549711c8352ed969f9ab3c45379da28f405363ad4c9aeb0b39e9abc101a529ca65a72ff9502b00bf74a912c4b64a9d62dfd26c29 languageName: node linkType: hard @@ -14621,6 +14981,13 @@ __metadata: languageName: node linkType: hard +"natural-orderby@npm:^5.0.0": + version: 5.0.0 + resolution: "natural-orderby@npm:5.0.0" + checksum: bfdc62b91fb1b08bd3a8a9b66ec3476c17f867544f34778ce85344ffcff257342d632e94bc125c97f02b89c746479edd62c8727a310c94cab1a1d4a016eeeb46 + languageName: node + linkType: hard + "negotiator@npm:0.6.3, negotiator@npm:^0.6.3": version: 0.6.3 resolution: "negotiator@npm:0.6.3" @@ -14628,13 +14995,6 @@ __metadata: languageName: node linkType: hard -"negotiator@npm:^1.0.0": - version: 1.0.0 - resolution: "negotiator@npm:1.0.0" - checksum: 20ebfe79b2d2e7cf9cbc8239a72662b584f71164096e6e8896c8325055497c96f6b80cd22c258e8a2f2aa382a787795ec3ee8b37b422a302c7d4381b0d5ecfbb - languageName: node - linkType: hard - "neo-async@npm:^2.6.2": version: 2.6.2 resolution: "neo-async@npm:2.6.2" @@ -14745,6 +15105,13 @@ __metadata: languageName: node linkType: hard +"normalize-url@npm:^6.0.1": + version: 6.1.0 + resolution: "normalize-url@npm:6.1.0" + checksum: 4a4944631173e7d521d6b80e4c85ccaeceb2870f315584fa30121f505a6dfd86439c5e3fdd8cd9e0e291290c41d0c3599f0cb12ab356722ed242584c30348e50 + languageName: node + linkType: hard + "normalize-url@npm:^8.0.0": version: 8.0.0 resolution: "normalize-url@npm:8.0.0" @@ -14829,21 +15196,21 @@ __metadata: languageName: node linkType: hard -"nx@npm:20.7.2": - version: 20.7.2 - resolution: "nx@npm:20.7.2" +"nx@npm:21.4.1": + version: 21.4.1 + resolution: "nx@npm:21.4.1" dependencies: "@napi-rs/wasm-runtime": 0.2.4 - "@nx/nx-darwin-arm64": 20.7.2 - "@nx/nx-darwin-x64": 20.7.2 - "@nx/nx-freebsd-x64": 20.7.2 - "@nx/nx-linux-arm-gnueabihf": 20.7.2 - "@nx/nx-linux-arm64-gnu": 20.7.2 - "@nx/nx-linux-arm64-musl": 20.7.2 - "@nx/nx-linux-x64-gnu": 20.7.2 - "@nx/nx-linux-x64-musl": 20.7.2 - "@nx/nx-win32-arm64-msvc": 20.7.2 - "@nx/nx-win32-x64-msvc": 20.7.2 + "@nx/nx-darwin-arm64": 21.4.1 + "@nx/nx-darwin-x64": 21.4.1 + "@nx/nx-freebsd-x64": 21.4.1 + "@nx/nx-linux-arm-gnueabihf": 21.4.1 + "@nx/nx-linux-arm64-gnu": 21.4.1 + "@nx/nx-linux-arm64-musl": 21.4.1 + "@nx/nx-linux-x64-gnu": 21.4.1 + "@nx/nx-linux-x64-musl": 21.4.1 + "@nx/nx-win32-arm64-msvc": 21.4.1 + "@nx/nx-win32-x64-msvc": 21.4.1 "@yarnpkg/lockfile": ^1.1.0 "@yarnpkg/parsers": 3.0.2 "@zkochan/js-yaml": 0.0.7 @@ -14859,7 +15226,7 @@ __metadata: flat: ^5.0.2 front-matter: ^4.0.2 ignore: ^5.0.4 - jest-diff: ^29.4.1 + jest-diff: ^30.0.2 jsonc-parser: 3.2.0 lines-and-columns: 2.0.3 minimatch: 9.0.3 @@ -14872,6 +15239,7 @@ __metadata: string-width: ^4.2.3 tar-stream: ~2.2.0 tmp: ~0.2.1 + tree-kill: ^1.2.2 tsconfig-paths: ^4.1.2 tslib: ^2.3.0 yaml: ^2.6.0 @@ -14909,21 +15277,21 @@ __metadata: bin: nx: bin/nx.js nx-cloud: bin/nx-cloud.js - checksum: e566448aa98de9fc5fd32fb20251062e4c628f97cd63dd194375fd7597ebcae2dc9ff31632499914e7dcd89a8d20abbd015745aeaecb90cbf290aa428227ce3e + checksum: babf4d271031fad5e300509310dd65cc1f3198c37a880ceb0c2eec105a61fcd903fa6fba4f597669b08b1c92445998f82f5f2cffab1a94ff45b015389bcb0515 languageName: node linkType: hard -"object-assign@npm:^4, object-assign@npm:^4.1.1": +"object-assign@npm:^4.1.1": version: 4.1.1 resolution: "object-assign@npm:4.1.1" checksum: fcc6e4ea8c7fe48abfbb552578b1c53e0d194086e2e6bbbf59e0a536381a292f39943c6e9628af05b5528aa5e3318bb30d6b2e53cadaf5b8fe9e12c4b69af23f languageName: node linkType: hard -"object-inspect@npm:^1.13.3": - version: 1.13.3 - resolution: "object-inspect@npm:1.13.3" - checksum: 8c962102117241e18ea403b84d2521f78291b774b03a29ee80a9863621d88265ffd11d0d7e435c4c2cea0dc2a2fbf8bbc92255737a05536590f2df2e8756f297 +"object-inspect@npm:^1.13.3, object-inspect@npm:^1.13.4": + version: 1.13.4 + resolution: "object-inspect@npm:1.13.4" + checksum: 582810c6a8d2ef988ea0a39e69e115a138dad8f42dd445383b394877e5816eb4268489f316a6f74ee9c4e0a984b3eab1028e3e79d62b1ed67c726661d55c7a8b languageName: node linkType: hard @@ -14982,7 +15350,7 @@ __metadata: languageName: node linkType: hard -"object.values@npm:^1.1.6, object.values@npm:^1.2.0, object.values@npm:^1.2.1": +"object.values@npm:^1.1.6, object.values@npm:^1.2.1": version: 1.2.1 resolution: "object.values@npm:1.2.1" dependencies: @@ -15001,7 +15369,7 @@ __metadata: languageName: node linkType: hard -"on-finished@npm:2.4.1, on-finished@npm:^2.4.1": +"on-finished@npm:2.4.1": version: 2.4.1 resolution: "on-finished@npm:2.4.1" dependencies: @@ -15017,7 +15385,7 @@ __metadata: languageName: node linkType: hard -"once@npm:^1.3.0, once@npm:^1.4.0": +"once@npm:^1.3.0, once@npm:^1.3.1, once@npm:^1.4.0": version: 1.4.0 resolution: "once@npm:1.4.0" dependencies: @@ -15103,7 +15471,7 @@ __metadata: languageName: node linkType: hard -"own-keys@npm:^1.0.0": +"own-keys@npm:^1.0.1": version: 1.0.1 resolution: "own-keys@npm:1.0.1" dependencies: @@ -15114,6 +15482,79 @@ __metadata: languageName: node linkType: hard +"oxc-resolver@npm:^11.12.0": + version: 11.13.1 + resolution: "oxc-resolver@npm:11.13.1" + dependencies: + "@oxc-resolver/binding-android-arm-eabi": 11.13.1 + "@oxc-resolver/binding-android-arm64": 11.13.1 + "@oxc-resolver/binding-darwin-arm64": 11.13.1 + "@oxc-resolver/binding-darwin-x64": 11.13.1 + "@oxc-resolver/binding-freebsd-x64": 11.13.1 + "@oxc-resolver/binding-linux-arm-gnueabihf": 11.13.1 + "@oxc-resolver/binding-linux-arm-musleabihf": 11.13.1 + "@oxc-resolver/binding-linux-arm64-gnu": 11.13.1 + "@oxc-resolver/binding-linux-arm64-musl": 11.13.1 + "@oxc-resolver/binding-linux-ppc64-gnu": 11.13.1 + "@oxc-resolver/binding-linux-riscv64-gnu": 11.13.1 + "@oxc-resolver/binding-linux-riscv64-musl": 11.13.1 + "@oxc-resolver/binding-linux-s390x-gnu": 11.13.1 + "@oxc-resolver/binding-linux-x64-gnu": 11.13.1 + "@oxc-resolver/binding-linux-x64-musl": 11.13.1 + "@oxc-resolver/binding-wasm32-wasi": 11.13.1 + "@oxc-resolver/binding-win32-arm64-msvc": 11.13.1 + "@oxc-resolver/binding-win32-ia32-msvc": 11.13.1 + "@oxc-resolver/binding-win32-x64-msvc": 11.13.1 + dependenciesMeta: + "@oxc-resolver/binding-android-arm-eabi": + optional: true + "@oxc-resolver/binding-android-arm64": + optional: true + "@oxc-resolver/binding-darwin-arm64": + optional: true + "@oxc-resolver/binding-darwin-x64": + optional: true + "@oxc-resolver/binding-freebsd-x64": + optional: true + "@oxc-resolver/binding-linux-arm-gnueabihf": + optional: true + "@oxc-resolver/binding-linux-arm-musleabihf": + optional: true + "@oxc-resolver/binding-linux-arm64-gnu": + optional: true + "@oxc-resolver/binding-linux-arm64-musl": + optional: true + "@oxc-resolver/binding-linux-ppc64-gnu": + optional: true + "@oxc-resolver/binding-linux-riscv64-gnu": + optional: true + "@oxc-resolver/binding-linux-riscv64-musl": + optional: true + "@oxc-resolver/binding-linux-s390x-gnu": + optional: true + "@oxc-resolver/binding-linux-x64-gnu": + optional: true + "@oxc-resolver/binding-linux-x64-musl": + optional: true + "@oxc-resolver/binding-wasm32-wasi": + optional: true + "@oxc-resolver/binding-win32-arm64-msvc": + optional: true + "@oxc-resolver/binding-win32-ia32-msvc": + optional: true + "@oxc-resolver/binding-win32-x64-msvc": + optional: true + checksum: 2aed976eac9d7142be0b518b95710ae6d988223064e49c5138951a334933a420b7176ec9a43f854b3e54d10a7d4fafc3cc5f15ea0aa297637165f47815f69151 + languageName: node + linkType: hard + +"p-cancelable@npm:^2.0.0": + version: 2.1.1 + resolution: "p-cancelable@npm:2.1.1" + checksum: 3dba12b4fb4a1e3e34524535c7858fc82381bbbd0f247cc32dedc4018592a3950ce66b106d0880b4ec4c2d8d6576f98ca885dc1d7d0f274d1370be20e9523ddf + languageName: node + linkType: hard + "p-cancelable@npm:^3.0.0": version: 3.0.0 resolution: "p-cancelable@npm:3.0.0" @@ -15121,7 +15562,7 @@ __metadata: languageName: node linkType: hard -"p-limit@npm:^2.0.0": +"p-limit@npm:^2.0.0, p-limit@npm:^2.2.0": version: 2.3.0 resolution: "p-limit@npm:2.3.0" dependencies: @@ -15264,13 +15705,12 @@ __metadata: languageName: node linkType: hard -"parse-imports@npm:^2.1.1": - version: 2.2.1 - resolution: "parse-imports@npm:2.2.1" +"parse-imports-exports@npm:^0.2.4": + version: 0.2.4 + resolution: "parse-imports-exports@npm:0.2.4" dependencies: - es-module-lexer: ^1.5.3 - slashes: ^3.0.12 - checksum: 0b5cedd10b6b45eea4f365bf047074a874d90e952597f83d4a8a00f1edece180b5870e42401b5531088916836f98c20eecbddc608d8717eb4a6be99a41f2b6fd + parse-statements: 1.0.11 + checksum: c0028aef0ac33c3905928973a0222be027e148ffb8950faaae1d2849526dc5c95aa44a4a619dea0e540529ae74e78414c2e2b6b037520e499e970c1059f0c12d languageName: node linkType: hard @@ -15293,6 +15733,13 @@ __metadata: languageName: node linkType: hard +"parse-statements@npm:1.0.11": + version: 1.0.11 + resolution: "parse-statements@npm:1.0.11" + checksum: b7281e5b9e949cbed4cebaf56fb2d30495e5caf0e0ef9b8227e4b4010664db693d4bc694d54d04997f65034ebd569246b6ad454d2cdc3ecbaff69b7bc7b9b068 + languageName: node + linkType: hard + "parse5-htmlparser2-tree-adapter@npm:^7.0.0": version: 7.0.0 resolution: "parse5-htmlparser2-tree-adapter@npm:7.0.0" @@ -15312,7 +15759,7 @@ __metadata: languageName: node linkType: hard -"parseurl@npm:^1.3.3, parseurl@npm:~1.3.2, parseurl@npm:~1.3.3": +"parseurl@npm:~1.3.2, parseurl@npm:~1.3.3": version: 1.3.3 resolution: "parseurl@npm:1.3.3" checksum: 407cee8e0a3a4c5cd472559bca8b6a45b82c124e9a4703302326e9ab60fc1081442ada4e02628efef1eb16197ddc7f8822f5a91fd7d7c86b51f530aedb17dfa2 @@ -15428,13 +15875,6 @@ __metadata: languageName: node linkType: hard -"path-to-regexp@npm:^8.0.0": - version: 8.2.0 - resolution: "path-to-regexp@npm:8.2.0" - checksum: 56e13e45962e776e9e7cd72e87a441cfe41f33fd539d097237ceb16adc922281136ca12f5a742962e33d8dda9569f630ba594de56d8b7b6e49adf31803c5e771 - languageName: node - linkType: hard - "path-type@npm:^4.0.0": version: 4.0.0 resolution: "path-type@npm:4.0.0" @@ -15474,7 +15914,7 @@ __metadata: languageName: node linkType: hard -"picomatch@npm:4.0.2, picomatch@npm:^4.0.1, picomatch@npm:^4.0.2": +"picomatch@npm:4.0.2": version: 4.0.2 resolution: "picomatch@npm:4.0.2" checksum: a7a5188c954f82c6585720e9143297ccd0e35ad8072231608086ca950bee672d51b0ef676254af0788205e59bd4e4deb4e7708769226bed725bf13370a7d1464 @@ -15488,6 +15928,13 @@ __metadata: languageName: node linkType: hard +"picomatch@npm:^4.0.1, picomatch@npm:^4.0.2, picomatch@npm:^4.0.3": + version: 4.0.3 + resolution: "picomatch@npm:4.0.3" + checksum: 6817fb74eb745a71445debe1029768de55fd59a42b75606f478ee1d0dc1aa6e78b711d041a7c9d5550e042642029b7f373dc1a43b224c4b7f12d23436735dba0 + languageName: node + linkType: hard + "pidtree@npm:^0.6.0": version: 0.6.0 resolution: "pidtree@npm:0.6.0" @@ -15497,13 +15944,6 @@ __metadata: languageName: node linkType: hard -"pkce-challenge@npm:^5.0.0": - version: 5.0.0 - resolution: "pkce-challenge@npm:5.0.0" - checksum: b5cc239f67ed525b49a23a86fdb8f49e3cdb9fd8f5e8612a15f35b553a18e5a43c99db474ffc6232e084c8328d4f2da51557e51ee4e7f8be42f710215df36f3f - languageName: node - linkType: hard - "pkg-dir@npm:^7.0.0": version: 7.0.0 resolution: "pkg-dir@npm:7.0.0" @@ -15536,6 +15976,17 @@ __metadata: languageName: node linkType: hard +"postcss-attribute-case-insensitive@npm:^7.0.1": + version: 7.0.1 + resolution: "postcss-attribute-case-insensitive@npm:7.0.1" + dependencies: + postcss-selector-parser: ^7.0.0 + peerDependencies: + postcss: ^8.4 + checksum: 18829dfc6dd2f6b1ca82afa8555f07ec8ac5687fe95612e353aa601b842bdec05ca78fc96016dba2b7d32607b31e085e5087fda00e1e0dfdc6c2a1b07b1b15c2 + languageName: node + linkType: hard + "postcss-calc@npm:^9.0.1": version: 9.0.1 resolution: "postcss-calc@npm:9.0.1" @@ -15548,6 +15999,56 @@ __metadata: languageName: node linkType: hard +"postcss-clamp@npm:^4.1.0": + version: 4.1.0 + resolution: "postcss-clamp@npm:4.1.0" + dependencies: + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.4.6 + checksum: 118eec936b3b035dc8d75c89973408f15c5a3de3d1ee210a2b3511e3e431d9c56e6f354b509a90540241e2225ffe3caaa2fdf25919c63348ce4583a28ada642c + languageName: node + linkType: hard + +"postcss-color-functional-notation@npm:^7.0.10": + version: 7.0.10 + resolution: "postcss-color-functional-notation@npm:7.0.10" + dependencies: + "@csstools/css-color-parser": ^3.0.10 + "@csstools/css-parser-algorithms": ^3.0.5 + "@csstools/css-tokenizer": ^3.0.4 + "@csstools/postcss-progressive-custom-properties": ^4.1.0 + "@csstools/utilities": ^2.0.0 + peerDependencies: + postcss: ^8.4 + checksum: af873fbd4899bd863aeed7b40753ab3e6028bf7b8eef53b54de1cbd1b83d92b1007a9a90db314781c2bc0ec204537ca423d17cdc37aee46ed1308d7406b81729 + languageName: node + linkType: hard + +"postcss-color-hex-alpha@npm:^10.0.0": + version: 10.0.0 + resolution: "postcss-color-hex-alpha@npm:10.0.0" + dependencies: + "@csstools/utilities": ^2.0.0 + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.4 + checksum: 2dbbd66d76522c7d281c292589360f21806b6dd31a582484e7e4a848e5244d645d5c5e1b6c6219dd5fb7333808cd94a27dd0d2e1db093d043668ed7b42db59ad + languageName: node + linkType: hard + +"postcss-color-rebeccapurple@npm:^10.0.0": + version: 10.0.0 + resolution: "postcss-color-rebeccapurple@npm:10.0.0" + dependencies: + "@csstools/utilities": ^2.0.0 + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.4 + checksum: 8ca0ee2b6b45ff62abdfc9b6757d8832d398c2e47dd705759485b685f544eaed81ec00f050a1bad67ffb5e6243332085a09807d47526ce3b43456b027119e0ae + languageName: node + linkType: hard + "postcss-colormin@npm:^6.1.0": version: 6.1.0 resolution: "postcss-colormin@npm:6.1.0" @@ -15574,6 +16075,60 @@ __metadata: languageName: node linkType: hard +"postcss-custom-media@npm:^11.0.6": + version: 11.0.6 + resolution: "postcss-custom-media@npm:11.0.6" + dependencies: + "@csstools/cascade-layer-name-parser": ^2.0.5 + "@csstools/css-parser-algorithms": ^3.0.5 + "@csstools/css-tokenizer": ^3.0.4 + "@csstools/media-query-list-parser": ^4.0.3 + peerDependencies: + postcss: ^8.4 + checksum: 3b8ab5eb6d80cf9dd0b74acf69530f73009d860509d820fc5349894a10c2abd08eb1ff77f90c59ee51aebf422fe09d4093ece8d15f652f771ab0fcfd03a42417 + languageName: node + linkType: hard + +"postcss-custom-properties@npm:^14.0.5": + version: 14.0.5 + resolution: "postcss-custom-properties@npm:14.0.5" + dependencies: + "@csstools/cascade-layer-name-parser": ^2.0.5 + "@csstools/css-parser-algorithms": ^3.0.5 + "@csstools/css-tokenizer": ^3.0.4 + "@csstools/utilities": ^2.0.0 + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.4 + checksum: e6b746b7b37dc0126f2f7b5f260251240cda1150db74aea1e1f8f3bd3b41fcdff055911c3eadecb1d8e867ef42b422c7fde2a4b45ff7503e92c359729e78946c + languageName: node + linkType: hard + +"postcss-custom-selectors@npm:^8.0.5": + version: 8.0.5 + resolution: "postcss-custom-selectors@npm:8.0.5" + dependencies: + "@csstools/cascade-layer-name-parser": ^2.0.5 + "@csstools/css-parser-algorithms": ^3.0.5 + "@csstools/css-tokenizer": ^3.0.4 + postcss-selector-parser: ^7.0.0 + peerDependencies: + postcss: ^8.4 + checksum: 191cfe62ad3eaf3d8bff75ed461baebbb3b9a52de9c1c75bded61da4ed2302d7c53c457e9febfa7cffc9a1fb7f6ed98cab8c4b2a071a1097e487e0117018e6cf + languageName: node + linkType: hard + +"postcss-dir-pseudo-class@npm:^9.0.1": + version: 9.0.1 + resolution: "postcss-dir-pseudo-class@npm:9.0.1" + dependencies: + postcss-selector-parser: ^7.0.0 + peerDependencies: + postcss: ^8.4 + checksum: 7f6212fe7f2a83e95d85df14208df3edb75b6b8f89ad865fdfbd1abf5765b6649ff46bb7ff56f7788ff8cfe60546ff305cc2fd2f9b1f9e1647a4386507714070 + languageName: node + linkType: hard + "postcss-discard-comments@npm:^6.0.2": version: 6.0.2 resolution: "postcss-discard-comments@npm:6.0.2" @@ -15621,6 +16176,86 @@ __metadata: languageName: node linkType: hard +"postcss-double-position-gradients@npm:^6.0.2": + version: 6.0.2 + resolution: "postcss-double-position-gradients@npm:6.0.2" + dependencies: + "@csstools/postcss-progressive-custom-properties": ^4.1.0 + "@csstools/utilities": ^2.0.0 + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.4 + checksum: cc0302e2850334566ca7b85bddfbf6f5e839132d542d41eb8c380194048e35656aa4b7b9ea9e557747e4924a90fbd590d5abaea799e5c7493b0f239eb3d27721 + languageName: node + linkType: hard + +"postcss-focus-visible@npm:^10.0.1": + version: 10.0.1 + resolution: "postcss-focus-visible@npm:10.0.1" + dependencies: + postcss-selector-parser: ^7.0.0 + peerDependencies: + postcss: ^8.4 + checksum: 47c038ccf139bad6a4c12cf59c5ac78acbac96ae0517ae08d5db676680d585ae7943e22328bd0d31876d6bacc24e4b717b5f809d26218d76989f7b9a44369793 + languageName: node + linkType: hard + +"postcss-focus-within@npm:^9.0.1": + version: 9.0.1 + resolution: "postcss-focus-within@npm:9.0.1" + dependencies: + postcss-selector-parser: ^7.0.0 + peerDependencies: + postcss: ^8.4 + checksum: ca953bf566605c6519f5318a5a4886f8f0698798ba96d505c287cc0397d90a80246de948af354592a680615667e553c3fb67e88d9f55bdf630dab67b0fc0ceaa + languageName: node + linkType: hard + +"postcss-font-variant@npm:^5.0.0": + version: 5.0.0 + resolution: "postcss-font-variant@npm:5.0.0" + peerDependencies: + postcss: ^8.1.0 + checksum: a19286589261c2bc3e20470486e1ee3b4daf34271c5020167f30856c9b30c26f23264307cb97a184d503814e1b8c5d8a1f9f64a14fd4fd9551c173dca9424695 + languageName: node + linkType: hard + +"postcss-gap-properties@npm:^6.0.0": + version: 6.0.0 + resolution: "postcss-gap-properties@npm:6.0.0" + peerDependencies: + postcss: ^8.4 + checksum: 8fa8a208fe254ddfcb0442072a6232576efa1fc3deea917be6d3a0c25dfcb855cc6806572e42a098aa0276a5ad3917f19b269409f5ce1f22d233c0072d72f823 + languageName: node + linkType: hard + +"postcss-image-set-function@npm:^7.0.0": + version: 7.0.0 + resolution: "postcss-image-set-function@npm:7.0.0" + dependencies: + "@csstools/utilities": ^2.0.0 + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.4 + checksum: 328946f3f258c230ac50f2f54dc43ac89f21b1afe42e2828fa20bfd19692a1198e439becabe9dfb64de50932c6ef987a8b2b5ea9398ae7ca813afb4f7e595be7 + languageName: node + linkType: hard + +"postcss-lab-function@npm:^7.0.10": + version: 7.0.10 + resolution: "postcss-lab-function@npm:7.0.10" + dependencies: + "@csstools/css-color-parser": ^3.0.10 + "@csstools/css-parser-algorithms": ^3.0.5 + "@csstools/css-tokenizer": ^3.0.4 + "@csstools/postcss-progressive-custom-properties": ^4.1.0 + "@csstools/utilities": ^2.0.0 + peerDependencies: + postcss: ^8.4 + checksum: bd3fb9350a72147d474bf5a5e924ff911ac16b8218ab7d5a8e06c158409a79e6817b6dc54533c62c4983024a91c706d9128d883369a0bdec58b650f4c5a4a7cf + languageName: node + linkType: hard + "postcss-loader@npm:^7.3.3": version: 7.3.4 resolution: "postcss-loader@npm:7.3.4" @@ -15635,6 +16270,17 @@ __metadata: languageName: node linkType: hard +"postcss-logical@npm:^8.1.0": + version: 8.1.0 + resolution: "postcss-logical@npm:8.1.0" + dependencies: + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.4 + checksum: 7db1e8c9f9c1ec9dc8cef56830ac3686766629cc7e28c0494b6e0f3699979f18c11225a39c37210cf81be4491adaa6bdbc394429d7e050f2d03e5845ef6608f9 + languageName: node + linkType: hard + "postcss-merge-idents@npm:^6.0.3": version: 6.0.3 resolution: "postcss-merge-idents@npm:6.0.3" @@ -15765,6 +16411,19 @@ __metadata: languageName: node linkType: hard +"postcss-nesting@npm:^13.0.1": + version: 13.0.1 + resolution: "postcss-nesting@npm:13.0.1" + dependencies: + "@csstools/selector-resolve-nested": ^3.0.0 + "@csstools/selector-specificity": ^5.0.0 + postcss-selector-parser: ^7.0.0 + peerDependencies: + postcss: ^8.4 + checksum: 71899e369a92678d6a19846a40cf851d84751f7018ea42e17707aa15611bc4bc3774deb1adc23b941dcb6350c83f78761230070055dd299b843de1c8d88b5b86 + languageName: node + linkType: hard + "postcss-normalize-charset@npm:^6.0.2": version: 6.0.2 resolution: "postcss-normalize-charset@npm:6.0.2" @@ -15863,6 +16522,15 @@ __metadata: languageName: node linkType: hard +"postcss-opacity-percentage@npm:^3.0.0": + version: 3.0.0 + resolution: "postcss-opacity-percentage@npm:3.0.0" + peerDependencies: + postcss: ^8.4 + checksum: dc813113f05f91f1c87ab3c125911f9e5989d1f3fc7cc5586a165901a63c0d02077d134df844391ea5624088680c6b3cee75bc33b8efdcaf340a91046e47e4e1 + languageName: node + linkType: hard + "postcss-ordered-values@npm:^6.0.2": version: 6.0.2 resolution: "postcss-ordered-values@npm:6.0.2" @@ -15875,6 +16543,122 @@ __metadata: languageName: node linkType: hard +"postcss-overflow-shorthand@npm:^6.0.0": + version: 6.0.0 + resolution: "postcss-overflow-shorthand@npm:6.0.0" + dependencies: + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.4 + checksum: 80f07e0beb97b7ac5dac590802591fc93392b0d7a9678e17998b4d34ee0cca637665232c7ea88b3a4342192bc9a2a4f5c757ad86b837a5fd59d083d37cc7da16 + languageName: node + linkType: hard + +"postcss-page-break@npm:^3.0.4": + version: 3.0.4 + resolution: "postcss-page-break@npm:3.0.4" + peerDependencies: + postcss: ^8 + checksum: a7d08c945fc691f62c77ac701e64722218b14ec5c8fc1972b8af9c21553492d40808cf95e61b9697b1dacaf7e6180636876d7fee314f079e6c9e39ac1b1edc6f + languageName: node + linkType: hard + +"postcss-place@npm:^10.0.0": + version: 10.0.0 + resolution: "postcss-place@npm:10.0.0" + dependencies: + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.4 + checksum: 738cd0dc2412cf573bcfb2f7dce8e1cd21887f61c8808f55114f08fb8fbf03715e957fdd8859241eecebe400a5202771f513610b04e0f17c7742f6a5ea3bafb3 + languageName: node + linkType: hard + +"postcss-preset-env@npm:^10.1.0": + version: 10.2.0 + resolution: "postcss-preset-env@npm:10.2.0" + dependencies: + "@csstools/postcss-cascade-layers": ^5.0.1 + "@csstools/postcss-color-function": ^4.0.10 + "@csstools/postcss-color-mix-function": ^3.0.10 + "@csstools/postcss-color-mix-variadic-function-arguments": ^1.0.0 + "@csstools/postcss-content-alt-text": ^2.0.6 + "@csstools/postcss-exponential-functions": ^2.0.9 + "@csstools/postcss-font-format-keywords": ^4.0.0 + "@csstools/postcss-gamut-mapping": ^2.0.10 + "@csstools/postcss-gradients-interpolation-method": ^5.0.10 + "@csstools/postcss-hwb-function": ^4.0.10 + "@csstools/postcss-ic-unit": ^4.0.2 + "@csstools/postcss-initial": ^2.0.1 + "@csstools/postcss-is-pseudo-class": ^5.0.1 + "@csstools/postcss-light-dark-function": ^2.0.9 + "@csstools/postcss-logical-float-and-clear": ^3.0.0 + "@csstools/postcss-logical-overflow": ^2.0.0 + "@csstools/postcss-logical-overscroll-behavior": ^2.0.0 + "@csstools/postcss-logical-resize": ^3.0.0 + "@csstools/postcss-logical-viewport-units": ^3.0.4 + "@csstools/postcss-media-minmax": ^2.0.9 + "@csstools/postcss-media-queries-aspect-ratio-number-values": ^3.0.5 + "@csstools/postcss-nested-calc": ^4.0.0 + "@csstools/postcss-normalize-display-values": ^4.0.0 + "@csstools/postcss-oklab-function": ^4.0.10 + "@csstools/postcss-progressive-custom-properties": ^4.1.0 + "@csstools/postcss-random-function": ^2.0.1 + "@csstools/postcss-relative-color-syntax": ^3.0.10 + "@csstools/postcss-scope-pseudo-class": ^4.0.1 + "@csstools/postcss-sign-functions": ^1.1.4 + "@csstools/postcss-stepped-value-functions": ^4.0.9 + "@csstools/postcss-text-decoration-shorthand": ^4.0.2 + "@csstools/postcss-trigonometric-functions": ^4.0.9 + "@csstools/postcss-unset-value": ^4.0.0 + autoprefixer: ^10.4.21 + browserslist: ^4.24.5 + css-blank-pseudo: ^7.0.1 + css-has-pseudo: ^7.0.2 + css-prefers-color-scheme: ^10.0.0 + cssdb: ^8.3.0 + postcss-attribute-case-insensitive: ^7.0.1 + postcss-clamp: ^4.1.0 + postcss-color-functional-notation: ^7.0.10 + postcss-color-hex-alpha: ^10.0.0 + postcss-color-rebeccapurple: ^10.0.0 + postcss-custom-media: ^11.0.6 + postcss-custom-properties: ^14.0.5 + postcss-custom-selectors: ^8.0.5 + postcss-dir-pseudo-class: ^9.0.1 + postcss-double-position-gradients: ^6.0.2 + postcss-focus-visible: ^10.0.1 + postcss-focus-within: ^9.0.1 + postcss-font-variant: ^5.0.0 + postcss-gap-properties: ^6.0.0 + postcss-image-set-function: ^7.0.0 + postcss-lab-function: ^7.0.10 + postcss-logical: ^8.1.0 + postcss-nesting: ^13.0.1 + postcss-opacity-percentage: ^3.0.0 + postcss-overflow-shorthand: ^6.0.0 + postcss-page-break: ^3.0.4 + postcss-place: ^10.0.0 + postcss-pseudo-class-any-link: ^10.0.1 + postcss-replace-overflow-wrap: ^4.0.0 + postcss-selector-not: ^8.0.1 + peerDependencies: + postcss: ^8.4 + checksum: 0d00ca805e0d869d137cdc4cce4ebbfa02b28b7c75ab43f8b245fa8242e834a654fda4dff37cc6161ac0f6e16f6614bf3e6d584ed35c68e75dd4b804bdc72c2a + languageName: node + linkType: hard + +"postcss-pseudo-class-any-link@npm:^10.0.1": + version: 10.0.1 + resolution: "postcss-pseudo-class-any-link@npm:10.0.1" + dependencies: + postcss-selector-parser: ^7.0.0 + peerDependencies: + postcss: ^8.4 + checksum: 376525d1a6fa223d908deb884b93d5cb76f4fa7431c090a8ada63e5ee9657bec7bf8e23eff1c36264c051c5a653928e38392165a862b7c5bf5e39e9364383fce + languageName: node + linkType: hard + "postcss-reduce-idents@npm:^6.0.3": version: 6.0.3 resolution: "postcss-reduce-idents@npm:6.0.3" @@ -15909,6 +16693,15 @@ __metadata: languageName: node linkType: hard +"postcss-replace-overflow-wrap@npm:^4.0.0": + version: 4.0.0 + resolution: "postcss-replace-overflow-wrap@npm:4.0.0" + peerDependencies: + postcss: ^8.0.3 + checksum: 3ffe20b300a4c377a11c588b142740d8557e03c707474c45234c934190ac374750ddc92c7906c373471d273a20504a429c2062c21fdcaff830fb28e0a81ac1dc + languageName: node + linkType: hard + "postcss-resolve-nested-selector@npm:^0.1.6": version: 0.1.6 resolution: "postcss-resolve-nested-selector@npm:0.1.6" @@ -15920,8 +16713,19 @@ __metadata: version: 7.0.1 resolution: "postcss-safe-parser@npm:7.0.1" peerDependencies: - postcss: ^8.4.31 - checksum: 285f30877f3ef5d43586432394ef4fcab904cd5bcfff5c26f586eb630fbee490abf2ac6d81e64fa212fb64d03630d12c2f3c5196f5637bec5ba3d043562ddf30 + postcss: ^8.4.31 + checksum: 285f30877f3ef5d43586432394ef4fcab904cd5bcfff5c26f586eb630fbee490abf2ac6d81e64fa212fb64d03630d12c2f3c5196f5637bec5ba3d043562ddf30 + languageName: node + linkType: hard + +"postcss-selector-not@npm:^8.0.1": + version: 8.0.1 + resolution: "postcss-selector-not@npm:8.0.1" + dependencies: + postcss-selector-parser: ^7.0.0 + peerDependencies: + postcss: ^8.4 + checksum: 28c1f7863ac85016ecd695304ee1eb21b1128eacba333d6d4540fd93691c58ff6329ac323b6a640f2da918e95c7b58e8f534c8b6e2ed016f6e31cdfdc743edbc languageName: node linkType: hard @@ -15935,7 +16739,7 @@ __metadata: languageName: node linkType: hard -"postcss-selector-parser@npm:^7.1.0": +"postcss-selector-parser@npm:^7.0.0, postcss-selector-parser@npm:^7.1.0": version: 7.1.0 resolution: "postcss-selector-parser@npm:7.1.0" dependencies: @@ -16004,14 +16808,14 @@ __metadata: languageName: node linkType: hard -"postcss@npm:^8.4.21, postcss@npm:^8.4.24, postcss@npm:^8.4.26, postcss@npm:^8.4.33, postcss@npm:^8.4.38, postcss@npm:^8.5.3": - version: 8.5.3 - resolution: "postcss@npm:8.5.3" +"postcss@npm:^8.4.21, postcss@npm:^8.4.24, postcss@npm:^8.4.26, postcss@npm:^8.4.33, postcss@npm:^8.4.38, postcss@npm:^8.5.3, postcss@npm:^8.5.6": + version: 8.5.6 + resolution: "postcss@npm:8.5.6" dependencies: - nanoid: ^3.3.8 + nanoid: ^3.3.11 picocolors: ^1.1.1 source-map-js: ^1.2.1 - checksum: da574620eb84ff60e65e1d8fc6bd5ad87a19101a23d0aba113c653434161543918229a0f673d89efb3b6d4906287eb04b957310dbcf4cbebacad9d1312711461 + checksum: 20f3b5d673ffeec2b28d65436756d31ee33f65b0a8bedb3d32f556fbd5973be38c3a7fb5b959a5236c60a5db7b91b0a6b14ffaac0d717dce1b903b964ee1c1bb languageName: node linkType: hard @@ -16022,12 +16826,12 @@ __metadata: languageName: node linkType: hard -"prettier@npm:3.5.0": - version: 3.5.0 - resolution: "prettier@npm:3.5.0" +"prettier@npm:3.6.2": + version: 3.6.2 + resolution: "prettier@npm:3.6.2" bin: prettier: bin/prettier.cjs - checksum: 5b451b701a437f4561b7413d1e5c1da92b1af52bf5995a429ce67c84a8525145f90992c00fe2eefd471c307d261d6f160b4bac045e0ca38f1aa4aba5e9bfdf0f + checksum: 0206f5f437892e8858f298af8850bf9d0ef1c22e21107a213ba56bfb9c2387a2020bfda244a20161d8e3dad40c6b04101609a55d370dece53d0a31893b64f861 languageName: node linkType: hard @@ -16048,14 +16852,14 @@ __metadata: languageName: node linkType: hard -"pretty-format@npm:^29": - version: 29.7.0 - resolution: "pretty-format@npm:29.7.0" +"pretty-format@npm:30.0.5": + version: 30.0.5 + resolution: "pretty-format@npm:30.0.5" dependencies: - "@jest/schemas": ^29.6.3 - ansi-styles: ^5.0.0 - react-is: ^18.0.0 - checksum: 032c1602383e71e9c0c02a01bbd25d6759d60e9c7cf21937dde8357aa753da348fcec5def5d1002c9678a8524d5fe099ad98861286550ef44de8808cc61e43b6 + "@jest/schemas": 30.0.5 + ansi-styles: ^5.2.0 + react-is: ^18.3.1 + checksum: 0772b7432ff4083483dc12b5b9a1904a1a8f2654936af2a5fa3ba5dfa994a4c7ef843f132152894fd96203a09e0ef80dab2e99dabebd510da86948ed91238fed languageName: node linkType: hard @@ -16151,7 +16955,7 @@ __metadata: languageName: node linkType: hard -"proxy-addr@npm:^2.0.7, proxy-addr@npm:~2.0.7": +"proxy-addr@npm:~2.0.7": version: 2.0.7 resolution: "proxy-addr@npm:2.0.7" dependencies: @@ -16168,6 +16972,16 @@ __metadata: languageName: node linkType: hard +"pump@npm:^3.0.0": + version: 3.0.3 + resolution: "pump@npm:3.0.3" + dependencies: + end-of-stream: ^1.1.0 + once: ^1.3.1 + checksum: 52843fc933b838c0330f588388115a1b28ef2a5ffa7774709b142e35431e8ab0c2edec90de3fa34ebb72d59fef854f151eea7dfc211b6dcf586b384556bd2f39 + languageName: node + linkType: hard + "punycode.js@npm:^2.3.1": version: 2.3.1 resolution: "punycode.js@npm:2.3.1" @@ -16200,15 +17014,6 @@ __metadata: languageName: node linkType: hard -"qs@npm:^6.14.0": - version: 6.14.0 - resolution: "qs@npm:6.14.0" - dependencies: - side-channel: ^1.1.0 - checksum: 189b52ad4e9a0da1a16aff4c58b2a554a8dad9bd7e287c7da7446059b49ca2e33a49e570480e8be406b87fccebf134f51c373cbce36c8c83859efa0c9b71d635 - languageName: node - linkType: hard - "queue-microtask@npm:^1.2.2": version: 1.2.3 resolution: "queue-microtask@npm:1.2.3" @@ -16267,18 +17072,6 @@ __metadata: languageName: node linkType: hard -"raw-body@npm:^3.0.0": - version: 3.0.0 - resolution: "raw-body@npm:3.0.0" - dependencies: - bytes: 3.1.2 - http-errors: 2.0.0 - iconv-lite: 0.6.3 - unpipe: 1.0.0 - checksum: 25b7cf7964183db322e819050d758a5abd0f22c51e9f37884ea44a9ed6855a1fb61f8caa8ec5b61d07e69f54db43dbbc08ad98ef84556696d6aa806be247af0e - languageName: node - linkType: hard - "raw-loader@npm:^4.0.2": version: 4.0.2 resolution: "raw-loader@npm:4.0.2" @@ -16363,9 +17156,9 @@ __metadata: languageName: node linkType: hard -"react-helmet-async@npm:*, react-helmet-async@npm:^1.3.0": +"react-helmet-async@npm:@slorber/react-helmet-async@*, react-helmet-async@npm:@slorber/react-helmet-async@1.3.0": version: 1.3.0 - resolution: "react-helmet-async@npm:1.3.0" + resolution: "@slorber/react-helmet-async@npm:1.3.0" dependencies: "@babel/runtime": ^7.12.5 invariant: ^2.2.4 @@ -16373,9 +17166,9 @@ __metadata: react-fast-compare: ^3.2.0 shallowequal: ^1.1.0 peerDependencies: - react: ^16.6.0 || ^17.0.0 || ^18.0.0 - react-dom: ^16.6.0 || ^17.0.0 || ^18.0.0 - checksum: 7ca7e47f8af14ea186688b512a87ab912bf6041312b297f92516341b140b3f0f8aedf5a44d226d99e69ed067b0cc106e38aeb9c9b738ffcc63d10721c844db90 + react: ^16.6.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 + react-dom: ^16.6.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 + checksum: 2bd080035aa4145761cc08caa2a64f1d8e867ddda71967936b1325f84c5bc7161ac77c1095818952bc5bb09c78ffbd594e7d0508d54255c5bfbc15e3769ef538 languageName: node linkType: hard @@ -16386,10 +17179,10 @@ __metadata: languageName: node linkType: hard -"react-is@npm:^18.0.0": - version: 18.2.0 - resolution: "react-is@npm:18.2.0" - checksum: e72d0ba81b5922759e4aff17e0252bd29988f9642ed817f56b25a3e217e13eea8a7f2322af99a06edb779da12d5d636e9fda473d620df9a3da0df2a74141d53e +"react-is@npm:^18.3.1": + version: 18.3.1 + resolution: "react-is@npm:18.3.1" + checksum: e20fe84c86ff172fc8d898251b7cc2c43645d108bf96d0b8edf39b98f9a2cae97b40520ee7ed8ee0085ccc94736c4886294456033304151c3f94978cec03df21 languageName: node linkType: hard @@ -16540,13 +17333,6 @@ __metadata: languageName: node linkType: hard -"readdirp@npm:^4.0.1": - version: 4.1.2 - resolution: "readdirp@npm:4.1.2" - checksum: 3242ee125422cb7c0e12d51452e993f507e6ed3d8c490bc8bf3366c5cdd09167562224e429b13e9cb2b98d4b8b2b11dc100d3c73883aa92d657ade5a21ded004 - languageName: node - linkType: hard - "readdirp@npm:~3.6.0": version: 3.6.0 resolution: "readdirp@npm:3.6.0" @@ -16657,15 +17443,17 @@ __metadata: languageName: node linkType: hard -"regexp.prototype.flags@npm:^1.5.3": - version: 1.5.3 - resolution: "regexp.prototype.flags@npm:1.5.3" +"regexp.prototype.flags@npm:^1.5.3, regexp.prototype.flags@npm:^1.5.4": + version: 1.5.4 + resolution: "regexp.prototype.flags@npm:1.5.4" dependencies: - call-bind: ^1.0.7 + call-bind: ^1.0.8 define-properties: ^1.2.1 es-errors: ^1.3.0 + get-proto: ^1.0.1 + gopd: ^1.2.0 set-function-name: ^2.0.2 - checksum: 83ff0705b837f7cb6d664010a11642250f36d3f642263dd0f3bdfe8f150261aa7b26b50ee97f21c1da30ef82a580bb5afedbef5f45639d69edaafbeac9bbb0ed + checksum: 18cb667e56cb328d2dda569d7f04e3ea78f2683135b866d606538cf7b1d4271f7f749f09608c877527799e6cf350e531368f3c7a20ccd1bb41048a48926bdeeb languageName: node linkType: hard @@ -16893,7 +17681,7 @@ __metadata: languageName: node linkType: hard -"resolve-alpn@npm:^1.2.0": +"resolve-alpn@npm:^1.0.0, resolve-alpn@npm:^1.2.0": version: 1.2.1 resolution: "resolve-alpn@npm:1.2.1" checksum: f558071fcb2c60b04054c99aebd572a2af97ef64128d59bef7ab73bd50d896a222a056de40ffc545b633d99b304c259ea9d0c06830d5c867c34f0bfa60b8eae0 @@ -16987,6 +17775,15 @@ __metadata: languageName: node linkType: hard +"responselike@npm:^2.0.0": + version: 2.0.1 + resolution: "responselike@npm:2.0.1" + dependencies: + lowercase-keys: ^2.0.0 + checksum: b122535466e9c97b55e69c7f18e2be0ce3823c5d47ee8de0d9c0b114aa55741c6db8bfbfce3766a94d1272e61bfb1ebf0a15e9310ac5629fbb7446a861b4fd3a + languageName: node + linkType: hard + "responselike@npm:^3.0.0": version: 3.0.0 resolution: "responselike@npm:3.0.0" @@ -17044,19 +17841,18 @@ __metadata: languageName: node linkType: hard -"rimraf@npm:*": - version: 6.0.1 - resolution: "rimraf@npm:6.0.1" +"rimraf@npm:*, rimraf@npm:^5.0.5": + version: 5.0.10 + resolution: "rimraf@npm:5.0.10" dependencies: - glob: ^11.0.0 - package-json-from-dist: ^1.0.0 + glob: ^10.3.7 bin: rimraf: dist/esm/bin.mjs - checksum: 8ba5b84131c1344e9417cb7e8c05d8368bb73cbe5dd4c1d5eb49fc0b558209781658d18c450460e30607d0b7865bb067482839a2f343b186b07ae87715837e66 + checksum: 50e27388dd2b3fa6677385fc1e2966e9157c89c86853b96d02e6915663a96b7ff4d590e14f6f70e90f9b554093aa5dbc05ac3012876be558c06a65437337bc05 languageName: node linkType: hard -"rimraf@npm:^3.0.0, rimraf@npm:^3.0.2": +"rimraf@npm:^3.0.2": version: 3.0.2 resolution: "rimraf@npm:3.0.2" dependencies: @@ -17067,17 +17863,6 @@ __metadata: languageName: node linkType: hard -"rimraf@npm:^5.0.5": - version: 5.0.10 - resolution: "rimraf@npm:5.0.10" - dependencies: - glob: ^10.3.7 - bin: - rimraf: dist/esm/bin.mjs - checksum: 50e27388dd2b3fa6677385fc1e2966e9157c89c86853b96d02e6915663a96b7ff4d590e14f6f70e90f9b554093aa5dbc05ac3012876be558c06a65437337bc05 - languageName: node - linkType: hard - "rollup-plugin-terser@npm:^7.0.0": version: 7.0.2 resolution: "rollup-plugin-terser@npm:7.0.2" @@ -17106,31 +17891,33 @@ __metadata: languageName: node linkType: hard -"rollup@npm:^4.34.9": - version: 4.40.2 - resolution: "rollup@npm:4.40.2" - dependencies: - "@rollup/rollup-android-arm-eabi": 4.40.2 - "@rollup/rollup-android-arm64": 4.40.2 - "@rollup/rollup-darwin-arm64": 4.40.2 - "@rollup/rollup-darwin-x64": 4.40.2 - "@rollup/rollup-freebsd-arm64": 4.40.2 - "@rollup/rollup-freebsd-x64": 4.40.2 - "@rollup/rollup-linux-arm-gnueabihf": 4.40.2 - "@rollup/rollup-linux-arm-musleabihf": 4.40.2 - "@rollup/rollup-linux-arm64-gnu": 4.40.2 - "@rollup/rollup-linux-arm64-musl": 4.40.2 - "@rollup/rollup-linux-loongarch64-gnu": 4.40.2 - "@rollup/rollup-linux-powerpc64le-gnu": 4.40.2 - "@rollup/rollup-linux-riscv64-gnu": 4.40.2 - "@rollup/rollup-linux-riscv64-musl": 4.40.2 - "@rollup/rollup-linux-s390x-gnu": 4.40.2 - "@rollup/rollup-linux-x64-gnu": 4.40.2 - "@rollup/rollup-linux-x64-musl": 4.40.2 - "@rollup/rollup-win32-arm64-msvc": 4.40.2 - "@rollup/rollup-win32-ia32-msvc": 4.40.2 - "@rollup/rollup-win32-x64-msvc": 4.40.2 - "@types/estree": 1.0.7 +"rollup@npm:^4.34.9, rollup@npm:^4.43.0": + version: 4.52.5 + resolution: "rollup@npm:4.52.5" + dependencies: + "@rollup/rollup-android-arm-eabi": 4.52.5 + "@rollup/rollup-android-arm64": 4.52.5 + "@rollup/rollup-darwin-arm64": 4.52.5 + "@rollup/rollup-darwin-x64": 4.52.5 + "@rollup/rollup-freebsd-arm64": 4.52.5 + "@rollup/rollup-freebsd-x64": 4.52.5 + "@rollup/rollup-linux-arm-gnueabihf": 4.52.5 + "@rollup/rollup-linux-arm-musleabihf": 4.52.5 + "@rollup/rollup-linux-arm64-gnu": 4.52.5 + "@rollup/rollup-linux-arm64-musl": 4.52.5 + "@rollup/rollup-linux-loong64-gnu": 4.52.5 + "@rollup/rollup-linux-ppc64-gnu": 4.52.5 + "@rollup/rollup-linux-riscv64-gnu": 4.52.5 + "@rollup/rollup-linux-riscv64-musl": 4.52.5 + "@rollup/rollup-linux-s390x-gnu": 4.52.5 + "@rollup/rollup-linux-x64-gnu": 4.52.5 + "@rollup/rollup-linux-x64-musl": 4.52.5 + "@rollup/rollup-openharmony-arm64": 4.52.5 + "@rollup/rollup-win32-arm64-msvc": 4.52.5 + "@rollup/rollup-win32-ia32-msvc": 4.52.5 + "@rollup/rollup-win32-x64-gnu": 4.52.5 + "@rollup/rollup-win32-x64-msvc": 4.52.5 + "@types/estree": 1.0.8 fsevents: ~2.3.2 dependenciesMeta: "@rollup/rollup-android-arm-eabi": @@ -17153,9 +17940,9 @@ __metadata: optional: true "@rollup/rollup-linux-arm64-musl": optional: true - "@rollup/rollup-linux-loongarch64-gnu": + "@rollup/rollup-linux-loong64-gnu": optional: true - "@rollup/rollup-linux-powerpc64le-gnu": + "@rollup/rollup-linux-ppc64-gnu": optional: true "@rollup/rollup-linux-riscv64-gnu": optional: true @@ -17167,37 +17954,21 @@ __metadata: optional: true "@rollup/rollup-linux-x64-musl": optional: true + "@rollup/rollup-openharmony-arm64": + optional: true "@rollup/rollup-win32-arm64-msvc": optional: true "@rollup/rollup-win32-ia32-msvc": optional: true + "@rollup/rollup-win32-x64-gnu": + optional: true "@rollup/rollup-win32-x64-msvc": optional: true fsevents: optional: true bin: rollup: dist/bin/rollup - checksum: d2bb0428df6d88892348c9c0405df6b38fcb4841b196711cc986ac177d62c8bf983a8f3a61b834a47b016c41152ae7a75239705a929b40cabba0e33fbb09ff03 - languageName: node - linkType: hard - -"router@npm:^2.2.0": - version: 2.2.0 - resolution: "router@npm:2.2.0" - dependencies: - debug: ^4.4.0 - depd: ^2.0.0 - is-promise: ^4.0.0 - parseurl: ^1.3.3 - path-to-regexp: ^8.0.0 - checksum: 4c3bec8011ed10bb07d1ee860bc715f245fff0fdff991d8319741d2932d89c3fe0a56766b4fa78e95444bc323fd2538e09c8e43bfbd442c2a7fab67456df7fa5 - languageName: node - linkType: hard - -"rtl-detect@npm:^1.0.4": - version: 1.0.4 - resolution: "rtl-detect@npm:1.0.4" - checksum: d562535baa0db62f57f0a1d4676297bff72fd6b94e88f0f0900d5c3e810ab512c5c4cadffd3e05fbe8d9c74310c919afa3ea8c1001c244e5555e8eef12d02d6f + checksum: 7d641f8131e5b75c35eb4c11a03aff161183fcb4848c446b660959043aee4ac90c524388290f7ab9ef43e9e33add7d5d57d11135597c7a744df5905e487e198d languageName: node linkType: hard @@ -17258,7 +18029,7 @@ __metadata: languageName: node linkType: hard -"safe-buffer@npm:5.2.1, safe-buffer@npm:>=5.1.0, safe-buffer@npm:^5.1.0, safe-buffer@npm:~5.2.0": +"safe-buffer@npm:5.2.1, safe-buffer@npm:>=5.1.0, safe-buffer@npm:^5.1.0": version: 5.2.1 resolution: "safe-buffer@npm:5.2.1" checksum: b99c4b41fdd67a6aaf280fcd05e9ffb0813654894223afb78a31f14a19ad220bba8aba1cb14eddce1fcfb037155fe6de4e861784eb434f7d11ed58d1e70dd491 @@ -17408,12 +18179,12 @@ __metadata: languageName: node linkType: hard -"semver@npm:^7.0.0, semver@npm:^7.3.2, semver@npm:^7.3.5, semver@npm:^7.3.7, semver@npm:^7.5.3, semver@npm:^7.5.4, semver@npm:^7.6.0, semver@npm:^7.6.3, semver@npm:^7.7.1": - version: 7.7.1 - resolution: "semver@npm:7.7.1" +"semver@npm:^7.0.0, semver@npm:^7.1.2, semver@npm:^7.3.2, semver@npm:^7.3.5, semver@npm:^7.3.7, semver@npm:^7.3.8, semver@npm:^7.5.3, semver@npm:^7.5.4, semver@npm:^7.6.0, semver@npm:^7.6.3, semver@npm:^7.7.1, semver@npm:^7.7.2": + version: 7.7.2 + resolution: "semver@npm:7.7.2" bin: semver: bin/semver.js - checksum: 586b825d36874007c9382d9e1ad8f93888d8670040add24a28e06a910aeebd673a2eb9e3bf169c6679d9245e66efb9057e0852e70d9daa6c27372aab1dda7104 + checksum: dd94ba8f1cbc903d8eeb4dd8bf19f46b3deb14262b6717d0de3c804b594058ae785ef2e4b46c5c3b58733c99c83339068203002f9e37cfe44f7e2cc5e3d2f621 languageName: node linkType: hard @@ -17449,25 +18220,6 @@ __metadata: languageName: node linkType: hard -"send@npm:^1.1.0, send@npm:^1.2.0": - version: 1.2.0 - resolution: "send@npm:1.2.0" - dependencies: - debug: ^4.3.5 - encodeurl: ^2.0.0 - escape-html: ^1.0.3 - etag: ^1.8.1 - fresh: ^2.0.0 - http-errors: ^2.0.0 - mime-types: ^3.0.1 - ms: ^2.1.3 - on-finished: ^2.4.1 - range-parser: ^1.2.1 - statuses: ^2.0.1 - checksum: 7557ee6c1c257a1c53b402b4fba8ed88c95800b08abe085fc79e0824869274f213491be2efb2df3de228c70e4d40ce2019e5f77b58c42adb97149135420c3f34 - languageName: node - linkType: hard - "serialize-javascript@npm:^4.0.0": version: 4.0.0 resolution: "serialize-javascript@npm:4.0.0" @@ -17528,18 +18280,6 @@ __metadata: languageName: node linkType: hard -"serve-static@npm:^2.2.0": - version: 2.2.0 - resolution: "serve-static@npm:2.2.0" - dependencies: - encodeurl: ^2.0.0 - escape-html: ^1.0.3 - parseurl: ^1.3.3 - send: ^1.2.0 - checksum: 74f39e88f0444aa6732aae3b9597739c47552adecdc83fa32aa42555e76f1daad480d791af73894655c27a2d378275a461e691cead33fb35d8b976f1e2d24665 - languageName: node - linkType: hard - "set-blocking@npm:^2.0.0": version: 2.0.0 resolution: "set-blocking@npm:2.0.0" @@ -17573,6 +18313,17 @@ __metadata: languageName: node linkType: hard +"set-proto@npm:^1.0.0": + version: 1.0.0 + resolution: "set-proto@npm:1.0.0" + dependencies: + dunder-proto: ^1.0.1 + es-errors: ^1.3.0 + es-object-atoms: ^1.0.0 + checksum: ec27cbbe334598547e99024403e96da32aca3e530583e4dba7f5db1c43cbc4affa9adfbd77c7b2c210b9b8b2e7b2e600bad2a6c44fd62e804d8233f96bbb62f4 + languageName: node + linkType: hard + "setprototypeof@npm:1.1.0": version: 1.1.0 resolution: "setprototypeof@npm:1.1.0" @@ -17708,19 +18459,6 @@ __metadata: languageName: node linkType: hard -"sinon@npm:^20.0.0": - version: 20.0.0 - resolution: "sinon@npm:20.0.0" - dependencies: - "@sinonjs/commons": ^3.0.1 - "@sinonjs/fake-timers": ^13.0.5 - "@sinonjs/samsam": ^8.0.1 - diff: ^7.0.0 - supports-color: ^7.2.0 - checksum: c6dcd3bc60aa360fede157fbed30c3984eb222990ff28f3014a5e31834cec74e5203c0575332a99c3f7976425167f70e0777507c0c58867473ad0a0c4c1a759c - languageName: node - linkType: hard - "sirv@npm:^2.0.3": version: 2.0.4 resolution: "sirv@npm:2.0.4" @@ -17776,13 +18514,6 @@ __metadata: languageName: node linkType: hard -"slashes@npm:^3.0.12": - version: 3.0.12 - resolution: "slashes@npm:3.0.12" - checksum: 6b68feb5a56d53d76acd4729b0e457f47a0b687877161ca2c05486ec0bc750e0694b37094b2f5f00a339dfe490269292c4197a70da7eba2be47bc56e35f10a60 - languageName: node - linkType: hard - "slice-ansi@npm:^4.0.0": version: 4.0.0 resolution: "slice-ansi@npm:4.0.0" @@ -17821,10 +18552,17 @@ __metadata: languageName: node linkType: hard -"smol-toml@npm:^1.3.1, smol-toml@npm:~1.3.1": - version: 1.3.1 - resolution: "smol-toml@npm:1.3.1" - checksum: dc3284a674065874b1d34a945709ce3da2a0c44b1ff86b3274615d322c2f6cf8e5d2f5f7d569fd92330ec08590777972725e7d3ba856bd6d841243673064994e +"smol-toml@npm:^1.4.1": + version: 1.4.2 + resolution: "smol-toml@npm:1.4.2" + checksum: f12d3fbc2d49396ec523170828a5c9a89bc7740eb7b205f8d8553af18629d936474c1ce55b70c7839aa239a11252e16fd1c3fc955b966b81c9dec00155df4f85 + languageName: node + linkType: hard + +"smol-toml@npm:~1.3.4": + version: 1.3.4 + resolution: "smol-toml@npm:1.3.4" + checksum: ddf333c69b6c848ce6bc89b85096ad8d89cf885cdbf8ca9c5c753df0f5b4a70e3c1984d13e033d68b89a2fff0d984a7f71eb0d3a1c087e934aeda3be71e81d3c languageName: node linkType: hard @@ -17894,7 +18632,7 @@ __metadata: languageName: node linkType: hard -"source-map-support@npm:^0.5.21, source-map-support@npm:~0.5.20": +"source-map-support@npm:~0.5.20": version: 0.5.21 resolution: "source-map-support@npm:0.5.21" dependencies: @@ -18022,7 +18760,7 @@ __metadata: languageName: node linkType: hard -"statuses@npm:2.0.1, statuses@npm:^2.0.1": +"statuses@npm:2.0.1": version: 2.0.1 resolution: "statuses@npm:2.0.1" checksum: 18c7623fdb8f646fb213ca4051be4df7efb3484d4ab662937ca6fbef7ced9b9e12842709872eb3020cc3504b93bde88935c9f6417489627a7786f24f8031cbcb @@ -18043,6 +18781,16 @@ __metadata: languageName: node linkType: hard +"stop-iteration-iterator@npm:^1.1.0": + version: 1.1.0 + resolution: "stop-iteration-iterator@npm:1.1.0" + dependencies: + es-errors: ^1.3.0 + internal-slot: ^1.1.0 + checksum: be944489d8829fb3bdec1a1cc4a2142c6b6eb317305eeace1ece978d286d6997778afa1ae8cb3bd70e2b274b9aa8c69f93febb1e15b94b1359b11058f9d3c3a1 + languageName: node + linkType: hard + "string-argv@npm:^0.3.2, string-argv@npm:~0.3.1": version: 0.3.2 resolution: "string-argv@npm:0.3.2" @@ -18140,7 +18888,7 @@ __metadata: languageName: node linkType: hard -"string.prototype.trimend@npm:^1.0.8, string.prototype.trimend@npm:^1.0.9": +"string.prototype.trimend@npm:^1.0.9": version: 1.0.9 resolution: "string.prototype.trimend@npm:1.0.9" dependencies: @@ -18163,16 +18911,7 @@ __metadata: languageName: node linkType: hard -"string_decoder@npm:^1.1.1": - version: 1.3.0 - resolution: "string_decoder@npm:1.3.0" - dependencies: - safe-buffer: ~5.2.0 - checksum: 8417646695a66e73aefc4420eb3b84cc9ffd89572861fe004e6aeb13c7bc00e2f616247505d2dbbef24247c372f70268f594af7126f43548565c68c117bdeb56 - languageName: node - linkType: hard - -"string_decoder@npm:~1.1.1": +"string_decoder@npm:^1.1.1, string_decoder@npm:~1.1.1": version: 1.1.1 resolution: "string_decoder@npm:1.1.1" dependencies: @@ -18264,10 +19003,10 @@ __metadata: languageName: node linkType: hard -"strip-json-comments@npm:5.0.1": - version: 5.0.1 - resolution: "strip-json-comments@npm:5.0.1" - checksum: b314af70c6666a71133e309a571bdb87687fc878d9fd8b38ebed393a77b89835b92f191aa6b0bc10dfd028ba99eed6b6365985001d64c5aef32a4a82456a156b +"strip-json-comments@npm:5.0.2": + version: 5.0.2 + resolution: "strip-json-comments@npm:5.0.2" + checksum: 986064b73898edc77113cd6147b32f36e299869f3675ed81c3166492a6d8f02d918a492604d1982dab40ca727a86969cb91aa44d6632626f8d7c3c6ead1216bb languageName: node linkType: hard @@ -18285,6 +19024,15 @@ __metadata: languageName: node linkType: hard +"strip-literal@npm:^3.0.0": + version: 3.0.0 + resolution: "strip-literal@npm:3.0.0" + dependencies: + js-tokens: ^9.0.1 + checksum: f697a31c4ad82ad259e0c57e715cde4585084af2260e38b3c916f34f0d462cec2af294a8b8cf062cc6f40d940ece7b79b0ec8316beabb2ed13c6e13e95ca70f0 + languageName: node + linkType: hard + "style-to-object@npm:^0.4.0": version: 0.4.4 resolution: "style-to-object@npm:0.4.4" @@ -18348,37 +19096,37 @@ __metadata: linkType: hard "stylelint@npm:^16.3.1": - version: 16.19.1 - resolution: "stylelint@npm:16.19.1" + version: 16.25.0 + resolution: "stylelint@npm:16.25.0" dependencies: - "@csstools/css-parser-algorithms": ^3.0.4 - "@csstools/css-tokenizer": ^3.0.3 - "@csstools/media-query-list-parser": ^4.0.2 + "@csstools/css-parser-algorithms": ^3.0.5 + "@csstools/css-tokenizer": ^3.0.4 + "@csstools/media-query-list-parser": ^4.0.3 "@csstools/selector-specificity": ^5.0.0 - "@dual-bundle/import-meta-resolve": ^4.1.0 + "@dual-bundle/import-meta-resolve": ^4.2.1 balanced-match: ^2.0.0 colord: ^2.9.3 cosmiconfig: ^9.0.0 css-functions-list: ^3.2.3 css-tree: ^3.1.0 - debug: ^4.3.7 + debug: ^4.4.3 fast-glob: ^3.3.3 fastest-levenshtein: ^1.0.16 - file-entry-cache: ^10.0.8 + file-entry-cache: ^10.1.4 global-modules: ^2.0.0 globby: ^11.1.0 globjoin: ^0.1.4 html-tags: ^3.3.1 - ignore: ^7.0.3 + ignore: ^7.0.5 imurmurhash: ^0.1.4 is-plain-object: ^5.0.0 - known-css-properties: ^0.36.0 + known-css-properties: ^0.37.0 mathml-tag-names: ^2.1.3 meow: ^13.2.0 micromatch: ^4.0.8 normalize-path: ^3.0.0 picocolors: ^1.1.1 - postcss: ^8.5.3 + postcss: ^8.5.6 postcss-resolve-nested-selector: ^0.1.6 postcss-safe-parser: ^7.0.1 postcss-selector-parser: ^7.1.0 @@ -18391,11 +19139,11 @@ __metadata: write-file-atomic: ^5.0.1 bin: stylelint: bin/stylelint.mjs - checksum: 5bb188187053592a481c19a4420d01cb50e78a6e68edac639a0316be1cf365df28826968345e10aaf1ec1c3ed672b91c749ca10b6e71d05ff5d181db188e50c6 + checksum: 0b36fead063f8903522afd04a350b021670348a0218f580aa895100cc59634179742ff844037d482bbeaff234f3411fc331f2ce59419c807c341ea3e0355d1cc languageName: node linkType: hard -"supports-color@npm:^7.0.0, supports-color@npm:^7.1.0, supports-color@npm:^7.2.0": +"supports-color@npm:^7.0.0, supports-color@npm:^7.1.0": version: 7.2.0 resolution: "supports-color@npm:7.2.0" dependencies: @@ -18404,7 +19152,7 @@ __metadata: languageName: node linkType: hard -"supports-color@npm:^8.0.0, supports-color@npm:^8.1.1, supports-color@npm:~8.1.1": +"supports-color@npm:^8.0.0, supports-color@npm:~8.1.1": version: 8.1.1 resolution: "supports-color@npm:8.1.1" dependencies: @@ -18461,16 +19209,6 @@ __metadata: languageName: node linkType: hard -"synckit@npm:^0.9.1": - version: 0.9.2 - resolution: "synckit@npm:0.9.2" - dependencies: - "@pkgr/core": ^0.1.0 - tslib: ^2.6.2 - checksum: 3a30e828efbdcf3b50fccab4da6e90ea7ca24d8c5c2ad3ffe98e07d7c492df121e0f75227c6e510f96f976aae76f1fa4710cb7b1d69db881caf66ef9de89360e - languageName: node - linkType: hard - "table@npm:^6.9.0": version: 6.9.0 resolution: "table@npm:6.9.0" @@ -18491,10 +19229,10 @@ __metadata: languageName: node linkType: hard -"tapable@npm:^2.0.0, tapable@npm:^2.1.1, tapable@npm:^2.2.0, tapable@npm:^2.2.1": - version: 2.2.1 - resolution: "tapable@npm:2.2.1" - checksum: 3b7a1b4d86fa940aad46d9e73d1e8739335efd4c48322cb37d073eb6f80f5281889bf0320c6d8ffcfa1a0dd5bfdbd0f9d037e252ef972aca595330538aac4d51 +"tapable@npm:^2.0.0, tapable@npm:^2.2.0, tapable@npm:^2.2.1, tapable@npm:^2.2.3": + version: 2.3.0 + resolution: "tapable@npm:2.3.0" + checksum: ada1194219ad550e3626d15019d87a2b8e77521d8463ab1135f46356e987a4c37eff1e87ffdd5acd573590962e519cc81e8ea6f7ed632c66bb58c0f12bd772a4 languageName: node linkType: hard @@ -18511,17 +19249,17 @@ __metadata: languageName: node linkType: hard -"tar@npm:^6.1.11, tar@npm:^6.1.2": - version: 6.1.11 - resolution: "tar@npm:6.1.11" +"tar@npm:^6.0.5, tar@npm:^6.1.11, tar@npm:^6.1.2": + version: 6.2.1 + resolution: "tar@npm:6.2.1" dependencies: chownr: ^2.0.0 fs-minipass: ^2.0.0 - minipass: ^3.0.0 + minipass: ^5.0.0 minizlib: ^2.1.1 mkdirp: ^1.0.3 yallist: ^4.0.0 - checksum: a04c07bb9e2d8f46776517d4618f2406fb977a74d914ad98b264fc3db0fe8224da5bec11e5f8902c5b9bcb8ace22d95fbe3c7b36b8593b7dfc8391a25898f32f + checksum: f1322768c9741a25356c11373bce918483f40fa9a25c69c59410c8a1247632487edef5fe76c5f12ac51a6356d2f1829e96d2bc34098668a2fc34d76050ac2b6c languageName: node linkType: hard @@ -18633,20 +19371,27 @@ __metadata: languageName: node linkType: hard -"tinyglobby@npm:^0.2.12, tinyglobby@npm:^0.2.13": - version: 0.2.13 - resolution: "tinyglobby@npm:0.2.13" +"tinyglobby@npm:^0.2.12, tinyglobby@npm:^0.2.13, tinyglobby@npm:^0.2.14, tinyglobby@npm:^0.2.15": + version: 0.2.15 + resolution: "tinyglobby@npm:0.2.15" dependencies: - fdir: ^6.4.4 - picomatch: ^4.0.2 - checksum: 3a2e87a2518cb3616057b0aa58be4f17771ae78c6890556516ae1e631f8ce4cfee1ba1dcb62fcc54a64e2bdd6c3104f4f3d021e1a3e3f8fb0875bca380b913e5 + fdir: ^6.5.0 + picomatch: ^4.0.3 + checksum: 0e33b8babff966c6ab86e9b825a350a6a98a63700fa0bb7ae6cf36a7770a508892383adc272f7f9d17aaf46a9d622b455e775b9949a3f951eaaf5dfb26331d44 languageName: node linkType: hard -"tinypool@npm:^1.0.2": - version: 1.0.2 - resolution: "tinypool@npm:1.0.2" - checksum: 752f23114d8fc95a9497fc812231d6d0a63728376aa11e6e8499c10423a91112e760e388887ea7854f1b16977c321f07c0eab061ec2f60f6761e58b184aac880 +"tinylogic@npm:^2.0.0": + version: 2.0.0 + resolution: "tinylogic@npm:2.0.0" + checksum: b966cbb41241a048095fb9e685d5e2020475fdea2c65b4ae51e5dee48964860a4505d987503c004b8a76e96b64c7da2f49954dd36c691d559c315d878ce7da29 + languageName: node + linkType: hard + +"tinypool@npm:^1.1.1": + version: 1.1.1 + resolution: "tinypool@npm:1.1.1" + checksum: 0258abe108df8be395a2cbdc8b4390c94908850250530f7bea83a129fa33d49a8c93246f76bf81cd458534abd81322f4d4cb3a40690254f8d9044ff449f328a8 languageName: node linkType: hard @@ -18657,10 +19402,10 @@ __metadata: languageName: node linkType: hard -"tinyspy@npm:^3.0.2": - version: 3.0.2 - resolution: "tinyspy@npm:3.0.2" - checksum: 5db671b2ff5cd309de650c8c4761ca945459d7204afb1776db9a04fb4efa28a75f08517a8620c01ee32a577748802231ad92f7d5b194dc003ee7f987a2a06337 +"tinyspy@npm:^4.0.3": + version: 4.0.3 + resolution: "tinyspy@npm:4.0.3" + checksum: cd5e52d09e2a67946d3a96e6cd68377e1281eb6aaddc9d38129bcec8971a55337ab438ac672857b983f5c620a9f978e784679054322155329d483d00d9291ba9 languageName: node linkType: hard @@ -18671,12 +19416,10 @@ __metadata: languageName: node linkType: hard -"tmp@npm:0.2.1": - version: 0.2.1 - resolution: "tmp@npm:0.2.1" - dependencies: - rimraf: ^3.0.0 - checksum: 8b1214654182575124498c87ca986ac53dc76ff36e8f0e0b67139a8d221eaecfdec108c0e6ec54d76f49f1f72ab9325500b246f562b926f85bcdfca8bf35df9e +"tmp@npm:~0.2.1": + version: 0.2.3 + resolution: "tmp@npm:0.2.3" + checksum: 73b5c96b6e52da7e104d9d44afb5d106bb1e16d9fa7d00dbeb9e6522e61b571fbdb165c756c62164be9a3bbe192b9b268c236d370a2a0955c7689cd2ae377b95 languageName: node linkType: hard @@ -18719,6 +19462,22 @@ __metadata: languageName: node linkType: hard +"tree-kill@npm:^1.2.2": + version: 1.2.2 + resolution: "tree-kill@npm:1.2.2" + bin: + tree-kill: cli.js + checksum: 49117f5f410d19c84b0464d29afb9642c863bc5ba40fcb9a245d474c6d5cc64d1b177a6e6713129eb346b40aebb9d4631d967517f9fbe8251c35b21b13cd96c7 + languageName: node + linkType: hard + +"treeify@npm:^1.1.0": + version: 1.1.0 + resolution: "treeify@npm:1.1.0" + checksum: aa00dded220c1dd052573bd6fc2c52862f09870851a284f0d3650d72bf913ba9b4f6b824f4f1ab81899bae29375f4266b07fe47cbf82343a1efa13cc09ce87af + languageName: node + linkType: hard + "trim-lines@npm:^3.0.0": version: 3.0.1 resolution: "trim-lines@npm:3.0.1" @@ -18765,7 +19524,7 @@ __metadata: languageName: node linkType: hard -"tslib@npm:^2.0.3, tslib@npm:^2.3.0, tslib@npm:^2.4.0, tslib@npm:^2.6.0, tslib@npm:^2.6.2, tslib@npm:^2.8.0": +"tslib@npm:^2.0.3, tslib@npm:^2.3.0, tslib@npm:^2.4.0, tslib@npm:^2.4.1, tslib@npm:^2.6.0": version: 2.8.1 resolution: "tslib@npm:2.8.1" checksum: e4aba30e632b8c8902b47587fd13345e2827fa639e7c3121074d5ee0880723282411a8838f830b55100cbe4517672f84a2472667d355b81e8af165a55dc6203a @@ -18788,10 +19547,10 @@ __metadata: languageName: node linkType: hard -"tunnel@npm:^0.0.6": - version: 0.0.6 - resolution: "tunnel@npm:0.0.6" - checksum: c362948df9ad34b649b5585e54ce2838fa583aa3037091aaed66793c65b423a264e5229f0d7e9a95513a795ac2bd4cb72cda7e89a74313f182c1e9ae0b0994fa +"typanion@npm:^3.8.0": + version: 3.14.0 + resolution: "typanion@npm:3.14.0" + checksum: fc0590d02c13c659eb1689e8adf7777e6c00dc911377e44cd36fe1b1271cfaca71547149f12cdc275058c0de5562a14e5273adbae66d47e6e0320e36007f5912 languageName: node linkType: hard @@ -18804,20 +19563,6 @@ __metadata: languageName: node linkType: hard -"type-detect@npm:4.0.8": - version: 4.0.8 - resolution: "type-detect@npm:4.0.8" - checksum: 62b5628bff67c0eb0b66afa371bd73e230399a8d2ad30d852716efcc4656a7516904570cd8631a49a3ce57c10225adf5d0cbdcb47f6b0255fe6557c453925a15 - languageName: node - linkType: hard - -"type-detect@npm:^4.1.0": - version: 4.1.0 - resolution: "type-detect@npm:4.1.0" - checksum: 3b32f873cd02bc7001b00a61502b7ddc4b49278aabe68d652f732e1b5d768c072de0bc734b427abf59d0520a5f19a2e07309ab921ef02018fa1cb4af155cdb37 - languageName: node - linkType: hard - "type-fest@npm:^0.16.0": version: 0.16.0 resolution: "type-fest@npm:0.16.0" @@ -18846,17 +19591,6 @@ __metadata: languageName: node linkType: hard -"type-is@npm:^2.0.0, type-is@npm:^2.0.1": - version: 2.0.1 - resolution: "type-is@npm:2.0.1" - dependencies: - content-type: ^1.0.5 - media-typer: ^1.1.0 - mime-types: ^3.0.0 - checksum: 0266e7c782238128292e8c45e60037174d48c6366bb2d45e6bd6422b611c193f83409a8341518b6b5f33f8e4d5a959f38658cacfea77f0a3505b9f7ac1ddec8f - languageName: node - linkType: hard - "type-is@npm:~1.6.18": version: 1.6.18 resolution: "type-is@npm:1.6.18" @@ -18939,11 +19673,11 @@ __metadata: linkType: hard "typedoc-plugin-markdown@npm:^4.6.3": - version: 4.6.3 - resolution: "typedoc-plugin-markdown@npm:4.6.3" + version: 4.9.0 + resolution: "typedoc-plugin-markdown@npm:4.9.0" peerDependencies: typedoc: 0.28.x - checksum: 0305611bb36fbecebd612cb256478acda57059942e856c8e0cb671ad406fa63fb2b8bfd16956b3f41d24b7d2d0b5f57605120070879f8a6b2f45d8fd61608b8a + checksum: cabdbf299e7f4c3db14878cfd630b2447bdee97dd668916028b4d8f5cb2049126178e747acd47a476806ebde35a112dec6c7b678198ad222087fc8410b2c0d1c languageName: node linkType: hard @@ -18968,37 +19702,38 @@ __metadata: version: 0.0.0-use.local resolution: "typescript-eslint@workspace:packages/typescript-eslint" dependencies: - "@typescript-eslint/eslint-plugin": 8.32.1 - "@typescript-eslint/parser": 8.32.1 - "@typescript-eslint/utils": 8.32.1 + "@typescript-eslint/eslint-plugin": 8.46.4 + "@typescript-eslint/parser": 8.46.4 + "@typescript-eslint/typescript-estree": 8.46.4 + "@typescript-eslint/utils": 8.46.4 "@vitest/coverage-v8": ^3.1.3 - prettier: ^3.2.5 + eslint: "*" rimraf: "*" typescript: "*" vitest: ^3.1.3 peerDependencies: eslint: ^8.57.0 || ^9.0.0 - typescript: ">=4.8.4 <5.9.0" + typescript: ">=4.8.4 <6.0.0" languageName: unknown linkType: soft -"typescript@npm:5.8.2": - version: 5.8.2 - resolution: "typescript@npm:5.8.2" +"typescript@npm:5.9.2": + version: 5.9.2 + resolution: "typescript@npm:5.9.2" bin: tsc: bin/tsc tsserver: bin/tsserver - checksum: 7f9e3d7ac15da6df713e439e785e51facd65d6450d5f51fab3e8d2f2e3f4eb317080d895480b8e305450cdbcb37e17383e8bf521e7395f8b556e2f2a4730ed86 + checksum: f619cf6773cfe31409279711afd68cdf0859780006c50bc2a7a0c3227f85dea89a3b97248846326f3a17dad72ea90ec27cf61a8387772c680b2252fd02d8497b languageName: node linkType: hard -"typescript@patch:typescript@npm%3A5.8.2#~builtin": - version: 5.8.2 - resolution: "typescript@patch:typescript@npm%3A5.8.2#~builtin::version=5.8.2&hash=b45daf" +"typescript@patch:typescript@npm%3A5.9.2#~builtin": + version: 5.9.2 + resolution: "typescript@patch:typescript@npm%3A5.9.2#~builtin::version=5.9.2&hash=b45daf" bin: tsc: bin/tsc tsserver: bin/tsserver - checksum: a58d19ff9811c1764a299dd83ca20ed8020f0ab642906dafc880121b710751227201531fdc99878158205c356ac79679b0b61ac5b42eda0e28bfb180947a258d + checksum: e42a701947325500008334622321a6ad073f842f5e7d5e7b588a6346b31fdf51d56082b9ce5cef24312ecd3e48d6c0d4d44da7555f65e2feec18cf62ec540385 languageName: node linkType: hard @@ -19028,15 +19763,6 @@ __metadata: languageName: node linkType: hard -"undici@npm:^5.25.4": - version: 5.26.4 - resolution: "undici@npm:5.26.4" - dependencies: - "@fastify/busboy": ^2.0.0 - checksum: 4d37f14ce56837d332ab1623be751f2a5b439069705671cc60b441133300b05bcb8803668132e7b3f98800db19cd6cb76b48831facbdbc2d73271b12383ab3cd - languageName: node - linkType: hard - "unicode-canonical-property-names-ecmascript@npm:^2.0.0": version: 2.0.0 resolution: "unicode-canonical-property-names-ecmascript@npm:2.0.0" @@ -19193,13 +19919,6 @@ __metadata: languageName: node linkType: hard -"universal-user-agent@npm:^6.0.0": - version: 6.0.0 - resolution: "universal-user-agent@npm:6.0.0" - checksum: 5092bbc80dd0d583cef0b62c17df0043193b74f425112ea6c1f69bc5eda21eeec7a08d8c4f793a277eb2202ffe9b44bec852fa3faff971234cd209874d1b79ef - languageName: node - linkType: hard - "universalify@npm:^2.0.0": version: 2.0.0 resolution: "universalify@npm:2.0.0" @@ -19336,7 +20055,7 @@ __metadata: languageName: node linkType: hard -"vary@npm:^1, vary@npm:^1.1.2, vary@npm:~1.1.2": +"vary@npm:~1.1.2": version: 1.1.2 resolution: "vary@npm:1.1.2" checksum: ae0123222c6df65b437669d63dfa8c36cee20a504101b2fcd97b8bf76f91259c17f9f2b4d70a1e3c6bbcee7f51b28392833adb6b2770b23b01abec84e369660b @@ -19374,24 +20093,79 @@ __metadata: languageName: node linkType: hard -"vite-node@npm:3.1.3": - version: 3.1.3 - resolution: "vite-node@npm:3.1.3" +"vite-node@npm:3.2.4": + version: 3.2.4 + resolution: "vite-node@npm:3.2.4" dependencies: cac: ^6.7.14 - debug: ^4.4.0 + debug: ^4.4.1 es-module-lexer: ^1.7.0 pathe: ^2.0.3 - vite: ^5.0.0 || ^6.0.0 + vite: ^5.0.0 || ^6.0.0 || ^7.0.0-0 bin: vite-node: vite-node.mjs - checksum: 69975ebd3acce54b0c708818f2a11cb5c4375888d4aab834253c89d0a19438528ccc8abe983ee73af19a69bf8d4a64ed475dca9cec717319c03191ac139c4bca + checksum: 2051394d48f5eefdee4afc9c5fd5dcbf7eb36d345043ba035c7782e10b33fbbd14318062c4e32e00d473a31a559fb628d67c023e82a4903016db3ac6bfdb3fe7 + languageName: node + linkType: hard + +"vite@npm:^5.0.0 || ^6.0.0 || ^7.0.0-0": + version: 7.1.12 + resolution: "vite@npm:7.1.12" + dependencies: + esbuild: ^0.25.0 + fdir: ^6.5.0 + fsevents: ~2.3.3 + picomatch: ^4.0.3 + postcss: ^8.5.6 + rollup: ^4.43.0 + tinyglobby: ^0.2.15 + peerDependencies: + "@types/node": ^20.19.0 || >=22.12.0 + jiti: ">=1.21.0" + less: ^4.0.0 + lightningcss: ^1.21.0 + sass: ^1.70.0 + sass-embedded: ^1.70.0 + stylus: ">=0.54.8" + sugarss: ^5.0.0 + terser: ^5.16.0 + tsx: ^4.8.1 + yaml: ^2.4.2 + dependenciesMeta: + fsevents: + optional: true + peerDependenciesMeta: + "@types/node": + optional: true + jiti: + optional: true + less: + optional: true + lightningcss: + optional: true + sass: + optional: true + sass-embedded: + optional: true + stylus: + optional: true + sugarss: + optional: true + terser: + optional: true + tsx: + optional: true + yaml: + optional: true + bin: + vite: bin/vite.js + checksum: 4be31af222b94aeaf627443b37e13239ca81bedcf29fb952580272098b966314a5136edf65fbd5b66bbcc84cc1c48403fcadb79d858da4bad455fc9a0da263b7 languageName: node linkType: hard -"vite@npm:^5.0.0 || ^6.0.0, vite@npm:^6.3.5": - version: 6.3.5 - resolution: "vite@npm:6.3.5" +"vite@npm:^6.3.5": + version: 6.4.1 + resolution: "vite@npm:6.4.1" dependencies: esbuild: ^0.25.0 fdir: ^6.4.4 @@ -19440,41 +20214,43 @@ __metadata: optional: true bin: vite: bin/vite.js - checksum: b7f1ebaae483090441f17ca09ea2c9b803688d2a2ed9860fbd8b72271918776ea3ceca643e807a5ee00628d65b79656d32529a4b8dd388aa33e41bc3f38732d0 + checksum: 7a939dbd6569ba829a7c21a18f8eca395a3a13cb93ce0fec02e8aa462e127a8daac81d00f684086648d905786056bba1ad931f51d88f06835d3b972bc9fbddda languageName: node linkType: hard "vitest@npm:^3.1.3": - version: 3.1.3 - resolution: "vitest@npm:3.1.3" - dependencies: - "@vitest/expect": 3.1.3 - "@vitest/mocker": 3.1.3 - "@vitest/pretty-format": ^3.1.3 - "@vitest/runner": 3.1.3 - "@vitest/snapshot": 3.1.3 - "@vitest/spy": 3.1.3 - "@vitest/utils": 3.1.3 + version: 3.2.4 + resolution: "vitest@npm:3.2.4" + dependencies: + "@types/chai": ^5.2.2 + "@vitest/expect": 3.2.4 + "@vitest/mocker": 3.2.4 + "@vitest/pretty-format": ^3.2.4 + "@vitest/runner": 3.2.4 + "@vitest/snapshot": 3.2.4 + "@vitest/spy": 3.2.4 + "@vitest/utils": 3.2.4 chai: ^5.2.0 - debug: ^4.4.0 + debug: ^4.4.1 expect-type: ^1.2.1 magic-string: ^0.30.17 pathe: ^2.0.3 + picomatch: ^4.0.2 std-env: ^3.9.0 tinybench: ^2.9.0 tinyexec: ^0.3.2 - tinyglobby: ^0.2.13 - tinypool: ^1.0.2 + tinyglobby: ^0.2.14 + tinypool: ^1.1.1 tinyrainbow: ^2.0.0 - vite: ^5.0.0 || ^6.0.0 - vite-node: 3.1.3 + vite: ^5.0.0 || ^6.0.0 || ^7.0.0-0 + vite-node: 3.2.4 why-is-node-running: ^2.3.0 peerDependencies: "@edge-runtime/vm": "*" "@types/debug": ^4.1.12 "@types/node": ^18.0.0 || ^20.0.0 || >=22.0.0 - "@vitest/browser": 3.1.3 - "@vitest/ui": 3.1.3 + "@vitest/browser": 3.2.4 + "@vitest/ui": 3.2.4 happy-dom: "*" jsdom: "*" peerDependenciesMeta: @@ -19494,7 +20270,7 @@ __metadata: optional: true bin: vitest: vitest.mjs - checksum: 4ebcc8bc3c8e23a894632a70851aa3e21646bce8aca4b406d3a5e0fb2aef84fb42c85eea951f9c1bf8b1415e1b3131c4d96ab26d4c1b5df64df9055024c1344d + checksum: e9aa14a2c4471c2e0364d1d7032303db8754fac9e5e9ada92fca8ebf61ee78d2c5d4386bff25913940a22ea7d78ab435c8dd85785d681b23e2c489d6c17dd382 languageName: node linkType: hard @@ -19512,13 +20288,20 @@ __metadata: languageName: node linkType: hard -"watchpack@npm:^2.4.1": - version: 2.4.1 - resolution: "watchpack@npm:2.4.1" +"walk-up-path@npm:^4.0.0": + version: 4.0.0 + resolution: "walk-up-path@npm:4.0.0" + checksum: 6a230b20e5de296895116dc12b09dafaec1f72b8060c089533d296e241aff059dfaebe0d015c77467f857e4b40c78e08f7481add76f340233a1f34fa8af9ed63 + languageName: node + linkType: hard + +"watchpack@npm:^2.4.4": + version: 2.4.4 + resolution: "watchpack@npm:2.4.4" dependencies: glob-to-regexp: ^0.4.1 graceful-fs: ^4.1.2 - checksum: 5b0179348655dcdf19cac7cb4ff923fdc024d630650c0bf6bec8899cf47c60e19d4f810a88dba692ed0e7f684cf0fcffea86efdbf6c35d81f031e328043b7fab + checksum: 469514a04bcdd7ea77d4b3c62d1f087eafbce64cbc728c89355d5710ee01311533456122da7c585d3654d5bfcf09e6085db1a6eb274c4762a18e370526d17561 languageName: node linkType: hard @@ -19667,27 +20450,28 @@ __metadata: languageName: node linkType: hard -"webpack-sources@npm:^3.2.3": - version: 3.2.3 - resolution: "webpack-sources@npm:3.2.3" - checksum: 989e401b9fe3536529e2a99dac8c1bdc50e3a0a2c8669cbafad31271eadd994bc9405f88a3039cd2e29db5e6d9d0926ceb7a1a4e7409ece021fe79c37d9c4607 +"webpack-sources@npm:^3.3.3": + version: 3.3.3 + resolution: "webpack-sources@npm:3.3.3" + checksum: 243d438ec4dfe805cca20fa66d111114b1f277b8ecfa95bb6ee0a6c7d996aee682539952028c2b203a6c170e6ef56f71ecf3e366e90bf1cb58b0ae982176b651 languageName: node linkType: hard "webpack@npm:^5.88.1, webpack@npm:^5.91.0, webpack@npm:^5.95.0": - version: 5.99.7 - resolution: "webpack@npm:5.99.7" + version: 5.102.0 + resolution: "webpack@npm:5.102.0" dependencies: "@types/eslint-scope": ^3.7.7 - "@types/estree": ^1.0.6 + "@types/estree": ^1.0.8 "@types/json-schema": ^7.0.15 "@webassemblyjs/ast": ^1.14.1 "@webassemblyjs/wasm-edit": ^1.14.1 "@webassemblyjs/wasm-parser": ^1.14.1 - acorn: ^8.14.0 - browserslist: ^4.24.0 + acorn: ^8.15.0 + acorn-import-phases: ^1.0.3 + browserslist: ^4.24.5 chrome-trace-event: ^1.0.2 - enhanced-resolve: ^5.17.1 + enhanced-resolve: ^5.17.3 es-module-lexer: ^1.2.1 eslint-scope: 5.1.1 events: ^3.2.0 @@ -19698,16 +20482,16 @@ __metadata: mime-types: ^2.1.27 neo-async: ^2.6.2 schema-utils: ^4.3.2 - tapable: ^2.1.1 + tapable: ^2.2.3 terser-webpack-plugin: ^5.3.11 - watchpack: ^2.4.1 - webpack-sources: ^3.2.3 + watchpack: ^2.4.4 + webpack-sources: ^3.3.3 peerDependenciesMeta: webpack-cli: optional: true bin: webpack: bin/webpack.js - checksum: 691b0a57c5a4e9dc1bf99188c4b68a4ff3cf10c23ea8e726e6bf36643f40ecb0fb7a4d7a92f01b187184b8c9f3bc27ee0efc6973cf46ef3913ee6ee8fe806521 + checksum: 0df990632239a9127c36acf219f208e9f534fd53b4a4534ab4dbd6904cfbac10e44c73d5d04fd0617f0fe2150fc222f2839d7558b68c3a617855c8b71b8254cb languageName: node linkType: hard @@ -19734,13 +20518,13 @@ __metadata: resolution: "website@workspace:packages/website" dependencies: "@babel/runtime": ^7.24.4 - "@docusaurus/core": ^3.2.1 - "@docusaurus/module-type-aliases": ^3.2.1 - "@docusaurus/plugin-client-redirects": ^3.2.1 - "@docusaurus/plugin-pwa": ^3.2.1 - "@docusaurus/preset-classic": ^3.2.1 - "@docusaurus/remark-plugin-npm2yarn": ^3.2.1 - "@docusaurus/theme-common": ^3.2.1 + "@docusaurus/core": ~3.7.0 + "@docusaurus/module-type-aliases": ~3.7.0 + "@docusaurus/plugin-client-redirects": ~3.7.0 + "@docusaurus/plugin-pwa": ~3.7.0 + "@docusaurus/preset-classic": ~3.7.0 + "@docusaurus/remark-plugin-npm2yarn": ~3.7.0 + "@docusaurus/theme-common": ~3.7.0 "@types/mdast": ^4.0.3 "@types/react": "*" "@types/unist": ^3.0.2 @@ -19758,6 +20542,7 @@ __metadata: cross-fetch: "*" docusaurus-plugin-typedoc: ^1.4.0 eslint: ^9.15.0 + gray-matter: ^4.0.3 history: ^4.9.0 json5: ^2.2.3 konamimojisplosion: ^0.5.2 @@ -19765,14 +20550,15 @@ __metadata: make-dir: "*" mdast-util-from-markdown: ^2.0.1 mdast-util-mdx: ^3.0.0 - monaco-editor: ~0.52.0 - prettier: ^3.2.5 + monaco-editor: ~0.54.0 + prettier: 3.6.2 prism-react-renderer: ^2.3.1 raw-loader: ^4.0.2 react: ^18.2.0 react-dom: ^18.2.0 react-markdown: ^10.0.0 react-resizable-panels: ^3.0.0 + reading-time: ^1.5.0 rimraf: "*" semver: ^7.6.0 stylelint: ^16.3.1 @@ -19786,6 +20572,7 @@ __metadata: unified: ^11.0.4 vfile: ^6.0.1 webpack: ^5.91.0 + zod: ^3.25.67 languageName: unknown linkType: soft @@ -19874,17 +20661,18 @@ __metadata: languageName: node linkType: hard -"which-typed-array@npm:^1.1.16, which-typed-array@npm:^1.1.18": - version: 1.1.18 - resolution: "which-typed-array@npm:1.1.18" +"which-typed-array@npm:^1.1.16, which-typed-array@npm:^1.1.19": + version: 1.1.19 + resolution: "which-typed-array@npm:1.1.19" dependencies: available-typed-arrays: ^1.0.7 call-bind: ^1.0.8 - call-bound: ^1.0.3 - for-each: ^0.3.3 + call-bound: ^1.0.4 + for-each: ^0.3.5 + get-proto: ^1.0.1 gopd: ^1.2.0 has-tostringtag: ^1.0.2 - checksum: d2feea7f51af66b3a240397aa41c796585033e1069f18e5b6d4cd3878538a1e7780596fd3ea9bf347c43d9e98e13be09b37d9ea3887cef29b11bc291fd47bb52 + checksum: 162d2a07f68ea323f88ed9419861487ce5d02cb876f2cf9dd1e428d04a63133f93a54f89308f337b27cabd312ee3d027cae4a79002b2f0a85b79b9ef4c190670 languageName: node linkType: hard @@ -20137,13 +20925,6 @@ __metadata: languageName: node linkType: hard -"workerpool@npm:^6.5.1": - version: 6.5.1 - resolution: "workerpool@npm:6.5.1" - checksum: f86d13f9139c3a57c5a5867e81905cd84134b499849405dec2ffe5b1acd30dabaa1809f6f6ee603a7c65e1e4325f21509db6b8398eaf202c8b8f5809e26a2e16 - languageName: node - linkType: hard - "wrap-ansi-cjs@npm:wrap-ansi@^7.0.0, wrap-ansi@npm:^7.0.0": version: 7.0.0 resolution: "wrap-ansi@npm:7.0.0" @@ -20282,12 +21063,12 @@ __metadata: languageName: node linkType: hard -"yaml@npm:^2.6.0, yaml@npm:^2.7.0, yaml@npm:^2.7.1": - version: 2.7.1 - resolution: "yaml@npm:2.7.1" +"yaml@npm:^2.6.0, yaml@npm:^2.7.0, yaml@npm:^2.7.1, yaml@npm:^2.8.0": + version: 2.8.1 + resolution: "yaml@npm:2.8.1" bin: yaml: bin.mjs - checksum: 385f8115ddfafdf8e599813cca8b2bf4e3f6a01b919fff5ae7da277e164df684d7dfe558b4085172094792b5a04786d3c55fa8b74abb0ee029873f031150bb80 + checksum: 35b46150d48bc1da2fd5b1521a48a4fa36d68deaabe496f3c3fa9646d5796b6b974f3930a02c4b5aee6c85c860d7d7f79009416724465e835f40b87898c36de4 languageName: node linkType: hard @@ -20298,19 +21079,7 @@ __metadata: languageName: node linkType: hard -"yargs-unparser@npm:^2.0.0": - version: 2.0.0 - resolution: "yargs-unparser@npm:2.0.0" - dependencies: - camelcase: ^6.0.0 - decamelize: ^4.0.0 - flat: ^5.0.2 - is-plain-obj: ^2.1.0 - checksum: 68f9a542c6927c3768c2f16c28f71b19008710abd6b8f8efbac6dcce26bbb68ab6503bed1d5994bdbc2df9a5c87c161110c1dfe04c6a3fe5c6ad1b0e15d9a8a3 - languageName: node - linkType: hard - -"yargs@npm:17.7.2, yargs@npm:^17.6.2, yargs@npm:^17.7.2": +"yargs@npm:17.7.2, yargs@npm:^17.6.2": version: 17.7.2 resolution: "yargs@npm:17.7.2" dependencies: @@ -20325,6 +21094,21 @@ __metadata: languageName: node linkType: hard +"yarn-berry-deduplicate@npm:^6.1.3": + version: 6.1.3 + resolution: "yarn-berry-deduplicate@npm:6.1.3" + dependencies: + "@yarnpkg/core": ^4.4.1 + "@yarnpkg/parsers": ^3.0.3 + commander: ^9.4.1 + semver: ^7.3.8 + tslib: ^2.4.1 + bin: + yarn-berry-deduplicate: dist/cli.js + checksum: 8f5afa2d51c38629ca01b5c650fdf5bbc43caa8035d4e74cacd607e47596afa0baab1b787c7111997e37ff12991097502ee4371d61f0a4aa94c21b88e53c812f + languageName: node + linkType: hard + "yocto-queue@npm:^0.1.0": version: 0.1.0 resolution: "yocto-queue@npm:0.1.0" @@ -20339,28 +21123,17 @@ __metadata: languageName: node linkType: hard -"zod-to-json-schema@npm:^3.24.1": - version: 3.24.5 - resolution: "zod-to-json-schema@npm:3.24.5" - peerDependencies: - zod: ^3.24.1 - checksum: dc4e5e4c06e9a5494e4b1d8c8363ac907f9d488f36c8e4923e1e5ac4f91f737722f99200cd92a409551e7456d960734d4cabd37935234ca95e290572468ffc08 - languageName: node - linkType: hard - -"zod-validation-error@npm:^3.0.3": - version: 3.2.0 - resolution: "zod-validation-error@npm:3.2.0" - peerDependencies: - zod: ^3.18.0 - checksum: 4d541566ff4bd54cc7c1c547ee69e50a11ff14c48d378f7c600146513e250067f8a9bac0170285d346d00095685cbc29a4cd84f9c6371bb4fd3ed29d0fb98be3 +"zod@npm:^3.25.67": + version: 3.25.67 + resolution: "zod@npm:3.25.67" + checksum: 56ab904d33b1cd00041ce64ae05b0628fcbfeb7e707fa31cd498a97b540135e4dfe685200c9c62aea307695ee132870b4bc34f035228ea728aa75cc96a4954cb languageName: node linkType: hard -"zod@npm:^3.22.4, zod@npm:^3.23.8, zod@npm:^3.24.2": - version: 3.24.3 - resolution: "zod@npm:3.24.3" - checksum: 9c3976e61cec25908f3405502abdf28ab1893afd5182c6739a30375c5c6bf4b9b6ea7e78735324e5ac63571c160ce607ebe320ff389b044223c357ccc2f8c94c +"zod@npm:^4.1.11": + version: 4.1.11 + resolution: "zod@npm:4.1.11" + checksum: 022d59f85ebe054835fbcdc96a93c01479a64321104f846cb5644812c91e00d17ae3479f823956ec9b04e4351dd32841e1f12c567e81bc43f6e21ef5cc02ce3c languageName: node linkType: hard