Skip to content

Commit

Permalink
Merge branch 'main' (partial)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaKGoldberg committed Jan 30, 2023
2 parents e0e665f + 4b27777 commit 50e6bfc
Show file tree
Hide file tree
Showing 139 changed files with 6,037 additions and 1,260 deletions.
1 change: 1 addition & 0 deletions .cspell.json
Expand Up @@ -62,6 +62,7 @@
"declarators",
"destructure",
"destructured",
"discoverability",
"dprint",
"errored",
"erroring",
Expand Down
1 change: 0 additions & 1 deletion .eslintrc.js
Expand Up @@ -214,7 +214,6 @@ module.exports = {
'jest/no-alias-methods': 'error',
'jest/no-identical-title': 'error',
'jest/no-jasmine-globals': 'error',
'jest/no-jest-import': 'error',
'jest/no-test-prefixes': 'error',
'jest/no-done-callback': 'error',
'jest/no-test-return-statement': 'error',
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/prepare-build/action.yml
Expand Up @@ -19,4 +19,4 @@ runs:
shell: bash
# Website will be built by the Netlify GitHub App
run: |
yarn build --exclude website
npx nx run-many --target=build --parallel --exclude website
3 changes: 3 additions & 0 deletions .github/renovate.json5
Expand Up @@ -7,6 +7,9 @@
'eslint-scope',
// this dep is now ESM only
'execa',
// Some kind of weird caching issue:
// https://github.com/typescript-eslint/typescript-eslint/issues/6230
'ts-node',
// the nx packages get updated using the nx migrate CLI
'@nrwl/cli',
'@nrwl/devkit',
Expand Down
55 changes: 55 additions & 0 deletions CHANGELOG.md
Expand Up @@ -3,6 +3,61 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

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


### Bug Fixes

* **typescript-estree:** fix typo in FAQ link ([#6346](https://github.com/typescript-eslint/typescript-eslint/issues/6346)) ([eefc578](https://github.com/typescript-eslint/typescript-eslint/commit/eefc5781b0f455264e4e58e33c27f8a91b3ab5e3))


### Features

* **eslint-plugin:** [naming-convention] add support for `#private` modifier on class members ([#6259](https://github.com/typescript-eslint/typescript-eslint/issues/6259)) ([c8a6d80](https://github.com/typescript-eslint/typescript-eslint/commit/c8a6d8096080228b6d122c861fe140ac97f17cbe))





## [5.48.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.48.1...v5.48.2) (2023-01-16)

**Note:** Version bump only for package @typescript-eslint/typescript-eslint





## [5.48.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.48.0...v5.48.1) (2023-01-09)

**Note:** Version bump only for package @typescript-eslint/typescript-eslint





# [5.48.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.47.1...v5.48.0) (2023-01-02)

### Bug Fixes

- **website:** fix typo ([#6285](https://github.com/typescript-eslint/typescript-eslint/issues/6285)) ([3f8d105](https://github.com/typescript-eslint/typescript-eslint/commit/3f8d105e9ee500428774b498083c4bc02bfd81b8))

### Features

- **eslint-plugin:** specify which method is unbound and added test case ([#6281](https://github.com/typescript-eslint/typescript-eslint/issues/6281)) ([cf3ffdd](https://github.com/typescript-eslint/typescript-eslint/commit/cf3ffdd49aceb734ce18dc44ed6a11f7701f178e))

## [5.47.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.47.0...v5.47.1) (2022-12-26)

### Bug Fixes

- **ast-spec:** correct some incorrect ast types ([#6257](https://github.com/typescript-eslint/typescript-eslint/issues/6257)) ([0f3f645](https://github.com/typescript-eslint/typescript-eslint/commit/0f3f64571ea5d938081b1a9f3fd1495765201700))
- **eslint-plugin:** [member-ordering] correctly invert optionalityOrder ([#6256](https://github.com/typescript-eslint/typescript-eslint/issues/6256)) ([ccd45d4](https://github.com/typescript-eslint/typescript-eslint/commit/ccd45d4a998946b7be1161f8c8216bc458e50b4e))

# [5.47.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.46.1...v5.47.0) (2022-12-19)

### Features

- **eslint-plugin:** [no-floating-promises] add suggestion fixer to add an 'await' ([#5943](https://github.com/typescript-eslint/typescript-eslint/issues/5943)) ([9e35ef9](https://github.com/typescript-eslint/typescript-eslint/commit/9e35ef9af3ec51ab2dd49336699f3a94528bb4b1))

## [5.46.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.46.0...v5.46.1) (2022-12-12)

**Note:** Version bump only for package @typescript-eslint/typescript-eslint
Expand Down
17 changes: 5 additions & 12 deletions CONTRIBUTORS.md
Expand Up @@ -71,23 +71,16 @@ Thanks goes to these wonderful people:
<tr>
<td align="center"><a href="https://github.com/Validark"><img src="https://avatars.githubusercontent.com/u/15217173?v=4&size=100" width="100px;" alt=""/><br /><sub><b>Niles Salter</b></sub></a></td>
<td align="center"><a href="https://github.com/pablobirukov"><img src="https://avatars.githubusercontent.com/u/1861546?v=4&size=100" width="100px;" alt=""/><br /><sub><b>Pavel Birukov </b></sub></a></td>
<td align="center"><a href="https://github.com/mightyiam"><img src="https://avatars.githubusercontent.com/u/635591?v=4&size=100" width="100px;" alt=""/><br /><sub><b>Shahar Dawn Or</b></sub></a></td>
<td align="center"><a href="https://github.com/mightyiam"><img src="https://avatars.githubusercontent.com/u/635591?v=4&size=100" width="100px;" alt=""/><br /><sub><b>Shahar "Dawn" Or</b></sub></a></td>
<td align="center"><a href="https://github.com/kmin-jeong"><img src="https://avatars.githubusercontent.com/u/53456037?v=4&size=100" width="100px;" alt=""/><br /><sub><b>kmin-jeong</b></sub></a></td>
<td align="center"><a href="https://github.com/43081j"><img src="https://avatars.githubusercontent.com/u/5677153?v=4&size=100" width="100px;" alt=""/><br /><sub><b>James Garbutt</b></sub></a></td>
<td align="center"><a href="https://github.com/koooge"><img src="https://avatars.githubusercontent.com/u/7419215?v=4&size=100" width="100px;" alt=""/><br /><sub><b>koooge</b></sub></a></td>
</tr>
<tr>
<td align="center"><a href="https://github.com/jonathanrdelgado"><img src="https://avatars.githubusercontent.com/u/1841149?v=4&size=100" width="100px;" alt=""/><br /><sub><b>Jonathan Delgado</b></sub></a></td>
<td align="center"><a href="https://github.com/flying-sheep"><img src="https://avatars.githubusercontent.com/u/291575?v=4&size=100" width="100px;" alt=""/><br /><sub><b>Philipp A.</b></sub></a></td>
<td align="center"><a href="https://github.com/g-plane"><img src="https://avatars.githubusercontent.com/u/17216317?v=4&size=100" width="100px;" alt=""/><br /><sub><b>Pig Fang</b></sub></a></td>
<td align="center"><a href="https://github.com/tadhgmister"><img src="https://avatars.githubusercontent.com/u/18615763?v=4&size=100" width="100px;" alt=""/><br /><sub><b>Tadhg McDonald-Jensen</b></sub></a></td>
<td align="center"><a href="https://github.com/ThomasdenH"><img src="https://avatars.githubusercontent.com/u/3889750?v=4&size=100" width="100px;" alt=""/><br /><sub><b>Thomas den Hollander</b></sub></a></td>
</tr>
<tr>
<td align="center"><a href="https://github.com/timkraut"><img src="https://avatars.githubusercontent.com/u/509669?v=4&size=100" width="100px;" alt=""/><br /><sub><b>Tim Kraut</b></sub></a></td>
<td align="center"><a href="https://github.com/thomasmichaelwallace"><img src="https://avatars.githubusercontent.com/u/1954845?v=4&size=100" width="100px;" alt=""/><br /><sub><b>thomas michael wallace</b></sub></a></td>
<td align="center"><a href="https://github.com/juank1809"><img src="https://avatars.githubusercontent.com/u/82288753?v=4&size=100" width="100px;" alt=""/><br /><sub><b>Juan García</b></sub></a></td>
<td align="center"><a href="https://github.com/danielnixon"><img src="https://avatars.githubusercontent.com/u/6418489?v=4&size=100" width="100px;" alt=""/><br /><sub><b>Daniel Nixon</b></sub></a></td>
<td align="center"><a href="https://github.com/yasarsid"><img src="https://avatars.githubusercontent.com/u/16225376?v=4&size=100" width="100px;" alt=""/><br /><sub><b>Yasar Siddiqui</b></sub></a></td>
<td align="center"><a href="https://github.com/magurotuna"><img src="https://avatars.githubusercontent.com/u/23649474?v=4&size=100" width="100px;" alt=""/><br /><sub><b>Yusuke Tanaka</b></sub></a></td>
<td align="center"><a href="https://github.com/holazz"><img src="https://avatars.githubusercontent.com/u/23100055?v=4&size=100" width="100px;" alt=""/><br /><sub><b>zz</b></sub></a></td>
</tr>
</table>

<!-- markdownlint-restore -->
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 @@ -128,7 +128,7 @@ Additionally, it enables rules that promote using the more modern constructs Typ

This config is automatically included if you use any of the recommended configurations.

See [`configs/eslint-recommended.ts``](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslint-recommended.ts) for the exact contents of this config.
See [`configs/eslint-recommended.ts`](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslint-recommended.ts) for the exact contents of this config.

## Suggesting Configuration Changes

Expand Down
71 changes: 1 addition & 70 deletions docs/linting/Troubleshooting.md
Expand Up @@ -248,73 +248,4 @@ 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.

If you're experiencing times much slower than that, then there are a few common culprits.

### Wide includes in your `tsconfig`

When using type-aware linting, you provide us with one or more tsconfigs.
We then will pre-parse all files so that full and complete type information is available.

If you provide very wide globs in your `include` (such as `**/*`), it can cause many more files than you expect to be included in this pre-parse.
Additionally, if you provide no `include` in your tsconfig, then it is the same as providing the widest glob.

Wide globs can cause TypeScript to parse things like build artifacts, which can heavily impact performance.
Always ensure you provide globs targeted at the folders you are specifically wanting to lint.

### Wide includes in your ESLint options

Specifying `tsconfig.json` paths in your ESLint commands is also likely to cause much more disk IO than expected.
Instead of globs that use `**` to recursively check all folders, prefer paths that use a single `*` at a time.

```diff
- eslint --parser-options project:./**/tsconfig.json
+ eslint --parser-options project:./packages/*/tsconfig.json
```

See [Glob pattern in parser's option "project" slows down linting](https://github.com/typescript-eslint/typescript-eslint/issues/2611) for more details.

### `eslint-plugin-prettier`

This plugin surfaces prettier formatting problems at lint time, helping to ensure your code is always formatted.
However this comes at a quite a large cost - in order to figure out if there is a difference, it has to do a prettier format on every file being linted.
This means that each file will be parsed twice - once by ESLint, and once by Prettier.
This can add up for large codebases.

Instead of using this plugin, we recommend using prettier's `--list-different` flag to detect if a file has not been correctly formatted.
For example, our CI is setup to run the following command automatically, which blocks PRs that have not been formatted:

```bash npm2yarn
npm run prettier --list-different \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\"
```

### `eslint-plugin-import`

This is another great plugin that we use ourselves in this project.
However there are a few rules which can cause your lints to be really slow, because they cause the plugin to do its own parsing, and file tracking.
This double parsing adds up for large codebases.

There are many rules that do single file static analysis, but we provide the following recommendations.

We recommend you do not use the following rules, as TypeScript provides the same checks as part of standard type checking:

- `import/named`
- `import/namespace`
- `import/default`
- `import/no-named-as-default-member`

The following rules do not have equivalent checks in TypeScript, so we recommend that you only run them at CI/push time, to lessen the local performance burden.

- `import/no-named-as-default`
- `import/no-cycle`
- `import/no-unused-modules`
- `import/no-deprecated`

### The `indent` / `@typescript-eslint/indent` rules

This rule helps ensure your codebase follows a consistent indentation pattern.
However this involves a _lot_ of computations across every single token in a file.
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.
If you think you're having issues with performance, see our [Performance Troubleshooting documentation](./troubleshooting/Performance.md).
22 changes: 11 additions & 11 deletions docs/linting/Typed_Linting.md
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.
- `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 Down

0 comments on commit 50e6bfc

Please sign in to comment.