diff --git a/.cspell.json b/.cspell.json index c9be4caedb7..f1806362b47 100644 --- a/.cspell.json +++ b/.cspell.json @@ -47,10 +47,12 @@ "autofix", "autofixers", "autofixes", + "automations", "backticks", "bigint", "bivariant", "blockless", + "blurple", "camelcase", "Cena", "codebases", @@ -101,12 +103,15 @@ "ruleset", "rulesets", "serializers", + "Sourcegraph", "superset", "thenables", "transpiled", "transpiles", "transpiling", + "triaging", "tsconfigs", + "tseslint", "tsutils", "tsvfs", "typedef", @@ -115,8 +120,7 @@ "unoptimized", "unprefixed", "upsert", - "Zacher", - "tseslint" + "Zacher" ], "overrides": [ { diff --git a/.eslintrc.js b/.eslintrc.js index 8e62b6d06e3..81f745d3824 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -257,8 +257,23 @@ module.exports = { './packages/eslint-plugin/src/rules/**/*.ts', ], rules: { + 'eslint-plugin/require-meta-docs-description': [ + 'error', + { pattern: '^(Enforce|Require|Disallow) .+[^. ]$' }, + ], + // specifically for rules - default exports makes the tooling easier 'import/no-default-export': 'off', + + 'no-restricted-syntax': [ + 'error', + { + selector: + 'ExportDefaultDeclaration Property[key.name="create"] MemberExpression[object.name="context"][property.name="options"]', + message: + "Retrieve options from create's second parameter so that defaultOptions are applied.", + }, + ], }, }, // plugin rule tests @@ -308,7 +323,7 @@ module.exports = { rules: { // disallow ALL unused vars '@typescript-eslint/no-unused-vars': 'error', - '@typescript-eslint/sort-type-union-intersection-members': 'error', + '@typescript-eslint/sort-type-constituents': 'error', }, }, { diff --git a/.github/DISCUSSION_TEMPLATE/rfcs.yml b/.github/DISCUSSION_TEMPLATE/rfcs.yml new file mode 100644 index 00000000000..e9467392b44 --- /dev/null +++ b/.github/DISCUSSION_TEMPLATE/rfcs.yml @@ -0,0 +1,24 @@ +body: + - attributes: + label: RFC + value: | + Suggested changes... + id: rfc + type: textarea + - attributes: + label: Additional Info + value: | + Any additional info... + id: additional + type: textarea + - attributes: + label: Before you submit your RFC, please confirm the following. If any of these required steps are not taken, we may not be able to review your RFC. Help us to help you! + options: + - label: I have [searched for related discussions](https://github.com/typescript-eslint/typescript-eslint/discussions) and [searched for related issues](https://github.com/typescript-eslint/typescript-eslint/issues) and found none that match my proposal. + required: true + - label: I have [read the FAQ](https://typescript-eslint.io/linting/troubleshooting) and my problem is not listed. + required: true + id: required-checks + type: checkboxes +labels: ['rfc'] +title: Your Title Here diff --git a/.github/ISSUE_TEMPLATE/01-bug-report-plugin.yaml b/.github/ISSUE_TEMPLATE/01-bug-report-plugin.yaml index af01af154c2..1d38ce4425d 100644 --- a/.github/ISSUE_TEMPLATE/01-bug-report-plugin.yaml +++ b/.github/ISSUE_TEMPLATE/01-bug-report-plugin.yaml @@ -16,9 +16,9 @@ body: required: true - label: I have updated to the latest version of the packages. required: true - - label: I have [searched for related issues](https://github.com/typescript-eslint/typescript-eslint/issues?q=is%3Aissue+label%3Abug+label%3A%22package%3A+eslint-plugin%22) and found none that matched my issue. + - label: I have [searched for related issues](https://github.com/typescript-eslint/typescript-eslint/issues?q=is%3Aissue+label%3A%22package%3A+eslint-plugin%22) and found none that matched my issue. required: true - - label: I have [read the FAQ](https://typescript-eslint.io/docs/linting/troubleshooting) and my problem is not listed. + - label: I have [read the FAQ](https://typescript-eslint.io/linting/troubleshooting) and my problem is not listed. required: true - type: input id: playground-link @@ -98,17 +98,3 @@ body: description: | Any additional info you'd like to provide. If ESLint threw an exception, please run your lint again with the `--debug` flag, and dump the output below. e.g. `eslint path/to/broken/file.ts --debug` - - type: textarea - id: versions - attributes: - label: Versions - value: | - | package | version | - | -------------------------------------- | ------- | - | `@typescript-eslint/eslint-plugin` | `X.Y.Z` | - | `@typescript-eslint/parser` | `X.Y.Z` | - | `TypeScript` | `X.Y.Z` | - | `ESLint` | `X.Y.Z` | - | `node` | `X.Y.Z` | - validations: - required: true diff --git a/.github/ISSUE_TEMPLATE/02-enhancement-rule-option.yaml b/.github/ISSUE_TEMPLATE/02-enhancement-rule-option.yaml index 8b857b50548..ac65fbca8c1 100644 --- a/.github/ISSUE_TEMPLATE/02-enhancement-rule-option.yaml +++ b/.github/ISSUE_TEMPLATE/02-enhancement-rule-option.yaml @@ -16,7 +16,7 @@ body: required: true - label: I have searched the [current rule list](https://typescript-eslint.io/rules/#supported-rules) and found no rules that match my proposal. required: true - - label: I have [read the FAQ](https://typescript-eslint.io/docs/linting/troubleshooting) and my problem is not listed. + - label: I have [read the FAQ](https://typescript-eslint.io/linting/troubleshooting) and my problem is not listed. required: true - type: checkboxes id: rule-fits-the-brief diff --git a/.github/ISSUE_TEMPLATE/03-enhancement-new-rule.yaml b/.github/ISSUE_TEMPLATE/03-enhancement-new-rule.yaml index 2e01a8d2c58..6bd61005bd6 100644 --- a/.github/ISSUE_TEMPLATE/03-enhancement-new-rule.yaml +++ b/.github/ISSUE_TEMPLATE/03-enhancement-new-rule.yaml @@ -16,7 +16,7 @@ body: required: true - label: I have searched the [current rule list](https://typescript-eslint.io/rules/#supported-rules) and found no rules that match my proposal. required: true - - label: I have [read the FAQ](https://typescript-eslint.io/docs/linting/troubleshooting) and my problem is not listed. + - label: I have [read the FAQ](https://typescript-eslint.io/linting/troubleshooting) and my problem is not listed. required: true - type: checkboxes id: rule-fits-the-brief diff --git a/.github/ISSUE_TEMPLATE/04-enhancement-new-base-rule-extension.yaml b/.github/ISSUE_TEMPLATE/04-enhancement-new-base-rule-extension.yaml index 1c02ebe658a..8c0ca8d8694 100644 --- a/.github/ISSUE_TEMPLATE/04-enhancement-new-base-rule-extension.yaml +++ b/.github/ISSUE_TEMPLATE/04-enhancement-new-base-rule-extension.yaml @@ -23,7 +23,7 @@ body: required: true - label: I have searched the [current extension rule list](https://typescript-eslint.io/rules/#extension-rules) and found no rules that match my proposal. required: true - - label: I have [read the FAQ](https://typescript-eslint.io/docs/linting/troubleshooting) and my problem is not listed. + - label: I have [read the FAQ](https://typescript-eslint.io/linting/troubleshooting) and my problem is not listed. required: true - type: checkboxes id: rule-fits-the-brief diff --git a/.github/ISSUE_TEMPLATE/05-documentation-request.yml b/.github/ISSUE_TEMPLATE/05-documentation-request.yml index f21358bf8ed..c140dc478d1 100644 --- a/.github/ISSUE_TEMPLATE/05-documentation-request.yml +++ b/.github/ISSUE_TEMPLATE/05-documentation-request.yml @@ -12,7 +12,7 @@ body: options: - label: I have looked for existing [open or closed documentation requests](https://github.com/typescript-eslint/typescript-eslint/issues?q=is%3Aissue+label%3Adocumentation) that match my proposal. required: true - - label: I have [read the FAQ](https://typescript-eslint.io/docs/linting/troubleshooting) and my problem is not listed. + - label: I have [read the FAQ](https://typescript-eslint.io/linting/troubleshooting) and my problem is not listed. required: true - type: markdown attributes: diff --git a/.github/ISSUE_TEMPLATE/06-bug-report-other.yaml b/.github/ISSUE_TEMPLATE/06-bug-report-other.yaml index 6340c525b37..91f2cf35fd3 100644 --- a/.github/ISSUE_TEMPLATE/06-bug-report-other.yaml +++ b/.github/ISSUE_TEMPLATE/06-bug-report-other.yaml @@ -17,7 +17,7 @@ body: required: true - label: I have [searched for related issues](https://github.com/typescript-eslint/typescript-eslint/issues?q=is%3Aissue+label%3Abug) and found none that matched my issue. required: true - - label: I have [read the FAQ](https://typescript-eslint.io/docs/linting/troubleshooting) and my problem is not listed. + - label: I have [read the FAQ](https://typescript-eslint.io/linting/troubleshooting) and my problem is not listed. required: true - type: markdown id: complexity-note diff --git a/.github/ISSUE_TEMPLATE/07-enhancement-other.yaml b/.github/ISSUE_TEMPLATE/07-enhancement-other.yaml index 686ee970a67..5f0ee6146c5 100644 --- a/.github/ISSUE_TEMPLATE/07-enhancement-other.yaml +++ b/.github/ISSUE_TEMPLATE/07-enhancement-other.yaml @@ -15,7 +15,7 @@ body: required: true - label: I have searched the [current rule list](https://typescript-eslint.io/rules/#supported-rules) and found no rules that match my proposal. required: true - - label: I have [read the FAQ](https://typescript-eslint.io/docs/linting/troubleshooting) and my problem is not listed. + - label: I have [read the FAQ](https://typescript-eslint.io/linting/troubleshooting) and my problem is not listed. required: true - type: dropdown id: package diff --git a/.github/ISSUE_TEMPLATE/08-bug-report-complex.yaml b/.github/ISSUE_TEMPLATE/08-bug-report-complex.yaml index 1292c539f27..c0da8397fa8 100644 --- a/.github/ISSUE_TEMPLATE/08-bug-report-complex.yaml +++ b/.github/ISSUE_TEMPLATE/08-bug-report-complex.yaml @@ -22,7 +22,7 @@ body: required: true - label: I have [searched for related issues](https://github.com/typescript-eslint/typescript-eslint/issues?q=is%3Aissue+label%3Abug) and found none that matched my issue. required: true - - label: I have [read the FAQ](https://typescript-eslint.io/docs/linting/troubleshooting) and my problem is not listed. + - label: I have [read the FAQ](https://typescript-eslint.io/linting/troubleshooting) and my problem is not listed. required: true - type: textarea id: description diff --git a/.github/ISSUE_TEMPLATE/09-config-change.yaml b/.github/ISSUE_TEMPLATE/09-config-change.yaml index 6f31c3f96b0..c5323335a93 100644 --- a/.github/ISSUE_TEMPLATE/09-config-change.yaml +++ b/.github/ISSUE_TEMPLATE/09-config-change.yaml @@ -14,7 +14,7 @@ body: options: - label: I have [searched for related issues](https://github.com/typescript-eslint/typescript-eslint/issues?q=is%3Aissue+label%3A%22preset+config+change%22+) and found none that match my proposal. required: true - - label: I have [read the FAQ](https://typescript-eslint.io/docs/linting/troubleshooting) and my problem is not listed. + - label: I have [read the FAQ](https://typescript-eslint.io/linting/troubleshooting) and my problem is not listed. required: true - type: textarea id: description diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 42e6c62d54c..566c2f4fc8a 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -2,7 +2,7 @@ blank_issues_enabled: false contact_links: - name: FAQ about: Please check out our FAQ before filing new issues - url: https://typescript-eslint.io/docs/linting/troubleshooting + url: https://typescript-eslint.io/linting/troubleshooting - name: Getting Started Guide about: If you're looking for help setting up check out our getting started guide - url: https://typescript-eslint.io/docs/ + url: https://typescript-eslint.io diff --git a/.github/SECURITY.md b/.github/SECURITY.md new file mode 100644 index 00000000000..b7d6d324c54 --- /dev/null +++ b/.github/SECURITY.md @@ -0,0 +1,12 @@ +# Security Policy + +The typescript-eslint team and community take all security vulnerabilities seriously. +If you have a vulnerability or other security issues to disclose: + +- Thank you very much, please do! +- Please send them to us by emailing `typescripteslint@gmail.com` + +We appreciate your efforts and responsible disclosure and will make every effort to acknowledge your contributions. + +> We also adhere to the [Tidelift security process](https://support.tidelift.com/hc/en-us/articles/4406287910036-Security-process). +> See https://tidelift.com/security. diff --git a/.github/SPONSORSHIPS.md b/.github/SPONSORSHIPS.md new file mode 100644 index 00000000000..d746aff13ba --- /dev/null +++ b/.github/SPONSORSHIPS.md @@ -0,0 +1,53 @@ +# Sponsorship + +typescript-eslint is an entirely volunteer-run project. +We are not associated with any company or organization; our development is funded solely from community donations. + +## Why Sponsor typescript-eslint? + +Our tooling is used by the vast majority of TypeScript applications today, including nearly 10,000 dependent projects and 20 million weekly downloads on npm. +Our packages enable both ESLint and Prettier to run on TypeScript code. +We additionally provide a comprehensive suite of TypeScript-focused ESLint rules that, by enabling access to TypeScript's type checking APIs, can detect classifications of application bugs more advanced than ESLint alone can. +Sponsoring typescript-eslint helps keep our development process running reliably, which in turn directly allows us to: + +- Support new versions of TypeScript sooner after their release +- Continue improving our documentation and first-run experiences +- Fix bugs and add new features to existing rules +- Write more advanced rules to solve more areas of application correctness + +### Sponsorship Benefits + +In addition to benefitting the TypeScript ecosystem, sponsoring us on Open Collective helps promote your company and development brand. +Our top sponsors may have their link, logo, and/or name featured on the homepage of [typescript-eslint.io](https://typescript-eslint.io). + +At present, sponsors must have given at least $100 to be featured on the homepage. +Placement tiers are based on total donations: + +- Platinum sponsors: Top 6 donators +- Gold supporters: The next 10 donators +- Silver supporters: The next 18 donators + +You can always view all financial contributors on [opencollective.com/typescript-eslint](https://opencollective.com/typescript-eslint). + +> Got an idea for how to make sponsorship work for you? +> Let us know at `typescripteslint@gmail.com`! + +## Sponsorship Limitations + +### Project Direction + +typescript-eslint is always appreciative of organizations sponsoring the project. +However, we do not factor sponsorship amounts into issue prioritization or pull request reviews. +If you have a need to push forward an area of work in typescript-eslint more urgently than a general donation can provide, consider donating engineering time as well. + +### Website Placement + +We are inclusive by default and allow all organizations that newly meet a monetary threshold to be added. +However, at our discretion, we may remove organizations we feel we cannot promote in good conscience. +Organizations would most commonly be removed if their core charter and/or repeated organization-wide intentional activities: + +- Deny fundamental human rights +- Repeatedly spread large-scale harmful misinformation online +- Finance and/or promote other organizations that match these issues + +If you disagree with a choice made by the maintenance team, or would like a refund for your sponsorship, please let us know by emailing `typescripteslint@gmail.com`. diff --git a/.github/actions/prepare-install/action.yml b/.github/actions/prepare-install/action.yml index 85051b4885d..b437dce9136 100644 --- a/.github/actions/prepare-install/action.yml +++ b/.github/actions/prepare-install/action.yml @@ -1,5 +1,12 @@ -name: 'Prepare: Checkout and Install' -description: 'Prepares the repo for a job by checking out and installing dependencies' +# IMPORTANT NOTE TO MAINTAINERS +# +# Changes to this composite action should be carefully considered and reviewed because it is referenced +# and executed by multiple workflows in our private-automations repository. +# +# Ensure that a member of @typescript-eslint/core-team tests changes there before merging. + +name: 'Prepare: Install' +description: 'Prepares the repo by installing dependencies' inputs: node-version: description: 'The node version to setup' @@ -7,6 +14,11 @@ inputs: registry-url: description: 'Define registry-url' required: false + # NOTE: This is required for our use-case of sharing this action across multiple repos + working-directory: + description: 'Override the working directory to run the installation in' + required: false + default: '.' # outputs: - no outputs @@ -15,6 +27,7 @@ runs: steps: - name: echo github.ref shell: bash + working-directory: ${{ inputs.working-directory }} run: echo ${{ github.ref }} - name: Use Node.js ${{ inputs.node-version }} @@ -26,14 +39,13 @@ runs: - name: Get yarn cache directory path shell: bash id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" + run: echo "yarn_cache_dir=$(yarn cache dir)" >> $GITHUB_ENV - uses: actions/cache@v3 id: yarn-cache with: path: | - ${{ steps.yarn-cache-dir-path.outputs.dir }} - ~/.cache/Cypress + ${{ env.yarn_cache_dir }} key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} restore-keys: | ${{ runner.os }}-yarn- @@ -41,6 +53,7 @@ runs: # if the cache was hit - this will run in <1s - name: Install dependencies shell: bash + working-directory: ${{ inputs.working-directory }} run: | yarn --ignore-engines --frozen-lockfile --ignore-scripts yarn check-clean-workspace-after-install diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index 0c40cbe5d13..00000000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,19 +0,0 @@ -version: 2 -updates: - - package-ecosystem: github-actions - directory: / - ignore: - - dependency-name: cypress - schedule: - interval: weekly - day: monday - - - package-ecosystem: npm - directory: / - schedule: - interval: weekly - day: monday - ignore: - - dependency-name: cypress - - dependency-name: typescript - - dependency-name: eslint diff --git a/.github/renovate.json5 b/.github/renovate.json5 new file mode 100644 index 00000000000..a681df192af --- /dev/null +++ b/.github/renovate.json5 @@ -0,0 +1,76 @@ +{ + enabledManagers: ['github-actions', 'npm'], + ignoreDeps: [ + // globby is ESM so we can't go any higher right now + 'globby', + // this dep now uses package.json exports - we will be removing it next major + 'eslint-scope', + // this dep is now ESM only + 'execa', + // the nx packages get updated using the nx migrate CLI + '@nrwl/cli', + '@nrwl/devkit', + '@nrwl/jest', + '@nrwl/nx-cloud', + '@nrwl/tao', + ], + ignorePaths: [ + // integration test package.json's should never be updated as they're purposely fixed tests + 'tests/integration/fixtures', + ], + internalChecksFilter: 'strict', + labels: ['dependencies'], + packageRules: [ + // automerge everything but major updates + { + matchUpdateTypes: ['minor', 'patch', 'pin', 'digest'], + automerge: true, + automergeStrategy: 'squash', + }, + + // label PRs appropriately + { + matchManagers: ['npm'], + addLabels: ['javascript'], + }, + { + matchManagers: ['github-actions'], + addLabels: ['github-actions'], + }, + + // batch package sets together + { + extends: ['packages:react'], + groupName: 'react', + }, + { + extends: ['monorepo:docusaurus'], + groupName: 'docusaurus', + }, + { + extends: ['monorepo:nrwl'], + groupName: 'nx', + }, + { + extends: ['monorepo:babel'], + matchPackagePrefixes: ['@types/babel'], + groupName: 'babel', + }, + { + extends: ['monorepo:jest'], + matchPackageNames: ['ts-jest', 'pretty-format'], + matchPackagePrefixes: ['@types/jest'], + groupName: 'jest', + }, + { + matchPackagePrefixes: ['@rollup', 'rollup-'], + matchPackageNames: ['rollup'], + groupName: 'rollup', + }, + ], + postUpdateOptions: [ + // run yarn dedupe to cleanup the lockfile after updates + 'yarnDedupeHighest', + ], + stabilityDays: 3, +} diff --git a/.github/replies.yml b/.github/replies.yml index 299aa0441d3..a1013724140 100644 --- a/.github/replies.yml +++ b/.github/replies.yml @@ -1,4 +1,7 @@ replies: + - body: | + 👋 Hey @{{ author }}! Just checking in, is this still something you have time for? No worries if not - I just don't want to leave it hanging. + name: Checking In - body: | Thanks for posting! This is a duplicate of #. Before filing an issue, please [use our issue search](https://github.com/typescript-eslint/typescript-eslint/issues) to check for open and closed issues that already address what you're looking for. name: Clearly Duplicate Issue @@ -18,8 +21,24 @@ replies: If you need it sooner, please try the `canary` tag on NPM. name: Fix Has Been Merged - body: | - - name: + Thanks for the report @!\ + This might be a valid issue, but we can't tell because you haven't filled in enough information.\ + Please fill in the rest of the issue template so we can take a look.\ + Thanks! + name: Needs More Info + - body: | + Thanks for the report @!\ + I can't reproduce the issue using the repository you provided.\ + Could you please comment with instructions on how to reproduce the issue?\ + Thanks! + name: Needs Full Reproduction + - body: | + Thanks for the report @!\ + I can't reproduce the issue using the code you provided.\ + Could you please create an isolated reproduction in our playground (https://typescript-eslint.io/play) and comment back when you've got one?\ + We prefer an isolated reproduction so that we as volunteer maintainers can quickly reproduce the issue and more easily find the cause.\ + Thanks! + name: Needs Playground Reproduction - body: | With any issue opened in this project — it either has visible progress in the form of an attached PR, or it has no progress.\ \ @@ -36,6 +55,12 @@ replies: If this issue is important to you — consider being that champion. If not — please use the subscribe function and wait patiently for someone else to implement this. name: Progress - Nice + - body: | + Closing this issue as it's been stale for ~6 weeks without activity. Feel free to reopen @{{ author }} if you have time - but no worries if not! If anybody wants to drive it forward, please do either post here or in a new issue with the info we asked about. Thanks! 😊 + name: Pruning Stale Issue + - body: | + Closing this PR as it's been stale for ~6 weeks without activity. Feel free to reopen @{{ author }} if you have time - but no worries if not! If anybody wants to drive it forward, please do post your own PR - and if you use this as a start, consider adding `Co-authored-by: @{{ author }}` at the end of your PR description. Thanks! 😊 + name: Pruning Stale PR - body: | As per [our contributing guidelines](https://github.com/typescript-eslint/typescript-eslint/blob/master/CONTRIBUTING.md#addressing-feedback-and-beyond) this PR is in the queue of PRs to reviewed, and will be reviewed when we are able. \ @@ -48,5 +73,5 @@ replies: The configurability also leads to huge fanout [making tests huge, and awful to maintain](https://github.com/typescript-eslint/typescript-eslint/blob/b814e635c1f34139c89e0176727480935dd45cac/packages/eslint-plugin/tests/rules/type-annotation-spacing.test.ts). \ It's for these reasons that [eslint has frozen all stylistic lint rule options, and will not accept any new ones](https://eslint.org/blog/2020/05/changes-to-rules-policies). - See also our [What About Formatting?](https://typescript-eslint.io/docs/linting/troubleshooting/formatting) docs. + See also our [What About Formatting?](https://typescript-eslint.io/linting/troubleshooting/formatting) docs. name: Use Prettier diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0d47090d634..5a3384f1eaa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,6 +4,7 @@ on: push: branches: - main + - v6 pull_request: branches: - '**' @@ -154,12 +155,12 @@ jobs: # would override the config - name: Run unit tests with coverage for ${{ matrix.package }} if: env.PRIMARY_NODE_VERSION == matrix.node-version - run: npx nx test @typescript-eslint/${{ matrix.package }} + run: npx nx test ${{ matrix.package }} env: CI: true - name: Run unit tests for ${{ matrix.package }} if: env.PRIMARY_NODE_VERSION != matrix.node-version - run: npx nx test @typescript-eslint/${{ matrix.package }} --coverage=false + run: npx nx test ${{ matrix.package }} --coverage=false env: CI: true @@ -175,7 +176,6 @@ jobs: website_tests: permissions: contents: read # to fetch code (actions/checkout) - actions: read # to correctly identify workflow run (cypress-io/github-action) name: Website tests needs: [build] @@ -192,23 +192,18 @@ jobs: - name: Build uses: ./.github/actions/prepare-build - - name: Install Cypress - run: yarn cypress install + - name: Install Playwright Browsers + run: npx playwright install --with-deps - - env: - DEBUG: '@cypress/github-action' - name: Cypress run - uses: cypress-io/github-action@v2 - with: - project: ./packages/website - start: yarn start + - name: Run Playwright tests + run: yarn playwright test --reporter=list + working-directory: packages/website - - uses: actions/upload-artifact@v3 + - if: always() + uses: actions/upload-artifact@v3 with: - name: screenshots - path: | - packages/website/cypress/screenshots/ - packages/website/cypress/videos/ + name: playwright-report + path: packages/website/playwright-report upload_coverage: name: Upload Codecov Coverage @@ -255,3 +250,28 @@ jobs: run: npx lerna publish --loglevel=verbose --canary --exact --force-publish --yes env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + publish_canary_version_v6: + name: Publish the next major version code as a canary version + runs-on: ubuntu-latest + needs: [integration_tests, lint_with_build, lint_without_build, unit_tests] + if: github.ref == 'refs/heads/v${major}' + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Install + uses: ./.github/actions/prepare-install + with: + node-version: ${{ env.PRIMARY_NODE_VERSION }} + registry-url: 'https://registry.npmjs.org' + - name: Build + uses: ./.github/actions/prepare-build + + # Fetch all history for all tags and branches in this job because lerna needs it + - run: | + git fetch --prune --unshallow + + - name: Publish all packages to npm + run: npx lerna publish premajor --loglevel=verbose --canary --exact --force-publish --yes --dist-tag rc-v${major} + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/lock.yml b/.github/workflows/lock.yml index fc8cea8a8ac..202088e5b17 100644 --- a/.github/workflows/lock.yml +++ b/.github/workflows/lock.yml @@ -14,12 +14,12 @@ jobs: runs-on: ubuntu-latest steps: - - uses: dessant/lock-threads@v3 + - uses: dessant/lock-threads@v4 with: github-token: ${{ github.token }} - issue-inactive-days: '30' + issue-inactive-days: '7' issue-lock-reason: 'resolved' issue-comment: '' - pr-inactive-days: '30' + pr-inactive-days: '7' pr-lock-reason: 'resolved' pr-comment: '' diff --git a/.github/workflows/nx-migrate.yml b/.github/workflows/nx-migrate.yml new file mode 100644 index 00000000000..af107f6c391 --- /dev/null +++ b/.github/workflows/nx-migrate.yml @@ -0,0 +1,85 @@ +# This workflow is used to augment the capabilities of the renovate GitHub app by running a full +# `nx migrate` when renovate opens a PR to change the version of @nrwl/workspace. +# +# You will therefore also notice that in the renovate configuration, we ignore any packages which +# Nx will manage for us as part of `nx migrate` such as the remaining @nrwl/* packages and jest. + +name: Nx Migrate + +on: + pull_request: + branches: [main] + paths: + - 'package.json' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.ref }} + cancel-in-progress: true + +jobs: + maybe_nx_migrate: + # Only run if it was the renovate bot that triggered the workflow (otherwise we'll create a loop) + if: contains('["renovate[bot]"]', github.actor) == true + name: Run nx migrate if required + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + # To allow us to perform the git diff we need the git history + fetch-depth: 0 + # To ensure we can push from a different user (and therefore cause actions to rerun) + persist-credentials: false + + - name: Derive appropriate SHAs for base and head for `nx affected` commands + uses: nrwl/nx-set-shas@v3 + + - name: Check if @nrwl/workspace was changed as part of the latest commit on the PR + id: nrwl-workspace-package-check + run: | + git diff HEAD~1 -G"@nrwl/workspace" --exit-code package.json && echo "@nrwl/workspace unchanged" || echo "::set-output name=was-changed::true" + + - name: Run nx migrate if @nrwl/workspace changed and commit the results + if: ${{ steps.nrwl-workspace-package-check.outputs.was-changed == 'true' }} + env: + # We cannot use secrets.GITHUB_TOKEN for this because it is not permitted to kick off subsequent actions worfklow runs, so we use a PAT instead + GITHUB_TOKEN: ${{ secrets.JAMES_HENRY_GITHUB_TOKEN }} + # We don't want to run any of our postinstall logic when Nx is invoking install behind the scenes + SKIP_POSTINSTALL: 'true' + run: | + # Checkout the PR branch using the github CLI + gh pr checkout ${{ github.event.pull_request.number }} + + # Get the version of Nx we are migrating to + NX_VERSION=$(node -e "console.log(require('./package.json').devDependencies['@nrwl/workspace'])") + + # Revert renovate's changes to package.json and yarn.lock so that it is a clean migrate from the status quo + git checkout HEAD~1 -- package.json yarn.lock + + yarn --ignore-scripts + + npx nx migrate @nrwl/workspace@$NX_VERSION + + # Sometimes Nx can require config formatting changes after a migrate command + yarn --ignore-scripts + npx nx format + + # migrations.json may or may not exist after running nx migrate + if [ -f migrations.json ]; then + # This will also invoke yarn automatically + npx nx migrate --run-migrations=migrations.json + + # After we have run its migrations, we no longer need the migrations.json file + rm migrations.json + fi + + # Ensure all the changed files are formatted appropriately + yarn format + + # Commit all the changes to the PR (see note on not being able to use secrets.GITHUB_TOKEN for this) + git config --global user.email "james@henry.sc" + git config --global user.name "JamesHenry" + git remote set-url origin https://x-access-token:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY.git + + git add --all + git commit -m "chore: run nx migrate for @nrwl/workspace v$NX_VERSION" + git push diff --git a/.github/workflows/semantic-pr-titles.yml b/.github/workflows/semantic-pr-titles.yml new file mode 100644 index 00000000000..98a7013beb7 --- /dev/null +++ b/.github/workflows/semantic-pr-titles.yml @@ -0,0 +1,52 @@ +name: Semantic PR Titles + +on: + pull_request_target: + types: + - opened + - edited + - synchronize + +jobs: + main: + name: Validate PR title + runs-on: ubuntu-latest + steps: + - uses: amannn/action-semantic-pull-request@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + # keep this synchronized with /docs/contributing/Pull_Requests.mdx + types: | + docs + feat + fix + test + chore + # deps is used by renovate for its PRs + scopes: | + deps + ast-spec + eslint-plugin + eslint-plugin-internal + eslint-plugin-tslint + experimental-utils + parser + scope-manager + type-utils + types + typescript-estree + utils + visitor-keys + website + # we allow "cross package" PRs with no scope + requireScope: false + # ensure that the subject is lower-case first + # also allows "[rule-name] " / "[rule-name, rule-name] " prefix for eslint-plugin rule PRs + # https://regexr.com/73m7b + subjectPattern: ^(\[[a-z\-]+(, [a-z\-]+)*\] )?[a-z].+[^\.]$ + subjectPatternError: | + The "subject" must start with a lower-case letter and must not + end with a full-stop. + For PRs that add or change ESLint-plugin rules, you should begin + the title with "[rule-name] " diff --git a/.gitignore b/.gitignore index 5159aa25e16..2ce061c3d4d 100644 --- a/.gitignore +++ b/.gitignore @@ -9,9 +9,10 @@ yarn-error.log* packages/website/.docusaurus packages/website/.cache-loader packages/website/build -packages/website/cypress/screenshots -packages/website/cypress/videos +packages/website/playwright-report +packages/website/playwright/.cache packages/website/static/sandbox +packages/website/test-results # Runtime data pids @@ -78,3 +79,12 @@ _ts3.4 # Files copied as part of the build packages/types/src/generated/**/*.ts + +# Yarn 3 +.pnp.* +.yarn/* +!.yarn/patches +!.yarn/plugins +!.yarn/releases +!.yarn/sdks +!.yarn/versions diff --git a/.lintstagedrc b/.lintstagedrc index 691f6e0eb0e..c4eebcd2f40 100644 --- a/.lintstagedrc +++ b/.lintstagedrc @@ -1,5 +1,3 @@ { - "*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}": [ - "prettier --write" - ] + "*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}": ["prettier --write"] } diff --git a/.markdownlint.json b/.markdownlint.json index 5d8a01896c6..05206c4297d 100644 --- a/.markdownlint.json +++ b/.markdownlint.json @@ -99,11 +99,11 @@ // MD044/proper-names - Proper names should have the correct capitalization "MD044": { "names": [ + "ESLint", "JavaScript", - "TypeScript", "TSLint", - "ESLint", - "typescript-eslint" + "typescript-eslint", + "TypeScript" ], "code_blocks": false }, diff --git a/.prettierignore b/.prettierignore index 637f32f77bf..edaa57ceac4 100644 --- a/.prettierignore +++ b/.prettierignore @@ -12,6 +12,9 @@ packages/eslint-plugin/src/configs/*.json CONTRIBUTORS.md packages/ast-spec/src/*/*/fixtures/_error_/*/fixture.ts +# prettier doesn't yet support auto-accessors +packages/ast-spec/src/element/AccessorProperty/fixtures + # Ignore CHANGELOG.md files to avoid issues with automated release job CHANGELOG.md diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 3c84af70cc5..d4d111dbe6e 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -5,7 +5,8 @@ "editorconfig.editorconfig", "esbenp.prettier-vscode", "streetsidesoftware.code-spell-checker", - "tlent.jest-snapshot-language-support" + "tlent.jest-snapshot-language-support", + "mrmlnc.vscode-json5" ], "unwantedRecommendations": ["hookyqr.beautify", "dbaeumer.jshint"] } diff --git a/CHANGELOG.md b/CHANGELOG.md index 26669379fd4..7fbfc4bba22 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,3098 +3,2246 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -# [5.39.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.1...v5.39.0) (2022-10-03) - - -### Features - -* **eslint-plugin:** allow using void as a default type for a generic argument if allowInGenericTypeArguments is specified ([#5671](https://github.com/typescript-eslint/typescript-eslint/issues/5671)) ([bb46ef0](https://github.com/typescript-eslint/typescript-eslint/commit/bb46ef0817fe03ef71f8e0f3df0cf96bc355e068)) - - - - - -## [5.38.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.0...v5.38.1) (2022-09-26) +## [5.46.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.46.0...v5.46.1) (2022-12-12) **Note:** Version bump only for package @typescript-eslint/typescript-eslint +# [5.46.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.45.1...v5.46.0) (2022-12-08) +### Bug Fixes - - -# [5.38.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.37.0...v5.38.0) (2022-09-19) - +- **eslint-plugin:** [ban-types] update message to suggest `object` instead of `Record` ([#6079](https://github.com/typescript-eslint/typescript-eslint/issues/6079)) ([d91a5fc](https://github.com/typescript-eslint/typescript-eslint/commit/d91a5fc41be5bc2a0625574e9c9496f61fb7471d)) ### Features -* **website:** add warning on top of formatting rule docs pages ([#5598](https://github.com/typescript-eslint/typescript-eslint/issues/5598)) ([5dfa2e9](https://github.com/typescript-eslint/typescript-eslint/commit/5dfa2e9a33491905e99d8940dbdac0b31ada4858)) - - +- **eslint-plugin:** [prefer-nullish-coalescing] logic and test for strict null checks ([#6174](https://github.com/typescript-eslint/typescript-eslint/issues/6174)) ([8a91cbd](https://github.com/typescript-eslint/typescript-eslint/commit/8a91cbd9fbe5bc4cf750cd949d2b8d48ff4c311d)) +## [5.45.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.45.0...v5.45.1) (2022-12-05) +### Bug Fixes -# [5.37.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.2...v5.37.0) (2022-09-12) +- **eslint-plugin:** [keyword-spacing] unexpected space before/after in `import type` ([#6095](https://github.com/typescript-eslint/typescript-eslint/issues/6095)) ([98caa92](https://github.com/typescript-eslint/typescript-eslint/commit/98caa92ca89bdf0ca6ba6e4ff1f13c60221579e8)) +- **eslint-plugin:** [no-shadow] add call and method signatures to `ignoreFunctionTypeParameterNameValueShadow` ([#6129](https://github.com/typescript-eslint/typescript-eslint/issues/6129)) ([9d58b6b](https://github.com/typescript-eslint/typescript-eslint/commit/9d58b6be246507d20af67c84a5e9bb592d97cff5)) +- **eslint-plugin:** [prefer-optional-chain] collect MetaProperty type ([#6083](https://github.com/typescript-eslint/typescript-eslint/issues/6083)) ([d7114d3](https://github.com/typescript-eslint/typescript-eslint/commit/d7114d3ab09d1b93627d3b3dbb9862e37ee29c97)) +- **eslint-plugin:** [sort-type-constituents, sort-type-union-intersection-members] handle some required parentheses cases in the fixer ([#6118](https://github.com/typescript-eslint/typescript-eslint/issues/6118)) ([5d49d5d](https://github.com/typescript-eslint/typescript-eslint/commit/5d49d5dbee4425fc8bc01c5e748d161f3619477b)) +- **parser:** remove the jsx option requirement for automatic jsx pragma resolution ([#6134](https://github.com/typescript-eslint/typescript-eslint/issues/6134)) ([e777f5e](https://github.com/typescript-eslint/typescript-eslint/commit/e777f5e225b9ddfb6bb1eaa74cbc5171a17ac017)) +# [5.45.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.44.0...v5.45.0) (2022-11-28) ### Bug Fixes -* **eslint-plugin:** [strict-boolean-expressions] check all conditions in a logical operator chain ([#5539](https://github.com/typescript-eslint/typescript-eslint/issues/5539)) ([77d76e2](https://github.com/typescript-eslint/typescript-eslint/commit/77d76e21cdc2e100c729c839c292e82ab7c554c5)) -* **website:** Use extended base rule name from file's meta ([#5621](https://github.com/typescript-eslint/typescript-eslint/issues/5621)) ([7fd2f89](https://github.com/typescript-eslint/typescript-eslint/commit/7fd2f89ae732ca12ec83fad278362032473ff3ca)) - +- **eslint-plugin:** [array-type] --fix flag removes parentheses from type ([#5997](https://github.com/typescript-eslint/typescript-eslint/issues/5997)) ([42b33af](https://github.com/typescript-eslint/typescript-eslint/commit/42b33af256e5269feb214c7bb161079f770964fa)) +- **eslint-plugin:** [keyword-spacing] prevent crash on no options ([#6073](https://github.com/typescript-eslint/typescript-eslint/issues/6073)) ([1f19998](https://github.com/typescript-eslint/typescript-eslint/commit/1f19998e3ec6d592fc679a7490708e2e96816f4c)) +- **eslint-plugin:** [member-ordering] support private fields ([#5859](https://github.com/typescript-eslint/typescript-eslint/issues/5859)) ([f02761a](https://github.com/typescript-eslint/typescript-eslint/commit/f02761af19848a84b8d1832bd00fd6c95d38fa0c)) +- **eslint-plugin:** [prefer-readonly] report if a member's property is reassigned ([#6043](https://github.com/typescript-eslint/typescript-eslint/issues/6043)) ([6e079eb](https://github.com/typescript-eslint/typescript-eslint/commit/6e079eb35cfec79ba9965627477117f026d161ac)) +- **scope-manager:** add support for TS4.9 satisfies expression ([#6059](https://github.com/typescript-eslint/typescript-eslint/issues/6059)) ([44027db](https://github.com/typescript-eslint/typescript-eslint/commit/44027db379e6e074a16cda2755ef554c2b0a4c5a)) +- **typescript-estree:** stub out `ts.SatisfiesExpression` on old TS versions ([#6076](https://github.com/typescript-eslint/typescript-eslint/issues/6076)) ([1302b30](https://github.com/typescript-eslint/typescript-eslint/commit/1302b30ecad9eb55aa9f1daa5068d9fb72c3688e)) ### Features -* **docs:** always expanding collapsible sidebar menus under docs ([#5608](https://github.com/typescript-eslint/typescript-eslint/issues/5608)) ([8176fb1](https://github.com/typescript-eslint/typescript-eslint/commit/8176fb15299943cbf20385eb0ea7ba877e193285)) +- **eslint-plugin:** [member-ordering] add a required option for required vs. optional member ordering ([#5965](https://github.com/typescript-eslint/typescript-eslint/issues/5965)) ([2abadc6](https://github.com/typescript-eslint/typescript-eslint/commit/2abadc6c26cd6300764157d405a2462b754d050b)) +- support Auto Accessor syntax ([#5926](https://github.com/typescript-eslint/typescript-eslint/issues/5926)) ([becd1f8](https://github.com/typescript-eslint/typescript-eslint/commit/becd1f8581c0013399dfe71be6c265e96cedb57a)) +# [5.44.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.43.0...v5.44.0) (2022-11-21) +### Bug Fixes +- **eslint-plugin:** [no-empty-interface] disable autofix for declaration merging with class ([#5920](https://github.com/typescript-eslint/typescript-eslint/issues/5920)) ([a4f85b8](https://github.com/typescript-eslint/typescript-eslint/commit/a4f85b8cfe38ba8ea2a2ac4a56d9b11a81a8a15a)) +- **eslint-plugin:** [no-unnecessary-condition] handle index signature type ([#5912](https://github.com/typescript-eslint/typescript-eslint/issues/5912)) ([5baad08](https://github.com/typescript-eslint/typescript-eslint/commit/5baad0893f9a90633d57fffac69af7523bd1501e)) +- **eslint-plugin:** [prefer-optional-chain] handle binary expressions in negated or ([#5992](https://github.com/typescript-eslint/typescript-eslint/issues/5992)) ([2778ff0](https://github.com/typescript-eslint/typescript-eslint/commit/2778ff0c3db011148be93ed3bea5ce07af3c81ef)) +- **typescript-estree:** don't consider a cached program unless it's specified in the current `parserOptions.project` config ([#5999](https://github.com/typescript-eslint/typescript-eslint/issues/5999)) ([530e0e6](https://github.com/typescript-eslint/typescript-eslint/commit/530e0e618cdf4bb956149bf8a8484848e1b9a1f5)) +### Features -## [5.36.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.1...v5.36.2) (2022-09-05) +- **eslint-plugin:** [adjacent-overload-signatures] check BlockStatement nodes ([#5998](https://github.com/typescript-eslint/typescript-eslint/issues/5998)) ([97d3e56](https://github.com/typescript-eslint/typescript-eslint/commit/97d3e56709ee19fdec39fd8b99d080db90b306e9)) +- **eslint-plugin:** [keyword-spacing] Support spacing in import-type syntax ([#5977](https://github.com/typescript-eslint/typescript-eslint/issues/5977)) ([6a735e1](https://github.com/typescript-eslint/typescript-eslint/commit/6a735e142ef67f3af6497f922cf83706867eb6b7)) +- support parsing `satisfies` operators ([#5717](https://github.com/typescript-eslint/typescript-eslint/issues/5717)) ([20d7cae](https://github.com/typescript-eslint/typescript-eslint/commit/20d7caee35ab84ae6381fdf04338c9e2b9e2bc48)) +- update to TypeScript 4.9 ([#5716](https://github.com/typescript-eslint/typescript-eslint/issues/5716)) ([4d744ea](https://github.com/typescript-eslint/typescript-eslint/commit/4d744ea10ba03c66eebcb63e8722e9f0165fbeed)) +# [5.43.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.1...v5.43.0) (2022-11-14) ### Bug Fixes -* **eslint-plugin:** [no-extra-parens] handle generic ts array type. ([#5550](https://github.com/typescript-eslint/typescript-eslint/issues/5550)) ([0d6a190](https://github.com/typescript-eslint/typescript-eslint/commit/0d6a190c56fb3489f9f554b9035a008e29cc08ec)) -* **scope-manager:** correct handling for class static blocks ([#5580](https://github.com/typescript-eslint/typescript-eslint/issues/5580)) ([35bb8dd](https://github.com/typescript-eslint/typescript-eslint/commit/35bb8ddac1b46397f6447c1a6e1e4e1774dd7957)) -* **typescript-estree:** don't double add decorators to a parameter property's parameter ([#5582](https://github.com/typescript-eslint/typescript-eslint/issues/5582)) ([863694c](https://github.com/typescript-eslint/typescript-eslint/commit/863694cbc71b5158ca6a018de8707c9f9fbc22c3)) +- **eslint-plugin:** [no-shadow] handle false positives on generics and parameters ([#5902](https://github.com/typescript-eslint/typescript-eslint/issues/5902)) ([769e8c8](https://github.com/typescript-eslint/typescript-eslint/commit/769e8c8b9a51cd3448e47d13c7b0dab0468ee23c)) +- **eslint-plugin:** [promise-function-async] handle keyword token ([#5907](https://github.com/typescript-eslint/typescript-eslint/issues/5907)) ([f25a94f](https://github.com/typescript-eslint/typescript-eslint/commit/f25a94fa75e497a6b9ec29a008bcc89818eed60d)) +### Features +- **eslint-plugin:** [consistent-type-imports] support fixing to inline types ([#5050](https://github.com/typescript-eslint/typescript-eslint/issues/5050)) ([75dcdf1](https://github.com/typescript-eslint/typescript-eslint/commit/75dcdf164d206c5530ba7cc095c4599ec90abe35)) +- **eslint-plugin:** [naming-convention] add support for "override" and "async" modifiers ([#5310](https://github.com/typescript-eslint/typescript-eslint/issues/5310)) ([#5610](https://github.com/typescript-eslint/typescript-eslint/issues/5610)) ([c759da1](https://github.com/typescript-eslint/typescript-eslint/commit/c759da169390ba490eee9ef773cc9edc88a32817)) +- **eslint-plugin:** [prefer-optional-chain] support suggesting `!foo || !foo.bar` as a valid match for the rule ([#5594](https://github.com/typescript-eslint/typescript-eslint/issues/5594)) ([923d486](https://github.com/typescript-eslint/typescript-eslint/commit/923d486c8c9c9096deac425e7a6cb0b6457eacbd)) +## [5.42.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.0...v5.42.1) (2022-11-07) +### Bug Fixes -## [5.36.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.0...v5.36.1) (2022-08-30) +- **ast-spec:** correct misnamed ExportNamedDeclaration AST type ([#5913](https://github.com/typescript-eslint/typescript-eslint/issues/5913)) ([e88f4fa](https://github.com/typescript-eslint/typescript-eslint/commit/e88f4fa1d0127ba0ddeff578ec67f2e66a1de68b)) +- **eslint-plugin:** isTypeReadonly stack overflow ([#5875](https://github.com/typescript-eslint/typescript-eslint/issues/5875)) ([#5876](https://github.com/typescript-eslint/typescript-eslint/issues/5876)) ([2d9a33c](https://github.com/typescript-eslint/typescript-eslint/commit/2d9a33cfb2db53d76246a59253daaf2abb19ee57)) +# [5.42.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.41.0...v5.42.0) (2022-10-31) ### Bug Fixes -* **typescript-estree:** fix decorator regression for pre TS4.8 ([#5574](https://github.com/typescript-eslint/typescript-eslint/issues/5574)) ([a603015](https://github.com/typescript-eslint/typescript-eslint/commit/a603015c93a6ea96d500c57bec1e284340141b1f)) - +- **ast-spec:** add TSQualifiedName to TypeNode union ([#5906](https://github.com/typescript-eslint/typescript-eslint/issues/5906)) ([5c316c1](https://github.com/typescript-eslint/typescript-eslint/commit/5c316c12f09d58aee6ee634a8055533f361f1589)) +- **eslint-plugin:** [no-extra-parens] handle type assertion in extends clause ([#5901](https://github.com/typescript-eslint/typescript-eslint/issues/5901)) ([8ed7219](https://github.com/typescript-eslint/typescript-eslint/commit/8ed72192c274249d26628fb125796e71318b857a)) +- **eslint-plugin:** enable react/jsx-curly-brace-presence lint rule in website package ([#5894](https://github.com/typescript-eslint/typescript-eslint/issues/5894)) ([344322a](https://github.com/typescript-eslint/typescript-eslint/commit/344322add846d03c6c9981e486b09e6ba1196555)) +- **typescript-estree:** don't allow single-run unless we're in type-aware linting mode ([#5893](https://github.com/typescript-eslint/typescript-eslint/issues/5893)) ([891b087](https://github.com/typescript-eslint/typescript-eslint/commit/891b0879ba9c64a4722b8c0bf9e599a725b6d6df)) +### Features +- **eslint-plugin:** [member-ordering] add natural sort order ([#5662](https://github.com/typescript-eslint/typescript-eslint/issues/5662)) ([1eaae09](https://github.com/typescript-eslint/typescript-eslint/commit/1eaae09ecca359f366b94f6a04665403f48b05c7)) +- **eslint-plugin:** [no-invalid-void-type] better report message for void used as a constituent inside a function return type ([#5274](https://github.com/typescript-eslint/typescript-eslint/issues/5274)) ([d806bda](https://github.com/typescript-eslint/typescript-eslint/commit/d806bda82343712a24e3c78b9b34d4345dd1de3b)) +- **scope-manager:** ignore ECMA version ([#5881](https://github.com/typescript-eslint/typescript-eslint/issues/5881)) ([3b8d449](https://github.com/typescript-eslint/typescript-eslint/commit/3b8d449696c319690536a18a48ef32749dc2f559)) +- **typescript-estree:** clarify docs and error for program project without matching TSConfig ([#5762](https://github.com/typescript-eslint/typescript-eslint/issues/5762)) ([67744db](https://github.com/typescript-eslint/typescript-eslint/commit/67744db31f61acab14b5fe027fbc2844ba198c97)) +- **utils:** add `RuleTester` API for top-level dependency constraints ([#5896](https://github.com/typescript-eslint/typescript-eslint/issues/5896)) ([0520d53](https://github.com/typescript-eslint/typescript-eslint/commit/0520d53536af411d66ce2ce0dd478365e67adbac)) +- **website:** Add a happy message to playground output pane when no errors or AST ([#5868](https://github.com/typescript-eslint/typescript-eslint/issues/5868)) ([#5873](https://github.com/typescript-eslint/typescript-eslint/issues/5873)) ([c4e0d86](https://github.com/typescript-eslint/typescript-eslint/commit/c4e0d8678e0398f3ab85510f40ad6f97832b9e6d)) +### Reverts -# [5.36.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.1...v5.36.0) (2022-08-30) +- Revert "feat(scope-manager): ignore ECMA version" (#5888) ([2ee81df](https://github.com/typescript-eslint/typescript-eslint/commit/2ee81df5a365d82ef4b3dfc124d4ec39c7bcb725)), closes [#5888](https://github.com/typescript-eslint/typescript-eslint/issues/5888) [#5881](https://github.com/typescript-eslint/typescript-eslint/issues/5881) +# [5.41.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.1...v5.41.0) (2022-10-24) ### Bug Fixes -* **eslint-plugin:** revert [#5266](https://github.com/typescript-eslint/typescript-eslint/issues/5266) ([#5564](https://github.com/typescript-eslint/typescript-eslint/issues/5564)) ([7a8afe2](https://github.com/typescript-eslint/typescript-eslint/commit/7a8afe29039c6c80fe584acaf5d933424a4452a9)) - +- **eslint-plugin:** [no-base-to-string] ignore Error, URL, and URLSearchParams by default ([#5839](https://github.com/typescript-eslint/typescript-eslint/issues/5839)) ([96e1c6c](https://github.com/typescript-eslint/typescript-eslint/commit/96e1c6c171a34b0793c50c3dba853c3999a6bd49)) +- **type-utils:** prevent stack overflow in `isTypeReadonly` ([#5860](https://github.com/typescript-eslint/typescript-eslint/issues/5860)) ([a6d8f7e](https://github.com/typescript-eslint/typescript-eslint/commit/a6d8f7edb84f9f6dd59a76faf53bf686756e2aed)), closes [#4476](https://github.com/typescript-eslint/typescript-eslint/issues/4476) ### Features -* support TypeScript 4.8 ([#5551](https://github.com/typescript-eslint/typescript-eslint/issues/5551)) ([81450ed](https://github.com/typescript-eslint/typescript-eslint/commit/81450ed7eaede74b384e9a91a84e9b4d34513866)) +- **eslint-plugin:** [no-unsafe-declaration-merging] switch to use scope analysis instead of type information ([#5865](https://github.com/typescript-eslint/typescript-eslint/issues/5865)) ([e70a10a](https://github.com/typescript-eslint/typescript-eslint/commit/e70a10aea684bc6bca05b69bfce3bae769a5f5ab)) +- **eslint-plugin:** add no-unsafe-declaration-merging ([#5840](https://github.com/typescript-eslint/typescript-eslint/issues/5840)) ([3728031](https://github.com/typescript-eslint/typescript-eslint/commit/3728031c659dabde7658cd54184951d4be9aabcb)) +## [5.40.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.0...v5.40.1) (2022-10-17) +### Bug Fixes +- **eslint-plugin:** Skip missing 'rest' tuple type arguments in no-misused-promises ([#5809](https://github.com/typescript-eslint/typescript-eslint/issues/5809)) ([c5beaa2](https://github.com/typescript-eslint/typescript-eslint/commit/c5beaa2ea340985211ca5c12821842c54f5170f0)), closes [#5807](https://github.com/typescript-eslint/typescript-eslint/issues/5807) +- **utils:** add missing dependency on `@types/semver` ([#5825](https://github.com/typescript-eslint/typescript-eslint/issues/5825)) ([17b8879](https://github.com/typescript-eslint/typescript-eslint/commit/17b887933a0640d6fe843622e0520c0315144bb7)) +# [5.40.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.39.0...v5.40.0) (2022-10-10) -## [5.35.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.0...v5.35.1) (2022-08-24) +### Bug Fixes +- **eslint-plugin:** [consistent-indexed-object-style] handle interface generic ([#5746](https://github.com/typescript-eslint/typescript-eslint/issues/5746)) ([7a8a0a3](https://github.com/typescript-eslint/typescript-eslint/commit/7a8a0a3c500ca726d2ab3bee0ae9f3fb9d8d39b8)) +- **eslint-plugin:** [no-unnecessary-condition] handle void ([#5766](https://github.com/typescript-eslint/typescript-eslint/issues/5766)) ([ac8f06b](https://github.com/typescript-eslint/typescript-eslint/commit/ac8f06b68dca7666bfb78fb38d6ccc07f676e435)) -### Bug Fixes +### Features -* **eslint-plugin:** correct rule schemas to pass ajv validation ([#5531](https://github.com/typescript-eslint/typescript-eslint/issues/5531)) ([dbf8b56](https://github.com/typescript-eslint/typescript-eslint/commit/dbf8b569dbada29e4a295d6c265976e55de1b2aa)) +- **eslint-plugin:** Check 'rest' parameters in no-misused-promises ([#5731](https://github.com/typescript-eslint/typescript-eslint/issues/5731)) ([6477f38](https://github.com/typescript-eslint/typescript-eslint/commit/6477f3855627cc257edc021b859711d4a5847a12)), closes [#4015](https://github.com/typescript-eslint/typescript-eslint/issues/4015) +- **utils:** add dependency constraint filtering for `RuleTester` ([#5750](https://github.com/typescript-eslint/typescript-eslint/issues/5750)) ([121f4c0](https://github.com/typescript-eslint/typescript-eslint/commit/121f4c0e7252def95d917e4734e933e53e29d501)) +- **website:** store options TypeScript, Enable jsx and AST Viewer in browser's local storage ([#5769](https://github.com/typescript-eslint/typescript-eslint/issues/5769)) ([77d2336](https://github.com/typescript-eslint/typescript-eslint/commit/77d2336594ca10b47c0f7978ae64f87d24a25d33)) +# [5.39.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.1...v5.39.0) (2022-10-03) +### Features +- **eslint-plugin:** allow using void as a default type for a generic argument if allowInGenericTypeArguments is specified ([#5671](https://github.com/typescript-eslint/typescript-eslint/issues/5671)) ([bb46ef0](https://github.com/typescript-eslint/typescript-eslint/commit/bb46ef0817fe03ef71f8e0f3df0cf96bc355e068)) +## [5.38.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.0...v5.38.1) (2022-09-26) -# [5.35.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.34.0...v5.35.0) (2022-08-24) +**Note:** Version bump only for package @typescript-eslint/typescript-eslint +# [5.38.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.37.0...v5.38.0) (2022-09-19) ### Features -* **eslint-plugin:** [explicit-member-accessibility] suggest adding explicit accessibility specifiers ([#5492](https://github.com/typescript-eslint/typescript-eslint/issues/5492)) ([0edb94a](https://github.com/typescript-eslint/typescript-eslint/commit/0edb94aee55e1ec6afa7f46f99a9b308bbb66301)) +- **website:** add warning on top of formatting rule docs pages ([#5598](https://github.com/typescript-eslint/typescript-eslint/issues/5598)) ([5dfa2e9](https://github.com/typescript-eslint/typescript-eslint/commit/5dfa2e9a33491905e99d8940dbdac0b31ada4858)) +# [5.37.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.2...v5.37.0) (2022-09-12) +### Bug Fixes +- **eslint-plugin:** [strict-boolean-expressions] check all conditions in a logical operator chain ([#5539](https://github.com/typescript-eslint/typescript-eslint/issues/5539)) ([77d76e2](https://github.com/typescript-eslint/typescript-eslint/commit/77d76e21cdc2e100c729c839c292e82ab7c554c5)) +- **website:** Use extended base rule name from file's meta ([#5621](https://github.com/typescript-eslint/typescript-eslint/issues/5621)) ([7fd2f89](https://github.com/typescript-eslint/typescript-eslint/commit/7fd2f89ae732ca12ec83fad278362032473ff3ca)) +### Features -# [5.34.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.1...v5.34.0) (2022-08-22) +- **docs:** always expanding collapsible sidebar menus under docs ([#5608](https://github.com/typescript-eslint/typescript-eslint/issues/5608)) ([8176fb1](https://github.com/typescript-eslint/typescript-eslint/commit/8176fb15299943cbf20385eb0ea7ba877e193285)) +## [5.36.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.1...v5.36.2) (2022-09-05) ### Bug Fixes -* **ast-spec:** NewExpression argument can be SpreadElement now ([#5422](https://github.com/typescript-eslint/typescript-eslint/issues/5422)) ([3ced62f](https://github.com/typescript-eslint/typescript-eslint/commit/3ced62fb8474ed377c1336ac3e855f0270ce9beb)) -* **eslint-plugin:** [no-useless-constructor] handle parameter decorator ([#5450](https://github.com/typescript-eslint/typescript-eslint/issues/5450)) ([864dbcf](https://github.com/typescript-eslint/typescript-eslint/commit/864dbcfccba274fe1b26eac8aeeaf2a2355b5969)) -* **scope-manager:** visit static blocks ([#5489](https://github.com/typescript-eslint/typescript-eslint/issues/5489)) ([78745c2](https://github.com/typescript-eslint/typescript-eslint/commit/78745c2092064446837b5683892001030a8bb4e2)) +- **eslint-plugin:** [no-extra-parens] handle generic ts array type. ([#5550](https://github.com/typescript-eslint/typescript-eslint/issues/5550)) ([0d6a190](https://github.com/typescript-eslint/typescript-eslint/commit/0d6a190c56fb3489f9f554b9035a008e29cc08ec)) +- **scope-manager:** correct handling for class static blocks ([#5580](https://github.com/typescript-eslint/typescript-eslint/issues/5580)) ([35bb8dd](https://github.com/typescript-eslint/typescript-eslint/commit/35bb8ddac1b46397f6447c1a6e1e4e1774dd7957)) +- **typescript-estree:** don't double add decorators to a parameter property's parameter ([#5582](https://github.com/typescript-eslint/typescript-eslint/issues/5582)) ([863694c](https://github.com/typescript-eslint/typescript-eslint/commit/863694cbc71b5158ca6a018de8707c9f9fbc22c3)) +## [5.36.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.0...v5.36.1) (2022-08-30) -### Features +### Bug Fixes -* **eslint-plugin:** [prefer-optional-chain] support suggesting `!foo || !foo.bar` as a valid match for the rule ([#5266](https://github.com/typescript-eslint/typescript-eslint/issues/5266)) ([aca935c](https://github.com/typescript-eslint/typescript-eslint/commit/aca935c9696712d4aff18144c4690db4d6ba9bf9)) -* **types:** add unbound property in parser options ([#5419](https://github.com/typescript-eslint/typescript-eslint/issues/5419)) ([e08a9dd](https://github.com/typescript-eslint/typescript-eslint/commit/e08a9dd79365c1b1f5d0145ab69377f7d45f8a4f)) +- **typescript-estree:** fix decorator regression for pre TS4.8 ([#5574](https://github.com/typescript-eslint/typescript-eslint/issues/5574)) ([a603015](https://github.com/typescript-eslint/typescript-eslint/commit/a603015c93a6ea96d500c57bec1e284340141b1f)) +# [5.36.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.1...v5.36.0) (2022-08-30) +### Bug Fixes +- **eslint-plugin:** revert [#5266](https://github.com/typescript-eslint/typescript-eslint/issues/5266) ([#5564](https://github.com/typescript-eslint/typescript-eslint/issues/5564)) ([7a8afe2](https://github.com/typescript-eslint/typescript-eslint/commit/7a8afe29039c6c80fe584acaf5d933424a4452a9)) +### Features -## [5.33.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.0...v5.33.1) (2022-08-15) +- support TypeScript 4.8 ([#5551](https://github.com/typescript-eslint/typescript-eslint/issues/5551)) ([81450ed](https://github.com/typescript-eslint/typescript-eslint/commit/81450ed7eaede74b384e9a91a84e9b4d34513866)) +## [5.35.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.0...v5.35.1) (2022-08-24) ### Bug Fixes -* missing placeholders in violation messages for `no-unnecessary-type-constraint` and `no-unsafe-argument` (and enable `eslint-plugin/recommended` rules internally) ([#5453](https://github.com/typescript-eslint/typescript-eslint/issues/5453)) ([d023910](https://github.com/typescript-eslint/typescript-eslint/commit/d0239104f4dbffd2b5ecdb19e520c7d4b71962e0)) - - +- **eslint-plugin:** correct rule schemas to pass ajv validation ([#5531](https://github.com/typescript-eslint/typescript-eslint/issues/5531)) ([dbf8b56](https://github.com/typescript-eslint/typescript-eslint/commit/dbf8b569dbada29e4a295d6c265976e55de1b2aa)) +# [5.35.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.34.0...v5.35.0) (2022-08-24) +### Features -# [5.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.32.0...v5.33.0) (2022-08-08) +- **eslint-plugin:** [explicit-member-accessibility] suggest adding explicit accessibility specifiers ([#5492](https://github.com/typescript-eslint/typescript-eslint/issues/5492)) ([0edb94a](https://github.com/typescript-eslint/typescript-eslint/commit/0edb94aee55e1ec6afa7f46f99a9b308bbb66301)) +# [5.34.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.1...v5.34.0) (2022-08-22) ### Bug Fixes -* **eslint-plugin:** [no-extra-parens] handle await with type assertion ([#5428](https://github.com/typescript-eslint/typescript-eslint/issues/5428)) ([e03826f](https://github.com/typescript-eslint/typescript-eslint/commit/e03826f08ce8bfdd6d6702025d975cfb7d867097)) -* **website:** add explicit frontmatter description to rule docs ([#5429](https://github.com/typescript-eslint/typescript-eslint/issues/5429)) ([63cba5f](https://github.com/typescript-eslint/typescript-eslint/commit/63cba5f4c1884e102927b3b14b18a00e96ac63a1)) - +- **ast-spec:** NewExpression argument can be SpreadElement now ([#5422](https://github.com/typescript-eslint/typescript-eslint/issues/5422)) ([3ced62f](https://github.com/typescript-eslint/typescript-eslint/commit/3ced62fb8474ed377c1336ac3e855f0270ce9beb)) +- **eslint-plugin:** [no-useless-constructor] handle parameter decorator ([#5450](https://github.com/typescript-eslint/typescript-eslint/issues/5450)) ([864dbcf](https://github.com/typescript-eslint/typescript-eslint/commit/864dbcfccba274fe1b26eac8aeeaf2a2355b5969)) +- **scope-manager:** visit static blocks ([#5489](https://github.com/typescript-eslint/typescript-eslint/issues/5489)) ([78745c2](https://github.com/typescript-eslint/typescript-eslint/commit/78745c2092064446837b5683892001030a8bb4e2)) ### Features -* **eslint-plugin:** [member-ordering] support static blocks ([#5417](https://github.com/typescript-eslint/typescript-eslint/issues/5417)) ([5983e5a](https://github.com/typescript-eslint/typescript-eslint/commit/5983e5ab3bfb94fec782bea54a37457fe31db545)) -* **eslint-plugin:** [prefer-as-const] adds support for class properties ([#5413](https://github.com/typescript-eslint/typescript-eslint/issues/5413)) ([d2394f8](https://github.com/typescript-eslint/typescript-eslint/commit/d2394f810960fda07b9c8affd47b769d16f4b8cb)) +- **eslint-plugin:** [prefer-optional-chain] support suggesting `!foo || !foo.bar` as a valid match for the rule ([#5266](https://github.com/typescript-eslint/typescript-eslint/issues/5266)) ([aca935c](https://github.com/typescript-eslint/typescript-eslint/commit/aca935c9696712d4aff18144c4690db4d6ba9bf9)) +- **types:** add unbound property in parser options ([#5419](https://github.com/typescript-eslint/typescript-eslint/issues/5419)) ([e08a9dd](https://github.com/typescript-eslint/typescript-eslint/commit/e08a9dd79365c1b1f5d0145ab69377f7d45f8a4f)) +## [5.33.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.0...v5.33.1) (2022-08-15) +### Bug Fixes +- missing placeholders in violation messages for `no-unnecessary-type-constraint` and `no-unsafe-argument` (and enable `eslint-plugin/recommended` rules internally) ([#5453](https://github.com/typescript-eslint/typescript-eslint/issues/5453)) ([d023910](https://github.com/typescript-eslint/typescript-eslint/commit/d0239104f4dbffd2b5ecdb19e520c7d4b71962e0)) +# [5.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.32.0...v5.33.0) (2022-08-08) -# [5.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.31.0...v5.32.0) (2022-08-01) +### Bug Fixes +- **eslint-plugin:** [no-extra-parens] handle await with type assertion ([#5428](https://github.com/typescript-eslint/typescript-eslint/issues/5428)) ([e03826f](https://github.com/typescript-eslint/typescript-eslint/commit/e03826f08ce8bfdd6d6702025d975cfb7d867097)) +- **website:** add explicit frontmatter description to rule docs ([#5429](https://github.com/typescript-eslint/typescript-eslint/issues/5429)) ([63cba5f](https://github.com/typescript-eslint/typescript-eslint/commit/63cba5f4c1884e102927b3b14b18a00e96ac63a1)) ### Features -* **eslint-plugin:** [no-use-before-define] add "allowNamedExports" option ([#5397](https://github.com/typescript-eslint/typescript-eslint/issues/5397)) ([ad412cd](https://github.com/typescript-eslint/typescript-eslint/commit/ad412cdd74dc5619fbe4bf27c0a5eb5c5a4b65ca)) - +- **eslint-plugin:** [member-ordering] support static blocks ([#5417](https://github.com/typescript-eslint/typescript-eslint/issues/5417)) ([5983e5a](https://github.com/typescript-eslint/typescript-eslint/commit/5983e5ab3bfb94fec782bea54a37457fe31db545)) +- **eslint-plugin:** [prefer-as-const] adds support for class properties ([#5413](https://github.com/typescript-eslint/typescript-eslint/issues/5413)) ([d2394f8](https://github.com/typescript-eslint/typescript-eslint/commit/d2394f810960fda07b9c8affd47b769d16f4b8cb)) +# [5.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.31.0...v5.32.0) (2022-08-01) +### Features +- **eslint-plugin:** [no-use-before-define] add "allowNamedExports" option ([#5397](https://github.com/typescript-eslint/typescript-eslint/issues/5397)) ([ad412cd](https://github.com/typescript-eslint/typescript-eslint/commit/ad412cdd74dc5619fbe4bf27c0a5eb5c5a4b65ca)) # [5.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.7...v5.31.0) (2022-07-25) - ### Bug Fixes -* **eslint-plugin:** [typedef] Support nested array destructuring with type annotation ([#5311](https://github.com/typescript-eslint/typescript-eslint/issues/5311)) ([6d19efe](https://github.com/typescript-eslint/typescript-eslint/commit/6d19efed16d1cf0357ad363b6373d2021c49a8c8)) -* **scope-manager:** handle typeParameters of TSInstantiationExpression ([#5355](https://github.com/typescript-eslint/typescript-eslint/issues/5355)) ([2595ccf](https://github.com/typescript-eslint/typescript-eslint/commit/2595ccf67cd5158edbd6bebd9ac2dbd8bbd8b99c)) - +- **eslint-plugin:** [typedef] Support nested array destructuring with type annotation ([#5311](https://github.com/typescript-eslint/typescript-eslint/issues/5311)) ([6d19efe](https://github.com/typescript-eslint/typescript-eslint/commit/6d19efed16d1cf0357ad363b6373d2021c49a8c8)) +- **scope-manager:** handle typeParameters of TSInstantiationExpression ([#5355](https://github.com/typescript-eslint/typescript-eslint/issues/5355)) ([2595ccf](https://github.com/typescript-eslint/typescript-eslint/commit/2595ccf67cd5158edbd6bebd9ac2dbd8bbd8b99c)) ### Features -* **eslint-plugin:** [consistent-generic-ctors] check class field declaration ([#5288](https://github.com/typescript-eslint/typescript-eslint/issues/5288)) ([48f996e](https://github.com/typescript-eslint/typescript-eslint/commit/48f996e8dda79c9c865e8ca6552069902836648b)) -* **eslint-plugin:** [prefer-nullish-coalescing] add ignoreTernaryTests option ([#4965](https://github.com/typescript-eslint/typescript-eslint/issues/4965)) ([f82727f](https://github.com/typescript-eslint/typescript-eslint/commit/f82727ffeb97475c07773ca1d1e5b9609fcc5e68)) - - - - +- **eslint-plugin:** [consistent-generic-ctors] check class field declaration ([#5288](https://github.com/typescript-eslint/typescript-eslint/issues/5288)) ([48f996e](https://github.com/typescript-eslint/typescript-eslint/commit/48f996e8dda79c9c865e8ca6552069902836648b)) +- **eslint-plugin:** [prefer-nullish-coalescing] add ignoreTernaryTests option ([#4965](https://github.com/typescript-eslint/typescript-eslint/issues/4965)) ([f82727f](https://github.com/typescript-eslint/typescript-eslint/commit/f82727ffeb97475c07773ca1d1e5b9609fcc5e68)) ## [5.30.7](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.6...v5.30.7) (2022-07-18) - ### Bug Fixes -* **eslint-plugin:** [no-inferrable] fix optional param to valid code ([#5342](https://github.com/typescript-eslint/typescript-eslint/issues/5342)) ([98f6d5e](https://github.com/typescript-eslint/typescript-eslint/commit/98f6d5e6d08d1eb9789da52a15f337f5f53438bd)) -* **eslint-plugin:** [no-unused-vars] highlight last write reference ([#5267](https://github.com/typescript-eslint/typescript-eslint/issues/5267)) ([c3f199a](https://github.com/typescript-eslint/typescript-eslint/commit/c3f199a65a16aa72f5bb83e81a1ce0ffb5f69772)) -* expose types supporting old versions of typescript ([#5339](https://github.com/typescript-eslint/typescript-eslint/issues/5339)) ([4ba9bdb](https://github.com/typescript-eslint/typescript-eslint/commit/4ba9bdb93f87e6bc370f13aa1de48f435abe3f88)) -* **scope-manager:** allow visiting of constraint in infer type ([#5331](https://github.com/typescript-eslint/typescript-eslint/issues/5331)) ([b2846a1](https://github.com/typescript-eslint/typescript-eslint/commit/b2846a16777a3aea7b1e6ac9d81b9b6dce0bb874)) - - - - +- **eslint-plugin:** [no-inferrable] fix optional param to valid code ([#5342](https://github.com/typescript-eslint/typescript-eslint/issues/5342)) ([98f6d5e](https://github.com/typescript-eslint/typescript-eslint/commit/98f6d5e6d08d1eb9789da52a15f337f5f53438bd)) +- **eslint-plugin:** [no-unused-vars] highlight last write reference ([#5267](https://github.com/typescript-eslint/typescript-eslint/issues/5267)) ([c3f199a](https://github.com/typescript-eslint/typescript-eslint/commit/c3f199a65a16aa72f5bb83e81a1ce0ffb5f69772)) +- expose types supporting old versions of typescript ([#5339](https://github.com/typescript-eslint/typescript-eslint/issues/5339)) ([4ba9bdb](https://github.com/typescript-eslint/typescript-eslint/commit/4ba9bdb93f87e6bc370f13aa1de48f435abe3f88)) +- **scope-manager:** allow visiting of constraint in infer type ([#5331](https://github.com/typescript-eslint/typescript-eslint/issues/5331)) ([b2846a1](https://github.com/typescript-eslint/typescript-eslint/commit/b2846a16777a3aea7b1e6ac9d81b9b6dce0bb874)) ## [5.30.6](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.5...v5.30.6) (2022-07-11) **Note:** Version bump only for package @typescript-eslint/typescript-eslint - - - - ## [5.30.5](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.4...v5.30.5) (2022-07-04) - ### Bug Fixes -* **eslint-plugin:** [consistent-indexed-object-style] fix record mode fixer for generics with a default value ([#5280](https://github.com/typescript-eslint/typescript-eslint/issues/5280)) ([57f032c](https://github.com/typescript-eslint/typescript-eslint/commit/57f032c2e6a822c049177713778d0077ee138d9a)) - - - - +- **eslint-plugin:** [consistent-indexed-object-style] fix record mode fixer for generics with a default value ([#5280](https://github.com/typescript-eslint/typescript-eslint/issues/5280)) ([57f032c](https://github.com/typescript-eslint/typescript-eslint/commit/57f032c2e6a822c049177713778d0077ee138d9a)) ## [5.30.4](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.3...v5.30.4) (2022-07-03) **Note:** Version bump only for package @typescript-eslint/typescript-eslint - - - - ## [5.30.3](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.2...v5.30.3) (2022-07-01) **Note:** Version bump only for package @typescript-eslint/typescript-eslint - - - - ## [5.30.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.1...v5.30.2) (2022-07-01) **Note:** Version bump only for package @typescript-eslint/typescript-eslint - - - - ## [5.30.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.0...v5.30.1) (2022-07-01) - ### Bug Fixes -* **eslint-plugin:** [no-base-to-string] add missing apostrophe to message ([#5270](https://github.com/typescript-eslint/typescript-eslint/issues/5270)) ([d320174](https://github.com/typescript-eslint/typescript-eslint/commit/58034e343a167ca7751b54d2b2a0e7d3852aabec)) - - - - +- **eslint-plugin:** [no-base-to-string] add missing apostrophe to message ([#5270](https://github.com/typescript-eslint/typescript-eslint/issues/5270)) ([d320174](https://github.com/typescript-eslint/typescript-eslint/commit/58034e343a167ca7751b54d2b2a0e7d3852aabec)) # [5.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.29.0...v5.30.0) (2022-06-27) - ### Features -* **eslint-plugin:** [no-shadow] add shadowed variable location to the error message ([#5183](https://github.com/typescript-eslint/typescript-eslint/issues/5183)) ([8ca08e9](https://github.com/typescript-eslint/typescript-eslint/commit/8ca08e9f18d59b29715c667fbb7d237f6e9a96ba)) -* treat `this` in `typeof this` as a `ThisExpression` ([#4382](https://github.com/typescript-eslint/typescript-eslint/issues/4382)) ([b04b2ce](https://github.com/typescript-eslint/typescript-eslint/commit/b04b2ce1ba90d94718891f2562dd210a6d7b8609)) - - - - +- **eslint-plugin:** [no-shadow] add shadowed variable location to the error message ([#5183](https://github.com/typescript-eslint/typescript-eslint/issues/5183)) ([8ca08e9](https://github.com/typescript-eslint/typescript-eslint/commit/8ca08e9f18d59b29715c667fbb7d237f6e9a96ba)) +- treat `this` in `typeof this` as a `ThisExpression` ([#4382](https://github.com/typescript-eslint/typescript-eslint/issues/4382)) ([b04b2ce](https://github.com/typescript-eslint/typescript-eslint/commit/b04b2ce1ba90d94718891f2562dd210a6d7b8609)) # [5.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.28.0...v5.29.0) (2022-06-20) - ### Features -* **website:** open issue with rule name if only one rule is enabled ([#5190](https://github.com/typescript-eslint/typescript-eslint/issues/5190)) ([b229ee4](https://github.com/typescript-eslint/typescript-eslint/commit/b229ee4ace1417d2d4f7d6cafa039f073e845c3a)) - - - - +- **website:** open issue with rule name if only one rule is enabled ([#5190](https://github.com/typescript-eslint/typescript-eslint/issues/5190)) ([b229ee4](https://github.com/typescript-eslint/typescript-eslint/commit/b229ee4ace1417d2d4f7d6cafa039f073e845c3a)) # [5.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.1...v5.28.0) (2022-06-13) - ### Bug Fixes -* [TS4.7] allow visiting of typeParameters in TSTypeQuery ([#5166](https://github.com/typescript-eslint/typescript-eslint/issues/5166)) ([dc1f930](https://github.com/typescript-eslint/typescript-eslint/commit/dc1f9309cf04aa7314e758980ac687558482f47f)) -* **eslint-plugin:** [space-infix-ops] support for optional property without type ([#5155](https://github.com/typescript-eslint/typescript-eslint/issues/5155)) ([1f25daf](https://github.com/typescript-eslint/typescript-eslint/commit/1f25daf74e5d45077199f9ee9fa9bf31107f4089)) - +- [TS4.7] allow visiting of typeParameters in TSTypeQuery ([#5166](https://github.com/typescript-eslint/typescript-eslint/issues/5166)) ([dc1f930](https://github.com/typescript-eslint/typescript-eslint/commit/dc1f9309cf04aa7314e758980ac687558482f47f)) +- **eslint-plugin:** [space-infix-ops] support for optional property without type ([#5155](https://github.com/typescript-eslint/typescript-eslint/issues/5155)) ([1f25daf](https://github.com/typescript-eslint/typescript-eslint/commit/1f25daf74e5d45077199f9ee9fa9bf31107f4089)) ### Features -* **ast-spec:** extract `AssignmentOperatorToText` ([#3570](https://github.com/typescript-eslint/typescript-eslint/issues/3570)) ([45f75e6](https://github.com/typescript-eslint/typescript-eslint/commit/45f75e6b869f4160a45a6890d794aba004356ad7)) -* **eslint-plugin:** [consistent-generic-constructors] add rule ([#4924](https://github.com/typescript-eslint/typescript-eslint/issues/4924)) ([921cdf1](https://github.com/typescript-eslint/typescript-eslint/commit/921cdf17e548845311d0591249616ec844503926)) +- **ast-spec:** extract `AssignmentOperatorToText` ([#3570](https://github.com/typescript-eslint/typescript-eslint/issues/3570)) ([45f75e6](https://github.com/typescript-eslint/typescript-eslint/commit/45f75e6b869f4160a45a6890d794aba004356ad7)) +- **eslint-plugin:** [consistent-generic-constructors] add rule ([#4924](https://github.com/typescript-eslint/typescript-eslint/issues/4924)) ([921cdf1](https://github.com/typescript-eslint/typescript-eslint/commit/921cdf17e548845311d0591249616ec844503926)) +## [5.27.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.0...v5.27.1) (2022-06-06) +### Bug Fixes +- **eslint-plugin:** [space-infix-ops] correct PropertyDefinition with typeAnnotation ([#5113](https://github.com/typescript-eslint/typescript-eslint/issues/5113)) ([d320174](https://github.com/typescript-eslint/typescript-eslint/commit/d320174f40a74b34e6b6e4c88128ef6e736311d8)) +- **eslint-plugin:** [space-infix-ops] regression fix for conditional types ([#5135](https://github.com/typescript-eslint/typescript-eslint/issues/5135)) ([e5238c8](https://github.com/typescript-eslint/typescript-eslint/commit/e5238c84e56e7c34174b2c6f1e3ea59456797c2f)) +- **eslint-plugin:** [space-infix-ops] regression fix for type aliases ([#5138](https://github.com/typescript-eslint/typescript-eslint/issues/5138)) ([4e13deb](https://github.com/typescript-eslint/typescript-eslint/commit/4e13deb05fbd8724996156b15b65f6a66794a7cc)) +# [5.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.26.0...v5.27.0) (2022-05-30) -## [5.27.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.0...v5.27.1) (2022-06-06) +### Bug Fixes +- **eslint-plugin:** [no-type-alias] handle Template Literal Types ([#5092](https://github.com/typescript-eslint/typescript-eslint/issues/5092)) ([8febf11](https://github.com/typescript-eslint/typescript-eslint/commit/8febf11a9296d1c0d7ccdf91ef9ab92ec8dfc39c)) +- **types:** remove leftovers from removal of useJSXTextNode ([#5091](https://github.com/typescript-eslint/typescript-eslint/issues/5091)) ([f9c3647](https://github.com/typescript-eslint/typescript-eslint/commit/f9c3647cb637c8d1ee461b471da9d817ccbde77c)) -### Bug Fixes +### Features -* **eslint-plugin:** [space-infix-ops] correct PropertyDefinition with typeAnnotation ([#5113](https://github.com/typescript-eslint/typescript-eslint/issues/5113)) ([d320174](https://github.com/typescript-eslint/typescript-eslint/commit/d320174f40a74b34e6b6e4c88128ef6e736311d8)) -* **eslint-plugin:** [space-infix-ops] regression fix for conditional types ([#5135](https://github.com/typescript-eslint/typescript-eslint/issues/5135)) ([e5238c8](https://github.com/typescript-eslint/typescript-eslint/commit/e5238c84e56e7c34174b2c6f1e3ea59456797c2f)) -* **eslint-plugin:** [space-infix-ops] regression fix for type aliases ([#5138](https://github.com/typescript-eslint/typescript-eslint/issues/5138)) ([4e13deb](https://github.com/typescript-eslint/typescript-eslint/commit/4e13deb05fbd8724996156b15b65f6a66794a7cc)) +- [4.7] support new extensions ([#5027](https://github.com/typescript-eslint/typescript-eslint/issues/5027)) ([efc147b](https://github.com/typescript-eslint/typescript-eslint/commit/efc147b04dce52ab17415b6a4ae4076b944b9036)) +- [TS4.7] support type parameters for `typeof` ([#5067](https://github.com/typescript-eslint/typescript-eslint/issues/5067)) ([836de79](https://github.com/typescript-eslint/typescript-eslint/commit/836de79e8d1bff43149168cc913a4c2b60e79bf6)) +- bump dependency ranges to TypeScript 4.7 ([#5082](https://github.com/typescript-eslint/typescript-eslint/issues/5082)) ([c4310b1](https://github.com/typescript-eslint/typescript-eslint/commit/c4310b1aac35c7d31b826f0602eca6a5900a09ee)) +- **eslint-plugin:** [ban-ts-comment] add descriptionFormat option ([#5026](https://github.com/typescript-eslint/typescript-eslint/issues/5026)) ([1fb31a4](https://github.com/typescript-eslint/typescript-eslint/commit/1fb31a4b3e05734f801ade0450fea33494e4d5e6)) +- **eslint-plugin:** [no-misused-promises] warn when spreading promises ([#5053](https://github.com/typescript-eslint/typescript-eslint/issues/5053)) ([61ffa9e](https://github.com/typescript-eslint/typescript-eslint/commit/61ffa9ed70e3cac6eca50a6c3cc5a0f1e7dec11c)) +- **eslint-plugin:** [space-infix-ops] missing error report for conditional types ([#5041](https://github.com/typescript-eslint/typescript-eslint/issues/5041)) ([0bfab6c](https://github.com/typescript-eslint/typescript-eslint/commit/0bfab6c9f5c5e243268200cf9368acf39ea099f8)) +# [5.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.25.0...v5.26.0) (2022-05-23) +### Bug Fixes +- **ast-spec:** add `SpreadElement` to `ArrayExpression.elements` ([#5025](https://github.com/typescript-eslint/typescript-eslint/issues/5025)) ([9f3121b](https://github.com/typescript-eslint/typescript-eslint/commit/9f3121b228b9c066bff7a6011aecf269ac55f17c)) +- **eslint-plugin:** [member-delimiter-style] autofixer result is not as expected when comments after the delimiter with option `delimiter: 'none'` ([#5029](https://github.com/typescript-eslint/typescript-eslint/issues/5029)) ([ed7b5f6](https://github.com/typescript-eslint/typescript-eslint/commit/ed7b5f61d93799fec3e38a87935ab9caa3abe279)) +- **eslint-plugin:** [member-delimiter-style] autofixer result is not as expected with option `delimiter: 'none'` ([#5023](https://github.com/typescript-eslint/typescript-eslint/issues/5023)) ([9e97a11](https://github.com/typescript-eslint/typescript-eslint/commit/9e97a11ecd80be5c63c980bfe8d8e57400221cec)) +- **eslint-plugin:** [prefer-readonly] correct issue with anonymus functions ([#4974](https://github.com/typescript-eslint/typescript-eslint/issues/4974)) ([952e2f0](https://github.com/typescript-eslint/typescript-eslint/commit/952e2f068862dde089ec03d3eb5452d1ee3e9271)), closes [#2590](https://github.com/typescript-eslint/typescript-eslint/issues/2590) +### Features -# [5.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.26.0...v5.27.0) (2022-05-30) +- [4.7] support instantiation expressions ([#4938](https://github.com/typescript-eslint/typescript-eslint/issues/4938)) ([79fbc77](https://github.com/typescript-eslint/typescript-eslint/commit/79fbc7743ae5dce3190f8168776e0204755390ad)) +- [4.7] support optional variance annotation ([#4831](https://github.com/typescript-eslint/typescript-eslint/issues/4831)) ([7e7b24c](https://github.com/typescript-eslint/typescript-eslint/commit/7e7b24c196e6d968e48f97f46feae5e7027e22d2)) +- **typescript-estree:** `extends` constraints for `infer` ([#4830](https://github.com/typescript-eslint/typescript-eslint/issues/4830)) ([8cbbcc3](https://github.com/typescript-eslint/typescript-eslint/commit/8cbbcc3d317779e0dcba15d3835137f38383de34)) +# [5.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.24.0...v5.25.0) (2022-05-17) ### Bug Fixes -* **eslint-plugin:** [no-type-alias] handle Template Literal Types ([#5092](https://github.com/typescript-eslint/typescript-eslint/issues/5092)) ([8febf11](https://github.com/typescript-eslint/typescript-eslint/commit/8febf11a9296d1c0d7ccdf91ef9ab92ec8dfc39c)) -* **types:** remove leftovers from removal of useJSXTextNode ([#5091](https://github.com/typescript-eslint/typescript-eslint/issues/5091)) ([f9c3647](https://github.com/typescript-eslint/typescript-eslint/commit/f9c3647cb637c8d1ee461b471da9d817ccbde77c)) - +- **eslint-plugin:** [typedef] stop enforcing rule for assignment expressions ([#4958](https://github.com/typescript-eslint/typescript-eslint/issues/4958)) ([04a216c](https://github.com/typescript-eslint/typescript-eslint/commit/04a216c39c02085fe5d555ce81bdced0e563a7c4)) +- **eslint-plugin:** strict config should not extend recommended ([#5005](https://github.com/typescript-eslint/typescript-eslint/issues/5005)) ([05d71c2](https://github.com/typescript-eslint/typescript-eslint/commit/05d71c2ebd8e072aa4e8ee3ea8521de00e47d4ca)) +- **website:** correct Presets link to be Configs ([#5004](https://github.com/typescript-eslint/typescript-eslint/issues/5004)) ([e18e91c](https://github.com/typescript-eslint/typescript-eslint/commit/e18e91c6cfb1ee93bfff3770ea4d8f807d5ced0b)) ### Features -* [4.7] support new extensions ([#5027](https://github.com/typescript-eslint/typescript-eslint/issues/5027)) ([efc147b](https://github.com/typescript-eslint/typescript-eslint/commit/efc147b04dce52ab17415b6a4ae4076b944b9036)) -* [TS4.7] support type parameters for `typeof` ([#5067](https://github.com/typescript-eslint/typescript-eslint/issues/5067)) ([836de79](https://github.com/typescript-eslint/typescript-eslint/commit/836de79e8d1bff43149168cc913a4c2b60e79bf6)) -* bump dependency ranges to TypeScript 4.7 ([#5082](https://github.com/typescript-eslint/typescript-eslint/issues/5082)) ([c4310b1](https://github.com/typescript-eslint/typescript-eslint/commit/c4310b1aac35c7d31b826f0602eca6a5900a09ee)) -* **eslint-plugin:** [ban-ts-comment] add descriptionFormat option ([#5026](https://github.com/typescript-eslint/typescript-eslint/issues/5026)) ([1fb31a4](https://github.com/typescript-eslint/typescript-eslint/commit/1fb31a4b3e05734f801ade0450fea33494e4d5e6)) -* **eslint-plugin:** [no-misused-promises] warn when spreading promises ([#5053](https://github.com/typescript-eslint/typescript-eslint/issues/5053)) ([61ffa9e](https://github.com/typescript-eslint/typescript-eslint/commit/61ffa9ed70e3cac6eca50a6c3cc5a0f1e7dec11c)) -* **eslint-plugin:** [space-infix-ops] missing error report for conditional types ([#5041](https://github.com/typescript-eslint/typescript-eslint/issues/5041)) ([0bfab6c](https://github.com/typescript-eslint/typescript-eslint/commit/0bfab6c9f5c5e243268200cf9368acf39ea099f8)) +- **eslint-plugin:** [no-empty-function] new allow option overrideMethods ([#4923](https://github.com/typescript-eslint/typescript-eslint/issues/4923)) ([13c05ae](https://github.com/typescript-eslint/typescript-eslint/commit/13c05aefb0e6531d320629e04b7207a3baebacb0)) +- **eslint-plugin:** deprecate `no-duplicate-imports` in favour of `import/no-duplicates` ([#4973](https://github.com/typescript-eslint/typescript-eslint/issues/4973)) ([1d2e41a](https://github.com/typescript-eslint/typescript-eslint/commit/1d2e41ada1979c081130d19b229c82bf1a69b7b4)) +- update to TypeScript 4.7-rc ([#4829](https://github.com/typescript-eslint/typescript-eslint/issues/4829)) ([6fe783c](https://github.com/typescript-eslint/typescript-eslint/commit/6fe783c20aebe26ef42b526e4a59a9be84dd5643)) +# [5.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.23.0...v5.24.0) (2022-05-16) +### Bug Fixes +- **eslint-plugin:** [array-type] in fixer add missing parens for constructor types [#4756](https://github.com/typescript-eslint/typescript-eslint/issues/4756) ([#4971](https://github.com/typescript-eslint/typescript-eslint/issues/4971)) ([0377070](https://github.com/typescript-eslint/typescript-eslint/commit/03770708900da663eb64c19465b3f937bab55b3d)) +- **website:** missing colon before tip notes in configs.md ([#4982](https://github.com/typescript-eslint/typescript-eslint/issues/4982)) ([f3a1aba](https://github.com/typescript-eslint/typescript-eslint/commit/f3a1aba6704c5978c9f6002d6b1fc076421103d1)) +### Features -# [5.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.25.0...v5.26.0) (2022-05-23) +- **eslint-plugin:** Add BigInt object type to default ban-types list ([#4970](https://github.com/typescript-eslint/typescript-eslint/issues/4970)) ([1867728](https://github.com/typescript-eslint/typescript-eslint/commit/1867728ba104a6a21941ed300828110964a43b96)) +- **eslint-plugin:** add new 'strict' config ([#4706](https://github.com/typescript-eslint/typescript-eslint/issues/4706)) ([4a500b2](https://github.com/typescript-eslint/typescript-eslint/commit/4a500b2d92a91873dbb729793d1ee1c36ef06ed8)) +# [5.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.22.0...v5.23.0) (2022-05-09) ### Bug Fixes -* **ast-spec:** add `SpreadElement` to `ArrayExpression.elements` ([#5025](https://github.com/typescript-eslint/typescript-eslint/issues/5025)) ([9f3121b](https://github.com/typescript-eslint/typescript-eslint/commit/9f3121b228b9c066bff7a6011aecf269ac55f17c)) -* **eslint-plugin:** [member-delimiter-style] autofixer result is not as expected when comments after the delimiter with option `delimiter: 'none'` ([#5029](https://github.com/typescript-eslint/typescript-eslint/issues/5029)) ([ed7b5f6](https://github.com/typescript-eslint/typescript-eslint/commit/ed7b5f61d93799fec3e38a87935ab9caa3abe279)) -* **eslint-plugin:** [member-delimiter-style] autofixer result is not as expected with option `delimiter: 'none'` ([#5023](https://github.com/typescript-eslint/typescript-eslint/issues/5023)) ([9e97a11](https://github.com/typescript-eslint/typescript-eslint/commit/9e97a11ecd80be5c63c980bfe8d8e57400221cec)) -* **eslint-plugin:** [prefer-readonly] correct issue with anonymus functions ([#4974](https://github.com/typescript-eslint/typescript-eslint/issues/4974)) ([952e2f0](https://github.com/typescript-eslint/typescript-eslint/commit/952e2f068862dde089ec03d3eb5452d1ee3e9271)), closes [#2590](https://github.com/typescript-eslint/typescript-eslint/issues/2590) - +- **ast-spec:** correct `AwaitExpression.argument` type ([#4880](https://github.com/typescript-eslint/typescript-eslint/issues/4880)) ([3ec5f53](https://github.com/typescript-eslint/typescript-eslint/commit/3ec5f53bad79b133ef5dee71c402160b3acf13cf)) +- **eslint-plugin:** [no-restricted-imports] allow type import as long as there's one matching pattern ([#4898](https://github.com/typescript-eslint/typescript-eslint/issues/4898)) ([0419d28](https://github.com/typescript-eslint/typescript-eslint/commit/0419d287b637e805c33036a45760badc2498e19b)) +- **eslint-plugin:** [no-unnecessary-type-constraint] change to suggestion fix, fix multiple trailing comma failures ([#4901](https://github.com/typescript-eslint/typescript-eslint/issues/4901)) ([4507ac8](https://github.com/typescript-eslint/typescript-eslint/commit/4507ac84c76da0ced43b6679305afe1891e7afca)) ### Features -* [4.7] support instantiation expressions ([#4938](https://github.com/typescript-eslint/typescript-eslint/issues/4938)) ([79fbc77](https://github.com/typescript-eslint/typescript-eslint/commit/79fbc7743ae5dce3190f8168776e0204755390ad)) -* [4.7] support optional variance annotation ([#4831](https://github.com/typescript-eslint/typescript-eslint/issues/4831)) ([7e7b24c](https://github.com/typescript-eslint/typescript-eslint/commit/7e7b24c196e6d968e48f97f46feae5e7027e22d2)) -* **typescript-estree:** `extends` constraints for `infer` ([#4830](https://github.com/typescript-eslint/typescript-eslint/issues/4830)) ([8cbbcc3](https://github.com/typescript-eslint/typescript-eslint/commit/8cbbcc3d317779e0dcba15d3835137f38383de34)) +- **utils:** update eslint types ([#4896](https://github.com/typescript-eslint/typescript-eslint/issues/4896)) ([da48527](https://github.com/typescript-eslint/typescript-eslint/commit/da485279f13cb95db1ee131a4f9c5367d54020fe)) +# [5.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.21.0...v5.22.0) (2022-05-02) +### Bug Fixes +- add rule to vscode settings ([#4881](https://github.com/typescript-eslint/typescript-eslint/issues/4881)) ([3eab889](https://github.com/typescript-eslint/typescript-eslint/commit/3eab889022c9d1617f275017d6951f663ea57f24)) +- **eslint-plugin:** [comma-spacing] verify `nextToken` exists ([#4868](https://github.com/typescript-eslint/typescript-eslint/issues/4868)) ([23746f8](https://github.com/typescript-eslint/typescript-eslint/commit/23746f8babace7c2354368d6fb0881be26e19c41)) +### Features -# [5.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.24.0...v5.25.0) (2022-05-17) +- **ast-spec:** add fixture test framework and some initial fixtures ([#3258](https://github.com/typescript-eslint/typescript-eslint/issues/3258)) ([f3cf87b](https://github.com/typescript-eslint/typescript-eslint/commit/f3cf87bf20fd0542f92a96a318aa9ee5bf23c1f6)) +- **eslint-plugin:** [no-duplicate-enum-values] add rule ([#4833](https://github.com/typescript-eslint/typescript-eslint/issues/4833)) ([5899164](https://github.com/typescript-eslint/typescript-eslint/commit/5899164b35d91106512a2720b23ba92e1893132f)) +# [5.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.20.0...v5.21.0) (2022-04-25) ### Bug Fixes -* **eslint-plugin:** [typedef] stop enforcing rule for assignment expressions ([#4958](https://github.com/typescript-eslint/typescript-eslint/issues/4958)) ([04a216c](https://github.com/typescript-eslint/typescript-eslint/commit/04a216c39c02085fe5d555ce81bdced0e563a7c4)) -* **eslint-plugin:** strict config should not extend recommended ([#5005](https://github.com/typescript-eslint/typescript-eslint/issues/5005)) ([05d71c2](https://github.com/typescript-eslint/typescript-eslint/commit/05d71c2ebd8e072aa4e8ee3ea8521de00e47d4ca)) -* **website:** correct Presets link to be Configs ([#5004](https://github.com/typescript-eslint/typescript-eslint/issues/5004)) ([e18e91c](https://github.com/typescript-eslint/typescript-eslint/commit/e18e91c6cfb1ee93bfff3770ea4d8f807d5ced0b)) +- **eslint-plugin:** [no-misused-promises] prioritize false returns when checking whether a function returns only void ([#4841](https://github.com/typescript-eslint/typescript-eslint/issues/4841)) ([ccadb60](https://github.com/typescript-eslint/typescript-eslint/commit/ccadb6075d6977c4921ffc09fa40f515f4d497c5)) +- **eslint-plugin:** [no-namespace] fix false positive for exported namespaces when allowDeclarations=true ([#4844](https://github.com/typescript-eslint/typescript-eslint/issues/4844)) ([4e7c9be](https://github.com/typescript-eslint/typescript-eslint/commit/4e7c9be6ff7e2448f4151563d7921cd285c2e349)) +- **eslint-plugin:** [space-infix-ops] fix no error when right type is function ([#4848](https://github.com/typescript-eslint/typescript-eslint/issues/4848)) ([d74d559](https://github.com/typescript-eslint/typescript-eslint/commit/d74d559c25e336c3ebe917bf5c43e14ffa2de694)) + +### Features + +- **eslint-plugin:** [parameter-properties] add rule to replace `no-parameter-properties` ([#4622](https://github.com/typescript-eslint/typescript-eslint/issues/4622)) ([88ed9ec](https://github.com/typescript-eslint/typescript-eslint/commit/88ed9ec9d6b971a9533565920fdcd6890ea941e9)) +# [5.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.19.0...v5.20.0) (2022-04-18) ### Features -* **eslint-plugin:** [no-empty-function] new allow option overrideMethods ([#4923](https://github.com/typescript-eslint/typescript-eslint/issues/4923)) ([13c05ae](https://github.com/typescript-eslint/typescript-eslint/commit/13c05aefb0e6531d320629e04b7207a3baebacb0)) -* **eslint-plugin:** deprecate `no-duplicate-imports` in favour of `import/no-duplicates` ([#4973](https://github.com/typescript-eslint/typescript-eslint/issues/4973)) ([1d2e41a](https://github.com/typescript-eslint/typescript-eslint/commit/1d2e41ada1979c081130d19b229c82bf1a69b7b4)) -* update to TypeScript 4.7-rc ([#4829](https://github.com/typescript-eslint/typescript-eslint/issues/4829)) ([6fe783c](https://github.com/typescript-eslint/typescript-eslint/commit/6fe783c20aebe26ef42b526e4a59a9be84dd5643)) +- **eslint-plugin:** [no-magic-numbers] ignoreTypeIndexes option ([#4789](https://github.com/typescript-eslint/typescript-eslint/issues/4789)) ([5e79451](https://github.com/typescript-eslint/typescript-eslint/commit/5e794512bf124c39de76d4e2cf8a3d6cfb08f1a8)) +# [5.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.18.0...v5.19.0) (2022-04-11) +### Bug Fixes +- **eslint-plugin:** update code to use estree range instead of ts pos/end [#4723](https://github.com/typescript-eslint/typescript-eslint/issues/4723) ([#4790](https://github.com/typescript-eslint/typescript-eslint/issues/4790)) ([a1e9fc4](https://github.com/typescript-eslint/typescript-eslint/commit/a1e9fc4cb19e7655613ebe6f4dd911b5427b0367)) +### Features -# [5.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.23.0...v5.24.0) (2022-05-16) +- **eslint-plugin:** [unified-signatures] add `ignoreDifferentlyNamedParameters` option ([#4659](https://github.com/typescript-eslint/typescript-eslint/issues/4659)) ([fdf95e0](https://github.com/typescript-eslint/typescript-eslint/commit/fdf95e02c45e137325c9ddd9d30e7f6b404f4514)) +- **eslint-plugin:** add support for valid number and bigint intersections in restrict-plus-operands rule ([#4795](https://github.com/typescript-eslint/typescript-eslint/issues/4795)) ([19c600a](https://github.com/typescript-eslint/typescript-eslint/commit/19c600a3dd485669cb87ae8f81b010e65eee1df8)) +# [5.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.17.0...v5.18.0) (2022-04-04) ### Bug Fixes -* **eslint-plugin:** [array-type] in fixer add missing parens for constructor types [#4756](https://github.com/typescript-eslint/typescript-eslint/issues/4756) ([#4971](https://github.com/typescript-eslint/typescript-eslint/issues/4971)) ([0377070](https://github.com/typescript-eslint/typescript-eslint/commit/03770708900da663eb64c19465b3f937bab55b3d)) -* **website:** missing colon before tip notes in configs.md ([#4982](https://github.com/typescript-eslint/typescript-eslint/issues/4982)) ([f3a1aba](https://github.com/typescript-eslint/typescript-eslint/commit/f3a1aba6704c5978c9f6002d6b1fc076421103d1)) - +- **eslint-plugin:** method-signature-style respect getter signature ([#4777](https://github.com/typescript-eslint/typescript-eslint/issues/4777)) ([12dd670](https://github.com/typescript-eslint/typescript-eslint/commit/12dd670bc8621867c5105d8892dba9f9550a2f35)) +- **visitor-keys:** add missing visitor keys ([#4731](https://github.com/typescript-eslint/typescript-eslint/issues/4731)) ([bb575a0](https://github.com/typescript-eslint/typescript-eslint/commit/bb575a0763f39b9b988a7c20afee7b5eeb64cba7)) ### Features -* **eslint-plugin:** Add BigInt object type to default ban-types list ([#4970](https://github.com/typescript-eslint/typescript-eslint/issues/4970)) ([1867728](https://github.com/typescript-eslint/typescript-eslint/commit/1867728ba104a6a21941ed300828110964a43b96)) -* **eslint-plugin:** add new 'strict' config ([#4706](https://github.com/typescript-eslint/typescript-eslint/issues/4706)) ([4a500b2](https://github.com/typescript-eslint/typescript-eslint/commit/4a500b2d92a91873dbb729793d1ee1c36ef06ed8)) +- **eslint-plugin:** [no-shadow] ignoreOnInitialization option ([#4603](https://github.com/typescript-eslint/typescript-eslint/issues/4603)) ([068ea9b](https://github.com/typescript-eslint/typescript-eslint/commit/068ea9b8eb3072fb46a6035f29c68ce96a69008d)) +- **eslint-plugin:** [no-this-alias] report on assignment expressions ([#4718](https://github.com/typescript-eslint/typescript-eslint/issues/4718)) ([8329498](https://github.com/typescript-eslint/typescript-eslint/commit/83294989dad543351a26e95be8d11a91d348679a)) +# [5.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.16.0...v5.17.0) (2022-03-28) +### Bug Fixes +- code container hiding navigation menu ([#4707](https://github.com/typescript-eslint/typescript-eslint/issues/4707)) ([96bc69a](https://github.com/typescript-eslint/typescript-eslint/commit/96bc69a652c7f6f474a39f1e9783e7fbd446696a)) +- revert "chore: Bump cypress from 8.3.0 to 9.5.2", and ignore cypress for now ([#4740](https://github.com/typescript-eslint/typescript-eslint/issues/4740)) ([cf5f5c4](https://github.com/typescript-eslint/typescript-eslint/commit/cf5f5c441ab0c4fb056bd688795ffc55e026627a)), closes [#4710](https://github.com/typescript-eslint/typescript-eslint/issues/4710) +### Features -# [5.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.22.0...v5.23.0) (2022-05-09) +- **eslint-plugin:** [no-unused-vars] add destructuredArrayIgnorePattern options ([#4748](https://github.com/typescript-eslint/typescript-eslint/issues/4748)) ([6f8db8b](https://github.com/typescript-eslint/typescript-eslint/commit/6f8db8b64821d280fff408c1704a9adde682ed69)) +# [5.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.15.0...v5.16.0) (2022-03-21) ### Bug Fixes -* **ast-spec:** correct `AwaitExpression.argument` type ([#4880](https://github.com/typescript-eslint/typescript-eslint/issues/4880)) ([3ec5f53](https://github.com/typescript-eslint/typescript-eslint/commit/3ec5f53bad79b133ef5dee71c402160b3acf13cf)) -* **eslint-plugin:** [no-restricted-imports] allow type import as long as there's one matching pattern ([#4898](https://github.com/typescript-eslint/typescript-eslint/issues/4898)) ([0419d28](https://github.com/typescript-eslint/typescript-eslint/commit/0419d287b637e805c33036a45760badc2498e19b)) -* **eslint-plugin:** [no-unnecessary-type-constraint] change to suggestion fix, fix multiple trailing comma failures ([#4901](https://github.com/typescript-eslint/typescript-eslint/issues/4901)) ([4507ac8](https://github.com/typescript-eslint/typescript-eslint/commit/4507ac84c76da0ced43b6679305afe1891e7afca)) - +- **eslint-plugin:** [consistent-type-assertions] enforce assertionStyle for `const` assertions ([#4685](https://github.com/typescript-eslint/typescript-eslint/issues/4685)) ([8ec05be](https://github.com/typescript-eslint/typescript-eslint/commit/8ec05bed0fed0dcd48b087acd5ab5a6132bf3b09)) +- **scope-manager:** incorrect reference for this within a jsx identifier ([#4535](https://github.com/typescript-eslint/typescript-eslint/issues/4535)) ([dd49280](https://github.com/typescript-eslint/typescript-eslint/commit/dd49280e50cb2f5bd26dc07210551bc1fda120af)) +- **utils:** RuleTester: Only call afterAll if defined ([#4656](https://github.com/typescript-eslint/typescript-eslint/issues/4656)) ([0fe0683](https://github.com/typescript-eslint/typescript-eslint/commit/0fe0683effe4c7390806a72c6aa7795445a67929)) ### Features -* **utils:** update eslint types ([#4896](https://github.com/typescript-eslint/typescript-eslint/issues/4896)) ([da48527](https://github.com/typescript-eslint/typescript-eslint/commit/da485279f13cb95db1ee131a4f9c5367d54020fe)) - - +- **eslint-plugin:** [prefer-optional-chain] support logical with empty object ([#4430](https://github.com/typescript-eslint/typescript-eslint/issues/4430)) ([d21cfe0](https://github.com/typescript-eslint/typescript-eslint/commit/d21cfe0f4b7d3041948b1b6e0cd56c5ec34b2b3f)) +# [5.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.14.0...v5.15.0) (2022-03-14) +### Features -# [5.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.21.0...v5.22.0) (2022-05-02) +- **parser:** add `parserOptions.emitDecoratorMetadata` ([#4646](https://github.com/typescript-eslint/typescript-eslint/issues/4646)) ([e3dd343](https://github.com/typescript-eslint/typescript-eslint/commit/e3dd343e51e3b7772e825a609735a04c921c1ec5)) +# [5.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.13.0...v5.14.0) (2022-03-07) ### Bug Fixes -* add rule to vscode settings ([#4881](https://github.com/typescript-eslint/typescript-eslint/issues/4881)) ([3eab889](https://github.com/typescript-eslint/typescript-eslint/commit/3eab889022c9d1617f275017d6951f663ea57f24)) -* **eslint-plugin:** [comma-spacing] verify `nextToken` exists ([#4868](https://github.com/typescript-eslint/typescript-eslint/issues/4868)) ([23746f8](https://github.com/typescript-eslint/typescript-eslint/commit/23746f8babace7c2354368d6fb0881be26e19c41)) - +- **eslint-plugin:** [naming-convention] cover case that requires quotes ([#4582](https://github.com/typescript-eslint/typescript-eslint/issues/4582)) ([3ea0947](https://github.com/typescript-eslint/typescript-eslint/commit/3ea09477debec9f1593e4d3857e153570b488f4d)) +- **eslint-plugin:** [no-misused-promises] factor thenable returning function overload signatures ([#4620](https://github.com/typescript-eslint/typescript-eslint/issues/4620)) ([56a09e9](https://github.com/typescript-eslint/typescript-eslint/commit/56a09e98f171662d25ae2692be703a8bbbd3a3a5)) +- **eslint-plugin:** [prefer-readonly-parameter-types] handle class sharp private field and member without throwing error ([#4343](https://github.com/typescript-eslint/typescript-eslint/issues/4343)) ([a65713a](https://github.com/typescript-eslint/typescript-eslint/commit/a65713ae138e56555d01a9e8e5179221a2f39e75)) +- **eslint-plugin:** [return-await] correct autofixer in binary expression ([#4401](https://github.com/typescript-eslint/typescript-eslint/issues/4401)) ([5fa2fad](https://github.com/typescript-eslint/typescript-eslint/commit/5fa2fade385cc526a962212b94410c58e4c31078)) ### Features -* **ast-spec:** add fixture test framework and some initial fixtures ([#3258](https://github.com/typescript-eslint/typescript-eslint/issues/3258)) ([f3cf87b](https://github.com/typescript-eslint/typescript-eslint/commit/f3cf87bf20fd0542f92a96a318aa9ee5bf23c1f6)) -* **eslint-plugin:** [no-duplicate-enum-values] add rule ([#4833](https://github.com/typescript-eslint/typescript-eslint/issues/4833)) ([5899164](https://github.com/typescript-eslint/typescript-eslint/commit/5899164b35d91106512a2720b23ba92e1893132f)) +- **eslint-plugin:** [no-misused-promises] add granular options within `checksVoidReturns` ([#4623](https://github.com/typescript-eslint/typescript-eslint/issues/4623)) ([1085177](https://github.com/typescript-eslint/typescript-eslint/commit/10851772696f982b585e0dade728f7980fdc6cc0)) +- TypeScript 4.6 ([#4615](https://github.com/typescript-eslint/typescript-eslint/issues/4615)) ([a02c63a](https://github.com/typescript-eslint/typescript-eslint/commit/a02c63a264e5a6c3557468a8eff48d34ca2b718a)) +# [5.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.1...v5.13.0) (2022-02-28) +### Bug Fixes +- **eslint-plugin:** [sort-type-union-intersection-members] Wrap the constructorType in parentheses ([#4590](https://github.com/typescript-eslint/typescript-eslint/issues/4590)) ([851bb90](https://github.com/typescript-eslint/typescript-eslint/commit/851bb90216e20b7679efc891dc445e6152d4837f)) +### Features -# [5.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.20.0...v5.21.0) (2022-04-25) +- **eslint-plugin:** [no-misused-promises] check more places for checksVoidReturn ([#4541](https://github.com/typescript-eslint/typescript-eslint/issues/4541)) ([052cf51](https://github.com/typescript-eslint/typescript-eslint/commit/052cf51fe663283afe89dc7bf97c947e750df095)) +- **eslint-plugin:** add `no-redundant-type-constituents` rule ([#4378](https://github.com/typescript-eslint/typescript-eslint/issues/4378)) ([63d051e](https://github.com/typescript-eslint/typescript-eslint/commit/63d051eed29dcf71015a23992feac0a8f92717a0)) +- **eslint-plugin:** add `no-useless-empty-export` rule ([#4380](https://github.com/typescript-eslint/typescript-eslint/issues/4380)) ([823b945](https://github.com/typescript-eslint/typescript-eslint/commit/823b945c8f9e83d0246a2a5d07519f01e1a64518)) +- **eslint-plugin:** add extension rule `space-before-blocks` ([#1606](https://github.com/typescript-eslint/typescript-eslint/issues/1606)) ([#4184](https://github.com/typescript-eslint/typescript-eslint/issues/4184)) ([208b6d0](https://github.com/typescript-eslint/typescript-eslint/commit/208b6d02252dff2bf272329d3e4a4a82e56c52c0)) +- **eslint-plugin:** added member group support to member-ordering rule ([#4538](https://github.com/typescript-eslint/typescript-eslint/issues/4538)) ([6afcaea](https://github.com/typescript-eslint/typescript-eslint/commit/6afcaea0160a1ccd1c6483ca677c544ca1b8cb4f)) +- **utils:** expose `ast-utils`' helpers ([#4503](https://github.com/typescript-eslint/typescript-eslint/issues/4503)) ([f106e4b](https://github.com/typescript-eslint/typescript-eslint/commit/f106e4b95e824ebb68141bce3d3207448d50c860)) +- **utils:** extract `isNotTokenOfTypeWithConditions` out of `ast-utils`' `predicates` ([#4502](https://github.com/typescript-eslint/typescript-eslint/issues/4502)) ([66501d6](https://github.com/typescript-eslint/typescript-eslint/commit/66501d6dd7e97c22c671efaa6d1ba8237907e417)) +## [5.12.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.0...v5.12.1) (2022-02-21) ### Bug Fixes -* **eslint-plugin:** [no-misused-promises] prioritize false returns when checking whether a function returns only void ([#4841](https://github.com/typescript-eslint/typescript-eslint/issues/4841)) ([ccadb60](https://github.com/typescript-eslint/typescript-eslint/commit/ccadb6075d6977c4921ffc09fa40f515f4d497c5)) -* **eslint-plugin:** [no-namespace] fix false positive for exported namespaces when allowDeclarations=true ([#4844](https://github.com/typescript-eslint/typescript-eslint/issues/4844)) ([4e7c9be](https://github.com/typescript-eslint/typescript-eslint/commit/4e7c9be6ff7e2448f4151563d7921cd285c2e349)) -* **eslint-plugin:** [space-infix-ops] fix no error when right type is function ([#4848](https://github.com/typescript-eslint/typescript-eslint/issues/4848)) ([d74d559](https://github.com/typescript-eslint/typescript-eslint/commit/d74d559c25e336c3ebe917bf5c43e14ffa2de694)) - +- **eslint-plugin:** [no-unnecessary-type-arguments] fix comparison of types ([#4555](https://github.com/typescript-eslint/typescript-eslint/issues/4555)) ([fc3936e](https://github.com/typescript-eslint/typescript-eslint/commit/fc3936e99712374a707ce9e0101bc641807b9ea6)) -### Features +# [5.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.11.0...v5.12.0) (2022-02-14) -* **eslint-plugin:** [parameter-properties] add rule to replace `no-parameter-properties` ([#4622](https://github.com/typescript-eslint/typescript-eslint/issues/4622)) ([88ed9ec](https://github.com/typescript-eslint/typescript-eslint/commit/88ed9ec9d6b971a9533565920fdcd6890ea941e9)) +### Bug Fixes +- **eslint-plugin:** [init-declarations] fix nested namespace ([#4544](https://github.com/typescript-eslint/typescript-eslint/issues/4544)) ([fe910e6](https://github.com/typescript-eslint/typescript-eslint/commit/fe910e61ca4bb42be3be9acb8ddcec73206754c2)) +- **eslint-plugin:** [no-unnecessary-type-arguments] Use Symbol to check if it's the same type ([#4543](https://github.com/typescript-eslint/typescript-eslint/issues/4543)) ([5b7d8df](https://github.com/typescript-eslint/typescript-eslint/commit/5b7d8df149be6554c863cdd5b73c0b0b0a7960db)) +- support nested object deconstructuring with type annotation ([#4548](https://github.com/typescript-eslint/typescript-eslint/issues/4548)) ([4da9278](https://github.com/typescript-eslint/typescript-eslint/commit/4da9278c80706f420d4c15a71c11c7b11d935643)) +### Features +- add checking property definition for allowNames option ([#4542](https://github.com/typescript-eslint/typescript-eslint/issues/4542)) ([e32bef6](https://github.com/typescript-eslint/typescript-eslint/commit/e32bef6f6b74228c95e54a5cba1cde53d5e40623)) +# [5.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.2...v5.11.0) (2022-02-07) -# [5.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.19.0...v5.20.0) (2022-04-18) +### Bug Fixes +- **eslint-plugin:** [no-magic-numbers] fix invalid schema merging ([#4517](https://github.com/typescript-eslint/typescript-eslint/issues/4517)) ([b95f796](https://github.com/typescript-eslint/typescript-eslint/commit/b95f79697acdd16347dc102bcb8311fe83746779)) +- **eslint-plugin:** [non-nullable-type-assertion-style] fix false positive when asserting to a generic type that might be nullish ([#4509](https://github.com/typescript-eslint/typescript-eslint/issues/4509)) ([4209362](https://github.com/typescript-eslint/typescript-eslint/commit/420936274603d8fee0631cdb3b58874cb3cc59d7)) ### Features -* **eslint-plugin:** [no-magic-numbers] ignoreTypeIndexes option ([#4789](https://github.com/typescript-eslint/typescript-eslint/issues/4789)) ([5e79451](https://github.com/typescript-eslint/typescript-eslint/commit/5e794512bf124c39de76d4e2cf8a3d6cfb08f1a8)) +- **eslint-plugin:** [explicit-function-return-type] add allowedNames ([#4440](https://github.com/typescript-eslint/typescript-eslint/issues/4440)) ([936e252](https://github.com/typescript-eslint/typescript-eslint/commit/936e252e30cfcebdaf971cf0f66a3031e236a41c)) +## [5.10.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.1...v5.10.2) (2022-01-31) +### Bug Fixes +- **eslint-plugin:** [no-restricted-imports] allow relative type imports with patterns configured ([#4494](https://github.com/typescript-eslint/typescript-eslint/issues/4494)) ([4a6d217](https://github.com/typescript-eslint/typescript-eslint/commit/4a6d217ae8a8f5fa1dd4bd3e3e66ba7519b4a287)) +## [5.10.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.0...v5.10.1) (2022-01-24) -# [5.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.18.0...v5.19.0) (2022-04-11) +**Note:** Version bump only for package @typescript-eslint/typescript-eslint +# [5.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.1...v5.10.0) (2022-01-17) ### Bug Fixes -* **eslint-plugin:** update code to use estree range instead of ts pos/end [#4723](https://github.com/typescript-eslint/typescript-eslint/issues/4723) ([#4790](https://github.com/typescript-eslint/typescript-eslint/issues/4790)) ([a1e9fc4](https://github.com/typescript-eslint/typescript-eslint/commit/a1e9fc4cb19e7655613ebe6f4dd911b5427b0367)) - +- **eslint-plugin:** [explicit-function-return-type] support AllowTypedFunctionExpression within AllowHigherOrderFunction ([#4250](https://github.com/typescript-eslint/typescript-eslint/issues/4250)) ([d053cde](https://github.com/typescript-eslint/typescript-eslint/commit/d053cde3e8b5bf9ba1c22fd64a7456d672ef77ca)) +- **eslint-plugin:** [no-extra-semi] false negatives when used with eslint 8.3.0 ([#4458](https://github.com/typescript-eslint/typescript-eslint/issues/4458)) ([f4016c2](https://github.com/typescript-eslint/typescript-eslint/commit/f4016c24f9023e8a42def9501b68c4a908cbfede)) +- **eslint-plugin:** [no-invalid-this] crash when used with eslint 8.7.0 ([#4448](https://github.com/typescript-eslint/typescript-eslint/issues/4448)) ([e56f1e5](https://github.com/typescript-eslint/typescript-eslint/commit/e56f1e5d52fcbf3caae43034872e0b3181871689)) +- **eslint-plugin:** [no-magic-numbers] handle bigint in class props ([#4411](https://github.com/typescript-eslint/typescript-eslint/issues/4411)) ([c8e650f](https://github.com/typescript-eslint/typescript-eslint/commit/c8e650f0c124d24b24beaeb376eaf61ee8d9e6fb)) +- **type-utils:** check IndexSignature internals when checking isTypeReadonly ([#4417](https://github.com/typescript-eslint/typescript-eslint/issues/4417)) ([ef3147c](https://github.com/typescript-eslint/typescript-eslint/commit/ef3147cf73767ddece91ce57f6028a83ce074b60)), closes [#4410](https://github.com/typescript-eslint/typescript-eslint/issues/4410) [#3714](https://github.com/typescript-eslint/typescript-eslint/issues/3714) +- **type-utils:** intersection types involving readonly arrays are now handled in most cases ([#4429](https://github.com/typescript-eslint/typescript-eslint/issues/4429)) ([5046882](https://github.com/typescript-eslint/typescript-eslint/commit/5046882025e3bc8cb122ecef703aebd0b5e79017)) +- **type-utils:** isTypeReadonly now handles conditional types ([#4421](https://github.com/typescript-eslint/typescript-eslint/issues/4421)) ([39a6806](https://github.com/typescript-eslint/typescript-eslint/commit/39a6806c61a48bbca93f9ffb965dd8b3fe0575b3)) +- **type-utils:** union types always being marked as readonly ([#4419](https://github.com/typescript-eslint/typescript-eslint/issues/4419)) ([99ab193](https://github.com/typescript-eslint/typescript-eslint/commit/99ab193bb02f181bed4ed917b1d121ed189d3fe4)) ### Features -* **eslint-plugin:** [unified-signatures] add `ignoreDifferentlyNamedParameters` option ([#4659](https://github.com/typescript-eslint/typescript-eslint/issues/4659)) ([fdf95e0](https://github.com/typescript-eslint/typescript-eslint/commit/fdf95e02c45e137325c9ddd9d30e7f6b404f4514)) -* **eslint-plugin:** add support for valid number and bigint intersections in restrict-plus-operands rule ([#4795](https://github.com/typescript-eslint/typescript-eslint/issues/4795)) ([19c600a](https://github.com/typescript-eslint/typescript-eslint/commit/19c600a3dd485669cb87ae8f81b010e65eee1df8)) +- rename `experimental-utils` to `utils` and make `experimental-utils` an alias to the new package ([#4172](https://github.com/typescript-eslint/typescript-eslint/issues/4172)) ([1d55a75](https://github.com/typescript-eslint/typescript-eslint/commit/1d55a7511b38d8e2b2eabe59f639e0a865e6c93f)) +- **type-utils:** make isTypeReadonly's options param optional ([#4415](https://github.com/typescript-eslint/typescript-eslint/issues/4415)) ([3a07a56](https://github.com/typescript-eslint/typescript-eslint/commit/3a07a563c987ff25f6cd8925eeeb2ede47cc19e8)) +## [5.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.0...v5.9.1) (2022-01-10) +**Note:** Version bump only for package @typescript-eslint/typescript-eslint +# [5.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.1...v5.9.0) (2022-01-03) +### Features -# [5.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.17.0...v5.18.0) (2022-04-04) +- **experimental-utils:** move isTypeReadonly from eslint-plugin to experimental-utils ([#3658](https://github.com/typescript-eslint/typescript-eslint/issues/3658)) ([a9eb0b9](https://github.com/typescript-eslint/typescript-eslint/commit/a9eb0b9eb2db291ea36065ec34f84bf5c5504b43)) +## [5.8.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.0...v5.8.1) (2021-12-27) ### Bug Fixes -* **eslint-plugin:** method-signature-style respect getter signature ([#4777](https://github.com/typescript-eslint/typescript-eslint/issues/4777)) ([12dd670](https://github.com/typescript-eslint/typescript-eslint/commit/12dd670bc8621867c5105d8892dba9f9550a2f35)) -* **visitor-keys:** add missing visitor keys ([#4731](https://github.com/typescript-eslint/typescript-eslint/issues/4731)) ([bb575a0](https://github.com/typescript-eslint/typescript-eslint/commit/bb575a0763f39b9b988a7c20afee7b5eeb64cba7)) +- **eslint-plugin:** [consistent-indexed-object-style] do not report for circular references ([#4347](https://github.com/typescript-eslint/typescript-eslint/issues/4347)) ([6edebcd](https://github.com/typescript-eslint/typescript-eslint/commit/6edebcda00053eecf7b3e55eeb3fe5d7fb9e7db7)) +- **eslint-plugin:** [consistent-type-definitions] correct fixer with declare keyword ([#4334](https://github.com/typescript-eslint/typescript-eslint/issues/4334)) ([0cd911a](https://github.com/typescript-eslint/typescript-eslint/commit/0cd911a916805d3b1f8043584e4685f3edd5c427)) +- **eslint-plugin:** [padding-line-between-statements] make function overloading is also processed ([#4345](https://github.com/typescript-eslint/typescript-eslint/issues/4345)) ([d31ec26](https://github.com/typescript-eslint/typescript-eslint/commit/d31ec264fe5f5cd27e8f522a485e106889f2d380)) +# [5.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.7.0...v5.8.0) (2021-12-20) -### Features - -* **eslint-plugin:** [no-shadow] ignoreOnInitialization option ([#4603](https://github.com/typescript-eslint/typescript-eslint/issues/4603)) ([068ea9b](https://github.com/typescript-eslint/typescript-eslint/commit/068ea9b8eb3072fb46a6035f29c68ce96a69008d)) -* **eslint-plugin:** [no-this-alias] report on assignment expressions ([#4718](https://github.com/typescript-eslint/typescript-eslint/issues/4718)) ([8329498](https://github.com/typescript-eslint/typescript-eslint/commit/83294989dad543351a26e95be8d11a91d348679a)) +### Bug Fixes +- **eslint-plugin:** [no-implied-eval] improve performance ([#4313](https://github.com/typescript-eslint/typescript-eslint/issues/4313)) ([e344596](https://github.com/typescript-eslint/typescript-eslint/commit/e3445967de6ed73e6b2334380236aed8a0ee6e4f)) +- **eslint-plugin:** [padding-line-between-statements] `type` StatementTypes can't differenciate from variable ([#4270](https://github.com/typescript-eslint/typescript-eslint/issues/4270)) ([bfc4324](https://github.com/typescript-eslint/typescript-eslint/commit/bfc4324f4cda24e30b2d39d5b70f7554f2b6bf81)) +- **eslint-plugin:** [strict-boolean-expression] false positive for truthy boolean ([#4275](https://github.com/typescript-eslint/typescript-eslint/issues/4275)) ([72c2e41](https://github.com/typescript-eslint/typescript-eslint/commit/72c2e418a4180f6db5795ebb42cbc095f5c53c37)) +- **eslint-plugin:** `array-type` mark `AST_NODE_TYPES.TSBigIntKeyword` as simple ([#4274](https://github.com/typescript-eslint/typescript-eslint/issues/4274)) ([74e544e](https://github.com/typescript-eslint/typescript-eslint/commit/74e544e487328e56fcb7aef048a78beaad593ea0)) +- **eslint-plugin:** handle method overloading in `semi` ([#4318](https://github.com/typescript-eslint/typescript-eslint/issues/4318)) ([3b87b49](https://github.com/typescript-eslint/typescript-eslint/commit/3b87b49ea8d62c2f4f3bee7494500b5ad44fcbc1)) +- **experimental-utils:** support immutable members ([#3844](https://github.com/typescript-eslint/typescript-eslint/issues/3844)) ([3d33a77](https://github.com/typescript-eslint/typescript-eslint/commit/3d33a77c57e5b752edf6f35ed152038bdb230b79)) +### Features +- **eslint-plugin:** [no-throw-literal] add options to to disallow `any`/`unknown` ([#4207](https://github.com/typescript-eslint/typescript-eslint/issues/4207)) ([ff0adf9](https://github.com/typescript-eslint/typescript-eslint/commit/ff0adf9e0bfbf71667c51de0a84038586e4cbfd1)) +- **eslint-plugin:** [restrict-plus-operand] add allowAny option ([#4260](https://github.com/typescript-eslint/typescript-eslint/issues/4260)) ([2788545](https://github.com/typescript-eslint/typescript-eslint/commit/27885456c577dfada52d298857f406f0f332c405)) +# [5.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.6.0...v5.7.0) (2021-12-13) -# [5.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.16.0...v5.17.0) (2022-03-28) +### Bug Fixes +- **typescript-estree:** type-only regression for consumers not yet on TS 4.5 ([#4272](https://github.com/typescript-eslint/typescript-eslint/issues/4272)) ([550b61e](https://github.com/typescript-eslint/typescript-eslint/commit/550b61ee1096113b234bf035dd267ba385809961)) -### Bug Fixes +### Features -* code container hiding navigation menu ([#4707](https://github.com/typescript-eslint/typescript-eslint/issues/4707)) ([96bc69a](https://github.com/typescript-eslint/typescript-eslint/commit/96bc69a652c7f6f474a39f1e9783e7fbd446696a)) -* revert "chore: Bump cypress from 8.3.0 to 9.5.2", and ignore cypress for now ([#4740](https://github.com/typescript-eslint/typescript-eslint/issues/4740)) ([cf5f5c4](https://github.com/typescript-eslint/typescript-eslint/commit/cf5f5c441ab0c4fb056bd688795ffc55e026627a)), closes [#4710](https://github.com/typescript-eslint/typescript-eslint/issues/4710) +- **eslint-plugin:** [consistent-type-exports] support TS4.5 inline export specifiers ([#4236](https://github.com/typescript-eslint/typescript-eslint/issues/4236)) ([be4d976](https://github.com/typescript-eslint/typescript-eslint/commit/be4d976215614cc032730ae596d2f6e47df67730)) +- **eslint-plugin:** [consistent-type-imports] support TS4.5 inline import specifiers ([#4237](https://github.com/typescript-eslint/typescript-eslint/issues/4237)) ([f61af7c](https://github.com/typescript-eslint/typescript-eslint/commit/f61af7c53cca52f81e77b4334c7d6ad100609af6)) +- **eslint-plugin:** [no-shadow] support TS4.5 inline import specifiers ([#4239](https://github.com/typescript-eslint/typescript-eslint/issues/4239)) ([96b7e8e](https://github.com/typescript-eslint/typescript-eslint/commit/96b7e8ee0f5280cab50a7205ae592e1d983a111a)) +# [5.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.5.0...v5.6.0) (2021-12-06) ### Features -* **eslint-plugin:** [no-unused-vars] add destructuredArrayIgnorePattern options ([#4748](https://github.com/typescript-eslint/typescript-eslint/issues/4748)) ([6f8db8b](https://github.com/typescript-eslint/typescript-eslint/commit/6f8db8b64821d280fff408c1704a9adde682ed69)) +- **scope-manager:** support TS4.5 import/export specifier kind ([#4234](https://github.com/typescript-eslint/typescript-eslint/issues/4234)) ([833f822](https://github.com/typescript-eslint/typescript-eslint/commit/833f8221ce00aecb7d08c519bab9568353850f48)) +- **scope-manager:** update lib types ([#4240](https://github.com/typescript-eslint/typescript-eslint/issues/4240)) ([8377e6e](https://github.com/typescript-eslint/typescript-eslint/commit/8377e6ea422ee2d52455da8955ff055e09c238d3)) +# [5.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.4.0...v5.5.0) (2021-11-29) +### Bug Fixes +- **eslint-plugin:** [member-ordering] order literal names correctly in ([#4054](https://github.com/typescript-eslint/typescript-eslint/issues/4054)) ([d57141a](https://github.com/typescript-eslint/typescript-eslint/commit/d57141a3d13fad30a93ed99a6a15f4b0b369246a)) +- **eslint-plugin:** [no-duplicate-imports] remove unnecessary type checking for `node.source` ([#4196](https://github.com/typescript-eslint/typescript-eslint/issues/4196)) ([637722a](https://github.com/typescript-eslint/typescript-eslint/commit/637722a77667f6ed1e0cf1f0e752d61622ae8546)) +- **eslint-plugin:** [no-var-requires] do not report require created from createRequire ([#4221](https://github.com/typescript-eslint/typescript-eslint/issues/4221)) ([0040186](https://github.com/typescript-eslint/typescript-eslint/commit/0040186aa23692724986df22a71926e8a7ff9e02)) +- **eslint-plugin:** [prefer-for-of] do nor error when iterating over this ([#4176](https://github.com/typescript-eslint/typescript-eslint/issues/4176)) ([258ddb0](https://github.com/typescript-eslint/typescript-eslint/commit/258ddb0708b7a44959bd3ac399cbde912c8021c8)) +- **eslint-plugin:** [require-await] treat yield\* asynciterable as an await ([#4125](https://github.com/typescript-eslint/typescript-eslint/issues/4125)) ([5a4ce6a](https://github.com/typescript-eslint/typescript-eslint/commit/5a4ce6a241b1d6c6caad87cad85c3741f0953e39)) +- **eslint-plugin:** remove all whitespaces in comparison [#4220](https://github.com/typescript-eslint/typescript-eslint/issues/4220) ([#4223](https://github.com/typescript-eslint/typescript-eslint/issues/4223)) ([853d799](https://github.com/typescript-eslint/typescript-eslint/commit/853d799428a061d9bf6a2e74b01dc49a1e4f3134)) +- **experimental-utils:** export RuleCreator interfaces ([#4199](https://github.com/typescript-eslint/typescript-eslint/issues/4199)) ([7821e4c](https://github.com/typescript-eslint/typescript-eslint/commit/7821e4c515ca2f11a14dcfa94dc77370da0287c5)) +- **experimental-utils:** fix types for eslint-utils ([#4173](https://github.com/typescript-eslint/typescript-eslint/issues/4173)) ([7079de2](https://github.com/typescript-eslint/typescript-eslint/commit/7079de26877a2313a7019845d4c33d0fc4d4b4a9)) +- **scope-manager:** support static class blocks ([#4211](https://github.com/typescript-eslint/typescript-eslint/issues/4211)) ([f8e9125](https://github.com/typescript-eslint/typescript-eslint/commit/f8e91256e0a721aaa906a5c40a92784da9433b53)) +- **visitor-keys:** add missing import assertion keys ([#4178](https://github.com/typescript-eslint/typescript-eslint/issues/4178)) ([9c38b7f](https://github.com/typescript-eslint/typescript-eslint/commit/9c38b7f7fc3ce471a8f720c4a2fbce01f3ee12a4)) +### Features -# [5.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.15.0...v5.16.0) (2022-03-21) +- **eslint-plugin:** [member-ordering] add option to sort case insensitive ([#3896](https://github.com/typescript-eslint/typescript-eslint/issues/3896)) ([e3533d5](https://github.com/typescript-eslint/typescript-eslint/commit/e3533d5a6293a358b5eb0a6ed17da961a09b0ed3)) +- **eslint-plugin:** `array-type` distinguish whether readonly or not ([#4066](https://github.com/typescript-eslint/typescript-eslint/issues/4066)) ([314af44](https://github.com/typescript-eslint/typescript-eslint/commit/314af44bde3ccbebc620625b2931d77688525976)) +# [5.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.3.1...v5.4.0) (2021-11-15) ### Bug Fixes -* **eslint-plugin:** [consistent-type-assertions] enforce assertionStyle for `const` assertions ([#4685](https://github.com/typescript-eslint/typescript-eslint/issues/4685)) ([8ec05be](https://github.com/typescript-eslint/typescript-eslint/commit/8ec05bed0fed0dcd48b087acd5ab5a6132bf3b09)) -* **scope-manager:** incorrect reference for this within a jsx identifier ([#4535](https://github.com/typescript-eslint/typescript-eslint/issues/4535)) ([dd49280](https://github.com/typescript-eslint/typescript-eslint/commit/dd49280e50cb2f5bd26dc07210551bc1fda120af)) -* **utils:** RuleTester: Only call afterAll if defined ([#4656](https://github.com/typescript-eslint/typescript-eslint/issues/4656)) ([0fe0683](https://github.com/typescript-eslint/typescript-eslint/commit/0fe0683effe4c7390806a72c6aa7795445a67929)) - +- correct issues with circular imports ([#4140](https://github.com/typescript-eslint/typescript-eslint/issues/4140)) ([4c87b24](https://github.com/typescript-eslint/typescript-eslint/commit/4c87b2486a9c90794d972a4d093c1dc22ffb418b)) +- **eslint-plugin:** [explicit-member-accessibility] private fields cannot have accessibility modifiers ([#4117](https://github.com/typescript-eslint/typescript-eslint/issues/4117)) ([81b25c1](https://github.com/typescript-eslint/typescript-eslint/commit/81b25c12eceae89e181a7bdb3c8298d820cfe3e3)) +- **eslint-plugin:** [no-implied-eval] ignore locally declared functions ([#4049](https://github.com/typescript-eslint/typescript-eslint/issues/4049)) ([d97140e](https://github.com/typescript-eslint/typescript-eslint/commit/d97140ecf4aeb0a1f8b391f46a31881f21ad93c3)) +- **eslint-plugin:** check optional chaining for floating promises ([#4096](https://github.com/typescript-eslint/typescript-eslint/issues/4096)) ([d724777](https://github.com/typescript-eslint/typescript-eslint/commit/d7247770886c619263482c3e083bed9f97b22688)) +- landing page title duplication ([#4123](https://github.com/typescript-eslint/typescript-eslint/issues/4123)) ([844c25e](https://github.com/typescript-eslint/typescript-eslint/commit/844c25e7b6ef9d79aec99d538252e82557f012d3)) ### Features -* **eslint-plugin:** [prefer-optional-chain] support logical with empty object ([#4430](https://github.com/typescript-eslint/typescript-eslint/issues/4430)) ([d21cfe0](https://github.com/typescript-eslint/typescript-eslint/commit/d21cfe0f4b7d3041948b1b6e0cd56c5ec34b2b3f)) - +- add RuleCreator.withoutDocs ([#4136](https://github.com/typescript-eslint/typescript-eslint/issues/4136)) ([87cfc6a](https://github.com/typescript-eslint/typescript-eslint/commit/87cfc6ad3e3312d7b6f98a592fb37e69d5d6880a)) +- **experimental-utils:** add default [] for RuleModule TOptions generic ([#4135](https://github.com/typescript-eslint/typescript-eslint/issues/4135)) ([62b8098](https://github.com/typescript-eslint/typescript-eslint/commit/62b8098fa7d361954c170ee6c190e47e95194b13)) +- **typescript-estree:** support Import Assertions ([#4074](https://github.com/typescript-eslint/typescript-eslint/issues/4074)) ([ae0fb5a](https://github.com/typescript-eslint/typescript-eslint/commit/ae0fb5a591958216b7df656e66b1dfe464898167)) +- **typescript-estree:** support private fields in-in syntax ([#4075](https://github.com/typescript-eslint/typescript-eslint/issues/4075)) ([939d8ea](https://github.com/typescript-eslint/typescript-eslint/commit/939d8eac547fb1734aa00f1ea01cc6eae0b4280a)) +- **typescript-estree:** support type-only module specifiers ([#4076](https://github.com/typescript-eslint/typescript-eslint/issues/4076)) ([77baa92](https://github.com/typescript-eslint/typescript-eslint/commit/77baa9203638e888a76e21003a278a8da386e133)) +## [5.3.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.3.0...v5.3.1) (2021-11-08) +**Note:** Version bump only for package @typescript-eslint/typescript-eslint +# [5.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.2.0...v5.3.0) (2021-11-01) -# [5.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.14.0...v5.15.0) (2022-03-14) +### Bug Fixes +- **eslint-plugin:** ignore private identifiers in explicit-module-boundary-types ([#4046](https://github.com/typescript-eslint/typescript-eslint/issues/4046)) ([80b853d](https://github.com/typescript-eslint/typescript-eslint/commit/80b853db90ae3d4e32c4b7ec9d45a5c41dc459c9)) +- **eslint-plugin:** skip seenTypes for unions in isTypeReadonly ([#4043](https://github.com/typescript-eslint/typescript-eslint/issues/4043)) ([6af7ca7](https://github.com/typescript-eslint/typescript-eslint/commit/6af7ca7d9fde230342d27ad5a75a09a58c022974)) +- **experimental-utils:** add `name` property to test case interface ([#4067](https://github.com/typescript-eslint/typescript-eslint/issues/4067)) ([f3021c9](https://github.com/typescript-eslint/typescript-eslint/commit/f3021c94460e8d06e4169335bcc1a23854531f2a)) ### Features -* **parser:** add `parserOptions.emitDecoratorMetadata` ([#4646](https://github.com/typescript-eslint/typescript-eslint/issues/4646)) ([e3dd343](https://github.com/typescript-eslint/typescript-eslint/commit/e3dd343e51e3b7772e825a609735a04c921c1ec5)) +- **eslint-plugin:** [no-shadow] exclude external type declaration merging ([#3959](https://github.com/typescript-eslint/typescript-eslint/issues/3959)) ([a93cebf](https://github.com/typescript-eslint/typescript-eslint/commit/a93cebfc0f2026c50972bcb110bcd3295ba9a44d)) +- **experimental-utils:** extract `isTokenOfTypeWithConditions` out of `ast-utils`' `predicates` ([#3977](https://github.com/typescript-eslint/typescript-eslint/issues/3977)) ([5229597](https://github.com/typescript-eslint/typescript-eslint/commit/5229597d9bfc998852c4b4fb421859e8f3d3d688)) +# [5.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.1.0...v5.2.0) (2021-10-25) +### Bug Fixes +- **eslint-plugin:** [typedef] fix regression with class properties ([#4034](https://github.com/typescript-eslint/typescript-eslint/issues/4034)) ([fe53d22](https://github.com/typescript-eslint/typescript-eslint/commit/fe53d22f57ad418397fb31fa89c97db0ab4cd6c0)), closes [#4033](https://github.com/typescript-eslint/typescript-eslint/issues/4033) +### Features -# [5.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.13.0...v5.14.0) (2022-03-07) +- **eslint-plugin:** adding `consistent-type-exports` rule ([#3936](https://github.com/typescript-eslint/typescript-eslint/issues/3936)) ([1971a3f](https://github.com/typescript-eslint/typescript-eslint/commit/1971a3f8027416cd1fb33b1d50faa035599917de)) +# [5.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.0.0...v5.1.0) (2021-10-18) ### Bug Fixes -* **eslint-plugin:** [naming-convention] cover case that requires quotes ([#4582](https://github.com/typescript-eslint/typescript-eslint/issues/4582)) ([3ea0947](https://github.com/typescript-eslint/typescript-eslint/commit/3ea09477debec9f1593e4d3857e153570b488f4d)) -* **eslint-plugin:** [no-misused-promises] factor thenable returning function overload signatures ([#4620](https://github.com/typescript-eslint/typescript-eslint/issues/4620)) ([56a09e9](https://github.com/typescript-eslint/typescript-eslint/commit/56a09e98f171662d25ae2692be703a8bbbd3a3a5)) -* **eslint-plugin:** [prefer-readonly-parameter-types] handle class sharp private field and member without throwing error ([#4343](https://github.com/typescript-eslint/typescript-eslint/issues/4343)) ([a65713a](https://github.com/typescript-eslint/typescript-eslint/commit/a65713ae138e56555d01a9e8e5179221a2f39e75)) -* **eslint-plugin:** [return-await] correct autofixer in binary expression ([#4401](https://github.com/typescript-eslint/typescript-eslint/issues/4401)) ([5fa2fad](https://github.com/typescript-eslint/typescript-eslint/commit/5fa2fade385cc526a962212b94410c58e4c31078)) - +- **eslint-plugin:** [no-restricted-imports]: report type-only imports properly ([#3996](https://github.com/typescript-eslint/typescript-eslint/issues/3996)) ([283cdf2](https://github.com/typescript-eslint/typescript-eslint/commit/283cdf26e6b32985531ff6416cd13ef4cb0a3c8c)) +- **eslint-plugin:** [strict-bool-expr] treat unconstrained generic as any ([#3981](https://github.com/typescript-eslint/typescript-eslint/issues/3981)) ([9b29ca7](https://github.com/typescript-eslint/typescript-eslint/commit/9b29ca751f496c25240c0c14b8fa432bf4443d39)) +- **typescript-estree:** support private optional property definition ([#3997](https://github.com/typescript-eslint/typescript-eslint/issues/3997)) ([8605e08](https://github.com/typescript-eslint/typescript-eslint/commit/8605e080a4dac4a277e6108cd9ed1e5a707302fa)) ### Features -* **eslint-plugin:** [no-misused-promises] add granular options within `checksVoidReturns` ([#4623](https://github.com/typescript-eslint/typescript-eslint/issues/4623)) ([1085177](https://github.com/typescript-eslint/typescript-eslint/commit/10851772696f982b585e0dade728f7980fdc6cc0)) -* TypeScript 4.6 ([#4615](https://github.com/typescript-eslint/typescript-eslint/issues/4615)) ([a02c63a](https://github.com/typescript-eslint/typescript-eslint/commit/a02c63a264e5a6c3557468a8eff48d34ca2b718a)) +- **experimental-utils:** extract `ast-utils`' `predicates`' helpers ([#3976](https://github.com/typescript-eslint/typescript-eslint/issues/3976)) ([154ec9a](https://github.com/typescript-eslint/typescript-eslint/commit/154ec9aea8e81732cafe36af97c4822f1591b077)) + +# [5.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.33.0...v5.0.0) (2021-10-11) + +### Bug Fixes +- **eslint-plugin:** [explicit-member-accessibility] report `TSAbstractPropertyDefinition` and `TSAbstractMethodDefinition` properly ([#3901](https://github.com/typescript-eslint/typescript-eslint/issues/3901)) ([82016f9](https://github.com/typescript-eslint/typescript-eslint/commit/82016f99b14825c9c60e1f7eb3b4efcc492bba86)) +- **eslint-plugin:** update new rules from master ([#3840](https://github.com/typescript-eslint/typescript-eslint/issues/3840)) ([d88a6b4](https://github.com/typescript-eslint/typescript-eslint/commit/d88a6b44eedcf9dd59569160570aa118851aa86b)) +- update new rules from master ([b34fb7e](https://github.com/typescript-eslint/typescript-eslint/commit/b34fb7eb3102ea603bb4aef0dbbf9885b3d47557)) +- **eslint-plugin:** crash in no-dupe-class-members (v5) ([#3813](https://github.com/typescript-eslint/typescript-eslint/issues/3813)) ([4b09644](https://github.com/typescript-eslint/typescript-eslint/commit/4b096442f731c0a60926ac0391a4f2c4208aa8d4)) +- **experimental-utils:** fix `isSetter`'s return type ([#3975](https://github.com/typescript-eslint/typescript-eslint/issues/3975)) ([d256856](https://github.com/typescript-eslint/typescript-eslint/commit/d2568561d0417fdfbdfd964ad942f9d00434af73)) +- **typescript-estree:** change `source` of ExportNamedDeclaration to Literal from Expression ([#3763](https://github.com/typescript-eslint/typescript-eslint/issues/3763)) ([dc5a0f5](https://github.com/typescript-eslint/typescript-eslint/commit/dc5a0f5104b400f4422b8d67ecfc6cc7a32613a2)) +### Features +- **ast-spec:** bring `Node` objects in line with ESTree ([#3771](https://github.com/typescript-eslint/typescript-eslint/issues/3771)) ([dd14064](https://github.com/typescript-eslint/typescript-eslint/commit/dd140643b457aa515cc21fcda2b3cd4acc2a1c5c)) +- **eslint-plugin:** remove `object` from `ban-types`' default types ([#3818](https://github.com/typescript-eslint/typescript-eslint/issues/3818)) ([ae3fa90](https://github.com/typescript-eslint/typescript-eslint/commit/ae3fa900d5b4e1f557a52ca58d35a7d098d9efaf)) +- **eslint-plugin:** removed value from abstract property nodes ([#3765](https://github.com/typescript-eslint/typescript-eslint/issues/3765)) ([5823524](https://github.com/typescript-eslint/typescript-eslint/commit/58235241714596b641a1e8b39c569e561e0039b4)), closes [#3748](https://github.com/typescript-eslint/typescript-eslint/issues/3748) +- **eslint-plugin:** update recommended configs ([#3809](https://github.com/typescript-eslint/typescript-eslint/issues/3809)) ([deeb7bb](https://github.com/typescript-eslint/typescript-eslint/commit/deeb7bb9334d301c6af56aefd37d318231af11ef)) +- align class property representation with ESTree ([#3806](https://github.com/typescript-eslint/typescript-eslint/issues/3806)) ([22fa5c0](https://github.com/typescript-eslint/typescript-eslint/commit/22fa5c0c4705ed2898f00b7cacc5dd642d859275)), closes [#3430](https://github.com/typescript-eslint/typescript-eslint/issues/3430) [#3077](https://github.com/typescript-eslint/typescript-eslint/issues/3077) +- remove `meta.docs.category` from rules ([#3800](https://github.com/typescript-eslint/typescript-eslint/issues/3800)) ([71c9370](https://github.com/typescript-eslint/typescript-eslint/commit/71c93706e55f5f92a1285102b93c6ab1950c6df4)) +- remove `TSParenthesizedType` ([#3340](https://github.com/typescript-eslint/typescript-eslint/issues/3340)) ([c8ee432](https://github.com/typescript-eslint/typescript-eslint/commit/c8ee43269faea4c04ec02eaa2b81a0aa6eec5d3e)), closes [#3136](https://github.com/typescript-eslint/typescript-eslint/issues/3136) +- support `PrivateIdentifier` ([#3808](https://github.com/typescript-eslint/typescript-eslint/issues/3808)) ([0eefe5e](https://github.com/typescript-eslint/typescript-eslint/commit/0eefe5e49d21af3f1e3e2d9a90c2e49929863ac2)), closes [#3430](https://github.com/typescript-eslint/typescript-eslint/issues/3430) [#2933](https://github.com/typescript-eslint/typescript-eslint/issues/2933) +- **eslint-plugin:** [comma-dangle] align schema with ESLint v8 ([#3768](https://github.com/typescript-eslint/typescript-eslint/issues/3768)) ([0acfafc](https://github.com/typescript-eslint/typescript-eslint/commit/0acfafcc655e28dcfc05a5caa567c0d0217ee7ad)) +- **eslint-plugin:** [member-ordering] add support for getters and setters ([#3611](https://github.com/typescript-eslint/typescript-eslint/issues/3611)) ([e264124](https://github.com/typescript-eslint/typescript-eslint/commit/e2641246571b69df36cde5cb7bce7c4fffc43f98)) +- **eslint-plugin:** remove `no-unused-vars-experimental` ([79ae03b](https://github.com/typescript-eslint/typescript-eslint/commit/79ae03b8adbae2b0a86276711a9c834af01bbb61)) +- **experimental-utils:** extract `isNodeOfTypes` out of `ast-utils`' `predicates` ([#3836](https://github.com/typescript-eslint/typescript-eslint/issues/3836)) ([0cc509b](https://github.com/typescript-eslint/typescript-eslint/commit/0cc509b61df248cfb4b42fe64ec800f3cac69c69)) +- **typescript-estree:** remove legacy `useJSXTextNode` option ([#3109](https://github.com/typescript-eslint/typescript-eslint/issues/3109)) ([5b84b98](https://github.com/typescript-eslint/typescript-eslint/commit/5b84b98fb3cf68d944b7d4e970f39f4e88f0b2d5)) +- support ESLint v8 ([#3737](https://github.com/typescript-eslint/typescript-eslint/issues/3737)) ([4ca62ae](https://github.com/typescript-eslint/typescript-eslint/commit/4ca62aee6681d706e762a8db727541ca204364f2)) +- **experimental-utils:** remove `getComments` from `ESLint` `SourceCode` types ([#3766](https://github.com/typescript-eslint/typescript-eslint/issues/3766)) ([165a507](https://github.com/typescript-eslint/typescript-eslint/commit/165a507970d8e4a0ed12abdd5f0d892f7de83ffe)) +### BREAKING CHANGES -# [5.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.1...v5.13.0) (2022-02-28) +- **eslint-plugin:** `ban-types` no longer reports `object` by default +# [4.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.32.0...v4.33.0) (2021-10-04) ### Bug Fixes -* **eslint-plugin:** [sort-type-union-intersection-members] Wrap the constructorType in parentheses ([#4590](https://github.com/typescript-eslint/typescript-eslint/issues/4590)) ([851bb90](https://github.com/typescript-eslint/typescript-eslint/commit/851bb90216e20b7679efc891dc445e6152d4837f)) - +- **eslint-plugin:** [lines-between-class-members] fix `exceptAfterOverload` for abstract methods ([#3943](https://github.com/typescript-eslint/typescript-eslint/issues/3943)) ([240fc65](https://github.com/typescript-eslint/typescript-eslint/commit/240fc65c307769eae9b35e611fca74ba4c35a025)) +- **eslint-plugin:** [no-confusing-void-expression] support optional chaining ([#3937](https://github.com/typescript-eslint/typescript-eslint/issues/3937)) ([c40dd13](https://github.com/typescript-eslint/typescript-eslint/commit/c40dd13df76b77052c85254622df5533307dc07e)) +- **eslint-plugin:** [no-restricted-imports] fix crash when no options given ([#3947](https://github.com/typescript-eslint/typescript-eslint/issues/3947)) ([edaa3c1](https://github.com/typescript-eslint/typescript-eslint/commit/edaa3c10eb67bb89f9c6a78bd1ed593925c33f16)) +- **eslint-plugin:** [non-nullable-type-assertion-style] false-positive with non-nullish `as` assertions and types ([#3940](https://github.com/typescript-eslint/typescript-eslint/issues/3940)) ([40760f9](https://github.com/typescript-eslint/typescript-eslint/commit/40760f98da0d23c7bce3da04cf37a56c10447bde)) +- **eslint-plugin:** [padding-line-between-statements] TSModuleBlock should change scope ([#3944](https://github.com/typescript-eslint/typescript-eslint/issues/3944)) ([f8f534e](https://github.com/typescript-eslint/typescript-eslint/commit/f8f534e42b0ec517274442422c37ab019cf3c200)) +- **eslint-plugin:** [prefer-regexp-exec] check `RegExp` without flags ([#3946](https://github.com/typescript-eslint/typescript-eslint/issues/3946)) ([0868725](https://github.com/typescript-eslint/typescript-eslint/commit/0868725713e8102e8932303d4c680340688e1fa9)) +- **experimental-utils:** add `getPhysicalFilename()` to `RuleContext` ([#3934](https://github.com/typescript-eslint/typescript-eslint/issues/3934)) ([ee5dfd4](https://github.com/typescript-eslint/typescript-eslint/commit/ee5dfd4989ab465d65ba3424e36b7f0964558191)) +- **experimental-utils:** require fix in suggestions ([#3949](https://github.com/typescript-eslint/typescript-eslint/issues/3949)) ([f022fb1](https://github.com/typescript-eslint/typescript-eslint/commit/f022fb14c71dad25be2314252eb751964f34fcb8)) ### Features -* **eslint-plugin:** [no-misused-promises] check more places for checksVoidReturn ([#4541](https://github.com/typescript-eslint/typescript-eslint/issues/4541)) ([052cf51](https://github.com/typescript-eslint/typescript-eslint/commit/052cf51fe663283afe89dc7bf97c947e750df095)) -* **eslint-plugin:** add `no-redundant-type-constituents` rule ([#4378](https://github.com/typescript-eslint/typescript-eslint/issues/4378)) ([63d051e](https://github.com/typescript-eslint/typescript-eslint/commit/63d051eed29dcf71015a23992feac0a8f92717a0)) -* **eslint-plugin:** add `no-useless-empty-export` rule ([#4380](https://github.com/typescript-eslint/typescript-eslint/issues/4380)) ([823b945](https://github.com/typescript-eslint/typescript-eslint/commit/823b945c8f9e83d0246a2a5d07519f01e1a64518)) -* **eslint-plugin:** add extension rule `space-before-blocks` ([#1606](https://github.com/typescript-eslint/typescript-eslint/issues/1606)) ([#4184](https://github.com/typescript-eslint/typescript-eslint/issues/4184)) ([208b6d0](https://github.com/typescript-eslint/typescript-eslint/commit/208b6d02252dff2bf272329d3e4a4a82e56c52c0)) -* **eslint-plugin:** added member group support to member-ordering rule ([#4538](https://github.com/typescript-eslint/typescript-eslint/issues/4538)) ([6afcaea](https://github.com/typescript-eslint/typescript-eslint/commit/6afcaea0160a1ccd1c6483ca677c544ca1b8cb4f)) -* **utils:** expose `ast-utils`' helpers ([#4503](https://github.com/typescript-eslint/typescript-eslint/issues/4503)) ([f106e4b](https://github.com/typescript-eslint/typescript-eslint/commit/f106e4b95e824ebb68141bce3d3207448d50c860)) -* **utils:** extract `isNotTokenOfTypeWithConditions` out of `ast-utils`' `predicates` ([#4502](https://github.com/typescript-eslint/typescript-eslint/issues/4502)) ([66501d6](https://github.com/typescript-eslint/typescript-eslint/commit/66501d6dd7e97c22c671efaa6d1ba8237907e417)) +- **experimental-utils:** extract `isNodeOfTypeWithConditions` out of `ast-utils`' `predicates` ([#3837](https://github.com/typescript-eslint/typescript-eslint/issues/3837)) ([214f898](https://github.com/typescript-eslint/typescript-eslint/commit/214f898178ba593146d06a444487d32ec3363854)) + +# [4.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.2...v4.32.0) (2021-09-27) +### Bug Fixes +- **eslint-plugin:** [consistent-type-definitions] correct fix for `export default` ([#3899](https://github.com/typescript-eslint/typescript-eslint/issues/3899)) ([ebb33ed](https://github.com/typescript-eslint/typescript-eslint/commit/ebb33ed8bc29f69ca2a657ec5b31857c0aeb4b56)) +- **eslint-plugin:** [no-require-imports] report only global `require` ([#3871](https://github.com/typescript-eslint/typescript-eslint/issues/3871)) ([8aa87a1](https://github.com/typescript-eslint/typescript-eslint/commit/8aa87a136e7cd7b40fbf09fcfa26bf04d1c6d5fe)) +- **eslint-plugin:** [no-shadow] ignore type-only imports properly ([#3868](https://github.com/typescript-eslint/typescript-eslint/issues/3868)) ([dda9cee](https://github.com/typescript-eslint/typescript-eslint/commit/dda9cee68a5cd78b358a854027999c739ac623e9)) +- **eslint-plugin:** [no-var-requires] report problems within `NewExpression` ([#3884](https://github.com/typescript-eslint/typescript-eslint/issues/3884)) ([ed5e459](https://github.com/typescript-eslint/typescript-eslint/commit/ed5e45983fa052accf3a7b5fcdbfcb15ed09490f)) +- **eslint-plugin:** [padding-line-between-statements] problems within namespaces not being reported ([#3869](https://github.com/typescript-eslint/typescript-eslint/issues/3869)) ([1861356](https://github.com/typescript-eslint/typescript-eslint/commit/186135698b40b510ffff6a2402aa34f2726596ea)) +- **eslint-plugin:** [prefer-regexp-exec] respect flags when using `RegExp` ([#3855](https://github.com/typescript-eslint/typescript-eslint/issues/3855)) ([ffdb5ff](https://github.com/typescript-eslint/typescript-eslint/commit/ffdb5ff9900e07374a2f3686447e3e2c78fbc38a)) +- **eslint-plugin:** [prefer-return-this-type] handle generics properly in fixer ([#3852](https://github.com/typescript-eslint/typescript-eslint/issues/3852)) ([9e98b8f](https://github.com/typescript-eslint/typescript-eslint/commit/9e98b8f43ca6aadc9758a4e9a0d1d3c250af6cca)) +- **eslint-plugin:** false-positive/negative with array index in no-unnecessary-condition ([#3805](https://github.com/typescript-eslint/typescript-eslint/issues/3805)) ([bdb8f0b](https://github.com/typescript-eslint/typescript-eslint/commit/bdb8f0be1466e4a4b713e91199be91030650ed01)) +- **experimental-utils:** add missing signature for `isParenthesized` ([#3887](https://github.com/typescript-eslint/typescript-eslint/issues/3887)) ([806eaac](https://github.com/typescript-eslint/typescript-eslint/commit/806eaac6af5325664634690e9ebd7ffaed276549)) +### Features +- **eslint-plugin:** [no-type-alias]: add allowGenerics option ([#3865](https://github.com/typescript-eslint/typescript-eslint/issues/3865)) ([4195919](https://github.com/typescript-eslint/typescript-eslint/commit/41959199735a6d4fe3ae7825f3087e8fb249be9f)) +- **eslint-plugin:** add `no-non-null-asserted-nullish-coalescing` rule ([#3349](https://github.com/typescript-eslint/typescript-eslint/issues/3349)) ([4e99961](https://github.com/typescript-eslint/typescript-eslint/commit/4e999614e9761f6dc7e5aa0c5bad76ab164ab3fb)) +- **eslint-plugin:** add new extended rule `no-restricted-imports` ([#3775](https://github.com/typescript-eslint/typescript-eslint/issues/3775)) ([ec5d506](https://github.com/typescript-eslint/typescript-eslint/commit/ec5d50696b249a207d322e4a2fc66582122eb010)) +- **eslint-plugin-internal:** [prefer-ast-types-enum] add `DefinitionType` enum ([#3916](https://github.com/typescript-eslint/typescript-eslint/issues/3916)) ([13b7de5](https://github.com/typescript-eslint/typescript-eslint/commit/13b7de508e0f8eac492879ff9ab99acd8d3e977e)) +- Support `'latest'` as `ecmaVersion` ([#3873](https://github.com/typescript-eslint/typescript-eslint/issues/3873)) ([25a42c0](https://github.com/typescript-eslint/typescript-eslint/commit/25a42c0bbe92d1ecbc2e8ff9ef3a3ef413f728b0)) -## [5.12.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.0...v5.12.1) (2022-02-21) +## [4.31.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.1...v4.31.2) (2021-09-20) +**Note:** Version bump only for package @typescript-eslint/typescript-eslint -### Bug Fixes +## [4.31.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.0...v4.31.1) (2021-09-13) -* **eslint-plugin:** [no-unnecessary-type-arguments] fix comparison of types ([#4555](https://github.com/typescript-eslint/typescript-eslint/issues/4555)) ([fc3936e](https://github.com/typescript-eslint/typescript-eslint/commit/fc3936e99712374a707ce9e0101bc641807b9ea6)) +**Note:** Version bump only for package @typescript-eslint/typescript-eslint +# [4.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.30.0...v4.31.0) (2021-09-06) +### Bug Fixes +- **ast-spec:** remove duplicate union types from `Expression` ([#3770](https://github.com/typescript-eslint/typescript-eslint/issues/3770)) ([463e768](https://github.com/typescript-eslint/typescript-eslint/commit/463e768978731d019345f6552d7fd7a073a80192)) +- **utils:** support immutable arrays in `ReportFixFunction` ([#3830](https://github.com/typescript-eslint/typescript-eslint/issues/3830)) ([8218055](https://github.com/typescript-eslint/typescript-eslint/commit/8218055d6dfd94c9e6c8645848f981d9d51ce08c)) +### Features -# [5.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.11.0...v5.12.0) (2022-02-14) +- **eslint-plugin:** [prefer-readonly-parameter-types] add option treatMethodsAsReadonly ([#3733](https://github.com/typescript-eslint/typescript-eslint/issues/3733)) ([a46e318](https://github.com/typescript-eslint/typescript-eslint/commit/a46e3182c8a0b07c914605d6d9fe28ef36a7c32a)) +- **eslint-plugin:** [restrict-template-expressions] add option to allow RegExp ([#3709](https://github.com/typescript-eslint/typescript-eslint/issues/3709)) ([363b3dc](https://github.com/typescript-eslint/typescript-eslint/commit/363b3dc4dd0dc343311c729d75935b10f9d2fd5e)) +- **eslint-plugin:** add `no-meaningless-void-operator` rule ([#3641](https://github.com/typescript-eslint/typescript-eslint/issues/3641)) ([ea40ab6](https://github.com/typescript-eslint/typescript-eslint/commit/ea40ab659351ae7cf7235ea063d42ac155b11e5f)) +- **eslint-plugin:** add extension rule `padding-line-between-statements` ([#3418](https://github.com/typescript-eslint/typescript-eslint/issues/3418)) ([f79ae9b](https://github.com/typescript-eslint/typescript-eslint/commit/f79ae9b58e82f4fddef640a34a1d7ff92b763e65)) +- **experimental-utils:** extract `isNodeOfType` out of `ast-utils`' `predicates` ([#3677](https://github.com/typescript-eslint/typescript-eslint/issues/3677)) ([4bfa437](https://github.com/typescript-eslint/typescript-eslint/commit/4bfa4375aff8f65057d4aa116e435803cbc6b464)) +# [4.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.3...v4.30.0) (2021-08-30) ### Bug Fixes -* **eslint-plugin:** [init-declarations] fix nested namespace ([#4544](https://github.com/typescript-eslint/typescript-eslint/issues/4544)) ([fe910e6](https://github.com/typescript-eslint/typescript-eslint/commit/fe910e61ca4bb42be3be9acb8ddcec73206754c2)) -* **eslint-plugin:** [no-unnecessary-type-arguments] Use Symbol to check if it's the same type ([#4543](https://github.com/typescript-eslint/typescript-eslint/issues/4543)) ([5b7d8df](https://github.com/typescript-eslint/typescript-eslint/commit/5b7d8df149be6554c863cdd5b73c0b0b0a7960db)) -* support nested object deconstructuring with type annotation ([#4548](https://github.com/typescript-eslint/typescript-eslint/issues/4548)) ([4da9278](https://github.com/typescript-eslint/typescript-eslint/commit/4da9278c80706f420d4c15a71c11c7b11d935643)) - +- **eslint-plugin:** [dot-notation] false positive with optional chaining ([#3711](https://github.com/typescript-eslint/typescript-eslint/issues/3711)) ([c19fc6e](https://github.com/typescript-eslint/typescript-eslint/commit/c19fc6e03072ed549bc9b35ebe6961e10f8f9b43)), closes [#3510](https://github.com/typescript-eslint/typescript-eslint/issues/3510) +- **eslint-plugin:** [prefer-reduce-type-parameter] handle already existing type params ([#3706](https://github.com/typescript-eslint/typescript-eslint/issues/3706)) ([71dd273](https://github.com/typescript-eslint/typescript-eslint/commit/71dd27361a1bc93b5d5eb2279d805922b10002fd)) +- **eslint-plugin:** isTypeReadonly error with unknown ([#2371](https://github.com/typescript-eslint/typescript-eslint/issues/2371)) ([e7528e6](https://github.com/typescript-eslint/typescript-eslint/commit/e7528e686f5fe5cce8504fc15d3cd06b8733712e)) -* **typescript-estree:** support TSv4 labelled tuple members ([#2378](https://github.com/typescript-eslint/typescript-eslint/issues/2378)) ([00d84ff](https://github.com/typescript-eslint/typescript-eslint/commit/00d84ffbcbe9d0ec98bdb2f2ce59959a27ce4dbe)) - - - +- **experimental-utils:** Include `getCwd()` in `RuleContext` type ([#3308](https://github.com/typescript-eslint/typescript-eslint/issues/3308)) ([2b75c11](https://github.com/typescript-eslint/typescript-eslint/commit/2b75c11d69bee88ca0cb77d7efd32b8d0387e6b3)) +- refactor to split AST specification out as its own module ([#2911](https://github.com/typescript-eslint/typescript-eslint/issues/2911)) ([25ea953](https://github.com/typescript-eslint/typescript-eslint/commit/25ea953cc60b118bd385c71e0a9b61c286c26fcf)) +## [4.22.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.0...v4.22.1) (2021-05-04) -# [3.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.7.1...v3.8.0) (2020-08-03) +**Note:** Version bump only for package @typescript-eslint/typescript-eslint +# [4.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.21.0...v4.22.0) (2021-04-12) ### Bug Fixes -* **eslint-plugin:** [no-implied-eval] don't report when `Function` is imported ([#2348](https://github.com/typescript-eslint/typescript-eslint/issues/2348)) ([fa169e7](https://github.com/typescript-eslint/typescript-eslint/commit/fa169e79661821f0e0e64a56d6db9da42c3c8654)) -* **eslint-plugin:** [no-unsafe-assignment] fix typo in message ([#2347](https://github.com/typescript-eslint/typescript-eslint/issues/2347)) ([2027bb1](https://github.com/typescript-eslint/typescript-eslint/commit/2027bb11689b76c297f93ba8a918b35fe68e5b9d)) - +- **eslint-plugin:** [no-unsafe-argument] handle tuple types on rest arguments ([#3269](https://github.com/typescript-eslint/typescript-eslint/issues/3269)) ([6f8cfe6](https://github.com/typescript-eslint/typescript-eslint/commit/6f8cfe6f83ee26b66b2146cc17b1205100a54a9c)) ### Features -* **eslint-plugin:** [naming-convention] allow specifying an array of selectors ([#2335](https://github.com/typescript-eslint/typescript-eslint/issues/2335)) ([3ef6bd5](https://github.com/typescript-eslint/typescript-eslint/commit/3ef6bd5cadc225e42ef1330d15919a39f53f2a2b)) -* **eslint-plugin:** add `prefer-enum-initializers` rule ([#2326](https://github.com/typescript-eslint/typescript-eslint/issues/2326)) ([4f38ea3](https://github.com/typescript-eslint/typescript-eslint/commit/4f38ea39c97289db11501d6368d01db8c5787257)) - - - - - -## [3.7.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.7.0...v3.7.1) (2020-07-27) +- **eslint-plugin:** [prefer-regexp-exec] add autofix ([#3207](https://github.com/typescript-eslint/typescript-eslint/issues/3207)) ([e2cbeef](https://github.com/typescript-eslint/typescript-eslint/commit/e2cbeefb3d9a7cce257b5675f7f19f1b159a9d26)) +# [4.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.20.0...v4.21.0) (2021-04-05) ### Bug Fixes -* **eslint-plugin:** [adjacent-overload-signatures] fix false positive on call signatures and a method named `call` ([#2313](https://github.com/typescript-eslint/typescript-eslint/issues/2313)) ([30fafb0](https://github.com/typescript-eslint/typescript-eslint/commit/30fafb09422b3aca881f4785d89b0536092d4952)) -* **eslint-plugin:** [no-extra-parens] stop reporting on calling generic functions with one argument and type parameters containing parentheses ([#2319](https://github.com/typescript-eslint/typescript-eslint/issues/2319)) ([616a841](https://github.com/typescript-eslint/typescript-eslint/commit/616a841032bec310d9f31f1c987888273df27008)) -* **typescript-estree:** correct AST regression introduced by TS4.0 upgrade ([#2316](https://github.com/typescript-eslint/typescript-eslint/issues/2316)) ([d7fefba](https://github.com/typescript-eslint/typescript-eslint/commit/d7fefba3741a526ff2b58dd713995c3ee5603962)) - - - - - -# [3.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.6.1...v3.7.0) (2020-07-20) - +- **eslint-plugin:** [no-type-alias] consider `keyof` as an alias ([#3242](https://github.com/typescript-eslint/typescript-eslint/issues/3242)) ([329ef02](https://github.com/typescript-eslint/typescript-eslint/commit/329ef023090c004694b5996ddb04fdde5b05ebb0)) +- **eslint-plugin:** [no-unnecessary-type-assertion] correct bad fix for angle bracket assertion ([#3244](https://github.com/typescript-eslint/typescript-eslint/issues/3244)) ([265a039](https://github.com/typescript-eslint/typescript-eslint/commit/265a039c7e728b719143e09ee61066039d721f62)) +- **eslint-plugin:** [restrict-plus-operands] consider template literal types as strings ([#3234](https://github.com/typescript-eslint/typescript-eslint/issues/3234)) ([ccfd68e](https://github.com/typescript-eslint/typescript-eslint/commit/ccfd68e365391b3f117df96792355f9c3655288c)) +- **eslint-plugin:** [strict-boolean-expressions] account for truthy literals ([#3236](https://github.com/typescript-eslint/typescript-eslint/issues/3236)) ([0913f40](https://github.com/typescript-eslint/typescript-eslint/commit/0913f40c87762de198b05a5473b4fb79aeb46967)) +- **eslint-plugin:** always ignore assignments in no-unnecessary-type-assertion ([#3235](https://github.com/typescript-eslint/typescript-eslint/issues/3235)) ([0221476](https://github.com/typescript-eslint/typescript-eslint/commit/02214768a3721d8514c70e00546e861da6581e4d)) ### Features -* **eslint-plugin:** [naming-convention] allow selecting only `const` variables ([#2291](https://github.com/typescript-eslint/typescript-eslint/issues/2291)) ([156d058](https://github.com/typescript-eslint/typescript-eslint/commit/156d058fee835fdf1ed827a5ad4a80d57190cc54)) -* **eslint-plugin:** [no-empty-function] add `decoratedFunctions` option ([#2295](https://github.com/typescript-eslint/typescript-eslint/issues/2295)) ([88f08f4](https://github.com/typescript-eslint/typescript-eslint/commit/88f08f410760f58fdc2de58ecd9dab9610821642)) -* **typescript-estree:** support short-circuiting assignment operators ([#2307](https://github.com/typescript-eslint/typescript-eslint/issues/2307)) ([2c90d9f](https://github.com/typescript-eslint/typescript-eslint/commit/2c90d9fa3aa5ebd7db697dddb7762bca2dd0e06b)) -* **typescript-estree:** support type annotations on catch clauses ([#2306](https://github.com/typescript-eslint/typescript-eslint/issues/2306)) ([b5afe9c](https://github.com/typescript-eslint/typescript-eslint/commit/b5afe9c560b9f38c8dffc312a600db30944129c8)) - - - - - -## [3.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.6.0...v3.6.1) (2020-07-13) - - -### Bug Fixes - -* **eslint-plugin:** [no-unnecessary-condition] handle computed member access ([#2288](https://github.com/typescript-eslint/typescript-eslint/issues/2288)) ([3a187ca](https://github.com/typescript-eslint/typescript-eslint/commit/3a187cafb7302a3c05de0e6a236dd142a5e2d741)) -* **eslint-plugin:** [prefer-literal-enum-member] allow negative numbers ([#2277](https://github.com/typescript-eslint/typescript-eslint/issues/2277)) ([00ac9c3](https://github.com/typescript-eslint/typescript-eslint/commit/00ac9c3ccaad27bab08ec3c3a104f612bb593df5)) -* **eslint-plugin:** [space-before-function-paren] incorrect handling of abstract methods ([#2275](https://github.com/typescript-eslint/typescript-eslint/issues/2275)) ([ced6591](https://github.com/typescript-eslint/typescript-eslint/commit/ced65918b16f46c383496a9b4bd43eca8a76baf6)), closes [#2274](https://github.com/typescript-eslint/typescript-eslint/issues/2274) -* **eslint-plugin:** [switch-exhaustiveness-check] handle special characters in enum keys ([#2207](https://github.com/typescript-eslint/typescript-eslint/issues/2207)) ([98ab010](https://github.com/typescript-eslint/typescript-eslint/commit/98ab010fb7fca884984bb4200fd806ecee8071b6)) - - - - - -# [3.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.5.0...v3.6.0) (2020-07-06) - - -### Bug Fixes - -* **eslint-plugin:** [no-namespace] allow namespaces in nested declarations with `allowDeclarations` ([#2238](https://github.com/typescript-eslint/typescript-eslint/issues/2238)) ([c1df669](https://github.com/typescript-eslint/typescript-eslint/commit/c1df6694f7866d3ef7ede0b1c6c9dd6f3955e682)) -* **eslint-plugin:** [space-before-function-paren] handle abstract functions ([#2199](https://github.com/typescript-eslint/typescript-eslint/issues/2199)) ([88a3edf](https://github.com/typescript-eslint/typescript-eslint/commit/88a3edfce8349f871b7b660d2b76508b67c94eda)) +- **eslint-plugin:** [no-unsafe-argument] add rule ([#3256](https://github.com/typescript-eslint/typescript-eslint/issues/3256)) ([b1aa7dc](https://github.com/typescript-eslint/typescript-eslint/commit/b1aa7dc6971ee8409b729dffb8b69478455734ed)), closes [#791](https://github.com/typescript-eslint/typescript-eslint/issues/791) +- **eslint-plugin:** [no-unsafe-call][no-unsafe-member-access] improve report messages for `this` for `noImplicitThis` ([#3199](https://github.com/typescript-eslint/typescript-eslint/issues/3199)) ([b1b26c4](https://github.com/typescript-eslint/typescript-eslint/commit/b1b26c4843a4cfa209a0c9c3d8bea1de37333b48)) +# [4.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.19.0...v4.20.0) (2021-03-29) ### Features -* **eslint-plugin:** add rule `prefer-literal-enum-member` ([#1898](https://github.com/typescript-eslint/typescript-eslint/issues/1898)) ([fe2b2ec](https://github.com/typescript-eslint/typescript-eslint/commit/fe2b2ec39ef04ac8b73eef9d29d12fd1b24fa183)) - - - - - -# [3.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.4.0...v3.5.0) (2020-06-29) +- **eslint-plugin:** [space-infix-ops] support for class properties and type aliases ([#3231](https://github.com/typescript-eslint/typescript-eslint/issues/3231)) ([5414bf2](https://github.com/typescript-eslint/typescript-eslint/commit/5414bf27a81311099d001808475d9cf832ce3bfe)) +- **eslint-plugin:** [type-annotation-spacing] handle space between ? and : ([#3138](https://github.com/typescript-eslint/typescript-eslint/issues/3138)) ([40bdb0b](https://github.com/typescript-eslint/typescript-eslint/commit/40bdb0b27b21de511f0ecd151cb8282a625ca6e1)) +# [4.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.18.0...v4.19.0) (2021-03-22) ### Bug Fixes -* **eslint-plugin:** [naming-convention] support unicode in regex ([#2241](https://github.com/typescript-eslint/typescript-eslint/issues/2241)) ([5fdd21a](https://github.com/typescript-eslint/typescript-eslint/commit/5fdd21a1726fb6928098c4152aec55a30df960d4)) -* **typescript-estree:** forward compatibility for new compound assignment operators ([#2253](https://github.com/typescript-eslint/typescript-eslint/issues/2253)) ([ba41680](https://github.com/typescript-eslint/typescript-eslint/commit/ba41680f2a25b1aa4d05c2d4b132ac73a6faefbd)) - +- **eslint-plugin:** [member-delimiter-style] correct invalid fix for multiline with params on the same line ([#3177](https://github.com/typescript-eslint/typescript-eslint/issues/3177)) ([7ad343b](https://github.com/typescript-eslint/typescript-eslint/commit/7ad343b067040f6ea816b129323d110d4bc2e830)) +- **eslint-plugin:** [promise-function-async] bad fixer with computed and literal methods ([#3163](https://github.com/typescript-eslint/typescript-eslint/issues/3163)) ([e3a3ea0](https://github.com/typescript-eslint/typescript-eslint/commit/e3a3ea04757464aa2dded1ef46af8ad4e05246f2)) +- **typescript-estree:** [ts 4.2] add support for import type equal declaration ([#3189](https://github.com/typescript-eslint/typescript-eslint/issues/3189)) ([6a25faf](https://github.com/typescript-eslint/typescript-eslint/commit/6a25faf5cfa4d21a7546d9866819f4e017308fb2)) ### Features -* add package scope-manager ([#1939](https://github.com/typescript-eslint/typescript-eslint/issues/1939)) ([682eb7e](https://github.com/typescript-eslint/typescript-eslint/commit/682eb7e009c3f22a542882dfd3602196a60d2a1e)) -* split types into their own package ([#2229](https://github.com/typescript-eslint/typescript-eslint/issues/2229)) ([5f45918](https://github.com/typescript-eslint/typescript-eslint/commit/5f4591886f3438329fbf2229b03ac66174334a24)) -* split visitor keys into their own package ([#2230](https://github.com/typescript-eslint/typescript-eslint/issues/2230)) ([689dae3](https://github.com/typescript-eslint/typescript-eslint/commit/689dae37392d527c64ae83db2a4c3e6b7fecece7)) - - - - - -# [3.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.3.0...v3.4.0) (2020-06-22) +- **eslint-plugin:** [object-curly-spacing] support MappedType ([#3176](https://github.com/typescript-eslint/typescript-eslint/issues/3176)) ([0557a43](https://github.com/typescript-eslint/typescript-eslint/commit/0557a439327557f4c0369ae2dddc8282ba45bfe6)) +- **eslint-plugin:** [unbound-method] improve error message ([#3203](https://github.com/typescript-eslint/typescript-eslint/issues/3203)) ([5cc5d2e](https://github.com/typescript-eslint/typescript-eslint/commit/5cc5d2ef6d924d301e87f7bcf599352310e74b2c)), closes [#3201](https://github.com/typescript-eslint/typescript-eslint/issues/3201) +# [4.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.17.0...v4.18.0) (2021-03-15) ### Bug Fixes -* **eslint-plugin:** [no-base-to-string] handle intersection types ([#2170](https://github.com/typescript-eslint/typescript-eslint/issues/2170)) ([9cca3a9](https://github.com/typescript-eslint/typescript-eslint/commit/9cca3a9584d5d5ef0536219c5a734f4e87efb543)) -* **eslint-plugin:** [unbound-method] handling destructuring ([#2228](https://github.com/typescript-eslint/typescript-eslint/issues/2228)) ([c3753c2](https://github.com/typescript-eslint/typescript-eslint/commit/c3753c21768d355ecdb9e7ae8e0bfdfbbc1d3bbe)) -* **experimental-utils:** correct types for TS versions older than 3.8 ([#2217](https://github.com/typescript-eslint/typescript-eslint/issues/2217)) ([5e4dda2](https://github.com/typescript-eslint/typescript-eslint/commit/5e4dda264a7d6a6a1626848e7599faea1ac34922)) -* **experimental-utils:** getParserServices takes a readonly context ([#2235](https://github.com/typescript-eslint/typescript-eslint/issues/2235)) ([26da8de](https://github.com/typescript-eslint/typescript-eslint/commit/26da8de7fcde9eddec63212d79af781c4bb22991)) - +- **eslint-plugin:** [explicit-module-boundary-types] fixes [#2864](https://github.com/typescript-eslint/typescript-eslint/issues/2864) related to functions in nested object properties ([#3178](https://github.com/typescript-eslint/typescript-eslint/issues/3178)) ([55e1fba](https://github.com/typescript-eslint/typescript-eslint/commit/55e1fbaca985b500cad1cc9ec25717b18cf5a17b)) +- **eslint-plugin:** [no-extran-class] allowWithDecorator should ignore other errors ([#3160](https://github.com/typescript-eslint/typescript-eslint/issues/3160)) ([a148673](https://github.com/typescript-eslint/typescript-eslint/commit/a1486736d8ef3555832ddfb27fd0980368b363f5)) ### Features -* **eslint-plugin:** [no-unnecessary-boolean-literal-compare] add option to check nullable booleans ([#1983](https://github.com/typescript-eslint/typescript-eslint/issues/1983)) ([c0b3057](https://github.com/typescript-eslint/typescript-eslint/commit/c0b3057b7f7d515891ad2efe32e4ef8c01e0478f)) -* **eslint-plugin:** add extension rule `no-loss-of-precision` ([#2196](https://github.com/typescript-eslint/typescript-eslint/issues/2196)) ([535b0f2](https://github.com/typescript-eslint/typescript-eslint/commit/535b0f2ddd82efa6a2c40307a61c480f4b3cdea3)) - - - - - -# [3.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.2.0...v3.3.0) (2020-06-15) +- **eslint-plugin:** add package type declaration ([#3164](https://github.com/typescript-eslint/typescript-eslint/issues/3164)) ([08b058a](https://github.com/typescript-eslint/typescript-eslint/commit/08b058a7a6db3b59c28753bb322717e1fee44d1f)) +# [4.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.16.1...v4.17.0) (2021-03-08) ### Bug Fixes -* **eslint-plugin:** [no-unused-expressions] handle ternary and short-circuit options ([#2194](https://github.com/typescript-eslint/typescript-eslint/issues/2194)) ([ee9f100](https://github.com/typescript-eslint/typescript-eslint/commit/ee9f100a2f9a874c2b361482742686eeaa9bdac7)) -* **typescript-estree:** handle TS4.0 breaking change in TupleType ([#2197](https://github.com/typescript-eslint/typescript-eslint/issues/2197)) ([5d68129](https://github.com/typescript-eslint/typescript-eslint/commit/5d6812914831a386997b453b4db1e3283e26005d)) - +- **eslint-plugin:** [no-unnecessary-type-assertion] handle assignment ([#3133](https://github.com/typescript-eslint/typescript-eslint/issues/3133)) ([cb22561](https://github.com/typescript-eslint/typescript-eslint/commit/cb2256168c67e0383083673a5afe77076de49da5)) ### Features -* **eslint-plugin:** [naming-convention] better error message and docs for prefix/suffix ([#2195](https://github.com/typescript-eslint/typescript-eslint/issues/2195)) ([a2ffe55](https://github.com/typescript-eslint/typescript-eslint/commit/a2ffe5568df0f7224bfe9141d298e538383d5f09)) - - - - - -# [3.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.1.0...v3.2.0) (2020-06-08) +- **eslint-plugin:** [strict-bool-expr] add fixes and suggestions ([#2847](https://github.com/typescript-eslint/typescript-eslint/issues/2847)) ([3f9e9a1](https://github.com/typescript-eslint/typescript-eslint/commit/3f9e9a1e9fc3e507bd01d1913ef642cd129de402)) +## [4.16.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.16.0...v4.16.1) (2021-03-01) ### Bug Fixes -* **eslint-plugin:** [explicit-module-boundary-types] dont report return type errors on constructor overloads ([#2158](https://github.com/typescript-eslint/typescript-eslint/issues/2158)) ([53232d7](https://github.com/typescript-eslint/typescript-eslint/commit/53232d775ca0b808e2d75d9501f4411a868b2b48)) -* **eslint-plugin:** [explicit-module-boundary-types] handle bodyless arrow functions with explicit return types that return functions ([#2169](https://github.com/typescript-eslint/typescript-eslint/issues/2169)) ([58db655](https://github.com/typescript-eslint/typescript-eslint/commit/58db655133aaae006efe3e3ceee971cf88dc348f)) -* **eslint-plugin:** [explicit-module-boundary-types] handle nested functions and functions expressions in a typed variable declaration ([#2176](https://github.com/typescript-eslint/typescript-eslint/issues/2176)) ([6ff450d](https://github.com/typescript-eslint/typescript-eslint/commit/6ff450da3abec93223a33f6b52484c9ca99b7abe)) -* **eslint-plugin:** [no-extra-non-null-assertion] dont report for assertions not followed by the optional chain ([#2167](https://github.com/typescript-eslint/typescript-eslint/issues/2167)) ([e4c1834](https://github.com/typescript-eslint/typescript-eslint/commit/e4c1834c7c5934332dd1d58c09018453568c4889)) -* **eslint-plugin:** [no-unnecessary-conditionals] Handle comparison of generics and loose comparisons with undefined values ([#2152](https://github.com/typescript-eslint/typescript-eslint/issues/2152)) ([c86e2a2](https://github.com/typescript-eslint/typescript-eslint/commit/c86e2a235372149db9b1700d39c2145e0ce5221a)) -* **eslint-plugin:** [prefer-optional-chain] handling first member expression ([#2156](https://github.com/typescript-eslint/typescript-eslint/issues/2156)) ([de18660](https://github.com/typescript-eslint/typescript-eslint/commit/de18660a8cf8f7033798646d8c5b0938d1accb12)) -* **eslint-plugin:** [return-await] correct handling of ternaries ([#2168](https://github.com/typescript-eslint/typescript-eslint/issues/2168)) ([fe4c0bf](https://github.com/typescript-eslint/typescript-eslint/commit/fe4c0bf8c04f070d6642fbe86c5e5614bc88e8fd)) - - -### Features - -* **eslint-plugin:** [naming-convention] put identifiers in quotes in error messages ([#2182](https://github.com/typescript-eslint/typescript-eslint/issues/2182)) ([fc61932](https://github.com/typescript-eslint/typescript-eslint/commit/fc619326eedf7ef2efa51444ecdead81a36a204f)), closes [#2178](https://github.com/typescript-eslint/typescript-eslint/issues/2178) -* **eslint-plugin:** [require-array-sort-compare] add `ignoreStringArrays` option ([#1972](https://github.com/typescript-eslint/typescript-eslint/issues/1972)) ([6dee784](https://github.com/typescript-eslint/typescript-eslint/commit/6dee7840a3af1dfe4c38a128d1c4655bdac625df)) -* **eslint-plugin:** add rule `ban-tslint-comment` ([#2140](https://github.com/typescript-eslint/typescript-eslint/issues/2140)) ([43ee226](https://github.com/typescript-eslint/typescript-eslint/commit/43ee226ffbaaa3e7126081db9476c24b89ec16e9)) -* **eslint-plugin:** add rule `no-confusing-non-null-assertion` ([#1941](https://github.com/typescript-eslint/typescript-eslint/issues/1941)) ([9b51c44](https://github.com/typescript-eslint/typescript-eslint/commit/9b51c44f29d8b3e95a510985544e8ded8a14404d)) - - - - - -# [3.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.0.2...v3.1.0) (2020-06-01) +- **typescript-estree:** update TS version range ([#3127](https://github.com/typescript-eslint/typescript-eslint/issues/3127)) ([0473674](https://github.com/typescript-eslint/typescript-eslint/commit/0473674c58df5039a2de3c63ad7494fc6be7487e)) +# [4.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.2...v4.16.0) (2021-03-01) ### Bug Fixes -* **eslint-plugin:** [explicit-module-boundary-types] don't check returned functions if parent function has return type ([#2084](https://github.com/typescript-eslint/typescript-eslint/issues/2084)) ([d7d4eeb](https://github.com/typescript-eslint/typescript-eslint/commit/d7d4eeb03f2918d5d9e361fdb47c2d42e83bd593)) -* **eslint-plugin:** [no-unnecessary-condition] handle comparison of any, unknown and loose comparisons with nullish values ([#2123](https://github.com/typescript-eslint/typescript-eslint/issues/2123)) ([1ae1d01](https://github.com/typescript-eslint/typescript-eslint/commit/1ae1d01e5603ec7cef8051ed018c3c3c88b29867)) -* **eslint-plugin:** [no-unnecessary-condition] improve optional chain handling ([#2111](https://github.com/typescript-eslint/typescript-eslint/issues/2111)) ([9ee399b](https://github.com/typescript-eslint/typescript-eslint/commit/9ee399b5906e82f346ff89141207a6630786de54)) -* **eslint-plugin:** [no-unnecessary-condition] improve optional chain handling 2 - electric boogaloo ([#2138](https://github.com/typescript-eslint/typescript-eslint/issues/2138)) ([c87cfaf](https://github.com/typescript-eslint/typescript-eslint/commit/c87cfaf6746775bb8ad9eb45b0002f068a822dbe)) -* **eslint-plugin:** [no-unused-expressions] ignore import expressions ([#2130](https://github.com/typescript-eslint/typescript-eslint/issues/2130)) ([e383691](https://github.com/typescript-eslint/typescript-eslint/commit/e3836910efdafd9edf04daed149c9e839c08047e)) -* **eslint-plugin:** [no-var-requires] false negative for TSAsExpression and MemberExpression ([#2139](https://github.com/typescript-eslint/typescript-eslint/issues/2139)) ([df95338](https://github.com/typescript-eslint/typescript-eslint/commit/df953388913b22d45242e65ce231d92a8b8a0080)) -* **experimental-utils:** downlevel type declarations for versions older than 3.8 ([#2133](https://github.com/typescript-eslint/typescript-eslint/issues/2133)) ([7925823](https://github.com/typescript-eslint/typescript-eslint/commit/792582326a8065270b69a0ffcaad5a7b4b103ff3)) - +- **eslint-plugin:** [consistent-indexed-object-style] do not autofix if interface has extends ([#3009](https://github.com/typescript-eslint/typescript-eslint/issues/3009)) ([b0475af](https://github.com/typescript-eslint/typescript-eslint/commit/b0475aff3920d748fa74b5a6d8a7ad5dd731aec4)) +- **eslint-plugin:** [no-implied-eval] handle conditional expression ([#3125](https://github.com/typescript-eslint/typescript-eslint/issues/3125)) ([8c65d30](https://github.com/typescript-eslint/typescript-eslint/commit/8c65d30a225a3b99e80326961d0cb0c8189b039c)) +- **eslint-plugin:** [no-unused-vars] don't report nested module declaration ([#3119](https://github.com/typescript-eslint/typescript-eslint/issues/3119)) ([4ca5888](https://github.com/typescript-eslint/typescript-eslint/commit/4ca58886adf3fc0fe31c263559990c8a534205f9)) +- **eslint-plugin:** [prefer-function-type] apply existing comments to the fixed code ([#3094](https://github.com/typescript-eslint/typescript-eslint/issues/3094)) ([c32f803](https://github.com/typescript-eslint/typescript-eslint/commit/c32f803d4480acf5ffc88e308b4243e5185c4f48)) +- **eslint-plugin:** [unbound-method] allow `super` expressions in `this` assignments ([#3010](https://github.com/typescript-eslint/typescript-eslint/issues/3010)) ([c65a139](https://github.com/typescript-eslint/typescript-eslint/commit/c65a1391be15bbcf3ae293b1c53686703883d546)) +- **scope-manager:** update libs for typescript 4.2 ([#3118](https://github.com/typescript-eslint/typescript-eslint/issues/3118)) ([0336c79](https://github.com/typescript-eslint/typescript-eslint/commit/0336c798c9502fc250d2eaa045661950da55e52f)) ### Features -* **eslint-plugin:** [ban-ts-comments] add "allow-with-description" option ([#2099](https://github.com/typescript-eslint/typescript-eslint/issues/2099)) ([8a0fd18](https://github.com/typescript-eslint/typescript-eslint/commit/8a0fd1899f544470a35afb3117f4c71aad7e4e42)) -* **eslint-plugin:** [ban-types] allow selective disable of default options with `false` value ([#2137](https://github.com/typescript-eslint/typescript-eslint/issues/2137)) ([1cb8ca4](https://github.com/typescript-eslint/typescript-eslint/commit/1cb8ca483d029935310e6904580df8501837084d)) -* **eslint-plugin:** [explicit-module-boundary-types] improve accuracy and coverage ([#2135](https://github.com/typescript-eslint/typescript-eslint/issues/2135)) ([caaa859](https://github.com/typescript-eslint/typescript-eslint/commit/caaa8599284d02ab3341e282cad35a52d0fb86c7)) - - - - - -## [3.0.2](https://github.com/typescript-eslint/typescript-eslint/compare/v3.0.1...v3.0.2) (2020-05-27) +- TypeScript 4.2 syntax support ([#3112](https://github.com/typescript-eslint/typescript-eslint/issues/3112)) ([2ebfb21](https://github.com/typescript-eslint/typescript-eslint/commit/2ebfb21ba6c88c793cfbd0e231e5803b2381694c)) +- **eslint-plugin:** [member-delimiter-style] Add an option 'multilineDetection' to treat types and interfaces as single line if the last member ends on the same line as the closing bracket ([#2970](https://github.com/typescript-eslint/typescript-eslint/issues/2970)) ([cf86f42](https://github.com/typescript-eslint/typescript-eslint/commit/cf86f427186d58b0fce4bb3ff9571c4301babeb3)) +- **eslint-plugin:** [prom-func-async] report only function head ([#2872](https://github.com/typescript-eslint/typescript-eslint/issues/2872)) ([25f459c](https://github.com/typescript-eslint/typescript-eslint/commit/25f459cdc4f38d44b48554e04cfa1676538ccdfb)) +- **typescript-estree:** throw custom error instead of plain object ([#3011](https://github.com/typescript-eslint/typescript-eslint/issues/3011)) ([ae14bf5](https://github.com/typescript-eslint/typescript-eslint/commit/ae14bf55fe31b0eb982ba17333e4aac550d10342)) +## [4.15.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.1...v4.15.2) (2021-02-22) ### Bug Fixes -* regression for eslint v6 ([#2105](https://github.com/typescript-eslint/typescript-eslint/issues/2105)) ([31fc503](https://github.com/typescript-eslint/typescript-eslint/commit/31fc5039ed919e1515fda673c186d5c83eb5beb3)) - - - - - -## [3.0.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.0.0...v3.0.1) (2020-05-25) +- **typescript-estree:** correct issues in AST definition ([#3083](https://github.com/typescript-eslint/typescript-eslint/issues/3083)) ([509a117](https://github.com/typescript-eslint/typescript-eslint/commit/509a11749f85400a01e9fecfecd12871ce562d3d)) +- add missing intrinsic keyword node to AST ([#3081](https://github.com/typescript-eslint/typescript-eslint/issues/3081)) ([409bf0b](https://github.com/typescript-eslint/typescript-eslint/commit/409bf0bb3e2ac4d8782408d436ebdefb42dba38b)) +- **eslint-plugin:** [no-var-requires] report when used in type assertion ([#3074](https://github.com/typescript-eslint/typescript-eslint/issues/3074)) ([763a252](https://github.com/typescript-eslint/typescript-eslint/commit/763a2520bfea09c3b6252ea36bc3ff10b05eca6c)) +- correct test names on windows for semantic-diagnostics-enabled ([#3060](https://github.com/typescript-eslint/typescript-eslint/issues/3060)) ([885780d](https://github.com/typescript-eslint/typescript-eslint/commit/885780d4a2b07e418256b7323d76b18453c14a50)) +## [4.15.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.0...v4.15.1) (2021-02-15) ### Bug Fixes -* **eslint-plugin:** [naming-convention] handle no options correctly ([#2095](https://github.com/typescript-eslint/typescript-eslint/issues/2095)) ([fd7d02b](https://github.com/typescript-eslint/typescript-eslint/commit/fd7d02b31ebd995b7fdd857d7c054042aa4f2001)) -* **eslint-plugin:** [no-throw-literal] handle intersection and union types ([#2085](https://github.com/typescript-eslint/typescript-eslint/issues/2085)) ([cae037f](https://github.com/typescript-eslint/typescript-eslint/commit/cae037ff9b20363b970cc600a09505b98bf10a14)) -* **eslint-plugin:** [unbound-method] fix crash due to missing `Intl` ([#2090](https://github.com/typescript-eslint/typescript-eslint/issues/2090)) ([f2fa82c](https://github.com/typescript-eslint/typescript-eslint/commit/f2fa82c532ae858ccfb064268cfcc9df657a54be)) -* **experimental-utils:** export `CLIEngine` & `ESLint` ([#2083](https://github.com/typescript-eslint/typescript-eslint/issues/2083)) ([014341b](https://github.com/typescript-eslint/typescript-eslint/commit/014341bb23261f609fc2a6fe7fece191466a084a)) -* **typescript-estree:** handle `BigInt` with `_` numeric separator ([#2067](https://github.com/typescript-eslint/typescript-eslint/issues/2067)) ([66f1627](https://github.com/typescript-eslint/typescript-eslint/commit/66f1627b11a566d5b925a577e800f99d5c808be2)) -* **typescript-estree:** mark TS 3.8 and 3.9 as "supported" ([#2057](https://github.com/typescript-eslint/typescript-eslint/issues/2057)) ([5eedbff](https://github.com/typescript-eslint/typescript-eslint/commit/5eedbff01178ea33b98ab22e556df4c1a195f839)), closes [#1436](https://github.com/typescript-eslint/typescript-eslint/issues/1436) [#1436](https://github.com/typescript-eslint/typescript-eslint/issues/1436) - +- **eslint-plugin:** [explicit-module-boundary-types] check allowNames on function declarations and property methods ([#3051](https://github.com/typescript-eslint/typescript-eslint/issues/3051)) ([0ade469](https://github.com/typescript-eslint/typescript-eslint/commit/0ade469dc1cf17d79c36a9c985630d60491ed847)) - - - -# [3.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.34.0...v3.0.0) (2020-05-21) - -## [Please see the release notes for v3.0.0](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v3.0.0) +# [4.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.2...v4.15.0) (2021-02-08) ### Bug Fixes -* **eslint-plugin:** [dot-notation] fix typo in schema ([#2040](https://github.com/typescript-eslint/typescript-eslint/issues/2040)) ([242328f](https://github.com/typescript-eslint/typescript-eslint/commit/242328fa749ee4c72af93433a9bef95f329ac62f)) -* **eslint-plugin:** correct parser peerDep version ([fe59f69](https://github.com/typescript-eslint/typescript-eslint/commit/fe59f69381a0915a4f5135e2e88637a5eea246ba)) -* **experimental-utils:** add back SourceCode.isSpaceBetweenTokens ([ae82ea4](https://github.com/typescript-eslint/typescript-eslint/commit/ae82ea4a85a4ca332ebe6104e96c59dba30411be)) -* **typescript-estree:** remove now defunct `Import` node type ([f199cbd](https://github.com/typescript-eslint/typescript-eslint/commit/f199cbdbbd892b5ba03bfff66f463f3d9c92ee9b)) -* **typescript-estree:** use `TSEmptyBodyFunctionExpression` for body-less nodes ([#1289](https://github.com/typescript-eslint/typescript-eslint/issues/1289)) ([82e7163](https://github.com/typescript-eslint/typescript-eslint/commit/82e7163214b56ccde93ba97807b161669a50a60b)) - +- **eslint-plugin:** [no-extra-parens] handle ESLint 7.19.0 ([#2993](https://github.com/typescript-eslint/typescript-eslint/issues/2993)) ([4615048](https://github.com/typescript-eslint/typescript-eslint/commit/4615048d24359e0fc57b90a96acf4d8ded1dc7bf)) +- **eslint-plugin:** [prefer-function-type] correct fixer when signature ends with a semi ([#3002](https://github.com/typescript-eslint/typescript-eslint/issues/3002)) ([898dd39](https://github.com/typescript-eslint/typescript-eslint/commit/898dd3961944a5da3a129e9eba02634286e7aee4)) +- **scope-manager:** fix visiting of TSImportType ([#3008](https://github.com/typescript-eslint/typescript-eslint/issues/3008)) ([ce4fcbf](https://github.com/typescript-eslint/typescript-eslint/commit/ce4fcbf4401098387a2cf19ae8457c89c509239a)), closes [#3006](https://github.com/typescript-eslint/typescript-eslint/issues/3006) ### Features -* add index files to parser and typescript-estree ([3dfc46d](https://github.com/typescript-eslint/typescript-eslint/commit/3dfc46dccbbd28eed2d74c7b6cacddf1a0848598)) -* **eslint-plugin:** [no-floating-promises] ignore void operator by default ([#2003](https://github.com/typescript-eslint/typescript-eslint/issues/2003)) ([3626a67](https://github.com/typescript-eslint/typescript-eslint/commit/3626a673cf8117cc995245cd86e466e2553e9b0e)) -* **eslint-plugin:** [no-unnecessary-condition] remove `checkArrayPredicates` and always check it ([#1579](https://github.com/typescript-eslint/typescript-eslint/issues/1579)) ([bfd9b60](https://github.com/typescript-eslint/typescript-eslint/commit/bfd9b606d17d30d5694967a1f01e0e1501ba1022)) -* **eslint-plugin:** [no-unnecessary-condition] report when non-nullish is compared to `null`/`undefined` ([#1659](https://github.com/typescript-eslint/typescript-eslint/issues/1659)) ([7fa9060](https://github.com/typescript-eslint/typescript-eslint/commit/7fa906073903c5eb70609c25f1a91ada14dcdc71)) -* **eslint-plugin:** [prefer-nullish-coalescing][prefer-optional-chain] remove unsafe fixers ([52b6085](https://github.com/typescript-eslint/typescript-eslint/commit/52b60852d0ba6bb6abe519c9d3ec1b231793e91d)) -* **eslint-plugin:** [restrict-template-expressions] `allowNumber: true` by default ([#2005](https://github.com/typescript-eslint/typescript-eslint/issues/2005)) ([643ec24](https://github.com/typescript-eslint/typescript-eslint/commit/643ec240bd901295d9e9ea5c43fc20109c33e982)) -* **eslint-plugin:** [restrict-template-expressions] rename `allowNullable` to `allowNullish` ([#2006](https://github.com/typescript-eslint/typescript-eslint/issues/2006)) ([264b017](https://github.com/typescript-eslint/typescript-eslint/commit/264b017c11c2ab132fcbad18b42a9a0fe639386e)) -* **experimental-utils:** upgrade eslint types for v7 ([#2023](https://github.com/typescript-eslint/typescript-eslint/issues/2023)) ([06869c9](https://github.com/typescript-eslint/typescript-eslint/commit/06869c9656fa37936126666845aee40aad546ebd)) -* bump minimum required TS version ([#2004](https://github.com/typescript-eslint/typescript-eslint/issues/2004)) ([7ad4d7c](https://github.com/typescript-eslint/typescript-eslint/commit/7ad4d7c2db088b6f779b9d883a4acad13eee3775)) -* upgrade to ESLint v7 ([#2022](https://github.com/typescript-eslint/typescript-eslint/issues/2022)) ([208de71](https://github.com/typescript-eslint/typescript-eslint/commit/208de71059746bf38e94bd460346ffb2698a3e12)) -* **eslint-plugin:** [ban-types] rework default options ([#848](https://github.com/typescript-eslint/typescript-eslint/issues/848)) ([8e31d5d](https://github.com/typescript-eslint/typescript-eslint/commit/8e31d5dbe9fe5227fdbefcecfd50ce5dd51360c3)) -* **eslint-plugin:** [no-unnecessary-condition] remove option `ignoreRHS` ([#1163](https://github.com/typescript-eslint/typescript-eslint/issues/1163)) ([ee8dd8f](https://github.com/typescript-eslint/typescript-eslint/commit/ee8dd8f8a9e6c25ac426ce9bb71c5f012c51f264)) -* **eslint-plugin:** [strict-boolean-expression] rework options ([#1631](https://github.com/typescript-eslint/typescript-eslint/issues/1631)) ([cd14482](https://github.com/typescript-eslint/typescript-eslint/commit/cd1448240dca11762fcb9c10e18bb6541a840485)) -* **eslint-plugin:** delete deprecated rules ([#2002](https://github.com/typescript-eslint/typescript-eslint/issues/2002)) ([da0aec2](https://github.com/typescript-eslint/typescript-eslint/commit/da0aec2cfa27902aae7c438a2fe91343c822e4ae)) -* **eslint-plugin:** eslint-recommended: disable no-func-assign ([#984](https://github.com/typescript-eslint/typescript-eslint/issues/984)) ([ae9b8a9](https://github.com/typescript-eslint/typescript-eslint/commit/ae9b8a9c73c0328287de956466257d8bbfbdb20f)) -* **eslint-plugin:** eslint-recommended: disable no-obj-calls ([#1000](https://github.com/typescript-eslint/typescript-eslint/issues/1000)) ([b9ca14c](https://github.com/typescript-eslint/typescript-eslint/commit/b9ca14c5f5ec28a3fde1a9b2d2f6a4dc74d903e4)) -* **eslint-plugin:** update `eslint-recommended` set ([#1996](https://github.com/typescript-eslint/typescript-eslint/issues/1996)) ([9a96e18](https://github.com/typescript-eslint/typescript-eslint/commit/9a96e18400e0a0d738d159d9d01faf41d3586249)) -* **eslint-plugin:** update recommended sets ([#2001](https://github.com/typescript-eslint/typescript-eslint/issues/2001)) ([0126b4f](https://github.com/typescript-eslint/typescript-eslint/commit/0126b4f56f9197d561e90b09962ccceb4f88bc41)) -* **typescript-estree:** align nodes with estree 2020 ([#1389](https://github.com/typescript-eslint/typescript-eslint/issues/1389)) ([aff5b62](https://github.com/typescript-eslint/typescript-eslint/commit/aff5b62044f9b93f2087a1d261e9be3f8d6fd54d)) -* **typescript-estree:** align optional fields ([#1429](https://github.com/typescript-eslint/typescript-eslint/issues/1429)) ([0e0010f](https://github.com/typescript-eslint/typescript-eslint/commit/0e0010f82952f9beeeb84136eea00cc5eecc9db6)) -* drop support for node v8 ([#1997](https://github.com/typescript-eslint/typescript-eslint/issues/1997)) ([b6c3b7b](https://github.com/typescript-eslint/typescript-eslint/commit/b6c3b7b84b8d199fa75a46432febd4a364a63217)) -* **typescript-estree:** always return parserServices ([#716](https://github.com/typescript-eslint/typescript-eslint/issues/716)) ([5b23443](https://github.com/typescript-eslint/typescript-eslint/commit/5b23443c48f3f62424db3e742243f3568080b946)) -* **typescript-estree:** handle 3.9's non-null assertion changes ([#2036](https://github.com/typescript-eslint/typescript-eslint/issues/2036)) ([06bec63](https://github.com/typescript-eslint/typescript-eslint/commit/06bec63c56536db070608ab136d2ad57083f0c6a)) - - +- **typescript-estree:** improve logic used to escape string literals in jsx ([#2995](https://github.com/typescript-eslint/typescript-eslint/issues/2995)) ([3cb3aad](https://github.com/typescript-eslint/typescript-eslint/commit/3cb3aade2864bab15ed1ff8d7cd32766aa57152f)) +## [4.14.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.1...v4.14.2) (2021-02-01) +### Bug Fixes -# [2.34.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.33.0...v2.34.0) (2020-05-18) +- **eslint-plugin:** [consistent-type-imports] incorrect handling of computed property type signatures ([#2990](https://github.com/typescript-eslint/typescript-eslint/issues/2990)) ([58f2655](https://github.com/typescript-eslint/typescript-eslint/commit/58f26555f62b5f59f13260306638d3148cde6079)), closes [#2989](https://github.com/typescript-eslint/typescript-eslint/issues/2989) +- **scope-manager:** correctly reference generic parameters when decorator metadata is enabled ([#2975](https://github.com/typescript-eslint/typescript-eslint/issues/2975)) ([7695ef3](https://github.com/typescript-eslint/typescript-eslint/commit/7695ef318f1cc8688acaabf4f2730769622f083f)), closes [#2972](https://github.com/typescript-eslint/typescript-eslint/issues/2972) +## [4.14.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.0...v4.14.1) (2021-01-25) ### Bug Fixes -* **typescript-estree:** fix handling of range/loc removal ([#2028](https://github.com/typescript-eslint/typescript-eslint/issues/2028)) ([ce344d9](https://github.com/typescript-eslint/typescript-eslint/commit/ce344d90e7c78b0c4b4b823494a3e78190f45c64)) +- **eslint-plugin:** [sort-type-union-intersection-members] consider `void` as a `nullish` ([#2944](https://github.com/typescript-eslint/typescript-eslint/issues/2944)) ([a241b25](https://github.com/typescript-eslint/typescript-eslint/commit/a241b25863eb063986fab76b511f478bbba91f47)), closes [#2940](https://github.com/typescript-eslint/typescript-eslint/issues/2940) +- **scope-manager:** fix incorrect handling of class decorators and class method default params ([#2943](https://github.com/typescript-eslint/typescript-eslint/issues/2943)) ([e1eac83](https://github.com/typescript-eslint/typescript-eslint/commit/e1eac8312268d1855a2ed7784b4d190ecb9c9fa4)), closes [#2941](https://github.com/typescript-eslint/typescript-eslint/issues/2941) [#2942](https://github.com/typescript-eslint/typescript-eslint/issues/2942) [#2751](https://github.com/typescript-eslint/typescript-eslint/issues/2751) +# [4.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.13.0...v4.14.0) (2021-01-18) ### Features -* **eslint-plugin:** [no-invalid-void-type] allow union of void and `allowInGenericTypeArguments` ([#1960](https://github.com/typescript-eslint/typescript-eslint/issues/1960)) ([1bc105a](https://github.com/typescript-eslint/typescript-eslint/commit/1bc105a2c6ae3fde9596f0419fed0de699dc57c7)) -* **eslint-plugin:** [restrict-template-expressions] improve error message ([#1926](https://github.com/typescript-eslint/typescript-eslint/issues/1926)) ([1af59ba](https://github.com/typescript-eslint/typescript-eslint/commit/1af59ba8ac0ceabb008d9c61556acf7db0a1d352)) -* **experimental-utils:** add `suggestion` property for rule modules ([#2033](https://github.com/typescript-eslint/typescript-eslint/issues/2033)) ([f42a5b0](https://github.com/typescript-eslint/typescript-eslint/commit/f42a5b09ebfa173f418a99c552b0cbe221567194)) +- add support for decorator metadata in scope analysis and in consistent-type-imports ([#2751](https://github.com/typescript-eslint/typescript-eslint/issues/2751)) ([445e416](https://github.com/typescript-eslint/typescript-eslint/commit/445e416878b27a54bf07c2d3b84dabd7b06e51bc)), closes [#2559](https://github.com/typescript-eslint/typescript-eslint/issues/2559) +- **eslint-plugin:** add `object-curly-spacing` rule ([#2892](https://github.com/typescript-eslint/typescript-eslint/issues/2892)) ([32bd18d](https://github.com/typescript-eslint/typescript-eslint/commit/32bd18de80f4f8388717d0f0c16d493234362aa5)) +# [4.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.12.0...v4.13.0) (2021-01-11) +### Bug Fixes +- **eslint-plugin:** support eslint@5 ([#2917](https://github.com/typescript-eslint/typescript-eslint/issues/2917)) ([f606846](https://github.com/typescript-eslint/typescript-eslint/commit/f606846af2617a0d8ee3ad5ce7c10864161ebf53)) +### Features -# [2.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.32.0...v2.33.0) (2020-05-12) +- **eslint-plugin:** [sort-type-union-intersection-members] add nullish group ([#2919](https://github.com/typescript-eslint/typescript-eslint/issues/2919)) ([5558f41](https://github.com/typescript-eslint/typescript-eslint/commit/5558f410007da58a3f4726bbf9501c924ef166a1)) +# [4.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.11.1...v4.12.0) (2021-01-04) ### Bug Fixes -* **experimental-utils:** remove accidental dep on json-schema ([#2010](https://github.com/typescript-eslint/typescript-eslint/issues/2010)) ([1875fba](https://github.com/typescript-eslint/typescript-eslint/commit/1875fbad41f2a3dda8f610f5dcd180c6205b73d3)) - +- **eslint-plugin:** [comma-spacing] handle empty type params ([#2915](https://github.com/typescript-eslint/typescript-eslint/issues/2915)) ([4d69fbb](https://github.com/typescript-eslint/typescript-eslint/commit/4d69fbba91ea3161213a0ab093e398fed091168c)) ### Features -* **eslint-plugin:** add extension rule `lines-between-class-members` ([#1684](https://github.com/typescript-eslint/typescript-eslint/issues/1684)) ([08f93e6](https://github.com/typescript-eslint/typescript-eslint/commit/08f93e69347a8e7f3a7e8a1455bb5d069c2faeef)) - - +- **eslint-plugin:** add rule `sort-type-union-intersection-members` ([#2913](https://github.com/typescript-eslint/typescript-eslint/issues/2913)) ([9092c04](https://github.com/typescript-eslint/typescript-eslint/commit/9092c0494ebd3486e38852198c1930f1432ef21f)) +## [4.11.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.11.0...v4.11.1) (2020-12-28) +### Bug Fixes -# [2.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.31.0...v2.32.0) (2020-05-11) +- **eslint-plugin:** [naming-convention] fix precedence of method and property meta selectors ([#2877](https://github.com/typescript-eslint/typescript-eslint/issues/2877)) ([2f10e1a](https://github.com/typescript-eslint/typescript-eslint/commit/2f10e1a5c795cac28a6e0a1a3a0adb5bd6be7f1c)) +# [4.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.10.0...v4.11.0) (2020-12-21) ### Bug Fixes -* **eslint-plugin:** [no-base-to-string] support boolean in unions ([#1979](https://github.com/typescript-eslint/typescript-eslint/issues/1979)) ([6987ecc](https://github.com/typescript-eslint/typescript-eslint/commit/6987ecc1dacfb45c0f8ed3e81d08aa708eb96ad1)) -* **eslint-plugin:** [no-type-alias] handle readonly types in aliases ([#1990](https://github.com/typescript-eslint/typescript-eslint/issues/1990)) ([56d9870](https://github.com/typescript-eslint/typescript-eslint/commit/56d987070f83d1b6410b04750b20a761fd793073)) -* **eslint-plugin:** [no-unused-expressions] inherit `messages` from base rule ([#1992](https://github.com/typescript-eslint/typescript-eslint/issues/1992)) ([51ca404](https://github.com/typescript-eslint/typescript-eslint/commit/51ca404af645eed194269ab7f8f67b97bd52e32d)) - +- **eslint-plugin:** [non-nullable-type-assertion-style] handle const assertion ([#2881](https://github.com/typescript-eslint/typescript-eslint/issues/2881)) ([53dc34d](https://github.com/typescript-eslint/typescript-eslint/commit/53dc34d3917b90c8ab0324fe8054619ddee98003)) ### Features -* bump dependencies and align AST ([#2007](https://github.com/typescript-eslint/typescript-eslint/issues/2007)) ([18668b7](https://github.com/typescript-eslint/typescript-eslint/commit/18668b78fd7d1e5281af7fc26c76e0ca53297f69)) - - - - - -# [2.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.30.0...v2.31.0) (2020-05-04) +- **eslint-plugin:** [prom-func-async] add automatic fix ([#2845](https://github.com/typescript-eslint/typescript-eslint/issues/2845)) ([717e718](https://github.com/typescript-eslint/typescript-eslint/commit/717e718e91df2165422228c02dfa248cf55f65a1)) +# [4.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.9.1...v4.10.0) (2020-12-14) ### Bug Fixes -* **eslint-plugin:** [dot-notation] handle missing declarations ([#1947](https://github.com/typescript-eslint/typescript-eslint/issues/1947)) ([383f931](https://github.com/typescript-eslint/typescript-eslint/commit/383f93182599c00e231a0f0d36575ca0e19369a6)) -* **eslint-plugin:** [method-signature-style] fix overloaded methods to an intersection type ([#1966](https://github.com/typescript-eslint/typescript-eslint/issues/1966)) ([7f3fba3](https://github.com/typescript-eslint/typescript-eslint/commit/7f3fba348d432d7637e1c737df943ee1f9105062)) -* **eslint-plugin:** [return-await] await in a normal function ([#1962](https://github.com/typescript-eslint/typescript-eslint/issues/1962)) ([f82fd7b](https://github.com/typescript-eslint/typescript-eslint/commit/f82fd7bb81f986c4861d0b4e2ecdb0c496d7a602)) -* **eslint-plugin:** [unbound-method] false positives for unary expressions ([#1964](https://github.com/typescript-eslint/typescript-eslint/issues/1964)) ([b35070e](https://github.com/typescript-eslint/typescript-eslint/commit/b35070ec6f84ad5ce606386cdb6eeb91488dfdd7)) -* **eslint-plugin:** no-base-to-string boolean expression detect ([#1969](https://github.com/typescript-eslint/typescript-eslint/issues/1969)) ([f78f13a](https://github.com/typescript-eslint/typescript-eslint/commit/f78f13aedd59d5b5880903d48c779a6c50fd937e)) - +- **eslint-plugin:** [naming-convention] fix wrong member of `method` and `property` meta selectors ([#2856](https://github.com/typescript-eslint/typescript-eslint/issues/2856)) ([9a6c362](https://github.com/typescript-eslint/typescript-eslint/commit/9a6c3628a2f3a7748b7a4b9b0c55400c8d7dfeae)) ### Features -* **eslint-plugin:** [member-ordering] add decorators support ([#1870](https://github.com/typescript-eslint/typescript-eslint/issues/1870)) ([f7ec192](https://github.com/typescript-eslint/typescript-eslint/commit/f7ec1920607cb8eec8020b08cd7247de0bf19ce1)) -* **eslint-plugin:** [prefer-optional-chain] added option to convert to suggestion fixer ([#1965](https://github.com/typescript-eslint/typescript-eslint/issues/1965)) ([2f0824b](https://github.com/typescript-eslint/typescript-eslint/commit/2f0824b0a41f3043b6242fc1d49faae540abaf22)) -* **eslint-plugin:** new extended rule 'no-invalid-this' ([#1823](https://github.com/typescript-eslint/typescript-eslint/issues/1823)) ([b18bc35](https://github.com/typescript-eslint/typescript-eslint/commit/b18bc357507337b9725f8d9c1b549513075a0da5)) -* **eslint-plugin-internal:** add rule no-poorly-typed-ts-props ([#1949](https://github.com/typescript-eslint/typescript-eslint/issues/1949)) ([56ea7c9](https://github.com/typescript-eslint/typescript-eslint/commit/56ea7c9581c0c99fe394bbcfc4128e8054c88ab2)) -* **experimental-utils:** expose our RuleTester extension ([#1948](https://github.com/typescript-eslint/typescript-eslint/issues/1948)) ([2dd1638](https://github.com/typescript-eslint/typescript-eslint/commit/2dd1638aaa2658ba99b2341861146b586f489121)) - - +- **eslint-plugin:** add rule `non-nullable-type-assertion-style` ([#2624](https://github.com/typescript-eslint/typescript-eslint/issues/2624)) ([7eee44f](https://github.com/typescript-eslint/typescript-eslint/commit/7eee44fff3041a9725d34bf2fcbfc6fd40a60c61)) +## [4.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.9.0...v4.9.1) (2020-12-07) +### Bug Fixes -# [2.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.29.0...v2.30.0) (2020-04-27) +- **eslint-plugin:** [method-signature-style] fix crash with methods without a return type ([#2836](https://github.com/typescript-eslint/typescript-eslint/issues/2836)) ([fed89f2](https://github.com/typescript-eslint/typescript-eslint/commit/fed89f24ebe42a6412f0eb19949d5d4771656189)), closes [#2834](https://github.com/typescript-eslint/typescript-eslint/issues/2834) +- **eslint-plugin:** [no-unused-vars] false-positive with class expressions ([#2833](https://github.com/typescript-eslint/typescript-eslint/issues/2833)) ([aadb39f](https://github.com/typescript-eslint/typescript-eslint/commit/aadb39f0ff500ee99ea80e9009ab61283ca9c8cd)), closes [#2831](https://github.com/typescript-eslint/typescript-eslint/issues/2831) +- **eslint-plugin:** [no-unused-vars] fix race condition between naming-convention and no-unused-vars ([#2848](https://github.com/typescript-eslint/typescript-eslint/issues/2848)) ([ccb6b94](https://github.com/typescript-eslint/typescript-eslint/commit/ccb6b9499a4a4077f2e3d81d0844860a25244a0f)), closes [#2844](https://github.com/typescript-eslint/typescript-eslint/issues/2844) +# [4.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.2...v4.9.0) (2020-11-30) ### Bug Fixes -* **eslint-plugin:** [prefer-string-starts-ends-with] check for negative start index in slice ([#1920](https://github.com/typescript-eslint/typescript-eslint/issues/1920)) ([ed2bd60](https://github.com/typescript-eslint/typescript-eslint/commit/ed2bd6067f74ae33e36a084719bb91efedfba599)) -* **eslint-plugin:** fix no-base-to-string boolean literal check ([#1850](https://github.com/typescript-eslint/typescript-eslint/issues/1850)) ([2f45e99](https://github.com/typescript-eslint/typescript-eslint/commit/2f45e9992a8f12b6233716e77a6159f9cea2c879)) - +- **eslint-plugin:** [consistent-indexed-object-style] convert readonly index signature to readonly record ([#2798](https://github.com/typescript-eslint/typescript-eslint/issues/2798)) ([29428a4](https://github.com/typescript-eslint/typescript-eslint/commit/29428a4dbef133563f2ee54b22908a01ab9a9472)) +- **eslint-plugin:** [consistent-type-imports] crash when using both default and namespace in one import ([#2778](https://github.com/typescript-eslint/typescript-eslint/issues/2778)) ([c816b84](https://github.com/typescript-eslint/typescript-eslint/commit/c816b84814214f7504a0d89a5cd3b08c595bfb50)) +- **eslint-plugin:** [explicit-module-boundary-types] ignore functions exported within typed object/array literals ([#2805](https://github.com/typescript-eslint/typescript-eslint/issues/2805)) ([73a63ee](https://github.com/typescript-eslint/typescript-eslint/commit/73a63ee9ea00b2db0a29f148d7863c3778e4a483)) +- **eslint-plugin:** [no-use-before-define] allow class references if they're within a class decorator ([#2827](https://github.com/typescript-eslint/typescript-eslint/issues/2827)) ([050023a](https://github.com/typescript-eslint/typescript-eslint/commit/050023aa7bd791d0be7b5788a9dcd8e61a00ce79)), closes [#2842](https://github.com/typescript-eslint/typescript-eslint/issues/2842) +- **eslint-plugin:** [triple-slash-reference] fix crash with external module reference ([#2788](https://github.com/typescript-eslint/typescript-eslint/issues/2788)) ([32b1b68](https://github.com/typescript-eslint/typescript-eslint/commit/32b1b6839fb32d93b7faa8fec74c9cb68ea587bb)) +- **scope-manager:** fix assertion assignments not being marked as write references ([#2809](https://github.com/typescript-eslint/typescript-eslint/issues/2809)) ([fa68492](https://github.com/typescript-eslint/typescript-eslint/commit/fa6849245ca55ca407dc031afbad456f2925a8e9)), closes [#2804](https://github.com/typescript-eslint/typescript-eslint/issues/2804) +- **typescript-estree:** add default value for `parserOptions.projectFolderIgnoreList` and deduplicate resolved projects ([#2819](https://github.com/typescript-eslint/typescript-eslint/issues/2819)) ([bf904ec](https://github.com/typescript-eslint/typescript-eslint/commit/bf904ec72db57174fec531f61e9427230662553e)), closes [#2418](https://github.com/typescript-eslint/typescript-eslint/issues/2418) [#2814](https://github.com/typescript-eslint/typescript-eslint/issues/2814) ### Features -* **eslint-plugin:** add extension rule `dot-notation` ([#1867](https://github.com/typescript-eslint/typescript-eslint/issues/1867)) ([a85c3e1](https://github.com/typescript-eslint/typescript-eslint/commit/a85c3e1515d735b6c245cc658cdaec6deb05d630)) -* **eslint-plugin:** create `no-invalid-void-type` rule ([#1847](https://github.com/typescript-eslint/typescript-eslint/issues/1847)) ([f667ff1](https://github.com/typescript-eslint/typescript-eslint/commit/f667ff1708d4ed28b7ea5beea742889da69a76d9)) -* **experimental-utils:** allow rule options to be a readonly tuple ([#1924](https://github.com/typescript-eslint/typescript-eslint/issues/1924)) ([4ef6788](https://github.com/typescript-eslint/typescript-eslint/commit/4ef67884962b6aac61cc895aaa3ba16aa892ecf4)) +- **eslint-plugin:** [naming-convention] add `requireDouble`, `allowDouble`, `allowSingleOrDouble` options for underscores ([#2812](https://github.com/typescript-eslint/typescript-eslint/issues/2812)) ([dd0576a](https://github.com/typescript-eslint/typescript-eslint/commit/dd0576a66c34810bc60e0958948c9a8104a3f1a3)) +- **eslint-plugin:** [naming-convention] add `requiresQuotes` modifier ([#2813](https://github.com/typescript-eslint/typescript-eslint/issues/2813)) ([6fc8409](https://github.com/typescript-eslint/typescript-eslint/commit/6fc84094928c3645a0e04c31bd4d759fdfbdcb74)), closes [#2761](https://github.com/typescript-eslint/typescript-eslint/issues/2761) [#1483](https://github.com/typescript-eslint/typescript-eslint/issues/1483) +- **eslint-plugin:** [naming-convention] add modifier `unused` ([#2810](https://github.com/typescript-eslint/typescript-eslint/issues/2810)) ([6a06944](https://github.com/typescript-eslint/typescript-eslint/commit/6a06944e60677a402e7ab432e6ac1209737a7027)) +- **eslint-plugin:** [naming-convention] add modifiers `exported`, `global`, and `destructured` ([#2808](https://github.com/typescript-eslint/typescript-eslint/issues/2808)) ([fb254a1](https://github.com/typescript-eslint/typescript-eslint/commit/fb254a1036b89f9b78f927d607358e65e81a2250)), closes [#2239](https://github.com/typescript-eslint/typescript-eslint/issues/2239) [#2512](https://github.com/typescript-eslint/typescript-eslint/issues/2512) [#2318](https://github.com/typescript-eslint/typescript-eslint/issues/2318) [#2802](https://github.com/typescript-eslint/typescript-eslint/issues/2802) +- **eslint-plugin:** [naming-convention] allow `destructured` modifier for `parameter` selector ([#2829](https://github.com/typescript-eslint/typescript-eslint/issues/2829)) ([525d2ff](https://github.com/typescript-eslint/typescript-eslint/commit/525d2ff9292d89e1445b273b5378159bca323a1e)), closes [#2828](https://github.com/typescript-eslint/typescript-eslint/issues/2828) +- **eslint-plugin:** [naming-convention] split `property` and `method` selectors into more granular `classXXX`, `objectLiteralXXX`, `typeXXX` ([#2807](https://github.com/typescript-eslint/typescript-eslint/issues/2807)) ([665b6d4](https://github.com/typescript-eslint/typescript-eslint/commit/665b6d4023fb9d821f348c39aefff0d7571a98bf)), closes [#1477](https://github.com/typescript-eslint/typescript-eslint/issues/1477) [#2802](https://github.com/typescript-eslint/typescript-eslint/issues/2802) +- **eslint-plugin:** [no-unused-vars] fork the base rule ([#2768](https://github.com/typescript-eslint/typescript-eslint/issues/2768)) ([a8227a6](https://github.com/typescript-eslint/typescript-eslint/commit/a8227a6185dd24de4bfc7d766931643871155021)), closes [#2782](https://github.com/typescript-eslint/typescript-eslint/issues/2782) [#2714](https://github.com/typescript-eslint/typescript-eslint/issues/2714) [#2648](https://github.com/typescript-eslint/typescript-eslint/issues/2648) +- **eslint-plugin:** [unbound-method] add support for methods with a `this: void` parameter ([#2796](https://github.com/typescript-eslint/typescript-eslint/issues/2796)) ([878dd4a](https://github.com/typescript-eslint/typescript-eslint/commit/878dd4ae8c408f1eb42790a8fac37f85040b7f3c)) +## [4.8.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.1...v4.8.2) (2020-11-23) +### Bug Fixes +- **eslint-plugin:** [prefer-literal-enum-member] allow pure template literal strings ([#2786](https://github.com/typescript-eslint/typescript-eslint/issues/2786)) ([f3bf6a1](https://github.com/typescript-eslint/typescript-eslint/commit/f3bf6a1791c9dc64bb18d45712f07767c9f96cbd)) +- **typescript-estree:** fix type-only regression for consumers not yet on TS 4.1 ([#2789](https://github.com/typescript-eslint/typescript-eslint/issues/2789)) ([50a46c6](https://github.com/typescript-eslint/typescript-eslint/commit/50a46c60fb81d8434aa4268a13d17d8fcf499e21)) +## [4.8.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.0...v4.8.1) (2020-11-17) -# [2.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.28.0...v2.29.0) (2020-04-20) +### Bug Fixes +- **eslint-plugin:** [no-unnecessary-condition] false positive when array predicate returns unknown ([#2772](https://github.com/typescript-eslint/typescript-eslint/issues/2772)) ([111c244](https://github.com/typescript-eslint/typescript-eslint/commit/111c244c3eb157efeb5c43ff39f12633b27f091e)) +- **typescript-estree:** parseWithNodeMaps returning empty maps ([#2773](https://github.com/typescript-eslint/typescript-eslint/issues/2773)) ([3e4a0ed](https://github.com/typescript-eslint/typescript-eslint/commit/3e4a0ed0d615fd22a2f28c7c8af6179673e195f8)) -### Bug Fixes +# [4.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.7.0...v4.8.0) (2020-11-16) -* **eslint-plugin:** [no-base-to-string] soft remove `ignoreTaggedTemplateExpressions` option ([#1916](https://github.com/typescript-eslint/typescript-eslint/issues/1916)) ([369978e](https://github.com/typescript-eslint/typescript-eslint/commit/369978e9685bacb3e3882b0510ff06eaf8df4ca1)) +### Bug Fixes +- **eslint-plugin:** [consistent-type-definitions] remove fixer when the interface is within a global module declaration ([#2739](https://github.com/typescript-eslint/typescript-eslint/issues/2739)) ([2326238](https://github.com/typescript-eslint/typescript-eslint/commit/2326238738c95acfc14c17f9b16798f1de6d267f)) +- **eslint-plugin:** [no-unsafe-member-access] ignore MemberExpression's whose parents are either TSClassImplements or TSInterfaceHeritage ([#2753](https://github.com/typescript-eslint/typescript-eslint/issues/2753)) ([535db3b](https://github.com/typescript-eslint/typescript-eslint/commit/535db3bf27ee1d7824ada9acd91d1b7833064628)) ### Features -* **eslint-plugin:** [no-floating-promise] add option to ignore IIFEs ([#1799](https://github.com/typescript-eslint/typescript-eslint/issues/1799)) ([cea51bf](https://github.com/typescript-eslint/typescript-eslint/commit/cea51bf130d6d3c2935f5e2dcc468196f2ad9d00)) -* **eslint-plugin:** [restrict-template-expressions] add support for intersection types ([#1803](https://github.com/typescript-eslint/typescript-eslint/issues/1803)) ([cc70e4f](https://github.com/typescript-eslint/typescript-eslint/commit/cc70e4fbadd0b15fd6af913a2e1e2ddd346fa558)) -* **eslint-plugin:** add extension rule `init-declarations` ([#1814](https://github.com/typescript-eslint/typescript-eslint/issues/1814)) ([b01f5e7](https://github.com/typescript-eslint/typescript-eslint/commit/b01f5e778ac28e0797a3734fc58d025bb224f418)) -* **eslint-plugin:** add extension rule `keyword-spacing` ([#1739](https://github.com/typescript-eslint/typescript-eslint/issues/1739)) ([c5106dd](https://github.com/typescript-eslint/typescript-eslint/commit/c5106dd4bf2bc8846cc39aa8bb50c33bec026d4d)) +- **typescript-estree:** add `parseWithNodeMaps` API ([#2760](https://github.com/typescript-eslint/typescript-eslint/issues/2760)) ([9441d50](https://github.com/typescript-eslint/typescript-eslint/commit/9441d5030211f1c32f5ae8e61d5565cab8bb6823)), closes [#1852](https://github.com/typescript-eslint/typescript-eslint/issues/1852) +# [4.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.6.1...v4.7.0) (2020-11-09) +### Bug Fixes +- **eslint-plugin:** [array-type] parenthesize ReadonlyArray fix ([#2747](https://github.com/typescript-eslint/typescript-eslint/issues/2747)) ([83385ac](https://github.com/typescript-eslint/typescript-eslint/commit/83385ac351f45d3bcbd19f72711838e9a8473827)) +- **eslint-plugin:** [no-extra-non-null-assertion] false positive with non-nullable computed key ([#2737](https://github.com/typescript-eslint/typescript-eslint/issues/2737)) ([e82698c](https://github.com/typescript-eslint/typescript-eslint/commit/e82698c0ec796e460e40c3dd90a30bd100db05c2)) +### Features -# [2.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.27.0...v2.28.0) (2020-04-13) +- **eslint-plugin:** add rule `no-confusing-void-expression` ([#2605](https://github.com/typescript-eslint/typescript-eslint/issues/2605)) ([c8a4dad](https://github.com/typescript-eslint/typescript-eslint/commit/c8a4dadeab8a64fb4768deda8f65475435dd2cad)) +- support TS4.1 features ([#2748](https://github.com/typescript-eslint/typescript-eslint/issues/2748)) ([2be354b](https://github.com/typescript-eslint/typescript-eslint/commit/2be354bb15f9013a2da1b13a0c0836e9ef057e16)), closes [#2583](https://github.com/typescript-eslint/typescript-eslint/issues/2583) +## [4.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.6.0...v4.6.1) (2020-11-02) ### Bug Fixes -* **eslint-plugin:** [method-signature-style] handle multiline params ([#1861](https://github.com/typescript-eslint/typescript-eslint/issues/1861)) ([5832a86](https://github.com/typescript-eslint/typescript-eslint/commit/5832a8643bbe174ec02df5966bb333e506e45f5d)) -* **eslint-plugin:** [no-empty-interface] use suggestion fixer for ambient contexts ([#1880](https://github.com/typescript-eslint/typescript-eslint/issues/1880)) ([62b2278](https://github.com/typescript-eslint/typescript-eslint/commit/62b2278aec0011c93eae17bed8b278114d3379a2)) -* **eslint-plugin:** [unbound-method] false positive on property function initializer ([#1890](https://github.com/typescript-eslint/typescript-eslint/issues/1890)) ([f1c3b18](https://github.com/typescript-eslint/typescript-eslint/commit/f1c3b18f7aadc81f7dca7aa32aa1a8fe424e04e7)) -* **eslint-plugin:** [unbound-method] ignore assignments _to_ methods ([#1736](https://github.com/typescript-eslint/typescript-eslint/issues/1736)) ([6b4680b](https://github.com/typescript-eslint/typescript-eslint/commit/6b4680b6e7343d9d98fa1de170f387a36d98b73e)) -* **eslint-plugin:** no-empty-interface autofix ([#1865](https://github.com/typescript-eslint/typescript-eslint/issues/1865)) ([829a2f7](https://github.com/typescript-eslint/typescript-eslint/commit/829a2f728f876d356908e2338c2d6620e58f9943)), closes [#1864](https://github.com/typescript-eslint/typescript-eslint/issues/1864) -* **eslint-plugin:** use `isTypeArrayTypeOrUnionOfArrayTypes` util for checking if type is array ([#1728](https://github.com/typescript-eslint/typescript-eslint/issues/1728)) ([05030f8](https://github.com/typescript-eslint/typescript-eslint/commit/05030f8d2bd5a50e95053bc61380891da71cc567)) +- **eslint-plugin:** [consistent-indexed-object-style] fix wrong autofix behaviour with generics ([#2722](https://github.com/typescript-eslint/typescript-eslint/issues/2722)) ([73d9713](https://github.com/typescript-eslint/typescript-eslint/commit/73d97130afe79b8a458c215581ce86c62009ad8b)) +- **eslint-plugin:** [no-shadow] ignore global module augmentation ([#2729](https://github.com/typescript-eslint/typescript-eslint/issues/2729)) ([d8c67a5](https://github.com/typescript-eslint/typescript-eslint/commit/d8c67a564a4cada5add8587f655aee2305cbc562)) +# [4.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.5.0...v4.6.0) (2020-10-26) + +### Bug Fixes + +- **eslint-plugin:** [method-signature-style] correct fixer for overloads in an object literal type ([#2708](https://github.com/typescript-eslint/typescript-eslint/issues/2708)) ([0763913](https://github.com/typescript-eslint/typescript-eslint/commit/0763913c4a0d1061465ae3329704f1a7de4b9326)) +- **eslint-plugin:** [method-signature-style] don't auto-fix interfaces within namespaces ([#2678](https://github.com/typescript-eslint/typescript-eslint/issues/2678)) ([e012049](https://github.com/typescript-eslint/typescript-eslint/commit/e01204931e460f5e6731abc443c88d666ca0b07a)) +- **eslint-plugin:** [prefer-string-starts-ends-with] Check negative indices in the second position for slice ([#2696](https://github.com/typescript-eslint/typescript-eslint/issues/2696)) ([66e9c6e](https://github.com/typescript-eslint/typescript-eslint/commit/66e9c6e29f9f56bbd178ba6405f47053be591258)) ### Features -* **eslint-plugin:** [ban-ts-comment] support `ts-expect-error` ([#1706](https://github.com/typescript-eslint/typescript-eslint/issues/1706)) ([469cff3](https://github.com/typescript-eslint/typescript-eslint/commit/469cff332c041f38f60de052769287342455cff1)) -* **eslint-plugin:** [consistent-type-assertions] always allow `const` assertions ([#1713](https://github.com/typescript-eslint/typescript-eslint/issues/1713)) ([af2c00d](https://github.com/typescript-eslint/typescript-eslint/commit/af2c00de62f7e31eaeb88996ebf3f330cc8473b9)) -* **eslint-plugin:** [explicit-function-return-type] add option to allow concise arrows that start with void ([#1732](https://github.com/typescript-eslint/typescript-eslint/issues/1732)) ([2e9c202](https://github.com/typescript-eslint/typescript-eslint/commit/2e9c2028a8a0b226e0f87d4bcc997fa259ca3ebd)) -* **eslint-plugin:** [explicit-module-boundary-types] add optio… ([#1778](https://github.com/typescript-eslint/typescript-eslint/issues/1778)) ([3eee804](https://github.com/typescript-eslint/typescript-eslint/commit/3eee804461d017ea6189cd7f64fcd473623684b4)) -* **eslint-plugin:** [no-base-to-string] add option to ignore tagged templates ([#1763](https://github.com/typescript-eslint/typescript-eslint/issues/1763)) ([f5edb99](https://github.com/typescript-eslint/typescript-eslint/commit/f5edb9938c33f8b68f026eba00db3abe9359ced3)) -* **eslint-plugin:** [restrict-template-expressions] add option `allowAny` ([#1762](https://github.com/typescript-eslint/typescript-eslint/issues/1762)) ([d44c0f9](https://github.com/typescript-eslint/typescript-eslint/commit/d44c0f9bed2404ca00b020b35fd825929e213398)) -* **eslint-plugin:** add rule `prefer-reduce-type-parameter` ([#1707](https://github.com/typescript-eslint/typescript-eslint/issues/1707)) ([c92d240](https://github.com/typescript-eslint/typescript-eslint/commit/c92d240e49113779053eac32038382b282812afc)) -* **eslint-plugin:** add rule `prefer-ts-expect-error` ([#1705](https://github.com/typescript-eslint/typescript-eslint/issues/1705)) ([7021f21](https://github.com/typescript-eslint/typescript-eslint/commit/7021f2151a25db2a8edf17e06cd6f21e90761ec8)) -* **eslint-plugin:** add rule no-unsafe-assignment ([#1694](https://github.com/typescript-eslint/typescript-eslint/issues/1694)) ([a49b860](https://github.com/typescript-eslint/typescript-eslint/commit/a49b860cbbb2c7d718b99f561e2fb6eaadf16f17)) +- **eslint-plugin:** [ban-types] support banning `[]` ([#2704](https://github.com/typescript-eslint/typescript-eslint/issues/2704)) ([ef8b5a7](https://github.com/typescript-eslint/typescript-eslint/commit/ef8b5a7e09cca4bdacf205da28f99f2b1a419d00)), closes [#2582](https://github.com/typescript-eslint/typescript-eslint/issues/2582) +- **eslint-plugin:** add `no-unnecessary-type-constraint` rule ([#2516](https://github.com/typescript-eslint/typescript-eslint/issues/2516)) ([880ac75](https://github.com/typescript-eslint/typescript-eslint/commit/880ac753b90d63034f0a33f8f512d9fabc17c8f9)) +- **eslint-plugin:** add extension rule `space-infix-ops` ([#2593](https://github.com/typescript-eslint/typescript-eslint/issues/2593)) ([343d20d](https://github.com/typescript-eslint/typescript-eslint/commit/343d20db23a1640e3bca8cf52b7db1fa46e092e6)) +# [4.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.4.1...v4.5.0) (2020-10-19) +### Bug Fixes +- **eslint-plugin:** [array-type] fix issues with readonly option ([#2667](https://github.com/typescript-eslint/typescript-eslint/issues/2667)) ([63d1d81](https://github.com/typescript-eslint/typescript-eslint/commit/63d1d8189c829c6543c7966a864b62c07fbd61a0)) +- **eslint-plugin:** [lines-between-class-members] fix typo in schema ([#2681](https://github.com/typescript-eslint/typescript-eslint/issues/2681)) ([a2a2514](https://github.com/typescript-eslint/typescript-eslint/commit/a2a2514f8a8eee478c8697c4ce42d3c586599b14)) +- **eslint-plugin:** [naming-convention] check bodyless function parameters ([#2675](https://github.com/typescript-eslint/typescript-eslint/issues/2675)) ([c505863](https://github.com/typescript-eslint/typescript-eslint/commit/c505863ac41755383e08893ba0bc4c0fd937eb1d)) +- **eslint-plugin:** [no-invalid-this] allow "this" in class property definitions ([#2685](https://github.com/typescript-eslint/typescript-eslint/issues/2685)) ([dccb6ee](https://github.com/typescript-eslint/typescript-eslint/commit/dccb6ee9f1cd9519c26808d10a5bed8291d0a8e4)) +- **eslint-plugin:** [no-misused-promises] False negative in LogicalExpression ([#2682](https://github.com/typescript-eslint/typescript-eslint/issues/2682)) ([30a6951](https://github.com/typescript-eslint/typescript-eslint/commit/30a695103e99d214fd40847aaa51c1631981c226)), closes [#2544](https://github.com/typescript-eslint/typescript-eslint/issues/2544) +- **eslint-plugin:** [no-unnecessary-type-assertion] correct fixer for vue files ([#2680](https://github.com/typescript-eslint/typescript-eslint/issues/2680)) ([55111af](https://github.com/typescript-eslint/typescript-eslint/commit/55111afd7819d29d65da4f41cc6a129f34aaeb3e)) +- **eslint-plugin:** [return-await] do not auto-fix when type is `any`/`unknown` ([#2671](https://github.com/typescript-eslint/typescript-eslint/issues/2671)) ([d690c8d](https://github.com/typescript-eslint/typescript-eslint/commit/d690c8dff3636d8c8a9a38bd422e0bedbd1d72cb)) +- **parser:** minor fix regexp, map-filter to reduce ([#2684](https://github.com/typescript-eslint/typescript-eslint/issues/2684)) ([f1329f6](https://github.com/typescript-eslint/typescript-eslint/commit/f1329f6c4e3d1de21b1dc59c30ce16503c346eee)) +### Features -# [2.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.26.0...v2.27.0) (2020-04-06) +- **eslint-plugin:** [dot-notation] add `allowProtectedClassPropertyAccess` option ([#2622](https://github.com/typescript-eslint/typescript-eslint/issues/2622)) ([bbc9e35](https://github.com/typescript-eslint/typescript-eslint/commit/bbc9e3540576891552dc2dc54b2acbc54104be9d)) +- **eslint-plugin:** [prefer-readonly-parameter-types] add `ignoreInferredTypes` option ([#2668](https://github.com/typescript-eslint/typescript-eslint/issues/2668)) ([91010e8](https://github.com/typescript-eslint/typescript-eslint/commit/91010e88258bf47a0438e842c8ddca19e0414b48)) +- **eslint-plugin:** [restrict-plus-operands] add intersection type determination logic ([#2628](https://github.com/typescript-eslint/typescript-eslint/issues/2628)) ([da71362](https://github.com/typescript-eslint/typescript-eslint/commit/da713627c88354229f245866ccf1018fb56b6e53)) +- **typescript-estree:** add flag EXPERIMENTAL_useSourceOfProjectReferenceRedirect ([#2669](https://github.com/typescript-eslint/typescript-eslint/issues/2669)) ([90a5878](https://github.com/typescript-eslint/typescript-eslint/commit/90a587845088da1b205e4d7d77dbc3f9447b1c5a)) +## [4.4.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.4.0...v4.4.1) (2020-10-12) ### Bug Fixes -* **eslint-plugin:** [no-throw-literal] fix crash caused by getBaseTypes ([#1830](https://github.com/typescript-eslint/typescript-eslint/issues/1830)) ([9d53c76](https://github.com/typescript-eslint/typescript-eslint/commit/9d53c761983dd964109b9f13eb9bfe20caf9defb)) -* **eslint-plugin:** [no-unsafe-call] fix incorrect selector ([#1826](https://github.com/typescript-eslint/typescript-eslint/issues/1826)) ([8ec53a3](https://github.com/typescript-eslint/typescript-eslint/commit/8ec53a3579fcb59cdffea0c60fbb755d056f4c8a)) -* **eslint-plugin:** [require-await] handle async generators ([#1782](https://github.com/typescript-eslint/typescript-eslint/issues/1782)) ([9642d9d](https://github.com/typescript-eslint/typescript-eslint/commit/9642d9dce693befac89a4e9d8bf8dd18f4361e2a)) -* **eslint-plugin:** no-explicit-any constructor functions (& mo… ([#1711](https://github.com/typescript-eslint/typescript-eslint/issues/1711)) ([ab8572e](https://github.com/typescript-eslint/typescript-eslint/commit/ab8572e30e14ebda91c8437be5ee35e7dc9add2e)) -* **typescript-estree:** add support for TS3.9 extra file extensions ([#1833](https://github.com/typescript-eslint/typescript-eslint/issues/1833)) ([1f0ff41](https://github.com/typescript-eslint/typescript-eslint/commit/1f0ff41aa1bc3b7c5330b2f5fe22e24bf578a6b2)) +- **eslint-plugin:** [ban-ts-comment] support block comments ([#2644](https://github.com/typescript-eslint/typescript-eslint/issues/2644)) ([9c3c686](https://github.com/typescript-eslint/typescript-eslint/commit/9c3c686b59b4b8fd02c479a534b5ca9b33c5ff40)) +- **eslint-plugin:** [ban-types] allow banning types with specific parameters ([#2662](https://github.com/typescript-eslint/typescript-eslint/issues/2662)) ([77732a2](https://github.com/typescript-eslint/typescript-eslint/commit/77732a2f3979f638e471b6de327b2ea0e976d568)) +- **eslint-plugin:** [consistent-type-assertions] check type assertion in jsx props ([#2653](https://github.com/typescript-eslint/typescript-eslint/issues/2653)) ([393e925](https://github.com/typescript-eslint/typescript-eslint/commit/393e92573fbde849369af1d10b9f25299ec92eaf)) +- **eslint-plugin:** [no-duplicate-imports] distinguish member, default ([#2637](https://github.com/typescript-eslint/typescript-eslint/issues/2637)) ([c71f423](https://github.com/typescript-eslint/typescript-eslint/commit/c71f423b89bf034caf2a4f1bb3ed0389b72f3aa9)) +- **eslint-plugin:** [no-throw-literal] false positive with logical expressions ([#2645](https://github.com/typescript-eslint/typescript-eslint/issues/2645)) ([57aa6c7](https://github.com/typescript-eslint/typescript-eslint/commit/57aa6c7642320074ed2b6a15e7f38e66a2fb13d1)) +- **eslint-plugin:** [no-unused-vars] fix false positives for duplicated names in namespaces ([#2659](https://github.com/typescript-eslint/typescript-eslint/issues/2659)) ([0d696c7](https://github.com/typescript-eslint/typescript-eslint/commit/0d696c72c5c9c3446902a63509d499ee95483e81)) +- **eslint-plugin:** [no-use-before-define] correctly handle typeof type references ([#2623](https://github.com/typescript-eslint/typescript-eslint/issues/2623)) ([8e44c78](https://github.com/typescript-eslint/typescript-eslint/commit/8e44c78a20410457851e5b7fe9a24777876c0aaf)) +- **scope-manager:** don't create a variable for global augmentation ([#2639](https://github.com/typescript-eslint/typescript-eslint/issues/2639)) ([6bc9325](https://github.com/typescript-eslint/typescript-eslint/commit/6bc93257ec876214743a165093b6666d713379f6)) +# [4.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.3.0...v4.4.0) (2020-10-05) ### Features -* **eslint-plugin:** new rule method-signature-style ([#1685](https://github.com/typescript-eslint/typescript-eslint/issues/1685)) ([c49d771](https://github.com/typescript-eslint/typescript-eslint/commit/c49d771ba62f1a21d3c1aec106341daddfcd3c9a)) -* **eslint-plugin:** sort members alphabetically ([#263](https://github.com/typescript-eslint/typescript-eslint/issues/263)) ([485e902](https://github.com/typescript-eslint/typescript-eslint/commit/485e90213a0f8baac0587f7d56925448883fc5bd)) -* **eslint-plugin-internal:** add plugin-test-formatting rule ([#1821](https://github.com/typescript-eslint/typescript-eslint/issues/1821)) ([9b0023a](https://github.com/typescript-eslint/typescript-eslint/commit/9b0023a4996ecdd7dfcb30abd1678091a78f3064)) -* **experimental-utils:** add types for suggestions from CLIEngine ([#1844](https://github.com/typescript-eslint/typescript-eslint/issues/1844)) ([7c11bd6](https://github.com/typescript-eslint/typescript-eslint/commit/7c11bd66f2d0e5ea9d3943e6b8c66e6ddff50862)) -* **experimental-utils:** update eslint types to match v6.8 ([#1846](https://github.com/typescript-eslint/typescript-eslint/issues/1846)) ([16ce74d](https://github.com/typescript-eslint/typescript-eslint/commit/16ce74d247781ac890dc0baa30c384f97e581b6b)) +- **eslint-plugin:** add `consistent-indexed-object-style` rule ([#2401](https://github.com/typescript-eslint/typescript-eslint/issues/2401)) ([d7dc108](https://github.com/typescript-eslint/typescript-eslint/commit/d7dc108580cdcb9890ac0539e7223aedbff4a0ed)) +- **eslint-plugin:** add extension rule `no-duplicate-imports` ([#2609](https://github.com/typescript-eslint/typescript-eslint/issues/2609)) ([498f397](https://github.com/typescript-eslint/typescript-eslint/commit/498f397ff3898dde631f37311615b555f38a414e)) +# [4.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.2.0...v4.3.0) (2020-09-28) +### Bug Fixes +- **eslint-plugin:** added safe getTypeOfPropertyOfType wrapper ([#2567](https://github.com/typescript-eslint/typescript-eslint/issues/2567)) ([7cba2de](https://github.com/typescript-eslint/typescript-eslint/commit/7cba2de138542563d678fbfc738cd1b3ebf01e07)) +- **experimental-utils:** treat RuleTester arrays as readonly ([#2601](https://github.com/typescript-eslint/typescript-eslint/issues/2601)) ([8025777](https://github.com/typescript-eslint/typescript-eslint/commit/80257776b78bd2b2b4389d6bd530b009a75fb520)) +### Features -# [2.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.25.0...v2.26.0) (2020-03-30) +- **eslint-plugin:** [no-invalid-void-type] add option to allow `this: void` ([#2481](https://github.com/typescript-eslint/typescript-eslint/issues/2481)) ([ddf5660](https://github.com/typescript-eslint/typescript-eslint/commit/ddf5660846784003cab4b10ae7a5e510b9dd562b)) +# [4.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.1...v4.2.0) (2020-09-21) ### Bug Fixes -* **eslint-plugin:** [no-explicit-any] error with ignoreRestArgs ([#1796](https://github.com/typescript-eslint/typescript-eslint/issues/1796)) ([638d84d](https://github.com/typescript-eslint/typescript-eslint/commit/638d84ddd77d07117b3ec7c5431f3b0e44b1995d)) -* **eslint-plugin:** [no-unsafe-call] allow import expressions ([#1800](https://github.com/typescript-eslint/typescript-eslint/issues/1800)) ([4fa7107](https://github.com/typescript-eslint/typescript-eslint/commit/4fa710754ecc412b65ac3864fe0c7857c254ac1b)) -* **eslint-plugin:** [no-unsafe-return] error with unknown ([#2371](https://github.com/typescript-eslint/typescript-eslint/issues/2371)) ([e7528e6](https://github.com/typescript-eslint/typescript-eslint/commit/e7528e686f5fe5cce8504fc15d3cd06b8733712e)) +- **typescript-estree:** support TSv4 labelled tuple members ([#2378](https://github.com/typescript-eslint/typescript-eslint/issues/2378)) ([00d84ff](https://github.com/typescript-eslint/typescript-eslint/commit/00d84ffbcbe9d0ec98bdb2f2ce59959a27ce4dbe)) +# [3.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.7.1...v3.8.0) (2020-08-03) +### Bug Fixes +- **eslint-plugin:** [no-implied-eval] don't report when `Function` is imported ([#2348](https://github.com/typescript-eslint/typescript-eslint/issues/2348)) ([fa169e7](https://github.com/typescript-eslint/typescript-eslint/commit/fa169e79661821f0e0e64a56d6db9da42c3c8654)) +- **eslint-plugin:** [no-unsafe-assignment] fix typo in message ([#2347](https://github.com/typescript-eslint/typescript-eslint/issues/2347)) ([2027bb1](https://github.com/typescript-eslint/typescript-eslint/commit/2027bb11689b76c297f93ba8a918b35fe68e5b9d)) +### Features -# [2.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.20.0...v2.21.0) (2020-02-24) +- **eslint-plugin:** [naming-convention] allow specifying an array of selectors ([#2335](https://github.com/typescript-eslint/typescript-eslint/issues/2335)) ([3ef6bd5](https://github.com/typescript-eslint/typescript-eslint/commit/3ef6bd5cadc225e42ef1330d15919a39f53f2a2b)) +- **eslint-plugin:** add `prefer-enum-initializers` rule ([#2326](https://github.com/typescript-eslint/typescript-eslint/issues/2326)) ([4f38ea3](https://github.com/typescript-eslint/typescript-eslint/commit/4f38ea39c97289db11501d6368d01db8c5787257)) +## [3.7.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.7.0...v3.7.1) (2020-07-27) ### Bug Fixes -* **eslint-plugin:** [embt] ignore JSX callbacks ([#1630](https://github.com/typescript-eslint/typescript-eslint/issues/1630)) ([4d45b33](https://github.com/typescript-eslint/typescript-eslint/commit/4d45b331b920113c97a90df7dc703f8dfbcc04f3)) -* **eslint-plugin:** [no-floating-promises] handle finally callback ([#1620](https://github.com/typescript-eslint/typescript-eslint/issues/1620)) ([1aa7135](https://github.com/typescript-eslint/typescript-eslint/commit/1aa7135bbfbf55cec52925fc0224188cd3c319e7)) -* **eslint-plugin:** [typedef] allow array/object destructuring in for/of ([#1570](https://github.com/typescript-eslint/typescript-eslint/issues/1570)) ([660bace](https://github.com/typescript-eslint/typescript-eslint/commit/660bace4c3da569d71cf1e296ac4f6ed35bdfc44)) -* **typescript-estree:** process.stdout can be undefined ([#1619](https://github.com/typescript-eslint/typescript-eslint/issues/1619)) ([0d8e87e](https://github.com/typescript-eslint/typescript-eslint/commit/0d8e87e09704588273bc94a740279b3e8af7474f)) +- **eslint-plugin:** [adjacent-overload-signatures] fix false positive on call signatures and a method named `call` ([#2313](https://github.com/typescript-eslint/typescript-eslint/issues/2313)) ([30fafb0](https://github.com/typescript-eslint/typescript-eslint/commit/30fafb09422b3aca881f4785d89b0536092d4952)) +- **eslint-plugin:** [no-extra-parens] stop reporting on calling generic functions with one argument and type parameters containing parentheses ([#2319](https://github.com/typescript-eslint/typescript-eslint/issues/2319)) ([616a841](https://github.com/typescript-eslint/typescript-eslint/commit/616a841032bec310d9f31f1c987888273df27008)) +- **typescript-estree:** correct AST regression introduced by TS4.0 upgrade ([#2316](https://github.com/typescript-eslint/typescript-eslint/issues/2316)) ([d7fefba](https://github.com/typescript-eslint/typescript-eslint/commit/d7fefba3741a526ff2b58dd713995c3ee5603962)) +# [3.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.6.1...v3.7.0) (2020-07-20) ### Features -* **eslint-plugin:** [require-await] add --fix support ([#1561](https://github.com/typescript-eslint/typescript-eslint/issues/1561)) ([9edd863](https://github.com/typescript-eslint/typescript-eslint/commit/9edd863b2a66ee44bd4a439903973e6c207480aa)) +- **eslint-plugin:** [naming-convention] allow selecting only `const` variables ([#2291](https://github.com/typescript-eslint/typescript-eslint/issues/2291)) ([156d058](https://github.com/typescript-eslint/typescript-eslint/commit/156d058fee835fdf1ed827a5ad4a80d57190cc54)) +- **eslint-plugin:** [no-empty-function] add `decoratedFunctions` option ([#2295](https://github.com/typescript-eslint/typescript-eslint/issues/2295)) ([88f08f4](https://github.com/typescript-eslint/typescript-eslint/commit/88f08f410760f58fdc2de58ecd9dab9610821642)) +- **typescript-estree:** support short-circuiting assignment operators ([#2307](https://github.com/typescript-eslint/typescript-eslint/issues/2307)) ([2c90d9f](https://github.com/typescript-eslint/typescript-eslint/commit/2c90d9fa3aa5ebd7db697dddb7762bca2dd0e06b)) +- **typescript-estree:** support type annotations on catch clauses ([#2306](https://github.com/typescript-eslint/typescript-eslint/issues/2306)) ([b5afe9c](https://github.com/typescript-eslint/typescript-eslint/commit/b5afe9c560b9f38c8dffc312a600db30944129c8)) +## [3.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.6.0...v3.6.1) (2020-07-13) +### Bug Fixes +- **eslint-plugin:** [no-unnecessary-condition] handle computed member access ([#2288](https://github.com/typescript-eslint/typescript-eslint/issues/2288)) ([3a187ca](https://github.com/typescript-eslint/typescript-eslint/commit/3a187cafb7302a3c05de0e6a236dd142a5e2d741)) +- **eslint-plugin:** [prefer-literal-enum-member] allow negative numbers ([#2277](https://github.com/typescript-eslint/typescript-eslint/issues/2277)) ([00ac9c3](https://github.com/typescript-eslint/typescript-eslint/commit/00ac9c3ccaad27bab08ec3c3a104f612bb593df5)) +- **eslint-plugin:** [space-before-function-paren] incorrect handling of abstract methods ([#2275](https://github.com/typescript-eslint/typescript-eslint/issues/2275)) ([ced6591](https://github.com/typescript-eslint/typescript-eslint/commit/ced65918b16f46c383496a9b4bd43eca8a76baf6)), closes [#2274](https://github.com/typescript-eslint/typescript-eslint/issues/2274) +- **eslint-plugin:** [switch-exhaustiveness-check] handle special characters in enum keys ([#2207](https://github.com/typescript-eslint/typescript-eslint/issues/2207)) ([98ab010](https://github.com/typescript-eslint/typescript-eslint/commit/98ab010fb7fca884984bb4200fd806ecee8071b6)) +# [3.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.5.0...v3.6.0) (2020-07-06) -# [2.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.19.2...v2.20.0) (2020-02-17) +### Bug Fixes +- **eslint-plugin:** [no-namespace] allow namespaces in nested declarations with `allowDeclarations` ([#2238](https://github.com/typescript-eslint/typescript-eslint/issues/2238)) ([c1df669](https://github.com/typescript-eslint/typescript-eslint/commit/c1df6694f7866d3ef7ede0b1c6c9dd6f3955e682)) +- **eslint-plugin:** [space-before-function-paren] handle abstract functions ([#2199](https://github.com/typescript-eslint/typescript-eslint/issues/2199)) ([88a3edf](https://github.com/typescript-eslint/typescript-eslint/commit/88a3edfce8349f871b7b660d2b76508b67c94eda)) ### Features -* **eslint-plugin:** [ban-types] allow banning null and undefined ([#821](https://github.com/typescript-eslint/typescript-eslint/issues/821)) ([0b2b887](https://github.com/typescript-eslint/typescript-eslint/commit/0b2b887c06f2582d812a45f7a8deb82f52d82a84)) -* **eslint-plugin:** [strict-boolean-expressions] refactor, add clearer error messages ([#1480](https://github.com/typescript-eslint/typescript-eslint/issues/1480)) ([db4b530](https://github.com/typescript-eslint/typescript-eslint/commit/db4b530f3f049267d679e89d9e75acfcb86faaf2)) - +- **eslint-plugin:** add rule `prefer-literal-enum-member` ([#1898](https://github.com/typescript-eslint/typescript-eslint/issues/1898)) ([fe2b2ec](https://github.com/typescript-eslint/typescript-eslint/commit/fe2b2ec39ef04ac8b73eef9d29d12fd1b24fa183)) +# [3.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.4.0...v3.5.0) (2020-06-29) +### Bug Fixes +- **eslint-plugin:** [naming-convention] support unicode in regex ([#2241](https://github.com/typescript-eslint/typescript-eslint/issues/2241)) ([5fdd21a](https://github.com/typescript-eslint/typescript-eslint/commit/5fdd21a1726fb6928098c4152aec55a30df960d4)) +- **typescript-estree:** forward compatibility for new compound assignment operators ([#2253](https://github.com/typescript-eslint/typescript-eslint/issues/2253)) ([ba41680](https://github.com/typescript-eslint/typescript-eslint/commit/ba41680f2a25b1aa4d05c2d4b132ac73a6faefbd)) -## [2.19.2](https://github.com/typescript-eslint/typescript-eslint/compare/v2.19.1...v2.19.2) (2020-02-10) +### Features -**Note:** Version bump only for package @typescript-eslint/typescript-eslint +- add package scope-manager ([#1939](https://github.com/typescript-eslint/typescript-eslint/issues/1939)) ([682eb7e](https://github.com/typescript-eslint/typescript-eslint/commit/682eb7e009c3f22a542882dfd3602196a60d2a1e)) +- split types into their own package ([#2229](https://github.com/typescript-eslint/typescript-eslint/issues/2229)) ([5f45918](https://github.com/typescript-eslint/typescript-eslint/commit/5f4591886f3438329fbf2229b03ac66174334a24)) +- split visitor keys into their own package ([#2230](https://github.com/typescript-eslint/typescript-eslint/issues/2230)) ([689dae3](https://github.com/typescript-eslint/typescript-eslint/commit/689dae37392d527c64ae83db2a4c3e6b7fecece7)) +# [3.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.3.0...v3.4.0) (2020-06-22) +### Bug Fixes +- **eslint-plugin:** [no-base-to-string] handle intersection types ([#2170](https://github.com/typescript-eslint/typescript-eslint/issues/2170)) ([9cca3a9](https://github.com/typescript-eslint/typescript-eslint/commit/9cca3a9584d5d5ef0536219c5a734f4e87efb543)) +- **eslint-plugin:** [unbound-method] handling destructuring ([#2228](https://github.com/typescript-eslint/typescript-eslint/issues/2228)) ([c3753c2](https://github.com/typescript-eslint/typescript-eslint/commit/c3753c21768d355ecdb9e7ae8e0bfdfbbc1d3bbe)) +- **experimental-utils:** correct types for TS versions older than 3.8 ([#2217](https://github.com/typescript-eslint/typescript-eslint/issues/2217)) ([5e4dda2](https://github.com/typescript-eslint/typescript-eslint/commit/5e4dda264a7d6a6a1626848e7599faea1ac34922)) +- **experimental-utils:** getParserServices takes a readonly context ([#2235](https://github.com/typescript-eslint/typescript-eslint/issues/2235)) ([26da8de](https://github.com/typescript-eslint/typescript-eslint/commit/26da8de7fcde9eddec63212d79af781c4bb22991)) +### Features -## [2.19.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.19.0...v2.19.1) (2020-02-10) +- **eslint-plugin:** [no-unnecessary-boolean-literal-compare] add option to check nullable booleans ([#1983](https://github.com/typescript-eslint/typescript-eslint/issues/1983)) ([c0b3057](https://github.com/typescript-eslint/typescript-eslint/commit/c0b3057b7f7d515891ad2efe32e4ef8c01e0478f)) +- **eslint-plugin:** add extension rule `no-loss-of-precision` ([#2196](https://github.com/typescript-eslint/typescript-eslint/issues/2196)) ([535b0f2](https://github.com/typescript-eslint/typescript-eslint/commit/535b0f2ddd82efa6a2c40307a61c480f4b3cdea3)) +# [3.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.2.0...v3.3.0) (2020-06-15) ### Bug Fixes -* **eslint-plugin:** [unbound-method] blacklist a few unbound natives ([#1562](https://github.com/typescript-eslint/typescript-eslint/issues/1562)) ([4670aab](https://github.com/typescript-eslint/typescript-eslint/commit/4670aabef31d9017ad302f206b9c2f18d53c8ee4)) -* **typescript-estree:** ts returning wrong file with project references ([#1575](https://github.com/typescript-eslint/typescript-eslint/issues/1575)) ([4c12dac](https://github.com/typescript-eslint/typescript-eslint/commit/4c12dac075f774801a145cd29c4c7eff64f98fdc)) - - - +- **eslint-plugin:** [no-unused-expressions] handle ternary and short-circuit options ([#2194](https://github.com/typescript-eslint/typescript-eslint/issues/2194)) ([ee9f100](https://github.com/typescript-eslint/typescript-eslint/commit/ee9f100a2f9a874c2b361482742686eeaa9bdac7)) +- **typescript-estree:** handle TS4.0 breaking change in TupleType ([#2197](https://github.com/typescript-eslint/typescript-eslint/issues/2197)) ([5d68129](https://github.com/typescript-eslint/typescript-eslint/commit/5d6812914831a386997b453b4db1e3283e26005d)) +### Features -# [2.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.18.0...v2.19.0) (2020-02-03) +- **eslint-plugin:** [naming-convention] better error message and docs for prefix/suffix ([#2195](https://github.com/typescript-eslint/typescript-eslint/issues/2195)) ([a2ffe55](https://github.com/typescript-eslint/typescript-eslint/commit/a2ffe5568df0f7224bfe9141d298e538383d5f09)) +# [3.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.1.0...v3.2.0) (2020-06-08) ### Bug Fixes -* **eslint-plugin:** [embt] fix allowTypedFunctionExpressions ([#1553](https://github.com/typescript-eslint/typescript-eslint/issues/1553)) ([9e7d161](https://github.com/typescript-eslint/typescript-eslint/commit/9e7d1616d78a0f94521f4e6d4b48344e5df2d9f7)) -* **eslint-plugin:** [require-await] improve performance ([#1536](https://github.com/typescript-eslint/typescript-eslint/issues/1536)) ([45ae0b9](https://github.com/typescript-eslint/typescript-eslint/commit/45ae0b9565ee6e9d01e82107d85ad7151a15af7b)) -* **typescript-estree:** fix regression introduced in [#1525](https://github.com/typescript-eslint/typescript-eslint/issues/1525) ([#1543](https://github.com/typescript-eslint/typescript-eslint/issues/1543)) ([bec4572](https://github.com/typescript-eslint/typescript-eslint/commit/bec45722dfed8aeb49189d151252b83d4a34239c)) -* **typescript-estree:** persisted parse and module none ([#1516](https://github.com/typescript-eslint/typescript-eslint/issues/1516)) ([7c70323](https://github.com/typescript-eslint/typescript-eslint/commit/7c7032322f55d9492e21d3bfa5da16da1f05cbce)) - +- **eslint-plugin:** [explicit-module-boundary-types] dont report return type errors on constructor overloads ([#2158](https://github.com/typescript-eslint/typescript-eslint/issues/2158)) ([53232d7](https://github.com/typescript-eslint/typescript-eslint/commit/53232d775ca0b808e2d75d9501f4411a868b2b48)) +- **eslint-plugin:** [explicit-module-boundary-types] handle bodyless arrow functions with explicit return types that return functions ([#2169](https://github.com/typescript-eslint/typescript-eslint/issues/2169)) ([58db655](https://github.com/typescript-eslint/typescript-eslint/commit/58db655133aaae006efe3e3ceee971cf88dc348f)) +- **eslint-plugin:** [explicit-module-boundary-types] handle nested functions and functions expressions in a typed variable declaration ([#2176](https://github.com/typescript-eslint/typescript-eslint/issues/2176)) ([6ff450d](https://github.com/typescript-eslint/typescript-eslint/commit/6ff450da3abec93223a33f6b52484c9ca99b7abe)) +- **eslint-plugin:** [no-extra-non-null-assertion] dont report for assertions not followed by the optional chain ([#2167](https://github.com/typescript-eslint/typescript-eslint/issues/2167)) ([e4c1834](https://github.com/typescript-eslint/typescript-eslint/commit/e4c1834c7c5934332dd1d58c09018453568c4889)) +- **eslint-plugin:** [no-unnecessary-conditionals] Handle comparison of generics and loose comparisons with undefined values ([#2152](https://github.com/typescript-eslint/typescript-eslint/issues/2152)) ([c86e2a2](https://github.com/typescript-eslint/typescript-eslint/commit/c86e2a235372149db9b1700d39c2145e0ce5221a)) +- **eslint-plugin:** [prefer-optional-chain] handling first member expression ([#2156](https://github.com/typescript-eslint/typescript-eslint/issues/2156)) ([de18660](https://github.com/typescript-eslint/typescript-eslint/commit/de18660a8cf8f7033798646d8c5b0938d1accb12)) +- **eslint-plugin:** [return-await] correct handling of ternaries ([#2168](https://github.com/typescript-eslint/typescript-eslint/issues/2168)) ([fe4c0bf](https://github.com/typescript-eslint/typescript-eslint/commit/fe4c0bf8c04f070d6642fbe86c5e5614bc88e8fd)) ### Features -* **eslint-plugin:** [no-extra-non-null-assert] add fixer ([#1468](https://github.com/typescript-eslint/typescript-eslint/issues/1468)) ([54201ab](https://github.com/typescript-eslint/typescript-eslint/commit/54201aba37b2865c0ba4981be79d1fd989806133)) -* **eslint-plugin:** [no-float-prom] fixer + msg for ignoreVoid ([#1473](https://github.com/typescript-eslint/typescript-eslint/issues/1473)) ([159b16e](https://github.com/typescript-eslint/typescript-eslint/commit/159b16ec3a66f05478080c397df5c3f6e29535e4)) -* **eslint-plugin:** [unbound-method] support bound builtins ([#1526](https://github.com/typescript-eslint/typescript-eslint/issues/1526)) ([0a110eb](https://github.com/typescript-eslint/typescript-eslint/commit/0a110eb680749c8c4a2a3dc1375c1a83056e4c14)) -* **eslint-plugin:** add extension [no-dupe-class-members] ([#1492](https://github.com/typescript-eslint/typescript-eslint/issues/1492)) ([b22424e](https://github.com/typescript-eslint/typescript-eslint/commit/b22424e7d4a16042a027557f44e9191e0722b38b)) -* **eslint-plugin:** add no-unnecessary-boolean-literal-compare ([#242](https://github.com/typescript-eslint/typescript-eslint/issues/242)) ([6bebb1d](https://github.com/typescript-eslint/typescript-eslint/commit/6bebb1dc47897ee0e1f075d7e5dd89d8b0590f31)) -* **eslint-plugin:** add switch-exhaustiveness-check rule ([#972](https://github.com/typescript-eslint/typescript-eslint/issues/972)) ([9e0f6dd](https://github.com/typescript-eslint/typescript-eslint/commit/9e0f6ddef7cd29f355f398c90f1986e51c4854f7)) -* **eslint-plugin:** support negative matches for `filter` ([#1517](https://github.com/typescript-eslint/typescript-eslint/issues/1517)) ([b24fbe8](https://github.com/typescript-eslint/typescript-eslint/commit/b24fbe8790b540998e4085174251fb4d61bf96b0)) +- **eslint-plugin:** [naming-convention] put identifiers in quotes in error messages ([#2182](https://github.com/typescript-eslint/typescript-eslint/issues/2182)) ([fc61932](https://github.com/typescript-eslint/typescript-eslint/commit/fc619326eedf7ef2efa51444ecdead81a36a204f)), closes [#2178](https://github.com/typescript-eslint/typescript-eslint/issues/2178) +- **eslint-plugin:** [require-array-sort-compare] add `ignoreStringArrays` option ([#1972](https://github.com/typescript-eslint/typescript-eslint/issues/1972)) ([6dee784](https://github.com/typescript-eslint/typescript-eslint/commit/6dee7840a3af1dfe4c38a128d1c4655bdac625df)) +- **eslint-plugin:** add rule `ban-tslint-comment` ([#2140](https://github.com/typescript-eslint/typescript-eslint/issues/2140)) ([43ee226](https://github.com/typescript-eslint/typescript-eslint/commit/43ee226ffbaaa3e7126081db9476c24b89ec16e9)) +- **eslint-plugin:** add rule `no-confusing-non-null-assertion` ([#1941](https://github.com/typescript-eslint/typescript-eslint/issues/1941)) ([9b51c44](https://github.com/typescript-eslint/typescript-eslint/commit/9b51c44f29d8b3e95a510985544e8ded8a14404d)) +# [3.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.0.2...v3.1.0) (2020-06-01) +### Bug Fixes +- **eslint-plugin:** [explicit-module-boundary-types] don't check returned functions if parent function has return type ([#2084](https://github.com/typescript-eslint/typescript-eslint/issues/2084)) ([d7d4eeb](https://github.com/typescript-eslint/typescript-eslint/commit/d7d4eeb03f2918d5d9e361fdb47c2d42e83bd593)) +- **eslint-plugin:** [no-unnecessary-condition] handle comparison of any, unknown and loose comparisons with nullish values ([#2123](https://github.com/typescript-eslint/typescript-eslint/issues/2123)) ([1ae1d01](https://github.com/typescript-eslint/typescript-eslint/commit/1ae1d01e5603ec7cef8051ed018c3c3c88b29867)) +- **eslint-plugin:** [no-unnecessary-condition] improve optional chain handling ([#2111](https://github.com/typescript-eslint/typescript-eslint/issues/2111)) ([9ee399b](https://github.com/typescript-eslint/typescript-eslint/commit/9ee399b5906e82f346ff89141207a6630786de54)) +- **eslint-plugin:** [no-unnecessary-condition] improve optional chain handling 2 - electric boogaloo ([#2138](https://github.com/typescript-eslint/typescript-eslint/issues/2138)) ([c87cfaf](https://github.com/typescript-eslint/typescript-eslint/commit/c87cfaf6746775bb8ad9eb45b0002f068a822dbe)) +- **eslint-plugin:** [no-unused-expressions] ignore import expressions ([#2130](https://github.com/typescript-eslint/typescript-eslint/issues/2130)) ([e383691](https://github.com/typescript-eslint/typescript-eslint/commit/e3836910efdafd9edf04daed149c9e839c08047e)) +- **eslint-plugin:** [no-var-requires] false negative for TSAsExpression and MemberExpression ([#2139](https://github.com/typescript-eslint/typescript-eslint/issues/2139)) ([df95338](https://github.com/typescript-eslint/typescript-eslint/commit/df953388913b22d45242e65ce231d92a8b8a0080)) +- **experimental-utils:** downlevel type declarations for versions older than 3.8 ([#2133](https://github.com/typescript-eslint/typescript-eslint/issues/2133)) ([7925823](https://github.com/typescript-eslint/typescript-eslint/commit/792582326a8065270b69a0ffcaad5a7b4b103ff3)) +### Features -# [2.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.17.0...v2.18.0) (2020-01-27) +- **eslint-plugin:** [ban-ts-comments] add "allow-with-description" option ([#2099](https://github.com/typescript-eslint/typescript-eslint/issues/2099)) ([8a0fd18](https://github.com/typescript-eslint/typescript-eslint/commit/8a0fd1899f544470a35afb3117f4c71aad7e4e42)) +- **eslint-plugin:** [ban-types] allow selective disable of default options with `false` value ([#2137](https://github.com/typescript-eslint/typescript-eslint/issues/2137)) ([1cb8ca4](https://github.com/typescript-eslint/typescript-eslint/commit/1cb8ca483d029935310e6904580df8501837084d)) +- **eslint-plugin:** [explicit-module-boundary-types] improve accuracy and coverage ([#2135](https://github.com/typescript-eslint/typescript-eslint/issues/2135)) ([caaa859](https://github.com/typescript-eslint/typescript-eslint/commit/caaa8599284d02ab3341e282cad35a52d0fb86c7)) +## [3.0.2](https://github.com/typescript-eslint/typescript-eslint/compare/v3.0.1...v3.0.2) (2020-05-27) ### Bug Fixes -* **eslint-plugin:** [explicit-module-boundary-types] false positive for returned fns ([#1490](https://github.com/typescript-eslint/typescript-eslint/issues/1490)) ([5562ad5](https://github.com/typescript-eslint/typescript-eslint/commit/5562ad5ed902102d7c09a7fd47ca4ea7e50d6654)) -* improve token types and add missing type guards ([#1497](https://github.com/typescript-eslint/typescript-eslint/issues/1497)) ([ce41d7d](https://github.com/typescript-eslint/typescript-eslint/commit/ce41d7de33bcb7ccf96c03ac1438304c5a49ff54)) -* **eslint-plugin:** [naming-convention] fix filter option ([#1482](https://github.com/typescript-eslint/typescript-eslint/issues/1482)) ([718cd88](https://github.com/typescript-eslint/typescript-eslint/commit/718cd889c155a75413c571ac006c33fbc271dcc5)) -* **eslint-plugin:** fix property access on undefined error ([#1507](https://github.com/typescript-eslint/typescript-eslint/issues/1507)) ([d89e8e8](https://github.com/typescript-eslint/typescript-eslint/commit/d89e8e8a1114989e2727351bee7aadb6579f312b)) -* **experimental-utils:** widen type of `settings` property ([#1527](https://github.com/typescript-eslint/typescript-eslint/issues/1527)) ([b515e47](https://github.com/typescript-eslint/typescript-eslint/commit/b515e47af2bc914c7ebcfa4be813409dcd86b1c3)) -* **typescript-estree:** error on unexpected jsdoc nodes ([#1525](https://github.com/typescript-eslint/typescript-eslint/issues/1525)) ([c8dfac3](https://github.com/typescript-eslint/typescript-eslint/commit/c8dfac3d2f066e50fa9d2b5a86beffdaafddb643)) -* **typescript-estree:** fix identifier tokens typed as `Keyword` ([#1487](https://github.com/typescript-eslint/typescript-eslint/issues/1487)) ([77a1caa](https://github.com/typescript-eslint/typescript-eslint/commit/77a1caa562638645b4717449800e410107d512c8)) - +- regression for eslint v6 ([#2105](https://github.com/typescript-eslint/typescript-eslint/issues/2105)) ([31fc503](https://github.com/typescript-eslint/typescript-eslint/commit/31fc5039ed919e1515fda673c186d5c83eb5beb3)) -### Features +## [3.0.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.0.0...v3.0.1) (2020-05-25) -* **eslint-plugin:** add comma-spacing ([#1495](https://github.com/typescript-eslint/typescript-eslint/issues/1495)) ([1fd86be](https://github.com/typescript-eslint/typescript-eslint/commit/1fd86befa6a940a0354c619dd2da08a5c5d69fb4)) -* **eslint-plugin:** add new rule prefer-as-const ([#1431](https://github.com/typescript-eslint/typescript-eslint/issues/1431)) ([420db96](https://github.com/typescript-eslint/typescript-eslint/commit/420db96921435e8bf7fb484ae74552a912a6adde)) -* **eslint-plugin:** create `ban-ts-comment` rule ([#1361](https://github.com/typescript-eslint/typescript-eslint/issues/1361)) ([2a83d13](https://github.com/typescript-eslint/typescript-eslint/commit/2a83d138a966cd5ce787d1eecf595b59b78232d4)) -* **eslint-plugin-internal:** add `prefer-ast-types-enum` ([#1508](https://github.com/typescript-eslint/typescript-eslint/issues/1508)) ([c3d0a3a](https://github.com/typescript-eslint/typescript-eslint/commit/c3d0a3a6bdff0cae226a279f0a0a9b00952ca925)) -* **experimental-utils:** make RuleMetaData.docs optional ([#1462](https://github.com/typescript-eslint/typescript-eslint/issues/1462)) ([cde97ac](https://github.com/typescript-eslint/typescript-eslint/commit/cde97aca24df5a0f28f37006ed130ebc217fb2ad)) -* **parser:** clean up scope-analysis types ([#1481](https://github.com/typescript-eslint/typescript-eslint/issues/1481)) ([4a727fa](https://github.com/typescript-eslint/typescript-eslint/commit/4a727fa083d749dba9eaf39322856f5f69c28cd8)) +### Bug Fixes +- **eslint-plugin:** [naming-convention] handle no options correctly ([#2095](https://github.com/typescript-eslint/typescript-eslint/issues/2095)) ([fd7d02b](https://github.com/typescript-eslint/typescript-eslint/commit/fd7d02b31ebd995b7fdd857d7c054042aa4f2001)) +- **eslint-plugin:** [no-throw-literal] handle intersection and union types ([#2085](https://github.com/typescript-eslint/typescript-eslint/issues/2085)) ([cae037f](https://github.com/typescript-eslint/typescript-eslint/commit/cae037ff9b20363b970cc600a09505b98bf10a14)) +- **eslint-plugin:** [unbound-method] fix crash due to missing `Intl` ([#2090](https://github.com/typescript-eslint/typescript-eslint/issues/2090)) ([f2fa82c](https://github.com/typescript-eslint/typescript-eslint/commit/f2fa82c532ae858ccfb064268cfcc9df657a54be)) +- **experimental-utils:** export `CLIEngine` & `ESLint` ([#2083](https://github.com/typescript-eslint/typescript-eslint/issues/2083)) ([014341b](https://github.com/typescript-eslint/typescript-eslint/commit/014341bb23261f609fc2a6fe7fece191466a084a)) +- **typescript-estree:** handle `BigInt` with `_` numeric separator ([#2067](https://github.com/typescript-eslint/typescript-eslint/issues/2067)) ([66f1627](https://github.com/typescript-eslint/typescript-eslint/commit/66f1627b11a566d5b925a577e800f99d5c808be2)) +- **typescript-estree:** mark TS 3.8 and 3.9 as "supported" ([#2057](https://github.com/typescript-eslint/typescript-eslint/issues/2057)) ([5eedbff](https://github.com/typescript-eslint/typescript-eslint/commit/5eedbff01178ea33b98ab22e556df4c1a195f839)), closes [#1436](https://github.com/typescript-eslint/typescript-eslint/issues/1436) [#1436](https://github.com/typescript-eslint/typescript-eslint/issues/1436) +# [3.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.34.0...v3.0.0) (2020-05-21) +## [Please see the release notes for v3.0.0](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v3.0.0) +### Bug Fixes -# [2.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.16.0...v2.17.0) (2020-01-20) +- **eslint-plugin:** [dot-notation] fix typo in schema ([#2040](https://github.com/typescript-eslint/typescript-eslint/issues/2040)) ([242328f](https://github.com/typescript-eslint/typescript-eslint/commit/242328fa749ee4c72af93433a9bef95f329ac62f)) +- **eslint-plugin:** correct parser peerDep version ([fe59f69](https://github.com/typescript-eslint/typescript-eslint/commit/fe59f69381a0915a4f5135e2e88637a5eea246ba)) +- **experimental-utils:** add back SourceCode.isSpaceBetweenTokens ([ae82ea4](https://github.com/typescript-eslint/typescript-eslint/commit/ae82ea4a85a4ca332ebe6104e96c59dba30411be)) +- **typescript-estree:** remove now defunct `Import` node type ([f199cbd](https://github.com/typescript-eslint/typescript-eslint/commit/f199cbdbbd892b5ba03bfff66f463f3d9c92ee9b)) +- **typescript-estree:** use `TSEmptyBodyFunctionExpression` for body-less nodes ([#1289](https://github.com/typescript-eslint/typescript-eslint/issues/1289)) ([82e7163](https://github.com/typescript-eslint/typescript-eslint/commit/82e7163214b56ccde93ba97807b161669a50a60b)) + +### Features + +- add index files to parser and typescript-estree ([3dfc46d](https://github.com/typescript-eslint/typescript-eslint/commit/3dfc46dccbbd28eed2d74c7b6cacddf1a0848598)) +- **eslint-plugin:** [no-floating-promises] ignore void operator by default ([#2003](https://github.com/typescript-eslint/typescript-eslint/issues/2003)) ([3626a67](https://github.com/typescript-eslint/typescript-eslint/commit/3626a673cf8117cc995245cd86e466e2553e9b0e)) +- **eslint-plugin:** [no-unnecessary-condition] remove `checkArrayPredicates` and always check it ([#1579](https://github.com/typescript-eslint/typescript-eslint/issues/1579)) ([bfd9b60](https://github.com/typescript-eslint/typescript-eslint/commit/bfd9b606d17d30d5694967a1f01e0e1501ba1022)) +- **eslint-plugin:** [no-unnecessary-condition] report when non-nullish is compared to `null`/`undefined` ([#1659](https://github.com/typescript-eslint/typescript-eslint/issues/1659)) ([7fa9060](https://github.com/typescript-eslint/typescript-eslint/commit/7fa906073903c5eb70609c25f1a91ada14dcdc71)) +- **eslint-plugin:** [prefer-nullish-coalescing][prefer-optional-chain] remove unsafe fixers ([52b6085](https://github.com/typescript-eslint/typescript-eslint/commit/52b60852d0ba6bb6abe519c9d3ec1b231793e91d)) +- **eslint-plugin:** [restrict-template-expressions] `allowNumber: true` by default ([#2005](https://github.com/typescript-eslint/typescript-eslint/issues/2005)) ([643ec24](https://github.com/typescript-eslint/typescript-eslint/commit/643ec240bd901295d9e9ea5c43fc20109c33e982)) +- **eslint-plugin:** [restrict-template-expressions] rename `allowNullable` to `allowNullish` ([#2006](https://github.com/typescript-eslint/typescript-eslint/issues/2006)) ([264b017](https://github.com/typescript-eslint/typescript-eslint/commit/264b017c11c2ab132fcbad18b42a9a0fe639386e)) +- **experimental-utils:** upgrade eslint types for v7 ([#2023](https://github.com/typescript-eslint/typescript-eslint/issues/2023)) ([06869c9](https://github.com/typescript-eslint/typescript-eslint/commit/06869c9656fa37936126666845aee40aad546ebd)) +- bump minimum required TS version ([#2004](https://github.com/typescript-eslint/typescript-eslint/issues/2004)) ([7ad4d7c](https://github.com/typescript-eslint/typescript-eslint/commit/7ad4d7c2db088b6f779b9d883a4acad13eee3775)) +- upgrade to ESLint v7 ([#2022](https://github.com/typescript-eslint/typescript-eslint/issues/2022)) ([208de71](https://github.com/typescript-eslint/typescript-eslint/commit/208de71059746bf38e94bd460346ffb2698a3e12)) +- **eslint-plugin:** [ban-types] rework default options ([#848](https://github.com/typescript-eslint/typescript-eslint/issues/848)) ([8e31d5d](https://github.com/typescript-eslint/typescript-eslint/commit/8e31d5dbe9fe5227fdbefcecfd50ce5dd51360c3)) +- **eslint-plugin:** [no-unnecessary-condition] remove option `ignoreRHS` ([#1163](https://github.com/typescript-eslint/typescript-eslint/issues/1163)) ([ee8dd8f](https://github.com/typescript-eslint/typescript-eslint/commit/ee8dd8f8a9e6c25ac426ce9bb71c5f012c51f264)) +- **eslint-plugin:** [strict-boolean-expression] rework options ([#1631](https://github.com/typescript-eslint/typescript-eslint/issues/1631)) ([cd14482](https://github.com/typescript-eslint/typescript-eslint/commit/cd1448240dca11762fcb9c10e18bb6541a840485)) +- **eslint-plugin:** delete deprecated rules ([#2002](https://github.com/typescript-eslint/typescript-eslint/issues/2002)) ([da0aec2](https://github.com/typescript-eslint/typescript-eslint/commit/da0aec2cfa27902aae7c438a2fe91343c822e4ae)) +- **eslint-plugin:** eslint-recommended: disable no-func-assign ([#984](https://github.com/typescript-eslint/typescript-eslint/issues/984)) ([ae9b8a9](https://github.com/typescript-eslint/typescript-eslint/commit/ae9b8a9c73c0328287de956466257d8bbfbdb20f)) +- **eslint-plugin:** eslint-recommended: disable no-obj-calls ([#1000](https://github.com/typescript-eslint/typescript-eslint/issues/1000)) ([b9ca14c](https://github.com/typescript-eslint/typescript-eslint/commit/b9ca14c5f5ec28a3fde1a9b2d2f6a4dc74d903e4)) +- **eslint-plugin:** update `eslint-recommended` set ([#1996](https://github.com/typescript-eslint/typescript-eslint/issues/1996)) ([9a96e18](https://github.com/typescript-eslint/typescript-eslint/commit/9a96e18400e0a0d738d159d9d01faf41d3586249)) +- **eslint-plugin:** update recommended sets ([#2001](https://github.com/typescript-eslint/typescript-eslint/issues/2001)) ([0126b4f](https://github.com/typescript-eslint/typescript-eslint/commit/0126b4f56f9197d561e90b09962ccceb4f88bc41)) +- **typescript-estree:** align nodes with estree 2020 ([#1389](https://github.com/typescript-eslint/typescript-eslint/issues/1389)) ([aff5b62](https://github.com/typescript-eslint/typescript-eslint/commit/aff5b62044f9b93f2087a1d261e9be3f8d6fd54d)) +- **typescript-estree:** align optional fields ([#1429](https://github.com/typescript-eslint/typescript-eslint/issues/1429)) ([0e0010f](https://github.com/typescript-eslint/typescript-eslint/commit/0e0010f82952f9beeeb84136eea00cc5eecc9db6)) +- drop support for node v8 ([#1997](https://github.com/typescript-eslint/typescript-eslint/issues/1997)) ([b6c3b7b](https://github.com/typescript-eslint/typescript-eslint/commit/b6c3b7b84b8d199fa75a46432febd4a364a63217)) +- **typescript-estree:** always return parserServices ([#716](https://github.com/typescript-eslint/typescript-eslint/issues/716)) ([5b23443](https://github.com/typescript-eslint/typescript-eslint/commit/5b23443c48f3f62424db3e742243f3568080b946)) +- **typescript-estree:** handle 3.9's non-null assertion changes ([#2036](https://github.com/typescript-eslint/typescript-eslint/issues/2036)) ([06bec63](https://github.com/typescript-eslint/typescript-eslint/commit/06bec63c56536db070608ab136d2ad57083f0c6a)) +# [2.34.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.33.0...v2.34.0) (2020-05-18) ### Bug Fixes -* **eslint-plugin:** [naming-convention] handle empty array-pattern ([#1450](https://github.com/typescript-eslint/typescript-eslint/issues/1450)) ([4726605](https://github.com/typescript-eslint/typescript-eslint/commit/4726605)) -* **eslint-plugin:** [unbound-method] handling of logical expr ([#1440](https://github.com/typescript-eslint/typescript-eslint/issues/1440)) ([9c5b857](https://github.com/typescript-eslint/typescript-eslint/commit/9c5b857)) -* **eslint-plugin:** set default-param-last as an extension rule ([#1445](https://github.com/typescript-eslint/typescript-eslint/issues/1445)) ([b5ef704](https://github.com/typescript-eslint/typescript-eslint/commit/b5ef704)) -* **typescript-estree:** correct type of `ArrayPattern.elements` ([#1451](https://github.com/typescript-eslint/typescript-eslint/issues/1451)) ([62e4ca0](https://github.com/typescript-eslint/typescript-eslint/commit/62e4ca0)) - +- **typescript-estree:** fix handling of range/loc removal ([#2028](https://github.com/typescript-eslint/typescript-eslint/issues/2028)) ([ce344d9](https://github.com/typescript-eslint/typescript-eslint/commit/ce344d90e7c78b0c4b4b823494a3e78190f45c64)) ### Features -* **eslint-plugin:** [naming-convention] allow not check format ([#1455](https://github.com/typescript-eslint/typescript-eslint/issues/1455)) ([61eb434](https://github.com/typescript-eslint/typescript-eslint/commit/61eb434)) -* **eslint-plugin:** [naming-convention] correct example ([#1455](https://github.com/typescript-eslint/typescript-eslint/issues/1455)) ([60683d7](https://github.com/typescript-eslint/typescript-eslint/commit/60683d7)) -* **eslint-plugin:** [no-extra-!-assert] flag ?. after !-assert ([#1460](https://github.com/typescript-eslint/typescript-eslint/issues/1460)) ([58c7c25](https://github.com/typescript-eslint/typescript-eslint/commit/58c7c25)) -* **eslint-plugin:** add explicit-module-boundary-types rule ([#1020](https://github.com/typescript-eslint/typescript-eslint/issues/1020)) ([bb0a846](https://github.com/typescript-eslint/typescript-eslint/commit/bb0a846)) -* **eslint-plugin:** add no-non-null-asserted-optional-chain ([#1469](https://github.com/typescript-eslint/typescript-eslint/issues/1469)) ([498aa24](https://github.com/typescript-eslint/typescript-eslint/commit/498aa24)) -* **experimental-utils:** expose getParserServices from utils ([#1448](https://github.com/typescript-eslint/typescript-eslint/issues/1448)) ([982c8bc](https://github.com/typescript-eslint/typescript-eslint/commit/982c8bc)) +- **eslint-plugin:** [no-invalid-void-type] allow union of void and `allowInGenericTypeArguments` ([#1960](https://github.com/typescript-eslint/typescript-eslint/issues/1960)) ([1bc105a](https://github.com/typescript-eslint/typescript-eslint/commit/1bc105a2c6ae3fde9596f0419fed0de699dc57c7)) +- **eslint-plugin:** [restrict-template-expressions] improve error message ([#1926](https://github.com/typescript-eslint/typescript-eslint/issues/1926)) ([1af59ba](https://github.com/typescript-eslint/typescript-eslint/commit/1af59ba8ac0ceabb008d9c61556acf7db0a1d352)) +- **experimental-utils:** add `suggestion` property for rule modules ([#2033](https://github.com/typescript-eslint/typescript-eslint/issues/2033)) ([f42a5b0](https://github.com/typescript-eslint/typescript-eslint/commit/f42a5b09ebfa173f418a99c552b0cbe221567194)) +# [2.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.32.0...v2.33.0) (2020-05-12) +### Bug Fixes +- **experimental-utils:** remove accidental dep on json-schema ([#2010](https://github.com/typescript-eslint/typescript-eslint/issues/2010)) ([1875fba](https://github.com/typescript-eslint/typescript-eslint/commit/1875fbad41f2a3dda8f610f5dcd180c6205b73d3)) +### Features -# [2.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.15.0...v2.16.0) (2020-01-13) +- **eslint-plugin:** add extension rule `lines-between-class-members` ([#1684](https://github.com/typescript-eslint/typescript-eslint/issues/1684)) ([08f93e6](https://github.com/typescript-eslint/typescript-eslint/commit/08f93e69347a8e7f3a7e8a1455bb5d069c2faeef)) +# [2.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.31.0...v2.32.0) (2020-05-11) ### Bug Fixes -* **eslint-plugin:** [no-magic-numbers] handle UnaryExpression for enums ([#1415](https://github.com/typescript-eslint/typescript-eslint/issues/1415)) ([852fc31](https://github.com/typescript-eslint/typescript-eslint/commit/852fc31)) -* **eslint-plugin:** [no-unnec-type-assert] handle JSX attributes ([#1002](https://github.com/typescript-eslint/typescript-eslint/issues/1002)) ([3c5659b](https://github.com/typescript-eslint/typescript-eslint/commit/3c5659b)) -* **eslint-plugin:** handle error classes using generics ([#1428](https://github.com/typescript-eslint/typescript-eslint/issues/1428)) ([b139540](https://github.com/typescript-eslint/typescript-eslint/commit/b139540)) -* **typescript-estree:** fix persisted parse for relative paths ([#1424](https://github.com/typescript-eslint/typescript-eslint/issues/1424)) ([9720d2c](https://github.com/typescript-eslint/typescript-eslint/commit/9720d2c)) -* **typescript-estree:** parsing of deeply nested new files in new folder ([#1412](https://github.com/typescript-eslint/typescript-eslint/issues/1412)) ([206c94b](https://github.com/typescript-eslint/typescript-eslint/commit/206c94b)) -* **typescript-estree:** resolve path relative to tsconfigRootDir ([#1439](https://github.com/typescript-eslint/typescript-eslint/issues/1439)) ([c709056](https://github.com/typescript-eslint/typescript-eslint/commit/c709056)) - +- **eslint-plugin:** [no-base-to-string] support boolean in unions ([#1979](https://github.com/typescript-eslint/typescript-eslint/issues/1979)) ([6987ecc](https://github.com/typescript-eslint/typescript-eslint/commit/6987ecc1dacfb45c0f8ed3e81d08aa708eb96ad1)) +- **eslint-plugin:** [no-type-alias] handle readonly types in aliases ([#1990](https://github.com/typescript-eslint/typescript-eslint/issues/1990)) ([56d9870](https://github.com/typescript-eslint/typescript-eslint/commit/56d987070f83d1b6410b04750b20a761fd793073)) +- **eslint-plugin:** [no-unused-expressions] inherit `messages` from base rule ([#1992](https://github.com/typescript-eslint/typescript-eslint/issues/1992)) ([51ca404](https://github.com/typescript-eslint/typescript-eslint/commit/51ca404af645eed194269ab7f8f67b97bd52e32d)) ### Features -* **eslint-plugin:** [no-unnec-cond] array predicate callbacks ([#1206](https://github.com/typescript-eslint/typescript-eslint/issues/1206)) ([f7ad716](https://github.com/typescript-eslint/typescript-eslint/commit/f7ad716)) -* **eslint-plugin:** add default-param-last rule ([#1418](https://github.com/typescript-eslint/typescript-eslint/issues/1418)) ([a37ff9f](https://github.com/typescript-eslint/typescript-eslint/commit/a37ff9f)) -* **eslint-plugin:** add rule naming-conventions ([#1318](https://github.com/typescript-eslint/typescript-eslint/issues/1318)) ([9eab26f](https://github.com/typescript-eslint/typescript-eslint/commit/9eab26f)) -* **typescript-estree:** add parserOption to turn on debug logs ([#1413](https://github.com/typescript-eslint/typescript-eslint/issues/1413)) ([25092fd](https://github.com/typescript-eslint/typescript-eslint/commit/25092fd)) -* **typescript-estree:** add strict type mapping to esTreeNodeToTSNodeMap ([#1382](https://github.com/typescript-eslint/typescript-eslint/issues/1382)) ([d3d70a3](https://github.com/typescript-eslint/typescript-eslint/commit/d3d70a3)) +- bump dependencies and align AST ([#2007](https://github.com/typescript-eslint/typescript-eslint/issues/2007)) ([18668b7](https://github.com/typescript-eslint/typescript-eslint/commit/18668b78fd7d1e5281af7fc26c76e0ca53297f69)) +# [2.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.30.0...v2.31.0) (2020-05-04) +### Bug Fixes +- **eslint-plugin:** [dot-notation] handle missing declarations ([#1947](https://github.com/typescript-eslint/typescript-eslint/issues/1947)) ([383f931](https://github.com/typescript-eslint/typescript-eslint/commit/383f93182599c00e231a0f0d36575ca0e19369a6)) +- **eslint-plugin:** [method-signature-style] fix overloaded methods to an intersection type ([#1966](https://github.com/typescript-eslint/typescript-eslint/issues/1966)) ([7f3fba3](https://github.com/typescript-eslint/typescript-eslint/commit/7f3fba348d432d7637e1c737df943ee1f9105062)) +- **eslint-plugin:** [return-await] await in a normal function ([#1962](https://github.com/typescript-eslint/typescript-eslint/issues/1962)) ([f82fd7b](https://github.com/typescript-eslint/typescript-eslint/commit/f82fd7bb81f986c4861d0b4e2ecdb0c496d7a602)) +- **eslint-plugin:** [unbound-method] false positives for unary expressions ([#1964](https://github.com/typescript-eslint/typescript-eslint/issues/1964)) ([b35070e](https://github.com/typescript-eslint/typescript-eslint/commit/b35070ec6f84ad5ce606386cdb6eeb91488dfdd7)) +- **eslint-plugin:** no-base-to-string boolean expression detect ([#1969](https://github.com/typescript-eslint/typescript-eslint/issues/1969)) ([f78f13a](https://github.com/typescript-eslint/typescript-eslint/commit/f78f13aedd59d5b5880903d48c779a6c50fd937e)) +### Features -# [2.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.14.0...v2.15.0) (2020-01-06) +- **eslint-plugin:** [member-ordering] add decorators support ([#1870](https://github.com/typescript-eslint/typescript-eslint/issues/1870)) ([f7ec192](https://github.com/typescript-eslint/typescript-eslint/commit/f7ec1920607cb8eec8020b08cd7247de0bf19ce1)) +- **eslint-plugin:** [prefer-optional-chain] added option to convert to suggestion fixer ([#1965](https://github.com/typescript-eslint/typescript-eslint/issues/1965)) ([2f0824b](https://github.com/typescript-eslint/typescript-eslint/commit/2f0824b0a41f3043b6242fc1d49faae540abaf22)) +- **eslint-plugin:** new extended rule 'no-invalid-this' ([#1823](https://github.com/typescript-eslint/typescript-eslint/issues/1823)) ([b18bc35](https://github.com/typescript-eslint/typescript-eslint/commit/b18bc357507337b9725f8d9c1b549513075a0da5)) +- **eslint-plugin-internal:** add rule no-poorly-typed-ts-props ([#1949](https://github.com/typescript-eslint/typescript-eslint/issues/1949)) ([56ea7c9](https://github.com/typescript-eslint/typescript-eslint/commit/56ea7c9581c0c99fe394bbcfc4128e8054c88ab2)) +- **experimental-utils:** expose our RuleTester extension ([#1948](https://github.com/typescript-eslint/typescript-eslint/issues/1948)) ([2dd1638](https://github.com/typescript-eslint/typescript-eslint/commit/2dd1638aaa2658ba99b2341861146b586f489121)) +# [2.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.29.0...v2.30.0) (2020-04-27) ### Bug Fixes -* **eslint-plugin:** crash in no-unnecessary-type-arguments ([#1401](https://github.com/typescript-eslint/typescript-eslint/issues/1401)) ([01c939f](https://github.com/typescript-eslint/typescript-eslint/commit/01c939f)) -* **typescript-estree:** correct persisted parse for windows ([#1406](https://github.com/typescript-eslint/typescript-eslint/issues/1406)) ([1a42f3d](https://github.com/typescript-eslint/typescript-eslint/commit/1a42f3d)) - +- **eslint-plugin:** [prefer-string-starts-ends-with] check for negative start index in slice ([#1920](https://github.com/typescript-eslint/typescript-eslint/issues/1920)) ([ed2bd60](https://github.com/typescript-eslint/typescript-eslint/commit/ed2bd6067f74ae33e36a084719bb91efedfba599)) +- **eslint-plugin:** fix no-base-to-string boolean literal check ([#1850](https://github.com/typescript-eslint/typescript-eslint/issues/1850)) ([2f45e99](https://github.com/typescript-eslint/typescript-eslint/commit/2f45e9992a8f12b6233716e77a6159f9cea2c879)) ### Features -* **eslint-plugin:** [strict-bool-expr] add allowSafe option ([#1385](https://github.com/typescript-eslint/typescript-eslint/issues/1385)) ([9344233](https://github.com/typescript-eslint/typescript-eslint/commit/9344233)) -* **eslint-plugin:** add no-implied-eval ([#1375](https://github.com/typescript-eslint/typescript-eslint/issues/1375)) ([254d276](https://github.com/typescript-eslint/typescript-eslint/commit/254d276)) +- **eslint-plugin:** add extension rule `dot-notation` ([#1867](https://github.com/typescript-eslint/typescript-eslint/issues/1867)) ([a85c3e1](https://github.com/typescript-eslint/typescript-eslint/commit/a85c3e1515d735b6c245cc658cdaec6deb05d630)) +- **eslint-plugin:** create `no-invalid-void-type` rule ([#1847](https://github.com/typescript-eslint/typescript-eslint/issues/1847)) ([f667ff1](https://github.com/typescript-eslint/typescript-eslint/commit/f667ff1708d4ed28b7ea5beea742889da69a76d9)) +- **experimental-utils:** allow rule options to be a readonly tuple ([#1924](https://github.com/typescript-eslint/typescript-eslint/issues/1924)) ([4ef6788](https://github.com/typescript-eslint/typescript-eslint/commit/4ef67884962b6aac61cc895aaa3ba16aa892ecf4)) +# [2.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.28.0...v2.29.0) (2020-04-20) +### Bug Fixes +- **eslint-plugin:** [no-base-to-string] soft remove `ignoreTaggedTemplateExpressions` option ([#1916](https://github.com/typescript-eslint/typescript-eslint/issues/1916)) ([369978e](https://github.com/typescript-eslint/typescript-eslint/commit/369978e9685bacb3e3882b0510ff06eaf8df4ca1)) +### Features -# [2.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.13.0...v2.14.0) (2019-12-30) +- **eslint-plugin:** [no-floating-promise] add option to ignore IIFEs ([#1799](https://github.com/typescript-eslint/typescript-eslint/issues/1799)) ([cea51bf](https://github.com/typescript-eslint/typescript-eslint/commit/cea51bf130d6d3c2935f5e2dcc468196f2ad9d00)) +- **eslint-plugin:** [restrict-template-expressions] add support for intersection types ([#1803](https://github.com/typescript-eslint/typescript-eslint/issues/1803)) ([cc70e4f](https://github.com/typescript-eslint/typescript-eslint/commit/cc70e4fbadd0b15fd6af913a2e1e2ddd346fa558)) +- **eslint-plugin:** add extension rule `init-declarations` ([#1814](https://github.com/typescript-eslint/typescript-eslint/issues/1814)) ([b01f5e7](https://github.com/typescript-eslint/typescript-eslint/commit/b01f5e778ac28e0797a3734fc58d025bb224f418)) +- **eslint-plugin:** add extension rule `keyword-spacing` ([#1739](https://github.com/typescript-eslint/typescript-eslint/issues/1739)) ([c5106dd](https://github.com/typescript-eslint/typescript-eslint/commit/c5106dd4bf2bc8846cc39aa8bb50c33bec026d4d)) +# [2.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.27.0...v2.28.0) (2020-04-13) ### Bug Fixes -* **eslint-plugin:** type assertion in rule no-extra-parens ([#1376](https://github.com/typescript-eslint/typescript-eslint/issues/1376)) ([f40639e](https://github.com/typescript-eslint/typescript-eslint/commit/f40639e)) -* **typescript-estree:** visit typeParameters in OptionalCallExpr ([#1377](https://github.com/typescript-eslint/typescript-eslint/issues/1377)) ([cba6a2a](https://github.com/typescript-eslint/typescript-eslint/commit/cba6a2a)) - +- **eslint-plugin:** [method-signature-style] handle multiline params ([#1861](https://github.com/typescript-eslint/typescript-eslint/issues/1861)) ([5832a86](https://github.com/typescript-eslint/typescript-eslint/commit/5832a8643bbe174ec02df5966bb333e506e45f5d)) +- **eslint-plugin:** [no-empty-interface] use suggestion fixer for ambient contexts ([#1880](https://github.com/typescript-eslint/typescript-eslint/issues/1880)) ([62b2278](https://github.com/typescript-eslint/typescript-eslint/commit/62b2278aec0011c93eae17bed8b278114d3379a2)) +- **eslint-plugin:** [unbound-method] false positive on property function initializer ([#1890](https://github.com/typescript-eslint/typescript-eslint/issues/1890)) ([f1c3b18](https://github.com/typescript-eslint/typescript-eslint/commit/f1c3b18f7aadc81f7dca7aa32aa1a8fe424e04e7)) +- **eslint-plugin:** [unbound-method] ignore assignments _to_ methods ([#1736](https://github.com/typescript-eslint/typescript-eslint/issues/1736)) ([6b4680b](https://github.com/typescript-eslint/typescript-eslint/commit/6b4680b6e7343d9d98fa1de170f387a36d98b73e)) +- **eslint-plugin:** no-empty-interface autofix ([#1865](https://github.com/typescript-eslint/typescript-eslint/issues/1865)) ([829a2f7](https://github.com/typescript-eslint/typescript-eslint/commit/829a2f728f876d356908e2338c2d6620e58f9943)), closes [#1864](https://github.com/typescript-eslint/typescript-eslint/issues/1864) +- **eslint-plugin:** use `isTypeArrayTypeOrUnionOfArrayTypes` util for checking if type is array ([#1728](https://github.com/typescript-eslint/typescript-eslint/issues/1728)) ([05030f8](https://github.com/typescript-eslint/typescript-eslint/commit/05030f8d2bd5a50e95053bc61380891da71cc567)) ### Features -* add internal eslint plugin for repo-specific lint rules ([#1373](https://github.com/typescript-eslint/typescript-eslint/issues/1373)) ([3a15413](https://github.com/typescript-eslint/typescript-eslint/commit/3a15413)) +- **eslint-plugin:** [ban-ts-comment] support `ts-expect-error` ([#1706](https://github.com/typescript-eslint/typescript-eslint/issues/1706)) ([469cff3](https://github.com/typescript-eslint/typescript-eslint/commit/469cff332c041f38f60de052769287342455cff1)) +- **eslint-plugin:** [consistent-type-assertions] always allow `const` assertions ([#1713](https://github.com/typescript-eslint/typescript-eslint/issues/1713)) ([af2c00d](https://github.com/typescript-eslint/typescript-eslint/commit/af2c00de62f7e31eaeb88996ebf3f330cc8473b9)) +- **eslint-plugin:** [explicit-function-return-type] add option to allow concise arrows that start with void ([#1732](https://github.com/typescript-eslint/typescript-eslint/issues/1732)) ([2e9c202](https://github.com/typescript-eslint/typescript-eslint/commit/2e9c2028a8a0b226e0f87d4bcc997fa259ca3ebd)) +- **eslint-plugin:** [explicit-module-boundary-types] add optio… ([#1778](https://github.com/typescript-eslint/typescript-eslint/issues/1778)) ([3eee804](https://github.com/typescript-eslint/typescript-eslint/commit/3eee804461d017ea6189cd7f64fcd473623684b4)) +- **eslint-plugin:** [no-base-to-string] add option to ignore tagged templates ([#1763](https://github.com/typescript-eslint/typescript-eslint/issues/1763)) ([f5edb99](https://github.com/typescript-eslint/typescript-eslint/commit/f5edb9938c33f8b68f026eba00db3abe9359ced3)) +- **eslint-plugin:** [restrict-template-expressions] add option `allowAny` ([#1762](https://github.com/typescript-eslint/typescript-eslint/issues/1762)) ([d44c0f9](https://github.com/typescript-eslint/typescript-eslint/commit/d44c0f9bed2404ca00b020b35fd825929e213398)) +- **eslint-plugin:** add rule `prefer-reduce-type-parameter` ([#1707](https://github.com/typescript-eslint/typescript-eslint/issues/1707)) ([c92d240](https://github.com/typescript-eslint/typescript-eslint/commit/c92d240e49113779053eac32038382b282812afc)) +- **eslint-plugin:** add rule `prefer-ts-expect-error` ([#1705](https://github.com/typescript-eslint/typescript-eslint/issues/1705)) ([7021f21](https://github.com/typescript-eslint/typescript-eslint/commit/7021f2151a25db2a8edf17e06cd6f21e90761ec8)) +- **eslint-plugin:** add rule no-unsafe-assignment ([#1694](https://github.com/typescript-eslint/typescript-eslint/issues/1694)) ([a49b860](https://github.com/typescript-eslint/typescript-eslint/commit/a49b860cbbb2c7d718b99f561e2fb6eaadf16f17)) +# [2.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.26.0...v2.27.0) (2020-04-06) +### Bug Fixes +- **eslint-plugin:** [no-throw-literal] fix crash caused by getBaseTypes ([#1830](https://github.com/typescript-eslint/typescript-eslint/issues/1830)) ([9d53c76](https://github.com/typescript-eslint/typescript-eslint/commit/9d53c761983dd964109b9f13eb9bfe20caf9defb)) +- **eslint-plugin:** [no-unsafe-call] fix incorrect selector ([#1826](https://github.com/typescript-eslint/typescript-eslint/issues/1826)) ([8ec53a3](https://github.com/typescript-eslint/typescript-eslint/commit/8ec53a3579fcb59cdffea0c60fbb755d056f4c8a)) +- **eslint-plugin:** [require-await] handle async generators ([#1782](https://github.com/typescript-eslint/typescript-eslint/issues/1782)) ([9642d9d](https://github.com/typescript-eslint/typescript-eslint/commit/9642d9dce693befac89a4e9d8bf8dd18f4361e2a)) +- **eslint-plugin:** no-explicit-any constructor functions (& mo… ([#1711](https://github.com/typescript-eslint/typescript-eslint/issues/1711)) ([ab8572e](https://github.com/typescript-eslint/typescript-eslint/commit/ab8572e30e14ebda91c8437be5ee35e7dc9add2e)) +- **typescript-estree:** add support for TS3.9 extra file extensions ([#1833](https://github.com/typescript-eslint/typescript-eslint/issues/1833)) ([1f0ff41](https://github.com/typescript-eslint/typescript-eslint/commit/1f0ff41aa1bc3b7c5330b2f5fe22e24bf578a6b2)) +### Features -# [2.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.12.0...v2.13.0) (2019-12-23) +- **eslint-plugin:** new rule method-signature-style ([#1685](https://github.com/typescript-eslint/typescript-eslint/issues/1685)) ([c49d771](https://github.com/typescript-eslint/typescript-eslint/commit/c49d771ba62f1a21d3c1aec106341daddfcd3c9a)) +- **eslint-plugin:** sort members alphabetically ([#263](https://github.com/typescript-eslint/typescript-eslint/issues/263)) ([485e902](https://github.com/typescript-eslint/typescript-eslint/commit/485e90213a0f8baac0587f7d56925448883fc5bd)) +- **eslint-plugin-internal:** add plugin-test-formatting rule ([#1821](https://github.com/typescript-eslint/typescript-eslint/issues/1821)) ([9b0023a](https://github.com/typescript-eslint/typescript-eslint/commit/9b0023a4996ecdd7dfcb30abd1678091a78f3064)) +- **experimental-utils:** add types for suggestions from CLIEngine ([#1844](https://github.com/typescript-eslint/typescript-eslint/issues/1844)) ([7c11bd6](https://github.com/typescript-eslint/typescript-eslint/commit/7c11bd66f2d0e5ea9d3943e6b8c66e6ddff50862)) +- **experimental-utils:** update eslint types to match v6.8 ([#1846](https://github.com/typescript-eslint/typescript-eslint/issues/1846)) ([16ce74d](https://github.com/typescript-eslint/typescript-eslint/commit/16ce74d247781ac890dc0baa30c384f97e581b6b)) +# [2.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.25.0...v2.26.0) (2020-03-30) ### Bug Fixes -* **eslint-plugin:** [quotes] ignore backticks for Enum members ([#1355](https://github.com/typescript-eslint/typescript-eslint/issues/1355)) ([e51048c](https://github.com/typescript-eslint/typescript-eslint/commit/e51048c)) -* **eslint-plugin:** [type-annotation-spacing] typo in messages ([#1354](https://github.com/typescript-eslint/typescript-eslint/issues/1354)) ([82e0dbc](https://github.com/typescript-eslint/typescript-eslint/commit/82e0dbc)) -* **eslint-plugin:** add isTypeAssertion utility function ([#1369](https://github.com/typescript-eslint/typescript-eslint/issues/1369)) ([bb1671e](https://github.com/typescript-eslint/typescript-eslint/commit/bb1671e)) -* **eslint-plugin:** use AST_NODE_TYPES enum instead of strings ([#1366](https://github.com/typescript-eslint/typescript-eslint/issues/1366)) ([bd0276b](https://github.com/typescript-eslint/typescript-eslint/commit/bd0276b)) -* **typescript-estree:** correct type of key for base nodes ([#1367](https://github.com/typescript-eslint/typescript-eslint/issues/1367)) ([099225a](https://github.com/typescript-eslint/typescript-eslint/commit/099225a)) - +- **eslint-plugin:** [no-explicit-any] error with ignoreRestArgs ([#1796](https://github.com/typescript-eslint/typescript-eslint/issues/1796)) ([638d84d](https://github.com/typescript-eslint/typescript-eslint/commit/638d84ddd77d07117b3ec7c5431f3b0e44b1995d)) +- **eslint-plugin:** [no-unsafe-call] allow import expressions ([#1800](https://github.com/typescript-eslint/typescript-eslint/issues/1800)) ([4fa7107](https://github.com/typescript-eslint/typescript-eslint/commit/4fa710754ecc412b65ac3864fe0c7857c254ac1b)) +- **eslint-plugin:** [no-unsafe-return] error with ), and make it easier for us to help you. Often times if you comment on a closed issue, we will just ask you to open a new issue, so please save everyone's time, and **_help us to help you_**. - -Please refrain from commenting on `main` commits. Commit comments are not searchable, meaning that nobody else can discover your comments. Raise an issue and reference the commit instead so that everyone can see your comment, and you can fill out the template. - ---- - -## Pull Requests - -> With the exception of extremely minor documentation typos, **only send pull requests that resolve open issues**. - -Anyone is free to help us build and maintain this project. If you see an issue that needs working on because it's important to you, comment on the issue to help make sure that nobody else works on it at the same time, and then start working. - -Developing in this repo is easy: - -- First fork the repo, and then clone it locally. -- Create a new branch. -- In the root of the project, run `yarn install`. - - This will install the dependencies, link the packages and do a build. -- Make the required changes. - -### Validating Your Changes - -We have a sophisticated CI process setup which gets run on every PR. You must pass all of the checks for us to consider merging your PR. Here is a list of checks that are done automatically, that you can also perform locally before pushing. - -- Ensure your code is properly formatted. - - You can run `yarn format` in any package or in the root. - - Alternatively, you can run prettier on save. -- Ensure there are no typechecking errors. - - You can run `yarn typecheck` in any package or in the root. -- Ensure your changes are adequately tested. - - You can run `yarn test` in any package. - - [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 - - We aim for around `90%` branch coverage for every PR. - - Coverage reports should automatically be generated locally, and the `codecov` bot should also comment on your PR with the percentage, as well as links to the line-by-line coverage of each file touched by your PR. -- Ensure you have no lint errors. - - You can run `yarn lint` in any package or in the root. - - You can run `yarn lint-markdown` in the root. -- If you have made changes to any markdown documentation, ensure there are no spelling errors - - You can run `yarn check-spelling` in the root. - - Or if you are using vscode, you can use [`Code Spell Checker`](https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker) plugin. -- If you have made changes within the `eslint-plugin` package, ensure the configs and documentation are valid. - - You can run `yarn check-configs` and `yarn check-docs` in the root, or in the `eslint-plugin` folder. - -### Raising a PR - -Once your changes are ready, you can raise a PR. The title of your PR should match the following format: - -```text -(): -``` - -You can find more samples of good past PR titles in [recent commits to `main`](https://github.com/typescript-eslint/typescript-eslint/commits/main)) - -```text -fix(scope-manager): correct handling for class static blocks -``` - -```text -docs: Fix links to getting started in README.md -``` - -### Type - -Must be one of the following: - -- `feat` - for any new functionality additions -- `fix` - for any bug fixes that don't add new functionality -- `test` - if you only change tests, and not shipped code -- `docs` - if you only change documentation, and not shipped code -- `chore` - anything else - -### package - -`` is the name of the package you have made changes within (`eslint-plugin`, `parser`, `typescript-estree`, etc). If you make significant changes across multiple packages, you can omit this (i.e. `feat: foo bar`). - -### short description - -And `` is a succinct title for the PR. - -Within the body of your PR, make sure you reference the issue that you have worked on, as well as pointing out anything of note you wish us to look at during our review. - -Make sure you use the "Fixes #xxx" format to reference issues, so that GitHub automatically closes the issues when we merge the PR. Also note that if you are fixing multiple issues at once, you can only reference one issue per line, and must put one "Fixes #xxx" per issue number. - -In terms of your commit history - we do not care about the number, or style of commits in your history, because we squash merge every PR into `main`. Feel free to commit in whatever style you feel comfortable with. - -**_One thing we ask is to please avoid force pushing after you have raised a PR_**. GitHub is not able to track changes across force pushes, which makes it impossible to efficiently do incremental reviews. This slows us down, and means it will take longer for us to get your PR merged. - -### Addressing Feedback and Beyond - -With your PR raised, and the CI showing green, your PR will [sit in the queue to be reviewed](https://github.com/typescript-eslint/typescript-eslint/pulls?q=is%3Apr+is%3Aopen+sort%3Acreated-asc+-label%3A%22breaking+change%22+-label%3A%22awaiting+response%22+-label%3A%221+approval%22+-label%3A%22DO+NOT+MERGE%22). We generally review PRs oldest to newest, unless we consider a newer PR higher priority (i.e. if it's a bug fix). - -Please note that as this project is maintained by volunteers, it may take a while for us to get around to your PR (sometimes a month or more). Be patient, we'll get to it. Please refrain from commenting asking for a review, or similar bump comments. **_These just create spam for maintainers, and does not push your PR higher in the queue_**. - -Once we have reviewed your PR, we will provide any feedback that needs addressing. If you feel a requested change is wrong, don't be afraid to discuss with us in the comments. Once the feedback is addressed, and the PR is reviewed, we'll ensure the branch is up to date with `main`, and merge it for you. +See **https://typescript-eslint.io/contributing** for our contributing guidelines. +Thanks! 💖 diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 3d6d37b2190..2dcd4d3f847 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -10,83 +10,83 @@ Thanks goes to these wonderful people:
Brad Zacher

Armano

Josh Goldberg
-
Reyad Attiyat
+
Oleksandr T.
-
Patricio Trevino
+
Michaël De Boey
+
Reyad Attiyat
+
Gareth Jones

Sosuke Suzuki
+
Patricio Trevino
+ +
Joshua Chen
+
YeonJuan

Nicholas C. Zakas

Jed Fox
+
Rafael Santana
-
YeonJuan
-
Rafael Santana

Ben Lichtman

Nikita

Taeheon Kim
- -
Scott O'Hara

Retsam
+ +
Kai Cataldo

Rasmus Eneman
+
Rebecca Stevens

Toru Nagashima
+
Yosuke Ota
-
Yosuke Ota

JounQin

Lucas Azzola
+
Simen Bekkhus

Danny Fritz

Ika
+
cherryblossom

mackie
-
Simen Bekkhus
+
Bryan Mishkin

Kanitkorn Sujautra
-
cherryblossom
-
Zzzen
+
Omri Luzon
+
Zzzen

Anix
+
Daniil Dubrava

Pete Gonzalez

ldrick
-
Susisu
-
Gavin Barron
+
Susisu
+
SHIMA RYUHEI
+
Gavin Barron

Kevin Partington

Lucas Duailibe
-
Niles Salter
-
SHIMA RYUHEI
-
koooge
-
thomas michael wallace
-
ulrichb
-
Juan García
-
Bryan Mishkin
-
Daniel Cassidy
+
Niles Salter
+
Pavel Birukov
+
Shahar Dawn Or
+
kmin-jeong
+
James Garbutt
-
Daniel Nixon
-
Denys Kniazevych
-
Dimitri Mitropoulos
-
Ian MacLeod

Jonathan Delgado
- -
Philipp A.

Pig Fang

Tadhg McDonald-Jensen

Thomas den Hollander
-
Yasar Siddiqui
+
Tim Kraut
+
Yasar Siddiqui

Yusuke Tanaka
-
Bence Dányi
-
Eric Wang
-
Soobin Bak
+
zz
diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md new file mode 100644 index 00000000000..40ba0362273 --- /dev/null +++ b/DEVELOPMENT.md @@ -0,0 +1,4 @@ +# Development + +See **https://typescript-eslint.io/contributing/local-development** for our development instructions. +Thanks! 💖 diff --git a/LICENSE b/LICENSE index 82e1ce3c460..61fed567687 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -TypeScript ESLint +typescript-eslint Originally extracted from: @@ -8,11 +8,11 @@ Copyright JS Foundation and other contributors, https://js.foundation Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. +- Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +- Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE diff --git a/README.md b/README.md index bddf59d198b..5241dbda4a2 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -

TypeScript ESLint

+

typescript-eslint

-

Monorepo for all the tooling which enables ESLint to support TypeScript

+

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

CI @@ -9,99 +9,26 @@ Codecov

+

👇

- - See typescript-eslint.io for documentation. + See typescript-eslint.io for documentation on the latest released version. +

+

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

👆

- -## Packages included in this project - -See https://typescript-eslint.io/docs/development/architecture/packages for more details. - -- [`@typescript-eslint/eslint-plugin`](./packages/eslint-plugin) -- [`@typescript-eslint/parser`](./packages/parser) -- [`@typescript-eslint/eslint-plugin-tslint`](./packages/eslint-plugin-tslint) -- [`@typescript-eslint/utils`](./packages/utils) -- [`@typescript-eslint/typescript-estree`](./packages/typescript-estree) -- [`@typescript-eslint/scope-manager`](./packages/scope-manager) - -## Versioning - -All of the packages are published with the same version number to make it easier to coordinate both releases and installations. - -We publish a canary release on every successful merge to `main`, so **you never need to wait for a new stable version to make use of any updates**. - -Additionally, we promote to the `latest` tag on NPM once per week, **on Mondays at 1 pm Eastern**. - -The latest version under the `latest` tag is: - -NPM Version - -The latest version under the `canary` tag **(latest commit to `main`)** is: - -NPM Version - -(Note: The only exception to the automated publishes described above is when we are in the final phases of creating the next major version of the libraries - e.g. going from `1.x.x` to `2.x.x`. During these periods, we manually publish `canary` releases until we are happy with the release and promote it to `latest`.) - -### Supported TypeScript Version - -**The version range of TypeScript currently supported by this parser is `>=3.3.1 <4.9.0`.** - -These versions are what we test against. - -We will always endeavor to support the latest stable version of TypeScript. -Sometimes, but not always, changes in TypeScript will not require breaking changes in this project, and so we are able to support more than one version of TypeScript. -In some cases, we may even be able to support additional pre-releases (i.e. betas and release candidates) of TypeScript, but only if doing so does not require us to compromise on support for the latest stable version. - -Note that our packages have an open `peerDependency` requirement in order to allow for experimentation on newer/beta versions of TypeScript. - -If you use a non-supported version of TypeScript, the parser will log a warning to the console. -If you want to disable this warning, you can configure this in your `parserOptions`. See: [`@typescript-eslint/parser`](./packages/parser/) and [`@typescript-eslint/typescript-estree`](./packages/typescript-estree/). - -**Please ensure that you are using a supported version before submitting any issues/bug reports.** - -### Supported ESLint Version - -See the value of `eslint` declared in `@typescript-eslint/eslint-plugin`'s [package.json](./packages/eslint-plugin/package.json). - -### Supported Node Version - -This project makes an effort to support Active LTS and Maintenance LTS release statuses of Node according to [Node's release document](https://nodejs.org/en/about/releases). -Support for specific Current status releases are considered periodically. - -## License - -TypeScript ESLint inherits from the original TypeScript ESLint Parser license, as the majority of the work began there. It is licensed under a permissive BSD 2-clause license. - -## How can I help? - -I'm so glad you asked! - -Although typescript-eslint's packages are already downloaded millions of times per month and power high profile projects across our industry, this is a 100% community-driven project. -From the second you install one of the packages from this monorepo, you are a part of that community. - -**See an issue?** -Report it in as much detail as possible, ideally with a clear and minimal reproduction. - -If you have the time and the inclination, you can even take it a step further and submit a PR to improve the project. - -There are also financial ways to contribute, please see [Financial Contributors](#Financial-Contributors) for more details. - -All positive contributions are welcome here! - -> **[See the contributing guide here](./CONTRIBUTING.md)**. - -Please be respectful and mindful of how many hours of unpaid work go into typescript-eslint. + ## Code Contributors -This project exists thanks to every one of the awesome people who contribute code and documentation: +This project exists thanks to the awesome people who contribute code and documentation: Gallery of all contributors' profile photos @@ -114,3 +41,7 @@ In addition to submitting code and documentation updates, you can help us sustai Deploys by Netlify + +## License + +typescript-eslint inherits from the original TypeScript ESLint Parser license, as the majority of the work began there. It is licensed under a permissive BSD 2-clause license. diff --git a/docs/Architecture.md b/docs/Architecture.md new file mode 100644 index 00000000000..ee224c1e90a --- /dev/null +++ b/docs/Architecture.md @@ -0,0 +1,17 @@ +--- +id: architecture +title: Architecture +--- + +The `@typescript-eslint/*` packages are built from a monorepo located at https://github.com/typescript-eslint/typescript-eslint. +The monorepo is built with [Lerna](https://lerna.js.org) and [Nx](https://nx.dev). + +Each page in this section corresponds to a package we intentionally expose to users. +They are: + +- [`@typescript-eslint/eslint-plugin`](./architecture/ESLint_Plugin.mdx): An ESLint plugin which provides lint rules for TypeScript codebases. +- [`@typescript-eslint/eslint-plugin-tslint`](./architecture/ESLint_Plugin_TSLint.mdx): ESLint plugin that allows running TSLint rules within ESLint to help you migrate from TSLint to ESLint. +- [`@typescript-eslint/parser`](./architecture/Parser.mdx): An ESLint parser which allows for ESLint to lint TypeScript source code. +- [`@typescript-eslint/scope-manager`](./architecture/Scope_Manager.mdx): A fork of [`eslint-scope`](https://github.com/eslint/eslint-scope), enhanced to support TypeScript functionality. +- [`@typescript-eslint/typescript-estree`](./architecture/TypeScript-ESTree.mdx): The underlying code used by [`@typescript-eslint/parser`](./architecture/Parser.mdx) that converts TypeScript source code into an ESTree-compatible form. +- [`@typescript-eslint/utils`](./architecture/Utils.mdx): Utilities for working with TypeScript + ESLint together. diff --git a/docs/Contributing.mdx b/docs/Contributing.mdx new file mode 100644 index 00000000000..852e503c269 --- /dev/null +++ b/docs/Contributing.mdx @@ -0,0 +1,15 @@ +--- +id: contributing +title: Contributing +--- + +Thank you for your interest in contributing to typescript-eslint! 💜 + +Although typescript-eslint's packages are already downloaded millions of times per month and power high profile projects across our industry, this is a 100% community-driven project. +From the second you install one of the packages from this monorepo, you are a part of that community. +So, from the bottom of our hearts, _thank you_ 💕. + +## Getting Started + +Please read our [Code of Conduct](https://github.com/typescript-eslint/typescript-eslint/blob/main/CODE_OF_CONDUCT.md) first. +If you're new to open source, you may also find the [How to Contribute to Open Source](https://opensource.guide/how-to-contribute) guide from https://opensource.guide useful. diff --git a/docs/development/CUSTOM_RULES.md b/docs/Custom_Rules.md similarity index 96% rename from docs/development/CUSTOM_RULES.md rename to docs/Custom_Rules.md index f04255d00e6..0590398b818 100644 --- a/docs/development/CUSTOM_RULES.md +++ b/docs/Custom_Rules.md @@ -5,7 +5,8 @@ title: Custom Rules --- :::important -You should be familiar with [ESLint's developer guide](https://eslint.org/docs/developer-guide) and [Development > Architecture](./architecture/asts) before writing custom rules. +This page describes how to write your own custom ESLint rules using typescript-eslint. +You should be familiar with [ESLint's developer guide](https://eslint.org/docs/developer-guide) and [ASTs](https://typescript-eslint.io/blog/asts-and-typescript-eslint) before writing custom rules. ::: As long as you are using `@typescript-eslint/parser` as the `parser` in your ESLint configuration, custom ESLint rules generally work the same way for JavaScript and TypeScript code. @@ -17,7 +18,7 @@ The main three changes to custom rules writing are: ## Utils Package -The `@typescript-eslint/utils` package acts as a replacement package for `eslint` that exports all the same objects and types, but with typescript-eslint support. +The [`@typescript-eslint/utils`](./architecture/Utils.mdx) package acts as a replacement package for `eslint` that exports all the same objects and types, but with typescript-eslint support. It also exports common utility functions and constants most custom typescript-eslint rules tend to use. :::caution diff --git a/docs/README.md b/docs/Getting_Started.md similarity index 82% rename from docs/README.md rename to docs/Getting_Started.md index 0cc743de8d8..91c978322f4 100644 --- a/docs/README.md +++ b/docs/Getting_Started.md @@ -1,7 +1,6 @@ --- id: getting-started title: Getting Started -slug: / --- ## Quickstart @@ -64,16 +63,16 @@ ESLint will lint all TypeScript compatible files within the current folder, and ### Configuration Values -- `parser: '@typescript-eslint/parser'` tells ESLint to use the [`@typescript-eslint/parser`](https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/parser) package you installed to parse your source files. +- `parser: '@typescript-eslint/parser'` tells ESLint to use the [`@typescript-eslint/parser`](./architecture/Parser.mdx) package you installed to parse your source files. - This is required, or else ESLint will throw errors as it tries to parse TypeScript code as if it were regular JavaScript. -- `plugins: ['@typescript-eslint']` tells ESLint to load the [`@typescript-eslint/eslint-plugin`](https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/eslint-plugin) package as a plugin. +- `plugins: ['@typescript-eslint']` tells ESLint to load the [`@typescript-eslint/eslint-plugin`](./architecture/ESLint_Plugin.mdx) package as a plugin. - This allows you to use typescript-eslint's rules within your codebase. - `extends: [ ... ]` tells ESLint that your config extends the given configurations. - `eslint:recommended` is ESLint's inbuilt "recommended" config - it turns on a small, sensible set of rules which lint for well-known best-practices. - - `plugin:@typescript-eslint/recommended` is our "recommended" config - it's just like `eslint:recommended`, except it only turns on rules from our TypeScript-specific plugin. + - `plugin:@typescript-eslint/recommended` is our "recommended" config - it's similar to `eslint:recommended`, except it turns on TypeScript-specific rules from our plugin. ## Next Steps -We provide a plethora of powerful rules that utilize the power of TypeScript's type information. [Visit the next page for a setup guide](./linting/TYPED_LINTING.md 'Visit the next page for a typed rules setup guide'). +We provide a plethora of powerful rules that utilize the power of TypeScript's type information. [Visit the next page for a setup guide](./linting/Typed_Linting.md 'Visit the next page for a typed rules setup guide'). -If you're having problems getting this working, please have a look at our [Troubleshooting & FAQs](./linting/TROUBLESHOOTING.md). +If you're having problems getting this working, please have a look at our [Troubleshooting & FAQs](./linting/Troubleshooting.md). diff --git a/docs/MAINTENANCE.md b/docs/MAINTENANCE.md new file mode 100644 index 00000000000..75f1030c015 --- /dev/null +++ b/docs/MAINTENANCE.md @@ -0,0 +1,12 @@ +--- +id: maintenance +sidebar_label: Maintenance Guide +title: Maintenance Guide +--- + +This is the maintainers guide to working on typescript-eslint. +It's intended for use by contributors who have been given access to at least triage issues and pull requests. +We keep it in the open for visibility into our processes. + +> If you're reading this as a new maintainer: welcome! +> We're happy to have you! ❤️‍🔥 diff --git a/docs/architecture/ESLint_Plugin.mdx b/docs/architecture/ESLint_Plugin.mdx new file mode 100644 index 00000000000..eca60141555 --- /dev/null +++ b/docs/architecture/ESLint_Plugin.mdx @@ -0,0 +1,22 @@ +--- +id: eslint-plugin +sidebar_label: eslint-plugin +--- + +# `@typescript-eslint/eslint-plugin` + +> The TypeScript plugin for ESLint. ✨ + +:::info +See [Getting Started](../Getting_Started.md) for documentation on how to lint your TypeScript code with ESLint. +::: + +`@typescript-eslint/eslint-plugin` is an ESLint plugin used to load in custom rules and rule configurations lists from typescript-eslint. +Those rules rely on [`@typescript-eslint/parser`](./Parser.mdx) to parse TypeScript code into ESLint-compatible nodes, as well as provide backing TypeScript programs. + +## Exports + +| Name | Description | +| --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `configs` | Object mapping string names of configs to extendable [ESLint config settings](https://eslint.org/docs/latest/user-guide/configuring/configuration-files#extending-configuration-files). | +| `rules` | Object mapping string names of rules to the [rule objects](https://eslint.org/docs/latest/developer-guide/working-with-rules). | diff --git a/docs/architecture/ESLint_Plugin_TSLint.mdx b/docs/architecture/ESLint_Plugin_TSLint.mdx new file mode 100644 index 00000000000..582d93aab8e --- /dev/null +++ b/docs/architecture/ESLint_Plugin_TSLint.mdx @@ -0,0 +1,51 @@ +--- +id: eslint-plugin-tslint +sidebar_label: eslint-plugin-tslint +--- + +# `@typescript-eslint/eslint-plugin-tslint` + +> ESLint plugin that allows running TSLint rules within ESLint to help you migrate from TSLint to ESLint. ✨ + +:::caution +Per [What About TSLint?](../linting/troubleshooting/TSLint.md), we highly recommend migrating off TSLint. +See [Getting Started](../Getting_Started.md) for documentation on how to lint your TypeScript code with ESLint. +::: + +## Installation + +```sh +yarn add -D @typescript-eslint/eslint-plugin-tslint +``` + +## Usage + +Configure in your ESLint config file: + +```js +{ + "plugins": [ + "@typescript-eslint/tslint" + ], + "parserOptions": { + "project": "tsconfig.json", + }, + "rules": { + "@typescript-eslint/tslint/config": ["warn", { + "lintFile": "", // path to tslint.json of your project + "rules": { + // tslint rules (will be used if `lintFile` is not specified) + }, + "rulesDirectory": [ + // array of paths to directories with rules, e.g. 'node_modules/tslint/lib/rules' (will be used if `lintFile` is not specified) + ] + }], + } +} +``` + +**Note:** The ability to automatically fix problems with `--fix` is unavailable for TSLint rules loaded with this plugin. + +## Rules + +This plugin contains only a single rule: `@typescript-eslint/tslint/config`. diff --git a/docs/architecture/Parser.mdx b/docs/architecture/Parser.mdx new file mode 100644 index 00000000000..9f5d51a53bb --- /dev/null +++ b/docs/architecture/Parser.mdx @@ -0,0 +1,260 @@ +--- +id: parser +sidebar_label: parser +--- + +# `@typescript-eslint/parser` + +> An [ESLint parser](https://eslint.org/docs/user-guide/configuring/plugins#specifying-parser) used to parse TypeScript code into ESLint-compatible nodes, as well as provide backing TypeScript programs. ✨ + +This is necessary because TypeScript produces a different, incompatible AST format to the one that ESLint requires to work. +For example, this is not valid JavaScript code because it contains the `: number` type annotation: + +```ts +let x: number = 1; +``` + +ESLint's native Espree parser would raise an error attempting to parse it. + +Additionally, because TypeScript is developed separately and with different goals from ESLint, ESTree, and Espree, its AST also represents nodes differently in many cases. +TS's AST is optimized for its use case of parsing incomplete code and typechecking. +ESTree is unoptimized and intended for "general purpose" use-cases of traversing the AST. + +:::tip +You can select `@typescript-eslint/parser` on the [typescript-eslint playground](https://typescript-eslint.io/play#showAST=es)'s left sidebar under _Options_ > _AST Explorer_ by selecting _ESTree_. +::: + +## Configuration + +The following additional configuration options are available by specifying them in [`parserOptions`](https://eslint.org/docs/user-guide/configuring/language-options#specifying-parser-options) in your ESLint configuration file. + +```ts +interface ParserOptions { + ecmaFeatures?: { + jsx?: boolean; + globalReturn?: boolean; + }; + ecmaVersion?: number | 'latest'; + emitDecoratorMetadata?: boolean; + extraFileExtensions?: string[]; + jsxFragmentName?: string | null; + jsxPragma?: string | null; + lib?: string[]; + moduleResolver?: string; + program?: import('typescript').Program; + project?: string | string[]; + projectFolderIgnoreList?: string[]; + tsconfigRootDir?: string; + warnOnUnsupportedTypeScriptVersion?: boolean; +} +``` + +### `ecmaFeatures` + +Optional additional options to describe how to parse the raw syntax. + +#### `jsx` + +> 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). + +**NOTE:** this setting does not affect known file types (`.js`, `.mjs`, `.cjs`, `.jsx`, `.ts`, `.mts`, `.cts`, `.tsx`, `.json`) because the TypeScript compiler has its own internal handling for known file extensions. + + + +The exact behavior is as follows: + +- `.js`, `.mjs`, `.cjs`, `.jsx`, `.tsx` files are always parsed as if this is `true`. +- `.ts`, `.mts`, `.cts` files are always parsed as if this is `false`. +- For "unknown" extensions (`.md`, `.vue`): + - If `parserOptions.project` is _not_ provided: + - The setting will be respected. + - If `parserOptions.project` is provided (i.e. you are using rules with type information): + - **always parsed as if this is `false`** + +#### `globalReturn` + +> Default `false`. + +This options allows you to tell the parser if you want to allow global `return` statements in your codebase. + +### `ecmaVersion` + +> Default `2018`. + +Accepts any valid ECMAScript version number or `'latest'`: + +- A version: es3, es5, es6, es7, es8, es9, es10, es11, es12, es13, ..., or +- A year: es2015, es2016, es2017, es2018, es2019, es2020, es2021, es2022, ..., or +- `'latest'` + +When it's a version or a year, the value **must** be a number - so do not include the `es` prefix. + +Specifies the version of ECMAScript syntax you want to use. This is used by the parser to determine how to perform scope analysis, and it affects the default + +### `emitDecoratorMetadata` + +> Default `undefined`. + +This option allow you to tell parser to act as if `emitDecoratorMetadata: true` is set in `tsconfig.json`, but without [type-aware linting](https://typescript-eslint.io/linting/typed-linting). In other words, you don't have to specify `parserOptions.project` in this case, making the linting process faster. + +### `extraFileExtensions` + +> 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']`. +Add extensions starting with `.`, followed by the file extension. E.g. for a `.vue` file use `"extraFileExtensions": [".vue"]`. + +### `jsxFragmentName` + +> 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`. +This should not be a member expression - just the root identifier (i.e. use `"h"` instead of `"h.Fragment"`). + +If you provide `parserOptions.project`, you do not need to set this, as it will automatically detected from the compiler. + +### `jsxPragma` + +> 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`. + +This should not be a member expression - just the root identifier (i.e. use `"React"` instead of `"React.createElement"`). + +If you provide `parserOptions.project`, you do not need to set this, as it will automatically detected from the compiler. + +### `lib` + +> Default `['es2018']` + +For valid options, see the [TypeScript compiler options](https://www.typescriptlang.org/tsconfig#lib). + +Specifies the TypeScript `lib`s that are available. This is used by the scope analyser to ensure there are global variables declared for the types exposed by TypeScript. + +If you provide `parserOptions.project`, you do not need to set this, as it will automatically detected from the compiler. + +### `moduleResolver` + +> Default `undefined`. + +This option allows you to provide a custom module resolution. The value should point to a JS file that default exports (`export default`, or `module.exports =`, or `export =`) a file with the following interface: + +```ts +interface ModuleResolver { + version: 1; + resolveModuleNames( + moduleNames: string[], + containingFile: string, + reusedNames: string[] | undefined, + redirectedReference: ts.ResolvedProjectReference | undefined, + options: ts.CompilerOptions, + ): (ts.ResolvedModule | undefined)[]; +} +``` + +### `program` + +> Default `undefined`. + +This option allows you to programmatically provide an instance of a TypeScript Program object that will provide type information to rules. +This will override any programs that would have been computed from `parserOptions.project` or `parserOptions.createDefaultProgram`. +All linted files must be part of the provided program(s). + +[Refer to the TypeScript Wiki for an example on how to write the `resolveModuleNames` function](https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#customizing-module-resolution). + +### `project` + +> Default `undefined`. + +This option allows you to provide a path to your project's `tsconfig.json`. **This setting is required if you want to use rules which require type information**. Relative paths are interpreted relative to the current working directory if `tsconfigRootDir` is not set. If you intend on running ESLint from directories other than the project root, you should consider using `tsconfigRootDir`. + +- Accepted values: + + ```js + // path + project: './tsconfig.json'; + + // glob pattern + project: './packages/**/tsconfig.json'; + + // array of paths and/or glob patterns + project: ['./packages/**/tsconfig.json', './separate-package/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. + +- Note that using wide globs `**` in your `parserOptions.project` may cause performance implications. Instead of globs that use `**` to recursively check all folders, prefer paths that use a single `*` at a time. For more info see [#2611](https://github.com/typescript-eslint/typescript-eslint/issues/2611). + +- TypeScript will ignore files with duplicate filenames in the same folder (for example, `src/file.ts` and `src/file.js`). TypeScript purposely ignore all but one of the files, only keeping the one file with the highest priority extension (the extension priority order (from highest to lowest) is `.ts`, `.tsx`, `.d.ts`, `.js`, `.jsx`). For more info see #955. + +- Note that if this setting is specified and `createDefaultProgram` is not, you must only lint files that are included in the projects as defined by the provided `tsconfig.json` files. If your existing configuration does not include all of the files you would like to lint, you can create a separate `tsconfig.eslint.json` as follows: + + ```jsonc + { + // extend your base config so you don't have to redefine your compilerOptions + "extends": "./tsconfig.json", + "include": [ + "src/**/*.ts", + "test/**/*.ts", + "typings/**/*.ts", + // etc + + // if you have a mixed JS/TS codebase, don't forget to include your JS files + "src/**/*.js" + ] + } + ``` + +### `projectFolderIgnoreList` + +> 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. + +It accepts an array of globs to exclude from the `project` globs. + +For example, by default it will ensure that a glob like `./**/tsconfig.json` will not match any `tsconfig`s within your `node_modules` folder (some npm packages do not exclude their source files from their published packages). + +### `tsconfigRootDir` + +> Default `undefined`. + +This option allows you to provide the root directory for relative tsconfig paths specified in the `project` option above. + +### `warnOnUnsupportedTypeScriptVersion` + +> 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 + +## Utilities + +### `createProgram(configFile, projectDirectory)` + +This serves as a utility method for users of the `parserOptions.programs` feature to create a TypeScript program instance from a config file. + +```ts +declare function createProgram( + configFile: string, + projectDirectory?: string, +): import('typescript').Program; +``` + +Example usage: + +```js title=".eslintrc.js" +const parser = require('@typescript-eslint/parser'); + +module.exports = { + parserOptions: { + programs: [parser.createProgram('tsconfig.json')], + }, +}; +``` diff --git a/docs/architecture/Scope_Manager.mdx b/docs/architecture/Scope_Manager.mdx new file mode 100644 index 00000000000..af7bd6e27c5 --- /dev/null +++ b/docs/architecture/Scope_Manager.mdx @@ -0,0 +1,104 @@ +--- +id: scope-manager +sidebar_label: scope-manager +--- + +# `@typescript-eslint/scope-manager` + +> A fork of [`eslint-scope`](https://github.com/eslint/eslint-scope), enhanced to support TypeScript functionality. ✨ + +A "scope analyser" traverses an AST and builds a model of how variables (and in our case, types) are defined and consumed by the source code. +This form of static analysis allows you to understand and trace variables throughout the program, allowing you to access powerful information about a program without needing to drop into the much, much heavier type information. + +## API + +### `analyze(tree, options)` + +Analyses a given AST and returns the resulting `ScopeManager`. + +```ts +interface AnalyzeOptions { + /** + * Known visitor keys. + */ + childVisitorKeys?: Record | null; + + /** + * Which ECMAScript version is considered. + * Defaults to `2018`. + * `'latest'` is converted to 1e8 at parser. + */ + ecmaVersion?: EcmaVersion | 1e8; + + /** + * Whether the whole script is executed under node.js environment. + * When enabled, the scope manager adds a function scope immediately following the global scope. + * Defaults to `false`. + */ + globalReturn?: boolean; + + /** + * Implied strict mode (if ecmaVersion >= 5). + * Defaults to `false`. + */ + impliedStrict?: boolean; + + /** + * The identifier that's used for JSX Element creation (after transpilation). + * This should not be a member expression - just the root identifier (i.e. use "React" instead of "React.createElement"). + * Defaults to `"React"`. + */ + jsxPragma?: string; + + /** + * The identifier that's used for JSX fragment elements (after transpilation). + * If `null`, assumes transpilation will always use a member on `jsxFactory` (i.e. React.Fragment). + * This should not be a member expression - just the root identifier (i.e. use "h" instead of "h.Fragment"). + * Defaults to `null`. + */ + jsxFragmentName?: string | null; + + /** + * The lib used by the project. + * This automatically defines a type variable for any types provided by the configured TS libs. + * For more information, see https://www.typescriptlang.org/tsconfig#lib + * + * Defaults to the lib for the provided `ecmaVersion`. + */ + lib?: Lib[]; + + /** + * The source type of the script. + */ + sourceType?: 'script' | 'module'; + + /** + * Emit design-type metadata for decorated declarations in source. + * Defaults to `false`. + */ + emitDecoratorMetadata?: boolean; +} +``` + +Example usage: + +```ts +import { analyze } from '@typescript-eslint/scope-manager'; +import { parse } from '@typescript-eslint/typescript-estree'; + +const code = `const hello: string = 'world';`; +const ast = parse(code, { + // note that scope-manager requires ranges on the AST + range: true, +}); +const scope = analyze(ast, { + ecmaVersion: 2020, + sourceType: 'module', +}); +``` + +## References + +- [You can view the original BSD 2 license for the code here](https://github.com/eslint/eslint-scope/blob/dbddf14d5771b21b5da704213e4508c660ca1c64/LICENSE) +- https://eslint.org/docs/developer-guide/scope-manager-interface +- https://github.com/eslint/eslint-scope diff --git a/docs/architecture/TypeScript-ESTree.mdx b/docs/architecture/TypeScript-ESTree.mdx new file mode 100644 index 00000000000..066030b0afe --- /dev/null +++ b/docs/architecture/TypeScript-ESTree.mdx @@ -0,0 +1,348 @@ +--- +id: typescript-estree +sidebar_label: typescript-estree +--- + +# `@typescript-eslint/typescript-estree` + +> The underlying code used by [`@typescript-eslint/parser`](./Parser.mdx) that converts TypeScript source code into an ESTree-compatible form. ✨ + +This parser is designed to be generic and robust. +It can be used to power any use-case which requires taking TypeScript source code and producing an ESTree-compatible AST. + +It is most known for use within these hyper-popular open-source projects to power their TypeScript support: + +- [ESLint](https://eslint.org), the pluggable linting utility for JavaScript and JSX +- [Prettier](https://prettier.io), an opinionated code formatter + +It works by: + +1. Invoking the TypeScript compiler on the given source code in order to + produce a TypeScript AST +2. Converting that TypeScript AST into an ESTree AST + +## API + +### Parsing + +#### `parse(code, options)` + +Parses the given string of code with the options provided and returns an ESTree-compatible AST. + +```ts +interface ParseOptions { + /** + * create a top-level comments array containing all comments + */ + comment?: boolean; + + /** + * An array of modules to turn explicit debugging on for. + * - 'typescript-eslint' is the same as setting the env var `DEBUG=typescript-eslint:*` + * - 'eslint' is the same as setting the env var `DEBUG=eslint:*` + * - 'typescript' is the same as setting `extendedDiagnostics: true` in your tsconfig compilerOptions + * + * For convenience, also supports a boolean: + * - true === ['typescript-eslint'] + * - false === [] + */ + debugLevel?: boolean | ('typescript-eslint' | 'eslint' | 'typescript')[]; + + /** + * Cause the parser to error if it encounters an unknown AST node type (useful for testing). + * This case only usually occurs when TypeScript releases new features. + */ + errorOnUnknownASTType?: boolean; + + /** + * Absolute (or relative to `cwd`) path to the file being parsed. + */ + filePath?: string; + + /** + * Enable parsing of JSX. + * For more details, see https://www.typescriptlang.org/docs/handbook/jsx.html + * + * NOTE: this setting does not effect known file types (.js, .cjs, .mjs, .jsx, .ts, .mts, .cts, .tsx, .json) because the + * TypeScript compiler has its own internal handling for known file extensions. + * + * For the exact behavior, see https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/parser#parseroptionsecmafeaturesjsx + */ + jsx?: boolean; + + /** + * Controls whether the `loc` information to each node. + * The `loc` property is an object which contains the exact line/column the node starts/ends on. + * This is similar to the `range` property, except it is line/column relative. + */ + loc?: boolean; + + /* + * Allows overriding of function used for logging. + * When value is `false`, no logging will occur. + * When value is not provided, `console.log()` will be used. + */ + loggerFn?: Function | false; + + /** + * Controls whether the `range` property is included on AST nodes. + * The `range` property is a [number, number] which indicates the start/end index of the node in the file contents. + * This is similar to the `loc` property, except this is the absolute index. + */ + range?: boolean; + + /** + * Set to true to create a top-level array containing all tokens from the file. + */ + tokens?: boolean; +} + +const PARSE_DEFAULT_OPTIONS: ParseOptions = { + comment: false, + errorOnUnknownASTType: false, + filePath: 'estree.ts', // or 'estree.tsx', if you pass jsx: true + jsx: false, + loc: false, + loggerFn: undefined, + range: false, + tokens: false, +}; + +declare function parse( + code: string, + options: ParseOptions = PARSE_DEFAULT_OPTIONS, +): TSESTree.Program; +``` + +Example usage: + +```js +import { parse } from '@typescript-eslint/typescript-estree'; + +const code = `const hello: string = 'world';`; +const ast = parse(code, { + loc: true, + range: true, +}); +``` + +#### `parseAndGenerateServices(code, options)` + +Parses the given string of code with the options provided and returns an ESTree-compatible AST. Accepts additional options which can be used to generate type information along with the AST. + +```ts +interface ParseAndGenerateServicesOptions extends ParseOptions { + /** + * Causes the parser to error if the TypeScript compiler returns any unexpected syntax/semantic errors. + */ + errorOnTypeScriptSyntacticAndSemanticIssues?: boolean; + + /** + * ***EXPERIMENTAL FLAG*** - Use this at your own risk. + * + * Causes TS to use the source files for referenced projects instead of the compiled .d.ts files. + * This feature is not yet optimized, and is likely to cause OOMs for medium to large projects. + * + * This flag REQUIRES at least TS v3.9, otherwise it does nothing. + * + * See: https://github.com/typescript-eslint/typescript-eslint/issues/2094 + */ + EXPERIMENTAL_useSourceOfProjectReferenceRedirect?: boolean; + + /** + * When `project` is provided, this controls the non-standard file extensions which will be parsed. + * It accepts an array of file extensions, each preceded by a `.`. + */ + extraFileExtensions?: string[]; + + /** + * Absolute (or relative to `tsconfigRootDir`) path to the file being parsed. + * When `project` is provided, this is required, as it is used to fetch the file from the TypeScript compiler's cache. + */ + filePath?: string; + + /** + * Allows the user to control whether or not two-way AST node maps are preserved + * during the AST conversion process. + * + * By default: the AST node maps are NOT preserved, unless `project` has been specified, + * in which case the maps are made available on the returned `parserServices`. + * + * NOTE: If `preserveNodeMaps` is explicitly set by the user, it will be respected, + * regardless of whether or not `project` is in use. + */ + preserveNodeMaps?: boolean; + + /** + * Absolute (or relative to `tsconfigRootDir`) paths to the tsconfig(s). + * If this is provided, type information will be returned. + */ + project?: string | string[]; + + /** + * If you provide a glob (or globs) to the project option, you can use this option to ignore certain folders from + * being matched by the globs. + * This accepts an array of globs to ignore. + * + * By default, this is set to ["/node_modules/"] + */ + projectFolderIgnoreList?: string[]; + + /** + * The absolute path to the root directory for all provided `project`s. + */ + tsconfigRootDir?: string; + + /** + * An array of one or more instances of TypeScript Program objects to be used for type information. + * This overrides any program or programs that would have been computed from the `project` option. + * All linted files must be part of the provided program(s). + */ + programs?: Program[]; + + /** + *************************************************************************************** + * IT IS RECOMMENDED THAT YOU DO NOT USE THIS OPTION, AS IT CAUSES PERFORMANCE ISSUES. * + *************************************************************************************** + * + * When passed with `project`, this allows the parser to create a catch-all, default program. + * This means that if the parser encounters a file not included in any of the provided `project`s, + * it will not error, but will instead parse the file and its dependencies in a new program. + */ + createDefaultProgram?: boolean; + + /** + * ESLint (and therefore typescript-eslint) is used in both "single run"/one-time contexts, + * such as an ESLint CLI invocation, and long-running sessions (such as continuous feedback + * on a file in an IDE). + * + * When typescript-eslint handles TypeScript Program management behind the scenes, this distinction + * is important because there is significant overhead to managing the so called Watch Programs + * needed for the long-running use-case. + * + * When allowAutomaticSingleRunInference is enabled, we will use common heuristics to infer + * whether or not ESLint is being used as part of a single run. + */ + allowAutomaticSingleRunInference?: boolean; + + /** + * Path to a file exporting a custom ModuleResolver. + */ + moduleResolver?: string; +} + +interface ParserServices { + program: ts.Program; + esTreeNodeToTSNodeMap: WeakMap; + tsNodeToESTreeNodeMap: WeakMap; + hasFullTypeInformation: boolean; +} + +interface ParseAndGenerateServicesResult { + ast: TSESTree.Program; + services: ParserServices; +} + +const PARSE_AND_GENERATE_SERVICES_DEFAULT_OPTIONS: ParseOptions = { + ...PARSE_DEFAULT_OPTIONS, + errorOnTypeScriptSyntacticAndSemanticIssues: false, + extraFileExtensions: [], + preserveNodeMaps: false, // or true, if you do not set this, but pass `project` + project: undefined, + projectFolderIgnoreList: ['/node_modules/'], + tsconfigRootDir: process.cwd(), +}; + +declare function parseAndGenerateServices( + code: string, + options: ParseOptions = PARSE_DEFAULT_OPTIONS, +): ParseAndGenerateServicesResult; +``` + +Example usage: + +```js +import { parseAndGenerateServices } from '@typescript-eslint/typescript-estree'; + +const code = `const hello: string = 'world';`; +const { ast, services } = parseAndGenerateServices(code, { + filePath: '/some/path/to/file/foo.ts', + loc: true, + project: './tsconfig.json', + range: true, +}); +``` + +#### `parseWithNodeMaps(code, options)` + +Parses the given string of code with the options provided and returns both the ESTree-compatible AST as well as the node maps. +This allows you to work with both ASTs without the overhead of types that may come with `parseAndGenerateServices`. + +```ts +interface ParseWithNodeMapsResult { + ast: TSESTree.Program; + esTreeNodeToTSNodeMap: ParserServices['esTreeNodeToTSNodeMap']; + tsNodeToESTreeNodeMap: ParserServices['tsNodeToESTreeNodeMap']; +} + +declare function parseWithNodeMaps( + code: string, + options: ParseOptions = PARSE_DEFAULT_OPTIONS, +): ParseWithNodeMapsResult; +``` + +Example usage: + +```js +import { parseWithNodeMaps } from '@typescript-eslint/typescript-estree'; + +const code = `const hello: string = 'world';`; +const { ast, esTreeNodeToTSNodeMap, tsNodeToESTreeNodeMap } = parseWithNodeMaps( + code, + { + loc: true, + range: true, + }, +); +``` + +### `TSESTree`, `AST_NODE_TYPES` and `AST_TOKEN_TYPES` + +Types for the AST produced by the parse functions. + +- `TSESTree` is a namespace which contains object types representing all of the AST Nodes produced by the parser. +- `AST_NODE_TYPES` is an enum which provides the values for every single AST node's `type` property. +- `AST_TOKEN_TYPES` is an enum which provides the values for every single AST token's `type` property. + +### Utilities + +#### `createProgram(configFile, projectDirectory)` + +This serves as a utility method for users of the `ParseOptions.programs` feature to create a TypeScript program instance from a config file. + +```ts +declare function createProgram( + configFile: string, + projectDirectory: string = process.cwd(), +): import('typescript').Program; +``` + +Example usage: + +```js +const tsESTree = require('@typescript-eslint/typescript-estree'); + +const program = tsESTree.createProgram('tsconfig.json'); +const code = `const hello: string = 'world';`; +const { ast, services } = parseAndGenerateServices(code, { + filePath: '/some/path/to/file/foo.ts', + loc: true, + program, + range: true, +}); +``` + +## Debugging + +If you encounter a bug with the parser that you want to investigate, you can turn on the debug logging via setting the environment variable: `DEBUG=typescript-eslint:*`. +I.e. in this repo you can run: `DEBUG=typescript-eslint:* yarn lint`. diff --git a/docs/architecture/Utils.mdx b/docs/architecture/Utils.mdx new file mode 100644 index 00000000000..9270f2ed8e5 --- /dev/null +++ b/docs/architecture/Utils.mdx @@ -0,0 +1,28 @@ +--- +id: utils +sidebar_label: utils +--- + +# `@typescript-eslint/utils` + +> Utilities for working with TypeScript + ESLint together. ✨ + +This package contains public utilities for writing custom rules and plugins in TypeScript. +Rules declared in [`@typescript-eslint/eslint-plugin`](https://typescript-eslint.io/architecture/eslint-plugin) are created using these utility functions. +Any custom rules you write generally will be as well. + +> See [Custom Rules](https://typescript-eslint.io/custom-rules) for documentation on creating your own custom ESLint rules for TypeScript code. + +## Exports + +| Name | Description | +| ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `AST_NODE_TYPES` | An enum with the names of every single _node_ found in `TSESTree`. | +| `AST_TOKEN_TYPES` | An enum with the names of every single _token_ found in `TSESTree`. | +| `ASTUtils` | Tools for operating on the ESTree AST. Also includes the [`eslint-utils`](https://www.npmjs.com/package/eslint-utils) package, correctly typed to work with the types found in `TSESTree` | +| `ESLintUtils` | Tools for creating ESLint rules with TypeScript. | +| `JSONSchema` | Types from the [`@types/json-schema`](https://www.npmjs.com/package/@types/json-schema) package, re-exported to save you having to manually import them. Also ensures you're using the same version of the types as this package. | +| `ParserServices` | Typing for the parser services provided when parsing a file using `@typescript-eslint/typescript-estree`. | +| `TSESLint` | Types for ESLint, correctly typed to work with the types found in `TSESTree`. | +| `TSESLintScope` | The [`eslint-scope`](https://www.npmjs.com/package/eslint-scope) package, correctly typed to work with the types found in both `TSESTree` and `TSESLint` | +| `TSESTree` | Types for the TypeScript flavor of ESTree created by `@typescript-eslint/typescript-estree`. | diff --git a/docs/contributing/Issues.mdx b/docs/contributing/Issues.mdx new file mode 100644 index 00000000000..ae61dd0e312 --- /dev/null +++ b/docs/contributing/Issues.mdx @@ -0,0 +1,36 @@ +--- +id: issues +title: Issues +--- + +So you've got a bug report, documentation request, or feature suggestion? +Great! + +Please do: + +- Make sure you're using the [latest version of our packages](https://github.com/typescript-eslint/typescript-eslint/releases) +- Search [all opened and closed issues](https://github.com/typescript-eslint/typescript-eslint/issues?q=is%3Aissue+) to make sure your issue wouldn't be a duplicate +- Fill out the [appropriate issue template](https://github.com/typescript-eslint/typescript-eslint/issues/new/choose) completely +- Provide as much information as you can + +## Commenting + +Please do comment on any open issue if you have more information that would be useful. + +Please don't: + +- Leave useless comments such as _"+1"_ or _"when's this getting fixed?"_ that only act as spam + - If you have nothing to add but enthusiasm and joy, add a reaction such as 👍 +- Bring up unrelated topics in existing issues: instead, file a new issue +- Comment on closed PRs: instead, [file a new issue](#raising-issues) +- Comment on commits directly, as those comments are not searchable: instead, file a new issue + +## Questions and Support Requests + +We do not have the bandwidth to handle questions or support requests in the issue tracker. +You can instead: + +- Ask a question on [StackOverflow](https://stackoverflow.com/questions/tagged/typescript-eslint 'StackOverflow questions tagged with typescript-eslint') using the `typescript-eslint` tag +- Publicly tweet [@tseslint on Twitter](https://twitter.com/tseslint) + +> Note that requests to add documentation _are_ allowed, even encouraged! 📝 diff --git a/docs/contributing/Local_Development.mdx b/docs/contributing/Local_Development.mdx new file mode 100644 index 00000000000..3f85bd9c90b --- /dev/null +++ b/docs/contributing/Local_Development.mdx @@ -0,0 +1,82 @@ +--- +id: local-development +title: Local Development +--- + +Thank you for your interest in developing on typescript-eslint! ❤️‍🔥 + +> See [Contributing](../Contributing.mdx) and [Issues](./Issues.mdx) for details on our general contribution flows. + +## Setup + +After [forking the repo from GitHub](https://help.github.com/articles/fork-a-repo) and [installing Yarn classic](https://classic.yarnpkg.com): + +```shell +git clone https://github.com//typescript-eslint +cd typescript-eslint +yarn +``` + +Postinstall scripts will then fully build your repository locally with (`yarn build`). +At this point, you're ready to develop! 🚀 + +## Builds + +You can run `yarn build` in the root to build all packages, or in any package to build just that package. + +Keep in mind that packages generally depend on each other's built outputs, and you'll need to `yarn build` dependents for their consumers to receive any new local changes. +For example, if you make a change within `scope-manager` and want to use it in `eslint-plugin`, you'll need to `yarn build` either from the root or within `packages/scope-manager`. + +## Validating Changes + +The following checks are all run on pull requests automatically. +You can also perform them locally. + +> See [Contributing > Pull Requests](../Contributing.mdx#raising-a-pr) for more information on pull requests. + +### Formatting + +We use [Prettier](https://prettier.io) to auto-format code. +A Git pre-commit hook should apply it to all committed changes. +ALternately, you can run `yarn format` in any package or in the root. + +### Linting + +All code changes must pass ESLint. +You can run `yarn lint` in any package or in the root. + +### Proofreading + +Changes must pass two linters for documentation and naming, the commands for which may be run from the root: + +- `yarn check-spelling`: [CSpell](https://cspell.org), for all code +- `yarn lint-markdown`: [Markdownlint](https://github.com/DavidAnson/markdownlint), for Markdown documentation + +### Tests + +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. + +#### Code Coverage + +We aim for 100% code coverage in all PRs when possible, except in the `website/` package. +Coverage reports are be generated locally whenever `yarn test` is run. + +The `codecov` bot should also comment on your PR with the percentage, as well as links to the line-by-line coverage of each file touched by your PR. + +### Type Checking + +All code should pass TypeScript type checking. +You can run `yarn typecheck` in any package or in the root to run `tsc`. + +> Run `yarn typecheck -w` to start `tsc` in watch mode. + +## Website Development + +Our interactive documentation website is built with [Docusaurus](https://docusaurus.io). +Running `yarn start` from either the root or `packages/website` will start a local dev server on `localhost:3000`. + +> The `website` package relies on other packages being built. +> We recommend running `yarn build` from the root before `yarn start`. diff --git a/docs/contributing/Pull_Requests.mdx b/docs/contributing/Pull_Requests.mdx new file mode 100644 index 00000000000..edb76feb7d6 --- /dev/null +++ b/docs/contributing/Pull_Requests.mdx @@ -0,0 +1,76 @@ +--- +id: pull-requests +title: Pull Requests +--- + +> See [Local Development](./Local_Development.mdx) for details on how to get started developing locally. + +So you've got changes locally that address an issue? +Fantastic! + +Please do: + +- Only send pull requests that resolve [open issues marked as `accepting prs`](https://github.com/typescript-eslint/typescript-eslint/issues?q=is%3Aissue+is%3Aopen+label%3A%22accepting+prs%22) + - One exception: extremely minor documentation typos +- Fill out the pull request template in full +- Validate your changes per [Development > Validating Changes](./Local_Development.mdx#validating-changes) before un-[drafting your PR](https://github.blog/2019-02-14-introducing-draft-pull-requests) + +Please don't: + +- Force push after opening a PR + - Reasoning: GitHub is not able to track changes across force pushes, which makes it take longer for us to perform incremental reviews +- Comment asking for updates + - Reasoning: Your PR hasn't been forgotten! The volunteer maintainers have limited time to work on the project, and they will get to it as soon as they are able. + +### Raising a PR + +Once your changes are ready, you can raise a PR! 🙌 +The title of your PR should match the following format: + +```text +(): +``` + +You can find more samples of good past PR titles in [recent commits to `main`](https://github.com/typescript-eslint/typescript-eslint/commits/main): + +- `fix(scope-manager): correct handling for class static blocks` +- `docs: Fix links to getting started in README.md` + +Within the body of your PR, make sure you reference the issue that you have worked on, as well as pointing out anything of note you wish us to look at during our review. + +> We do not care about the number, or style of commits in your history, because we squash merge every PR into `main`. +> Feel free to commit in whatever style you feel comfortable with. + +> Tip: Send the PR from a branch other than `main`. +> See GitHub's [Proposing Changes docs](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests) for more information. + +#### type + +Must be one of the following: + + + +- `docs` - if you only change documentation, and not shipped code +- `feat` - for any new functionality additions +- `fix` - for any bug fixes that don't add new functionality +- `test` - if you only change tests, and not shipped code +- `chore` - anything else + +#### package + +The name of the package you have made changes within, (e.g. `eslint-plugin`, `parser`, `typescript-estree`). +If you make significant changes across multiple packages, you can omit this (e.g. +`feat: foo bar`). + +#### short description + +A succinct title for the PR. + +### Addressing Feedback and Beyond + +With your PR raised and the CI passing, your PR will [wait in the queue to be reviewed](https://github.com/typescript-eslint/typescript-eslint/pulls?q=is%3Apr+is%3Aopen+sort%3Acreated-asc+-label%3A%22breaking+change%22+-label%3A%22awaiting+response%22+-label%3A%221+approval%22+-label%3A%22DO+NOT+MERGE%22+status%3Asuccess). +We generally review PRs oldest to newest, unless we consider a newer PR higher priority (e.g. if it's a bug fix). + +Once we have reviewed your PR, we will provide any feedback that needs addressing. +If you feel a requested change is wrong, don't be afraid to discuss with us in the comments. +Once the feedback is addressed, and the PR is reviewed, we'll ensure the branch is up to date with `main`, and merge it for you. diff --git a/docs/development/architecture/ASTS.md b/docs/development/architecture/ASTS.md deleted file mode 100644 index 26164c8174e..00000000000 --- a/docs/development/architecture/ASTS.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -id: asts -sidebar_label: ASTs ---- - -# Abstract Syntax Trees (ASTs) - -Parsers such as those in ESLint and TypeScript read in the text of source code and parse it into a standard format they can reason about known as an **Abstract Syntax Tree** (AST). -ASTs are called such because although they might contain information on the location of constructs within source code, they are an abstract representation that cares more about the semantic structure. - -For example, given this line of code: - -```js -1 + 2; -``` - -ESLint would natively understand it as an object like: - -```json -{ - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "left": { - "type": "Literal", - "value": 1, - "raw": "1" - }, - "operator": "+", - "right": { - "type": "Literal", - "value": 2, - "raw": "2" - } - } -} -``` - -ESLint uses an AST format known as **[`estree`]**. - -ESTree is more broadly used than just for ESLint -- it is the de facto community standard. -ESLint's built-in parser that outputs an `estree`-shaped AST is also a separate package, called **[`espree`]**. - -## AST Playground - -The [TypeScript ESLint playground](https://typescript-eslint.io/play#showAST=es) contains an AST explorer that generates an interactive AST for any code entered into the playground. -You can activate it under _Options_ > _AST Explorer_ on its left sidebar by selecting _ESTree_. - -:::note - -You can play more with various other ASTs on [astexplorer.net] and read more details on their [Wikipedia article](https://en.wikipedia.org/wiki/Abstract_syntax_tree). - -::: - -[astexplorer.net]: https://astexplorer.net -[`espree`]: https://github.com/eslint/espree -[`estree`]: https://github.com/estree/estree diff --git a/docs/development/architecture/PACKAGES.md b/docs/development/architecture/PACKAGES.md deleted file mode 100644 index f798e35b2e4..00000000000 --- a/docs/development/architecture/PACKAGES.md +++ /dev/null @@ -1,78 +0,0 @@ ---- -id: packages -title: Packages -sidebar_label: Packages ---- - -This page describes the top-level packages exported by the [typescript-eslint monorepo](https://github.com/typescript-eslint/typescript-eslint). -Each of these are published as npm packages under the `@typescript-eslint` organization. - -## `@typescript-eslint/eslint-plugin` - -[`@typescript-eslint/eslint-plugin`] is the core [ESLint plugin](https://eslint.org/docs/user-guide/configuring/plugins) used by consumers to load in custom rules and rule configurations lists from typescript-eslint. -Those rules rely on ESLint using the `@typescript-eslint/parser` package described below, and are generally built using the other packages on this page. - -## `@typescript-eslint/parser` - -[`@typescript-eslint/parser`] takes in ESLint configuration settings, reads in TypeScript source text, and produces an ESTree AST. -This is necessary because TypeScript produces a different, incompatible AST format to the one that ESLint requires to work. - -For example, this is not valid JavaScript code because it contains the `: number` type annotation: - -```ts -let x: number = 1; -``` - -ESLint's native Espree parser would raise an error attempting to parse it. - -Additionally, because TypeScript is developed separately and with different goals from ESLint, ESTree, and Espree, its AST also represents nodes differently in many cases. -TS's AST is optimized for its use case of parsing incomplete code and typechecking. -ESTree is unoptimized and intended for "general purpose" use-cases of traversing the AST. - -See more on configuring custom parsers with ESLint on [ESLint's User Guide > Configuring > Plugins](https://eslint.org/docs/user-guide/configuring/plugins#specifying-parser). - -:::tip -You can select `@typescript-eslint/parser` on the [TypeScript ESLint playground](https://typescript-eslint.io/play#showAST=es)'s left sidebar under _Options_ > _AST Explorer_ by selecting _ESTree_. -::: - -## `@typescript-eslint/typescript-estree` - -[`@typescript-eslint/typescript-estree`] is used by `@typescript-eslint/parser` to take TypeScript source code and produce the equivalent ESTree AST. -It works by: - -1. Invoking the TypeScript compiler on the given source code in order to - produce a TypeScript AST -2. Converting that TypeScript AST into an ESTree AST - -> Because [`@typescript-eslint/typescript-estree`] has a very specific purpose, it is reusable for tools with similar -> requirements to ESLint. -> It is therefore also used to power the amazing opinionated code formatter [Prettier](https://prettier.io)'s TypeScript support. - -## `@typescript-eslint/scope-manager` - -[`@typescript-eslint/scope-manager`] is a fork of [`eslint-scope`](https://github.com/eslint/eslint-scope), enhanced to support TypeScript functionality. - -A "scope analyser" traverses an AST and builds a model of how variables (and in our case, types) are defined and consumed by the source code. -This form of static analysis allows you to understand and trace variables throughout the program, allowing you to access powerful information about a program without needing to drop into the much, much heavier type information. - -## `@typescript-eslint/utils` - -[`@typescript-eslint/utils`] contains public utilities for writing custom rules and plugins in TypeScript. -Rules declared in `@typescript-eslint/eslint-plugin` are created using its utility functions. -Any custom rules you write generally will be as well. - -## `@typescript-eslint/eslint-plugin-tslint` - -[`@typescript-eslint/eslint-plugin-tslint`] is a separate ESLint plugin that allows running TSLint rules within ESLint to help you migrate from TSLint to ESLint. - -:::caution -**TSLint is deprecated.** It is in your best interest to migrate off it. See [Linting > Troubleshooting & FAQs > What About TSLint?](../../linting/troubleshooting/TSLINT.md). -::: - -[`@typescript-eslint/eslint-plugin-tslint`]: https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/eslint-plugin-tslint -[`@typescript-eslint/eslint-plugin`]: https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/eslint-plugin -[`@typescript-eslint/utils`]: https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/utils -[`@typescript-eslint/parser`]: https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/parser -[`@typescript-eslint/scope-manager`]: https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/scope-manager -[`@typescript-eslint/typescript-estree`]: https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/typescript-estree -[`@typescript-eslint/typescript-estree`]: https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/typescript-estree diff --git a/docs/linting/CONFIGURATIONS.md b/docs/linting/CONFIGURATIONS.md deleted file mode 100644 index de05a216ff8..00000000000 --- a/docs/linting/CONFIGURATIONS.md +++ /dev/null @@ -1,122 +0,0 @@ ---- -id: configs -title: Configurations ---- - -[ESLint shareable configurations](https://eslint.org/docs/latest/developer-guide/shareable-configs) exist to provide a comprehensive base config for you, with the intention that you add the config and it gives you an opinionated setup. - -## Built-In Configurations - -`@typescript-eslint/eslint-plugin` includes built-in configurations you can extend from to pull in the recommended starting rules. - -With the exception of `strict`, all configurations are considered "stable". -Rule additions and removals are treated as breaking changes and will only be done in major version bumps. - -:::note -We recommend most packages extend from [`recommended-requiring-type-checking`](#recommended-requiring-type-checking) (which requires [typed linting](./TYPED_LINTING.md)). -::: - -### `eslint-recommended` - -This ruleset is meant to be used after extending `eslint:recommended`. -It disables core ESLint rules that are already checked by the TypeScript compiler. -Additionally, it enables rules that promote using the more modern constructs TypeScript allows for. - -```jsonc -{ - "extends": [ - "eslint:recommended", - "plugin:@typescript-eslint/eslint-recommended" - ] -} -``` - -This config is automatically included if you use any of the other configurations mentioned on this page. - -### `recommended` - -Recommended rules for code correctness that you can drop in without additional configuration. -These rules are those whose reports are almost always for a bad practice and/or likely bug. -`recommended` also disables rules known to conflict with this repository, or cause issues in TypeScript codebases. - -```json -{ - "extends": ["plugin:@typescript-eslint/recommended"] -} -``` - -:::tip -We strongly recommend all TypeScript projects extend from this configuration. -::: - -### `recommended-requiring-type-checking` - -Additional recommended rules that require type information. -Rules in this configuration are similarly useful to those in `recommended`. - -```json -{ - "extends": [ - "plugin:@typescript-eslint/recommended", - "plugin:@typescript-eslint/recommended-requiring-type-checking" - ] -} -``` - -:::tip -We recommend all TypeScript projects extend from this configuration, with the caveat that rules using type information take longer to run. -See [Linting with Type Information](/docs/linting/typed-linting) for more details. -::: - -### `strict` - -Additional strict rules that can also catch bugs but are more opinionated than recommended rules. - -```json -{ - "extends": [ - "plugin:@typescript-eslint/recommended", - "plugin:@typescript-eslint/recommended-requiring-type-checking", - "plugin:@typescript-eslint/strict" - ] -} -``` - -:::tip -We recommend a TypeScript project extend from this configuration only if a nontrivial percentage of its developers are highly proficient in TypeScript. -::: - -## Overriding Configurations - -These configurations are our recommended starting points, but **you don't need to use them as-is**. -ESLint allows you to configure your own rule settings on top of any extended configurations. -See [ESLint's Configuring Rules docs](https://eslint.org/docs/user-guide/configuring/rules#using-configuration-files). - -### Suggesting Configuration Changes - -If you feel strongly that a specific rule should (or should not) be one of these configurations, please [file an issue](https://github.com/typescript-eslint/typescript-eslint/issues/new?assignees=&labels=package%3A+eslint-plugin%2Cpreset+config+change%2Ctriage&template=09-config-change.yaml&title=Configs%3A+%3Ca+short+description+of+my+proposal%3E) along with a **detailed** argument explaining your reasoning. - -## Prettier - -If you use [`prettier`](https://www.npmjs.com/package/prettier), there is also a helpful config to help ensure ESLint doesn't report on formatting issues that prettier will fix: [`eslint-config-prettier`](https://www.npmjs.com/package/eslint-config-prettier). - -Using this config by adding it to the end of your `extends`: - -```js title=".eslintrc.js" -module.exports = { - root: true, - parser: '@typescript-eslint/parser', - plugins: ['@typescript-eslint'], - extends: [ - 'eslint:recommended', - 'plugin:@typescript-eslint/recommended', - // Add this line - 'prettier', - ], -}; -``` - -:::warning -**We strongly recommend you use Prettier or an equivalent**, not ESLint formatting rules. -See [this issue](https://github.com/typescript-eslint/typescript-eslint/issues/4907 'Issue: Docs: Add our opinion on delegating stylistic issues to a tool such as Prettier #4907') for more information. -::: diff --git a/docs/linting/CONFIGURATIONS.mdx b/docs/linting/CONFIGURATIONS.mdx new file mode 100644 index 00000000000..a620083fa71 --- /dev/null +++ b/docs/linting/CONFIGURATIONS.mdx @@ -0,0 +1,141 @@ +--- +id: configs +title: Configurations +--- + +[ESLint shareable configurations](https://eslint.org/docs/latest/developer-guide/shareable-configs) exist to provide a comprehensive base config for you. +`@typescript-eslint/eslint-plugin` includes built-in configurations you can extend from to pull in the recommended starting rules. + +> With the exception of `strict`, all configurations are considered "stable". +> Rule additions and removals are treated as breaking changes and will only be done in major version bumps. + +## Recommended Configurations + +Most projects should extend from at least one of: + +- [`recommended`](#recommended): Recommended rules for code correctness that you can drop in without additional configuration. +- [`recommended-requiring-type-checking`](#recommended-requiring-type-checking): Additional recommended rules that require type information. +- [`strict`](#strict): Additional strict rules that can also catch bugs but are more opinionated than recommended rules. + +:::tip +We recommend most projects use [`recommended-requiring-type-checking`](#recommended-requiring-type-checking) (which requires [typed linting](./Typed_Linting.md)). +::: + +:::note +These configurations are our recommended starting points, but **you don't need to use them as-is**. +ESLint allows configuring own rule settings on top of extended configurations. +See [ESLint's Configuring Rules docs](https://eslint.org/docs/user-guide/configuring/rules#using-configuration-files). +::: + +### `recommended` + +Recommended rules for code correctness that you can drop in without additional configuration. +These rules are those whose reports are almost always for a bad practice and/or likely bug. +`recommended` also disables rules known to conflict with this repository, or cause issues in TypeScript codebases. + +```json +{ + "extends": ["plugin:@typescript-eslint/recommended"] +} +``` + +See [`configs/recommended.ts`](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/recommended.ts) for the exact contents of this config. + +:::tip +We strongly recommend all TypeScript projects extend from `plugin:@typescript-eslint/recommended`. +::: + +### `recommended-requiring-type-checking` + +Additional recommended rules that require type information. +Rules in this configuration are similarly useful to those in `recommended`. + +```json +{ + "extends": [ + "plugin:@typescript-eslint/recommended", + "plugin:@typescript-eslint/recommended-requiring-type-checking" + ] +} +``` + +See [`configs/recommended-requiring-type-checking.ts`](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/recommended-requiring-type-checking.ts) for the exact contents of this config. + +:::tip +We recommend all TypeScript projects extend from `plugin:@typescript-eslint/recommended-requiring-type-checking`, with the caveat that rules using type information take longer to run. +See [Linting with Type Information](/linting/typed-linting) for more details. +::: + +### `strict` + +Additional strict rules that can also catch bugs but are more opinionated than recommended rules. + +```json +{ + "extends": [ + "plugin:@typescript-eslint/recommended", + "plugin:@typescript-eslint/recommended-requiring-type-checking", + "plugin:@typescript-eslint/strict" + ] +} +``` + +See [`configs/strict.ts`](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/strict.ts) for the exact contents of this config. + +:::caution +We recommend a TypeScript project extend from `plugin:@typescript-eslint/strict` only if a nontrivial percentage of its developers are highly proficient in TypeScript. +::: + +## Other Configurations + +typescript-eslint includes a scattering of utility configurations used by the recommended configurations. +We don't recommend using these directly; instead, extend from an earlier recommended rule. + +### `all` + +Enables each the rules provided as a part of typescript-eslint. +Note that many rules are not applicable in all codebases, or are meant to be configured. + +See [`configs/all.ts`](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/all.ts) for the exact contents of this config. + +:::warning +We do not recommend a TypeScript projects extend from `plugin:@typescript-eslint/all`. +Many rules conflict with each other and/or are intended to be configured per-project. +::: + +### `base` + +A minimal ruleset that sets only the required parser and plugin options needed to run typescript-eslint. + + + +This config is automatically included if you use any of the recommended configurations. + +### `eslint-recommended` + +This ruleset is meant to be used after extending `eslint:recommended`. +It disables core ESLint rules that are already checked by the TypeScript compiler. +Additionally, it enables rules that promote using the more modern constructs TypeScript allows for. + +```jsonc +{ + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/eslint-recommended" + ] +} +``` + +This config is automatically included if you use any of the recommended configurations. + +See [`configs/eslint-recommended.ts``](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslint-recommended.ts) for the exact contents of this config. + +## Suggesting Configuration Changes + +If you feel strongly that a specific rule should (or should not) be one of these configurations, please [file an issue](https://github.com/typescript-eslint/typescript-eslint/issues/new?assignees=&labels=package%3A+eslint-plugin%2Cpreset+config+change%2Ctriage&template=09-config-change.yaml&title=Configs%3A+%3Ca+short+description+of+my+proposal%3E) along with a **detailed** argument explaining your reasoning. + +## Formatting + +None of the preset configs provided by typescript-eslint enable formatting rules (rules that only serve to enforce code whitespace and other trivia). +We strongly recommend you use Prettier or an equivalent for formatting your code, not ESLint formatting rules. +See [What About Formatting? > Suggested Usage](./troubleshooting/formatting#suggested-usage). diff --git a/docs/linting/TROUBLESHOOTING.md b/docs/linting/Troubleshooting.md similarity index 66% rename from docs/linting/TROUBLESHOOTING.md rename to docs/linting/Troubleshooting.md index f37f8780a33..f1aff9346bb 100644 --- a/docs/linting/TROUBLESHOOTING.md +++ b/docs/linting/Troubleshooting.md @@ -28,12 +28,48 @@ If you don't find an existing extension rule, or the extension rule doesn't work > We release a new version our tooling every week. > _Please_ ensure that you [check our the latest list of "extension" rules](https://typescript-eslint.io/rules/#extension-rules) **_before_** filing an issue. -## I get errors telling me "The file must be included in at least one of the projects provided" +## I get errors telling me "ESLint was configured to run ... However, that TSConfig does not / none of those TSConfigs include this file" + +### Fixing the Error + +- If you **do not** want to lint the file: + - Use [one of the options ESLint offers](https://eslint.org/docs/latest/user-guide/configuring/ignoring-code) to ignore files, namely a `.eslintignore` file, or `ignorePatterns` config. +- If you **do** want to lint the file: + - If you **do not** want to lint the file with [type-aware linting](./Typed_Linting.md): + - Use [ESLint's `overrides` configuration](https://eslint.org/docs/latest/user-guide/configuring/configuration-files#configuration-based-on-glob-patterns) to configure the file to not be parsed with type information. + - A popular setup is to omit the above additions from top-level configuration and only apply them to TypeScript files via an override. + - Alternatively, you can add `parserOptions: { project: null }` to an override for the files you wish to exclude. Note that `{ project: undefined }` will not work. + - If you **do** want to lint the file with [type-aware linting](./Typed_Linting.md): + - Check the `include` option of each of the tsconfigs that you provide to `parserOptions.project` - you must ensure that all files match an `include` glob, or else our tooling will not be able to find it. + - If your file shouldn't be a part of one of your existing tsconfigs (for example, it is a script/tool local to the repo), then consider creating a new tsconfig (we advise calling it `tsconfig.eslint.json`) in your project root which lists this file in its `include`. For an example of this, you can check out the configuration we use in this repo: + - [`tsconfig.eslint.json`](https://github.com/typescript-eslint/typescript-eslint/blob/main/tsconfig.eslint.json) + - [`.eslintrc.js`](https://github.com/typescript-eslint/typescript-eslint/blob/main/.eslintrc.js) + +### More Details + +This error may appear from the combination of two things: + +- The ESLint configuration for the source file specifies at least one TSConfig file in `parserOptions.project` +- None of those TSConfig files includes the source file being linted + - Note that files with the same name and different extension may not be recognized by TypeScript: see [`parserOptions.project` docs](https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/parser#parseroptionsproject) + +When TSConfig files are specified for parsing a source file, `@typescript-eslint/parser` will use the first TSConfig that is able to include that source file (per [aka.ms/tsconfig#include](https://www.typescriptlang.org/tsconfig#include)) to generate type information. +However, if no specified TSConfig includes the source file, the parser won't be able to generate type information. + +This error most commonly happens on config files or similar that are not included in their project TSConfig(s). +For example, many projects have files like: -This error means that the file that's being linted is not included in any of the TSConfig files you provided us. -This happens when users have test files, config files, or similar that are not included. +- An `.eslintrc.cjs` with `parserOptions.project: ["./tsconfig.json"]` +- A `tsconfig.json` with `include: ["src"]` -See our docs on [type aware linting](./TYPED_LINTING.md#i-get-errors-telling-me-the-file-must-be-included-in-at-least-one-of-the-projects-provided) for solutions. +In that case, viewing the `.eslintrc.cjs` in an IDE with the ESLint extension will show the error notice that the file couldn't be linted because it isn't included in `tsconfig.json`. + +See our docs on [type aware linting](./Typed_Linting.md) for more information. + +## I get errors telling me "The file must be included in at least one of the projects provided" + +You're using an outdated version of `@typescript-eslint/parser`. +Update to the latest version to see a more informative version of this error message, explained [above](#i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file 'backlink to I get errors telling me ESLint was configured to run ...'). ## I use a framework (like Vue) that requires custom file extensions, and I get errors like "You should add `parserOptions.extraFileExtensions` to your config" @@ -50,12 +86,34 @@ module.exports = { }; ``` +## I am running into errors when parsing TypeScript in my .vue files + +If you are running into issues parsing .vue files, it might be because parsers like [`vue-eslint-parser`](https://www.npmjs.com/package/vue-eslint-parser) are required to parse `.vue` files. In this case you can move `@typescript-eslint/parser` inside `parserOptions` and use `vue-eslint-parser` as the top level parser. + +```diff +- "parser": "@typescript-eslint/parser", ++ "parser": "vue-eslint-parser", + "parserOptions": { ++ "parser": "@typescript-eslint/parser", + "sourceType": "module" + } +``` + +The `parserOptions.parser` option can also specify an object to specify multiple parsers. See the [`vue-eslint-parser` usage guide](https://eslint.vuejs.org/user-guide/#usage) for more details. + ## One of my lint rules isn't working correctly on a pure JavaScript file 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. +## Should I run ESLint on transpiled output JavaScript files? + +No. + +Source TypeScript files have all the content of output JavaScript files, plus type annotations. +There's no benefit to also linting output JavaScript files. + ## TypeScript should be installed locally Make sure that you have installed TypeScript locally i.e. by using `npm install typescript`, not `npm install -g typescript`, @@ -67,7 +125,7 @@ See [#2041](https://github.com/typescript-eslint/typescript-eslint/issues/2041) ESLint core contains the rule [`no-restricted-syntax`](https://eslint.org/docs/rules/no-restricted-syntax). This generic rule allows you to specify a [selector](https://eslint.org/docs/developer-guide/selectors) for the code you want to ban, along with a custom error message. -You can use an AST visualization tool such as [TypeScript ESLint playground](https://typescript-eslint.io/play#showAST=es) > _Options_ > _AST Explorer_ on its left sidebar by selecting _ESTree_ to help in figuring out the structure of the AST that you want to ban. +You can use an AST visualization tool such as [typescript-eslint playground](https://typescript-eslint.io/play#showAST=es) > _Options_ > _AST Explorer_ on its left sidebar by selecting _ESTree_ to help in figuring out the structure of the AST that you want to ban. For example, you can ban enums (or some variation of) using one of the following configs: @@ -169,9 +227,28 @@ For example: See [this issue comment](https://github.com/typescript-eslint/typescript-eslint/issues/4102#issuecomment-963265514) for more details. +## Changes to one file are not reflected when linting other files in my IDE + +> tl;dr: Restart your ESLint server to force an update. + +ESLint currently does not have any way of telling parsers such as ours when an arbitrary file is changed on disk. +That means if you change file A that is imported by file B, it won't update lint caches for file B -- even if file B's text contents have changed. +Sometimes the only solution is to restart your ESLint editor extension altogether. + +See [this issue comment](https://github.com/typescript-eslint/typescript-eslint/issues/5845#issuecomment-1283248238 'GitHub issue 5845, comment 1283248238: details on ESLint cross-file caching') for more information. + +:::tip +[VS Code's ESLint extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) provides an `ESLint: Restart ESLint Server` action. +::: + +### I get `no-unsafe-*` complaints for cross-file changes + +See [Changes to one file are not reflected in linting other files in my IDE](#changes-to-one-file-are-not-reflected-in-linting-other-files-in-my-ide). +Rules such as [`no-unsafe-argument`](https://typescript-eslint.io/rules/no-unsafe-argument), [`no-unsafe-assignment`](https://typescript-eslint.io/rules/no-unsafe-assignment), and [`no-unsafe-call`](https://typescript-eslint.io/rules/no-unsafe-call) are often impacted. + ## My linting feels really slow -As mentioned in the [type-aware linting doc](./TYPED_LINTING.md), if you're using type-aware linting, your lint times should be roughly the same as your build times. +As mentioned in the [type-aware linting doc](./Typed_Linting.md), if you're using type-aware linting, your lint times should be roughly the same as your build times. If you're experiencing times much slower than that, then there are a few common culprits. diff --git a/docs/linting/TYPED_LINTING.md b/docs/linting/Typed_Linting.md similarity index 53% rename from docs/linting/TYPED_LINTING.md rename to docs/linting/Typed_Linting.md index fcf6f4b185d..3e1beb396a8 100644 --- a/docs/linting/TYPED_LINTING.md +++ b/docs/linting/Typed_Linting.md @@ -30,7 +30,7 @@ In more detail: - `parserOptions.tsconfigRootDir` tells our parser the absolute path of your project's root directory. - `parserOptions.project` tells our parser the relative path where your project's `tsconfig.json` is. - - If your project is a multi-package monorepo, see [our docs on configuring a monorepo](./typed-linting/MONOREPOS.md). + - If your project is a multi-package monorepo, see [our docs on configuring a monorepo](./typed-linting/Monorepos.md). - `plugin:@typescript-eslint/recommended-requiring-type-checking` is another recommended configuration we provide. This one contains rules that specifically require type information. With that done, run the same lint command you ran before. @@ -52,24 +52,9 @@ This means that generally they usually only run a complete lint before a push, o ### I get errors telling me "The file must be included in at least one of the projects provided" -This error means that the file that's being linted is not included in any of the tsconfig files you provided us. -A lot of the time this happens when users have test files or similar that are not included in their normal tsconfigs. - -Depending on what you want to achieve: - -- If you **do not** want to lint the file: - - Use [one of the options ESLint offers](https://eslint.org/docs/user-guide/configuring#ignoring-files-and-directories) to ignore files, like a `.eslintignore` file, or `ignorePatterns` config. -- If you **do** want to lint the file: - - If you **do not** want to lint the file with [type-aware linting](./TYPED_LINTING.md): - - Use [ESLint's `overrides` configuration](https://eslint.org/docs/user-guide/configuring#configuration-based-on-glob-patterns) to configure the file to not be parsed with type information. - - A popular setup is to omit the above additions from top-level configuration and only apply them to TypeScript files via an override. - - Alternatively, you can add `parserOptions: { project: null }` to an override for the files you wish to exclude. Note that `{ project: undefined }` will not work. - - If you **do** want to lint the file with [type-aware linting](./TYPED_LINTING.md): - - Check the `include` option of each of the tsconfigs that you provide to `parserOptions.project` - you must ensure that all files match an `include` glob, or else our tooling will not be able to find it. - - If your file shouldn't be a part of one of your existing tsconfigs (for example, it is a script/tool local to the repo), then consider creating a new tsconfig (we advise calling it `tsconfig.eslint.json`) in your project root which lists this file in its `include`. For an example of this, you can check out the configuration we use in this repo: - - [`tsconfig.eslint.json`](https://github.com/typescript-eslint/typescript-eslint/blob/main/tsconfig.eslint.json) - - [`.eslintrc.js`](https://github.com/typescript-eslint/typescript-eslint/blob/main/.eslintrc.js) +You're using an outdated version of `@typescript-eslint/parser`. +Update to the latest version to see a more informative version of this error message, explained in our [Troubleshooting and FAQs page](./Troubleshooting.md#i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file). ## Troubleshooting -If you're having problems getting this working, please have a look at our [Troubleshooting FAQ](./TROUBLESHOOTING.md). +If you're having problems getting this working, please have a look at our [Troubleshooting and FAQs page](./Troubleshooting.md). diff --git a/docs/linting/troubleshooting/FORMATTING.md b/docs/linting/troubleshooting/FORMATTING.md index 2acb36d0e60..47ff57c3b45 100644 --- a/docs/linting/troubleshooting/FORMATTING.md +++ b/docs/linting/troubleshooting/FORMATTING.md @@ -27,6 +27,22 @@ Linters typically run on a rule-by-rule basis, typically resulting in many edge We recommend using [`eslint-config-prettier`](https://github.com/prettier/eslint-config-prettier) to disable formatting rules in your ESLint configuration. You can then configure your formatter separately from ESLint. +Using this config by adding it to the end of your `extends`: + +```js title=".eslintrc.js" +module.exports = { + extends: [ + 'eslint:recommended', + 'plugin:@typescript-eslint/recommended', + // Add this line + 'prettier', + ], + parser: '@typescript-eslint/parser', + plugins: ['@typescript-eslint'], + root: true, +}; +``` + ## ESLint Core and Formatting Per [ESLint's 2020 Changes to Rule Policies blog post](https://eslint.org/blog/2020/05/changes-to-rules-policies#what-are-the-changes): diff --git a/docs/linting/troubleshooting/TSLINT.md b/docs/linting/troubleshooting/TSLint.md similarity index 94% rename from docs/linting/troubleshooting/TSLINT.md rename to docs/linting/troubleshooting/TSLint.md index a145f9fca61..8eb61e85713 100644 --- a/docs/linting/troubleshooting/TSLINT.md +++ b/docs/linting/troubleshooting/TSLint.md @@ -17,7 +17,7 @@ You can look at [the alternatives list](https://github.com/typescript-eslint/typ There is also the ultimate fallback option of using both linters together for a while during your transition if you absolutely have to by using TSLint _within_ ESLint. -For this option, check out [`@typescript-eslint/eslint-plugin-tslint`](https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/eslint-plugin-tslint). +For this option, check out [`@typescript-eslint/eslint-plugin-tslint`](../../architecture/ESLint_Plugin_TSLint.mdx). ## Why Deprecate TSLint? diff --git a/docs/linting/typed-linting/MONOREPOS.md b/docs/linting/typed-linting/Monorepos.md similarity index 74% rename from docs/linting/typed-linting/MONOREPOS.md rename to docs/linting/typed-linting/Monorepos.md index 1bb057718c6..e55d2064779 100644 --- a/docs/linting/typed-linting/MONOREPOS.md +++ b/docs/linting/typed-linting/Monorepos.md @@ -38,7 +38,7 @@ Be sure to update your `.eslintrc.js` to point at this new config file. ## One `tsconfig.json` per package (and an optional one in the root) -The `parserOptions.project` option introduced in [Linting with Type Information](../TYPED_LINTING.md) accepts an array of relative paths. +The `parserOptions.project` option introduced in [Linting with Type Information](../Typed_Linting.md) accepts an array of relative paths. Paths may be provided as [Node globs](https://github.com/isaacs/node-glob/blob/f5a57d3d6e19b324522a3fa5bdd5075fd1aa79d1/README.md#glob-primer). For each file being linted, the first matching project path will be used as its backing TSConfig. @@ -62,6 +62,33 @@ module.exports = { }; ``` +### Wide globs in `parserOptions.project` + +Using wide globs `**` in your `parserOptions.project` may degrade linting performance. +Instead of globs that use `**` to recursively check all folders, prefer paths that use a single `*` at a time. + +```js title=".eslintrc.js" +module.exports = { + extends: [ + 'eslint:recommended', + 'plugin:@typescript-eslint/recommended', + 'plugin:@typescript-eslint/recommended-requiring-type-checking', + ], + parser: '@typescript-eslint/parser', + parserOptions: { + tsconfigRootDir: __dirname, + // Remove this line + project: ['./tsconfig.eslint.json', './**/tsconfig.json'], + // Add this line + project: ['./tsconfig.eslint.json', './packages/*/tsconfig.json'], + }, + plugins: ['@typescript-eslint'], + root: true, +}; +``` + +See [Glob pattern in parser's option "project" slows down linting](https://github.com/typescript-eslint/typescript-eslint/issues/2611) for more details. + ### Important note regarding large (> 10) multi-package monorepos We've had reports that for sufficiently large and/or interdependent projects, you may run into OOMs using this approach. @@ -77,4 +104,4 @@ As an interim workaround, consider one of the following: ## Troubleshooting -If you're having problems getting this working, please have a look at our [Troubleshooting FAQ](../TROUBLESHOOTING.md). +If you're having problems getting this working, please have a look at our [Troubleshooting FAQ](../Troubleshooting.md). diff --git a/docs/maintenance/BRANDING.md b/docs/maintenance/BRANDING.md new file mode 100644 index 00000000000..25c08b216e6 --- /dev/null +++ b/docs/maintenance/BRANDING.md @@ -0,0 +1,37 @@ +--- +id: branding +title: Branding +--- + +This document serves as a guide for how we generally describe or represent typescript-eslint. +It's fine if you don't always adhere to it. + +## Terminology + +### Name + + + +Our project name is **_"typescript-eslint"_**. +We sometimes refer to it as _"ts-eslint"_ for short. + +_"typescript-eslint"_ is preferred over _"TypeScript ESLint"_ or _"TypeScript-ESLint"_ because ESLint and TypeScript are written in abbreviated Pascal Case. +Combining lowercase with a dash helps differentiate us. + + + +### Slogan + +> The tooling that enables ESLint and Prettier to support TypeScript. + +## Visuals + +Our primary brand color is `#2656c7`, the halfway point between ESLint's `#4b32c3` purple and TypeScript's `#007acc` blue. +You can call it _blurple_ if you want. + +Our logo is also a halfway between [ESLint's logo](https://en.wikipedia.org/wiki/ESLint#/media/File:ESLint_logo.svg) and [TypeScript's logo](https://en.wikipedia.org/wiki/TypeScript#/media/File:Typescript.svg): + +typescript-eslint logo + +- [Logo PNG download](/img/logo.png) +- [Logo SVG download](/img/logo.svg) diff --git a/docs/maintenance/ISSUES.md b/docs/maintenance/ISSUES.md new file mode 100644 index 00000000000..ebddcc6df1b --- /dev/null +++ b/docs/maintenance/ISSUES.md @@ -0,0 +1,112 @@ +--- +id: issues +title: Issues +--- + +This document serves as a guide for how you might manage issues, also known as issue triaging. + +Use your best judgement when triaging issues, and most of all remember to be **kind, friendly, and encouraging** when responding to users. +Many users are new to open source and/or typed linting. +It's imperative we give them a positive, uplifting experience. + +:::tip +If you're ever unsure on any part of issue management, don't hesitate to loop in a maintainer that has more context to help! +::: + +## Issue Flow + +:::note +We include a set of common responses to issues in [`.github/replies.yml`](https://github.com/typescript-eslint/typescript-eslint/blob/main/.github/replies.yml), intended to be used with the [Refined Saved Replies](https://github.com/JoshuaKGoldberg/refined-saved-replies) extension. +Don't treat these as exact responses you must use: they're just a starting copy+paste helper. +Please do adopt your specific responses to your personal tone and to match the thread for non-straightforward issues. +::: + +[Issues pending triage](https://github.com/typescript-eslint/typescript-eslint/issues?q=is%3Aopen+is%3Aissue+label%3Atriage) are searchable the `triage` label. +That label is added automatically when a new issue is created. +Most issues go through the following review flow when created or updated: + +1. A maintainer ensures the issue is valid: + - If the poster didn't fill out an appropriate template with enough information: + - Add the `please fill out the template` and `awaiting response` labels + - Ask the poster for more information using a _Needs More Info_ response + - If it's a duplicate of an issue that already exists: + - Add the `duplicate` label and remove the `bug` label + - If it's an obvious duplicate, post a _Clearly Duplicate Issue_ response + - If it's not an obvious duplicate, link to the existing issue and explain why + - If the code is working as intended: + - Add the `working as intended` label and remove the `bug` and `triage` labels + - If the behavior is due to the user doing something wrong, such as an incorrect config: + - Add the `fix: user error` label + - [This issue search has some examples of closing comments](https://github.com/typescript-eslint/typescript-eslint/issues?q=is%3Aissue+sort%3Aupdated-desc+label%3A%22fix%3A+user+error%22+is%3Aclosed) + - If the behavior is otherwise expected, [this issue search has some examples of closing comments](https://github.com/typescript-eslint/typescript-eslint/issues?q=is%3Aissue+sort%3Aupdated-desc+label%3A%22working+as+intended%22+-label%3A%22fix%3A+user+error%22+is%3Aclosed+) + - You needn't go into too much detail in your comment - just enough to explain it +2. If the report is valid, add the `accepting prs` label and remove the `triage` label +3. If you know the rough steps for a fix, consider writing a comment with links to codebase to help someone put together a fix +4. If you think that the fix is relatively straightforward, consider also adding the `good first issue` label + +Whenever an issue is waiting for the reporter to provide more information, it should be given the `awaiting response` label. +When more information is provided: + +- If you have time to go through the triage flow again, do so +- If you don't have time, add the `triage` label and remove the `awaiting response` label + +:::tip +If your link is both a "permalink" (includes a commit hash instead of a branch name) and has a line number/line range then GitHub will embed the code in your comment. +When viewing a file in GitHub pressing `y` will update the URL to a "permalink" with the current commit hash, then you can select the relevant lines and paste that URL into the comment. +::: + +### Determining Whether Code is Working As Intended + +As you become more familiar with the codebase and how everything works, this will be easier to do intuitively, but to begin with, this will likely involve investigating the documentation, code, and tests to determine if it's a bug or working as intended. +In general, if there is a passing test or documented example that is the same as or similar to the repro code — that indicates it's working as intended. +If you can't find anything that matches, use your best judgement based on the spirit of the code. + +### Looking for Duplicates + +It's worth noting that, occasionally, a user will intentionally raise a duplicate issue because they feel the original issue was closed when it shouldn't have been. +If this is the case, you should read the original issue to gather context, understand the reason for it being closed, and determine if the new issue raises any new or relevant point that requires addressing. + +## Skipping Steps + +As you become more familiar with the codebase and how it's supposed to behave you'll be able to skip steps or do things out of order as you see fit. +For example, you may be able to identify if a bug report is "working as intended", or you might recognize an issue as a duplicate without having a completely filled-out issue. +In such cases you can forgo the back-and-forth and just skip to the closing steps. + +## Specific Issue Types + +### 🐛 Bug Reports + +#### 🐞 "Simple" Bugs + +A simple bug is a bug that can be reproduced in a single TS file plus an ESLint config (and possibly a TSConfig) - i.e. an issue reproducible on https://typescript-eslint.io/play. +The vast majority of bug reports fall into this category. + +If you cannot reproduce the issue as described using the issue's provided playground reproduction, it has not provided enough information. +Consider using a specific response like the _Needs Playground Reproduction_ response. + +#### 🦟 "Complex" Bugs + +A complex bug is a bug that requires multiple files to reproduce. +This is the rarer case, but does happen when people are using library types or if there are issues when types are imported. + +These bugs should be reported with a link to a GitHub repository that can be checked out to reproduce the issue. +If you cannot reproduce the issue as described using repository's README.md and issue description, it has not provided enough information. +Consider using a specific response like the _Needs Full Reproduction_ response. + +### ✨ Rule Enhancements + +TODO: This will be filled out... soon! + +### 🚀 New Rules + +TODO: This will be filled out... soon! + +## Pruning Old Issues + +Every so often, we like to [search for open issues `awaiting response`](https://github.com/typescript-eslint/typescript-eslint/issues?q=is%3Aopen+is%3Aissue+label%3A%22awaiting+response%22) to find ones that might have been forgotten. +Our flow for issues that have been waiting for >=1 month is: + +1. Ping the author with a message like the _Checking In_ template +2. Add the `stale` label to the issue +3. Wait 2 weeks +4. If they still haven't responded, close the issue with a message like the _Pruning Stale Issue_ template diff --git a/docs/maintenance/PULL_REQUESTS.md b/docs/maintenance/PULL_REQUESTS.md new file mode 100644 index 00000000000..37c6b40256c --- /dev/null +++ b/docs/maintenance/PULL_REQUESTS.md @@ -0,0 +1,34 @@ +--- +id: pull-requests +title: Pull Requests +--- + +This document serves as a guide for how you might review pull requests. + +Use your best judgement when reviewing PRs, and most of all remember to be **kind, friendly, and encouraging** when responding to users. +Many users are new to open source and/or typed linting. +It's imperative we give them a positive, uplifting experience. + +:::tip +If you're ever unsure on any part of PR reviews, don't hesitate to loop in a maintainer that has more context to help! +::: + +## PR Flow + +:::note +We include a set of common responses to PRs in [`.github/replies.yml`](https://github.com/typescript-eslint/typescript-eslint/blob/main/.github/replies.yml), intended to be used with the [Refined Saved Replies](https://github.com/JoshuaKGoldberg/refined-saved-replies) extension. +Don't treat these as exact responses you must use: they're just a starting copy+paste helper. +Please do adopt your specific responses to your personal tone and to match the thread for non-straightforward PRs. +::: + +TODO: This will be filled out... soon! + +## Pruning Old PRs + +Every so often, we like to [search for open PRs `awaiting response`](https://github.com/typescript-eslint/typescript-eslint/pulls?q=is%3Aopen+is%3Apr+label%3A%22awaiting+response%22) to find ones that might have been forgotten. +Our flow for PRs that have been waiting for >=1 month is: + +1. Ping the author with a message like the _Checking In_ template +2. Add the `stale` label to the PR +3. Wait 2 weeks +4. If they still haven't responded, close the PR with a message like the _Pruning Stale PR_ template diff --git a/docs/maintenance/RELEASES.md b/docs/maintenance/RELEASES.md new file mode 100644 index 00000000000..211294d488b --- /dev/null +++ b/docs/maintenance/RELEASES.md @@ -0,0 +1,88 @@ +--- +id: releases +sidebar_label: Releases +title: Releases +--- + +## Canary + +We release a canary version for each commit to `main` that passes all required checks. This release is performed automatically by the [`publish_canary_version` step](https://github.com/typescript-eslint/typescript-eslint/blob/5feb2dba9da2bd5e233451b7b0f1c99414b5aef9/.github/workflows/ci.yml#L234-L263). + +This release is goes to the `canary` tag on npm and it is versioned as an incremental canary patch release on top of the current `latest` version. I.e. if the current version is `5.6.1`, then the first canary version will be `5.6.2-alpha.0`, the second `5.6.2-alpha.1`, and so on. + +## Latest + +We release a latest version every Monday at 1pm US Eastern time using the latest commit to `main` at that time. This release is performed automatically by a Github action located in a private repository. This release goes to the standard `latest` tag on npm. + +See the [versioning](#versioning) section below for how the version number is calculated. + +If there have been no commits that impact public-facing packages then a patch-level release shall be released. + +Latest releases shall only ever be "minor" or "patch" releases. + +## Major Releases + +We currently do not have a set schedule around when major releases shall be performed; instead they are done as the need arises. + +We keep a backlog of breaking issues as a milestone on GitHub that is named in the form `${major}.0.0`. +When we do do a major release, we release a release candidate version to the `rc-v${major}` tag on npm for each commit to the major branch. + +### Major Release Steps + +Our releases go through three groups of steps: + +1. [Pre-Release Preparation] +1. [Merging Breaking Changes] +1. [Releasing the Version] + +#### 1. Pre-Release Preparation + +1. Create a milestone by the name of the release [example: [Milestone 6.0.0](https://github.com/typescript-eslint/typescript-eslint/milestone/8)]. +1. If an issue for changes to recommended rule configs doesn't yet exist, create one [example: [Changes to the `recommended` sets for 5.0.0](https://github.com/typescript-eslint/typescript-eslint/issues/5900)]. +1. Add any breaking changes intended for the release to that milestone. +1. Create two new branches off `main` in the project repository (not a personal fork): + - `v${major}` + - `v${major}-canary-auto-release` +1. Raise a PR from `v${major}-canary-auto-release` to `main` modifying the [`ci.yml` workflow](https://github.com/typescript-eslint/typescript-eslint/blob/main/.github/workflows/ci.yml) [example: [chore: add auto-canary release for v6](https://github.com/typescript-eslint/typescript-eslint/pull/5883)]: + - Under `pushes:` at the beginning of the file, add an `- v${major}` list item. + - Add a `publish_canary_version_v${major}` step the same as `publish_canary_version` except: + - Add the condition: `if: github.ref == 'refs/heads/v${major}'`. + - Its publish command should be `npx lerna publish premajor --loglevel=verbose --canary --exact --force-publish --yes --dist-tag rc-v${major}`. + - Merge this into `main` once reviewed and rebase the `v${major}` branch. + +#### 2. Merging Breaking Changes + +1. Send a PR from `v${major}` to `main` [example: [v6.0.0](https://github.com/typescript-eslint/typescript-eslint/pull/5886)]. +1. Change all [breaking change PRs](https://github.com/typescript-eslint/typescript-eslint/issues?q=is%3Aissue+is%3Aopen+label%3A%22breaking+change%22) to target the `v${major}` branch. + - To signify these changes as breaking, the first line of the PR description must read as `BREAKING CHANGE:`, and second line should briefly summarize the changes. + - It is important to note that when merged the commit message must also include `BREAKING CHANGE:` as the first line in order for lerna 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. Wait until all required PRs have been merged +1. Let the release wait for **at least 1 week** to allow time for early adopters to help test it and discuss the changes. + - Promote it on the [`@tseslint`](https://twitter.com/tseslint) twitter to get some additional attention. +1. Once discussions have settled, rebase merge the PR on top of `main`. + +:::note +_Non_-breaking changes can be merged to `main` or the major branch. +They don't need any special treatment. +::: + +#### 3. Releasing the Version + +1. Discuss with the maintainers to be ready for an [out-of-band](#out-of-band) release. Doing this manually helps ensure someone is on-hand to action any issues that might arise from the major release. +1. Prepare the release notes. Lerna will automatically generate the release notes on GitHub, however this will be disorganized and unhelpful for users. We need to reorganize the release notes so that breaking changes are placed at the top to make them most visible. If any migrations are required, we must list the steps to make it easy for users. + +- Example release notes: [`v5.0.0`](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v5.0.0), [`v4.0.0`](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v4.0.0), [`v3.0.0`](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v3.0.0) + +1. Finally, tweet the release on the `@tseslint` twitter with a link to the GitHub release. Make sure you include additional information about the highlights of the release! + +## Out-of-Band + +We will do releases "out-of-band" (outside the [latest](#latest) schedule) for rare emergencies. +We assess need on a case-by-case basis though generally an emergency is defined as a critical regression specifically introduced in the latest release. + +These releases are done manually by a maintainer with the required access privileges. + +## Back-Porting Releases + +We **_do not_** back port releases to previously released major/minor versions. +We only ever release forward. diff --git a/docs/maintenance/VERSIONING.md b/docs/maintenance/VERSIONING.md new file mode 100644 index 00000000000..0dd31ae90c1 --- /dev/null +++ b/docs/maintenance/VERSIONING.md @@ -0,0 +1,120 @@ +--- +id: versioning +sidebar_label: Versioning +title: Versioning +--- + +We follow [semantic versioning (semver)](https://semver.org). +This page exists to help set guidelines around when what we consider to fall within each of the semver categories. + +All of the packages in this project are published with the same version number to make it easier to coordinate both releases and installations. + +We publish a canary release on every successful merge to `main`, so **you never need to wait for a new stable version to make use of any updates**. + +Additionally, we promote to the `latest` tag on NPM once per week, **on Mondays at 1 pm Eastern**. + +The latest version under the `latest` tag is: + +NPM Version + +The latest version under the `canary` tag **(latest commit to `main`)** is: + +NPM Version + +:::note +The only exception to the automated publishes described above is when we are in the final phases of creating the next major version of the libraries - e.g. going from `1.x.x` to `2.x.x`. +During these periods, we manually publish `canary` releases until we are happy with the release and promote it to `latest`. +::: + +## Dependant Versions + +### TypeScript + +> The version range of TypeScript currently supported is `>=3.3.1 <4.9.0`. + +These versions are what we test against. + +We will always endeavor to support the latest stable version of TypeScript. +Sometimes, but not always, changes in TypeScript will not require breaking changes in this project, and so we are able to support more than one version of TypeScript. +In some cases, we may even be able to support additional pre-releases (i.e. betas and release candidates) of TypeScript, but only if doing so does not require us to compromise on support for the latest stable version. + +Note that our packages have an open `peerDependency` requirement in order to allow for experimentation on newer/beta versions of TypeScript. + +If you use a non-supported version of TypeScript, the parser will log a warning to the console. +If you want to disable this warning, you can configure this in your `parserOptions`. +See: [`@typescript-eslint/parser`](./packages/parser/ TODO JOSH) and [`@typescript-eslint/typescript-estree`](./packages/typescript-estree/ TODO JOSH). + +### ESLint + +> The version range of ESLint currently supported is `^6.0.0 || ^7.0.0 || ^8.0.0`. + +We generally support at least the latest two major versions of ESLint. + +### Node + +This project makes an effort to support Active LTS and Maintenance LTS release statuses of Node according to [Node's release document](https://nodejs.org/en/about/releases). +Support for specific Current status releases are considered periodically. + +## Breaking Changes + +When considering whether a change should be counted as "breaking" we first need to consider what package(s) it impacts. For example breaking changes for the parser packages have a different standard to those for the ESLint plugins. This is because not only do they have _very_ different API surfaces, they also are consumed in very different ways. + +Please note that the lists provided below are non-exhaustive and are intended to serve as examples to help guide maintainers when planning and reviewing changes. + +### `ast-spec` and `visitor-keys` + +A change to the AST **_shall_** be considered breaking if it: + +- Removes or renames an existing AST Node. +- Removes or renames an existing property on an AST Node. +- Changes a type in a non-refining way (i.e. `string` to `number`). + +A change to the AST **_shall not_** be considered breaking if it: + +- Adds a new property to the AST. +- Adds a new node type to the AST. +- Adds a new node type to an existing union type. +- Refines a type to be more specific (i.e. `string` to `'literal' | 'union'`). +- Removes a type from a union that was erroneously added and did not match the runtime AST. + +### `eslint-plugin` and `eslint-plugin-tslint` + +A change to the plugins **_shall_** be considered breaking if it will require the user to change their config. More specifically: + +- Removes or renames an option. +- Changes the default option of a rule. +- Changes a rule's schema to be stricter. +- Consumes type information to a rule that did not previously consume it. +- Removes or renames a rule. +- Changes any of the recommended configurations. +- Changes the default behavior of a rule in such a way that causes new reports in a large set of cases in an average codebase. + +A change to the plugins **_shall not_** be considered breaking if it: + +- Adds an option that by default does not remove existing functionality. +- Adds a rule. +- Deprecates a rule. +- Adds additional checks to an existing rule that causes new reports in a small-to-medium set of cases in an average codebase. +- Refactors a rule's code in a way that does not introduce additional reports. +- Changes to a rule's description or other metadata. +- Adds a fixer or suggestion fixer. +- Removes a fixer or suggestion fixer. +- Fixes incorrect behavior in a rule that may or may not introduce additional reports. + +#### `parser`, `typescript-estree`, `scope-manager`, `types`, `type-utils`, `utils` + +A change to these packages **_shall_** be considered breaking if it: + +- Changes the API surface in a backwards-incompatible way (remove or rename functions, types, etc). + +A change to these packages **_shall not_** be considered breaking if it: + +- Adds to the API surface (add functions, types, etc). +- Deprecates parts of the API surface. +- Adds **_optional_** arguments to functions or properties to input types. +- Adds additional properties to output types. +- Adds documentation in the form of JSDoc comments. + +### Internal packages + +Any packages in this project that are not part of our public API surface (such as `eslint-plugin-internal` or `website`) shall not be considered when calculating new package versions. diff --git a/docs/maintenance/issues/Rule_Deprecations.md b/docs/maintenance/issues/Rule_Deprecations.md new file mode 100644 index 00000000000..98486f2bb6c --- /dev/null +++ b/docs/maintenance/issues/Rule_Deprecations.md @@ -0,0 +1,34 @@ +--- +id: rule-deprecations +title: Rule Deprecations +--- + +Sometimes a rule that used to be 👍 does not age well and becomes 👎. +In the past, these cases have included: + +- Overly opinionated and/or stylistic rules that don't represent a universal best practice +- Renames +- Rules moved to an external plugin + +In these cases, we aim to remove the old rule with minimal user disruption. + +## Filing the Issue + +Rule deprecations can be filed as a [new issue bypassing templates](https://github.com/typescript-eslint/typescript-eslint/issues/new). + +Provide it an `## Overview` containing: + +- The rule name & link to its documentation page +- A clear explanation of why you believe it should be deprecated +- Whether it exists in popular configs such as `eslint-config-airbnb-typescript` and `eslint-config-standard-with-typescript` +- Sourcegraph queries showing how often it appears in user configs + +> See [#6036](https://github.com/typescript-eslint/typescript-eslint/issues/6036) for examples of those links and queries. + +## Timeline + +1. In any minor/patch version, add [rule `meta` properties](https://eslint.org/docs/latest/developer-guide/working-with-rules#rule-basics): + - `deprecated: true` + - `replacedBy`, if applicable +2. In the next major version, you may delete the rule + - If the rule is relatively popular with users, consider leaving a documentation page as a tombstone pointing to the new relevant rule or docs (see [`camelcase`](https://typescript-eslint.io/rules/camelcase/) as an example) diff --git a/lerna.json b/lerna.json index b478f846acf..05ae3263abc 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "5.39.0", + "version": "5.46.1", "npmClient": "yarn", "useWorkspaces": true, "stream": true diff --git a/netlify.toml b/netlify.toml index 7ac5b981148..06deeaaed01 100644 --- a/netlify.toml +++ b/netlify.toml @@ -8,18 +8,35 @@ YARN_FLAGS = "--ignore-scripts" # https://docs.netlify.com/configure-builds/file-based-configuration/#redirects + +[[redirects]] + from = "/docs" + to = "/getting-started" + +[[redirects]] + from = "/docs/development/architecture/asts" + to = "/blog/asts-and-typescript-eslint" + [[redirects]] - from = "/docs/linting" - to = "/docs" + from = "/docs/development/architecture/packages" + to = "/architecture" + +[[redirects]] + from = "/docs/development/custom-rules" + to = "/custom-rules" [[redirects]] from = "/docs/linting/type-linting" - to = "/docs/linting/typed-linting" + to = "/linting/typed-linting" [[redirects]] from = "/docs/linting/monorepo" - to = "/docs/linting/typed-linting/monorepos" + to = "/linting/typed-linting/monorepos" [[redirects]] from = "/docs/linting/tslint" - to = "/docs/linting/troubleshooting/tslint" + to = "/linting/troubleshooting/tslint" + +[[redirects]] + from = "/docs/*" + to = "/" diff --git a/nx.json b/nx.json index 7b001c0f790..b34a91f7800 100644 --- a/nx.json +++ b/nx.json @@ -1,12 +1,6 @@ { + "$schema": "./node_modules/nx/schemas/nx-schema.json", "npmScope": "typescript-eslint", - "implicitDependencies": { - "package.json": { - "dependencies": "*", - "devDependencies": "*" - }, - ".github/workflows/ci.yml": "*" - }, "affected": { "defaultBase": "main" }, @@ -17,7 +11,7 @@ "default": { "runner": "@nrwl/nx-cloud", "options": { - "cacheableOperations": ["build", "test", "package", "prebuild"], + "cacheableOperations": ["build", "lint", "package", "prebuild", "test"], "accessToken": "YjFjNTBhOWUtY2JmNy00ZDhiLWE5N2UtZjliNDAwNmIzOTdjfHJlYWQtd3JpdGU=", "canTrackAnalytics": false, "showUsageWarnings": true, @@ -26,12 +20,18 @@ } } }, - "targetDependencies": { - "build": [ - { - "target": "build", - "projects": "dependencies" - } - ] + "targetDefaults": { + "build": { + "dependsOn": ["^build"], + "inputs": ["production", "^production"] + }, + "test": { + "outputs": ["{projectRoot}/coverage"] + } + }, + "namedInputs": { + "default": ["{projectRoot}/**/*", "sharedGlobals"], + "sharedGlobals": ["{workspaceRoot}/.github/workflows/ci.yml"], + "production": ["default"] } } diff --git a/package.json b/package.json index d69b79c7d8c..ead2b34ea82 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "check-docs": "nx run-many --target=check-docs --all --parallel", "check-format": "prettier --list-different .", "check-spelling": "cspell --config=.cspell.json \"**/*.{md,mdx,ts,mts,cts,js,cjs,mjs,tsx,jsx}\"", - "clean": "lerna clean && lerna run clean", + "clean": "lerna clean -y && nx run-many --target=clean", "format": "prettier --write .", "generate-contributors": "yarn ts-node --transpile-only ./tools/generate-contributors.ts", "generate-sponsors": "yarn ts-node --transpile-only ./tools/generate-sponsors.ts", @@ -37,8 +37,8 @@ "lint-fix": "eslint . --fix", "lint-markdown-fix": "yarn lint-markdown --fix", "lint-markdown": "markdownlint \"**/*.md\" --config=.markdownlint.json --ignore-path=.markdownlintignore", - "lint": "cross-env NODE_OPTIONS=\"--max-old-space-size=16384\" eslint .", - "postinstall": "yarn patch-package && yarn husky install && yarn build", + "lint": "nx run-many --target=lint --all --parallel", + "postinstall": "yarn ts-node --transpile-only ./tools/postinstall.ts", "pre-commit": "yarn lint-staged", "start": "nx run website:start", "test": "nx run-many --target=test --all --parallel", @@ -49,14 +49,14 @@ "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "devDependencies": { - "@babel/code-frame": "^7.16.7", - "@babel/eslint-parser": "^7.18.2", - "@babel/parser": "^7.18.0", - "@babel/types": "^7.18.2", - "@nrwl/cli": "14.1.4", - "@nrwl/nx-cloud": "14.0.3", - "@nrwl/tao": "14.1.4", - "@nrwl/workspace": "14.1.4", + "@babel/code-frame": "^7.18.6", + "@babel/core": "^7.20.2", + "@babel/eslint-parser": "^7.19.1", + "@babel/parser": "^7.20.3", + "@babel/types": "^7.20.2", + "@nrwl/nx-cloud": "15.0.2", + "@nrwl/jest": "15.3.2", + "@nrwl/workspace": "15.3.2", "@swc/core": "^1.3.1", "@swc/jest": "^0.2.21", "@types/babel__code-frame": "^7.0.3", @@ -69,7 +69,7 @@ "@types/lodash": "^4.14.182", "@types/marked": "^4.0.3", "@types/ncp": "^2.0.5", - "@types/node": "^17.0.31", + "@types/node": "^18.11.9", "@types/prettier": "^2.6.0", "@types/rimraf": "^3.0.2", "@types/semver": "^7.3.9", @@ -77,7 +77,7 @@ "console-fail-test": "^0.1.7", "cross-env": "^7.0.3", "cross-fetch": "^3.1.5", - "cspell": "^5.20.0", + "cspell": "^6.0.0", "downlevel-dts": ">=0.10.0", "enhanced-resolve": "^5.9.3", "eslint": "^8.15.0", @@ -87,30 +87,31 @@ "eslint-plugin-import": "^2.26.0", "eslint-plugin-jest": "^26.1.5", "eslint-plugin-simple-import-sort": "^8.0.0", + "execa": "5.1.1", "glob": "^8.0.1", "husky": "^8.0.1", "jest": "^29.0.3", "jest-diff": "^29.0.3", "jest-snapshot": "^29.0.3", - "jest-specific-snapshot": "^5.0.0", - "lerna": "5.5.2", + "jest-specific-snapshot": "^7.0.0", + "lerna": "6.1.0", "lint-staged": "^13.0.0", "make-dir": "^3.1.0", - "markdownlint-cli": "^0.31.1", + "markdownlint-cli": "^0.32.0", "ncp": "^2.0.0", + "nx": "15.3.2", "patch-package": "^6.4.7", - "prettier": "2.7.1", + "prettier": "2.8.0", "pretty-format": "^29.0.3", "rimraf": "^3.0.2", "tmp": "^0.2.1", "ts-node": "^10.7.0", "tslint": "^6.1.3", - "typescript": ">=3.3.1 <4.9.0" + "typescript": ">=3.3.1 <5.0.0" }, "resolutions": { - "typescript": "~4.8.3", - "@types/node": "^17.0.31", - "//": "Pin jest to v29 across the repo", + "typescript": "~4.9.3", + "@types/node": "^18.11.9", "@jest/create-cache-key-function": "^29", "@jest/reporters": "^29", "@jest/test-result": "^29", @@ -122,7 +123,6 @@ "jest-snapshot": "^29", "jest-util": "^29", "pretty-format": "^29", - "//": "Stub out unnecessary swc packages to improve install size and speed", "@swc/core-android-arm-eabi": "npm:dummypkg-a@1.0.0", "@swc/core-android-arm64": "npm:dummypkg-a@1.0.0", "@swc/core-freebsd-x64": "npm:dummypkg-a@1.0.0", diff --git a/packages/ast-spec/CHANGELOG.md b/packages/ast-spec/CHANGELOG.md index 9a5fc2598bb..8b8f051a142 100644 --- a/packages/ast-spec/CHANGELOG.md +++ b/packages/ast-spec/CHANGELOG.md @@ -3,728 +3,439 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -# [5.39.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.1...v5.39.0) (2022-10-03) +## [5.46.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.46.0...v5.46.1) (2022-12-12) **Note:** Version bump only for package @typescript-eslint/ast-spec +# [5.46.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.45.1...v5.46.0) (2022-12-08) +**Note:** Version bump only for package @typescript-eslint/ast-spec - - -## [5.38.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.0...v5.38.1) (2022-09-26) +## [5.45.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.45.0...v5.45.1) (2022-12-05) **Note:** Version bump only for package @typescript-eslint/ast-spec +# [5.45.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.44.0...v5.45.0) (2022-11-28) +### Features +- support Auto Accessor syntax ([#5926](https://github.com/typescript-eslint/typescript-eslint/issues/5926)) ([becd1f8](https://github.com/typescript-eslint/typescript-eslint/commit/becd1f8581c0013399dfe71be6c265e96cedb57a)) +# [5.44.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.43.0...v5.44.0) (2022-11-21) -# [5.38.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.37.0...v5.38.0) (2022-09-19) +### Features -**Note:** Version bump only for package @typescript-eslint/ast-spec +- support parsing `satisfies` operators ([#5717](https://github.com/typescript-eslint/typescript-eslint/issues/5717)) ([20d7cae](https://github.com/typescript-eslint/typescript-eslint/commit/20d7caee35ab84ae6381fdf04338c9e2b9e2bc48)) +# [5.43.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.1...v5.43.0) (2022-11-14) +**Note:** Version bump only for package @typescript-eslint/ast-spec +## [5.42.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.0...v5.42.1) (2022-11-07) +### Bug Fixes -# [5.37.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.2...v5.37.0) (2022-09-12) +- **ast-spec:** correct misnamed ExportNamedDeclaration AST type ([#5913](https://github.com/typescript-eslint/typescript-eslint/issues/5913)) ([e88f4fa](https://github.com/typescript-eslint/typescript-eslint/commit/e88f4fa1d0127ba0ddeff578ec67f2e66a1de68b)) -**Note:** Version bump only for package @typescript-eslint/ast-spec +# [5.42.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.41.0...v5.42.0) (2022-10-31) +### Bug Fixes +- **ast-spec:** add TSQualifiedName to TypeNode union ([#5906](https://github.com/typescript-eslint/typescript-eslint/issues/5906)) ([5c316c1](https://github.com/typescript-eslint/typescript-eslint/commit/5c316c12f09d58aee6ee634a8055533f361f1589)) +# [5.41.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.1...v5.41.0) (2022-10-24) +**Note:** Version bump only for package @typescript-eslint/ast-spec -## [5.36.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.1...v5.36.2) (2022-09-05) +## [5.40.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.0...v5.40.1) (2022-10-17) **Note:** Version bump only for package @typescript-eslint/ast-spec +# [5.40.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.39.0...v5.40.0) (2022-10-10) +**Note:** Version bump only for package @typescript-eslint/ast-spec +# [5.39.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.1...v5.39.0) (2022-10-03) +**Note:** Version bump only for package @typescript-eslint/ast-spec -## [5.36.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.0...v5.36.1) (2022-08-30) +## [5.38.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.0...v5.38.1) (2022-09-26) **Note:** Version bump only for package @typescript-eslint/ast-spec +# [5.38.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.37.0...v5.38.0) (2022-09-19) +**Note:** Version bump only for package @typescript-eslint/ast-spec +# [5.37.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.2...v5.37.0) (2022-09-12) +**Note:** Version bump only for package @typescript-eslint/ast-spec -# [5.36.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.1...v5.36.0) (2022-08-30) +## [5.36.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.1...v5.36.2) (2022-09-05) **Note:** Version bump only for package @typescript-eslint/ast-spec +## [5.36.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.0...v5.36.1) (2022-08-30) +**Note:** Version bump only for package @typescript-eslint/ast-spec +# [5.36.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.1...v5.36.0) (2022-08-30) +**Note:** Version bump only for package @typescript-eslint/ast-spec ## [5.35.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.0...v5.35.1) (2022-08-24) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - # [5.35.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.34.0...v5.35.0) (2022-08-24) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - # [5.34.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.1...v5.34.0) (2022-08-22) - ### Bug Fixes -* **ast-spec:** NewExpression argument can be SpreadElement now ([#5422](https://github.com/typescript-eslint/typescript-eslint/issues/5422)) ([3ced62f](https://github.com/typescript-eslint/typescript-eslint/commit/3ced62fb8474ed377c1336ac3e855f0270ce9beb)) - - - - +- **ast-spec:** NewExpression argument can be SpreadElement now ([#5422](https://github.com/typescript-eslint/typescript-eslint/issues/5422)) ([3ced62f](https://github.com/typescript-eslint/typescript-eslint/commit/3ced62fb8474ed377c1336ac3e855f0270ce9beb)) ## [5.33.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.0...v5.33.1) (2022-08-15) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - # [5.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.32.0...v5.33.0) (2022-08-08) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - # [5.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.31.0...v5.32.0) (2022-08-01) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - # [5.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.7...v5.31.0) (2022-07-25) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - ## [5.30.7](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.6...v5.30.7) (2022-07-18) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - ## [5.30.6](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.5...v5.30.6) (2022-07-11) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - ## [5.30.5](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.4...v5.30.5) (2022-07-04) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - ## [5.30.4](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.3...v5.30.4) (2022-07-03) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - ## [5.30.3](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.2...v5.30.3) (2022-07-01) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - ## [5.30.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.1...v5.30.2) (2022-07-01) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - ## 5.30.1 (2022-07-01) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - # [5.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.29.0...v5.30.0) (2022-06-27) - ### Features -* treat `this` in `typeof this` as a `ThisExpression` ([#4382](https://github.com/typescript-eslint/typescript-eslint/issues/4382)) ([b04b2ce](https://github.com/typescript-eslint/typescript-eslint/commit/b04b2ce1ba90d94718891f2562dd210a6d7b8609)) - - - - +- treat `this` in `typeof this` as a `ThisExpression` ([#4382](https://github.com/typescript-eslint/typescript-eslint/issues/4382)) ([b04b2ce](https://github.com/typescript-eslint/typescript-eslint/commit/b04b2ce1ba90d94718891f2562dd210a6d7b8609)) # [5.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.28.0...v5.29.0) (2022-06-20) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - # [5.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.1...v5.28.0) (2022-06-13) - ### Features -* **ast-spec:** extract `AssignmentOperatorToText` ([#3570](https://github.com/typescript-eslint/typescript-eslint/issues/3570)) ([45f75e6](https://github.com/typescript-eslint/typescript-eslint/commit/45f75e6b869f4160a45a6890d794aba004356ad7)) - - - - +- **ast-spec:** extract `AssignmentOperatorToText` ([#3570](https://github.com/typescript-eslint/typescript-eslint/issues/3570)) ([45f75e6](https://github.com/typescript-eslint/typescript-eslint/commit/45f75e6b869f4160a45a6890d794aba004356ad7)) ## [5.27.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.0...v5.27.1) (2022-06-06) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - # [5.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.26.0...v5.27.0) (2022-05-30) - ### Features -* [4.7] support new extensions ([#5027](https://github.com/typescript-eslint/typescript-eslint/issues/5027)) ([efc147b](https://github.com/typescript-eslint/typescript-eslint/commit/efc147b04dce52ab17415b6a4ae4076b944b9036)) -* [TS4.7] support type parameters for `typeof` ([#5067](https://github.com/typescript-eslint/typescript-eslint/issues/5067)) ([836de79](https://github.com/typescript-eslint/typescript-eslint/commit/836de79e8d1bff43149168cc913a4c2b60e79bf6)) - - - - +- [4.7] support new extensions ([#5027](https://github.com/typescript-eslint/typescript-eslint/issues/5027)) ([efc147b](https://github.com/typescript-eslint/typescript-eslint/commit/efc147b04dce52ab17415b6a4ae4076b944b9036)) +- [TS4.7] support type parameters for `typeof` ([#5067](https://github.com/typescript-eslint/typescript-eslint/issues/5067)) ([836de79](https://github.com/typescript-eslint/typescript-eslint/commit/836de79e8d1bff43149168cc913a4c2b60e79bf6)) # [5.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.25.0...v5.26.0) (2022-05-23) - ### Bug Fixes -* **ast-spec:** add `SpreadElement` to `ArrayExpression.elements` ([#5025](https://github.com/typescript-eslint/typescript-eslint/issues/5025)) ([9f3121b](https://github.com/typescript-eslint/typescript-eslint/commit/9f3121b228b9c066bff7a6011aecf269ac55f17c)) - +- **ast-spec:** add `SpreadElement` to `ArrayExpression.elements` ([#5025](https://github.com/typescript-eslint/typescript-eslint/issues/5025)) ([9f3121b](https://github.com/typescript-eslint/typescript-eslint/commit/9f3121b228b9c066bff7a6011aecf269ac55f17c)) ### Features -* [4.7] support instantiation expressions ([#4938](https://github.com/typescript-eslint/typescript-eslint/issues/4938)) ([79fbc77](https://github.com/typescript-eslint/typescript-eslint/commit/79fbc7743ae5dce3190f8168776e0204755390ad)) -* [4.7] support optional variance annotation ([#4831](https://github.com/typescript-eslint/typescript-eslint/issues/4831)) ([7e7b24c](https://github.com/typescript-eslint/typescript-eslint/commit/7e7b24c196e6d968e48f97f46feae5e7027e22d2)) - - - - +- [4.7] support instantiation expressions ([#4938](https://github.com/typescript-eslint/typescript-eslint/issues/4938)) ([79fbc77](https://github.com/typescript-eslint/typescript-eslint/commit/79fbc7743ae5dce3190f8168776e0204755390ad)) +- [4.7] support optional variance annotation ([#4831](https://github.com/typescript-eslint/typescript-eslint/issues/4831)) ([7e7b24c](https://github.com/typescript-eslint/typescript-eslint/commit/7e7b24c196e6d968e48f97f46feae5e7027e22d2)) # [5.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.24.0...v5.25.0) (2022-05-17) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - # [5.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.23.0...v5.24.0) (2022-05-16) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - # [5.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.22.0...v5.23.0) (2022-05-09) - ### Bug Fixes -* **ast-spec:** correct `AwaitExpression.argument` type ([#4880](https://github.com/typescript-eslint/typescript-eslint/issues/4880)) ([3ec5f53](https://github.com/typescript-eslint/typescript-eslint/commit/3ec5f53bad79b133ef5dee71c402160b3acf13cf)) - - - - +- **ast-spec:** correct `AwaitExpression.argument` type ([#4880](https://github.com/typescript-eslint/typescript-eslint/issues/4880)) ([3ec5f53](https://github.com/typescript-eslint/typescript-eslint/commit/3ec5f53bad79b133ef5dee71c402160b3acf13cf)) # [5.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.21.0...v5.22.0) (2022-05-02) - ### Features -* **ast-spec:** add fixture test framework and some initial fixtures ([#3258](https://github.com/typescript-eslint/typescript-eslint/issues/3258)) ([f3cf87b](https://github.com/typescript-eslint/typescript-eslint/commit/f3cf87bf20fd0542f92a96a318aa9ee5bf23c1f6)) - - - - +- **ast-spec:** add fixture test framework and some initial fixtures ([#3258](https://github.com/typescript-eslint/typescript-eslint/issues/3258)) ([f3cf87b](https://github.com/typescript-eslint/typescript-eslint/commit/f3cf87bf20fd0542f92a96a318aa9ee5bf23c1f6)) # [5.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.20.0...v5.21.0) (2022-04-25) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - # [5.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.19.0...v5.20.0) (2022-04-18) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - # [5.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.18.0...v5.19.0) (2022-04-11) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - # [5.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.17.0...v5.18.0) (2022-04-04) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - # [5.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.16.0...v5.17.0) (2022-03-28) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - # [5.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.15.0...v5.16.0) (2022-03-21) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - # [5.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.14.0...v5.15.0) (2022-03-14) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - # [5.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.13.0...v5.14.0) (2022-03-07) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - # [5.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.1...v5.13.0) (2022-02-28) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - ## [5.12.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.0...v5.12.1) (2022-02-21) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - # [5.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.11.0...v5.12.0) (2022-02-14) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - # [5.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.2...v5.11.0) (2022-02-07) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - ## [5.10.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.1...v5.10.2) (2022-01-31) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - ## [5.10.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.0...v5.10.1) (2022-01-24) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - # [5.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.1...v5.10.0) (2022-01-17) - ### Features -* rename `experimental-utils` to `utils` and make `experimental-utils` an alias to the new package ([#4172](https://github.com/typescript-eslint/typescript-eslint/issues/4172)) ([1d55a75](https://github.com/typescript-eslint/typescript-eslint/commit/1d55a7511b38d8e2b2eabe59f639e0a865e6c93f)) - - - - +- rename `experimental-utils` to `utils` and make `experimental-utils` an alias to the new package ([#4172](https://github.com/typescript-eslint/typescript-eslint/issues/4172)) ([1d55a75](https://github.com/typescript-eslint/typescript-eslint/commit/1d55a7511b38d8e2b2eabe59f639e0a865e6c93f)) ## [5.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.0...v5.9.1) (2022-01-10) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - # [5.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.1...v5.9.0) (2022-01-03) - ### Features -* **experimental-utils:** move isTypeReadonly from eslint-plugin to experimental-utils ([#3658](https://github.com/typescript-eslint/typescript-eslint/issues/3658)) ([a9eb0b9](https://github.com/typescript-eslint/typescript-eslint/commit/a9eb0b9eb2db291ea36065ec34f84bf5c5504b43)) - - - - +- **experimental-utils:** move isTypeReadonly from eslint-plugin to experimental-utils ([#3658](https://github.com/typescript-eslint/typescript-eslint/issues/3658)) ([a9eb0b9](https://github.com/typescript-eslint/typescript-eslint/commit/a9eb0b9eb2db291ea36065ec34f84bf5c5504b43)) ## [5.8.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.0...v5.8.1) (2021-12-27) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - # [5.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.7.0...v5.8.0) (2021-12-20) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - # [5.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.6.0...v5.7.0) (2021-12-13) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - # [5.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.5.0...v5.6.0) (2021-12-06) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - # [5.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.4.0...v5.5.0) (2021-11-29) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - # [5.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.3.1...v5.4.0) (2021-11-15) - ### Features -* **typescript-estree:** support Import Assertions ([#4074](https://github.com/typescript-eslint/typescript-eslint/issues/4074)) ([ae0fb5a](https://github.com/typescript-eslint/typescript-eslint/commit/ae0fb5a591958216b7df656e66b1dfe464898167)) -* **typescript-estree:** support private fields in-in syntax ([#4075](https://github.com/typescript-eslint/typescript-eslint/issues/4075)) ([939d8ea](https://github.com/typescript-eslint/typescript-eslint/commit/939d8eac547fb1734aa00f1ea01cc6eae0b4280a)) -* **typescript-estree:** support type-only module specifiers ([#4076](https://github.com/typescript-eslint/typescript-eslint/issues/4076)) ([77baa92](https://github.com/typescript-eslint/typescript-eslint/commit/77baa9203638e888a76e21003a278a8da386e133)) - - - - +- **typescript-estree:** support Import Assertions ([#4074](https://github.com/typescript-eslint/typescript-eslint/issues/4074)) ([ae0fb5a](https://github.com/typescript-eslint/typescript-eslint/commit/ae0fb5a591958216b7df656e66b1dfe464898167)) +- **typescript-estree:** support private fields in-in syntax ([#4075](https://github.com/typescript-eslint/typescript-eslint/issues/4075)) ([939d8ea](https://github.com/typescript-eslint/typescript-eslint/commit/939d8eac547fb1734aa00f1ea01cc6eae0b4280a)) +- **typescript-estree:** support type-only module specifiers ([#4076](https://github.com/typescript-eslint/typescript-eslint/issues/4076)) ([77baa92](https://github.com/typescript-eslint/typescript-eslint/commit/77baa9203638e888a76e21003a278a8da386e133)) ## [5.3.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.3.0...v5.3.1) (2021-11-08) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - # [5.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.2.0...v5.3.0) (2021-11-01) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - # [5.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.1.0...v5.2.0) (2021-10-25) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - # [5.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.0.0...v5.1.0) (2021-10-18) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - # [5.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.33.0...v5.0.0) (2021-10-11) - ### Bug Fixes -* **typescript-estree:** change `source` of ExportNamedDeclaration to Literal from Expression ([#3763](https://github.com/typescript-eslint/typescript-eslint/issues/3763)) ([dc5a0f5](https://github.com/typescript-eslint/typescript-eslint/commit/dc5a0f5104b400f4422b8d67ecfc6cc7a32613a2)) - +- **typescript-estree:** change `source` of ExportNamedDeclaration to Literal from Expression ([#3763](https://github.com/typescript-eslint/typescript-eslint/issues/3763)) ([dc5a0f5](https://github.com/typescript-eslint/typescript-eslint/commit/dc5a0f5104b400f4422b8d67ecfc6cc7a32613a2)) ### Features -* **ast-spec:** bring `Node` objects in line with ESTree ([#3771](https://github.com/typescript-eslint/typescript-eslint/issues/3771)) ([dd14064](https://github.com/typescript-eslint/typescript-eslint/commit/dd140643b457aa515cc21fcda2b3cd4acc2a1c5c)) -* align class property representation with ESTree ([#3806](https://github.com/typescript-eslint/typescript-eslint/issues/3806)) ([22fa5c0](https://github.com/typescript-eslint/typescript-eslint/commit/22fa5c0c4705ed2898f00b7cacc5dd642d859275)), closes [#3430](https://github.com/typescript-eslint/typescript-eslint/issues/3430) [#3077](https://github.com/typescript-eslint/typescript-eslint/issues/3077) -* remove `TSParenthesizedType` ([#3340](https://github.com/typescript-eslint/typescript-eslint/issues/3340)) ([c8ee432](https://github.com/typescript-eslint/typescript-eslint/commit/c8ee43269faea4c04ec02eaa2b81a0aa6eec5d3e)), closes [#3136](https://github.com/typescript-eslint/typescript-eslint/issues/3136) -* support `PrivateIdentifier` ([#3808](https://github.com/typescript-eslint/typescript-eslint/issues/3808)) ([0eefe5e](https://github.com/typescript-eslint/typescript-eslint/commit/0eefe5e49d21af3f1e3e2d9a90c2e49929863ac2)), closes [#3430](https://github.com/typescript-eslint/typescript-eslint/issues/3430) [#2933](https://github.com/typescript-eslint/typescript-eslint/issues/2933) -* **eslint-plugin:** removed value from abstract property nodes ([#3765](https://github.com/typescript-eslint/typescript-eslint/issues/3765)) ([5823524](https://github.com/typescript-eslint/typescript-eslint/commit/58235241714596b641a1e8b39c569e561e0039b4)), closes [#3748](https://github.com/typescript-eslint/typescript-eslint/issues/3748) - - - - +- **ast-spec:** bring `Node` objects in line with ESTree ([#3771](https://github.com/typescript-eslint/typescript-eslint/issues/3771)) ([dd14064](https://github.com/typescript-eslint/typescript-eslint/commit/dd140643b457aa515cc21fcda2b3cd4acc2a1c5c)) +- align class property representation with ESTree ([#3806](https://github.com/typescript-eslint/typescript-eslint/issues/3806)) ([22fa5c0](https://github.com/typescript-eslint/typescript-eslint/commit/22fa5c0c4705ed2898f00b7cacc5dd642d859275)), closes [#3430](https://github.com/typescript-eslint/typescript-eslint/issues/3430) [#3077](https://github.com/typescript-eslint/typescript-eslint/issues/3077) +- remove `TSParenthesizedType` ([#3340](https://github.com/typescript-eslint/typescript-eslint/issues/3340)) ([c8ee432](https://github.com/typescript-eslint/typescript-eslint/commit/c8ee43269faea4c04ec02eaa2b81a0aa6eec5d3e)), closes [#3136](https://github.com/typescript-eslint/typescript-eslint/issues/3136) +- support `PrivateIdentifier` ([#3808](https://github.com/typescript-eslint/typescript-eslint/issues/3808)) ([0eefe5e](https://github.com/typescript-eslint/typescript-eslint/commit/0eefe5e49d21af3f1e3e2d9a90c2e49929863ac2)), closes [#3430](https://github.com/typescript-eslint/typescript-eslint/issues/3430) [#2933](https://github.com/typescript-eslint/typescript-eslint/issues/2933) +- **eslint-plugin:** removed value from abstract property nodes ([#3765](https://github.com/typescript-eslint/typescript-eslint/issues/3765)) ([5823524](https://github.com/typescript-eslint/typescript-eslint/commit/58235241714596b641a1e8b39c569e561e0039b4)), closes [#3748](https://github.com/typescript-eslint/typescript-eslint/issues/3748) # [4.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.32.0...v4.33.0) (2021-10-04) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - # [4.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.2...v4.32.0) (2021-09-27) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - ## [4.31.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.1...v4.31.2) (2021-09-20) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - ## [4.31.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.0...v4.31.1) (2021-09-13) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - # [4.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.30.0...v4.31.0) (2021-09-06) - ### Bug Fixes -* **ast-spec:** remove duplicate union types from `Expression` ([#3770](https://github.com/typescript-eslint/typescript-eslint/issues/3770)) ([463e768](https://github.com/typescript-eslint/typescript-eslint/commit/463e768978731d019345f6552d7fd7a073a80192)) - +- **ast-spec:** remove duplicate union types from `Expression` ([#3770](https://github.com/typescript-eslint/typescript-eslint/issues/3770)) ([463e768](https://github.com/typescript-eslint/typescript-eslint/commit/463e768978731d019345f6552d7fd7a073a80192)) ### Features -* **eslint-plugin:** add extension rule `padding-line-between-statements` ([#3418](https://github.com/typescript-eslint/typescript-eslint/issues/3418)) ([f79ae9b](https://github.com/typescript-eslint/typescript-eslint/commit/f79ae9b58e82f4fddef640a34a1d7ff92b763e65)) - - - - +- **eslint-plugin:** add extension rule `padding-line-between-statements` ([#3418](https://github.com/typescript-eslint/typescript-eslint/issues/3418)) ([f79ae9b](https://github.com/typescript-eslint/typescript-eslint/commit/f79ae9b58e82f4fddef640a34a1d7ff92b763e65)) # [4.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.3...v4.30.0) (2021-08-30) - ### Features -* **typescript-estree:** add support for class static blocks ([#3730](https://github.com/typescript-eslint/typescript-eslint/issues/3730)) ([f81831b](https://github.com/typescript-eslint/typescript-eslint/commit/f81831bd279a32da6dbab0f1c061053ea43965f6)) - - - - +- **typescript-estree:** add support for class static blocks ([#3730](https://github.com/typescript-eslint/typescript-eslint/issues/3730)) ([f81831b](https://github.com/typescript-eslint/typescript-eslint/commit/f81831bd279a32da6dbab0f1c061053ea43965f6)) ## [4.29.3](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.2...v4.29.3) (2021-08-23) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - ## [4.29.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.1...v4.29.2) (2021-08-16) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - ## [4.29.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.0...v4.29.1) (2021-08-09) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - # [4.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.5...v4.29.0) (2021-08-02) - ### Features -* **ast-spec:** extract `ExportKind` & `ImportKind` ([#3564](https://github.com/typescript-eslint/typescript-eslint/issues/3564)) ([120d566](https://github.com/typescript-eslint/typescript-eslint/commit/120d566c980c61d3823fbe8b2db30d76b8c31140)) -* **ast-spec:** make `BaseNode` & `BaseToken` more type-safe ([#3560](https://github.com/typescript-eslint/typescript-eslint/issues/3560)) ([a6c5604](https://github.com/typescript-eslint/typescript-eslint/commit/a6c5604b65b6330d047aa016fc46b8a597a6ae58)) - - - - +- **ast-spec:** extract `ExportKind` & `ImportKind` ([#3564](https://github.com/typescript-eslint/typescript-eslint/issues/3564)) ([120d566](https://github.com/typescript-eslint/typescript-eslint/commit/120d566c980c61d3823fbe8b2db30d76b8c31140)) +- **ast-spec:** make `BaseNode` & `BaseToken` more type-safe ([#3560](https://github.com/typescript-eslint/typescript-eslint/issues/3560)) ([a6c5604](https://github.com/typescript-eslint/typescript-eslint/commit/a6c5604b65b6330d047aa016fc46b8a597a6ae58)) ## [4.28.5](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.4...v4.28.5) (2021-07-26) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - ## [4.28.4](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.3...v4.28.4) (2021-07-19) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - ## [4.28.3](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.2...v4.28.3) (2021-07-12) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - ## [4.28.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.1...v4.28.2) (2021-07-05) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - ## [4.28.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.0...v4.28.1) (2021-06-28) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - # [4.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.27.0...v4.28.0) (2021-06-21) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - # [4.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.1...v4.27.0) (2021-06-14) - ### Bug Fixes -* **typescript-estree:** support override modifier for parameter property ([#3485](https://github.com/typescript-eslint/typescript-eslint/issues/3485)) ([33b9f69](https://github.com/typescript-eslint/typescript-eslint/commit/33b9f69a681cd3219a2acca5b0b2fa67609f099e)) - +- **typescript-estree:** support override modifier for parameter property ([#3485](https://github.com/typescript-eslint/typescript-eslint/issues/3485)) ([33b9f69](https://github.com/typescript-eslint/typescript-eslint/commit/33b9f69a681cd3219a2acca5b0b2fa67609f099e)) ### Features -* **ast-spec:** specify `LogicalExpression`'s `operator` type ([#3497](https://github.com/typescript-eslint/typescript-eslint/issues/3497)) ([9e343fd](https://github.com/typescript-eslint/typescript-eslint/commit/9e343fdaa0b04ed007b873c781e8cc98fc1fb7f5)) -* **ast-spec:** specify `PunctuatorToken`'s `value` type ([#3496](https://github.com/typescript-eslint/typescript-eslint/issues/3496)) ([fdb1d81](https://github.com/typescript-eslint/typescript-eslint/commit/fdb1d81f0fcf75a9216e6a90469f18c24c91f718)) - - - - +- **ast-spec:** specify `LogicalExpression`'s `operator` type ([#3497](https://github.com/typescript-eslint/typescript-eslint/issues/3497)) ([9e343fd](https://github.com/typescript-eslint/typescript-eslint/commit/9e343fdaa0b04ed007b873c781e8cc98fc1fb7f5)) +- **ast-spec:** specify `PunctuatorToken`'s `value` type ([#3496](https://github.com/typescript-eslint/typescript-eslint/issues/3496)) ([fdb1d81](https://github.com/typescript-eslint/typescript-eslint/commit/fdb1d81f0fcf75a9216e6a90469f18c24c91f718)) ## [4.26.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.0...v4.26.1) (2021-06-07) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - # [4.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.25.0...v4.26.0) (2021-05-31) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - # [4.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.24.0...v4.25.0) (2021-05-24) - ### Features -* **typescript-estree:** [TS4.3] support overrides on class members ([#3429](https://github.com/typescript-eslint/typescript-eslint/issues/3429)) ([21d1b62](https://github.com/typescript-eslint/typescript-eslint/commit/21d1b62a0b84b502d2cf12674b3d141994a3ffd4)) -* **typescript-estree:** add support for getter/setter signatures on types ([#3427](https://github.com/typescript-eslint/typescript-eslint/issues/3427)) ([b830b7f](https://github.com/typescript-eslint/typescript-eslint/commit/b830b7f4e8a99affc8af8b53cb83371ef81d7032)), closes [#3272](https://github.com/typescript-eslint/typescript-eslint/issues/3272) [#3272](https://github.com/typescript-eslint/typescript-eslint/issues/3272) - - - - +- **typescript-estree:** [TS4.3] support overrides on class members ([#3429](https://github.com/typescript-eslint/typescript-eslint/issues/3429)) ([21d1b62](https://github.com/typescript-eslint/typescript-eslint/commit/21d1b62a0b84b502d2cf12674b3d141994a3ffd4)) +- **typescript-estree:** add support for getter/setter signatures on types ([#3427](https://github.com/typescript-eslint/typescript-eslint/issues/3427)) ([b830b7f](https://github.com/typescript-eslint/typescript-eslint/commit/b830b7f4e8a99affc8af8b53cb83371ef81d7032)), closes [#3272](https://github.com/typescript-eslint/typescript-eslint/issues/3272) [#3272](https://github.com/typescript-eslint/typescript-eslint/issues/3272) # [4.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.23.0...v4.24.0) (2021-05-17) **Note:** Version bump only for package @typescript-eslint/ast-spec - - - - # [4.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.1...v4.23.0) (2021-05-10) - ### Features -* refactor to split AST specification out as its own module ([#2911](https://github.com/typescript-eslint/typescript-eslint/issues/2911)) ([25ea953](https://github.com/typescript-eslint/typescript-eslint/commit/25ea953cc60b118bd385c71e0a9b61c286c26fcf)) +- refactor to split AST specification out as its own module ([#2911](https://github.com/typescript-eslint/typescript-eslint/issues/2911)) ([25ea953](https://github.com/typescript-eslint/typescript-eslint/commit/25ea953cc60b118bd385c71e0a9b61c286c26fcf)) diff --git a/packages/ast-spec/LICENSE b/packages/ast-spec/LICENSE index 7e7370143b2..a1164108d4d 100644 --- a/packages/ast-spec/LICENSE +++ b/packages/ast-spec/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2019 TypeScript ESLint and other contributors +Copyright (c) 2019 typescript-eslint and other contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/ast-spec/README.md b/packages/ast-spec/README.md index 388241c0061..43536bb821b 100644 --- a/packages/ast-spec/README.md +++ b/packages/ast-spec/README.md @@ -1,24 +1,16 @@ -

TypeScript-ESTree AST Specification

+# `@typescript-eslint/ast-spec` -

- CI - NPM Version - NPM Downloads -

+> Complete specification for the TypeScript-ESTree AST -This is the complete specification for the TypeScript-ESTree AST. - -It includes: +This package includes: - Node definitions as TypeScript types (the specification) - Logic for converting from the TypeScript AST to the TypeScript-ESTree AST. - Tests/Fixtures/Examples for each Node -**You probably don't want to use it directly.** - -If you're building an ESLint plugin, consider using [`@typescript-eslint/utils`](../utils) and [`@typescript-eslint/type-utils`](../type-utils). -If you're parsing TypeScript code, consider using [`@typescript-eslint/typescript-estree`](../typescript-estree). +## ✋ Internal Package -## Contributing +This is an _internal package_ to the [typescript-eslint monorepo](https://github.com/typescript-eslint/typescript-eslint). +You likely don't want to use it directly. -[See the contributing guide here](../../CONTRIBUTING.md) +👉 See **https://typescript-eslint.io** for docs on typescript-eslint. diff --git a/packages/ast-spec/package.json b/packages/ast-spec/package.json index a09416ecb35..dd8390cfc5d 100644 --- a/packages/ast-spec/package.json +++ b/packages/ast-spec/package.json @@ -1,7 +1,7 @@ { "name": "@typescript-eslint/ast-spec", - "version": "5.39.0", - "description": "TypeScript-ESTree AST spec", + "version": "5.46.1", + "description": "Complete specification for the TypeScript-ESTree AST", "private": true, "keywords": [ "eslint", @@ -34,7 +34,7 @@ "postclean": "rimraf dist && rimraf _ts3.4 && rimraf .rollup.cache && rimraf coverage", "clean-fixtures": "rimraf -g \"./src/**/fixtures/**/snapshots\"", "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", - "lint": "eslint . --ignore-path='../../.eslintignore'", + "lint": "nx lint", "test": "jest", "typecheck": "tsc -p tsconfig.json --noEmit" }, diff --git a/packages/ast-spec/project.json b/packages/ast-spec/project.json index 3cb2cf7be65..682cdbf3d91 100644 --- a/packages/ast-spec/project.json +++ b/packages/ast-spec/project.json @@ -1,5 +1,23 @@ { - "root": "packages/ast-spec", + "name": "ast-spec", + "$schema": "../../node_modules/nx/schemas/project-schema.json", "type": "library", - "implicitDependencies": [] + "implicitDependencies": [], + "targets": { + "build": { + "executor": "nx:run-commands", + "options": { + "cwd": "packages/ast-spec", + "commands": ["yarn build"] + }, + "outputs": ["packages/ast-spec/dist/**/*.ts"] + }, + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["packages/ast-spec/**/*.ts"] + } + } + } } diff --git a/packages/ast-spec/src/ast-node-types.ts b/packages/ast-spec/src/ast-node-types.ts index ff90dd1ee18..7a637489eb0 100644 --- a/packages/ast-spec/src/ast-node-types.ts +++ b/packages/ast-spec/src/ast-node-types.ts @@ -1,4 +1,5 @@ export enum AST_NODE_TYPES { + AccessorProperty = 'AccessorProperty', ArrayExpression = 'ArrayExpression', ArrayPattern = 'ArrayPattern', ArrowFunctionExpression = 'ArrowFunctionExpression', @@ -90,6 +91,7 @@ export enum AST_NODE_TYPES { /** * TS-prefixed nodes */ + TSAbstractAccessorProperty = 'TSAbstractAccessorProperty', TSAbstractKeyword = 'TSAbstractKeyword', TSAbstractMethodDefinition = 'TSAbstractMethodDefinition', TSAbstractPropertyDefinition = 'TSAbstractPropertyDefinition', @@ -145,6 +147,7 @@ export enum AST_NODE_TYPES { TSQualifiedName = 'TSQualifiedName', TSReadonlyKeyword = 'TSReadonlyKeyword', TSRestType = 'TSRestType', + TSSatisfiesExpression = 'TSSatisfiesExpression', TSStaticKeyword = 'TSStaticKeyword', TSStringKeyword = 'TSStringKeyword', TSSymbolKeyword = 'TSSymbolKeyword', diff --git a/packages/ast-spec/src/base/BaseNode.ts b/packages/ast-spec/src/base/BaseNode.ts index 797b3d35132..6c753efd731 100644 --- a/packages/ast-spec/src/base/BaseNode.ts +++ b/packages/ast-spec/src/base/BaseNode.ts @@ -3,6 +3,8 @@ import type { AST_NODE_TYPES } from '../ast-node-types'; import type { NodeOrTokenData } from './NodeOrTokenData'; export interface BaseNode extends NodeOrTokenData { + type: AST_NODE_TYPES; + /** * The parent node of the current node * @@ -10,6 +12,4 @@ export interface BaseNode extends NodeOrTokenData { * while traversing. */ // parent?: Node; - - type: AST_NODE_TYPES; } diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/kind-type/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/kind-type/snapshots/1-TSESTree-AST.shot deleted file mode 100644 index 4e1ab2405d4..00000000000 --- a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/kind-type/snapshots/1-TSESTree-AST.shot +++ /dev/null @@ -1,48 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures declaration ExportAllDeclaration kind-type TSESTree - AST 1`] = ` -Program { - type: "Program", - body: Array [ - ExportAllDeclaration { - type: "ExportAllDeclaration", - assertions: Array [], - exported: Identifier { - type: "Identifier", - name: "x", - - range: [17, 18], - loc: { - start: { column: 17, line: 1 }, - end: { column: 18, line: 1 }, - }, - }, - exportKind: "type", - source: Literal { - type: "Literal", - raw: "'a'", - value: "a", - - range: [24, 27], - loc: { - start: { column: 24, line: 1 }, - end: { column: 27, line: 1 }, - }, - }, - - range: [0, 28], - loc: { - start: { column: 0, line: 1 }, - end: { column: 28, line: 1 }, - }, - }, - ], - sourceType: "module", - - range: [0, 29], - loc: { - start: { column: 0, line: 1 }, - end: { column: 0, line: 2 }, - }, -} -`; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/kind-type/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/kind-type/snapshots/2-TSESTree-Tokens.shot deleted file mode 100644 index f5bfa8f5615..00000000000 --- a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/kind-type/snapshots/2-TSESTree-Tokens.shot +++ /dev/null @@ -1,86 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures declaration ExportAllDeclaration kind-type TSESTree - Tokens 1`] = ` -Array [ - Keyword { - type: "Keyword", - value: "export", - - range: [0, 6], - loc: { - start: { column: 0, line: 1 }, - end: { column: 6, line: 1 }, - }, - }, - Identifier { - type: "Identifier", - value: "type", - - range: [7, 11], - loc: { - start: { column: 7, line: 1 }, - end: { column: 11, line: 1 }, - }, - }, - Punctuator { - type: "Punctuator", - value: "*", - - range: [12, 13], - loc: { - start: { column: 12, line: 1 }, - end: { column: 13, line: 1 }, - }, - }, - Identifier { - type: "Identifier", - value: "as", - - range: [14, 16], - loc: { - start: { column: 14, line: 1 }, - end: { column: 16, line: 1 }, - }, - }, - Identifier { - type: "Identifier", - value: "x", - - range: [17, 18], - loc: { - start: { column: 17, line: 1 }, - end: { column: 18, line: 1 }, - }, - }, - Identifier { - type: "Identifier", - value: "from", - - range: [19, 23], - loc: { - start: { column: 19, line: 1 }, - end: { column: 23, line: 1 }, - }, - }, - String { - type: "String", - value: "'a'", - - range: [24, 27], - loc: { - start: { column: 24, line: 1 }, - end: { column: 27, line: 1 }, - }, - }, - Punctuator { - type: "Punctuator", - value: ";", - - range: [27, 28], - loc: { - start: { column: 27, line: 1 }, - end: { column: 28, line: 1 }, - }, - }, -] -`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/1-TSESTree-AST.shot deleted file mode 100644 index 9136ca295cb..00000000000 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/1-TSESTree-AST.shot +++ /dev/null @@ -1,102 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures declaration ExportNamedDeclaration assertion TSESTree - AST 1`] = ` -Program { - type: "Program", - body: Array [ - ExportNamedDeclaration { - type: "ExportNamedDeclaration", - assertions: Array [ - ImportAttribute { - type: "ImportAttribute", - key: Identifier { - type: "Identifier", - name: "type", - - range: [35, 39], - loc: { - start: { column: 35, line: 1 }, - end: { column: 39, line: 1 }, - }, - }, - value: Literal { - type: "Literal", - raw: "'json'", - value: "json", - - range: [41, 47], - loc: { - start: { column: 41, line: 1 }, - end: { column: 47, line: 1 }, - }, - }, - - range: [35, 47], - loc: { - start: { column: 35, line: 1 }, - end: { column: 47, line: 1 }, - }, - }, - ], - declaration: null, - exportKind: "value", - source: Literal { - type: "Literal", - raw: "'mod'", - value: "mod", - - range: [20, 25], - loc: { - start: { column: 20, line: 1 }, - end: { column: 25, line: 1 }, - }, - }, - specifiers: Array [ - ExportSpecifier { - type: "ExportSpecifier", - exported: Identifier { - type: "Identifier", - name: "foo", - - range: [9, 12], - loc: { - start: { column: 9, line: 1 }, - end: { column: 12, line: 1 }, - }, - }, - exportKind: "value", - local: Identifier { - type: "Identifier", - name: "foo", - - range: [9, 12], - loc: { - start: { column: 9, line: 1 }, - end: { column: 12, line: 1 }, - }, - }, - - range: [9, 12], - loc: { - start: { column: 9, line: 1 }, - end: { column: 12, line: 1 }, - }, - }, - ], - - range: [0, 50], - loc: { - start: { column: 0, line: 1 }, - end: { column: 50, line: 1 }, - }, - }, - ], - sourceType: "module", - - range: [0, 51], - loc: { - start: { column: 0, line: 1 }, - end: { column: 0, line: 2 }, - }, -} -`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/2-TSESTree-Tokens.shot deleted file mode 100644 index 9a30eb2745c..00000000000 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/2-TSESTree-Tokens.shot +++ /dev/null @@ -1,136 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures declaration ExportNamedDeclaration assertion TSESTree - Tokens 1`] = ` -Array [ - Keyword { - type: "Keyword", - value: "export", - - range: [0, 6], - loc: { - start: { column: 0, line: 1 }, - end: { column: 6, line: 1 }, - }, - }, - Punctuator { - type: "Punctuator", - value: "{", - - range: [7, 8], - loc: { - start: { column: 7, line: 1 }, - end: { column: 8, line: 1 }, - }, - }, - Identifier { - type: "Identifier", - value: "foo", - - range: [9, 12], - loc: { - start: { column: 9, line: 1 }, - end: { column: 12, line: 1 }, - }, - }, - Punctuator { - type: "Punctuator", - value: "}", - - range: [13, 14], - loc: { - start: { column: 13, line: 1 }, - end: { column: 14, line: 1 }, - }, - }, - Identifier { - type: "Identifier", - value: "from", - - range: [15, 19], - loc: { - start: { column: 15, line: 1 }, - end: { column: 19, line: 1 }, - }, - }, - String { - type: "String", - value: "'mod'", - - range: [20, 25], - loc: { - start: { column: 20, line: 1 }, - end: { column: 25, line: 1 }, - }, - }, - Identifier { - type: "Identifier", - value: "assert", - - range: [26, 32], - loc: { - start: { column: 26, line: 1 }, - end: { column: 32, line: 1 }, - }, - }, - Punctuator { - type: "Punctuator", - value: "{", - - range: [33, 34], - loc: { - start: { column: 33, line: 1 }, - end: { column: 34, line: 1 }, - }, - }, - Identifier { - type: "Identifier", - value: "type", - - range: [35, 39], - loc: { - start: { column: 35, line: 1 }, - end: { column: 39, line: 1 }, - }, - }, - Punctuator { - type: "Punctuator", - value: ":", - - range: [39, 40], - loc: { - start: { column: 39, line: 1 }, - end: { column: 40, line: 1 }, - }, - }, - String { - type: "String", - value: "'json'", - - range: [41, 47], - loc: { - start: { column: 41, line: 1 }, - end: { column: 47, line: 1 }, - }, - }, - Punctuator { - type: "Punctuator", - value: "}", - - range: [48, 49], - loc: { - start: { column: 48, line: 1 }, - end: { column: 49, line: 1 }, - }, - }, - Punctuator { - type: "Punctuator", - value: ";", - - range: [49, 50], - loc: { - start: { column: 49, line: 1 }, - end: { column: 50, line: 1 }, - }, - }, -] -`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/3-Babel-AST.shot deleted file mode 100644 index b2ee980389e..00000000000 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/3-Babel-AST.shot +++ /dev/null @@ -1,102 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures declaration ExportNamedDeclaration assertion Babel - AST 1`] = ` -Program { - type: "Program", - body: Array [ - ExportNamedDeclaration { - type: "ExportNamedDeclaration", - assertions: Array [ - ImportAttribute { - type: "ImportAttribute", - key: Identifier { - type: "Identifier", - name: "type", - - range: [35, 39], - loc: { - start: { column: 35, line: 1 }, - end: { column: 39, line: 1 }, - }, - }, - value: Literal { - type: "Literal", - raw: "'json'", - value: "json", - - range: [41, 47], - loc: { - start: { column: 41, line: 1 }, - end: { column: 47, line: 1 }, - }, - }, - - range: [35, 47], - loc: { - start: { column: 35, line: 1 }, - end: { column: 47, line: 1 }, - }, - }, - ], - declaration: null, - exportKind: "value", - source: Literal { - type: "Literal", - raw: "'mod'", - value: "mod", - - range: [20, 25], - loc: { - start: { column: 20, line: 1 }, - end: { column: 25, line: 1 }, - }, - }, - specifiers: Array [ - ExportSpecifier { - type: "ExportSpecifier", - exported: Identifier { - type: "Identifier", - name: "foo", - - range: [9, 12], - loc: { - start: { column: 9, line: 1 }, - end: { column: 12, line: 1 }, - }, - }, - exportKind: "value", - local: Identifier { - type: "Identifier", - name: "foo", - - range: [9, 12], - loc: { - start: { column: 9, line: 1 }, - end: { column: 12, line: 1 }, - }, - }, - - range: [9, 12], - loc: { - start: { column: 9, line: 1 }, - end: { column: 12, line: 1 }, - }, - }, - ], - - range: [0, 50], - loc: { - start: { column: 0, line: 1 }, - end: { column: 50, line: 1 }, - }, - }, - ], - sourceType: "module", - - range: [0, 51], - loc: { - start: { column: 0, line: 1 }, - end: { column: 0, line: 2 }, - }, -} -`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/4-Babel-Tokens.shot deleted file mode 100644 index 95aa314bf6b..00000000000 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/4-Babel-Tokens.shot +++ /dev/null @@ -1,136 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures declaration ExportNamedDeclaration assertion Babel - Tokens 1`] = ` -Array [ - Keyword { - type: "Keyword", - value: "export", - - range: [0, 6], - loc: { - start: { column: 0, line: 1 }, - end: { column: 6, line: 1 }, - }, - }, - Punctuator { - type: "Punctuator", - value: "{", - - range: [7, 8], - loc: { - start: { column: 7, line: 1 }, - end: { column: 8, line: 1 }, - }, - }, - Identifier { - type: "Identifier", - value: "foo", - - range: [9, 12], - loc: { - start: { column: 9, line: 1 }, - end: { column: 12, line: 1 }, - }, - }, - Punctuator { - type: "Punctuator", - value: "}", - - range: [13, 14], - loc: { - start: { column: 13, line: 1 }, - end: { column: 14, line: 1 }, - }, - }, - Identifier { - type: "Identifier", - value: "from", - - range: [15, 19], - loc: { - start: { column: 15, line: 1 }, - end: { column: 19, line: 1 }, - }, - }, - String { - type: "String", - value: "'mod'", - - range: [20, 25], - loc: { - start: { column: 20, line: 1 }, - end: { column: 25, line: 1 }, - }, - }, - Identifier { - type: "Identifier", - value: "assert", - - range: [26, 32], - loc: { - start: { column: 26, line: 1 }, - end: { column: 32, line: 1 }, - }, - }, - Punctuator { - type: "Punctuator", - value: "{", - - range: [33, 34], - loc: { - start: { column: 33, line: 1 }, - end: { column: 34, line: 1 }, - }, - }, - Identifier { - type: "Identifier", - value: "type", - - range: [35, 39], - loc: { - start: { column: 35, line: 1 }, - end: { column: 39, line: 1 }, - }, - }, - Punctuator { - type: "Punctuator", - value: ":", - - range: [39, 40], - loc: { - start: { column: 39, line: 1 }, - end: { column: 40, line: 1 }, - }, - }, - String { - type: "String", - value: "'json'", - - range: [41, 47], - loc: { - start: { column: 41, line: 1 }, - end: { column: 47, line: 1 }, - }, - }, - Punctuator { - type: "Punctuator", - value: "}", - - range: [48, 49], - loc: { - start: { column: 48, line: 1 }, - end: { column: 49, line: 1 }, - }, - }, - Punctuator { - type: "Punctuator", - value: ";", - - range: [49, 50], - loc: { - start: { column: 49, line: 1 }, - end: { column: 50, line: 1 }, - }, - }, -] -`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/spec.ts b/packages/ast-spec/src/declaration/ExportNamedDeclaration/spec.ts index 061c53f4b46..b9b158eddb4 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/spec.ts +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/spec.ts @@ -46,7 +46,7 @@ export interface ExportNamedDeclarationWithoutSourceWithMultiple extends ExportNamedDeclarationBase { // this will always be empty array assertions: ImportAttribute[]; - declaration: NamedExportDeclarations; + declaration: null; source: null; specifiers: ExportSpecifier[]; } @@ -55,7 +55,7 @@ export interface ExportNamedDeclarationWithoutSourceWithSingle extends ExportNamedDeclarationBase { // this will always be empty array assertions: ImportAttribute[]; - declaration: null; + declaration: NamedExportDeclarations; source: null; // this will always be empty array specifiers: ExportSpecifier[]; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/async/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/async/snapshots/1-TSESTree-AST.shot deleted file mode 100644 index d01382249a1..00000000000 --- a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/async/snapshots/1-TSESTree-AST.shot +++ /dev/null @@ -1,40 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures declaration TSDeclareFunction async TSESTree - AST 1`] = ` -Program { - type: "Program", - body: Array [ - TSDeclareFunction { - type: "TSDeclareFunction", - async: true, - declare: true, - expression: false, - generator: false, - id: Identifier { - type: "Identifier", - name: "foo", - - range: [23, 26], - loc: { - start: { column: 23, line: 1 }, - end: { column: 26, line: 1 }, - }, - }, - params: Array [], - - range: [0, 29], - loc: { - start: { column: 0, line: 1 }, - end: { column: 29, line: 1 }, - }, - }, - ], - sourceType: "script", - - range: [0, 30], - loc: { - start: { column: 0, line: 1 }, - end: { column: 0, line: 2 }, - }, -} -`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-declare/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-declare/fixture.ts new file mode 100644 index 00000000000..2a4248c0bf8 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-declare/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + declare accessor foo: number; +} diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-declare/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-declare/snapshots/1-TSESTree-Error.shot new file mode 100644 index 00000000000..e9efe0512eb --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-declare/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty _error_ modifier-declare TSESTree - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-declare/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-declare/snapshots/2-Babel-Error.shot new file mode 100644 index 00000000000..7d44c5a9712 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-declare/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty _error_ modifier-declare Babel - Error 1`] = `[SyntaxError: Missing semicolon. (2:22)]`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-declare/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-declare/snapshots/3-Alignment-Error.shot new file mode 100644 index 00000000000..a6fbd60e31c --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-declare/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty _error_ modifier-declare Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/fixture.ts new file mode 100644 index 00000000000..3369657d82b --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + override accessor foo = 2; +} diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/snapshots/1-TSESTree-Error.shot new file mode 100644 index 00000000000..e1f58f42d42 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty _error_ modifier-override-with-no-extends TSESTree - Error 1`] = `"NO ERROR"`; 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 new file mode 100644 index 00000000000..071d521919f --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty _error_ modifier-override-with-no-extends Babel - Error 1`] = `[SyntaxError: This member cannot have an 'override' modifier because its containing class does not extend another class. (2:2)]`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/snapshots/3-Alignment-Error.shot new file mode 100644 index 00000000000..27d6eef74b0 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty _error_ modifier-override-with-no-extends Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/fixture.ts new file mode 100644 index 00000000000..5dc28758b4e --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + accessor 1 = 2; +} diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..00745c8a8d3 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,82 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-computed-complex TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + AccessorProperty { + type: "AccessorProperty", + computed: false, + declare: false, + key: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [23, 24], + loc: { + start: { column: 11, line: 2 }, + end: { column: 12, line: 2 }, + }, + }, + override: false, + static: false, + value: Literal { + type: "Literal", + raw: "2", + value: 2, + + range: [27, 28], + loc: { + start: { column: 15, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + + range: [14, 29], + loc: { + start: { column: 2, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + ], + + range: [10, 31], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..97c056640e7 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,96 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-computed-complex TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [14, 22], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [23, 24], + loc: { + start: { column: 11, line: 2 }, + end: { column: 12, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [25, 26], + loc: { + start: { column: 13, line: 2 }, + end: { column: 14, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "2", + + range: [27, 28], + loc: { + start: { column: 15, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [28, 29], + loc: { + start: { column: 16, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [30, 31], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..e52653f4094 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/3-Babel-AST.shot @@ -0,0 +1,80 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-computed-complex Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + ClassAccessorProperty { + type: "ClassAccessorProperty", + computed: false, + key: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [23, 24], + loc: { + start: { column: 11, line: 2 }, + end: { column: 12, line: 2 }, + }, + }, + static: false, + value: Literal { + type: "Literal", + raw: "2", + value: 2, + + range: [27, 28], + loc: { + start: { column: 15, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + + range: [14, 29], + loc: { + start: { column: 2, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + ], + + range: [10, 31], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..651eb331471 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,96 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-computed-complex Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [14, 22], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [23, 24], + loc: { + start: { column: 11, line: 2 }, + end: { column: 12, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [25, 26], + loc: { + start: { column: 13, line: 2 }, + end: { column: 14, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "2", + + range: [27, 28], + loc: { + start: { column: 15, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [28, 29], + loc: { + start: { column: 16, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [30, 31], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..b6b30dd18c6 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,88 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-computed-complex AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', + body: ClassBody { + type: 'ClassBody', + body: Array [ +- AccessorProperty { +- type: 'AccessorProperty', ++ ClassAccessorProperty { ++ type: 'ClassAccessorProperty', + computed: false, +- declare: false, + key: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [23, 24], + loc: { + start: { column: 11, line: 2 }, + end: { column: 12, line: 2 }, + }, + }, +- override: false, + static: false, + value: Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [27, 28], + loc: { + start: { column: 15, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + + range: [14, 29], + loc: { + start: { column: 2, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + ], + + range: [10, 31], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: 'Identifier', + name: 'Foo', + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, + }" +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..8375156efe1 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-computed-complex AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/fixture.ts new file mode 100644 index 00000000000..e6eb4123594 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + accessor [1] = 2; +} diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..abb1554d8a2 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,82 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-computed-number TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + AccessorProperty { + type: "AccessorProperty", + computed: true, + declare: false, + key: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [24, 25], + loc: { + start: { column: 12, line: 2 }, + end: { column: 13, line: 2 }, + }, + }, + override: false, + static: false, + value: Literal { + type: "Literal", + raw: "2", + value: 2, + + range: [29, 30], + loc: { + start: { column: 17, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, + + range: [14, 31], + loc: { + start: { column: 2, line: 2 }, + end: { column: 19, line: 2 }, + }, + }, + ], + + range: [10, 33], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 33], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 34], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..d12fe10489e --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,116 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-computed-number TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "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 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [24, 25], + loc: { + start: { column: 12, 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: [27, 28], + loc: { + start: { column: 15, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "2", + + range: [29, 30], + loc: { + start: { column: 17, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [30, 31], + loc: { + start: { column: 18, line: 2 }, + end: { column: 19, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [32, 33], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..69de24d530d --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/3-Babel-AST.shot @@ -0,0 +1,80 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-computed-number Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + ClassAccessorProperty { + type: "ClassAccessorProperty", + computed: true, + key: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [24, 25], + loc: { + start: { column: 12, line: 2 }, + end: { column: 13, line: 2 }, + }, + }, + static: false, + value: Literal { + type: "Literal", + raw: "2", + value: 2, + + range: [29, 30], + loc: { + start: { column: 17, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, + + range: [14, 31], + loc: { + start: { column: 2, line: 2 }, + end: { column: 19, line: 2 }, + }, + }, + ], + + range: [10, 33], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 33], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 34], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..e2dd78f3f2f --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,116 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-computed-number Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "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 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [24, 25], + loc: { + start: { column: 12, 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: [27, 28], + loc: { + start: { column: 15, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "2", + + range: [29, 30], + loc: { + start: { column: 17, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [30, 31], + loc: { + start: { column: 18, line: 2 }, + end: { column: 19, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [32, 33], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..bd3b115af80 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,88 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-computed-number AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', + body: ClassBody { + type: 'ClassBody', + body: Array [ +- AccessorProperty { +- type: 'AccessorProperty', ++ ClassAccessorProperty { ++ type: 'ClassAccessorProperty', + computed: true, +- declare: false, + key: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [24, 25], + loc: { + start: { column: 12, line: 2 }, + end: { column: 13, line: 2 }, + }, + }, +- override: false, + static: false, + value: Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [29, 30], + loc: { + start: { column: 17, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, + + range: [14, 31], + loc: { + start: { column: 2, line: 2 }, + end: { column: 19, line: 2 }, + }, + }, + ], + + range: [10, 33], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: 'Identifier', + name: 'Foo', + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 33], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 34], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, + }" +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/6-AST-Alignment-Tokens.shot similarity index 52% rename from packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/6-AST-Alignment-Tokens.shot rename to packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/6-AST-Alignment-Tokens.shot index dade8ee29e7..2243b91ca2e 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/6-AST-Alignment-Tokens.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/6-AST-Alignment-Tokens.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ExportNamedDeclaration assertion AST Alignment - Token 1`] = ` +exports[`AST Fixtures element AccessorProperty key-computed-number AST Alignment - Token 1`] = ` "Snapshot Diff: Compared values have no visual difference." `; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/fixture.ts new file mode 100644 index 00000000000..feb7a8c14ce --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + accessor ['prop'] = 'value'; +} diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..24de40f9aae --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,82 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-computed-string TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + AccessorProperty { + type: "AccessorProperty", + computed: true, + declare: false, + key: Literal { + type: "Literal", + raw: "'prop'", + value: "prop", + + range: [24, 30], + loc: { + start: { column: 12, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, + override: false, + static: false, + value: Literal { + type: "Literal", + raw: "'value'", + value: "value", + + range: [34, 41], + loc: { + start: { column: 22, line: 2 }, + end: { column: 29, line: 2 }, + }, + }, + + range: [14, 42], + loc: { + start: { column: 2, line: 2 }, + end: { column: 30, line: 2 }, + }, + }, + ], + + range: [10, 44], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 44], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 45], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..9b1fd979379 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,116 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-computed-string TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "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: "'prop'", + + range: [24, 30], + loc: { + start: { column: 12, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [30, 31], + loc: { + start: { column: 18, line: 2 }, + end: { column: 19, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [32, 33], + loc: { + start: { column: 20, line: 2 }, + end: { column: 21, line: 2 }, + }, + }, + String { + type: "String", + value: "'value'", + + range: [34, 41], + loc: { + start: { column: 22, line: 2 }, + end: { column: 29, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [41, 42], + loc: { + start: { column: 29, line: 2 }, + end: { column: 30, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [43, 44], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..d8b18a55910 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/3-Babel-AST.shot @@ -0,0 +1,80 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-computed-string Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + ClassAccessorProperty { + type: "ClassAccessorProperty", + computed: true, + key: Literal { + type: "Literal", + raw: "'prop'", + value: "prop", + + range: [24, 30], + loc: { + start: { column: 12, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, + static: false, + value: Literal { + type: "Literal", + raw: "'value'", + value: "value", + + range: [34, 41], + loc: { + start: { column: 22, line: 2 }, + end: { column: 29, line: 2 }, + }, + }, + + range: [14, 42], + loc: { + start: { column: 2, line: 2 }, + end: { column: 30, line: 2 }, + }, + }, + ], + + range: [10, 44], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 44], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 45], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..29da5db3884 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,116 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-computed-string Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "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: "'prop'", + + range: [24, 30], + loc: { + start: { column: 12, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [30, 31], + loc: { + start: { column: 18, line: 2 }, + end: { column: 19, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [32, 33], + loc: { + start: { column: 20, line: 2 }, + end: { column: 21, line: 2 }, + }, + }, + String { + type: "String", + value: "'value'", + + range: [34, 41], + loc: { + start: { column: 22, line: 2 }, + end: { column: 29, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [41, 42], + loc: { + start: { column: 29, line: 2 }, + end: { column: 30, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [43, 44], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..3ca8eaf26ea --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,88 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-computed-string AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', + body: ClassBody { + type: 'ClassBody', + body: Array [ +- AccessorProperty { +- type: 'AccessorProperty', ++ ClassAccessorProperty { ++ type: 'ClassAccessorProperty', + computed: true, +- declare: false, + key: Literal { + type: 'Literal', + raw: '\\\\'prop\\\\'', + value: 'prop', + + range: [24, 30], + loc: { + start: { column: 12, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, +- override: false, + static: false, + value: Literal { + type: 'Literal', + raw: '\\\\'value\\\\'', + value: 'value', + + range: [34, 41], + loc: { + start: { column: 22, line: 2 }, + end: { column: 29, line: 2 }, + }, + }, + + range: [14, 42], + loc: { + start: { column: 2, line: 2 }, + end: { column: 30, line: 2 }, + }, + }, + ], + + range: [10, 44], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: 'Identifier', + name: 'Foo', + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 44], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 45], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, + }" +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..628cbb97adb --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-computed-string AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/fixture.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..40d09186f6d --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,15 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-number TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [], + sourceType: "script", + + range: [0, 0], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 1 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..ea5732d8dee --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-number TSESTree - Tokens 1`] = `Array []`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..c3c65ccd7f8 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/3-Babel-AST.shot @@ -0,0 +1,15 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-number Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [], + sourceType: "script", + + range: [0, 0], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 1 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..75ca02a990c --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-number Babel - Tokens 1`] = `Array []`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/5-AST-Alignment-AST.shot similarity index 52% rename from packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/5-AST-Alignment-AST.shot rename to packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/5-AST-Alignment-AST.shot index 258519a7adf..55fd7a3d475 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/5-AST-Alignment-AST.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ExportNamedDeclaration assertion AST Alignment - AST 1`] = ` +exports[`AST Fixtures element AccessorProperty key-number AST Alignment - AST 1`] = ` "Snapshot Diff: Compared values have no visual difference." `; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..0ee5b89aab4 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-number AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/fixture.ts new file mode 100644 index 00000000000..255b0794a5e --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + accessor #foo = 2; +} diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..e30dd5e502f --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,81 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-private TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + AccessorProperty { + type: "AccessorProperty", + computed: false, + declare: false, + key: PrivateIdentifier { + type: "PrivateIdentifier", + name: "foo", + + range: [23, 27], + loc: { + start: { column: 11, line: 2 }, + end: { column: 15, line: 2 }, + }, + }, + override: false, + static: false, + value: Literal { + type: "Literal", + raw: "2", + value: 2, + + range: [30, 31], + loc: { + start: { column: 18, line: 2 }, + end: { column: 19, line: 2 }, + }, + }, + + range: [14, 32], + loc: { + start: { column: 2, line: 2 }, + end: { column: 20, line: 2 }, + }, + }, + ], + + range: [10, 34], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 34], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 35], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..1a3c3d84ed7 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,96 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-private TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [14, 22], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "#foo", + + range: [23, 27], + loc: { + start: { column: 11, 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 }, + }, + }, + Numeric { + type: "Numeric", + value: "2", + + range: [30, 31], + loc: { + start: { column: 18, line: 2 }, + end: { column: 19, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [31, 32], + loc: { + start: { column: 19, line: 2 }, + end: { column: 20, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [33, 34], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..e687dfd0d9a --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/3-Babel-AST.shot @@ -0,0 +1,79 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-private Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + ClassAccessorProperty { + type: "ClassAccessorProperty", + computed: false, + key: PrivateIdentifier { + type: "PrivateIdentifier", + name: "foo", + + range: [23, 27], + loc: { + start: { column: 11, line: 2 }, + end: { column: 15, line: 2 }, + }, + }, + static: false, + value: Literal { + type: "Literal", + raw: "2", + value: 2, + + range: [30, 31], + loc: { + start: { column: 18, line: 2 }, + end: { column: 19, line: 2 }, + }, + }, + + range: [14, 32], + loc: { + start: { column: 2, line: 2 }, + end: { column: 20, line: 2 }, + }, + }, + ], + + range: [10, 34], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 34], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 35], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..52963d76a15 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,96 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-private Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [14, 22], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + PrivateIdentifier { + type: "PrivateIdentifier", + value: "foo", + + range: [23, 27], + loc: { + start: { column: 11, 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 }, + }, + }, + Numeric { + type: "Numeric", + value: "2", + + range: [30, 31], + loc: { + start: { column: 18, line: 2 }, + end: { column: 19, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [31, 32], + loc: { + start: { column: 19, line: 2 }, + end: { column: 20, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [33, 34], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..100c519c06c --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,87 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-private AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', + body: ClassBody { + type: 'ClassBody', + body: Array [ +- AccessorProperty { +- type: 'AccessorProperty', ++ ClassAccessorProperty { ++ type: 'ClassAccessorProperty', + computed: false, +- declare: false, + key: PrivateIdentifier { + type: 'PrivateIdentifier', + name: 'foo', + + range: [23, 27], + loc: { + start: { column: 11, line: 2 }, + end: { column: 15, line: 2 }, + }, + }, +- override: false, + static: false, + value: Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [30, 31], + loc: { + start: { column: 18, line: 2 }, + end: { column: 19, line: 2 }, + }, + }, + + range: [14, 32], + loc: { + start: { column: 2, line: 2 }, + end: { column: 20, line: 2 }, + }, + }, + ], + + range: [10, 34], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: 'Identifier', + name: 'Foo', + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 34], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 35], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, + }" +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..11bd633e049 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,103 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-private AST Alignment - Token 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Array [ + Keyword { + type: 'Keyword', + value: 'class', + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'Foo', + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + 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 }, + }, + }, +- Identifier { +- type: 'Identifier', +- value: '#foo', ++ PrivateIdentifier { ++ type: 'PrivateIdentifier', ++ value: 'foo', + + range: [23, 27], + loc: { + start: { column: 11, 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 }, + }, + }, + Numeric { + type: 'Numeric', + value: '2', + + range: [30, 31], + loc: { + start: { column: 18, line: 2 }, + end: { column: 19, line: 2 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ';', + + range: [31, 32], + loc: { + start: { column: 19, line: 2 }, + end: { column: 20, line: 2 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '}', + + range: [33, 34], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, + ]" +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/fixture.ts new file mode 100644 index 00000000000..808470d5b6a --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + accessor 'prop' = 'value'; +} diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..06a3b3705ed --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,82 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-string TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + AccessorProperty { + type: "AccessorProperty", + computed: false, + declare: false, + key: Literal { + type: "Literal", + raw: "'prop'", + value: "prop", + + range: [23, 29], + loc: { + start: { column: 11, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + override: false, + static: false, + value: Literal { + type: "Literal", + raw: "'value'", + value: "value", + + range: [32, 39], + loc: { + start: { column: 20, line: 2 }, + end: { column: 27, line: 2 }, + }, + }, + + range: [14, 40], + loc: { + start: { column: 2, line: 2 }, + end: { column: 28, line: 2 }, + }, + }, + ], + + range: [10, 42], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 42], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 43], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..0fe6262dd93 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,96 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-string TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [14, 22], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + String { + type: "String", + value: "'prop'", + + range: [23, 29], + loc: { + start: { column: 11, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [30, 31], + loc: { + start: { column: 18, line: 2 }, + end: { column: 19, line: 2 }, + }, + }, + String { + type: "String", + value: "'value'", + + range: [32, 39], + loc: { + start: { column: 20, line: 2 }, + end: { column: 27, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [39, 40], + loc: { + start: { column: 27, line: 2 }, + end: { column: 28, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [41, 42], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..9af9236878c --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/3-Babel-AST.shot @@ -0,0 +1,80 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-string Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + ClassAccessorProperty { + type: "ClassAccessorProperty", + computed: false, + key: Literal { + type: "Literal", + raw: "'prop'", + value: "prop", + + range: [23, 29], + loc: { + start: { column: 11, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + static: false, + value: Literal { + type: "Literal", + raw: "'value'", + value: "value", + + range: [32, 39], + loc: { + start: { column: 20, line: 2 }, + end: { column: 27, line: 2 }, + }, + }, + + range: [14, 40], + loc: { + start: { column: 2, line: 2 }, + end: { column: 28, line: 2 }, + }, + }, + ], + + range: [10, 42], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 42], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 43], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..110b7cb9949 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,96 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-string Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [14, 22], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + String { + type: "String", + value: "'prop'", + + range: [23, 29], + loc: { + start: { column: 11, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [30, 31], + loc: { + start: { column: 18, line: 2 }, + end: { column: 19, line: 2 }, + }, + }, + String { + type: "String", + value: "'value'", + + range: [32, 39], + loc: { + start: { column: 20, line: 2 }, + end: { column: 27, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [39, 40], + loc: { + start: { column: 27, line: 2 }, + end: { column: 28, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [41, 42], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..f831283bcb4 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,88 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-string AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', + body: ClassBody { + type: 'ClassBody', + body: Array [ +- AccessorProperty { +- type: 'AccessorProperty', ++ ClassAccessorProperty { ++ type: 'ClassAccessorProperty', + computed: false, +- declare: false, + key: Literal { + type: 'Literal', + raw: '\\\\'prop\\\\'', + value: 'prop', + + range: [23, 29], + loc: { + start: { column: 11, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, +- override: false, + static: false, + value: Literal { + type: 'Literal', + raw: '\\\\'value\\\\'', + value: 'value', + + range: [32, 39], + loc: { + start: { column: 20, line: 2 }, + end: { column: 27, line: 2 }, + }, + }, + + range: [14, 40], + loc: { + start: { column: 2, line: 2 }, + end: { column: 28, line: 2 }, + }, + }, + ], + + range: [10, 42], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: 'Identifier', + name: 'Foo', + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 42], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 43], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, + }" +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..af1e8eed8c6 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-string AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/config.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/config.ts new file mode 100644 index 00000000000..61e0e137a0e --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/config.ts @@ -0,0 +1,3 @@ +export default { + expectBabelToNotSupport: 'https://github.com/babel/babel/issues/15205', +} satisfies ASTFixtureConfig; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/fixture.ts new file mode 100644 index 00000000000..26b6ab5a4e0 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/fixture.ts @@ -0,0 +1,3 @@ +abstract class Foo { + abstract accessor foo: number = 1; +} diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..1c8247fb96d --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,90 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-abstract-with-value TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + abstract: true, + body: ClassBody { + type: "ClassBody", + body: Array [ + TSAbstractAccessorProperty { + type: "TSAbstractAccessorProperty", + computed: false, + declare: false, + key: Identifier { + type: "Identifier", + name: "foo", + + range: [41, 44], + loc: { + start: { column: 20, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + override: false, + static: false, + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSNumberKeyword { + type: "TSNumberKeyword", + + range: [46, 52], + loc: { + start: { column: 25, line: 2 }, + end: { column: 31, line: 2 }, + }, + }, + + range: [44, 52], + loc: { + start: { column: 23, line: 2 }, + end: { column: 31, line: 2 }, + }, + }, + value: null, + + range: [23, 57], + loc: { + start: { column: 2, line: 2 }, + end: { column: 36, line: 2 }, + }, + }, + ], + + range: [19, 59], + loc: { + start: { column: 19, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + superClass: null, + + range: [0, 59], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 60], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..b993bfecdea --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,136 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-abstract-with-value TSESTree - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "abstract", + + range: [0, 8], + loc: { + start: { column: 0, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "class", + + range: [9, 14], + loc: { + start: { column: 9, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "abstract", + + range: [23, 31], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [32, 40], + loc: { + start: { column: 11, line: 2 }, + end: { column: 19, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [41, 44], + loc: { + start: { column: 20, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [44, 45], + loc: { + start: { column: 23, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "number", + + range: [46, 52], + loc: { + start: { column: 25, line: 2 }, + end: { column: 31, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [53, 54], + loc: { + start: { column: 32, line: 2 }, + end: { column: 33, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [55, 56], + loc: { + start: { column: 34, line: 2 }, + end: { column: 35, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [56, 57], + loc: { + start: { column: 35, line: 2 }, + end: { column: 36, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [58, 59], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/3-Babel-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/3-Babel-Error.shot new file mode 100644 index 00000000000..c49a847cd3a --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/3-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-abstract-with-value Babel - Error 1`] = `[SyntaxError: Missing semicolon. (2:23)]`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/config.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/config.ts new file mode 100644 index 00000000000..61e0e137a0e --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/config.ts @@ -0,0 +1,3 @@ +export default { + expectBabelToNotSupport: 'https://github.com/babel/babel/issues/15205', +} satisfies ASTFixtureConfig; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/fixture.ts new file mode 100644 index 00000000000..61608bfc72d --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/fixture.ts @@ -0,0 +1,3 @@ +abstract class Foo { + abstract accessor foo: number; +} diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..420e13ca4bf --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,90 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-abstract TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + abstract: true, + body: ClassBody { + type: "ClassBody", + body: Array [ + TSAbstractAccessorProperty { + type: "TSAbstractAccessorProperty", + computed: false, + declare: false, + key: Identifier { + type: "Identifier", + name: "foo", + + range: [41, 44], + loc: { + start: { column: 20, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + override: false, + static: false, + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSNumberKeyword { + type: "TSNumberKeyword", + + range: [46, 52], + loc: { + start: { column: 25, line: 2 }, + end: { column: 31, line: 2 }, + }, + }, + + range: [44, 52], + loc: { + start: { column: 23, line: 2 }, + end: { column: 31, line: 2 }, + }, + }, + value: null, + + range: [23, 53], + loc: { + start: { column: 2, line: 2 }, + end: { column: 32, line: 2 }, + }, + }, + ], + + range: [19, 55], + loc: { + start: { column: 19, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + superClass: null, + + range: [0, 55], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 56], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..732caf89fce --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,116 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-abstract TSESTree - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "abstract", + + range: [0, 8], + loc: { + start: { column: 0, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "class", + + range: [9, 14], + loc: { + start: { column: 9, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "abstract", + + range: [23, 31], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [32, 40], + loc: { + start: { column: 11, line: 2 }, + end: { column: 19, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [41, 44], + loc: { + start: { column: 20, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [44, 45], + loc: { + start: { column: 23, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "number", + + range: [46, 52], + loc: { + start: { column: 25, line: 2 }, + end: { column: 31, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [52, 53], + loc: { + start: { column: 31, line: 2 }, + end: { column: 32, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [54, 55], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/snapshots/3-Babel-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/snapshots/3-Babel-Error.shot new file mode 100644 index 00000000000..6f975b3a497 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/snapshots/3-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-abstract Babel - Error 1`] = `[SyntaxError: Missing semicolon. (2:23)]`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/fixture.ts new file mode 100644 index 00000000000..70dd6b95f61 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/fixture.ts @@ -0,0 +1,3 @@ +class Foo extends Bar { + override accessor foo = 2; +} diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..b0e78060a09 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,90 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-override TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + AccessorProperty { + type: "AccessorProperty", + computed: false, + declare: false, + key: Identifier { + type: "Identifier", + name: "foo", + + range: [44, 47], + loc: { + start: { column: 20, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + override: true, + static: false, + value: Literal { + type: "Literal", + raw: "2", + value: 2, + + range: [50, 51], + loc: { + start: { column: 26, line: 2 }, + end: { column: 27, line: 2 }, + }, + }, + + range: [26, 52], + loc: { + start: { column: 2, line: 2 }, + end: { column: 28, line: 2 }, + }, + }, + ], + + range: [22, 54], + loc: { + start: { column: 22, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: Identifier { + type: "Identifier", + name: "Bar", + + range: [18, 21], + loc: { + start: { column: 18, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + + range: [0, 54], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 55], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..24c22b85146 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,126 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-override TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "extends", + + range: [10, 17], + loc: { + start: { column: 10, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Bar", + + range: [18, 21], + loc: { + start: { column: 18, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [22, 23], + loc: { + start: { column: 22, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "override", + + range: [26, 34], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [35, 43], + loc: { + start: { column: 11, line: 2 }, + end: { column: 19, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [44, 47], + loc: { + start: { column: 20, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [48, 49], + loc: { + start: { column: 24, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "2", + + range: [50, 51], + loc: { + start: { column: 26, line: 2 }, + end: { column: 27, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [51, 52], + loc: { + start: { column: 27, line: 2 }, + end: { column: 28, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [53, 54], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..49d82178de5 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/3-Babel-AST.shot @@ -0,0 +1,89 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-override Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + ClassAccessorProperty { + type: "ClassAccessorProperty", + computed: false, + key: Identifier { + type: "Identifier", + name: "foo", + + range: [44, 47], + loc: { + start: { column: 20, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + override: true, + static: false, + value: Literal { + type: "Literal", + raw: "2", + value: 2, + + range: [50, 51], + loc: { + start: { column: 26, line: 2 }, + end: { column: 27, line: 2 }, + }, + }, + + range: [26, 52], + loc: { + start: { column: 2, line: 2 }, + end: { column: 28, line: 2 }, + }, + }, + ], + + range: [22, 54], + loc: { + start: { column: 22, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: Identifier { + type: "Identifier", + name: "Bar", + + range: [18, 21], + loc: { + start: { column: 18, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + + range: [0, 54], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 55], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..dd9763a4fcd --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,126 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-override Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "extends", + + range: [10, 17], + loc: { + start: { column: 10, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Bar", + + range: [18, 21], + loc: { + start: { column: 18, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [22, 23], + loc: { + start: { column: 22, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "override", + + range: [26, 34], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [35, 43], + loc: { + start: { column: 11, line: 2 }, + end: { column: 19, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [44, 47], + loc: { + start: { column: 20, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [48, 49], + loc: { + start: { column: 24, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "2", + + range: [50, 51], + loc: { + start: { column: 26, line: 2 }, + end: { column: 27, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [51, 52], + loc: { + start: { column: 27, line: 2 }, + end: { column: 28, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [53, 54], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..7949a056f9a --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,96 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-override AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', + body: ClassBody { + type: 'ClassBody', + body: Array [ +- AccessorProperty { +- type: 'AccessorProperty', ++ ClassAccessorProperty { ++ type: 'ClassAccessorProperty', + computed: false, +- declare: false, + key: Identifier { + type: 'Identifier', + name: 'foo', + + range: [44, 47], + loc: { + start: { column: 20, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + override: true, + static: false, + value: Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [50, 51], + loc: { + start: { column: 26, line: 2 }, + end: { column: 27, line: 2 }, + }, + }, + + range: [26, 52], + loc: { + start: { column: 2, line: 2 }, + end: { column: 28, line: 2 }, + }, + }, + ], + + range: [22, 54], + loc: { + start: { column: 22, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: 'Identifier', + name: 'Foo', + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: Identifier { + type: 'Identifier', + name: 'Bar', + + range: [18, 21], + loc: { + start: { column: 18, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + + range: [0, 54], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 55], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, + }" +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..4585c5481d0 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-override AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/fixture.ts new file mode 100644 index 00000000000..ceacabc649f --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + private accessor foo = 2; +} diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..0f0fa0f2a10 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,82 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-private TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + AccessorProperty { + type: "AccessorProperty", + accessibility: "private", + computed: false, + declare: false, + key: Identifier { + type: "Identifier", + name: "foo", + + range: [31, 34], + loc: { + start: { column: 19, line: 2 }, + end: { column: 22, line: 2 }, + }, + }, + override: false, + static: false, + value: Literal { + type: "Literal", + raw: "2", + value: 2, + + range: [37, 38], + loc: { + start: { column: 25, line: 2 }, + end: { column: 26, line: 2 }, + }, + }, + + 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 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + 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 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..17510235b46 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,106 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-private TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "private", + + range: [14, 21], + loc: { + start: { column: 2, line: 2 }, + end: { column: 9, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [22, 30], + loc: { + start: { column: 10, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [31, 34], + loc: { + start: { column: 19, line: 2 }, + end: { column: 22, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [35, 36], + loc: { + start: { column: 23, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "2", + + 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 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..b11a056920d --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/3-Babel-AST.shot @@ -0,0 +1,80 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-private Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + ClassAccessorProperty { + type: "ClassAccessorProperty", + accessibility: "private", + computed: false, + key: Identifier { + type: "Identifier", + name: "foo", + + range: [31, 34], + loc: { + start: { column: 19, line: 2 }, + end: { column: 22, line: 2 }, + }, + }, + static: false, + value: Literal { + type: "Literal", + raw: "2", + value: 2, + + range: [37, 38], + loc: { + start: { column: 25, line: 2 }, + end: { column: 26, line: 2 }, + }, + }, + + 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 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + 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 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..75520e7741d --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,106 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-private Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "private", + + range: [14, 21], + loc: { + start: { column: 2, line: 2 }, + end: { column: 9, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [22, 30], + loc: { + start: { column: 10, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [31, 34], + loc: { + start: { column: 19, line: 2 }, + end: { column: 22, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [35, 36], + loc: { + start: { column: 23, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "2", + + 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 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..fd302779cf1 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,88 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-private AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', + body: ClassBody { + type: 'ClassBody', + body: Array [ +- AccessorProperty { +- type: 'AccessorProperty', ++ ClassAccessorProperty { ++ type: 'ClassAccessorProperty', + accessibility: 'private', + computed: false, +- declare: false, + key: Identifier { + type: 'Identifier', + name: 'foo', + + range: [31, 34], + loc: { + start: { column: 19, line: 2 }, + end: { column: 22, line: 2 }, + }, + }, +- override: false, + static: false, + value: Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [37, 38], + loc: { + start: { column: 25, line: 2 }, + end: { column: 26, line: 2 }, + }, + }, + + 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 }, + }, + }, + id: Identifier { + type: 'Identifier', + name: 'Foo', + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + 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 }, + }, + }" +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..35301570665 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,112 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-private AST Alignment - Token 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Array [ + Keyword { + type: 'Keyword', + value: 'class', + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'Foo', + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '{', + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, +- Keyword { +- type: 'Keyword', ++ Identifier { ++ type: 'Identifier', + value: 'private', + + range: [14, 21], + loc: { + start: { column: 2, line: 2 }, + end: { column: 9, line: 2 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'accessor', + + range: [22, 30], + loc: { + start: { column: 10, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'foo', + + range: [31, 34], + loc: { + start: { column: 19, line: 2 }, + end: { column: 22, line: 2 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '=', + + range: [35, 36], + loc: { + start: { column: 23, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, + Numeric { + type: 'Numeric', + value: '2', + + 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 }, + }, + }, + ]" +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/fixture.ts new file mode 100644 index 00000000000..dac8cd734c5 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + protected accessor foo = 2; +} diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..d862c8f8648 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,82 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-protected TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + AccessorProperty { + type: "AccessorProperty", + accessibility: "protected", + computed: false, + declare: false, + key: Identifier { + type: "Identifier", + name: "foo", + + range: [33, 36], + loc: { + start: { column: 21, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, + override: false, + static: false, + value: Literal { + type: "Literal", + raw: "2", + value: 2, + + range: [39, 40], + loc: { + start: { column: 27, line: 2 }, + end: { column: 28, line: 2 }, + }, + }, + + range: [14, 41], + loc: { + start: { column: 2, line: 2 }, + end: { column: 29, line: 2 }, + }, + }, + ], + + range: [10, 43], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 43], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 44], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..88ab4ac1f40 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,106 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-protected TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "protected", + + range: [14, 23], + loc: { + start: { column: 2, line: 2 }, + end: { column: 11, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [24, 32], + loc: { + start: { column: 12, line: 2 }, + end: { column: 20, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [33, 36], + loc: { + start: { column: 21, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [37, 38], + loc: { + start: { column: 25, line: 2 }, + end: { column: 26, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "2", + + range: [39, 40], + loc: { + start: { column: 27, line: 2 }, + end: { column: 28, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [40, 41], + loc: { + start: { column: 28, line: 2 }, + end: { column: 29, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [42, 43], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..dbabfaa6a93 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/3-Babel-AST.shot @@ -0,0 +1,80 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-protected Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + ClassAccessorProperty { + type: "ClassAccessorProperty", + accessibility: "protected", + computed: false, + key: Identifier { + type: "Identifier", + name: "foo", + + range: [33, 36], + loc: { + start: { column: 21, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, + static: false, + value: Literal { + type: "Literal", + raw: "2", + value: 2, + + range: [39, 40], + loc: { + start: { column: 27, line: 2 }, + end: { column: 28, line: 2 }, + }, + }, + + range: [14, 41], + loc: { + start: { column: 2, line: 2 }, + end: { column: 29, line: 2 }, + }, + }, + ], + + range: [10, 43], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 43], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 44], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..c730984ef44 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,106 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-protected Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "protected", + + range: [14, 23], + loc: { + start: { column: 2, line: 2 }, + end: { column: 11, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [24, 32], + loc: { + start: { column: 12, line: 2 }, + end: { column: 20, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [33, 36], + loc: { + start: { column: 21, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [37, 38], + loc: { + start: { column: 25, line: 2 }, + end: { column: 26, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "2", + + range: [39, 40], + loc: { + start: { column: 27, line: 2 }, + end: { column: 28, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [40, 41], + loc: { + start: { column: 28, line: 2 }, + end: { column: 29, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [42, 43], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..c26ec2b5985 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,88 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-protected AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', + body: ClassBody { + type: 'ClassBody', + body: Array [ +- AccessorProperty { +- type: 'AccessorProperty', ++ ClassAccessorProperty { ++ type: 'ClassAccessorProperty', + accessibility: 'protected', + computed: false, +- declare: false, + key: Identifier { + type: 'Identifier', + name: 'foo', + + range: [33, 36], + loc: { + start: { column: 21, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, +- override: false, + static: false, + value: Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [39, 40], + loc: { + start: { column: 27, line: 2 }, + end: { column: 28, line: 2 }, + }, + }, + + range: [14, 41], + loc: { + start: { column: 2, line: 2 }, + end: { column: 29, line: 2 }, + }, + }, + ], + + range: [10, 43], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: 'Identifier', + name: 'Foo', + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 43], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 44], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, + }" +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..cbbcda53541 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,112 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-protected AST Alignment - Token 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Array [ + Keyword { + type: 'Keyword', + value: 'class', + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'Foo', + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '{', + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, +- Keyword { +- type: 'Keyword', ++ Identifier { ++ type: 'Identifier', + value: 'protected', + + range: [14, 23], + loc: { + start: { column: 2, line: 2 }, + end: { column: 11, line: 2 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'accessor', + + range: [24, 32], + loc: { + start: { column: 12, line: 2 }, + end: { column: 20, line: 2 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'foo', + + range: [33, 36], + loc: { + start: { column: 21, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '=', + + range: [37, 38], + loc: { + start: { column: 25, line: 2 }, + end: { column: 26, line: 2 }, + }, + }, + Numeric { + type: 'Numeric', + value: '2', + + range: [39, 40], + loc: { + start: { column: 27, line: 2 }, + end: { column: 28, line: 2 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ';', + + range: [40, 41], + loc: { + start: { column: 28, line: 2 }, + end: { column: 29, line: 2 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '}', + + range: [42, 43], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, + ]" +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/fixture.ts new file mode 100644 index 00000000000..bbcbc59c710 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + public accessor foo = 2; +} diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..6a1c4d1b7ec --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,82 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-public TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + AccessorProperty { + type: "AccessorProperty", + accessibility: "public", + computed: false, + declare: false, + key: Identifier { + type: "Identifier", + name: "foo", + + range: [30, 33], + loc: { + start: { column: 18, line: 2 }, + end: { column: 21, line: 2 }, + }, + }, + override: false, + static: false, + value: Literal { + type: "Literal", + raw: "2", + value: 2, + + range: [36, 37], + loc: { + start: { column: 24, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, + + range: [14, 38], + loc: { + start: { column: 2, line: 2 }, + end: { column: 26, line: 2 }, + }, + }, + ], + + range: [10, 40], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 40], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 41], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..31de17a79dd --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,106 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-public TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "public", + + range: [14, 20], + loc: { + start: { column: 2, line: 2 }, + end: { column: 8, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [21, 29], + loc: { + start: { column: 9, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [30, 33], + loc: { + start: { column: 18, line: 2 }, + end: { column: 21, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [34, 35], + loc: { + start: { column: 22, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "2", + + range: [36, 37], + loc: { + start: { column: 24, 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: [39, 40], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..ed50b70a5c7 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/3-Babel-AST.shot @@ -0,0 +1,80 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-public Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + ClassAccessorProperty { + type: "ClassAccessorProperty", + accessibility: "public", + computed: false, + key: Identifier { + type: "Identifier", + name: "foo", + + range: [30, 33], + loc: { + start: { column: 18, line: 2 }, + end: { column: 21, line: 2 }, + }, + }, + static: false, + value: Literal { + type: "Literal", + raw: "2", + value: 2, + + range: [36, 37], + loc: { + start: { column: 24, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, + + range: [14, 38], + loc: { + start: { column: 2, line: 2 }, + end: { column: 26, line: 2 }, + }, + }, + ], + + range: [10, 40], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 40], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 41], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..e0257ccc735 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,106 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-public Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "public", + + range: [14, 20], + loc: { + start: { column: 2, line: 2 }, + end: { column: 8, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [21, 29], + loc: { + start: { column: 9, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [30, 33], + loc: { + start: { column: 18, line: 2 }, + end: { column: 21, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [34, 35], + loc: { + start: { column: 22, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "2", + + range: [36, 37], + loc: { + start: { column: 24, 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: [39, 40], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..9eb4ac8ef9b --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,88 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-public AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', + body: ClassBody { + type: 'ClassBody', + body: Array [ +- AccessorProperty { +- type: 'AccessorProperty', ++ ClassAccessorProperty { ++ type: 'ClassAccessorProperty', + accessibility: 'public', + computed: false, +- declare: false, + key: Identifier { + type: 'Identifier', + name: 'foo', + + range: [30, 33], + loc: { + start: { column: 18, line: 2 }, + end: { column: 21, line: 2 }, + }, + }, +- override: false, + static: false, + value: Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [36, 37], + loc: { + start: { column: 24, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, + + range: [14, 38], + loc: { + start: { column: 2, line: 2 }, + end: { column: 26, line: 2 }, + }, + }, + ], + + range: [10, 40], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: 'Identifier', + name: 'Foo', + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 40], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 41], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, + }" +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..7228be97ad2 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,112 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-public AST Alignment - Token 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Array [ + Keyword { + type: 'Keyword', + value: 'class', + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'Foo', + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '{', + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, +- Keyword { +- type: 'Keyword', ++ Identifier { ++ type: 'Identifier', + value: 'public', + + range: [14, 20], + loc: { + start: { column: 2, line: 2 }, + end: { column: 8, line: 2 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'accessor', + + range: [21, 29], + loc: { + start: { column: 9, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'foo', + + range: [30, 33], + loc: { + start: { column: 18, line: 2 }, + end: { column: 21, line: 2 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '=', + + range: [34, 35], + loc: { + start: { column: 22, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + Numeric { + type: 'Numeric', + value: '2', + + range: [36, 37], + loc: { + start: { column: 24, 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: [39, 40], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, + ]" +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/fixture.ts new file mode 100644 index 00000000000..532df27a9ee --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + readonly accessor foo = 2; +} diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..41928f7e572 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,82 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-readonly TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + AccessorProperty { + type: "AccessorProperty", + computed: false, + declare: false, + key: Identifier { + type: "Identifier", + name: "foo", + + range: [32, 35], + loc: { + start: { column: 20, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + override: false, + readonly: true, + static: false, + value: Literal { + type: "Literal", + raw: "2", + value: 2, + + range: [38, 39], + loc: { + start: { column: 26, line: 2 }, + end: { column: 27, line: 2 }, + }, + }, + + range: [14, 40], + loc: { + start: { column: 2, line: 2 }, + end: { column: 28, line: 2 }, + }, + }, + ], + + range: [10, 42], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 42], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 43], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..802229ba8ae --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,106 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-readonly TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "readonly", + + range: [14, 22], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [23, 31], + loc: { + start: { column: 11, line: 2 }, + end: { column: 19, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [32, 35], + loc: { + start: { column: 20, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [36, 37], + loc: { + start: { column: 24, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "2", + + range: [38, 39], + loc: { + start: { column: 26, line: 2 }, + end: { column: 27, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [39, 40], + loc: { + start: { column: 27, line: 2 }, + end: { column: 28, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [41, 42], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..369cfde552a --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/3-Babel-AST.shot @@ -0,0 +1,80 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-readonly Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + ClassAccessorProperty { + type: "ClassAccessorProperty", + computed: false, + key: Identifier { + type: "Identifier", + name: "foo", + + range: [32, 35], + loc: { + start: { column: 20, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + readonly: true, + static: false, + value: Literal { + type: "Literal", + raw: "2", + value: 2, + + range: [38, 39], + loc: { + start: { column: 26, line: 2 }, + end: { column: 27, line: 2 }, + }, + }, + + range: [14, 40], + loc: { + start: { column: 2, line: 2 }, + end: { column: 28, line: 2 }, + }, + }, + ], + + range: [10, 42], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 42], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 43], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..673f38fe66c --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,106 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-readonly Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "readonly", + + range: [14, 22], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [23, 31], + loc: { + start: { column: 11, line: 2 }, + end: { column: 19, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [32, 35], + loc: { + start: { column: 20, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [36, 37], + loc: { + start: { column: 24, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "2", + + range: [38, 39], + loc: { + start: { column: 26, line: 2 }, + end: { column: 27, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [39, 40], + loc: { + start: { column: 27, line: 2 }, + end: { column: 28, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [41, 42], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..7f48bba2e58 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,88 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-readonly AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', + body: ClassBody { + type: 'ClassBody', + body: Array [ +- AccessorProperty { +- type: 'AccessorProperty', ++ ClassAccessorProperty { ++ type: 'ClassAccessorProperty', + computed: false, +- declare: false, + key: Identifier { + type: 'Identifier', + name: 'foo', + + range: [32, 35], + loc: { + start: { column: 20, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, +- override: false, + readonly: true, + static: false, + value: Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [38, 39], + loc: { + start: { column: 26, line: 2 }, + end: { column: 27, line: 2 }, + }, + }, + + range: [14, 40], + loc: { + start: { column: 2, line: 2 }, + end: { column: 28, line: 2 }, + }, + }, + ], + + range: [10, 42], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: 'Identifier', + name: 'Foo', + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 42], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 43], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, + }" +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..ba78cbeda59 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-readonly AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/fixture.ts new file mode 100644 index 00000000000..0c8cd7ca6a4 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + static accessor foo = 2; +} diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..6733de847c8 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,81 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-static TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + AccessorProperty { + type: "AccessorProperty", + computed: false, + declare: false, + key: Identifier { + type: "Identifier", + name: "foo", + + range: [30, 33], + loc: { + start: { column: 18, line: 2 }, + end: { column: 21, line: 2 }, + }, + }, + override: false, + static: true, + value: Literal { + type: "Literal", + raw: "2", + value: 2, + + range: [36, 37], + loc: { + start: { column: 24, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, + + range: [14, 38], + loc: { + start: { column: 2, line: 2 }, + end: { column: 26, line: 2 }, + }, + }, + ], + + range: [10, 40], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 40], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 41], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..245c071ee55 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,106 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-static TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "static", + + range: [14, 20], + loc: { + start: { column: 2, line: 2 }, + end: { column: 8, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [21, 29], + loc: { + start: { column: 9, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [30, 33], + loc: { + start: { column: 18, line: 2 }, + end: { column: 21, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [34, 35], + loc: { + start: { column: 22, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "2", + + range: [36, 37], + loc: { + start: { column: 24, 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: [39, 40], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..917914d80fb --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/3-Babel-AST.shot @@ -0,0 +1,79 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-static Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + ClassAccessorProperty { + type: "ClassAccessorProperty", + computed: false, + key: Identifier { + type: "Identifier", + name: "foo", + + range: [30, 33], + loc: { + start: { column: 18, line: 2 }, + end: { column: 21, line: 2 }, + }, + }, + static: true, + value: Literal { + type: "Literal", + raw: "2", + value: 2, + + range: [36, 37], + loc: { + start: { column: 24, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, + + range: [14, 38], + loc: { + start: { column: 2, line: 2 }, + end: { column: 26, line: 2 }, + }, + }, + ], + + range: [10, 40], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 40], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 41], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..64b2cf04408 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,106 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-static Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "static", + + range: [14, 20], + loc: { + start: { column: 2, line: 2 }, + end: { column: 8, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [21, 29], + loc: { + start: { column: 9, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [30, 33], + loc: { + start: { column: 18, line: 2 }, + end: { column: 21, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [34, 35], + loc: { + start: { column: 22, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "2", + + range: [36, 37], + loc: { + start: { column: 24, 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: [39, 40], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..c5c6c8589ee --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,87 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-static AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', + body: ClassBody { + type: 'ClassBody', + body: Array [ +- AccessorProperty { +- type: 'AccessorProperty', ++ ClassAccessorProperty { ++ type: 'ClassAccessorProperty', + computed: false, +- declare: false, + key: Identifier { + type: 'Identifier', + name: 'foo', + + range: [30, 33], + loc: { + start: { column: 18, line: 2 }, + end: { column: 21, line: 2 }, + }, + }, +- override: false, + static: true, + value: Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [36, 37], + loc: { + start: { column: 24, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, + + range: [14, 38], + loc: { + start: { column: 2, line: 2 }, + end: { column: 26, line: 2 }, + }, + }, + ], + + range: [10, 40], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: 'Identifier', + name: 'Foo', + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 40], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 41], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, + }" +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..72680d23ee5 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-static AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/fixture.ts new file mode 100644 index 00000000000..18afaa86480 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + accessor prop; +} diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..a5341fd2f70 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,71 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty no-annotation-no-value TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + AccessorProperty { + type: "AccessorProperty", + computed: false, + declare: false, + key: Identifier { + type: "Identifier", + name: "prop", + + range: [23, 27], + loc: { + start: { column: 11, line: 2 }, + end: { column: 15, line: 2 }, + }, + }, + override: 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 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + 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 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..b28c76ee39c --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty no-annotation-no-value TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [14, 22], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "prop", + + range: [23, 27], + loc: { + start: { column: 11, 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 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..7cf14ad2c92 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/3-Babel-AST.shot @@ -0,0 +1,69 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty no-annotation-no-value Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + ClassAccessorProperty { + type: "ClassAccessorProperty", + computed: false, + key: Identifier { + type: "Identifier", + name: "prop", + + range: [23, 27], + loc: { + start: { column: 11, line: 2 }, + end: { column: 15, line: 2 }, + }, + }, + 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 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + 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 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..46747c3659a --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty no-annotation-no-value Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [14, 22], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "prop", + + range: [23, 27], + loc: { + start: { column: 11, 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 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..b08e790e91d --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,77 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty no-annotation-no-value AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', + body: ClassBody { + type: 'ClassBody', + body: Array [ +- AccessorProperty { +- type: 'AccessorProperty', ++ ClassAccessorProperty { ++ type: 'ClassAccessorProperty', + computed: false, +- declare: false, + key: Identifier { + type: 'Identifier', + name: 'prop', + + range: [23, 27], + loc: { + start: { column: 11, line: 2 }, + end: { column: 15, line: 2 }, + }, + }, +- override: 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 }, + }, + }, + id: Identifier { + type: 'Identifier', + name: 'Foo', + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + 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 }, + }, + }" +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..3a66da8c8d9 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty no-annotation-no-value AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/fixture.ts new file mode 100644 index 00000000000..4ac51cccf92 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + accessor prop = 'str'; +} diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..0cc63f22486 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,81 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty no-annotation-with-value TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + AccessorProperty { + type: "AccessorProperty", + computed: false, + declare: false, + key: Identifier { + type: "Identifier", + name: "prop", + + range: [23, 27], + loc: { + start: { column: 11, line: 2 }, + end: { column: 15, line: 2 }, + }, + }, + override: false, + static: false, + value: Literal { + type: "Literal", + raw: "'str'", + value: "str", + + range: [30, 35], + loc: { + start: { column: 18, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + + range: [14, 36], + loc: { + start: { column: 2, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, + ], + + range: [10, 38], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 38], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 39], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..e98ce8a1ccf --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,96 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty no-annotation-with-value TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [14, 22], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "prop", + + range: [23, 27], + loc: { + start: { column: 11, 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 }, + }, + }, + String { + type: "String", + value: "'str'", + + range: [30, 35], + loc: { + start: { column: 18, 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: [37, 38], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..7c1c8d024f9 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/3-Babel-AST.shot @@ -0,0 +1,79 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty no-annotation-with-value Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + ClassAccessorProperty { + type: "ClassAccessorProperty", + computed: false, + key: Identifier { + type: "Identifier", + name: "prop", + + range: [23, 27], + loc: { + start: { column: 11, line: 2 }, + end: { column: 15, line: 2 }, + }, + }, + static: false, + value: Literal { + type: "Literal", + raw: "'str'", + value: "str", + + range: [30, 35], + loc: { + start: { column: 18, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + + range: [14, 36], + loc: { + start: { column: 2, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, + ], + + range: [10, 38], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 38], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 39], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..fbe3b7015a8 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,96 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty no-annotation-with-value Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [14, 22], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "prop", + + range: [23, 27], + loc: { + start: { column: 11, 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 }, + }, + }, + String { + type: "String", + value: "'str'", + + range: [30, 35], + loc: { + start: { column: 18, 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: [37, 38], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..2d4b943581c --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,87 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty no-annotation-with-value AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', + body: ClassBody { + type: 'ClassBody', + body: Array [ +- AccessorProperty { +- type: 'AccessorProperty', ++ ClassAccessorProperty { ++ type: 'ClassAccessorProperty', + computed: false, +- declare: false, + key: Identifier { + type: 'Identifier', + name: 'prop', + + range: [23, 27], + loc: { + start: { column: 11, line: 2 }, + end: { column: 15, line: 2 }, + }, + }, +- override: false, + static: false, + value: Literal { + type: 'Literal', + raw: '\\\\'str\\\\'', + value: 'str', + + range: [30, 35], + loc: { + start: { column: 18, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + + range: [14, 36], + loc: { + start: { column: 2, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, + ], + + range: [10, 38], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: 'Identifier', + name: 'Foo', + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 38], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 39], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, + }" +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..01d2c94e685 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty no-annotation-with-value AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/config.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/config.ts new file mode 100644 index 00000000000..61e0e137a0e --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/config.ts @@ -0,0 +1,3 @@ +export default { + expectBabelToNotSupport: 'https://github.com/babel/babel/issues/15205', +} satisfies ASTFixtureConfig; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/fixture.ts new file mode 100644 index 00000000000..1ec3f55869e --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + accessor prop: string; +} diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..be65f1b2fcd --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,89 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty with-annotation-no-value TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + AccessorProperty { + type: "AccessorProperty", + computed: false, + declare: false, + key: Identifier { + type: "Identifier", + name: "prop", + + range: [23, 27], + loc: { + start: { column: 11, line: 2 }, + end: { column: 15, line: 2 }, + }, + }, + override: false, + static: false, + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSStringKeyword { + type: "TSStringKeyword", + + range: [29, 35], + loc: { + start: { column: 17, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + + range: [27, 35], + loc: { + start: { column: 15, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + value: null, + + range: [14, 36], + loc: { + start: { column: 2, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, + ], + + range: [10, 38], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 38], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 39], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..3787e2a78f8 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,96 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty with-annotation-no-value TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [14, 22], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "prop", + + range: [23, 27], + loc: { + start: { column: 11, 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "string", + + range: [29, 35], + loc: { + start: { column: 17, 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: [37, 38], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/snapshots/3-Babel-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/snapshots/3-Babel-Error.shot new file mode 100644 index 00000000000..95932fa9389 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/snapshots/3-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty with-annotation-no-value Babel - Error 1`] = `[SyntaxError: Missing semicolon. (2:15)]`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/config.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/config.ts new file mode 100644 index 00000000000..61e0e137a0e --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/config.ts @@ -0,0 +1,3 @@ +export default { + expectBabelToNotSupport: 'https://github.com/babel/babel/issues/15205', +} satisfies ASTFixtureConfig; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/fixture.ts new file mode 100644 index 00000000000..0fde6c3138c --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + accessor prop: string = 'str'; +} diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..9e9448b46f1 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,99 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty with-annotation-with-value TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + AccessorProperty { + type: "AccessorProperty", + computed: false, + declare: false, + key: Identifier { + type: "Identifier", + name: "prop", + + range: [23, 27], + loc: { + start: { column: 11, line: 2 }, + end: { column: 15, line: 2 }, + }, + }, + override: false, + static: false, + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSStringKeyword { + type: "TSStringKeyword", + + range: [29, 35], + loc: { + start: { column: 17, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + + range: [27, 35], + loc: { + start: { column: 15, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + value: Literal { + type: "Literal", + raw: "'str'", + value: "str", + + range: [38, 43], + loc: { + start: { column: 26, line: 2 }, + end: { column: 31, line: 2 }, + }, + }, + + range: [14, 44], + loc: { + start: { column: 2, line: 2 }, + end: { column: 32, line: 2 }, + }, + }, + ], + + range: [10, 46], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 46], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 47], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..2ee9140971c --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,116 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty with-annotation-with-value TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [14, 22], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "prop", + + range: [23, 27], + loc: { + start: { column: 11, 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "string", + + range: [29, 35], + loc: { + start: { column: 17, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [36, 37], + loc: { + start: { column: 24, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, + String { + type: "String", + value: "'str'", + + range: [38, 43], + loc: { + start: { column: 26, line: 2 }, + end: { column: 31, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [43, 44], + loc: { + start: { column: 31, line: 2 }, + end: { column: 32, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [45, 46], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/snapshots/3-Babel-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/snapshots/3-Babel-Error.shot new file mode 100644 index 00000000000..58104f64f7b --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/snapshots/3-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty with-annotation-with-value Babel - Error 1`] = `[SyntaxError: Missing semicolon. (2:15)]`; diff --git a/packages/ast-spec/src/element/AccessorProperty/spec.ts b/packages/ast-spec/src/element/AccessorProperty/spec.ts new file mode 100644 index 00000000000..739481e9c23 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/spec.ts @@ -0,0 +1,19 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { + PropertyDefinitionComputedNameBase, + PropertyDefinitionNonComputedNameBase, +} from '../../base/PropertyDefinitionBase'; + +export interface AccessorPropertyComputedName + extends PropertyDefinitionComputedNameBase { + type: AST_NODE_TYPES.AccessorProperty; +} + +export interface AccessorPropertyNonComputedName + extends PropertyDefinitionNonComputedNameBase { + type: AST_NODE_TYPES.AccessorProperty; +} + +export type AccessorProperty = + | AccessorPropertyComputedName + | AccessorPropertyNonComputedName; diff --git a/packages/ast-spec/src/element/TSAbstractAccessorProperty/spec.ts b/packages/ast-spec/src/element/TSAbstractAccessorProperty/spec.ts new file mode 100644 index 00000000000..6ca44e44183 --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractAccessorProperty/spec.ts @@ -0,0 +1,22 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { + PropertyDefinitionComputedNameBase, + PropertyDefinitionNonComputedNameBase, +} from '../../base/PropertyDefinitionBase'; + +export interface TSAbstractAccessorPropertyComputedName + extends PropertyDefinitionComputedNameBase { + type: AST_NODE_TYPES.TSAbstractAccessorProperty; + value: null; +} + +export interface TSAbstractAccessorPropertyNonComputedName + // this does not extend ClassPropertyDefinitionNonComputedNameBase because abstract private names are not allowed + extends PropertyDefinitionNonComputedNameBase { + type: AST_NODE_TYPES.TSAbstractAccessorProperty; + value: null; +} + +export type TSAbstractAccessorProperty = + | TSAbstractAccessorPropertyComputedName + | TSAbstractAccessorPropertyNonComputedName; diff --git a/packages/ast-spec/src/element/spec.ts b/packages/ast-spec/src/element/spec.ts index 77ed3f2f283..eeecc41028c 100644 --- a/packages/ast-spec/src/element/spec.ts +++ b/packages/ast-spec/src/element/spec.ts @@ -1,8 +1,10 @@ +export * from './AccessorProperty/spec'; export * from './PropertyDefinition/spec'; export * from './MethodDefinition/spec'; export * from './Property/spec'; export * from './SpreadElement/spec'; export * from './StaticBlock/spec'; +export * from './TSAbstractAccessorProperty/spec'; export * from './TSAbstractPropertyDefinition/spec'; export * from './TSAbstractMethodDefinition/spec'; export * from './TSCallSignatureDeclaration/spec'; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/array-array/fixture.ts b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/array-array/fixture.ts new file mode 100644 index 00000000000..36e81ab9edb --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/array-array/fixture.ts @@ -0,0 +1 @@ +[1, 2, 3] satisfies [1, 2, 3]; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/array-array/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/array-array/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..cfbfed088ce --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/array-array/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,149 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression array-array TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: ArrayExpression { + type: "ArrayExpression", + elements: Array [ + Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [1, 2], + loc: { + start: { column: 1, line: 1 }, + end: { column: 2, line: 1 }, + }, + }, + Literal { + type: "Literal", + raw: "2", + value: 2, + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Literal { + type: "Literal", + raw: "3", + value: 3, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + ], + + range: [0, 9], + loc: { + start: { column: 0, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + typeAnnotation: TSTupleType { + type: "TSTupleType", + elementTypes: Array [ + TSLiteralType { + type: "TSLiteralType", + literal: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + TSLiteralType { + type: "TSLiteralType", + literal: Literal { + type: "Literal", + raw: "2", + value: 2, + + range: [24, 25], + loc: { + start: { column: 24, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + + range: [24, 25], + loc: { + start: { column: 24, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + TSLiteralType { + type: "TSLiteralType", + literal: Literal { + type: "Literal", + raw: "3", + value: 3, + + range: [27, 28], + loc: { + start: { column: 27, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + + range: [27, 28], + loc: { + start: { column: 27, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + ], + + range: [20, 29], + loc: { + start: { column: 20, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + + range: [0, 29], + loc: { + start: { column: 0, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + + range: [0, 30], + loc: { + start: { column: 0, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/array-array/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/array-array/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..b4adbaf21bb --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/array-array/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,166 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression array-array TSESTree - Tokens 1`] = ` +Array [ + Punctuator { + type: "Punctuator", + value: "[", + + range: [0, 1], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [1, 2], + loc: { + start: { column: 1, line: 1 }, + end: { column: 2, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [2, 3], + loc: { + start: { column: 2, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "2", + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [5, 6], + loc: { + start: { column: 5, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "3", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [10, 19], + loc: { + start: { column: 10, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + 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 }, + }, + }, + Numeric { + type: "Numeric", + value: "2", + + 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 }, + }, + }, + Numeric { + type: "Numeric", + value: "3", + + range: [27, 28], + loc: { + start: { column: 27, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [28, 29], + loc: { + start: { column: 28, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [29, 30], + loc: { + start: { column: 29, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/array-array/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/array-array/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..635240ef2dd --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/array-array/snapshots/3-Babel-AST.shot @@ -0,0 +1,149 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression array-array Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: ArrayExpression { + type: "ArrayExpression", + elements: Array [ + Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [1, 2], + loc: { + start: { column: 1, line: 1 }, + end: { column: 2, line: 1 }, + }, + }, + Literal { + type: "Literal", + raw: "2", + value: 2, + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Literal { + type: "Literal", + raw: "3", + value: 3, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + ], + + range: [0, 9], + loc: { + start: { column: 0, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + typeAnnotation: TSTupleType { + type: "TSTupleType", + elementTypes: Array [ + TSLiteralType { + type: "TSLiteralType", + literal: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + TSLiteralType { + type: "TSLiteralType", + literal: Literal { + type: "Literal", + raw: "2", + value: 2, + + range: [24, 25], + loc: { + start: { column: 24, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + + range: [24, 25], + loc: { + start: { column: 24, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + TSLiteralType { + type: "TSLiteralType", + literal: Literal { + type: "Literal", + raw: "3", + value: 3, + + range: [27, 28], + loc: { + start: { column: 27, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + + range: [27, 28], + loc: { + start: { column: 27, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + ], + + range: [20, 29], + loc: { + start: { column: 20, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + + range: [0, 29], + loc: { + start: { column: 0, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + + range: [0, 30], + loc: { + start: { column: 0, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/array-array/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/array-array/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..814b7c0915b --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/array-array/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,166 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression array-array Babel - Tokens 1`] = ` +Array [ + Punctuator { + type: "Punctuator", + value: "[", + + range: [0, 1], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [1, 2], + loc: { + start: { column: 1, line: 1 }, + end: { column: 2, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [2, 3], + loc: { + start: { column: 2, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "2", + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [5, 6], + loc: { + start: { column: 5, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "3", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [10, 19], + loc: { + start: { column: 10, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + 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 }, + }, + }, + Numeric { + type: "Numeric", + value: "2", + + 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 }, + }, + }, + Numeric { + type: "Numeric", + value: "3", + + range: [27, 28], + loc: { + start: { column: 27, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [28, 29], + loc: { + start: { column: 28, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [29, 30], + loc: { + start: { column: 29, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/array-array/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/array-array/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..3cf7cab2487 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/array-array/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression array-array AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/array-array/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/array-array/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..263f9da8e6c --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/array-array/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression array-array AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-no-parentheses/fixture.ts b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-no-parentheses/fixture.ts new file mode 100644 index 00000000000..23c6cdf5a50 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-no-parentheses/fixture.ts @@ -0,0 +1 @@ +() => 1 satisfies number; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-no-parentheses/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-no-parentheses/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..d678e2b5ace --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-no-parentheses/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,68 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression arrow-func-no-parentheses TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: ArrowFunctionExpression { + type: "ArrowFunctionExpression", + async: false, + body: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + typeAnnotation: TSNumberKeyword { + type: "TSNumberKeyword", + + range: [18, 24], + loc: { + start: { column: 18, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + + range: [6, 24], + loc: { + start: { column: 6, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + expression: true, + generator: false, + id: null, + params: Array [], + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + + range: [0, 25], + loc: { + start: { column: 0, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 26], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-no-parentheses/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-no-parentheses/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..0d642d94824 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-no-parentheses/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression arrow-func-no-parentheses TSESTree - Tokens 1`] = ` +Array [ + 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 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=>", + + range: [3, 5], + loc: { + start: { column: 3, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [8, 17], + loc: { + start: { column: 8, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "number", + + range: [18, 24], + loc: { + start: { column: 18, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [24, 25], + loc: { + start: { column: 24, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-no-parentheses/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-no-parentheses/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..55e90ce71c0 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-no-parentheses/snapshots/3-Babel-AST.shot @@ -0,0 +1,68 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression arrow-func-no-parentheses Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: ArrowFunctionExpression { + type: "ArrowFunctionExpression", + async: false, + body: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + typeAnnotation: TSNumberKeyword { + type: "TSNumberKeyword", + + range: [18, 24], + loc: { + start: { column: 18, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + + range: [6, 24], + loc: { + start: { column: 6, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + expression: true, + generator: false, + id: null, + params: Array [], + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + + range: [0, 25], + loc: { + start: { column: 0, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 26], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-no-parentheses/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-no-parentheses/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..c921c840faa --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-no-parentheses/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression arrow-func-no-parentheses Babel - Tokens 1`] = ` +Array [ + 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 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=>", + + range: [3, 5], + loc: { + start: { column: 3, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [8, 17], + loc: { + start: { column: 8, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "number", + + range: [18, 24], + loc: { + start: { column: 18, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [24, 25], + loc: { + start: { column: 24, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-no-parentheses/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-no-parentheses/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..4697cea82c6 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-no-parentheses/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression arrow-func-no-parentheses AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-no-parentheses/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-no-parentheses/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..7fd90338cb4 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-no-parentheses/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression arrow-func-no-parentheses AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-with-parentheses/fixture.ts b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-with-parentheses/fixture.ts new file mode 100644 index 00000000000..d0e16762720 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-with-parentheses/fixture.ts @@ -0,0 +1 @@ +(() => 1) satisfies () => number; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-with-parentheses/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-with-parentheses/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..193cbbd12e3 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-with-parentheses/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,87 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression arrow-func-with-parentheses TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: ArrowFunctionExpression { + type: "ArrowFunctionExpression", + async: false, + body: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + expression: true, + generator: false, + id: null, + params: Array [], + + range: [1, 8], + loc: { + start: { column: 1, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + typeAnnotation: TSFunctionType { + type: "TSFunctionType", + params: Array [], + returnType: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSNumberKeyword { + type: "TSNumberKeyword", + + range: [26, 32], + loc: { + start: { column: 26, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + + range: [23, 32], + loc: { + start: { column: 23, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + + range: [20, 32], + loc: { + start: { column: 20, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + + range: [0, 33], + loc: { + start: { column: 0, line: 1 }, + end: { column: 33, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 34], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-with-parentheses/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-with-parentheses/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..7e75dcaa2c0 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-with-parentheses/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,126 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression arrow-func-with-parentheses TSESTree - Tokens 1`] = ` +Array [ + 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 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [2, 3], + loc: { + start: { column: 2, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=>", + + range: [4, 6], + loc: { + start: { column: 4, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [10, 19], + loc: { + start: { column: 10, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=>", + + range: [23, 25], + loc: { + start: { column: 23, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "number", + + range: [26, 32], + loc: { + start: { column: 26, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [32, 33], + loc: { + start: { column: 32, line: 1 }, + end: { column: 33, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-with-parentheses/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-with-parentheses/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..7bddc387f4c --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-with-parentheses/snapshots/3-Babel-AST.shot @@ -0,0 +1,87 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression arrow-func-with-parentheses Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: ArrowFunctionExpression { + type: "ArrowFunctionExpression", + async: false, + body: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + expression: true, + generator: false, + id: null, + params: Array [], + + range: [1, 8], + loc: { + start: { column: 1, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + typeAnnotation: TSFunctionType { + type: "TSFunctionType", + parameters: Array [], + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSNumberKeyword { + type: "TSNumberKeyword", + + range: [26, 32], + loc: { + start: { column: 26, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + + range: [23, 32], + loc: { + start: { column: 23, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + + range: [20, 32], + loc: { + start: { column: 20, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + + range: [0, 33], + loc: { + start: { column: 0, line: 1 }, + end: { column: 33, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 34], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-with-parentheses/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-with-parentheses/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..5edb3e0a841 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-with-parentheses/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,126 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression arrow-func-with-parentheses Babel - Tokens 1`] = ` +Array [ + 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 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [2, 3], + loc: { + start: { column: 2, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=>", + + range: [4, 6], + loc: { + start: { column: 4, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [10, 19], + loc: { + start: { column: 10, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=>", + + range: [23, 25], + loc: { + start: { column: 23, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "number", + + range: [26, 32], + loc: { + start: { column: 26, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [32, 33], + loc: { + start: { column: 32, line: 1 }, + end: { column: 33, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-with-parentheses/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-with-parentheses/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..1999cc34c68 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-with-parentheses/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,93 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression arrow-func-with-parentheses AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: TSSatisfiesExpression { + type: 'TSSatisfiesExpression', + expression: ArrowFunctionExpression { + type: 'ArrowFunctionExpression', + async: false, + body: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + expression: true, + generator: false, + id: null, + params: Array [], + + range: [1, 8], + loc: { + start: { column: 1, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + typeAnnotation: TSFunctionType { + type: 'TSFunctionType', +- params: Array [], +- returnType: TSTypeAnnotation { ++ parameters: Array [], ++ typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [26, 32], + loc: { + start: { column: 26, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + + range: [23, 32], + loc: { + start: { column: 23, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + + range: [20, 32], + loc: { + start: { column: 20, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + + range: [0, 33], + loc: { + start: { column: 0, line: 1 }, + end: { column: 33, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 34], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-with-parentheses/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-with-parentheses/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..f3d317fb4b7 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-with-parentheses/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression arrow-func-with-parentheses AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/fixture.ts b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/fixture.ts new file mode 100644 index 00000000000..65dcd3629bd --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/fixture.ts @@ -0,0 +1 @@ +foo satisfies bar satisfies baz; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..508caf4b944 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,91 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression chained-satisfies TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: Identifier { + type: "Identifier", + name: "foo", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + typeAnnotation: TSTypeReference { + type: "TSTypeReference", + typeName: Identifier { + type: "Identifier", + name: "bar", + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + + range: [0, 17], + loc: { + start: { column: 0, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + typeAnnotation: TSTypeReference { + type: "TSTypeReference", + typeName: Identifier { + type: "Identifier", + name: "baz", + + range: [28, 31], + loc: { + start: { column: 28, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + + range: [28, 31], + loc: { + start: { column: 28, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 33], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..dd0ebe5a72f --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression chained-satisfies TSESTree - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "foo", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [4, 13], + loc: { + start: { column: 4, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "bar", + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [18, 27], + loc: { + start: { column: 18, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "baz", + + 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 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..190d8d14fd0 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/3-Babel-AST.shot @@ -0,0 +1,91 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression chained-satisfies Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: Identifier { + type: "Identifier", + name: "foo", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + typeAnnotation: TSTypeReference { + type: "TSTypeReference", + typeName: Identifier { + type: "Identifier", + name: "bar", + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + + range: [0, 17], + loc: { + start: { column: 0, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + typeAnnotation: TSTypeReference { + type: "TSTypeReference", + typeName: Identifier { + type: "Identifier", + name: "baz", + + range: [28, 31], + loc: { + start: { column: 28, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + + range: [28, 31], + loc: { + start: { column: 28, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 33], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..5afc144ecef --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression chained-satisfies Babel - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "foo", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [4, 13], + loc: { + start: { column: 4, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "bar", + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [18, 27], + loc: { + start: { column: 18, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "baz", + + 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 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..0d7d689095e --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression chained-satisfies AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..b7cbaaf6bb8 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression chained-satisfies AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/fixture.ts b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/fixture.ts new file mode 100644 index 00000000000..dc8407dc0d6 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/fixture.ts @@ -0,0 +1 @@ +foo ? 1 : (0 satisfies number); diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..bb649ea977d --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,84 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression conditional-no-parentheses TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: ConditionalExpression { + type: "ConditionalExpression", + alternate: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: Literal { + type: "Literal", + raw: "0", + value: 0, + + range: [11, 12], + loc: { + start: { column: 11, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + typeAnnotation: TSNumberKeyword { + type: "TSNumberKeyword", + + range: [23, 29], + loc: { + start: { column: 23, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + + range: [11, 29], + loc: { + start: { column: 11, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + consequent: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + test: Identifier { + type: "Identifier", + name: "foo", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + + range: [0, 30], + loc: { + start: { column: 0, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..43f6da6a680 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,106 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression conditional-no-parentheses TSESTree - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "foo", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "?", + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "0", + + range: [11, 12], + loc: { + start: { column: 11, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [13, 22], + loc: { + start: { column: 13, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "number", + + range: [23, 29], + loc: { + start: { column: 23, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [29, 30], + loc: { + start: { column: 29, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [30, 31], + loc: { + start: { column: 30, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..4cba5b2f4f1 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/3-Babel-AST.shot @@ -0,0 +1,84 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression conditional-no-parentheses Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: ConditionalExpression { + type: "ConditionalExpression", + alternate: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: Literal { + type: "Literal", + raw: "0", + value: 0, + + range: [11, 12], + loc: { + start: { column: 11, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + typeAnnotation: TSNumberKeyword { + type: "TSNumberKeyword", + + range: [23, 29], + loc: { + start: { column: 23, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + + range: [11, 29], + loc: { + start: { column: 11, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + consequent: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + test: Identifier { + type: "Identifier", + name: "foo", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + + range: [0, 30], + loc: { + start: { column: 0, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..80d8c6ce89e --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,106 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression conditional-no-parentheses Babel - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "foo", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "?", + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "0", + + range: [11, 12], + loc: { + start: { column: 11, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [13, 22], + loc: { + start: { column: 13, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "number", + + range: [23, 29], + loc: { + start: { column: 23, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [29, 30], + loc: { + start: { column: 29, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [30, 31], + loc: { + start: { column: 30, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..a35b55978ba --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression conditional-no-parentheses AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..220450772c1 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression conditional-no-parentheses AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/fixture.ts b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/fixture.ts new file mode 100644 index 00000000000..5c71ca2d0e6 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/fixture.ts @@ -0,0 +1 @@ +(foo ? 1 : 0) satisfies number; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..2194d921890 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,84 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression conditional-with-parentheses TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: ConditionalExpression { + type: "ConditionalExpression", + alternate: Literal { + type: "Literal", + raw: "0", + value: 0, + + range: [11, 12], + loc: { + start: { column: 11, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + consequent: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + test: Identifier { + type: "Identifier", + name: "foo", + + range: [1, 4], + loc: { + start: { column: 1, line: 1 }, + end: { column: 4, line: 1 }, + }, + }, + + range: [1, 12], + loc: { + start: { column: 1, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + typeAnnotation: TSNumberKeyword { + type: "TSNumberKeyword", + + range: [24, 30], + loc: { + start: { column: 24, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + + range: [0, 30], + loc: { + start: { column: 0, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..09ed0254895 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,106 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression conditional-with-parentheses TSESTree - Tokens 1`] = ` +Array [ + Punctuator { + type: "Punctuator", + value: "(", + + range: [0, 1], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [1, 4], + loc: { + start: { column: 1, line: 1 }, + end: { column: 4, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "?", + + range: [5, 6], + loc: { + start: { column: 5, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "0", + + range: [11, 12], + loc: { + start: { column: 11, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [14, 23], + loc: { + start: { column: 14, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "number", + + range: [24, 30], + loc: { + start: { column: 24, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [30, 31], + loc: { + start: { column: 30, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..39a9e9951ad --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/3-Babel-AST.shot @@ -0,0 +1,84 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression conditional-with-parentheses Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: ConditionalExpression { + type: "ConditionalExpression", + alternate: Literal { + type: "Literal", + raw: "0", + value: 0, + + range: [11, 12], + loc: { + start: { column: 11, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + consequent: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + test: Identifier { + type: "Identifier", + name: "foo", + + range: [1, 4], + loc: { + start: { column: 1, line: 1 }, + end: { column: 4, line: 1 }, + }, + }, + + range: [1, 12], + loc: { + start: { column: 1, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + typeAnnotation: TSNumberKeyword { + type: "TSNumberKeyword", + + range: [24, 30], + loc: { + start: { column: 24, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + + range: [0, 30], + loc: { + start: { column: 0, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..7ca2b46ad24 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,106 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression conditional-with-parentheses Babel - Tokens 1`] = ` +Array [ + Punctuator { + type: "Punctuator", + value: "(", + + range: [0, 1], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [1, 4], + loc: { + start: { column: 1, line: 1 }, + end: { column: 4, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "?", + + range: [5, 6], + loc: { + start: { column: 5, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "0", + + range: [11, 12], + loc: { + start: { column: 11, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [14, 23], + loc: { + start: { column: 14, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "number", + + range: [24, 30], + loc: { + start: { column: 24, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [30, 31], + loc: { + start: { column: 30, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..45e35dfc272 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression conditional-with-parentheses AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..36442e7ebdc --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression conditional-with-parentheses AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/fixture.ts b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/fixture.ts new file mode 100644 index 00000000000..2ce6678d398 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/fixture.ts @@ -0,0 +1 @@ +foo satisfies boolean; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..7b7bb15a5af --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,53 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression identifier-keyword TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: Identifier { + type: "Identifier", + name: "foo", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + typeAnnotation: TSBooleanKeyword { + type: "TSBooleanKeyword", + + range: [14, 21], + loc: { + start: { column: 14, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + + range: [0, 21], + loc: { + start: { column: 0, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + + range: [0, 22], + loc: { + start: { column: 0, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..3563bcb2809 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,46 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression identifier-keyword TSESTree - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "foo", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [4, 13], + loc: { + start: { column: 4, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "boolean", + + range: [14, 21], + loc: { + start: { column: 14, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..8be9fb16653 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/3-Babel-AST.shot @@ -0,0 +1,53 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression identifier-keyword Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: Identifier { + type: "Identifier", + name: "foo", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + typeAnnotation: TSBooleanKeyword { + type: "TSBooleanKeyword", + + range: [14, 21], + loc: { + start: { column: 14, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + + range: [0, 21], + loc: { + start: { column: 0, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + + range: [0, 22], + loc: { + start: { column: 0, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..2559a7666c6 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,46 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression identifier-keyword Babel - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "foo", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [4, 13], + loc: { + start: { column: 4, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "boolean", + + range: [14, 21], + loc: { + start: { column: 14, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..c167cbcb46b --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression identifier-keyword AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..7dad93b1da3 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression identifier-keyword AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/fixture.ts b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/fixture.ts new file mode 100644 index 00000000000..cdcca67f637 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/fixture.ts @@ -0,0 +1 @@ +foo satisfies { prop: 'value' }; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..6197262c7a0 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,104 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression identifier-object-type TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: Identifier { + type: "Identifier", + name: "foo", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + typeAnnotation: TSTypeLiteral { + type: "TSTypeLiteral", + members: Array [ + TSPropertySignature { + type: "TSPropertySignature", + computed: false, + key: Identifier { + type: "Identifier", + name: "prop", + + range: [16, 20], + loc: { + start: { column: 16, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSLiteralType { + type: "TSLiteralType", + literal: Literal { + type: "Literal", + raw: "'value'", + value: "value", + + range: [22, 29], + loc: { + start: { column: 22, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + + range: [22, 29], + loc: { + start: { column: 22, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + + range: [20, 29], + loc: { + start: { column: 20, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + + range: [16, 29], + loc: { + start: { column: 16, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + ], + + range: [14, 31], + loc: { + start: { column: 14, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 33], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..99673ea1ecf --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,86 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression identifier-object-type TSESTree - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "foo", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [4, 13], + loc: { + start: { column: 4, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [14, 15], + loc: { + start: { column: 14, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "prop", + + range: [16, 20], + loc: { + start: { column: 16, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + String { + type: "String", + value: "'value'", + + range: [22, 29], + loc: { + start: { column: 22, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [30, 31], + loc: { + start: { column: 30, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [31, 32], + loc: { + start: { column: 31, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..a2861a34b1f --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/3-Babel-AST.shot @@ -0,0 +1,104 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression identifier-object-type Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: Identifier { + type: "Identifier", + name: "foo", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + typeAnnotation: TSTypeLiteral { + type: "TSTypeLiteral", + members: Array [ + TSPropertySignature { + type: "TSPropertySignature", + computed: false, + key: Identifier { + type: "Identifier", + name: "prop", + + range: [16, 20], + loc: { + start: { column: 16, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSLiteralType { + type: "TSLiteralType", + literal: Literal { + type: "Literal", + raw: "'value'", + value: "value", + + range: [22, 29], + loc: { + start: { column: 22, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + + range: [22, 29], + loc: { + start: { column: 22, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + + range: [20, 29], + loc: { + start: { column: 20, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + + range: [16, 29], + loc: { + start: { column: 16, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + ], + + range: [14, 31], + loc: { + start: { column: 14, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 33], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..34926c2bea7 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,86 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression identifier-object-type Babel - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "foo", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [4, 13], + loc: { + start: { column: 4, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [14, 15], + loc: { + start: { column: 14, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "prop", + + range: [16, 20], + loc: { + start: { column: 16, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + String { + type: "String", + value: "'value'", + + range: [22, 29], + loc: { + start: { column: 22, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [30, 31], + loc: { + start: { column: 30, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [31, 32], + loc: { + start: { column: 31, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..8e025552275 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression identifier-object-type AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..bfb99b63e1c --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression identifier-object-type AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/fixture.ts b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/fixture.ts new file mode 100644 index 00000000000..266a2ad0836 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/fixture.ts @@ -0,0 +1 @@ +foo satisfies [1, 2, 3]; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..57c80c5a805 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,115 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression identifier-tuple-type TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: Identifier { + type: "Identifier", + name: "foo", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + typeAnnotation: TSTupleType { + type: "TSTupleType", + elementTypes: Array [ + TSLiteralType { + type: "TSLiteralType", + literal: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + TSLiteralType { + type: "TSLiteralType", + literal: Literal { + type: "Literal", + raw: "2", + value: 2, + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + TSLiteralType { + type: "TSLiteralType", + literal: Literal { + type: "Literal", + raw: "3", + value: 3, + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + ], + + range: [14, 23], + loc: { + start: { column: 14, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 25], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..07ece3eadee --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,106 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression identifier-tuple-type TSESTree - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "foo", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [4, 13], + loc: { + start: { column: 4, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [14, 15], + loc: { + start: { column: 14, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [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 }, + }, + }, + Numeric { + type: "Numeric", + value: "2", + + 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 }, + }, + }, + Numeric { + type: "Numeric", + value: "3", + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [22, 23], + loc: { + start: { column: 22, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [23, 24], + loc: { + start: { column: 23, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..7201de5d38f --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/3-Babel-AST.shot @@ -0,0 +1,115 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression identifier-tuple-type Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: Identifier { + type: "Identifier", + name: "foo", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + typeAnnotation: TSTupleType { + type: "TSTupleType", + elementTypes: Array [ + TSLiteralType { + type: "TSLiteralType", + literal: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + TSLiteralType { + type: "TSLiteralType", + literal: Literal { + type: "Literal", + raw: "2", + value: 2, + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + TSLiteralType { + type: "TSLiteralType", + literal: Literal { + type: "Literal", + raw: "3", + value: 3, + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + ], + + range: [14, 23], + loc: { + start: { column: 14, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 25], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..8a62c8d0380 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,106 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression identifier-tuple-type Babel - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "foo", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [4, 13], + loc: { + start: { column: 4, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [14, 15], + loc: { + start: { column: 14, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [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 }, + }, + }, + Numeric { + type: "Numeric", + value: "2", + + 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 }, + }, + }, + Numeric { + type: "Numeric", + value: "3", + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [22, 23], + loc: { + start: { column: 22, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [23, 24], + loc: { + start: { column: 23, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..eb993d611eb --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression identifier-tuple-type AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..3f0aa9841e8 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression identifier-tuple-type AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/fixture.ts b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/fixture.ts new file mode 100644 index 00000000000..953653b0e23 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/fixture.ts @@ -0,0 +1 @@ +foo === (1 satisfies number); diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..1ad1131264a --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,74 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression logical-no-parentheses TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: BinaryExpression { + type: "BinaryExpression", + left: Identifier { + type: "Identifier", + name: "foo", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + operator: "===", + right: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + typeAnnotation: TSNumberKeyword { + type: "TSNumberKeyword", + + range: [21, 27], + loc: { + start: { column: 21, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + + range: [9, 27], + loc: { + start: { column: 9, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + + range: [0, 28], + loc: { + start: { column: 0, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + + range: [0, 29], + loc: { + start: { column: 0, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 30], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..f5e333ee1db --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,86 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression logical-no-parentheses TSESTree - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "foo", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "===", + + range: [4, 7], + loc: { + start: { column: 4, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [11, 20], + loc: { + start: { column: 11, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "number", + + 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 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [28, 29], + loc: { + start: { column: 28, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..a2add050375 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/3-Babel-AST.shot @@ -0,0 +1,74 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression logical-no-parentheses Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: BinaryExpression { + type: "BinaryExpression", + left: Identifier { + type: "Identifier", + name: "foo", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + operator: "===", + right: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + typeAnnotation: TSNumberKeyword { + type: "TSNumberKeyword", + + range: [21, 27], + loc: { + start: { column: 21, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + + range: [9, 27], + loc: { + start: { column: 9, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + + range: [0, 28], + loc: { + start: { column: 0, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + + range: [0, 29], + loc: { + start: { column: 0, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 30], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/async/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/4-Babel-Tokens.shot similarity index 56% rename from packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/async/snapshots/2-TSESTree-Tokens.shot rename to packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/4-Babel-Tokens.shot index 57b56f38b08..e4fa1f6cea5 100644 --- a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/async/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/4-Babel-Tokens.shot @@ -1,54 +1,64 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration TSDeclareFunction async TSESTree - Tokens 1`] = ` +exports[`AST Fixtures expression TSSatisfiesExpression logical-no-parentheses Babel - Tokens 1`] = ` Array [ Identifier { type: "Identifier", - value: "declare", + value: "foo", - range: [0, 7], + range: [0, 3], loc: { start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "===", + + range: [4, 7], + loc: { + start: { column: 4, line: 1 }, end: { column: 7, line: 1 }, }, }, - Identifier { - type: "Identifier", - value: "async", + Punctuator { + type: "Punctuator", + value: "(", - range: [8, 13], + range: [8, 9], loc: { start: { column: 8, line: 1 }, - end: { column: 13, line: 1 }, + end: { column: 9, line: 1 }, }, }, - Keyword { - type: "Keyword", - value: "function", + Numeric { + type: "Numeric", + value: "1", - range: [14, 22], + range: [9, 10], loc: { - start: { column: 14, line: 1 }, - end: { column: 22, line: 1 }, + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, }, }, Identifier { type: "Identifier", - value: "foo", + value: "satisfies", - range: [23, 26], + range: [11, 20], loc: { - start: { column: 23, line: 1 }, - end: { column: 26, line: 1 }, + start: { column: 11, line: 1 }, + end: { column: 20, line: 1 }, }, }, - Punctuator { - type: "Punctuator", - value: "(", + Identifier { + type: "Identifier", + value: "number", - range: [26, 27], + range: [21, 27], loc: { - start: { column: 26, line: 1 }, + start: { column: 21, line: 1 }, end: { column: 27, line: 1 }, }, }, diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..a21b35204c9 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression logical-no-parentheses AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..6a3c807848a --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression logical-no-parentheses AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/fixture.ts b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/fixture.ts new file mode 100644 index 00000000000..a93f5746e7c --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/fixture.ts @@ -0,0 +1 @@ +(foo === 1) satisfies boolean; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..4401893b67e --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,74 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression logical-with-parentheses TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: BinaryExpression { + type: "BinaryExpression", + left: Identifier { + type: "Identifier", + name: "foo", + + range: [1, 4], + loc: { + start: { column: 1, line: 1 }, + end: { column: 4, line: 1 }, + }, + }, + operator: "===", + right: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + + range: [1, 10], + loc: { + start: { column: 1, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + typeAnnotation: TSBooleanKeyword { + type: "TSBooleanKeyword", + + range: [22, 29], + loc: { + start: { column: 22, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + + range: [0, 29], + loc: { + start: { column: 0, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + + range: [0, 30], + loc: { + start: { column: 0, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..7034fce1187 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,86 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression logical-with-parentheses TSESTree - Tokens 1`] = ` +Array [ + Punctuator { + type: "Punctuator", + value: "(", + + range: [0, 1], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [1, 4], + loc: { + start: { column: 1, line: 1 }, + end: { column: 4, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "===", + + range: [5, 8], + loc: { + start: { column: 5, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [12, 21], + loc: { + start: { column: 12, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "boolean", + + range: [22, 29], + loc: { + start: { column: 22, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [29, 30], + loc: { + start: { column: 29, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..fb10fc5442e --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/3-Babel-AST.shot @@ -0,0 +1,74 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression logical-with-parentheses Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: BinaryExpression { + type: "BinaryExpression", + left: Identifier { + type: "Identifier", + name: "foo", + + range: [1, 4], + loc: { + start: { column: 1, line: 1 }, + end: { column: 4, line: 1 }, + }, + }, + operator: "===", + right: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + + range: [1, 10], + loc: { + start: { column: 1, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + typeAnnotation: TSBooleanKeyword { + type: "TSBooleanKeyword", + + range: [22, 29], + loc: { + start: { column: 22, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + + range: [0, 29], + loc: { + start: { column: 0, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + + range: [0, 30], + loc: { + start: { column: 0, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..4c73b5cc818 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,86 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression logical-with-parentheses Babel - Tokens 1`] = ` +Array [ + Punctuator { + type: "Punctuator", + value: "(", + + range: [0, 1], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [1, 4], + loc: { + start: { column: 1, line: 1 }, + end: { column: 4, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "===", + + range: [5, 8], + loc: { + start: { column: 5, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [12, 21], + loc: { + start: { column: 12, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "boolean", + + range: [22, 29], + loc: { + start: { column: 22, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [29, 30], + loc: { + start: { column: 29, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..28594822212 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression logical-with-parentheses AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..b6881fd10cf --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression logical-with-parentheses AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/fixture.ts b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/fixture.ts new file mode 100644 index 00000000000..b7726f7f140 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/fixture.ts @@ -0,0 +1 @@ +({ prop: 'string' } satisfies { prop: string }); diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..c39ffc049d1 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,128 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression object-object-inner-parentheses TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: ObjectExpression { + type: "ObjectExpression", + properties: Array [ + Property { + type: "Property", + computed: false, + key: Identifier { + type: "Identifier", + name: "prop", + + range: [3, 7], + loc: { + start: { column: 3, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + kind: "init", + method: false, + shorthand: false, + value: Literal { + type: "Literal", + raw: "'string'", + value: "string", + + range: [9, 17], + loc: { + start: { column: 9, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + + range: [3, 17], + loc: { + start: { column: 3, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + + range: [1, 19], + loc: { + start: { column: 1, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + typeAnnotation: TSTypeLiteral { + type: "TSTypeLiteral", + members: Array [ + TSPropertySignature { + type: "TSPropertySignature", + computed: false, + key: Identifier { + type: "Identifier", + name: "prop", + + range: [32, 36], + loc: { + start: { column: 32, line: 1 }, + end: { column: 36, line: 1 }, + }, + }, + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSStringKeyword { + type: "TSStringKeyword", + + range: [38, 44], + loc: { + start: { column: 38, line: 1 }, + end: { column: 44, line: 1 }, + }, + }, + + range: [36, 44], + loc: { + start: { column: 36, line: 1 }, + end: { column: 44, line: 1 }, + }, + }, + + range: [32, 44], + loc: { + start: { column: 32, line: 1 }, + end: { column: 44, line: 1 }, + }, + }, + ], + + range: [30, 46], + loc: { + start: { column: 30, line: 1 }, + end: { column: 46, line: 1 }, + }, + }, + + range: [1, 46], + loc: { + start: { column: 1, line: 1 }, + end: { column: 46, line: 1 }, + }, + }, + + range: [0, 48], + loc: { + start: { column: 0, line: 1 }, + end: { column: 48, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 49], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..be50e77f271 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,146 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression object-object-inner-parentheses TSESTree - Tokens 1`] = ` +Array [ + 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: "prop", + + range: [3, 7], + loc: { + start: { column: 3, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + String { + type: "String", + value: "'string'", + + range: [9, 17], + loc: { + start: { column: 9, 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [20, 29], + loc: { + start: { column: 20, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [30, 31], + loc: { + start: { column: 30, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "prop", + + range: [32, 36], + loc: { + start: { column: 32, line: 1 }, + end: { column: 36, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [36, 37], + loc: { + start: { column: 36, line: 1 }, + end: { column: 37, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "string", + + range: [38, 44], + loc: { + start: { column: 38, line: 1 }, + end: { column: 44, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [45, 46], + loc: { + start: { column: 45, line: 1 }, + end: { column: 46, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [46, 47], + loc: { + start: { column: 46, line: 1 }, + end: { column: 47, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [47, 48], + loc: { + start: { column: 47, line: 1 }, + end: { column: 48, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..90c569abf82 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/3-Babel-AST.shot @@ -0,0 +1,128 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression object-object-inner-parentheses Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: ObjectExpression { + type: "ObjectExpression", + properties: Array [ + Property { + type: "Property", + computed: false, + key: Identifier { + type: "Identifier", + name: "prop", + + range: [3, 7], + loc: { + start: { column: 3, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + kind: "init", + method: false, + shorthand: false, + value: Literal { + type: "Literal", + raw: "'string'", + value: "string", + + range: [9, 17], + loc: { + start: { column: 9, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + + range: [3, 17], + loc: { + start: { column: 3, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + + range: [1, 19], + loc: { + start: { column: 1, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + typeAnnotation: TSTypeLiteral { + type: "TSTypeLiteral", + members: Array [ + TSPropertySignature { + type: "TSPropertySignature", + computed: false, + key: Identifier { + type: "Identifier", + name: "prop", + + range: [32, 36], + loc: { + start: { column: 32, line: 1 }, + end: { column: 36, line: 1 }, + }, + }, + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSStringKeyword { + type: "TSStringKeyword", + + range: [38, 44], + loc: { + start: { column: 38, line: 1 }, + end: { column: 44, line: 1 }, + }, + }, + + range: [36, 44], + loc: { + start: { column: 36, line: 1 }, + end: { column: 44, line: 1 }, + }, + }, + + range: [32, 44], + loc: { + start: { column: 32, line: 1 }, + end: { column: 44, line: 1 }, + }, + }, + ], + + range: [30, 46], + loc: { + start: { column: 30, line: 1 }, + end: { column: 46, line: 1 }, + }, + }, + + range: [1, 46], + loc: { + start: { column: 1, line: 1 }, + end: { column: 46, line: 1 }, + }, + }, + + range: [0, 48], + loc: { + start: { column: 0, line: 1 }, + end: { column: 48, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 49], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..45fc90349da --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,146 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression object-object-inner-parentheses Babel - Tokens 1`] = ` +Array [ + 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: "prop", + + range: [3, 7], + loc: { + start: { column: 3, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + String { + type: "String", + value: "'string'", + + range: [9, 17], + loc: { + start: { column: 9, 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [20, 29], + loc: { + start: { column: 20, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [30, 31], + loc: { + start: { column: 30, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "prop", + + range: [32, 36], + loc: { + start: { column: 32, line: 1 }, + end: { column: 36, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [36, 37], + loc: { + start: { column: 36, line: 1 }, + end: { column: 37, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "string", + + range: [38, 44], + loc: { + start: { column: 38, line: 1 }, + end: { column: 44, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [45, 46], + loc: { + start: { column: 45, line: 1 }, + end: { column: 46, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [46, 47], + loc: { + start: { column: 46, line: 1 }, + end: { column: 47, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [47, 48], + loc: { + start: { column: 47, line: 1 }, + end: { column: 48, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..bad308efe92 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression object-object-inner-parentheses AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..92a052f3254 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression object-object-inner-parentheses AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/fixture.ts b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/fixture.ts new file mode 100644 index 00000000000..b7726f7f140 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/fixture.ts @@ -0,0 +1 @@ +({ prop: 'string' } satisfies { prop: string }); diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..9100755681a --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,128 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression object-object-outer-parentheses TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: ObjectExpression { + type: "ObjectExpression", + properties: Array [ + Property { + type: "Property", + computed: false, + key: Identifier { + type: "Identifier", + name: "prop", + + range: [3, 7], + loc: { + start: { column: 3, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + kind: "init", + method: false, + shorthand: false, + value: Literal { + type: "Literal", + raw: "'string'", + value: "string", + + range: [9, 17], + loc: { + start: { column: 9, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + + range: [3, 17], + loc: { + start: { column: 3, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + + range: [1, 19], + loc: { + start: { column: 1, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + typeAnnotation: TSTypeLiteral { + type: "TSTypeLiteral", + members: Array [ + TSPropertySignature { + type: "TSPropertySignature", + computed: false, + key: Identifier { + type: "Identifier", + name: "prop", + + range: [32, 36], + loc: { + start: { column: 32, line: 1 }, + end: { column: 36, line: 1 }, + }, + }, + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSStringKeyword { + type: "TSStringKeyword", + + range: [38, 44], + loc: { + start: { column: 38, line: 1 }, + end: { column: 44, line: 1 }, + }, + }, + + range: [36, 44], + loc: { + start: { column: 36, line: 1 }, + end: { column: 44, line: 1 }, + }, + }, + + range: [32, 44], + loc: { + start: { column: 32, line: 1 }, + end: { column: 44, line: 1 }, + }, + }, + ], + + range: [30, 46], + loc: { + start: { column: 30, line: 1 }, + end: { column: 46, line: 1 }, + }, + }, + + range: [1, 46], + loc: { + start: { column: 1, line: 1 }, + end: { column: 46, line: 1 }, + }, + }, + + range: [0, 48], + loc: { + start: { column: 0, line: 1 }, + end: { column: 48, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 49], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..388f2790bb0 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,146 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression object-object-outer-parentheses TSESTree - Tokens 1`] = ` +Array [ + 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: "prop", + + range: [3, 7], + loc: { + start: { column: 3, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + String { + type: "String", + value: "'string'", + + range: [9, 17], + loc: { + start: { column: 9, 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [20, 29], + loc: { + start: { column: 20, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [30, 31], + loc: { + start: { column: 30, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "prop", + + range: [32, 36], + loc: { + start: { column: 32, line: 1 }, + end: { column: 36, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [36, 37], + loc: { + start: { column: 36, line: 1 }, + end: { column: 37, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "string", + + range: [38, 44], + loc: { + start: { column: 38, line: 1 }, + end: { column: 44, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [45, 46], + loc: { + start: { column: 45, line: 1 }, + end: { column: 46, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [46, 47], + loc: { + start: { column: 46, line: 1 }, + end: { column: 47, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [47, 48], + loc: { + start: { column: 47, line: 1 }, + end: { column: 48, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..16adf4fa64a --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/3-Babel-AST.shot @@ -0,0 +1,128 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression object-object-outer-parentheses Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: ObjectExpression { + type: "ObjectExpression", + properties: Array [ + Property { + type: "Property", + computed: false, + key: Identifier { + type: "Identifier", + name: "prop", + + range: [3, 7], + loc: { + start: { column: 3, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + kind: "init", + method: false, + shorthand: false, + value: Literal { + type: "Literal", + raw: "'string'", + value: "string", + + range: [9, 17], + loc: { + start: { column: 9, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + + range: [3, 17], + loc: { + start: { column: 3, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + + range: [1, 19], + loc: { + start: { column: 1, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + typeAnnotation: TSTypeLiteral { + type: "TSTypeLiteral", + members: Array [ + TSPropertySignature { + type: "TSPropertySignature", + computed: false, + key: Identifier { + type: "Identifier", + name: "prop", + + range: [32, 36], + loc: { + start: { column: 32, line: 1 }, + end: { column: 36, line: 1 }, + }, + }, + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSStringKeyword { + type: "TSStringKeyword", + + range: [38, 44], + loc: { + start: { column: 38, line: 1 }, + end: { column: 44, line: 1 }, + }, + }, + + range: [36, 44], + loc: { + start: { column: 36, line: 1 }, + end: { column: 44, line: 1 }, + }, + }, + + range: [32, 44], + loc: { + start: { column: 32, line: 1 }, + end: { column: 44, line: 1 }, + }, + }, + ], + + range: [30, 46], + loc: { + start: { column: 30, line: 1 }, + end: { column: 46, line: 1 }, + }, + }, + + range: [1, 46], + loc: { + start: { column: 1, line: 1 }, + end: { column: 46, line: 1 }, + }, + }, + + range: [0, 48], + loc: { + start: { column: 0, line: 1 }, + end: { column: 48, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 49], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..bdca107f453 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,146 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression object-object-outer-parentheses Babel - Tokens 1`] = ` +Array [ + 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: "prop", + + range: [3, 7], + loc: { + start: { column: 3, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + String { + type: "String", + value: "'string'", + + range: [9, 17], + loc: { + start: { column: 9, 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [20, 29], + loc: { + start: { column: 20, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [30, 31], + loc: { + start: { column: 30, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "prop", + + range: [32, 36], + loc: { + start: { column: 32, line: 1 }, + end: { column: 36, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [36, 37], + loc: { + start: { column: 36, line: 1 }, + end: { column: 37, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "string", + + range: [38, 44], + loc: { + start: { column: 38, line: 1 }, + end: { column: 44, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [45, 46], + loc: { + start: { column: 45, line: 1 }, + end: { column: 46, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [46, 47], + loc: { + start: { column: 46, line: 1 }, + end: { column: 47, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [47, 48], + loc: { + start: { column: 47, line: 1 }, + end: { column: 48, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..982ccda73a2 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression object-object-outer-parentheses AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..c113b8be7e9 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression object-object-outer-parentheses AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/spec.ts b/packages/ast-spec/src/expression/TSSatisfiesExpression/spec.ts new file mode 100644 index 00000000000..1297ade3eba --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/spec.ts @@ -0,0 +1,10 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; +import type { TypeNode } from '../../unions/TypeNode'; + +export interface TSSatisfiesExpression extends BaseNode { + type: AST_NODE_TYPES.TSSatisfiesExpression; + expression: Expression; + typeAnnotation: TypeNode; +} diff --git a/packages/ast-spec/src/expression/spec.ts b/packages/ast-spec/src/expression/spec.ts index 9ed4a0cc756..f753672d472 100644 --- a/packages/ast-spec/src/expression/spec.ts +++ b/packages/ast-spec/src/expression/spec.ts @@ -23,6 +23,7 @@ export * from './TSAsExpression/spec'; export * from './TSEmptyBodyFunctionExpression/spec'; export * from './TSInstantiationExpression/spec'; export * from './TSNonNullExpression/spec'; +export * from './TSSatisfiesExpression/spec'; export * from './TSTypeAssertion/spec'; export * from './TaggedTemplateExpression/spec'; export * from './TemplateLiteral/spec'; diff --git a/packages/ast-spec/src/unions/ClassElement.ts b/packages/ast-spec/src/unions/ClassElement.ts index 27d4ec4d752..21fba7babcf 100644 --- a/packages/ast-spec/src/unions/ClassElement.ts +++ b/packages/ast-spec/src/unions/ClassElement.ts @@ -1,14 +1,18 @@ +import type { AccessorProperty } from '../element/AccessorProperty/spec'; import type { MethodDefinition } from '../element/MethodDefinition/spec'; import type { PropertyDefinition } from '../element/PropertyDefinition/spec'; import type { StaticBlock } from '../element/StaticBlock/spec'; +import type { TSAbstractAccessorProperty } from '../element/TSAbstractAccessorProperty/spec'; import type { TSAbstractMethodDefinition } from '../element/TSAbstractMethodDefinition/spec'; import type { TSAbstractPropertyDefinition } from '../element/TSAbstractPropertyDefinition/spec'; import type { TSIndexSignature } from '../element/TSIndexSignature/spec'; export type ClassElement = + | AccessorProperty | MethodDefinition | PropertyDefinition | StaticBlock + | TSAbstractAccessorProperty | TSAbstractMethodDefinition | TSAbstractPropertyDefinition | TSIndexSignature; diff --git a/packages/ast-spec/src/unions/Expression.ts b/packages/ast-spec/src/unions/Expression.ts index 36220bc0391..1c0ee899ec3 100644 --- a/packages/ast-spec/src/unions/Expression.ts +++ b/packages/ast-spec/src/unions/Expression.ts @@ -25,6 +25,7 @@ import type { ThisExpression } from '../expression/ThisExpression/spec'; import type { TSAsExpression } from '../expression/TSAsExpression/spec'; import type { TSInstantiationExpression } from '../expression/TSInstantiationExpression/spec'; import type { TSNonNullExpression } from '../expression/TSNonNullExpression/spec'; +import type { TSSatisfiesExpression } from '../expression/TSSatisfiesExpression/spec'; import type { TSTypeAssertion } from '../expression/TSTypeAssertion/spec'; import type { UnaryExpression } from '../expression/UnaryExpression/spec'; import type { UpdateExpression } from '../expression/UpdateExpression/spec'; @@ -72,6 +73,7 @@ export type Expression = | TSAsExpression | TSInstantiationExpression | TSNonNullExpression + | TSSatisfiesExpression | TSTypeAssertion | UnaryExpression | UpdateExpression diff --git a/packages/ast-spec/src/unions/Node.ts b/packages/ast-spec/src/unions/Node.ts index 6505270427b..b0952e0e186 100644 --- a/packages/ast-spec/src/unions/Node.ts +++ b/packages/ast-spec/src/unions/Node.ts @@ -12,11 +12,13 @@ import type { TSModuleDeclaration } from '../declaration/TSModuleDeclaration/spe import type { TSNamespaceExportDeclaration } from '../declaration/TSNamespaceExportDeclaration/spec'; import type { TSTypeAliasDeclaration } from '../declaration/TSTypeAliasDeclaration/spec'; import type { VariableDeclaration } from '../declaration/VariableDeclaration/spec'; +import type { AccessorProperty } from '../element/AccessorProperty/spec'; import type { MethodDefinition } from '../element/MethodDefinition/spec'; import type { Property } from '../element/Property/spec'; import type { PropertyDefinition } from '../element/PropertyDefinition/spec'; import type { SpreadElement } from '../element/SpreadElement/spec'; import type { StaticBlock } from '../element/StaticBlock/spec'; +import type { TSAbstractAccessorProperty } from '../element/TSAbstractAccessorProperty/spec'; import type { TSAbstractMethodDefinition } from '../element/TSAbstractMethodDefinition/spec'; import type { TSAbstractPropertyDefinition } from '../element/TSAbstractPropertyDefinition/spec'; import type { TSCallSignatureDeclaration } from '../element/TSCallSignatureDeclaration/spec'; @@ -53,6 +55,7 @@ import type { TSAsExpression } from '../expression/TSAsExpression/spec'; import type { TSEmptyBodyFunctionExpression } from '../expression/TSEmptyBodyFunctionExpression/spec'; import type { TSInstantiationExpression } from '../expression/TSInstantiationExpression/spec'; import type { TSNonNullExpression } from '../expression/TSNonNullExpression/spec'; +import type { TSSatisfiesExpression } from '../expression/TSSatisfiesExpression/spec'; import type { TSTypeAssertion } from '../expression/TSTypeAssertion/spec'; import type { UnaryExpression } from '../expression/UnaryExpression/spec'; import type { UpdateExpression } from '../expression/UpdateExpression/spec'; @@ -169,6 +172,7 @@ import type { Literal } from './Literal'; */ export type Node = + | AccessorProperty | ArrayExpression | ArrayPattern | ArrowFunctionExpression @@ -250,6 +254,7 @@ export type Node = | ThisExpression | ThrowStatement | TryStatement + | TSAbstractAccessorProperty | TSAbstractKeyword | TSAbstractMethodDefinition | TSAbstractPropertyDefinition @@ -305,6 +310,7 @@ export type Node = | TSQualifiedName | TSReadonlyKeyword | TSRestType + | TSSatisfiesExpression | TSStaticKeyword | TSStringKeyword | TSSymbolKeyword diff --git a/packages/ast-spec/src/unions/TypeNode.ts b/packages/ast-spec/src/unions/TypeNode.ts index 461281cd4ce..f1859d7d347 100644 --- a/packages/ast-spec/src/unions/TypeNode.ts +++ b/packages/ast-spec/src/unions/TypeNode.ts @@ -25,6 +25,7 @@ import type { TSOptionalType } from '../type/TSOptionalType/spec'; import type { TSPrivateKeyword } from '../type/TSPrivateKeyword/spec'; import type { TSProtectedKeyword } from '../type/TSProtectedKeyword/spec'; import type { TSPublicKeyword } from '../type/TSPublicKeyword/spec'; +import type { TSQualifiedName } from '../type/TSQualifiedName/spec'; import type { TSReadonlyKeyword } from '../type/TSReadonlyKeyword/spec'; import type { TSRestType } from '../type/TSRestType/spec'; import type { TSStaticKeyword } from '../type/TSStaticKeyword/spec'; @@ -71,6 +72,7 @@ export type TypeNode = | TSPrivateKeyword | TSProtectedKeyword | TSPublicKeyword + | TSQualifiedName | TSReadonlyKeyword | TSRestType | TSStaticKeyword diff --git a/packages/ast-spec/tests/fixtures-with-differences-ast.shot b/packages/ast-spec/tests/fixtures-with-differences-ast.shot index 9d3e5d88ccc..e6ea1804e84 100644 --- a/packages/ast-spec/tests/fixtures-with-differences-ast.shot +++ b/packages/ast-spec/tests/fixtures-with-differences-ast.shot @@ -24,5 +24,19 @@ Set { "declaration/TSInterfaceDeclaration/fixtures/type-param-one/fixture.ts", "declaration/TSTypeAliasDeclaration/fixtures/type-param-many/fixture.ts", "declaration/TSTypeAliasDeclaration/fixtures/type-param-one/fixture.ts", + "element/AccessorProperty/fixtures/key-computed-complex/fixture.ts", + "element/AccessorProperty/fixtures/key-computed-number/fixture.ts", + "element/AccessorProperty/fixtures/key-computed-string/fixture.ts", + "element/AccessorProperty/fixtures/key-private/fixture.ts", + "element/AccessorProperty/fixtures/key-string/fixture.ts", + "element/AccessorProperty/fixtures/modifier-override/fixture.ts", + "element/AccessorProperty/fixtures/modifier-private/fixture.ts", + "element/AccessorProperty/fixtures/modifier-protected/fixture.ts", + "element/AccessorProperty/fixtures/modifier-public/fixture.ts", + "element/AccessorProperty/fixtures/modifier-readonly/fixture.ts", + "element/AccessorProperty/fixtures/modifier-static/fixture.ts", + "element/AccessorProperty/fixtures/no-annotation-no-value/fixture.ts", + "element/AccessorProperty/fixtures/no-annotation-with-value/fixture.ts", + "expression/TSSatisfiesExpression/fixtures/arrow-func-with-parentheses/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 7946dc0daab..68799952497 100644 --- a/packages/ast-spec/tests/fixtures-with-differences-errors.shot +++ b/packages/ast-spec/tests/fixtures-with-differences-errors.shot @@ -21,6 +21,8 @@ Object { "declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-extends/fixture.ts", "declaration/TSTypeAliasDeclaration/fixtures/_error_/missing-type-parameter/fixture.ts", "declaration/VariableDeclaration/fixtures/_error_/missing-id-without-value/fixture.ts", + "element/AccessorProperty/fixtures/_error_/modifier-declare/fixture.ts", + "element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/fixture.ts", }, "TSESTree errored but Babel didn't": Set { "declaration/ExportAllDeclaration/fixtures/_error_/named-non-identifier/fixture.ts", diff --git a/packages/ast-spec/tests/fixtures-with-differences-tokens.shot b/packages/ast-spec/tests/fixtures-with-differences-tokens.shot index ee92fc9b050..c9796a38459 100644 --- a/packages/ast-spec/tests/fixtures-with-differences-tokens.shot +++ b/packages/ast-spec/tests/fixtures-with-differences-tokens.shot @@ -22,5 +22,9 @@ Set { "declaration/VariableDeclaration/fixtures/let-with-value/fixture.ts", "declaration/VariableDeclaration/fixtures/let-without-value/fixture.ts", "declaration/VariableDeclaration/fixtures/multiple-declarations/fixture.ts", + "element/AccessorProperty/fixtures/key-private/fixture.ts", + "element/AccessorProperty/fixtures/modifier-private/fixture.ts", + "element/AccessorProperty/fixtures/modifier-protected/fixture.ts", + "element/AccessorProperty/fixtures/modifier-public/fixture.ts", } `; diff --git a/packages/ast-spec/tests/fixtures-without-babel-support.shot b/packages/ast-spec/tests/fixtures-without-babel-support.shot new file mode 100644 index 00000000000..a4022f6319b --- /dev/null +++ b/packages/ast-spec/tests/fixtures-without-babel-support.shot @@ -0,0 +1,10 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures List fixtures we expect babel to not support 1`] = ` +Map { + "element/AccessorProperty/fixtures/modifier-abstract-with-value/fixture.ts" => "https://github.com/babel/babel/issues/15205", + "element/AccessorProperty/fixtures/modifier-abstract/fixture.ts" => "https://github.com/babel/babel/issues/15205", + "element/AccessorProperty/fixtures/with-annotation-no-value/fixture.ts" => "https://github.com/babel/babel/issues/15205", + "element/AccessorProperty/fixtures/with-annotation-with-value/fixture.ts" => "https://github.com/babel/babel/issues/15205", +} +`; diff --git a/packages/ast-spec/tests/fixtures.test.ts b/packages/ast-spec/tests/fixtures.test.ts index 3fff2ead3f2..df70fe613eb 100644 --- a/packages/ast-spec/tests/fixtures.test.ts +++ b/packages/ast-spec/tests/fixtures.test.ts @@ -25,6 +25,7 @@ const ONLY = [].join(path.sep); const fixturesWithASTDifferences = new Set(); const fixturesWithTokenDifferences = new Set(); +const fixturesConfiguredToExpectBabelToNotSupport = new Map(); enum ErrorLabel { TSESTree = "TSESTree errored but Babel didn't", Babel = "Babel errored but TSESTree didn't", @@ -36,46 +37,67 @@ const fixturesWithErrorDifferences = { [ErrorLabel.Babel]: new Set(), } as const; -const validFixtures = glob.sync(`${SRC_DIR}/**/fixtures/*/*.{ts,tsx}`); -const errorFixtures = glob.sync(`${SRC_DIR}/**/fixtures/_error_/*/*.{ts,tsx}`); +const VALID_FIXTURES: readonly string[] = glob.sync( + `${SRC_DIR}/**/fixtures/*/fixture.{ts,tsx}`, +); +const ERROR_FIXTURES: readonly string[] = glob.sync( + `${SRC_DIR}/**/fixtures/_error_/*/fixture.{ts,tsx}`, +); -const fixtures: readonly Fixture[] = [...validFixtures, ...errorFixtures].map( +const FIXTURES: readonly Fixture[] = [...VALID_FIXTURES, ...ERROR_FIXTURES].map( absolute => { const relativeToSrc = path.relative(SRC_DIR, absolute); const { dir, ext } = path.parse(relativeToSrc); const segments = dir.split(path.sep).filter(s => s !== 'fixtures'); const name = segments.pop()!; - const snapshotPath = path.join(SRC_DIR, dir, 'snapshots'); + const fixtureDir = path.join(SRC_DIR, dir); + const configPath = path.join(fixtureDir, 'config' /* .ts */); + const snapshotPath = path.join(fixtureDir, 'snapshots'); return { absolute, - name, + config: ((): ASTFixtureConfig => { + try { + return require(configPath).default; + } catch { + return {}; + } + })(), ext, isError: absolute.includes('/_error_/'), isJSX: ext.endsWith('x'), + name, relative: path.relative(SRC_DIR, absolute), segments, - snapshotPath, snapshotFiles: { success: { tsestree: { - ast: path.join(snapshotPath, '1-TSESTree-AST.shot'), - tokens: path.join(snapshotPath, '2-TSESTree-Tokens.shot'), + ast: (i: number) => + path.join(snapshotPath, `${i}-TSESTree-AST.shot`), + tokens: (i: number) => + path.join(snapshotPath, `${i}-TSESTree-Tokens.shot`), }, babel: { - ast: path.join(snapshotPath, '3-Babel-AST.shot'), - tokens: path.join(snapshotPath, '4-Babel-Tokens.shot'), + ast: (i: number) => path.join(snapshotPath, `${i}-Babel-AST.shot`), + tokens: (i: number) => + path.join(snapshotPath, `${i}-Babel-Tokens.shot`), }, alignment: { - ast: path.join(snapshotPath, '5-AST-Alignment-AST.shot'), - tokens: path.join(snapshotPath, '6-AST-Alignment-Tokens.shot'), + ast: (i: number) => + path.join(snapshotPath, `${i}-AST-Alignment-AST.shot`), + tokens: (i: number) => + path.join(snapshotPath, `${i}-AST-Alignment-Tokens.shot`), }, }, error: { - tsestree: path.join(snapshotPath, '1-TSESTree-Error.shot'), - babel: path.join(snapshotPath, '2-Babel-Error.shot'), - alignment: path.join(snapshotPath, '3-Alignment-Error.shot'), + tsestree: (i: number) => + path.join(snapshotPath, `${i}-TSESTree-Error.shot`), + babel: (i: number) => + path.join(snapshotPath, `${i}-Babel-Error.shot`), + alignment: (i: number) => + path.join(snapshotPath, `${i}-Alignment-Error.shot`), }, }, + snapshotPath, }; }, ); @@ -130,6 +152,8 @@ function nestDescribe(fixture: Fixture, segments = fixture.segments): void { errorLabel = ErrorLabel.None; } + let snapshotCounter = 1; + if (fixture.isError) { if ( errorLabel === ErrorLabel.TSESTree || @@ -140,17 +164,17 @@ function nestDescribe(fixture: Fixture, segments = fixture.segments): void { it('TSESTree - Error', () => { expect(tsestreeParsed.error).toMatchSpecificSnapshot( - fixture.snapshotFiles.error.tsestree, + fixture.snapshotFiles.error.tsestree(snapshotCounter++), ); }); it('Babel - Error', () => { expect(babelParsed.error).toMatchSpecificSnapshot( - fixture.snapshotFiles.error.babel, + fixture.snapshotFiles.error.babel(snapshotCounter++), ); }); it('Error Alignment', () => { expect(errorLabel).toMatchSpecificSnapshot( - fixture.snapshotFiles.error.alignment, + fixture.snapshotFiles.error.alignment(snapshotCounter++), ); }); it('Should parse with errors', () => { @@ -162,63 +186,80 @@ function nestDescribe(fixture: Fixture, segments = fixture.segments): void { it('TSESTree - AST', () => { expectSuccessResponse(tsestreeParsed); expect(tsestreeParsed.ast).toMatchSpecificSnapshot( - fixture.snapshotFiles.success.tsestree.ast, + fixture.snapshotFiles.success.tsestree.ast(snapshotCounter++), ); }); it('TSESTree - Tokens', () => { expectSuccessResponse(tsestreeParsed); expect(tsestreeParsed.tokens).toMatchSpecificSnapshot( - fixture.snapshotFiles.success.tsestree.tokens, + fixture.snapshotFiles.success.tsestree.tokens(snapshotCounter++), ); }); - it('Babel - AST', () => { - expectSuccessResponse(babelParsed); - expect(babelParsed.ast).toMatchSpecificSnapshot( - fixture.snapshotFiles.success.babel.ast, + if (fixture.config.expectBabelToNotSupport != null) { + fixturesConfiguredToExpectBabelToNotSupport.set( + fixture.relative, + fixture.config.expectBabelToNotSupport, ); - }); - it('Babel - Tokens', () => { - expectSuccessResponse(babelParsed); - expect(babelParsed.tokens).toMatchSpecificSnapshot( - fixture.snapshotFiles.success.babel.tokens, - ); - }); - it('AST Alignment - AST', () => { - expectSuccessResponse(tsestreeParsed); - expectSuccessResponse(babelParsed); - const diffResult = snapshotDiff( - 'TSESTree', - tsestreeParsed.ast, - 'Babel', - babelParsed.ast, - ); - expect(diffResult).toMatchSpecificSnapshot( - fixture.snapshotFiles.success.alignment.ast, - ); + // eslint-disable-next-line jest/no-identical-title -- intentional duplication that won't ever happen due to exclusionary conditions + it('Babel - Error', () => { + expect(babelParsed.error).toMatchSpecificSnapshot( + fixture.snapshotFiles.error.babel(snapshotCounter++), + ); + }); + // eslint-disable-next-line jest/no-disabled-tests -- intentional skip for CLI documentation purposes + it.skip('Babel - Skipped as this fixture is configured to expect babel to error', () => {}); + // eslint-disable-next-line jest/no-disabled-tests -- intentional skip for CLI documentation purposes + it.skip('AST Alignment - Skipped as this fixture is configured to expect babel to error', () => {}); + } else { + it('Babel - AST', () => { + expectSuccessResponse(babelParsed); + expect(babelParsed.ast).toMatchSpecificSnapshot( + fixture.snapshotFiles.success.babel.ast(snapshotCounter++), + ); + }); + it('Babel - Tokens', () => { + expectSuccessResponse(babelParsed); + expect(babelParsed.tokens).toMatchSpecificSnapshot( + fixture.snapshotFiles.success.babel.tokens(snapshotCounter++), + ); + }); + it('AST Alignment - AST', () => { + expectSuccessResponse(tsestreeParsed); + expectSuccessResponse(babelParsed); + const diffResult = snapshotDiff( + 'TSESTree', + tsestreeParsed.ast, + 'Babel', + babelParsed.ast, + ); + expect(diffResult).toMatchSpecificSnapshot( + fixture.snapshotFiles.success.alignment.ast(snapshotCounter++), + ); - if (diffHasChanges(diffResult)) { - fixturesWithASTDifferences.add(fixture.relative); - } - }); - it('AST Alignment - Token', () => { - expectSuccessResponse(tsestreeParsed); - expectSuccessResponse(babelParsed); - const diffResult = snapshotDiff( - 'TSESTree', - tsestreeParsed.tokens, - 'Babel', - babelParsed.tokens, - ); - expect(diffResult).toMatchSpecificSnapshot( - fixture.snapshotFiles.success.alignment.tokens, - ); + if (diffHasChanges(diffResult)) { + fixturesWithASTDifferences.add(fixture.relative); + } + }); + it('AST Alignment - Token', () => { + expectSuccessResponse(tsestreeParsed); + expectSuccessResponse(babelParsed); + const diffResult = snapshotDiff( + 'TSESTree', + tsestreeParsed.tokens, + 'Babel', + babelParsed.tokens, + ); + expect(diffResult).toMatchSpecificSnapshot( + fixture.snapshotFiles.success.alignment.tokens(snapshotCounter++), + ); - if (diffHasChanges(diffResult)) { - fixturesWithTokenDifferences.add(fixture.relative); - } - }); + if (diffHasChanges(diffResult)) { + fixturesWithTokenDifferences.add(fixture.relative); + } + }); + } it('Should parse with no errors', () => { // log the error for debug purposes in case there wasn't supposed to be an error @@ -228,7 +269,9 @@ function nestDescribe(fixture: Fixture, segments = fixture.segments): void { case ErrorLabel.Babel: expectErrorResponse(babelParsed); - console.error('Babel:\n', babelParsed.error); + if (fixture.config.expectBabelToNotSupport == null) { + console.error('Babel:\n', babelParsed.error); + } break; case ErrorLabel.TSESTree: @@ -244,15 +287,33 @@ function nestDescribe(fixture: Fixture, segments = fixture.segments): void { break; } + // NOTE - the comments below exist so that they show up in the stack trace jest shows + // when the test fails. Yes, sadly, they're duplicated, but it's necessary to + // provide the best and most understandable DevX that we can here. + // Jest will print a code frame with the fail line as well as 2 lines before and after + + // if this fails and you WERE expecting a parser error, then your fixture should be in the `_error_` subfolder + // if this fails and you WEREN'T expecting a parser error - then something is broken. + expect(errorLabel).not.toBe(ErrorLabel.TSESTree); + // if this fails and you WERE expecting a parser error, then your fixture should be in the `_error_` subfolder // if this fails and you WEREN'T expecting a parser error - then something is broken. - expect(errorLabel).toBe(ErrorLabel.None); + expect(errorLabel).not.toBe(ErrorLabel.Both); + + if (fixture.config.expectBabelToNotSupport != null) { + // if this fails and you WERE expecting a parser error, then Babel parsed without error and you should remove the `expectBabelToNotSupport` config. + expect(errorLabel).toBe(ErrorLabel.Babel); + } else { + // if this fails and you WERE expecting a parser error, then your fixture should be in the `_error_` subfolder + // if this fails and you WEREN'T expecting a parser error - then something is broken. + expect(errorLabel).not.toBe(ErrorLabel.Babel); + } }); } }; if ([...fixture.segments, fixture.name].join(path.sep) === ONLY) { - // eslint-disable-next-line jest/no-focused-tests + // eslint-disable-next-line jest/no-focused-tests -- intentional focused test that only happens during development describe.only(fixture.name, test); } else { describe(fixture.name, test); @@ -261,7 +322,7 @@ function nestDescribe(fixture: Fixture, segments = fixture.segments): void { } describe('AST Fixtures', () => { - fixtures.forEach(f => nestDescribe(f)); + FIXTURES.forEach(f => nestDescribe(f)); // once we've run all the tests, snapshot the list of fixtures that have differences for easy reference it('List fixtures with AST differences', () => { @@ -279,4 +340,9 @@ describe('AST Fixtures', () => { path.resolve(__dirname, 'fixtures-with-differences-errors.shot'), ); }); + it('List fixtures we expect babel to not support', () => { + expect(fixturesConfiguredToExpectBabelToNotSupport).toMatchSpecificSnapshot( + path.resolve(__dirname, 'fixtures-without-babel-support.shot'), + ); + }); }); diff --git a/packages/ast-spec/tests/util/parsers/babel.ts b/packages/ast-spec/tests/util/parsers/babel.ts index e0d4268bbcc..5e874be85af 100644 --- a/packages/ast-spec/tests/util/parsers/babel.ts +++ b/packages/ast-spec/tests/util/parsers/babel.ts @@ -5,6 +5,7 @@ import type { Fixture, ParserResponse } from './parser-types'; import { ParserResponseType } from './parser-types'; const PLUGINS: ParserPlugin[] = [ + 'decoratorAutoAccessors', // TODO - enable classFeatures instead of classProperties when we support it // 'classFeatures', 'classProperties', diff --git a/packages/ast-spec/tests/util/parsers/parser-types.ts b/packages/ast-spec/tests/util/parsers/parser-types.ts index 1278d43a99e..4538d8ed4a9 100644 --- a/packages/ast-spec/tests/util/parsers/parser-types.ts +++ b/packages/ast-spec/tests/util/parsers/parser-types.ts @@ -1,17 +1,19 @@ +type SnapshotPathFn = (i: number) => string; + interface SuccessSnapshotPaths { - readonly ast: string; - readonly tokens: string; + readonly ast: SnapshotPathFn; + readonly tokens: SnapshotPathFn; } export interface Fixture { readonly absolute: string; - readonly name: string; + readonly config: ASTFixtureConfig; readonly ext: string; readonly isError: boolean; readonly isJSX: boolean; + readonly name: string; readonly relative: string; readonly segments: string[]; - readonly snapshotPath: string; readonly snapshotFiles: { readonly success: { readonly tsestree: SuccessSnapshotPaths; @@ -19,11 +21,12 @@ export interface Fixture { readonly alignment: SuccessSnapshotPaths; }; readonly error: { - readonly tsestree: string; - readonly babel: string; - readonly alignment: string; + readonly tsestree: SnapshotPathFn; + readonly babel: SnapshotPathFn; + readonly alignment: SnapshotPathFn; }; }; + readonly snapshotPath: string; } export enum ParserResponseType { diff --git a/packages/ast-spec/tsconfig.json b/packages/ast-spec/tsconfig.json index fd3827cd5ba..35ae2aa3a17 100644 --- a/packages/ast-spec/tsconfig.json +++ b/packages/ast-spec/tsconfig.json @@ -4,7 +4,14 @@ "composite": false, "rootDir": "." }, - "include": ["src", "typings", "tests", "tools", "./rollup.config.ts"], - "exclude": ["**/fixtures/**"], + "include": [ + "src", + "typings", + "tests", + "tools", + "./rollup.config.ts", + "**/fixtures/**/config.ts" + ], + "exclude": ["**/fixtures/**/fixture.ts"], "references": [{ "path": "../typescript-estree/tsconfig.build.json" }] } diff --git a/packages/ast-spec/typings/global.d.ts b/packages/ast-spec/typings/global.d.ts new file mode 100644 index 00000000000..4464c06fbcf --- /dev/null +++ b/packages/ast-spec/typings/global.d.ts @@ -0,0 +1,14 @@ +/** + * 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 { + /** + * 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/CHANGELOG.md b/packages/eslint-plugin-internal/CHANGELOG.md index 955f4430056..84d3ba16372 100644 --- a/packages/eslint-plugin-internal/CHANGELOG.md +++ b/packages/eslint-plugin-internal/CHANGELOG.md @@ -3,1318 +3,721 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -# [5.39.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.1...v5.39.0) (2022-10-03) +## [5.46.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.46.0...v5.46.1) (2022-12-12) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [5.46.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.45.1...v5.46.0) (2022-12-08) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +## [5.45.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.45.0...v5.45.1) (2022-12-05) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal -## [5.38.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.0...v5.38.1) (2022-09-26) +# [5.45.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.44.0...v5.45.0) (2022-11-28) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [5.44.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.43.0...v5.44.0) (2022-11-21) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [5.43.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.1...v5.43.0) (2022-11-14) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal -# [5.38.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.37.0...v5.38.0) (2022-09-19) +## [5.42.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.0...v5.42.1) (2022-11-07) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [5.42.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.41.0...v5.42.0) (2022-10-31) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [5.41.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.1...v5.41.0) (2022-10-24) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal -# [5.37.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.2...v5.37.0) (2022-09-12) +## [5.40.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.0...v5.40.1) (2022-10-17) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [5.40.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.39.0...v5.40.0) (2022-10-10) +### Features +- **utils:** add dependency constraint filtering for `RuleTester` ([#5750](https://github.com/typescript-eslint/typescript-eslint/issues/5750)) ([121f4c0](https://github.com/typescript-eslint/typescript-eslint/commit/121f4c0e7252def95d917e4734e933e53e29d501)) - -## [5.36.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.1...v5.36.2) (2022-09-05) +# [5.39.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.1...v5.39.0) (2022-10-03) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +## [5.38.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.0...v5.38.1) (2022-09-26) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [5.38.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.37.0...v5.38.0) (2022-09-19) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal -## [5.36.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.0...v5.36.1) (2022-08-30) +# [5.37.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.2...v5.37.0) (2022-09-12) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +## [5.36.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.1...v5.36.2) (2022-09-05) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +## [5.36.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.0...v5.36.1) (2022-08-30) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal # [5.36.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.1...v5.36.0) (2022-08-30) - ### Features -* support TypeScript 4.8 ([#5551](https://github.com/typescript-eslint/typescript-eslint/issues/5551)) ([81450ed](https://github.com/typescript-eslint/typescript-eslint/commit/81450ed7eaede74b384e9a91a84e9b4d34513866)) +- support TypeScript 4.8 ([#5551](https://github.com/typescript-eslint/typescript-eslint/issues/5551)) ([81450ed](https://github.com/typescript-eslint/typescript-eslint/commit/81450ed7eaede74b384e9a91a84e9b4d34513866)) +## [5.35.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.0...v5.35.1) (2022-08-24) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [5.35.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.34.0...v5.35.0) (2022-08-24) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal -## [5.35.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.0...v5.35.1) (2022-08-24) +# [5.34.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.1...v5.34.0) (2022-08-22) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +## [5.33.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.0...v5.33.1) (2022-08-15) +### Bug Fixes +- missing placeholders in violation messages for `no-unnecessary-type-constraint` and `no-unsafe-argument` (and enable `eslint-plugin/recommended` rules internally) ([#5453](https://github.com/typescript-eslint/typescript-eslint/issues/5453)) ([d023910](https://github.com/typescript-eslint/typescript-eslint/commit/d0239104f4dbffd2b5ecdb19e520c7d4b71962e0)) - -# [5.35.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.34.0...v5.35.0) (2022-08-24) +# [5.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.32.0...v5.33.0) (2022-08-08) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [5.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.31.0...v5.32.0) (2022-08-01) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [5.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.7...v5.31.0) (2022-07-25) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal -# [5.34.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.1...v5.34.0) (2022-08-22) +## [5.30.7](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.6...v5.30.7) (2022-07-18) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +## [5.30.6](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.5...v5.30.6) (2022-07-11) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +## [5.30.5](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.4...v5.30.5) (2022-07-04) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal -## [5.33.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.0...v5.33.1) (2022-08-15) +## [5.30.4](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.3...v5.30.4) (2022-07-03) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal -### Bug Fixes +## [5.30.3](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.2...v5.30.3) (2022-07-01) -* missing placeholders in violation messages for `no-unnecessary-type-constraint` and `no-unsafe-argument` (and enable `eslint-plugin/recommended` rules internally) ([#5453](https://github.com/typescript-eslint/typescript-eslint/issues/5453)) ([d023910](https://github.com/typescript-eslint/typescript-eslint/commit/d0239104f4dbffd2b5ecdb19e520c7d4b71962e0)) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +## [5.30.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.1...v5.30.2) (2022-07-01) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +## 5.30.1 (2022-07-01) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal -# [5.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.32.0...v5.33.0) (2022-08-08) +# [5.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.29.0...v5.30.0) (2022-06-27) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [5.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.28.0...v5.29.0) (2022-06-20) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [5.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.1...v5.28.0) (2022-06-13) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal -# [5.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.31.0...v5.32.0) (2022-08-01) +## [5.27.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.0...v5.27.1) (2022-06-06) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [5.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.26.0...v5.27.0) (2022-05-30) +### Features +- [4.7] support new extensions ([#5027](https://github.com/typescript-eslint/typescript-eslint/issues/5027)) ([efc147b](https://github.com/typescript-eslint/typescript-eslint/commit/efc147b04dce52ab17415b6a4ae4076b944b9036)) - -# [5.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.7...v5.31.0) (2022-07-25) +# [5.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.25.0...v5.26.0) (2022-05-23) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [5.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.24.0...v5.25.0) (2022-05-17) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [5.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.23.0...v5.24.0) (2022-05-16) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal -## [5.30.7](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.6...v5.30.7) (2022-07-18) +# [5.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.22.0...v5.23.0) (2022-05-09) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [5.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.21.0...v5.22.0) (2022-05-02) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [5.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.20.0...v5.21.0) (2022-04-25) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal -## [5.30.6](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.5...v5.30.6) (2022-07-11) +# [5.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.19.0...v5.20.0) (2022-04-18) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [5.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.18.0...v5.19.0) (2022-04-11) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [5.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.17.0...v5.18.0) (2022-04-04) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal -## [5.30.5](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.4...v5.30.5) (2022-07-04) +# [5.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.16.0...v5.17.0) (2022-03-28) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [5.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.15.0...v5.16.0) (2022-03-21) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [5.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.14.0...v5.15.0) (2022-03-14) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal -## [5.30.4](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.3...v5.30.4) (2022-07-03) +# [5.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.13.0...v5.14.0) (2022-03-07) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [5.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.1...v5.13.0) (2022-02-28) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +## [5.12.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.0...v5.12.1) (2022-02-21) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal -## [5.30.3](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.2...v5.30.3) (2022-07-01) +# [5.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.11.0...v5.12.0) (2022-02-14) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [5.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.2...v5.11.0) (2022-02-07) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +## [5.10.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.1...v5.10.2) (2022-01-31) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal -## [5.30.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.1...v5.30.2) (2022-07-01) +## [5.10.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.0...v5.10.1) (2022-01-24) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [5.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.1...v5.10.0) (2022-01-17) +### Features +- rename `experimental-utils` to `utils` and make `experimental-utils` an alias to the new package ([#4172](https://github.com/typescript-eslint/typescript-eslint/issues/4172)) ([1d55a75](https://github.com/typescript-eslint/typescript-eslint/commit/1d55a7511b38d8e2b2eabe59f639e0a865e6c93f)) - -## 5.30.1 (2022-07-01) +## [5.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.0...v5.9.1) (2022-01-10) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [5.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.1...v5.9.0) (2022-01-03) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - -# [5.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.29.0...v5.30.0) (2022-06-27) +## [5.8.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.0...v5.8.1) (2021-12-27) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [5.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.7.0...v5.8.0) (2021-12-20) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [5.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.6.0...v5.7.0) (2021-12-13) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal -# [5.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.28.0...v5.29.0) (2022-06-20) +# [5.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.5.0...v5.6.0) (2021-12-06) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [5.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.4.0...v5.5.0) (2021-11-29) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [5.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.3.1...v5.4.0) (2021-11-15) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal -# [5.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.1...v5.28.0) (2022-06-13) +## [5.3.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.3.0...v5.3.1) (2021-11-08) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [5.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.2.0...v5.3.0) (2021-11-01) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [5.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.1.0...v5.2.0) (2021-10-25) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal -## [5.27.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.0...v5.27.1) (2022-06-06) +# [5.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.0.0...v5.1.0) (2021-10-18) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [5.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.33.0...v5.0.0) (2021-10-11) +### Features +- remove `meta.docs.category` from rules ([#3800](https://github.com/typescript-eslint/typescript-eslint/issues/3800)) ([71c9370](https://github.com/typescript-eslint/typescript-eslint/commit/71c93706e55f5f92a1285102b93c6ab1950c6df4)) +- support ESLint v8 ([#3737](https://github.com/typescript-eslint/typescript-eslint/issues/3737)) ([4ca62ae](https://github.com/typescript-eslint/typescript-eslint/commit/4ca62aee6681d706e762a8db727541ca204364f2)) +# [4.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.32.0...v4.33.0) (2021-10-04) -# [5.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.26.0...v5.27.0) (2022-05-30) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [4.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.2...v4.32.0) (2021-09-27) ### Features -* [4.7] support new extensions ([#5027](https://github.com/typescript-eslint/typescript-eslint/issues/5027)) ([efc147b](https://github.com/typescript-eslint/typescript-eslint/commit/efc147b04dce52ab17415b6a4ae4076b944b9036)) +- **eslint-plugin-internal:** [prefer-ast-types-enum] add `DefinitionType` enum ([#3916](https://github.com/typescript-eslint/typescript-eslint/issues/3916)) ([13b7de5](https://github.com/typescript-eslint/typescript-eslint/commit/13b7de508e0f8eac492879ff9ab99acd8d3e977e)) +## [4.31.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.1...v4.31.2) (2021-09-20) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +## [4.31.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.0...v4.31.1) (2021-09-13) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal -# [5.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.25.0...v5.26.0) (2022-05-23) +# [4.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.30.0...v4.31.0) (2021-09-06) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [4.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.3...v4.30.0) (2021-08-30) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +## [4.29.3](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.2...v4.29.3) (2021-08-23) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal -# [5.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.24.0...v5.25.0) (2022-05-17) +## [4.29.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.1...v4.29.2) (2021-08-16) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +## [4.29.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.0...v4.29.1) (2021-08-09) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [4.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.5...v4.29.0) (2021-08-02) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal -# [5.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.23.0...v5.24.0) (2022-05-16) +## [4.28.5](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.4...v4.28.5) (2021-07-26) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +## [4.28.4](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.3...v4.28.4) (2021-07-19) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +## [4.28.3](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.2...v4.28.3) (2021-07-12) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal -# [5.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.22.0...v5.23.0) (2022-05-09) +## [4.28.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.1...v4.28.2) (2021-07-05) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +## [4.28.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.0...v4.28.1) (2021-06-28) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [4.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.27.0...v4.28.0) (2021-06-21) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal -# [5.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.21.0...v5.22.0) (2022-05-02) +# [4.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.1...v4.27.0) (2021-06-14) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +## [4.26.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.0...v4.26.1) (2021-06-07) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [4.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.25.0...v4.26.0) (2021-05-31) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal -# [5.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.20.0...v5.21.0) (2022-04-25) +# [4.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.24.0...v4.25.0) (2021-05-24) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [4.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.23.0...v4.24.0) (2021-05-17) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [4.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.1...v4.23.0) (2021-05-10) +### Features +- refactor to split AST specification out as its own module ([#2911](https://github.com/typescript-eslint/typescript-eslint/issues/2911)) ([25ea953](https://github.com/typescript-eslint/typescript-eslint/commit/25ea953cc60b118bd385c71e0a9b61c286c26fcf)) -# [5.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.19.0...v5.20.0) (2022-04-18) +## [4.22.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.0...v4.22.1) (2021-05-04) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [4.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.21.0...v4.22.0) (2021-04-12) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [4.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.20.0...v4.21.0) (2021-04-05) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal -# [5.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.18.0...v5.19.0) (2022-04-11) +# [4.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.19.0...v4.20.0) (2021-03-29) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [4.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.18.0...v4.19.0) (2021-03-22) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [4.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.17.0...v4.18.0) (2021-03-15) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal -# [5.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.17.0...v5.18.0) (2022-04-04) +# [4.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.16.1...v4.17.0) (2021-03-08) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +## [4.16.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.16.0...v4.16.1) (2021-03-01) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [4.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.2...v4.16.0) (2021-03-01) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal -# [5.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.16.0...v5.17.0) (2022-03-28) +## [4.15.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.1...v4.15.2) (2021-02-22) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +## [4.15.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.0...v4.15.1) (2021-02-15) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [4.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.2...v4.15.0) (2021-02-08) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal -# [5.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.15.0...v5.16.0) (2022-03-21) +## [4.14.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.1...v4.14.2) (2021-02-01) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +## [4.14.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.0...v4.14.1) (2021-01-25) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [4.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.13.0...v4.14.0) (2021-01-18) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal -# [5.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.14.0...v5.15.0) (2022-03-14) +# [4.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.12.0...v4.13.0) (2021-01-11) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [4.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.11.1...v4.12.0) (2021-01-04) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +## [4.11.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.11.0...v4.11.1) (2020-12-28) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal -# [5.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.13.0...v5.14.0) (2022-03-07) +# [4.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.10.0...v4.11.0) (2020-12-21) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [4.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.9.1...v4.10.0) (2020-12-14) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +## [4.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.9.0...v4.9.1) (2020-12-07) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal -# [5.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.1...v5.13.0) (2022-02-28) +# [4.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.2...v4.9.0) (2020-11-30) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +## [4.8.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.1...v4.8.2) (2020-11-23) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +## [4.8.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.0...v4.8.1) (2020-11-17) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal -## [5.12.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.0...v5.12.1) (2022-02-21) +# [4.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.7.0...v4.8.0) (2020-11-16) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [4.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.6.1...v4.7.0) (2020-11-09) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +## [4.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.6.0...v4.6.1) (2020-11-02) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal -# [5.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.11.0...v5.12.0) (2022-02-14) +# [4.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.5.0...v4.6.0) (2020-10-26) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [4.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.4.1...v4.5.0) (2020-10-19) +### Features +- **typescript-estree:** add flag EXPERIMENTAL_useSourceOfProjectReferenceRedirect ([#2669](https://github.com/typescript-eslint/typescript-eslint/issues/2669)) ([90a5878](https://github.com/typescript-eslint/typescript-eslint/commit/90a587845088da1b205e4d7d77dbc3f9447b1c5a)) - -# [5.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.2...v5.11.0) (2022-02-07) +## [4.4.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.4.0...v4.4.1) (2020-10-12) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [4.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.3.0...v4.4.0) (2020-10-05) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [4.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.2.0...v4.3.0) (2020-09-28) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal -## [5.10.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.1...v5.10.2) (2022-01-31) +# [4.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.1...v4.2.0) (2020-09-21) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +## [4.1.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.0...v4.1.1) (2020-09-14) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [4.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.0.1...v4.1.0) (2020-09-07) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal -## [5.10.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.0...v5.10.1) (2022-01-24) +## [4.0.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.0.0...v4.0.1) (2020-08-31) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal +# [4.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.10.1...v4.0.0) (2020-08-31) - - - -# [5.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.1...v5.10.0) (2022-01-17) - - -### Features - -* rename `experimental-utils` to `utils` and make `experimental-utils` an alias to the new package ([#4172](https://github.com/typescript-eslint/typescript-eslint/issues/4172)) ([1d55a75](https://github.com/typescript-eslint/typescript-eslint/commit/1d55a7511b38d8e2b2eabe59f639e0a865e6c93f)) - - - - - -## [5.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.0...v5.9.1) (2022-01-10) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -# [5.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.1...v5.9.0) (2022-01-03) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -## [5.8.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.0...v5.8.1) (2021-12-27) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -# [5.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.7.0...v5.8.0) (2021-12-20) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -# [5.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.6.0...v5.7.0) (2021-12-13) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -# [5.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.5.0...v5.6.0) (2021-12-06) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -# [5.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.4.0...v5.5.0) (2021-11-29) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -# [5.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.3.1...v5.4.0) (2021-11-15) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -## [5.3.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.3.0...v5.3.1) (2021-11-08) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -# [5.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.2.0...v5.3.0) (2021-11-01) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -# [5.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.1.0...v5.2.0) (2021-10-25) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -# [5.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.0.0...v5.1.0) (2021-10-18) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -# [5.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.33.0...v5.0.0) (2021-10-11) - - -### Features - -* remove `meta.docs.category` from rules ([#3800](https://github.com/typescript-eslint/typescript-eslint/issues/3800)) ([71c9370](https://github.com/typescript-eslint/typescript-eslint/commit/71c93706e55f5f92a1285102b93c6ab1950c6df4)) -* support ESLint v8 ([#3737](https://github.com/typescript-eslint/typescript-eslint/issues/3737)) ([4ca62ae](https://github.com/typescript-eslint/typescript-eslint/commit/4ca62aee6681d706e762a8db727541ca204364f2)) - - - - - -# [4.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.32.0...v4.33.0) (2021-10-04) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -# [4.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.2...v4.32.0) (2021-09-27) - - -### Features - -* **eslint-plugin-internal:** [prefer-ast-types-enum] add `DefinitionType` enum ([#3916](https://github.com/typescript-eslint/typescript-eslint/issues/3916)) ([13b7de5](https://github.com/typescript-eslint/typescript-eslint/commit/13b7de508e0f8eac492879ff9ab99acd8d3e977e)) - - - - - -## [4.31.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.1...v4.31.2) (2021-09-20) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -## [4.31.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.0...v4.31.1) (2021-09-13) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -# [4.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.30.0...v4.31.0) (2021-09-06) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -# [4.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.3...v4.30.0) (2021-08-30) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -## [4.29.3](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.2...v4.29.3) (2021-08-23) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -## [4.29.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.1...v4.29.2) (2021-08-16) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -## [4.29.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.0...v4.29.1) (2021-08-09) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -# [4.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.5...v4.29.0) (2021-08-02) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -## [4.28.5](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.4...v4.28.5) (2021-07-26) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -## [4.28.4](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.3...v4.28.4) (2021-07-19) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -## [4.28.3](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.2...v4.28.3) (2021-07-12) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -## [4.28.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.1...v4.28.2) (2021-07-05) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -## [4.28.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.0...v4.28.1) (2021-06-28) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -# [4.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.27.0...v4.28.0) (2021-06-21) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -# [4.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.1...v4.27.0) (2021-06-14) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -## [4.26.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.0...v4.26.1) (2021-06-07) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -# [4.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.25.0...v4.26.0) (2021-05-31) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -# [4.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.24.0...v4.25.0) (2021-05-24) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -# [4.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.23.0...v4.24.0) (2021-05-17) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -# [4.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.1...v4.23.0) (2021-05-10) - - -### Features - -* refactor to split AST specification out as its own module ([#2911](https://github.com/typescript-eslint/typescript-eslint/issues/2911)) ([25ea953](https://github.com/typescript-eslint/typescript-eslint/commit/25ea953cc60b118bd385c71e0a9b61c286c26fcf)) - - - - - -## [4.22.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.0...v4.22.1) (2021-05-04) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -# [4.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.21.0...v4.22.0) (2021-04-12) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -# [4.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.20.0...v4.21.0) (2021-04-05) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -# [4.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.19.0...v4.20.0) (2021-03-29) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -# [4.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.18.0...v4.19.0) (2021-03-22) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -# [4.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.17.0...v4.18.0) (2021-03-15) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -# [4.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.16.1...v4.17.0) (2021-03-08) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -## [4.16.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.16.0...v4.16.1) (2021-03-01) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -# [4.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.2...v4.16.0) (2021-03-01) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -## [4.15.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.1...v4.15.2) (2021-02-22) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -## [4.15.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.0...v4.15.1) (2021-02-15) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -# [4.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.2...v4.15.0) (2021-02-08) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -## [4.14.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.1...v4.14.2) (2021-02-01) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -## [4.14.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.0...v4.14.1) (2021-01-25) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -# [4.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.13.0...v4.14.0) (2021-01-18) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -# [4.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.12.0...v4.13.0) (2021-01-11) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -# [4.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.11.1...v4.12.0) (2021-01-04) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -## [4.11.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.11.0...v4.11.1) (2020-12-28) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -# [4.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.10.0...v4.11.0) (2020-12-21) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -# [4.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.9.1...v4.10.0) (2020-12-14) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -## [4.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.9.0...v4.9.1) (2020-12-07) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -# [4.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.2...v4.9.0) (2020-11-30) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -## [4.8.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.1...v4.8.2) (2020-11-23) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -## [4.8.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.0...v4.8.1) (2020-11-17) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -# [4.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.7.0...v4.8.0) (2020-11-16) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -# [4.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.6.1...v4.7.0) (2020-11-09) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -## [4.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.6.0...v4.6.1) (2020-11-02) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -# [4.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.5.0...v4.6.0) (2020-10-26) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -# [4.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.4.1...v4.5.0) (2020-10-19) - - -### Features - -* **typescript-estree:** add flag EXPERIMENTAL_useSourceOfProjectReferenceRedirect ([#2669](https://github.com/typescript-eslint/typescript-eslint/issues/2669)) ([90a5878](https://github.com/typescript-eslint/typescript-eslint/commit/90a587845088da1b205e4d7d77dbc3f9447b1c5a)) - - - - - -## [4.4.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.4.0...v4.4.1) (2020-10-12) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -# [4.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.3.0...v4.4.0) (2020-10-05) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -# [4.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.2.0...v4.3.0) (2020-09-28) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -# [4.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.1...v4.2.0) (2020-09-21) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -## [4.1.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.0...v4.1.1) (2020-09-14) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -# [4.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.0.1...v4.1.0) (2020-09-07) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -## [4.0.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.0.0...v4.0.1) (2020-08-31) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - - -# [4.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.10.1...v4.0.0) (2020-08-31) - -## [Please see the release notes for v4.0.0](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v4.0.0) +## [Please see the release notes for v4.0.0](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v4.0.0) ### Features -* support ESTree optional chaining representation ([#2308](https://github.com/typescript-eslint/typescript-eslint/issues/2308)) ([e9d2ab6](https://github.com/typescript-eslint/typescript-eslint/commit/e9d2ab638b6767700b52797e74b814ea059beaae)) - - - - +- support ESTree optional chaining representation ([#2308](https://github.com/typescript-eslint/typescript-eslint/issues/2308)) ([e9d2ab6](https://github.com/typescript-eslint/typescript-eslint/commit/e9d2ab638b6767700b52797e74b814ea059beaae)) ## [3.10.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.10.0...v3.10.1) (2020-08-25) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - # [3.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.9.1...v3.10.0) (2020-08-24) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - ## [3.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.9.0...v3.9.1) (2020-08-17) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - # [3.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.8.0...v3.9.0) (2020-08-10) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - # [3.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.7.1...v3.8.0) (2020-08-03) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - ## [3.7.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.7.0...v3.7.1) (2020-07-27) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - # [3.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.6.1...v3.7.0) (2020-07-20) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - ## [3.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.6.0...v3.6.1) (2020-07-13) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - # [3.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.5.0...v3.6.0) (2020-07-06) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - # [3.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.4.0...v3.5.0) (2020-06-29) - ### Features -* add package scope-manager ([#1939](https://github.com/typescript-eslint/typescript-eslint/issues/1939)) ([682eb7e](https://github.com/typescript-eslint/typescript-eslint/commit/682eb7e009c3f22a542882dfd3602196a60d2a1e)) -* split types into their own package ([#2229](https://github.com/typescript-eslint/typescript-eslint/issues/2229)) ([5f45918](https://github.com/typescript-eslint/typescript-eslint/commit/5f4591886f3438329fbf2229b03ac66174334a24)) - - - - +- add package scope-manager ([#1939](https://github.com/typescript-eslint/typescript-eslint/issues/1939)) ([682eb7e](https://github.com/typescript-eslint/typescript-eslint/commit/682eb7e009c3f22a542882dfd3602196a60d2a1e)) +- split types into their own package ([#2229](https://github.com/typescript-eslint/typescript-eslint/issues/2229)) ([5f45918](https://github.com/typescript-eslint/typescript-eslint/commit/5f4591886f3438329fbf2229b03ac66174334a24)) # [3.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.3.0...v3.4.0) (2020-06-22) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - # [3.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.2.0...v3.3.0) (2020-06-15) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - # [3.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.1.0...v3.2.0) (2020-06-08) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - # [3.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.0.2...v3.1.0) (2020-06-01) - ### Bug Fixes -* **experimental-utils:** downlevel type declarations for versions older than 3.8 ([#2133](https://github.com/typescript-eslint/typescript-eslint/issues/2133)) ([7925823](https://github.com/typescript-eslint/typescript-eslint/commit/792582326a8065270b69a0ffcaad5a7b4b103ff3)) - - - - +- **experimental-utils:** downlevel type declarations for versions older than 3.8 ([#2133](https://github.com/typescript-eslint/typescript-eslint/issues/2133)) ([7925823](https://github.com/typescript-eslint/typescript-eslint/commit/792582326a8065270b69a0ffcaad5a7b4b103ff3)) ## [3.0.2](https://github.com/typescript-eslint/typescript-eslint/compare/v3.0.1...v3.0.2) (2020-05-27) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - ## [3.0.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.0.0...v3.0.1) (2020-05-25) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - # [3.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.34.0...v3.0.0) (2020-05-21) ## [Please see the release notes for v3.0.0](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v3.0.0) ### Features -* upgrade to ESLint v7 ([#2022](https://github.com/typescript-eslint/typescript-eslint/issues/2022)) ([208de71](https://github.com/typescript-eslint/typescript-eslint/commit/208de71059746bf38e94bd460346ffb2698a3e12)) - - - - +- upgrade to ESLint v7 ([#2022](https://github.com/typescript-eslint/typescript-eslint/issues/2022)) ([208de71](https://github.com/typescript-eslint/typescript-eslint/commit/208de71059746bf38e94bd460346ffb2698a3e12)) # [2.34.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.33.0...v2.34.0) (2020-05-18) - ### Features -* **experimental-utils:** add `suggestion` property for rule modules ([#2033](https://github.com/typescript-eslint/typescript-eslint/issues/2033)) ([f42a5b0](https://github.com/typescript-eslint/typescript-eslint/commit/f42a5b09ebfa173f418a99c552b0cbe221567194)) - - - - +- **experimental-utils:** add `suggestion` property for rule modules ([#2033](https://github.com/typescript-eslint/typescript-eslint/issues/2033)) ([f42a5b0](https://github.com/typescript-eslint/typescript-eslint/commit/f42a5b09ebfa173f418a99c552b0cbe221567194)) # [2.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.32.0...v2.33.0) (2020-05-12) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - # [2.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.31.0...v2.32.0) (2020-05-11) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - # [2.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.30.0...v2.31.0) (2020-05-04) - ### Features -* **eslint-plugin-internal:** add rule no-poorly-typed-ts-props ([#1949](https://github.com/typescript-eslint/typescript-eslint/issues/1949)) ([56ea7c9](https://github.com/typescript-eslint/typescript-eslint/commit/56ea7c9581c0c99fe394bbcfc4128e8054c88ab2)) -* **experimental-utils:** expose our RuleTester extension ([#1948](https://github.com/typescript-eslint/typescript-eslint/issues/1948)) ([2dd1638](https://github.com/typescript-eslint/typescript-eslint/commit/2dd1638aaa2658ba99b2341861146b586f489121)) - - - - +- **eslint-plugin-internal:** add rule no-poorly-typed-ts-props ([#1949](https://github.com/typescript-eslint/typescript-eslint/issues/1949)) ([56ea7c9](https://github.com/typescript-eslint/typescript-eslint/commit/56ea7c9581c0c99fe394bbcfc4128e8054c88ab2)) +- **experimental-utils:** expose our RuleTester extension ([#1948](https://github.com/typescript-eslint/typescript-eslint/issues/1948)) ([2dd1638](https://github.com/typescript-eslint/typescript-eslint/commit/2dd1638aaa2658ba99b2341861146b586f489121)) # [2.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.29.0...v2.30.0) (2020-04-27) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - # [2.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.28.0...v2.29.0) (2020-04-20) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - # [2.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.27.0...v2.28.0) (2020-04-13) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - # [2.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.26.0...v2.27.0) (2020-04-06) - ### Features -* **eslint-plugin-internal:** add plugin-test-formatting rule ([#1821](https://github.com/typescript-eslint/typescript-eslint/issues/1821)) ([9b0023a](https://github.com/typescript-eslint/typescript-eslint/commit/9b0023a4996ecdd7dfcb30abd1678091a78f3064)) - - - - +- **eslint-plugin-internal:** add plugin-test-formatting rule ([#1821](https://github.com/typescript-eslint/typescript-eslint/issues/1821)) ([9b0023a](https://github.com/typescript-eslint/typescript-eslint/commit/9b0023a4996ecdd7dfcb30abd1678091a78f3064)) # [2.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.25.0...v2.26.0) (2020-03-30) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - # [2.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.24.0...v2.25.0) (2020-03-23) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - # [2.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.23.0...v2.24.0) (2020-03-16) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - # [2.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.22.0...v2.23.0) (2020-03-09) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - # [2.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.21.0...v2.22.0) (2020-03-02) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - # [2.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.20.0...v2.21.0) (2020-02-24) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - # [2.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.19.2...v2.20.0) (2020-02-17) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - ## [2.19.2](https://github.com/typescript-eslint/typescript-eslint/compare/v2.19.1...v2.19.2) (2020-02-10) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - ## [2.19.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.19.0...v2.19.1) (2020-02-10) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - # [2.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.18.0...v2.19.0) (2020-02-03) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - # [2.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.17.0...v2.18.0) (2020-01-27) - ### Features -* **eslint-plugin-internal:** add `prefer-ast-types-enum` ([#1508](https://github.com/typescript-eslint/typescript-eslint/issues/1508)) ([c3d0a3a](https://github.com/typescript-eslint/typescript-eslint/commit/c3d0a3a6bdff0cae226a279f0a0a9b00952ca925)) - - - - +- **eslint-plugin-internal:** add `prefer-ast-types-enum` ([#1508](https://github.com/typescript-eslint/typescript-eslint/issues/1508)) ([c3d0a3a](https://github.com/typescript-eslint/typescript-eslint/commit/c3d0a3a6bdff0cae226a279f0a0a9b00952ca925)) # [2.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.16.0...v2.17.0) (2020-01-20) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - # [2.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.15.0...v2.16.0) (2020-01-13) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - # [2.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.14.0...v2.15.0) (2020-01-06) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal - - - - # [2.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.13.0...v2.14.0) (2019-12-30) - ### Features -* add internal eslint plugin for repo-specific lint rules ([#1373](https://github.com/typescript-eslint/typescript-eslint/issues/1373)) ([3a15413](https://github.com/typescript-eslint/typescript-eslint/commit/3a15413)) +- add internal eslint plugin for repo-specific lint rules ([#1373](https://github.com/typescript-eslint/typescript-eslint/issues/1373)) ([3a15413](https://github.com/typescript-eslint/typescript-eslint/commit/3a15413)) diff --git a/packages/eslint-plugin-internal/README.md b/packages/eslint-plugin-internal/README.md index adf36999928..7d081266c54 100644 --- a/packages/eslint-plugin-internal/README.md +++ b/packages/eslint-plugin-internal/README.md @@ -1,9 +1,10 @@ -

Internal ESLint Plugin

+# `@typescript-eslint/eslint-plugin-internal` -

An ESLint plugin used internally in this project to ensure consistency.

+> An ESLint plugin used internally in this project to ensure consistency. -

- CI -

+## ✋ Internal Package -This plugin is not intended to be used externally. +This is an _internal package_ to the [typescript-eslint monorepo](https://github.com/typescript-eslint/typescript-eslint). +You likely don't want to use it directly. + +👉 See **https://typescript-eslint.io** for docs on typescript-eslint. diff --git a/packages/eslint-plugin-internal/jest.config.js b/packages/eslint-plugin-internal/jest.config.js index 910991b20cf..72e29aa600b 100644 --- a/packages/eslint-plugin-internal/jest.config.js +++ b/packages/eslint-plugin-internal/jest.config.js @@ -4,4 +4,5 @@ /** @type {import('@jest/types').Config.InitialOptions} */ module.exports = { ...require('../../jest.config.base.js'), + coveragePathIgnorePatterns: ['src/index.ts$', 'src/configs/.*.ts$'], }; diff --git a/packages/eslint-plugin-internal/package.json b/packages/eslint-plugin-internal/package.json index a8f20e7683a..1d3a61a74ea 100644 --- a/packages/eslint-plugin-internal/package.json +++ b/packages/eslint-plugin-internal/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin-internal", - "version": "5.39.0", + "version": "5.46.1", "private": true, "main": "dist/index.js", "scripts": { @@ -8,14 +8,15 @@ "clean": "tsc -b tsconfig.build.json --clean", "postclean": "rimraf dist && rimraf coverage", "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", - "lint": "eslint . --ignore-path='../../.eslintignore'", + "lint": "nx lint", "test": "jest --coverage", "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { "@types/prettier": "*", - "@typescript-eslint/scope-manager": "5.39.0", - "@typescript-eslint/utils": "5.39.0", + "@typescript-eslint/scope-manager": "5.46.1", + "@typescript-eslint/type-utils": "5.46.1", + "@typescript-eslint/utils": "5.46.1", "prettier": "*" } } diff --git a/packages/eslint-plugin-internal/project.json b/packages/eslint-plugin-internal/project.json index 948fce1f60c..e7ac6302d69 100644 --- a/packages/eslint-plugin-internal/project.json +++ b/packages/eslint-plugin-internal/project.json @@ -1,5 +1,15 @@ { - "root": "packages/eslint-plugin-internal", + "name": "eslint-plugin-internal", + "$schema": "../../node_modules/nx/schemas/project-schema.json", "type": "library", - "implicitDependencies": [] + "implicitDependencies": [], + "targets": { + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["packages/eslint-plugin-internal/**/*.ts"] + } + } + } } 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 6811c935bba..0c671d8432f 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 @@ -35,7 +35,7 @@ export default createRule({ type: 'problem', docs: { description: - "Enforces rules don't use TS API properties with known bad type definitions", + "Enforce that rules don't use TS API properties with known bad type definitions", recommended: 'error', requiresTypeChecking: true, }, 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 34b911451e7..fd7279c3823 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 @@ -20,7 +20,7 @@ export default createRule({ type: 'problem', docs: { description: - "Enforces that packages rules don't do `import ts from 'typescript';`", + "Enforce that packages rules don't do `import ts from 'typescript';`", recommended: 'error', }, fixable: 'code', diff --git a/packages/eslint-plugin-internal/src/rules/no-typescript-estree-import.ts b/packages/eslint-plugin-internal/src/rules/no-typescript-estree-import.ts index 022fd98b7ca..28f7439472b 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 @@ -15,7 +15,7 @@ export default createRule({ meta: { type: 'problem', docs: { - description: `Enforces that eslint-plugin rules don't require anything from ${TSESTREE_NAME} or ${TYPES_NAME}`, + description: `Enforce that eslint-plugin rules don't require anything from ${TSESTREE_NAME} or ${TYPES_NAME}`, recommended: 'error', }, fixable: 'code', diff --git a/packages/eslint-plugin-internal/src/rules/plugin-test-formatting.ts b/packages/eslint-plugin-internal/src/rules/plugin-test-formatting.ts index 15386398048..f86d4946836 100644 --- a/packages/eslint-plugin-internal/src/rules/plugin-test-formatting.ts +++ b/packages/eslint-plugin-internal/src/rules/plugin-test-formatting.ts @@ -1,5 +1,6 @@ +import { getContextualType } from '@typescript-eslint/type-utils'; import type { TSESTree } from '@typescript-eslint/utils'; -import { AST_NODE_TYPES } from '@typescript-eslint/utils'; +import { AST_NODE_TYPES, ESLintUtils } from '@typescript-eslint/utils'; import { format, resolveConfig } from 'prettier'; import { createRule } from '../util'; @@ -106,8 +107,9 @@ export default createRule({ meta: { type: 'problem', docs: { - description: `Enforces that eslint-plugin test snippets are correctly formatted`, + description: `Enforce that eslint-plugin test snippets are correctly formatted`, recommended: 'error', + requiresTypeChecking: true, }, fixable: 'code', schema: [ @@ -146,6 +148,11 @@ export default createRule({ ], create(context, [{ formatWithPrettier }]) { const sourceCode = context.getSourceCode(); + const { program, esTreeNodeToTSNodeMap } = + ESLintUtils.getParserServices(context); + const checker = program.getTypeChecker(); + + const checkedObjects = new Set(); function prettierFormat( code: string, @@ -448,6 +455,12 @@ export default createRule({ test: TSESTree.ObjectExpression, isErrorTest = true, ): void { + if (checkedObjects.has(test)) { + return; + } + + checkedObjects.add(test); + for (const prop of test.properties) { if ( prop.type !== AST_NODE_TYPES.Property || @@ -478,33 +491,99 @@ export default createRule({ } } - const invalidTestsSelectorPath = [ - AST_NODE_TYPES.CallExpression, - AST_NODE_TYPES.ObjectExpression, - 'Property[key.name = "invalid"]', - AST_NODE_TYPES.ArrayExpression, - AST_NODE_TYPES.ObjectExpression, - ]; - return { // valid 'CallExpression > ObjectExpression > Property[key.name = "valid"] > ArrayExpression': checkValidTest, // invalid - errors - [invalidTestsSelectorPath.join(' > ')]: checkInvalidTest, - // invalid - suggestions [[ - ...invalidTestsSelectorPath, - 'Property[key.name = "errors"]', - AST_NODE_TYPES.ArrayExpression, + AST_NODE_TYPES.CallExpression, AST_NODE_TYPES.ObjectExpression, - 'Property[key.name = "suggestions"]', + 'Property[key.name = "invalid"]', 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 + * literals that are passed via array maps, etc + */ + ObjectExpression(node): void { + if (checkedObjects.has(node)) { + return; + } + + const type = getContextualType( + checker, + esTreeNodeToTSNodeMap.get(node), + ); + if (!type) { + return; + } + + const typeString = checker.typeToString(type); + if (/^RunTests\b/.test(typeString)) { + checkedObjects.add(node); + + for (const prop of node.properties) { + if ( + prop.type === AST_NODE_TYPES.SpreadElement || + prop.computed || + prop.key.type !== AST_NODE_TYPES.Identifier || + prop.value.type !== AST_NODE_TYPES.ArrayExpression + ) { + continue; + } + + switch (prop.key.name) { + case 'valid': + checkValidTest(prop.value); + break; + + case 'invalid': + for (const element of prop.value.elements) { + if (element.type === AST_NODE_TYPES.ObjectExpression) { + checkInvalidTest(element); + } + } + break; + } + } + return; + } + + if (/^ValidTestCase\b/.test(typeString)) { + checkInvalidTest(node); + return; + } + + if (/^InvalidTestCase\b/.test(typeString)) { + checkInvalidTest(node); + for (const testProp of node.properties) { + if ( + testProp.type === AST_NODE_TYPES.SpreadElement || + testProp.computed || + testProp.key.type !== AST_NODE_TYPES.Identifier || + testProp.key.name !== 'errors' || + testProp.value.type !== AST_NODE_TYPES.ArrayExpression + ) { + continue; + } + + for (const errorElement of testProp.value.elements) { + if (errorElement.type !== AST_NODE_TYPES.ObjectExpression) { + continue; + } + + checkInvalidTest(errorElement); + } + } + } + }, }; }, }); 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 4b74cbe09b9..4099e2f02be 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 @@ -15,7 +15,7 @@ export default createRule({ docs: { recommended: 'error', description: - 'Ensures consistent usage of `AST_NODE_TYPES`, `AST_TOKEN_TYPES` and `DefinitionType` enums.', + 'Enforce consistent usage of `AST_NODE_TYPES`, `AST_TOKEN_TYPES` and `DefinitionType` enums', }, messages: { preferEnum: 'Prefer {{ enumName }}.{{ literal }} over raw literal', 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 81be2118f6c..f5745996d38 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,9 +1,11 @@ import rule from '../../src/rules/plugin-test-formatting'; -import { RuleTester } from '../RuleTester'; +import { getFixturesRootDir, RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', parserOptions: { + project: './tsconfig.json', + tsconfigRootDir: getFixturesRootDir(), sourceType: 'module', }, }); @@ -132,6 +134,44 @@ ${CODE_INDENT}const a = 1; ${CODE_INDENT}const b = 1; ${PARENT_INDENT}\``, + + // random, unannotated variables aren't checked + ` +const test1 = { + code: 'const badlyFormatted = "code"', +}; +const test2 = { + valid: [ + 'const badlyFormatted = "code"', + { + code: 'const badlyFormatted = "code"', + }, + ], + invalid: [ + { + code: 'const badlyFormatted = "code"', + errors: [], + }, + ], +}; + `, + + // TODO - figure out how to handle this pattern + ` +import { TSESLint } from '@typescript-eslint/utils'; + +const test = [ + { + code: 'const badlyFormatted = "code1"', + }, + { + code: 'const badlyFormatted = "code2"', + }, +].map>(test => ({ + code: test.code, + errors: [], +})); + `, ], invalid: [ // Literal @@ -506,5 +546,174 @@ foo }, ], }, + + // annotated variables are checked + { + code: ` +const test: RunTests = { + valid: [ + 'const badlyFormatted = "code"', + { + code: 'const badlyFormatted = "code"', + }, + ], + invalid: [ + { + code: 'const badlyFormatted = "code"', + errors: [], + }, + ], +}; + `, + output: ` +const test: RunTests = { + valid: [ + "const badlyFormatted = 'code';", + { + code: "const badlyFormatted = 'code';", + }, + ], + invalid: [ + { + code: "const badlyFormatted = 'code';", + errors: [], + }, + ], +}; + `, + errors: [ + { + messageId: 'invalidFormatting', + }, + { + messageId: 'invalidFormatting', + }, + { + messageId: 'invalidFormattingErrorTest', + }, + ], + }, + { + code: ` +import { TSESLint } from '@typescript-eslint/utils'; + +const test: TSESLint.RunTests<'', []> = { + valid: [ + 'const badlyFormatted = "code"', + { + code: 'const badlyFormatted = "code"', + }, + ], + invalid: [ + { + code: 'const badlyFormatted = "code"', + errors: [], + }, + ], +}; + `, + output: ` +import { TSESLint } from '@typescript-eslint/utils'; + +const test: TSESLint.RunTests<'', []> = { + valid: [ + "const badlyFormatted = 'code';", + { + code: "const badlyFormatted = 'code';", + }, + ], + invalid: [ + { + code: "const badlyFormatted = 'code';", + errors: [], + }, + ], +}; + `, + errors: [ + { + messageId: 'invalidFormatting', + }, + { + messageId: 'invalidFormatting', + }, + { + messageId: 'invalidFormattingErrorTest', + }, + ], + }, + { + code: ` +import { TSESLint } from '@typescript-eslint/utils'; + +const test: TSESLint.ValidTestCase<[]> = { + code: 'const badlyFormatted = "code"', +}; + `, + output: ` +import { TSESLint } from '@typescript-eslint/utils'; + +const test: TSESLint.ValidTestCase<[]> = { + code: "const badlyFormatted = 'code';", +}; + `, + errors: [ + { + messageId: 'invalidFormattingErrorTest', + }, + ], + }, + { + code: ` +import { TSESLint } from '@typescript-eslint/utils'; + +const test: TSESLint.InvalidTestCase<'', []> = { + code: 'const badlyFormatted = "code1"', + errors: [ + { + code: 'const badlyFormatted = "code2"', + // shouldn't get fixed as per rule ignoring output + output: 'const badlyFormatted = "code3"', + suggestions: [ + { + messageId: '', + // shouldn't get fixed as per rule ignoring output + output: 'const badlyFormatted = "code4"', + }, + ], + }, + ], +}; + `, + output: ` +import { TSESLint } from '@typescript-eslint/utils'; + +const test: TSESLint.InvalidTestCase<'', []> = { + code: "const badlyFormatted = 'code1';", + errors: [ + { + code: "const badlyFormatted = 'code2';", + // shouldn't get fixed as per rule ignoring output + output: 'const badlyFormatted = "code3"', + suggestions: [ + { + messageId: '', + // shouldn't get fixed as per rule ignoring output + output: 'const badlyFormatted = "code4"', + }, + ], + }, + ], +}; + `, + errors: [ + { + messageId: 'invalidFormattingErrorTest', + }, + { + messageId: 'invalidFormattingErrorTest', + }, + ], + }, ], }); diff --git a/packages/eslint-plugin-tslint/CHANGELOG.md b/packages/eslint-plugin-tslint/CHANGELOG.md index 886cf7f02c9..037d1977639 100644 --- a/packages/eslint-plugin-tslint/CHANGELOG.md +++ b/packages/eslint-plugin-tslint/CHANGELOG.md @@ -3,1510 +3,819 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -# [5.39.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.1...v5.39.0) (2022-10-03) +## [5.46.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.46.0...v5.46.1) (2022-12-12) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [5.46.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.45.1...v5.46.0) (2022-12-08) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - -## [5.38.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.0...v5.38.1) (2022-09-26) +## [5.45.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.45.0...v5.45.1) (2022-12-05) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [5.45.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.44.0...v5.45.0) (2022-11-28) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [5.44.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.43.0...v5.44.0) (2022-11-21) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint -# [5.38.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.37.0...v5.38.0) (2022-09-19) +# [5.43.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.1...v5.43.0) (2022-11-14) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +## [5.42.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.0...v5.42.1) (2022-11-07) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [5.42.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.41.0...v5.42.0) (2022-10-31) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint -# [5.37.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.2...v5.37.0) (2022-09-12) +# [5.41.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.1...v5.41.0) (2022-10-24) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +## [5.40.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.0...v5.40.1) (2022-10-17) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [5.40.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.39.0...v5.40.0) (2022-10-10) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint -## [5.36.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.1...v5.36.2) (2022-09-05) +# [5.39.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.1...v5.39.0) (2022-10-03) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +## [5.38.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.0...v5.38.1) (2022-09-26) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [5.38.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.37.0...v5.38.0) (2022-09-19) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint -## [5.36.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.0...v5.36.1) (2022-08-30) +# [5.37.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.2...v5.37.0) (2022-09-12) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +## [5.36.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.1...v5.36.2) (2022-09-05) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +## [5.36.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.0...v5.36.1) (2022-08-30) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint # [5.36.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.1...v5.36.0) (2022-08-30) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - ## [5.35.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.0...v5.35.1) (2022-08-24) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - # [5.35.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.34.0...v5.35.0) (2022-08-24) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [5.34.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.1...v5.34.0) (2022-08-22) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +## [5.33.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.0...v5.33.1) (2022-08-15) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint -# [5.34.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.1...v5.34.0) (2022-08-22) +# [5.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.32.0...v5.33.0) (2022-08-08) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [5.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.31.0...v5.32.0) (2022-08-01) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [5.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.7...v5.31.0) (2022-07-25) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint -## [5.33.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.0...v5.33.1) (2022-08-15) +## [5.30.7](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.6...v5.30.7) (2022-07-18) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +## [5.30.6](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.5...v5.30.6) (2022-07-11) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +## [5.30.5](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.4...v5.30.5) (2022-07-04) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint -# [5.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.32.0...v5.33.0) (2022-08-08) +## [5.30.4](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.3...v5.30.4) (2022-07-03) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +## [5.30.3](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.2...v5.30.3) (2022-07-01) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +## [5.30.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.1...v5.30.2) (2022-07-01) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint -# [5.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.31.0...v5.32.0) (2022-08-01) +## 5.30.1 (2022-07-01) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [5.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.29.0...v5.30.0) (2022-06-27) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [5.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.28.0...v5.29.0) (2022-06-20) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint -# [5.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.7...v5.31.0) (2022-07-25) +# [5.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.1...v5.28.0) (2022-06-13) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +## [5.27.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.0...v5.27.1) (2022-06-06) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [5.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.26.0...v5.27.0) (2022-05-30) +### Features +- [4.7] support new extensions ([#5027](https://github.com/typescript-eslint/typescript-eslint/issues/5027)) ([efc147b](https://github.com/typescript-eslint/typescript-eslint/commit/efc147b04dce52ab17415b6a4ae4076b944b9036)) -## [5.30.7](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.6...v5.30.7) (2022-07-18) +# [5.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.25.0...v5.26.0) (2022-05-23) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [5.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.24.0...v5.25.0) (2022-05-17) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [5.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.23.0...v5.24.0) (2022-05-16) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint -## [5.30.6](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.5...v5.30.6) (2022-07-11) +# [5.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.22.0...v5.23.0) (2022-05-09) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [5.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.21.0...v5.22.0) (2022-05-02) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [5.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.20.0...v5.21.0) (2022-04-25) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint -## [5.30.5](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.4...v5.30.5) (2022-07-04) +# [5.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.19.0...v5.20.0) (2022-04-18) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [5.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.18.0...v5.19.0) (2022-04-11) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [5.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.17.0...v5.18.0) (2022-04-04) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint -## [5.30.4](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.3...v5.30.4) (2022-07-03) +# [5.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.16.0...v5.17.0) (2022-03-28) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [5.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.15.0...v5.16.0) (2022-03-21) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [5.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.14.0...v5.15.0) (2022-03-14) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint -## [5.30.3](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.2...v5.30.3) (2022-07-01) +# [5.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.13.0...v5.14.0) (2022-03-07) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [5.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.1...v5.13.0) (2022-02-28) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +## [5.12.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.0...v5.12.1) (2022-02-21) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint -## [5.30.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.1...v5.30.2) (2022-07-01) +# [5.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.11.0...v5.12.0) (2022-02-14) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [5.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.2...v5.11.0) (2022-02-07) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +## [5.10.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.1...v5.10.2) (2022-01-31) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint -## 5.30.1 (2022-07-01) +## [5.10.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.0...v5.10.1) (2022-01-24) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [5.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.1...v5.10.0) (2022-01-17) +### Features +- rename `experimental-utils` to `utils` and make `experimental-utils` an alias to the new package ([#4172](https://github.com/typescript-eslint/typescript-eslint/issues/4172)) ([1d55a75](https://github.com/typescript-eslint/typescript-eslint/commit/1d55a7511b38d8e2b2eabe59f639e0a865e6c93f)) - -# [5.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.29.0...v5.30.0) (2022-06-27) +## [5.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.0...v5.9.1) (2022-01-10) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [5.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.1...v5.9.0) (2022-01-03) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +## [5.8.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.0...v5.8.1) (2021-12-27) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint -# [5.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.28.0...v5.29.0) (2022-06-20) +# [5.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.7.0...v5.8.0) (2021-12-20) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [5.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.6.0...v5.7.0) (2021-12-13) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [5.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.5.0...v5.6.0) (2021-12-06) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint -# [5.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.1...v5.28.0) (2022-06-13) +# [5.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.4.0...v5.5.0) (2021-11-29) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [5.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.3.1...v5.4.0) (2021-11-15) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +## [5.3.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.3.0...v5.3.1) (2021-11-08) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint -## [5.27.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.0...v5.27.1) (2022-06-06) +# [5.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.2.0...v5.3.0) (2021-11-01) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [5.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.1.0...v5.2.0) (2021-10-25) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [5.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.0.0...v5.1.0) (2021-10-18) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint -# [5.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.26.0...v5.27.0) (2022-05-30) - +# [5.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.33.0...v5.0.0) (2021-10-11) ### Features -* [4.7] support new extensions ([#5027](https://github.com/typescript-eslint/typescript-eslint/issues/5027)) ([efc147b](https://github.com/typescript-eslint/typescript-eslint/commit/efc147b04dce52ab17415b6a4ae4076b944b9036)) +- remove `meta.docs.category` from rules ([#3800](https://github.com/typescript-eslint/typescript-eslint/issues/3800)) ([71c9370](https://github.com/typescript-eslint/typescript-eslint/commit/71c93706e55f5f92a1285102b93c6ab1950c6df4)) +- support ESLint v8 ([#3737](https://github.com/typescript-eslint/typescript-eslint/issues/3737)) ([4ca62ae](https://github.com/typescript-eslint/typescript-eslint/commit/4ca62aee6681d706e762a8db727541ca204364f2)) +# [4.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.32.0...v4.33.0) (2021-10-04) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [4.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.2...v4.32.0) (2021-09-27) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint -# [5.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.25.0...v5.26.0) (2022-05-23) +## [4.31.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.1...v4.31.2) (2021-09-20) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +## [4.31.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.0...v4.31.1) (2021-09-13) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [4.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.30.0...v4.31.0) (2021-09-06) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint -# [5.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.24.0...v5.25.0) (2022-05-17) +# [4.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.3...v4.30.0) (2021-08-30) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +## [4.29.3](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.2...v4.29.3) (2021-08-23) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +## [4.29.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.1...v4.29.2) (2021-08-16) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint -# [5.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.23.0...v5.24.0) (2022-05-16) +## [4.29.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.0...v4.29.1) (2021-08-09) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [4.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.5...v4.29.0) (2021-08-02) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +## [4.28.5](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.4...v4.28.5) (2021-07-26) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint -# [5.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.22.0...v5.23.0) (2022-05-09) +## [4.28.4](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.3...v4.28.4) (2021-07-19) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +## [4.28.3](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.2...v4.28.3) (2021-07-12) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +## [4.28.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.1...v4.28.2) (2021-07-05) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint -# [5.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.21.0...v5.22.0) (2022-05-02) +## [4.28.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.0...v4.28.1) (2021-06-28) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [4.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.27.0...v4.28.0) (2021-06-21) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [4.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.1...v4.27.0) (2021-06-14) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint -# [5.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.20.0...v5.21.0) (2022-04-25) +## [4.26.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.0...v4.26.1) (2021-06-07) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [4.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.25.0...v4.26.0) (2021-05-31) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [4.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.24.0...v4.25.0) (2021-05-24) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint -# [5.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.19.0...v5.20.0) (2022-04-18) +# [4.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.23.0...v4.24.0) (2021-05-17) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [4.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.1...v4.23.0) (2021-05-10) +### Features +- refactor to split AST specification out as its own module ([#2911](https://github.com/typescript-eslint/typescript-eslint/issues/2911)) ([25ea953](https://github.com/typescript-eslint/typescript-eslint/commit/25ea953cc60b118bd385c71e0a9b61c286c26fcf)) - -# [5.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.18.0...v5.19.0) (2022-04-11) +## [4.22.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.0...v4.22.1) (2021-05-04) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [4.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.21.0...v4.22.0) (2021-04-12) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [4.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.20.0...v4.21.0) (2021-04-05) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint -# [5.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.17.0...v5.18.0) (2022-04-04) +# [4.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.19.0...v4.20.0) (2021-03-29) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [4.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.18.0...v4.19.0) (2021-03-22) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [4.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.17.0...v4.18.0) (2021-03-15) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint -# [5.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.16.0...v5.17.0) (2022-03-28) +# [4.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.16.1...v4.17.0) (2021-03-08) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +## [4.16.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.16.0...v4.16.1) (2021-03-01) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [4.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.2...v4.16.0) (2021-03-01) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint -# [5.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.15.0...v5.16.0) (2022-03-21) +## [4.15.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.1...v4.15.2) (2021-02-22) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +## [4.15.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.0...v4.15.1) (2021-02-15) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [4.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.2...v4.15.0) (2021-02-08) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint -# [5.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.14.0...v5.15.0) (2022-03-14) +## [4.14.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.1...v4.14.2) (2021-02-01) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +## [4.14.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.0...v4.14.1) (2021-01-25) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [4.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.13.0...v4.14.0) (2021-01-18) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint -# [5.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.13.0...v5.14.0) (2022-03-07) +# [4.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.12.0...v4.13.0) (2021-01-11) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [4.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.11.1...v4.12.0) (2021-01-04) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +## [4.11.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.11.0...v4.11.1) (2020-12-28) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint -# [5.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.1...v5.13.0) (2022-02-28) +# [4.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.10.0...v4.11.0) (2020-12-21) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [4.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.9.1...v4.10.0) (2020-12-14) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +## [4.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.9.0...v4.9.1) (2020-12-07) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint -## [5.12.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.0...v5.12.1) (2022-02-21) +# [4.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.2...v4.9.0) (2020-11-30) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +## [4.8.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.1...v4.8.2) (2020-11-23) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +## [4.8.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.0...v4.8.1) (2020-11-17) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint -# [5.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.11.0...v5.12.0) (2022-02-14) +# [4.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.7.0...v4.8.0) (2020-11-16) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [4.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.6.1...v4.7.0) (2020-11-09) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +## [4.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.6.0...v4.6.1) (2020-11-02) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint -# [5.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.2...v5.11.0) (2022-02-07) +# [4.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.5.0...v4.6.0) (2020-10-26) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [4.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.4.1...v4.5.0) (2020-10-19) +### Features +- **typescript-estree:** add flag EXPERIMENTAL_useSourceOfProjectReferenceRedirect ([#2669](https://github.com/typescript-eslint/typescript-eslint/issues/2669)) ([90a5878](https://github.com/typescript-eslint/typescript-eslint/commit/90a587845088da1b205e4d7d77dbc3f9447b1c5a)) - -## [5.10.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.1...v5.10.2) (2022-01-31) +## [4.4.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.4.0...v4.4.1) (2020-10-12) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [4.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.3.0...v4.4.0) (2020-10-05) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [4.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.2.0...v4.3.0) (2020-09-28) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint -## [5.10.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.0...v5.10.1) (2022-01-24) +# [4.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.1...v4.2.0) (2020-09-21) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +## [4.1.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.0...v4.1.1) (2020-09-14) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [4.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.0.1...v4.1.0) (2020-09-07) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint -# [5.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.1...v5.10.0) (2022-01-17) - - -### Features - -* rename `experimental-utils` to `utils` and make `experimental-utils` an alias to the new package ([#4172](https://github.com/typescript-eslint/typescript-eslint/issues/4172)) ([1d55a75](https://github.com/typescript-eslint/typescript-eslint/commit/1d55a7511b38d8e2b2eabe59f639e0a865e6c93f)) - - - - - -## [5.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.0...v5.9.1) (2022-01-10) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [5.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.1...v5.9.0) (2022-01-03) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -## [5.8.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.0...v5.8.1) (2021-12-27) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [5.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.7.0...v5.8.0) (2021-12-20) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [5.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.6.0...v5.7.0) (2021-12-13) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [5.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.5.0...v5.6.0) (2021-12-06) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [5.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.4.0...v5.5.0) (2021-11-29) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [5.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.3.1...v5.4.0) (2021-11-15) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -## [5.3.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.3.0...v5.3.1) (2021-11-08) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [5.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.2.0...v5.3.0) (2021-11-01) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [5.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.1.0...v5.2.0) (2021-10-25) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [5.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.0.0...v5.1.0) (2021-10-18) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [5.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.33.0...v5.0.0) (2021-10-11) - - -### Features - -* remove `meta.docs.category` from rules ([#3800](https://github.com/typescript-eslint/typescript-eslint/issues/3800)) ([71c9370](https://github.com/typescript-eslint/typescript-eslint/commit/71c93706e55f5f92a1285102b93c6ab1950c6df4)) -* support ESLint v8 ([#3737](https://github.com/typescript-eslint/typescript-eslint/issues/3737)) ([4ca62ae](https://github.com/typescript-eslint/typescript-eslint/commit/4ca62aee6681d706e762a8db727541ca204364f2)) - - - - - -# [4.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.32.0...v4.33.0) (2021-10-04) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [4.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.2...v4.32.0) (2021-09-27) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -## [4.31.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.1...v4.31.2) (2021-09-20) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -## [4.31.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.0...v4.31.1) (2021-09-13) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [4.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.30.0...v4.31.0) (2021-09-06) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [4.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.3...v4.30.0) (2021-08-30) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -## [4.29.3](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.2...v4.29.3) (2021-08-23) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -## [4.29.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.1...v4.29.2) (2021-08-16) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -## [4.29.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.0...v4.29.1) (2021-08-09) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [4.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.5...v4.29.0) (2021-08-02) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -## [4.28.5](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.4...v4.28.5) (2021-07-26) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -## [4.28.4](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.3...v4.28.4) (2021-07-19) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -## [4.28.3](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.2...v4.28.3) (2021-07-12) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -## [4.28.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.1...v4.28.2) (2021-07-05) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -## [4.28.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.0...v4.28.1) (2021-06-28) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [4.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.27.0...v4.28.0) (2021-06-21) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [4.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.1...v4.27.0) (2021-06-14) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -## [4.26.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.0...v4.26.1) (2021-06-07) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [4.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.25.0...v4.26.0) (2021-05-31) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [4.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.24.0...v4.25.0) (2021-05-24) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [4.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.23.0...v4.24.0) (2021-05-17) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [4.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.1...v4.23.0) (2021-05-10) - - -### Features - -* refactor to split AST specification out as its own module ([#2911](https://github.com/typescript-eslint/typescript-eslint/issues/2911)) ([25ea953](https://github.com/typescript-eslint/typescript-eslint/commit/25ea953cc60b118bd385c71e0a9b61c286c26fcf)) - - - - - -## [4.22.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.0...v4.22.1) (2021-05-04) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [4.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.21.0...v4.22.0) (2021-04-12) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [4.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.20.0...v4.21.0) (2021-04-05) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [4.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.19.0...v4.20.0) (2021-03-29) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [4.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.18.0...v4.19.0) (2021-03-22) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [4.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.17.0...v4.18.0) (2021-03-15) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [4.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.16.1...v4.17.0) (2021-03-08) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -## [4.16.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.16.0...v4.16.1) (2021-03-01) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [4.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.2...v4.16.0) (2021-03-01) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -## [4.15.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.1...v4.15.2) (2021-02-22) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -## [4.15.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.0...v4.15.1) (2021-02-15) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [4.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.2...v4.15.0) (2021-02-08) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -## [4.14.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.1...v4.14.2) (2021-02-01) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -## [4.14.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.0...v4.14.1) (2021-01-25) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [4.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.13.0...v4.14.0) (2021-01-18) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [4.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.12.0...v4.13.0) (2021-01-11) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [4.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.11.1...v4.12.0) (2021-01-04) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -## [4.11.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.11.0...v4.11.1) (2020-12-28) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [4.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.10.0...v4.11.0) (2020-12-21) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [4.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.9.1...v4.10.0) (2020-12-14) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -## [4.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.9.0...v4.9.1) (2020-12-07) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [4.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.2...v4.9.0) (2020-11-30) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -## [4.8.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.1...v4.8.2) (2020-11-23) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -## [4.8.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.0...v4.8.1) (2020-11-17) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [4.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.7.0...v4.8.0) (2020-11-16) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [4.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.6.1...v4.7.0) (2020-11-09) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -## [4.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.6.0...v4.6.1) (2020-11-02) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [4.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.5.0...v4.6.0) (2020-10-26) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [4.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.4.1...v4.5.0) (2020-10-19) - - -### Features - -* **typescript-estree:** add flag EXPERIMENTAL_useSourceOfProjectReferenceRedirect ([#2669](https://github.com/typescript-eslint/typescript-eslint/issues/2669)) ([90a5878](https://github.com/typescript-eslint/typescript-eslint/commit/90a587845088da1b205e4d7d77dbc3f9447b1c5a)) - - - - - -## [4.4.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.4.0...v4.4.1) (2020-10-12) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [4.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.3.0...v4.4.0) (2020-10-05) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [4.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.2.0...v4.3.0) (2020-09-28) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [4.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.1...v4.2.0) (2020-09-21) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -## [4.1.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.0...v4.1.1) (2020-09-14) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [4.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.0.1...v4.1.0) (2020-09-07) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -## [4.0.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.0.0...v4.0.1) (2020-08-31) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - +## [4.0.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.0.0...v4.0.1) (2020-08-31) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint # [4.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.10.1...v4.0.0) (2020-08-31) -## [Please see the release notes for v4.0.0](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v4.0.0) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -## [3.10.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.10.0...v3.10.1) (2020-08-25) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [3.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.9.1...v3.10.0) (2020-08-24) +## [Please see the release notes for v4.0.0](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v4.0.0) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +## [3.10.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.10.0...v3.10.1) (2020-08-25) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint +# [3.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.9.1...v3.10.0) (2020-08-24) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint ## [3.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.9.0...v3.9.1) (2020-08-17) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - # [3.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.8.0...v3.9.0) (2020-08-10) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - # [3.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.7.1...v3.8.0) (2020-08-03) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - ## [3.7.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.7.0...v3.7.1) (2020-07-27) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - # [3.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.6.1...v3.7.0) (2020-07-20) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - ## [3.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.6.0...v3.6.1) (2020-07-13) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - # [3.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.5.0...v3.6.0) (2020-07-06) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - # [3.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.4.0...v3.5.0) (2020-06-29) - ### Features -* add package scope-manager ([#1939](https://github.com/typescript-eslint/typescript-eslint/issues/1939)) ([682eb7e](https://github.com/typescript-eslint/typescript-eslint/commit/682eb7e009c3f22a542882dfd3602196a60d2a1e)) - - - - +- add package scope-manager ([#1939](https://github.com/typescript-eslint/typescript-eslint/issues/1939)) ([682eb7e](https://github.com/typescript-eslint/typescript-eslint/commit/682eb7e009c3f22a542882dfd3602196a60d2a1e)) # [3.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.3.0...v3.4.0) (2020-06-22) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - # [3.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.2.0...v3.3.0) (2020-06-15) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - # [3.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.1.0...v3.2.0) (2020-06-08) - ### Bug Fixes -* **eslint-plugin:** [prefer-optional-chain] handling first member expression ([#2156](https://github.com/typescript-eslint/typescript-eslint/issues/2156)) ([de18660](https://github.com/typescript-eslint/typescript-eslint/commit/de18660a8cf8f7033798646d8c5b0938d1accb12)) - - - - +- **eslint-plugin:** [prefer-optional-chain] handling first member expression ([#2156](https://github.com/typescript-eslint/typescript-eslint/issues/2156)) ([de18660](https://github.com/typescript-eslint/typescript-eslint/commit/de18660a8cf8f7033798646d8c5b0938d1accb12)) # [3.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.0.2...v3.1.0) (2020-06-01) - ### Bug Fixes -* **experimental-utils:** downlevel type declarations for versions older than 3.8 ([#2133](https://github.com/typescript-eslint/typescript-eslint/issues/2133)) ([7925823](https://github.com/typescript-eslint/typescript-eslint/commit/792582326a8065270b69a0ffcaad5a7b4b103ff3)) - - - - +- **experimental-utils:** downlevel type declarations for versions older than 3.8 ([#2133](https://github.com/typescript-eslint/typescript-eslint/issues/2133)) ([7925823](https://github.com/typescript-eslint/typescript-eslint/commit/792582326a8065270b69a0ffcaad5a7b4b103ff3)) ## [3.0.2](https://github.com/typescript-eslint/typescript-eslint/compare/v3.0.1...v3.0.2) (2020-05-27) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - ## [3.0.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.0.0...v3.0.1) (2020-05-25) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - # [3.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.34.0...v3.0.0) (2020-05-21) ## [Please see the release notes for v3.0.0](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v3.0.0) ### Features -* drop support for node v8 ([#1997](https://github.com/typescript-eslint/typescript-eslint/issues/1997)) ([b6c3b7b](https://github.com/typescript-eslint/typescript-eslint/commit/b6c3b7b84b8d199fa75a46432febd4a364a63217)) -* upgrade to ESLint v7 ([#2022](https://github.com/typescript-eslint/typescript-eslint/issues/2022)) ([208de71](https://github.com/typescript-eslint/typescript-eslint/commit/208de71059746bf38e94bd460346ffb2698a3e12)) - - - - +- drop support for node v8 ([#1997](https://github.com/typescript-eslint/typescript-eslint/issues/1997)) ([b6c3b7b](https://github.com/typescript-eslint/typescript-eslint/commit/b6c3b7b84b8d199fa75a46432febd4a364a63217)) +- upgrade to ESLint v7 ([#2022](https://github.com/typescript-eslint/typescript-eslint/issues/2022)) ([208de71](https://github.com/typescript-eslint/typescript-eslint/commit/208de71059746bf38e94bd460346ffb2698a3e12)) # [2.34.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.33.0...v2.34.0) (2020-05-18) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - # [2.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.32.0...v2.33.0) (2020-05-12) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - # [2.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.31.0...v2.32.0) (2020-05-11) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - # [2.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.30.0...v2.31.0) (2020-05-04) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - # [2.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.29.0...v2.30.0) (2020-04-27) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - # [2.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.28.0...v2.29.0) (2020-04-20) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - # [2.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.27.0...v2.28.0) (2020-04-13) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - # [2.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.26.0...v2.27.0) (2020-04-06) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - # [2.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.25.0...v2.26.0) (2020-03-30) - ### Features -* **eslint-plugin-tslint:** support tslint 6 ([#1809](https://github.com/typescript-eslint/typescript-eslint/issues/1809)) ([7d963fd](https://github.com/typescript-eslint/typescript-eslint/commit/7d963fd846935acd91b7b0cd31c56a70a2b994d1)) - - - - +- **eslint-plugin-tslint:** support tslint 6 ([#1809](https://github.com/typescript-eslint/typescript-eslint/issues/1809)) ([7d963fd](https://github.com/typescript-eslint/typescript-eslint/commit/7d963fd846935acd91b7b0cd31c56a70a2b994d1)) # [2.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.24.0...v2.25.0) (2020-03-23) - ### Bug Fixes -* **eslint-plugin-tslint:** fix tslintConfig memoization key ([#1719](https://github.com/typescript-eslint/typescript-eslint/issues/1719)) ([abf1a2f](https://github.com/typescript-eslint/typescript-eslint/commit/abf1a2fa5574e41af8070be3d79a886ea2f989cc)), closes [typescript-eslint#1692](https://github.com/typescript-eslint/issues/1692) - - - - +- **eslint-plugin-tslint:** fix tslintConfig memoization key ([#1719](https://github.com/typescript-eslint/typescript-eslint/issues/1719)) ([abf1a2f](https://github.com/typescript-eslint/typescript-eslint/commit/abf1a2fa5574e41af8070be3d79a886ea2f989cc)), closes [typescript-eslint#1692](https://github.com/typescript-eslint/issues/1692) # [2.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.23.0...v2.24.0) (2020-03-16) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - # [2.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.22.0...v2.23.0) (2020-03-09) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - # [2.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.21.0...v2.22.0) (2020-03-02) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - # [2.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.20.0...v2.21.0) (2020-02-24) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - # [2.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.19.2...v2.20.0) (2020-02-17) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - ## [2.19.2](https://github.com/typescript-eslint/typescript-eslint/compare/v2.19.1...v2.19.2) (2020-02-10) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - ## [2.19.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.19.0...v2.19.1) (2020-02-10) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - # [2.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.18.0...v2.19.0) (2020-02-03) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - # [2.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.17.0...v2.18.0) (2020-01-27) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - # [2.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.16.0...v2.17.0) (2020-01-20) - ### Features -* **experimental-utils:** expose getParserServices from utils ([#1448](https://github.com/typescript-eslint/typescript-eslint/issues/1448)) ([982c8bc](https://github.com/typescript-eslint/typescript-eslint/commit/982c8bc)) - - - - +- **experimental-utils:** expose getParserServices from utils ([#1448](https://github.com/typescript-eslint/typescript-eslint/issues/1448)) ([982c8bc](https://github.com/typescript-eslint/typescript-eslint/commit/982c8bc)) # [2.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.15.0...v2.16.0) (2020-01-13) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - # [2.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.14.0...v2.15.0) (2020-01-06) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - # [2.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.13.0...v2.14.0) (2019-12-30) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - # [2.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.12.0...v2.13.0) (2019-12-23) - ### Features -* **eslint-plugin-tslint:** add fixer for config rule ([#1342](https://github.com/typescript-eslint/typescript-eslint/issues/1342)) ([c52c5c9](https://github.com/typescript-eslint/typescript-eslint/commit/c52c5c9)) - - - - +- **eslint-plugin-tslint:** add fixer for config rule ([#1342](https://github.com/typescript-eslint/typescript-eslint/issues/1342)) ([c52c5c9](https://github.com/typescript-eslint/typescript-eslint/commit/c52c5c9)) # [2.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.11.0...v2.12.0) (2019-12-16) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - # [2.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.10.0...v2.11.0) (2019-12-09) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - # [2.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.9.0...v2.10.0) (2019-12-02) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - # [2.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.8.0...v2.9.0) (2019-11-25) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - # [2.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.7.0...v2.8.0) (2019-11-18) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - # [2.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.6.1...v2.7.0) (2019-11-11) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - ## [2.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.6.0...v2.6.1) (2019-11-04) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - # [2.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.5.0...v2.6.0) (2019-10-28) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - # [2.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.4.0...v2.5.0) (2019-10-21) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - # [2.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.3...v2.4.0) (2019-10-14) - ### Bug Fixes -* support long running "watch" lint sessions ([#973](https://github.com/typescript-eslint/typescript-eslint/issues/973)) ([854620e](https://github.com/typescript-eslint/typescript-eslint/commit/854620e)) - +- support long running "watch" lint sessions ([#973](https://github.com/typescript-eslint/typescript-eslint/issues/973)) ([854620e](https://github.com/typescript-eslint/typescript-eslint/commit/854620e)) ### Features -* **typescript-estree:** support for parsing 3.7 features ([#1045](https://github.com/typescript-eslint/typescript-eslint/issues/1045)) ([623febf](https://github.com/typescript-eslint/typescript-eslint/commit/623febf)) - - - - +- **typescript-estree:** support for parsing 3.7 features ([#1045](https://github.com/typescript-eslint/typescript-eslint/issues/1045)) ([623febf](https://github.com/typescript-eslint/typescript-eslint/commit/623febf)) ## [2.3.3](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.2...v2.3.3) (2019-10-07) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - ## [2.3.2](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.1...v2.3.2) (2019-09-30) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - ## [2.3.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.0...v2.3.1) (2019-09-23) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - # [2.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.2.0...v2.3.0) (2019-09-16) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - # [2.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.1.0...v2.2.0) (2019-09-09) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - # [2.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.0.0...v2.1.0) (2019-09-02) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - # [2.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.13.0...v2.0.0) (2019-08-13) - ### Features -* explicitly support eslint v6 ([#645](https://github.com/typescript-eslint/typescript-eslint/issues/645)) ([34a7cf6](https://github.com/typescript-eslint/typescript-eslint/commit/34a7cf6)) - - -* feat(eslint-plugin)!: change recommended config (#729) ([428567d](https://github.com/typescript-eslint/typescript-eslint/commit/428567d)), closes [#729](https://github.com/typescript-eslint/typescript-eslint/issues/729) -* feat(typescript-estree)!: throw error on file not in project when `project` set (#760) ([3777b77](https://github.com/typescript-eslint/typescript-eslint/commit/3777b77)), closes [#760](https://github.com/typescript-eslint/typescript-eslint/issues/760) +- explicitly support eslint v6 ([#645](https://github.com/typescript-eslint/typescript-eslint/issues/645)) ([34a7cf6](https://github.com/typescript-eslint/typescript-eslint/commit/34a7cf6)) +- feat(eslint-plugin)!: change recommended config (#729) ([428567d](https://github.com/typescript-eslint/typescript-eslint/commit/428567d)), closes [#729](https://github.com/typescript-eslint/typescript-eslint/issues/729) +- feat(typescript-estree)!: throw error on file not in project when `project` set (#760) ([3777b77](https://github.com/typescript-eslint/typescript-eslint/commit/3777b77)), closes [#760](https://github.com/typescript-eslint/typescript-eslint/issues/760) ### BREAKING CHANGES -* recommended config changes are considered breaking -* by default we will now throw when a file is not in the `project` provided -* Node 6 is no longer supported - - - - +- recommended config changes are considered breaking +- by default we will now throw when a file is not in the `project` provided +- Node 6 is no longer supported # [1.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.12.0...v1.13.0) (2019-07-21) - ### Bug Fixes -* Correct `@types/json-schema` dependency ([#675](https://github.com/typescript-eslint/typescript-eslint/issues/675)) ([a5398ce](https://github.com/typescript-eslint/typescript-eslint/commit/a5398ce)) - - - - +- Correct `@types/json-schema` dependency ([#675](https://github.com/typescript-eslint/typescript-eslint/issues/675)) ([a5398ce](https://github.com/typescript-eslint/typescript-eslint/commit/a5398ce)) # [1.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.11.0...v1.12.0) (2019-07-12) - ### Features -* **eslint-plugin:** added new rule prefer-readonly ([#555](https://github.com/typescript-eslint/typescript-eslint/issues/555)) ([76b89a5](https://github.com/typescript-eslint/typescript-eslint/commit/76b89a5)) - - - - +- **eslint-plugin:** added new rule prefer-readonly ([#555](https://github.com/typescript-eslint/typescript-eslint/issues/555)) ([76b89a5](https://github.com/typescript-eslint/typescript-eslint/commit/76b89a5)) # [1.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.10.2...v1.11.0) (2019-06-23) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - ## [1.10.2](https://github.com/typescript-eslint/typescript-eslint/compare/v1.10.1...v1.10.2) (2019-06-10) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint diff --git a/packages/eslint-plugin-tslint/LICENSE b/packages/eslint-plugin-tslint/LICENSE index 7e7370143b2..a1164108d4d 100644 --- a/packages/eslint-plugin-tslint/LICENSE +++ b/packages/eslint-plugin-tslint/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2019 TypeScript ESLint and other contributors +Copyright (c) 2019 typescript-eslint and other contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/eslint-plugin-tslint/README.md b/packages/eslint-plugin-tslint/README.md index 021b8780bfb..57c414230ec 100644 --- a/packages/eslint-plugin-tslint/README.md +++ b/packages/eslint-plugin-tslint/README.md @@ -1,62 +1,10 @@ -

ESLint Plugin TSLint

+# `@typescript-eslint/eslint-plugin-tslint` -

ESLint plugin wraps a TSLint configuration and lints the whole source using TSLint.

+> ESLint plugin that wraps a TSLint configuration and lints the whole source using TSLint. -

- CI - NPM Version - NPM Downloads -

+[![NPM Version](https://img.shields.io/npm/v/@typescript-eslint/eslint-plugin-tslint.svg?style=flat-square)](https://www.npmjs.com/package/@typescript-eslint/eslint-plugin-tslint) +[![NPM Downloads](https://img.shields.io/npm/dm/@typescript-eslint/eslint-plugin-tslint.svg?style=flat-square)](https://www.npmjs.com/package/@typescript-eslint/eslint-plugin-tslint) -## Installation +👉 See **https://typescript-eslint.io/architecture/eslint-plugin-tslint** for documentation on this package. -```sh -yarn add -D @typescript-eslint/eslint-plugin-tslint -``` - -## Usage - -Configure in your ESLint config file: - -```js -{ - "plugins": [ - "@typescript-eslint/tslint" - ], - "parserOptions": { - "project": "tsconfig.json", - }, - "rules": { - "@typescript-eslint/tslint/config": ["warn", { - "lintFile": "", // path to tslint.json of your project - "rules": { - // tslint rules (will be used if `lintFile` is not specified) - }, - "rulesDirectory": [ - // array of paths to directories with rules, e.g. 'node_modules/tslint/lib/rules' (will be used if `lintFile` is not specified) - ] - }], - } -} -``` - -**Note:** The ability to automatically fix problems with `--fix` is unavailable for TSLint rules loaded with this plugin. - -## Rules - -Plugin contains only single rule `@typescript-eslint/tslint/config`. - -## Examples - -- [`unlight/node-package-starter/.eslintrc.js`](https://github.com/unlight/node-package-starter/blob/master/.eslintrc.js) - -### TSLint Plugins - -- https://github.com/Glavin001/tslint-clean-code -- https://github.com/Microsoft/tslint-microsoft-contrib -- https://github.com/SonarSource/SonarTS -- https://github.com/ajafff/tslint-consistent-codestyle - -## Contributing - -[See the contributing guide here](../../CONTRIBUTING.md) +> See https://typescript-eslint.io for general documentation on typescript-eslint, the tooling that allows you to run ESLint and Prettier on TypeScript code. diff --git a/packages/eslint-plugin-tslint/package.json b/packages/eslint-plugin-tslint/package.json index 7dc807fdb1b..ade2a280892 100644 --- a/packages/eslint-plugin-tslint/package.json +++ b/packages/eslint-plugin-tslint/package.json @@ -1,9 +1,9 @@ { "name": "@typescript-eslint/eslint-plugin-tslint", - "version": "5.39.0", + "version": "5.46.1", "main": "dist/index.js", "typings": "src/index.ts", - "description": "TSLint wrapper plugin for ESLint", + "description": "ESLint plugin that wraps a TSLint configuration and lints the whole source using TSLint", "keywords": [ "eslint", "eslintplugin", @@ -33,12 +33,12 @@ "clean": "tsc -b tsconfig.build.json --clean", "postclean": "rimraf dist && rimraf coverage", "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", - "lint": "eslint . --ignore-path='../../.eslintignore'", + "lint": "nx lint", "test": "jest --coverage", "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/utils": "5.39.0", + "@typescript-eslint/utils": "5.46.1", "lodash": "^4.17.21" }, "peerDependencies": { @@ -48,6 +48,6 @@ }, "devDependencies": { "@types/lodash": "*", - "@typescript-eslint/parser": "5.39.0" + "@typescript-eslint/parser": "5.46.1" } } diff --git a/packages/eslint-plugin-tslint/project.json b/packages/eslint-plugin-tslint/project.json index 8ca785bd7d1..29bcb865041 100644 --- a/packages/eslint-plugin-tslint/project.json +++ b/packages/eslint-plugin-tslint/project.json @@ -1,5 +1,15 @@ { - "root": "packages/eslint-plugin-tslint", + "name": "eslint-plugin-tslint", + "$schema": "../../node_modules/nx/schemas/project-schema.json", "type": "library", - "implicitDependencies": [] + "implicitDependencies": [], + "targets": { + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["packages/eslint-plugin-tslint/**/*.ts"] + } + } + } } diff --git a/packages/eslint-plugin-tslint/src/rules/config.ts b/packages/eslint-plugin-tslint/src/rules/config.ts index 5f20bcd4430..97b77e7d080 100644 --- a/packages/eslint-plugin-tslint/src/rules/config.ts +++ b/packages/eslint-plugin-tslint/src/rules/config.ts @@ -64,7 +64,7 @@ export default createRule({ meta: { docs: { description: - 'Wraps a TSLint configuration and lints the whole source using TSLint', + 'Wraps a TSLint configuration and lints the whole source using TSLint', // eslint-disable-line eslint-plugin/require-meta-docs-description recommended: false, }, fixable: 'code', @@ -98,18 +98,13 @@ export default createRule({ ], }, defaultOptions: [{}], - create(context) { + create( + context, + [{ rules: tslintRules, rulesDirectory: tslintRulesDirectory, lintFile }], + ) { const fileName = context.getFilename(); const sourceCode = context.getSourceCode().text; const parserServices = ESLintUtils.getParserServices(context); - - /** - * The TSLint rules configuration passed in by the user - */ - const [ - { rules: tslintRules, rulesDirectory: tslintRulesDirectory, lintFile }, - ] = context.options; - const program = parserServices.program; /** diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index 3fd0506e389..74ddd9d67c6 100644 --- a/packages/eslint-plugin/CHANGELOG.md +++ b/packages/eslint-plugin/CHANGELOG.md @@ -3,2831 +3,1983 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -# [5.39.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.1...v5.39.0) (2022-10-03) - +## [5.46.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.46.0...v5.46.1) (2022-12-12) -### Features +**Note:** Version bump only for package @typescript-eslint/eslint-plugin -* **eslint-plugin:** allow using void as a default type for a generic argument if allowInGenericTypeArguments is specified ([#5671](https://github.com/typescript-eslint/typescript-eslint/issues/5671)) ([bb46ef0](https://github.com/typescript-eslint/typescript-eslint/commit/bb46ef0817fe03ef71f8e0f3df0cf96bc355e068)) +# [5.46.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.45.1...v5.46.0) (2022-12-08) +### Bug Fixes +- **eslint-plugin:** [ban-types] update message to suggest `object` instead of `Record` ([#6079](https://github.com/typescript-eslint/typescript-eslint/issues/6079)) ([d91a5fc](https://github.com/typescript-eslint/typescript-eslint/commit/d91a5fc41be5bc2a0625574e9c9496f61fb7471d)) +### Features +- **eslint-plugin:** [prefer-nullish-coalescing] logic and test for strict null checks ([#6174](https://github.com/typescript-eslint/typescript-eslint/issues/6174)) ([8a91cbd](https://github.com/typescript-eslint/typescript-eslint/commit/8a91cbd9fbe5bc4cf750cd949d2b8d48ff4c311d)) -## [5.38.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.0...v5.38.1) (2022-09-26) +## [5.45.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.45.0...v5.45.1) (2022-12-05) -**Note:** Version bump only for package @typescript-eslint/eslint-plugin +### Bug Fixes +- **eslint-plugin:** [keyword-spacing] unexpected space before/after in `import type` ([#6095](https://github.com/typescript-eslint/typescript-eslint/issues/6095)) ([98caa92](https://github.com/typescript-eslint/typescript-eslint/commit/98caa92ca89bdf0ca6ba6e4ff1f13c60221579e8)) +- **eslint-plugin:** [no-shadow] add call and method signatures to `ignoreFunctionTypeParameterNameValueShadow` ([#6129](https://github.com/typescript-eslint/typescript-eslint/issues/6129)) ([9d58b6b](https://github.com/typescript-eslint/typescript-eslint/commit/9d58b6be246507d20af67c84a5e9bb592d97cff5)) +- **eslint-plugin:** [prefer-optional-chain] collect MetaProperty type ([#6083](https://github.com/typescript-eslint/typescript-eslint/issues/6083)) ([d7114d3](https://github.com/typescript-eslint/typescript-eslint/commit/d7114d3ab09d1b93627d3b3dbb9862e37ee29c97)) +- **eslint-plugin:** [sort-type-constituents, sort-type-union-intersection-members] handle some required parentheses cases in the fixer ([#6118](https://github.com/typescript-eslint/typescript-eslint/issues/6118)) ([5d49d5d](https://github.com/typescript-eslint/typescript-eslint/commit/5d49d5dbee4425fc8bc01c5e748d161f3619477b)) +# [5.45.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.44.0...v5.45.0) (2022-11-28) +### Bug Fixes +- **eslint-plugin:** [array-type] --fix flag removes parentheses from type ([#5997](https://github.com/typescript-eslint/typescript-eslint/issues/5997)) ([42b33af](https://github.com/typescript-eslint/typescript-eslint/commit/42b33af256e5269feb214c7bb161079f770964fa)) +- **eslint-plugin:** [keyword-spacing] prevent crash on no options ([#6073](https://github.com/typescript-eslint/typescript-eslint/issues/6073)) ([1f19998](https://github.com/typescript-eslint/typescript-eslint/commit/1f19998e3ec6d592fc679a7490708e2e96816f4c)) +- **eslint-plugin:** [member-ordering] support private fields ([#5859](https://github.com/typescript-eslint/typescript-eslint/issues/5859)) ([f02761a](https://github.com/typescript-eslint/typescript-eslint/commit/f02761af19848a84b8d1832bd00fd6c95d38fa0c)) +- **eslint-plugin:** [prefer-readonly] report if a member's property is reassigned ([#6043](https://github.com/typescript-eslint/typescript-eslint/issues/6043)) ([6e079eb](https://github.com/typescript-eslint/typescript-eslint/commit/6e079eb35cfec79ba9965627477117f026d161ac)) -# [5.38.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.37.0...v5.38.0) (2022-09-19) +### Features -**Note:** Version bump only for package @typescript-eslint/eslint-plugin +- **eslint-plugin:** [member-ordering] add a required option for required vs. optional member ordering ([#5965](https://github.com/typescript-eslint/typescript-eslint/issues/5965)) ([2abadc6](https://github.com/typescript-eslint/typescript-eslint/commit/2abadc6c26cd6300764157d405a2462b754d050b)) +# [5.44.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.43.0...v5.44.0) (2022-11-21) +### Bug Fixes +- **eslint-plugin:** [no-empty-interface] disable autofix for declaration merging with class ([#5920](https://github.com/typescript-eslint/typescript-eslint/issues/5920)) ([a4f85b8](https://github.com/typescript-eslint/typescript-eslint/commit/a4f85b8cfe38ba8ea2a2ac4a56d9b11a81a8a15a)) +- **eslint-plugin:** [no-unnecessary-condition] handle index signature type ([#5912](https://github.com/typescript-eslint/typescript-eslint/issues/5912)) ([5baad08](https://github.com/typescript-eslint/typescript-eslint/commit/5baad0893f9a90633d57fffac69af7523bd1501e)) +- **eslint-plugin:** [prefer-optional-chain] handle binary expressions in negated or ([#5992](https://github.com/typescript-eslint/typescript-eslint/issues/5992)) ([2778ff0](https://github.com/typescript-eslint/typescript-eslint/commit/2778ff0c3db011148be93ed3bea5ce07af3c81ef)) +- **typescript-estree:** don't consider a cached program unless it's specified in the current `parserOptions.project` config ([#5999](https://github.com/typescript-eslint/typescript-eslint/issues/5999)) ([530e0e6](https://github.com/typescript-eslint/typescript-eslint/commit/530e0e618cdf4bb956149bf8a8484848e1b9a1f5)) +### Features -# [5.37.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.2...v5.37.0) (2022-09-12) +- **eslint-plugin:** [adjacent-overload-signatures] check BlockStatement nodes ([#5998](https://github.com/typescript-eslint/typescript-eslint/issues/5998)) ([97d3e56](https://github.com/typescript-eslint/typescript-eslint/commit/97d3e56709ee19fdec39fd8b99d080db90b306e9)) +- **eslint-plugin:** [keyword-spacing] Support spacing in import-type syntax ([#5977](https://github.com/typescript-eslint/typescript-eslint/issues/5977)) ([6a735e1](https://github.com/typescript-eslint/typescript-eslint/commit/6a735e142ef67f3af6497f922cf83706867eb6b7)) +# [5.43.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.1...v5.43.0) (2022-11-14) ### Bug Fixes -* **eslint-plugin:** [strict-boolean-expressions] check all conditions in a logical operator chain ([#5539](https://github.com/typescript-eslint/typescript-eslint/issues/5539)) ([77d76e2](https://github.com/typescript-eslint/typescript-eslint/commit/77d76e21cdc2e100c729c839c292e82ab7c554c5)) +- **eslint-plugin:** [no-shadow] handle false positives on generics and parameters ([#5902](https://github.com/typescript-eslint/typescript-eslint/issues/5902)) ([769e8c8](https://github.com/typescript-eslint/typescript-eslint/commit/769e8c8b9a51cd3448e47d13c7b0dab0468ee23c)) +- **eslint-plugin:** [promise-function-async] handle keyword token ([#5907](https://github.com/typescript-eslint/typescript-eslint/issues/5907)) ([f25a94f](https://github.com/typescript-eslint/typescript-eslint/commit/f25a94fa75e497a6b9ec29a008bcc89818eed60d)) +### Features +- **eslint-plugin:** [consistent-type-imports] support fixing to inline types ([#5050](https://github.com/typescript-eslint/typescript-eslint/issues/5050)) ([75dcdf1](https://github.com/typescript-eslint/typescript-eslint/commit/75dcdf164d206c5530ba7cc095c4599ec90abe35)) +- **eslint-plugin:** [naming-convention] add support for "override" and "async" modifiers ([#5310](https://github.com/typescript-eslint/typescript-eslint/issues/5310)) ([#5610](https://github.com/typescript-eslint/typescript-eslint/issues/5610)) ([c759da1](https://github.com/typescript-eslint/typescript-eslint/commit/c759da169390ba490eee9ef773cc9edc88a32817)) +- **eslint-plugin:** [prefer-optional-chain] support suggesting `!foo || !foo.bar` as a valid match for the rule ([#5594](https://github.com/typescript-eslint/typescript-eslint/issues/5594)) ([923d486](https://github.com/typescript-eslint/typescript-eslint/commit/923d486c8c9c9096deac425e7a6cb0b6457eacbd)) +## [5.42.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.0...v5.42.1) (2022-11-07) +### Bug Fixes -## [5.36.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.1...v5.36.2) (2022-09-05) +- **eslint-plugin:** isTypeReadonly stack overflow ([#5875](https://github.com/typescript-eslint/typescript-eslint/issues/5875)) ([#5876](https://github.com/typescript-eslint/typescript-eslint/issues/5876)) ([2d9a33c](https://github.com/typescript-eslint/typescript-eslint/commit/2d9a33cfb2db53d76246a59253daaf2abb19ee57)) +# [5.42.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.41.0...v5.42.0) (2022-10-31) ### Bug Fixes -* **eslint-plugin:** [no-extra-parens] handle generic ts array type. ([#5550](https://github.com/typescript-eslint/typescript-eslint/issues/5550)) ([0d6a190](https://github.com/typescript-eslint/typescript-eslint/commit/0d6a190c56fb3489f9f554b9035a008e29cc08ec)) -* **scope-manager:** correct handling for class static blocks ([#5580](https://github.com/typescript-eslint/typescript-eslint/issues/5580)) ([35bb8dd](https://github.com/typescript-eslint/typescript-eslint/commit/35bb8ddac1b46397f6447c1a6e1e4e1774dd7957)) - +- **ast-spec:** add TSQualifiedName to TypeNode union ([#5906](https://github.com/typescript-eslint/typescript-eslint/issues/5906)) ([5c316c1](https://github.com/typescript-eslint/typescript-eslint/commit/5c316c12f09d58aee6ee634a8055533f361f1589)) +- **eslint-plugin:** [no-extra-parens] handle type assertion in extends clause ([#5901](https://github.com/typescript-eslint/typescript-eslint/issues/5901)) ([8ed7219](https://github.com/typescript-eslint/typescript-eslint/commit/8ed72192c274249d26628fb125796e71318b857a)) +### Features +- **eslint-plugin:** [member-ordering] add natural sort order ([#5662](https://github.com/typescript-eslint/typescript-eslint/issues/5662)) ([1eaae09](https://github.com/typescript-eslint/typescript-eslint/commit/1eaae09ecca359f366b94f6a04665403f48b05c7)) +- **eslint-plugin:** [no-invalid-void-type] better report message for void used as a constituent inside a function return type ([#5274](https://github.com/typescript-eslint/typescript-eslint/issues/5274)) ([d806bda](https://github.com/typescript-eslint/typescript-eslint/commit/d806bda82343712a24e3c78b9b34d4345dd1de3b)) +# [5.41.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.1...v5.41.0) (2022-10-24) -## [5.36.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.0...v5.36.1) (2022-08-30) +### Bug Fixes -**Note:** Version bump only for package @typescript-eslint/eslint-plugin +- **eslint-plugin:** [no-base-to-string] ignore Error, URL, and URLSearchParams by default ([#5839](https://github.com/typescript-eslint/typescript-eslint/issues/5839)) ([96e1c6c](https://github.com/typescript-eslint/typescript-eslint/commit/96e1c6c171a34b0793c50c3dba853c3999a6bd49)) +- **type-utils:** prevent stack overflow in `isTypeReadonly` ([#5860](https://github.com/typescript-eslint/typescript-eslint/issues/5860)) ([a6d8f7e](https://github.com/typescript-eslint/typescript-eslint/commit/a6d8f7edb84f9f6dd59a76faf53bf686756e2aed)), closes [#4476](https://github.com/typescript-eslint/typescript-eslint/issues/4476) +### Features +- **eslint-plugin:** [no-unsafe-declaration-merging] switch to use scope analysis instead of type information ([#5865](https://github.com/typescript-eslint/typescript-eslint/issues/5865)) ([e70a10a](https://github.com/typescript-eslint/typescript-eslint/commit/e70a10aea684bc6bca05b69bfce3bae769a5f5ab)) +- **eslint-plugin:** add no-unsafe-declaration-merging ([#5840](https://github.com/typescript-eslint/typescript-eslint/issues/5840)) ([3728031](https://github.com/typescript-eslint/typescript-eslint/commit/3728031c659dabde7658cd54184951d4be9aabcb)) +## [5.40.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.0...v5.40.1) (2022-10-17) +### Bug Fixes -# [5.36.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.1...v5.36.0) (2022-08-30) +- **eslint-plugin:** Skip missing 'rest' tuple type arguments in no-misused-promises ([#5809](https://github.com/typescript-eslint/typescript-eslint/issues/5809)) ([c5beaa2](https://github.com/typescript-eslint/typescript-eslint/commit/c5beaa2ea340985211ca5c12821842c54f5170f0)), closes [#5807](https://github.com/typescript-eslint/typescript-eslint/issues/5807) +# [5.40.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.39.0...v5.40.0) (2022-10-10) ### Bug Fixes -* **eslint-plugin:** revert [#5266](https://github.com/typescript-eslint/typescript-eslint/issues/5266) ([#5564](https://github.com/typescript-eslint/typescript-eslint/issues/5564)) ([7a8afe2](https://github.com/typescript-eslint/typescript-eslint/commit/7a8afe29039c6c80fe584acaf5d933424a4452a9)) - +- **eslint-plugin:** [consistent-indexed-object-style] handle interface generic ([#5746](https://github.com/typescript-eslint/typescript-eslint/issues/5746)) ([7a8a0a3](https://github.com/typescript-eslint/typescript-eslint/commit/7a8a0a3c500ca726d2ab3bee0ae9f3fb9d8d39b8)) +- **eslint-plugin:** [no-unnecessary-condition] handle void ([#5766](https://github.com/typescript-eslint/typescript-eslint/issues/5766)) ([ac8f06b](https://github.com/typescript-eslint/typescript-eslint/commit/ac8f06b68dca7666bfb78fb38d6ccc07f676e435)) ### Features -* support TypeScript 4.8 ([#5551](https://github.com/typescript-eslint/typescript-eslint/issues/5551)) ([81450ed](https://github.com/typescript-eslint/typescript-eslint/commit/81450ed7eaede74b384e9a91a84e9b4d34513866)) - +- **eslint-plugin:** Check 'rest' parameters in no-misused-promises ([#5731](https://github.com/typescript-eslint/typescript-eslint/issues/5731)) ([6477f38](https://github.com/typescript-eslint/typescript-eslint/commit/6477f3855627cc257edc021b859711d4a5847a12)), closes [#4015](https://github.com/typescript-eslint/typescript-eslint/issues/4015) +- **utils:** add dependency constraint filtering for `RuleTester` ([#5750](https://github.com/typescript-eslint/typescript-eslint/issues/5750)) ([121f4c0](https://github.com/typescript-eslint/typescript-eslint/commit/121f4c0e7252def95d917e4734e933e53e29d501)) +# [5.39.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.1...v5.39.0) (2022-10-03) +### Features +- **eslint-plugin:** allow using void as a default type for a generic argument if allowInGenericTypeArguments is specified ([#5671](https://github.com/typescript-eslint/typescript-eslint/issues/5671)) ([bb46ef0](https://github.com/typescript-eslint/typescript-eslint/commit/bb46ef0817fe03ef71f8e0f3df0cf96bc355e068)) -## [5.35.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.0...v5.35.1) (2022-08-24) +## [5.38.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.0...v5.38.1) (2022-09-26) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin -### Bug Fixes +# [5.38.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.37.0...v5.38.0) (2022-09-19) -* **eslint-plugin:** correct rule schemas to pass ajv validation ([#5531](https://github.com/typescript-eslint/typescript-eslint/issues/5531)) ([dbf8b56](https://github.com/typescript-eslint/typescript-eslint/commit/dbf8b569dbada29e4a295d6c265976e55de1b2aa)) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin +# [5.37.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.2...v5.37.0) (2022-09-12) +### Bug Fixes +- **eslint-plugin:** [strict-boolean-expressions] check all conditions in a logical operator chain ([#5539](https://github.com/typescript-eslint/typescript-eslint/issues/5539)) ([77d76e2](https://github.com/typescript-eslint/typescript-eslint/commit/77d76e21cdc2e100c729c839c292e82ab7c554c5)) +## [5.36.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.1...v5.36.2) (2022-09-05) -# [5.35.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.34.0...v5.35.0) (2022-08-24) +### Bug Fixes +- **eslint-plugin:** [no-extra-parens] handle generic ts array type. ([#5550](https://github.com/typescript-eslint/typescript-eslint/issues/5550)) ([0d6a190](https://github.com/typescript-eslint/typescript-eslint/commit/0d6a190c56fb3489f9f554b9035a008e29cc08ec)) +- **scope-manager:** correct handling for class static blocks ([#5580](https://github.com/typescript-eslint/typescript-eslint/issues/5580)) ([35bb8dd](https://github.com/typescript-eslint/typescript-eslint/commit/35bb8ddac1b46397f6447c1a6e1e4e1774dd7957)) -### Features +## [5.36.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.0...v5.36.1) (2022-08-30) -* **eslint-plugin:** [explicit-member-accessibility] suggest adding explicit accessibility specifiers ([#5492](https://github.com/typescript-eslint/typescript-eslint/issues/5492)) ([0edb94a](https://github.com/typescript-eslint/typescript-eslint/commit/0edb94aee55e1ec6afa7f46f99a9b308bbb66301)) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin +# [5.36.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.1...v5.36.0) (2022-08-30) +### Bug Fixes +- **eslint-plugin:** revert [#5266](https://github.com/typescript-eslint/typescript-eslint/issues/5266) ([#5564](https://github.com/typescript-eslint/typescript-eslint/issues/5564)) ([7a8afe2](https://github.com/typescript-eslint/typescript-eslint/commit/7a8afe29039c6c80fe584acaf5d933424a4452a9)) +### Features -# [5.34.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.1...v5.34.0) (2022-08-22) +- support TypeScript 4.8 ([#5551](https://github.com/typescript-eslint/typescript-eslint/issues/5551)) ([81450ed](https://github.com/typescript-eslint/typescript-eslint/commit/81450ed7eaede74b384e9a91a84e9b4d34513866)) +## [5.35.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.0...v5.35.1) (2022-08-24) ### Bug Fixes -* **eslint-plugin:** [no-useless-constructor] handle parameter decorator ([#5450](https://github.com/typescript-eslint/typescript-eslint/issues/5450)) ([864dbcf](https://github.com/typescript-eslint/typescript-eslint/commit/864dbcfccba274fe1b26eac8aeeaf2a2355b5969)) +- **eslint-plugin:** correct rule schemas to pass ajv validation ([#5531](https://github.com/typescript-eslint/typescript-eslint/issues/5531)) ([dbf8b56](https://github.com/typescript-eslint/typescript-eslint/commit/dbf8b569dbada29e4a295d6c265976e55de1b2aa)) +# [5.35.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.34.0...v5.35.0) (2022-08-24) ### Features -* **eslint-plugin:** [prefer-optional-chain] support suggesting `!foo || !foo.bar` as a valid match for the rule ([#5266](https://github.com/typescript-eslint/typescript-eslint/issues/5266)) ([aca935c](https://github.com/typescript-eslint/typescript-eslint/commit/aca935c9696712d4aff18144c4690db4d6ba9bf9)) +- **eslint-plugin:** [explicit-member-accessibility] suggest adding explicit accessibility specifiers ([#5492](https://github.com/typescript-eslint/typescript-eslint/issues/5492)) ([0edb94a](https://github.com/typescript-eslint/typescript-eslint/commit/0edb94aee55e1ec6afa7f46f99a9b308bbb66301)) + +# [5.34.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.1...v5.34.0) (2022-08-22) +### Bug Fixes +- **eslint-plugin:** [no-useless-constructor] handle parameter decorator ([#5450](https://github.com/typescript-eslint/typescript-eslint/issues/5450)) ([864dbcf](https://github.com/typescript-eslint/typescript-eslint/commit/864dbcfccba274fe1b26eac8aeeaf2a2355b5969)) +### Features +- **eslint-plugin:** [prefer-optional-chain] support suggesting `!foo || !foo.bar` as a valid match for the rule ([#5266](https://github.com/typescript-eslint/typescript-eslint/issues/5266)) ([aca935c](https://github.com/typescript-eslint/typescript-eslint/commit/aca935c9696712d4aff18144c4690db4d6ba9bf9)) ## [5.33.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.0...v5.33.1) (2022-08-15) - ### Bug Fixes -* missing placeholders in violation messages for `no-unnecessary-type-constraint` and `no-unsafe-argument` (and enable `eslint-plugin/recommended` rules internally) ([#5453](https://github.com/typescript-eslint/typescript-eslint/issues/5453)) ([d023910](https://github.com/typescript-eslint/typescript-eslint/commit/d0239104f4dbffd2b5ecdb19e520c7d4b71962e0)) - - - - +- missing placeholders in violation messages for `no-unnecessary-type-constraint` and `no-unsafe-argument` (and enable `eslint-plugin/recommended` rules internally) ([#5453](https://github.com/typescript-eslint/typescript-eslint/issues/5453)) ([d023910](https://github.com/typescript-eslint/typescript-eslint/commit/d0239104f4dbffd2b5ecdb19e520c7d4b71962e0)) # [5.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.32.0...v5.33.0) (2022-08-08) - ### Bug Fixes -* **eslint-plugin:** [no-extra-parens] handle await with type assertion ([#5428](https://github.com/typescript-eslint/typescript-eslint/issues/5428)) ([e03826f](https://github.com/typescript-eslint/typescript-eslint/commit/e03826f08ce8bfdd6d6702025d975cfb7d867097)) -* **website:** add explicit frontmatter description to rule docs ([#5429](https://github.com/typescript-eslint/typescript-eslint/issues/5429)) ([63cba5f](https://github.com/typescript-eslint/typescript-eslint/commit/63cba5f4c1884e102927b3b14b18a00e96ac63a1)) - +- **eslint-plugin:** [no-extra-parens] handle await with type assertion ([#5428](https://github.com/typescript-eslint/typescript-eslint/issues/5428)) ([e03826f](https://github.com/typescript-eslint/typescript-eslint/commit/e03826f08ce8bfdd6d6702025d975cfb7d867097)) +- **website:** add explicit frontmatter description to rule docs ([#5429](https://github.com/typescript-eslint/typescript-eslint/issues/5429)) ([63cba5f](https://github.com/typescript-eslint/typescript-eslint/commit/63cba5f4c1884e102927b3b14b18a00e96ac63a1)) ### Features -* **eslint-plugin:** [member-ordering] support static blocks ([#5417](https://github.com/typescript-eslint/typescript-eslint/issues/5417)) ([5983e5a](https://github.com/typescript-eslint/typescript-eslint/commit/5983e5ab3bfb94fec782bea54a37457fe31db545)) -* **eslint-plugin:** [prefer-as-const] adds support for class properties ([#5413](https://github.com/typescript-eslint/typescript-eslint/issues/5413)) ([d2394f8](https://github.com/typescript-eslint/typescript-eslint/commit/d2394f810960fda07b9c8affd47b769d16f4b8cb)) - - - - +- **eslint-plugin:** [member-ordering] support static blocks ([#5417](https://github.com/typescript-eslint/typescript-eslint/issues/5417)) ([5983e5a](https://github.com/typescript-eslint/typescript-eslint/commit/5983e5ab3bfb94fec782bea54a37457fe31db545)) +- **eslint-plugin:** [prefer-as-const] adds support for class properties ([#5413](https://github.com/typescript-eslint/typescript-eslint/issues/5413)) ([d2394f8](https://github.com/typescript-eslint/typescript-eslint/commit/d2394f810960fda07b9c8affd47b769d16f4b8cb)) # [5.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.31.0...v5.32.0) (2022-08-01) - ### Features -* **eslint-plugin:** [no-use-before-define] add "allowNamedExports" option ([#5397](https://github.com/typescript-eslint/typescript-eslint/issues/5397)) ([ad412cd](https://github.com/typescript-eslint/typescript-eslint/commit/ad412cdd74dc5619fbe4bf27c0a5eb5c5a4b65ca)) - - - - +- **eslint-plugin:** [no-use-before-define] add "allowNamedExports" option ([#5397](https://github.com/typescript-eslint/typescript-eslint/issues/5397)) ([ad412cd](https://github.com/typescript-eslint/typescript-eslint/commit/ad412cdd74dc5619fbe4bf27c0a5eb5c5a4b65ca)) # [5.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.7...v5.31.0) (2022-07-25) - ### Bug Fixes -* **eslint-plugin:** [typedef] Support nested array destructuring with type annotation ([#5311](https://github.com/typescript-eslint/typescript-eslint/issues/5311)) ([6d19efe](https://github.com/typescript-eslint/typescript-eslint/commit/6d19efed16d1cf0357ad363b6373d2021c49a8c8)) -* **scope-manager:** handle typeParameters of TSInstantiationExpression ([#5355](https://github.com/typescript-eslint/typescript-eslint/issues/5355)) ([2595ccf](https://github.com/typescript-eslint/typescript-eslint/commit/2595ccf67cd5158edbd6bebd9ac2dbd8bbd8b99c)) - +- **eslint-plugin:** [typedef] Support nested array destructuring with type annotation ([#5311](https://github.com/typescript-eslint/typescript-eslint/issues/5311)) ([6d19efe](https://github.com/typescript-eslint/typescript-eslint/commit/6d19efed16d1cf0357ad363b6373d2021c49a8c8)) +- **scope-manager:** handle typeParameters of TSInstantiationExpression ([#5355](https://github.com/typescript-eslint/typescript-eslint/issues/5355)) ([2595ccf](https://github.com/typescript-eslint/typescript-eslint/commit/2595ccf67cd5158edbd6bebd9ac2dbd8bbd8b99c)) ### Features -* **eslint-plugin:** [consistent-generic-ctors] check class field declaration ([#5288](https://github.com/typescript-eslint/typescript-eslint/issues/5288)) ([48f996e](https://github.com/typescript-eslint/typescript-eslint/commit/48f996e8dda79c9c865e8ca6552069902836648b)) -* **eslint-plugin:** [prefer-nullish-coalescing] add ignoreTernaryTests option ([#4965](https://github.com/typescript-eslint/typescript-eslint/issues/4965)) ([f82727f](https://github.com/typescript-eslint/typescript-eslint/commit/f82727ffeb97475c07773ca1d1e5b9609fcc5e68)) - - - - +- **eslint-plugin:** [consistent-generic-ctors] check class field declaration ([#5288](https://github.com/typescript-eslint/typescript-eslint/issues/5288)) ([48f996e](https://github.com/typescript-eslint/typescript-eslint/commit/48f996e8dda79c9c865e8ca6552069902836648b)) +- **eslint-plugin:** [prefer-nullish-coalescing] add ignoreTernaryTests option ([#4965](https://github.com/typescript-eslint/typescript-eslint/issues/4965)) ([f82727f](https://github.com/typescript-eslint/typescript-eslint/commit/f82727ffeb97475c07773ca1d1e5b9609fcc5e68)) ## [5.30.7](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.6...v5.30.7) (2022-07-18) - ### Bug Fixes -* **eslint-plugin:** [no-inferrable] fix optional param to valid code ([#5342](https://github.com/typescript-eslint/typescript-eslint/issues/5342)) ([98f6d5e](https://github.com/typescript-eslint/typescript-eslint/commit/98f6d5e6d08d1eb9789da52a15f337f5f53438bd)) -* **eslint-plugin:** [no-unused-vars] highlight last write reference ([#5267](https://github.com/typescript-eslint/typescript-eslint/issues/5267)) ([c3f199a](https://github.com/typescript-eslint/typescript-eslint/commit/c3f199a65a16aa72f5bb83e81a1ce0ffb5f69772)) - - - - +- **eslint-plugin:** [no-inferrable] fix optional param to valid code ([#5342](https://github.com/typescript-eslint/typescript-eslint/issues/5342)) ([98f6d5e](https://github.com/typescript-eslint/typescript-eslint/commit/98f6d5e6d08d1eb9789da52a15f337f5f53438bd)) +- **eslint-plugin:** [no-unused-vars] highlight last write reference ([#5267](https://github.com/typescript-eslint/typescript-eslint/issues/5267)) ([c3f199a](https://github.com/typescript-eslint/typescript-eslint/commit/c3f199a65a16aa72f5bb83e81a1ce0ffb5f69772)) ## [5.30.6](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.5...v5.30.6) (2022-07-11) **Note:** Version bump only for package @typescript-eslint/eslint-plugin - - - - ## [5.30.5](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.4...v5.30.5) (2022-07-04) - ### Bug Fixes -* **eslint-plugin:** [consistent-indexed-object-style] fix record mode fixer for generics with a default value ([#5280](https://github.com/typescript-eslint/typescript-eslint/issues/5280)) ([57f032c](https://github.com/typescript-eslint/typescript-eslint/commit/57f032c2e6a822c049177713778d0077ee138d9a)) - - - - +- **eslint-plugin:** [consistent-indexed-object-style] fix record mode fixer for generics with a default value ([#5280](https://github.com/typescript-eslint/typescript-eslint/issues/5280)) ([57f032c](https://github.com/typescript-eslint/typescript-eslint/commit/57f032c2e6a822c049177713778d0077ee138d9a)) ## [5.30.4](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.3...v5.30.4) (2022-07-03) **Note:** Version bump only for package @typescript-eslint/eslint-plugin - - - - ## [5.30.3](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.2...v5.30.3) (2022-07-01) **Note:** Version bump only for package @typescript-eslint/eslint-plugin - - - - ## [5.30.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.1...v5.30.2) (2022-07-01) **Note:** Version bump only for package @typescript-eslint/eslint-plugin - - - - ## [5.30.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.0...v5.30.1) (2022-07-01) - ### Bug Fixes -* **eslint-plugin:** [no-base-to-string] add missing apostrophe to message ([#5270](https://github.com/typescript-eslint/typescript-eslint/issues/5270)) ([d320174](https://github.com/typescript-eslint/typescript-eslint/commit/58034e343a167ca7751b54d2b2a0e7d3852aabec)) - - - - +- **eslint-plugin:** [no-base-to-string] add missing apostrophe to message ([#5270](https://github.com/typescript-eslint/typescript-eslint/issues/5270)) ([d320174](https://github.com/typescript-eslint/typescript-eslint/commit/58034e343a167ca7751b54d2b2a0e7d3852aabec)) # [5.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.29.0...v5.30.0) (2022-06-27) - ### Features -* **eslint-plugin:** [no-shadow] add shadowed variable location to the error message ([#5183](https://github.com/typescript-eslint/typescript-eslint/issues/5183)) ([8ca08e9](https://github.com/typescript-eslint/typescript-eslint/commit/8ca08e9f18d59b29715c667fbb7d237f6e9a96ba)) -* treat `this` in `typeof this` as a `ThisExpression` ([#4382](https://github.com/typescript-eslint/typescript-eslint/issues/4382)) ([b04b2ce](https://github.com/typescript-eslint/typescript-eslint/commit/b04b2ce1ba90d94718891f2562dd210a6d7b8609)) - - - - +- **eslint-plugin:** [no-shadow] add shadowed variable location to the error message ([#5183](https://github.com/typescript-eslint/typescript-eslint/issues/5183)) ([8ca08e9](https://github.com/typescript-eslint/typescript-eslint/commit/8ca08e9f18d59b29715c667fbb7d237f6e9a96ba)) +- treat `this` in `typeof this` as a `ThisExpression` ([#4382](https://github.com/typescript-eslint/typescript-eslint/issues/4382)) ([b04b2ce](https://github.com/typescript-eslint/typescript-eslint/commit/b04b2ce1ba90d94718891f2562dd210a6d7b8609)) # [5.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.28.0...v5.29.0) (2022-06-20) **Note:** Version bump only for package @typescript-eslint/eslint-plugin - - - - # [5.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.1...v5.28.0) (2022-06-13) - ### Bug Fixes -* [TS4.7] allow visiting of typeParameters in TSTypeQuery ([#5166](https://github.com/typescript-eslint/typescript-eslint/issues/5166)) ([dc1f930](https://github.com/typescript-eslint/typescript-eslint/commit/dc1f9309cf04aa7314e758980ac687558482f47f)) -* **eslint-plugin:** [space-infix-ops] support for optional property without type ([#5155](https://github.com/typescript-eslint/typescript-eslint/issues/5155)) ([1f25daf](https://github.com/typescript-eslint/typescript-eslint/commit/1f25daf74e5d45077199f9ee9fa9bf31107f4089)) - +- [TS4.7] allow visiting of typeParameters in TSTypeQuery ([#5166](https://github.com/typescript-eslint/typescript-eslint/issues/5166)) ([dc1f930](https://github.com/typescript-eslint/typescript-eslint/commit/dc1f9309cf04aa7314e758980ac687558482f47f)) +- **eslint-plugin:** [space-infix-ops] support for optional property without type ([#5155](https://github.com/typescript-eslint/typescript-eslint/issues/5155)) ([1f25daf](https://github.com/typescript-eslint/typescript-eslint/commit/1f25daf74e5d45077199f9ee9fa9bf31107f4089)) ### Features -* **eslint-plugin:** [consistent-generic-constructors] add rule ([#4924](https://github.com/typescript-eslint/typescript-eslint/issues/4924)) ([921cdf1](https://github.com/typescript-eslint/typescript-eslint/commit/921cdf17e548845311d0591249616ec844503926)) - - +- **eslint-plugin:** [consistent-generic-constructors] add rule ([#4924](https://github.com/typescript-eslint/typescript-eslint/issues/4924)) ([921cdf1](https://github.com/typescript-eslint/typescript-eslint/commit/921cdf17e548845311d0591249616ec844503926)) +## [5.27.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.0...v5.27.1) (2022-06-06) +### Bug Fixes -## [5.27.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.0...v5.27.1) (2022-06-06) +- **eslint-plugin:** [space-infix-ops] correct PropertyDefinition with typeAnnotation ([#5113](https://github.com/typescript-eslint/typescript-eslint/issues/5113)) ([d320174](https://github.com/typescript-eslint/typescript-eslint/commit/d320174f40a74b34e6b6e4c88128ef6e736311d8)) +- **eslint-plugin:** [space-infix-ops] regression fix for conditional types ([#5135](https://github.com/typescript-eslint/typescript-eslint/issues/5135)) ([e5238c8](https://github.com/typescript-eslint/typescript-eslint/commit/e5238c84e56e7c34174b2c6f1e3ea59456797c2f)) +- **eslint-plugin:** [space-infix-ops] regression fix for type aliases ([#5138](https://github.com/typescript-eslint/typescript-eslint/issues/5138)) ([4e13deb](https://github.com/typescript-eslint/typescript-eslint/commit/4e13deb05fbd8724996156b15b65f6a66794a7cc)) +# [5.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.26.0...v5.27.0) (2022-05-30) ### Bug Fixes -* **eslint-plugin:** [space-infix-ops] correct PropertyDefinition with typeAnnotation ([#5113](https://github.com/typescript-eslint/typescript-eslint/issues/5113)) ([d320174](https://github.com/typescript-eslint/typescript-eslint/commit/d320174f40a74b34e6b6e4c88128ef6e736311d8)) -* **eslint-plugin:** [space-infix-ops] regression fix for conditional types ([#5135](https://github.com/typescript-eslint/typescript-eslint/issues/5135)) ([e5238c8](https://github.com/typescript-eslint/typescript-eslint/commit/e5238c84e56e7c34174b2c6f1e3ea59456797c2f)) -* **eslint-plugin:** [space-infix-ops] regression fix for type aliases ([#5138](https://github.com/typescript-eslint/typescript-eslint/issues/5138)) ([4e13deb](https://github.com/typescript-eslint/typescript-eslint/commit/4e13deb05fbd8724996156b15b65f6a66794a7cc)) +- **eslint-plugin:** [no-type-alias] handle Template Literal Types ([#5092](https://github.com/typescript-eslint/typescript-eslint/issues/5092)) ([8febf11](https://github.com/typescript-eslint/typescript-eslint/commit/8febf11a9296d1c0d7ccdf91ef9ab92ec8dfc39c)) +### Features +- [4.7] support new extensions ([#5027](https://github.com/typescript-eslint/typescript-eslint/issues/5027)) ([efc147b](https://github.com/typescript-eslint/typescript-eslint/commit/efc147b04dce52ab17415b6a4ae4076b944b9036)) +- **eslint-plugin:** [ban-ts-comment] add descriptionFormat option ([#5026](https://github.com/typescript-eslint/typescript-eslint/issues/5026)) ([1fb31a4](https://github.com/typescript-eslint/typescript-eslint/commit/1fb31a4b3e05734f801ade0450fea33494e4d5e6)) +- **eslint-plugin:** [no-misused-promises] warn when spreading promises ([#5053](https://github.com/typescript-eslint/typescript-eslint/issues/5053)) ([61ffa9e](https://github.com/typescript-eslint/typescript-eslint/commit/61ffa9ed70e3cac6eca50a6c3cc5a0f1e7dec11c)) +- **eslint-plugin:** [space-infix-ops] missing error report for conditional types ([#5041](https://github.com/typescript-eslint/typescript-eslint/issues/5041)) ([0bfab6c](https://github.com/typescript-eslint/typescript-eslint/commit/0bfab6c9f5c5e243268200cf9368acf39ea099f8)) +# [5.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.25.0...v5.26.0) (2022-05-23) +### Bug Fixes -# [5.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.26.0...v5.27.0) (2022-05-30) +- **eslint-plugin:** [member-delimiter-style] autofixer result is not as expected when comments after the delimiter with option `delimiter: 'none'` ([#5029](https://github.com/typescript-eslint/typescript-eslint/issues/5029)) ([ed7b5f6](https://github.com/typescript-eslint/typescript-eslint/commit/ed7b5f61d93799fec3e38a87935ab9caa3abe279)) +- **eslint-plugin:** [member-delimiter-style] autofixer result is not as expected with option `delimiter: 'none'` ([#5023](https://github.com/typescript-eslint/typescript-eslint/issues/5023)) ([9e97a11](https://github.com/typescript-eslint/typescript-eslint/commit/9e97a11ecd80be5c63c980bfe8d8e57400221cec)) +- **eslint-plugin:** [prefer-readonly] correct issue with anonymus functions ([#4974](https://github.com/typescript-eslint/typescript-eslint/issues/4974)) ([952e2f0](https://github.com/typescript-eslint/typescript-eslint/commit/952e2f068862dde089ec03d3eb5452d1ee3e9271)), closes [#2590](https://github.com/typescript-eslint/typescript-eslint/issues/2590) +# [5.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.24.0...v5.25.0) (2022-05-17) ### Bug Fixes -* **eslint-plugin:** [no-type-alias] handle Template Literal Types ([#5092](https://github.com/typescript-eslint/typescript-eslint/issues/5092)) ([8febf11](https://github.com/typescript-eslint/typescript-eslint/commit/8febf11a9296d1c0d7ccdf91ef9ab92ec8dfc39c)) - +- **eslint-plugin:** [typedef] stop enforcing rule for assignment expressions ([#4958](https://github.com/typescript-eslint/typescript-eslint/issues/4958)) ([04a216c](https://github.com/typescript-eslint/typescript-eslint/commit/04a216c39c02085fe5d555ce81bdced0e563a7c4)) +- **eslint-plugin:** strict config should not extend recommended ([#5005](https://github.com/typescript-eslint/typescript-eslint/issues/5005)) ([05d71c2](https://github.com/typescript-eslint/typescript-eslint/commit/05d71c2ebd8e072aa4e8ee3ea8521de00e47d4ca)) +- **website:** correct Presets link to be Configs ([#5004](https://github.com/typescript-eslint/typescript-eslint/issues/5004)) ([e18e91c](https://github.com/typescript-eslint/typescript-eslint/commit/e18e91c6cfb1ee93bfff3770ea4d8f807d5ced0b)) ### Features -* [4.7] support new extensions ([#5027](https://github.com/typescript-eslint/typescript-eslint/issues/5027)) ([efc147b](https://github.com/typescript-eslint/typescript-eslint/commit/efc147b04dce52ab17415b6a4ae4076b944b9036)) -* **eslint-plugin:** [ban-ts-comment] add descriptionFormat option ([#5026](https://github.com/typescript-eslint/typescript-eslint/issues/5026)) ([1fb31a4](https://github.com/typescript-eslint/typescript-eslint/commit/1fb31a4b3e05734f801ade0450fea33494e4d5e6)) -* **eslint-plugin:** [no-misused-promises] warn when spreading promises ([#5053](https://github.com/typescript-eslint/typescript-eslint/issues/5053)) ([61ffa9e](https://github.com/typescript-eslint/typescript-eslint/commit/61ffa9ed70e3cac6eca50a6c3cc5a0f1e7dec11c)) -* **eslint-plugin:** [space-infix-ops] missing error report for conditional types ([#5041](https://github.com/typescript-eslint/typescript-eslint/issues/5041)) ([0bfab6c](https://github.com/typescript-eslint/typescript-eslint/commit/0bfab6c9f5c5e243268200cf9368acf39ea099f8)) +- **eslint-plugin:** [no-empty-function] new allow option overrideMethods ([#4923](https://github.com/typescript-eslint/typescript-eslint/issues/4923)) ([13c05ae](https://github.com/typescript-eslint/typescript-eslint/commit/13c05aefb0e6531d320629e04b7207a3baebacb0)) +- **eslint-plugin:** deprecate `no-duplicate-imports` in favour of `import/no-duplicates` ([#4973](https://github.com/typescript-eslint/typescript-eslint/issues/4973)) ([1d2e41a](https://github.com/typescript-eslint/typescript-eslint/commit/1d2e41ada1979c081130d19b229c82bf1a69b7b4)) +- update to TypeScript 4.7-rc ([#4829](https://github.com/typescript-eslint/typescript-eslint/issues/4829)) ([6fe783c](https://github.com/typescript-eslint/typescript-eslint/commit/6fe783c20aebe26ef42b526e4a59a9be84dd5643)) +# [5.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.23.0...v5.24.0) (2022-05-16) +### Bug Fixes +- **eslint-plugin:** [array-type] in fixer add missing parens for constructor types [#4756](https://github.com/typescript-eslint/typescript-eslint/issues/4756) ([#4971](https://github.com/typescript-eslint/typescript-eslint/issues/4971)) ([0377070](https://github.com/typescript-eslint/typescript-eslint/commit/03770708900da663eb64c19465b3f937bab55b3d)) +### Features -# [5.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.25.0...v5.26.0) (2022-05-23) +- **eslint-plugin:** Add BigInt object type to default ban-types list ([#4970](https://github.com/typescript-eslint/typescript-eslint/issues/4970)) ([1867728](https://github.com/typescript-eslint/typescript-eslint/commit/1867728ba104a6a21941ed300828110964a43b96)) +- **eslint-plugin:** add new 'strict' config ([#4706](https://github.com/typescript-eslint/typescript-eslint/issues/4706)) ([4a500b2](https://github.com/typescript-eslint/typescript-eslint/commit/4a500b2d92a91873dbb729793d1ee1c36ef06ed8)) +# [5.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.22.0...v5.23.0) (2022-05-09) ### Bug Fixes -* **eslint-plugin:** [member-delimiter-style] autofixer result is not as expected when comments after the delimiter with option `delimiter: 'none'` ([#5029](https://github.com/typescript-eslint/typescript-eslint/issues/5029)) ([ed7b5f6](https://github.com/typescript-eslint/typescript-eslint/commit/ed7b5f61d93799fec3e38a87935ab9caa3abe279)) -* **eslint-plugin:** [member-delimiter-style] autofixer result is not as expected with option `delimiter: 'none'` ([#5023](https://github.com/typescript-eslint/typescript-eslint/issues/5023)) ([9e97a11](https://github.com/typescript-eslint/typescript-eslint/commit/9e97a11ecd80be5c63c980bfe8d8e57400221cec)) -* **eslint-plugin:** [prefer-readonly] correct issue with anonymus functions ([#4974](https://github.com/typescript-eslint/typescript-eslint/issues/4974)) ([952e2f0](https://github.com/typescript-eslint/typescript-eslint/commit/952e2f068862dde089ec03d3eb5452d1ee3e9271)), closes [#2590](https://github.com/typescript-eslint/typescript-eslint/issues/2590) +- **eslint-plugin:** [no-restricted-imports] allow type import as long as there's one matching pattern ([#4898](https://github.com/typescript-eslint/typescript-eslint/issues/4898)) ([0419d28](https://github.com/typescript-eslint/typescript-eslint/commit/0419d287b637e805c33036a45760badc2498e19b)) +- **eslint-plugin:** [no-unnecessary-type-constraint] change to suggestion fix, fix multiple trailing comma failures ([#4901](https://github.com/typescript-eslint/typescript-eslint/issues/4901)) ([4507ac8](https://github.com/typescript-eslint/typescript-eslint/commit/4507ac84c76da0ced43b6679305afe1891e7afca)) +# [5.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.21.0...v5.22.0) (2022-05-02) +### Bug Fixes +- **eslint-plugin:** [comma-spacing] verify `nextToken` exists ([#4868](https://github.com/typescript-eslint/typescript-eslint/issues/4868)) ([23746f8](https://github.com/typescript-eslint/typescript-eslint/commit/23746f8babace7c2354368d6fb0881be26e19c41)) +### Features -# [5.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.24.0...v5.25.0) (2022-05-17) +- **eslint-plugin:** [no-duplicate-enum-values] add rule ([#4833](https://github.com/typescript-eslint/typescript-eslint/issues/4833)) ([5899164](https://github.com/typescript-eslint/typescript-eslint/commit/5899164b35d91106512a2720b23ba92e1893132f)) +# [5.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.20.0...v5.21.0) (2022-04-25) ### Bug Fixes -* **eslint-plugin:** [typedef] stop enforcing rule for assignment expressions ([#4958](https://github.com/typescript-eslint/typescript-eslint/issues/4958)) ([04a216c](https://github.com/typescript-eslint/typescript-eslint/commit/04a216c39c02085fe5d555ce81bdced0e563a7c4)) -* **eslint-plugin:** strict config should not extend recommended ([#5005](https://github.com/typescript-eslint/typescript-eslint/issues/5005)) ([05d71c2](https://github.com/typescript-eslint/typescript-eslint/commit/05d71c2ebd8e072aa4e8ee3ea8521de00e47d4ca)) -* **website:** correct Presets link to be Configs ([#5004](https://github.com/typescript-eslint/typescript-eslint/issues/5004)) ([e18e91c](https://github.com/typescript-eslint/typescript-eslint/commit/e18e91c6cfb1ee93bfff3770ea4d8f807d5ced0b)) - +- **eslint-plugin:** [no-misused-promises] prioritize false returns when checking whether a function returns only void ([#4841](https://github.com/typescript-eslint/typescript-eslint/issues/4841)) ([ccadb60](https://github.com/typescript-eslint/typescript-eslint/commit/ccadb6075d6977c4921ffc09fa40f515f4d497c5)) +- **eslint-plugin:** [no-namespace] fix false positive for exported namespaces when allowDeclarations=true ([#4844](https://github.com/typescript-eslint/typescript-eslint/issues/4844)) ([4e7c9be](https://github.com/typescript-eslint/typescript-eslint/commit/4e7c9be6ff7e2448f4151563d7921cd285c2e349)) +- **eslint-plugin:** [space-infix-ops] fix no error when right type is function ([#4848](https://github.com/typescript-eslint/typescript-eslint/issues/4848)) ([d74d559](https://github.com/typescript-eslint/typescript-eslint/commit/d74d559c25e336c3ebe917bf5c43e14ffa2de694)) ### Features -* **eslint-plugin:** [no-empty-function] new allow option overrideMethods ([#4923](https://github.com/typescript-eslint/typescript-eslint/issues/4923)) ([13c05ae](https://github.com/typescript-eslint/typescript-eslint/commit/13c05aefb0e6531d320629e04b7207a3baebacb0)) -* **eslint-plugin:** deprecate `no-duplicate-imports` in favour of `import/no-duplicates` ([#4973](https://github.com/typescript-eslint/typescript-eslint/issues/4973)) ([1d2e41a](https://github.com/typescript-eslint/typescript-eslint/commit/1d2e41ada1979c081130d19b229c82bf1a69b7b4)) -* update to TypeScript 4.7-rc ([#4829](https://github.com/typescript-eslint/typescript-eslint/issues/4829)) ([6fe783c](https://github.com/typescript-eslint/typescript-eslint/commit/6fe783c20aebe26ef42b526e4a59a9be84dd5643)) +- **eslint-plugin:** [parameter-properties] add rule to replace `no-parameter-properties` ([#4622](https://github.com/typescript-eslint/typescript-eslint/issues/4622)) ([88ed9ec](https://github.com/typescript-eslint/typescript-eslint/commit/88ed9ec9d6b971a9533565920fdcd6890ea941e9)) +# [5.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.19.0...v5.20.0) (2022-04-18) +### Features +- **eslint-plugin:** [no-magic-numbers] ignoreTypeIndexes option ([#4789](https://github.com/typescript-eslint/typescript-eslint/issues/4789)) ([5e79451](https://github.com/typescript-eslint/typescript-eslint/commit/5e794512bf124c39de76d4e2cf8a3d6cfb08f1a8)) +# [5.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.18.0...v5.19.0) (2022-04-11) -# [5.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.23.0...v5.24.0) (2022-05-16) +### Bug Fixes +- **eslint-plugin:** update code to use estree range instead of ts pos/end [#4723](https://github.com/typescript-eslint/typescript-eslint/issues/4723) ([#4790](https://github.com/typescript-eslint/typescript-eslint/issues/4790)) ([a1e9fc4](https://github.com/typescript-eslint/typescript-eslint/commit/a1e9fc4cb19e7655613ebe6f4dd911b5427b0367)) -### Bug Fixes +### Features -* **eslint-plugin:** [array-type] in fixer add missing parens for constructor types [#4756](https://github.com/typescript-eslint/typescript-eslint/issues/4756) ([#4971](https://github.com/typescript-eslint/typescript-eslint/issues/4971)) ([0377070](https://github.com/typescript-eslint/typescript-eslint/commit/03770708900da663eb64c19465b3f937bab55b3d)) +- **eslint-plugin:** [unified-signatures] add `ignoreDifferentlyNamedParameters` option ([#4659](https://github.com/typescript-eslint/typescript-eslint/issues/4659)) ([fdf95e0](https://github.com/typescript-eslint/typescript-eslint/commit/fdf95e02c45e137325c9ddd9d30e7f6b404f4514)) +- **eslint-plugin:** add support for valid number and bigint intersections in restrict-plus-operands rule ([#4795](https://github.com/typescript-eslint/typescript-eslint/issues/4795)) ([19c600a](https://github.com/typescript-eslint/typescript-eslint/commit/19c600a3dd485669cb87ae8f81b010e65eee1df8)) +# [5.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.17.0...v5.18.0) (2022-04-04) -### Features +### Bug Fixes -* **eslint-plugin:** Add BigInt object type to default ban-types list ([#4970](https://github.com/typescript-eslint/typescript-eslint/issues/4970)) ([1867728](https://github.com/typescript-eslint/typescript-eslint/commit/1867728ba104a6a21941ed300828110964a43b96)) -* **eslint-plugin:** add new 'strict' config ([#4706](https://github.com/typescript-eslint/typescript-eslint/issues/4706)) ([4a500b2](https://github.com/typescript-eslint/typescript-eslint/commit/4a500b2d92a91873dbb729793d1ee1c36ef06ed8)) +- **eslint-plugin:** method-signature-style respect getter signature ([#4777](https://github.com/typescript-eslint/typescript-eslint/issues/4777)) ([12dd670](https://github.com/typescript-eslint/typescript-eslint/commit/12dd670bc8621867c5105d8892dba9f9550a2f35)) +### Features +- **eslint-plugin:** [no-shadow] ignoreOnInitialization option ([#4603](https://github.com/typescript-eslint/typescript-eslint/issues/4603)) ([068ea9b](https://github.com/typescript-eslint/typescript-eslint/commit/068ea9b8eb3072fb46a6035f29c68ce96a69008d)) +- **eslint-plugin:** [no-this-alias] report on assignment expressions ([#4718](https://github.com/typescript-eslint/typescript-eslint/issues/4718)) ([8329498](https://github.com/typescript-eslint/typescript-eslint/commit/83294989dad543351a26e95be8d11a91d348679a)) +# [5.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.16.0...v5.17.0) (2022-03-28) +### Features -# [5.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.22.0...v5.23.0) (2022-05-09) +- **eslint-plugin:** [no-unused-vars] add destructuredArrayIgnorePattern options ([#4748](https://github.com/typescript-eslint/typescript-eslint/issues/4748)) ([6f8db8b](https://github.com/typescript-eslint/typescript-eslint/commit/6f8db8b64821d280fff408c1704a9adde682ed69)) +# [5.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.15.0...v5.16.0) (2022-03-21) ### Bug Fixes -* **eslint-plugin:** [no-restricted-imports] allow type import as long as there's one matching pattern ([#4898](https://github.com/typescript-eslint/typescript-eslint/issues/4898)) ([0419d28](https://github.com/typescript-eslint/typescript-eslint/commit/0419d287b637e805c33036a45760badc2498e19b)) -* **eslint-plugin:** [no-unnecessary-type-constraint] change to suggestion fix, fix multiple trailing comma failures ([#4901](https://github.com/typescript-eslint/typescript-eslint/issues/4901)) ([4507ac8](https://github.com/typescript-eslint/typescript-eslint/commit/4507ac84c76da0ced43b6679305afe1891e7afca)) +- **eslint-plugin:** [consistent-type-assertions] enforce assertionStyle for `const` assertions ([#4685](https://github.com/typescript-eslint/typescript-eslint/issues/4685)) ([8ec05be](https://github.com/typescript-eslint/typescript-eslint/commit/8ec05bed0fed0dcd48b087acd5ab5a6132bf3b09)) +### Features +- **eslint-plugin:** [prefer-optional-chain] support logical with empty object ([#4430](https://github.com/typescript-eslint/typescript-eslint/issues/4430)) ([d21cfe0](https://github.com/typescript-eslint/typescript-eslint/commit/d21cfe0f4b7d3041948b1b6e0cd56c5ec34b2b3f)) +# [5.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.14.0...v5.15.0) (2022-03-14) +### Features -# [5.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.21.0...v5.22.0) (2022-05-02) +- **parser:** add `parserOptions.emitDecoratorMetadata` ([#4646](https://github.com/typescript-eslint/typescript-eslint/issues/4646)) ([e3dd343](https://github.com/typescript-eslint/typescript-eslint/commit/e3dd343e51e3b7772e825a609735a04c921c1ec5)) +# [5.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.13.0...v5.14.0) (2022-03-07) ### Bug Fixes -* **eslint-plugin:** [comma-spacing] verify `nextToken` exists ([#4868](https://github.com/typescript-eslint/typescript-eslint/issues/4868)) ([23746f8](https://github.com/typescript-eslint/typescript-eslint/commit/23746f8babace7c2354368d6fb0881be26e19c41)) - +- **eslint-plugin:** [naming-convention] cover case that requires quotes ([#4582](https://github.com/typescript-eslint/typescript-eslint/issues/4582)) ([3ea0947](https://github.com/typescript-eslint/typescript-eslint/commit/3ea09477debec9f1593e4d3857e153570b488f4d)) +- **eslint-plugin:** [no-misused-promises] factor thenable returning function overload signatures ([#4620](https://github.com/typescript-eslint/typescript-eslint/issues/4620)) ([56a09e9](https://github.com/typescript-eslint/typescript-eslint/commit/56a09e98f171662d25ae2692be703a8bbbd3a3a5)) +- **eslint-plugin:** [prefer-readonly-parameter-types] handle class sharp private field and member without throwing error ([#4343](https://github.com/typescript-eslint/typescript-eslint/issues/4343)) ([a65713a](https://github.com/typescript-eslint/typescript-eslint/commit/a65713ae138e56555d01a9e8e5179221a2f39e75)) +- **eslint-plugin:** [return-await] correct autofixer in binary expression ([#4401](https://github.com/typescript-eslint/typescript-eslint/issues/4401)) ([5fa2fad](https://github.com/typescript-eslint/typescript-eslint/commit/5fa2fade385cc526a962212b94410c58e4c31078)) ### Features -* **eslint-plugin:** [no-duplicate-enum-values] add rule ([#4833](https://github.com/typescript-eslint/typescript-eslint/issues/4833)) ([5899164](https://github.com/typescript-eslint/typescript-eslint/commit/5899164b35d91106512a2720b23ba92e1893132f)) +- **eslint-plugin:** [no-misused-promises] add granular options within `checksVoidReturns` ([#4623](https://github.com/typescript-eslint/typescript-eslint/issues/4623)) ([1085177](https://github.com/typescript-eslint/typescript-eslint/commit/10851772696f982b585e0dade728f7980fdc6cc0)) +# [5.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.1...v5.13.0) (2022-02-28) +### Bug Fixes +- **eslint-plugin:** [sort-type-union-intersection-members] Wrap the constructorType in parentheses ([#4590](https://github.com/typescript-eslint/typescript-eslint/issues/4590)) ([851bb90](https://github.com/typescript-eslint/typescript-eslint/commit/851bb90216e20b7679efc891dc445e6152d4837f)) +### Features -# [5.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.20.0...v5.21.0) (2022-04-25) +- **eslint-plugin:** [no-misused-promises] check more places for checksVoidReturn ([#4541](https://github.com/typescript-eslint/typescript-eslint/issues/4541)) ([052cf51](https://github.com/typescript-eslint/typescript-eslint/commit/052cf51fe663283afe89dc7bf97c947e750df095)) +- **eslint-plugin:** add `no-redundant-type-constituents` rule ([#4378](https://github.com/typescript-eslint/typescript-eslint/issues/4378)) ([63d051e](https://github.com/typescript-eslint/typescript-eslint/commit/63d051eed29dcf71015a23992feac0a8f92717a0)) +- **eslint-plugin:** add `no-useless-empty-export` rule ([#4380](https://github.com/typescript-eslint/typescript-eslint/issues/4380)) ([823b945](https://github.com/typescript-eslint/typescript-eslint/commit/823b945c8f9e83d0246a2a5d07519f01e1a64518)) +- **eslint-plugin:** add extension rule `space-before-blocks` ([#1606](https://github.com/typescript-eslint/typescript-eslint/issues/1606)) ([#4184](https://github.com/typescript-eslint/typescript-eslint/issues/4184)) ([208b6d0](https://github.com/typescript-eslint/typescript-eslint/commit/208b6d02252dff2bf272329d3e4a4a82e56c52c0)) +- **eslint-plugin:** added member group support to member-ordering rule ([#4538](https://github.com/typescript-eslint/typescript-eslint/issues/4538)) ([6afcaea](https://github.com/typescript-eslint/typescript-eslint/commit/6afcaea0160a1ccd1c6483ca677c544ca1b8cb4f)) +## [5.12.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.0...v5.12.1) (2022-02-21) ### Bug Fixes -* **eslint-plugin:** [no-misused-promises] prioritize false returns when checking whether a function returns only void ([#4841](https://github.com/typescript-eslint/typescript-eslint/issues/4841)) ([ccadb60](https://github.com/typescript-eslint/typescript-eslint/commit/ccadb6075d6977c4921ffc09fa40f515f4d497c5)) -* **eslint-plugin:** [no-namespace] fix false positive for exported namespaces when allowDeclarations=true ([#4844](https://github.com/typescript-eslint/typescript-eslint/issues/4844)) ([4e7c9be](https://github.com/typescript-eslint/typescript-eslint/commit/4e7c9be6ff7e2448f4151563d7921cd285c2e349)) -* **eslint-plugin:** [space-infix-ops] fix no error when right type is function ([#4848](https://github.com/typescript-eslint/typescript-eslint/issues/4848)) ([d74d559](https://github.com/typescript-eslint/typescript-eslint/commit/d74d559c25e336c3ebe917bf5c43e14ffa2de694)) +- **eslint-plugin:** [no-unnecessary-type-arguments] fix comparison of types ([#4555](https://github.com/typescript-eslint/typescript-eslint/issues/4555)) ([fc3936e](https://github.com/typescript-eslint/typescript-eslint/commit/fc3936e99712374a707ce9e0101bc641807b9ea6)) +# [5.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.11.0...v5.12.0) (2022-02-14) -### Features - -* **eslint-plugin:** [parameter-properties] add rule to replace `no-parameter-properties` ([#4622](https://github.com/typescript-eslint/typescript-eslint/issues/4622)) ([88ed9ec](https://github.com/typescript-eslint/typescript-eslint/commit/88ed9ec9d6b971a9533565920fdcd6890ea941e9)) +### Bug Fixes +- **eslint-plugin:** [init-declarations] fix nested namespace ([#4544](https://github.com/typescript-eslint/typescript-eslint/issues/4544)) ([fe910e6](https://github.com/typescript-eslint/typescript-eslint/commit/fe910e61ca4bb42be3be9acb8ddcec73206754c2)) +- **eslint-plugin:** [no-unnecessary-type-arguments] Use Symbol to check if it's the same type ([#4543](https://github.com/typescript-eslint/typescript-eslint/issues/4543)) ([5b7d8df](https://github.com/typescript-eslint/typescript-eslint/commit/5b7d8df149be6554c863cdd5b73c0b0b0a7960db)) +- support nested object deconstructuring with type annotation ([#4548](https://github.com/typescript-eslint/typescript-eslint/issues/4548)) ([4da9278](https://github.com/typescript-eslint/typescript-eslint/commit/4da9278c80706f420d4c15a71c11c7b11d935643)) +### Features +- add checking property definition for allowNames option ([#4542](https://github.com/typescript-eslint/typescript-eslint/issues/4542)) ([e32bef6](https://github.com/typescript-eslint/typescript-eslint/commit/e32bef6f6b74228c95e54a5cba1cde53d5e40623)) +# [5.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.2...v5.11.0) (2022-02-07) -# [5.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.19.0...v5.20.0) (2022-04-18) +### Bug Fixes +- **eslint-plugin:** [no-magic-numbers] fix invalid schema merging ([#4517](https://github.com/typescript-eslint/typescript-eslint/issues/4517)) ([b95f796](https://github.com/typescript-eslint/typescript-eslint/commit/b95f79697acdd16347dc102bcb8311fe83746779)) +- **eslint-plugin:** [non-nullable-type-assertion-style] fix false positive when asserting to a generic type that might be nullish ([#4509](https://github.com/typescript-eslint/typescript-eslint/issues/4509)) ([4209362](https://github.com/typescript-eslint/typescript-eslint/commit/420936274603d8fee0631cdb3b58874cb3cc59d7)) ### Features -* **eslint-plugin:** [no-magic-numbers] ignoreTypeIndexes option ([#4789](https://github.com/typescript-eslint/typescript-eslint/issues/4789)) ([5e79451](https://github.com/typescript-eslint/typescript-eslint/commit/5e794512bf124c39de76d4e2cf8a3d6cfb08f1a8)) +- **eslint-plugin:** [explicit-function-return-type] add allowedNames ([#4440](https://github.com/typescript-eslint/typescript-eslint/issues/4440)) ([936e252](https://github.com/typescript-eslint/typescript-eslint/commit/936e252e30cfcebdaf971cf0f66a3031e236a41c)) +## [5.10.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.1...v5.10.2) (2022-01-31) +### Bug Fixes +- **eslint-plugin:** [no-restricted-imports] allow relative type imports with patterns configured ([#4494](https://github.com/typescript-eslint/typescript-eslint/issues/4494)) ([4a6d217](https://github.com/typescript-eslint/typescript-eslint/commit/4a6d217ae8a8f5fa1dd4bd3e3e66ba7519b4a287)) +## [5.10.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.0...v5.10.1) (2022-01-24) -# [5.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.18.0...v5.19.0) (2022-04-11) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin +# [5.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.1...v5.10.0) (2022-01-17) ### Bug Fixes -* **eslint-plugin:** update code to use estree range instead of ts pos/end [#4723](https://github.com/typescript-eslint/typescript-eslint/issues/4723) ([#4790](https://github.com/typescript-eslint/typescript-eslint/issues/4790)) ([a1e9fc4](https://github.com/typescript-eslint/typescript-eslint/commit/a1e9fc4cb19e7655613ebe6f4dd911b5427b0367)) - +- **eslint-plugin:** [explicit-function-return-type] support AllowTypedFunctionExpression within AllowHigherOrderFunction ([#4250](https://github.com/typescript-eslint/typescript-eslint/issues/4250)) ([d053cde](https://github.com/typescript-eslint/typescript-eslint/commit/d053cde3e8b5bf9ba1c22fd64a7456d672ef77ca)) +- **eslint-plugin:** [no-extra-semi] false negatives when used with eslint 8.3.0 ([#4458](https://github.com/typescript-eslint/typescript-eslint/issues/4458)) ([f4016c2](https://github.com/typescript-eslint/typescript-eslint/commit/f4016c24f9023e8a42def9501b68c4a908cbfede)) +- **eslint-plugin:** [no-invalid-this] crash when used with eslint 8.7.0 ([#4448](https://github.com/typescript-eslint/typescript-eslint/issues/4448)) ([e56f1e5](https://github.com/typescript-eslint/typescript-eslint/commit/e56f1e5d52fcbf3caae43034872e0b3181871689)) +- **eslint-plugin:** [no-magic-numbers] handle bigint in class props ([#4411](https://github.com/typescript-eslint/typescript-eslint/issues/4411)) ([c8e650f](https://github.com/typescript-eslint/typescript-eslint/commit/c8e650f0c124d24b24beaeb376eaf61ee8d9e6fb)) ### Features -* **eslint-plugin:** [unified-signatures] add `ignoreDifferentlyNamedParameters` option ([#4659](https://github.com/typescript-eslint/typescript-eslint/issues/4659)) ([fdf95e0](https://github.com/typescript-eslint/typescript-eslint/commit/fdf95e02c45e137325c9ddd9d30e7f6b404f4514)) -* **eslint-plugin:** add support for valid number and bigint intersections in restrict-plus-operands rule ([#4795](https://github.com/typescript-eslint/typescript-eslint/issues/4795)) ([19c600a](https://github.com/typescript-eslint/typescript-eslint/commit/19c600a3dd485669cb87ae8f81b010e65eee1df8)) +- rename `experimental-utils` to `utils` and make `experimental-utils` an alias to the new package ([#4172](https://github.com/typescript-eslint/typescript-eslint/issues/4172)) ([1d55a75](https://github.com/typescript-eslint/typescript-eslint/commit/1d55a7511b38d8e2b2eabe59f639e0a865e6c93f)) +## [5.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.0...v5.9.1) (2022-01-10) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin +# [5.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.1...v5.9.0) (2022-01-03) +### Features -# [5.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.17.0...v5.18.0) (2022-04-04) +- **experimental-utils:** move isTypeReadonly from eslint-plugin to experimental-utils ([#3658](https://github.com/typescript-eslint/typescript-eslint/issues/3658)) ([a9eb0b9](https://github.com/typescript-eslint/typescript-eslint/commit/a9eb0b9eb2db291ea36065ec34f84bf5c5504b43)) +## [5.8.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.0...v5.8.1) (2021-12-27) ### Bug Fixes -* **eslint-plugin:** method-signature-style respect getter signature ([#4777](https://github.com/typescript-eslint/typescript-eslint/issues/4777)) ([12dd670](https://github.com/typescript-eslint/typescript-eslint/commit/12dd670bc8621867c5105d8892dba9f9550a2f35)) +- **eslint-plugin:** [consistent-indexed-object-style] do not report for circular references ([#4347](https://github.com/typescript-eslint/typescript-eslint/issues/4347)) ([6edebcd](https://github.com/typescript-eslint/typescript-eslint/commit/6edebcda00053eecf7b3e55eeb3fe5d7fb9e7db7)) +- **eslint-plugin:** [consistent-type-definitions] correct fixer with declare keyword ([#4334](https://github.com/typescript-eslint/typescript-eslint/issues/4334)) ([0cd911a](https://github.com/typescript-eslint/typescript-eslint/commit/0cd911a916805d3b1f8043584e4685f3edd5c427)) +- **eslint-plugin:** [padding-line-between-statements] make function overloading is also processed ([#4345](https://github.com/typescript-eslint/typescript-eslint/issues/4345)) ([d31ec26](https://github.com/typescript-eslint/typescript-eslint/commit/d31ec264fe5f5cd27e8f522a485e106889f2d380)) +# [5.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.7.0...v5.8.0) (2021-12-20) -### Features +### Bug Fixes -* **eslint-plugin:** [no-shadow] ignoreOnInitialization option ([#4603](https://github.com/typescript-eslint/typescript-eslint/issues/4603)) ([068ea9b](https://github.com/typescript-eslint/typescript-eslint/commit/068ea9b8eb3072fb46a6035f29c68ce96a69008d)) -* **eslint-plugin:** [no-this-alias] report on assignment expressions ([#4718](https://github.com/typescript-eslint/typescript-eslint/issues/4718)) ([8329498](https://github.com/typescript-eslint/typescript-eslint/commit/83294989dad543351a26e95be8d11a91d348679a)) +- **eslint-plugin:** [no-implied-eval] improve performance ([#4313](https://github.com/typescript-eslint/typescript-eslint/issues/4313)) ([e344596](https://github.com/typescript-eslint/typescript-eslint/commit/e3445967de6ed73e6b2334380236aed8a0ee6e4f)) +- **eslint-plugin:** [padding-line-between-statements] `type` StatementTypes can't differenciate from variable ([#4270](https://github.com/typescript-eslint/typescript-eslint/issues/4270)) ([bfc4324](https://github.com/typescript-eslint/typescript-eslint/commit/bfc4324f4cda24e30b2d39d5b70f7554f2b6bf81)) +- **eslint-plugin:** [strict-boolean-expression] false positive for truthy boolean ([#4275](https://github.com/typescript-eslint/typescript-eslint/issues/4275)) ([72c2e41](https://github.com/typescript-eslint/typescript-eslint/commit/72c2e418a4180f6db5795ebb42cbc095f5c53c37)) +- **eslint-plugin:** `array-type` mark `AST_NODE_TYPES.TSBigIntKeyword` as simple ([#4274](https://github.com/typescript-eslint/typescript-eslint/issues/4274)) ([74e544e](https://github.com/typescript-eslint/typescript-eslint/commit/74e544e487328e56fcb7aef048a78beaad593ea0)) +- **eslint-plugin:** handle method overloading in `semi` ([#4318](https://github.com/typescript-eslint/typescript-eslint/issues/4318)) ([3b87b49](https://github.com/typescript-eslint/typescript-eslint/commit/3b87b49ea8d62c2f4f3bee7494500b5ad44fcbc1)) +- **experimental-utils:** support immutable members ([#3844](https://github.com/typescript-eslint/typescript-eslint/issues/3844)) ([3d33a77](https://github.com/typescript-eslint/typescript-eslint/commit/3d33a77c57e5b752edf6f35ed152038bdb230b79)) +### Features +- **eslint-plugin:** [no-throw-literal] add options to to disallow `any`/`unknown` ([#4207](https://github.com/typescript-eslint/typescript-eslint/issues/4207)) ([ff0adf9](https://github.com/typescript-eslint/typescript-eslint/commit/ff0adf9e0bfbf71667c51de0a84038586e4cbfd1)) +- **eslint-plugin:** [restrict-plus-operand] add allowAny option ([#4260](https://github.com/typescript-eslint/typescript-eslint/issues/4260)) ([2788545](https://github.com/typescript-eslint/typescript-eslint/commit/27885456c577dfada52d298857f406f0f332c405)) +# [5.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.6.0...v5.7.0) (2021-12-13) +### Features -# [5.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.16.0...v5.17.0) (2022-03-28) +- **eslint-plugin:** [consistent-type-exports] support TS4.5 inline export specifiers ([#4236](https://github.com/typescript-eslint/typescript-eslint/issues/4236)) ([be4d976](https://github.com/typescript-eslint/typescript-eslint/commit/be4d976215614cc032730ae596d2f6e47df67730)) +- **eslint-plugin:** [consistent-type-imports] support TS4.5 inline import specifiers ([#4237](https://github.com/typescript-eslint/typescript-eslint/issues/4237)) ([f61af7c](https://github.com/typescript-eslint/typescript-eslint/commit/f61af7c53cca52f81e77b4334c7d6ad100609af6)) +- **eslint-plugin:** [no-shadow] support TS4.5 inline import specifiers ([#4239](https://github.com/typescript-eslint/typescript-eslint/issues/4239)) ([96b7e8e](https://github.com/typescript-eslint/typescript-eslint/commit/96b7e8ee0f5280cab50a7205ae592e1d983a111a)) +# [5.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.5.0...v5.6.0) (2021-12-06) ### Features -* **eslint-plugin:** [no-unused-vars] add destructuredArrayIgnorePattern options ([#4748](https://github.com/typescript-eslint/typescript-eslint/issues/4748)) ([6f8db8b](https://github.com/typescript-eslint/typescript-eslint/commit/6f8db8b64821d280fff408c1704a9adde682ed69)) +- **scope-manager:** support TS4.5 import/export specifier kind ([#4234](https://github.com/typescript-eslint/typescript-eslint/issues/4234)) ([833f822](https://github.com/typescript-eslint/typescript-eslint/commit/833f8221ce00aecb7d08c519bab9568353850f48)) +# [5.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.4.0...v5.5.0) (2021-11-29) +### Bug Fixes +- **eslint-plugin:** [member-ordering] order literal names correctly in ([#4054](https://github.com/typescript-eslint/typescript-eslint/issues/4054)) ([d57141a](https://github.com/typescript-eslint/typescript-eslint/commit/d57141a3d13fad30a93ed99a6a15f4b0b369246a)) +- **eslint-plugin:** [no-duplicate-imports] remove unnecessary type checking for `node.source` ([#4196](https://github.com/typescript-eslint/typescript-eslint/issues/4196)) ([637722a](https://github.com/typescript-eslint/typescript-eslint/commit/637722a77667f6ed1e0cf1f0e752d61622ae8546)) +- **eslint-plugin:** [no-var-requires] do not report require created from createRequire ([#4221](https://github.com/typescript-eslint/typescript-eslint/issues/4221)) ([0040186](https://github.com/typescript-eslint/typescript-eslint/commit/0040186aa23692724986df22a71926e8a7ff9e02)) +- **eslint-plugin:** [prefer-for-of] do nor error when iterating over this ([#4176](https://github.com/typescript-eslint/typescript-eslint/issues/4176)) ([258ddb0](https://github.com/typescript-eslint/typescript-eslint/commit/258ddb0708b7a44959bd3ac399cbde912c8021c8)) +- **eslint-plugin:** [require-await] treat yield\* asynciterable as an await ([#4125](https://github.com/typescript-eslint/typescript-eslint/issues/4125)) ([5a4ce6a](https://github.com/typescript-eslint/typescript-eslint/commit/5a4ce6a241b1d6c6caad87cad85c3741f0953e39)) +- **eslint-plugin:** remove all whitespaces in comparison [#4220](https://github.com/typescript-eslint/typescript-eslint/issues/4220) ([#4223](https://github.com/typescript-eslint/typescript-eslint/issues/4223)) ([853d799](https://github.com/typescript-eslint/typescript-eslint/commit/853d799428a061d9bf6a2e74b01dc49a1e4f3134)) +### Features -# [5.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.15.0...v5.16.0) (2022-03-21) +- **eslint-plugin:** [member-ordering] add option to sort case insensitive ([#3896](https://github.com/typescript-eslint/typescript-eslint/issues/3896)) ([e3533d5](https://github.com/typescript-eslint/typescript-eslint/commit/e3533d5a6293a358b5eb0a6ed17da961a09b0ed3)) +- **eslint-plugin:** `array-type` distinguish whether readonly or not ([#4066](https://github.com/typescript-eslint/typescript-eslint/issues/4066)) ([314af44](https://github.com/typescript-eslint/typescript-eslint/commit/314af44bde3ccbebc620625b2931d77688525976)) +# [5.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.3.1...v5.4.0) (2021-11-15) ### Bug Fixes -* **eslint-plugin:** [consistent-type-assertions] enforce assertionStyle for `const` assertions ([#4685](https://github.com/typescript-eslint/typescript-eslint/issues/4685)) ([8ec05be](https://github.com/typescript-eslint/typescript-eslint/commit/8ec05bed0fed0dcd48b087acd5ab5a6132bf3b09)) - +- correct issues with circular imports ([#4140](https://github.com/typescript-eslint/typescript-eslint/issues/4140)) ([4c87b24](https://github.com/typescript-eslint/typescript-eslint/commit/4c87b2486a9c90794d972a4d093c1dc22ffb418b)) +- **eslint-plugin:** [explicit-member-accessibility] private fields cannot have accessibility modifiers ([#4117](https://github.com/typescript-eslint/typescript-eslint/issues/4117)) ([81b25c1](https://github.com/typescript-eslint/typescript-eslint/commit/81b25c12eceae89e181a7bdb3c8298d820cfe3e3)) +- **eslint-plugin:** [no-implied-eval] ignore locally declared functions ([#4049](https://github.com/typescript-eslint/typescript-eslint/issues/4049)) ([d97140e](https://github.com/typescript-eslint/typescript-eslint/commit/d97140ecf4aeb0a1f8b391f46a31881f21ad93c3)) +- **eslint-plugin:** check optional chaining for floating promises ([#4096](https://github.com/typescript-eslint/typescript-eslint/issues/4096)) ([d724777](https://github.com/typescript-eslint/typescript-eslint/commit/d7247770886c619263482c3e083bed9f97b22688)) ### Features -* **eslint-plugin:** [prefer-optional-chain] support logical with empty object ([#4430](https://github.com/typescript-eslint/typescript-eslint/issues/4430)) ([d21cfe0](https://github.com/typescript-eslint/typescript-eslint/commit/d21cfe0f4b7d3041948b1b6e0cd56c5ec34b2b3f)) - +- add RuleCreator.withoutDocs ([#4136](https://github.com/typescript-eslint/typescript-eslint/issues/4136)) ([87cfc6a](https://github.com/typescript-eslint/typescript-eslint/commit/87cfc6ad3e3312d7b6f98a592fb37e69d5d6880a)) +- **typescript-estree:** support private fields in-in syntax ([#4075](https://github.com/typescript-eslint/typescript-eslint/issues/4075)) ([939d8ea](https://github.com/typescript-eslint/typescript-eslint/commit/939d8eac547fb1734aa00f1ea01cc6eae0b4280a)) +## [5.3.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.3.0...v5.3.1) (2021-11-08) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin +# [5.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.2.0...v5.3.0) (2021-11-01) -# [5.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.14.0...v5.15.0) (2022-03-14) +### Bug Fixes +- **eslint-plugin:** ignore private identifiers in explicit-module-boundary-types ([#4046](https://github.com/typescript-eslint/typescript-eslint/issues/4046)) ([80b853d](https://github.com/typescript-eslint/typescript-eslint/commit/80b853db90ae3d4e32c4b7ec9d45a5c41dc459c9)) +- **eslint-plugin:** skip seenTypes for unions in isTypeReadonly ([#4043](https://github.com/typescript-eslint/typescript-eslint/issues/4043)) ([6af7ca7](https://github.com/typescript-eslint/typescript-eslint/commit/6af7ca7d9fde230342d27ad5a75a09a58c022974)) ### Features -* **parser:** add `parserOptions.emitDecoratorMetadata` ([#4646](https://github.com/typescript-eslint/typescript-eslint/issues/4646)) ([e3dd343](https://github.com/typescript-eslint/typescript-eslint/commit/e3dd343e51e3b7772e825a609735a04c921c1ec5)) +- **eslint-plugin:** [no-shadow] exclude external type declaration merging ([#3959](https://github.com/typescript-eslint/typescript-eslint/issues/3959)) ([a93cebf](https://github.com/typescript-eslint/typescript-eslint/commit/a93cebfc0f2026c50972bcb110bcd3295ba9a44d)) +# [5.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.1.0...v5.2.0) (2021-10-25) +### Bug Fixes +- **eslint-plugin:** [typedef] fix regression with class properties ([#4034](https://github.com/typescript-eslint/typescript-eslint/issues/4034)) ([fe53d22](https://github.com/typescript-eslint/typescript-eslint/commit/fe53d22f57ad418397fb31fa89c97db0ab4cd6c0)), closes [#4033](https://github.com/typescript-eslint/typescript-eslint/issues/4033) +### Features -# [5.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.13.0...v5.14.0) (2022-03-07) +- **eslint-plugin:** adding `consistent-type-exports` rule ([#3936](https://github.com/typescript-eslint/typescript-eslint/issues/3936)) ([1971a3f](https://github.com/typescript-eslint/typescript-eslint/commit/1971a3f8027416cd1fb33b1d50faa035599917de)) +# [5.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.0.0...v5.1.0) (2021-10-18) ### Bug Fixes -* **eslint-plugin:** [naming-convention] cover case that requires quotes ([#4582](https://github.com/typescript-eslint/typescript-eslint/issues/4582)) ([3ea0947](https://github.com/typescript-eslint/typescript-eslint/commit/3ea09477debec9f1593e4d3857e153570b488f4d)) -* **eslint-plugin:** [no-misused-promises] factor thenable returning function overload signatures ([#4620](https://github.com/typescript-eslint/typescript-eslint/issues/4620)) ([56a09e9](https://github.com/typescript-eslint/typescript-eslint/commit/56a09e98f171662d25ae2692be703a8bbbd3a3a5)) -* **eslint-plugin:** [prefer-readonly-parameter-types] handle class sharp private field and member without throwing error ([#4343](https://github.com/typescript-eslint/typescript-eslint/issues/4343)) ([a65713a](https://github.com/typescript-eslint/typescript-eslint/commit/a65713ae138e56555d01a9e8e5179221a2f39e75)) -* **eslint-plugin:** [return-await] correct autofixer in binary expression ([#4401](https://github.com/typescript-eslint/typescript-eslint/issues/4401)) ([5fa2fad](https://github.com/typescript-eslint/typescript-eslint/commit/5fa2fade385cc526a962212b94410c58e4c31078)) +- **eslint-plugin:** [no-restricted-imports]: report type-only imports properly ([#3996](https://github.com/typescript-eslint/typescript-eslint/issues/3996)) ([283cdf2](https://github.com/typescript-eslint/typescript-eslint/commit/283cdf26e6b32985531ff6416cd13ef4cb0a3c8c)) +- **eslint-plugin:** [strict-bool-expr] treat unconstrained generic as any ([#3981](https://github.com/typescript-eslint/typescript-eslint/issues/3981)) ([9b29ca7](https://github.com/typescript-eslint/typescript-eslint/commit/9b29ca751f496c25240c0c14b8fa432bf4443d39)) + +# [5.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.33.0...v5.0.0) (2021-10-11) + +### Bug Fixes +- **eslint-plugin:** [explicit-member-accessibility] report `TSAbstractPropertyDefinition` and `TSAbstractMethodDefinition` properly ([#3901](https://github.com/typescript-eslint/typescript-eslint/issues/3901)) ([82016f9](https://github.com/typescript-eslint/typescript-eslint/commit/82016f99b14825c9c60e1f7eb3b4efcc492bba86)) +- **eslint-plugin:** update new rules from master ([#3840](https://github.com/typescript-eslint/typescript-eslint/issues/3840)) ([d88a6b4](https://github.com/typescript-eslint/typescript-eslint/commit/d88a6b44eedcf9dd59569160570aa118851aa86b)) +- update new rules from master ([b34fb7e](https://github.com/typescript-eslint/typescript-eslint/commit/b34fb7eb3102ea603bb4aef0dbbf9885b3d47557)) +- **eslint-plugin:** crash in no-dupe-class-members (v5) ([#3813](https://github.com/typescript-eslint/typescript-eslint/issues/3813)) ([4b09644](https://github.com/typescript-eslint/typescript-eslint/commit/4b096442f731c0a60926ac0391a4f2c4208aa8d4)) ### Features -* **eslint-plugin:** [no-misused-promises] add granular options within `checksVoidReturns` ([#4623](https://github.com/typescript-eslint/typescript-eslint/issues/4623)) ([1085177](https://github.com/typescript-eslint/typescript-eslint/commit/10851772696f982b585e0dade728f7980fdc6cc0)) +- **ast-spec:** bring `Node` objects in line with ESTree ([#3771](https://github.com/typescript-eslint/typescript-eslint/issues/3771)) ([dd14064](https://github.com/typescript-eslint/typescript-eslint/commit/dd140643b457aa515cc21fcda2b3cd4acc2a1c5c)) +- **eslint-plugin:** remove `object` from `ban-types`' default types ([#3818](https://github.com/typescript-eslint/typescript-eslint/issues/3818)) ([ae3fa90](https://github.com/typescript-eslint/typescript-eslint/commit/ae3fa900d5b4e1f557a52ca58d35a7d098d9efaf)) +- **eslint-plugin:** removed value from abstract property nodes ([#3765](https://github.com/typescript-eslint/typescript-eslint/issues/3765)) ([5823524](https://github.com/typescript-eslint/typescript-eslint/commit/58235241714596b641a1e8b39c569e561e0039b4)), closes [#3748](https://github.com/typescript-eslint/typescript-eslint/issues/3748) +- **eslint-plugin:** update recommended configs ([#3809](https://github.com/typescript-eslint/typescript-eslint/issues/3809)) ([deeb7bb](https://github.com/typescript-eslint/typescript-eslint/commit/deeb7bb9334d301c6af56aefd37d318231af11ef)) +- align class property representation with ESTree ([#3806](https://github.com/typescript-eslint/typescript-eslint/issues/3806)) ([22fa5c0](https://github.com/typescript-eslint/typescript-eslint/commit/22fa5c0c4705ed2898f00b7cacc5dd642d859275)), closes [#3430](https://github.com/typescript-eslint/typescript-eslint/issues/3430) [#3077](https://github.com/typescript-eslint/typescript-eslint/issues/3077) +- remove `meta.docs.category` from rules ([#3800](https://github.com/typescript-eslint/typescript-eslint/issues/3800)) ([71c9370](https://github.com/typescript-eslint/typescript-eslint/commit/71c93706e55f5f92a1285102b93c6ab1950c6df4)) +- remove `TSParenthesizedType` ([#3340](https://github.com/typescript-eslint/typescript-eslint/issues/3340)) ([c8ee432](https://github.com/typescript-eslint/typescript-eslint/commit/c8ee43269faea4c04ec02eaa2b81a0aa6eec5d3e)), closes [#3136](https://github.com/typescript-eslint/typescript-eslint/issues/3136) +- support `PrivateIdentifier` ([#3808](https://github.com/typescript-eslint/typescript-eslint/issues/3808)) ([0eefe5e](https://github.com/typescript-eslint/typescript-eslint/commit/0eefe5e49d21af3f1e3e2d9a90c2e49929863ac2)), closes [#3430](https://github.com/typescript-eslint/typescript-eslint/issues/3430) [#2933](https://github.com/typescript-eslint/typescript-eslint/issues/2933) +- **eslint-plugin:** [comma-dangle] align schema with ESLint v8 ([#3768](https://github.com/typescript-eslint/typescript-eslint/issues/3768)) ([0acfafc](https://github.com/typescript-eslint/typescript-eslint/commit/0acfafcc655e28dcfc05a5caa567c0d0217ee7ad)) +- **eslint-plugin:** [member-ordering] add support for getters and setters ([#3611](https://github.com/typescript-eslint/typescript-eslint/issues/3611)) ([e264124](https://github.com/typescript-eslint/typescript-eslint/commit/e2641246571b69df36cde5cb7bce7c4fffc43f98)) +- **eslint-plugin:** remove `no-unused-vars-experimental` ([79ae03b](https://github.com/typescript-eslint/typescript-eslint/commit/79ae03b8adbae2b0a86276711a9c834af01bbb61)) +- support ESLint v8 ([#3737](https://github.com/typescript-eslint/typescript-eslint/issues/3737)) ([4ca62ae](https://github.com/typescript-eslint/typescript-eslint/commit/4ca62aee6681d706e762a8db727541ca204364f2)) +### BREAKING CHANGES +- **eslint-plugin:** `ban-types` no longer reports `object` by default +# [4.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.32.0...v4.33.0) (2021-10-04) +### Bug Fixes -# [5.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.1...v5.13.0) (2022-02-28) +- **eslint-plugin:** [lines-between-class-members] fix `exceptAfterOverload` for abstract methods ([#3943](https://github.com/typescript-eslint/typescript-eslint/issues/3943)) ([240fc65](https://github.com/typescript-eslint/typescript-eslint/commit/240fc65c307769eae9b35e611fca74ba4c35a025)) +- **eslint-plugin:** [no-confusing-void-expression] support optional chaining ([#3937](https://github.com/typescript-eslint/typescript-eslint/issues/3937)) ([c40dd13](https://github.com/typescript-eslint/typescript-eslint/commit/c40dd13df76b77052c85254622df5533307dc07e)) +- **eslint-plugin:** [no-restricted-imports] fix crash when no options given ([#3947](https://github.com/typescript-eslint/typescript-eslint/issues/3947)) ([edaa3c1](https://github.com/typescript-eslint/typescript-eslint/commit/edaa3c10eb67bb89f9c6a78bd1ed593925c33f16)) +- **eslint-plugin:** [non-nullable-type-assertion-style] false-positive with non-nullish `as` assertions and types ([#3940](https://github.com/typescript-eslint/typescript-eslint/issues/3940)) ([40760f9](https://github.com/typescript-eslint/typescript-eslint/commit/40760f98da0d23c7bce3da04cf37a56c10447bde)) +- **eslint-plugin:** [padding-line-between-statements] TSModuleBlock should change scope ([#3944](https://github.com/typescript-eslint/typescript-eslint/issues/3944)) ([f8f534e](https://github.com/typescript-eslint/typescript-eslint/commit/f8f534e42b0ec517274442422c37ab019cf3c200)) +- **eslint-plugin:** [prefer-regexp-exec] check `RegExp` without flags ([#3946](https://github.com/typescript-eslint/typescript-eslint/issues/3946)) ([0868725](https://github.com/typescript-eslint/typescript-eslint/commit/0868725713e8102e8932303d4c680340688e1fa9)) +# [4.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.2...v4.32.0) (2021-09-27) ### Bug Fixes -* **eslint-plugin:** [sort-type-union-intersection-members] Wrap the constructorType in parentheses ([#4590](https://github.com/typescript-eslint/typescript-eslint/issues/4590)) ([851bb90](https://github.com/typescript-eslint/typescript-eslint/commit/851bb90216e20b7679efc891dc445e6152d4837f)) - +- **eslint-plugin:** [consistent-type-definitions] correct fix for `export default` ([#3899](https://github.com/typescript-eslint/typescript-eslint/issues/3899)) ([ebb33ed](https://github.com/typescript-eslint/typescript-eslint/commit/ebb33ed8bc29f69ca2a657ec5b31857c0aeb4b56)) +- **eslint-plugin:** [no-require-imports] report only global `require` ([#3871](https://github.com/typescript-eslint/typescript-eslint/issues/3871)) ([8aa87a1](https://github.com/typescript-eslint/typescript-eslint/commit/8aa87a136e7cd7b40fbf09fcfa26bf04d1c6d5fe)) +- **eslint-plugin:** [no-shadow] ignore type-only imports properly ([#3868](https://github.com/typescript-eslint/typescript-eslint/issues/3868)) ([dda9cee](https://github.com/typescript-eslint/typescript-eslint/commit/dda9cee68a5cd78b358a854027999c739ac623e9)) +- **eslint-plugin:** [no-var-requires] report problems within `NewExpression` ([#3884](https://github.com/typescript-eslint/typescript-eslint/issues/3884)) ([ed5e459](https://github.com/typescript-eslint/typescript-eslint/commit/ed5e45983fa052accf3a7b5fcdbfcb15ed09490f)) +- **eslint-plugin:** [padding-line-between-statements] problems within namespaces not being reported ([#3869](https://github.com/typescript-eslint/typescript-eslint/issues/3869)) ([1861356](https://github.com/typescript-eslint/typescript-eslint/commit/186135698b40b510ffff6a2402aa34f2726596ea)) +- **eslint-plugin:** [prefer-regexp-exec] respect flags when using `RegExp` ([#3855](https://github.com/typescript-eslint/typescript-eslint/issues/3855)) ([ffdb5ff](https://github.com/typescript-eslint/typescript-eslint/commit/ffdb5ff9900e07374a2f3686447e3e2c78fbc38a)) +- **eslint-plugin:** [prefer-return-this-type] handle generics properly in fixer ([#3852](https://github.com/typescript-eslint/typescript-eslint/issues/3852)) ([9e98b8f](https://github.com/typescript-eslint/typescript-eslint/commit/9e98b8f43ca6aadc9758a4e9a0d1d3c250af6cca)) +- **eslint-plugin:** false-positive/negative with array index in no-unnecessary-condition ([#3805](https://github.com/typescript-eslint/typescript-eslint/issues/3805)) ([bdb8f0b](https://github.com/typescript-eslint/typescript-eslint/commit/bdb8f0be1466e4a4b713e91199be91030650ed01)) ### Features -* **eslint-plugin:** [no-misused-promises] check more places for checksVoidReturn ([#4541](https://github.com/typescript-eslint/typescript-eslint/issues/4541)) ([052cf51](https://github.com/typescript-eslint/typescript-eslint/commit/052cf51fe663283afe89dc7bf97c947e750df095)) -* **eslint-plugin:** add `no-redundant-type-constituents` rule ([#4378](https://github.com/typescript-eslint/typescript-eslint/issues/4378)) ([63d051e](https://github.com/typescript-eslint/typescript-eslint/commit/63d051eed29dcf71015a23992feac0a8f92717a0)) -* **eslint-plugin:** add `no-useless-empty-export` rule ([#4380](https://github.com/typescript-eslint/typescript-eslint/issues/4380)) ([823b945](https://github.com/typescript-eslint/typescript-eslint/commit/823b945c8f9e83d0246a2a5d07519f01e1a64518)) -* **eslint-plugin:** add extension rule `space-before-blocks` ([#1606](https://github.com/typescript-eslint/typescript-eslint/issues/1606)) ([#4184](https://github.com/typescript-eslint/typescript-eslint/issues/4184)) ([208b6d0](https://github.com/typescript-eslint/typescript-eslint/commit/208b6d02252dff2bf272329d3e4a4a82e56c52c0)) -* **eslint-plugin:** added member group support to member-ordering rule ([#4538](https://github.com/typescript-eslint/typescript-eslint/issues/4538)) ([6afcaea](https://github.com/typescript-eslint/typescript-eslint/commit/6afcaea0160a1ccd1c6483ca677c544ca1b8cb4f)) - +- **eslint-plugin:** [no-type-alias]: add allowGenerics option ([#3865](https://github.com/typescript-eslint/typescript-eslint/issues/3865)) ([4195919](https://github.com/typescript-eslint/typescript-eslint/commit/41959199735a6d4fe3ae7825f3087e8fb249be9f)) +- **eslint-plugin:** add `no-non-null-asserted-nullish-coalescing` rule ([#3349](https://github.com/typescript-eslint/typescript-eslint/issues/3349)) ([4e99961](https://github.com/typescript-eslint/typescript-eslint/commit/4e999614e9761f6dc7e5aa0c5bad76ab164ab3fb)) +- **eslint-plugin:** add new extended rule `no-restricted-imports` ([#3775](https://github.com/typescript-eslint/typescript-eslint/issues/3775)) ([ec5d506](https://github.com/typescript-eslint/typescript-eslint/commit/ec5d50696b249a207d322e4a2fc66582122eb010)) +- **eslint-plugin-internal:** [prefer-ast-types-enum] add `DefinitionType` enum ([#3916](https://github.com/typescript-eslint/typescript-eslint/issues/3916)) ([13b7de5](https://github.com/typescript-eslint/typescript-eslint/commit/13b7de508e0f8eac492879ff9ab99acd8d3e977e)) +## [4.31.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.1...v4.31.2) (2021-09-20) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin +## [4.31.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.0...v4.31.1) (2021-09-13) -## [5.12.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.0...v5.12.1) (2022-02-21) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin +# [4.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.30.0...v4.31.0) (2021-09-06) ### Bug Fixes -* **eslint-plugin:** [no-unnecessary-type-arguments] fix comparison of types ([#4555](https://github.com/typescript-eslint/typescript-eslint/issues/4555)) ([fc3936e](https://github.com/typescript-eslint/typescript-eslint/commit/fc3936e99712374a707ce9e0101bc641807b9ea6)) - - - +- **utils:** support immutable arrays in `ReportFixFunction` ([#3830](https://github.com/typescript-eslint/typescript-eslint/issues/3830)) ([8218055](https://github.com/typescript-eslint/typescript-eslint/commit/8218055d6dfd94c9e6c8645848f981d9d51ce08c)) +### Features -# [5.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.11.0...v5.12.0) (2022-02-14) +- **eslint-plugin:** [prefer-readonly-parameter-types] add option treatMethodsAsReadonly ([#3733](https://github.com/typescript-eslint/typescript-eslint/issues/3733)) ([a46e318](https://github.com/typescript-eslint/typescript-eslint/commit/a46e3182c8a0b07c914605d6d9fe28ef36a7c32a)) +- **eslint-plugin:** [restrict-template-expressions] add option to allow RegExp ([#3709](https://github.com/typescript-eslint/typescript-eslint/issues/3709)) ([363b3dc](https://github.com/typescript-eslint/typescript-eslint/commit/363b3dc4dd0dc343311c729d75935b10f9d2fd5e)) +- **eslint-plugin:** add `no-meaningless-void-operator` rule ([#3641](https://github.com/typescript-eslint/typescript-eslint/issues/3641)) ([ea40ab6](https://github.com/typescript-eslint/typescript-eslint/commit/ea40ab659351ae7cf7235ea063d42ac155b11e5f)) +- **eslint-plugin:** add extension rule `padding-line-between-statements` ([#3418](https://github.com/typescript-eslint/typescript-eslint/issues/3418)) ([f79ae9b](https://github.com/typescript-eslint/typescript-eslint/commit/f79ae9b58e82f4fddef640a34a1d7ff92b763e65)) +# [4.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.3...v4.30.0) (2021-08-30) ### Bug Fixes -* **eslint-plugin:** [init-declarations] fix nested namespace ([#4544](https://github.com/typescript-eslint/typescript-eslint/issues/4544)) ([fe910e6](https://github.com/typescript-eslint/typescript-eslint/commit/fe910e61ca4bb42be3be9acb8ddcec73206754c2)) -* **eslint-plugin:** [no-unnecessary-type-arguments] Use Symbol to check if it's the same type ([#4543](https://github.com/typescript-eslint/typescript-eslint/issues/4543)) ([5b7d8df](https://github.com/typescript-eslint/typescript-eslint/commit/5b7d8df149be6554c863cdd5b73c0b0b0a7960db)) -* support nested object deconstructuring with type annotation ([#4548](https://github.com/typescript-eslint/typescript-eslint/issues/4548)) ([4da9278](https://github.com/typescript-eslint/typescript-eslint/commit/4da9278c80706f420d4c15a71c11c7b11d935643)) - +- **eslint-plugin:** [dot-notation] false positive with optional chaining ([#3711](https://github.com/typescript-eslint/typescript-eslint/issues/3711)) ([c19fc6e](https://github.com/typescript-eslint/typescript-eslint/commit/c19fc6e03072ed549bc9b35ebe6961e10f8f9b43)), closes [#3510](https://github.com/typescript-eslint/typescript-eslint/issues/3510) +- **eslint-plugin:** [prefer-reduce-type-parameter] handle already existing type params ([#3706](https://github.com/typescript-eslint/typescript-eslint/issues/3706)) ([71dd273](https://github.com/typescript-eslint/typescript-eslint/commit/71dd27361a1bc93b5d5eb2279d805922b10002fd)) +- **eslint-plugin:** isTypeReadonly error with unknown ([#2371](https://github.com/typescript-eslint/typescript-eslint/issues/2371)) ([e7528e6](https://github.com/typescript-eslint/typescript-eslint/commit/e7528e686f5fe5cce8504fc15d3cd06b8733712e)) -* **typescript-estree:** support TSv4 labelled tuple members ([#2378](https://github.com/typescript-eslint/typescript-eslint/issues/2378)) ([00d84ff](https://github.com/typescript-eslint/typescript-eslint/commit/00d84ffbcbe9d0ec98bdb2f2ce59959a27ce4dbe)) - - - - - -# [3.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.7.1...v3.8.0) (2020-08-03) +- **eslint-plugin:** [prefer-regexp-exec] add autofix ([#3207](https://github.com/typescript-eslint/typescript-eslint/issues/3207)) ([e2cbeef](https://github.com/typescript-eslint/typescript-eslint/commit/e2cbeefb3d9a7cce257b5675f7f19f1b159a9d26)) +# [4.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.20.0...v4.21.0) (2021-04-05) ### Bug Fixes -* **eslint-plugin:** [no-implied-eval] don't report when `Function` is imported ([#2348](https://github.com/typescript-eslint/typescript-eslint/issues/2348)) ([fa169e7](https://github.com/typescript-eslint/typescript-eslint/commit/fa169e79661821f0e0e64a56d6db9da42c3c8654)) -* **eslint-plugin:** [no-unsafe-assignment] fix typo in message ([#2347](https://github.com/typescript-eslint/typescript-eslint/issues/2347)) ([2027bb1](https://github.com/typescript-eslint/typescript-eslint/commit/2027bb11689b76c297f93ba8a918b35fe68e5b9d)) - +- **eslint-plugin:** [no-type-alias] consider `keyof` as an alias ([#3242](https://github.com/typescript-eslint/typescript-eslint/issues/3242)) ([329ef02](https://github.com/typescript-eslint/typescript-eslint/commit/329ef023090c004694b5996ddb04fdde5b05ebb0)) +- **eslint-plugin:** [no-unnecessary-type-assertion] correct bad fix for angle bracket assertion ([#3244](https://github.com/typescript-eslint/typescript-eslint/issues/3244)) ([265a039](https://github.com/typescript-eslint/typescript-eslint/commit/265a039c7e728b719143e09ee61066039d721f62)) +- **eslint-plugin:** [restrict-plus-operands] consider template literal types as strings ([#3234](https://github.com/typescript-eslint/typescript-eslint/issues/3234)) ([ccfd68e](https://github.com/typescript-eslint/typescript-eslint/commit/ccfd68e365391b3f117df96792355f9c3655288c)) +- **eslint-plugin:** [strict-boolean-expressions] account for truthy literals ([#3236](https://github.com/typescript-eslint/typescript-eslint/issues/3236)) ([0913f40](https://github.com/typescript-eslint/typescript-eslint/commit/0913f40c87762de198b05a5473b4fb79aeb46967)) +- **eslint-plugin:** always ignore assignments in no-unnecessary-type-assertion ([#3235](https://github.com/typescript-eslint/typescript-eslint/issues/3235)) ([0221476](https://github.com/typescript-eslint/typescript-eslint/commit/02214768a3721d8514c70e00546e861da6581e4d)) ### Features -* **eslint-plugin:** [naming-convention] allow specifying an array of selectors ([#2335](https://github.com/typescript-eslint/typescript-eslint/issues/2335)) ([3ef6bd5](https://github.com/typescript-eslint/typescript-eslint/commit/3ef6bd5cadc225e42ef1330d15919a39f53f2a2b)) -* **eslint-plugin:** add `prefer-enum-initializers` rule ([#2326](https://github.com/typescript-eslint/typescript-eslint/issues/2326)) ([4f38ea3](https://github.com/typescript-eslint/typescript-eslint/commit/4f38ea39c97289db11501d6368d01db8c5787257)) - - - - - -## [3.7.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.7.0...v3.7.1) (2020-07-27) - - -### Bug Fixes - -* **eslint-plugin:** [adjacent-overload-signatures] fix false positive on call signatures and a method named `call` ([#2313](https://github.com/typescript-eslint/typescript-eslint/issues/2313)) ([30fafb0](https://github.com/typescript-eslint/typescript-eslint/commit/30fafb09422b3aca881f4785d89b0536092d4952)) -* **eslint-plugin:** [no-extra-parens] stop reporting on calling generic functions with one argument and type parameters containing parentheses ([#2319](https://github.com/typescript-eslint/typescript-eslint/issues/2319)) ([616a841](https://github.com/typescript-eslint/typescript-eslint/commit/616a841032bec310d9f31f1c987888273df27008)) - - - - - -# [3.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.6.1...v3.7.0) (2020-07-20) +- **eslint-plugin:** [no-unsafe-argument] add rule ([#3256](https://github.com/typescript-eslint/typescript-eslint/issues/3256)) ([b1aa7dc](https://github.com/typescript-eslint/typescript-eslint/commit/b1aa7dc6971ee8409b729dffb8b69478455734ed)), closes [#791](https://github.com/typescript-eslint/typescript-eslint/issues/791) +- **eslint-plugin:** [no-unsafe-call][no-unsafe-member-access] improve report messages for `this` for `noImplicitThis` ([#3199](https://github.com/typescript-eslint/typescript-eslint/issues/3199)) ([b1b26c4](https://github.com/typescript-eslint/typescript-eslint/commit/b1b26c4843a4cfa209a0c9c3d8bea1de37333b48)) +# [4.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.19.0...v4.20.0) (2021-03-29) ### Features -* **eslint-plugin:** [naming-convention] allow selecting only `const` variables ([#2291](https://github.com/typescript-eslint/typescript-eslint/issues/2291)) ([156d058](https://github.com/typescript-eslint/typescript-eslint/commit/156d058fee835fdf1ed827a5ad4a80d57190cc54)) -* **eslint-plugin:** [no-empty-function] add `decoratedFunctions` option ([#2295](https://github.com/typescript-eslint/typescript-eslint/issues/2295)) ([88f08f4](https://github.com/typescript-eslint/typescript-eslint/commit/88f08f410760f58fdc2de58ecd9dab9610821642)) - - - - - -## [3.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.6.0...v3.6.1) (2020-07-13) - - -### Bug Fixes - -* **eslint-plugin:** [no-unnecessary-condition] handle computed member access ([#2288](https://github.com/typescript-eslint/typescript-eslint/issues/2288)) ([3a187ca](https://github.com/typescript-eslint/typescript-eslint/commit/3a187cafb7302a3c05de0e6a236dd142a5e2d741)) -* **eslint-plugin:** [prefer-literal-enum-member] allow negative numbers ([#2277](https://github.com/typescript-eslint/typescript-eslint/issues/2277)) ([00ac9c3](https://github.com/typescript-eslint/typescript-eslint/commit/00ac9c3ccaad27bab08ec3c3a104f612bb593df5)) -* **eslint-plugin:** [space-before-function-paren] incorrect handling of abstract methods ([#2275](https://github.com/typescript-eslint/typescript-eslint/issues/2275)) ([ced6591](https://github.com/typescript-eslint/typescript-eslint/commit/ced65918b16f46c383496a9b4bd43eca8a76baf6)), closes [#2274](https://github.com/typescript-eslint/typescript-eslint/issues/2274) -* **eslint-plugin:** [switch-exhaustiveness-check] handle special characters in enum keys ([#2207](https://github.com/typescript-eslint/typescript-eslint/issues/2207)) ([98ab010](https://github.com/typescript-eslint/typescript-eslint/commit/98ab010fb7fca884984bb4200fd806ecee8071b6)) - - - - - -# [3.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.5.0...v3.6.0) (2020-07-06) +- **eslint-plugin:** [space-infix-ops] support for class properties and type aliases ([#3231](https://github.com/typescript-eslint/typescript-eslint/issues/3231)) ([5414bf2](https://github.com/typescript-eslint/typescript-eslint/commit/5414bf27a81311099d001808475d9cf832ce3bfe)) +- **eslint-plugin:** [type-annotation-spacing] handle space between ? and : ([#3138](https://github.com/typescript-eslint/typescript-eslint/issues/3138)) ([40bdb0b](https://github.com/typescript-eslint/typescript-eslint/commit/40bdb0b27b21de511f0ecd151cb8282a625ca6e1)) +# [4.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.18.0...v4.19.0) (2021-03-22) ### Bug Fixes -* **eslint-plugin:** [no-namespace] allow namespaces in nested declarations with `allowDeclarations` ([#2238](https://github.com/typescript-eslint/typescript-eslint/issues/2238)) ([c1df669](https://github.com/typescript-eslint/typescript-eslint/commit/c1df6694f7866d3ef7ede0b1c6c9dd6f3955e682)) -* **eslint-plugin:** [space-before-function-paren] handle abstract functions ([#2199](https://github.com/typescript-eslint/typescript-eslint/issues/2199)) ([88a3edf](https://github.com/typescript-eslint/typescript-eslint/commit/88a3edfce8349f871b7b660d2b76508b67c94eda)) - +- **eslint-plugin:** [member-delimiter-style] correct invalid fix for multiline with params on the same line ([#3177](https://github.com/typescript-eslint/typescript-eslint/issues/3177)) ([7ad343b](https://github.com/typescript-eslint/typescript-eslint/commit/7ad343b067040f6ea816b129323d110d4bc2e830)) +- **eslint-plugin:** [promise-function-async] bad fixer with computed and literal methods ([#3163](https://github.com/typescript-eslint/typescript-eslint/issues/3163)) ([e3a3ea0](https://github.com/typescript-eslint/typescript-eslint/commit/e3a3ea04757464aa2dded1ef46af8ad4e05246f2)) ### Features -* **eslint-plugin:** add rule `prefer-literal-enum-member` ([#1898](https://github.com/typescript-eslint/typescript-eslint/issues/1898)) ([fe2b2ec](https://github.com/typescript-eslint/typescript-eslint/commit/fe2b2ec39ef04ac8b73eef9d29d12fd1b24fa183)) - - - - - -# [3.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.4.0...v3.5.0) (2020-06-29) +- **eslint-plugin:** [object-curly-spacing] support MappedType ([#3176](https://github.com/typescript-eslint/typescript-eslint/issues/3176)) ([0557a43](https://github.com/typescript-eslint/typescript-eslint/commit/0557a439327557f4c0369ae2dddc8282ba45bfe6)) +- **eslint-plugin:** [unbound-method] improve error message ([#3203](https://github.com/typescript-eslint/typescript-eslint/issues/3203)) ([5cc5d2e](https://github.com/typescript-eslint/typescript-eslint/commit/5cc5d2ef6d924d301e87f7bcf599352310e74b2c)), closes [#3201](https://github.com/typescript-eslint/typescript-eslint/issues/3201) +# [4.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.17.0...v4.18.0) (2021-03-15) ### Bug Fixes -* **eslint-plugin:** [naming-convention] support unicode in regex ([#2241](https://github.com/typescript-eslint/typescript-eslint/issues/2241)) ([5fdd21a](https://github.com/typescript-eslint/typescript-eslint/commit/5fdd21a1726fb6928098c4152aec55a30df960d4)) - +- **eslint-plugin:** [explicit-module-boundary-types] fixes [#2864](https://github.com/typescript-eslint/typescript-eslint/issues/2864) related to functions in nested object properties ([#3178](https://github.com/typescript-eslint/typescript-eslint/issues/3178)) ([55e1fba](https://github.com/typescript-eslint/typescript-eslint/commit/55e1fbaca985b500cad1cc9ec25717b18cf5a17b)) +- **eslint-plugin:** [no-extran-class] allowWithDecorator should ignore other errors ([#3160](https://github.com/typescript-eslint/typescript-eslint/issues/3160)) ([a148673](https://github.com/typescript-eslint/typescript-eslint/commit/a1486736d8ef3555832ddfb27fd0980368b363f5)) ### Features -* add package scope-manager ([#1939](https://github.com/typescript-eslint/typescript-eslint/issues/1939)) ([682eb7e](https://github.com/typescript-eslint/typescript-eslint/commit/682eb7e009c3f22a542882dfd3602196a60d2a1e)) - - - - - -# [3.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.3.0...v3.4.0) (2020-06-22) +- **eslint-plugin:** add package type declaration ([#3164](https://github.com/typescript-eslint/typescript-eslint/issues/3164)) ([08b058a](https://github.com/typescript-eslint/typescript-eslint/commit/08b058a7a6db3b59c28753bb322717e1fee44d1f)) +# [4.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.16.1...v4.17.0) (2021-03-08) ### Bug Fixes -* **eslint-plugin:** [no-base-to-string] handle intersection types ([#2170](https://github.com/typescript-eslint/typescript-eslint/issues/2170)) ([9cca3a9](https://github.com/typescript-eslint/typescript-eslint/commit/9cca3a9584d5d5ef0536219c5a734f4e87efb543)) -* **eslint-plugin:** [unbound-method] handling destructuring ([#2228](https://github.com/typescript-eslint/typescript-eslint/issues/2228)) ([c3753c2](https://github.com/typescript-eslint/typescript-eslint/commit/c3753c21768d355ecdb9e7ae8e0bfdfbbc1d3bbe)) - +- **eslint-plugin:** [no-unnecessary-type-assertion] handle assignment ([#3133](https://github.com/typescript-eslint/typescript-eslint/issues/3133)) ([cb22561](https://github.com/typescript-eslint/typescript-eslint/commit/cb2256168c67e0383083673a5afe77076de49da5)) ### Features -* **eslint-plugin:** [no-unnecessary-boolean-literal-compare] add option to check nullable booleans ([#1983](https://github.com/typescript-eslint/typescript-eslint/issues/1983)) ([c0b3057](https://github.com/typescript-eslint/typescript-eslint/commit/c0b3057b7f7d515891ad2efe32e4ef8c01e0478f)) -* **eslint-plugin:** add extension rule `no-loss-of-precision` ([#2196](https://github.com/typescript-eslint/typescript-eslint/issues/2196)) ([535b0f2](https://github.com/typescript-eslint/typescript-eslint/commit/535b0f2ddd82efa6a2c40307a61c480f4b3cdea3)) - - - +- **eslint-plugin:** [strict-bool-expr] add fixes and suggestions ([#2847](https://github.com/typescript-eslint/typescript-eslint/issues/2847)) ([3f9e9a1](https://github.com/typescript-eslint/typescript-eslint/commit/3f9e9a1e9fc3e507bd01d1913ef642cd129de402)) +## [4.16.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.16.0...v4.16.1) (2021-03-01) -# [3.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.2.0...v3.3.0) (2020-06-15) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin +# [4.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.2...v4.16.0) (2021-03-01) ### Bug Fixes -* **eslint-plugin:** [no-unused-expressions] handle ternary and short-circuit options ([#2194](https://github.com/typescript-eslint/typescript-eslint/issues/2194)) ([ee9f100](https://github.com/typescript-eslint/typescript-eslint/commit/ee9f100a2f9a874c2b361482742686eeaa9bdac7)) - +- **eslint-plugin:** [consistent-indexed-object-style] do not autofix if interface has extends ([#3009](https://github.com/typescript-eslint/typescript-eslint/issues/3009)) ([b0475af](https://github.com/typescript-eslint/typescript-eslint/commit/b0475aff3920d748fa74b5a6d8a7ad5dd731aec4)) +- **eslint-plugin:** [no-implied-eval] handle conditional expression ([#3125](https://github.com/typescript-eslint/typescript-eslint/issues/3125)) ([8c65d30](https://github.com/typescript-eslint/typescript-eslint/commit/8c65d30a225a3b99e80326961d0cb0c8189b039c)) +- **eslint-plugin:** [no-unused-vars] don't report nested module declaration ([#3119](https://github.com/typescript-eslint/typescript-eslint/issues/3119)) ([4ca5888](https://github.com/typescript-eslint/typescript-eslint/commit/4ca58886adf3fc0fe31c263559990c8a534205f9)) +- **eslint-plugin:** [prefer-function-type] apply existing comments to the fixed code ([#3094](https://github.com/typescript-eslint/typescript-eslint/issues/3094)) ([c32f803](https://github.com/typescript-eslint/typescript-eslint/commit/c32f803d4480acf5ffc88e308b4243e5185c4f48)) +- **eslint-plugin:** [unbound-method] allow `super` expressions in `this` assignments ([#3010](https://github.com/typescript-eslint/typescript-eslint/issues/3010)) ([c65a139](https://github.com/typescript-eslint/typescript-eslint/commit/c65a1391be15bbcf3ae293b1c53686703883d546)) ### Features -* **eslint-plugin:** [naming-convention] better error message and docs for prefix/suffix ([#2195](https://github.com/typescript-eslint/typescript-eslint/issues/2195)) ([a2ffe55](https://github.com/typescript-eslint/typescript-eslint/commit/a2ffe5568df0f7224bfe9141d298e538383d5f09)) - - - - - -# [3.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.1.0...v3.2.0) (2020-06-08) +- **eslint-plugin:** [member-delimiter-style] Add an option 'multilineDetection' to treat types and interfaces as single line if the last member ends on the same line as the closing bracket ([#2970](https://github.com/typescript-eslint/typescript-eslint/issues/2970)) ([cf86f42](https://github.com/typescript-eslint/typescript-eslint/commit/cf86f427186d58b0fce4bb3ff9571c4301babeb3)) +- **eslint-plugin:** [prom-func-async] report only function head ([#2872](https://github.com/typescript-eslint/typescript-eslint/issues/2872)) ([25f459c](https://github.com/typescript-eslint/typescript-eslint/commit/25f459cdc4f38d44b48554e04cfa1676538ccdfb)) +## [4.15.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.1...v4.15.2) (2021-02-22) ### Bug Fixes -* **eslint-plugin:** [explicit-module-boundary-types] dont report return type errors on constructor overloads ([#2158](https://github.com/typescript-eslint/typescript-eslint/issues/2158)) ([53232d7](https://github.com/typescript-eslint/typescript-eslint/commit/53232d775ca0b808e2d75d9501f4411a868b2b48)) -* **eslint-plugin:** [explicit-module-boundary-types] handle bodyless arrow functions with explicit return types that return functions ([#2169](https://github.com/typescript-eslint/typescript-eslint/issues/2169)) ([58db655](https://github.com/typescript-eslint/typescript-eslint/commit/58db655133aaae006efe3e3ceee971cf88dc348f)) -* **eslint-plugin:** [explicit-module-boundary-types] handle nested functions and functions expressions in a typed variable declaration ([#2176](https://github.com/typescript-eslint/typescript-eslint/issues/2176)) ([6ff450d](https://github.com/typescript-eslint/typescript-eslint/commit/6ff450da3abec93223a33f6b52484c9ca99b7abe)) -* **eslint-plugin:** [no-extra-non-null-assertion] dont report for assertions not followed by the optional chain ([#2167](https://github.com/typescript-eslint/typescript-eslint/issues/2167)) ([e4c1834](https://github.com/typescript-eslint/typescript-eslint/commit/e4c1834c7c5934332dd1d58c09018453568c4889)) -* **eslint-plugin:** [no-unnecessary-conditionals] Handle comparison of generics and loose comparisons with undefined values ([#2152](https://github.com/typescript-eslint/typescript-eslint/issues/2152)) ([c86e2a2](https://github.com/typescript-eslint/typescript-eslint/commit/c86e2a235372149db9b1700d39c2145e0ce5221a)) -* **eslint-plugin:** [prefer-optional-chain] handling first member expression ([#2156](https://github.com/typescript-eslint/typescript-eslint/issues/2156)) ([de18660](https://github.com/typescript-eslint/typescript-eslint/commit/de18660a8cf8f7033798646d8c5b0938d1accb12)) -* **eslint-plugin:** [return-await] correct handling of ternaries ([#2168](https://github.com/typescript-eslint/typescript-eslint/issues/2168)) ([fe4c0bf](https://github.com/typescript-eslint/typescript-eslint/commit/fe4c0bf8c04f070d6642fbe86c5e5614bc88e8fd)) - - -### Features - -* **eslint-plugin:** [naming-convention] put identifiers in quotes in error messages ([#2182](https://github.com/typescript-eslint/typescript-eslint/issues/2182)) ([fc61932](https://github.com/typescript-eslint/typescript-eslint/commit/fc619326eedf7ef2efa51444ecdead81a36a204f)), closes [#2178](https://github.com/typescript-eslint/typescript-eslint/issues/2178) -* **eslint-plugin:** [require-array-sort-compare] add `ignoreStringArrays` option ([#1972](https://github.com/typescript-eslint/typescript-eslint/issues/1972)) ([6dee784](https://github.com/typescript-eslint/typescript-eslint/commit/6dee7840a3af1dfe4c38a128d1c4655bdac625df)) -* **eslint-plugin:** add rule `ban-tslint-comment` ([#2140](https://github.com/typescript-eslint/typescript-eslint/issues/2140)) ([43ee226](https://github.com/typescript-eslint/typescript-eslint/commit/43ee226ffbaaa3e7126081db9476c24b89ec16e9)) -* **eslint-plugin:** add rule `no-confusing-non-null-assertion` ([#1941](https://github.com/typescript-eslint/typescript-eslint/issues/1941)) ([9b51c44](https://github.com/typescript-eslint/typescript-eslint/commit/9b51c44f29d8b3e95a510985544e8ded8a14404d)) - - - - - -# [3.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.0.2...v3.1.0) (2020-06-01) +- **typescript-estree:** correct issues in AST definition ([#3083](https://github.com/typescript-eslint/typescript-eslint/issues/3083)) ([509a117](https://github.com/typescript-eslint/typescript-eslint/commit/509a11749f85400a01e9fecfecd12871ce562d3d)) +- add missing intrinsic keyword node to AST ([#3081](https://github.com/typescript-eslint/typescript-eslint/issues/3081)) ([409bf0b](https://github.com/typescript-eslint/typescript-eslint/commit/409bf0bb3e2ac4d8782408d436ebdefb42dba38b)) +- **eslint-plugin:** [no-var-requires] report when used in type assertion ([#3074](https://github.com/typescript-eslint/typescript-eslint/issues/3074)) ([763a252](https://github.com/typescript-eslint/typescript-eslint/commit/763a2520bfea09c3b6252ea36bc3ff10b05eca6c)) +## [4.15.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.0...v4.15.1) (2021-02-15) ### Bug Fixes -* **eslint-plugin:** [explicit-module-boundary-types] don't check returned functions if parent function has return type ([#2084](https://github.com/typescript-eslint/typescript-eslint/issues/2084)) ([d7d4eeb](https://github.com/typescript-eslint/typescript-eslint/commit/d7d4eeb03f2918d5d9e361fdb47c2d42e83bd593)) -* **eslint-plugin:** [no-unnecessary-condition] handle comparison of any, unknown and loose comparisons with nullish values ([#2123](https://github.com/typescript-eslint/typescript-eslint/issues/2123)) ([1ae1d01](https://github.com/typescript-eslint/typescript-eslint/commit/1ae1d01e5603ec7cef8051ed018c3c3c88b29867)) -* **eslint-plugin:** [no-unnecessary-condition] improve optional chain handling ([#2111](https://github.com/typescript-eslint/typescript-eslint/issues/2111)) ([9ee399b](https://github.com/typescript-eslint/typescript-eslint/commit/9ee399b5906e82f346ff89141207a6630786de54)) -* **eslint-plugin:** [no-unnecessary-condition] improve optional chain handling 2 - electric boogaloo ([#2138](https://github.com/typescript-eslint/typescript-eslint/issues/2138)) ([c87cfaf](https://github.com/typescript-eslint/typescript-eslint/commit/c87cfaf6746775bb8ad9eb45b0002f068a822dbe)) -* **eslint-plugin:** [no-unused-expressions] ignore import expressions ([#2130](https://github.com/typescript-eslint/typescript-eslint/issues/2130)) ([e383691](https://github.com/typescript-eslint/typescript-eslint/commit/e3836910efdafd9edf04daed149c9e839c08047e)) -* **eslint-plugin:** [no-var-requires] false negative for TSAsExpression and MemberExpression ([#2139](https://github.com/typescript-eslint/typescript-eslint/issues/2139)) ([df95338](https://github.com/typescript-eslint/typescript-eslint/commit/df953388913b22d45242e65ce231d92a8b8a0080)) -* **experimental-utils:** downlevel type declarations for versions older than 3.8 ([#2133](https://github.com/typescript-eslint/typescript-eslint/issues/2133)) ([7925823](https://github.com/typescript-eslint/typescript-eslint/commit/792582326a8065270b69a0ffcaad5a7b4b103ff3)) - - -### Features - -* **eslint-plugin:** [ban-ts-comments] add "allow-with-description" option ([#2099](https://github.com/typescript-eslint/typescript-eslint/issues/2099)) ([8a0fd18](https://github.com/typescript-eslint/typescript-eslint/commit/8a0fd1899f544470a35afb3117f4c71aad7e4e42)) -* **eslint-plugin:** [ban-types] allow selective disable of default options with `false` value ([#2137](https://github.com/typescript-eslint/typescript-eslint/issues/2137)) ([1cb8ca4](https://github.com/typescript-eslint/typescript-eslint/commit/1cb8ca483d029935310e6904580df8501837084d)) -* **eslint-plugin:** [explicit-module-boundary-types] improve accuracy and coverage ([#2135](https://github.com/typescript-eslint/typescript-eslint/issues/2135)) ([caaa859](https://github.com/typescript-eslint/typescript-eslint/commit/caaa8599284d02ab3341e282cad35a52d0fb86c7)) - - - - - -## [3.0.2](https://github.com/typescript-eslint/typescript-eslint/compare/v3.0.1...v3.0.2) (2020-05-27) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin - - - - - -## [3.0.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.0.0...v3.0.1) (2020-05-25) +- **eslint-plugin:** [explicit-module-boundary-types] check allowNames on function declarations and property methods ([#3051](https://github.com/typescript-eslint/typescript-eslint/issues/3051)) ([0ade469](https://github.com/typescript-eslint/typescript-eslint/commit/0ade469dc1cf17d79c36a9c985630d60491ed847)) +# [4.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.2...v4.15.0) (2021-02-08) ### Bug Fixes -* **eslint-plugin:** [naming-convention] handle no options correctly ([#2095](https://github.com/typescript-eslint/typescript-eslint/issues/2095)) ([fd7d02b](https://github.com/typescript-eslint/typescript-eslint/commit/fd7d02b31ebd995b7fdd857d7c054042aa4f2001)) -* **eslint-plugin:** [no-throw-literal] handle intersection and union types ([#2085](https://github.com/typescript-eslint/typescript-eslint/issues/2085)) ([cae037f](https://github.com/typescript-eslint/typescript-eslint/commit/cae037ff9b20363b970cc600a09505b98bf10a14)) -* **eslint-plugin:** [unbound-method] fix crash due to missing `Intl` ([#2090](https://github.com/typescript-eslint/typescript-eslint/issues/2090)) ([f2fa82c](https://github.com/typescript-eslint/typescript-eslint/commit/f2fa82c532ae858ccfb064268cfcc9df657a54be)) - - +- **eslint-plugin:** [no-extra-parens] handle ESLint 7.19.0 ([#2993](https://github.com/typescript-eslint/typescript-eslint/issues/2993)) ([4615048](https://github.com/typescript-eslint/typescript-eslint/commit/4615048d24359e0fc57b90a96acf4d8ded1dc7bf)) +- **eslint-plugin:** [prefer-function-type] correct fixer when signature ends with a semi ([#3002](https://github.com/typescript-eslint/typescript-eslint/issues/3002)) ([898dd39](https://github.com/typescript-eslint/typescript-eslint/commit/898dd3961944a5da3a129e9eba02634286e7aee4)) +- **scope-manager:** fix visiting of TSImportType ([#3008](https://github.com/typescript-eslint/typescript-eslint/issues/3008)) ([ce4fcbf](https://github.com/typescript-eslint/typescript-eslint/commit/ce4fcbf4401098387a2cf19ae8457c89c509239a)), closes [#3006](https://github.com/typescript-eslint/typescript-eslint/issues/3006) - - -# [3.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.34.0...v3.0.0) (2020-05-21) - -## [Please see the release notes for v3.0.0](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v3.0.0) +## [4.14.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.1...v4.14.2) (2021-02-01) ### Bug Fixes -* **eslint-plugin:** [dot-notation] fix typo in schema ([#2040](https://github.com/typescript-eslint/typescript-eslint/issues/2040)) ([242328f](https://github.com/typescript-eslint/typescript-eslint/commit/242328fa749ee4c72af93433a9bef95f329ac62f)) -* **eslint-plugin:** correct parser peerDep version ([fe59f69](https://github.com/typescript-eslint/typescript-eslint/commit/fe59f69381a0915a4f5135e2e88637a5eea246ba)) -* **experimental-utils:** add back SourceCode.isSpaceBetweenTokens ([ae82ea4](https://github.com/typescript-eslint/typescript-eslint/commit/ae82ea4a85a4ca332ebe6104e96c59dba30411be)) -* **typescript-estree:** remove now defunct `Import` node type ([f199cbd](https://github.com/typescript-eslint/typescript-eslint/commit/f199cbdbbd892b5ba03bfff66f463f3d9c92ee9b)) -* **typescript-estree:** use `TSEmptyBodyFunctionExpression` for body-less nodes ([#1289](https://github.com/typescript-eslint/typescript-eslint/issues/1289)) ([82e7163](https://github.com/typescript-eslint/typescript-eslint/commit/82e7163214b56ccde93ba97807b161669a50a60b)) - - -### Features - -* **eslint-plugin:** [ban-types] rework default options ([#848](https://github.com/typescript-eslint/typescript-eslint/issues/848)) ([8e31d5d](https://github.com/typescript-eslint/typescript-eslint/commit/8e31d5dbe9fe5227fdbefcecfd50ce5dd51360c3)) -* **eslint-plugin:** [no-floating-promises] ignore void operator by default ([#2003](https://github.com/typescript-eslint/typescript-eslint/issues/2003)) ([3626a67](https://github.com/typescript-eslint/typescript-eslint/commit/3626a673cf8117cc995245cd86e466e2553e9b0e)) -* **eslint-plugin:** [prefer-nullish-coalescing][prefer-optional-chain] remove unsafe fixers ([52b6085](https://github.com/typescript-eslint/typescript-eslint/commit/52b60852d0ba6bb6abe519c9d3ec1b231793e91d)) -* **experimental-utils:** upgrade eslint types for v7 ([#2023](https://github.com/typescript-eslint/typescript-eslint/issues/2023)) ([06869c9](https://github.com/typescript-eslint/typescript-eslint/commit/06869c9656fa37936126666845aee40aad546ebd)) -* upgrade to ESLint v7 ([#2022](https://github.com/typescript-eslint/typescript-eslint/issues/2022)) ([208de71](https://github.com/typescript-eslint/typescript-eslint/commit/208de71059746bf38e94bd460346ffb2698a3e12)) -* **eslint-plugin:** [no-unnecessary-condition] remove `checkArrayPredicates` and always check it ([#1579](https://github.com/typescript-eslint/typescript-eslint/issues/1579)) ([bfd9b60](https://github.com/typescript-eslint/typescript-eslint/commit/bfd9b606d17d30d5694967a1f01e0e1501ba1022)) -* **eslint-plugin:** [no-unnecessary-condition] remove option `ignoreRHS` ([#1163](https://github.com/typescript-eslint/typescript-eslint/issues/1163)) ([ee8dd8f](https://github.com/typescript-eslint/typescript-eslint/commit/ee8dd8f8a9e6c25ac426ce9bb71c5f012c51f264)) -* **eslint-plugin:** [no-unnecessary-condition] report when non-nullish is compared to `null`/`undefined` ([#1659](https://github.com/typescript-eslint/typescript-eslint/issues/1659)) ([7fa9060](https://github.com/typescript-eslint/typescript-eslint/commit/7fa906073903c5eb70609c25f1a91ada14dcdc71)) -* **eslint-plugin:** [restrict-template-expressions] `allowNumber: true` by default ([#2005](https://github.com/typescript-eslint/typescript-eslint/issues/2005)) ([643ec24](https://github.com/typescript-eslint/typescript-eslint/commit/643ec240bd901295d9e9ea5c43fc20109c33e982)) -* **eslint-plugin:** [restrict-template-expressions] rename `allowNullable` to `allowNullish` ([#2006](https://github.com/typescript-eslint/typescript-eslint/issues/2006)) ([264b017](https://github.com/typescript-eslint/typescript-eslint/commit/264b017c11c2ab132fcbad18b42a9a0fe639386e)) -* **eslint-plugin:** [strict-boolean-expression] rework options ([#1631](https://github.com/typescript-eslint/typescript-eslint/issues/1631)) ([cd14482](https://github.com/typescript-eslint/typescript-eslint/commit/cd1448240dca11762fcb9c10e18bb6541a840485)) -* **eslint-plugin:** delete deprecated rules ([#2002](https://github.com/typescript-eslint/typescript-eslint/issues/2002)) ([da0aec2](https://github.com/typescript-eslint/typescript-eslint/commit/da0aec2cfa27902aae7c438a2fe91343c822e4ae)) -* **eslint-plugin:** eslint-recommended: disable no-func-assign ([#984](https://github.com/typescript-eslint/typescript-eslint/issues/984)) ([ae9b8a9](https://github.com/typescript-eslint/typescript-eslint/commit/ae9b8a9c73c0328287de956466257d8bbfbdb20f)) -* **eslint-plugin:** eslint-recommended: disable no-obj-calls ([#1000](https://github.com/typescript-eslint/typescript-eslint/issues/1000)) ([b9ca14c](https://github.com/typescript-eslint/typescript-eslint/commit/b9ca14c5f5ec28a3fde1a9b2d2f6a4dc74d903e4)) -* **eslint-plugin:** update `eslint-recommended` set ([#1996](https://github.com/typescript-eslint/typescript-eslint/issues/1996)) ([9a96e18](https://github.com/typescript-eslint/typescript-eslint/commit/9a96e18400e0a0d738d159d9d01faf41d3586249)) -* **eslint-plugin:** update recommended sets ([#2001](https://github.com/typescript-eslint/typescript-eslint/issues/2001)) ([0126b4f](https://github.com/typescript-eslint/typescript-eslint/commit/0126b4f56f9197d561e90b09962ccceb4f88bc41)) -* **typescript-estree:** align nodes with estree 2020 ([#1389](https://github.com/typescript-eslint/typescript-eslint/issues/1389)) ([aff5b62](https://github.com/typescript-eslint/typescript-eslint/commit/aff5b62044f9b93f2087a1d261e9be3f8d6fd54d)) -* drop support for node v8 ([#1997](https://github.com/typescript-eslint/typescript-eslint/issues/1997)) ([b6c3b7b](https://github.com/typescript-eslint/typescript-eslint/commit/b6c3b7b84b8d199fa75a46432febd4a364a63217)) -* **typescript-estree:** always return parserServices ([#716](https://github.com/typescript-eslint/typescript-eslint/issues/716)) ([5b23443](https://github.com/typescript-eslint/typescript-eslint/commit/5b23443c48f3f62424db3e742243f3568080b946)) -* **typescript-estree:** handle 3.9's non-null assertion changes ([#2036](https://github.com/typescript-eslint/typescript-eslint/issues/2036)) ([06bec63](https://github.com/typescript-eslint/typescript-eslint/commit/06bec63c56536db070608ab136d2ad57083f0c6a)) - - +- **eslint-plugin:** [consistent-type-imports] incorrect handling of computed property type signatures ([#2990](https://github.com/typescript-eslint/typescript-eslint/issues/2990)) ([58f2655](https://github.com/typescript-eslint/typescript-eslint/commit/58f26555f62b5f59f13260306638d3148cde6079)), closes [#2989](https://github.com/typescript-eslint/typescript-eslint/issues/2989) +- **scope-manager:** correctly reference generic parameters when decorator metadata is enabled ([#2975](https://github.com/typescript-eslint/typescript-eslint/issues/2975)) ([7695ef3](https://github.com/typescript-eslint/typescript-eslint/commit/7695ef318f1cc8688acaabf4f2730769622f083f)), closes [#2972](https://github.com/typescript-eslint/typescript-eslint/issues/2972) +## [4.14.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.0...v4.14.1) (2021-01-25) +### Bug Fixes -# [2.34.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.33.0...v2.34.0) (2020-05-18) +- **eslint-plugin:** [sort-type-union-intersection-members] consider `void` as a `nullish` ([#2944](https://github.com/typescript-eslint/typescript-eslint/issues/2944)) ([a241b25](https://github.com/typescript-eslint/typescript-eslint/commit/a241b25863eb063986fab76b511f478bbba91f47)), closes [#2940](https://github.com/typescript-eslint/typescript-eslint/issues/2940) +- **scope-manager:** fix incorrect handling of class decorators and class method default params ([#2943](https://github.com/typescript-eslint/typescript-eslint/issues/2943)) ([e1eac83](https://github.com/typescript-eslint/typescript-eslint/commit/e1eac8312268d1855a2ed7784b4d190ecb9c9fa4)), closes [#2941](https://github.com/typescript-eslint/typescript-eslint/issues/2941) [#2942](https://github.com/typescript-eslint/typescript-eslint/issues/2942) [#2751](https://github.com/typescript-eslint/typescript-eslint/issues/2751) +# [4.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.13.0...v4.14.0) (2021-01-18) ### Features -* **eslint-plugin:** [no-invalid-void-type] allow union of void and `allowInGenericTypeArguments` ([#1960](https://github.com/typescript-eslint/typescript-eslint/issues/1960)) ([1bc105a](https://github.com/typescript-eslint/typescript-eslint/commit/1bc105a2c6ae3fde9596f0419fed0de699dc57c7)) -* **eslint-plugin:** [restrict-template-expressions] improve error message ([#1926](https://github.com/typescript-eslint/typescript-eslint/issues/1926)) ([1af59ba](https://github.com/typescript-eslint/typescript-eslint/commit/1af59ba8ac0ceabb008d9c61556acf7db0a1d352)) -* **experimental-utils:** add `suggestion` property for rule modules ([#2033](https://github.com/typescript-eslint/typescript-eslint/issues/2033)) ([f42a5b0](https://github.com/typescript-eslint/typescript-eslint/commit/f42a5b09ebfa173f418a99c552b0cbe221567194)) - - - +- add support for decorator metadata in scope analysis and in consistent-type-imports ([#2751](https://github.com/typescript-eslint/typescript-eslint/issues/2751)) ([445e416](https://github.com/typescript-eslint/typescript-eslint/commit/445e416878b27a54bf07c2d3b84dabd7b06e51bc)), closes [#2559](https://github.com/typescript-eslint/typescript-eslint/issues/2559) +- **eslint-plugin:** add `object-curly-spacing` rule ([#2892](https://github.com/typescript-eslint/typescript-eslint/issues/2892)) ([32bd18d](https://github.com/typescript-eslint/typescript-eslint/commit/32bd18de80f4f8388717d0f0c16d493234362aa5)) +# [4.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.12.0...v4.13.0) (2021-01-11) -# [2.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.32.0...v2.33.0) (2020-05-12) +### Bug Fixes +- **eslint-plugin:** support eslint@5 ([#2917](https://github.com/typescript-eslint/typescript-eslint/issues/2917)) ([f606846](https://github.com/typescript-eslint/typescript-eslint/commit/f606846af2617a0d8ee3ad5ce7c10864161ebf53)) ### Features -* **eslint-plugin:** add extension rule `lines-between-class-members` ([#1684](https://github.com/typescript-eslint/typescript-eslint/issues/1684)) ([08f93e6](https://github.com/typescript-eslint/typescript-eslint/commit/08f93e69347a8e7f3a7e8a1455bb5d069c2faeef)) - - - - - -# [2.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.31.0...v2.32.0) (2020-05-11) +- **eslint-plugin:** [sort-type-union-intersection-members] add nullish group ([#2919](https://github.com/typescript-eslint/typescript-eslint/issues/2919)) ([5558f41](https://github.com/typescript-eslint/typescript-eslint/commit/5558f410007da58a3f4726bbf9501c924ef166a1)) +# [4.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.11.1...v4.12.0) (2021-01-04) ### Bug Fixes -* **eslint-plugin:** [no-base-to-string] support boolean in unions ([#1979](https://github.com/typescript-eslint/typescript-eslint/issues/1979)) ([6987ecc](https://github.com/typescript-eslint/typescript-eslint/commit/6987ecc1dacfb45c0f8ed3e81d08aa708eb96ad1)) -* **eslint-plugin:** [no-type-alias] handle readonly types in aliases ([#1990](https://github.com/typescript-eslint/typescript-eslint/issues/1990)) ([56d9870](https://github.com/typescript-eslint/typescript-eslint/commit/56d987070f83d1b6410b04750b20a761fd793073)) -* **eslint-plugin:** [no-unused-expressions] inherit `messages` from base rule ([#1992](https://github.com/typescript-eslint/typescript-eslint/issues/1992)) ([51ca404](https://github.com/typescript-eslint/typescript-eslint/commit/51ca404af645eed194269ab7f8f67b97bd52e32d)) - +- **eslint-plugin:** [comma-spacing] handle empty type params ([#2915](https://github.com/typescript-eslint/typescript-eslint/issues/2915)) ([4d69fbb](https://github.com/typescript-eslint/typescript-eslint/commit/4d69fbba91ea3161213a0ab093e398fed091168c)) ### Features -* bump dependencies and align AST ([#2007](https://github.com/typescript-eslint/typescript-eslint/issues/2007)) ([18668b7](https://github.com/typescript-eslint/typescript-eslint/commit/18668b78fd7d1e5281af7fc26c76e0ca53297f69)) - - +- **eslint-plugin:** add rule `sort-type-union-intersection-members` ([#2913](https://github.com/typescript-eslint/typescript-eslint/issues/2913)) ([9092c04](https://github.com/typescript-eslint/typescript-eslint/commit/9092c0494ebd3486e38852198c1930f1432ef21f)) +## [4.11.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.11.0...v4.11.1) (2020-12-28) +### Bug Fixes -# [2.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.30.0...v2.31.0) (2020-05-04) +- **eslint-plugin:** [naming-convention] fix precedence of method and property meta selectors ([#2877](https://github.com/typescript-eslint/typescript-eslint/issues/2877)) ([2f10e1a](https://github.com/typescript-eslint/typescript-eslint/commit/2f10e1a5c795cac28a6e0a1a3a0adb5bd6be7f1c)) +# [4.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.10.0...v4.11.0) (2020-12-21) ### Bug Fixes -* **eslint-plugin:** [dot-notation] handle missing declarations ([#1947](https://github.com/typescript-eslint/typescript-eslint/issues/1947)) ([383f931](https://github.com/typescript-eslint/typescript-eslint/commit/383f93182599c00e231a0f0d36575ca0e19369a6)) -* **eslint-plugin:** [method-signature-style] fix overloaded methods to an intersection type ([#1966](https://github.com/typescript-eslint/typescript-eslint/issues/1966)) ([7f3fba3](https://github.com/typescript-eslint/typescript-eslint/commit/7f3fba348d432d7637e1c737df943ee1f9105062)) -* **eslint-plugin:** [return-await] await in a normal function ([#1962](https://github.com/typescript-eslint/typescript-eslint/issues/1962)) ([f82fd7b](https://github.com/typescript-eslint/typescript-eslint/commit/f82fd7bb81f986c4861d0b4e2ecdb0c496d7a602)) -* **eslint-plugin:** [unbound-method] false positives for unary expressions ([#1964](https://github.com/typescript-eslint/typescript-eslint/issues/1964)) ([b35070e](https://github.com/typescript-eslint/typescript-eslint/commit/b35070ec6f84ad5ce606386cdb6eeb91488dfdd7)) -* **eslint-plugin:** no-base-to-string boolean expression detect ([#1969](https://github.com/typescript-eslint/typescript-eslint/issues/1969)) ([f78f13a](https://github.com/typescript-eslint/typescript-eslint/commit/f78f13aedd59d5b5880903d48c779a6c50fd937e)) - +- **eslint-plugin:** [non-nullable-type-assertion-style] handle const assertion ([#2881](https://github.com/typescript-eslint/typescript-eslint/issues/2881)) ([53dc34d](https://github.com/typescript-eslint/typescript-eslint/commit/53dc34d3917b90c8ab0324fe8054619ddee98003)) ### Features -* **eslint-plugin:** [member-ordering] add decorators support ([#1870](https://github.com/typescript-eslint/typescript-eslint/issues/1870)) ([f7ec192](https://github.com/typescript-eslint/typescript-eslint/commit/f7ec1920607cb8eec8020b08cd7247de0bf19ce1)) -* **eslint-plugin:** [prefer-optional-chain] added option to convert to suggestion fixer ([#1965](https://github.com/typescript-eslint/typescript-eslint/issues/1965)) ([2f0824b](https://github.com/typescript-eslint/typescript-eslint/commit/2f0824b0a41f3043b6242fc1d49faae540abaf22)) -* **eslint-plugin:** new extended rule 'no-invalid-this' ([#1823](https://github.com/typescript-eslint/typescript-eslint/issues/1823)) ([b18bc35](https://github.com/typescript-eslint/typescript-eslint/commit/b18bc357507337b9725f8d9c1b549513075a0da5)) -* **experimental-utils:** expose our RuleTester extension ([#1948](https://github.com/typescript-eslint/typescript-eslint/issues/1948)) ([2dd1638](https://github.com/typescript-eslint/typescript-eslint/commit/2dd1638aaa2658ba99b2341861146b586f489121)) - - - - - -# [2.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.29.0...v2.30.0) (2020-04-27) +- **eslint-plugin:** [prom-func-async] add automatic fix ([#2845](https://github.com/typescript-eslint/typescript-eslint/issues/2845)) ([717e718](https://github.com/typescript-eslint/typescript-eslint/commit/717e718e91df2165422228c02dfa248cf55f65a1)) +# [4.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.9.1...v4.10.0) (2020-12-14) ### Bug Fixes -* **eslint-plugin:** [prefer-string-starts-ends-with] check for negative start index in slice ([#1920](https://github.com/typescript-eslint/typescript-eslint/issues/1920)) ([ed2bd60](https://github.com/typescript-eslint/typescript-eslint/commit/ed2bd6067f74ae33e36a084719bb91efedfba599)) -* **eslint-plugin:** fix no-base-to-string boolean literal check ([#1850](https://github.com/typescript-eslint/typescript-eslint/issues/1850)) ([2f45e99](https://github.com/typescript-eslint/typescript-eslint/commit/2f45e9992a8f12b6233716e77a6159f9cea2c879)) - +- **eslint-plugin:** [naming-convention] fix wrong member of `method` and `property` meta selectors ([#2856](https://github.com/typescript-eslint/typescript-eslint/issues/2856)) ([9a6c362](https://github.com/typescript-eslint/typescript-eslint/commit/9a6c3628a2f3a7748b7a4b9b0c55400c8d7dfeae)) ### Features -* **eslint-plugin:** add extension rule `dot-notation` ([#1867](https://github.com/typescript-eslint/typescript-eslint/issues/1867)) ([a85c3e1](https://github.com/typescript-eslint/typescript-eslint/commit/a85c3e1515d735b6c245cc658cdaec6deb05d630)) -* **eslint-plugin:** create `no-invalid-void-type` rule ([#1847](https://github.com/typescript-eslint/typescript-eslint/issues/1847)) ([f667ff1](https://github.com/typescript-eslint/typescript-eslint/commit/f667ff1708d4ed28b7ea5beea742889da69a76d9)) - - +- **eslint-plugin:** add rule `non-nullable-type-assertion-style` ([#2624](https://github.com/typescript-eslint/typescript-eslint/issues/2624)) ([7eee44f](https://github.com/typescript-eslint/typescript-eslint/commit/7eee44fff3041a9725d34bf2fcbfc6fd40a60c61)) +## [4.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.9.0...v4.9.1) (2020-12-07) +### Bug Fixes -# [2.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.28.0...v2.29.0) (2020-04-20) +- **eslint-plugin:** [method-signature-style] fix crash with methods without a return type ([#2836](https://github.com/typescript-eslint/typescript-eslint/issues/2836)) ([fed89f2](https://github.com/typescript-eslint/typescript-eslint/commit/fed89f24ebe42a6412f0eb19949d5d4771656189)), closes [#2834](https://github.com/typescript-eslint/typescript-eslint/issues/2834) +- **eslint-plugin:** [no-unused-vars] false-positive with class expressions ([#2833](https://github.com/typescript-eslint/typescript-eslint/issues/2833)) ([aadb39f](https://github.com/typescript-eslint/typescript-eslint/commit/aadb39f0ff500ee99ea80e9009ab61283ca9c8cd)), closes [#2831](https://github.com/typescript-eslint/typescript-eslint/issues/2831) +- **eslint-plugin:** [no-unused-vars] fix race condition between naming-convention and no-unused-vars ([#2848](https://github.com/typescript-eslint/typescript-eslint/issues/2848)) ([ccb6b94](https://github.com/typescript-eslint/typescript-eslint/commit/ccb6b9499a4a4077f2e3d81d0844860a25244a0f)), closes [#2844](https://github.com/typescript-eslint/typescript-eslint/issues/2844) +# [4.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.2...v4.9.0) (2020-11-30) ### Bug Fixes -* **eslint-plugin:** [no-base-to-string] soft remove `ignoreTaggedTemplateExpressions` option ([#1916](https://github.com/typescript-eslint/typescript-eslint/issues/1916)) ([369978e](https://github.com/typescript-eslint/typescript-eslint/commit/369978e9685bacb3e3882b0510ff06eaf8df4ca1)) - +- **eslint-plugin:** [consistent-indexed-object-style] convert readonly index signature to readonly record ([#2798](https://github.com/typescript-eslint/typescript-eslint/issues/2798)) ([29428a4](https://github.com/typescript-eslint/typescript-eslint/commit/29428a4dbef133563f2ee54b22908a01ab9a9472)) +- **eslint-plugin:** [consistent-type-imports] crash when using both default and namespace in one import ([#2778](https://github.com/typescript-eslint/typescript-eslint/issues/2778)) ([c816b84](https://github.com/typescript-eslint/typescript-eslint/commit/c816b84814214f7504a0d89a5cd3b08c595bfb50)) +- **eslint-plugin:** [explicit-module-boundary-types] ignore functions exported within typed object/array literals ([#2805](https://github.com/typescript-eslint/typescript-eslint/issues/2805)) ([73a63ee](https://github.com/typescript-eslint/typescript-eslint/commit/73a63ee9ea00b2db0a29f148d7863c3778e4a483)) +- **eslint-plugin:** [no-use-before-define] allow class references if they're within a class decorator ([#2827](https://github.com/typescript-eslint/typescript-eslint/issues/2827)) ([050023a](https://github.com/typescript-eslint/typescript-eslint/commit/050023aa7bd791d0be7b5788a9dcd8e61a00ce79)), closes [#2842](https://github.com/typescript-eslint/typescript-eslint/issues/2842) +- **eslint-plugin:** [triple-slash-reference] fix crash with external module reference ([#2788](https://github.com/typescript-eslint/typescript-eslint/issues/2788)) ([32b1b68](https://github.com/typescript-eslint/typescript-eslint/commit/32b1b6839fb32d93b7faa8fec74c9cb68ea587bb)) +- **scope-manager:** fix assertion assignments not being marked as write references ([#2809](https://github.com/typescript-eslint/typescript-eslint/issues/2809)) ([fa68492](https://github.com/typescript-eslint/typescript-eslint/commit/fa6849245ca55ca407dc031afbad456f2925a8e9)), closes [#2804](https://github.com/typescript-eslint/typescript-eslint/issues/2804) ### Features -* **eslint-plugin:** [no-floating-promise] add option to ignore IIFEs ([#1799](https://github.com/typescript-eslint/typescript-eslint/issues/1799)) ([cea51bf](https://github.com/typescript-eslint/typescript-eslint/commit/cea51bf130d6d3c2935f5e2dcc468196f2ad9d00)) -* **eslint-plugin:** [restrict-template-expressions] add support for intersection types ([#1803](https://github.com/typescript-eslint/typescript-eslint/issues/1803)) ([cc70e4f](https://github.com/typescript-eslint/typescript-eslint/commit/cc70e4fbadd0b15fd6af913a2e1e2ddd346fa558)) -* **eslint-plugin:** add extension rule `init-declarations` ([#1814](https://github.com/typescript-eslint/typescript-eslint/issues/1814)) ([b01f5e7](https://github.com/typescript-eslint/typescript-eslint/commit/b01f5e778ac28e0797a3734fc58d025bb224f418)) -* **eslint-plugin:** add extension rule `keyword-spacing` ([#1739](https://github.com/typescript-eslint/typescript-eslint/issues/1739)) ([c5106dd](https://github.com/typescript-eslint/typescript-eslint/commit/c5106dd4bf2bc8846cc39aa8bb50c33bec026d4d)) +- **eslint-plugin:** [naming-convention] add `requireDouble`, `allowDouble`, `allowSingleOrDouble` options for underscores ([#2812](https://github.com/typescript-eslint/typescript-eslint/issues/2812)) ([dd0576a](https://github.com/typescript-eslint/typescript-eslint/commit/dd0576a66c34810bc60e0958948c9a8104a3f1a3)) +- **eslint-plugin:** [naming-convention] add `requiresQuotes` modifier ([#2813](https://github.com/typescript-eslint/typescript-eslint/issues/2813)) ([6fc8409](https://github.com/typescript-eslint/typescript-eslint/commit/6fc84094928c3645a0e04c31bd4d759fdfbdcb74)), closes [#2761](https://github.com/typescript-eslint/typescript-eslint/issues/2761) [#1483](https://github.com/typescript-eslint/typescript-eslint/issues/1483) +- **eslint-plugin:** [naming-convention] add modifier `unused` ([#2810](https://github.com/typescript-eslint/typescript-eslint/issues/2810)) ([6a06944](https://github.com/typescript-eslint/typescript-eslint/commit/6a06944e60677a402e7ab432e6ac1209737a7027)) +- **eslint-plugin:** [naming-convention] add modifiers `exported`, `global`, and `destructured` ([#2808](https://github.com/typescript-eslint/typescript-eslint/issues/2808)) ([fb254a1](https://github.com/typescript-eslint/typescript-eslint/commit/fb254a1036b89f9b78f927d607358e65e81a2250)), closes [#2239](https://github.com/typescript-eslint/typescript-eslint/issues/2239) [#2512](https://github.com/typescript-eslint/typescript-eslint/issues/2512) [#2318](https://github.com/typescript-eslint/typescript-eslint/issues/2318) [#2802](https://github.com/typescript-eslint/typescript-eslint/issues/2802) +- **eslint-plugin:** [naming-convention] allow `destructured` modifier for `parameter` selector ([#2829](https://github.com/typescript-eslint/typescript-eslint/issues/2829)) ([525d2ff](https://github.com/typescript-eslint/typescript-eslint/commit/525d2ff9292d89e1445b273b5378159bca323a1e)), closes [#2828](https://github.com/typescript-eslint/typescript-eslint/issues/2828) +- **eslint-plugin:** [naming-convention] split `property` and `method` selectors into more granular `classXXX`, `objectLiteralXXX`, `typeXXX` ([#2807](https://github.com/typescript-eslint/typescript-eslint/issues/2807)) ([665b6d4](https://github.com/typescript-eslint/typescript-eslint/commit/665b6d4023fb9d821f348c39aefff0d7571a98bf)), closes [#1477](https://github.com/typescript-eslint/typescript-eslint/issues/1477) [#2802](https://github.com/typescript-eslint/typescript-eslint/issues/2802) +- **eslint-plugin:** [no-unused-vars] fork the base rule ([#2768](https://github.com/typescript-eslint/typescript-eslint/issues/2768)) ([a8227a6](https://github.com/typescript-eslint/typescript-eslint/commit/a8227a6185dd24de4bfc7d766931643871155021)), closes [#2782](https://github.com/typescript-eslint/typescript-eslint/issues/2782) [#2714](https://github.com/typescript-eslint/typescript-eslint/issues/2714) [#2648](https://github.com/typescript-eslint/typescript-eslint/issues/2648) +- **eslint-plugin:** [unbound-method] add support for methods with a `this: void` parameter ([#2796](https://github.com/typescript-eslint/typescript-eslint/issues/2796)) ([878dd4a](https://github.com/typescript-eslint/typescript-eslint/commit/878dd4ae8c408f1eb42790a8fac37f85040b7f3c)) +## [4.8.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.1...v4.8.2) (2020-11-23) +### Bug Fixes +- **eslint-plugin:** [prefer-literal-enum-member] allow pure template literal strings ([#2786](https://github.com/typescript-eslint/typescript-eslint/issues/2786)) ([f3bf6a1](https://github.com/typescript-eslint/typescript-eslint/commit/f3bf6a1791c9dc64bb18d45712f07767c9f96cbd)) +## [4.8.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.0...v4.8.1) (2020-11-17) -# [2.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.27.0...v2.28.0) (2020-04-13) +### Bug Fixes + +- **eslint-plugin:** [no-unnecessary-condition] false positive when array predicate returns unknown ([#2772](https://github.com/typescript-eslint/typescript-eslint/issues/2772)) ([111c244](https://github.com/typescript-eslint/typescript-eslint/commit/111c244c3eb157efeb5c43ff39f12633b27f091e)) +# [4.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.7.0...v4.8.0) (2020-11-16) ### Bug Fixes -* **eslint-plugin:** [method-signature-style] handle multiline params ([#1861](https://github.com/typescript-eslint/typescript-eslint/issues/1861)) ([5832a86](https://github.com/typescript-eslint/typescript-eslint/commit/5832a8643bbe174ec02df5966bb333e506e45f5d)) -* **eslint-plugin:** [no-empty-interface] use suggestion fixer for ambient contexts ([#1880](https://github.com/typescript-eslint/typescript-eslint/issues/1880)) ([62b2278](https://github.com/typescript-eslint/typescript-eslint/commit/62b2278aec0011c93eae17bed8b278114d3379a2)) -* **eslint-plugin:** [unbound-method] false positive on property function initializer ([#1890](https://github.com/typescript-eslint/typescript-eslint/issues/1890)) ([f1c3b18](https://github.com/typescript-eslint/typescript-eslint/commit/f1c3b18f7aadc81f7dca7aa32aa1a8fe424e04e7)) -* **eslint-plugin:** [unbound-method] ignore assignments _to_ methods ([#1736](https://github.com/typescript-eslint/typescript-eslint/issues/1736)) ([6b4680b](https://github.com/typescript-eslint/typescript-eslint/commit/6b4680b6e7343d9d98fa1de170f387a36d98b73e)) -* **eslint-plugin:** no-empty-interface autofix ([#1865](https://github.com/typescript-eslint/typescript-eslint/issues/1865)) ([829a2f7](https://github.com/typescript-eslint/typescript-eslint/commit/829a2f728f876d356908e2338c2d6620e58f9943)), closes [#1864](https://github.com/typescript-eslint/typescript-eslint/issues/1864) -* **eslint-plugin:** use `isTypeArrayTypeOrUnionOfArrayTypes` util for checking if type is array ([#1728](https://github.com/typescript-eslint/typescript-eslint/issues/1728)) ([05030f8](https://github.com/typescript-eslint/typescript-eslint/commit/05030f8d2bd5a50e95053bc61380891da71cc567)) +- **eslint-plugin:** [consistent-type-definitions] remove fixer when the interface is within a global module declaration ([#2739](https://github.com/typescript-eslint/typescript-eslint/issues/2739)) ([2326238](https://github.com/typescript-eslint/typescript-eslint/commit/2326238738c95acfc14c17f9b16798f1de6d267f)) +- **eslint-plugin:** [no-unsafe-member-access] ignore MemberExpression's whose parents are either TSClassImplements or TSInterfaceHeritage ([#2753](https://github.com/typescript-eslint/typescript-eslint/issues/2753)) ([535db3b](https://github.com/typescript-eslint/typescript-eslint/commit/535db3bf27ee1d7824ada9acd91d1b7833064628)) +# [4.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.6.1...v4.7.0) (2020-11-09) -### Features +### Bug Fixes -* **eslint-plugin:** [ban-ts-comment] support `ts-expect-error` ([#1706](https://github.com/typescript-eslint/typescript-eslint/issues/1706)) ([469cff3](https://github.com/typescript-eslint/typescript-eslint/commit/469cff332c041f38f60de052769287342455cff1)) -* **eslint-plugin:** [consistent-type-assertions] always allow `const` assertions ([#1713](https://github.com/typescript-eslint/typescript-eslint/issues/1713)) ([af2c00d](https://github.com/typescript-eslint/typescript-eslint/commit/af2c00de62f7e31eaeb88996ebf3f330cc8473b9)) -* **eslint-plugin:** [explicit-function-return-type] add option to allow concise arrows that start with void ([#1732](https://github.com/typescript-eslint/typescript-eslint/issues/1732)) ([2e9c202](https://github.com/typescript-eslint/typescript-eslint/commit/2e9c2028a8a0b226e0f87d4bcc997fa259ca3ebd)) -* **eslint-plugin:** [explicit-module-boundary-types] add optio… ([#1778](https://github.com/typescript-eslint/typescript-eslint/issues/1778)) ([3eee804](https://github.com/typescript-eslint/typescript-eslint/commit/3eee804461d017ea6189cd7f64fcd473623684b4)) -* **eslint-plugin:** [no-base-to-string] add option to ignore tagged templates ([#1763](https://github.com/typescript-eslint/typescript-eslint/issues/1763)) ([f5edb99](https://github.com/typescript-eslint/typescript-eslint/commit/f5edb9938c33f8b68f026eba00db3abe9359ced3)) -* **eslint-plugin:** [restrict-template-expressions] add option `allowAny` ([#1762](https://github.com/typescript-eslint/typescript-eslint/issues/1762)) ([d44c0f9](https://github.com/typescript-eslint/typescript-eslint/commit/d44c0f9bed2404ca00b020b35fd825929e213398)) -* **eslint-plugin:** add rule `prefer-reduce-type-parameter` ([#1707](https://github.com/typescript-eslint/typescript-eslint/issues/1707)) ([c92d240](https://github.com/typescript-eslint/typescript-eslint/commit/c92d240e49113779053eac32038382b282812afc)) -* **eslint-plugin:** add rule `prefer-ts-expect-error` ([#1705](https://github.com/typescript-eslint/typescript-eslint/issues/1705)) ([7021f21](https://github.com/typescript-eslint/typescript-eslint/commit/7021f2151a25db2a8edf17e06cd6f21e90761ec8)) -* **eslint-plugin:** add rule no-unsafe-assignment ([#1694](https://github.com/typescript-eslint/typescript-eslint/issues/1694)) ([a49b860](https://github.com/typescript-eslint/typescript-eslint/commit/a49b860cbbb2c7d718b99f561e2fb6eaadf16f17)) +- **eslint-plugin:** [array-type] parenthesize ReadonlyArray fix ([#2747](https://github.com/typescript-eslint/typescript-eslint/issues/2747)) ([83385ac](https://github.com/typescript-eslint/typescript-eslint/commit/83385ac351f45d3bcbd19f72711838e9a8473827)) +- **eslint-plugin:** [no-extra-non-null-assertion] false positive with non-nullable computed key ([#2737](https://github.com/typescript-eslint/typescript-eslint/issues/2737)) ([e82698c](https://github.com/typescript-eslint/typescript-eslint/commit/e82698c0ec796e460e40c3dd90a30bd100db05c2)) +### Features +- **eslint-plugin:** add rule `no-confusing-void-expression` ([#2605](https://github.com/typescript-eslint/typescript-eslint/issues/2605)) ([c8a4dad](https://github.com/typescript-eslint/typescript-eslint/commit/c8a4dadeab8a64fb4768deda8f65475435dd2cad)) +- support TS4.1 features ([#2748](https://github.com/typescript-eslint/typescript-eslint/issues/2748)) ([2be354b](https://github.com/typescript-eslint/typescript-eslint/commit/2be354bb15f9013a2da1b13a0c0836e9ef057e16)), closes [#2583](https://github.com/typescript-eslint/typescript-eslint/issues/2583) +## [4.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.6.0...v4.6.1) (2020-11-02) +### Bug Fixes -# [2.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.26.0...v2.27.0) (2020-04-06) +- **eslint-plugin:** [consistent-indexed-object-style] fix wrong autofix behaviour with generics ([#2722](https://github.com/typescript-eslint/typescript-eslint/issues/2722)) ([73d9713](https://github.com/typescript-eslint/typescript-eslint/commit/73d97130afe79b8a458c215581ce86c62009ad8b)) +- **eslint-plugin:** [no-shadow] ignore global module augmentation ([#2729](https://github.com/typescript-eslint/typescript-eslint/issues/2729)) ([d8c67a5](https://github.com/typescript-eslint/typescript-eslint/commit/d8c67a564a4cada5add8587f655aee2305cbc562)) +# [4.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.5.0...v4.6.0) (2020-10-26) ### Bug Fixes -* **eslint-plugin:** [no-throw-literal] fix crash caused by getBaseTypes ([#1830](https://github.com/typescript-eslint/typescript-eslint/issues/1830)) ([9d53c76](https://github.com/typescript-eslint/typescript-eslint/commit/9d53c761983dd964109b9f13eb9bfe20caf9defb)) -* **eslint-plugin:** [no-unsafe-call] fix incorrect selector ([#1826](https://github.com/typescript-eslint/typescript-eslint/issues/1826)) ([8ec53a3](https://github.com/typescript-eslint/typescript-eslint/commit/8ec53a3579fcb59cdffea0c60fbb755d056f4c8a)) -* **eslint-plugin:** [require-await] handle async generators ([#1782](https://github.com/typescript-eslint/typescript-eslint/issues/1782)) ([9642d9d](https://github.com/typescript-eslint/typescript-eslint/commit/9642d9dce693befac89a4e9d8bf8dd18f4361e2a)) -* **eslint-plugin:** no-explicit-any constructor functions (& mo… ([#1711](https://github.com/typescript-eslint/typescript-eslint/issues/1711)) ([ab8572e](https://github.com/typescript-eslint/typescript-eslint/commit/ab8572e30e14ebda91c8437be5ee35e7dc9add2e)) - +- **eslint-plugin:** [method-signature-style] correct fixer for overloads in an object literal type ([#2708](https://github.com/typescript-eslint/typescript-eslint/issues/2708)) ([0763913](https://github.com/typescript-eslint/typescript-eslint/commit/0763913c4a0d1061465ae3329704f1a7de4b9326)) +- **eslint-plugin:** [method-signature-style] don't auto-fix interfaces within namespaces ([#2678](https://github.com/typescript-eslint/typescript-eslint/issues/2678)) ([e012049](https://github.com/typescript-eslint/typescript-eslint/commit/e01204931e460f5e6731abc443c88d666ca0b07a)) +- **eslint-plugin:** [prefer-string-starts-ends-with] Check negative indices in the second position for slice ([#2696](https://github.com/typescript-eslint/typescript-eslint/issues/2696)) ([66e9c6e](https://github.com/typescript-eslint/typescript-eslint/commit/66e9c6e29f9f56bbd178ba6405f47053be591258)) ### Features -* **eslint-plugin:** new rule method-signature-style ([#1685](https://github.com/typescript-eslint/typescript-eslint/issues/1685)) ([c49d771](https://github.com/typescript-eslint/typescript-eslint/commit/c49d771ba62f1a21d3c1aec106341daddfcd3c9a)) -* **eslint-plugin:** sort members alphabetically ([#263](https://github.com/typescript-eslint/typescript-eslint/issues/263)) ([485e902](https://github.com/typescript-eslint/typescript-eslint/commit/485e90213a0f8baac0587f7d56925448883fc5bd)) -* **eslint-plugin-internal:** add plugin-test-formatting rule ([#1821](https://github.com/typescript-eslint/typescript-eslint/issues/1821)) ([9b0023a](https://github.com/typescript-eslint/typescript-eslint/commit/9b0023a4996ecdd7dfcb30abd1678091a78f3064)) +- **eslint-plugin:** [ban-types] support banning `[]` ([#2704](https://github.com/typescript-eslint/typescript-eslint/issues/2704)) ([ef8b5a7](https://github.com/typescript-eslint/typescript-eslint/commit/ef8b5a7e09cca4bdacf205da28f99f2b1a419d00)), closes [#2582](https://github.com/typescript-eslint/typescript-eslint/issues/2582) +- **eslint-plugin:** add `no-unnecessary-type-constraint` rule ([#2516](https://github.com/typescript-eslint/typescript-eslint/issues/2516)) ([880ac75](https://github.com/typescript-eslint/typescript-eslint/commit/880ac753b90d63034f0a33f8f512d9fabc17c8f9)) +- **eslint-plugin:** add extension rule `space-infix-ops` ([#2593](https://github.com/typescript-eslint/typescript-eslint/issues/2593)) ([343d20d](https://github.com/typescript-eslint/typescript-eslint/commit/343d20db23a1640e3bca8cf52b7db1fa46e092e6)) +# [4.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.4.1...v4.5.0) (2020-10-19) +### Bug Fixes +- **eslint-plugin:** [array-type] fix issues with readonly option ([#2667](https://github.com/typescript-eslint/typescript-eslint/issues/2667)) ([63d1d81](https://github.com/typescript-eslint/typescript-eslint/commit/63d1d8189c829c6543c7966a864b62c07fbd61a0)) +- **eslint-plugin:** [lines-between-class-members] fix typo in schema ([#2681](https://github.com/typescript-eslint/typescript-eslint/issues/2681)) ([a2a2514](https://github.com/typescript-eslint/typescript-eslint/commit/a2a2514f8a8eee478c8697c4ce42d3c586599b14)) +- **eslint-plugin:** [naming-convention] check bodyless function parameters ([#2675](https://github.com/typescript-eslint/typescript-eslint/issues/2675)) ([c505863](https://github.com/typescript-eslint/typescript-eslint/commit/c505863ac41755383e08893ba0bc4c0fd937eb1d)) +- **eslint-plugin:** [no-invalid-this] allow "this" in class property definitions ([#2685](https://github.com/typescript-eslint/typescript-eslint/issues/2685)) ([dccb6ee](https://github.com/typescript-eslint/typescript-eslint/commit/dccb6ee9f1cd9519c26808d10a5bed8291d0a8e4)) +- **eslint-plugin:** [no-misused-promises] False negative in LogicalExpression ([#2682](https://github.com/typescript-eslint/typescript-eslint/issues/2682)) ([30a6951](https://github.com/typescript-eslint/typescript-eslint/commit/30a695103e99d214fd40847aaa51c1631981c226)), closes [#2544](https://github.com/typescript-eslint/typescript-eslint/issues/2544) +- **eslint-plugin:** [no-unnecessary-type-assertion] correct fixer for vue files ([#2680](https://github.com/typescript-eslint/typescript-eslint/issues/2680)) ([55111af](https://github.com/typescript-eslint/typescript-eslint/commit/55111afd7819d29d65da4f41cc6a129f34aaeb3e)) +- **eslint-plugin:** [return-await] do not auto-fix when type is `any`/`unknown` ([#2671](https://github.com/typescript-eslint/typescript-eslint/issues/2671)) ([d690c8d](https://github.com/typescript-eslint/typescript-eslint/commit/d690c8dff3636d8c8a9a38bd422e0bedbd1d72cb)) +### Features -# [2.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.25.0...v2.26.0) (2020-03-30) +- **eslint-plugin:** [dot-notation] add `allowProtectedClassPropertyAccess` option ([#2622](https://github.com/typescript-eslint/typescript-eslint/issues/2622)) ([bbc9e35](https://github.com/typescript-eslint/typescript-eslint/commit/bbc9e3540576891552dc2dc54b2acbc54104be9d)) +- **eslint-plugin:** [prefer-readonly-parameter-types] add `ignoreInferredTypes` option ([#2668](https://github.com/typescript-eslint/typescript-eslint/issues/2668)) ([91010e8](https://github.com/typescript-eslint/typescript-eslint/commit/91010e88258bf47a0438e842c8ddca19e0414b48)) +- **eslint-plugin:** [restrict-plus-operands] add intersection type determination logic ([#2628](https://github.com/typescript-eslint/typescript-eslint/issues/2628)) ([da71362](https://github.com/typescript-eslint/typescript-eslint/commit/da713627c88354229f245866ccf1018fb56b6e53)) +- **typescript-estree:** add flag EXPERIMENTAL_useSourceOfProjectReferenceRedirect ([#2669](https://github.com/typescript-eslint/typescript-eslint/issues/2669)) ([90a5878](https://github.com/typescript-eslint/typescript-eslint/commit/90a587845088da1b205e4d7d77dbc3f9447b1c5a)) +## [4.4.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.4.0...v4.4.1) (2020-10-12) ### Bug Fixes -* **eslint-plugin:** [no-explicit-any] error with ignoreRestArgs ([#1796](https://github.com/typescript-eslint/typescript-eslint/issues/1796)) ([638d84d](https://github.com/typescript-eslint/typescript-eslint/commit/638d84ddd77d07117b3ec7c5431f3b0e44b1995d)) -* **eslint-plugin:** [no-unsafe-call] allow import expressions ([#1800](https://github.com/typescript-eslint/typescript-eslint/issues/1800)) ([4fa7107](https://github.com/typescript-eslint/typescript-eslint/commit/4fa710754ecc412b65ac3864fe0c7857c254ac1b)) -* **eslint-plugin:** [no-unsafe-return] error with unknown ([#2371](https://github.com/typescript-eslint/typescript-eslint/issues/2371)) ([e7528e6](https://github.com/typescript-eslint/typescript-eslint/commit/e7528e686f5fe5cce8504fc15d3cd06b8733712e)) +- **typescript-estree:** support TSv4 labelled tuple members ([#2378](https://github.com/typescript-eslint/typescript-eslint/issues/2378)) ([00d84ff](https://github.com/typescript-eslint/typescript-eslint/commit/00d84ffbcbe9d0ec98bdb2f2ce59959a27ce4dbe)) +# [3.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.7.1...v3.8.0) (2020-08-03) +### Bug Fixes +- **eslint-plugin:** [no-implied-eval] don't report when `Function` is imported ([#2348](https://github.com/typescript-eslint/typescript-eslint/issues/2348)) ([fa169e7](https://github.com/typescript-eslint/typescript-eslint/commit/fa169e79661821f0e0e64a56d6db9da42c3c8654)) +- **eslint-plugin:** [no-unsafe-assignment] fix typo in message ([#2347](https://github.com/typescript-eslint/typescript-eslint/issues/2347)) ([2027bb1](https://github.com/typescript-eslint/typescript-eslint/commit/2027bb11689b76c297f93ba8a918b35fe68e5b9d)) +### Features -## [2.19.2](https://github.com/typescript-eslint/typescript-eslint/compare/v2.19.1...v2.19.2) (2020-02-10) +- **eslint-plugin:** [naming-convention] allow specifying an array of selectors ([#2335](https://github.com/typescript-eslint/typescript-eslint/issues/2335)) ([3ef6bd5](https://github.com/typescript-eslint/typescript-eslint/commit/3ef6bd5cadc225e42ef1330d15919a39f53f2a2b)) +- **eslint-plugin:** add `prefer-enum-initializers` rule ([#2326](https://github.com/typescript-eslint/typescript-eslint/issues/2326)) ([4f38ea3](https://github.com/typescript-eslint/typescript-eslint/commit/4f38ea39c97289db11501d6368d01db8c5787257)) -**Note:** Version bump only for package @typescript-eslint/eslint-plugin +## [3.7.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.7.0...v3.7.1) (2020-07-27) +### Bug Fixes +- **eslint-plugin:** [adjacent-overload-signatures] fix false positive on call signatures and a method named `call` ([#2313](https://github.com/typescript-eslint/typescript-eslint/issues/2313)) ([30fafb0](https://github.com/typescript-eslint/typescript-eslint/commit/30fafb09422b3aca881f4785d89b0536092d4952)) +- **eslint-plugin:** [no-extra-parens] stop reporting on calling generic functions with one argument and type parameters containing parentheses ([#2319](https://github.com/typescript-eslint/typescript-eslint/issues/2319)) ([616a841](https://github.com/typescript-eslint/typescript-eslint/commit/616a841032bec310d9f31f1c987888273df27008)) +# [3.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.6.1...v3.7.0) (2020-07-20) +### Features -## [2.19.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.19.0...v2.19.1) (2020-02-10) +- **eslint-plugin:** [naming-convention] allow selecting only `const` variables ([#2291](https://github.com/typescript-eslint/typescript-eslint/issues/2291)) ([156d058](https://github.com/typescript-eslint/typescript-eslint/commit/156d058fee835fdf1ed827a5ad4a80d57190cc54)) +- **eslint-plugin:** [no-empty-function] add `decoratedFunctions` option ([#2295](https://github.com/typescript-eslint/typescript-eslint/issues/2295)) ([88f08f4](https://github.com/typescript-eslint/typescript-eslint/commit/88f08f410760f58fdc2de58ecd9dab9610821642)) +## [3.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.6.0...v3.6.1) (2020-07-13) ### Bug Fixes -* **eslint-plugin:** [unbound-method] blacklist a few unbound natives ([#1562](https://github.com/typescript-eslint/typescript-eslint/issues/1562)) ([4670aab](https://github.com/typescript-eslint/typescript-eslint/commit/4670aabef31d9017ad302f206b9c2f18d53c8ee4)) +- **eslint-plugin:** [no-unnecessary-condition] handle computed member access ([#2288](https://github.com/typescript-eslint/typescript-eslint/issues/2288)) ([3a187ca](https://github.com/typescript-eslint/typescript-eslint/commit/3a187cafb7302a3c05de0e6a236dd142a5e2d741)) +- **eslint-plugin:** [prefer-literal-enum-member] allow negative numbers ([#2277](https://github.com/typescript-eslint/typescript-eslint/issues/2277)) ([00ac9c3](https://github.com/typescript-eslint/typescript-eslint/commit/00ac9c3ccaad27bab08ec3c3a104f612bb593df5)) +- **eslint-plugin:** [space-before-function-paren] incorrect handling of abstract methods ([#2275](https://github.com/typescript-eslint/typescript-eslint/issues/2275)) ([ced6591](https://github.com/typescript-eslint/typescript-eslint/commit/ced65918b16f46c383496a9b4bd43eca8a76baf6)), closes [#2274](https://github.com/typescript-eslint/typescript-eslint/issues/2274) +- **eslint-plugin:** [switch-exhaustiveness-check] handle special characters in enum keys ([#2207](https://github.com/typescript-eslint/typescript-eslint/issues/2207)) ([98ab010](https://github.com/typescript-eslint/typescript-eslint/commit/98ab010fb7fca884984bb4200fd806ecee8071b6)) +# [3.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.5.0...v3.6.0) (2020-07-06) +### Bug Fixes +- **eslint-plugin:** [no-namespace] allow namespaces in nested declarations with `allowDeclarations` ([#2238](https://github.com/typescript-eslint/typescript-eslint/issues/2238)) ([c1df669](https://github.com/typescript-eslint/typescript-eslint/commit/c1df6694f7866d3ef7ede0b1c6c9dd6f3955e682)) +- **eslint-plugin:** [space-before-function-paren] handle abstract functions ([#2199](https://github.com/typescript-eslint/typescript-eslint/issues/2199)) ([88a3edf](https://github.com/typescript-eslint/typescript-eslint/commit/88a3edfce8349f871b7b660d2b76508b67c94eda)) +### Features -# [2.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.18.0...v2.19.0) (2020-02-03) +- **eslint-plugin:** add rule `prefer-literal-enum-member` ([#1898](https://github.com/typescript-eslint/typescript-eslint/issues/1898)) ([fe2b2ec](https://github.com/typescript-eslint/typescript-eslint/commit/fe2b2ec39ef04ac8b73eef9d29d12fd1b24fa183)) +# [3.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.4.0...v3.5.0) (2020-06-29) ### Bug Fixes -* **eslint-plugin:** [embt] fix allowTypedFunctionExpressions ([#1553](https://github.com/typescript-eslint/typescript-eslint/issues/1553)) ([9e7d161](https://github.com/typescript-eslint/typescript-eslint/commit/9e7d1616d78a0f94521f4e6d4b48344e5df2d9f7)) -* **eslint-plugin:** [require-await] improve performance ([#1536](https://github.com/typescript-eslint/typescript-eslint/issues/1536)) ([45ae0b9](https://github.com/typescript-eslint/typescript-eslint/commit/45ae0b9565ee6e9d01e82107d85ad7151a15af7b)) - +- **eslint-plugin:** [naming-convention] support unicode in regex ([#2241](https://github.com/typescript-eslint/typescript-eslint/issues/2241)) ([5fdd21a](https://github.com/typescript-eslint/typescript-eslint/commit/5fdd21a1726fb6928098c4152aec55a30df960d4)) ### Features -* **eslint-plugin:** [no-extra-non-null-assert] add fixer ([#1468](https://github.com/typescript-eslint/typescript-eslint/issues/1468)) ([54201ab](https://github.com/typescript-eslint/typescript-eslint/commit/54201aba37b2865c0ba4981be79d1fd989806133)) -* **eslint-plugin:** [no-float-prom] fixer + msg for ignoreVoid ([#1473](https://github.com/typescript-eslint/typescript-eslint/issues/1473)) ([159b16e](https://github.com/typescript-eslint/typescript-eslint/commit/159b16ec3a66f05478080c397df5c3f6e29535e4)) -* **eslint-plugin:** [unbound-method] support bound builtins ([#1526](https://github.com/typescript-eslint/typescript-eslint/issues/1526)) ([0a110eb](https://github.com/typescript-eslint/typescript-eslint/commit/0a110eb680749c8c4a2a3dc1375c1a83056e4c14)) -* **eslint-plugin:** add extension [no-dupe-class-members] ([#1492](https://github.com/typescript-eslint/typescript-eslint/issues/1492)) ([b22424e](https://github.com/typescript-eslint/typescript-eslint/commit/b22424e7d4a16042a027557f44e9191e0722b38b)) -* **eslint-plugin:** add no-unnecessary-boolean-literal-compare ([#242](https://github.com/typescript-eslint/typescript-eslint/issues/242)) ([6bebb1d](https://github.com/typescript-eslint/typescript-eslint/commit/6bebb1dc47897ee0e1f075d7e5dd89d8b0590f31)) -* **eslint-plugin:** add switch-exhaustiveness-check rule ([#972](https://github.com/typescript-eslint/typescript-eslint/issues/972)) ([9e0f6dd](https://github.com/typescript-eslint/typescript-eslint/commit/9e0f6ddef7cd29f355f398c90f1986e51c4854f7)) -* **eslint-plugin:** support negative matches for `filter` ([#1517](https://github.com/typescript-eslint/typescript-eslint/issues/1517)) ([b24fbe8](https://github.com/typescript-eslint/typescript-eslint/commit/b24fbe8790b540998e4085174251fb4d61bf96b0)) +- add package scope-manager ([#1939](https://github.com/typescript-eslint/typescript-eslint/issues/1939)) ([682eb7e](https://github.com/typescript-eslint/typescript-eslint/commit/682eb7e009c3f22a542882dfd3602196a60d2a1e)) +# [3.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.3.0...v3.4.0) (2020-06-22) +### Bug Fixes +- **eslint-plugin:** [no-base-to-string] handle intersection types ([#2170](https://github.com/typescript-eslint/typescript-eslint/issues/2170)) ([9cca3a9](https://github.com/typescript-eslint/typescript-eslint/commit/9cca3a9584d5d5ef0536219c5a734f4e87efb543)) +- **eslint-plugin:** [unbound-method] handling destructuring ([#2228](https://github.com/typescript-eslint/typescript-eslint/issues/2228)) ([c3753c2](https://github.com/typescript-eslint/typescript-eslint/commit/c3753c21768d355ecdb9e7ae8e0bfdfbbc1d3bbe)) +### Features -# [2.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.17.0...v2.18.0) (2020-01-27) +- **eslint-plugin:** [no-unnecessary-boolean-literal-compare] add option to check nullable booleans ([#1983](https://github.com/typescript-eslint/typescript-eslint/issues/1983)) ([c0b3057](https://github.com/typescript-eslint/typescript-eslint/commit/c0b3057b7f7d515891ad2efe32e4ef8c01e0478f)) +- **eslint-plugin:** add extension rule `no-loss-of-precision` ([#2196](https://github.com/typescript-eslint/typescript-eslint/issues/2196)) ([535b0f2](https://github.com/typescript-eslint/typescript-eslint/commit/535b0f2ddd82efa6a2c40307a61c480f4b3cdea3)) +# [3.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.2.0...v3.3.0) (2020-06-15) ### Bug Fixes -* **eslint-plugin:** [explicit-module-boundary-types] false positive for returned fns ([#1490](https://github.com/typescript-eslint/typescript-eslint/issues/1490)) ([5562ad5](https://github.com/typescript-eslint/typescript-eslint/commit/5562ad5ed902102d7c09a7fd47ca4ea7e50d6654)) -* improve token types and add missing type guards ([#1497](https://github.com/typescript-eslint/typescript-eslint/issues/1497)) ([ce41d7d](https://github.com/typescript-eslint/typescript-eslint/commit/ce41d7de33bcb7ccf96c03ac1438304c5a49ff54)) -* **eslint-plugin:** [naming-convention] fix filter option ([#1482](https://github.com/typescript-eslint/typescript-eslint/issues/1482)) ([718cd88](https://github.com/typescript-eslint/typescript-eslint/commit/718cd889c155a75413c571ac006c33fbc271dcc5)) -* **eslint-plugin:** fix property access on undefined error ([#1507](https://github.com/typescript-eslint/typescript-eslint/issues/1507)) ([d89e8e8](https://github.com/typescript-eslint/typescript-eslint/commit/d89e8e8a1114989e2727351bee7aadb6579f312b)) - +- **eslint-plugin:** [no-unused-expressions] handle ternary and short-circuit options ([#2194](https://github.com/typescript-eslint/typescript-eslint/issues/2194)) ([ee9f100](https://github.com/typescript-eslint/typescript-eslint/commit/ee9f100a2f9a874c2b361482742686eeaa9bdac7)) ### Features -* **eslint-plugin:** add comma-spacing ([#1495](https://github.com/typescript-eslint/typescript-eslint/issues/1495)) ([1fd86be](https://github.com/typescript-eslint/typescript-eslint/commit/1fd86befa6a940a0354c619dd2da08a5c5d69fb4)) -* **eslint-plugin:** add new rule prefer-as-const ([#1431](https://github.com/typescript-eslint/typescript-eslint/issues/1431)) ([420db96](https://github.com/typescript-eslint/typescript-eslint/commit/420db96921435e8bf7fb484ae74552a912a6adde)) -* **eslint-plugin:** create `ban-ts-comment` rule ([#1361](https://github.com/typescript-eslint/typescript-eslint/issues/1361)) ([2a83d13](https://github.com/typescript-eslint/typescript-eslint/commit/2a83d138a966cd5ce787d1eecf595b59b78232d4)) -* **experimental-utils:** make RuleMetaData.docs optional ([#1462](https://github.com/typescript-eslint/typescript-eslint/issues/1462)) ([cde97ac](https://github.com/typescript-eslint/typescript-eslint/commit/cde97aca24df5a0f28f37006ed130ebc217fb2ad)) +- **eslint-plugin:** [naming-convention] better error message and docs for prefix/suffix ([#2195](https://github.com/typescript-eslint/typescript-eslint/issues/2195)) ([a2ffe55](https://github.com/typescript-eslint/typescript-eslint/commit/a2ffe5568df0f7224bfe9141d298e538383d5f09)) +# [3.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.1.0...v3.2.0) (2020-06-08) +### Bug Fixes +- **eslint-plugin:** [explicit-module-boundary-types] dont report return type errors on constructor overloads ([#2158](https://github.com/typescript-eslint/typescript-eslint/issues/2158)) ([53232d7](https://github.com/typescript-eslint/typescript-eslint/commit/53232d775ca0b808e2d75d9501f4411a868b2b48)) +- **eslint-plugin:** [explicit-module-boundary-types] handle bodyless arrow functions with explicit return types that return functions ([#2169](https://github.com/typescript-eslint/typescript-eslint/issues/2169)) ([58db655](https://github.com/typescript-eslint/typescript-eslint/commit/58db655133aaae006efe3e3ceee971cf88dc348f)) +- **eslint-plugin:** [explicit-module-boundary-types] handle nested functions and functions expressions in a typed variable declaration ([#2176](https://github.com/typescript-eslint/typescript-eslint/issues/2176)) ([6ff450d](https://github.com/typescript-eslint/typescript-eslint/commit/6ff450da3abec93223a33f6b52484c9ca99b7abe)) +- **eslint-plugin:** [no-extra-non-null-assertion] dont report for assertions not followed by the optional chain ([#2167](https://github.com/typescript-eslint/typescript-eslint/issues/2167)) ([e4c1834](https://github.com/typescript-eslint/typescript-eslint/commit/e4c1834c7c5934332dd1d58c09018453568c4889)) +- **eslint-plugin:** [no-unnecessary-conditionals] Handle comparison of generics and loose comparisons with undefined values ([#2152](https://github.com/typescript-eslint/typescript-eslint/issues/2152)) ([c86e2a2](https://github.com/typescript-eslint/typescript-eslint/commit/c86e2a235372149db9b1700d39c2145e0ce5221a)) +- **eslint-plugin:** [prefer-optional-chain] handling first member expression ([#2156](https://github.com/typescript-eslint/typescript-eslint/issues/2156)) ([de18660](https://github.com/typescript-eslint/typescript-eslint/commit/de18660a8cf8f7033798646d8c5b0938d1accb12)) +- **eslint-plugin:** [return-await] correct handling of ternaries ([#2168](https://github.com/typescript-eslint/typescript-eslint/issues/2168)) ([fe4c0bf](https://github.com/typescript-eslint/typescript-eslint/commit/fe4c0bf8c04f070d6642fbe86c5e5614bc88e8fd)) +### Features -# [2.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.16.0...v2.17.0) (2020-01-20) +- **eslint-plugin:** [naming-convention] put identifiers in quotes in error messages ([#2182](https://github.com/typescript-eslint/typescript-eslint/issues/2182)) ([fc61932](https://github.com/typescript-eslint/typescript-eslint/commit/fc619326eedf7ef2efa51444ecdead81a36a204f)), closes [#2178](https://github.com/typescript-eslint/typescript-eslint/issues/2178) +- **eslint-plugin:** [require-array-sort-compare] add `ignoreStringArrays` option ([#1972](https://github.com/typescript-eslint/typescript-eslint/issues/1972)) ([6dee784](https://github.com/typescript-eslint/typescript-eslint/commit/6dee7840a3af1dfe4c38a128d1c4655bdac625df)) +- **eslint-plugin:** add rule `ban-tslint-comment` ([#2140](https://github.com/typescript-eslint/typescript-eslint/issues/2140)) ([43ee226](https://github.com/typescript-eslint/typescript-eslint/commit/43ee226ffbaaa3e7126081db9476c24b89ec16e9)) +- **eslint-plugin:** add rule `no-confusing-non-null-assertion` ([#1941](https://github.com/typescript-eslint/typescript-eslint/issues/1941)) ([9b51c44](https://github.com/typescript-eslint/typescript-eslint/commit/9b51c44f29d8b3e95a510985544e8ded8a14404d)) +# [3.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.0.2...v3.1.0) (2020-06-01) ### Bug Fixes -* **eslint-plugin:** [naming-convention] handle empty array-pattern ([#1450](https://github.com/typescript-eslint/typescript-eslint/issues/1450)) ([4726605](https://github.com/typescript-eslint/typescript-eslint/commit/4726605)) -* **eslint-plugin:** [unbound-method] handling of logical expr ([#1440](https://github.com/typescript-eslint/typescript-eslint/issues/1440)) ([9c5b857](https://github.com/typescript-eslint/typescript-eslint/commit/9c5b857)) -* **eslint-plugin:** set default-param-last as an extension rule ([#1445](https://github.com/typescript-eslint/typescript-eslint/issues/1445)) ([b5ef704](https://github.com/typescript-eslint/typescript-eslint/commit/b5ef704)) -* **typescript-estree:** correct type of `ArrayPattern.elements` ([#1451](https://github.com/typescript-eslint/typescript-eslint/issues/1451)) ([62e4ca0](https://github.com/typescript-eslint/typescript-eslint/commit/62e4ca0)) - +- **eslint-plugin:** [explicit-module-boundary-types] don't check returned functions if parent function has return type ([#2084](https://github.com/typescript-eslint/typescript-eslint/issues/2084)) ([d7d4eeb](https://github.com/typescript-eslint/typescript-eslint/commit/d7d4eeb03f2918d5d9e361fdb47c2d42e83bd593)) +- **eslint-plugin:** [no-unnecessary-condition] handle comparison of any, unknown and loose comparisons with nullish values ([#2123](https://github.com/typescript-eslint/typescript-eslint/issues/2123)) ([1ae1d01](https://github.com/typescript-eslint/typescript-eslint/commit/1ae1d01e5603ec7cef8051ed018c3c3c88b29867)) +- **eslint-plugin:** [no-unnecessary-condition] improve optional chain handling ([#2111](https://github.com/typescript-eslint/typescript-eslint/issues/2111)) ([9ee399b](https://github.com/typescript-eslint/typescript-eslint/commit/9ee399b5906e82f346ff89141207a6630786de54)) +- **eslint-plugin:** [no-unnecessary-condition] improve optional chain handling 2 - electric boogaloo ([#2138](https://github.com/typescript-eslint/typescript-eslint/issues/2138)) ([c87cfaf](https://github.com/typescript-eslint/typescript-eslint/commit/c87cfaf6746775bb8ad9eb45b0002f068a822dbe)) +- **eslint-plugin:** [no-unused-expressions] ignore import expressions ([#2130](https://github.com/typescript-eslint/typescript-eslint/issues/2130)) ([e383691](https://github.com/typescript-eslint/typescript-eslint/commit/e3836910efdafd9edf04daed149c9e839c08047e)) +- **eslint-plugin:** [no-var-requires] false negative for TSAsExpression and MemberExpression ([#2139](https://github.com/typescript-eslint/typescript-eslint/issues/2139)) ([df95338](https://github.com/typescript-eslint/typescript-eslint/commit/df953388913b22d45242e65ce231d92a8b8a0080)) +- **experimental-utils:** downlevel type declarations for versions older than 3.8 ([#2133](https://github.com/typescript-eslint/typescript-eslint/issues/2133)) ([7925823](https://github.com/typescript-eslint/typescript-eslint/commit/792582326a8065270b69a0ffcaad5a7b4b103ff3)) ### Features -* **eslint-plugin:** [naming-convention] allow not check format ([#1455](https://github.com/typescript-eslint/typescript-eslint/issues/1455)) ([61eb434](https://github.com/typescript-eslint/typescript-eslint/commit/61eb434)) -* **eslint-plugin:** [naming-convention] correct example ([#1455](https://github.com/typescript-eslint/typescript-eslint/issues/1455)) ([60683d7](https://github.com/typescript-eslint/typescript-eslint/commit/60683d7)) -* **eslint-plugin:** [no-extra-!-assert] flag ?. after !-assert ([#1460](https://github.com/typescript-eslint/typescript-eslint/issues/1460)) ([58c7c25](https://github.com/typescript-eslint/typescript-eslint/commit/58c7c25)) -* **eslint-plugin:** add explicit-module-boundary-types rule ([#1020](https://github.com/typescript-eslint/typescript-eslint/issues/1020)) ([bb0a846](https://github.com/typescript-eslint/typescript-eslint/commit/bb0a846)) -* **eslint-plugin:** add no-non-null-asserted-optional-chain ([#1469](https://github.com/typescript-eslint/typescript-eslint/issues/1469)) ([498aa24](https://github.com/typescript-eslint/typescript-eslint/commit/498aa24)) -* **experimental-utils:** expose getParserServices from utils ([#1448](https://github.com/typescript-eslint/typescript-eslint/issues/1448)) ([982c8bc](https://github.com/typescript-eslint/typescript-eslint/commit/982c8bc)) +- **eslint-plugin:** [ban-ts-comments] add "allow-with-description" option ([#2099](https://github.com/typescript-eslint/typescript-eslint/issues/2099)) ([8a0fd18](https://github.com/typescript-eslint/typescript-eslint/commit/8a0fd1899f544470a35afb3117f4c71aad7e4e42)) +- **eslint-plugin:** [ban-types] allow selective disable of default options with `false` value ([#2137](https://github.com/typescript-eslint/typescript-eslint/issues/2137)) ([1cb8ca4](https://github.com/typescript-eslint/typescript-eslint/commit/1cb8ca483d029935310e6904580df8501837084d)) +- **eslint-plugin:** [explicit-module-boundary-types] improve accuracy and coverage ([#2135](https://github.com/typescript-eslint/typescript-eslint/issues/2135)) ([caaa859](https://github.com/typescript-eslint/typescript-eslint/commit/caaa8599284d02ab3341e282cad35a52d0fb86c7)) + +## [3.0.2](https://github.com/typescript-eslint/typescript-eslint/compare/v3.0.1...v3.0.2) (2020-05-27) +**Note:** Version bump only for package @typescript-eslint/eslint-plugin +## [3.0.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.0.0...v3.0.1) (2020-05-25) +### Bug Fixes +- **eslint-plugin:** [naming-convention] handle no options correctly ([#2095](https://github.com/typescript-eslint/typescript-eslint/issues/2095)) ([fd7d02b](https://github.com/typescript-eslint/typescript-eslint/commit/fd7d02b31ebd995b7fdd857d7c054042aa4f2001)) +- **eslint-plugin:** [no-throw-literal] handle intersection and union types ([#2085](https://github.com/typescript-eslint/typescript-eslint/issues/2085)) ([cae037f](https://github.com/typescript-eslint/typescript-eslint/commit/cae037ff9b20363b970cc600a09505b98bf10a14)) +- **eslint-plugin:** [unbound-method] fix crash due to missing `Intl` ([#2090](https://github.com/typescript-eslint/typescript-eslint/issues/2090)) ([f2fa82c](https://github.com/typescript-eslint/typescript-eslint/commit/f2fa82c532ae858ccfb064268cfcc9df657a54be)) -# [2.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.15.0...v2.16.0) (2020-01-13) +# [3.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.34.0...v3.0.0) (2020-05-21) +## [Please see the release notes for v3.0.0](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v3.0.0) ### Bug Fixes -* **eslint-plugin:** [no-magic-numbers] handle UnaryExpression for enums ([#1415](https://github.com/typescript-eslint/typescript-eslint/issues/1415)) ([852fc31](https://github.com/typescript-eslint/typescript-eslint/commit/852fc31)) -* **eslint-plugin:** [no-unnec-type-assert] handle JSX attributes ([#1002](https://github.com/typescript-eslint/typescript-eslint/issues/1002)) ([3c5659b](https://github.com/typescript-eslint/typescript-eslint/commit/3c5659b)) -* **eslint-plugin:** handle error classes using generics ([#1428](https://github.com/typescript-eslint/typescript-eslint/issues/1428)) ([b139540](https://github.com/typescript-eslint/typescript-eslint/commit/b139540)) -* **typescript-estree:** resolve path relative to tsconfigRootDir ([#1439](https://github.com/typescript-eslint/typescript-eslint/issues/1439)) ([c709056](https://github.com/typescript-eslint/typescript-eslint/commit/c709056)) +- **eslint-plugin:** [dot-notation] fix typo in schema ([#2040](https://github.com/typescript-eslint/typescript-eslint/issues/2040)) ([242328f](https://github.com/typescript-eslint/typescript-eslint/commit/242328fa749ee4c72af93433a9bef95f329ac62f)) +- **eslint-plugin:** correct parser peerDep version ([fe59f69](https://github.com/typescript-eslint/typescript-eslint/commit/fe59f69381a0915a4f5135e2e88637a5eea246ba)) +- **experimental-utils:** add back SourceCode.isSpaceBetweenTokens ([ae82ea4](https://github.com/typescript-eslint/typescript-eslint/commit/ae82ea4a85a4ca332ebe6104e96c59dba30411be)) +- **typescript-estree:** remove now defunct `Import` node type ([f199cbd](https://github.com/typescript-eslint/typescript-eslint/commit/f199cbdbbd892b5ba03bfff66f463f3d9c92ee9b)) +- **typescript-estree:** use `TSEmptyBodyFunctionExpression` for body-less nodes ([#1289](https://github.com/typescript-eslint/typescript-eslint/issues/1289)) ([82e7163](https://github.com/typescript-eslint/typescript-eslint/commit/82e7163214b56ccde93ba97807b161669a50a60b)) + +### Features + +- **eslint-plugin:** [ban-types] rework default options ([#848](https://github.com/typescript-eslint/typescript-eslint/issues/848)) ([8e31d5d](https://github.com/typescript-eslint/typescript-eslint/commit/8e31d5dbe9fe5227fdbefcecfd50ce5dd51360c3)) +- **eslint-plugin:** [no-floating-promises] ignore void operator by default ([#2003](https://github.com/typescript-eslint/typescript-eslint/issues/2003)) ([3626a67](https://github.com/typescript-eslint/typescript-eslint/commit/3626a673cf8117cc995245cd86e466e2553e9b0e)) +- **eslint-plugin:** [prefer-nullish-coalescing][prefer-optional-chain] remove unsafe fixers ([52b6085](https://github.com/typescript-eslint/typescript-eslint/commit/52b60852d0ba6bb6abe519c9d3ec1b231793e91d)) +- **experimental-utils:** upgrade eslint types for v7 ([#2023](https://github.com/typescript-eslint/typescript-eslint/issues/2023)) ([06869c9](https://github.com/typescript-eslint/typescript-eslint/commit/06869c9656fa37936126666845aee40aad546ebd)) +- upgrade to ESLint v7 ([#2022](https://github.com/typescript-eslint/typescript-eslint/issues/2022)) ([208de71](https://github.com/typescript-eslint/typescript-eslint/commit/208de71059746bf38e94bd460346ffb2698a3e12)) +- **eslint-plugin:** [no-unnecessary-condition] remove `checkArrayPredicates` and always check it ([#1579](https://github.com/typescript-eslint/typescript-eslint/issues/1579)) ([bfd9b60](https://github.com/typescript-eslint/typescript-eslint/commit/bfd9b606d17d30d5694967a1f01e0e1501ba1022)) +- **eslint-plugin:** [no-unnecessary-condition] remove option `ignoreRHS` ([#1163](https://github.com/typescript-eslint/typescript-eslint/issues/1163)) ([ee8dd8f](https://github.com/typescript-eslint/typescript-eslint/commit/ee8dd8f8a9e6c25ac426ce9bb71c5f012c51f264)) +- **eslint-plugin:** [no-unnecessary-condition] report when non-nullish is compared to `null`/`undefined` ([#1659](https://github.com/typescript-eslint/typescript-eslint/issues/1659)) ([7fa9060](https://github.com/typescript-eslint/typescript-eslint/commit/7fa906073903c5eb70609c25f1a91ada14dcdc71)) +- **eslint-plugin:** [restrict-template-expressions] `allowNumber: true` by default ([#2005](https://github.com/typescript-eslint/typescript-eslint/issues/2005)) ([643ec24](https://github.com/typescript-eslint/typescript-eslint/commit/643ec240bd901295d9e9ea5c43fc20109c33e982)) +- **eslint-plugin:** [restrict-template-expressions] rename `allowNullable` to `allowNullish` ([#2006](https://github.com/typescript-eslint/typescript-eslint/issues/2006)) ([264b017](https://github.com/typescript-eslint/typescript-eslint/commit/264b017c11c2ab132fcbad18b42a9a0fe639386e)) +- **eslint-plugin:** [strict-boolean-expression] rework options ([#1631](https://github.com/typescript-eslint/typescript-eslint/issues/1631)) ([cd14482](https://github.com/typescript-eslint/typescript-eslint/commit/cd1448240dca11762fcb9c10e18bb6541a840485)) +- **eslint-plugin:** delete deprecated rules ([#2002](https://github.com/typescript-eslint/typescript-eslint/issues/2002)) ([da0aec2](https://github.com/typescript-eslint/typescript-eslint/commit/da0aec2cfa27902aae7c438a2fe91343c822e4ae)) +- **eslint-plugin:** eslint-recommended: disable no-func-assign ([#984](https://github.com/typescript-eslint/typescript-eslint/issues/984)) ([ae9b8a9](https://github.com/typescript-eslint/typescript-eslint/commit/ae9b8a9c73c0328287de956466257d8bbfbdb20f)) +- **eslint-plugin:** eslint-recommended: disable no-obj-calls ([#1000](https://github.com/typescript-eslint/typescript-eslint/issues/1000)) ([b9ca14c](https://github.com/typescript-eslint/typescript-eslint/commit/b9ca14c5f5ec28a3fde1a9b2d2f6a4dc74d903e4)) +- **eslint-plugin:** update `eslint-recommended` set ([#1996](https://github.com/typescript-eslint/typescript-eslint/issues/1996)) ([9a96e18](https://github.com/typescript-eslint/typescript-eslint/commit/9a96e18400e0a0d738d159d9d01faf41d3586249)) +- **eslint-plugin:** update recommended sets ([#2001](https://github.com/typescript-eslint/typescript-eslint/issues/2001)) ([0126b4f](https://github.com/typescript-eslint/typescript-eslint/commit/0126b4f56f9197d561e90b09962ccceb4f88bc41)) +- **typescript-estree:** align nodes with estree 2020 ([#1389](https://github.com/typescript-eslint/typescript-eslint/issues/1389)) ([aff5b62](https://github.com/typescript-eslint/typescript-eslint/commit/aff5b62044f9b93f2087a1d261e9be3f8d6fd54d)) +- drop support for node v8 ([#1997](https://github.com/typescript-eslint/typescript-eslint/issues/1997)) ([b6c3b7b](https://github.com/typescript-eslint/typescript-eslint/commit/b6c3b7b84b8d199fa75a46432febd4a364a63217)) +- **typescript-estree:** always return parserServices ([#716](https://github.com/typescript-eslint/typescript-eslint/issues/716)) ([5b23443](https://github.com/typescript-eslint/typescript-eslint/commit/5b23443c48f3f62424db3e742243f3568080b946)) +- **typescript-estree:** handle 3.9's non-null assertion changes ([#2036](https://github.com/typescript-eslint/typescript-eslint/issues/2036)) ([06bec63](https://github.com/typescript-eslint/typescript-eslint/commit/06bec63c56536db070608ab136d2ad57083f0c6a)) +# [2.34.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.33.0...v2.34.0) (2020-05-18) ### Features -* **eslint-plugin:** [no-unnec-cond] array predicate callbacks ([#1206](https://github.com/typescript-eslint/typescript-eslint/issues/1206)) ([f7ad716](https://github.com/typescript-eslint/typescript-eslint/commit/f7ad716)) -* **eslint-plugin:** add default-param-last rule ([#1418](https://github.com/typescript-eslint/typescript-eslint/issues/1418)) ([a37ff9f](https://github.com/typescript-eslint/typescript-eslint/commit/a37ff9f)) -* **eslint-plugin:** add rule naming-conventions ([#1318](https://github.com/typescript-eslint/typescript-eslint/issues/1318)) ([9eab26f](https://github.com/typescript-eslint/typescript-eslint/commit/9eab26f)) -* **typescript-estree:** add strict type mapping to esTreeNodeToTSNodeMap ([#1382](https://github.com/typescript-eslint/typescript-eslint/issues/1382)) ([d3d70a3](https://github.com/typescript-eslint/typescript-eslint/commit/d3d70a3)) - - +- **eslint-plugin:** [no-invalid-void-type] allow union of void and `allowInGenericTypeArguments` ([#1960](https://github.com/typescript-eslint/typescript-eslint/issues/1960)) ([1bc105a](https://github.com/typescript-eslint/typescript-eslint/commit/1bc105a2c6ae3fde9596f0419fed0de699dc57c7)) +- **eslint-plugin:** [restrict-template-expressions] improve error message ([#1926](https://github.com/typescript-eslint/typescript-eslint/issues/1926)) ([1af59ba](https://github.com/typescript-eslint/typescript-eslint/commit/1af59ba8ac0ceabb008d9c61556acf7db0a1d352)) +- **experimental-utils:** add `suggestion` property for rule modules ([#2033](https://github.com/typescript-eslint/typescript-eslint/issues/2033)) ([f42a5b0](https://github.com/typescript-eslint/typescript-eslint/commit/f42a5b09ebfa173f418a99c552b0cbe221567194)) +# [2.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.32.0...v2.33.0) (2020-05-12) +### Features -# [2.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.14.0...v2.15.0) (2020-01-06) +- **eslint-plugin:** add extension rule `lines-between-class-members` ([#1684](https://github.com/typescript-eslint/typescript-eslint/issues/1684)) ([08f93e6](https://github.com/typescript-eslint/typescript-eslint/commit/08f93e69347a8e7f3a7e8a1455bb5d069c2faeef)) +# [2.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.31.0...v2.32.0) (2020-05-11) ### Bug Fixes -* **eslint-plugin:** crash in no-unnecessary-type-arguments ([#1401](https://github.com/typescript-eslint/typescript-eslint/issues/1401)) ([01c939f](https://github.com/typescript-eslint/typescript-eslint/commit/01c939f)) - +- **eslint-plugin:** [no-base-to-string] support boolean in unions ([#1979](https://github.com/typescript-eslint/typescript-eslint/issues/1979)) ([6987ecc](https://github.com/typescript-eslint/typescript-eslint/commit/6987ecc1dacfb45c0f8ed3e81d08aa708eb96ad1)) +- **eslint-plugin:** [no-type-alias] handle readonly types in aliases ([#1990](https://github.com/typescript-eslint/typescript-eslint/issues/1990)) ([56d9870](https://github.com/typescript-eslint/typescript-eslint/commit/56d987070f83d1b6410b04750b20a761fd793073)) +- **eslint-plugin:** [no-unused-expressions] inherit `messages` from base rule ([#1992](https://github.com/typescript-eslint/typescript-eslint/issues/1992)) ([51ca404](https://github.com/typescript-eslint/typescript-eslint/commit/51ca404af645eed194269ab7f8f67b97bd52e32d)) ### Features -* **eslint-plugin:** [strict-bool-expr] add allowSafe option ([#1385](https://github.com/typescript-eslint/typescript-eslint/issues/1385)) ([9344233](https://github.com/typescript-eslint/typescript-eslint/commit/9344233)) -* **eslint-plugin:** add no-implied-eval ([#1375](https://github.com/typescript-eslint/typescript-eslint/issues/1375)) ([254d276](https://github.com/typescript-eslint/typescript-eslint/commit/254d276)) +- bump dependencies and align AST ([#2007](https://github.com/typescript-eslint/typescript-eslint/issues/2007)) ([18668b7](https://github.com/typescript-eslint/typescript-eslint/commit/18668b78fd7d1e5281af7fc26c76e0ca53297f69)) +# [2.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.30.0...v2.31.0) (2020-05-04) +### Bug Fixes +- **eslint-plugin:** [dot-notation] handle missing declarations ([#1947](https://github.com/typescript-eslint/typescript-eslint/issues/1947)) ([383f931](https://github.com/typescript-eslint/typescript-eslint/commit/383f93182599c00e231a0f0d36575ca0e19369a6)) +- **eslint-plugin:** [method-signature-style] fix overloaded methods to an intersection type ([#1966](https://github.com/typescript-eslint/typescript-eslint/issues/1966)) ([7f3fba3](https://github.com/typescript-eslint/typescript-eslint/commit/7f3fba348d432d7637e1c737df943ee1f9105062)) +- **eslint-plugin:** [return-await] await in a normal function ([#1962](https://github.com/typescript-eslint/typescript-eslint/issues/1962)) ([f82fd7b](https://github.com/typescript-eslint/typescript-eslint/commit/f82fd7bb81f986c4861d0b4e2ecdb0c496d7a602)) +- **eslint-plugin:** [unbound-method] false positives for unary expressions ([#1964](https://github.com/typescript-eslint/typescript-eslint/issues/1964)) ([b35070e](https://github.com/typescript-eslint/typescript-eslint/commit/b35070ec6f84ad5ce606386cdb6eeb91488dfdd7)) +- **eslint-plugin:** no-base-to-string boolean expression detect ([#1969](https://github.com/typescript-eslint/typescript-eslint/issues/1969)) ([f78f13a](https://github.com/typescript-eslint/typescript-eslint/commit/f78f13aedd59d5b5880903d48c779a6c50fd937e)) +### Features -# [2.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.13.0...v2.14.0) (2019-12-30) +- **eslint-plugin:** [member-ordering] add decorators support ([#1870](https://github.com/typescript-eslint/typescript-eslint/issues/1870)) ([f7ec192](https://github.com/typescript-eslint/typescript-eslint/commit/f7ec1920607cb8eec8020b08cd7247de0bf19ce1)) +- **eslint-plugin:** [prefer-optional-chain] added option to convert to suggestion fixer ([#1965](https://github.com/typescript-eslint/typescript-eslint/issues/1965)) ([2f0824b](https://github.com/typescript-eslint/typescript-eslint/commit/2f0824b0a41f3043b6242fc1d49faae540abaf22)) +- **eslint-plugin:** new extended rule 'no-invalid-this' ([#1823](https://github.com/typescript-eslint/typescript-eslint/issues/1823)) ([b18bc35](https://github.com/typescript-eslint/typescript-eslint/commit/b18bc357507337b9725f8d9c1b549513075a0da5)) +- **experimental-utils:** expose our RuleTester extension ([#1948](https://github.com/typescript-eslint/typescript-eslint/issues/1948)) ([2dd1638](https://github.com/typescript-eslint/typescript-eslint/commit/2dd1638aaa2658ba99b2341861146b586f489121)) +# [2.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.29.0...v2.30.0) (2020-04-27) ### Bug Fixes -* **eslint-plugin:** type assertion in rule no-extra-parens ([#1376](https://github.com/typescript-eslint/typescript-eslint/issues/1376)) ([f40639e](https://github.com/typescript-eslint/typescript-eslint/commit/f40639e)) - +- **eslint-plugin:** [prefer-string-starts-ends-with] check for negative start index in slice ([#1920](https://github.com/typescript-eslint/typescript-eslint/issues/1920)) ([ed2bd60](https://github.com/typescript-eslint/typescript-eslint/commit/ed2bd6067f74ae33e36a084719bb91efedfba599)) +- **eslint-plugin:** fix no-base-to-string boolean literal check ([#1850](https://github.com/typescript-eslint/typescript-eslint/issues/1850)) ([2f45e99](https://github.com/typescript-eslint/typescript-eslint/commit/2f45e9992a8f12b6233716e77a6159f9cea2c879)) ### Features -* add internal eslint plugin for repo-specific lint rules ([#1373](https://github.com/typescript-eslint/typescript-eslint/issues/1373)) ([3a15413](https://github.com/typescript-eslint/typescript-eslint/commit/3a15413)) +- **eslint-plugin:** add extension rule `dot-notation` ([#1867](https://github.com/typescript-eslint/typescript-eslint/issues/1867)) ([a85c3e1](https://github.com/typescript-eslint/typescript-eslint/commit/a85c3e1515d735b6c245cc658cdaec6deb05d630)) +- **eslint-plugin:** create `no-invalid-void-type` rule ([#1847](https://github.com/typescript-eslint/typescript-eslint/issues/1847)) ([f667ff1](https://github.com/typescript-eslint/typescript-eslint/commit/f667ff1708d4ed28b7ea5beea742889da69a76d9)) +# [2.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.28.0...v2.29.0) (2020-04-20) +### Bug Fixes +- **eslint-plugin:** [no-base-to-string] soft remove `ignoreTaggedTemplateExpressions` option ([#1916](https://github.com/typescript-eslint/typescript-eslint/issues/1916)) ([369978e](https://github.com/typescript-eslint/typescript-eslint/commit/369978e9685bacb3e3882b0510ff06eaf8df4ca1)) +### Features -# [2.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.12.0...v2.13.0) (2019-12-23) +- **eslint-plugin:** [no-floating-promise] add option to ignore IIFEs ([#1799](https://github.com/typescript-eslint/typescript-eslint/issues/1799)) ([cea51bf](https://github.com/typescript-eslint/typescript-eslint/commit/cea51bf130d6d3c2935f5e2dcc468196f2ad9d00)) +- **eslint-plugin:** [restrict-template-expressions] add support for intersection types ([#1803](https://github.com/typescript-eslint/typescript-eslint/issues/1803)) ([cc70e4f](https://github.com/typescript-eslint/typescript-eslint/commit/cc70e4fbadd0b15fd6af913a2e1e2ddd346fa558)) +- **eslint-plugin:** add extension rule `init-declarations` ([#1814](https://github.com/typescript-eslint/typescript-eslint/issues/1814)) ([b01f5e7](https://github.com/typescript-eslint/typescript-eslint/commit/b01f5e778ac28e0797a3734fc58d025bb224f418)) +- **eslint-plugin:** add extension rule `keyword-spacing` ([#1739](https://github.com/typescript-eslint/typescript-eslint/issues/1739)) ([c5106dd](https://github.com/typescript-eslint/typescript-eslint/commit/c5106dd4bf2bc8846cc39aa8bb50c33bec026d4d)) +# [2.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.27.0...v2.28.0) (2020-04-13) ### Bug Fixes -* **eslint-plugin:** [quotes] ignore backticks for Enum members ([#1355](https://github.com/typescript-eslint/typescript-eslint/issues/1355)) ([e51048c](https://github.com/typescript-eslint/typescript-eslint/commit/e51048c)) -* **eslint-plugin:** [type-annotation-spacing] typo in messages ([#1354](https://github.com/typescript-eslint/typescript-eslint/issues/1354)) ([82e0dbc](https://github.com/typescript-eslint/typescript-eslint/commit/82e0dbc)) -* **eslint-plugin:** add isTypeAssertion utility function ([#1369](https://github.com/typescript-eslint/typescript-eslint/issues/1369)) ([bb1671e](https://github.com/typescript-eslint/typescript-eslint/commit/bb1671e)) -* **eslint-plugin:** use AST_NODE_TYPES enum instead of strings ([#1366](https://github.com/typescript-eslint/typescript-eslint/issues/1366)) ([bd0276b](https://github.com/typescript-eslint/typescript-eslint/commit/bd0276b)) - +- **eslint-plugin:** [method-signature-style] handle multiline params ([#1861](https://github.com/typescript-eslint/typescript-eslint/issues/1861)) ([5832a86](https://github.com/typescript-eslint/typescript-eslint/commit/5832a8643bbe174ec02df5966bb333e506e45f5d)) +- **eslint-plugin:** [no-empty-interface] use suggestion fixer for ambient contexts ([#1880](https://github.com/typescript-eslint/typescript-eslint/issues/1880)) ([62b2278](https://github.com/typescript-eslint/typescript-eslint/commit/62b2278aec0011c93eae17bed8b278114d3379a2)) +- **eslint-plugin:** [unbound-method] false positive on property function initializer ([#1890](https://github.com/typescript-eslint/typescript-eslint/issues/1890)) ([f1c3b18](https://github.com/typescript-eslint/typescript-eslint/commit/f1c3b18f7aadc81f7dca7aa32aa1a8fe424e04e7)) +- **eslint-plugin:** [unbound-method] ignore assignments _to_ methods ([#1736](https://github.com/typescript-eslint/typescript-eslint/issues/1736)) ([6b4680b](https://github.com/typescript-eslint/typescript-eslint/commit/6b4680b6e7343d9d98fa1de170f387a36d98b73e)) +- **eslint-plugin:** no-empty-interface autofix ([#1865](https://github.com/typescript-eslint/typescript-eslint/issues/1865)) ([829a2f7](https://github.com/typescript-eslint/typescript-eslint/commit/829a2f728f876d356908e2338c2d6620e58f9943)), closes [#1864](https://github.com/typescript-eslint/typescript-eslint/issues/1864) +- **eslint-plugin:** use `isTypeArrayTypeOrUnionOfArrayTypes` util for checking if type is array ([#1728](https://github.com/typescript-eslint/typescript-eslint/issues/1728)) ([05030f8](https://github.com/typescript-eslint/typescript-eslint/commit/05030f8d2bd5a50e95053bc61380891da71cc567)) ### Features -* **eslint-plugin:** [ban-types] handle empty type literal {} ([#1348](https://github.com/typescript-eslint/typescript-eslint/issues/1348)) ([1c0ce9b](https://github.com/typescript-eslint/typescript-eslint/commit/1c0ce9b)) -* **eslint-plugin:** [no-use-before-define] opt to ignore enum ([#1242](https://github.com/typescript-eslint/typescript-eslint/issues/1242)) ([6edd911](https://github.com/typescript-eslint/typescript-eslint/commit/6edd911)) -* **eslint-plugin:** [pref-str-starts/ends-with] optional chain… ([#1357](https://github.com/typescript-eslint/typescript-eslint/issues/1357)) ([fd37bc3](https://github.com/typescript-eslint/typescript-eslint/commit/fd37bc3)) -* **eslint-plugin:** add no-extra-semi [extension] ([#1237](https://github.com/typescript-eslint/typescript-eslint/issues/1237)) ([425f65c](https://github.com/typescript-eslint/typescript-eslint/commit/425f65c)) -* **eslint-plugin:** add no-throw-literal [extension] ([#1331](https://github.com/typescript-eslint/typescript-eslint/issues/1331)) ([2aa696c](https://github.com/typescript-eslint/typescript-eslint/commit/2aa696c)) -* **eslint-plugin:** more optional chain support in rules ([#1363](https://github.com/typescript-eslint/typescript-eslint/issues/1363)) ([3dd1b02](https://github.com/typescript-eslint/typescript-eslint/commit/3dd1b02)) -* **typescript-estree:** computed members discriminated unions ([#1349](https://github.com/typescript-eslint/typescript-eslint/issues/1349)) ([013df9a](https://github.com/typescript-eslint/typescript-eslint/commit/013df9a)) -* **typescript-estree:** tighten prop name and destructure types ([#1346](https://github.com/typescript-eslint/typescript-eslint/issues/1346)) ([f335c50](https://github.com/typescript-eslint/typescript-eslint/commit/f335c50)) +- **eslint-plugin:** [ban-ts-comment] support `ts-expect-error` ([#1706](https://github.com/typescript-eslint/typescript-eslint/issues/1706)) ([469cff3](https://github.com/typescript-eslint/typescript-eslint/commit/469cff332c041f38f60de052769287342455cff1)) +- **eslint-plugin:** [consistent-type-assertions] always allow `const` assertions ([#1713](https://github.com/typescript-eslint/typescript-eslint/issues/1713)) ([af2c00d](https://github.com/typescript-eslint/typescript-eslint/commit/af2c00de62f7e31eaeb88996ebf3f330cc8473b9)) +- **eslint-plugin:** [explicit-function-return-type] add option to allow concise arrows that start with void ([#1732](https://github.com/typescript-eslint/typescript-eslint/issues/1732)) ([2e9c202](https://github.com/typescript-eslint/typescript-eslint/commit/2e9c2028a8a0b226e0f87d4bcc997fa259ca3ebd)) +- **eslint-plugin:** [explicit-module-boundary-types] add optio… ([#1778](https://github.com/typescript-eslint/typescript-eslint/issues/1778)) ([3eee804](https://github.com/typescript-eslint/typescript-eslint/commit/3eee804461d017ea6189cd7f64fcd473623684b4)) +- **eslint-plugin:** [no-base-to-string] add option to ignore tagged templates ([#1763](https://github.com/typescript-eslint/typescript-eslint/issues/1763)) ([f5edb99](https://github.com/typescript-eslint/typescript-eslint/commit/f5edb9938c33f8b68f026eba00db3abe9359ced3)) +- **eslint-plugin:** [restrict-template-expressions] add option `allowAny` ([#1762](https://github.com/typescript-eslint/typescript-eslint/issues/1762)) ([d44c0f9](https://github.com/typescript-eslint/typescript-eslint/commit/d44c0f9bed2404ca00b020b35fd825929e213398)) +- **eslint-plugin:** add rule `prefer-reduce-type-parameter` ([#1707](https://github.com/typescript-eslint/typescript-eslint/issues/1707)) ([c92d240](https://github.com/typescript-eslint/typescript-eslint/commit/c92d240e49113779053eac32038382b282812afc)) +- **eslint-plugin:** add rule `prefer-ts-expect-error` ([#1705](https://github.com/typescript-eslint/typescript-eslint/issues/1705)) ([7021f21](https://github.com/typescript-eslint/typescript-eslint/commit/7021f2151a25db2a8edf17e06cd6f21e90761ec8)) +- **eslint-plugin:** add rule no-unsafe-assignment ([#1694](https://github.com/typescript-eslint/typescript-eslint/issues/1694)) ([a49b860](https://github.com/typescript-eslint/typescript-eslint/commit/a49b860cbbb2c7d718b99f561e2fb6eaadf16f17)) +# [2.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.26.0...v2.27.0) (2020-04-06) +### Bug Fixes +- **eslint-plugin:** [no-throw-literal] fix crash caused by getBaseTypes ([#1830](https://github.com/typescript-eslint/typescript-eslint/issues/1830)) ([9d53c76](https://github.com/typescript-eslint/typescript-eslint/commit/9d53c761983dd964109b9f13eb9bfe20caf9defb)) +- **eslint-plugin:** [no-unsafe-call] fix incorrect selector ([#1826](https://github.com/typescript-eslint/typescript-eslint/issues/1826)) ([8ec53a3](https://github.com/typescript-eslint/typescript-eslint/commit/8ec53a3579fcb59cdffea0c60fbb755d056f4c8a)) +- **eslint-plugin:** [require-await] handle async generators ([#1782](https://github.com/typescript-eslint/typescript-eslint/issues/1782)) ([9642d9d](https://github.com/typescript-eslint/typescript-eslint/commit/9642d9dce693befac89a4e9d8bf8dd18f4361e2a)) +- **eslint-plugin:** no-explicit-any constructor functions (& mo… ([#1711](https://github.com/typescript-eslint/typescript-eslint/issues/1711)) ([ab8572e](https://github.com/typescript-eslint/typescript-eslint/commit/ab8572e30e14ebda91c8437be5ee35e7dc9add2e)) +### Features -# [2.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.11.0...v2.12.0) (2019-12-16) +- **eslint-plugin:** new rule method-signature-style ([#1685](https://github.com/typescript-eslint/typescript-eslint/issues/1685)) ([c49d771](https://github.com/typescript-eslint/typescript-eslint/commit/c49d771ba62f1a21d3c1aec106341daddfcd3c9a)) +- **eslint-plugin:** sort members alphabetically ([#263](https://github.com/typescript-eslint/typescript-eslint/issues/263)) ([485e902](https://github.com/typescript-eslint/typescript-eslint/commit/485e90213a0f8baac0587f7d56925448883fc5bd)) +- **eslint-plugin-internal:** add plugin-test-formatting rule ([#1821](https://github.com/typescript-eslint/typescript-eslint/issues/1821)) ([9b0023a](https://github.com/typescript-eslint/typescript-eslint/commit/9b0023a4996ecdd7dfcb30abd1678091a78f3064)) +# [2.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.25.0...v2.26.0) (2020-03-30) ### Bug Fixes -* **eslint-plugin:** [prefer-null-coal] fixer w/ mixed logicals ([#1326](https://github.com/typescript-eslint/typescript-eslint/issues/1326)) ([f9a9fbf](https://github.com/typescript-eslint/typescript-eslint/commit/f9a9fbf)) -* **eslint-plugin:** [quotes] ignore backticks for interface properties ([#1311](https://github.com/typescript-eslint/typescript-eslint/issues/1311)) ([3923a09](https://github.com/typescript-eslint/typescript-eslint/commit/3923a09)) - +- **eslint-plugin:** [no-explicit-any] error with ignoreRestArgs ([#1796](https://github.com/typescript-eslint/typescript-eslint/issues/1796)) ([638d84d](https://github.com/typescript-eslint/typescript-eslint/commit/638d84ddd77d07117b3ec7c5431f3b0e44b1995d)) +- **eslint-plugin:** [no-unsafe-call] allow import expressions ([#1800](https://github.com/typescript-eslint/typescript-eslint/issues/1800)) ([4fa7107](https://github.com/typescript-eslint/typescript-eslint/commit/4fa710754ecc412b65ac3864fe0c7857c254ac1b)) +- **eslint-plugin:** [no-unsafe-return] error with ESLint Plugin TypeScript +# `@typescript-eslint/eslint-plugin` -

An ESLint plugin which provides lint rules for TypeScript codebases.

+An ESLint plugin which provides lint rules for TypeScript codebases. -

- CI - NPM Version - NPM Downloads -

+[![NPM Version](https://img.shields.io/npm/v/@typescript-eslint/eslint-plugin.svg?style=flat-square)](https://www.npmjs.com/package/@typescript-eslint/eslint-plugin) +[![NPM Downloads](https://img.shields.io/npm/dm/@typescript-eslint/eslint-plugin.svg?style=flat-square)](https://www.npmjs.com/package/@typescript-eslint/eslint-plugin) -## Getting Started +👉 See **https://typescript-eslint.io/architecture/utils** for our Getting Started docs. -- **[You can find our Getting Started docs here](https://typescript-eslint.io/docs)** -- **[You can find our FAQ / Troubleshooting docs here](https://typescript-eslint.io/docs/linting/troubleshooting)** - -These docs walk you through setting up ESLint, this plugin, and our parser. If you know what you're doing and just want to quick start, read on... - -## Quick-start - -### Installation - -Make sure you have TypeScript and [`@typescript-eslint/parser`](../parser) installed: - -```bash -$ yarn add -D typescript @typescript-eslint/parser -$ npm i --save-dev typescript @typescript-eslint/parser -``` - -Then install the plugin: - -```bash -$ yarn add -D @typescript-eslint/eslint-plugin -$ npm i --save-dev @typescript-eslint/eslint-plugin -``` - -It is important that you use the same version number for `@typescript-eslint/parser` and `@typescript-eslint/eslint-plugin`. - -**Note:** If you installed ESLint globally (using the `-g` flag) then you must also install `@typescript-eslint/eslint-plugin` globally. - -### Usage - -Add `@typescript-eslint/parser` to the `parser` field and `@typescript-eslint` to the plugins section of your `.eslintrc` configuration file, then configure the rules you want to use under the rules section. - -```json -{ - "parser": "@typescript-eslint/parser", - "plugins": ["@typescript-eslint"], - "rules": { - "@typescript-eslint/rule-name": "error" - } -} -``` - -You can also enable all the recommended rules for our plugin. Add `plugin:@typescript-eslint/recommended` in extends: - -```json -{ - "extends": ["plugin:@typescript-eslint/recommended"] -} -``` - -### Recommended Configs - -You can also use [`eslint:recommended`](https://eslint.org/docs/rules/) (the set of rules which are recommended for all projects by the ESLint Team) with this plugin: - -```json -{ - "extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"] -} -``` - -As of version 2 of this plugin, _by design_, none of the rules in the main `recommended` config require type-checking in order to run. This means that they are more lightweight and faster to run. - -Some highly valuable rules require type-checking in order to be implemented correctly, however, so we provide an additional config you can extend from called `recommended-requiring-type-checking`. You would apply this _in addition_ to the recommended configs previously mentioned, e.g.: - -```json -{ - "extends": [ - "eslint:recommended", - "plugin:@typescript-eslint/recommended", - "plugin:@typescript-eslint/recommended-requiring-type-checking" - ] -} -``` - -Pro Tip: For larger codebases you may want to consider splitting our linting into two separate stages: 1. fast feedback rules which operate purely based on syntax (no type-checking), 2. rules which are based on semantics (type-checking). - -**[You can read more about linting with type information here](https://typescript-eslint.io/docs/linting/typed-linting)** - -## Supported Rules - -For the exhaustive list of supported rules, [please see our website](https://typescript-eslint.io/rules/). - -## Contributing - -[See the contributing guide here](../../CONTRIBUTING.md). +> See https://typescript-eslint.io for general documentation on typescript-eslint, the tooling that allows you to run ESLint and Prettier on TypeScript code. diff --git a/packages/eslint-plugin/docs/rules/README.md b/packages/eslint-plugin/docs/rules/README.md index 7c6bd00d36d..04e2d987056 100644 --- a/packages/eslint-plugin/docs/rules/README.md +++ b/packages/eslint-plugin/docs/rules/README.md @@ -7,7 +7,7 @@ slug: / --- `@typescript-eslint/eslint-plugin` includes over 100 rules that detect best practice violations, bugs, and/or stylistic issues specifically for TypeScript code. -See [Configs](/docs/linting/configs) for how to enable recommended rules using configs. +See [Configs](/linting/configs) for how to enable recommended rules using configs. ## Supported Rules diff --git a/packages/eslint-plugin/docs/rules/TEMPLATE.md b/packages/eslint-plugin/docs/rules/TEMPLATE.md index 20ca5d8bdbe..ddc6def34a5 100644 --- a/packages/eslint-plugin/docs/rules/TEMPLATE.md +++ b/packages/eslint-plugin/docs/rules/TEMPLATE.md @@ -2,7 +2,7 @@ > > See **https://typescript-eslint.io/rules/your-rule-name** for documentation. -## Rule Details +## Examples To fill out: tell us more about this rule. diff --git a/packages/eslint-plugin/docs/rules/adjacent-overload-signatures.md b/packages/eslint-plugin/docs/rules/adjacent-overload-signatures.md index 422824d7f3e..b221b449724 100644 --- a/packages/eslint-plugin/docs/rules/adjacent-overload-signatures.md +++ b/packages/eslint-plugin/docs/rules/adjacent-overload-signatures.md @@ -1,16 +1,16 @@ --- -description: 'Require that member overloads be consecutive.' +description: 'Require that function overload signatures be consecutive.' --- > 🛑 This file is source code, not the primary documentation location! 🛑 > > See **https://typescript-eslint.io/rules/adjacent-overload-signatures** for documentation. -Grouping overloaded members together can improve readability of the code. +Function overload signatures represent multiple ways a function can be called, potentially with different return types. +It's typical for an interface or type alias describing a function to place all overload signatures next to each other. +If Signatures placed elsewhere in the type are easier to be missed by future developers reading the code. -## Rule Details - -This rule aims to standardize the way overloaded members are organized. +## Examples diff --git a/packages/eslint-plugin/docs/rules/array-type.md b/packages/eslint-plugin/docs/rules/array-type.md index 08b9ddfb386..66905370cf0 100644 --- a/packages/eslint-plugin/docs/rules/array-type.md +++ b/packages/eslint-plugin/docs/rules/array-type.md @@ -1,16 +1,14 @@ --- -description: 'Require using either `T[]` or `Array` for arrays.' +description: 'Require consistently using either `T[]` or `Array` for arrays.' --- > 🛑 This file is source code, not the primary documentation location! 🛑 > > See **https://typescript-eslint.io/rules/array-type** for documentation. -Using the same style for array definitions across your codebase makes it easier for your developers to read and understand the types. - -## Rule Details - -This rule aims to standardize usage of array types within your codebase. +TypeScript provides two equivalent ways to define an array type: `T[]` and `Array`. +The two styles are functionally equivalent. +Using the same style consistently across your codebase makes it easier for developers to read and understand array types. ## Options diff --git a/packages/eslint-plugin/docs/rules/await-thenable.md b/packages/eslint-plugin/docs/rules/await-thenable.md index dda20909971..8179a90af19 100644 --- a/packages/eslint-plugin/docs/rules/await-thenable.md +++ b/packages/eslint-plugin/docs/rules/await-thenable.md @@ -6,12 +6,13 @@ description: 'Disallow awaiting a value that is not a Thenable.' > > See **https://typescript-eslint.io/rules/await-thenable** for documentation. -This rule disallows awaiting a value that is not a "Thenable" (an object which has `then` method, such as a Promise). -While it is valid JavaScript to await a non-`Promise`-like value (it will resolve immediately), this pattern is often a programmer error, such as forgetting to add parenthesis to call a function that returns a Promise. +A "Thenable" value is an object with has a `then` method, such as a Promise. +The `await` keyword is generally used to retrieve the result of calling a Thenable's `then` method. -## Rule Details +If the `await` keyword is used on a value that is not a Thenable, the value is directly resolved immediately. +While doing so is valid JavaScript, it is often a programmer error, such as forgetting to add parenthesis to call a function that returns a Promise. -Examples of code for this rule: +## Examples diff --git a/packages/eslint-plugin/docs/rules/ban-ts-comment.md b/packages/eslint-plugin/docs/rules/ban-ts-comment.md index efadc961e10..b0fa17f6aa0 100644 --- a/packages/eslint-plugin/docs/rules/ban-ts-comment.md +++ b/packages/eslint-plugin/docs/rules/ban-ts-comment.md @@ -1,5 +1,5 @@ --- -description: 'Disallow `@ts-` comments or require descriptions after directive.' +description: 'Disallow `@ts-` comments or require descriptions after directives.' --- > 🛑 This file is source code, not the primary documentation location! 🛑 @@ -7,7 +7,8 @@ description: 'Disallow `@ts-` comments or require descriptions after > 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. -Using these to suppress TypeScript Compiler Errors reduces the effectiveness of TypeScript overall. +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: @@ -18,8 +19,6 @@ The directive comments supported by TypeScript are: // @ts-check ``` -## Rule Details - This rule lets you set which directive comments you want to allow in your codebase. ## Options diff --git a/packages/eslint-plugin/docs/rules/ban-tslint-comment.md b/packages/eslint-plugin/docs/rules/ban-tslint-comment.md index fc9fe81af6b..96a5e9b91db 100644 --- a/packages/eslint-plugin/docs/rules/ban-tslint-comment.md +++ b/packages/eslint-plugin/docs/rules/ban-tslint-comment.md @@ -8,9 +8,9 @@ description: 'Disallow `// tslint:` comments.' Useful when migrating from TSLint to ESLint. Once TSLint has been removed, this rule helps locate TSLint annotations (e.g. `// tslint:disable`). -## Rule Details +> See the [TSLint rule flags docs](https://palantir.github.io/tslint/usage/rule-flags) for reference. -All TSLint [rule flags](https://palantir.github.io/tslint/usage/rule-flags/) +## Examples diff --git a/packages/eslint-plugin/docs/rules/ban-types.md b/packages/eslint-plugin/docs/rules/ban-types.md index 2d0b345cda8..016b2a7217e 100644 --- a/packages/eslint-plugin/docs/rules/ban-types.md +++ b/packages/eslint-plugin/docs/rules/ban-types.md @@ -9,11 +9,11 @@ description: 'Disallow certain types.' Some built-in types have aliases, while some types are considered dangerous or harmful. It's often a good idea to ban certain types to help with consistency and safety. -## Rule Details - This rule bans specific types and can suggest alternatives. Note that it does not ban the corresponding runtime objects from being used. +## Examples + Examples of code with the default options: diff --git a/packages/eslint-plugin/docs/rules/brace-style.md b/packages/eslint-plugin/docs/rules/brace-style.md index 18f93c48a5e..4e032c80580 100644 --- a/packages/eslint-plugin/docs/rules/brace-style.md +++ b/packages/eslint-plugin/docs/rules/brace-style.md @@ -6,7 +6,7 @@ description: 'Enforce consistent brace style for blocks.' > > See **https://typescript-eslint.io/rules/brace-style** for documentation. -## Rule Details +## Examples This rule extends the base [`eslint/brace-style`](https://eslint.org/docs/rules/brace-style) rule. It adds support for `enum`, `interface`, `namespace` and `module` declarations. diff --git a/packages/eslint-plugin/docs/rules/class-literal-property-style.md b/packages/eslint-plugin/docs/rules/class-literal-property-style.md index 7d1acfcd4bb..6ce4b454e5b 100644 --- a/packages/eslint-plugin/docs/rules/class-literal-property-style.md +++ b/packages/eslint-plugin/docs/rules/class-literal-property-style.md @@ -6,14 +6,14 @@ description: 'Enforce that literals on classes are exposed in a consistent style > > See **https://typescript-eslint.io/rules/class-literal-property-style** for documentation. -When writing TypeScript applications, it's typically safe to store literal values on classes using fields with the `readonly` modifier to prevent them from being reassigned. -When writing TypeScript libraries that could be used by JavaScript users however, it's typically safer to expose these literals using `getter`s, since the `readonly` modifier is enforced at compile type. - -## Options +Some TypeScript applications store literal values on classes using fields with the `readonly` modifier to prevent them from being reassigned. +When writing TypeScript libraries that could be used by JavaScript users, however, it's typically safer to expose these literals using `getter`s, since the `readonly` modifier is enforced at compile type. This rule aims to ensure that literals exposed by classes are done so consistently, in one of the two style described above. By default this rule prefers the `fields` style as it means JS doesn't have to setup & teardown a function closure. +## Options + :::note This rule only checks for constant _literal_ values (string, template string, number, bigint, boolean, regexp, null). It does not check objects or arrays, because a readonly field behaves differently to a getter in those cases. It also does not check functions, as it is a common pattern to use readonly fields with arrow function values as auto-bound methods. diff --git a/packages/eslint-plugin/docs/rules/comma-dangle.md b/packages/eslint-plugin/docs/rules/comma-dangle.md index 49f816448fb..1f11f9cf3ac 100644 --- a/packages/eslint-plugin/docs/rules/comma-dangle.md +++ b/packages/eslint-plugin/docs/rules/comma-dangle.md @@ -6,7 +6,7 @@ description: 'Require or disallow trailing commas.' > > See **https://typescript-eslint.io/rules/comma-dangle** for documentation. -## Rule Details +## Examples This rule extends the base [`eslint/comma-dangle`](https://eslint.org/docs/rules/comma-dangle) rule. It adds support for TypeScript syntax. diff --git a/packages/eslint-plugin/docs/rules/comma-spacing.md b/packages/eslint-plugin/docs/rules/comma-spacing.md index af4959e146d..9d5424811a8 100644 --- a/packages/eslint-plugin/docs/rules/comma-spacing.md +++ b/packages/eslint-plugin/docs/rules/comma-spacing.md @@ -6,7 +6,7 @@ description: 'Enforce consistent spacing before and after commas.' > > See **https://typescript-eslint.io/rules/comma-spacing** for documentation. -## Rule Details +## Examples This rule extends the base [`eslint/comma-spacing`](https://eslint.org/docs/rules/comma-spacing) rule. It adds support for trailing comma in a types parameters list. diff --git a/packages/eslint-plugin/docs/rules/consistent-generic-constructors.md b/packages/eslint-plugin/docs/rules/consistent-generic-constructors.md index 893c4ce819e..6c259a70888 100644 --- a/packages/eslint-plugin/docs/rules/consistent-generic-constructors.md +++ b/packages/eslint-plugin/docs/rules/consistent-generic-constructors.md @@ -17,10 +17,10 @@ const map = new Map(); ``` This rule ensures that type arguments appear consistently on one side of the declaration. +Keeping to one side consistently improve code readability. -## Rule Details - -The rule never reports when there are type parameters on both sides, or neither sides of the declaration. It also doesn't report if the names of the type annotation and the constructor don't match. +> The rule never reports when there are type parameters on both sides, or neither sides of the declaration. +> It also doesn't report if the names of the type annotation and the constructor don't match. ## Options diff --git a/packages/eslint-plugin/docs/rules/consistent-indexed-object-style.md b/packages/eslint-plugin/docs/rules/consistent-indexed-object-style.md index 918c27fef61..d8d805df692 100644 --- a/packages/eslint-plugin/docs/rules/consistent-indexed-object-style.md +++ b/packages/eslint-plugin/docs/rules/consistent-indexed-object-style.md @@ -6,7 +6,7 @@ description: 'Require or disallow the `Record` type.' > > See **https://typescript-eslint.io/rules/consistent-indexed-object-style** for documentation. -TypeScript supports defining object show keys can be flexible using an index signature. TypeScript also has a builtin type named `Record` to create an empty object defining only an index signature. For example, the following types are equal: +TypeScript supports defining arbitrary object keys using an index signature. TypeScript also has a builtin type named `Record` to create an empty object defining only an index signature. For example, the following types are equal: ```ts interface Foo { @@ -20,9 +20,7 @@ type Foo = { type Foo = Record; ``` -## Rule Details - -This rule enforces a consistent way to define records. +Keeping to one declaration form consistently improve code readability. ## Options diff --git a/packages/eslint-plugin/docs/rules/consistent-type-assertions.md b/packages/eslint-plugin/docs/rules/consistent-type-assertions.md index f6d439613cb..4c7f87ee955 100644 --- a/packages/eslint-plugin/docs/rules/consistent-type-assertions.md +++ b/packages/eslint-plugin/docs/rules/consistent-type-assertions.md @@ -6,15 +6,22 @@ description: 'Enforce consistent usage of type assertions.' > > See **https://typescript-eslint.io/rules/consistent-type-assertions** for documentation. -## Rule Details +TypeScript provides two syntaxes for "type assertions": -This rule aims to standardize the use of type assertion style across the codebase. +- Angle brackets: `value` +- As: `value as Type` -Type assertions are also commonly referred as "type casting" in TypeScript (even though it is technically slightly different to what is understood by type casting in other languages), so you can think of type assertions and type casting referring to the same thing. It is essentially you saying to the TypeScript compiler, "in this case, I know better than you!". +This rule aims to standardize the use of type assertion style across the codebase. +Keeping to one syntax consistently helps with code readability. -In addition to ensuring that type assertions are written in a consistent way, this rule also helps make your codebase more type-safe. +:::note +Type assertions are also commonly referred as "type casting" in TypeScript. +However, that term is technically slightly different to what is understood by type casting in other languages. +Type assertions are a way to say to the TypeScript compiler, _"I know better than you, it's actually this different type!"_. +::: -[`const` assertions](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-4.html#const-assertions) are always allowed by this rule. Examples of them include `let x = "hello" as const;` and `let x = "hello";`. +[`const` assertions](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-4.html#const-assertions) are always allowed by this rule. +Examples of them include `let x = "hello" as const;` and `let x = "hello";`. ## Options diff --git a/packages/eslint-plugin/docs/rules/consistent-type-definitions.md b/packages/eslint-plugin/docs/rules/consistent-type-definitions.md index 5d400a28a1c..9d72abe36ae 100644 --- a/packages/eslint-plugin/docs/rules/consistent-type-definitions.md +++ b/packages/eslint-plugin/docs/rules/consistent-type-definitions.md @@ -6,7 +6,7 @@ description: 'Enforce type definitions to consistently use either `interface` or > > See **https://typescript-eslint.io/rules/consistent-type-definitions** for documentation. -There are two ways to define a type. +TypeScript provides two common ways to define an object type: `interface` and `type`. ```ts // type alias @@ -22,6 +22,9 @@ interface T2 { } ``` +The two are generally very similar, and can often be used interchangeably. +Using the same type declaration style consistently helps with code readability. + ## Options - `"interface"` _(default)_: enforce using `interface`s for object type definitions. diff --git a/packages/eslint-plugin/docs/rules/consistent-type-exports.md b/packages/eslint-plugin/docs/rules/consistent-type-exports.md index 97a11e65a28..ec15e9fdecb 100644 --- a/packages/eslint-plugin/docs/rules/consistent-type-exports.md +++ b/packages/eslint-plugin/docs/rules/consistent-type-exports.md @@ -6,14 +6,10 @@ description: 'Enforce consistent usage of type exports.' > > See **https://typescript-eslint.io/rules/consistent-type-exports** for documentation. -Type-only exports allow you to specify that 1 or more named exports are exported as type-only. This allows -transpilers to drop exports without knowing the types of the dependencies. +TypeScript allows specifying a `type` keyword on exports to indicate that the export exists only in the type system, not at runtime. +This allows transpilers to drop exports without knowing the types of the dependencies. -## Rule Details - -This rule aims to standardize the use of type exports style. - -Given a class `Button`, and an interface `ButtonProps`, examples of code: +## Examples @@ -25,9 +21,7 @@ interface ButtonProps { } class Button implements ButtonProps { - onClick() { - console.log('button!'); - } + onClick = () => console.log('button!'); } export { Button, ButtonProps }; @@ -39,11 +33,11 @@ export { Button, ButtonProps }; interface ButtonProps { onClick: () => void; } + class Button implements ButtonProps { - onClick() { - console.log('button!'); - } + onClick = () => console.log('button!'); } + export { Button }; export type { ButtonProps }; ``` diff --git a/packages/eslint-plugin/docs/rules/consistent-type-imports.md b/packages/eslint-plugin/docs/rules/consistent-type-imports.md index 9293fca42c6..045b7c2fa7d 100644 --- a/packages/eslint-plugin/docs/rules/consistent-type-imports.md +++ b/packages/eslint-plugin/docs/rules/consistent-type-imports.md @@ -6,11 +6,8 @@ description: 'Enforce consistent usage of type imports.' > > See **https://typescript-eslint.io/rules/consistent-type-imports** for documentation. -Type-only imports allow you to specify that an import can only be used in a type location, allowing certain optimizations within compilers. - -## Rule Details - -This rule aims to standardize the use of type imports style. +TypeScript allows specifying a `type` keyword on imports to indicate that the export exists only in the type system, not at runtime. +This allows transpilers to drop imports without knowing the types of the dependencies. ## Options @@ -18,7 +15,7 @@ This rule aims to standardize the use of type imports style. This option defines the expected import kind for type-only imports. Valid values for `prefer` are: -- `type-imports` will enforce that you always use `import type Foo from '...'` except referenced by metadata of decorators. It is default. +- `type-imports` will enforce that you always use `import type Foo from '...'` except referenced by metadata of decorators. It is the default. - `no-type-imports` will enforce that you always use `import Foo from '...'`. Examples of **correct** code with `{prefer: 'type-imports'}`, and **incorrect** code with `{prefer: 'no-type-imports'}`. @@ -39,6 +36,44 @@ type T = Foo; const x: Bar = 1; ``` +### `fixStyle` + +This option defines the expected type modifier to be added when an import is detected as used only in the type position. Valid values for `fixStyle` are: + +- `separate-type-imports` will add the type keyword after the import keyword `import type { A } from '...'`. It is the default. +- `inline-type-imports` will inline the type keyword `import { type A } from '...'` and is only available in TypeScript 4.5 and onwards. See [documentation here](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-5.html#type-modifiers-on-import-names 'TypeScript 4.5 documentation on type modifiers and import names'). + + + +#### ❌ Incorrect + +```ts +import { Foo } from 'Foo'; +import Bar from 'Bar'; +type T = Foo; +const x: Bar = 1; +``` + +#### ✅ With `separate-type-imports` + +```ts +import type { Foo } from 'Foo'; +import type Bar from 'Bar'; +type T = Foo; +const x: Bar = 1; +``` + +#### ✅ With `inline-type-imports` + +```ts +import { type Foo } from 'Foo'; +import type Bar from 'Bar'; +type T = Foo; +const x: Bar = 1; +``` + + + ### `disallowTypeAnnotations` If `true`, type imports in type annotations (`import()`) are not allowed. @@ -51,6 +86,12 @@ type T = import('Foo').Foo; const x: import('Bar') = 1; ``` +## Usage with `emitDecoratorMetadata` + +The `emitDecoratorMetadata` compiler option changes the code the TypeScript emits. In short - it causes TypeScript to create references to value imports when they are used in a type-only location. If you are using `emitDecoratorMetadata` then our tooling will require additional information in order for the rule to work correctly. + +If you are using [type-aware linting](https://typescript-eslint.io/linting/typed-linting), then you just need to ensure that the `tsconfig.json` you've configured for `parserOptions.project` has `emitDecoratorMetadata` turned on. Otherwise you can explicitly tell our tooling to analyze your code as if the compiler option was turned on [by setting `parserOptions.emitDecoratorMetadata` to `true`](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/README.md#parseroptionsemitdecoratormetadata). + ## When Not To Use It - If you specifically want to use both import kinds for stylistic reasons, you can disable this rule. diff --git a/packages/eslint-plugin/docs/rules/default-param-last.md b/packages/eslint-plugin/docs/rules/default-param-last.md index 9a0624fca22..e5902b200c0 100644 --- a/packages/eslint-plugin/docs/rules/default-param-last.md +++ b/packages/eslint-plugin/docs/rules/default-param-last.md @@ -6,7 +6,7 @@ description: 'Enforce default parameters to be last.' > > See **https://typescript-eslint.io/rules/default-param-last** for documentation. -## Rule Details +## Examples This rule extends the base [`eslint/default-param-last`](https://eslint.org/docs/rules/default-param-last) rule. It adds support for optional parameters. diff --git a/packages/eslint-plugin/docs/rules/dot-notation.md b/packages/eslint-plugin/docs/rules/dot-notation.md index 741de5ee5e7..e48e2c9a9b4 100644 --- a/packages/eslint-plugin/docs/rules/dot-notation.md +++ b/packages/eslint-plugin/docs/rules/dot-notation.md @@ -6,7 +6,7 @@ description: 'Enforce dot notation whenever possible.' > > See **https://typescript-eslint.io/rules/dot-notation** for documentation. -## Rule Details +## Examples This rule extends the base [`eslint/dot-notation`](https://eslint.org/docs/rules/dot-notation) rule. It adds: diff --git a/packages/eslint-plugin/docs/rules/explicit-function-return-type.md b/packages/eslint-plugin/docs/rules/explicit-function-return-type.md index 5697be355b5..3a67a7e2372 100644 --- a/packages/eslint-plugin/docs/rules/explicit-function-return-type.md +++ b/packages/eslint-plugin/docs/rules/explicit-function-return-type.md @@ -6,14 +6,15 @@ description: 'Require explicit return types on functions and class methods.' > > See **https://typescript-eslint.io/rules/explicit-function-return-type** for documentation. -Explicit types for function return values makes it clear to any calling code what type is returned. -This ensures that the return value is assigned to a variable of the correct type; or in the case -where there is no return value, that the calling code doesn't try to use the undefined value when it -shouldn't. +Functions in TypeScript often don't need to be given an explicit return type annotation. +Leaving off the return type is less code to read or write and allows the compiler to infer it from the contents of the function. -## Rule Details +However, explicit return types do make it visually more clear what type is returned by a function. +They can also speed up TypeScript type checking performance in large codebases with many large functions. -This rule aims to ensure that the values returned from functions are of the expected type. +This rule enforces that functions do have an explicit return type annotation. + +## Examples diff --git a/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md b/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md index 6cb6068a887..87d7d23b038 100644 --- a/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md +++ b/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md @@ -6,12 +6,16 @@ description: 'Require explicit accessibility modifiers on class properties and m > > See **https://typescript-eslint.io/rules/explicit-member-accessibility** for documentation. -Leaving off accessibility modifier and making everything public can make -your interface hard to use by others. -If you make all internal pieces private or protected, your interface will -be easier to use. +TypeScript allows placing explicit `public`, `protected`, and `private` accessibility modifiers in front of class members. +The modifiers exist solely in the type system and just server to describe who is allowed to access those members. -## Rule Details +Leaving off accessibility modifiers makes for less code to read and write. +Members are `public` by default. + +However, adding in explicit accessibility modifiers can be helpful in codebases with many classes for enforcing proper privacy of members. +Some developers also find it preferable for code readability to keep member publicity explicit. + +## Examples This rule aims to make code more readable and explicit about who can use which properties. @@ -324,4 +328,4 @@ If you think defaulting to public is a good default, then you should consider us ## Further Reading -- TypeScript [Accessibility Modifiers](https://www.typescriptlang.org/docs/handbook/classes.html#public-private-and-protected-modifiers) +- TypeScript [Accessibility Modifiers Handbook Docs](https://www.typescriptlang.org/docs/handbook/2/classes.html#member-visibility) diff --git a/packages/eslint-plugin/docs/rules/explicit-module-boundary-types.md b/packages/eslint-plugin/docs/rules/explicit-module-boundary-types.md index 48626a34b08..2995d3b2c7e 100644 --- a/packages/eslint-plugin/docs/rules/explicit-module-boundary-types.md +++ b/packages/eslint-plugin/docs/rules/explicit-module-boundary-types.md @@ -7,10 +7,10 @@ description: "Require explicit return and argument types on exported functions' > See **https://typescript-eslint.io/rules/explicit-module-boundary-types** for documentation. Explicit types for function return values and arguments makes it clear to any calling code what is the module boundary's input and output. +Adding explicit type annotations for those types can help improve code readability. +It can also improve TypeScript type checking performance on larger codebases. -## Rule Details - -This rule aims to ensure that the values returned from a module are of the expected type. +## Examples diff --git a/packages/eslint-plugin/docs/rules/func-call-spacing.md b/packages/eslint-plugin/docs/rules/func-call-spacing.md index 74de5955e9b..c30bbface28 100644 --- a/packages/eslint-plugin/docs/rules/func-call-spacing.md +++ b/packages/eslint-plugin/docs/rules/func-call-spacing.md @@ -6,7 +6,7 @@ description: 'Require or disallow spacing between function identifiers and their > > See **https://typescript-eslint.io/rules/func-call-spacing** for documentation. -## Rule Details +## Examples This rule extends the base [`eslint/func-call-spacing`](https://eslint.org/docs/rules/func-call-spacing) rule. It adds support for generic type parameters on function calls. diff --git a/packages/eslint-plugin/docs/rules/indent.md b/packages/eslint-plugin/docs/rules/indent.md index 6c16f6f0c21..3d291c8b81c 100644 --- a/packages/eslint-plugin/docs/rules/indent.md +++ b/packages/eslint-plugin/docs/rules/indent.md @@ -14,7 +14,7 @@ Please read [Issue #1824: Problems with the indent rule](https://github.com/type ::: -## Rule Details +## Examples This rule extends the base [`eslint/indent`](https://eslint.org/docs/rules/indent) rule. It adds support for TypeScript nodes. diff --git a/packages/eslint-plugin/docs/rules/init-declarations.md b/packages/eslint-plugin/docs/rules/init-declarations.md index 97fc51bc5c3..da086da8392 100644 --- a/packages/eslint-plugin/docs/rules/init-declarations.md +++ b/packages/eslint-plugin/docs/rules/init-declarations.md @@ -6,7 +6,7 @@ description: 'Require or disallow initialization in variable declarations.' > > See **https://typescript-eslint.io/rules/init-declarations** for documentation. -## Rule Details +## Examples This rule extends the base [`eslint/init-declarations`](https://eslint.org/docs/rules/init-declarations) rule. It adds support for TypeScript's `declare` variables. diff --git a/packages/eslint-plugin/docs/rules/keyword-spacing.md b/packages/eslint-plugin/docs/rules/keyword-spacing.md index 17f731cfc94..5fe8888ff99 100644 --- a/packages/eslint-plugin/docs/rules/keyword-spacing.md +++ b/packages/eslint-plugin/docs/rules/keyword-spacing.md @@ -6,7 +6,7 @@ description: 'Enforce consistent spacing before and after keywords.' > > See **https://typescript-eslint.io/rules/keyword-spacing** for documentation. -## Rule Details +## Examples This rule extends the base [`eslint/keyword-spacing`](https://eslint.org/docs/rules/keyword-spacing) rule. This version adds support for generic type parameters on function calls. diff --git a/packages/eslint-plugin/docs/rules/lines-between-class-members.md b/packages/eslint-plugin/docs/rules/lines-between-class-members.md index f8d40de4089..13636d07a2c 100644 --- a/packages/eslint-plugin/docs/rules/lines-between-class-members.md +++ b/packages/eslint-plugin/docs/rules/lines-between-class-members.md @@ -8,7 +8,7 @@ description: 'Require or disallow an empty line between class members.' This rule improves readability by enforcing lines between class members. It will not check empty lines before the first member and after the last member. This rule will require or disallow an empty line between class members. -## Rule Details +## Examples This rule extends the base [`eslint/lines-between-class-members`](https://eslint.org/docs/rules/lines-between-class-members) rule. It adds support for ignoring overload methods in a class. diff --git a/packages/eslint-plugin/docs/rules/member-delimiter-style.md b/packages/eslint-plugin/docs/rules/member-delimiter-style.md index 1437e97ba60..d2e1f59ec4f 100644 --- a/packages/eslint-plugin/docs/rules/member-delimiter-style.md +++ b/packages/eslint-plugin/docs/rules/member-delimiter-style.md @@ -6,82 +6,29 @@ description: 'Require a specific member delimiter style for interfaces and type > > See **https://typescript-eslint.io/rules/member-delimiter-style** for documentation. -Enforces a consistent member delimiter style in interfaces and type literals. There are three member delimiter styles primarily used in TypeScript: - -- Semicolon style (default, preferred in TypeScript). +TypeScript allows three delimiters between members in interfaces and type aliases: ```ts interface Foo { + // Semicolons (default, preferred in TypeScript): name: string; - greet(): void; -} - -type Bar = { - name: string; - greet(): void; -} -``` - -- Comma style (JSON style). - -```ts -interface Foo { - name: string, - greet(): void, -} - -type Bar = { + // Commas (JSON-like): name: string, - greet(): void, -} -``` -- Line break (none) style. - - -```ts -interface Foo { + // Line breaks (none): name: string - greet(): void -} - -type Bar = { - name: string - greet(): void } ``` -The rule also enforces the presence (or absence) of the delimiter in the last member of the interface and/or type literal. -Finally, this rule can enforce separate delimiter syntax for single line declarations. +For code readability, it's generally best to use the same style consistently in your codebase. -## Rule Details - -This rule aims to standardize the way interface and type literal members are delimited. +This rule enforces keeping to one configurable code style. +It can also standardize the presence (or absence) of a delimiter in the last member of a construct, as well as a separate delimiter syntax for single line declarations. ## Options -```ts -interface BaseConfig { - multiline?: { - delimiter?: 'none' | 'semi' | 'comma'; - requireLast?: boolean; - }; - singleline?: { - delimiter?: 'semi' | 'comma'; - requireLast?: boolean; - }; -} -type Config = BaseConfig & { - overrides?: { - interface?: BaseConfig; - typeLiteral?: BaseConfig; - }; - multilineDetection?: 'brackets' | 'last-member'; -}; -``` - Default config: ```json diff --git a/packages/eslint-plugin/docs/rules/member-ordering.md b/packages/eslint-plugin/docs/rules/member-ordering.md index 2765aeb5dd6..919ec88186f 100644 --- a/packages/eslint-plugin/docs/rules/member-ordering.md +++ b/packages/eslint-plugin/docs/rules/member-ordering.md @@ -6,11 +6,8 @@ description: 'Require a consistent member declaration order.' > > See **https://typescript-eslint.io/rules/member-ordering** for documentation. -A consistent ordering of fields, methods and constructors can make interfaces, type literals, classes and class expressions easier to read, navigate, and edit. - -## Rule Details - -This rule aims to standardize the way class declarations, class expressions, interfaces and type literals are structured and ordered. +This rule aims to standardize the way classes, interfaces, and type literals are structured and ordered. +A consistent ordering of fields, methods and constructors can make code easier to read, navigate, and edit. ## Options @@ -27,7 +24,13 @@ type OrderConfig = MemberType[] | SortedOrderConfig | 'never'; interface SortedOrderConfig { memberTypes?: MemberType[] | 'never'; - order: 'alphabetically' | 'alphabetically-case-insensitive' | 'as-written'; + optionalityOrder?: 'optional-first' | 'required-first'; + order: + | 'alphabetically' + | 'alphabetically-case-insensitive' + | 'as-written' + | 'natural' + | 'natural-case-insensitive'; } // See below for the more specific MemberType strings @@ -42,9 +45,10 @@ You can configure `OrderConfig` options for: - **`interfaces`**?: override ordering specifically for interfaces - **`typeLiterals`**?: override ordering specifically for type literals -The `OrderConfig` settings for each kind of construct may configure sorting on one or both two levels: +The `OrderConfig` settings for each kind of construct may configure sorting on up to three levels: - **`memberTypes`**: organizing on member type groups such as methods vs. properties +- **`optionalityOrder`**: whether to put all optional members first or all required members first - **`order`**: organizing based on member names, such as alphabetically ### Groups @@ -52,13 +56,24 @@ The `OrderConfig` settings for each kind of construct may configure sorting on o You can define many different groups based on different attributes of members. The supported member attributes are, in order: -- **Accessibility** (`'public' | 'protected' | 'private'`) +- **Accessibility** (`'public' | 'protected' | 'private' | '#private'`) - **Decoration** (`'decorated'`): Whether the member has an explicit accessibility decorator - **Kind** (`'call-signature' | 'constructor' | 'field' | 'get' | 'method' | 'set' | 'signature'`) Member attributes may be joined with a `'-'` to combine into more specific groups. For example, `'public-field'` would come before `'private-field'`. +### Orders + +The `order` value specifies what order members should be within a group. +It defaults to `as-written`, meaning any order is fine. +Other allowed values are: + +- `alphabetically`: Sorted in a-z alphabetical order, directly using string `<` comparison (so `B` comes before `a`) +- `alphabetically-case-insensitive`: Sorted in a-z alphabetical order, ignoring case (so `a` comes before `B`) +- `natural`: Same as `alphabetically`, but using [`natural-compare-lite`](https://github.com/litejs/natural-compare-lite) for more friendly sorting of numbers +- `natural-case-insensitive`: Same as `alphabetically-case-insensitive`, but using [`natural-compare-lite`](https://github.com/litejs/natural-compare-lite) for more friendly sorting of numbers + ### Default configuration The default configuration looks as follows: @@ -68,11 +83,13 @@ The default configuration looks as follows: "default": [ // Index signature "signature", + "call-signature", // Fields "public-static-field", "protected-static-field", "private-static-field", + "#private-static-field", "public-decorated-field", "protected-decorated-field", @@ -81,14 +98,15 @@ The default configuration looks as follows: "public-instance-field", "protected-instance-field", "private-instance-field", + "#private-instance-field", "public-abstract-field", "protected-abstract-field", - "private-abstract-field", "public-field", "protected-field", "private-field", + "#private-field", "static-field", "instance-field", @@ -112,6 +130,7 @@ The default configuration looks as follows: "public-static-get", "protected-static-get", "private-static-get", + "#private-static-get", "public-decorated-get", "protected-decorated-get", @@ -120,14 +139,15 @@ The default configuration looks as follows: "public-instance-get", "protected-instance-get", "private-instance-get", + "#private-instance-get", "public-abstract-get", "protected-abstract-get", - "private-abstract-get", "public-get", "protected-get", "private-get", + "#private-get", "static-get", "instance-get", @@ -141,6 +161,7 @@ The default configuration looks as follows: "public-static-set", "protected-static-set", "private-static-set", + "#private-static-set", "public-decorated-set", "protected-decorated-set", @@ -149,14 +170,15 @@ The default configuration looks as follows: "public-instance-set", "protected-instance-set", "private-instance-set", + "#private-instance-set", "public-abstract-set", "protected-abstract-set", - "private-abstract-set", "public-set", "protected-set", "private-set", + "#private-set", "static-set", "instance-set", @@ -170,6 +192,7 @@ The default configuration looks as follows: "public-static-method", "protected-static-method", "private-static-method", + "#private-static-method", "public-decorated-method", "protected-decorated-method", @@ -178,14 +201,15 @@ The default configuration looks as follows: "public-instance-method", "protected-instance-method", "private-instance-method", + "#private-instance-method", "public-abstract-method", "protected-abstract-method", - "private-abstract-method", "public-method", "protected-method", "private-method", + "#private-method", "static-method", "instance-method", @@ -889,6 +913,96 @@ interface Foo { } ``` +#### Sorting Optional Members First or Last + +The `optionalityOrder` option may be enabled to place all optional members in a group at the beginning or end of that group. + +This config places all optional members before all required members: + +```jsonc +// .eslintrc.json +{ + "rules": { + "@typescript-eslint/member-ordering": [ + "error", + { + "default": { + "optionalityOrder": "optional-first", + "order": "alphabetically" + } + } + ] + } +} +``` + + + +##### ❌ Incorrect + +```ts +interface Foo { + a: boolean; + b?: number; + c: string; +} +``` + +##### ✅ Correct + +```ts +interface Foo { + b?: number; + a: boolean; + c: string; +} +``` + + + +This config places all required members before all optional members: + +```jsonc +// .eslintrc.json +{ + "rules": { + "@typescript-eslint/member-ordering": [ + "error", + { + "default": { + "optionalityOrder": "required-first", + "order": "alphabetically" + } + } + ] + } +} +``` + + + +##### ❌ Incorrect + +```ts +interface Foo { + a: boolean; + b?: number; + c: string; +} +``` + +##### ✅ Correct + +```ts +interface Foo { + a: boolean; + c: string; + b?: number; +} +``` + + + ## All Supported Options ### Member Types (Granular Form) @@ -905,15 +1019,32 @@ The most explicit and granular form is the following: "public-static-field", "protected-static-field", "private-static-field", + "#private-static-field", + "public-decorated-field", "protected-decorated-field", "private-decorated-field", + "public-instance-field", "protected-instance-field", "private-instance-field", + "#private-instance-field", + "public-abstract-field", "protected-abstract-field", - "private-abstract-field", + + "public-field", + "protected-field", + "private-field", + "#private-field", + + "static-field", + "instance-field", + "abstract-field", + + "decorated-field", + + "field", // Static initialization "static-initialization", @@ -927,6 +1058,7 @@ The most explicit and granular form is the following: "public-static-get", "protected-static-get", "private-static-get", + "#private-static-get", "public-decorated-get", "protected-decorated-get", @@ -935,14 +1067,15 @@ The most explicit and granular form is the following: "public-instance-get", "protected-instance-get", "private-instance-get", + "#private-instance-get", "public-abstract-get", "protected-abstract-get", - "private-abstract-get", "public-get", "protected-get", "private-get", + "#private-get", "static-get", "instance-get", @@ -956,6 +1089,7 @@ The most explicit and granular form is the following: "public-static-set", "protected-static-set", "private-static-set", + "#private-static-set", "public-decorated-set", "protected-decorated-set", @@ -964,10 +1098,10 @@ The most explicit and granular form is the following: "public-instance-set", "protected-instance-set", "private-instance-set", + "#private-instance-set", "public-abstract-set", "protected-abstract-set", - "private-abstract-set", "public-set", "protected-set", @@ -985,15 +1119,16 @@ The most explicit and granular form is the following: "public-static-method", "protected-static-method", "private-static-method", + "#private-static-method", "public-decorated-method", "protected-decorated-method", "private-decorated-method", "public-instance-method", "protected-instance-method", "private-instance-method", + "#private-instance-method", "public-abstract-method", - "protected-abstract-method", - "private-abstract-method" + "protected-abstract-method" ] ``` @@ -1097,7 +1232,7 @@ Another option is to group the member types by their scope (`public`, `protected // Fields "static-field", // = ["public-static-field", "protected-static-field", "private-static-field"] "instance-field", // = ["public-instance-field", "protected-instance-field", "private-instance-field"] - "abstract-field", // = ["public-abstract-field", "protected-abstract-field", "private-abstract-field"] + "abstract-field", // = ["public-abstract-field", "protected-abstract-field"] // Static initialization // No scope for static initialization. @@ -1108,17 +1243,17 @@ Another option is to group the member types by their scope (`public`, `protected // Getters "static-get", // = ["public-static-get", "protected-static-get", "private-static-get"] "instance-get", // = ["public-instance-get", "protected-instance-get", "private-instance-get"] - "abstract-get", // = ["public-abstract-get", "protected-abstract-get", "private-abstract-get"] + "abstract-get", // = ["public-abstract-get", "protected-abstract-get"] // Setters "static-set", // = ["public-static-set", "protected-static-set", "private-static-set"] "instance-set", // = ["public-instance-set", "protected-instance-set", "private-instance-set"] - "abstract-set", // = ["public-abstract-set", "protected-abstract-set", "private-abstract-set"] + "abstract-set", // = ["public-abstract-set", "protected-abstract-set"] // Methods "static-method", // = ["public-static-method", "protected-static-method", "private-static-method"] "instance-method", // = ["public-instance-method", "protected-instance-method", "private-instance-method"] - "abstract-method" // = ["public-abstract-method", "protected-abstract-method", "private-abstract-method"] + "abstract-method" // = ["public-abstract-method", "protected-abstract-method"] ] ``` @@ -1133,7 +1268,7 @@ The third grouping option is to ignore both scope and accessibility. // Fields "field", // = ["public-static-field", "protected-static-field", "private-static-field", "public-instance-field", "protected-instance-field", "private-instance-field", - // "public-abstract-field", "protected-abstract-field", private-abstract-field"] + // "public-abstract-field", "protected-abstract-field"] // Static initialization // No grouping for static initialization. @@ -1143,15 +1278,15 @@ The third grouping option is to ignore both scope and accessibility. // Getters "get", // = ["public-static-get", "protected-static-get", "private-static-get", "public-instance-get", "protected-instance-get", "private-instance-get", - // "public-abstract-get", "protected-abstract-get", "private-abstract-get"] + // "public-abstract-get", "protected-abstract-get"] // Setters "set", // = ["public-static-set", "protected-static-set", "private-static-set", "public-instance-set", "protected-instance-set", "private-instance-set", - // "public-abstract-set", "protected-abstract-set", "private-abstract-set"] + // "public-abstract-set", "protected-abstract-set"] // Methods "method" // = ["public-static-method", "protected-static-method", "private-static-method", "public-instance-method", "protected-instance-method", "private-instance-method", - // "public-abstract-method", "protected-abstract-method", "private-abstract-method"] + // "public-abstract-method", "protected-abstract-method"] ] ``` diff --git a/packages/eslint-plugin/docs/rules/method-signature-style.md b/packages/eslint-plugin/docs/rules/method-signature-style.md index 4d6bea7ebdf..4997ea09281 100644 --- a/packages/eslint-plugin/docs/rules/method-signature-style.md +++ b/packages/eslint-plugin/docs/rules/method-signature-style.md @@ -6,20 +6,20 @@ description: 'Enforce using a particular method signature syntax.' > > See **https://typescript-eslint.io/rules/method-signature-style** for documentation. -There are two ways to define an object/interface function property. +TypeScript provides two ways to define an object/interface function property: ```ts -// method shorthand syntax -interface T1 { +interface Example { + // method shorthand syntax func(arg: string): number; -} -// regular property with function type -interface T2 { + // regular property with function type func: (arg: string) => number; } ``` +The two are very similar; most of the time it doesn't matter which one you use. + A good practice is to use the TypeScript's `strict` option (which implies `strictFunctionTypes`) which enables correct typechecking for function properties only (method signatures get old behavior). TypeScript FAQ: diff --git a/packages/eslint-plugin/docs/rules/naming-convention.md b/packages/eslint-plugin/docs/rules/naming-convention.md index ef6d82e8302..f5922ba3653 100644 --- a/packages/eslint-plugin/docs/rules/naming-convention.md +++ b/packages/eslint-plugin/docs/rules/naming-convention.md @@ -9,9 +9,7 @@ description: 'Enforce naming conventions for everything across a codebase.' Enforcing naming conventions helps keep the codebase consistent, and reduces overhead when thinking about how to name a variable. Additionally, a well-designed style guide can help communicate intent, such as by enforcing all private properties begin with an `_`, and all global-level constants are written in `UPPER_CASE`. -There are many different rules that have existed over time, but they have had the problem of not having enough granularity, meaning it was hard to have a well defined style guide, and most of the time you needed 3 or more rules at once to enforce different conventions, hoping they didn't conflict. - -## Rule Details +## Examples This rule allows you to enforce conventions for any identifier, using granular selectors to create a fine-grained style guide. @@ -151,7 +149,7 @@ The `leadingUnderscore` / `trailingUnderscore` options control whether leading/t The `prefix` / `suffix` options control which prefix/suffix strings must exist for the identifier. Accepts an array of strings. -If these are provided, the identifier must start with one of the provided values. For example, if you provide `{ prefix: ['IFace', 'Class', 'Type'] }`, then the following names are valid: `IFaceFoo`, `ClassBar`, `TypeBaz`, but the name `Bang` is not valid, as it contains none of the prefixes. +If these are provided, the identifier must start with one of the provided values. For example, if you provide `{ prefix: ['Class', 'IFace', 'Type'] }`, then the following names are valid: `ClassBar`, `IFaceFoo`, `TypeBaz`, but the name `Bang` is not valid, as it contains none of the prefixes. **Note:** As [documented above](#format-options), the prefix is trimmed before format is validated, therefore PascalCase must be used to allow variables such as `isEnabled` using the prefix `is`. @@ -159,11 +157,11 @@ If these are provided, the identifier must start with one of the provided values - `selector` allows you to specify what types of identifiers to target. - Accepts one or array of selectors to define an option block that applies to one or multiple selectors. - - For example, if you provide `{ selector: ['variable', 'function'] }`, then it will apply the same option to variable and function nodes. + - For example, if you provide `{ selector: ['function', 'variable'] }`, then it will apply the same option to variable and function nodes. - See [Allowed Selectors, Modifiers and Types](#allowed-selectors-modifiers-and-types) below for the complete list of allowed selectors. -- `modifiers` allows you to specify which modifiers to granularly apply to, such as the accessibility (`private`/`public`/`protected`), or if the thing is `static`, etc. +- `modifiers` allows you to specify which modifiers to granularly apply to, such as the accessibility (`private`/`protected`/`public`), or if the thing is `static`, etc. - The name must match _all_ of the modifiers. - - For example, if you provide `{ modifiers: ['private', 'static', 'readonly'] }`, then it will only match something that is `private static readonly`, and something that is just `private` will not match. + - For example, if you provide `{ modifiers: ['private','readonly','static'] }`, then it will only match something that is `private static readonly`, and something that is just `private` will not match. - The following `modifiers` are allowed: - `const` - matches a variable declared as being `const` (`const x = 1`). - `destructured` - matches a variable declared via an object destructuring pattern (`const {x, z = 2}`). @@ -173,8 +171,9 @@ If these are provided, the identifier must start with one of the provided values - `unused` - matches anything that is not used. - `requiresQuotes` - matches any name that requires quotes as it is not a valid identifier (i.e. has a space, a dash, etc in it). - `public` - matches any member that is either explicitly declared as `public`, or has no visibility modifier (i.e. implicitly public). - - `readonly`, `static`, `abstract`, `protected`, `private` - matches any member explicitly declared with the given modifier. -- `types` allows you to specify which types to match. This option supports simple, primitive types only (`boolean`, `string`, `number`, `array`, `function`). + - `abstract`,`override`,`private`,`protected`,`readonly`,`static` - matches any member explicitly declared with the given modifier. + - `async` - matches any method, function, or function variable which is async via the `async` keyword (e.g. does not match functions that return promises without using `async` keyword) +- `types` allows you to specify which types to match. This option supports simple, primitive types only (`array`,`boolean`,`function`,`number`,`string`). - The name must match _one_ of the types. - **_NOTE - Using this option will require that you lint with type information._** - For example, this lets you do things like enforce that `boolean` variables are prefixed with a verb. @@ -195,39 +194,39 @@ There are two types of selectors, individual selectors, and grouped selectors. Individual Selectors match specific, well-defined sets. There is no overlap between each of the individual selectors. -- `variable` - matches any `var` / `let` / `const` variable name. - - Allowed `modifiers`: `const`, `destructured`, `global`, `exported`, `unused`. - - Allowed `types`: `boolean`, `string`, `number`, `function`, `array`. +- `variable` - matches any `let` / `const` / `var` variable name. + - Allowed `modifiers`: `async`, `const`, `destructured`, `exported`, `global`, `unused`. + - Allowed `types`: `array`, `boolean`, `function`, `number`, `string`. - `function` - matches any named function declaration or named function expression. - - Allowed `modifiers`: `global`, `exported`, `unused`. + - Allowed `modifiers`: `async`, `exported`, `global`, `unused`. - Allowed `types`: none. - `parameter` - matches any function parameter. Does not match parameter properties. - Allowed `modifiers`: `destructured`, `unused`. - Allowed `types`: `boolean`, `string`, `number`, `function`, `array`. - `classProperty` - matches any class property. Does not match properties that have direct function expression or arrow function expression values. - - Allowed `modifiers`: `abstract`, `private`, `protected`, `public`, `readonly`, `requiresQuotes`, `static`. - - Allowed `types`: `boolean`, `string`, `number`, `function`, `array`. + - Allowed `modifiers`: `abstract`, `override`, `private`, `protected`, `public`, `readonly`, `requiresQuotes`, `static`. + - Allowed `types`: `array`, `boolean`, `function`, `number`, `string`. - `objectLiteralProperty` - matches any object literal property. Does not match properties that have direct function expression or arrow function expression values. - Allowed `modifiers`: `public`, `requiresQuotes`. - - Allowed `types`: `boolean`, `string`, `number`, `function`, `array`. + - Allowed `types`: `array`, `boolean`, `function`, `number`, `string`. - `typeProperty` - matches any object type property. Does not match properties that have direct function expression or arrow function expression values. - Allowed `modifiers`: `public`, `readonly`, `requiresQuotes`. - - Allowed `types`: `boolean`, `string`, `number`, `function`, `array`. + - Allowed `types`: `array`, `boolean`, `function`, `number`, `string`. - `parameterProperty` - matches any parameter property. - Allowed `modifiers`: `private`, `protected`, `public`, `readonly`. - - Allowed `types`: `boolean`, `string`, `number`, `function`, `array`. + - Allowed `types`: `array`, `boolean`, `function`, `number`, `string`. - `classMethod` - matches any class method. Also matches properties that have direct function expression or arrow function expression values. Does not match accessors. - - Allowed `modifiers`: `abstract`, `private`, `protected`, `public`, `requiresQuotes`, `static`. + - Allowed `modifiers`: `abstract`, `async`, `override`, `private`, `protected`, `public`, `requiresQuotes`, `static`. - Allowed `types`: none. - `objectLiteralMethod` - matches any object literal method. Also matches properties that have direct function expression or arrow function expression values. Does not match accessors. - - Allowed `modifiers`: `public`, `requiresQuotes`. + - Allowed `modifiers`: `async`, `public`, `requiresQuotes`. - Allowed `types`: none. - `typeMethod` - matches any object type method. Also matches properties that have direct function expression or arrow function expression values. Does not match accessors. - Allowed `modifiers`: `public`, `requiresQuotes`. - Allowed `types`: none. - `accessor` - matches any accessor. - - Allowed `modifiers`: `abstract`, `private`, `protected`, `public`, `requiresQuotes`, `static`. - - Allowed `types`: `boolean`, `string`, `number`, `function`, `array`. + - Allowed `modifiers`: `abstract`, `override`, `private`, `protected`, `public`, `requiresQuotes`, `static`. + - Allowed `types`: `array`, `boolean`, `function`, `number`, `string`. - `enumMember` - matches any enum member. - Allowed `modifiers`: `requiresQuotes`. - Allowed `types`: none. @@ -254,20 +253,20 @@ Group Selectors are provided for convenience, and essentially bundle up sets of - `default` - matches everything. - Allowed `modifiers`: all modifiers. - Allowed `types`: none. -- `variableLike` - matches the same as `variable`, `function` and `parameter`. - - Allowed `modifiers`: `unused`. +- `variableLike` - matches the same as `function`, `parameter` and `variable`. + - Allowed `modifiers`: `async`, `unused`. - Allowed `types`: none. -- `memberLike` - matches the same as `property`, `parameterProperty`, `method`, `accessor`, `enumMember`. - - Allowed `modifiers`: `private`, `protected`, `public`, `static`, `readonly`, `abstract`, `requiresQuotes`. +- `memberLike` - matches the same as `accessor`, `enumMember`, `method`, `parameterProperty`, `property`. + - Allowed `modifiers`: `abstract`, `async`, `override`, `private`, `protected`, `public`, `readonly`, `requiresQuotes`, `static`. - Allowed `types`: none. -- `typeLike` - matches the same as `class`, `interface`, `typeAlias`, `enum`, `typeParameter`. +- `typeLike` - matches the same as `class`, `enum`, `interface`, `typeAlias`, `typeParameter`. - Allowed `modifiers`: `abstract`, `unused`. - Allowed `types`: none. - `property` - matches the same as `classProperty`, `objectLiteralProperty`, `typeProperty`. - - Allowed `modifiers`: `private`, `protected`, `public`, `static`, `readonly`, `abstract`, `requiresQuotes`. - - Allowed `types`: `boolean`, `string`, `number`, `function`, `array`. + - Allowed `modifiers`: `abstract`, `async`, `override`, `private`, `protected`, `public`, `readonly`, `requiresQuotes`, `static`. + - Allowed `types`: `array`, `boolean`, `function`, `number`, `string`. - `method` - matches the same as `classMethod`, `objectLiteralMethod`, `typeMethod`. - - Allowed `modifiers`: `private`, `protected`, `public`, `static`, `readonly`, `abstract`, `requiresQuotes`. + - Allowed `modifiers`: `abstract`, `async`, `override`, `private`, `protected`, `public`, `readonly`, `requiresQuotes`, `static`. - Allowed `types`: none. ## FAQ diff --git a/packages/eslint-plugin/docs/rules/no-array-constructor.md b/packages/eslint-plugin/docs/rules/no-array-constructor.md index 54b69eb91ba..c6b147752f2 100644 --- a/packages/eslint-plugin/docs/rules/no-array-constructor.md +++ b/packages/eslint-plugin/docs/rules/no-array-constructor.md @@ -6,7 +6,7 @@ description: 'Disallow generic `Array` constructors.' > > See **https://typescript-eslint.io/rules/no-array-constructor** for documentation. -## Rule Details +## Examples This rule extends the base [`eslint/no-array-constructor`](https://eslint.org/docs/rules/no-array-constructor) rule. It adds support for the generically typed `Array` constructor (`new Array()`). diff --git a/packages/eslint-plugin/docs/rules/no-base-to-string.md b/packages/eslint-plugin/docs/rules/no-base-to-string.md index 857c82091f6..7409f5e134e 100644 --- a/packages/eslint-plugin/docs/rules/no-base-to-string.md +++ b/packages/eslint-plugin/docs/rules/no-base-to-string.md @@ -6,20 +6,14 @@ description: 'Require `.toString()` to only be called on objects which provide u > > See **https://typescript-eslint.io/rules/no-base-to-string** for documentation. -Requires `.toString()` to only be called on objects which provide useful information when stringified. - JavaScript will call `toString()` on an object when it is converted to a string, such as when `+` adding to a string or in `${}` template literals. +The default Object `.toString()` returns `"[object Object]"`, which is often not what was intended. +This rule reports on stringified values that aren't primitives and don't define a more useful `.toString()` method. -The default Object `.toString()` returns `"[object Object]"`, so this rule requires stringified objects define a more useful `.toString()` method. - -Note that `Function` provides its own `.toString()` that returns the function's code. -Functions are not flagged by this rule. - -This rule has some overlap with [`restrict-plus-operands`](./restrict-plus-operands.md) and [`restrict-template-expressions`](./restrict-template-expressions.md). - -## Rule Details +> Note that `Function` provides its own `.toString()` that returns the function's code. +> Functions are not flagged by this rule. -This rule prevents accidentally defaulting to the base Object `.toString()` method. +## Examples @@ -84,4 +78,11 @@ let text = `${value}`; If you don't mind `"[object Object]"` in your strings, then you will not need this rule. +## Related To + +- [`restrict-plus-operands`](./restrict-plus-operands.md) +- [`restrict-template-expressions`](./restrict-template-expressions.md) + +## Further Reading + - [`Object.prototype.toString()` MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString) diff --git a/packages/eslint-plugin/docs/rules/no-confusing-non-null-assertion.md b/packages/eslint-plugin/docs/rules/no-confusing-non-null-assertion.md index 1b67f558af5..34d474cf853 100644 --- a/packages/eslint-plugin/docs/rules/no-confusing-non-null-assertion.md +++ b/packages/eslint-plugin/docs/rules/no-confusing-non-null-assertion.md @@ -6,8 +6,6 @@ description: 'Disallow non-null assertion in locations that may be confusing.' > > See **https://typescript-eslint.io/rules/no-confusing-non-null-assertion** for documentation. -## Rule Details - Using a non-null assertion (`!`) next to an assign or equals check (`=` or `==` or `===`) creates code that is confusing as it looks similar to a not equals check (`!=` `!==`). ```typescript @@ -16,6 +14,10 @@ a !== b; // not equals test(`!==`) a! === b; // a non-null assertions(`!`) and an triple equals test(`===`) ``` +This rule flags confusing `!` assertions and suggests either removing them or wrapping the asserted expression in `()` parenthesis. + +## Examples + ### ❌ Incorrect diff --git a/packages/eslint-plugin/docs/rules/no-confusing-void-expression.md b/packages/eslint-plugin/docs/rules/no-confusing-void-expression.md index 4c4f6b1fa21..dbc0aaee9e8 100644 --- a/packages/eslint-plugin/docs/rules/no-confusing-void-expression.md +++ b/packages/eslint-plugin/docs/rules/no-confusing-void-expression.md @@ -6,12 +6,11 @@ description: 'Require expressions of type void to appear in statement position.' > > See **https://typescript-eslint.io/rules/no-confusing-void-expression** for documentation. -Returning the results of an expression whose type is void can be misleading. -Attempting to do so is likely a symptom of expecting a different return type from a function. -Even if used correctly, it can be misleading for other developers, -who don't know what a particular function does and if its result matters. +`void` in TypeScript refers to a function return that is meant to be ignored. +Attempting to use a `void`-typed value, such as storing the result of a called function in a variable, is often a sign of a programmer error. +`void` can also be misleading for other developers even if used correctly. -This rule provides automatic fixes for most common cases. +This rule prevents `void` type expressions from being used in misleading locations such as being assigned to a variable, provided as a function argument, or returned from a function. ## Examples diff --git a/packages/eslint-plugin/docs/rules/no-dupe-class-members.md b/packages/eslint-plugin/docs/rules/no-dupe-class-members.md index 2bfc1864f7e..432ac55f014 100644 --- a/packages/eslint-plugin/docs/rules/no-dupe-class-members.md +++ b/packages/eslint-plugin/docs/rules/no-dupe-class-members.md @@ -6,7 +6,7 @@ description: 'Disallow duplicate class members.' > > See **https://typescript-eslint.io/rules/no-dupe-class-members** for documentation. -## Rule Details +## Examples This rule extends the base [`eslint/no-dupe-class-members`](https://eslint.org/docs/rules/no-dupe-class-members) rule. It adds support for TypeScript's method overload definitions. diff --git a/packages/eslint-plugin/docs/rules/no-duplicate-enum-values.md b/packages/eslint-plugin/docs/rules/no-duplicate-enum-values.md index e65884f821f..22b951a4a16 100644 --- a/packages/eslint-plugin/docs/rules/no-duplicate-enum-values.md +++ b/packages/eslint-plugin/docs/rules/no-duplicate-enum-values.md @@ -8,9 +8,12 @@ description: 'Disallow duplicate enum member values.' Although TypeScript supports duplicate enum member values, people usually expect members to have unique values within the same enum. Duplicate values can lead to bugs that are hard to track down. -## Rule Details +## Examples -This rule disallows defining an enum with multiple members initialized to the same value. Now it only enforces on enum members initialized with String or Number literals. Members without initializer or initialized with an expression are not checked by this rule. +This rule disallows defining an enum with multiple members initialized to the same value. + +> This rule only enforces on enum members initialized with string or number literals. +> Members without an initializer or initialized with an expression are not checked by this rule. diff --git a/packages/eslint-plugin/docs/rules/no-dynamic-delete.md b/packages/eslint-plugin/docs/rules/no-dynamic-delete.md index 78b1a1453bd..e6afb335bc8 100644 --- a/packages/eslint-plugin/docs/rules/no-dynamic-delete.md +++ b/packages/eslint-plugin/docs/rules/no-dynamic-delete.md @@ -7,12 +7,12 @@ description: 'Disallow using the `delete` operator on computed key expressions.' > See **https://typescript-eslint.io/rules/no-dynamic-delete** for documentation. Deleting dynamically computed keys can be dangerous and in some cases not well optimized. - -## Rule Details - Using the `delete` operator on keys that aren't runtime constants could be a sign that you're using the wrong data structures. Using `Object`s with added and removed keys can cause occasional edge case bugs, such as if a key is named `"hasOwnProperty"`. -Consider using a `Map` or `Set` if you’re storing collections of objects. + +> Consider using a `Map` or `Set` if you’re storing collections of objects. + +## Examples diff --git a/packages/eslint-plugin/docs/rules/no-empty-function.md b/packages/eslint-plugin/docs/rules/no-empty-function.md index b889968c071..529a8a2df7a 100644 --- a/packages/eslint-plugin/docs/rules/no-empty-function.md +++ b/packages/eslint-plugin/docs/rules/no-empty-function.md @@ -6,7 +6,7 @@ description: 'Disallow empty functions.' > > See **https://typescript-eslint.io/rules/no-empty-function** for documentation. -## Rule Details +## Examples This rule extends the base [`eslint/no-empty-function`](https://eslint.org/docs/rules/no-empty-function) rule. It adds support for handling TypeScript specific code that would otherwise trigger the rule. diff --git a/packages/eslint-plugin/docs/rules/no-empty-interface.md b/packages/eslint-plugin/docs/rules/no-empty-interface.md index 17bebea168f..699ebccb64a 100644 --- a/packages/eslint-plugin/docs/rules/no-empty-interface.md +++ b/packages/eslint-plugin/docs/rules/no-empty-interface.md @@ -6,13 +6,13 @@ description: 'Disallow the declaration of empty interfaces.' > > See **https://typescript-eslint.io/rules/no-empty-interface** for documentation. -An empty interface is equivalent to its supertype. If the interface does not implement a supertype, then -the interface is equivalent to an empty object (`{}`). In both cases it can be omitted. - -## Rule Details +An empty interface in TypeScript does very little: any non-nullable value is assignable to `{}`. +Using an empty interface is often a sign of programmer error, such as misunderstanding the concept of `{}` or forgetting to fill in fields. This rule aims to ensure that only meaningful interfaces are declared in the code. +## Examples + ### ❌ Incorrect @@ -48,7 +48,7 @@ interface Baz extends Foo, Bar {} -### Options +## Options This rule accepts a single object option with the following default configuration: diff --git a/packages/eslint-plugin/docs/rules/no-explicit-any.md b/packages/eslint-plugin/docs/rules/no-explicit-any.md index b32acb43902..efec5011373 100644 --- a/packages/eslint-plugin/docs/rules/no-explicit-any.md +++ b/packages/eslint-plugin/docs/rules/no-explicit-any.md @@ -6,16 +6,13 @@ description: 'Disallow the `any` type.' > > See **https://typescript-eslint.io/rules/no-explicit-any** for documentation. -Using the `any` type defeats the purpose of using TypeScript. -When `any` is used, all compiler type checks around that value are ignored. +The `any` type in TypeScript is a dangerous "escape hatch" from the type system. +Using `any` disables many type checking rules and is generally best used only as a last resort or when prototyping code. +This rule reports on explicit uses of the `any` keyword as a type annotation. -## Rule Details +> TypeScript's `--noImplicitAny` compiler option prevents an implied `any`, but doesn't prevent `any` from being explicitly used the way this rule does. -This rule doesn't allow `any` types to be defined. -It aims to keep TypeScript maximally useful. -TypeScript has a compiler flag for `--noImplicitAny` that will prevent -an `any` type from being implied by the compiler, but doesn't prevent -`any` from being explicitly used. +## Examples @@ -164,6 +161,14 @@ interface Garply { If an unknown type or a library without typings is used and you want to be able to specify `any`. +## Related To + +- [`no-unsafe-argument`](./no-unsafe-argument.md) +- [`no-unsafe-assignment`](./no-unsafe-assignment.md) +- [`no-unsafe-call`](./no-unsafe-call.md) +- [`no-unsafe-member-access`](./no-unsafe-member-access.md) +- [`no-unsafe-return`](./no-unsafe-return.md) + ## Further Reading - TypeScript [any type](https://www.typescriptlang.org/docs/handbook/basic-types.html#any) diff --git a/packages/eslint-plugin/docs/rules/no-extra-non-null-assertion.md b/packages/eslint-plugin/docs/rules/no-extra-non-null-assertion.md index 28b47a74531..db2c584827c 100644 --- a/packages/eslint-plugin/docs/rules/no-extra-non-null-assertion.md +++ b/packages/eslint-plugin/docs/rules/no-extra-non-null-assertion.md @@ -1,14 +1,15 @@ --- -description: 'Disallow extra non-null assertion.' +description: 'Disallow extra non-null assertions.' --- > 🛑 This file is source code, not the primary documentation location! 🛑 > > See **https://typescript-eslint.io/rules/no-extra-non-null-assertion** for documentation. -## Rule Details +The `!` non-null assertion operator in TypeScript is used to assert that a value's type does not include `null` or `undefined`. +Using the operator any more than once on a single value does nothing. -Examples of code for this rule: +## Examples diff --git a/packages/eslint-plugin/docs/rules/no-extra-parens.md b/packages/eslint-plugin/docs/rules/no-extra-parens.md index 4bd89ac91b9..0c5cc21941e 100644 --- a/packages/eslint-plugin/docs/rules/no-extra-parens.md +++ b/packages/eslint-plugin/docs/rules/no-extra-parens.md @@ -6,7 +6,7 @@ description: 'Disallow unnecessary parentheses.' > > See **https://typescript-eslint.io/rules/no-extra-parens** for documentation. -## Rule Details +## Examples This rule extends the base [`eslint/no-extra-parens`](https://eslint.org/docs/rules/no-extra-parens) rule. It adds support for TypeScript type assertions. diff --git a/packages/eslint-plugin/docs/rules/no-extra-semi.md b/packages/eslint-plugin/docs/rules/no-extra-semi.md index a8f3cdca1b2..086bd87f450 100644 --- a/packages/eslint-plugin/docs/rules/no-extra-semi.md +++ b/packages/eslint-plugin/docs/rules/no-extra-semi.md @@ -6,7 +6,7 @@ description: 'Disallow unnecessary semicolons.' > > See **https://typescript-eslint.io/rules/no-extra-semi** for documentation. -## Rule Details +## Examples This rule extends the base [`eslint/no-extra-semi`](https://eslint.org/docs/rules/no-extra-semi) rule. It adds support for class properties. diff --git a/packages/eslint-plugin/docs/rules/no-extraneous-class.md b/packages/eslint-plugin/docs/rules/no-extraneous-class.md index 2efb49e9556..4cf0a2c67ad 100644 --- a/packages/eslint-plugin/docs/rules/no-extraneous-class.md +++ b/packages/eslint-plugin/docs/rules/no-extraneous-class.md @@ -6,23 +6,21 @@ description: 'Disallow classes used as namespaces.' > > See **https://typescript-eslint.io/rules/no-extraneous-class** for documentation. -This rule warns when a class has no non-static members, such as for a class used exclusively as a static namespace. - -## Rule Details +This rule reports when a class has no non-static members, such as for a class used exclusively as a static namespace. Users who come from a [OOP](https://en.wikipedia.org/wiki/Object-oriented_programming) paradigm may wrap their utility functions in an extra class, instead of putting them at the top level of an ECMAScript module. Doing so is generally unnecessary in JavaScript and TypeScript projects. - Wrapper classes add extra cognitive complexity to code without adding any structural improvements - Whatever would be put on them, such as utility functions, are already organized by virtue of being in a module. - - As an alternative, you can always `import * as ...` the module to get all of them in a single object. + - As an alternative, you can `import * as ...` the module to get all of them in a single object. - IDEs can't provide as good suggestions for static class or namespace imported properties when you start typing property names - It's more difficult to statically analyze code for unused variables, etc. when they're all on the class (see: [Finding dead code (and dead types) in TypeScript](https://effectivetypescript.com/2020/10/20/tsprune)). -This rule also flags classes that have only a constructor and no fields. +This rule also reports classes that have only a constructor and no fields. Those classes can generally be replaced with a standalone function. -Examples of code for this rule: +## Examples diff --git a/packages/eslint-plugin/docs/rules/no-floating-promises.md b/packages/eslint-plugin/docs/rules/no-floating-promises.md index 09e86b85308..289e42f903c 100644 --- a/packages/eslint-plugin/docs/rules/no-floating-promises.md +++ b/packages/eslint-plugin/docs/rules/no-floating-promises.md @@ -7,9 +7,9 @@ description: 'Require Promise-like statements to be handled appropriately.' > See **https://typescript-eslint.io/rules/no-floating-promises** for documentation. A "floating" Promise is one that is created without any code set up to handle any errors it might throw. - Floating Promises can cause several issues, such as improperly sequenced operations, ignored Promise rejections, and more. +This rule reports when a Promise is created and not properly handled. Valid ways of handling a Promise-valued statement include: - `await`ing it @@ -22,9 +22,7 @@ Valid ways of handling a Promise-valued statement include: See [`no-misused-promises`](./no-misused-promises.md) for detecting code that provides Promises to _logical_ locations such as if statements. ::: -## Rule Details - -Examples of code for this rule: +## Examples diff --git a/packages/eslint-plugin/docs/rules/no-for-in-array.md b/packages/eslint-plugin/docs/rules/no-for-in-array.md index f046ff8ddd6..759f427b9ac 100644 --- a/packages/eslint-plugin/docs/rules/no-for-in-array.md +++ b/packages/eslint-plugin/docs/rules/no-for-in-array.md @@ -6,40 +6,48 @@ description: 'Disallow iterating over an array with a for-in loop.' > > See **https://typescript-eslint.io/rules/no-for-in-array** for documentation. -This rule prohibits iterating over an array with a for-in loop. - -## Rule Details - -A for-in loop (`for (var k in o)`) iterates over the properties of an Object. +A for-in loop (`for (var i in o)`) iterates over the properties of an Object. While it is legal to use for-in loops with array types, it is not common. for-in will iterate over the indices of the array as strings, omitting any "holes" in the array. -More common is to use for-of, which iterates over the values of an array. -If you want to iterate over the indices, alternatives include: -```js -array.forEach((value, index) => { ... }); -for (const [index, value] of array.entries()) { ... } -for (let i = 0; i < array.length; i++) { ... } -``` - -Examples of code for this rule: +## Examples ### ❌ Incorrect ```js -for (const x in [3, 4, 5]) { - console.log(x); +declare const array: string[]; + +for (const i in array) { + console.log(array[i]); +} + +for (const i in array) { + console.log(i, array[i]); } ``` ### ✅ Correct ```js -for (const x in { a: 3, b: 4, c: 5 }) { - console.log(x); +declare const array: string[]; + +for (const value of array) { + console.log(value); +} + +for (let i = 0; i < array.length; i += 1) { + console.log(i, array[i]); +} + +array.forEach((value, i) => { + console.log(i, value); +}) + +for (const [i, value] of array.entries()) { + console.log(i, value); } ``` diff --git a/packages/eslint-plugin/docs/rules/no-implicit-any-catch.md b/packages/eslint-plugin/docs/rules/no-implicit-any-catch.md index 943e2c75b21..ea75c981890 100644 --- a/packages/eslint-plugin/docs/rules/no-implicit-any-catch.md +++ b/packages/eslint-plugin/docs/rules/no-implicit-any-catch.md @@ -19,12 +19,10 @@ The `noImplicitAny` flag in TypeScript does not cover this for backwards compati ## DEPRECATED -## Rule Details +## Examples This rule requires an explicit type to be declared on a catch clause variable. -Examples of code for this rule: - ### ❌ Incorrect diff --git a/packages/eslint-plugin/docs/rules/no-implied-eval.md b/packages/eslint-plugin/docs/rules/no-implied-eval.md index 9f3ad17180f..918b6a12e75 100644 --- a/packages/eslint-plugin/docs/rules/no-implied-eval.md +++ b/packages/eslint-plugin/docs/rules/no-implied-eval.md @@ -25,12 +25,10 @@ passed in to be interpreted. The same can be done with `setInterval()`, `setImme The best practice is to avoid using `new Function()` or `execScript()` and always use a function for the first argument of `setTimeout()`, `setInterval()` and `setImmediate()`. -## Rule Details +## Examples This rule aims to eliminate implied `eval()` through the use of `new Function()`, `setTimeout()`, `setInterval()`, `setImmediate()` or `execScript()`. -Examples of code for this rule: - ### ❌ Incorrect diff --git a/packages/eslint-plugin/docs/rules/no-inferrable-types.md b/packages/eslint-plugin/docs/rules/no-inferrable-types.md index a29427a33cf..0427bf8acad 100644 --- a/packages/eslint-plugin/docs/rules/no-inferrable-types.md +++ b/packages/eslint-plugin/docs/rules/no-inferrable-types.md @@ -6,14 +6,11 @@ description: 'Disallow explicit type declarations for variables or parameters in > > See **https://typescript-eslint.io/rules/no-inferrable-types** for documentation. -Explicit types where they can be easily inferred may add unnecessary verbosity. +TypeScript is able to infer the types of parameters, properties, and variables from their default or initial values. +There is no need to use an explicit `:` type annotation on one of those constructs initialized to a boolean, number, or string. +Doing so adds unnecessary verbosity to code -making it harder to read- and in some cases can prevent TypeScript from inferring a more specific literal type (e.g. `10`) instead of the more general primitive type (e.g. `number`) -## Rule Details - -This rule disallows explicit type declarations on parameters, variables -and properties where the type can be easily inferred from its value. - -Examples of code with the default options: +## Examples @@ -21,30 +18,17 @@ Examples of code with the default options: ```ts const a: bigint = 10n; -const a: bigint = -10n; const a: bigint = BigInt(10); -const a: bigint = -BigInt(10); -const a: boolean = false; -const a: boolean = true; -const a: boolean = Boolean(null); const a: boolean = !0; +const a: boolean = Boolean(null); +const a: boolean = true; +const a: null = null; const a: number = 10; -const a: number = +10; -const a: number = -10; -const a: number = Number('1'); -const a: number = +Number('1'); -const a: number = -Number('1'); const a: number = Infinity; -const a: number = +Infinity; -const a: number = -Infinity; const a: number = NaN; -const a: number = +NaN; -const a: number = -NaN; -const a: null = null; +const a: number = Number('1'); const a: RegExp = /a/; -const a: RegExp = RegExp('a'); const a: RegExp = new RegExp('a'); -const a: string = 'str'; const a: string = `str`; const a: string = String(1); const a: symbol = Symbol('a'); @@ -62,30 +46,17 @@ function fn(a: number = 5, b: boolean = true) {} ```ts const a = 10n; -const a = -10n; const a = BigInt(10); -const a = -BigInt(10); -const a = false; -const a = true; -const a = Boolean(null); const a = !0; +const a = Boolean(null); +const a = true; +const a = null; const a = 10; -const a = +10; -const a = -10; -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 = Number('1'); const a = /a/; -const a = RegExp('a'); const a = new RegExp('a'); -const a = 'str'; const a = `str`; const a = String(1); const a = Symbol('a'); @@ -97,8 +68,6 @@ class Foo { } function fn(a = 5, b = true) {} - -function fn(a: number, b: boolean, c: string) {} ``` diff --git a/packages/eslint-plugin/docs/rules/no-invalid-this.md b/packages/eslint-plugin/docs/rules/no-invalid-this.md index 53e0f68fa9f..4d6abe81f70 100644 --- a/packages/eslint-plugin/docs/rules/no-invalid-this.md +++ b/packages/eslint-plugin/docs/rules/no-invalid-this.md @@ -6,7 +6,7 @@ description: 'Disallow `this` keywords outside of classes or class-like objects. > > See **https://typescript-eslint.io/rules/no-invalid-this** for documentation. -## Rule Details +## Examples This rule extends the base [`eslint/no-invalid-this`](https://eslint.org/docs/rules/no-invalid-this) rule. It adds support for TypeScript's `this` parameters. diff --git a/packages/eslint-plugin/docs/rules/no-invalid-void-type.md b/packages/eslint-plugin/docs/rules/no-invalid-void-type.md index a3691936371..d2b60d59e68 100644 --- a/packages/eslint-plugin/docs/rules/no-invalid-void-type.md +++ b/packages/eslint-plugin/docs/rules/no-invalid-void-type.md @@ -6,21 +6,14 @@ description: 'Disallow `void` type outside of generic or return types.' > > See **https://typescript-eslint.io/rules/no-invalid-void-type** for documentation. -Disallows usage of `void` type outside of return types or generic type arguments. -If `void` is used as return type, it shouldn’t be a part of intersection/union type with most other types. +`void` in TypeScript refers to a function return that is meant to be ignored. +Attempting to use a `void` type outside of a return type or generic type argument is often a sign of programmer error. +`void` can also be misleading for other developers even if used correctly. -## Rationale +> The `void` type means cannot be mixed with any other types, other than `never`, which accepts all types. +> If you think you need this then you probably want the `undefined` type instead. -The `void` type means “nothing” or that a function does not return any value, -in contrast with implicit `undefined` type which means that a function returns a value `undefined`. -So “nothing” cannot be mixed with any other types, other than `never`, which accepts all types. -If you need this - use the `undefined` type instead. - -## Rule Details - -This rule aims to ensure that the `void` type is only used in valid places. - -Examples of code for this rule: +## Examples diff --git a/packages/eslint-plugin/docs/rules/no-loop-func.md b/packages/eslint-plugin/docs/rules/no-loop-func.md index 753eb115cfb..e2ba64a8ecd 100644 --- a/packages/eslint-plugin/docs/rules/no-loop-func.md +++ b/packages/eslint-plugin/docs/rules/no-loop-func.md @@ -6,7 +6,7 @@ description: 'Disallow function declarations that contain unsafe references insi > > See **https://typescript-eslint.io/rules/no-loop-func** for documentation. -## Rule Details +## Examples This rule extends the base [`eslint/no-loop-func`](https://eslint.org/docs/rules/no-loop-func) rule. It adds support for TypeScript types. diff --git a/packages/eslint-plugin/docs/rules/no-loss-of-precision.md b/packages/eslint-plugin/docs/rules/no-loss-of-precision.md index 62e263219e8..f8db7ef6021 100644 --- a/packages/eslint-plugin/docs/rules/no-loss-of-precision.md +++ b/packages/eslint-plugin/docs/rules/no-loss-of-precision.md @@ -6,7 +6,7 @@ description: 'Disallow literal numbers that lose precision.' > > See **https://typescript-eslint.io/rules/no-loss-of-precision** for documentation. -## Rule Details +## Examples This rule extends the base [`eslint/no-loss-of-precision`](https://eslint.org/docs/rules/no-loss-of-precision) rule. It adds support for [numeric separators](https://github.com/tc39/proposal-numeric-separator). diff --git a/packages/eslint-plugin/docs/rules/no-magic-numbers.md b/packages/eslint-plugin/docs/rules/no-magic-numbers.md index 7af0e561536..258af4dd4cf 100644 --- a/packages/eslint-plugin/docs/rules/no-magic-numbers.md +++ b/packages/eslint-plugin/docs/rules/no-magic-numbers.md @@ -6,7 +6,7 @@ description: 'Disallow magic numbers.' > > See **https://typescript-eslint.io/rules/no-magic-numbers** for documentation. -## Rule Details +## Examples This rule extends the base [`eslint/no-magic-numbers`](https://eslint.org/docs/rules/no-magic-numbers) rule. It adds support for: diff --git a/packages/eslint-plugin/docs/rules/no-meaningless-void-operator.md b/packages/eslint-plugin/docs/rules/no-meaningless-void-operator.md index d99347a7514..f904c473d66 100644 --- a/packages/eslint-plugin/docs/rules/no-meaningless-void-operator.md +++ b/packages/eslint-plugin/docs/rules/no-meaningless-void-operator.md @@ -6,15 +6,15 @@ description: 'Disallow the `void` operator except when used to discard a value.' > > See **https://typescript-eslint.io/rules/no-meaningless-void-operator** for documentation. -Disallows the `void` operator when its argument is already of type `void` or `undefined`. +`void` in TypeScript refers to a function return that is meant to be ignored. +The `void` operator is a useful tool to convey the programmer's intent to discard a value. +For example, it is recommended as one way of suppressing [`@typescript-eslint/no-floating-promises`](./no-floating-promises.md) instead of adding `.catch()` to a promise. -## Rule Details +This rule helps an authors catch API changes where previously a value was being discarded at a call site, but the callee changed so it no longer returns a value. +When combined with [no-unused-expressions](https://eslint.org/docs/rules/no-unused-expressions), it also helps _readers_ of the code by ensuring consistency: a statement that looks like `void foo();` is **always** discarding a return value, and a statement that looks like `foo();` is **never** discarding a return value. +This rule reports on any `void` operator whose argument is already of type `void` or `undefined`. -The `void` operator is a useful tool to convey the programmer's intent to discard a value. For example, it is recommended as one way of suppressing [`@typescript-eslint/no-floating-promises`](./no-floating-promises.md) instead of adding `.catch()` to a promise. - -This rule helps an author catch API changes where previously a value was being discarded at a call site, but the callee changed so it no longer returns a value. When combined with [no-unused-expressions](https://eslint.org/docs/rules/no-unused-expressions), it also helps _readers_ of the code by ensuring consistency: a statement that looks like `void foo();` is **always** discarding a return value, and a statement that looks like `foo();` is **never** discarding a return value. - -Examples of code for this rule: +## Examples @@ -44,17 +44,4 @@ void bar(); // discarding a number ## Options -This rule accepts a single object option with the following default configuration: - -```json -{ - "@typescript-eslint/no-meaningless-void-operator": [ - "error", - { - "checkNever": false - } - ] -} -``` - -- `checkNever: true` will suggest removing `void` when the argument has type `never`. +`checkNever: true` will suggest removing `void` when the argument has type `never`. diff --git a/packages/eslint-plugin/docs/rules/no-misused-new.md b/packages/eslint-plugin/docs/rules/no-misused-new.md index 08459fba796..a311c40be7a 100644 --- a/packages/eslint-plugin/docs/rules/no-misused-new.md +++ b/packages/eslint-plugin/docs/rules/no-misused-new.md @@ -6,18 +6,20 @@ description: 'Enforce valid definition of `new` and `constructor`.' > > See **https://typescript-eslint.io/rules/no-misused-new** for documentation. -Warns on apparent attempts to define constructors for interfaces or `new` for classes. +JavaScript classes may define a `constructor` method that runs when a class instance is newly created. +TypeScript allows interfaces that describe a static class object to define a `new()` method (though this is rarely used in real world code). +Developers new to JavaScript classes and/or TypeScript interfaces may sometimes confuse when to use `constructor` or `new`. -## Rule Details +This rule reports when a class defines a method named `new` or an interface defines a method named `constructor`. -Examples of code for this rule: +## Examples ### ❌ Incorrect ```ts -class C { +declare class C { new(): C; } @@ -30,10 +32,15 @@ interface I { ### ✅ Correct ```ts -class C { - constructor() {} +declare class C { + constructor(); } + interface I { new (): C; } ``` + +## When Not To Use It + +If you intentionally want a class with a `new` method, and you're confident nobody working in your code will mistake it with a constructor. diff --git a/packages/eslint-plugin/docs/rules/no-misused-promises.md b/packages/eslint-plugin/docs/rules/no-misused-promises.md index 6e75b5db103..72d4e5c670b 100644 --- a/packages/eslint-plugin/docs/rules/no-misused-promises.md +++ b/packages/eslint-plugin/docs/rules/no-misused-promises.md @@ -15,40 +15,8 @@ functions are handled/awaited. See [`no-floating-promises`](./no-floating-promises.md) for detecting unhandled Promise _statements_. ::: -## Rule Details - -This rule accepts a single option which is an object with `checksConditionals`, -`checksVoidReturn`, and `checksSpreads` properties indicating which types of -misuse to flag. All are enabled by default. - ## Options -```ts -type Options = [ - { - checksConditionals?: boolean; - checksVoidReturn?: boolean | ChecksVoidReturnOptions; - checksSpreads?: boolean; - }, -]; - -interface ChecksVoidReturnOptions { - arguments?: boolean; - attributes?: boolean; - properties?: boolean; - returns?: boolean; - variables?: boolean; -} - -const defaultOptions: Options = [ - { - checksConditionals: true, - checksVoidReturn: true, - checksSpreads: true, - }, -]; -``` - ### `"checksConditionals"` If you don't want to check conditionals, you can configure the rule with `"checksConditionals": false`: @@ -66,6 +34,45 @@ If you don't want to check conditionals, you can configure the rule with `"check Doing so prevents the rule from looking at code like `if (somePromise)`. +Examples of code for this rule with `checksConditionals: true`: + + + +#### ❌ Incorrect + +```ts +const promise = Promise.resolve('value'); + +if (promise) { + // Do something +} + +const val = promise ? 123 : 456; + +while (promise) { + // Do something +} +``` + +#### ✅ Correct + +```ts +const promise = Promise.resolve('value'); + +// Always `await` the Promise in a conditional +if (await promise) { + // Do something +} + +const val = (await promise) ? 123 : 456; + +while (await promise) { + // Do something +} +``` + + + ### `"checksVoidReturn"` Likewise, if you don't want functions that return promises where a void return is @@ -107,64 +114,6 @@ For example, if you don't mind that passing a `() => Promise` to a `() => } ``` -### `"checksSpreads"` - -If you don't want to check object spreads, you can add this configuration: - -```json -{ - "@typescript-eslint/no-misused-promises": [ - "error", - { - "checksSpreads": false - } - ] -} -``` - -### `checksConditionals: true` - -Examples of code for this rule with `checksConditionals: true`: - - - -#### ❌ Incorrect - -```ts -const promise = Promise.resolve('value'); - -if (promise) { - // Do something -} - -const val = promise ? 123 : 456; - -while (promise) { - // Do something -} -``` - -#### ✅ Correct - -```ts -const promise = Promise.resolve('value'); - -// Always `await` the Promise in a conditional -if (await promise) { - // Do something -} - -const val = (await promise) ? 123 : 456; - -while (await promise) { - // Do something -} -``` - - - -### `checksVoidReturn: true` - Examples of code for this rule with `checksVoidReturn: true`: @@ -233,7 +182,20 @@ eventEmitter.on('some-event', () => { -### `checksSpreads: true` +### `"checksSpreads"` + +If you don't want to check object spreads, you can add this configuration: + +```json +{ + "@typescript-eslint/no-misused-promises": [ + "error", + { + "checksSpreads": false + } + ] +} +``` Examples of code for this rule with `checksSpreads: true`: diff --git a/packages/eslint-plugin/docs/rules/no-namespace.md b/packages/eslint-plugin/docs/rules/no-namespace.md index 6e4bda690be..e5f2d431d57 100644 --- a/packages/eslint-plugin/docs/rules/no-namespace.md +++ b/packages/eslint-plugin/docs/rules/no-namespace.md @@ -1,19 +1,18 @@ --- -description: 'Disallow custom TypeScript modules and namespaces.' +description: 'Disallow TypeScript namespaces.' --- > 🛑 This file is source code, not the primary documentation location! 🛑 > > See **https://typescript-eslint.io/rules/no-namespace** for documentation. -Custom TypeScript modules (`module foo {}`) and namespaces (`namespace foo {}`) are considered outdated -ways to organize TypeScript code. ES2015 module syntax is now preferred (`import`/`export`). +TypeScript historically allowed a form of code organization called "custom modules" (`module Example {}`), later renamed to "namespaces" (`namespace Example`). +Namespaces are an outdated way to organize TypeScript code. +ES2015 module syntax is now preferred (`import`/`export`). -This rule still allows the use of TypeScript module declarations to describe external APIs (`declare module 'foo' {}`). +> This rule does not report on the use of TypeScript module declarations to describe external APIs (`declare module 'foo' {}`). -## Rule Details - -This rule aims to standardize the way modules are declared. +## Examples Examples of code with the default options: diff --git a/packages/eslint-plugin/docs/rules/no-non-null-asserted-nullish-coalescing.md b/packages/eslint-plugin/docs/rules/no-non-null-asserted-nullish-coalescing.md index 19fd65779f8..09bf9be3be8 100644 --- a/packages/eslint-plugin/docs/rules/no-non-null-asserted-nullish-coalescing.md +++ b/packages/eslint-plugin/docs/rules/no-non-null-asserted-nullish-coalescing.md @@ -6,20 +6,16 @@ description: 'Disallow non-null assertions in the left operand of a nullish coal > > See **https://typescript-eslint.io/rules/no-non-null-asserted-nullish-coalescing** for documentation. -## Rule Details +The `??` nullish coalescing runtime operator allows providing a default value when dealing with `null` or `undefined`. +Using a `!` non-null assertion type operator in the left operand of a nullish coalescing operator is redundant, and likely a sign of programmer error or confusion over the two operators. -The nullish coalescing operator is designed to provide a default value when dealing with `null` or `undefined`. -Using non-null assertions in the left operand of the nullish coalescing operator is redundant. - -Examples of code for this rule: +## Examples ### ❌ Incorrect ```ts -/* eslint @typescript-eslint/no-non-null-asserted-nullish-coalescing: "error" */ - foo! ?? bar; foo.bazz! ?? bar; foo!.bazz! ?? bar; @@ -36,8 +32,6 @@ x! ?? ''; ### ✅ Correct ```ts -/* eslint @typescript-eslint/no-non-null-asserted-nullish-coalescing: "error" */ - foo ?? bar; foo ?? bar!; foo!.bazz ?? bar; @@ -49,10 +43,6 @@ let x: string; x! ?? ''; ``` -## When Not To Use It - -If you are not using TypeScript 3.7 (or greater), then you will not need to use this rule, as the nullish coalescing operator is not supported. - ## Further Reading - [TypeScript 3.7 Release Notes](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html) diff --git a/packages/eslint-plugin/docs/rules/no-non-null-asserted-optional-chain.md b/packages/eslint-plugin/docs/rules/no-non-null-asserted-optional-chain.md index 89f9a3c87b7..4a6c1607a94 100644 --- a/packages/eslint-plugin/docs/rules/no-non-null-asserted-optional-chain.md +++ b/packages/eslint-plugin/docs/rules/no-non-null-asserted-optional-chain.md @@ -6,52 +6,29 @@ description: 'Disallow non-null assertions after an optional chain expression.' > > See **https://typescript-eslint.io/rules/no-non-null-asserted-optional-chain** for documentation. -## Rule Details +`?.` optional chain expressions provide `undefined` if an object is `null` or `undefined`. +Using a `!` non-null assertion to assert the result of an `?.` optional chain expression is non-nullable is likely wrong. -Optional chain expressions are designed to return `undefined` if the optional property is nullish. -Using non-null assertions after an optional chain expression is wrong, and introduces a serious type safety hole into your code. +> Most of the time, either the object was not nullable and did not need the `?.` for its property lookup, or the `!` is incorrect and introducing a type safety hole. -Examples of code for this rule: +## Examples ### ❌ Incorrect ```ts -/* eslint @typescript-eslint/no-non-null-asserted-optional-chain: "error" */ - foo?.bar!; foo?.bar()!; - -// Prior to TS3.9, foo?.bar!.baz meant (foo?.bar).baz - i.e. the non-null assertion is applied to the entire chain so far. -// For TS3.9 and greater, the non-null assertion is only applied to the property itself, so it's safe. -// The following is incorrect code if you're using less than TS3.9 -foo?.bar!.baz; -foo?.bar!(); -foo?.bar!().baz; ``` ### ✅ Correct ```ts -/* eslint @typescript-eslint/no-non-null-asserted-optional-chain: "error" */ - foo?.bar; -(foo?.bar).baz; -foo?.bar(); foo?.bar(); -foo?.bar().baz; - -// The following is correct code if you're using TS3.9 or greater -foo?.bar!.baz; -foo?.bar!(); -foo?.bar!().baz; ``` -## When Not To Use It - -If you are not using TypeScript 3.7 (or greater), then you will not need to use this rule, as the operator is not supported. - ## Further Reading - [TypeScript 3.7 Release Notes](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html) diff --git a/packages/eslint-plugin/docs/rules/no-non-null-assertion.md b/packages/eslint-plugin/docs/rules/no-non-null-assertion.md index 6e60483bc54..874e01605c8 100644 --- a/packages/eslint-plugin/docs/rules/no-non-null-assertion.md +++ b/packages/eslint-plugin/docs/rules/no-non-null-assertion.md @@ -6,36 +6,37 @@ description: 'Disallow non-null assertions using the `!` postfix operator.' > > See **https://typescript-eslint.io/rules/no-non-null-assertion** for documentation. -## Rule Details +TypeScript's `!` non-null assertion operator asserts to the type system that an expression is non-nullable, as in not `null` or `undefined`. +Using assertions to tell the type system new information is often a sign that code is not fully type-safe. +It's generally better to structure program logic so that TypeScript understands when values may be nullable. -Using non-null assertions cancels the benefits of the strict null-checking mode. - -Examples of code for this rule: +## Examples ### ❌ Incorrect ```ts -interface Foo { - bar?: string; +interface Example { + property?: string; } -const foo: Foo = getFoo(); -const includesBaz: boolean = foo.bar!.includes('baz'); +declare const example: Example; +const includesBaz = example.property!.includes('baz'); ``` ### ✅ Correct ```ts -interface Foo { - bar?: string; +interface Example { + property?: string; } -const foo: Foo = getFoo(); -const includesBaz: boolean = foo.bar?.includes('baz') ?? false; +declare const example: Example; +const includesBaz = example.property?.includes('baz') ?? false; ``` ## When Not To Use It -If you don't care about strict null-checking, then you will not need this rule. +If your project does not use the `strictNullChecks` compiler option, this rule is likely useless to you. +If your code is often wildly incorrect with respect to strict null-checking, your code may not yet be ready for this rule. diff --git a/packages/eslint-plugin/docs/rules/no-parameter-properties.md b/packages/eslint-plugin/docs/rules/no-parameter-properties.md index 2468cc5838a..16a91864d59 100644 --- a/packages/eslint-plugin/docs/rules/no-parameter-properties.md +++ b/packages/eslint-plugin/docs/rules/no-parameter-properties.md @@ -14,7 +14,7 @@ This rule has been deprecated in favour of the equivalent, better named [`parame Parameter properties can be confusing to those new to TypeScript as they are less explicit than other ways of declaring and initializing class members. -## Rule Details +## Examples This rule disallows the use of parameter properties in constructors, forcing the user to explicitly declare all properties in the class. diff --git a/packages/eslint-plugin/docs/rules/no-redeclare.md b/packages/eslint-plugin/docs/rules/no-redeclare.md index b51ba369ce5..faef214667c 100644 --- a/packages/eslint-plugin/docs/rules/no-redeclare.md +++ b/packages/eslint-plugin/docs/rules/no-redeclare.md @@ -6,7 +6,7 @@ description: 'Disallow variable redeclaration.' > > See **https://typescript-eslint.io/rules/no-redeclare** for documentation. -## Rule Details +## Examples This rule extends the base [`eslint/no-redeclare`](https://eslint.org/docs/rules/no-redeclare) rule. It adds support for TypeScript function overloads, and declaration merging. diff --git a/packages/eslint-plugin/docs/rules/no-redundant-type-constituents.md b/packages/eslint-plugin/docs/rules/no-redundant-type-constituents.md index 3cf63d4df49..69cd6c83af0 100644 --- a/packages/eslint-plugin/docs/rules/no-redundant-type-constituents.md +++ b/packages/eslint-plugin/docs/rules/no-redundant-type-constituents.md @@ -6,8 +6,6 @@ description: 'Disallow members of unions and intersections that do nothing or ov > > See **https://typescript-eslint.io/rules/no-redundant-type-constituents** for documentation. -## Rule Details - Some types can override some other types ("constituents") in a union or intersection and/or be overridden by some other types. TypeScript's set theory of types includes cases where a constituent type might be useless in the parent union or intersection. @@ -24,7 +22,7 @@ Within `&` intersections: - literal types "override" any primitive types in an intersection - literal types such as `""` "override" any of their primitive types such as `string` -Examples of code for this rule: +## Examples @@ -66,14 +64,11 @@ type IntersectionNever = string; type IntersectionBooleanLiteral = false; type IntersectionNumberLiteral = 1; type IntersectionStringLiteral = 'foo'; - -type ReturnUnionNever = () => string | never; ``` ## Limitations This rule plays it safe and only works with bottom types, top types, and comparing literal types to primitive types. -It also does not provide an auto-fixer just yet. ## Further Reading diff --git a/packages/eslint-plugin/docs/rules/no-require-imports.md b/packages/eslint-plugin/docs/rules/no-require-imports.md index b38486837e1..6e75a3d41cd 100644 --- a/packages/eslint-plugin/docs/rules/no-require-imports.md +++ b/packages/eslint-plugin/docs/rules/no-require-imports.md @@ -8,33 +8,30 @@ description: 'Disallow invocation of `require()`.' Prefer the newer ES6-style imports over `require()`. -## Rule Details - -Examples of code for this rule: +## Examples ### ❌ Incorrect ```ts -var lib = require('lib'); -let lib2 = require('lib2'); -var lib5 = require('lib5'), - lib6 = require('lib6'); -import lib8 = require('lib8'); +const lib1 = require('lib1'); +const { lib2 } = require('lib2'); +import lib3 = require('lib3'); ``` ### ✅ Correct ```ts -import { l } from 'lib'; -var lib3 = load('not_an_import'); -var lib4 = lib2.subImport; -var lib7 = 700; -import lib9 = lib2.anotherSubImport; -import lib10 from 'lib10'; +import * as lib1 from 'lib1'; +import { lib2 } from 'lib2'; +import * as lib3 from 'lib3'; ``` ## When Not To Use It -If you don't care about TypeScript module syntax, then you will not need this rule. +If you don't care about using newer module syntax, then you will not need this rule. + +## Related To + +- [`no-var-requires`](./no-var-requires.md) diff --git a/packages/eslint-plugin/docs/rules/no-restricted-imports.md b/packages/eslint-plugin/docs/rules/no-restricted-imports.md index 202143581f2..900a9cdd030 100644 --- a/packages/eslint-plugin/docs/rules/no-restricted-imports.md +++ b/packages/eslint-plugin/docs/rules/no-restricted-imports.md @@ -6,7 +6,7 @@ description: 'Disallow specified modules when loaded by `import`.' > > See **https://typescript-eslint.io/rules/no-restricted-imports** for documentation. -## Rule Details +## Examples This rule extends the base [`eslint/no-restricted-imports`](https://eslint.org/docs/rules/no-restricted-imports) rule. diff --git a/packages/eslint-plugin/docs/rules/no-shadow.md b/packages/eslint-plugin/docs/rules/no-shadow.md index c990ff97230..1dfadba55aa 100644 --- a/packages/eslint-plugin/docs/rules/no-shadow.md +++ b/packages/eslint-plugin/docs/rules/no-shadow.md @@ -6,7 +6,7 @@ description: 'Disallow variable declarations from shadowing variables declared i > > See **https://typescript-eslint.io/rules/no-shadow** for documentation. -## Rule Details +## Examples This rule extends the base [`eslint/no-shadow`](https://eslint.org/docs/rules/no-shadow) rule. It adds support for TypeScript's `this` parameters and global augmentation, and adds options for TypeScript features. @@ -78,3 +78,24 @@ Examples of **correct** code with `{ ignoreFunctionTypeParameterNameValueShadow: const test = 1; type Func = (test: string) => typeof test; ``` + +## FAQ + +### Why does the rule report on enum members that share the same name as a variable in a parent scope? + +Reporting on this case isn't a bug - it is completely intentional and correct reporting! The rule reports due to a relatively unknown feature of enums - enum members create a variable within the enum scope so that they can be referenced within the enum without a qualifier. + +To illustrate this with an example: + +```ts +const A = 2; +enum Test { + A = 1, + B = A, +} + +console.log(Test.B); +// what should be logged? +``` + +Naively looking at the above code, it might look like the log should output `2`, because the outer variable `A`'s value is `2` - however, the code instead outputs `1`, which is the value of `Test.A`. This is because the unqualified code `B = A` is equivalent to the fully-qualified code `B = Test.A`. Due to this behavior, the enum member has **shadowed** the outer variable declaration. diff --git a/packages/eslint-plugin/docs/rules/no-this-alias.md b/packages/eslint-plugin/docs/rules/no-this-alias.md index 8ba520d7af6..640d5a6a2b5 100644 --- a/packages/eslint-plugin/docs/rules/no-this-alias.md +++ b/packages/eslint-plugin/docs/rules/no-this-alias.md @@ -6,24 +6,24 @@ description: 'Disallow aliasing `this`.' > > See **https://typescript-eslint.io/rules/no-this-alias** for documentation. -This rule prohibits assigning variables to `this`. - -## Rule Details - Assigning a variable to `this` instead of properly using arrow lambdas may be a symptom of pre-ES6 practices or not managing scope well. -Instead of storing a reference to `this` and using it inside a `function () {`: +## Examples + + + +### ❌ Incorrect ```js const self = this; -> + setTimeout(function () { - self.doWork(); + self.doWork(); }); ``` -Use `() =>` arrow lambdas, as they preserve `this` scope for you: +### ✅ Correct ```js setTimeout(() => { @@ -31,13 +31,7 @@ setTimeout(() => { }); ``` -Examples of **incorrect** code for this rule: - -(see the rationale above) - -Examples of **correct** code for this rule: - -(see the rationale above) +## Options ## When Not To Use It diff --git a/packages/eslint-plugin/docs/rules/no-throw-literal.md b/packages/eslint-plugin/docs/rules/no-throw-literal.md index 9fb71fcbe49..f4d189067b9 100644 --- a/packages/eslint-plugin/docs/rules/no-throw-literal.md +++ b/packages/eslint-plugin/docs/rules/no-throw-literal.md @@ -11,12 +11,10 @@ The fundamental benefit of `Error` objects is that they automatically keep track This rule restricts what can be thrown as an exception. When it was first created, it only prevented literals from being thrown (hence the name), but it has now been expanded to only allow expressions which have a possibility of being an `Error` object. With the `allowThrowingAny` and `allowThrowingUnknown`, it can be configured to only allow throwing values which are guaranteed to be an instance of `Error`. -## Rule Details +## 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. -Examples of code for this rule: - ### ❌ Incorrect diff --git a/packages/eslint-plugin/docs/rules/no-type-alias.md b/packages/eslint-plugin/docs/rules/no-type-alias.md index 4117d613345..a9774ebdde1 100644 --- a/packages/eslint-plugin/docs/rules/no-type-alias.md +++ b/packages/eslint-plugin/docs/rules/no-type-alias.md @@ -78,7 +78,7 @@ On the other hand, using a type alias as an interface can limit your ability to: Finally, mapping types is an advanced technique and leaving it open can quickly become a pain point in your application. -## Rule Details +## Examples This rule disallows the use of type aliases in favor of interfaces and simplified types (primitives, tuples, unions, intersections, etc). diff --git a/packages/eslint-plugin/docs/rules/no-unnecessary-boolean-literal-compare.md b/packages/eslint-plugin/docs/rules/no-unnecessary-boolean-literal-compare.md index 8e148460a42..69c9a33441b 100644 --- a/packages/eslint-plugin/docs/rules/no-unnecessary-boolean-literal-compare.md +++ b/packages/eslint-plugin/docs/rules/no-unnecessary-boolean-literal-compare.md @@ -6,25 +6,20 @@ description: 'Disallow unnecessary equality comparisons against boolean literals > > See **https://typescript-eslint.io/rules/no-unnecessary-boolean-literal-compare** for documentation. -Comparing boolean values to boolean literals is unnecessary, those comparisons result in the same booleans. Using the boolean values directly, or via a unary negation (`!value`), is more concise and clearer. - -## Rule Details +Comparing boolean values to boolean literals is unnecessary: those comparisons result in the same booleans. +Using the boolean values directly, or via a unary negation (`!value`), is more concise and clearer. This rule ensures that you do not include unnecessary comparisons with boolean literals. A comparison is considered unnecessary if it checks a boolean literal against any variable with just the `boolean` type. -A comparison is **_not_** considered unnecessary if the type is a union of booleans (`string | boolean`, `someObject | boolean`). - -**Warning**: Do not use this rule when `strictNullChecks` is disabled. -ESLint is not able to distinguish between `false` and `undefined` or `null` values. -This can cause unintended code changes when using autofix. +A comparison is **_not_** considered unnecessary if the type is a union of booleans (`string | boolean`, `SomeObject | boolean`, etc.). -**Note**: Throughout this page, only strict equality (`===` and `!==`) are -used in the examples. However, the implementation of the rule does not -distinguish between strict and loose equality. Any example below that uses -`===` would be treated the same way if `==` was used, and any example below -that uses `!==` would be treated the same way if `!=` was used. +## Examples -Examples of code for this rule: +:::note +Throughout this page, only strict equality (`===` and `!==`) are used in the examples. +However, the implementation of the rule does not distinguish between strict and loose equality. +Any example below that uses `===` would be treated the same way if `==` was used, and `!==` would be treated the same way if `!=` was used. +::: @@ -130,3 +125,9 @@ if (!(someNullCondition ?? true)) { | `nullableBooleanVar !== true` | `!nullableBooleanVar` | Only checked/fixed if the `allowComparingNullableBooleansToTrue` option is `false` | | `nullableBooleanVar === false` | `nullableBooleanVar ?? true` | Only checked/fixed if the `allowComparingNullableBooleansToFalse` option is `false` | | `nullableBooleanVar !== false` | `!(nullableBooleanVar ?? true)` | Only checked/fixed if the `allowComparingNullableBooleansToFalse` option is `false` | + +## Not To Use It + +Do not use this rule when `strictNullChecks` is disabled. +ESLint is not able to distinguish between `false` and `undefined` or `null` values. +This can cause unintended code changes when using autofix. diff --git a/packages/eslint-plugin/docs/rules/no-unnecessary-condition.md b/packages/eslint-plugin/docs/rules/no-unnecessary-condition.md index ac50dc295f3..8e052f2379f 100644 --- a/packages/eslint-plugin/docs/rules/no-unnecessary-condition.md +++ b/packages/eslint-plugin/docs/rules/no-unnecessary-condition.md @@ -6,7 +6,8 @@ description: 'Disallow conditionals where the type is always truthy or always fa > > See **https://typescript-eslint.io/rules/no-unnecessary-condition** for documentation. -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. +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: @@ -14,9 +15,7 @@ The following expressions are checked: - Conditions for `if`, `for`, `while`, and `do-while` statements - Base values of optional chain expressions -## Rule Details - -Examples of code for this rule: +## Examples diff --git a/packages/eslint-plugin/docs/rules/no-unnecessary-qualifier.md b/packages/eslint-plugin/docs/rules/no-unnecessary-qualifier.md index 58a2b80bf5d..6ca2afe17f5 100644 --- a/packages/eslint-plugin/docs/rules/no-unnecessary-qualifier.md +++ b/packages/eslint-plugin/docs/rules/no-unnecessary-qualifier.md @@ -6,31 +6,16 @@ description: 'Disallow unnecessary namespace qualifiers.' > > See **https://typescript-eslint.io/rules/no-unnecessary-qualifier** for documentation. -## Rule Details +Members of TypeScript enums and namespaces are generally retrieved as qualified property lookups: e.g. `Enum.member`. +However, when accessed within their parent enum or namespace, the qualifier is unnecessary: e.g. just `member` instead of `Enum.member`. +This rule reports when an enum or namespace qualifier is unnecessary. -This rule aims to let users know when a namespace or enum qualifier is unnecessary, -whether used for a type or for a value. - -Examples of code for this rule: +## Examples ### ❌ Incorrect -```ts -namespace A { - export type B = number; - const x: A.B = 3; -} -``` - -```ts -namespace A { - export const x = 3; - export const y = A.x; -} -``` - ```ts enum A { B, @@ -40,46 +25,27 @@ enum A { ```ts namespace A { - export namespace B { - export type T = number; - const x: A.B.T = 3; - } + export type B = number; + const x: A.B = 3; } ``` ### ✅ Correct -```ts -namespace X { - export type T = number; -} - -namespace Y { - export const x: X.T = 3; -} -``` - ```ts enum A { - X, - Y, -} - -enum B { - Z = A.X, + B, + C = B, } ``` ```ts -namespace X { - export type T = number; - namespace Y { - type T = string; - const x: X.T = 0; - } +namespace A { + export type B = number; + const x: B = 3; } ``` ## When Not To Use It -If you don't care about having unneeded namespace or enum qualifiers, then you don't need to use this rule. +If you don't care about having unneeded enum or namespace qualifiers, then you don't need to use this rule. diff --git a/packages/eslint-plugin/docs/rules/no-unnecessary-type-arguments.md b/packages/eslint-plugin/docs/rules/no-unnecessary-type-arguments.md index 976cf23e372..43526aec571 100644 --- a/packages/eslint-plugin/docs/rules/no-unnecessary-type-arguments.md +++ b/packages/eslint-plugin/docs/rules/no-unnecessary-type-arguments.md @@ -6,20 +6,17 @@ description: 'Disallow type arguments that are equal to the default.' > > See **https://typescript-eslint.io/rules/no-unnecessary-type-arguments** for documentation. -Warns if an explicitly specified type argument is the default for that type parameter. - -## Rule Details - Type parameters in TypeScript may specify a default value. For example: ```ts -function f() {} +function f(...) {...} ``` -It is redundant to provide an explicit type parameter equal to that default. +It is redundant to provide an explicit type parameter equal to that default: e.g. calling `f(...)`. +This rule reports when an explicitly specified type argument is the default for that type parameter. -Examples of code for this rule: +## Examples @@ -28,15 +25,21 @@ Examples of code for this rule: ```ts function f() {} f(); +``` +```ts function g() {} g(); +``` +```ts class C {} -function h(c: C) {} new C(); + class D extends C {} +``` +```ts interface I {} class Impl implements I {} ``` @@ -45,15 +48,26 @@ class Impl implements I {} ```ts function f() {} +f(); f(); +``` +```ts function g() {} +g(); g(); +``` +```ts class C {} +new C(); new C(); + +class D extends C {} class D extends C {} +``` +```ts interface I {} class Impl implements I {} ``` diff --git a/packages/eslint-plugin/docs/rules/no-unnecessary-type-assertion.md b/packages/eslint-plugin/docs/rules/no-unnecessary-type-assertion.md index 30e81b4c9b6..72698d8980a 100644 --- a/packages/eslint-plugin/docs/rules/no-unnecessary-type-assertion.md +++ b/packages/eslint-plugin/docs/rules/no-unnecessary-type-assertion.md @@ -6,13 +6,11 @@ description: 'Disallow type assertions that do not change the type of an express > > See **https://typescript-eslint.io/rules/no-unnecessary-type-assertion** for documentation. -This rule prohibits using a type assertion that does not change the type of an expression. +TypeScript can be told an expression is a different type than expected using `as` type assertions. +Leaving `as` assertions in the codebase increases visual clutter and harms code readability, so it's generally best practice to remove them if they don't change the type of an expression. +This rule reports when a type assertion does not change the type of an expression. -## Rule Details - -This rule aims to prevent unnecessary type assertions. - -Examples of code for this rule: +## Examples diff --git a/packages/eslint-plugin/docs/rules/no-unnecessary-type-constraint.md b/packages/eslint-plugin/docs/rules/no-unnecessary-type-constraint.md index c5b078810fa..b8672d945d5 100644 --- a/packages/eslint-plugin/docs/rules/no-unnecessary-type-constraint.md +++ b/packages/eslint-plugin/docs/rules/no-unnecessary-type-constraint.md @@ -6,17 +6,11 @@ description: 'Disallow unnecessary constraints on generic types.' > > See **https://typescript-eslint.io/rules/no-unnecessary-type-constraint** for documentation. -## Rule Details +Generic type parameters (``) in TypeScript may be "constrained" with an [`extends` keyword](https://www.typescriptlang.org/docs/handbook/generics.html#generic-constraints). +When no `extends` is provided, type parameters default a constraint to `any`. +It is therefore redundant to `extend` from `any`. -Type parameters (``) may be "constrained" with an `extends` keyword ([docs](https://www.typescriptlang.org/docs/handbook/generics.html#generic-constraints)). -When not provided, type parameters happen to default to: - -- As of TypeScript 3.9: `unknown` ([docs](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-9.html#type-parameters-that-extend-any-no-longer-act-as-any)) -- Before that, as of 3.5: `any` ([docs](https://devblogs.microsoft.com/typescript/announcing-typescript-3-5/#breaking-changes)) - -It is therefore redundant to `extend` from these types in later versions of TypeScript. - -Examples of code for this rule: +## Examples @@ -24,24 +18,16 @@ Examples of code for this rule: ```ts interface FooAny {} -interface FooUnknown {} type BarAny = {}; -type BarUnknown = {}; class BazAny { - quxUnknown() {} -} - -class BazUnknown { - quxUnknown() {} + quxAny() {} } const QuuxAny = () => {}; -const QuuxUnknown = () => {}; function QuuzAny() {} -function QuuzUnknown() {} ``` ### ✅ Correct @@ -52,7 +38,7 @@ interface Foo {} type Bar = {}; class Baz { - qux { } + qux { } } const Quux = () => {}; diff --git a/packages/eslint-plugin/docs/rules/no-unsafe-argument.md b/packages/eslint-plugin/docs/rules/no-unsafe-argument.md index 63068ce497c..6390409827a 100644 --- a/packages/eslint-plugin/docs/rules/no-unsafe-argument.md +++ b/packages/eslint-plugin/docs/rules/no-unsafe-argument.md @@ -6,16 +6,19 @@ description: 'Disallow calling a function with a value with type `any`.' > > See **https://typescript-eslint.io/rules/no-unsafe-argument** for documentation. +The `any` type in TypeScript is a dangerous "escape hatch" from the type system. +Using `any` disables many type checking rules and is generally best used only as a last resort or when prototyping code. + Despite your best intentions, the `any` type can sometimes leak into your codebase. -Call a function with `any` typed argument are not checked at all by TypeScript, so it creates a potential safety hole, and source of bugs in your codebase. +Calling a function with an `any` typed argument creates a potential safety hole and source of bugs. -## Rule Details +This rule disallows calling a function with `any` in its arguments. +That includes spreading arrays or tuples with `any` typed elements as function arguments. -This rule disallows calling a function with `any` in its arguments, and it will disallow spreading `any[]`. -This rule also disallows spreading a tuple type with one of its elements typed as `any`. -This rule also compares the argument's type to the variable's type to ensure you don't pass an unsafe `any` in a generic position to a receiver that's expecting a specific type. For example, it will error if you assign `Set` to an argument declared as `Set`. +This rule also compares generic type argument types to ensure you don't pass an unsafe `any` in a generic position to a receiver that's expecting a specific type. +For example, it will error if you pass `Set` as an argument to a parameter declared as `Set`. -Examples of code for this rule: +## Examples @@ -68,7 +71,7 @@ foo(new Set(), new Map()); There are cases where the rule allows passing an argument of `any` to `unknown`. -Example of `any` to `unknown` assignment that are allowed. +Example of `any` to `unknown` assignment that are allowed: ```ts declare function foo(arg1: unknown, arg2: Set, arg3: unknown[]): void; diff --git a/packages/eslint-plugin/docs/rules/no-unsafe-assignment.md b/packages/eslint-plugin/docs/rules/no-unsafe-assignment.md index 9e797f4319f..98228f81683 100644 --- a/packages/eslint-plugin/docs/rules/no-unsafe-assignment.md +++ b/packages/eslint-plugin/docs/rules/no-unsafe-assignment.md @@ -6,15 +6,18 @@ description: 'Disallow assigning a value with type `any` to variables and proper > > See **https://typescript-eslint.io/rules/no-unsafe-assignment** for documentation. -Despite your best intentions, the `any` type can sometimes leak into your codebase. -Assigning an `any` typed value to a variable can be hard to pick up on, particularly if it leaks in from an external library. Operations on the variable will not be checked at all by TypeScript, so it creates a potential safety hole, and source of bugs in your codebase. +The `any` type in TypeScript is a dangerous "escape hatch" from the type system. +Using `any` disables many type checking rules and is generally best used only as a last resort or when prototyping code. -## Rule Details +Despite your best intentions, the `any` type can sometimes leak into your codebase. +Assigning an `any` typed value to a variable can be hard to pick up on, particularly if it leaks in from an external library. This rule disallows assigning `any` to a variable, and assigning `any[]` to an array destructuring. -This rule also compares the assigned type to the variable's type to ensure you don't assign an unsafe `any` in a generic position to a receiver that's expecting a specific type. For example, it will error if you assign `Set` to a variable declared as `Set`. -Examples of code for this rule: +This rule also compares generic type argument types to ensure you don't pass an unsafe `any` in a generic position to a receiver that's expecting a specific type. +For example, it will error if you assign `Set` to a variable declared as `Set`. + +## Examples @@ -70,7 +73,7 @@ const x: Set>> = new Set>>(); There are cases where the rule allows assignment of `any` to `unknown`. -Example of `any` to `unknown` assignment that are allowed. +Example of `any` to `unknown` assignment that are allowed: ```ts const x: unknown = y as any; diff --git a/packages/eslint-plugin/docs/rules/no-unsafe-call.md b/packages/eslint-plugin/docs/rules/no-unsafe-call.md index 9191dca9ae8..8fddb2774b6 100644 --- a/packages/eslint-plugin/docs/rules/no-unsafe-call.md +++ b/packages/eslint-plugin/docs/rules/no-unsafe-call.md @@ -6,14 +6,15 @@ description: 'Disallow calling a value with type `any`.' > > See **https://typescript-eslint.io/rules/no-unsafe-call** for documentation. -Despite your best intentions, the `any` type can sometimes leak into your codebase. -The arguments to, and return value of calling an `any` typed variable are not checked at all by TypeScript, so it creates a potential safety hole, and source of bugs in your codebase. +The `any` type in TypeScript is a dangerous "escape hatch" from the type system. +Using `any` disables many type checking rules and is generally best used only as a last resort or when prototyping code. -## Rule Details +Despite your best intentions, the `any` type can sometimes leak into your codebase. +Calling an `any`-typed value as a function creates a potential type safety hole and source of bugs in your codebase. -This rule disallows calling any variable that is typed as `any`. +This rule disallows calling any value that is typed as `any`. -Examples of code for this rule: +## Examples diff --git a/packages/eslint-plugin/docs/rules/no-unsafe-declaration-merging.md b/packages/eslint-plugin/docs/rules/no-unsafe-declaration-merging.md new file mode 100644 index 00000000000..9c917aa3ee0 --- /dev/null +++ b/packages/eslint-plugin/docs/rules/no-unsafe-declaration-merging.md @@ -0,0 +1,54 @@ +--- +description: 'Disallow unsafe declaration merging.' +--- + +> 🛑 This file is source code, not the primary documentation location! 🛑 +> +> See **https://typescript-eslint.io/rules/no-unsafe-declaration-merging** for documentation. + +TypeScript's "declaration merging" supports merging separate declarations with the same name. + +Declaration merging between classes and interfaces is unsafe. +The TypeScript compiler doesn't check whether properties are initialized, which can cause lead to TypeScript not detecting code that will cause runtime errors. + +```ts +interface Foo { + nums: number[]; +} + +class Foo {} + +const foo = new Foo(); + +foo.nums.push(1); // Runtime Error: Cannot read properties of undefined. +``` + +## Examples + + + +### ❌ Incorrect + +```ts +interface Foo {} + +class Foo {} +``` + +### ✅ Correct + +```ts +interface Foo {} +class Bar implements Foo {} + +namespace Baz {} +namespace Baz {} +enum Baz {} + +namespace Qux {} +function Qux() {} +``` + +## Further Reading + +- [Declaration Merging](https://www.typescriptlang.org/docs/handbook/declaration-merging.html) diff --git a/packages/eslint-plugin/docs/rules/no-unsafe-member-access.md b/packages/eslint-plugin/docs/rules/no-unsafe-member-access.md index 393a4bb46cd..dfefaccd8b4 100644 --- a/packages/eslint-plugin/docs/rules/no-unsafe-member-access.md +++ b/packages/eslint-plugin/docs/rules/no-unsafe-member-access.md @@ -6,14 +6,15 @@ description: 'Disallow member access on a value with type `any`.' > > See **https://typescript-eslint.io/rules/no-unsafe-member-access** for documentation. -Despite your best intentions, the `any` type can sometimes leak into your codebase. -Member access on `any` typed variables is not checked at all by TypeScript, so it creates a potential safety hole, and source of bugs in your codebase. +The `any` type in TypeScript is a dangerous "escape hatch" from the type system. +Using `any` disables many type checking rules and is generally best used only as a last resort or when prototyping code. -## Rule Details +Despite your best intentions, the `any` type can sometimes leak into your codebase. +Accessing a member of an `any`-typed value creates a potential type safety hole and source of bugs in your codebase. This rule disallows member access on any variable that is typed as `any`. -Examples of code for this rule: +## Examples diff --git a/packages/eslint-plugin/docs/rules/no-unsafe-return.md b/packages/eslint-plugin/docs/rules/no-unsafe-return.md index 9c553722959..796580f23dd 100644 --- a/packages/eslint-plugin/docs/rules/no-unsafe-return.md +++ b/packages/eslint-plugin/docs/rules/no-unsafe-return.md @@ -6,15 +6,18 @@ description: 'Disallow returning a value with type `any` from a function.' > > See **https://typescript-eslint.io/rules/no-unsafe-return** for documentation. -Despite your best intentions, the `any` type can sometimes leak into your codebase. -Returned `any` typed values are not checked at all by TypeScript, so it creates a potential safety hole, and source of bugs in your codebase. +The `any` type in TypeScript is a dangerous "escape hatch" from the type system. +Using `any` disables many type checking rules and is generally best used only as a last resort or when prototyping code. -## Rule Details +Despite your best intentions, the `any` type can sometimes leak into your codebase. +Returning an an `any`-typed value from a function creates a potential type safety hole and source of bugs in your codebase. This rule disallows returning `any` or `any[]` from a function. -This rule also compares the return type to the function's declared/inferred return type to ensure you don't return an unsafe `any` in a generic position to a receiver that's expecting a specific type. For example, it will error if you return `Set` from a function declared as returning `Set`. -Examples of code for this rule: +This rule also compares generic type argument types to ensure you don't return an unsafe `any` in a generic position to a function that's expecting a specific type. +For example, it will error if you return `Set` from a function declared as returning `Set`. + +## Examples @@ -83,7 +86,7 @@ const assignability2: TAssign = () => new Set(['foo']); There are cases where the rule allows to return `any` to `unknown`. -Examples of `any` to `unknown` return that are allowed. +Examples of `any` to `unknown` return that are allowed: ```ts function foo1(): unknown { diff --git a/packages/eslint-plugin/docs/rules/no-unused-expressions.md b/packages/eslint-plugin/docs/rules/no-unused-expressions.md index db3120db3e2..4e439431d45 100644 --- a/packages/eslint-plugin/docs/rules/no-unused-expressions.md +++ b/packages/eslint-plugin/docs/rules/no-unused-expressions.md @@ -6,7 +6,7 @@ description: 'Disallow unused expressions.' > > See **https://typescript-eslint.io/rules/no-unused-expressions** for documentation. -## Rule Details +## Examples This rule extends the base [`eslint/no-unused-expressions`](https://eslint.org/docs/rules/no-unused-expressions) rule. It adds support for optional call expressions `x?.()`, and directive in module declarations. diff --git a/packages/eslint-plugin/docs/rules/no-unused-vars.md b/packages/eslint-plugin/docs/rules/no-unused-vars.md index ffd1ceb0f6a..8fd90f74ae5 100644 --- a/packages/eslint-plugin/docs/rules/no-unused-vars.md +++ b/packages/eslint-plugin/docs/rules/no-unused-vars.md @@ -6,7 +6,7 @@ description: 'Disallow unused variables.' > > See **https://typescript-eslint.io/rules/no-unused-vars** for documentation. -## Rule Details +## Examples This rule extends the base [`eslint/no-unused-vars`](https://eslint.org/docs/rules/no-unused-vars) rule. It adds support for TypeScript features, such as types. diff --git a/packages/eslint-plugin/docs/rules/no-use-before-define.md b/packages/eslint-plugin/docs/rules/no-use-before-define.md index e17a8b873e3..0350658347a 100644 --- a/packages/eslint-plugin/docs/rules/no-use-before-define.md +++ b/packages/eslint-plugin/docs/rules/no-use-before-define.md @@ -6,7 +6,7 @@ description: 'Disallow the use of variables before they are defined.' > > See **https://typescript-eslint.io/rules/no-use-before-define** for documentation. -## Rule Details +## Examples This rule extends the base [`eslint/no-use-before-define`](https://eslint.org/docs/rules/no-use-before-define) rule. It adds support for `type`, `interface` and `enum` declarations. diff --git a/packages/eslint-plugin/docs/rules/no-useless-constructor.md b/packages/eslint-plugin/docs/rules/no-useless-constructor.md index e1a8297fefe..0f570ab9e59 100644 --- a/packages/eslint-plugin/docs/rules/no-useless-constructor.md +++ b/packages/eslint-plugin/docs/rules/no-useless-constructor.md @@ -6,7 +6,7 @@ description: 'Disallow unnecessary constructors.' > > See **https://typescript-eslint.io/rules/no-useless-constructor** for documentation. -## Rule Details +## Examples This rule extends the base [`eslint/no-useless-constructor`](https://eslint.org/docs/rules/no-useless-constructor) rule. It adds support for: diff --git a/packages/eslint-plugin/docs/rules/no-useless-empty-export.md b/packages/eslint-plugin/docs/rules/no-useless-empty-export.md index bf0f2b94ff2..9358e954b3f 100644 --- a/packages/eslint-plugin/docs/rules/no-useless-empty-export.md +++ b/packages/eslint-plugin/docs/rules/no-useless-empty-export.md @@ -6,17 +6,17 @@ description: "Disallow empty exports that don't change anything in a module file > > See **https://typescript-eslint.io/rules/no-useless-empty-export** for documentation. -## Rule Details - An empty `export {}` statement is sometimes useful in TypeScript code to turn a file that would otherwise be a script file into a module file. -Per the TypeScript Handbook [Modules](https://www.typescriptlang.org/docs/handbook/modules.html) page: +Per the [TypeScript Handbook Modules page](https://www.typescriptlang.org/docs/handbook/modules.html): > In TypeScript, just as in ECMAScript 2015, any file containing a top-level import or export is considered a module. > Conversely, a file without any top-level import or export declarations is treated as a script whose contents are available in the global scope (and therefore to modules as well). However, an `export {}` statement does nothing if there are any other top-level import or export statements in a file. -Examples of code for this rule: +This rule reports an `export {}` that doesn't do anything in a file already using ES modules. + +## Examples diff --git a/packages/eslint-plugin/docs/rules/no-var-requires.md b/packages/eslint-plugin/docs/rules/no-var-requires.md index f7c0f8b8fb5..7230e4e8aeb 100644 --- a/packages/eslint-plugin/docs/rules/no-var-requires.md +++ b/packages/eslint-plugin/docs/rules/no-var-requires.md @@ -8,9 +8,7 @@ description: 'Disallow `require` statements except in import statements.' In other words, the use of forms such as `var foo = require("foo")` are banned. Instead use ES6 style imports or `import foo = require("foo")` imports. -## Rule Details - -Examples of code for this rule: +## Examples @@ -32,4 +30,8 @@ import foo from 'foo'; ## When Not To Use It -If you don't care about TypeScript module syntax, then you will not need this rule. +If you don't care about using newer module syntax, then you will not need this rule. + +## Related To + +- [`no-require-imports`](./no-require-imports.md) diff --git a/packages/eslint-plugin/docs/rules/non-nullable-type-assertion-style.md b/packages/eslint-plugin/docs/rules/non-nullable-type-assertion-style.md index c6aaa091324..8f068f062e6 100644 --- a/packages/eslint-plugin/docs/rules/non-nullable-type-assertion-style.md +++ b/packages/eslint-plugin/docs/rules/non-nullable-type-assertion-style.md @@ -6,11 +6,15 @@ description: 'Enforce non-null assertions over explicit type casts.' > > See **https://typescript-eslint.io/rules/non-nullable-type-assertion-style** for documentation. -This rule detects when an `as` cast is doing the same job as a `!` would, and suggests fixing the code to be an `!`. +There are two common ways to assert to TypeScript that a value is its type without `null` or `undefined`: -## Rule Details +- `!`: Non-null assertion +- `as`: Traditional type assertion with a coincidentally equivalent type -Examples of code for this rule: +`!` non-null assertions are generally preferred for requiring less code and being harder to fall out of sync as types change. +This rule reports when an `as` cast is doing the same job as a `!` would, and suggests fixing the code to be an `!`. + +## Examples diff --git a/packages/eslint-plugin/docs/rules/object-curly-spacing.md b/packages/eslint-plugin/docs/rules/object-curly-spacing.md index 9dcf431db32..1b333cae45e 100644 --- a/packages/eslint-plugin/docs/rules/object-curly-spacing.md +++ b/packages/eslint-plugin/docs/rules/object-curly-spacing.md @@ -6,7 +6,7 @@ description: 'Enforce consistent spacing inside braces.' > > See **https://typescript-eslint.io/rules/object-curly-spacing** for documentation. -## Rule Details +## Examples This rule extends the base [`eslint/object-curly-spacing`](https://eslint.org/docs/rules/object-curly-spacing) rule. It adds support for TypeScript's object types. diff --git a/packages/eslint-plugin/docs/rules/padding-line-between-statements.md b/packages/eslint-plugin/docs/rules/padding-line-between-statements.md index d3687c11a22..5387cacac36 100644 --- a/packages/eslint-plugin/docs/rules/padding-line-between-statements.md +++ b/packages/eslint-plugin/docs/rules/padding-line-between-statements.md @@ -6,7 +6,7 @@ description: 'Require or disallow padding lines between statements.' > > See **https://typescript-eslint.io/rules/padding-line-between-statements** for documentation. -## Rule Details +## Examples This rule extends the base [`eslint/padding-line-between-statements`](https://eslint.org/docs/rules/padding-line-between-statements) rule. It adds support for TypeScript constructs such as `interface` and `type`. diff --git a/packages/eslint-plugin/docs/rules/parameter-properties.md b/packages/eslint-plugin/docs/rules/parameter-properties.md index e41e1bbd5df..e0e30ddbd3a 100644 --- a/packages/eslint-plugin/docs/rules/parameter-properties.md +++ b/packages/eslint-plugin/docs/rules/parameter-properties.md @@ -6,13 +6,10 @@ description: 'Require or disallow parameter properties in class constructors.' > > See **https://typescript-eslint.io/rules/parameter-properties** for documentation. -Parameter properties can be confusing to those new to TypeScript as they are less explicit than other ways -of declaring and initializing class members. +TypeScript includes a "parameter properties" shorthand for declaring a class constructor parameter and class property in one location. +Parameter properties can be confusing to those new to TypeScript as they are less explicit than other ways of declaring and initializing class members. -## Rule Details - -This rule disallows the use of parameter properties in constructors, forcing the user to explicitly -declare all properties in the class. +This rule can be configured to always disallow the use of parameter properties or enforce their usage when possible. ## Options diff --git a/packages/eslint-plugin/docs/rules/prefer-as-const.md b/packages/eslint-plugin/docs/rules/prefer-as-const.md index ce930aa3390..628c573044c 100644 --- a/packages/eslint-plugin/docs/rules/prefer-as-const.md +++ b/packages/eslint-plugin/docs/rules/prefer-as-const.md @@ -6,11 +6,15 @@ description: 'Enforce the use of `as const` over literal type.' > > See **https://typescript-eslint.io/rules/prefer-as-const** for documentation. -This rule recommends usage of `const` assertion when type primitive value is equal to type. +There are two common ways to tell TypeScript that a literal value should be interpreted as its literal type (e.g. `2`) rather than general primitive type (e.g. `number`); -## Rule Details +- `as const`: telling TypeScript to infer the literal type automatically +- `as` with the literal type: explicitly telling the literal type to TypeScript -Examples of code for this rule: +`as const` is generally preferred, as it doesn't require re-typing the literal value. +This rule reports when an `as` with an explicit literal type can be replaced with an `as const`. + +## Examples diff --git a/packages/eslint-plugin/docs/rules/prefer-enum-initializers.md b/packages/eslint-plugin/docs/rules/prefer-enum-initializers.md index 08e19754b2b..1c4204b665c 100644 --- a/packages/eslint-plugin/docs/rules/prefer-enum-initializers.md +++ b/packages/eslint-plugin/docs/rules/prefer-enum-initializers.md @@ -6,32 +6,14 @@ description: 'Require each enum member value to be explicitly initialized.' > > See **https://typescript-eslint.io/rules/prefer-enum-initializers** for documentation. -This rule recommends having each `enum`s member value explicitly initialized. +TypeScript `enum`s are a practical way to organize semantically related constant values. +Members of `enum`s that don't have explicit values are by default given sequentially increasing numbers. -`enum`s are a practical way to organize semantically related constant values. However, by implicitly defining values, `enum`s can lead to unexpected bugs if it's modified without paying attention to the order of its items. +In projects where the value of `enum` members are important, allowing implicit values for enums can cause bugs if `enum`s are modified over time. -## Rule Details +This rule recommends having each `enum` member value explicitly initialized. -`enum`s infers sequential numbers automatically when initializers are omitted: - -```ts -enum Status { - Open, // infer 0 - Closed, // infer 1 -} -``` - -If a new member is added to the top of `Status`, both `Open` and `Closed` would have its values altered: - -```ts -enum Status { - Pending, // infer 0 - Open, // infer 1 - Closed, // infer 2 -} -``` - -Examples of code for this rule: +## Examples diff --git a/packages/eslint-plugin/docs/rules/prefer-for-of.md b/packages/eslint-plugin/docs/rules/prefer-for-of.md index 815059bcc9a..83b7846acb0 100644 --- a/packages/eslint-plugin/docs/rules/prefer-for-of.md +++ b/packages/eslint-plugin/docs/rules/prefer-for-of.md @@ -6,39 +6,38 @@ description: 'Enforce the use of `for-of` loop over the standard `for` loop wher > > See **https://typescript-eslint.io/rules/prefer-for-of** for documentation. -This rule recommends a for-of loop when the loop index is only used to read from an array that is being iterated. - -## Rule Details +Many developers default to writing `for (let i = 0; i < ...` loops to iterate over arrays. +However, in many of those arrays, the loop iterator variable (e.g. `i`) is only used to access the respective element of the array. +In those cases, a `for-of` loop is easier to read and write. -For cases where the index is only used to read from the array being iterated, a for-of loop is easier to read and write. +This rule recommends a for-of loop when the loop index is only used to read from an array that is being iterated. -Examples of code for this rule: +## Examples ### ❌ Incorrect ```js -for (let i = 0; i < arr.length; i++) { - console.log(arr[i]); +declare const array: string[]; + +for (let i = 0; i < array.length; i++) { + console.log(array[i]); } ``` ### ✅ Correct ```js -for (const x of arr) { - console.log(x); -} +declare const array: string[]; -for (let i = 0; i < arr.length; i++) { - // i is used to write to arr, so for-of could not be used. - arr[i] = 0; +for (const x of array) { + console.log(x); } -for (let i = 0; i < arr.length; i++) { - // i is used independent of arr, so for-of could not be used. - console.log(i, arr[i]); +for (let i = 0; i < array.length; i++) { + // i is used, so for-of could not be used. + console.log(i, array[i]); } ``` diff --git a/packages/eslint-plugin/docs/rules/prefer-function-type.md b/packages/eslint-plugin/docs/rules/prefer-function-type.md index 1ba1cf22a2c..5ec8490a487 100644 --- a/packages/eslint-plugin/docs/rules/prefer-function-type.md +++ b/packages/eslint-plugin/docs/rules/prefer-function-type.md @@ -6,36 +6,35 @@ description: 'Enforce using function types instead of interfaces with call signa > > See **https://typescript-eslint.io/rules/prefer-function-type** for documentation. -## Rule Details +TypeScript allows for two common ways to declare a type for a function: + +- Function type: `() => string` +- Object type with a signature: `{ (): string }` + +The function type form is generally preferred when possible for being more succinct. This rule suggests using a function type instead of an interface or object type literal with a single call signature. -Examples of code for this rule: +## Examples ### ❌ Incorrect ```ts -interface Foo { +interface Example { (): string; } ``` ```ts -function foo(bar: { (): number }): number { - return bar(); -} -``` - -```ts -interface Foo extends Function { - (): void; +function foo(example: { (): number }): number { + return example(); } ``` ```ts -interface MixinMethod { +interface ReturnsSelf { // returns the function itself, not the `this` argument. (arg: string): this; } @@ -44,12 +43,20 @@ interface MixinMethod { ### ✅ Correct ```ts -interface Foo { - (): void; - bar: number; +type Example = () => string; +``` + +```ts +function foo(example: () => number): number { + return bar(); } ``` +```ts +// returns the function itself, not the `this` argument. +type ReturnsSelf = (arg: string) => ReturnsSelf; +``` + ```ts function foo(bar: { (): string; baz: number }): string { return bar(); @@ -65,13 +72,6 @@ interface Bar extends Foo { } ``` -```ts -// returns the `this` argument of function, retaining it's type. -type MixinMethod = (this: TSelf, arg: string) => TSelf; -// a function that returns itself is much clearer in this form. -type ReturnsSelf = (arg: string) => ReturnsSelf; -``` - ```ts // multiple call signatures (overloads) is allowed: interface Overloaded { diff --git a/packages/eslint-plugin/docs/rules/prefer-includes.md b/packages/eslint-plugin/docs/rules/prefer-includes.md index c06a82d8d64..8c1a709c2de 100644 --- a/packages/eslint-plugin/docs/rules/prefer-includes.md +++ b/packages/eslint-plugin/docs/rules/prefer-includes.md @@ -6,34 +6,28 @@ description: 'Enforce `includes` method over `indexOf` method.' > > See **https://typescript-eslint.io/rules/prefer-includes** for documentation. -Until ES5, we were using `String#indexOf` method to check whether a string contains an arbitrary substring or not. -Until ES2015, we were using `Array#indexOf` method to check whether an array contains an arbitrary value or not. - -ES2015 has added `String#includes` and ES2016 has added `Array#includes`. -It makes code more understandable if we use those `includes` methods for the purpose. - -## Rule Details - -This rule is aimed at suggesting `includes` method if `indexOf` method was used to check whether an object contains an arbitrary value or not. - -If the receiver object of the `indexOf` method call has `includes` method and the two methods have the same parameters, this rule does suggestion. -There are such types: `String`, `Array`, `ReadonlyArray`, and typed arrays. +Prior to ES2015, `Array#indexOf` and `String#indexOf` comparisons against `-1` were the standard ways to check whether a value exists in an array or string, respectively. +Alternatives that are easier to read and write now exist: ES2015 added `String#includes` and ES2016 added `Array#includes`. +This rule reports when an `.indexOf` call can be replaced with an `.includes`. Additionally, this rule reports the tests of simple regular expressions in favor of `String#includes`. -Examples of code for this rule: +> This rule will report on any receiver object of an `indexOf` method call that has an `includes` method where the two methods have the same parameters. +> Matching types include: `String`, `Array`, `ReadonlyArray`, and typed arrays. + +## Examples ### ❌ Incorrect ```ts -let str: string; -let array: any[]; -let readonlyArray: ReadonlyArray; -let typedArray: UInt8Array; -let maybe: string; -let userDefined: { +const str: string; +const array: any[]; +const readonlyArray: ReadonlyArray; +const typedArray: UInt8Array; +const maybe: string; +const userDefined: { indexOf(x: any): number; includes(x: any): boolean; }; @@ -45,32 +39,36 @@ typedArray.indexOf(value) > -1; maybe?.indexOf('') !== -1; userDefined.indexOf(value) >= 0; -// simple RegExp test -/foo/.test(str); +/example/.test(str); ``` ### ✅ Correct ```ts -let array: any[]; -let readonlyArray: ReadonlyArray; -let typedArray: UInt8Array; -let userDefined: { +const str: string; +const array: any[]; +const readonlyArray: ReadonlyArray; +const typedArray: UInt8Array; +const maybe: string; +const userDefined: { indexOf(x: any): number; includes(x: any): boolean; }; -let mismatchExample: { - indexOf(x: any, fromIndex?: number): number; - includes(x: any): boolean; -}; str.includes(value); array.includes(value); readonlyArray.includes(value); typedArray.includes(value); +maybe?.includes(''); userDefined.includes(value); -// the two methods have different parameters. +str.includes('example'); + +// The two methods have different parameters. +declare const mismatchExample: { + indexOf(x: unknown, fromIndex?: number): number; + includes(x: unknown): boolean; +}; mismatchExample.indexOf(value) >= 0; ``` diff --git a/packages/eslint-plugin/docs/rules/prefer-literal-enum-member.md b/packages/eslint-plugin/docs/rules/prefer-literal-enum-member.md index 1bb4d23cc08..2c0bd40a33d 100644 --- a/packages/eslint-plugin/docs/rules/prefer-literal-enum-member.md +++ b/packages/eslint-plugin/docs/rules/prefer-literal-enum-member.md @@ -6,7 +6,9 @@ description: 'Require all enum members to be literal values.' > > See **https://typescript-eslint.io/rules/prefer-literal-enum-member** for documentation. -TypeScript allows the value of an enum member to be many different kinds of valid JavaScript expressions. However, because enums create their own scope whereby each enum member becomes a variable in that scope, unexpected values could be used at runtime. Example: +TypeScript allows the value of an enum member to be many different kinds of valid JavaScript expressions. +However, because enums create their own scope whereby each enum member becomes a variable in that scope, developers are often surprised at the resultant values. +For example: ```ts const imOutside = 2; @@ -21,17 +23,12 @@ enum Foo { } ``` -The answer is that `Foo.c` will be `1` at runtime. The [playground](https://www.typescriptlang.org/play/#src=const%20imOutside%20%3D%202%3B%0D%0Aconst%20b%20%3D%202%3B%0D%0Aenum%20Foo%20%7B%0D%0A%20%20%20%20outer%20%3D%20imOutside%2C%0D%0A%20%20%20%20a%20%3D%201%2C%0D%0A%20%20%20%20b%20%3D%20a%2C%0D%0A%20%20%20%20c%20%3D%20b%2C%0D%0A%20%20%20%20%2F%2F%20does%20c%20%3D%3D%20Foo.b%20%3D%3D%20Foo.c%20%3D%3D%201%3F%0D%0A%20%20%20%20%2F%2F%20or%20does%20c%20%3D%3D%20b%20%3D%3D%202%3F%0D%0A%7D) illustrates this quite nicely. +> The answer is that `Foo.c` will be `1` at runtime [[TypeScript playground](https://www.typescriptlang.org/play/#src=const%20imOutside%20%3D%202%3B%0D%0Aconst%20b%20%3D%202%3B%0D%0Aenum%20Foo%20%7B%0D%0A%20%20%20%20outer%20%3D%20imOutside%2C%0D%0A%20%20%20%20a%20%3D%201%2C%0D%0A%20%20%20%20b%20%3D%20a%2C%0D%0A%20%20%20%20c%20%3D%20b%2C%0D%0A%20%20%20%20%2F%2F%20does%20c%20%3D%3D%20Foo.b%20%3D%3D%20Foo.c%20%3D%3D%201%3F%0D%0A%20%20%20%20%2F%2F%20or%20does%20c%20%3D%3D%20b%20%3D%3D%202%3F%0D%0A%7D)]. -## Rule Details +Therefore, it's often better to prevent unexpected results in code by requiring the use of literal values as enum members. +This rule reports when an enum member is given a value that is not a literal. -This rule is meant to prevent unexpected results in code by requiring the use of literal values as enum members to prevent unexpected runtime behavior. Template literals, arrays, objects, constructors, and all other expression types can end up using a variable from its scope or the parent scope, which can result in the same unexpected behavior at runtime. - -## Options - -- `allowBitwiseExpressions` set to `true` will allow you to use bitwise expressions in enum initializer (Default: `false`). - -Examples of code for this rule: +## Examples @@ -62,13 +59,15 @@ enum Valid { -### `allowBitwiseExpressions` +## Options + +- `allowBitwiseExpressions` set to `true` will allow you to use bitwise expressions in enum initializer (Default: `false`). Examples of code for the `{ "allowBitwiseExpressions": true }` option: -#### ❌ Incorrect +### ❌ Incorrect ```ts const x = 1; @@ -83,7 +82,7 @@ enum Foo { } ``` -#### ✅ Correct +### ✅ Correct ```ts enum Foo { diff --git a/packages/eslint-plugin/docs/rules/prefer-namespace-keyword.md b/packages/eslint-plugin/docs/rules/prefer-namespace-keyword.md index ccb97abbec8..f25b124c776 100644 --- a/packages/eslint-plugin/docs/rules/prefer-namespace-keyword.md +++ b/packages/eslint-plugin/docs/rules/prefer-namespace-keyword.md @@ -6,12 +6,35 @@ description: 'Require using `namespace` keyword over `module` keyword to declare > > See **https://typescript-eslint.io/rules/prefer-namespace-keyword** for documentation. -In an effort to prevent further confusion between custom TypeScript modules and the new ES2015 modules, starting -with TypeScript `v1.5` the keyword `namespace` is now the preferred way to declare custom TypeScript modules. +TypeScript historically allowed a form of code organization called "custom modules" (`module Example {}`), later renamed to "namespaces" (`namespace Example`). -## Rule Details +Namespaces are an outdated way to organize TypeScript code. +ES2015 module syntax is now preferred (`import`/`export`). -This rule aims to standardize the way modules are declared. +For projects still using custom modules / namespaces, it's preferred to refer to them as namespaces. +This rule reports when the `module` keyword is used instead of `namespace`. + +> This rule does not report on the use of TypeScript module declarations to describe external APIs (`declare module 'foo' {}`). + +## Examples + + + +### ❌ Incorrect + +```ts +module Example {} +``` + +### ✅ Correct + +```ts +namespace Example {} + +declare module 'foo' {} +``` + + ## When Not To Use It diff --git a/packages/eslint-plugin/docs/rules/prefer-nullish-coalescing.md b/packages/eslint-plugin/docs/rules/prefer-nullish-coalescing.md index 272240b4d48..d2fc95f4066 100644 --- a/packages/eslint-plugin/docs/rules/prefer-nullish-coalescing.md +++ b/packages/eslint-plugin/docs/rules/prefer-nullish-coalescing.md @@ -6,65 +6,17 @@ description: 'Enforce using the nullish coalescing operator instead of logical c > > See **https://typescript-eslint.io/rules/prefer-nullish-coalescing** for documentation. -TypeScript 3.7 added support for the nullish coalescing operator. -This operator allows you to safely cascade a value when dealing with `null` or `undefined`. +The `??` nullish coalescing runtime operator allows providing a default value when dealing with `null` or `undefined`. +Because the nullish coalescing operator _only_ coalesces when the original value is `null` or `undefined`, it is much safer than relying upon logical OR operator chaining `||`, which coalesces on any _falsy_ value. -```ts -function myFunc(foo: string | null) { - return foo ?? 'a string'; -} - -// is equivalent to - -function myFunc(foo: string | null) { - return foo !== null && foo !== undefined ? foo : 'a string'; -} -``` - -Because the nullish coalescing operator _only_ coalesces when the original value is `null` or `undefined`, it is much safer than relying upon logical OR operator chaining `||`; which coalesces on any _falsy_ value: - -```ts -const emptyString = ''; - -const nullish1 = emptyString ?? 'unsafe'; -const logical1 = emptyString || 'unsafe'; +This rule reports when an `||` operator can be safely replaced with a `??`. -// nullish1 === '' -// logical1 === 'unsafe' - -declare const nullString: string | null; - -const nullish2 = nullString ?? 'safe'; -const logical2 = nullString || 'safe'; - -// nullish2 === 'safe' -// logical2 === 'safe' -``` - -## Rule Details - -This rule aims enforce the usage of the safer operator. +:::caution +This rule will not work as expected if [`strictNullChecks`](https://www.typescriptlang.org/tsconfig#strictNullChecks) is not enabled. +::: ## Options -```ts -type Options = [ - { - ignoreTernaryTests?: boolean; - ignoreConditionalTests?: boolean; - ignoreMixedLogicalExpressions?: boolean; - }, -]; - -const defaultOptions = [ - { - ignoreTernaryTests: true; - ignoreConditionalTests: true, - ignoreMixedLogicalExpressions: true, - }, -]; -``` - ### `ignoreTernaryTests` Setting this option to `true` (the default) will cause the rule to ignore any ternary expressions that could be simplified by using the nullish coalescing operator. diff --git a/packages/eslint-plugin/docs/rules/prefer-optional-chain.md b/packages/eslint-plugin/docs/rules/prefer-optional-chain.md index a0ff0a0ab22..4a9ada8b08f 100644 --- a/packages/eslint-plugin/docs/rules/prefer-optional-chain.md +++ b/packages/eslint-plugin/docs/rules/prefer-optional-chain.md @@ -1,60 +1,18 @@ --- -description: 'Enforce using concise optional chain expressions instead of chained logical ands.' +description: 'Enforce using concise optional chain expressions instead of chained logical ands, negated logical ors, or empty objects.' --- > 🛑 This file is source code, not the primary documentation location! 🛑 > > See **https://typescript-eslint.io/rules/prefer-optional-chain** for documentation. -TypeScript 3.7 added support for the optional chain operator. -This operator allows you to safely access properties and methods on objects when they are potentially `null` or `undefined`. - -```ts -type T = { - a?: { - b?: { - c: string; - method?: () => void; - }; - }; -}; - -function myFunc(foo: T | null) { - return foo?.a?.b?.c; -} -// is roughly equivalent to -function myFunc(foo: T | null) { - return foo && foo.a && foo.a.b && foo.a.b.c; -} -// or -function myFunc(foo: T | null) { - return (((foo || {}).a || {}).b || {}).c; -} - -function myFunc(foo: T | null) { - return foo?.['a']?.b?.c; -} -// is roughly equivalent to -function myFunc(foo: T | null) { - return foo && foo['a'] && foo['a'].b && foo['a'].b.c; -} - -function myFunc(foo: T | null) { - return foo?.a?.b?.method?.(); -} -// is roughly equivalent to -function myFunc(foo: T | null) { - return foo && foo.a && foo.a.b && foo.a.b.method && foo.a.b.method(); -} -``` - +`?.` optional chain expressions provide `undefined` if an object is `null` or `undefined`. Because the optional chain operator _only_ chains when the property value is `null` or `undefined`, it is much safer than relying upon logical AND operator chaining `&&`; which chains on any _truthy_ value. +It is also often less code to use `?.` optional chaining than `&&` truthiness checks. -## Rule Details +This rule reports on code where an `&&` operator can be safely replaced with `?.` optional chaining. -This rule aims enforce the usage of the safer operator. - -Examples of code for this rule: +## Examples @@ -65,9 +23,15 @@ foo && foo.a && foo.a.b && foo.a.b.c; foo && foo['a'] && foo['a'].b && foo['a'].b.c; foo && foo.a && foo.a.b && foo.a.b.method && foo.a.b.method(); +// With empty objects (((foo || {}).a || {}).b || {}).c; (((foo || {})['a'] || {}).b || {}).c; +// With negated `or`s +!foo || !foo.bar; +!foo || !foo[bar]; +!foo || !foo.bar || !foo.bar.baz || !foo.bar.baz(); + // this rule also supports converting chained strict nullish checks: foo && foo.a != null && @@ -85,13 +49,21 @@ foo?.['a']?.b?.c; foo?.a?.b?.method?.(); foo?.a?.b?.c?.d?.e; + +!foo?.bar; +!foo?.[bar]; +!foo?.bar?.baz?.(); ``` -**Note:** there are a few edge cases where this rule will false positive. Use your best judgement when evaluating reported errors. + + +:::note +There are a few edge cases where this rule will false positive. Use your best judgement when evaluating reported errors. +::: ## When Not To Use It -If you are not using TypeScript 3.7 (or greater), then you will not be able to use this rule, as the operator is not supported. +If you don't mind using more explicit `&&`s, you don't need this rule. ## Further Reading diff --git a/packages/eslint-plugin/docs/rules/prefer-readonly-parameter-types.md b/packages/eslint-plugin/docs/rules/prefer-readonly-parameter-types.md index 8a281aa3868..b1e912abe37 100644 --- a/packages/eslint-plugin/docs/rules/prefer-readonly-parameter-types.md +++ b/packages/eslint-plugin/docs/rules/prefer-readonly-parameter-types.md @@ -10,8 +10,6 @@ Mutating function arguments can lead to confusing, hard to debug behavior. Whilst it's easy to implicitly remember to not modify function arguments, explicitly typing arguments as readonly provides clear contract to consumers. This contract makes it easier for a consumer to reason about if a function has side-effects. -## Rule Details - This rule allows you to enforce that function parameters resolve to readonly types. A type is considered readonly if: @@ -21,7 +19,7 @@ A type is considered readonly if: - it is a readonly tuple type whose elements are all considered readonly. - it is an object type whose properties are all marked as readonly, and whose values are all considered readonly. -Examples of code for this rule: +## Examples diff --git a/packages/eslint-plugin/docs/rules/prefer-readonly.md b/packages/eslint-plugin/docs/rules/prefer-readonly.md index c4384e266c3..774b55b39ff 100644 --- a/packages/eslint-plugin/docs/rules/prefer-readonly.md +++ b/packages/eslint-plugin/docs/rules/prefer-readonly.md @@ -6,14 +6,12 @@ description: "Require private members to be marked as `readonly` if they're neve > > See **https://typescript-eslint.io/rules/prefer-readonly** for documentation. -This rule enforces that private members are marked as `readonly` if they're never modified outside of the constructor. - -## Rule Details - Member variables with the privacy `private` are never permitted to be modified outside of their declaring class. If that class never modifies their value, they may safely be marked as `readonly`. -Examples of code for this rule: +This rule reports on private members are marked as `readonly` if they're never modified outside of the constructor. + +## Examples diff --git a/packages/eslint-plugin/docs/rules/prefer-reduce-type-parameter.md b/packages/eslint-plugin/docs/rules/prefer-reduce-type-parameter.md index d66c91ba943..520a25a653b 100644 --- a/packages/eslint-plugin/docs/rules/prefer-reduce-type-parameter.md +++ b/packages/eslint-plugin/docs/rules/prefer-reduce-type-parameter.md @@ -12,18 +12,16 @@ Since these values are empty, their types are not usable: - `[]` has type `never[]`, which can't have items pushed into it as nothing is type `never` - `{}` has type `{}`, which doesn't have an index signature and so can't have properties added to it -A common solution to this problem is to cast the initial value. While this will work, it's not the most optimal -solution as casting has subtle effects on the underlying types that can allow bugs to slip in. +A common solution to this problem is to use an `as` assertion on the initial value. +While this will work, it's not the most optimal solution as type assertions have subtle effects on the underlying types that can allow bugs to slip in. -A better (and lesser known) solution is to pass the type in as a generic parameter to `Array#reduce` explicitly. +A better solution is to pass the type in as a generic type argument to `Array#reduce` explicitly. This means that TypeScript doesn't have to try to infer the type, and avoids the common pitfalls that come with casting. -## Rule Details +This rule looks for calls to `Array#reduce`, and reports if an initial value is being passed & asserted. +It will suggest instead pass the asserted type to `Array#reduce` as a generic type argument. -This rule looks for calls to `Array#reduce`, and warns if an initial value is being passed & casted, -suggesting instead to pass the cast type to `Array#reduce` as its generic parameter. - -Examples of code for this rule: +## Examples diff --git a/packages/eslint-plugin/docs/rules/prefer-regexp-exec.md b/packages/eslint-plugin/docs/rules/prefer-regexp-exec.md index 38cae500fa0..0d9f127be38 100644 --- a/packages/eslint-plugin/docs/rules/prefer-regexp-exec.md +++ b/packages/eslint-plugin/docs/rules/prefer-regexp-exec.md @@ -6,19 +6,14 @@ description: 'Enforce `RegExp#exec` over `String#match` if no global flag is pro > > See **https://typescript-eslint.io/rules/prefer-regexp-exec** for documentation. -As `String#match` is defined to be the same as `RegExp#exec` when the regular expression does not include the `g` flag, prefer a consistent usage. +`String#match` is defined to work the same as `RegExp#exec` when the regular expression does not include the `g` flag. +Keeping to consistently using one of the two can help improve code readability. -## Rule Details +This rule reports when a `String#match` call can be replaced with an equivalent `RegExp#exec`. -This rule is aimed at enforcing a consistent way to apply regular expressions to strings. +> `RegExp#exec` may also be slightly faster than `String#match`; this is the reason to choose it as the preferred usage. -From [`String#match` on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match): - -> If the regular expression does not include the g flag, returns the same result as `RegExp.exec()`. - -`RegExp#exec` may also be slightly faster than `String#match`; this is the reason to choose it as the preferred usage. - -Examples of code for this rule: +## Examples @@ -48,4 +43,4 @@ search.exec(text); ## When Not To Use It -If you prefer consistent use of `String#match` for both, with `g` flag and without it, you can turn this rule off. +If you prefer consistent use of `String#match` for both with `g` flag and without it, you can turn this rule off. diff --git a/packages/eslint-plugin/docs/rules/prefer-return-this-type.md b/packages/eslint-plugin/docs/rules/prefer-return-this-type.md index 836938ee892..b09c03ba52f 100644 --- a/packages/eslint-plugin/docs/rules/prefer-return-this-type.md +++ b/packages/eslint-plugin/docs/rules/prefer-return-this-type.md @@ -6,12 +6,17 @@ description: 'Enforce that `this` is used when only `this` type is returned.' > > See **https://typescript-eslint.io/rules/prefer-return-this-type** for documentation. -[Method chaining](https://en.wikipedia.org/wiki/Method_chaining) is a common pattern in OOP languages and TypeScript provides a special [polymorphic this type](https://www.typescriptlang.org/docs/handbook/2/classes.html#this-types). -If any type other than `this` is specified as the return type of these chaining methods, TypeScript will fail to cast it when invoking in subclass. +[Method chaining](https://en.wikipedia.org/wiki/Method_chaining) is a common pattern in OOP languages and TypeScript provides a special [polymorphic `this` type](https://www.typescriptlang.org/docs/handbook/2/classes.html#this-types) to facilitate it. +Class methods that explicitly declare a return type of the class name instead of `this` make it harder for extending classes to call that method: the returned object will be typed as the base class, not the derived class. + +This rule reports when a class method declares a return type of that class name instead of `this`. ```ts class Animal { eat(): Animal { + // ~~~~~~ + // Either removing this type annotation or replacing + // it with `this` would remove the type error below. console.log("I'm moving!"); return this; } @@ -25,33 +30,13 @@ class Cat extends Animal { } const cat = new Cat(); +cat.eat().meow(); +// ~~~~ // Error: Property 'meow' does not exist on type 'Animal'. // because `eat` returns `Animal` and not all animals meow. -cat.eat().meow(); - -// the error can be fixed by removing the return type of `eat` or use `this` as the return type. -class Animal { - eat(): this { - console.log("I'm moving!"); - return this; - } -} - -class Cat extends Animal { - meow(): this { - console.log('Meow~'); - return this; - } -} - -const cat = new Cat(); -// no errors. Because `eat` returns `Cat` now -cat.eat().meow(); ``` -## Rule Details - -Examples of code for this rule: +## Examples diff --git a/packages/eslint-plugin/docs/rules/prefer-string-starts-ends-with.md b/packages/eslint-plugin/docs/rules/prefer-string-starts-ends-with.md index 99ead1d7934..573ce53ed09 100644 --- a/packages/eslint-plugin/docs/rules/prefer-string-starts-ends-with.md +++ b/packages/eslint-plugin/docs/rules/prefer-string-starts-ends-with.md @@ -7,20 +7,19 @@ description: 'Enforce using `String#startsWith` and `String#endsWith` over other > See **https://typescript-eslint.io/rules/prefer-string-starts-ends-with** for documentation. There are multiple ways to verify if a string starts or ends with a specific string, such as `foo.indexOf('bar') === 0`. -Since ES2015 has added `String#startsWith` and `String#endsWith`, this rule reports other ways to be consistent. +As of ES2015, the most common way in JavaScript is to use `String#startsWith` and `String#endsWith`. +Keeping to those methods consistently helps with code readability. -## Rule Details +This rule reports when a string method can be replaced safely with `String#startsWith` or `String#endsWith`. -This rule is aimed at enforcing a consistent way to check whether a string starts or ends with a specific string. - -Examples of code for this rule: +## Examples ### ❌ Incorrect ```ts -let foo: string; +declare const foo: string; // starts with foo[0] === 'b'; @@ -44,7 +43,12 @@ foo.match(/bar$/) != null; ### ✅ Correct ```ts +declare const foo: string; + +// starts with foo.startsWith('bar'); + +// ends with foo.endsWith('bar'); ``` diff --git a/packages/eslint-plugin/docs/rules/prefer-ts-expect-error.md b/packages/eslint-plugin/docs/rules/prefer-ts-expect-error.md index 85308e4786f..8cc2abb2305 100644 --- a/packages/eslint-plugin/docs/rules/prefer-ts-expect-error.md +++ b/packages/eslint-plugin/docs/rules/prefer-ts-expect-error.md @@ -6,21 +6,15 @@ description: 'Enforce using `@ts-expect-error` over `@ts-ignore`.' > > See **https://typescript-eslint.io/rules/prefer-ts-expect-error** for documentation. -TypeScript allows you to suppress all errors on a line by placing a single-line comment or a comment block line starting with `@ts-ignore` immediately before the erroring line. -While powerful, there is no way to know if a `@ts-ignore` is actually suppressing an error without manually investigating what happens when the `@ts-ignore` is removed. +TypeScript allows you to suppress all errors on a line by placing a comment starting with `@ts-ignore` or `@ts-expect-error` immediately before the erroring line. +The two directives work the same, except `@ts-expect-error` causes a type error if placed before a line that's not erroring in the first place. This means its easy for `@ts-ignore`s to be forgotten about, and remain in code even after the error they were suppressing is fixed. This is dangerous, as if a new error arises on that line it'll be suppressed by the forgotten about `@ts-ignore`, and so be missed. -To address this, TS3.9 ships with a new single-line comment directive: `// @ts-expect-error`. +## Examples -This directive operates in the same manner as `@ts-ignore`, but will error if the line it's meant to be suppressing doesn't actually contain an error, making it a lot safer. - -## Rule Details - -This rule looks for usages of `@ts-ignore`, and flags them to be replaced with `@ts-expect-error`. - -Examples of code for this rule: +This rule reports any usage of `@ts-ignore`, including a fixer to replace with `@ts-expect-error`. @@ -68,7 +62,7 @@ const isOptionEnabled = (key: string): boolean => { ## When Not To Use It -If you are **NOT** using TypeScript 3.9 (or greater), then you will not be able to use this rule, as the directive is not supported +If you are compiling against multiple versions of TypeScript and using `@ts-ignore` to ignore version-specific type errors, this rule might get in your way. ## Further Reading diff --git a/packages/eslint-plugin/docs/rules/promise-function-async.md b/packages/eslint-plugin/docs/rules/promise-function-async.md index 3c6b1922cd5..e697217dc5d 100644 --- a/packages/eslint-plugin/docs/rules/promise-function-async.md +++ b/packages/eslint-plugin/docs/rules/promise-function-async.md @@ -15,7 +15,7 @@ In contrast, non-`async` `Promise` - returning functions are technically capable Code that handles the results of those functions will often need to handle both cases, which can get complex. This rule's practice removes a requirement for creating code to handle both cases. -## Rule Details +## Examples Examples of code for this rule diff --git a/packages/eslint-plugin/docs/rules/quotes.md b/packages/eslint-plugin/docs/rules/quotes.md index 64a5704454c..b67c5dc8966 100644 --- a/packages/eslint-plugin/docs/rules/quotes.md +++ b/packages/eslint-plugin/docs/rules/quotes.md @@ -6,7 +6,7 @@ description: 'Enforce the consistent use of either backticks, double, or single > > See **https://typescript-eslint.io/rules/quotes** for documentation. -## Rule Details +## Examples This rule extends the base [`eslint/quotes`](https://eslint.org/docs/rules/quotes) rule. It adds support for TypeScript features which allow quoted names, but not backtick quoted names. diff --git a/packages/eslint-plugin/docs/rules/require-array-sort-compare.md b/packages/eslint-plugin/docs/rules/require-array-sort-compare.md index e2e43c81143..66b39a004cd 100644 --- a/packages/eslint-plugin/docs/rules/require-array-sort-compare.md +++ b/packages/eslint-plugin/docs/rules/require-array-sort-compare.md @@ -6,30 +6,21 @@ description: 'Require `Array#sort` calls to always provide a `compareFunction`.' > > See **https://typescript-eslint.io/rules/require-array-sort-compare** for documentation. -This rule prevents invoking the `Array#sort()` method without providing a `compare` argument. -When called without a compare function, `Array#sort()` converts all non-undefined array elements into strings and then compares said strings based off their UTF-16 code units. +When called without a compare function, `Array#sort()` converts all non-undefined array elements into strings and then compares said strings based off their UTF-16 code units [[ECMA specification](https://www.ecma-international.org/ecma-262/9.0/#sec-sortcompare)]. The result is that elements are sorted alphabetically, regardless of their type. -When sorting numbers, this results in the classic "10 before 2" order: +For example, when sorting numbers, this results in a "10 before 2" order: ```ts [1, 2, 3, 10, 20, 30].sort(); //→ [1, 10, 2, 20, 3, 30] ``` -This also means that `Array#sort` does not always sort consistently, as elements may have custom `#toString` implementations that are not deterministic; this trap is noted in the language specification thusly: +This rule reports on any call to the `Array#sort()` method that doesn't provide a `compare` argument. -:::note -Method calls performed by the `ToString` abstract operations in steps 5 and 7 have the potential to cause `SortCompare` to not behave as a consistent comparison function. - -https://www.ecma-international.org/ecma-262/9.0/#sec-sortcompare -::: - -## Rule Details +## Examples This rule aims to ensure all calls of the native `Array#sort` method provide a `compareFunction`, while ignoring calls to user-defined `sort` methods. -Examples of code for this rule: - ### ❌ Incorrect @@ -84,4 +75,4 @@ const three = '3'; ## When Not To Use It -If you understand the language specification enough, you can turn this rule off safely. +If you understand the language specification enough, and/or only ever sort arrays in a string-like manner, you can turn this rule off safely. diff --git a/packages/eslint-plugin/docs/rules/require-await.md b/packages/eslint-plugin/docs/rules/require-await.md index a578f0c4b42..f4ccd6fc21a 100644 --- a/packages/eslint-plugin/docs/rules/require-await.md +++ b/packages/eslint-plugin/docs/rules/require-await.md @@ -6,7 +6,7 @@ description: 'Disallow async functions which have no `await` expression.' > > See **https://typescript-eslint.io/rules/require-await** for documentation. -## Rule Details +## Examples This rule extends the base [`eslint/require-await`](https://eslint.org/docs/rules/require-await) rule. It uses type information to add support for `async` functions that return a `Promise`. diff --git a/packages/eslint-plugin/docs/rules/restrict-plus-operands.md b/packages/eslint-plugin/docs/rules/restrict-plus-operands.md index cf08200be7f..fc823f6da9f 100644 --- a/packages/eslint-plugin/docs/rules/restrict-plus-operands.md +++ b/packages/eslint-plugin/docs/rules/restrict-plus-operands.md @@ -1,14 +1,17 @@ --- -description: 'Require both operands of addition to have type `number` or `string`.' +description: 'Require both operands of addition to be the same type and be `bigint`, `number`, or `string`.' --- > 🛑 This file is source code, not the primary documentation location! 🛑 > > See **https://typescript-eslint.io/rules/restrict-plus-operands** for documentation. -## Rule Details +TypeScript allows `+` adding together two values of any type(s). +However, adding values that are not the same type and/or are not the same primitive type is often a sign of programmer error. -Examples of code for this rule: +This rule reports when a `+` operation combines two values of different types, or a type that is not `bigint`, `number`, or `string`. + +## Examples @@ -81,4 +84,15 @@ var fn = (a: any, b: bigint) => a + b; var fn = (a: any, b: number) => a + b; ``` -## How to Use +## When Not To Use It + +If you don't mind `"[object Object]"` in your strings, then you will not need this rule. + +## Related To + +- [`no-base-to-string`](./no-base-to-string.md) +- [`restrict-template-expressions`](./restrict-template-expressions.md) + +## Further Reading + +- [`Object.prototype.toString()` MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString) diff --git a/packages/eslint-plugin/docs/rules/restrict-template-expressions.md b/packages/eslint-plugin/docs/rules/restrict-template-expressions.md index d22b66dac1d..e2d18d8e267 100644 --- a/packages/eslint-plugin/docs/rules/restrict-template-expressions.md +++ b/packages/eslint-plugin/docs/rules/restrict-template-expressions.md @@ -6,9 +6,11 @@ description: 'Enforce template literal expressions to be of `string` type.' > > See **https://typescript-eslint.io/rules/restrict-template-expressions** for documentation. -## Rule Details +JavaScript will call `toString()` on an object when it is converted to a string, such as when `+` adding to a string or in `${}` template literals. +The default Object `.toString()` returns `"[object Object]"`, which is often not what was intended. +This rule reports on values used in a template literal string that aren't primitives and don't define a more useful `.toString()` method. -Examples of code for this rule: +## Examples @@ -87,3 +89,8 @@ const msg1 = `arg = ${arg}`; const arg = /foo/; const msg1 = `arg = ${arg}`; ``` + +## Related To + +- [`no-base-to-string`](./no-base-to-string.md) +- [`restrict-plus-operands`](./restrict-plus-operands.md) diff --git a/packages/eslint-plugin/docs/rules/return-await.md b/packages/eslint-plugin/docs/rules/return-await.md index 13d04d014eb..205c0eb0e8d 100644 --- a/packages/eslint-plugin/docs/rules/return-await.md +++ b/packages/eslint-plugin/docs/rules/return-await.md @@ -8,7 +8,7 @@ description: 'Enforce consistent returning of awaited values.' Returning an awaited promise can make sense for better stack trace information as well as for consistent error handling (returned promises will not be caught in an async function try/catch). -## Rule Details +## Examples This rule builds on top of the [`eslint/no-return-await`](https://eslint.org/docs/rules/no-return-await) rule. It expands upon the base rule to add support for optionally requiring `return await` in certain cases. diff --git a/packages/eslint-plugin/docs/rules/semi.md b/packages/eslint-plugin/docs/rules/semi.md index ee33eca9223..16622a1d856 100644 --- a/packages/eslint-plugin/docs/rules/semi.md +++ b/packages/eslint-plugin/docs/rules/semi.md @@ -8,7 +8,7 @@ description: 'Require or disallow semicolons instead of ASI.' This rule enforces consistent use of semicolons after statements. -## Rule Details +## Examples This rule extends the base [`eslint/semi`](https://eslint.org/docs/rules/semi) rule. It adds support for TypeScript features that require semicolons. diff --git a/packages/eslint-plugin/docs/rules/sort-type-constituents.md b/packages/eslint-plugin/docs/rules/sort-type-constituents.md new file mode 100644 index 00000000000..264ef2b52df --- /dev/null +++ b/packages/eslint-plugin/docs/rules/sort-type-constituents.md @@ -0,0 +1,101 @@ +--- +description: 'Enforce constituents of a type union/intersection to be sorted alphabetically.' +--- + +> 🛑 This file is source code, not the primary documentation location! 🛑 +> +> See **https://typescript-eslint.io/rules/sort-type-constituents** for documentation. + +Sorting union (`|`) and intersection (`&`) types can help: + +- keep your codebase standardized +- find repeated types +- reduce diff churn + +This rule reports on any types that aren't sorted alphabetically. + +> Types are sorted case-insensitively and treating numbers like a human would, falling back to character code sorting in case of ties. + +## Examples + + + +### ❌ Incorrect + +```ts +type T1 = B | A; + +type T2 = { b: string } & { a: string }; + +type T3 = [1, 2, 4] & [1, 2, 3]; + +type T4 = + | [1, 2, 4] + | [1, 2, 3] + | { b: string } + | { a: string } + | (() => void) + | (() => string) + | 'b' + | 'a' + | 'b' + | 'a' + | readonly string[] + | readonly number[] + | string[] + | number[] + | B + | A + | string + | any; +``` + +### ✅ Correct + +```ts +type T1 = A | B; + +type T2 = { a: string } & { b: string }; + +type T3 = [1, 2, 3] & [1, 2, 4]; + +type T4 = + | any + | string + | A + | B + | number[] + | string[] + | readonly number[] + | readonly string[] + | 'a' + | 'b' + | 'a' + | 'b' + | (() => string) + | (() => void) + | { a: string } + | { b: string } + | [1, 2, 3] + | [1, 2, 4]; +``` + +## Options + +### `groupOrder` + +Each constituent of the type is placed into a group, and then the rule sorts alphabetically within each group. +The ordering of groups is determined by this option. + +- `conditional` - Conditional types (`A extends B ? C : D`) +- `function` - Function and constructor types (`() => void`, `new () => type`) +- `import` - Import types (`import('path')`) +- `intersection` - Intersection types (`A & B`) +- `keyword` - Keyword types (`any`, `string`, etc) +- `literal` - Literal types (`1`, `'b'`, `true`, etc) +- `named` - Named types (`A`, `A['prop']`, `B[]`, `Array`) +- `object` - Object types (`{ a: string }`, `{ [key: string]: number }`) +- `operator` - Operator types (`keyof A`, `typeof B`, `readonly C[]`) +- `tuple` - Tuple types (`[A, B, C]`) +- `union` - Union types (`A | B`) +- `nullish` - `null` and `undefined` diff --git a/packages/eslint-plugin/docs/rules/sort-type-union-intersection-members.md b/packages/eslint-plugin/docs/rules/sort-type-union-intersection-members.md index 68b5fce8aca..edaa195df6b 100644 --- a/packages/eslint-plugin/docs/rules/sort-type-union-intersection-members.md +++ b/packages/eslint-plugin/docs/rules/sort-type-union-intersection-members.md @@ -6,30 +6,22 @@ description: 'Enforce members of a type union/intersection to be sorted alphabet > > See **https://typescript-eslint.io/rules/sort-type-union-intersection-members** for documentation. +:::danger Deprecated + +This rule has been renamed to [`sort-type-constituents`](./sort-type-constituents.md). +::: + Sorting union (`|`) and intersection (`&`) types can help: - keep your codebase standardized - find repeated types - reduce diff churn -## Rule Details - -Sorting within each group is done using the following code: - -```ts -const collator = new Intl.Collator('en', { - sensitivity: 'base', - numeric: true, -}); - -function compare(a, b) { - return collator.compare(a, b) || (a < b ? -1 : a > b ? 1 : 0); -} -``` +This rule reports on any types that aren't sorted alphabetically. -In other words, the types are sorted alphabetically, case-insensitively and treating numbers like a human would, falling back to character code sorting in case of ties. +> Types are sorted case-insensitively and treating numbers like a human would, falling back to character code sorting in case of ties. -Examples of code for this rule: +## Examples diff --git a/packages/eslint-plugin/docs/rules/space-before-blocks.md b/packages/eslint-plugin/docs/rules/space-before-blocks.md index daba57a2ec2..716de2294f6 100644 --- a/packages/eslint-plugin/docs/rules/space-before-blocks.md +++ b/packages/eslint-plugin/docs/rules/space-before-blocks.md @@ -6,7 +6,7 @@ description: 'Enforce consistent spacing before blocks.' > > See **https://typescript-eslint.io/rules/space-before-blocks** for documentation. -## Rule Details +## Examples This rule extends the base [`eslint/space-before-blocks`](https://eslint.org/docs/rules/space-before-blocks) rule. It adds support for interfaces and enums. diff --git a/packages/eslint-plugin/docs/rules/space-before-function-paren.md b/packages/eslint-plugin/docs/rules/space-before-function-paren.md index 5760b5128d1..f2c1b5e846c 100644 --- a/packages/eslint-plugin/docs/rules/space-before-function-paren.md +++ b/packages/eslint-plugin/docs/rules/space-before-function-paren.md @@ -6,7 +6,7 @@ description: 'Enforce consistent spacing before function parenthesis.' > > See **https://typescript-eslint.io/rules/space-before-function-paren** for documentation. -## Rule Details +## Examples This rule extends the base [`eslint/space-before-function-paren`](https://eslint.org/docs/rules/space-before-function-paren) rule. It adds support for generic type parameters on function calls. diff --git a/packages/eslint-plugin/docs/rules/strict-boolean-expressions.md b/packages/eslint-plugin/docs/rules/strict-boolean-expressions.md index f25aa3efc1d..b7e8c13a9be 100644 --- a/packages/eslint-plugin/docs/rules/strict-boolean-expressions.md +++ b/packages/eslint-plugin/docs/rules/strict-boolean-expressions.md @@ -21,8 +21,6 @@ The following nodes are considered boolean expressions and their type is checked ## Examples -Examples of code for this rule: - ### ❌ Incorrect diff --git a/packages/eslint-plugin/docs/rules/switch-exhaustiveness-check.md b/packages/eslint-plugin/docs/rules/switch-exhaustiveness-check.md index 4cc7e152e7a..9320624924b 100644 --- a/packages/eslint-plugin/docs/rules/switch-exhaustiveness-check.md +++ b/packages/eslint-plugin/docs/rules/switch-exhaustiveness-check.md @@ -6,11 +6,12 @@ description: 'Require switch-case statements to be exhaustive with union type.' > > See **https://typescript-eslint.io/rules/switch-exhaustiveness-check** for documentation. -Union type may have a lot of parts. It's easy to forget to consider all cases in switch. This rule reminds which parts are missing. If domain of the problem requires to have only a partial switch, developer may _explicitly_ add a default clause. +When working with union types in TypeScript, it's common to want to write a `switch` statement intended to contain a `case` for each constituent (possible type in the union). +However, if the union type changes, it's easy to forget to modify the cases to account for any new types. -## Rule Details +This rule reports when a `switch` statement over a value typed as a union of literals is missing a case for any of those literal types and does not have a `default` clause. -Examples of code for this rule: +## Examples @@ -30,10 +31,9 @@ const day = 'Monday' as Day; let result = 0; switch (day) { - case 'Monday': { + case 'Monday': result = 1; break; - } } ``` @@ -53,34 +53,27 @@ const day = 'Monday' as Day; let result = 0; switch (day) { - case 'Monday': { + case 'Monday': result = 1; break; - } - case 'Tuesday': { + case 'Tuesday': result = 2; break; - } - case 'Wednesday': { + case 'Wednesday': result = 3; break; - } - case 'Thursday': { + case 'Thursday': result = 4; break; - } - case 'Friday': { + case 'Friday': result = 5; break; - } - case 'Saturday': { + case 'Saturday': result = 6; break; - } - case 'Sunday': { + case 'Sunday': result = 7; break; - } } ``` @@ -100,16 +93,14 @@ const day = 'Monday' as Day; let result = 0; switch (day) { - case 'Monday': { + case 'Monday': result = 1; break; - } - default: { + default: result = 42; - } } ``` ## When Not To Use It -If program doesn't have union types with many parts. Downside of this rule is the need for type information, so it's slower than regular rules. +If you don't frequently `switch` over union types with many parts, or intentionally wish to leave out some parts. diff --git a/packages/eslint-plugin/docs/rules/triple-slash-reference.md b/packages/eslint-plugin/docs/rules/triple-slash-reference.md index 75edec3261a..f48f7c98497 100644 --- a/packages/eslint-plugin/docs/rules/triple-slash-reference.md +++ b/packages/eslint-plugin/docs/rules/triple-slash-reference.md @@ -6,9 +6,11 @@ description: 'Disallow certain triple slash directives in favor of ES6-style imp > > See **https://typescript-eslint.io/rules/triple-slash-reference** for documentation. -## Rule Details +TypeScript's `///` triple-slash references are a way to indicate that types from another module are available in a file. +Use of triple-slash reference type directives is generally discouraged in favor of ECMAScript Module `import`s. +This rule reports on the use of `/// `, `/// `, or `/// ` directives. -Use of triple-slash reference type directives is discouraged in favor of the newer `import` style. This rule allows you to ban use of `/// `, `/// `, or `/// ` directives. +## Examples ## Options diff --git a/packages/eslint-plugin/docs/rules/type-annotation-spacing.md b/packages/eslint-plugin/docs/rules/type-annotation-spacing.md index d3a97920072..36cfab06592 100644 --- a/packages/eslint-plugin/docs/rules/type-annotation-spacing.md +++ b/packages/eslint-plugin/docs/rules/type-annotation-spacing.md @@ -35,7 +35,7 @@ type Foo = (string: name)=> string; type Foo = (string: name) =>string; ``` -## Rule Details +## Examples This rule aims to enforce specific spacing patterns around type annotations and function types in type literals. diff --git a/packages/eslint-plugin/docs/rules/typedef.md b/packages/eslint-plugin/docs/rules/typedef.md index 317f9687957..11e2b39c440 100644 --- a/packages/eslint-plugin/docs/rules/typedef.md +++ b/packages/eslint-plugin/docs/rules/typedef.md @@ -9,6 +9,9 @@ description: 'Require type annotations in certain places.' TypeScript cannot always infer types for all places in code. Some locations require type annotations for their types to be inferred. +This rule can enforce type annotations in locations regardless of whether they're required. +This is typically used to maintain consistency for element types that sometimes require them. + ```ts class ContainsText { // There must be a type annotation here to infer the type @@ -22,6 +25,8 @@ class ContainsText { } ``` +> To enforce type definitions existing on call signatures, use [`explicit-function-return-type`](./explicit-function-return-type.md), or [`explicit-module-boundary-types`](./explicit-module-boundary-types.md). + :::caution Requiring type annotations unnecessarily can be cumbersome to maintain and generally reduces code readability. @@ -31,13 +36,6 @@ TypeScript is often better at inferring types than easily written type annotatio ::: -## Rule Details - -This rule can enforce type annotations in locations regardless of whether they're required. -This is typically used to maintain consistency for element types that sometimes require them. - -> To enforce type definitions existing on call signatures, use `explicit-function-return-type`, or `explicit-module-boundary-types`. - ## Options For example, with the following configuration: diff --git a/packages/eslint-plugin/docs/rules/unbound-method.md b/packages/eslint-plugin/docs/rules/unbound-method.md index fe030ad5fac..99dc8ba7963 100644 --- a/packages/eslint-plugin/docs/rules/unbound-method.md +++ b/packages/eslint-plugin/docs/rules/unbound-method.md @@ -6,14 +6,17 @@ description: 'Enforce unbound methods are called with their expected scope.' > > See **https://typescript-eslint.io/rules/unbound-method** for documentation. -Class functions don't preserve the class scope when passed as standalone variables. +Class method functions don't preserve the class scope when passed as standalone variables ("unbound"). If your function does not access `this`, [you can annotate it with `this: void`](https://www.typescriptlang.org/docs/handbook/2/functions.html#declaring-this-in-a-function), or consider using an arrow function instead. +Otherwise, passing class methods around as values can remove type safety by failing to capture `this`. -If you're working with `jest`, you can use [`eslint-plugin-jest`'s version of this rule](https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/unbound-method.md) to lint your test files, which knows when it's ok to pass an unbound method to `expect` calls. +This rule reports when a class method is referenced in an unbound manner. -## Rule Details +:::note Tip +If you're working with `jest`, you can use [`eslint-plugin-jest`'s version of this rule](https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/unbound-method.md) to lint your test files, which knows when it's ok to pass an unbound method to `expect` calls. +::: -Examples of code for this rule with the default options: +## Examples diff --git a/packages/eslint-plugin/docs/rules/unified-signatures.md b/packages/eslint-plugin/docs/rules/unified-signatures.md index ad6bbb917aa..5736561d2ff 100644 --- a/packages/eslint-plugin/docs/rules/unified-signatures.md +++ b/packages/eslint-plugin/docs/rules/unified-signatures.md @@ -6,11 +6,13 @@ description: 'Disallow two overloads that could be unified into one with a union > > See **https://typescript-eslint.io/rules/unified-signatures** for documentation. -## Rule Details +Function overload signatures are a TypeScript way to define a function that can be called in multiple very different ways. +Overload signatures add syntax and theoretical bloat, so it's generally best to avoid using them when possible. +Switching to union types and/or optional or rest parameters can often avoid the need for overload signatures. -This rule aims to keep the source code as maintainable as possible by reducing the amount of overloads. +This rule reports when function overload signatures can be replaced by a single function signature. -Examples of code for this rule with the default options: +## Examples diff --git a/packages/eslint-plugin/jest.config.js b/packages/eslint-plugin/jest.config.js index 910991b20cf..72e29aa600b 100644 --- a/packages/eslint-plugin/jest.config.js +++ b/packages/eslint-plugin/jest.config.js @@ -4,4 +4,5 @@ /** @type {import('@jest/types').Config.InitialOptions} */ module.exports = { ...require('../../jest.config.base.js'), + coveragePathIgnorePatterns: ['src/index.ts$', 'src/configs/.*.ts$'], }; diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index a2898e7adf8..3eecb874ffb 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin", - "version": "5.39.0", + "version": "5.46.1", "description": "TypeScript plugin for ESLint", "keywords": [ "eslint", @@ -37,18 +37,19 @@ "clean": "tsc -b tsconfig.build.json --clean", "postclean": "rimraf dist && rimraf coverage", "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", - "generate:configs": "../../node_modules/.bin/ts-node --files --transpile-only tools/generate-configs.ts", - "generate:rules-lists": "../../node_modules/.bin/ts-node --files --transpile-only tools/generate-rules-lists.ts", - "lint": "eslint . --ignore-path ../../.eslintignore", + "generate:breaking-changes": "../../node_modules/.bin/ts-node tools/generate-breaking-changes.ts", + "generate:configs": "../../node_modules/.bin/ts-node tools/generate-configs.ts", + "lint": "nx lint", "test": "jest --coverage", "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/scope-manager": "5.39.0", - "@typescript-eslint/type-utils": "5.39.0", - "@typescript-eslint/utils": "5.39.0", + "@typescript-eslint/scope-manager": "5.46.1", + "@typescript-eslint/type-utils": "5.46.1", + "@typescript-eslint/utils": "5.46.1", "debug": "^4.3.4", "ignore": "^5.2.0", + "natural-compare-lite": "^1.4.0", "regexpp": "^3.2.0", "semver": "^7.3.7", "tsutils": "^3.21.0" @@ -57,10 +58,13 @@ "@types/debug": "*", "@types/json-schema": "*", "@types/marked": "*", + "@types/natural-compare-lite": "^1.4.0", "@types/prettier": "*", "chalk": "^5.0.1", "grapheme-splitter": "^1.0.4", + "cross-fetch": "^3.1.5", "json-schema": "*", + "markdown-table": "^3.0.2", "marked": "^4.0.15", "prettier": "*", "title-case": "^3.0.3", diff --git a/packages/eslint-plugin/project.json b/packages/eslint-plugin/project.json index d04cdcb07b1..72ca4c7a9d0 100644 --- a/packages/eslint-plugin/project.json +++ b/packages/eslint-plugin/project.json @@ -1,5 +1,15 @@ { - "root": "packages/eslint-plugin", + "name": "eslint-plugin", + "$schema": "../../node_modules/nx/schemas/project-schema.json", "type": "library", - "implicitDependencies": [] + "implicitDependencies": [], + "targets": { + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["packages/eslint-plugin/**/*.ts"] + } + } + } } diff --git a/packages/eslint-plugin/src/configs/all.ts b/packages/eslint-plugin/src/configs/all.ts index 8742d36b208..20ea892f581 100644 --- a/packages/eslint-plugin/src/configs/all.ts +++ b/packages/eslint-plugin/src/configs/all.ts @@ -108,6 +108,7 @@ export = { '@typescript-eslint/no-unsafe-argument': 'error', '@typescript-eslint/no-unsafe-assignment': 'error', '@typescript-eslint/no-unsafe-call': 'error', + '@typescript-eslint/no-unsafe-declaration-merging': 'error', '@typescript-eslint/no-unsafe-member-access': 'error', '@typescript-eslint/no-unsafe-return': 'error', 'no-unused-expressions': 'off', @@ -153,7 +154,7 @@ export = { '@typescript-eslint/return-await': 'error', semi: 'off', '@typescript-eslint/semi': 'error', - '@typescript-eslint/sort-type-union-intersection-members': 'error', + '@typescript-eslint/sort-type-constituents': 'error', 'space-before-blocks': 'off', '@typescript-eslint/space-before-blocks': 'error', 'space-before-function-paren': 'off', diff --git a/packages/eslint-plugin/src/configs/eslint-recommended.ts b/packages/eslint-plugin/src/configs/eslint-recommended.ts index 71443e1f52e..af3c0050c01 100644 --- a/packages/eslint-plugin/src/configs/eslint-recommended.ts +++ b/packages/eslint-plugin/src/configs/eslint-recommended.ts @@ -16,7 +16,7 @@ export = { 'no-dupe-keys': 'off', // ts(1117) 'no-func-assign': 'off', // ts(2539) 'no-import-assign': 'off', // ts(2539) & ts(2540) - 'no-new-symbol': 'off', // ts(2588) + 'no-new-symbol': 'off', // ts(7009) 'no-obj-calls': 'off', // ts(2349) 'no-redeclare': 'off', // ts(2451) 'no-setter-return': 'off', // ts(2408) diff --git a/packages/eslint-plugin/src/configs/strict.ts b/packages/eslint-plugin/src/configs/strict.ts index a9c91f7c1ca..ccd44b85a0a 100644 --- a/packages/eslint-plugin/src/configs/strict.ts +++ b/packages/eslint-plugin/src/configs/strict.ts @@ -27,6 +27,7 @@ export = { '@typescript-eslint/no-unnecessary-boolean-literal-compare': 'warn', '@typescript-eslint/no-unnecessary-condition': 'warn', '@typescript-eslint/no-unnecessary-type-arguments': 'warn', + '@typescript-eslint/no-unsafe-declaration-merging': 'warn', 'no-useless-constructor': 'off', '@typescript-eslint/no-useless-constructor': 'warn', '@typescript-eslint/non-nullable-type-assertion-style': 'warn', diff --git a/packages/eslint-plugin/src/rules/adjacent-overload-signatures.ts b/packages/eslint-plugin/src/rules/adjacent-overload-signatures.ts index 7bf3b6ee052..5f5ddfc0aad 100644 --- a/packages/eslint-plugin/src/rules/adjacent-overload-signatures.ts +++ b/packages/eslint-plugin/src/rules/adjacent-overload-signatures.ts @@ -8,7 +8,8 @@ type RuleNode = | TSESTree.Program | TSESTree.TSModuleBlock | TSESTree.TSTypeLiteral - | TSESTree.TSInterfaceBody; + | TSESTree.TSInterfaceBody + | TSESTree.BlockStatement; type Member = | TSESTree.ClassElement | TSESTree.ProgramStatement @@ -19,7 +20,7 @@ export default util.createRule({ meta: { type: 'suggestion', docs: { - description: 'Require that member overloads be consecutive', + description: 'Require that function overload signatures be consecutive', recommended: 'error', }, schema: [], @@ -121,6 +122,7 @@ export default util.createRule({ case AST_NODE_TYPES.Program: case AST_NODE_TYPES.TSModuleBlock: case AST_NODE_TYPES.TSInterfaceBody: + case AST_NODE_TYPES.BlockStatement: return node.body; case AST_NODE_TYPES.TSTypeLiteral: @@ -172,6 +174,7 @@ export default util.createRule({ TSModuleBlock: checkBodyForOverloadMethods, TSTypeLiteral: checkBodyForOverloadMethods, TSInterfaceBody: checkBodyForOverloadMethods, + BlockStatement: checkBodyForOverloadMethods, }; }, }); diff --git a/packages/eslint-plugin/src/rules/array-type.ts b/packages/eslint-plugin/src/rules/array-type.ts index d8d310f3623..f353207e7d5 100644 --- a/packages/eslint-plugin/src/rules/array-type.ts +++ b/packages/eslint-plugin/src/rules/array-type.ts @@ -90,7 +90,8 @@ export default util.createRule({ meta: { type: 'suggestion', docs: { - description: 'Require using either `T[]` or `Array` for arrays', + description: + 'Require consistently using either `T[]` or `Array` for arrays', recommended: 'strict', }, fixable: 'code', @@ -251,8 +252,7 @@ export default util.createRule({ } const type = typeParams[0]; - const typeParens = - !util.isParenthesized(type, sourceCode) && typeNeedsParentheses(type); + const typeParens = typeNeedsParentheses(type); const parentParens = readonlyPrefix && node.parent?.type === AST_NODE_TYPES.TSArrayType && diff --git a/packages/eslint-plugin/src/rules/ban-ts-comment.ts b/packages/eslint-plugin/src/rules/ban-ts-comment.ts index 7fd20d9c31f..f0bfce93ff6 100644 --- a/packages/eslint-plugin/src/rules/ban-ts-comment.ts +++ b/packages/eslint-plugin/src/rules/ban-ts-comment.ts @@ -43,7 +43,7 @@ export default util.createRule<[Options], MessageIds>({ type: 'problem', docs: { description: - 'Disallow `@ts-` comments or require descriptions after directive', + 'Disallow `@ts-` comments or require descriptions after directives', recommended: 'error', }, messages: { diff --git a/packages/eslint-plugin/src/rules/ban-types.ts b/packages/eslint-plugin/src/rules/ban-types.ts index f94808a50a5..dce41140515 100644 --- a/packages/eslint-plugin/src/rules/ban-types.ts +++ b/packages/eslint-plugin/src/rules/ban-types.ts @@ -86,14 +86,14 @@ const defaultTypes: Types = { Object: { message: [ 'The `Object` type actually means "any non-nullish value", so it is marginally better than `unknown`.', - '- If you want a type meaning "any object", you probably want `Record` instead.', + '- If you want a type meaning "any object", you probably want `object` instead.', '- If you want a type meaning "any value", you probably want `unknown` instead.', ].join('\n'), }, '{}': { message: [ '`{}` actually means "any non-nullish value".', - '- If you want a type meaning "any object", you probably want `Record` instead.', + '- If you want a type meaning "any object", you probably want `object` instead.', '- If you want a type meaning "any value", you probably want `unknown` instead.', '- If you want a type meaning "empty object", you probably want `Record` instead.', ].join('\n'), diff --git a/packages/eslint-plugin/src/rules/brace-style.ts b/packages/eslint-plugin/src/rules/brace-style.ts index c4b052beadd..43d4ba63c3c 100644 --- a/packages/eslint-plugin/src/rules/brace-style.ts +++ b/packages/eslint-plugin/src/rules/brace-style.ts @@ -29,6 +29,7 @@ export default createRule({ defaultOptions: ['1tbs'], create(context) { const [style, { allowSingleLine } = { allowSingleLine: false }] = + // eslint-disable-next-line no-restricted-syntax -- Use raw options for extended rules. context.options; const isAllmanStyle = style === 'allman'; diff --git a/packages/eslint-plugin/src/rules/comma-spacing.ts b/packages/eslint-plugin/src/rules/comma-spacing.ts index 5538fffe4a5..fda50d1b2e4 100644 --- a/packages/eslint-plugin/src/rules/comma-spacing.ts +++ b/packages/eslint-plugin/src/rules/comma-spacing.ts @@ -19,7 +19,7 @@ type MessageIds = 'unexpected' | 'missing'; export default createRule({ name: 'comma-spacing', meta: { - type: 'suggestion', + type: 'layout', docs: { description: 'Enforce consistent spacing before and after commas', recommended: false, diff --git a/packages/eslint-plugin/src/rules/consistent-indexed-object-style.ts b/packages/eslint-plugin/src/rules/consistent-indexed-object-style.ts index 2b260865a4c..535692f3fa8 100644 --- a/packages/eslint-plugin/src/rules/consistent-indexed-object-style.ts +++ b/packages/eslint-plugin/src/rules/consistent-indexed-object-style.ts @@ -1,5 +1,5 @@ import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; -import { AST_NODE_TYPES } from '@typescript-eslint/utils'; +import { AST_NODE_TYPES, ASTUtils } from '@typescript-eslint/utils'; import { createRule } from '../util'; @@ -67,7 +67,7 @@ export default createRule({ if (parentId) { const scope = context.getScope(); - const superVar = scope.set.get(parentId.name); + const superVar = ASTUtils.findVariable(scope, parentId.name); if (superVar) { const isCircular = superVar.references.some( item => diff --git a/packages/eslint-plugin/src/rules/consistent-type-imports.ts b/packages/eslint-plugin/src/rules/consistent-type-imports.ts index 1817018fe7b..a812116f2f8 100644 --- a/packages/eslint-plugin/src/rules/consistent-type-imports.ts +++ b/packages/eslint-plugin/src/rules/consistent-type-imports.ts @@ -4,11 +4,13 @@ import { AST_NODE_TYPES, AST_TOKEN_TYPES } from '@typescript-eslint/utils'; import * as util from '../util'; type Prefer = 'type-imports' | 'no-type-imports'; +type FixStyle = 'separate-type-imports' | 'inline-type-imports'; type Options = [ { prefer?: Prefer; disallowTypeAnnotations?: boolean; + fixStyle?: FixStyle; }, ]; @@ -19,6 +21,8 @@ interface SourceImports { typeOnlyNamedImport: TSESTree.ImportDeclaration | null; // ImportDeclaration for value-only import only with named imports. valueOnlyNamedImport: TSESTree.ImportDeclaration | null; + // ImportDeclaration for value-only import only with default imports and/or named imports. + valueImport: TSESTree.ImportDeclaration | null; } interface ReportValueImport { node: TSESTree.ImportDeclaration; @@ -79,6 +83,9 @@ export default util.createRule({ disallowTypeAnnotations: { type: 'boolean', }, + fixStyle: { + enum: ['separate-type-imports', 'inline-type-imports'], + }, }, additionalProperties: false, }, @@ -90,12 +97,14 @@ export default util.createRule({ { prefer: 'type-imports', disallowTypeAnnotations: true, + fixStyle: 'separate-type-imports', }, ], create(context, [option]) { const prefer = option.prefer ?? 'type-imports'; const disallowTypeAnnotations = option.disallowTypeAnnotations !== false; + const fixStyle = option.fixStyle ?? 'separate-type-imports'; const sourceCode = context.getSourceCode(); const sourceImportsMap: { [key: string]: SourceImports } = {}; @@ -106,13 +115,15 @@ export default util.createRule({ // prefer type imports ImportDeclaration(node): void { const source = node.source.value; + // sourceImports is the object containing all the specifics for a particular import source, type or value const sourceImports = sourceImportsMap[source] ?? (sourceImportsMap[source] = { source, - reportValueImports: [], - typeOnlyNamedImport: null, - valueOnlyNamedImport: null, + reportValueImports: [], // if there is a mismatch where type importKind but value specifiers + typeOnlyNamedImport: null, // if only type imports + valueOnlyNamedImport: null, // if only value imports with named specifiers + valueImport: null, // if only value imports }); if (node.importKind === 'type') { if ( @@ -122,6 +133,7 @@ export default util.createRule({ specifier.type === AST_NODE_TYPES.ImportSpecifier, ) ) { + // definitely import type { TypeX } sourceImports.typeOnlyNamedImport = node; } } else { @@ -133,6 +145,15 @@ export default util.createRule({ ) ) { sourceImports.valueOnlyNamedImport = node; + sourceImports.valueImport = node; + } else if ( + !sourceImports.valueImport && + node.specifiers.some( + specifier => + specifier.type === AST_NODE_TYPES.ImportDefaultSpecifier, + ) + ) { + sourceImports.valueImport = node; } } @@ -243,14 +264,15 @@ export default util.createRule({ 'Program:exit'(): void { for (const sourceImports of Object.values(sourceImportsMap)) { if (sourceImports.reportValueImports.length === 0) { + // nothing to fix. value specifiers and type specifiers are correctly written continue; } for (const report of sourceImports.reportValueImports) { if ( report.valueSpecifiers.length === 0 && - report.unusedSpecifiers.length === 0 + report.unusedSpecifiers.length === 0 && + report.node.importKind !== 'type' ) { - // import is all type-only, convert the entire import to `import type` context.report({ node: report.node, messageId: 'typeOverValue', @@ -265,12 +287,13 @@ export default util.createRule({ } else { const isTypeImport = report.node.importKind === 'type'; - // we have a mixed type/value import, so we need to split them out into multiple exports + // we have a mixed type/value import or just value imports, so we need to split them out into multiple imports if separate-type-imports is configured const importNames = ( isTypeImport - ? report.valueSpecifiers + ? report.valueSpecifiers // import type { A } from 'roo'; // WHERE A is used in value position : report.typeSpecifiers - ).map(specifier => `"${specifier.local.name}"`); + ) // import { A, B } from 'roo'; // WHERE A is used in type position and B is in value position + .map(specifier => `"${specifier.local.name}"`); const message = ((): { messageId: MessageIds; @@ -294,12 +317,12 @@ export default util.createRule({ if (isTypeImport) { return { messageId: 'someImportsInDecoMeta', - data: { typeImports }, + data: { typeImports }, // typeImports are all the value specifiers that are in the type position }; } else { return { messageId: 'someImportsAreOnlyTypes', - data: { typeImports }, + data: { typeImports }, // typeImports are all the type specifiers in the value position }; } } @@ -310,12 +333,14 @@ export default util.createRule({ ...message, *fix(fixer) { if (isTypeImport) { + // take all the valueSpecifiers and put them on a new line yield* fixToValueImportDeclaration( fixer, report, sourceImports, ); } else { + // take all the typeSpecifiers and put them on a new line yield* fixToTypeImportDeclaration( fixer, report, @@ -396,12 +421,12 @@ export default util.createRule({ } /** - * Returns information for fixing named specifiers. + * Returns information for fixing named specifiers, type or value */ function getFixesNamedSpecifiers( fixer: TSESLint.RuleFixer, node: TSESTree.ImportDeclaration, - typeNamedSpecifiers: TSESTree.ImportSpecifier[], + subsetNamedSpecifiers: TSESTree.ImportSpecifier[], allNamedSpecifiers: TSESTree.ImportSpecifier[], ): { typeNamedSpecifiersText: string; @@ -415,12 +440,12 @@ export default util.createRule({ } const typeNamedSpecifiersTexts: string[] = []; const removeTypeNamedSpecifiers: TSESLint.RuleFix[] = []; - if (typeNamedSpecifiers.length === allNamedSpecifiers.length) { + if (subsetNamedSpecifiers.length === allNamedSpecifiers.length) { // import Foo, {Type1, Type2} from 'foo' // import DefType, {Type1, Type2} from 'foo' const openingBraceToken = util.nullThrows( sourceCode.getTokenBefore( - typeNamedSpecifiers[0], + subsetNamedSpecifiers[0], util.isOpeningBraceToken, ), util.NullThrowsReasons.MissingToken('{', node.type), @@ -451,20 +476,20 @@ export default util.createRule({ ), ); } else { - const typeNamedSpecifierGroups: TSESTree.ImportSpecifier[][] = []; + const namedSpecifierGroups: TSESTree.ImportSpecifier[][] = []; let group: TSESTree.ImportSpecifier[] = []; for (const namedSpecifier of allNamedSpecifiers) { - if (typeNamedSpecifiers.includes(namedSpecifier)) { + if (subsetNamedSpecifiers.includes(namedSpecifier)) { group.push(namedSpecifier); } else if (group.length) { - typeNamedSpecifierGroups.push(group); + namedSpecifierGroups.push(group); group = []; } } if (group.length) { - typeNamedSpecifierGroups.push(group); + namedSpecifierGroups.push(group); } - for (const namedSpecifiers of typeNamedSpecifierGroups) { + for (const namedSpecifiers of namedSpecifierGroups) { const { removeRange, textRange } = getNamedSpecifierRanges( namedSpecifiers, allNamedSpecifiers, @@ -541,7 +566,53 @@ export default util.createRule({ if (!util.isCommaToken(before) && !util.isOpeningBraceToken(before)) { insertText = `,${insertText}`; } - return fixer.insertTextBefore(closingBraceToken, `${insertText}`); + return fixer.insertTextBefore(closingBraceToken, insertText); + } + + /** + * insert type keyword to named import node. + * e.g. + * import ADefault, { Already, type Type1, type Type2 } from 'foo' + * ^^^^ insert + */ + function* fixInsertTypeKeywordInNamedSpecifierList( + fixer: TSESLint.RuleFixer, + typeSpecifiers: TSESTree.ImportSpecifier[], + ): IterableIterator { + for (const spec of typeSpecifiers) { + const insertText = sourceCode.text.slice(...spec.range); + yield fixer.replaceTextRange(spec.range, `type ${insertText}`); + } + } + + function* fixInlineTypeImportDeclaration( + fixer: TSESLint.RuleFixer, + report: ReportValueImport, + sourceImports: SourceImports, + ): IterableIterator { + const { node } = report; + // For a value import, will only add an inline type to named specifiers + const { namedSpecifiers } = classifySpecifier(node); + const typeNamedSpecifiers = namedSpecifiers.filter(specifier => + report.typeSpecifiers.includes(specifier), + ); + + if (sourceImports.valueImport) { + // add import named type specifiers to its value import + // import ValueA, { type A } + // ^^^^ insert + const { namedSpecifiers: valueImportNamedSpecifiers } = + classifySpecifier(sourceImports.valueImport); + if ( + sourceImports.valueOnlyNamedImport || + valueImportNamedSpecifiers.length + ) { + yield* fixInsertTypeKeywordInNamedSpecifierList( + fixer, + typeNamedSpecifiers, + ); + } + } } function* fixToTypeImportDeclaration( @@ -567,13 +638,31 @@ export default util.createRule({ // import Type from 'foo' yield* fixInsertTypeSpecifierForImportDeclaration(fixer, node, true); return; + } else if ( + fixStyle === 'inline-type-imports' && + !report.typeSpecifiers.includes(defaultSpecifier) && + namedSpecifiers.length > 0 && + !namespaceSpecifier + ) { + // if there is a default specifier but it isn't a type specifier, then just add the inline type modifier to the named specifiers + // import AValue, {BValue, Type1, Type2} from 'foo' + yield* fixInlineTypeImportDeclaration(fixer, report, sourceImports); + return; } - } else { + } else if (!namespaceSpecifier) { if ( + fixStyle === 'inline-type-imports' && + namedSpecifiers.some(specifier => + report.typeSpecifiers.includes(specifier), + ) + ) { + // import {AValue, Type1, Type2} from 'foo' + yield* fixInlineTypeImportDeclaration(fixer, report, sourceImports); + return; + } else if ( namedSpecifiers.every(specifier => report.typeSpecifiers.includes(specifier), - ) && - !namespaceSpecifier + ) ) { // import {Type1, Type2} from 'foo' yield* fixInsertTypeSpecifierForImportDeclaration(fixer, node, false); @@ -606,12 +695,25 @@ export default util.createRule({ afterFixes.push(insertTypeNamedSpecifiers); } } else { - yield fixer.insertTextBefore( - node, - `import type {${ - fixesNamedSpecifiers.typeNamedSpecifiersText - }} from ${sourceCode.getText(node.source)};\n`, - ); + // The import is both default and named. Insert named on new line because can't mix default type import and named type imports + if (fixStyle === 'inline-type-imports') { + yield fixer.insertTextBefore( + node, + `import {${typeNamedSpecifiers + .map(spec => { + const insertText = sourceCode.text.slice(...spec.range); + return `type ${insertText}`; + }) + .join(', ')}} from ${sourceCode.getText(node.source)};\n`, + ); + } else { + yield fixer.insertTextBefore( + node, + `import type {${ + fixesNamedSpecifiers.typeNamedSpecifiersText + }} from ${sourceCode.getText(node.source)};\n`, + ); + } } } @@ -736,8 +838,6 @@ export default util.createRule({ closingBraceToken.range[1], ); if (node.specifiers.length > 1) { - // import type Foo from 'foo' - // import type {...} from 'foo' // <- insert yield fixer.insertTextAfter( node, `\nimport type${specifiersText} from ${sourceCode.getText( @@ -794,6 +894,9 @@ export default util.createRule({ } } + // we have some valueSpecifiers intermixed in types that need to be put on their own line + // import type { Type1, A } from 'foo' + // import type { A } from 'foo' const valueNamedSpecifiers = namedSpecifiers.filter(specifier => report.valueSpecifiers.includes(specifier), ); @@ -819,6 +922,8 @@ export default util.createRule({ afterFixes.push(insertTypeNamedSpecifiers); } } else { + // some are types. + // Add new value import and later remove those value specifiers from import type yield fixer.insertTextBefore( node, `import {${ @@ -862,6 +967,8 @@ export default util.createRule({ fixer: TSESLint.RuleFixer, node: TSESTree.ImportSpecifier, ): IterableIterator { + // import { type Foo } from 'foo' + // ^^^^ remove const typeToken = util.nullThrows( sourceCode.getFirstToken(node, isTypeToken), util.NullThrowsReasons.MissingToken('type', node.type), diff --git a/packages/eslint-plugin/src/rules/index.ts b/packages/eslint-plugin/src/rules/index.ts index 29a47ec2384..8a3c2bbf437 100644 --- a/packages/eslint-plugin/src/rules/index.ts +++ b/packages/eslint-plugin/src/rules/index.ts @@ -78,6 +78,7 @@ import noUnnecessaryTypeConstraint from './no-unnecessary-type-constraint'; import noUnsafeArgument from './no-unsafe-argument'; import noUnsafeAssignment from './no-unsafe-assignment'; import noUnsafeCall from './no-unsafe-call'; +import noUnsafeDeclarationMerging from './no-unsafe-declaration-merging'; import noUnsafeMemberAccess from './no-unsafe-member-access'; import noUnsafeReturn from './no-unsafe-return'; import noUnusedExpressions from './no-unused-expressions'; @@ -114,6 +115,7 @@ import restrictPlusOperands from './restrict-plus-operands'; import restrictTemplateExpressions from './restrict-template-expressions'; import returnAwait from './return-await'; import semi from './semi'; +import sortTypeConstituents from './sort-type-constituents'; import sortTypeUnionIntersectionMembers from './sort-type-union-intersection-members'; import spaceBeforeBlocks from './space-before-blocks'; import spaceBeforeFunctionParen from './space-before-function-paren'; @@ -207,6 +209,7 @@ export default { 'no-unsafe-argument': noUnsafeArgument, 'no-unsafe-assignment': noUnsafeAssignment, 'no-unsafe-call': noUnsafeCall, + 'no-unsafe-declaration-merging': noUnsafeDeclarationMerging, 'no-unsafe-member-access': noUnsafeMemberAccess, 'no-unsafe-return': noUnsafeReturn, 'no-unused-expressions': noUnusedExpressions, @@ -243,6 +246,7 @@ export default { 'restrict-template-expressions': restrictTemplateExpressions, 'return-await': returnAwait, semi: semi, + 'sort-type-constituents': sortTypeConstituents, 'sort-type-union-intersection-members': sortTypeUnionIntersectionMembers, 'space-before-blocks': spaceBeforeBlocks, 'space-before-function-paren': spaceBeforeFunctionParen, diff --git a/packages/eslint-plugin/src/rules/keyword-spacing.ts b/packages/eslint-plugin/src/rules/keyword-spacing.ts index bcb90573836..aa09fb3d1b8 100644 --- a/packages/eslint-plugin/src/rules/keyword-spacing.ts +++ b/packages/eslint-plugin/src/rules/keyword-spacing.ts @@ -1,4 +1,5 @@ -import { AST_TOKEN_TYPES } from '@typescript-eslint/utils'; +import type { TSESTree } from '@typescript-eslint/utils'; +import { AST_NODE_TYPES, AST_TOKEN_TYPES } from '@typescript-eslint/utils'; import * as util from '../util'; import { getESLintCoreRule } from '../util/getESLintCoreRule'; @@ -8,6 +9,25 @@ const baseRule = getESLintCoreRule('keyword-spacing'); export type Options = util.InferOptionsTypeFromRule; export type MessageIds = util.InferMessageIdsTypeFromRule; +// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment +const baseSchema = Array.isArray(baseRule.meta.schema) + ? baseRule.meta.schema[0] + : baseRule.meta.schema; +const schema = util.deepMerge( + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument -- https://github.com/microsoft/TypeScript/issues/17002 + baseSchema, + { + properties: { + overrides: { + properties: { + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access + type: baseSchema.properties.overrides.properties.import, + }, + }, + }, + }, +); + export default util.createRule({ name: 'keyword-spacing', meta: { @@ -19,12 +39,12 @@ export default util.createRule({ }, fixable: 'whitespace', hasSuggestions: baseRule.meta.hasSuggestions, - schema: baseRule.meta.schema, + schema: [schema], messages: baseRule.meta.messages, }, defaultOptions: [{}], - create(context) { + create(context, [{ after, overrides }]) { const sourceCode = context.getSourceCode(); const baseRules = baseRule.create(context); return { @@ -50,6 +70,49 @@ export default util.createRule({ // make sure to reset the type afterward so we don't permanently mutate the AST asToken.type = oldTokenType; }, + 'ImportDeclaration[importKind=type]'( + node: TSESTree.ImportDeclaration, + ): void { + const { type: typeOptionOverride = {} } = overrides ?? {}; + const typeToken = sourceCode.getFirstToken(node, { skip: 1 })!; + const punctuatorToken = sourceCode.getTokenAfter(typeToken)!; + if ( + node.specifiers?.[0]?.type === AST_NODE_TYPES.ImportDefaultSpecifier + ) { + return; + } + const spacesBetweenTypeAndPunctuator = + punctuatorToken.range[0] - typeToken.range[1]; + if ( + (typeOptionOverride.after ?? after) === true && + spacesBetweenTypeAndPunctuator === 0 + ) { + context.report({ + loc: typeToken.loc, + messageId: 'expectedAfter', + data: { value: 'type' }, + fix(fixer) { + return fixer.insertTextAfter(typeToken, ' '); + }, + }); + } + if ( + (typeOptionOverride.after ?? after) === false && + spacesBetweenTypeAndPunctuator > 0 + ) { + context.report({ + loc: typeToken.loc, + messageId: 'unexpectedAfter', + data: { value: 'type' }, + fix(fixer) { + return fixer.removeRange([ + typeToken.range[1], + typeToken.range[1] + spacesBetweenTypeAndPunctuator, + ]); + }, + }); + } + }, }; }, }); diff --git a/packages/eslint-plugin/src/rules/member-delimiter-style.ts b/packages/eslint-plugin/src/rules/member-delimiter-style.ts index 4ae205967ce..53d2019e97d 100644 --- a/packages/eslint-plugin/src/rules/member-delimiter-style.ts +++ b/packages/eslint-plugin/src/rules/member-delimiter-style.ts @@ -135,13 +135,13 @@ const makeFixFunction = ({ export default util.createRule({ name: 'member-delimiter-style', meta: { - type: 'suggestion', + type: 'layout', docs: { description: 'Require a specific member delimiter style for interfaces and type literals', recommended: false, }, - fixable: 'code', + fixable: 'whitespace', messages: { unexpectedComma: 'Unexpected separator (,).', unexpectedSemi: 'Unexpected separator (;).', diff --git a/packages/eslint-plugin/src/rules/member-ordering.ts b/packages/eslint-plugin/src/rules/member-ordering.ts index 66fe9b62334..87022f16f4f 100644 --- a/packages/eslint-plugin/src/rules/member-ordering.ts +++ b/packages/eslint-plugin/src/rules/member-ordering.ts @@ -1,9 +1,13 @@ import type { JSONSchema, TSESLint, TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; +import naturalCompare from 'natural-compare-lite'; import * as util from '../util'; -export type MessageIds = 'incorrectGroupOrder' | 'incorrectOrder'; +export type MessageIds = + | 'incorrectGroupOrder' + | 'incorrectOrder' + | 'incorrectRequiredMembersOrder'; type MemberKind = | 'call-signature' @@ -21,32 +25,40 @@ type NonCallableMemberKind = Exclude; type MemberScope = 'static' | 'instance' | 'abstract'; +type Accessibility = TSESTree.Accessibility | '#private'; + type BaseMemberType = | MemberKind - | `${TSESTree.Accessibility}-${Exclude< + | `${Accessibility}-${Exclude< MemberKind, 'signature' | 'static-initialization' >}` - | `${TSESTree.Accessibility}-decorated-${DecoratedMemberKind}` + | `${Accessibility}-decorated-${DecoratedMemberKind}` | `decorated-${DecoratedMemberKind}` - | `${TSESTree.Accessibility}-${MemberScope}-${NonCallableMemberKind}` + | `${Accessibility}-${MemberScope}-${NonCallableMemberKind}` | `${MemberScope}-${NonCallableMemberKind}`; type MemberType = BaseMemberType | BaseMemberType[]; -type Order = +type AlphabeticalOrder = | 'alphabetically' | 'alphabetically-case-insensitive' - | 'as-written'; + | 'natural' + | 'natural-case-insensitive'; + +type Order = AlphabeticalOrder | 'as-written'; interface SortedOrderConfig { memberTypes?: MemberType[] | 'never'; + optionalityOrder?: OptionalityOrder; order: Order; } type OrderConfig = MemberType[] | SortedOrderConfig | 'never'; type Member = TSESTree.ClassElement | TSESTree.TypeElement; +type OptionalityOrder = 'optional-first' | 'required-first'; + export type Options = [ { default?: OrderConfig; @@ -87,7 +99,17 @@ const objectConfig = (memberTypes: MemberType[]): JSONSchema.JSONSchema4 => ({ }, order: { type: 'string', - enum: ['alphabetically', 'alphabetically-case-insensitive', 'as-written'], + enum: [ + 'alphabetically', + 'alphabetically-case-insensitive', + 'as-written', + 'natural', + 'natural-case-insensitive', + ], + }, + optionalityOrder: { + type: 'string', + enum: ['optional-first', 'required-first'], }, }, additionalProperties: false, @@ -102,6 +124,7 @@ export const defaultOrder: MemberType[] = [ 'public-static-field', 'protected-static-field', 'private-static-field', + '#private-static-field', 'public-decorated-field', 'protected-decorated-field', @@ -110,14 +133,15 @@ export const defaultOrder: MemberType[] = [ 'public-instance-field', 'protected-instance-field', 'private-instance-field', + '#private-instance-field', 'public-abstract-field', 'protected-abstract-field', - 'private-abstract-field', 'public-field', 'protected-field', 'private-field', + '#private-field', 'static-field', 'instance-field', @@ -141,6 +165,7 @@ export const defaultOrder: MemberType[] = [ 'public-static-get', 'protected-static-get', 'private-static-get', + '#private-static-get', 'public-decorated-get', 'protected-decorated-get', @@ -149,14 +174,15 @@ export const defaultOrder: MemberType[] = [ 'public-instance-get', 'protected-instance-get', 'private-instance-get', + '#private-instance-get', 'public-abstract-get', 'protected-abstract-get', - 'private-abstract-get', 'public-get', 'protected-get', 'private-get', + '#private-get', 'static-get', 'instance-get', @@ -170,6 +196,7 @@ export const defaultOrder: MemberType[] = [ 'public-static-set', 'protected-static-set', 'private-static-set', + '#private-static-set', 'public-decorated-set', 'protected-decorated-set', @@ -178,14 +205,15 @@ export const defaultOrder: MemberType[] = [ 'public-instance-set', 'protected-instance-set', 'private-instance-set', + '#private-instance-set', 'public-abstract-set', 'protected-abstract-set', - 'private-abstract-set', 'public-set', 'protected-set', 'private-set', + '#private-set', 'static-set', 'instance-set', @@ -199,6 +227,7 @@ export const defaultOrder: MemberType[] = [ 'public-static-method', 'protected-static-method', 'private-static-method', + '#private-static-method', 'public-decorated-method', 'protected-decorated-method', @@ -207,14 +236,15 @@ export const defaultOrder: MemberType[] = [ 'public-instance-method', 'protected-instance-method', 'private-instance-method', + '#private-instance-method', 'public-abstract-method', 'protected-abstract-method', - 'private-abstract-method', 'public-method', 'protected-method', 'private-method', + '#private-method', 'static-method', 'instance-method', @@ -240,30 +270,49 @@ const allMemberTypes = Array.from( ).reduce>((all, type) => { all.add(type); - (['public', 'protected', 'private'] as const).forEach(accessibility => { - if (type !== 'signature' && type !== 'static-initialization') { - all.add(`${accessibility}-${type}`); // e.g. `public-field` - } + (['public', 'protected', 'private', '#private'] as const).forEach( + accessibility => { + if ( + type !== 'signature' && + type !== 'static-initialization' && + type !== 'call-signature' && + !(type === 'constructor' && accessibility === '#private') + ) { + all.add(`${accessibility}-${type}`); // e.g. `public-field` + } - // Only class instance fields, methods, get and set can have decorators attached to them - if ( - type === 'field' || - type === 'method' || - type === 'get' || - type === 'set' - ) { - all.add(`${accessibility}-decorated-${type}`); - all.add(`decorated-${type}`); - } + // Only class instance fields, methods, get and set can have decorators attached to them + if ( + accessibility !== '#private' && + (type === 'field' || + type === 'method' || + type === 'get' || + type === 'set') + ) { + all.add(`${accessibility}-decorated-${type}`); + all.add(`decorated-${type}`); + } - if (type !== 'constructor' && type !== 'signature') { - // There is no `static-constructor` or `instance-constructor` or `abstract-constructor` - (['static', 'instance', 'abstract'] as const).forEach(scope => { - all.add(`${scope}-${type}`); - all.add(`${accessibility}-${scope}-${type}`); - }); - } - }); + if ( + type !== 'constructor' && + type !== 'signature' && + type !== 'call-signature' + ) { + // There is no `static-constructor` or `instance-constructor` or `abstract-constructor` + if (accessibility === '#private' || accessibility === 'private') { + (['static', 'instance'] as const).forEach(scope => { + all.add(`${scope}-${type}`); + all.add(`${accessibility}-${scope}-${type}`); + }); + } else { + (['static', 'instance', 'abstract'] as const).forEach(scope => { + all.add(`${scope}-${type}`); + all.add(`${accessibility}-${scope}-${type}`); + }); + } + } + }, + ); return all; }, new Set()), @@ -366,6 +415,26 @@ function getMemberName( } } +/** + * Returns true if the member is optional based on the member type. + * + * @param node the node to be evaluated. + * + * @returns Whether the member is optional, or false if it cannot be optional at all. + */ +function isMemberOptional(node: Member): boolean { + switch (node.type) { + case AST_NODE_TYPES.TSPropertySignature: + case AST_NODE_TYPES.TSMethodSignature: + case AST_NODE_TYPES.TSAbstractPropertyDefinition: + case AST_NODE_TYPES.PropertyDefinition: + case AST_NODE_TYPES.TSAbstractMethodDefinition: + case AST_NODE_TYPES.MethodDefinition: + return !!node.optional; + } + return false; +} + /** * Gets the calculated rank using the provided method definition. * The algorithm is as follows: @@ -397,6 +466,16 @@ function getRankOrder( return rank; } +function getAccessibility(node: Member): Accessibility { + if ('accessibility' in node && node.accessibility) { + return node.accessibility; + } + if ('key' in node && node.key?.type === AST_NODE_TYPES.PrivateIdentifier) { + return '#private'; + } + return 'public'; +} + /** * Gets the rank of the node given the order. * @param node the node to be evaluated. @@ -425,10 +504,7 @@ function getRank( : abstract ? 'abstract' : 'instance'; - const accessibility = - 'accessibility' in node && node.accessibility - ? node.accessibility - : 'public'; + const accessibility = getAccessibility(node); // Collect all existing member groups that apply to this node... // (e.g. 'public-instance-field', 'instance-field', 'public-field', 'constructor' etc.) @@ -515,6 +591,7 @@ export default util.createRule({ 'Member {{member}} should be declared before member {{beforeMember}}.', incorrectGroupOrder: 'Member {{name}} should be declared before all {{rank}} definitions.', + incorrectRequiredMembersOrder: `Member {{member}} should be declared after all {{optionalOrRequired}} members.`, }, schema: [ { @@ -629,7 +706,7 @@ export default util.createRule({ */ function checkAlphaSort( members: Member[], - caseSensitive: boolean, + order: AlphabeticalOrder, ): boolean { let previousName = ''; let isCorrectlySorted = true; @@ -640,11 +717,7 @@ export default util.createRule({ // Note: Not all members have names if (name) { - if ( - caseSensitive - ? name < previousName - : name.toLowerCase() < previousName.toLowerCase() - ) { + if (naturalOutOfOrder(name, previousName, order)) { context.report({ node: member, messageId: 'incorrectOrder', @@ -664,6 +737,78 @@ export default util.createRule({ return isCorrectlySorted; } + function naturalOutOfOrder( + name: string, + previousName: string, + order: AlphabeticalOrder, + ): boolean { + switch (order) { + case 'alphabetically': + return name < previousName; + case 'alphabetically-case-insensitive': + return name.toLowerCase() < previousName.toLowerCase(); + case 'natural': + return naturalCompare(name, previousName) !== 1; + case 'natural-case-insensitive': + return ( + naturalCompare(name.toLowerCase(), previousName.toLowerCase()) !== 1 + ); + } + } + + /** + * Checks if the order of optional and required members is correct based + * on the given 'required' parameter. + * + * @param members Members to be validated. + * @param optionalityOrder Where to place optional members, if not intermixed. + * + * @return True if all required and optional members are correctly sorted. + */ + function checkRequiredOrder( + members: Member[], + optionalityOrder: OptionalityOrder | undefined, + ): boolean { + const switchIndex = members.findIndex( + (member, i) => + i && isMemberOptional(member) !== isMemberOptional(members[i - 1]), + ); + + const report = (member: Member): void => + context.report({ + messageId: 'incorrectRequiredMembersOrder', + loc: member.loc, + data: { + member: getMemberName(member, context.getSourceCode()), + optionalOrRequired: + optionalityOrder === 'optional-first' ? 'required' : 'optional', + }, + }); + + // if the optionality of the first item is correct (based on optionalityOrder) + // then the first 0 inclusive to switchIndex exclusive members all + // have the correct optionality + if ( + isMemberOptional(members[0]) !== + (optionalityOrder === 'required-first') + ) { + report(members[0]); + return false; + } + + for (let i = switchIndex + 1; i < members.length; i++) { + if ( + isMemberOptional(members[i]) !== + isMemberOptional(members[switchIndex]) + ) { + report(members[switchIndex]); + return false; + } + } + + return true; + } + /** * Validates if all members are correctly sorted. * @@ -681,36 +826,63 @@ export default util.createRule({ } // Standardize config - let order: Order | null = null; - let memberTypes; + let order: Order | undefined; + let memberTypes: string | MemberType[] | undefined; + let optionalityOrder: OptionalityOrder | undefined; + + // returns true if everything is good and false if an error was reported + const checkOrder = (memberSet: Member[]): boolean => { + const hasAlphaSort = !!(order && order !== 'as-written'); + + // Check order + if (Array.isArray(memberTypes)) { + const grouped = checkGroupSort( + memberSet, + memberTypes, + supportsModifiers, + ); + + if (grouped === null) { + return false; + } + + if (hasAlphaSort) { + return !grouped.some( + groupMember => + !checkAlphaSort(groupMember, order as AlphabeticalOrder), + ); + } + } else if (hasAlphaSort) { + return checkAlphaSort(memberSet, order as AlphabeticalOrder); + } + + return true; + }; if (Array.isArray(orderConfig)) { memberTypes = orderConfig; } else { order = orderConfig.order; memberTypes = orderConfig.memberTypes; + optionalityOrder = orderConfig.optionalityOrder; } - const hasAlphaSort = order?.startsWith('alphabetically'); - const alphaSortIsCaseSensitive = - order !== 'alphabetically-case-insensitive'; + if (!optionalityOrder) { + checkOrder(members); + return; + } - // Check order - if (Array.isArray(memberTypes)) { - const grouped = checkGroupSort(members, memberTypes, supportsModifiers); + const switchIndex = members.findIndex( + (member, i) => + i && isMemberOptional(member) !== isMemberOptional(members[i - 1]), + ); - if (grouped === null) { + if (switchIndex !== -1) { + if (!checkRequiredOrder(members, optionalityOrder)) { return; } - - if (hasAlphaSort) { - grouped.some( - groupMember => - !checkAlphaSort(groupMember, alphaSortIsCaseSensitive), - ); - } - } else if (hasAlphaSort) { - checkAlphaSort(members, alphaSortIsCaseSensitive); + checkOrder(members.slice(0, switchIndex)); + checkOrder(members.slice(switchIndex)); } } diff --git a/packages/eslint-plugin/src/rules/naming-convention-utils/enums.ts b/packages/eslint-plugin/src/rules/naming-convention-utils/enums.ts index c9460305847..bc2547ffa3f 100644 --- a/packages/eslint-plugin/src/rules/naming-convention-utils/enums.ts +++ b/packages/eslint-plugin/src/rules/naming-convention-utils/enums.ts @@ -102,6 +102,10 @@ enum Modifiers { unused = 1 << 10, // properties that require quoting requiresQuotes = 1 << 11, + // class members that are overridden + override = 1 << 12, + // class methods, object function properties, or functions that are async via the `async` keyword + async = 1 << 13, // make sure TypeModifiers starts at Modifiers + 1 or else sorting won't work } diff --git a/packages/eslint-plugin/src/rules/naming-convention-utils/schema.ts b/packages/eslint-plugin/src/rules/naming-convention-utils/schema.ts index fab1d1bc2b6..179b6dd7f43 100644 --- a/packages/eslint-plugin/src/rules/naming-convention-utils/schema.ts +++ b/packages/eslint-plugin/src/rules/naming-convention-utils/schema.ts @@ -170,15 +170,21 @@ const SCHEMA: JSONSchema.JSONSchema4 = { selectorsSchema(), ...selectorSchema('default', false, util.getEnumNames(Modifiers)), - ...selectorSchema('variableLike', false, ['unused']), + ...selectorSchema('variableLike', false, ['unused', 'async']), ...selectorSchema('variable', true, [ 'const', 'destructured', 'exported', 'global', 'unused', + 'async', + ]), + ...selectorSchema('function', false, [ + 'exported', + 'global', + 'unused', + 'async', ]), - ...selectorSchema('function', false, ['exported', 'global', 'unused']), ...selectorSchema('parameter', true, ['destructured', 'unused']), ...selectorSchema('memberLike', false, [ @@ -189,6 +195,8 @@ const SCHEMA: JSONSchema.JSONSchema4 = { 'readonly', 'requiresQuotes', 'static', + 'override', + 'async', ]), ...selectorSchema('classProperty', true, [ 'abstract', @@ -198,6 +206,7 @@ const SCHEMA: JSONSchema.JSONSchema4 = { 'readonly', 'requiresQuotes', 'static', + 'override', ]), ...selectorSchema('objectLiteralProperty', true, [ 'public', @@ -222,6 +231,8 @@ const SCHEMA: JSONSchema.JSONSchema4 = { 'readonly', 'requiresQuotes', 'static', + 'override', + 'async', ]), ...selectorSchema('classMethod', false, [ @@ -231,10 +242,13 @@ const SCHEMA: JSONSchema.JSONSchema4 = { 'public', 'requiresQuotes', 'static', + 'override', + 'async', ]), ...selectorSchema('objectLiteralMethod', false, [ 'public', 'requiresQuotes', + 'async', ]), ...selectorSchema('typeMethod', false, ['public', 'requiresQuotes']), ...selectorSchema('method', false, [ @@ -244,6 +258,8 @@ const SCHEMA: JSONSchema.JSONSchema4 = { 'public', 'requiresQuotes', 'static', + 'override', + 'async', ]), ...selectorSchema('accessor', true, [ 'abstract', @@ -252,6 +268,7 @@ const SCHEMA: JSONSchema.JSONSchema4 = { 'public', 'requiresQuotes', 'static', + 'override', ]), ...selectorSchema('enumMember', false, ['requiresQuotes']), diff --git a/packages/eslint-plugin/src/rules/naming-convention.ts b/packages/eslint-plugin/src/rules/naming-convention.ts index 2984c49f5a2..05f3dd0f2a6 100644 --- a/packages/eslint-plugin/src/rules/naming-convention.ts +++ b/packages/eslint-plugin/src/rules/naming-convention.ts @@ -138,6 +138,9 @@ export default util.createRule({ if ('readonly' in node && node.readonly) { modifiers.add(Modifiers.readonly); } + if ('override' in node && node.override) { + modifiers.add(Modifiers.override); + } if ( node.type === AST_NODE_TYPES.TSAbstractPropertyDefinition || node.type === AST_NODE_TYPES.TSAbstractMethodDefinition @@ -182,6 +185,34 @@ export default util.createRule({ ); } + function isAsyncMemberOrProperty( + propertyOrMemberNode: + | TSESTree.PropertyNonComputedName + | TSESTree.TSMethodSignatureNonComputedName + | TSESTree.PropertyDefinitionNonComputedName + | TSESTree.TSAbstractPropertyDefinitionNonComputedName + | TSESTree.MethodDefinitionNonComputedName + | TSESTree.TSAbstractMethodDefinitionNonComputedName, + ): boolean { + return Boolean( + 'value' in propertyOrMemberNode && + propertyOrMemberNode.value && + 'async' in propertyOrMemberNode.value && + propertyOrMemberNode.value.async, + ); + } + + function isAsyncVariableIdentifier(id: TSESTree.Identifier): boolean { + return Boolean( + id.parent && + (('async' in id.parent && id.parent.async) || + ('init' in id.parent && + id.parent.init && + 'async' in id.parent.init && + id.parent.init.async)), + ); + } + return { // #region variable @@ -219,6 +250,10 @@ export default util.createRule({ modifiers.add(Modifiers.unused); } + if (isAsyncVariableIdentifier(id)) { + modifiers.add(Modifiers.async); + } + validator(id, modifiers); }); }, @@ -254,6 +289,10 @@ export default util.createRule({ modifiers.add(Modifiers.unused); } + if (node.async) { + modifiers.add(Modifiers.async); + } + validator(node.id, modifiers); }, @@ -360,6 +399,11 @@ export default util.createRule({ | TSESTree.TSMethodSignatureNonComputedName, ): void { const modifiers = new Set([Modifiers.public]); + + if (isAsyncMemberOrProperty(node)) { + modifiers.add(Modifiers.async); + } + handleMember(validators.objectLiteralMethod, node, modifiers); }, @@ -376,6 +420,11 @@ export default util.createRule({ | TSESTree.TSAbstractMethodDefinitionNonComputedName, ): void { const modifiers = getMemberModifiers(node); + + if (isAsyncMemberOrProperty(node)) { + modifiers.add(Modifiers.async); + } + handleMember(validators.classMethod, node, modifiers); }, 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 8c81878238f..8b8521491f2 100644 --- a/packages/eslint-plugin/src/rules/no-base-to-string.ts +++ b/packages/eslint-plugin/src/rules/no-base-to-string.ts @@ -48,7 +48,7 @@ export default util.createRule({ }, defaultOptions: [ { - ignoredTypeNames: ['RegExp'], + ignoredTypeNames: ['Error', 'RegExp', 'URL', 'URLSearchParams'], }, ], create(context, [option]) { diff --git a/packages/eslint-plugin/src/rules/no-empty-interface.ts b/packages/eslint-plugin/src/rules/no-empty-interface.ts index 4e037e9cc8a..d74034114bb 100644 --- a/packages/eslint-plugin/src/rules/no-empty-interface.ts +++ b/packages/eslint-plugin/src/rules/no-empty-interface.ts @@ -1,4 +1,5 @@ import type { TSESLint } from '@typescript-eslint/utils'; +import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import * as util from '../util'; @@ -73,29 +74,39 @@ export default util.createRule({ )}${typeParam} = ${sourceCode.getText(extend[0])}`, ); }; + const scope = context.getScope(); - // Check if interface is within ambient declaration - let useAutoFix = true; - if (util.isDefinitionFile(filename)) { - const scope = context.getScope(); - if (scope.type === 'tsModule' && scope.block.declare) { - useAutoFix = false; - } - } + const mergedWithClassDeclaration = scope.set + .get(node.id.name) + ?.defs?.some( + def => def.node.type === AST_NODE_TYPES.ClassDeclaration, + ); + + const isInAmbientDeclaration = !!( + util.isDefinitionFile(filename) && + scope.type === 'tsModule' && + scope.block.declare + ); + + const useAutoFix = !( + isInAmbientDeclaration || mergedWithClassDeclaration + ); context.report({ node: node.id, messageId: 'noEmptyWithSuper', ...(useAutoFix ? { fix } - : { + : !mergedWithClassDeclaration + ? { suggest: [ { messageId: 'noEmptyWithSuper', fix, }, ], - }), + } + : null), }); } } diff --git a/packages/eslint-plugin/src/rules/no-extra-non-null-assertion.ts b/packages/eslint-plugin/src/rules/no-extra-non-null-assertion.ts index 8d15029f716..a69cd262d6e 100644 --- a/packages/eslint-plugin/src/rules/no-extra-non-null-assertion.ts +++ b/packages/eslint-plugin/src/rules/no-extra-non-null-assertion.ts @@ -7,7 +7,7 @@ export default util.createRule({ meta: { type: 'problem', docs: { - description: 'Disallow extra non-null assertion', + description: 'Disallow extra non-null assertions', recommended: 'error', }, fixable: 'code', diff --git a/packages/eslint-plugin/src/rules/no-extra-parens.ts b/packages/eslint-plugin/src/rules/no-extra-parens.ts index 3a4a5973074..a44276a0a76 100644 --- a/packages/eslint-plugin/src/rules/no-extra-parens.ts +++ b/packages/eslint-plugin/src/rules/no-extra-parens.ts @@ -141,8 +141,30 @@ export default util.createRule({ }, BinaryExpression: binaryExp, CallExpression: callExp, - // ClassDeclaration - // ClassExpression + ClassDeclaration(node) { + if (node.superClass?.type === AST_NODE_TYPES.TSAsExpression) { + return rules.ClassDeclaration({ + ...node, + superClass: { + ...node.superClass, + type: AST_NODE_TYPES.SequenceExpression as any, + }, + }); + } + return rules.ClassDeclaration(node); + }, + ClassExpression(node) { + if (node.superClass?.type === AST_NODE_TYPES.TSAsExpression) { + return rules.ClassExpression({ + ...node, + superClass: { + ...node.superClass, + type: AST_NODE_TYPES.SequenceExpression as any, + }, + }); + } + return rules.ClassExpression(node); + }, ConditionalExpression(node) { // reduces the precedence of the node so the rule thinks it needs to be wrapped if (util.isTypeAssertion(node.test)) { diff --git a/packages/eslint-plugin/src/rules/no-floating-promises.ts b/packages/eslint-plugin/src/rules/no-floating-promises.ts index 05f0954e305..61829743e81 100644 --- a/packages/eslint-plugin/src/rules/no-floating-promises.ts +++ b/packages/eslint-plugin/src/rules/no-floating-promises.ts @@ -1,7 +1,7 @@ import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import * as tsutils from 'tsutils'; -import type * as ts from 'typescript'; +import * as ts from 'typescript'; import * as util from '../util'; @@ -12,7 +12,11 @@ type Options = [ }, ]; -type MessageId = 'floating' | 'floatingVoid' | 'floatingFixVoid'; +type MessageId = + | 'floating' + | 'floatingVoid' + | 'floatingFixVoid' + | 'floatingFixAwait'; export default util.createRule({ name: 'no-floating-promises', @@ -27,6 +31,7 @@ export default util.createRule({ messages: { floating: 'Promises must be awaited, end with a call to .catch, or end with a call to .then with a rejection handler.', + floatingFixAwait: 'Add await operator.', floatingVoid: 'Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler' + ' or be explicitly marked as ignored with the `void` operator.', @@ -95,12 +100,54 @@ export default util.createRule({ context.report({ node, messageId: 'floating', + suggest: [ + { + messageId: 'floatingFixAwait', + fix(fixer): TSESLint.RuleFix | TSESLint.RuleFix[] { + if ( + expression.type === AST_NODE_TYPES.UnaryExpression && + expression.operator === 'void' + ) { + return fixer.replaceTextRange( + [expression.range[0], expression.range[0] + 4], + 'await', + ); + } + const tsNode = parserServices.esTreeNodeToTSNodeMap.get( + node.expression, + ); + if (isHigherPrecedenceThanAwait(tsNode)) { + return fixer.insertTextBefore(node, 'await '); + } else { + return [ + fixer.insertTextBefore(node, 'await ('), + fixer.insertTextAfterRange( + [expression.range[1], expression.range[1]], + ')', + ), + ]; + } + }, + }, + ], }); } } }, }; + function isHigherPrecedenceThanAwait(node: ts.Node): boolean { + const operator = tsutils.isBinaryExpression(node) + ? node.operatorToken.kind + : ts.SyntaxKind.Unknown; + const nodePrecedence = util.getOperatorPrecedence(node.kind, operator); + const awaitPrecedence = util.getOperatorPrecedence( + ts.SyntaxKind.AwaitExpression, + ts.SyntaxKind.Unknown, + ); + return nodePrecedence > awaitPrecedence; + } + 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-invalid-void-type.ts b/packages/eslint-plugin/src/rules/no-invalid-void-type.ts index 7cda184e4fd..9f938ac438f 100644 --- a/packages/eslint-plugin/src/rules/no-invalid-void-type.ts +++ b/packages/eslint-plugin/src/rules/no-invalid-void-type.ts @@ -13,7 +13,8 @@ type MessageIds = | 'invalidVoidNotReturnOrGeneric' | 'invalidVoidNotReturn' | 'invalidVoidNotReturnOrThisParam' - | 'invalidVoidNotReturnOrThisParamOrGeneric'; + | 'invalidVoidNotReturnOrThisParamOrGeneric' + | 'invalidVoidUnionConstituent'; export default util.createRule<[Options], MessageIds>({ name: 'no-invalid-void-type', @@ -25,14 +26,16 @@ export default util.createRule<[Options], MessageIds>({ }, messages: { invalidVoidForGeneric: - '{{ generic }} may not have void as a type variable.', + '{{ generic }} may not have void as a type argument.', invalidVoidNotReturnOrGeneric: - 'void is only valid as a return type or generic type variable.', + 'void is only valid as a return type or generic type argument.', invalidVoidNotReturn: 'void is only valid as a return type.', invalidVoidNotReturnOrThisParam: 'void is only valid as return type or type of `this` parameter.', invalidVoidNotReturnOrThisParamOrGeneric: - 'void is only valid as a return type or generic type variable or the type of a `this` parameter.', + 'void is only valid as a return type or generic type argument or the type of a `this` parameter.', + invalidVoidUnionConstituent: + 'void is not valid as a constituent in a union type', }, schema: [ { @@ -136,7 +139,7 @@ export default util.createRule<[Options], MessageIds>({ ): void { if (parentNode.default !== node) { context.report({ - messageId: 'invalidVoidNotReturnOrGeneric', + messageId: getNotReturnOrGenericMessageId(node), node, }); } @@ -218,7 +221,7 @@ export default util.createRule<[Options], MessageIds>({ allowInGenericTypeArguments && allowAsThisParameter ? 'invalidVoidNotReturnOrThisParamOrGeneric' : allowInGenericTypeArguments - ? 'invalidVoidNotReturnOrGeneric' + ? getNotReturnOrGenericMessageId(node) : allowAsThisParameter ? 'invalidVoidNotReturnOrThisParam' : 'invalidVoidNotReturn', @@ -228,3 +231,11 @@ export default util.createRule<[Options], MessageIds>({ }; }, }); + +function getNotReturnOrGenericMessageId( + node: TSESTree.TSVoidKeyword, +): MessageIds { + return node.parent!.type === AST_NODE_TYPES.TSUnionType + ? 'invalidVoidUnionConstituent' + : 'invalidVoidNotReturnOrGeneric'; +} diff --git a/packages/eslint-plugin/src/rules/no-misused-promises.ts b/packages/eslint-plugin/src/rules/no-misused-promises.ts index 2c7f1eeb259..b6914ae2c39 100644 --- a/packages/eslint-plugin/src/rules/no-misused-promises.ts +++ b/packages/eslint-plugin/src/rules/no-misused-promises.ts @@ -213,13 +213,13 @@ export default util.createRule({ node: TSESTree.CallExpression | TSESTree.NewExpression, ): void { const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node); - const voidParams = voidFunctionParams(checker, tsNode); - if (voidParams.size === 0) { + const voidArgs = voidFunctionArguments(checker, tsNode); + if (voidArgs.size === 0) { return; } for (const [index, argument] of node.arguments.entries()) { - if (!voidParams.has(index)) { + if (!voidArgs.has(index)) { continue; } @@ -486,13 +486,40 @@ function isFunctionParam( return false; } -// Get the positions of parameters which are void functions (and not also +function checkThenableOrVoidArgument( + checker: ts.TypeChecker, + node: ts.CallExpression | ts.NewExpression, + type: ts.Type, + index: number, + thenableReturnIndices: Set, + voidReturnIndices: Set, +): void { + if (isThenableReturningFunctionType(checker, node.expression, type)) { + thenableReturnIndices.add(index); + } else if (isVoidReturningFunctionType(checker, node.expression, type)) { + // If a certain argument accepts both thenable and void returns, + // a promise-returning function is valid + if (!thenableReturnIndices.has(index)) { + voidReturnIndices.add(index); + } + } +} + +// Get the positions of arguments which are void functions (and not also // thenable functions). These are the candidates for the void-return check at // the current call site. -function voidFunctionParams( +// If the function parameters end with a 'rest' parameter, then we consider +// the array type parameter (e.g. '...args:Array') when determining +// if trailing arguments are candidates. +function voidFunctionArguments( checker: ts.TypeChecker, node: ts.CallExpression | ts.NewExpression, ): Set { + // 'new' can be used without any arguments, as in 'let b = new Object;' + // In this case, there are no argument positions to check, so return early. + if (!node.arguments) { + return new Set(); + } const thenableReturnIndices = new Set(); const voidReturnIndices = new Set(); const type = checker.getTypeAtLocation(node.expression); @@ -507,17 +534,60 @@ function voidFunctionParams( : subType.getConstructSignatures(); for (const signature of signatures) { for (const [index, parameter] of signature.parameters.entries()) { - const type = checker.getTypeOfSymbolAtLocation( + const decl = parameter.valueDeclaration; + let type = checker.getTypeOfSymbolAtLocation( parameter, node.expression, ); - if (isThenableReturningFunctionType(checker, node.expression, type)) { - thenableReturnIndices.add(index); - } else if ( - !thenableReturnIndices.has(index) && - isVoidReturningFunctionType(checker, node.expression, type) - ) { - voidReturnIndices.add(index); + + // If this is a array 'rest' parameter, check all of the argument indices + // from the current argument to the end. + // Note - we currently do not support 'spread' arguments - adding support for them + // is tracked in https://github.com/typescript-eslint/typescript-eslint/issues/5744 + if (decl && ts.isParameter(decl) && decl.dotDotDotToken) { + if (checker.isArrayType(type)) { + // Unwrap 'Array' to 'MaybeVoidFunction', + // so that we'll handle it in the same way as a non-rest + // 'param: MaybeVoidFunction' + type = checker.getTypeArguments(type)[0]; + for (let i = index; i < node.arguments.length; i++) { + checkThenableOrVoidArgument( + checker, + node, + type, + i, + thenableReturnIndices, + voidReturnIndices, + ); + } + } else if (checker.isTupleType(type)) { + // Check each type in the tuple - for example, [boolean, () => void] would + // add the index of the second tuple parameter to 'voidReturnIndices' + const typeArgs = checker.getTypeArguments(type); + for ( + let i = index; + i < node.arguments.length && i - index < typeArgs.length; + i++ + ) { + checkThenableOrVoidArgument( + checker, + node, + typeArgs[i - index], + i, + thenableReturnIndices, + voidReturnIndices, + ); + } + } + } else { + checkThenableOrVoidArgument( + checker, + node, + type, + index, + thenableReturnIndices, + voidReturnIndices, + ); } } } diff --git a/packages/eslint-plugin/src/rules/no-namespace.ts b/packages/eslint-plugin/src/rules/no-namespace.ts index ee986a4d82d..2a9a4a251be 100644 --- a/packages/eslint-plugin/src/rules/no-namespace.ts +++ b/packages/eslint-plugin/src/rules/no-namespace.ts @@ -16,12 +16,12 @@ export default util.createRule({ meta: { type: 'suggestion', docs: { - description: 'Disallow custom TypeScript modules and namespaces', + description: 'Disallow TypeScript namespaces', recommended: 'error', }, messages: { moduleSyntaxIsPreferred: - 'ES2015 module syntax is preferred over custom TypeScript modules and namespaces.', + 'ES2015 module syntax is preferred over namespaces.', }, schema: [ { diff --git a/packages/eslint-plugin/src/rules/no-shadow.ts b/packages/eslint-plugin/src/rules/no-shadow.ts index 1f746a3201c..e9b73370966 100644 --- a/packages/eslint-plugin/src/rules/no-shadow.ts +++ b/packages/eslint-plugin/src/rules/no-shadow.ts @@ -20,6 +20,12 @@ type Options = [ }, ]; +const allowedFunctionVariableDefTypes = new Set([ + AST_NODE_TYPES.TSCallSignatureDeclaration, + AST_NODE_TYPES.TSFunctionType, + AST_NODE_TYPES.TSMethodSignature, +]); + export default util.createRule({ name: 'no-shadow', meta: { @@ -147,8 +153,9 @@ export default util.createRule({ return false; } - const id = variable.identifiers[0]; - return util.isFunctionType(id.parent); + return variable.defs.every(def => + allowedFunctionVariableDefTypes.has(def.node.type), + ); } function isGenericOfStaticMethod( diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts b/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts index 942048bce0b..030ed4fe188 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts @@ -330,6 +330,7 @@ export default createRule({ if (isStrictNullChecks) { const UNDEFINED = ts.TypeFlags.Undefined; const NULL = ts.TypeFlags.Null; + const VOID = ts.TypeFlags.Void; const isComparable = (type: ts.Type, flag: ts.TypeFlags): boolean => { // Allow comparison to `any`, `unknown` or a naked type parameter. flag |= @@ -339,7 +340,7 @@ export default createRule({ // Allow loose comparison to nullish values. if (node.operator === '==' || node.operator === '!=') { - flag |= NULL | UNDEFINED; + flag |= NULL | UNDEFINED | VOID; } return isTypeFlagSet(type, flag); @@ -347,9 +348,9 @@ export default createRule({ if ( (leftType.flags === UNDEFINED && - !isComparable(rightType, UNDEFINED)) || + !isComparable(rightType, UNDEFINED | VOID)) || (rightType.flags === UNDEFINED && - !isComparable(leftType, UNDEFINED)) || + !isComparable(leftType, UNDEFINED | VOID)) || (leftType.flags === NULL && !isComparable(rightType, NULL)) || (rightType.flags === NULL && !isComparable(leftType, NULL)) ) { @@ -553,7 +554,12 @@ export default createRule({ type, property.name, ); - return propType && isNullableType(propType, { allowUndefined: true }); + + if (propType) { + return isNullableType(propType, { allowUndefined: true }); + } + + return !!checker.getIndexInfoOfType(type, ts.IndexKind.String); }); return ( !isOwnNullable && isNullableType(prevType, { allowUndefined: true }) diff --git a/packages/eslint-plugin/src/rules/no-unsafe-declaration-merging.ts b/packages/eslint-plugin/src/rules/no-unsafe-declaration-merging.ts new file mode 100644 index 00000000000..89d68db6e67 --- /dev/null +++ b/packages/eslint-plugin/src/rules/no-unsafe-declaration-merging.ts @@ -0,0 +1,73 @@ +import type { Scope } from '@typescript-eslint/scope-manager'; +import type { TSESTree } from '@typescript-eslint/utils'; +import { AST_NODE_TYPES } from '@typescript-eslint/utils'; + +import * as util from '../util'; + +export default util.createRule({ + name: 'no-unsafe-declaration-merging', + meta: { + type: 'problem', + docs: { + description: 'Disallow unsafe declaration merging', + recommended: 'strict', + requiresTypeChecking: false, + }, + messages: { + unsafeMerging: + 'Unsafe declaration merging between classes and interfaces.', + }, + schema: [], + }, + defaultOptions: [], + create(context) { + function checkUnsafeDeclaration( + scope: Scope, + node: TSESTree.Identifier, + unsafeKind: AST_NODE_TYPES, + ): void { + const variable = scope.set.get(node.name); + if (!variable) { + return; + } + + const defs = variable.defs; + if (defs.length <= 1) { + return; + } + + if (defs.some(def => def.node.type === unsafeKind)) { + context.report({ + node, + messageId: 'unsafeMerging', + }); + } + } + + return { + ClassDeclaration(node): void { + if (node.id) { + // by default eslint returns the inner class scope for the ClassDeclaration node + // but we want the outer scope within which merged variables will sit + const currentScope = context.getScope().upper; + if (currentScope == null) { + return; + } + + checkUnsafeDeclaration( + currentScope, + node.id, + AST_NODE_TYPES.TSInterfaceDeclaration, + ); + } + }, + TSInterfaceDeclaration(node): void { + checkUnsafeDeclaration( + context.getScope(), + node.id, + AST_NODE_TYPES.ClassDeclaration, + ); + }, + }; + }, +}); diff --git a/packages/eslint-plugin/src/rules/no-unused-vars.ts b/packages/eslint-plugin/src/rules/no-unused-vars.ts index 5fcde198667..77da885048d 100644 --- a/packages/eslint-plugin/src/rules/no-unused-vars.ts +++ b/packages/eslint-plugin/src/rules/no-unused-vars.ts @@ -84,7 +84,7 @@ export default util.createRule({ }, }, defaultOptions: [{}], - create(context) { + create(context, [firstOption]) { const filename = context.getFilename(); const sourceCode = context.getSourceCode(); const MODULE_DECL_CACHE = new Map(); @@ -97,8 +97,6 @@ export default util.createRule({ caughtErrors: 'none', }; - const [firstOption] = context.options; - if (firstOption) { if (typeof firstOption === 'string') { options.vars = firstOption; diff --git a/packages/eslint-plugin/src/rules/object-curly-spacing.ts b/packages/eslint-plugin/src/rules/object-curly-spacing.ts index 5c188bb2c07..1c1c737c842 100644 --- a/packages/eslint-plugin/src/rules/object-curly-spacing.ts +++ b/packages/eslint-plugin/src/rules/object-curly-spacing.ts @@ -31,6 +31,7 @@ export default createRule({ }, defaultOptions: ['never'], create(context) { + // eslint-disable-next-line no-restricted-syntax -- Use raw options for extended rules. const [firstOption, secondOption] = context.options; const spaced = firstOption === 'always'; const sourceCode = context.getSourceCode(); diff --git a/packages/eslint-plugin/src/rules/padding-line-between-statements.ts b/packages/eslint-plugin/src/rules/padding-line-between-statements.ts index a3c354ea737..f9b97096afc 100644 --- a/packages/eslint-plugin/src/rules/padding-line-between-statements.ts +++ b/packages/eslint-plugin/src/rules/padding-line-between-statements.ts @@ -634,6 +634,7 @@ export default util.createRule({ defaultOptions: [], create(context) { const sourceCode = context.getSourceCode(); + // eslint-disable-next-line no-restricted-syntax -- We need all raw options. const configureList = context.options || []; type Scope = null | { diff --git a/packages/eslint-plugin/src/rules/prefer-nullish-coalescing.ts b/packages/eslint-plugin/src/rules/prefer-nullish-coalescing.ts index 6d820369b0a..14157427efa 100644 --- a/packages/eslint-plugin/src/rules/prefer-nullish-coalescing.ts +++ b/packages/eslint-plugin/src/rules/prefer-nullish-coalescing.ts @@ -1,5 +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 'tsutils'; import * as ts from 'typescript'; import * as util from '../util'; @@ -9,13 +10,15 @@ export type Options = [ ignoreConditionalTests?: boolean; ignoreTernaryTests?: boolean; ignoreMixedLogicalExpressions?: boolean; + allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing?: boolean; }, ]; export type MessageIds = | 'preferNullishOverOr' | 'preferNullishOverTernary' - | 'suggestNullish'; + | 'suggestNullish' + | 'noStrictNullCheck'; export default util.createRule({ name: 'prefer-nullish-coalescing', @@ -34,6 +37,8 @@ export default util.createRule({ preferNullishOverTernary: 'Prefer using nullish coalescing operator (`??`) instead of a ternary expression, as it is simpler to read.', suggestNullish: 'Fix to nullish coalescing operator (`??`).', + noStrictNullCheck: + 'This rule requires the `strictNullChecks` compiler option to be turned on to function correctly.', }, schema: [ { @@ -48,7 +53,7 @@ export default util.createRule({ ignoreMixedLogicalExpressions: { type: 'boolean', }, - forceSuggestionFixer: { + allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing: { type: 'boolean', }, }, @@ -61,6 +66,7 @@ export default util.createRule({ ignoreConditionalTests: true, ignoreTernaryTests: true, ignoreMixedLogicalExpressions: true, + allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing: false, }, ], create( @@ -70,12 +76,31 @@ export default util.createRule({ ignoreConditionalTests, ignoreTernaryTests, ignoreMixedLogicalExpressions, + allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing, }, ], ) { const parserServices = util.getParserServices(context); + const compilerOptions = parserServices.program.getCompilerOptions(); const sourceCode = context.getSourceCode(); const checker = parserServices.program.getTypeChecker(); + const isStrictNullChecks = tsutils.isStrictCompilerOptionEnabled( + compilerOptions, + 'strictNullChecks', + ); + + if ( + !isStrictNullChecks && + allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing !== true + ) { + context.report({ + loc: { + start: { line: 0, column: 0 }, + end: { line: 0, column: 0 }, + }, + messageId: 'noStrictNullCheck', + }); + } return { ConditionalExpression(node: TSESTree.ConditionalExpression): void { diff --git a/packages/eslint-plugin/src/rules/prefer-optional-chain.ts b/packages/eslint-plugin/src/rules/prefer-optional-chain.ts index dc9b514e353..9a4949b734b 100644 --- a/packages/eslint-plugin/src/rules/prefer-optional-chain.ts +++ b/packages/eslint-plugin/src/rules/prefer-optional-chain.ts @@ -11,7 +11,8 @@ type ValidChainTarget = | TSESTree.ChainExpression | TSESTree.Identifier | TSESTree.MemberExpression - | TSESTree.ThisExpression; + | TSESTree.ThisExpression + | TSESTree.MetaProperty; /* The AST is always constructed such the first element is always the deepest element. @@ -35,7 +36,7 @@ export default util.createRule({ type: 'suggestion', docs: { description: - 'Enforce using concise optional chain expressions instead of chained logical ands', + 'Enforce using concise optional chain expressions instead of chained logical ands, negated logical ors, or empty objects', recommended: 'strict', }, hasSuggestions: true, @@ -111,17 +112,96 @@ export default util.createRule({ ], }); }, + [[ + 'LogicalExpression[operator="||"] > UnaryExpression[operator="!"] > Identifier', + 'LogicalExpression[operator="||"] > UnaryExpression[operator="!"] > MemberExpression', + 'LogicalExpression[operator="||"] > UnaryExpression[operator="!"] > ChainExpression > MemberExpression', + 'LogicalExpression[operator="||"] > UnaryExpression[operator="!"] > MetaProperty', + ].join(',')]( + initialIdentifierOrNotEqualsExpr: + | TSESTree.Identifier + | TSESTree.MemberExpression + | TSESTree.MetaProperty, + ): void { + // selector guarantees this cast + const initialExpression = ( + initialIdentifierOrNotEqualsExpr.parent!.type === + AST_NODE_TYPES.ChainExpression + ? initialIdentifierOrNotEqualsExpr.parent.parent + : initialIdentifierOrNotEqualsExpr.parent + )!.parent as TSESTree.LogicalExpression; + + if ( + initialExpression.left.type !== AST_NODE_TYPES.UnaryExpression || + initialExpression.left.argument !== initialIdentifierOrNotEqualsExpr + ) { + // the node(identifier or member expression) is not the deepest left node + return; + } + + // walk up the tree to figure out how many logical expressions we can include + let previous: TSESTree.LogicalExpression = initialExpression; + let current: TSESTree.Node = initialExpression; + let previousLeftText = getText(initialIdentifierOrNotEqualsExpr); + let optionallyChainedCode = previousLeftText; + let expressionCount = 1; + while (current.type === AST_NODE_TYPES.LogicalExpression) { + if ( + current.right.type !== AST_NODE_TYPES.UnaryExpression || + !isValidChainTarget( + current.right.argument, + // only allow unary '!' with identifiers for the first chain - !foo || !foo() + expressionCount === 1, + ) + ) { + break; + } + const { rightText, shouldBreak } = breakIfInvalid({ + rightNode: current.right.argument, + previousLeftText, + }); + if (shouldBreak) { + break; + } + + ({ + expressionCount, + previousLeftText, + optionallyChainedCode, + previous, + current, + } = normalizeRepeatingPatterns( + rightText, + expressionCount, + previousLeftText, + optionallyChainedCode, + previous, + current, + )); + } + + reportIfMoreThanOne({ + expressionCount, + previous, + optionallyChainedCode, + sourceCode, + context, + shouldHandleChainedAnds: false, + }); + }, [[ 'LogicalExpression[operator="&&"] > Identifier', 'LogicalExpression[operator="&&"] > MemberExpression', 'LogicalExpression[operator="&&"] > ChainExpression > MemberExpression', + 'LogicalExpression[operator="&&"] > MetaProperty', 'LogicalExpression[operator="&&"] > BinaryExpression[operator="!=="]', 'LogicalExpression[operator="&&"] > BinaryExpression[operator="!="]', ].join(',')]( initialIdentifierOrNotEqualsExpr: | TSESTree.BinaryExpression | TSESTree.Identifier - | TSESTree.MemberExpression, + | TSESTree.MemberExpression + | TSESTree.MetaProperty, ): void { // selector guarantees this cast const initialExpression = ( @@ -155,94 +235,76 @@ export default util.createRule({ ) { break; } - - const leftText = previousLeftText; - const rightText = getText(current.right); - // can't just use startsWith because of cases like foo && fooBar.baz; - const matchRegex = new RegExp( - `^${ - // escape regex characters - leftText.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') - }[^a-zA-Z0-9_$]`, - ); - if ( - !matchRegex.test(rightText) && - // handle redundant cases like foo.bar && foo.bar - leftText !== rightText - ) { + const { rightText, shouldBreak } = breakIfInvalid({ + rightNode: current.right, + previousLeftText, + }); + if (shouldBreak) { break; } - // omit weird doubled up expression that make no sense like foo.bar && foo.bar - if (rightText !== leftText) { - expressionCount += 1; - previousLeftText = rightText; - - /* - Diff the left and right text to construct the fix string - There are the following cases: - 1) - rightText === 'foo.bar.baz.buzz' - leftText === 'foo.bar.baz' - diff === '.buzz' - 2) - rightText === 'foo.bar.baz.buzz()' - leftText === 'foo.bar.baz' - diff === '.buzz()' - 3) - rightText === 'foo.bar.baz.buzz()' - leftText === 'foo.bar.baz.buzz' - diff === '()' - 4) - rightText === 'foo.bar.baz[buzz]' - leftText === 'foo.bar.baz' - diff === '[buzz]' - 5) - rightText === 'foo.bar.baz?.buzz' - leftText === 'foo.bar.baz' - diff === '?.buzz' - */ - const diff = rightText.replace(leftText, ''); - if (diff.startsWith('?')) { - // item was "pre optional chained" - optionallyChainedCode += diff; - } else { - const needsDot = diff.startsWith('(') || diff.startsWith('['); - optionallyChainedCode += `?${needsDot ? '.' : ''}${diff}`; - } - } - - previous = current; - current = util.nullThrows( - current.parent, - util.NullThrowsReasons.MissingParent, - ); + ({ + expressionCount, + previousLeftText, + optionallyChainedCode, + previous, + current, + } = normalizeRepeatingPatterns( + rightText, + expressionCount, + previousLeftText, + optionallyChainedCode, + previous, + current, + )); } - if (expressionCount > 1) { - if (previous.right.type === AST_NODE_TYPES.BinaryExpression) { - // case like foo && foo.bar !== someValue - optionallyChainedCode += ` ${ - previous.right.operator - } ${sourceCode.getText(previous.right.right)}`; - } - - context.report({ - node: previous, - messageId: 'preferOptionalChain', - suggest: [ - { - messageId: 'optionalChainSuggest', - fix: (fixer): TSESLint.RuleFix[] => [ - fixer.replaceText(previous, optionallyChainedCode), - ], - }, - ], - }); - } + reportIfMoreThanOne({ + expressionCount, + previous, + optionallyChainedCode, + sourceCode, + context, + shouldHandleChainedAnds: true, + }); }, }; + interface BreakIfInvalidResult { + leftText: string; + rightText: string; + shouldBreak: boolean; + } + + interface BreakIfInvalidOptions { + previousLeftText: string; + rightNode: ValidChainTarget; + } + + function breakIfInvalid({ + previousLeftText, + rightNode, + }: BreakIfInvalidOptions): BreakIfInvalidResult { + let shouldBreak = false; + + const rightText = getText(rightNode); + // can't just use startsWith because of cases like foo && fooBar.baz; + const matchRegex = new RegExp( + `^${ + // escape regex characters + previousLeftText.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + }[^a-zA-Z0-9_$]`, + ); + if ( + !matchRegex.test(rightText) && + // handle redundant cases like foo.bar && foo.bar + previousLeftText !== rightText + ) { + shouldBreak = true; + } + return { shouldBreak, leftText: previousLeftText, rightText }; + } + function getText(node: ValidChainTarget): string { if (node.type === AST_NODE_TYPES.BinaryExpression) { return getText( @@ -285,6 +347,10 @@ export default util.createRule({ return node.name; } + if (node.type === AST_NODE_TYPES.MetaProperty) { + return `${node.meta.name}.${node.property.name}`; + } + if (node.type === AST_NODE_TYPES.ThisExpression) { return 'this'; } @@ -299,6 +365,11 @@ export default util.createRule({ return getText(node.expression); } + if (node.object.type === AST_NODE_TYPES.TSNonNullExpression) { + // Not supported mixing with TSNonNullExpression + return ''; + } + return getMemberExpressionText(node); } @@ -319,6 +390,7 @@ export default util.createRule({ objectText = getMemberExpressionText(node.object); break; + case AST_NODE_TYPES.MetaProperty: case AST_NODE_TYPES.ThisExpression: objectText = getText(node.object); break; @@ -338,6 +410,7 @@ export default util.createRule({ case AST_NODE_TYPES.Literal: case AST_NODE_TYPES.TemplateLiteral: + case AST_NODE_TYPES.BinaryExpression: propertyText = sourceCode.getText(node.property); break; @@ -378,6 +451,7 @@ const ALLOWED_MEMBER_OBJECT_TYPES: ReadonlySet = new Set([ AST_NODE_TYPES.Identifier, AST_NODE_TYPES.MemberExpression, AST_NODE_TYPES.ThisExpression, + AST_NODE_TYPES.MetaProperty, ]); const ALLOWED_COMPUTED_PROP_TYPES: ReadonlySet = new Set([ AST_NODE_TYPES.Identifier, @@ -389,6 +463,132 @@ const ALLOWED_NON_COMPUTED_PROP_TYPES: ReadonlySet = new Set([ AST_NODE_TYPES.Identifier, ]); +interface ReportIfMoreThanOneOptions { + expressionCount: number; + previous: TSESTree.LogicalExpression; + optionallyChainedCode: string; + sourceCode: Readonly; + context: Readonly< + TSESLint.RuleContext< + 'preferOptionalChain' | 'optionalChainSuggest', + never[] + > + >; + shouldHandleChainedAnds: boolean; +} + +function reportIfMoreThanOne({ + expressionCount, + previous, + optionallyChainedCode, + sourceCode, + context, + shouldHandleChainedAnds, +}: ReportIfMoreThanOneOptions): void { + if (expressionCount > 1) { + if ( + shouldHandleChainedAnds && + previous.right.type === AST_NODE_TYPES.BinaryExpression + ) { + // case like foo && foo.bar !== someValue + optionallyChainedCode += ` ${ + previous.right.operator + } ${sourceCode.getText(previous.right.right)}`; + } + + context.report({ + node: previous, + messageId: 'preferOptionalChain', + suggest: [ + { + messageId: 'optionalChainSuggest', + fix: (fixer): TSESLint.RuleFix[] => [ + fixer.replaceText( + previous, + `${shouldHandleChainedAnds ? '' : '!'}${optionallyChainedCode}`, + ), + ], + }, + ], + }); + } +} + +interface NormalizedPattern { + expressionCount: number; + previousLeftText: string; + optionallyChainedCode: string; + previous: TSESTree.LogicalExpression; + current: TSESTree.Node; +} + +function normalizeRepeatingPatterns( + rightText: string, + expressionCount: number, + previousLeftText: string, + optionallyChainedCode: string, + previous: TSESTree.Node, + current: TSESTree.Node, +): NormalizedPattern { + const leftText = previousLeftText; + // omit weird doubled up expression that make no sense like foo.bar && foo.bar + if (rightText !== previousLeftText) { + expressionCount += 1; + previousLeftText = rightText; + + /* + Diff the left and right text to construct the fix string + There are the following cases: + + 1) + rightText === 'foo.bar.baz.buzz' + leftText === 'foo.bar.baz' + diff === '.buzz' + + 2) + rightText === 'foo.bar.baz.buzz()' + leftText === 'foo.bar.baz' + diff === '.buzz()' + + 3) + rightText === 'foo.bar.baz.buzz()' + leftText === 'foo.bar.baz.buzz' + diff === '()' + + 4) + rightText === 'foo.bar.baz[buzz]' + leftText === 'foo.bar.baz' + diff === '[buzz]' + + 5) + rightText === 'foo.bar.baz?.buzz' + leftText === 'foo.bar.baz' + diff === '?.buzz' + */ + const diff = rightText.replace(leftText, ''); + if (diff.startsWith('?')) { + // item was "pre optional chained" + optionallyChainedCode += diff; + } else { + const needsDot = diff.startsWith('(') || diff.startsWith('['); + optionallyChainedCode += `?${needsDot ? '.' : ''}${diff}`; + } + } + + previous = current as TSESTree.LogicalExpression; + current = util.nullThrows( + current.parent, + util.NullThrowsReasons.MissingParent, + ); + return { + expressionCount, + previousLeftText, + optionallyChainedCode, + previous, + current, + }; +} + function isValidChainTarget( node: TSESTree.Node, allowIdentifier: boolean, @@ -420,7 +620,8 @@ function isValidChainTarget( if ( allowIdentifier && (node.type === AST_NODE_TYPES.Identifier || - node.type === AST_NODE_TYPES.ThisExpression) + node.type === AST_NODE_TYPES.ThisExpression || + node.type === AST_NODE_TYPES.MetaProperty) ) { return true; } diff --git a/packages/eslint-plugin/src/rules/prefer-readonly.ts b/packages/eslint-plugin/src/rules/prefer-readonly.ts index 3a1cd3f42f6..3a9e6cdca66 100644 --- a/packages/eslint-plugin/src/rules/prefer-readonly.ts +++ b/packages/eslint-plugin/src/rules/prefer-readonly.ts @@ -119,7 +119,10 @@ export default util.createRule({ ts.isArrayLiteralExpression(parent.parent)) ) { current = parent; - } else if (ts.isBinaryExpression(parent)) { + } else if ( + ts.isBinaryExpression(parent) && + !ts.isPropertyAccessExpression(current) + ) { return ( parent.left === current && parent.operatorToken.kind === ts.SyntaxKind.EqualsToken diff --git a/packages/eslint-plugin/src/rules/promise-function-async.ts b/packages/eslint-plugin/src/rules/promise-function-async.ts index ba3c3d9478f..4387bc52c9b 100644 --- a/packages/eslint-plugin/src/rules/promise-function-async.ts +++ b/packages/eslint-plugin/src/rules/promise-function-async.ts @@ -175,7 +175,10 @@ export default util.createRule({ } // if current token is a keyword like `static` or `public` then skip it - while (keyToken.type === AST_TOKEN_TYPES.Keyword) { + while ( + keyToken.type === AST_TOKEN_TYPES.Keyword && + keyToken.range[0] < method.key.range[0] + ) { keyToken = sourceCode.getTokenAfter(keyToken)!; } diff --git a/packages/eslint-plugin/src/rules/restrict-plus-operands.ts b/packages/eslint-plugin/src/rules/restrict-plus-operands.ts index a4cc0374395..ad5d0a832b7 100644 --- a/packages/eslint-plugin/src/rules/restrict-plus-operands.ts +++ b/packages/eslint-plugin/src/rules/restrict-plus-operands.ts @@ -22,7 +22,7 @@ export default util.createRule({ type: 'problem', docs: { description: - 'Require both operands of addition to have type `number` or `string`', + 'Require both operands of addition to be the same type and be `bigint`, `number`, or `string`', recommended: 'error', requiresTypeChecking: true, }, diff --git a/packages/eslint-plugin/src/rules/sort-type-constituents.ts b/packages/eslint-plugin/src/rules/sort-type-constituents.ts new file mode 100644 index 00000000000..848b2ce0722 --- /dev/null +++ b/packages/eslint-plugin/src/rules/sort-type-constituents.ts @@ -0,0 +1,269 @@ +import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; +import { AST_NODE_TYPES } from '@typescript-eslint/utils'; + +import * as util from '../util'; +import { getEnumNames, typeNodeRequiresParentheses } from '../util'; + +enum Group { + conditional = 'conditional', + function = 'function', + import = 'import', + intersection = 'intersection', + keyword = 'keyword', + nullish = 'nullish', + literal = 'literal', + named = 'named', + object = 'object', + operator = 'operator', + tuple = 'tuple', + union = 'union', +} + +function getGroup(node: TSESTree.TypeNode): Group { + switch (node.type) { + case AST_NODE_TYPES.TSConditionalType: + return Group.conditional; + + case AST_NODE_TYPES.TSConstructorType: + case AST_NODE_TYPES.TSFunctionType: + return Group.function; + + case AST_NODE_TYPES.TSImportType: + return Group.import; + + case AST_NODE_TYPES.TSIntersectionType: + return Group.intersection; + + case AST_NODE_TYPES.TSAnyKeyword: + case AST_NODE_TYPES.TSBigIntKeyword: + case AST_NODE_TYPES.TSBooleanKeyword: + case AST_NODE_TYPES.TSNeverKeyword: + case AST_NODE_TYPES.TSNumberKeyword: + case AST_NODE_TYPES.TSObjectKeyword: + case AST_NODE_TYPES.TSStringKeyword: + case AST_NODE_TYPES.TSSymbolKeyword: + case AST_NODE_TYPES.TSThisType: + case AST_NODE_TYPES.TSUnknownKeyword: + case AST_NODE_TYPES.TSIntrinsicKeyword: + return Group.keyword; + + case AST_NODE_TYPES.TSNullKeyword: + case AST_NODE_TYPES.TSUndefinedKeyword: + case AST_NODE_TYPES.TSVoidKeyword: + return Group.nullish; + + case AST_NODE_TYPES.TSLiteralType: + case AST_NODE_TYPES.TSTemplateLiteralType: + return Group.literal; + + case AST_NODE_TYPES.TSArrayType: + case AST_NODE_TYPES.TSIndexedAccessType: + case AST_NODE_TYPES.TSInferType: + case AST_NODE_TYPES.TSTypeReference: + case AST_NODE_TYPES.TSQualifiedName: + return Group.named; + + case AST_NODE_TYPES.TSMappedType: + case AST_NODE_TYPES.TSTypeLiteral: + return Group.object; + + case AST_NODE_TYPES.TSTypeOperator: + case AST_NODE_TYPES.TSTypeQuery: + return Group.operator; + + case AST_NODE_TYPES.TSTupleType: + return Group.tuple; + + case AST_NODE_TYPES.TSUnionType: + return Group.union; + + // These types should never occur as part of a union/intersection + case AST_NODE_TYPES.TSAbstractKeyword: + case AST_NODE_TYPES.TSAsyncKeyword: + case AST_NODE_TYPES.TSDeclareKeyword: + case AST_NODE_TYPES.TSExportKeyword: + case AST_NODE_TYPES.TSNamedTupleMember: + case AST_NODE_TYPES.TSOptionalType: + case AST_NODE_TYPES.TSPrivateKeyword: + case AST_NODE_TYPES.TSProtectedKeyword: + case AST_NODE_TYPES.TSPublicKeyword: + case AST_NODE_TYPES.TSReadonlyKeyword: + case AST_NODE_TYPES.TSRestType: + case AST_NODE_TYPES.TSStaticKeyword: + case AST_NODE_TYPES.TSTypePredicate: + /* istanbul ignore next */ + throw new Error(`Unexpected Type ${node.type}`); + } +} + +export type Options = [ + { + checkIntersections?: boolean; + checkUnions?: boolean; + groupOrder?: string[]; + }, +]; +export type MessageIds = 'notSorted' | 'notSortedNamed' | 'suggestFix'; + +export default util.createRule({ + name: 'sort-type-constituents', + meta: { + type: 'suggestion', + docs: { + description: + 'Enforce constituents of a type union/intersection to be sorted alphabetically', + recommended: false, + }, + fixable: 'code', + hasSuggestions: true, + messages: { + notSorted: '{{type}} type constituents must be sorted.', + notSortedNamed: '{{type}} type {{name}} constituents must be sorted.', + suggestFix: 'Sort constituents of type (removes all comments).', + }, + schema: [ + { + type: 'object', + properties: { + checkIntersections: { + description: 'Whether to check intersection types.', + type: 'boolean', + }, + checkUnions: { + description: 'Whether to check union types.', + type: 'boolean', + }, + groupOrder: { + description: 'Ordering of the groups.', + type: 'array', + items: { + type: 'string', + enum: getEnumNames(Group), + }, + }, + }, + }, + ], + }, + defaultOptions: [ + { + checkIntersections: true, + checkUnions: true, + groupOrder: [ + Group.named, + Group.keyword, + Group.operator, + Group.literal, + Group.function, + Group.import, + Group.conditional, + Group.object, + Group.tuple, + Group.intersection, + Group.union, + Group.nullish, + ], + }, + ], + create(context, [{ checkIntersections, checkUnions, groupOrder }]) { + const sourceCode = context.getSourceCode(); + + const collator = new Intl.Collator('en', { + sensitivity: 'base', + numeric: true, + }); + + function checkSorting( + node: TSESTree.TSIntersectionType | TSESTree.TSUnionType, + ): void { + const sourceOrder = node.types.map(type => { + const group = groupOrder?.indexOf(getGroup(type)) ?? -1; + return { + group: group === -1 ? Number.MAX_SAFE_INTEGER : group, + node: type, + text: sourceCode.getText(type), + }; + }); + const expectedOrder = [...sourceOrder].sort((a, b) => { + if (a.group !== b.group) { + return a.group - b.group; + } + + return ( + collator.compare(a.text, b.text) || + (a.text < b.text ? -1 : a.text > b.text ? 1 : 0) + ); + }); + + const hasComments = node.types.some(type => { + const count = + sourceCode.getCommentsBefore(type).length + + sourceCode.getCommentsAfter(type).length; + return count > 0; + }); + + for (let i = 0; i < expectedOrder.length; i += 1) { + if (expectedOrder[i].node !== sourceOrder[i].node) { + let messageId: MessageIds = 'notSorted'; + const data = { + name: '', + type: + node.type === AST_NODE_TYPES.TSIntersectionType + ? 'Intersection' + : 'Union', + }; + if (node.parent?.type === AST_NODE_TYPES.TSTypeAliasDeclaration) { + messageId = 'notSortedNamed'; + data.name = node.parent.id.name; + } + + const fix: TSESLint.ReportFixFunction = fixer => { + const sorted = expectedOrder + .map(t => + typeNodeRequiresParentheses(t.node, t.text) || + (node.type === AST_NODE_TYPES.TSIntersectionType && + t.node.type === AST_NODE_TYPES.TSUnionType) + ? `(${t.text})` + : t.text, + ) + .join( + node.type === AST_NODE_TYPES.TSIntersectionType ? ' & ' : ' | ', + ); + + return fixer.replaceText(node, sorted); + }; + return context.report({ + node, + messageId, + data, + // don't autofix if any of the types have leading/trailing comments + // the logic for preserving them correctly is a pain - we may implement this later + ...(hasComments + ? { + suggest: [ + { + messageId: 'suggestFix', + fix, + }, + ], + } + : { fix }), + }); + } + } + } + + return { + ...(checkIntersections && { + TSIntersectionType(node): void { + checkSorting(node); + }, + }), + ...(checkUnions && { + TSUnionType(node): void { + checkSorting(node); + }, + }), + }; + }, +}); diff --git a/packages/eslint-plugin/src/rules/sort-type-union-intersection-members.ts b/packages/eslint-plugin/src/rules/sort-type-union-intersection-members.ts index ded7212c6c9..cbfa7a51594 100644 --- a/packages/eslint-plugin/src/rules/sort-type-union-intersection-members.ts +++ b/packages/eslint-plugin/src/rules/sort-type-union-intersection-members.ts @@ -2,7 +2,7 @@ import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import * as util from '../util'; -import { getEnumNames } from '../util'; +import { getEnumNames, typeNodeRequiresParentheses } from '../util'; enum Group { conditional = 'conditional', @@ -60,6 +60,7 @@ function getGroup(node: TSESTree.TypeNode): Group { case AST_NODE_TYPES.TSIndexedAccessType: case AST_NODE_TYPES.TSInferType: case AST_NODE_TYPES.TSTypeReference: + case AST_NODE_TYPES.TSQualifiedName: return Group.named; case AST_NODE_TYPES.TSMappedType: @@ -95,13 +96,6 @@ function getGroup(node: TSESTree.TypeNode): Group { } } -function requiresParentheses(node: TSESTree.TypeNode): boolean { - return ( - node.type === AST_NODE_TYPES.TSFunctionType || - node.type === AST_NODE_TYPES.TSConstructorType - ); -} - export type Options = [ { checkIntersections?: boolean; @@ -114,6 +108,7 @@ export type MessageIds = 'notSorted' | 'notSortedNamed' | 'suggestFix'; export default util.createRule({ name: 'sort-type-union-intersection-members', meta: { + deprecated: true, type: 'suggestion', docs: { description: @@ -127,6 +122,7 @@ export default util.createRule({ notSortedNamed: '{{type}} type {{name}} members must be sorted.', suggestFix: 'Sort members of type (removes all comments).', }, + replacedBy: ['@typescript-eslint/sort-type-constituents'], schema: [ { type: 'object', @@ -225,7 +221,13 @@ export default util.createRule({ const fix: TSESLint.ReportFixFunction = fixer => { const sorted = expectedOrder - .map(t => (requiresParentheses(t.node) ? `(${t.text})` : t.text)) + .map(t => + typeNodeRequiresParentheses(t.node, t.text) || + (node.type === AST_NODE_TYPES.TSIntersectionType && + t.node.type === AST_NODE_TYPES.TSUnionType) + ? `(${t.text})` + : t.text, + ) .join( node.type === AST_NODE_TYPES.TSIntersectionType ? ' & ' : ' | ', ); diff --git a/packages/eslint-plugin/src/rules/space-before-blocks.ts b/packages/eslint-plugin/src/rules/space-before-blocks.ts index 569be350cd7..5f16929aa52 100644 --- a/packages/eslint-plugin/src/rules/space-before-blocks.ts +++ b/packages/eslint-plugin/src/rules/space-before-blocks.ts @@ -29,9 +29,8 @@ export default util.createRule({ }, }, defaultOptions: ['always'], - create(context) { + create(context, [config]) { const rules = baseRule.create(context); - const config = context.options[0]; const sourceCode = context.getSourceCode(); let requireSpace = true; diff --git a/packages/eslint-plugin/src/util/misc.ts b/packages/eslint-plugin/src/util/misc.ts index 2bdc8ee0f59..fa9c5ccf528 100644 --- a/packages/eslint-plugin/src/util/misc.ts +++ b/packages/eslint-plugin/src/util/misc.ts @@ -180,6 +180,41 @@ function formatWordList(words: string[]): string { return [words.slice(0, -1).join(', '), words.slice(-1)[0]].join(' and '); } +/** + * Iterates the array in reverse and returns the index of the first element it + * finds which passes the predicate function. + * + * @returns Returns the index of the element if it finds it or -1 otherwise. + */ +function findLastIndex( + members: T[], + predicate: (member: T) => boolean | undefined | null, +): number { + let idx = members.length - 1; + + while (idx >= 0) { + const valid = predicate(members[idx]); + if (valid) { + return idx; + } + idx--; + } + + return -1; +} + +function typeNodeRequiresParentheses( + node: TSESTree.TypeNode, + text: string, +): boolean { + return ( + node.type === AST_NODE_TYPES.TSFunctionType || + node.type === AST_NODE_TYPES.TSConstructorType || + (node.type === AST_NODE_TYPES.TSUnionType && text.startsWith('|')) || + (node.type === AST_NODE_TYPES.TSIntersectionType && text.startsWith('&')) + ); +} + export { arrayGroupByToMap, arraysAreEqual, @@ -193,5 +228,7 @@ export { isDefinitionFile, MemberNameType, RequireKeys, + typeNodeRequiresParentheses, upperCaseFirst, + findLastIndex, }; diff --git a/packages/eslint-plugin/tests/RuleTester.ts b/packages/eslint-plugin/tests/RuleTester.ts index 7479d99f29a..7c46b9a12f5 100644 --- a/packages/eslint-plugin/tests/RuleTester.ts +++ b/packages/eslint-plugin/tests/RuleTester.ts @@ -6,5 +6,10 @@ function getFixturesRootDir(): string { } const { batchedSingleLineTests, RuleTester, noFormat } = ESLintUtils; +export { + RunTests, + ValidTestCase, + InvalidTestCase, +} from '@typescript-eslint/utils/dist/eslint-utils/rule-tester/RuleTester'; export { batchedSingleLineTests, getFixturesRootDir, noFormat, RuleTester }; diff --git a/packages/eslint-plugin/tests/docs.test.ts b/packages/eslint-plugin/tests/docs.test.ts index 9442ed366a3..e7872a962c9 100644 --- a/packages/eslint-plugin/tests/docs.test.ts +++ b/packages/eslint-plugin/tests/docs.test.ts @@ -26,11 +26,15 @@ function tokenIs( return token.type === type; } -function tokenIsH2(token: marked.Token): token is marked.Tokens.Heading { +function tokenIsHeading(token: marked.Token): token is marked.Tokens.Heading { + return tokenIs(token, 'heading'); +} + +function tokenIsH2( + token: marked.Token, +): token is marked.Tokens.Heading & { depth: 2 } { return ( - tokenIs(token, 'heading') && - token.depth === 2 && - !/[a-z]+: /.test(token.text) + tokenIsHeading(token) && token.depth === 2 && !/[a-z]+: /.test(token.text) ); } @@ -93,6 +97,23 @@ describe('Validating rule docs', () => { expect(header.text).toBe(titleCase(header.text)), ); }); + + const importantHeadings = new Set([ + 'How to Use', + 'Options', + 'Related To', + 'When Not To Use It', + ]); + + test('important headings must be h2s', () => { + const headers = tokens.filter(tokenIsHeading); + + for (const header of headers) { + if (importantHeadings.has(header.raw.replace(/#/g, '').trim())) { + expect(header.depth).toBe(2); + } + } + }); }); } }); diff --git a/packages/eslint-plugin/tests/rules/adjacent-overload-signatures.test.ts b/packages/eslint-plugin/tests/rules/adjacent-overload-signatures.test.ts index 12cf859a84a..9a20771b4af 100644 --- a/packages/eslint-plugin/tests/rules/adjacent-overload-signatures.test.ts +++ b/packages/eslint-plugin/tests/rules/adjacent-overload-signatures.test.ts @@ -250,12 +250,64 @@ class Test { '#private'(): void; '#private'(arg: number): void {} +} + `, + // block statement + ` +function wrap() { + function foo(s: string); + function foo(n: number); + function foo(sn: string | number) {} +} + `, + ` +if (true) { + function foo(s: string); + function foo(n: number); + function foo(sn: string | number) {} } `, ], invalid: [ { code: ` +function wrap() { + function foo(s: string); + function foo(n: number); + type bar = number; + function foo(sn: string | number) {} +} + `, + errors: [ + { + messageId: 'adjacentSignature', + data: { name: 'foo' }, + line: 6, + column: 3, + }, + ], + }, + { + code: ` +if (true) { + function foo(s: string); + function foo(n: number); + let a = 1; + function foo(sn: string | number) {} + foo(a); +} + `, + errors: [ + { + messageId: 'adjacentSignature', + data: { name: 'foo' }, + line: 6, + column: 3, + }, + ], + }, + { + code: ` export function foo(s: string); export function foo(n: number); export function bar(): void {} diff --git a/packages/eslint-plugin/tests/rules/array-type.test.ts b/packages/eslint-plugin/tests/rules/array-type.test.ts index c32da51cc08..04ab47d0b8a 100644 --- a/packages/eslint-plugin/tests/rules/array-type.test.ts +++ b/packages/eslint-plugin/tests/rules/array-type.test.ts @@ -1982,6 +1982,61 @@ class Foo extends Bar implements Baz { } `, ); + testOutput( + 'array', + ` +interface WorkingArray { + outerProperty: Array< + { innerPropertyOne: string } & { innerPropertyTwo: string } + >; +} + +interface BrokenArray { + outerProperty: Array< + ({ innerPropertyOne: string } & { innerPropertyTwo: string }) + >; +} + `, + ` +interface WorkingArray { + outerProperty: ({ innerPropertyOne: string } & { innerPropertyTwo: string })[]; +} + +interface BrokenArray { + outerProperty: ({ innerPropertyOne: string } & { innerPropertyTwo: string })[]; +} + `, + ); + testOutput( + 'array', + ` +type WorkingArray = { + outerProperty: Array< + { innerPropertyOne: string } & { innerPropertyTwo: string } + >; +} + +type BrokenArray = { + outerProperty: Array< + ({ innerPropertyOne: string } & { innerPropertyTwo: string }) + >; +} + `, + ` +type WorkingArray = { + outerProperty: ({ innerPropertyOne: string } & { innerPropertyTwo: string })[]; +} + +type BrokenArray = { + outerProperty: ({ innerPropertyOne: string } & { innerPropertyTwo: string })[]; +} + `, + ); + testOutput( + 'array', + 'const a: Array<(string|number)>;', + 'const a: (string|number)[];', + ); testOutput( 'array-simple', 'let xx: Array> = [[1, 2], [3]];', diff --git a/packages/eslint-plugin/tests/rules/consistent-indexed-object-style.test.ts b/packages/eslint-plugin/tests/rules/consistent-indexed-object-style.test.ts index 5c59f92b92d..6bdc76362e0 100644 --- a/packages/eslint-plugin/tests/rules/consistent-indexed-object-style.test.ts +++ b/packages/eslint-plugin/tests/rules/consistent-indexed-object-style.test.ts @@ -39,7 +39,16 @@ interface Foo { [key: string]: Foo; } `, - + ` +interface Foo { + [key: string]: Foo; +} + `, + ` +interface Foo { + [key: string]: Foo | string; +} + `, // Type literal 'type Foo = {};', ` @@ -328,6 +337,17 @@ type Foo = Readonly>; }, { code: ` +interface Foo { + [k: string]: T; +} + `, + output: ` +type Foo = Record; + `, + errors: [{ messageId: 'preferRecord', line: 2, column: 1 }], + }, + { + code: ` interface Foo { [k: string]: A.Foo; } 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 518050bebcf..e5f7bfbc2d3 100644 --- a/packages/eslint-plugin/tests/rules/consistent-type-exports.test.ts +++ b/packages/eslint-plugin/tests/rules/consistent-type-exports.test.ts @@ -266,6 +266,9 @@ export { type T, T }; type T = 1; export type { T, T }; `, + dependencyConstraints: { + typescript: '4.5', + }, errors: [ { messageId: 'typeOverValue', @@ -283,6 +286,9 @@ export { type/* */T, type /* */T, T }; type T = 1; export type { /* */T, /* */T, T }; `, + dependencyConstraints: { + typescript: '4.5', + }, errors: [ { messageId: 'typeOverValue', @@ -303,6 +309,9 @@ const x = 1; export type { T, T }; export { x }; `, + dependencyConstraints: { + typescript: '4.5', + }, errors: [ { messageId: 'singleExportIsType', @@ -322,6 +331,9 @@ type T = 1; const x = 1; export { type T, x }; `, + dependencyConstraints: { + typescript: '4.5', + }, options: [{ fixMixedExportsWithInlineTypeSpecifier: true }], errors: [ { @@ -340,6 +352,9 @@ export { type T, T }; type T = 1; export type { T, T }; `, + dependencyConstraints: { + typescript: '4.5', + }, options: [{ fixMixedExportsWithInlineTypeSpecifier: true }], errors: [ { @@ -362,6 +377,9 @@ export { export type { AnalyzeOptions, Definition as Foo, BlockScope as BScope } from '@typescript-eslint/scope-manager'; export { CatchScope as CScope } from '@typescript-eslint/scope-manager'; `, + dependencyConstraints: { + typescript: '4.5', + }, options: [{ fixMixedExportsWithInlineTypeSpecifier: false }], errors: [ { @@ -388,6 +406,9 @@ export { CatchScope as CScope, } from '@typescript-eslint/scope-manager'; `, + dependencyConstraints: { + typescript: '4.5', + }, options: [{ fixMixedExportsWithInlineTypeSpecifier: true }], errors: [ { diff --git a/packages/eslint-plugin/tests/rules/consistent-type-imports.test.ts b/packages/eslint-plugin/tests/rules/consistent-type-imports.test.ts index b1389b26e6b..2d41b0c3f98 100644 --- a/packages/eslint-plugin/tests/rules/consistent-type-imports.test.ts +++ b/packages/eslint-plugin/tests/rules/consistent-type-imports.test.ts @@ -7,6 +7,10 @@ const ruleTester = new RuleTester({ ecmaVersion: 2020, sourceType: 'module', }, + // type-only imports were first added in TS3.8 + dependencyConstraints: { + typescript: '3.8', + }, }); const withMetaParserOptions = { @@ -118,11 +122,83 @@ ruleTester.run('consistent-type-imports', rule, { `, options: [{ prefer: 'no-type-imports' }], }, + ` + import { type A } from 'foo'; + type T = A; + `, ` import { type A, B } from 'foo'; type T = A; const b = B; `, + ` + import { type A, type B } from 'foo'; + type T = A; + type Z = B; + `, + ` + import { B } from 'foo'; + import { type A } from 'foo'; + type T = A; + const b = B; + `, + { + code: ` + import { B, type A } from 'foo'; + type T = A; + const b = B; + `, + options: [{ fixStyle: 'inline-type-imports' }], + }, + { + code: ` + import { B } from 'foo'; + import type A from 'baz'; + type T = A; + const b = B; + `, + options: [{ fixStyle: 'inline-type-imports' }], + }, + { + code: ` + import { type B } from 'foo'; + import type { A } from 'foo'; + type T = A; + const b = B; + `, + options: [{ fixStyle: 'inline-type-imports' }], + }, + { + code: ` + import { B, type C } from 'foo'; + import type A from 'baz'; + type T = A; + type Z = C; + const b = B; + `, + options: [{ prefer: 'type-imports', fixStyle: 'inline-type-imports' }], + }, + { + code: ` + import { B } from 'foo'; + import type { A } from 'foo'; + type T = A; + const b = B; + `, + options: [{ prefer: 'type-imports', fixStyle: 'inline-type-imports' }], + }, + { + code: ` + import { B } from 'foo'; + import { A } from 'foo'; + type T = A; + const b = B; + `, + options: [{ prefer: 'no-type-imports', fixStyle: 'inline-type-imports' }], + dependencyConstraints: { + typescript: '4.5', + }, + }, // exports ` import Type from 'foo'; @@ -512,6 +588,24 @@ export type Y = { }, ], }, + { + code: ` + import Foo from 'foo'; + let foo: Foo; + `, + output: ` + import type Foo from 'foo'; + let foo: Foo; + `, + options: [{ prefer: 'type-imports', fixStyle: 'inline-type-imports' }], + errors: [ + { + messageId: 'typeOverValue', + line: 2, + column: 9, + }, + ], + }, { code: ` import { A, B } from 'foo'; @@ -1804,6 +1898,9 @@ import { A, B } from 'foo'; type T = A; const b = B; `, + dependencyConstraints: { + typescript: '4.5', + }, options: [{ prefer: 'no-type-imports' }], errors: [ { @@ -1824,6 +1921,9 @@ import { B, type C } from 'foo'; type T = A | C; const b = B; `, + dependencyConstraints: { + typescript: '4.5', + }, options: [{ prefer: 'type-imports' }], errors: [ { @@ -1833,5 +1933,277 @@ const b = B; }, ], }, + + // inline-type-imports + { + code: ` + import { A, B } from 'foo'; + let foo: A; + let bar: B; + `, + output: ` + import { type A, type B } from 'foo'; + let foo: A; + let bar: B; + `, + options: [{ prefer: 'type-imports', fixStyle: 'inline-type-imports' }], + errors: [ + { + messageId: 'typeOverValue', + line: 2, + column: 9, + }, + ], + }, + { + code: ` + import { A, B } from 'foo'; + + let foo: A; + B(); + `, + output: ` + import { type A, B } from 'foo'; + + let foo: A; + B(); + `, + options: [{ prefer: 'type-imports', fixStyle: 'inline-type-imports' }], + errors: [ + { + messageId: 'aImportIsOnlyTypes', + line: 2, + column: 9, + }, + ], + }, + { + code: ` + import { A, B } from 'foo'; + type T = A; + B(); + `, + output: ` + import { type A, B } from 'foo'; + type T = A; + B(); + `, + options: [{ prefer: 'type-imports', fixStyle: 'inline-type-imports' }], + errors: [ + { + messageId: 'aImportIsOnlyTypes', + line: 2, + column: 9, + }, + ], + }, + { + code: ` + import { A } from 'foo'; + import { B } from 'foo'; + type T = A; + type U = B; + `, + output: ` + import { type A } from 'foo'; + import { type B } from 'foo'; + type T = A; + type U = B; + `, + options: [{ prefer: 'type-imports', fixStyle: 'inline-type-imports' }], + errors: [ + { + messageId: 'typeOverValue', + line: 2, + column: 9, + }, + { + messageId: 'typeOverValue', + line: 3, + column: 9, + }, + ], + }, + { + code: ` + import { A } from 'foo'; + import B from 'foo'; + type T = A; + type U = B; + `, + output: ` + import { type A } from 'foo'; + import type B from 'foo'; + type T = A; + type U = B; + `, + options: [{ prefer: 'type-imports', fixStyle: 'inline-type-imports' }], + errors: [ + { + messageId: 'typeOverValue', + line: 2, + column: 9, + }, + { + messageId: 'typeOverValue', + line: 3, + column: 9, + }, + ], + }, + { + code: ` +import A, { B, C } from 'foo'; +type T = B; +type U = C; +A(); + `, + output: ` +import A, { type B, type C } from 'foo'; +type T = B; +type U = C; +A(); + `, + options: [{ prefer: 'type-imports', fixStyle: 'inline-type-imports' }], + errors: [ + { + messageId: 'someImportsAreOnlyTypes', + line: 2, + column: 1, + }, + ], + }, + { + code: ` +import A, { B, C } from 'foo'; +type T = B; +type U = C; +type V = A; + `, + output: ` +import {type B, type C} from 'foo'; +import type A from 'foo'; +type T = B; +type U = C; +type V = A; + `, + options: [{ prefer: 'type-imports', fixStyle: 'inline-type-imports' }], + errors: [ + { + messageId: 'typeOverValue', + line: 2, + column: 1, + }, + ], + }, + { + code: ` +import A, { B, C as D } from 'foo'; +type T = B; +type U = D; +type V = A; + `, + output: ` +import {type B, type C as D} from 'foo'; +import type A from 'foo'; +type T = B; +type U = D; +type V = A; + `, + options: [{ prefer: 'type-imports', fixStyle: 'inline-type-imports' }], + errors: [ + { + messageId: 'typeOverValue', + line: 2, + column: 1, + }, + ], + }, + { + code: ` + import { /* comment */ A, B } from 'foo'; + type T = A; + `, + output: ` + import { /* comment */ type A, B } from 'foo'; + type T = A; + `, + options: [{ prefer: 'type-imports', fixStyle: 'inline-type-imports' }], + errors: [ + { + messageId: 'aImportIsOnlyTypes', + line: 2, + column: 9, + }, + ], + }, + { + code: ` + import { B, /* comment */ A } from 'foo'; + type T = A; + `, + output: ` + import { B, /* comment */ type A } from 'foo'; + type T = A; + `, + options: [{ prefer: 'type-imports', fixStyle: 'inline-type-imports' }], + errors: [ + { + messageId: 'aImportIsOnlyTypes', + line: 2, + column: 9, + }, + ], + }, + { + code: ` +import { A, B, C } from 'foo'; +import type { D } from 'deez'; + +const foo: A = B(); +let bar: C; +let baz: D; + `, + output: ` +import { type A, B, type C } from 'foo'; +import type { D } from 'deez'; + +const foo: A = B(); +let bar: C; +let baz: D; + `, + options: [{ prefer: 'type-imports', fixStyle: 'inline-type-imports' }], + errors: [ + { + messageId: 'someImportsAreOnlyTypes', + line: 2, + column: 1, + }, + ], + }, + { + code: ` +import { A, B, type C } from 'foo'; +import type { D } from 'deez'; +const foo: A = B(); +let bar: C; +let baz: D; + `, + output: ` +import { type A, B, type C } from 'foo'; +import type { D } from 'deez'; +const foo: A = B(); +let bar: C; +let baz: D; + `, + options: [{ prefer: 'type-imports', fixStyle: 'inline-type-imports' }], + errors: [ + { + messageId: 'aImportIsOnlyTypes', + line: 2, + column: 1, + }, + ], + }, ], }); diff --git a/packages/eslint-plugin/tests/rules/keyword-spacing.test.ts b/packages/eslint-plugin/tests/rules/keyword-spacing.test.ts index c2694829b35..58c740fbd5c 100644 --- a/packages/eslint-plugin/tests/rules/keyword-spacing.test.ts +++ b/packages/eslint-plugin/tests/rules/keyword-spacing.test.ts @@ -114,6 +114,126 @@ ruleTester.run('keyword-spacing', rule, { options: [{ overrides: { as: {} } }], parserOptions: { ecmaVersion: 6, sourceType: 'module' }, }, + { + code: 'import type { foo } from "foo";', + options: [BOTH], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + }, + { + code: "import type * as Foo from 'foo'", + options: [BOTH], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + }, + { + code: 'import type { SavedQueries } from "./SavedQueries.js";', + options: [ + { + before: true, + after: false, + overrides: { + else: { after: true }, + return: { after: true }, + try: { after: true }, + catch: { after: false }, + case: { after: true }, + const: { after: true }, + throw: { after: true }, + let: { after: true }, + do: { after: true }, + of: { after: true }, + as: { after: true }, + finally: { after: true }, + from: { after: true }, + import: { after: true }, + export: { after: true }, + default: { after: true }, + // The new option: + type: { after: true }, + }, + }, + ], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + }, + { + // Space after import is not configurable from option since it's invalid syntax with import type + code: 'import type { SavedQueries } from "./SavedQueries.js";', + options: [ + { + before: true, + after: true, + overrides: { + import: { after: false }, + }, + }, + ], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + }, + { + code: "import type{SavedQueries} from './SavedQueries.js';", + options: [ + { + before: true, + after: false, + overrides: { + from: { after: true }, + }, + }, + ], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + }, + { + code: "import type{SavedQueries} from'./SavedQueries.js';", + options: [ + { + before: true, + after: false, + }, + ], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + }, + { + code: "import type http from 'node:http';", + options: [ + { + before: true, + after: false, + overrides: { + from: { after: true }, + }, + }, + ], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + }, + { + code: "import type http from'node:http';", + options: [ + { + before: true, + after: false, + }, + ], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + }, + { + code: 'import type {} from "foo";', + options: [BOTH], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + }, + { + code: 'import type { foo1, foo2 } from "foo";', + options: [BOTH], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + }, + { + code: 'import type { foo1 as _foo1, foo2 as _foo2 } from "foo";', + options: [BOTH], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + }, + { + code: 'import type { foo as bar } from "foo";', + options: [BOTH], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + }, ], invalid: [ //---------------------------------------------------------------------- @@ -152,5 +272,63 @@ ruleTester.run('keyword-spacing', rule, { parserOptions: { ecmaVersion: 6, sourceType: 'module' }, errors: expectedAfter('as'), }, + { + code: 'import type{ foo } from "foo";', + output: 'import type { foo } from "foo";', + options: [{ after: true, before: true }], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + errors: expectedAfter('type'), + }, + { + code: 'import type { foo } from"foo";', + output: 'import type{ foo } from"foo";', + options: [{ after: false, before: true }], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + errors: unexpectedAfter('type'), + }, + { + code: 'import type* as foo from "foo";', + output: 'import type * as foo from "foo";', + options: [{ after: true, before: true }], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + errors: expectedAfter('type'), + }, + { + code: 'import type * as foo from"foo";', + output: 'import type* as foo from"foo";', + options: [{ after: false, before: true }], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + errors: unexpectedAfter('type'), + }, + { + code: "import type {SavedQueries} from './SavedQueries.js';", + output: "import type{SavedQueries} from './SavedQueries.js';", + options: [ + { + before: true, + after: false, + overrides: { + from: { after: true }, + }, + }, + ], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + errors: unexpectedAfter('type'), + }, + { + code: "import type {SavedQueries} from './SavedQueries.js';", + output: "import type{SavedQueries} from'./SavedQueries.js';", + options: [ + { + before: true, + after: false, + }, + ], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + errors: [ + { messageId: 'unexpectedAfter', data: { value: 'type' } }, + { messageId: 'unexpectedAfter', data: { value: 'from' } }, + ], + }, ], }); diff --git a/packages/eslint-plugin/tests/rules/member-ordering.test.ts b/packages/eslint-plugin/tests/rules/member-ordering.test.ts index 68bbfa7eff6..3305bebfa8c 100644 --- a/packages/eslint-plugin/tests/rules/member-ordering.test.ts +++ b/packages/eslint-plugin/tests/rules/member-ordering.test.ts @@ -1,130 +1,132 @@ -import type { TSESLint } from '@typescript-eslint/utils'; - import type { MessageIds, Options } from '../../src/rules/member-ordering'; import rule from '../../src/rules/member-ordering'; +import type { RunTests } from '../RuleTester'; import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', }); -const grouped: TSESLint.RunTests = { +const grouped: RunTests = { valid: [ ` // no accessibility === public interface Foo { - [Z: string]: any; - A: string; - B: string; - C: string; - D: string; - E: string; - F: string; - new(); - G(); - H(); - I(); - J(); - K(); - L(); + [Z: string]: any; + A: string; + B: string; + C: string; + D: string; + E: string; + F: string; + new (); + G(); + H(); + I(); + J(); + K(); + L(); } - `, + `, { + dependencyConstraints: { + typescript: '4.5', + }, code: ` // no accessibility === public interface Foo { - A: string; - J(); - K(); - D: string; - E: string; - F: string; - new(); - G(); - H(); - [Z: string]: any; - B: string; - C: string; - I(); - L(); + A: string; + J(); + K(); + D: string; + E: string; + F: string; + new (); + G(); + H(); + [Z: string]: any; + B: string; + C: string; + I(); + L(); } - `, + `, options: [{ default: 'never' }], }, { code: ` // no accessibility === public interface Foo { - [Z: string]: any; - A: string; - B: string; - C: string; - D: string; - E: string; - F: string; - new(); - G(); - H(); - I(); - J(); - K(); - L(); + [Z: string]: any; + A: string; + B: string; + C: string; + D: string; + E: string; + F: string; + new (); + G(); + H(); + I(); + J(); + K(); + L(); } - `, + `, options: [{ default: ['signature', 'field', 'constructor', 'method'] }], }, { code: ` interface X { (): void; - a: unknown; + a: unknown; b(): void; } - `, + `, options: [{ default: ['call-signature', 'field', 'method'] }], }, { code: ` // no accessibility === public interface Foo { - A: string; - J(); - K(); - D: string; - [Z: string]: any; - E: string; - F: string; - new(); - G(); - B: string; - C: string; - H(); - I(); - L(); + A: string; + J(); + K(); + D: string; + [Z: string]: any; + E: string; + F: string; + new (); + G(); + B: string; + C: string; + H(); + I(); + L(); } - `, + `, options: [{ interfaces: 'never' }], }, { code: ` // no accessibility === public interface Foo { - [Z: string]: any; - G(); - H(); - I(); - J(); - K(); - L(); - new(); - A: string; - B: string; - C: string; - D: string; - E: string; - F: string; + [Z: string]: any; + G(); + H(); + I(); + J(); + K(); + L(); + new (); + A: string; + B: string; + C: string; + D: string; + E: string; + F: string; } - `, + `, options: [ { interfaces: ['signature', 'method', 'constructor', 'field'] }, ], @@ -133,22 +135,22 @@ interface Foo { code: ` // no accessibility === public interface Foo { - G(); - H(); - I(); - J(); - K(); - L(); - new(); - A: string; - B: string; - C: string; - D: string; - E: string; - F: string; - [Z: string]: any; + G(); + H(); + I(); + J(); + K(); + L(); + new (); + A: string; + B: string; + C: string; + D: string; + E: string; + F: string; + [Z: string]: any; } - `, + `, options: [ { default: ['signature', 'field', 'constructor', 'method'], @@ -160,23 +162,23 @@ interface Foo { code: ` // no accessibility === public interface Foo { - G(); - H(); - I(); - new(); - [Z: string]: any; - D: string; - E: string; - F: string; - G?: string; - J(); - K(); - L(); - A: string; - B: string; - C: string; + G(); + H(); + I(); + new (); + [Z: string]: any; + D: string; + E: string; + F: string; + G?: string; + J(); + K(); + L(); + A: string; + B: string; + C: string; } - `, + `, options: [ { default: [ @@ -191,22 +193,22 @@ interface Foo { code: ` // no accessibility === public interface Foo { - G(); - H(); - I(); - J(); - K(); - L(); - [Z: string]: any; - D: string; - E: string; - F: string; - new(); - A: string; - B: string; - C: string; + G(); + H(); + I(); + J(); + K(); + L(); + [Z: string]: any; + D: string; + E: string; + F: string; + new (); + A: string; + B: string; + C: string; } - `, + `, options: [ { default: ['method', 'public-constructor', 'protected-static-field'], @@ -216,147 +218,147 @@ interface Foo { ` // no accessibility === public type Foo = { - [Z: string]: any; - A: string; - B: string; - C: string; - D: string; - E: string; - F: string; - new(); - G(); - H(); - I(); - J(); - K(); - L(); -} - `, + [Z: string]: any; + A: string; + B: string; + C: string; + D: string; + E: string; + F: string; + new (); + G(); + H(); + I(); + J(); + K(); + L(); +}; + `, { code: ` // no accessibility === public type Foo = { - A: string; - B: string; - C: string; - D: string; - E: string; - F: string; - [Z: string]: any; - G(); - H(); - I(); - J(); - K(); - L(); -} - `, + A: string; + B: string; + C: string; + D: string; + E: string; + F: string; + [Z: string]: any; + G(); + H(); + I(); + J(); + K(); + L(); +}; + `, options: [{ default: 'never' }], }, { code: ` // no accessibility === public type Foo = { - [Z: string]: any; - A: string; - B: string; - C: string; - D: string; - E: string; - F: string; - G(); - H(); - I(); - J(); - K(); - L(); -} - `, + [Z: string]: any; + A: string; + B: string; + C: string; + D: string; + E: string; + F: string; + G(); + H(); + I(); + J(); + K(); + L(); +}; + `, options: [{ default: ['signature', 'field', 'constructor', 'method'] }], }, { code: ` // no accessibility === public type Foo = { - [Z: string]: any; - new(); - A: string; - B: string; - C: string; - D: string; - E: string; - F: string; - G(); - H(); - I(); - J(); - K(); - L(); -} - `, + [Z: string]: any; + new (); + A: string; + B: string; + C: string; + D: string; + E: string; + F: string; + G(); + H(); + I(); + J(); + K(); + L(); +}; + `, options: [{ default: ['field', 'method'] }], }, { code: ` // no accessibility === public type Foo = { - G(); - H(); - [Z: string]: any; - K(); - L(); - A: string; - B: string; - I(); - J(); - C: string; - D: string; - E: string; - F: string; -} - `, + G(); + H(); + [Z: string]: any; + K(); + L(); + A: string; + B: string; + I(); + J(); + C: string; + D: string; + E: string; + F: string; +}; + `, options: [{ typeLiterals: 'never' }], }, { code: ` // no accessibility === public type Foo = { - G(); - H(); - I(); - J(); - K(); - L(); - A: string; - B: string; - C: string; - D: string; - E: string; - F: string; - [Z: string]: any; -} - `, + G(); + H(); + I(); + J(); + K(); + L(); + A: string; + B: string; + C: string; + D: string; + E: string; + F: string; + [Z: string]: any; +}; + `, options: [{ typeLiterals: ['method', 'field', 'signature'] }], }, { code: ` // no accessibility === public type Foo = { - G(); - H(); - I(); - J(); - K(); - L(); - A: string; - B: string; - C: string; - D: string; - E: string; - F: string; - [Z: string]: any; -} - `, + G(); + H(); + I(); + J(); + K(); + L(); + A: string; + B: string; + C: string; + D: string; + E: string; + F: string; + [Z: string]: any; +}; + `, options: [ { typeLiterals: ['method', 'constructor', 'field', 'signature'] }, ], @@ -365,21 +367,21 @@ type Foo = { code: ` // no accessibility === public type Foo = { - G(); - H(); - I(); - J(); - K(); - L(); - A: string; - B: string; - C: string; - D: string; - E: string; - F: string; - [Z: string]: any; -} - `, + G(); + H(); + I(); + J(); + K(); + L(); + A: string; + B: string; + C: string; + D: string; + E: string; + F: string; + [Z: string]: any; +}; + `, options: [ { default: ['signature', 'field', 'constructor', 'method'], @@ -391,21 +393,21 @@ type Foo = { code: ` // no accessibility === public type Foo = { - [Z: string]: any; - D: string; - E: string; - F: string; - A: string; - B: string; - C: string; - G(); - H(); - I(); - J(); - K(); - L(); -} - `, + [Z: string]: any; + D: string; + E: string; + F: string; + A: string; + B: string; + C: string; + G(); + H(); + I(); + J(); + K(); + L(); +}; + `, options: [ { default: [ @@ -419,182 +421,202 @@ type Foo = { }, ` class Foo { - [Z: string]: any; - public static A: string; - protected static B: string = ""; - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - private F: string = ""; - constructor() {} - public static G() {} - protected static H() {} - private static I() {} - public J() {} - protected K() {} - private L() {} + [Z: string]: any; + public static A: string; + protected static B: string = ''; + private static C: string = ''; + static #C: string = ''; + public D: string = ''; + protected E: string = ''; + private F: string = ''; + #F: string = ''; + constructor() {} + public static G() {} + protected static H() {} + private static I() {} + static #I() {} + public J() {} + protected K() {} + private L() {} + #L() {} } - `, + `, { code: ` class Foo { - [Z: string]: any; - public static A: string; - protected static B: string = ""; - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - private F: string = ""; - constructor() {} - public static G() {} - protected static H() {} - private static I() {} - public J() {} - protected K() {} - private L() {} + [Z: string]: any; + public static A: string; + protected static B: string = ''; + private static C: string = ''; + static #C: string = ''; + public D: string = ''; + protected E: string = ''; + private F: string = ''; + #F: string = ''; + constructor() {} + public static G() {} + protected static H() {} + private static I() {} + static #I() {} + public J() {} + protected K() {} + private L() {} + #L() {} } - `, + `, options: [{ default: 'never' }], }, { code: ` class Foo { - [Z: string]: any; - public static A: string; - protected static B: string = ""; - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - private F: string = ""; - constructor() {} - public static G() {} - protected static H() {} - private static I() {} - public J() {} - protected K() {} - private L() {} + [Z: string]: any; + public static A: string; + protected static B: string = ''; + private static C: string = ''; + static #C: string = ''; + public D: string = ''; + protected E: string = ''; + private F: string = ''; + #F: string = ''; + constructor() {} + public static G() {} + protected static H() {} + private static I() {} + static #I() {} + public J() {} + protected K() {} + private L() {} + #L() {} } - `, + `, options: [{ default: ['signature', 'field', 'constructor', 'method'] }], }, { code: ` class Foo { - [Z: string]: any; - constructor() {} - public static A: string; - protected static B: string = ""; - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - private F: string = ""; - public static G() {} - protected static H() {} - private static I() {} - public J() {} - protected K() {} - private L() {} + [Z: string]: any; + constructor() {} + public static A: string; + protected static B: string = ''; + private static C: string = ''; + static #C: string = ''; + public D: string = ''; + protected E: string = ''; + private F: string = ''; + #F: string = ''; + public static G() {} + protected static H() {} + private static I() {} + static #I() {} + public J() {} + protected K() {} + private L() {} + #L() {} } - `, + `, options: [{ default: ['field', 'method'] }], }, { code: ` class Foo { - public static G() {} - protected K() {} - private L() {} - private static I() {} - public J() {} - public D: string = ""; - [Z: string]: any; - protected static H() {} - public static A: string; - protected static B: string = ""; - constructor() {} - private static C: string = ""; - protected E: string = ""; - private F: string = ""; + public static G() {} + protected K() {} + private L() {} + private static I() {} + public J() {} + public D: string = ''; + [Z: string]: any; + protected static H() {} + public static A: string; + protected static B: string = ''; + constructor() {} + private static C: string = ''; + protected E: string = ''; + private F: string = ''; } - `, + `, options: [{ classes: 'never' }], }, { code: ` class Foo { - public static G() {} - protected static H() {} - private static I() {} - public J() {} - protected K() {} - private L() {} - [Z: string]: any; - public static A: string; - protected static B: string = ""; - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - private F: string = ""; - constructor() {} + public static G() {} + protected static H() {} + private static I() {} + static #I() {} + public J() {} + protected K() {} + private L() {} + #L() {} + [Z: string]: any; + public static A: string; + protected static B: string = ''; + private static C: string = ''; + static #C: string = ''; + public D: string = ''; + protected E: string = ''; + private F: string = ''; + #F: string = ''; + constructor() {} } - `, + `, options: [{ classes: ['method', 'field'] }], }, { code: ` class Foo { - public static G() {} - protected static H() {} - private static I() {} - public J() {} - protected K() {} - private L() {} - constructor() {} - public static A: string; - protected static B: string = ""; - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - private F: string = ""; - [Z: string]: any; + public static G() {} + protected static H() {} + private static I() {} + public J() {} + protected K() {} + private L() {} + constructor() {} + public static A: string; + protected static B: string = ''; + private static C: string = ''; + public D: string = ''; + protected E: string = ''; + private F: string = ''; + [Z: string]: any; } - `, + `, options: [{ classes: ['method', 'constructor', 'field', 'signature'] }], }, { code: ` class Foo { - private required: boolean; - private typeChecker: (data: any) => boolean; - constructor(validator: (data: any) => boolean) { - this.typeChecker = validator; - } - check(data: any): boolean { - return this.typeChecker(data); - } + private required: boolean; + private typeChecker: (data: any) => boolean; + constructor(validator: (data: any) => boolean) { + this.typeChecker = validator; + } + check(data: any): boolean { + return this.typeChecker(data); + } } - `, + `, options: [{ classes: ['field', 'constructor', 'method'] }], }, { code: ` class Foo { - public static G() {} - protected static H() {} - private static I() {} - public J() {} - protected K() {} - private L() {} - constructor() {} - public static A: string; - protected static B: string = ""; - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - private F: string = ""; - [Z: string]: any; + public static G() {} + protected static H() {} + private static I() {} + public J() {} + protected K() {} + private L() {} + constructor() {} + public static A: string; + protected static B: string = ''; + private static C: string = ''; + public D: string = ''; + protected E: string = ''; + private F: string = ''; + [Z: string]: any; } - `, + `, options: [ { default: ['signature', 'field', 'constructor', 'method'], @@ -605,22 +627,24 @@ class Foo { { code: ` class Foo { - public J() {} - public static G() {} - protected static H() {} - private static I() {} - protected K() {} - private L() {} - [Z: string]: any; - constructor() {} - public D: string = ""; - public static A: string; - private static C: string = ""; - private F: string = ""; - protected static B: string = ""; - protected E: string = ""; + public J() {} + public static G() {} + protected static H() {} + private static I() {} + protected K() {} + private L() {} + [Z: string]: any; + constructor() {} + public D: string = ''; + public static A: string; + private static C: string = ''; + private F: string = ''; + static #M: string = ''; + #N: string = ''; + protected static B: string = ''; + protected E: string = ''; } - `, + `, options: [ { classes: [ @@ -629,6 +653,7 @@ class Foo { 'constructor', 'public-field', 'private-field', + '#private-field', 'protected-field', ], }, @@ -637,22 +662,23 @@ class Foo { { code: ` class Foo { - public static G() {} - private static I() {} - protected static H() {} - public J() {} - private L() {} - protected K() {} - [Z: string]: any; - constructor() {} - public D: string = ""; - public static A: string; - protected static B: string = ""; - protected E: string = ""; - private static C: string = ""; - private F: string = ""; + public static G() {} + private static I() {} + protected static H() {} + public J() {} + private L() {} + protected K() {} + [Z: string]: any; + constructor() {} + public D: string = ''; + public static A: string; + protected static B: string = ''; + protected E: string = ''; + private static C: string = ''; + private F: string = ''; + #M: string = ''; } - `, + `, options: [ { classes: [ @@ -665,6 +691,7 @@ class Foo { 'public-field', 'protected-field', 'private-field', + '#private-field', ], }, ], @@ -672,22 +699,26 @@ class Foo { { code: ` class Foo { - public J() {} - public static G() {} - public D: string = ""; - public static A: string = ""; - constructor() {} - protected K() {} - private L() {} - protected static H() {} - private static I() {} - protected static B: string = ""; - private static C: string = ""; - protected E: string = ""; - private F: string = ""; - [Z: string]: any; + public J() {} + public static G() {} + public D: string = ''; + public static A: string = ''; + constructor() {} + protected K() {} + private L() {} + #P() {} + protected static H() {} + private static I() {} + static #O() {} + protected static B: string = ''; + private static C: string = ''; + static #N: string = ''; + protected E: string = ''; + private F: string = ''; + #M: string = ''; + [Z: string]: any; } - `, + `, options: [ { default: [ @@ -704,30 +735,35 @@ class Foo { { code: ` class Foo { - public J() {} - public static G() {} - protected static H() {} - private static I() {} - protected K() {} - private L() {} - constructor() {} - [Z: string]: any; - public static A: string; - private F: string = ""; - protected static B: string = ""; - public D: string = ""; - private static C: string = ""; - protected E: string = ""; + public J() {} + public static G() {} + protected static H() {} + private static I() {} + static #I() {} + protected K() {} + private L() {} + #L() {} + constructor() {} + [Z: string]: any; + public static A: string; + private F: string = ''; + #F: string = ''; + protected static B: string = ''; + public D: string = ''; + private static C: string = ''; + static #C: string = ''; + protected E: string = ''; } - `, + `, options: [ { classes: [ 'public-method', 'protected-static-method', - 'private-static-method', + '#private-static-method', 'protected-instance-method', 'private-instance-method', + '#private-instance-method', 'constructor', 'signature', 'field', @@ -738,22 +774,22 @@ class Foo { { code: ` class Foo { - private L() {} - private static I() {} - protected static H() {} - protected static B: string = ""; - public static G() {} - public J() {} - protected K() {} - private static C: string = ""; - private F: string = ""; - protected E: string = ""; - public static A: string; - public D: string = ""; - constructor() {} - [Z: string]: any; + private L() {} + private static I() {} + protected static H() {} + protected static B: string = ''; + public static G() {} + public J() {} + protected K() {} + private static C: string = ''; + private F: string = ''; + protected E: string = ''; + public static A: string; + public D: string = ''; + constructor() {} + [Z: string]: any; } - `, + `, options: [ { classes: ['private-instance-method', 'protected-static-field'], @@ -763,22 +799,47 @@ class Foo { { code: ` class Foo { - private L() {} - private static I() {} - protected static H() {} - public static G() {} - public J() {} - protected static B: string = ""; - protected K() {} - private static C: string = ""; - private F: string = ""; - protected E: string = ""; - public static A: string; - public D: string = ""; - constructor() {} - [Z: string]: any; + private L() {} + private static I() {} + static #H() {} + static #B: string = ''; + public static G() {} + public J() {} + #K() {} + private static C: string = ''; + private F: string = ''; + #E: string = ''; + public static A: string; + public D: string = ''; + constructor() {} + [Z: string]: any; } - `, + `, + options: [ + { + classes: ['private-instance-method', 'protected-static-field'], + }, + ], + }, + { + code: ` +class Foo { + private L() {} + private static I() {} + protected static H() {} + public static G() {} + public J() {} + protected static B: string = ''; + protected K() {} + private static C: string = ''; + private F: string = ''; + protected E: string = ''; + public static A: string; + public D: string = ''; + constructor() {} + [Z: string]: any; +} + `, options: [ { default: ['public-instance-method', 'protected-static-field'], @@ -788,22 +849,22 @@ class Foo { { code: ` class Foo { - private L() {} - private static I() {} - protected static H() {} - public static G() {} - public J() {} - protected static B: string = ""; - protected K() {} - private static C: string = ""; - private F: string = ""; - protected E: string = ""; - public static A: string; - public D: string = ""; - constructor() {} - [Z: string]: any; + private L() {} + private static I() {} + protected static H() {} + public static G() {} + public J() {} + protected static B: string = ''; + protected K() {} + private static C: string = ''; + private F: string = ''; + protected E: string = ''; + public static A: string; + public D: string = ''; + constructor() {} + [Z: string]: any; } - `, + `, options: [ { classes: ['public-instance-method', 'protected-static-field'], @@ -813,22 +874,22 @@ class Foo { { code: ` class Foo { - [Z: string]: any; - public D: string = ""; - private L() {} - private static I() {} - protected static H() {} - public static G() {} - public J() {} - private constructor() {} - protected static B: string = ""; - protected K() {} - private static C: string = ""; - private F: string = ""; - protected E: string = ""; - public static A: string; + [Z: string]: any; + public D: string = ''; + private L() {} + private static I() {} + protected static H() {} + public static G() {} + public J() {} + private constructor() {} + protected static B: string = ''; + protected K() {} + private static C: string = ''; + private F: string = ''; + protected E: string = ''; + public static A: string; } - `, + `, options: [ { default: [ @@ -847,22 +908,22 @@ class Foo { { code: ` class Foo { - public constructor() {} - public D: string = ""; - private L() {} - private static I() {} - protected static H() {} - public static G() {} - public J() {} - [Z: string]: any; - protected static B: string = ""; - protected K() {} - private static C: string = ""; - private F: string = ""; - protected E: string = ""; - public static A: string; + public constructor() {} + public D: string = ''; + private L() {} + private static I() {} + protected static H() {} + public static G() {} + public J() {} + [Z: string]: any; + protected static B: string = ''; + protected K() {} + private static C: string = ''; + private F: string = ''; + protected E: string = ''; + public static A: string; } - `, + `, options: [ { default: [ @@ -880,146 +941,146 @@ class Foo { }, ` const foo = class Foo { - [Z: string]: any; - public static A: string; - protected static B: string = ""; - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - private F: string = ""; - constructor() {} - public static G() {} - protected static H() {} - private static I() {} - public J() {} - protected K() {} - private L() {} -} - `, + [Z: string]: any; + public static A: string; + protected static B: string = ''; + private static C: string = ''; + public D: string = ''; + protected E: string = ''; + private F: string = ''; + constructor() {} + public static G() {} + protected static H() {} + private static I() {} + public J() {} + protected K() {} + private L() {} +}; + `, { code: ` const foo = class Foo { - constructor() {} - public static A: string; - protected static B: string = ""; - private static I() {} - public J() {} - private F: string = ""; - [Z: string]: any; - public static G() {} - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - protected static H() {} - protected K() {} - private L() {} -} - `, + constructor() {} + public static A: string; + protected static B: string = ''; + private static I() {} + public J() {} + private F: string = ''; + [Z: string]: any; + public static G() {} + private static C: string = ''; + public D: string = ''; + protected E: string = ''; + protected static H() {} + protected K() {} + private L() {} +}; + `, options: [{ default: 'never' }], }, { code: ` const foo = class Foo { - [Z: string]: any; - public static A: string; - protected static B: string = ""; - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - private F: string = ""; - constructor() {} - public static G() {} - protected static H() {} - private static I() {} - public J() {} - protected K() {} - private L() {} -} - `, + [Z: string]: any; + public static A: string; + protected static B: string = ''; + private static C: string = ''; + public D: string = ''; + protected E: string = ''; + private F: string = ''; + constructor() {} + public static G() {} + protected static H() {} + private static I() {} + public J() {} + protected K() {} + private L() {} +}; + `, options: [{ default: ['signature', 'field', 'constructor', 'method'] }], }, { code: ` const foo = class Foo { - constructor() {} - public static A: string; - protected static B: string = ""; - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - private F: string = ""; - [Z: string]: any; - public static G() {} - protected static H() {} - private static I() {} - public J() {} - protected K() {} - private L() {} -} - `, + constructor() {} + public static A: string; + protected static B: string = ''; + private static C: string = ''; + public D: string = ''; + protected E: string = ''; + private F: string = ''; + [Z: string]: any; + public static G() {} + protected static H() {} + private static I() {} + public J() {} + protected K() {} + private L() {} +}; + `, options: [{ default: ['field', 'method'] }], }, { code: ` const foo = class Foo { - private L() {} - protected static H() {} - constructor() {} - private static I() {} - public J() {} - private static C: string = ""; - [Z: string]: any; - public D: string = ""; - protected K() {} - public static G() {} - public static A: string; - protected static B: string = ""; - protected E: string = ""; - private F: string = ""; -} - `, + private L() {} + protected static H() {} + constructor() {} + private static I() {} + public J() {} + private static C: string = ''; + [Z: string]: any; + public D: string = ''; + protected K() {} + public static G() {} + public static A: string; + protected static B: string = ''; + protected E: string = ''; + private F: string = ''; +}; + `, options: [{ classExpressions: 'never' }], }, { code: ` const foo = class Foo { - public static G() {} - protected static H() {} - private static I() {} - public J() {} - protected K() {} - private L() {} - public static A: string; - protected static B: string = ""; - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - private F: string = ""; - constructor() {} - [Z: string]: any; -} - `, + public static G() {} + protected static H() {} + private static I() {} + public J() {} + protected K() {} + private L() {} + public static A: string; + protected static B: string = ''; + private static C: string = ''; + public D: string = ''; + protected E: string = ''; + private F: string = ''; + constructor() {} + [Z: string]: any; +}; + `, options: [{ classExpressions: ['method', 'field'] }], }, { code: ` const foo = class Foo { - public static G() {} - protected static H() {} - private static I() {} - public J() {} - protected K() {} - private L() {} - [Z: string]: any; - constructor() {} - public static A: string; - protected static B: string = ""; - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - private F: string = ""; -} - `, + public static G() {} + protected static H() {} + private static I() {} + public J() {} + protected K() {} + private L() {} + [Z: string]: any; + constructor() {} + public static A: string; + protected static B: string = ''; + private static C: string = ''; + public D: string = ''; + protected E: string = ''; + private F: string = ''; +}; + `, options: [ { classExpressions: ['method', 'signature', 'constructor', 'field'] }, ], @@ -1027,22 +1088,22 @@ const foo = class Foo { { code: ` const foo = class Foo { - public static G() {} - protected static H() {} - private static I() {} - public J() {} - protected K() {} - private L() {} - [Z: string]: any; - constructor() {} - public static A: string; - protected static B: string = ""; - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - private F: string = ""; -} - `, + public static G() {} + protected static H() {} + private static I() {} + public J() {} + protected K() {} + private L() {} + [Z: string]: any; + constructor() {} + public static A: string; + protected static B: string = ''; + private static C: string = ''; + public D: string = ''; + protected E: string = ''; + private F: string = ''; +}; + `, options: [ { default: ['field', 'constructor', 'method'], @@ -1053,23 +1114,22 @@ const foo = class Foo { { code: ` const foo = class Foo { - [Z: string]: any; - private L() {} - private static I() {} - protected static H() {} - protected static B: string = ""; - public static G() {} - public J() {} - protected K() {} - private static C: string = ""; - private F: string = ""; - protected E: string = ""; - public static A: string; - public D: string = ""; - constructor() {} - -} - `, + [Z: string]: any; + private L() {} + private static I() {} + protected static H() {} + protected static B: string = ''; + public static G() {} + public J() {} + protected K() {} + private static C: string = ''; + private F: string = ''; + protected E: string = ''; + public static A: string; + public D: string = ''; + constructor() {} +}; + `, options: [ { classExpressions: [ @@ -1082,23 +1142,22 @@ const foo = class Foo { { code: ` const foo = class Foo { - private L() {} - private static I() {} - protected static H() {} - public static G() {} - public J() {} - [Z: string]: any; - protected static B: string = ""; - protected K() {} - private static C: string = ""; - private F: string = ""; - protected E: string = ""; - public static A: string; - public D: string = ""; - constructor() {} - -} - `, + private L() {} + private static I() {} + protected static H() {} + public static G() {} + public J() {} + [Z: string]: any; + protected static B: string = ''; + protected K() {} + private static C: string = ''; + private F: string = ''; + protected E: string = ''; + public static A: string; + public D: string = ''; + constructor() {} +}; + `, options: [ { default: ['public-instance-method', 'protected-static-field'], @@ -1108,23 +1167,22 @@ const foo = class Foo { { code: ` const foo = class Foo { - private L() {} - private static I() {} - protected static H() {} - public static G() {} - public J() {} - [Z: string]: any; - protected static B: string = ""; - protected K() {} - private static C: string = ""; - private F: string = ""; - protected E: string = ""; - public static A: string; - public D: string = ""; - constructor() {} - -} - `, + private L() {} + private static I() {} + protected static H() {} + public static G() {} + public J() {} + [Z: string]: any; + protected static B: string = ''; + protected K() {} + private static C: string = ''; + private F: string = ''; + protected E: string = ''; + public static A: string; + public D: string = ''; + constructor() {} +}; + `, options: [ { classExpressions: [ @@ -1137,22 +1195,22 @@ const foo = class Foo { { code: ` const foo = class Foo { - public D: string = ""; - private L() {} - private static I() {} - protected static H() {} - public static G() {} - public J() {} - [Z: string]: any; - private constructor() {} - protected static B: string = ""; - protected K() {} - private static C: string = ""; - private F: string = ""; - protected E: string = ""; - public static A: string; -} - `, + public D: string = ''; + private L() {} + private static I() {} + protected static H() {} + public static G() {} + public J() {} + [Z: string]: any; + private constructor() {} + protected static B: string = ''; + protected K() {} + private static C: string = ''; + private F: string = ''; + protected E: string = ''; + public static A: string; +}; + `, options: [ { default: [ @@ -1176,22 +1234,22 @@ const foo = class Foo { { code: ` const foo = class Foo { - public constructor() {} - public D: string = ""; - private L() {} - private static I() {} - protected static H() {} - public static G() {} - public J() {} - protected static B: string = ""; - protected K() {} - [Z: string]: any; - private static C: string = ""; - private F: string = ""; - protected E: string = ""; - public static A: string; -} - `, + public constructor() {} + public D: string = ''; + private L() {} + private static I() {} + protected static H() {} + public static G() {} + public J() {} + protected static B: string = ''; + protected K() {} + [Z: string]: any; + private static C: string = ''; + private F: string = ''; + protected E: string = ''; + public static A: string; +}; + `, options: [ { default: [ @@ -1214,36 +1272,36 @@ const foo = class Foo { }, ` class Foo { - [Z: string]: any; - A: string; - constructor () {} - J() {} - K = () => {} + [Z: string]: any; + A: string; + constructor() {} + J() {} + K = () => {}; } - `, + `, { code: ` class Foo { - J() {} - K = () => {} - constructor () {} - A: string; - [Z: string]: any; + J() {} + K = () => {}; + constructor() {} + A: string; + [Z: string]: any; } - `, + `, options: [{ default: ['method', 'constructor', 'field', 'signature'] }], }, { code: ` class Foo { - J() {} - K = () => {} - constructor () {} - [Z: string]: any; - A: string; - L: () => {} + J() {} + K = () => {}; + constructor() {} + [Z: string]: any; + A: string; + L: () => {}; } - `, + `, options: [{ default: ['method', 'constructor', 'signature', 'field'] }], }, { @@ -1253,7 +1311,10 @@ class Foo { m() {} f = 1; } - `, + `, + dependencyConstraints: { + typescript: '4.4', + }, options: [{ default: ['static-initialization', 'method', 'field'] }], }, { @@ -1263,7 +1324,10 @@ class Foo { f = 1; static {} } - `, + `, + dependencyConstraints: { + typescript: '4.4', + }, options: [{ default: ['method', 'field', 'static-initialization'] }], }, { @@ -1273,108 +1337,113 @@ class Foo { static {} m() {} } - `, + `, + dependencyConstraints: { + typescript: '4.4', + }, options: [{ default: ['field', 'static-initialization', 'method'] }], }, ` interface Foo { - [Z: string]: any; - A: string; - K: () => {}; - J(); + [Z: string]: any; + A: string; + K: () => {}; + J(); } - `, + `, { code: ` interface Foo { - [Z: string]: any; - J(); - K: () => {} - A: string; + [Z: string]: any; + J(); + K: () => {}; + A: string; } - `, + `, options: [{ default: ['signature', 'method', 'constructor', 'field'] }], }, ` type Foo = { - [Z: string]: any; - A: string; - K: () => {} - J(); -} - `, + [Z: string]: any; + A: string; + K: () => {}; + J(); +}; + `, { code: ` type Foo = { - J(); - [Z: string]: any; - K: () => {} - A: string; -} - `, + J(); + [Z: string]: any; + K: () => {}; + A: string; +}; + `, options: [{ default: ['method', 'constructor', 'signature', 'field'] }], }, { code: ` abstract class Foo { - B: string; - abstract A: () => {} + B: string; + abstract A: () => {}; } - `, + `, }, { code: ` interface Foo { - [A:string]: number; - public B: string; + [A: string]: number; + B: string; } - `, + `, }, { code: ` abstract class Foo { - [Z: string]: any; - private static C: string; - B: string; - private D: string; - protected static F(): {}; - public E(): {}; - public abstract A(): void; - protected abstract G(): void; + [Z: string]: any; + private static C: string; + B: string; + private D: string; + protected static F(): {}; + public E(): {}; + public abstract A(): void; + protected abstract G(): void; } - `, + `, }, { code: ` abstract class Foo { - protected typeChecker: (data: any) => boolean; - public abstract required: boolean; - abstract verify(): void; + protected typeChecker: (data: any) => boolean; + public abstract required: boolean; + abstract verify(): void; } - `, + `, options: [{ classes: ['signature', 'field', 'constructor', 'method'] }], }, { code: ` class Foo { - @Dec() B: string; - @Dec() A: string; - constructor() {} - D: string; - C: string; - E(): void; - F(): void; -} `, + @Dec() B: string; + @Dec() A: string; + constructor() {} + D: string; + C: string; + E(): void; + F(): void; +} + `, options: [{ default: ['decorated-field', 'field'] }], }, { code: ` class Foo { - A: string; - B: string; - @Dec() private C: string; - private D: string; -} `, + A: string; + B: string; + @Dec() private C: string; + private D: string; +} + `, options: [ { default: ['public-field', 'private-decorated-field', 'private-field'], @@ -1384,12 +1453,13 @@ class Foo { { code: ` class Foo { - constructor() {} - @Dec() public A(): void; - @Dec() private B: string; - private C(): void; - private D: string; -} `, + constructor() {} + @Dec() public A(): void; + @Dec() private B: string; + private C(): void; + private D: string; +} + `, options: [ { default: [ @@ -1403,12 +1473,13 @@ class Foo { { code: ` class Foo { - @Dec() private A(): void; - @Dec() private B: string; - constructor() {} - private C(): void; - private D: string; -} `, + @Dec() private A(): void; + @Dec() private B: string; + constructor() {} + private C(): void; + private D: string; +} + `, options: [ { default: [ @@ -1423,9 +1494,10 @@ class Foo { { code: ` class Foo { - public A: string; - @Dec() private B: string; -} `, + public A: string; + @Dec() private B: string; +} + `, options: [ { default: ['private-decorated-field', 'public-instance-field'], @@ -1437,12 +1509,13 @@ class Foo { { code: ` class Foo { - public A(): string; - @Dec() public B(): string; - public C(): string; + public A(): string; + @Dec() public B(): string; + public C(): string; - d: string; -} `, + d: string; +} + `, options: [ { default: ['public-method', 'field'], @@ -1452,14 +1525,15 @@ class Foo { { code: ` class Foo { - A: string; - constructor() {} - get B() {} - set B() {} - get C() {} - set C() {} - D(): void; -} `, + A: string; + constructor() {} + get B() {} + set B() {} + get C() {} + set C() {} + D(): void; +} + `, options: [ { default: ['field', 'constructor', ['get', 'set'], 'method'], @@ -1469,10 +1543,11 @@ class Foo { { code: ` class Foo { - A: string; - constructor() {} - B(): void; -} `, + A: string; + constructor() {} + B(): void; +} + `, options: [ { default: ['field', 'constructor', [], 'method'], @@ -1482,13 +1557,14 @@ class Foo { { code: ` class Foo { - A: string; - constructor() {} - @Dec() private B: string; - private C(): void; - set D() {} - E(): void; -} `, + A: string; + constructor() {} + @Dec() private B: string; + private C(): void; + set D() {} + E(): void; +} + `, options: [ { default: [ @@ -1503,42 +1579,97 @@ class Foo { { code: ` class Foo { - A: string; - constructor() {} - get B() {} - get C() {} - set B() {} - set C() {} - D(): void; -} `, + A: string; + constructor() {} + get B() {} + get C() {} + set B() {} + set C() {} + D(): void; +} + `, options: [ { default: ['field', 'constructor', ['get'], ['set'], 'method'], }, ], }, + { + name: 'with private identifier', + code: ` +// no accessibility === public +class Foo { + imPublic() {} + #imPrivate() {} +} + `, + options: [ + { + default: { + memberTypes: ['public-method', '#private-method'], + order: 'alphabetically-case-insensitive', + }, + }, + ], + }, + { + name: 'private and #private member order', + code: ` +// no accessibility === public +class Foo { + private imPrivate() {} + #imPrivate() {} +} + `, + options: [ + { + default: { + memberTypes: ['private-method', '#private-method'], + order: 'alphabetically-case-insensitive', + }, + }, + ], + }, + { + name: '#private and private member order', + code: ` +// no accessibility === public +class Foo { + #imPrivate() {} + private imPrivate() {} +} + `, + options: [ + { + default: { + memberTypes: ['#private-method', 'private-method'], + order: 'alphabetically-case-insensitive', + }, + }, + ], + }, ], invalid: [ { code: ` // no accessibility === public interface Foo { - [Z: string]: any; - A: string; - B: string; - C: string; - D: string; - E: string; - F: string; - G(); - H(); - I(); - J(); - K(); - L(); - new(); + [Z: string]: any; + A: string; + B: string; + C: string; + D: string; + E: string; + F: string; + G(); + H(); + I(); + J(); + K(); + L(); + new (); } - `, + `, errors: [ { messageId: 'incorrectGroupOrder', @@ -1547,18 +1678,18 @@ interface Foo { rank: 'method', }, line: 17, - column: 5, + column: 3, }, ], }, { code: ` interface X { - a: unknown; + a: unknown; (): void; b(): void; } - `, + `, options: [{ default: ['call-signature', 'field', 'method'] }], errors: [ { @@ -1576,22 +1707,22 @@ interface X { code: ` // no accessibility === public interface Foo { - A: string; - B: string; - C: string; - D: string; - E: string; - F: string; - G(); - H(); - I(); - J(); - K(); - L(); - new(); - [Z: string]: any; + A: string; + B: string; + C: string; + D: string; + E: string; + F: string; + G(); + H(); + I(); + J(); + K(); + L(); + new (); + [Z: string]: any; } - `, + `, options: [{ default: ['signature', 'method', 'constructor', 'field'] }], errors: [ { @@ -1601,7 +1732,7 @@ interface Foo { rank: 'field', }, line: 10, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -1610,7 +1741,7 @@ interface Foo { rank: 'field', }, line: 11, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -1619,7 +1750,7 @@ interface Foo { rank: 'field', }, line: 12, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -1628,7 +1759,7 @@ interface Foo { rank: 'field', }, line: 13, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -1637,7 +1768,7 @@ interface Foo { rank: 'field', }, line: 14, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -1646,7 +1777,7 @@ interface Foo { rank: 'field', }, line: 15, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -1655,7 +1786,7 @@ interface Foo { rank: 'field', }, line: 16, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -1664,7 +1795,7 @@ interface Foo { rank: 'field', }, line: 17, - column: 5, + column: 3, }, ], }, @@ -1672,22 +1803,22 @@ interface Foo { code: ` // no accessibility === public interface Foo { - A: string; - B: string; - C: string; - D: string; - E: string; - F: string; - G(); - H(); - I(); - J(); - K(); - L(); - new(); - [Z: string]: any; + A: string; + B: string; + C: string; + D: string; + E: string; + F: string; + G(); + H(); + I(); + J(); + K(); + L(); + new (); + [Z: string]: any; } - `, + `, options: [ { interfaces: ['method', 'signature', 'constructor', 'field'] }, ], @@ -1699,7 +1830,7 @@ interface Foo { rank: 'field', }, line: 10, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -1708,7 +1839,7 @@ interface Foo { rank: 'field', }, line: 11, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -1717,7 +1848,7 @@ interface Foo { rank: 'field', }, line: 12, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -1726,7 +1857,7 @@ interface Foo { rank: 'field', }, line: 13, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -1735,7 +1866,7 @@ interface Foo { rank: 'field', }, line: 14, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -1744,7 +1875,7 @@ interface Foo { rank: 'field', }, line: 15, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -1753,7 +1884,7 @@ interface Foo { rank: 'field', }, line: 16, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -1762,7 +1893,7 @@ interface Foo { rank: 'field', }, line: 17, - column: 5, + column: 3, }, ], }, @@ -1770,22 +1901,22 @@ interface Foo { code: ` // no accessibility === public interface Foo { - A: string; - B: string; - C: string; - D: string; - E: string; - F: string; - G(); - H(); - I(); - J(); - K(); - L(); - new(); - [Z: string]: any; + A: string; + B: string; + C: string; + D: string; + E: string; + F: string; + G(); + H(); + I(); + J(); + K(); + L(); + new (); + [Z: string]: any; } - `, + `, options: [ { default: ['field', 'method', 'constructor', 'signature'], @@ -1800,7 +1931,7 @@ interface Foo { rank: 'field', }, line: 10, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -1809,7 +1940,7 @@ interface Foo { rank: 'field', }, line: 11, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -1818,7 +1949,7 @@ interface Foo { rank: 'field', }, line: 12, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -1827,7 +1958,7 @@ interface Foo { rank: 'field', }, line: 13, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -1836,7 +1967,7 @@ interface Foo { rank: 'field', }, line: 14, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -1845,7 +1976,7 @@ interface Foo { rank: 'field', }, line: 15, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -1854,7 +1985,7 @@ interface Foo { rank: 'field', }, line: 16, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -1863,7 +1994,7 @@ interface Foo { rank: 'field', }, line: 17, - column: 5, + column: 3, }, ], }, @@ -1871,22 +2002,22 @@ interface Foo { code: ` // no accessibility === public interface Foo { - [Z: string]: any; - new(); - A: string; - G(); - B: string; - H(); - C: string; - I(); - D: string; - J(); - E: string; - K(); - F: string; - L(); + [Z: string]: any; + new (); + A: string; + G(); + B: string; + H(); + C: string; + I(); + D: string; + J(); + E: string; + K(); + F: string; + L(); } - `, + `, options: [ { interfaces: ['signature', 'constructor', 'field', 'method'], @@ -1900,7 +2031,7 @@ interface Foo { rank: 'method', }, line: 8, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -1909,7 +2040,7 @@ interface Foo { rank: 'method', }, line: 10, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -1918,7 +2049,7 @@ interface Foo { rank: 'method', }, line: 12, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -1927,7 +2058,7 @@ interface Foo { rank: 'method', }, line: 14, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -1936,7 +2067,7 @@ interface Foo { rank: 'method', }, line: 16, - column: 5, + column: 3, }, ], }, @@ -1944,22 +2075,22 @@ interface Foo { code: ` // no accessibility === public type Foo = { - [Z: string]: any; - A: string; - B: string; - C: string; - D: string; - E: string; - F: string; - G(); - H(); - I(); - J(); - K(); - L(); - new(); -} - `, + [Z: string]: any; + A: string; + B: string; + C: string; + D: string; + E: string; + F: string; + G(); + H(); + I(); + J(); + K(); + L(); + new (); +}; + `, errors: [ { messageId: 'incorrectGroupOrder', @@ -1968,7 +2099,7 @@ type Foo = { rank: 'method', }, line: 17, - column: 5, + column: 3, }, ], }, @@ -1976,22 +2107,22 @@ type Foo = { code: ` // no accessibility === public type Foo = { - A: string; - B: string; - C: string; - D: string; - E: string; - F: string; - G(); - H(); - I(); - J(); - K(); - L(); - [Z: string]: any; - new(); -} - `, + A: string; + B: string; + C: string; + D: string; + E: string; + F: string; + G(); + H(); + I(); + J(); + K(); + L(); + [Z: string]: any; + new (); +}; + `, options: [{ default: ['method', 'constructor', 'signature', 'field'] }], errors: [ { @@ -2001,7 +2132,7 @@ type Foo = { rank: 'field', }, line: 10, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2010,7 +2141,7 @@ type Foo = { rank: 'field', }, line: 11, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2019,7 +2150,7 @@ type Foo = { rank: 'field', }, line: 12, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2028,7 +2159,7 @@ type Foo = { rank: 'field', }, line: 13, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2037,7 +2168,7 @@ type Foo = { rank: 'field', }, line: 14, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2046,7 +2177,7 @@ type Foo = { rank: 'field', }, line: 15, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2055,7 +2186,7 @@ type Foo = { rank: 'field', }, line: 16, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2064,7 +2195,7 @@ type Foo = { rank: 'field', }, line: 17, - column: 5, + column: 3, }, ], }, @@ -2072,22 +2203,22 @@ type Foo = { code: ` // no accessibility === public type Foo = { - [Z: string]: any; - A: string; - B: string; - C: string; - D: string; - E: string; - F: string; - G(); - H(); - I(); - J(); - K(); - L(); - new(); -} - `, + [Z: string]: any; + A: string; + B: string; + C: string; + D: string; + E: string; + F: string; + G(); + H(); + I(); + J(); + K(); + L(); + new (); +}; + `, options: [ { typeLiterals: ['method', 'constructor', 'signature', 'field'] }, ], @@ -2099,7 +2230,7 @@ type Foo = { rank: 'signature', }, line: 11, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2108,7 +2239,7 @@ type Foo = { rank: 'signature', }, line: 12, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2117,7 +2248,7 @@ type Foo = { rank: 'signature', }, line: 13, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2126,7 +2257,7 @@ type Foo = { rank: 'signature', }, line: 14, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2135,7 +2266,7 @@ type Foo = { rank: 'signature', }, line: 15, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2144,7 +2275,7 @@ type Foo = { rank: 'signature', }, line: 16, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2153,7 +2284,7 @@ type Foo = { rank: 'signature', }, line: 17, - column: 5, + column: 3, }, ], }, @@ -2161,22 +2292,22 @@ type Foo = { code: ` // no accessibility === public type Foo = { - A: string; - B: string; - C: string; - D: string; - E: string; - F: string; - G(); - H(); - I(); - J(); - K(); - L(); - new(); - [Z: string]: any; -} - `, + A: string; + B: string; + C: string; + D: string; + E: string; + F: string; + G(); + H(); + I(); + J(); + K(); + L(); + new (); + [Z: string]: any; +}; + `, options: [ { default: ['field', 'method', 'constructor', 'signature'], @@ -2191,7 +2322,7 @@ type Foo = { rank: 'field', }, line: 10, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2200,7 +2331,7 @@ type Foo = { rank: 'field', }, line: 11, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2209,7 +2340,7 @@ type Foo = { rank: 'field', }, line: 12, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2218,7 +2349,7 @@ type Foo = { rank: 'field', }, line: 13, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2227,7 +2358,7 @@ type Foo = { rank: 'field', }, line: 14, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2236,7 +2367,7 @@ type Foo = { rank: 'field', }, line: 15, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2245,7 +2376,7 @@ type Foo = { rank: 'field', }, line: 16, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2254,7 +2385,7 @@ type Foo = { rank: 'field', }, line: 17, - column: 5, + column: 3, }, ], }, @@ -2262,22 +2393,22 @@ type Foo = { code: ` // no accessibility === public type Foo = { - new(); - [Z: string]: any; - A: string; - G(); - B: string; - H(); - C: string; - I(); - D: string; - J(); - E: string; - K(); - F: string; - L(); -} - `, + new (); + [Z: string]: any; + A: string; + G(); + B: string; + H(); + C: string; + I(); + D: string; + J(); + E: string; + K(); + F: string; + L(); +}; + `, options: [ { typeLiterals: ['constructor', 'signature', 'field', 'method'], @@ -2291,7 +2422,7 @@ type Foo = { rank: 'method', }, line: 8, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2300,7 +2431,7 @@ type Foo = { rank: 'method', }, line: 10, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2309,7 +2440,7 @@ type Foo = { rank: 'method', }, line: 12, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2318,7 +2449,7 @@ type Foo = { rank: 'method', }, line: 14, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2327,29 +2458,33 @@ type Foo = { rank: 'method', }, line: 16, - column: 5, + column: 3, }, ], }, { code: ` class Foo { - [Z: string]: any; - public static A: string = ""; - protected static B: string = ""; - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - private F: string = ""; - constructor() {} - public J() {} - protected K() {} - private L() {} - public static G() {} - protected static H() {} - private static I() {} + [Z: string]: any; + public static A: string = ''; + protected static B: string = ''; + private static C: string = ''; + static #C: string = ''; + public D: string = ''; + protected E: string = ''; + private F: string = ''; + #F: string = ''; + constructor() {} + public J() {} + protected K() {} + private L() {} + #L() {} + public static G() {} + protected static H() {} + private static I() {} + static #I() {} } - `, + `, errors: [ { messageId: 'incorrectGroupOrder', @@ -2357,8 +2492,8 @@ class Foo { name: 'G', rank: 'public instance method', }, - line: 14, - column: 5, + line: 17, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2366,8 +2501,8 @@ class Foo { name: 'H', rank: 'public instance method', }, - line: 15, - column: 5, + line: 18, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2375,30 +2510,43 @@ class Foo { name: 'I', rank: 'public instance method', }, - line: 16, - column: 5, + line: 19, + column: 3, + }, + { + messageId: 'incorrectGroupOrder', + data: { + name: 'I', + rank: 'public instance method', + }, + line: 20, + column: 3, }, ], }, { code: ` class Foo { - constructor() {} - public static A: string = ""; - protected static B: string = ""; - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - private F: string = ""; - public J() {} - protected K() {} - private L() {} - public static G() {} - protected static H() {} - private static I() {} - [Z: string]: any; + constructor() {} + public static A: string = ''; + protected static B: string = ''; + private static C: string = ''; + static #C: string = ''; + public D: string = ''; + protected E: string = ''; + private F: string = ''; + #F: string = ''; + public J() {} + protected K() {} + private L() {} + #L() {} + public static G() {} + protected static H() {} + private static I() {} + static #I() {} + [Z: string]: any; } - `, + `, options: [{ default: ['field', 'constructor', 'method', 'signature'] }], errors: [ { @@ -2408,7 +2556,7 @@ class Foo { rank: 'constructor', }, line: 4, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2417,7 +2565,7 @@ class Foo { rank: 'constructor', }, line: 5, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2426,55 +2574,73 @@ class Foo { rank: 'constructor', }, line: 6, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', data: { - name: 'D', + name: 'C', rank: 'constructor', }, line: 7, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', data: { - name: 'E', + name: 'D', rank: 'constructor', }, line: 8, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', data: { - name: 'F', + name: 'E', rank: 'constructor', }, line: 9, - column: 5, + column: 3, + }, + { + messageId: 'incorrectGroupOrder', + data: { + name: 'F', + rank: 'constructor', + }, + line: 10, + column: 3, + }, + { + messageId: 'incorrectGroupOrder', + data: { + name: 'F', + rank: 'constructor', + }, + line: 11, + column: 3, }, ], }, { code: ` class Foo { - constructor() {} - protected static B: string = ""; - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - private F: string = ""; - public static G() {} - public static A: string; - protected static H() {} - private static I() {} - public J() {} - protected K() {} - private L() {} + constructor() {} + protected static B: string = ''; + private static C: string = ''; + public D: string = ''; + protected E: string = ''; + private F: string = ''; + public static G() {} + public static A: string; + protected static H() {} + private static I() {} + public J() {} + protected K() {} + private L() {} } - `, + `, options: [{ default: ['field', 'method'] }], errors: [ { @@ -2484,28 +2650,28 @@ class Foo { rank: 'method', }, line: 10, - column: 5, + column: 3, }, ], }, { code: ` class Foo { - protected static H() {} - private static I() {} - public J() {} - protected K() {} - private L() {} - public static A: string; - public static G() {} - protected static B: string = ""; - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - private F: string = ""; - constructor() {} + protected static H() {} + private static I() {} + public J() {} + protected K() {} + private L() {} + public static A: string; + public static G() {} + protected static B: string = ''; + private static C: string = ''; + public D: string = ''; + protected E: string = ''; + private F: string = ''; + constructor() {} } - `, + `, options: [{ default: ['method', 'field'] }], errors: [ { @@ -2515,28 +2681,28 @@ class Foo { rank: 'field', }, line: 9, - column: 5, + column: 3, }, ], }, { code: ` class Foo { - public static G() {} - protected static H() {} - protected static B: string = ""; - private static I() {} - public J() {} - protected K() {} - private L() {} - public static A: string; - constructor() {} - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - private F: string = ""; + public static G() {} + protected static H() {} + protected static B: string = ''; + private static I() {} + public J() {} + protected K() {} + private L() {} + public static A: string; + constructor() {} + private static C: string = ''; + public D: string = ''; + protected E: string = ''; + private F: string = ''; } - `, + `, options: [{ classes: ['method', 'constructor', 'field'] }], errors: [ { @@ -2546,7 +2712,7 @@ class Foo { rank: 'field', }, line: 6, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2555,7 +2721,7 @@ class Foo { rank: 'field', }, line: 7, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2564,7 +2730,7 @@ class Foo { rank: 'field', }, line: 8, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2573,7 +2739,7 @@ class Foo { rank: 'field', }, line: 9, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2582,28 +2748,28 @@ class Foo { rank: 'field', }, line: 11, - column: 5, + column: 3, }, ], }, { code: ` class Foo { - public static A: string; - public static G() {} - protected static H() {} - private static I() {} - public J() {} - protected K() {} - private L() {} - constructor() {} - protected static B: string = ""; - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - private F: string = ""; + public static A: string; + public static G() {} + protected static H() {} + private static I() {} + public J() {} + protected K() {} + private L() {} + constructor() {} + protected static B: string = ''; + private static C: string = ''; + public D: string = ''; + protected E: string = ''; + private F: string = ''; } - `, + `, options: [ { default: ['field', 'constructor', 'method'], @@ -2618,7 +2784,7 @@ class Foo { rank: 'field', }, line: 4, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2627,7 +2793,7 @@ class Foo { rank: 'field', }, line: 5, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2636,7 +2802,7 @@ class Foo { rank: 'field', }, line: 6, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2645,7 +2811,7 @@ class Foo { rank: 'field', }, line: 7, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2654,7 +2820,7 @@ class Foo { rank: 'field', }, line: 8, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2663,7 +2829,7 @@ class Foo { rank: 'field', }, line: 9, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2672,30 +2838,30 @@ class Foo { rank: 'field', }, line: 10, - column: 5, + column: 3, }, ], }, { code: ` class Foo { - private L() {} - public J() {} - public static G() {} - protected static H() {} - private static I() {} - protected K() {} - constructor() {} - public D: string = ""; - private static C: string = ""; - public static A: string; - private static C: string = ""; - protected static B: string = ""; - private F: string = ""; - protected static B: string = ""; - protected E: string = ""; + private L() {} + public J() {} + public static G() {} + protected static H() {} + private static I() {} + protected K() {} + constructor() {} + public D: string = ''; + private static C: string = ''; + public static A: string; + private static C: string = ''; + protected static B: string = ''; + private F: string = ''; + protected static B: string = ''; + protected E: string = ''; } - `, + `, options: [ { classes: [ @@ -2715,7 +2881,7 @@ class Foo { rank: 'private field', }, line: 12, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2724,28 +2890,28 @@ class Foo { rank: 'protected field', }, line: 15, - column: 5, + column: 3, }, ], }, { code: ` class Foo { - public static G() {} - private static I() {} - public J() {} - protected static H() {} - private L() {} - protected K() {} - public D: string = ""; - constructor() {} - public static A: string; - protected static B: string = ""; - protected E: string = ""; - private static C: string = ""; - private F: string = ""; + public static G() {} + private static I() {} + public J() {} + protected static H() {} + private L() {} + protected K() {} + public D: string = ''; + constructor() {} + public static A: string; + protected static B: string = ''; + protected E: string = ''; + private static C: string = ''; + private F: string = ''; } - `, + `, options: [ { classes: [ @@ -2768,7 +2934,7 @@ class Foo { rank: 'public instance method', }, line: 6, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2777,28 +2943,28 @@ class Foo { rank: 'public field', }, line: 10, - column: 5, + column: 3, }, ], }, { code: ` class Foo { - public J() {} - public static G() {} - public D: string = ""; - public static A: string = ""; - private L() {} - constructor() {} - protected K() {} - protected static H() {} - private static I() {} - protected static B: string = ""; - private static C: string = ""; - protected E: string = ""; - private F: string = ""; + public J() {} + public static G() {} + public D: string = ''; + public static A: string = ''; + private L() {} + constructor() {} + protected K() {} + protected static H() {} + private static I() {} + protected static B: string = ''; + private static C: string = ''; + protected E: string = ''; + private F: string = ''; } - `, + `, options: [ { default: [ @@ -2818,28 +2984,28 @@ class Foo { rank: 'method', }, line: 8, - column: 5, + column: 3, }, ], }, { code: ` class Foo { - public J() {} - private static I() {} - public static G() {} - protected static H() {} - protected K() {} - private L() {} - constructor() {} - public static A: string; - private F: string = ""; - protected static B: string = ""; - public D: string = ""; - private static C: string = ""; - protected E: string = ""; + public J() {} + private static I() {} + public static G() {} + protected static H() {} + protected K() {} + private L() {} + constructor() {} + public static A: string; + private F: string = ''; + protected static B: string = ''; + public D: string = ''; + private static C: string = ''; + protected E: string = ''; } - `, + `, options: [ { classes: [ @@ -2861,7 +3027,7 @@ class Foo { rank: 'private static method', }, line: 5, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2870,28 +3036,28 @@ class Foo { rank: 'private static method', }, line: 6, - column: 5, + column: 3, }, ], }, { code: ` class Foo { - private static I() {} - protected static H() {} - protected static B: string = ""; - public static G() {} - public J() {} - protected K() {} - private static C: string = ""; - private L() {} - private F: string = ""; - protected E: string = ""; - public static A: string; - public D: string = ""; - constructor() {} + private static I() {} + protected static H() {} + protected static B: string = ''; + public static G() {} + public J() {} + protected K() {} + private static C: string = ''; + private L() {} + private F: string = ''; + protected E: string = ''; + public static A: string; + public D: string = ''; + constructor() {} } - `, + `, options: [ { classes: ['private-instance-method', 'protected-static-field'], @@ -2905,29 +3071,28 @@ class Foo { rank: 'protected static field', }, line: 10, - column: 5, + column: 3, }, ], }, { code: ` class Foo { - private L() {} - private static I() {} - protected static H() {} - public static G() {} - protected static B: string = ""; - public J() {} - protected K() {} - private static C: string = ""; - private F: string = ""; - protected E: string = ""; - public static A: string; - public D: string = ""; - constructor() {} - + private L() {} + private static I() {} + protected static H() {} + public static G() {} + protected static B: string = ''; + public J() {} + protected K() {} + private static C: string = ''; + private F: string = ''; + protected E: string = ''; + public static A: string; + public D: string = ''; + constructor() {} } - `, + `, options: [ { default: ['public-instance-method', 'protected-static-field'], @@ -2941,28 +3106,28 @@ class Foo { rank: 'protected static field', }, line: 8, - column: 5, + column: 3, }, ], }, { code: ` const foo = class Foo { - public static A: string = ""; - protected static B: string = ""; - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - private F: string = ""; - constructor() {} - public J() {} - protected K() {} - private L() {} - public static G() {} - protected static H() {} - private static I() {} -} - `, + public static A: string = ''; + protected static B: string = ''; + private static C: string = ''; + public D: string = ''; + protected E: string = ''; + private F: string = ''; + constructor() {} + public J() {} + protected K() {} + private L() {} + public static G() {} + protected static H() {} + private static I() {} +}; + `, errors: [ { messageId: 'incorrectGroupOrder', @@ -2971,7 +3136,7 @@ const foo = class Foo { rank: 'public instance method', }, line: 13, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2980,7 +3145,7 @@ const foo = class Foo { rank: 'public instance method', }, line: 14, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2989,29 +3154,29 @@ const foo = class Foo { rank: 'public instance method', }, line: 15, - column: 5, + column: 3, }, ], }, { code: ` const foo = class { - [Z: string]: any; - constructor() {} - public static A: string = ""; - protected static B: string = ""; - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - private F: string = ""; - public J() {} - protected K() {} - private L() {} - public static G() {} - protected static H() {} - private static I() {} -} - `, + [Z: string]: any; + constructor() {} + public static A: string = ''; + protected static B: string = ''; + private static C: string = ''; + public D: string = ''; + protected E: string = ''; + private F: string = ''; + public J() {} + protected K() {} + private L() {} + public static G() {} + protected static H() {} + private static I() {} +}; + `, options: [{ default: ['signature', 'field', 'constructor', 'method'] }], errors: [ { @@ -3021,7 +3186,7 @@ const foo = class { rank: 'constructor', }, line: 5, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -3030,7 +3195,7 @@ const foo = class { rank: 'constructor', }, line: 6, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -3039,7 +3204,7 @@ const foo = class { rank: 'constructor', }, line: 7, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -3048,7 +3213,7 @@ const foo = class { rank: 'constructor', }, line: 8, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -3057,7 +3222,7 @@ const foo = class { rank: 'constructor', }, line: 9, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -3066,29 +3231,29 @@ const foo = class { rank: 'constructor', }, line: 10, - column: 5, + column: 3, }, ], }, { code: ` const foo = class { - constructor() {} - protected static B: string = ""; - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - private F: string = ""; - [Z: string]: any; - public static G() {} - public static A: string; - protected static H() {} - private static I() {} - public J() {} - protected K() {} - private L() {} -} - `, + constructor() {} + protected static B: string = ''; + private static C: string = ''; + public D: string = ''; + protected E: string = ''; + private F: string = ''; + [Z: string]: any; + public static G() {} + public static A: string; + protected static H() {} + private static I() {} + public J() {} + protected K() {} + private L() {} +}; + `, options: [{ default: ['field', 'method'] }], errors: [ { @@ -3098,28 +3263,28 @@ const foo = class { rank: 'method', }, line: 11, - column: 5, + column: 3, }, ], }, { code: ` const foo = class { - protected static H() {} - private static I() {} - public J() {} - protected K() {} - private L() {} - public static A: string; - public static G() {} - protected static B: string = ""; - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - private F: string = ""; - constructor() {} -} - `, + protected static H() {} + private static I() {} + public J() {} + protected K() {} + private L() {} + public static A: string; + public static G() {} + protected static B: string = ''; + private static C: string = ''; + public D: string = ''; + protected E: string = ''; + private F: string = ''; + constructor() {} +}; + `, options: [{ default: ['method', 'field'] }], errors: [ { @@ -3129,29 +3294,29 @@ const foo = class { rank: 'field', }, line: 9, - column: 5, + column: 3, }, ], }, { code: ` const foo = class { - public static G() {} - protected static H() {} - protected static B: string = ""; - private static I() {} - public J() {} - protected K() {} - private L() {} - public static A: string; - constructor() {} - [Z: string]: any; - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - private F: string = ""; -} - `, + public static G() {} + protected static H() {} + protected static B: string = ''; + private static I() {} + public J() {} + protected K() {} + private L() {} + public static A: string; + constructor() {} + [Z: string]: any; + private static C: string = ''; + public D: string = ''; + protected E: string = ''; + private F: string = ''; +}; + `, options: [{ classExpressions: ['method', 'constructor', 'field'] }], errors: [ { @@ -3161,7 +3326,7 @@ const foo = class { rank: 'field', }, line: 6, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -3170,7 +3335,7 @@ const foo = class { rank: 'field', }, line: 7, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -3179,7 +3344,7 @@ const foo = class { rank: 'field', }, line: 8, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -3188,7 +3353,7 @@ const foo = class { rank: 'field', }, line: 9, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -3197,28 +3362,28 @@ const foo = class { rank: 'field', }, line: 11, - column: 5, + column: 3, }, ], }, { code: ` const foo = class { - public static A: string; - public static G() {} - protected static H() {} - private static I() {} - public J() {} - protected K() {} - private L() {} - constructor() {} - protected static B: string = ""; - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - private F: string = ""; -} - `, + public static A: string; + public static G() {} + protected static H() {} + private static I() {} + public J() {} + protected K() {} + private L() {} + constructor() {} + protected static B: string = ''; + private static C: string = ''; + public D: string = ''; + protected E: string = ''; + private F: string = ''; +}; + `, options: [ { default: ['field', 'constructor', 'method'], @@ -3233,7 +3398,7 @@ const foo = class { rank: 'field', }, line: 4, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -3242,7 +3407,7 @@ const foo = class { rank: 'field', }, line: 5, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -3251,7 +3416,7 @@ const foo = class { rank: 'field', }, line: 6, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -3260,7 +3425,7 @@ const foo = class { rank: 'field', }, line: 7, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -3269,7 +3434,7 @@ const foo = class { rank: 'field', }, line: 8, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -3278,7 +3443,7 @@ const foo = class { rank: 'field', }, line: 9, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -3287,30 +3452,30 @@ const foo = class { rank: 'field', }, line: 10, - column: 5, + column: 3, }, ], }, { code: ` const foo = class { - private L() {} - public J() {} - public static G() {} - protected static H() {} - private static I() {} - protected K() {} - constructor() {} - public D: string = ""; - private static C: string = ""; - public static A: string; - private static C: string = ""; - protected static B: string = ""; - private F: string = ""; - protected static B: string = ""; - protected E: string = ""; -} - `, + private L() {} + public J() {} + public static G() {} + protected static H() {} + private static I() {} + protected K() {} + constructor() {} + public D: string = ''; + private static C: string = ''; + public static A: string; + private static C: string = ''; + protected static B: string = ''; + private F: string = ''; + protected static B: string = ''; + protected E: string = ''; +}; + `, options: [ { classExpressions: [ @@ -3330,7 +3495,7 @@ const foo = class { rank: 'private field', }, line: 12, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -3339,28 +3504,28 @@ const foo = class { rank: 'protected field', }, line: 15, - column: 5, + column: 3, }, ], }, { code: ` const foo = class { - public static G() {} - private static I() {} - public J() {} - protected static H() {} - private L() {} - protected K() {} - public D: string = ""; - constructor() {} - public static A: string; - protected static B: string = ""; - protected E: string = ""; - private static C: string = ""; - private F: string = ""; -} - `, + public static G() {} + private static I() {} + public J() {} + protected static H() {} + private L() {} + protected K() {} + public D: string = ''; + constructor() {} + public static A: string; + protected static B: string = ''; + protected E: string = ''; + private static C: string = ''; + private F: string = ''; +}; + `, options: [ { classExpressions: [ @@ -3383,7 +3548,7 @@ const foo = class { rank: 'public instance method', }, line: 6, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -3392,28 +3557,28 @@ const foo = class { rank: 'public field', }, line: 10, - column: 5, + column: 3, }, ], }, { code: ` const foo = class { - public J() {} - public static G() {} - public D: string = ""; - public static A: string = ""; - private L() {} - constructor() {} - protected K() {} - protected static H() {} - private static I() {} - protected static B: string = ""; - private static C: string = ""; - protected E: string = ""; - private F: string = ""; -} - `, + public J() {} + public static G() {} + public D: string = ''; + public static A: string = ''; + private L() {} + constructor() {} + protected K() {} + protected static H() {} + private static I() {} + protected static B: string = ''; + private static C: string = ''; + protected E: string = ''; + private F: string = ''; +}; + `, options: [ { default: [ @@ -3433,28 +3598,28 @@ const foo = class { rank: 'method', }, line: 8, - column: 5, + column: 3, }, ], }, { code: ` const foo = class { - public J() {} - private static I() {} - public static G() {} - protected static H() {} - protected K() {} - private L() {} - constructor() {} - public static A: string; - private F: string = ""; - protected static B: string = ""; - public D: string = ""; - private static C: string = ""; - protected E: string = ""; -} - `, + public J() {} + private static I() {} + public static G() {} + protected static H() {} + protected K() {} + private L() {} + constructor() {} + public static A: string; + private F: string = ''; + protected static B: string = ''; + public D: string = ''; + private static C: string = ''; + protected E: string = ''; +}; + `, options: [ { classExpressions: [ @@ -3476,7 +3641,7 @@ const foo = class { rank: 'private static method', }, line: 5, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -3485,29 +3650,28 @@ const foo = class { rank: 'private static method', }, line: 6, - column: 5, + column: 3, }, ], }, { code: ` const foo = class { - private static I() {} - protected static H() {} - protected static B: string = ""; - public static G() {} - public J() {} - protected K() {} - private static C: string = ""; - private L() {} - private F: string = ""; - protected E: string = ""; - public static A: string; - public D: string = ""; - constructor() {} - -} - `, + private static I() {} + protected static H() {} + protected static B: string = ''; + public static G() {} + public J() {} + protected K() {} + private static C: string = ''; + private L() {} + private F: string = ''; + protected E: string = ''; + public static A: string; + public D: string = ''; + constructor() {} +}; + `, options: [ { classExpressions: [ @@ -3524,29 +3688,28 @@ const foo = class { rank: 'protected static field', }, line: 10, - column: 5, + column: 3, }, ], }, { code: ` const foo = class { - private L() {} - private static I() {} - protected static H() {} - public static G() {} - protected static B: string = ""; - public J() {} - protected K() {} - private static C: string = ""; - private F: string = ""; - protected E: string = ""; - public static A: string; - public D: string = ""; - constructor() {} - -} - `, + private L() {} + private static I() {} + protected static H() {} + public static G() {} + protected static B: string = ''; + public J() {} + protected K() {} + private static C: string = ''; + private F: string = ''; + protected E: string = ''; + public static A: string; + public D: string = ''; + constructor() {} +}; + `, options: [ { default: ['public-instance-method', 'protected-static-field'], @@ -3560,20 +3723,20 @@ const foo = class { rank: 'protected static field', }, line: 8, - column: 5, + column: 3, }, ], }, { code: ` class Foo { - K = () => {} - A: string; - constructor () {} - [Z: string]: any; - J() {} + K = () => {}; + A: string; + constructor() {} + [Z: string]: any; + J() {} } - `, + `, errors: [ { messageId: 'incorrectGroupOrder', @@ -3582,7 +3745,7 @@ class Foo { rank: 'public instance method', }, line: 4, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -3591,7 +3754,7 @@ class Foo { rank: 'public instance method', }, line: 5, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -3600,20 +3763,20 @@ class Foo { rank: 'public instance method', }, line: 6, - column: 5, + column: 3, }, ], }, { code: ` class Foo { - J() {} - constructor () {} - K = () => {} - A: string; - [Z: string]: any; + J() {} + constructor() {} + K = () => {}; + A: string; + [Z: string]: any; } - `, + `, options: [{ default: ['method', 'constructor', 'field', 'signature'] }], errors: [ { @@ -3623,20 +3786,20 @@ class Foo { rank: 'constructor', }, line: 5, - column: 5, + column: 3, }, ], }, { code: ` class Foo { - J() {} - constructor () {} - K = () => {} - L: () => {} - A: string; + J() {} + constructor() {} + K = () => {}; + L: () => {}; + A: string; } - `, + `, options: [{ default: ['method', 'constructor', 'field'] }], errors: [ { @@ -3646,18 +3809,18 @@ class Foo { rank: 'constructor', }, line: 5, - column: 5, + column: 3, }, ], }, { code: ` interface Foo { - K: () => {} - J(); - A: string; + K: () => {}; + J(); + A: string; } - `, + `, errors: [ { messageId: 'incorrectGroupOrder', @@ -3666,18 +3829,18 @@ interface Foo { rank: 'method', }, line: 5, - column: 5, + column: 3, }, ], }, { code: ` type Foo = { - K: () => {} - J(); - A: string; -} - `, + K: () => {}; + J(); + A: string; +}; + `, errors: [ { messageId: 'incorrectGroupOrder', @@ -3686,18 +3849,18 @@ type Foo = { rank: 'method', }, line: 5, - column: 5, + column: 3, }, ], }, { code: ` type Foo = { - A: string; - K: () => {} - J(); -} - `, + A: string; + K: () => {}; + J(); +}; + `, options: [{ default: ['method', 'constructor', 'field'] }], errors: [ { @@ -3707,17 +3870,17 @@ type Foo = { rank: 'field', }, line: 5, - column: 5, + column: 3, }, ], }, { code: ` abstract class Foo { - abstract A(): void; - B: string; + abstract A(): void; + B: string; } - `, + `, errors: [ { messageId: 'incorrectGroupOrder', @@ -3726,17 +3889,17 @@ abstract class Foo { rank: 'public abstract method', }, line: 4, - column: 5, + column: 3, }, ], }, { code: ` abstract class Foo { - abstract A: () => {}; - B: string; + abstract A: () => {}; + B: string; } - `, + `, errors: [ { messageId: 'incorrectGroupOrder', @@ -3745,20 +3908,20 @@ abstract class Foo { rank: 'public abstract field', }, line: 4, - column: 5, + column: 3, }, ], }, { code: ` abstract class Foo { - abstract A: () => {}; - B: string; - public C() {}; - private D() {}; - abstract E() {}; + abstract A: () => {}; + B: string; + public C() {} + private D() {} + abstract E() {} } - `, + `, errors: [ { messageId: 'incorrectGroupOrder', @@ -3767,19 +3930,19 @@ abstract class Foo { rank: 'public abstract field', }, line: 4, - column: 5, + column: 3, }, ], }, { code: ` class Foo { - C: number; - [A:string]: number; - public static D(): {}; - private static [B:string]: number; + C: number; + [A: string]: number; + public static D(): {}; + private static [B: string]: number; } - `, + `, options: [ { default: [ @@ -3799,18 +3962,18 @@ class Foo { rank: 'signature', }, line: 5, - column: 5, + column: 3, }, ], }, { code: ` abstract class Foo { - abstract B: string; - abstract A(): void; - public C(): {}; + abstract B: string; + abstract A(): void; + public C(): {}; } - `, + `, options: [{ default: ['method', 'constructor', 'field'] }], errors: [ { @@ -3820,7 +3983,7 @@ abstract class Foo { rank: 'field', }, line: 4, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -3829,7 +3992,7 @@ abstract class Foo { rank: 'field', }, line: 5, - column: 5, + column: 3, }, ], }, @@ -3837,13 +4000,14 @@ abstract class Foo { code: ` // no accessibility === public class Foo { - B: string; - @Dec() A: string = ""; - C: string = ""; - constructor() {} - D() {} - E() {} -} `, + B: string; + @Dec() A: string = ''; + C: string = ''; + constructor() {} + D() {} + E() {} +} + `, options: [{ default: ['decorated-field', 'field'] }], errors: [ { @@ -3853,18 +4017,19 @@ class Foo { rank: 'field', }, line: 5, - column: 5, + column: 3, }, ], }, { code: ` class Foo { - A() {} + A() {} - @Decorator() - B() {} -} `, + @Decorator() + B() {} +} + `, options: [{ default: ['decorated-method', 'method'] }], errors: [ { @@ -3874,16 +4039,17 @@ class Foo { rank: 'method', }, line: 5, // Symbol starts at the line with decorator - column: 5, + column: 3, }, ], }, { code: ` class Foo { - @Decorator() C() {} - A() {} -} `, + @Decorator() C() {} + A() {} +} + `, options: [{ default: ['public-method', 'decorated-method'] }], errors: [ { @@ -3893,19 +4059,20 @@ class Foo { rank: 'decorated method', }, line: 4, - column: 5, + column: 3, }, ], }, { code: ` class Foo { - A(): void; - B(): void; - private C() {} - constructor() {} - @Dec() private D() {} -} `, + A(): void; + B(): void; + private C() {} + constructor() {} + @Dec() private D() {} +} + `, options: [ { classes: ['public-method', 'decorated-method', 'private-method'], @@ -3919,21 +4086,22 @@ class Foo { rank: 'private method', }, line: 7, - column: 5, + column: 3, }, ], }, { code: ` class Foo { - A: string; - get B() {} - constructor() {} - set B() {} - get C() {} - set C() {} - D(): void; -} `, + A: string; + get B() {} + constructor() {} + set B() {} + get C() {} + set C() {} + D(): void; +} + `, options: [ { default: ['field', 'constructor', ['get', 'set'], 'method'], @@ -3947,20 +4115,21 @@ class Foo { rank: 'get, set', }, line: 5, - column: 5, + column: 3, }, ], }, { code: ` class Foo { - A: string; - private C(): void; - constructor() {} - @Dec() private B: string; - set D() {} - E(): void; -} `, + A: string; + private C(): void; + constructor() {} + @Dec() private B: string; + set D() {} + E(): void; +} + `, options: [ { default: [ @@ -3979,21 +4148,22 @@ class Foo { rank: 'private decorated field, public set, private method', }, line: 5, - column: 5, + column: 3, }, ], }, { code: ` class Foo { - A: string; - constructor() {} - get B() {} - set B() {} - get C() {} - set C() {} - D(): void; -} `, + A: string; + constructor() {} + get B() {} + set B() {} + get C() {} + set C() {} + D(): void; +} + `, options: [ { default: ['field', 'constructor', 'get', ['set'], 'method'], @@ -4007,7 +4177,7 @@ class Foo { rank: 'set', }, line: 7, - column: 5, + column: 3, }, ], }, @@ -4018,7 +4188,10 @@ class Foo { m() {} f = 1; } - `, + `, + dependencyConstraints: { + typescript: '4.4', + }, options: [{ default: ['method', 'field', 'static-initialization'] }], errors: [ { @@ -4048,7 +4221,10 @@ class Foo { f = 1; static {} } - `, + `, + dependencyConstraints: { + typescript: '4.4', + }, options: [{ default: ['static-initialization', 'method', 'field'] }], errors: [ { @@ -4069,7 +4245,10 @@ class Foo { static {} m() {} } - `, + `, + dependencyConstraints: { + typescript: '4.4', + }, options: [{ default: ['static-initialization', 'field', 'method'] }], errors: [ { @@ -4090,7 +4269,10 @@ class Foo { f = 1; m() {} } - `, + `, + dependencyConstraints: { + typescript: '4.4', + }, options: [{ default: ['field', 'static-initialization', 'method'] }], errors: [ { @@ -4113,7 +4295,10 @@ class Foo { @dec md() {} } - `, + `, + dependencyConstraints: { + typescript: '4.4', + }, options: [ { default: ['decorated-method', 'static-initialization', 'method'] }, ], @@ -4138,6 +4323,93 @@ class Foo { }, ], }, + { + name: 'with private identifier', + code: ` +// no accessibility === public +class Foo { + #imPrivate() {} + imPublic() {} +} + `, + options: [ + { + default: { + memberTypes: ['public-method', '#private-method'], + order: 'alphabetically-case-insensitive', + }, + }, + ], + errors: [ + { + messageId: 'incorrectGroupOrder', + data: { + name: 'imPublic', + rank: '#private method', + }, + line: 5, + column: 3, + }, + ], + }, + { + name: 'private and #private member order', + code: ` +// no accessibility === public +class Foo { + #imPrivate() {} + private imPrivate() {} +} + `, + options: [ + { + default: { + memberTypes: ['private-method', '#private-method'], + order: 'alphabetically-case-insensitive', + }, + }, + ], + errors: [ + { + messageId: 'incorrectGroupOrder', + data: { + name: 'imPrivate', + rank: '#private method', + }, + line: 5, + column: 3, + }, + ], + }, + { + name: '#private and private member order', + code: ` +// no accessibility === public +class Foo { + private imPrivate() {} + #imPrivate() {} +} + `, + options: [ + { + default: { + memberTypes: ['#private-method', 'private-method'], + order: 'alphabetically-case-insensitive', + }, + }, + ], + errors: [ + { + messageId: 'incorrectGroupOrder', + data: { + name: 'imPrivate', + rank: 'private method', + }, + line: 5, + column: 3, + }, + ], + }, ], }; diff --git a/packages/eslint-plugin/tests/rules/member-ordering-alphabetically-case-insensitive-order.test.ts b/packages/eslint-plugin/tests/rules/member-ordering/member-ordering-alphabetically-case-insensitive-order.test.ts similarity index 77% rename from packages/eslint-plugin/tests/rules/member-ordering-alphabetically-case-insensitive-order.test.ts rename to packages/eslint-plugin/tests/rules/member-ordering/member-ordering-alphabetically-case-insensitive-order.test.ts index d2600b17dc8..fd10c55fe91 100644 --- a/packages/eslint-plugin/tests/rules/member-ordering-alphabetically-case-insensitive-order.test.ts +++ b/packages/eslint-plugin/tests/rules/member-ordering/member-ordering-alphabetically-case-insensitive-order.test.ts @@ -1,23 +1,22 @@ -import type { TSESLint } from '@typescript-eslint/utils'; - -import type { MessageIds, Options } from '../../src/rules/member-ordering'; -import rule, { defaultOrder } from '../../src/rules/member-ordering'; -import { RuleTester } from '../RuleTester'; +import type { MessageIds, Options } from '../../../src/rules/member-ordering'; +import rule, { defaultOrder } from '../../../src/rules/member-ordering'; +import type { RunTests } from '../../RuleTester'; +import { RuleTester } from '../../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', }); -const sortedCiWithoutGrouping: TSESLint.RunTests = { +const sortedCiWithoutGrouping: RunTests = { valid: [ // default option + interface + lower/upper case { code: ` interface Foo { - a : b; - B : b; + a: b; + B: b; } - `, + `, options: [ { default: { @@ -32,10 +31,10 @@ interface Foo { { code: ` type Foo = { - a : b; - B : b; -} - `, + a: b; + B: b; +}; + `, options: [ { default: { @@ -50,10 +49,10 @@ type Foo = { { code: ` class Foo { - public static a : string; - public static B : string; + public static a: string; + public static B: string; } - `, + `, options: [ { default: { @@ -68,10 +67,10 @@ class Foo { { code: ` const foo = class Foo { - public static a : string; - public static B : string; -} - `, + public static a: string; + public static B: string; +}; + `, options: [ { default: { @@ -86,11 +85,11 @@ const foo = class Foo { { code: ` class Foo { - public static a : string; - @Dec() static B : string; - public static c : string; + public static a: string; + @Dec() static B: string; + public static c: string; } - `, + `, options: [ { default: { @@ -106,11 +105,11 @@ class Foo { { code: ` interface Foo { - c : string; - B : string; - a : string; + c: string; + B: string; + a: string; } - `, + `, options: [ { default: { @@ -141,10 +140,10 @@ interface Foo { { code: ` interface Foo { - B : b; - a : b; + B: b; + a: b; } - `, + `, options: [ { default: { @@ -168,10 +167,10 @@ interface Foo { { code: ` type Foo = { - B : b; - a : b; -} - `, + B: b; + a: b; +}; + `, options: [ { default: { @@ -195,10 +194,10 @@ type Foo = { { code: ` class Foo { - public static B : string; - public static a : string; + public static B: string; + public static a: string; } - `, + `, options: [ { default: { @@ -222,10 +221,10 @@ class Foo { { code: ` const foo = class Foo { - public static B : string; - public static a : string; -} - `, + public static B: string; + public static a: string; +}; + `, options: [ { default: { @@ -247,27 +246,27 @@ const foo = class Foo { ], }; -const sortedCiWithGrouping: TSESLint.RunTests = { +const sortedCiWithGrouping: RunTests = { valid: [ // default option + interface + default order + alphabetically { code: ` interface Foo { - [a: string] : number; + [a: string]: number; - () : Baz; + (): Baz; - a : x; - B : x; - c : x; + a: x; + B: x; + c: x; - new () : Bar; + new (): Bar; - a() : void; - B() : void; - c() : void; + a(): void; + B(): void; + c(): void; } - `, + `, options: [ { default: { @@ -282,20 +281,20 @@ interface Foo { { code: ` interface Foo { - new () : Bar; + new (): Bar; - a() : void; - B() : void; - c() : void; + a(): void; + B(): void; + c(): void; - a : x; - B : x; - c : x; + a: x; + B: x; + c: x; - [a: string] : number; - () : Baz; + [a: string]: number; + (): Baz; } - `, + `, options: [ { default: { @@ -310,21 +309,21 @@ interface Foo { { code: ` type Foo = { - [a: string] : number; + [a: string]: number; - () : Baz; + (): Baz; - a : x; - B : x; - c : x; + a: x; + B: x; + c: x; - new () : Bar; + new (): Bar; - a() : void; - B() : void; - c() : void; -} - `, + a(): void; + B(): void; + c(): void; +}; + `, options: [ { default: { @@ -339,21 +338,21 @@ type Foo = { { code: ` type Foo = { - [a: string] : number; + [a: string]: number; - new () : Bar; + new (): Bar; - a() : void; - B() : void; - c() : void; + a(): void; + B(): void; + c(): void; - a : x; - B : x; - c : x; + a: x; + B: x; + c: x; - () : Baz; -} - `, + (): Baz; +}; + `, options: [ { default: { @@ -369,16 +368,16 @@ type Foo = { code: ` class Foo { public static a: string; - protected static b: string = ""; - private static c: string = ""; + protected static b: string = ''; + private static c: string = ''; - public d: string = ""; - protected E: string = ""; - private f: string = ""; + public d: string = ''; + protected E: string = ''; + private f: string = ''; constructor() {} } - `, + `, options: [ { default: { @@ -393,20 +392,20 @@ class Foo { code: ` class Foo { public static a: string; - protected static b: string = ""; - private static c: string = ""; + protected static b: string = ''; + private static c: string = ''; @Dec() public d: string; @Dec() protected E: string; @Dec() private f: string; - public g: string = ""; - protected h: string = ""; - private i: string = ""; + public g: string = ''; + protected h: string = ''; + private i: string = ''; constructor() {} } - `, + `, options: [ { default: { @@ -423,15 +422,15 @@ class Foo { class Foo { constructor() {} - public d: string = ""; - protected E: string = ""; - private f: string = ""; + public d: string = ''; + protected E: string = ''; + private f: string = ''; public static a: string; - protected static b: string = ""; - private static c: string = ""; + protected static b: string = ''; + private static c: string = ''; } - `, + `, options: [ { default: { @@ -447,16 +446,16 @@ class Foo { code: ` const foo = class Foo { public static a: string; - protected static b: string = ""; - private static c: string = ""; + protected static b: string = ''; + private static c: string = ''; - public d: string = ""; - protected E: string = ""; - private f: string = ""; + public d: string = ''; + protected E: string = ''; + private f: string = ''; constructor() {} -} - `, +}; + `, options: [ { default: { @@ -473,15 +472,15 @@ const foo = class Foo { const foo = class Foo { constructor() {} - public d: string = ""; - protected E: string = ""; - private f: string = ""; + public d: string = ''; + protected E: string = ''; + private f: string = ''; public static a: string; - protected static b: string = ""; - private static c: string = ""; -} - `, + protected static b: string = ''; + private static c: string = ''; +}; + `, options: [ { default: { @@ -499,7 +498,10 @@ class Foo { static {} static {} } - `, + `, + dependencyConstraints: { + typescript: '4.4', + }, options: [ { default: { @@ -515,21 +517,21 @@ class Foo { { code: ` interface Foo { - [a: string] : number; + [a: string]: number; - a : x; - B : x; - c : x; + a: x; + B: x; + c: x; - c() : void; - B() : void; - a() : void; + c(): void; + B(): void; + a(): void; - () : Baz; + (): Baz; - new () : Bar; + new (): Bar; } - `, + `, options: [ { default: { @@ -560,21 +562,21 @@ interface Foo { { code: ` type Foo = { - [a: string] : number; + [a: string]: number; - a : x; - B : x; - c : x; + a: x; + B: x; + c: x; - c() : void; - B() : void; - a() : void; + c(): void; + B(): void; + a(): void; - () : Baz; + (): Baz; - new () : Bar; -} - `, + new (): Bar; +}; + `, options: [ { default: { @@ -605,15 +607,15 @@ type Foo = { { code: ` class Foo { - public static c: string = ""; - public static B: string = ""; + public static c: string = ''; + public static B: string = ''; public static a: string; constructor() {} - public d: string = ""; + public d: string = ''; } - `, + `, options: [ { default: { @@ -637,15 +639,15 @@ class Foo { { code: ` const foo = class Foo { - public static c: string = ""; - public static B: string = ""; + public static c: string = ''; + public static B: string = ''; public static a: string; constructor() {} - public d: string = ""; -} - `, + public d: string = ''; +}; + `, options: [ { default: { diff --git a/packages/eslint-plugin/tests/rules/member-ordering-alphabetically-order.test.ts b/packages/eslint-plugin/tests/rules/member-ordering/member-ordering-alphabetically-order.test.ts similarity index 59% rename from packages/eslint-plugin/tests/rules/member-ordering-alphabetically-order.test.ts rename to packages/eslint-plugin/tests/rules/member-ordering/member-ordering-alphabetically-order.test.ts index 63ef55408e7..338b3a50ee9 100644 --- a/packages/eslint-plugin/tests/rules/member-ordering-alphabetically-order.test.ts +++ b/packages/eslint-plugin/tests/rules/member-ordering/member-ordering-alphabetically-order.test.ts @@ -1,16 +1,12 @@ -import type { TSESLint } from '@typescript-eslint/utils'; - -import type { MessageIds, Options } from '../../src/rules/member-ordering'; -import rule, { defaultOrder } from '../../src/rules/member-ordering'; -import { RuleTester } from '../RuleTester'; +import type { MessageIds, Options } from '../../../src/rules/member-ordering'; +import rule, { defaultOrder } from '../../../src/rules/member-ordering'; +import type { RunTests } from '../../RuleTester'; +import { RuleTester } from '../../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', }); -const sortedWithoutGroupingDefaultOption: TSESLint.RunTests< - MessageIds, - Options -> = { +const sortedWithoutGroupingDefaultOption: RunTests = { valid: [ // default option + interface + multiple types { @@ -20,7 +16,7 @@ interface Foo { a(): Foo; b(): Foo; } - `, + `, options: [ { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, ], @@ -30,10 +26,10 @@ interface Foo { { code: ` interface Foo { - A : b; - a : b; + A: b; + a: b; } - `, + `, options: [{ default: { memberTypes: 'never', order: 'alphabetically' } }], }, @@ -41,10 +37,10 @@ interface Foo { { code: ` interface Foo { - a1 : b; - aa : b; + a1: b; + aa: b; } - `, + `, options: [{ default: { memberTypes: 'never', order: 'alphabetically' } }], }, @@ -52,11 +48,11 @@ interface Foo { { code: ` interface Foo { - a : Foo; - 'b.c' : Foo; - "b.d" : Foo; + a: Foo; + 'b.c': Foo; + 'b.d': Foo; } - `, + `, options: [{ default: { order: 'alphabetically' } }], }, @@ -64,13 +60,13 @@ interface Foo { { code: ` type Foo = { - a : b; - [a: string] : number; - b() : void; - () : Baz; - new () : Bar; -} - `, + a: b; + [a: string]: number; + b(): void; + (): Baz; + new (): Bar; +}; + `, options: [{ default: { memberTypes: 'never', order: 'alphabetically' } }], }, @@ -78,10 +74,10 @@ type Foo = { { code: ` type Foo = { - A : b; - a : b; -} - `, + A: b; + a: b; +}; + `, options: [{ default: { memberTypes: 'never', order: 'alphabetically' } }], }, @@ -89,10 +85,10 @@ type Foo = { { code: ` type Foo = { - a1 : b; - aa : b; -} - `, + a1: b; + aa: b; +}; + `, options: [{ default: { memberTypes: 'never', order: 'alphabetically' } }], }, @@ -100,11 +96,11 @@ type Foo = { { code: ` type Foo = { - a : Foo; - 'b.c' : Foo; - "b.d" : Foo; -} - `, + a: Foo; + 'b.c': Foo; + 'b.d': Foo; +}; + `, options: [{ default: { order: 'alphabetically' } }], }, @@ -112,17 +108,17 @@ type Foo = { { code: ` class Foo { - public static a : string; - protected static b : string = ""; - private static c : string = ""; + public static a: string; + protected static b: string = ''; + private static c: string = ''; constructor() {} @Dec() d: string; - public e : string = ""; - @Dec() f : string = ""; - protected g : string = ""; - private h : string = ""; + public e: string = ''; + @Dec() f: string = ''; + protected g: string = ''; + private h: string = ''; } - `, + `, options: [{ default: { memberTypes: 'never', order: 'alphabetically' } }], }, @@ -130,10 +126,10 @@ class Foo { { code: ` class Foo { - public static A : string; - public static a : string; + public static A: string; + public static a: string; } - `, + `, options: [{ default: { memberTypes: 'never', order: 'alphabetically' } }], }, @@ -141,10 +137,10 @@ class Foo { { code: ` class Foo { - public static a1 : string; - public static aa : string; + public static a1: string; + public static aa: string; } - `, + `, options: [{ default: { memberTypes: 'never', order: 'alphabetically' } }], }, @@ -152,15 +148,15 @@ class Foo { { code: ` const foo = class Foo { - public static a : string; - protected static b : string = ""; - private static c : string = ""; + public static a: string; + protected static b: string = ''; + private static c: string = ''; constructor() {} - public d : string = ""; - protected e : string = ""; - private f : string = ""; -} - `, + public d: string = ''; + protected e: string = ''; + private f: string = ''; +}; + `, options: [{ default: { memberTypes: 'never', order: 'alphabetically' } }], }, @@ -168,10 +164,10 @@ const foo = class Foo { { code: ` const foo = class Foo { - public static A : string; - public static a : string; -} - `, + public static A: string; + public static a: string; +}; + `, options: [{ default: { memberTypes: 'never', order: 'alphabetically' } }], }, @@ -179,10 +175,10 @@ const foo = class Foo { { code: ` const foo = class Foo { - public static a1 : string; - public static aa : string; -} - `, + public static a1: string; + public static aa: string; +}; + `, options: [{ default: { memberTypes: 'never', order: 'alphabetically' } }], }, @@ -190,11 +186,11 @@ const foo = class Foo { { code: ` class Foo { - public static a : string; - @Dec() static b : string; - public static c : string; + public static a: string; + @Dec() static b: string; + public static c: string; } - `, + `, options: [{ default: { memberTypes: 'never', order: 'alphabetically' } }], }, @@ -217,13 +213,13 @@ class Foo { { code: ` interface Foo { - b() : void; - a : b; - [a: string] : number; - new () : Bar; - () : Baz; + b(): void; + a: b; + [a: string]: number; + new (): Bar; + (): Baz; } - `, + `, options: [{ default: { memberTypes: 'never', order: 'alphabetically' } }], errors: [ { @@ -247,11 +243,11 @@ interface Foo { { code: ` interface Foo { - "b.d" : Foo; - 'b.c' : Foo; - a : Foo; + 'b.d': Foo; + 'b.c': Foo; + a: Foo; } - `, + `, options: [{ default: { order: 'alphabetically' } }], errors: [ { @@ -275,11 +271,11 @@ interface Foo { { code: ` interface Foo { - c : string; - b : string; - a : string; + c: string; + b: string; + a: string; } - `, + `, options: [{ default: { memberTypes: 'never', order: 'alphabetically' } }], errors: [ { @@ -303,13 +299,13 @@ interface Foo { { code: ` type Foo = { - b() : void; - a : b; - [a: string] : number; - new () : Bar; - () : Baz; -} - `, + b(): void; + a: b; + [a: string]: number; + new (): Bar; + (): Baz; +}; + `, options: [{ default: { memberTypes: 'never', order: 'alphabetically' } }], errors: [ { @@ -333,11 +329,11 @@ type Foo = { { code: ` type Foo = { - "b.d" : Foo; - 'b.c' : Foo; - a : Foo; -} - `, + 'b.d': Foo; + 'b.c': Foo; + a: Foo; +}; + `, options: [{ default: { order: 'alphabetically' } }], errors: [ { @@ -361,11 +357,11 @@ type Foo = { { code: ` type Foo = { - c : string; - b : string; - a : string; -} - `, + c: string; + b: string; + a: string; +}; + `, options: [{ default: { memberTypes: 'never', order: 'alphabetically' } }], errors: [ { @@ -389,15 +385,15 @@ type Foo = { { code: ` class Foo { - protected static b : string = ""; - public static a : string; - private static c : string = ""; + protected static b: string = ''; + public static a: string; + private static c: string = ''; constructor() {} - public d : string = ""; - protected e : string = ""; - private f : string = ""; + public d: string = ''; + protected e: string = ''; + private f: string = ''; } - `, + `, options: [{ default: { memberTypes: 'never', order: 'alphabetically' } }], errors: [ { @@ -418,7 +414,7 @@ class Foo { public static b: string; public static a: string; } - `, + `, options: [{ default: { memberTypes: 'never', order: 'alphabetically' } }], errors: [ { @@ -442,15 +438,15 @@ class Foo { { code: ` const foo = class Foo { - protected static b : string = ""; - public static a : string; - private static c : string = ""; + protected static b: string = ''; + public static a: string; + private static c: string = ''; constructor() {} - public d : string = ""; - protected e : string = ""; - private f : string = ""; -} - `, + public d: string = ''; + protected e: string = ''; + private f: string = ''; +}; + `, options: [{ default: { memberTypes: 'never', order: 'alphabetically' } }], errors: [ { @@ -470,8 +466,8 @@ const foo = class Foo { public static c: string; public static b: string; public static a: string; -} - `, +}; + `, options: [{ default: { memberTypes: 'never', order: 'alphabetically' } }], errors: [ { @@ -493,22 +489,19 @@ const foo = class Foo { ], }; -const sortedWithoutGroupingClassesOption: TSESLint.RunTests< - MessageIds, - Options -> = { +const sortedWithoutGroupingClassesOption: RunTests = { valid: [ // classes option + interface + multiple types --> Only member group order is checked (default config) { code: ` interface Foo { - [a: string] : number; - () : Baz; - c : b; - new () : Bar; - b() : void; + [a: string]: number; + (): Baz; + c: b; + new (): Bar; + b(): void; } - `, + `, options: [{ classes: { memberTypes: 'never', order: 'alphabetically' } }], }, @@ -516,10 +509,10 @@ interface Foo { { code: ` interface Foo { - a : b; - A : b; + a: b; + A: b; } - `, + `, options: [{ classes: { memberTypes: 'never', order: 'alphabetically' } }], }, @@ -527,10 +520,10 @@ interface Foo { { code: ` interface Foo { - aa : b; - a1 : b; + aa: b; + a1: b; } - `, + `, options: [{ classes: { memberTypes: 'never', order: 'alphabetically' } }], }, @@ -538,13 +531,13 @@ interface Foo { { code: ` type Foo = { - [a: string] : number; - () : Baz; - c : b; - new () : Bar; - b() : void; -} - `, + [a: string]: number; + (): Baz; + c: b; + new (): Bar; + b(): void; +}; + `, options: [{ classes: { memberTypes: 'never', order: 'alphabetically' } }], }, @@ -552,10 +545,10 @@ type Foo = { { code: ` type Foo = { - a : b; - A : b; -} - `, + a: b; + A: b; +}; + `, options: [{ classes: { memberTypes: 'never', order: 'alphabetically' } }], }, @@ -563,10 +556,10 @@ type Foo = { { code: ` type Foo = { - aa : b; - a1 : b; -} - `, + aa: b; + a1: b; +}; + `, options: [{ classes: { memberTypes: 'never', order: 'alphabetically' } }], }, @@ -574,16 +567,16 @@ type Foo = { { code: ` class Foo { - public static a : string; - protected static b : string = ""; - @Dec() private static c : string = ""; + public static a: string; + protected static b: string = ''; + @Dec() private static c: string = ''; constructor() {} - public d : string = ""; - protected e : string = ""; + public d: string = ''; + protected e: string = ''; @Dec() - private f : string = ""; + private f: string = ''; } - `, + `, options: [{ classes: { memberTypes: 'never', order: 'alphabetically' } }], }, @@ -591,10 +584,10 @@ class Foo { { code: ` class Foo { - public static A : string; - public static a : string; + public static A: string; + public static a: string; } - `, + `, options: [{ classes: { memberTypes: 'never', order: 'alphabetically' } }], }, @@ -602,10 +595,10 @@ class Foo { { code: ` class Foo { - public static a1 : string; - public static aa : string; + public static a1: string; + public static aa: string; } - `, + `, options: [{ classes: { memberTypes: 'never', order: 'alphabetically' } }], }, @@ -613,15 +606,15 @@ class Foo { { code: ` const foo = class Foo { - public static a : string; - protected static b : string = ""; - private static c : string = ""; - public d : string = ""; - protected e : string = ""; - private f : string = ""; + public static a: string; + protected static b: string = ''; + private static c: string = ''; + public d: string = ''; + protected e: string = ''; + private f: string = ''; constructor() {} -} - `, +}; + `, options: [{ classes: { memberTypes: 'never', order: 'alphabetically' } }], }, @@ -629,10 +622,10 @@ const foo = class Foo { { code: ` const foo = class Foo { - public static a : string; - public static A : string; -} - `, + public static a: string; + public static A: string; +}; + `, options: [{ classes: { memberTypes: 'never', order: 'alphabetically' } }], }, @@ -640,10 +633,10 @@ const foo = class Foo { { code: ` const foo = class Foo { - public static aa : string; - public static a1 : string; -} - `, + public static aa: string; + public static a1: string; +}; + `, options: [{ classes: { memberTypes: 'never', order: 'alphabetically' } }], }, ], @@ -652,15 +645,15 @@ const foo = class Foo { { code: ` class Foo { - protected static b : string = ""; - public static a : string; - private static c : string = ""; + protected static b: string = ''; + public static a: string; + private static c: string = ''; constructor() {} - public d : string = ""; - protected e : string = ""; - private f : string = ""; + public d: string = ''; + protected e: string = ''; + private f: string = ''; } - `, + `, options: [{ classes: { memberTypes: 'never', order: 'alphabetically' } }], errors: [ { @@ -681,7 +674,7 @@ class Foo { public static b: string; public static a: string; } - `, + `, options: [{ classes: { memberTypes: 'never', order: 'alphabetically' } }], errors: [ { @@ -703,7 +696,7 @@ class Foo { ], }; -const sortedWithoutGroupingClassExpressionsOption: TSESLint.RunTests< +const sortedWithoutGroupingClassExpressionsOption: RunTests< MessageIds, Options > = { @@ -712,13 +705,13 @@ const sortedWithoutGroupingClassExpressionsOption: TSESLint.RunTests< { code: ` interface Foo { - [a: string] : number; - () : Baz; - c : b; - new () : Bar; - b() : void; + [a: string]: number; + (): Baz; + c: b; + new (): Bar; + b(): void; } - `, + `, options: [ { classExpressions: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -728,10 +721,10 @@ interface Foo { { code: ` interface Foo { - a : b; - A : b; + a: b; + A: b; } - `, + `, options: [ { classExpressions: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -741,10 +734,10 @@ interface Foo { { code: ` interface Foo { - aa : b; - a1 : b; + aa: b; + a1: b; } - `, + `, options: [ { classExpressions: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -754,13 +747,13 @@ interface Foo { { code: ` type Foo = { - [a: string] : number; - () : Baz; - c : b; - new () : Bar; - b() : void; -} - `, + [a: string]: number; + (): Baz; + c: b; + new (): Bar; + b(): void; +}; + `, options: [ { classExpressions: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -770,10 +763,10 @@ type Foo = { { code: ` type Foo = { - a : b; - A : b; -} - `, + a: b; + A: b; +}; + `, options: [ { classExpressions: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -783,10 +776,10 @@ type Foo = { { code: ` type Foo = { - aa : b; - a1 : b; -} - `, + aa: b; + a1: b; +}; + `, options: [ { classExpressions: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -796,15 +789,15 @@ type Foo = { { code: ` class Foo { - public static a : string; - protected static b : string = ""; - private static c : string = ""; - public d : string = ""; - protected e : string = ""; - private f : string = ""; + public static a: string; + protected static b: string = ''; + private static c: string = ''; + public d: string = ''; + protected e: string = ''; + private f: string = ''; constructor() {} } - `, + `, options: [ { classExpressions: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -814,10 +807,10 @@ class Foo { { code: ` class Foo { - public static a : string; - public static A : string; + public static a: string; + public static A: string; } - `, + `, options: [ { classExpressions: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -827,10 +820,10 @@ class Foo { { code: ` class Foo { - public static aa : string; - public static a1 : string; + public static aa: string; + public static a1: string; } - `, + `, options: [ { classExpressions: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -840,15 +833,15 @@ class Foo { { code: ` const foo = class Foo { - public static a : string; - protected static b : string = ""; - private static c : string = ""; + public static a: string; + protected static b: string = ''; + private static c: string = ''; constructor() {} - public d : string = ""; - protected e : string = ""; - private f : string = ""; -} - `, + public d: string = ''; + protected e: string = ''; + private f: string = ''; +}; + `, options: [ { classExpressions: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -858,10 +851,10 @@ const foo = class Foo { { code: ` const foo = class Foo { - public static A : string; - public static a : string; -} - `, + public static A: string; + public static a: string; +}; + `, options: [ { classExpressions: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -871,10 +864,10 @@ const foo = class Foo { { code: ` const foo = class Foo { - public static a1 : string; - public static aa : string; -} - `, + public static a1: string; + public static aa: string; +}; + `, options: [ { classExpressions: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -885,15 +878,15 @@ const foo = class Foo { { code: ` const foo = class Foo { - protected static b : string = ""; - public static a : string; - private static c : string = ""; + protected static b: string = ''; + public static a: string; + private static c: string = ''; constructor() {} - public d : string = ""; - protected e : string = ""; - private f : string = ""; -} - `, + public d: string = ''; + protected e: string = ''; + private f: string = ''; +}; + `, options: [ { classExpressions: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -915,8 +908,8 @@ const foo = class Foo { public static c: string; public static b: string; public static a: string; -} - `, +}; + `, options: [ { classExpressions: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -940,22 +933,19 @@ const foo = class Foo { ], }; -const sortedWithoutGroupingInterfacesOption: TSESLint.RunTests< - MessageIds, - Options -> = { +const sortedWithoutGroupingInterfacesOption: RunTests = { valid: [ // interfaces option + interface + multiple types { code: ` interface Foo { - [a: string] : number; - a : b; - b() : void; - () : Baz; - new () : Bar; + [a: string]: number; + a: b; + b(): void; + (): Baz; + new (): Bar; } - `, + `, options: [ { interfaces: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -965,10 +955,10 @@ interface Foo { { code: ` interface Foo { - A : b; - a : b; + A: b; + a: b; } - `, + `, options: [ { interfaces: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -978,10 +968,10 @@ interface Foo { { code: ` interface Foo { - a1 : b; - aa : b; + a1: b; + aa: b; } - `, + `, options: [ { interfaces: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -991,13 +981,13 @@ interface Foo { { code: ` type Foo = { - [a: string] : number; - () : Baz; - c : b; - new () : Bar; - b() : void; -} - `, + [a: string]: number; + (): Baz; + c: b; + new (): Bar; + b(): void; +}; + `, options: [ { interfaces: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -1007,10 +997,10 @@ type Foo = { { code: ` type Foo = { - a : b; - A : b; -} - `, + a: b; + A: b; +}; + `, options: [ { interfaces: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -1020,10 +1010,10 @@ type Foo = { { code: ` type Foo = { - aa : b; - a1 : b; -} - `, + aa: b; + a1: b; +}; + `, options: [ { interfaces: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -1033,15 +1023,15 @@ type Foo = { { code: ` class Foo { - public static a : string; - protected static b : string = ""; - private static c : string = ""; - public d : string = ""; - protected e : string = ""; - private f : string = ""; + public static a: string; + protected static b: string = ''; + private static c: string = ''; + public d: string = ''; + protected e: string = ''; + private f: string = ''; constructor() {} } - `, + `, options: [ { interfaces: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -1051,10 +1041,10 @@ class Foo { { code: ` class Foo { - public static a : string; - public static A : string; + public static a: string; + public static A: string; } - `, + `, options: [ { interfaces: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -1064,10 +1054,10 @@ class Foo { { code: ` class Foo { - public static aa : string; - public static a1 : string; + public static aa: string; + public static a1: string; } - `, + `, options: [ { interfaces: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -1077,15 +1067,15 @@ class Foo { { code: ` const foo = class Foo { - public static a : string; - protected static b : string = ""; - private static c : string = ""; - public d : string = ""; - protected e : string = ""; - private f : string = ""; + public static a: string; + protected static b: string = ''; + private static c: string = ''; + public d: string = ''; + protected e: string = ''; + private f: string = ''; constructor() {} -} - `, +}; + `, options: [ { interfaces: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -1095,10 +1085,10 @@ const foo = class Foo { { code: ` const foo = class Foo { - public static a : string; - public static A : string; -} - `, + public static a: string; + public static A: string; +}; + `, options: [ { interfaces: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -1108,10 +1098,10 @@ const foo = class Foo { { code: ` const foo = class Foo { - public static aa : string; - public static a1 : string; -} - `, + public static aa: string; + public static a1: string; +}; + `, options: [ { interfaces: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -1122,13 +1112,13 @@ const foo = class Foo { { code: ` interface Foo { - b() : void; - a : b; - [a: string] : number; - new () : Bar; - () : Baz; + b(): void; + a: b; + [a: string]: number; + new (): Bar; + (): Baz; } - `, + `, options: [ { interfaces: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -1154,11 +1144,11 @@ interface Foo { { code: ` interface Foo { - c : string; - b : string; - a : string; + c: string; + b: string; + a: string; } - `, + `, options: [ { interfaces: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -1182,22 +1172,19 @@ interface Foo { ], }; -const sortedWithoutGroupingTypeLiteralsOption: TSESLint.RunTests< - MessageIds, - Options -> = { +const sortedWithoutGroupingTypeLiteralsOption: RunTests = { valid: [ // typeLiterals option + interface + multiple types --> Only member group order is checked (default config) { code: ` interface Foo { - [a: string] : number; - () : Baz; - c : b; - new () : Bar; - b() : void; + [a: string]: number; + (): Baz; + c: b; + new (): Bar; + b(): void; } - `, + `, options: [ { typeLiterals: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -1207,10 +1194,10 @@ interface Foo { { code: ` interface Foo { - a : b; - A : b; + a: b; + A: b; } - `, + `, options: [ { typeLiterals: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -1220,10 +1207,10 @@ interface Foo { { code: ` interface Foo { - aa : b; - a1 : b; + aa: b; + a1: b; } - `, + `, options: [ { typeLiterals: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -1233,13 +1220,13 @@ interface Foo { { code: ` type Foo = { - [a: string] : number; - a : b; - b() : void; - () : Baz; - new () : Bar; -} - `, + [a: string]: number; + a: b; + b(): void; + (): Baz; + new (): Bar; +}; + `, options: [ { typeLiterals: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -1249,10 +1236,10 @@ type Foo = { { code: ` type Foo = { - A : b; - a : b; -} - `, + A: b; + a: b; +}; + `, options: [ { typeLiterals: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -1262,10 +1249,10 @@ type Foo = { { code: ` type Foo = { - a1 : b; - aa : b; -} - `, + a1: b; + aa: b; +}; + `, options: [ { typeLiterals: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -1275,15 +1262,15 @@ type Foo = { { code: ` class Foo { - public static a : string; - protected static b : string = ""; - private static c : string = ""; - public d : string = ""; - protected e : string = ""; - private f : string = ""; + public static a: string; + protected static b: string = ''; + private static c: string = ''; + public d: string = ''; + protected e: string = ''; + private f: string = ''; constructor() {} } - `, + `, options: [ { typeLiterals: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -1293,10 +1280,10 @@ class Foo { { code: ` class Foo { - public static a : string; - public static A : string; + public static a: string; + public static A: string; } - `, + `, options: [ { typeLiterals: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -1306,10 +1293,10 @@ class Foo { { code: ` class Foo { - public static aa : string; - public static a1 : string; + public static aa: string; + public static a1: string; } - `, + `, options: [ { typeLiterals: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -1319,15 +1306,15 @@ class Foo { { code: ` const foo = class Foo { - public static a : string; - protected static b : string = ""; - private static c : string = ""; - public d : string = ""; - protected e : string = ""; - private f : string = ""; + public static a: string; + protected static b: string = ''; + private static c: string = ''; + public d: string = ''; + protected e: string = ''; + private f: string = ''; constructor() {} -} - `, +}; + `, options: [ { typeLiterals: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -1337,10 +1324,10 @@ const foo = class Foo { { code: ` const foo = class Foo { - public static a : string; - public static A : string; -} - `, + public static a: string; + public static A: string; +}; + `, options: [ { typeLiterals: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -1350,10 +1337,10 @@ const foo = class Foo { { code: ` const foo = class Foo { - public static aa : string; - public static a1 : string; -} - `, + public static aa: string; + public static a1: string; +}; + `, options: [ { typeLiterals: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -1364,13 +1351,13 @@ const foo = class Foo { { code: ` type Foo = { - b() : void; - a : b; - [a: string] : number; - new () : Bar; - () : Baz; -} - `, + b(): void; + a: b; + [a: string]: number; + new (): Bar; + (): Baz; +}; + `, options: [ { typeLiterals: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -1396,11 +1383,11 @@ type Foo = { { code: ` type Foo = { - c : string; - b : string; - a : string; -} - `, + c: string; + b: string; + a: string; +}; + `, options: [ { typeLiterals: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -1424,145 +1411,144 @@ type Foo = { ], }; -const sortedWithGroupingDefaultOption: TSESLint.RunTests = - { - valid: [ - // default option + interface + default order + alphabetically - { - code: ` +const sortedWithGroupingDefaultOption: RunTests = { + valid: [ + // default option + interface + default order + alphabetically + { + code: ` interface Foo { - [a: string] : number; + [a: string]: number; - () : Baz; + (): Baz; - a : x; - b : x; - c : x; + a: x; + b: x; + c: x; - new () : Bar; + new (): Bar; - a() : void; - b() : void; - c() : void; + a(): void; + b(): void; + c(): void; } - `, - options: [ - { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, - ], - }, + `, + options: [ + { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, + ], + }, - // default option + interface + custom order + alphabetically - { - code: ` + // default option + interface + custom order + alphabetically + { + code: ` interface Foo { - new () : Bar; + new (): Bar; - a() : void; - b() : void; - c() : void; + a(): void; + b(): void; + c(): void; - a : x; - b : x; - c : x; + a: x; + b: x; + c: x; - [a: string] : number; - () : Baz; + [a: string]: number; + (): Baz; } - `, - options: [ - { - default: { - memberTypes: ['constructor', 'method', 'field'], - order: 'alphabetically', - }, + `, + options: [ + { + default: { + memberTypes: ['constructor', 'method', 'field'], + order: 'alphabetically', }, - ], - }, + }, + ], + }, - // default option + type literal + default order + alphabetically - { - code: ` + // default option + type literal + default order + alphabetically + { + code: ` type Foo = { - [a: string] : number; + [a: string]: number; - () : Baz; + (): Baz; - a : x; - b : x; - c : x; + a: x; + b: x; + c: x; - new () : Bar; + new (): Bar; - a() : void; - b() : void; - c() : void; -} - `, - options: [ - { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, - ], - }, + a(): void; + b(): void; + c(): void; +}; + `, + options: [ + { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, + ], + }, - // default option + type literal + custom order + alphabetically - { - code: ` + // default option + type literal + custom order + alphabetically + { + code: ` type Foo = { - [a: string] : number; + [a: string]: number; - new () : Bar; + new (): Bar; - a() : void; - b() : void; - c() : void; + a(): void; + b(): void; + c(): void; - a : x; - b : x; - c : x; + a: x; + b: x; + c: x; - () : Baz; -} - `, - options: [ - { - default: { - memberTypes: ['constructor', 'method', 'field'], - order: 'alphabetically', - }, + (): Baz; +}; + `, + options: [ + { + default: { + memberTypes: ['constructor', 'method', 'field'], + order: 'alphabetically', }, - ], - }, + }, + ], + }, - // default option + class + default order + alphabetically - { - code: ` + // default option + class + default order + alphabetically + { + code: ` class Foo { public static a: string; - protected static b: string = ""; - private static c: string = ""; + protected static b: string = ''; + private static c: string = ''; - public d: string = ""; - protected e: string = ""; - private f: string = ""; + public d: string = ''; + protected e: string = ''; + private f: string = ''; constructor() {} } - `, - options: [ - { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, - ], - }, + `, + options: [ + { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, + ], + }, - // default option + class + defaultOrder + alphabetically - { - code: ` + // default option + class + defaultOrder + alphabetically + { + code: ` class Foo { public static a: string; - protected static b: string = ""; - private static c: string = ""; + protected static b: string = ''; + private static c: string = ''; - public d: string = ""; - protected e: string = ""; - private f: string = ""; + public d: string = ''; + protected e: string = ''; + private f: string = ''; constructor() {} @@ -1570,20 +1556,20 @@ class Foo { set g() {} } - `, - options: [ - { - default: { - memberTypes: defaultOrder, - order: 'alphabetically', - }, + `, + options: [ + { + default: { + memberTypes: defaultOrder, + order: 'alphabetically', }, - ], - }, + }, + ], + }, - // default option + class + custom + alphabetically - { - code: ` + // default option + class + custom + alphabetically + { + code: ` class Foo { get a() {} @@ -1595,141 +1581,144 @@ class Foo { @Bar set d() {} } - `, - options: [ - { - default: { - memberTypes: ['get', 'decorated-get', 'set', 'decorated-set'], - order: 'alphabetically', - }, + `, + options: [ + { + default: { + memberTypes: ['get', 'decorated-get', 'set', 'decorated-set'], + order: 'alphabetically', }, - ], - }, + }, + ], + }, - // default option + class + decorators + default order + alphabetically - { - code: ` + // default option + class + decorators + default order + alphabetically + { + code: ` class Foo { public static a: string; - protected static b: string = ""; - private static c: string = ""; + protected static b: string = ''; + private static c: string = ''; @Dec() public d: string; @Dec() protected e: string; @Dec() private f: string; - public g: string = ""; - protected h: string = ""; - private i: string = ""; + public g: string = ''; + protected h: string = ''; + private i: string = ''; constructor() {} } - `, - options: [ - { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, - ], - }, + `, + options: [ + { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, + ], + }, - // default option + class + custom order + alphabetically - { - code: ` + // default option + class + custom order + alphabetically + { + code: ` class Foo { constructor() {} - public d: string = ""; - protected e: string = ""; - private f: string = ""; + public d: string = ''; + protected e: string = ''; + private f: string = ''; public static a: string; - protected static b: string = ""; - private static c: string = ""; + protected static b: string = ''; + private static c: string = ''; } - `, - options: [ - { - default: { - memberTypes: ['constructor', 'instance-field', 'static-field'], - order: 'alphabetically', - }, + `, + options: [ + { + default: { + memberTypes: ['constructor', 'instance-field', 'static-field'], + order: 'alphabetically', }, - ], - }, + }, + ], + }, - // default option + class expression + default order + alphabetically - { - code: ` + // default option + class expression + default order + alphabetically + { + code: ` const foo = class Foo { public static a: string; - protected static b: string = ""; - private static c: string = ""; + protected static b: string = ''; + private static c: string = ''; - public d: string = ""; - protected e: string = ""; - private f: string = ""; + public d: string = ''; + protected e: string = ''; + private f: string = ''; constructor() {} -} - `, - options: [ - { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, - ], - }, +}; + `, + options: [ + { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, + ], + }, - // default option + class expression + custom order + alphabetically - { - code: ` + // default option + class expression + custom order + alphabetically + { + code: ` const foo = class Foo { constructor() {} - public d: string = ""; - protected e: string = ""; - private f: string = ""; + public d: string = ''; + protected e: string = ''; + private f: string = ''; public static a: string; - protected static b: string = ""; - private static c: string = ""; -} - `, - options: [ - { - default: { - memberTypes: ['constructor', 'instance-field', 'static-field'], - order: 'alphabetically', - }, + protected static b: string = ''; + private static c: string = ''; +}; + `, + options: [ + { + default: { + memberTypes: ['constructor', 'instance-field', 'static-field'], + order: 'alphabetically', }, - ], - }, + }, + ], + }, - // default option + static blocks; should always be valid - { - code: ` + // default option + static blocks; should always be valid + { + code: ` class Foo { static {} static {} } - `, - options: [ - { - default: { - memberTypes: 'never', - order: 'alphabetically', - }, - }, - ], + `, + dependencyConstraints: { + typescript: '4.4', }, - ], - invalid: [ - // default option + class + wrong order within group and wrong group order + alphabetically - { - code: ` + options: [ + { + default: { + memberTypes: 'never', + order: 'alphabetically', + }, + }, + ], + }, + ], + invalid: [ + // default option + class + wrong order within group and wrong group order + alphabetically + { + code: ` class FooTestGetter { public static a: string; - protected static b: string = ""; - private static c: string = ""; + protected static b: string = ''; + private static c: string = ''; - public d: string = ""; - protected e: string = ""; - private f: string = ""; + public d: string = ''; + protected e: string = ''; + private f: string = ''; get h() {} @@ -1737,29 +1726,29 @@ class FooTestGetter { constructor() {} } - `, - options: [ - { - default: { - memberTypes: defaultOrder, - order: 'alphabetically', - }, + `, + options: [ + { + default: { + memberTypes: defaultOrder, + order: 'alphabetically', }, - ], - errors: [ - { - messageId: 'incorrectGroupOrder', - data: { - name: 'constructor', - rank: 'public instance get', - }, + }, + ], + errors: [ + { + messageId: 'incorrectGroupOrder', + data: { + name: 'constructor', + rank: 'public instance get', }, - ], - }, + }, + ], + }, - // default option + class + custom + alphabetically - { - code: ` + // default option + class + custom + alphabetically + { + code: ` class Foo { @Bar get a() {} @@ -1771,44 +1760,44 @@ class Foo { set d() {} } - `, - options: [ - { - default: { - memberTypes: ['get', 'decorated-get', 'set', 'decorated-set'], - order: 'alphabetically', - }, + `, + options: [ + { + default: { + memberTypes: ['get', 'decorated-get', 'set', 'decorated-set'], + order: 'alphabetically', }, - ], - errors: [ - { - messageId: 'incorrectGroupOrder', - data: { - name: 'b', - rank: 'decorated get', - }, + }, + ], + errors: [ + { + messageId: 'incorrectGroupOrder', + data: { + name: 'b', + rank: 'decorated get', }, - { - messageId: 'incorrectGroupOrder', - data: { - name: 'd', - rank: 'decorated set', - }, + }, + { + messageId: 'incorrectGroupOrder', + data: { + name: 'd', + rank: 'decorated set', }, - ], - }, + }, + ], + }, - // default option + class + wrong order within group and wrong group order + alphabetically - { - code: ` + // default option + class + wrong order within group and wrong group order + alphabetically + { + code: ` class FooTestGetter { public static a: string; - protected static b: string = ""; - private static c: string = ""; + protected static b: string = ''; + private static c: string = ''; - public d: string = ""; - protected e: string = ""; - private f: string = ""; + public d: string = ''; + protected e: string = ''; + private f: string = ''; set g() {} @@ -1816,489 +1805,341 @@ class FooTestGetter { get h() {} } - `, - options: [ - { - default: { - memberTypes: defaultOrder, - order: 'alphabetically', - }, + `, + options: [ + { + default: { + memberTypes: defaultOrder, + order: 'alphabetically', }, - ], - errors: [ - { - messageId: 'incorrectGroupOrder', - data: { - name: 'constructor', - rank: 'public instance set', - }, + }, + ], + errors: [ + { + messageId: 'incorrectGroupOrder', + data: { + name: 'constructor', + rank: 'public instance set', }, - { - messageId: 'incorrectGroupOrder', - data: { - name: 'h', - rank: 'public instance set', - }, + }, + { + messageId: 'incorrectGroupOrder', + data: { + name: 'h', + rank: 'public instance set', }, - ], - }, + }, + ], + }, - // default option + interface + wrong order within group and wrong group order + alphabetically - { - code: ` + // default option + interface + wrong order within group and wrong group order + alphabetically + { + code: ` interface Foo { - [a: string] : number; + [a: string]: number; - a : x; - b : x; - c : x; + a: x; + b: x; + c: x; - c() : void; - b() : void; - a() : void; + c(): void; + b(): void; + a(): void; - () : Baz; + (): Baz; - new () : Bar; + new (): Bar; } - `, - options: [ - { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, - ], - errors: [ - { - messageId: 'incorrectGroupOrder', - data: { - name: 'call', - rank: 'field', - }, + `, + options: [ + { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, + ], + errors: [ + { + messageId: 'incorrectGroupOrder', + data: { + name: 'call', + rank: 'field', }, - { - messageId: 'incorrectGroupOrder', - data: { - name: 'new', - rank: 'method', - }, + }, + { + messageId: 'incorrectGroupOrder', + data: { + name: 'new', + rank: 'method', }, - ], - }, + }, + ], + }, - // default option + type literal + wrong order within group and wrong group order + alphabetically - { - code: ` + // default option + type literal + wrong order within group and wrong group order + alphabetically + { + code: ` type Foo = { - [a: string] : number; + [a: string]: number; - a : x; - b : x; - c : x; + a: x; + b: x; + c: x; - c() : void; - b() : void; - a() : void; + c(): void; + b(): void; + a(): void; - () : Baz; + (): Baz; - new () : Bar; -} - `, - options: [ - { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, - ], - errors: [ - { - messageId: 'incorrectGroupOrder', - data: { - name: 'call', - rank: 'field', - }, - }, - { - messageId: 'incorrectGroupOrder', - data: { - name: 'new', - rank: 'method', - }, - }, - ], - }, - - // default option + class + wrong order within group and wrong group order + alphabetically - { - code: ` -class Foo { - public static c: string = ""; - public static b: string = ""; - public static a: string; - - constructor() {} - - public d: string = ""; -} - `, - options: [ - { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, - ], - errors: [ - { - messageId: 'incorrectGroupOrder', - data: { - name: 'd', - rank: 'public constructor', - }, - }, - ], - }, - - // default option + class expression + wrong order within group and wrong group order + alphabetically - { - code: ` -const foo = class Foo { - public static c: string = ""; - public static b: string = ""; - public static a: string; - - constructor() {} - - public d: string = ""; -} - `, - options: [ - { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, - ], - errors: [ - { - messageId: 'incorrectGroupOrder', - data: { - name: 'd', - rank: 'public constructor', - }, - }, - ], - }, - // default option + class + decorators + custom order + wrong order within group and wrong group order + alphabetically - { - code: ` -class Foo { - @Dec() a1: string; - @Dec() - a3: string; - @Dec() - a2: string; - - constructor() {} - - b1: string; - b2: string; - - public c(): void; - @Dec() d(): void -} - `, - options: [ - { - default: { - memberTypes: [ - 'decorated-field', - 'field', - 'constructor', - 'decorated-method', - ], - order: 'alphabetically', - }, - }, - ], - errors: [ - { - messageId: 'incorrectGroupOrder', - data: { - name: 'b1', - rank: 'constructor', - }, + new (): Bar; +}; + `, + options: [ + { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, + ], + errors: [ + { + messageId: 'incorrectGroupOrder', + data: { + name: 'call', + rank: 'field', }, - { - messageId: 'incorrectGroupOrder', - data: { - name: 'b2', - rank: 'constructor', - }, + }, + { + messageId: 'incorrectGroupOrder', + data: { + name: 'new', + rank: 'method', }, - ], - }, - ], - }; - -const sortedWithGroupingClassesOption: TSESLint.RunTests = - { - valid: [ - // classes option + interface + alphabetically --> Default order applies - { - code: ` -interface Foo { - [a: string] : number; - - () : Baz; - - c : x; - b : x; - a : x; - - new () : Bar; - - c() : void; - b() : void; - a() : void; -} - `, - options: [{ classes: { order: 'alphabetically' } }], - }, - - // classes option + type literal + alphabetically --> Default order applies - { - code: ` -type Foo = { - [a: string] : number; - - () : Baz; - - c : x; - b : x; - a : x; - - new () : Bar; - - c() : void; - b() : void; - a() : void; -} - `, - options: [{ classes: { order: 'alphabetically' } }], - }, + }, + ], + }, - // classes option + class + default order + alphabetically - { - code: ` + // default option + class + wrong order within group and wrong group order + alphabetically + { + code: ` class Foo { + public static c: string = ''; + public static b: string = ''; public static a: string; - protected static b: string = ""; - private static c: string = ""; - - public d: string = ""; - protected e: string = ""; - private f: string = ""; - - constructor() {} -} - `, - options: [ - { classes: { memberTypes: defaultOrder, order: 'alphabetically' } }, - ], - }, - - // classes option + class + custom order + alphabetically - { - code: ` -class Foo { - constructor() {} - public d: string = ""; - protected e: string = ""; - private f: string = ""; + constructor() {} - public static a: string; - protected static b: string = ""; - private static c: string = ""; + public d: string = ''; } - `, - options: [ - { - classes: { - memberTypes: ['constructor', 'instance-field', 'static-field'], - order: 'alphabetically', - }, + `, + options: [ + { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, + ], + errors: [ + { + messageId: 'incorrectGroupOrder', + data: { + name: 'd', + rank: 'public constructor', }, - ], - }, + }, + ], + }, - // classes option + class expression + alphabetically --> Default order applies - { - code: ` + // default option + class expression + wrong order within group and wrong group order + alphabetically + { + code: ` const foo = class Foo { + public static c: string = ''; + public static b: string = ''; public static a: string; - protected static b: string = ""; - private static c: string = ""; - - public d: string = ""; - protected e: string = ""; - private f: string = ""; constructor() {} -} - `, - options: [{ classes: { order: 'alphabetically' } }], - }, - ], - invalid: [ - // default option + class + wrong order within group and wrong group order + alphabetically - { - code: ` + + public d: string = ''; +}; + `, + options: [ + { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, + ], + errors: [ + { + messageId: 'incorrectGroupOrder', + data: { + name: 'd', + rank: 'public constructor', + }, + }, + ], + }, + // default option + class + decorators + custom order + wrong order within group and wrong group order + alphabetically + { + code: ` class Foo { - public static c: string = ""; - public static b: string = ""; - public static a: string; + @Dec() a1: string; + @Dec() + a3: string; + @Dec() + a2: string; constructor() {} - public d: string = ""; + b1: string; + b2: string; + + public c(): void; + @Dec() d(): void; } - `, - options: [ - { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, - ], - errors: [ - { - messageId: 'incorrectGroupOrder', - data: { - name: 'd', - rank: 'public constructor', - }, + `, + options: [ + { + default: { + memberTypes: [ + 'decorated-field', + 'field', + 'constructor', + 'decorated-method', + ], + order: 'alphabetically', }, - ], - }, - ], - }; + }, + ], + errors: [ + { + messageId: 'incorrectGroupOrder', + data: { + name: 'b1', + rank: 'constructor', + }, + }, + { + messageId: 'incorrectGroupOrder', + data: { + name: 'b2', + rank: 'constructor', + }, + }, + ], + }, + ], +}; -const sortedWithGroupingClassExpressionsOption: TSESLint.RunTests< - MessageIds, - Options -> = { +const sortedWithGroupingClassesOption: RunTests = { valid: [ - // classExpressions option + interface + alphabetically --> Default order applies + // classes option + interface + alphabetically --> Default order applies { code: ` interface Foo { - [a: string] : number; + [a: string]: number; - () : Baz; + (): Baz; - c : x; - b : x; - a : x; + c: x; + b: x; + a: x; - new () : Bar; + new (): Bar; - c() : void; - b() : void; - a() : void; + c(): void; + b(): void; + a(): void; } - `, - options: [{ classExpressions: { order: 'alphabetically' } }], + `, + options: [{ classes: { order: 'alphabetically' } }], }, - // classExpressions option + type literal + alphabetically --> Default order applies + // classes option + type literal + alphabetically --> Default order applies { code: ` type Foo = { - [a: string] : number; + [a: string]: number; - () : Baz; + (): Baz; - c : x; - b : x; - a : x; + c: x; + b: x; + a: x; - new () : Bar; + new (): Bar; - c() : void; - b() : void; - a() : void; -} - `, - options: [{ classExpressions: { order: 'alphabetically' } }], + c(): void; + b(): void; + a(): void; +}; + `, + options: [{ classes: { order: 'alphabetically' } }], }, - // classExpressions option + class + alphabetically --> Default order applies + // classes option + class + default order + alphabetically { code: ` class Foo { public static a: string; - protected static b: string = ""; - private static c: string = ""; + protected static b: string = ''; + private static c: string = ''; - public d: string = ""; - protected e: string = ""; - private f: string = ""; + public d: string = ''; + protected e: string = ''; + private f: string = ''; constructor() {} } - `, - options: [{ classExpressions: { order: 'alphabetically' } }], + `, + options: [ + { classes: { memberTypes: defaultOrder, order: 'alphabetically' } }, + ], }, - // classExpressions option + class expression + default order + alphabetically + // classes option + class + custom order + alphabetically { code: ` -const foo = class Foo { - public static a: string; - protected static b: string = ""; - private static c: string = ""; +class Foo { + constructor() {} - public d: string = ""; - protected e: string = ""; - private f: string = ""; + public d: string = ''; + protected e: string = ''; + private f: string = ''; - constructor() {} + public static a: string; + protected static b: string = ''; + private static c: string = ''; } - `, + `, options: [ { - classExpressions: { - memberTypes: defaultOrder, + classes: { + memberTypes: ['constructor', 'instance-field', 'static-field'], order: 'alphabetically', }, }, ], }, - // classExpressions option + class expression + custom order + alphabetically + // classes option + class expression + alphabetically --> Default order applies { code: ` const foo = class Foo { - constructor() {} + public static a: string; + protected static b: string = ''; + private static c: string = ''; - public d: string = ""; - protected e: string = ""; - private f: string = ""; + public d: string = ''; + protected e: string = ''; + private f: string = ''; - public static a: string; - protected static b: string = ""; - private static c: string = ""; -} - `, - options: [ - { - classExpressions: { - memberTypes: ['constructor', 'instance-field', 'static-field'], - order: 'alphabetically', - }, - }, - ], + constructor() {} +}; + `, + options: [{ classes: { order: 'alphabetically' } }], }, ], invalid: [ - // default option + class expression + wrong order within group and wrong group order + alphabetically + // default option + class + wrong order within group and wrong group order + alphabetically { code: ` -const foo = class Foo { - public static c: string = ""; - public static b: string = ""; +class Foo { + public static c: string = ''; + public static b: string = ''; public static a: string; constructor() {} - public d: string = ""; + public d: string = ''; } - `, + `, options: [ { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, ], @@ -2315,30 +2156,172 @@ const foo = class Foo { ], }; -const sortedWithGroupingInterfacesOption: TSESLint.RunTests< - MessageIds, - Options -> = { +const sortedWithGroupingClassExpressionsOption: RunTests = + { + valid: [ + // classExpressions option + interface + alphabetically --> Default order applies + { + code: ` +interface Foo { + [a: string]: number; + + (): Baz; + + c: x; + b: x; + a: x; + + new (): Bar; + + c(): void; + b(): void; + a(): void; +} + `, + options: [{ classExpressions: { order: 'alphabetically' } }], + }, + + // classExpressions option + type literal + alphabetically --> Default order applies + { + code: ` +type Foo = { + [a: string]: number; + + (): Baz; + + c: x; + b: x; + a: x; + + new (): Bar; + + c(): void; + b(): void; + a(): void; +}; + `, + options: [{ classExpressions: { order: 'alphabetically' } }], + }, + + // classExpressions option + class + alphabetically --> Default order applies + { + code: ` +class Foo { + public static a: string; + protected static b: string = ''; + private static c: string = ''; + + public d: string = ''; + protected e: string = ''; + private f: string = ''; + + constructor() {} +} + `, + options: [{ classExpressions: { order: 'alphabetically' } }], + }, + + // classExpressions option + class expression + default order + alphabetically + { + code: ` +const foo = class Foo { + public static a: string; + protected static b: string = ''; + private static c: string = ''; + + public d: string = ''; + protected e: string = ''; + private f: string = ''; + + constructor() {} +}; + `, + options: [ + { + classExpressions: { + memberTypes: defaultOrder, + order: 'alphabetically', + }, + }, + ], + }, + + // classExpressions option + class expression + custom order + alphabetically + { + code: ` +const foo = class Foo { + constructor() {} + + public d: string = ''; + protected e: string = ''; + private f: string = ''; + + public static a: string; + protected static b: string = ''; + private static c: string = ''; +}; + `, + options: [ + { + classExpressions: { + memberTypes: ['constructor', 'instance-field', 'static-field'], + order: 'alphabetically', + }, + }, + ], + }, + ], + invalid: [ + // default option + class expression + wrong order within group and wrong group order + alphabetically + { + code: ` +const foo = class Foo { + public static c: string = ''; + public static b: string = ''; + public static a: string; + + constructor() {} + + public d: string = ''; +}; + `, + options: [ + { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, + ], + errors: [ + { + messageId: 'incorrectGroupOrder', + data: { + name: 'd', + rank: 'public constructor', + }, + }, + ], + }, + ], + }; + +const sortedWithGroupingInterfacesOption: RunTests = { valid: [ // interfaces option + interface + default order + alphabetically { code: ` interface Foo { - [a: string] : number; + [a: string]: number; - a : x; - b : x; - c : x; + a: x; + b: x; + c: x; - a() : void; - b() : void; - c() : void; + a(): void; + b(): void; + c(): void; - new () : Bar; + new (): Bar; - () : Baz; + (): Baz; } - `, + `, options: [ { interfaces: { @@ -2353,20 +2336,20 @@ interface Foo { { code: ` interface Foo { - new () : Bar; + new (): Bar; - a() : void; - b() : void; - c() : void; + a(): void; + b(): void; + c(): void; - a : x; - b : x; - c : x; + a: x; + b: x; + c: x; - [a: string] : number; - () : Baz; + [a: string]: number; + (): Baz; } - `, + `, options: [ { interfaces: { @@ -2381,21 +2364,21 @@ interface Foo { { code: ` type Foo = { - [a: string] : number; + [a: string]: number; - () : Baz; + (): Baz; - c : x; - b : x; - a : x; + c: x; + b: x; + a: x; - new () : Bar; + new (): Bar; - c() : void; - b() : void; - a() : void; -} - `, + c(): void; + b(): void; + a(): void; +}; + `, options: [{ interfaces: { order: 'alphabetically' } }], }, @@ -2404,16 +2387,16 @@ type Foo = { code: ` class Foo { public static a: string; - protected static b: string = ""; - private static c: string = ""; + protected static b: string = ''; + private static c: string = ''; - public d: string = ""; - protected e: string = ""; - private f: string = ""; + public d: string = ''; + protected e: string = ''; + private f: string = ''; constructor() {} } - `, + `, options: [{ interfaces: { order: 'alphabetically' } }], }, @@ -2422,16 +2405,16 @@ class Foo { code: ` const foo = class Foo { public static a: string; - protected static b: string = ""; - private static c: string = ""; + protected static b: string = ''; + private static c: string = ''; - public d: string = ""; - protected e: string = ""; - private f: string = ""; + public d: string = ''; + protected e: string = ''; + private f: string = ''; constructor() {} -} - `, +}; + `, options: [{ interfaces: { order: 'alphabetically' } }], }, ], @@ -2440,21 +2423,21 @@ const foo = class Foo { { code: ` interface Foo { - [a: string] : number; + [a: string]: number; - a : x; - b : x; - c : x; + a: x; + b: x; + c: x; - c() : void; - b() : void; - a() : void; + c(): void; + b(): void; + a(): void; - () : Baz; + (): Baz; - new () : Bar; + new (): Bar; } - `, + `, options: [ { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, ], @@ -2478,30 +2461,27 @@ interface Foo { ], }; -const sortedWithGroupingTypeLiteralsOption: TSESLint.RunTests< - MessageIds, - Options -> = { +const sortedWithGroupingTypeLiteralsOption: RunTests = { valid: [ // typeLiterals option + interface + alphabetically --> Default order applies { code: ` interface Foo { - [a: string] : number; + [a: string]: number; - () : Baz; + (): Baz; - c : x; - b : x; - a : x; + c: x; + b: x; + a: x; - new () : Bar; + new (): Bar; - c() : void; - b() : void; - a() : void; + c(): void; + b(): void; + a(): void; } - `, + `, options: [{ typeLiterals: { order: 'alphabetically' } }], }, @@ -2509,21 +2489,21 @@ interface Foo { { code: ` type Foo = { - [a: string] : number; + [a: string]: number; - a : x; - b : x; - c : x; + a: x; + b: x; + c: x; - a() : void; - b() : void; - c() : void; + a(): void; + b(): void; + c(): void; - new () : Bar; + new (): Bar; - () : Baz; -} - `, + (): Baz; +}; + `, options: [ { typeLiterals: { @@ -2538,20 +2518,20 @@ type Foo = { { code: ` type Foo = { - new () : Bar; + new (): Bar; - a() : void; - b() : void; - c() : void; + a(): void; + b(): void; + c(): void; - a : x; - b : x; - c : x; + a: x; + b: x; + c: x; - [a: string] : number; - () : Baz; -} - `, + [a: string]: number; + (): Baz; +}; + `, options: [ { typeLiterals: { @@ -2567,16 +2547,16 @@ type Foo = { code: ` class Foo { public static a: string; - protected static b: string = ""; - private static c: string = ""; + protected static b: string = ''; + private static c: string = ''; - public d: string = ""; - protected e: string = ""; - private f: string = ""; + public d: string = ''; + protected e: string = ''; + private f: string = ''; constructor() {} } - `, + `, options: [{ typeLiterals: { order: 'alphabetically' } }], }, @@ -2585,16 +2565,16 @@ class Foo { code: ` const foo = class Foo { public static a: string; - protected static b: string = ""; - private static c: string = ""; + protected static b: string = ''; + private static c: string = ''; - public d: string = ""; - protected e: string = ""; - private f: string = ""; + public d: string = ''; + protected e: string = ''; + private f: string = ''; constructor() {} -} - `, +}; + `, options: [{ typeLiterals: { order: 'alphabetically' } }], }, ], @@ -2603,21 +2583,21 @@ const foo = class Foo { { code: ` type Foo = { - [a: string] : number; + [a: string]: number; - a : x; - b : x; - c : x; + a: x; + b: x; + c: x; - c() : void; - b() : void; - a() : void; + c(): void; + b(): void; + a(): void; - () : Baz; + (): Baz; - new () : Bar; -} - `, + new (): Bar; +}; + `, options: [ { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, ], @@ -2667,7 +2647,7 @@ class Foo { ], }; -const sortedWithoutGrouping = { +const sortedWithoutGrouping: RunTests = { valid: [ ...sortedWithoutGroupingDefaultOption.valid, ...sortedWithoutGroupingClassesOption.valid, @@ -2684,7 +2664,7 @@ const sortedWithoutGrouping = { ], }; -const sortedWithGrouping = { +const sortedWithGrouping: RunTests = { valid: [ ...sortedWithGroupingDefaultOption.valid, ...sortedWithGroupingClassesOption.valid, diff --git a/packages/eslint-plugin/tests/rules/member-ordering/member-ordering-natural-case-insensitive-order.test.ts b/packages/eslint-plugin/tests/rules/member-ordering/member-ordering-natural-case-insensitive-order.test.ts new file mode 100644 index 00000000000..782fee826d5 --- /dev/null +++ b/packages/eslint-plugin/tests/rules/member-ordering/member-ordering-natural-case-insensitive-order.test.ts @@ -0,0 +1,135 @@ +import rule from '../../../src/rules/member-ordering'; +import { RuleTester } from '../../RuleTester'; + +const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', +}); + +ruleTester.run('member-ordering-natural-order', rule, { + valid: [ + { + code: ` +interface Example { + 1: number; + 5: number; + 10: number; +} + `, + options: [ + { + default: { + order: 'natural-case-insensitive', + }, + }, + ], + }, + { + code: ` +interface Example { + new (): unknown; + + a1(): void; + a5(): void; + a10(): void; + B1(): void; + B5(): void; + B10(): void; + + a1: number; + a5: number; + a10: number; + B1: number; + B5: number; + B10: number; +} + `, + options: [ + { + default: { + memberTypes: ['constructor', 'method', 'field'], + order: 'natural-case-insensitive', + }, + }, + ], + }, + ], + invalid: [ + { + code: ` +interface Example { + 1: number; + 10: number; + 5: number; +} + `, + errors: [ + { + messageId: 'incorrectOrder', + data: { + beforeMember: 10, + member: 5, + }, + line: 5, + column: 3, + }, + ], + options: [ + { + default: { + order: 'natural-case-insensitive', + }, + }, + ], + }, + + { + code: ` +interface Example { + new (): unknown; + + a1(): void; + a10(): void; + a5(): void; + B5(): void; + B10(): void; + B1(): void; + + a5: number; + a10: number; + B1: number; + a1: number; + B5: number; + B10: number; +} + `, + errors: [ + { + column: 3, + data: { + beforeMember: 'a10', + member: 'a5', + }, + line: 7, + messageId: 'incorrectOrder', + }, + { + column: 3, + data: { + beforeMember: 'B10', + member: 'B1', + }, + line: 10, + messageId: 'incorrectOrder', + }, + ], + options: [ + { + default: { + memberTypes: ['constructor', 'method', 'field'], + order: 'natural-case-insensitive', + }, + }, + ], + }, + ], +}); diff --git a/packages/eslint-plugin/tests/rules/member-ordering/member-ordering-natural-order.test.ts b/packages/eslint-plugin/tests/rules/member-ordering/member-ordering-natural-order.test.ts new file mode 100644 index 00000000000..c34677a81c7 --- /dev/null +++ b/packages/eslint-plugin/tests/rules/member-ordering/member-ordering-natural-order.test.ts @@ -0,0 +1,144 @@ +import rule from '../../../src/rules/member-ordering'; +import { RuleTester } from '../../RuleTester'; + +const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', +}); + +ruleTester.run('member-ordering-natural-order', rule, { + valid: [ + { + code: ` +interface Example { + 1: number; + 5: number; + 10: number; +} + `, + options: [ + { + default: { + order: 'natural', + }, + }, + ], + }, + { + code: ` +interface Example { + new (): unknown; + + B1(): void; + B5(): void; + B10(): void; + a1(): void; + a5(): void; + a10(): void; + + B1: number; + B5: number; + B10: number; + a1: number; + a5: number; + a10: number; +} + `, + options: [ + { + default: { + memberTypes: ['constructor', 'method', 'field'], + order: 'natural', + }, + }, + ], + }, + ], + invalid: [ + { + code: ` +interface Example { + 1: number; + 10: number; + 5: number; +} + `, + errors: [ + { + messageId: 'incorrectOrder', + data: { + beforeMember: 10, + member: 5, + }, + line: 5, + column: 3, + }, + ], + options: [ + { + default: { + order: 'natural', + }, + }, + ], + }, + + { + code: ` +interface Example { + new (): unknown; + + a1(): void; + a10(): void; + a5(): void; + B5(): void; + B10(): void; + B1(): void; + + a5: number; + a10: number; + B1: number; + a1: number; + B5: number; + B10: number; +} + `, + errors: [ + { + column: 3, + data: { + beforeMember: 'a10', + member: 'a5', + }, + line: 7, + messageId: 'incorrectOrder', + }, + { + column: 3, + data: { + beforeMember: 'a5', + member: 'B5', + }, + line: 8, + messageId: 'incorrectOrder', + }, + { + column: 3, + data: { + beforeMember: 'B10', + member: 'B1', + }, + line: 10, + messageId: 'incorrectOrder', + }, + ], + options: [ + { + default: { + memberTypes: ['constructor', 'method', 'field'], + order: 'natural', + }, + }, + ], + }, + ], +}); diff --git a/packages/eslint-plugin/tests/rules/member-ordering/member-ordering-optionalMembers.test.ts b/packages/eslint-plugin/tests/rules/member-ordering/member-ordering-optionalMembers.test.ts new file mode 100644 index 00000000000..9c72fc7322a --- /dev/null +++ b/packages/eslint-plugin/tests/rules/member-ordering/member-ordering-optionalMembers.test.ts @@ -0,0 +1,458 @@ +import type { TSESLint } from '@typescript-eslint/utils'; + +import type { MessageIds, Options } from '../../../src/rules/member-ordering'; +import rule from '../../../src/rules/member-ordering'; +import { RuleTester } from '../../RuleTester'; + +const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', +}); + +const grouped: TSESLint.RunTests = { + valid: [ + // optionalityOrder - optional-first + { + code: ` +interface X { + c: string; + b?: string; + d?: string; +} + `, + options: [ + { + default: { + memberTypes: 'never', + order: 'alphabetically', + optionalityOrder: 'optional-first', + }, + }, + ], + }, + { + code: ` +interface X { + b?: string; + c?: string; + d?: string; +} + `, + options: [ + { + default: { + memberTypes: 'never', + order: 'as-written', + optionalityOrder: 'optional-first', + }, + }, + ], + }, + { + code: ` +interface X { + b: string; + c: string; + d: string; +} + `, + options: [ + { + default: { + memberTypes: 'never', + order: 'as-written', + optionalityOrder: 'optional-first', + }, + }, + ], + }, + { + code: ` +class X { + c: string; + d: string; + ['a']?: string; +} + `, + options: [ + { + default: { + memberTypes: 'never', + order: 'alphabetically', + optionalityOrder: 'optional-first', + }, + }, + ], + }, + { + code: ` +class X { + c: string; + public static d: string; + public static ['a']?: string; +} + `, + options: [ + { + default: { + memberTypes: 'never', + order: 'alphabetically', + optionalityOrder: 'optional-first', + }, + }, + ], + }, + { + code: ` +class X { + a: string; + static {} + b: string; +} + `, + options: [ + { + default: { + memberTypes: 'never', + order: 'alphabetically', + optionalityOrder: 'optional-first', + }, + }, + ], + }, + { + code: ` +class X { + a: string; + [i: number]: string; + b?: string; +} + `, + options: [ + { + default: { + memberTypes: 'never', + order: 'alphabetically', + optionalityOrder: 'optional-first', + }, + }, + ], + }, + { + code: ` +interface X { + a: string; + [i?: number]: string; + b?: string; +} + `, + options: [ + { + default: { + memberTypes: 'never', + order: 'alphabetically', + optionalityOrder: 'optional-first', + }, + }, + ], + }, + { + code: ` +interface X { + a: string; + (a: number): string; + new (i: number): string; + b?: string; +} + `, + options: [ + { + default: { + memberTypes: 'never', + order: 'alphabetically', + optionalityOrder: 'optional-first', + }, + }, + ], + }, + // optionalityOrder - required-first + { + code: ` +interface X { + b?: string; + d?: string; + c: string; +} + `, + options: [ + { + default: { + memberTypes: 'never', + order: 'alphabetically', + optionalityOrder: 'required-first', + }, + }, + ], + }, + { + code: ` +interface X { + b?: string; + c?: string; + d?: string; +} + `, + options: [ + { + default: { + memberTypes: 'never', + order: 'as-written', + optionalityOrder: 'required-first', + }, + }, + ], + }, + { + code: ` +interface X { + b: string; + c: string; + d: string; +} + `, + options: [ + { + default: { + memberTypes: 'never', + order: 'as-written', + optionalityOrder: 'required-first', + }, + }, + ], + }, + { + code: ` +class X { + ['c']?: string; + a: string; + b: string; +} + `, + options: [ + { + default: { + memberTypes: 'never', + order: 'alphabetically', + optionalityOrder: 'required-first', + }, + }, + ], + }, + ], + // optionalityOrder - optional-first + invalid: [ + { + code: ` +interface X { + m: string; + d?: string; + b?: string; +} + `, + options: [ + { + default: { + memberTypes: 'never', + order: 'alphabetically', + optionalityOrder: 'optional-first', + }, + }, + ], + errors: [ + { + messageId: 'incorrectOrder', + line: 5, + column: 3, + }, + ], + }, + { + code: ` +interface X { + a: string; + b?: string; + c: string; +} + `, + options: [ + { + default: { + memberTypes: ['call-signature', 'field', 'method'], + order: 'as-written', + optionalityOrder: 'optional-first', + }, + }, + ], + errors: [ + { + messageId: 'incorrectRequiredMembersOrder', + line: 4, + column: 3, + data: { + member: 'b', + optionalOrRequired: 'required', + }, + }, + ], + }, + { + code: ` +class X { + a?: string; + static {} + b?: string; +} + `, + options: [ + { + default: { + memberTypes: 'never', + order: 'as-written', + optionalityOrder: 'optional-first', + }, + }, + ], + errors: [ + { + messageId: 'incorrectRequiredMembersOrder', + line: 3, + column: 3, + data: { + member: 'a', + optionalOrRequired: 'required', + }, + }, + ], + }, + // optionalityOrder - required-first + { + code: ` +interface X { + d?: string; + b?: string; + m: string; +} + `, + options: [ + { + default: { + memberTypes: 'never', + order: 'alphabetically', + optionalityOrder: 'required-first', + }, + }, + ], + errors: [ + { + messageId: 'incorrectOrder', + line: 4, + column: 3, + }, + ], + }, + { + code: ` +interface X { + a?: string; + b: string; + c?: string; +} + `, + options: [ + { + default: { + memberTypes: ['call-signature', 'field', 'method'], + order: 'as-written', + optionalityOrder: 'required-first', + }, + }, + ], + errors: [ + { + messageId: 'incorrectRequiredMembersOrder', + line: 4, + column: 3, + data: { + member: 'b', + optionalOrRequired: 'optional', + }, + }, + ], + }, + { + code: ` +class Test { + a?: string; + b?: string; + f: string; + c?: string; + d?: string; + g: string; + h: string; +} + `, + options: [ + { + default: { + memberTypes: 'never', + order: 'as-written', + optionalityOrder: 'required-first', + }, + }, + ], + errors: [ + { + messageId: 'incorrectRequiredMembersOrder', + line: 5, + column: 3, + data: { + member: 'f', + optionalOrRequired: 'optional', + }, + }, + ], + }, + { + code: ` +class Test { + a: string; + b: string; + f?: string; + c?: string; + d?: string; +} + `, + options: [ + { + default: { + memberTypes: 'never', + order: 'as-written', + optionalityOrder: 'required-first', + }, + }, + ], + errors: [ + { + messageId: 'incorrectRequiredMembersOrder', + line: 3, + column: 3, + data: { + member: 'a', + optionalOrRequired: 'optional', + }, + }, + ], + }, + ], +}; + +ruleTester.run('member-ordering-required', rule, grouped); 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 d2a88e9c02b..d9db8f5d6eb 100644 --- a/packages/eslint-plugin/tests/rules/method-signature-style.test.ts +++ b/packages/eslint-plugin/tests/rules/method-signature-style.test.ts @@ -32,22 +32,42 @@ interface Test { 'f!': (/* b */ x: any /* c */) => void; } `, - ` + { + code: ` interface Test { get f(): number; } - `, - ` + `, + dependencyConstraints: { + typescript: '4.3', + }, + }, + { + code: ` interface Test { set f(value: number): void; } - `, + `, + dependencyConstraints: { + typescript: '4.3', + }, + }, 'type Test = { readonly f: (a: string) => number };', "type Test = { ['f']?: (a: boolean) => void };", 'type Test = { readonly f?: (a?: T) => T };', "type Test = { readonly ['f']?: (a: T, b: T) => T };", - 'type Test = { get f(): number };', - 'type Test = { set f(value: number): void };', + { + code: 'type Test = { get f(): number };', + dependencyConstraints: { + typescript: '4.3', + }, + }, + { + code: 'type Test = { set f(value: number): void };', + dependencyConstraints: { + typescript: '4.3', + }, + }, ...batchedSingleLineTests({ options: ['method'], code: noFormat` @@ -56,15 +76,23 @@ interface Test { interface Test { f(a: T): T } interface Test { ['f'](a: T, b: T): T } interface Test { 'f!'(/* b */ x: any /* c */): void } - interface Test { get f(): number } - interface Test { set f(value: number): void } type Test = { readonly f(a: string): number } type Test = { ['f']?(a: boolean): void } type Test = { readonly f?(a?: T): T } type Test = { readonly ['f']?(a: T, b: T): T } + `, + }), + ...batchedSingleLineTests({ + options: ['method'], + code: noFormat` + interface Test { get f(): number } + interface Test { set f(value: number): void } type Test = { get f(): number } type Test = { set f(value: number): void } `, + dependencyConstraints: { + typescript: '4.3', + }, }), ], invalid: [ 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 4c496b6c127..9917aec3cb7 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 @@ -768,6 +768,105 @@ ruleTester.run('naming-convention', rule, { }, ], }, + { + code: ` + const obj = { + Bar() { + return 42; + }, + async async_bar() { + return 42; + }, + }; + class foo { + public Bar() { + return 42; + } + public async async_bar() { + return 42; + } + } + abstract class foo { + public abstract Bar() { + return 42; + } + public abstract async async_bar() { + return 42; + } + } + `, + parserOptions, + options: [ + { + selector: 'memberLike', + format: ['camelCase'], + }, + { + selector: ['method', 'objectLiteralMethod'], + format: ['snake_case'], + modifiers: ['async'], + }, + { + selector: 'method', + format: ['PascalCase'], + }, + ], + }, + { + code: ` + const async_bar1 = async () => {}; + async function async_bar2() {} + const async_bar3 = async function async_bar4() {}; + `, + parserOptions, + options: [ + { + selector: 'memberLike', + format: ['camelCase'], + }, + { + selector: 'method', + format: ['PascalCase'], + }, + { + selector: ['variable'], + format: ['snake_case'], + modifiers: ['async'], + }, + ], + }, + { + code: ` + class foo extends bar { + public someAttribute = 1; + public override some_attribute_override = 1; + public someMethod() { + return 42; + } + public override some_method_override2() { + return 42; + } + } + abstract class foo extends bar { + public abstract someAttribute: string; + public abstract override some_attribute_override: string; + public abstract someMethod(): string; + public abstract override some_method_override2(): string; + } + `, + parserOptions, + options: [ + { + selector: 'memberLike', + format: ['camelCase'], + }, + { + selector: ['memberLike'], + modifiers: ['override'], + format: ['snake_case'], + }, + ], + }, ], invalid: [ { @@ -1526,5 +1625,352 @@ ruleTester.run('naming-convention', rule, { // 6, not 7 because 'foo' is valid errors: Array(6).fill({ messageId: 'doesNotMatchFormat' }), }, + { + code: ` + class foo { + public Bar() { + return 42; + } + public async async_bar() { + return 42; + } + // ❌ error + public async asyncBar() { + return 42; + } + // ❌ error + public AsyncBar2 = async () => { + return 42; + }; + // ❌ error + public AsyncBar3 = async function () { + return 42; + }; + } + abstract class foo { + public abstract Bar(): number; + public abstract async async_bar(): number; + // ❌ error + public abstract async ASYNC_BAR(): number; + } + `, + parserOptions, + options: [ + { + selector: 'memberLike', + format: ['camelCase'], + }, + { + selector: 'method', + format: ['PascalCase'], + }, + { + selector: ['method', 'objectLiteralMethod'], + format: ['snake_case'], + modifiers: ['async'], + }, + ], + errors: [ + { + messageId: 'doesNotMatchFormat', + data: { + type: 'Class Method', + name: 'asyncBar', + formats: 'snake_case', + }, + }, + { + messageId: 'doesNotMatchFormat', + data: { + type: 'Class Method', + name: 'AsyncBar2', + formats: 'snake_case', + }, + }, + { + messageId: 'doesNotMatchFormat', + data: { + type: 'Class Method', + name: 'AsyncBar3', + formats: 'snake_case', + }, + }, + { + messageId: 'doesNotMatchFormat', + data: { + type: 'Class Method', + name: 'ASYNC_BAR', + formats: 'snake_case', + }, + }, + ], + }, + { + code: ` + const obj = { + Bar() { + return 42; + }, + async async_bar() { + return 42; + }, + // ❌ error + async AsyncBar() { + return 42; + }, + // ❌ error + AsyncBar2: async () => { + return 42; + }, + // ❌ error + AsyncBar3: async function () { + return 42; + }, + }; + `, + parserOptions, + options: [ + { + selector: 'memberLike', + format: ['camelCase'], + }, + { + selector: 'method', + format: ['PascalCase'], + }, + { + selector: ['method', 'objectLiteralMethod'], + format: ['snake_case'], + modifiers: ['async'], + }, + ], + errors: [ + { + messageId: 'doesNotMatchFormat', + data: { + type: 'Object Literal Method', + name: 'AsyncBar', + formats: 'snake_case', + }, + }, + { + messageId: 'doesNotMatchFormat', + data: { + type: 'Object Literal Method', + name: 'AsyncBar2', + formats: 'snake_case', + }, + }, + { + messageId: 'doesNotMatchFormat', + data: { + type: 'Object Literal Method', + name: 'AsyncBar3', + formats: 'snake_case', + }, + }, + ], + }, + { + code: ` + const syncbar1 = () => {}; + function syncBar2() {} + const syncBar3 = function syncBar4() {}; + + // ❌ error + const AsyncBar1 = async () => {}; + const async_bar1 = async () => {}; + const async_bar3 = async function async_bar4() {}; + async function async_bar2() {} + // ❌ error + const asyncBar5 = async function async_bar6() {}; + `, + parserOptions, + options: [ + { + selector: 'variableLike', + format: ['camelCase'], + }, + { + selector: ['variableLike'], + modifiers: ['async'], + format: ['snake_case'], + }, + ], + errors: [ + { + messageId: 'doesNotMatchFormat', + data: { + type: 'Variable', + name: 'AsyncBar1', + formats: 'snake_case', + }, + }, + { + messageId: 'doesNotMatchFormat', + data: { + type: 'Variable', + name: 'asyncBar5', + formats: 'snake_case', + }, + }, + ], + }, + { + code: ` + const syncbar1 = () => {}; + function syncBar2() {} + const syncBar3 = function syncBar4() {}; + + const async_bar1 = async () => {}; + // ❌ error + async function asyncBar2() {} + const async_bar3 = async function async_bar4() {}; + async function async_bar2() {} + // ❌ error + const async_bar3 = async function ASYNC_BAR4() {}; + `, + parserOptions, + options: [ + { + selector: 'variableLike', + format: ['camelCase'], + }, + { + selector: ['variableLike'], + modifiers: ['async'], + format: ['snake_case'], + }, + ], + errors: [ + { + messageId: 'doesNotMatchFormat', + data: { + type: 'Function', + name: 'asyncBar2', + formats: 'snake_case', + }, + }, + { + messageId: 'doesNotMatchFormat', + data: { + type: 'Function', + name: 'ASYNC_BAR4', + formats: 'snake_case', + }, + }, + ], + }, + { + code: ` + class foo extends bar { + public someAttribute = 1; + public override some_attribute_override = 1; + // ❌ error + public override someAttributeOverride = 1; + } + `, + parserOptions, + options: [ + { + selector: 'memberLike', + format: ['camelCase'], + }, + { + selector: ['memberLike'], + modifiers: ['override'], + format: ['snake_case'], + }, + ], + errors: [ + { + messageId: 'doesNotMatchFormat', + data: { + type: 'Class Property', + name: 'someAttributeOverride', + formats: 'snake_case', + }, + }, + ], + }, + { + code: ` + class foo extends bar { + public override some_method_override() { + return 42; + } + // ❌ error + public override someMethodOverride() { + return 42; + } + } + `, + parserOptions, + options: [ + { + selector: 'memberLike', + format: ['camelCase'], + }, + { + selector: ['memberLike'], + modifiers: ['override'], + format: ['snake_case'], + }, + ], + errors: [ + { + messageId: 'doesNotMatchFormat', + data: { + type: 'Class Method', + name: 'someMethodOverride', + formats: 'snake_case', + }, + }, + ], + }, + { + code: ` + class foo extends bar { + public get someGetter(): string; + public override get some_getter_override(): string; + // ❌ error + public override get someGetterOverride(): string; + public set someSetter(val: string); + public override set some_setter_override(val: string); + // ❌ error + public override set someSetterOverride(val: string); + } + `, + parserOptions, + options: [ + { + selector: 'memberLike', + format: ['camelCase'], + }, + { + selector: ['memberLike'], + modifiers: ['override'], + format: ['snake_case'], + }, + ], + errors: [ + { + messageId: 'doesNotMatchFormat', + data: { + type: 'Accessor', + name: 'someGetterOverride', + formats: 'snake_case', + }, + }, + { + messageId: 'doesNotMatchFormat', + data: { + type: 'Accessor', + name: 'someSetterOverride', + formats: 'snake_case', + }, + }, + ], + }, ], }); 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 a60ac656a40..c8af0c48ad8 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 @@ -113,6 +113,9 @@ tag\`\${{}}\`; return \`\${v}\`; } `, + "'' += new Error();", + "'' += new URL();", + "'' += new URLSearchParams();", ], invalid: [ { 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 7d29b0fa5a2..7f35c79852c 100644 --- a/packages/eslint-plugin/tests/rules/no-empty-function.test.ts +++ b/packages/eslint-plugin/tests/rules/no-empty-function.test.ts @@ -78,6 +78,9 @@ class Foo extends Base { override foo() {} } `, + dependencyConstraints: { + typescript: '4.3', + }, options: [{ allow: ['overrideMethods'] }], }, ], @@ -206,6 +209,9 @@ class Foo extends Base { override foo() {} } `, + dependencyConstraints: { + typescript: '4.3', + }, errors: [ { messageId: 'unexpected', diff --git a/packages/eslint-plugin/tests/rules/no-empty-interface.test.ts b/packages/eslint-plugin/tests/rules/no-empty-interface.test.ts index 0d7f73342b5..893deaf01d6 100644 --- a/packages/eslint-plugin/tests/rules/no-empty-interface.test.ts +++ b/packages/eslint-plugin/tests/rules/no-empty-interface.test.ts @@ -34,6 +34,18 @@ interface Bar extends Foo {} `, options: [{ allowSingleExtends: true }], }, + { + code: ` +interface Foo { + props: string; +} + +interface Bar extends Foo {} + +class Bar {} + `, + options: [{ allowSingleExtends: true }], + }, ], invalid: [ { @@ -58,6 +70,82 @@ interface Bar extends Foo {} }, { code: ` +interface Foo { + props: string; +} + +interface Bar extends Foo {} + +class Baz {} + `, + output: ` +interface Foo { + props: string; +} + +type Bar = Foo + +class Baz {} + `, + options: [{ allowSingleExtends: false }], + errors: [ + { + messageId: 'noEmptyWithSuper', + line: 6, + column: 11, + }, + ], + }, + { + code: ` +interface Foo { + props: string; +} + +interface Bar extends Foo {} + +class Bar {} + `, + options: [{ allowSingleExtends: false }], + errors: [ + { + messageId: 'noEmptyWithSuper', + line: 6, + column: 11, + }, + ], + output: null, + }, + { + code: ` +interface Foo { + props: string; +} + +interface Bar extends Foo {} + +const bar = class Bar {}; + `, + output: ` +interface Foo { + props: string; +} + +type Bar = Foo + +const bar = class Bar {}; + `, + options: [{ allowSingleExtends: false }], + errors: [ + { + messageId: 'noEmptyWithSuper', + line: 6, + column: 11, + }, + ], + }, + { + code: ` interface Foo { name: string; } diff --git a/packages/eslint-plugin/tests/rules/no-extra-parens.test.ts b/packages/eslint-plugin/tests/rules/no-extra-parens.test.ts index 6a9e87111aa..369f55101f2 100644 --- a/packages/eslint-plugin/tests/rules/no-extra-parens.test.ts +++ b/packages/eslint-plugin/tests/rules/no-extra-parens.test.ts @@ -141,6 +141,10 @@ t.true((me.get as SinonStub).calledWithExactly('/foo', other)); t.true((me.get).calledWithExactly('/foo', other)); (requestInit.headers as Headers).get('Cookie'); ( requestInit.headers).get('Cookie'); +class Foo {} +class Foo extends (Bar as any) {} +const foo = class {}; +const foo = class extends (Bar as any) {} `, parserOptions: { ecmaFeatures: { @@ -254,6 +258,10 @@ new a((1)); a<(A)>((1)); async function f(arg: Promise) { await (arg); } async function f(arg: any) { await ((arg as Promise)); } +class Foo extends ((Bar as any)) {} +class Foo extends (Bar) {} +const foo = class extends ((Bar as any)) {} +const foo = class extends (Bar) {} `, output: ` a = b * c; @@ -267,6 +275,10 @@ new a(1); a<(A)>(1); async function f(arg: Promise) { await arg; } async function f(arg: any) { await (arg as Promise); } +class Foo extends (Bar as any) {} +class Foo extends Bar {} +const foo = class extends (Bar as any) {} +const foo = class extends Bar {} `, errors: [ { @@ -324,6 +336,26 @@ async function f(arg: any) { await (arg as Promise); } line: 12, column: 37, }, + { + messageId: 'unexpected', + line: 13, + column: 20, + }, + { + messageId: 'unexpected', + line: 14, + column: 19, + }, + { + messageId: 'unexpected', + line: 15, + column: 28, + }, + { + messageId: 'unexpected', + line: 16, + column: 27, + }, ], }), ...batchedSingleLineTests({ 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 17ec0bb6198..a80acab989a 100644 --- a/packages/eslint-plugin/tests/rules/no-floating-promises.test.ts +++ b/packages/eslint-plugin/tests/rules/no-floating-promises.test.ts @@ -656,6 +656,147 @@ async function test() { { line: 3, messageId: 'floating', + suggestions: [ + { + messageId: 'floatingFixAwait', + output: ` +async function test() { + await Promise.resolve(); +} + `, + }, + ], + }, + ], + }, + { + code: ` +async function test() { + const promise = new Promise((resolve, reject) => resolve('value')); + promise; +} + `, + options: [{ ignoreVoid: false }], + errors: [ + { + line: 4, + messageId: 'floating', + suggestions: [ + { + messageId: 'floatingFixAwait', + output: ` +async function test() { + const promise = new Promise((resolve, reject) => resolve('value')); + await promise; +} + `, + }, + ], + }, + ], + }, + { + code: ` +async function returnsPromise() { + return 'value'; +} +void returnsPromise(); + `, + options: [{ ignoreVoid: false }], + errors: [ + { + line: 5, + messageId: 'floating', + suggestions: [ + { + messageId: 'floatingFixAwait', + output: ` +async function returnsPromise() { + return 'value'; +} +await returnsPromise(); + `, + }, + ], + }, + ], + }, + { + // eslint-disable-next-line @typescript-eslint/internal/plugin-test-formatting + code: ` +async function returnsPromise() { + return 'value'; +} +void /* ... */ returnsPromise(); + `, + options: [{ ignoreVoid: false }], + errors: [ + { + line: 5, + messageId: 'floating', + suggestions: [ + { + messageId: 'floatingFixAwait', + output: ` +async function returnsPromise() { + return 'value'; +} +await /* ... */ returnsPromise(); + `, + }, + ], + }, + ], + }, + { + code: ` +async function returnsPromise() { + return 'value'; +} +1, returnsPromise(); + `, + options: [{ ignoreVoid: false }], + errors: [ + { + line: 5, + messageId: 'floating', + suggestions: [ + { + messageId: 'floatingFixAwait', + output: ` +async function returnsPromise() { + return 'value'; +} +await (1, returnsPromise()); + `, + }, + ], + }, + ], + }, + { + code: ` +async function returnsPromise() { + return 'value'; +} +bool ? returnsPromise() : null; + `, + options: [{ ignoreVoid: false }], + errors: [ + { + line: 5, + messageId: 'floating', + suggestions: [ + { + messageId: 'floatingFixAwait', + output: ` +async function returnsPromise() { + return 'value'; +} +await (bool ? returnsPromise() : null); + `, + }, + ], }, ], }, diff --git a/packages/eslint-plugin/tests/rules/no-invalid-void-type.test.ts b/packages/eslint-plugin/tests/rules/no-invalid-void-type.test.ts index 8164e85b2bd..1a972b665be 100644 --- a/packages/eslint-plugin/tests/rules/no-invalid-void-type.test.ts +++ b/packages/eslint-plugin/tests/rules/no-invalid-void-type.test.ts @@ -316,7 +316,7 @@ ruleTester.run('allowInGenericTypeArguments: true', rule, { code: 'type UnionType2 = string | number | void;', errors: [ { - messageId: 'invalidVoidNotReturnOrGeneric', + messageId: 'invalidVoidUnionConstituent', line: 1, column: 37, }, @@ -326,12 +326,32 @@ ruleTester.run('allowInGenericTypeArguments: true', rule, { code: 'type UnionType3 = string | ((number & any) | (string | void));', errors: [ { - messageId: 'invalidVoidNotReturnOrGeneric', + messageId: 'invalidVoidUnionConstituent', line: 1, column: 56, }, ], }, + { + code: 'declare function test(): number | void;', + errors: [ + { + messageId: 'invalidVoidUnionConstituent', + line: 1, + column: 35, + }, + ], + }, + { + code: 'declare function test(): T;', + errors: [ + { + messageId: 'invalidVoidUnionConstituent', + line: 1, + column: 42, + }, + ], + }, { code: 'type IntersectionType = string & number & void;', errors: [ @@ -394,7 +414,7 @@ ruleTester.run('allowInGenericTypeArguments: true', rule, { code: 'type invalidVoidUnion = void | Map;', errors: [ { - messageId: 'invalidVoidNotReturnOrGeneric', + messageId: 'invalidVoidUnionConstituent', line: 1, column: 25, }, diff --git a/packages/eslint-plugin/tests/rules/no-magic-numbers.test.ts b/packages/eslint-plugin/tests/rules/no-magic-numbers.test.ts index 3be7590742a..d6aa21a799e 100644 --- a/packages/eslint-plugin/tests/rules/no-magic-numbers.test.ts +++ b/packages/eslint-plugin/tests/rules/no-magic-numbers.test.ts @@ -536,6 +536,9 @@ type Foo = { [K in keyof Other]: \`\${K & number}\`; }; `, + dependencyConstraints: { + typescript: '4.1', + }, options: [{ ignoreTypeIndexes: true }], errors: [ { 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 55ba429cdb0..c962761717d 100644 --- a/packages/eslint-plugin/tests/rules/no-misused-promises.test.ts +++ b/packages/eslint-plugin/tests/rules/no-misused-promises.test.ts @@ -373,6 +373,60 @@ console.log([...Promise.resolve(42)]); `, options: [{ checksSpreads: false }], }, + ` +function spreadAny(..._args: any): void {} + +spreadAny( + true, + () => Promise.resolve(1), + () => Promise.resolve(false), +); + `, + ` +function spreadArrayAny(..._args: Array): void {} + +spreadArrayAny( + true, + () => Promise.resolve(1), + () => Promise.resolve(false), +); + `, + ` +function spreadArrayUnknown(..._args: Array): void {} + +spreadArrayUnknown(() => Promise.resolve(true), 1, 2); + +function spreadArrayFuncPromise( + ..._args: Array<() => Promise> +): void {} + +spreadArrayFuncPromise( + () => Promise.resolve(undefined), + () => Promise.resolve(undefined), +); + `, + // Prettier adds a () but this tests arguments being undefined, not [] + // eslint-disable-next-line @typescript-eslint/internal/plugin-test-formatting + ` +class TakeCallbacks { + constructor(...callbacks: Array<() => void>) {} +} + +new TakeCallbacks; +new TakeCallbacks(); +new TakeCallbacks( + () => 1, + () => true, +); + `, + ` +function restTuple(...args: []): void; +function restTuple(...args: [string]): void; +function restTuple(..._args: string[]): void {} + +restTuple(); +restTuple('Hello'); + `, ], invalid: [ @@ -970,5 +1024,99 @@ console.log({ ...(condition ? Promise.resolve({ key: 42 }) : {}) }); { line: 7, messageId: 'spread' }, ], }, + { + code: ` +function restPromises(first: Boolean, ...callbacks: Array<() => void>): void {} + +restPromises( + true, + () => Promise.resolve(true), + () => Promise.resolve(null), + () => true, + () => Promise.resolve('Hello'), +); + `, + errors: [ + { line: 6, messageId: 'voidReturnArgument' }, + { line: 7, messageId: 'voidReturnArgument' }, + { line: 9, messageId: 'voidReturnArgument' }, + ], + }, + { + code: ` +type MyUnion = (() => void) | boolean; + +function restUnion(first: string, ...callbacks: Array): void {} +restUnion('Testing', false, () => Promise.resolve(true)); + `, + errors: [{ line: 5, messageId: 'voidReturnArgument' }], + }, + { + code: ` +function restTupleOne(first: string, ...callbacks: [() => void]): void {} +restTupleOne('My string', () => Promise.resolve(1)); + `, + errors: [{ line: 3, messageId: 'voidReturnArgument' }], + }, + { + code: ` +function restTupleTwo( + first: boolean, + ...callbacks: [undefined, () => void, undefined] +): void {} + +restTupleTwo(true, undefined, () => Promise.resolve(true), undefined); + `, + errors: [{ line: 7, messageId: 'voidReturnArgument' }], + }, + { + code: ` +function restTupleFour( + first: number, + ...callbacks: [() => void, boolean, () => void, () => void] +): void; + +restTupleFour( + 1, + () => Promise.resolve(true), + false, + () => {}, + () => Promise.resolve(1), +); + `, + errors: [ + { line: 9, messageId: 'voidReturnArgument' }, + { line: 12, messageId: 'voidReturnArgument' }, + ], + }, + { + // Prettier adds a () but this tests arguments being undefined, not [] + // eslint-disable-next-line @typescript-eslint/internal/plugin-test-formatting + code: ` +class TakesVoidCb { + constructor(first: string, ...args: Array<() => void>); +} + +new TakesVoidCb; +new TakesVoidCb(); +new TakesVoidCb( + 'Testing', + () => {}, + () => Promise.resolve(true), +); + `, + errors: [{ line: 11, messageId: 'voidReturnArgument' }], + }, + { + code: ` +function restTuple(...args: []): void; +function restTuple(...args: [boolean, () => void]): void; +function restTuple(..._args: any[]): void {} + +restTuple(); +restTuple(true, () => Promise.resolve(1)); + `, + errors: [{ line: 7, messageId: 'voidReturnArgument' }], + }, ], }); 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 454fb255f0e..29259f4b3f0 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 @@ -154,11 +154,21 @@ ruleTester.run('no-redundant-type-constituents', rule, { type B = string; type T = B & null; `, - 'type T = `${string}` & null;', - ` - type B = \`\${string}\`; - type T = B & null; - `, + { + code: 'type T = `${string}` & null;', + dependencyConstraints: { + typescript: '4.1', + }, + }, + { + code: ` + type B = \`\${string}\`; + type T = B & null; + `, + dependencyConstraints: { + typescript: '4.1', + }, + }, ], invalid: [ @@ -442,6 +452,9 @@ ruleTester.run('no-redundant-type-constituents', rule, { }, { code: 'type T = `a${number}c` | string;', + dependencyConstraints: { + typescript: '4.1', + }, errors: [ { column: 10, @@ -458,6 +471,9 @@ ruleTester.run('no-redundant-type-constituents', rule, { type B = \`a\${number}c\`; type T = B | string; `, + dependencyConstraints: { + typescript: '4.1', + }, errors: [ { column: 18, @@ -471,6 +487,9 @@ ruleTester.run('no-redundant-type-constituents', rule, { }, { code: 'type T = `${number}` | string;', + dependencyConstraints: { + typescript: '4.1', + }, errors: [ { column: 10, 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 1097f466a18..854154ff096 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 @@ -12,6 +12,25 @@ const ruleTester = new RuleTester({ ruleTester.run('no-shadow TS tests', rule, { valid: [ + 'function foo any>(arg: T) {}', + 'function foo any>(arg: T) {}', + 'function foo any>(arg: T) {}', + 'function foo any>(fn: T, args: any[]) {}', + 'function foo any>(fn: T, args: any[]) {}', + 'function foo any>(fn: T, ...args: any[]) {}', + 'function foo any>(fn: T, args: any[]) {}', + 'function foo any>(fn: T, args: any[]) {}', + 'function foo any>(fn: T, args: any) {}', + ` +function foo any>( + fn: T, + ...args: any[] +) {} + `, + ` +type Args = 1; +function foo void>(arg: T) {} + `, // nested conditional types ` export type ArrayInput = Func extends (arg0: Array) => any @@ -126,6 +145,27 @@ type Fn = (Foo: string) => typeof Foo; Foo: 'writable', }, }, + // https://github.com/typescript-eslint/typescript-eslint/issues/6098 + { + code: ` +const arg = 0; + +interface Test { + (arg: string): typeof arg; +} + `, + options: [{ ignoreFunctionTypeParameterNameValueShadow: true }], + }, + { + code: ` +const arg = 0; + +interface Test { + p1(arg: string): typeof arg; +} + `, + options: [{ ignoreFunctionTypeParameterNameValueShadow: true }], + }, // https://github.com/typescript-eslint/typescript-eslint/issues/2724 { code: ` @@ -201,6 +241,9 @@ import { type foo } from './foo'; // 'foo' is already declared in the upper scope function doThing(foo: number) {} `, + dependencyConstraints: { + typescript: '4.5', + }, options: [{ ignoreTypeValueShadow: true }], }, { @@ -375,6 +418,22 @@ type T = 1; }, { code: ` +type T = 1; +function foo(arg: T) {} + `, + errors: [ + { + messageId: 'noShadow', + data: { + name: 'T', + shadowedLine: 2, + shadowedColumn: 6, + }, + }, + ], + }, + { + code: ` function foo() { return function () {}; } @@ -392,6 +451,22 @@ function foo() { }, { code: ` +type T = string; +function foo void>(arg: T) {} + `, + errors: [ + { + messageId: 'noShadow', + data: { + name: 'T', + shadowedLine: 2, + shadowedColumn: 6, + }, + }, + ], + }, + { + code: ` const x = 1; { type x = string; @@ -471,6 +546,48 @@ type Fn = (Foo: string) => typeof Foo; }, ], }, + + // https://github.com/typescript-eslint/typescript-eslint/issues/6098 + { + code: ` +const arg = 0; + +interface Test { + (arg: string): typeof arg; +} + `, + options: [{ ignoreFunctionTypeParameterNameValueShadow: false }], + errors: [ + { + messageId: 'noShadow', + data: { + name: 'arg', + shadowedLine: 2, + shadowedColumn: 7, + }, + }, + ], + }, + { + code: ` +const arg = 0; + +interface Test { + p1(arg: string): typeof arg; +} + `, + options: [{ ignoreFunctionTypeParameterNameValueShadow: false }], + errors: [ + { + messageId: 'noShadow', + data: { + name: 'arg', + shadowedLine: 2, + shadowedColumn: 7, + }, + }, + ], + }, { code: ` import type { foo } from './foo'; @@ -494,6 +611,9 @@ function doThing(foo: number) {} import { type foo } from './foo'; function doThing(foo: number) {} `, + dependencyConstraints: { + typescript: '4.5', + }, options: [{ ignoreTypeValueShadow: false }], errors: [ { @@ -621,6 +741,9 @@ declare module 'baz' { } } `, + dependencyConstraints: { + typescript: '4.5', + }, errors: [ { messageId: 'noShadow', @@ -641,6 +764,9 @@ declare module 'bar' { export type Foo = string; } `, + dependencyConstraints: { + typescript: '4.5', + }, errors: [ { messageId: 'noShadow', @@ -663,6 +789,9 @@ declare module 'bar' { } } `, + dependencyConstraints: { + typescript: '4.5', + }, errors: [ { messageId: 'noShadow', @@ -703,5 +832,29 @@ let y; }, ], }, + { + code: ` +function foo any>(fn: T, args: any[]) {} + `, + options: [ + { + ignoreTypeValueShadow: false, + builtinGlobals: true, + }, + ], + globals: { + args: 'writable', + }, + errors: [ + { + messageId: 'noShadowGlobal', + data: { + name: 'args', + shadowedLine: 2, + shadowedColumn: 5, + }, + }, + ], + }, ], }); diff --git a/packages/eslint-plugin/tests/rules/no-type-alias.test.ts b/packages/eslint-plugin/tests/rules/no-type-alias.test.ts index 6a307454f51..ed2c00c9991 100644 --- a/packages/eslint-plugin/tests/rules/no-type-alias.test.ts +++ b/packages/eslint-plugin/tests/rules/no-type-alias.test.ts @@ -133,62 +133,107 @@ ruleTester.run('no-type-alias', rule, { }, { code: 'type Foo = `a-${number}`;', + dependencyConstraints: { + typescript: '4.1', + }, options: [{ allowAliases: 'always' }], }, { code: 'type Foo = `a-${number}` | `b-${number}`;', + dependencyConstraints: { + typescript: '4.1', + }, options: [{ allowAliases: 'always' }], }, { code: 'type Foo = `a-${number}` | `b-${number}`;', + dependencyConstraints: { + typescript: '4.1', + }, options: [{ allowAliases: 'in-unions-and-intersections' }], }, { code: 'type Foo = `a-${number}` | `b-${number}`;', + dependencyConstraints: { + typescript: '4.1', + }, options: [{ allowAliases: 'in-unions' }], }, { code: 'type Foo = `a-${number}` | `b-${number}` | `c-${number}`;', + dependencyConstraints: { + typescript: '4.1', + }, options: [{ allowAliases: 'always' }], }, { code: 'type Foo = `a-${number}` | `b-${number}` | `c-${number}`;', + dependencyConstraints: { + typescript: '4.1', + }, options: [{ allowAliases: 'in-unions-and-intersections' }], }, { code: 'type Foo = `a-${number}` | `b-${number}` | `c-${number}`;', + dependencyConstraints: { + typescript: '4.1', + }, options: [{ allowAliases: 'in-unions' }], }, { code: 'type Foo = `a-${number}` & `b-${number}`;', + dependencyConstraints: { + typescript: '4.1', + }, options: [{ allowAliases: 'always' }], }, { code: 'type Foo = `a-${number}` & `b-${number}`;', + dependencyConstraints: { + typescript: '4.1', + }, options: [{ allowAliases: 'in-unions-and-intersections' }], }, { code: 'type Foo = `a-${number}` & `b-${number}`;', + dependencyConstraints: { + typescript: '4.1', + }, options: [{ allowAliases: 'in-intersections' }], }, { code: 'type Foo = `a-${number}` & `b-${number}` & `c-${number}`;', + dependencyConstraints: { + typescript: '4.1', + }, options: [{ allowAliases: 'always' }], }, { code: 'type Foo = `a-${number}` & `b-${number}` & `c-${number}`;', + dependencyConstraints: { + typescript: '4.1', + }, options: [{ allowAliases: 'in-unions-and-intersections' }], }, { code: 'type Foo = `a-${number}` & `b-${number}` & `c-${number}`;', + dependencyConstraints: { + typescript: '4.1', + }, options: [{ allowAliases: 'in-intersections' }], }, { code: 'type Foo = `a-${number}` | (`b-${number}` & `c-${number}`);', + dependencyConstraints: { + typescript: '4.1', + }, options: [{ allowAliases: 'always' }], }, { code: 'type Foo = `a-${number}` | (`b-${number}` & `c-${number}`);', + dependencyConstraints: { + typescript: '4.1', + }, options: [{ allowAliases: 'in-unions-and-intersections' }], }, { @@ -3402,6 +3447,9 @@ type Foo = { }, { code: 'type Foo = `foo-${number}`;', + dependencyConstraints: { + typescript: '4.1', + }, errors: [ { messageId: 'noTypeAlias', @@ -3415,6 +3463,9 @@ type Foo = { }, { code: 'type Foo = `a-${number}` | `b-${number}`;', + dependencyConstraints: { + typescript: '4.1', + }, options: [{ allowAliases: 'never' }], errors: [ { @@ -3439,6 +3490,9 @@ type Foo = { }, { code: 'type Foo = `a-${number}` & `b-${number}`;', + dependencyConstraints: { + typescript: '4.1', + }, options: [{ allowAliases: 'never' }], errors: [ { 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 d5fd8a8e5b3..af8b189f899 100644 --- a/packages/eslint-plugin/tests/rules/no-unnecessary-condition.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unnecessary-condition.test.ts @@ -45,7 +45,7 @@ const unnecessaryConditionTest = ( errors: [ruleError(4, 12, messageId)], }); -ruleTester.run('no-unnecessary-conditionals', rule, { +ruleTester.run('no-unnecessary-condition', rule, { valid: [ ` declare const b1: boolean; @@ -67,6 +67,11 @@ for (let i = 0; b1 && b2; i++) { } const t1 = b1 && b2 ? 'yes' : 'no'; for (;;) {} + `, + ` +declare function foo(): number | void; +const result1 = foo() === undefined; +const result2 = foo() == null; `, necessaryConditionTest('false | 5'), // Truthy literal and falsy literal necessaryConditionTest('boolean | "foo"'), // boolean and truthy literal @@ -522,6 +527,24 @@ if (x) { tsconfigRootDir: path.join(rootPath, 'unstrict'), }, }, + ` +interface Foo { + [key: string]: [string] | undefined; +} + +type OptionalFoo = Foo | undefined; +declare const foo: OptionalFoo; +foo?.test?.length; + `, + ` +interface Foo { + [key: number]: [string] | undefined; +} + +type OptionalFoo = Foo | undefined; +declare const foo: OptionalFoo; +foo?.[1]?.length; + `, ], invalid: [ // Ensure that it's checking in all the right places @@ -1543,5 +1566,36 @@ if (x) { tsconfigRootDir: path.join(rootPath, 'unstrict'), }, }, + { + code: ` +interface Foo { + test: string; + [key: string]: [string] | undefined; +} + +type OptionalFoo = Foo | undefined; +declare const foo: OptionalFoo; +foo?.test?.length; + `, + output: ` +interface Foo { + test: string; + [key: string]: [string] | undefined; +} + +type OptionalFoo = Foo | undefined; +declare const foo: OptionalFoo; +foo?.test.length; + `, + errors: [ + { + messageId: 'neverOptionalChain', + line: 9, + endLine: 9, + column: 10, + endColumn: 12, + }, + ], + }, ], }); 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 512407474e6..abedc24d274 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 @@ -127,11 +127,17 @@ class Foo extends Bar {} interface Bar {} class Foo implements Bar {} `, - ` + { + code: ` import { F } from './missing'; function bar() {} bar>(); - `, + `, + dependencyConstraints: { + // TS 4.5 improved type resolution for unresolved generics + typescript: '4.5', + }, + }, ` type A = T; type B = A; 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 new file mode 100644 index 00000000000..1feabbe8158 --- /dev/null +++ b/packages/eslint-plugin/tests/rules/no-unsafe-declaration-merging.test.ts @@ -0,0 +1,120 @@ +import rule from '../../src/rules/no-unsafe-declaration-merging'; +import { getFixturesRootDir, RuleTester } from '../RuleTester'; + +const rootPath = getFixturesRootDir(); + +const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', + parserOptions: { + sourceType: 'module', + tsconfigRootDir: rootPath, + project: './tsconfig.json', + }, +}); + +ruleTester.run('no-unsafe-declaration-merging', rule, { + valid: [ + ` +interface Foo {} +class Bar implements Foo {} + `, + ` +namespace Foo {} +namespace Foo {} + `, + ` +enum Foo {} +namespace Foo {} + `, + ` +namespace Fooo {} +function Foo() {} + `, + ` +const Foo = class {}; + `, + ` +interface Foo { + props: string; +} + +function bar() { + return class Foo {}; +} + `, + ` +interface Foo { + props: string; +} + +(function bar() { + class Foo {} +})(); + `, + ` +declare global { + interface Foo {} +} + +class Foo {} + `, + ], + invalid: [ + { + code: ` +interface Foo {} +class Foo {} + `, + errors: [ + { + messageId: 'unsafeMerging', + line: 2, + column: 11, + }, + { + messageId: 'unsafeMerging', + line: 3, + column: 7, + }, + ], + }, + { + code: ` +class Foo {} +interface Foo {} + `, + errors: [ + { + messageId: 'unsafeMerging', + line: 2, + column: 7, + }, + { + messageId: 'unsafeMerging', + line: 3, + column: 11, + }, + ], + }, + { + code: ` +declare global { + interface Foo {} + class Foo {} +} + `, + errors: [ + { + messageId: 'unsafeMerging', + line: 3, + column: 13, + }, + { + messageId: 'unsafeMerging', + line: 4, + column: 9, + }, + ], + }, + ], +}); 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 715d2e94385..ee2191a3f4c 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 @@ -402,7 +402,8 @@ export const map: { [name in Foo]: Bar } = { }; `, // 4.1 remapped mapped type - noFormat` + { + code: noFormat` type Foo = 'a' | 'b' | 'c'; type Bar = number; @@ -411,7 +412,11 @@ export const map: { [name in Foo as string]: Bar } = { b: 2, c: 3, }; - `, + `, + dependencyConstraints: { + typescript: '4.1', + }, + }, ` import { Nullable } from 'nullable'; class A { @@ -747,6 +752,9 @@ function foo(value: T): T { } export type Foo = typeof foo; `, + dependencyConstraints: { + typescript: '4.7', + }, }, // https://github.com/typescript-eslint/typescript-eslint/issues/2331 { @@ -922,7 +930,8 @@ export declare namespace Foo { } } `, - noFormat` + { + code: noFormat` class Foo { value: T; } @@ -930,7 +939,11 @@ class Bar { foo = Foo; } new Bar(); - `, + `, + dependencyConstraints: { + typescript: '4.7', + }, + }, { code: ` declare namespace A { @@ -946,21 +959,36 @@ declare function A(A: string): string; filename: 'foo.d.ts', }, // 4.1 template literal types - noFormat` + { + code: noFormat` type Color = 'red' | 'blue'; type Quantity = 'one' | 'two'; export type SeussFish = \`\${Quantity | Color} fish\`; - `, - noFormat` + `, + dependencyConstraints: { + typescript: '4.1', + }, + }, + { + code: noFormat` type VerticalAlignment = "top" | "middle" | "bottom"; type HorizontalAlignment = "left" | "center" | "right"; export declare function setAlignment(value: \`\${VerticalAlignment}-\${HorizontalAlignment}\`): void; - `, - noFormat` + `, + dependencyConstraints: { + typescript: '4.1', + }, + }, + { + code: noFormat` type EnthusiasticGreeting = \`\${Uppercase} - \${Lowercase} - \${Capitalize} - \${Uncapitalize}\`; export type HELLO = EnthusiasticGreeting<"heLLo">; - `, + `, + dependencyConstraints: { + typescript: '4.1', + }, + }, // https://github.com/typescript-eslint/typescript-eslint/issues/2714 { code: ` @@ -1028,7 +1056,8 @@ export class Foo { } } `, - ` + { + code: ` function foo() {} export class Foo { @@ -1038,7 +1067,11 @@ export class Foo { foo(); } } - `, + `, + dependencyConstraints: { + typescript: '4.4', + }, + }, ], invalid: [ 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 4b0750c8c84..6826230b4fd 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,14 +1,11 @@ -import path from 'path'; - import rule from '../../src/rules/non-nullable-type-assertion-style'; -import { RuleTester } from '../RuleTester'; +import { getFixturesRootDir, RuleTester } from '../RuleTester'; -const rootDir = path.resolve(__dirname, '../fixtures/'); const ruleTester = new RuleTester({ parserOptions: { sourceType: 'module', - tsconfigRootDir: rootDir, - project: './tsconfig.noUncheckedIndexedAccess.json', + tsconfigRootDir: getFixturesRootDir(), + project: './tsconfig.json', }, parser: '@typescript-eslint/parser', }); @@ -62,35 +59,6 @@ const x = 1 as 1; declare function foo(): T; const bar = foo() as number; `, - ` -function first(array: ArrayLike): T | null { - return array.length > 0 ? (array[0] as T) : null; -} - `, - ` -function first(array: ArrayLike): T | null { - return array.length > 0 ? (array[0] as T) : null; -} - `, - ` -function first(array: ArrayLike): T | null { - return array.length > 0 ? (array[0] as T) : null; -} - `, - ` -function first( - array: ArrayLike, -): T | null { - return array.length > 0 ? (array[0] as T) : null; -} - `, - ` -type A = 'a' | 'A'; -type B = 'b' | 'B'; -function first(array: ArrayLike): T | null { - return array.length > 0 ? (array[0] as T) : null; -} - `, ], invalid: [ @@ -229,24 +197,76 @@ declare const x: T; const y = x!; `, }, - { - code: ` -function first(array: ArrayLike): T | null { + ], +}); + +const ruleTesterWithNoUncheckedIndexAccess = new RuleTester({ + parserOptions: { + sourceType: 'module', + tsconfigRootDir: getFixturesRootDir(), + project: './tsconfig.noUncheckedIndexedAccess.json', + }, + parser: '@typescript-eslint/parser', + dependencyConstraints: { + typescript: '4.1', + }, +}); + +ruleTesterWithNoUncheckedIndexAccess.run( + 'non-nullable-type-assertion-style - noUncheckedIndexedAccess', + rule, + { + valid: [ + ` +function first(array: ArrayLike): T | null { return array.length > 0 ? (array[0] as T) : null; } `, - errors: [ - { - column: 30, - line: 3, - messageId: 'preferNonNullAssertion', - }, - ], - output: ` + ` +function first(array: ArrayLike): T | null { + return array.length > 0 ? (array[0] as T) : null; +} + `, + ` +function first(array: ArrayLike): T | null { + return array.length > 0 ? (array[0] as T) : null; +} + `, + ` +function first( + array: ArrayLike, +): T | null { + return array.length > 0 ? (array[0] as T) : null; +} + `, + ` +type A = 'a' | 'A'; +type B = 'b' | 'B'; +function first(array: ArrayLike): T | null { + return array.length > 0 ? (array[0] as T) : null; +} + `, + ], + invalid: [ + { + code: ` +function first(array: ArrayLike): T | null { + return array.length > 0 ? (array[0] as T) : null; +} + `, + errors: [ + { + column: 30, + line: 3, + messageId: 'preferNonNullAssertion', + }, + ], + output: ` function first(array: ArrayLike): T | null { return array.length > 0 ? (array[0]!) : null; } - `, - }, - ], -}); + `, + }, + ], + }, +); 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 3824f464a58..49e50e741a8 100644 --- a/packages/eslint-plugin/tests/rules/prefer-nullish-coalescing.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-nullish-coalescing.test.ts @@ -1,4 +1,5 @@ import type { TSESLint } from '@typescript-eslint/utils'; +import * as path from 'path'; import type { MessageIds, @@ -385,6 +386,25 @@ x ?? y; ], })), + // noStrictNullCheck + { + code: ` +declare const x: string[] | null; +if (x) { +} + `, + errors: [ + { + messageId: 'noStrictNullCheck', + line: 0, + column: 1, + }, + ], + parserOptions: { + tsconfigRootDir: path.join(rootPath, 'unstrict'), + }, + }, + // ignoreConditionalTests ...nullishTypeInvalidTest((nullish, type) => ({ code: ` diff --git a/packages/eslint-plugin/tests/rules/prefer-optional-chain.test.ts b/packages/eslint-plugin/tests/rules/prefer-optional-chain.test.ts index 0358c065870..120ad20aaea 100644 --- a/packages/eslint-plugin/tests/rules/prefer-optional-chain.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-optional-chain.test.ts @@ -65,6 +65,16 @@ const baseCases = [ code: 'foo && foo[bar].baz && foo[bar].baz.buzz', output: 'foo?.[bar].baz?.buzz', }, + // case with a property access in computed property + { + code: 'foo && foo[bar.baz] && foo[bar.baz].buzz', + output: 'foo?.[bar.baz]?.buzz', + }, + // case with this keyword + { + code: 'foo[this.bar] && foo[this.bar].baz', + output: 'foo[this.bar]?.baz', + }, // chained calls { code: 'foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz()', @@ -147,6 +157,14 @@ const baseCases = [ ruleTester.run('prefer-optional-chain', rule, { valid: [ + '!a || !b;', + '!a || a.b;', + '!a && a.b;', + '!a && !a.b;', + '!a.b || a.b?.();', + '!a.b || a.b();', + '!foo() || !foo().bar;', + 'foo || {};', 'foo || ({} as any);', '(foo || {})?.bar;', @@ -180,6 +198,25 @@ ruleTester.run('prefer-optional-chain', rule, { 'foo && foo[bar as string] && foo[bar as string].baz;', 'foo && foo[1 + 2] && foo[1 + 2].baz;', 'foo && foo[typeof bar] && foo[typeof bar].baz;', + '!foo[1 + 1] || !foo[1 + 2];', + '!foo[1 + 1] || !foo[1 + 1].foo;', + '!foo || !foo[bar as string] || !foo[bar as string].baz;', + '!foo || !foo[1 + 2] || !foo[1 + 2].baz;', + '!foo || !foo[typeof bar] || !foo[typeof bar].baz;', + // currently do not handle 'this' as the first part of a chain + 'this && this.foo;', + '!this || !this.foo;', + // intentionally do not handle mixed TSNonNullExpression in properties + '!entity.__helper!.__initialized || options.refresh;', + '!foo!.bar || !foo!.bar.baz;', + '!foo!.bar!.baz || !foo!.bar!.baz!.paz;', + '!foo.bar!.baz || !foo.bar!.baz!.paz;', + 'import.meta || true;', + 'import.meta || import.meta.foo;', + '!import.meta && false;', + '!import.meta && !import.meta.foo;', + 'new.target || new.target.length;', + '!new.target || true;', ], invalid: [ ...baseCases, @@ -447,6 +484,22 @@ foo?.bar(/* comment */a, }, ], }, + // case with this keyword at the start of expression + { + code: 'this.bar && this.bar.baz;', + output: null, + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: 'this.bar?.baz;', + }, + ], + }, + ], + }, // other weird cases { code: 'foo && foo?.();', @@ -1144,5 +1197,208 @@ foo?.bar(/* comment */a, }, ], }, + { + code: '(this || {}).foo;', + errors: [ + { + messageId: 'optionalChainSuggest', + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: 'this?.foo;', + }, + ], + }, + ], + }, + ...baseCases.map(c => ({ + ...c, + code: c.code.replace(/foo/g, '!foo').replace(/&&/g, '||'), + errors: [ + { + ...c.errors[0], + suggestions: [ + { + ...c.errors[0].suggestions![0], + output: `!${c.errors[0].suggestions![0].output}`, + }, + ], + }, + ], + })), + // case with this keyword at the start of expression + { + code: '!this.bar || !this.bar.baz;', + output: null, + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '!this.bar?.baz;', + }, + ], + }, + ], + }, + { + code: '!a.b || !a.b();', + output: null, + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '!a.b?.();', + }, + ], + }, + ], + }, + { + code: '!foo.bar || !foo.bar.baz;', + output: null, + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '!foo.bar?.baz;', + }, + ], + }, + ], + }, + { + code: '!foo[bar] || !foo[bar]?.[baz];', + output: null, + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '!foo[bar]?.[baz];', + }, + ], + }, + ], + }, + { + code: '!foo || !foo?.bar.baz;', + output: null, + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '!foo?.bar.baz;', + }, + ], + }, + ], + }, + // two errors + { + code: noFormat`(!foo || !foo.bar || !foo.bar.baz) && (!baz || !baz.bar || !baz.bar.foo);`, + output: null, + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: noFormat`(!foo?.bar?.baz) && (!baz || !baz.bar || !baz.bar.foo);`, + }, + ], + }, + { + messageId: 'preferOptionalChain', + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: noFormat`(!foo || !foo.bar || !foo.bar.baz) && (!baz?.bar?.foo);`, + }, + ], + }, + ], + }, + { + code: ` + class Foo { + constructor() { + new.target && new.target.length; + } + } + `, + output: null, + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: ` + class Foo { + constructor() { + new.target?.length; + } + } + `, + }, + ], + }, + ], + }, + { + code: noFormat`import.meta && import.meta?.baz;`, + output: null, + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: noFormat`import.meta?.baz;`, + }, + ], + }, + ], + }, + { + code: noFormat`!import.meta || !import.meta?.baz;`, + output: null, + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: noFormat`!import.meta?.baz;`, + }, + ], + }, + ], + }, + + { + code: noFormat`import.meta && import.meta?.() && import.meta?.().baz;`, + output: null, + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: noFormat`import.meta?.()?.baz;`, + }, + ], + }, + ], + }, ], }); 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 219b8cbdb08..7cd0527b2cf 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 @@ -5,6 +5,7 @@ import type { InferMessageIdsTypeFromRule, InferOptionsTypeFromRule, } from '../../src/util'; +import { readonlynessOptionsDefaults } from '../../src/util'; import { getFixturesRootDir, noFormat, RuleTester } from '../RuleTester'; type MessageIds = InferMessageIdsTypeFromRule; @@ -362,6 +363,44 @@ ruleTester.run('prefer-readonly-parameter-types', rule, { }, ], }, + { + name: 'circular readonly types (Bug: #4476)', + code: ` + interface Obj { + readonly [K: string]: Obj; + } + + function foo(event: Obj): void {} + `, + options: [ + { + checkParameterProperties: true, + ignoreInferredTypes: false, + ...readonlynessOptionsDefaults, + }, + ], + }, + { + name: 'circular readonly types (Bug: #5875)', + code: ` + interface Obj1 { + readonly [K: string]: Obj2; + } + + interface Obj2 { + readonly [K: string]: Obj1; + } + + function foo(event: Obj1): void {} + `, + options: [ + { + checkParameterProperties: true, + ignoreInferredTypes: false, + ...readonlynessOptionsDefaults, + }, + ], + }, ], invalid: [ // arrays diff --git a/packages/eslint-plugin/tests/rules/prefer-readonly.test.ts b/packages/eslint-plugin/tests/rules/prefer-readonly.test.ts index 333ffc9b5ff..10f2e3d1e07 100644 --- a/packages/eslint-plugin/tests/rules/prefer-readonly.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-readonly.test.ts @@ -339,6 +339,34 @@ class Foo { } `, }, + { + code: ` + class Test { + private testObj = { + prop: '', + }; + + public test(): void { + this.testObj = ''; + } + } + `, + }, + { + code: ` + class TestObject { + public prop: number; + } + + class Test { + private testObj = new TestObject(); + + public test(): void { + this.testObj = new TestObject(); + } + } + `, + }, ], invalid: [ { @@ -742,5 +770,322 @@ function ClassWithName {}>(Base: TBase) { }, ], }, + { + code: ` + class Test { + private testObj = { + prop: '', + }; + + public test(): void { + this.testObj.prop = ''; + } + } + `, + output: ` + class Test { + private readonly testObj = { + prop: '', + }; + + public test(): void { + this.testObj.prop = ''; + } + } + `, + errors: [ + { + data: { + name: 'testObj', + }, + line: 3, + messageId: 'preferReadonly', + }, + ], + }, + { + code: ` + class TestObject { + public prop: number; + } + + class Test { + private testObj = new TestObject(); + + public test(): void { + this.testObj.prop = 10; + } + } + `, + output: ` + class TestObject { + public prop: number; + } + + class Test { + private readonly testObj = new TestObject(); + + public test(): void { + this.testObj.prop = 10; + } + } + `, + errors: [ + { + data: { + name: 'testObj', + }, + line: 7, + messageId: 'preferReadonly', + }, + ], + }, + { + code: ` + class Test { + private testObj = { + prop: '', + }; + public test(): void { + this.testObj.prop; + } + } + `, + output: ` + class Test { + private readonly testObj = { + prop: '', + }; + public test(): void { + this.testObj.prop; + } + } + `, + errors: [ + { + data: { + name: 'testObj', + }, + line: 3, + messageId: 'preferReadonly', + }, + ], + }, + { + code: ` + class Test { + private testObj = {}; + public test(): void { + this.testObj?.prop; + } + } + `, + output: ` + class Test { + private readonly testObj = {}; + public test(): void { + this.testObj?.prop; + } + } + `, + errors: [ + { + data: { + name: 'testObj', + }, + line: 3, + messageId: 'preferReadonly', + }, + ], + }, + { + code: ` + class Test { + private testObj = {}; + public test(): void { + this.testObj!.prop; + } + } + `, + output: ` + class Test { + private readonly testObj = {}; + public test(): void { + this.testObj!.prop; + } + } + `, + errors: [ + { + data: { + name: 'testObj', + }, + line: 3, + messageId: 'preferReadonly', + }, + ], + }, + { + code: ` + class Test { + private testObj = {}; + public test(): void { + this.testObj.prop.prop = ''; + } + } + `, + output: ` + class Test { + private readonly testObj = {}; + public test(): void { + this.testObj.prop.prop = ''; + } + } + `, + errors: [ + { + data: { + name: 'testObj', + }, + line: 3, + messageId: 'preferReadonly', + }, + ], + }, + { + code: ` + class Test { + private testObj = {}; + public test(): void { + this.testObj.prop.doesSomething(); + } + } + `, + output: ` + class Test { + private readonly testObj = {}; + public test(): void { + this.testObj.prop.doesSomething(); + } + } + `, + errors: [ + { + data: { + name: 'testObj', + }, + line: 3, + messageId: 'preferReadonly', + }, + ], + }, + { + code: ` + class Test { + private testObj = {}; + public test(): void { + this.testObj?.prop.prop; + } + } + `, + output: ` + class Test { + private readonly testObj = {}; + public test(): void { + this.testObj?.prop.prop; + } + } + `, + errors: [ + { + data: { + name: 'testObj', + }, + line: 3, + messageId: 'preferReadonly', + }, + ], + }, + { + code: ` + class Test { + private testObj = {}; + public test(): void { + this.testObj?.prop?.prop; + } + } + `, + output: ` + class Test { + private readonly testObj = {}; + public test(): void { + this.testObj?.prop?.prop; + } + } + `, + errors: [ + { + data: { + name: 'testObj', + }, + line: 3, + messageId: 'preferReadonly', + }, + ], + }, + { + code: ` + class Test { + private testObj = {}; + public test(): void { + this.testObj.prop?.prop; + } + } + `, + output: ` + class Test { + private readonly testObj = {}; + public test(): void { + this.testObj.prop?.prop; + } + } + `, + errors: [ + { + data: { + name: 'testObj', + }, + line: 3, + messageId: 'preferReadonly', + }, + ], + }, + { + code: ` + class Test { + private testObj = {}; + public test(): void { + this.testObj!.prop?.prop; + } + } + `, + output: ` + class Test { + private readonly testObj = {}; + public test(): void { + this.testObj!.prop?.prop; + } + } + `, + errors: [ + { + data: { + name: 'testObj', + }, + line: 3, + messageId: 'preferReadonly', + }, + ], + }, ], }); 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 69b604c811c..ccf99b6afcb 100644 --- a/packages/eslint-plugin/tests/rules/promise-function-async.test.ts +++ b/packages/eslint-plugin/tests/rules/promise-function-async.test.ts @@ -102,6 +102,13 @@ const invalidAsyncModifiers = { constructor() {} } `, + ` +class Foo { + async catch(arg: Promise) { + return arg; + } +} + `, { code: ` function returnsAny(): any { @@ -670,5 +677,80 @@ class Test { } `, }, + // https://github.com/typescript-eslint/typescript-eslint/issues/5729 + { + code: ` +class Foo { + catch() { + return Promise.resolve(1); + } + + public default() { + return Promise.resolve(2); + } + + @decorator + private case() { + return Promise.resolve(3); + } +} + `, + output: ` +class Foo { + async catch() { + return Promise.resolve(1); + } + + public async default() { + return Promise.resolve(2); + } + + @decorator + private async case() { + return Promise.resolve(3); + } +} + `, + errors: [ + { + line: 3, + column: 3, + messageId, + }, + { + line: 7, + column: 3, + messageId, + }, + { + line: 12, + column: 3, + messageId, + }, + ], + }, + { + code: ` +const foo = { + catch() { + return Promise.resolve(1); + }, +}; + `, + output: ` +const foo = { + async catch() { + return Promise.resolve(1); + }, +}; + `, + errors: [ + { + line: 3, + column: 3, + messageId, + }, + ], + }, ], }); 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 b0322b290ab..7e80bdbdf5d 100644 --- a/packages/eslint-plugin/tests/rules/restrict-template-expressions.test.ts +++ b/packages/eslint-plugin/tests/rules/restrict-template-expressions.test.ts @@ -358,6 +358,11 @@ ruleTester.run('restrict-template-expressions', rule, { return \`arg = \${arg}\`; } `, + dependencyConstraints: { + // TS 4.5 improved type printing to print the type T as `T` + // before that it was printed as `any` + typescript: '4.5', + }, errors: [ { messageId: 'invalidType', diff --git a/packages/eslint-plugin/tests/rules/sort-type-constituents.test.ts b/packages/eslint-plugin/tests/rules/sort-type-constituents.test.ts new file mode 100644 index 00000000000..1aa6f8a6c9a --- /dev/null +++ b/packages/eslint-plugin/tests/rules/sort-type-constituents.test.ts @@ -0,0 +1,380 @@ +import type { TSESLint } from '@typescript-eslint/utils'; + +import type { + MessageIds, + Options, +} from '../../src/rules/sort-type-constituents'; +import rule from '../../src/rules/sort-type-constituents'; +import { noFormat, RuleTester } from '../RuleTester'; + +const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', +}); + +const valid = (operator: '|' | '&'): TSESLint.ValidTestCase[] => [ + { + code: `type T = A ${operator} B;`, + }, + { + code: `type T = A ${operator} /* comment */ B;`, + }, + { + code: `type T = 'A' ${operator} 'B';`, + }, + { + code: `type T = 1 ${operator} 2;`, + }, + { + code: noFormat`type T = (A) ${operator} (B);`, + }, + { + code: `type T = { a: string } ${operator} { b: string };`, + }, + { + code: `type T = [1, 2, 3] ${operator} [1, 2, 4];`, + }, + { + code: `type T = (() => string) ${operator} (() => void);`, + }, + { + code: `type T = () => string ${operator} void;`, + }, + { + // testing the default ordering + code: noFormat` +type T = + ${operator} A + ${operator} B + ${operator} C.D + ${operator} D.E + ${operator} intrinsic + ${operator} number[] + ${operator} string[] + ${operator} any + ${operator} string + ${operator} symbol + ${operator} this + ${operator} readonly number[] + ${operator} readonly string[] + ${operator} 'a' + ${operator} 'b' + ${operator} "a" + ${operator} "b" + ${operator} (() => string) + ${operator} (() => void) + ${operator} (new () => string) + ${operator} (new () => void) + ${operator} import('bar') + ${operator} import('foo') + ${operator} (number extends string ? unknown : never) + ${operator} (string extends string ? unknown : never) + ${operator} { [a in string]: string } + ${operator} { [a: string]: string } + ${operator} { [b in string]: string } + ${operator} { [b: string]: string } + ${operator} { a: string } + ${operator} { b: string } + ${operator} [1, 2, 3] + ${operator} [1, 2, 4] + ${operator} (A & B) + ${operator} (B & C) + ${operator} (A | B) + ${operator} (B | C) + ${operator} null + ${operator} undefined + `, + }, +]; +const invalid = ( + operator: '|' | '&', +): TSESLint.InvalidTestCase[] => { + const type = operator === '|' ? 'Union' : 'Intersection'; + return [ + { + code: `type T = B ${operator} A;`, + output: `type T = A ${operator} B;`, + errors: [ + { + messageId: 'notSortedNamed', + data: { + type, + name: 'T', + }, + }, + ], + }, + { + code: `type T = 'B' ${operator} 'A';`, + output: `type T = 'A' ${operator} 'B';`, + errors: [ + { + messageId: 'notSortedNamed', + data: { + type, + name: 'T', + }, + }, + ], + }, + { + code: `type T = 2 ${operator} 1;`, + output: `type T = 1 ${operator} 2;`, + errors: [ + { + messageId: 'notSortedNamed', + data: { + type, + name: 'T', + }, + }, + ], + }, + { + code: noFormat`type T = (B) ${operator} (A);`, + output: `type T = A ${operator} B;`, + errors: [ + { + messageId: 'notSortedNamed', + data: { + type, + name: 'T', + }, + }, + ], + }, + { + code: `type T = { b: string } ${operator} { a: string };`, + output: `type T = { a: string } ${operator} { b: string };`, + errors: [ + { + messageId: 'notSortedNamed', + data: { + type, + name: 'T', + }, + }, + ], + }, + { + code: `type T = [1, 2, 4] ${operator} [1, 2, 3];`, + output: `type T = [1, 2, 3] ${operator} [1, 2, 4];`, + errors: [ + { + messageId: 'notSortedNamed', + data: { + type, + name: 'T', + }, + }, + ], + }, + { + code: `type T = (() => void) ${operator} (() => string);`, + output: `type T = (() => string) ${operator} (() => void);`, + errors: [ + { + messageId: 'notSortedNamed', + data: { + type, + name: 'T', + }, + }, + ], + }, + { + code: `type T = () => void ${operator} string;`, + output: `type T = () => string ${operator} void;`, + errors: [ + { + messageId: 'notSorted', + data: { + type, + }, + }, + ], + }, + { + code: `type T = () => undefined ${operator} null;`, + output: `type T = () => null ${operator} undefined;`, + errors: [ + { + messageId: 'notSorted', + data: { + type, + }, + }, + ], + }, + { + code: noFormat` +type T = + ${operator} [1, 2, 4] + ${operator} [1, 2, 3] + ${operator} { b: string } + ${operator} { a: string } + ${operator} (() => void) + ${operator} (() => string) + ${operator} "b" + ${operator} "a" + ${operator} 'b' + ${operator} 'a' + ${operator} readonly string[] + ${operator} readonly number[] + ${operator} string[] + ${operator} number[] + ${operator} D.E + ${operator} C.D + ${operator} B + ${operator} A + ${operator} undefined + ${operator} null + ${operator} string + ${operator} any; + `, + output: ` +type T = + A ${operator} B ${operator} C.D ${operator} D.E ${operator} number[] ${operator} string[] ${operator} any ${operator} string ${operator} readonly number[] ${operator} readonly string[] ${operator} 'a' ${operator} 'b' ${operator} "a" ${operator} "b" ${operator} (() => string) ${operator} (() => void) ${operator} { a: string } ${operator} { b: string } ${operator} [1, 2, 3] ${operator} [1, 2, 4] ${operator} null ${operator} undefined; + `, + errors: [ + { + messageId: 'notSortedNamed', + data: { + type, + name: 'T', + }, + }, + ], + }, + { + code: `type T = B ${operator} /* comment */ A;`, + output: null, + errors: [ + { + messageId: 'notSortedNamed', + data: { + type, + name: 'T', + }, + suggestions: [ + { + messageId: 'suggestFix', + output: `type T = A ${operator} B;`, + }, + ], + }, + ], + }, + { + code: `type T = (() => /* comment */ A) ${operator} B;`, + output: `type T = B ${operator} (() => /* comment */ A);`, + errors: [ + { + messageId: 'notSortedNamed', + data: { + type, + name: 'T', + }, + suggestions: null, + }, + ], + }, + { + code: `type Expected = (new (x: number) => boolean) ${operator} string;`, + output: `type Expected = string ${operator} (new (x: number) => boolean);`, + errors: [ + { + messageId: 'notSortedNamed', + }, + ], + }, + { + code: `type T = (| A) ${operator} B;`, + output: `type T = B ${operator} (| A);`, + errors: [ + { + messageId: 'notSortedNamed', + data: { + type, + name: 'T', + }, + }, + ], + }, + { + code: `type T = (& A) ${operator} B;`, + output: `type T = B ${operator} (& A);`, + errors: [ + { + messageId: 'notSortedNamed', + data: { + type, + name: 'T', + }, + }, + ], + }, + ]; +}; + +ruleTester.run('sort-type-constituents', rule, { + valid: [ + ...valid('|'), + { + code: 'type T = B | A;', + options: [ + { + checkUnions: false, + }, + ], + }, + + ...valid('&'), + { + code: 'type T = B & A;', + options: [ + { + checkIntersections: false, + }, + ], + }, + + { + code: noFormat` +type T = [1] | 'a' | 'b' | "b" | 1 | 2 | {}; + `, + options: [ + { + groupOrder: ['tuple', 'literal', 'object'], + }, + ], + }, + { + // if not specified - groups should be placed last + code: ` +type T = 1 | string | {} | A; + `, + options: [ + { + groupOrder: ['literal', 'keyword'], + }, + ], + }, + ], + invalid: [ + ...invalid('|'), + ...invalid('&'), + { + code: 'type T = (B | C) & A;', + output: `type T = A & (B | C);`, + errors: [ + { + messageId: 'notSortedNamed', + data: { + type: 'Intersection', + name: 'T', + }, + }, + ], + }, + ], +}); diff --git a/packages/eslint-plugin/tests/rules/sort-type-union-intersection-members.test.ts b/packages/eslint-plugin/tests/rules/sort-type-union-intersection-members.test.ts index 38ae67f1804..6242d140634 100644 --- a/packages/eslint-plugin/tests/rules/sort-type-union-intersection-members.test.ts +++ b/packages/eslint-plugin/tests/rules/sort-type-union-intersection-members.test.ts @@ -45,6 +45,8 @@ const valid = (operator: '|' | '&'): TSESLint.ValidTestCase[] => [ type T = ${operator} A ${operator} B + ${operator} C.D + ${operator} D.E ${operator} intrinsic ${operator} number[] ${operator} string[] @@ -220,6 +222,8 @@ type T = ${operator} readonly number[] ${operator} string[] ${operator} number[] + ${operator} D.E + ${operator} C.D ${operator} B ${operator} A ${operator} undefined @@ -229,7 +233,7 @@ type T = `, output: ` type T = - A ${operator} B ${operator} number[] ${operator} string[] ${operator} any ${operator} string ${operator} readonly number[] ${operator} readonly string[] ${operator} 'a' ${operator} 'b' ${operator} "a" ${operator} "b" ${operator} (() => string) ${operator} (() => void) ${operator} { a: string } ${operator} { b: string } ${operator} [1, 2, 3] ${operator} [1, 2, 4] ${operator} null ${operator} undefined; + A ${operator} B ${operator} C.D ${operator} D.E ${operator} number[] ${operator} string[] ${operator} any ${operator} string ${operator} readonly number[] ${operator} readonly string[] ${operator} 'a' ${operator} 'b' ${operator} "a" ${operator} "b" ${operator} (() => string) ${operator} (() => void) ${operator} { a: string } ${operator} { b: string } ${operator} [1, 2, 3] ${operator} [1, 2, 4] ${operator} null ${operator} undefined; `, errors: [ { @@ -283,6 +287,32 @@ type T = }, ], }, + { + code: `type T = (| A) ${operator} B;`, + output: `type T = B ${operator} (| A);`, + errors: [ + { + messageId: 'notSortedNamed', + data: { + type, + name: 'T', + }, + }, + ], + }, + { + code: `type T = (& A) ${operator} B;`, + output: `type T = B ${operator} (& A);`, + errors: [ + { + messageId: 'notSortedNamed', + data: { + type, + name: 'T', + }, + }, + ], + }, ]; }; @@ -330,5 +360,21 @@ type T = 1 | string | {} | A; ], }, ], - invalid: [...invalid('|'), ...invalid('&')], + invalid: [ + ...invalid('|'), + ...invalid('&'), + { + code: 'type T = (B | C) & A;', + output: `type T = A & (B | C);`, + errors: [ + { + messageId: 'notSortedNamed', + data: { + type: 'Intersection', + name: 'T', + }, + }, + ], + }, + ], }); diff --git a/packages/eslint-plugin/tests/util/misc.test.ts b/packages/eslint-plugin/tests/util/misc.test.ts index c4291f00d9f..6eae810eb62 100644 --- a/packages/eslint-plugin/tests/util/misc.test.ts +++ b/packages/eslint-plugin/tests/util/misc.test.ts @@ -23,3 +23,17 @@ describe('formatWordList', () => { ); }); }); + +describe('findLastIndex', () => { + it('returns -1 if there are no elements to iterate over', () => { + expect(misc.findLastIndex([], () => true)).toBe(-1); + }); + + it('returns the index of the last element if predicate just returns true for all values', () => { + expect(misc.findLastIndex([1, 2, 3], () => true)).toBe(2); + }); + + it('returns the index of the last occurance 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.ts b/packages/eslint-plugin/tools/generate-breaking-changes.ts new file mode 100644 index 00000000000..0b7da717287 --- /dev/null +++ b/packages/eslint-plugin/tools/generate-breaking-changes.ts @@ -0,0 +1,156 @@ +// eslint-disable-next-line @typescript-eslint/consistent-type-imports +type RulesFile = typeof import('../src/rules'); + +interface RulesObject { + default: RulesFile; +} + +async function main(): Promise { + const { + default: { default: rules }, + } = + // @ts-expect-error -- We don't support ESM imports of local code yet. + (await import('../dist/rules/index.js')) as RulesObject; + const { markdownTable } = await import('markdown-table'); + const { fetch } = await import('cross-fetch'); + + const newRuleNames = await getNewRulesAsOfMajorVersion('5.0.0'); + + console.log(`## Table Key + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ColumnDescriptionEmojis
StatusBeing added, deprecated, or removed +
    +
  • 🆕 = newly added to typescript-eslint
  • +
  • 🙅 = deprecated in the next major
  • +
  • ➖️ = to be removed from the plugin in the next version
  • +
+
ExtExtension rule? +
    +
  • ☑️ = yes
  • +
+
RRecommended +
    +
  • ➕ = add to recommended this version
  • +
  • ⚠️ = recommended as warning
  • +
  • 🛑 = recommended as an error
  • +
  • ➖️ = remove from recommended this version
  • +
+
RWTRecommended-requiring-type-checking +
    +
  • ➕ = add to recommended-with-typechecking this version
  • +
  • ⚠️ = recommended as warning
  • +
  • 🛑 = recommended as an error
  • +
  • ➖️ = remove from recommended this version
  • +
+
StrictStrict +
    +
  • ➕ = add to strict this version
  • +
  • ⚠️ = recommended as warning
  • +
  • ➖️ = remove from strict this version
  • +
+
+ +## Recommendations Table + +> Hint: search for 🆕 to find newly added rules, and ➕ or ➖ to see config changes. +`); + + console.log( + markdownTable([ + ['Rule', 'Status', 'Ext', 'R', 'RWT', 'Strict', 'Comment'], + ...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 ? '🙅' : '', + extendsBaseRule ? '☑️' : '', + recommended && + ['error', 'warn'].includes(recommended) && + !requiresTypeChecking + ? '🛑' + : '', + recommended && + ['error', 'warn'].includes(recommended) && + requiresTypeChecking + ? '🛑' + : '', + recommended === 'strict' ? '⚠️' : '', + meta.type === 'layout' ? 'layout 💩' : '(todo)', + ]; + }), + ]), + ); + + // Annotate which rules are new since version 5.0.0 + async function getNewRulesAsOfMajorVersion( + oldVersion: string, + ): Promise> { + // 1. Get the current list of rules (already done) + const newRuleNames = Object.keys(rules); + + // 2. Use some CDN thing for the 5.X version of typescript-eslint + const oldUrl = `https://unpkg.com/@typescript-eslint/eslint-plugin@${oldVersion}/dist/configs/all.js`; + const oldFileText = await (await fetch(oldUrl)).text(); + const oldObjectText = oldFileText.substring( + oldFileText.indexOf('{'), + oldFileText.lastIndexOf('}') + 1, + ); + // Normally we wouldn't condone using the 'eval' API... + // But this is an internal-only script and it's the easiest way to convert + // the JS raw text into a runtime object. 🤷 + let oldRulesObject!: { rules: RulesFile }; + eval('oldRulesObject = ' + oldObjectText); + const oldRuleNames = new Set(Object.keys(oldRulesObject.rules)); + + // 3. Get the keys that exist in (1) (new version) and not (2) (old version) + return new Set( + newRuleNames.filter( + newRuleName => !oldRuleNames.has(`@typescript-eslint/${newRuleName}`), + ), + ); + } + + await getNewRulesAsOfMajorVersion('5.0.0'); +} + +main().catch(error => { + console.error(error); +}); diff --git a/packages/eslint-plugin/tools/generate-rules-lists.ts b/packages/eslint-plugin/tools/generate-rules-lists.ts deleted file mode 100644 index ce806cc2e8d..00000000000 --- a/packages/eslint-plugin/tools/generate-rules-lists.ts +++ /dev/null @@ -1,147 +0,0 @@ -#!/usr/bin/env ts-node - -import type { TSESLint } from '@typescript-eslint/utils'; -import fs from 'fs'; -import path from 'path'; -import prettier from 'prettier'; - -import rules from '../src/rules'; - -interface RuleDetails { - name: string; - description: string; - recommended: TSESLint.RuleRecommendation; - fixable: boolean; - requiresTypeChecking: boolean; - extendsBaseRule: boolean; -} - -type RuleColumn = [ - string, - string, - ':lock:' | ':white_check_mark:' | '', - ':wrench:' | '', - ':thought_balloon:' | '', -]; - -const emojiKey = { - recommended: ':white_check_mark:', - strict: ':lock:', - fixable: ':wrench:', - requiresTypeChecking: ':thought_balloon:', -} as const; - -const staticElements = { - rulesListKey: [ - `**Key**: ${emojiKey.recommended} = recommended`, - `${emojiKey.strict} = strict`, - `${emojiKey.fixable} = fixable`, - `${emojiKey.requiresTypeChecking} = requires type information`, - ].join(', '), - listHeaderRow: [ - 'Name', - 'Description', - `${emojiKey.recommended}${emojiKey.strict}`, - emojiKey.fixable, - emojiKey.requiresTypeChecking, - ], - listSpacerRow: Array(5).fill('-'), -}; - -const returnEmojiIfTrue = ( - key: TKey, - obj: { [K in TKey]?: unknown }, -): typeof emojiKey[TKey] | '' => (obj[key] ? emojiKey[key] : ''); - -const createRuleLink = (ruleName: string, basePath: string): string => - `[\`@typescript-eslint/${ruleName}\`](${basePath}${ruleName}.md)`; - -const buildRuleRow = (rule: RuleDetails, basePath: string): RuleColumn => [ - createRuleLink(rule.name, basePath), - rule.description, - rule.recommended === 'strict' - ? emojiKey.strict - : returnEmojiIfTrue('recommended', rule), - returnEmojiIfTrue('fixable', rule), - returnEmojiIfTrue('requiresTypeChecking', rule), -]; - -const buildRulesTable = ( - rules: RuleDetails[], - basePath: string, -): string[][] => [ - staticElements.listHeaderRow, - staticElements.listSpacerRow, - ...rules - .sort(({ name: ruleNameA }, { name: ruleNameB }) => - ruleNameA.localeCompare(ruleNameB), - ) - .map(item => buildRuleRow(item, basePath)), -]; - -const generateRulesListMarkdown = ( - rules: RuleDetails[], - basePath: string, -): string => - [ - '', - staticElements.rulesListKey, - '', - ...buildRulesTable(rules, basePath).map(column => - [...column, ' '].join('|'), - ), - '', - ].join('\n'); - -const updateRulesList = ( - listName: 'base' | 'extension', - rules: RuleDetails[], - markdown: string, - basePath: string, -): string => { - const listBeginMarker = ``; - const listEndMarker = ``; - - const listStartIndex = markdown.indexOf(listBeginMarker); - const listEndIndex = markdown.indexOf(listEndMarker); - - if (listStartIndex === -1 || listEndIndex === -1) { - throw new Error(`cannot find start or end of ${listName} list`); - } - - return [ - markdown.substring(0, listStartIndex - 1), - listBeginMarker, - '', - generateRulesListMarkdown(rules, basePath), // - markdown.substring(listEndIndex), - ].join('\n'); -}; - -const rulesDetails: RuleDetails[] = Object.entries(rules) - .filter(([, rule]) => rule.meta.deprecated !== true) - .map(([name, rule]) => ({ - name, - description: rule.meta.docs?.description ?? '', - recommended: rule.meta.docs?.recommended ?? false, - fixable: !!rule.meta.fixable, - requiresTypeChecking: rule.meta.docs?.requiresTypeChecking ?? false, - extendsBaseRule: !!rule.meta.docs?.extendsBaseRule ?? false, - })); - -const baseRules = rulesDetails.filter(rule => !rule.extendsBaseRule); -const extensionRules = rulesDetails.filter(rule => rule.extendsBaseRule); - -function updateFile(file: string, basePath: string): void { - let readme = fs.readFileSync(file, 'utf8'); - - readme = updateRulesList('base', baseRules, readme, basePath); - readme = updateRulesList('extension', extensionRules, readme, basePath); - - readme = prettier.format(readme, { parser: 'markdown' }); - - fs.writeFileSync(file, readme, 'utf8'); -} - -updateFile(path.resolve(__dirname, '../README.md'), './docs/rules/'); -updateFile(path.resolve(__dirname, '../docs/rules/README.md'), './'); diff --git a/packages/eslint-plugin/tsconfig.json b/packages/eslint-plugin/tsconfig.json index 7801773b539..53deb3aa1bb 100644 --- a/packages/eslint-plugin/tsconfig.json +++ b/packages/eslint-plugin/tsconfig.json @@ -10,5 +10,12 @@ { "path": "../parser/tsconfig.build.json" }, { "path": "../scope-manager/tsconfig.build.json" }, { "path": "../type-utils/tsconfig.build.json" } - ] + ], + "ts-node": { + "compilerOptions": { + "module": "ESNext" + }, + "files": true, + "transpileOnly": true + } } diff --git a/packages/experimental-utils/CHANGELOG.md b/packages/experimental-utils/CHANGELOG.md index d9ab5776de4..d958d143681 100644 --- a/packages/experimental-utils/CHANGELOG.md +++ b/packages/experimental-utils/CHANGELOG.md @@ -3,1218 +3,691 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -# [5.39.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.1...v5.39.0) (2022-10-03) +## [5.46.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.46.0...v5.46.1) (2022-12-12) **Note:** Version bump only for package @typescript-eslint/experimental-utils +# [5.46.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.45.1...v5.46.0) (2022-12-08) +**Note:** Version bump only for package @typescript-eslint/experimental-utils - - -## [5.38.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.0...v5.38.1) (2022-09-26) +## [5.45.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.45.0...v5.45.1) (2022-12-05) **Note:** Version bump only for package @typescript-eslint/experimental-utils +# [5.45.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.44.0...v5.45.0) (2022-11-28) +**Note:** Version bump only for package @typescript-eslint/experimental-utils +# [5.44.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.43.0...v5.44.0) (2022-11-21) +**Note:** Version bump only for package @typescript-eslint/experimental-utils -# [5.38.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.37.0...v5.38.0) (2022-09-19) +# [5.43.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.1...v5.43.0) (2022-11-14) **Note:** Version bump only for package @typescript-eslint/experimental-utils +## [5.42.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.0...v5.42.1) (2022-11-07) +**Note:** Version bump only for package @typescript-eslint/experimental-utils +# [5.42.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.41.0...v5.42.0) (2022-10-31) +**Note:** Version bump only for package @typescript-eslint/experimental-utils -# [5.37.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.2...v5.37.0) (2022-09-12) +# [5.41.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.1...v5.41.0) (2022-10-24) **Note:** Version bump only for package @typescript-eslint/experimental-utils +## [5.40.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.0...v5.40.1) (2022-10-17) +**Note:** Version bump only for package @typescript-eslint/experimental-utils +# [5.40.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.39.0...v5.40.0) (2022-10-10) +**Note:** Version bump only for package @typescript-eslint/experimental-utils -## [5.36.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.1...v5.36.2) (2022-09-05) +# [5.39.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.1...v5.39.0) (2022-10-03) **Note:** Version bump only for package @typescript-eslint/experimental-utils +## [5.38.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.0...v5.38.1) (2022-09-26) +**Note:** Version bump only for package @typescript-eslint/experimental-utils +# [5.38.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.37.0...v5.38.0) (2022-09-19) +**Note:** Version bump only for package @typescript-eslint/experimental-utils -## [5.36.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.0...v5.36.1) (2022-08-30) +# [5.37.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.2...v5.37.0) (2022-09-12) **Note:** Version bump only for package @typescript-eslint/experimental-utils +## [5.36.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.1...v5.36.2) (2022-09-05) +**Note:** Version bump only for package @typescript-eslint/experimental-utils +## [5.36.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.0...v5.36.1) (2022-08-30) +**Note:** Version bump only for package @typescript-eslint/experimental-utils # [5.36.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.1...v5.36.0) (2022-08-30) **Note:** Version bump only for package @typescript-eslint/experimental-utils +## [5.35.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.0...v5.35.1) (2022-08-24) +**Note:** Version bump only for package @typescript-eslint/experimental-utils +# [5.35.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.34.0...v5.35.0) (2022-08-24) +**Note:** Version bump only for package @typescript-eslint/experimental-utils -## [5.35.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.0...v5.35.1) (2022-08-24) +# [5.34.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.1...v5.34.0) (2022-08-22) **Note:** Version bump only for package @typescript-eslint/experimental-utils +## [5.33.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.0...v5.33.1) (2022-08-15) +**Note:** Version bump only for package @typescript-eslint/experimental-utils +# [5.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.32.0...v5.33.0) (2022-08-08) +**Note:** Version bump only for package @typescript-eslint/experimental-utils -# [5.35.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.34.0...v5.35.0) (2022-08-24) +# [5.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.31.0...v5.32.0) (2022-08-01) **Note:** Version bump only for package @typescript-eslint/experimental-utils +# [5.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.7...v5.31.0) (2022-07-25) +**Note:** Version bump only for package @typescript-eslint/experimental-utils +## [5.30.7](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.6...v5.30.7) (2022-07-18) +**Note:** Version bump only for package @typescript-eslint/experimental-utils -# [5.34.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.1...v5.34.0) (2022-08-22) +## [5.30.6](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.5...v5.30.6) (2022-07-11) **Note:** Version bump only for package @typescript-eslint/experimental-utils +## [5.30.5](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.4...v5.30.5) (2022-07-04) +**Note:** Version bump only for package @typescript-eslint/experimental-utils +## [5.30.4](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.3...v5.30.4) (2022-07-03) +**Note:** Version bump only for package @typescript-eslint/experimental-utils -## [5.33.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.0...v5.33.1) (2022-08-15) +## [5.30.3](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.2...v5.30.3) (2022-07-01) **Note:** Version bump only for package @typescript-eslint/experimental-utils +## [5.30.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.1...v5.30.2) (2022-07-01) +**Note:** Version bump only for package @typescript-eslint/experimental-utils +## 5.30.1 (2022-07-01) +**Note:** Version bump only for package @typescript-eslint/experimental-utils -# [5.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.32.0...v5.33.0) (2022-08-08) +# [5.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.29.0...v5.30.0) (2022-06-27) **Note:** Version bump only for package @typescript-eslint/experimental-utils +# [5.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.28.0...v5.29.0) (2022-06-20) +**Note:** Version bump only for package @typescript-eslint/experimental-utils +# [5.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.1...v5.28.0) (2022-06-13) +**Note:** Version bump only for package @typescript-eslint/experimental-utils -# [5.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.31.0...v5.32.0) (2022-08-01) +## [5.27.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.0...v5.27.1) (2022-06-06) **Note:** Version bump only for package @typescript-eslint/experimental-utils +# [5.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.26.0...v5.27.0) (2022-05-30) +### Features +- [4.7] support new extensions ([#5027](https://github.com/typescript-eslint/typescript-eslint/issues/5027)) ([efc147b](https://github.com/typescript-eslint/typescript-eslint/commit/efc147b04dce52ab17415b6a4ae4076b944b9036)) - -# [5.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.7...v5.31.0) (2022-07-25) +# [5.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.25.0...v5.26.0) (2022-05-23) **Note:** Version bump only for package @typescript-eslint/experimental-utils +# [5.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.24.0...v5.25.0) (2022-05-17) +**Note:** Version bump only for package @typescript-eslint/experimental-utils +# [5.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.23.0...v5.24.0) (2022-05-16) +**Note:** Version bump only for package @typescript-eslint/experimental-utils -## [5.30.7](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.6...v5.30.7) (2022-07-18) +# [5.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.22.0...v5.23.0) (2022-05-09) **Note:** Version bump only for package @typescript-eslint/experimental-utils +# [5.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.21.0...v5.22.0) (2022-05-02) +**Note:** Version bump only for package @typescript-eslint/experimental-utils +# [5.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.20.0...v5.21.0) (2022-04-25) +**Note:** Version bump only for package @typescript-eslint/experimental-utils -## [5.30.6](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.5...v5.30.6) (2022-07-11) +# [5.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.19.0...v5.20.0) (2022-04-18) **Note:** Version bump only for package @typescript-eslint/experimental-utils +# [5.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.18.0...v5.19.0) (2022-04-11) +**Note:** Version bump only for package @typescript-eslint/experimental-utils +# [5.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.17.0...v5.18.0) (2022-04-04) +**Note:** Version bump only for package @typescript-eslint/experimental-utils -## [5.30.5](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.4...v5.30.5) (2022-07-04) +# [5.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.16.0...v5.17.0) (2022-03-28) **Note:** Version bump only for package @typescript-eslint/experimental-utils +# [5.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.15.0...v5.16.0) (2022-03-21) +**Note:** Version bump only for package @typescript-eslint/experimental-utils +# [5.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.14.0...v5.15.0) (2022-03-14) +**Note:** Version bump only for package @typescript-eslint/experimental-utils -## [5.30.4](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.3...v5.30.4) (2022-07-03) +# [5.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.13.0...v5.14.0) (2022-03-07) **Note:** Version bump only for package @typescript-eslint/experimental-utils +# [5.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.1...v5.13.0) (2022-02-28) +**Note:** Version bump only for package @typescript-eslint/experimental-utils +## [5.12.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.0...v5.12.1) (2022-02-21) +**Note:** Version bump only for package @typescript-eslint/experimental-utils -## [5.30.3](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.2...v5.30.3) (2022-07-01) +# [5.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.11.0...v5.12.0) (2022-02-14) **Note:** Version bump only for package @typescript-eslint/experimental-utils +# [5.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.2...v5.11.0) (2022-02-07) +**Note:** Version bump only for package @typescript-eslint/experimental-utils +## [5.10.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.1...v5.10.2) (2022-01-31) +**Note:** Version bump only for package @typescript-eslint/experimental-utils -## [5.30.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.1...v5.30.2) (2022-07-01) +## [5.10.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.0...v5.10.1) (2022-01-24) **Note:** Version bump only for package @typescript-eslint/experimental-utils +# [5.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.1...v5.10.0) (2022-01-17) +### Features +- rename `experimental-utils` to `utils` and make `experimental-utils` an alias to the new package ([#4172](https://github.com/typescript-eslint/typescript-eslint/issues/4172)) ([1d55a75](https://github.com/typescript-eslint/typescript-eslint/commit/1d55a7511b38d8e2b2eabe59f639e0a865e6c93f)) - -## 5.30.1 (2022-07-01) +## [5.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.0...v5.9.1) (2022-01-10) **Note:** Version bump only for package @typescript-eslint/experimental-utils +# [5.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.1...v5.9.0) (2022-01-03) +### Features +- **experimental-utils:** move isTypeReadonly from eslint-plugin to experimental-utils ([#3658](https://github.com/typescript-eslint/typescript-eslint/issues/3658)) ([a9eb0b9](https://github.com/typescript-eslint/typescript-eslint/commit/a9eb0b9eb2db291ea36065ec34f84bf5c5504b43)) - -# [5.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.29.0...v5.30.0) (2022-06-27) +## [5.8.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.0...v5.8.1) (2021-12-27) **Note:** Version bump only for package @typescript-eslint/experimental-utils +# [5.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.7.0...v5.8.0) (2021-12-20) +### Bug Fixes +- **experimental-utils:** support immutable members ([#3844](https://github.com/typescript-eslint/typescript-eslint/issues/3844)) ([3d33a77](https://github.com/typescript-eslint/typescript-eslint/commit/3d33a77c57e5b752edf6f35ed152038bdb230b79)) +# [5.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.6.0...v5.7.0) (2021-12-13) -# [5.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.28.0...v5.29.0) (2022-06-20) +**Note:** Version bump only for package @typescript-eslint/experimental-utils + +# [5.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.5.0...v5.6.0) (2021-12-06) **Note:** Version bump only for package @typescript-eslint/experimental-utils +# [5.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.4.0...v5.5.0) (2021-11-29) + +### Bug Fixes + +- **experimental-utils:** export RuleCreator interfaces ([#4199](https://github.com/typescript-eslint/typescript-eslint/issues/4199)) ([7821e4c](https://github.com/typescript-eslint/typescript-eslint/commit/7821e4c515ca2f11a14dcfa94dc77370da0287c5)) +- **experimental-utils:** fix types for eslint-utils ([#4173](https://github.com/typescript-eslint/typescript-eslint/issues/4173)) ([7079de2](https://github.com/typescript-eslint/typescript-eslint/commit/7079de26877a2313a7019845d4c33d0fc4d4b4a9)) +# [5.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.3.1...v5.4.0) (2021-11-15) +### Features +- add RuleCreator.withoutDocs ([#4136](https://github.com/typescript-eslint/typescript-eslint/issues/4136)) ([87cfc6a](https://github.com/typescript-eslint/typescript-eslint/commit/87cfc6ad3e3312d7b6f98a592fb37e69d5d6880a)) +- **experimental-utils:** add default [] for RuleModule TOptions generic ([#4135](https://github.com/typescript-eslint/typescript-eslint/issues/4135)) ([62b8098](https://github.com/typescript-eslint/typescript-eslint/commit/62b8098fa7d361954c170ee6c190e47e95194b13)) -# [5.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.1...v5.28.0) (2022-06-13) +## [5.3.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.3.0...v5.3.1) (2021-11-08) **Note:** Version bump only for package @typescript-eslint/experimental-utils +# [5.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.2.0...v5.3.0) (2021-11-01) + +### Bug Fixes +- **experimental-utils:** add `name` property to test case interface ([#4067](https://github.com/typescript-eslint/typescript-eslint/issues/4067)) ([f3021c9](https://github.com/typescript-eslint/typescript-eslint/commit/f3021c94460e8d06e4169335bcc1a23854531f2a)) +### Features +- **experimental-utils:** extract `isTokenOfTypeWithConditions` out of `ast-utils`' `predicates` ([#3977](https://github.com/typescript-eslint/typescript-eslint/issues/3977)) ([5229597](https://github.com/typescript-eslint/typescript-eslint/commit/5229597d9bfc998852c4b4fb421859e8f3d3d688)) -## [5.27.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.0...v5.27.1) (2022-06-06) +# [5.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.1.0...v5.2.0) (2021-10-25) **Note:** Version bump only for package @typescript-eslint/experimental-utils +# [5.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.0.0...v5.1.0) (2021-10-18) +### Features +- **experimental-utils:** extract `ast-utils`' `predicates`' helpers ([#3976](https://github.com/typescript-eslint/typescript-eslint/issues/3976)) ([154ec9a](https://github.com/typescript-eslint/typescript-eslint/commit/154ec9aea8e81732cafe36af97c4822f1591b077)) +# [5.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.33.0...v5.0.0) (2021-10-11) -# [5.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.26.0...v5.27.0) (2022-05-30) +### Bug Fixes +- **experimental-utils:** fix `isSetter`'s return type ([#3975](https://github.com/typescript-eslint/typescript-eslint/issues/3975)) ([d256856](https://github.com/typescript-eslint/typescript-eslint/commit/d2568561d0417fdfbdfd964ad942f9d00434af73)) ### Features -* [4.7] support new extensions ([#5027](https://github.com/typescript-eslint/typescript-eslint/issues/5027)) ([efc147b](https://github.com/typescript-eslint/typescript-eslint/commit/efc147b04dce52ab17415b6a4ae4076b944b9036)) +- **ast-spec:** bring `Node` objects in line with ESTree ([#3771](https://github.com/typescript-eslint/typescript-eslint/issues/3771)) ([dd14064](https://github.com/typescript-eslint/typescript-eslint/commit/dd140643b457aa515cc21fcda2b3cd4acc2a1c5c)) +- align class property representation with ESTree ([#3806](https://github.com/typescript-eslint/typescript-eslint/issues/3806)) ([22fa5c0](https://github.com/typescript-eslint/typescript-eslint/commit/22fa5c0c4705ed2898f00b7cacc5dd642d859275)), closes [#3430](https://github.com/typescript-eslint/typescript-eslint/issues/3430) [#3077](https://github.com/typescript-eslint/typescript-eslint/issues/3077) +- remove `meta.docs.category` from rules ([#3800](https://github.com/typescript-eslint/typescript-eslint/issues/3800)) ([71c9370](https://github.com/typescript-eslint/typescript-eslint/commit/71c93706e55f5f92a1285102b93c6ab1950c6df4)) +- remove `TSParenthesizedType` ([#3340](https://github.com/typescript-eslint/typescript-eslint/issues/3340)) ([c8ee432](https://github.com/typescript-eslint/typescript-eslint/commit/c8ee43269faea4c04ec02eaa2b81a0aa6eec5d3e)), closes [#3136](https://github.com/typescript-eslint/typescript-eslint/issues/3136) +- support ESLint v8 ([#3737](https://github.com/typescript-eslint/typescript-eslint/issues/3737)) ([4ca62ae](https://github.com/typescript-eslint/typescript-eslint/commit/4ca62aee6681d706e762a8db727541ca204364f2)) +- **experimental-utils:** extract `isNodeOfTypes` out of `ast-utils`' `predicates` ([#3836](https://github.com/typescript-eslint/typescript-eslint/issues/3836)) ([0cc509b](https://github.com/typescript-eslint/typescript-eslint/commit/0cc509b61df248cfb4b42fe64ec800f3cac69c69)) +- **experimental-utils:** remove `getComments` from `ESLint` `SourceCode` types ([#3766](https://github.com/typescript-eslint/typescript-eslint/issues/3766)) ([165a507](https://github.com/typescript-eslint/typescript-eslint/commit/165a507970d8e4a0ed12abdd5f0d892f7de83ffe)) +# [4.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.32.0...v4.33.0) (2021-10-04) +### Bug Fixes +- **experimental-utils:** add `getPhysicalFilename()` to `RuleContext` ([#3934](https://github.com/typescript-eslint/typescript-eslint/issues/3934)) ([ee5dfd4](https://github.com/typescript-eslint/typescript-eslint/commit/ee5dfd4989ab465d65ba3424e36b7f0964558191)) +- **experimental-utils:** require fix in suggestions ([#3949](https://github.com/typescript-eslint/typescript-eslint/issues/3949)) ([f022fb1](https://github.com/typescript-eslint/typescript-eslint/commit/f022fb14c71dad25be2314252eb751964f34fcb8)) +### Features -# [5.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.25.0...v5.26.0) (2022-05-23) +- **experimental-utils:** extract `isNodeOfTypeWithConditions` out of `ast-utils`' `predicates` ([#3837](https://github.com/typescript-eslint/typescript-eslint/issues/3837)) ([214f898](https://github.com/typescript-eslint/typescript-eslint/commit/214f898178ba593146d06a444487d32ec3363854)) -**Note:** Version bump only for package @typescript-eslint/experimental-utils +# [4.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.2...v4.32.0) (2021-09-27) +### Bug Fixes +- **experimental-utils:** add missing signature for `isParenthesized` ([#3887](https://github.com/typescript-eslint/typescript-eslint/issues/3887)) ([806eaac](https://github.com/typescript-eslint/typescript-eslint/commit/806eaac6af5325664634690e9ebd7ffaed276549)) +## [4.31.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.1...v4.31.2) (2021-09-20) +**Note:** Version bump only for package @typescript-eslint/experimental-utils -# [5.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.24.0...v5.25.0) (2022-05-17) +## [4.31.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.0...v4.31.1) (2021-09-13) **Note:** Version bump only for package @typescript-eslint/experimental-utils +# [4.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.30.0...v4.31.0) (2021-09-06) +### Bug Fixes +- **utils:** support immutable arrays in `ReportFixFunction` ([#3830](https://github.com/typescript-eslint/typescript-eslint/issues/3830)) ([8218055](https://github.com/typescript-eslint/typescript-eslint/commit/8218055d6dfd94c9e6c8645848f981d9d51ce08c)) +### Features -# [5.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.23.0...v5.24.0) (2022-05-16) +- **experimental-utils:** extract `isNodeOfType` out of `ast-utils`' `predicates` ([#3677](https://github.com/typescript-eslint/typescript-eslint/issues/3677)) ([4bfa437](https://github.com/typescript-eslint/typescript-eslint/commit/4bfa4375aff8f65057d4aa116e435803cbc6b464)) -**Note:** Version bump only for package @typescript-eslint/experimental-utils +# [4.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.3...v4.30.0) (2021-08-30) +### Features +- **experimental-utils:** add literal types to `global` option ([#3634](https://github.com/typescript-eslint/typescript-eslint/issues/3634)) ([820965c](https://github.com/typescript-eslint/typescript-eslint/commit/820965c41c58be918770ff6bbae313c0cfc75d3c)) +## [4.29.3](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.2...v4.29.3) (2021-08-23) +**Note:** Version bump only for package @typescript-eslint/experimental-utils -# [5.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.22.0...v5.23.0) (2022-05-09) +## [4.29.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.1...v4.29.2) (2021-08-16) **Note:** Version bump only for package @typescript-eslint/experimental-utils +## [4.29.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.0...v4.29.1) (2021-08-09) +**Note:** Version bump only for package @typescript-eslint/experimental-utils +# [4.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.5...v4.29.0) (2021-08-02) +### Bug Fixes -# [5.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.21.0...v5.22.0) (2022-05-02) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils +- **experimental-utils:** simplify `eslint-utils`' `findVariable`'s signature in `ast-utils` ([#3574](https://github.com/typescript-eslint/typescript-eslint/issues/3574)) ([3ef5267](https://github.com/typescript-eslint/typescript-eslint/commit/3ef5267b850e1ffb7115e263e89a98c455fd2532)) +### Features +- **ast-spec:** make `BaseNode` & `BaseToken` more type-safe ([#3560](https://github.com/typescript-eslint/typescript-eslint/issues/3560)) ([a6c5604](https://github.com/typescript-eslint/typescript-eslint/commit/a6c5604b65b6330d047aa016fc46b8a597a6ae58)) +## [4.28.5](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.4...v4.28.5) (2021-07-26) +**Note:** Version bump only for package @typescript-eslint/experimental-utils -# [5.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.20.0...v5.21.0) (2022-04-25) +## [4.28.4](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.3...v4.28.4) (2021-07-19) **Note:** Version bump only for package @typescript-eslint/experimental-utils +## [4.28.3](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.2...v4.28.3) (2021-07-12) +**Note:** Version bump only for package @typescript-eslint/experimental-utils +## [4.28.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.1...v4.28.2) (2021-07-05) +**Note:** Version bump only for package @typescript-eslint/experimental-utils -# [5.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.19.0...v5.20.0) (2022-04-18) +## [4.28.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.0...v4.28.1) (2021-06-28) **Note:** Version bump only for package @typescript-eslint/experimental-utils +# [4.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.27.0...v4.28.0) (2021-06-21) +### Bug Fixes +- **experimental-utils:** expand `RuleTester` config properties ([#3557](https://github.com/typescript-eslint/typescript-eslint/issues/3557)) ([ffbb3cf](https://github.com/typescript-eslint/typescript-eslint/commit/ffbb3cff18bc78467e70e794f9b1f0e79be4aff7)) +- **experimental-utils:** fix `eslint-utils`' negative predicates' return types ([#3462](https://github.com/typescript-eslint/typescript-eslint/issues/3462)) ([1e6016b](https://github.com/typescript-eslint/typescript-eslint/commit/1e6016b356ae40e4636a3cbe41fa02b6a61403ee)) +- **experimental-utils:** fix `eslint-utils`' negative predicates' return types in `ast-utils` ([#3461](https://github.com/typescript-eslint/typescript-eslint/issues/3461)) ([614b0a3](https://github.com/typescript-eslint/typescript-eslint/commit/614b0a38b4163eb4667cce7a415d534222d15dd3)) +- **experimental-utils:** make keys for `ReferenceTracker` options optional ([#3531](https://github.com/typescript-eslint/typescript-eslint/issues/3531)) ([a7fd7bb](https://github.com/typescript-eslint/typescript-eslint/commit/a7fd7bb25584cb3f72f0339025dc76efa6cccceb)) +### Features -# [5.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.18.0...v5.19.0) (2022-04-11) +- **experimental-utils:** add `only` property to `RuleTester` types ([#3555](https://github.com/typescript-eslint/typescript-eslint/issues/3555)) ([2a36e3e](https://github.com/typescript-eslint/typescript-eslint/commit/2a36e3e737f935cc6b967befb022d10a83c8bc9b)) +- **experimental-utils:** expose ReferenceTracker.ESM ([#3532](https://github.com/typescript-eslint/typescript-eslint/issues/3532)) ([4ac67c4](https://github.com/typescript-eslint/typescript-eslint/commit/4ac67c4c9401c5ce0e947a6409efbc11afe1eb3b)) +- **experimental-utils:** use mergable interface for `settings` property ([#3556](https://github.com/typescript-eslint/typescript-eslint/issues/3556)) ([abfc19b](https://github.com/typescript-eslint/typescript-eslint/commit/abfc19bf9364d881bdf594ee166a1deb23240630)) -**Note:** Version bump only for package @typescript-eslint/experimental-utils +# [4.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.1...v4.27.0) (2021-06-14) +### Bug Fixes +- **typescript-estree:** allow providing more one than one existing program in config ([#3508](https://github.com/typescript-eslint/typescript-eslint/issues/3508)) ([4f1806e](https://github.com/typescript-eslint/typescript-eslint/commit/4f1806e548affb7265da360d1fc8d033e25de325)) +## [4.26.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.0...v4.26.1) (2021-06-07) +**Note:** Version bump only for package @typescript-eslint/experimental-utils -# [5.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.17.0...v5.18.0) (2022-04-04) +# [4.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.25.0...v4.26.0) (2021-05-31) **Note:** Version bump only for package @typescript-eslint/experimental-utils +# [4.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.24.0...v4.25.0) (2021-05-24) +### Bug Fixes +- **experimental-utils:** fix `isAwaitKeyword` predicate in ast-utils ([#3290](https://github.com/typescript-eslint/typescript-eslint/issues/3290)) ([c15da67](https://github.com/typescript-eslint/typescript-eslint/commit/c15da67b939b615ed063291cde12c55c0d6d236e)) - -# [5.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.16.0...v5.17.0) (2022-03-28) +# [4.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.23.0...v4.24.0) (2021-05-17) **Note:** Version bump only for package @typescript-eslint/experimental-utils +# [4.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.1...v4.23.0) (2021-05-10) + +### Features +- **experimental-utils:** Include `getCwd()` in `RuleContext` type ([#3308](https://github.com/typescript-eslint/typescript-eslint/issues/3308)) ([2b75c11](https://github.com/typescript-eslint/typescript-eslint/commit/2b75c11d69bee88ca0cb77d7efd32b8d0387e6b3)) +- refactor to split AST specification out as its own module ([#2911](https://github.com/typescript-eslint/typescript-eslint/issues/2911)) ([25ea953](https://github.com/typescript-eslint/typescript-eslint/commit/25ea953cc60b118bd385c71e0a9b61c286c26fcf)) +## [4.22.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.0...v4.22.1) (2021-05-04) +**Note:** Version bump only for package @typescript-eslint/experimental-utils -# [5.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.15.0...v5.16.0) (2022-03-21) +# [4.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.21.0...v4.22.0) (2021-04-12) **Note:** Version bump only for package @typescript-eslint/experimental-utils +# [4.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.20.0...v4.21.0) (2021-04-05) +**Note:** Version bump only for package @typescript-eslint/experimental-utils +# [4.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.19.0...v4.20.0) (2021-03-29) +**Note:** Version bump only for package @typescript-eslint/experimental-utils -# [5.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.14.0...v5.15.0) (2022-03-14) +# [4.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.18.0...v4.19.0) (2021-03-22) **Note:** Version bump only for package @typescript-eslint/experimental-utils +# [4.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.17.0...v4.18.0) (2021-03-15) +**Note:** Version bump only for package @typescript-eslint/experimental-utils +# [4.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.16.1...v4.17.0) (2021-03-08) +**Note:** Version bump only for package @typescript-eslint/experimental-utils -# [5.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.13.0...v5.14.0) (2022-03-07) +## [4.16.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.16.0...v4.16.1) (2021-03-01) **Note:** Version bump only for package @typescript-eslint/experimental-utils +# [4.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.2...v4.16.0) (2021-03-01) +**Note:** Version bump only for package @typescript-eslint/experimental-utils +## [4.15.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.1...v4.15.2) (2021-02-22) +**Note:** Version bump only for package @typescript-eslint/experimental-utils -# [5.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.1...v5.13.0) (2022-02-28) +## [4.15.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.0...v4.15.1) (2021-02-15) **Note:** Version bump only for package @typescript-eslint/experimental-utils +# [4.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.2...v4.15.0) (2021-02-08) +**Note:** Version bump only for package @typescript-eslint/experimental-utils +## [4.14.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.1...v4.14.2) (2021-02-01) +**Note:** Version bump only for package @typescript-eslint/experimental-utils -## [5.12.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.0...v5.12.1) (2022-02-21) +## [4.14.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.0...v4.14.1) (2021-01-25) **Note:** Version bump only for package @typescript-eslint/experimental-utils +# [4.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.13.0...v4.14.0) (2021-01-18) +**Note:** Version bump only for package @typescript-eslint/experimental-utils +# [4.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.12.0...v4.13.0) (2021-01-11) +**Note:** Version bump only for package @typescript-eslint/experimental-utils -# [5.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.11.0...v5.12.0) (2022-02-14) +# [4.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.11.1...v4.12.0) (2021-01-04) **Note:** Version bump only for package @typescript-eslint/experimental-utils +## [4.11.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.11.0...v4.11.1) (2020-12-28) +**Note:** Version bump only for package @typescript-eslint/experimental-utils +# [4.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.10.0...v4.11.0) (2020-12-21) +**Note:** Version bump only for package @typescript-eslint/experimental-utils -# [5.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.2...v5.11.0) (2022-02-07) +# [4.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.9.1...v4.10.0) (2020-12-14) **Note:** Version bump only for package @typescript-eslint/experimental-utils +## [4.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.9.0...v4.9.1) (2020-12-07) + +**Note:** Version bump only for package @typescript-eslint/experimental-utils +# [4.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.2...v4.9.0) (2020-11-30) +### Features +- **eslint-plugin:** [no-unused-vars] fork the base rule ([#2768](https://github.com/typescript-eslint/typescript-eslint/issues/2768)) ([a8227a6](https://github.com/typescript-eslint/typescript-eslint/commit/a8227a6185dd24de4bfc7d766931643871155021)), closes [#2782](https://github.com/typescript-eslint/typescript-eslint/issues/2782) [#2714](https://github.com/typescript-eslint/typescript-eslint/issues/2714) [#2648](https://github.com/typescript-eslint/typescript-eslint/issues/2648) -## [5.10.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.1...v5.10.2) (2022-01-31) +## [4.8.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.1...v4.8.2) (2020-11-23) **Note:** Version bump only for package @typescript-eslint/experimental-utils +## [4.8.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.0...v4.8.1) (2020-11-17) +**Note:** Version bump only for package @typescript-eslint/experimental-utils +# [4.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.7.0...v4.8.0) (2020-11-16) +**Note:** Version bump only for package @typescript-eslint/experimental-utils -## [5.10.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.0...v5.10.1) (2022-01-24) +# [4.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.6.1...v4.7.0) (2020-11-09) **Note:** Version bump only for package @typescript-eslint/experimental-utils +## [4.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.6.0...v4.6.1) (2020-11-02) +**Note:** Version bump only for package @typescript-eslint/experimental-utils +# [4.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.5.0...v4.6.0) (2020-10-26) +**Note:** Version bump only for package @typescript-eslint/experimental-utils -# [5.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.1...v5.10.0) (2022-01-17) - - -### Features - -* rename `experimental-utils` to `utils` and make `experimental-utils` an alias to the new package ([#4172](https://github.com/typescript-eslint/typescript-eslint/issues/4172)) ([1d55a75](https://github.com/typescript-eslint/typescript-eslint/commit/1d55a7511b38d8e2b2eabe59f639e0a865e6c93f)) - - - - - -## [5.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.0...v5.9.1) (2022-01-10) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -# [5.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.1...v5.9.0) (2022-01-03) - - -### Features - -* **experimental-utils:** move isTypeReadonly from eslint-plugin to experimental-utils ([#3658](https://github.com/typescript-eslint/typescript-eslint/issues/3658)) ([a9eb0b9](https://github.com/typescript-eslint/typescript-eslint/commit/a9eb0b9eb2db291ea36065ec34f84bf5c5504b43)) - - - - - -## [5.8.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.0...v5.8.1) (2021-12-27) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -# [5.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.7.0...v5.8.0) (2021-12-20) - - -### Bug Fixes - -* **experimental-utils:** support immutable members ([#3844](https://github.com/typescript-eslint/typescript-eslint/issues/3844)) ([3d33a77](https://github.com/typescript-eslint/typescript-eslint/commit/3d33a77c57e5b752edf6f35ed152038bdb230b79)) - - - - - -# [5.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.6.0...v5.7.0) (2021-12-13) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -# [5.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.5.0...v5.6.0) (2021-12-06) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -# [5.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.4.0...v5.5.0) (2021-11-29) - - -### Bug Fixes - -* **experimental-utils:** export RuleCreator interfaces ([#4199](https://github.com/typescript-eslint/typescript-eslint/issues/4199)) ([7821e4c](https://github.com/typescript-eslint/typescript-eslint/commit/7821e4c515ca2f11a14dcfa94dc77370da0287c5)) -* **experimental-utils:** fix types for eslint-utils ([#4173](https://github.com/typescript-eslint/typescript-eslint/issues/4173)) ([7079de2](https://github.com/typescript-eslint/typescript-eslint/commit/7079de26877a2313a7019845d4c33d0fc4d4b4a9)) - - - - - -# [5.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.3.1...v5.4.0) (2021-11-15) - - -### Features - -* add RuleCreator.withoutDocs ([#4136](https://github.com/typescript-eslint/typescript-eslint/issues/4136)) ([87cfc6a](https://github.com/typescript-eslint/typescript-eslint/commit/87cfc6ad3e3312d7b6f98a592fb37e69d5d6880a)) -* **experimental-utils:** add default [] for RuleModule TOptions generic ([#4135](https://github.com/typescript-eslint/typescript-eslint/issues/4135)) ([62b8098](https://github.com/typescript-eslint/typescript-eslint/commit/62b8098fa7d361954c170ee6c190e47e95194b13)) - - - - - -## [5.3.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.3.0...v5.3.1) (2021-11-08) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -# [5.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.2.0...v5.3.0) (2021-11-01) - - -### Bug Fixes - -* **experimental-utils:** add `name` property to test case interface ([#4067](https://github.com/typescript-eslint/typescript-eslint/issues/4067)) ([f3021c9](https://github.com/typescript-eslint/typescript-eslint/commit/f3021c94460e8d06e4169335bcc1a23854531f2a)) - - -### Features - -* **experimental-utils:** extract `isTokenOfTypeWithConditions` out of `ast-utils`' `predicates` ([#3977](https://github.com/typescript-eslint/typescript-eslint/issues/3977)) ([5229597](https://github.com/typescript-eslint/typescript-eslint/commit/5229597d9bfc998852c4b4fb421859e8f3d3d688)) - - - - - -# [5.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.1.0...v5.2.0) (2021-10-25) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -# [5.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.0.0...v5.1.0) (2021-10-18) - - -### Features - -* **experimental-utils:** extract `ast-utils`' `predicates`' helpers ([#3976](https://github.com/typescript-eslint/typescript-eslint/issues/3976)) ([154ec9a](https://github.com/typescript-eslint/typescript-eslint/commit/154ec9aea8e81732cafe36af97c4822f1591b077)) - - - - - -# [5.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.33.0...v5.0.0) (2021-10-11) - - -### Bug Fixes - -* **experimental-utils:** fix `isSetter`'s return type ([#3975](https://github.com/typescript-eslint/typescript-eslint/issues/3975)) ([d256856](https://github.com/typescript-eslint/typescript-eslint/commit/d2568561d0417fdfbdfd964ad942f9d00434af73)) - - -### Features - -* **ast-spec:** bring `Node` objects in line with ESTree ([#3771](https://github.com/typescript-eslint/typescript-eslint/issues/3771)) ([dd14064](https://github.com/typescript-eslint/typescript-eslint/commit/dd140643b457aa515cc21fcda2b3cd4acc2a1c5c)) -* align class property representation with ESTree ([#3806](https://github.com/typescript-eslint/typescript-eslint/issues/3806)) ([22fa5c0](https://github.com/typescript-eslint/typescript-eslint/commit/22fa5c0c4705ed2898f00b7cacc5dd642d859275)), closes [#3430](https://github.com/typescript-eslint/typescript-eslint/issues/3430) [#3077](https://github.com/typescript-eslint/typescript-eslint/issues/3077) -* remove `meta.docs.category` from rules ([#3800](https://github.com/typescript-eslint/typescript-eslint/issues/3800)) ([71c9370](https://github.com/typescript-eslint/typescript-eslint/commit/71c93706e55f5f92a1285102b93c6ab1950c6df4)) -* remove `TSParenthesizedType` ([#3340](https://github.com/typescript-eslint/typescript-eslint/issues/3340)) ([c8ee432](https://github.com/typescript-eslint/typescript-eslint/commit/c8ee43269faea4c04ec02eaa2b81a0aa6eec5d3e)), closes [#3136](https://github.com/typescript-eslint/typescript-eslint/issues/3136) -* support ESLint v8 ([#3737](https://github.com/typescript-eslint/typescript-eslint/issues/3737)) ([4ca62ae](https://github.com/typescript-eslint/typescript-eslint/commit/4ca62aee6681d706e762a8db727541ca204364f2)) -* **experimental-utils:** extract `isNodeOfTypes` out of `ast-utils`' `predicates` ([#3836](https://github.com/typescript-eslint/typescript-eslint/issues/3836)) ([0cc509b](https://github.com/typescript-eslint/typescript-eslint/commit/0cc509b61df248cfb4b42fe64ec800f3cac69c69)) -* **experimental-utils:** remove `getComments` from `ESLint` `SourceCode` types ([#3766](https://github.com/typescript-eslint/typescript-eslint/issues/3766)) ([165a507](https://github.com/typescript-eslint/typescript-eslint/commit/165a507970d8e4a0ed12abdd5f0d892f7de83ffe)) - - - - - -# [4.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.32.0...v4.33.0) (2021-10-04) - - -### Bug Fixes - -* **experimental-utils:** add `getPhysicalFilename()` to `RuleContext` ([#3934](https://github.com/typescript-eslint/typescript-eslint/issues/3934)) ([ee5dfd4](https://github.com/typescript-eslint/typescript-eslint/commit/ee5dfd4989ab465d65ba3424e36b7f0964558191)) -* **experimental-utils:** require fix in suggestions ([#3949](https://github.com/typescript-eslint/typescript-eslint/issues/3949)) ([f022fb1](https://github.com/typescript-eslint/typescript-eslint/commit/f022fb14c71dad25be2314252eb751964f34fcb8)) - - -### Features - -* **experimental-utils:** extract `isNodeOfTypeWithConditions` out of `ast-utils`' `predicates` ([#3837](https://github.com/typescript-eslint/typescript-eslint/issues/3837)) ([214f898](https://github.com/typescript-eslint/typescript-eslint/commit/214f898178ba593146d06a444487d32ec3363854)) - - - - - -# [4.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.2...v4.32.0) (2021-09-27) - - -### Bug Fixes - -* **experimental-utils:** add missing signature for `isParenthesized` ([#3887](https://github.com/typescript-eslint/typescript-eslint/issues/3887)) ([806eaac](https://github.com/typescript-eslint/typescript-eslint/commit/806eaac6af5325664634690e9ebd7ffaed276549)) - - - - - -## [4.31.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.1...v4.31.2) (2021-09-20) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -## [4.31.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.0...v4.31.1) (2021-09-13) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -# [4.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.30.0...v4.31.0) (2021-09-06) - - -### Bug Fixes - -* **utils:** support immutable arrays in `ReportFixFunction` ([#3830](https://github.com/typescript-eslint/typescript-eslint/issues/3830)) ([8218055](https://github.com/typescript-eslint/typescript-eslint/commit/8218055d6dfd94c9e6c8645848f981d9d51ce08c)) - - -### Features - -* **experimental-utils:** extract `isNodeOfType` out of `ast-utils`' `predicates` ([#3677](https://github.com/typescript-eslint/typescript-eslint/issues/3677)) ([4bfa437](https://github.com/typescript-eslint/typescript-eslint/commit/4bfa4375aff8f65057d4aa116e435803cbc6b464)) - - - - - -# [4.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.3...v4.30.0) (2021-08-30) - - -### Features - -* **experimental-utils:** add literal types to `global` option ([#3634](https://github.com/typescript-eslint/typescript-eslint/issues/3634)) ([820965c](https://github.com/typescript-eslint/typescript-eslint/commit/820965c41c58be918770ff6bbae313c0cfc75d3c)) - - - - - -## [4.29.3](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.2...v4.29.3) (2021-08-23) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -## [4.29.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.1...v4.29.2) (2021-08-16) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -## [4.29.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.0...v4.29.1) (2021-08-09) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -# [4.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.5...v4.29.0) (2021-08-02) - - -### Bug Fixes - -* **experimental-utils:** simplify `eslint-utils`' `findVariable`'s signature in `ast-utils` ([#3574](https://github.com/typescript-eslint/typescript-eslint/issues/3574)) ([3ef5267](https://github.com/typescript-eslint/typescript-eslint/commit/3ef5267b850e1ffb7115e263e89a98c455fd2532)) - - -### Features - -* **ast-spec:** make `BaseNode` & `BaseToken` more type-safe ([#3560](https://github.com/typescript-eslint/typescript-eslint/issues/3560)) ([a6c5604](https://github.com/typescript-eslint/typescript-eslint/commit/a6c5604b65b6330d047aa016fc46b8a597a6ae58)) - - - - - -## [4.28.5](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.4...v4.28.5) (2021-07-26) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -## [4.28.4](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.3...v4.28.4) (2021-07-19) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -## [4.28.3](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.2...v4.28.3) (2021-07-12) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -## [4.28.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.1...v4.28.2) (2021-07-05) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -## [4.28.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.0...v4.28.1) (2021-06-28) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -# [4.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.27.0...v4.28.0) (2021-06-21) - - -### Bug Fixes - -* **experimental-utils:** expand `RuleTester` config properties ([#3557](https://github.com/typescript-eslint/typescript-eslint/issues/3557)) ([ffbb3cf](https://github.com/typescript-eslint/typescript-eslint/commit/ffbb3cff18bc78467e70e794f9b1f0e79be4aff7)) -* **experimental-utils:** fix `eslint-utils`' negative predicates' return types ([#3462](https://github.com/typescript-eslint/typescript-eslint/issues/3462)) ([1e6016b](https://github.com/typescript-eslint/typescript-eslint/commit/1e6016b356ae40e4636a3cbe41fa02b6a61403ee)) -* **experimental-utils:** fix `eslint-utils`' negative predicates' return types in `ast-utils` ([#3461](https://github.com/typescript-eslint/typescript-eslint/issues/3461)) ([614b0a3](https://github.com/typescript-eslint/typescript-eslint/commit/614b0a38b4163eb4667cce7a415d534222d15dd3)) -* **experimental-utils:** make keys for `ReferenceTracker` options optional ([#3531](https://github.com/typescript-eslint/typescript-eslint/issues/3531)) ([a7fd7bb](https://github.com/typescript-eslint/typescript-eslint/commit/a7fd7bb25584cb3f72f0339025dc76efa6cccceb)) - - -### Features - -* **experimental-utils:** add `only` property to `RuleTester` types ([#3555](https://github.com/typescript-eslint/typescript-eslint/issues/3555)) ([2a36e3e](https://github.com/typescript-eslint/typescript-eslint/commit/2a36e3e737f935cc6b967befb022d10a83c8bc9b)) -* **experimental-utils:** expose ReferenceTracker.ESM ([#3532](https://github.com/typescript-eslint/typescript-eslint/issues/3532)) ([4ac67c4](https://github.com/typescript-eslint/typescript-eslint/commit/4ac67c4c9401c5ce0e947a6409efbc11afe1eb3b)) -* **experimental-utils:** use mergable interface for `settings` property ([#3556](https://github.com/typescript-eslint/typescript-eslint/issues/3556)) ([abfc19b](https://github.com/typescript-eslint/typescript-eslint/commit/abfc19bf9364d881bdf594ee166a1deb23240630)) - - - - - -# [4.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.1...v4.27.0) (2021-06-14) - - -### Bug Fixes - -* **typescript-estree:** allow providing more one than one existing program in config ([#3508](https://github.com/typescript-eslint/typescript-eslint/issues/3508)) ([4f1806e](https://github.com/typescript-eslint/typescript-eslint/commit/4f1806e548affb7265da360d1fc8d033e25de325)) - - - - - -## [4.26.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.0...v4.26.1) (2021-06-07) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -# [4.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.25.0...v4.26.0) (2021-05-31) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -# [4.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.24.0...v4.25.0) (2021-05-24) - - -### Bug Fixes - -* **experimental-utils:** fix `isAwaitKeyword` predicate in ast-utils ([#3290](https://github.com/typescript-eslint/typescript-eslint/issues/3290)) ([c15da67](https://github.com/typescript-eslint/typescript-eslint/commit/c15da67b939b615ed063291cde12c55c0d6d236e)) - - - - - -# [4.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.23.0...v4.24.0) (2021-05-17) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -# [4.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.1...v4.23.0) (2021-05-10) - - -### Features - -* **experimental-utils:** Include `getCwd()` in `RuleContext` type ([#3308](https://github.com/typescript-eslint/typescript-eslint/issues/3308)) ([2b75c11](https://github.com/typescript-eslint/typescript-eslint/commit/2b75c11d69bee88ca0cb77d7efd32b8d0387e6b3)) -* refactor to split AST specification out as its own module ([#2911](https://github.com/typescript-eslint/typescript-eslint/issues/2911)) ([25ea953](https://github.com/typescript-eslint/typescript-eslint/commit/25ea953cc60b118bd385c71e0a9b61c286c26fcf)) - - - - - -## [4.22.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.0...v4.22.1) (2021-05-04) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -# [4.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.21.0...v4.22.0) (2021-04-12) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -# [4.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.20.0...v4.21.0) (2021-04-05) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -# [4.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.19.0...v4.20.0) (2021-03-29) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -# [4.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.18.0...v4.19.0) (2021-03-22) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -# [4.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.17.0...v4.18.0) (2021-03-15) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -# [4.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.16.1...v4.17.0) (2021-03-08) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -## [4.16.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.16.0...v4.16.1) (2021-03-01) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -# [4.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.2...v4.16.0) (2021-03-01) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -## [4.15.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.1...v4.15.2) (2021-02-22) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -## [4.15.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.0...v4.15.1) (2021-02-15) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -# [4.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.2...v4.15.0) (2021-02-08) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -## [4.14.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.1...v4.14.2) (2021-02-01) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -## [4.14.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.0...v4.14.1) (2021-01-25) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -# [4.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.13.0...v4.14.0) (2021-01-18) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -# [4.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.12.0...v4.13.0) (2021-01-11) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -# [4.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.11.1...v4.12.0) (2021-01-04) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -## [4.11.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.11.0...v4.11.1) (2020-12-28) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -# [4.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.10.0...v4.11.0) (2020-12-21) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -# [4.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.9.1...v4.10.0) (2020-12-14) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -## [4.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.9.0...v4.9.1) (2020-12-07) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -# [4.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.2...v4.9.0) (2020-11-30) - - -### Features - -* **eslint-plugin:** [no-unused-vars] fork the base rule ([#2768](https://github.com/typescript-eslint/typescript-eslint/issues/2768)) ([a8227a6](https://github.com/typescript-eslint/typescript-eslint/commit/a8227a6185dd24de4bfc7d766931643871155021)), closes [#2782](https://github.com/typescript-eslint/typescript-eslint/issues/2782) [#2714](https://github.com/typescript-eslint/typescript-eslint/issues/2714) [#2648](https://github.com/typescript-eslint/typescript-eslint/issues/2648) - - - - - -## [4.8.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.1...v4.8.2) (2020-11-23) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -## [4.8.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.0...v4.8.1) (2020-11-17) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -# [4.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.7.0...v4.8.0) (2020-11-16) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -# [4.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.6.1...v4.7.0) (2020-11-09) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -## [4.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.6.0...v4.6.1) (2020-11-02) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -# [4.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.5.0...v4.6.0) (2020-10-26) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -# [4.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.4.1...v4.5.0) (2020-10-19) - +# [4.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.4.1...v4.5.0) (2020-10-19) ### Features -* **typescript-estree:** add flag EXPERIMENTAL_useSourceOfProjectReferenceRedirect ([#2669](https://github.com/typescript-eslint/typescript-eslint/issues/2669)) ([90a5878](https://github.com/typescript-eslint/typescript-eslint/commit/90a587845088da1b205e4d7d77dbc3f9447b1c5a)) - - - - +- **typescript-estree:** add flag EXPERIMENTAL_useSourceOfProjectReferenceRedirect ([#2669](https://github.com/typescript-eslint/typescript-eslint/issues/2669)) ([90a5878](https://github.com/typescript-eslint/typescript-eslint/commit/90a587845088da1b205e4d7d77dbc3f9447b1c5a)) ## [4.4.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.4.0...v4.4.1) (2020-10-12) **Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - # [4.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.3.0...v4.4.0) (2020-10-05) **Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - # [4.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.2.0...v4.3.0) (2020-09-28) - ### Bug Fixes -* **experimental-utils:** treat RuleTester arrays as readonly ([#2601](https://github.com/typescript-eslint/typescript-eslint/issues/2601)) ([8025777](https://github.com/typescript-eslint/typescript-eslint/commit/80257776b78bd2b2b4389d6bd530b009a75fb520)) - - - - +- **experimental-utils:** treat RuleTester arrays as readonly ([#2601](https://github.com/typescript-eslint/typescript-eslint/issues/2601)) ([8025777](https://github.com/typescript-eslint/typescript-eslint/commit/80257776b78bd2b2b4389d6bd530b009a75fb520)) # [4.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.1...v4.2.0) (2020-09-21) **Note:** Version bump only for package @typescript-eslint/experimental-utils +## [4.1.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.0...v4.1.1) (2020-09-14) +### Bug Fixes +- **eslint-plugin:** [no-use-before-define] false positive for function type arguments ([#2554](https://github.com/typescript-eslint/typescript-eslint/issues/2554)) ([189162d](https://github.com/typescript-eslint/typescript-eslint/commit/189162d46ecb116c420232937a7f86df913f4e79)), closes [#2527](https://github.com/typescript-eslint/typescript-eslint/issues/2527) +# [4.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.0.1...v4.1.0) (2020-09-07) -## [4.1.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.0...v4.1.1) (2020-09-14) - - -### Bug Fixes - -* **eslint-plugin:** [no-use-before-define] false positive for function type arguments ([#2554](https://github.com/typescript-eslint/typescript-eslint/issues/2554)) ([189162d](https://github.com/typescript-eslint/typescript-eslint/commit/189162d46ecb116c420232937a7f86df913f4e79)), closes [#2527](https://github.com/typescript-eslint/typescript-eslint/issues/2527) - - - - - -# [4.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.0.1...v4.1.0) (2020-09-07) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -## [4.0.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.0.0...v4.0.1) (2020-08-31) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -# [4.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.10.1...v4.0.0) (2020-08-31) - -## [Please see the release notes for v4.0.0](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v4.0.0) - -### Features - -* consume new scope analysis package ([#2039](https://github.com/typescript-eslint/typescript-eslint/issues/2039)) ([3be125d](https://github.com/typescript-eslint/typescript-eslint/commit/3be125d9bdbee1984ac6037874edf619213bd3d0)) -* support ESTree optional chaining representation ([#2308](https://github.com/typescript-eslint/typescript-eslint/issues/2308)) ([e9d2ab6](https://github.com/typescript-eslint/typescript-eslint/commit/e9d2ab638b6767700b52797e74b814ea059beaae)) - - - - - -## [3.10.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.10.0...v3.10.1) (2020-08-25) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -# [3.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.9.1...v3.10.0) (2020-08-24) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -## [3.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.9.0...v3.9.1) (2020-08-17) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -# [3.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.8.0...v3.9.0) (2020-08-10) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -# [3.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.7.1...v3.8.0) (2020-08-03) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -## [3.7.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.7.0...v3.7.1) (2020-07-27) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -# [3.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.6.1...v3.7.0) (2020-07-20) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -## [3.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.6.0...v3.6.1) (2020-07-13) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -# [3.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.5.0...v3.6.0) (2020-07-06) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -# [3.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.4.0...v3.5.0) (2020-06-29) - - -### Features - -* add package scope-manager ([#1939](https://github.com/typescript-eslint/typescript-eslint/issues/1939)) ([682eb7e](https://github.com/typescript-eslint/typescript-eslint/commit/682eb7e009c3f22a542882dfd3602196a60d2a1e)) -* split types into their own package ([#2229](https://github.com/typescript-eslint/typescript-eslint/issues/2229)) ([5f45918](https://github.com/typescript-eslint/typescript-eslint/commit/5f4591886f3438329fbf2229b03ac66174334a24)) - - - - - -# [3.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.3.0...v3.4.0) (2020-06-22) - +**Note:** Version bump only for package @typescript-eslint/experimental-utils -### Bug Fixes +## [4.0.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.0.0...v4.0.1) (2020-08-31) -* **experimental-utils:** correct types for TS versions older than 3.8 ([#2217](https://github.com/typescript-eslint/typescript-eslint/issues/2217)) ([5e4dda2](https://github.com/typescript-eslint/typescript-eslint/commit/5e4dda264a7d6a6a1626848e7599faea1ac34922)) -* **experimental-utils:** getParserServices takes a readonly context ([#2235](https://github.com/typescript-eslint/typescript-eslint/issues/2235)) ([26da8de](https://github.com/typescript-eslint/typescript-eslint/commit/26da8de7fcde9eddec63212d79af781c4bb22991)) +**Note:** Version bump only for package @typescript-eslint/experimental-utils +# [4.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.10.1...v4.0.0) (2020-08-31) +## [Please see the release notes for v4.0.0](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v4.0.0) +### Features +- consume new scope analysis package ([#2039](https://github.com/typescript-eslint/typescript-eslint/issues/2039)) ([3be125d](https://github.com/typescript-eslint/typescript-eslint/commit/3be125d9bdbee1984ac6037874edf619213bd3d0)) +- support ESTree optional chaining representation ([#2308](https://github.com/typescript-eslint/typescript-eslint/issues/2308)) ([e9d2ab6](https://github.com/typescript-eslint/typescript-eslint/commit/e9d2ab638b6767700b52797e74b814ea059beaae)) -# [3.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.2.0...v3.3.0) (2020-06-15) +## [3.10.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.10.0...v3.10.1) (2020-08-25) **Note:** Version bump only for package @typescript-eslint/experimental-utils +# [3.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.9.1...v3.10.0) (2020-08-24) +**Note:** Version bump only for package @typescript-eslint/experimental-utils +## [3.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.9.0...v3.9.1) (2020-08-17) +**Note:** Version bump only for package @typescript-eslint/experimental-utils -# [3.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.1.0...v3.2.0) (2020-06-08) +# [3.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.8.0...v3.9.0) (2020-08-10) +**Note:** Version bump only for package @typescript-eslint/experimental-utils -### Bug Fixes +# [3.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.7.1...v3.8.0) (2020-08-03) -* **eslint-plugin:** [prefer-optional-chain] handling first member expression ([#2156](https://github.com/typescript-eslint/typescript-eslint/issues/2156)) ([de18660](https://github.com/typescript-eslint/typescript-eslint/commit/de18660a8cf8f7033798646d8c5b0938d1accb12)) +**Note:** Version bump only for package @typescript-eslint/experimental-utils +## [3.7.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.7.0...v3.7.1) (2020-07-27) +**Note:** Version bump only for package @typescript-eslint/experimental-utils +# [3.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.6.1...v3.7.0) (2020-07-20) +**Note:** Version bump only for package @typescript-eslint/experimental-utils -# [3.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.0.2...v3.1.0) (2020-06-01) +## [3.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.6.0...v3.6.1) (2020-07-13) +**Note:** Version bump only for package @typescript-eslint/experimental-utils -### Bug Fixes +# [3.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.5.0...v3.6.0) (2020-07-06) -* **experimental-utils:** downlevel type declarations for versions older than 3.8 ([#2133](https://github.com/typescript-eslint/typescript-eslint/issues/2133)) ([7925823](https://github.com/typescript-eslint/typescript-eslint/commit/792582326a8065270b69a0ffcaad5a7b4b103ff3)) +**Note:** Version bump only for package @typescript-eslint/experimental-utils +# [3.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.4.0...v3.5.0) (2020-06-29) ### Features -* **eslint-plugin:** [explicit-module-boundary-types] improve accuracy and coverage ([#2135](https://github.com/typescript-eslint/typescript-eslint/issues/2135)) ([caaa859](https://github.com/typescript-eslint/typescript-eslint/commit/caaa8599284d02ab3341e282cad35a52d0fb86c7)) +- add package scope-manager ([#1939](https://github.com/typescript-eslint/typescript-eslint/issues/1939)) ([682eb7e](https://github.com/typescript-eslint/typescript-eslint/commit/682eb7e009c3f22a542882dfd3602196a60d2a1e)) +- split types into their own package ([#2229](https://github.com/typescript-eslint/typescript-eslint/issues/2229)) ([5f45918](https://github.com/typescript-eslint/typescript-eslint/commit/5f4591886f3438329fbf2229b03ac66174334a24)) +# [3.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.3.0...v3.4.0) (2020-06-22) +### Bug Fixes +- **experimental-utils:** correct types for TS versions older than 3.8 ([#2217](https://github.com/typescript-eslint/typescript-eslint/issues/2217)) ([5e4dda2](https://github.com/typescript-eslint/typescript-eslint/commit/5e4dda264a7d6a6a1626848e7599faea1ac34922)) +- **experimental-utils:** getParserServices takes a readonly context ([#2235](https://github.com/typescript-eslint/typescript-eslint/issues/2235)) ([26da8de](https://github.com/typescript-eslint/typescript-eslint/commit/26da8de7fcde9eddec63212d79af781c4bb22991)) +# [3.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.2.0...v3.3.0) (2020-06-15) -## [3.0.2](https://github.com/typescript-eslint/typescript-eslint/compare/v3.0.1...v3.0.2) (2020-05-27) +**Note:** Version bump only for package @typescript-eslint/experimental-utils +# [3.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.1.0...v3.2.0) (2020-06-08) ### Bug Fixes -* regression for eslint v6 ([#2105](https://github.com/typescript-eslint/typescript-eslint/issues/2105)) ([31fc503](https://github.com/typescript-eslint/typescript-eslint/commit/31fc5039ed919e1515fda673c186d5c83eb5beb3)) +- **eslint-plugin:** [prefer-optional-chain] handling first member expression ([#2156](https://github.com/typescript-eslint/typescript-eslint/issues/2156)) ([de18660](https://github.com/typescript-eslint/typescript-eslint/commit/de18660a8cf8f7033798646d8c5b0938d1accb12)) +# [3.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.0.2...v3.1.0) (2020-06-01) +### Bug Fixes +- **experimental-utils:** downlevel type declarations for versions older than 3.8 ([#2133](https://github.com/typescript-eslint/typescript-eslint/issues/2133)) ([7925823](https://github.com/typescript-eslint/typescript-eslint/commit/792582326a8065270b69a0ffcaad5a7b4b103ff3)) +### Features -## [3.0.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.0.0...v3.0.1) (2020-05-25) +- **eslint-plugin:** [explicit-module-boundary-types] improve accuracy and coverage ([#2135](https://github.com/typescript-eslint/typescript-eslint/issues/2135)) ([caaa859](https://github.com/typescript-eslint/typescript-eslint/commit/caaa8599284d02ab3341e282cad35a52d0fb86c7)) +## [3.0.2](https://github.com/typescript-eslint/typescript-eslint/compare/v3.0.1...v3.0.2) (2020-05-27) ### Bug Fixes -* **experimental-utils:** export `CLIEngine` & `ESLint` ([#2083](https://github.com/typescript-eslint/typescript-eslint/issues/2083)) ([014341b](https://github.com/typescript-eslint/typescript-eslint/commit/014341bb23261f609fc2a6fe7fece191466a084a)) - +- regression for eslint v6 ([#2105](https://github.com/typescript-eslint/typescript-eslint/issues/2105)) ([31fc503](https://github.com/typescript-eslint/typescript-eslint/commit/31fc5039ed919e1515fda673c186d5c83eb5beb3)) +## [3.0.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.0.0...v3.0.1) (2020-05-25) +### Bug Fixes +- **experimental-utils:** export `CLIEngine` & `ESLint` ([#2083](https://github.com/typescript-eslint/typescript-eslint/issues/2083)) ([014341b](https://github.com/typescript-eslint/typescript-eslint/commit/014341bb23261f609fc2a6fe7fece191466a084a)) # [3.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.34.0...v3.0.0) (2020-05-21) @@ -1222,481 +695,273 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline ### Bug Fixes -* **experimental-utils:** add back SourceCode.isSpaceBetweenTokens ([ae82ea4](https://github.com/typescript-eslint/typescript-eslint/commit/ae82ea4a85a4ca332ebe6104e96c59dba30411be)) -* **typescript-estree:** remove now defunct `Import` node type ([f199cbd](https://github.com/typescript-eslint/typescript-eslint/commit/f199cbdbbd892b5ba03bfff66f463f3d9c92ee9b)) - +- **experimental-utils:** add back SourceCode.isSpaceBetweenTokens ([ae82ea4](https://github.com/typescript-eslint/typescript-eslint/commit/ae82ea4a85a4ca332ebe6104e96c59dba30411be)) +- **typescript-estree:** remove now defunct `Import` node type ([f199cbd](https://github.com/typescript-eslint/typescript-eslint/commit/f199cbdbbd892b5ba03bfff66f463f3d9c92ee9b)) ### Features -* **experimental-utils:** upgrade eslint types for v7 ([#2023](https://github.com/typescript-eslint/typescript-eslint/issues/2023)) ([06869c9](https://github.com/typescript-eslint/typescript-eslint/commit/06869c9656fa37936126666845aee40aad546ebd)) -* drop support for node v8 ([#1997](https://github.com/typescript-eslint/typescript-eslint/issues/1997)) ([b6c3b7b](https://github.com/typescript-eslint/typescript-eslint/commit/b6c3b7b84b8d199fa75a46432febd4a364a63217)) -* upgrade to ESLint v7 ([#2022](https://github.com/typescript-eslint/typescript-eslint/issues/2022)) ([208de71](https://github.com/typescript-eslint/typescript-eslint/commit/208de71059746bf38e94bd460346ffb2698a3e12)) -* **eslint-plugin:** [ban-types] rework default options ([#848](https://github.com/typescript-eslint/typescript-eslint/issues/848)) ([8e31d5d](https://github.com/typescript-eslint/typescript-eslint/commit/8e31d5dbe9fe5227fdbefcecfd50ce5dd51360c3)) -* **typescript-estree:** always return parserServices ([#716](https://github.com/typescript-eslint/typescript-eslint/issues/716)) ([5b23443](https://github.com/typescript-eslint/typescript-eslint/commit/5b23443c48f3f62424db3e742243f3568080b946)) - - - - +- **experimental-utils:** upgrade eslint types for v7 ([#2023](https://github.com/typescript-eslint/typescript-eslint/issues/2023)) ([06869c9](https://github.com/typescript-eslint/typescript-eslint/commit/06869c9656fa37936126666845aee40aad546ebd)) +- drop support for node v8 ([#1997](https://github.com/typescript-eslint/typescript-eslint/issues/1997)) ([b6c3b7b](https://github.com/typescript-eslint/typescript-eslint/commit/b6c3b7b84b8d199fa75a46432febd4a364a63217)) +- upgrade to ESLint v7 ([#2022](https://github.com/typescript-eslint/typescript-eslint/issues/2022)) ([208de71](https://github.com/typescript-eslint/typescript-eslint/commit/208de71059746bf38e94bd460346ffb2698a3e12)) +- **eslint-plugin:** [ban-types] rework default options ([#848](https://github.com/typescript-eslint/typescript-eslint/issues/848)) ([8e31d5d](https://github.com/typescript-eslint/typescript-eslint/commit/8e31d5dbe9fe5227fdbefcecfd50ce5dd51360c3)) +- **typescript-estree:** always return parserServices ([#716](https://github.com/typescript-eslint/typescript-eslint/issues/716)) ([5b23443](https://github.com/typescript-eslint/typescript-eslint/commit/5b23443c48f3f62424db3e742243f3568080b946)) # [2.34.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.33.0...v2.34.0) (2020-05-18) - ### Features -* **experimental-utils:** add `suggestion` property for rule modules ([#2033](https://github.com/typescript-eslint/typescript-eslint/issues/2033)) ([f42a5b0](https://github.com/typescript-eslint/typescript-eslint/commit/f42a5b09ebfa173f418a99c552b0cbe221567194)) - - - - +- **experimental-utils:** add `suggestion` property for rule modules ([#2033](https://github.com/typescript-eslint/typescript-eslint/issues/2033)) ([f42a5b0](https://github.com/typescript-eslint/typescript-eslint/commit/f42a5b09ebfa173f418a99c552b0cbe221567194)) # [2.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.32.0...v2.33.0) (2020-05-12) - ### Bug Fixes -* **experimental-utils:** remove accidental dep on json-schema ([#2010](https://github.com/typescript-eslint/typescript-eslint/issues/2010)) ([1875fba](https://github.com/typescript-eslint/typescript-eslint/commit/1875fbad41f2a3dda8f610f5dcd180c6205b73d3)) - - - - +- **experimental-utils:** remove accidental dep on json-schema ([#2010](https://github.com/typescript-eslint/typescript-eslint/issues/2010)) ([1875fba](https://github.com/typescript-eslint/typescript-eslint/commit/1875fbad41f2a3dda8f610f5dcd180c6205b73d3)) # [2.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.31.0...v2.32.0) (2020-05-11) - ### Features -* bump dependencies and align AST ([#2007](https://github.com/typescript-eslint/typescript-eslint/issues/2007)) ([18668b7](https://github.com/typescript-eslint/typescript-eslint/commit/18668b78fd7d1e5281af7fc26c76e0ca53297f69)) - - - - +- bump dependencies and align AST ([#2007](https://github.com/typescript-eslint/typescript-eslint/issues/2007)) ([18668b7](https://github.com/typescript-eslint/typescript-eslint/commit/18668b78fd7d1e5281af7fc26c76e0ca53297f69)) # [2.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.30.0...v2.31.0) (2020-05-04) - ### Features -* **experimental-utils:** expose our RuleTester extension ([#1948](https://github.com/typescript-eslint/typescript-eslint/issues/1948)) ([2dd1638](https://github.com/typescript-eslint/typescript-eslint/commit/2dd1638aaa2658ba99b2341861146b586f489121)) - - - - +- **experimental-utils:** expose our RuleTester extension ([#1948](https://github.com/typescript-eslint/typescript-eslint/issues/1948)) ([2dd1638](https://github.com/typescript-eslint/typescript-eslint/commit/2dd1638aaa2658ba99b2341861146b586f489121)) # [2.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.29.0...v2.30.0) (2020-04-27) - ### Features -* **experimental-utils:** allow rule options to be a readonly tuple ([#1924](https://github.com/typescript-eslint/typescript-eslint/issues/1924)) ([4ef6788](https://github.com/typescript-eslint/typescript-eslint/commit/4ef67884962b6aac61cc895aaa3ba16aa892ecf4)) - - - - +- **experimental-utils:** allow rule options to be a readonly tuple ([#1924](https://github.com/typescript-eslint/typescript-eslint/issues/1924)) ([4ef6788](https://github.com/typescript-eslint/typescript-eslint/commit/4ef67884962b6aac61cc895aaa3ba16aa892ecf4)) # [2.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.28.0...v2.29.0) (2020-04-20) **Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - # [2.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.27.0...v2.28.0) (2020-04-13) - ### Features -* **eslint-plugin:** add rule `prefer-reduce-type-parameter` ([#1707](https://github.com/typescript-eslint/typescript-eslint/issues/1707)) ([c92d240](https://github.com/typescript-eslint/typescript-eslint/commit/c92d240e49113779053eac32038382b282812afc)) - - - - +- **eslint-plugin:** add rule `prefer-reduce-type-parameter` ([#1707](https://github.com/typescript-eslint/typescript-eslint/issues/1707)) ([c92d240](https://github.com/typescript-eslint/typescript-eslint/commit/c92d240e49113779053eac32038382b282812afc)) # [2.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.26.0...v2.27.0) (2020-04-06) - ### Features -* **experimental-utils:** add types for suggestions from CLIEngine ([#1844](https://github.com/typescript-eslint/typescript-eslint/issues/1844)) ([7c11bd6](https://github.com/typescript-eslint/typescript-eslint/commit/7c11bd66f2d0e5ea9d3943e6b8c66e6ddff50862)) -* **experimental-utils:** update eslint types to match v6.8 ([#1846](https://github.com/typescript-eslint/typescript-eslint/issues/1846)) ([16ce74d](https://github.com/typescript-eslint/typescript-eslint/commit/16ce74d247781ac890dc0baa30c384f97e581b6b)) - - - - +- **experimental-utils:** add types for suggestions from CLIEngine ([#1844](https://github.com/typescript-eslint/typescript-eslint/issues/1844)) ([7c11bd6](https://github.com/typescript-eslint/typescript-eslint/commit/7c11bd66f2d0e5ea9d3943e6b8c66e6ddff50862)) +- **experimental-utils:** update eslint types to match v6.8 ([#1846](https://github.com/typescript-eslint/typescript-eslint/issues/1846)) ([16ce74d](https://github.com/typescript-eslint/typescript-eslint/commit/16ce74d247781ac890dc0baa30c384f97e581b6b)) # [2.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.25.0...v2.26.0) (2020-03-30) - ### Features -* **typescript-estree:** add option to ignore certain folders from glob resolution ([#1802](https://github.com/typescript-eslint/typescript-eslint/issues/1802)) ([1e29e69](https://github.com/typescript-eslint/typescript-eslint/commit/1e29e69b289d61107a7de67592beae331ba50222)) - - - - +- **typescript-estree:** add option to ignore certain folders from glob resolution ([#1802](https://github.com/typescript-eslint/typescript-eslint/issues/1802)) ([1e29e69](https://github.com/typescript-eslint/typescript-eslint/commit/1e29e69b289d61107a7de67592beae331ba50222)) # [2.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.24.0...v2.25.0) (2020-03-23) - ### Features -* **experimental-utils:** expose ast utility functions ([#1670](https://github.com/typescript-eslint/typescript-eslint/issues/1670)) ([3eb5d45](https://github.com/typescript-eslint/typescript-eslint/commit/3eb5d4525e95c8ab990f55588b8d830a02ce5a9c)) - - - - +- **experimental-utils:** expose ast utility functions ([#1670](https://github.com/typescript-eslint/typescript-eslint/issues/1670)) ([3eb5d45](https://github.com/typescript-eslint/typescript-eslint/commit/3eb5d4525e95c8ab990f55588b8d830a02ce5a9c)) # [2.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.23.0...v2.24.0) (2020-03-16) **Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - # [2.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.22.0...v2.23.0) (2020-03-09) **Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - # [2.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.21.0...v2.22.0) (2020-03-02) **Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - # [2.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.20.0...v2.21.0) (2020-02-24) **Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - # [2.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.19.2...v2.20.0) (2020-02-17) **Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - ## [2.19.2](https://github.com/typescript-eslint/typescript-eslint/compare/v2.19.1...v2.19.2) (2020-02-10) **Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - ## [2.19.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.19.0...v2.19.1) (2020-02-10) **Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - # [2.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.18.0...v2.19.0) (2020-02-03) **Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - # [2.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.17.0...v2.18.0) (2020-01-27) - ### Bug Fixes -* improve token types and add missing type guards ([#1497](https://github.com/typescript-eslint/typescript-eslint/issues/1497)) ([ce41d7d](https://github.com/typescript-eslint/typescript-eslint/commit/ce41d7de33bcb7ccf96c03ac1438304c5a49ff54)) -* **experimental-utils:** widen type of `settings` property ([#1527](https://github.com/typescript-eslint/typescript-eslint/issues/1527)) ([b515e47](https://github.com/typescript-eslint/typescript-eslint/commit/b515e47af2bc914c7ebcfa4be813409dcd86b1c3)) - +- improve token types and add missing type guards ([#1497](https://github.com/typescript-eslint/typescript-eslint/issues/1497)) ([ce41d7d](https://github.com/typescript-eslint/typescript-eslint/commit/ce41d7de33bcb7ccf96c03ac1438304c5a49ff54)) +- **experimental-utils:** widen type of `settings` property ([#1527](https://github.com/typescript-eslint/typescript-eslint/issues/1527)) ([b515e47](https://github.com/typescript-eslint/typescript-eslint/commit/b515e47af2bc914c7ebcfa4be813409dcd86b1c3)) ### Features -* **experimental-utils:** make RuleMetaData.docs optional ([#1462](https://github.com/typescript-eslint/typescript-eslint/issues/1462)) ([cde97ac](https://github.com/typescript-eslint/typescript-eslint/commit/cde97aca24df5a0f28f37006ed130ebc217fb2ad)) -* **parser:** clean up scope-analysis types ([#1481](https://github.com/typescript-eslint/typescript-eslint/issues/1481)) ([4a727fa](https://github.com/typescript-eslint/typescript-eslint/commit/4a727fa083d749dba9eaf39322856f5f69c28cd8)) - - - - +- **experimental-utils:** make RuleMetaData.docs optional ([#1462](https://github.com/typescript-eslint/typescript-eslint/issues/1462)) ([cde97ac](https://github.com/typescript-eslint/typescript-eslint/commit/cde97aca24df5a0f28f37006ed130ebc217fb2ad)) +- **parser:** clean up scope-analysis types ([#1481](https://github.com/typescript-eslint/typescript-eslint/issues/1481)) ([4a727fa](https://github.com/typescript-eslint/typescript-eslint/commit/4a727fa083d749dba9eaf39322856f5f69c28cd8)) # [2.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.16.0...v2.17.0) (2020-01-20) - ### Features -* **experimental-utils:** expose getParserServices from utils ([#1448](https://github.com/typescript-eslint/typescript-eslint/issues/1448)) ([982c8bc](https://github.com/typescript-eslint/typescript-eslint/commit/982c8bc)) - - - - +- **experimental-utils:** expose getParserServices from utils ([#1448](https://github.com/typescript-eslint/typescript-eslint/issues/1448)) ([982c8bc](https://github.com/typescript-eslint/typescript-eslint/commit/982c8bc)) # [2.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.15.0...v2.16.0) (2020-01-13) - ### Features -* **typescript-estree:** add parserOption to turn on debug logs ([#1413](https://github.com/typescript-eslint/typescript-eslint/issues/1413)) ([25092fd](https://github.com/typescript-eslint/typescript-eslint/commit/25092fd)) -* **typescript-estree:** add strict type mapping to esTreeNodeToTSNodeMap ([#1382](https://github.com/typescript-eslint/typescript-eslint/issues/1382)) ([d3d70a3](https://github.com/typescript-eslint/typescript-eslint/commit/d3d70a3)) - - - - +- **typescript-estree:** add parserOption to turn on debug logs ([#1413](https://github.com/typescript-eslint/typescript-eslint/issues/1413)) ([25092fd](https://github.com/typescript-eslint/typescript-eslint/commit/25092fd)) +- **typescript-estree:** add strict type mapping to esTreeNodeToTSNodeMap ([#1382](https://github.com/typescript-eslint/typescript-eslint/issues/1382)) ([d3d70a3](https://github.com/typescript-eslint/typescript-eslint/commit/d3d70a3)) # [2.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.14.0...v2.15.0) (2020-01-06) **Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - # [2.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.13.0...v2.14.0) (2019-12-30) - ### Features -* add internal eslint plugin for repo-specific lint rules ([#1373](https://github.com/typescript-eslint/typescript-eslint/issues/1373)) ([3a15413](https://github.com/typescript-eslint/typescript-eslint/commit/3a15413)) - - - - +- add internal eslint plugin for repo-specific lint rules ([#1373](https://github.com/typescript-eslint/typescript-eslint/issues/1373)) ([3a15413](https://github.com/typescript-eslint/typescript-eslint/commit/3a15413)) # [2.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.12.0...v2.13.0) (2019-12-23) **Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - # [2.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.11.0...v2.12.0) (2019-12-16) **Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - # [2.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.10.0...v2.11.0) (2019-12-09) **Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - # [2.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.9.0...v2.10.0) (2019-12-02) - ### Features -* **eslint-plugin:** [no-non-null-assert] add suggestion fixer ([#1260](https://github.com/typescript-eslint/typescript-eslint/issues/1260)) ([e350a21](https://github.com/typescript-eslint/typescript-eslint/commit/e350a21)) -* **experimental-utils:** add isSpaceBetween declaration to Sou… ([#1268](https://github.com/typescript-eslint/typescript-eslint/issues/1268)) ([f83f04b](https://github.com/typescript-eslint/typescript-eslint/commit/f83f04b)) - - - - +- **eslint-plugin:** [no-non-null-assert] add suggestion fixer ([#1260](https://github.com/typescript-eslint/typescript-eslint/issues/1260)) ([e350a21](https://github.com/typescript-eslint/typescript-eslint/commit/e350a21)) +- **experimental-utils:** add isSpaceBetween declaration to Sou… ([#1268](https://github.com/typescript-eslint/typescript-eslint/issues/1268)) ([f83f04b](https://github.com/typescript-eslint/typescript-eslint/commit/f83f04b)) # [2.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.8.0...v2.9.0) (2019-11-25) - ### Features -* suggestion types, suggestions for no-explicit-any ([#1250](https://github.com/typescript-eslint/typescript-eslint/issues/1250)) ([b16a4b6](https://github.com/typescript-eslint/typescript-eslint/commit/b16a4b6)) -* **eslint-plugin:** add prefer-nullish-coalescing ([#1069](https://github.com/typescript-eslint/typescript-eslint/issues/1069)) ([a9cd399](https://github.com/typescript-eslint/typescript-eslint/commit/a9cd399)) -* **eslint-plugin:** add rule prefer-optional-chain ([#1213](https://github.com/typescript-eslint/typescript-eslint/issues/1213)) ([ad7e1a7](https://github.com/typescript-eslint/typescript-eslint/commit/ad7e1a7)) - - - - +- suggestion types, suggestions for no-explicit-any ([#1250](https://github.com/typescript-eslint/typescript-eslint/issues/1250)) ([b16a4b6](https://github.com/typescript-eslint/typescript-eslint/commit/b16a4b6)) +- **eslint-plugin:** add prefer-nullish-coalescing ([#1069](https://github.com/typescript-eslint/typescript-eslint/issues/1069)) ([a9cd399](https://github.com/typescript-eslint/typescript-eslint/commit/a9cd399)) +- **eslint-plugin:** add rule prefer-optional-chain ([#1213](https://github.com/typescript-eslint/typescript-eslint/issues/1213)) ([ad7e1a7](https://github.com/typescript-eslint/typescript-eslint/commit/ad7e1a7)) # [2.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.7.0...v2.8.0) (2019-11-18) **Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - # [2.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.6.1...v2.7.0) (2019-11-11) **Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - ## [2.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.6.0...v2.6.1) (2019-11-04) **Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - # [2.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.5.0...v2.6.0) (2019-10-28) **Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - # [2.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.4.0...v2.5.0) (2019-10-21) **Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - # [2.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.3...v2.4.0) (2019-10-14) - ### Bug Fixes -* support long running "watch" lint sessions ([#973](https://github.com/typescript-eslint/typescript-eslint/issues/973)) ([854620e](https://github.com/typescript-eslint/typescript-eslint/commit/854620e)) - +- support long running "watch" lint sessions ([#973](https://github.com/typescript-eslint/typescript-eslint/issues/973)) ([854620e](https://github.com/typescript-eslint/typescript-eslint/commit/854620e)) ### Features -* **typescript-estree:** support for parsing 3.7 features ([#1045](https://github.com/typescript-eslint/typescript-eslint/issues/1045)) ([623febf](https://github.com/typescript-eslint/typescript-eslint/commit/623febf)) - - - - +- **typescript-estree:** support for parsing 3.7 features ([#1045](https://github.com/typescript-eslint/typescript-eslint/issues/1045)) ([623febf](https://github.com/typescript-eslint/typescript-eslint/commit/623febf)) ## [2.3.3](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.2...v2.3.3) (2019-10-07) - ### Bug Fixes -* **experimental-utils:** remove Rule.meta.extraDescription ([#1036](https://github.com/typescript-eslint/typescript-eslint/issues/1036)) ([192e23d](https://github.com/typescript-eslint/typescript-eslint/commit/192e23d)) - - - - +- **experimental-utils:** remove Rule.meta.extraDescription ([#1036](https://github.com/typescript-eslint/typescript-eslint/issues/1036)) ([192e23d](https://github.com/typescript-eslint/typescript-eslint/commit/192e23d)) ## [2.3.2](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.1...v2.3.2) (2019-09-30) **Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - ## [2.3.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.0...v2.3.1) (2019-09-23) **Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - # [2.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.2.0...v2.3.0) (2019-09-16) **Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - # [2.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.1.0...v2.2.0) (2019-09-09) **Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - # [2.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.0.0...v2.1.0) (2019-09-02) **Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - # [2.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.13.0...v2.0.0) (2019-08-13) - ### Bug Fixes -* **eslint-plugin:** add `Literal` to `RuleListener` types ([#824](https://github.com/typescript-eslint/typescript-eslint/issues/824)) ([3c902a1](https://github.com/typescript-eslint/typescript-eslint/commit/3c902a1)) -* **utils:** add ES2019 as valid `ecmaVersion` ([#746](https://github.com/typescript-eslint/typescript-eslint/issues/746)) ([d11fbbe](https://github.com/typescript-eslint/typescript-eslint/commit/d11fbbe)) - +- **eslint-plugin:** add `Literal` to `RuleListener` types ([#824](https://github.com/typescript-eslint/typescript-eslint/issues/824)) ([3c902a1](https://github.com/typescript-eslint/typescript-eslint/commit/3c902a1)) +- **utils:** add ES2019 as valid `ecmaVersion` ([#746](https://github.com/typescript-eslint/typescript-eslint/issues/746)) ([d11fbbe](https://github.com/typescript-eslint/typescript-eslint/commit/d11fbbe)) ### Features -* explicitly support eslint v6 ([#645](https://github.com/typescript-eslint/typescript-eslint/issues/645)) ([34a7cf6](https://github.com/typescript-eslint/typescript-eslint/commit/34a7cf6)) - - -* feat(eslint-plugin)!: recommended-requiring-type-checking config (#846) ([d3470c9](https://github.com/typescript-eslint/typescript-eslint/commit/d3470c9)), closes [#846](https://github.com/typescript-eslint/typescript-eslint/issues/846) -* feat(eslint-plugin)!: change recommended config (#729) ([428567d](https://github.com/typescript-eslint/typescript-eslint/commit/428567d)), closes [#729](https://github.com/typescript-eslint/typescript-eslint/issues/729) -* feat(eslint-plugin)!: add rule `consistent-type-assertions` (#731) ([92e98de](https://github.com/typescript-eslint/typescript-eslint/commit/92e98de)), closes [#731](https://github.com/typescript-eslint/typescript-eslint/issues/731) +- explicitly support eslint v6 ([#645](https://github.com/typescript-eslint/typescript-eslint/issues/645)) ([34a7cf6](https://github.com/typescript-eslint/typescript-eslint/commit/34a7cf6)) +- feat(eslint-plugin)!: recommended-requiring-type-checking config (#846) ([d3470c9](https://github.com/typescript-eslint/typescript-eslint/commit/d3470c9)), closes [#846](https://github.com/typescript-eslint/typescript-eslint/issues/846) +- feat(eslint-plugin)!: change recommended config (#729) ([428567d](https://github.com/typescript-eslint/typescript-eslint/commit/428567d)), closes [#729](https://github.com/typescript-eslint/typescript-eslint/issues/729) +- feat(eslint-plugin)!: add rule `consistent-type-assertions` (#731) ([92e98de](https://github.com/typescript-eslint/typescript-eslint/commit/92e98de)), closes [#731](https://github.com/typescript-eslint/typescript-eslint/issues/731) ### BREAKING CHANGES -* removed some rules from recommended config -* recommended config changes are considered breaking -* Merges both no-angle-bracket-type-assertion and no-object-literal-type-assertion into one rule -* Node 6 is no longer supported - - - - +- removed some rules from recommended config +- recommended config changes are considered breaking +- Merges both no-angle-bracket-type-assertion and no-object-literal-type-assertion into one rule +- Node 6 is no longer supported # [1.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.12.0...v1.13.0) (2019-07-21) - ### Bug Fixes -* Correct `@types/json-schema` dependency ([#675](https://github.com/typescript-eslint/typescript-eslint/issues/675)) ([a5398ce](https://github.com/typescript-eslint/typescript-eslint/commit/a5398ce)) -* **utils:** move `typescript` from peer dep to dev dep ([#712](https://github.com/typescript-eslint/typescript-eslint/issues/712)) ([f949355](https://github.com/typescript-eslint/typescript-eslint/commit/f949355)) -* **utils:** RuleTester should not require a parser ([#713](https://github.com/typescript-eslint/typescript-eslint/issues/713)) ([158a417](https://github.com/typescript-eslint/typescript-eslint/commit/158a417)) - +- Correct `@types/json-schema` dependency ([#675](https://github.com/typescript-eslint/typescript-eslint/issues/675)) ([a5398ce](https://github.com/typescript-eslint/typescript-eslint/commit/a5398ce)) +- **utils:** move `typescript` from peer dep to dev dep ([#712](https://github.com/typescript-eslint/typescript-eslint/issues/712)) ([f949355](https://github.com/typescript-eslint/typescript-eslint/commit/f949355)) +- **utils:** RuleTester should not require a parser ([#713](https://github.com/typescript-eslint/typescript-eslint/issues/713)) ([158a417](https://github.com/typescript-eslint/typescript-eslint/commit/158a417)) ### Features -* **eslint-plugin:** add new rule no-misused-promises ([#612](https://github.com/typescript-eslint/typescript-eslint/issues/612)) ([28a131d](https://github.com/typescript-eslint/typescript-eslint/commit/28a131d)) - - - - +- **eslint-plugin:** add new rule no-misused-promises ([#612](https://github.com/typescript-eslint/typescript-eslint/issues/612)) ([28a131d](https://github.com/typescript-eslint/typescript-eslint/commit/28a131d)) # [1.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.11.0...v1.12.0) (2019-07-12) **Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - # [1.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.10.2...v1.11.0) (2019-06-23) - ### Bug Fixes -* **eslint-plugin:** Remove duplicated code ([#611](https://github.com/typescript-eslint/typescript-eslint/issues/611)) ([c4df4ff](https://github.com/typescript-eslint/typescript-eslint/commit/c4df4ff)) - +- **eslint-plugin:** Remove duplicated code ([#611](https://github.com/typescript-eslint/typescript-eslint/issues/611)) ([c4df4ff](https://github.com/typescript-eslint/typescript-eslint/commit/c4df4ff)) ### Features -* **eslint-plugin:** add `consistent-type-definitions` rule ([#463](https://github.com/typescript-eslint/typescript-eslint/issues/463)) ([ec87d06](https://github.com/typescript-eslint/typescript-eslint/commit/ec87d06)) - - - - +- **eslint-plugin:** add `consistent-type-definitions` rule ([#463](https://github.com/typescript-eslint/typescript-eslint/issues/463)) ([ec87d06](https://github.com/typescript-eslint/typescript-eslint/commit/ec87d06)) ## [1.10.2](https://github.com/typescript-eslint/typescript-eslint/compare/v1.10.1...v1.10.2) (2019-06-10) diff --git a/packages/experimental-utils/LICENSE b/packages/experimental-utils/LICENSE index 7e7370143b2..a1164108d4d 100644 --- a/packages/experimental-utils/LICENSE +++ b/packages/experimental-utils/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2019 TypeScript ESLint and other contributors +Copyright (c) 2019 typescript-eslint and other contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/experimental-utils/README.md b/packages/experimental-utils/README.md index 3073308c16b..d1468f928b1 100644 --- a/packages/experimental-utils/README.md +++ b/packages/experimental-utils/README.md @@ -1,12 +1,9 @@ -

Utils for ESLint Plugins

+# `@typescript-eslint/experimental-utils` -

Utilities for working with TypeScript + ESLint together.

+Utilities for working with TypeScript + ESLint together. -

- CI - NPM Version - NPM Downloads -

+[![NPM Version](https://img.shields.io/npm/v/@typescript-eslint/experimental-utils.svg?style=flat-square)](https://www.npmjs.com/package/@typescript-eslint/experimental-utils) +[![NPM Downloads](https://img.shields.io/npm/dm/@typescript-eslint/experimental-utils.svg?style=flat-square)](https://www.npmjs.com/package/@typescript-eslint/experimental-utils) ## Note diff --git a/packages/experimental-utils/package.json b/packages/experimental-utils/package.json index 20bf9271848..4030b20dcb4 100644 --- a/packages/experimental-utils/package.json +++ b/packages/experimental-utils/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/experimental-utils", - "version": "5.39.0", + "version": "5.46.1", "description": "(Experimental) Utilities for working with TypeScript + ESLint together", "keywords": [ "eslint", @@ -34,11 +34,11 @@ "clean": "tsc -b tsconfig.build.json --clean", "postclean": "rimraf dist && rimraf _ts3.4 && rimraf coverage", "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", - "lint": "eslint . --ignore-path='../../.eslintignore'", + "lint": "nx lint", "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/utils": "5.39.0" + "@typescript-eslint/utils": "5.46.1" }, "peerDependencies": { "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" diff --git a/packages/experimental-utils/project.json b/packages/experimental-utils/project.json index f8bd9117eea..74410fed05a 100644 --- a/packages/experimental-utils/project.json +++ b/packages/experimental-utils/project.json @@ -1,5 +1,15 @@ { - "root": "packages/experimental-utils", + "name": "experimental-utils", + "$schema": "../../node_modules/nx/schemas/project-schema.json", "type": "library", - "implicitDependencies": [] + "implicitDependencies": [], + "targets": { + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["packages/experimental-utils/**/*.ts"] + } + } + } } diff --git a/packages/parser/CHANGELOG.md b/packages/parser/CHANGELOG.md index bf2bbe8aeae..ab637d405ae 100644 --- a/packages/parser/CHANGELOG.md +++ b/packages/parser/CHANGELOG.md @@ -3,1162 +3,655 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -# [5.39.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.1...v5.39.0) (2022-10-03) +## [5.46.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.46.0...v5.46.1) (2022-12-12) **Note:** Version bump only for package @typescript-eslint/parser +# [5.46.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.45.1...v5.46.0) (2022-12-08) +**Note:** Version bump only for package @typescript-eslint/parser +## [5.45.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.45.0...v5.45.1) (2022-12-05) +### Bug Fixes -## [5.38.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.0...v5.38.1) (2022-09-26) +- **parser:** remove the jsx option requirement for automatic jsx pragma resolution ([#6134](https://github.com/typescript-eslint/typescript-eslint/issues/6134)) ([e777f5e](https://github.com/typescript-eslint/typescript-eslint/commit/e777f5e225b9ddfb6bb1eaa74cbc5171a17ac017)) + +# [5.45.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.44.0...v5.45.0) (2022-11-28) **Note:** Version bump only for package @typescript-eslint/parser +# [5.44.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.43.0...v5.44.0) (2022-11-21) +**Note:** Version bump only for package @typescript-eslint/parser +# [5.43.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.1...v5.43.0) (2022-11-14) +**Note:** Version bump only for package @typescript-eslint/parser -# [5.38.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.37.0...v5.38.0) (2022-09-19) +## [5.42.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.0...v5.42.1) (2022-11-07) **Note:** Version bump only for package @typescript-eslint/parser +# [5.42.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.41.0...v5.42.0) (2022-10-31) +### Features +- **scope-manager:** ignore ECMA version ([#5881](https://github.com/typescript-eslint/typescript-eslint/issues/5881)) ([3b8d449](https://github.com/typescript-eslint/typescript-eslint/commit/3b8d449696c319690536a18a48ef32749dc2f559)) +### Reverts -# [5.37.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.2...v5.37.0) (2022-09-12) +- Revert "feat(scope-manager): ignore ECMA version" (#5888) ([2ee81df](https://github.com/typescript-eslint/typescript-eslint/commit/2ee81df5a365d82ef4b3dfc124d4ec39c7bcb725)), closes [#5888](https://github.com/typescript-eslint/typescript-eslint/issues/5888) [#5881](https://github.com/typescript-eslint/typescript-eslint/issues/5881) + +# [5.41.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.1...v5.41.0) (2022-10-24) **Note:** Version bump only for package @typescript-eslint/parser +## [5.40.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.0...v5.40.1) (2022-10-17) +**Note:** Version bump only for package @typescript-eslint/parser +# [5.40.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.39.0...v5.40.0) (2022-10-10) +**Note:** Version bump only for package @typescript-eslint/parser -## [5.36.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.1...v5.36.2) (2022-09-05) +# [5.39.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.1...v5.39.0) (2022-10-03) **Note:** Version bump only for package @typescript-eslint/parser +## [5.38.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.0...v5.38.1) (2022-09-26) +**Note:** Version bump only for package @typescript-eslint/parser +# [5.38.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.37.0...v5.38.0) (2022-09-19) +**Note:** Version bump only for package @typescript-eslint/parser -## [5.36.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.0...v5.36.1) (2022-08-30) +# [5.37.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.2...v5.37.0) (2022-09-12) **Note:** Version bump only for package @typescript-eslint/parser +## [5.36.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.1...v5.36.2) (2022-09-05) +**Note:** Version bump only for package @typescript-eslint/parser +## [5.36.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.0...v5.36.1) (2022-08-30) +**Note:** Version bump only for package @typescript-eslint/parser # [5.36.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.1...v5.36.0) (2022-08-30) **Note:** Version bump only for package @typescript-eslint/parser - - - - ## [5.35.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.0...v5.35.1) (2022-08-24) **Note:** Version bump only for package @typescript-eslint/parser +# [5.35.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.34.0...v5.35.0) (2022-08-24) +**Note:** Version bump only for package @typescript-eslint/parser +# [5.34.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.1...v5.34.0) (2022-08-22) +**Note:** Version bump only for package @typescript-eslint/parser -# [5.35.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.34.0...v5.35.0) (2022-08-24) +## [5.33.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.0...v5.33.1) (2022-08-15) **Note:** Version bump only for package @typescript-eslint/parser +# [5.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.32.0...v5.33.0) (2022-08-08) +**Note:** Version bump only for package @typescript-eslint/parser +# [5.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.31.0...v5.32.0) (2022-08-01) +**Note:** Version bump only for package @typescript-eslint/parser -# [5.34.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.1...v5.34.0) (2022-08-22) +# [5.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.7...v5.31.0) (2022-07-25) **Note:** Version bump only for package @typescript-eslint/parser +## [5.30.7](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.6...v5.30.7) (2022-07-18) +### Bug Fixes +- expose types supporting old versions of typescript ([#5339](https://github.com/typescript-eslint/typescript-eslint/issues/5339)) ([4ba9bdb](https://github.com/typescript-eslint/typescript-eslint/commit/4ba9bdb93f87e6bc370f13aa1de48f435abe3f88)) - -## [5.33.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.0...v5.33.1) (2022-08-15) +## [5.30.6](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.5...v5.30.6) (2022-07-11) **Note:** Version bump only for package @typescript-eslint/parser +## [5.30.5](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.4...v5.30.5) (2022-07-04) +**Note:** Version bump only for package @typescript-eslint/parser +## [5.30.4](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.3...v5.30.4) (2022-07-03) +**Note:** Version bump only for package @typescript-eslint/parser -# [5.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.32.0...v5.33.0) (2022-08-08) +## [5.30.3](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.2...v5.30.3) (2022-07-01) **Note:** Version bump only for package @typescript-eslint/parser +## [5.30.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.1...v5.30.2) (2022-07-01) +**Note:** Version bump only for package @typescript-eslint/parser +## 5.30.1 (2022-07-01) +**Note:** Version bump only for package @typescript-eslint/parser -# [5.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.31.0...v5.32.0) (2022-08-01) +# [5.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.29.0...v5.30.0) (2022-06-27) **Note:** Version bump only for package @typescript-eslint/parser +# [5.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.28.0...v5.29.0) (2022-06-20) +**Note:** Version bump only for package @typescript-eslint/parser +# [5.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.1...v5.28.0) (2022-06-13) +**Note:** Version bump only for package @typescript-eslint/parser -# [5.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.7...v5.31.0) (2022-07-25) +## [5.27.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.0...v5.27.1) (2022-06-06) **Note:** Version bump only for package @typescript-eslint/parser +# [5.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.26.0...v5.27.0) (2022-05-30) +### Bug Fixes +- **types:** remove leftovers from removal of useJSXTextNode ([#5091](https://github.com/typescript-eslint/typescript-eslint/issues/5091)) ([f9c3647](https://github.com/typescript-eslint/typescript-eslint/commit/f9c3647cb637c8d1ee461b471da9d817ccbde77c)) +### Features -## [5.30.7](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.6...v5.30.7) (2022-07-18) - +- [4.7] support new extensions ([#5027](https://github.com/typescript-eslint/typescript-eslint/issues/5027)) ([efc147b](https://github.com/typescript-eslint/typescript-eslint/commit/efc147b04dce52ab17415b6a4ae4076b944b9036)) -### Bug Fixes +# [5.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.25.0...v5.26.0) (2022-05-23) -* expose types supporting old versions of typescript ([#5339](https://github.com/typescript-eslint/typescript-eslint/issues/5339)) ([4ba9bdb](https://github.com/typescript-eslint/typescript-eslint/commit/4ba9bdb93f87e6bc370f13aa1de48f435abe3f88)) +**Note:** Version bump only for package @typescript-eslint/parser +# [5.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.24.0...v5.25.0) (2022-05-17) +**Note:** Version bump only for package @typescript-eslint/parser +# [5.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.23.0...v5.24.0) (2022-05-16) +**Note:** Version bump only for package @typescript-eslint/parser -## [5.30.6](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.5...v5.30.6) (2022-07-11) +# [5.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.22.0...v5.23.0) (2022-05-09) **Note:** Version bump only for package @typescript-eslint/parser +# [5.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.21.0...v5.22.0) (2022-05-02) +**Note:** Version bump only for package @typescript-eslint/parser +# [5.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.20.0...v5.21.0) (2022-04-25) +**Note:** Version bump only for package @typescript-eslint/parser -## [5.30.5](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.4...v5.30.5) (2022-07-04) +# [5.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.19.0...v5.20.0) (2022-04-18) **Note:** Version bump only for package @typescript-eslint/parser +# [5.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.18.0...v5.19.0) (2022-04-11) +**Note:** Version bump only for package @typescript-eslint/parser +# [5.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.17.0...v5.18.0) (2022-04-04) +**Note:** Version bump only for package @typescript-eslint/parser -## [5.30.4](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.3...v5.30.4) (2022-07-03) +# [5.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.16.0...v5.17.0) (2022-03-28) **Note:** Version bump only for package @typescript-eslint/parser +# [5.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.15.0...v5.16.0) (2022-03-21) + +**Note:** Version bump only for package @typescript-eslint/parser +# [5.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.14.0...v5.15.0) (2022-03-14) +### Features +- **parser:** add `parserOptions.emitDecoratorMetadata` ([#4646](https://github.com/typescript-eslint/typescript-eslint/issues/4646)) ([e3dd343](https://github.com/typescript-eslint/typescript-eslint/commit/e3dd343e51e3b7772e825a609735a04c921c1ec5)) -## [5.30.3](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.2...v5.30.3) (2022-07-01) +# [5.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.13.0...v5.14.0) (2022-03-07) **Note:** Version bump only for package @typescript-eslint/parser +# [5.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.1...v5.13.0) (2022-02-28) +**Note:** Version bump only for package @typescript-eslint/parser +## [5.12.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.0...v5.12.1) (2022-02-21) +**Note:** Version bump only for package @typescript-eslint/parser -## [5.30.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.1...v5.30.2) (2022-07-01) +# [5.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.11.0...v5.12.0) (2022-02-14) **Note:** Version bump only for package @typescript-eslint/parser +# [5.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.2...v5.11.0) (2022-02-07) +**Note:** Version bump only for package @typescript-eslint/parser +## [5.10.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.1...v5.10.2) (2022-01-31) +**Note:** Version bump only for package @typescript-eslint/parser -## 5.30.1 (2022-07-01) +## [5.10.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.0...v5.10.1) (2022-01-24) **Note:** Version bump only for package @typescript-eslint/parser +# [5.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.1...v5.10.0) (2022-01-17) +### Features +- rename `experimental-utils` to `utils` and make `experimental-utils` an alias to the new package ([#4172](https://github.com/typescript-eslint/typescript-eslint/issues/4172)) ([1d55a75](https://github.com/typescript-eslint/typescript-eslint/commit/1d55a7511b38d8e2b2eabe59f639e0a865e6c93f)) - -# [5.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.29.0...v5.30.0) (2022-06-27) +## [5.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.0...v5.9.1) (2022-01-10) **Note:** Version bump only for package @typescript-eslint/parser +# [5.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.1...v5.9.0) (2022-01-03) +**Note:** Version bump only for package @typescript-eslint/parser +## [5.8.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.0...v5.8.1) (2021-12-27) +**Note:** Version bump only for package @typescript-eslint/parser -# [5.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.28.0...v5.29.0) (2022-06-20) +# [5.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.7.0...v5.8.0) (2021-12-20) **Note:** Version bump only for package @typescript-eslint/parser +# [5.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.6.0...v5.7.0) (2021-12-13) +**Note:** Version bump only for package @typescript-eslint/parser +# [5.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.5.0...v5.6.0) (2021-12-06) +**Note:** Version bump only for package @typescript-eslint/parser -# [5.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.1...v5.28.0) (2022-06-13) +# [5.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.4.0...v5.5.0) (2021-11-29) **Note:** Version bump only for package @typescript-eslint/parser +# [5.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.3.1...v5.4.0) (2021-11-15) +**Note:** Version bump only for package @typescript-eslint/parser +## [5.3.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.3.0...v5.3.1) (2021-11-08) +**Note:** Version bump only for package @typescript-eslint/parser -## [5.27.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.0...v5.27.1) (2022-06-06) +# [5.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.2.0...v5.3.0) (2021-11-01) **Note:** Version bump only for package @typescript-eslint/parser +# [5.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.1.0...v5.2.0) (2021-10-25) + +**Note:** Version bump only for package @typescript-eslint/parser +# [5.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.0.0...v5.1.0) (2021-10-18) +**Note:** Version bump only for package @typescript-eslint/parser +# [5.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.33.0...v5.0.0) (2021-10-11) -# [5.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.26.0...v5.27.0) (2022-05-30) +### Features +- support ESLint v8 ([#3737](https://github.com/typescript-eslint/typescript-eslint/issues/3737)) ([4ca62ae](https://github.com/typescript-eslint/typescript-eslint/commit/4ca62aee6681d706e762a8db727541ca204364f2)) -### Bug Fixes +# [4.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.32.0...v4.33.0) (2021-10-04) -* **types:** remove leftovers from removal of useJSXTextNode ([#5091](https://github.com/typescript-eslint/typescript-eslint/issues/5091)) ([f9c3647](https://github.com/typescript-eslint/typescript-eslint/commit/f9c3647cb637c8d1ee461b471da9d817ccbde77c)) +**Note:** Version bump only for package @typescript-eslint/parser +# [4.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.2...v4.32.0) (2021-09-27) ### Features -* [4.7] support new extensions ([#5027](https://github.com/typescript-eslint/typescript-eslint/issues/5027)) ([efc147b](https://github.com/typescript-eslint/typescript-eslint/commit/efc147b04dce52ab17415b6a4ae4076b944b9036)) +- Support `'latest'` as `ecmaVersion` ([#3873](https://github.com/typescript-eslint/typescript-eslint/issues/3873)) ([25a42c0](https://github.com/typescript-eslint/typescript-eslint/commit/25a42c0bbe92d1ecbc2e8ff9ef3a3ef413f728b0)) +## [4.31.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.1...v4.31.2) (2021-09-20) +**Note:** Version bump only for package @typescript-eslint/parser +## [4.31.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.0...v4.31.1) (2021-09-13) +**Note:** Version bump only for package @typescript-eslint/parser -# [5.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.25.0...v5.26.0) (2022-05-23) +# [4.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.30.0...v4.31.0) (2021-09-06) **Note:** Version bump only for package @typescript-eslint/parser +# [4.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.3...v4.30.0) (2021-08-30) +### Features +- **typescript-estree:** add support for class static blocks ([#3730](https://github.com/typescript-eslint/typescript-eslint/issues/3730)) ([f81831b](https://github.com/typescript-eslint/typescript-eslint/commit/f81831bd279a32da6dbab0f1c061053ea43965f6)) - -# [5.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.24.0...v5.25.0) (2022-05-17) +## [4.29.3](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.2...v4.29.3) (2021-08-23) **Note:** Version bump only for package @typescript-eslint/parser +## [4.29.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.1...v4.29.2) (2021-08-16) +**Note:** Version bump only for package @typescript-eslint/parser - - -# [5.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.23.0...v5.24.0) (2022-05-16) +## [4.29.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.0...v4.29.1) (2021-08-09) **Note:** Version bump only for package @typescript-eslint/parser +# [4.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.5...v4.29.0) (2021-08-02) +### Features +- **eslint-plugin:** Catch unused React import with new JSX transform ([#3577](https://github.com/typescript-eslint/typescript-eslint/issues/3577)) ([02998ea](https://github.com/typescript-eslint/typescript-eslint/commit/02998eac510665758b9a093d43afc310f3ac980d)) +- **typescript-estree:** add support for custom module resolution ([#3516](https://github.com/typescript-eslint/typescript-eslint/issues/3516)) ([d48429d](https://github.com/typescript-eslint/typescript-eslint/commit/d48429d97326545bb727f88ce9056270b1599a31)) - -# [5.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.22.0...v5.23.0) (2022-05-09) +## [4.28.5](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.4...v4.28.5) (2021-07-26) **Note:** Version bump only for package @typescript-eslint/parser +## [4.28.4](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.3...v4.28.4) (2021-07-19) +**Note:** Version bump only for package @typescript-eslint/parser - - -# [5.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.21.0...v5.22.0) (2022-05-02) +## [4.28.3](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.2...v4.28.3) (2021-07-12) **Note:** Version bump only for package @typescript-eslint/parser +## [4.28.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.1...v4.28.2) (2021-07-05) +**Note:** Version bump only for package @typescript-eslint/parser +## [4.28.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.0...v4.28.1) (2021-06-28) +**Note:** Version bump only for package @typescript-eslint/parser -# [5.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.20.0...v5.21.0) (2022-04-25) +# [4.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.27.0...v4.28.0) (2021-06-21) **Note:** Version bump only for package @typescript-eslint/parser +# [4.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.1...v4.27.0) (2021-06-14) + +### Bug Fixes +- **typescript-estree:** allow providing more one than one existing program in config ([#3508](https://github.com/typescript-eslint/typescript-eslint/issues/3508)) ([4f1806e](https://github.com/typescript-eslint/typescript-eslint/commit/4f1806e548affb7265da360d1fc8d033e25de325)) +### Features +- allow user to provide TS program instance in parser options ([#3484](https://github.com/typescript-eslint/typescript-eslint/issues/3484)) ([e855b18](https://github.com/typescript-eslint/typescript-eslint/commit/e855b18b8feee0edb5c617c11006861426a6f530)) -# [5.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.19.0...v5.20.0) (2022-04-18) +## [4.26.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.0...v4.26.1) (2021-06-07) **Note:** Version bump only for package @typescript-eslint/parser +# [4.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.25.0...v4.26.0) (2021-05-31) +**Note:** Version bump only for package @typescript-eslint/parser +# [4.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.24.0...v4.25.0) (2021-05-24) +**Note:** Version bump only for package @typescript-eslint/parser -# [5.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.18.0...v5.19.0) (2022-04-11) +# [4.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.23.0...v4.24.0) (2021-05-17) **Note:** Version bump only for package @typescript-eslint/parser +# [4.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.1...v4.23.0) (2021-05-10) +### Features +- refactor to split AST specification out as its own module ([#2911](https://github.com/typescript-eslint/typescript-eslint/issues/2911)) ([25ea953](https://github.com/typescript-eslint/typescript-eslint/commit/25ea953cc60b118bd385c71e0a9b61c286c26fcf)) - -# [5.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.17.0...v5.18.0) (2022-04-04) +## [4.22.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.0...v4.22.1) (2021-05-04) **Note:** Version bump only for package @typescript-eslint/parser +# [4.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.21.0...v4.22.0) (2021-04-12) +**Note:** Version bump only for package @typescript-eslint/parser +# [4.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.20.0...v4.21.0) (2021-04-05) +**Note:** Version bump only for package @typescript-eslint/parser -# [5.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.16.0...v5.17.0) (2022-03-28) +# [4.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.19.0...v4.20.0) (2021-03-29) **Note:** Version bump only for package @typescript-eslint/parser +# [4.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.18.0...v4.19.0) (2021-03-22) +**Note:** Version bump only for package @typescript-eslint/parser +# [4.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.17.0...v4.18.0) (2021-03-15) +**Note:** Version bump only for package @typescript-eslint/parser -# [5.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.15.0...v5.16.0) (2022-03-21) +# [4.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.16.1...v4.17.0) (2021-03-08) **Note:** Version bump only for package @typescript-eslint/parser +## [4.16.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.16.0...v4.16.1) (2021-03-01) +**Note:** Version bump only for package @typescript-eslint/parser +# [4.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.2...v4.16.0) (2021-03-01) +**Note:** Version bump only for package @typescript-eslint/parser -# [5.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.14.0...v5.15.0) (2022-03-14) +## [4.15.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.1...v4.15.2) (2021-02-22) +**Note:** Version bump only for package @typescript-eslint/parser -### Features +## [4.15.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.0...v4.15.1) (2021-02-15) -* **parser:** add `parserOptions.emitDecoratorMetadata` ([#4646](https://github.com/typescript-eslint/typescript-eslint/issues/4646)) ([e3dd343](https://github.com/typescript-eslint/typescript-eslint/commit/e3dd343e51e3b7772e825a609735a04c921c1ec5)) +**Note:** Version bump only for package @typescript-eslint/parser +# [4.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.2...v4.15.0) (2021-02-08) +**Note:** Version bump only for package @typescript-eslint/parser +## [4.14.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.1...v4.14.2) (2021-02-01) +**Note:** Version bump only for package @typescript-eslint/parser -# [5.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.13.0...v5.14.0) (2022-03-07) +## [4.14.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.0...v4.14.1) (2021-01-25) **Note:** Version bump only for package @typescript-eslint/parser +# [4.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.13.0...v4.14.0) (2021-01-18) +### Features +- add support for decorator metadata in scope analysis and in consistent-type-imports ([#2751](https://github.com/typescript-eslint/typescript-eslint/issues/2751)) ([445e416](https://github.com/typescript-eslint/typescript-eslint/commit/445e416878b27a54bf07c2d3b84dabd7b06e51bc)), closes [#2559](https://github.com/typescript-eslint/typescript-eslint/issues/2559) - -# [5.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.1...v5.13.0) (2022-02-28) +# [4.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.12.0...v4.13.0) (2021-01-11) **Note:** Version bump only for package @typescript-eslint/parser +# [4.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.11.1...v4.12.0) (2021-01-04) +**Note:** Version bump only for package @typescript-eslint/parser +## [4.11.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.11.0...v4.11.1) (2020-12-28) +**Note:** Version bump only for package @typescript-eslint/parser -## [5.12.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.0...v5.12.1) (2022-02-21) +# [4.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.10.0...v4.11.0) (2020-12-21) **Note:** Version bump only for package @typescript-eslint/parser +# [4.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.9.1...v4.10.0) (2020-12-14) +**Note:** Version bump only for package @typescript-eslint/parser +## [4.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.9.0...v4.9.1) (2020-12-07) +**Note:** Version bump only for package @typescript-eslint/parser -# [5.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.11.0...v5.12.0) (2022-02-14) +# [4.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.2...v4.9.0) (2020-11-30) **Note:** Version bump only for package @typescript-eslint/parser +## [4.8.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.1...v4.8.2) (2020-11-23) +**Note:** Version bump only for package @typescript-eslint/parser +## [4.8.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.0...v4.8.1) (2020-11-17) +**Note:** Version bump only for package @typescript-eslint/parser -# [5.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.2...v5.11.0) (2022-02-07) +# [4.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.7.0...v4.8.0) (2020-11-16) **Note:** Version bump only for package @typescript-eslint/parser +# [4.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.6.1...v4.7.0) (2020-11-09) +**Note:** Version bump only for package @typescript-eslint/parser +## [4.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.6.0...v4.6.1) (2020-11-02) +**Note:** Version bump only for package @typescript-eslint/parser -## [5.10.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.1...v5.10.2) (2022-01-31) +# [4.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.5.0...v4.6.0) (2020-10-26) **Note:** Version bump only for package @typescript-eslint/parser +# [4.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.4.1...v4.5.0) (2020-10-19) +### Bug Fixes +- **parser:** minor fix regexp, map-filter to reduce ([#2684](https://github.com/typescript-eslint/typescript-eslint/issues/2684)) ([f1329f6](https://github.com/typescript-eslint/typescript-eslint/commit/f1329f6c4e3d1de21b1dc59c30ce16503c346eee)) +### Features -## [5.10.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.0...v5.10.1) (2022-01-24) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -# [5.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.1...v5.10.0) (2022-01-17) - - -### Features - -* rename `experimental-utils` to `utils` and make `experimental-utils` an alias to the new package ([#4172](https://github.com/typescript-eslint/typescript-eslint/issues/4172)) ([1d55a75](https://github.com/typescript-eslint/typescript-eslint/commit/1d55a7511b38d8e2b2eabe59f639e0a865e6c93f)) - - - - - -## [5.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.0...v5.9.1) (2022-01-10) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -# [5.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.1...v5.9.0) (2022-01-03) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -## [5.8.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.0...v5.8.1) (2021-12-27) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -# [5.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.7.0...v5.8.0) (2021-12-20) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -# [5.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.6.0...v5.7.0) (2021-12-13) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -# [5.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.5.0...v5.6.0) (2021-12-06) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -# [5.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.4.0...v5.5.0) (2021-11-29) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -# [5.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.3.1...v5.4.0) (2021-11-15) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -## [5.3.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.3.0...v5.3.1) (2021-11-08) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -# [5.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.2.0...v5.3.0) (2021-11-01) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -# [5.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.1.0...v5.2.0) (2021-10-25) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -# [5.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.0.0...v5.1.0) (2021-10-18) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -# [5.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.33.0...v5.0.0) (2021-10-11) - - -### Features - -* support ESLint v8 ([#3737](https://github.com/typescript-eslint/typescript-eslint/issues/3737)) ([4ca62ae](https://github.com/typescript-eslint/typescript-eslint/commit/4ca62aee6681d706e762a8db727541ca204364f2)) - - - - - -# [4.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.32.0...v4.33.0) (2021-10-04) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -# [4.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.2...v4.32.0) (2021-09-27) - - -### Features - -* Support `'latest'` as `ecmaVersion` ([#3873](https://github.com/typescript-eslint/typescript-eslint/issues/3873)) ([25a42c0](https://github.com/typescript-eslint/typescript-eslint/commit/25a42c0bbe92d1ecbc2e8ff9ef3a3ef413f728b0)) - - - - - -## [4.31.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.1...v4.31.2) (2021-09-20) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -## [4.31.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.0...v4.31.1) (2021-09-13) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -# [4.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.30.0...v4.31.0) (2021-09-06) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -# [4.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.3...v4.30.0) (2021-08-30) - - -### Features - -* **typescript-estree:** add support for class static blocks ([#3730](https://github.com/typescript-eslint/typescript-eslint/issues/3730)) ([f81831b](https://github.com/typescript-eslint/typescript-eslint/commit/f81831bd279a32da6dbab0f1c061053ea43965f6)) - - - - - -## [4.29.3](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.2...v4.29.3) (2021-08-23) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -## [4.29.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.1...v4.29.2) (2021-08-16) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -## [4.29.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.0...v4.29.1) (2021-08-09) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -# [4.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.5...v4.29.0) (2021-08-02) - - -### Features - -* **eslint-plugin:** Catch unused React import with new JSX transform ([#3577](https://github.com/typescript-eslint/typescript-eslint/issues/3577)) ([02998ea](https://github.com/typescript-eslint/typescript-eslint/commit/02998eac510665758b9a093d43afc310f3ac980d)) -* **typescript-estree:** add support for custom module resolution ([#3516](https://github.com/typescript-eslint/typescript-eslint/issues/3516)) ([d48429d](https://github.com/typescript-eslint/typescript-eslint/commit/d48429d97326545bb727f88ce9056270b1599a31)) - - - - - -## [4.28.5](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.4...v4.28.5) (2021-07-26) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -## [4.28.4](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.3...v4.28.4) (2021-07-19) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -## [4.28.3](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.2...v4.28.3) (2021-07-12) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -## [4.28.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.1...v4.28.2) (2021-07-05) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -## [4.28.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.0...v4.28.1) (2021-06-28) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -# [4.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.27.0...v4.28.0) (2021-06-21) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -# [4.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.1...v4.27.0) (2021-06-14) - - -### Bug Fixes - -* **typescript-estree:** allow providing more one than one existing program in config ([#3508](https://github.com/typescript-eslint/typescript-eslint/issues/3508)) ([4f1806e](https://github.com/typescript-eslint/typescript-eslint/commit/4f1806e548affb7265da360d1fc8d033e25de325)) - - -### Features - -* allow user to provide TS program instance in parser options ([#3484](https://github.com/typescript-eslint/typescript-eslint/issues/3484)) ([e855b18](https://github.com/typescript-eslint/typescript-eslint/commit/e855b18b8feee0edb5c617c11006861426a6f530)) - - - - - -## [4.26.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.0...v4.26.1) (2021-06-07) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -# [4.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.25.0...v4.26.0) (2021-05-31) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -# [4.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.24.0...v4.25.0) (2021-05-24) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -# [4.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.23.0...v4.24.0) (2021-05-17) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -# [4.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.1...v4.23.0) (2021-05-10) - - -### Features - -* refactor to split AST specification out as its own module ([#2911](https://github.com/typescript-eslint/typescript-eslint/issues/2911)) ([25ea953](https://github.com/typescript-eslint/typescript-eslint/commit/25ea953cc60b118bd385c71e0a9b61c286c26fcf)) - - - - - -## [4.22.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.0...v4.22.1) (2021-05-04) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -# [4.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.21.0...v4.22.0) (2021-04-12) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -# [4.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.20.0...v4.21.0) (2021-04-05) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -# [4.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.19.0...v4.20.0) (2021-03-29) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -# [4.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.18.0...v4.19.0) (2021-03-22) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -# [4.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.17.0...v4.18.0) (2021-03-15) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -# [4.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.16.1...v4.17.0) (2021-03-08) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -## [4.16.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.16.0...v4.16.1) (2021-03-01) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -# [4.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.2...v4.16.0) (2021-03-01) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -## [4.15.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.1...v4.15.2) (2021-02-22) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -## [4.15.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.0...v4.15.1) (2021-02-15) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -# [4.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.2...v4.15.0) (2021-02-08) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -## [4.14.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.1...v4.14.2) (2021-02-01) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -## [4.14.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.0...v4.14.1) (2021-01-25) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -# [4.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.13.0...v4.14.0) (2021-01-18) - - -### Features - -* add support for decorator metadata in scope analysis and in consistent-type-imports ([#2751](https://github.com/typescript-eslint/typescript-eslint/issues/2751)) ([445e416](https://github.com/typescript-eslint/typescript-eslint/commit/445e416878b27a54bf07c2d3b84dabd7b06e51bc)), closes [#2559](https://github.com/typescript-eslint/typescript-eslint/issues/2559) - - - - - -# [4.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.12.0...v4.13.0) (2021-01-11) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -# [4.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.11.1...v4.12.0) (2021-01-04) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -## [4.11.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.11.0...v4.11.1) (2020-12-28) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -# [4.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.10.0...v4.11.0) (2020-12-21) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -# [4.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.9.1...v4.10.0) (2020-12-14) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -## [4.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.9.0...v4.9.1) (2020-12-07) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -# [4.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.2...v4.9.0) (2020-11-30) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -## [4.8.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.1...v4.8.2) (2020-11-23) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -## [4.8.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.0...v4.8.1) (2020-11-17) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -# [4.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.7.0...v4.8.0) (2020-11-16) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -# [4.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.6.1...v4.7.0) (2020-11-09) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -## [4.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.6.0...v4.6.1) (2020-11-02) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -# [4.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.5.0...v4.6.0) (2020-10-26) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -# [4.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.4.1...v4.5.0) (2020-10-19) - - -### Bug Fixes - -* **parser:** minor fix regexp, map-filter to reduce ([#2684](https://github.com/typescript-eslint/typescript-eslint/issues/2684)) ([f1329f6](https://github.com/typescript-eslint/typescript-eslint/commit/f1329f6c4e3d1de21b1dc59c30ce16503c346eee)) - - -### Features - -* **typescript-estree:** add flag EXPERIMENTAL_useSourceOfProjectReferenceRedirect ([#2669](https://github.com/typescript-eslint/typescript-eslint/issues/2669)) ([90a5878](https://github.com/typescript-eslint/typescript-eslint/commit/90a587845088da1b205e4d7d77dbc3f9447b1c5a)) - - - - +- **typescript-estree:** add flag EXPERIMENTAL_useSourceOfProjectReferenceRedirect ([#2669](https://github.com/typescript-eslint/typescript-eslint/issues/2669)) ([90a5878](https://github.com/typescript-eslint/typescript-eslint/commit/90a587845088da1b205e4d7d77dbc3f9447b1c5a)) ## [4.4.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.4.0...v4.4.1) (2020-10-12) **Note:** Version bump only for package @typescript-eslint/parser - - - - # [4.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.3.0...v4.4.0) (2020-10-05) **Note:** Version bump only for package @typescript-eslint/parser - - - - # [4.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.2.0...v4.3.0) (2020-09-28) **Note:** Version bump only for package @typescript-eslint/parser - - - - # [4.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.1...v4.2.0) (2020-09-21) **Note:** Version bump only for package @typescript-eslint/parser - - - - ## [4.1.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.0...v4.1.1) (2020-09-14) -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -# [4.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.0.1...v4.1.0) (2020-09-07) - - -### Features - -* **scope-manager:** add support for JSX scope analysis ([#2498](https://github.com/typescript-eslint/typescript-eslint/issues/2498)) ([f887ab5](https://github.com/typescript-eslint/typescript-eslint/commit/f887ab51f58c1b3571f9a14832864bc0ca59623f)), closes [#2455](https://github.com/typescript-eslint/typescript-eslint/issues/2455) [#2477](https://github.com/typescript-eslint/typescript-eslint/issues/2477) - - - - - -## [4.0.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.0.0...v4.0.1) (2020-08-31) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -# [4.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.10.1...v4.0.0) (2020-08-31) - -## [Please see the release notes for v4.0.0](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v4.0.0) - -### Features - -* consume new scope analysis package ([#2039](https://github.com/typescript-eslint/typescript-eslint/issues/2039)) ([3be125d](https://github.com/typescript-eslint/typescript-eslint/commit/3be125d9bdbee1984ac6037874edf619213bd3d0)) -* support ESTree optional chaining representation ([#2308](https://github.com/typescript-eslint/typescript-eslint/issues/2308)) ([e9d2ab6](https://github.com/typescript-eslint/typescript-eslint/commit/e9d2ab638b6767700b52797e74b814ea059beaae)) -* **typescript-estree:** switch to globby ([#2418](https://github.com/typescript-eslint/typescript-eslint/issues/2418)) ([3a7ec9b](https://github.com/typescript-eslint/typescript-eslint/commit/3a7ec9bcf1873a99c6da2f19ade8ab4763b4793c)), closes [#2398](https://github.com/typescript-eslint/typescript-eslint/issues/2398) - - -### BREAKING CHANGES - -* **typescript-estree:** - removes the ability to supply a `RegExp` to `projectFolderIgnoreList`, and changes the meaning of the string value from a regex to a glob. - - - - - -## [3.10.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.10.0...v3.10.1) (2020-08-25) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -# [3.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.9.1...v3.10.0) (2020-08-24) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -## [3.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.9.0...v3.9.1) (2020-08-17) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -# [3.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.8.0...v3.9.0) (2020-08-10) - - -### Features - -* **typescript-estree:** support TSv4 labelled tuple members ([#2378](https://github.com/typescript-eslint/typescript-eslint/issues/2378)) ([00d84ff](https://github.com/typescript-eslint/typescript-eslint/commit/00d84ffbcbe9d0ec98bdb2f2ce59959a27ce4dbe)) - - - - - -# [3.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.7.1...v3.8.0) (2020-08-03) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -## [3.7.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.7.0...v3.7.1) (2020-07-27) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -# [3.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.6.1...v3.7.0) (2020-07-20) - - -### Features - -* **typescript-estree:** support short-circuiting assignment operators ([#2307](https://github.com/typescript-eslint/typescript-eslint/issues/2307)) ([2c90d9f](https://github.com/typescript-eslint/typescript-eslint/commit/2c90d9fa3aa5ebd7db697dddb7762bca2dd0e06b)) -* **typescript-estree:** support type annotations on catch clauses ([#2306](https://github.com/typescript-eslint/typescript-eslint/issues/2306)) ([b5afe9c](https://github.com/typescript-eslint/typescript-eslint/commit/b5afe9c560b9f38c8dffc312a600db30944129c8)) - - - - - -## [3.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.6.0...v3.6.1) (2020-07-13) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -# [3.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.5.0...v3.6.0) (2020-07-06) - -**Note:** Version bump only for package @typescript-eslint/parser - - - - - -# [3.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.4.0...v3.5.0) (2020-06-29) +**Note:** Version bump only for package @typescript-eslint/parser +# [4.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.0.1...v4.1.0) (2020-09-07) ### Features -* split types into their own package ([#2229](https://github.com/typescript-eslint/typescript-eslint/issues/2229)) ([5f45918](https://github.com/typescript-eslint/typescript-eslint/commit/5f4591886f3438329fbf2229b03ac66174334a24)) +- **scope-manager:** add support for JSX scope analysis ([#2498](https://github.com/typescript-eslint/typescript-eslint/issues/2498)) ([f887ab5](https://github.com/typescript-eslint/typescript-eslint/commit/f887ab51f58c1b3571f9a14832864bc0ca59623f)), closes [#2455](https://github.com/typescript-eslint/typescript-eslint/issues/2455) [#2477](https://github.com/typescript-eslint/typescript-eslint/issues/2477) +## [4.0.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.0.0...v4.0.1) (2020-08-31) +**Note:** Version bump only for package @typescript-eslint/parser +# [4.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.10.1...v4.0.0) (2020-08-31) +## [Please see the release notes for v4.0.0](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v4.0.0) -# [3.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.3.0...v3.4.0) (2020-06-22) +### Features -**Note:** Version bump only for package @typescript-eslint/parser +- consume new scope analysis package ([#2039](https://github.com/typescript-eslint/typescript-eslint/issues/2039)) ([3be125d](https://github.com/typescript-eslint/typescript-eslint/commit/3be125d9bdbee1984ac6037874edf619213bd3d0)) +- support ESTree optional chaining representation ([#2308](https://github.com/typescript-eslint/typescript-eslint/issues/2308)) ([e9d2ab6](https://github.com/typescript-eslint/typescript-eslint/commit/e9d2ab638b6767700b52797e74b814ea059beaae)) +- **typescript-estree:** switch to globby ([#2418](https://github.com/typescript-eslint/typescript-eslint/issues/2418)) ([3a7ec9b](https://github.com/typescript-eslint/typescript-eslint/commit/3a7ec9bcf1873a99c6da2f19ade8ab4763b4793c)), closes [#2398](https://github.com/typescript-eslint/typescript-eslint/issues/2398) +### BREAKING CHANGES +- **typescript-estree:** - removes the ability to supply a `RegExp` to `projectFolderIgnoreList`, and changes the meaning of the string value from a regex to a glob. +## [3.10.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.10.0...v3.10.1) (2020-08-25) +**Note:** Version bump only for package @typescript-eslint/parser -# [3.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.2.0...v3.3.0) (2020-06-15) +# [3.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.9.1...v3.10.0) (2020-08-24) **Note:** Version bump only for package @typescript-eslint/parser +## [3.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.9.0...v3.9.1) (2020-08-17) +**Note:** Version bump only for package @typescript-eslint/parser +# [3.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.8.0...v3.9.0) (2020-08-10) +### Features -# [3.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.1.0...v3.2.0) (2020-06-08) - +- **typescript-estree:** support TSv4 labelled tuple members ([#2378](https://github.com/typescript-eslint/typescript-eslint/issues/2378)) ([00d84ff](https://github.com/typescript-eslint/typescript-eslint/commit/00d84ffbcbe9d0ec98bdb2f2ce59959a27ce4dbe)) -### Bug Fixes +# [3.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.7.1...v3.8.0) (2020-08-03) -* **eslint-plugin:** [prefer-optional-chain] handling first member expression ([#2156](https://github.com/typescript-eslint/typescript-eslint/issues/2156)) ([de18660](https://github.com/typescript-eslint/typescript-eslint/commit/de18660a8cf8f7033798646d8c5b0938d1accb12)) +**Note:** Version bump only for package @typescript-eslint/parser +## [3.7.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.7.0...v3.7.1) (2020-07-27) +**Note:** Version bump only for package @typescript-eslint/parser +# [3.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.6.1...v3.7.0) (2020-07-20) +### Features -# [3.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.0.2...v3.1.0) (2020-06-01) +- **typescript-estree:** support short-circuiting assignment operators ([#2307](https://github.com/typescript-eslint/typescript-eslint/issues/2307)) ([2c90d9f](https://github.com/typescript-eslint/typescript-eslint/commit/2c90d9fa3aa5ebd7db697dddb7762bca2dd0e06b)) +- **typescript-estree:** support type annotations on catch clauses ([#2306](https://github.com/typescript-eslint/typescript-eslint/issues/2306)) ([b5afe9c](https://github.com/typescript-eslint/typescript-eslint/commit/b5afe9c560b9f38c8dffc312a600db30944129c8)) +## [3.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.6.0...v3.6.1) (2020-07-13) -### Bug Fixes +**Note:** Version bump only for package @typescript-eslint/parser -* **experimental-utils:** downlevel type declarations for versions older than 3.8 ([#2133](https://github.com/typescript-eslint/typescript-eslint/issues/2133)) ([7925823](https://github.com/typescript-eslint/typescript-eslint/commit/792582326a8065270b69a0ffcaad5a7b4b103ff3)) +# [3.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.5.0...v3.6.0) (2020-07-06) +**Note:** Version bump only for package @typescript-eslint/parser +# [3.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.4.0...v3.5.0) (2020-06-29) +### Features +- split types into their own package ([#2229](https://github.com/typescript-eslint/typescript-eslint/issues/2229)) ([5f45918](https://github.com/typescript-eslint/typescript-eslint/commit/5f4591886f3438329fbf2229b03ac66174334a24)) -## [3.0.2](https://github.com/typescript-eslint/typescript-eslint/compare/v3.0.1...v3.0.2) (2020-05-27) +# [3.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.3.0...v3.4.0) (2020-06-22) **Note:** Version bump only for package @typescript-eslint/parser +# [3.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.2.0...v3.3.0) (2020-06-15) +**Note:** Version bump only for package @typescript-eslint/parser +# [3.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.1.0...v3.2.0) (2020-06-08) +### Bug Fixes -## [3.0.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.0.0...v3.0.1) (2020-05-25) +- **eslint-plugin:** [prefer-optional-chain] handling first member expression ([#2156](https://github.com/typescript-eslint/typescript-eslint/issues/2156)) ([de18660](https://github.com/typescript-eslint/typescript-eslint/commit/de18660a8cf8f7033798646d8c5b0938d1accb12)) +# [3.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.0.2...v3.1.0) (2020-06-01) ### Bug Fixes -* **typescript-estree:** handle `BigInt` with `_` numeric separator ([#2067](https://github.com/typescript-eslint/typescript-eslint/issues/2067)) ([66f1627](https://github.com/typescript-eslint/typescript-eslint/commit/66f1627b11a566d5b925a577e800f99d5c808be2)) +- **experimental-utils:** downlevel type declarations for versions older than 3.8 ([#2133](https://github.com/typescript-eslint/typescript-eslint/issues/2133)) ([7925823](https://github.com/typescript-eslint/typescript-eslint/commit/792582326a8065270b69a0ffcaad5a7b4b103ff3)) +## [3.0.2](https://github.com/typescript-eslint/typescript-eslint/compare/v3.0.1...v3.0.2) (2020-05-27) + +**Note:** Version bump only for package @typescript-eslint/parser +## [3.0.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.0.0...v3.0.1) (2020-05-25) +### Bug Fixes +- **typescript-estree:** handle `BigInt` with `_` numeric separator ([#2067](https://github.com/typescript-eslint/typescript-eslint/issues/2067)) ([66f1627](https://github.com/typescript-eslint/typescript-eslint/commit/66f1627b11a566d5b925a577e800f99d5c808be2)) # [3.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.34.0...v3.0.0) (2020-05-21) @@ -1166,471 +659,264 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline ### Bug Fixes -* **typescript-estree:** use `TSEmptyBodyFunctionExpression` for body-less nodes ([#1289](https://github.com/typescript-eslint/typescript-eslint/issues/1289)) ([82e7163](https://github.com/typescript-eslint/typescript-eslint/commit/82e7163214b56ccde93ba97807b161669a50a60b)) - +- **typescript-estree:** use `TSEmptyBodyFunctionExpression` for body-less nodes ([#1289](https://github.com/typescript-eslint/typescript-eslint/issues/1289)) ([82e7163](https://github.com/typescript-eslint/typescript-eslint/commit/82e7163214b56ccde93ba97807b161669a50a60b)) ### Features -* add index files to parser and typescript-estree ([3dfc46d](https://github.com/typescript-eslint/typescript-eslint/commit/3dfc46dccbbd28eed2d74c7b6cacddf1a0848598)) -* **experimental-utils:** upgrade eslint types for v7 ([#2023](https://github.com/typescript-eslint/typescript-eslint/issues/2023)) ([06869c9](https://github.com/typescript-eslint/typescript-eslint/commit/06869c9656fa37936126666845aee40aad546ebd)) -* upgrade to ESLint v7 ([#2022](https://github.com/typescript-eslint/typescript-eslint/issues/2022)) ([208de71](https://github.com/typescript-eslint/typescript-eslint/commit/208de71059746bf38e94bd460346ffb2698a3e12)) -* **typescript-estree:** align nodes with estree 2020 ([#1389](https://github.com/typescript-eslint/typescript-eslint/issues/1389)) ([aff5b62](https://github.com/typescript-eslint/typescript-eslint/commit/aff5b62044f9b93f2087a1d261e9be3f8d6fd54d)) -* **typescript-estree:** align optional fields ([#1429](https://github.com/typescript-eslint/typescript-eslint/issues/1429)) ([0e0010f](https://github.com/typescript-eslint/typescript-eslint/commit/0e0010f82952f9beeeb84136eea00cc5eecc9db6)) -* drop support for node v8 ([#1997](https://github.com/typescript-eslint/typescript-eslint/issues/1997)) ([b6c3b7b](https://github.com/typescript-eslint/typescript-eslint/commit/b6c3b7b84b8d199fa75a46432febd4a364a63217)) -* **eslint-plugin:** [ban-types] rework default options ([#848](https://github.com/typescript-eslint/typescript-eslint/issues/848)) ([8e31d5d](https://github.com/typescript-eslint/typescript-eslint/commit/8e31d5dbe9fe5227fdbefcecfd50ce5dd51360c3)) -* **typescript-estree:** handle 3.9's non-null assertion changes ([#2036](https://github.com/typescript-eslint/typescript-eslint/issues/2036)) ([06bec63](https://github.com/typescript-eslint/typescript-eslint/commit/06bec63c56536db070608ab136d2ad57083f0c6a)) - - - - +- add index files to parser and typescript-estree ([3dfc46d](https://github.com/typescript-eslint/typescript-eslint/commit/3dfc46dccbbd28eed2d74c7b6cacddf1a0848598)) +- **experimental-utils:** upgrade eslint types for v7 ([#2023](https://github.com/typescript-eslint/typescript-eslint/issues/2023)) ([06869c9](https://github.com/typescript-eslint/typescript-eslint/commit/06869c9656fa37936126666845aee40aad546ebd)) +- upgrade to ESLint v7 ([#2022](https://github.com/typescript-eslint/typescript-eslint/issues/2022)) ([208de71](https://github.com/typescript-eslint/typescript-eslint/commit/208de71059746bf38e94bd460346ffb2698a3e12)) +- **typescript-estree:** align nodes with estree 2020 ([#1389](https://github.com/typescript-eslint/typescript-eslint/issues/1389)) ([aff5b62](https://github.com/typescript-eslint/typescript-eslint/commit/aff5b62044f9b93f2087a1d261e9be3f8d6fd54d)) +- **typescript-estree:** align optional fields ([#1429](https://github.com/typescript-eslint/typescript-eslint/issues/1429)) ([0e0010f](https://github.com/typescript-eslint/typescript-eslint/commit/0e0010f82952f9beeeb84136eea00cc5eecc9db6)) +- drop support for node v8 ([#1997](https://github.com/typescript-eslint/typescript-eslint/issues/1997)) ([b6c3b7b](https://github.com/typescript-eslint/typescript-eslint/commit/b6c3b7b84b8d199fa75a46432febd4a364a63217)) +- **eslint-plugin:** [ban-types] rework default options ([#848](https://github.com/typescript-eslint/typescript-eslint/issues/848)) ([8e31d5d](https://github.com/typescript-eslint/typescript-eslint/commit/8e31d5dbe9fe5227fdbefcecfd50ce5dd51360c3)) +- **typescript-estree:** handle 3.9's non-null assertion changes ([#2036](https://github.com/typescript-eslint/typescript-eslint/issues/2036)) ([06bec63](https://github.com/typescript-eslint/typescript-eslint/commit/06bec63c56536db070608ab136d2ad57083f0c6a)) # [2.34.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.33.0...v2.34.0) (2020-05-18) **Note:** Version bump only for package @typescript-eslint/parser - - - - # [2.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.32.0...v2.33.0) (2020-05-12) **Note:** Version bump only for package @typescript-eslint/parser - - - - # [2.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.31.0...v2.32.0) (2020-05-11) - ### Features -* bump dependencies and align AST ([#2007](https://github.com/typescript-eslint/typescript-eslint/issues/2007)) ([18668b7](https://github.com/typescript-eslint/typescript-eslint/commit/18668b78fd7d1e5281af7fc26c76e0ca53297f69)) - - - - +- bump dependencies and align AST ([#2007](https://github.com/typescript-eslint/typescript-eslint/issues/2007)) ([18668b7](https://github.com/typescript-eslint/typescript-eslint/commit/18668b78fd7d1e5281af7fc26c76e0ca53297f69)) # [2.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.30.0...v2.31.0) (2020-05-04) **Note:** Version bump only for package @typescript-eslint/parser - - - - # [2.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.29.0...v2.30.0) (2020-04-27) **Note:** Version bump only for package @typescript-eslint/parser - - - - # [2.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.28.0...v2.29.0) (2020-04-20) **Note:** Version bump only for package @typescript-eslint/parser - - - - # [2.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.27.0...v2.28.0) (2020-04-13) **Note:** Version bump only for package @typescript-eslint/parser - - - - # [2.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.26.0...v2.27.0) (2020-04-06) **Note:** Version bump only for package @typescript-eslint/parser - - - - # [2.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.25.0...v2.26.0) (2020-03-30) - ### Features -* **typescript-estree:** add option to ignore certain folders from glob resolution ([#1802](https://github.com/typescript-eslint/typescript-eslint/issues/1802)) ([1e29e69](https://github.com/typescript-eslint/typescript-eslint/commit/1e29e69b289d61107a7de67592beae331ba50222)) - - - - +- **typescript-estree:** add option to ignore certain folders from glob resolution ([#1802](https://github.com/typescript-eslint/typescript-eslint/issues/1802)) ([1e29e69](https://github.com/typescript-eslint/typescript-eslint/commit/1e29e69b289d61107a7de67592beae331ba50222)) # [2.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.24.0...v2.25.0) (2020-03-23) **Note:** Version bump only for package @typescript-eslint/parser - - - - # [2.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.23.0...v2.24.0) (2020-03-16) - ### Features -* **typescript-estree:** support 3.8 `export * as ns` ([#1698](https://github.com/typescript-eslint/typescript-eslint/issues/1698)) ([133f622](https://github.com/typescript-eslint/typescript-eslint/commit/133f622f38a286eac45288a9789d2ee529d5e582)) - - - - +- **typescript-estree:** support 3.8 `export * as ns` ([#1698](https://github.com/typescript-eslint/typescript-eslint/issues/1698)) ([133f622](https://github.com/typescript-eslint/typescript-eslint/commit/133f622f38a286eac45288a9789d2ee529d5e582)) # [2.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.22.0...v2.23.0) (2020-03-09) - ### Features -* **typescript-estree:** support 3.8 import/export type ([#1697](https://github.com/typescript-eslint/typescript-eslint/issues/1697)) ([625d603](https://github.com/typescript-eslint/typescript-eslint/commit/625d603f94bf0521f834313bf31c734ce4948b7a)) - - - - +- **typescript-estree:** support 3.8 import/export type ([#1697](https://github.com/typescript-eslint/typescript-eslint/issues/1697)) ([625d603](https://github.com/typescript-eslint/typescript-eslint/commit/625d603f94bf0521f834313bf31c734ce4948b7a)) # [2.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.21.0...v2.22.0) (2020-03-02) **Note:** Version bump only for package @typescript-eslint/parser - - - - # [2.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.20.0...v2.21.0) (2020-02-24) **Note:** Version bump only for package @typescript-eslint/parser - - - - # [2.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.19.2...v2.20.0) (2020-02-17) **Note:** Version bump only for package @typescript-eslint/parser - - - - ## [2.19.2](https://github.com/typescript-eslint/typescript-eslint/compare/v2.19.1...v2.19.2) (2020-02-10) **Note:** Version bump only for package @typescript-eslint/parser - - - - ## [2.19.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.19.0...v2.19.1) (2020-02-10) **Note:** Version bump only for package @typescript-eslint/parser - - - - # [2.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.18.0...v2.19.0) (2020-02-03) **Note:** Version bump only for package @typescript-eslint/parser - - - - # [2.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.17.0...v2.18.0) (2020-01-27) - ### Bug Fixes -* **typescript-estree:** fix identifier tokens typed as `Keyword` ([#1487](https://github.com/typescript-eslint/typescript-eslint/issues/1487)) ([77a1caa](https://github.com/typescript-eslint/typescript-eslint/commit/77a1caa562638645b4717449800e410107d512c8)) - +- **typescript-estree:** fix identifier tokens typed as `Keyword` ([#1487](https://github.com/typescript-eslint/typescript-eslint/issues/1487)) ([77a1caa](https://github.com/typescript-eslint/typescript-eslint/commit/77a1caa562638645b4717449800e410107d512c8)) ### Features -* **eslint-plugin:** add new rule prefer-as-const ([#1431](https://github.com/typescript-eslint/typescript-eslint/issues/1431)) ([420db96](https://github.com/typescript-eslint/typescript-eslint/commit/420db96921435e8bf7fb484ae74552a912a6adde)) -* **parser:** clean up scope-analysis types ([#1481](https://github.com/typescript-eslint/typescript-eslint/issues/1481)) ([4a727fa](https://github.com/typescript-eslint/typescript-eslint/commit/4a727fa083d749dba9eaf39322856f5f69c28cd8)) - - - - +- **eslint-plugin:** add new rule prefer-as-const ([#1431](https://github.com/typescript-eslint/typescript-eslint/issues/1431)) ([420db96](https://github.com/typescript-eslint/typescript-eslint/commit/420db96921435e8bf7fb484ae74552a912a6adde)) +- **parser:** clean up scope-analysis types ([#1481](https://github.com/typescript-eslint/typescript-eslint/issues/1481)) ([4a727fa](https://github.com/typescript-eslint/typescript-eslint/commit/4a727fa083d749dba9eaf39322856f5f69c28cd8)) # [2.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.16.0...v2.17.0) (2020-01-20) **Note:** Version bump only for package @typescript-eslint/parser - - - - # [2.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.15.0...v2.16.0) (2020-01-13) - ### Bug Fixes -* **typescript-estree:** resolve path relative to tsconfigRootDir ([#1439](https://github.com/typescript-eslint/typescript-eslint/issues/1439)) ([c709056](https://github.com/typescript-eslint/typescript-eslint/commit/c709056)) - - - - +- **typescript-estree:** resolve path relative to tsconfigRootDir ([#1439](https://github.com/typescript-eslint/typescript-eslint/issues/1439)) ([c709056](https://github.com/typescript-eslint/typescript-eslint/commit/c709056)) # [2.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.14.0...v2.15.0) (2020-01-06) **Note:** Version bump only for package @typescript-eslint/parser - - - - # [2.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.13.0...v2.14.0) (2019-12-30) - ### Bug Fixes -* **typescript-estree:** visit typeParameters in OptionalCallExpr ([#1377](https://github.com/typescript-eslint/typescript-eslint/issues/1377)) ([cba6a2a](https://github.com/typescript-eslint/typescript-eslint/commit/cba6a2a)) - - - - +- **typescript-estree:** visit typeParameters in OptionalCallExpr ([#1377](https://github.com/typescript-eslint/typescript-eslint/issues/1377)) ([cba6a2a](https://github.com/typescript-eslint/typescript-eslint/commit/cba6a2a)) # [2.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.12.0...v2.13.0) (2019-12-23) - ### Features -* **typescript-estree:** computed members discriminated unions ([#1349](https://github.com/typescript-eslint/typescript-eslint/issues/1349)) ([013df9a](https://github.com/typescript-eslint/typescript-eslint/commit/013df9a)) - - - - +- **typescript-estree:** computed members discriminated unions ([#1349](https://github.com/typescript-eslint/typescript-eslint/issues/1349)) ([013df9a](https://github.com/typescript-eslint/typescript-eslint/commit/013df9a)) # [2.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.11.0...v2.12.0) (2019-12-16) **Note:** Version bump only for package @typescript-eslint/parser - - - - # [2.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.10.0...v2.11.0) (2019-12-09) **Note:** Version bump only for package @typescript-eslint/parser - - - - # [2.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.9.0...v2.10.0) (2019-12-02) **Note:** Version bump only for package @typescript-eslint/parser - - - - # [2.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.8.0...v2.9.0) (2019-11-25) **Note:** Version bump only for package @typescript-eslint/parser - - - - # [2.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.7.0...v2.8.0) (2019-11-18) - ### Bug Fixes -* **typescript-estree:** options range loc being always true ([#704](https://github.com/typescript-eslint/typescript-eslint/issues/704)) ([db1aa18](https://github.com/typescript-eslint/typescript-eslint/commit/db1aa18)) - - - - +- **typescript-estree:** options range loc being always true ([#704](https://github.com/typescript-eslint/typescript-eslint/issues/704)) ([db1aa18](https://github.com/typescript-eslint/typescript-eslint/commit/db1aa18)) # [2.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.6.1...v2.7.0) (2019-11-11) - ### Features -* **parser:** handle optional chaining in scope analysis ([#1169](https://github.com/typescript-eslint/typescript-eslint/issues/1169)) ([026ceb9](https://github.com/typescript-eslint/typescript-eslint/commit/026ceb9)) - - - - +- **parser:** handle optional chaining in scope analysis ([#1169](https://github.com/typescript-eslint/typescript-eslint/issues/1169)) ([026ceb9](https://github.com/typescript-eslint/typescript-eslint/commit/026ceb9)) ## [2.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.6.0...v2.6.1) (2019-11-04) - ### Bug Fixes -* **typescript-estree:** fix filename handling for vue JSX + markdown ([#1127](https://github.com/typescript-eslint/typescript-eslint/issues/1127)) ([366518f](https://github.com/typescript-eslint/typescript-eslint/commit/366518f)) - - - - +- **typescript-estree:** fix filename handling for vue JSX + markdown ([#1127](https://github.com/typescript-eslint/typescript-eslint/issues/1127)) ([366518f](https://github.com/typescript-eslint/typescript-eslint/commit/366518f)) # [2.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.5.0...v2.6.0) (2019-10-28) - ### Bug Fixes -* **typescript-estree:** correct parenthesized optional chain AST ([#1141](https://github.com/typescript-eslint/typescript-eslint/issues/1141)) ([5ae286e](https://github.com/typescript-eslint/typescript-eslint/commit/5ae286e)) - +- **typescript-estree:** correct parenthesized optional chain AST ([#1141](https://github.com/typescript-eslint/typescript-eslint/issues/1141)) ([5ae286e](https://github.com/typescript-eslint/typescript-eslint/commit/5ae286e)) ### Features -* **typescript-estree:** add support for declare class properties ([#1136](https://github.com/typescript-eslint/typescript-eslint/issues/1136)) ([1508670](https://github.com/typescript-eslint/typescript-eslint/commit/1508670)) - - - - +- **typescript-estree:** add support for declare class properties ([#1136](https://github.com/typescript-eslint/typescript-eslint/issues/1136)) ([1508670](https://github.com/typescript-eslint/typescript-eslint/commit/1508670)) # [2.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.4.0...v2.5.0) (2019-10-21) **Note:** Version bump only for package @typescript-eslint/parser - - - - # [2.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.3...v2.4.0) (2019-10-14) - ### Bug Fixes -* support long running "watch" lint sessions ([#973](https://github.com/typescript-eslint/typescript-eslint/issues/973)) ([854620e](https://github.com/typescript-eslint/typescript-eslint/commit/854620e)) - +- support long running "watch" lint sessions ([#973](https://github.com/typescript-eslint/typescript-eslint/issues/973)) ([854620e](https://github.com/typescript-eslint/typescript-eslint/commit/854620e)) ### Features -* **typescript-estree:** support for parsing 3.7 features ([#1045](https://github.com/typescript-eslint/typescript-eslint/issues/1045)) ([623febf](https://github.com/typescript-eslint/typescript-eslint/commit/623febf)) - - - - +- **typescript-estree:** support for parsing 3.7 features ([#1045](https://github.com/typescript-eslint/typescript-eslint/issues/1045)) ([623febf](https://github.com/typescript-eslint/typescript-eslint/commit/623febf)) ## [2.3.3](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.2...v2.3.3) (2019-10-07) **Note:** Version bump only for package @typescript-eslint/parser - - - - ## [2.3.2](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.1...v2.3.2) (2019-09-30) - ### Bug Fixes -* **typescript-estree:** handle optional computed prop w/o type ([#1026](https://github.com/typescript-eslint/typescript-eslint/issues/1026)) ([95c13fe](https://github.com/typescript-eslint/typescript-eslint/commit/95c13fe)) - - - - +- **typescript-estree:** handle optional computed prop w/o type ([#1026](https://github.com/typescript-eslint/typescript-eslint/issues/1026)) ([95c13fe](https://github.com/typescript-eslint/typescript-eslint/commit/95c13fe)) ## [2.3.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.0...v2.3.1) (2019-09-23) - ### Bug Fixes -* **typescript-estree:** parsing error for await in non-async func ([#988](https://github.com/typescript-eslint/typescript-eslint/issues/988)) ([19abbe0](https://github.com/typescript-eslint/typescript-eslint/commit/19abbe0)) - - - - +- **typescript-estree:** parsing error for await in non-async func ([#988](https://github.com/typescript-eslint/typescript-eslint/issues/988)) ([19abbe0](https://github.com/typescript-eslint/typescript-eslint/commit/19abbe0)) # [2.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.2.0...v2.3.0) (2019-09-16) **Note:** Version bump only for package @typescript-eslint/parser - - - - # [2.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.1.0...v2.2.0) (2019-09-09) **Note:** Version bump only for package @typescript-eslint/parser - - - - # [2.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.0.0...v2.1.0) (2019-09-02) - ### Bug Fixes -* **typescript-estree:** improve missing project file error msg ([#866](https://github.com/typescript-eslint/typescript-eslint/issues/866)) ([8f3b0a8](https://github.com/typescript-eslint/typescript-eslint/commit/8f3b0a8)), closes [#853](https://github.com/typescript-eslint/typescript-eslint/issues/853) - +- **typescript-estree:** improve missing project file error msg ([#866](https://github.com/typescript-eslint/typescript-eslint/issues/866)) ([8f3b0a8](https://github.com/typescript-eslint/typescript-eslint/commit/8f3b0a8)), closes [#853](https://github.com/typescript-eslint/typescript-eslint/issues/853) ### Features -* **typescript-estree:** Accept a glob pattern for `options.project` ([#806](https://github.com/typescript-eslint/typescript-eslint/issues/806)) ([9e5f21e](https://github.com/typescript-eslint/typescript-eslint/commit/9e5f21e)) - - - - +- **typescript-estree:** Accept a glob pattern for `options.project` ([#806](https://github.com/typescript-eslint/typescript-eslint/issues/806)) ([9e5f21e](https://github.com/typescript-eslint/typescript-eslint/commit/9e5f21e)) # [2.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.13.0...v2.0.0) (2019-08-13) - -* feat(eslint-plugin)!: change recommended config (#729) ([428567d](https://github.com/typescript-eslint/typescript-eslint/commit/428567d)), closes [#729](https://github.com/typescript-eslint/typescript-eslint/issues/729) -* feat(typescript-estree)!: throw error on file not in project when `project` set (#760) ([3777b77](https://github.com/typescript-eslint/typescript-eslint/commit/3777b77)), closes [#760](https://github.com/typescript-eslint/typescript-eslint/issues/760) - +- feat(eslint-plugin)!: change recommended config (#729) ([428567d](https://github.com/typescript-eslint/typescript-eslint/commit/428567d)), closes [#729](https://github.com/typescript-eslint/typescript-eslint/issues/729) +- feat(typescript-estree)!: throw error on file not in project when `project` set (#760) ([3777b77](https://github.com/typescript-eslint/typescript-eslint/commit/3777b77)), closes [#760](https://github.com/typescript-eslint/typescript-eslint/issues/760) ### Bug Fixes -* **typescript-estree:** fix `is` token typed as `Keyword ([#750](https://github.com/typescript-eslint/typescript-eslint/issues/750)) ([35dec52](https://github.com/typescript-eslint/typescript-eslint/commit/35dec52)) -* **typescript-estree:** jsx comment parsing ([#703](https://github.com/typescript-eslint/typescript-eslint/issues/703)) ([0cfc48e](https://github.com/typescript-eslint/typescript-eslint/commit/0cfc48e)) - +- **typescript-estree:** fix `is` token typed as `Keyword ([#750](https://github.com/typescript-eslint/typescript-eslint/issues/750)) ([35dec52](https://github.com/typescript-eslint/typescript-eslint/commit/35dec52)) +- **typescript-estree:** jsx comment parsing ([#703](https://github.com/typescript-eslint/typescript-eslint/issues/703)) ([0cfc48e](https://github.com/typescript-eslint/typescript-eslint/commit/0cfc48e)) ### Features -* explicitly support eslint v6 ([#645](https://github.com/typescript-eslint/typescript-eslint/issues/645)) ([34a7cf6](https://github.com/typescript-eslint/typescript-eslint/commit/34a7cf6)) - +- explicitly support eslint v6 ([#645](https://github.com/typescript-eslint/typescript-eslint/issues/645)) ([34a7cf6](https://github.com/typescript-eslint/typescript-eslint/commit/34a7cf6)) ### BREAKING CHANGES -* recommended config changes are considered breaking -* by default we will now throw when a file is not in the `project` provided -* Node 6 is no longer supported - - - - +- recommended config changes are considered breaking +- by default we will now throw when a file is not in the `project` provided +- Node 6 is no longer supported # [1.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.12.0...v1.13.0) (2019-07-21) **Note:** Version bump only for package @typescript-eslint/parser - - - - # [1.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.11.0...v1.12.0) (2019-07-12) - ### Bug Fixes -* **typescript-estree:** fix `async` identifier token typed as `Keyword` ([#681](https://github.com/typescript-eslint/typescript-eslint/issues/681)) ([6de19d3](https://github.com/typescript-eslint/typescript-eslint/commit/6de19d3)) - - - - +- **typescript-estree:** fix `async` identifier token typed as `Keyword` ([#681](https://github.com/typescript-eslint/typescript-eslint/issues/681)) ([6de19d3](https://github.com/typescript-eslint/typescript-eslint/commit/6de19d3)) # [1.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.10.2...v1.11.0) (2019-06-23) - ### Bug Fixes -* **parser:** add simpleTraverse, replaces private ESLint util ([#628](https://github.com/typescript-eslint/typescript-eslint/issues/628)) ([aa206c4](https://github.com/typescript-eslint/typescript-eslint/commit/aa206c4)) -* **typescript-estree:** fix more cases with double slash in JSX text ([#607](https://github.com/typescript-eslint/typescript-eslint/issues/607)) ([34cfa53](https://github.com/typescript-eslint/typescript-eslint/commit/34cfa53)) - - - - +- **parser:** add simpleTraverse, replaces private ESLint util ([#628](https://github.com/typescript-eslint/typescript-eslint/issues/628)) ([aa206c4](https://github.com/typescript-eslint/typescript-eslint/commit/aa206c4)) +- **typescript-estree:** fix more cases with double slash in JSX text ([#607](https://github.com/typescript-eslint/typescript-eslint/issues/607)) ([34cfa53](https://github.com/typescript-eslint/typescript-eslint/commit/34cfa53)) ## [1.10.2](https://github.com/typescript-eslint/typescript-eslint/compare/v1.10.1...v1.10.2) (2019-06-10) diff --git a/packages/parser/LICENSE b/packages/parser/LICENSE index a2d896685ac..dc04d8c91c0 100644 --- a/packages/parser/LICENSE +++ b/packages/parser/LICENSE @@ -4,11 +4,11 @@ Copyright JS Foundation and other contributors, https://js.foundation Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. +- Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +- Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE diff --git a/packages/parser/README.md b/packages/parser/README.md index efba4854413..f057b97f868 100644 --- a/packages/parser/README.md +++ b/packages/parser/README.md @@ -1,302 +1,10 @@ -

TypeScript ESLint Parser

+# `@typescript-eslint/parser` -

An ESLint parser which leverages TypeScript ESTree to allow for ESLint to lint TypeScript source code.

+> An ESLint parser which leverages TypeScript ESTree to allow for ESLint to lint TypeScript source code. -

- CI - NPM Version - NPM Downloads -

+[![NPM Version](https://img.shields.io/npm/v/@typescript-eslint/parser.svg?style=flat-square)](https://www.npmjs.com/package/@typescript-eslint/parser) +[![NPM Downloads](https://img.shields.io/npm/dm/@typescript-eslint/parser.svg?style=flat-square)](https://www.npmjs.com/package/@typescript-eslint/parser) -## Getting Started +👉 See **https://typescript-eslint.io/architecture/parser** for documentation on this package. -**[You can find our Getting Started docs here](https://typescript-eslint.io/docs)** - -These docs walk you through setting up ESLint, this parser, and our plugin. If you know what you're doing and just want to quick start, read on... - -## Quick-start - -### Installation - -```bash -$ yarn add -D typescript @typescript-eslint/parser -$ npm i --save-dev typescript @typescript-eslint/parser -``` - -### Usage - -In your ESLint configuration file, set the `parser` property: - -```json -{ - "parser": "@typescript-eslint/parser" -} -``` - -There is sometimes an incorrect assumption that the parser itself is what does everything necessary to facilitate the use of ESLint with TypeScript. In actuality, it is the combination of the parser _and_ one or more plugins which allow you to maximize your usage of ESLint with TypeScript. - -For example, once this parser successfully produces an AST for the TypeScript source code, it might well contain some information which simply does not exist in a standard JavaScript context, such as the data for a TypeScript-specific construct, like an `interface`. - -The core rules built into ESLint, such as `indent` have no knowledge of such constructs, so it is impossible to expect them to work out of the box with them. - -Instead, you also need to make use of one more plugins which will add or extend rules with TypeScript-specific features. - -By far the most common case will be installing the [`@typescript-eslint/eslint-plugin`](https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/eslint-plugin) plugin, but there are also other relevant options available such a [`@typescript-eslint/eslint-plugin-tslint`](https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/eslint-plugin-tslint). - -## Configuration - -The following additional configuration options are available by specifying them in [`parserOptions`](https://eslint.org/docs/user-guide/configuring/language-options#specifying-parser-options) in your ESLint configuration file. - -```ts -interface ParserOptions { - ecmaFeatures?: { - jsx?: boolean; - globalReturn?: boolean; - }; - ecmaVersion?: number | 'latest'; - - jsxPragma?: string | null; - jsxFragmentName?: string | null; - lib?: string[]; - - project?: string | string[]; - projectFolderIgnoreList?: string[]; - tsconfigRootDir?: string; - extraFileExtensions?: string[]; - warnOnUnsupportedTypeScriptVersion?: boolean; - - program?: import('typescript').Program; - moduleResolver?: string; - - emitDecoratorMetadata?: boolean; -} -``` - -### `parserOptions.ecmaFeatures.jsx` - -Default `false`. - -Enable parsing JSX when `true`. More details can be found [here](https://www.typescriptlang.org/docs/handbook/jsx.html). - -**NOTE:** this setting does not affect known file types (`.js`, `.mjs`, `.cjs`, `.jsx`, `.ts`, `.mts`, `.cts`, `.tsx`, `.json`) because the TypeScript compiler has its own internal handling for known file extensions. - - - -The exact behavior is as follows: - -- `.js`, `.mjs`, `.cjs`, `.jsx`, `.tsx` files are always parsed as if this is `true`. -- `.ts`, `.mts`, `.cts` files are always parsed as if this is `false`. -- For "unknown" extensions (`.md`, `.vue`): - - If `parserOptions.project` is _not_ provided: - - The setting will be respected. - - If `parserOptions.project` is provided (i.e. you are using rules with type information): - - **always parsed as if this is `false`** - -### `parserOptions.ecmaFeatures.globalReturn` - -Default `false`. - -This options allows you to tell the parser if you want to allow global `return` statements in your codebase. - -### `parserOptions.ecmaVersion` - -Default `2018`. - -Accepts any valid ECMAScript version number or `'latest'`: - -- A version: es3, es5, es6, es7, es8, es9, es10, es11, es12, es13, ..., or -- A year: es2015, es2016, es2017, es2018, es2019, es2020, es2021, es2022, ..., or -- `'latest'` - -When it's a version or a year, the value **must** be a number - so do not include the `es` prefix. - -Specifies the version of ECMAScript syntax you want to use. This is used by the parser to determine how to perform scope analysis, and it affects the default - -### `parserOptions.jsxPragma` - -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`. - -This should not be a member expression - just the root identifier (i.e. use `"React"` instead of `"React.createElement"`). - -If you provide `parserOptions.project`, you do not need to set this, as it will automatically detected from the compiler. - -### `parserOptions.jsxFragmentName` - -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`. -This should not be a member expression - just the root identifier (i.e. use `"h"` instead of `"h.Fragment"`). - -If you provide `parserOptions.project`, you do not need to set this, as it will automatically detected from the compiler. - -### `parserOptions.lib` - -Default `['es2018']` - -For valid options, see the [TypeScript compiler options](https://www.typescriptlang.org/tsconfig#lib). - -Specifies the TypeScript `lib`s that are available. This is used by the scope analyser to ensure there are global variables declared for the types exposed by TypeScript. - -If you provide `parserOptions.project`, you do not need to set this, as it will automatically detected from the compiler. - -### `parserOptions.project` - -Default `undefined`. - -This option allows you to provide a path to your project's `tsconfig.json`. **This setting is required if you want to use rules which require type information**. Relative paths are interpreted relative to the current working directory if `tsconfigRootDir` is not set. If you intend on running ESLint from directories other than the project root, you should consider using `tsconfigRootDir`. - -- Accepted values: - - ```js - // path - project: './tsconfig.json'; - - // glob pattern - project: './packages/**/tsconfig.json'; - - // array of paths and/or glob patterns - project: ['./packages/**/tsconfig.json', './separate-package/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. - -- TypeScript will ignore files with duplicate filenames in the same folder (for example, `src/file.ts` and `src/file.js`). TypeScript purposely ignore all but one of the files, only keeping the one file with the highest priority extension (the extension priority order (from highest to lowest) is `.ts`, `.tsx`, `.d.ts`, `.js`, `.jsx`). For more info see #955. - -- Note that if this setting is specified and `createDefaultProgram` is not, you must only lint files that are included in the projects as defined by the provided `tsconfig.json` files. If your existing configuration does not include all of the files you would like to lint, you can create a separate `tsconfig.eslint.json` as follows: - - ```jsonc - { - // extend your base config so you don't have to redefine your compilerOptions - "extends": "./tsconfig.json", - "include": [ - "src/**/*.ts", - "test/**/*.ts", - "typings/**/*.ts", - // etc - - // if you have a mixed JS/TS codebase, don't forget to include your JS files - "src/**/*.js" - ] - } - ``` - -### `parserOptions.tsconfigRootDir` - -Default `undefined`. - -This option allows you to provide the root directory for relative tsconfig paths specified in the `project` option above. - -### `parserOptions.projectFolderIgnoreList` - -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. - -It accepts an array of globs to exclude from the `project` globs. - -For example, by default it will ensure that a glob like `./**/tsconfig.json` will not match any `tsconfig`s within your `node_modules` folder (some npm packages do not exclude their source files from their published packages). - -### `parserOptions.extraFileExtensions` - -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']`. -Add extensions starting with `.`, followed by the file extension. E.g. for a `.vue` file use `"extraFileExtensions": [".vue"]`. - -### `parserOptions.warnOnUnsupportedTypeScriptVersion` - -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 - -### `parserOptions.createDefaultProgram` - -Default `false`. - -This option allows you to request that when the `project` setting is specified, files will be allowed when not included in the projects defined by the provided `tsconfig.json` files. **Using this option will incur significant performance costs. This option is primarily included for backwards-compatibility.** See the **`project`** section above for more information. - -### `parserOptions.programs` - -Default `undefined`. - -This option allows you to programmatically provide an array of one or more instances of a TypeScript Program object that will provide type information to rules. -This will override any programs that would have been computed from `parserOptions.project` or `parserOptions.createDefaultProgram`. -All linted files must be part of the provided program(s). - -### `parserOptions.moduleResolver` - -Default `undefined`. - -This option allows you to provide a custom module resolution. The value should point to a JS file that default exports (`export default`, or `module.exports =`, or `export =`) a file with the following interface: - -```ts -interface ModuleResolver { - version: 1; - resolveModuleNames( - moduleNames: string[], - containingFile: string, - reusedNames: string[] | undefined, - redirectedReference: ts.ResolvedProjectReference | undefined, - options: ts.CompilerOptions, - ): (ts.ResolvedModule | undefined)[]; -} -``` - -[Refer to the TypeScript Wiki for an example on how to write the `resolveModuleNames` function](https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#customizing-module-resolution). - -Note that if you pass custom programs via `options.programs` this option will not have any effect over them (you can simply add the custom resolution on them directly). - -### `parserOptions.emitDecoratorMetadata` - -Default `undefined`. - -This option allow you to tell parser to act as if `emitDecoratorMetadata: true` is set in `tsconfig.json`, but without [type-aware linting](https://typescript-eslint.io/docs/linting/typed-linting). In other words, you don't have to specify `parserOptions.project` in this case, making the linting process faster. - -## Utilities - -### `createProgram(configFile, projectDirectory)` - -This serves as a utility method for users of the `parserOptions.programs` feature to create a TypeScript program instance from a config file. - -```ts -declare function createProgram( - configFile: string, - projectDirectory?: string, -): import('typescript').Program; -``` - -Example usage in .eslintrc.js: - -```js -const parser = require('@typescript-eslint/parser'); -const programs = [parser.createProgram('tsconfig.json')]; -module.exports = { - parserOptions: { - programs, - }, -}; -``` - -## Supported TypeScript Version - -Please see [`typescript-eslint`](https://github.com/typescript-eslint/typescript-eslint) for the supported TypeScript version. - -**Please ensure that you are using a supported version before submitting any issues/bug reports.** - -## Reporting Issues - -Please use the `@typescript-eslint/parser` issue template when creating your issue and fill out the information requested as best you can. This will really help us when looking into your issue. - -## License - -TypeScript ESLint Parser is licensed under a permissive BSD 2-clause license. - -## Contributing - -[See the contributing guide here](../../CONTRIBUTING.md) +> See https://typescript-eslint.io for general documentation on typescript-eslint, the tooling that allows you to run ESLint and Prettier on TypeScript code. diff --git a/packages/parser/package.json b/packages/parser/package.json index 1976d9efd6b..e2361a139ed 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/parser", - "version": "5.39.0", + "version": "5.46.1", "description": "An ESLint custom parser which leverages TypeScript ESTree", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -37,7 +37,7 @@ "clean": "tsc -b tsconfig.build.json --clean", "postclean": "rimraf dist && rimraf _ts3.4 && rimraf coverage", "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", - "lint": "eslint . --ignore-path='../../.eslintignore'", + "lint": "nx lint", "test": "jest --coverage", "typecheck": "tsc -p tsconfig.json --noEmit" }, @@ -45,9 +45,9 @@ "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" }, "dependencies": { - "@typescript-eslint/scope-manager": "5.39.0", - "@typescript-eslint/types": "5.39.0", - "@typescript-eslint/typescript-estree": "5.39.0", + "@typescript-eslint/scope-manager": "5.46.1", + "@typescript-eslint/types": "5.46.1", + "@typescript-eslint/typescript-estree": "5.46.1", "debug": "^4.3.4" }, "devDependencies": { diff --git a/packages/parser/project.json b/packages/parser/project.json index c9c9e3b6321..39cc9637919 100644 --- a/packages/parser/project.json +++ b/packages/parser/project.json @@ -1,5 +1,15 @@ { - "root": "packages/parser", + "name": "parser", + "$schema": "../../node_modules/nx/schemas/project-schema.json", "type": "library", - "implicitDependencies": [] + "implicitDependencies": [], + "targets": { + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["packages/parser/**/*.ts"] + } + } + } } diff --git a/packages/parser/src/parser.ts b/packages/parser/src/parser.ts index 0e4b7780c17..f151cbdc143 100644 --- a/packages/parser/src/parser.ts +++ b/packages/parser/src/parser.ts @@ -136,30 +136,28 @@ function parseForESLint( analyzeOptions.lib = getLib(compilerOptions); log('Resolved libs from program: %o', analyzeOptions.lib); } - if (parserOptions.jsx === true) { - if ( - analyzeOptions.jsxPragma === undefined && - compilerOptions.jsxFactory != null - ) { - // in case the user has specified something like "preact.h" - const factory = compilerOptions.jsxFactory.split('.')[0].trim(); - analyzeOptions.jsxPragma = factory; - log('Resolved jsxPragma from program: %s', analyzeOptions.jsxPragma); - } - if ( - analyzeOptions.jsxFragmentName === undefined && - compilerOptions.jsxFragmentFactory != null - ) { - // in case the user has specified something like "preact.Fragment" - const fragFactory = compilerOptions.jsxFragmentFactory - .split('.')[0] - .trim(); - analyzeOptions.jsxFragmentName = fragFactory; - log( - 'Resolved jsxFragmentName from program: %s', - analyzeOptions.jsxFragmentName, - ); - } + if ( + analyzeOptions.jsxPragma === undefined && + compilerOptions.jsxFactory != null + ) { + // in case the user has specified something like "preact.h" + const factory = compilerOptions.jsxFactory.split('.')[0].trim(); + analyzeOptions.jsxPragma = factory; + log('Resolved jsxPragma from program: %s', analyzeOptions.jsxPragma); + } + if ( + analyzeOptions.jsxFragmentName === undefined && + compilerOptions.jsxFragmentFactory != null + ) { + // in case the user has specified something like "preact.Fragment" + const fragFactory = compilerOptions.jsxFragmentFactory + .split('.')[0] + .trim(); + analyzeOptions.jsxFragmentName = fragFactory; + log( + 'Resolved jsxFragmentName from program: %s', + analyzeOptions.jsxFragmentName, + ); } if (compilerOptions.emitDecoratorMetadata === true) { emitDecoratorMetadata = true; diff --git a/packages/parser/tsconfig.build.json b/packages/parser/tsconfig.build.json index 8556d030722..4a72f7a3d46 100644 --- a/packages/parser/tsconfig.build.json +++ b/packages/parser/tsconfig.build.json @@ -8,7 +8,6 @@ }, "include": ["src"], "references": [ - { "path": "../utils/tsconfig.build.json" }, { "path": "../scope-manager/tsconfig.build.json" }, { "path": "../types/tsconfig.build.json" }, { "path": "../typescript-estree/tsconfig.build.json" } diff --git a/packages/parser/tsconfig.json b/packages/parser/tsconfig.json index ae4f11eded6..eebdf92705d 100644 --- a/packages/parser/tsconfig.json +++ b/packages/parser/tsconfig.json @@ -7,7 +7,6 @@ "include": ["src", "tests", "tools"], "exclude": ["tests/fixtures"], "references": [ - { "path": "../utils/tsconfig.build.json" }, { "path": "../scope-manager/tsconfig.build.json" }, { "path": "../types/tsconfig.build.json" }, { "path": "../typescript-estree/tsconfig.build.json" } diff --git a/packages/scope-manager/CHANGELOG.md b/packages/scope-manager/CHANGELOG.md index 9ad9a8a1253..7af02624853 100644 --- a/packages/scope-manager/CHANGELOG.md +++ b/packages/scope-manager/CHANGELOG.md @@ -3,1173 +3,682 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -# [5.39.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.1...v5.39.0) (2022-10-03) +## [5.46.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.46.0...v5.46.1) (2022-12-12) **Note:** Version bump only for package @typescript-eslint/scope-manager +# [5.46.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.45.1...v5.46.0) (2022-12-08) +**Note:** Version bump only for package @typescript-eslint/scope-manager - - -## [5.38.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.0...v5.38.1) (2022-09-26) +## [5.45.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.45.0...v5.45.1) (2022-12-05) **Note:** Version bump only for package @typescript-eslint/scope-manager +# [5.45.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.44.0...v5.45.0) (2022-11-28) +### Bug Fixes +- **scope-manager:** add support for TS4.9 satisfies expression ([#6059](https://github.com/typescript-eslint/typescript-eslint/issues/6059)) ([44027db](https://github.com/typescript-eslint/typescript-eslint/commit/44027db379e6e074a16cda2755ef554c2b0a4c5a)) +### Features -# [5.38.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.37.0...v5.38.0) (2022-09-19) +- support Auto Accessor syntax ([#5926](https://github.com/typescript-eslint/typescript-eslint/issues/5926)) ([becd1f8](https://github.com/typescript-eslint/typescript-eslint/commit/becd1f8581c0013399dfe71be6c265e96cedb57a)) -**Note:** Version bump only for package @typescript-eslint/scope-manager +# [5.44.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.43.0...v5.44.0) (2022-11-21) +### Features +- update to TypeScript 4.9 ([#5716](https://github.com/typescript-eslint/typescript-eslint/issues/5716)) ([4d744ea](https://github.com/typescript-eslint/typescript-eslint/commit/4d744ea10ba03c66eebcb63e8722e9f0165fbeed)) +# [5.43.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.1...v5.43.0) (2022-11-14) +**Note:** Version bump only for package @typescript-eslint/scope-manager -# [5.37.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.2...v5.37.0) (2022-09-12) +## [5.42.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.0...v5.42.1) (2022-11-07) **Note:** Version bump only for package @typescript-eslint/scope-manager +# [5.42.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.41.0...v5.42.0) (2022-10-31) +### Features +- **scope-manager:** ignore ECMA version ([#5881](https://github.com/typescript-eslint/typescript-eslint/issues/5881)) ([3b8d449](https://github.com/typescript-eslint/typescript-eslint/commit/3b8d449696c319690536a18a48ef32749dc2f559)) +### Reverts -## [5.36.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.1...v5.36.2) (2022-09-05) +- Revert "feat(scope-manager): ignore ECMA version" (#5888) ([2ee81df](https://github.com/typescript-eslint/typescript-eslint/commit/2ee81df5a365d82ef4b3dfc124d4ec39c7bcb725)), closes [#5888](https://github.com/typescript-eslint/typescript-eslint/issues/5888) [#5881](https://github.com/typescript-eslint/typescript-eslint/issues/5881) +# [5.41.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.1...v5.41.0) (2022-10-24) -### Bug Fixes +**Note:** Version bump only for package @typescript-eslint/scope-manager -* **scope-manager:** correct handling for class static blocks ([#5580](https://github.com/typescript-eslint/typescript-eslint/issues/5580)) ([35bb8dd](https://github.com/typescript-eslint/typescript-eslint/commit/35bb8ddac1b46397f6447c1a6e1e4e1774dd7957)) +## [5.40.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.0...v5.40.1) (2022-10-17) +**Note:** Version bump only for package @typescript-eslint/scope-manager +# [5.40.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.39.0...v5.40.0) (2022-10-10) +**Note:** Version bump only for package @typescript-eslint/scope-manager +# [5.39.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.1...v5.39.0) (2022-10-03) -## [5.36.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.0...v5.36.1) (2022-08-30) +**Note:** Version bump only for package @typescript-eslint/scope-manager + +## [5.38.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.0...v5.38.1) (2022-09-26) **Note:** Version bump only for package @typescript-eslint/scope-manager +# [5.38.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.37.0...v5.38.0) (2022-09-19) +**Note:** Version bump only for package @typescript-eslint/scope-manager +# [5.37.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.2...v5.37.0) (2022-09-12) +**Note:** Version bump only for package @typescript-eslint/scope-manager -# [5.36.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.1...v5.36.0) (2022-08-30) +## [5.36.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.1...v5.36.2) (2022-09-05) +### Bug Fixes -### Features +- **scope-manager:** correct handling for class static blocks ([#5580](https://github.com/typescript-eslint/typescript-eslint/issues/5580)) ([35bb8dd](https://github.com/typescript-eslint/typescript-eslint/commit/35bb8ddac1b46397f6447c1a6e1e4e1774dd7957)) -* support TypeScript 4.8 ([#5551](https://github.com/typescript-eslint/typescript-eslint/issues/5551)) ([81450ed](https://github.com/typescript-eslint/typescript-eslint/commit/81450ed7eaede74b384e9a91a84e9b4d34513866)) +## [5.36.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.0...v5.36.1) (2022-08-30) +**Note:** Version bump only for package @typescript-eslint/scope-manager +# [5.36.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.1...v5.36.0) (2022-08-30) +### Features +- support TypeScript 4.8 ([#5551](https://github.com/typescript-eslint/typescript-eslint/issues/5551)) ([81450ed](https://github.com/typescript-eslint/typescript-eslint/commit/81450ed7eaede74b384e9a91a84e9b4d34513866)) ## [5.35.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.0...v5.35.1) (2022-08-24) **Note:** Version bump only for package @typescript-eslint/scope-manager +# [5.35.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.34.0...v5.35.0) (2022-08-24) +**Note:** Version bump only for package @typescript-eslint/scope-manager +# [5.34.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.1...v5.34.0) (2022-08-22) +### Bug Fixes -# [5.35.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.34.0...v5.35.0) (2022-08-24) +- **scope-manager:** visit static blocks ([#5489](https://github.com/typescript-eslint/typescript-eslint/issues/5489)) ([78745c2](https://github.com/typescript-eslint/typescript-eslint/commit/78745c2092064446837b5683892001030a8bb4e2)) -**Note:** Version bump only for package @typescript-eslint/scope-manager +## [5.33.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.0...v5.33.1) (2022-08-15) +**Note:** Version bump only for package @typescript-eslint/scope-manager +# [5.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.32.0...v5.33.0) (2022-08-08) +**Note:** Version bump only for package @typescript-eslint/scope-manager +# [5.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.31.0...v5.32.0) (2022-08-01) -# [5.34.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.1...v5.34.0) (2022-08-22) +**Note:** Version bump only for package @typescript-eslint/scope-manager +# [5.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.7...v5.31.0) (2022-07-25) ### Bug Fixes -* **scope-manager:** visit static blocks ([#5489](https://github.com/typescript-eslint/typescript-eslint/issues/5489)) ([78745c2](https://github.com/typescript-eslint/typescript-eslint/commit/78745c2092064446837b5683892001030a8bb4e2)) - +- **scope-manager:** handle typeParameters of TSInstantiationExpression ([#5355](https://github.com/typescript-eslint/typescript-eslint/issues/5355)) ([2595ccf](https://github.com/typescript-eslint/typescript-eslint/commit/2595ccf67cd5158edbd6bebd9ac2dbd8bbd8b99c)) +## [5.30.7](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.6...v5.30.7) (2022-07-18) +### Bug Fixes +- **scope-manager:** allow visiting of constraint in infer type ([#5331](https://github.com/typescript-eslint/typescript-eslint/issues/5331)) ([b2846a1](https://github.com/typescript-eslint/typescript-eslint/commit/b2846a16777a3aea7b1e6ac9d81b9b6dce0bb874)) -## [5.33.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.0...v5.33.1) (2022-08-15) +## [5.30.6](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.5...v5.30.6) (2022-07-11) **Note:** Version bump only for package @typescript-eslint/scope-manager +## [5.30.5](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.4...v5.30.5) (2022-07-04) +**Note:** Version bump only for package @typescript-eslint/scope-manager - - -# [5.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.32.0...v5.33.0) (2022-08-08) +## [5.30.4](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.3...v5.30.4) (2022-07-03) **Note:** Version bump only for package @typescript-eslint/scope-manager +## [5.30.3](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.2...v5.30.3) (2022-07-01) +**Note:** Version bump only for package @typescript-eslint/scope-manager +## [5.30.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.1...v5.30.2) (2022-07-01) +**Note:** Version bump only for package @typescript-eslint/scope-manager -# [5.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.31.0...v5.32.0) (2022-08-01) +## 5.30.1 (2022-07-01) **Note:** Version bump only for package @typescript-eslint/scope-manager +# [5.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.29.0...v5.30.0) (2022-06-27) +### Features +- treat `this` in `typeof this` as a `ThisExpression` ([#4382](https://github.com/typescript-eslint/typescript-eslint/issues/4382)) ([b04b2ce](https://github.com/typescript-eslint/typescript-eslint/commit/b04b2ce1ba90d94718891f2562dd210a6d7b8609)) +# [5.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.28.0...v5.29.0) (2022-06-20) -# [5.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.7...v5.31.0) (2022-07-25) +**Note:** Version bump only for package @typescript-eslint/scope-manager +# [5.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.1...v5.28.0) (2022-06-13) ### Bug Fixes -* **scope-manager:** handle typeParameters of TSInstantiationExpression ([#5355](https://github.com/typescript-eslint/typescript-eslint/issues/5355)) ([2595ccf](https://github.com/typescript-eslint/typescript-eslint/commit/2595ccf67cd5158edbd6bebd9ac2dbd8bbd8b99c)) +- [TS4.7] allow visiting of typeParameters in TSTypeQuery ([#5166](https://github.com/typescript-eslint/typescript-eslint/issues/5166)) ([dc1f930](https://github.com/typescript-eslint/typescript-eslint/commit/dc1f9309cf04aa7314e758980ac687558482f47f)) +## [5.27.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.0...v5.27.1) (2022-06-06) +**Note:** Version bump only for package @typescript-eslint/scope-manager +# [5.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.26.0...v5.27.0) (2022-05-30) +### Features -## [5.30.7](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.6...v5.30.7) (2022-07-18) +- [4.7] support new extensions ([#5027](https://github.com/typescript-eslint/typescript-eslint/issues/5027)) ([efc147b](https://github.com/typescript-eslint/typescript-eslint/commit/efc147b04dce52ab17415b6a4ae4076b944b9036)) +# [5.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.25.0...v5.26.0) (2022-05-23) -### Bug Fixes +**Note:** Version bump only for package @typescript-eslint/scope-manager -* **scope-manager:** allow visiting of constraint in infer type ([#5331](https://github.com/typescript-eslint/typescript-eslint/issues/5331)) ([b2846a1](https://github.com/typescript-eslint/typescript-eslint/commit/b2846a16777a3aea7b1e6ac9d81b9b6dce0bb874)) +# [5.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.24.0...v5.25.0) (2022-05-17) + +### Features +- update to TypeScript 4.7-rc ([#4829](https://github.com/typescript-eslint/typescript-eslint/issues/4829)) ([6fe783c](https://github.com/typescript-eslint/typescript-eslint/commit/6fe783c20aebe26ef42b526e4a59a9be84dd5643)) +# [5.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.23.0...v5.24.0) (2022-05-16) +### Features +- **eslint-plugin:** add new 'strict' config ([#4706](https://github.com/typescript-eslint/typescript-eslint/issues/4706)) ([4a500b2](https://github.com/typescript-eslint/typescript-eslint/commit/4a500b2d92a91873dbb729793d1ee1c36ef06ed8)) -## [5.30.6](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.5...v5.30.6) (2022-07-11) +# [5.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.22.0...v5.23.0) (2022-05-09) **Note:** Version bump only for package @typescript-eslint/scope-manager +# [5.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.21.0...v5.22.0) (2022-05-02) +### Features +- **ast-spec:** add fixture test framework and some initial fixtures ([#3258](https://github.com/typescript-eslint/typescript-eslint/issues/3258)) ([f3cf87b](https://github.com/typescript-eslint/typescript-eslint/commit/f3cf87bf20fd0542f92a96a318aa9ee5bf23c1f6)) - -## [5.30.5](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.4...v5.30.5) (2022-07-04) +# [5.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.20.0...v5.21.0) (2022-04-25) **Note:** Version bump only for package @typescript-eslint/scope-manager +# [5.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.19.0...v5.20.0) (2022-04-18) +**Note:** Version bump only for package @typescript-eslint/scope-manager +# [5.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.18.0...v5.19.0) (2022-04-11) +**Note:** Version bump only for package @typescript-eslint/scope-manager -## [5.30.4](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.3...v5.30.4) (2022-07-03) +# [5.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.17.0...v5.18.0) (2022-04-04) **Note:** Version bump only for package @typescript-eslint/scope-manager +# [5.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.16.0...v5.17.0) (2022-03-28) +**Note:** Version bump only for package @typescript-eslint/scope-manager +# [5.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.15.0...v5.16.0) (2022-03-21) +### Bug Fixes -## [5.30.3](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.2...v5.30.3) (2022-07-01) +- **scope-manager:** incorrect reference for this within a jsx identifier ([#4535](https://github.com/typescript-eslint/typescript-eslint/issues/4535)) ([dd49280](https://github.com/typescript-eslint/typescript-eslint/commit/dd49280e50cb2f5bd26dc07210551bc1fda120af)) -**Note:** Version bump only for package @typescript-eslint/scope-manager +# [5.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.14.0...v5.15.0) (2022-03-14) +**Note:** Version bump only for package @typescript-eslint/scope-manager +# [5.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.13.0...v5.14.0) (2022-03-07) +### Features +- TypeScript 4.6 ([#4615](https://github.com/typescript-eslint/typescript-eslint/issues/4615)) ([a02c63a](https://github.com/typescript-eslint/typescript-eslint/commit/a02c63a264e5a6c3557468a8eff48d34ca2b718a)) -## [5.30.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.1...v5.30.2) (2022-07-01) +# [5.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.1...v5.13.0) (2022-02-28) **Note:** Version bump only for package @typescript-eslint/scope-manager +## [5.12.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.0...v5.12.1) (2022-02-21) +**Note:** Version bump only for package @typescript-eslint/scope-manager +# [5.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.11.0...v5.12.0) (2022-02-14) +**Note:** Version bump only for package @typescript-eslint/scope-manager -## 5.30.1 (2022-07-01) +# [5.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.2...v5.11.0) (2022-02-07) **Note:** Version bump only for package @typescript-eslint/scope-manager +## [5.10.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.1...v5.10.2) (2022-01-31) +**Note:** Version bump only for package @typescript-eslint/scope-manager +## [5.10.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.0...v5.10.1) (2022-01-24) +**Note:** Version bump only for package @typescript-eslint/scope-manager -# [5.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.29.0...v5.30.0) (2022-06-27) +# [5.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.1...v5.10.0) (2022-01-17) +**Note:** Version bump only for package @typescript-eslint/scope-manager -### Features +## [5.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.0...v5.9.1) (2022-01-10) -* treat `this` in `typeof this` as a `ThisExpression` ([#4382](https://github.com/typescript-eslint/typescript-eslint/issues/4382)) ([b04b2ce](https://github.com/typescript-eslint/typescript-eslint/commit/b04b2ce1ba90d94718891f2562dd210a6d7b8609)) +**Note:** Version bump only for package @typescript-eslint/scope-manager +# [5.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.1...v5.9.0) (2022-01-03) +**Note:** Version bump only for package @typescript-eslint/scope-manager +## [5.8.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.0...v5.8.1) (2021-12-27) +**Note:** Version bump only for package @typescript-eslint/scope-manager -# [5.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.28.0...v5.29.0) (2022-06-20) +# [5.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.7.0...v5.8.0) (2021-12-20) **Note:** Version bump only for package @typescript-eslint/scope-manager +# [5.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.6.0...v5.7.0) (2021-12-13) +**Note:** Version bump only for package @typescript-eslint/scope-manager +# [5.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.5.0...v5.6.0) (2021-12-06) +### Features -# [5.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.1...v5.28.0) (2022-06-13) +- **scope-manager:** support TS4.5 import/export specifier kind ([#4234](https://github.com/typescript-eslint/typescript-eslint/issues/4234)) ([833f822](https://github.com/typescript-eslint/typescript-eslint/commit/833f8221ce00aecb7d08c519bab9568353850f48)) +- **scope-manager:** update lib types ([#4240](https://github.com/typescript-eslint/typescript-eslint/issues/4240)) ([8377e6e](https://github.com/typescript-eslint/typescript-eslint/commit/8377e6ea422ee2d52455da8955ff055e09c238d3)) +# [5.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.4.0...v5.5.0) (2021-11-29) ### Bug Fixes -* [TS4.7] allow visiting of typeParameters in TSTypeQuery ([#5166](https://github.com/typescript-eslint/typescript-eslint/issues/5166)) ([dc1f930](https://github.com/typescript-eslint/typescript-eslint/commit/dc1f9309cf04aa7314e758980ac687558482f47f)) +- **scope-manager:** support static class blocks ([#4211](https://github.com/typescript-eslint/typescript-eslint/issues/4211)) ([f8e9125](https://github.com/typescript-eslint/typescript-eslint/commit/f8e91256e0a721aaa906a5c40a92784da9433b53)) + +# [5.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.3.1...v5.4.0) (2021-11-15) +### Bug Fixes +- correct issues with circular imports ([#4140](https://github.com/typescript-eslint/typescript-eslint/issues/4140)) ([4c87b24](https://github.com/typescript-eslint/typescript-eslint/commit/4c87b2486a9c90794d972a4d093c1dc22ffb418b)) +### Features +- **typescript-estree:** support Import Assertions ([#4074](https://github.com/typescript-eslint/typescript-eslint/issues/4074)) ([ae0fb5a](https://github.com/typescript-eslint/typescript-eslint/commit/ae0fb5a591958216b7df656e66b1dfe464898167)) -## [5.27.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.0...v5.27.1) (2022-06-06) +## [5.3.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.3.0...v5.3.1) (2021-11-08) **Note:** Version bump only for package @typescript-eslint/scope-manager +# [5.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.2.0...v5.3.0) (2021-11-01) + +**Note:** Version bump only for package @typescript-eslint/scope-manager +# [5.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.1.0...v5.2.0) (2021-10-25) +**Note:** Version bump only for package @typescript-eslint/scope-manager +# [5.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.0.0...v5.1.0) (2021-10-18) -# [5.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.26.0...v5.27.0) (2022-05-30) +**Note:** Version bump only for package @typescript-eslint/scope-manager +# [5.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.33.0...v5.0.0) (2021-10-11) ### Features -* [4.7] support new extensions ([#5027](https://github.com/typescript-eslint/typescript-eslint/issues/5027)) ([efc147b](https://github.com/typescript-eslint/typescript-eslint/commit/efc147b04dce52ab17415b6a4ae4076b944b9036)) +- align class property representation with ESTree ([#3806](https://github.com/typescript-eslint/typescript-eslint/issues/3806)) ([22fa5c0](https://github.com/typescript-eslint/typescript-eslint/commit/22fa5c0c4705ed2898f00b7cacc5dd642d859275)), closes [#3430](https://github.com/typescript-eslint/typescript-eslint/issues/3430) [#3077](https://github.com/typescript-eslint/typescript-eslint/issues/3077) +- support `PrivateIdentifier` ([#3808](https://github.com/typescript-eslint/typescript-eslint/issues/3808)) ([0eefe5e](https://github.com/typescript-eslint/typescript-eslint/commit/0eefe5e49d21af3f1e3e2d9a90c2e49929863ac2)), closes [#3430](https://github.com/typescript-eslint/typescript-eslint/issues/3430) [#2933](https://github.com/typescript-eslint/typescript-eslint/issues/2933) +- **eslint-plugin:** removed value from abstract property nodes ([#3765](https://github.com/typescript-eslint/typescript-eslint/issues/3765)) ([5823524](https://github.com/typescript-eslint/typescript-eslint/commit/58235241714596b641a1e8b39c569e561e0039b4)), closes [#3748](https://github.com/typescript-eslint/typescript-eslint/issues/3748) +# [4.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.32.0...v4.33.0) (2021-10-04) +**Note:** Version bump only for package @typescript-eslint/scope-manager +# [4.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.2...v4.32.0) (2021-09-27) +### Features -# [5.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.25.0...v5.26.0) (2022-05-23) +- **eslint-plugin-internal:** [prefer-ast-types-enum] add `DefinitionType` enum ([#3916](https://github.com/typescript-eslint/typescript-eslint/issues/3916)) ([13b7de5](https://github.com/typescript-eslint/typescript-eslint/commit/13b7de508e0f8eac492879ff9ab99acd8d3e977e)) +- Support `'latest'` as `ecmaVersion` ([#3873](https://github.com/typescript-eslint/typescript-eslint/issues/3873)) ([25a42c0](https://github.com/typescript-eslint/typescript-eslint/commit/25a42c0bbe92d1ecbc2e8ff9ef3a3ef413f728b0)) -**Note:** Version bump only for package @typescript-eslint/scope-manager +## [4.31.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.1...v4.31.2) (2021-09-20) +**Note:** Version bump only for package @typescript-eslint/scope-manager +## [4.31.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.0...v4.31.1) (2021-09-13) +**Note:** Version bump only for package @typescript-eslint/scope-manager +# [4.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.30.0...v4.31.0) (2021-09-06) -# [5.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.24.0...v5.25.0) (2022-05-17) +**Note:** Version bump only for package @typescript-eslint/scope-manager +# [4.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.3...v4.30.0) (2021-08-30) ### Features -* update to TypeScript 4.7-rc ([#4829](https://github.com/typescript-eslint/typescript-eslint/issues/4829)) ([6fe783c](https://github.com/typescript-eslint/typescript-eslint/commit/6fe783c20aebe26ef42b526e4a59a9be84dd5643)) +- **typescript-estree:** add support for class static blocks ([#3730](https://github.com/typescript-eslint/typescript-eslint/issues/3730)) ([f81831b](https://github.com/typescript-eslint/typescript-eslint/commit/f81831bd279a32da6dbab0f1c061053ea43965f6)) + +## [4.29.3](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.2...v4.29.3) (2021-08-23) +**Note:** Version bump only for package @typescript-eslint/scope-manager +## [4.29.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.1...v4.29.2) (2021-08-16) +**Note:** Version bump only for package @typescript-eslint/scope-manager +## [4.29.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.0...v4.29.1) (2021-08-09) -# [5.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.23.0...v5.24.0) (2022-05-16) +**Note:** Version bump only for package @typescript-eslint/scope-manager +# [4.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.5...v4.29.0) (2021-08-02) ### Features -* **eslint-plugin:** add new 'strict' config ([#4706](https://github.com/typescript-eslint/typescript-eslint/issues/4706)) ([4a500b2](https://github.com/typescript-eslint/typescript-eslint/commit/4a500b2d92a91873dbb729793d1ee1c36ef06ed8)) +- **eslint-plugin:** Catch unused React import with new JSX transform ([#3577](https://github.com/typescript-eslint/typescript-eslint/issues/3577)) ([02998ea](https://github.com/typescript-eslint/typescript-eslint/commit/02998eac510665758b9a093d43afc310f3ac980d)) +## [4.28.5](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.4...v4.28.5) (2021-07-26) +**Note:** Version bump only for package @typescript-eslint/scope-manager +## [4.28.4](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.3...v4.28.4) (2021-07-19) +**Note:** Version bump only for package @typescript-eslint/scope-manager -# [5.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.22.0...v5.23.0) (2022-05-09) +## [4.28.3](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.2...v4.28.3) (2021-07-12) **Note:** Version bump only for package @typescript-eslint/scope-manager +## [4.28.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.1...v4.28.2) (2021-07-05) +**Note:** Version bump only for package @typescript-eslint/scope-manager +## [4.28.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.0...v4.28.1) (2021-06-28) +**Note:** Version bump only for package @typescript-eslint/scope-manager -# [5.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.21.0...v5.22.0) (2022-05-02) - +# [4.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.27.0...v4.28.0) (2021-06-21) -### Features +**Note:** Version bump only for package @typescript-eslint/scope-manager -* **ast-spec:** add fixture test framework and some initial fixtures ([#3258](https://github.com/typescript-eslint/typescript-eslint/issues/3258)) ([f3cf87b](https://github.com/typescript-eslint/typescript-eslint/commit/f3cf87bf20fd0542f92a96a318aa9ee5bf23c1f6)) +# [4.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.1...v4.27.0) (2021-06-14) +**Note:** Version bump only for package @typescript-eslint/scope-manager +## [4.26.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.0...v4.26.1) (2021-06-07) +**Note:** Version bump only for package @typescript-eslint/scope-manager +# [4.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.25.0...v4.26.0) (2021-05-31) -# [5.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.20.0...v5.21.0) (2022-04-25) +### Bug Fixes -**Note:** Version bump only for package @typescript-eslint/scope-manager +- generate library types for TypeScript v4.3 ([#3460](https://github.com/typescript-eslint/typescript-eslint/issues/3460)) ([ed4776a](https://github.com/typescript-eslint/typescript-eslint/commit/ed4776afa1374279027b9b7d82aa4b453b334998)), closes [#3449](https://github.com/typescript-eslint/typescript-eslint/issues/3449) +### Features +- **scope-manager:** reduce generated lib file size ([#3468](https://github.com/typescript-eslint/typescript-eslint/issues/3468)) ([258116b](https://github.com/typescript-eslint/typescript-eslint/commit/258116ba7b0dd4ac7a1cc3876fab12f2556bda74)) +# [4.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.24.0...v4.25.0) (2021-05-24) +**Note:** Version bump only for package @typescript-eslint/scope-manager -# [5.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.19.0...v5.20.0) (2022-04-18) +# [4.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.23.0...v4.24.0) (2021-05-17) **Note:** Version bump only for package @typescript-eslint/scope-manager +# [4.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.1...v4.23.0) (2021-05-10) +### Bug Fixes +- **scope-manager:** fix visiting TSAsExpression in assignment ([#3355](https://github.com/typescript-eslint/typescript-eslint/issues/3355)) ([87521a0](https://github.com/typescript-eslint/typescript-eslint/commit/87521a024103bc5fc643861649bee9a288f55b7b)) +### Features -# [5.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.18.0...v5.19.0) (2022-04-11) +- refactor to split AST specification out as its own module ([#2911](https://github.com/typescript-eslint/typescript-eslint/issues/2911)) ([25ea953](https://github.com/typescript-eslint/typescript-eslint/commit/25ea953cc60b118bd385c71e0a9b61c286c26fcf)) + +## [4.22.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.0...v4.22.1) (2021-05-04) **Note:** Version bump only for package @typescript-eslint/scope-manager +# [4.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.21.0...v4.22.0) (2021-04-12) +**Note:** Version bump only for package @typescript-eslint/scope-manager +# [4.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.20.0...v4.21.0) (2021-04-05) +**Note:** Version bump only for package @typescript-eslint/scope-manager -# [5.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.17.0...v5.18.0) (2022-04-04) +# [4.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.19.0...v4.20.0) (2021-03-29) **Note:** Version bump only for package @typescript-eslint/scope-manager +# [4.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.18.0...v4.19.0) (2021-03-22) +**Note:** Version bump only for package @typescript-eslint/scope-manager +# [4.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.17.0...v4.18.0) (2021-03-15) +**Note:** Version bump only for package @typescript-eslint/scope-manager -# [5.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.16.0...v5.17.0) (2022-03-28) +# [4.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.16.1...v4.17.0) (2021-03-08) **Note:** Version bump only for package @typescript-eslint/scope-manager +## [4.16.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.16.0...v4.16.1) (2021-03-01) +**Note:** Version bump only for package @typescript-eslint/scope-manager +# [4.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.2...v4.16.0) (2021-03-01) +### Bug Fixes -# [5.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.15.0...v5.16.0) (2022-03-21) - +- **scope-manager:** update libs for typescript 4.2 ([#3118](https://github.com/typescript-eslint/typescript-eslint/issues/3118)) ([0336c79](https://github.com/typescript-eslint/typescript-eslint/commit/0336c798c9502fc250d2eaa045661950da55e52f)) -### Bug Fixes +## [4.15.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.1...v4.15.2) (2021-02-22) -* **scope-manager:** incorrect reference for this within a jsx identifier ([#4535](https://github.com/typescript-eslint/typescript-eslint/issues/4535)) ([dd49280](https://github.com/typescript-eslint/typescript-eslint/commit/dd49280e50cb2f5bd26dc07210551bc1fda120af)) +**Note:** Version bump only for package @typescript-eslint/scope-manager +## [4.15.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.0...v4.15.1) (2021-02-15) +**Note:** Version bump only for package @typescript-eslint/scope-manager +# [4.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.2...v4.15.0) (2021-02-08) +### Bug Fixes -# [5.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.14.0...v5.15.0) (2022-03-14) +- **scope-manager:** fix visiting of TSImportType ([#3008](https://github.com/typescript-eslint/typescript-eslint/issues/3008)) ([ce4fcbf](https://github.com/typescript-eslint/typescript-eslint/commit/ce4fcbf4401098387a2cf19ae8457c89c509239a)), closes [#3006](https://github.com/typescript-eslint/typescript-eslint/issues/3006) -**Note:** Version bump only for package @typescript-eslint/scope-manager +## [4.14.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.1...v4.14.2) (2021-02-01) +### Bug Fixes +- **scope-manager:** correctly reference generic parameters when decorator metadata is enabled ([#2975](https://github.com/typescript-eslint/typescript-eslint/issues/2975)) ([7695ef3](https://github.com/typescript-eslint/typescript-eslint/commit/7695ef318f1cc8688acaabf4f2730769622f083f)), closes [#2972](https://github.com/typescript-eslint/typescript-eslint/issues/2972) +## [4.14.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.0...v4.14.1) (2021-01-25) +### Bug Fixes -# [5.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.13.0...v5.14.0) (2022-03-07) +- **scope-manager:** fix incorrect handling of class decorators and class method default params ([#2943](https://github.com/typescript-eslint/typescript-eslint/issues/2943)) ([e1eac83](https://github.com/typescript-eslint/typescript-eslint/commit/e1eac8312268d1855a2ed7784b4d190ecb9c9fa4)), closes [#2941](https://github.com/typescript-eslint/typescript-eslint/issues/2941) [#2942](https://github.com/typescript-eslint/typescript-eslint/issues/2942) [#2751](https://github.com/typescript-eslint/typescript-eslint/issues/2751) +# [4.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.13.0...v4.14.0) (2021-01-18) ### Features -* TypeScript 4.6 ([#4615](https://github.com/typescript-eslint/typescript-eslint/issues/4615)) ([a02c63a](https://github.com/typescript-eslint/typescript-eslint/commit/a02c63a264e5a6c3557468a8eff48d34ca2b718a)) +- add support for decorator metadata in scope analysis and in consistent-type-imports ([#2751](https://github.com/typescript-eslint/typescript-eslint/issues/2751)) ([445e416](https://github.com/typescript-eslint/typescript-eslint/commit/445e416878b27a54bf07c2d3b84dabd7b06e51bc)), closes [#2559](https://github.com/typescript-eslint/typescript-eslint/issues/2559) +# [4.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.12.0...v4.13.0) (2021-01-11) +**Note:** Version bump only for package @typescript-eslint/scope-manager +# [4.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.11.1...v4.12.0) (2021-01-04) +**Note:** Version bump only for package @typescript-eslint/scope-manager -# [5.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.1...v5.13.0) (2022-02-28) +## [4.11.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.11.0...v4.11.1) (2020-12-28) **Note:** Version bump only for package @typescript-eslint/scope-manager +# [4.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.10.0...v4.11.0) (2020-12-21) +**Note:** Version bump only for package @typescript-eslint/scope-manager +# [4.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.9.1...v4.10.0) (2020-12-14) +**Note:** Version bump only for package @typescript-eslint/scope-manager -## [5.12.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.0...v5.12.1) (2022-02-21) +## [4.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.9.0...v4.9.1) (2020-12-07) **Note:** Version bump only for package @typescript-eslint/scope-manager - - - - -# [5.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.11.0...v5.12.0) (2022-02-14) - -**Note:** Version bump only for package @typescript-eslint/scope-manager - - - - - -# [5.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.2...v5.11.0) (2022-02-07) - -**Note:** Version bump only for package @typescript-eslint/scope-manager - - - - - -## [5.10.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.1...v5.10.2) (2022-01-31) - -**Note:** Version bump only for package @typescript-eslint/scope-manager - - - - - -## [5.10.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.0...v5.10.1) (2022-01-24) - -**Note:** Version bump only for package @typescript-eslint/scope-manager - - - - - -# [5.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.1...v5.10.0) (2022-01-17) - -**Note:** Version bump only for package @typescript-eslint/scope-manager - - - - - -## [5.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.0...v5.9.1) (2022-01-10) - -**Note:** Version bump only for package @typescript-eslint/scope-manager - - - - - -# [5.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.1...v5.9.0) (2022-01-03) - -**Note:** Version bump only for package @typescript-eslint/scope-manager - - - - - -## [5.8.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.0...v5.8.1) (2021-12-27) - -**Note:** Version bump only for package @typescript-eslint/scope-manager - - - - - -# [5.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.7.0...v5.8.0) (2021-12-20) - -**Note:** Version bump only for package @typescript-eslint/scope-manager - - - - - -# [5.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.6.0...v5.7.0) (2021-12-13) - -**Note:** Version bump only for package @typescript-eslint/scope-manager - - - - - -# [5.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.5.0...v5.6.0) (2021-12-06) - - -### Features - -* **scope-manager:** support TS4.5 import/export specifier kind ([#4234](https://github.com/typescript-eslint/typescript-eslint/issues/4234)) ([833f822](https://github.com/typescript-eslint/typescript-eslint/commit/833f8221ce00aecb7d08c519bab9568353850f48)) -* **scope-manager:** update lib types ([#4240](https://github.com/typescript-eslint/typescript-eslint/issues/4240)) ([8377e6e](https://github.com/typescript-eslint/typescript-eslint/commit/8377e6ea422ee2d52455da8955ff055e09c238d3)) - - - - - -# [5.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.4.0...v5.5.0) (2021-11-29) - - -### Bug Fixes - -* **scope-manager:** support static class blocks ([#4211](https://github.com/typescript-eslint/typescript-eslint/issues/4211)) ([f8e9125](https://github.com/typescript-eslint/typescript-eslint/commit/f8e91256e0a721aaa906a5c40a92784da9433b53)) - - - - - -# [5.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.3.1...v5.4.0) (2021-11-15) - - -### Bug Fixes - -* correct issues with circular imports ([#4140](https://github.com/typescript-eslint/typescript-eslint/issues/4140)) ([4c87b24](https://github.com/typescript-eslint/typescript-eslint/commit/4c87b2486a9c90794d972a4d093c1dc22ffb418b)) - - -### Features - -* **typescript-estree:** support Import Assertions ([#4074](https://github.com/typescript-eslint/typescript-eslint/issues/4074)) ([ae0fb5a](https://github.com/typescript-eslint/typescript-eslint/commit/ae0fb5a591958216b7df656e66b1dfe464898167)) - - - - - -## [5.3.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.3.0...v5.3.1) (2021-11-08) - -**Note:** Version bump only for package @typescript-eslint/scope-manager - - - - - -# [5.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.2.0...v5.3.0) (2021-11-01) - -**Note:** Version bump only for package @typescript-eslint/scope-manager - - - - - -# [5.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.1.0...v5.2.0) (2021-10-25) - -**Note:** Version bump only for package @typescript-eslint/scope-manager - - - - - -# [5.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.0.0...v5.1.0) (2021-10-18) - -**Note:** Version bump only for package @typescript-eslint/scope-manager - - - - - -# [5.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.33.0...v5.0.0) (2021-10-11) - - -### Features - -* align class property representation with ESTree ([#3806](https://github.com/typescript-eslint/typescript-eslint/issues/3806)) ([22fa5c0](https://github.com/typescript-eslint/typescript-eslint/commit/22fa5c0c4705ed2898f00b7cacc5dd642d859275)), closes [#3430](https://github.com/typescript-eslint/typescript-eslint/issues/3430) [#3077](https://github.com/typescript-eslint/typescript-eslint/issues/3077) -* support `PrivateIdentifier` ([#3808](https://github.com/typescript-eslint/typescript-eslint/issues/3808)) ([0eefe5e](https://github.com/typescript-eslint/typescript-eslint/commit/0eefe5e49d21af3f1e3e2d9a90c2e49929863ac2)), closes [#3430](https://github.com/typescript-eslint/typescript-eslint/issues/3430) [#2933](https://github.com/typescript-eslint/typescript-eslint/issues/2933) -* **eslint-plugin:** removed value from abstract property nodes ([#3765](https://github.com/typescript-eslint/typescript-eslint/issues/3765)) ([5823524](https://github.com/typescript-eslint/typescript-eslint/commit/58235241714596b641a1e8b39c569e561e0039b4)), closes [#3748](https://github.com/typescript-eslint/typescript-eslint/issues/3748) - - - - - -# [4.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.32.0...v4.33.0) (2021-10-04) - -**Note:** Version bump only for package @typescript-eslint/scope-manager - - - - - -# [4.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.2...v4.32.0) (2021-09-27) - - -### Features - -* **eslint-plugin-internal:** [prefer-ast-types-enum] add `DefinitionType` enum ([#3916](https://github.com/typescript-eslint/typescript-eslint/issues/3916)) ([13b7de5](https://github.com/typescript-eslint/typescript-eslint/commit/13b7de508e0f8eac492879ff9ab99acd8d3e977e)) -* Support `'latest'` as `ecmaVersion` ([#3873](https://github.com/typescript-eslint/typescript-eslint/issues/3873)) ([25a42c0](https://github.com/typescript-eslint/typescript-eslint/commit/25a42c0bbe92d1ecbc2e8ff9ef3a3ef413f728b0)) - - - - - -## [4.31.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.1...v4.31.2) (2021-09-20) - -**Note:** Version bump only for package @typescript-eslint/scope-manager - - - - - -## [4.31.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.0...v4.31.1) (2021-09-13) - -**Note:** Version bump only for package @typescript-eslint/scope-manager - - - - - -# [4.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.30.0...v4.31.0) (2021-09-06) - -**Note:** Version bump only for package @typescript-eslint/scope-manager - - - - - -# [4.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.3...v4.30.0) (2021-08-30) - - -### Features - -* **typescript-estree:** add support for class static blocks ([#3730](https://github.com/typescript-eslint/typescript-eslint/issues/3730)) ([f81831b](https://github.com/typescript-eslint/typescript-eslint/commit/f81831bd279a32da6dbab0f1c061053ea43965f6)) - - - - - -## [4.29.3](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.2...v4.29.3) (2021-08-23) - -**Note:** Version bump only for package @typescript-eslint/scope-manager - - - - - -## [4.29.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.1...v4.29.2) (2021-08-16) - -**Note:** Version bump only for package @typescript-eslint/scope-manager - - - - - -## [4.29.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.0...v4.29.1) (2021-08-09) - -**Note:** Version bump only for package @typescript-eslint/scope-manager - - - - - -# [4.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.5...v4.29.0) (2021-08-02) - - -### Features - -* **eslint-plugin:** Catch unused React import with new JSX transform ([#3577](https://github.com/typescript-eslint/typescript-eslint/issues/3577)) ([02998ea](https://github.com/typescript-eslint/typescript-eslint/commit/02998eac510665758b9a093d43afc310f3ac980d)) - - - - - -## [4.28.5](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.4...v4.28.5) (2021-07-26) - -**Note:** Version bump only for package @typescript-eslint/scope-manager - - - - - -## [4.28.4](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.3...v4.28.4) (2021-07-19) - -**Note:** Version bump only for package @typescript-eslint/scope-manager - - - - - -## [4.28.3](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.2...v4.28.3) (2021-07-12) - -**Note:** Version bump only for package @typescript-eslint/scope-manager - - - - - -## [4.28.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.1...v4.28.2) (2021-07-05) - -**Note:** Version bump only for package @typescript-eslint/scope-manager - - - - - -## [4.28.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.0...v4.28.1) (2021-06-28) - -**Note:** Version bump only for package @typescript-eslint/scope-manager - - - - - -# [4.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.27.0...v4.28.0) (2021-06-21) - -**Note:** Version bump only for package @typescript-eslint/scope-manager - - - - - -# [4.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.1...v4.27.0) (2021-06-14) - -**Note:** Version bump only for package @typescript-eslint/scope-manager - - - - - -## [4.26.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.0...v4.26.1) (2021-06-07) - -**Note:** Version bump only for package @typescript-eslint/scope-manager - - - - - -# [4.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.25.0...v4.26.0) (2021-05-31) - - -### Bug Fixes - -* generate library types for TypeScript v4.3 ([#3460](https://github.com/typescript-eslint/typescript-eslint/issues/3460)) ([ed4776a](https://github.com/typescript-eslint/typescript-eslint/commit/ed4776afa1374279027b9b7d82aa4b453b334998)), closes [#3449](https://github.com/typescript-eslint/typescript-eslint/issues/3449) - - -### Features - -* **scope-manager:** reduce generated lib file size ([#3468](https://github.com/typescript-eslint/typescript-eslint/issues/3468)) ([258116b](https://github.com/typescript-eslint/typescript-eslint/commit/258116ba7b0dd4ac7a1cc3876fab12f2556bda74)) - - - - - -# [4.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.24.0...v4.25.0) (2021-05-24) - -**Note:** Version bump only for package @typescript-eslint/scope-manager - - - - - -# [4.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.23.0...v4.24.0) (2021-05-17) - -**Note:** Version bump only for package @typescript-eslint/scope-manager - - - - - -# [4.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.1...v4.23.0) (2021-05-10) - - -### Bug Fixes - -* **scope-manager:** fix visiting TSAsExpression in assignment ([#3355](https://github.com/typescript-eslint/typescript-eslint/issues/3355)) ([87521a0](https://github.com/typescript-eslint/typescript-eslint/commit/87521a024103bc5fc643861649bee9a288f55b7b)) - - -### Features - -* refactor to split AST specification out as its own module ([#2911](https://github.com/typescript-eslint/typescript-eslint/issues/2911)) ([25ea953](https://github.com/typescript-eslint/typescript-eslint/commit/25ea953cc60b118bd385c71e0a9b61c286c26fcf)) - - - - - -## [4.22.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.0...v4.22.1) (2021-05-04) - -**Note:** Version bump only for package @typescript-eslint/scope-manager - - - - - -# [4.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.21.0...v4.22.0) (2021-04-12) - -**Note:** Version bump only for package @typescript-eslint/scope-manager - - - - - -# [4.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.20.0...v4.21.0) (2021-04-05) - -**Note:** Version bump only for package @typescript-eslint/scope-manager - - - - - -# [4.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.19.0...v4.20.0) (2021-03-29) - -**Note:** Version bump only for package @typescript-eslint/scope-manager - - - - - -# [4.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.18.0...v4.19.0) (2021-03-22) - -**Note:** Version bump only for package @typescript-eslint/scope-manager - - - - - -# [4.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.17.0...v4.18.0) (2021-03-15) - -**Note:** Version bump only for package @typescript-eslint/scope-manager - - - - - -# [4.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.16.1...v4.17.0) (2021-03-08) - -**Note:** Version bump only for package @typescript-eslint/scope-manager - - - - - -## [4.16.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.16.0...v4.16.1) (2021-03-01) - -**Note:** Version bump only for package @typescript-eslint/scope-manager - - - - - -# [4.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.2...v4.16.0) (2021-03-01) - - -### Bug Fixes - -* **scope-manager:** update libs for typescript 4.2 ([#3118](https://github.com/typescript-eslint/typescript-eslint/issues/3118)) ([0336c79](https://github.com/typescript-eslint/typescript-eslint/commit/0336c798c9502fc250d2eaa045661950da55e52f)) - - - - - -## [4.15.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.1...v4.15.2) (2021-02-22) - -**Note:** Version bump only for package @typescript-eslint/scope-manager - - - - - -## [4.15.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.0...v4.15.1) (2021-02-15) - -**Note:** Version bump only for package @typescript-eslint/scope-manager - - - - - -# [4.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.2...v4.15.0) (2021-02-08) - - -### Bug Fixes - -* **scope-manager:** fix visiting of TSImportType ([#3008](https://github.com/typescript-eslint/typescript-eslint/issues/3008)) ([ce4fcbf](https://github.com/typescript-eslint/typescript-eslint/commit/ce4fcbf4401098387a2cf19ae8457c89c509239a)), closes [#3006](https://github.com/typescript-eslint/typescript-eslint/issues/3006) - - - - - -## [4.14.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.1...v4.14.2) (2021-02-01) - - -### Bug Fixes - -* **scope-manager:** correctly reference generic parameters when decorator metadata is enabled ([#2975](https://github.com/typescript-eslint/typescript-eslint/issues/2975)) ([7695ef3](https://github.com/typescript-eslint/typescript-eslint/commit/7695ef318f1cc8688acaabf4f2730769622f083f)), closes [#2972](https://github.com/typescript-eslint/typescript-eslint/issues/2972) - - - - - -## [4.14.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.0...v4.14.1) (2021-01-25) - - -### Bug Fixes - -* **scope-manager:** fix incorrect handling of class decorators and class method default params ([#2943](https://github.com/typescript-eslint/typescript-eslint/issues/2943)) ([e1eac83](https://github.com/typescript-eslint/typescript-eslint/commit/e1eac8312268d1855a2ed7784b4d190ecb9c9fa4)), closes [#2941](https://github.com/typescript-eslint/typescript-eslint/issues/2941) [#2942](https://github.com/typescript-eslint/typescript-eslint/issues/2942) [#2751](https://github.com/typescript-eslint/typescript-eslint/issues/2751) - - - - - -# [4.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.13.0...v4.14.0) (2021-01-18) - - -### Features - -* add support for decorator metadata in scope analysis and in consistent-type-imports ([#2751](https://github.com/typescript-eslint/typescript-eslint/issues/2751)) ([445e416](https://github.com/typescript-eslint/typescript-eslint/commit/445e416878b27a54bf07c2d3b84dabd7b06e51bc)), closes [#2559](https://github.com/typescript-eslint/typescript-eslint/issues/2559) - - - - - -# [4.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.12.0...v4.13.0) (2021-01-11) - -**Note:** Version bump only for package @typescript-eslint/scope-manager - - - - - -# [4.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.11.1...v4.12.0) (2021-01-04) - -**Note:** Version bump only for package @typescript-eslint/scope-manager - - - - - -## [4.11.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.11.0...v4.11.1) (2020-12-28) - -**Note:** Version bump only for package @typescript-eslint/scope-manager - - - - - -# [4.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.10.0...v4.11.0) (2020-12-21) - -**Note:** Version bump only for package @typescript-eslint/scope-manager - - - - - -# [4.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.9.1...v4.10.0) (2020-12-14) - -**Note:** Version bump only for package @typescript-eslint/scope-manager - - - - - -## [4.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.9.0...v4.9.1) (2020-12-07) - -**Note:** Version bump only for package @typescript-eslint/scope-manager - - - - - -# [4.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.2...v4.9.0) (2020-11-30) - +# [4.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.2...v4.9.0) (2020-11-30) ### Bug Fixes -* **scope-manager:** fix assertion assignments not being marked as write references ([#2809](https://github.com/typescript-eslint/typescript-eslint/issues/2809)) ([fa68492](https://github.com/typescript-eslint/typescript-eslint/commit/fa6849245ca55ca407dc031afbad456f2925a8e9)), closes [#2804](https://github.com/typescript-eslint/typescript-eslint/issues/2804) - +- **scope-manager:** fix assertion assignments not being marked as write references ([#2809](https://github.com/typescript-eslint/typescript-eslint/issues/2809)) ([fa68492](https://github.com/typescript-eslint/typescript-eslint/commit/fa6849245ca55ca407dc031afbad456f2925a8e9)), closes [#2804](https://github.com/typescript-eslint/typescript-eslint/issues/2804) ### Features -* **eslint-plugin:** [no-unused-vars] fork the base rule ([#2768](https://github.com/typescript-eslint/typescript-eslint/issues/2768)) ([a8227a6](https://github.com/typescript-eslint/typescript-eslint/commit/a8227a6185dd24de4bfc7d766931643871155021)), closes [#2782](https://github.com/typescript-eslint/typescript-eslint/issues/2782) [#2714](https://github.com/typescript-eslint/typescript-eslint/issues/2714) [#2648](https://github.com/typescript-eslint/typescript-eslint/issues/2648) - - - - +- **eslint-plugin:** [no-unused-vars] fork the base rule ([#2768](https://github.com/typescript-eslint/typescript-eslint/issues/2768)) ([a8227a6](https://github.com/typescript-eslint/typescript-eslint/commit/a8227a6185dd24de4bfc7d766931643871155021)), closes [#2782](https://github.com/typescript-eslint/typescript-eslint/issues/2782) [#2714](https://github.com/typescript-eslint/typescript-eslint/issues/2714) [#2648](https://github.com/typescript-eslint/typescript-eslint/issues/2648) ## [4.8.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.1...v4.8.2) (2020-11-23) **Note:** Version bump only for package @typescript-eslint/scope-manager - - - - ## [4.8.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.0...v4.8.1) (2020-11-17) **Note:** Version bump only for package @typescript-eslint/scope-manager - - - - # [4.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.7.0...v4.8.0) (2020-11-16) **Note:** Version bump only for package @typescript-eslint/scope-manager - - - - # [4.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.6.1...v4.7.0) (2020-11-09) - ### Features -* support TS4.1 features ([#2748](https://github.com/typescript-eslint/typescript-eslint/issues/2748)) ([2be354b](https://github.com/typescript-eslint/typescript-eslint/commit/2be354bb15f9013a2da1b13a0c0836e9ef057e16)), closes [#2583](https://github.com/typescript-eslint/typescript-eslint/issues/2583) - - - - +- support TS4.1 features ([#2748](https://github.com/typescript-eslint/typescript-eslint/issues/2748)) ([2be354b](https://github.com/typescript-eslint/typescript-eslint/commit/2be354bb15f9013a2da1b13a0c0836e9ef057e16)), closes [#2583](https://github.com/typescript-eslint/typescript-eslint/issues/2583) ## [4.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.6.0...v4.6.1) (2020-11-02) **Note:** Version bump only for package @typescript-eslint/scope-manager - - - - # [4.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.5.0...v4.6.0) (2020-10-26) **Note:** Version bump only for package @typescript-eslint/scope-manager - - - - # [4.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.4.1...v4.5.0) (2020-10-19) - ### Features -* **typescript-estree:** add flag EXPERIMENTAL_useSourceOfProjectReferenceRedirect ([#2669](https://github.com/typescript-eslint/typescript-eslint/issues/2669)) ([90a5878](https://github.com/typescript-eslint/typescript-eslint/commit/90a587845088da1b205e4d7d77dbc3f9447b1c5a)) - - - - +- **typescript-estree:** add flag EXPERIMENTAL_useSourceOfProjectReferenceRedirect ([#2669](https://github.com/typescript-eslint/typescript-eslint/issues/2669)) ([90a5878](https://github.com/typescript-eslint/typescript-eslint/commit/90a587845088da1b205e4d7d77dbc3f9447b1c5a)) ## [4.4.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.4.0...v4.4.1) (2020-10-12) - ### Bug Fixes -* **scope-manager:** don't create a variable for global augmentation ([#2639](https://github.com/typescript-eslint/typescript-eslint/issues/2639)) ([6bc9325](https://github.com/typescript-eslint/typescript-eslint/commit/6bc93257ec876214743a165093b6666d713379f6)) - - - - +- **scope-manager:** don't create a variable for global augmentation ([#2639](https://github.com/typescript-eslint/typescript-eslint/issues/2639)) ([6bc9325](https://github.com/typescript-eslint/typescript-eslint/commit/6bc93257ec876214743a165093b6666d713379f6)) # [4.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.3.0...v4.4.0) (2020-10-05) **Note:** Version bump only for package @typescript-eslint/scope-manager - - - - # [4.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.2.0...v4.3.0) (2020-09-28) **Note:** Version bump only for package @typescript-eslint/scope-manager - - - - # [4.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.1...v4.2.0) (2020-09-21) - ### Bug Fixes -* **scope-manager:** correct analysis of inferred types in conditional types ([#2537](https://github.com/typescript-eslint/typescript-eslint/issues/2537)) ([4f660fd](https://github.com/typescript-eslint/typescript-eslint/commit/4f660fd31acbb88b30719f925dcb2b3022cc2bab)) - - - - +- **scope-manager:** correct analysis of inferred types in conditional types ([#2537](https://github.com/typescript-eslint/typescript-eslint/issues/2537)) ([4f660fd](https://github.com/typescript-eslint/typescript-eslint/commit/4f660fd31acbb88b30719f925dcb2b3022cc2bab)) ## [4.1.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.0...v4.1.1) (2020-09-14) **Note:** Version bump only for package @typescript-eslint/scope-manager - - - - # [4.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.0.1...v4.1.0) (2020-09-07) - ### Bug Fixes -* **eslint-plugin:** [no-unused-vars] correct detection of unused vars in a declared module with `export =` ([#2505](https://github.com/typescript-eslint/typescript-eslint/issues/2505)) ([3d07a99](https://github.com/typescript-eslint/typescript-eslint/commit/3d07a99faa0a5fc1b44acdb43ddbfc90a5105833)) -* **scope-manager:** add `const` as a global type variable ([#2499](https://github.com/typescript-eslint/typescript-eslint/issues/2499)) ([eb3f6e3](https://github.com/typescript-eslint/typescript-eslint/commit/eb3f6e39391d62ac424baa305a15e61806b2fd65)) -* **scope-manager:** correctly handle inferred types in nested type scopes ([#2497](https://github.com/typescript-eslint/typescript-eslint/issues/2497)) ([95f6bf4](https://github.com/typescript-eslint/typescript-eslint/commit/95f6bf4818cdec48a0583bf82f928c598af22736)) -* **scope-manager:** don't create references for intrinsic JSX elements ([#2504](https://github.com/typescript-eslint/typescript-eslint/issues/2504)) ([cdb9807](https://github.com/typescript-eslint/typescript-eslint/commit/cdb9807a5a368a136856cd03048b68e0f2dfb405)) -* **scope-manager:** fallback to lib 'esnext' or 'es5' when ecma version is unsupported ([#2474](https://github.com/typescript-eslint/typescript-eslint/issues/2474)) ([20a7dcc](https://github.com/typescript-eslint/typescript-eslint/commit/20a7dcc808a39cd447d6e52fc5a1e1373d7122e9)) -* **scope-manager:** support rest function type parameters ([#2491](https://github.com/typescript-eslint/typescript-eslint/issues/2491)) ([9d8b4c4](https://github.com/typescript-eslint/typescript-eslint/commit/9d8b4c479c98623e4198aa07639321929a8a876f)), closes [#2449](https://github.com/typescript-eslint/typescript-eslint/issues/2449) -* **scope-manager:** support tagged template string generic type parameters ([#2492](https://github.com/typescript-eslint/typescript-eslint/issues/2492)) ([a2686c0](https://github.com/typescript-eslint/typescript-eslint/commit/a2686c04293ab9070c1500a0dab7e205bd1fa9d2)) -* **scope-manager:** support type predicates ([#2493](https://github.com/typescript-eslint/typescript-eslint/issues/2493)) ([a40f54c](https://github.com/typescript-eslint/typescript-eslint/commit/a40f54c39d59096a0d12a492807dcd52fbcdc384)), closes [#2462](https://github.com/typescript-eslint/typescript-eslint/issues/2462) -* **scope-manager:** treat type imports as both values and types ([#2494](https://github.com/typescript-eslint/typescript-eslint/issues/2494)) ([916e95a](https://github.com/typescript-eslint/typescript-eslint/commit/916e95a505689746dda38a67148c95cc7d207d9f)), closes [#2453](https://github.com/typescript-eslint/typescript-eslint/issues/2453) - +- **eslint-plugin:** [no-unused-vars] correct detection of unused vars in a declared module with `export =` ([#2505](https://github.com/typescript-eslint/typescript-eslint/issues/2505)) ([3d07a99](https://github.com/typescript-eslint/typescript-eslint/commit/3d07a99faa0a5fc1b44acdb43ddbfc90a5105833)) +- **scope-manager:** add `const` as a global type variable ([#2499](https://github.com/typescript-eslint/typescript-eslint/issues/2499)) ([eb3f6e3](https://github.com/typescript-eslint/typescript-eslint/commit/eb3f6e39391d62ac424baa305a15e61806b2fd65)) +- **scope-manager:** correctly handle inferred types in nested type scopes ([#2497](https://github.com/typescript-eslint/typescript-eslint/issues/2497)) ([95f6bf4](https://github.com/typescript-eslint/typescript-eslint/commit/95f6bf4818cdec48a0583bf82f928c598af22736)) +- **scope-manager:** don't create references for intrinsic JSX elements ([#2504](https://github.com/typescript-eslint/typescript-eslint/issues/2504)) ([cdb9807](https://github.com/typescript-eslint/typescript-eslint/commit/cdb9807a5a368a136856cd03048b68e0f2dfb405)) +- **scope-manager:** fallback to lib 'esnext' or 'es5' when ecma version is unsupported ([#2474](https://github.com/typescript-eslint/typescript-eslint/issues/2474)) ([20a7dcc](https://github.com/typescript-eslint/typescript-eslint/commit/20a7dcc808a39cd447d6e52fc5a1e1373d7122e9)) +- **scope-manager:** support rest function type parameters ([#2491](https://github.com/typescript-eslint/typescript-eslint/issues/2491)) ([9d8b4c4](https://github.com/typescript-eslint/typescript-eslint/commit/9d8b4c479c98623e4198aa07639321929a8a876f)), closes [#2449](https://github.com/typescript-eslint/typescript-eslint/issues/2449) +- **scope-manager:** support tagged template string generic type parameters ([#2492](https://github.com/typescript-eslint/typescript-eslint/issues/2492)) ([a2686c0](https://github.com/typescript-eslint/typescript-eslint/commit/a2686c04293ab9070c1500a0dab7e205bd1fa9d2)) +- **scope-manager:** support type predicates ([#2493](https://github.com/typescript-eslint/typescript-eslint/issues/2493)) ([a40f54c](https://github.com/typescript-eslint/typescript-eslint/commit/a40f54c39d59096a0d12a492807dcd52fbcdc384)), closes [#2462](https://github.com/typescript-eslint/typescript-eslint/issues/2462) +- **scope-manager:** treat type imports as both values and types ([#2494](https://github.com/typescript-eslint/typescript-eslint/issues/2494)) ([916e95a](https://github.com/typescript-eslint/typescript-eslint/commit/916e95a505689746dda38a67148c95cc7d207d9f)), closes [#2453](https://github.com/typescript-eslint/typescript-eslint/issues/2453) ### Features -* **scope-manager:** add support for JSX scope analysis ([#2498](https://github.com/typescript-eslint/typescript-eslint/issues/2498)) ([f887ab5](https://github.com/typescript-eslint/typescript-eslint/commit/f887ab51f58c1b3571f9a14832864bc0ca59623f)), closes [#2455](https://github.com/typescript-eslint/typescript-eslint/issues/2455) [#2477](https://github.com/typescript-eslint/typescript-eslint/issues/2477) - - - - +- **scope-manager:** add support for JSX scope analysis ([#2498](https://github.com/typescript-eslint/typescript-eslint/issues/2498)) ([f887ab5](https://github.com/typescript-eslint/typescript-eslint/commit/f887ab51f58c1b3571f9a14832864bc0ca59623f)), closes [#2455](https://github.com/typescript-eslint/typescript-eslint/issues/2455) [#2477](https://github.com/typescript-eslint/typescript-eslint/issues/2477) ## [4.0.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.0.0...v4.0.1) (2020-08-31) **Note:** Version bump only for package @typescript-eslint/scope-manager - - - - # [4.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.10.1...v4.0.0) (2020-08-31) ## [Please see the release notes for v4.0.0](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v4.0.0) ### Bug Fixes -* **scope-manager:** correct analysis of abstract class properties ([#2420](https://github.com/typescript-eslint/typescript-eslint/issues/2420)) ([cd84549](https://github.com/typescript-eslint/typescript-eslint/commit/cd84549beba3cf471d75cfd9ba26f80366842ed5)) - +- **scope-manager:** correct analysis of abstract class properties ([#2420](https://github.com/typescript-eslint/typescript-eslint/issues/2420)) ([cd84549](https://github.com/typescript-eslint/typescript-eslint/commit/cd84549beba3cf471d75cfd9ba26f80366842ed5)) ### Features -* support ESTree optional chaining representation ([#2308](https://github.com/typescript-eslint/typescript-eslint/issues/2308)) ([e9d2ab6](https://github.com/typescript-eslint/typescript-eslint/commit/e9d2ab638b6767700b52797e74b814ea059beaae)) - - - - +- support ESTree optional chaining representation ([#2308](https://github.com/typescript-eslint/typescript-eslint/issues/2308)) ([e9d2ab6](https://github.com/typescript-eslint/typescript-eslint/commit/e9d2ab638b6767700b52797e74b814ea059beaae)) ## [3.10.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.10.0...v3.10.1) (2020-08-25) **Note:** Version bump only for package @typescript-eslint/scope-manager - - - - # [3.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.9.1...v3.10.0) (2020-08-24) **Note:** Version bump only for package @typescript-eslint/scope-manager - - - - ## [3.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.9.0...v3.9.1) (2020-08-17) **Note:** Version bump only for package @typescript-eslint/scope-manager - - - - # [3.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.8.0...v3.9.0) (2020-08-10) - ### Features -* **typescript-estree:** support TSv4 labelled tuple members ([#2378](https://github.com/typescript-eslint/typescript-eslint/issues/2378)) ([00d84ff](https://github.com/typescript-eslint/typescript-eslint/commit/00d84ffbcbe9d0ec98bdb2f2ce59959a27ce4dbe)) - - - - +- **typescript-estree:** support TSv4 labelled tuple members ([#2378](https://github.com/typescript-eslint/typescript-eslint/issues/2378)) ([00d84ff](https://github.com/typescript-eslint/typescript-eslint/commit/00d84ffbcbe9d0ec98bdb2f2ce59959a27ce4dbe)) # [3.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.7.1...v3.8.0) (2020-08-03) **Note:** Version bump only for package @typescript-eslint/scope-manager - - - - ## [3.7.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.7.0...v3.7.1) (2020-07-27) **Note:** Version bump only for package @typescript-eslint/scope-manager - - - - # [3.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.6.1...v3.7.0) (2020-07-20) **Note:** Version bump only for package @typescript-eslint/scope-manager - - - - ## [3.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.6.0...v3.6.1) (2020-07-13) **Note:** Version bump only for package @typescript-eslint/scope-manager - - - - # [3.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.5.0...v3.6.0) (2020-07-06) **Note:** Version bump only for package @typescript-eslint/scope-manager - - - - # [3.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.4.0...v3.5.0) (2020-06-29) - ### Features -* add package scope-manager ([#1939](https://github.com/typescript-eslint/typescript-eslint/issues/1939)) ([682eb7e](https://github.com/typescript-eslint/typescript-eslint/commit/682eb7e009c3f22a542882dfd3602196a60d2a1e)) +- add package scope-manager ([#1939](https://github.com/typescript-eslint/typescript-eslint/issues/1939)) ([682eb7e](https://github.com/typescript-eslint/typescript-eslint/commit/682eb7e009c3f22a542882dfd3602196a60d2a1e)) diff --git a/packages/scope-manager/LICENSE b/packages/scope-manager/LICENSE index 7e7370143b2..a1164108d4d 100644 --- a/packages/scope-manager/LICENSE +++ b/packages/scope-manager/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2019 TypeScript ESLint and other contributors +Copyright (c) 2019 typescript-eslint and other contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/scope-manager/README.md b/packages/scope-manager/README.md index b0a745f3fa5..0258932e390 100644 --- a/packages/scope-manager/README.md +++ b/packages/scope-manager/README.md @@ -1,120 +1,8 @@ -

TypeScript Scope Manager

+# `@typescript-eslint/scope-manager` -

- CI - NPM Version - NPM Downloads -

+[![NPM Version](https://img.shields.io/npm/v/@typescript-eslint/scope-manager.svg?style=flat-square)](https://www.npmjs.com/package/@typescript-eslint/scope-manager) +[![NPM Downloads](https://img.shields.io/npm/dm/@typescript-eslint/scope-manager.svg?style=flat-square)](https://www.npmjs.com/package/@typescript-eslint/scope-manager) -This is a fork of [`eslint-scope`](https://github.com/eslint/eslint-scope), enhanced to support TypeScript functionality. -[You can view the original license for the code here](https://github.com/eslint/eslint-scope/blob/dbddf14d5771b21b5da704213e4508c660ca1c64/LICENSE). +👉 See **https://typescript-eslint.io/architecture/scope-manager** for documentation on this package. -This package is consumed automatically by [`@typescript-eslint/parser`](../parser). -You probably don't want to use it directly. - -## Getting Started - -**[You can find our Getting Started docs here](https://typescript-eslint.io/docs)** - -## Installation - -```bash -$ yarn add -D typescript @typescript-eslint/scope-manager -$ npm i --save-dev typescript @typescript-eslint/scope-manager -``` - -## API - -### `analyze(tree, options)` - -Analyses a given AST and returns the resulting `ScopeManager`. - -```ts -interface AnalyzeOptions { - /** - * Known visitor keys. - */ - childVisitorKeys?: Record | null; - - /** - * Which ECMAScript version is considered. - * Defaults to `2018`. - * `'latest'` is converted to 1e8 at parser. - */ - ecmaVersion?: EcmaVersion | 1e8; - - /** - * Whether the whole script is executed under node.js environment. - * When enabled, the scope manager adds a function scope immediately following the global scope. - * Defaults to `false`. - */ - globalReturn?: boolean; - - /** - * Implied strict mode (if ecmaVersion >= 5). - * Defaults to `false`. - */ - impliedStrict?: boolean; - - /** - * The identifier that's used for JSX Element creation (after transpilation). - * This should not be a member expression - just the root identifier (i.e. use "React" instead of "React.createElement"). - * Defaults to `"React"`. - */ - jsxPragma?: string; - - /** - * The identifier that's used for JSX fragment elements (after transpilation). - * If `null`, assumes transpilation will always use a member on `jsxFactory` (i.e. React.Fragment). - * This should not be a member expression - just the root identifier (i.e. use "h" instead of "h.Fragment"). - * Defaults to `null`. - */ - jsxFragmentName?: string | null; - - /** - * The lib used by the project. - * This automatically defines a type variable for any types provided by the configured TS libs. - * For more information, see https://www.typescriptlang.org/tsconfig#lib - * - * Defaults to the lib for the provided `ecmaVersion`. - */ - lib?: Lib[]; - - /** - * The source type of the script. - */ - sourceType?: 'script' | 'module'; - - /** - * Emit design-type metadata for decorated declarations in source. - * Defaults to `false`. - */ - emitDecoratorMetadata?: boolean; -} -``` - -Example usage: - -```ts -import { analyze } from '@typescript-eslint/scope-manager'; -import { parse } from '@typescript-eslint/typescript-estree'; - -const code = `const hello: string = 'world';`; -const ast = parse(code, { - // note that scope-manager requires ranges on the AST - range: true, -}); -const scope = analyze(ast, { - ecmaVersion: 2020, - sourceType: 'module', -}); -``` - -## References - -- https://eslint.org/docs/developer-guide/scope-manager-interface -- https://github.com/eslint/eslint-scope - -## Contributing - -[See the contributing guide here](../../CONTRIBUTING.md) +> See https://typescript-eslint.io for general documentation on typescript-eslint, the tooling that allows you to run ESLint and Prettier on TypeScript code. diff --git a/packages/scope-manager/package.json b/packages/scope-manager/package.json index f67265ca71b..933add59f67 100644 --- a/packages/scope-manager/package.json +++ b/packages/scope-manager/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/scope-manager", - "version": "5.39.0", + "version": "5.46.1", "description": "TypeScript scope analyser for ESLint", "keywords": [ "eslint", @@ -28,22 +28,22 @@ "main": "dist/index.js", "types": "dist/index.d.ts", "scripts": { - "build": "cd ../../ && nx build @typescript-eslint/scope-manager", - "clean": "cd ../../ && nx clean @typescript-eslint/scope-manager", - "clean-fixtures": "cd ../../ && nx clean-fixtures @typescript-eslint/scope-manager", + "build": "nx build", + "clean": "nx clean", + "clean-fixtures": "nx clean-fixtures", "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", - "generate:lib": "cd ../../ && nx generate-lib @typescript-eslint/scope-manager", - "lint": "cd ../../ && nx lint @typescript-eslint/scope-manager", - "test": "cd ../../ && nx test @typescript-eslint/scope-manager --code-coverage", - "typecheck": "cd ../../ && nx typecheck @typescript-eslint/scope-manager" + "generate:lib": "nx generate-lib", + "lint": "nx lint", + "test": "nx test --code-coverage", + "typecheck": "nx typecheck" }, "dependencies": { - "@typescript-eslint/types": "5.39.0", - "@typescript-eslint/visitor-keys": "5.39.0" + "@typescript-eslint/types": "5.46.1", + "@typescript-eslint/visitor-keys": "5.46.1" }, "devDependencies": { "@types/glob": "*", - "@typescript-eslint/typescript-estree": "5.39.0", + "@typescript-eslint/typescript-estree": "5.46.1", "glob": "*", "jest-specific-snapshot": "*", "make-dir": "*", diff --git a/packages/scope-manager/project.json b/packages/scope-manager/project.json index 7753d267f39..9d4a6c37c9a 100644 --- a/packages/scope-manager/project.json +++ b/packages/scope-manager/project.json @@ -1,14 +1,12 @@ { - "root": "packages/scope-manager", + "name": "scope-manager", + "$schema": "../../node_modules/nx/schemas/project-schema.json", "sourceRoot": "packages/scope-manager/src", "projectType": "library", "targets": { "build": { - "executor": "@nrwl/workspace:run-commands", - "outputs": [ - "packages/scope-manager/dist", - "packages/scope-manager/_ts3.4" - ], + "executor": "nx:run-commands", + "outputs": ["{projectRoot}/dist", "{projectRoot}/_ts3.4"], "options": { "parallel": false, "cwd": "packages/scope-manager", @@ -20,7 +18,7 @@ } }, "typecheck": { - "executor": "@nrwl/workspace:run-commands", + "executor": "nx:run-commands", "options": { "parallel": true, "cwd": "packages/scope-manager", @@ -31,7 +29,7 @@ } }, "clean": { - "executor": "@nrwl/workspace:run-commands", + "executor": "nx:run-commands", "options": { "parallel": false, "cwd": "packages/scope-manager", @@ -44,7 +42,7 @@ } }, "clean-fixtures": { - "executor": "@nrwl/workspace:run-commands", + "executor": "nx:run-commands", "options": { "parallel": false, "cwd": "packages/scope-manager", @@ -55,20 +53,19 @@ "executor": "@nrwl/linter:eslint", "outputs": ["{options.outputFile}"], "options": { - "lintFilePatterns": ["packages/scope-manager/**/*.{ts,js}"], - "ignorePath": ".eslintignore" + "lintFilePatterns": ["packages/scope-manager/**/*.ts"] } }, "test": { "executor": "@nrwl/jest:jest", - "outputs": ["packages/scope-manager/coverage"], + "outputs": ["{projectRoot}/coverage"], "options": { "jestConfig": "packages/scope-manager/jest.config.js", "passWithNoTests": true } }, "generate-lib": { - "executor": "@nrwl/workspace:run-commands", + "executor": "nx:run-commands", "options": { "parallel": false, "cwd": "packages/scope-manager", diff --git a/packages/scope-manager/src/analyze.ts b/packages/scope-manager/src/analyze.ts index e227d1e45ad..8e8e0d83406 100644 --- a/packages/scope-manager/src/analyze.ts +++ b/packages/scope-manager/src/analyze.ts @@ -6,9 +6,9 @@ import type { ReferencerOptions } from './referencer'; import { Referencer } from './referencer'; import { ScopeManager } from './ScopeManager'; -//////////////////////////////////////////////////// -// MAKE SURE THIS IS KEPT IN SYNC WITH THE README // -//////////////////////////////////////////////////// +////////////////////////////////////////////////////////// +// MAKE SURE THIS IS KEPT IN SYNC WITH THE WEBSITE DOCS // +////////////////////////////////////////////////////////// interface AnalyzeOptions { /** diff --git a/packages/scope-manager/src/lib/dom.iterable.ts b/packages/scope-manager/src/lib/dom.iterable.ts index d294d684ddc..1d43661478b 100644 --- a/packages/scope-manager/src/lib/dom.iterable.ts +++ b/packages/scope-manager/src/lib/dom.iterable.ts @@ -13,6 +13,7 @@ export const dom_iterable = { CSSRuleList: TYPE, CSSStyleDeclaration: TYPE, Cache: TYPE, + CanvasPath: TYPE, CanvasPathDrawingStyles: TYPE, DOMRectList: TYPE, DOMStringList: TYPE, diff --git a/packages/scope-manager/src/lib/dom.ts b/packages/scope-manager/src/lib/dom.ts index dd8523bc66e..1087a238dfc 100644 --- a/packages/scope-manager/src/lib/dom.ts +++ b/packages/scope-manager/src/lib/dom.ts @@ -66,7 +66,7 @@ export const dom = { DeviceMotionEventInit: TYPE, DeviceMotionEventRotationRateInit: TYPE, DeviceOrientationEventInit: TYPE, - DisplayMediaStreamConstraints: TYPE, + DisplayMediaStreamOptions: TYPE, DocumentTimelineOptions: TYPE, DoubleRange: TYPE, DragEventInit: TYPE, @@ -143,7 +143,6 @@ export const dom = { MediaMetadataInit: TYPE, MediaPositionState: TYPE, MediaQueryListEventInit: TYPE, - MediaRecorderErrorEventInit: TYPE, MediaRecorderOptions: TYPE, MediaSessionActionDetails: TYPE, MediaStreamAudioSourceOptions: TYPE, @@ -184,6 +183,7 @@ export const dom = { PeriodicWaveConstraints: TYPE, PeriodicWaveOptions: TYPE, PermissionDescriptor: TYPE, + PictureInPictureEventInit: TYPE, PointerEventInit: TYPE, PopStateEventInit: TYPE, PositionOptions: TYPE, @@ -243,6 +243,7 @@ export const dom = { RTCStats: TYPE, RTCTrackEventInit: TYPE, RTCTransportStats: TYPE, + ReadableStreamGetReaderOptions: TYPE, ReadableStreamReadDoneResult: TYPE, ReadableStreamReadValueResult: TYPE, ReadableWritablePair: TYPE, @@ -284,12 +285,14 @@ export const dom = { TransitionEventInit: TYPE, UIEventInit: TYPE, ULongRange: TYPE, + UnderlyingByteSource: TYPE, + UnderlyingDefaultSource: TYPE, UnderlyingSink: TYPE, UnderlyingSource: TYPE, ValidityStateFlags: TYPE, VideoColorSpaceInit: TYPE, VideoConfiguration: TYPE, - VideoFrameMetadata: TYPE, + VideoFrameCallbackMetadata: TYPE, WaveShaperOptions: TYPE, WebGLContextAttributes: TYPE, WebGLContextEventInit: TYPE, @@ -348,12 +351,16 @@ export const dom = { CDATASection: TYPE_VALUE, CSSAnimation: TYPE_VALUE, CSSConditionRule: TYPE_VALUE, + CSSContainerRule: TYPE_VALUE, CSSCounterStyleRule: TYPE_VALUE, CSSFontFaceRule: TYPE_VALUE, + CSSFontPaletteValuesRule: TYPE_VALUE, CSSGroupingRule: TYPE_VALUE, CSSImportRule: TYPE_VALUE, CSSKeyframeRule: TYPE_VALUE, CSSKeyframesRule: TYPE_VALUE, + CSSLayerBlockRule: TYPE_VALUE, + CSSLayerStatementRule: TYPE_VALUE, CSSMediaRule: TYPE_VALUE, CSSNamespaceRule: TYPE_VALUE, CSSPageRule: TYPE_VALUE, @@ -449,8 +456,10 @@ export const dom = { EXT_frag_depth: TYPE, EXT_sRGB: TYPE, EXT_shader_texture_lod: TYPE, + EXT_texture_compression_bptc: TYPE, EXT_texture_compression_rgtc: TYPE, EXT_texture_filter_anisotropic: TYPE, + EXT_texture_norm16: TYPE, ElementEventMap: TYPE, Element: TYPE_VALUE, ElementCSSInlineStyle: TYPE, @@ -641,7 +650,6 @@ export const dom = { MediaQueryListEvent: TYPE_VALUE, MediaRecorderEventMap: TYPE, MediaRecorder: TYPE_VALUE, - MediaRecorderErrorEvent: TYPE_VALUE, MediaSession: TYPE_VALUE, MediaSourceEventMap: TYPE, MediaSource: TYPE_VALUE, @@ -683,6 +691,7 @@ export const dom = { NonElementParentNode: TYPE, NotificationEventMap: TYPE, Notification: TYPE_VALUE, + OES_draw_buffers_indexed: TYPE, OES_element_index_uint: TYPE, OES_fbo_render_mipmap: TYPE, OES_standard_derivatives: TYPE, @@ -695,6 +704,9 @@ export const dom = { OfflineAudioCompletionEvent: TYPE_VALUE, OfflineAudioContextEventMap: TYPE, OfflineAudioContext: TYPE_VALUE, + OffscreenCanvasEventMap: TYPE, + OffscreenCanvas: TYPE_VALUE, + OffscreenCanvasRenderingContext2D: TYPE_VALUE, OscillatorNode: TYPE_VALUE, OverconstrainedError: TYPE_VALUE, PageTransitionEvent: TYPE_VALUE, @@ -724,6 +736,7 @@ export const dom = { PermissionStatusEventMap: TYPE, PermissionStatus: TYPE_VALUE, Permissions: TYPE_VALUE, + PictureInPictureEvent: TYPE_VALUE, PictureInPictureWindowEventMap: TYPE, PictureInPictureWindow: TYPE_VALUE, Plugin: TYPE_VALUE, @@ -1111,6 +1124,7 @@ export const dom = { MessageEventSource: TYPE, MutationRecordType: TYPE, NamedCurve: TYPE, + OffscreenRenderingContext: TYPE, OnBeforeUnloadEventHandler: TYPE, OnErrorEventHandler: TYPE, PerformanceEntryList: TYPE, @@ -1123,8 +1137,6 @@ export const dom = { TimerHandler: TYPE, Transferable: TYPE, Uint32List: TYPE, - UvmEntries: TYPE, - UvmEntry: TYPE, VibratePattern: TYPE, WindowProxy: TYPE, XMLHttpRequestBodyInit: TYPE, @@ -1203,6 +1215,7 @@ export const dom = { NavigationTimingType: TYPE, NotificationDirection: TYPE, NotificationPermission: TYPE, + OffscreenRenderingContextId: TYPE, OrientationLockType: TYPE, OrientationType: TYPE, OscillatorType: TYPE, @@ -1227,7 +1240,6 @@ export const dom = { RTCIceCandidateType: TYPE, RTCIceComponent: TYPE, RTCIceConnectionState: TYPE, - RTCIceCredentialType: TYPE, RTCIceGathererState: TYPE, RTCIceGatheringState: TYPE, RTCIceProtocol: TYPE, @@ -1243,6 +1255,8 @@ export const dom = { RTCSignalingState: TYPE, RTCStatsIceCandidatePairState: TYPE, RTCStatsType: TYPE, + ReadableStreamReaderMode: TYPE, + ReadableStreamType: TYPE, ReadyState: TYPE, RecordingState: TYPE, ReferrerPolicy: TYPE, diff --git a/packages/scope-manager/src/lib/es2019.intl.ts b/packages/scope-manager/src/lib/es2019.intl.ts new file mode 100644 index 00000000000..64b46f40ebb --- /dev/null +++ b/packages/scope-manager/src/lib/es2019.intl.ts @@ -0,0 +1,11 @@ +// 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 @typescript-eslint/scope-manager + +import type { ImplicitLibVariableOptions } from '../variable'; +import { TYPE_VALUE } from './base-config'; + +export const es2019_intl = { + Intl: TYPE_VALUE, +} as Record; diff --git a/packages/scope-manager/src/lib/es2019.ts b/packages/scope-manager/src/lib/es2019.ts index 43e55a27a3a..cd6d33c1f5d 100644 --- a/packages/scope-manager/src/lib/es2019.ts +++ b/packages/scope-manager/src/lib/es2019.ts @@ -6,6 +6,7 @@ import type { ImplicitLibVariableOptions } from '../variable'; import { es2018 } from './es2018'; import { es2019_array } from './es2019.array'; +import { es2019_intl } from './es2019.intl'; import { es2019_object } from './es2019.object'; import { es2019_string } from './es2019.string'; import { es2019_symbol } from './es2019.symbol'; @@ -16,4 +17,5 @@ export const es2019 = { ...es2019_object, ...es2019_string, ...es2019_symbol, + ...es2019_intl, } as Record; diff --git a/packages/scope-manager/src/lib/index.ts b/packages/scope-manager/src/lib/index.ts index 989857ba152..dfee880fa16 100644 --- a/packages/scope-manager/src/lib/index.ts +++ b/packages/scope-manager/src/lib/index.ts @@ -38,6 +38,7 @@ import { es2018_regexp } from './es2018.regexp'; import { es2019 } from './es2019'; import { es2019_array } from './es2019.array'; import { es2019_full } from './es2019.full'; +import { es2019_intl } from './es2019.intl'; import { es2019_object } from './es2019.object'; import { es2019_string } from './es2019.string'; import { es2019_symbol } from './es2019.symbol'; @@ -124,6 +125,7 @@ const lib = { 'es2019.object': es2019_object, 'es2019.string': es2019_string, 'es2019.symbol': es2019_symbol, + 'es2019.intl': es2019_intl, 'es2020.bigint': es2020_bigint, 'es2020.date': es2020_date, 'es2020.promise': es2020_promise, diff --git a/packages/scope-manager/src/lib/webworker.iterable.ts b/packages/scope-manager/src/lib/webworker.iterable.ts index e4b0fb8b940..5ff03255ece 100644 --- a/packages/scope-manager/src/lib/webworker.iterable.ts +++ b/packages/scope-manager/src/lib/webworker.iterable.ts @@ -8,6 +8,8 @@ import { TYPE } from './base-config'; export const webworker_iterable = { Cache: TYPE, + CanvasPath: TYPE, + CanvasPathDrawingStyles: 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 e44ce52113c..bddb6bf9aa4 100644 --- a/packages/scope-manager/src/lib/webworker.ts +++ b/packages/scope-manager/src/lib/webworker.ts @@ -88,6 +88,7 @@ export const webworker = { QueuingStrategyInit: TYPE, RTCEncodedAudioFrameMetadata: TYPE, RTCEncodedVideoFrameMetadata: TYPE, + ReadableStreamGetReaderOptions: TYPE, ReadableStreamReadDoneResult: TYPE, ReadableStreamReadValueResult: TYPE, ReadableWritablePair: TYPE, @@ -108,6 +109,8 @@ export const webworker = { TextDecoderOptions: TYPE, TextEncoderEncodeIntoResult: TYPE, Transformer: TYPE, + UnderlyingByteSource: TYPE, + UnderlyingDefaultSource: TYPE, UnderlyingSink: TYPE, UnderlyingSource: TYPE, VideoColorSpaceInit: TYPE, @@ -129,9 +132,23 @@ export const webworker = { ByteLengthQueuingStrategy: TYPE_VALUE, Cache: TYPE_VALUE, CacheStorage: TYPE_VALUE, + CanvasCompositing: TYPE, + CanvasDrawImage: TYPE, + CanvasDrawPath: TYPE, + CanvasFillStrokeStyles: TYPE, + CanvasFilters: TYPE, CanvasGradient: TYPE_VALUE, + CanvasImageData: TYPE, + CanvasImageSmoothing: TYPE, CanvasPath: TYPE, + CanvasPathDrawingStyles: TYPE, CanvasPattern: TYPE_VALUE, + CanvasRect: TYPE, + CanvasShadowStyles: TYPE, + CanvasState: TYPE, + CanvasText: TYPE, + CanvasTextDrawingStyles: TYPE, + CanvasTransform: TYPE, Client: TYPE_VALUE, Clients: TYPE_VALUE, CloseEvent: TYPE_VALUE, @@ -157,8 +174,10 @@ export const webworker = { EXT_frag_depth: TYPE, EXT_sRGB: TYPE, EXT_shader_texture_lod: TYPE, + EXT_texture_compression_bptc: TYPE, EXT_texture_compression_rgtc: TYPE, EXT_texture_filter_anisotropic: TYPE, + EXT_texture_norm16: TYPE, ErrorEvent: TYPE_VALUE, Event: TYPE_VALUE, EventListener: TYPE, @@ -221,6 +240,7 @@ export const webworker = { NotificationEventMap: TYPE, Notification: TYPE_VALUE, NotificationEvent: TYPE_VALUE, + OES_draw_buffers_indexed: TYPE, OES_element_index_uint: TYPE, OES_fbo_render_mipmap: TYPE, OES_standard_derivatives: TYPE, @@ -230,7 +250,9 @@ export const webworker = { OES_texture_half_float_linear: TYPE, OES_vertex_array_object: TYPE, OVR_multiview2: TYPE, - OffscreenCanvas: TYPE, + OffscreenCanvasEventMap: TYPE, + OffscreenCanvas: TYPE_VALUE, + OffscreenCanvasRenderingContext2D: TYPE_VALUE, Path2D: TYPE_VALUE, PerformanceEventMap: TYPE, Performance: TYPE_VALUE, @@ -388,6 +410,7 @@ export const webworker = { Int32List: TYPE, MessageEventSource: TYPE, NamedCurve: TYPE, + OffscreenRenderingContext: TYPE, OnErrorEventHandler: TYPE, PerformanceEntryList: TYPE, PushMessageDataInit: TYPE, @@ -402,6 +425,16 @@ export const webworker = { VibratePattern: TYPE, XMLHttpRequestBodyInit: TYPE, BinaryType: TYPE, + CanvasDirection: TYPE, + CanvasFillRule: TYPE, + CanvasFontKerning: TYPE, + CanvasFontStretch: TYPE, + CanvasFontVariantCaps: TYPE, + CanvasLineCap: TYPE, + CanvasLineJoin: TYPE, + CanvasTextAlign: TYPE, + CanvasTextBaseline: TYPE, + CanvasTextRendering: TYPE, ClientTypes: TYPE, ColorGamut: TYPE, ColorSpaceConversion: TYPE, @@ -411,12 +444,14 @@ export const webworker = { FontFaceLoadStatus: TYPE, FontFaceSetLoadStatus: TYPE, FrameType: TYPE, + GlobalCompositeOperation: TYPE, HdrMetadataType: TYPE, IDBCursorDirection: TYPE, IDBRequestReadyState: TYPE, IDBTransactionDurability: TYPE, IDBTransactionMode: TYPE, ImageOrientation: TYPE, + ImageSmoothingQuality: TYPE, KeyFormat: TYPE, KeyType: TYPE, KeyUsage: TYPE, @@ -425,12 +460,15 @@ export const webworker = { MediaEncodingType: TYPE, NotificationDirection: TYPE, NotificationPermission: TYPE, + OffscreenRenderingContextId: TYPE, PermissionName: TYPE, PermissionState: TYPE, PredefinedColorSpace: TYPE, PremultiplyAlpha: TYPE, PushEncryptionKeyName: TYPE, RTCEncodedVideoFrameType: TYPE, + ReadableStreamReaderMode: TYPE, + ReadableStreamType: TYPE, ReferrerPolicy: TYPE, RequestCache: TYPE, RequestCredentials: TYPE, diff --git a/packages/scope-manager/src/referencer/ClassVisitor.ts b/packages/scope-manager/src/referencer/ClassVisitor.ts index 3aced282e44..5f84e37404f 100644 --- a/packages/scope-manager/src/referencer/ClassVisitor.ts +++ b/packages/scope-manager/src/referencer/ClassVisitor.ts @@ -83,9 +83,13 @@ class ClassVisitor extends Visitor { } protected visitPropertyDefinition( - node: TSESTree.TSAbstractPropertyDefinition | TSESTree.PropertyDefinition, + node: + | TSESTree.AccessorProperty + | TSESTree.PropertyDefinition + | TSESTree.TSAbstractAccessorProperty + | TSESTree.TSAbstractPropertyDefinition, ): void { - this.visitProperty(node); + this.visitPropertyBase(node); /** * class A { * @meta // <--- check this @@ -229,9 +233,11 @@ class ClassVisitor extends Visitor { this.#referencer.close(node); } - protected visitProperty( + protected visitPropertyBase( node: + | TSESTree.AccessorProperty | TSESTree.PropertyDefinition + | TSESTree.TSAbstractAccessorProperty | TSESTree.TSAbstractPropertyDefinition | TSESTree.TSAbstractMethodDefinition, ): void { @@ -240,7 +246,10 @@ class ClassVisitor extends Visitor { } if (node.value) { - if (node.type === AST_NODE_TYPES.PropertyDefinition) { + if ( + node.type === AST_NODE_TYPES.PropertyDefinition || + node.type === AST_NODE_TYPES.AccessorProperty + ) { this.#referencer.scopeManager.nestClassFieldInitializerScope( node.value, ); @@ -248,7 +257,10 @@ class ClassVisitor extends Visitor { this.#referencer.visit(node.value); - if (node.type === AST_NODE_TYPES.PropertyDefinition) { + if ( + node.type === AST_NODE_TYPES.PropertyDefinition || + node.type === AST_NODE_TYPES.AccessorProperty + ) { this.#referencer.close(node.value); } } @@ -328,6 +340,10 @@ class ClassVisitor extends Visitor { // Visit selectors // ///////////////////// + protected AccessorProperty(node: TSESTree.AccessorProperty): void { + this.visitPropertyDefinition(node); + } + protected ClassBody(node: TSESTree.ClassBody): void { // this is here on purpose so that this visitor explicitly declares visitors // for all nodes it cares about (see the instance visit method above) @@ -342,6 +358,12 @@ class ClassVisitor extends Visitor { this.visitMethod(node); } + protected TSAbstractAccessorProperty( + node: TSESTree.TSAbstractAccessorProperty, + ): void { + this.visitPropertyDefinition(node); + } + protected TSAbstractPropertyDefinition( node: TSESTree.TSAbstractPropertyDefinition, ): void { @@ -351,7 +373,7 @@ class ClassVisitor extends Visitor { protected TSAbstractMethodDefinition( node: TSESTree.TSAbstractMethodDefinition, ): void { - this.visitProperty(node); + this.visitPropertyBase(node); } protected Identifier(node: TSESTree.Identifier): void { diff --git a/packages/scope-manager/src/referencer/Referencer.ts b/packages/scope-manager/src/referencer/Referencer.ts index a69209e86c6..e7b41127ba4 100644 --- a/packages/scope-manager/src/referencer/Referencer.ts +++ b/packages/scope-manager/src/referencer/Referencer.ts @@ -301,7 +301,10 @@ class Referencer extends Visitor { } protected visitTypeAssertion( - node: TSESTree.TSAsExpression | TSESTree.TSTypeAssertion, + node: + | TSESTree.TSAsExpression + | TSESTree.TSTypeAssertion + | TSESTree.TSSatisfiesExpression, ): void { this.visit(node.expression); this.visitType(node.typeAnnotation); @@ -675,7 +678,7 @@ class Referencer extends Visitor { member.id.type === AST_NODE_TYPES.Literal && typeof member.id.value === 'string' ) { - const name = member.id as TSESTree.StringLiteral; + const name = member.id; this.currentScope().defineLiteralIdentifier( name, new TSEnumMemberDefinition(name, member), @@ -724,6 +727,10 @@ class Referencer extends Visitor { this.close(node); } + protected TSSatisfiesExpression(node: TSESTree.TSSatisfiesExpression): void { + this.visitTypeAssertion(node); + } + protected TSTypeAliasDeclaration( node: TSESTree.TSTypeAliasDeclaration, ): void { diff --git a/packages/scope-manager/tests/fixtures/class/declaration/abstract-accessor-property.ts b/packages/scope-manager/tests/fixtures/class/declaration/abstract-accessor-property.ts new file mode 100644 index 00000000000..b84caed0b39 --- /dev/null +++ b/packages/scope-manager/tests/fixtures/class/declaration/abstract-accessor-property.ts @@ -0,0 +1,5 @@ +type T = 1; + +abstract class Foo { + abstract prop: T; +} diff --git a/packages/scope-manager/tests/fixtures/class/declaration/abstract-accessor-property.ts.shot b/packages/scope-manager/tests/fixtures/class/declaration/abstract-accessor-property.ts.shot new file mode 100644 index 00000000000..c895afba904 --- /dev/null +++ b/packages/scope-manager/tests/fixtures/class/declaration/abstract-accessor-property.ts.shot @@ -0,0 +1,88 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`class declaration abstract-accessor-property 1`] = ` +ScopeManager { + variables: Array [ + ImplicitGlobalConstTypeVariable, + Variable$2 { + defs: Array [ + TypeDefinition$1 { + name: Identifier<"T">, + node: TSTypeAliasDeclaration$1, + }, + ], + name: "T", + references: Array [ + Reference$1 { + identifier: Identifier<"T">, + isRead: true, + isTypeReference: true, + isValueReference: false, + isWrite: false, + resolved: Variable$2, + }, + ], + isValueVariable: false, + isTypeVariable: true, + }, + Variable$3 { + defs: Array [ + ClassNameDefinition$2 { + name: Identifier<"Foo">, + node: ClassDeclaration$2, + }, + ], + name: "Foo", + references: Array [], + isValueVariable: true, + isTypeVariable: true, + }, + Variable$4 { + defs: Array [ + ClassNameDefinition$3 { + name: Identifier<"Foo">, + node: ClassDeclaration$2, + }, + ], + name: "Foo", + references: Array [], + isValueVariable: true, + isTypeVariable: true, + }, + ], + scopes: Array [ + GlobalScope$1 { + block: Program$3, + isStrict: false, + references: Array [], + set: Map { + "const" => ImplicitGlobalConstTypeVariable, + "T" => Variable$2, + "Foo" => Variable$3, + }, + type: "global", + upper: null, + variables: Array [ + ImplicitGlobalConstTypeVariable, + Variable$2, + Variable$3, + ], + }, + ClassScope$2 { + block: ClassDeclaration$2, + isStrict: true, + references: Array [ + Reference$1, + ], + set: Map { + "Foo" => Variable$4, + }, + type: "class", + upper: GlobalScope$1, + variables: Array [ + Variable$4, + ], + }, + ], +} +`; diff --git a/packages/scope-manager/tests/fixtures/class/declaration/accessor-property-type-annotation.ts b/packages/scope-manager/tests/fixtures/class/declaration/accessor-property-type-annotation.ts new file mode 100644 index 00000000000..824821d682e --- /dev/null +++ b/packages/scope-manager/tests/fixtures/class/declaration/accessor-property-type-annotation.ts @@ -0,0 +1,4 @@ +type T = 1; +class A { + prop: T; +} diff --git a/packages/scope-manager/tests/fixtures/class/declaration/accessor-property-type-annotation.ts.shot b/packages/scope-manager/tests/fixtures/class/declaration/accessor-property-type-annotation.ts.shot new file mode 100644 index 00000000000..fb8248edefe --- /dev/null +++ b/packages/scope-manager/tests/fixtures/class/declaration/accessor-property-type-annotation.ts.shot @@ -0,0 +1,88 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`class declaration accessor-property-type-annotation 1`] = ` +ScopeManager { + variables: Array [ + ImplicitGlobalConstTypeVariable, + Variable$2 { + defs: Array [ + TypeDefinition$1 { + name: Identifier<"T">, + node: TSTypeAliasDeclaration$1, + }, + ], + name: "T", + references: Array [ + Reference$1 { + identifier: Identifier<"T">, + isRead: true, + isTypeReference: true, + isValueReference: false, + isWrite: false, + resolved: Variable$2, + }, + ], + isValueVariable: false, + isTypeVariable: true, + }, + Variable$3 { + defs: Array [ + ClassNameDefinition$2 { + name: Identifier<"A">, + node: ClassDeclaration$2, + }, + ], + name: "A", + references: Array [], + isValueVariable: true, + isTypeVariable: true, + }, + Variable$4 { + defs: Array [ + ClassNameDefinition$3 { + name: Identifier<"A">, + node: ClassDeclaration$2, + }, + ], + name: "A", + references: Array [], + isValueVariable: true, + isTypeVariable: true, + }, + ], + scopes: Array [ + GlobalScope$1 { + block: Program$3, + isStrict: false, + references: Array [], + set: Map { + "const" => ImplicitGlobalConstTypeVariable, + "T" => Variable$2, + "A" => Variable$3, + }, + type: "global", + upper: null, + variables: Array [ + ImplicitGlobalConstTypeVariable, + Variable$2, + Variable$3, + ], + }, + ClassScope$2 { + block: ClassDeclaration$2, + isStrict: true, + references: Array [ + Reference$1, + ], + set: Map { + "A" => Variable$4, + }, + type: "class", + upper: GlobalScope$1, + variables: Array [ + Variable$4, + ], + }, + ], +} +`; diff --git a/packages/scope-manager/tests/fixtures/class/declaration/accessor-property.ts b/packages/scope-manager/tests/fixtures/class/declaration/accessor-property.ts new file mode 100644 index 00000000000..e75d9def3e9 --- /dev/null +++ b/packages/scope-manager/tests/fixtures/class/declaration/accessor-property.ts @@ -0,0 +1,7 @@ +const x = 1; +class A { + prop1 = 1; + prop2 = x; +} + +const unresolved = prop1; diff --git a/packages/scope-manager/tests/fixtures/class/declaration/accessor-property.ts.shot b/packages/scope-manager/tests/fixtures/class/declaration/accessor-property.ts.shot new file mode 100644 index 00000000000..88914131b5c --- /dev/null +++ b/packages/scope-manager/tests/fixtures/class/declaration/accessor-property.ts.shot @@ -0,0 +1,152 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`class declaration accessor-property 1`] = ` +ScopeManager { + variables: Array [ + ImplicitGlobalConstTypeVariable, + Variable$2 { + defs: Array [ + VariableDefinition$1 { + name: Identifier<"x">, + node: VariableDeclarator$1, + }, + ], + name: "x", + references: Array [ + Reference$1 { + identifier: Identifier<"x">, + init: true, + isRead: false, + isTypeReference: false, + isValueReference: true, + isWrite: true, + resolved: Variable$2, + writeExpr: Literal$2, + }, + Reference$2 { + identifier: Identifier<"x">, + isRead: true, + isTypeReference: false, + isValueReference: true, + isWrite: false, + resolved: Variable$2, + }, + ], + isValueVariable: true, + isTypeVariable: false, + }, + Variable$3 { + defs: Array [ + ClassNameDefinition$2 { + name: Identifier<"A">, + node: ClassDeclaration$3, + }, + ], + name: "A", + references: Array [], + isValueVariable: true, + isTypeVariable: true, + }, + Variable$4 { + defs: Array [ + ClassNameDefinition$3 { + name: Identifier<"A">, + node: ClassDeclaration$3, + }, + ], + name: "A", + references: Array [], + isValueVariable: true, + isTypeVariable: true, + }, + Variable$5 { + defs: Array [ + VariableDefinition$4 { + name: Identifier<"unresolved">, + node: VariableDeclarator$4, + }, + ], + name: "unresolved", + references: Array [ + Reference$3 { + identifier: Identifier<"unresolved">, + init: true, + isRead: false, + isTypeReference: false, + isValueReference: true, + isWrite: true, + resolved: Variable$5, + writeExpr: Identifier<"prop1">, + }, + ], + isValueVariable: true, + isTypeVariable: false, + }, + ], + scopes: Array [ + GlobalScope$1 { + block: Program$5, + isStrict: false, + references: Array [ + Reference$1, + Reference$3, + Reference$4 { + identifier: Identifier<"prop1">, + isRead: true, + isTypeReference: false, + isValueReference: true, + isWrite: false, + resolved: null, + }, + ], + set: Map { + "const" => ImplicitGlobalConstTypeVariable, + "x" => Variable$2, + "A" => Variable$3, + "unresolved" => Variable$5, + }, + type: "global", + upper: null, + variables: Array [ + ImplicitGlobalConstTypeVariable, + Variable$2, + Variable$3, + Variable$5, + ], + }, + ClassScope$2 { + block: ClassDeclaration$3, + isStrict: true, + references: Array [], + set: Map { + "A" => Variable$4, + }, + type: "class", + upper: GlobalScope$1, + variables: Array [ + Variable$4, + ], + }, + ClassFieldInitializerScope$3 { + block: Literal$6, + isStrict: true, + references: Array [], + set: Map {}, + type: "class-field-initializer", + upper: ClassScope$2, + variables: Array [], + }, + ClassFieldInitializerScope$4 { + block: Identifier<"x">, + isStrict: true, + references: Array [ + Reference$2, + ], + set: Map {}, + type: "class-field-initializer", + upper: ClassScope$2, + variables: Array [], + }, + ], +} +`; diff --git a/packages/scope-manager/tests/fixtures/type-assertion/satisfies.ts b/packages/scope-manager/tests/fixtures/type-assertion/satisfies.ts new file mode 100644 index 00000000000..69dae24ecf2 --- /dev/null +++ b/packages/scope-manager/tests/fixtures/type-assertion/satisfies.ts @@ -0,0 +1,4 @@ +const x = 1; +type T = 1; + +x satisfies T; diff --git a/packages/scope-manager/tests/fixtures/type-assertion/satisfies.ts.shot b/packages/scope-manager/tests/fixtures/type-assertion/satisfies.ts.shot new file mode 100644 index 00000000000..9d6dcc03ce1 --- /dev/null +++ b/packages/scope-manager/tests/fixtures/type-assertion/satisfies.ts.shot @@ -0,0 +1,84 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`type-assertion satisfies 1`] = ` +ScopeManager { + variables: Array [ + ImplicitGlobalConstTypeVariable, + Variable$2 { + defs: Array [ + VariableDefinition$1 { + name: Identifier<"x">, + node: VariableDeclarator$1, + }, + ], + name: "x", + references: Array [ + Reference$1 { + identifier: Identifier<"x">, + init: true, + isRead: false, + isTypeReference: false, + isValueReference: true, + isWrite: true, + resolved: Variable$2, + writeExpr: Literal$2, + }, + Reference$2 { + identifier: Identifier<"x">, + isRead: true, + isTypeReference: false, + isValueReference: true, + isWrite: false, + resolved: Variable$2, + }, + ], + isValueVariable: true, + isTypeVariable: false, + }, + Variable$3 { + defs: Array [ + TypeDefinition$2 { + name: Identifier<"T">, + node: TSTypeAliasDeclaration$3, + }, + ], + name: "T", + references: Array [ + Reference$3 { + identifier: Identifier<"T">, + isRead: true, + isTypeReference: true, + isValueReference: false, + isWrite: false, + resolved: Variable$3, + }, + ], + isValueVariable: false, + isTypeVariable: true, + }, + ], + scopes: Array [ + GlobalScope$1 { + block: Program$4, + isStrict: false, + references: Array [ + Reference$1, + Reference$2, + Reference$3, + ], + set: Map { + "const" => ImplicitGlobalConstTypeVariable, + "x" => Variable$2, + "T" => Variable$3, + }, + type: "global", + upper: null, + variables: Array [ + ImplicitGlobalConstTypeVariable, + Variable$2, + Variable$3, + ], + }, + ], +} +`; diff --git a/packages/shared-fixtures/CHANGELOG.md b/packages/shared-fixtures/CHANGELOG.md index d15287d559d..8954c99d3f8 100644 --- a/packages/shared-fixtures/CHANGELOG.md +++ b/packages/shared-fixtures/CHANGELOG.md @@ -3,1708 +3,932 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -# [5.39.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.1...v5.39.0) (2022-10-03) +## [5.46.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.46.0...v5.46.1) (2022-12-12) **Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [5.46.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.45.1...v5.46.0) (2022-12-08) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures +## [5.45.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.45.0...v5.45.1) (2022-12-05) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures -## [5.38.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.0...v5.38.1) (2022-09-26) +# [5.45.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.44.0...v5.45.0) (2022-11-28) **Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [5.44.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.43.0...v5.44.0) (2022-11-21) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [5.43.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.1...v5.43.0) (2022-11-14) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures -# [5.38.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.37.0...v5.38.0) (2022-09-19) +## [5.42.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.0...v5.42.1) (2022-11-07) **Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [5.42.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.41.0...v5.42.0) (2022-10-31) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [5.41.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.1...v5.41.0) (2022-10-24) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures -# [5.37.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.2...v5.37.0) (2022-09-12) +## [5.40.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.0...v5.40.1) (2022-10-17) **Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [5.40.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.39.0...v5.40.0) (2022-10-10) + +**Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [5.39.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.1...v5.39.0) (2022-10-03) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures +## [5.38.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.0...v5.38.1) (2022-09-26) -## [5.36.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.1...v5.36.2) (2022-09-05) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [5.38.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.37.0...v5.38.0) (2022-09-19) -### Bug Fixes +**Note:** Version bump only for package @typescript-eslint/shared-fixtures -* **typescript-estree:** don't double add decorators to a parameter property's parameter ([#5582](https://github.com/typescript-eslint/typescript-eslint/issues/5582)) ([863694c](https://github.com/typescript-eslint/typescript-eslint/commit/863694cbc71b5158ca6a018de8707c9f9fbc22c3)) +# [5.37.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.2...v5.37.0) (2022-09-12) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures +## [5.36.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.1...v5.36.2) (2022-09-05) +### Bug Fixes +- **typescript-estree:** don't double add decorators to a parameter property's parameter ([#5582](https://github.com/typescript-eslint/typescript-eslint/issues/5582)) ([863694c](https://github.com/typescript-eslint/typescript-eslint/commit/863694cbc71b5158ca6a018de8707c9f9fbc22c3)) ## [5.36.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.0...v5.36.1) (2022-08-30) **Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [5.36.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.1...v5.36.0) (2022-08-30) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures +## [5.35.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.0...v5.35.1) (2022-08-24) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures -# [5.36.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.1...v5.36.0) (2022-08-30) +# [5.35.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.34.0...v5.35.0) (2022-08-24) **Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [5.34.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.1...v5.34.0) (2022-08-22) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures +## [5.33.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.0...v5.33.1) (2022-08-15) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures -## [5.35.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.0...v5.35.1) (2022-08-24) +# [5.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.32.0...v5.33.0) (2022-08-08) **Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [5.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.31.0...v5.32.0) (2022-08-01) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [5.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.7...v5.31.0) (2022-07-25) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures -# [5.35.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.34.0...v5.35.0) (2022-08-24) +## [5.30.7](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.6...v5.30.7) (2022-07-18) **Note:** Version bump only for package @typescript-eslint/shared-fixtures +## [5.30.6](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.5...v5.30.6) (2022-07-11) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures +## [5.30.5](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.4...v5.30.5) (2022-07-04) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures -# [5.34.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.1...v5.34.0) (2022-08-22) +## [5.30.4](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.3...v5.30.4) (2022-07-03) **Note:** Version bump only for package @typescript-eslint/shared-fixtures +## [5.30.3](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.2...v5.30.3) (2022-07-01) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures +## [5.30.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.1...v5.30.2) (2022-07-01) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures -## [5.33.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.0...v5.33.1) (2022-08-15) +## 5.30.1 (2022-07-01) **Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [5.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.29.0...v5.30.0) (2022-06-27) + +### Features +- treat `this` in `typeof this` as a `ThisExpression` ([#4382](https://github.com/typescript-eslint/typescript-eslint/issues/4382)) ([b04b2ce](https://github.com/typescript-eslint/typescript-eslint/commit/b04b2ce1ba90d94718891f2562dd210a6d7b8609)) +# [5.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.28.0...v5.29.0) (2022-06-20) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures -# [5.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.32.0...v5.33.0) (2022-08-08) +# [5.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.1...v5.28.0) (2022-06-13) **Note:** Version bump only for package @typescript-eslint/shared-fixtures +## [5.27.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.0...v5.27.1) (2022-06-06) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [5.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.26.0...v5.27.0) (2022-05-30) +### Features -# [5.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.31.0...v5.32.0) (2022-08-01) +- [TS4.7] support type parameters for `typeof` ([#5067](https://github.com/typescript-eslint/typescript-eslint/issues/5067)) ([836de79](https://github.com/typescript-eslint/typescript-eslint/commit/836de79e8d1bff43149168cc913a4c2b60e79bf6)) -**Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [5.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.25.0...v5.26.0) (2022-05-23) +### Features +- [4.7] support instantiation expressions ([#4938](https://github.com/typescript-eslint/typescript-eslint/issues/4938)) ([79fbc77](https://github.com/typescript-eslint/typescript-eslint/commit/79fbc7743ae5dce3190f8168776e0204755390ad)) +- [4.7] support optional variance annotation ([#4831](https://github.com/typescript-eslint/typescript-eslint/issues/4831)) ([7e7b24c](https://github.com/typescript-eslint/typescript-eslint/commit/7e7b24c196e6d968e48f97f46feae5e7027e22d2)) +- **typescript-estree:** `extends` constraints for `infer` ([#4830](https://github.com/typescript-eslint/typescript-eslint/issues/4830)) ([8cbbcc3](https://github.com/typescript-eslint/typescript-eslint/commit/8cbbcc3d317779e0dcba15d3835137f38383de34)) +# [5.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.24.0...v5.25.0) (2022-05-17) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures -# [5.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.7...v5.31.0) (2022-07-25) +# [5.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.23.0...v5.24.0) (2022-05-16) **Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [5.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.22.0...v5.23.0) (2022-05-09) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [5.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.21.0...v5.22.0) (2022-05-02) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures -## [5.30.7](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.6...v5.30.7) (2022-07-18) +# [5.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.20.0...v5.21.0) (2022-04-25) **Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [5.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.19.0...v5.20.0) (2022-04-18) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [5.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.18.0...v5.19.0) (2022-04-11) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures -## [5.30.6](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.5...v5.30.6) (2022-07-11) +# [5.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.17.0...v5.18.0) (2022-04-04) **Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [5.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.16.0...v5.17.0) (2022-03-28) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [5.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.15.0...v5.16.0) (2022-03-21) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures -## [5.30.5](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.4...v5.30.5) (2022-07-04) +# [5.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.14.0...v5.15.0) (2022-03-14) **Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [5.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.13.0...v5.14.0) (2022-03-07) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [5.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.1...v5.13.0) (2022-02-28) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures -## [5.30.4](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.3...v5.30.4) (2022-07-03) +## [5.12.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.0...v5.12.1) (2022-02-21) **Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [5.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.11.0...v5.12.0) (2022-02-14) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [5.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.2...v5.11.0) (2022-02-07) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures -## [5.30.3](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.2...v5.30.3) (2022-07-01) +## [5.10.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.1...v5.10.2) (2022-01-31) **Note:** Version bump only for package @typescript-eslint/shared-fixtures +## [5.10.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.0...v5.10.1) (2022-01-24) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [5.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.1...v5.10.0) (2022-01-17) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures -## [5.30.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.1...v5.30.2) (2022-07-01) +## [5.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.0...v5.9.1) (2022-01-10) **Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [5.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.1...v5.9.0) (2022-01-03) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures +## [5.8.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.0...v5.8.1) (2021-12-27) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures -## 5.30.1 (2022-07-01) +# [5.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.7.0...v5.8.0) (2021-12-20) **Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [5.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.6.0...v5.7.0) (2021-12-13) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [5.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.5.0...v5.6.0) (2021-12-06) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures -# [5.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.29.0...v5.30.0) (2022-06-27) +# [5.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.4.0...v5.5.0) (2021-11-29) + +**Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [5.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.3.1...v5.4.0) (2021-11-15) ### Features -* treat `this` in `typeof this` as a `ThisExpression` ([#4382](https://github.com/typescript-eslint/typescript-eslint/issues/4382)) ([b04b2ce](https://github.com/typescript-eslint/typescript-eslint/commit/b04b2ce1ba90d94718891f2562dd210a6d7b8609)) +- **typescript-estree:** support Import Assertions ([#4074](https://github.com/typescript-eslint/typescript-eslint/issues/4074)) ([ae0fb5a](https://github.com/typescript-eslint/typescript-eslint/commit/ae0fb5a591958216b7df656e66b1dfe464898167)) +- **typescript-estree:** support private fields in-in syntax ([#4075](https://github.com/typescript-eslint/typescript-eslint/issues/4075)) ([939d8ea](https://github.com/typescript-eslint/typescript-eslint/commit/939d8eac547fb1734aa00f1ea01cc6eae0b4280a)) +- **typescript-estree:** support type-only module specifiers ([#4076](https://github.com/typescript-eslint/typescript-eslint/issues/4076)) ([77baa92](https://github.com/typescript-eslint/typescript-eslint/commit/77baa9203638e888a76e21003a278a8da386e133)) +## [5.3.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.3.0...v5.3.1) (2021-11-08) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [5.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.2.0...v5.3.0) (2021-11-01) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures -# [5.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.28.0...v5.29.0) (2022-06-20) +# [5.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.1.0...v5.2.0) (2021-10-25) **Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [5.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.0.0...v5.1.0) (2021-10-18) +### Bug Fixes +- **typescript-estree:** support private optional property definition ([#3997](https://github.com/typescript-eslint/typescript-eslint/issues/3997)) ([8605e08](https://github.com/typescript-eslint/typescript-eslint/commit/8605e080a4dac4a277e6108cd9ed1e5a707302fa)) +# [5.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.33.0...v5.0.0) (2021-10-11) -# [5.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.1...v5.28.0) (2022-06-13) +### Bug Fixes -**Note:** Version bump only for package @typescript-eslint/shared-fixtures +- **typescript-estree:** change `source` of ExportNamedDeclaration to Literal from Expression ([#3763](https://github.com/typescript-eslint/typescript-eslint/issues/3763)) ([dc5a0f5](https://github.com/typescript-eslint/typescript-eslint/commit/dc5a0f5104b400f4422b8d67ecfc6cc7a32613a2)) +### Features +- support `PrivateIdentifier` ([#3808](https://github.com/typescript-eslint/typescript-eslint/issues/3808)) ([0eefe5e](https://github.com/typescript-eslint/typescript-eslint/commit/0eefe5e49d21af3f1e3e2d9a90c2e49929863ac2)), closes [#3430](https://github.com/typescript-eslint/typescript-eslint/issues/3430) [#2933](https://github.com/typescript-eslint/typescript-eslint/issues/2933) +- **eslint-plugin:** removed value from abstract property nodes ([#3765](https://github.com/typescript-eslint/typescript-eslint/issues/3765)) ([5823524](https://github.com/typescript-eslint/typescript-eslint/commit/58235241714596b641a1e8b39c569e561e0039b4)), closes [#3748](https://github.com/typescript-eslint/typescript-eslint/issues/3748) +# [4.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.32.0...v4.33.0) (2021-10-04) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures -## [5.27.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.0...v5.27.1) (2022-06-06) +# [4.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.2...v4.32.0) (2021-09-27) **Note:** Version bump only for package @typescript-eslint/shared-fixtures +## [4.31.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.1...v4.31.2) (2021-09-20) + +**Note:** Version bump only for package @typescript-eslint/shared-fixtures +## [4.31.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.0...v4.31.1) (2021-09-13) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [4.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.30.0...v4.31.0) (2021-09-06) -# [5.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.26.0...v5.27.0) (2022-05-30) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [4.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.3...v4.30.0) (2021-08-30) ### Features -* [TS4.7] support type parameters for `typeof` ([#5067](https://github.com/typescript-eslint/typescript-eslint/issues/5067)) ([836de79](https://github.com/typescript-eslint/typescript-eslint/commit/836de79e8d1bff43149168cc913a4c2b60e79bf6)) +- **typescript-estree:** add support for class static blocks ([#3730](https://github.com/typescript-eslint/typescript-eslint/issues/3730)) ([f81831b](https://github.com/typescript-eslint/typescript-eslint/commit/f81831bd279a32da6dbab0f1c061053ea43965f6)) +## [4.29.3](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.2...v4.29.3) (2021-08-23) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures +## [4.29.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.1...v4.29.2) (2021-08-16) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures -# [5.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.25.0...v5.26.0) (2022-05-23) +## [4.29.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.0...v4.29.1) (2021-08-09) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures -### Features +# [4.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.5...v4.29.0) (2021-08-02) -* [4.7] support instantiation expressions ([#4938](https://github.com/typescript-eslint/typescript-eslint/issues/4938)) ([79fbc77](https://github.com/typescript-eslint/typescript-eslint/commit/79fbc7743ae5dce3190f8168776e0204755390ad)) -* [4.7] support optional variance annotation ([#4831](https://github.com/typescript-eslint/typescript-eslint/issues/4831)) ([7e7b24c](https://github.com/typescript-eslint/typescript-eslint/commit/7e7b24c196e6d968e48f97f46feae5e7027e22d2)) -* **typescript-estree:** `extends` constraints for `infer` ([#4830](https://github.com/typescript-eslint/typescript-eslint/issues/4830)) ([8cbbcc3](https://github.com/typescript-eslint/typescript-eslint/commit/8cbbcc3d317779e0dcba15d3835137f38383de34)) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures +## [4.28.5](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.4...v4.28.5) (2021-07-26) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures +## [4.28.4](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.3...v4.28.4) (2021-07-19) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures -# [5.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.24.0...v5.25.0) (2022-05-17) +## [4.28.3](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.2...v4.28.3) (2021-07-12) **Note:** Version bump only for package @typescript-eslint/shared-fixtures +## [4.28.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.1...v4.28.2) (2021-07-05) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures +## [4.28.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.0...v4.28.1) (2021-06-28) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures -# [5.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.23.0...v5.24.0) (2022-05-16) +# [4.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.27.0...v4.28.0) (2021-06-21) **Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [4.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.1...v4.27.0) (2021-06-14) +### Bug Fixes +- **typescript-estree:** support override modifier for parameter property ([#3485](https://github.com/typescript-eslint/typescript-eslint/issues/3485)) ([33b9f69](https://github.com/typescript-eslint/typescript-eslint/commit/33b9f69a681cd3219a2acca5b0b2fa67609f099e)) - -# [5.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.22.0...v5.23.0) (2022-05-09) +## [4.26.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.0...v4.26.1) (2021-06-07) **Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [4.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.25.0...v4.26.0) (2021-05-31) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [4.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.24.0...v4.25.0) (2021-05-24) +### Features -# [5.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.21.0...v5.22.0) (2022-05-02) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures +- **typescript-estree:** [TS4.3] support overrides on class members ([#3429](https://github.com/typescript-eslint/typescript-eslint/issues/3429)) ([21d1b62](https://github.com/typescript-eslint/typescript-eslint/commit/21d1b62a0b84b502d2cf12674b3d141994a3ffd4)) +- **typescript-estree:** add support for getter/setter signatures on types ([#3427](https://github.com/typescript-eslint/typescript-eslint/issues/3427)) ([b830b7f](https://github.com/typescript-eslint/typescript-eslint/commit/b830b7f4e8a99affc8af8b53cb83371ef81d7032)), closes [#3272](https://github.com/typescript-eslint/typescript-eslint/issues/3272) [#3272](https://github.com/typescript-eslint/typescript-eslint/issues/3272) +# [4.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.23.0...v4.24.0) (2021-05-17) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [4.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.1...v4.23.0) (2021-05-10) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures -# [5.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.20.0...v5.21.0) (2022-04-25) +## [4.22.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.0...v4.22.1) (2021-05-04) **Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [4.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.21.0...v4.22.0) (2021-04-12) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [4.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.20.0...v4.21.0) (2021-04-05) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures -# [5.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.19.0...v5.20.0) (2022-04-18) +# [4.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.19.0...v4.20.0) (2021-03-29) **Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [4.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.18.0...v4.19.0) (2021-03-22) +### Bug Fixes +- **typescript-estree:** [ts 4.2] add support for import type equal declaration ([#3189](https://github.com/typescript-eslint/typescript-eslint/issues/3189)) ([6a25faf](https://github.com/typescript-eslint/typescript-eslint/commit/6a25faf5cfa4d21a7546d9866819f4e017308fb2)) - -# [5.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.18.0...v5.19.0) (2022-04-11) +# [4.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.17.0...v4.18.0) (2021-03-15) **Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [4.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.16.1...v4.17.0) (2021-03-08) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures +## [4.16.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.16.0...v4.16.1) (2021-03-01) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures -# [5.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.17.0...v5.18.0) (2022-04-04) +# [4.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.2...v4.16.0) (2021-03-01) -**Note:** Version bump only for package @typescript-eslint/shared-fixtures +### Features +- TypeScript 4.2 syntax support ([#3112](https://github.com/typescript-eslint/typescript-eslint/issues/3112)) ([2ebfb21](https://github.com/typescript-eslint/typescript-eslint/commit/2ebfb21ba6c88c793cfbd0e231e5803b2381694c)) +## [4.15.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.1...v4.15.2) (2021-02-22) +### Bug Fixes +- add missing intrinsic keyword node to AST ([#3081](https://github.com/typescript-eslint/typescript-eslint/issues/3081)) ([409bf0b](https://github.com/typescript-eslint/typescript-eslint/commit/409bf0bb3e2ac4d8782408d436ebdefb42dba38b)) -# [5.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.16.0...v5.17.0) (2022-03-28) +## [4.15.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.0...v4.15.1) (2021-02-15) **Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [4.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.2...v4.15.0) (2021-02-08) +### Features +- **typescript-estree:** improve logic used to escape string literals in jsx ([#2995](https://github.com/typescript-eslint/typescript-eslint/issues/2995)) ([3cb3aad](https://github.com/typescript-eslint/typescript-eslint/commit/3cb3aade2864bab15ed1ff8d7cd32766aa57152f)) - -# [5.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.15.0...v5.16.0) (2022-03-21) +## [4.14.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.1...v4.14.2) (2021-02-01) **Note:** Version bump only for package @typescript-eslint/shared-fixtures +## [4.14.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.0...v4.14.1) (2021-01-25) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [4.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.13.0...v4.14.0) (2021-01-18) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures -# [5.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.14.0...v5.15.0) (2022-03-14) +# [4.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.12.0...v4.13.0) (2021-01-11) **Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [4.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.11.1...v4.12.0) (2021-01-04) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures +## [4.11.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.11.0...v4.11.1) (2020-12-28) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures -# [5.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.13.0...v5.14.0) (2022-03-07) +# [4.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.10.0...v4.11.0) (2020-12-21) **Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [4.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.9.1...v4.10.0) (2020-12-14) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures +## [4.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.9.0...v4.9.1) (2020-12-07) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures -# [5.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.1...v5.13.0) (2022-02-28) +# [4.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.2...v4.9.0) (2020-11-30) **Note:** Version bump only for package @typescript-eslint/shared-fixtures +## [4.8.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.1...v4.8.2) (2020-11-23) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures +## [4.8.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.0...v4.8.1) (2020-11-17) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures -## [5.12.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.0...v5.12.1) (2022-02-21) +# [4.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.7.0...v4.8.0) (2020-11-16) **Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [4.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.6.1...v4.7.0) (2020-11-09) +### Features +- support TS4.1 features ([#2748](https://github.com/typescript-eslint/typescript-eslint/issues/2748)) ([2be354b](https://github.com/typescript-eslint/typescript-eslint/commit/2be354bb15f9013a2da1b13a0c0836e9ef057e16)), closes [#2583](https://github.com/typescript-eslint/typescript-eslint/issues/2583) - -# [5.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.11.0...v5.12.0) (2022-02-14) +## [4.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.6.0...v4.6.1) (2020-11-02) **Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [4.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.5.0...v4.6.0) (2020-10-26) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [4.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.4.1...v4.5.0) (2020-10-19) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures -# [5.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.2...v5.11.0) (2022-02-07) +## [4.4.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.4.0...v4.4.1) (2020-10-12) **Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [4.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.3.0...v4.4.0) (2020-10-05) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - -## [5.10.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.1...v5.10.2) (2022-01-31) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -## [5.10.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.0...v5.10.1) (2022-01-24) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -# [5.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.1...v5.10.0) (2022-01-17) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -## [5.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.0...v5.9.1) (2022-01-10) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -# [5.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.1...v5.9.0) (2022-01-03) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -## [5.8.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.0...v5.8.1) (2021-12-27) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -# [5.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.7.0...v5.8.0) (2021-12-20) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -# [5.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.6.0...v5.7.0) (2021-12-13) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -# [5.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.5.0...v5.6.0) (2021-12-06) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -# [5.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.4.0...v5.5.0) (2021-11-29) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -# [5.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.3.1...v5.4.0) (2021-11-15) - - -### Features - -* **typescript-estree:** support Import Assertions ([#4074](https://github.com/typescript-eslint/typescript-eslint/issues/4074)) ([ae0fb5a](https://github.com/typescript-eslint/typescript-eslint/commit/ae0fb5a591958216b7df656e66b1dfe464898167)) -* **typescript-estree:** support private fields in-in syntax ([#4075](https://github.com/typescript-eslint/typescript-eslint/issues/4075)) ([939d8ea](https://github.com/typescript-eslint/typescript-eslint/commit/939d8eac547fb1734aa00f1ea01cc6eae0b4280a)) -* **typescript-estree:** support type-only module specifiers ([#4076](https://github.com/typescript-eslint/typescript-eslint/issues/4076)) ([77baa92](https://github.com/typescript-eslint/typescript-eslint/commit/77baa9203638e888a76e21003a278a8da386e133)) - - - - - -## [5.3.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.3.0...v5.3.1) (2021-11-08) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -# [5.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.2.0...v5.3.0) (2021-11-01) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -# [5.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.1.0...v5.2.0) (2021-10-25) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -# [5.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.0.0...v5.1.0) (2021-10-18) - - -### Bug Fixes - -* **typescript-estree:** support private optional property definition ([#3997](https://github.com/typescript-eslint/typescript-eslint/issues/3997)) ([8605e08](https://github.com/typescript-eslint/typescript-eslint/commit/8605e080a4dac4a277e6108cd9ed1e5a707302fa)) - - - - - -# [5.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.33.0...v5.0.0) (2021-10-11) - - -### Bug Fixes - -* **typescript-estree:** change `source` of ExportNamedDeclaration to Literal from Expression ([#3763](https://github.com/typescript-eslint/typescript-eslint/issues/3763)) ([dc5a0f5](https://github.com/typescript-eslint/typescript-eslint/commit/dc5a0f5104b400f4422b8d67ecfc6cc7a32613a2)) - - -### Features - -* support `PrivateIdentifier` ([#3808](https://github.com/typescript-eslint/typescript-eslint/issues/3808)) ([0eefe5e](https://github.com/typescript-eslint/typescript-eslint/commit/0eefe5e49d21af3f1e3e2d9a90c2e49929863ac2)), closes [#3430](https://github.com/typescript-eslint/typescript-eslint/issues/3430) [#2933](https://github.com/typescript-eslint/typescript-eslint/issues/2933) -* **eslint-plugin:** removed value from abstract property nodes ([#3765](https://github.com/typescript-eslint/typescript-eslint/issues/3765)) ([5823524](https://github.com/typescript-eslint/typescript-eslint/commit/58235241714596b641a1e8b39c569e561e0039b4)), closes [#3748](https://github.com/typescript-eslint/typescript-eslint/issues/3748) - - - - - -# [4.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.32.0...v4.33.0) (2021-10-04) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -# [4.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.2...v4.32.0) (2021-09-27) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -## [4.31.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.1...v4.31.2) (2021-09-20) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -## [4.31.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.0...v4.31.1) (2021-09-13) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -# [4.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.30.0...v4.31.0) (2021-09-06) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -# [4.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.3...v4.30.0) (2021-08-30) - - -### Features - -* **typescript-estree:** add support for class static blocks ([#3730](https://github.com/typescript-eslint/typescript-eslint/issues/3730)) ([f81831b](https://github.com/typescript-eslint/typescript-eslint/commit/f81831bd279a32da6dbab0f1c061053ea43965f6)) - - - - - -## [4.29.3](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.2...v4.29.3) (2021-08-23) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -## [4.29.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.1...v4.29.2) (2021-08-16) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -## [4.29.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.0...v4.29.1) (2021-08-09) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -# [4.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.5...v4.29.0) (2021-08-02) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -## [4.28.5](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.4...v4.28.5) (2021-07-26) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -## [4.28.4](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.3...v4.28.4) (2021-07-19) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -## [4.28.3](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.2...v4.28.3) (2021-07-12) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -## [4.28.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.1...v4.28.2) (2021-07-05) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -## [4.28.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.0...v4.28.1) (2021-06-28) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -# [4.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.27.0...v4.28.0) (2021-06-21) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -# [4.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.1...v4.27.0) (2021-06-14) - - -### Bug Fixes - -* **typescript-estree:** support override modifier for parameter property ([#3485](https://github.com/typescript-eslint/typescript-eslint/issues/3485)) ([33b9f69](https://github.com/typescript-eslint/typescript-eslint/commit/33b9f69a681cd3219a2acca5b0b2fa67609f099e)) - - - - - -## [4.26.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.0...v4.26.1) (2021-06-07) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -# [4.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.25.0...v4.26.0) (2021-05-31) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -# [4.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.24.0...v4.25.0) (2021-05-24) - - -### Features - -* **typescript-estree:** [TS4.3] support overrides on class members ([#3429](https://github.com/typescript-eslint/typescript-eslint/issues/3429)) ([21d1b62](https://github.com/typescript-eslint/typescript-eslint/commit/21d1b62a0b84b502d2cf12674b3d141994a3ffd4)) -* **typescript-estree:** add support for getter/setter signatures on types ([#3427](https://github.com/typescript-eslint/typescript-eslint/issues/3427)) ([b830b7f](https://github.com/typescript-eslint/typescript-eslint/commit/b830b7f4e8a99affc8af8b53cb83371ef81d7032)), closes [#3272](https://github.com/typescript-eslint/typescript-eslint/issues/3272) [#3272](https://github.com/typescript-eslint/typescript-eslint/issues/3272) - - - - - -# [4.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.23.0...v4.24.0) (2021-05-17) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -# [4.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.1...v4.23.0) (2021-05-10) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -## [4.22.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.0...v4.22.1) (2021-05-04) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -# [4.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.21.0...v4.22.0) (2021-04-12) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -# [4.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.20.0...v4.21.0) (2021-04-05) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -# [4.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.19.0...v4.20.0) (2021-03-29) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -# [4.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.18.0...v4.19.0) (2021-03-22) - - -### Bug Fixes - -* **typescript-estree:** [ts 4.2] add support for import type equal declaration ([#3189](https://github.com/typescript-eslint/typescript-eslint/issues/3189)) ([6a25faf](https://github.com/typescript-eslint/typescript-eslint/commit/6a25faf5cfa4d21a7546d9866819f4e017308fb2)) - - - - - -# [4.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.17.0...v4.18.0) (2021-03-15) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -# [4.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.16.1...v4.17.0) (2021-03-08) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -## [4.16.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.16.0...v4.16.1) (2021-03-01) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -# [4.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.2...v4.16.0) (2021-03-01) - - -### Features - -* TypeScript 4.2 syntax support ([#3112](https://github.com/typescript-eslint/typescript-eslint/issues/3112)) ([2ebfb21](https://github.com/typescript-eslint/typescript-eslint/commit/2ebfb21ba6c88c793cfbd0e231e5803b2381694c)) - - - - - -## [4.15.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.1...v4.15.2) (2021-02-22) - - -### Bug Fixes - -* add missing intrinsic keyword node to AST ([#3081](https://github.com/typescript-eslint/typescript-eslint/issues/3081)) ([409bf0b](https://github.com/typescript-eslint/typescript-eslint/commit/409bf0bb3e2ac4d8782408d436ebdefb42dba38b)) - - - - - -## [4.15.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.0...v4.15.1) (2021-02-15) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -# [4.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.2...v4.15.0) (2021-02-08) - - -### Features - -* **typescript-estree:** improve logic used to escape string literals in jsx ([#2995](https://github.com/typescript-eslint/typescript-eslint/issues/2995)) ([3cb3aad](https://github.com/typescript-eslint/typescript-eslint/commit/3cb3aade2864bab15ed1ff8d7cd32766aa57152f)) - - - - - -## [4.14.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.1...v4.14.2) (2021-02-01) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -## [4.14.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.0...v4.14.1) (2021-01-25) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -# [4.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.13.0...v4.14.0) (2021-01-18) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -# [4.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.12.0...v4.13.0) (2021-01-11) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -# [4.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.11.1...v4.12.0) (2021-01-04) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -## [4.11.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.11.0...v4.11.1) (2020-12-28) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -# [4.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.10.0...v4.11.0) (2020-12-21) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -# [4.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.9.1...v4.10.0) (2020-12-14) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -## [4.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.9.0...v4.9.1) (2020-12-07) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -# [4.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.2...v4.9.0) (2020-11-30) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -## [4.8.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.1...v4.8.2) (2020-11-23) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -## [4.8.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.0...v4.8.1) (2020-11-17) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -# [4.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.7.0...v4.8.0) (2020-11-16) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -# [4.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.6.1...v4.7.0) (2020-11-09) - - -### Features - -* support TS4.1 features ([#2748](https://github.com/typescript-eslint/typescript-eslint/issues/2748)) ([2be354b](https://github.com/typescript-eslint/typescript-eslint/commit/2be354bb15f9013a2da1b13a0c0836e9ef057e16)), closes [#2583](https://github.com/typescript-eslint/typescript-eslint/issues/2583) - - - - - -## [4.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.6.0...v4.6.1) (2020-11-02) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -# [4.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.5.0...v4.6.0) (2020-10-26) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -# [4.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.4.1...v4.5.0) (2020-10-19) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -## [4.4.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.4.0...v4.4.1) (2020-10-12) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -# [4.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.3.0...v4.4.0) (2020-10-05) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -# [4.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.2.0...v4.3.0) (2020-09-28) +# [4.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.2.0...v4.3.0) (2020-09-28) **Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - # [4.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.1...v4.2.0) (2020-09-21) **Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - ## [4.1.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.0...v4.1.1) (2020-09-14) **Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - # [4.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.0.1...v4.1.0) (2020-09-07) **Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - ## [4.0.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.0.0...v4.0.1) (2020-08-31) **Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - # [4.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.10.1...v4.0.0) (2020-08-31) ## [Please see the release notes for v4.0.0](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v4.0.0) **Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - ## [3.10.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.10.0...v3.10.1) (2020-08-25) **Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - # [3.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.9.1...v3.10.0) (2020-08-24) **Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - ## [3.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.9.0...v3.9.1) (2020-08-17) **Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - # [3.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.8.0...v3.9.0) (2020-08-10) - ### Features -* **typescript-estree:** support TSv4 labelled tuple members ([#2378](https://github.com/typescript-eslint/typescript-eslint/issues/2378)) ([00d84ff](https://github.com/typescript-eslint/typescript-eslint/commit/00d84ffbcbe9d0ec98bdb2f2ce59959a27ce4dbe)) - - - - +- **typescript-estree:** support TSv4 labelled tuple members ([#2378](https://github.com/typescript-eslint/typescript-eslint/issues/2378)) ([00d84ff](https://github.com/typescript-eslint/typescript-eslint/commit/00d84ffbcbe9d0ec98bdb2f2ce59959a27ce4dbe)) # [3.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.7.1...v3.8.0) (2020-08-03) **Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - ## [3.7.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.7.0...v3.7.1) (2020-07-27) **Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [3.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.6.1...v3.7.0) (2020-07-20) +### Features +- **typescript-estree:** support short-circuiting assignment operators ([#2307](https://github.com/typescript-eslint/typescript-eslint/issues/2307)) ([2c90d9f](https://github.com/typescript-eslint/typescript-eslint/commit/2c90d9fa3aa5ebd7db697dddb7762bca2dd0e06b)) +- **typescript-estree:** support type annotations on catch clauses ([#2306](https://github.com/typescript-eslint/typescript-eslint/issues/2306)) ([b5afe9c](https://github.com/typescript-eslint/typescript-eslint/commit/b5afe9c560b9f38c8dffc312a600db30944129c8)) - -# [3.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.6.1...v3.7.0) (2020-07-20) - - -### Features - -* **typescript-estree:** support short-circuiting assignment operators ([#2307](https://github.com/typescript-eslint/typescript-eslint/issues/2307)) ([2c90d9f](https://github.com/typescript-eslint/typescript-eslint/commit/2c90d9fa3aa5ebd7db697dddb7762bca2dd0e06b)) -* **typescript-estree:** support type annotations on catch clauses ([#2306](https://github.com/typescript-eslint/typescript-eslint/issues/2306)) ([b5afe9c](https://github.com/typescript-eslint/typescript-eslint/commit/b5afe9c560b9f38c8dffc312a600db30944129c8)) - - - - - -## [3.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.6.0...v3.6.1) (2020-07-13) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -# [3.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.5.0...v3.6.0) (2020-07-06) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -# [3.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.4.0...v3.5.0) (2020-06-29) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -# [3.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.3.0...v3.4.0) (2020-06-22) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -# [3.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.2.0...v3.3.0) (2020-06-15) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -# [3.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.1.0...v3.2.0) (2020-06-08) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -# [3.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.0.2...v3.1.0) (2020-06-01) - - -### Bug Fixes - -* **experimental-utils:** downlevel type declarations for versions older than 3.8 ([#2133](https://github.com/typescript-eslint/typescript-eslint/issues/2133)) ([7925823](https://github.com/typescript-eslint/typescript-eslint/commit/792582326a8065270b69a0ffcaad5a7b4b103ff3)) - - - - - -## [3.0.2](https://github.com/typescript-eslint/typescript-eslint/compare/v3.0.1...v3.0.2) (2020-05-27) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -## [3.0.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.0.0...v3.0.1) (2020-05-25) - - -### Bug Fixes - -* **typescript-estree:** handle `BigInt` with `_` numeric separator ([#2067](https://github.com/typescript-eslint/typescript-eslint/issues/2067)) ([66f1627](https://github.com/typescript-eslint/typescript-eslint/commit/66f1627b11a566d5b925a577e800f99d5c808be2)) - - - - - -# [3.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.34.0...v3.0.0) (2020-05-21) - -## [Please see the release notes for v3.0.0](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v3.0.0) - -### Features - -* **typescript-estree:** align nodes with estree 2020 ([#1389](https://github.com/typescript-eslint/typescript-eslint/issues/1389)) ([aff5b62](https://github.com/typescript-eslint/typescript-eslint/commit/aff5b62044f9b93f2087a1d261e9be3f8d6fd54d)) -* **typescript-estree:** align optional fields ([#1429](https://github.com/typescript-eslint/typescript-eslint/issues/1429)) ([0e0010f](https://github.com/typescript-eslint/typescript-eslint/commit/0e0010f82952f9beeeb84136eea00cc5eecc9db6)) -* **typescript-estree:** handle 3.9's non-null assertion changes ([#2036](https://github.com/typescript-eslint/typescript-eslint/issues/2036)) ([06bec63](https://github.com/typescript-eslint/typescript-eslint/commit/06bec63c56536db070608ab136d2ad57083f0c6a)) - - - - - -# [2.34.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.33.0...v2.34.0) (2020-05-18) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -# [2.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.32.0...v2.33.0) (2020-05-12) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -# [2.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.31.0...v2.32.0) (2020-05-11) - - -### Features - -* bump dependencies and align AST ([#2007](https://github.com/typescript-eslint/typescript-eslint/issues/2007)) ([18668b7](https://github.com/typescript-eslint/typescript-eslint/commit/18668b78fd7d1e5281af7fc26c76e0ca53297f69)) - - - - - -# [2.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.30.0...v2.31.0) (2020-05-04) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -# [2.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.29.0...v2.30.0) (2020-04-27) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -# [2.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.28.0...v2.29.0) (2020-04-20) - -**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - - -# [2.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.27.0...v2.28.0) (2020-04-13) +## [3.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.6.0...v3.6.1) (2020-07-13) **Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [3.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.5.0...v3.6.0) (2020-07-06) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures - - -# [2.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.26.0...v2.27.0) (2020-04-06) +# [3.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.4.0...v3.5.0) (2020-06-29) **Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [3.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.3.0...v3.4.0) (2020-06-22) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [3.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.2.0...v3.3.0) (2020-06-15) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures -# [2.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.25.0...v2.26.0) (2020-03-30) +# [3.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.1.0...v3.2.0) (2020-06-08) **Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [3.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.0.2...v3.1.0) (2020-06-01) +### Bug Fixes +- **experimental-utils:** downlevel type declarations for versions older than 3.8 ([#2133](https://github.com/typescript-eslint/typescript-eslint/issues/2133)) ([7925823](https://github.com/typescript-eslint/typescript-eslint/commit/792582326a8065270b69a0ffcaad5a7b4b103ff3)) - -# [2.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.24.0...v2.25.0) (2020-03-23) +## [3.0.2](https://github.com/typescript-eslint/typescript-eslint/compare/v3.0.1...v3.0.2) (2020-05-27) **Note:** Version bump only for package @typescript-eslint/shared-fixtures +## [3.0.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.0.0...v3.0.1) (2020-05-25) +### Bug Fixes +- **typescript-estree:** handle `BigInt` with `_` numeric separator ([#2067](https://github.com/typescript-eslint/typescript-eslint/issues/2067)) ([66f1627](https://github.com/typescript-eslint/typescript-eslint/commit/66f1627b11a566d5b925a577e800f99d5c808be2)) +# [3.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.34.0...v3.0.0) (2020-05-21) -# [2.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.23.0...v2.24.0) (2020-03-16) - +## [Please see the release notes for v3.0.0](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v3.0.0) ### Features -* **typescript-estree:** support 3.8 `export * as ns` ([#1698](https://github.com/typescript-eslint/typescript-eslint/issues/1698)) ([133f622](https://github.com/typescript-eslint/typescript-eslint/commit/133f622f38a286eac45288a9789d2ee529d5e582)) - +- **typescript-estree:** align nodes with estree 2020 ([#1389](https://github.com/typescript-eslint/typescript-eslint/issues/1389)) ([aff5b62](https://github.com/typescript-eslint/typescript-eslint/commit/aff5b62044f9b93f2087a1d261e9be3f8d6fd54d)) +- **typescript-estree:** align optional fields ([#1429](https://github.com/typescript-eslint/typescript-eslint/issues/1429)) ([0e0010f](https://github.com/typescript-eslint/typescript-eslint/commit/0e0010f82952f9beeeb84136eea00cc5eecc9db6)) +- **typescript-estree:** handle 3.9's non-null assertion changes ([#2036](https://github.com/typescript-eslint/typescript-eslint/issues/2036)) ([06bec63](https://github.com/typescript-eslint/typescript-eslint/commit/06bec63c56536db070608ab136d2ad57083f0c6a)) +# [2.34.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.33.0...v2.34.0) (2020-05-18) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [2.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.32.0...v2.33.0) (2020-05-12) -# [2.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.22.0...v2.23.0) (2020-03-09) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [2.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.31.0...v2.32.0) (2020-05-11) ### Features -* **typescript-estree:** support 3.8 import/export type ([#1697](https://github.com/typescript-eslint/typescript-eslint/issues/1697)) ([625d603](https://github.com/typescript-eslint/typescript-eslint/commit/625d603f94bf0521f834313bf31c734ce4948b7a)) +- bump dependencies and align AST ([#2007](https://github.com/typescript-eslint/typescript-eslint/issues/2007)) ([18668b7](https://github.com/typescript-eslint/typescript-eslint/commit/18668b78fd7d1e5281af7fc26c76e0ca53297f69)) +# [2.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.30.0...v2.31.0) (2020-05-04) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [2.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.29.0...v2.30.0) (2020-04-27) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures -# [2.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.21.0...v2.22.0) (2020-03-02) +# [2.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.28.0...v2.29.0) (2020-04-20) **Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [2.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.27.0...v2.28.0) (2020-04-13) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [2.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.26.0...v2.27.0) (2020-04-06) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures -# [2.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.20.0...v2.21.0) (2020-02-24) +# [2.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.25.0...v2.26.0) (2020-03-30) **Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [2.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.24.0...v2.25.0) (2020-03-23) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [2.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.23.0...v2.24.0) (2020-03-16) +### Features -# [2.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.19.2...v2.20.0) (2020-02-17) +- **typescript-estree:** support 3.8 `export * as ns` ([#1698](https://github.com/typescript-eslint/typescript-eslint/issues/1698)) ([133f622](https://github.com/typescript-eslint/typescript-eslint/commit/133f622f38a286eac45288a9789d2ee529d5e582)) -**Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [2.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.22.0...v2.23.0) (2020-03-09) +### Features +- **typescript-estree:** support 3.8 import/export type ([#1697](https://github.com/typescript-eslint/typescript-eslint/issues/1697)) ([625d603](https://github.com/typescript-eslint/typescript-eslint/commit/625d603f94bf0521f834313bf31c734ce4948b7a)) +# [2.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.21.0...v2.22.0) (2020-03-02) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures -## [2.19.2](https://github.com/typescript-eslint/typescript-eslint/compare/v2.19.1...v2.19.2) (2020-02-10) +# [2.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.20.0...v2.21.0) (2020-02-24) **Note:** Version bump only for package @typescript-eslint/shared-fixtures +# [2.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.19.2...v2.20.0) (2020-02-17) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures +## [2.19.2](https://github.com/typescript-eslint/typescript-eslint/compare/v2.19.1...v2.19.2) (2020-02-10) +**Note:** Version bump only for package @typescript-eslint/shared-fixtures ## [2.19.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.19.0...v2.19.1) (2020-02-10) **Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - # [2.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.18.0...v2.19.0) (2020-02-03) **Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - # [2.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.17.0...v2.18.0) (2020-01-27) - ### Bug Fixes -* **typescript-estree:** fix identifier tokens typed as `Keyword` ([#1487](https://github.com/typescript-eslint/typescript-eslint/issues/1487)) ([77a1caa](https://github.com/typescript-eslint/typescript-eslint/commit/77a1caa562638645b4717449800e410107d512c8)) - - - - +- **typescript-estree:** fix identifier tokens typed as `Keyword` ([#1487](https://github.com/typescript-eslint/typescript-eslint/issues/1487)) ([77a1caa](https://github.com/typescript-eslint/typescript-eslint/commit/77a1caa562638645b4717449800e410107d512c8)) # [2.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.16.0...v2.17.0) (2020-01-20) **Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - # [2.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.15.0...v2.16.0) (2020-01-13) **Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - # [2.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.14.0...v2.15.0) (2020-01-06) **Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - # [2.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.13.0...v2.14.0) (2019-12-30) - ### Bug Fixes -* **typescript-estree:** visit typeParameters in OptionalCallExpr ([#1377](https://github.com/typescript-eslint/typescript-eslint/issues/1377)) ([cba6a2a](https://github.com/typescript-eslint/typescript-eslint/commit/cba6a2a)) - - - - +- **typescript-estree:** visit typeParameters in OptionalCallExpr ([#1377](https://github.com/typescript-eslint/typescript-eslint/issues/1377)) ([cba6a2a](https://github.com/typescript-eslint/typescript-eslint/commit/cba6a2a)) # [2.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.12.0...v2.13.0) (2019-12-23) - ### Features -* **typescript-estree:** computed members discriminated unions ([#1349](https://github.com/typescript-eslint/typescript-eslint/issues/1349)) ([013df9a](https://github.com/typescript-eslint/typescript-eslint/commit/013df9a)) - - - - +- **typescript-estree:** computed members discriminated unions ([#1349](https://github.com/typescript-eslint/typescript-eslint/issues/1349)) ([013df9a](https://github.com/typescript-eslint/typescript-eslint/commit/013df9a)) # [2.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.11.0...v2.12.0) (2019-12-16) **Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - # [2.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.10.0...v2.11.0) (2019-12-09) **Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - # [2.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.9.0...v2.10.0) (2019-12-02) **Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - # [2.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.8.0...v2.9.0) (2019-11-25) **Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - # [2.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.7.0...v2.8.0) (2019-11-18) **Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - # [2.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.6.1...v2.7.0) (2019-11-11) **Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - ## [2.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.6.0...v2.6.1) (2019-11-04) **Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - # [2.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.5.0...v2.6.0) (2019-10-28) - ### Bug Fixes -* **typescript-estree:** correct parenthesized optional chain AST ([#1141](https://github.com/typescript-eslint/typescript-eslint/issues/1141)) ([5ae286e](https://github.com/typescript-eslint/typescript-eslint/commit/5ae286e)) - +- **typescript-estree:** correct parenthesized optional chain AST ([#1141](https://github.com/typescript-eslint/typescript-eslint/issues/1141)) ([5ae286e](https://github.com/typescript-eslint/typescript-eslint/commit/5ae286e)) ### Features -* **typescript-estree:** add support for declare class properties ([#1136](https://github.com/typescript-eslint/typescript-eslint/issues/1136)) ([1508670](https://github.com/typescript-eslint/typescript-eslint/commit/1508670)) - - - - +- **typescript-estree:** add support for declare class properties ([#1136](https://github.com/typescript-eslint/typescript-eslint/issues/1136)) ([1508670](https://github.com/typescript-eslint/typescript-eslint/commit/1508670)) # [2.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.4.0...v2.5.0) (2019-10-21) **Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - # [2.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.3...v2.4.0) (2019-10-14) - ### Features -* **typescript-estree:** support for parsing 3.7 features ([#1045](https://github.com/typescript-eslint/typescript-eslint/issues/1045)) ([623febf](https://github.com/typescript-eslint/typescript-eslint/commit/623febf)) - - - - +- **typescript-estree:** support for parsing 3.7 features ([#1045](https://github.com/typescript-eslint/typescript-eslint/issues/1045)) ([623febf](https://github.com/typescript-eslint/typescript-eslint/commit/623febf)) ## [2.3.3](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.2...v2.3.3) (2019-10-07) **Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - ## [2.3.2](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.1...v2.3.2) (2019-09-30) - ### Bug Fixes -* **typescript-estree:** handle optional computed prop w/o type ([#1026](https://github.com/typescript-eslint/typescript-eslint/issues/1026)) ([95c13fe](https://github.com/typescript-eslint/typescript-eslint/commit/95c13fe)) - - - - +- **typescript-estree:** handle optional computed prop w/o type ([#1026](https://github.com/typescript-eslint/typescript-eslint/issues/1026)) ([95c13fe](https://github.com/typescript-eslint/typescript-eslint/commit/95c13fe)) ## [2.3.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.0...v2.3.1) (2019-09-23) - ### Bug Fixes -* **typescript-estree:** parsing error for await in non-async func ([#988](https://github.com/typescript-eslint/typescript-eslint/issues/988)) ([19abbe0](https://github.com/typescript-eslint/typescript-eslint/commit/19abbe0)) - - - - +- **typescript-estree:** parsing error for await in non-async func ([#988](https://github.com/typescript-eslint/typescript-eslint/issues/988)) ([19abbe0](https://github.com/typescript-eslint/typescript-eslint/commit/19abbe0)) # [2.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.2.0...v2.3.0) (2019-09-16) **Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - # [2.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.1.0...v2.2.0) (2019-09-09) **Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - # [2.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.0.0...v2.1.0) (2019-09-02) **Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - # [2.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.13.0...v2.0.0) (2019-08-13) - ### Bug Fixes -* **typescript-estree:** fix `is` token typed as `Keyword ([#750](https://github.com/typescript-eslint/typescript-eslint/issues/750)) ([35dec52](https://github.com/typescript-eslint/typescript-eslint/commit/35dec52)) -* **typescript-estree:** jsx comment parsing ([#703](https://github.com/typescript-eslint/typescript-eslint/issues/703)) ([0cfc48e](https://github.com/typescript-eslint/typescript-eslint/commit/0cfc48e)) - - - - +- **typescript-estree:** fix `is` token typed as `Keyword ([#750](https://github.com/typescript-eslint/typescript-eslint/issues/750)) ([35dec52](https://github.com/typescript-eslint/typescript-eslint/commit/35dec52)) +- **typescript-estree:** jsx comment parsing ([#703](https://github.com/typescript-eslint/typescript-eslint/issues/703)) ([0cfc48e](https://github.com/typescript-eslint/typescript-eslint/commit/0cfc48e)) # [1.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.12.0...v1.13.0) (2019-07-21) **Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - # [1.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.11.0...v1.12.0) (2019-07-12) - ### Bug Fixes -* **typescript-estree:** fix `async` identifier token typed as `Keyword` ([#681](https://github.com/typescript-eslint/typescript-eslint/issues/681)) ([6de19d3](https://github.com/typescript-eslint/typescript-eslint/commit/6de19d3)) - - - - +- **typescript-estree:** fix `async` identifier token typed as `Keyword` ([#681](https://github.com/typescript-eslint/typescript-eslint/issues/681)) ([6de19d3](https://github.com/typescript-eslint/typescript-eslint/commit/6de19d3)) # [1.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.10.2...v1.11.0) (2019-06-23) - ### Bug Fixes -* **typescript-estree:** fix more cases with double slash in JSX text ([#607](https://github.com/typescript-eslint/typescript-eslint/issues/607)) ([34cfa53](https://github.com/typescript-eslint/typescript-eslint/commit/34cfa53)) - - - - +- **typescript-estree:** fix more cases with double slash in JSX text ([#607](https://github.com/typescript-eslint/typescript-eslint/issues/607)) ([34cfa53](https://github.com/typescript-eslint/typescript-eslint/commit/34cfa53)) ## [1.10.2](https://github.com/typescript-eslint/typescript-eslint/compare/v1.10.1...v1.10.2) (2019-06-10) **Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - ## [1.10.1](https://github.com/typescript-eslint/typescript-eslint/compare/v1.10.0...v1.10.1) (2019-06-09) **Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - # [1.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.9.0...v1.10.0) (2019-06-09) - ### Bug Fixes -* **typescript-estree:** stop ignoring comments in JSX with generic ([#596](https://github.com/typescript-eslint/typescript-eslint/issues/596)) ([31d5bd4](https://github.com/typescript-eslint/typescript-eslint/commit/31d5bd4)) - - - - +- **typescript-estree:** stop ignoring comments in JSX with generic ([#596](https://github.com/typescript-eslint/typescript-eslint/issues/596)) ([31d5bd4](https://github.com/typescript-eslint/typescript-eslint/commit/31d5bd4)) # [1.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.8.0...v1.9.0) (2019-05-12) **Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - # [1.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.7.0...v1.8.0) (2019-05-10) **Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - # [1.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.6.0...v1.7.0) (2019-04-20) **Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - # [1.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.5.0...v1.6.0) (2019-04-03) - ### Features -* change TypeScript version range to >=3.2.1 <3.5.0 ([#399](https://github.com/typescript-eslint/typescript-eslint/issues/399)) ([a4f95d3](https://github.com/typescript-eslint/typescript-eslint/commit/a4f95d3)) - - - - +- change TypeScript version range to >=3.2.1 <3.5.0 ([#399](https://github.com/typescript-eslint/typescript-eslint/issues/399)) ([a4f95d3](https://github.com/typescript-eslint/typescript-eslint/commit/a4f95d3)) # [1.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.4.2...v1.5.0) (2019-03-20) **Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - ## [1.4.2](https://github.com/typescript-eslint/typescript-eslint/compare/v1.4.1...v1.4.2) (2019-02-25) **Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - ## [1.4.1](https://github.com/typescript-eslint/typescript-eslint/compare/v1.4.0...v1.4.1) (2019-02-23) **Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - # [1.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.3.0...v1.4.0) (2019-02-19) - ### Features -* **ts-estree:** fix parsing nested sequence expressions ([#286](https://github.com/typescript-eslint/typescript-eslint/issues/286)) ([ecc9631](https://github.com/typescript-eslint/typescript-eslint/commit/ecc9631)) - - - - +- **ts-estree:** fix parsing nested sequence expressions ([#286](https://github.com/typescript-eslint/typescript-eslint/issues/286)) ([ecc9631](https://github.com/typescript-eslint/typescript-eslint/commit/ecc9631)) # [1.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.2.0...v1.3.0) (2019-02-07) - ### Bug Fixes -* **ts-estree:** align typeArguments and typeParameters across nodes ([#223](https://github.com/typescript-eslint/typescript-eslint/issues/223)) ([3306198](https://github.com/typescript-eslint/typescript-eslint/commit/3306198)) - +- **ts-estree:** align typeArguments and typeParameters across nodes ([#223](https://github.com/typescript-eslint/typescript-eslint/issues/223)) ([3306198](https://github.com/typescript-eslint/typescript-eslint/commit/3306198)) ### Features -* **ts-estree:** enable errors 1098 and 1099 ([#219](https://github.com/typescript-eslint/typescript-eslint/issues/219)) ([fc50167](https://github.com/typescript-eslint/typescript-eslint/commit/fc50167)) - - - - +- **ts-estree:** enable errors 1098 and 1099 ([#219](https://github.com/typescript-eslint/typescript-eslint/issues/219)) ([fc50167](https://github.com/typescript-eslint/typescript-eslint/commit/fc50167)) # [1.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.1.1...v1.2.0) (2019-02-01) **Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - ## [1.1.1](https://github.com/typescript-eslint/typescript-eslint/compare/v1.1.0...v1.1.1) (2019-01-29) **Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - # [1.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.0.0...v1.1.0) (2019-01-23) - ### Bug Fixes -* **typescript-estree:** correct range of parameters with comments ([#128](https://github.com/typescript-eslint/typescript-eslint/issues/128)) ([91eedf2](https://github.com/typescript-eslint/typescript-eslint/commit/91eedf2)) - - - - +- **typescript-estree:** correct range of parameters with comments ([#128](https://github.com/typescript-eslint/typescript-eslint/issues/128)) ([91eedf2](https://github.com/typescript-eslint/typescript-eslint/commit/91eedf2)) # [1.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v0.2.1...v1.0.0) (2019-01-20) **Note:** Version bump only for package @typescript-eslint/shared-fixtures - - - - ## [0.2.1](https://github.com/typescript-eslint/typescript-eslint/compare/v0.2.0...v0.2.1) (2019-01-20) **Note:** Version bump only for package @typescript-eslint/shared-fixtures diff --git a/packages/shared-fixtures/README.md b/packages/shared-fixtures/README.md index 866a6e86614..eb3bceabc7f 100644 --- a/packages/shared-fixtures/README.md +++ b/packages/shared-fixtures/README.md @@ -1,7 +1,10 @@ -

Fixtures for Testing typescript-eslint

+# `@typescript-eslint/shared-fixtures` -

Code fixtures used to test the parser. This is not intended for external use.

+> Code fixtures used to test the `typescript-estree` parser. -

- CI -

+## ✋ Internal Package + +This is an _internal package_ to the [typescript-eslint monorepo](https://github.com/typescript-eslint/typescript-eslint). +You likely don't want to use it directly. + +👉 See **https://typescript-eslint.io** for docs on typescript-eslint. diff --git a/packages/shared-fixtures/package.json b/packages/shared-fixtures/package.json index 08055413546..fe37cc39921 100644 --- a/packages/shared-fixtures/package.json +++ b/packages/shared-fixtures/package.json @@ -1,5 +1,6 @@ { + "description": "Code fixtures used to test the typescript-estree parser.", "name": "@typescript-eslint/shared-fixtures", - "version": "5.39.0", + "version": "5.46.1", "private": true } diff --git a/packages/shared-fixtures/project.json b/packages/shared-fixtures/project.json index b100b1e4ba7..18cfac97135 100644 --- a/packages/shared-fixtures/project.json +++ b/packages/shared-fixtures/project.json @@ -1,5 +1,6 @@ { - "root": "packages/shared-fixtures", + "$schema": "../../node_modules/nx/schemas/project-schema.json", "type": "library", - "implicitDependencies": [] + "implicitDependencies": [], + "name": "shared-fixtures" } diff --git a/packages/type-utils/CHANGELOG.md b/packages/type-utils/CHANGELOG.md index ad834ddc3d7..8ef63cde40c 100644 --- a/packages/type-utils/CHANGELOG.md +++ b/packages/type-utils/CHANGELOG.md @@ -3,412 +3,264 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -# [5.39.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.1...v5.39.0) (2022-10-03) +## [5.46.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.46.0...v5.46.1) (2022-12-12) **Note:** Version bump only for package @typescript-eslint/type-utils +# [5.46.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.45.1...v5.46.0) (2022-12-08) +**Note:** Version bump only for package @typescript-eslint/type-utils +## [5.45.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.45.0...v5.45.1) (2022-12-05) +**Note:** Version bump only for package @typescript-eslint/type-utils -## [5.38.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.0...v5.38.1) (2022-09-26) +# [5.45.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.44.0...v5.45.0) (2022-11-28) **Note:** Version bump only for package @typescript-eslint/type-utils +# [5.44.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.43.0...v5.44.0) (2022-11-21) +**Note:** Version bump only for package @typescript-eslint/type-utils - - -# [5.38.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.37.0...v5.38.0) (2022-09-19) +# [5.43.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.1...v5.43.0) (2022-11-14) **Note:** Version bump only for package @typescript-eslint/type-utils +## [5.42.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.0...v5.42.1) (2022-11-07) +### Bug Fixes +- **eslint-plugin:** isTypeReadonly stack overflow ([#5875](https://github.com/typescript-eslint/typescript-eslint/issues/5875)) ([#5876](https://github.com/typescript-eslint/typescript-eslint/issues/5876)) ([2d9a33c](https://github.com/typescript-eslint/typescript-eslint/commit/2d9a33cfb2db53d76246a59253daaf2abb19ee57)) - -# [5.37.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.2...v5.37.0) (2022-09-12) +# [5.42.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.41.0...v5.42.0) (2022-10-31) **Note:** Version bump only for package @typescript-eslint/type-utils +# [5.41.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.1...v5.41.0) (2022-10-24) +### Bug Fixes +- **type-utils:** prevent stack overflow in `isTypeReadonly` ([#5860](https://github.com/typescript-eslint/typescript-eslint/issues/5860)) ([a6d8f7e](https://github.com/typescript-eslint/typescript-eslint/commit/a6d8f7edb84f9f6dd59a76faf53bf686756e2aed)), closes [#4476](https://github.com/typescript-eslint/typescript-eslint/issues/4476) - -## [5.36.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.1...v5.36.2) (2022-09-05) +## [5.40.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.0...v5.40.1) (2022-10-17) **Note:** Version bump only for package @typescript-eslint/type-utils +# [5.40.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.39.0...v5.40.0) (2022-10-10) +**Note:** Version bump only for package @typescript-eslint/type-utils +# [5.39.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.1...v5.39.0) (2022-10-03) +**Note:** Version bump only for package @typescript-eslint/type-utils -## [5.36.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.0...v5.36.1) (2022-08-30) +## [5.38.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.0...v5.38.1) (2022-09-26) **Note:** Version bump only for package @typescript-eslint/type-utils +# [5.38.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.37.0...v5.38.0) (2022-09-19) +**Note:** Version bump only for package @typescript-eslint/type-utils +# [5.37.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.2...v5.37.0) (2022-09-12) +**Note:** Version bump only for package @typescript-eslint/type-utils -# [5.36.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.1...v5.36.0) (2022-08-30) - +## [5.36.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.1...v5.36.2) (2022-09-05) -### Features +**Note:** Version bump only for package @typescript-eslint/type-utils -* support TypeScript 4.8 ([#5551](https://github.com/typescript-eslint/typescript-eslint/issues/5551)) ([81450ed](https://github.com/typescript-eslint/typescript-eslint/commit/81450ed7eaede74b384e9a91a84e9b4d34513866)) +## [5.36.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.0...v5.36.1) (2022-08-30) +**Note:** Version bump only for package @typescript-eslint/type-utils +# [5.36.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.1...v5.36.0) (2022-08-30) +### Features +- support TypeScript 4.8 ([#5551](https://github.com/typescript-eslint/typescript-eslint/issues/5551)) ([81450ed](https://github.com/typescript-eslint/typescript-eslint/commit/81450ed7eaede74b384e9a91a84e9b4d34513866)) ## [5.35.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.0...v5.35.1) (2022-08-24) **Note:** Version bump only for package @typescript-eslint/type-utils - - - - # [5.35.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.34.0...v5.35.0) (2022-08-24) **Note:** Version bump only for package @typescript-eslint/type-utils - - - - # [5.34.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.1...v5.34.0) (2022-08-22) **Note:** Version bump only for package @typescript-eslint/type-utils - - - - ## [5.33.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.0...v5.33.1) (2022-08-15) **Note:** Version bump only for package @typescript-eslint/type-utils - - - - # [5.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.32.0...v5.33.0) (2022-08-08) **Note:** Version bump only for package @typescript-eslint/type-utils - - - - # [5.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.31.0...v5.32.0) (2022-08-01) **Note:** Version bump only for package @typescript-eslint/type-utils - - - - # [5.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.7...v5.31.0) (2022-07-25) **Note:** Version bump only for package @typescript-eslint/type-utils - - - - ## [5.30.7](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.6...v5.30.7) (2022-07-18) **Note:** Version bump only for package @typescript-eslint/type-utils - - - - ## [5.30.6](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.5...v5.30.6) (2022-07-11) **Note:** Version bump only for package @typescript-eslint/type-utils - - - - ## [5.30.5](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.4...v5.30.5) (2022-07-04) **Note:** Version bump only for package @typescript-eslint/type-utils - - - - ## [5.30.4](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.3...v5.30.4) (2022-07-03) **Note:** Version bump only for package @typescript-eslint/type-utils - - - - ## [5.30.3](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.2...v5.30.3) (2022-07-01) **Note:** Version bump only for package @typescript-eslint/type-utils - - - - ## [5.30.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.1...v5.30.2) (2022-07-01) **Note:** Version bump only for package @typescript-eslint/type-utils - - - - ## 5.30.1 (2022-07-01) **Note:** Version bump only for package @typescript-eslint/type-utils - - - - # [5.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.29.0...v5.30.0) (2022-06-27) **Note:** Version bump only for package @typescript-eslint/type-utils - - - - # [5.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.28.0...v5.29.0) (2022-06-20) **Note:** Version bump only for package @typescript-eslint/type-utils - - - - # [5.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.1...v5.28.0) (2022-06-13) **Note:** Version bump only for package @typescript-eslint/type-utils - - - - ## [5.27.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.0...v5.27.1) (2022-06-06) **Note:** Version bump only for package @typescript-eslint/type-utils - - - - # [5.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.26.0...v5.27.0) (2022-05-30) - ### Features -* [4.7] support new extensions ([#5027](https://github.com/typescript-eslint/typescript-eslint/issues/5027)) ([efc147b](https://github.com/typescript-eslint/typescript-eslint/commit/efc147b04dce52ab17415b6a4ae4076b944b9036)) - - - - +- [4.7] support new extensions ([#5027](https://github.com/typescript-eslint/typescript-eslint/issues/5027)) ([efc147b](https://github.com/typescript-eslint/typescript-eslint/commit/efc147b04dce52ab17415b6a4ae4076b944b9036)) # [5.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.25.0...v5.26.0) (2022-05-23) **Note:** Version bump only for package @typescript-eslint/type-utils - - - - # [5.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.24.0...v5.25.0) (2022-05-17) **Note:** Version bump only for package @typescript-eslint/type-utils - - - - # [5.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.23.0...v5.24.0) (2022-05-16) **Note:** Version bump only for package @typescript-eslint/type-utils - - - - # [5.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.22.0...v5.23.0) (2022-05-09) **Note:** Version bump only for package @typescript-eslint/type-utils - - - - # [5.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.21.0...v5.22.0) (2022-05-02) **Note:** Version bump only for package @typescript-eslint/type-utils - - - - # [5.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.20.0...v5.21.0) (2022-04-25) **Note:** Version bump only for package @typescript-eslint/type-utils - - - - # [5.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.19.0...v5.20.0) (2022-04-18) **Note:** Version bump only for package @typescript-eslint/type-utils - - - - # [5.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.18.0...v5.19.0) (2022-04-11) **Note:** Version bump only for package @typescript-eslint/type-utils - - - - # [5.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.17.0...v5.18.0) (2022-04-04) **Note:** Version bump only for package @typescript-eslint/type-utils - - - - # [5.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.16.0...v5.17.0) (2022-03-28) **Note:** Version bump only for package @typescript-eslint/type-utils - - - - # [5.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.15.0...v5.16.0) (2022-03-21) **Note:** Version bump only for package @typescript-eslint/type-utils - - - - # [5.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.14.0...v5.15.0) (2022-03-14) **Note:** Version bump only for package @typescript-eslint/type-utils - - - - # [5.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.13.0...v5.14.0) (2022-03-07) - ### Bug Fixes -* **eslint-plugin:** [prefer-readonly-parameter-types] handle class sharp private field and member without throwing error ([#4343](https://github.com/typescript-eslint/typescript-eslint/issues/4343)) ([a65713a](https://github.com/typescript-eslint/typescript-eslint/commit/a65713ae138e56555d01a9e8e5179221a2f39e75)) - - - - +- **eslint-plugin:** [prefer-readonly-parameter-types] handle class sharp private field and member without throwing error ([#4343](https://github.com/typescript-eslint/typescript-eslint/issues/4343)) ([a65713a](https://github.com/typescript-eslint/typescript-eslint/commit/a65713ae138e56555d01a9e8e5179221a2f39e75)) # [5.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.1...v5.13.0) (2022-02-28) - ### Features -* **eslint-plugin:** add `no-redundant-type-constituents` rule ([#4378](https://github.com/typescript-eslint/typescript-eslint/issues/4378)) ([63d051e](https://github.com/typescript-eslint/typescript-eslint/commit/63d051eed29dcf71015a23992feac0a8f92717a0)) - - - - +- **eslint-plugin:** add `no-redundant-type-constituents` rule ([#4378](https://github.com/typescript-eslint/typescript-eslint/issues/4378)) ([63d051e](https://github.com/typescript-eslint/typescript-eslint/commit/63d051eed29dcf71015a23992feac0a8f92717a0)) ## [5.12.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.0...v5.12.1) (2022-02-21) - ### Bug Fixes -* **eslint-plugin:** [no-unnecessary-type-arguments] fix comparison of types ([#4555](https://github.com/typescript-eslint/typescript-eslint/issues/4555)) ([fc3936e](https://github.com/typescript-eslint/typescript-eslint/commit/fc3936e99712374a707ce9e0101bc641807b9ea6)) - - - - +- **eslint-plugin:** [no-unnecessary-type-arguments] fix comparison of types ([#4555](https://github.com/typescript-eslint/typescript-eslint/issues/4555)) ([fc3936e](https://github.com/typescript-eslint/typescript-eslint/commit/fc3936e99712374a707ce9e0101bc641807b9ea6)) # [5.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.11.0...v5.12.0) (2022-02-14) **Note:** Version bump only for package @typescript-eslint/type-utils - - - - # [5.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.2...v5.11.0) (2022-02-07) **Note:** Version bump only for package @typescript-eslint/type-utils - - - - ## [5.10.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.1...v5.10.2) (2022-01-31) **Note:** Version bump only for package @typescript-eslint/type-utils - - - - ## [5.10.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.0...v5.10.1) (2022-01-24) **Note:** Version bump only for package @typescript-eslint/type-utils - - - - # [5.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.1...v5.10.0) (2022-01-17) - ### Bug Fixes -* **type-utils:** check IndexSignature internals when checking isTypeReadonly ([#4417](https://github.com/typescript-eslint/typescript-eslint/issues/4417)) ([ef3147c](https://github.com/typescript-eslint/typescript-eslint/commit/ef3147cf73767ddece91ce57f6028a83ce074b60)), closes [#4410](https://github.com/typescript-eslint/typescript-eslint/issues/4410) [#3714](https://github.com/typescript-eslint/typescript-eslint/issues/3714) -* **type-utils:** intersection types involving readonly arrays are now handled in most cases ([#4429](https://github.com/typescript-eslint/typescript-eslint/issues/4429)) ([5046882](https://github.com/typescript-eslint/typescript-eslint/commit/5046882025e3bc8cb122ecef703aebd0b5e79017)) -* **type-utils:** isTypeReadonly now handles conditional types ([#4421](https://github.com/typescript-eslint/typescript-eslint/issues/4421)) ([39a6806](https://github.com/typescript-eslint/typescript-eslint/commit/39a6806c61a48bbca93f9ffb965dd8b3fe0575b3)) -* **type-utils:** union types always being marked as readonly ([#4419](https://github.com/typescript-eslint/typescript-eslint/issues/4419)) ([99ab193](https://github.com/typescript-eslint/typescript-eslint/commit/99ab193bb02f181bed4ed917b1d121ed189d3fe4)) - +- **type-utils:** check IndexSignature internals when checking isTypeReadonly ([#4417](https://github.com/typescript-eslint/typescript-eslint/issues/4417)) ([ef3147c](https://github.com/typescript-eslint/typescript-eslint/commit/ef3147cf73767ddece91ce57f6028a83ce074b60)), closes [#4410](https://github.com/typescript-eslint/typescript-eslint/issues/4410) [#3714](https://github.com/typescript-eslint/typescript-eslint/issues/3714) +- **type-utils:** intersection types involving readonly arrays are now handled in most cases ([#4429](https://github.com/typescript-eslint/typescript-eslint/issues/4429)) ([5046882](https://github.com/typescript-eslint/typescript-eslint/commit/5046882025e3bc8cb122ecef703aebd0b5e79017)) +- **type-utils:** isTypeReadonly now handles conditional types ([#4421](https://github.com/typescript-eslint/typescript-eslint/issues/4421)) ([39a6806](https://github.com/typescript-eslint/typescript-eslint/commit/39a6806c61a48bbca93f9ffb965dd8b3fe0575b3)) +- **type-utils:** union types always being marked as readonly ([#4419](https://github.com/typescript-eslint/typescript-eslint/issues/4419)) ([99ab193](https://github.com/typescript-eslint/typescript-eslint/commit/99ab193bb02f181bed4ed917b1d121ed189d3fe4)) ### Features -* rename `experimental-utils` to `utils` and make `experimental-utils` an alias to the new package ([#4172](https://github.com/typescript-eslint/typescript-eslint/issues/4172)) ([1d55a75](https://github.com/typescript-eslint/typescript-eslint/commit/1d55a7511b38d8e2b2eabe59f639e0a865e6c93f)) -* **type-utils:** make isTypeReadonly's options param optional ([#4415](https://github.com/typescript-eslint/typescript-eslint/issues/4415)) ([3a07a56](https://github.com/typescript-eslint/typescript-eslint/commit/3a07a563c987ff25f6cd8925eeeb2ede47cc19e8)) - - - - +- rename `experimental-utils` to `utils` and make `experimental-utils` an alias to the new package ([#4172](https://github.com/typescript-eslint/typescript-eslint/issues/4172)) ([1d55a75](https://github.com/typescript-eslint/typescript-eslint/commit/1d55a7511b38d8e2b2eabe59f639e0a865e6c93f)) +- **type-utils:** make isTypeReadonly's options param optional ([#4415](https://github.com/typescript-eslint/typescript-eslint/issues/4415)) ([3a07a56](https://github.com/typescript-eslint/typescript-eslint/commit/3a07a563c987ff25f6cd8925eeeb2ede47cc19e8)) ## [5.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.0...v5.9.1) (2022-01-10) **Note:** Version bump only for package @typescript-eslint/type-utils - - - - # [5.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.1...v5.9.0) (2022-01-03) - ### Features -* **experimental-utils:** move isTypeReadonly from eslint-plugin to experimental-utils ([#3658](https://github.com/typescript-eslint/typescript-eslint/issues/3658)) ([a9eb0b9](https://github.com/typescript-eslint/typescript-eslint/commit/a9eb0b9eb2db291ea36065ec34f84bf5c5504b43)) +- **experimental-utils:** move isTypeReadonly from eslint-plugin to experimental-utils ([#3658](https://github.com/typescript-eslint/typescript-eslint/issues/3658)) ([a9eb0b9](https://github.com/typescript-eslint/typescript-eslint/commit/a9eb0b9eb2db291ea36065ec34f84bf5c5504b43)) diff --git a/packages/type-utils/LICENSE b/packages/type-utils/LICENSE index 7641edcfd0a..dabd464af3a 100644 --- a/packages/type-utils/LICENSE +++ b/packages/type-utils/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2021 TypeScript ESLint and other contributors +Copyright (c) 2021 typescript-eslint and other contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/type-utils/README.md b/packages/type-utils/README.md index 19a4bf7e964..2f842e803cc 100644 --- a/packages/type-utils/README.md +++ b/packages/type-utils/README.md @@ -1,15 +1,12 @@ -

Type utils for ESLint Plugins

+# `@typescript-eslint/type-utils` -

Type utilities for working with TypeScript within ESLint rules.

+> Type utilities for working with TypeScript within ESLint rules. -

- CI - NPM Version - NPM Downloads -

+The utilities in this package are separated from `@typescript-eslint/utils` so that that package does not require a dependency on `typescript`. -This utilities in this package are separated from `@typescript-eslint/utils` so that that package does not require a dependency on `typescript`. +## ✋ Internal Package -## Contributing +This is an _internal package_ to the [typescript-eslint monorepo](https://github.com/typescript-eslint/typescript-eslint). +You likely don't want to use it directly. -[See the contributing guide here](../../CONTRIBUTING.md) +👉 See **https://typescript-eslint.io** for docs on typescript-eslint. diff --git a/packages/type-utils/package.json b/packages/type-utils/package.json index 842c2288795..6b4acb042ba 100644 --- a/packages/type-utils/package.json +++ b/packages/type-utils/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/type-utils", - "version": "5.39.0", + "version": "5.46.1", "description": "Type utilities for working with TypeScript + ESLint together", "keywords": [ "eslint", @@ -34,18 +34,18 @@ "clean": "tsc -b tsconfig.build.json --clean", "postclean": "rimraf dist && rimraf _ts3.4 && rimraf coverage", "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", - "lint": "eslint . --ignore-path='../../.eslintignore'", + "lint": "nx lint", "test": "jest --coverage", "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/typescript-estree": "5.39.0", - "@typescript-eslint/utils": "5.39.0", + "@typescript-eslint/typescript-estree": "5.46.1", + "@typescript-eslint/utils": "5.46.1", "debug": "^4.3.4", "tsutils": "^3.21.0" }, "devDependencies": { - "@typescript-eslint/parser": "5.39.0", + "@typescript-eslint/parser": "5.46.1", "typescript": "*" }, "peerDependencies": { diff --git a/packages/type-utils/project.json b/packages/type-utils/project.json index fea4ee94ee4..77fdd9b5fce 100644 --- a/packages/type-utils/project.json +++ b/packages/type-utils/project.json @@ -1,5 +1,15 @@ { - "root": "packages/type-utils", + "name": "type-utils", + "$schema": "../../node_modules/nx/schemas/project-schema.json", "type": "library", - "implicitDependencies": [] + "implicitDependencies": [], + "targets": { + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["packages/type-utils/**/*.ts"] + } + } + } } diff --git a/packages/type-utils/src/isTypeReadonly.ts b/packages/type-utils/src/isTypeReadonly.ts index 42dcc2ce907..7ba2b300089 100644 --- a/packages/type-utils/src/isTypeReadonly.ts +++ b/packages/type-utils/src/isTypeReadonly.ts @@ -113,6 +113,10 @@ function isTypeReadonlyObject( return Readonlyness.Mutable; } + if (indexInfo.type === type || seenTypes.has(indexInfo.type)) { + return Readonlyness.Readonly; + } + return isTypeReadonlyRecurser( checker, indexInfo.type, diff --git a/packages/type-utils/tests/isTypeReadonly.test.ts b/packages/type-utils/tests/isTypeReadonly.test.ts index 60d822b57a1..382091a2375 100644 --- a/packages/type-utils/tests/isTypeReadonly.test.ts +++ b/packages/type-utils/tests/isTypeReadonly.test.ts @@ -134,6 +134,18 @@ describe('isTypeReadonly', () => { ); }); + describe('is readonly circular', () => { + const runTests = runTestIsReadonly; + + it('handles circular readonly PropertySignature inside a readonly IndexSignature', () => + runTests('interface Test { readonly [key: string]: Test };')); + + it('handles circular readonly PropertySignature inside interdependent objects', () => + runTests( + 'interface Test1 { readonly [key: string]: Test } interface Test { readonly [key: string]: Test1 }', + )); + }); + describe('is not readonly', () => { const runTests = runTestIsNotReadonly; @@ -145,6 +157,28 @@ describe('isTypeReadonly', () => { runTests, ); }); + + describe('is not readonly circular', () => { + const runTests = runTestIsNotReadonly; + + it('handles circular mutable PropertySignature', () => + runTests('interface Test { [key: string]: Test };')); + + it.each([ + [ + 'interface Test1 { [key: string]: Test } interface Test { readonly [key: string]: Test1 }', + ], + [ + 'interface Test1 { readonly [key: string]: Test } interface Test { [key: string]: Test1 }', + ], + [ + 'interface Test1 { [key: string]: Test } interface Test { [key: string]: Test1 }', + ], + ])( + 'handles circular mutable PropertySignature inside interdependent objects', + runTests, + ); + }); }); describe('Union', () => { diff --git a/packages/types/CHANGELOG.md b/packages/types/CHANGELOG.md index 517153ab601..3350b0f5470 100644 --- a/packages/types/CHANGELOG.md +++ b/packages/types/CHANGELOG.md @@ -3,1134 +3,642 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -# [5.39.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.1...v5.39.0) (2022-10-03) +## [5.46.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.46.0...v5.46.1) (2022-12-12) **Note:** Version bump only for package @typescript-eslint/types +# [5.46.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.45.1...v5.46.0) (2022-12-08) +**Note:** Version bump only for package @typescript-eslint/types +## [5.45.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.45.0...v5.45.1) (2022-12-05) +**Note:** Version bump only for package @typescript-eslint/types -## [5.38.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.0...v5.38.1) (2022-09-26) +# [5.45.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.44.0...v5.45.0) (2022-11-28) **Note:** Version bump only for package @typescript-eslint/types +# [5.44.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.43.0...v5.44.0) (2022-11-21) +### Features +- update to TypeScript 4.9 ([#5716](https://github.com/typescript-eslint/typescript-eslint/issues/5716)) ([4d744ea](https://github.com/typescript-eslint/typescript-eslint/commit/4d744ea10ba03c66eebcb63e8722e9f0165fbeed)) - -# [5.38.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.37.0...v5.38.0) (2022-09-19) +# [5.43.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.1...v5.43.0) (2022-11-14) **Note:** Version bump only for package @typescript-eslint/types +## [5.42.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.0...v5.42.1) (2022-11-07) +**Note:** Version bump only for package @typescript-eslint/types +# [5.42.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.41.0...v5.42.0) (2022-10-31) +**Note:** Version bump only for package @typescript-eslint/types -# [5.37.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.2...v5.37.0) (2022-09-12) +# [5.41.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.1...v5.41.0) (2022-10-24) **Note:** Version bump only for package @typescript-eslint/types +## [5.40.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.0...v5.40.1) (2022-10-17) +**Note:** Version bump only for package @typescript-eslint/types +# [5.40.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.39.0...v5.40.0) (2022-10-10) +**Note:** Version bump only for package @typescript-eslint/types -## [5.36.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.1...v5.36.2) (2022-09-05) +# [5.39.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.1...v5.39.0) (2022-10-03) **Note:** Version bump only for package @typescript-eslint/types +## [5.38.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.0...v5.38.1) (2022-09-26) +**Note:** Version bump only for package @typescript-eslint/types +# [5.38.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.37.0...v5.38.0) (2022-09-19) +**Note:** Version bump only for package @typescript-eslint/types -## [5.36.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.0...v5.36.1) (2022-08-30) +# [5.37.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.2...v5.37.0) (2022-09-12) **Note:** Version bump only for package @typescript-eslint/types +## [5.36.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.1...v5.36.2) (2022-09-05) +**Note:** Version bump only for package @typescript-eslint/types +## [5.36.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.0...v5.36.1) (2022-08-30) +**Note:** Version bump only for package @typescript-eslint/types # [5.36.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.1...v5.36.0) (2022-08-30) - ### Features -* support TypeScript 4.8 ([#5551](https://github.com/typescript-eslint/typescript-eslint/issues/5551)) ([81450ed](https://github.com/typescript-eslint/typescript-eslint/commit/81450ed7eaede74b384e9a91a84e9b4d34513866)) - - - - +- support TypeScript 4.8 ([#5551](https://github.com/typescript-eslint/typescript-eslint/issues/5551)) ([81450ed](https://github.com/typescript-eslint/typescript-eslint/commit/81450ed7eaede74b384e9a91a84e9b4d34513866)) ## [5.35.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.0...v5.35.1) (2022-08-24) **Note:** Version bump only for package @typescript-eslint/types - - - - # [5.35.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.34.0...v5.35.0) (2022-08-24) **Note:** Version bump only for package @typescript-eslint/types - - - - # [5.34.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.1...v5.34.0) (2022-08-22) - ### Features -* **types:** add unbound property in parser options ([#5419](https://github.com/typescript-eslint/typescript-eslint/issues/5419)) ([e08a9dd](https://github.com/typescript-eslint/typescript-eslint/commit/e08a9dd79365c1b1f5d0145ab69377f7d45f8a4f)) - - - - +- **types:** add unbound property in parser options ([#5419](https://github.com/typescript-eslint/typescript-eslint/issues/5419)) ([e08a9dd](https://github.com/typescript-eslint/typescript-eslint/commit/e08a9dd79365c1b1f5d0145ab69377f7d45f8a4f)) ## [5.33.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.0...v5.33.1) (2022-08-15) **Note:** Version bump only for package @typescript-eslint/types - - - - # [5.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.32.0...v5.33.0) (2022-08-08) **Note:** Version bump only for package @typescript-eslint/types - - - - # [5.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.31.0...v5.32.0) (2022-08-01) **Note:** Version bump only for package @typescript-eslint/types - - - - # [5.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.7...v5.31.0) (2022-07-25) **Note:** Version bump only for package @typescript-eslint/types - - - - ## [5.30.7](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.6...v5.30.7) (2022-07-18) - ### Bug Fixes -* expose types supporting old versions of typescript ([#5339](https://github.com/typescript-eslint/typescript-eslint/issues/5339)) ([4ba9bdb](https://github.com/typescript-eslint/typescript-eslint/commit/4ba9bdb93f87e6bc370f13aa1de48f435abe3f88)) - - - - +- expose types supporting old versions of typescript ([#5339](https://github.com/typescript-eslint/typescript-eslint/issues/5339)) ([4ba9bdb](https://github.com/typescript-eslint/typescript-eslint/commit/4ba9bdb93f87e6bc370f13aa1de48f435abe3f88)) ## [5.30.6](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.5...v5.30.6) (2022-07-11) **Note:** Version bump only for package @typescript-eslint/types +## [5.30.5](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.4...v5.30.5) (2022-07-04) +**Note:** Version bump only for package @typescript-eslint/types +## [5.30.4](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.3...v5.30.4) (2022-07-03) +**Note:** Version bump only for package @typescript-eslint/types -## [5.30.5](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.4...v5.30.5) (2022-07-04) +## [5.30.3](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.2...v5.30.3) (2022-07-01) **Note:** Version bump only for package @typescript-eslint/types +## [5.30.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.1...v5.30.2) (2022-07-01) +**Note:** Version bump only for package @typescript-eslint/types +## 5.30.1 (2022-07-01) +**Note:** Version bump only for package @typescript-eslint/types -## [5.30.4](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.3...v5.30.4) (2022-07-03) +# [5.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.29.0...v5.30.0) (2022-06-27) **Note:** Version bump only for package @typescript-eslint/types +# [5.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.28.0...v5.29.0) (2022-06-20) +**Note:** Version bump only for package @typescript-eslint/types +# [5.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.1...v5.28.0) (2022-06-13) +**Note:** Version bump only for package @typescript-eslint/types -## [5.30.3](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.2...v5.30.3) (2022-07-01) +## [5.27.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.0...v5.27.1) (2022-06-06) **Note:** Version bump only for package @typescript-eslint/types +# [5.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.26.0...v5.27.0) (2022-05-30) + +### Bug Fixes +- **types:** remove leftovers from removal of useJSXTextNode ([#5091](https://github.com/typescript-eslint/typescript-eslint/issues/5091)) ([f9c3647](https://github.com/typescript-eslint/typescript-eslint/commit/f9c3647cb637c8d1ee461b471da9d817ccbde77c)) +### Features +- [4.7] support new extensions ([#5027](https://github.com/typescript-eslint/typescript-eslint/issues/5027)) ([efc147b](https://github.com/typescript-eslint/typescript-eslint/commit/efc147b04dce52ab17415b6a4ae4076b944b9036)) -## [5.30.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.1...v5.30.2) (2022-07-01) +# [5.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.25.0...v5.26.0) (2022-05-23) **Note:** Version bump only for package @typescript-eslint/types +# [5.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.24.0...v5.25.0) (2022-05-17) + +### Features +- update to TypeScript 4.7-rc ([#4829](https://github.com/typescript-eslint/typescript-eslint/issues/4829)) ([6fe783c](https://github.com/typescript-eslint/typescript-eslint/commit/6fe783c20aebe26ef42b526e4a59a9be84dd5643)) +# [5.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.23.0...v5.24.0) (2022-05-16) +**Note:** Version bump only for package @typescript-eslint/types -## 5.30.1 (2022-07-01) +# [5.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.22.0...v5.23.0) (2022-05-09) **Note:** Version bump only for package @typescript-eslint/types +# [5.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.21.0...v5.22.0) (2022-05-02) + +### Features +- **ast-spec:** add fixture test framework and some initial fixtures ([#3258](https://github.com/typescript-eslint/typescript-eslint/issues/3258)) ([f3cf87b](https://github.com/typescript-eslint/typescript-eslint/commit/f3cf87bf20fd0542f92a96a318aa9ee5bf23c1f6)) +# [5.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.20.0...v5.21.0) (2022-04-25) +**Note:** Version bump only for package @typescript-eslint/types -# [5.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.29.0...v5.30.0) (2022-06-27) +# [5.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.19.0...v5.20.0) (2022-04-18) **Note:** Version bump only for package @typescript-eslint/types +# [5.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.18.0...v5.19.0) (2022-04-11) +**Note:** Version bump only for package @typescript-eslint/types +# [5.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.17.0...v5.18.0) (2022-04-04) +**Note:** Version bump only for package @typescript-eslint/types -# [5.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.28.0...v5.29.0) (2022-06-20) +# [5.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.16.0...v5.17.0) (2022-03-28) **Note:** Version bump only for package @typescript-eslint/types +# [5.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.15.0...v5.16.0) (2022-03-21) +**Note:** Version bump only for package @typescript-eslint/types +# [5.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.14.0...v5.15.0) (2022-03-14) +### Features -# [5.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.1...v5.28.0) (2022-06-13) +- **parser:** add `parserOptions.emitDecoratorMetadata` ([#4646](https://github.com/typescript-eslint/typescript-eslint/issues/4646)) ([e3dd343](https://github.com/typescript-eslint/typescript-eslint/commit/e3dd343e51e3b7772e825a609735a04c921c1ec5)) -**Note:** Version bump only for package @typescript-eslint/types +# [5.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.13.0...v5.14.0) (2022-03-07) +### Features +- TypeScript 4.6 ([#4615](https://github.com/typescript-eslint/typescript-eslint/issues/4615)) ([a02c63a](https://github.com/typescript-eslint/typescript-eslint/commit/a02c63a264e5a6c3557468a8eff48d34ca2b718a)) +# [5.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.1...v5.13.0) (2022-02-28) +**Note:** Version bump only for package @typescript-eslint/types -## [5.27.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.0...v5.27.1) (2022-06-06) +## [5.12.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.0...v5.12.1) (2022-02-21) **Note:** Version bump only for package @typescript-eslint/types +# [5.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.11.0...v5.12.0) (2022-02-14) +**Note:** Version bump only for package @typescript-eslint/types +# [5.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.2...v5.11.0) (2022-02-07) +**Note:** Version bump only for package @typescript-eslint/types -# [5.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.26.0...v5.27.0) (2022-05-30) +## [5.10.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.1...v5.10.2) (2022-01-31) +**Note:** Version bump only for package @typescript-eslint/types -### Bug Fixes +## [5.10.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.0...v5.10.1) (2022-01-24) -* **types:** remove leftovers from removal of useJSXTextNode ([#5091](https://github.com/typescript-eslint/typescript-eslint/issues/5091)) ([f9c3647](https://github.com/typescript-eslint/typescript-eslint/commit/f9c3647cb637c8d1ee461b471da9d817ccbde77c)) +**Note:** Version bump only for package @typescript-eslint/types +# [5.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.1...v5.10.0) (2022-01-17) ### Features -* [4.7] support new extensions ([#5027](https://github.com/typescript-eslint/typescript-eslint/issues/5027)) ([efc147b](https://github.com/typescript-eslint/typescript-eslint/commit/efc147b04dce52ab17415b6a4ae4076b944b9036)) +- rename `experimental-utils` to `utils` and make `experimental-utils` an alias to the new package ([#4172](https://github.com/typescript-eslint/typescript-eslint/issues/4172)) ([1d55a75](https://github.com/typescript-eslint/typescript-eslint/commit/1d55a7511b38d8e2b2eabe59f639e0a865e6c93f)) +## [5.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.0...v5.9.1) (2022-01-10) +**Note:** Version bump only for package @typescript-eslint/types +# [5.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.1...v5.9.0) (2022-01-03) +**Note:** Version bump only for package @typescript-eslint/types -# [5.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.25.0...v5.26.0) (2022-05-23) +## [5.8.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.0...v5.8.1) (2021-12-27) **Note:** Version bump only for package @typescript-eslint/types +# [5.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.7.0...v5.8.0) (2021-12-20) +**Note:** Version bump only for package @typescript-eslint/types +# [5.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.6.0...v5.7.0) (2021-12-13) +**Note:** Version bump only for package @typescript-eslint/types -# [5.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.24.0...v5.25.0) (2022-05-17) - +# [5.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.5.0...v5.6.0) (2021-12-06) ### Features -* update to TypeScript 4.7-rc ([#4829](https://github.com/typescript-eslint/typescript-eslint/issues/4829)) ([6fe783c](https://github.com/typescript-eslint/typescript-eslint/commit/6fe783c20aebe26ef42b526e4a59a9be84dd5643)) +- **scope-manager:** update lib types ([#4240](https://github.com/typescript-eslint/typescript-eslint/issues/4240)) ([8377e6e](https://github.com/typescript-eslint/typescript-eslint/commit/8377e6ea422ee2d52455da8955ff055e09c238d3)) +# [5.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.4.0...v5.5.0) (2021-11-29) +**Note:** Version bump only for package @typescript-eslint/types +# [5.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.3.1...v5.4.0) (2021-11-15) +**Note:** Version bump only for package @typescript-eslint/types -# [5.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.23.0...v5.24.0) (2022-05-16) +## [5.3.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.3.0...v5.3.1) (2021-11-08) **Note:** Version bump only for package @typescript-eslint/types +# [5.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.2.0...v5.3.0) (2021-11-01) +**Note:** Version bump only for package @typescript-eslint/types +# [5.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.1.0...v5.2.0) (2021-10-25) +**Note:** Version bump only for package @typescript-eslint/types -# [5.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.22.0...v5.23.0) (2022-05-09) +# [5.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.0.0...v5.1.0) (2021-10-18) **Note:** Version bump only for package @typescript-eslint/types +# [5.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.33.0...v5.0.0) (2021-10-11) +### Features +- support `PrivateIdentifier` ([#3808](https://github.com/typescript-eslint/typescript-eslint/issues/3808)) ([0eefe5e](https://github.com/typescript-eslint/typescript-eslint/commit/0eefe5e49d21af3f1e3e2d9a90c2e49929863ac2)), closes [#3430](https://github.com/typescript-eslint/typescript-eslint/issues/3430) [#2933](https://github.com/typescript-eslint/typescript-eslint/issues/2933) +# [4.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.32.0...v4.33.0) (2021-10-04) -# [5.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.21.0...v5.22.0) (2022-05-02) +**Note:** Version bump only for package @typescript-eslint/types +# [4.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.2...v4.32.0) (2021-09-27) ### Features -* **ast-spec:** add fixture test framework and some initial fixtures ([#3258](https://github.com/typescript-eslint/typescript-eslint/issues/3258)) ([f3cf87b](https://github.com/typescript-eslint/typescript-eslint/commit/f3cf87bf20fd0542f92a96a318aa9ee5bf23c1f6)) +- Support `'latest'` as `ecmaVersion` ([#3873](https://github.com/typescript-eslint/typescript-eslint/issues/3873)) ([25a42c0](https://github.com/typescript-eslint/typescript-eslint/commit/25a42c0bbe92d1ecbc2e8ff9ef3a3ef413f728b0)) +## [4.31.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.1...v4.31.2) (2021-09-20) +**Note:** Version bump only for package @typescript-eslint/types +## [4.31.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.0...v4.31.1) (2021-09-13) +**Note:** Version bump only for package @typescript-eslint/types -# [5.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.20.0...v5.21.0) (2022-04-25) +# [4.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.30.0...v4.31.0) (2021-09-06) **Note:** Version bump only for package @typescript-eslint/types +# [4.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.3...v4.30.0) (2021-08-30) +**Note:** Version bump only for package @typescript-eslint/types +## [4.29.3](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.2...v4.29.3) (2021-08-23) +**Note:** Version bump only for package @typescript-eslint/types -# [5.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.19.0...v5.20.0) (2022-04-18) +## [4.29.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.1...v4.29.2) (2021-08-16) **Note:** Version bump only for package @typescript-eslint/types +## [4.29.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.0...v4.29.1) (2021-08-09) +**Note:** Version bump only for package @typescript-eslint/types +# [4.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.5...v4.29.0) (2021-08-02) +### Features -# [5.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.18.0...v5.19.0) (2022-04-11) - -**Note:** Version bump only for package @typescript-eslint/types +- **eslint-plugin:** Catch unused React import with new JSX transform ([#3577](https://github.com/typescript-eslint/typescript-eslint/issues/3577)) ([02998ea](https://github.com/typescript-eslint/typescript-eslint/commit/02998eac510665758b9a093d43afc310f3ac980d)) +- **typescript-estree:** add support for custom module resolution ([#3516](https://github.com/typescript-eslint/typescript-eslint/issues/3516)) ([d48429d](https://github.com/typescript-eslint/typescript-eslint/commit/d48429d97326545bb727f88ce9056270b1599a31)) +## [4.28.5](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.4...v4.28.5) (2021-07-26) +**Note:** Version bump only for package @typescript-eslint/types +## [4.28.4](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.3...v4.28.4) (2021-07-19) +**Note:** Version bump only for package @typescript-eslint/types -# [5.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.17.0...v5.18.0) (2022-04-04) +## [4.28.3](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.2...v4.28.3) (2021-07-12) **Note:** Version bump only for package @typescript-eslint/types +## [4.28.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.1...v4.28.2) (2021-07-05) +**Note:** Version bump only for package @typescript-eslint/types +## [4.28.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.0...v4.28.1) (2021-06-28) +**Note:** Version bump only for package @typescript-eslint/types -# [5.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.16.0...v5.17.0) (2022-03-28) +# [4.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.27.0...v4.28.0) (2021-06-21) **Note:** Version bump only for package @typescript-eslint/types +# [4.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.1...v4.27.0) (2021-06-14) +### Features +- allow user to provide TS program instance in parser options ([#3484](https://github.com/typescript-eslint/typescript-eslint/issues/3484)) ([e855b18](https://github.com/typescript-eslint/typescript-eslint/commit/e855b18b8feee0edb5c617c11006861426a6f530)) - -# [5.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.15.0...v5.16.0) (2022-03-21) +## [4.26.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.0...v4.26.1) (2021-06-07) **Note:** Version bump only for package @typescript-eslint/types +# [4.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.25.0...v4.26.0) (2021-05-31) + +### Bug Fixes + +- generate library types for TypeScript v4.3 ([#3460](https://github.com/typescript-eslint/typescript-eslint/issues/3460)) ([ed4776a](https://github.com/typescript-eslint/typescript-eslint/commit/ed4776afa1374279027b9b7d82aa4b453b334998)), closes [#3449](https://github.com/typescript-eslint/typescript-eslint/issues/3449) +# [4.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.24.0...v4.25.0) (2021-05-24) +**Note:** Version bump only for package @typescript-eslint/types +# [4.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.23.0...v4.24.0) (2021-05-17) -# [5.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.14.0...v5.15.0) (2022-03-14) +**Note:** Version bump only for package @typescript-eslint/types +# [4.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.1...v4.23.0) (2021-05-10) ### Features -* **parser:** add `parserOptions.emitDecoratorMetadata` ([#4646](https://github.com/typescript-eslint/typescript-eslint/issues/4646)) ([e3dd343](https://github.com/typescript-eslint/typescript-eslint/commit/e3dd343e51e3b7772e825a609735a04c921c1ec5)) - +- refactor to split AST specification out as its own module ([#2911](https://github.com/typescript-eslint/typescript-eslint/issues/2911)) ([25ea953](https://github.com/typescript-eslint/typescript-eslint/commit/25ea953cc60b118bd385c71e0a9b61c286c26fcf)) +## [4.22.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.0...v4.22.1) (2021-05-04) +**Note:** Version bump only for package @typescript-eslint/types +# [4.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.21.0...v4.22.0) (2021-04-12) -# [5.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.13.0...v5.14.0) (2022-03-07) +**Note:** Version bump only for package @typescript-eslint/types +# [4.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.20.0...v4.21.0) (2021-04-05) -### Features +**Note:** Version bump only for package @typescript-eslint/types -* TypeScript 4.6 ([#4615](https://github.com/typescript-eslint/typescript-eslint/issues/4615)) ([a02c63a](https://github.com/typescript-eslint/typescript-eslint/commit/a02c63a264e5a6c3557468a8eff48d34ca2b718a)) +# [4.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.19.0...v4.20.0) (2021-03-29) +**Note:** Version bump only for package @typescript-eslint/types +# [4.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.18.0...v4.19.0) (2021-03-22) +### Bug Fixes +- **typescript-estree:** [ts 4.2] add support for import type equal declaration ([#3189](https://github.com/typescript-eslint/typescript-eslint/issues/3189)) ([6a25faf](https://github.com/typescript-eslint/typescript-eslint/commit/6a25faf5cfa4d21a7546d9866819f4e017308fb2)) -# [5.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.1...v5.13.0) (2022-02-28) +# [4.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.17.0...v4.18.0) (2021-03-15) **Note:** Version bump only for package @typescript-eslint/types +# [4.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.16.1...v4.17.0) (2021-03-08) +**Note:** Version bump only for package @typescript-eslint/types +## [4.16.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.16.0...v4.16.1) (2021-03-01) +**Note:** Version bump only for package @typescript-eslint/types -## [5.12.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.0...v5.12.1) (2022-02-21) +# [4.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.2...v4.16.0) (2021-03-01) -**Note:** Version bump only for package @typescript-eslint/types +### Features +- TypeScript 4.2 syntax support ([#3112](https://github.com/typescript-eslint/typescript-eslint/issues/3112)) ([2ebfb21](https://github.com/typescript-eslint/typescript-eslint/commit/2ebfb21ba6c88c793cfbd0e231e5803b2381694c)) +## [4.15.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.1...v4.15.2) (2021-02-22) +### Bug Fixes +- **typescript-estree:** correct issues in AST definition ([#3083](https://github.com/typescript-eslint/typescript-eslint/issues/3083)) ([509a117](https://github.com/typescript-eslint/typescript-eslint/commit/509a11749f85400a01e9fecfecd12871ce562d3d)) +- add missing intrinsic keyword node to AST ([#3081](https://github.com/typescript-eslint/typescript-eslint/issues/3081)) ([409bf0b](https://github.com/typescript-eslint/typescript-eslint/commit/409bf0bb3e2ac4d8782408d436ebdefb42dba38b)) -# [5.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.11.0...v5.12.0) (2022-02-14) +## [4.15.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.0...v4.15.1) (2021-02-15) **Note:** Version bump only for package @typescript-eslint/types +# [4.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.2...v4.15.0) (2021-02-08) +**Note:** Version bump only for package @typescript-eslint/types +## [4.14.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.1...v4.14.2) (2021-02-01) +**Note:** Version bump only for package @typescript-eslint/types -# [5.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.2...v5.11.0) (2022-02-07) +## [4.14.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.0...v4.14.1) (2021-01-25) **Note:** Version bump only for package @typescript-eslint/types +# [4.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.13.0...v4.14.0) (2021-01-18) +**Note:** Version bump only for package @typescript-eslint/types +# [4.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.12.0...v4.13.0) (2021-01-11) +**Note:** Version bump only for package @typescript-eslint/types -## [5.10.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.1...v5.10.2) (2022-01-31) +# [4.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.11.1...v4.12.0) (2021-01-04) **Note:** Version bump only for package @typescript-eslint/types +## [4.11.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.11.0...v4.11.1) (2020-12-28) +**Note:** Version bump only for package @typescript-eslint/types +# [4.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.10.0...v4.11.0) (2020-12-21) +**Note:** Version bump only for package @typescript-eslint/types -## [5.10.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.0...v5.10.1) (2022-01-24) +# [4.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.9.1...v4.10.0) (2020-12-14) **Note:** Version bump only for package @typescript-eslint/types +## [4.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.9.0...v4.9.1) (2020-12-07) +**Note:** Version bump only for package @typescript-eslint/types +# [4.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.2...v4.9.0) (2020-11-30) +### Features -# [5.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.1...v5.10.0) (2022-01-17) - - -### Features - -* rename `experimental-utils` to `utils` and make `experimental-utils` an alias to the new package ([#4172](https://github.com/typescript-eslint/typescript-eslint/issues/4172)) ([1d55a75](https://github.com/typescript-eslint/typescript-eslint/commit/1d55a7511b38d8e2b2eabe59f639e0a865e6c93f)) - - - - - -## [5.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.0...v5.9.1) (2022-01-10) - -**Note:** Version bump only for package @typescript-eslint/types - - - - - -# [5.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.1...v5.9.0) (2022-01-03) - -**Note:** Version bump only for package @typescript-eslint/types - - - - - -## [5.8.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.0...v5.8.1) (2021-12-27) - -**Note:** Version bump only for package @typescript-eslint/types - - - - - -# [5.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.7.0...v5.8.0) (2021-12-20) - -**Note:** Version bump only for package @typescript-eslint/types - - - - - -# [5.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.6.0...v5.7.0) (2021-12-13) - -**Note:** Version bump only for package @typescript-eslint/types - - - - - -# [5.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.5.0...v5.6.0) (2021-12-06) - - -### Features - -* **scope-manager:** update lib types ([#4240](https://github.com/typescript-eslint/typescript-eslint/issues/4240)) ([8377e6e](https://github.com/typescript-eslint/typescript-eslint/commit/8377e6ea422ee2d52455da8955ff055e09c238d3)) - - - - - -# [5.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.4.0...v5.5.0) (2021-11-29) - -**Note:** Version bump only for package @typescript-eslint/types - - - - - -# [5.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.3.1...v5.4.0) (2021-11-15) - -**Note:** Version bump only for package @typescript-eslint/types - - - - - -## [5.3.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.3.0...v5.3.1) (2021-11-08) - -**Note:** Version bump only for package @typescript-eslint/types - - - - - -# [5.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.2.0...v5.3.0) (2021-11-01) - -**Note:** Version bump only for package @typescript-eslint/types - - - - - -# [5.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.1.0...v5.2.0) (2021-10-25) - -**Note:** Version bump only for package @typescript-eslint/types - - - - - -# [5.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.0.0...v5.1.0) (2021-10-18) - -**Note:** Version bump only for package @typescript-eslint/types - - - - - -# [5.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.33.0...v5.0.0) (2021-10-11) - - -### Features - -* support `PrivateIdentifier` ([#3808](https://github.com/typescript-eslint/typescript-eslint/issues/3808)) ([0eefe5e](https://github.com/typescript-eslint/typescript-eslint/commit/0eefe5e49d21af3f1e3e2d9a90c2e49929863ac2)), closes [#3430](https://github.com/typescript-eslint/typescript-eslint/issues/3430) [#2933](https://github.com/typescript-eslint/typescript-eslint/issues/2933) - - - - - -# [4.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.32.0...v4.33.0) (2021-10-04) - -**Note:** Version bump only for package @typescript-eslint/types - - - - - -# [4.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.2...v4.32.0) (2021-09-27) - - -### Features - -* Support `'latest'` as `ecmaVersion` ([#3873](https://github.com/typescript-eslint/typescript-eslint/issues/3873)) ([25a42c0](https://github.com/typescript-eslint/typescript-eslint/commit/25a42c0bbe92d1ecbc2e8ff9ef3a3ef413f728b0)) - - - - - -## [4.31.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.1...v4.31.2) (2021-09-20) - -**Note:** Version bump only for package @typescript-eslint/types - - - - - -## [4.31.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.0...v4.31.1) (2021-09-13) - -**Note:** Version bump only for package @typescript-eslint/types - - - - - -# [4.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.30.0...v4.31.0) (2021-09-06) - -**Note:** Version bump only for package @typescript-eslint/types - - - - - -# [4.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.3...v4.30.0) (2021-08-30) - -**Note:** Version bump only for package @typescript-eslint/types - - - - - -## [4.29.3](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.2...v4.29.3) (2021-08-23) - -**Note:** Version bump only for package @typescript-eslint/types - - - - - -## [4.29.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.1...v4.29.2) (2021-08-16) - -**Note:** Version bump only for package @typescript-eslint/types - - - - - -## [4.29.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.0...v4.29.1) (2021-08-09) - -**Note:** Version bump only for package @typescript-eslint/types - - - - - -# [4.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.5...v4.29.0) (2021-08-02) - - -### Features - -* **eslint-plugin:** Catch unused React import with new JSX transform ([#3577](https://github.com/typescript-eslint/typescript-eslint/issues/3577)) ([02998ea](https://github.com/typescript-eslint/typescript-eslint/commit/02998eac510665758b9a093d43afc310f3ac980d)) -* **typescript-estree:** add support for custom module resolution ([#3516](https://github.com/typescript-eslint/typescript-eslint/issues/3516)) ([d48429d](https://github.com/typescript-eslint/typescript-eslint/commit/d48429d97326545bb727f88ce9056270b1599a31)) - - - - - -## [4.28.5](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.4...v4.28.5) (2021-07-26) - -**Note:** Version bump only for package @typescript-eslint/types - - - - - -## [4.28.4](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.3...v4.28.4) (2021-07-19) - -**Note:** Version bump only for package @typescript-eslint/types - - - - - -## [4.28.3](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.2...v4.28.3) (2021-07-12) - -**Note:** Version bump only for package @typescript-eslint/types - - - - - -## [4.28.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.1...v4.28.2) (2021-07-05) - -**Note:** Version bump only for package @typescript-eslint/types - - - - - -## [4.28.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.0...v4.28.1) (2021-06-28) - -**Note:** Version bump only for package @typescript-eslint/types - - - - - -# [4.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.27.0...v4.28.0) (2021-06-21) - -**Note:** Version bump only for package @typescript-eslint/types - - - - - -# [4.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.1...v4.27.0) (2021-06-14) - - -### Features - -* allow user to provide TS program instance in parser options ([#3484](https://github.com/typescript-eslint/typescript-eslint/issues/3484)) ([e855b18](https://github.com/typescript-eslint/typescript-eslint/commit/e855b18b8feee0edb5c617c11006861426a6f530)) - - - - - -## [4.26.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.0...v4.26.1) (2021-06-07) - -**Note:** Version bump only for package @typescript-eslint/types - - - - - -# [4.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.25.0...v4.26.0) (2021-05-31) - - -### Bug Fixes - -* generate library types for TypeScript v4.3 ([#3460](https://github.com/typescript-eslint/typescript-eslint/issues/3460)) ([ed4776a](https://github.com/typescript-eslint/typescript-eslint/commit/ed4776afa1374279027b9b7d82aa4b453b334998)), closes [#3449](https://github.com/typescript-eslint/typescript-eslint/issues/3449) - - - - - -# [4.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.24.0...v4.25.0) (2021-05-24) - -**Note:** Version bump only for package @typescript-eslint/types - - - - - -# [4.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.23.0...v4.24.0) (2021-05-17) - -**Note:** Version bump only for package @typescript-eslint/types - - - - - -# [4.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.1...v4.23.0) (2021-05-10) - - -### Features - -* refactor to split AST specification out as its own module ([#2911](https://github.com/typescript-eslint/typescript-eslint/issues/2911)) ([25ea953](https://github.com/typescript-eslint/typescript-eslint/commit/25ea953cc60b118bd385c71e0a9b61c286c26fcf)) - - - - - -## [4.22.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.0...v4.22.1) (2021-05-04) - -**Note:** Version bump only for package @typescript-eslint/types - - - - - -# [4.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.21.0...v4.22.0) (2021-04-12) - -**Note:** Version bump only for package @typescript-eslint/types - - - - - -# [4.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.20.0...v4.21.0) (2021-04-05) - -**Note:** Version bump only for package @typescript-eslint/types - - - - - -# [4.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.19.0...v4.20.0) (2021-03-29) - -**Note:** Version bump only for package @typescript-eslint/types - - - - - -# [4.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.18.0...v4.19.0) (2021-03-22) - - -### Bug Fixes - -* **typescript-estree:** [ts 4.2] add support for import type equal declaration ([#3189](https://github.com/typescript-eslint/typescript-eslint/issues/3189)) ([6a25faf](https://github.com/typescript-eslint/typescript-eslint/commit/6a25faf5cfa4d21a7546d9866819f4e017308fb2)) - - - - - -# [4.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.17.0...v4.18.0) (2021-03-15) - -**Note:** Version bump only for package @typescript-eslint/types - - - - - -# [4.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.16.1...v4.17.0) (2021-03-08) - -**Note:** Version bump only for package @typescript-eslint/types - - - - - -## [4.16.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.16.0...v4.16.1) (2021-03-01) - -**Note:** Version bump only for package @typescript-eslint/types - - - - - -# [4.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.2...v4.16.0) (2021-03-01) - - -### Features - -* TypeScript 4.2 syntax support ([#3112](https://github.com/typescript-eslint/typescript-eslint/issues/3112)) ([2ebfb21](https://github.com/typescript-eslint/typescript-eslint/commit/2ebfb21ba6c88c793cfbd0e231e5803b2381694c)) - - - - - -## [4.15.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.1...v4.15.2) (2021-02-22) - - -### Bug Fixes - -* **typescript-estree:** correct issues in AST definition ([#3083](https://github.com/typescript-eslint/typescript-eslint/issues/3083)) ([509a117](https://github.com/typescript-eslint/typescript-eslint/commit/509a11749f85400a01e9fecfecd12871ce562d3d)) -* add missing intrinsic keyword node to AST ([#3081](https://github.com/typescript-eslint/typescript-eslint/issues/3081)) ([409bf0b](https://github.com/typescript-eslint/typescript-eslint/commit/409bf0bb3e2ac4d8782408d436ebdefb42dba38b)) - - - - - -## [4.15.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.0...v4.15.1) (2021-02-15) - -**Note:** Version bump only for package @typescript-eslint/types - - - - - -# [4.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.2...v4.15.0) (2021-02-08) - -**Note:** Version bump only for package @typescript-eslint/types - - - - - -## [4.14.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.1...v4.14.2) (2021-02-01) - -**Note:** Version bump only for package @typescript-eslint/types - - - - - -## [4.14.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.0...v4.14.1) (2021-01-25) - -**Note:** Version bump only for package @typescript-eslint/types - - - - - -# [4.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.13.0...v4.14.0) (2021-01-18) - -**Note:** Version bump only for package @typescript-eslint/types - - - - - -# [4.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.12.0...v4.13.0) (2021-01-11) - -**Note:** Version bump only for package @typescript-eslint/types - - - - - -# [4.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.11.1...v4.12.0) (2021-01-04) - -**Note:** Version bump only for package @typescript-eslint/types - - - - - -## [4.11.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.11.0...v4.11.1) (2020-12-28) - -**Note:** Version bump only for package @typescript-eslint/types - - - - - -# [4.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.10.0...v4.11.0) (2020-12-21) - -**Note:** Version bump only for package @typescript-eslint/types - - - - - -# [4.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.9.1...v4.10.0) (2020-12-14) - -**Note:** Version bump only for package @typescript-eslint/types - - - - - -## [4.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.9.0...v4.9.1) (2020-12-07) - -**Note:** Version bump only for package @typescript-eslint/types - - - - - -# [4.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.2...v4.9.0) (2020-11-30) - - -### Features - -* **eslint-plugin:** [no-unused-vars] fork the base rule ([#2768](https://github.com/typescript-eslint/typescript-eslint/issues/2768)) ([a8227a6](https://github.com/typescript-eslint/typescript-eslint/commit/a8227a6185dd24de4bfc7d766931643871155021)), closes [#2782](https://github.com/typescript-eslint/typescript-eslint/issues/2782) [#2714](https://github.com/typescript-eslint/typescript-eslint/issues/2714) [#2648](https://github.com/typescript-eslint/typescript-eslint/issues/2648) - - - - +- **eslint-plugin:** [no-unused-vars] fork the base rule ([#2768](https://github.com/typescript-eslint/typescript-eslint/issues/2768)) ([a8227a6](https://github.com/typescript-eslint/typescript-eslint/commit/a8227a6185dd24de4bfc7d766931643871155021)), closes [#2782](https://github.com/typescript-eslint/typescript-eslint/issues/2782) [#2714](https://github.com/typescript-eslint/typescript-eslint/issues/2714) [#2648](https://github.com/typescript-eslint/typescript-eslint/issues/2648) ## [4.8.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.1...v4.8.2) (2020-11-23) **Note:** Version bump only for package @typescript-eslint/types - - - - ## [4.8.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.0...v4.8.1) (2020-11-17) **Note:** Version bump only for package @typescript-eslint/types - - - - # [4.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.7.0...v4.8.0) (2020-11-16) **Note:** Version bump only for package @typescript-eslint/types - - - - # [4.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.6.1...v4.7.0) (2020-11-09) - ### Features -* support TS4.1 features ([#2748](https://github.com/typescript-eslint/typescript-eslint/issues/2748)) ([2be354b](https://github.com/typescript-eslint/typescript-eslint/commit/2be354bb15f9013a2da1b13a0c0836e9ef057e16)), closes [#2583](https://github.com/typescript-eslint/typescript-eslint/issues/2583) - - - - +- support TS4.1 features ([#2748](https://github.com/typescript-eslint/typescript-eslint/issues/2748)) ([2be354b](https://github.com/typescript-eslint/typescript-eslint/commit/2be354bb15f9013a2da1b13a0c0836e9ef057e16)), closes [#2583](https://github.com/typescript-eslint/typescript-eslint/issues/2583) ## [4.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.6.0...v4.6.1) (2020-11-02) **Note:** Version bump only for package @typescript-eslint/types - - - - # [4.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.5.0...v4.6.0) (2020-10-26) **Note:** Version bump only for package @typescript-eslint/types - - - - # [4.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.4.1...v4.5.0) (2020-10-19) - ### Features -* **typescript-estree:** add flag EXPERIMENTAL_useSourceOfProjectReferenceRedirect ([#2669](https://github.com/typescript-eslint/typescript-eslint/issues/2669)) ([90a5878](https://github.com/typescript-eslint/typescript-eslint/commit/90a587845088da1b205e4d7d77dbc3f9447b1c5a)) - - - - +- **typescript-estree:** add flag EXPERIMENTAL_useSourceOfProjectReferenceRedirect ([#2669](https://github.com/typescript-eslint/typescript-eslint/issues/2669)) ([90a5878](https://github.com/typescript-eslint/typescript-eslint/commit/90a587845088da1b205e4d7d77dbc3f9447b1c5a)) ## [4.4.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.4.0...v4.4.1) (2020-10-12) **Note:** Version bump only for package @typescript-eslint/types - - - - # [4.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.3.0...v4.4.0) (2020-10-05) **Note:** Version bump only for package @typescript-eslint/types - - - - # [4.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.2.0...v4.3.0) (2020-09-28) **Note:** Version bump only for package @typescript-eslint/types - - - - # [4.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.1...v4.2.0) (2020-09-21) **Note:** Version bump only for package @typescript-eslint/types - - - - ## [4.1.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.0...v4.1.1) (2020-09-14) - ### Bug Fixes -* **types:** artificial fix needed to trigger release ([b577daf](https://github.com/typescript-eslint/typescript-eslint/commit/b577daf27cd87870b6e095e4e995519f96d321dd)) - - - - +- **types:** artificial fix needed to trigger release ([b577daf](https://github.com/typescript-eslint/typescript-eslint/commit/b577daf27cd87870b6e095e4e995519f96d321dd)) # [4.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.0.1...v4.1.0) (2020-09-07) - ### Bug Fixes -* **eslint-plugin:** [no-unused-vars] correct detection of unused vars in a declared module with `export =` ([#2505](https://github.com/typescript-eslint/typescript-eslint/issues/2505)) ([3d07a99](https://github.com/typescript-eslint/typescript-eslint/commit/3d07a99faa0a5fc1b44acdb43ddbfc90a5105833)) - +- **eslint-plugin:** [no-unused-vars] correct detection of unused vars in a declared module with `export =` ([#2505](https://github.com/typescript-eslint/typescript-eslint/issues/2505)) ([3d07a99](https://github.com/typescript-eslint/typescript-eslint/commit/3d07a99faa0a5fc1b44acdb43ddbfc90a5105833)) ### Features -* **scope-manager:** add support for JSX scope analysis ([#2498](https://github.com/typescript-eslint/typescript-eslint/issues/2498)) ([f887ab5](https://github.com/typescript-eslint/typescript-eslint/commit/f887ab51f58c1b3571f9a14832864bc0ca59623f)), closes [#2455](https://github.com/typescript-eslint/typescript-eslint/issues/2455) [#2477](https://github.com/typescript-eslint/typescript-eslint/issues/2477) - - - - +- **scope-manager:** add support for JSX scope analysis ([#2498](https://github.com/typescript-eslint/typescript-eslint/issues/2498)) ([f887ab5](https://github.com/typescript-eslint/typescript-eslint/commit/f887ab51f58c1b3571f9a14832864bc0ca59623f)), closes [#2455](https://github.com/typescript-eslint/typescript-eslint/issues/2455) [#2477](https://github.com/typescript-eslint/typescript-eslint/issues/2477) ## [4.0.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.0.0...v4.0.1) (2020-08-31) **Note:** Version bump only for package @typescript-eslint/types - - - - # [4.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.10.1...v4.0.0) (2020-08-31) ## [Please see the release notes for v4.0.0](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v4.0.0) ### Bug Fixes -* correct decorator traversal for AssignmentPattern ([#2375](https://github.com/typescript-eslint/typescript-eslint/issues/2375)) ([d738fa4](https://github.com/typescript-eslint/typescript-eslint/commit/d738fa4eff0a5c4cfc9b30b1c0502f8d1e78d7b6)) -* **typescript-estree:** correct ChainExpression interaction with parentheses and non-nulls ([#2380](https://github.com/typescript-eslint/typescript-eslint/issues/2380)) ([762bc99](https://github.com/typescript-eslint/typescript-eslint/commit/762bc99584ede4d0b8099a743991e957aec86aa8)) - +- correct decorator traversal for AssignmentPattern ([#2375](https://github.com/typescript-eslint/typescript-eslint/issues/2375)) ([d738fa4](https://github.com/typescript-eslint/typescript-eslint/commit/d738fa4eff0a5c4cfc9b30b1c0502f8d1e78d7b6)) +- **typescript-estree:** correct ChainExpression interaction with parentheses and non-nulls ([#2380](https://github.com/typescript-eslint/typescript-eslint/issues/2380)) ([762bc99](https://github.com/typescript-eslint/typescript-eslint/commit/762bc99584ede4d0b8099a743991e957aec86aa8)) ### Features -* consume new scope analysis package ([#2039](https://github.com/typescript-eslint/typescript-eslint/issues/2039)) ([3be125d](https://github.com/typescript-eslint/typescript-eslint/commit/3be125d9bdbee1984ac6037874edf619213bd3d0)) -* support ESTree optional chaining representation ([#2308](https://github.com/typescript-eslint/typescript-eslint/issues/2308)) ([e9d2ab6](https://github.com/typescript-eslint/typescript-eslint/commit/e9d2ab638b6767700b52797e74b814ea059beaae)) - +- consume new scope analysis package ([#2039](https://github.com/typescript-eslint/typescript-eslint/issues/2039)) ([3be125d](https://github.com/typescript-eslint/typescript-eslint/commit/3be125d9bdbee1984ac6037874edf619213bd3d0)) +- support ESTree optional chaining representation ([#2308](https://github.com/typescript-eslint/typescript-eslint/issues/2308)) ([e9d2ab6](https://github.com/typescript-eslint/typescript-eslint/commit/e9d2ab638b6767700b52797e74b814ea059beaae)) ### BREAKING CHANGES -* - Removed decorators property from several Nodes that could never semantically have them (FunctionDeclaration, TSEnumDeclaration, and TSInterfaceDeclaration) -- Removed AST_NODE_TYPES.Import. This is a minor breaking change as the node type that used this was removed ages ago. - - - +- - Removed decorators property from several Nodes that could never semantically have them (FunctionDeclaration, TSEnumDeclaration, and TSInterfaceDeclaration) +* Removed AST_NODE_TYPES.Import. This is a minor breaking change as the node type that used this was removed ages ago. ## [3.10.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.10.0...v3.10.1) (2020-08-25) **Note:** Version bump only for package @typescript-eslint/types - - - - # [3.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.9.1...v3.10.0) (2020-08-24) **Note:** Version bump only for package @typescript-eslint/types - - - - ## [3.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.9.0...v3.9.1) (2020-08-17) **Note:** Version bump only for package @typescript-eslint/types - - - - # [3.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.8.0...v3.9.0) (2020-08-10) - ### Features -* **typescript-estree:** support TSv4 labelled tuple members ([#2378](https://github.com/typescript-eslint/typescript-eslint/issues/2378)) ([00d84ff](https://github.com/typescript-eslint/typescript-eslint/commit/00d84ffbcbe9d0ec98bdb2f2ce59959a27ce4dbe)) - - - - +- **typescript-estree:** support TSv4 labelled tuple members ([#2378](https://github.com/typescript-eslint/typescript-eslint/issues/2378)) ([00d84ff](https://github.com/typescript-eslint/typescript-eslint/commit/00d84ffbcbe9d0ec98bdb2f2ce59959a27ce4dbe)) # [3.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.7.1...v3.8.0) (2020-08-03) **Note:** Version bump only for package @typescript-eslint/types - - - - ## [3.7.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.7.0...v3.7.1) (2020-07-27) **Note:** Version bump only for package @typescript-eslint/types - - - - # [3.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.6.1...v3.7.0) (2020-07-20) - ### Features -* **eslint-plugin:** [no-empty-function] add `decoratedFunctions` option ([#2295](https://github.com/typescript-eslint/typescript-eslint/issues/2295)) ([88f08f4](https://github.com/typescript-eslint/typescript-eslint/commit/88f08f410760f58fdc2de58ecd9dab9610821642)) -* **typescript-estree:** support short-circuiting assignment operators ([#2307](https://github.com/typescript-eslint/typescript-eslint/issues/2307)) ([2c90d9f](https://github.com/typescript-eslint/typescript-eslint/commit/2c90d9fa3aa5ebd7db697dddb7762bca2dd0e06b)) - - - - +- **eslint-plugin:** [no-empty-function] add `decoratedFunctions` option ([#2295](https://github.com/typescript-eslint/typescript-eslint/issues/2295)) ([88f08f4](https://github.com/typescript-eslint/typescript-eslint/commit/88f08f410760f58fdc2de58ecd9dab9610821642)) +- **typescript-estree:** support short-circuiting assignment operators ([#2307](https://github.com/typescript-eslint/typescript-eslint/issues/2307)) ([2c90d9f](https://github.com/typescript-eslint/typescript-eslint/commit/2c90d9fa3aa5ebd7db697dddb7762bca2dd0e06b)) ## [3.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.6.0...v3.6.1) (2020-07-13) **Note:** Version bump only for package @typescript-eslint/types - - - - # [3.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.5.0...v3.6.0) (2020-07-06) **Note:** Version bump only for package @typescript-eslint/types - - - - # [3.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.4.0...v3.5.0) (2020-06-29) - ### Features -* add package scope-manager ([#1939](https://github.com/typescript-eslint/typescript-eslint/issues/1939)) ([682eb7e](https://github.com/typescript-eslint/typescript-eslint/commit/682eb7e009c3f22a542882dfd3602196a60d2a1e)) -* split types into their own package ([#2229](https://github.com/typescript-eslint/typescript-eslint/issues/2229)) ([5f45918](https://github.com/typescript-eslint/typescript-eslint/commit/5f4591886f3438329fbf2229b03ac66174334a24)) +- add package scope-manager ([#1939](https://github.com/typescript-eslint/typescript-eslint/issues/1939)) ([682eb7e](https://github.com/typescript-eslint/typescript-eslint/commit/682eb7e009c3f22a542882dfd3602196a60d2a1e)) +- split types into their own package ([#2229](https://github.com/typescript-eslint/typescript-eslint/issues/2229)) ([5f45918](https://github.com/typescript-eslint/typescript-eslint/commit/5f4591886f3438329fbf2229b03ac66174334a24)) diff --git a/packages/types/LICENSE b/packages/types/LICENSE index 7e7370143b2..a1164108d4d 100644 --- a/packages/types/LICENSE +++ b/packages/types/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2019 TypeScript ESLint and other contributors +Copyright (c) 2019 typescript-eslint and other contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/types/README.md b/packages/types/README.md index 273ac71a936..7a3008bb982 100644 --- a/packages/types/README.md +++ b/packages/types/README.md @@ -1,17 +1,12 @@ -

TypeScript-ESTree Types

+# `@typescript-eslint/types` -

- CI - NPM Version - NPM Downloads -

+> Types for the TypeScript-ESTree AST spec This package exists to help us reduce cycles and provide lighter-weight packages at runtime. -You probably don't want to use it directly. -If you're building an ESLint plugin, consider using [`@typescript-eslint/utils`](../utils). -If you're parsing TypeScript code, consider using [`@typescript-eslint/typescript-estree`](../typescript-estree). +## ✋ Internal Package -## Contributing +This is an _internal package_ to the [typescript-eslint monorepo](https://github.com/typescript-eslint/typescript-eslint). +You likely don't want to use it directly. -[See the contributing guide here](../../CONTRIBUTING.md) +👉 See **https://typescript-eslint.io** for docs on typescript-eslint. diff --git a/packages/types/package.json b/packages/types/package.json index 22b83fe35ca..68258118ae1 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/types", - "version": "5.39.0", + "version": "5.46.1", "description": "Types for the TypeScript-ESTree AST spec", "keywords": [ "eslint", @@ -33,10 +33,10 @@ "build": "tsc -b tsconfig.build.json", "postbuild": "downlevel-dts dist _ts3.4/dist", "clean": "tsc -b tsconfig.build.json --clean", - "postclean": "rimraf dist && rimraf _ts3.4 && rimraf coverage", + "postclean": "rimraf dist && rimraf src/generated && rimraf _ts3.4 && rimraf coverage", "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", "generate:lib": "../../node_modules/.bin/ts-node --files --transpile-only ../scope-manager/tools/generate-lib.ts", - "lint": "eslint . --ignore-path='../../.eslintignore'", + "lint": "nx lint", "typecheck": "tsc -p tsconfig.json --noEmit" }, "nx": { diff --git a/packages/types/project.json b/packages/types/project.json index d0c5660433f..74fee293f18 100644 --- a/packages/types/project.json +++ b/packages/types/project.json @@ -1,5 +1,15 @@ { - "root": "packages/types", + "name": "types", + "$schema": "../../node_modules/nx/schemas/project-schema.json", "type": "library", - "implicitDependencies": ["@typescript-eslint/ast-spec"] + "implicitDependencies": ["ast-spec"], + "targets": { + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["packages/types/**/*.ts"] + } + } + } } diff --git a/packages/types/src/lib.ts b/packages/types/src/lib.ts index 0d92717fcb5..880bafe5b5e 100644 --- a/packages/types/src/lib.ts +++ b/packages/types/src/lib.ts @@ -46,6 +46,7 @@ type Lib = | 'es2019.object' | 'es2019.string' | 'es2019.symbol' + | 'es2019.intl' | 'es2020.bigint' | 'es2020.date' | 'es2020.promise' diff --git a/packages/typescript-estree/CHANGELOG.md b/packages/typescript-estree/CHANGELOG.md index 1acad00016e..7c12eb686eb 100644 --- a/packages/typescript-estree/CHANGELOG.md +++ b/packages/typescript-estree/CHANGELOG.md @@ -3,1853 +3,1102 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -# [5.39.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.1...v5.39.0) (2022-10-03) +## [5.46.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.46.0...v5.46.1) (2022-12-12) **Note:** Version bump only for package @typescript-eslint/typescript-estree +# [5.46.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.45.1...v5.46.0) (2022-12-08) +**Note:** Version bump only for package @typescript-eslint/typescript-estree +## [5.45.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.45.0...v5.45.1) (2022-12-05) +**Note:** Version bump only for package @typescript-eslint/typescript-estree -## [5.38.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.0...v5.38.1) (2022-09-26) +# [5.45.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.44.0...v5.45.0) (2022-11-28) -**Note:** Version bump only for package @typescript-eslint/typescript-estree +### Bug Fixes +- **typescript-estree:** stub out `ts.SatisfiesExpression` on old TS versions ([#6076](https://github.com/typescript-eslint/typescript-eslint/issues/6076)) ([1302b30](https://github.com/typescript-eslint/typescript-eslint/commit/1302b30ecad9eb55aa9f1daa5068d9fb72c3688e)) +### Features +- support Auto Accessor syntax ([#5926](https://github.com/typescript-eslint/typescript-eslint/issues/5926)) ([becd1f8](https://github.com/typescript-eslint/typescript-eslint/commit/becd1f8581c0013399dfe71be6c265e96cedb57a)) +# [5.44.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.43.0...v5.44.0) (2022-11-21) -# [5.38.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.37.0...v5.38.0) (2022-09-19) +### Bug Fixes -**Note:** Version bump only for package @typescript-eslint/typescript-estree +- **typescript-estree:** don't consider a cached program unless it's specified in the current `parserOptions.project` config ([#5999](https://github.com/typescript-eslint/typescript-eslint/issues/5999)) ([530e0e6](https://github.com/typescript-eslint/typescript-eslint/commit/530e0e618cdf4bb956149bf8a8484848e1b9a1f5)) +### Features +- support parsing `satisfies` operators ([#5717](https://github.com/typescript-eslint/typescript-eslint/issues/5717)) ([20d7cae](https://github.com/typescript-eslint/typescript-eslint/commit/20d7caee35ab84ae6381fdf04338c9e2b9e2bc48)) +- update to TypeScript 4.9 ([#5716](https://github.com/typescript-eslint/typescript-eslint/issues/5716)) ([4d744ea](https://github.com/typescript-eslint/typescript-eslint/commit/4d744ea10ba03c66eebcb63e8722e9f0165fbeed)) +# [5.43.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.1...v5.43.0) (2022-11-14) +**Note:** Version bump only for package @typescript-eslint/typescript-estree -# [5.37.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.2...v5.37.0) (2022-09-12) +## [5.42.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.0...v5.42.1) (2022-11-07) **Note:** Version bump only for package @typescript-eslint/typescript-estree +# [5.42.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.41.0...v5.42.0) (2022-10-31) +### Bug Fixes +- **typescript-estree:** don't allow single-run unless we're in type-aware linting mode ([#5893](https://github.com/typescript-eslint/typescript-eslint/issues/5893)) ([891b087](https://github.com/typescript-eslint/typescript-eslint/commit/891b0879ba9c64a4722b8c0bf9e599a725b6d6df)) +### Features -## [5.36.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.1...v5.36.2) (2022-09-05) +- **typescript-estree:** clarify docs and error for program project without matching TSConfig ([#5762](https://github.com/typescript-eslint/typescript-eslint/issues/5762)) ([67744db](https://github.com/typescript-eslint/typescript-eslint/commit/67744db31f61acab14b5fe027fbc2844ba198c97)) +# [5.41.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.1...v5.41.0) (2022-10-24) -### Bug Fixes +**Note:** Version bump only for package @typescript-eslint/typescript-estree -* **typescript-estree:** don't double add decorators to a parameter property's parameter ([#5582](https://github.com/typescript-eslint/typescript-eslint/issues/5582)) ([863694c](https://github.com/typescript-eslint/typescript-eslint/commit/863694cbc71b5158ca6a018de8707c9f9fbc22c3)) +## [5.40.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.0...v5.40.1) (2022-10-17) +**Note:** Version bump only for package @typescript-eslint/typescript-estree +# [5.40.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.39.0...v5.40.0) (2022-10-10) +**Note:** Version bump only for package @typescript-eslint/typescript-estree +# [5.39.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.1...v5.39.0) (2022-10-03) -## [5.36.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.0...v5.36.1) (2022-08-30) +**Note:** Version bump only for package @typescript-eslint/typescript-estree +## [5.38.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.0...v5.38.1) (2022-09-26) -### Bug Fixes +**Note:** Version bump only for package @typescript-eslint/typescript-estree -* **typescript-estree:** fix decorator regression for pre TS4.8 ([#5574](https://github.com/typescript-eslint/typescript-eslint/issues/5574)) ([a603015](https://github.com/typescript-eslint/typescript-eslint/commit/a603015c93a6ea96d500c57bec1e284340141b1f)) +# [5.38.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.37.0...v5.38.0) (2022-09-19) +**Note:** Version bump only for package @typescript-eslint/typescript-estree +# [5.37.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.2...v5.37.0) (2022-09-12) +**Note:** Version bump only for package @typescript-eslint/typescript-estree +## [5.36.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.1...v5.36.2) (2022-09-05) -# [5.36.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.1...v5.36.0) (2022-08-30) +### Bug Fixes +- **typescript-estree:** don't double add decorators to a parameter property's parameter ([#5582](https://github.com/typescript-eslint/typescript-eslint/issues/5582)) ([863694c](https://github.com/typescript-eslint/typescript-eslint/commit/863694cbc71b5158ca6a018de8707c9f9fbc22c3)) -### Features +## [5.36.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.0...v5.36.1) (2022-08-30) -* support TypeScript 4.8 ([#5551](https://github.com/typescript-eslint/typescript-eslint/issues/5551)) ([81450ed](https://github.com/typescript-eslint/typescript-eslint/commit/81450ed7eaede74b384e9a91a84e9b4d34513866)) +### Bug Fixes +- **typescript-estree:** fix decorator regression for pre TS4.8 ([#5574](https://github.com/typescript-eslint/typescript-eslint/issues/5574)) ([a603015](https://github.com/typescript-eslint/typescript-eslint/commit/a603015c93a6ea96d500c57bec1e284340141b1f)) +# [5.36.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.1...v5.36.0) (2022-08-30) +### Features +- support TypeScript 4.8 ([#5551](https://github.com/typescript-eslint/typescript-eslint/issues/5551)) ([81450ed](https://github.com/typescript-eslint/typescript-eslint/commit/81450ed7eaede74b384e9a91a84e9b4d34513866)) ## [5.35.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.0...v5.35.1) (2022-08-24) **Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - # [5.35.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.34.0...v5.35.0) (2022-08-24) **Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - # [5.34.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.1...v5.34.0) (2022-08-22) - ### Features -* **eslint-plugin:** [prefer-optional-chain] support suggesting `!foo || !foo.bar` as a valid match for the rule ([#5266](https://github.com/typescript-eslint/typescript-eslint/issues/5266)) ([aca935c](https://github.com/typescript-eslint/typescript-eslint/commit/aca935c9696712d4aff18144c4690db4d6ba9bf9)) - - - - +- **eslint-plugin:** [prefer-optional-chain] support suggesting `!foo || !foo.bar` as a valid match for the rule ([#5266](https://github.com/typescript-eslint/typescript-eslint/issues/5266)) ([aca935c](https://github.com/typescript-eslint/typescript-eslint/commit/aca935c9696712d4aff18144c4690db4d6ba9bf9)) ## [5.33.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.0...v5.33.1) (2022-08-15) **Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - # [5.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.32.0...v5.33.0) (2022-08-08) **Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - # [5.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.31.0...v5.32.0) (2022-08-01) **Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - # [5.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.7...v5.31.0) (2022-07-25) **Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - ## [5.30.7](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.6...v5.30.7) (2022-07-18) - ### Bug Fixes -* expose types supporting old versions of typescript ([#5339](https://github.com/typescript-eslint/typescript-eslint/issues/5339)) ([4ba9bdb](https://github.com/typescript-eslint/typescript-eslint/commit/4ba9bdb93f87e6bc370f13aa1de48f435abe3f88)) - - - - +- expose types supporting old versions of typescript ([#5339](https://github.com/typescript-eslint/typescript-eslint/issues/5339)) ([4ba9bdb](https://github.com/typescript-eslint/typescript-eslint/commit/4ba9bdb93f87e6bc370f13aa1de48f435abe3f88)) ## [5.30.6](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.5...v5.30.6) (2022-07-11) **Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - ## [5.30.5](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.4...v5.30.5) (2022-07-04) **Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - ## [5.30.4](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.3...v5.30.4) (2022-07-03) **Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - ## [5.30.3](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.2...v5.30.3) (2022-07-01) **Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - ## [5.30.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.1...v5.30.2) (2022-07-01) **Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - ## 5.30.1 (2022-07-01) **Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - # [5.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.29.0...v5.30.0) (2022-06-27) - ### Features -* treat `this` in `typeof this` as a `ThisExpression` ([#4382](https://github.com/typescript-eslint/typescript-eslint/issues/4382)) ([b04b2ce](https://github.com/typescript-eslint/typescript-eslint/commit/b04b2ce1ba90d94718891f2562dd210a6d7b8609)) - - - - +- treat `this` in `typeof this` as a `ThisExpression` ([#4382](https://github.com/typescript-eslint/typescript-eslint/issues/4382)) ([b04b2ce](https://github.com/typescript-eslint/typescript-eslint/commit/b04b2ce1ba90d94718891f2562dd210a6d7b8609)) # [5.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.28.0...v5.29.0) (2022-06-20) **Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - # [5.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.1...v5.28.0) (2022-06-13) **Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - ## [5.27.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.0...v5.27.1) (2022-06-06) **Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - # [5.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.26.0...v5.27.0) (2022-05-30) - ### Bug Fixes -* **types:** remove leftovers from removal of useJSXTextNode ([#5091](https://github.com/typescript-eslint/typescript-eslint/issues/5091)) ([f9c3647](https://github.com/typescript-eslint/typescript-eslint/commit/f9c3647cb637c8d1ee461b471da9d817ccbde77c)) - +- **types:** remove leftovers from removal of useJSXTextNode ([#5091](https://github.com/typescript-eslint/typescript-eslint/issues/5091)) ([f9c3647](https://github.com/typescript-eslint/typescript-eslint/commit/f9c3647cb637c8d1ee461b471da9d817ccbde77c)) ### Features -* [4.7] support new extensions ([#5027](https://github.com/typescript-eslint/typescript-eslint/issues/5027)) ([efc147b](https://github.com/typescript-eslint/typescript-eslint/commit/efc147b04dce52ab17415b6a4ae4076b944b9036)) -* [TS4.7] support type parameters for `typeof` ([#5067](https://github.com/typescript-eslint/typescript-eslint/issues/5067)) ([836de79](https://github.com/typescript-eslint/typescript-eslint/commit/836de79e8d1bff43149168cc913a4c2b60e79bf6)) -* bump dependency ranges to TypeScript 4.7 ([#5082](https://github.com/typescript-eslint/typescript-eslint/issues/5082)) ([c4310b1](https://github.com/typescript-eslint/typescript-eslint/commit/c4310b1aac35c7d31b826f0602eca6a5900a09ee)) - - - - +- [4.7] support new extensions ([#5027](https://github.com/typescript-eslint/typescript-eslint/issues/5027)) ([efc147b](https://github.com/typescript-eslint/typescript-eslint/commit/efc147b04dce52ab17415b6a4ae4076b944b9036)) +- [TS4.7] support type parameters for `typeof` ([#5067](https://github.com/typescript-eslint/typescript-eslint/issues/5067)) ([836de79](https://github.com/typescript-eslint/typescript-eslint/commit/836de79e8d1bff43149168cc913a4c2b60e79bf6)) +- bump dependency ranges to TypeScript 4.7 ([#5082](https://github.com/typescript-eslint/typescript-eslint/issues/5082)) ([c4310b1](https://github.com/typescript-eslint/typescript-eslint/commit/c4310b1aac35c7d31b826f0602eca6a5900a09ee)) # [5.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.25.0...v5.26.0) (2022-05-23) - ### Features -* [4.7] support instantiation expressions ([#4938](https://github.com/typescript-eslint/typescript-eslint/issues/4938)) ([79fbc77](https://github.com/typescript-eslint/typescript-eslint/commit/79fbc7743ae5dce3190f8168776e0204755390ad)) -* [4.7] support optional variance annotation ([#4831](https://github.com/typescript-eslint/typescript-eslint/issues/4831)) ([7e7b24c](https://github.com/typescript-eslint/typescript-eslint/commit/7e7b24c196e6d968e48f97f46feae5e7027e22d2)) -* **typescript-estree:** `extends` constraints for `infer` ([#4830](https://github.com/typescript-eslint/typescript-eslint/issues/4830)) ([8cbbcc3](https://github.com/typescript-eslint/typescript-eslint/commit/8cbbcc3d317779e0dcba15d3835137f38383de34)) - - - - +- [4.7] support instantiation expressions ([#4938](https://github.com/typescript-eslint/typescript-eslint/issues/4938)) ([79fbc77](https://github.com/typescript-eslint/typescript-eslint/commit/79fbc7743ae5dce3190f8168776e0204755390ad)) +- [4.7] support optional variance annotation ([#4831](https://github.com/typescript-eslint/typescript-eslint/issues/4831)) ([7e7b24c](https://github.com/typescript-eslint/typescript-eslint/commit/7e7b24c196e6d968e48f97f46feae5e7027e22d2)) +- **typescript-estree:** `extends` constraints for `infer` ([#4830](https://github.com/typescript-eslint/typescript-eslint/issues/4830)) ([8cbbcc3](https://github.com/typescript-eslint/typescript-eslint/commit/8cbbcc3d317779e0dcba15d3835137f38383de34)) # [5.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.24.0...v5.25.0) (2022-05-17) - ### Features -* update to TypeScript 4.7-rc ([#4829](https://github.com/typescript-eslint/typescript-eslint/issues/4829)) ([6fe783c](https://github.com/typescript-eslint/typescript-eslint/commit/6fe783c20aebe26ef42b526e4a59a9be84dd5643)) - - - - +- update to TypeScript 4.7-rc ([#4829](https://github.com/typescript-eslint/typescript-eslint/issues/4829)) ([6fe783c](https://github.com/typescript-eslint/typescript-eslint/commit/6fe783c20aebe26ef42b526e4a59a9be84dd5643)) # [5.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.23.0...v5.24.0) (2022-05-16) **Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - # [5.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.22.0...v5.23.0) (2022-05-09) **Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - # [5.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.21.0...v5.22.0) (2022-05-02) **Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - # [5.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.20.0...v5.21.0) (2022-04-25) **Note:** Version bump only for package @typescript-eslint/typescript-estree +# [5.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.19.0...v5.20.0) (2022-04-18) +**Note:** Version bump only for package @typescript-eslint/typescript-estree +# [5.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.18.0...v5.19.0) (2022-04-11) +**Note:** Version bump only for package @typescript-eslint/typescript-estree -# [5.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.19.0...v5.20.0) (2022-04-18) +# [5.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.17.0...v5.18.0) (2022-04-04) **Note:** Version bump only for package @typescript-eslint/typescript-estree +# [5.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.16.0...v5.17.0) (2022-03-28) +**Note:** Version bump only for package @typescript-eslint/typescript-estree +# [5.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.15.0...v5.16.0) (2022-03-21) +**Note:** Version bump only for package @typescript-eslint/typescript-estree -# [5.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.18.0...v5.19.0) (2022-04-11) +# [5.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.14.0...v5.15.0) (2022-03-14) **Note:** Version bump only for package @typescript-eslint/typescript-estree +# [5.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.13.0...v5.14.0) (2022-03-07) +### Features +- TypeScript 4.6 ([#4615](https://github.com/typescript-eslint/typescript-eslint/issues/4615)) ([a02c63a](https://github.com/typescript-eslint/typescript-eslint/commit/a02c63a264e5a6c3557468a8eff48d34ca2b718a)) - -# [5.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.17.0...v5.18.0) (2022-04-04) +# [5.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.1...v5.13.0) (2022-02-28) **Note:** Version bump only for package @typescript-eslint/typescript-estree +## [5.12.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.0...v5.12.1) (2022-02-21) +**Note:** Version bump only for package @typescript-eslint/typescript-estree +# [5.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.11.0...v5.12.0) (2022-02-14) +**Note:** Version bump only for package @typescript-eslint/typescript-estree -# [5.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.16.0...v5.17.0) (2022-03-28) +# [5.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.2...v5.11.0) (2022-02-07) **Note:** Version bump only for package @typescript-eslint/typescript-estree +## [5.10.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.1...v5.10.2) (2022-01-31) +**Note:** Version bump only for package @typescript-eslint/typescript-estree +## [5.10.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.0...v5.10.1) (2022-01-24) +**Note:** Version bump only for package @typescript-eslint/typescript-estree -# [5.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.15.0...v5.16.0) (2022-03-21) +# [5.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.1...v5.10.0) (2022-01-17) **Note:** Version bump only for package @typescript-eslint/typescript-estree +## [5.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.0...v5.9.1) (2022-01-10) +**Note:** Version bump only for package @typescript-eslint/typescript-estree +# [5.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.1...v5.9.0) (2022-01-03) +**Note:** Version bump only for package @typescript-eslint/typescript-estree -# [5.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.14.0...v5.15.0) (2022-03-14) +## [5.8.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.0...v5.8.1) (2021-12-27) **Note:** Version bump only for package @typescript-eslint/typescript-estree +# [5.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.7.0...v5.8.0) (2021-12-20) +**Note:** Version bump only for package @typescript-eslint/typescript-estree +# [5.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.6.0...v5.7.0) (2021-12-13) +### Bug Fixes -# [5.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.13.0...v5.14.0) (2022-03-07) +- **typescript-estree:** type-only regression for consumers not yet on TS 4.5 ([#4272](https://github.com/typescript-eslint/typescript-eslint/issues/4272)) ([550b61e](https://github.com/typescript-eslint/typescript-eslint/commit/550b61ee1096113b234bf035dd267ba385809961)) +# [5.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.5.0...v5.6.0) (2021-12-06) ### Features -* TypeScript 4.6 ([#4615](https://github.com/typescript-eslint/typescript-eslint/issues/4615)) ([a02c63a](https://github.com/typescript-eslint/typescript-eslint/commit/a02c63a264e5a6c3557468a8eff48d34ca2b718a)) - - +- **scope-manager:** update lib types ([#4240](https://github.com/typescript-eslint/typescript-eslint/issues/4240)) ([8377e6e](https://github.com/typescript-eslint/typescript-eslint/commit/8377e6ea422ee2d52455da8955ff055e09c238d3)) - - -# [5.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.1...v5.13.0) (2022-02-28) +# [5.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.4.0...v5.5.0) (2021-11-29) **Note:** Version bump only for package @typescript-eslint/typescript-estree +# [5.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.3.1...v5.4.0) (2021-11-15) +### Features +- **typescript-estree:** support Import Assertions ([#4074](https://github.com/typescript-eslint/typescript-eslint/issues/4074)) ([ae0fb5a](https://github.com/typescript-eslint/typescript-eslint/commit/ae0fb5a591958216b7df656e66b1dfe464898167)) +- **typescript-estree:** support private fields in-in syntax ([#4075](https://github.com/typescript-eslint/typescript-eslint/issues/4075)) ([939d8ea](https://github.com/typescript-eslint/typescript-eslint/commit/939d8eac547fb1734aa00f1ea01cc6eae0b4280a)) +- **typescript-estree:** support type-only module specifiers ([#4076](https://github.com/typescript-eslint/typescript-eslint/issues/4076)) ([77baa92](https://github.com/typescript-eslint/typescript-eslint/commit/77baa9203638e888a76e21003a278a8da386e133)) - -## [5.12.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.0...v5.12.1) (2022-02-21) +## [5.3.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.3.0...v5.3.1) (2021-11-08) **Note:** Version bump only for package @typescript-eslint/typescript-estree +# [5.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.2.0...v5.3.0) (2021-11-01) +**Note:** Version bump only for package @typescript-eslint/typescript-estree - - -# [5.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.11.0...v5.12.0) (2022-02-14) +# [5.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.1.0...v5.2.0) (2021-10-25) **Note:** Version bump only for package @typescript-eslint/typescript-estree +# [5.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.0.0...v5.1.0) (2021-10-18) +### Bug Fixes +- **typescript-estree:** support private optional property definition ([#3997](https://github.com/typescript-eslint/typescript-eslint/issues/3997)) ([8605e08](https://github.com/typescript-eslint/typescript-eslint/commit/8605e080a4dac4a277e6108cd9ed1e5a707302fa)) +# [5.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.33.0...v5.0.0) (2021-10-11) -# [5.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.2...v5.11.0) (2022-02-07) +### Bug Fixes -**Note:** Version bump only for package @typescript-eslint/typescript-estree +- **typescript-estree:** change `source` of ExportNamedDeclaration to Literal from Expression ([#3763](https://github.com/typescript-eslint/typescript-eslint/issues/3763)) ([dc5a0f5](https://github.com/typescript-eslint/typescript-eslint/commit/dc5a0f5104b400f4422b8d67ecfc6cc7a32613a2)) +### Features +- **ast-spec:** bring `Node` objects in line with ESTree ([#3771](https://github.com/typescript-eslint/typescript-eslint/issues/3771)) ([dd14064](https://github.com/typescript-eslint/typescript-eslint/commit/dd140643b457aa515cc21fcda2b3cd4acc2a1c5c)) +- **eslint-plugin:** update recommended configs ([#3809](https://github.com/typescript-eslint/typescript-eslint/issues/3809)) ([deeb7bb](https://github.com/typescript-eslint/typescript-eslint/commit/deeb7bb9334d301c6af56aefd37d318231af11ef)) +- align class property representation with ESTree ([#3806](https://github.com/typescript-eslint/typescript-eslint/issues/3806)) ([22fa5c0](https://github.com/typescript-eslint/typescript-eslint/commit/22fa5c0c4705ed2898f00b7cacc5dd642d859275)), closes [#3430](https://github.com/typescript-eslint/typescript-eslint/issues/3430) [#3077](https://github.com/typescript-eslint/typescript-eslint/issues/3077) +- remove `TSParenthesizedType` ([#3340](https://github.com/typescript-eslint/typescript-eslint/issues/3340)) ([c8ee432](https://github.com/typescript-eslint/typescript-eslint/commit/c8ee43269faea4c04ec02eaa2b81a0aa6eec5d3e)), closes [#3136](https://github.com/typescript-eslint/typescript-eslint/issues/3136) +- support `PrivateIdentifier` ([#3808](https://github.com/typescript-eslint/typescript-eslint/issues/3808)) ([0eefe5e](https://github.com/typescript-eslint/typescript-eslint/commit/0eefe5e49d21af3f1e3e2d9a90c2e49929863ac2)), closes [#3430](https://github.com/typescript-eslint/typescript-eslint/issues/3430) [#2933](https://github.com/typescript-eslint/typescript-eslint/issues/2933) +- **eslint-plugin:** removed value from abstract property nodes ([#3765](https://github.com/typescript-eslint/typescript-eslint/issues/3765)) ([5823524](https://github.com/typescript-eslint/typescript-eslint/commit/58235241714596b641a1e8b39c569e561e0039b4)), closes [#3748](https://github.com/typescript-eslint/typescript-eslint/issues/3748) +- **typescript-estree:** remove legacy `useJSXTextNode` option ([#3109](https://github.com/typescript-eslint/typescript-eslint/issues/3109)) ([5b84b98](https://github.com/typescript-eslint/typescript-eslint/commit/5b84b98fb3cf68d944b7d4e970f39f4e88f0b2d5)) +# [4.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.32.0...v4.33.0) (2021-10-04) +**Note:** Version bump only for package @typescript-eslint/typescript-estree -## [5.10.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.1...v5.10.2) (2022-01-31) +# [4.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.2...v4.32.0) (2021-09-27) **Note:** Version bump only for package @typescript-eslint/typescript-estree +## [4.31.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.1...v4.31.2) (2021-09-20) +**Note:** Version bump only for package @typescript-eslint/typescript-estree +## [4.31.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.0...v4.31.1) (2021-09-13) +**Note:** Version bump only for package @typescript-eslint/typescript-estree -## [5.10.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.0...v5.10.1) (2022-01-24) +# [4.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.30.0...v4.31.0) (2021-09-06) **Note:** Version bump only for package @typescript-eslint/typescript-estree +# [4.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.3...v4.30.0) (2021-08-30) +### Features +- **typescript-estree:** add support for class static blocks ([#3730](https://github.com/typescript-eslint/typescript-eslint/issues/3730)) ([f81831b](https://github.com/typescript-eslint/typescript-eslint/commit/f81831bd279a32da6dbab0f1c061053ea43965f6)) - -# [5.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.1...v5.10.0) (2022-01-17) +## [4.29.3](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.2...v4.29.3) (2021-08-23) **Note:** Version bump only for package @typescript-eslint/typescript-estree +## [4.29.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.1...v4.29.2) (2021-08-16) +**Note:** Version bump only for package @typescript-eslint/typescript-estree - - -## [5.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.0...v5.9.1) (2022-01-10) +## [4.29.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.0...v4.29.1) (2021-08-09) **Note:** Version bump only for package @typescript-eslint/typescript-estree +# [4.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.5...v4.29.0) (2021-08-02) + +### Bug Fixes +- **typescript-estree:** correct tty check ([#3635](https://github.com/typescript-eslint/typescript-eslint/issues/3635)) ([62bcc93](https://github.com/typescript-eslint/typescript-eslint/commit/62bcc937f08cd18296ffbe96a3551ec1fb87aecd)) +- **typescript-estree:** ensure --fix works with singleRun mode ([#3655](https://github.com/typescript-eslint/typescript-eslint/issues/3655)) ([99eca0d](https://github.com/typescript-eslint/typescript-eslint/commit/99eca0d428187d4c29ded9ddd1b57b40ab463c01)) +### Features +- **ast-spec:** make `BaseNode` & `BaseToken` more type-safe ([#3560](https://github.com/typescript-eslint/typescript-eslint/issues/3560)) ([a6c5604](https://github.com/typescript-eslint/typescript-eslint/commit/a6c5604b65b6330d047aa016fc46b8a597a6ae58)) +- **typescript-estree:** add support for custom module resolution ([#3516](https://github.com/typescript-eslint/typescript-eslint/issues/3516)) ([d48429d](https://github.com/typescript-eslint/typescript-eslint/commit/d48429d97326545bb727f88ce9056270b1599a31)) -# [5.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.1...v5.9.0) (2022-01-03) +## [4.28.5](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.4...v4.28.5) (2021-07-26) **Note:** Version bump only for package @typescript-eslint/typescript-estree +## [4.28.4](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.3...v4.28.4) (2021-07-19) +**Note:** Version bump only for package @typescript-eslint/typescript-estree +## [4.28.3](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.2...v4.28.3) (2021-07-12) +**Note:** Version bump only for package @typescript-eslint/typescript-estree -## [5.8.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.0...v5.8.1) (2021-12-27) +## [4.28.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.1...v4.28.2) (2021-07-05) **Note:** Version bump only for package @typescript-eslint/typescript-estree +## [4.28.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.0...v4.28.1) (2021-06-28) +**Note:** Version bump only for package @typescript-eslint/typescript-estree +# [4.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.27.0...v4.28.0) (2021-06-21) +**Note:** Version bump only for package @typescript-eslint/typescript-estree -# [5.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.7.0...v5.8.0) (2021-12-20) +# [4.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.1...v4.27.0) (2021-06-14) -**Note:** Version bump only for package @typescript-eslint/typescript-estree +### Bug Fixes +- **typescript-estree:** allow providing more one than one existing program in config ([#3508](https://github.com/typescript-eslint/typescript-eslint/issues/3508)) ([4f1806e](https://github.com/typescript-eslint/typescript-eslint/commit/4f1806e548affb7265da360d1fc8d033e25de325)) +- **typescript-estree:** support override modifier for parameter property ([#3485](https://github.com/typescript-eslint/typescript-eslint/issues/3485)) ([33b9f69](https://github.com/typescript-eslint/typescript-eslint/commit/33b9f69a681cd3219a2acca5b0b2fa67609f099e)) +### Features +- **ast-spec:** specify `PunctuatorToken`'s `value` type ([#3496](https://github.com/typescript-eslint/typescript-eslint/issues/3496)) ([fdb1d81](https://github.com/typescript-eslint/typescript-eslint/commit/fdb1d81f0fcf75a9216e6a90469f18c24c91f718)) +- **typescript-estree:** add opt-in inference for single runs and create programs for projects up front ([#3512](https://github.com/typescript-eslint/typescript-eslint/issues/3512)) ([06c2d9b](https://github.com/typescript-eslint/typescript-eslint/commit/06c2d9ba5442330f56637ecb14fae7e41696699c)) +- allow user to provide TS program instance in parser options ([#3484](https://github.com/typescript-eslint/typescript-eslint/issues/3484)) ([e855b18](https://github.com/typescript-eslint/typescript-eslint/commit/e855b18b8feee0edb5c617c11006861426a6f530)) +## [4.26.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.0...v4.26.1) (2021-06-07) -# [5.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.6.0...v5.7.0) (2021-12-13) +**Note:** Version bump only for package @typescript-eslint/typescript-estree +# [4.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.25.0...v4.26.0) (2021-05-31) ### Bug Fixes -* **typescript-estree:** type-only regression for consumers not yet on TS 4.5 ([#4272](https://github.com/typescript-eslint/typescript-eslint/issues/4272)) ([550b61e](https://github.com/typescript-eslint/typescript-eslint/commit/550b61ee1096113b234bf035dd267ba385809961)) +- generate library types for TypeScript v4.3 ([#3460](https://github.com/typescript-eslint/typescript-eslint/issues/3460)) ([ed4776a](https://github.com/typescript-eslint/typescript-eslint/commit/ed4776afa1374279027b9b7d82aa4b453b334998)), closes [#3449](https://github.com/typescript-eslint/typescript-eslint/issues/3449) +# [4.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.24.0...v4.25.0) (2021-05-24) +### Features +- **typescript-estree:** [TS4.3] support overrides on class members ([#3429](https://github.com/typescript-eslint/typescript-eslint/issues/3429)) ([21d1b62](https://github.com/typescript-eslint/typescript-eslint/commit/21d1b62a0b84b502d2cf12674b3d141994a3ffd4)) +- **typescript-estree:** add support for getter/setter signatures on types ([#3427](https://github.com/typescript-eslint/typescript-eslint/issues/3427)) ([b830b7f](https://github.com/typescript-eslint/typescript-eslint/commit/b830b7f4e8a99affc8af8b53cb83371ef81d7032)), closes [#3272](https://github.com/typescript-eslint/typescript-eslint/issues/3272) [#3272](https://github.com/typescript-eslint/typescript-eslint/issues/3272) - -# [5.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.5.0...v5.6.0) (2021-12-06) - - -### Features - -* **scope-manager:** update lib types ([#4240](https://github.com/typescript-eslint/typescript-eslint/issues/4240)) ([8377e6e](https://github.com/typescript-eslint/typescript-eslint/commit/8377e6ea422ee2d52455da8955ff055e09c238d3)) - - - - - -# [5.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.4.0...v5.5.0) (2021-11-29) - -**Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - - -# [5.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.3.1...v5.4.0) (2021-11-15) - - -### Features - -* **typescript-estree:** support Import Assertions ([#4074](https://github.com/typescript-eslint/typescript-eslint/issues/4074)) ([ae0fb5a](https://github.com/typescript-eslint/typescript-eslint/commit/ae0fb5a591958216b7df656e66b1dfe464898167)) -* **typescript-estree:** support private fields in-in syntax ([#4075](https://github.com/typescript-eslint/typescript-eslint/issues/4075)) ([939d8ea](https://github.com/typescript-eslint/typescript-eslint/commit/939d8eac547fb1734aa00f1ea01cc6eae0b4280a)) -* **typescript-estree:** support type-only module specifiers ([#4076](https://github.com/typescript-eslint/typescript-eslint/issues/4076)) ([77baa92](https://github.com/typescript-eslint/typescript-eslint/commit/77baa9203638e888a76e21003a278a8da386e133)) - - - - - -## [5.3.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.3.0...v5.3.1) (2021-11-08) - -**Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - - -# [5.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.2.0...v5.3.0) (2021-11-01) - -**Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - - -# [5.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.1.0...v5.2.0) (2021-10-25) - -**Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - - -# [5.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.0.0...v5.1.0) (2021-10-18) - - -### Bug Fixes - -* **typescript-estree:** support private optional property definition ([#3997](https://github.com/typescript-eslint/typescript-eslint/issues/3997)) ([8605e08](https://github.com/typescript-eslint/typescript-eslint/commit/8605e080a4dac4a277e6108cd9ed1e5a707302fa)) - - - - - -# [5.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.33.0...v5.0.0) (2021-10-11) - - -### Bug Fixes - -* **typescript-estree:** change `source` of ExportNamedDeclaration to Literal from Expression ([#3763](https://github.com/typescript-eslint/typescript-eslint/issues/3763)) ([dc5a0f5](https://github.com/typescript-eslint/typescript-eslint/commit/dc5a0f5104b400f4422b8d67ecfc6cc7a32613a2)) - - -### Features - -* **ast-spec:** bring `Node` objects in line with ESTree ([#3771](https://github.com/typescript-eslint/typescript-eslint/issues/3771)) ([dd14064](https://github.com/typescript-eslint/typescript-eslint/commit/dd140643b457aa515cc21fcda2b3cd4acc2a1c5c)) -* **eslint-plugin:** update recommended configs ([#3809](https://github.com/typescript-eslint/typescript-eslint/issues/3809)) ([deeb7bb](https://github.com/typescript-eslint/typescript-eslint/commit/deeb7bb9334d301c6af56aefd37d318231af11ef)) -* align class property representation with ESTree ([#3806](https://github.com/typescript-eslint/typescript-eslint/issues/3806)) ([22fa5c0](https://github.com/typescript-eslint/typescript-eslint/commit/22fa5c0c4705ed2898f00b7cacc5dd642d859275)), closes [#3430](https://github.com/typescript-eslint/typescript-eslint/issues/3430) [#3077](https://github.com/typescript-eslint/typescript-eslint/issues/3077) -* remove `TSParenthesizedType` ([#3340](https://github.com/typescript-eslint/typescript-eslint/issues/3340)) ([c8ee432](https://github.com/typescript-eslint/typescript-eslint/commit/c8ee43269faea4c04ec02eaa2b81a0aa6eec5d3e)), closes [#3136](https://github.com/typescript-eslint/typescript-eslint/issues/3136) -* support `PrivateIdentifier` ([#3808](https://github.com/typescript-eslint/typescript-eslint/issues/3808)) ([0eefe5e](https://github.com/typescript-eslint/typescript-eslint/commit/0eefe5e49d21af3f1e3e2d9a90c2e49929863ac2)), closes [#3430](https://github.com/typescript-eslint/typescript-eslint/issues/3430) [#2933](https://github.com/typescript-eslint/typescript-eslint/issues/2933) -* **eslint-plugin:** removed value from abstract property nodes ([#3765](https://github.com/typescript-eslint/typescript-eslint/issues/3765)) ([5823524](https://github.com/typescript-eslint/typescript-eslint/commit/58235241714596b641a1e8b39c569e561e0039b4)), closes [#3748](https://github.com/typescript-eslint/typescript-eslint/issues/3748) -* **typescript-estree:** remove legacy `useJSXTextNode` option ([#3109](https://github.com/typescript-eslint/typescript-eslint/issues/3109)) ([5b84b98](https://github.com/typescript-eslint/typescript-eslint/commit/5b84b98fb3cf68d944b7d4e970f39f4e88f0b2d5)) - - - - - -# [4.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.32.0...v4.33.0) (2021-10-04) - -**Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - - -# [4.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.2...v4.32.0) (2021-09-27) - -**Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - - -## [4.31.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.1...v4.31.2) (2021-09-20) - -**Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - - -## [4.31.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.0...v4.31.1) (2021-09-13) - -**Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - - -# [4.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.30.0...v4.31.0) (2021-09-06) - -**Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - - -# [4.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.3...v4.30.0) (2021-08-30) - - -### Features - -* **typescript-estree:** add support for class static blocks ([#3730](https://github.com/typescript-eslint/typescript-eslint/issues/3730)) ([f81831b](https://github.com/typescript-eslint/typescript-eslint/commit/f81831bd279a32da6dbab0f1c061053ea43965f6)) - - - - - -## [4.29.3](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.2...v4.29.3) (2021-08-23) - -**Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - - -## [4.29.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.1...v4.29.2) (2021-08-16) - -**Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - - -## [4.29.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.0...v4.29.1) (2021-08-09) - -**Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - - -# [4.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.5...v4.29.0) (2021-08-02) - - -### Bug Fixes - -* **typescript-estree:** correct tty check ([#3635](https://github.com/typescript-eslint/typescript-eslint/issues/3635)) ([62bcc93](https://github.com/typescript-eslint/typescript-eslint/commit/62bcc937f08cd18296ffbe96a3551ec1fb87aecd)) -* **typescript-estree:** ensure --fix works with singleRun mode ([#3655](https://github.com/typescript-eslint/typescript-eslint/issues/3655)) ([99eca0d](https://github.com/typescript-eslint/typescript-eslint/commit/99eca0d428187d4c29ded9ddd1b57b40ab463c01)) - - -### Features - -* **ast-spec:** make `BaseNode` & `BaseToken` more type-safe ([#3560](https://github.com/typescript-eslint/typescript-eslint/issues/3560)) ([a6c5604](https://github.com/typescript-eslint/typescript-eslint/commit/a6c5604b65b6330d047aa016fc46b8a597a6ae58)) -* **typescript-estree:** add support for custom module resolution ([#3516](https://github.com/typescript-eslint/typescript-eslint/issues/3516)) ([d48429d](https://github.com/typescript-eslint/typescript-eslint/commit/d48429d97326545bb727f88ce9056270b1599a31)) - - - - - -## [4.28.5](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.4...v4.28.5) (2021-07-26) - -**Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - - -## [4.28.4](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.3...v4.28.4) (2021-07-19) - -**Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - - -## [4.28.3](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.2...v4.28.3) (2021-07-12) - -**Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - - -## [4.28.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.1...v4.28.2) (2021-07-05) - -**Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - - -## [4.28.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.0...v4.28.1) (2021-06-28) - -**Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - - -# [4.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.27.0...v4.28.0) (2021-06-21) - -**Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - - -# [4.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.1...v4.27.0) (2021-06-14) - - -### Bug Fixes - -* **typescript-estree:** allow providing more one than one existing program in config ([#3508](https://github.com/typescript-eslint/typescript-eslint/issues/3508)) ([4f1806e](https://github.com/typescript-eslint/typescript-eslint/commit/4f1806e548affb7265da360d1fc8d033e25de325)) -* **typescript-estree:** support override modifier for parameter property ([#3485](https://github.com/typescript-eslint/typescript-eslint/issues/3485)) ([33b9f69](https://github.com/typescript-eslint/typescript-eslint/commit/33b9f69a681cd3219a2acca5b0b2fa67609f099e)) - - -### Features - -* **ast-spec:** specify `PunctuatorToken`'s `value` type ([#3496](https://github.com/typescript-eslint/typescript-eslint/issues/3496)) ([fdb1d81](https://github.com/typescript-eslint/typescript-eslint/commit/fdb1d81f0fcf75a9216e6a90469f18c24c91f718)) -* **typescript-estree:** add opt-in inference for single runs and create programs for projects up front ([#3512](https://github.com/typescript-eslint/typescript-eslint/issues/3512)) ([06c2d9b](https://github.com/typescript-eslint/typescript-eslint/commit/06c2d9ba5442330f56637ecb14fae7e41696699c)) -* allow user to provide TS program instance in parser options ([#3484](https://github.com/typescript-eslint/typescript-eslint/issues/3484)) ([e855b18](https://github.com/typescript-eslint/typescript-eslint/commit/e855b18b8feee0edb5c617c11006861426a6f530)) - - - - - -## [4.26.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.0...v4.26.1) (2021-06-07) - -**Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - - -# [4.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.25.0...v4.26.0) (2021-05-31) - - -### Bug Fixes - -* generate library types for TypeScript v4.3 ([#3460](https://github.com/typescript-eslint/typescript-eslint/issues/3460)) ([ed4776a](https://github.com/typescript-eslint/typescript-eslint/commit/ed4776afa1374279027b9b7d82aa4b453b334998)), closes [#3449](https://github.com/typescript-eslint/typescript-eslint/issues/3449) - - - - - -# [4.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.24.0...v4.25.0) (2021-05-24) - - -### Features - -* **typescript-estree:** [TS4.3] support overrides on class members ([#3429](https://github.com/typescript-eslint/typescript-eslint/issues/3429)) ([21d1b62](https://github.com/typescript-eslint/typescript-eslint/commit/21d1b62a0b84b502d2cf12674b3d141994a3ffd4)) -* **typescript-estree:** add support for getter/setter signatures on types ([#3427](https://github.com/typescript-eslint/typescript-eslint/issues/3427)) ([b830b7f](https://github.com/typescript-eslint/typescript-eslint/commit/b830b7f4e8a99affc8af8b53cb83371ef81d7032)), closes [#3272](https://github.com/typescript-eslint/typescript-eslint/issues/3272) [#3272](https://github.com/typescript-eslint/typescript-eslint/issues/3272) - - - - - -# [4.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.23.0...v4.24.0) (2021-05-17) - -**Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - - -# [4.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.1...v4.23.0) (2021-05-10) - - -### Features - -* refactor to split AST specification out as its own module ([#2911](https://github.com/typescript-eslint/typescript-eslint/issues/2911)) ([25ea953](https://github.com/typescript-eslint/typescript-eslint/commit/25ea953cc60b118bd385c71e0a9b61c286c26fcf)) - - - - - -## [4.22.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.0...v4.22.1) (2021-05-04) - -**Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - - -# [4.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.21.0...v4.22.0) (2021-04-12) - -**Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - - -# [4.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.20.0...v4.21.0) (2021-04-05) - -**Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - - -# [4.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.19.0...v4.20.0) (2021-03-29) - -**Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - - -# [4.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.18.0...v4.19.0) (2021-03-22) - - -### Bug Fixes - -* **typescript-estree:** [ts 4.2] add support for import type equal declaration ([#3189](https://github.com/typescript-eslint/typescript-eslint/issues/3189)) ([6a25faf](https://github.com/typescript-eslint/typescript-eslint/commit/6a25faf5cfa4d21a7546d9866819f4e017308fb2)) - - - - - -# [4.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.17.0...v4.18.0) (2021-03-15) - -**Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - - -# [4.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.16.1...v4.17.0) (2021-03-08) - -**Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - - -## [4.16.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.16.0...v4.16.1) (2021-03-01) - - -### Bug Fixes - -* **typescript-estree:** update TS version range ([#3127](https://github.com/typescript-eslint/typescript-eslint/issues/3127)) ([0473674](https://github.com/typescript-eslint/typescript-eslint/commit/0473674c58df5039a2de3c63ad7494fc6be7487e)) - - - - - -# [4.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.2...v4.16.0) (2021-03-01) - - -### Features - -* TypeScript 4.2 syntax support ([#3112](https://github.com/typescript-eslint/typescript-eslint/issues/3112)) ([2ebfb21](https://github.com/typescript-eslint/typescript-eslint/commit/2ebfb21ba6c88c793cfbd0e231e5803b2381694c)) -* **typescript-estree:** throw custom error instead of plain object ([#3011](https://github.com/typescript-eslint/typescript-eslint/issues/3011)) ([ae14bf5](https://github.com/typescript-eslint/typescript-eslint/commit/ae14bf55fe31b0eb982ba17333e4aac550d10342)) - - - - - -## [4.15.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.1...v4.15.2) (2021-02-22) - - -### Bug Fixes - -* **typescript-estree:** correct issues in AST definition ([#3083](https://github.com/typescript-eslint/typescript-eslint/issues/3083)) ([509a117](https://github.com/typescript-eslint/typescript-eslint/commit/509a11749f85400a01e9fecfecd12871ce562d3d)) -* add missing intrinsic keyword node to AST ([#3081](https://github.com/typescript-eslint/typescript-eslint/issues/3081)) ([409bf0b](https://github.com/typescript-eslint/typescript-eslint/commit/409bf0bb3e2ac4d8782408d436ebdefb42dba38b)) -* correct test names on windows for semantic-diagnostics-enabled ([#3060](https://github.com/typescript-eslint/typescript-eslint/issues/3060)) ([885780d](https://github.com/typescript-eslint/typescript-eslint/commit/885780d4a2b07e418256b7323d76b18453c14a50)) - - - - - -## [4.15.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.0...v4.15.1) (2021-02-15) - -**Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - - -# [4.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.2...v4.15.0) (2021-02-08) - - -### Features - -* **typescript-estree:** improve logic used to escape string literals in jsx ([#2995](https://github.com/typescript-eslint/typescript-eslint/issues/2995)) ([3cb3aad](https://github.com/typescript-eslint/typescript-eslint/commit/3cb3aade2864bab15ed1ff8d7cd32766aa57152f)) - - - - - -## [4.14.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.1...v4.14.2) (2021-02-01) - -**Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - - -## [4.14.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.0...v4.14.1) (2021-01-25) - -**Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - - -# [4.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.13.0...v4.14.0) (2021-01-18) - -**Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - - -# [4.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.12.0...v4.13.0) (2021-01-11) - -**Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - - -# [4.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.11.1...v4.12.0) (2021-01-04) - -**Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - - -## [4.11.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.11.0...v4.11.1) (2020-12-28) - -**Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - - -# [4.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.10.0...v4.11.0) (2020-12-21) - -**Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - - -# [4.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.9.1...v4.10.0) (2020-12-14) - -**Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - - -## [4.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.9.0...v4.9.1) (2020-12-07) - -**Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - - -# [4.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.2...v4.9.0) (2020-11-30) - - -### Bug Fixes - -* **typescript-estree:** add default value for `parserOptions.projectFolderIgnoreList` and deduplicate resolved projects ([#2819](https://github.com/typescript-eslint/typescript-eslint/issues/2819)) ([bf904ec](https://github.com/typescript-eslint/typescript-eslint/commit/bf904ec72db57174fec531f61e9427230662553e)), closes [#2418](https://github.com/typescript-eslint/typescript-eslint/issues/2418) [#2814](https://github.com/typescript-eslint/typescript-eslint/issues/2814) - - - - - -## [4.8.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.1...v4.8.2) (2020-11-23) - - -### Bug Fixes - -* **typescript-estree:** fix type-only regression for consumers not yet on TS 4.1 ([#2789](https://github.com/typescript-eslint/typescript-eslint/issues/2789)) ([50a46c6](https://github.com/typescript-eslint/typescript-eslint/commit/50a46c60fb81d8434aa4268a13d17d8fcf499e21)) - - - - - -## [4.8.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.0...v4.8.1) (2020-11-17) - - -### Bug Fixes - -* **typescript-estree:** parseWithNodeMaps returning empty maps ([#2773](https://github.com/typescript-eslint/typescript-eslint/issues/2773)) ([3e4a0ed](https://github.com/typescript-eslint/typescript-eslint/commit/3e4a0ed0d615fd22a2f28c7c8af6179673e195f8)) - - - - - -# [4.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.7.0...v4.8.0) (2020-11-16) - - -### Features - -* **typescript-estree:** add `parseWithNodeMaps` API ([#2760](https://github.com/typescript-eslint/typescript-eslint/issues/2760)) ([9441d50](https://github.com/typescript-eslint/typescript-eslint/commit/9441d5030211f1c32f5ae8e61d5565cab8bb6823)), closes [#1852](https://github.com/typescript-eslint/typescript-eslint/issues/1852) - - - - - -# [4.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.6.1...v4.7.0) (2020-11-09) - - -### Features - -* support TS4.1 features ([#2748](https://github.com/typescript-eslint/typescript-eslint/issues/2748)) ([2be354b](https://github.com/typescript-eslint/typescript-eslint/commit/2be354bb15f9013a2da1b13a0c0836e9ef057e16)), closes [#2583](https://github.com/typescript-eslint/typescript-eslint/issues/2583) - - - - - -## [4.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.6.0...v4.6.1) (2020-11-02) - -**Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - - -# [4.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.5.0...v4.6.0) (2020-10-26) - -**Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - - -# [4.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.4.1...v4.5.0) (2020-10-19) - - -### Features - -* **typescript-estree:** add flag EXPERIMENTAL_useSourceOfProjectReferenceRedirect ([#2669](https://github.com/typescript-eslint/typescript-eslint/issues/2669)) ([90a5878](https://github.com/typescript-eslint/typescript-eslint/commit/90a587845088da1b205e4d7d77dbc3f9447b1c5a)) - - - - - -## [4.4.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.4.0...v4.4.1) (2020-10-12) - -**Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - - -# [4.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.3.0...v4.4.0) (2020-10-05) - -**Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - - -# [4.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.2.0...v4.3.0) (2020-09-28) - -**Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - - -# [4.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.1...v4.2.0) (2020-09-21) - -**Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - - -## [4.1.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.0...v4.1.1) (2020-09-14) - -**Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - - -# [4.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.0.1...v4.1.0) (2020-09-07) - -**Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - - -## [4.0.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.0.0...v4.0.1) (2020-08-31) - -**Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - - -# [4.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.10.1...v4.0.0) (2020-08-31) - - -### Bug Fixes - -* correct decorator traversal for AssignmentPattern ([#2375](https://github.com/typescript-eslint/typescript-eslint/issues/2375)) ([d738fa4](https://github.com/typescript-eslint/typescript-eslint/commit/d738fa4eff0a5c4cfc9b30b1c0502f8d1e78d7b6)) -* **typescript-estree:** correct ChainExpression interaction with parentheses and non-nulls ([#2380](https://github.com/typescript-eslint/typescript-eslint/issues/2380)) ([762bc99](https://github.com/typescript-eslint/typescript-eslint/commit/762bc99584ede4d0b8099a743991e957aec86aa8)) - - -### Features - -* support ESTree optional chaining representation ([#2308](https://github.com/typescript-eslint/typescript-eslint/issues/2308)) ([e9d2ab6](https://github.com/typescript-eslint/typescript-eslint/commit/e9d2ab638b6767700b52797e74b814ea059beaae)) -* **typescript-estree:** switch to globby ([#2418](https://github.com/typescript-eslint/typescript-eslint/issues/2418)) ([3a7ec9b](https://github.com/typescript-eslint/typescript-eslint/commit/3a7ec9bcf1873a99c6da2f19ade8ab4763b4793c)), closes [#2398](https://github.com/typescript-eslint/typescript-eslint/issues/2398) - - -### BREAKING CHANGES - -* **typescript-estree:** - removes the ability to supply a `RegExp` to `projectFolderIgnoreList`, and changes the meaning of the string value from a regex to a glob. -* - Removed decorators property from several Nodes that could never semantically have them (FunctionDeclaration, TSEnumDeclaration, and TSInterfaceDeclaration) -- Removed AST_NODE_TYPES.Import. This is a minor breaking change as the node type that used this was removed ages ago. - - - - - -## [3.10.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.10.0...v3.10.1) (2020-08-25) +# [4.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.23.0...v4.24.0) (2021-05-17) **Note:** Version bump only for package @typescript-eslint/typescript-estree - - - - -# [3.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.9.1...v3.10.0) (2020-08-24) - - -### Bug Fixes - -* **typescript-estree:** ts.NamedTupleMember workaround for TypeScript ESTree +# `@typescript-eslint/typescript-estree` -

A parser that converts TypeScript source code into an ESTree-compatible form

- -

- CI - NPM Version - NPM Downloads -

- -## Getting Started - -**[You can find our Getting Started docs here](https://typescript-eslint.io/docs)** - -## About - -This parser is somewhat generic and robust, and could be used to power any use-case which requires taking TypeScript source code and producing an ESTree-compatible AST. - -In fact, it is already used within these hyper-popular open-source projects to power their TypeScript support: - -- [ESLint](https://eslint.org), the pluggable linting utility for JavaScript and JSX -- [Prettier](https://prettier.io), an opinionated code formatter - -## Installation - -```sh -yarn add -D @typescript-eslint/typescript-estree -``` - -## API - -### Parsing - -#### `parse(code, options)` - -Parses the given string of code with the options provided and returns an ESTree-compatible AST. - -```ts -interface ParseOptions { - /** - * create a top-level comments array containing all comments - */ - comment?: boolean; - - /** - * An array of modules to turn explicit debugging on for. - * - 'typescript-eslint' is the same as setting the env var `DEBUG=typescript-eslint:*` - * - 'eslint' is the same as setting the env var `DEBUG=eslint:*` - * - 'typescript' is the same as setting `extendedDiagnostics: true` in your tsconfig compilerOptions - * - * For convenience, also supports a boolean: - * - true === ['typescript-eslint'] - * - false === [] - */ - debugLevel?: boolean | ('typescript-eslint' | 'eslint' | 'typescript')[]; - - /** - * Cause the parser to error if it encounters an unknown AST node type (useful for testing). - * This case only usually occurs when TypeScript releases new features. - */ - errorOnUnknownASTType?: boolean; - - /** - * Absolute (or relative to `cwd`) path to the file being parsed. - */ - filePath?: string; - - /** - * Enable parsing of JSX. - * For more details, see https://www.typescriptlang.org/docs/handbook/jsx.html - * - * NOTE: this setting does not effect known file types (.js, .cjs, .mjs, .jsx, .ts, .mts, .cts, .tsx, .json) because the - * TypeScript compiler has its own internal handling for known file extensions. - * - * For the exact behavior, see https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/parser#parseroptionsecmafeaturesjsx - */ - jsx?: boolean; - - /** - * Controls whether the `loc` information to each node. - * The `loc` property is an object which contains the exact line/column the node starts/ends on. - * This is similar to the `range` property, except it is line/column relative. - */ - loc?: boolean; - - /* - * Allows overriding of function used for logging. - * When value is `false`, no logging will occur. - * When value is not provided, `console.log()` will be used. - */ - loggerFn?: Function | false; - - /** - * Controls whether the `range` property is included on AST nodes. - * The `range` property is a [number, number] which indicates the start/end index of the node in the file contents. - * This is similar to the `loc` property, except this is the absolute index. - */ - range?: boolean; - - /** - * Set to true to create a top-level array containing all tokens from the file. - */ - tokens?: boolean; -} - -const PARSE_DEFAULT_OPTIONS: ParseOptions = { - comment: false, - errorOnUnknownASTType: false, - filePath: 'estree.ts', // or 'estree.tsx', if you pass jsx: true - jsx: false, - loc: false, - loggerFn: undefined, - range: false, - tokens: false, -}; - -declare function parse( - code: string, - options: ParseOptions = PARSE_DEFAULT_OPTIONS, -): TSESTree.Program; -``` - -Example usage: - -```js -import { parse } from '@typescript-eslint/typescript-estree'; - -const code = `const hello: string = 'world';`; -const ast = parse(code, { - loc: true, - range: true, -}); -``` - -#### `parseAndGenerateServices(code, options)` - -Parses the given string of code with the options provided and returns an ESTree-compatible AST. Accepts additional options which can be used to generate type information along with the AST. - -```ts -interface ParseAndGenerateServicesOptions extends ParseOptions { - /** - * Causes the parser to error if the TypeScript compiler returns any unexpected syntax/semantic errors. - */ - errorOnTypeScriptSyntacticAndSemanticIssues?: boolean; - - /** - * ***EXPERIMENTAL FLAG*** - Use this at your own risk. - * - * Causes TS to use the source files for referenced projects instead of the compiled .d.ts files. - * This feature is not yet optimized, and is likely to cause OOMs for medium to large projects. - * - * This flag REQUIRES at least TS v3.9, otherwise it does nothing. - * - * See: https://github.com/typescript-eslint/typescript-eslint/issues/2094 - */ - EXPERIMENTAL_useSourceOfProjectReferenceRedirect?: boolean; - - /** - * When `project` is provided, this controls the non-standard file extensions which will be parsed. - * It accepts an array of file extensions, each preceded by a `.`. - */ - extraFileExtensions?: string[]; - - /** - * Absolute (or relative to `tsconfigRootDir`) path to the file being parsed. - * When `project` is provided, this is required, as it is used to fetch the file from the TypeScript compiler's cache. - */ - filePath?: string; - - /** - * Allows the user to control whether or not two-way AST node maps are preserved - * during the AST conversion process. - * - * By default: the AST node maps are NOT preserved, unless `project` has been specified, - * in which case the maps are made available on the returned `parserServices`. - * - * NOTE: If `preserveNodeMaps` is explicitly set by the user, it will be respected, - * regardless of whether or not `project` is in use. - */ - preserveNodeMaps?: boolean; - - /** - * Absolute (or relative to `tsconfigRootDir`) paths to the tsconfig(s). - * If this is provided, type information will be returned. - */ - project?: string | string[]; - - /** - * If you provide a glob (or globs) to the project option, you can use this option to ignore certain folders from - * being matched by the globs. - * This accepts an array of globs to ignore. - * - * By default, this is set to ["/node_modules/"] - */ - projectFolderIgnoreList?: string[]; - - /** - * The absolute path to the root directory for all provided `project`s. - */ - tsconfigRootDir?: string; - - /** - * An array of one or more instances of TypeScript Program objects to be used for type information. - * This overrides any program or programs that would have been computed from the `project` option. - * All linted files must be part of the provided program(s). - */ - programs?: Program[]; - - /** - *************************************************************************************** - * IT IS RECOMMENDED THAT YOU DO NOT USE THIS OPTION, AS IT CAUSES PERFORMANCE ISSUES. * - *************************************************************************************** - * - * When passed with `project`, this allows the parser to create a catch-all, default program. - * This means that if the parser encounters a file not included in any of the provided `project`s, - * it will not error, but will instead parse the file and its dependencies in a new program. - */ - createDefaultProgram?: boolean; - - /** - * ESLint (and therefore typescript-eslint) is used in both "single run"/one-time contexts, - * such as an ESLint CLI invocation, and long-running sessions (such as continuous feedback - * on a file in an IDE). - * - * When typescript-eslint handles TypeScript Program management behind the scenes, this distinction - * is important because there is significant overhead to managing the so called Watch Programs - * needed for the long-running use-case. - * - * When allowAutomaticSingleRunInference is enabled, we will use common heuristics to infer - * whether or not ESLint is being used as part of a single run. - */ - allowAutomaticSingleRunInference?: boolean; - - /** - * Path to a file exporting a custom ModuleResolver. - */ - moduleResolver?: string; -} - -interface ParserServices { - program: ts.Program; - esTreeNodeToTSNodeMap: WeakMap; - tsNodeToESTreeNodeMap: WeakMap; - hasFullTypeInformation: boolean; -} - -interface ParseAndGenerateServicesResult { - ast: TSESTree.Program; - services: ParserServices; -} - -const PARSE_AND_GENERATE_SERVICES_DEFAULT_OPTIONS: ParseOptions = { - ...PARSE_DEFAULT_OPTIONS, - errorOnTypeScriptSyntacticAndSemanticIssues: false, - extraFileExtensions: [], - preserveNodeMaps: false, // or true, if you do not set this, but pass `project` - project: undefined, - projectFolderIgnoreList: ['/node_modules/'], - tsconfigRootDir: process.cwd(), -}; - -declare function parseAndGenerateServices( - code: string, - options: ParseOptions = PARSE_DEFAULT_OPTIONS, -): ParseAndGenerateServicesResult; -``` - -Example usage: - -```js -import { parseAndGenerateServices } from '@typescript-eslint/typescript-estree'; - -const code = `const hello: string = 'world';`; -const { ast, services } = parseAndGenerateServices(code, { - filePath: '/some/path/to/file/foo.ts', - loc: true, - project: './tsconfig.json', - range: true, -}); -``` - -#### `parseWithNodeMaps(code, options)` - -Parses the given string of code with the options provided and returns both the ESTree-compatible AST as well as the node maps. -This allows you to work with both ASTs without the overhead of types that may come with `parseAndGenerateServices`. - -```ts -interface ParseWithNodeMapsResult { - ast: TSESTree.Program; - esTreeNodeToTSNodeMap: ParserServices['esTreeNodeToTSNodeMap']; - tsNodeToESTreeNodeMap: ParserServices['tsNodeToESTreeNodeMap']; -} - -declare function parseWithNodeMaps( - code: string, - options: ParseOptions = PARSE_DEFAULT_OPTIONS, -): ParseWithNodeMapsResult; -``` - -Example usage: - -```js -import { parseWithNodeMaps } from '@typescript-eslint/typescript-estree'; - -const code = `const hello: string = 'world';`; -const { ast, esTreeNodeToTSNodeMap, tsNodeToESTreeNodeMap } = parseWithNodeMaps( - code, - { - loc: true, - range: true, - }, -); -``` - -### `TSESTree`, `AST_NODE_TYPES` and `AST_TOKEN_TYPES` - -Types for the AST produced by the parse functions. - -- `TSESTree` is a namespace which contains object types representing all of the AST Nodes produced by the parser. -- `AST_NODE_TYPES` is an enum which provides the values for every single AST node's `type` property. -- `AST_TOKEN_TYPES` is an enum which provides the values for every single AST token's `type` property. - -### Utilities - -#### `createProgram(configFile, projectDirectory)` - -This serves as a utility method for users of the `ParseOptions.programs` feature to create a TypeScript program instance from a config file. - -```ts -declare function createProgram( - configFile: string, - projectDirectory: string = process.cwd(), -): import('typescript').Program; -``` - -Example usage: - -```js -const tsESTree = require('@typescript-eslint/typescript-estree'); - -const program = tsESTree.createProgram('tsconfig.json'); -const code = `const hello: string = 'world';`; -const { ast, services } = parseAndGenerateServices(code, { - filePath: '/some/path/to/file/foo.ts', - loc: true, - program, - range: true, -}); -``` - -## Supported TypeScript Version - -See the [Supported TypeScript Version](../../README.md#supported-typescript-version) section in the project root. - -If you use a non-supported version of TypeScript, the parser will log a warning to the console. - -**Please ensure that you are using a supported version before submitting any issues/bug reports.** - -## Reporting Issues - -Please check the current list of open and known issues and ensure the issue has not been reported before. When creating a new issue provide as much information about your environment as possible. This includes: - -- TypeScript version -- The `typescript-estree` version - -## AST Alignment Tests - -A couple of years after work on this parser began, the TypeScript Team at Microsoft began [officially supporting TypeScript parsing via Babel](https://blogs.msdn.microsoft.com/typescript/2018/08/27/typescript-and-babel-7/). - -I work closely with the TypeScript Team and we are gradually aligning the AST of this project with the one produced by Babel's parser. To that end, I have created a full test harness to compare the ASTs of the two projects which runs on every PR, please see [the code](https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/typescript-estree/tests/ast-alignment) for more details. - -## Debugging - -If you encounter a bug with the parser that you want to investigate, you can turn on the debug logging via setting the environment variable: `DEBUG=typescript-eslint:*`. -I.e. in this repo you can run: `DEBUG=typescript-eslint:* yarn lint`. - -## License - -TypeScript ESTree inherits from the the original TypeScript ESLint Parser license, as the majority of the work began there. It is licensed under a permissive BSD 2-clause license. +[![NPM Version](https://img.shields.io/npm/v/@typescript-eslint/typescript-estree.svg?style=flat-square)](https://www.npmjs.com/package/@typescript-eslint/utils) +[![NPM Downloads](https://img.shields.io/npm/dm/@typescript-eslint/typescript-estree.svg?style=flat-square)](https://www.npmjs.com/package/@typescript-eslint/utils) ## Contributing -[See the contributing guide here](../../CONTRIBUTING.md) +👉 See **https://typescript-eslint.io/architecture/typescript-estree** for documentation on this package. + +> See https://typescript-eslint.io for general documentation on typescript-eslint, the tooling that allows you to run ESLint and Prettier on TypeScript code. diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index d6f16b776a5..f03bb3eeecf 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/typescript-estree", - "version": "5.39.0", + "version": "5.46.1", "description": "A parser that converts TypeScript source code into an ESTree compatible form", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -37,13 +37,13 @@ "clean": "tsc -b tsconfig.build.json --clean", "postclean": "rimraf dist && rimraf _ts3.4 && rimraf coverage", "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", - "lint": "eslint . --ignore-path='../../.eslintignore'", + "lint": "nx lint", "test": "jest --coverage", "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/types": "5.39.0", - "@typescript-eslint/visitor-keys": "5.39.0", + "@typescript-eslint/types": "5.46.1", + "@typescript-eslint/visitor-keys": "5.46.1", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -59,7 +59,7 @@ "@types/is-glob": "*", "@types/semver": "*", "@types/tmp": "*", - "@typescript-eslint/shared-fixtures": "5.39.0", + "@typescript-eslint/shared-fixtures": "5.46.1", "glob": "*", "jest-specific-snapshot": "*", "make-dir": "*", diff --git a/packages/typescript-estree/project.json b/packages/typescript-estree/project.json index fe32123b550..2856ffe4f07 100644 --- a/packages/typescript-estree/project.json +++ b/packages/typescript-estree/project.json @@ -1,5 +1,15 @@ { - "root": "packages/typescript-estree", + "name": "typescript-estree", + "$schema": "../../node_modules/nx/schemas/project-schema.json", "type": "library", - "implicitDependencies": ["@typescript-eslint/types"] + "implicitDependencies": ["types"], + "targets": { + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["packages/typescript-estree/**/*.ts"] + } + } + } } diff --git a/packages/typescript-estree/src/ast-converter.ts b/packages/typescript-estree/src/ast-converter.ts index 86a1970aef7..b9be864f529 100644 --- a/packages/typescript-estree/src/ast-converter.ts +++ b/packages/typescript-estree/src/ast-converter.ts @@ -4,13 +4,13 @@ import type { ASTMaps } from './convert'; import { Converter, convertError } from './convert'; import { convertComments } from './convert-comments'; import { convertTokens } from './node-utils'; -import type { Extra } from './parser-options'; +import type { ParseSettings } from './parseSettings'; import { simpleTraverse } from './simple-traverse'; import type { TSESTree } from './ts-estree'; export function astConverter( ast: SourceFile, - extra: Extra, + parseSettings: ParseSettings, shouldPreserveNodeMaps: boolean, ): { estree: TSESTree.Program; astMaps: ASTMaps } { /** @@ -26,7 +26,7 @@ export function astConverter( * Recursively convert the TypeScript AST into an ESTree-compatible AST */ const instance = new Converter(ast, { - errorOnUnknownASTType: extra.errorOnUnknownASTType || false, + errorOnUnknownASTType: parseSettings.errorOnUnknownASTType || false, shouldPreserveNodeMaps, }); @@ -35,15 +35,15 @@ export function astConverter( /** * Optionally remove range and loc if specified */ - if (!extra.range || !extra.loc) { + if (!parseSettings.range || !parseSettings.loc) { simpleTraverse(estree, { enter: node => { - if (!extra.range) { + if (!parseSettings.range) { // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- TS 4.0 made this an error because the types aren't optional // @ts-expect-error delete node.range; } - if (!extra.loc) { + if (!parseSettings.loc) { // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- TS 4.0 made this an error because the types aren't optional // @ts-expect-error delete node.loc; @@ -55,15 +55,15 @@ export function astConverter( /** * Optionally convert and include all tokens in the AST */ - if (extra.tokens) { + if (parseSettings.tokens) { estree.tokens = convertTokens(ast); } /** * Optionally convert and include all comments in the AST */ - if (extra.comment) { - estree.comments = convertComments(ast, extra.code); + if (parseSettings.comment) { + estree.comments = convertComments(ast, parseSettings.code); } const astMaps = instance.getASTMaps(); diff --git a/packages/typescript-estree/src/convert.ts b/packages/typescript-estree/src/convert.ts index 30c33050d42..b21a42614da 100644 --- a/packages/typescript-estree/src/convert.ts +++ b/packages/typescript-estree/src/convert.ts @@ -1167,12 +1167,30 @@ export class Converter { case SyntaxKind.PropertyDeclaration: { const isAbstract = hasModifier(SyntaxKind.AbstractKeyword, node); + const isAccessor = hasModifier(SyntaxKind.AccessorKeyword, node); + + // eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- TODO - add ignore IIFE option + const type = (() => { + if (isAccessor) { + if (isAbstract) { + return AST_NODE_TYPES.TSAbstractAccessorProperty; + } + return AST_NODE_TYPES.AccessorProperty; + } + + if (isAbstract) { + return AST_NODE_TYPES.TSAbstractPropertyDefinition; + } + return AST_NODE_TYPES.PropertyDefinition; + })(); + const result = this.createNode< - TSESTree.TSAbstractPropertyDefinition | TSESTree.PropertyDefinition + | TSESTree.TSAbstractAccessorProperty + | TSESTree.TSAbstractPropertyDefinition + | TSESTree.PropertyDefinition + | TSESTree.AccessorProperty >(node, { - type: isAbstract - ? AST_NODE_TYPES.TSAbstractPropertyDefinition - : AST_NODE_TYPES.PropertyDefinition, + type, key: this.convertChild(node.name), value: isAbstract ? null : this.convertChild(node.initializer), computed: isComputedProperty(node.name), @@ -2954,6 +2972,14 @@ export class Converter { }); } + case SyntaxKind.SatisfiesExpression: { + return this.createNode(node, { + type: AST_NODE_TYPES.TSSatisfiesExpression, + expression: this.convertChild(node.expression), + typeAnnotation: this.convertChild(node.type), + }); + } + default: return this.deeplyCopy(node); } diff --git a/packages/typescript-estree/src/create-program/createDefaultProgram.ts b/packages/typescript-estree/src/create-program/createDefaultProgram.ts index bebb194aef5..a2de81399d2 100644 --- a/packages/typescript-estree/src/create-program/createDefaultProgram.ts +++ b/packages/typescript-estree/src/create-program/createDefaultProgram.ts @@ -2,8 +2,8 @@ import debug from 'debug'; import path from 'path'; import * as ts from 'typescript'; -import type { Extra } from '../parser-options'; -import type { ASTAndProgram, CanonicalPath } from './shared'; +import type { ParseSettings } from '../parseSettings'; +import type { ASTAndProgram } from './shared'; import { createDefaultCompilerOptionsFromExtra, getModuleResolver, @@ -12,27 +12,26 @@ import { const log = debug('typescript-eslint:typescript-estree:createDefaultProgram'); /** - * @param code The code of the file being linted - * @param extra The config object - * @param extra.tsconfigRootDir The root directory for relative tsconfig paths - * @param extra.projects Provided tsconfig paths + * @param parseSettings Internal settings for parsing the file * @returns If found, returns the source file corresponding to the code and the containing program */ function createDefaultProgram( - code: string, - extra: Extra, + parseSettings: ParseSettings, ): ASTAndProgram | undefined { - log('Getting default program for: %s', extra.filePath || 'unnamed file'); + log( + 'Getting default program for: %s', + parseSettings.filePath || 'unnamed file', + ); - if (!extra.projects || extra.projects.length !== 1) { + if (parseSettings.projects?.length !== 1) { return undefined; } - const tsconfigPath: CanonicalPath = extra.projects[0]; + const tsconfigPath = parseSettings.projects[0]; const commandLine = ts.getParsedCommandLineOfConfigFile( tsconfigPath, - createDefaultCompilerOptionsFromExtra(extra), + createDefaultCompilerOptionsFromExtra(parseSettings), { ...ts.sys, onUnRecoverableConfigFileDiagnostic: () => {} }, ); @@ -45,24 +44,24 @@ function createDefaultProgram( /* setParentNodes */ true, ); - if (extra.moduleResolver) { + if (parseSettings.moduleResolver) { compilerHost.resolveModuleNames = getModuleResolver( - extra.moduleResolver, + parseSettings.moduleResolver, ).resolveModuleNames; } const oldReadFile = compilerHost.readFile; compilerHost.readFile = (fileName: string): string | undefined => - path.normalize(fileName) === path.normalize(extra.filePath) - ? code + path.normalize(fileName) === path.normalize(parseSettings.filePath) + ? parseSettings.code : oldReadFile(fileName); const program = ts.createProgram( - [extra.filePath], + [parseSettings.filePath], commandLine.options, compilerHost, ); - const ast = program.getSourceFile(extra.filePath); + const ast = program.getSourceFile(parseSettings.filePath); return ast && { ast, program }; } diff --git a/packages/typescript-estree/src/create-program/createIsolatedProgram.ts b/packages/typescript-estree/src/create-program/createIsolatedProgram.ts index ba19b843aeb..5ec1c8e0fe7 100644 --- a/packages/typescript-estree/src/create-program/createIsolatedProgram.ts +++ b/packages/typescript-estree/src/create-program/createIsolatedProgram.ts @@ -1,7 +1,7 @@ import debug from 'debug'; import * as ts from 'typescript'; -import type { Extra } from '../parser-options'; +import type { ParseSettings } from '../parseSettings'; import { getScriptKind } from './getScriptKind'; import type { ASTAndProgram } from './shared'; import { createDefaultCompilerOptionsFromExtra } from './shared'; @@ -12,11 +12,11 @@ const log = debug('typescript-eslint:typescript-estree:createIsolatedProgram'); * @param code The code of the file being linted * @returns Returns a new source file and program corresponding to the linted code */ -function createIsolatedProgram(code: string, extra: Extra): ASTAndProgram { +function createIsolatedProgram(parseSettings: ParseSettings): ASTAndProgram { log( 'Getting isolated program in %s mode for: %s', - extra.jsx ? 'TSX' : 'TS', - extra.filePath, + parseSettings.jsx ? 'TSX' : 'TS', + parseSettings.filePath, ); const compilerHost: ts.CompilerHost = { @@ -24,7 +24,7 @@ function createIsolatedProgram(code: string, extra: Extra): ASTAndProgram { return true; }, getCanonicalFileName() { - return extra.filePath; + return parseSettings.filePath; }, getCurrentDirectory() { return ''; @@ -43,10 +43,10 @@ function createIsolatedProgram(code: string, extra: Extra): ASTAndProgram { getSourceFile(filename: string) { return ts.createSourceFile( filename, - code, + parseSettings.code, ts.ScriptTarget.Latest, /* setParentNodes */ true, - getScriptKind(extra.filePath, extra.jsx), + getScriptKind(parseSettings.filePath, parseSettings.jsx), ); }, readFile() { @@ -61,17 +61,17 @@ function createIsolatedProgram(code: string, extra: Extra): ASTAndProgram { }; const program = ts.createProgram( - [extra.filePath], + [parseSettings.filePath], { noResolve: true, target: ts.ScriptTarget.Latest, - jsx: extra.jsx ? ts.JsxEmit.Preserve : undefined, - ...createDefaultCompilerOptionsFromExtra(extra), + jsx: parseSettings.jsx ? ts.JsxEmit.Preserve : undefined, + ...createDefaultCompilerOptionsFromExtra(parseSettings), }, compilerHost, ); - const ast = program.getSourceFile(extra.filePath); + const ast = program.getSourceFile(parseSettings.filePath); if (!ast) { throw new Error( 'Expected an ast to be returned for the single-file isolated program.', diff --git a/packages/typescript-estree/src/create-program/createProjectProgram.ts b/packages/typescript-estree/src/create-program/createProjectProgram.ts index 359c2b2dc90..9869a6e4e54 100644 --- a/packages/typescript-estree/src/create-program/createProjectProgram.ts +++ b/packages/typescript-estree/src/create-program/createProjectProgram.ts @@ -3,8 +3,8 @@ import path from 'path'; import * as ts from 'typescript'; import { firstDefined } from '../node-utils'; -import type { Extra } from '../parser-options'; -import { getProgramsForProjects } from './createWatchProgram'; +import type { ParseSettings } from '../parseSettings'; +import { getWatchProgramsForProjects } from './getWatchProgramsForProjects'; import type { ASTAndProgram } from './shared'; import { getAstFromProgram } from './shared'; @@ -22,77 +22,94 @@ const DEFAULT_EXTRA_FILE_EXTENSIONS = [ ] as readonly string[]; /** - * @param code The code of the file being linted - * @param createDefaultProgram True if the default program should be created - * @param extra The config object - * @returns If found, returns the source file corresponding to the code and the containing program + * @param parseSettings Internal settings for parsing the file + * @returns If found, the source file corresponding to the code and the containing program */ function createProjectProgram( - code: string, - createDefaultProgram: boolean, - extra: Extra, + parseSettings: ParseSettings, ): ASTAndProgram | undefined { - log('Creating project program for: %s', extra.filePath); + log('Creating project program for: %s', parseSettings.filePath); - const astAndProgram = firstDefined( - getProgramsForProjects(code, extra.filePath, extra), - currentProgram => getAstFromProgram(currentProgram, extra), + const programsForProjects = getWatchProgramsForProjects(parseSettings); + const astAndProgram = firstDefined(programsForProjects, currentProgram => + getAstFromProgram(currentProgram, parseSettings), ); - if (!astAndProgram && !createDefaultProgram) { - // the file was either not matched within the tsconfig, or the extension wasn't expected - const errorLines = [ - '"parserOptions.project" has been set for @typescript-eslint/parser.', - `The file does not match your project config: ${path.relative( - extra.tsconfigRootDir || process.cwd(), - extra.filePath, - )}.`, - ]; - let hasMatchedAnError = false; + // The file was either matched within the tsconfig, or we allow creating a default program + if (astAndProgram || parseSettings.createDefaultProgram) { + return astAndProgram; + } - const extraFileExtensions = extra.extraFileExtensions || []; + const describeFilePath = (filePath: string): string => { + const relative = path.relative( + parseSettings.tsconfigRootDir || process.cwd(), + filePath, + ); + if (parseSettings.tsconfigRootDir) { + return `/${relative}`; + } + return `/${relative}`; + }; - extraFileExtensions.forEach(extraExtension => { - if (!extraExtension.startsWith('.')) { - errorLines.push( - `Found unexpected extension "${extraExtension}" specified with the "extraFileExtensions" option. Did you mean ".${extraExtension}"?`, - ); - } - if (DEFAULT_EXTRA_FILE_EXTENSIONS.includes(extraExtension)) { - errorLines.push( - `You unnecessarily included the extension "${extraExtension}" with the "extraFileExtensions" option. This extension is already handled by the parser by default.`, - ); - } - }); + const describedFilePath = describeFilePath(parseSettings.filePath); + const relativeProjects = parseSettings.projects.map(describeFilePath); + const describedPrograms = + relativeProjects.length === 1 + ? relativeProjects[0] + : `\n${relativeProjects.map(project => `- ${project}`).join('\n')}`; + const errorLines = [ + `ESLint was configured to run on \`${describedFilePath}\` using \`parserOptions.project\`: ${describedPrograms}`, + ]; + let hasMatchedAnError = false; - const fileExtension = path.extname(extra.filePath); - if (!DEFAULT_EXTRA_FILE_EXTENSIONS.includes(fileExtension)) { - const nonStandardExt = `The extension for the file (${fileExtension}) is non-standard`; - if (extraFileExtensions.length > 0) { - if (!extraFileExtensions.includes(fileExtension)) { - errorLines.push( - `${nonStandardExt}. It should be added to your existing "parserOptions.extraFileExtensions".`, - ); - hasMatchedAnError = true; - } - } else { + const extraFileExtensions = parseSettings.extraFileExtensions || []; + + extraFileExtensions.forEach(extraExtension => { + if (!extraExtension.startsWith('.')) { + errorLines.push( + `Found unexpected extension \`${extraExtension}\` specified with the \`parserOptions.extraFileExtensions\` option. Did you mean \`.${extraExtension}\`?`, + ); + } + if (DEFAULT_EXTRA_FILE_EXTENSIONS.includes(extraExtension)) { + errorLines.push( + `You unnecessarily included the extension \`${extraExtension}\` with the \`parserOptions.extraFileExtensions\` option. This extension is already handled by the parser by default.`, + ); + } + }); + + const fileExtension = path.extname(parseSettings.filePath); + if (!DEFAULT_EXTRA_FILE_EXTENSIONS.includes(fileExtension)) { + const nonStandardExt = `The extension for the file (\`${fileExtension}\`) is non-standard`; + if (extraFileExtensions.length > 0) { + if (!extraFileExtensions.includes(fileExtension)) { errorLines.push( - `${nonStandardExt}. You should add "parserOptions.extraFileExtensions" to your config.`, + `${nonStandardExt}. It should be added to your existing \`parserOptions.extraFileExtensions\`.`, ); hasMatchedAnError = true; } - } - - if (!hasMatchedAnError) { + } else { errorLines.push( - 'The file must be included in at least one of the projects provided.', + `${nonStandardExt}. You should add \`parserOptions.extraFileExtensions\` to your config.`, ); + hasMatchedAnError = true; } + } - throw new Error(errorLines.join('\n')); + if (!hasMatchedAnError) { + const [describedInclusions, describedSpecifiers] = + parseSettings.projects.length === 1 + ? ['that TSConfig does not', 'that TSConfig'] + : ['none of those TSConfigs', 'one of those TSConfigs']; + errorLines.push( + `However, ${describedInclusions} include this file. Either:`, + `- Change ESLint's list of included files to not include this file`, + `- Change ${describedSpecifiers} to include this file`, + `- Create a new TSConfig that includes this file and include it in your parserOptions.project`, + `See the typescript-eslint docs for more info: https://typescript-eslint.io/linting/troubleshooting##i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file`, + ); } - return astAndProgram; + throw new Error(errorLines.join('\n')); } export { createProjectProgram }; diff --git a/packages/typescript-estree/src/create-program/createSourceFile.ts b/packages/typescript-estree/src/create-program/createSourceFile.ts index 107f027e46d..806e503f0e4 100644 --- a/packages/typescript-estree/src/create-program/createSourceFile.ts +++ b/packages/typescript-estree/src/create-program/createSourceFile.ts @@ -1,24 +1,24 @@ import debug from 'debug'; import * as ts from 'typescript'; -import type { Extra } from '../parser-options'; +import type { ParseSettings } from '../parseSettings'; import { getScriptKind } from './getScriptKind'; const log = debug('typescript-eslint:typescript-estree:createSourceFile'); -function createSourceFile(code: string, extra: Extra): ts.SourceFile { +function createSourceFile(parseSettings: ParseSettings): ts.SourceFile { log( 'Getting AST without type information in %s mode for: %s', - extra.jsx ? 'TSX' : 'TS', - extra.filePath, + parseSettings.jsx ? 'TSX' : 'TS', + parseSettings.filePath, ); return ts.createSourceFile( - extra.filePath, - code, + parseSettings.filePath, + parseSettings.code, ts.ScriptTarget.Latest, /* setParentNodes */ true, - getScriptKind(extra.filePath, extra.jsx), + getScriptKind(parseSettings.filePath, parseSettings.jsx), ); } diff --git a/packages/typescript-estree/src/create-program/createWatchProgram.ts b/packages/typescript-estree/src/create-program/getWatchProgramsForProjects.ts similarity index 89% rename from packages/typescript-estree/src/create-program/createWatchProgram.ts rename to packages/typescript-estree/src/create-program/getWatchProgramsForProjects.ts index 1511023a97e..15d88e5f454 100644 --- a/packages/typescript-estree/src/create-program/createWatchProgram.ts +++ b/packages/typescript-estree/src/create-program/getWatchProgramsForProjects.ts @@ -3,7 +3,7 @@ import fs from 'fs'; import semver from 'semver'; import * as ts from 'typescript'; -import type { Extra } from '../parser-options'; +import type { ParseSettings } from '../parseSettings'; import type { CanonicalPath } from './shared'; import { canonicalDirname, @@ -121,40 +121,36 @@ function createHash(content: string): string { function updateCachedFileList( tsconfigPath: CanonicalPath, program: ts.Program, - extra: Extra, + parseSettings: ParseSettings, ): Set { - const fileList = extra.EXPERIMENTAL_useSourceOfProjectReferenceRedirect - ? new Set( - program.getSourceFiles().map(sf => getCanonicalFileName(sf.fileName)), - ) - : new Set(program.getRootFileNames().map(f => getCanonicalFileName(f))); + const fileList = + parseSettings.EXPERIMENTAL_useSourceOfProjectReferenceRedirect + ? new Set( + program.getSourceFiles().map(sf => getCanonicalFileName(sf.fileName)), + ) + : new Set(program.getRootFileNames().map(f => getCanonicalFileName(f))); programFileListCache.set(tsconfigPath, fileList); return fileList; } /** * Calculate project environments using options provided by consumer and paths from config - * @param code The code being linted - * @param filePathIn The path of the file being parsed - * @param extra.tsconfigRootDir The root directory for relative tsconfig paths - * @param extra.projects Provided tsconfig paths + * @param parseSettings Internal settings for parsing the file * @returns The programs corresponding to the supplied tsconfig paths */ -function getProgramsForProjects( - code: string, - filePathIn: string, - extra: Extra, +function getWatchProgramsForProjects( + parseSettings: ParseSettings, ): ts.Program[] { - const filePath = getCanonicalFileName(filePathIn); + const filePath = getCanonicalFileName(parseSettings.filePath); const results = []; // preserve reference to code and file being linted - currentLintOperationState.code = code; + currentLintOperationState.code = parseSettings.code; currentLintOperationState.filePath = filePath; // Update file version if necessary const fileWatchCallbacks = fileWatchCallbackTrackingMap.get(filePath); - const codeHash = createHash(code); + const codeHash = createHash(parseSettings.code); if ( parsedFilesSeenHash.get(filePath) !== codeHash && fileWatchCallbacks && @@ -165,16 +161,30 @@ function getProgramsForProjects( ); } + const currentProjectsFromSettings = new Set(parseSettings.projects); + /* * before we go into the process of attempting to find and update every program * see if we know of a program that contains this file */ for (const [tsconfigPath, existingWatch] of knownWatchProgramMap.entries()) { + if (!currentProjectsFromSettings.has(tsconfigPath)) { + // the current parser run doesn't specify this tsconfig in parserOptions.project + // so we don't want to consider it for caching purposes. + // + // if we did consider it we might return a program for a project + // that wasn't specified in the current parser run (which is obv bad!). + continue; + } let fileList = programFileListCache.get(tsconfigPath); let updatedProgram: ts.Program | null = null; if (!fileList) { updatedProgram = existingWatch.getProgram().getProgram(); - fileList = updateCachedFileList(tsconfigPath, updatedProgram, extra); + fileList = updateCachedFileList( + tsconfigPath, + updatedProgram, + parseSettings, + ); } if (fileList.has(filePath)) { @@ -198,7 +208,7 @@ function getProgramsForProjects( * - the required program hasn't been created yet, or * - the file is new/renamed, and the program hasn't been updated. */ - for (const tsconfigPath of extra.projects) { + for (const tsconfigPath of parseSettings.projects) { const existingWatch = knownWatchProgramMap.get(tsconfigPath); if (existingWatch) { @@ -218,7 +228,7 @@ function getProgramsForProjects( const fileList = updateCachedFileList( tsconfigPath, updatedProgram, - extra, + parseSettings, ); if (fileList.has(filePath)) { log('Found updated program for file. %s', filePath); @@ -230,7 +240,7 @@ function getProgramsForProjects( continue; } - const programWatch = createWatchProgram(tsconfigPath, extra); + const programWatch = createWatchProgram(tsconfigPath, parseSettings); knownWatchProgramMap.set(tsconfigPath, programWatch); const program = programWatch.getProgram().getProgram(); @@ -238,7 +248,7 @@ function getProgramsForProjects( program.getTypeChecker(); // cache and check the file list - const fileList = updateCachedFileList(tsconfigPath, program, extra); + const fileList = updateCachedFileList(tsconfigPath, program, parseSettings); if (fileList.has(filePath)) { log('Found program for file. %s', filePath); // we can return early because we know this program contains the file @@ -257,23 +267,23 @@ const isRunningNoTimeoutFix = semver.satisfies(ts.version, '>=3.9.0-beta', { function createWatchProgram( tsconfigPath: string, - extra: Extra, + parseSettings: ParseSettings, ): ts.WatchOfConfigFile { log('Creating watch program for %s.', tsconfigPath); // create compiler host const watchCompilerHost = ts.createWatchCompilerHost( tsconfigPath, - createDefaultCompilerOptionsFromExtra(extra), + createDefaultCompilerOptionsFromExtra(parseSettings), ts.sys, ts.createAbstractBuilder, diagnosticReporter, /*reportWatchStatus*/ () => {}, ) as WatchCompilerHostOfConfigFile; - if (extra.moduleResolver) { + if (parseSettings.moduleResolver) { watchCompilerHost.resolveModuleNames = getModuleResolver( - extra.moduleResolver, + parseSettings.moduleResolver, ).resolveModuleNames; } @@ -337,7 +347,9 @@ function createWatchProgram( ): string[] => oldReadDirectory( path, - !extensions ? undefined : extensions.concat(extra.extraFileExtensions), + !extensions + ? undefined + : extensions.concat(parseSettings.extraFileExtensions), exclude, include, depth, @@ -345,7 +357,7 @@ function createWatchProgram( oldOnDirectoryStructureHostCreate(host); }; // This works only on 3.9 - watchCompilerHost.extraFileExtensions = extra.extraFileExtensions.map( + watchCompilerHost.extraFileExtensions = parseSettings.extraFileExtensions.map( extension => ({ extension, isMixedContent: true, @@ -359,7 +371,7 @@ function createWatchProgram( * See https://github.com/typescript-eslint/typescript-eslint/issues/2094 */ watchCompilerHost.useSourceOfProjectReferenceRedirect = (): boolean => - extra.EXPERIMENTAL_useSourceOfProjectReferenceRedirect; + parseSettings.EXPERIMENTAL_useSourceOfProjectReferenceRedirect; // Since we don't want to asynchronously update program we want to disable timeout methods // So any changes in the program will be delayed and updated when getProgram is called on watch @@ -538,4 +550,4 @@ function maybeInvalidateProgram( return null; } -export { clearWatchCaches, createWatchProgram, getProgramsForProjects }; +export { clearWatchCaches, getWatchProgramsForProjects }; diff --git a/packages/typescript-estree/src/create-program/shared.ts b/packages/typescript-estree/src/create-program/shared.ts index 63ba34a5f83..dd50f757dce 100644 --- a/packages/typescript-estree/src/create-program/shared.ts +++ b/packages/typescript-estree/src/create-program/shared.ts @@ -2,7 +2,8 @@ import path from 'path'; import type { Program } from 'typescript'; import * as ts from 'typescript'; -import type { Extra, ModuleResolver } from '../parser-options'; +import type { ModuleResolver } from '../parser-options'; +import type { ParseSettings } from '../parseSettings'; interface ASTAndProgram { ast: ts.SourceFile; @@ -33,9 +34,9 @@ const DEFAULT_COMPILER_OPTIONS: ts.CompilerOptions = { }; function createDefaultCompilerOptionsFromExtra( - extra: Extra, + parseSettings: ParseSettings, ): ts.CompilerOptions { - if (extra.debugLevel.has('typescript')) { + if (parseSettings.debugLevel.has('typescript')) { return { ...DEFAULT_COMPILER_OPTIONS, extendedDiagnostics: true, @@ -63,10 +64,10 @@ function getCanonicalFileName(filePath: string): CanonicalPath { return correctPathCasing(normalized) as CanonicalPath; } -function ensureAbsolutePath(p: string, extra: Extra): string { +function ensureAbsolutePath(p: string, tsconfigRootDir: string): string { return path.isAbsolute(p) ? p - : path.join(extra.tsconfigRootDir || process.cwd(), p); + : path.join(tsconfigRootDir || process.cwd(), p); } function canonicalDirname(p: CanonicalPath): CanonicalPath { @@ -92,12 +93,12 @@ function getExtension(fileName: string | undefined): string | null { function getAstFromProgram( currentProgram: Program, - extra: Extra, + parseSettings: ParseSettings, ): ASTAndProgram | undefined { - const ast = currentProgram.getSourceFile(extra.filePath); + const ast = currentProgram.getSourceFile(parseSettings.filePath); // working around https://github.com/typescript-eslint/typescript-eslint/issues/1573 - const expectedExt = getExtension(extra.filePath); + const expectedExt = getExtension(parseSettings.filePath); const returnedExt = getExtension(ast?.fileName); if (expectedExt !== returnedExt) { return undefined; diff --git a/packages/typescript-estree/src/create-program/useProvidedPrograms.ts b/packages/typescript-estree/src/create-program/useProvidedPrograms.ts index 0a8300f5ad2..fc99416faa5 100644 --- a/packages/typescript-estree/src/create-program/useProvidedPrograms.ts +++ b/packages/typescript-estree/src/create-program/useProvidedPrograms.ts @@ -3,7 +3,7 @@ import * as fs from 'fs'; import * as path from 'path'; import * as ts from 'typescript'; -import type { Extra } from '../parser-options'; +import type { ParseSettings } from '../parseSettings'; import type { ASTAndProgram } from './shared'; import { CORE_COMPILER_OPTIONS, getAstFromProgram } from './shared'; @@ -11,16 +11,16 @@ const log = debug('typescript-eslint:typescript-estree:useProvidedProgram'); function useProvidedPrograms( programInstances: Iterable, - extra: Extra, + parseSettings: ParseSettings, ): ASTAndProgram | undefined { log( 'Retrieving ast for %s from provided program instance(s)', - extra.filePath, + parseSettings.filePath, ); let astAndProgram: ASTAndProgram | undefined; for (const programInstance of programInstances) { - astAndProgram = getAstFromProgram(programInstance, extra); + astAndProgram = getAstFromProgram(programInstance, parseSettings); // Stop at the first applicable program instance if (astAndProgram) { break; @@ -29,8 +29,8 @@ function useProvidedPrograms( if (!astAndProgram) { const relativeFilePath = path.relative( - extra.tsconfigRootDir || process.cwd(), - extra.filePath, + parseSettings.tsconfigRootDir || process.cwd(), + parseSettings.filePath, ); const errorLines = [ '"parserOptions.programs" has been provided for @typescript-eslint/parser.', diff --git a/packages/typescript-estree/src/index.ts b/packages/typescript-estree/src/index.ts index 48c9fb1ab88..bc7ed6024f3 100644 --- a/packages/typescript-estree/src/index.ts +++ b/packages/typescript-estree/src/index.ts @@ -10,7 +10,7 @@ export { export { ParserServices, TSESTreeOptions } from './parser-options'; export { simpleTraverse } from './simple-traverse'; export * from './ts-estree'; -export { clearWatchCaches as clearCaches } from './create-program/createWatchProgram'; +export { clearWatchCaches as clearCaches } from './create-program/getWatchProgramsForProjects'; export { createProgramFromConfigFile as createProgram } from './create-program/useProvidedPrograms'; export * from './create-program/getScriptKind'; export { typescriptVersionIsAtLeast } from './version-check'; diff --git a/packages/typescript-estree/src/parseSettings/createParseSettings.ts b/packages/typescript-estree/src/parseSettings/createParseSettings.ts new file mode 100644 index 00000000000..b1cde9d4c9a --- /dev/null +++ b/packages/typescript-estree/src/parseSettings/createParseSettings.ts @@ -0,0 +1,201 @@ +import debug from 'debug'; +import { sync as globSync } from 'globby'; +import isGlob from 'is-glob'; + +import type { CanonicalPath } from '../create-program/shared'; +import { + ensureAbsolutePath, + getCanonicalFileName, +} from '../create-program/shared'; +import type { TSESTreeOptions } from '../parser-options'; +import type { MutableParseSettings } from './index'; +import { inferSingleRun } from './inferSingleRun'; +import { warnAboutTSVersion } from './warnAboutTSVersion'; + +const log = debug( + 'typescript-eslint:typescript-estree:parser:parseSettings:createParseSettings', +); + +export function createParseSettings( + code: string, + options: Partial = {}, +): MutableParseSettings { + const tsconfigRootDir = + typeof options.tsconfigRootDir === 'string' + ? options.tsconfigRootDir + : process.cwd(); + const parseSettings: MutableParseSettings = { + code: enforceString(code), + comment: options.comment === true, + comments: [], + createDefaultProgram: options.createDefaultProgram === true, + debugLevel: + options.debugLevel === true + ? new Set(['typescript-eslint']) + : Array.isArray(options.debugLevel) + ? new Set(options.debugLevel) + : new Set(), + errorOnTypeScriptSyntacticAndSemanticIssues: false, + errorOnUnknownASTType: options.errorOnUnknownASTType === true, + EXPERIMENTAL_useSourceOfProjectReferenceRedirect: + options.EXPERIMENTAL_useSourceOfProjectReferenceRedirect === true, + extraFileExtensions: + Array.isArray(options.extraFileExtensions) && + options.extraFileExtensions.every(ext => typeof ext === 'string') + ? options.extraFileExtensions + : [], + filePath: ensureAbsolutePath( + typeof options.filePath === 'string' && options.filePath !== '' + ? options.filePath + : getFileName(options.jsx), + tsconfigRootDir, + ), + jsx: options.jsx === true, + loc: options.loc === true, + log: + typeof options.loggerFn === 'function' + ? options.loggerFn + : options.loggerFn === false + ? (): void => {} + : console.log, // eslint-disable-line no-console + moduleResolver: options.moduleResolver ?? '', + preserveNodeMaps: options.preserveNodeMaps !== false, + programs: Array.isArray(options.programs) ? options.programs : null, + projects: [], + range: options.range === true, + singleRun: inferSingleRun(options), + tokens: options.tokens === true ? [] : null, + tsconfigRootDir, + }; + + // debug doesn't support multiple `enable` calls, so have to do it all at once + if (parseSettings.debugLevel.size > 0) { + const namespaces = []; + if (parseSettings.debugLevel.has('typescript-eslint')) { + namespaces.push('typescript-eslint:*'); + } + if ( + parseSettings.debugLevel.has('eslint') || + // make sure we don't turn off the eslint debug if it was enabled via --debug + debug.enabled('eslint:*,-eslint:code-path') + ) { + // https://github.com/eslint/eslint/blob/9dfc8501fb1956c90dc11e6377b4cb38a6bea65d/bin/eslint.js#L25 + namespaces.push('eslint:*,-eslint:code-path'); + } + debug.enable(namespaces.join(',')); + } + + if (Array.isArray(options.programs)) { + if (!options.programs.length) { + throw new Error( + `You have set parserOptions.programs to an empty array. This will cause all files to not be found in existing programs. Either provide one or more existing TypeScript Program instances in the array, or remove the parserOptions.programs setting.`, + ); + } + log( + 'parserOptions.programs was provided, so parserOptions.project will be ignored.', + ); + } + + // Providing a program overrides project resolution + if (!parseSettings.programs) { + const projectFolderIgnoreList = ( + options.projectFolderIgnoreList ?? ['**/node_modules/**'] + ) + .reduce((acc, folder) => { + if (typeof folder === 'string') { + acc.push(folder); + } + return acc; + }, []) + // prefix with a ! for not match glob + .map(folder => (folder.startsWith('!') ? folder : `!${folder}`)); + + parseSettings.projects = prepareAndTransformProjects( + tsconfigRootDir, + options.project, + projectFolderIgnoreList, + ); + } + + warnAboutTSVersion(parseSettings); + + return parseSettings; +} + +/** + * Ensures source code is a string. + */ +function enforceString(code: unknown): string { + if (typeof code !== 'string') { + return String(code); + } + + return code; +} + +/** + * Compute the filename based on the parser options. + * + * Even if jsx option is set in typescript compiler, filename still has to + * contain .tsx file extension. + * + * @param options Parser options + */ +function getFileName(jsx?: boolean): string { + return jsx ? 'estree.tsx' : 'estree.ts'; +} + +function getTsconfigPath( + tsconfigPath: string, + tsconfigRootDir: string, +): CanonicalPath { + return getCanonicalFileName( + ensureAbsolutePath(tsconfigPath, tsconfigRootDir), + ); +} + +/** + * Normalizes, sanitizes, resolves and filters the provided project paths + */ +function prepareAndTransformProjects( + tsconfigRootDir: string, + projectsInput: string | string[] | undefined, + ignoreListInput: string[], +): CanonicalPath[] { + const sanitizedProjects: string[] = []; + + // Normalize and sanitize the project paths + if (typeof projectsInput === 'string') { + sanitizedProjects.push(projectsInput); + } else if (Array.isArray(projectsInput)) { + for (const project of projectsInput) { + if (typeof project === 'string') { + sanitizedProjects.push(project); + } + } + } + + if (sanitizedProjects.length === 0) { + return []; + } + + // Transform glob patterns into paths + const nonGlobProjects = sanitizedProjects.filter(project => !isGlob(project)); + const globProjects = sanitizedProjects.filter(project => isGlob(project)); + const uniqueCanonicalProjectPaths = new Set( + nonGlobProjects + .concat( + globSync([...globProjects, ...ignoreListInput], { + cwd: tsconfigRootDir, + }), + ) + .map(project => getTsconfigPath(project, tsconfigRootDir)), + ); + + log( + 'parserOptions.project (excluding ignored) matched projects: %s', + uniqueCanonicalProjectPaths, + ); + + return Array.from(uniqueCanonicalProjectPaths); +} diff --git a/packages/typescript-estree/src/parseSettings/index.ts b/packages/typescript-estree/src/parseSettings/index.ts new file mode 100644 index 00000000000..0a9734d1b24 --- /dev/null +++ b/packages/typescript-estree/src/parseSettings/index.ts @@ -0,0 +1,124 @@ +import type * as ts from 'typescript'; + +import type { CanonicalPath } from '../create-program/shared'; +import type { TSESTree } from '../ts-estree'; + +type DebugModule = 'typescript-eslint' | 'eslint' | 'typescript'; + +/** + * Internal settings used by the parser to run on a file. + */ +export interface MutableParseSettings { + /** + * Code of the file being parsed. + */ + code: string; + + /** + * Whether the `comment` parse option is enabled. + */ + comment: boolean; + + /** + * If the `comment` parse option is enabled, retrieved comments. + */ + comments: TSESTree.Comment[]; + + /** + * Whether to create a TypeScript program if one is not provided. + */ + createDefaultProgram: boolean; + + /** + * Which debug areas should be logged. + */ + debugLevel: Set; + + /** + * Whether to error if TypeScript reports a semantic or syntactic error diagnostic. + */ + errorOnTypeScriptSyntacticAndSemanticIssues: boolean; + + /** + * Whether to error if an unknown AST node type is encountered. + */ + errorOnUnknownASTType: boolean; + + /** + * Whether TS should use the source files for referenced projects instead of the compiled .d.ts files. + * + * @remarks + * This feature is not yet optimized, and is likely to cause OOMs for medium to large projects. + * This flag REQUIRES at least TS v3.9, otherwise it does nothing. + */ + EXPERIMENTAL_useSourceOfProjectReferenceRedirect: boolean; + + /** + * Any non-standard file extensions which will be parsed. + */ + extraFileExtensions: string[]; + + /** + * Path of the file being parsed. + */ + filePath: string; + + /** + * Whether parsing of JSX is enabled. + * + * @remarks The applicable file extension is still required. + */ + jsx: boolean; + + /** + * Whether to add `loc` information to each node. + */ + loc: boolean; + + /** + * Log function, if not `console.log`. + */ + log: (message: string) => void; + + /** + * Path for a module resolver to use for the compiler host's `resolveModuleNames`. + */ + moduleResolver: string; + + /** + * Whether two-way AST node maps are preserved during the AST conversion process. + */ + preserveNodeMaps?: boolean; + + /** + * One or more instances of TypeScript Program objects to be used for type information. + */ + programs: null | Iterable; + + /** + * Normalized paths to provided project paths. + */ + projects: CanonicalPath[]; + + /** + * Whether to add the `range` property to AST nodes. + */ + range: boolean; + + /** + * Whether this is part of a single run, rather than a long-running process. + */ + singleRun: boolean; + + /** + * If the `tokens` parse option is enabled, retrieved tokens. + */ + tokens: null | TSESTree.Token[]; + + /** + * The absolute path to the root directory for all provided `project`s. + */ + tsconfigRootDir: string; +} + +export type ParseSettings = Readonly; diff --git a/packages/typescript-estree/src/parseSettings/inferSingleRun.ts b/packages/typescript-estree/src/parseSettings/inferSingleRun.ts new file mode 100644 index 00000000000..5d765a22ce9 --- /dev/null +++ b/packages/typescript-estree/src/parseSettings/inferSingleRun.ts @@ -0,0 +1,56 @@ +import { normalize } from 'path'; + +import type { TSESTreeOptions } from '../parser-options'; + +/** + * ESLint (and therefore typescript-eslint) is used in both "single run"/one-time contexts, + * such as an ESLint CLI invocation, and long-running sessions (such as continuous feedback + * on a file in an IDE). + * + * When typescript-eslint handles TypeScript Program management behind the scenes, this distinction + * is important because there is significant overhead to managing the so called Watch Programs + * needed for the long-running use-case. We therefore use the following logic to figure out which + * of these contexts applies to the current execution. + * + * @returns Whether this is part of a single run, rather than a long-running process. + */ +export function inferSingleRun(options: TSESTreeOptions | undefined): boolean { + if ( + // single-run implies type-aware linting - no projects means we can't be in single-run mode + options?.project == null || + // programs passed via options means the user should be managing the programs, so we shouldn't + // be creating our own single-run programs accidentally + options?.programs != null + ) { + return false; + } + + // Allow users to explicitly inform us of their intent to perform a single run (or not) with TSESTREE_SINGLE_RUN + if (process.env.TSESTREE_SINGLE_RUN === 'false') { + return false; + } + if (process.env.TSESTREE_SINGLE_RUN === 'true') { + return true; + } + + // Currently behind a flag while we gather real-world feedback + if (options?.allowAutomaticSingleRunInference) { + if ( + // Default to single runs for CI processes. CI=true is set by most CI providers by default. + process.env.CI === 'true' || + // This will be true for invocations such as `npx eslint ...` and `./node_modules/.bin/eslint ...` + process.argv[1].endsWith(normalize('node_modules/.bin/eslint')) + ) { + return true; + } + } + + /** + * We default to assuming that this run could be part of a long-running session (e.g. in an IDE) + * and watch programs will therefore be required. + * + * Unless we can reliably infer otherwise, we default to assuming that this run could be part + * of a long-running session (e.g. in an IDE) and watch programs will therefore be required + */ + return false; +} diff --git a/packages/typescript-estree/src/parseSettings/warnAboutTSVersion.ts b/packages/typescript-estree/src/parseSettings/warnAboutTSVersion.ts new file mode 100644 index 00000000000..191ac029325 --- /dev/null +++ b/packages/typescript-estree/src/parseSettings/warnAboutTSVersion.ts @@ -0,0 +1,45 @@ +import semver from 'semver'; +import * as ts from 'typescript'; + +import type { ParseSettings } from './index'; +/** + * This needs to be kept in sync with /docs/maintenance/VERSIONING.md + * in the typescript-eslint monorepo + */ +const SUPPORTED_TYPESCRIPT_VERSIONS = '>=3.3.1 <5.0.0'; + +/* + * The semver package will ignore prerelease ranges, and we don't want to explicitly document every one + * List them all separately here, so we can automatically create the full string + */ +const SUPPORTED_PRERELEASE_RANGES: string[] = []; +const ACTIVE_TYPESCRIPT_VERSION = ts.version; +const isRunningSupportedTypeScriptVersion = semver.satisfies( + ACTIVE_TYPESCRIPT_VERSION, + [SUPPORTED_TYPESCRIPT_VERSIONS] + .concat(SUPPORTED_PRERELEASE_RANGES) + .join(' || '), +); + +let warnedAboutTSVersion = false; + +export function warnAboutTSVersion(parseSettings: ParseSettings): void { + if (!isRunningSupportedTypeScriptVersion && !warnedAboutTSVersion) { + const isTTY = + typeof process === 'undefined' ? false : process.stdout?.isTTY; + if (isTTY) { + const border = '============='; + const versionWarning = [ + border, + 'WARNING: You are currently running a version of TypeScript which is not officially supported by @typescript-eslint/typescript-estree.', + 'You may find that it works just fine, or you may not.', + `SUPPORTED TYPESCRIPT VERSIONS: ${SUPPORTED_TYPESCRIPT_VERSIONS}`, + `YOUR TYPESCRIPT VERSION: ${ACTIVE_TYPESCRIPT_VERSION}`, + 'Please only submit bug reports when using the officially supported version.', + border, + ]; + parseSettings.log(versionWarning.join('\n\n')); + } + warnedAboutTSVersion = true; + } +} diff --git a/packages/typescript-estree/src/parser-options.ts b/packages/typescript-estree/src/parser-options.ts index cfe82b15f22..632d9e6ae88 100644 --- a/packages/typescript-estree/src/parser-options.ts +++ b/packages/typescript-estree/src/parser-options.ts @@ -1,39 +1,11 @@ import type { DebugLevel } from '@typescript-eslint/types'; import type * as ts from 'typescript'; -import type { CanonicalPath } from './create-program/shared'; import type { TSESTree, TSESTreeToTSNode, TSNode, TSToken } from './ts-estree'; -type DebugModule = 'typescript-eslint' | 'eslint' | 'typescript'; - -export interface Extra { - code: string; - comment: boolean; - comments: TSESTree.Comment[]; - createDefaultProgram: boolean; - debugLevel: Set; - errorOnTypeScriptSyntacticAndSemanticIssues: boolean; - errorOnUnknownASTType: boolean; - EXPERIMENTAL_useSourceOfProjectReferenceRedirect: boolean; - extraFileExtensions: string[]; - filePath: string; - jsx: boolean; - loc: boolean; - singleRun: boolean; - log: (message: string) => void; - preserveNodeMaps?: boolean; - programs: null | Iterable; - projects: CanonicalPath[]; - range: boolean; - strict: boolean; - tokens: null | TSESTree.Token[]; - tsconfigRootDir: string; - moduleResolver: string; -} - -//////////////////////////////////////////////////// -// MAKE SURE THIS IS KEPT IN SYNC WITH THE README // -//////////////////////////////////////////////////// +////////////////////////////////////////////////////////// +// MAKE SURE THIS IS KEPT IN SYNC WITH THE WEBSITE DOCS // +////////////////////////////////////////////////////////// interface ParseOptions { /** diff --git a/packages/typescript-estree/src/parser.ts b/packages/typescript-estree/src/parser.ts index ae461a24dd5..c5504ba961a 100644 --- a/packages/typescript-estree/src/parser.ts +++ b/packages/typescript-estree/src/parser.ts @@ -1,9 +1,5 @@ import debug from 'debug'; -import { sync as globSync } from 'globby'; -import isGlob from 'is-glob'; -import { normalize } from 'path'; -import semver from 'semver'; -import * as ts from 'typescript'; +import type * as ts from 'typescript'; import { astConverter } from './ast-converter'; import { convertError } from './convert'; @@ -12,41 +8,18 @@ import { createIsolatedProgram } from './create-program/createIsolatedProgram'; import { createProjectProgram } from './create-program/createProjectProgram'; import { createSourceFile } from './create-program/createSourceFile'; import type { ASTAndProgram, CanonicalPath } from './create-program/shared'; -import { - ensureAbsolutePath, - getCanonicalFileName, -} from './create-program/shared'; import { createProgramFromConfigFile, useProvidedPrograms, } from './create-program/useProvidedPrograms'; -import type { Extra, ParserServices, TSESTreeOptions } from './parser-options'; +import type { ParserServices, TSESTreeOptions } from './parser-options'; +import type { ParseSettings } from './parseSettings'; +import { createParseSettings } from './parseSettings/createParseSettings'; import { getFirstSemanticOrSyntacticError } from './semantic-or-syntactic-errors'; import type { TSESTree } from './ts-estree'; const log = debug('typescript-eslint:typescript-estree:parser'); -/** - * This needs to be kept in sync with the top-level README.md in the - * typescript-eslint monorepo - */ -const SUPPORTED_TYPESCRIPT_VERSIONS = '>=3.3.1 <4.9.0'; -/* - * The semver package will ignore prerelease ranges, and we don't want to explicitly document every one - * List them all separately here, so we can automatically create the full string - */ -const SUPPORTED_PRERELEASE_RANGES: string[] = []; -const ACTIVE_TYPESCRIPT_VERSION = ts.version; -const isRunningSupportedTypeScriptVersion = semver.satisfies( - ACTIVE_TYPESCRIPT_VERSION, - [SUPPORTED_TYPESCRIPT_VERSIONS] - .concat(SUPPORTED_PRERELEASE_RANGES) - .join(' || '), -); - -let extra: Extra; -let warnedAboutTSVersion = false; - /** * Cache existing programs for the single run use-case. * @@ -57,348 +30,24 @@ function clearProgramCache(): void { existingPrograms.clear(); } -function enforceString(code: unknown): string { - /** - * Ensure the source code is a string - */ - if (typeof code !== 'string') { - return String(code); - } - - return code; -} - /** - * @param code The code of the file being linted - * @param programInstances One or more (potentially lazily constructed) existing programs to use + * @param parseSettings Internal settings for parsing the file * @param shouldProvideParserServices True if the program should be attempted to be calculated from provided tsconfig files - * @param shouldCreateDefaultProgram True if the program should be created from compiler host * @returns Returns a source file and program corresponding to the linted code */ function getProgramAndAST( - code: string, - programInstances: Iterable | null, + parseSettings: ParseSettings, shouldProvideParserServices: boolean, - shouldCreateDefaultProgram: boolean, ): ASTAndProgram { return ( - (programInstances && useProvidedPrograms(programInstances, extra)) || + (parseSettings.programs && + useProvidedPrograms(parseSettings.programs, parseSettings)) || + (shouldProvideParserServices && createProjectProgram(parseSettings)) || (shouldProvideParserServices && - createProjectProgram(code, shouldCreateDefaultProgram, extra)) || - (shouldProvideParserServices && - shouldCreateDefaultProgram && - createDefaultProgram(code, extra)) || - createIsolatedProgram(code, extra) - ); -} - -/** - * Compute the filename based on the parser options. - * - * Even if jsx option is set in typescript compiler, filename still has to - * contain .tsx file extension. - * - * @param options Parser options - */ -function getFileName({ jsx }: { jsx?: boolean } = {}): string { - return jsx ? 'estree.tsx' : 'estree.ts'; -} - -/** - * Resets the extra config object - */ -function resetExtra(): void { - extra = { - code: '', - comment: false, - comments: [], - createDefaultProgram: false, - debugLevel: new Set(), - errorOnTypeScriptSyntacticAndSemanticIssues: false, - errorOnUnknownASTType: false, - EXPERIMENTAL_useSourceOfProjectReferenceRedirect: false, - extraFileExtensions: [], - filePath: getFileName(), - jsx: false, - loc: false, - log: console.log, // eslint-disable-line no-console - preserveNodeMaps: true, - programs: null, - projects: [], - range: false, - strict: false, - tokens: null, - tsconfigRootDir: process.cwd(), - /** - * Unless we can reliably infer otherwise, we default to assuming that this run could be part - * of a long-running session (e.g. in an IDE) and watch programs will therefore be required - */ - singleRun: false, - moduleResolver: '', - }; -} - -function getTsconfigPath(tsconfigPath: string, extra: Extra): CanonicalPath { - return getCanonicalFileName(ensureAbsolutePath(tsconfigPath, extra)); -} - -/** - * Normalizes, sanitizes, resolves and filters the provided project paths - */ -function prepareAndTransformProjects( - projectsInput: string | string[] | undefined, - ignoreListInput: string[], -): CanonicalPath[] { - const sanitizedProjects: string[] = []; - - // Normalize and sanitize the project paths - if (typeof projectsInput === 'string') { - sanitizedProjects.push(projectsInput); - } else if (Array.isArray(projectsInput)) { - for (const project of projectsInput) { - if (typeof project === 'string') { - sanitizedProjects.push(project); - } - } - } - - if (sanitizedProjects.length === 0) { - return []; - } - - // Transform glob patterns into paths - const nonGlobProjects = sanitizedProjects.filter(project => !isGlob(project)); - const globProjects = sanitizedProjects.filter(project => isGlob(project)); - const uniqueCanonicalProjectPaths = new Set( - nonGlobProjects - .concat( - globSync([...globProjects, ...ignoreListInput], { - cwd: extra.tsconfigRootDir, - }), - ) - .map(project => getTsconfigPath(project, extra)), - ); - - log( - 'parserOptions.project (excluding ignored) matched projects: %s', - uniqueCanonicalProjectPaths, + parseSettings.createDefaultProgram && + createDefaultProgram(parseSettings)) || + createIsolatedProgram(parseSettings) ); - - return Array.from(uniqueCanonicalProjectPaths); -} - -function applyParserOptionsToExtra(options: TSESTreeOptions): void { - /** - * Configure Debug logging - */ - if (options.debugLevel === true) { - extra.debugLevel = new Set(['typescript-eslint']); - } else if (Array.isArray(options.debugLevel)) { - extra.debugLevel = new Set(options.debugLevel); - } - if (extra.debugLevel.size > 0) { - // debug doesn't support multiple `enable` calls, so have to do it all at once - const namespaces = []; - if (extra.debugLevel.has('typescript-eslint')) { - namespaces.push('typescript-eslint:*'); - } - if ( - extra.debugLevel.has('eslint') || - // make sure we don't turn off the eslint debug if it was enabled via --debug - debug.enabled('eslint:*,-eslint:code-path') - ) { - // https://github.com/eslint/eslint/blob/9dfc8501fb1956c90dc11e6377b4cb38a6bea65d/bin/eslint.js#L25 - namespaces.push('eslint:*,-eslint:code-path'); - } - debug.enable(namespaces.join(',')); - } - - /** - * Track range information in the AST - */ - extra.range = typeof options.range === 'boolean' && options.range; - extra.loc = typeof options.loc === 'boolean' && options.loc; - - /** - * Track tokens in the AST - */ - if (typeof options.tokens === 'boolean' && options.tokens) { - extra.tokens = []; - } - - /** - * Track comments in the AST - */ - if (typeof options.comment === 'boolean' && options.comment) { - extra.comment = true; - extra.comments = []; - } - - /** - * Enable JSX - note the applicable file extension is still required - */ - if (typeof options.jsx !== 'boolean') { - extra.jsx = false; - } else { - extra.jsx = options.jsx; - } - - /** - * Get the file path - */ - if (typeof options.filePath === 'string' && options.filePath !== '') { - extra.filePath = options.filePath; - } else { - extra.filePath = getFileName(extra); - } - - /** - * Allow the user to cause the parser to error if it encounters an unknown AST Node Type - * (used in testing) - */ - if ( - typeof options.errorOnUnknownASTType === 'boolean' && - options.errorOnUnknownASTType - ) { - extra.errorOnUnknownASTType = true; - } - - /** - * Allow the user to override the function used for logging - */ - if (typeof options.loggerFn === 'function') { - extra.log = options.loggerFn; - } else if (options.loggerFn === false) { - extra.log = (): void => {}; - } - - if (typeof options.tsconfigRootDir === 'string') { - extra.tsconfigRootDir = options.tsconfigRootDir; - } - - // NOTE - ensureAbsolutePath relies upon having the correct tsconfigRootDir in extra - extra.filePath = ensureAbsolutePath(extra.filePath, extra); - - if (Array.isArray(options.programs)) { - if (!options.programs.length) { - throw new Error( - `You have set parserOptions.programs to an empty array. This will cause all files to not be found in existing programs. Either provide one or more existing TypeScript Program instances in the array, or remove the parserOptions.programs setting.`, - ); - } - extra.programs = options.programs; - log( - 'parserOptions.programs was provided, so parserOptions.project will be ignored.', - ); - } - - if (!extra.programs) { - // providing a program overrides project resolution - const projectFolderIgnoreList = ( - options.projectFolderIgnoreList ?? ['**/node_modules/**'] - ) - .reduce((acc, folder) => { - if (typeof folder === 'string') { - acc.push(folder); - } - return acc; - }, []) - // prefix with a ! for not match glob - .map(folder => (folder.startsWith('!') ? folder : `!${folder}`)); - // NOTE - prepareAndTransformProjects relies upon having the correct tsconfigRootDir in extra - extra.projects = prepareAndTransformProjects( - options.project, - projectFolderIgnoreList, - ); - } - - if ( - Array.isArray(options.extraFileExtensions) && - options.extraFileExtensions.every(ext => typeof ext === 'string') - ) { - extra.extraFileExtensions = options.extraFileExtensions; - } - - /** - * Allow the user to enable or disable the preservation of the AST node maps - * during the conversion process. - */ - if (typeof options.preserveNodeMaps === 'boolean') { - extra.preserveNodeMaps = options.preserveNodeMaps; - } - - extra.createDefaultProgram = - typeof options.createDefaultProgram === 'boolean' && - options.createDefaultProgram; - - extra.EXPERIMENTAL_useSourceOfProjectReferenceRedirect = - typeof options.EXPERIMENTAL_useSourceOfProjectReferenceRedirect === - 'boolean' && options.EXPERIMENTAL_useSourceOfProjectReferenceRedirect; - - if (typeof options.moduleResolver === 'string') { - extra.moduleResolver = options.moduleResolver; - } -} - -function warnAboutTSVersion(): void { - if (!isRunningSupportedTypeScriptVersion && !warnedAboutTSVersion) { - const isTTY = - typeof process === 'undefined' ? false : process.stdout?.isTTY; - if (isTTY) { - const border = '============='; - const versionWarning = [ - border, - 'WARNING: You are currently running a version of TypeScript which is not officially supported by @typescript-eslint/typescript-estree.', - 'You may find that it works just fine, or you may not.', - `SUPPORTED TYPESCRIPT VERSIONS: ${SUPPORTED_TYPESCRIPT_VERSIONS}`, - `YOUR TYPESCRIPT VERSION: ${ACTIVE_TYPESCRIPT_VERSION}`, - 'Please only submit bug reports when using the officially supported version.', - border, - ]; - extra.log(versionWarning.join('\n\n')); - } - warnedAboutTSVersion = true; - } -} - -/** - * ESLint (and therefore typescript-eslint) is used in both "single run"/one-time contexts, - * such as an ESLint CLI invocation, and long-running sessions (such as continuous feedback - * on a file in an IDE). - * - * When typescript-eslint handles TypeScript Program management behind the scenes, this distinction - * is important because there is significant overhead to managing the so called Watch Programs - * needed for the long-running use-case. We therefore use the following logic to figure out which - * of these contexts applies to the current execution. - */ -function inferSingleRun(options: TSESTreeOptions | undefined): void { - // Allow users to explicitly inform us of their intent to perform a single run (or not) with TSESTREE_SINGLE_RUN - if (process.env.TSESTREE_SINGLE_RUN === 'false') { - extra.singleRun = false; - return; - } - if (process.env.TSESTREE_SINGLE_RUN === 'true') { - extra.singleRun = true; - return; - } - - // Currently behind a flag while we gather real-world feedback - if (options?.allowAutomaticSingleRunInference) { - if ( - // Default to single runs for CI processes. CI=true is set by most CI providers by default. - process.env.CI === 'true' || - // This will be true for invocations such as `npx eslint ...` and `./node_modules/.bin/eslint ...` - process.argv[1].endsWith(normalize('node_modules/.bin/eslint')) - ) { - extra.singleRun = true; - return; - } - } - - /** - * We default to assuming that this run could be part of a long-running session (e.g. in an IDE) - * and watch programs will therefore be required - */ - extra.singleRun = false; } // eslint-disable-next-line @typescript-eslint/no-empty-interface @@ -433,7 +82,7 @@ function parseWithNodeMapsInternal( /** * Reset the parse configuration */ - resetExtra(); + const parseSettings = createParseSettings(code, options); /** * Ensure users do not attempt to use parse() when they need parseAndGenerateServices() @@ -445,38 +94,18 @@ function parseWithNodeMapsInternal( } /** - * Ensure the source code is a string, and store a reference to it - */ - code = enforceString(code); - extra.code = code; - - /** - * Apply the given parser options - */ - if (typeof options !== 'undefined') { - applyParserOptionsToExtra(options); - } - - /** - * Warn if the user is using an unsupported version of TypeScript - */ - warnAboutTSVersion(); - - /** - * Figure out whether this is a single run or part of a long-running process + * Create a ts.SourceFile directly, no ts.Program is needed for a simple parse */ - inferSingleRun(options); - - /** - * Create a ts.SourceFile directly, no ts.Program is needed for a simple - * parse - */ - const ast = createSourceFile(code, extra); + const ast = createSourceFile(parseSettings); /** * Convert the TypeScript AST to an ESTree-compatible one */ - const { estree, astMaps } = astConverter(ast, extra, shouldPreserveNodeMaps); + const { estree, astMaps } = astConverter( + ast, + parseSettings, + shouldPreserveNodeMaps, + ); return { ast: estree as AST, @@ -505,47 +134,31 @@ function parseAndGenerateServices( /** * Reset the parse configuration */ - resetExtra(); + const parseSettings = createParseSettings(code, options); - /** - * Ensure the source code is a string, and store a reference to it - */ - code = enforceString(code); - extra.code = code; - - /** - * Apply the given parser options - */ if (typeof options !== 'undefined') { - applyParserOptionsToExtra(options); if ( typeof options.errorOnTypeScriptSyntacticAndSemanticIssues === 'boolean' && options.errorOnTypeScriptSyntacticAndSemanticIssues ) { - extra.errorOnTypeScriptSyntacticAndSemanticIssues = true; + parseSettings.errorOnTypeScriptSyntacticAndSemanticIssues = true; } } - /** - * Warn if the user is using an unsupported version of TypeScript - */ - warnAboutTSVersion(); - - /** - * Figure out whether this is a single run or part of a long-running process - */ - inferSingleRun(options); - /** * If this is a single run in which the user has not provided any existing programs but there * are programs which need to be created from the provided "project" option, * create an Iterable which will lazily create the programs as needed by the iteration logic */ - if (extra.singleRun && !extra.programs && extra.projects?.length > 0) { - extra.programs = { + if ( + parseSettings.singleRun && + !parseSettings.programs && + parseSettings.projects?.length > 0 + ) { + parseSettings.programs = { *[Symbol.iterator](): Iterator { - for (const configFile of extra.projects) { + for (const configFile of parseSettings.projects) { const existingProgram = existingPrograms.get(configFile); if (existingProgram) { yield existingProgram; @@ -567,7 +180,7 @@ function parseAndGenerateServices( * Generate a full ts.Program or offer provided instances in order to be able to provide parser services, such as type-checking */ const shouldProvideParserServices = - extra.programs != null || (extra.projects && extra.projects.length > 0); + parseSettings.programs != null || parseSettings.projects?.length > 0; /** * If we are in singleRun mode but the parseAndGenerateServices() function has been called more than once for the current file, @@ -577,46 +190,38 @@ function parseAndGenerateServices( * In this scenario we cannot rely upon the singleRun AOT compiled programs because the SourceFiles will not contain the source * with the latest fixes applied. Therefore we fallback to creating the quickest possible isolated program from the updated source. */ - let ast: ts.SourceFile; - let program: ts.Program; - - if (extra.singleRun && options.filePath) { + if (parseSettings.singleRun && options.filePath) { parseAndGenerateServicesCalls[options.filePath] = (parseAndGenerateServicesCalls[options.filePath] || 0) + 1; } - if ( - extra.singleRun && + const { ast, program } = + parseSettings.singleRun && options.filePath && parseAndGenerateServicesCalls[options.filePath] > 1 - ) { - const isolatedAstAndProgram = createIsolatedProgram(code, extra); - ast = isolatedAstAndProgram.ast; - program = isolatedAstAndProgram.program; - } else { - const astAndProgram = getProgramAndAST( - code, - extra.programs, - shouldProvideParserServices, - extra.createDefaultProgram, - )!; - ast = astAndProgram.ast; - program = astAndProgram.program; - } + ? createIsolatedProgram(parseSettings) + : getProgramAndAST(parseSettings, shouldProvideParserServices)!; /** * Convert the TypeScript AST to an ESTree-compatible one, and optionally preserve * mappings between converted and original AST nodes */ - const preserveNodeMaps = - typeof extra.preserveNodeMaps === 'boolean' ? extra.preserveNodeMaps : true; - const { estree, astMaps } = astConverter(ast, extra, preserveNodeMaps); + const shouldPreserveNodeMaps = + typeof parseSettings.preserveNodeMaps === 'boolean' + ? parseSettings.preserveNodeMaps + : true; + + const { estree, astMaps } = astConverter( + ast, + parseSettings, + shouldPreserveNodeMaps, + ); /** * Even if TypeScript parsed the source code ok, and we had no problems converting the AST, * there may be other syntactic or semantic issues in the code that we can optionally report on. */ - if (program && extra.errorOnTypeScriptSyntacticAndSemanticIssues) { + if (program && parseSettings.errorOnTypeScriptSyntacticAndSemanticIssues) { const error = getFirstSemanticOrSyntacticError(program, ast); if (error) { throw convertError(error); diff --git a/packages/typescript-estree/src/ts-estree/estree-to-ts-node-types.ts b/packages/typescript-estree/src/ts-estree/estree-to-ts-node-types.ts index 3b80ab0a958..c080a83559b 100644 --- a/packages/typescript-estree/src/ts-estree/estree-to-ts-node-types.ts +++ b/packages/typescript-estree/src/ts-estree/estree-to-ts-node-types.ts @@ -4,6 +4,7 @@ import type * as ts from 'typescript'; import type { TSNode } from './ts-nodes'; export interface EstreeToTsNodeTypes { + [AST_NODE_TYPES.AccessorProperty]: ts.PropertyDeclaration; [AST_NODE_TYPES.ArrayExpression]: ts.ArrayLiteralExpression; [AST_NODE_TYPES.ArrayPattern]: | ts.ArrayLiteralExpression @@ -156,6 +157,7 @@ export interface EstreeToTsNodeTypes { | ts.Identifier; [AST_NODE_TYPES.ThrowStatement]: ts.ThrowStatement; [AST_NODE_TYPES.TryStatement]: ts.TryStatement; + [AST_NODE_TYPES.TSAbstractAccessorProperty]: ts.PropertyDeclaration; [AST_NODE_TYPES.TSAbstractPropertyDefinition]: ts.PropertyDeclaration; [AST_NODE_TYPES.TSAbstractMethodDefinition]: | ts.GetAccessorDeclaration @@ -185,6 +187,7 @@ export interface EstreeToTsNodeTypes { [AST_NODE_TYPES.TSInterfaceHeritage]: ts.ExpressionWithTypeArguments; [AST_NODE_TYPES.TSIntersectionType]: ts.IntersectionTypeNode; [AST_NODE_TYPES.TSInstantiationExpression]: ts.ExpressionWithTypeArguments; + [AST_NODE_TYPES.TSSatisfiesExpression]: ts.SatisfiesExpression; [AST_NODE_TYPES.TSLiteralType]: ts.LiteralTypeNode; [AST_NODE_TYPES.TSMappedType]: ts.MappedTypeNode; [AST_NODE_TYPES.TSMethodSignature]: diff --git a/packages/typescript-estree/src/ts-estree/ts-nodes.ts b/packages/typescript-estree/src/ts-estree/ts-nodes.ts index 28c30ea8bc3..0ba5414e137 100644 --- a/packages/typescript-estree/src/ts-estree/ts-nodes.ts +++ b/packages/typescript-estree/src/ts-estree/ts-nodes.ts @@ -4,12 +4,18 @@ import type * as ts from 'typescript'; // Eg: https://github.com/typescript-eslint/typescript-eslint/issues/2388, https://github.com/typescript-eslint/typescript-eslint/issues/2784 declare module 'typescript' { /* eslint-disable @typescript-eslint/no-empty-interface */ + // added in TS 4.0 export interface NamedTupleMember extends ts.Node {} + // added in TS 4.1 export interface TemplateLiteralTypeNode extends ts.Node {} + // added in TS 4.3 export interface PrivateIdentifier extends ts.Node {} export interface ClassStaticBlockDeclaration extends ts.Node {} + // added in TS 4.5 export interface AssertClause extends ts.Node {} export interface AssertEntry extends ts.Node {} + // added in TS 4.9 + export interface SatisfiesExpression extends ts.Node {} /* eslint-enable @typescript-eslint/no-empty-interface */ } @@ -180,6 +186,7 @@ export type TSNode = | ts.UnparsedSource | ts.JsonMinusNumericLiteral | ts.TemplateLiteralTypeNode + | ts.SatisfiesExpression // JSDoc: Unsupported | ts.JSDoc diff --git a/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts b/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts index 6abab590b77..9c4d8a44bcc 100644 --- a/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts +++ b/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts @@ -477,6 +477,11 @@ tester.addFixturePatternConfig('typescript/expressions', { * @see https://github.com/babel/babel/issues/14613 */ 'instantiation-expression', + /** + * TS 4.9 `satisfies` operator has not been implemented in Babel yet. + * @see https://github.com/babel/babel/pull/14211 + */ + 'satisfies-expression', ], }); diff --git a/packages/typescript-estree/tests/ast-alignment/parse.ts b/packages/typescript-estree/tests/ast-alignment/parse.ts index ee3b3066cce..b4d5ea1c8f9 100644 --- a/packages/typescript-estree/tests/ast-alignment/parse.ts +++ b/packages/typescript-estree/tests/ast-alignment/parse.ts @@ -29,7 +29,6 @@ function parseWithBabelParser(text: string, jsx = true): File { [ 'estree', { - // @ts-expect-error -- this isn't exposed in the types yet classFeatures: true, }, ], diff --git a/packages/typescript-estree/tests/fixtures/invalidFileErrors/tsconfig.extra.json b/packages/typescript-estree/tests/fixtures/invalidFileErrors/tsconfig.extra.json new file mode 100644 index 00000000000..0967ef424bc --- /dev/null +++ b/packages/typescript-estree/tests/fixtures/invalidFileErrors/tsconfig.extra.json @@ -0,0 +1 @@ +{} diff --git a/packages/typescript-estree/tests/lib/__snapshots__/parse.test.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/parse.test.ts.snap index 9816bea2914..36909473930 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/parse.test.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/parse.test.ts.snap @@ -1,59 +1,85 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`parseAndGenerateServices invalid file error messages "parserOptions.extraFileExtensions" is empty the extension does not match 1`] = ` -""parserOptions.project" has been set for @typescript-eslint/parser. -The file does not match your project config: other/unknownFileType.unknown. -The extension for the file (.unknown) is non-standard. You should add "parserOptions.extraFileExtensions" to your config." +"ESLint was configured to run on \`/other/unknownFileType.unknown\` using \`parserOptions.project\`: /tsconfig.json +The extension for the file (\`.unknown\`) is non-standard. You should add \`parserOptions.extraFileExtensions\` to your config." `; exports[`parseAndGenerateServices invalid file error messages "parserOptions.extraFileExtensions" is non-empty invalid extension 1`] = ` -""parserOptions.project" has been set for @typescript-eslint/parser. -The file does not match your project config: other/unknownFileType.unknown. -Found unexpected extension "unknown" specified with the "extraFileExtensions" option. Did you mean ".unknown"? -The extension for the file (.unknown) is non-standard. It should be added to your existing "parserOptions.extraFileExtensions"." +"ESLint was configured to run on \`/other/unknownFileType.unknown\` using \`parserOptions.project\`: /tsconfig.json +Found unexpected extension \`unknown\` specified with the \`parserOptions.extraFileExtensions\` option. Did you mean \`.unknown\`? +The extension for the file (\`.unknown\`) is non-standard. It should be added to your existing \`parserOptions.extraFileExtensions\`." `; exports[`parseAndGenerateServices invalid file error messages "parserOptions.extraFileExtensions" is non-empty the extension does not match 1`] = ` -""parserOptions.project" has been set for @typescript-eslint/parser. -The file does not match your project config: other/unknownFileType.unknown. -The extension for the file (.unknown) is non-standard. It should be added to your existing "parserOptions.extraFileExtensions"." +"ESLint was configured to run on \`/other/unknownFileType.unknown\` using \`parserOptions.project\`: /tsconfig.json +The extension for the file (\`.unknown\`) is non-standard. It should be added to your existing \`parserOptions.extraFileExtensions\`." `; exports[`parseAndGenerateServices invalid file error messages "parserOptions.extraFileExtensions" is non-empty the extension matches duplicate extension 1`] = ` -""parserOptions.project" has been set for @typescript-eslint/parser. -The file does not match your project config: ts/notIncluded.ts. -You unnecessarily included the extension ".ts" with the "extraFileExtensions" option. This extension is already handled by the parser by default. -The file must be included in at least one of the projects provided." +"ESLint was configured to run on \`/ts/notIncluded.ts\` using \`parserOptions.project\`: /tsconfig.json +You unnecessarily included the extension \`.ts\` with the \`parserOptions.extraFileExtensions\` option. This extension is already handled by the parser by default. +However, that TSConfig does not include this file. Either: +- Change ESLint's list of included files to not include this file +- Change that TSConfig to include this file +- Create a new TSConfig that includes this file and include it in your parserOptions.project +See the typescript-eslint docs for more info: https://typescript-eslint.io/linting/troubleshooting##i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file" `; exports[`parseAndGenerateServices invalid file error messages "parserOptions.extraFileExtensions" is non-empty the extension matches the file isn't included 1`] = ` -""parserOptions.project" has been set for @typescript-eslint/parser. -The file does not match your project config: other/notIncluded.vue. -The file must be included in at least one of the projects provided." +"ESLint was configured to run on \`/other/notIncluded.vue\` using \`parserOptions.project\`: /tsconfig.json +However, that TSConfig does not include this file. Either: +- Change ESLint's list of included files to not include this file +- Change that TSConfig to include this file +- Create a new TSConfig that includes this file and include it in your parserOptions.project +See the typescript-eslint docs for more info: https://typescript-eslint.io/linting/troubleshooting##i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file" `; exports[`parseAndGenerateServices invalid file error messages project includes errors for not included files 1`] = ` -""parserOptions.project" has been set for @typescript-eslint/parser. -The file does not match your project config: ts/notIncluded0j1.ts. -The file must be included in at least one of the projects provided." +"ESLint was configured to run on \`/ts/notIncluded0j1.ts\` using \`parserOptions.project\`: /tsconfig.json +However, that TSConfig does not include this file. Either: +- Change ESLint's list of included files to not include this file +- Change that TSConfig to include this file +- Create a new TSConfig that includes this file and include it in your parserOptions.project +See the typescript-eslint docs for more info: https://typescript-eslint.io/linting/troubleshooting##i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file" `; exports[`parseAndGenerateServices invalid file error messages project includes errors for not included files 2`] = ` -""parserOptions.project" has been set for @typescript-eslint/parser. -The file does not match your project config: ts/notIncluded02.tsx. -The file must be included in at least one of the projects provided." +"ESLint was configured to run on \`/ts/notIncluded02.tsx\` using \`parserOptions.project\`: /tsconfig.json +However, that TSConfig does not include this file. Either: +- Change ESLint's list of included files to not include this file +- Change that TSConfig to include this file +- Create a new TSConfig that includes this file and include it in your parserOptions.project +See the typescript-eslint docs for more info: https://typescript-eslint.io/linting/troubleshooting##i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file" `; exports[`parseAndGenerateServices invalid file error messages project includes errors for not included files 3`] = ` -""parserOptions.project" has been set for @typescript-eslint/parser. -The file does not match your project config: js/notIncluded01.js. -The file must be included in at least one of the projects provided." +"ESLint was configured to run on \`/js/notIncluded01.js\` using \`parserOptions.project\`: /tsconfig.json +However, that TSConfig does not include this file. Either: +- Change ESLint's list of included files to not include this file +- Change that TSConfig to include this file +- Create a new TSConfig that includes this file and include it in your parserOptions.project +See the typescript-eslint docs for more info: https://typescript-eslint.io/linting/troubleshooting##i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file" `; exports[`parseAndGenerateServices invalid file error messages project includes errors for not included files 4`] = ` -""parserOptions.project" has been set for @typescript-eslint/parser. -The file does not match your project config: js/notIncluded02.jsx. -The file must be included in at least one of the projects provided." +"ESLint was configured to run on \`/js/notIncluded02.jsx\` using \`parserOptions.project\`: /tsconfig.json +However, that TSConfig does not include this file. Either: +- Change ESLint's list of included files to not include this file +- Change that TSConfig to include this file +- Create a new TSConfig that includes this file and include it in your parserOptions.project +See the typescript-eslint docs for more info: https://typescript-eslint.io/linting/troubleshooting##i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file" +`; + +exports[`parseAndGenerateServices invalid project error messages throws when non of multiple projects include the file 1`] = ` +"ESLint was configured to run on \`/ts/notIncluded0j1.ts\` using \`parserOptions.project\`: +- /tsconfig.json +- /tsconfig.extra.json +However, none of those TSConfigs include this file. Either: +- Change ESLint's list of included files to not include this file +- Change one of those TSConfigs to include this file +- Create a new TSConfig that includes this file and include it in your parserOptions.project +See the typescript-eslint docs for more info: https://typescript-eslint.io/linting/troubleshooting##i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file" `; exports[`parseAndGenerateServices isolated parsing should parse .js file - with JSX content - parserOptions.jsx = false 1`] = ` diff --git a/packages/typescript-estree/tests/lib/parse.test.ts b/packages/typescript-estree/tests/lib/parse.test.ts index 54d4c12dacd..dab87e38ab6 100644 --- a/packages/typescript-estree/tests/lib/parse.test.ts +++ b/packages/typescript-estree/tests/lib/parse.test.ts @@ -35,11 +35,32 @@ jest.mock('../../src/create-program/shared', () => { }; }); +// Tests in CI by default run with lowercase program file names, +// resulting in path.relative results starting with many "../"s +jest.mock('typescript', () => { + const ts = jest.requireActual('typescript'); + return { + ...ts, + sys: { + ...ts.sys, + useCaseSensitiveFileNames: true, + }, + }; +}); + const astConverterMock = jest.mocked(astConverterModule.astConverter); const createDefaultCompilerOptionsFromExtra = jest.mocked( sharedParserUtilsModule.createDefaultCompilerOptionsFromExtra, ); +/** + * Aligns paths between environments, node for windows uses `\`, for linux and mac uses `/` + */ +function alignErrorPath(error: Error): never { + error.message = error.message.replace(/\\(?!["])/gm, '/'); + throw error; +} + beforeEach(() => { jest.clearAllMocks(); }); @@ -539,14 +560,7 @@ describe('parseAndGenerateServices', () => { filePath: join(PROJECT_DIR, filePath), }); } catch (error) { - /** - * Aligns paths between environments, node for windows uses `\`, for linux and mac uses `/` - */ - (error as Error).message = (error as Error).message.replace( - /\\(?!["])/gm, - '/', - ); - throw error; + throw alignErrorPath(error as Error); } }; @@ -617,6 +631,33 @@ describe('parseAndGenerateServices', () => { }); }); + describe('invalid project error messages', () => { + it('throws when non of multiple projects include the file', () => { + const PROJECT_DIR = resolve(FIXTURES_DIR, '../invalidFileErrors'); + const code = 'var a = true'; + const config: TSESTreeOptions = { + comment: true, + tokens: true, + range: true, + loc: true, + tsconfigRootDir: PROJECT_DIR, + project: ['./**/tsconfig.json', './**/tsconfig.extra.json'], + }; + const testParse = (filePath: string) => (): void => { + try { + parser.parseAndGenerateServices(code, { + ...config, + filePath: join(PROJECT_DIR, filePath), + }); + } catch (error) { + throw alignErrorPath(error as Error); + } + }; + + expect(testParse('ts/notIncluded0j1.ts')).toThrowErrorMatchingSnapshot(); + }); + }); + describe('debug options', () => { const debugEnable = jest.fn(); beforeEach(() => { diff --git a/packages/typescript-estree/tests/lib/persistentParse.test.ts b/packages/typescript-estree/tests/lib/persistentParse.test.ts index b6ef717afa0..63e81d7e260 100644 --- a/packages/typescript-estree/tests/lib/persistentParse.test.ts +++ b/packages/typescript-estree/tests/lib/persistentParse.test.ts @@ -2,7 +2,7 @@ import fs from 'fs'; import path from 'path'; import tmp from 'tmp'; -import { clearWatchCaches } from '../../src/create-program/createWatchProgram'; +import { clearWatchCaches } from '../../src/create-program/getWatchProgramsForProjects'; import { parseAndGenerateServices } from '../../src/parser'; const CONTENTS = { diff --git a/packages/typescript-estree/tests/lib/semanticInfo-singleRun.test.ts b/packages/typescript-estree/tests/lib/semanticInfo-singleRun.test.ts index b9bd5adb87b..33daa30a13f 100644 --- a/packages/typescript-estree/tests/lib/semanticInfo-singleRun.test.ts +++ b/packages/typescript-estree/tests/lib/semanticInfo-singleRun.test.ts @@ -60,10 +60,12 @@ jest.mock('../../src/create-program/useProvidedPrograms.ts', () => { }; }); -jest.mock('../../src/create-program/createWatchProgram', () => { +jest.mock('../../src/create-program/getWatchProgramsForProjects', () => { return { - ...jest.requireActual('../../src/create-program/createWatchProgram'), - getProgramsForProjects: jest.fn(() => [mockProgram]), + ...jest.requireActual( + '../../src/create-program/getWatchProgramsForProjects', + ), + getWatchProgramsForProjects: jest.fn(() => [mockProgram]), }; }); diff --git a/packages/typescript-estree/tests/lib/semanticInfo.test.ts b/packages/typescript-estree/tests/lib/semanticInfo.test.ts index 59a59e08a53..3ebe689185e 100644 --- a/packages/typescript-estree/tests/lib/semanticInfo.test.ts +++ b/packages/typescript-estree/tests/lib/semanticInfo.test.ts @@ -3,7 +3,7 @@ import glob from 'glob'; import * as path from 'path'; import * as ts from 'typescript'; -import { clearWatchCaches } from '../../src/create-program/createWatchProgram'; +import { clearWatchCaches } from '../../src/create-program/getWatchProgramsForProjects'; import { createProgramFromConfigFile as createProgram } from '../../src/create-program/useProvidedPrograms'; import type { ParseAndGenerateServicesResult } from '../../src/parser'; import { parseAndGenerateServices } from '../../src/parser'; @@ -240,7 +240,9 @@ describe('semanticInfo', () => { `function M() { return Base }`, createOptions(''), ), - ).toThrow(/The file does not match your project config: estree.ts/); + ).toThrow( + /ESLint was configured to run on `\/estree\.ts` using/, + ); }); it('non-existent project file', () => { diff --git a/packages/utils/CHANGELOG.md b/packages/utils/CHANGELOG.md index 6f6d1772f54..40853481544 100644 --- a/packages/utils/CHANGELOG.md +++ b/packages/utils/CHANGELOG.md @@ -3,398 +3,258 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -# [5.39.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.1...v5.39.0) (2022-10-03) +## [5.46.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.46.0...v5.46.1) (2022-12-12) **Note:** Version bump only for package @typescript-eslint/utils +# [5.46.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.45.1...v5.46.0) (2022-12-08) +**Note:** Version bump only for package @typescript-eslint/utils +## [5.45.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.45.0...v5.45.1) (2022-12-05) +**Note:** Version bump only for package @typescript-eslint/utils -## [5.38.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.0...v5.38.1) (2022-09-26) +# [5.45.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.44.0...v5.45.0) (2022-11-28) **Note:** Version bump only for package @typescript-eslint/utils +# [5.44.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.43.0...v5.44.0) (2022-11-21) +**Note:** Version bump only for package @typescript-eslint/utils +# [5.43.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.1...v5.43.0) (2022-11-14) +**Note:** Version bump only for package @typescript-eslint/utils -# [5.38.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.37.0...v5.38.0) (2022-09-19) +## [5.42.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.0...v5.42.1) (2022-11-07) **Note:** Version bump only for package @typescript-eslint/utils +# [5.42.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.41.0...v5.42.0) (2022-10-31) +### Features +- **utils:** add `RuleTester` API for top-level dependency constraints ([#5896](https://github.com/typescript-eslint/typescript-eslint/issues/5896)) ([0520d53](https://github.com/typescript-eslint/typescript-eslint/commit/0520d53536af411d66ce2ce0dd478365e67adbac)) - -# [5.37.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.2...v5.37.0) (2022-09-12) +# [5.41.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.1...v5.41.0) (2022-10-24) **Note:** Version bump only for package @typescript-eslint/utils +## [5.40.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.0...v5.40.1) (2022-10-17) +### Bug Fixes +- **utils:** add missing dependency on `@types/semver` ([#5825](https://github.com/typescript-eslint/typescript-eslint/issues/5825)) ([17b8879](https://github.com/typescript-eslint/typescript-eslint/commit/17b887933a0640d6fe843622e0520c0315144bb7)) +# [5.40.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.39.0...v5.40.0) (2022-10-10) -## [5.36.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.1...v5.36.2) (2022-09-05) +### Features + +- **utils:** add dependency constraint filtering for `RuleTester` ([#5750](https://github.com/typescript-eslint/typescript-eslint/issues/5750)) ([121f4c0](https://github.com/typescript-eslint/typescript-eslint/commit/121f4c0e7252def95d917e4734e933e53e29d501)) + +# [5.39.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.1...v5.39.0) (2022-10-03) **Note:** Version bump only for package @typescript-eslint/utils +## [5.38.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.0...v5.38.1) (2022-09-26) +**Note:** Version bump only for package @typescript-eslint/utils +# [5.38.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.37.0...v5.38.0) (2022-09-19) +**Note:** Version bump only for package @typescript-eslint/utils -## [5.36.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.0...v5.36.1) (2022-08-30) +# [5.37.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.2...v5.37.0) (2022-09-12) **Note:** Version bump only for package @typescript-eslint/utils +## [5.36.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.1...v5.36.2) (2022-09-05) +**Note:** Version bump only for package @typescript-eslint/utils +## [5.36.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.0...v5.36.1) (2022-08-30) +**Note:** Version bump only for package @typescript-eslint/utils # [5.36.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.1...v5.36.0) (2022-08-30) - ### Features -* support TypeScript 4.8 ([#5551](https://github.com/typescript-eslint/typescript-eslint/issues/5551)) ([81450ed](https://github.com/typescript-eslint/typescript-eslint/commit/81450ed7eaede74b384e9a91a84e9b4d34513866)) - - - - +- support TypeScript 4.8 ([#5551](https://github.com/typescript-eslint/typescript-eslint/issues/5551)) ([81450ed](https://github.com/typescript-eslint/typescript-eslint/commit/81450ed7eaede74b384e9a91a84e9b4d34513866)) ## [5.35.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.0...v5.35.1) (2022-08-24) **Note:** Version bump only for package @typescript-eslint/utils - - - - # [5.35.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.34.0...v5.35.0) (2022-08-24) **Note:** Version bump only for package @typescript-eslint/utils - - - - # [5.34.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.1...v5.34.0) (2022-08-22) - ### Features -* **eslint-plugin:** [prefer-optional-chain] support suggesting `!foo || !foo.bar` as a valid match for the rule ([#5266](https://github.com/typescript-eslint/typescript-eslint/issues/5266)) ([aca935c](https://github.com/typescript-eslint/typescript-eslint/commit/aca935c9696712d4aff18144c4690db4d6ba9bf9)) - - - - +- **eslint-plugin:** [prefer-optional-chain] support suggesting `!foo || !foo.bar` as a valid match for the rule ([#5266](https://github.com/typescript-eslint/typescript-eslint/issues/5266)) ([aca935c](https://github.com/typescript-eslint/typescript-eslint/commit/aca935c9696712d4aff18144c4690db4d6ba9bf9)) ## [5.33.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.0...v5.33.1) (2022-08-15) **Note:** Version bump only for package @typescript-eslint/utils - - - - # [5.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.32.0...v5.33.0) (2022-08-08) **Note:** Version bump only for package @typescript-eslint/utils - - - - # [5.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.31.0...v5.32.0) (2022-08-01) **Note:** Version bump only for package @typescript-eslint/utils - - - - # [5.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.7...v5.31.0) (2022-07-25) **Note:** Version bump only for package @typescript-eslint/utils - - - - ## [5.30.7](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.6...v5.30.7) (2022-07-18) **Note:** Version bump only for package @typescript-eslint/utils - - - - ## [5.30.6](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.5...v5.30.6) (2022-07-11) **Note:** Version bump only for package @typescript-eslint/utils - - - - ## [5.30.5](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.4...v5.30.5) (2022-07-04) **Note:** Version bump only for package @typescript-eslint/utils - - - - ## [5.30.4](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.3...v5.30.4) (2022-07-03) **Note:** Version bump only for package @typescript-eslint/utils - - - - ## [5.30.3](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.2...v5.30.3) (2022-07-01) **Note:** Version bump only for package @typescript-eslint/utils - - - - ## [5.30.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.1...v5.30.2) (2022-07-01) **Note:** Version bump only for package @typescript-eslint/utils - - - - ## 5.30.1 (2022-07-01) **Note:** Version bump only for package @typescript-eslint/utils - - - - # [5.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.29.0...v5.30.0) (2022-06-27) **Note:** Version bump only for package @typescript-eslint/utils - - - - # [5.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.28.0...v5.29.0) (2022-06-20) **Note:** Version bump only for package @typescript-eslint/utils - - - - # [5.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.1...v5.28.0) (2022-06-13) - ### Features -* **eslint-plugin:** [consistent-generic-constructors] add rule ([#4924](https://github.com/typescript-eslint/typescript-eslint/issues/4924)) ([921cdf1](https://github.com/typescript-eslint/typescript-eslint/commit/921cdf17e548845311d0591249616ec844503926)) - - - - +- **eslint-plugin:** [consistent-generic-constructors] add rule ([#4924](https://github.com/typescript-eslint/typescript-eslint/issues/4924)) ([921cdf1](https://github.com/typescript-eslint/typescript-eslint/commit/921cdf17e548845311d0591249616ec844503926)) ## [5.27.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.0...v5.27.1) (2022-06-06) **Note:** Version bump only for package @typescript-eslint/utils - - - - # [5.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.26.0...v5.27.0) (2022-05-30) - ### Features -* [4.7] support new extensions ([#5027](https://github.com/typescript-eslint/typescript-eslint/issues/5027)) ([efc147b](https://github.com/typescript-eslint/typescript-eslint/commit/efc147b04dce52ab17415b6a4ae4076b944b9036)) - - - - +- [4.7] support new extensions ([#5027](https://github.com/typescript-eslint/typescript-eslint/issues/5027)) ([efc147b](https://github.com/typescript-eslint/typescript-eslint/commit/efc147b04dce52ab17415b6a4ae4076b944b9036)) # [5.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.25.0...v5.26.0) (2022-05-23) **Note:** Version bump only for package @typescript-eslint/utils - - - - # [5.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.24.0...v5.25.0) (2022-05-17) - ### Features -* update to TypeScript 4.7-rc ([#4829](https://github.com/typescript-eslint/typescript-eslint/issues/4829)) ([6fe783c](https://github.com/typescript-eslint/typescript-eslint/commit/6fe783c20aebe26ef42b526e4a59a9be84dd5643)) - - - - +- update to TypeScript 4.7-rc ([#4829](https://github.com/typescript-eslint/typescript-eslint/issues/4829)) ([6fe783c](https://github.com/typescript-eslint/typescript-eslint/commit/6fe783c20aebe26ef42b526e4a59a9be84dd5643)) # [5.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.23.0...v5.24.0) (2022-05-16) - ### Features -* **eslint-plugin:** add new 'strict' config ([#4706](https://github.com/typescript-eslint/typescript-eslint/issues/4706)) ([4a500b2](https://github.com/typescript-eslint/typescript-eslint/commit/4a500b2d92a91873dbb729793d1ee1c36ef06ed8)) - - - - +- **eslint-plugin:** add new 'strict' config ([#4706](https://github.com/typescript-eslint/typescript-eslint/issues/4706)) ([4a500b2](https://github.com/typescript-eslint/typescript-eslint/commit/4a500b2d92a91873dbb729793d1ee1c36ef06ed8)) # [5.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.22.0...v5.23.0) (2022-05-09) - ### Features -* **utils:** update eslint types ([#4896](https://github.com/typescript-eslint/typescript-eslint/issues/4896)) ([da48527](https://github.com/typescript-eslint/typescript-eslint/commit/da485279f13cb95db1ee131a4f9c5367d54020fe)) - - - - +- **utils:** update eslint types ([#4896](https://github.com/typescript-eslint/typescript-eslint/issues/4896)) ([da48527](https://github.com/typescript-eslint/typescript-eslint/commit/da485279f13cb95db1ee131a4f9c5367d54020fe)) # [5.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.21.0...v5.22.0) (2022-05-02) **Note:** Version bump only for package @typescript-eslint/utils - - - - # [5.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.20.0...v5.21.0) (2022-04-25) **Note:** Version bump only for package @typescript-eslint/utils - - - - # [5.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.19.0...v5.20.0) (2022-04-18) **Note:** Version bump only for package @typescript-eslint/utils - - - - # [5.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.18.0...v5.19.0) (2022-04-11) **Note:** Version bump only for package @typescript-eslint/utils - - - - # [5.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.17.0...v5.18.0) (2022-04-04) **Note:** Version bump only for package @typescript-eslint/utils - - - - # [5.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.16.0...v5.17.0) (2022-03-28) **Note:** Version bump only for package @typescript-eslint/utils - - - - # [5.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.15.0...v5.16.0) (2022-03-21) - ### Bug Fixes -* **utils:** RuleTester: Only call afterAll if defined ([#4656](https://github.com/typescript-eslint/typescript-eslint/issues/4656)) ([0fe0683](https://github.com/typescript-eslint/typescript-eslint/commit/0fe0683effe4c7390806a72c6aa7795445a67929)) - - - - +- **utils:** RuleTester: Only call afterAll if defined ([#4656](https://github.com/typescript-eslint/typescript-eslint/issues/4656)) ([0fe0683](https://github.com/typescript-eslint/typescript-eslint/commit/0fe0683effe4c7390806a72c6aa7795445a67929)) # [5.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.14.0...v5.15.0) (2022-03-14) **Note:** Version bump only for package @typescript-eslint/utils - - - - # [5.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.13.0...v5.14.0) (2022-03-07) **Note:** Version bump only for package @typescript-eslint/utils - - - - # [5.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.1...v5.13.0) (2022-02-28) - ### Features -* **eslint-plugin:** add extension rule `space-before-blocks` ([#1606](https://github.com/typescript-eslint/typescript-eslint/issues/1606)) ([#4184](https://github.com/typescript-eslint/typescript-eslint/issues/4184)) ([208b6d0](https://github.com/typescript-eslint/typescript-eslint/commit/208b6d02252dff2bf272329d3e4a4a82e56c52c0)) -* **utils:** expose `ast-utils`' helpers ([#4503](https://github.com/typescript-eslint/typescript-eslint/issues/4503)) ([f106e4b](https://github.com/typescript-eslint/typescript-eslint/commit/f106e4b95e824ebb68141bce3d3207448d50c860)) -* **utils:** extract `isNotTokenOfTypeWithConditions` out of `ast-utils`' `predicates` ([#4502](https://github.com/typescript-eslint/typescript-eslint/issues/4502)) ([66501d6](https://github.com/typescript-eslint/typescript-eslint/commit/66501d6dd7e97c22c671efaa6d1ba8237907e417)) - - - - +- **eslint-plugin:** add extension rule `space-before-blocks` ([#1606](https://github.com/typescript-eslint/typescript-eslint/issues/1606)) ([#4184](https://github.com/typescript-eslint/typescript-eslint/issues/4184)) ([208b6d0](https://github.com/typescript-eslint/typescript-eslint/commit/208b6d02252dff2bf272329d3e4a4a82e56c52c0)) +- **utils:** expose `ast-utils`' helpers ([#4503](https://github.com/typescript-eslint/typescript-eslint/issues/4503)) ([f106e4b](https://github.com/typescript-eslint/typescript-eslint/commit/f106e4b95e824ebb68141bce3d3207448d50c860)) +- **utils:** extract `isNotTokenOfTypeWithConditions` out of `ast-utils`' `predicates` ([#4502](https://github.com/typescript-eslint/typescript-eslint/issues/4502)) ([66501d6](https://github.com/typescript-eslint/typescript-eslint/commit/66501d6dd7e97c22c671efaa6d1ba8237907e417)) ## [5.12.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.0...v5.12.1) (2022-02-21) **Note:** Version bump only for package @typescript-eslint/utils - - - - # [5.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.11.0...v5.12.0) (2022-02-14) **Note:** Version bump only for package @typescript-eslint/utils - - - - # [5.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.2...v5.11.0) (2022-02-07) **Note:** Version bump only for package @typescript-eslint/utils - - - - ## [5.10.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.1...v5.10.2) (2022-01-31) **Note:** Version bump only for package @typescript-eslint/utils - - - - ## [5.10.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.0...v5.10.1) (2022-01-24) **Note:** Version bump only for package @typescript-eslint/utils - - - - # [5.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.1...v5.10.0) (2022-01-17) - ### Features -* rename `experimental-utils` to `utils` and make `experimental-utils` an alias to the new package ([#4172](https://github.com/typescript-eslint/typescript-eslint/issues/4172)) ([1d55a75](https://github.com/typescript-eslint/typescript-eslint/commit/1d55a7511b38d8e2b2eabe59f639e0a865e6c93f)) +- rename `experimental-utils` to `utils` and make `experimental-utils` an alias to the new package ([#4172](https://github.com/typescript-eslint/typescript-eslint/issues/4172)) ([1d55a75](https://github.com/typescript-eslint/typescript-eslint/commit/1d55a7511b38d8e2b2eabe59f639e0a865e6c93f)) diff --git a/packages/utils/LICENSE b/packages/utils/LICENSE index 7e7370143b2..a1164108d4d 100644 --- a/packages/utils/LICENSE +++ b/packages/utils/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2019 TypeScript ESLint and other contributors +Copyright (c) 2019 typescript-eslint and other contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/utils/README.md b/packages/utils/README.md index d517cc457a5..8013675d962 100644 --- a/packages/utils/README.md +++ b/packages/utils/README.md @@ -1,27 +1,10 @@ -

Utils for ESLint Plugins

+# `@typescript-eslint/utils` -

Utilities for working with TypeScript + ESLint together.

+> Utilities for working with TypeScript + ESLint together. -

- CI - NPM Version - NPM Downloads -

+[![NPM Version](https://img.shields.io/npm/v/@typescript-eslint/utils.svg?style=flat-square)](https://www.npmjs.com/package/@typescript-eslint/utils) +[![NPM Downloads](https://img.shields.io/npm/dm/@typescript-eslint/utils.svg?style=flat-square)](https://www.npmjs.com/package/@typescript-eslint/utils) -## Exports +👉 See **https://typescript-eslint.io/architecture/utils** for documentation on this package. -| Name | Description | -| -------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [`ASTUtils`](./src/ast-utils) | Tools for operating on the ESTree AST. Also includes the [`eslint-utils`](https://www.npmjs.com/package/eslint-utils) package, correctly typed to work with the types found in `TSESTree` | -| [`ESLintUtils`](./src/eslint-utils) | Tools for creating ESLint rules with TypeScript. | -| `JSONSchema` | Types from the [`@types/json-schema`](https://www.npmjs.com/package/@types/json-schema) package, re-exported to save you having to manually import them. Also ensures you're using the same version of the types as this package. | -| [`TSESLint`](./src/ts-eslint) | Types for ESLint, correctly typed to work with the types found in `TSESTree`. | -| [`TSESLintScope`](./src/ts-eslint-scope) | The [`eslint-scope`](https://www.npmjs.com/package/eslint-scope) package, correctly typed to work with the types found in both `TSESTree` and `TSESLint` | -| [`TSESTree`](../types/src/ts-estree.ts) | Types for the TypeScript flavor of ESTree created by `@typescript-eslint/typescript-estree`. | -| [`AST_NODE_TYPES`](../types/src/ast-node-types.ts) | An enum with the names of every single _node_ found in `TSESTree`. | -| [`AST_TOKEN_TYPES`](../types/src/ast-token-types.ts) | An enum with the names of every single _token_ found in `TSESTree`. | -| [`ParserServices`](../typescript-estree/src/parser-options.ts) | Typing for the parser services provided when parsing a file using `@typescript-eslint/typescript-estree`. | - -## Contributing - -[See the contributing guide here](../../CONTRIBUTING.md) +> See https://typescript-eslint.io for general documentation on typescript-eslint, the tooling that allows you to run ESLint and Prettier on TypeScript code. diff --git a/packages/utils/package.json b/packages/utils/package.json index 15be0d28738..f0c35d911e1 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/utils", - "version": "5.39.0", + "version": "5.46.1", "description": "Utilities for working with TypeScript + ESLint together", "keywords": [ "eslint", @@ -34,22 +34,25 @@ "clean": "tsc -b tsconfig.build.json --clean", "postclean": "rimraf dist && rimraf _ts3.4 && rimraf coverage", "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", - "lint": "eslint . --ignore-path='../../.eslintignore'", + "lint": "nx lint", "test": "jest --coverage", "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { "@types/json-schema": "^7.0.9", - "@typescript-eslint/scope-manager": "5.39.0", - "@typescript-eslint/types": "5.39.0", - "@typescript-eslint/typescript-estree": "5.39.0", + "@types/semver": "^7.3.12", + "@typescript-eslint/scope-manager": "5.46.1", + "@typescript-eslint/types": "5.46.1", + "@typescript-eslint/typescript-estree": "5.46.1", "eslint-scope": "^5.1.1", - "eslint-utils": "^3.0.0" + "eslint-utils": "^3.0.0", + "semver": "^7.3.7" }, "peerDependencies": { "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" }, "devDependencies": { + "@typescript-eslint/parser": "5.46.1", "typescript": "*" }, "funding": { diff --git a/packages/utils/project.json b/packages/utils/project.json index b55a371ba33..c38b32ab3a2 100644 --- a/packages/utils/project.json +++ b/packages/utils/project.json @@ -1,5 +1,15 @@ { - "root": "packages/utils", + "name": "utils", + "$schema": "../../node_modules/nx/schemas/project-schema.json", "type": "library", - "implicitDependencies": [] + "implicitDependencies": [], + "targets": { + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["packages/utils/**/*.ts"] + } + } + } } diff --git a/packages/utils/src/eslint-utils/RuleTester.ts b/packages/utils/src/eslint-utils/RuleTester.ts deleted file mode 100644 index d0317837211..00000000000 --- a/packages/utils/src/eslint-utils/RuleTester.ts +++ /dev/null @@ -1,130 +0,0 @@ -import * as path from 'path'; - -import * as TSESLint from '../ts-eslint'; - -const parser = '@typescript-eslint/parser'; - -type RuleTesterConfig = Omit & { - parser: typeof parser; -}; - -class RuleTester extends TSESLint.RuleTester { - readonly #options: RuleTesterConfig; - - // as of eslint 6 you have to provide an absolute path to the parser - // but that's not as clean to type, this saves us trying to manually enforce - // that contributors require.resolve everything - constructor(options: RuleTesterConfig) { - super({ - ...options, - parserOptions: { - ...options.parserOptions, - warnOnUnsupportedTypeScriptVersion: - options.parserOptions?.warnOnUnsupportedTypeScriptVersion ?? false, - }, - parser: require.resolve(options.parser), - }); - - this.#options = options; - - // make sure that the parser doesn't hold onto file handles between tests - // on linux (i.e. our CI env), there can be very a limited number of watch handles available - if (typeof afterAll !== 'undefined') { - afterAll(() => { - try { - // instead of creating a hard dependency, just use a soft require - // a bit weird, but if they're using this tooling, it'll be installed - // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access - require(parser).clearCaches(); - } catch { - // ignored - } - }); - } - } - private getFilename(options?: TSESLint.ParserOptions): string { - if (options) { - const filename = `file.ts${options.ecmaFeatures?.jsx ? 'x' : ''}`; - if (options.project) { - return path.join( - options.tsconfigRootDir != null - ? options.tsconfigRootDir - : process.cwd(), - filename, - ); - } - - return filename; - } else if (this.#options.parserOptions) { - return this.getFilename(this.#options.parserOptions); - } - - return 'file.ts'; - } - - // as of eslint 6 you have to provide an absolute path to the parser - // If you don't do that at the test level, the test will fail somewhat cryptically... - // This is a lot more explicit - run>( - name: string, - rule: TSESLint.RuleModule, - testsReadonly: TSESLint.RunTests, - ): void { - const errorMessage = `Do not set the parser at the test level unless you want to use a parser other than ${parser}`; - - const tests = { ...testsReadonly }; - - // standardize the valid tests as objects - tests.valid = tests.valid.map(test => { - if (typeof test === 'string') { - return { - code: test, - }; - } - return test; - }); - - tests.valid = tests.valid.map(test => { - if (typeof test !== 'string') { - if (test.parser === parser) { - throw new Error(errorMessage); - } - if (!test.filename) { - return { - ...test, - filename: this.getFilename(test.parserOptions), - }; - } - } - return test; - }); - tests.invalid = tests.invalid.map(test => { - if (test.parser === parser) { - throw new Error(errorMessage); - } - if (!test.filename) { - return { - ...test, - filename: this.getFilename(test.parserOptions), - }; - } - return test; - }); - - super.run(name, rule, tests); - } -} - -/** - * Simple no-op tag to mark code samples as "should not format with prettier" - * for the internal/plugin-test-formatting lint rule - */ -function noFormat(strings: TemplateStringsArray, ...keys: string[]): string { - const lastIndex = strings.length - 1; - return ( - strings.slice(0, lastIndex).reduce((p, s, i) => p + s + keys[i], '') + - strings[lastIndex] - ); -} - -export { noFormat, RuleTester }; diff --git a/packages/utils/src/eslint-utils/batchedSingleLineTests.ts b/packages/utils/src/eslint-utils/batchedSingleLineTests.ts index 64a29fd5109..fcd15210e48 100644 --- a/packages/utils/src/eslint-utils/batchedSingleLineTests.ts +++ b/packages/utils/src/eslint-utils/batchedSingleLineTests.ts @@ -1,4 +1,7 @@ -import type { InvalidTestCase, ValidTestCase } from '../ts-eslint'; +import type { + InvalidTestCase, + ValidTestCase, +} from '../eslint-utils/rule-tester/RuleTester'; /** * Converts a batch of single line tests into a number of separate test cases. diff --git a/packages/utils/src/eslint-utils/index.ts b/packages/utils/src/eslint-utils/index.ts index fc8e410428e..a3d0cb75245 100644 --- a/packages/utils/src/eslint-utils/index.ts +++ b/packages/utils/src/eslint-utils/index.ts @@ -3,6 +3,6 @@ export * from './batchedSingleLineTests'; export * from './getParserServices'; export * from './InferTypesFromRule'; export * from './RuleCreator'; -export * from './RuleTester'; +export * from './rule-tester/RuleTester'; export * from './deepMerge'; export * from './nullThrows'; diff --git a/packages/utils/src/eslint-utils/rule-tester/RuleTester.ts b/packages/utils/src/eslint-utils/rule-tester/RuleTester.ts new file mode 100644 index 00000000000..7350de3a975 --- /dev/null +++ b/packages/utils/src/eslint-utils/rule-tester/RuleTester.ts @@ -0,0 +1,318 @@ +import type * as TSESLintParserType from '@typescript-eslint/parser'; +import assert from 'assert'; +import { version as eslintVersion } from 'eslint/package.json'; +import * as path from 'path'; +import * as semver from 'semver'; + +import type { ParserOptions } from '../../ts-eslint/ParserOptions'; +import type { RuleModule } from '../../ts-eslint/Rule'; +import type { RuleTesterTestFrameworkFunction } from '../../ts-eslint/RuleTester'; +import * as BaseRuleTester from '../../ts-eslint/RuleTester'; +import { deepMerge } from '../deepMerge'; +import type { DependencyConstraint } from './dependencyConstraints'; +import { satisfiesAllDependencyConstraints } from './dependencyConstraints'; + +const TS_ESLINT_PARSER = '@typescript-eslint/parser'; +const ERROR_MESSAGE = `Do not set the parser at the test level unless you want to use a parser other than ${TS_ESLINT_PARSER}`; + +type RuleTesterConfig = Omit & { + parser: typeof TS_ESLINT_PARSER; + /** + * Constraints that must pass in the current environment for any tests to run + */ + dependencyConstraints?: DependencyConstraint; +}; + +interface InvalidTestCase< + TMessageIds extends string, + TOptions extends Readonly, +> extends BaseRuleTester.InvalidTestCase { + /** + * Constraints that must pass in the current environment for the test to run + */ + dependencyConstraints?: DependencyConstraint; +} +interface ValidTestCase> + extends BaseRuleTester.ValidTestCase { + /** + * Constraints that must pass in the current environment for the test to run + */ + dependencyConstraints?: DependencyConstraint; +} +interface RunTests< + TMessageIds extends string, + TOptions extends Readonly, +> { + // RuleTester.run also accepts strings for valid cases + readonly valid: readonly (ValidTestCase | string)[]; + readonly invalid: readonly InvalidTestCase[]; +} + +type AfterAll = (fn: () => void) => void; + +function isDescribeWithSkip( + value: unknown, +): value is RuleTesterTestFrameworkFunction & { + skip: RuleTesterTestFrameworkFunction; +} { + return ( + typeof value === 'object' && + value != null && + 'skip' in value && + typeof (value as Record).skip === 'function' + ); +} + +class RuleTester extends BaseRuleTester.RuleTester { + readonly #baseOptions: RuleTesterConfig; + + static #afterAll: AfterAll | undefined; + /** + * If you supply a value to this property, the rule tester will call this instead of using the version defined on + * the global namespace. + */ + static get afterAll(): AfterAll { + return ( + this.#afterAll ?? + (typeof afterAll === 'function' ? afterAll : (): void => {}) + ); + } + static set afterAll(value: AfterAll | undefined) { + this.#afterAll = value; + } + + private get staticThis(): typeof RuleTester { + // the cast here is due to https://github.com/microsoft/TypeScript/issues/3841 + return this.constructor as typeof RuleTester; + } + + constructor(baseOptions: RuleTesterConfig) { + // eslint will hard-error if you include non-standard top-level properties + const { dependencyConstraints: _, ...baseOptionsSafeForESLint } = + baseOptions; + super({ + ...baseOptionsSafeForESLint, + parserOptions: { + ...baseOptions.parserOptions, + warnOnUnsupportedTypeScriptVersion: + baseOptions.parserOptions?.warnOnUnsupportedTypeScriptVersion ?? + false, + }, + // as of eslint 6 you have to provide an absolute path to the parser + // but that's not as clean to type, this saves us trying to manually enforce + // that contributors require.resolve everything + parser: require.resolve(baseOptions.parser), + }); + + this.#baseOptions = baseOptions; + + // make sure that the parser doesn't hold onto file handles between tests + // on linux (i.e. our CI env), there can be very a limited number of watch handles available + this.staticThis.afterAll(() => { + try { + // instead of creating a hard dependency, just use a soft require + // a bit weird, but if they're using this tooling, it'll be installed + const parser = require(TS_ESLINT_PARSER) as typeof TSESLintParserType; + parser.clearCaches(); + } catch { + // ignored on purpose + } + }); + } + private getFilename(testOptions?: ParserOptions): string { + const resolvedOptions = deepMerge( + this.#baseOptions.parserOptions, + testOptions, + ) as ParserOptions; + const filename = `file.ts${resolvedOptions.ecmaFeatures?.jsx ? 'x' : ''}`; + if (resolvedOptions.project) { + return path.join( + resolvedOptions.tsconfigRootDir != null + ? resolvedOptions.tsconfigRootDir + : process.cwd(), + filename, + ); + } + return filename; + } + + // as of eslint 6 you have to provide an absolute path to the parser + // If you don't do that at the test level, the test will fail somewhat cryptically... + // This is a lot more explicit + run>( + name: string, + rule: RuleModule, + testsReadonly: RunTests, + ): void { + if ( + this.#baseOptions.dependencyConstraints && + !satisfiesAllDependencyConstraints( + this.#baseOptions.dependencyConstraints, + ) + ) { + if (isDescribeWithSkip(this.staticThis.describe)) { + // for frameworks like mocha or jest that have a "skip" version of their function + // we can provide a nice skipped test! + this.staticThis.describe.skip(name, () => { + this.staticThis.it( + 'All tests skipped due to unsatisfied constructor dependency constraints', + () => {}, + ); + }); + } else { + // otherwise just declare an empty test + this.staticThis.describe(name, () => { + this.staticThis.it( + 'All tests skipped due to unsatisfied constructor dependency constraints', + () => { + // some frameworks error if there are no assertions + assert.equal(true, true); + }, + ); + }); + } + + // don't run any tests because we don't match the base constraint + return; + } + + const tests = { + // standardize the valid tests as objects + valid: testsReadonly.valid.map(test => { + if (typeof test === 'string') { + return { + code: test, + }; + } + return test; + }), + invalid: testsReadonly.invalid, + }; + + // convenience iterator to make it easy to loop all tests without a concat + const allTestsIterator = { + *[Symbol.iterator](): Generator, void, unknown> { + for (const test of tests.valid) { + yield test; + } + for (const test of tests.invalid) { + yield test; + } + }, + }; + + /* + Automatically add a filename to the tests to enable type-aware tests to "just work". + This saves users having to verbosely and manually add the filename to every + single test case. + Hugely helps with the string-based valid test cases as it means they don't + need to be made objects! + Also removes dependencyConstraints, which we support but ESLint core doesn't. + */ + const normalizeTest = < + T extends + | ValidTestCase + | InvalidTestCase, + >({ + dependencyConstraints: _, + ...test + }: T): Omit => { + if (test.parser === TS_ESLINT_PARSER) { + throw new Error(ERROR_MESSAGE); + } + if (!test.filename) { + return { + ...test, + filename: this.getFilename(test.parserOptions), + }; + } + return test; + }; + tests.valid = tests.valid.map(normalizeTest); + tests.invalid = tests.invalid.map(normalizeTest); + + const hasOnly = ((): boolean => { + for (const test of allTestsIterator) { + if (test.only) { + return true; + } + } + return false; + })(); + // if there is an `only: true` - don't apply constraints - assume that + // we are in "local development" mode rather than "CI validation" mode + if (!hasOnly) { + /* + Automatically skip tests that don't satisfy the dependency constraints. + */ + const hasConstraints = ((): boolean => { + for (const test of allTestsIterator) { + if ( + test.dependencyConstraints && + Object.keys(test.dependencyConstraints).length > 0 + ) { + return true; + } + } + return false; + })(); + if (hasConstraints) { + // The `only: boolean` test property was only added in ESLint v7.29.0. + if (semver.satisfies(eslintVersion, '>=7.29.0')) { + /* + Mark all satisfactory tests as `only: true`, and all other tests as + `only: false`. + When multiple tests are marked as "only", test frameworks like jest and mocha + will run all of those tests and will just skip the other tests. + + We do this instead of just omitting the tests entirely because it gives the + test framework the opportunity to log the test as skipped rather than the test + just disappearing. + */ + const maybeMarkAsOnly = < + T extends + | ValidTestCase + | InvalidTestCase, + >( + test: T, + ): T => { + return { + ...test, + only: satisfiesAllDependencyConstraints( + test.dependencyConstraints, + ), + }; + }; + + tests.valid = tests.valid.map(maybeMarkAsOnly); + tests.invalid = tests.invalid.map(maybeMarkAsOnly); + } else { + // On older versions we just fallback to raw array filtering like SAVAGES + tests.valid = tests.valid.filter(test => + satisfiesAllDependencyConstraints(test.dependencyConstraints), + ); + tests.invalid = tests.invalid.filter(test => + satisfiesAllDependencyConstraints(test.dependencyConstraints), + ); + } + } + } + + super.run(name, rule, tests); + } +} + +/** + * Simple no-op tag to mark code samples as "should not format with prettier" + * for the internal/plugin-test-formatting lint rule + */ +function noFormat(strings: TemplateStringsArray, ...keys: string[]): string { + const lastIndex = strings.length - 1; + return ( + strings.slice(0, lastIndex).reduce((p, s, i) => p + s + keys[i], '') + + strings[lastIndex] + ); +} + +export { noFormat, RuleTester }; +export type { InvalidTestCase, ValidTestCase, RunTests }; diff --git a/packages/utils/src/eslint-utils/rule-tester/dependencyConstraints.ts b/packages/utils/src/eslint-utils/rule-tester/dependencyConstraints.ts new file mode 100644 index 00000000000..0bc1f5fc5ce --- /dev/null +++ b/packages/utils/src/eslint-utils/rule-tester/dependencyConstraints.ts @@ -0,0 +1,63 @@ +import * as semver from 'semver'; + +interface SemverVersionConstraint { + readonly range: string; + readonly options?: Parameters[2]; +} +type AtLeastVersionConstraint = + | `${number}` + | `${number}.${number}` + | `${number}.${number}.${number}` + | `${number}.${number}.${number}-${string}`; +type VersionConstraint = SemverVersionConstraint | AtLeastVersionConstraint; +interface DependencyConstraint { + /** + * Passing a string for the value is shorthand for a '>=' constraint + */ + readonly [packageName: string]: VersionConstraint; +} + +const BASE_SATISFIES_OPTIONS: semver.RangeOptions = { + includePrerelease: true, +}; + +function satisfiesDependencyConstraint( + packageName: string, + constraintIn: DependencyConstraint[string], +): boolean { + const constraint: SemverVersionConstraint = + typeof constraintIn === 'string' + ? { + range: `>=${constraintIn}`, + } + : constraintIn; + + return semver.satisfies( + (require(`${packageName}/package.json`) as { version: string }).version, + constraint.range, + typeof constraint.options === 'object' + ? { ...BASE_SATISFIES_OPTIONS, ...constraint.options } + : constraint.options, + ); +} + +function satisfiesAllDependencyConstraints( + dependencyConstraints: DependencyConstraint | undefined, +): boolean { + if (dependencyConstraints == null) { + return true; + } + + for (const [packageName, constraint] of Object.entries( + dependencyConstraints, + )) { + if (!satisfiesDependencyConstraint(packageName, constraint)) { + return false; + } + } + + return true; +} + +export { satisfiesAllDependencyConstraints }; +export type { DependencyConstraint }; diff --git a/packages/utils/src/ts-eslint/RuleTester.ts b/packages/utils/src/ts-eslint/RuleTester.ts index 15f3bd7e1f5..6c0b98b795f 100644 --- a/packages/utils/src/ts-eslint/RuleTester.ts +++ b/packages/utils/src/ts-eslint/RuleTester.ts @@ -125,6 +125,15 @@ interface TestCaseError { // readonly message?: string | RegExp; } +/** + * @param text a string describing the rule + * @param callback the test callback + */ +type RuleTesterTestFrameworkFunction = ( + text: string, + callback: () => void, +) => void; + interface RunTests< TMessageIds extends string, TOptions extends Readonly, @@ -161,23 +170,26 @@ declare class RuleTesterBase { /** * If you supply a value to this property, the rule tester will call this instead of using the version defined on * the global namespace. - * @param text a string describing the rule - * @param callback the test callback */ - static describe?: (text: string, callback: () => void) => void; + static get describe(): RuleTesterTestFrameworkFunction; + static set describe(value: RuleTesterTestFrameworkFunction | undefined); + + /** + * If you supply a value to this property, the rule tester will call this instead of using the version defined on + * the global namespace. + */ + static get it(): RuleTesterTestFrameworkFunction; + static set it(value: RuleTesterTestFrameworkFunction | undefined); /** * If you supply a value to this property, the rule tester will call this instead of using the version defined on * the global namespace. - * @param text a string describing the test case - * @param callback the test callback */ - static it?: (text: string, callback: () => void) => void; + static get itOnly(): RuleTesterTestFrameworkFunction; + static set itOnly(value: RuleTesterTestFrameworkFunction | undefined); /** * Define a rule for one particular run of tests. - * @param name The name of the rule to define. - * @param rule The rule definition. */ defineRule>( name: string, @@ -194,6 +206,7 @@ export { SuggestionOutput, RuleTester, RuleTesterConfig, + RuleTesterTestFrameworkFunction, RunTests, TestCaseError, ValidTestCase, diff --git a/packages/utils/tests/eslint-utils/rule-tester/RuleTester.test.ts b/packages/utils/tests/eslint-utils/rule-tester/RuleTester.test.ts new file mode 100644 index 00000000000..57ac48b38c1 --- /dev/null +++ b/packages/utils/tests/eslint-utils/rule-tester/RuleTester.test.ts @@ -0,0 +1,737 @@ +import * as parser from '@typescript-eslint/parser'; +import eslintPackageJson from 'eslint/package.json'; + +import * as dependencyConstraintsModule from '../../../src/eslint-utils/rule-tester/dependencyConstraints'; +import { RuleTester } from '../../../src/eslint-utils/rule-tester/RuleTester'; +import type { RuleModule } from '../../../src/ts-eslint'; +import { RuleTester as BaseRuleTester } from '../../../src/ts-eslint'; + +// we can't spy on the exports of an ES module - so we instead have to mock the entire module +jest.mock('../../../src/eslint-utils/rule-tester/dependencyConstraints', () => { + const dependencyConstraints = jest.requireActual< + typeof dependencyConstraintsModule + >('../../../src/eslint-utils/rule-tester/dependencyConstraints'); + + return { + ...dependencyConstraints, + __esModule: true, + satisfiesAllDependencyConstraints: jest.fn( + dependencyConstraints.satisfiesAllDependencyConstraints, + ), + }; +}); +const satisfiesAllDependencyConstraintsMock = jest.mocked( + dependencyConstraintsModule.satisfiesAllDependencyConstraints, +); + +jest.mock( + 'totally-real-dependency/package.json', + () => ({ + version: '10.0.0', + }), + { + // this is not a real module that will exist + virtual: true, + }, +); +jest.mock( + 'totally-real-dependency-prerelease/package.json', + () => ({ + version: '10.0.0-rc.1', + }), + { + // this is not a real module that will exist + virtual: true, + }, +); + +// mock the eslint package.json so that we can manipulate the version in the test +jest.mock('eslint/package.json', () => { + return { + // make the version a getter so we can spy on it and change the return value + get version(): string { + // fix the version so the test is stable on older ESLint versions + return '8.0.0'; + }, + }; +}); + +jest.mock('@typescript-eslint/parser', () => { + return { + __esModule: true, + clearCaches: jest.fn(), + }; +}); + +/* eslint-disable jest/prefer-spy-on -- + need to specifically assign to the properties or else it will use the + global value */ +RuleTester.afterAll = jest.fn(); +RuleTester.describe = jest.fn(); +RuleTester.it = jest.fn(); +RuleTester.itOnly = jest.fn(); +/* eslint-enable jest/prefer-spy-on */ + +const mockedAfterAll = jest.mocked(RuleTester.afterAll); +const mockedDescribe = jest.mocked(RuleTester.describe); +const mockedIt = jest.mocked(RuleTester.it); +const _mockedItOnly = jest.mocked(RuleTester.itOnly); +const runSpy = jest.spyOn(BaseRuleTester.prototype, 'run'); +const mockedParserClearCaches = jest.mocked(parser.clearCaches); + +const eslintVersionSpy = jest.spyOn(eslintPackageJson, 'version', 'get'); + +beforeEach(() => { + jest.clearAllMocks(); +}); + +const NOOP_RULE: RuleModule<'error', []> = { + meta: { + messages: { + error: 'error', + }, + type: 'problem', + schema: {}, + }, + defaultOptions: [], + create() { + return {}; + }, +}; + +describe('RuleTester', () => { + it('automatically sets the filename for tests', () => { + const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', + parserOptions: { + project: 'tsconfig.json', + tsconfigRootDir: '/some/path/that/totally/exists/', + }, + }); + + ruleTester.run('my-rule', NOOP_RULE, { + invalid: [ + { + code: 'invalid tests should work as well', + errors: [], + }, + ], + valid: [ + 'string based valid test', + { + code: 'object based valid test', + }, + { + code: "explicit filename shouldn't be overwritten", + filename: '/set/in/the/test.ts', + }, + { + code: 'jsx should have the correct filename', + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + }, + }, + { + code: 'type-aware parser options should override the constructor config', + parserOptions: { + project: 'tsconfig.test-specific.json', + tsconfigRootDir: '/set/in/the/test/', + }, + }, + ], + }); + + expect(runSpy.mock.lastCall?.[2]).toMatchInlineSnapshot(` + { + "invalid": [ + { + "code": "invalid tests should work as well", + "errors": [], + "filename": "/some/path/that/totally/exists/file.ts", + }, + ], + "valid": [ + { + "code": "string based valid test", + "filename": "/some/path/that/totally/exists/file.ts", + }, + { + "code": "object based valid test", + "filename": "/some/path/that/totally/exists/file.ts", + }, + { + "code": "explicit filename shouldn't be overwritten", + "filename": "/set/in/the/test.ts", + }, + { + "code": "jsx should have the correct filename", + "filename": "/some/path/that/totally/exists/file.tsx", + "parserOptions": { + "ecmaFeatures": { + "jsx": true, + }, + }, + }, + { + "code": "type-aware parser options should override the constructor config", + "filename": "/set/in/the/test/file.ts", + "parserOptions": { + "project": "tsconfig.test-specific.json", + "tsconfigRootDir": "/set/in/the/test/", + }, + }, + ], + } + `); + }); + + it('schedules the parser caches to be cleared afterAll', () => { + // it should schedule the afterAll + expect(mockedAfterAll).toHaveBeenCalledTimes(0); + const _ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', + parserOptions: { + project: 'tsconfig.json', + tsconfigRootDir: '/some/path/that/totally/exists/', + }, + }); + expect(mockedAfterAll).toHaveBeenCalledTimes(1); + + // the provided callback should clear the caches + const callback = mockedAfterAll.mock.calls[0][0]; + expect(typeof callback).toBe('function'); + expect(mockedParserClearCaches).not.toHaveBeenCalled(); + callback(); + expect(mockedParserClearCaches).toHaveBeenCalledTimes(1); + }); + + it('throws an error if you attempt to set the parser to ts-eslint at the test level', () => { + const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', + parserOptions: { + project: 'tsconfig.json', + tsconfigRootDir: '/some/path/that/totally/exists/', + }, + }); + + expect(() => + ruleTester.run('my-rule', NOOP_RULE, { + valid: [ + { + code: 'object based valid test', + parser: '@typescript-eslint/parser', + }, + ], + + invalid: [], + }), + ).toThrowErrorMatchingInlineSnapshot( + `"Do not set the parser at the test level unless you want to use a parser other than @typescript-eslint/parser"`, + ); + }); + + describe('checks dependencies as specified', () => { + it('does not check dependencies if there are no dependency constraints', () => { + const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', + }); + + ruleTester.run('my-rule', NOOP_RULE, { + valid: [ + 'const x = 1;', + { code: 'const x = 2;' }, + // empty object is ignored + { code: 'const x = 3;', dependencyConstraints: {} }, + ], + invalid: [], + }); + + expect(satisfiesAllDependencyConstraintsMock).not.toHaveBeenCalled(); + }); + + describe('does not check dependencies if is an "only" manually set', () => { + it('in the valid section', () => { + const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', + }); + + ruleTester.run('my-rule', NOOP_RULE, { + valid: [ + 'const x = 1;', + { code: 'const x = 2;' }, + { + code: 'const x = 3;', + // eslint-disable-next-line eslint-plugin/no-only-tests -- intentional only for test purposes + only: true, + }, + { + code: 'const x = 4;', + dependencyConstraints: { + 'totally-real-dependency': '999', + }, + }, + ], + invalid: [], + }); + + expect(satisfiesAllDependencyConstraintsMock).not.toHaveBeenCalled(); + }); + + it('in the invalid section', () => { + const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', + }); + + ruleTester.run('my-rule', NOOP_RULE, { + valid: [ + 'const x = 1;', + { code: 'const x = 2;' }, + { + code: 'const x = 4;', + dependencyConstraints: { + 'totally-real-dependency': '999', + }, + }, + ], + invalid: [ + { + code: 'const x = 3;', + errors: [], + // eslint-disable-next-line eslint-plugin/no-only-tests -- intentional only for test purposes + only: true, + }, + ], + }); + + expect(satisfiesAllDependencyConstraintsMock).not.toHaveBeenCalled(); + }); + }); + + it('correctly handles string-based at-least', () => { + const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', + }); + + ruleTester.run('my-rule', NOOP_RULE, { + invalid: [ + { + code: 'failing - major', + errors: [], + dependencyConstraints: { + 'totally-real-dependency': '999', + }, + }, + { + code: 'failing - major.minor', + errors: [], + dependencyConstraints: { + 'totally-real-dependency': '999.0', + }, + }, + { + code: 'failing - major.minor.patch', + errors: [], + dependencyConstraints: { + 'totally-real-dependency': '999.0.0', + }, + }, + ], + valid: [ + { + code: 'passing - major', + dependencyConstraints: { + 'totally-real-dependency': '10', + }, + }, + { + code: 'passing - major.minor', + dependencyConstraints: { + 'totally-real-dependency': '10.0', + }, + }, + { + code: 'passing - major.minor.patch', + dependencyConstraints: { + 'totally-real-dependency': '10.0.0', + }, + }, + ], + }); + + expect(runSpy.mock.lastCall?.[2]).toMatchInlineSnapshot(` + { + "invalid": [ + { + "code": "failing - major", + "errors": [], + "filename": "file.ts", + }, + { + "code": "failing - major.minor", + "errors": [], + "filename": "file.ts", + }, + { + "code": "failing - major.minor.patch", + "errors": [], + "filename": "file.ts", + }, + ], + "valid": [ + { + "code": "passing - major", + "filename": "file.ts", + }, + { + "code": "passing - major.minor", + "filename": "file.ts", + }, + { + "code": "passing - major.minor.patch", + "filename": "file.ts", + }, + ], + } + `); + }); + + it('correctly handles object-based semver', () => { + const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', + }); + + ruleTester.run('my-rule', NOOP_RULE, { + invalid: [ + { + code: 'failing - major', + errors: [], + dependencyConstraints: { + 'totally-real-dependency': { + range: '^999', + }, + }, + }, + { + code: 'failing - major.minor', + errors: [], + dependencyConstraints: { + 'totally-real-dependency': { + range: '>=999.0', + }, + }, + }, + + { + code: 'failing with options', + errors: [], + dependencyConstraints: { + 'totally-real-dependency-prerelease': { + range: '^10', + options: { + includePrerelease: false, + }, + }, + }, + }, + ], + valid: [ + { + code: 'passing - major', + dependencyConstraints: { + 'totally-real-dependency': { + range: '^10', + }, + }, + }, + { + code: 'passing - major.minor', + dependencyConstraints: { + 'totally-real-dependency': { + range: '<999', + }, + }, + }, + ], + }); + + expect(runSpy.mock.lastCall?.[2]).toMatchInlineSnapshot(` + { + "invalid": [ + { + "code": "failing - major", + "errors": [], + "filename": "file.ts", + }, + { + "code": "failing - major.minor", + "errors": [], + "filename": "file.ts", + }, + { + "code": "failing with options", + "errors": [], + "filename": "file.ts", + }, + ], + "valid": [ + { + "code": "passing - major", + "filename": "file.ts", + }, + { + "code": "passing - major.minor", + "filename": "file.ts", + }, + ], + } + `); + }); + + it('tests without versions should always be run', () => { + const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', + }); + + ruleTester.run('my-rule', NOOP_RULE, { + invalid: [ + { + code: 'no constraints is always run', + errors: [], + }, + { + code: 'empty object is always run', + errors: [], + dependencyConstraints: {}, + }, + { + code: 'failing constraint', + errors: [], + dependencyConstraints: { + 'totally-real-dependency': '99999', + }, + }, + ], + valid: [ + 'string based is always run', + { + code: 'no constraints is always run', + }, + { + code: 'empty object is always run', + dependencyConstraints: {}, + }, + { + code: 'passing constraint', + dependencyConstraints: { + 'totally-real-dependency': '10', + }, + }, + ], + }); + + expect(runSpy.mock.lastCall?.[2]).toMatchInlineSnapshot(` + { + "invalid": [ + { + "code": "no constraints is always run", + "errors": [], + "filename": "file.ts", + }, + { + "code": "empty object is always run", + "errors": [], + "filename": "file.ts", + }, + { + "code": "failing constraint", + "errors": [], + "filename": "file.ts", + }, + ], + "valid": [ + { + "code": "string based is always run", + "filename": "file.ts", + }, + { + "code": "no constraints is always run", + "filename": "file.ts", + }, + { + "code": "empty object is always run", + "filename": "file.ts", + }, + { + "code": "passing constraint", + "filename": "file.ts", + }, + ], + } + `); + }); + + it('uses filter instead of "only" for old ESLint versions', () => { + // need it twice because ESLint internally fetches this value once :( + eslintVersionSpy.mockReturnValueOnce('1.0.0'); + eslintVersionSpy.mockReturnValueOnce('1.0.0'); + + const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', + }); + + ruleTester.run('my-rule', NOOP_RULE, { + invalid: [ + { + code: 'failing', + errors: [], + dependencyConstraints: { + 'totally-real-dependency': '999', + }, + }, + { + code: 'passing', + errors: [], + dependencyConstraints: { + 'totally-real-dependency': '10', + }, + }, + ], + valid: [ + 'always passing string test', + { + code: 'failing', + dependencyConstraints: { + 'totally-real-dependency': '999', + }, + }, + { + code: 'passing', + dependencyConstraints: { + 'totally-real-dependency': '10', + }, + }, + ], + }); + + expect(runSpy.mock.lastCall?.[2]).toMatchInlineSnapshot(` + { + "invalid": [ + { + "code": "failing", + "errors": [], + "filename": "file.ts", + }, + { + "code": "passing", + "errors": [], + "filename": "file.ts", + }, + ], + "valid": [ + { + "code": "always passing string test", + "filename": "file.ts", + }, + { + "code": "failing", + "filename": "file.ts", + }, + { + "code": "passing", + "filename": "file.ts", + }, + ], + } + `); + }); + + describe('constructor constraints', () => { + it('skips all tests if a constructor constraint is not satisifed', () => { + const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', + dependencyConstraints: { + 'totally-real-dependency': '999', + }, + }); + + ruleTester.run('my-rule', NOOP_RULE, { + invalid: [ + { + code: 'failing - major', + errors: [], + }, + ], + valid: [ + { + code: 'passing - major', + }, + ], + }); + + // trigger the describe block + expect(mockedDescribe.mock.calls.length).toBeGreaterThanOrEqual(1); + mockedDescribe.mock.lastCall?.[1](); + expect(mockedDescribe.mock.calls).toMatchInlineSnapshot(` + [ + [ + "my-rule", + [Function], + ], + ] + `); + expect(mockedIt.mock.lastCall).toMatchInlineSnapshot(` + [ + "All tests skipped due to unsatisfied constructor dependency constraints", + [Function], + ] + `); + }); + + it('does not skip all tests if a constructor constraint is satisifed', () => { + const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', + dependencyConstraints: { + 'totally-real-dependency': '10', + }, + }); + + ruleTester.run('my-rule', NOOP_RULE, { + invalid: [ + { + code: 'valid', + errors: [], + }, + ], + valid: [ + { + code: 'valid', + }, + ], + }); + + // trigger the describe block + expect(mockedDescribe.mock.calls.length).toBeGreaterThanOrEqual(1); + mockedDescribe.mock.lastCall?.[1](); + expect(mockedDescribe.mock.calls).toMatchInlineSnapshot(` + [ + [ + "my-rule", + [Function], + ], + [ + "valid", + [Function], + ], + [ + "invalid", + [Function], + ], + ] + `); + // expect(mockedIt.mock.lastCall).toMatchInlineSnapshot(`undefined`); + }); + }); + }); +}); diff --git a/packages/visitor-keys/CHANGELOG.md b/packages/visitor-keys/CHANGELOG.md index cd78eccf8b0..d3c1d03fde2 100644 --- a/packages/visitor-keys/CHANGELOG.md +++ b/packages/visitor-keys/CHANGELOG.md @@ -3,1092 +3,613 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -# [5.39.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.1...v5.39.0) (2022-10-03) +## [5.46.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.46.0...v5.46.1) (2022-12-12) **Note:** Version bump only for package @typescript-eslint/visitor-keys +# [5.46.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.45.1...v5.46.0) (2022-12-08) +**Note:** Version bump only for package @typescript-eslint/visitor-keys +## [5.45.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.45.0...v5.45.1) (2022-12-05) +**Note:** Version bump only for package @typescript-eslint/visitor-keys -## [5.38.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.0...v5.38.1) (2022-09-26) +# [5.45.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.44.0...v5.45.0) (2022-11-28) -**Note:** Version bump only for package @typescript-eslint/visitor-keys +### Features +- support Auto Accessor syntax ([#5926](https://github.com/typescript-eslint/typescript-eslint/issues/5926)) ([becd1f8](https://github.com/typescript-eslint/typescript-eslint/commit/becd1f8581c0013399dfe71be6c265e96cedb57a)) +# [5.44.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.43.0...v5.44.0) (2022-11-21) +### Features +- support parsing `satisfies` operators ([#5717](https://github.com/typescript-eslint/typescript-eslint/issues/5717)) ([20d7cae](https://github.com/typescript-eslint/typescript-eslint/commit/20d7caee35ab84ae6381fdf04338c9e2b9e2bc48)) -# [5.38.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.37.0...v5.38.0) (2022-09-19) +# [5.43.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.1...v5.43.0) (2022-11-14) **Note:** Version bump only for package @typescript-eslint/visitor-keys +## [5.42.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.0...v5.42.1) (2022-11-07) +**Note:** Version bump only for package @typescript-eslint/visitor-keys +# [5.42.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.41.0...v5.42.0) (2022-10-31) +**Note:** Version bump only for package @typescript-eslint/visitor-keys -# [5.37.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.2...v5.37.0) (2022-09-12) +# [5.41.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.1...v5.41.0) (2022-10-24) **Note:** Version bump only for package @typescript-eslint/visitor-keys +## [5.40.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.0...v5.40.1) (2022-10-17) +**Note:** Version bump only for package @typescript-eslint/visitor-keys +# [5.40.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.39.0...v5.40.0) (2022-10-10) +**Note:** Version bump only for package @typescript-eslint/visitor-keys -## [5.36.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.1...v5.36.2) (2022-09-05) +# [5.39.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.1...v5.39.0) (2022-10-03) **Note:** Version bump only for package @typescript-eslint/visitor-keys +## [5.38.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.0...v5.38.1) (2022-09-26) +**Note:** Version bump only for package @typescript-eslint/visitor-keys +# [5.38.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.37.0...v5.38.0) (2022-09-19) +**Note:** Version bump only for package @typescript-eslint/visitor-keys -## [5.36.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.0...v5.36.1) (2022-08-30) +# [5.37.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.2...v5.37.0) (2022-09-12) **Note:** Version bump only for package @typescript-eslint/visitor-keys +## [5.36.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.1...v5.36.2) (2022-09-05) +**Note:** Version bump only for package @typescript-eslint/visitor-keys +## [5.36.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.0...v5.36.1) (2022-08-30) +**Note:** Version bump only for package @typescript-eslint/visitor-keys # [5.36.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.1...v5.36.0) (2022-08-30) **Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - ## [5.35.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.0...v5.35.1) (2022-08-24) **Note:** Version bump only for package @typescript-eslint/visitor-keys +# [5.35.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.34.0...v5.35.0) (2022-08-24) +**Note:** Version bump only for package @typescript-eslint/visitor-keys +# [5.34.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.1...v5.34.0) (2022-08-22) +**Note:** Version bump only for package @typescript-eslint/visitor-keys -# [5.35.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.34.0...v5.35.0) (2022-08-24) +## [5.33.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.0...v5.33.1) (2022-08-15) **Note:** Version bump only for package @typescript-eslint/visitor-keys +# [5.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.32.0...v5.33.0) (2022-08-08) +**Note:** Version bump only for package @typescript-eslint/visitor-keys +# [5.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.31.0...v5.32.0) (2022-08-01) +**Note:** Version bump only for package @typescript-eslint/visitor-keys -# [5.34.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.1...v5.34.0) (2022-08-22) +# [5.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.7...v5.31.0) (2022-07-25) **Note:** Version bump only for package @typescript-eslint/visitor-keys +## [5.30.7](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.6...v5.30.7) (2022-07-18) +### Bug Fixes +- expose types supporting old versions of typescript ([#5339](https://github.com/typescript-eslint/typescript-eslint/issues/5339)) ([4ba9bdb](https://github.com/typescript-eslint/typescript-eslint/commit/4ba9bdb93f87e6bc370f13aa1de48f435abe3f88)) - -## [5.33.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.0...v5.33.1) (2022-08-15) +## [5.30.6](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.5...v5.30.6) (2022-07-11) **Note:** Version bump only for package @typescript-eslint/visitor-keys +## [5.30.5](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.4...v5.30.5) (2022-07-04) +**Note:** Version bump only for package @typescript-eslint/visitor-keys +## [5.30.4](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.3...v5.30.4) (2022-07-03) +**Note:** Version bump only for package @typescript-eslint/visitor-keys -# [5.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.32.0...v5.33.0) (2022-08-08) +## [5.30.3](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.2...v5.30.3) (2022-07-01) **Note:** Version bump only for package @typescript-eslint/visitor-keys +## [5.30.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.1...v5.30.2) (2022-07-01) +**Note:** Version bump only for package @typescript-eslint/visitor-keys +## 5.30.1 (2022-07-01) +**Note:** Version bump only for package @typescript-eslint/visitor-keys -# [5.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.31.0...v5.32.0) (2022-08-01) +# [5.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.29.0...v5.30.0) (2022-06-27) **Note:** Version bump only for package @typescript-eslint/visitor-keys +# [5.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.28.0...v5.29.0) (2022-06-20) +**Note:** Version bump only for package @typescript-eslint/visitor-keys +# [5.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.1...v5.28.0) (2022-06-13) +### Bug Fixes -# [5.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.7...v5.31.0) (2022-07-25) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys +- [TS4.7] allow visiting of typeParameters in TSTypeQuery ([#5166](https://github.com/typescript-eslint/typescript-eslint/issues/5166)) ([dc1f930](https://github.com/typescript-eslint/typescript-eslint/commit/dc1f9309cf04aa7314e758980ac687558482f47f)) +## [5.27.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.0...v5.27.1) (2022-06-06) +**Note:** Version bump only for package @typescript-eslint/visitor-keys +# [5.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.26.0...v5.27.0) (2022-05-30) +### Features -## [5.30.7](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.6...v5.30.7) (2022-07-18) +- [4.7] support new extensions ([#5027](https://github.com/typescript-eslint/typescript-eslint/issues/5027)) ([efc147b](https://github.com/typescript-eslint/typescript-eslint/commit/efc147b04dce52ab17415b6a4ae4076b944b9036)) +# [5.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.25.0...v5.26.0) (2022-05-23) -### Bug Fixes +### Features -* expose types supporting old versions of typescript ([#5339](https://github.com/typescript-eslint/typescript-eslint/issues/5339)) ([4ba9bdb](https://github.com/typescript-eslint/typescript-eslint/commit/4ba9bdb93f87e6bc370f13aa1de48f435abe3f88)) +- [4.7] support instantiation expressions ([#4938](https://github.com/typescript-eslint/typescript-eslint/issues/4938)) ([79fbc77](https://github.com/typescript-eslint/typescript-eslint/commit/79fbc7743ae5dce3190f8168776e0204755390ad)) +# [5.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.24.0...v5.25.0) (2022-05-17) +**Note:** Version bump only for package @typescript-eslint/visitor-keys +# [5.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.23.0...v5.24.0) (2022-05-16) +**Note:** Version bump only for package @typescript-eslint/visitor-keys -## [5.30.6](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.5...v5.30.6) (2022-07-11) +# [5.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.22.0...v5.23.0) (2022-05-09) **Note:** Version bump only for package @typescript-eslint/visitor-keys +# [5.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.21.0...v5.22.0) (2022-05-02) + +### Features +- **ast-spec:** add fixture test framework and some initial fixtures ([#3258](https://github.com/typescript-eslint/typescript-eslint/issues/3258)) ([f3cf87b](https://github.com/typescript-eslint/typescript-eslint/commit/f3cf87bf20fd0542f92a96a318aa9ee5bf23c1f6)) +# [5.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.20.0...v5.21.0) (2022-04-25) +**Note:** Version bump only for package @typescript-eslint/visitor-keys -## [5.30.5](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.4...v5.30.5) (2022-07-04) +# [5.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.19.0...v5.20.0) (2022-04-18) **Note:** Version bump only for package @typescript-eslint/visitor-keys +# [5.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.18.0...v5.19.0) (2022-04-11) + +**Note:** Version bump only for package @typescript-eslint/visitor-keys +# [5.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.17.0...v5.18.0) (2022-04-04) +### Bug Fixes +- **visitor-keys:** add missing visitor keys ([#4731](https://github.com/typescript-eslint/typescript-eslint/issues/4731)) ([bb575a0](https://github.com/typescript-eslint/typescript-eslint/commit/bb575a0763f39b9b988a7c20afee7b5eeb64cba7)) -## [5.30.4](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.3...v5.30.4) (2022-07-03) +# [5.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.16.0...v5.17.0) (2022-03-28) **Note:** Version bump only for package @typescript-eslint/visitor-keys +# [5.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.15.0...v5.16.0) (2022-03-21) +**Note:** Version bump only for package @typescript-eslint/visitor-keys +# [5.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.14.0...v5.15.0) (2022-03-14) +**Note:** Version bump only for package @typescript-eslint/visitor-keys -## [5.30.3](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.2...v5.30.3) (2022-07-01) +# [5.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.13.0...v5.14.0) (2022-03-07) **Note:** Version bump only for package @typescript-eslint/visitor-keys +# [5.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.1...v5.13.0) (2022-02-28) +**Note:** Version bump only for package @typescript-eslint/visitor-keys +## [5.12.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.0...v5.12.1) (2022-02-21) +**Note:** Version bump only for package @typescript-eslint/visitor-keys -## [5.30.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.1...v5.30.2) (2022-07-01) +# [5.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.11.0...v5.12.0) (2022-02-14) **Note:** Version bump only for package @typescript-eslint/visitor-keys +# [5.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.2...v5.11.0) (2022-02-07) +**Note:** Version bump only for package @typescript-eslint/visitor-keys +## [5.10.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.1...v5.10.2) (2022-01-31) +**Note:** Version bump only for package @typescript-eslint/visitor-keys -## 5.30.1 (2022-07-01) +## [5.10.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.0...v5.10.1) (2022-01-24) **Note:** Version bump only for package @typescript-eslint/visitor-keys +# [5.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.1...v5.10.0) (2022-01-17) +**Note:** Version bump only for package @typescript-eslint/visitor-keys +## [5.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.0...v5.9.1) (2022-01-10) +**Note:** Version bump only for package @typescript-eslint/visitor-keys -# [5.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.29.0...v5.30.0) (2022-06-27) +# [5.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.1...v5.9.0) (2022-01-03) **Note:** Version bump only for package @typescript-eslint/visitor-keys +## [5.8.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.0...v5.8.1) (2021-12-27) +**Note:** Version bump only for package @typescript-eslint/visitor-keys +# [5.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.7.0...v5.8.0) (2021-12-20) +**Note:** Version bump only for package @typescript-eslint/visitor-keys -# [5.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.28.0...v5.29.0) (2022-06-20) +# [5.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.6.0...v5.7.0) (2021-12-13) **Note:** Version bump only for package @typescript-eslint/visitor-keys +# [5.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.5.0...v5.6.0) (2021-12-06) +**Note:** Version bump only for package @typescript-eslint/visitor-keys +# [5.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.4.0...v5.5.0) (2021-11-29) +### Bug Fixes -# [5.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.1...v5.28.0) (2022-06-13) +- **visitor-keys:** add missing import assertion keys ([#4178](https://github.com/typescript-eslint/typescript-eslint/issues/4178)) ([9c38b7f](https://github.com/typescript-eslint/typescript-eslint/commit/9c38b7f7fc3ce471a8f720c4a2fbce01f3ee12a4)) +# [5.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.3.1...v5.4.0) (2021-11-15) -### Bug Fixes +### Features -* [TS4.7] allow visiting of typeParameters in TSTypeQuery ([#5166](https://github.com/typescript-eslint/typescript-eslint/issues/5166)) ([dc1f930](https://github.com/typescript-eslint/typescript-eslint/commit/dc1f9309cf04aa7314e758980ac687558482f47f)) +- **typescript-estree:** support Import Assertions ([#4074](https://github.com/typescript-eslint/typescript-eslint/issues/4074)) ([ae0fb5a](https://github.com/typescript-eslint/typescript-eslint/commit/ae0fb5a591958216b7df656e66b1dfe464898167)) +## [5.3.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.3.0...v5.3.1) (2021-11-08) +**Note:** Version bump only for package @typescript-eslint/visitor-keys +# [5.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.2.0...v5.3.0) (2021-11-01) +**Note:** Version bump only for package @typescript-eslint/visitor-keys -## [5.27.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.0...v5.27.1) (2022-06-06) +# [5.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.1.0...v5.2.0) (2021-10-25) **Note:** Version bump only for package @typescript-eslint/visitor-keys +# [5.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.0.0...v5.1.0) (2021-10-18) +**Note:** Version bump only for package @typescript-eslint/visitor-keys +# [5.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.33.0...v5.0.0) (2021-10-11) +### Features -# [5.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.26.0...v5.27.0) (2022-05-30) +- align class property representation with ESTree ([#3806](https://github.com/typescript-eslint/typescript-eslint/issues/3806)) ([22fa5c0](https://github.com/typescript-eslint/typescript-eslint/commit/22fa5c0c4705ed2898f00b7cacc5dd642d859275)), closes [#3430](https://github.com/typescript-eslint/typescript-eslint/issues/3430) [#3077](https://github.com/typescript-eslint/typescript-eslint/issues/3077) +- remove `TSParenthesizedType` ([#3340](https://github.com/typescript-eslint/typescript-eslint/issues/3340)) ([c8ee432](https://github.com/typescript-eslint/typescript-eslint/commit/c8ee43269faea4c04ec02eaa2b81a0aa6eec5d3e)), closes [#3136](https://github.com/typescript-eslint/typescript-eslint/issues/3136) +- support `PrivateIdentifier` ([#3808](https://github.com/typescript-eslint/typescript-eslint/issues/3808)) ([0eefe5e](https://github.com/typescript-eslint/typescript-eslint/commit/0eefe5e49d21af3f1e3e2d9a90c2e49929863ac2)), closes [#3430](https://github.com/typescript-eslint/typescript-eslint/issues/3430) [#2933](https://github.com/typescript-eslint/typescript-eslint/issues/2933) +- **eslint-plugin:** removed value from abstract property nodes ([#3765](https://github.com/typescript-eslint/typescript-eslint/issues/3765)) ([5823524](https://github.com/typescript-eslint/typescript-eslint/commit/58235241714596b641a1e8b39c569e561e0039b4)), closes [#3748](https://github.com/typescript-eslint/typescript-eslint/issues/3748) +# [4.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.32.0...v4.33.0) (2021-10-04) -### Features +**Note:** Version bump only for package @typescript-eslint/visitor-keys -* [4.7] support new extensions ([#5027](https://github.com/typescript-eslint/typescript-eslint/issues/5027)) ([efc147b](https://github.com/typescript-eslint/typescript-eslint/commit/efc147b04dce52ab17415b6a4ae4076b944b9036)) +# [4.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.2...v4.32.0) (2021-09-27) +**Note:** Version bump only for package @typescript-eslint/visitor-keys +## [4.31.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.1...v4.31.2) (2021-09-20) +**Note:** Version bump only for package @typescript-eslint/visitor-keys +## [4.31.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.0...v4.31.1) (2021-09-13) -# [5.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.25.0...v5.26.0) (2022-05-23) +**Note:** Version bump only for package @typescript-eslint/visitor-keys +# [4.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.30.0...v4.31.0) (2021-09-06) -### Features +**Note:** Version bump only for package @typescript-eslint/visitor-keys -* [4.7] support instantiation expressions ([#4938](https://github.com/typescript-eslint/typescript-eslint/issues/4938)) ([79fbc77](https://github.com/typescript-eslint/typescript-eslint/commit/79fbc7743ae5dce3190f8168776e0204755390ad)) +# [4.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.3...v4.30.0) (2021-08-30) +### Bug Fixes +- **visitor-keys:** add key to StaticBlock (v5) ([#3812](https://github.com/typescript-eslint/typescript-eslint/issues/3812)) ([fa35e22](https://github.com/typescript-eslint/typescript-eslint/commit/fa35e22702207baf07acb3eec11d3383721bf6b6)) +### Features +- **typescript-estree:** add support for class static blocks ([#3730](https://github.com/typescript-eslint/typescript-eslint/issues/3730)) ([f81831b](https://github.com/typescript-eslint/typescript-eslint/commit/f81831bd279a32da6dbab0f1c061053ea43965f6)) -# [5.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.24.0...v5.25.0) (2022-05-17) +## [4.29.3](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.2...v4.29.3) (2021-08-23) **Note:** Version bump only for package @typescript-eslint/visitor-keys +## [4.29.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.1...v4.29.2) (2021-08-16) +**Note:** Version bump only for package @typescript-eslint/visitor-keys +## [4.29.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.0...v4.29.1) (2021-08-09) +**Note:** Version bump only for package @typescript-eslint/visitor-keys -# [5.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.23.0...v5.24.0) (2022-05-16) +# [4.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.5...v4.29.0) (2021-08-02) **Note:** Version bump only for package @typescript-eslint/visitor-keys +## [4.28.5](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.4...v4.28.5) (2021-07-26) +**Note:** Version bump only for package @typescript-eslint/visitor-keys +## [4.28.4](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.3...v4.28.4) (2021-07-19) +**Note:** Version bump only for package @typescript-eslint/visitor-keys -# [5.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.22.0...v5.23.0) (2022-05-09) +## [4.28.3](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.2...v4.28.3) (2021-07-12) **Note:** Version bump only for package @typescript-eslint/visitor-keys +## [4.28.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.1...v4.28.2) (2021-07-05) +**Note:** Version bump only for package @typescript-eslint/visitor-keys +## [4.28.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.0...v4.28.1) (2021-06-28) +**Note:** Version bump only for package @typescript-eslint/visitor-keys -# [5.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.21.0...v5.22.0) (2022-05-02) +# [4.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.27.0...v4.28.0) (2021-06-21) +**Note:** Version bump only for package @typescript-eslint/visitor-keys -### Features +# [4.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.1...v4.27.0) (2021-06-14) -* **ast-spec:** add fixture test framework and some initial fixtures ([#3258](https://github.com/typescript-eslint/typescript-eslint/issues/3258)) ([f3cf87b](https://github.com/typescript-eslint/typescript-eslint/commit/f3cf87bf20fd0542f92a96a318aa9ee5bf23c1f6)) +**Note:** Version bump only for package @typescript-eslint/visitor-keys +## [4.26.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.0...v4.26.1) (2021-06-07) +**Note:** Version bump only for package @typescript-eslint/visitor-keys +# [4.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.25.0...v4.26.0) (2021-05-31) +**Note:** Version bump only for package @typescript-eslint/visitor-keys -# [5.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.20.0...v5.21.0) (2022-04-25) +# [4.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.24.0...v4.25.0) (2021-05-24) **Note:** Version bump only for package @typescript-eslint/visitor-keys +# [4.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.23.0...v4.24.0) (2021-05-17) + +**Note:** Version bump only for package @typescript-eslint/visitor-keys +# [4.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.1...v4.23.0) (2021-05-10) +### Features +- refactor to split AST specification out as its own module ([#2911](https://github.com/typescript-eslint/typescript-eslint/issues/2911)) ([25ea953](https://github.com/typescript-eslint/typescript-eslint/commit/25ea953cc60b118bd385c71e0a9b61c286c26fcf)) -# [5.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.19.0...v5.20.0) (2022-04-18) +## [4.22.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.0...v4.22.1) (2021-05-04) **Note:** Version bump only for package @typescript-eslint/visitor-keys +# [4.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.21.0...v4.22.0) (2021-04-12) +**Note:** Version bump only for package @typescript-eslint/visitor-keys +# [4.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.20.0...v4.21.0) (2021-04-05) +**Note:** Version bump only for package @typescript-eslint/visitor-keys -# [5.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.18.0...v5.19.0) (2022-04-11) +# [4.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.19.0...v4.20.0) (2021-03-29) **Note:** Version bump only for package @typescript-eslint/visitor-keys +# [4.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.18.0...v4.19.0) (2021-03-22) +**Note:** Version bump only for package @typescript-eslint/visitor-keys +# [4.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.17.0...v4.18.0) (2021-03-15) +**Note:** Version bump only for package @typescript-eslint/visitor-keys -# [5.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.17.0...v5.18.0) (2022-04-04) +# [4.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.16.1...v4.17.0) (2021-03-08) +**Note:** Version bump only for package @typescript-eslint/visitor-keys -### Bug Fixes +## [4.16.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.16.0...v4.16.1) (2021-03-01) -* **visitor-keys:** add missing visitor keys ([#4731](https://github.com/typescript-eslint/typescript-eslint/issues/4731)) ([bb575a0](https://github.com/typescript-eslint/typescript-eslint/commit/bb575a0763f39b9b988a7c20afee7b5eeb64cba7)) +**Note:** Version bump only for package @typescript-eslint/visitor-keys +# [4.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.2...v4.16.0) (2021-03-01) +### Features +- TypeScript 4.2 syntax support ([#3112](https://github.com/typescript-eslint/typescript-eslint/issues/3112)) ([2ebfb21](https://github.com/typescript-eslint/typescript-eslint/commit/2ebfb21ba6c88c793cfbd0e231e5803b2381694c)) +## [4.15.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.1...v4.15.2) (2021-02-22) -# [5.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.16.0...v5.17.0) (2022-03-28) +### Bug Fixes -**Note:** Version bump only for package @typescript-eslint/visitor-keys +- add missing intrinsic keyword node to AST ([#3081](https://github.com/typescript-eslint/typescript-eslint/issues/3081)) ([409bf0b](https://github.com/typescript-eslint/typescript-eslint/commit/409bf0bb3e2ac4d8782408d436ebdefb42dba38b)) +## [4.15.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.0...v4.15.1) (2021-02-15) +**Note:** Version bump only for package @typescript-eslint/visitor-keys +# [4.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.2...v4.15.0) (2021-02-08) +**Note:** Version bump only for package @typescript-eslint/visitor-keys -# [5.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.15.0...v5.16.0) (2022-03-21) +## [4.14.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.1...v4.14.2) (2021-02-01) **Note:** Version bump only for package @typescript-eslint/visitor-keys +## [4.14.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.0...v4.14.1) (2021-01-25) +**Note:** Version bump only for package @typescript-eslint/visitor-keys +# [4.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.13.0...v4.14.0) (2021-01-18) +**Note:** Version bump only for package @typescript-eslint/visitor-keys -# [5.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.14.0...v5.15.0) (2022-03-14) +# [4.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.12.0...v4.13.0) (2021-01-11) **Note:** Version bump only for package @typescript-eslint/visitor-keys +# [4.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.11.1...v4.12.0) (2021-01-04) +**Note:** Version bump only for package @typescript-eslint/visitor-keys +## [4.11.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.11.0...v4.11.1) (2020-12-28) +**Note:** Version bump only for package @typescript-eslint/visitor-keys -# [5.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.13.0...v5.14.0) (2022-03-07) +# [4.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.10.0...v4.11.0) (2020-12-21) **Note:** Version bump only for package @typescript-eslint/visitor-keys +# [4.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.9.1...v4.10.0) (2020-12-14) +**Note:** Version bump only for package @typescript-eslint/visitor-keys +## [4.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.9.0...v4.9.1) (2020-12-07) +**Note:** Version bump only for package @typescript-eslint/visitor-keys -# [5.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.1...v5.13.0) (2022-02-28) +# [4.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.2...v4.9.0) (2020-11-30) **Note:** Version bump only for package @typescript-eslint/visitor-keys +## [4.8.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.1...v4.8.2) (2020-11-23) +**Note:** Version bump only for package @typescript-eslint/visitor-keys +## [4.8.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.0...v4.8.1) (2020-11-17) +**Note:** Version bump only for package @typescript-eslint/visitor-keys -## [5.12.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.0...v5.12.1) (2022-02-21) +# [4.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.7.0...v4.8.0) (2020-11-16) **Note:** Version bump only for package @typescript-eslint/visitor-keys +# [4.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.6.1...v4.7.0) (2020-11-09) +### Features +- support TS4.1 features ([#2748](https://github.com/typescript-eslint/typescript-eslint/issues/2748)) ([2be354b](https://github.com/typescript-eslint/typescript-eslint/commit/2be354bb15f9013a2da1b13a0c0836e9ef057e16)), closes [#2583](https://github.com/typescript-eslint/typescript-eslint/issues/2583) - -# [5.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.11.0...v5.12.0) (2022-02-14) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -# [5.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.2...v5.11.0) (2022-02-07) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -## [5.10.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.1...v5.10.2) (2022-01-31) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -## [5.10.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.0...v5.10.1) (2022-01-24) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -# [5.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.1...v5.10.0) (2022-01-17) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -## [5.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.0...v5.9.1) (2022-01-10) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -# [5.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.1...v5.9.0) (2022-01-03) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -## [5.8.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.0...v5.8.1) (2021-12-27) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -# [5.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.7.0...v5.8.0) (2021-12-20) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -# [5.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.6.0...v5.7.0) (2021-12-13) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -# [5.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.5.0...v5.6.0) (2021-12-06) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -# [5.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.4.0...v5.5.0) (2021-11-29) - - -### Bug Fixes - -* **visitor-keys:** add missing import assertion keys ([#4178](https://github.com/typescript-eslint/typescript-eslint/issues/4178)) ([9c38b7f](https://github.com/typescript-eslint/typescript-eslint/commit/9c38b7f7fc3ce471a8f720c4a2fbce01f3ee12a4)) - - - - - -# [5.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.3.1...v5.4.0) (2021-11-15) - - -### Features - -* **typescript-estree:** support Import Assertions ([#4074](https://github.com/typescript-eslint/typescript-eslint/issues/4074)) ([ae0fb5a](https://github.com/typescript-eslint/typescript-eslint/commit/ae0fb5a591958216b7df656e66b1dfe464898167)) - - - - - -## [5.3.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.3.0...v5.3.1) (2021-11-08) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -# [5.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.2.0...v5.3.0) (2021-11-01) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -# [5.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.1.0...v5.2.0) (2021-10-25) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -# [5.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.0.0...v5.1.0) (2021-10-18) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -# [5.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.33.0...v5.0.0) (2021-10-11) - - -### Features - -* align class property representation with ESTree ([#3806](https://github.com/typescript-eslint/typescript-eslint/issues/3806)) ([22fa5c0](https://github.com/typescript-eslint/typescript-eslint/commit/22fa5c0c4705ed2898f00b7cacc5dd642d859275)), closes [#3430](https://github.com/typescript-eslint/typescript-eslint/issues/3430) [#3077](https://github.com/typescript-eslint/typescript-eslint/issues/3077) -* remove `TSParenthesizedType` ([#3340](https://github.com/typescript-eslint/typescript-eslint/issues/3340)) ([c8ee432](https://github.com/typescript-eslint/typescript-eslint/commit/c8ee43269faea4c04ec02eaa2b81a0aa6eec5d3e)), closes [#3136](https://github.com/typescript-eslint/typescript-eslint/issues/3136) -* support `PrivateIdentifier` ([#3808](https://github.com/typescript-eslint/typescript-eslint/issues/3808)) ([0eefe5e](https://github.com/typescript-eslint/typescript-eslint/commit/0eefe5e49d21af3f1e3e2d9a90c2e49929863ac2)), closes [#3430](https://github.com/typescript-eslint/typescript-eslint/issues/3430) [#2933](https://github.com/typescript-eslint/typescript-eslint/issues/2933) -* **eslint-plugin:** removed value from abstract property nodes ([#3765](https://github.com/typescript-eslint/typescript-eslint/issues/3765)) ([5823524](https://github.com/typescript-eslint/typescript-eslint/commit/58235241714596b641a1e8b39c569e561e0039b4)), closes [#3748](https://github.com/typescript-eslint/typescript-eslint/issues/3748) - - - - - -# [4.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.32.0...v4.33.0) (2021-10-04) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -# [4.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.2...v4.32.0) (2021-09-27) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -## [4.31.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.1...v4.31.2) (2021-09-20) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -## [4.31.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.0...v4.31.1) (2021-09-13) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -# [4.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.30.0...v4.31.0) (2021-09-06) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -# [4.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.3...v4.30.0) (2021-08-30) - - -### Bug Fixes - -* **visitor-keys:** add key to StaticBlock (v5) ([#3812](https://github.com/typescript-eslint/typescript-eslint/issues/3812)) ([fa35e22](https://github.com/typescript-eslint/typescript-eslint/commit/fa35e22702207baf07acb3eec11d3383721bf6b6)) - - -### Features - -* **typescript-estree:** add support for class static blocks ([#3730](https://github.com/typescript-eslint/typescript-eslint/issues/3730)) ([f81831b](https://github.com/typescript-eslint/typescript-eslint/commit/f81831bd279a32da6dbab0f1c061053ea43965f6)) - - - - - -## [4.29.3](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.2...v4.29.3) (2021-08-23) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -## [4.29.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.1...v4.29.2) (2021-08-16) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -## [4.29.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.0...v4.29.1) (2021-08-09) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -# [4.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.5...v4.29.0) (2021-08-02) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -## [4.28.5](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.4...v4.28.5) (2021-07-26) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -## [4.28.4](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.3...v4.28.4) (2021-07-19) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -## [4.28.3](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.2...v4.28.3) (2021-07-12) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -## [4.28.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.1...v4.28.2) (2021-07-05) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -## [4.28.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.0...v4.28.1) (2021-06-28) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -# [4.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.27.0...v4.28.0) (2021-06-21) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -# [4.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.1...v4.27.0) (2021-06-14) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -## [4.26.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.0...v4.26.1) (2021-06-07) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -# [4.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.25.0...v4.26.0) (2021-05-31) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -# [4.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.24.0...v4.25.0) (2021-05-24) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -# [4.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.23.0...v4.24.0) (2021-05-17) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -# [4.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.1...v4.23.0) (2021-05-10) - - -### Features - -* refactor to split AST specification out as its own module ([#2911](https://github.com/typescript-eslint/typescript-eslint/issues/2911)) ([25ea953](https://github.com/typescript-eslint/typescript-eslint/commit/25ea953cc60b118bd385c71e0a9b61c286c26fcf)) - - - - - -## [4.22.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.0...v4.22.1) (2021-05-04) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -# [4.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.21.0...v4.22.0) (2021-04-12) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -# [4.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.20.0...v4.21.0) (2021-04-05) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -# [4.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.19.0...v4.20.0) (2021-03-29) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -# [4.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.18.0...v4.19.0) (2021-03-22) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -# [4.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.17.0...v4.18.0) (2021-03-15) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -# [4.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.16.1...v4.17.0) (2021-03-08) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -## [4.16.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.16.0...v4.16.1) (2021-03-01) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -# [4.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.2...v4.16.0) (2021-03-01) - - -### Features - -* TypeScript 4.2 syntax support ([#3112](https://github.com/typescript-eslint/typescript-eslint/issues/3112)) ([2ebfb21](https://github.com/typescript-eslint/typescript-eslint/commit/2ebfb21ba6c88c793cfbd0e231e5803b2381694c)) - - - - - -## [4.15.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.1...v4.15.2) (2021-02-22) - - -### Bug Fixes - -* add missing intrinsic keyword node to AST ([#3081](https://github.com/typescript-eslint/typescript-eslint/issues/3081)) ([409bf0b](https://github.com/typescript-eslint/typescript-eslint/commit/409bf0bb3e2ac4d8782408d436ebdefb42dba38b)) - - - - - -## [4.15.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.0...v4.15.1) (2021-02-15) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -# [4.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.2...v4.15.0) (2021-02-08) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -## [4.14.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.1...v4.14.2) (2021-02-01) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -## [4.14.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.0...v4.14.1) (2021-01-25) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -# [4.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.13.0...v4.14.0) (2021-01-18) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -# [4.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.12.0...v4.13.0) (2021-01-11) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -# [4.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.11.1...v4.12.0) (2021-01-04) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -## [4.11.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.11.0...v4.11.1) (2020-12-28) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -# [4.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.10.0...v4.11.0) (2020-12-21) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -# [4.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.9.1...v4.10.0) (2020-12-14) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -## [4.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.9.0...v4.9.1) (2020-12-07) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -# [4.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.2...v4.9.0) (2020-11-30) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -## [4.8.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.1...v4.8.2) (2020-11-23) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -## [4.8.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.0...v4.8.1) (2020-11-17) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -# [4.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.7.0...v4.8.0) (2020-11-16) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -# [4.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.6.1...v4.7.0) (2020-11-09) - - -### Features - -* support TS4.1 features ([#2748](https://github.com/typescript-eslint/typescript-eslint/issues/2748)) ([2be354b](https://github.com/typescript-eslint/typescript-eslint/commit/2be354bb15f9013a2da1b13a0c0836e9ef057e16)), closes [#2583](https://github.com/typescript-eslint/typescript-eslint/issues/2583) - - - - - -## [4.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.6.0...v4.6.1) (2020-11-02) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -# [4.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.5.0...v4.6.0) (2020-10-26) - -**Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - - -# [4.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.4.1...v4.5.0) (2020-10-19) +## [4.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.6.0...v4.6.1) (2020-11-02) **Note:** Version bump only for package @typescript-eslint/visitor-keys +# [4.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.5.0...v4.6.0) (2020-10-26) +**Note:** Version bump only for package @typescript-eslint/visitor-keys +# [4.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.4.1...v4.5.0) (2020-10-19) +**Note:** Version bump only for package @typescript-eslint/visitor-keys ## [4.4.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.4.0...v4.4.1) (2020-10-12) **Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - # [4.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.3.0...v4.4.0) (2020-10-05) **Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - # [4.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.2.0...v4.3.0) (2020-09-28) **Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - # [4.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.1...v4.2.0) (2020-09-21) **Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - ## [4.1.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.0...v4.1.1) (2020-09-14) **Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - # [4.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.0.1...v4.1.0) (2020-09-07) **Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - ## [4.0.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.0.0...v4.0.1) (2020-08-31) **Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - # [4.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.10.1...v4.0.0) (2020-08-31) - ### Bug Fixes -* correct decorator traversal for AssignmentPattern ([#2375](https://github.com/typescript-eslint/typescript-eslint/issues/2375)) ([d738fa4](https://github.com/typescript-eslint/typescript-eslint/commit/d738fa4eff0a5c4cfc9b30b1c0502f8d1e78d7b6)) - +- correct decorator traversal for AssignmentPattern ([#2375](https://github.com/typescript-eslint/typescript-eslint/issues/2375)) ([d738fa4](https://github.com/typescript-eslint/typescript-eslint/commit/d738fa4eff0a5c4cfc9b30b1c0502f8d1e78d7b6)) ### Features -* support ESTree optional chaining representation ([#2308](https://github.com/typescript-eslint/typescript-eslint/issues/2308)) ([e9d2ab6](https://github.com/typescript-eslint/typescript-eslint/commit/e9d2ab638b6767700b52797e74b814ea059beaae)) - +- support ESTree optional chaining representation ([#2308](https://github.com/typescript-eslint/typescript-eslint/issues/2308)) ([e9d2ab6](https://github.com/typescript-eslint/typescript-eslint/commit/e9d2ab638b6767700b52797e74b814ea059beaae)) ### BREAKING CHANGES -* - Removed decorators property from several Nodes that could never semantically have them (FunctionDeclaration, TSEnumDeclaration, and TSInterfaceDeclaration) -- Removed AST_NODE_TYPES.Import. This is a minor breaking change as the node type that used this was removed ages ago. - - - +- - Removed decorators property from several Nodes that could never semantically have them (FunctionDeclaration, TSEnumDeclaration, and TSInterfaceDeclaration) +* Removed AST_NODE_TYPES.Import. This is a minor breaking change as the node type that used this was removed ages ago. ## [3.10.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.10.0...v3.10.1) (2020-08-25) **Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - # [3.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.9.1...v3.10.0) (2020-08-24) **Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - ## [3.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.9.0...v3.9.1) (2020-08-17) **Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - # [3.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.8.0...v3.9.0) (2020-08-10) - ### Features -* **typescript-estree:** support TSv4 labelled tuple members ([#2378](https://github.com/typescript-eslint/typescript-eslint/issues/2378)) ([00d84ff](https://github.com/typescript-eslint/typescript-eslint/commit/00d84ffbcbe9d0ec98bdb2f2ce59959a27ce4dbe)) - - - - +- **typescript-estree:** support TSv4 labelled tuple members ([#2378](https://github.com/typescript-eslint/typescript-eslint/issues/2378)) ([00d84ff](https://github.com/typescript-eslint/typescript-eslint/commit/00d84ffbcbe9d0ec98bdb2f2ce59959a27ce4dbe)) # [3.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.7.1...v3.8.0) (2020-08-03) **Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - ## [3.7.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.7.0...v3.7.1) (2020-07-27) **Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - # [3.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.6.1...v3.7.0) (2020-07-20) **Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - ## [3.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.6.0...v3.6.1) (2020-07-13) **Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - # [3.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.5.0...v3.6.0) (2020-07-06) **Note:** Version bump only for package @typescript-eslint/visitor-keys - - - - # [3.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.4.0...v3.5.0) (2020-06-29) - ### Features -* split visitor keys into their own package ([#2230](https://github.com/typescript-eslint/typescript-eslint/issues/2230)) ([689dae3](https://github.com/typescript-eslint/typescript-eslint/commit/689dae37392d527c64ae83db2a4c3e6b7fecece7)) +- split visitor keys into their own package ([#2230](https://github.com/typescript-eslint/typescript-eslint/issues/2230)) ([689dae3](https://github.com/typescript-eslint/typescript-eslint/commit/689dae37392d527c64ae83db2a4c3e6b7fecece7)) diff --git a/packages/visitor-keys/LICENSE b/packages/visitor-keys/LICENSE index 7e7370143b2..a1164108d4d 100644 --- a/packages/visitor-keys/LICENSE +++ b/packages/visitor-keys/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2019 TypeScript ESLint and other contributors +Copyright (c) 2019 typescript-eslint and other contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/visitor-keys/README.md b/packages/visitor-keys/README.md index 839c20c4954..1745172a6f2 100644 --- a/packages/visitor-keys/README.md +++ b/packages/visitor-keys/README.md @@ -1,13 +1,10 @@ -

TypeScript-ESTree Visitor Keys

+# `@typescript-eslint/visitor-keys` -

Visitor keys used to help traverse the TypeScript-ESTree AST

+> Visitor keys used to help traverse the TypeScript-ESTree AST. -

- CI - NPM Version - NPM Downloads -

+## ✋ Internal Package -## Contributing +This is an _internal package_ to the [typescript-eslint monorepo](https://github.com/typescript-eslint/typescript-eslint). +You likely don't want to use it directly. -[See the contributing guide here](../../CONTRIBUTING.md) +👉 See **https://typescript-eslint.io** for docs on typescript-eslint. diff --git a/packages/visitor-keys/package.json b/packages/visitor-keys/package.json index 9d4f9024551..57f71eee155 100644 --- a/packages/visitor-keys/package.json +++ b/packages/visitor-keys/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/visitor-keys", - "version": "5.39.0", + "version": "5.46.1", "description": "Visitor keys used to help traverse the TypeScript-ESTree AST", "keywords": [ "eslint", @@ -34,12 +34,12 @@ "clean": "tsc -b tsconfig.build.json --clean", "postclean": "rimraf dist && rimraf _ts3.4 && rimraf coverage", "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", - "lint": "eslint . --ignore-path='../../.eslintignore'", + "lint": "nx lint", "test": "jest --coverage", "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/types": "5.39.0", + "@typescript-eslint/types": "5.46.1", "eslint-visitor-keys": "^3.3.0" }, "devDependencies": { diff --git a/packages/visitor-keys/project.json b/packages/visitor-keys/project.json index e531f19f69d..ab99ec943a6 100644 --- a/packages/visitor-keys/project.json +++ b/packages/visitor-keys/project.json @@ -1,5 +1,15 @@ { - "root": "packages/visitor-keys", + "name": "visitor-keys", + "$schema": "../../node_modules/nx/schemas/project-schema.json", "type": "library", - "implicitDependencies": [] + "implicitDependencies": [], + "targets": { + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["packages/visitor-keys/**/*.ts"] + } + } + } } diff --git a/packages/visitor-keys/src/visitor-keys.ts b/packages/visitor-keys/src/visitor-keys.ts index a1898e92246..80a8b8c9c78 100644 --- a/packages/visitor-keys/src/visitor-keys.ts +++ b/packages/visitor-keys/src/visitor-keys.ts @@ -10,91 +10,197 @@ type GetNodeTypeKeys = Exclude< 'type' | 'loc' | 'range' | 'parent' >; +type KeysDefinedInESLintVisitorKeysCore = + | AST_NODE_TYPES.AssignmentExpression + | AST_NODE_TYPES.AssignmentPattern + | AST_NODE_TYPES.ArrayExpression + | AST_NODE_TYPES.ArrayPattern + | AST_NODE_TYPES.ArrowFunctionExpression + | AST_NODE_TYPES.AwaitExpression + | AST_NODE_TYPES.BlockStatement + | AST_NODE_TYPES.BinaryExpression + | AST_NODE_TYPES.BreakStatement + | AST_NODE_TYPES.CallExpression + | AST_NODE_TYPES.CatchClause + | AST_NODE_TYPES.ChainExpression + | AST_NODE_TYPES.ClassBody + | AST_NODE_TYPES.ClassDeclaration + | AST_NODE_TYPES.ClassExpression + | AST_NODE_TYPES.ConditionalExpression + | AST_NODE_TYPES.ContinueStatement + | AST_NODE_TYPES.DebuggerStatement + | AST_NODE_TYPES.DoWhileStatement + | AST_NODE_TYPES.EmptyStatement + | AST_NODE_TYPES.ExportAllDeclaration + | AST_NODE_TYPES.ExportDefaultDeclaration + | AST_NODE_TYPES.ExportNamedDeclaration + | AST_NODE_TYPES.ExportSpecifier + | AST_NODE_TYPES.ExpressionStatement + // | AST_NODE_TYPES.ExperimentalRestProperty + // | AST_NODE_TYPES.ExperimentalSpreadProperty + | AST_NODE_TYPES.ForStatement + | AST_NODE_TYPES.ForInStatement + | AST_NODE_TYPES.ForOfStatement + | AST_NODE_TYPES.FunctionDeclaration + | AST_NODE_TYPES.FunctionExpression + | AST_NODE_TYPES.Identifier + | AST_NODE_TYPES.IfStatement + | AST_NODE_TYPES.ImportDeclaration + | AST_NODE_TYPES.ImportDefaultSpecifier + | AST_NODE_TYPES.ImportExpression + | AST_NODE_TYPES.ImportNamespaceSpecifier + | AST_NODE_TYPES.ImportSpecifier + | AST_NODE_TYPES.JSXAttribute + | AST_NODE_TYPES.JSXClosingElement + | AST_NODE_TYPES.JSXElement + | AST_NODE_TYPES.JSXEmptyExpression + | AST_NODE_TYPES.JSXExpressionContainer + | AST_NODE_TYPES.JSXIdentifier + | AST_NODE_TYPES.JSXMemberExpression + | AST_NODE_TYPES.JSXNamespacedName + | AST_NODE_TYPES.JSXOpeningElement + | AST_NODE_TYPES.JSXSpreadAttribute + | AST_NODE_TYPES.JSXText + | AST_NODE_TYPES.JSXFragment + | AST_NODE_TYPES.JSXClosingFragment + | AST_NODE_TYPES.JSXOpeningFragment + | AST_NODE_TYPES.Literal + | AST_NODE_TYPES.LabeledStatement + | AST_NODE_TYPES.LogicalExpression + | AST_NODE_TYPES.MemberExpression + | AST_NODE_TYPES.MetaProperty + | AST_NODE_TYPES.MethodDefinition + | AST_NODE_TYPES.NewExpression + | AST_NODE_TYPES.ObjectExpression + | AST_NODE_TYPES.ObjectPattern + | AST_NODE_TYPES.PrivateIdentifier + | AST_NODE_TYPES.Program + | AST_NODE_TYPES.Property + | AST_NODE_TYPES.PropertyDefinition + | AST_NODE_TYPES.RestElement + | AST_NODE_TYPES.ReturnStatement + | AST_NODE_TYPES.SequenceExpression + | AST_NODE_TYPES.SpreadElement + | AST_NODE_TYPES.StaticBlock + | AST_NODE_TYPES.Super + | AST_NODE_TYPES.SwitchStatement + | AST_NODE_TYPES.SwitchCase + | AST_NODE_TYPES.TaggedTemplateExpression + | AST_NODE_TYPES.TemplateElement + | AST_NODE_TYPES.TemplateLiteral + | AST_NODE_TYPES.ThisExpression + | AST_NODE_TYPES.ThrowStatement + | AST_NODE_TYPES.TryStatement + | AST_NODE_TYPES.UnaryExpression + | AST_NODE_TYPES.UpdateExpression + | AST_NODE_TYPES.VariableDeclaration + | AST_NODE_TYPES.VariableDeclarator + | AST_NODE_TYPES.WhileStatement + | AST_NODE_TYPES.WithStatement + | AST_NODE_TYPES.YieldExpression; + // strictly type the arrays of keys provided to make sure we keep this config in sync with the type defs type AdditionalKeys = { - readonly [T in AST_NODE_TYPES]?: readonly GetNodeTypeKeys[]; + readonly // require keys for all nodes NOT defined in `eslint-visitor-keys` + [T in Exclude< + AST_NODE_TYPES, + KeysDefinedInESLintVisitorKeysCore + >]: readonly GetNodeTypeKeys[]; +} & { + readonly // optionally allow keys for all nodes defined in `eslint-visitor-keys` + [T in KeysDefinedInESLintVisitorKeysCore]?: readonly GetNodeTypeKeys[]; }; -const additionalKeys: AdditionalKeys = { - // Stage 3 Import Assertions - ImportAttribute: ['key', 'value'], +/** + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! IMPORTANT NOTE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * + * The key arrays should be sorted in the order in which you would want to visit + * the child keys - don't just sort them alphabetically. + */ + +// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- TODO - add ignore IIFE option +const SharedVisitorKeys = (() => { + const FunctionType = ['typeParameters', 'params', 'returnType'] as const; + const AnonymousFunction = [...FunctionType, 'body'] as const; + const AbstractPropertyDefinition = [ + 'decorators', + 'key', + 'typeAnnotation', + ] as const; + + return { + AnonymousFunction, + Function: ['id', ...AnonymousFunction], + FunctionType, + + ClassDeclaration: [ + 'decorators', + 'id', + 'typeParameters', + 'superClass', + 'superTypeParameters', + 'implements', + 'body', + ], + + AbstractPropertyDefinition: ['decorators', 'key', 'typeAnnotation'], + PropertyDefinition: [...AbstractPropertyDefinition, 'value'], + TypeAssertion: ['expression', 'typeAnnotation'], + } as const; +})(); - // Additional Properties. +const additionalKeys: AdditionalKeys = { + AccessorProperty: SharedVisitorKeys.PropertyDefinition, ArrayPattern: ['decorators', 'elements', 'typeAnnotation'], - ArrowFunctionExpression: ['typeParameters', 'params', 'returnType', 'body'], + ArrowFunctionExpression: SharedVisitorKeys.AnonymousFunction, AssignmentPattern: ['decorators', 'left', 'right', 'typeAnnotation'], CallExpression: ['callee', 'typeParameters', 'arguments'], - ClassDeclaration: [ - 'decorators', - 'id', - 'typeParameters', - 'superClass', - 'superTypeParameters', - 'implements', - 'body', - ], - ClassExpression: [ - 'decorators', - 'id', - 'typeParameters', - 'superClass', - 'superTypeParameters', - 'implements', - 'body', - ], + ClassDeclaration: SharedVisitorKeys.ClassDeclaration, + ClassExpression: SharedVisitorKeys.ClassDeclaration, + Decorator: ['expression'], ExportAllDeclaration: ['exported', 'source', 'assertions'], ExportNamedDeclaration: ['declaration', 'specifiers', 'source', 'assertions'], - FunctionDeclaration: ['id', 'typeParameters', 'params', 'returnType', 'body'], - FunctionExpression: ['id', 'typeParameters', 'params', 'returnType', 'body'], + FunctionDeclaration: SharedVisitorKeys.Function, + FunctionExpression: SharedVisitorKeys.Function, Identifier: ['decorators', 'typeAnnotation'], + ImportAttribute: ['key', 'value'], ImportDeclaration: ['specifiers', 'source', 'assertions'], ImportExpression: ['source', 'attributes'], + JSXClosingFragment: [], + JSXOpeningElement: ['name', 'typeParameters', 'attributes'], + JSXOpeningFragment: [], + JSXSpreadChild: ['expression'], MethodDefinition: ['decorators', 'key', 'value', 'typeParameters'], NewExpression: ['callee', 'typeParameters', 'arguments'], ObjectPattern: ['decorators', 'properties', 'typeAnnotation'], - PropertyDefinition: ['decorators', 'key', 'typeAnnotation', 'value'], + PropertyDefinition: SharedVisitorKeys.PropertyDefinition, RestElement: ['decorators', 'argument', 'typeAnnotation'], - TaggedTemplateExpression: ['tag', 'typeParameters', 'quasi'], StaticBlock: ['body'], - - // JSX - JSXOpeningElement: ['name', 'typeParameters', 'attributes'], - JSXClosingFragment: [], - JSXOpeningFragment: [], - JSXSpreadChild: ['expression'], - - // Additional Nodes. - Decorator: ['expression'], - - // TS-prefixed nodes + TaggedTemplateExpression: ['tag', 'typeParameters', 'quasi'], + TSAbstractAccessorProperty: SharedVisitorKeys.AbstractPropertyDefinition, TSAbstractKeyword: [], TSAbstractMethodDefinition: ['key', 'value'], - TSAbstractPropertyDefinition: ['decorators', 'key', 'typeAnnotation'], + TSAbstractPropertyDefinition: SharedVisitorKeys.AbstractPropertyDefinition, TSAnyKeyword: [], TSArrayType: ['elementType'], - TSAsExpression: ['expression', 'typeAnnotation'], + TSAsExpression: SharedVisitorKeys.TypeAssertion, TSAsyncKeyword: [], TSBigIntKeyword: [], TSBooleanKeyword: [], - TSCallSignatureDeclaration: ['typeParameters', 'params', 'returnType'], + TSCallSignatureDeclaration: SharedVisitorKeys.FunctionType, TSClassImplements: ['expression', 'typeParameters'], TSConditionalType: ['checkType', 'extendsType', 'trueType', 'falseType'], - TSConstructorType: ['typeParameters', 'params', 'returnType'], - TSConstructSignatureDeclaration: ['typeParameters', 'params', 'returnType'], - TSDeclareFunction: ['id', 'typeParameters', 'params', 'returnType', 'body'], + TSConstructorType: SharedVisitorKeys.FunctionType, + TSConstructSignatureDeclaration: SharedVisitorKeys.FunctionType, + TSDeclareFunction: SharedVisitorKeys.Function, TSDeclareKeyword: [], - TSEmptyBodyFunctionExpression: [ - 'id', - 'typeParameters', - 'params', - 'returnType', - ], + TSEmptyBodyFunctionExpression: ['id', ...SharedVisitorKeys.FunctionType], TSEnumDeclaration: ['id', 'members'], TSEnumMember: ['id', 'initializer'], TSExportAssignment: ['expression'], TSExportKeyword: [], TSExternalModuleReference: ['expression'], - TSFunctionType: ['typeParameters', 'params', 'returnType'], + TSFunctionType: SharedVisitorKeys.FunctionType, TSImportEqualsDeclaration: ['id', 'moduleReference'], TSImportType: ['parameter', 'qualifier', 'typeParameters'], TSIndexedAccessType: ['indexType', 'objectType'], @@ -127,6 +233,12 @@ const additionalKeys: AdditionalKeys = { TSQualifiedName: ['left', 'right'], TSReadonlyKeyword: [], TSRestType: ['typeAnnotation'], + TSSatisfiesExpression: [ + // this is intentionally different to SharedVisitorKeys.TypeAssertion because + // the type annotation comes first in the source code + 'typeAnnotation', + 'expression', + ], TSStaticKeyword: [], TSStringKeyword: [], TSSymbolKeyword: [], @@ -135,7 +247,7 @@ const additionalKeys: AdditionalKeys = { TSTupleType: ['elementTypes'], TSTypeAliasDeclaration: ['id', 'typeParameters', 'typeAnnotation'], TSTypeAnnotation: ['typeAnnotation'], - TSTypeAssertion: ['typeAnnotation', 'expression'], + TSTypeAssertion: SharedVisitorKeys.TypeAssertion, TSTypeLiteral: ['members'], TSTypeOperator: ['typeAnnotation'], TSTypeParameter: ['name', 'constraint', 'default'], @@ -148,7 +260,7 @@ const additionalKeys: AdditionalKeys = { TSUnionType: ['types'], TSUnknownKeyword: [], TSVoidKeyword: [], -} as const; +}; const visitorKeys: VisitorKeys = eslintVisitorKeys.unionWith(additionalKeys); diff --git a/packages/website-eslint/CHANGELOG.md b/packages/website-eslint/CHANGELOG.md index c2d069e70a8..1006fd2ea83 100644 --- a/packages/website-eslint/CHANGELOG.md +++ b/packages/website-eslint/CHANGELOG.md @@ -3,428 +3,262 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -# [5.39.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.1...v5.39.0) (2022-10-03) +## [5.46.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.46.0...v5.46.1) (2022-12-12) **Note:** Version bump only for package @typescript-eslint/website-eslint +# [5.46.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.45.1...v5.46.0) (2022-12-08) +**Note:** Version bump only for package @typescript-eslint/website-eslint - - -## [5.38.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.0...v5.38.1) (2022-09-26) +## [5.45.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.45.0...v5.45.1) (2022-12-05) **Note:** Version bump only for package @typescript-eslint/website-eslint +# [5.45.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.44.0...v5.45.0) (2022-11-28) +**Note:** Version bump only for package @typescript-eslint/website-eslint +# [5.44.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.43.0...v5.44.0) (2022-11-21) +**Note:** Version bump only for package @typescript-eslint/website-eslint -# [5.38.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.37.0...v5.38.0) (2022-09-19) +# [5.43.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.1...v5.43.0) (2022-11-14) **Note:** Version bump only for package @typescript-eslint/website-eslint +## [5.42.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.0...v5.42.1) (2022-11-07) +**Note:** Version bump only for package @typescript-eslint/website-eslint +# [5.42.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.41.0...v5.42.0) (2022-10-31) +**Note:** Version bump only for package @typescript-eslint/website-eslint -# [5.37.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.2...v5.37.0) (2022-09-12) +# [5.41.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.1...v5.41.0) (2022-10-24) **Note:** Version bump only for package @typescript-eslint/website-eslint +## [5.40.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.0...v5.40.1) (2022-10-17) +**Note:** Version bump only for package @typescript-eslint/website-eslint +# [5.40.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.39.0...v5.40.0) (2022-10-10) +**Note:** Version bump only for package @typescript-eslint/website-eslint -## [5.36.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.1...v5.36.2) (2022-09-05) +# [5.39.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.1...v5.39.0) (2022-10-03) **Note:** Version bump only for package @typescript-eslint/website-eslint +## [5.38.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.0...v5.38.1) (2022-09-26) +**Note:** Version bump only for package @typescript-eslint/website-eslint +# [5.38.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.37.0...v5.38.0) (2022-09-19) +**Note:** Version bump only for package @typescript-eslint/website-eslint -## [5.36.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.0...v5.36.1) (2022-08-30) +# [5.37.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.2...v5.37.0) (2022-09-12) **Note:** Version bump only for package @typescript-eslint/website-eslint +## [5.36.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.1...v5.36.2) (2022-09-05) +**Note:** Version bump only for package @typescript-eslint/website-eslint +## [5.36.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.0...v5.36.1) (2022-08-30) +**Note:** Version bump only for package @typescript-eslint/website-eslint # [5.36.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.1...v5.36.0) (2022-08-30) **Note:** Version bump only for package @typescript-eslint/website-eslint - - - - ## [5.35.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.0...v5.35.1) (2022-08-24) **Note:** Version bump only for package @typescript-eslint/website-eslint - - - - # [5.35.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.34.0...v5.35.0) (2022-08-24) **Note:** Version bump only for package @typescript-eslint/website-eslint - - - - # [5.34.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.1...v5.34.0) (2022-08-22) **Note:** Version bump only for package @typescript-eslint/website-eslint - - - - ## [5.33.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.0...v5.33.1) (2022-08-15) **Note:** Version bump only for package @typescript-eslint/website-eslint - - - - # [5.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.32.0...v5.33.0) (2022-08-08) **Note:** Version bump only for package @typescript-eslint/website-eslint - - - - # [5.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.31.0...v5.32.0) (2022-08-01) **Note:** Version bump only for package @typescript-eslint/website-eslint - - - - # [5.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.7...v5.31.0) (2022-07-25) **Note:** Version bump only for package @typescript-eslint/website-eslint - - - - ## [5.30.7](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.6...v5.30.7) (2022-07-18) **Note:** Version bump only for package @typescript-eslint/website-eslint - - - - ## [5.30.6](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.5...v5.30.6) (2022-07-11) **Note:** Version bump only for package @typescript-eslint/website-eslint - - - - ## [5.30.5](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.4...v5.30.5) (2022-07-04) **Note:** Version bump only for package @typescript-eslint/website-eslint - - - - ## [5.30.4](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.3...v5.30.4) (2022-07-03) **Note:** Version bump only for package @typescript-eslint/website-eslint - - - - ## [5.30.3](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.2...v5.30.3) (2022-07-01) **Note:** Version bump only for package @typescript-eslint/website-eslint - - - - ## [5.30.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.1...v5.30.2) (2022-07-01) **Note:** Version bump only for package @typescript-eslint/website-eslint - - - - ## 5.30.1 (2022-07-01) **Note:** Version bump only for package @typescript-eslint/website-eslint - - - - # [5.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.29.0...v5.30.0) (2022-06-27) **Note:** Version bump only for package @typescript-eslint/website-eslint - - - - # [5.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.28.0...v5.29.0) (2022-06-20) **Note:** Version bump only for package @typescript-eslint/website-eslint - - - - # [5.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.1...v5.28.0) (2022-06-13) **Note:** Version bump only for package @typescript-eslint/website-eslint - - - - ## [5.27.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.0...v5.27.1) (2022-06-06) **Note:** Version bump only for package @typescript-eslint/website-eslint - - - - # [5.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.26.0...v5.27.0) (2022-05-30) - ### Features -* [4.7] support new extensions ([#5027](https://github.com/typescript-eslint/typescript-eslint/issues/5027)) ([efc147b](https://github.com/typescript-eslint/typescript-eslint/commit/efc147b04dce52ab17415b6a4ae4076b944b9036)) - - - - +- [4.7] support new extensions ([#5027](https://github.com/typescript-eslint/typescript-eslint/issues/5027)) ([efc147b](https://github.com/typescript-eslint/typescript-eslint/commit/efc147b04dce52ab17415b6a4ae4076b944b9036)) # [5.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.25.0...v5.26.0) (2022-05-23) **Note:** Version bump only for package @typescript-eslint/website-eslint - - - - # [5.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.24.0...v5.25.0) (2022-05-17) **Note:** Version bump only for package @typescript-eslint/website-eslint - - - - # [5.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.23.0...v5.24.0) (2022-05-16) **Note:** Version bump only for package @typescript-eslint/website-eslint - - - - # [5.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.22.0...v5.23.0) (2022-05-09) **Note:** Version bump only for package @typescript-eslint/website-eslint - - - - # [5.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.21.0...v5.22.0) (2022-05-02) **Note:** Version bump only for package @typescript-eslint/website-eslint - - - - # [5.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.20.0...v5.21.0) (2022-04-25) **Note:** Version bump only for package @typescript-eslint/website-eslint - - - - # [5.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.19.0...v5.20.0) (2022-04-18) **Note:** Version bump only for package @typescript-eslint/website-eslint - - - - # [5.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.18.0...v5.19.0) (2022-04-11) **Note:** Version bump only for package @typescript-eslint/website-eslint - - - - # [5.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.17.0...v5.18.0) (2022-04-04) **Note:** Version bump only for package @typescript-eslint/website-eslint - - - - # [5.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.16.0...v5.17.0) (2022-03-28) **Note:** Version bump only for package @typescript-eslint/website-eslint - - - - # [5.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.15.0...v5.16.0) (2022-03-21) **Note:** Version bump only for package @typescript-eslint/website-eslint - - - - # [5.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.14.0...v5.15.0) (2022-03-14) **Note:** Version bump only for package @typescript-eslint/website-eslint - - - - # [5.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.13.0...v5.14.0) (2022-03-07) **Note:** Version bump only for package @typescript-eslint/website-eslint - - - - # [5.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.1...v5.13.0) (2022-02-28) **Note:** Version bump only for package @typescript-eslint/website-eslint - - - - ## [5.12.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.0...v5.12.1) (2022-02-21) **Note:** Version bump only for package @typescript-eslint/website-eslint - - - - # [5.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.11.0...v5.12.0) (2022-02-14) **Note:** Version bump only for package @typescript-eslint/website-eslint - - - - # [5.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.2...v5.11.0) (2022-02-07) **Note:** Version bump only for package @typescript-eslint/website-eslint - - - - ## [5.10.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.1...v5.10.2) (2022-01-31) **Note:** Version bump only for package @typescript-eslint/website-eslint - - - - ## [5.10.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.0...v5.10.1) (2022-01-24) **Note:** Version bump only for package @typescript-eslint/website-eslint - - - - # [5.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.1...v5.10.0) (2022-01-17) - ### Features -* rename `experimental-utils` to `utils` and make `experimental-utils` an alias to the new package ([#4172](https://github.com/typescript-eslint/typescript-eslint/issues/4172)) ([1d55a75](https://github.com/typescript-eslint/typescript-eslint/commit/1d55a7511b38d8e2b2eabe59f639e0a865e6c93f)) - - - - +- rename `experimental-utils` to `utils` and make `experimental-utils` an alias to the new package ([#4172](https://github.com/typescript-eslint/typescript-eslint/issues/4172)) ([1d55a75](https://github.com/typescript-eslint/typescript-eslint/commit/1d55a7511b38d8e2b2eabe59f639e0a865e6c93f)) ## [5.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.0...v5.9.1) (2022-01-10) **Note:** Version bump only for package @typescript-eslint/website-eslint - - - - # [5.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.1...v5.9.0) (2022-01-03) **Note:** Version bump only for package @typescript-eslint/website-eslint - - - - ## [5.8.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.0...v5.8.1) (2021-12-27) **Note:** Version bump only for package @typescript-eslint/website-eslint - - - - # [5.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.7.0...v5.8.0) (2021-12-20) **Note:** Version bump only for package @typescript-eslint/website-eslint - - - - # [5.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.6.0...v5.7.0) (2021-12-13) **Note:** Version bump only for package @typescript-eslint/website-eslint - - - - # [5.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.5.0...v5.6.0) (2021-12-06) **Note:** Version bump only for package @typescript-eslint/website-eslint - - - - # [5.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.4.0...v5.5.0) (2021-11-29) **Note:** Version bump only for package @typescript-eslint/website-eslint diff --git a/packages/website-eslint/package.json b/packages/website-eslint/package.json index 7d4d0a520f3..b95f1231027 100644 --- a/packages/website-eslint/package.json +++ b/packages/website-eslint/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/website-eslint", - "version": "5.39.0", + "version": "5.46.1", "private": true, "description": "ESLint which works in browsers.", "engines": { @@ -16,19 +16,19 @@ "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore" }, "dependencies": { - "@typescript-eslint/types": "5.39.0", - "@typescript-eslint/utils": "5.39.0" + "@typescript-eslint/types": "5.46.1", + "@typescript-eslint/utils": "5.46.1" }, "devDependencies": { - "@rollup/plugin-commonjs": "^22.0.0", - "@rollup/plugin-json": "^4.1.0", - "@rollup/plugin-node-resolve": "^14.1.0", - "@rollup/pluginutils": "^4.2.1", - "@typescript-eslint/eslint-plugin": "5.39.0", - "@typescript-eslint/parser": "5.39.0", - "@typescript-eslint/scope-manager": "5.39.0", - "@typescript-eslint/typescript-estree": "5.39.0", - "@typescript-eslint/visitor-keys": "5.39.0", + "@rollup/plugin-commonjs": "^23.0.0", + "@rollup/plugin-json": "^5.0.0", + "@rollup/plugin-node-resolve": "^15.0.0", + "@rollup/pluginutils": "^5.0.0", + "@typescript-eslint/eslint-plugin": "5.46.1", + "@typescript-eslint/parser": "5.46.1", + "@typescript-eslint/scope-manager": "5.46.1", + "@typescript-eslint/typescript-estree": "5.46.1", + "@typescript-eslint/visitor-keys": "5.46.1", "eslint": "*", "rollup": "^2.75.4", "rollup-plugin-terser": "^7.0.2", diff --git a/packages/website-eslint/project.json b/packages/website-eslint/project.json index ac6ff89fcb8..517439cbec3 100644 --- a/packages/website-eslint/project.json +++ b/packages/website-eslint/project.json @@ -1,5 +1,6 @@ { - "root": "packages/website-eslint", + "$schema": "../../node_modules/nx/schemas/project-schema.json", "type": "library", - "implicitDependencies": [] + "implicitDependencies": [], + "name": "website-eslint" } diff --git a/packages/website-eslint/rollup.config.js b/packages/website-eslint/rollup.config.js index bc9143b27db..825b60cec25 100644 --- a/packages/website-eslint/rollup.config.js +++ b/packages/website-eslint/rollup.config.js @@ -27,10 +27,10 @@ module.exports = { match: [ /eslint\/lib\/(rule-tester|eslint|cli-engine|init)\//u, /eslint\/lib\/cli\.js$/, - /utils\/dist\/eslint-utils\/RuleTester\.js$/, + /utils\/dist\/eslint-utils\/rule-tester\/RuleTester\.js$/, /utils\/dist\/ts-eslint\/CLIEngine\.js$/, /utils\/dist\/ts-eslint\/RuleTester\.js$/, - /typescript-estree\/dist\/create-program\/createWatchProgram\.js/, + /typescript-estree\/dist\/create-program\/getWatchProgramsForProjects\.js/, /typescript-estree\/dist\/create-program\/createProjectProgram\.js/, /typescript-estree\/dist\/create-program\/createIsolatedProgram\.js/, /utils\/dist\/ts-eslint\/ESLint\.js/, diff --git a/packages/website/.eslintrc.js b/packages/website/.eslintrc.js index 0b55f475b33..323ce34a38d 100644 --- a/packages/website/.eslintrc.js +++ b/packages/website/.eslintrc.js @@ -9,6 +9,7 @@ module.exports = { overrides: [ { files: [ + './*.config.*', './src/pages/*.tsx', './src/components/**/*.tsx', './src/components/hooks/*.ts', @@ -22,6 +23,7 @@ module.exports = { 'react/jsx-no-target-blank': 'off', 'react/no-unescaped-entities': 'off', '@typescript-eslint/internal/prefer-ast-types-enum': 'off', + 'react/jsx-curly-brace-presence': 'error', }, settings: { react: { diff --git a/packages/website/CHANGELOG.md b/packages/website/CHANGELOG.md index b46e5caeb19..b0a49ca4a19 100644 --- a/packages/website/CHANGELOG.md +++ b/packages/website/CHANGELOG.md @@ -3,479 +3,307 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -# [5.39.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.1...v5.39.0) (2022-10-03) +## [5.46.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.46.0...v5.46.1) (2022-12-12) **Note:** Version bump only for package website - - - - -## [5.38.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.0...v5.38.1) (2022-09-26) +# [5.46.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.45.1...v5.46.0) (2022-12-08) **Note:** Version bump only for package website +## [5.45.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.45.0...v5.45.1) (2022-12-05) +**Note:** Version bump only for package website +# [5.45.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.44.0...v5.45.0) (2022-11-28) +**Note:** Version bump only for package website -# [5.38.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.37.0...v5.38.0) (2022-09-19) - - -### Features - -* **website:** add warning on top of formatting rule docs pages ([#5598](https://github.com/typescript-eslint/typescript-eslint/issues/5598)) ([5dfa2e9](https://github.com/typescript-eslint/typescript-eslint/commit/5dfa2e9a33491905e99d8940dbdac0b31ada4858)) +# [5.44.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.43.0...v5.44.0) (2022-11-21) +**Note:** Version bump only for package website +# [5.43.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.1...v5.43.0) (2022-11-14) +**Note:** Version bump only for package website +## [5.42.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.0...v5.42.1) (2022-11-07) -# [5.37.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.2...v5.37.0) (2022-09-12) +**Note:** Version bump only for package website +# [5.42.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.41.0...v5.42.0) (2022-10-31) ### Bug Fixes -* **website:** Use extended base rule name from file's meta ([#5621](https://github.com/typescript-eslint/typescript-eslint/issues/5621)) ([7fd2f89](https://github.com/typescript-eslint/typescript-eslint/commit/7fd2f89ae732ca12ec83fad278362032473ff3ca)) - +- **eslint-plugin:** enable react/jsx-curly-brace-presence lint rule in website package ([#5894](https://github.com/typescript-eslint/typescript-eslint/issues/5894)) ([344322a](https://github.com/typescript-eslint/typescript-eslint/commit/344322add846d03c6c9981e486b09e6ba1196555)) ### Features -* **docs:** always expanding collapsible sidebar menus under docs ([#5608](https://github.com/typescript-eslint/typescript-eslint/issues/5608)) ([8176fb1](https://github.com/typescript-eslint/typescript-eslint/commit/8176fb15299943cbf20385eb0ea7ba877e193285)) +- **scope-manager:** ignore ECMA version ([#5881](https://github.com/typescript-eslint/typescript-eslint/issues/5881)) ([3b8d449](https://github.com/typescript-eslint/typescript-eslint/commit/3b8d449696c319690536a18a48ef32749dc2f559)) +- **website:** Add a happy message to playground output pane when no errors or AST ([#5868](https://github.com/typescript-eslint/typescript-eslint/issues/5868)) ([#5873](https://github.com/typescript-eslint/typescript-eslint/issues/5873)) ([c4e0d86](https://github.com/typescript-eslint/typescript-eslint/commit/c4e0d8678e0398f3ab85510f40ad6f97832b9e6d)) +### Reverts +- Revert "feat(scope-manager): ignore ECMA version" (#5888) ([2ee81df](https://github.com/typescript-eslint/typescript-eslint/commit/2ee81df5a365d82ef4b3dfc124d4ec39c7bcb725)), closes [#5888](https://github.com/typescript-eslint/typescript-eslint/issues/5888) [#5881](https://github.com/typescript-eslint/typescript-eslint/issues/5881) +# [5.41.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.1...v5.41.0) (2022-10-24) +**Note:** Version bump only for package website -## [5.36.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.1...v5.36.2) (2022-09-05) +## [5.40.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.0...v5.40.1) (2022-10-17) **Note:** Version bump only for package website +# [5.40.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.39.0...v5.40.0) (2022-10-10) +### Features +- **website:** store options TypeScript, Enable jsx and AST Viewer in browser's local storage ([#5769](https://github.com/typescript-eslint/typescript-eslint/issues/5769)) ([77d2336](https://github.com/typescript-eslint/typescript-eslint/commit/77d2336594ca10b47c0f7978ae64f87d24a25d33)) - -## [5.36.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.0...v5.36.1) (2022-08-30) +# [5.39.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.1...v5.39.0) (2022-10-03) **Note:** Version bump only for package website +## [5.38.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.0...v5.38.1) (2022-09-26) +**Note:** Version bump only for package website +# [5.38.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.37.0...v5.38.0) (2022-09-19) +### Features -# [5.36.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.1...v5.36.0) (2022-08-30) +- **website:** add warning on top of formatting rule docs pages ([#5598](https://github.com/typescript-eslint/typescript-eslint/issues/5598)) ([5dfa2e9](https://github.com/typescript-eslint/typescript-eslint/commit/5dfa2e9a33491905e99d8940dbdac0b31ada4858)) +# [5.37.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.2...v5.37.0) (2022-09-12) -### Features +### Bug Fixes -* support TypeScript 4.8 ([#5551](https://github.com/typescript-eslint/typescript-eslint/issues/5551)) ([81450ed](https://github.com/typescript-eslint/typescript-eslint/commit/81450ed7eaede74b384e9a91a84e9b4d34513866)) +- **website:** Use extended base rule name from file's meta ([#5621](https://github.com/typescript-eslint/typescript-eslint/issues/5621)) ([7fd2f89](https://github.com/typescript-eslint/typescript-eslint/commit/7fd2f89ae732ca12ec83fad278362032473ff3ca)) +### Features +- **docs:** always expanding collapsible sidebar menus under docs ([#5608](https://github.com/typescript-eslint/typescript-eslint/issues/5608)) ([8176fb1](https://github.com/typescript-eslint/typescript-eslint/commit/8176fb15299943cbf20385eb0ea7ba877e193285)) +## [5.36.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.1...v5.36.2) (2022-09-05) +**Note:** Version bump only for package website -## [5.35.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.0...v5.35.1) (2022-08-24) +## [5.36.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.0...v5.36.1) (2022-08-30) +**Note:** Version bump only for package website -### Bug Fixes +# [5.36.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.1...v5.36.0) (2022-08-30) -* **eslint-plugin:** correct rule schemas to pass ajv validation ([#5531](https://github.com/typescript-eslint/typescript-eslint/issues/5531)) ([dbf8b56](https://github.com/typescript-eslint/typescript-eslint/commit/dbf8b569dbada29e4a295d6c265976e55de1b2aa)) +### Features +- support TypeScript 4.8 ([#5551](https://github.com/typescript-eslint/typescript-eslint/issues/5551)) ([81450ed](https://github.com/typescript-eslint/typescript-eslint/commit/81450ed7eaede74b384e9a91a84e9b4d34513866)) +## [5.35.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.0...v5.35.1) (2022-08-24) +### Bug Fixes +- **eslint-plugin:** correct rule schemas to pass ajv validation ([#5531](https://github.com/typescript-eslint/typescript-eslint/issues/5531)) ([dbf8b56](https://github.com/typescript-eslint/typescript-eslint/commit/dbf8b569dbada29e4a295d6c265976e55de1b2aa)) # [5.35.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.34.0...v5.35.0) (2022-08-24) **Note:** Version bump only for package website - - - - # [5.34.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.1...v5.34.0) (2022-08-22) - ### Features -* **eslint-plugin:** [prefer-optional-chain] support suggesting `!foo || !foo.bar` as a valid match for the rule ([#5266](https://github.com/typescript-eslint/typescript-eslint/issues/5266)) ([aca935c](https://github.com/typescript-eslint/typescript-eslint/commit/aca935c9696712d4aff18144c4690db4d6ba9bf9)) - - - - +- **eslint-plugin:** [prefer-optional-chain] support suggesting `!foo || !foo.bar` as a valid match for the rule ([#5266](https://github.com/typescript-eslint/typescript-eslint/issues/5266)) ([aca935c](https://github.com/typescript-eslint/typescript-eslint/commit/aca935c9696712d4aff18144c4690db4d6ba9bf9)) ## [5.33.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.0...v5.33.1) (2022-08-15) **Note:** Version bump only for package website - - - - # [5.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.32.0...v5.33.0) (2022-08-08) **Note:** Version bump only for package website - - - - # [5.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.31.0...v5.32.0) (2022-08-01) **Note:** Version bump only for package website - - - - # [5.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.7...v5.31.0) (2022-07-25) **Note:** Version bump only for package website - - - - ## [5.30.7](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.6...v5.30.7) (2022-07-18) **Note:** Version bump only for package website - - - - ## [5.30.6](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.5...v5.30.6) (2022-07-11) **Note:** Version bump only for package website - - - - ## [5.30.5](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.4...v5.30.5) (2022-07-04) **Note:** Version bump only for package website - - - - ## [5.30.4](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.3...v5.30.4) (2022-07-03) **Note:** Version bump only for package website - - - - ## [5.30.3](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.2...v5.30.3) (2022-07-01) **Note:** Version bump only for package website - - - - ## [5.30.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.1...v5.30.2) (2022-07-01) **Note:** Version bump only for package website - - - - ## 5.30.1 (2022-07-01) **Note:** Version bump only for package website - - - - # [5.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.29.0...v5.30.0) (2022-06-27) **Note:** Version bump only for package website - - - - # [5.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.28.0...v5.29.0) (2022-06-20) - ### Features -* **website:** open issue with rule name if only one rule is enabled ([#5190](https://github.com/typescript-eslint/typescript-eslint/issues/5190)) ([b229ee4](https://github.com/typescript-eslint/typescript-eslint/commit/b229ee4ace1417d2d4f7d6cafa039f073e845c3a)) - - - - +- **website:** open issue with rule name if only one rule is enabled ([#5190](https://github.com/typescript-eslint/typescript-eslint/issues/5190)) ([b229ee4](https://github.com/typescript-eslint/typescript-eslint/commit/b229ee4ace1417d2d4f7d6cafa039f073e845c3a)) # [5.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.1...v5.28.0) (2022-06-13) **Note:** Version bump only for package website - - - - ## [5.27.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.0...v5.27.1) (2022-06-06) **Note:** Version bump only for package website - - - - # [5.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.26.0...v5.27.0) (2022-05-30) - ### Features -* [4.7] support new extensions ([#5027](https://github.com/typescript-eslint/typescript-eslint/issues/5027)) ([efc147b](https://github.com/typescript-eslint/typescript-eslint/commit/efc147b04dce52ab17415b6a4ae4076b944b9036)) - - - - +- [4.7] support new extensions ([#5027](https://github.com/typescript-eslint/typescript-eslint/issues/5027)) ([efc147b](https://github.com/typescript-eslint/typescript-eslint/commit/efc147b04dce52ab17415b6a4ae4076b944b9036)) # [5.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.25.0...v5.26.0) (2022-05-23) **Note:** Version bump only for package website - - - - # [5.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.24.0...v5.25.0) (2022-05-17) **Note:** Version bump only for package website - - - - # [5.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.23.0...v5.24.0) (2022-05-16) - ### Features -* **eslint-plugin:** add new 'strict' config ([#4706](https://github.com/typescript-eslint/typescript-eslint/issues/4706)) ([4a500b2](https://github.com/typescript-eslint/typescript-eslint/commit/4a500b2d92a91873dbb729793d1ee1c36ef06ed8)) - - - - +- **eslint-plugin:** add new 'strict' config ([#4706](https://github.com/typescript-eslint/typescript-eslint/issues/4706)) ([4a500b2](https://github.com/typescript-eslint/typescript-eslint/commit/4a500b2d92a91873dbb729793d1ee1c36ef06ed8)) # [5.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.22.0...v5.23.0) (2022-05-09) **Note:** Version bump only for package website - - - - # [5.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.21.0...v5.22.0) (2022-05-02) **Note:** Version bump only for package website - - - - # [5.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.20.0...v5.21.0) (2022-04-25) **Note:** Version bump only for package website - - - - # [5.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.19.0...v5.20.0) (2022-04-18) **Note:** Version bump only for package website - - - - # [5.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.18.0...v5.19.0) (2022-04-11) **Note:** Version bump only for package website - - - - # [5.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.17.0...v5.18.0) (2022-04-04) **Note:** Version bump only for package website - - - - # [5.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.16.0...v5.17.0) (2022-03-28) - ### Bug Fixes -* code container hiding navigation menu ([#4707](https://github.com/typescript-eslint/typescript-eslint/issues/4707)) ([96bc69a](https://github.com/typescript-eslint/typescript-eslint/commit/96bc69a652c7f6f474a39f1e9783e7fbd446696a)) -* revert "chore: Bump cypress from 8.3.0 to 9.5.2", and ignore cypress for now ([#4740](https://github.com/typescript-eslint/typescript-eslint/issues/4740)) ([cf5f5c4](https://github.com/typescript-eslint/typescript-eslint/commit/cf5f5c441ab0c4fb056bd688795ffc55e026627a)), closes [#4710](https://github.com/typescript-eslint/typescript-eslint/issues/4710) - - - - +- code container hiding navigation menu ([#4707](https://github.com/typescript-eslint/typescript-eslint/issues/4707)) ([96bc69a](https://github.com/typescript-eslint/typescript-eslint/commit/96bc69a652c7f6f474a39f1e9783e7fbd446696a)) +- revert "chore: Bump cypress from 8.3.0 to 9.5.2", and ignore cypress for now ([#4740](https://github.com/typescript-eslint/typescript-eslint/issues/4740)) ([cf5f5c4](https://github.com/typescript-eslint/typescript-eslint/commit/cf5f5c441ab0c4fb056bd688795ffc55e026627a)), closes [#4710](https://github.com/typescript-eslint/typescript-eslint/issues/4710) # [5.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.15.0...v5.16.0) (2022-03-21) **Note:** Version bump only for package website - - - - # [5.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.14.0...v5.15.0) (2022-03-14) **Note:** Version bump only for package website - - - - # [5.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.13.0...v5.14.0) (2022-03-07) **Note:** Version bump only for package website - - - - # [5.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.1...v5.13.0) (2022-02-28) - ### Features -* **eslint-plugin:** [no-misused-promises] check more places for checksVoidReturn ([#4541](https://github.com/typescript-eslint/typescript-eslint/issues/4541)) ([052cf51](https://github.com/typescript-eslint/typescript-eslint/commit/052cf51fe663283afe89dc7bf97c947e750df095)) - - - - +- **eslint-plugin:** [no-misused-promises] check more places for checksVoidReturn ([#4541](https://github.com/typescript-eslint/typescript-eslint/issues/4541)) ([052cf51](https://github.com/typescript-eslint/typescript-eslint/commit/052cf51fe663283afe89dc7bf97c947e750df095)) ## [5.12.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.0...v5.12.1) (2022-02-21) **Note:** Version bump only for package website - - - - # [5.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.11.0...v5.12.0) (2022-02-14) **Note:** Version bump only for package website - - - - # [5.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.2...v5.11.0) (2022-02-07) **Note:** Version bump only for package website - - - - ## [5.10.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.1...v5.10.2) (2022-01-31) **Note:** Version bump only for package website - - - - ## [5.10.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.0...v5.10.1) (2022-01-24) **Note:** Version bump only for package website - - - - # [5.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.1...v5.10.0) (2022-01-17) **Note:** Version bump only for package website - - - - ## [5.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.0...v5.9.1) (2022-01-10) **Note:** Version bump only for package website - - - - # [5.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.1...v5.9.0) (2022-01-03) **Note:** Version bump only for package website - - - - ## [5.8.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.0...v5.8.1) (2021-12-27) **Note:** Version bump only for package website - - - - # [5.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.7.0...v5.8.0) (2021-12-20) **Note:** Version bump only for package website - - - - # [5.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.6.0...v5.7.0) (2021-12-13) **Note:** Version bump only for package website - - - - # [5.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.5.0...v5.6.0) (2021-12-06) - ### Features -* **scope-manager:** support TS4.5 import/export specifier kind ([#4234](https://github.com/typescript-eslint/typescript-eslint/issues/4234)) ([833f822](https://github.com/typescript-eslint/typescript-eslint/commit/833f8221ce00aecb7d08c519bab9568353850f48)) - - - - +- **scope-manager:** support TS4.5 import/export specifier kind ([#4234](https://github.com/typescript-eslint/typescript-eslint/issues/4234)) ([833f822](https://github.com/typescript-eslint/typescript-eslint/commit/833f8221ce00aecb7d08c519bab9568353850f48)) # [5.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.4.0...v5.5.0) (2021-11-29) **Note:** Version bump only for package website - - - - # [5.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.3.1...v5.4.0) (2021-11-15) - ### Bug Fixes -* landing page title duplication ([#4123](https://github.com/typescript-eslint/typescript-eslint/issues/4123)) ([844c25e](https://github.com/typescript-eslint/typescript-eslint/commit/844c25e7b6ef9d79aec99d538252e82557f012d3)) - - - - +- landing page title duplication ([#4123](https://github.com/typescript-eslint/typescript-eslint/issues/4123)) ([844c25e](https://github.com/typescript-eslint/typescript-eslint/commit/844c25e7b6ef9d79aec99d538252e82557f012d3)) ## [5.3.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.3.0...v5.3.1) (2021-11-08) diff --git a/packages/website/README.md b/packages/website/README.md index fd7bb57cb42..7f4c12e2372 100644 --- a/packages/website/README.md +++ b/packages/website/README.md @@ -1,5 +1,7 @@ # Website +[![Netlify Status](https://api.netlify.com/api/v1/badges/128d21c7-b2fe-45ad-b141-9878fcf5de3a/deploy-status)](https://app.netlify.com/sites/typescript-eslint/deploys) + This website is built using [Docusaurus 2](https://v2.docusaurus.io/), a modern static website generator. ## Installation @@ -26,4 +28,11 @@ This command generates static content into the `build` directory and can be serv ## Deployment -The website is deployed automatically using Netlify. Each pull request into the `main` branch will have a unique preview deployment generated for it. +### Production + +The website is deployed from the `website` branch automatically using Netlify. +That branch gets updated from the `main` branch whenever a new stable version is released (generally weekly). + +### Pull Requests + +Each pull request into the `main` branch will have a unique preview deployment generated for it. diff --git a/packages/website/blog/2022-09-18-automated-rule-docs-with-docusaurus-and-remark.md b/packages/website/blog/2022-09-18-automated-rule-docs-with-docusaurus-and-remark.md index 58dd129cddf..a1c5d205a02 100644 --- a/packages/website/blog/2022-09-18-automated-rule-docs-with-docusaurus-and-remark.md +++ b/packages/website/blog/2022-09-18-automated-rule-docs-with-docusaurus-and-remark.md @@ -2,15 +2,15 @@ authors: - image_url: https://www.joshuakgoldberg.com/img/josh.jpg name: Josh Goldberg - title: TypeScript ESLint Maintainer + title: typescript-eslint Maintainer url: https://github.com/JoshuaKGoldberg -description: How TypeScript ESLint generates much of the docs pages for each of its lint rules. +description: How typescript-eslint generates much of the docs pages for each of its lint rules. slug: automated-rule-docs-with-docusaurus-and-remark tags: [documentation, docusaurus, remark] title: Automated Rule Docs With Docusaurus and Remark --- -The TypeScript ESLint website at https://typescript-eslint.io is the canonical location for documentation on how to use ESLint on TypeScript code. +The typescript-eslint website at https://typescript-eslint.io is the canonical location for documentation on how to use ESLint on TypeScript code. The site includes a documentation page for each of the over 100 ESLint rules exposed by its ESLint plugin. Each of those rule docs pages includes a description of the rule, any options it allows, links to its source code, and other important information about its usage. @@ -87,7 +87,7 @@ The [`@typescript-eslint/no-for-in-array` rule](https://typescript-eslint.io/rul Our Remark plugin: 1. Takes in the AST and metadata of a documentation file -2. Tries to find the corresponding TypeScript ESLint rule for the file's name +2. Tries to find the corresponding typescript-eslint rule for the file's name 3. If one was found, applies a set of modifications to the AST The rest of this section of the blog post will give a high-level overview of what kinds of AST modifications take place. @@ -95,7 +95,7 @@ You can dive into [the source code of our plugin](https://github.com/typescript- ### Matching Docs to Rules -The [`@typescript-eslint/eslint-plugin` package](https://www.npmjs.com/package/@typescript-eslint/eslint-plugin) exports an object with a `rules` property containing all the TypeScript ESLint lint rules. +The [`@typescript-eslint/eslint-plugin` package](https://www.npmjs.com/package/@typescript-eslint/eslint-plugin) exports an object with a `rules` property containing all the typescript-eslint lint rules. Properties have names like `"array-type"` that map to the rule object exported by files like [`array-type.ts`](https://github.com/typescript-eslint/typescript-eslint/blob/39829c01906f326fec94e9b3a5fdb1730eb02002/packages/eslint-plugin/src/rules/array-type.ts#L86). Remark plugins are able to access the name of the file they're modifying by accessing `file.stem`, as in the following code snippet. @@ -144,7 +144,7 @@ root.children.splice( ``` :::info Historical context -Before typescript-eslint.io existed, the canonical documentation URL for TypeScript ESLint's lint rules was the GitHub link to their corresponding `.md` file. +Before typescript-eslint.io existed, the canonical documentation URL for typescript-eslint's lint rules was the GitHub link to their corresponding `.md` file. Now that we have a rich documentation site and have automated much of what used to be in those `.md` files, they're no longer a good place to look for documentation. ::: @@ -221,8 +221,8 @@ We'd like to extend thanks to [Joshua Chen](https://github.com/Josh-Cena), one o Without Joshua, this change would have taken us a great deal longer (if we'd have been able to tackle it at all). Thanks Joshua! 🤗 -## Supporting TypeScript ESLint +## Supporting typescript-eslint -If you enjoyed this blog post and/or or use TypeScript ESLint, please consider [supporting us on Open Collective](https://opencollective.com/typescript-eslint). +If you enjoyed this blog post and/or or use typescript-eslint, please consider [supporting us on Open Collective](https://opencollective.com/typescript-eslint). We're a small volunteer team and could use your support to make the ESLint experience on TypeScript great. Thanks! 💖 diff --git a/packages/website/blog/2022-12-05-asts-and-typescript-eslint.md b/packages/website/blog/2022-12-05-asts-and-typescript-eslint.md new file mode 100644 index 00000000000..47cb9374c90 --- /dev/null +++ b/packages/website/blog/2022-12-05-asts-and-typescript-eslint.md @@ -0,0 +1,124 @@ +--- +authors: + - image_url: https://www.joshuakgoldberg.com/img/josh.jpg + name: Josh Goldberg + title: typescript-eslint Maintainer + url: https://github.com/JoshuaKGoldberg +description: Describing what an AST (Abstract Syntax Tree) is and why it's useful for ESLint and TypeScript tooling. +slug: asts-and-typescript-eslint +tags: [ast, abstract syntax tree, parser, parsing, prettier] +title: ASTs and typescript-eslint +--- + +Programmers who work with tools like [ESLint](https://eslint.org) and [Prettier](https://prettier.io) often refer to ASTs. +But what is an AST, why is it useful for these kinds of tools, and how does that interact with ESLint and TypeScript tooling? +Let's dig in! + +## What's an AST? + +_Static analysis_ tools are those that look at code without running it. +They typically _parse_ code, or transform it from a string into a standard format they can reason about known as an **Abstract Syntax Tree** (AST). +ASTs are called such because although they might contain information on the location of constructs within source code, they are an abstract representation that cares more about the semantic structure. + +> In other words, an AST is a description of your code's syntax. + +### An Example AST + +Take this single line of code: + +```js +1 + 2; +``` + +ESLint's AST format, **[ESTree]**, would describe that line of code as an object like: + +```json +{ + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "left": { + "type": "Literal", + "value": 1, + "raw": "1" + }, + "operator": "+", + "right": { + "type": "Literal", + "value": 2, + "raw": "2" + } + } +} +``` + +Each piece of code described within an AST description is referred to as a **node**, or AST node. +Each node is given a **node type** indicating the type of code syntax it represents +That code snippet includes four nodes of the following types: + +- _ExpressionStatement_: `1 + 2;` +- _BinaryExpression_: `1 + 2` +- _Literal_: `1` +- _Literal_: `2` + +That ESTree object representation of the code is what static analysis tools such as [ESLint](https://eslint.org) and [Prettier](https://prettier.io) work with. + +## AST Formats + +ESTree is more broadly used than just for ESLint -- it is a popular community standard. +ESLint's built-in parser that outputs an ESTree-shaped AST is also a separate package, called **[Espree]**. + +TypeScript has its own separate AST format, often referred to as the TypeScript AST. +Because TypeScript is developed separately and with different goals from ESLint, ESTree, and Espree, its AST also represents nodes differently in many cases. + +- TS's AST is optimized for its use case of parsing incomplete code and typechecking. +- ESTree is unoptimized and intended for "general purpose" use-cases of traversing the AST. + +ESLint rules are by default only given nodes in the ESTree AST format - which has no knowledge of TypeScript-specific syntax such as interfaces. +On the other hand, TypeScript's type checking APIs require nodes in the TypeScript AST format. + +### Enter TSESTree + +To resolve the incompatibilities between ESTrees and the TypeScript AST typescript-eslint provides its own [`@typescript-eslint/parser` package](https://typescript-eslint.io/architecture/Parser.mdx) which: + +1. First parses TypeScript syntax into a TypeScript AST +1. Creates an ESTree AST based on that TypeScript AST +1. Keeps track of equivalent nodes across each AST + +By creating both an ESTree AST and a TypeScript AST, the typescript-eslint parser allows ESLint rules to work with TypeScript code. +That's why the [Getting Started guide](https://typescript-eslint.io/getting-started) for typescript-eslint has you specify `parser: '@typescript-eslint/parser'` in your ESLint config! + +We commonly refer to the ESTree format that also includes TypeScript-specific syntax as **TSESTree**. + +### AST Playground + +The [typescript-eslint playground](https://typescript-eslint.io/play#showAST=es) contains an AST explorer that generates an interactive AST for any code entered into the playground. +You can activate it under _Options_ > _AST Explorer_ on its left sidebar by selecting the value of _AST Viewer_. + +## Further Resources + +You can play more with various other ASTs on [astexplorer.net], including those for other languages such as CSS and HTML. + +The [AST Wikipedia article](https://en.wikipedia.org/wiki/Abstract_syntax_tree) has a great deal more context and history on ASTs. + +### Glossary + +Putting together all the terms introduces in this article: + +- **AST (Abstract Syntax Tree)**: An object representation of your code's syntax. +- **Espree**: ESLint's built-in parser that outputs an ESTree-shaped AST. +- **ESTree**: The AST specification used by ESLint and other common JavaScript tools. +- **Node Type**: What kind of code syntax an AST node refers to, such as _BinaryExpression_ or _Literal_. +- **Node**: A single range of code syntax in an AST. +- **Parser**: A tool that reads in a string and outputs an AST. +- **TSESTree**: Our extension to the ESTree AST format that also includes TypeScript-specific syntax. + +### TypeScript Lint Rules and ASTs + +Interested in how these ASTs work with ESLint rules? +We collaborated with our friends at Sourcegraph on a [Tour de Source on typescript-eslint](https://sourcegraph.com/notebooks/Tm90ZWJvb2s6MTA2OA==). +Read on to learn how ESLint rules use ASTs to analyze code files and, thanks to `@typescript-eslint/parser`, call TypeScript's type checking APIs to analyze code. + +[astexplorer.net]: https://astexplorer.net +[espree]: https://github.com/eslint/espree +[estree]: https://github.com/ESTree/ESTree diff --git a/packages/website/cypress/integration/index.spec.js b/packages/website/cypress/integration/index.spec.js deleted file mode 100644 index 250878da795..00000000000 --- a/packages/website/cypress/integration/index.spec.js +++ /dev/null @@ -1,15 +0,0 @@ -import { checkAccessibility } from '../utils'; - -describe('Index', () => { - it('has no accessibility issues detected by aXe', () => { - cy.visit('/'); - cy.injectAxe(); - - // 1. Check accessibility in default, light mode - checkAccessibility(); - - // 2. Check accessibility in dark mode - cy.get('[class*=toggleButton]').click(); - checkAccessibility(); - }); -}); diff --git a/packages/website/cypress/plugins/index.js b/packages/website/cypress/plugins/index.js deleted file mode 100644 index f27e2b46f7d..00000000000 --- a/packages/website/cypress/plugins/index.js +++ /dev/null @@ -1,17 +0,0 @@ -/// - -/** - * @type {Cypress.PluginConfig} - */ -module.exports = on => { - on('task', { - log(message) { - console.log(message); - return null; - }, - table(message) { - console.table(message); - return null; - }, - }); -}; diff --git a/packages/website/cypress/support/commands.js b/packages/website/cypress/support/commands.js deleted file mode 100644 index 46bfe99c37f..00000000000 --- a/packages/website/cypress/support/commands.js +++ /dev/null @@ -1 +0,0 @@ -import 'cypress-axe'; diff --git a/packages/website/cypress/support/index.js b/packages/website/cypress/support/index.js deleted file mode 100644 index 1221b17e096..00000000000 --- a/packages/website/cypress/support/index.js +++ /dev/null @@ -1 +0,0 @@ -import './commands'; diff --git a/packages/website/cypress/utils.js b/packages/website/cypress/utils.js deleted file mode 100644 index f60a8143c7e..00000000000 --- a/packages/website/cypress/utils.js +++ /dev/null @@ -1,28 +0,0 @@ -function terminalLog(violations) { - cy.task( - 'log', - `${violations.length} accessibility violation${ - violations.length === 1 ? '' : 's' - } detected`, - ); - for (const violation of violations) { - cy.task('log', JSON.stringify(violation, null, 4)); - } - - cy.task( - 'table', - violations.map(({ description, id, impact, nodes }) => ({ - description, - id, - impact, - nodes: nodes.length, - })), - ); -} - -export function checkAccessibility() { - // Wait for any pending paints and ticks to clear - cy.wait(500); - - cy.checkA11y(undefined, undefined, terminalLog); -} diff --git a/packages/website/data/sponsors.json b/packages/website/data/sponsors.json index faef97d207f..d550faf83f8 100644 --- a/packages/website/data/sponsors.json +++ b/packages/website/data/sponsors.json @@ -3,7 +3,6 @@ "id": "Indeed", "image": "https://images.opencollective.com/indeed/4b8725e/logo.png", "name": "Indeed", - "tier": "sponsor", "totalDonations": 1005000, "website": "https://Indeed.com" }, @@ -11,103 +10,97 @@ "id": "Nx (by Nrwl)", "image": "https://images.opencollective.com/nx/0efbe42/logo.png", "name": "Nx (by Nrwl)", - "tier": "sponsor", - "totalDonations": 525000, + "totalDonations": 575000, "website": "https://nx.dev" }, { "id": "ESLint", "image": "https://images.opencollective.com/eslint/96b09dc/logo.png", "name": "ESLint", - "tier": "sponsor", - "totalDonations": 200000, + "totalDonations": 230000, "website": "https://eslint.org/" }, { "id": "Airbnb", "image": "https://images.opencollective.com/airbnb/d327d66/logo.png", "name": "Airbnb", - "tier": "sponsor", - "totalDonations": 135800, + "totalDonations": 145800, "website": "https://www.airbnb.com/" }, + { + "id": "n8n.io - n8n GmbH", + "image": "https://images.opencollective.com/n8n/dca2f0c/logo.png", + "name": "n8n.io - n8n GmbH", + "totalDonations": 120000, + "website": "https://n8n.io" + }, { "id": "Coinbase", "image": "https://images.opencollective.com/coinbase/a202856/logo.png", "name": "Coinbase", - "tier": "sponsor", "totalDonations": 120000, "website": "https://blog.coinbase.com/engineering-and-security/home" }, - { - "id": "n8n.io - n8n GmbH", - "image": "https://images.opencollective.com/n8n/dca2f0c/logo.png", - "name": "n8n.io - n8n GmbH", - "tier": "sponsor", - "totalDonations": 110000, - "website": "https://n8n.io" - }, { "id": "GitBook", "image": "https://images.opencollective.com/gitbook/d35a8e7/logo.png", "name": "GitBook", - "tier": "sponsor", - "totalDonations": 100000, + "totalDonations": 120000, "website": "https://www.gitbook.com" }, + { + "id": "Sentry", + "image": "https://images.opencollective.com/sentry/9620d33/logo.png", + "name": "Sentry", + "totalDonations": 114800, + "website": "https://sentry.io/welcome/" + }, { "id": "Codecademy", "image": "https://images.opencollective.com/codecademy/d56a48d/logo.png", "name": "Codecademy", - "tier": "supporter", - "totalDonations": 90000, + "totalDonations": 110000, "website": "https://codecademy.com" }, { "id": "EY Doberman", "image": "https://images.opencollective.com/ey-doberman/b269462/logo.png", "name": "EY Doberman", - "tier": "supporter", "totalDonations": 80400, "website": "https://doberman.co" }, + { + "id": "Sourcegraph", + "image": "https://images.opencollective.com/sourcegraph/67e40ff/logo.png", + "name": "Sourcegraph", + "totalDonations": 60000, + "website": "https://about.sourcegraph.com" + }, { "id": "Future Processing", "image": "https://images.opencollective.com/future-processing/1410d26/logo.png", "name": "Future Processing", - "tier": "supporter", "totalDonations": 54000, "website": "https://www.future-processing.com/" }, - { - "id": "Sentry", - "image": "https://images.opencollective.com/sentry/9620d33/logo.png", - "name": "Sentry", - "tier": "supporter", - "totalDonations": 50000, - "website": "https://sentry.io/welcome/" - }, { "id": "Whitebox", "image": "https://images.opencollective.com/whiteboxinc/ef0d11d/logo.png", "name": "Whitebox", - "tier": "contributor", "totalDonations": 40000, "website": "https://whitebox.com" }, { - "id": "Sourcegraph", - "image": "https://images.opencollective.com/sourcegraph/67e40ff/logo.png", - "name": "Sourcegraph", - "tier": "contributor", + "id": "Codiga", + "image": "https://images.opencollective.com/codiga/1065f9f/logo.png", + "name": "Codiga", "totalDonations": 40000, - "website": "https://about.sourcegraph.com" + "website": "https://www.codiga.io" }, { "id": "Monito", "image": "https://images.opencollective.com/monito/50fc878/logo.png", "name": "Monito", - "tier": "contributor", "totalDonations": 30000, "website": "https://www.monito.com" }, @@ -115,15 +108,13 @@ "id": "STORIS", "image": "https://images.opencollective.com/storis/dfb0e13/logo.png", "name": "STORIS", - "tier": "contributor", - "totalDonations": 25500, + "totalDonations": 28500, "website": "https://www.storis.com/" }, { "id": "revo.js", "image": "https://images.opencollective.com/revojsro/82623a7/logo.png", "name": "revo.js", - "tier": "contributor", "totalDonations": 23000, "website": "https://revojs.ro" }, @@ -131,39 +122,48 @@ "id": "Ian MacLeod", "image": "https://images.opencollective.com/nevir/35c52ef/avatar.png", "name": "Ian MacLeod", - "tier": "contributor", "totalDonations": 22000, "website": "https://twitter.com/nevir" }, - { - "id": "Codiga", - "image": "https://images.opencollective.com/codiga/1065f9f/logo.png", - "name": "Codiga", - "tier": "contributor", - "totalDonations": 20000, - "website": "https://www.codiga.io" - }, { "id": "David Johnston", "image": "https://images.opencollective.com/blacksheepcode/976d69a/avatar.png", "name": "David Johnston", - "tier": "contributor", - "totalDonations": 14500, + "totalDonations": 15500, "website": "https://blacksheepcode.com" }, + { + "id": "THANKS.DEV", + "image": "https://images.opencollective.com/thanks-dev/ed78b39/logo.png", + "name": "THANKS.DEV", + "totalDonations": 14761, + "website": "https://thanks.dev" + }, { "id": "Joe Alden", "image": "https://images.opencollective.com/joealden/44a6738/avatar.png", "name": "Joe Alden", - "tier": "contributor", "totalDonations": 14000, "website": "https://joealden.com" }, + { + "id": "Evil Martians", + "image": "https://images.opencollective.com/evilmartians/707ab4d/logo.png", + "name": "Evil Martians", + "totalDonations": 10500, + "website": "https://evilmartians.com/" + }, + { + "id": "Balsa", + "image": "https://images.opencollective.com/balsa/77de498/logo.png", + "name": "Balsa", + "totalDonations": 10500, + "website": "https://balsa.com" + }, { "id": "Gianfranco Palumbo", "image": "https://images.opencollective.com/gianpaj/5d62d25/avatar.png", "name": "Gianfranco Palumbo", - "tier": "contributor", "totalDonations": 10000, "website": "http://gian.xyz" }, @@ -171,7 +171,6 @@ "id": "The Guardian", "image": "https://images.opencollective.com/gdndevelopers/0b72bf0/logo.png", "name": "The Guardian", - "tier": "contributor", "totalDonations": 10000, "website": "https://www.theguardian.com/" }, @@ -179,8 +178,14 @@ "id": "Laserhub", "image": "https://images.opencollective.com/laserhub/bae6275/logo.png", "name": "Laserhub", - "tier": "contributor", "totalDonations": 10000, "website": "https://laserhub.com/" + }, + { + "id": "DeepSource", + "image": "https://images.opencollective.com/deepsource/0f18cea/logo.png", + "name": "DeepSource", + "totalDonations": 10000, + "website": "https://deepsource.io/" } ] diff --git a/packages/website/docusaurusConfig.ts b/packages/website/docusaurusConfig.ts index 1a9a41e548e..bfa844fc2f0 100644 --- a/packages/website/docusaurusConfig.ts +++ b/packages/website/docusaurusConfig.ts @@ -1,5 +1,6 @@ import type { MDXPlugin } from '@docusaurus/mdx-loader'; import type { Options as PluginContentDocsOptions } from '@docusaurus/plugin-content-docs'; +import type { Options as PluginPwaOptions } from '@docusaurus/plugin-pwa'; import type { Options as PresetClassicOptions } from '@docusaurus/preset-classic'; import npm2yarnPlugin from '@docusaurus/remark-plugin-npm2yarn'; import type { UserThemeConfig as ThemeCommonConfig } from '@docusaurus/theme-common'; @@ -7,6 +8,7 @@ import type { UserThemeConfig as AlgoliaThemeConfig } from '@docusaurus/theme-se import type { Config } from '@docusaurus/types'; import tabsPlugin from 'remark-docusaurus-tabs'; +import { version } from './package.json'; import { generatedRuleDocs } from './plugins/generated-rule-docs'; import { rulesMeta } from './rulesMeta'; @@ -43,7 +45,7 @@ const presetClassicOptions: PresetClassicOptions = { const pluginContentDocsOptions: PluginContentDocsOptions = { id: 'base-docs', path: '../../docs', - routeBasePath: 'docs', + routeBasePath: '/', sidebarPath: require.resolve('./sidebars/sidebar.base.js'), editUrl: `${githubUrl}/edit/main/packages/website/`, beforeDefaultRemarkPlugins, @@ -64,34 +66,34 @@ const themeConfig: ThemeCommonConfig & AlgoliaThemeConfig = { ], image: 'img/logo-twitter-card.png', navbar: { - title: 'TypeScript ESLint', - // hideOnScroll: true, + title: 'typescript-eslint', logo: { alt: '', height: '32px', src: 'img/logo.svg', width: '32px', }, - // style: 'primary', items: [ { - to: 'docs/', - activeBasePath: 'docs', + to: 'getting-started/', label: 'Getting started', position: 'left', }, { to: 'rules/', - activeBasePath: 'rules', label: 'Rules', position: 'left', }, { to: 'blog/', - activeBasePath: 'blog', label: 'Blog', position: 'left', }, + { + position: 'right', + value: `v${version}`, + type: 'html', + }, { to: 'play', activeBasePath: 'play', @@ -140,8 +142,7 @@ const themeConfig: ThemeCommonConfig & AlgoliaThemeConfig = { ], }, ], - // style: 'primary', - copyright: `Copyright © ${new Date().getFullYear()} TypeScript ESLint, Inc. Built with Docusaurus.`, + copyright: `Copyright © ${new Date().getFullYear()} typescript-eslint, Inc. Built with Docusaurus.`, }, prism: { theme: { @@ -173,9 +174,67 @@ const themeConfig: ThemeCommonConfig & AlgoliaThemeConfig = { }, }; +const pluginPwaOptions: PluginPwaOptions = { + debug: true, + offlineModeActivationStrategies: [ + 'appInstalled', + 'queryString', + 'standalone', + ], + pwaHead: [ + { + href: '/img/logo.svg', + rel: 'icon', + tagName: 'link', + }, + { + href: '/manifest.json', + rel: 'manifest', + tagName: 'link', + }, + { + content: '#443FD4', + name: 'theme-color', + tagName: 'meta', + }, + { + content: 'yes', + name: 'apple-mobile-web-app-capable', + tagName: 'meta', + }, + { + content: '#443FD4', + name: 'apple-mobile-web-app-status-bar-style', + tagName: 'meta', + }, + { + href: '/img/logo.png', + rel: 'apple-touch-icon', + tagName: 'link', + }, + { + color: '#443FD4', + href: '/img/logo.png', + rel: 'mask-icon', + tagName: 'link', + }, + { + content: '/img/logo.png', + name: 'msapplication-TileImage', + tagName: 'meta', + }, + { + content: '#443FD4', + name: 'msapplication-TileColor', + tagName: 'meta', + }, + ], +}; + const config: Config = { - title: 'TypeScript ESLint', - tagline: 'Tooling which enables ESLint to support TypeScript', + title: 'typescript-eslint', + tagline: + 'The tooling that enables ESLint and Prettier to support TypeScript.', url: 'https://typescript-eslint.io', baseUrl: '/', onBrokenLinks: 'throw', @@ -191,6 +250,7 @@ const config: Config = { plugins: [ require.resolve('./webpack.plugin'), ['@docusaurus/plugin-content-docs', pluginContentDocsOptions], + ['@docusaurus/plugin-pwa', pluginPwaOptions], ], themeConfig, // Misleading API name, but these are just tags @@ -216,6 +276,11 @@ const config: Config = { rel: 'manifest', href: '/img/favicon/site.webmanifest', }, + { + color: '#2656c7', + href: '/img/favicon/safari-pinned-tab.svg', + rel: 'mask-icon', + }, ], }; diff --git a/packages/website/package.json b/packages/website/package.json index d1b28be8e5b..f2e254b7fd0 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -1,27 +1,28 @@ { "name": "website", - "version": "5.39.0", + "version": "5.46.1", "private": true, "scripts": { "build": "docusaurus build", "clear": "docusaurus clear", "format": "prettier --write \"./**/*.{md,mdx,ts,js,tsx,jsx}\" --ignore-path ../../.prettierignore", - "lint": "eslint . --ignore-path ../../.eslintignore", + "lint": "nx lint", "serve": "docusaurus serve", "start": "docusaurus start", "swizzle": "docusaurus swizzle", - "test": "cypress run", - "test:open": "cypress open" + "test": "playwright test", + "typecheck": "tsc" }, "dependencies": { "@babel/runtime": "^7.18.3", - "@docusaurus/core": "~2.0.1", - "@docusaurus/preset-classic": "~2.0.1", - "@docusaurus/remark-plugin-npm2yarn": "~2.0.1", - "@docusaurus/theme-common": "~2.0.1", + "@docusaurus/core": "~2.2.0", + "@docusaurus/plugin-pwa": "~2.2.0", + "@docusaurus/preset-classic": "~2.2.0", + "@docusaurus/remark-plugin-npm2yarn": "~2.2.0", + "@docusaurus/theme-common": "~2.2.0", "@mdx-js/react": "1.6.22", - "@typescript-eslint/parser": "5.39.0", - "@typescript-eslint/website-eslint": "5.39.0", + "@typescript-eslint/parser": "5.46.1", + "@typescript-eslint/website-eslint": "5.46.1", "clsx": "^1.1.1", "eslint": "*", "json-schema": "^0.4.0", @@ -41,14 +42,14 @@ "react": "^18.0.0" }, "devDependencies": { - "@docusaurus/module-type-aliases": "~2.0.1", + "@axe-core/playwright": "^4.4.5", + "@docusaurus/module-type-aliases": "~2.2.0", + "@playwright/test": "^1.27.1", "@types/react": "^18.0.9", "@types/react-helmet": "^6.1.5", "@types/react-router-dom": "^5.3.3", - "@typescript-eslint/eslint-plugin": "5.39.0", + "@typescript-eslint/eslint-plugin": "5.46.1", "copy-webpack-plugin": "^11.0.0", - "cypress": "8.3.0", - "cypress-axe": "^0.14.0", "eslint-plugin-jsx-a11y": "^6.5.1", "eslint-plugin-react": "^7.29.4", "eslint-plugin-react-hooks": "^4.5.0", diff --git a/packages/website/playwright.config.ts b/packages/website/playwright.config.ts new file mode 100644 index 00000000000..ad85c7391d9 --- /dev/null +++ b/packages/website/playwright.config.ts @@ -0,0 +1,30 @@ +import type { PlaywrightTestConfig } from '@playwright/test'; +import { devices } from '@playwright/test'; + +const config: PlaywrightTestConfig = { + forbidOnly: !!process.env.CI, + fullyParallel: true, + reporter: 'html', + retries: 0, + testDir: './tests', + use: { + baseURL: 'http://localhost:3000', + trace: 'on-first-retry', + }, + projects: [ + { + name: 'chromium', + use: { + ...devices['Desktop Chrome'], + }, + }, + ], + webServer: { + command: 'yarn start', + port: 3000, + reuseExistingServer: !process.env.CI, + }, + workers: process.env.CI ? 1 : undefined, +}; + +export default config; diff --git a/packages/website/plugins/generated-rule-docs.ts b/packages/website/plugins/generated-rule-docs.ts index e21a408dbf4..37bd4e02cc4 100644 --- a/packages/website/plugins/generated-rule-docs.ts +++ b/packages/website/plugins/generated-rule-docs.ts @@ -52,20 +52,26 @@ export const generatedRuleDocs: Plugin = () => { ); // 2. Add a description of the rule at the top of the file - root.children.unshift({ - children: [ - { - children: meta.docs.description - .split(/`(.+?)`/) - .map((value, index, array) => ({ - type: index % 2 === 0 ? 'text' : 'inlineCode', - value: index === array.length - 1 ? `${value}.` : value, - })), - type: 'paragraph', - }, - ], - type: 'blockquote', - } as mdast.Blockquote); + root.children.unshift( + { + children: [ + { + children: meta.docs.description + .split(/`(.+?)`/) + .map((value, index, array) => ({ + type: index % 2 === 0 ? 'text' : 'inlineCode', + value: index === array.length - 1 ? `${value}.` : value, + })), + type: 'paragraph', + }, + ], + type: 'blockquote', + } as mdast.Blockquote, + { + type: 'jsx', + value: ``, + } as unist.Node, + ); // 3. Add a notice about formatting rules being 🤢 if (meta.type === 'layout') { @@ -74,7 +80,7 @@ export const generatedRuleDocs: Plugin = () => { We strongly recommend you do not use this rule or any other formatting linter rules. Use a separate dedicated formatter instead. - See What About Formatting? for more information. + See What About Formatting? for more information. `, type: 'jsx', @@ -82,19 +88,7 @@ export const generatedRuleDocs: Plugin = () => { root.children.unshift(warningNode); } - // 4. Add a rule attributes list before the first h2. - const attributesH2Index = root.children.findIndex( - child => nodeIsHeading(child) && child.depth === 2, - ); - - // The actual content will be injected on client side. - const attributesNode = { - type: 'jsx', - value: ``, - }; - root.children.splice(attributesH2Index, 0, attributesNode); - - // 5. Make sure the appropriate headers exist to place content under + // 4. Make sure the appropriate headers exist to place content under const [howToUseH2Index, optionsH2Index] = ((): [number, number] => { let howToUseH2Index = root.children.findIndex( createH2TextFilter('How to Use'), @@ -162,7 +156,7 @@ export const generatedRuleDocs: Plugin = () => { return [howToUseH2Index, optionsH2Index]; })(); - // 6. Add a description of how to use / options for the rule + // 5. Add a description of how to use / options for the rule const optionLevel = meta.docs.recommended === 'error' ? 'error' : 'warn'; if (meta.docs.extendsBaseRule) { @@ -204,13 +198,20 @@ export const generatedRuleDocs: Plugin = () => { type: 'code', meta: 'title=".eslintrc.cjs"', value: `module.exports = { - // Note: you must disable the base rule as it can report incorrect errors - "${extendsBaseRuleName}": "off", - "@typescript-eslint/${file.stem}": "${optionLevel}" + "rules": { + // Note: you must disable the base rule as it can report incorrect errors + "${extendsBaseRuleName}": "off", + "@typescript-eslint/${file.stem}": "${optionLevel}" + } };`, } as mdast.Code); } else { - root.children.splice(optionsH2Index, 0, { + // For non-extended rules, the code snippet is placed before the first h2 + // (i.e. at the end of the initial explanation) + const firstH2Index = root.children.findIndex( + child => nodeIsHeading(child) && child.depth === 2, + ); + root.children.splice(firstH2Index, 0, { lang: 'js', type: 'code', meta: 'title=".eslintrc.cjs"', @@ -297,7 +298,7 @@ export const generatedRuleDocs: Plugin = () => { } } - // 7. Add a notice about coming from ESLint core for extension rules + // 6. Add a notice about coming from ESLint core for extension rules if (meta.docs.extendsBaseRule) { root.children.push({ children: [ @@ -329,7 +330,7 @@ export const generatedRuleDocs: Plugin = () => { } as mdast.Paragraph); } - // 8. Also add a link to view the rule's source and test code + // 7. Also add a link to view the rule's source and test code root.children.push( { children: [ diff --git a/packages/website/project.json b/packages/website/project.json index 9bfd9e8a8aa..e7e7b0eabbf 100644 --- a/packages/website/project.json +++ b/packages/website/project.json @@ -1,5 +1,15 @@ { - "root": "packages/website", + "name": "website", + "$schema": "../../node_modules/nx/schemas/project-schema.json", "type": "library", - "implicitDependencies": [] + "implicitDependencies": [], + "targets": { + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["packages/website/**/*.ts"] + } + } + } } diff --git a/packages/website/sidebars/sidebar.base.js b/packages/website/sidebars/sidebar.base.js index 339ea39e95c..fe84b9c1ae3 100644 --- a/packages/website/sidebars/sidebar.base.js +++ b/packages/website/sidebars/sidebar.base.js @@ -35,22 +35,59 @@ module.exports = { label: 'Getting Started', type: 'category', }, + 'custom-rules', { + items: [ + 'contributing/issues', + 'contributing/local-development', + 'contributing/pull-requests', + ], + label: 'Contributing', + link: { + id: 'contributing', + type: 'doc', + }, type: 'category', - label: 'Development', - collapsible: false, + }, + { items: [ + 'architecture/eslint-plugin', + 'architecture/eslint-plugin-tslint', + 'architecture/parser', + 'architecture/scope-manager', + 'architecture/typescript-estree', + 'architecture/utils', + ], + label: 'Architecture', + link: { + id: 'architecture', + type: 'doc', + }, + type: 'category', + }, + { + items: [ + 'maintenance/branding', { - label: 'Architecture', - type: 'category', collapsible: false, - items: [ - 'development/architecture/asts', - 'development/architecture/packages', - ], + items: ['maintenance/issues/rule-deprecations'], + label: 'Issues', + link: { + id: 'maintenance/issues', + type: 'doc', + }, + type: 'category', }, - 'development/custom-rules', + 'maintenance/pull-requests', + 'maintenance/releases', + 'maintenance/versioning', ], + label: 'Maintenance', + link: { + id: 'maintenance', + type: 'doc', + }, + type: 'category', }, ], }; diff --git a/packages/website/sidebars/sidebar.rules.js b/packages/website/sidebars/sidebar.rules.js index b5075872411..e698d7cda05 100644 --- a/packages/website/sidebars/sidebar.rules.js +++ b/packages/website/sidebars/sidebar.rules.js @@ -13,14 +13,19 @@ const rules = Object.entries(plugin.rules).map(([name, rule]) => { const deprecatedRules = new Set(rules.filter(rule => rule.meta.deprecated)); const formattingRules = new Set( + rules.filter(rule => !rule.meta.deprecated && rule.meta.type === 'layout'), +); + +const extensionRules = new Set( rules.filter( - rule => !rule.meta.deprecated && rule.meta.fixable === 'whitespace', + rule => rule.meta.docs?.extendsBaseRule && !formattingRules.has(rule), ), ); -const emphasizedRules = rules.filter( +const typescriptRules = rules.filter( rule => !rule.meta.deprecated && + !extensionRules.has(rule) && !deprecatedRules.has(rule) && !formattingRules.has(rule), ); @@ -63,14 +68,17 @@ module.exports = { someSidebar: [ 'README', { - ...createCategory('Rules', emphasizedRules, [ - createCategory('Formatting Rules', Array.from(formattingRules)), - createCategory('Deprecated Rules', [ - ...Array.from(deprecatedRules), - ...paths, - ]), - ]), + ...createCategory('TypeScript Rules', Array.from(typescriptRules)), + collapsed: false, + }, + { + ...createCategory('Extension Rules', Array.from(extensionRules)), collapsed: false, }, + createCategory('Formatting Rules', Array.from(formattingRules)), + createCategory('Deprecated Rules', [ + ...Array.from(deprecatedRules), + ...paths, + ]), ], }; diff --git a/packages/website/src/components/ErrorsViewer.tsx b/packages/website/src/components/ErrorsViewer.tsx index 3e0a890ee0a..0789b84d78c 100644 --- a/packages/website/src/components/ErrorsViewer.tsx +++ b/packages/website/src/components/ErrorsViewer.tsx @@ -91,6 +91,18 @@ function ErrorBlock({ ); } +function SuccessBlock(): JSX.Element { + return ( +
+
+
+
All is ok!
+
+
+
+ ); +} + export default function ErrorsViewer({ value, }: ErrorsViewerProps): JSX.Element { @@ -113,31 +125,37 @@ export default function ErrorsViewer({ return (
- {value?.map(({ group, uri, items }) => { - return ( -
-

- {group} - {uri && ( - <> - {' - '} - - docs - - - )} -

- {items.map((item, index) => ( - - ))} -
- ); - })} + {value?.length ? ( + value.map(({ group, uri, items }) => { + return ( +
+

+ {group} + {uri && ( + <> + {' - '} + + docs + + + )} +

+ {items.map((item, index) => ( + + ))} +
+ ); + }) + ) : ( +
+ +
+ )}
); } diff --git a/packages/website/src/components/FinancialContributors/Sponsors/index.tsx b/packages/website/src/components/FinancialContributors/Sponsors/index.tsx index c175cdc2615..dfcdad8c7b9 100644 --- a/packages/website/src/components/FinancialContributors/Sponsors/index.tsx +++ b/packages/website/src/components/FinancialContributors/Sponsors/index.tsx @@ -1,36 +1,35 @@ -import sponsors from '@site/data/sponsors.json'; import clsx from 'clsx'; import React from 'react'; import { Sponsor } from '../Sponsor'; -import type { SponsorIncludeOptions } from '../types'; +import type { SponsorData, SponsorIncludeOptions } from '../types'; import styles from './styles.module.css'; interface SponsorsProps { className: string; include?: SponsorIncludeOptions; expanded?: boolean; - tier?: string; + sponsors: SponsorData[]; title: string; + tier: string; } export function Sponsors({ className, include, - tier, title, + tier, + sponsors, }: SponsorsProps): JSX.Element { return (

{title}

    - {sponsors - .filter(sponsor => sponsor.tier === tier) - .map(sponsor => ( -
  • - -
  • - ))} + {sponsors.map(sponsor => ( +
  • + +
  • + ))}
); diff --git a/packages/website/src/components/FinancialContributors/Sponsors/styles.module.css b/packages/website/src/components/FinancialContributors/Sponsors/styles.module.css index e740c76f8bd..b92051eddcb 100644 --- a/packages/website/src/components/FinancialContributors/Sponsors/styles.module.css +++ b/packages/website/src/components/FinancialContributors/Sponsors/styles.module.css @@ -7,7 +7,7 @@ display: flex; flex-wrap: wrap; justify-content: center; - align-items: flex-end; + align-items: stretch; max-width: 800px; padding: 0; } @@ -15,10 +15,11 @@ .sponsorsTier li { list-style: none; margin: 5px; - max-width: 120px; + max-width: 130px; } .sponsorsTier img { + background: white; display: block; margin: auto; } @@ -29,40 +30,42 @@ border: none; } -.tier-sponsor { +.tier-platinum-sponsor { gap: 32px 16px; } -.tier-sponsor img { +.tier-platinum-sponsor img { display: inline-block; - max-height: 120px; - max-width: 120px; - width: 120px; + max-height: 130px; + max-width: 130px; + width: 130px; } -.tier-supporter, -.tier-contributor { +.tier-gold-supporter, +.tier-silver-supporter { align-items: center; } -.tier-supporter { +.tier-gold-supporter { font-size: 0.95rem; line-height: 1; - gap: 24px; - padding-top: 16px; + gap: 12px; + padding-top: 12px; } -.tier-supporter img { +.tier-gold-supporter img { max-height: 75px; max-width: 75px; width: 75px; } -.tier-contributor { - gap: 4px 24px; +.tier-silver-supporter { + gap: 4px 16px; + margin: auto; + max-width: 75%; } -.tier-contributor img { +.tier-silver-supporter img { max-height: 45px; max-width: 45px; width: 45px; @@ -81,4 +84,8 @@ width: auto; padding: 0 60px; } + + .tier-gold-supporter { + margin-bottom: 0; + } } diff --git a/packages/website/src/components/FinancialContributors/index.tsx b/packages/website/src/components/FinancialContributors/index.tsx index f977dbdecc7..d71bd065004 100644 --- a/packages/website/src/components/FinancialContributors/index.tsx +++ b/packages/website/src/components/FinancialContributors/index.tsx @@ -1,4 +1,5 @@ import Link from '@docusaurus/Link'; +import sponsors from '@site/data/sponsors.json'; import clsx from 'clsx'; import React from 'react'; @@ -9,26 +10,29 @@ export function FinancialContributors(): JSX.Element { return ( <>

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

@@ -37,15 +41,25 @@ export function FinancialContributors(): JSX.Element { to="https://opencollective.com/typescript-eslint/contribute" target="_blank" > - Become a financial contributor - - - See all financial contributors + Become a financial sponsor +
+ + See all financial sponsors + + + Docs + +
); diff --git a/packages/website/src/components/FinancialContributors/styles.module.css b/packages/website/src/components/FinancialContributors/styles.module.css index b1c348155aa..c5ffc1e2681 100644 --- a/packages/website/src/components/FinancialContributors/styles.module.css +++ b/packages/website/src/components/FinancialContributors/styles.module.css @@ -2,6 +2,7 @@ display: inline-flex; flex-direction: column; gap: 8px; + height: 100%; } .linksArea { @@ -14,6 +15,17 @@ .become { font-size: 1.25rem; + padding: 0.75rem 1.75rem; +} + +.linksMore { + display: flex; + gap: 0.5rem; +} + +[data-theme='dark'] .linksArea a { + --ifm-font-color-base: var(--ifm-color-white); + --ifm-button-color: var(--ifm-color-white); } @media screen and (min-width: 1150px) { diff --git a/packages/website/src/components/ast/utils.ts b/packages/website/src/components/ast/utils.ts index 6c01ed7323e..de55a5c0720 100644 --- a/packages/website/src/components/ast/utils.ts +++ b/packages/website/src/components/ast/utils.ts @@ -20,7 +20,6 @@ export function isWithinRange( export function objType(obj: unknown): string { const type = Object.prototype.toString.call(obj).slice(8, -1); - // @ts-expect-error: this is correct check if (type === 'Object' && obj && typeof obj[Symbol.iterator] === 'function') { return 'Iterable'; } diff --git a/packages/website/src/components/config/ConfigEditor.tsx b/packages/website/src/components/config/ConfigEditor.tsx index 1d6e9346e0b..0d4915d281b 100644 --- a/packages/website/src/components/config/ConfigEditor.tsx +++ b/packages/website/src/components/config/ConfigEditor.tsx @@ -129,8 +129,12 @@ function ConfigEditor(props: ConfigEditorProps): JSX.Element {