Skip to content

Commit

Permalink
Merge branch 'main' into fix/2206
Browse files Browse the repository at this point in the history
  • Loading branch information
yeonjuan committed Feb 20, 2024
2 parents ef25a3d + f36f682 commit d759d3f
Show file tree
Hide file tree
Showing 116 changed files with 1,727 additions and 594 deletions.
1 change: 1 addition & 0 deletions .cspell.json
Expand Up @@ -58,6 +58,7 @@
"autofixers",
"autofixes",
"automations",
"auvred",
"backticks",
"bigint",
"bivariant",
Expand Down
15 changes: 15 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,18 @@
## 7.0.2 (2024-02-19)


### 🩹 Fixes

- fix tsconfig-less check errors, fix `@types/eslint` incompatibilities, add tests ([#8460](https://github.com/typescript-eslint/typescript-eslint/pull/8460))
- **utils:** use mergeable interface for `settings` property ([#8485](https://github.com/typescript-eslint/typescript-eslint/pull/8485))

### ❤️ Thank You

- Brad Zacher @bradzacher
- Gareth Jones @G-Rath

You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website.

## 7.0.1 (2024-02-12)


Expand Down
6 changes: 4 additions & 2 deletions docs/Developers.mdx
Expand Up @@ -6,5 +6,7 @@ title: Developers
These are the developer guides to working with the typescript-eslint tooling.
It's intended for use by third-parties who want to use our tools to build great things.

> If you're reading this as a new developer: welcome to the community!
> We're happy to have you! ❤️‍🔥
:::info Welcome!
If you're reading this as a new developer: welcome to the community!
We're happy to have you! ❤️‍🔥
:::
2 changes: 1 addition & 1 deletion docs/Packages.mdx
Expand Up @@ -12,7 +12,7 @@ As of v7 and ESLint 9, most users should be using the **[`typescript-eslint`](./
It exports configurations for ESLint and brings along the corresponding versions of other packages as dependencies.

:::tip
See [Getting Started](./Getting_Started.mdx) for guidance on setting up typescript-eslint on a project.
See [Getting Started](./getting-started/Quickstart.mdx) for guidance on setting up typescript-eslint on a project.
:::

## Other Packages
Expand Down
Expand Up @@ -3,13 +3,16 @@ id: legacy-eslint-setup
title: Legacy ESLint Setup
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

## Quickstart

These steps will get you running ESLint with our recommended rules on your TypeScript code as quickly as possible.

:::note
This page is for [ESLint's legacy config format](https://eslint.org/docs/latest/use/configure/configuration-files).
See [Getting Started](../Getting_Started.mdx) for [ESLint's new "flat" configuration format](https://eslint.org/docs/latest/use/configure/configuration-files-new).
See [Getting Started](../getting-started/Quickstart.mdx) for [ESLint's new "flat" configuration format](https://eslint.org/docs/latest/use/configure/configuration-files-new).
:::

### Step 1: Installation
Expand Down Expand Up @@ -83,7 +86,7 @@ ESLint will lint all TypeScript compatible files within the current folder, and

We provide a plethora of powerful rules that utilize the power of TypeScript's type information. [Visit _Typed Rules_ for a setup guide](./Typed_Linting.mdx).

If you're having problems getting this working, please have a look at our [Troubleshooting & FAQs](./Troubleshooting.mdx).
If you're having problems getting this working, please have a look at our [Troubleshooting & FAQs](../troubleshooting/FAQ.mdx).

### Documentation Resources

Expand Down
42 changes: 26 additions & 16 deletions docs/Getting_Started.mdx → docs/getting-started/Quickstart.mdx
@@ -1,28 +1,36 @@
---
id: getting-started
id: quickstart
title: Getting Started
slug: /getting-started/
pagination_next: getting-started/typed-linting
---

## Quickstart

These steps will get you running ESLint with our recommended rules on your TypeScript code as quickly as possible.
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

:::note
This page is for [ESLint's new "flat" config format](https://eslint.org/docs/latest/use/configure/configuration-files-new).
See [Legacy ESLint Setup](./linting/Legacy_ESLint_Setup.mdx) for [ESLint's legacy format](https://eslint.org/docs/latest/use/configure/configuration-files).
This page is a quick-start guide for [ESLint's new "flat" config format](https://eslint.org/docs/latest/use/configure/configuration-files-new) to help you go from zero to linting as quick as possible.

- For the same guide but for [ESLint's legacy format](https://eslint.org/docs/latest/use/configure/configuration-files) — see [Legacy ESLint Setup](./Legacy_ESLint_Setup.mdx).
- For quickstart information on linting with type information — see [Typed Linting](./Typed_Linting.mdx).

:::

## Quickstart

These steps will get you running ESLint with our recommended rules on your TypeScript code as quickly as possible.

### Step 1: Installation

First, install the required packages for [ESLint](https://eslint.org), [TypeScript](https://typescriptlang.org), and this plugin:
First, install the required packages for [ESLint](https://eslint.org), [TypeScript](https://typescriptlang.org), and [our tooling](../packages/TypeScript_ESLint.mdx):

```bash npm2yarn
npm install --save-dev eslint typescript typescript-eslint
```

### Step 2: Configuration

Next, create a `eslint.config.js` config file in the root of your project, and populate it with the following:
Next, create an `eslint.config.js` config file in the root of your project, and populate it with the following:

```js title="eslint.config.js"
// @ts-check
Expand All @@ -36,6 +44,8 @@ export default tseslint.config(
);
```

This code will enable our [recommended configuration](../users/Shared_Configurations.mdx) for linting.

### Step 3: Running ESLint

Open a terminal to the root of your project and run the following command:
Expand Down Expand Up @@ -68,19 +78,19 @@ ESLint will lint all TypeScript compatible files within the current folder, and

## Details

The [`config`](./packages/TypeScript_ESLint.mdx) helper sets three parts of ESLint:

- [Parser](https://eslint.org/docs/latest/use/configure/parser): set to [`@typescript-eslint/parser`](./packages/Parser.mdx) so ESLint knows how to parse the new pieces of TypeScript syntax.
- [Plugins](https://eslint.org/docs/latest/use/configure/plugins): set to [`@typescript-eslint/eslint-plugin`](./packages/ESLint_Plugin.mdx) to load [rules listed in our _Rules_ page](./Rules).
- [Rules](https://eslint.org/docs/latest/use/configure/rules): extends from our [recommended configuration](http://localhost:3000/linting/configs#recommended) to enable our most commonly useful lint rules.
- `tseslint.config(...)` is an _optional_ helper function — [read more about it here](../packages/TypeScript_ESLint.mdx#config).
- `'@eslint/js'` / `eslint.configs.recommended` turns on [eslint's recommended config](https://www.npmjs.com/package/@eslint/js).
- `...tseslint.configs.recommended` turns on [our recommended config](../users/Shared_Configurations.mdx#recommended).

See [ESLint's Configuration Files docs](https://eslint.org/docs/user-guide/configuring/configuration-files) for more details on configuring ESLint.
See [ESLint's Configuration Files docs](https://eslint.org/docs/user-guide/configuring/configuration-files-new) for more details on configuring ESLint.

## Next Steps

We provide a plethora of powerful rules that utilize the power of TypeScript's type information. [Visit the next page for a setup guide](./linting/Typed_Linting.mdx 'Visit the next page for a typed rules setup guide').
We provide a plethora of powerful rules that utilize the power of TypeScript's type information.

[Visit the next page for a setup guide](./Typed_Linting.mdx 'Visit the next page for a typed rules setup guide').

If you're having problems getting this working, please have a look at our [Troubleshooting & FAQs](./linting/Troubleshooting.mdx).
If you're having problems getting this working, please have a look at our [Troubleshooting & FAQs](../troubleshooting/FAQ.mdx).

### Documentation Resources

Expand Down
@@ -1,6 +1,7 @@
---
id: typed-linting
title: Linting with Type Information
pagination_next: getting-started/typed-linting/monorepos
---

import Tabs from '@theme/Tabs';
Expand Down Expand Up @@ -38,7 +39,7 @@ For CommonJS modules and/or older versions of Node.js, [use `__dirname` or an al

In more detail:

- `tseslint.configs.recommendedTypeChecked` is another [recommended configuration](./Configurations.mdx) we provide. This one contains recommended rules that additionally require type information.
- `tseslint.configs.recommendedTypeChecked` is another [recommended configuration](../users/Shared_Configurations.mdx) we provide. This one contains recommended rules that additionally require type information.
- `parserOption.project` tells our parser how to find the TSConfig for each source file (`true` indicates to find the closest `tsconfig.json` for each source file)
- If your project is a multi-package monorepo, see [our docs on configuring a monorepo](./typed-linting/Monorepos.mdx).

Expand Down Expand Up @@ -69,7 +70,7 @@ module.exports = {

In more detail:

- `plugin:@typescript-eslint/recommended-type-checked` is another [recommended configuration](./Configurations.mdx) we provide. This one contains recommended rules that additionally require type information.
- `plugin:@typescript-eslint/recommended-type-checked` is another [recommended configuration](../users/Shared_Configurations.mdx) we provide. This one contains recommended rules that additionally require type information.
- `parserOptions.project` tells our parser how to find the TSConfig for each source file (`true` indicates to find the closest `tsconfig.json` for each source file)
- If your project is a multi-package monorepo, see [our docs on configuring a monorepo](./typed-linting/Monorepos.mdx).
- `parserOptions.tsconfigRootDir` tells our parser the absolute path of your project's root directory (see [Parser#tsconfigRootDir](../packages/Parser.mdx#tsconfigrootdir)).
Expand All @@ -79,7 +80,7 @@ In more detail:

:::caution
Your ESLint config file may start receiving a parsing error about type information.
See [our TSConfig inclusion FAQ](./Troubleshooting.mdx#i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file).
See [our TSConfig inclusion FAQ](../troubleshooting/FAQ.mdx#i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file).
:::

With that done, run the same lint command you ran before.
Expand Down Expand Up @@ -137,7 +138,7 @@ If your project is a multi-package monorepo, see [our docs on configuring a mono

### How can I disable type-aware linting for a subset of files?

You can combine ESLint's [overrides](https://eslint.org/docs/latest/use/configure/configuration-files#configuration-based-on-glob-patterns) config in conjunction with our [`disable-type-checked`](./Configurations.mdx#disable-type-checked) config to turn off type-aware linting on specific subsets of files.
You can combine ESLint's [overrides](https://eslint.org/docs/latest/use/configure/configuration-files#configuration-based-on-glob-patterns) config in conjunction with our [`disable-type-checked`](../users/Shared_Configurations.mdx#disable-type-checked) config to turn off type-aware linting on specific subsets of files.

<Tabs groupId="eslint-config">
<TabItem value="Flat Config">
Expand Down Expand Up @@ -211,8 +212,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 in our [Troubleshooting and FAQs page](./Troubleshooting.mdx#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/FAQ.mdx#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 and FAQs page](./Troubleshooting.mdx).
If you're having problems getting this working, please have a look at our [Troubleshooting and FAQs page](../troubleshooting/FAQ.mdx).
@@ -1,6 +1,7 @@
---
id: monorepos
title: Monorepo Configuration
pagination_next: null
---

import Tabs from '@theme/Tabs';
Expand Down Expand Up @@ -158,4 +159,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.mdx).
If you're having problems getting this working, please have a look at our [Troubleshooting FAQ](../../troubleshooting/FAQ.mdx).
33 changes: 29 additions & 4 deletions docs/maintenance/Issues.mdx
Expand Up @@ -44,13 +44,22 @@ Most issues go through the following review flow when created or updated:
- Add the `duplicate` label and remove the `triage` label
- If it's an obvious duplicate, post a _Clearly Duplicate Issue_ response linking to the existing issue
- If it's not an obvious duplicate, link to the existing issue and explain why
- Close the issue as _not planned_
- If the code is working as intended:
- Add the `working as intended` label and remove the `bug` and `triage` labels
- If the behavior is due to the user doing something wrong, such as an incorrect config:
- Add the `fix: user error` label
- [This issue search has some examples of closing comments](https://github.com/typescript-eslint/typescript-eslint/issues?q=is%3Aissue+sort%3Aupdated-desc+label%3A%22fix%3A+user+error%22+is%3Aclosed)
- If the behavior is otherwise expected, [this issue search has some examples of closing comments](https://github.com/typescript-eslint/typescript-eslint/issues?q=is%3Aissue+sort%3Aupdated-desc+label%3A%22working+as+intended%22+-label%3A%22fix%3A+user+error%22+is%3Aclosed+)
- You needn't go into too much detail in your comment - just enough to explain it
- Close the issue as _not planned_
- If issue contains an enhancement-like request that is unlikely to be implemented on the typescript-eslint side:
- Add the `wontfix` label and remove `triage` label
- [Issue search with some examples of closing comments](https://github.com/typescript-eslint/typescript-eslint/issues?q=is%3Aissue+sort%3Aupdated-desc+label%3Awontfix+is%3Aclosed)
- If there're any alternatives or approaches to meet the request, it would be nice to suggest them
- Close the issue as _not planned_
- If the issue requires further discussion or community engagement evaluation:
- Add the `evaluating community engagement` label and remove the `triage` label
2. If the report is valid, add the `accepting prs` label and remove the `triage` label
3. If you know the rough steps for a fix, consider writing a comment with links to codebase to help someone put together a fix
4. If you think that the fix is relatively straightforward, consider also adding the `good first issue` label
Expand All @@ -66,16 +75,32 @@ If your link is both a "permalink" (includes a commit hash instead of a branch n
When viewing a file in GitHub pressing `y` will update the URL to a "permalink" with the current commit hash, then you can select the relevant lines and paste that URL into the comment.
:::

### Looking for Duplicates

It's worth noting that, occasionally, a user will intentionally raise a duplicate issue because they feel the original issue was closed when it shouldn't have been.
If this is the case, you should read the original issue to gather context, understand the reason for it being closed, and determine if the new issue raises any new or relevant point that requires addressing.

### Determining Whether Code is Working As Intended

As you become more familiar with the codebase and how everything works, this will be easier to do intuitively, but to begin with, this will likely involve investigating the documentation, code, and tests to determine if it's a bug or working as intended.
In general, if there is a passing test or documented example that is the same as or similar to the repro code — that indicates it's working as intended.
If you can't find anything that matches, use your best judgement based on the spirit of the code.

### Looking for Duplicates
### Community Engagement Evaluation

It's worth noting that, occasionally, a user will intentionally raise a duplicate issue because they feel the original issue was closed when it shouldn't have been.
If this is the case, you should read the original issue to gather context, understand the reason for it being closed, and determine if the new issue raises any new or relevant point that requires addressing.
In most cases, maintainers have a pretty good idea of how people write code and what most users of the typescript-eslint tooling want.
However, there are cases when maintainers can't confidently choose the most reasonable approach to solving a particular problem:

- The issue subject relates to a library/framework that the maintainers are not familiar with. Therefore, they don't know the idiomatic patterns associated with it.
- There is a new syntax or a new feature - sometimes it's hard to guess how people might use that feature.
- The issue was about to be closed, but someone made a compelling argument. This requires further discussion to find a viewpoint that most people agree on.

3-6 months after the issue is labeled `evaluating community engagement`, the engagement of community is evaluated:

- If the community was active and common ground was found, the issue is labeled as `accepting prs`
- Otherwise, the issue is closed as _not planned_ with the `wontfix` label

For requests that can be implemented outside of typescript-eslint, be sure to mention any relevant APIs such as [Custom Rules](../developers/Custom_Rules.mdx) that can be used.

## Skipping Steps

Expand Down Expand Up @@ -116,7 +141,7 @@ We avoid features that:
- Are only relevant for a minority of users, as they aren't likely worth the maintenance burden
- Aren't TypeScript-specific (e.g. should be in ESLint core instead)
- Are only relevant with specific userland frameworks or libraries, such as Jest or React
- Are for "formatting" functionality (we [strongly recommend users use a separate dedicated formatter](../linting/troubleshooting/Formatting.mdx))
- Are for "formatting" functionality (we [strongly recommend users use a separate dedicated formatter](../troubleshooting/Formatting.mdx))

#### ✨ Rule Enhancements

Expand Down
7 changes: 6 additions & 1 deletion docs/maintenance/Team.mdx
Expand Up @@ -72,6 +72,11 @@ TypeScript linting experience great.
name: 'Joshua Chen',
username: 'josh-cena',
},
{
description: '...',
name: 'auvred',
username: 'auvred',
},
]}
description="Code committers who regularly work on the code in the repository."
explanation="Committers triage issues, review pull requests, and write code to push the project's functionality and stability forward."
Expand All @@ -94,5 +99,5 @@ We're eternally grateful to every individual and organization able to help us ke

See [`.github/SPONSORSHIPS.md`](https://github.com/typescript-eslint/typescript-eslint/blob/main/.github/SPONSORSHIPS.md) for documentation on how and why to sponsor us.

You can find our biggest sponsors on [typescript-eslint.io > Financial Contributors](https://typescript-eslint.io/#financial-contributors).
You can find our biggest sponsors on [typescript-eslint.io > Financial Contributors](/#financial-contributors).
More can be found on [our Open Collective](https://opencollective.com/typescript-eslint).
2 changes: 1 addition & 1 deletion docs/packages/ESLint_Plugin.mdx
Expand Up @@ -8,7 +8,7 @@ sidebar_label: eslint-plugin
> The TypeScript plugin for ESLint. ✨
:::info
See [Getting Started](../Getting_Started.mdx) for documentation on how to lint your TypeScript code with ESLint.
See [Getting Started](../getting-started/Quickstart.mdx) 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.
Expand Down

0 comments on commit d759d3f

Please sign in to comment.