Skip to content

Commit

Permalink
Merge branch 'main'
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaKGoldberg committed Jan 31, 2023
2 parents 92b73a8 + 5bf7f7f commit 2073b68
Show file tree
Hide file tree
Showing 124 changed files with 1,066 additions and 516 deletions.
2 changes: 2 additions & 0 deletions .cspell.json
Expand Up @@ -62,6 +62,7 @@
"declarators",
"destructure",
"destructured",
"discoverability",
"dprint",
"errored",
"erroring",
Expand Down Expand Up @@ -120,6 +121,7 @@
"unoptimized",
"unprefixed",
"upsert",
"warnonunsupportedtypescriptversion",
"Zacher"
],
"overrides": [
Expand Down
7 changes: 7 additions & 0 deletions .eslintrc.js
Expand Up @@ -106,6 +106,13 @@ module.exports = {
//

curly: ['error', 'all'],
eqeqeq: [
'error',
'always',
{
null: 'never',
},
],
'no-mixed-operators': 'error',
'no-console': 'error',
'no-process-exit': 'error',
Expand Down
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Expand Up @@ -8,7 +8,7 @@ Otherwise we may not be able to review your PR.

- [ ] Addresses an existing open issue: fixes #000
- [ ] That issue was marked as [accepting prs](https://github.com/typescript-eslint/typescript-eslint/issues?q=is%3Aopen+is%3Aissue+label%3A%22accepting+prs%22)
- [ ] Steps in [CONTRIBUTING.md](https://github.com/typescript-eslint/typescript-eslint/blob/main/CONTRIBUTING.md) were taken
- [ ] Steps in [Contributing](https://typescript-eslint.io/contributing) were taken

## Overview

Expand Down
19 changes: 19 additions & 0 deletions CHANGELOG.md
Expand Up @@ -3,6 +3,25 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [5.50.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.49.0...v5.50.0) (2023-01-31)


### Bug Fixes

* **ast-spec:** a JSXEmptyExpression is not a possible JSXExpression ([#6321](https://github.com/typescript-eslint/typescript-eslint/issues/6321)) ([4b27777](https://github.com/typescript-eslint/typescript-eslint/commit/4b27777ed26cc83d6efc52a89b2d3fc6c01bc0d7))
* **eslint-plugin:** [ban-ts-comment] counts graphemes instead of `String.prototype.length` ([#5704](https://github.com/typescript-eslint/typescript-eslint/issues/5704)) ([09d57ce](https://github.com/typescript-eslint/typescript-eslint/commit/09d57cec8901880c6b24ea80dfa7d9fcdc463930))
* **eslint-plugin:** [prefer-optional-chain] fix `ThisExpression` and `PrivateIdentifier` errors ([#6028](https://github.com/typescript-eslint/typescript-eslint/issues/6028)) ([85e783c](https://github.com/typescript-eslint/typescript-eslint/commit/85e783c1fabe96d390729a5796d6d346e401692b))
* **eslint-plugin:** [prefer-optional-chain] fixer produces wrong logic ([#5919](https://github.com/typescript-eslint/typescript-eslint/issues/5919)) ([b0f6c8e](https://github.com/typescript-eslint/typescript-eslint/commit/b0f6c8ec0b372696ef26ca3a2b4f82dafd9dc417)), closes [#1438](https://github.com/typescript-eslint/typescript-eslint/issues/1438)


### Features

* **eslint-plugin:** add `key-spacing` rule extension for interface & type declarations ([#6211](https://github.com/typescript-eslint/typescript-eslint/issues/6211)) ([67706e7](https://github.com/typescript-eslint/typescript-eslint/commit/67706e72e332bf11c82fdf51f3d417d3c93a86cf))





# [5.49.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.48.2...v5.49.0) (2023-01-23)


Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions docs/Getting_Started.md → docs/Getting_Started.mdx
Expand Up @@ -73,6 +73,6 @@ ESLint will lint all TypeScript compatible files within the current folder, and

## 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.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.md).
If you're having problems getting this working, please have a look at our [Troubleshooting & FAQs](./linting/Troubleshooting.mdx).
File renamed without changes.
2 changes: 1 addition & 1 deletion docs/architecture/ESLint_Plugin.mdx
Expand Up @@ -8,7 +8,7 @@ sidebar_label: 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.
See [Getting Started](../Getting_Started.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
4 changes: 2 additions & 2 deletions docs/architecture/ESLint_Plugin_TSLint.mdx
Expand Up @@ -8,8 +8,8 @@ sidebar_label: 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.
Per [What About TSLint?](../linting/troubleshooting/TSLint.mdx), we highly recommend migrating off TSLint.
See [Getting Started](../Getting_Started.mdx) for documentation on how to lint your TypeScript code with ESLint.
:::

## Installation
Expand Down
3 changes: 2 additions & 1 deletion docs/architecture/Parser.mdx
Expand Up @@ -226,7 +226,8 @@ For example, by default it will ensure that a glob like `./**/tsconfig.json` wil

> Default `undefined`.
This option allows you to provide the root directory for relative tsconfig paths specified in the `project` option above.
This option allows you to provide the root directory for relative TSConfig paths specified in the `project` option above.
Doing so ensures running ESLint from a directory other than the root will still be able to find your TSConfig.

### `warnOnUnsupportedTypeScriptVersion`

Expand Down
28 changes: 28 additions & 0 deletions docs/contributing/Discussions.md
@@ -0,0 +1,28 @@
---
id: discussions
title: Discussions
---

Most proposals in the typescript-eslint repository happen in [GitHub Issues](https://docs.github.com/issues).
We generally try to keep conversations inside issues for their discoverability and ability to be linked to [GitHub Pull Requests](https://docs.github.com/pull-requests).

We have [GitHub Discussions](https://docs.github.com/discussions) enabled to enable three kinds of deeper, threaded conversations:

- **Community Feedback**: Questions from the maintainer team that should be raised to the broader community
- **RFCs (Requests For Comments)**: Formalized proposals for larger changes that should be discussed before turned into issues
- **Technical Discussions**: Deeper questions about typescript-eslint's architecture and/or APIs

Before filing a Discussion, search the issue tracker for any related conversations.
Link to them in the Discussion, along with a detailed description of what you'd like to discuss.

:::tip
For change proposals that match an [existing issue format](https://github.com/typescript-eslint/typescript-eslint/issues/new/choose), keep to filing issues.
Most don't need to be moved to this separate format.
We can always move an issue to a discussion if it becomes unexpectedly deep.
:::

:::caution
Please don't use Discussions as a support forum.
We don't have the maintainer-budget to handle that.
See [Issues > Questions and Support Requests](./Issues.mdx#questions-and-support-requests).
:::
1 change: 1 addition & 0 deletions docs/contributing/Issues.mdx
Expand Up @@ -21,6 +21,7 @@ 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 👍
- One exception: if an issue has been blocked on a question to a maintainer for 3 or more months, please ping us - we probably lost track of it
- 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
Expand Down
3 changes: 2 additions & 1 deletion docs/contributing/Pull_Requests.mdx
Expand Up @@ -19,8 +19,9 @@ 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
- Comment on an existing PR 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.
- One exception: if a PR has been blocked on a question to a maintainer for 3 or more months, please ping us - we probably lost track of it.

### Raising a PR

Expand Down
2 changes: 1 addition & 1 deletion docs/linting/CONFIGURATIONS.mdx
Expand Up @@ -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.mdx)).
:::

:::note
Expand Down
Expand Up @@ -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.mdx):
- 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.mdx):
- 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)
Expand All @@ -64,7 +64,7 @@ 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.mdx) for more information.

## I get errors telling me "The file must be included in at least one of the projects provided"

Expand Down
28 changes: 14 additions & 14 deletions docs/linting/Typed_Linting.md → docs/linting/Typed_Linting.mdx
Expand Up @@ -8,30 +8,30 @@ To tap into TypeScript's additional powers, there are two small changes you need

```js title=".eslintrc.js"
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
// Added lines start
parserOptions: {
tsconfigRootDir: __dirname,
project: ['./tsconfig.json'],
},
// Added lines end
plugins: ['@typescript-eslint'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
// Add this line
'plugin:@typescript-eslint/recommended-requiring-type-checking',
],
plugins: ['@typescript-eslint'],
parser: '@typescript-eslint/parser',
// Added lines start
parserOptions: {
project: ['./tsconfig.json'],
tsconfigRootDir: __dirname,
},
// Added lines end
root: true,
};
```

In more detail:

- `parserOptions.tsconfigRootDir` tells our parser the absolute path of your project's root directory.
- `plugin:@typescript-eslint/recommended-requiring-type-checking` is another [recommended configuration](./CONFIGURATIONS.mdx) we provide. This one contains recommended rules that additionally require type information.
- `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).
- `plugin:@typescript-eslint/recommended-requiring-type-checking` is another recommended configuration we provide. This one contains rules that specifically require type information.
- 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](../architecture/Parser.mdx#tsconfigRootDir)).

With that done, run the same lint command you ran before.
You may see new rules reporting errors based on type information!
Expand All @@ -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 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).
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).

## Troubleshooting

If you're having problems getting this working, please have a look at our [Troubleshooting and FAQs page](./Troubleshooting.md).
If you're having problems getting this working, please have a look at our [Troubleshooting and FAQs page](./Troubleshooting.mdx).
File renamed without changes.
4 changes: 2 additions & 2 deletions docs/linting/troubleshooting/Performance.md
Expand Up @@ -3,7 +3,7 @@ id: performance-troubleshooting
title: Performance Troubleshooting
---

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.mdx), 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.

Expand Down Expand Up @@ -53,7 +53,7 @@ Across a large codebase, these can add up, and severely impact performance.

We recommend not using this rule, and instead using a tool like [`prettier`](https://www.npmjs.com/package/prettier) to enforce a standardized formatting.

See our [documentation on formatting](./Formatting.md) for more information.
See our [documentation on formatting](./Formatting.mdx) for more information.

## `eslint-plugin-prettier`

Expand Down
File renamed without changes.
Expand Up @@ -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.mdx) 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.

Expand Down Expand Up @@ -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.mdx).
Expand Up @@ -31,7 +31,12 @@ You can call it _blurple_ if you want.

Our logo is also a halfway between [ESLint's logo](https://en.wikipedia.org/wiki/ESLint#/media/File:ESLint_logo.svg) and [TypeScript's logo](https://en.wikipedia.org/wiki/TypeScript#/media/File:Typescript.svg):

<img alt="typescript-eslint logo" src="/img/logo.svg" height="128px" width="128px" />
<img
alt="typescript-eslint logo"
src="/img/logo.svg"
height="128px"
width="128px"
/>

- [Logo PNG download](/img/logo.png)
- [Logo SVG download](/img/logo.svg)
38 changes: 33 additions & 5 deletions docs/maintenance/ISSUES.md → docs/maintenance/Issues.mdx
Expand Up @@ -3,7 +3,7 @@ id: issues
title: Issues
---

This document serves as a guide for how you might manage issues, also known as issue triaging.
This document serves as a guide for how you might manage our [GitHub Issues](https://docs.github.com/issues), also known as issue triaging.

Use your best judgement when triaging issues, and most of all remember to be **kind, friendly, and encouraging** when responding to users.
Many users are new to open source and/or typed linting.
Expand Down Expand Up @@ -93,13 +93,41 @@ These bugs should be reported with a link to a GitHub repository that can be che
If you cannot reproduce the issue as described using repository's README.md and issue description, it has not provided enough information.
Consider using a specific response like the _Needs Full Reproduction_ response.

### ✨ Rule Enhancements
### 🏗 Feature Requests

TODO: This will be filled out... soon!
For any feature request, make sure the requested support is either:

### 🚀 New Rules
- Very useful for at least one commonly used way to run TypeScript (e.g. tsc-built CLI package; bundler-managed web app)
- Relevant for _most_ projects that would be using typescript-eslint

TODO: This will be filled out... soon!
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))

#### ✨ Rule Enhancements

We're generally accepting of rule enhancements that meet the above feature request criteria.
If a rule enhancement would substantially change the target area of the rule, consider whether it should instead be a new rule.
Common signs of this are the rule's original name now being inaccurate, or some options being relevant just for the old functionality.

Enhancements that can cause new reports to be reported are considered breaking changes.
We have two common strategies for them:

- Treat the enhancement as a breaking change, and block merging it until the next major version
- Add an option to disable the new logic: which is a breaking change if opt-in, and a non-breaking change if opt-out
- Add an option to enable the new logic: which is a breaking change if opt-out, and a non-breaking change if opt-in

See [Can we standardize logical direction of rule options?](https://github.com/typescript-eslint/typescript-eslint/discussions/6101) for context on naming options.

For enhancements meant to limit which kinds of nodes the rule targets, mark the issue as blocked on [RFC: Common format to specify a type or value as a rule option](https://github.com/typescript-eslint/typescript-eslint/discussions/6017).

#### 🚀 New Rules

We're generally accepting of new rules that meet the above feature request criteria.
The biggest exception is rules that can roughly be implemented with [`@typescript-eslint/ban-types`](https://typescript-eslint.io/rules/ban-types) and/or [`no-restricted-syntax`](https://eslint.org/docs/latest/rules/no-restricted-syntax).

## Pruning Old Issues

Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 2073b68

Please sign in to comment.