diff --git a/.cspell.json b/.cspell.json
index f6bb6c5cd87d..47e1d390de9e 100644
--- a/.cspell.json
+++ b/.cspell.json
@@ -101,6 +101,7 @@
"ruleset",
"rulesets",
"serializers",
+ "Sourcegraph",
"superset",
"thenables",
"transpiled",
@@ -108,6 +109,7 @@
"transpiling",
"triaging",
"tsconfigs",
+ "tseslint",
"tsutils",
"tsvfs",
"typedef",
@@ -116,8 +118,7 @@
"unoptimized",
"unprefixed",
"upsert",
- "Zacher",
- "tseslint"
+ "Zacher"
],
"overrides": [
{
diff --git a/.github/DISCUSSION_TEMPLATE/rfcs.yml b/.github/DISCUSSION_TEMPLATE/rfcs.yml
index 0e0b99abf05e..e9467392b44d 100644
--- a/.github/DISCUSSION_TEMPLATE/rfcs.yml
+++ b/.github/DISCUSSION_TEMPLATE/rfcs.yml
@@ -16,7 +16,7 @@ body:
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/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
id: required-checks
type: checkboxes
diff --git a/.github/ISSUE_TEMPLATE/01-bug-report-plugin.yaml b/.github/ISSUE_TEMPLATE/01-bug-report-plugin.yaml
index af01af154c20..adf2b5331a1e 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
diff --git a/.github/ISSUE_TEMPLATE/02-enhancement-rule-option.yaml b/.github/ISSUE_TEMPLATE/02-enhancement-rule-option.yaml
index 8b857b50548f..ac65fbca8c1f 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 2e01a8d2c586..6bd61005bd6a 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 1c02ebe658a4..8c0ca8d8694c 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 f21358bf8ed6..c140dc478d15 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 6340c525b375..91f2cf35fd37 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 686ee970a679..5f0ee6146c59 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 1292c539f27f..c0da8397fa8e 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 6f31c3f96b0e..c5323335a93a 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 42e6c62d54c0..566c2f4fc8a6 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/replies.yml b/.github/replies.yml
index 3edf22c3ca14..a10137241409 100644
--- a/.github/replies.yml
+++ b/.github/replies.yml
@@ -73,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 1a1fd0e460b2..5a3384f1eaa1 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -155,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
diff --git a/.github/workflows/semantic-pr-titles.yml b/.github/workflows/semantic-pr-titles.yml
index 24b6fb7c7ab9..98a7013beb74 100644
--- a/.github/workflows/semantic-pr-titles.yml
+++ b/.github/workflows/semantic-pr-titles.yml
@@ -16,7 +16,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
- # keep this synchronized with the /CONTRIBUTING.md
+ # keep this synchronized with /docs/contributing/Pull_Requests.mdx
types: |
docs
feat
@@ -42,9 +42,9 @@ jobs:
# we allow "cross package" PRs with no scope
requireScope: false
# ensure that the subject is lower-case first
- # also allows "[rule-name] " prefix for eslint-plugin rule PRs
- # https://regexr.com/733ed
- subjectPattern: ^(\[[a-z\-]+\] )?[a-z].+[^\.]$
+ # 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.
diff --git a/.gitignore b/.gitignore
index 1ec5893ee553..2ce061c3d4d7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -79,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/CHANGELOG.md b/CHANGELOG.md
index 6c2b7d9c7a22..e478349e5154 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,16 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+## [5.45.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.45.0...v5.45.1) (2022-12-05)
+
+### 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))
+- **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
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index aaf07b243ee4..7144d2f3bc38 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,112 +1,4 @@
# Contributing
-Thank you for your interest in contributing to TypeScript ESLint! π
-
-> Make sure you read our [Code of Conduct](./CODE_OF_CONDUCT.md) before contributing.
-
-## Raising Issues
-
-So you've got a bug report, documentation request, or feature suggestion?
-Great!
-
-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
-
-### 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! π
-
-## Commenting
-
-Please do comment on any open issue if you have more information that would be useful.
-
-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
-
-## Pull Requests
-
-> See [DEVELOPMENT.md](./DEVELOPMENT.md) for details on how to get started developing locally.
-
-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](./DEVELOPMENT.md#validating-changes) before un-[drafting your PR](https://github.blog/2019-02-14-introducing-draft-pull-requests)
-
-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).
-
-```text
-fix(scope-manager): correct handling for class static blocks
-```
-
-```text
-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.
-
-#### 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.
+See **https://typescript-eslint.io/contributing** for our contributing guidelines.
+Thanks! π
diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md
index 9d9b15f70f2a..ff1a7dbe9a4c 100644
--- a/CONTRIBUTORS.md
+++ b/CONTRIBUTORS.md
@@ -15,78 +15,78 @@ Thanks goes to these wonderful people:
diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md
index fd5c04937988..40ba0362273a 100644
--- a/DEVELOPMENT.md
+++ b/DEVELOPMENT.md
@@ -1,69 +1,4 @@
# Development
-Thank you for your interest in developing on TypeScript ESLint! β€οΈβπ₯
-
-> See [CONTRIBUTING.md](./CONTRIBUTING.md) for details on our general contribution flows.
-
-## Setup
-
-After [forking the repo from GitHub](https://help.github.com/articles/fork-a-repo):
-
-```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 any package or in the root to build the package(s).
-
-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.
-
-### 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.
+See **https://typescript-eslint.io/contributing/local-development** for our development instructions.
+Thanks! π
diff --git a/README.md b/README.md
index 93bee2f66dc4..c1934b1c4484 100644
--- a/README.md
+++ b/README.md
@@ -9,99 +9,26 @@
-
-## 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:
-
-
-
-The latest version under the `canary` tag **(latest commit to `main`)** is:
-
-
-
-(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 <5.0.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:
@@ -114,3 +41,7 @@ In addition to submitting code and documentation updates, you can help us sustai
+
+## 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 000000000000..ee224c1e90ae
--- /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 000000000000..35846cdaaae0
--- /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 f04255d00e68..0590398b8188 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 0cc743de8d8a..91c978322f48 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/architecture/ESLint_Plugin.mdx b/docs/architecture/ESLint_Plugin.mdx
new file mode 100644
index 000000000000..eca601415550
--- /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 000000000000..582d93aab8ef
--- /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 000000000000..185d67d35808
--- /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 000000000000..af7bd6e27c5c
--- /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 000000000000..066030b0afee
--- /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 000000000000..9270f2ed8e55
--- /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 000000000000..ae61dd0e3123
--- /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 000000000000..294435616b70
--- /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 000000000000..edb76feb7d6f
--- /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 26164c8174e1..000000000000
--- 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 f798e35b2e47..000000000000
--- 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.mdx b/docs/linting/CONFIGURATIONS.mdx
index eebf58cf8fd2..03227ce0cced 100644
--- a/docs/linting/CONFIGURATIONS.mdx
+++ b/docs/linting/CONFIGURATIONS.mdx
@@ -18,7 +18,7 @@ Most projects should extend from at least one of:
- [`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)).
+We recommend most projects use [`recommended-requiring-type-checking`](#recommended-requiring-type-checking) (which requires [typed linting](./Typed_Linting.md)).
:::
:::note
@@ -63,7 +63,7 @@ See [`configs/recommended-requiring-type-checking.ts`](https://github.com/typesc
:::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](/docs/linting/typed-linting) for more details.
+See [Linting with Type Information](/linting/typed-linting) for more details.
:::
### `strict`
diff --git a/docs/linting/TROUBLESHOOTING.md b/docs/linting/Troubleshooting.md
similarity index 98%
rename from docs/linting/TROUBLESHOOTING.md
rename to docs/linting/Troubleshooting.md
index 5001a0a16fa4..38d3bf38e710 100644
--- a/docs/linting/TROUBLESHOOTING.md
+++ b/docs/linting/Troubleshooting.md
@@ -35,11 +35,11 @@ If you don't find an existing extension rule, or the extension rule doesn't work
- 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):
+ - 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):
+ - 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)
@@ -64,12 +64,12 @@ For example, many projects have files like:
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.
+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).
+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"
@@ -241,7 +241,7 @@ Rules such as [`no-unsafe-argument`](https://typescript-eslint.io/rules/no-unsaf
## 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 88%
rename from docs/linting/TYPED_LINTING.md
rename to docs/linting/Typed_Linting.md
index 8ffb708d0e3e..3e1beb396a8a 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.
@@ -53,8 +53,8 @@ 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"
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 [Troubleshooting and FAQs](./TROUBLESHOOTING.md##i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file).
+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/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 a145f9fca61e..8eb61e85713f 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 97%
rename from docs/linting/typed-linting/MONOREPOS.md
rename to docs/linting/typed-linting/Monorepos.md
index 5163e997ec84..e55d20647796 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.
@@ -104,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/VERSIONING.md b/docs/maintenance/VERSIONING.md
index 514215d1136c..0dd31ae90c1b 100644
--- a/docs/maintenance/VERSIONING.md
+++ b/docs/maintenance/VERSIONING.md
@@ -9,15 +9,59 @@ This page exists to help set guidelines around when what we consider to fall wit
All of the packages in this project are published with the same version number to make it easier to coordinate both releases and installations.
-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.
+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**.
-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.
+Additionally, we promote to the `latest` tag on NPM once per week, **on Mondays at 1 pm Eastern**.
-## Internal packages
+The latest version under the `latest` tag is:
-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.
+
+
+The latest version under the `canary` tag **(latest commit to `main`)** is:
+
+
+
+:::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).
-## `ast-spec` and `visitor-keys`
+### 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:
@@ -33,7 +77,7 @@ A change to the AST **_shall not_** be considered breaking if it:
- 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`
+### `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:
@@ -57,7 +101,7 @@ A change to the plugins **_shall not_** be considered breaking if it:
- 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`
+#### `parser`, `typescript-estree`, `scope-manager`, `types`, `type-utils`, `utils`
A change to these packages **_shall_** be considered breaking if it:
@@ -70,3 +114,7 @@ A change to these packages **_shall not_** be considered breaking if it:
- 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/lerna.json b/lerna.json
index df2f5631f3d5..aa194fc967ca 100644
--- a/lerna.json
+++ b/lerna.json
@@ -1,5 +1,5 @@
{
- "version": "5.45.0",
+ "version": "5.45.1",
"npmClient": "yarn",
"useWorkspaces": true,
"stream": true
diff --git a/netlify.toml b/netlify.toml
index 7ac5b9811484..06deeaaed01f 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 ed1f57517e12..b34a91f78001 100644
--- a/nx.json
+++ b/nx.json
@@ -1,13 +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"
},
@@ -29,10 +22,16 @@
},
"targetDefaults": {
"build": {
- "dependsOn": ["^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 89bc49447f2e..021f9250bef7 100644
--- a/package.json
+++ b/package.json
@@ -54,8 +54,8 @@
"@babel/eslint-parser": "^7.19.1",
"@babel/parser": "^7.20.3",
"@babel/types": "^7.20.2",
- "@nrwl/nx-cloud": "14.7.0",
- "@nrwl/workspace": "14.8.4",
+ "@nrwl/nx-cloud": "15.0.2",
+ "@nrwl/workspace": "15.2.4",
"@swc/core": "^1.3.1",
"@swc/jest": "^0.2.21",
"@types/babel__code-frame": "^7.0.3",
@@ -93,12 +93,12 @@
"jest-diff": "^29.0.3",
"jest-snapshot": "^29.0.3",
"jest-specific-snapshot": "^7.0.0",
- "lerna": "6.0.3",
+ "lerna": "6.1.0",
"lint-staged": "^13.0.0",
"make-dir": "^3.1.0",
"markdownlint-cli": "^0.32.0",
"ncp": "^2.0.0",
- "nx": "14.8.4",
+ "nx": "15.2.4",
"patch-package": "^6.4.7",
"prettier": "2.8.0",
"pretty-format": "^29.0.3",
@@ -111,7 +111,6 @@
"resolutions": {
"typescript": "~4.9.3",
"@types/node": "^18.11.9",
- "//": "Pin jest to v29 across the repo",
"@jest/create-cache-key-function": "^29",
"@jest/reporters": "^29",
"@jest/test-result": "^29",
@@ -123,7 +122,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 41f4b761b1fc..71410ae3ea41 100644
--- a/packages/ast-spec/CHANGELOG.md
+++ b/packages/ast-spec/CHANGELOG.md
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+## [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
diff --git a/packages/ast-spec/README.md b/packages/ast-spec/README.md
index 388241c0061d..43536bb821b3 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`
-
-
-
-
-
+> 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 de9818c347fa..7a5a2bb2c932 100644
--- a/packages/ast-spec/package.json
+++ b/packages/ast-spec/package.json
@@ -1,7 +1,7 @@
{
"name": "@typescript-eslint/ast-spec",
- "version": "5.45.0",
- "description": "TypeScript-ESTree AST spec",
+ "version": "5.45.1",
+ "description": "Complete specification for the TypeScript-ESTree AST",
"private": true,
"keywords": [
"eslint",
diff --git a/packages/ast-spec/project.json b/packages/ast-spec/project.json
index b892bb3fae01..682cdbf3d91c 100644
--- a/packages/ast-spec/project.json
+++ b/packages/ast-spec/project.json
@@ -1,8 +1,17 @@
{
+ "name": "ast-spec",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"type": "library",
"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}"],
diff --git a/packages/eslint-plugin-internal/CHANGELOG.md b/packages/eslint-plugin-internal/CHANGELOG.md
index 9e53fd6f0bcf..9ab8b4f45240 100644
--- a/packages/eslint-plugin-internal/CHANGELOG.md
+++ b/packages/eslint-plugin-internal/CHANGELOG.md
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+## [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.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
diff --git a/packages/eslint-plugin-internal/README.md b/packages/eslint-plugin-internal/README.md
index adf369999286..7d081266c542 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.
-
-
-
+## β 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/package.json b/packages/eslint-plugin-internal/package.json
index 11206ef2b581..f15e97b1b1d1 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.45.0",
+ "version": "5.45.1",
"private": true,
"main": "dist/index.js",
"scripts": {
@@ -14,9 +14,9 @@
},
"dependencies": {
"@types/prettier": "*",
- "@typescript-eslint/scope-manager": "5.45.0",
- "@typescript-eslint/type-utils": "5.45.0",
- "@typescript-eslint/utils": "5.45.0",
+ "@typescript-eslint/scope-manager": "5.45.1",
+ "@typescript-eslint/type-utils": "5.45.1",
+ "@typescript-eslint/utils": "5.45.1",
"prettier": "*"
}
}
diff --git a/packages/eslint-plugin-internal/project.json b/packages/eslint-plugin-internal/project.json
index 803b12f53227..e7ac6302d698 100644
--- a/packages/eslint-plugin-internal/project.json
+++ b/packages/eslint-plugin-internal/project.json
@@ -1,4 +1,5 @@
{
+ "name": "eslint-plugin-internal",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"type": "library",
"implicitDependencies": [],
diff --git a/packages/eslint-plugin-tslint/CHANGELOG.md b/packages/eslint-plugin-tslint/CHANGELOG.md
index 6ad97388e3c9..c03ee8c3ea91 100644
--- a/packages/eslint-plugin-tslint/CHANGELOG.md
+++ b/packages/eslint-plugin-tslint/CHANGELOG.md
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+## [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
diff --git a/packages/eslint-plugin-tslint/README.md b/packages/eslint-plugin-tslint/README.md
index 021b8780bfbd..57c414230ec8 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.
-
-
-
-
-
+[](https://www.npmjs.com/package/@typescript-eslint/eslint-plugin-tslint)
+[](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 d44a4b3d98b5..cd07f8d2a34b 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.45.0",
+ "version": "5.45.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",
@@ -38,7 +38,7 @@
"typecheck": "tsc -p tsconfig.json --noEmit"
},
"dependencies": {
- "@typescript-eslint/utils": "5.45.0",
+ "@typescript-eslint/utils": "5.45.1",
"lodash": "^4.17.21"
},
"peerDependencies": {
@@ -48,6 +48,6 @@
},
"devDependencies": {
"@types/lodash": "*",
- "@typescript-eslint/parser": "5.45.0"
+ "@typescript-eslint/parser": "5.45.1"
}
}
diff --git a/packages/eslint-plugin-tslint/project.json b/packages/eslint-plugin-tslint/project.json
index 6f6c19ca7c58..29bcb865041a 100644
--- a/packages/eslint-plugin-tslint/project.json
+++ b/packages/eslint-plugin-tslint/project.json
@@ -1,4 +1,5 @@
{
+ "name": "eslint-plugin-tslint",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"type": "library",
"implicitDependencies": [],
diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md
index 5d7959eb27ce..3b9c96121c18 100644
--- a/packages/eslint-plugin/CHANGELOG.md
+++ b/packages/eslint-plugin/CHANGELOG.md
@@ -3,6 +3,15 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+## [5.45.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.45.0...v5.45.1) (2022-12-05)
+
+### 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
diff --git a/packages/eslint-plugin/README.md b/packages/eslint-plugin/README.md
index c7c0ea80e4f9..b9dd0cecd032 100644
--- a/packages/eslint-plugin/README.md
+++ b/packages/eslint-plugin/README.md
@@ -1,96 +1,10 @@
-
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.
-
-
-
-
-
+[](https://www.npmjs.com/package/@typescript-eslint/eslint-plugin)
+[](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 7c6bd00d36df..04e2d9870563 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/consistent-type-imports.md b/packages/eslint-plugin/docs/rules/consistent-type-imports.md
index 4ea1f7559943..045b7c2fa7da 100644
--- a/packages/eslint-plugin/docs/rules/consistent-type-imports.md
+++ b/packages/eslint-plugin/docs/rules/consistent-type-imports.md
@@ -90,7 +90,7 @@ const x: import('Bar') = 1;
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/docs/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).
+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
diff --git a/packages/eslint-plugin/docs/rules/member-ordering.md b/packages/eslint-plugin/docs/rules/member-ordering.md
index aaece66adba2..919ec88186ff 100644
--- a/packages/eslint-plugin/docs/rules/member-ordering.md
+++ b/packages/eslint-plugin/docs/rules/member-ordering.md
@@ -1232,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.
@@ -1243,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"]
]
```
@@ -1268,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.
@@ -1278,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/package.json b/packages/eslint-plugin/package.json
index ce7c23c480f3..fd01a7062feb 100644
--- a/packages/eslint-plugin/package.json
+++ b/packages/eslint-plugin/package.json
@@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/eslint-plugin",
- "version": "5.45.0",
+ "version": "5.45.1",
"description": "TypeScript plugin for ESLint",
"keywords": [
"eslint",
@@ -44,9 +44,9 @@
"typecheck": "tsc -p tsconfig.json --noEmit"
},
"dependencies": {
- "@typescript-eslint/scope-manager": "5.45.0",
- "@typescript-eslint/type-utils": "5.45.0",
- "@typescript-eslint/utils": "5.45.0",
+ "@typescript-eslint/scope-manager": "5.45.1",
+ "@typescript-eslint/type-utils": "5.45.1",
+ "@typescript-eslint/utils": "5.45.1",
"debug": "^4.3.4",
"ignore": "^5.2.0",
"natural-compare-lite": "^1.4.0",
diff --git a/packages/eslint-plugin/project.json b/packages/eslint-plugin/project.json
index d3a8c23a138f..72ca4c7a9d01 100644
--- a/packages/eslint-plugin/project.json
+++ b/packages/eslint-plugin/project.json
@@ -1,4 +1,5 @@
{
+ "name": "eslint-plugin",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"type": "library",
"implicitDependencies": [],
diff --git a/packages/eslint-plugin/src/configs/eslint-recommended.ts b/packages/eslint-plugin/src/configs/eslint-recommended.ts
index 71443e1f52ef..af3c0050c011 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/rules/keyword-spacing.ts b/packages/eslint-plugin/src/rules/keyword-spacing.ts
index 32fb2aaeb717..aa09fb3d1b87 100644
--- a/packages/eslint-plugin/src/rules/keyword-spacing.ts
+++ b/packages/eslint-plugin/src/rules/keyword-spacing.ts
@@ -1,5 +1,5 @@
import type { TSESTree } from '@typescript-eslint/utils';
-import { AST_TOKEN_TYPES } 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';
@@ -9,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: {
@@ -20,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, [{ after }]) {
+ create(context, [{ after, overrides }]) {
const sourceCode = context.getSourceCode();
const baseRules = baseRule.create(context);
return {
@@ -54,25 +73,37 @@ export default util.createRule({
'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 (after && spacesBetweenTypeAndPunctuator === 0) {
+ if (
+ (typeOptionOverride.after ?? after) === true &&
+ spacesBetweenTypeAndPunctuator === 0
+ ) {
context.report({
- loc: punctuatorToken.loc,
- messageId: 'expectedBefore',
- data: { value: punctuatorToken.value },
+ loc: typeToken.loc,
+ messageId: 'expectedAfter',
+ data: { value: 'type' },
fix(fixer) {
- return fixer.insertTextBefore(punctuatorToken, ' ');
+ return fixer.insertTextAfter(typeToken, ' ');
},
});
}
- if (!after && spacesBetweenTypeAndPunctuator > 0) {
+ if (
+ (typeOptionOverride.after ?? after) === false &&
+ spacesBetweenTypeAndPunctuator > 0
+ ) {
context.report({
- loc: punctuatorToken.loc,
- messageId: 'unexpectedBefore',
- data: { value: punctuatorToken.value },
+ loc: typeToken.loc,
+ messageId: 'unexpectedAfter',
+ data: { value: 'type' },
fix(fixer) {
return fixer.removeRange([
typeToken.range[1],
diff --git a/packages/eslint-plugin/src/rules/no-shadow.ts b/packages/eslint-plugin/src/rules/no-shadow.ts
index 7d8eff0b9e22..e9b73370966e 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,8 @@ export default util.createRule({
return false;
}
- return variable.defs.every(
- def => def.node.type === AST_NODE_TYPES.TSFunctionType,
+ return variable.defs.every(def =>
+ allowedFunctionVariableDefTypes.has(def.node.type),
);
}
diff --git a/packages/eslint-plugin/src/rules/prefer-optional-chain.ts b/packages/eslint-plugin/src/rules/prefer-optional-chain.ts
index 73fbcc27af3e..9a4949b734bc 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.
@@ -115,10 +116,12 @@ 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.MemberExpression
+ | TSESTree.MetaProperty,
): void {
// selector guarantees this cast
const initialExpression = (
@@ -190,13 +193,15 @@ export default util.createRule({
'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 = (
@@ -342,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';
}
@@ -381,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;
@@ -441,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,
@@ -609,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/sort-type-constituents.ts b/packages/eslint-plugin/src/rules/sort-type-constituents.ts
index 1abeddcf8231..848b2ce0722e 100644
--- a/packages/eslint-plugin/src/rules/sort-type-constituents.ts
+++ b/packages/eslint-plugin/src/rules/sort-type-constituents.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',
@@ -96,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;
@@ -226,7 +219,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/sort-type-union-intersection-members.ts b/packages/eslint-plugin/src/rules/sort-type-union-intersection-members.ts
index 1fbf91b9ae89..cbfa7a515940 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',
@@ -96,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;
@@ -228,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/util/misc.ts b/packages/eslint-plugin/src/util/misc.ts
index 351c94a6361f..fa9c5ccf5287 100644
--- a/packages/eslint-plugin/src/util/misc.ts
+++ b/packages/eslint-plugin/src/util/misc.ts
@@ -203,6 +203,18 @@ function findLastIndex(
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,
@@ -216,6 +228,7 @@ export {
isDefinitionFile,
MemberNameType,
RequireKeys,
+ typeNodeRequiresParentheses,
upperCaseFirst,
findLastIndex,
};
diff --git a/packages/eslint-plugin/tests/rules/keyword-spacing.test.ts b/packages/eslint-plugin/tests/rules/keyword-spacing.test.ts
index b8a1a72d2cac..58c740fbd5cc 100644
--- a/packages/eslint-plugin/tests/rules/keyword-spacing.test.ts
+++ b/packages/eslint-plugin/tests/rules/keyword-spacing.test.ts
@@ -116,12 +116,122 @@ ruleTester.run('keyword-spacing', rule, {
},
{
code: 'import type { foo } from "foo";',
- options: [{ overrides: { as: {} } }],
+ options: [BOTH],
parserOptions: { ecmaVersion: 6, sourceType: 'module' },
},
{
code: "import type * as Foo from 'foo'",
- options: [{ overrides: { as: {} } }],
+ 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' },
},
],
@@ -167,28 +277,58 @@ ruleTester.run('keyword-spacing', rule, {
output: 'import type { foo } from "foo";',
options: [{ after: true, before: true }],
parserOptions: { ecmaVersion: 6, sourceType: 'module' },
- errors: [{ messageId: 'expectedBefore', data: { value: '{' } }],
+ 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: [{ messageId: 'unexpectedBefore', data: { value: '{' } }],
+ 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: [{ messageId: 'expectedBefore', data: { value: '*' } }],
+ 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: [{ messageId: 'unexpectedBefore', data: { value: '*' } }],
+ 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/no-shadow/no-shadow.test.ts b/packages/eslint-plugin/tests/rules/no-shadow/no-shadow.test.ts
index d55e85b3d8f7..854154ff0968 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
@@ -145,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: `
@@ -525,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';
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 e1a1467d80ff..120ad20aaeac 100644
--- a/packages/eslint-plugin/tests/rules/prefer-optional-chain.test.ts
+++ b/packages/eslint-plugin/tests/rules/prefer-optional-chain.test.ts
@@ -211,6 +211,12 @@ ruleTester.run('prefer-optional-chain', rule, {
'!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,
@@ -1321,5 +1327,78 @@ foo?.bar(/* comment */a,
},
],
},
+ {
+ 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/sort-type-constituents.test.ts b/packages/eslint-plugin/tests/rules/sort-type-constituents.test.ts
index 2587375060ed..1aa6f8a6c9a3 100644
--- a/packages/eslint-plugin/tests/rules/sort-type-constituents.test.ts
+++ b/packages/eslint-plugin/tests/rules/sort-type-constituents.test.ts
@@ -287,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',
+ },
+ },
+ ],
+ },
];
};
@@ -334,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/rules/sort-type-union-intersection-members.test.ts b/packages/eslint-plugin/tests/rules/sort-type-union-intersection-members.test.ts
index a24959d8b6a6..6242d140634b 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
@@ -287,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',
+ },
+ },
+ ],
+ },
];
};
@@ -334,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/experimental-utils/CHANGELOG.md b/packages/experimental-utils/CHANGELOG.md
index f441dd8da408..2577ec6c2519 100644
--- a/packages/experimental-utils/CHANGELOG.md
+++ b/packages/experimental-utils/CHANGELOG.md
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+## [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
diff --git a/packages/experimental-utils/README.md b/packages/experimental-utils/README.md
index 3073308c16bb..d1468f928b15 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.
-
-
-
-
-
+[](https://www.npmjs.com/package/@typescript-eslint/experimental-utils)
+[](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 37ea291a0344..93e0193797de 100644
--- a/packages/experimental-utils/package.json
+++ b/packages/experimental-utils/package.json
@@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/experimental-utils",
- "version": "5.45.0",
+ "version": "5.45.1",
"description": "(Experimental) Utilities for working with TypeScript + ESLint together",
"keywords": [
"eslint",
@@ -38,7 +38,7 @@
"typecheck": "tsc -p tsconfig.json --noEmit"
},
"dependencies": {
- "@typescript-eslint/utils": "5.45.0"
+ "@typescript-eslint/utils": "5.45.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 415df390d359..74410fed05a9 100644
--- a/packages/experimental-utils/project.json
+++ b/packages/experimental-utils/project.json
@@ -1,4 +1,5 @@
{
+ "name": "experimental-utils",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"type": "library",
"implicitDependencies": [],
diff --git a/packages/parser/CHANGELOG.md b/packages/parser/CHANGELOG.md
index eba0fcd3c106..1bfb546985f3 100644
--- a/packages/parser/CHANGELOG.md
+++ b/packages/parser/CHANGELOG.md
@@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+## [5.45.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.45.0...v5.45.1) (2022-12-05)
+
+### Bug Fixes
+
+- **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
diff --git a/packages/parser/README.md b/packages/parser/README.md
index b32ed30beab4..f057b97f8680 100644
--- a/packages/parser/README.md
+++ b/packages/parser/README.md
@@ -1,304 +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.
-
-
-
-
-
+[](https://www.npmjs.com/package/@typescript-eslint/parser)
+[](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.
-
-- 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"
- ]
- }
- ```
-
-### `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 2c5846e634b9..319b8049236a 100644
--- a/packages/parser/package.json
+++ b/packages/parser/package.json
@@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/parser",
- "version": "5.45.0",
+ "version": "5.45.1",
"description": "An ESLint custom parser which leverages TypeScript ESTree",
"main": "dist/index.js",
"types": "dist/index.d.ts",
@@ -45,9 +45,9 @@
"eslint": "^6.0.0 || ^7.0.0 || ^8.0.0"
},
"dependencies": {
- "@typescript-eslint/scope-manager": "5.45.0",
- "@typescript-eslint/types": "5.45.0",
- "@typescript-eslint/typescript-estree": "5.45.0",
+ "@typescript-eslint/scope-manager": "5.45.1",
+ "@typescript-eslint/types": "5.45.1",
+ "@typescript-eslint/typescript-estree": "5.45.1",
"debug": "^4.3.4"
},
"devDependencies": {
diff --git a/packages/parser/project.json b/packages/parser/project.json
index 10eb8732ea1e..39cc96379195 100644
--- a/packages/parser/project.json
+++ b/packages/parser/project.json
@@ -1,4 +1,5 @@
{
+ "name": "parser",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"type": "library",
"implicitDependencies": [],
diff --git a/packages/parser/src/parser.ts b/packages/parser/src/parser.ts
index 0e4b7780c170..f151cbdc143e 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/scope-manager/CHANGELOG.md b/packages/scope-manager/CHANGELOG.md
index 7625e49c7f6e..b5a011ffb012 100644
--- a/packages/scope-manager/CHANGELOG.md
+++ b/packages/scope-manager/CHANGELOG.md
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+## [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
diff --git a/packages/scope-manager/README.md b/packages/scope-manager/README.md
index b0a745f3fa53..0258932e390a 100644
--- a/packages/scope-manager/README.md
+++ b/packages/scope-manager/README.md
@@ -1,120 +1,8 @@
-
TypeScript Scope Manager
+# `@typescript-eslint/scope-manager`
-
-
-
-
-
+[](https://www.npmjs.com/package/@typescript-eslint/scope-manager)
+[](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 ab38deddf68c..21910ea60094 100644
--- a/packages/scope-manager/package.json
+++ b/packages/scope-manager/package.json
@@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/scope-manager",
- "version": "5.45.0",
+ "version": "5.45.1",
"description": "TypeScript scope analyser for ESLint",
"keywords": [
"eslint",
@@ -38,12 +38,12 @@
"typecheck": "nx typecheck"
},
"dependencies": {
- "@typescript-eslint/types": "5.45.0",
- "@typescript-eslint/visitor-keys": "5.45.0"
+ "@typescript-eslint/types": "5.45.1",
+ "@typescript-eslint/visitor-keys": "5.45.1"
},
"devDependencies": {
"@types/glob": "*",
- "@typescript-eslint/typescript-estree": "5.45.0",
+ "@typescript-eslint/typescript-estree": "5.45.1",
"glob": "*",
"jest-specific-snapshot": "*",
"make-dir": "*",
diff --git a/packages/scope-manager/project.json b/packages/scope-manager/project.json
index efaf69f925c5..9d4a6c37c9a7 100644
--- a/packages/scope-manager/project.json
+++ b/packages/scope-manager/project.json
@@ -1,14 +1,12 @@
{
+ "name": "scope-manager",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "packages/scope-manager/src",
"projectType": "library",
"targets": {
"build": {
"executor": "nx:run-commands",
- "outputs": [
- "packages/scope-manager/dist",
- "packages/scope-manager/_ts3.4"
- ],
+ "outputs": ["{projectRoot}/dist", "{projectRoot}/_ts3.4"],
"options": {
"parallel": false,
"cwd": "packages/scope-manager",
@@ -60,7 +58,7 @@
},
"test": {
"executor": "@nrwl/jest:jest",
- "outputs": ["packages/scope-manager/coverage"],
+ "outputs": ["{projectRoot}/coverage"],
"options": {
"jestConfig": "packages/scope-manager/jest.config.js",
"passWithNoTests": true
diff --git a/packages/scope-manager/src/analyze.ts b/packages/scope-manager/src/analyze.ts
index e227d1e45ad3..8e8e0d83406f 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/shared-fixtures/CHANGELOG.md b/packages/shared-fixtures/CHANGELOG.md
index ebb26c9c7238..fd5776e26321 100644
--- a/packages/shared-fixtures/CHANGELOG.md
+++ b/packages/shared-fixtures/CHANGELOG.md
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+## [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.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
diff --git a/packages/shared-fixtures/README.md b/packages/shared-fixtures/README.md
index 866a6e866149..eb3bceabc7f8 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.
-
-
-
+## β 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 54f9b423115e..baa3569ddbfc 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.45.0",
+ "version": "5.45.1",
"private": true
}
diff --git a/packages/shared-fixtures/project.json b/packages/shared-fixtures/project.json
index 24256b3e4d0b..18cfac971353 100644
--- a/packages/shared-fixtures/project.json
+++ b/packages/shared-fixtures/project.json
@@ -1,5 +1,6 @@
{
"$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 5d305078ff02..74b3fc9046f9 100644
--- a/packages/type-utils/CHANGELOG.md
+++ b/packages/type-utils/CHANGELOG.md
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+## [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.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
diff --git a/packages/type-utils/README.md b/packages/type-utils/README.md
index 19a4bf7e964d..2f842e803cc5 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.
-
-
-
-
-
+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 e48a5edbae3b..c96e7b171357 100644
--- a/packages/type-utils/package.json
+++ b/packages/type-utils/package.json
@@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/type-utils",
- "version": "5.45.0",
+ "version": "5.45.1",
"description": "Type utilities for working with TypeScript + ESLint together",
"keywords": [
"eslint",
@@ -39,13 +39,13 @@
"typecheck": "tsc -p tsconfig.json --noEmit"
},
"dependencies": {
- "@typescript-eslint/typescript-estree": "5.45.0",
- "@typescript-eslint/utils": "5.45.0",
+ "@typescript-eslint/typescript-estree": "5.45.1",
+ "@typescript-eslint/utils": "5.45.1",
"debug": "^4.3.4",
"tsutils": "^3.21.0"
},
"devDependencies": {
- "@typescript-eslint/parser": "5.45.0",
+ "@typescript-eslint/parser": "5.45.1",
"typescript": "*"
},
"peerDependencies": {
diff --git a/packages/type-utils/project.json b/packages/type-utils/project.json
index efc70d52332f..77fdd9b5fce5 100644
--- a/packages/type-utils/project.json
+++ b/packages/type-utils/project.json
@@ -1,4 +1,5 @@
{
+ "name": "type-utils",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"type": "library",
"implicitDependencies": [],
diff --git a/packages/types/CHANGELOG.md b/packages/types/CHANGELOG.md
index 1a3881e1d3b3..168cef42cc9b 100644
--- a/packages/types/CHANGELOG.md
+++ b/packages/types/CHANGELOG.md
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+## [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.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
diff --git a/packages/types/README.md b/packages/types/README.md
index 273ac71a9368..7a3008bb982a 100644
--- a/packages/types/README.md
+++ b/packages/types/README.md
@@ -1,17 +1,12 @@
-
TypeScript-ESTree Types
+# `@typescript-eslint/types`
-
-
-
-
-
+> 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 caf58ad26184..11886f5f3b64 100644
--- a/packages/types/package.json
+++ b/packages/types/package.json
@@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/types",
- "version": "5.45.0",
+ "version": "5.45.1",
"description": "Types for the TypeScript-ESTree AST spec",
"keywords": [
"eslint",
diff --git a/packages/types/project.json b/packages/types/project.json
index 968c1ed0e23e..74fee293f18a 100644
--- a/packages/types/project.json
+++ b/packages/types/project.json
@@ -1,7 +1,8 @@
{
+ "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",
diff --git a/packages/typescript-estree/CHANGELOG.md b/packages/typescript-estree/CHANGELOG.md
index acf4c9b023d0..2ae3553e9739 100644
--- a/packages/typescript-estree/CHANGELOG.md
+++ b/packages/typescript-estree/CHANGELOG.md
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+## [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.45.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.44.0...v5.45.0) (2022-11-28)
### Bug Fixes
diff --git a/packages/typescript-estree/README.md b/packages/typescript-estree/README.md
index cb1d0d0312c7..4ce7f1e7cf4e 100644
--- a/packages/typescript-estree/README.md
+++ b/packages/typescript-estree/README.md
@@ -1,383 +1,10 @@
-
TypeScript ESTree
+# `@typescript-eslint/typescript-estree`
-
A parser that converts TypeScript source code into an ESTree-compatible form
-
-
-
-
-
-
-
-## 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.
+[](https://www.npmjs.com/package/@typescript-eslint/utils)
+[](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 93b61acfe11d..b7d490ff961a 100644
--- a/packages/typescript-estree/package.json
+++ b/packages/typescript-estree/package.json
@@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/typescript-estree",
- "version": "5.45.0",
+ "version": "5.45.1",
"description": "A parser that converts TypeScript source code into an ESTree compatible form",
"main": "dist/index.js",
"types": "dist/index.d.ts",
@@ -42,8 +42,8 @@
"typecheck": "tsc -p tsconfig.json --noEmit"
},
"dependencies": {
- "@typescript-eslint/types": "5.45.0",
- "@typescript-eslint/visitor-keys": "5.45.0",
+ "@typescript-eslint/types": "5.45.1",
+ "@typescript-eslint/visitor-keys": "5.45.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.45.0",
+ "@typescript-eslint/shared-fixtures": "5.45.1",
"glob": "*",
"jest-specific-snapshot": "*",
"make-dir": "*",
diff --git a/packages/typescript-estree/project.json b/packages/typescript-estree/project.json
index 61848afaa648..2856ffe4f07f 100644
--- a/packages/typescript-estree/project.json
+++ b/packages/typescript-estree/project.json
@@ -1,7 +1,8 @@
{
+ "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",
diff --git a/packages/typescript-estree/src/create-program/createProjectProgram.ts b/packages/typescript-estree/src/create-program/createProjectProgram.ts
index 326100d35784..784b44b93d4d 100644
--- a/packages/typescript-estree/src/create-program/createProjectProgram.ts
+++ b/packages/typescript-estree/src/create-program/createProjectProgram.ts
@@ -4,7 +4,7 @@ import * as ts from 'typescript';
import { firstDefined } from '../node-utils';
import type { ParseSettings } from '../parseSettings';
-import { getProgramsForProjects } from './createWatchProgram';
+import { getWatchProgramsForProjects } from './getWatchProgramsForProjects';
import type { ASTAndProgram } from './shared';
import { getAstFromProgram } from './shared';
@@ -30,7 +30,7 @@ function createProjectProgram(
): ASTAndProgram | undefined {
log('Creating project program for: %s', parseSettings.filePath);
- const programsForProjects = getProgramsForProjects(parseSettings);
+ const programsForProjects = getWatchProgramsForProjects(parseSettings);
const astAndProgram = firstDefined(programsForProjects, currentProgram =>
getAstFromProgram(currentProgram, parseSettings),
);
@@ -105,7 +105,7 @@ function createProjectProgram(
`- 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/docs/linting/troubleshooting##i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file`,
+ `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`,
);
}
diff --git a/packages/typescript-estree/src/create-program/createWatchProgram.ts b/packages/typescript-estree/src/create-program/getWatchProgramsForProjects.ts
similarity index 99%
rename from packages/typescript-estree/src/create-program/createWatchProgram.ts
rename to packages/typescript-estree/src/create-program/getWatchProgramsForProjects.ts
index d17835fff3c8..15d88e5f4540 100644
--- a/packages/typescript-estree/src/create-program/createWatchProgram.ts
+++ b/packages/typescript-estree/src/create-program/getWatchProgramsForProjects.ts
@@ -138,7 +138,9 @@ function updateCachedFileList(
* @param parseSettings Internal settings for parsing the file
* @returns The programs corresponding to the supplied tsconfig paths
*/
-function getProgramsForProjects(parseSettings: ParseSettings): ts.Program[] {
+function getWatchProgramsForProjects(
+ parseSettings: ParseSettings,
+): ts.Program[] {
const filePath = getCanonicalFileName(parseSettings.filePath);
const results = [];
@@ -548,4 +550,4 @@ function maybeInvalidateProgram(
return null;
}
-export { clearWatchCaches, createWatchProgram, getProgramsForProjects };
+export { clearWatchCaches, getWatchProgramsForProjects };
diff --git a/packages/typescript-estree/src/index.ts b/packages/typescript-estree/src/index.ts
index 48c9fb1ab88a..bc7ed6024f3b 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/warnAboutTSVersion.ts b/packages/typescript-estree/src/parseSettings/warnAboutTSVersion.ts
index ad9a74157d6c..191ac029325a 100644
--- a/packages/typescript-estree/src/parseSettings/warnAboutTSVersion.ts
+++ b/packages/typescript-estree/src/parseSettings/warnAboutTSVersion.ts
@@ -3,8 +3,8 @@ import * as ts from 'typescript';
import type { ParseSettings } from './index';
/**
- * This needs to be kept in sync with the top-level README.md in the
- * typescript-eslint monorepo
+ * 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';
diff --git a/packages/typescript-estree/src/parser-options.ts b/packages/typescript-estree/src/parser-options.ts
index cec95c3b413d..632d9e6ae883 100644
--- a/packages/typescript-estree/src/parser-options.ts
+++ b/packages/typescript-estree/src/parser-options.ts
@@ -3,9 +3,9 @@ import type * as ts from 'typescript';
import type { TSESTree, TSESTreeToTSNode, TSNode, TSToken } from './ts-estree';
-////////////////////////////////////////////////////
-// 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/tests/lib/__snapshots__/parse.test.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/parse.test.ts.snap
index 81341b5e35f2..108fdad11a14 100644
--- a/packages/typescript-estree/tests/lib/__snapshots__/parse.test.ts.snap
+++ b/packages/typescript-estree/tests/lib/__snapshots__/parse.test.ts.snap
@@ -23,7 +23,7 @@ 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/docs/linting/troubleshooting##i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file"
+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`] = `
@@ -32,7 +32,7 @@ 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/docs/linting/troubleshooting##i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file"
+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`] = `
@@ -41,7 +41,7 @@ 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/docs/linting/troubleshooting##i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file"
+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`] = `
@@ -50,7 +50,7 @@ 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/docs/linting/troubleshooting##i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file"
+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`] = `
@@ -59,7 +59,7 @@ 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/docs/linting/troubleshooting##i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file"
+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`] = `
@@ -68,7 +68,7 @@ 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/docs/linting/troubleshooting##i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file"
+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`] = `
@@ -79,7 +79,7 @@ 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/docs/linting/troubleshooting##i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file"
+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/persistentParse.test.ts b/packages/typescript-estree/tests/lib/persistentParse.test.ts
index b6ef717afa0b..63e81d7e260a 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 b9bd5adb87b1..33daa30a13f0 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 fae6a3836628..3ebe689185e1 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';
diff --git a/packages/utils/CHANGELOG.md b/packages/utils/CHANGELOG.md
index 81eee28e5465..20b59ba3771d 100644
--- a/packages/utils/CHANGELOG.md
+++ b/packages/utils/CHANGELOG.md
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+## [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.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
diff --git a/packages/utils/README.md b/packages/utils/README.md
index d517cc457a53..8013675d9625 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.
-
-
-
-
-
+[](https://www.npmjs.com/package/@typescript-eslint/utils)
+[](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 80a37b641f62..1bd7d891079a 100644
--- a/packages/utils/package.json
+++ b/packages/utils/package.json
@@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/utils",
- "version": "5.45.0",
+ "version": "5.45.1",
"description": "Utilities for working with TypeScript + ESLint together",
"keywords": [
"eslint",
@@ -41,9 +41,9 @@
"dependencies": {
"@types/json-schema": "^7.0.9",
"@types/semver": "^7.3.12",
- "@typescript-eslint/scope-manager": "5.45.0",
- "@typescript-eslint/types": "5.45.0",
- "@typescript-eslint/typescript-estree": "5.45.0",
+ "@typescript-eslint/scope-manager": "5.45.1",
+ "@typescript-eslint/types": "5.45.1",
+ "@typescript-eslint/typescript-estree": "5.45.1",
"eslint-scope": "^5.1.1",
"eslint-utils": "^3.0.0",
"semver": "^7.3.7"
@@ -52,7 +52,7 @@
"eslint": "^6.0.0 || ^7.0.0 || ^8.0.0"
},
"devDependencies": {
- "@typescript-eslint/parser": "5.45.0",
+ "@typescript-eslint/parser": "5.45.1",
"typescript": "*"
},
"funding": {
diff --git a/packages/utils/project.json b/packages/utils/project.json
index 7ef570436b4c..c38b32ab3a25 100644
--- a/packages/utils/project.json
+++ b/packages/utils/project.json
@@ -1,4 +1,5 @@
{
+ "name": "utils",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"type": "library",
"implicitDependencies": [],
diff --git a/packages/visitor-keys/CHANGELOG.md b/packages/visitor-keys/CHANGELOG.md
index e040c42f8090..a4f273986a45 100644
--- a/packages/visitor-keys/CHANGELOG.md
+++ b/packages/visitor-keys/CHANGELOG.md
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+## [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.45.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.44.0...v5.45.0) (2022-11-28)
### Features
diff --git a/packages/visitor-keys/README.md b/packages/visitor-keys/README.md
index 839c20c4954d..1745172a6f20 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.
-
-
-
-
-
+## β 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 a1637e76adb9..562b44ab3680 100644
--- a/packages/visitor-keys/package.json
+++ b/packages/visitor-keys/package.json
@@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/visitor-keys",
- "version": "5.45.0",
+ "version": "5.45.1",
"description": "Visitor keys used to help traverse the TypeScript-ESTree AST",
"keywords": [
"eslint",
@@ -39,7 +39,7 @@
"typecheck": "tsc -p tsconfig.json --noEmit"
},
"dependencies": {
- "@typescript-eslint/types": "5.45.0",
+ "@typescript-eslint/types": "5.45.1",
"eslint-visitor-keys": "^3.3.0"
},
"devDependencies": {
diff --git a/packages/visitor-keys/project.json b/packages/visitor-keys/project.json
index c7e3401148e7..ab99ec943a66 100644
--- a/packages/visitor-keys/project.json
+++ b/packages/visitor-keys/project.json
@@ -1,4 +1,5 @@
{
+ "name": "visitor-keys",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"type": "library",
"implicitDependencies": [],
diff --git a/packages/website-eslint/CHANGELOG.md b/packages/website-eslint/CHANGELOG.md
index 1e9c3506cc98..f79b0dfdaf79 100644
--- a/packages/website-eslint/CHANGELOG.md
+++ b/packages/website-eslint/CHANGELOG.md
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+## [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
diff --git a/packages/website-eslint/package.json b/packages/website-eslint/package.json
index 2922dc49fbab..e5fa1dd65597 100644
--- a/packages/website-eslint/package.json
+++ b/packages/website-eslint/package.json
@@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/website-eslint",
- "version": "5.45.0",
+ "version": "5.45.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.45.0",
- "@typescript-eslint/utils": "5.45.0"
+ "@typescript-eslint/types": "5.45.1",
+ "@typescript-eslint/utils": "5.45.1"
},
"devDependencies": {
"@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.45.0",
- "@typescript-eslint/parser": "5.45.0",
- "@typescript-eslint/scope-manager": "5.45.0",
- "@typescript-eslint/typescript-estree": "5.45.0",
- "@typescript-eslint/visitor-keys": "5.45.0",
+ "@typescript-eslint/eslint-plugin": "5.45.1",
+ "@typescript-eslint/parser": "5.45.1",
+ "@typescript-eslint/scope-manager": "5.45.1",
+ "@typescript-eslint/typescript-estree": "5.45.1",
+ "@typescript-eslint/visitor-keys": "5.45.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 24256b3e4d0b..517439cbec3d 100644
--- a/packages/website-eslint/project.json
+++ b/packages/website-eslint/project.json
@@ -1,5 +1,6 @@
{
"$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 77c6d5280036..825b60cec254 100644
--- a/packages/website-eslint/rollup.config.js
+++ b/packages/website-eslint/rollup.config.js
@@ -30,7 +30,7 @@ module.exports = {
/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/CHANGELOG.md b/packages/website/CHANGELOG.md
index 2bf6057010dd..d75789de1548 100644
--- a/packages/website/CHANGELOG.md
+++ b/packages/website/CHANGELOG.md
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+## [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
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 000000000000..17da83da75d0
--- /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/data/sponsors.json b/packages/website/data/sponsors.json
index 49d7576bf770..fef41913d975 100644
--- a/packages/website/data/sponsors.json
+++ b/packages/website/data/sponsors.json
@@ -10,23 +10,30 @@
"id": "Nx (by Nrwl)",
"image": "https://images.opencollective.com/nx/0efbe42/logo.png",
"name": "Nx (by Nrwl)",
- "totalDonations": 550000,
+ "totalDonations": 575000,
"website": "https://nx.dev"
},
{
"id": "ESLint",
"image": "https://images.opencollective.com/eslint/96b09dc/logo.png",
"name": "ESLint",
- "totalDonations": 215000,
+ "totalDonations": 230000,
"website": "https://eslint.org/"
},
{
"id": "Airbnb",
"image": "https://images.opencollective.com/airbnb/d327d66/logo.png",
"name": "Airbnb",
- "totalDonations": 140800,
+ "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",
@@ -35,11 +42,11 @@
"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",
- "totalDonations": 115000,
- "website": "https://n8n.io"
+ "id": "GitBook",
+ "image": "https://images.opencollective.com/gitbook/d35a8e7/logo.png",
+ "name": "GitBook",
+ "totalDonations": 120000,
+ "website": "https://www.gitbook.com"
},
{
"id": "Sentry",
@@ -48,18 +55,11 @@
"totalDonations": 114800,
"website": "https://sentry.io/welcome/"
},
- {
- "id": "GitBook",
- "image": "https://images.opencollective.com/gitbook/d35a8e7/logo.png",
- "name": "GitBook",
- "totalDonations": 110000,
- "website": "https://www.gitbook.com"
- },
{
"id": "Codecademy",
"image": "https://images.opencollective.com/codecademy/d56a48d/logo.png",
"name": "Codecademy",
- "totalDonations": 100000,
+ "totalDonations": 110000,
"website": "https://codecademy.com"
},
{
@@ -69,6 +69,13 @@
"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",
@@ -76,13 +83,6 @@
"totalDonations": 54000,
"website": "https://www.future-processing.com/"
},
- {
- "id": "Sourcegraph",
- "image": "https://images.opencollective.com/sourcegraph/67e40ff/logo.png",
- "name": "Sourcegraph",
- "totalDonations": 50000,
- "website": "https://about.sourcegraph.com"
- },
{
"id": "Whitebox",
"image": "https://images.opencollective.com/whiteboxinc/ef0d11d/logo.png",
@@ -90,6 +90,13 @@
"totalDonations": 40000,
"website": "https://whitebox.com"
},
+ {
+ "id": "Codiga",
+ "image": "https://images.opencollective.com/codiga/1065f9f/logo.png",
+ "name": "Codiga",
+ "totalDonations": 40000,
+ "website": "https://www.codiga.io"
+ },
{
"id": "Monito",
"image": "https://images.opencollective.com/monito/50fc878/logo.png",
@@ -97,18 +104,11 @@
"totalDonations": 30000,
"website": "https://www.monito.com"
},
- {
- "id": "Codiga",
- "image": "https://images.opencollective.com/codiga/1065f9f/logo.png",
- "name": "Codiga",
- "totalDonations": 30000,
- "website": "https://www.codiga.io"
- },
{
"id": "STORIS",
"image": "https://images.opencollective.com/storis/dfb0e13/logo.png",
"name": "STORIS",
- "totalDonations": 27000,
+ "totalDonations": 28500,
"website": "https://www.storis.com/"
},
{
@@ -129,7 +129,7 @@
"id": "David Johnston",
"image": "https://images.opencollective.com/blacksheepcode/976d69a/avatar.png",
"name": "David Johnston",
- "totalDonations": 15000,
+ "totalDonations": 15500,
"website": "https://blacksheepcode.com"
},
{
@@ -139,6 +139,20 @@
"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",
@@ -146,13 +160,6 @@
"totalDonations": 10000,
"website": "http://gian.xyz"
},
- {
- "id": "Evil Martians",
- "image": "https://images.opencollective.com/evilmartians/707ab4d/logo.png",
- "name": "Evil Martians",
- "totalDonations": 10000,
- "website": "https://evilmartians.com/"
- },
{
"id": "The Guardian",
"image": "https://images.opencollective.com/gdndevelopers/0b72bf0/logo.png",
@@ -160,13 +167,6 @@
"totalDonations": 10000,
"website": "https://www.theguardian.com/"
},
- {
- "id": "Balsa",
- "image": "https://images.opencollective.com/balsa/77de498/logo.png",
- "name": "Balsa",
- "totalDonations": 10000,
- "website": "https://balsa.com"
- },
{
"id": "Laserhub",
"image": "https://images.opencollective.com/laserhub/bae6275/logo.png",
diff --git a/packages/website/docusaurusConfig.ts b/packages/website/docusaurusConfig.ts
index 7ac111820f2c..7ad2d275be8a 100644
--- a/packages/website/docusaurusConfig.ts
+++ b/packages/website/docusaurusConfig.ts
@@ -45,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,
@@ -75,20 +75,17 @@ const themeConfig: ThemeCommonConfig & AlgoliaThemeConfig = {
},
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',
},
diff --git a/packages/website/package.json b/packages/website/package.json
index d98523269042..cdab7c0c2626 100644
--- a/packages/website/package.json
+++ b/packages/website/package.json
@@ -1,6 +1,6 @@
{
"name": "website",
- "version": "5.45.0",
+ "version": "5.45.1",
"private": true,
"scripts": {
"build": "docusaurus build",
@@ -21,8 +21,8 @@
"@docusaurus/remark-plugin-npm2yarn": "~2.2.0",
"@docusaurus/theme-common": "~2.2.0",
"@mdx-js/react": "1.6.22",
- "@typescript-eslint/parser": "5.45.0",
- "@typescript-eslint/website-eslint": "5.45.0",
+ "@typescript-eslint/parser": "5.45.1",
+ "@typescript-eslint/website-eslint": "5.45.1",
"clsx": "^1.1.1",
"eslint": "*",
"json-schema": "^0.4.0",
@@ -48,7 +48,7 @@
"@types/react": "^18.0.9",
"@types/react-helmet": "^6.1.5",
"@types/react-router-dom": "^5.3.3",
- "@typescript-eslint/eslint-plugin": "5.45.0",
+ "@typescript-eslint/eslint-plugin": "5.45.1",
"copy-webpack-plugin": "^11.0.0",
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-react": "^7.29.4",
diff --git a/packages/website/plugins/generated-rule-docs.ts b/packages/website/plugins/generated-rule-docs.ts
index 04f35189f5cf..37bd4e02cc40 100644
--- a/packages/website/plugins/generated-rule-docs.ts
+++ b/packages/website/plugins/generated-rule-docs.ts
@@ -80,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',
diff --git a/packages/website/project.json b/packages/website/project.json
index a9f414356b18..e7e7b0eabbfc 100644
--- a/packages/website/project.json
+++ b/packages/website/project.json
@@ -1,4 +1,5 @@
{
+ "name": "website",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"type": "library",
"implicitDependencies": [],
diff --git a/packages/website/sidebars/sidebar.base.js b/packages/website/sidebars/sidebar.base.js
index 81b219c541ce..89fa0e543f36 100644
--- a/packages/website/sidebars/sidebar.base.js
+++ b/packages/website/sidebars/sidebar.base.js
@@ -35,25 +35,37 @@ 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: [
- {
- label: 'Architecture',
- type: 'category',
- collapsible: false,
- items: [
- 'development/architecture/asts',
- 'development/architecture/packages',
- ],
- },
- 'development/custom-rules',
+ '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',
},
{
- collapsible: false,
items: [
'maintenance/issues',
'maintenance/pull-requests',
diff --git a/packages/website/src/pages/index.tsx b/packages/website/src/pages/index.tsx
index 8dc318973cdc..c66571392d4e 100644
--- a/packages/website/src/pages/index.tsx
+++ b/packages/website/src/pages/index.tsx
@@ -119,7 +119,10 @@ function Feature({ title, description }: FeatureItem): JSX.Element {
{description}
-
+
Get Started
@@ -138,7 +141,7 @@ function Home(): JSX.Element {