From 7c77b1b123d13fb585d588a9dd19f810c973a42a Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Tue, 20 Feb 2024 12:09:29 +1030 Subject: [PATCH 01/35] docs: rework structure and improve flat config docs (#8507) --- docs/Developers.mdx | 6 +- docs/Packages.mdx | 2 +- .../Legacy_ESLint_Setup.mdx | 7 +- .../Quickstart.mdx} | 42 ++-- .../Typed_Linting.mdx | 13 +- .../typed-linting/Monorepos.mdx | 3 +- docs/maintenance/Issues.mdx | 2 +- docs/maintenance/Team.mdx | 2 +- docs/packages/ESLint_Plugin.mdx | 2 +- docs/packages/ESLint_Plugin_TSLint.mdx | 4 +- docs/packages/Parser.mdx | 4 +- docs/packages/TypeScript_ESLint.mdx | 149 ++++++++++- .../FAQ.mdx} | 235 +++++++++++++----- .../troubleshooting/Formatting.mdx | 33 ++- .../troubleshooting/Performance.mdx | 40 ++- docs/{linting => }/troubleshooting/TSLint.mdx | 2 +- docs/users/Releases.mdx | 14 +- .../Shared_Configurations.mdx} | 8 +- packages/eslint-plugin/docs/rules/README.md | 8 +- .../docs/rules/consistent-type-imports.md | 2 +- .../eslint-plugin/docs/rules/no-extra-semi.md | 2 +- .../eslint-plugin/docs/rules/no-type-alias.md | 2 +- packages/eslint-plugin/src/configs/all.ts | 2 +- .../src/configs/disable-type-checked.ts | 2 +- .../src/configs/recommended-type-checked.ts | 2 +- .../eslint-plugin/src/configs/recommended.ts | 2 +- .../src/configs/strict-type-checked.ts | 2 +- packages/eslint-plugin/src/configs/strict.ts | 2 +- .../src/configs/stylistic-type-checked.ts | 2 +- .../eslint-plugin/src/configs/stylistic.ts | 2 +- .../flat-config-types/eslint.config.js | 60 +++-- .../flat-config-types.test.ts.snap | 89 ++++--- packages/repo-tools/src/generate-configs.mts | 2 +- packages/typescript-eslint/src/configs/all.ts | 2 +- .../src/configs/disable-type-checked.ts | 2 +- .../src/configs/recommended-type-checked.ts | 2 +- .../src/configs/recommended.ts | 2 +- .../src/configs/strict-type-checked.ts | 2 +- .../typescript-eslint/src/configs/strict.ts | 2 +- .../src/configs/stylistic-type-checked.ts | 2 +- .../src/configs/stylistic.ts | 2 +- packages/typescript-eslint/src/index.ts | 72 +++++- ...13-announcing-typescript-eslint-v6-beta.md | 19 +- ...3-07-09-announcing-typescript-eslint-v6.md | 18 +- .../2023-09-18-parser-options-project-true.md | 6 +- ...2023-12-25-deprecating-formatting-rules.md | 4 +- packages/website/docusaurusConfig.ts | 35 +++ packages/website/package.json | 1 + .../insertions/insertWhenNotToUseIt.ts | 4 +- packages/website/sidebars/sidebar.base.js | 48 ++-- .../theme/MDXComponents/RuleAttributes.tsx | 4 +- yarn.lock | 21 ++ 52 files changed, 720 insertions(+), 277 deletions(-) rename docs/{linting => getting-started}/Legacy_ESLint_Setup.mdx (91%) rename docs/{Getting_Started.mdx => getting-started/Quickstart.mdx} (50%) rename docs/{linting => getting-started}/Typed_Linting.mdx (87%) rename docs/{linting => getting-started}/typed-linting/Monorepos.mdx (98%) rename docs/{linting/Troubleshooting.mdx => troubleshooting/FAQ.mdx} (80%) rename docs/{linting => }/troubleshooting/Formatting.mdx (88%) rename docs/{linting => }/troubleshooting/Performance.mdx (87%) rename docs/{linting => }/troubleshooting/TSLint.mdx (97%) rename docs/{linting/Configurations.mdx => users/Shared_Configurations.mdx} (95%) diff --git a/docs/Developers.mdx b/docs/Developers.mdx index e1658aa105b7..7db3a7029c67 100644 --- a/docs/Developers.mdx +++ b/docs/Developers.mdx @@ -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! ❤️‍🔥 +::: diff --git a/docs/Packages.mdx b/docs/Packages.mdx index 8f4c27472f2b..2235d57b21ae 100644 --- a/docs/Packages.mdx +++ b/docs/Packages.mdx @@ -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 diff --git a/docs/linting/Legacy_ESLint_Setup.mdx b/docs/getting-started/Legacy_ESLint_Setup.mdx similarity index 91% rename from docs/linting/Legacy_ESLint_Setup.mdx rename to docs/getting-started/Legacy_ESLint_Setup.mdx index 9a9b5a21db46..c6dd1dbd70da 100644 --- a/docs/linting/Legacy_ESLint_Setup.mdx +++ b/docs/getting-started/Legacy_ESLint_Setup.mdx @@ -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 @@ -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 diff --git a/docs/Getting_Started.mdx b/docs/getting-started/Quickstart.mdx similarity index 50% rename from docs/Getting_Started.mdx rename to docs/getting-started/Quickstart.mdx index e64cdb025307..2d38219ef24c 100644 --- a/docs/Getting_Started.mdx +++ b/docs/getting-started/Quickstart.mdx @@ -1,20 +1,28 @@ --- -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 @@ -22,7 +30,7 @@ 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 @@ -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: @@ -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](./linting/Configurations.mdx#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 diff --git a/docs/linting/Typed_Linting.mdx b/docs/getting-started/Typed_Linting.mdx similarity index 87% rename from docs/linting/Typed_Linting.mdx rename to docs/getting-started/Typed_Linting.mdx index 88e526242bc1..4de4516968c3 100644 --- a/docs/linting/Typed_Linting.mdx +++ b/docs/getting-started/Typed_Linting.mdx @@ -1,6 +1,7 @@ --- id: typed-linting title: Linting with Type Information +pagination_next: getting-started/typed-linting/monorepos --- import Tabs from '@theme/Tabs'; @@ -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). @@ -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)). @@ -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. @@ -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. @@ -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). diff --git a/docs/linting/typed-linting/Monorepos.mdx b/docs/getting-started/typed-linting/Monorepos.mdx similarity index 98% rename from docs/linting/typed-linting/Monorepos.mdx rename to docs/getting-started/typed-linting/Monorepos.mdx index e58acd0a560b..13e8f8575626 100644 --- a/docs/linting/typed-linting/Monorepos.mdx +++ b/docs/getting-started/typed-linting/Monorepos.mdx @@ -1,6 +1,7 @@ --- id: monorepos title: Monorepo Configuration +pagination_next: null --- import Tabs from '@theme/Tabs'; @@ -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). diff --git a/docs/maintenance/Issues.mdx b/docs/maintenance/Issues.mdx index a0f38da60b38..525147f88c54 100644 --- a/docs/maintenance/Issues.mdx +++ b/docs/maintenance/Issues.mdx @@ -141,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 diff --git a/docs/maintenance/Team.mdx b/docs/maintenance/Team.mdx index 3fd2d66d8a80..6091e3e6a02a 100644 --- a/docs/maintenance/Team.mdx +++ b/docs/maintenance/Team.mdx @@ -94,5 +94,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). diff --git a/docs/packages/ESLint_Plugin.mdx b/docs/packages/ESLint_Plugin.mdx index 6db78ddfcebe..bf0777a005d3 100644 --- a/docs/packages/ESLint_Plugin.mdx +++ b/docs/packages/ESLint_Plugin.mdx @@ -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. diff --git a/docs/packages/ESLint_Plugin_TSLint.mdx b/docs/packages/ESLint_Plugin_TSLint.mdx index 525b1c072477..6b9da9e6982f 100644 --- a/docs/packages/ESLint_Plugin_TSLint.mdx +++ b/docs/packages/ESLint_Plugin_TSLint.mdx @@ -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.mdx), we highly recommend migrating off TSLint. -See [Getting Started](../Getting_Started.mdx) for documentation on how to lint your TypeScript code with ESLint. +Per [What About TSLint?](../troubleshooting/TSLint.mdx), we highly recommend migrating off TSLint. +See [Getting Started](../getting-started/Quickstart.mdx) for documentation on how to lint your TypeScript code with ESLint. ::: ## Installation diff --git a/docs/packages/Parser.mdx b/docs/packages/Parser.mdx index 062c7aa247a0..8d39a8fb0bdd 100644 --- a/docs/packages/Parser.mdx +++ b/docs/packages/Parser.mdx @@ -60,7 +60,7 @@ interface ParserOptions { Whether to use common heuristics to infer whether ESLint is being used as part of a single run (as opposed to `--fix` mode or in a persistent session such as an editor extension). -When typescript-eslint handles TypeScript Program management behind the scenes for [linting with type information](../linting/Typed_Linting.mdx), this distinction is important for performance. +When typescript-eslint handles TypeScript Program management behind the scenes for [linting with type information](../getting-started/Typed_Linting.mdx), this distinction is important for performance. There is significant overhead to managing TypeScript "Watch" Programs needed for the long-running use-case. Being able to assume the single run case allows typescript-eslint to faster immutable Programs instead. @@ -126,7 +126,7 @@ Specifies the version of ECMAScript syntax you want to use. This is used by the > 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](../linting/Typed_Linting.mdx). In other words, you don't have to specify `parserOptions.project` in this case, making the linting process faster. +This option allow you to tell parser to act as if `emitDecoratorMetadata: true` is set in `tsconfig.json`, but without [type-aware linting](../getting-started/Typed_Linting.mdx). In other words, you don't have to specify `parserOptions.project` in this case, making the linting process faster. ### `extraFileExtensions` diff --git a/docs/packages/TypeScript_ESLint.mdx b/docs/packages/TypeScript_ESLint.mdx index 5bd5e38c1f77..c5f1d2665245 100644 --- a/docs/packages/TypeScript_ESLint.mdx +++ b/docs/packages/TypeScript_ESLint.mdx @@ -3,6 +3,9 @@ id: typescript-eslint sidebar_label: typescript-eslint --- +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + # `typescript-eslint` > Tooling which enables you to use TypeScript with ESLint @@ -11,12 +14,12 @@ This package is the main entrypoint that you can use to consume our tooling with This package exports the following: -| name | description | -| --------- | ---------------------------------------------------------- | -| `config` | A utility function for creating type-safe flat configs | -| `configs` | [Our eslint (flat) configs](../linting/Configurations.mdx) | -| `parser` | [Our parser](./Parser.mdx) | -| `plugin` | [Our plugin](./ESLint_Plugin.mdx) | +| name | description | +| --------- | --------------------------------------------------------------- | +| `config` | A utility function for creating type-safe flat configs | +| `configs` | [Our eslint (flat) configs](../users/Shared_Configurations.mdx) | +| `parser` | [Our parser](./Parser.mdx) | +| `plugin` | [Our plugin](./ESLint_Plugin.mdx) | ## Installation @@ -32,11 +35,11 @@ If you're migrating from a "legacy" `.eslintrc` configuration setup you likely h npm un @typescript-eslint/parser @typescript-eslint/eslint-plugin ``` -## Usage +For more information on migrating from a "legacy" config setup, see [ESLint's Configuration Migration Guide](https://eslint.org/docs/latest/use/configure/migration-guide). -The `config` function is a simple utility which does a few things. First and foremost it is a strictly typed function - meaning it allows you to write type-safe configs! +## Usage -The simplest usage would be: +The simplest usage of this package would be: ```js title="eslint.config.js" // @ts-check @@ -50,18 +53,30 @@ export default tseslint.config( ); ``` -You can also declare our plugin and parser in your config via this package. For example this config would enable our plugin, our parser, and type-aware linting with a few of our popular type-aware rules: +This config file exports a flat config that enables both the [core eslint recommended config](https://www.npmjs.com/package/@eslint/js) and [our recommended config](../users/Shared_Configurations.mdx#recommended). + +For more information on the `tseslint.config` function [see `config(...)` below](#config). + +### Advanced usage + +#### Manually configuring our plugin and parser + +You can declare our plugin and parser in your config via this package, for example: ```js title="eslint.config.js" // @ts-check +import eslint from '@eslint/js'; +import jestPlugin from 'eslint-plugin-jest'; import tseslint from 'typescript-eslint'; export default tseslint.config({ plugins: { + // highlight-next-line '@typescript-eslint': tseslint.plugin, }, languageOptions: { + // highlight-next-line parser: tseslint.parser, parserOptions: { project: true, @@ -83,6 +98,112 @@ We **_strongly_** recommend declaring our plugin with the namespace `@typescript You may choose a different namespace - but note that currently [flat configs allow the same plugin to be registered, configured, and have duplicate reports under multiple namespaces](https://github.com/eslint/eslint/discussions/17766). ::: +#### Usage with other plugins + +Below is a more complex example of how you might use our tooling with flat configs. This config: + +- Ignores `build`/`dist` folders from being linted +- Enables our plugin, our parser, and type-aware linting with a few of our popular type-aware rules +- Disables type-aware linting on JS files +- Enables the recommended `eslint-plugin-jest` rules on test files only + +```js title="eslint.config.js" +// @ts-check + +import eslint from '@eslint/js'; +import jestPlugin from 'eslint-plugin-jest'; +import tseslint from 'typescript-eslint'; + +export default tseslint.config( + { + // config with just ignores is the replacement for `.eslintignore` + ignores: ['**/build/**', '**/dist/**', 'src/some/file/to/ignore.ts'], + }, + eslint.configs.recommended, + { + plugins: { + '@typescript-eslint': tseslint.plugin, + jest: jestPlugin, + }, + languageOptions: { + parser: tseslint.parser, + parserOptions: { + project: true, + }, + }, + rules: { + '@typescript-eslint/no-unsafe-argument': 'error', + '@typescript-eslint/no-unsafe-assignment': 'error', + '@typescript-eslint/no-unsafe-call': 'error', + '@typescript-eslint/no-unsafe-member-access': 'error', + '@typescript-eslint/no-unsafe-return': 'error', + }, + }, + { + // disable type-aware linting on JS files + files: ['**/*.js'], + ...tseslint.configs.disableTypeChecked, + }, + { + // enable jest rules on test files + files: ['test/**'], + ...jestPlugin.configs['flat/recommended'], + }, +); +``` + +## `config(...)` + +The `config` function is a [variadic](https://en.wikipedia.org/wiki/Variadic_function) [identity function](https://en.wikipedia.org/wiki/Identity_function) which is a fancy way of saying that it's a function with a spread argument that accepts any number flat config objects and returns the objects unchanged. It exists as a way to quickly and easily provide types for your flat config file without the need for JSDoc type comments. + +By using this function you will get autocomplete and documentation for all config properties in addition to TypeScript errors, should you provide invalid values. + + + + +```ts title="eslint.config.js" +// @ts-check + +import eslint from '@eslint/js'; +import tseslint from 'typescript-eslint'; + +export default tseslint.config( + eslint.configs.recommended, + ...tseslint.configs.recommended, + { + /*... */ + }, + // ... +); +``` + + + + +```ts title="eslint.config.js" +// @ts-check + +import eslint from '@eslint/js'; +import tseslint from 'typescript-eslint'; + +/** @type {import('typescript-eslint').Config} */ +export default [ + eslint.configs.recommended, + ...tseslint.configs.recommended, + { + /*... */ + }, + // ... +]; +``` + + + + +:::note +We _**strongly**_ recommend using this utility to improve the config authoring experience — however it is entirely optional. By choosing not to use it you lose editor autocomplete and type checking for config files but otherwise it _will not_ impact your ability to use our tooling. +::: + ### Flat config `extends` The `tseslint.config` utility function also adds handling for the `extends` property on flat config objects. This allows you to more easily extend shared configs for specific file patterns whilst also overriding rules/options provided by those configs: @@ -120,10 +241,12 @@ export default [ ]; ``` -We found that this is a pretty common operation when writing ESLint configs which is why we provided this convenience property - for example in codebases with type-aware linting a config object like this is a very common way to disable TS-specific linting setups on JS files: +We found that this is a pretty common operation when writing ESLint configs which is why we provided this convenience property. + +For example in codebases with type-aware linting a config object like this is a very common way to disable TS-specific linting setups on JS files: ```js -export default [ +export default tseslint.config([ { files: ['**/*.js'], extends: [tseslint.configs.disableTypeChecked], @@ -136,5 +259,5 @@ export default [ '@typescript-eslint/explicit-function-return-type': 'off', }, }, -]; +]); ``` diff --git a/docs/linting/Troubleshooting.mdx b/docs/troubleshooting/FAQ.mdx similarity index 80% rename from docs/linting/Troubleshooting.mdx rename to docs/troubleshooting/FAQ.mdx index 36d8798ceab3..dd96a721bcc0 100644 --- a/docs/linting/Troubleshooting.mdx +++ b/docs/troubleshooting/FAQ.mdx @@ -1,8 +1,12 @@ --- -id: troubleshooting -title: Troubleshooting & FAQs +id: faqs +title: FAQs +slug: /troubleshooting/ --- +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + ## I am using a rule from ESLint core, and it doesn't work correctly with TypeScript code This happens because TypeScript adds new features that ESLint doesn't know about. @@ -39,55 +43,47 @@ These errors are caused by an ESLint config requesting type information be gener - 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.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 remove all rules requiring type information from the top-level configuration - and only apply them to TypeScript files via an override. - - - ```js title=".eslintrc.cjs" - module.exports = { - // ... the rest of your config ... - overrides: [ - { - extends: [ - 'plugin:@typescript-eslint/recommended-requiring-type-checking', - ], - files: ['./**/*.{ts,tsx}'], - }, - ], - }; - ``` - -
-
- - Alternatively, in our version v6, you can use our{' '} - disable-type-checked config to disable type checking for just that type of file. - - - ```js title=".eslintrc.cjs" - module.exports = { - // ... the rest of your config ... - overrides: [ - { - extends: ['plugin:@typescript-eslint/disable-type-checked'], - files: ['./**/*.js'], - }, - ], - }; - ``` - To disable type checking for files manually, set `parserOptions: { project: null }` to an override for the files you wish to exclude. Note that `{ project: undefined }` will not work, and you'll also need to disable any rules or rule options that require type checking. -
- - - If you **do** want to lint the file with [type-aware linting](./Typed_Linting.mdx): + - If you **do not** want to lint the file with [type-aware linting](../getting-started/Typed_Linting.mdx): + - Use [ESLint's `overrides` configuration](https://eslint.org/docs/latest/user-guide/configuring/configuration-files#configuration-based-on-glob-patterns) with our [`disable-type-checked`](../users/Shared_Configurations.mdx#disable-type-checked) config to disable type checking for just that type of file. + + + + ```js title="eslint.config.js" + import tseslint from 'typescript-eslint'; + + export default tseslint.config( + // ... the rest of your config ... + { + files: ['**/*.js'], + extends: [tseslint.configs.disableTypeChecked], + }, + ); + ``` + + + + + ```js title=".eslintrc.cjs" + module.exports = { + // ... the rest of your config ... + overrides: [ + { + extends: ['plugin:@typescript-eslint/disable-type-checked'], + files: ['./**/*.js'], + }, + ], + }; + ``` + + + + - Alternatively to disable type checking for files manually, you can set `parserOptions: { project: false }` to an override for the files you wish to exclude. + - If you **do** want to lint the file with [type-aware linting](../getting-started/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 the file is a `.cjs`, `.js`, or `.mjs` file, make sure [`allowJs`](https://www.typescriptlang.org/tsconfig#allowJs) is enabled. - If your file shouldn't be a part of one of your existing tsconfigs (for example, it is a script/tool local to the repo), then consider creating a new tsconfig (we advise calling it `tsconfig.eslint.json`) in your project root which lists this file in its `include`. For an example of this, you can check out the configuration we use in this repo: - [`tsconfig.eslint.json`](https://github.com/typescript-eslint/typescript-eslint/blob/main/tsconfig.eslint.json) - - [`.eslintrc.js`](https://github.com/typescript-eslint/typescript-eslint/blob/main/.eslintrc.js) + - [`eslint.config.mjs`](https://github.com/typescript-eslint/typescript-eslint/blob/main/eslint.config.mjs) @@ -105,12 +101,12 @@ However, if no specified TSConfig includes the source file, the parser won't be This error most commonly happens on config files or similar that are not included in their project TSConfig(s). For example, many projects have files like: -- An `.eslintrc.cjs` with `parserOptions.project: ["./tsconfig.json"]` +- An `.eslintrc.cjs` / `eslint.config.js` with `parserOptions.project: ["./tsconfig.json"]` - A `tsconfig.json` with `include: ["src"]` -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`. +In that case, viewing the file 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.mdx) for more information. +See our docs on [type aware linting](../getting-started/Typed_Linting.mdx) for more information. ## I get errors telling me "The file must be included in at least one of the projects provided" @@ -121,7 +117,7 @@ Update to the latest version to see a more informative version of this error mes First make sure you've read the docs and understand ESLint configuration files: -- [Read our getting started guide](../Getting_Started.mdx) to ensure your config is properly setup to start configuring our rules. +- [Read our getting started guide](../getting-started/Quickstart.mdx) to ensure your config is properly setup to start configuring our rules. - [Checkout ESLint's documentation on configuring rules](https://eslint.org/docs/latest/use/configure/rules) to ensure you understand how to configure rules. Our [rule docs](/rules) detail the options each rule supports under the "Options" heading. @@ -142,8 +138,29 @@ type RuleConfig = Some examples -```js title=".eslintrc.js" + + + +```js title="eslint.config.js" +export default tseslint.config( + // ... the rest of your config ... + { + rules: { + // turns a rule on with no configuration (i.e. uses the default configuration) + '@typescript-eslint/array-type': 'error', + // turns on a rule with configuration + '@typescript-eslint/no-explicit-any': ['warn', { ignoreRestArgs: true }], + }, + }, +); +``` + + + + +```js title=".eslintrc.cjs" module.exports = { + // ... the rest of your config ... rules: { // turns a rule on with no configuration (i.e. uses the default configuration) '@typescript-eslint/array-type': 'error', @@ -153,6 +170,9 @@ module.exports = { }; ``` + + + ## typescript-eslint thinks my variable is never nullish / is `any` / etc., but that is clearly not the case to me Our type-aware rules almost always trust the type information provided by the TypeScript compiler. Therefore, an easy way to check if our rule is behaving correctly is to inspect the type of the variable in question, such as by hovering over it in your IDE. @@ -180,7 +200,7 @@ If the IDE provides different type information from typescript-eslint's report, You can use it, but it will only work reliably for untyped rules -- and even then, not always. Any ESLint rule that checks logic across files, including many rules from `eslint-plugin-import`, creates cross-file dependencies. -[Typed lint rules](./Typed_Linting.mdx) almost always have dependencies on types across files in practice. +[Typed lint rules](../getting-started/Typed_Linting.mdx) almost always have dependencies on types across files in practice. ESLint's caching doesn't account for those cross-file dependencies. We don't recommend using `--cache`. @@ -189,8 +209,31 @@ We don't recommend using `--cache`. You can use `parserOptions.extraFileExtensions` to specify an array of non-TypeScript extensions to allow, for example: + + + +```js title="eslint.config.js" +export default tseslint.config( + // ... the rest of your config ... + { + languageOptions: { + parserOptions: { + tsconfigRootDir: import.meta.dirname, + project: ['./tsconfig.json'], + // Add this line + extraFileExtensions: ['.vue'], + }, + }, + }, +); +``` + + + + ```js title=".eslintrc.js" module.exports = { + // ... the rest of your config ... parserOptions: { tsconfigRootDir: __dirname, project: ['./tsconfig.json'], @@ -200,19 +243,60 @@ module.exports = { }; ``` + + + ## I am running into errors when parsing TypeScript in my .vue files If you are running into issues parsing .vue files, it might be because parsers like [`vue-eslint-parser`](https://www.npmjs.com/package/vue-eslint-parser) are required to parse `.vue` files. In this case you can move `@typescript-eslint/parser` inside `parserOptions` and use `vue-eslint-parser` as the top level parser. -```diff -- "parser": "@typescript-eslint/parser", -+ "parser": "vue-eslint-parser", - "parserOptions": { -+ "parser": "@typescript-eslint/parser", - "sourceType": "module" - } + + + +```js title="eslint.config.js" +import tseslint from 'typescript-eslint'; +// Add this line +import vueParser from 'vue-eslint-parser'; + +export default tseslint.config( + // ... the rest of your config ... + { + languageOptions: { + // Remove this line + parser: tseslint.parser, + // Add this line + parser: vueParser, + parserOptions: { + // Add this line + parser: tseslint.parser, + sourceType: 'module', + }, + }, + }, +); +``` + + + + +```js title=".eslintrc.js" +module.exports = { + // ... the rest of your config ... + // Remove this line + parser: '@typescript-eslint/parser', + // Add this line + parser: 'vue-eslint-parser', + parserOptions: { + parser: '@typescript-eslint/parser', + // Add this line + extraFileExtensions: ['.vue'], + }, +}; ``` + + + The `parserOptions.parser` option can also specify an object to specify multiple parsers. See the [`vue-eslint-parser` usage guide](https://eslint.vuejs.org/user-guide/#usage) for more details. ## One of my lint rules isn't working correctly on a pure JavaScript file @@ -291,9 +375,29 @@ As of our v4.0.0 release, this also applies to types. If you use global types from a 3rd party package (i.e. anything from an `@types` package), then you will have to configure ESLint appropriately to define these global types. For example; the `JSX` namespace from `@types/react` is a global 3rd party type that you must define in your ESLint config. -Note, that for a mixed project including JavaScript and TypeScript, the `no-undef` rule (like any rule) can be turned off for TypeScript files alone by adding an `overrides` section to `.eslintrc.cjs`: +Note, that for a mixed project including JavaScript and TypeScript, the `no-undef` rule (like any rule) can be turned off for TypeScript files alone as follows: -```js title=".eslintrc.cjs" + + + +```js title="eslint.config.js" +import tseslint from 'typescript-eslint'; + +export default tseslint.config( + // ... the rest of your config ... + { + files: ['**/*.{ts,tsx,mts,cts}'], + rules: { + 'no-undef': 'off', + }, + }, +); +``` + + + + +```js title=".eslintrc.js" module.exports = { // ... the rest of your config ... overrides: [ @@ -307,6 +411,9 @@ module.exports = { }; ``` + + + If you choose to leave on the ESLint `no-undef` lint rule, you can [manually define the set of allowed `globals` in your ESLint config](https://eslint.org/docs/user-guide/configuring/language-options#specifying-globals), and/or you can use one of the [pre-defined environment (`env`) configurations](https://eslint.org/docs/user-guide/configuring/language-options#specifying-environments). ## How do I check to see what versions are installed? @@ -384,11 +491,11 @@ For developers updating ESLint rules in plugins that still need to support types For more context, see the [Some properties named typeParameters instead of typeArguments](https://github.com/typescript-eslint/typescript-eslint/issues/146) issue, and the implementing [fix: rename typeParameters to typeArguments where needed](https://github.com/typescript-eslint/typescript-eslint/pull/5384) pull request. -The [typescript-eslint v6 release post](https://deploy-preview-6515--typescript-eslint.netlify.app/blog/announcing-typescript-eslint-v6-beta) has more information on typescript-eslint v6. +The [typescript-eslint v6 release post](/blog/announcing-typescript-eslint-v6-beta) has more information on typescript-eslint v6. ## My linting feels really slow -If you think you're having issues with performance, see our [Performance Troubleshooting documentation](./troubleshooting/Performance.mdx). +If you think you're having issues with performance, see our [Performance Troubleshooting documentation](../troubleshooting/Performance.mdx). ## Are TypeScript project references supported? diff --git a/docs/linting/troubleshooting/Formatting.mdx b/docs/troubleshooting/Formatting.mdx similarity index 88% rename from docs/linting/troubleshooting/Formatting.mdx rename to docs/troubleshooting/Formatting.mdx index 57d1562ebb72..ac94a82195b2 100644 --- a/docs/linting/troubleshooting/Formatting.mdx +++ b/docs/troubleshooting/Formatting.mdx @@ -3,6 +3,9 @@ id: formatting title: What About Formatting? --- +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + We recommend against using ESLint for formatting. We recommend using [Prettier](https://prettier.io), [dprint](https://dprint.dev), or an equivalent instead. @@ -23,7 +26,7 @@ Additionally linters typically run each rule isolated from one another. This has - any two lint rules can't share config meaning one lint rule's fixer might introduce a violation of another lint rule's fixer (eg one lint rule might use the incorrect indentation character). - lint rule fixers can conflict (apply to the same code range), forcing the linter to perform an additional cycle to attempt to apply a fixer to a clean set of code. -These problems cause a linter to be much slower - which can be much more of a problem in projects that enable [typed linting](../Typed_Linting.mdx). +These problems cause a linter to be much slower - which can be much more of a problem in projects that enable [typed linting](../getting-started/Typed_Linting.mdx). Formatting with a linter is also much less consistent and less able to handle edge-cases than a purpose-built formatter. The maintenance cost of formatting-related lint rules is typically very high as a result. @@ -40,6 +43,29 @@ You can then configure your formatter separately from ESLint. Using this config by adding it to the end of your `extends`: + + + +```js title="eslint.config.js" +// @ts-check + +import eslint from '@eslint/js'; +import someOtherConfig from 'eslint-config-other-configuration-that-enables-formatting-rules'; +import prettierConfig from 'eslint-config-prettier'; +import tseslint from 'typescript-eslint'; + +export default tseslint.config( + eslint.configs.recommended, + ...tseslint.configs.recommended, + ...someOtherConfig, + // Add this line + ...prettierConfig, +); +``` + + + + ```js title=".eslintrc.js" /* eslint-env node */ module.exports = { @@ -56,6 +82,9 @@ module.exports = { }; ``` + + + Note that even if you use a formatter other than `prettier`, you can use `eslint-config-prettier` as it exclusively turns **off** all formatting rules. #### `eslint-plugin-prettier` @@ -65,7 +94,7 @@ Note that even if you use a formatter other than `prettier`, you can use `eslint - The _config_ only disables rules from core and other plugins. - The _plugin_ loads and runs Prettier inside ESLint. -Running Prettier inside ESLint can be slow: see [Performance Troubleshooting > `eslint-plugin-prettier`](./performance-troubleshooting#eslint-plugin-prettier). +Running Prettier inside ESLint can be slow: see [Performance Troubleshooting > `eslint-plugin-prettier`](./Performance.mdx#eslint-plugin-prettier). However, because it doesn't re-implement Prettier's logic in ESLint, the caveats mentioned about using linters for formatting don't apply to `eslint-plugin-prettier` either. ## ESLint Core and Formatting diff --git a/docs/linting/troubleshooting/Performance.mdx b/docs/troubleshooting/Performance.mdx similarity index 87% rename from docs/linting/troubleshooting/Performance.mdx rename to docs/troubleshooting/Performance.mdx index 71523c0db210..71a63da234b2 100644 --- a/docs/linting/troubleshooting/Performance.mdx +++ b/docs/troubleshooting/Performance.mdx @@ -3,7 +3,10 @@ id: performance-troubleshooting title: Performance Troubleshooting --- -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. +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +As mentioned in the [type-aware linting doc](../getting-started/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. @@ -23,11 +26,39 @@ Always ensure you provide globs targeted at the folders you are specifically wan 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. + + + +```js title="eslint.config.js" +// @ts-check + +import eslint from '@eslint/js'; +import tseslint from 'typescript-eslint'; + +export default tseslint.config( + eslint.configs.recommended, + ...tseslint.configs.recommendedRequiringTypeChecking, + { + languageOptions: { + parserOptions: { + tsconfigRootDir: import.meta.dirname, + // Remove this line + project: ['./**/tsconfig.json'], + // Add this line + project: ['./packages/*/tsconfig.json'], + }, + }, + }, +); +``` + + + + ```js title=".eslintrc.js" module.exports = { extends: [ 'eslint:recommended', - 'plugin:@typescript-eslint/recommended', 'plugin:@typescript-eslint/recommended-requiring-type-checking', ], parser: '@typescript-eslint/parser', @@ -43,6 +74,9 @@ module.exports = { }; ``` + + + See [Glob pattern in parser's option "project" slows down linting](https://github.com/typescript-eslint/typescript-eslint/issues/2611) for more details. ## The `indent` / `@typescript-eslint/indent` rules @@ -85,7 +119,7 @@ We recommend you do not use the following rules, as TypeScript provides the same - `import/namespace` - `import/default` - `import/no-named-as-default-member` -- `import/no-unresolved` (as long as you are using [`import` over `require`](https://typescript-eslint.io/rules/no-var-requires/)) +- `import/no-unresolved` (as long as you are using [`import` over `require`](/rules/no-var-requires/)) 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. diff --git a/docs/linting/troubleshooting/TSLint.mdx b/docs/troubleshooting/TSLint.mdx similarity index 97% rename from docs/linting/troubleshooting/TSLint.mdx rename to docs/troubleshooting/TSLint.mdx index 29e778aec936..1c595ac7c8a8 100644 --- a/docs/linting/troubleshooting/TSLint.mdx +++ b/docs/troubleshooting/TSLint.mdx @@ -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`](../../packages/ESLint_Plugin_TSLint.mdx). +For this option, check out [`@typescript-eslint/eslint-plugin-tslint`](../packages/ESLint_Plugin_TSLint.mdx). ## Why Deprecate TSLint? diff --git a/docs/users/Releases.mdx b/docs/users/Releases.mdx index 4ad0fdd9db70..09070f950ecb 100644 --- a/docs/users/Releases.mdx +++ b/docs/users/Releases.mdx @@ -50,22 +50,10 @@ During these periods, we manually publish `canary` releases until we are happy w To try out the latest canary versions of typescript-eslint, install `@typescript-eslint/eslint-plugin@canary` and `@typescript-eslint/parser@canary`. Note that npm may need a `--force` to override version requirements. - - -### npm - -```bash +```bash npm2yarn npm i @typescript-eslint/eslint-plugin@canary @typescript-eslint/parser@canary --save-dev --force ``` -### Yarn - -```bash -yarn add @typescript-eslint/eslint-plugin@canary @typescript-eslint/parser@canary --dev -``` - - - ## Major Releases We currently do not have a set schedule around when major releases shall be performed; instead they are done as the need arises. diff --git a/docs/linting/Configurations.mdx b/docs/users/Shared_Configurations.mdx similarity index 95% rename from docs/linting/Configurations.mdx rename to docs/users/Shared_Configurations.mdx index 7d997c3d5a88..03cb635d0cb8 100644 --- a/docs/linting/Configurations.mdx +++ b/docs/users/Shared_Configurations.mdx @@ -1,6 +1,6 @@ --- id: configs -title: Configurations +title: Shared Configs --- import Tabs from '@theme/Tabs'; @@ -16,7 +16,7 @@ import TabItem from '@theme/TabItem'; ### Projects Without Type Checking -If your project does not enable [typed linting](./Typed_Linting.mdx), we suggest enabling the [`recommended`](#recommended) and [`stylistic`](#stylistic) configurations to start: +If your project does not enable [typed linting](../getting-started/Typed_Linting.mdx), we suggest enabling the [`recommended`](#recommended) and [`stylistic`](#stylistic) configurations to start: @@ -49,7 +49,7 @@ module.exports = { ### Projects With Type Checking -If your project enables [typed linting](./Typed_Linting.mdx), we suggest enabling the [`recommended-type-checked`](#recommended-type-checked) and [`stylistic-type-checked`](#stylistic-type-checked) configurations to start: +If your project enables [typed linting](../getting-started/Typed_Linting.mdx), we suggest enabling the [`recommended-type-checked`](#recommended-type-checked) and [`stylistic-type-checked`](#stylistic-type-checked) configurations to start: @@ -398,4 +398,4 @@ If you feel strongly that a specific rule should (or should not) be one of these None of the preset configs provided by typescript-eslint enable formatting rules (rules that only serve to enforce code whitespace and other trivia). We strongly recommend you use Prettier or an equivalent for formatting your code, not ESLint formatting rules. -See [What About Formatting? > Suggested Usage](./troubleshooting/Formatting.mdx#suggested-usage---prettier). +See [What About Formatting? > Suggested Usage](../troubleshooting/Formatting.mdx#suggested-usage---prettier). diff --git a/packages/eslint-plugin/docs/rules/README.md b/packages/eslint-plugin/docs/rules/README.md index 7b4d4dde58ed..32c1cefc16e0 100644 --- a/packages/eslint-plugin/docs/rules/README.md +++ b/packages/eslint-plugin/docs/rules/README.md @@ -9,7 +9,7 @@ slug: / `@typescript-eslint/eslint-plugin` includes over 100 rules that detect best practice violations, bugs, and/or stylistic issues specifically for TypeScript code. All of our rules are listed below. :::tip -Instead of enabling rules one by one, we recommend using one of [our pre-defined configs](/linting/configs) to enable a large set of recommended rules. +Instead of enabling rules one by one, we recommend using one of [our pre-defined configs](/users/configs) to enable a large set of recommended rules. ::: ## Rules @@ -24,17 +24,17 @@ import RulesTable from "@site/src/components/RulesTable"; ### Config Group (⚙️) -"Config Group" refers to the [pre-defined config](/linting/configs) that includes the rule. Extending from a configuration preset allow for enabling a large set of recommended rules all at once. +"Config Group" refers to the [pre-defined config](/users/configs) that includes the rule. Extending from a configuration preset allow for enabling a large set of recommended rules all at once. ### Metadata - `🔧 fixable` refers to whether the rule contains an [ESLint `--fix` auto-fixer](https://eslint.org/docs/latest/use/command-line-interface#--fix). - `💡 has suggestions` refers to whether the rule contains an ESLint suggestion fixer. - Sometimes, it is not safe to automatically fix the code with an auto-fixer. But in these cases, we often have a good guess of what the correct fix should be, and we can provide it as a suggestion to the developer. -- `💭 requires type information` refers to whether the rule requires [typed linting](/linting/typed-linting). +- `💭 requires type information` refers to whether the rule requires [typed linting](/getting-started/typed-linting). - `🧱 extension rule` means that the rule is an extension of an [core ESLint rule](https://eslint.org/docs/latest/rules) (see [Extension Rules](#extension-rules)). - `📐 formatting rule` means that the rule has to do with formatting. - - We [strongly recommend against using ESLint for formatting](/linting/troubleshooting/formatting). + - We [strongly recommend against using ESLint for formatting](/troubleshooting/formatting). - Soon, formatting rules will be moved to the [ESLint stylistic plugin](https://eslint.style). - `💀 deprecated rule` means that the rule should no longer be used and will be removed from the plugin in a future version. diff --git a/packages/eslint-plugin/docs/rules/consistent-type-imports.md b/packages/eslint-plugin/docs/rules/consistent-type-imports.md index 496172f342e3..97e6ba147c26 100644 --- a/packages/eslint-plugin/docs/rules/consistent-type-imports.md +++ b/packages/eslint-plugin/docs/rules/consistent-type-imports.md @@ -92,7 +92,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/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](/getting-started/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/no-extra-semi.md b/packages/eslint-plugin/docs/rules/no-extra-semi.md index 2768bae0df25..b20f22d949d2 100644 --- a/packages/eslint-plugin/docs/rules/no-extra-semi.md +++ b/packages/eslint-plugin/docs/rules/no-extra-semi.md @@ -9,4 +9,4 @@ description: 'Disallow unnecessary semicolons.' This rule extends the base [`eslint/no-extra-semi`](https://eslint.org/docs/rules/no-extra-semi) rule. It adds support for class properties. -Note that this rule is classified as a "Suggestion" rule instead of a "Layout & Formatting" rule because [adding extra semi-colons actually changes the AST of the program](https://typescript-eslint.io/play/#ts=5.1.6&showAST=es&fileType=.ts&code=MYewdgzgLgBAHjAvDAjAbg0A&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQHYHsBaRADwBdoBDQ5RAWwEt0p8AzVyAGnG0gAEyATwAOKAMbQGwssWTwGuMgHoCxclRr0mGSImjR80SDwC%2BIE0A&tsconfig=&tokens=false). With that said, modern TypeScript formatters will remove extra semi-colons automatically during the formatting process. Thus, if you [use a formatter](/linting/troubleshooting/formatting), then enabling this rule is probably unnecessary. +Note that this rule is classified as a "Suggestion" rule instead of a "Layout & Formatting" rule because [adding extra semi-colons actually changes the AST of the program](https://typescript-eslint.io/play/#ts=5.1.6&showAST=es&fileType=.ts&code=MYewdgzgLgBAHjAvDAjAbg0A&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQHYHsBaRADwBdoBDQ5RAWwEt0p8AzVyAGnG0gAEyATwAOKAMbQGwssWTwGuMgHoCxclRr0mGSImjR80SDwC%2BIE0A&tsconfig=&tokens=false). With that said, modern TypeScript formatters will remove extra semi-colons automatically during the formatting process. Thus, if you [use a formatter](/troubleshooting/formatting), then enabling this rule is probably unnecessary. diff --git a/packages/eslint-plugin/docs/rules/no-type-alias.md b/packages/eslint-plugin/docs/rules/no-type-alias.md index e34b23548bb9..32caada41dc6 100644 --- a/packages/eslint-plugin/docs/rules/no-type-alias.md +++ b/packages/eslint-plugin/docs/rules/no-type-alias.md @@ -16,7 +16,7 @@ TypeScript type aliases are a commonly necessary language feature; banning it al :::note If you want to ban certain classifications of type aliases, consider using [`no-restricted-syntax`](https://eslint.org/docs/latest/rules/no-restricted-syntax). -See [Troubleshooting & FAQs](/linting/troubleshooting#how-can-i-ban-specific-language-feature). +See [Troubleshooting & FAQs](/troubleshooting#how-can-i-ban-specific-language-feature). ::: diff --git a/packages/eslint-plugin/src/configs/all.ts b/packages/eslint-plugin/src/configs/all.ts index b1890165c7ad..4c30f33ed9e5 100644 --- a/packages/eslint-plugin/src/configs/all.ts +++ b/packages/eslint-plugin/src/configs/all.ts @@ -1,6 +1,6 @@ // THIS CODE WAS AUTOMATICALLY GENERATED // DO NOT EDIT THIS CODE BY HAND -// SEE https://typescript-eslint.io/linting/configs +// SEE https://typescript-eslint.io/users/configs // // For developers working in the typescript-eslint monorepo: // You can regenerate it using `yarn generate:configs` diff --git a/packages/eslint-plugin/src/configs/disable-type-checked.ts b/packages/eslint-plugin/src/configs/disable-type-checked.ts index 09a5c07fd3e7..48cf79d56e22 100644 --- a/packages/eslint-plugin/src/configs/disable-type-checked.ts +++ b/packages/eslint-plugin/src/configs/disable-type-checked.ts @@ -1,6 +1,6 @@ // THIS CODE WAS AUTOMATICALLY GENERATED // DO NOT EDIT THIS CODE BY HAND -// SEE https://typescript-eslint.io/linting/configs +// SEE https://typescript-eslint.io/users/configs // // For developers working in the typescript-eslint monorepo: // You can regenerate it using `yarn generate:configs` diff --git a/packages/eslint-plugin/src/configs/recommended-type-checked.ts b/packages/eslint-plugin/src/configs/recommended-type-checked.ts index 6c0a8aff826e..38d36c132851 100644 --- a/packages/eslint-plugin/src/configs/recommended-type-checked.ts +++ b/packages/eslint-plugin/src/configs/recommended-type-checked.ts @@ -1,6 +1,6 @@ // THIS CODE WAS AUTOMATICALLY GENERATED // DO NOT EDIT THIS CODE BY HAND -// SEE https://typescript-eslint.io/linting/configs +// SEE https://typescript-eslint.io/users/configs // // For developers working in the typescript-eslint monorepo: // You can regenerate it using `yarn generate:configs` diff --git a/packages/eslint-plugin/src/configs/recommended.ts b/packages/eslint-plugin/src/configs/recommended.ts index a4c94992c159..80a607a3288f 100644 --- a/packages/eslint-plugin/src/configs/recommended.ts +++ b/packages/eslint-plugin/src/configs/recommended.ts @@ -1,6 +1,6 @@ // THIS CODE WAS AUTOMATICALLY GENERATED // DO NOT EDIT THIS CODE BY HAND -// SEE https://typescript-eslint.io/linting/configs +// SEE https://typescript-eslint.io/users/configs // // For developers working in the typescript-eslint monorepo: // You can regenerate it using `yarn generate:configs` diff --git a/packages/eslint-plugin/src/configs/strict-type-checked.ts b/packages/eslint-plugin/src/configs/strict-type-checked.ts index 5666c64035da..836a0ec76e7c 100644 --- a/packages/eslint-plugin/src/configs/strict-type-checked.ts +++ b/packages/eslint-plugin/src/configs/strict-type-checked.ts @@ -1,6 +1,6 @@ // THIS CODE WAS AUTOMATICALLY GENERATED // DO NOT EDIT THIS CODE BY HAND -// SEE https://typescript-eslint.io/linting/configs +// SEE https://typescript-eslint.io/users/configs // // For developers working in the typescript-eslint monorepo: // You can regenerate it using `yarn generate:configs` diff --git a/packages/eslint-plugin/src/configs/strict.ts b/packages/eslint-plugin/src/configs/strict.ts index 75952e10634b..e49b8cbcadc1 100644 --- a/packages/eslint-plugin/src/configs/strict.ts +++ b/packages/eslint-plugin/src/configs/strict.ts @@ -1,6 +1,6 @@ // THIS CODE WAS AUTOMATICALLY GENERATED // DO NOT EDIT THIS CODE BY HAND -// SEE https://typescript-eslint.io/linting/configs +// SEE https://typescript-eslint.io/users/configs // // For developers working in the typescript-eslint monorepo: // You can regenerate it using `yarn generate:configs` diff --git a/packages/eslint-plugin/src/configs/stylistic-type-checked.ts b/packages/eslint-plugin/src/configs/stylistic-type-checked.ts index 73c1404c3f45..0bb075e5c8f2 100644 --- a/packages/eslint-plugin/src/configs/stylistic-type-checked.ts +++ b/packages/eslint-plugin/src/configs/stylistic-type-checked.ts @@ -1,6 +1,6 @@ // THIS CODE WAS AUTOMATICALLY GENERATED // DO NOT EDIT THIS CODE BY HAND -// SEE https://typescript-eslint.io/linting/configs +// SEE https://typescript-eslint.io/users/configs // // For developers working in the typescript-eslint monorepo: // You can regenerate it using `yarn generate:configs` diff --git a/packages/eslint-plugin/src/configs/stylistic.ts b/packages/eslint-plugin/src/configs/stylistic.ts index 66c31eaa0eb0..74f2586dd78b 100644 --- a/packages/eslint-plugin/src/configs/stylistic.ts +++ b/packages/eslint-plugin/src/configs/stylistic.ts @@ -1,6 +1,6 @@ // THIS CODE WAS AUTOMATICALLY GENERATED // DO NOT EDIT THIS CODE BY HAND -// SEE https://typescript-eslint.io/linting/configs +// SEE https://typescript-eslint.io/users/configs // // For developers working in the typescript-eslint monorepo: // You can regenerate it using `yarn generate:configs` diff --git a/packages/integration-tests/fixtures/flat-config-types/eslint.config.js b/packages/integration-tests/fixtures/flat-config-types/eslint.config.js index 93701448726a..a7096065b106 100644 --- a/packages/integration-tests/fixtures/flat-config-types/eslint.config.js +++ b/packages/integration-tests/fixtures/flat-config-types/eslint.config.js @@ -18,6 +18,10 @@ const compat = new FlatCompat({ // this config is run through eslint as part of the integration test // so it needs to be a correct config export default tseslint.config( + { + // config with just ignores is the replacement for `.eslintignore` + ignores: ['**/build/**', '**/dist/**', 'src/some/file/to/ignore.ts'], + }, { plugins: { ['@typescript-eslint']: tseslint.plugin, @@ -30,28 +34,34 @@ export default tseslint.config( stylisticPlugin.configs['recommended-flat'], ); -// these are just tests for the types and are not seen by eslint so they can be whatever -tseslint.config({ - plugins: { - ['@stylistic']: stylisticPlugin, - ['@typescript-eslint']: tseslint.plugin, - ['deprecation']: deprecationPlugin, - ['jest']: jestPlugin, - }, -}); -tseslint.config( - eslint.configs.recommended, - ...tseslint.configs.recommended, - stylisticPlugin.configs['recommended-flat'], -); -tseslint.config( - // @ts-expect-error - compat.config(deprecationPlugin.configs.recommended), - ...compat.config(jestPlugin.configs.recommended), -); -tseslint.config( - // @ts-expect-error - deprecationPlugin.configs.recommended, - // this should error but doesn't because there are no types exported from the jest plugin - jestPlugin.configs.recommended, -); +// wrapped in a function so they aren't executed at lint time +function _otherCases() { + // these are just tests for the types and are not seen by eslint so they can be whatever + tseslint.config({ + plugins: { + ['@stylistic']: stylisticPlugin, + ['@typescript-eslint']: tseslint.plugin, + ['deprecation']: deprecationPlugin, + ['jest']: jestPlugin, + }, + }); + tseslint.config( + eslint.configs.recommended, + ...tseslint.configs.recommended, + stylisticPlugin.configs['recommended-flat'], + jestPlugin.configs['flat/recommended'], + ); + tseslint.config( + // @ts-expect-error + compat.config(deprecationPlugin.configs.recommended), + ...compat.config(jestPlugin.configs.recommended), + ); + tseslint.config( + // @ts-expect-error + deprecationPlugin.configs.recommended, + // this should error but doesn't because there are no types exported from the jest plugin + jestPlugin.configs.recommended, + // this should error but doesn't because there are no types exported from the jest plugin + ...jestPlugin.configs['flat/recommended'], + ); +} diff --git a/packages/integration-tests/tests/__snapshots__/flat-config-types.test.ts.snap b/packages/integration-tests/tests/__snapshots__/flat-config-types.test.ts.snap index 4280148fc361..a4ff003ab83b 100644 --- a/packages/integration-tests/tests/__snapshots__/flat-config-types.test.ts.snap +++ b/packages/integration-tests/tests/__snapshots__/flat-config-types.test.ts.snap @@ -3,17 +3,28 @@ exports[`flat-config-types eslint should work successfully 1`] = ` [ { - "errorCount": 2, + "errorCount": 3, "fatalErrorCount": 0, "filePath": "/eslint.config.js", "fixableErrorCount": 0, "fixableWarningCount": 0, "messages": [ { - "column": 3, - "endColumn": 22, - "endLine": 48, - "line": 48, + "column": 10, + "endColumn": 21, + "endLine": 38, + "line": 38, + "message": "'_otherCases' is defined but never used.", + "messageId": "unusedVar", + "nodeType": "Identifier", + "ruleId": "@typescript-eslint/no-unused-vars", + "severity": 2, + }, + { + "column": 5, + "endColumn": 24, + "endLine": 55, + "line": 55, "message": "Include a description after the "@ts-expect-error" directive to explain why the @ts-expect-error is necessary. The description must be 3 characters or longer.", "messageId": "tsDirectiveCommentRequiresDescription", "nodeType": "Line", @@ -21,10 +32,10 @@ exports[`flat-config-types eslint should work successfully 1`] = ` "severity": 2, }, { - "column": 3, - "endColumn": 22, - "endLine": 53, - "line": 53, + "column": 5, + "endColumn": 24, + "endLine": 60, + "line": 60, "message": "Include a description after the "@ts-expect-error" directive to explain why the @ts-expect-error is necessary. The description must be 3 characters or longer.", "messageId": "tsDirectiveCommentRequiresDescription", "nodeType": "Line", @@ -52,6 +63,10 @@ const compat = new FlatCompat({ // this config is run through eslint as part of the integration test // so it needs to be a correct config export default tseslint.config( + { + // config with just ignores is the replacement for \`.eslintignore\` + ignores: ['**/build/**', '**/dist/**', 'src/some/file/to/ignore.ts'], + }, { plugins: { ['@typescript-eslint']: tseslint.plugin, @@ -64,31 +79,37 @@ export default tseslint.config( stylisticPlugin.configs['recommended-flat'], ) -// these are just tests for the types and are not seen by eslint so they can be whatever -tseslint.config({ - plugins: { - ['@stylistic']: stylisticPlugin, - ['@typescript-eslint']: tseslint.plugin, - ['deprecation']: deprecationPlugin, - ['jest']: jestPlugin, - }, -}) -tseslint.config( - eslint.configs.recommended, - ...tseslint.configs.recommended, - stylisticPlugin.configs['recommended-flat'], -) -tseslint.config( - // @ts-expect-error - compat.config(deprecationPlugin.configs.recommended), - ...compat.config(jestPlugin.configs.recommended), -) -tseslint.config( - // @ts-expect-error - deprecationPlugin.configs.recommended, - // this should error but doesn't because there are no types exported from the jest plugin - jestPlugin.configs.recommended, -) +// wrapped in a function so they aren't executed at lint time +function _otherCases() { + // these are just tests for the types and are not seen by eslint so they can be whatever + tseslint.config({ + plugins: { + ['@stylistic']: stylisticPlugin, + ['@typescript-eslint']: tseslint.plugin, + ['deprecation']: deprecationPlugin, + ['jest']: jestPlugin, + }, + }) + tseslint.config( + eslint.configs.recommended, + ...tseslint.configs.recommended, + stylisticPlugin.configs['recommended-flat'], + jestPlugin.configs['flat/recommended'], + ) + tseslint.config( + // @ts-expect-error + compat.config(deprecationPlugin.configs.recommended), + ...compat.config(jestPlugin.configs.recommended), + ) + tseslint.config( + // @ts-expect-error + deprecationPlugin.configs.recommended, + // this should error but doesn't because there are no types exported from the jest plugin + jestPlugin.configs.recommended, + // this should error but doesn't because there are no types exported from the jest plugin + ...jestPlugin.configs['flat/recommended'], + ) +} ", "suppressedMessages": [], "usedDeprecatedRules": [ diff --git a/packages/repo-tools/src/generate-configs.mts b/packages/repo-tools/src/generate-configs.mts index acf7819a461a..b32f0b7d5f1c 100644 --- a/packages/repo-tools/src/generate-configs.mts +++ b/packages/repo-tools/src/generate-configs.mts @@ -29,7 +29,7 @@ const chalk = { const AUTO_GENERATED_COMMENT_LINES = [ '// THIS CODE WAS AUTOMATICALLY GENERATED', '// DO NOT EDIT THIS CODE BY HAND', - '// SEE https://typescript-eslint.io/linting/configs', + '// SEE https://typescript-eslint.io/users/configs', '//', '// For developers working in the typescript-eslint monorepo:', '// You can regenerate it using `yarn generate:configs`', diff --git a/packages/typescript-eslint/src/configs/all.ts b/packages/typescript-eslint/src/configs/all.ts index f891ff9b92f4..ebade354a351 100644 --- a/packages/typescript-eslint/src/configs/all.ts +++ b/packages/typescript-eslint/src/configs/all.ts @@ -1,6 +1,6 @@ // THIS CODE WAS AUTOMATICALLY GENERATED // DO NOT EDIT THIS CODE BY HAND -// SEE https://typescript-eslint.io/linting/configs +// SEE https://typescript-eslint.io/users/configs // // For developers working in the typescript-eslint monorepo: // You can regenerate it using `yarn generate:configs` diff --git a/packages/typescript-eslint/src/configs/disable-type-checked.ts b/packages/typescript-eslint/src/configs/disable-type-checked.ts index da3a0b7256df..17801026e24a 100644 --- a/packages/typescript-eslint/src/configs/disable-type-checked.ts +++ b/packages/typescript-eslint/src/configs/disable-type-checked.ts @@ -1,6 +1,6 @@ // THIS CODE WAS AUTOMATICALLY GENERATED // DO NOT EDIT THIS CODE BY HAND -// SEE https://typescript-eslint.io/linting/configs +// SEE https://typescript-eslint.io/users/configs // // For developers working in the typescript-eslint monorepo: // You can regenerate it using `yarn generate:configs` diff --git a/packages/typescript-eslint/src/configs/recommended-type-checked.ts b/packages/typescript-eslint/src/configs/recommended-type-checked.ts index 7d9ac811e1c7..77feebb92cba 100644 --- a/packages/typescript-eslint/src/configs/recommended-type-checked.ts +++ b/packages/typescript-eslint/src/configs/recommended-type-checked.ts @@ -1,6 +1,6 @@ // THIS CODE WAS AUTOMATICALLY GENERATED // DO NOT EDIT THIS CODE BY HAND -// SEE https://typescript-eslint.io/linting/configs +// SEE https://typescript-eslint.io/users/configs // // For developers working in the typescript-eslint monorepo: // You can regenerate it using `yarn generate:configs` diff --git a/packages/typescript-eslint/src/configs/recommended.ts b/packages/typescript-eslint/src/configs/recommended.ts index ae5103d9fea8..042891ebf9b2 100644 --- a/packages/typescript-eslint/src/configs/recommended.ts +++ b/packages/typescript-eslint/src/configs/recommended.ts @@ -1,6 +1,6 @@ // THIS CODE WAS AUTOMATICALLY GENERATED // DO NOT EDIT THIS CODE BY HAND -// SEE https://typescript-eslint.io/linting/configs +// SEE https://typescript-eslint.io/users/configs // // For developers working in the typescript-eslint monorepo: // You can regenerate it using `yarn generate:configs` diff --git a/packages/typescript-eslint/src/configs/strict-type-checked.ts b/packages/typescript-eslint/src/configs/strict-type-checked.ts index c1c4628d0cdf..91abadd4b563 100644 --- a/packages/typescript-eslint/src/configs/strict-type-checked.ts +++ b/packages/typescript-eslint/src/configs/strict-type-checked.ts @@ -1,6 +1,6 @@ // THIS CODE WAS AUTOMATICALLY GENERATED // DO NOT EDIT THIS CODE BY HAND -// SEE https://typescript-eslint.io/linting/configs +// SEE https://typescript-eslint.io/users/configs // // For developers working in the typescript-eslint monorepo: // You can regenerate it using `yarn generate:configs` diff --git a/packages/typescript-eslint/src/configs/strict.ts b/packages/typescript-eslint/src/configs/strict.ts index e54b7d07322e..c1eb5e29cf3d 100644 --- a/packages/typescript-eslint/src/configs/strict.ts +++ b/packages/typescript-eslint/src/configs/strict.ts @@ -1,6 +1,6 @@ // THIS CODE WAS AUTOMATICALLY GENERATED // DO NOT EDIT THIS CODE BY HAND -// SEE https://typescript-eslint.io/linting/configs +// SEE https://typescript-eslint.io/users/configs // // For developers working in the typescript-eslint monorepo: // You can regenerate it using `yarn generate:configs` diff --git a/packages/typescript-eslint/src/configs/stylistic-type-checked.ts b/packages/typescript-eslint/src/configs/stylistic-type-checked.ts index 3923973100b3..e72f5accc5f9 100644 --- a/packages/typescript-eslint/src/configs/stylistic-type-checked.ts +++ b/packages/typescript-eslint/src/configs/stylistic-type-checked.ts @@ -1,6 +1,6 @@ // THIS CODE WAS AUTOMATICALLY GENERATED // DO NOT EDIT THIS CODE BY HAND -// SEE https://typescript-eslint.io/linting/configs +// SEE https://typescript-eslint.io/users/configs // // For developers working in the typescript-eslint monorepo: // You can regenerate it using `yarn generate:configs` diff --git a/packages/typescript-eslint/src/configs/stylistic.ts b/packages/typescript-eslint/src/configs/stylistic.ts index 4db1a78f9a0a..a8b9a0368c2d 100644 --- a/packages/typescript-eslint/src/configs/stylistic.ts +++ b/packages/typescript-eslint/src/configs/stylistic.ts @@ -1,6 +1,6 @@ // THIS CODE WAS AUTOMATICALLY GENERATED // DO NOT EDIT THIS CODE BY HAND -// SEE https://typescript-eslint.io/linting/configs +// SEE https://typescript-eslint.io/users/configs // // For developers working in the typescript-eslint monorepo: // You can regenerate it using `yarn generate:configs` diff --git a/packages/typescript-eslint/src/index.ts b/packages/typescript-eslint/src/index.ts index ad8487db5848..4f1b55c4ea64 100644 --- a/packages/typescript-eslint/src/index.ts +++ b/packages/typescript-eslint/src/index.ts @@ -25,20 +25,66 @@ const plugin: TSESLint.FlatConfig.Plugin = { rules: pluginBase.rules, }; -export = { +const configs = { + all: allConfig(plugin, parser), + base: baseConfig(plugin, parser), + disableTypeChecked: disableTypeCheckedConfig(plugin, parser), + eslintRecommended: eslintRecommendedConfig(plugin, parser), + recommended: recommendedConfig(plugin, parser), + recommendedTypeChecked: recommendedTypeCheckedConfig(plugin, parser), + strict: strictConfig(plugin, parser), + strictTypeChecked: strictTypeCheckedConfig(plugin, parser), + stylistic: stylisticConfig(plugin, parser), + stylisticTypeChecked: stylisticTypeCheckedConfig(plugin, parser), +}; + +export type Config = TSESLint.FlatConfig.ConfigFile; +/* +eslint-disable-next-line import/no-default-export -- +we do both a default and named exports to allow people to use this package from +both CJS and ESM in very natural ways. + +EG it means that all of the following are valid: + +```ts +import tseslint from 'typescript-eslint'; + +export default tseslint.config( + ...tseslint.configs.recommended, +); +``` +```ts +import { config, parser, plugin } from 'typescript-eslint'; + +export default config( + { + languageOptions: { parser } + plugins: { ts: plugin }, + } +); +``` +```ts +const tseslint = require('typescript-eslint'); + +module.exports = tseslint.config( + ...tseslint.configs.recommended, +); +``` +```ts +const { config, parser, plugin } = require('typescript-eslint'); + +module.exports = config( + { + languageOptions: { parser } + plugins: { ts: plugin }, + } +); +``` +*/ +export default { config, - configs: { - all: allConfig(plugin, parser), - base: baseConfig(plugin, parser), - disableTypeChecked: disableTypeCheckedConfig(plugin, parser), - eslintRecommended: eslintRecommendedConfig(plugin, parser), - recommended: recommendedConfig(plugin, parser), - recommendedTypeChecked: recommendedTypeCheckedConfig(plugin, parser), - strict: strictConfig(plugin, parser), - strictTypeChecked: strictTypeCheckedConfig(plugin, parser), - stylistic: stylisticConfig(plugin, parser), - stylisticTypeChecked: stylisticTypeCheckedConfig(plugin, parser), - }, + configs, parser, plugin, }; +export { config, configs, parser, plugin }; diff --git a/packages/website/blog/2023-03-13-announcing-typescript-eslint-v6-beta.md b/packages/website/blog/2023-03-13-announcing-typescript-eslint-v6-beta.md index d0b2d1c36b4f..38f9f289d03f 100644 --- a/packages/website/blog/2023-03-13-announcing-typescript-eslint-v6-beta.md +++ b/packages/website/blog/2023-03-13-announcing-typescript-eslint-v6-beta.md @@ -33,11 +33,10 @@ If you feel passionately about any of the choices we've made here -positively or ## Trying Out v6 Please do try out the typescript-eslint v6 beta! -Its documentation site is hosted on a preview deploy link: **[v6--typescript-eslint.netlify.app](https://v6--typescript-eslint.netlify.app)**. ### As A New User -If you don't yet use typescript-eslint, you can go through our [configuration steps on the v6 _Getting Started_ docs](https://v6--typescript-eslint.netlify.app/getting-started). +If you don't yet use typescript-eslint, you can go through our [configuration steps on the v6 _Getting Started_ docs](/getting-started). It'll walk you through setting up typescript-eslint in a project. To use v6 specifically, see the following section for an updated install command. @@ -61,12 +60,12 @@ These are the changes that users of typescript-eslint -generally, any developer ### Reworked Configuration Names -The biggest configuration change in typescript-eslint v6 is that we've reworked the names of our [provided user configuration files](https://v6--typescript-eslint.netlify.app/linting/configs). +The biggest configuration change in typescript-eslint v6 is that we've reworked the names of our [provided user configuration files](/users/configs). typescript-eslint v5 provided three recommended configurations: -- [`recommended`](https://v6--typescript-eslint.netlify.app/linting/configs#recommended): Recommended rules for code correctness that you can drop in without additional configuration. -- [`recommended-requiring-type-checking`](https://v6--typescript-eslint.netlify.app/linting/configs#recommended-requiring-type-checking): Additional recommended rules that require type information. -- [`strict`](https://v6--typescript-eslint.netlify.app/linting/configs#strict): Additional strict rules that can also catch bugs but are more opinionated than recommended rules. +- [`recommended`](/users/configs#recommended): Recommended rules for code correctness that you can drop in without additional configuration. +- [`recommended-requiring-type-checking`](/users/configs#recommended-requiring-type-checking): Additional recommended rules that require type information. +- [`strict`](/users/configs#strict): Additional strict rules that can also catch bugs but are more opinionated than recommended rules. Those configurations worked well for most projects. However, some users correctly noted two flaws in that approach: @@ -121,7 +120,7 @@ module.exports = { }; ``` -See [_Configurations_ on the v6 docs site preview](https://v6--typescript-eslint.netlify.app/linting/configs) for the updated documentation on configurations provided by typescript-eslint. +See [_Configurations_ on the v6 docs site preview](/users/configs) for the updated documentation on configurations provided by typescript-eslint. For more information on these changes, see: @@ -165,8 +164,8 @@ Several rules were changed in significant enough ways to be considered breaking - `@typescript-eslint/no-implicit-any-catch` - `@typescript-eslint/no-parameter-properties` - `@typescript-eslint/sort-type-union-intersection-members` -- [feat(eslint-plugin): [prefer-nullish-coalescing]: add support for assignment expressions](https://github.com/typescript-eslint/typescript-eslint/pull/5234): Enhances the [`@typescript-eslint/prefer-nullish-coalescing`](https://v6--typescript-eslint.netlify.app/prefer-nullish-coalescing) rule to also check `||=` expressions. -- [feat(eslint-plugin): [prefer-optional-chain] use type checking for strict falsiness](https://github.com/typescript-eslint/typescript-eslint/pull/6240): Rewrites the [`@typescript-eslint/prefer-optional-chain`](https://v6--typescript-eslint.netlify.app/prefer-optional-chain) rule to fix numerous false positives, at the cost of making it require type information. +- [feat(eslint-plugin): [prefer-nullish-coalescing]: add support for assignment expressions](https://github.com/typescript-eslint/typescript-eslint/pull/5234): Enhances the [`@typescript-eslint/prefer-nullish-coalescing`](/rules/prefer-nullish-coalescing) rule to also check `||=` expressions. +- [feat(eslint-plugin): [prefer-optional-chain] use type checking for strict falsiness](https://github.com/typescript-eslint/typescript-eslint/pull/6240): Rewrites the [`@typescript-eslint/prefer-optional-chain`](/rules/prefer-optional-chain) rule to fix numerous false positives, at the cost of making it require type information. ### Tooling Breaking Changes @@ -242,7 +241,7 @@ Rules can still retrieve their full backing TypeScript type checker with `servic This can be necessary for TypeScript APIs not wrapped by the parser services. ::: -See [_Custom Rules_ on the v6 docs site preview](https://v6--typescript-eslint.netlify.app/developers/custom-rules) for the updated documentation on creating custom rules with typescript-eslint. +See [_Custom Rules_ on the v6 docs site preview](/developers/custom-rules) for the updated documentation on creating custom rules with typescript-eslint. ### AST Breaking Changes diff --git a/packages/website/blog/2023-07-09-announcing-typescript-eslint-v6.md b/packages/website/blog/2023-07-09-announcing-typescript-eslint-v6.md index f1db265643da..e0352744d189 100644 --- a/packages/website/blog/2023-07-09-announcing-typescript-eslint-v6.md +++ b/packages/website/blog/2023-07-09-announcing-typescript-eslint-v6.md @@ -46,12 +46,12 @@ These are the changes that users of typescript-eslint -generally, any developer ### Reworked Configuration Names -The biggest configuration change in typescript-eslint v6 is that we've reworked the names of our [provided user configuration files](https://typescript-eslint.io/linting/configs). +The biggest configuration change in typescript-eslint v6 is that we've reworked the names of our [provided user configuration files](/users/configs). typescript-eslint v5 provided three recommended configurations: -- [`recommended`](https://typescript-eslint.io/linting/configs#recommended): Recommended rules for code correctness that you can drop in without additional configuration. -- [`recommended-requiring-type-checking`](https://typescript-eslint.io/linting/configs#recommended-requiring-type-checking): Additional recommended rules that require type information. -- [`strict`](https://typescript-eslint.io/linting/configs#strict): Additional strict rules that can also catch bugs but are more opinionated than recommended rules. +- [`recommended`](/users/configs#recommended): Recommended rules for code correctness that you can drop in without additional configuration. +- [`recommended-requiring-type-checking`](/users/configs#recommended-requiring-type-checking): Additional recommended rules that require type information. +- [`strict`](/users/configs#strict): Additional strict rules that can also catch bugs but are more opinionated than recommended rules. Those configurations worked well for most projects. However, some users correctly noted two flaws in that approach: @@ -106,11 +106,11 @@ module.exports = { }; ``` -See [our _Configurations_ linting docs](/linting/configs) for the updated documentation on configurations provided by typescript-eslint. +See [our _Configurations_ linting docs](/users/configs) for the updated documentation on configurations provided by typescript-eslint. For more information on these changes, see: -- [Our documentation on our configurations](https://typescript-eslint.io/linting/configs). +- [Our documentation on our configurations](/users/configs). - [Configs: Have recommended/strict configs include lesser configs, and simplify type checked names](https://github.com/typescript-eslint/typescript-eslint/discussions/6019) for the discussion leading up to these configuration changes. - [feat(eslint-plugin): rework configs: recommended, strict, stylistic; -type-checked](https://github.com/typescript-eslint/typescript-eslint/pull/5251) for the pull request implementing the changes. @@ -485,8 +485,8 @@ Several rules were changed in significant enough ways to be considered breaking - `@typescript-eslint/no-implicit-any-catch`, replaced by the TSConfig option [`useUnknownInCatchVariables`](https://www.typescriptlang.org/tsconfig#useUnknownInCatchVariables) - `@typescript-eslint/no-parameter-properties`, replaced by `@typescript-eslint/parameter-properties` - `@typescript-eslint/sort-type-union-intersection-members`, replaced by `@typescript-eslint/sort-type-constituents` -- [feat(eslint-plugin): [prefer-nullish-coalescing]: add support for assignment expressions](https://github.com/typescript-eslint/typescript-eslint/pull/5234): Enhances the [`@typescript-eslint/prefer-nullish-coalescing`](https://typescript-eslint.io/prefer-nullish-coalescing) rule to also check `||=` expressions. -- [feat(eslint-plugin): [prefer-optional-chain] use type checking for strict falsiness](https://github.com/typescript-eslint/typescript-eslint/pull/6240): Fixes edge case bugs in the [`@typescript-eslint/prefer-optional-chain`](https://typescript-eslint.io/prefer-optional-chain) rule around false positives, at the cost of making it require type information. +- [feat(eslint-plugin): [prefer-nullish-coalescing]: add support for assignment expressions](https://github.com/typescript-eslint/typescript-eslint/pull/5234): Enhances the [`@typescript-eslint/prefer-nullish-coalescing`](/rules/prefer-nullish-coalescing) rule to also check `||=` expressions. +- [feat(eslint-plugin): [prefer-optional-chain] use type checking for strict falsiness](https://github.com/typescript-eslint/typescript-eslint/pull/6240): Fixes edge case bugs in the [`@typescript-eslint/prefer-optional-chain`](/rules/prefer-optional-chain) rule around false positives, at the cost of making it require type information. - ✨ [feat(eslint-plugin): [restrict-plus-operands] change checkCompoundAssignments to skipCompoundAssignments](https://github.com/typescript-eslint/typescript-eslint/pull/7027): inverses the logical value of the option and renames it - ✨ [feat(eslint-plugin): [prefer-optional-chain] handle cases where the first operands are unrelated to the rest of the chain and add type info](https://github.com/typescript-eslint/typescript-eslint/pull/6397): uses type information to make the rule more intelligent about when to flag violations @@ -561,7 +561,7 @@ Rules can still retrieve their full backing TypeScript type checker with `servic This can be necessary for TypeScript APIs not wrapped by the parser services. ::: -See [_Custom Rules_](https://typescript-eslint.io/developers/custom-rules) for the updated documentation on creating custom rules with typescript-eslint. +See [_Custom Rules_](/developers/custom-rules) for the updated documentation on creating custom rules with typescript-eslint. ### AST Breaking Changes diff --git a/packages/website/blog/2023-09-18-parser-options-project-true.md b/packages/website/blog/2023-09-18-parser-options-project-true.md index a28bb69c30ec..c767972508ae 100644 --- a/packages/website/blog/2023-09-18-parser-options-project-true.md +++ b/packages/website/blog/2023-09-18-parser-options-project-true.md @@ -10,7 +10,7 @@ tags: [parser, parser options, project, tsconfig] title: Relative TSConfig Projects with `parserOptions.project = true` --- -["Typed linting"](/linting/typed-linting), or enabling ESLint rules to tap into the power of the TypeScript type checker, is one of the best parts of typescript-eslint. +["Typed linting"](/getting-started/typed-linting), or enabling ESLint rules to tap into the power of the TypeScript type checker, is one of the best parts of typescript-eslint. But enabling the type checker in repositories with multiple `tsconfig.json` files can be annoying to set up. Even worse, specifying the wrong include paths could result in incorrect rule reports and/or unexpectedly slow lint times. @@ -51,7 +51,7 @@ Explicitly indicating which TSConfig files are used for typed linting can be use Developers like being given explicit control over their tooling. However, we've seen a few issues arise from this approach: -- Particularly large repos can end up with so many TSConfig globs, they become confusing to developers or even cause [performance issues from overly permissive globs](/linting/troubleshooting/performance-troubleshooting#wide-includes-in-your-eslint-options) +- Particularly large repos can end up with so many TSConfig globs, they become confusing to developers or even cause [performance issues from overly permissive globs](/troubleshooting/performance-troubleshooting#wide-includes-in-your-eslint-options) - Needing to change a template ESLint config every time it's used for a different repository structure is a pain - Using a TSConfig that's different from what your editor uses can result in different lint reports between the editor and the command-line @@ -135,7 +135,7 @@ Manual Program creation logic comes with a few issues: - For example, [typescript-eslint does not yet support Project References](https://github.com/typescript-eslint/typescript-eslint/issues/2094). - The TypeScript compiler options used in the user's editor might differ from the compiler options in the TSConfigs they specified on disk. - Files not included in created Programs can't be linted with type information, even though editors still typically surface type information when editing those files. - - Most commonly, `.eslintrc.(c)js` files can be tricky to lint, resulting in the dreaded [_TSConfig does not include this file_ error](/linting/troubleshooting#i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file). + - Most commonly, `.eslintrc.(c)js` files can be tricky to lint, resulting in the dreaded [_TSConfig does not include this file_ error](/troubleshooting#i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file). We're working on an option to instead call the same TypeScript "Project Service" APIs that editors such as VS Code use to create Programs for us instead. Project Services will automatically detect the TSConfig for each file (like `project: true`), and will also allow type information to be computed for JavaScript files without the `allowJs` compiler option (unlike `project: true`). diff --git a/packages/website/blog/2023-12-25-deprecating-formatting-rules.md b/packages/website/blog/2023-12-25-deprecating-formatting-rules.md index 439a8b4be14d..9bb344ee696f 100644 --- a/packages/website/blog/2023-12-25-deprecating-formatting-rules.md +++ b/packages/website/blog/2023-12-25-deprecating-formatting-rules.md @@ -21,8 +21,8 @@ We'll keep these deprecated rules available until our next major version. ## Context: Formatting Rules The ESLint blog post thoroughly explains the history and tradeoffs of formatting rules. -See also [ESLint's 2020 Changes to Rule Policies blog post](https://eslint.org/blog/2020/05/changes-to-rules-policies/#what-are-the-changes) and our _[What About Formatting?](/linting/troubleshooting/formatting)_ docs. -The performance downsides of formatting rules are heightened when [linting with type information](/linting/typed-linting). +See also [ESLint's 2020 Changes to Rule Policies blog post](https://eslint.org/blog/2020/05/changes-to-rules-policies/#what-are-the-changes) and our _[What About Formatting?](/troubleshooting/formatting)_ docs. +The performance downsides of formatting rules are heightened when [linting with type information](/getting-started/typed-linting). ## Timelines diff --git a/packages/website/docusaurusConfig.ts b/packages/website/docusaurusConfig.ts index 2ee976cf08cc..1598f96ffefa 100644 --- a/packages/website/docusaurusConfig.ts +++ b/packages/website/docusaurusConfig.ts @@ -1,4 +1,5 @@ import type { MDXPlugin } from '@docusaurus/mdx-loader'; +import type { Options as PluginRedirectOptions } from '@docusaurus/plugin-client-redirects'; import type { Options as PluginContentDocsOptions } from '@docusaurus/plugin-content-docs'; import type { Options as PluginPwaOptions } from '@docusaurus/plugin-pwa'; import type { Options as PresetClassicOptions } from '@docusaurus/preset-classic'; @@ -254,6 +255,39 @@ const pluginPwaOptions: PluginPwaOptions = { ], }; +const redirects: PluginRedirectOptions = { + redirects: [ + { + from: '/linting/configs', + to: '/users/configs', + }, + { + from: '/linting/troubleshooting', + to: '/troubleshooting', + }, + { + from: '/linting/troubleshooting/formatting', + to: '/troubleshooting/formatting', + }, + { + from: '/linting/troubleshooting/performance-troubleshooting', + to: '/troubleshooting/performance-troubleshooting', + }, + { + from: '/linting/troubleshooting/tslint', + to: '/troubleshooting/tslint', + }, + { + from: '/linting/typed-linting', + to: '/getting-started/typed-linting', + }, + { + from: '/linting/typed-linting/monorepos', + to: '/getting-started/typed-linting/monorepos', + }, + ], +}; + const config: Config = { title: 'typescript-eslint', tagline: @@ -274,6 +308,7 @@ const config: Config = { require.resolve('./webpack.plugin'), ['@docusaurus/plugin-content-docs', pluginContentDocsOptions], ['@docusaurus/plugin-pwa', pluginPwaOptions], + ['@docusaurus/plugin-client-redirects', redirects], ], themeConfig, // Misleading API name, but these are just tags diff --git a/packages/website/package.json b/packages/website/package.json index 1a55e33355bb..569ea3c695ca 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -18,6 +18,7 @@ "dependencies": { "@babel/runtime": "^7.22.6", "@docusaurus/core": "~2.4.1", + "@docusaurus/plugin-client-redirects": "~2.4.3", "@docusaurus/plugin-pwa": "~2.4.1", "@docusaurus/preset-classic": "~2.4.1", "@docusaurus/remark-plugin-npm2yarn": "~2.4.1", diff --git a/packages/website/plugins/generated-rule-docs/insertions/insertWhenNotToUseIt.ts b/packages/website/plugins/generated-rule-docs/insertions/insertWhenNotToUseIt.ts index 170a8f33a5d8..ad7949c4c6e4 100644 --- a/packages/website/plugins/generated-rule-docs/insertions/insertWhenNotToUseIt.ts +++ b/packages/website/plugins/generated-rule-docs/insertions/insertWhenNotToUseIt.ts @@ -34,7 +34,7 @@ export function insertWhenNotToUseIt(page: RuleDocsPage): void { { type: 'link', title: null, - url: `/linting/typed-linting`, + url: `/getting-started/typed-linting`, children: [ { type: 'text', @@ -49,7 +49,7 @@ export function insertWhenNotToUseIt(page: RuleDocsPage): void { { type: 'link', title: null, - url: `/linting/troubleshooting/performance-troubleshooting`, + url: `/troubleshooting/performance-troubleshooting`, children: [ { type: 'text', diff --git a/packages/website/sidebars/sidebar.base.js b/packages/website/sidebars/sidebar.base.js index b94a12c33660..1dedb8b220be 100644 --- a/packages/website/sidebars/sidebar.base.js +++ b/packages/website/sidebars/sidebar.base.js @@ -6,35 +6,41 @@ module.exports = { collapsible: false, items: [ { - collapsible: false, - items: ['linting/typed-linting/monorepos'], - label: 'Linting with Type Information', - link: { - id: 'linting/typed-linting', - type: 'doc', - }, - type: 'category', + label: 'Quickstart', + id: 'getting-started/quickstart', + type: 'doc', }, - 'linting/configs', { collapsible: false, - items: [ - 'linting/troubleshooting/performance-troubleshooting', - 'linting/troubleshooting/formatting', - 'linting/troubleshooting/tslint', - ], - label: 'Troubleshooting & FAQs', + items: ['getting-started/typed-linting/monorepos'], + label: 'Linting with Type Information', link: { - id: 'linting/troubleshooting', + id: 'getting-started/typed-linting', type: 'doc', }, type: 'category', }, - 'linting/legacy-eslint-setup', + 'getting-started/legacy-eslint-setup', ], label: 'Getting Started', link: { - id: 'getting-started', + id: 'getting-started/quickstart', + type: 'doc', + }, + type: 'category', + }, + + { + collapsible: false, + items: [ + 'troubleshooting/faqs', + 'troubleshooting/performance-troubleshooting', + 'troubleshooting/formatting', + 'troubleshooting/tslint', + ], + label: 'Troubleshooting & FAQs', + link: { + id: 'troubleshooting/faqs', type: 'doc', }, type: 'category', @@ -42,6 +48,12 @@ module.exports = { { collapsible: false, items: [ + { + label: 'Rules', + href: '/rules/', + type: 'link', + }, + 'users/configs', 'users/dependency-versions', 'users/releases', 'users/versioning', diff --git a/packages/website/src/theme/MDXComponents/RuleAttributes.tsx b/packages/website/src/theme/MDXComponents/RuleAttributes.tsx index 365dd15b1e8d..8340657d7742 100644 --- a/packages/website/src/theme/MDXComponents/RuleAttributes.tsx +++ b/packages/website/src/theme/MDXComponents/RuleAttributes.tsx @@ -43,7 +43,7 @@ export function RuleAttributes({ name }: { name: string }): React.ReactNode { children: ( <> Extending{' '} - + "plugin:@typescript-eslint/{recommendation}" @@ -94,7 +94,7 @@ export function RuleAttributes({ name }: { name: string }): React.ReactNode { children: ( <> This rule requires{' '} - + type information {' '} to run. diff --git a/yarn.lock b/yarn.lock index 9c7412a701e1..08c0f0fec0e2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2503,6 +2503,26 @@ __metadata: languageName: node linkType: hard +"@docusaurus/plugin-client-redirects@npm:~2.4.3": + version: 2.4.3 + resolution: "@docusaurus/plugin-client-redirects@npm:2.4.3" + dependencies: + "@docusaurus/core": 2.4.3 + "@docusaurus/logger": 2.4.3 + "@docusaurus/utils": 2.4.3 + "@docusaurus/utils-common": 2.4.3 + "@docusaurus/utils-validation": 2.4.3 + eta: ^2.0.0 + fs-extra: ^10.1.0 + lodash: ^4.17.21 + tslib: ^2.4.0 + peerDependencies: + react: ^16.8.4 || ^17.0.0 + react-dom: ^16.8.4 || ^17.0.0 + checksum: f039f89ad2658524819543ff4a370e409053bfd3b4851be82c3cceb6fcd39e954a1ca3bfd13e99fbd1f7fbb9cd69ed28545a852c8dbca2e8300eec23586767a4 + languageName: node + linkType: hard + "@docusaurus/plugin-content-blog@npm:2.4.3": version: 2.4.3 resolution: "@docusaurus/plugin-content-blog@npm:2.4.3" @@ -19260,6 +19280,7 @@ __metadata: "@babel/runtime": ^7.22.6 "@docusaurus/core": ~2.4.1 "@docusaurus/module-type-aliases": ~2.4.1 + "@docusaurus/plugin-client-redirects": ~2.4.3 "@docusaurus/plugin-pwa": ~2.4.1 "@docusaurus/preset-classic": ~2.4.1 "@docusaurus/remark-plugin-npm2yarn": ~2.4.1 From 405546afb66f8c1efce2e5757c6333651ef3c7da Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Tue, 20 Feb 2024 02:14:22 -0800 Subject: [PATCH 02/35] docs(typescript-eslint): temporarily update docs until next release this helper will come out next release - just switching the docs until then. --- docs/packages/TypeScript_ESLint.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/packages/TypeScript_ESLint.mdx b/docs/packages/TypeScript_ESLint.mdx index c5f1d2665245..5e910850b80d 100644 --- a/docs/packages/TypeScript_ESLint.mdx +++ b/docs/packages/TypeScript_ESLint.mdx @@ -186,7 +186,7 @@ export default tseslint.config( import eslint from '@eslint/js'; import tseslint from 'typescript-eslint'; -/** @type {import('typescript-eslint').Config} */ +/** @type {import('@typescript-eslint/utils').TSESLint.FlatConfig.ConfigFile} */ export default [ eslint.configs.recommended, ...tseslint.configs.recommended, From 05be50273bbe045a869a6a8ef337f852c762834b Mon Sep 17 00:00:00 2001 From: auvred <61150013+auvred@users.noreply.github.com> Date: Tue, 20 Feb 2024 17:24:04 +0300 Subject: [PATCH 03/35] chore: add auvred to committers team (#8514) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 🥳 * cspell --- .cspell.json | 1 + docs/maintenance/Team.mdx | 5 +++++ packages/website/static/img/team/auvred.jpg | Bin 0 -> 445 bytes 3 files changed, 6 insertions(+) create mode 100644 packages/website/static/img/team/auvred.jpg diff --git a/.cspell.json b/.cspell.json index 99feed384c1f..01235a662ad8 100644 --- a/.cspell.json +++ b/.cspell.json @@ -58,6 +58,7 @@ "autofixers", "autofixes", "automations", + "auvred", "backticks", "bigint", "bivariant", diff --git a/docs/maintenance/Team.mdx b/docs/maintenance/Team.mdx index 6091e3e6a02a..a9465f24b2ef 100644 --- a/docs/maintenance/Team.mdx +++ b/docs/maintenance/Team.mdx @@ -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." diff --git a/packages/website/static/img/team/auvred.jpg b/packages/website/static/img/team/auvred.jpg new file mode 100644 index 0000000000000000000000000000000000000000..71ffee29dca8894e05a35cb29d62b664fd3e9e35 GIT binary patch literal 445 zcmex=@c!Qf01*TgSO5S3 literal 0 HcmV?d00001 From f36f68263c40a9baf7871eeece0f56f3d686edc5 Mon Sep 17 00:00:00 2001 From: auvred <61150013+auvred@users.noreply.github.com> Date: Tue, 20 Feb 2024 17:57:55 +0300 Subject: [PATCH 04/35] chore(website): add line breaks for the bios on the Team page (#8516) --- packages/website/src/components/team/TeamBioList.module.css | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/website/src/components/team/TeamBioList.module.css b/packages/website/src/components/team/TeamBioList.module.css index a2815486a787..fdac3bf3cb23 100644 --- a/packages/website/src/components/team/TeamBioList.module.css +++ b/packages/website/src/components/team/TeamBioList.module.css @@ -6,6 +6,7 @@ --ifm-list-item-margin: 0; display: flex; + flex-wrap: wrap; gap: 1.5rem; padding-left: 0; } From c82377af9c6c333d35db59231072e0bb4a758190 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 21 Feb 2024 10:02:19 -0500 Subject: [PATCH 05/35] chore(deps): update dependency webpack to v5.90.2 (#8501) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 08c0f0fec0e2..55386caeded4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -19223,8 +19223,8 @@ __metadata: linkType: hard "webpack@npm:^5.73.0, webpack@npm:^5.88.1": - version: 5.90.1 - resolution: "webpack@npm:5.90.1" + version: 5.90.2 + resolution: "webpack@npm:5.90.2" dependencies: "@types/eslint-scope": ^3.7.3 "@types/estree": ^1.0.5 @@ -19255,7 +19255,7 @@ __metadata: optional: true bin: webpack: bin/webpack.js - checksum: a7be844d5720a0c6282fec012e6fa34b1137dff953c5d48bf2ef066a6c27c1dbc92a9b9effc05ee61c9fe269499266db9782073f2d82a589d3c5c966ffc56584 + checksum: 4af55f314c3610e0b17afd01960c4cf9d8d90c87a58ef7d7dc7a0a019f48e2bba4eff63b02d9da56fc61df5b04af0d66b3fa4ec82937a780d37a64db84c643fe languageName: node linkType: hard From 361440aeaaaf0db04945ab35b342afd6ae3df2f5 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 21 Feb 2024 10:02:39 -0500 Subject: [PATCH 06/35] chore(deps): update dependency @types/node to v20.11.19 (#8500) chore(deps): update dependency @types/node to v20.11.18 Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 55386caeded4..ca20e3a79124 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5157,11 +5157,11 @@ __metadata: linkType: hard "@types/node@npm:^20.0.0": - version: 20.11.17 - resolution: "@types/node@npm:20.11.17" + version: 20.11.19 + resolution: "@types/node@npm:20.11.19" dependencies: undici-types: ~5.26.4 - checksum: 59c0dde187120adc97da30063c86511664b24b50fe777abfe1f557c217d0a0b84a68aaab5ef8ac44f5c2986b3f9cd605a15fa6e4f31195e594da96bbe9617c20 + checksum: 259d16643ba611ade617a8212e594a3ac014727457507389bbf7213971346ab052d870f1e6e2df0afd0876ecd7874f578bccb130be01e069263cfc7136ddc0c1 languageName: node linkType: hard From b615fc295c05599085979e2064c6907645715e21 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 21 Feb 2024 10:02:51 -0500 Subject: [PATCH 07/35] chore(deps): update dependency eslint-plugin-jest to v27.9.0 (#8495) chore(deps): update dependency eslint-plugin-jest to v27.8.0 Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- yarn.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/yarn.lock b/yarn.lock index ca20e3a79124..0bbfcaf86f5d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9540,12 +9540,12 @@ __metadata: linkType: hard "eslint-plugin-jest@npm:^27.6.3": - version: 27.6.3 - resolution: "eslint-plugin-jest@npm:27.6.3" + version: 27.9.0 + resolution: "eslint-plugin-jest@npm:27.9.0" dependencies: "@typescript-eslint/utils": ^5.10.0 peerDependencies: - "@typescript-eslint/eslint-plugin": ^5.0.0 || ^6.0.0 + "@typescript-eslint/eslint-plugin": ^5.0.0 || ^6.0.0 || ^7.0.0 eslint: ^7.0.0 || ^8.0.0 jest: "*" peerDependenciesMeta: @@ -9553,7 +9553,7 @@ __metadata: optional: true jest: optional: true - checksum: e22e8dbd941b34bb95958f035ffabb94114506b294e74d6e411bc85bc9dc57888ffd3ebb5c28316a8b7cc9d391cca35557acc64bf815f48d1dcc5ea3d28fa43a + checksum: e2a4b415105408de28ad146818fcc6f4e122f6a39c6b2216ec5c24a80393f1390298b20231b0467bc5fd730f6e24b05b89e1a6a3ce651fc159aa4174ecc233d0 languageName: node linkType: hard From 3e1b73c64941edd8fdc01b872bdfb4e547c116d3 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 21 Feb 2024 17:17:51 -0500 Subject: [PATCH 08/35] chore(deps): update dependency @types/react to v18.2.56 (#8528) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 0bbfcaf86f5d..6afbd6ed7411 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5249,13 +5249,13 @@ __metadata: linkType: hard "@types/react@npm:^18.2.14": - version: 18.2.55 - resolution: "@types/react@npm:18.2.55" + version: 18.2.57 + resolution: "@types/react@npm:18.2.57" dependencies: "@types/prop-types": "*" "@types/scheduler": "*" csstype: ^3.0.2 - checksum: a8eb4fa77f73831b9112d4f11a7006217dc0740361649b9b0da3fd441d151a9cd415d5d68b91c0af4e430e063424d301c77489e5edaddc9f711c4e46cf9818a5 + checksum: 01e7a3424162468428f3b28acec5e5c6cd1e26775ff605d0f46c883dea2d835924873d36b9ea0b75e40c9593aa78ca56a8ccde66bd58dbf6ecb0dd95af28609d languageName: node linkType: hard From dafefd0c45a0d91465ad98e6529b7f848265a658 Mon Sep 17 00:00:00 2001 From: Tarun Chauhan Date: Thu, 22 Feb 2024 04:58:55 +0530 Subject: [PATCH 09/35] chore: enable `import/consistent-type-specifier-style` internally (#8527) --- eslint.config.mjs | 3 ++- packages/eslint-plugin/src/rules/ban-ts-comment.ts | 3 ++- packages/eslint-plugin/src/rules/max-params.ts | 3 ++- packages/scope-manager/src/referencer/TypeVisitor.ts | 3 ++- packages/type-utils/tests/isTypeReadonly.test.ts | 6 ++---- .../typescript-estree/src/useProgramFromProjectService.ts | 2 +- packages/website/src/components/Playground.tsx | 8 ++------ packages/website/src/components/RulesTable/index.tsx | 6 ++---- .../website/src/components/editor/useSandboxServices.ts | 3 ++- packages/website/src/theme/CodeBlock/Content/String.tsx | 3 ++- 10 files changed, 19 insertions(+), 21 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 4e049e6e2578..8aab7daa4a56 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -237,7 +237,8 @@ export default tseslint.config( // // eslint-plugin-import // - + // enforces consistent type specifier style for named imports + 'import/consistent-type-specifier-style': 'error', // disallow non-import statements appearing before import statements 'import/first': 'error', // Require a newline after the last import/require in a group diff --git a/packages/eslint-plugin/src/rules/ban-ts-comment.ts b/packages/eslint-plugin/src/rules/ban-ts-comment.ts index b0f964f58d1b..40e6acbbd6d7 100644 --- a/packages/eslint-plugin/src/rules/ban-ts-comment.ts +++ b/packages/eslint-plugin/src/rules/ban-ts-comment.ts @@ -1,4 +1,5 @@ -import { AST_TOKEN_TYPES, type TSESLint } from '@typescript-eslint/utils'; +import type { TSESLint } from '@typescript-eslint/utils'; +import { AST_TOKEN_TYPES } from '@typescript-eslint/utils'; import { createRule, getStringLength } from '../util'; diff --git a/packages/eslint-plugin/src/rules/max-params.ts b/packages/eslint-plugin/src/rules/max-params.ts index 29a18358946f..622848affce1 100644 --- a/packages/eslint-plugin/src/rules/max-params.ts +++ b/packages/eslint-plugin/src/rules/max-params.ts @@ -1,4 +1,5 @@ -import { AST_NODE_TYPES, type TSESTree } from '@typescript-eslint/utils'; +import type { TSESTree } from '@typescript-eslint/utils'; +import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import type { InferMessageIdsTypeFromRule, diff --git a/packages/scope-manager/src/referencer/TypeVisitor.ts b/packages/scope-manager/src/referencer/TypeVisitor.ts index 786b1059b5a1..778b2d673336 100644 --- a/packages/scope-manager/src/referencer/TypeVisitor.ts +++ b/packages/scope-manager/src/referencer/TypeVisitor.ts @@ -2,7 +2,8 @@ import type { TSESTree } from '@typescript-eslint/types'; import { AST_NODE_TYPES } from '@typescript-eslint/types'; import { ParameterDefinition, TypeDefinition } from '../definition'; -import { type Scope, ScopeType } from '../scope'; +import type { Scope } from '../scope'; +import { ScopeType } from '../scope'; import type { Referencer } from './Referencer'; import { Visitor } from './Visitor'; diff --git a/packages/type-utils/tests/isTypeReadonly.test.ts b/packages/type-utils/tests/isTypeReadonly.test.ts index 2adfaaec7aa8..c171417e5d32 100644 --- a/packages/type-utils/tests/isTypeReadonly.test.ts +++ b/packages/type-utils/tests/isTypeReadonly.test.ts @@ -3,10 +3,8 @@ import type { TSESTree } from '@typescript-eslint/utils'; import path from 'path'; import type * as ts from 'typescript'; -import { - isTypeReadonly, - type ReadonlynessOptions, -} from '../src/isTypeReadonly'; +import type { ReadonlynessOptions } from '../src/isTypeReadonly'; +import { isTypeReadonly } from '../src/isTypeReadonly'; import { expectToHaveParserServices } from './test-utils/expectToHaveParserServices'; describe('isTypeReadonly', () => { diff --git a/packages/typescript-estree/src/useProgramFromProjectService.ts b/packages/typescript-estree/src/useProgramFromProjectService.ts index d49acd55e095..6b3b9f373356 100644 --- a/packages/typescript-estree/src/useProgramFromProjectService.ts +++ b/packages/typescript-estree/src/useProgramFromProjectService.ts @@ -2,8 +2,8 @@ import { minimatch } from 'minimatch'; import { createProjectProgram } from './create-program/createProjectProgram'; import type { ProjectServiceSettings } from './create-program/createProjectService'; +import type { ASTAndDefiniteProgram } from './create-program/shared'; import { - type ASTAndDefiniteProgram, ensureAbsolutePath, getCanonicalFileName, } from './create-program/shared'; diff --git a/packages/website/src/components/Playground.tsx b/packages/website/src/components/Playground.tsx index 78e857104d39..d4eaf3f7eafb 100644 --- a/packages/website/src/components/Playground.tsx +++ b/packages/website/src/components/Playground.tsx @@ -3,12 +3,8 @@ import { useWindowSize } from '@docusaurus/theme-common'; import clsx from 'clsx'; import React, { useCallback, useEffect, useRef, useState } from 'react'; -import { - type ImperativePanelHandle, - Panel, - PanelGroup, - PanelResizeHandle, -} from 'react-resizable-panels'; +import type { ImperativePanelHandle } from 'react-resizable-panels'; +import { Panel, PanelGroup, PanelResizeHandle } from 'react-resizable-panels'; import ASTViewer from './ast/ASTViewer'; import ConfigEslint from './config/ConfigEslint'; diff --git a/packages/website/src/components/RulesTable/index.tsx b/packages/website/src/components/RulesTable/index.tsx index ea0dd98cf5cc..9a1235079303 100644 --- a/packages/website/src/components/RulesTable/index.tsx +++ b/packages/website/src/components/RulesTable/index.tsx @@ -5,10 +5,8 @@ import { useRulesMeta } from '@site/src/hooks/useRulesMeta'; import clsx from 'clsx'; import React, { useMemo } from 'react'; -import { - type HistorySelector, - useHistorySelector, -} from '../../hooks/useHistorySelector'; +import type { HistorySelector } from '../../hooks/useHistorySelector'; +import { useHistorySelector } from '../../hooks/useHistorySelector'; import { CONFIG_EMOJI, DEPRECATED_RULE_EMOJI, diff --git a/packages/website/src/components/editor/useSandboxServices.ts b/packages/website/src/components/editor/useSandboxServices.ts index 2e231c60491e..f3fae7903878 100644 --- a/packages/website/src/components/editor/useSandboxServices.ts +++ b/packages/website/src/components/editor/useSandboxServices.ts @@ -7,7 +7,8 @@ import rootPackageJson from '../../../../../package.json'; import type { createTypeScriptSandbox } from '../../vendor/sandbox'; import { createCompilerOptions } from '../lib/createCompilerOptions'; import { createFileSystem } from '../linter/bridge'; -import { type CreateLinter, createLinter } from '../linter/createLinter'; +import type { CreateLinter } from '../linter/createLinter'; +import { createLinter } from '../linter/createLinter'; import type { PlaygroundSystem } from '../linter/types'; import type { RuleDetails } from '../types'; import { createTwoslashInlayProvider } from './createProvideTwoslashInlay'; diff --git a/packages/website/src/theme/CodeBlock/Content/String.tsx b/packages/website/src/theme/CodeBlock/Content/String.tsx index 6895cab853e2..d09ec102f080 100644 --- a/packages/website/src/theme/CodeBlock/Content/String.tsx +++ b/packages/website/src/theme/CodeBlock/Content/String.tsx @@ -15,7 +15,8 @@ import Line from '@theme/CodeBlock/Line'; import WordWrapButton from '@theme/CodeBlock/WordWrapButton'; import clsx from 'clsx'; import * as lz from 'lz-string'; -import Highlight, { defaultProps, type Language } from 'prism-react-renderer'; +import type { Language } from 'prism-react-renderer'; +import Highlight, { defaultProps } from 'prism-react-renderer'; import React from 'react'; import { TryInPlayground } from '../../MDXComponents/TryInPlayground'; From 6c1ae93ffcb734cc5e90810e22218f927c3d7575 Mon Sep 17 00:00:00 2001 From: John Reilly Date: Wed, 21 Feb 2024 23:32:52 +0000 Subject: [PATCH 10/35] docs: no-unused-vars demonstrate TypeScript style exemptions (#8526) --- .../docs/rules/no-unused-vars.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/packages/eslint-plugin/docs/rules/no-unused-vars.md b/packages/eslint-plugin/docs/rules/no-unused-vars.md index eef57d3830dd..aaccc6e03398 100644 --- a/packages/eslint-plugin/docs/rules/no-unused-vars.md +++ b/packages/eslint-plugin/docs/rules/no-unused-vars.md @@ -17,6 +17,25 @@ However: - These lint rules are more configurable than TypeScript's compiler options. - For example, the [`varsIgnorePattern` option](https://eslint.org/docs/latest/rules/no-unused-vars#varsignorepattern) can customize what names are always allowed to be exempted. TypeScript hardcodes its exemptions to names starting with `_`. + If you would like to emulate the TypeScript style of exempting names starting with `_`, you can use this configuration (this includes errors as well): + ```json + { + "rules": { + "@typescript-eslint/no-unused-vars": [ + "error", + { + "args": "all", + "argsIgnorePattern": "^_", + "caughtErrors": "all", + "caughtErrorsIgnorePattern": "^_", + "destructuredArrayIgnorePattern": "^_", + "varsIgnorePattern": "^_", + "ignoreRestSiblings": true + } + ] + } + } + ``` - [ESLint can be configured](https://eslint.org/docs/latest/use/configure/rules) within lines, files, and folders. TypeScript compiler options are linked to their TSConfig file. - Many projects configure TypeScript's reported errors to block builds more aggressively than ESLint complaints. Blocking builds on unused variables can be inconvenient. From f5adf19ab8fb9f61e4670579b776bac81b3069f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josh=20Goldberg=20=E2=9C=A8?= Date: Wed, 21 Feb 2024 18:57:10 -0500 Subject: [PATCH 11/35] chore: extract eslint-plugin-tslint to new repository (#8366) * chore: extract eslint-plugin-tslint to new repository * Remove integration test too * Re-ran yarn --- .eslintrc.js | 454 +++++ .../ISSUE_TEMPLATE/06-bug-report-other.yaml | 1 - .../ISSUE_TEMPLATE/07-enhancement-other.yaml | 1 - .github/workflows/ci.yml | 8 +- .github/workflows/semantic-pr-titles.yml | 1 - .vscode/launch.json | 67 - docs/packages/ESLint_Plugin_TSLint.mdx | 39 +- docs/users/Versioning.mdx | 2 +- package.json | 1 - packages/eslint-plugin-tslint/CHANGELOG.md | 1557 ----------------- packages/eslint-plugin-tslint/LICENSE | 21 - packages/eslint-plugin-tslint/README.md | 12 - packages/eslint-plugin-tslint/jest.config.js | 7 - packages/eslint-plugin-tslint/package.json | 67 - packages/eslint-plugin-tslint/project.json | 12 - .../eslint-plugin-tslint/src/custom-linter.ts | 21 - packages/eslint-plugin-tslint/src/index.ts | 22 - .../eslint-plugin-tslint/src/rules/config.ts | 194 -- .../tests/fixtures/fixture-project/1.ts | 1 - .../tests/fixtures/fixture-project/2.ts | 1 - .../tests/fixtures/fixture-project/3.ts | 1 - .../tests/fixtures/fixture-project/4.ts | 1 - .../tests/fixtures/fixture-project/5.ts | 1 - .../tests/fixtures/fixture-project/6.ts | 1 - .../fixtures/fixture-project/tsconfig.json | 1 - .../tests/fixtures/test-project/extra.ts | 1 - .../tests/fixtures/test-project/file-spec.ts | 2 - .../tests/fixtures/test-project/file.ts | 3 - .../tests/fixtures/test-project/source.ts | 2 - .../fixtures/test-project/tsconfig-files.json | 4 - .../tests/fixtures/test-project/tsconfig.json | 9 - .../tests/fixtures/test-project/tslint.json | 8 - .../alwaysFailRule.js | 19 - .../eslint-plugin-tslint/tests/index.spec.ts | 238 --- .../eslint-plugin-tslint/tsconfig.build.json | 14 - packages/eslint-plugin-tslint/tsconfig.json | 10 - .../.eslintrc.js | 28 - .../index.ts | 2 - .../package.json | 5 - .../tsconfig.json | 5 - .../tools/integration-test-base.ts | 4 - yarn.lock | 82 +- 42 files changed, 463 insertions(+), 2467 deletions(-) create mode 100644 .eslintrc.js delete mode 100644 packages/eslint-plugin-tslint/CHANGELOG.md delete mode 100644 packages/eslint-plugin-tslint/LICENSE delete mode 100644 packages/eslint-plugin-tslint/README.md delete mode 100644 packages/eslint-plugin-tslint/jest.config.js delete mode 100644 packages/eslint-plugin-tslint/package.json delete mode 100644 packages/eslint-plugin-tslint/project.json delete mode 100644 packages/eslint-plugin-tslint/src/custom-linter.ts delete mode 100644 packages/eslint-plugin-tslint/src/index.ts delete mode 100644 packages/eslint-plugin-tslint/src/rules/config.ts delete mode 100644 packages/eslint-plugin-tslint/tests/fixtures/fixture-project/1.ts delete mode 100644 packages/eslint-plugin-tslint/tests/fixtures/fixture-project/2.ts delete mode 100644 packages/eslint-plugin-tslint/tests/fixtures/fixture-project/3.ts delete mode 100644 packages/eslint-plugin-tslint/tests/fixtures/fixture-project/4.ts delete mode 100644 packages/eslint-plugin-tslint/tests/fixtures/fixture-project/5.ts delete mode 100644 packages/eslint-plugin-tslint/tests/fixtures/fixture-project/6.ts delete mode 100644 packages/eslint-plugin-tslint/tests/fixtures/fixture-project/tsconfig.json delete mode 100644 packages/eslint-plugin-tslint/tests/fixtures/test-project/extra.ts delete mode 100644 packages/eslint-plugin-tslint/tests/fixtures/test-project/file-spec.ts delete mode 100644 packages/eslint-plugin-tslint/tests/fixtures/test-project/file.ts delete mode 100644 packages/eslint-plugin-tslint/tests/fixtures/test-project/source.ts delete mode 100644 packages/eslint-plugin-tslint/tests/fixtures/test-project/tsconfig-files.json delete mode 100644 packages/eslint-plugin-tslint/tests/fixtures/test-project/tsconfig.json delete mode 100644 packages/eslint-plugin-tslint/tests/fixtures/test-project/tslint.json delete mode 100644 packages/eslint-plugin-tslint/tests/fixtures/test-tslint-rules-directory/alwaysFailRule.js delete mode 100644 packages/eslint-plugin-tslint/tests/index.spec.ts delete mode 100644 packages/eslint-plugin-tslint/tsconfig.build.json delete mode 100644 packages/eslint-plugin-tslint/tsconfig.json delete mode 100644 packages/integration-tests/fixtures/typescript-and-tslint-plugins-together/.eslintrc.js delete mode 100644 packages/integration-tests/fixtures/typescript-and-tslint-plugins-together/index.ts delete mode 100644 packages/integration-tests/fixtures/typescript-and-tslint-plugins-together/package.json delete mode 100644 packages/integration-tests/fixtures/typescript-and-tslint-plugins-together/tsconfig.json diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 000000000000..6cb7aee6824a --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,454 @@ +// @ts-check +/** @type {import('./packages/utils/src/ts-eslint/Linter').Linter.Config} */ +module.exports = { + root: true, + plugins: [ + '@typescript-eslint', + '@typescript-eslint/internal', + 'deprecation', + 'eslint-comments', + 'eslint-plugin', + 'import', + 'jest', + 'jsdoc', + 'simple-import-sort', + 'unicorn', + ], + env: { + es2020: true, + node: true, + }, + extends: [ + 'eslint:recommended', + 'plugin:eslint-plugin/recommended', + 'plugin:jsdoc/recommended-typescript-error', + 'plugin:@typescript-eslint/strict-type-checked', + 'plugin:@typescript-eslint/stylistic-type-checked', + ], + parserOptions: { + allowAutomaticSingleRunInference: true, + cacheLifetime: { + // we pretty well never create/change tsconfig structure - so no need to ever evict the cache + // in the rare case that we do - just need to manually restart their IDE. + glob: 'Infinity', + }, + project: [ + './tsconfig.eslint.json', + './packages/*/tsconfig.json', + /** + * We are currently in the process of transitioning to nx's out of the box structure and + * so need to manually specify converted packages' tsconfig.build.json and tsconfig.spec.json + * files here for now in addition to the tsconfig.json glob pattern. + * + * TODO(#4665): Clean this up once all packages have been transitioned. + */ + './packages/scope-manager/tsconfig.build.json', + './packages/scope-manager/tsconfig.spec.json', + ], + tsconfigRootDir: __dirname, + }, + rules: { + // make sure we're not leveraging any deprecated APIs + 'deprecation/deprecation': 'error', + + // TODO(#7130): Investigate changing these in or removing these from presets + '@typescript-eslint/no-confusing-void-expression': 'off', + '@typescript-eslint/prefer-string-starts-ends-with': 'off', + + // + // our plugin :D + // + + '@typescript-eslint/ban-ts-comment': [ + 'error', + { + 'ts-expect-error': 'allow-with-description', + 'ts-ignore': true, + 'ts-nocheck': true, + 'ts-check': false, + minimumDescriptionLength: 5, + }, + ], + '@typescript-eslint/consistent-type-imports': [ + 'error', + { prefer: 'type-imports', disallowTypeAnnotations: true }, + ], + '@typescript-eslint/explicit-function-return-type': [ + 'error', + { allowIIFEs: true }, + ], + '@typescript-eslint/no-explicit-any': 'error', + '@typescript-eslint/no-non-null-assertion': 'off', + 'no-constant-condition': 'off', + '@typescript-eslint/no-unnecessary-condition': [ + 'error', + { allowConstantLoopConditions: true }, + ], + '@typescript-eslint/no-var-requires': 'off', + '@typescript-eslint/prefer-literal-enum-member': [ + 'error', + { + allowBitwiseExpressions: true, + }, + ], + '@typescript-eslint/unbound-method': 'off', + '@typescript-eslint/restrict-template-expressions': [ + 'error', + { + allowNumber: true, + allowBoolean: true, + allowAny: true, + allowNullish: true, + allowRegExp: true, + }, + ], + '@typescript-eslint/no-unused-vars': [ + 'error', + { varsIgnorePattern: '^_', argsIgnorePattern: '^_' }, + ], + '@typescript-eslint/prefer-nullish-coalescing': [ + 'error', + { + ignoreConditionalTests: true, + ignorePrimitives: true, + }, + ], + + // + // Internal repo rules + // + + '@typescript-eslint/internal/no-poorly-typed-ts-props': 'error', + '@typescript-eslint/internal/no-typescript-default-import': 'error', + '@typescript-eslint/internal/prefer-ast-types-enum': 'error', + + // + // eslint-base + // + + curly: ['error', 'all'], + eqeqeq: [ + 'error', + 'always', + { + null: 'never', + }, + ], + 'logical-assignment-operators': 'error', + 'no-else-return': 'error', + 'no-mixed-operators': 'error', + 'no-console': 'error', + 'no-process-exit': 'error', + 'no-fallthrough': [ + 'error', + { commentPattern: '.*intentional fallthrough.*' }, + ], + 'one-var': ['error', 'never'], + + // + // eslint-plugin-eslint-comment + // + + // require a eslint-enable comment for every eslint-disable comment + 'eslint-comments/disable-enable-pair': [ + 'error', + { + allowWholeFile: true, + }, + ], + // disallow a eslint-enable comment for multiple eslint-disable comments + 'eslint-comments/no-aggregating-enable': 'error', + // disallow duplicate eslint-disable comments + 'eslint-comments/no-duplicate-disable': 'error', + // disallow eslint-disable comments without rule names + 'eslint-comments/no-unlimited-disable': 'error', + // disallow unused eslint-disable comments + 'eslint-comments/no-unused-disable': 'error', + // disallow unused eslint-enable comments + 'eslint-comments/no-unused-enable': 'error', + // disallow ESLint directive-comments + 'eslint-comments/no-use': [ + 'error', + { + allow: [ + 'eslint-disable', + 'eslint-disable-line', + 'eslint-disable-next-line', + 'eslint-enable', + 'global', + ], + }, + ], + + // + // eslint-plugin-import + // + + // disallow non-import statements appearing before import statements + 'import/first': 'error', + // Require a newline after the last import/require in a group + 'import/newline-after-import': 'error', + // Forbid import of modules using absolute paths + 'import/no-absolute-path': 'error', + // disallow AMD require/define + 'import/no-amd': 'error', + // forbid default exports - we want to standardize on named exports so that imported names are consistent + 'import/no-default-export': 'error', + // disallow imports from duplicate paths + 'import/no-duplicates': 'error', + // Forbid the use of extraneous packages + 'import/no-extraneous-dependencies': [ + 'error', + { + devDependencies: true, + peerDependencies: true, + optionalDependencies: false, + }, + ], + // Forbid mutable exports + 'import/no-mutable-exports': 'error', + // Prevent importing the default as if it were named + 'import/no-named-default': 'error', + // Prohibit named exports + 'import/no-named-export': 'off', // we want everything to be a named export + // Forbid a module from importing itself + 'import/no-self-import': 'error', + // Require modules with a single export to use a default export + 'import/prefer-default-export': 'off', // we want everything to be named + + // enforce a sort order across the codebase + 'simple-import-sort/imports': 'error', + + // + // eslint-plugin-jsdoc + // + + // We often use @remarks or other ad-hoc tag names + 'jsdoc/check-tag-names': 'off', + // https://github.com/gajus/eslint-plugin-jsdoc/issues/1169 + 'jsdoc/check-param-names': 'off', + // https://github.com/gajus/eslint-plugin-jsdoc/issues/1175 + 'jsdoc/require-jsdoc': 'off', + 'jsdoc/require-param': 'off', + 'jsdoc/require-returns': 'off', + 'jsdoc/require-yields': 'off', + 'jsdoc/tag-lines': 'off', + + // + // eslint-plugin-unicorn + // + + 'unicorn/no-typeof-undefined': 'error', + }, + overrides: [ + { + files: ['*.js'], + extends: ['plugin:@typescript-eslint/disable-type-checked'], + rules: { + // turn off other type-aware rules + 'deprecation/deprecation': 'off', + '@typescript-eslint/internal/no-poorly-typed-ts-props': 'off', + + // turn off rules that don't apply to JS code + '@typescript-eslint/explicit-function-return-type': 'off', + }, + }, + // all test files + { + files: [ + './packages/*/tests/**/*.spec.ts', + './packages/*/tests/**/*.test.ts', + './packages/*/tests/**/spec.ts', + './packages/*/tests/**/test.ts', + './packages/parser/tests/**/*.ts', + './packages/integration-tests/tools/integration-test-base.ts', + './packages/integration-tests/tools/pack-packages.ts', + ], + env: { + 'jest/globals': true, + }, + rules: { + '@typescript-eslint/no-empty-function': [ + 'error', + { allow: ['arrowFunctions'] }, + ], + '@typescript-eslint/no-unsafe-assignment': 'off', + '@typescript-eslint/no-unsafe-call': 'off', + '@typescript-eslint/no-unsafe-member-access': 'off', + '@typescript-eslint/no-unsafe-return': 'off', + 'eslint-plugin/consistent-output': 'off', // Might eventually be removed from `eslint-plugin/recommended`: https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/issues/284 + 'jest/no-disabled-tests': 'error', + 'jest/no-focused-tests': 'error', + 'jest/no-alias-methods': 'error', + 'jest/no-identical-title': 'error', + 'jest/no-jasmine-globals': 'error', + 'jest/no-test-prefixes': 'error', + 'jest/no-done-callback': 'error', + 'jest/no-test-return-statement': 'error', + 'jest/prefer-to-be': 'error', + 'jest/prefer-to-contain': 'error', + 'jest/prefer-to-have-length': 'error', + 'jest/prefer-spy-on': 'error', + 'jest/valid-expect': 'error', + 'jest/no-deprecated-functions': 'error', + }, + }, + // test utility scripts and website js files + { + files: ['tests/**/*.js'], + rules: { + '@typescript-eslint/explicit-function-return-type': 'off', + '@typescript-eslint/no-unsafe-call': 'off', + '@typescript-eslint/no-unsafe-member-access': 'off', + '@typescript-eslint/no-unsafe-return': 'off', + '@typescript-eslint/restrict-plus-operands': 'off', + }, + }, + // plugin source files + { + files: [ + './packages/eslint-plugin-internal/**/*.ts', + './packages/eslint-plugin/**/*.ts', + ], + rules: { + '@typescript-eslint/internal/no-typescript-estree-import': 'error', + }, + }, + // plugin rule source files + { + files: [ + './packages/eslint-plugin-internal/src/rules/**/*.ts', + './packages/eslint-plugin/src/configs/**/*.ts', + './packages/eslint-plugin/src/rules/**/*.ts', + ], + rules: { + 'eslint-plugin/require-meta-docs-description': [ + 'error', + { pattern: '^(Enforce|Require|Disallow) .+[^. ]$' }, + ], + + // specifically for rules - default exports makes the tooling easier + 'import/no-default-export': 'off', + + 'no-restricted-syntax': [ + 'error', + { + selector: + 'ExportDefaultDeclaration Property[key.name="create"] MemberExpression[object.name="context"][property.name="options"]', + message: + "Retrieve options from create's second parameter so that defaultOptions are applied.", + }, + ], + }, + }, + // plugin rule tests + { + files: [ + './packages/eslint-plugin-internal/tests/rules/**/*.test.ts', + './packages/eslint-plugin/tests/rules/**/*.test.ts', + './packages/eslint-plugin/tests/eslint-rules/**/*.test.ts', + ], + rules: { + '@typescript-eslint/internal/plugin-test-formatting': 'error', + }, + }, + // files which list all the things + { + files: ['./packages/eslint-plugin/src/rules/index.ts'], + rules: { + // enforce alphabetical ordering + 'sort-keys': 'error', + 'import/order': ['error', { alphabetize: { order: 'asc' } }], + }, + }, + // tools and tests + { + files: [ + '**/tools/**/*.*t*', + '**/tests/**/*.ts', + './packages/repo-tools/**/*.*t*', + './packages/integration-tests/**/*.*t*', + ], + rules: { + // allow console logs in tools and tests + 'no-console': 'off', + }, + }, + // generated files + { + files: [ + './packages/scope-manager/src/lib/*.ts', + './packages/eslint-plugin/src/configs/*.ts', + ], + rules: { + '@typescript-eslint/internal/no-poorly-typed-ts-props': 'off', + '@typescript-eslint/internal/no-typescript-default-import': 'off', + '@typescript-eslint/internal/prefer-ast-types-enum': 'off', + }, + }, + // ast spec specific standardization + { + files: ['./packages/ast-spec/src/**/*.ts'], + rules: { + // disallow ALL unused vars + '@typescript-eslint/no-unused-vars': 'error', + '@typescript-eslint/sort-type-constituents': 'error', + }, + }, + { + files: ['./packages/ast-spec/**/*.ts'], + rules: { + 'no-restricted-imports': [ + 'error', + { + name: '@typescript-eslint/typescript-estree', + message: + 'To prevent nx build errors, all `typescript-estree` imports should be done via `packages/ast-spec/tests/util/parsers/typescript-estree-import.ts`.', + }, + ], + }, + }, + { + files: ['rollup.config.ts'], + rules: { + 'import/no-default-export': 'off', + }, + }, + { + files: ['./packages/website/**/*.{ts,tsx,mts,cts,js,jsx}'], + extends: [ + 'plugin:jsx-a11y/recommended', + 'plugin:react/recommended', + 'plugin:react-hooks/recommended', + ], + plugins: ['jsx-a11y', 'react', 'react-hooks'], + rules: { + '@typescript-eslint/internal/prefer-ast-types-enum': 'off', + 'import/no-default-export': 'off', + 'react/jsx-no-target-blank': 'off', + 'react/no-unescaped-entities': 'off', + 'react-hooks/exhaustive-deps': 'warn', // TODO: enable it later + }, + settings: { + react: { + version: 'detect', + }, + }, + }, + { + files: ['./packages/website/src/**/*.{ts,tsx}'], + rules: { + 'import/no-default-export': 'off', + // allow console logs in the website to help with debugging things in production + 'no-console': 'off', + }, + }, + { + files: ['./packages/website-eslint/src/mock/**/*.js', '*.d.ts'], + rules: { + // mocks and declaration files have to mirror their original package + 'import/no-default-export': 'off', + }, + }, + ], +}; diff --git a/.github/ISSUE_TEMPLATE/06-bug-report-other.yaml b/.github/ISSUE_TEMPLATE/06-bug-report-other.yaml index c3ab6ee8df3b..7d9fc140f091 100644 --- a/.github/ISSUE_TEMPLATE/06-bug-report-other.yaml +++ b/.github/ISSUE_TEMPLATE/06-bug-report-other.yaml @@ -34,7 +34,6 @@ body: description: Select the package against which you want to report the bug. options: - ast-spec - - eslint-plugin-tslint - parser - rule-tester - scope-manager diff --git a/.github/ISSUE_TEMPLATE/07-enhancement-other.yaml b/.github/ISSUE_TEMPLATE/07-enhancement-other.yaml index b3ae91962b1c..ddb1ef6e328d 100644 --- a/.github/ISSUE_TEMPLATE/07-enhancement-other.yaml +++ b/.github/ISSUE_TEMPLATE/07-enhancement-other.yaml @@ -24,7 +24,6 @@ body: description: Select the package against which you want to report the bug. options: - ast-spec - - eslint-plugin-tslint - parser - scope-manager - type-utils diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ba2829c7f2c9..4d4a1ee08b2e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -167,7 +167,6 @@ jobs: 'ast-spec', 'eslint-plugin', 'eslint-plugin-internal', - 'eslint-plugin-tslint', 'parser', 'repo-tools', 'rule-schema-to-typescript-types', @@ -226,12 +225,7 @@ jobs: strategy: matrix: package: - [ - 'eslint-plugin', - 'eslint-plugin-internal', - 'eslint-plugin-tslint', - 'typescript-estree', - ] + ['eslint-plugin', 'eslint-plugin-internal', 'typescript-estree'] env: COLLECT_COVERAGE: false steps: diff --git a/.github/workflows/semantic-pr-titles.yml b/.github/workflows/semantic-pr-titles.yml index fceee3e45519..3a3c4a2c3164 100644 --- a/.github/workflows/semantic-pr-titles.yml +++ b/.github/workflows/semantic-pr-titles.yml @@ -29,7 +29,6 @@ jobs: ast-spec eslint-plugin eslint-plugin-internal - eslint-plugin-tslint parser rule-tester scope-manager diff --git a/.vscode/launch.json b/.vscode/launch.json index 82c02f90b2e5..8b6498950280 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -71,39 +71,6 @@ "${workspaceFolder}/packages/scope-manager/dist/index.js", "${workspaceFolder}/packages/scope-manager/dist/index.js", ], - },{ - "type": "node", - "request": "launch", - "name": "Jest Test Current eslint-plugin-tslint Rule", - "cwd": "${workspaceFolder}/packages/eslint-plugin-tslint/", - "program": "${workspaceFolder}/node_modules/jest/bin/jest.js", - "args": [ - "--runInBand", - "--no-cache", - "--no-coverage", - "${fileBasenameNoExtension}" - ], - "sourceMaps": true, - "console": "integratedTerminal", - "internalConsoleOptions": "neverOpen", - "skipFiles": [ - "${workspaceFolder}/packages/utils/src/index.ts", - "${workspaceFolder}/packages/utils/dist/index.js", - "${workspaceFolder}/packages/utils/src/ts-estree.ts", - "${workspaceFolder}/packages/utils/dist/ts-estree.js", - "${workspaceFolder}/packages/type-utils/src/index.ts", - "${workspaceFolder}/packages/type-utils/dist/index.js", - "${workspaceFolder}/packages/parser/src/index.ts", - "${workspaceFolder}/packages/parser/dist/index.js", - "${workspaceFolder}/packages/typescript-estree/src/index.ts", - "${workspaceFolder}/packages/typescript-estree/dist/index.js", - "${workspaceFolder}/packages/types/src/index.ts", - "${workspaceFolder}/packages/types/dist/index.js", - "${workspaceFolder}/packages/visitor-keys/src/index.ts", - "${workspaceFolder}/packages/visitor-keys/dist/index.js", - "${workspaceFolder}/packages/scope-manager/dist/index.js", - "${workspaceFolder}/packages/scope-manager/dist/index.js", - ], }, { "type": "node", @@ -141,40 +108,6 @@ "${workspaceFolder}/packages/scope-manager/dist/index.js", ], }, - { - "type": "node", - "request": "launch", - "name": "Jest Test Current eslint-plugin-tslint Rule", - "cwd": "${workspaceFolder}/packages/eslint-plugin-tslint/", - "program": "${workspaceFolder}/node_modules/jest/bin/jest.js", - "args": [ - "--runInBand", - "--no-cache", - "--no-coverage", - "${fileBasenameNoExtension}" - ], - "sourceMaps": true, - "console": "integratedTerminal", - "internalConsoleOptions": "neverOpen", - "skipFiles": [ - "${workspaceFolder}/packages/utils/src/index.ts", - "${workspaceFolder}/packages/utils/dist/index.js", - "${workspaceFolder}/packages/utils/src/ts-estree.ts", - "${workspaceFolder}/packages/utils/dist/ts-estree.js", - "${workspaceFolder}/packages/type-utils/src/index.ts", - "${workspaceFolder}/packages/type-utils/dist/index.js", - "${workspaceFolder}/packages/parser/src/index.ts", - "${workspaceFolder}/packages/parser/dist/index.js", - "${workspaceFolder}/packages/typescript-estree/src/index.ts", - "${workspaceFolder}/packages/typescript-estree/dist/index.js", - "${workspaceFolder}/packages/types/src/index.ts", - "${workspaceFolder}/packages/types/dist/index.js", - "${workspaceFolder}/packages/visitor-keys/src/index.ts", - "${workspaceFolder}/packages/visitor-keys/dist/index.js", - "${workspaceFolder}/packages/scope-manager/dist/index.js", - "${workspaceFolder}/packages/scope-manager/dist/index.js", - ], - }, { "type": "node", "request": "launch", diff --git a/docs/packages/ESLint_Plugin_TSLint.mdx b/docs/packages/ESLint_Plugin_TSLint.mdx index 6b9da9e6982f..f8f3d8dc8119 100644 --- a/docs/packages/ESLint_Plugin_TSLint.mdx +++ b/docs/packages/ESLint_Plugin_TSLint.mdx @@ -12,40 +12,5 @@ Per [What About TSLint?](../troubleshooting/TSLint.mdx), we highly recommend mig See [Getting Started](../getting-started/Quickstart.mdx) 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`. +Documentation for this package has moved to [github.com/typescript-eslint/eslint-plugin-tslint](https://github.com/typescript-eslint/eslint-plugin-tslint). +This page will eventually be removed. diff --git a/docs/users/Versioning.mdx b/docs/users/Versioning.mdx index f2170a051520..4501218587a6 100644 --- a/docs/users/Versioning.mdx +++ b/docs/users/Versioning.mdx @@ -30,7 +30,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` A change to the plugins **_shall_** be considered breaking if it will require the user to change their config. More specifically: diff --git a/package.json b/package.json index 5522da4d1e26..9846a467e112 100644 --- a/package.json +++ b/package.json @@ -117,7 +117,6 @@ "rimraf": "^5.0.1", "tmp": "^0.2.1", "ts-node": "10.7.0", - "tslint": "^6.1.3", "tsx": "^4.6.2", "typescript": ">=4.7.4 <5.4.0", "typescript-eslint": "workspace:^", diff --git a/packages/eslint-plugin-tslint/CHANGELOG.md b/packages/eslint-plugin-tslint/CHANGELOG.md deleted file mode 100644 index 02aa5478c4a9..000000000000 --- a/packages/eslint-plugin-tslint/CHANGELOG.md +++ /dev/null @@ -1,1557 +0,0 @@ -## 7.0.2 (2024-02-19) - - -### 🩹 Fixes - -- fix tsconfig-less check errors, fix `@types/eslint` incompatibilities, add tests - - -### ❤️ Thank You - -- Brad Zacher -- Gareth Jones - -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) - -This was a version bump only for eslint-plugin-tslint to align it with other projects, there were no code changes. - -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.0 (2024-02-12) - - -### 🚀 Features - -- ⚠️ bump ESLint, NodeJS, and TS minimum version requirements - -- add support for flat configs - - -#### ⚠️ Breaking Changes - -- ⚠️ bump ESLint, NodeJS, and TS minimum version requirements - -### ❤️ Thank You - -- Brad Zacher -- Kirk Waiblinger -- StyleShit -- YeonJuan - -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. - -## 6.21.0 (2024-02-05) - - -### 🚀 Features - -- export plugin metadata - -- allow `parserOptions.project: false` - - -### ❤️ Thank You - -- auvred -- Brad Zacher -- Kirk Waiblinger -- Pete Gonzalez -- YeonJuan - -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. - -## 6.20.0 (2024-01-29) - -This was a version bump only for eslint-plugin-tslint to align it with other projects, there were no code changes. - -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. - -## 6.19.1 (2024-01-22) - -This was a version bump only for eslint-plugin-tslint to align it with other projects, there were no code changes. - -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. - -## 6.19.0 (2024-01-15) - -This was a version bump only for eslint-plugin-tslint to align it with other projects, there were no code changes. - -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. - -## 6.18.1 (2024-01-08) - -This was a version bump only for eslint-plugin-tslint to align it with other projects, there were no code changes. - -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. - -## 6.18.0 (2024-01-06) - -This was a version bump only for eslint-plugin-tslint to align it with other projects, there were no code changes. - -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. - -# [6.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v6.16.0...v6.17.0) (2024-01-01) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -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. - - - - - -# [6.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v6.15.0...v6.16.0) (2023-12-25) - - -### Features - -* **typescript-estree:** add allowDefaultProjectForFiles project service allowlist option ([#7752](https://github.com/typescript-eslint/typescript-eslint/issues/7752)) ([7ddadda](https://github.com/typescript-eslint/typescript-eslint/commit/7ddadda10845bc53967eeec83ba6b7cdc71a079f)) - -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. - - - - - -# [6.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v6.14.0...v6.15.0) (2023-12-18) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -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. - - - - - -# [6.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v6.13.2...v6.14.0) (2023-12-11) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -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. - - - - - -## [6.13.2](https://github.com/typescript-eslint/typescript-eslint/compare/v6.13.1...v6.13.2) (2023-12-04) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -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. - - - - - -## [6.13.1](https://github.com/typescript-eslint/typescript-eslint/compare/v6.13.0...v6.13.1) (2023-11-28) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -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. - - - - - -# [6.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v6.12.0...v6.13.0) (2023-11-27) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -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. - - - - - -# [6.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v6.11.0...v6.12.0) (2023-11-20) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -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. - - - - - -# [6.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v6.10.0...v6.11.0) (2023-11-13) - - -### Features - -* add types for flat config files ([#7273](https://github.com/typescript-eslint/typescript-eslint/issues/7273)) ([66cd0c0](https://github.com/typescript-eslint/typescript-eslint/commit/66cd0c0535e5de1b46ba337919a9a92748d2b0a6)) - -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. - - - - - -# [6.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v6.9.1...v6.10.0) (2023-11-06) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -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. - - - - - -## [6.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v6.9.0...v6.9.1) (2023-10-30) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -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. - - - - - -# [6.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v6.8.0...v6.9.0) (2023-10-23) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -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. - - - - - -# [6.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v6.7.5...v6.8.0) (2023-10-16) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -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. - - - - - -## [6.7.5](https://github.com/typescript-eslint/typescript-eslint/compare/v6.7.4...v6.7.5) (2023-10-09) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -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. - - - - - -## [6.7.4](https://github.com/typescript-eslint/typescript-eslint/compare/v6.7.3...v6.7.4) (2023-10-02) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -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. - - - - - -## [6.7.3](https://github.com/typescript-eslint/typescript-eslint/compare/v6.7.2...v6.7.3) (2023-09-25) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -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. - - - - - -## [6.7.2](https://github.com/typescript-eslint/typescript-eslint/compare/v6.7.1...v6.7.2) (2023-09-18) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -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. - - - - - -## [6.7.1](https://github.com/typescript-eslint/typescript-eslint/compare/v6.7.0...v6.7.1) (2023-09-18) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -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. - - - - - -# [6.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v6.6.0...v6.7.0) (2023-09-11) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -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. - - - - - -# [6.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v6.5.0...v6.6.0) (2023-09-04) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -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. - - - - - -# [6.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v6.4.1...v6.5.0) (2023-08-28) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -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. - - - - - -## [6.4.1](https://github.com/typescript-eslint/typescript-eslint/compare/v6.4.0...v6.4.1) (2023-08-21) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -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. - - - - - -# [6.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v6.3.0...v6.4.0) (2023-08-14) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -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. - - - - - -# [6.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v6.2.1...v6.3.0) (2023-08-07) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -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. - - - - - -## [6.2.1](https://github.com/typescript-eslint/typescript-eslint/compare/v6.2.0...v6.2.1) (2023-07-31) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -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. - - - - - -# [6.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v6.1.0...v6.2.0) (2023-07-24) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -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. - - - - - -# [6.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v6.0.0...v6.1.0) (2023-07-17) - - -### Features - -* **typescript-estree:** add EXPERIMENTAL_useProjectService option to use TypeScript project service ([#6754](https://github.com/typescript-eslint/typescript-eslint/issues/6754)) ([6d3d162](https://github.com/typescript-eslint/typescript-eslint/commit/6d3d162ce032ebcf5f892a4edfb897797fc96191)) - -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. - - - - - -# [6.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.62.0...v6.0.0) (2023-07-10) - - -### Bug Fixes - -* update `exports` field in package.json files ([#6550](https://github.com/typescript-eslint/typescript-eslint/issues/6550)) ([53776c2](https://github.com/typescript-eslint/typescript-eslint/commit/53776c244f8bbdc852d57c7b313b0935e755ddc4)) - - -### chore - -* drop support for node v14.17, v17 ([#5971](https://github.com/typescript-eslint/typescript-eslint/issues/5971)) ([cc62015](https://github.com/typescript-eslint/typescript-eslint/commit/cc62015b8ae5f207912ff8988e2a0b3fe9a79243)) - - -### Features - -* add new package `rule-tester` ([#6777](https://github.com/typescript-eslint/typescript-eslint/issues/6777)) ([2ce1c1d](https://github.com/typescript-eslint/typescript-eslint/commit/2ce1c1d22c799a1ca027674fcb9b3a7ab0107428)) -* add package.json exports for public packages ([#6458](https://github.com/typescript-eslint/typescript-eslint/issues/6458)) ([d676683](https://github.com/typescript-eslint/typescript-eslint/commit/d6766838a05259556029acaac57dc7839b68c592)) -* drop support for ESLint v6 ([#5972](https://github.com/typescript-eslint/typescript-eslint/issues/5972)) ([bda806d](https://github.com/typescript-eslint/typescript-eslint/commit/bda806d78ee46133587d9383baff52d796a594e5)) -* drop support for node v12 ([#5918](https://github.com/typescript-eslint/typescript-eslint/issues/5918)) ([7e3fe9a](https://github.com/typescript-eslint/typescript-eslint/commit/7e3fe9a67abd394b0a114f2deb466edf5c9759ac)) -* drop support for node v14 and test against node v20 ([#7022](https://github.com/typescript-eslint/typescript-eslint/issues/7022)) ([e6235bf](https://github.com/typescript-eslint/typescript-eslint/commit/e6235bf61b781066653581b57b7cd976c9c4f905)) -* **eslint-plugin:** rework configs: recommended, strict, stylistic; -type-checked ([#5251](https://github.com/typescript-eslint/typescript-eslint/issues/5251)) ([5346b5b](https://github.com/typescript-eslint/typescript-eslint/commit/5346b5bbdbba81439ba761c282ba9cdcec7b45c8)), closes [#5036](https://github.com/typescript-eslint/typescript-eslint/issues/5036) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#3076](https://github.com/typescript-eslint/typescript-eslint/issues/3076) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#5889](https://github.com/typescript-eslint/typescript-eslint/issues/5889) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#5883](https://github.com/typescript-eslint/typescript-eslint/issues/5883) [#4863](https://github.com/typescript-eslint/typescript-eslint/issues/4863) [#5381](https://github.com/typescript-eslint/typescript-eslint/issues/5381) [#5256](https://github.com/typescript-eslint/typescript-eslint/issues/5256) [#5399](https://github.com/typescript-eslint/typescript-eslint/issues/5399) -* **typescript-estree:** add type checker wrapper APIs to ParserServicesWithTypeInformation ([#6404](https://github.com/typescript-eslint/typescript-eslint/issues/6404)) ([62d5755](https://github.com/typescript-eslint/typescript-eslint/commit/62d57559564fb08512eafe03a2c1b167c4377601)) - - -### BREAKING CHANGES - -* drop support for ESLint v6 -* drops support for node v17 -* drops support for node v12 - -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. - - - - - -# [5.62.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.61.0...v5.62.0) (2023-07-10) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -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. - - - - - -# [5.61.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.1...v5.61.0) (2023-07-03) - - -### Features - -* support TypeScript 5.1 ([#7088](https://github.com/typescript-eslint/typescript-eslint/issues/7088)) ([4bf2d73](https://github.com/typescript-eslint/typescript-eslint/commit/4bf2d7360eaf74c9ef87b196ff4c459b8f50800b)) - -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. - - - - - -## [5.60.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.0...v5.60.1) (2023-06-26) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -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. - - - - - -# [5.60.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.11...v5.60.0) (2023-06-19) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -## [5.59.11](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.10...v5.59.11) (2023-06-12) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -## [5.59.10](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.9...v5.59.10) (2023-06-12) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -## [5.59.9](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.8...v5.59.9) (2023-06-05) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -## [5.59.8](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.7...v5.59.8) (2023-05-29) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -## [5.59.7](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.6...v5.59.7) (2023-05-22) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -## [5.59.6](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.5...v5.59.6) (2023-05-15) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -## [5.59.5](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.4...v5.59.5) (2023-05-08) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -## [5.59.4](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.3...v5.59.4) (2023-05-08) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -## [5.59.3](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.2...v5.59.3) (2023-05-08) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -## [5.59.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.1...v5.59.2) (2023-05-01) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -## [5.59.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.0...v5.59.1) (2023-04-24) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [5.59.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.58.0...v5.59.0) (2023-04-17) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [5.58.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.57.1...v5.58.0) (2023-04-10) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -## [5.57.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.57.0...v5.57.1) (2023-04-03) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [5.57.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.56.0...v5.57.0) (2023-03-27) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [5.56.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.55.0...v5.56.0) (2023-03-20) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [5.55.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.54.1...v5.55.0) (2023-03-13) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -## [5.54.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.54.0...v5.54.1) (2023-03-06) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [5.54.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.53.0...v5.54.0) (2023-02-27) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [5.53.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.52.0...v5.53.0) (2023-02-20) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [5.52.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.51.0...v5.52.0) (2023-02-13) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [5.51.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.50.0...v5.51.0) (2023-02-06) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [5.50.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.49.0...v5.50.0) (2023-01-31) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -# [5.49.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.48.2...v5.49.0) (2023-01-23) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - - - - - -## [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/eslint-plugin-tslint - - - - - -## [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/eslint-plugin-tslint - - - - - -# [5.48.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.47.1...v5.48.0) (2023-01-02) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [5.47.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.47.0...v5.47.1) (2022-12-26) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [5.47.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.46.1...v5.47.0) (2022-12-19) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [5.46.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.46.0...v5.46.1) (2022-12-12) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [5.46.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.45.1...v5.46.0) (2022-12-08) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [5.45.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.45.0...v5.45.1) (2022-12-05) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [5.45.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.44.0...v5.45.0) (2022-11-28) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [5.44.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.43.0...v5.44.0) (2022-11-21) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [5.43.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.1...v5.43.0) (2022-11-14) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [5.42.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.0...v5.42.1) (2022-11-07) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [5.42.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.41.0...v5.42.0) (2022-10-31) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [5.41.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.1...v5.41.0) (2022-10-24) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [5.40.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.0...v5.40.1) (2022-10-17) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [5.40.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.39.0...v5.40.0) (2022-10-10) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [5.39.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.1...v5.39.0) (2022-10-03) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [5.38.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.0...v5.38.1) (2022-09-26) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [5.38.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.37.0...v5.38.0) (2022-09-19) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [5.37.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.2...v5.37.0) (2022-09-12) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [5.36.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.1...v5.36.2) (2022-09-05) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [5.36.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.0...v5.36.1) (2022-08-30) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [5.36.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.1...v5.36.0) (2022-08-30) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [5.35.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.0...v5.35.1) (2022-08-24) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [5.35.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.34.0...v5.35.0) (2022-08-24) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [5.34.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.1...v5.34.0) (2022-08-22) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [5.33.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.0...v5.33.1) (2022-08-15) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [5.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.32.0...v5.33.0) (2022-08-08) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [5.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.31.0...v5.32.0) (2022-08-01) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [5.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.7...v5.31.0) (2022-07-25) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [5.30.7](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.6...v5.30.7) (2022-07-18) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [5.30.6](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.5...v5.30.6) (2022-07-11) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [5.30.5](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.4...v5.30.5) (2022-07-04) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [5.30.4](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.3...v5.30.4) (2022-07-03) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [5.30.3](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.2...v5.30.3) (2022-07-01) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [5.30.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.1...v5.30.2) (2022-07-01) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## 5.30.1 (2022-07-01) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [5.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.29.0...v5.30.0) (2022-06-27) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [5.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.28.0...v5.29.0) (2022-06-20) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [5.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.1...v5.28.0) (2022-06-13) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [5.27.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.0...v5.27.1) (2022-06-06) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [5.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.26.0...v5.27.0) (2022-05-30) - -### Features - -- [4.7] support new extensions ([#5027](https://github.com/typescript-eslint/typescript-eslint/issues/5027)) ([efc147b](https://github.com/typescript-eslint/typescript-eslint/commit/efc147b04dce52ab17415b6a4ae4076b944b9036)) - -# [5.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.25.0...v5.26.0) (2022-05-23) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [5.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.24.0...v5.25.0) (2022-05-17) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [5.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.23.0...v5.24.0) (2022-05-16) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [5.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.22.0...v5.23.0) (2022-05-09) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [5.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.21.0...v5.22.0) (2022-05-02) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [5.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.20.0...v5.21.0) (2022-04-25) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [5.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.19.0...v5.20.0) (2022-04-18) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [5.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.18.0...v5.19.0) (2022-04-11) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [5.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.17.0...v5.18.0) (2022-04-04) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [5.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.16.0...v5.17.0) (2022-03-28) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [5.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.15.0...v5.16.0) (2022-03-21) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [5.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.14.0...v5.15.0) (2022-03-14) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [5.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.13.0...v5.14.0) (2022-03-07) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [5.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.1...v5.13.0) (2022-02-28) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [5.12.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.0...v5.12.1) (2022-02-21) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [5.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.11.0...v5.12.0) (2022-02-14) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [5.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.2...v5.11.0) (2022-02-07) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [5.10.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.1...v5.10.2) (2022-01-31) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [5.10.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.0...v5.10.1) (2022-01-24) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [5.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.1...v5.10.0) (2022-01-17) - -### Features - -- rename `experimental-utils` to `utils` and make `experimental-utils` an alias to the new package ([#4172](https://github.com/typescript-eslint/typescript-eslint/issues/4172)) ([1d55a75](https://github.com/typescript-eslint/typescript-eslint/commit/1d55a7511b38d8e2b2eabe59f639e0a865e6c93f)) - -## [5.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.0...v5.9.1) (2022-01-10) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [5.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.1...v5.9.0) (2022-01-03) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [5.8.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.0...v5.8.1) (2021-12-27) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [5.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.7.0...v5.8.0) (2021-12-20) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [5.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.6.0...v5.7.0) (2021-12-13) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [5.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.5.0...v5.6.0) (2021-12-06) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [5.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.4.0...v5.5.0) (2021-11-29) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [5.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.3.1...v5.4.0) (2021-11-15) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [5.3.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.3.0...v5.3.1) (2021-11-08) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [5.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.2.0...v5.3.0) (2021-11-01) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [5.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.1.0...v5.2.0) (2021-10-25) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [5.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.0.0...v5.1.0) (2021-10-18) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [5.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.33.0...v5.0.0) (2021-10-11) - -### Features - -- remove `meta.docs.category` from rules ([#3800](https://github.com/typescript-eslint/typescript-eslint/issues/3800)) ([71c9370](https://github.com/typescript-eslint/typescript-eslint/commit/71c93706e55f5f92a1285102b93c6ab1950c6df4)) -- support ESLint v8 ([#3737](https://github.com/typescript-eslint/typescript-eslint/issues/3737)) ([4ca62ae](https://github.com/typescript-eslint/typescript-eslint/commit/4ca62aee6681d706e762a8db727541ca204364f2)) - -# [4.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.32.0...v4.33.0) (2021-10-04) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [4.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.2...v4.32.0) (2021-09-27) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [4.31.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.1...v4.31.2) (2021-09-20) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [4.31.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.0...v4.31.1) (2021-09-13) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [4.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.30.0...v4.31.0) (2021-09-06) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [4.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.3...v4.30.0) (2021-08-30) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [4.29.3](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.2...v4.29.3) (2021-08-23) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [4.29.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.1...v4.29.2) (2021-08-16) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [4.29.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.0...v4.29.1) (2021-08-09) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [4.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.5...v4.29.0) (2021-08-02) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [4.28.5](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.4...v4.28.5) (2021-07-26) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [4.28.4](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.3...v4.28.4) (2021-07-19) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [4.28.3](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.2...v4.28.3) (2021-07-12) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [4.28.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.1...v4.28.2) (2021-07-05) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [4.28.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.0...v4.28.1) (2021-06-28) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [4.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.27.0...v4.28.0) (2021-06-21) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [4.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.1...v4.27.0) (2021-06-14) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [4.26.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.0...v4.26.1) (2021-06-07) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [4.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.25.0...v4.26.0) (2021-05-31) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [4.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.24.0...v4.25.0) (2021-05-24) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [4.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.23.0...v4.24.0) (2021-05-17) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [4.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.1...v4.23.0) (2021-05-10) - -### Features - -- refactor to split AST specification out as its own module ([#2911](https://github.com/typescript-eslint/typescript-eslint/issues/2911)) ([25ea953](https://github.com/typescript-eslint/typescript-eslint/commit/25ea953cc60b118bd385c71e0a9b61c286c26fcf)) - -## [4.22.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.0...v4.22.1) (2021-05-04) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [4.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.21.0...v4.22.0) (2021-04-12) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [4.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.20.0...v4.21.0) (2021-04-05) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [4.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.19.0...v4.20.0) (2021-03-29) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [4.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.18.0...v4.19.0) (2021-03-22) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [4.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.17.0...v4.18.0) (2021-03-15) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [4.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.16.1...v4.17.0) (2021-03-08) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [4.16.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.16.0...v4.16.1) (2021-03-01) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [4.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.2...v4.16.0) (2021-03-01) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [4.15.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.1...v4.15.2) (2021-02-22) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [4.15.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.0...v4.15.1) (2021-02-15) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [4.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.2...v4.15.0) (2021-02-08) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [4.14.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.1...v4.14.2) (2021-02-01) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [4.14.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.0...v4.14.1) (2021-01-25) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [4.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.13.0...v4.14.0) (2021-01-18) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [4.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.12.0...v4.13.0) (2021-01-11) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [4.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.11.1...v4.12.0) (2021-01-04) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [4.11.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.11.0...v4.11.1) (2020-12-28) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [4.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.10.0...v4.11.0) (2020-12-21) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [4.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.9.1...v4.10.0) (2020-12-14) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [4.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.9.0...v4.9.1) (2020-12-07) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [4.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.2...v4.9.0) (2020-11-30) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [4.8.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.1...v4.8.2) (2020-11-23) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [4.8.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.0...v4.8.1) (2020-11-17) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [4.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.7.0...v4.8.0) (2020-11-16) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [4.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.6.1...v4.7.0) (2020-11-09) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [4.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.6.0...v4.6.1) (2020-11-02) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [4.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.5.0...v4.6.0) (2020-10-26) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [4.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.4.1...v4.5.0) (2020-10-19) - -### Features - -- **typescript-estree:** add flag EXPERIMENTAL_useSourceOfProjectReferenceRedirect ([#2669](https://github.com/typescript-eslint/typescript-eslint/issues/2669)) ([90a5878](https://github.com/typescript-eslint/typescript-eslint/commit/90a587845088da1b205e4d7d77dbc3f9447b1c5a)) - -## [4.4.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.4.0...v4.4.1) (2020-10-12) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [4.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.3.0...v4.4.0) (2020-10-05) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [4.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.2.0...v4.3.0) (2020-09-28) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [4.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.1...v4.2.0) (2020-09-21) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [4.1.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.0...v4.1.1) (2020-09-14) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [4.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.0.1...v4.1.0) (2020-09-07) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [4.0.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.0.0...v4.0.1) (2020-08-31) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [4.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.10.1...v4.0.0) (2020-08-31) - -## [Please see the release notes for v4.0.0](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v4.0.0) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [3.10.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.10.0...v3.10.1) (2020-08-25) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [3.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.9.1...v3.10.0) (2020-08-24) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [3.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.9.0...v3.9.1) (2020-08-17) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [3.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.8.0...v3.9.0) (2020-08-10) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [3.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.7.1...v3.8.0) (2020-08-03) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [3.7.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.7.0...v3.7.1) (2020-07-27) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [3.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.6.1...v3.7.0) (2020-07-20) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [3.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.6.0...v3.6.1) (2020-07-13) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [3.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.5.0...v3.6.0) (2020-07-06) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [3.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.4.0...v3.5.0) (2020-06-29) - -### Features - -- add package scope-manager ([#1939](https://github.com/typescript-eslint/typescript-eslint/issues/1939)) ([682eb7e](https://github.com/typescript-eslint/typescript-eslint/commit/682eb7e009c3f22a542882dfd3602196a60d2a1e)) - -# [3.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.3.0...v3.4.0) (2020-06-22) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [3.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.2.0...v3.3.0) (2020-06-15) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [3.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.1.0...v3.2.0) (2020-06-08) - -### Bug Fixes - -- **eslint-plugin:** [prefer-optional-chain] handling first member expression ([#2156](https://github.com/typescript-eslint/typescript-eslint/issues/2156)) ([de18660](https://github.com/typescript-eslint/typescript-eslint/commit/de18660a8cf8f7033798646d8c5b0938d1accb12)) - -# [3.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.0.2...v3.1.0) (2020-06-01) - -### Bug Fixes - -- **experimental-utils:** downlevel type declarations for versions older than 3.8 ([#2133](https://github.com/typescript-eslint/typescript-eslint/issues/2133)) ([7925823](https://github.com/typescript-eslint/typescript-eslint/commit/792582326a8065270b69a0ffcaad5a7b4b103ff3)) - -## [3.0.2](https://github.com/typescript-eslint/typescript-eslint/compare/v3.0.1...v3.0.2) (2020-05-27) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [3.0.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.0.0...v3.0.1) (2020-05-25) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [3.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.34.0...v3.0.0) (2020-05-21) - -## [Please see the release notes for v3.0.0](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v3.0.0) - -### Features - -- drop support for node v8 ([#1997](https://github.com/typescript-eslint/typescript-eslint/issues/1997)) ([b6c3b7b](https://github.com/typescript-eslint/typescript-eslint/commit/b6c3b7b84b8d199fa75a46432febd4a364a63217)) -- upgrade to ESLint v7 ([#2022](https://github.com/typescript-eslint/typescript-eslint/issues/2022)) ([208de71](https://github.com/typescript-eslint/typescript-eslint/commit/208de71059746bf38e94bd460346ffb2698a3e12)) - -# [2.34.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.33.0...v2.34.0) (2020-05-18) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [2.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.32.0...v2.33.0) (2020-05-12) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [2.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.31.0...v2.32.0) (2020-05-11) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [2.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.30.0...v2.31.0) (2020-05-04) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [2.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.29.0...v2.30.0) (2020-04-27) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [2.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.28.0...v2.29.0) (2020-04-20) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [2.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.27.0...v2.28.0) (2020-04-13) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [2.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.26.0...v2.27.0) (2020-04-06) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [2.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.25.0...v2.26.0) (2020-03-30) - -### Features - -- **eslint-plugin-tslint:** support tslint 6 ([#1809](https://github.com/typescript-eslint/typescript-eslint/issues/1809)) ([7d963fd](https://github.com/typescript-eslint/typescript-eslint/commit/7d963fd846935acd91b7b0cd31c56a70a2b994d1)) - -# [2.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.24.0...v2.25.0) (2020-03-23) - -### Bug Fixes - -- **eslint-plugin-tslint:** fix tslintConfig memoization key ([#1719](https://github.com/typescript-eslint/typescript-eslint/issues/1719)) ([abf1a2f](https://github.com/typescript-eslint/typescript-eslint/commit/abf1a2fa5574e41af8070be3d79a886ea2f989cc)), closes [typescript-eslint#1692](https://github.com/typescript-eslint/issues/1692) - -# [2.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.23.0...v2.24.0) (2020-03-16) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [2.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.22.0...v2.23.0) (2020-03-09) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [2.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.21.0...v2.22.0) (2020-03-02) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [2.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.20.0...v2.21.0) (2020-02-24) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [2.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.19.2...v2.20.0) (2020-02-17) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [2.19.2](https://github.com/typescript-eslint/typescript-eslint/compare/v2.19.1...v2.19.2) (2020-02-10) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [2.19.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.19.0...v2.19.1) (2020-02-10) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [2.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.18.0...v2.19.0) (2020-02-03) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [2.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.17.0...v2.18.0) (2020-01-27) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [2.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.16.0...v2.17.0) (2020-01-20) - -### Features - -- **experimental-utils:** expose getParserServices from utils ([#1448](https://github.com/typescript-eslint/typescript-eslint/issues/1448)) ([982c8bc](https://github.com/typescript-eslint/typescript-eslint/commit/982c8bc)) - -# [2.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.15.0...v2.16.0) (2020-01-13) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [2.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.14.0...v2.15.0) (2020-01-06) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [2.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.13.0...v2.14.0) (2019-12-30) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [2.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.12.0...v2.13.0) (2019-12-23) - -### Features - -- **eslint-plugin-tslint:** add fixer for config rule ([#1342](https://github.com/typescript-eslint/typescript-eslint/issues/1342)) ([c52c5c9](https://github.com/typescript-eslint/typescript-eslint/commit/c52c5c9)) - -# [2.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.11.0...v2.12.0) (2019-12-16) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [2.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.10.0...v2.11.0) (2019-12-09) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [2.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.9.0...v2.10.0) (2019-12-02) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [2.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.8.0...v2.9.0) (2019-11-25) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [2.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.7.0...v2.8.0) (2019-11-18) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [2.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.6.1...v2.7.0) (2019-11-11) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [2.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.6.0...v2.6.1) (2019-11-04) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [2.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.5.0...v2.6.0) (2019-10-28) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [2.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.4.0...v2.5.0) (2019-10-21) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [2.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.3...v2.4.0) (2019-10-14) - -### Bug Fixes - -- support long running "watch" lint sessions ([#973](https://github.com/typescript-eslint/typescript-eslint/issues/973)) ([854620e](https://github.com/typescript-eslint/typescript-eslint/commit/854620e)) - -### Features - -- **typescript-estree:** support for parsing 3.7 features ([#1045](https://github.com/typescript-eslint/typescript-eslint/issues/1045)) ([623febf](https://github.com/typescript-eslint/typescript-eslint/commit/623febf)) - -## [2.3.3](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.2...v2.3.3) (2019-10-07) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [2.3.2](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.1...v2.3.2) (2019-09-30) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [2.3.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.0...v2.3.1) (2019-09-23) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [2.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.2.0...v2.3.0) (2019-09-16) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [2.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.1.0...v2.2.0) (2019-09-09) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [2.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.0.0...v2.1.0) (2019-09-02) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [2.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.13.0...v2.0.0) (2019-08-13) - -### Features - -- explicitly support eslint v6 ([#645](https://github.com/typescript-eslint/typescript-eslint/issues/645)) ([34a7cf6](https://github.com/typescript-eslint/typescript-eslint/commit/34a7cf6)) - -- feat(eslint-plugin)!: change recommended config (#729) ([428567d](https://github.com/typescript-eslint/typescript-eslint/commit/428567d)), closes [#729](https://github.com/typescript-eslint/typescript-eslint/issues/729) -- feat(typescript-estree)!: throw error on file not in project when `project` set (#760) ([3777b77](https://github.com/typescript-eslint/typescript-eslint/commit/3777b77)), closes [#760](https://github.com/typescript-eslint/typescript-eslint/issues/760) - -### BREAKING CHANGES - -- recommended config changes are considered breaking -- by default we will now throw when a file is not in the `project` provided -- Node 6 is no longer supported - -# [1.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.12.0...v1.13.0) (2019-07-21) - -### Bug Fixes - -- Correct `@types/json-schema` dependency ([#675](https://github.com/typescript-eslint/typescript-eslint/issues/675)) ([a5398ce](https://github.com/typescript-eslint/typescript-eslint/commit/a5398ce)) - -# [1.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.11.0...v1.12.0) (2019-07-12) - -### Features - -- **eslint-plugin:** added new rule prefer-readonly ([#555](https://github.com/typescript-eslint/typescript-eslint/issues/555)) ([76b89a5](https://github.com/typescript-eslint/typescript-eslint/commit/76b89a5)) - -# [1.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.10.2...v1.11.0) (2019-06-23) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [1.10.2](https://github.com/typescript-eslint/typescript-eslint/compare/v1.10.1...v1.10.2) (2019-06-10) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [1.10.1](https://github.com/typescript-eslint/typescript-eslint/compare/v1.10.0...v1.10.1) (2019-06-09) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [1.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.9.0...v1.10.0) (2019-06-09) - -### Features - -- make utils/TSESLint export typed classes instead of just types ([#526](https://github.com/typescript-eslint/typescript-eslint/issues/526)) ([370ac72](https://github.com/typescript-eslint/typescript-eslint/commit/370ac72)) - -# [1.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.8.0...v1.9.0) (2019-05-12) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [1.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.7.0...v1.8.0) (2019-05-10) - -### Bug Fixes - -- upgrade lockfile versions ([#487](https://github.com/typescript-eslint/typescript-eslint/issues/487)) ([f029dba](https://github.com/typescript-eslint/typescript-eslint/commit/f029dba)) -- **eslint-plugin:** Support more nodes [no-extra-parens](<[#465](https://github.com/typescript-eslint/typescript-eslint/issues/465)>) ([2d15644](https://github.com/typescript-eslint/typescript-eslint/commit/2d15644)) - -# [1.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.6.0...v1.7.0) (2019-04-20) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [1.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.5.0...v1.6.0) (2019-04-03) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [1.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.4.2...v1.5.0) (2019-03-20) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [1.4.2](https://github.com/typescript-eslint/typescript-eslint/compare/v1.4.1...v1.4.2) (2019-02-25) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [1.4.1](https://github.com/typescript-eslint/typescript-eslint/compare/v1.4.0...v1.4.1) (2019-02-23) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [1.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.3.0...v1.4.0) (2019-02-19) - -### Features - -- **eslint-plugin:** Migrate plugin to ts ([#120](https://github.com/typescript-eslint/typescript-eslint/issues/120)) ([61c60dc](https://github.com/typescript-eslint/typescript-eslint/commit/61c60dc)) - -# [1.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.2.0...v1.3.0) (2019-02-07) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [1.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.1.1...v1.2.0) (2019-02-01) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [1.1.1](https://github.com/typescript-eslint/typescript-eslint/compare/v1.1.0...v1.1.1) (2019-01-29) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [1.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.0.0...v1.1.0) (2019-01-23) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -# [1.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v0.2.1...v1.0.0) (2019-01-20) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint - -## [0.2.1](https://github.com/typescript-eslint/typescript-eslint/compare/v0.2.0...v0.2.1) (2019-01-20) - -**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint diff --git a/packages/eslint-plugin-tslint/LICENSE b/packages/eslint-plugin-tslint/LICENSE deleted file mode 100644 index a1164108d4d6..000000000000 --- a/packages/eslint-plugin-tslint/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2019 typescript-eslint and other contributors - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/packages/eslint-plugin-tslint/README.md b/packages/eslint-plugin-tslint/README.md deleted file mode 100644 index d02ff8797606..000000000000 --- a/packages/eslint-plugin-tslint/README.md +++ /dev/null @@ -1,12 +0,0 @@ -# `@typescript-eslint/eslint-plugin-tslint` - -> ESLint plugin that wraps a TSLint configuration and lints the whole source using TSLint. - -[![NPM Version](https://img.shields.io/npm/v/@typescript-eslint/eslint-plugin-tslint.svg?style=flat-square)](https://www.npmjs.com/package/@typescript-eslint/eslint-plugin-tslint) -[![NPM Downloads](https://img.shields.io/npm/dm/@typescript-eslint/eslint-plugin-tslint.svg?style=flat-square)](https://www.npmjs.com/package/@typescript-eslint/eslint-plugin-tslint) - -👉 See **https://typescript-eslint.io/packages/eslint-plugin-tslint** 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/eslint-plugin-tslint/jest.config.js b/packages/eslint-plugin-tslint/jest.config.js deleted file mode 100644 index 910991b20cff..000000000000 --- a/packages/eslint-plugin-tslint/jest.config.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict'; - -// @ts-check -/** @type {import('@jest/types').Config.InitialOptions} */ -module.exports = { - ...require('../../jest.config.base.js'), -}; diff --git a/packages/eslint-plugin-tslint/package.json b/packages/eslint-plugin-tslint/package.json deleted file mode 100644 index 890850d4a771..000000000000 --- a/packages/eslint-plugin-tslint/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "@typescript-eslint/eslint-plugin-tslint", - "version": "7.0.2", - "main": "dist/index.js", - "typings": "src/index.ts", - "description": "ESLint plugin that wraps a TSLint configuration and lints the whole source using TSLint", - "files": [ - "dist", - "package.json", - "README.md", - "LICENSE" - ], - "type": "commonjs", - "exports": { - ".": { - "types": "./dist/index.d.ts", - "default": "./dist/index.js" - }, - "./package.json": "./package.json" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "repository": { - "type": "git", - "url": "https://github.com/typescript-eslint/typescript-eslint.git", - "directory": "packages/eslint-plugin-tslint" - }, - "bugs": { - "url": "https://github.com/typescript-eslint/typescript-eslint/issues" - }, - "license": "MIT", - "keywords": [ - "eslint", - "eslintplugin", - "eslint-plugin", - "tslint" - ], - "scripts": { - "build": "tsc -b tsconfig.build.json", - "clean": "tsc -b tsconfig.build.json --clean", - "postclean": "rimraf dist && rimraf coverage", - "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", - "lint": "npx nx lint", - "test": "jest --coverage", - "typecheck": "tsc -p tsconfig.json --noEmit" - }, - "dependencies": { - "@typescript-eslint/utils": "7.0.2" - }, - "peerDependencies": { - "eslint": "^8.56.0", - "tslint": "^5.0.0 || ^6.0.0", - "typescript": "*" - }, - "devDependencies": { - "@types/lodash": "*", - "@typescript-eslint/parser": "7.0.2", - "jest": "29.7.0", - "prettier": "^3.0.3", - "rimraf": "*" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } -} diff --git a/packages/eslint-plugin-tslint/project.json b/packages/eslint-plugin-tslint/project.json deleted file mode 100644 index dc5d5b11a632..000000000000 --- a/packages/eslint-plugin-tslint/project.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "eslint-plugin-tslint", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "type": "library", - "implicitDependencies": [], - "targets": { - "lint": { - "executor": "@nx/eslint:lint", - "outputs": ["{options.outputFile}"] - } - } -} diff --git a/packages/eslint-plugin-tslint/src/custom-linter.ts b/packages/eslint-plugin-tslint/src/custom-linter.ts deleted file mode 100644 index b4e8d753b8f9..000000000000 --- a/packages/eslint-plugin-tslint/src/custom-linter.ts +++ /dev/null @@ -1,21 +0,0 @@ -import type { ILinterOptions, LintResult } from 'tslint'; -import { Linter } from 'tslint'; -import type { Program, SourceFile } from 'typescript'; - -// @ts-expect-error - We need to access the program, but Linter has private program already -export class CustomLinter extends Linter { - constructor( - options: ILinterOptions, - private readonly program: Program, - ) { - super(options, program); - } - - getResult(): LintResult { - return super.getResult(); - } - - getSourceFile(fileName: string): SourceFile | undefined { - return this.program.getSourceFile(fileName); - } -} diff --git a/packages/eslint-plugin-tslint/src/index.ts b/packages/eslint-plugin-tslint/src/index.ts deleted file mode 100644 index bc64dc8b53f4..000000000000 --- a/packages/eslint-plugin-tslint/src/index.ts +++ /dev/null @@ -1,22 +0,0 @@ -import type { Linter } from '@typescript-eslint/utils/ts-eslint'; - -import configRule from './rules/config'; - -// note - cannot migrate this to an import statement because it will make TSC copy the package.json to the dist folder -const { name, version } = require('../package.json') as { - name: string; - version: string; -}; - -export const meta: Linter.PluginMeta = { - name, - version, -}; - -/** - * Expose a single rule called "config", which will be accessed in the user's eslint config files - * via "tslint/config" - */ -export const rules: Linter.PluginRules = { - config: configRule, -}; diff --git a/packages/eslint-plugin-tslint/src/rules/config.ts b/packages/eslint-plugin-tslint/src/rules/config.ts deleted file mode 100644 index 89abe0507f55..000000000000 --- a/packages/eslint-plugin-tslint/src/rules/config.ts +++ /dev/null @@ -1,194 +0,0 @@ -import { ESLintUtils } from '@typescript-eslint/utils'; -import path from 'path'; -import type { RuleSeverity } from 'tslint'; -import { Configuration } from 'tslint'; - -import { CustomLinter } from '../custom-linter'; - -function memoize unknown>( - func: T, - resolver: (...args: Parameters) => string, -): T { - const cache = new Map>(); - const memoized = function (...args) { - const key = resolver(...(args as Parameters)); - - if (cache.has(key)) { - return cache.get(key)!; - } - const result = func(...args); - cache.set(key, result as ReturnType); - return result; - } as T; - return memoized; -} - -// note - cannot migrate this to an import statement because it will make TSC copy the package.json to the dist folder -// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -const version: string = require('../../package.json'); - -const createRule = ESLintUtils.RuleCreator( - () => - `https://github.com/typescript-eslint/typescript-eslint/blob/v${version}/packages/eslint-plugin-tslint/README.md`, -); -export type RawRulesConfig = Record< - string, - | unknown[] - | boolean - | { - severity?: RuleSeverity | 'default' | 'none' | 'warn'; - options?: unknown; - } - | null - | undefined ->; - -export type MessageIds = 'failure'; -export type Options = [ - { - rules?: RawRulesConfig; - rulesDirectory?: string[]; - lintFile?: string; - }, -]; - -/** - * Construct a configFile for TSLint - */ -const tslintConfig = memoize( - ( - lintFile?: string, - tslintRules?: RawRulesConfig, - tslintRulesDirectory?: string[], - ) => { - if (lintFile != null) { - return Configuration.loadConfigurationFromPath(lintFile); - } - return Configuration.parseConfigFile({ - rules: tslintRules ?? {}, - rulesDirectory: tslintRulesDirectory ?? [], - }); - }, - ( - lintFile: string | undefined, - tslintRules = {}, - tslintRulesDirectory: string[] = [], - ) => - `${lintFile}_${JSON.stringify(tslintRules)}_${tslintRulesDirectory.join()}`, -); - -export default createRule({ - name: 'config', - meta: { - docs: { - description: - 'Wraps a TSLint configuration and lints the whole source using TSLint', // eslint-disable-line eslint-plugin/require-meta-docs-description - }, - fixable: 'code', - type: 'problem', - messages: { - failure: '{{message}} (tslint:{{ruleName}})', - }, - schema: [ - { - type: 'object', - properties: { - rules: { - type: 'object', - /** - * No fixed schema properties for rules, as this would be a permanently moving target - */ - additionalProperties: true, - }, - rulesDirectory: { - type: 'array', - items: { - type: 'string', - }, - }, - lintFile: { - type: 'string', - }, - }, - additionalProperties: false, - }, - ], - }, - defaultOptions: [{}], - create( - context, - [{ rules: tslintRules, rulesDirectory: tslintRulesDirectory, lintFile }], - ) { - const fileName = path.resolve(context.cwd, context.filename); - const services = ESLintUtils.getParserServices(context); - const program = services.program; - - /** - * Create an instance of TSLint - * Lint the source code using the configured TSLint instance, and the rules which have been - * passed via the ESLint rule options for this rule (using "tslint/config") - */ - const tslintOptions = { - formatter: 'json', - fix: false, - }; - const tslint = new CustomLinter(tslintOptions, program); - const configuration = tslintConfig( - lintFile, - tslintRules, - tslintRulesDirectory, - ); - tslint.lint(fileName, context.sourceCode.text, configuration); - - const result = tslint.getResult(); - - /** - * Format the TSLint results for ESLint - */ - if (result.failures.length) { - result.failures.forEach(failure => { - const start = failure.getStartPosition().getLineAndCharacter(); - const end = failure.getEndPosition().getLineAndCharacter(); - context.report({ - messageId: 'failure', - data: { - message: failure.getFailure(), - ruleName: failure.getRuleName(), - }, - loc: { - start: { - line: start.line + 1, - column: start.character, - }, - end: { - line: end.line + 1, - column: end.character, - }, - }, - fix: fixer => { - const replacements = failure.getFix(); - - return Array.isArray(replacements) - ? replacements.map(replacement => - fixer.replaceTextRange( - [replacement.start, replacement.end], - replacement.text, - ), - ) - : replacements !== undefined - ? fixer.replaceTextRange( - [replacements.start, replacements.end], - replacements.text, - ) - : []; - }, - }); - }); - } - - /** - * Return an empty object for the ESLint rule - */ - return {}; - }, -}); diff --git a/packages/eslint-plugin-tslint/tests/fixtures/fixture-project/1.ts b/packages/eslint-plugin-tslint/tests/fixtures/fixture-project/1.ts deleted file mode 100644 index 0870b5cd2825..000000000000 --- a/packages/eslint-plugin-tslint/tests/fixtures/fixture-project/1.ts +++ /dev/null @@ -1 +0,0 @@ -var foo = true; diff --git a/packages/eslint-plugin-tslint/tests/fixtures/fixture-project/2.ts b/packages/eslint-plugin-tslint/tests/fixtures/fixture-project/2.ts deleted file mode 100644 index 3da535b2cde3..000000000000 --- a/packages/eslint-plugin-tslint/tests/fixtures/fixture-project/2.ts +++ /dev/null @@ -1 +0,0 @@ -throw 'should be ok because rule is not loaded'; diff --git a/packages/eslint-plugin-tslint/tests/fixtures/fixture-project/3.ts b/packages/eslint-plugin-tslint/tests/fixtures/fixture-project/3.ts deleted file mode 100644 index e71f830c3915..000000000000 --- a/packages/eslint-plugin-tslint/tests/fixtures/fixture-project/3.ts +++ /dev/null @@ -1 +0,0 @@ -throw 'err'; // no-string-throw diff --git a/packages/eslint-plugin-tslint/tests/fixtures/fixture-project/4.ts b/packages/eslint-plugin-tslint/tests/fixtures/fixture-project/4.ts deleted file mode 100644 index e1173e87a223..000000000000 --- a/packages/eslint-plugin-tslint/tests/fixtures/fixture-project/4.ts +++ /dev/null @@ -1 +0,0 @@ -var foo = true; // semicolon diff --git a/packages/eslint-plugin-tslint/tests/fixtures/fixture-project/5.ts b/packages/eslint-plugin-tslint/tests/fixtures/fixture-project/5.ts deleted file mode 100644 index 2fc07810720c..000000000000 --- a/packages/eslint-plugin-tslint/tests/fixtures/fixture-project/5.ts +++ /dev/null @@ -1 +0,0 @@ -var foo = true; // fail diff --git a/packages/eslint-plugin-tslint/tests/fixtures/fixture-project/6.ts b/packages/eslint-plugin-tslint/tests/fixtures/fixture-project/6.ts deleted file mode 100644 index e901f01b4874..000000000000 --- a/packages/eslint-plugin-tslint/tests/fixtures/fixture-project/6.ts +++ /dev/null @@ -1 +0,0 @@ -foo; diff --git a/packages/eslint-plugin-tslint/tests/fixtures/fixture-project/tsconfig.json b/packages/eslint-plugin-tslint/tests/fixtures/fixture-project/tsconfig.json deleted file mode 100644 index 0967ef424bce..000000000000 --- a/packages/eslint-plugin-tslint/tests/fixtures/fixture-project/tsconfig.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/packages/eslint-plugin-tslint/tests/fixtures/test-project/extra.ts b/packages/eslint-plugin-tslint/tests/fixtures/test-project/extra.ts deleted file mode 100644 index e901f01b4874..000000000000 --- a/packages/eslint-plugin-tslint/tests/fixtures/test-project/extra.ts +++ /dev/null @@ -1 +0,0 @@ -foo; diff --git a/packages/eslint-plugin-tslint/tests/fixtures/test-project/file-spec.ts b/packages/eslint-plugin-tslint/tests/fixtures/test-project/file-spec.ts deleted file mode 100644 index 0b4d57c7ee74..000000000000 --- a/packages/eslint-plugin-tslint/tests/fixtures/test-project/file-spec.ts +++ /dev/null @@ -1,2 +0,0 @@ -import { x } from './file'; -console.assert(x); diff --git a/packages/eslint-plugin-tslint/tests/fixtures/test-project/file.ts b/packages/eslint-plugin-tslint/tests/fixtures/test-project/file.ts deleted file mode 100644 index d85368d8a303..000000000000 --- a/packages/eslint-plugin-tslint/tests/fixtures/test-project/file.ts +++ /dev/null @@ -1,3 +0,0 @@ -import * as number from './number'; -export const x = 1; -console.log(number); diff --git a/packages/eslint-plugin-tslint/tests/fixtures/test-project/source.ts b/packages/eslint-plugin-tslint/tests/fixtures/test-project/source.ts deleted file mode 100644 index 187dd947b0ff..000000000000 --- a/packages/eslint-plugin-tslint/tests/fixtures/test-project/source.ts +++ /dev/null @@ -1,2 +0,0 @@ -const a: string = 1; -const sum = 1 + '2'; diff --git a/packages/eslint-plugin-tslint/tests/fixtures/test-project/tsconfig-files.json b/packages/eslint-plugin-tslint/tests/fixtures/test-project/tsconfig-files.json deleted file mode 100644 index 1d1ee04cc92b..000000000000 --- a/packages/eslint-plugin-tslint/tests/fixtures/test-project/tsconfig-files.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "lib": ["dom"], - "files": ["file.ts"] -} diff --git a/packages/eslint-plugin-tslint/tests/fixtures/test-project/tsconfig.json b/packages/eslint-plugin-tslint/tests/fixtures/test-project/tsconfig.json deleted file mode 100644 index fcd054ab4880..000000000000 --- a/packages/eslint-plugin-tslint/tests/fixtures/test-project/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "compilerOptions": { - "target": "es5", - "module": "commonjs", - "strict": true, - "noUnusedLocals": true, - "noImplicitAny": true - } -} diff --git a/packages/eslint-plugin-tslint/tests/fixtures/test-project/tslint.json b/packages/eslint-plugin-tslint/tests/fixtures/test-project/tslint.json deleted file mode 100644 index 9d026172da7c..000000000000 --- a/packages/eslint-plugin-tslint/tests/fixtures/test-project/tslint.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "rules": { - "no-string-throw": true, - "no-var-keyword": true, - "prefer-const": true, - "radix": true - } -} diff --git a/packages/eslint-plugin-tslint/tests/fixtures/test-tslint-rules-directory/alwaysFailRule.js b/packages/eslint-plugin-tslint/tests/fixtures/test-tslint-rules-directory/alwaysFailRule.js deleted file mode 100644 index 76537897f031..000000000000 --- a/packages/eslint-plugin-tslint/tests/fixtures/test-tslint-rules-directory/alwaysFailRule.js +++ /dev/null @@ -1,19 +0,0 @@ -const Lint = require('tslint'); - -class Rule extends Lint.Rules.AbstractRule { - apply(sourceFile) { - return this.applyWithWalker( - new AlwaysFailWalker(sourceFile, this.getOptions()), - ); - } -} - -class AlwaysFailWalker extends Lint.RuleWalker { - visitSourceFile(node) { - this.addFailure( - this.createFailure(node.getStart(), node.getWidth(), 'failure'), - ); - } -} - -exports.Rule = Rule; diff --git a/packages/eslint-plugin-tslint/tests/index.spec.ts b/packages/eslint-plugin-tslint/tests/index.spec.ts deleted file mode 100644 index bbe479c832b8..000000000000 --- a/packages/eslint-plugin-tslint/tests/index.spec.ts +++ /dev/null @@ -1,238 +0,0 @@ -import * as parser from '@typescript-eslint/parser'; -import { TSESLint } from '@typescript-eslint/utils'; -import { readFileSync } from 'fs'; -import path = require('path'); - -import type { ClassicConfig } from '@typescript-eslint/utils/ts-eslint'; - -import type { Options } from '../src/rules/config'; -import rule from '../src/rules/config'; - -const ruleTester = new TSESLint.RuleTester({ - parserOptions: { - ecmaVersion: 6, - sourceType: 'module', - ecmaFeatures: {}, - /** - * Project is needed to generate the parserServices - * within @typescript-eslint/parser - */ - project: './tests/fixtures/fixture-project/tsconfig.json', - warnOnUnsupportedTypeScriptVersion: false, - }, - parser: require.resolve('@typescript-eslint/parser'), -}); - -/** - * Inline rules should be supported - */ -const tslintRulesConfig: Options = [ - { - rules: { - semicolon: [true, 'always'], - }, - }, -]; - -/** - * Custom rules directories should be supported - */ -const tslintRulesDirectoryConfig: Options = [ - { - rulesDirectory: ['./tests/fixtures/test-tslint-rules-directory'], - rules: { - 'always-fail': { - severity: 'error', - }, - }, - }, -]; - -const TEST_PROJECT_PATH = path.resolve( - __dirname, - 'fixtures', - 'test-project', - 'tsconfig.json', -); - -ruleTester.run('tslint/config', rule, { - valid: [ - { - code: 'var foo = true;', - options: tslintRulesConfig, - filename: './tests/fixtures/fixture-project/1.ts', - }, - { - filename: './tests/fixtures/test-project/file-spec.ts', - code: readFileSync( - './tests/fixtures/test-project/file-spec.ts', - 'utf8', - ).replace(/\n/g, ' '), - parserOptions: { - project: TEST_PROJECT_PATH, - }, - options: tslintRulesConfig, - }, - { - code: 'throw "should be ok because rule is not loaded";', - options: tslintRulesConfig, - filename: './tests/fixtures/fixture-project/2.ts', - }, - ], - - invalid: [ - { - options: [{ lintFile: './tests/fixtures/test-project/tslint.json' }], - code: 'throw "err" // no-string-throw', - output: 'throw new Error("err") // no-string-throw', - filename: './tests/fixtures/fixture-project/3.ts', - errors: [ - { - messageId: 'failure', - data: { - message: - 'Throwing plain strings (not instances of Error) gives no stack traces', - ruleName: 'no-string-throw', - }, - }, - ], - }, - { - code: 'var foo = true // semicolon', - options: tslintRulesConfig, - output: 'var foo = true; // semicolon', - filename: './tests/fixtures/fixture-project/4.ts', - errors: [ - { - messageId: 'failure', - data: { - message: 'Missing semicolon', - ruleName: 'semicolon', - }, - line: 1, - column: 15, - }, - ], - }, - { - code: 'var foo = true // fail', - options: tslintRulesDirectoryConfig, - output: null, - filename: './tests/fixtures/fixture-project/5.ts', - errors: [ - { - messageId: 'failure', - data: { - message: 'failure', - ruleName: 'always-fail', - }, - line: 1, - column: 1, - }, - ], - }, - { - filename: './tests/fixtures/test-project/source.ts', - code: readFileSync( - './tests/fixtures/test-project/source.ts', - 'utf8', - ).replace(/\n/g, ' '), - parserOptions: { - project: TEST_PROJECT_PATH, - }, - options: [ - { - rulesDirectory: [ - path.join( - path.dirname(require.resolve('tslint/package.json')), - 'lib', - 'rules', - ), - ], - rules: { 'restrict-plus-operands': true }, - }, - ], - errors: [ - { - messageId: 'failure', - data: { - message: - 'Operands of \'+\' operation must either be both strings or both numbers or both bigints, but found 1 + "2". Consider using template literals.', - ruleName: 'restrict-plus-operands', - }, - }, - ], - }, - ], -}); - -if (process.env.TYPESCRIPT_ESLINT_EXPERIMENTAL_TSSERVER !== 'true') { - describe('tslint/error', () => { - function testOutput(code: string, config: ClassicConfig.Config): void { - const linter = new TSESLint.Linter(); - linter.defineRule('tslint/config', rule); - linter.defineParser('@typescript-eslint/parser', parser); - - expect(() => linter.verify(code, config)).toThrow( - 'You have used a rule which requires parserServices to be generated. You must therefore provide a value for the "parserOptions.project" property for @typescript-eslint/parser.', - ); - } - - it('should error on missing project', () => { - testOutput('foo;', { - rules: { - 'tslint/config': [2, tslintRulesConfig], - }, - parser: '@typescript-eslint/parser', - }); - }); - - it('should error on default parser', () => { - testOutput('foo;', { - parserOptions: { - project: TEST_PROJECT_PATH, - }, - rules: { - 'tslint/config': [2, tslintRulesConfig], - }, - }); - }); - - it('should not crash if there are no tslint rules specified', () => { - const linter = new TSESLint.Linter(); - jest.spyOn(console, 'warn').mockImplementation(); - linter.defineRule('tslint/config', rule); - linter.defineParser('@typescript-eslint/parser', parser); - - const filePath = path.resolve( - __dirname, - 'fixtures', - 'test-project', - 'extra.ts', - ); - - expect(() => - linter.verify( - 'foo;', - { - parserOptions: { - project: TEST_PROJECT_PATH, - }, - rules: { - 'tslint/config': [2, {}], - }, - parser: '@typescript-eslint/parser', - }, - filePath, - ), - ).not.toThrow(); - - expect(console.warn).toHaveBeenCalledWith( - expect.stringContaining( - `Tried to lint ${filePath} but found no valid, enabled rules for this file type and file path in the resolved configuration.`, - ), - ); - jest.resetAllMocks(); - }); - }); -} diff --git a/packages/eslint-plugin-tslint/tsconfig.build.json b/packages/eslint-plugin-tslint/tsconfig.build.json deleted file mode 100644 index 86650784975c..000000000000 --- a/packages/eslint-plugin-tslint/tsconfig.build.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "extends": "../../tsconfig.base.json", - "compilerOptions": { - // specifically disable declarations for the plugin - // see reasoning in packages/eslint-plugin/rules.d.ts - "declaration": false, - "declarationMap": false, - "outDir": "./dist", - "rootDir": "./src", - "resolveJsonModule": true - }, - "include": ["src"], - "references": [{ "path": "../utils/tsconfig.build.json" }] -} diff --git a/packages/eslint-plugin-tslint/tsconfig.json b/packages/eslint-plugin-tslint/tsconfig.json deleted file mode 100644 index 4ba17c6d60ab..000000000000 --- a/packages/eslint-plugin-tslint/tsconfig.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "./tsconfig.build.json", - "compilerOptions": { - "composite": false, - "rootDir": "." - }, - "include": ["src", "tests"], - "exclude": ["tests/fixtures"], - "references": [{ "path": "../utils/tsconfig.build.json" }] -} diff --git a/packages/integration-tests/fixtures/typescript-and-tslint-plugins-together/.eslintrc.js b/packages/integration-tests/fixtures/typescript-and-tslint-plugins-together/.eslintrc.js deleted file mode 100644 index c86654dad2d5..000000000000 --- a/packages/integration-tests/fixtures/typescript-and-tslint-plugins-together/.eslintrc.js +++ /dev/null @@ -1,28 +0,0 @@ -module.exports = { - root: true, - parser: '@typescript-eslint/parser', - plugins: ['@typescript-eslint', '@typescript-eslint/tslint'], - env: { - es6: true, - node: true, - }, - extends: ['plugin:@typescript-eslint/recommended'], - parserOptions: { - sourceType: 'module', - ecmaFeatures: { - jsx: false, - }, - tsconfigRootDir: __dirname, - project: './tsconfig.json', - }, - rules: { - '@typescript-eslint/tslint/config': [ - 'error', - { - rules: { - semicolon: [true, 'always'], - }, - }, - ], - }, -}; diff --git a/packages/integration-tests/fixtures/typescript-and-tslint-plugins-together/index.ts b/packages/integration-tests/fixtures/typescript-and-tslint-plugins-together/index.ts deleted file mode 100644 index 8812117dbb25..000000000000 --- a/packages/integration-tests/fixtures/typescript-and-tslint-plugins-together/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// prettier-ignore -const noSemi = true diff --git a/packages/integration-tests/fixtures/typescript-and-tslint-plugins-together/package.json b/packages/integration-tests/fixtures/typescript-and-tslint-plugins-together/package.json deleted file mode 100644 index 576b100099e2..000000000000 --- a/packages/integration-tests/fixtures/typescript-and-tslint-plugins-together/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "devDependencies": { - "tslint": "*" - } -} diff --git a/packages/integration-tests/fixtures/typescript-and-tslint-plugins-together/tsconfig.json b/packages/integration-tests/fixtures/typescript-and-tslint-plugins-together/tsconfig.json deleted file mode 100644 index aee0ec940fcd..000000000000 --- a/packages/integration-tests/fixtures/typescript-and-tslint-plugins-together/tsconfig.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "compilerOptions": { - "strict": true - } -} diff --git a/packages/integration-tests/tools/integration-test-base.ts b/packages/integration-tests/tools/integration-test-base.ts index 121d89ebb5e7..6934dbb8b25b 100644 --- a/packages/integration-tests/tools/integration-test-base.ts +++ b/packages/integration-tests/tools/integration-test-base.ts @@ -72,10 +72,6 @@ function integrationTest( devDependencies: { ...BASE_DEPENDENCIES, ...fixturePackageJson.devDependencies, - // install tslint with the base version if required - tslint: fixturePackageJson.devDependencies.tslint - ? rootPackageJson.devDependencies.tslint - : undefined, }, // ensure everything uses the locally packed versions instead of the NPM versions resolutions: { diff --git a/yarn.lock b/yarn.lock index 6afbd6ed7411..2e7f081f757a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5425,23 +5425,6 @@ __metadata: languageName: unknown linkType: soft -"@typescript-eslint/eslint-plugin-tslint@workspace:packages/eslint-plugin-tslint": - version: 0.0.0-use.local - resolution: "@typescript-eslint/eslint-plugin-tslint@workspace:packages/eslint-plugin-tslint" - dependencies: - "@types/lodash": "*" - "@typescript-eslint/parser": 7.0.2 - "@typescript-eslint/utils": 7.0.2 - jest: 29.7.0 - prettier: ^3.0.3 - rimraf: "*" - peerDependencies: - eslint: ^8.56.0 - tslint: ^5.0.0 || ^6.0.0 - typescript: "*" - languageName: unknown - linkType: soft - "@typescript-eslint/eslint-plugin@7.0.2, @typescript-eslint/eslint-plugin@workspace:packages/eslint-plugin": version: 0.0.0-use.local resolution: "@typescript-eslint/eslint-plugin@workspace:packages/eslint-plugin" @@ -5721,7 +5704,6 @@ __metadata: rimraf: ^5.0.1 tmp: ^0.2.1 ts-node: 10.7.0 - tslint: ^6.1.3 tsx: ^4.6.2 typescript: ">=4.7.4 <5.4.0" typescript-eslint: "workspace:^" @@ -7102,13 +7084,6 @@ __metadata: languageName: node linkType: hard -"builtin-modules@npm:^1.1.1": - version: 1.1.1 - resolution: "builtin-modules@npm:1.1.1" - checksum: 0fbf69ffe77fecf11c441b9a7d1e664bb8119a7d3004831d9bd6ce0eacfd5d121ed4b667172870b5f66ecfce4bd54f7c20060d21c339c29049a7a5dd2bb7bf8c - languageName: node - linkType: hard - "builtin-modules@npm:^3.1.0, builtin-modules@npm:^3.3.0": version: 3.3.0 resolution: "builtin-modules@npm:3.3.0" @@ -7293,7 +7268,7 @@ __metadata: languageName: node linkType: hard -"chalk@npm:^2.3.0, chalk@npm:^2.4.2": +"chalk@npm:^2.4.2": version: 2.4.2 resolution: "chalk@npm:2.4.2" dependencies: @@ -7731,7 +7706,7 @@ __metadata: languageName: node linkType: hard -"commander@npm:^2.12.1, commander@npm:^2.20.0, commander@npm:^2.7.1": +"commander@npm:^2.20.0, commander@npm:^2.7.1": version: 2.20.3 resolution: "commander@npm:2.20.3" checksum: ab8c07884e42c3a8dbc5dd9592c606176c7eb5c1ca5ff274bcf907039b2c41de3626f684ea75ccf4d361ba004bbaff1f577d5384c155f3871e456bdf27becf9e @@ -10750,7 +10725,7 @@ __metadata: languageName: node linkType: hard -"glob@npm:^7.0.0, glob@npm:^7.1.1, glob@npm:^7.1.3, glob@npm:^7.1.4, glob@npm:^7.1.6": +"glob@npm:^7.0.0, glob@npm:^7.1.3, glob@npm:^7.1.4, glob@npm:^7.1.6": version: 7.2.3 resolution: "glob@npm:7.2.3" dependencies: @@ -14013,17 +13988,6 @@ __metadata: languageName: node linkType: hard -"mkdirp@npm:^0.5.3": - version: 0.5.5 - resolution: "mkdirp@npm:0.5.5" - dependencies: - minimist: ^1.2.5 - bin: - mkdirp: bin/cmd.js - checksum: 3bce20ea525f9477befe458ab85284b0b66c8dc3812f94155af07c827175948cdd8114852ac6c6d82009b13c1048c37f6d98743eb019651ee25c39acc8aabe7d - languageName: node - linkType: hard - "mkdirp@npm:^1.0.3": version: 1.0.4 resolution: "mkdirp@npm:1.0.4" @@ -16878,7 +16842,7 @@ __metadata: languageName: node linkType: hard -"semver@npm:2 || 3 || 4 || 5, semver@npm:^5.3.0, semver@npm:^5.4.1": +"semver@npm:2 || 3 || 4 || 5, semver@npm:^5.4.1": version: 5.7.2 resolution: "semver@npm:5.7.2" bin: @@ -18273,7 +18237,7 @@ __metadata: languageName: node linkType: hard -"tslib@npm:^1.13.0, tslib@npm:^1.8.1": +"tslib@npm:^1.8.1": version: 1.14.1 resolution: "tslib@npm:1.14.1" checksum: dbe628ef87f66691d5d2959b3e41b9ca0045c3ee3c7c7b906cc1e328b39f199bb1ad9e671c39025bd56122ac57dfbf7385a94843b1cc07c60a4db74795829acd @@ -18287,42 +18251,6 @@ __metadata: languageName: node linkType: hard -"tslint@npm:^6.1.3": - version: 6.1.3 - resolution: "tslint@npm:6.1.3" - dependencies: - "@babel/code-frame": ^7.0.0 - builtin-modules: ^1.1.1 - chalk: ^2.3.0 - commander: ^2.12.1 - diff: ^4.0.1 - glob: ^7.1.1 - js-yaml: ^3.13.1 - minimatch: ^3.0.4 - mkdirp: ^0.5.3 - resolve: ^1.3.2 - semver: ^5.3.0 - tslib: ^1.13.0 - tsutils: ^2.29.0 - peerDependencies: - typescript: ">=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev || >=2.8.0-dev || >=2.9.0-dev || >=3.0.0-dev || >= 3.1.0-dev || >= 3.2.0-dev || >= 4.0.0-dev" - bin: - tslint: bin/tslint - checksum: 7348b7abd6b8939f0b295c4dddbb104adfe2e96c9cc5be4a946a87a28df648bde61046cfb07951708938192f553eba6254f7729b85fd230efebbd72f7988255e - languageName: node - linkType: hard - -"tsutils@npm:^2.29.0": - version: 2.29.0 - resolution: "tsutils@npm:2.29.0" - dependencies: - tslib: ^1.8.1 - peerDependencies: - typescript: ">=2.1.0 || >=2.1.0-dev || >=2.2.0-dev || >=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev || >=2.8.0-dev || >=2.9.0-dev || >= 3.0.0-dev || >= 3.1.0-dev" - checksum: 5d681bab79979e3b4d61dd0d1e6c1dd6a79b5608cf8dec5a5ee599ac8b5921107870bcf037140b8dce85a479df78aee0ffa61c1b3d8e5660748af36551946616 - languageName: node - linkType: hard - "tsutils@npm:^3.21.0": version: 3.21.0 resolution: "tsutils@npm:3.21.0" From d3d7d65c0c544ca12053c7fdec8bedd9dfa77bc1 Mon Sep 17 00:00:00 2001 From: James Henry Date: Thu, 22 Feb 2024 10:55:52 +0400 Subject: [PATCH 12/35] chore: enable verbose logging in CI (#8529) --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4d4a1ee08b2e..a3f23abff0a4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,6 +17,8 @@ env: PRIMARY_NODE_VERSION: 20 # Only set the read-write token if we are on the main branch NX_CLOUD_ACCESS_TOKEN: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') && secrets.NX_CLOUD_ACCESS_TOKEN || '' }} + # This increases the verbosity of the logs for everything, including Nx Cloud, but will hopefully surface more info about recent lint failures + NX_VERBOSE_LOGGING: true defaults: run: From f825426a382aaf505897cde182f09d9405c0fe09 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Thu, 22 Feb 2024 09:28:28 -0500 Subject: [PATCH 13/35] test: remove remaining typescript-and-tslint-plugins-together vestiges --- ...t-and-tslint-plugins-together.test.ts.snap | 32 ------------------- ...script-and-tslint-plugins-together.test.ts | 3 -- 2 files changed, 35 deletions(-) delete mode 100644 packages/integration-tests/tests/__snapshots__/typescript-and-tslint-plugins-together.test.ts.snap delete mode 100644 packages/integration-tests/tests/typescript-and-tslint-plugins-together.test.ts diff --git a/packages/integration-tests/tests/__snapshots__/typescript-and-tslint-plugins-together.test.ts.snap b/packages/integration-tests/tests/__snapshots__/typescript-and-tslint-plugins-together.test.ts.snap deleted file mode 100644 index d79b8458b4e5..000000000000 --- a/packages/integration-tests/tests/__snapshots__/typescript-and-tslint-plugins-together.test.ts.snap +++ /dev/null @@ -1,32 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`typescript-and-tslint-plugins-together eslint should work successfully 1`] = ` -[ - { - "errorCount": 1, - "fatalErrorCount": 0, - "filePath": "/index.ts", - "fixableErrorCount": 0, - "fixableWarningCount": 0, - "messages": [ - { - "column": 7, - "endColumn": 13, - "endLine": 2, - "line": 2, - "message": "'noSemi' is assigned a value but never used.", - "messageId": "unusedVar", - "nodeType": "Identifier", - "ruleId": "@typescript-eslint/no-unused-vars", - "severity": 2, - }, - ], - "output": "// prettier-ignore -const noSemi = true; -", - "suppressedMessages": [], - "usedDeprecatedRules": [], - "warningCount": 0, - }, -] -`; diff --git a/packages/integration-tests/tests/typescript-and-tslint-plugins-together.test.ts b/packages/integration-tests/tests/typescript-and-tslint-plugins-together.test.ts deleted file mode 100644 index fe0b175c3f8e..000000000000 --- a/packages/integration-tests/tests/typescript-and-tslint-plugins-together.test.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { eslintIntegrationTest } from '../tools/integration-test-base'; - -eslintIntegrationTest(__filename, '*.ts'); From d3e921aa718399652000c6efb84867f2dccbe884 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 22 Feb 2024 14:13:16 -0500 Subject: [PATCH 14/35] chore(deps): update dependency esbuild to v0.20.1 (#8531) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- yarn.lock | 384 +++++++++++++++++++++++++++--------------------------- 1 file changed, 192 insertions(+), 192 deletions(-) diff --git a/yarn.lock b/yarn.lock index 2e7f081f757a..55ab3707645d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2940,324 +2940,324 @@ __metadata: languageName: node linkType: hard -"@esbuild/aix-ppc64@npm:0.19.11": - version: 0.19.11 - resolution: "@esbuild/aix-ppc64@npm:0.19.11" +"@esbuild/aix-ppc64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/aix-ppc64@npm:0.19.12" conditions: os=aix & cpu=ppc64 languageName: node linkType: hard -"@esbuild/aix-ppc64@npm:0.20.0": - version: 0.20.0 - resolution: "@esbuild/aix-ppc64@npm:0.20.0" +"@esbuild/aix-ppc64@npm:0.20.1": + version: 0.20.1 + resolution: "@esbuild/aix-ppc64@npm:0.20.1" conditions: os=aix & cpu=ppc64 languageName: node linkType: hard -"@esbuild/android-arm64@npm:0.19.11": - version: 0.19.11 - resolution: "@esbuild/android-arm64@npm:0.19.11" +"@esbuild/android-arm64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/android-arm64@npm:0.19.12" conditions: os=android & cpu=arm64 languageName: node linkType: hard -"@esbuild/android-arm64@npm:0.20.0": - version: 0.20.0 - resolution: "@esbuild/android-arm64@npm:0.20.0" +"@esbuild/android-arm64@npm:0.20.1": + version: 0.20.1 + resolution: "@esbuild/android-arm64@npm:0.20.1" conditions: os=android & cpu=arm64 languageName: node linkType: hard -"@esbuild/android-arm@npm:0.19.11": - version: 0.19.11 - resolution: "@esbuild/android-arm@npm:0.19.11" +"@esbuild/android-arm@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/android-arm@npm:0.19.12" conditions: os=android & cpu=arm languageName: node linkType: hard -"@esbuild/android-arm@npm:0.20.0": - version: 0.20.0 - resolution: "@esbuild/android-arm@npm:0.20.0" +"@esbuild/android-arm@npm:0.20.1": + version: 0.20.1 + resolution: "@esbuild/android-arm@npm:0.20.1" conditions: os=android & cpu=arm languageName: node linkType: hard -"@esbuild/android-x64@npm:0.19.11": - version: 0.19.11 - resolution: "@esbuild/android-x64@npm:0.19.11" +"@esbuild/android-x64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/android-x64@npm:0.19.12" conditions: os=android & cpu=x64 languageName: node linkType: hard -"@esbuild/android-x64@npm:0.20.0": - version: 0.20.0 - resolution: "@esbuild/android-x64@npm:0.20.0" +"@esbuild/android-x64@npm:0.20.1": + version: 0.20.1 + resolution: "@esbuild/android-x64@npm:0.20.1" conditions: os=android & cpu=x64 languageName: node linkType: hard -"@esbuild/darwin-arm64@npm:0.19.11": - version: 0.19.11 - resolution: "@esbuild/darwin-arm64@npm:0.19.11" +"@esbuild/darwin-arm64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/darwin-arm64@npm:0.19.12" conditions: os=darwin & cpu=arm64 languageName: node linkType: hard -"@esbuild/darwin-arm64@npm:0.20.0": - version: 0.20.0 - resolution: "@esbuild/darwin-arm64@npm:0.20.0" +"@esbuild/darwin-arm64@npm:0.20.1": + version: 0.20.1 + resolution: "@esbuild/darwin-arm64@npm:0.20.1" conditions: os=darwin & cpu=arm64 languageName: node linkType: hard -"@esbuild/darwin-x64@npm:0.19.11": - version: 0.19.11 - resolution: "@esbuild/darwin-x64@npm:0.19.11" +"@esbuild/darwin-x64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/darwin-x64@npm:0.19.12" conditions: os=darwin & cpu=x64 languageName: node linkType: hard -"@esbuild/darwin-x64@npm:0.20.0": - version: 0.20.0 - resolution: "@esbuild/darwin-x64@npm:0.20.0" +"@esbuild/darwin-x64@npm:0.20.1": + version: 0.20.1 + resolution: "@esbuild/darwin-x64@npm:0.20.1" conditions: os=darwin & cpu=x64 languageName: node linkType: hard -"@esbuild/freebsd-arm64@npm:0.19.11": - version: 0.19.11 - resolution: "@esbuild/freebsd-arm64@npm:0.19.11" +"@esbuild/freebsd-arm64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/freebsd-arm64@npm:0.19.12" conditions: os=freebsd & cpu=arm64 languageName: node linkType: hard -"@esbuild/freebsd-arm64@npm:0.20.0": - version: 0.20.0 - resolution: "@esbuild/freebsd-arm64@npm:0.20.0" +"@esbuild/freebsd-arm64@npm:0.20.1": + version: 0.20.1 + resolution: "@esbuild/freebsd-arm64@npm:0.20.1" conditions: os=freebsd & cpu=arm64 languageName: node linkType: hard -"@esbuild/freebsd-x64@npm:0.19.11": - version: 0.19.11 - resolution: "@esbuild/freebsd-x64@npm:0.19.11" +"@esbuild/freebsd-x64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/freebsd-x64@npm:0.19.12" conditions: os=freebsd & cpu=x64 languageName: node linkType: hard -"@esbuild/freebsd-x64@npm:0.20.0": - version: 0.20.0 - resolution: "@esbuild/freebsd-x64@npm:0.20.0" +"@esbuild/freebsd-x64@npm:0.20.1": + version: 0.20.1 + resolution: "@esbuild/freebsd-x64@npm:0.20.1" conditions: os=freebsd & cpu=x64 languageName: node linkType: hard -"@esbuild/linux-arm64@npm:0.19.11": - version: 0.19.11 - resolution: "@esbuild/linux-arm64@npm:0.19.11" +"@esbuild/linux-arm64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/linux-arm64@npm:0.19.12" conditions: os=linux & cpu=arm64 languageName: node linkType: hard -"@esbuild/linux-arm64@npm:0.20.0": - version: 0.20.0 - resolution: "@esbuild/linux-arm64@npm:0.20.0" +"@esbuild/linux-arm64@npm:0.20.1": + version: 0.20.1 + resolution: "@esbuild/linux-arm64@npm:0.20.1" conditions: os=linux & cpu=arm64 languageName: node linkType: hard -"@esbuild/linux-arm@npm:0.19.11": - version: 0.19.11 - resolution: "@esbuild/linux-arm@npm:0.19.11" +"@esbuild/linux-arm@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/linux-arm@npm:0.19.12" conditions: os=linux & cpu=arm languageName: node linkType: hard -"@esbuild/linux-arm@npm:0.20.0": - version: 0.20.0 - resolution: "@esbuild/linux-arm@npm:0.20.0" +"@esbuild/linux-arm@npm:0.20.1": + version: 0.20.1 + resolution: "@esbuild/linux-arm@npm:0.20.1" conditions: os=linux & cpu=arm languageName: node linkType: hard -"@esbuild/linux-ia32@npm:0.19.11": - version: 0.19.11 - resolution: "@esbuild/linux-ia32@npm:0.19.11" +"@esbuild/linux-ia32@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/linux-ia32@npm:0.19.12" conditions: os=linux & cpu=ia32 languageName: node linkType: hard -"@esbuild/linux-ia32@npm:0.20.0": - version: 0.20.0 - resolution: "@esbuild/linux-ia32@npm:0.20.0" +"@esbuild/linux-ia32@npm:0.20.1": + version: 0.20.1 + resolution: "@esbuild/linux-ia32@npm:0.20.1" conditions: os=linux & cpu=ia32 languageName: node linkType: hard -"@esbuild/linux-loong64@npm:0.19.11": - version: 0.19.11 - resolution: "@esbuild/linux-loong64@npm:0.19.11" +"@esbuild/linux-loong64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/linux-loong64@npm:0.19.12" conditions: os=linux & cpu=loong64 languageName: node linkType: hard -"@esbuild/linux-loong64@npm:0.20.0": - version: 0.20.0 - resolution: "@esbuild/linux-loong64@npm:0.20.0" +"@esbuild/linux-loong64@npm:0.20.1": + version: 0.20.1 + resolution: "@esbuild/linux-loong64@npm:0.20.1" conditions: os=linux & cpu=loong64 languageName: node linkType: hard -"@esbuild/linux-mips64el@npm:0.19.11": - version: 0.19.11 - resolution: "@esbuild/linux-mips64el@npm:0.19.11" +"@esbuild/linux-mips64el@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/linux-mips64el@npm:0.19.12" conditions: os=linux & cpu=mips64el languageName: node linkType: hard -"@esbuild/linux-mips64el@npm:0.20.0": - version: 0.20.0 - resolution: "@esbuild/linux-mips64el@npm:0.20.0" +"@esbuild/linux-mips64el@npm:0.20.1": + version: 0.20.1 + resolution: "@esbuild/linux-mips64el@npm:0.20.1" conditions: os=linux & cpu=mips64el languageName: node linkType: hard -"@esbuild/linux-ppc64@npm:0.19.11": - version: 0.19.11 - resolution: "@esbuild/linux-ppc64@npm:0.19.11" +"@esbuild/linux-ppc64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/linux-ppc64@npm:0.19.12" conditions: os=linux & cpu=ppc64 languageName: node linkType: hard -"@esbuild/linux-ppc64@npm:0.20.0": - version: 0.20.0 - resolution: "@esbuild/linux-ppc64@npm:0.20.0" +"@esbuild/linux-ppc64@npm:0.20.1": + version: 0.20.1 + resolution: "@esbuild/linux-ppc64@npm:0.20.1" conditions: os=linux & cpu=ppc64 languageName: node linkType: hard -"@esbuild/linux-riscv64@npm:0.19.11": - version: 0.19.11 - resolution: "@esbuild/linux-riscv64@npm:0.19.11" +"@esbuild/linux-riscv64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/linux-riscv64@npm:0.19.12" conditions: os=linux & cpu=riscv64 languageName: node linkType: hard -"@esbuild/linux-riscv64@npm:0.20.0": - version: 0.20.0 - resolution: "@esbuild/linux-riscv64@npm:0.20.0" +"@esbuild/linux-riscv64@npm:0.20.1": + version: 0.20.1 + resolution: "@esbuild/linux-riscv64@npm:0.20.1" conditions: os=linux & cpu=riscv64 languageName: node linkType: hard -"@esbuild/linux-s390x@npm:0.19.11": - version: 0.19.11 - resolution: "@esbuild/linux-s390x@npm:0.19.11" +"@esbuild/linux-s390x@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/linux-s390x@npm:0.19.12" conditions: os=linux & cpu=s390x languageName: node linkType: hard -"@esbuild/linux-s390x@npm:0.20.0": - version: 0.20.0 - resolution: "@esbuild/linux-s390x@npm:0.20.0" +"@esbuild/linux-s390x@npm:0.20.1": + version: 0.20.1 + resolution: "@esbuild/linux-s390x@npm:0.20.1" conditions: os=linux & cpu=s390x languageName: node linkType: hard -"@esbuild/linux-x64@npm:0.19.11": - version: 0.19.11 - resolution: "@esbuild/linux-x64@npm:0.19.11" +"@esbuild/linux-x64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/linux-x64@npm:0.19.12" conditions: os=linux & cpu=x64 languageName: node linkType: hard -"@esbuild/linux-x64@npm:0.20.0": - version: 0.20.0 - resolution: "@esbuild/linux-x64@npm:0.20.0" +"@esbuild/linux-x64@npm:0.20.1": + version: 0.20.1 + resolution: "@esbuild/linux-x64@npm:0.20.1" conditions: os=linux & cpu=x64 languageName: node linkType: hard -"@esbuild/netbsd-x64@npm:0.19.11": - version: 0.19.11 - resolution: "@esbuild/netbsd-x64@npm:0.19.11" +"@esbuild/netbsd-x64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/netbsd-x64@npm:0.19.12" conditions: os=netbsd & cpu=x64 languageName: node linkType: hard -"@esbuild/netbsd-x64@npm:0.20.0": - version: 0.20.0 - resolution: "@esbuild/netbsd-x64@npm:0.20.0" +"@esbuild/netbsd-x64@npm:0.20.1": + version: 0.20.1 + resolution: "@esbuild/netbsd-x64@npm:0.20.1" conditions: os=netbsd & cpu=x64 languageName: node linkType: hard -"@esbuild/openbsd-x64@npm:0.19.11": - version: 0.19.11 - resolution: "@esbuild/openbsd-x64@npm:0.19.11" +"@esbuild/openbsd-x64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/openbsd-x64@npm:0.19.12" conditions: os=openbsd & cpu=x64 languageName: node linkType: hard -"@esbuild/openbsd-x64@npm:0.20.0": - version: 0.20.0 - resolution: "@esbuild/openbsd-x64@npm:0.20.0" +"@esbuild/openbsd-x64@npm:0.20.1": + version: 0.20.1 + resolution: "@esbuild/openbsd-x64@npm:0.20.1" conditions: os=openbsd & cpu=x64 languageName: node linkType: hard -"@esbuild/sunos-x64@npm:0.19.11": - version: 0.19.11 - resolution: "@esbuild/sunos-x64@npm:0.19.11" +"@esbuild/sunos-x64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/sunos-x64@npm:0.19.12" conditions: os=sunos & cpu=x64 languageName: node linkType: hard -"@esbuild/sunos-x64@npm:0.20.0": - version: 0.20.0 - resolution: "@esbuild/sunos-x64@npm:0.20.0" +"@esbuild/sunos-x64@npm:0.20.1": + version: 0.20.1 + resolution: "@esbuild/sunos-x64@npm:0.20.1" conditions: os=sunos & cpu=x64 languageName: node linkType: hard -"@esbuild/win32-arm64@npm:0.19.11": - version: 0.19.11 - resolution: "@esbuild/win32-arm64@npm:0.19.11" +"@esbuild/win32-arm64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/win32-arm64@npm:0.19.12" conditions: os=win32 & cpu=arm64 languageName: node linkType: hard -"@esbuild/win32-arm64@npm:0.20.0": - version: 0.20.0 - resolution: "@esbuild/win32-arm64@npm:0.20.0" +"@esbuild/win32-arm64@npm:0.20.1": + version: 0.20.1 + resolution: "@esbuild/win32-arm64@npm:0.20.1" conditions: os=win32 & cpu=arm64 languageName: node linkType: hard -"@esbuild/win32-ia32@npm:0.19.11": - version: 0.19.11 - resolution: "@esbuild/win32-ia32@npm:0.19.11" +"@esbuild/win32-ia32@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/win32-ia32@npm:0.19.12" conditions: os=win32 & cpu=ia32 languageName: node linkType: hard -"@esbuild/win32-ia32@npm:0.20.0": - version: 0.20.0 - resolution: "@esbuild/win32-ia32@npm:0.20.0" +"@esbuild/win32-ia32@npm:0.20.1": + version: 0.20.1 + resolution: "@esbuild/win32-ia32@npm:0.20.1" conditions: os=win32 & cpu=ia32 languageName: node linkType: hard -"@esbuild/win32-x64@npm:0.19.11": - version: 0.19.11 - resolution: "@esbuild/win32-x64@npm:0.19.11" +"@esbuild/win32-x64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/win32-x64@npm:0.19.12" conditions: os=win32 & cpu=x64 languageName: node linkType: hard -"@esbuild/win32-x64@npm:0.20.0": - version: 0.20.0 - resolution: "@esbuild/win32-x64@npm:0.20.0" +"@esbuild/win32-x64@npm:0.20.1": + version: 0.20.1 + resolution: "@esbuild/win32-x64@npm:0.20.1" conditions: os=win32 & cpu=x64 languageName: node linkType: hard @@ -9225,32 +9225,32 @@ __metadata: linkType: hard "esbuild@npm:~0.19.10": - version: 0.19.11 - resolution: "esbuild@npm:0.19.11" - dependencies: - "@esbuild/aix-ppc64": 0.19.11 - "@esbuild/android-arm": 0.19.11 - "@esbuild/android-arm64": 0.19.11 - "@esbuild/android-x64": 0.19.11 - "@esbuild/darwin-arm64": 0.19.11 - "@esbuild/darwin-x64": 0.19.11 - "@esbuild/freebsd-arm64": 0.19.11 - "@esbuild/freebsd-x64": 0.19.11 - "@esbuild/linux-arm": 0.19.11 - "@esbuild/linux-arm64": 0.19.11 - "@esbuild/linux-ia32": 0.19.11 - "@esbuild/linux-loong64": 0.19.11 - "@esbuild/linux-mips64el": 0.19.11 - "@esbuild/linux-ppc64": 0.19.11 - "@esbuild/linux-riscv64": 0.19.11 - "@esbuild/linux-s390x": 0.19.11 - "@esbuild/linux-x64": 0.19.11 - "@esbuild/netbsd-x64": 0.19.11 - "@esbuild/openbsd-x64": 0.19.11 - "@esbuild/sunos-x64": 0.19.11 - "@esbuild/win32-arm64": 0.19.11 - "@esbuild/win32-ia32": 0.19.11 - "@esbuild/win32-x64": 0.19.11 + version: 0.19.12 + resolution: "esbuild@npm:0.19.12" + dependencies: + "@esbuild/aix-ppc64": 0.19.12 + "@esbuild/android-arm": 0.19.12 + "@esbuild/android-arm64": 0.19.12 + "@esbuild/android-x64": 0.19.12 + "@esbuild/darwin-arm64": 0.19.12 + "@esbuild/darwin-x64": 0.19.12 + "@esbuild/freebsd-arm64": 0.19.12 + "@esbuild/freebsd-x64": 0.19.12 + "@esbuild/linux-arm": 0.19.12 + "@esbuild/linux-arm64": 0.19.12 + "@esbuild/linux-ia32": 0.19.12 + "@esbuild/linux-loong64": 0.19.12 + "@esbuild/linux-mips64el": 0.19.12 + "@esbuild/linux-ppc64": 0.19.12 + "@esbuild/linux-riscv64": 0.19.12 + "@esbuild/linux-s390x": 0.19.12 + "@esbuild/linux-x64": 0.19.12 + "@esbuild/netbsd-x64": 0.19.12 + "@esbuild/openbsd-x64": 0.19.12 + "@esbuild/sunos-x64": 0.19.12 + "@esbuild/win32-arm64": 0.19.12 + "@esbuild/win32-ia32": 0.19.12 + "@esbuild/win32-x64": 0.19.12 dependenciesMeta: "@esbuild/aix-ppc64": optional: true @@ -9300,37 +9300,37 @@ __metadata: optional: true bin: esbuild: bin/esbuild - checksum: ae949a796d1d06b55275ae7491ce137857468f69a93d8cc9c0943d2a701ac54e14dbb250a2ba56f2ad98283669578f1ec3bd85a4681910a5ff29a2470c3bd62c + checksum: 2936e29107b43e65a775b78b7bc66ddd7d76febd73840ac7e825fb22b65029422ff51038a08d19b05154f543584bd3afe7d1ef1c63900429475b17fbe61cb61f languageName: node linkType: hard "esbuild@npm:~0.20.0": - version: 0.20.0 - resolution: "esbuild@npm:0.20.0" - dependencies: - "@esbuild/aix-ppc64": 0.20.0 - "@esbuild/android-arm": 0.20.0 - "@esbuild/android-arm64": 0.20.0 - "@esbuild/android-x64": 0.20.0 - "@esbuild/darwin-arm64": 0.20.0 - "@esbuild/darwin-x64": 0.20.0 - "@esbuild/freebsd-arm64": 0.20.0 - "@esbuild/freebsd-x64": 0.20.0 - "@esbuild/linux-arm": 0.20.0 - "@esbuild/linux-arm64": 0.20.0 - "@esbuild/linux-ia32": 0.20.0 - "@esbuild/linux-loong64": 0.20.0 - "@esbuild/linux-mips64el": 0.20.0 - "@esbuild/linux-ppc64": 0.20.0 - "@esbuild/linux-riscv64": 0.20.0 - "@esbuild/linux-s390x": 0.20.0 - "@esbuild/linux-x64": 0.20.0 - "@esbuild/netbsd-x64": 0.20.0 - "@esbuild/openbsd-x64": 0.20.0 - "@esbuild/sunos-x64": 0.20.0 - "@esbuild/win32-arm64": 0.20.0 - "@esbuild/win32-ia32": 0.20.0 - "@esbuild/win32-x64": 0.20.0 + version: 0.20.1 + resolution: "esbuild@npm:0.20.1" + dependencies: + "@esbuild/aix-ppc64": 0.20.1 + "@esbuild/android-arm": 0.20.1 + "@esbuild/android-arm64": 0.20.1 + "@esbuild/android-x64": 0.20.1 + "@esbuild/darwin-arm64": 0.20.1 + "@esbuild/darwin-x64": 0.20.1 + "@esbuild/freebsd-arm64": 0.20.1 + "@esbuild/freebsd-x64": 0.20.1 + "@esbuild/linux-arm": 0.20.1 + "@esbuild/linux-arm64": 0.20.1 + "@esbuild/linux-ia32": 0.20.1 + "@esbuild/linux-loong64": 0.20.1 + "@esbuild/linux-mips64el": 0.20.1 + "@esbuild/linux-ppc64": 0.20.1 + "@esbuild/linux-riscv64": 0.20.1 + "@esbuild/linux-s390x": 0.20.1 + "@esbuild/linux-x64": 0.20.1 + "@esbuild/netbsd-x64": 0.20.1 + "@esbuild/openbsd-x64": 0.20.1 + "@esbuild/sunos-x64": 0.20.1 + "@esbuild/win32-arm64": 0.20.1 + "@esbuild/win32-ia32": 0.20.1 + "@esbuild/win32-x64": 0.20.1 dependenciesMeta: "@esbuild/aix-ppc64": optional: true @@ -9380,7 +9380,7 @@ __metadata: optional: true bin: esbuild: bin/esbuild - checksum: 501b0f540ab68b3843cb9b1be7efa2d90353c8743e99e84931baa1ef5fe1b87934e29becb23cc635a8af45fab223875efa62200589e18d796f0881a655cb9c07 + checksum: af8b3c79e48d303501cac8551bf1ac5ebf5d86eebf2d1eb9d2a7018f4c5506bb120ed2454a013e3387e499de780a916bbffc9edd4ef132be403cd39771ace045 languageName: node linkType: hard From d2c6b4ebe27f77d61c481d7ccbe74f2dc97fbf94 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 22 Feb 2024 14:13:36 -0500 Subject: [PATCH 15/35] chore(deps): update dependency webpack to v5.90.3 (#8533) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 55ab3707645d..b381bfaaeb18 100644 --- a/yarn.lock +++ b/yarn.lock @@ -19151,8 +19151,8 @@ __metadata: linkType: hard "webpack@npm:^5.73.0, webpack@npm:^5.88.1": - version: 5.90.2 - resolution: "webpack@npm:5.90.2" + version: 5.90.3 + resolution: "webpack@npm:5.90.3" dependencies: "@types/eslint-scope": ^3.7.3 "@types/estree": ^1.0.5 @@ -19183,7 +19183,7 @@ __metadata: optional: true bin: webpack: bin/webpack.js - checksum: 4af55f314c3610e0b17afd01960c4cf9d8d90c87a58ef7d7dc7a0a019f48e2bba4eff63b02d9da56fc61df5b04af0d66b3fa4ec82937a780d37a64db84c643fe + checksum: de0c824ac220f41cc1153ac33e081d46260b104c4f2fda26f011cdf7a73f74cc091f288cb1fc16f88a36e35bac44e0aa85fc9922fdf3109dfb361f46b20f3fcc languageName: node linkType: hard From b17c45394147a62e56055bd9c45ededac2f0900f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 22 Feb 2024 14:13:56 -0500 Subject: [PATCH 16/35] chore(deps): update dependency @swc/core to v1.4.2 (#8530) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- yarn.lock | 88 +++++++++++++++++++++++++++---------------------------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/yarn.lock b/yarn.lock index b381bfaaeb18..8c8bd25e6fa1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4615,90 +4615,90 @@ __metadata: languageName: node linkType: hard -"@swc/core-darwin-arm64@npm:1.4.1": - version: 1.4.1 - resolution: "@swc/core-darwin-arm64@npm:1.4.1" +"@swc/core-darwin-arm64@npm:1.4.2": + version: 1.4.2 + resolution: "@swc/core-darwin-arm64@npm:1.4.2" conditions: os=darwin & cpu=arm64 languageName: node linkType: hard -"@swc/core-darwin-x64@npm:1.4.1": - version: 1.4.1 - resolution: "@swc/core-darwin-x64@npm:1.4.1" +"@swc/core-darwin-x64@npm:1.4.2": + version: 1.4.2 + resolution: "@swc/core-darwin-x64@npm:1.4.2" conditions: os=darwin & cpu=x64 languageName: node linkType: hard -"@swc/core-linux-arm-gnueabihf@npm:1.4.1": - version: 1.4.1 - resolution: "@swc/core-linux-arm-gnueabihf@npm:1.4.1" +"@swc/core-linux-arm-gnueabihf@npm:1.4.2": + version: 1.4.2 + resolution: "@swc/core-linux-arm-gnueabihf@npm:1.4.2" conditions: os=linux & cpu=arm languageName: node linkType: hard -"@swc/core-linux-arm64-gnu@npm:1.4.1": - version: 1.4.1 - resolution: "@swc/core-linux-arm64-gnu@npm:1.4.1" +"@swc/core-linux-arm64-gnu@npm:1.4.2": + version: 1.4.2 + resolution: "@swc/core-linux-arm64-gnu@npm:1.4.2" conditions: os=linux & cpu=arm64 & libc=glibc languageName: node linkType: hard -"@swc/core-linux-arm64-musl@npm:1.4.1": - version: 1.4.1 - resolution: "@swc/core-linux-arm64-musl@npm:1.4.1" +"@swc/core-linux-arm64-musl@npm:1.4.2": + version: 1.4.2 + resolution: "@swc/core-linux-arm64-musl@npm:1.4.2" conditions: os=linux & cpu=arm64 & libc=musl languageName: node linkType: hard -"@swc/core-linux-x64-gnu@npm:1.4.1": - version: 1.4.1 - resolution: "@swc/core-linux-x64-gnu@npm:1.4.1" +"@swc/core-linux-x64-gnu@npm:1.4.2": + version: 1.4.2 + resolution: "@swc/core-linux-x64-gnu@npm:1.4.2" conditions: os=linux & cpu=x64 & libc=glibc languageName: node linkType: hard -"@swc/core-linux-x64-musl@npm:1.4.1": - version: 1.4.1 - resolution: "@swc/core-linux-x64-musl@npm:1.4.1" +"@swc/core-linux-x64-musl@npm:1.4.2": + version: 1.4.2 + resolution: "@swc/core-linux-x64-musl@npm:1.4.2" conditions: os=linux & cpu=x64 & libc=musl languageName: node linkType: hard -"@swc/core-win32-arm64-msvc@npm:1.4.1": - version: 1.4.1 - resolution: "@swc/core-win32-arm64-msvc@npm:1.4.1" +"@swc/core-win32-arm64-msvc@npm:1.4.2": + version: 1.4.2 + resolution: "@swc/core-win32-arm64-msvc@npm:1.4.2" conditions: os=win32 & cpu=arm64 languageName: node linkType: hard -"@swc/core-win32-ia32-msvc@npm:1.4.1": - version: 1.4.1 - resolution: "@swc/core-win32-ia32-msvc@npm:1.4.1" +"@swc/core-win32-ia32-msvc@npm:1.4.2": + version: 1.4.2 + resolution: "@swc/core-win32-ia32-msvc@npm:1.4.2" conditions: os=win32 & cpu=ia32 languageName: node linkType: hard -"@swc/core-win32-x64-msvc@npm:1.4.1": - version: 1.4.1 - resolution: "@swc/core-win32-x64-msvc@npm:1.4.1" +"@swc/core-win32-x64-msvc@npm:1.4.2": + version: 1.4.2 + resolution: "@swc/core-win32-x64-msvc@npm:1.4.2" conditions: os=win32 & cpu=x64 languageName: node linkType: hard "@swc/core@npm:^1.4.0": - version: 1.4.1 - resolution: "@swc/core@npm:1.4.1" - dependencies: - "@swc/core-darwin-arm64": 1.4.1 - "@swc/core-darwin-x64": 1.4.1 - "@swc/core-linux-arm-gnueabihf": 1.4.1 - "@swc/core-linux-arm64-gnu": 1.4.1 - "@swc/core-linux-arm64-musl": 1.4.1 - "@swc/core-linux-x64-gnu": 1.4.1 - "@swc/core-linux-x64-musl": 1.4.1 - "@swc/core-win32-arm64-msvc": 1.4.1 - "@swc/core-win32-ia32-msvc": 1.4.1 - "@swc/core-win32-x64-msvc": 1.4.1 + version: 1.4.2 + resolution: "@swc/core@npm:1.4.2" + dependencies: + "@swc/core-darwin-arm64": 1.4.2 + "@swc/core-darwin-x64": 1.4.2 + "@swc/core-linux-arm-gnueabihf": 1.4.2 + "@swc/core-linux-arm64-gnu": 1.4.2 + "@swc/core-linux-arm64-musl": 1.4.2 + "@swc/core-linux-x64-gnu": 1.4.2 + "@swc/core-linux-x64-musl": 1.4.2 + "@swc/core-win32-arm64-msvc": 1.4.2 + "@swc/core-win32-ia32-msvc": 1.4.2 + "@swc/core-win32-x64-msvc": 1.4.2 "@swc/counter": ^0.1.2 "@swc/types": ^0.1.5 peerDependencies: @@ -4727,7 +4727,7 @@ __metadata: peerDependenciesMeta: "@swc/helpers": optional: true - checksum: 3549b4a0ba8201be2dd39954ef8375df5d028da5688a68211dc5cbf69ff7a43533e9ffd36f629095f51555552f4df52116384ef779d5ec45c2b9de938e651d57 + checksum: b17afda692b2627d3a82e589f1b29cef31bdee626a2dd997d78312dcbfc6eb701850fbab22e85f02b1261da39f0b0afb6a236c6065f6d0d7478cff939ca5a888 languageName: node linkType: hard From 813ad93b85ba66246cd7e17ac1aa1b5785a5d206 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josh=20Goldberg=20=E2=9C=A8?= Date: Thu, 22 Feb 2024 16:37:10 -0500 Subject: [PATCH 17/35] chore: enable unused-vars caughtErrors: all internally (#8369) --- eslint.config.mjs | 8 ++++++-- packages/website/src/hooks/useMediaQuery.ts | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 8aab7daa4a56..2c4bedd9b359 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -158,7 +158,11 @@ export default tseslint.config( ], '@typescript-eslint/no-unused-vars': [ 'error', - { varsIgnorePattern: '^_', argsIgnorePattern: '^_' }, + { + caughtErrors: 'all', + varsIgnorePattern: '^_', + argsIgnorePattern: '^_', + }, ], '@typescript-eslint/prefer-nullish-coalescing': [ 'error', @@ -472,7 +476,7 @@ export default tseslint.config( files: ['packages/ast-spec/src/**/*.{ts,tsx,cts,mts}'], rules: { // disallow ALL unused vars - '@typescript-eslint/no-unused-vars': 'error', + '@typescript-eslint/no-unused-vars': ['error', { caughtErrors: 'all' }], '@typescript-eslint/sort-type-constituents': 'error', }, }, diff --git a/packages/website/src/hooks/useMediaQuery.ts b/packages/website/src/hooks/useMediaQuery.ts index 1bd928c4a4b2..a092478ac882 100644 --- a/packages/website/src/hooks/useMediaQuery.ts +++ b/packages/website/src/hooks/useMediaQuery.ts @@ -22,7 +22,7 @@ const useMediaQuery = (mediaQuery: string): boolean => { try { mediaQueryList.addEventListener('change', documentChangeHandler); - } catch (e) { + } catch { // Safari isn't supporting mediaQueryList.addEventListener // eslint-disable-next-line deprecation/deprecation mediaQueryList.addListener(documentChangeHandler); @@ -32,7 +32,7 @@ const useMediaQuery = (mediaQuery: string): boolean => { return () => { try { mediaQueryList.removeEventListener('change', documentChangeHandler); - } catch (e) { + } catch { // Safari isn't supporting mediaQueryList.removeEventListener // eslint-disable-next-line deprecation/deprecation mediaQueryList.removeListener(documentChangeHandler); From 13429ccabf4357c3b7e252f574d8f775f347a747 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josh=20Goldberg=20=E2=9C=A8?= Date: Thu, 22 Feb 2024 17:05:04 -0500 Subject: [PATCH 18/35] feat(eslint-plugin): add *-type-checked-only configs (#8367) --- docs/users/Shared_Configurations.mdx | 39 ++++++++++++ .../configs/recommended-type-checked-only.ts | 35 +++++++++++ .../src/configs/strict-type-checked-only.ts | 50 ++++++++++++++++ .../configs/stylistic-type-checked-only.ts | 20 +++++++ packages/repo-tools/src/generate-configs.mts | 28 ++++++++- .../configs/recommended-type-checked-only.ts | 44 ++++++++++++++ .../src/configs/strict-type-checked-only.ts | 59 +++++++++++++++++++ .../configs/stylistic-type-checked-only.ts | 29 +++++++++ 8 files changed, 302 insertions(+), 2 deletions(-) create mode 100644 packages/eslint-plugin/src/configs/recommended-type-checked-only.ts create mode 100644 packages/eslint-plugin/src/configs/strict-type-checked-only.ts create mode 100644 packages/eslint-plugin/src/configs/stylistic-type-checked-only.ts create mode 100644 packages/typescript-eslint/src/configs/recommended-type-checked-only.ts create mode 100644 packages/typescript-eslint/src/configs/strict-type-checked-only.ts create mode 100644 packages/typescript-eslint/src/configs/stylistic-type-checked-only.ts diff --git a/docs/users/Shared_Configurations.mdx b/docs/users/Shared_Configurations.mdx index 03cb635d0cb8..2436464a09e5 100644 --- a/docs/users/Shared_Configurations.mdx +++ b/docs/users/Shared_Configurations.mdx @@ -390,6 +390,45 @@ This config is automatically included if you use any of the recommended configur 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. +### `recommended-type-checked-only` + +A version of `recommended` that _only_ contains type-checked rules and disables of any corresponding core ESLint rules. +This config plus `recommended` is equivalent to `recommended-type-checked`. + +```js title=".eslintrc.js" +module.exports = { + extends: ['plugin:@typescript-eslint/recommended-type-checked-only'], +}; +``` + +See [`configs/recommended-type-checked-only.ts`](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/recommended-type-checked-only.ts) for the exact contents of this config. + +### `strict-type-checked-only` + +A version of `strict` that _only_ contains type-checked rules and disables of any corresponding core ESLint rules. +This config plus `strict` is equivalent to `strict-type-checked`. + +```js title=".eslintrc.js" +module.exports = { + extends: ['plugin:@typescript-eslint/strict-type-checked-only'], +}; +``` + +See [`configs/strict-type-checked-only.ts`](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/strict-type-checked-only.ts) for the exact contents of this config. + +### `stylistic-type-checked-only` + +A version of `stylistic` that _only_ contains type-checked rules and disables of any corresponding core ESLint rules. +This config plus `stylistic` is equivalent to `stylistic-type-checked`. + +```js title=".eslintrc.js" +module.exports = { + extends: ['plugin:@typescript-eslint/stylistic-type-checked-only'], +}; +``` + +See [`configs/stylistic-type-checked-only.ts`](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/stylistic-type-checked-only.ts) for the exact contents of this config. + ## Suggesting Configuration Changes If you feel strongly that a specific rule should (or should not) be one of these configurations, please [file an issue](https://github.com/typescript-eslint/typescript-eslint/issues/new?assignees=&labels=package%3A+eslint-plugin%2Cpreset+config+change%2Ctriage&template=09-config-change.yaml&title=Configs%3A+%3Ca+short+description+of+my+proposal%3E) along with a **detailed** argument explaining your reasoning. diff --git a/packages/eslint-plugin/src/configs/recommended-type-checked-only.ts b/packages/eslint-plugin/src/configs/recommended-type-checked-only.ts new file mode 100644 index 000000000000..13a1f5fb4271 --- /dev/null +++ b/packages/eslint-plugin/src/configs/recommended-type-checked-only.ts @@ -0,0 +1,35 @@ +// THIS CODE WAS AUTOMATICALLY GENERATED +// DO NOT EDIT THIS CODE BY HAND +// SEE https://typescript-eslint.io/users/configs +// +// For developers working in the typescript-eslint monorepo: +// You can regenerate it using `yarn generate:configs` + +import type { ClassicConfig } from '@typescript-eslint/utils/ts-eslint'; + +export = { + extends: ['./configs/base', './configs/eslint-recommended'], + rules: { + '@typescript-eslint/await-thenable': 'error', + '@typescript-eslint/no-base-to-string': 'error', + '@typescript-eslint/no-duplicate-type-constituents': 'error', + '@typescript-eslint/no-floating-promises': 'error', + '@typescript-eslint/no-for-in-array': 'error', + 'no-implied-eval': 'off', + '@typescript-eslint/no-implied-eval': 'error', + '@typescript-eslint/no-misused-promises': 'error', + '@typescript-eslint/no-redundant-type-constituents': 'error', + '@typescript-eslint/no-unnecessary-type-assertion': 'error', + '@typescript-eslint/no-unsafe-argument': 'error', + '@typescript-eslint/no-unsafe-assignment': 'error', + '@typescript-eslint/no-unsafe-call': 'error', + '@typescript-eslint/no-unsafe-enum-comparison': 'error', + '@typescript-eslint/no-unsafe-member-access': 'error', + '@typescript-eslint/no-unsafe-return': 'error', + 'require-await': 'off', + '@typescript-eslint/require-await': 'error', + '@typescript-eslint/restrict-plus-operands': 'error', + '@typescript-eslint/restrict-template-expressions': 'error', + '@typescript-eslint/unbound-method': 'error', + }, +} satisfies ClassicConfig.Config; diff --git a/packages/eslint-plugin/src/configs/strict-type-checked-only.ts b/packages/eslint-plugin/src/configs/strict-type-checked-only.ts new file mode 100644 index 000000000000..4188f5f73465 --- /dev/null +++ b/packages/eslint-plugin/src/configs/strict-type-checked-only.ts @@ -0,0 +1,50 @@ +// THIS CODE WAS AUTOMATICALLY GENERATED +// DO NOT EDIT THIS CODE BY HAND +// SEE https://typescript-eslint.io/users/configs +// +// For developers working in the typescript-eslint monorepo: +// You can regenerate it using `yarn generate:configs` + +import type { ClassicConfig } from '@typescript-eslint/utils/ts-eslint'; + +export = { + extends: ['./configs/base', './configs/eslint-recommended'], + rules: { + '@typescript-eslint/await-thenable': 'error', + '@typescript-eslint/no-array-delete': 'error', + '@typescript-eslint/no-base-to-string': 'error', + '@typescript-eslint/no-confusing-void-expression': 'error', + '@typescript-eslint/no-duplicate-type-constituents': 'error', + '@typescript-eslint/no-floating-promises': 'error', + '@typescript-eslint/no-for-in-array': 'error', + 'no-implied-eval': 'off', + '@typescript-eslint/no-implied-eval': 'error', + '@typescript-eslint/no-meaningless-void-operator': 'error', + '@typescript-eslint/no-misused-promises': 'error', + '@typescript-eslint/no-mixed-enums': 'error', + '@typescript-eslint/no-redundant-type-constituents': 'error', + 'no-throw-literal': 'off', + '@typescript-eslint/no-throw-literal': 'error', + '@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error', + '@typescript-eslint/no-unnecessary-condition': 'error', + '@typescript-eslint/no-unnecessary-type-arguments': 'error', + '@typescript-eslint/no-unnecessary-type-assertion': 'error', + '@typescript-eslint/no-unsafe-argument': 'error', + '@typescript-eslint/no-unsafe-assignment': 'error', + '@typescript-eslint/no-unsafe-call': 'error', + '@typescript-eslint/no-unsafe-enum-comparison': 'error', + '@typescript-eslint/no-unsafe-member-access': 'error', + '@typescript-eslint/no-unsafe-return': 'error', + '@typescript-eslint/no-useless-template-literals': 'error', + '@typescript-eslint/prefer-includes': 'error', + 'prefer-promise-reject-errors': 'off', + '@typescript-eslint/prefer-promise-reject-errors': 'error', + '@typescript-eslint/prefer-reduce-type-parameter': 'error', + '@typescript-eslint/prefer-return-this-type': 'error', + 'require-await': 'off', + '@typescript-eslint/require-await': 'error', + '@typescript-eslint/restrict-plus-operands': 'error', + '@typescript-eslint/restrict-template-expressions': 'error', + '@typescript-eslint/unbound-method': 'error', + }, +} satisfies ClassicConfig.Config; diff --git a/packages/eslint-plugin/src/configs/stylistic-type-checked-only.ts b/packages/eslint-plugin/src/configs/stylistic-type-checked-only.ts new file mode 100644 index 000000000000..d9026c1db57e --- /dev/null +++ b/packages/eslint-plugin/src/configs/stylistic-type-checked-only.ts @@ -0,0 +1,20 @@ +// THIS CODE WAS AUTOMATICALLY GENERATED +// DO NOT EDIT THIS CODE BY HAND +// SEE https://typescript-eslint.io/users/configs +// +// For developers working in the typescript-eslint monorepo: +// You can regenerate it using `yarn generate:configs` + +import type { ClassicConfig } from '@typescript-eslint/utils/ts-eslint'; + +export = { + extends: ['./configs/base', './configs/eslint-recommended'], + rules: { + 'dot-notation': 'off', + '@typescript-eslint/dot-notation': 'error', + '@typescript-eslint/non-nullable-type-assertion-style': 'error', + '@typescript-eslint/prefer-nullish-coalescing': 'error', + '@typescript-eslint/prefer-optional-chain': 'error', + '@typescript-eslint/prefer-string-starts-ends-with': 'error', + }, +} satisfies ClassicConfig.Config; diff --git a/packages/repo-tools/src/generate-configs.mts b/packages/repo-tools/src/generate-configs.mts index b32f0b7d5f1c..941d51fd4928 100644 --- a/packages/repo-tools/src/generate-configs.mts +++ b/packages/repo-tools/src/generate-configs.mts @@ -251,7 +251,7 @@ async function main(): Promise { } async function writeExtendedConfig({ - filters: ruleFilter, + filters, name, ruleEntries, }: ExtendedConfigSettings): Promise { @@ -259,7 +259,7 @@ async function main(): Promise { () => ({ extends: [...CLASSIC_EXTENDS], rules: ruleEntries.reduce( - (config, entry) => reducer(config, entry, ruleFilter), + (config, entry) => reducer(config, entry, filters), {}, ), }), @@ -296,6 +296,14 @@ async function main(): Promise { ruleEntries: filterRuleEntriesTo('recommended'), }); + await writeExtendedConfig({ + filters: { + typeChecked: 'include-only', + }, + name: 'recommended-type-checked-only', + ruleEntries: filterRuleEntriesTo('recommended'), + }); + await writeExtendedConfig({ filters: { typeChecked: 'exclude', @@ -309,6 +317,14 @@ async function main(): Promise { ruleEntries: filterRuleEntriesTo('recommended', 'strict'), }); + await writeExtendedConfig({ + filters: { + typeChecked: 'include-only', + }, + name: 'strict-type-checked-only', + ruleEntries: filterRuleEntriesTo('recommended', 'strict'), + }); + await writeExtendedConfig({ filters: { typeChecked: 'exclude', @@ -322,6 +338,14 @@ async function main(): Promise { ruleEntries: filterRuleEntriesTo('stylistic'), }); + await writeExtendedConfig({ + filters: { + typeChecked: 'include-only', + }, + name: 'stylistic-type-checked-only', + ruleEntries: filterRuleEntriesTo('stylistic'), + }); + await writeConfig( () => ({ parserOptions: { diff --git a/packages/typescript-eslint/src/configs/recommended-type-checked-only.ts b/packages/typescript-eslint/src/configs/recommended-type-checked-only.ts new file mode 100644 index 000000000000..a2b39143c6cd --- /dev/null +++ b/packages/typescript-eslint/src/configs/recommended-type-checked-only.ts @@ -0,0 +1,44 @@ +// THIS CODE WAS AUTOMATICALLY GENERATED +// DO NOT EDIT THIS CODE BY HAND +// SEE https://typescript-eslint.io/users/configs +// +// For developers working in the typescript-eslint monorepo: +// You can regenerate it using `yarn generate:configs` + +import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint'; + +import baseConfig from './base'; +import eslintRecommendedConfig from './eslint-recommended'; + +export default ( + plugin: FlatConfig.Plugin, + parser: FlatConfig.Parser, +): FlatConfig.ConfigArray => [ + baseConfig(plugin, parser), + eslintRecommendedConfig(plugin, parser), + { + rules: { + '@typescript-eslint/await-thenable': 'error', + '@typescript-eslint/no-base-to-string': 'error', + '@typescript-eslint/no-duplicate-type-constituents': 'error', + '@typescript-eslint/no-floating-promises': 'error', + '@typescript-eslint/no-for-in-array': 'error', + 'no-implied-eval': 'off', + '@typescript-eslint/no-implied-eval': 'error', + '@typescript-eslint/no-misused-promises': 'error', + '@typescript-eslint/no-redundant-type-constituents': 'error', + '@typescript-eslint/no-unnecessary-type-assertion': 'error', + '@typescript-eslint/no-unsafe-argument': 'error', + '@typescript-eslint/no-unsafe-assignment': 'error', + '@typescript-eslint/no-unsafe-call': 'error', + '@typescript-eslint/no-unsafe-enum-comparison': 'error', + '@typescript-eslint/no-unsafe-member-access': 'error', + '@typescript-eslint/no-unsafe-return': 'error', + 'require-await': 'off', + '@typescript-eslint/require-await': 'error', + '@typescript-eslint/restrict-plus-operands': 'error', + '@typescript-eslint/restrict-template-expressions': 'error', + '@typescript-eslint/unbound-method': 'error', + }, + }, +]; diff --git a/packages/typescript-eslint/src/configs/strict-type-checked-only.ts b/packages/typescript-eslint/src/configs/strict-type-checked-only.ts new file mode 100644 index 000000000000..e1f60b92e692 --- /dev/null +++ b/packages/typescript-eslint/src/configs/strict-type-checked-only.ts @@ -0,0 +1,59 @@ +// THIS CODE WAS AUTOMATICALLY GENERATED +// DO NOT EDIT THIS CODE BY HAND +// SEE https://typescript-eslint.io/users/configs +// +// For developers working in the typescript-eslint monorepo: +// You can regenerate it using `yarn generate:configs` + +import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint'; + +import baseConfig from './base'; +import eslintRecommendedConfig from './eslint-recommended'; + +export default ( + plugin: FlatConfig.Plugin, + parser: FlatConfig.Parser, +): FlatConfig.ConfigArray => [ + baseConfig(plugin, parser), + eslintRecommendedConfig(plugin, parser), + { + rules: { + '@typescript-eslint/await-thenable': 'error', + '@typescript-eslint/no-array-delete': 'error', + '@typescript-eslint/no-base-to-string': 'error', + '@typescript-eslint/no-confusing-void-expression': 'error', + '@typescript-eslint/no-duplicate-type-constituents': 'error', + '@typescript-eslint/no-floating-promises': 'error', + '@typescript-eslint/no-for-in-array': 'error', + 'no-implied-eval': 'off', + '@typescript-eslint/no-implied-eval': 'error', + '@typescript-eslint/no-meaningless-void-operator': 'error', + '@typescript-eslint/no-misused-promises': 'error', + '@typescript-eslint/no-mixed-enums': 'error', + '@typescript-eslint/no-redundant-type-constituents': 'error', + 'no-throw-literal': 'off', + '@typescript-eslint/no-throw-literal': 'error', + '@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error', + '@typescript-eslint/no-unnecessary-condition': 'error', + '@typescript-eslint/no-unnecessary-type-arguments': 'error', + '@typescript-eslint/no-unnecessary-type-assertion': 'error', + '@typescript-eslint/no-unsafe-argument': 'error', + '@typescript-eslint/no-unsafe-assignment': 'error', + '@typescript-eslint/no-unsafe-call': 'error', + '@typescript-eslint/no-unsafe-enum-comparison': 'error', + '@typescript-eslint/no-unsafe-member-access': 'error', + '@typescript-eslint/no-unsafe-return': 'error', + '@typescript-eslint/no-useless-template-literals': 'error', + '@typescript-eslint/prefer-includes': 'error', + 'prefer-promise-reject-errors': 'off', + '@typescript-eslint/prefer-promise-reject-errors': 'error', + '@typescript-eslint/prefer-reduce-type-parameter': 'error', + '@typescript-eslint/prefer-return-this-type': 'error', + 'require-await': 'off', + '@typescript-eslint/require-await': 'error', + '@typescript-eslint/restrict-plus-operands': 'error', + '@typescript-eslint/restrict-template-expressions': 'error', + '@typescript-eslint/unbound-method': 'error', + }, + }, +]; diff --git a/packages/typescript-eslint/src/configs/stylistic-type-checked-only.ts b/packages/typescript-eslint/src/configs/stylistic-type-checked-only.ts new file mode 100644 index 000000000000..b0bde294564c --- /dev/null +++ b/packages/typescript-eslint/src/configs/stylistic-type-checked-only.ts @@ -0,0 +1,29 @@ +// THIS CODE WAS AUTOMATICALLY GENERATED +// DO NOT EDIT THIS CODE BY HAND +// SEE https://typescript-eslint.io/users/configs +// +// For developers working in the typescript-eslint monorepo: +// You can regenerate it using `yarn generate:configs` + +import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint'; + +import baseConfig from './base'; +import eslintRecommendedConfig from './eslint-recommended'; + +export default ( + plugin: FlatConfig.Plugin, + parser: FlatConfig.Parser, +): FlatConfig.ConfigArray => [ + baseConfig(plugin, parser), + eslintRecommendedConfig(plugin, parser), + { + rules: { + 'dot-notation': 'off', + '@typescript-eslint/dot-notation': 'error', + '@typescript-eslint/non-nullable-type-assertion-style': 'error', + '@typescript-eslint/prefer-nullish-coalescing': 'error', + '@typescript-eslint/prefer-optional-chain': 'error', + '@typescript-eslint/prefer-string-starts-ends-with': 'error', + }, + }, +]; From f7198db67d881c9b288e8f0774c1ad0ea2a5d900 Mon Sep 17 00:00:00 2001 From: Arka Pratim Chaudhuri <105232141+arka1002@users.noreply.github.com> Date: Fri, 23 Feb 2024 03:56:58 +0530 Subject: [PATCH 19/35] feat(eslint-plugin): [naming-convention] support the auto-accessor syntax (#8084) --- .../docs/rules/naming-convention.md | 10 +- .../rules/naming-convention-utils/enums.ts | 15 +- .../rules/naming-convention-utils/schema.ts | 18 ++ .../naming-convention-utils/validator.ts | 2 +- .../src/rules/naming-convention.ts | 52 +++-- .../naming-convention/cases/accessor.test.ts | 11 ++ .../cases/autoAccessor.test.ts | 22 +++ .../cases/classicAccessor.test.ts | 19 ++ .../cases/createTestCases.ts | 3 +- .../naming-convention.test.ts | 4 +- .../schema-snapshots/naming-convention.shot | 182 ++++++++++++++++++ 11 files changed, 312 insertions(+), 26 deletions(-) create mode 100644 packages/eslint-plugin/tests/rules/naming-convention/cases/autoAccessor.test.ts create mode 100644 packages/eslint-plugin/tests/rules/naming-convention/cases/classicAccessor.test.ts diff --git a/packages/eslint-plugin/docs/rules/naming-convention.md b/packages/eslint-plugin/docs/rules/naming-convention.md index 9d3a52aa8816..f1d143e5b033 100644 --- a/packages/eslint-plugin/docs/rules/naming-convention.md +++ b/packages/eslint-plugin/docs/rules/naming-convention.md @@ -200,7 +200,10 @@ There are two types of selectors, individual selectors, and grouped selectors. Individual Selectors match specific, well-defined sets. There is no overlap between each of the individual selectors. -- `accessor` - matches any accessor. +- `classicAccessor` - matches any accessor. It refers to the methods attached to `get` and `set` syntax. + - Allowed `modifiers`: `abstract`, `override`, `private`, `protected`, `public`, `requiresQuotes`, `static`. + - Allowed `types`: `array`, `boolean`, `function`, `number`, `string`. +- `autoAccessor` - matches any auto-accessor. An auto-accessor is just a class field starting with an `accessor` keyword. - Allowed `modifiers`: `abstract`, `override`, `private`, `protected`, `public`, `requiresQuotes`, `static`. - Allowed `types`: `array`, `boolean`, `function`, `number`, `string`. - `class` - matches any class declaration. @@ -262,7 +265,10 @@ Group Selectors are provided for convenience, and essentially bundle up sets of - `default` - matches everything. - Allowed `modifiers`: all modifiers. - Allowed `types`: none. -- `memberLike` - matches the same as `accessor`, `enumMember`, `method`, `parameterProperty`, `property`. +- `accessor` - matches the same as `classicAccessor` and `autoAccessor`. + - Allowed `modifiers`: `abstract`, `override`, `private`, `protected`, `public`, `requiresQuotes`, `static`. + - Allowed `types`: `array`, `boolean`, `function`, `number`, `string`. +- `memberLike` - matches the same as `classicAccessor`, `autoAccessor`, `enumMember`, `method`, `parameterProperty`, `property`. - Allowed `modifiers`: `abstract`, `async`, `override`, `#private`, `private`, `protected`, `public`, `readonly`, `requiresQuotes`, `static`. - Allowed `types`: none. - `method` - matches the same as `classMethod`, `objectLiteralMethod`, `typeMethod`. diff --git a/packages/eslint-plugin/src/rules/naming-convention-utils/enums.ts b/packages/eslint-plugin/src/rules/naming-convention-utils/enums.ts index 7b96072291d9..c30029882e16 100644 --- a/packages/eslint-plugin/src/rules/naming-convention-utils/enums.ts +++ b/packages/eslint-plugin/src/rules/naming-convention-utils/enums.ts @@ -28,7 +28,7 @@ enum Selectors { // memberLike parameterProperty = 1 << 3, - accessor = 1 << 4, + classicAccessor = 1 << 4, enumMember = 1 << 5, classMethod = 1 << 6, objectLiteralMethod = 1 << 7, @@ -36,12 +36,13 @@ enum Selectors { classProperty = 1 << 9, objectLiteralProperty = 1 << 10, typeProperty = 1 << 11, + autoAccessor = 1 << 12, // typeLike - class = 1 << 12, - interface = 1 << 13, - typeAlias = 1 << 14, - enum = 1 << 15, + class = 1 << 13, + interface = 1 << 14, + typeAlias = 1 << 15, + enum = 1 << 16, typeParameter = 1 << 17, // other @@ -65,7 +66,8 @@ enum MetaSelectors { Selectors.classMethod | Selectors.objectLiteralMethod | Selectors.typeMethod | - Selectors.accessor, + Selectors.classicAccessor | + Selectors.autoAccessor, typeLike = 0 | Selectors.class | Selectors.interface | @@ -80,6 +82,7 @@ enum MetaSelectors { Selectors.classProperty | Selectors.objectLiteralProperty | Selectors.typeProperty, + accessor = 0 | Selectors.classicAccessor | Selectors.autoAccessor, /* eslint-enable @typescript-eslint/prefer-literal-enum-member */ } type MetaSelectorsString = keyof typeof MetaSelectors; diff --git a/packages/eslint-plugin/src/rules/naming-convention-utils/schema.ts b/packages/eslint-plugin/src/rules/naming-convention-utils/schema.ts index d963f3101c59..91e5bfec36f3 100644 --- a/packages/eslint-plugin/src/rules/naming-convention-utils/schema.ts +++ b/packages/eslint-plugin/src/rules/naming-convention-utils/schema.ts @@ -290,6 +290,24 @@ const SCHEMA: JSONSchema.JSONSchema4 = { 'override', 'async', ]), + ...selectorSchema('classicAccessor', true, [ + 'abstract', + 'private', + 'protected', + 'public', + 'requiresQuotes', + 'static', + 'override', + ]), + ...selectorSchema('autoAccessor', true, [ + 'abstract', + 'private', + 'protected', + 'public', + 'requiresQuotes', + 'static', + 'override', + ]), ...selectorSchema('accessor', true, [ 'abstract', 'private', diff --git a/packages/eslint-plugin/src/rules/naming-convention-utils/validator.ts b/packages/eslint-plugin/src/rules/naming-convention-utils/validator.ts index b0715c2f8aa3..f656769b1b67 100644 --- a/packages/eslint-plugin/src/rules/naming-convention-utils/validator.ts +++ b/packages/eslint-plugin/src/rules/naming-convention-utils/validator.ts @@ -419,7 +419,7 @@ const SelectorsAllowedToHaveTypes = Selectors.objectLiteralProperty | Selectors.typeProperty | Selectors.parameterProperty | - Selectors.accessor; + Selectors.classicAccessor; function isCorrectType( node: TSESTree.Node, diff --git a/packages/eslint-plugin/src/rules/naming-convention.ts b/packages/eslint-plugin/src/rules/naming-convention.ts index 4af3fd2502c8..635e1a625b80 100644 --- a/packages/eslint-plugin/src/rules/naming-convention.ts +++ b/packages/eslint-plugin/src/rules/naming-convention.ts @@ -109,7 +109,8 @@ export default createRule({ | TSESTree.TSAbstractMethodDefinitionNonComputedName | TSESTree.TSAbstractPropertyDefinitionNonComputedName | TSESTree.TSMethodSignatureNonComputedName - | TSESTree.TSPropertySignatureNonComputedName, + | TSESTree.TSPropertySignatureNonComputedName + | TSESTree.AccessorPropertyNonComputedName, modifiers: Set, ): void { const key = node.key; @@ -126,7 +127,9 @@ export default createRule({ | TSESTree.PropertyDefinition | TSESTree.TSAbstractMethodDefinition | TSESTree.TSAbstractPropertyDefinition - | TSESTree.TSParameterProperty, + | TSESTree.TSParameterProperty + | TSESTree.AccessorProperty + | TSESTree.TSAbstractAccessorProperty, ): Set { const modifiers = new Set(); if ('key' in node && node.key.type === AST_NODE_TYPES.PrivateIdentifier) { @@ -147,7 +150,8 @@ export default createRule({ } if ( node.type === AST_NODE_TYPES.TSAbstractPropertyDefinition || - node.type === AST_NODE_TYPES.TSAbstractMethodDefinition + node.type === AST_NODE_TYPES.TSAbstractMethodDefinition || + node.type === AST_NODE_TYPES.TSAbstractAccessorProperty ) { modifiers.add(Modifiers.abstract); } @@ -519,27 +523,47 @@ export default createRule({ // #region accessor 'Property[computed = false]:matches([kind = "get"], [kind = "set"])': { - validator: validators.accessor, + validator: validators.classicAccessor, handler: (node: TSESTree.PropertyNonComputedName, validator): void => { const modifiers = new Set([Modifiers.public]); handleMember(validator, node, modifiers); }, }, - 'MethodDefinition[computed = false]:matches([kind = "get"], [kind = "set"])': - { - validator: validators.accessor, - handler: ( - node: TSESTree.MethodDefinitionNonComputedName, - validator, - ): void => { - const modifiers = getMemberModifiers(node); - handleMember(validator, node, modifiers); - }, + [[ + 'MethodDefinition[computed = false]:matches([kind = "get"], [kind = "set"])', + 'TSAbstractMethodDefinition[computed = false]:matches([kind="get"], [kind="set"])', + ].join(', ')]: { + validator: validators.classicAccessor, + handler: ( + node: TSESTree.MethodDefinitionNonComputedName, + validator, + ): void => { + const modifiers = getMemberModifiers(node); + handleMember(validator, node, modifiers); }, + }, // #endregion accessor + // #region autoAccessor + + [[ + AST_NODE_TYPES.AccessorProperty, + AST_NODE_TYPES.TSAbstractAccessorProperty, + ].join(', ')]: { + validator: validators.autoAccessor, + handler: ( + node: TSESTree.AccessorPropertyNonComputedName, + validator, + ): void => { + const modifiers = getMemberModifiers(node); + handleMember(validator, node, modifiers); + }, + }, + + // #endregion autoAccessor + // #region enumMember // computed is optional, so can't do [computed = false] diff --git a/packages/eslint-plugin/tests/rules/naming-convention/cases/accessor.test.ts b/packages/eslint-plugin/tests/rules/naming-convention/cases/accessor.test.ts index a2f9ff06a21d..8b7cacbcc57e 100644 --- a/packages/eslint-plugin/tests/rules/naming-convention/cases/accessor.test.ts +++ b/packages/eslint-plugin/tests/rules/naming-convention/cases/accessor.test.ts @@ -3,6 +3,17 @@ import { createTestCases } from './createTestCases'; createTestCases([ { code: [ + 'class Ignored { accessor % = 10; }', + 'class Ignored { accessor #% = 10; }', + 'class Ignored { static accessor % = 10; }', + 'class Ignored { static accessor #% = 10; }', + 'class Ignored { private accessor % = 10; }', + 'class Ignored { private static accessor % = 10; }', + 'class Ignored { override accessor % = 10; }', + 'class Ignored { accessor "%" = 10; }', + 'class Ignored { protected accessor % = 10; }', + 'class Ignored { public accessor % = 10; }', + 'class Ignored { abstract accessor %; }', 'const ignored = { get %() {} };', 'const ignored = { set "%"(ignored) {} };', 'class Ignored { private get %() {} }', diff --git a/packages/eslint-plugin/tests/rules/naming-convention/cases/autoAccessor.test.ts b/packages/eslint-plugin/tests/rules/naming-convention/cases/autoAccessor.test.ts new file mode 100644 index 000000000000..f82e7c7cbce7 --- /dev/null +++ b/packages/eslint-plugin/tests/rules/naming-convention/cases/autoAccessor.test.ts @@ -0,0 +1,22 @@ +import { createTestCases } from './createTestCases'; + +createTestCases([ + { + code: [ + 'class Ignored { accessor % = 10; }', + 'class Ignored { accessor #% = 10; }', + 'class Ignored { static accessor % = 10; }', + 'class Ignored { static accessor #% = 10; }', + 'class Ignored { private accessor % = 10; }', + 'class Ignored { private static accessor % = 10; }', + 'class Ignored { override accessor % = 10; }', + 'class Ignored { accessor "%" = 10; }', + 'class Ignored { protected accessor % = 10; }', + 'class Ignored { public accessor % = 10; }', + 'class Ignored { abstract accessor %; }', + ], + options: { + selector: 'autoAccessor', + }, + }, +]); diff --git a/packages/eslint-plugin/tests/rules/naming-convention/cases/classicAccessor.test.ts b/packages/eslint-plugin/tests/rules/naming-convention/cases/classicAccessor.test.ts new file mode 100644 index 000000000000..4b03e8ac0bcd --- /dev/null +++ b/packages/eslint-plugin/tests/rules/naming-convention/cases/classicAccessor.test.ts @@ -0,0 +1,19 @@ +import { createTestCases } from './createTestCases'; + +createTestCases([ + { + code: [ + 'const ignored = { get %() {} };', + 'const ignored = { set "%"(ignored) {} };', + 'class Ignored { private get %() {} }', + 'class Ignored { private set "%"(ignored) {} }', + 'class Ignored { private static get %() {} }', + 'class Ignored { static get #%() {} }', + 'abstract class Ignored { abstract get %(): number }', + 'abstract class Ignored { abstract set %(ignored: number) }', + ], + options: { + selector: 'classicAccessor', + }, + }, +]); diff --git a/packages/eslint-plugin/tests/rules/naming-convention/cases/createTestCases.ts b/packages/eslint-plugin/tests/rules/naming-convention/cases/createTestCases.ts index 7f7f0efcd491..327bc77ab71e 100644 --- a/packages/eslint-plugin/tests/rules/naming-convention/cases/createTestCases.ts +++ b/packages/eslint-plugin/tests/rules/naming-convention/cases/createTestCases.ts @@ -291,7 +291,8 @@ export function createTestCases(cases: Cases): void { selector !== 'memberLike' && selector !== 'typeLike' && selector !== 'property' && - selector !== 'method' + selector !== 'method' && + selector !== 'accessor' ? { data: { type: selectorTypeToMessageString(selector), diff --git a/packages/eslint-plugin/tests/rules/naming-convention/naming-convention.test.ts b/packages/eslint-plugin/tests/rules/naming-convention/naming-convention.test.ts index 6150f9476f33..85fa8450ad21 100644 --- a/packages/eslint-plugin/tests/rules/naming-convention/naming-convention.test.ts +++ b/packages/eslint-plugin/tests/rules/naming-convention/naming-convention.test.ts @@ -2088,7 +2088,7 @@ ruleTester.run('naming-convention', rule, { { messageId: 'doesNotMatchFormat', data: { - type: 'Accessor', + type: 'Classic Accessor', name: 'someGetterOverride', formats: 'snake_case', }, @@ -2096,7 +2096,7 @@ ruleTester.run('naming-convention', rule, { { messageId: 'doesNotMatchFormat', data: { - type: 'Accessor', + type: 'Classic Accessor', name: 'someSetterOverride', formats: 'snake_case', }, diff --git a/packages/eslint-plugin/tests/schema-snapshots/naming-convention.shot b/packages/eslint-plugin/tests/schema-snapshots/naming-convention.shot index 668f54f1a3b4..80a4f0e19e1c 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/naming-convention.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/naming-convention.shot @@ -132,9 +132,11 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "items": { "enum": [ "accessor", + "autoAccessor", "class", "classMethod", "classProperty", + "classicAccessor", "default", "enum", "enumMember", @@ -1083,6 +1085,140 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "required": ["selector", "format"], "type": "object" }, + { + "additionalProperties": false, + "description": "Selector 'classicAccessor'", + "properties": { + "custom": { + "$ref": "#/$defs/matchRegexConfig" + }, + "failureMessage": { + "type": "string" + }, + "filter": { + "oneOf": [ + { + "minLength": 1, + "type": "string" + }, + { + "$ref": "#/$defs/matchRegexConfig" + } + ] + }, + "format": { + "$ref": "#/$defs/formatOptionsConfig" + }, + "leadingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, + "modifiers": { + "additionalItems": false, + "items": { + "enum": [ + "abstract", + "override", + "private", + "protected", + "public", + "requiresQuotes", + "static" + ], + "type": "string" + }, + "type": "array" + }, + "prefix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "selector": { + "enum": ["classicAccessor"], + "type": "string" + }, + "suffix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "trailingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, + "types": { + "additionalItems": false, + "items": { + "$ref": "#/$defs/typeModifiers" + }, + "type": "array" + } + }, + "required": ["selector", "format"], + "type": "object" + }, + { + "additionalProperties": false, + "description": "Selector 'autoAccessor'", + "properties": { + "custom": { + "$ref": "#/$defs/matchRegexConfig" + }, + "failureMessage": { + "type": "string" + }, + "filter": { + "oneOf": [ + { + "minLength": 1, + "type": "string" + }, + { + "$ref": "#/$defs/matchRegexConfig" + } + ] + }, + "format": { + "$ref": "#/$defs/formatOptionsConfig" + }, + "leadingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, + "modifiers": { + "additionalItems": false, + "items": { + "enum": [ + "abstract", + "override", + "private", + "protected", + "public", + "requiresQuotes", + "static" + ], + "type": "string" + }, + "type": "array" + }, + "prefix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "selector": { + "enum": ["autoAccessor"], + "type": "string" + }, + "suffix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "trailingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, + "types": { + "additionalItems": false, + "items": { + "$ref": "#/$defs/typeModifiers" + }, + "type": "array" + } + }, + "required": ["selector", "format"], + "type": "object" + }, { "additionalProperties": false, "description": "Selector 'accessor'", @@ -1630,9 +1766,11 @@ type Options = /** Multiple selectors in one config */ prefix?: PrefixSuffixConfig; selector: ( | 'accessor' + | 'autoAccessor' | 'class' | 'classMethod' | 'classProperty' + | 'classicAccessor' | 'default' | 'enum' | 'enumMember' @@ -1680,6 +1818,28 @@ type Options = /** Multiple selectors in one config */ trailingUnderscore?: UnderscoreOptions; types?: TypeModifiers[]; } + /** Selector 'autoAccessor' */ + | { + custom?: MatchRegexConfig; + failureMessage?: string; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; + modifiers?: ( + | 'abstract' + | 'override' + | 'private' + | 'protected' + | 'public' + | 'requiresQuotes' + | 'static' + )[]; + prefix?: PrefixSuffixConfig; + selector: 'autoAccessor'; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; + types?: TypeModifiers[]; + } /** Selector 'class' */ | { custom?: MatchRegexConfig; @@ -1740,6 +1900,28 @@ type Options = /** Multiple selectors in one config */ trailingUnderscore?: UnderscoreOptions; types?: TypeModifiers[]; } + /** Selector 'classicAccessor' */ + | { + custom?: MatchRegexConfig; + failureMessage?: string; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; + modifiers?: ( + | 'abstract' + | 'override' + | 'private' + | 'protected' + | 'public' + | 'requiresQuotes' + | 'static' + )[]; + prefix?: PrefixSuffixConfig; + selector: 'classicAccessor'; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; + types?: TypeModifiers[]; + } /** Selector 'default' */ | { custom?: MatchRegexConfig; From bba28a9ed041ef0f064c1a5d46100a348b64049a Mon Sep 17 00:00:00 2001 From: Leo Shklovskii Date: Fri, 23 Feb 2024 00:49:57 -0500 Subject: [PATCH 20/35] docs: fixing prettier config example (#8535) --- docs/troubleshooting/Formatting.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/troubleshooting/Formatting.mdx b/docs/troubleshooting/Formatting.mdx index ac94a82195b2..c01fe4532dbd 100644 --- a/docs/troubleshooting/Formatting.mdx +++ b/docs/troubleshooting/Formatting.mdx @@ -59,7 +59,7 @@ export default tseslint.config( ...tseslint.configs.recommended, ...someOtherConfig, // Add this line - ...prettierConfig, + prettierConfig, ); ``` From 46cef966fb861f341768815a6fcae974d7cd43ff Mon Sep 17 00:00:00 2001 From: YeonJuan Date: Fri, 23 Feb 2024 21:23:31 +0900 Subject: [PATCH 21/35] feat(eslint-plugin): [consistent-return] add new rule (#8289) * feat(eslint-plugin): [consistent-return] add new rule * apply reviews * fix docs * fix order * docs: remove eslint comment * handle treatUndefinedAsUnspecified option * fix rule in rulemap order * add test case * fix docs * add test case * fix default options * refactor * refactor * fix * handle nested promise * fix lint error --- .../docs/rules/consistent-return.md | 42 ++ packages/eslint-plugin/src/configs/all.ts | 2 + .../src/configs/disable-type-checked.ts | 1 + .../src/rules/consistent-return.ts | 128 +++++ packages/eslint-plugin/src/rules/index.ts | 2 + .../src/util/getESLintCoreRule.ts | 1 + .../tests/rules/consistent-return.test.ts | 457 ++++++++++++++++++ .../schema-snapshots/consistent-return.shot | 29 ++ .../eslint-plugin/typings/eslint-rules.d.ts | 23 + 9 files changed, 685 insertions(+) create mode 100644 packages/eslint-plugin/docs/rules/consistent-return.md create mode 100644 packages/eslint-plugin/src/rules/consistent-return.ts create mode 100644 packages/eslint-plugin/tests/rules/consistent-return.test.ts create mode 100644 packages/eslint-plugin/tests/schema-snapshots/consistent-return.shot diff --git a/packages/eslint-plugin/docs/rules/consistent-return.md b/packages/eslint-plugin/docs/rules/consistent-return.md new file mode 100644 index 000000000000..03f74840e26f --- /dev/null +++ b/packages/eslint-plugin/docs/rules/consistent-return.md @@ -0,0 +1,42 @@ +--- +description: 'Require `return` statements to either always or never specify values.' +--- + +> 🛑 This file is source code, not the primary documentation location! 🛑 +> +> See **https://typescript-eslint.io/rules/consistent-return** for documentation. + +This rule extends the base [`eslint/consistent-return`](https://eslint.org/docs/rules/consistent-return) rule. +This version adds support for functions that return `void` or `Promise`. + + + +### ❌ Incorrect + +```ts +function foo(): undefined {} +function bar(flag: boolean): undefined { + if (flag) return foo(); + return; +} + +async function baz(flag: boolean): Promise { + if (flag) return; + return foo(); +} +``` + +### ✅ Correct + +```ts +function foo(): void {} +function bar(flag: boolean): void { + if (flag) return foo(); + return; +} + +async function baz(flag: boolean): Promise { + if (flag) return 42; + return; +} +``` diff --git a/packages/eslint-plugin/src/configs/all.ts b/packages/eslint-plugin/src/configs/all.ts index 4c30f33ed9e5..c66afe869db4 100644 --- a/packages/eslint-plugin/src/configs/all.ts +++ b/packages/eslint-plugin/src/configs/all.ts @@ -21,6 +21,8 @@ export = { '@typescript-eslint/class-methods-use-this': 'error', '@typescript-eslint/consistent-generic-constructors': 'error', '@typescript-eslint/consistent-indexed-object-style': 'error', + 'consistent-return': 'off', + '@typescript-eslint/consistent-return': 'error', '@typescript-eslint/consistent-type-assertions': 'error', '@typescript-eslint/consistent-type-definitions': 'error', '@typescript-eslint/consistent-type-exports': 'error', diff --git a/packages/eslint-plugin/src/configs/disable-type-checked.ts b/packages/eslint-plugin/src/configs/disable-type-checked.ts index 48cf79d56e22..f322a903637c 100644 --- a/packages/eslint-plugin/src/configs/disable-type-checked.ts +++ b/packages/eslint-plugin/src/configs/disable-type-checked.ts @@ -11,6 +11,7 @@ export = { parserOptions: { project: false, program: null }, rules: { '@typescript-eslint/await-thenable': 'off', + '@typescript-eslint/consistent-return': 'off', '@typescript-eslint/consistent-type-exports': 'off', '@typescript-eslint/dot-notation': 'off', '@typescript-eslint/naming-convention': 'off', diff --git a/packages/eslint-plugin/src/rules/consistent-return.ts b/packages/eslint-plugin/src/rules/consistent-return.ts new file mode 100644 index 000000000000..5d4cc3fb9256 --- /dev/null +++ b/packages/eslint-plugin/src/rules/consistent-return.ts @@ -0,0 +1,128 @@ +import type { TSESTree } from '@typescript-eslint/utils'; +import * as tsutils from 'ts-api-utils'; +import * as ts from 'typescript'; + +import type { + InferMessageIdsTypeFromRule, + InferOptionsTypeFromRule, +} from '../util'; +import { createRule, getParserServices, isTypeFlagSet } from '../util'; +import { getESLintCoreRule } from '../util/getESLintCoreRule'; + +const baseRule = getESLintCoreRule('consistent-return'); + +type Options = InferOptionsTypeFromRule; +type MessageIds = InferMessageIdsTypeFromRule; + +type FunctionNode = + | TSESTree.FunctionDeclaration + | TSESTree.FunctionExpression + | TSESTree.ArrowFunctionExpression; + +export default createRule({ + name: 'consistent-return', + meta: { + type: 'suggestion', + docs: { + description: + 'Require `return` statements to either always or never specify values', + extendsBaseRule: true, + requiresTypeChecking: true, + }, + hasSuggestions: baseRule.meta.hasSuggestions, + schema: baseRule.meta.schema, + messages: baseRule.meta.messages, + }, + defaultOptions: [{ treatUndefinedAsUnspecified: false }], + create(context, [options]) { + const services = getParserServices(context); + const checker = services.program.getTypeChecker(); + const rules = baseRule.create(context); + const functions: FunctionNode[] = []; + const treatUndefinedAsUnspecified = + options?.treatUndefinedAsUnspecified === true; + + function enterFunction(node: FunctionNode): void { + functions.push(node); + } + + function exitFunction(): void { + functions.pop(); + } + + function getCurrentFunction(): FunctionNode | null { + return functions[functions.length - 1] ?? null; + } + + function isPromiseVoid(node: ts.Node, type: ts.Type): boolean { + if ( + tsutils.isThenableType(checker, node, type) && + tsutils.isTypeReference(type) + ) { + const awaitedType = type.typeArguments?.[0]; + if (awaitedType) { + if (isTypeFlagSet(awaitedType, ts.TypeFlags.Void)) { + return true; + } + return isPromiseVoid(node, awaitedType); + } + } + return false; + } + + function isReturnVoidOrThenableVoid(node: FunctionNode): boolean { + const functionType = services.getTypeAtLocation(node); + const tsNode = services.esTreeNodeToTSNodeMap.get(node); + const callSignatures = functionType.getCallSignatures(); + + return callSignatures.some(signature => { + const returnType = signature.getReturnType(); + if (node.async) { + return isPromiseVoid(tsNode, returnType); + } + return isTypeFlagSet(returnType, ts.TypeFlags.Void); + }); + } + + return { + ...rules, + FunctionDeclaration: enterFunction, + 'FunctionDeclaration:exit'(node): void { + exitFunction(); + rules['FunctionDeclaration:exit'](node); + }, + FunctionExpression: enterFunction, + 'FunctionExpression:exit'(node): void { + exitFunction(); + rules['FunctionExpression:exit'](node); + }, + ArrowFunctionExpression: enterFunction, + 'ArrowFunctionExpression:exit'(node): void { + exitFunction(); + rules['ArrowFunctionExpression:exit'](node); + }, + ReturnStatement(node): void { + const functionNode = getCurrentFunction(); + if ( + !node.argument && + functionNode && + isReturnVoidOrThenableVoid(functionNode) + ) { + return; + } + if (treatUndefinedAsUnspecified && node.argument) { + const returnValueType = services.getTypeAtLocation(node.argument); + if (returnValueType.flags === ts.TypeFlags.Undefined) { + rules.ReturnStatement({ + ...node, + argument: null, + }); + return; + } + } + + rules.ReturnStatement(node); + }, + }; + }, +}); diff --git a/packages/eslint-plugin/src/rules/index.ts b/packages/eslint-plugin/src/rules/index.ts index e497019debec..6d94605135b5 100644 --- a/packages/eslint-plugin/src/rules/index.ts +++ b/packages/eslint-plugin/src/rules/index.ts @@ -14,6 +14,7 @@ import commaDangle from './comma-dangle'; import commaSpacing from './comma-spacing'; import consistentGenericConstructors from './consistent-generic-constructors'; import consistentIndexedObjectStyle from './consistent-indexed-object-style'; +import consistentReturn from './consistent-return'; import consistentTypeAssertions from './consistent-type-assertions'; import consistentTypeDefinitions from './consistent-type-definitions'; import consistentTypeExports from './consistent-type-exports'; @@ -156,6 +157,7 @@ export default { 'comma-spacing': commaSpacing, 'consistent-generic-constructors': consistentGenericConstructors, 'consistent-indexed-object-style': consistentIndexedObjectStyle, + 'consistent-return': consistentReturn, 'consistent-type-assertions': consistentTypeAssertions, 'consistent-type-definitions': consistentTypeDefinitions, 'consistent-type-exports': consistentTypeExports, diff --git a/packages/eslint-plugin/src/util/getESLintCoreRule.ts b/packages/eslint-plugin/src/util/getESLintCoreRule.ts index c3349011de52..be28069d2877 100644 --- a/packages/eslint-plugin/src/util/getESLintCoreRule.ts +++ b/packages/eslint-plugin/src/util/getESLintCoreRule.ts @@ -7,6 +7,7 @@ interface RuleMap { 'block-spacing': typeof import('eslint/lib/rules/block-spacing'); 'brace-style': typeof import('eslint/lib/rules/brace-style'); 'comma-dangle': typeof import('eslint/lib/rules/comma-dangle'); + 'consistent-return': typeof import('eslint/lib/rules/consistent-return'); 'dot-notation': typeof import('eslint/lib/rules/dot-notation'); indent: typeof import('eslint/lib/rules/indent'); 'init-declarations': typeof import('eslint/lib/rules/init-declarations'); diff --git a/packages/eslint-plugin/tests/rules/consistent-return.test.ts b/packages/eslint-plugin/tests/rules/consistent-return.test.ts new file mode 100644 index 000000000000..1489b835d8ba --- /dev/null +++ b/packages/eslint-plugin/tests/rules/consistent-return.test.ts @@ -0,0 +1,457 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; +import { AST_NODE_TYPES } from '@typescript-eslint/utils'; + +import rule from '../../src/rules/consistent-return'; +import { getFixturesRootDir } from '../RuleTester'; + +const rootDir = getFixturesRootDir(); +const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', + parserOptions: { + ecmaVersion: 2021, + tsconfigRootDir: rootDir, + project: './tsconfig.json', + }, +}); + +ruleTester.run('consistent-return', rule, { + valid: [ + // base rule + ` + function foo() { + return; + } + `, + ` + const foo = (flag: boolean) => { + if (flag) return true; + return false; + }; + `, + ` + class A { + foo() { + if (a) return true; + return false; + } + } + `, + { + code: ` + const foo = (flag: boolean) => { + if (flag) return; + else return undefined; + }; + `, + options: [{ treatUndefinedAsUnspecified: true }], + }, + // void + ` + declare function bar(): void; + function foo(flag: boolean): void { + if (flag) { + return bar(); + } + return; + } + `, + ` + declare function bar(): void; + const foo = (flag: boolean): void => { + if (flag) { + return; + } + return bar(); + }; + `, + ` + function foo(flag?: boolean): number | void { + if (flag) { + return 42; + } + return; + } + `, + ` + function foo(): boolean; + function foo(flag: boolean): void; + function foo(flag?: boolean): boolean | void { + if (flag) { + return; + } + return true; + } + `, + ` + class Foo { + baz(): void {} + bar(flag: boolean): void { + if (flag) return baz(); + return; + } + } + `, + ` + declare function bar(): void; + function foo(flag: boolean): void { + function fn(): string { + return '1'; + } + if (flag) { + return bar(); + } + return; + } + `, + ` + class Foo { + foo(flag: boolean): void { + const bar = (): void => { + if (flag) return; + return this.foo(); + }; + if (flag) { + return this.bar(); + } + return; + } + } + `, + // async + ` + declare function bar(): void; + async function foo(flag?: boolean): Promise { + if (flag) { + return bar(); + } + return; + } + `, + ` + declare function bar(): Promise; + async function foo(flag?: boolean): Promise> { + if (flag) { + return bar(); + } + return; + } + `, + ` + async function foo(flag?: boolean): Promise> { + if (flag) { + return undefined; + } + return; + } + `, + ` + type PromiseVoidNumber = Promise; + async function foo(flag?: boolean): PromiseVoidNumber { + if (flag) { + return 42; + } + return; + } + `, + ` + class Foo { + baz(): void {} + async bar(flag: boolean): Promise { + if (flag) return baz(); + return; + } + } + `, + { + code: ` + declare const undef: undefined; + function foo(flag: boolean) { + if (flag) { + return undef; + } + return 'foo'; + } + `, + options: [ + { + treatUndefinedAsUnspecified: false, + }, + ], + }, + { + code: ` + function foo(flag: boolean): undefined { + if (flag) { + return undefined; + } + return; + } + `, + options: [ + { + treatUndefinedAsUnspecified: true, + }, + ], + }, + { + code: ` + declare const undef: undefined; + function foo(flag: boolean): undefined { + if (flag) { + return undef; + } + return; + } + `, + options: [ + { + treatUndefinedAsUnspecified: true, + }, + ], + }, + ], + invalid: [ + { + code: ` + function foo(flag: boolean): any { + if (flag) return true; + else return; + } + `, + errors: [ + { + messageId: 'missingReturnValue', + data: { name: "Function 'foo'" }, + type: AST_NODE_TYPES.ReturnStatement, + line: 4, + column: 16, + endLine: 4, + endColumn: 23, + }, + ], + }, + { + code: ` + function bar(): undefined {} + function foo(flag: boolean): undefined { + if (flag) return bar(); + return; + } + `, + errors: [ + { + messageId: 'missingReturnValue', + data: { name: "Function 'foo'" }, + type: AST_NODE_TYPES.ReturnStatement, + line: 5, + column: 11, + endLine: 5, + endColumn: 18, + }, + ], + }, + { + code: ` + declare function foo(): void; + function bar(flag: boolean): undefined { + function baz(): undefined { + if (flag) return; + return undefined; + } + if (flag) return baz(); + return; + } + `, + errors: [ + { + messageId: 'unexpectedReturnValue', + data: { name: "Function 'baz'" }, + type: AST_NODE_TYPES.ReturnStatement, + line: 6, + column: 13, + endLine: 6, + endColumn: 30, + }, + { + messageId: 'missingReturnValue', + data: { name: "Function 'bar'" }, + type: AST_NODE_TYPES.ReturnStatement, + line: 9, + column: 11, + endLine: 9, + endColumn: 18, + }, + ], + }, + { + code: ` + function foo(flag: boolean): Promise { + if (flag) return Promise.resolve(void 0); + else return; + } + `, + errors: [ + { + messageId: 'missingReturnValue', + data: { name: "Function 'foo'" }, + type: AST_NODE_TYPES.ReturnStatement, + line: 4, + column: 16, + endLine: 4, + endColumn: 23, + }, + ], + }, + { + code: ` + async function foo(flag: boolean): Promise { + if (flag) return; + else return 'value'; + } + `, + errors: [ + { + messageId: 'unexpectedReturnValue', + data: { name: "Async function 'foo'" }, + type: AST_NODE_TYPES.ReturnStatement, + line: 4, + column: 16, + endLine: 4, + endColumn: 31, + }, + ], + }, + { + code: ` + async function foo(flag: boolean): Promise { + if (flag) return 'value'; + else return; + } + `, + errors: [ + { + messageId: 'missingReturnValue', + data: { name: "Async function 'foo'" }, + type: AST_NODE_TYPES.ReturnStatement, + line: 4, + column: 16, + endLine: 4, + endColumn: 23, + }, + ], + }, + { + code: ` + async function foo(flag: boolean) { + if (flag) return; + return 1; + } + `, + errors: [ + { + messageId: 'unexpectedReturnValue', + data: { name: "Async function 'foo'" }, + type: AST_NODE_TYPES.ReturnStatement, + line: 4, + column: 11, + endLine: 4, + endColumn: 20, + }, + ], + }, + { + code: ` + function foo(flag: boolean): Promise { + if (flag) return; + else return 'value'; + } + `, + errors: [ + { + messageId: 'unexpectedReturnValue', + data: { name: "Function 'foo'" }, + type: AST_NODE_TYPES.ReturnStatement, + line: 4, + column: 16, + endLine: 4, + endColumn: 31, + }, + ], + }, + { + code: ` + declare async function bar(): Promise; + function foo(flag?: boolean): Promise { + if (flag) { + return bar(); + } + return; + } + `, + errors: [ + { + messageId: 'missingReturnValue', + data: { name: "Function 'foo'" }, + type: AST_NODE_TYPES.ReturnStatement, + line: 7, + column: 11, + endLine: 7, + endColumn: 18, + }, + ], + }, + { + code: ` + function foo(flag: boolean): undefined | boolean { + if (flag) { + return undefined; + } + return true; + } + `, + options: [ + { + treatUndefinedAsUnspecified: true, + }, + ], + errors: [ + { + messageId: 'unexpectedReturnValue', + data: { name: "Function 'foo'" }, + type: AST_NODE_TYPES.ReturnStatement, + line: 6, + column: 11, + endLine: 6, + endColumn: 23, + }, + ], + }, + { + code: ` + declare const undefOrNum: undefined | number; + function foo(flag: boolean) { + if (flag) { + return; + } + return undefOrNum; + } + `, + options: [ + { + treatUndefinedAsUnspecified: true, + }, + ], + errors: [ + { + messageId: 'unexpectedReturnValue', + data: { name: "Function 'foo'" }, + type: AST_NODE_TYPES.ReturnStatement, + line: 7, + column: 11, + endLine: 7, + endColumn: 29, + }, + ], + }, + ], +}); diff --git a/packages/eslint-plugin/tests/schema-snapshots/consistent-return.shot b/packages/eslint-plugin/tests/schema-snapshots/consistent-return.shot new file mode 100644 index 000000000000..ec95109ea466 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/consistent-return.shot @@ -0,0 +1,29 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes consistent-return 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "properties": { + "treatUndefinedAsUnspecified": { + "default": false, + "type": "boolean" + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + { + treatUndefinedAsUnspecified?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/typings/eslint-rules.d.ts b/packages/eslint-plugin/typings/eslint-rules.d.ts index 68e8f106781d..c72e018bc9bb 100644 --- a/packages/eslint-plugin/typings/eslint-rules.d.ts +++ b/packages/eslint-plugin/typings/eslint-rules.d.ts @@ -11,6 +11,7 @@ declare module 'eslint/use-at-your-own-risk' { 'block-spacing': typeof import('eslint/lib/rules/block-spacing'); 'brace-style': typeof import('eslint/lib/rules/brace-style'); 'comma-dangle': typeof import('eslint/lib/rules/comma-dangle'); + 'consistent-return': typeof import('eslint/lib/rules/consistent-return'); 'dot-notation': typeof import('eslint/lib/rules/dot-notation'); indent: typeof import('eslint/lib/rules/indent'); 'init-declarations': typeof import('eslint/lib/rules/init-declarations'); @@ -71,6 +72,28 @@ declare module 'eslint/lib/rules/arrow-parens' { export = rule; } +declare module 'eslint/lib/rules/consistent-return' { + import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; + + const rule: TSESLint.RuleModule< + 'missingReturn' | 'missingReturnValue' | 'unexpectedReturnValue', + [ + { + treatUndefinedAsUnspecified?: boolean; + }?, + ], + { + ReturnStatement(node: TSESTree.ReturnStatement): void; + 'FunctionDeclaration:exit'(node: TSESTree.FunctionDeclaration): void; + 'FunctionExpression:exit'(node: TSESTree.FunctionExpression): void; + 'ArrowFunctionExpression:exit'( + node: TSESTree.ArrowFunctionExpression, + ): void; + } + >; + export = rule; +} + declare module 'eslint/lib/rules/camelcase' { import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; From e7ec6f061f9ce77346906a0d865fd9c18281256d Mon Sep 17 00:00:00 2001 From: Arka Pratim Chaudhuri <105232141+arka1002@users.noreply.github.com> Date: Fri, 23 Feb 2024 17:54:23 +0530 Subject: [PATCH 22/35] docs: from option instead of source in prefer-readonly-parameter-types (#8461) Update prefer-readonly-parameter-types.md --- .../docs/rules/prefer-readonly-parameter-types.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/eslint-plugin/docs/rules/prefer-readonly-parameter-types.md b/packages/eslint-plugin/docs/rules/prefer-readonly-parameter-types.md index 6a5c29ea4cd2..e75ec860faa9 100644 --- a/packages/eslint-plugin/docs/rules/prefer-readonly-parameter-types.md +++ b/packages/eslint-plugin/docs/rules/prefer-readonly-parameter-types.md @@ -150,8 +150,8 @@ Examples of code for this rule with: { "allow": [ "$", - { "source": "file", "name": "Foo" }, - { "source": "lib", "name": "HTMLElement" }, + { "from": "file", "name": "Foo" }, + { "from": "lib", "name": "HTMLElement" }, { "from": "package", "name": "Bar", "package": "bar-lib" } ] } @@ -161,7 +161,7 @@ Examples of code for this rule with: #### ❌ Incorrect -```ts option='{"allow":["$",{"source":"file","name":"Foo"},{"source":"lib","name":"HTMLElement"},{"from":"package","name":"Bar","package":"bar-lib"}]}' +```ts option='{"allow":["$",{"from":"file","name":"Foo"},{"from":"lib","name":"HTMLElement"},{"from":"package","name":"Bar","package":"bar-lib"}]}' interface ThisIsMutable { prop: string; } @@ -185,7 +185,7 @@ function fn2(arg: Wrapper) {} function fn3(arg: WrapperWithOther) {} ``` -```ts option='{"allow":["$",{"source":"file","name":"Foo"},{"source":"lib","name":"HTMLElement"},{"from":"package","name":"Bar","package":"bar-lib"}]}' +```ts option='{"allow":["$",{"from":"file","name":"Foo"},{"from":"lib","name":"HTMLElement"},{"from":"package","name":"Bar","package":"bar-lib"}]}' import { Foo } from 'some-lib'; import { Bar } from 'incorrect-lib'; @@ -205,7 +205,7 @@ function fn3(arg: Bar) {} #### ✅ Correct -```ts option='{"allow":["$",{"source":"file","name":"Foo"},{"source":"lib","name":"HTMLElement"},{"from":"package","name":"Bar","package":"bar-lib"}]}' +```ts option='{"allow":["$",{"from":"file","name":"Foo"},{"from":"lib","name":"HTMLElement"},{"from":"package","name":"Bar","package":"bar-lib"}]}' interface Foo { prop: string; } @@ -222,7 +222,7 @@ function fn1(arg: Foo) {} function fn2(arg: Wrapper) {} ``` -```ts option='{"allow":["$",{"source":"file","name":"Foo"},{"source":"lib","name":"HTMLElement"},{"from":"package","name":"Bar","package":"bar-lib"}]}' +```ts option='{"allow":["$",{"from":"file","name":"Foo"},{"from":"lib","name":"HTMLElement"},{"from":"package","name":"Bar","package":"bar-lib"}]}' import { Bar } from 'bar-lib'; interface Foo { @@ -239,7 +239,7 @@ function fn2(arg: HTMLElement) {} function fn3(arg: Bar) {} ``` -```ts option='{"allow":["$",{"source":"file","name":"Foo"},{"source":"lib","name":"HTMLElement"},{"from":"package","name":"Bar","package":"bar-lib"}]}' +```ts option='{"allow":["$",{"from":"file","name":"Foo"},{"from":"lib","name":"HTMLElement"},{"from":"package","name":"Bar","package":"bar-lib"}]}' import { Foo } from './foo'; // Works because Foo is still a local type - it has to be in the same package From fb82a33c7b44b439ddbfa6c782d86d6043c21f69 Mon Sep 17 00:00:00 2001 From: auvred <61150013+auvred@users.noreply.github.com> Date: Fri, 23 Feb 2024 15:28:32 +0300 Subject: [PATCH 23/35] chore(website): properly align underline for children of `` tag (#8470) --- packages/website/src/css/custom.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/website/src/css/custom.css b/packages/website/src/css/custom.css index 7e1e417c8692..45136fa05e7d 100644 --- a/packages/website/src/css/custom.css +++ b/packages/website/src/css/custom.css @@ -195,3 +195,7 @@ h6 { .markdown a { text-decoration: underline; } + +.markdown a * { + vertical-align: baseline; +} From 8431d9d396ee9b2a09e5d30f3645c2b538a03dcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josh=20Goldberg=20=E2=9C=A8?= Date: Fri, 23 Feb 2024 07:50:15 -0500 Subject: [PATCH 24/35] feat(typescript-estree): add debug logs for useProgramFromProjectService (#8426) * feat(typescript-estree): add debug logs for useProgramFromProjectService * Added a bit more around filePathMatchedBy * Update packages/typescript-estree/src/useProgramFromProjectService.ts --- .../src/useProgramFromProjectService.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/packages/typescript-estree/src/useProgramFromProjectService.ts b/packages/typescript-estree/src/useProgramFromProjectService.ts index 6b3b9f373356..39b51e8366b5 100644 --- a/packages/typescript-estree/src/useProgramFromProjectService.ts +++ b/packages/typescript-estree/src/useProgramFromProjectService.ts @@ -1,3 +1,4 @@ +import debug from 'debug'; import { minimatch } from 'minimatch'; import { createProjectProgram } from './create-program/createProjectProgram'; @@ -9,12 +10,17 @@ import { } from './create-program/shared'; import type { MutableParseSettings } from './parseSettings'; +const log = debug( + 'typescript-eslint:typescript-estree:useProgramFromProjectService', +); + export function useProgramFromProjectService( { allowDefaultProjectForFiles, service }: ProjectServiceSettings, parseSettings: Readonly, hasFullTypeInformation: boolean, ): ASTAndDefiniteProgram | undefined { const filePath = getCanonicalFileName(parseSettings.filePath); + log('Opening project service file for: %s', filePath); const opened = service.openClientFile( ensureAbsolutePath(filePath, service.host.getCurrentDirectory()), @@ -23,7 +29,14 @@ export function useProgramFromProjectService( parseSettings.tsconfigRootDir, ); + log('Opened project service file: %o', opened); + if (hasFullTypeInformation) { + log( + 'Project service type information enabled; checking for file path match on: %o', + allowDefaultProjectForFiles, + ); + if (opened.configFileName) { if (filePathMatchedBy(filePath, allowDefaultProjectForFiles)) { throw new Error( @@ -37,6 +50,8 @@ export function useProgramFromProjectService( } } + log('Retrieving script info and then program for: %s', filePath); + const scriptInfo = service.getScriptInfo(filePath); const program = service .getDefaultProjectForFile(scriptInfo!.fileName, true)! @@ -44,9 +59,12 @@ export function useProgramFromProjectService( .getProgram(); if (!program) { + log('Could not find project service program for: %s', filePath); return undefined; } + log('Found project service program for: %s', filePath); + return createProjectProgram(parseSettings, [program]); } From c1441c8f5bb0f980238c934af6e499baacdd41f2 Mon Sep 17 00:00:00 2001 From: YeonJuan Date: Fri, 23 Feb 2024 22:52:48 +0900 Subject: [PATCH 25/35] fix(eslint-plugin): [prefer-optional-chan] allow typeof for avoiding reference error (#8472) --- .../gatherLogicalOperands.ts | 17 ++++++++- .../src/rules/prefer-optional-chain.ts | 1 + .../prefer-optional-chain.test.ts | 37 +++++++++++++++++++ 3 files changed, 54 insertions(+), 1 deletion(-) diff --git a/packages/eslint-plugin/src/rules/prefer-optional-chain-utils/gatherLogicalOperands.ts b/packages/eslint-plugin/src/rules/prefer-optional-chain-utils/gatherLogicalOperands.ts index 73ce6d9255aa..986b2e5f8575 100644 --- a/packages/eslint-plugin/src/rules/prefer-optional-chain-utils/gatherLogicalOperands.ts +++ b/packages/eslint-plugin/src/rules/prefer-optional-chain-utils/gatherLogicalOperands.ts @@ -3,6 +3,7 @@ import type { TSESTree, } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; +import type { SourceCode } from '@typescript-eslint/utils/ts-eslint'; import { isBigIntLiteralType, isBooleanLiteralType, @@ -122,6 +123,7 @@ function isValidFalseBooleanCheckType( export function gatherLogicalOperands( node: TSESTree.LogicalExpression, parserServices: ParserServicesWithTypeInformation, + sourceCode: Readonly, options: PreferOptionalChainOptions, ): { operands: Operand[]; @@ -157,7 +159,20 @@ export function gatherLogicalOperands( comparedExpression.type === AST_NODE_TYPES.UnaryExpression && comparedExpression.operator === 'typeof' ) { - // typeof x === 'undefined' + const argument = comparedExpression.argument; + if (argument.type === AST_NODE_TYPES.Identifier) { + const reference = sourceCode + .getScope(argument) + .references.find(ref => ref.identifier.name === argument.name); + + if (!reference?.resolved?.defs.length) { + // typeof window === 'undefined' + result.push({ type: OperandValidity.Invalid }); + continue; + } + } + + // typeof x.y === 'undefined' result.push({ type: OperandValidity.Valid, comparedName: comparedExpression.argument, diff --git a/packages/eslint-plugin/src/rules/prefer-optional-chain.ts b/packages/eslint-plugin/src/rules/prefer-optional-chain.ts index 24791c5841ed..605045b99fd2 100644 --- a/packages/eslint-plugin/src/rules/prefer-optional-chain.ts +++ b/packages/eslint-plugin/src/rules/prefer-optional-chain.ts @@ -179,6 +179,7 @@ export default createRule< const { operands, newlySeenLogicals } = gatherLogicalOperands( node, parserServices, + context.sourceCode, options, ); diff --git a/packages/eslint-plugin/tests/rules/prefer-optional-chain/prefer-optional-chain.test.ts b/packages/eslint-plugin/tests/rules/prefer-optional-chain/prefer-optional-chain.test.ts index 852296721a74..cee379d45ac2 100644 --- a/packages/eslint-plugin/tests/rules/prefer-optional-chain/prefer-optional-chain.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-optional-chain/prefer-optional-chain.test.ts @@ -907,6 +907,7 @@ describe('hand-crafted cases', () => { declare const x: 0n | { a: string }; !x || x.a; `, + "typeof globalThis !== 'undefined' && globalThis.Array();", ], invalid: [ // two errors @@ -1915,6 +1916,42 @@ describe('hand-crafted cases', () => { }, ], }, + { + code: ` + function foo(globalThis?: { Array: Function }) { + typeof globalThis !== 'undefined' && globalThis.Array(); + } + `, + output: ` + function foo(globalThis?: { Array: Function }) { + globalThis?.Array(); + } + `, + errors: [ + { + messageId: 'preferOptionalChain', + }, + ], + }, + { + code: ` + typeof globalThis !== 'undefined' && globalThis.Array && globalThis.Array(); + `, + output: null, + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: ` + typeof globalThis !== 'undefined' && globalThis.Array?.(); + `, + }, + ], + }, + ], + }, ], }); }); From 14589205e405d91605be84c0492c02458efe5f54 Mon Sep 17 00:00:00 2001 From: YeonJuan Date: Sat, 24 Feb 2024 00:13:41 +0900 Subject: [PATCH 26/35] fix(eslint-plugin): [no-misused-promises] improve check union types (#8534) * fix(eslint-plugin): [no-misused-promises] improve check union types * apply reviews --- .../src/rules/no-misused-promises.ts | 9 +++----- .../tests/rules/no-misused-promises.test.ts | 21 +++++++++++++++++++ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/packages/eslint-plugin/src/rules/no-misused-promises.ts b/packages/eslint-plugin/src/rules/no-misused-promises.ts index fa5f9ae5796b..b7d556c893f0 100644 --- a/packages/eslint-plugin/src/rules/no-misused-promises.ts +++ b/packages/eslint-plugin/src/rules/no-misused-promises.ts @@ -674,10 +674,7 @@ function isVoidReturningFunctionType( */ function returnsThenable(checker: ts.TypeChecker, node: ts.Node): boolean { const type = checker.getApparentType(checker.getTypeAtLocation(node)); - - if (anySignatureIsThenableType(checker, node, type)) { - return true; - } - - return false; + return tsutils + .unionTypeParts(type) + .some(t => anySignatureIsThenableType(checker, node, t)); } diff --git a/packages/eslint-plugin/tests/rules/no-misused-promises.test.ts b/packages/eslint-plugin/tests/rules/no-misused-promises.test.ts index a6d6f1db5ad2..1910dd4f93f9 100644 --- a/packages/eslint-plugin/tests/rules/no-misused-promises.test.ts +++ b/packages/eslint-plugin/tests/rules/no-misused-promises.test.ts @@ -474,6 +474,11 @@ restTuple('Hello'); }; } `, + ` +declare function foo(cb: undefined | (() => void)); +declare const bar: undefined | (() => void); +foo(bar); + `, // https://github.com/typescript-eslint/typescript-eslint/issues/6637 { code: ` @@ -1227,5 +1232,21 @@ const test: ReturnsRecord = () => { `, errors: [{ line: 7, messageId: 'voidReturnProperty' }], }, + { + code: ` +declare function foo(cb: undefined | (() => void)); +declare const bar: undefined | (() => Promise); +foo(bar); + `, + errors: [{ line: 4, messageId: 'voidReturnArgument' }], + }, + { + code: ` +declare function foo(cb: string & (() => void)); +declare const bar: string & (() => Promise); +foo(bar); + `, + errors: [{ line: 4, messageId: 'voidReturnArgument' }], + }, ], }); From 60c1cd35dd057f0e6d836f1c38d255f275002c89 Mon Sep 17 00:00:00 2001 From: YeonJuan Date: Sat, 24 Feb 2024 00:20:55 +0900 Subject: [PATCH 27/35] fix(eslint-plugin): [no-use-before-define] fix false positive type reference in as, satisfies (#8474) * fix(eslint-plugin): [no-use-before-define] fix false positive type reference in as, satisfies * chore: add testcase * refactor: condition --- .../src/rules/no-use-before-define.ts | 2 +- .../tests/rules/no-use-before-define.test.ts | 65 +++++++++++++++++++ 2 files changed, 66 insertions(+), 1 deletion(-) diff --git a/packages/eslint-plugin/src/rules/no-use-before-define.ts b/packages/eslint-plugin/src/rules/no-use-before-define.ts index c08a21b4bac5..d577773de9ef 100644 --- a/packages/eslint-plugin/src/rules/no-use-before-define.ts +++ b/packages/eslint-plugin/src/rules/no-use-before-define.ts @@ -317,7 +317,7 @@ export default createRule({ ): boolean { return ( variable.identifiers[0].range[1] <= reference.identifier.range[1] && - !isInInitializer(variable, reference) + !(reference.isValueReference && isInInitializer(variable, reference)) ); } diff --git a/packages/eslint-plugin/tests/rules/no-use-before-define.test.ts b/packages/eslint-plugin/tests/rules/no-use-before-define.test.ts index 44ce43101e79..38efe428dd1a 100644 --- a/packages/eslint-plugin/tests/rules/no-use-before-define.test.ts +++ b/packages/eslint-plugin/tests/rules/no-use-before-define.test.ts @@ -529,6 +529,52 @@ class A { } } `, + { + code: ` +const obj = { + foo: 'foo-value', + bar: 'bar-value', +} satisfies { + [key in 'foo' | 'bar']: \`\${key}-value\`; +}; + `, + options: [{ ignoreTypeReferences: false }], + }, + { + code: ` +const obj = { + foo: 'foo-value', + bar: 'bar-value', +} as { + [key in 'foo' | 'bar']: \`\${key}-value\`; +}; + `, + options: [{ ignoreTypeReferences: false }], + }, + { + code: ` +const obj = { + foo: { + foo: 'foo', + } as { + [key in 'foo' | 'bar']: key; + }, +}; + `, + options: [{ ignoreTypeReferences: false }], + }, + { + code: ` +const foo = { + bar: 'bar', +} satisfies { + bar: typeof baz; +}; + +const baz = ''; + `, + options: [{ ignoreTypeReferences: true }], + }, ], invalid: [ { @@ -1104,6 +1150,25 @@ const Foo = { }, ], }, + { + code: ` +const foo = { + bar: 'bar', +} satisfies { + bar: typeof baz; +}; + +const baz = ''; + `, + options: [{ ignoreTypeReferences: false }], + errors: [ + { + messageId: 'noUseBeforeDefine', + data: { name: 'baz' }, + type: AST_NODE_TYPES.Identifier, + }, + ], + }, // "variables" option { From fa679550052f122c82bc4fd88d2e2c9138824bc3 Mon Sep 17 00:00:00 2001 From: Mark de Dios <99303358+peanutenthusiast@users.noreply.github.com> Date: Fri, 23 Feb 2024 08:37:37 -0800 Subject: [PATCH 28/35] chore: drop T from internal types (#8521) * Add test cases per #8380 * Revert "Add test cases per #8380" This reverts commit f3b9d24634942386aa5df5f681e96f88e54112d3. * Remove t prefix from DefinitionBase, ScopeBase, and getSpecificNode fiiles in scope manager * remove t prefixed internal variables from RuleModule * fix internal types for eslint-plugin/src/util/misc * Addresss other files where T prefixes are used for internal types * Remove t prefix from internal types * Revert edit to rule.d.ts file in eslint-plugin * remove t prefixess from rule create function --------- Co-authored-by: auvred <61150013+auvred@users.noreply.github.com> --- .../src/util/collectUnusedVariables.ts | 18 ++--- packages/eslint-plugin/src/util/misc.ts | 12 +-- .../eslint-plugin/src/util/objectIterators.ts | 16 ++-- packages/eslint-plugin/tests/RuleTester.ts | 22 +++--- .../prefer-string-starts-ends-with.test.ts | 30 ++++--- packages/rule-tester/src/RuleTester.ts | 78 +++++++++---------- .../rule-tester/src/types/InvalidTestCase.ts | 18 ++--- .../rule-tester/src/types/ValidTestCase.ts | 4 +- packages/rule-tester/src/types/index.ts | 16 ++-- .../rule-tester/src/utils/hasOwnProperty.ts | 10 +-- .../src/definition/DefinitionBase.ts | 18 ++--- packages/scope-manager/src/scope/ScopeBase.ts | 18 ++--- .../tests/test-utils/getSpecificNode.ts | 22 +++--- .../test-utils/serializers/baseSerializer.ts | 18 ++--- .../src/parseSettings/ExpiringCache.ts | 10 +-- .../typescript-estree/src/parser-options.ts | 8 +- .../src/eslint-utils/InferTypesFromRule.ts | 20 ++--- .../utils/src/eslint-utils/RuleCreator.ts | 56 +++++++------ .../utils/src/eslint-utils/applyDefault.ts | 12 +-- .../src/eslint-utils/getParserServices.ts | 24 +++--- packages/utils/src/ts-eslint/Linter.ts | 18 ++--- packages/utils/src/ts-eslint/Rule.ts | 57 +++++++------- packages/utils/src/ts-eslint/RuleTester.ts | 42 +++++----- packages/utils/src/ts-eslint/SourceCode.ts | 15 ++-- 24 files changed, 279 insertions(+), 283 deletions(-) diff --git a/packages/eslint-plugin/src/util/collectUnusedVariables.ts b/packages/eslint-plugin/src/util/collectUnusedVariables.ts index 80b05c7c43d4..dbe749e62900 100644 --- a/packages/eslint-plugin/src/util/collectUnusedVariables.ts +++ b/packages/eslint-plugin/src/util/collectUnusedVariables.ts @@ -12,8 +12,8 @@ import { } from '@typescript-eslint/utils'; class UnusedVarsVisitor< - TMessageIds extends string, - TOptions extends readonly unknown[], + MessageIds extends string, + Options extends readonly unknown[], > extends Visitor { private static readonly RESULTS_CACHE = new WeakMap< TSESTree.Program, @@ -23,7 +23,7 @@ class UnusedVarsVisitor< readonly #scopeManager: TSESLint.Scope.ScopeManager; // readonly #unusedVariables = new Set(); - private constructor(context: TSESLint.RuleContext) { + private constructor(context: TSESLint.RuleContext) { super({ visitChildrenEvenIfSelectorExists: true, }); @@ -35,10 +35,10 @@ class UnusedVarsVisitor< } public static collectUnusedVariables< - TMessageIds extends string, - TOptions extends readonly unknown[], + MessageIds extends string, + Options extends readonly unknown[], >( - context: TSESLint.RuleContext, + context: TSESLint.RuleContext, ): ReadonlySet { const program = context.sourceCode.ast; const cached = this.RESULTS_CACHE.get(program); @@ -749,10 +749,10 @@ function isUsedVariable(variable: TSESLint.Scope.Variable): boolean { * - variables within ambient module declarations */ function collectUnusedVariables< - TMessageIds extends string, - TOptions extends readonly unknown[], + MessageIds extends string, + Options extends readonly unknown[], >( - context: Readonly>, + context: Readonly>, ): ReadonlySet { return UnusedVarsVisitor.collectUnusedVariables(context); } diff --git a/packages/eslint-plugin/src/util/misc.ts b/packages/eslint-plugin/src/util/misc.ts index 0ac711a3facc..8c3604d77d98 100644 --- a/packages/eslint-plugin/src/util/misc.ts +++ b/packages/eslint-plugin/src/util/misc.ts @@ -149,13 +149,13 @@ function getNameFromMember( } type ExcludeKeys< - TObj extends Record, - TKeys extends keyof TObj, -> = { [k in Exclude]: TObj[k] }; + Obj extends Record, + Keys extends keyof Obj, +> = { [k in Exclude]: Obj[k] }; type RequireKeys< - TObj extends Record, - TKeys extends keyof TObj, -> = ExcludeKeys & { [k in TKeys]-?: Exclude }; + Obj extends Record, + Keys extends keyof Obj, +> = ExcludeKeys & { [k in Keys]-?: Exclude }; function getEnumNames(myEnum: Record): T[] { return Object.keys(myEnum).filter(x => isNaN(parseInt(x))) as T[]; diff --git a/packages/eslint-plugin/src/util/objectIterators.ts b/packages/eslint-plugin/src/util/objectIterators.ts index 474d64349ff6..ddea38a1981f 100644 --- a/packages/eslint-plugin/src/util/objectIterators.ts +++ b/packages/eslint-plugin/src/util/objectIterators.ts @@ -8,22 +8,22 @@ function objectForEachKey>( } } -function objectMapKey, TReturn>( +function objectMapKey, Return>( obj: T, - callback: (key: keyof T) => TReturn, -): TReturn[] { - const values: TReturn[] = []; + callback: (key: keyof T) => Return, +): Return[] { + const values: Return[] = []; objectForEachKey(obj, key => { values.push(callback(key)); }); return values; } -function objectReduceKey, TAccumulator>( +function objectReduceKey, Accumulator>( obj: T, - callback: (acc: TAccumulator, key: keyof T) => TAccumulator, - initial: TAccumulator, -): TAccumulator { + callback: (acc: Accumulator, key: keyof T) => Accumulator, + initial: Accumulator, +): Accumulator { let accumulator = initial; objectForEachKey(obj, key => { accumulator = callback(accumulator, key); diff --git a/packages/eslint-plugin/tests/RuleTester.ts b/packages/eslint-plugin/tests/RuleTester.ts index 741b33e0260c..1ad34648a8b0 100644 --- a/packages/eslint-plugin/tests/RuleTester.ts +++ b/packages/eslint-plugin/tests/RuleTester.ts @@ -18,9 +18,9 @@ export function getFixturesRootDir(): string { * * @deprecated - DO NOT USE THIS FOR NEW RULES */ -export function batchedSingleLineTests( - test: ValidTestCase, -): ValidTestCase[]; +export function batchedSingleLineTests( + test: ValidTestCase, +): ValidTestCase[]; /** * Converts a batch of single line tests into a number of separate test cases. * This makes it easier to write tests which use the same options. @@ -35,17 +35,17 @@ export function batchedSingleLineTests( * @deprecated - DO NOT USE THIS FOR NEW RULES */ export function batchedSingleLineTests< - TMessageIds extends string, - TOptions extends readonly unknown[], + MessageIds extends string, + Options extends readonly unknown[], >( - test: InvalidTestCase, -): InvalidTestCase[]; + test: InvalidTestCase, +): InvalidTestCase[]; export function batchedSingleLineTests< - TMessageIds extends string, - TOptions extends readonly unknown[], + MessageIds extends string, + Options extends readonly unknown[], >( - options: InvalidTestCase | ValidTestCase, -): (InvalidTestCase | ValidTestCase)[] { + options: InvalidTestCase | ValidTestCase, +): (InvalidTestCase | ValidTestCase)[] { // -- eslint counts lines from 1 const lineOffset = options.code.startsWith('\n') ? 2 : 1; const output = diff --git a/packages/eslint-plugin/tests/rules/prefer-string-starts-ends-with.test.ts b/packages/eslint-plugin/tests/rules/prefer-string-starts-ends-with.test.ts index e51cbe3a8d87..c4e3ff83b8a9 100644 --- a/packages/eslint-plugin/tests/rules/prefer-string-starts-ends-with.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-string-starts-ends-with.test.ts @@ -1060,24 +1060,22 @@ ruleTester.run('prefer-string-starts-ends-with', rule, { ]), }); -type Case> = - | TSESLint.InvalidTestCase - | TSESLint.ValidTestCase; -function addOptional>( - cases: (TSESLint.ValidTestCase | string)[], -): TSESLint.ValidTestCase[]; +type Case> = + | TSESLint.InvalidTestCase + | TSESLint.ValidTestCase; +function addOptional>( + cases: (TSESLint.ValidTestCase | string)[], +): TSESLint.ValidTestCase[]; function addOptional< - TMessageIds extends string, - TOptions extends Readonly, + MessageIds extends string, + Options extends Readonly, >( - cases: TSESLint.InvalidTestCase[], -): TSESLint.InvalidTestCase[]; + cases: TSESLint.InvalidTestCase[], +): TSESLint.InvalidTestCase[]; function addOptional< - TMessageIds extends string, - TOptions extends Readonly, ->( - cases: (Case | string)[], -): Case[] { + MessageIds extends string, + Options extends Readonly, +>(cases: (Case | string)[]): Case[] { function makeOptional(code: string): string; function makeOptional(code: string | null | undefined): string | null; function makeOptional(code: string | null | undefined): string | null { @@ -1093,7 +1091,7 @@ function addOptional< ); } - return cases.reduce[]>((acc, c) => { + return cases.reduce[]>((acc, c) => { if (typeof c === 'string') { acc.push({ code: c, diff --git a/packages/rule-tester/src/RuleTester.ts b/packages/rule-tester/src/RuleTester.ts index ba482063d7c0..e0ab970d32f8 100644 --- a/packages/rule-tester/src/RuleTester.ts +++ b/packages/rule-tester/src/RuleTester.ts @@ -146,21 +146,21 @@ export class RuleTester extends TestFramework { /** * Adds the `only` property to a test to run it in isolation. */ - static only>( - item: ValidTestCase | string, - ): ValidTestCase; + static only>( + item: ValidTestCase | string, + ): ValidTestCase; /** * Adds the `only` property to a test to run it in isolation. */ - static only>( - item: InvalidTestCase, - ): InvalidTestCase; - static only>( + static only>( + item: InvalidTestCase, + ): InvalidTestCase; + static only>( item: - | InvalidTestCase - | ValidTestCase + | InvalidTestCase + | ValidTestCase | string, - ): InvalidTestCase | ValidTestCase { + ): InvalidTestCase | ValidTestCase { if (typeof item === 'string') { return { code: item, only: true }; } @@ -176,11 +176,11 @@ export class RuleTester extends TestFramework { } #normalizeTests< - TMessageIds extends string, - TOptions extends readonly unknown[], + MessageIds extends string, + Options extends readonly unknown[], >( - rawTests: RunTests, - ): NormalizedRunTests { + rawTests: RunTests, + ): NormalizedRunTests { /* Automatically add a filename to the tests to enable type-aware tests to "just work". This saves users having to verbosely and manually add the filename to every @@ -205,11 +205,9 @@ export class RuleTester extends TestFramework { return filename; }; const normalizeTest = < - TMessageIds extends string, - TOptions extends readonly unknown[], - T extends - | InvalidTestCase - | ValidTestCase, + MessageIds extends string, + Options extends readonly unknown[], + T extends InvalidTestCase | ValidTestCase, >( test: T, ): T => { @@ -239,7 +237,7 @@ export class RuleTester extends TestFramework { // convenience iterator to make it easy to loop all tests without a concat const allTestsIterator = { - *[Symbol.iterator](): Generator, void> { + *[Symbol.iterator](): Generator, void> { for (const testCase of normalizedTests.valid) { yield testCase; } @@ -285,9 +283,7 @@ export class RuleTester extends TestFramework { just disappearing without a trace. */ const maybeMarkAsOnly = < - T extends - | InvalidTestCase - | ValidTestCase, + T extends InvalidTestCase | ValidTestCase, >( test: T, ): T => { @@ -305,10 +301,10 @@ export class RuleTester extends TestFramework { /** * Adds a new rule test to execute. */ - run( + run( ruleName: string, - rule: RuleModule, - test: RunTests, + rule: RuleModule, + test: RunTests, ): void { const constructor = this.constructor as typeof RuleTester; @@ -366,7 +362,7 @@ export class RuleTester extends TestFramework { ruleName, Object.assign({}, rule, { // Create a wrapper rule that freezes the `context` properties. - create(context: RuleContext) { + create(context: RuleContext) { freezeDeeply(context.options); freezeDeeply(context.settings); freezeDeeply(context.parserOptions); @@ -381,7 +377,7 @@ export class RuleTester extends TestFramework { const normalizedTests = this.#normalizeTests(test); function getTestMethod( - test: ValidTestCase, + test: ValidTestCase, ): 'it' | 'itOnly' | 'itSkip' { if (test.skip) { return 'itSkip'; @@ -437,12 +433,12 @@ export class RuleTester extends TestFramework { * Use @private instead of #private to expose it for testing purposes */ private runRuleForItem< - TMessageIds extends string, - TOptions extends readonly unknown[], + MessageIds extends string, + Options extends readonly unknown[], >( ruleName: string, - rule: RuleModule, - item: InvalidTestCase | ValidTestCase, + rule: RuleModule, + item: InvalidTestCase | ValidTestCase, ): { messages: Linter.LintMessage[]; output: string; @@ -627,14 +623,14 @@ export class RuleTester extends TestFramework { * all valid cases go through this */ #testValidTemplate< - TMessageIds extends string, - TOptions extends readonly unknown[], + MessageIds extends string, + Options extends readonly unknown[], >( ruleName: string, - rule: RuleModule, - itemIn: ValidTestCase | string, + rule: RuleModule, + itemIn: ValidTestCase | string, ): void { - const item: ValidTestCase = + const item: ValidTestCase = typeof itemIn === 'object' ? itemIn : { code: itemIn }; assert.ok( @@ -669,12 +665,12 @@ export class RuleTester extends TestFramework { * all invalid cases go through this. */ #testInvalidTemplate< - TMessageIds extends string, - TOptions extends readonly unknown[], + MessageIds extends string, + Options extends readonly unknown[], >( ruleName: string, - rule: RuleModule, - item: InvalidTestCase, + rule: RuleModule, + item: InvalidTestCase, ): void { assert.ok( typeof item.code === 'string', diff --git a/packages/rule-tester/src/types/InvalidTestCase.ts b/packages/rule-tester/src/types/InvalidTestCase.ts index 1bef9e2b89fb..96754682cc4b 100644 --- a/packages/rule-tester/src/types/InvalidTestCase.ts +++ b/packages/rule-tester/src/types/InvalidTestCase.ts @@ -4,11 +4,11 @@ import type { ReportDescriptorMessageData } from '@typescript-eslint/utils/ts-es import type { DependencyConstraint } from './DependencyConstraint'; import type { ValidTestCase } from './ValidTestCase'; -export interface SuggestionOutput { +export interface SuggestionOutput { /** * Reported message ID. */ - readonly messageId: TMessageIds; + readonly messageId: MessageIds; /** * The data used to fill the message template. */ @@ -23,7 +23,7 @@ export interface SuggestionOutput { // readonly desc?: string; } -export interface TestCaseError { +export interface TestCaseError { /** * The 1-based column number of the reported start location. */ @@ -47,11 +47,11 @@ export interface TestCaseError { /** * Reported message ID. */ - readonly messageId: TMessageIds; + readonly messageId: MessageIds; /** * Reported suggestions. */ - readonly suggestions?: readonly SuggestionOutput[] | null; + readonly suggestions?: readonly SuggestionOutput[] | null; /** * The type of the reported AST node. */ @@ -62,13 +62,13 @@ export interface TestCaseError { } export interface InvalidTestCase< - TMessageIds extends string, - TOptions extends Readonly, -> extends ValidTestCase { + MessageIds extends string, + Options extends Readonly, +> extends ValidTestCase { /** * Expected errors. */ - readonly errors: readonly TestCaseError[]; + readonly errors: readonly TestCaseError[]; /** * The expected code after autofixes are applied. If set to `null`, the test runner will assert that no autofix is suggested. */ diff --git a/packages/rule-tester/src/types/ValidTestCase.ts b/packages/rule-tester/src/types/ValidTestCase.ts index 11b6c9e7e4b0..c65b416917ca 100644 --- a/packages/rule-tester/src/types/ValidTestCase.ts +++ b/packages/rule-tester/src/types/ValidTestCase.ts @@ -6,7 +6,7 @@ import type { import type { DependencyConstraint } from './DependencyConstraint'; -export interface ValidTestCase> { +export interface ValidTestCase> { /** * Name for the test case. */ @@ -30,7 +30,7 @@ export interface ValidTestCase> { /** * Options for the test case. */ - readonly options?: Readonly; + readonly options?: Readonly; /** * The absolute path for the parser. */ diff --git a/packages/rule-tester/src/types/index.ts b/packages/rule-tester/src/types/index.ts index a4901875d9e6..7169810b11e2 100644 --- a/packages/rule-tester/src/types/index.ts +++ b/packages/rule-tester/src/types/index.ts @@ -11,20 +11,20 @@ export type TesterConfigWithDefaults = Mutable< >; export interface RunTests< - TMessageIds extends string, - TOptions extends Readonly, + MessageIds extends string, + Options extends Readonly, > { // RuleTester.run also accepts strings for valid cases - readonly valid: readonly (ValidTestCase | string)[]; - readonly invalid: readonly InvalidTestCase[]; + readonly valid: readonly (ValidTestCase | string)[]; + readonly invalid: readonly InvalidTestCase[]; } export interface NormalizedRunTests< - TMessageIds extends string, - TOptions extends Readonly, + MessageIds extends string, + Options extends Readonly, > { - readonly valid: readonly ValidTestCase[]; - readonly invalid: readonly InvalidTestCase[]; + readonly valid: readonly ValidTestCase[]; + readonly invalid: readonly InvalidTestCase[]; } export type { ValidTestCase } from './ValidTestCase'; diff --git a/packages/rule-tester/src/utils/hasOwnProperty.ts b/packages/rule-tester/src/utils/hasOwnProperty.ts index a8816f89fe85..fb49345c2327 100644 --- a/packages/rule-tester/src/utils/hasOwnProperty.ts +++ b/packages/rule-tester/src/utils/hasOwnProperty.ts @@ -1,8 +1,8 @@ // typed so that TS can remove optionality export const hasOwnProperty = Function.call.bind(Object.hasOwnProperty) as < - TObj extends object, - TK extends keyof TObj, + Obj extends object, + K extends keyof Obj, >( - obj: TObj, - key: TK, -) => obj is TObj & { [key in TK]-?: TObj[key] }; + obj: Obj, + key: K, +) => obj is Obj & { [key in K]-?: Obj[key] }; diff --git a/packages/scope-manager/src/definition/DefinitionBase.ts b/packages/scope-manager/src/definition/DefinitionBase.ts index 01976f164eb0..f382ca303f30 100644 --- a/packages/scope-manager/src/definition/DefinitionBase.ts +++ b/packages/scope-manager/src/definition/DefinitionBase.ts @@ -6,10 +6,10 @@ import type { DefinitionType } from './DefinitionType'; const generator = createIdGenerator(); abstract class DefinitionBase< - TType extends DefinitionType, - TNode extends TSESTree.Node, - TParent extends TSESTree.Node | null, - TName extends TSESTree.Node, + Type extends DefinitionType, + Node extends TSESTree.Node, + Parent extends TSESTree.Node | null, + Name extends TSESTree.Node, > { /** * A unique ID for this instance - primarily used to help debugging and testing @@ -20,27 +20,27 @@ abstract class DefinitionBase< * The type of the definition * @public */ - public readonly type: TType; + public readonly type: Type; /** * The `Identifier` node of this definition * @public */ - public readonly name: TName; + public readonly name: Name; /** * The enclosing node of the name. * @public */ - public readonly node: TNode; + public readonly node: Node; /** * the enclosing statement node of the identifier. * @public */ - public readonly parent: TParent; + public readonly parent: Parent; - constructor(type: TType, name: TName, node: TNode, parent: TParent) { + constructor(type: Type, name: Name, node: Node, parent: Parent) { this.type = type; this.name = name; this.node = node; diff --git a/packages/scope-manager/src/scope/ScopeBase.ts b/packages/scope-manager/src/scope/ScopeBase.ts index 1cdb2c98586c..f5afb3aa4ad9 100644 --- a/packages/scope-manager/src/scope/ScopeBase.ts +++ b/packages/scope-manager/src/scope/ScopeBase.ts @@ -136,9 +136,9 @@ const VARIABLE_SCOPE_TYPES = new Set([ type AnyScope = ScopeBase; abstract class ScopeBase< - TType extends ScopeType, - TBlock extends TSESTree.Node, - TUpper extends Scope | null, + Type extends ScopeType, + Block extends TSESTree.Node, + Upper extends Scope | null, > { /** * A unique ID for this instance - primarily used to help debugging and testing @@ -149,7 +149,7 @@ abstract class ScopeBase< * The AST node which created this scope. * @public */ - public readonly block: TBlock; + public readonly block: Block; /** * The array of child scopes. This does not include grandchild scopes. * @public @@ -204,12 +204,12 @@ abstract class ScopeBase< * The type of scope * @public */ - public readonly type: TType; + public readonly type: Type; /** * Reference to the parent {@link Scope}. * @public */ - public readonly upper: TUpper; + public readonly upper: Upper; /** * The scoped {@link Variable}s of this scope. * In the case of a 'function' scope this includes the automatic argument `arguments` as its first element, as well @@ -227,9 +227,9 @@ abstract class ScopeBase< constructor( scopeManager: ScopeManager, - type: TType, - upperScope: TUpper, - block: TBlock, + type: Type, + upperScope: Upper, + block: Block, isMethodDefinition: boolean, ) { const upperScopeAsScopeBase = upperScope; diff --git a/packages/scope-manager/tests/test-utils/getSpecificNode.ts b/packages/scope-manager/tests/test-utils/getSpecificNode.ts index 520d43bc7a86..a3d549cfd2d8 100644 --- a/packages/scope-manager/tests/test-utils/getSpecificNode.ts +++ b/packages/scope-manager/tests/test-utils/getSpecificNode.ts @@ -2,22 +2,22 @@ import type { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/types'; import { simpleTraverse } from '@typescript-eslint/typescript-estree'; function getSpecificNode< - TSelector extends AST_NODE_TYPES, - TNode extends Extract, + Selector extends AST_NODE_TYPES, + Node extends Extract, >( ast: TSESTree.Node, - selector: TSelector, - cb?: (node: TNode) => boolean | null | undefined, -): TNode; + selector: Selector, + cb?: (node: Node) => boolean | null | undefined, +): Node; function getSpecificNode< - TSelector extends AST_NODE_TYPES, - TNode extends Extract, - TReturnType extends TSESTree.Node, + Selector extends AST_NODE_TYPES, + Node extends Extract, + ReturnType extends TSESTree.Node, >( ast: TSESTree.Node, - selector: TSelector, - cb: (node: TNode) => TReturnType | null | undefined, -): TReturnType; + selector: Selector, + cb: (node: Node) => ReturnType | null | undefined, +): ReturnType; function getSpecificNode( ast: TSESTree.Node, diff --git a/packages/scope-manager/tests/test-utils/serializers/baseSerializer.ts b/packages/scope-manager/tests/test-utils/serializers/baseSerializer.ts index 733e4971c78b..cb619d683a5b 100644 --- a/packages/scope-manager/tests/test-utils/serializers/baseSerializer.ts +++ b/packages/scope-manager/tests/test-utils/serializers/baseSerializer.ts @@ -2,20 +2,20 @@ import type { NewPlugin } from 'pretty-format'; type ConstructorSignature = new (...args: never) => unknown; -function createSerializer( - type: TConstructor, - keys: (keyof InstanceType)[], +function createSerializer( + type: Constructor, + keys: (keyof InstanceType)[], ): NewPlugin; // A hack of signature to enable this to work with abstract classes -function createSerializer( +function createSerializer( abstractConstructor: unknown, - keys: (keyof InstanceType)[], - instanceConstructorThatsNeverUsed: TConstructor, + keys: (keyof InstanceType)[], + instanceConstructorThatsNeverUsed: Constructor, ): NewPlugin; -function createSerializer( - type: TConstructor, - keys: (keyof InstanceType)[], +function createSerializer( + type: Constructor, + keys: (keyof InstanceType)[], ): NewPlugin { const SEEN_THINGS = new Set(); diff --git a/packages/typescript-estree/src/parseSettings/ExpiringCache.ts b/packages/typescript-estree/src/parseSettings/ExpiringCache.ts index 344942747917..d02bdfb0b1f4 100644 --- a/packages/typescript-estree/src/parseSettings/ExpiringCache.ts +++ b/packages/typescript-estree/src/parseSettings/ExpiringCache.ts @@ -11,13 +11,13 @@ export interface CacheLike { /** * A map with key-level expiration. */ -export class ExpiringCache implements CacheLike { +export class ExpiringCache implements CacheLike { readonly #cacheDurationSeconds: CacheDurationSeconds; readonly #map = new Map< - TKey, + Key, Readonly<{ - value: TValue; + value: Value; lastSeen: [number, number]; }> >(); @@ -26,7 +26,7 @@ export class ExpiringCache implements CacheLike { this.#cacheDurationSeconds = cacheDurationSeconds; } - set(key: TKey, value: TValue): this { + set(key: Key, value: Value): this { this.#map.set(key, { value, lastSeen: @@ -38,7 +38,7 @@ export class ExpiringCache implements CacheLike { return this; } - get(key: TKey): TValue | undefined { + get(key: Key): Value | undefined { const entry = this.#map.get(key); if (entry?.value != null) { if (this.#cacheDurationSeconds === 'Infinity') { diff --git a/packages/typescript-estree/src/parser-options.ts b/packages/typescript-estree/src/parser-options.ts index 208de53b55cc..0aeb3e4a4356 100644 --- a/packages/typescript-estree/src/parser-options.ts +++ b/packages/typescript-estree/src/parser-options.ts @@ -233,15 +233,15 @@ export type TSESTreeOptions = ParseAndGenerateServicesOptions; // This lets us use generics to type the return value, and removes the need to // handle the undefined type in the get method -export interface ParserWeakMap { - get(key: TKey): TValue; +export interface ParserWeakMap { + get(key: Key): Value; has(key: unknown): boolean; } export interface ParserWeakMapESTreeToTSNode< - TKey extends TSESTree.Node = TSESTree.Node, + Key extends TSESTree.Node = TSESTree.Node, > { - get(key: TKeyBase): TSESTreeToTSNode; + get(key: KeyBase): TSESTreeToTSNode; has(key: unknown): boolean; } diff --git a/packages/utils/src/eslint-utils/InferTypesFromRule.ts b/packages/utils/src/eslint-utils/InferTypesFromRule.ts index 215a869eaddf..c716912cdf1f 100644 --- a/packages/utils/src/eslint-utils/InferTypesFromRule.ts +++ b/packages/utils/src/eslint-utils/InferTypesFromRule.ts @@ -1,23 +1,23 @@ import type { RuleCreateFunction, RuleModule } from '../ts-eslint'; /** - * Uses type inference to fetch the TOptions type from the given RuleModule + * Uses type inference to fetch the Options type from the given RuleModule */ type InferOptionsTypeFromRule = - T extends RuleModule - ? TOptions - : T extends RuleCreateFunction - ? TOptions + T extends RuleModule + ? Options + : T extends RuleCreateFunction + ? Options : unknown; /** - * Uses type inference to fetch the TMessageIds type from the given RuleModule + * Uses type inference to fetch the MessageIds type from the given RuleModule */ type InferMessageIdsTypeFromRule = - T extends RuleModule - ? TMessageIds - : T extends RuleCreateFunction - ? TMessageIds + T extends RuleModule + ? MessageIds + : T extends RuleCreateFunction + ? MessageIds : unknown; export { InferOptionsTypeFromRule, InferMessageIdsTypeFromRule }; diff --git a/packages/utils/src/eslint-utils/RuleCreator.ts b/packages/utils/src/eslint-utils/RuleCreator.ts index 2ca060bef169..40ebe7f49120 100644 --- a/packages/utils/src/eslint-utils/RuleCreator.ts +++ b/packages/utils/src/eslint-utils/RuleCreator.ts @@ -11,36 +11,36 @@ export type { RuleListener, RuleModule }; // we automatically add the url export type NamedCreateRuleMetaDocs = Omit; -export type NamedCreateRuleMeta = Omit< - RuleMetaData, +export type NamedCreateRuleMeta = Omit< + RuleMetaData, 'docs' > & { docs: NamedCreateRuleMetaDocs; }; export interface RuleCreateAndOptions< - TOptions extends readonly unknown[], - TMessageIds extends string, + Options extends readonly unknown[], + MessageIds extends string, > { create: ( - context: Readonly>, - optionsWithDefault: Readonly, + context: Readonly>, + optionsWithDefault: Readonly, ) => RuleListener; - defaultOptions: Readonly; + defaultOptions: Readonly; } export interface RuleWithMeta< - TOptions extends readonly unknown[], - TMessageIds extends string, -> extends RuleCreateAndOptions { - meta: RuleMetaData; + Options extends readonly unknown[], + MessageIds extends string, +> extends RuleCreateAndOptions { + meta: RuleMetaData; } export interface RuleWithMetaAndName< - TOptions extends readonly unknown[], - TMessageIds extends string, -> extends RuleCreateAndOptions { - meta: NamedCreateRuleMeta; + Options extends readonly unknown[], + MessageIds extends string, +> extends RuleCreateAndOptions { + meta: NamedCreateRuleMeta; name: string; } @@ -54,17 +54,17 @@ export function RuleCreator(urlCreator: (ruleName: string) => string) { // This function will get much easier to call when this is merged https://github.com/Microsoft/TypeScript/pull/26349 // TODO - when the above PR lands; add type checking for the context.report `data` property return function createNamedRule< - TOptions extends readonly unknown[], - TMessageIds extends string, + Options extends readonly unknown[], + MessageIds extends string, >({ name, meta, ...rule - }: Readonly>): RuleModule< - TMessageIds, - TOptions + }: Readonly>): RuleModule< + MessageIds, + Options > { - return createRule({ + return createRule({ meta: { ...meta, docs: { @@ -84,20 +84,18 @@ export function RuleCreator(urlCreator: (ruleName: string) => string) { * @remarks It is generally better to provide a docs URL function to RuleCreator. */ function createRule< - TOptions extends readonly unknown[], - TMessageIds extends string, + Options extends readonly unknown[], + MessageIds extends string, >({ create, defaultOptions, meta, -}: Readonly>): RuleModule< - TMessageIds, - TOptions +}: Readonly>): RuleModule< + MessageIds, + Options > { return { - create( - context: Readonly>, - ): RuleListener { + create(context: Readonly>): RuleListener { const optionsWithDefault = applyDefault(defaultOptions, context.options); return create(context, optionsWithDefault); }, diff --git a/packages/utils/src/eslint-utils/applyDefault.ts b/packages/utils/src/eslint-utils/applyDefault.ts index f16ae798715f..231561bef11d 100644 --- a/packages/utils/src/eslint-utils/applyDefault.ts +++ b/packages/utils/src/eslint-utils/applyDefault.ts @@ -7,14 +7,14 @@ import { deepMerge, isObjectNotArray } from './deepMerge'; * @param userOptions the user opts * @returns the options with defaults */ -function applyDefault( - defaultOptions: Readonly, - userOptions: Readonly | null, -): TDefault { +function applyDefault( + defaultOptions: Readonly, + userOptions: Readonly | null, +): Default { // clone defaults const options = JSON.parse( JSON.stringify(defaultOptions), - ) as AsMutable; + ) as AsMutable; if (userOptions == null) { return options; @@ -38,7 +38,7 @@ function applyDefault( } type AsMutable = { - -readonly [TKey in keyof T]: T[TKey]; + -readonly [Key in keyof T]: T[Key]; }; export { applyDefault }; diff --git a/packages/utils/src/eslint-utils/getParserServices.ts b/packages/utils/src/eslint-utils/getParserServices.ts index c834c230091d..e064d32aaca3 100644 --- a/packages/utils/src/eslint-utils/getParserServices.ts +++ b/packages/utils/src/eslint-utils/getParserServices.ts @@ -17,20 +17,20 @@ const ERROR_MESSAGE_UNKNOWN_PARSER = * This **_will_** throw if it is not available. */ function getParserServices< - TMessageIds extends string, - TOptions extends readonly unknown[], + MessageIds extends string, + Options extends readonly unknown[], >( - context: Readonly>, + context: Readonly>, ): ParserServicesWithTypeInformation; /** * Try to retrieve type-aware parser service from context. * This **_will_** throw if it is not available. */ function getParserServices< - TMessageIds extends string, - TOptions extends readonly unknown[], + MessageIds extends string, + Options extends readonly unknown[], >( - context: Readonly>, + context: Readonly>, allowWithoutFullTypeInformation: false, ): ParserServicesWithTypeInformation; /** @@ -38,10 +38,10 @@ function getParserServices< * This **_will not_** throw if it is not available. */ function getParserServices< - TMessageIds extends string, - TOptions extends readonly unknown[], + MessageIds extends string, + Options extends readonly unknown[], >( - context: Readonly>, + context: Readonly>, allowWithoutFullTypeInformation: true, ): ParserServices; /** @@ -49,10 +49,10 @@ function getParserServices< * This may or may not throw if it is not available, depending on if `allowWithoutFullTypeInformation` is `true` */ function getParserServices< - TMessageIds extends string, - TOptions extends readonly unknown[], + MessageIds extends string, + Options extends readonly unknown[], >( - context: Readonly>, + context: Readonly>, allowWithoutFullTypeInformation: boolean, ): ParserServices; diff --git a/packages/utils/src/ts-eslint/Linter.ts b/packages/utils/src/ts-eslint/Linter.ts index 4ac5d846f1a7..8ea129409b8d 100644 --- a/packages/utils/src/ts-eslint/Linter.ts +++ b/packages/utils/src/ts-eslint/Linter.ts @@ -15,10 +15,10 @@ import type { import type { SourceCode } from './SourceCode'; export type MinimalRuleModule< - TMessageIds extends string = string, - TOptions extends readonly unknown[] = [], -> = Partial, 'create'>> & - Pick, 'create'>; + MessageIds extends string = string, + Options extends readonly unknown[] = [], +> = Partial, 'create'>> & + Pick, 'create'>; declare class LinterBase { /** @@ -39,20 +39,20 @@ declare class LinterBase { * @param ruleId A unique rule identifier * @param ruleModule Function from context to object mapping AST node types to event handlers */ - defineRule( + defineRule( ruleId: string, - ruleModule: MinimalRuleModule | RuleCreateFunction, + ruleModule: MinimalRuleModule | RuleCreateFunction, ): void; /** * Defines many new linting rules. * @param rulesToDefine map from unique rule identifier to rule */ - defineRules( + defineRules( rulesToDefine: Record< string, - | MinimalRuleModule - | RuleCreateFunction + | MinimalRuleModule + | RuleCreateFunction >, ): void; diff --git a/packages/utils/src/ts-eslint/Rule.ts b/packages/utils/src/ts-eslint/Rule.ts index 57f5abb59f3d..3c654cedc64e 100644 --- a/packages/utils/src/ts-eslint/Rule.ts +++ b/packages/utils/src/ts-eslint/Rule.ts @@ -35,7 +35,8 @@ export interface RuleMetaDataDocs { */ extendsBaseRule?: boolean | string; } -export interface RuleMetaData { + +export interface RuleMetaData { /** * True if the rule is deprecated, false otherwise */ @@ -57,7 +58,7 @@ export interface RuleMetaData { * The key is the messageId, and the string is the parameterised error string. * See: https://eslint.org/docs/developer-guide/working-with-rules#messageids */ - messages: Record; + messages: Record; /** * The type of rule. * - `"problem"` means the rule is identifying code that either will cause an error or may cause a confusing behavior. Developers should consider this a high priority to resolve. @@ -107,20 +108,21 @@ export interface RuleFixer { replaceTextRange(range: Readonly, text: string): RuleFix; } -export interface SuggestionReportDescriptor - extends Omit, 'fix'> { +export interface SuggestionReportDescriptor + extends Omit, 'fix'> { readonly fix: ReportFixFunction; } export type ReportFixFunction = ( fixer: RuleFixer, ) => IterableIterator | RuleFix | readonly RuleFix[] | null; -export type ReportSuggestionArray = - SuggestionReportDescriptor[]; + +export type ReportSuggestionArray = + SuggestionReportDescriptor[]; export type ReportDescriptorMessageData = Readonly>; -interface ReportDescriptorBase { +interface ReportDescriptorBase { /** * The parameters for the message string associated with `messageId`. */ @@ -132,17 +134,17 @@ interface ReportDescriptorBase { /** * The messageId which is being reported. */ - readonly messageId: TMessageIds; + readonly messageId: MessageIds; // we disallow this because it's much better to use messageIds for reusable errors that are easily testable // readonly desc?: string; } -interface ReportDescriptorWithSuggestion - extends ReportDescriptorBase { +interface ReportDescriptorWithSuggestion + extends ReportDescriptorBase { /** * 6.7's Suggestions API */ - readonly suggest?: Readonly> | null; + readonly suggest?: Readonly> | null; } interface ReportDescriptorNodeOptionalLoc { @@ -163,8 +165,9 @@ interface ReportDescriptorLocOnly { */ loc: Readonly | Readonly; } -export type ReportDescriptor = - ReportDescriptorWithSuggestion & + +export type ReportDescriptor = + ReportDescriptorWithSuggestion & (ReportDescriptorLocOnly | ReportDescriptorNodeOptionalLoc); /** @@ -177,8 +180,8 @@ export interface SharedConfigurationSettings { } export interface RuleContext< - TMessageIds extends string, - TOptions extends readonly unknown[], + MessageIds extends string, + Options extends readonly unknown[], > { /** * The rule ID. @@ -188,7 +191,7 @@ export interface RuleContext< * An array of the configured options for this rule. * This array does not include the rule severity. */ - options: TOptions; + options: Options; /** * The name of the parser from configuration. */ @@ -299,7 +302,7 @@ export interface RuleContext< /** * Reports a problem in the code. */ - report(descriptor: ReportDescriptor): void; + report(descriptor: ReportDescriptor): void; } /** @@ -614,26 +617,28 @@ export type RuleListener = RuleListenerBaseSelectors & RuleListenerExitSelectors; export interface RuleModule< - TMessageIds extends string, - TOptions extends readonly unknown[] = [], + MessageIds extends string, + Options extends readonly unknown[] = [], // for extending base rules - TRuleListener extends RuleListener = RuleListener, + ExtendedRuleListener extends RuleListener = RuleListener, > { /** * Default options the rule will be run with */ - defaultOptions: TOptions; + defaultOptions: Options; /** * Metadata about the rule */ - meta: RuleMetaData; + meta: RuleMetaData; /** * Function which returns an object with methods that ESLint calls to “visit” * nodes while traversing the abstract syntax tree. */ - create(context: Readonly>): TRuleListener; + create( + context: Readonly>, + ): ExtendedRuleListener; } export type AnyRuleModule = RuleModule; @@ -673,9 +678,9 @@ export type LooseRuleCreateFunction = (context: any) => Record< >; export type RuleCreateFunction< - TMessageIds extends string = never, - TOptions extends readonly unknown[] = unknown[], -> = (context: Readonly>) => RuleListener; + MessageIds extends string = never, + Options extends readonly unknown[] = unknown[], +> = (context: Readonly>) => RuleListener; export type AnyRuleCreateFunction = RuleCreateFunction< string, readonly unknown[] diff --git a/packages/utils/src/ts-eslint/RuleTester.ts b/packages/utils/src/ts-eslint/RuleTester.ts index 9e3e0166b0ee..021d2f579218 100644 --- a/packages/utils/src/ts-eslint/RuleTester.ts +++ b/packages/utils/src/ts-eslint/RuleTester.ts @@ -11,7 +11,7 @@ import type { SharedConfigurationSettings, } from './Rule'; -interface ValidTestCase> { +interface ValidTestCase> { /** * Name for the test case. */ @@ -35,7 +35,7 @@ interface ValidTestCase> { /** * Options for the test case. */ - readonly options?: Readonly; + readonly options?: Readonly; /** * The absolute path for the parser. */ @@ -54,11 +54,11 @@ interface ValidTestCase> { readonly only?: boolean; } -interface SuggestionOutput { +interface SuggestionOutput { /** * Reported message ID. */ - readonly messageId: TMessageIds; + readonly messageId: MessageIds; /** * The data used to fill the message template. */ @@ -74,20 +74,20 @@ interface SuggestionOutput { } interface InvalidTestCase< - TMessageIds extends string, - TOptions extends Readonly, -> extends ValidTestCase { + MessageIds extends string, + Options extends Readonly, +> extends ValidTestCase { /** * Expected errors. */ - readonly errors: readonly TestCaseError[]; + readonly errors: readonly TestCaseError[]; /** * The expected code after autofixes are applied. If set to `null`, the test runner will assert that no autofix is suggested. */ readonly output?: string | null; } -interface TestCaseError { +interface TestCaseError { /** * The 1-based column number of the reported start location. */ @@ -111,11 +111,11 @@ interface TestCaseError { /** * Reported message ID. */ - readonly messageId: TMessageIds; + readonly messageId: MessageIds; /** * Reported suggestions. */ - readonly suggestions?: readonly SuggestionOutput[] | null; + readonly suggestions?: readonly SuggestionOutput[] | null; /** * The type of the reported AST node. */ @@ -135,12 +135,12 @@ type RuleTesterTestFrameworkFunction = ( ) => void; interface RunTests< - TMessageIds extends string, - TOptions extends Readonly, + MessageIds extends string, + Options extends Readonly, > { // RuleTester.run also accepts strings for valid cases - readonly valid: readonly (ValidTestCase | string)[]; - readonly invalid: readonly InvalidTestCase[]; + readonly valid: readonly (ValidTestCase | string)[]; + readonly invalid: readonly InvalidTestCase[]; } interface RuleTesterConfig extends ClassicConfig.Config { // should be require.resolve(parserPackageName) @@ -161,10 +161,10 @@ declare class RuleTesterBase { * @param rule The rule to test. * @param test The collection of tests to run. */ - run>( + run>( ruleName: string, - rule: RuleModule, - tests: RunTests, + rule: RuleModule, + tests: RunTests, ): void; /** @@ -191,11 +191,11 @@ declare class RuleTesterBase { /** * Define a rule for one particular run of tests. */ - defineRule>( + defineRule>( name: string, rule: - | RuleCreateFunction - | RuleModule, + | RuleCreateFunction + | RuleModule, ): void; } diff --git a/packages/utils/src/ts-eslint/SourceCode.ts b/packages/utils/src/ts-eslint/SourceCode.ts index 3216efb26e65..1675832dd2e0 100644 --- a/packages/utils/src/ts-eslint/SourceCode.ts +++ b/packages/utils/src/ts-eslint/SourceCode.ts @@ -396,19 +396,18 @@ namespace SourceCode { export type VisitorKeys = Parser.VisitorKeys; export type FilterPredicate = (token: TSESTree.Token) => boolean; - export type GetFilterPredicate = + export type GetFilterPredicate = // https://github.com/prettier/prettier/issues/14275 // prettier-ignore - TFilter extends (( + Filter extends (( token: TSESTree.Token, ) => token is infer U extends TSESTree.Token) ? U - : TDefault; - export type GetFilterPredicateFromOptions = - TOptions extends { filter?: FilterPredicate } - ? GetFilterPredicate - : GetFilterPredicate; - + : Default; + export type GetFilterPredicateFromOptions = + Options extends { filter?: FilterPredicate } + ? GetFilterPredicate + : GetFilterPredicate; export type ReturnTypeFromOptions = T extends { includeComments: true } ? GetFilterPredicateFromOptions : GetFilterPredicateFromOptions< From f2f57de6d203f083a0573c132196f0777182793f Mon Sep 17 00:00:00 2001 From: Kirk Waiblinger <53019676+kirkwaiblinger@users.noreply.github.com> Date: Fri, 23 Feb 2024 20:52:53 -0700 Subject: [PATCH 29/35] test(eslint-plugin): [no-misused-promises] add test cases for spread args (#8493) 5744: Add test cases for spread args in no-misused-promsies --- .../src/rules/no-misused-promises.ts | 2 -- .../tests/rules/no-misused-promises.test.ts | 27 +++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/packages/eslint-plugin/src/rules/no-misused-promises.ts b/packages/eslint-plugin/src/rules/no-misused-promises.ts index b7d556c893f0..754832a3c1b3 100644 --- a/packages/eslint-plugin/src/rules/no-misused-promises.ts +++ b/packages/eslint-plugin/src/rules/no-misused-promises.ts @@ -549,8 +549,6 @@ function voidFunctionArguments( // If this is a array 'rest' parameter, check all of the argument indices // from the current argument to the end. - // Note - we currently do not support 'spread' arguments - adding support for them - // is tracked in https://github.com/typescript-eslint/typescript-eslint/issues/5744 if (decl && ts.isParameter(decl) && decl.dotDotDotToken) { if (checker.isArrayType(type)) { // Unwrap 'Array' to 'MaybeVoidFunction', diff --git a/packages/eslint-plugin/tests/rules/no-misused-promises.test.ts b/packages/eslint-plugin/tests/rules/no-misused-promises.test.ts index 1910dd4f93f9..0db6c0831b04 100644 --- a/packages/eslint-plugin/tests/rules/no-misused-promises.test.ts +++ b/packages/eslint-plugin/tests/rules/no-misused-promises.test.ts @@ -1248,5 +1248,32 @@ foo(bar); `, errors: [{ line: 4, messageId: 'voidReturnArgument' }], }, + { + code: ` +function consume(..._callbacks: Array<() => void>): void {} +let cbs: Array<() => Promise> = [ + () => Promise.resolve(true), + () => Promise.resolve(true), +]; +consume(...cbs); + `, + errors: [{ line: 7, messageId: 'voidReturnArgument' }], + }, + { + code: ` +function consume(..._callbacks: Array<() => void>): void {} +let cbs = [() => Promise.resolve(true), () => Promise.resolve(true)] as const; +consume(...cbs); + `, + errors: [{ line: 4, messageId: 'voidReturnArgument' }], + }, + { + code: ` +function consume(..._callbacks: Array<() => void>): void {} +let cbs = [() => Promise.resolve(true), () => Promise.resolve(true)]; +consume(...cbs); + `, + errors: [{ line: 4, messageId: 'voidReturnArgument' }], + }, ], }); From 1807d555aeb99873c665b34b75a4e5bc89bc1f86 Mon Sep 17 00:00:00 2001 From: YeonJuan Date: Sat, 24 Feb 2024 12:57:00 +0900 Subject: [PATCH 30/35] docs: add tabs in no-unsafe-unary-minus.md (#8542) Co-authored-by: Joshua Chen --- packages/eslint-plugin/docs/rules/no-unsafe-unary-minus.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/eslint-plugin/docs/rules/no-unsafe-unary-minus.md b/packages/eslint-plugin/docs/rules/no-unsafe-unary-minus.md index a215f8e19aa0..c4093c54df80 100644 --- a/packages/eslint-plugin/docs/rules/no-unsafe-unary-minus.md +++ b/packages/eslint-plugin/docs/rules/no-unsafe-unary-minus.md @@ -17,6 +17,8 @@ This rule restricts the unary `-` operator to `number | bigint`. ## Examples + + ### ❌ Incorrect ```ts From 5e7ec8f23c511f5bdfc51c6479e8daa3526550e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josh=20Goldberg=20=E2=9C=A8?= Date: Sat, 24 Feb 2024 08:36:01 -0500 Subject: [PATCH 31/35] fix(typescript-estree): use simpler absolutify behavior for project service client file paths (#8520) * fix(typescript-estree): use simpler absolutify behavior for project service client file paths * A bit of internal cleanup, and added unit tests * Lol Windows * Standardize type specifier style * oopity * Correct unit test for undefined * Update packages/typescript-estree/src/useProgramFromProjectService.ts Co-authored-by: Brad Zacher * cspell --------- Co-authored-by: Brad Zacher --- .cspell.json | 1 + .../src/useProgramFromProjectService.ts | 50 ++++-- .../lib/useProgramFromProjectService.test.ts | 152 ++++++++++++++++++ 3 files changed, 187 insertions(+), 16 deletions(-) create mode 100644 packages/typescript-estree/tests/lib/useProgramFromProjectService.test.ts diff --git a/.cspell.json b/.cspell.json index 01235a662ad8..93e4a9b6594d 100644 --- a/.cspell.json +++ b/.cspell.json @@ -66,6 +66,7 @@ "blurple", "bradzacher", "camelcase", + "canonicalize", "Cena", "codebases", "Codecov", diff --git a/packages/typescript-estree/src/useProgramFromProjectService.ts b/packages/typescript-estree/src/useProgramFromProjectService.ts index 39b51e8366b5..9ceb2d210c11 100644 --- a/packages/typescript-estree/src/useProgramFromProjectService.ts +++ b/packages/typescript-estree/src/useProgramFromProjectService.ts @@ -1,13 +1,10 @@ import debug from 'debug'; import { minimatch } from 'minimatch'; +import path from 'path'; import { createProjectProgram } from './create-program/createProjectProgram'; import type { ProjectServiceSettings } from './create-program/createProjectService'; import type { ASTAndDefiniteProgram } from './create-program/shared'; -import { - ensureAbsolutePath, - getCanonicalFileName, -} from './create-program/shared'; import type { MutableParseSettings } from './parseSettings'; const log = debug( @@ -19,11 +16,17 @@ export function useProgramFromProjectService( parseSettings: Readonly, hasFullTypeInformation: boolean, ): ASTAndDefiniteProgram | undefined { - const filePath = getCanonicalFileName(parseSettings.filePath); - log('Opening project service file for: %s', filePath); + // We don't canonicalize the filename because it caused a performance regression. + // See https://github.com/typescript-eslint/typescript-eslint/issues/8519 + const filePathAbsolute = absolutify(parseSettings.filePath); + log( + 'Opening project service file for: %s at absolute path %s', + parseSettings.filePath, + filePathAbsolute, + ); const opened = service.openClientFile( - ensureAbsolutePath(filePath, service.host.getCurrentDirectory()), + filePathAbsolute, parseSettings.codeFullText, /* scriptKind */ undefined, parseSettings.tsconfigRootDir, @@ -36,36 +39,51 @@ export function useProgramFromProjectService( 'Project service type information enabled; checking for file path match on: %o', allowDefaultProjectForFiles, ); + const isDefaultProjectAllowedPath = filePathMatchedBy( + parseSettings.filePath, + allowDefaultProjectForFiles, + ); + + log( + 'Default project allowed path: %s, based on config file: %s', + isDefaultProjectAllowedPath, + opened.configFileName, + ); if (opened.configFileName) { - if (filePathMatchedBy(filePath, allowDefaultProjectForFiles)) { + if (isDefaultProjectAllowedPath) { throw new Error( - `${filePath} was included by allowDefaultProjectForFiles but also was found in the project service. Consider removing it from allowDefaultProjectForFiles.`, + `${parseSettings.filePath} was included by allowDefaultProjectForFiles but also was found in the project service. Consider removing it from allowDefaultProjectForFiles.`, ); } - } else if (!filePathMatchedBy(filePath, allowDefaultProjectForFiles)) { + } else if (!isDefaultProjectAllowedPath) { throw new Error( - `${filePath} was not found by the project service. Consider either including it in the tsconfig.json or including it in allowDefaultProjectForFiles.`, + `${parseSettings.filePath} was not found by the project service. Consider either including it in the tsconfig.json or including it in allowDefaultProjectForFiles.`, ); } } + log('Retrieving script info and then program for: %s', filePathAbsolute); - log('Retrieving script info and then program for: %s', filePath); - - const scriptInfo = service.getScriptInfo(filePath); + const scriptInfo = service.getScriptInfo(filePathAbsolute); const program = service .getDefaultProjectForFile(scriptInfo!.fileName, true)! .getLanguageService(/*ensureSynchronized*/ true) .getProgram(); if (!program) { - log('Could not find project service program for: %s', filePath); + log('Could not find project service program for: %s', filePathAbsolute); return undefined; } - log('Found project service program for: %s', filePath); + log('Found project service program for: %s', filePathAbsolute); return createProjectProgram(parseSettings, [program]); + + function absolutify(filePath: string): string { + return path.isAbsolute(filePath) + ? filePath + : path.join(service.host.getCurrentDirectory(), filePath); + } } function filePathMatchedBy( diff --git a/packages/typescript-estree/tests/lib/useProgramFromProjectService.test.ts b/packages/typescript-estree/tests/lib/useProgramFromProjectService.test.ts new file mode 100644 index 000000000000..cec730d1cf74 --- /dev/null +++ b/packages/typescript-estree/tests/lib/useProgramFromProjectService.test.ts @@ -0,0 +1,152 @@ +/* eslint-disable @typescript-eslint/explicit-function-return-type -- Fancy mocks */ +import path from 'path'; + +import type { TypeScriptProjectService } from '../../src/create-program/createProjectService'; +import type { ParseSettings } from '../../src/parseSettings'; +import { useProgramFromProjectService } from '../../src/useProgramFromProjectService'; + +const mockCreateProjectProgram = jest.fn(); + +jest.mock('../../src/create-program/createProjectProgram', () => ({ + get createProjectProgram() { + return mockCreateProjectProgram; + }, +})); + +const mockGetProgram = jest.fn(); + +const currentDirectory = '/repos/repo'; + +function createMockProjectService() { + const openClientFile = jest.fn(); + const service = { + getDefaultProjectForFile: () => ({ + getLanguageService: () => ({ + getProgram: mockGetProgram, + }), + }), + getScriptInfo: () => ({}), + host: { + getCurrentDirectory: () => currentDirectory, + }, + openClientFile, + }; + + return { + service: service as typeof service & TypeScriptProjectService, + openClientFile, + }; +} + +const mockParseSettings = { + filePath: 'path/PascalCaseDirectory/camelCaseFile.ts', +} as ParseSettings; + +describe('useProgramFromProjectService', () => { + it('passes an absolute, case-matching file path to service.openClientFile', () => { + const { service } = createMockProjectService(); + + useProgramFromProjectService( + { allowDefaultProjectForFiles: undefined, service }, + mockParseSettings, + false, + ); + + expect(service.openClientFile).toHaveBeenCalledWith( + path.normalize('/repos/repo/path/PascalCaseDirectory/camelCaseFile.ts'), + undefined, + undefined, + undefined, + ); + }); + + it('throws an error when hasFullTypeInformation is enabled and the file is both in the project service and allowDefaultProjectForFiles', () => { + const { service } = createMockProjectService(); + + service.openClientFile.mockReturnValueOnce({ + configFileName: 'tsconfig.json', + }); + + expect(() => + useProgramFromProjectService( + { allowDefaultProjectForFiles: [mockParseSettings.filePath], service }, + mockParseSettings, + true, + ), + ).toThrow( + `${mockParseSettings.filePath} was included by allowDefaultProjectForFiles but also was found in the project service. Consider removing it from allowDefaultProjectForFiles.`, + ); + }); + + it('throws an error when hasFullTypeInformation is enabled and the file is neither in the project service nor allowDefaultProjectForFiles', () => { + const { service } = createMockProjectService(); + + service.openClientFile.mockReturnValueOnce({}); + + expect(() => + useProgramFromProjectService( + { allowDefaultProjectForFiles: [], service }, + mockParseSettings, + true, + ), + ).toThrow( + `${mockParseSettings.filePath} was not found by the project service. Consider either including it in the tsconfig.json or including it in allowDefaultProjectForFiles.`, + ); + }); + + it('returns undefined when hasFullTypeInformation is disabled, the file is both in the project service and allowDefaultProjectForFiles, and the service does not have a matching program', () => { + const { service } = createMockProjectService(); + + mockGetProgram.mockReturnValue(undefined); + + service.openClientFile.mockReturnValueOnce({ + configFileName: 'tsconfig.json', + }); + + const actual = useProgramFromProjectService( + { allowDefaultProjectForFiles: [mockParseSettings.filePath], service }, + mockParseSettings, + false, + ); + + expect(actual).toBeUndefined(); + }); + + it('returns a created program when hasFullTypeInformation is disabled, the file is both in the project service and allowDefaultProjectForFiles, and the service has a matching program', () => { + const { service } = createMockProjectService(); + const program = { getSourceFile: jest.fn() }; + + mockGetProgram.mockReturnValue(program); + + service.openClientFile.mockReturnValueOnce({ + configFileName: 'tsconfig.json', + }); + mockCreateProjectProgram.mockReturnValueOnce(program); + + const actual = useProgramFromProjectService( + { allowDefaultProjectForFiles: [mockParseSettings.filePath], service }, + mockParseSettings, + false, + ); + + expect(actual).toBe(program); + }); + + it('returns a created program when hasFullTypeInformation is disabled, the file is neither in the project service nor allowDefaultProjectForFiles, and the service has a matching program', () => { + const { service } = createMockProjectService(); + const program = { getSourceFile: jest.fn() }; + + mockGetProgram.mockReturnValue(program); + + service.openClientFile.mockReturnValueOnce({}); + mockCreateProjectProgram.mockReturnValueOnce(program); + + const actual = useProgramFromProjectService( + { allowDefaultProjectForFiles: [], service }, + mockParseSettings, + false, + ); + + expect(actual).toBe(program); + }); +}); From 025e89298f219c9c1f3c7e65b49893f20ffb9513 Mon Sep 17 00:00:00 2001 From: James Henry Date: Sun, 25 Feb 2024 15:10:59 +0400 Subject: [PATCH 32/35] chore: tmp skip cache for eslint-plugin lint (#8539) --- .github/workflows/ci.yml | 6 +++--- nx.json | 2 +- package.json | 2 +- packages/typescript-eslint/src/configs/all.ts | 2 ++ .../typescript-eslint/src/configs/disable-type-checked.ts | 1 + 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a3f23abff0a4..5255f2cc33a8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -62,7 +62,7 @@ jobs: uses: ./.github/actions/prepare-build generate_configs: - name: Lint + name: Generate Configs needs: [build] runs-on: ubuntu-latest steps: @@ -78,7 +78,7 @@ jobs: run: echo "Outdated result detected from yarn generate-configs. Please check in any file changes." lint_without_build: - name: Lint + name: Lint without build needs: [install] runs-on: ubuntu-latest strategy: @@ -96,7 +96,7 @@ jobs: run: yarn ${{ matrix.lint-task }} lint_with_build: - name: Lint + name: Lint with build # because we lint with our own tooling, we need to build needs: [build] runs-on: ubuntu-latest diff --git a/nx.json b/nx.json index 6f8ca39d33d6..f18f497922fe 100644 --- a/nx.json +++ b/nx.json @@ -56,7 +56,7 @@ } } }, - "@nx/eslint:lint": { + "lint": { "dependsOn": ["eslint-plugin:build"], "inputs": [ "default", diff --git a/package.json b/package.json index 9846a467e112..0bcdf16c8691 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "lint-fix": "yarn lint --fix", "lint-markdown-fix": "yarn lint-markdown --fix", "lint-markdown": "markdownlint \"**/*.md\" --config=.markdownlint.json --ignore-path=.markdownlintignore", - "lint": "npx nx run-many --target=lint --parallel", + "lint": "npx nx lint eslint-plugin --skip-nx-cache && npx nx run-many --target=lint --parallel --exclude eslint-plugin", "postinstall": "npx nx run repo-tools:postinstall-script", "pre-commit": "yarn lint-staged", "release": "tsx tools/release/release.mts", diff --git a/packages/typescript-eslint/src/configs/all.ts b/packages/typescript-eslint/src/configs/all.ts index ebade354a351..ab7e7d37528e 100644 --- a/packages/typescript-eslint/src/configs/all.ts +++ b/packages/typescript-eslint/src/configs/all.ts @@ -29,6 +29,8 @@ export default ( '@typescript-eslint/class-methods-use-this': 'error', '@typescript-eslint/consistent-generic-constructors': 'error', '@typescript-eslint/consistent-indexed-object-style': 'error', + 'consistent-return': 'off', + '@typescript-eslint/consistent-return': 'error', '@typescript-eslint/consistent-type-assertions': 'error', '@typescript-eslint/consistent-type-definitions': 'error', '@typescript-eslint/consistent-type-exports': 'error', diff --git a/packages/typescript-eslint/src/configs/disable-type-checked.ts b/packages/typescript-eslint/src/configs/disable-type-checked.ts index 17801026e24a..06364fb3b3e0 100644 --- a/packages/typescript-eslint/src/configs/disable-type-checked.ts +++ b/packages/typescript-eslint/src/configs/disable-type-checked.ts @@ -13,6 +13,7 @@ export default ( ): FlatConfig.Config => ({ rules: { '@typescript-eslint/await-thenable': 'off', + '@typescript-eslint/consistent-return': 'off', '@typescript-eslint/consistent-type-exports': 'off', '@typescript-eslint/dot-notation': 'off', '@typescript-eslint/naming-convention': 'off', From 3c71c9149a6d2a51c88f9a5a8518ef5c17cdaca0 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 26 Feb 2024 07:44:55 -0500 Subject: [PATCH 33/35] chore(deps): update dependency @types/react to v18.2.58 (#8551) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 8c8bd25e6fa1..80bcb080fd5d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5249,13 +5249,13 @@ __metadata: linkType: hard "@types/react@npm:^18.2.14": - version: 18.2.57 - resolution: "@types/react@npm:18.2.57" + version: 18.2.58 + resolution: "@types/react@npm:18.2.58" dependencies: "@types/prop-types": "*" "@types/scheduler": "*" csstype: ^3.0.2 - checksum: 01e7a3424162468428f3b28acec5e5c6cd1e26775ff605d0f46c883dea2d835924873d36b9ea0b75e40c9593aa78ca56a8ccde66bd58dbf6ecb0dd95af28609d + checksum: 42551e30c8a54161a11b2ecd11406782ddba4472a4471d45034c551295263d56f06234f283526d0c0420352ce9ce9675b2a6c65db7a287d9613643d3ceaaf1f0 languageName: node linkType: hard From c8ba7e7a247674405a7848ca44a3a3cb93f84834 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 26 Feb 2024 07:45:06 -0500 Subject: [PATCH 34/35] chore(deps): update dependency @types/node to v20.11.20 (#8550) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 80bcb080fd5d..722db0215383 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5157,11 +5157,11 @@ __metadata: linkType: hard "@types/node@npm:^20.0.0": - version: 20.11.19 - resolution: "@types/node@npm:20.11.19" + version: 20.11.20 + resolution: "@types/node@npm:20.11.20" dependencies: undici-types: ~5.26.4 - checksum: 259d16643ba611ade617a8212e594a3ac014727457507389bbf7213971346ab052d870f1e6e2df0afd0876ecd7874f578bccb130be01e069263cfc7136ddc0c1 + checksum: 79d339622fed1c0e64297c8b9f558815a91edb9fea3acb69c1201b919d450e12915cf98b1a96b2d2c121bf86f30b62b6de3708f8894c5319f8dfb3a991e3ccdd languageName: node linkType: hard From 4bc6944f880570273d8486d07bbac63186c8dfe0 Mon Sep 17 00:00:00 2001 From: "typescript-eslint[bot]" Date: Mon, 26 Feb 2024 17:14:39 +0000 Subject: [PATCH 35/35] chore(release): publish 7.1.0 --- CHANGELOG.md | 25 ++++ packages/ast-spec/CHANGELOG.md | 6 + packages/ast-spec/package.json | 2 +- packages/eslint-plugin-internal/CHANGELOG.md | 6 + packages/eslint-plugin-internal/package.json | 10 +- packages/eslint-plugin/CHANGELOG.md | 29 +++++ packages/eslint-plugin/package.json | 14 +-- packages/integration-tests/CHANGELOG.md | 6 + packages/integration-tests/package.json | 2 +- packages/parser/CHANGELOG.md | 6 + packages/parser/package.json | 10 +- packages/repo-tools/CHANGELOG.md | 16 +++ packages/repo-tools/package.json | 2 +- .../CHANGELOG.md | 6 + .../package.json | 6 +- packages/rule-tester/CHANGELOG.md | 6 + packages/rule-tester/package.json | 8 +- packages/scope-manager/CHANGELOG.md | 6 + packages/scope-manager/package.json | 8 +- packages/type-utils/CHANGELOG.md | 6 + packages/type-utils/package.json | 8 +- packages/types/CHANGELOG.md | 6 + packages/types/package.json | 2 +- packages/typescript-eslint/CHANGELOG.md | 16 +++ packages/typescript-eslint/package.json | 6 +- packages/typescript-estree/CHANGELOG.md | 21 ++++ packages/typescript-estree/package.json | 6 +- packages/utils/CHANGELOG.md | 6 + packages/utils/package.json | 10 +- packages/visitor-keys/CHANGELOG.md | 6 + packages/visitor-keys/package.json | 4 +- packages/website-eslint/CHANGELOG.md | 6 + packages/website-eslint/package.json | 16 +-- packages/website/CHANGELOG.md | 6 + packages/website/package.json | 12 +- yarn.lock | 114 +++++++++--------- 36 files changed, 305 insertions(+), 120 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 13ea817dbc1b..9da45006e337 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,28 @@ +## 7.1.0 (2024-02-26) + + +### 🚀 Features + +- **eslint-plugin:** add *-type-checked-only configs ([#8367](https://github.com/typescript-eslint/typescript-eslint/pull/8367)) +- **eslint-plugin:** [naming-convention] support the auto-accessor syntax ([#8084](https://github.com/typescript-eslint/typescript-eslint/pull/8084)) +- **eslint-plugin:** [consistent-return] add new rule ([#8289](https://github.com/typescript-eslint/typescript-eslint/pull/8289)) +- **typescript-estree:** add debug logs for useProgramFromProjectService ([#8426](https://github.com/typescript-eslint/typescript-eslint/pull/8426)) + +### 🩹 Fixes + +- **eslint-plugin:** [prefer-optional-chan] allow typeof for avoiding reference error ([#8472](https://github.com/typescript-eslint/typescript-eslint/pull/8472)) +- **eslint-plugin:** [no-misused-promises] improve check union types ([#8534](https://github.com/typescript-eslint/typescript-eslint/pull/8534)) +- **eslint-plugin:** [no-use-before-define] fix false positive type reference in as, satisfies ([#8474](https://github.com/typescript-eslint/typescript-eslint/pull/8474)) +- **typescript-estree:** use simpler absolutify behavior for project service client file paths ([#8520](https://github.com/typescript-eslint/typescript-eslint/pull/8520)) + +### ❤️ Thank You + +- Arka Pratim Chaudhuri @arka1002 +- Josh Goldberg ✨ +- YeonJuan @yeonjuan + +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.2 (2024-02-19) diff --git a/packages/ast-spec/CHANGELOG.md b/packages/ast-spec/CHANGELOG.md index d6879c5a4ad1..b2bba72a110c 100644 --- a/packages/ast-spec/CHANGELOG.md +++ b/packages/ast-spec/CHANGELOG.md @@ -1,3 +1,9 @@ +## 7.1.0 (2024-02-26) + +This was a version bump only for ast-spec to align it with other projects, there were no code changes. + +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.2 (2024-02-19) diff --git a/packages/ast-spec/package.json b/packages/ast-spec/package.json index 195d61b0ecc5..c15872b34d10 100644 --- a/packages/ast-spec/package.json +++ b/packages/ast-spec/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/ast-spec", - "version": "7.0.2", + "version": "7.1.0", "description": "Complete specification for the TypeScript-ESTree AST", "private": true, "keywords": [ diff --git a/packages/eslint-plugin-internal/CHANGELOG.md b/packages/eslint-plugin-internal/CHANGELOG.md index 958bcd2682c5..50933910aadd 100644 --- a/packages/eslint-plugin-internal/CHANGELOG.md +++ b/packages/eslint-plugin-internal/CHANGELOG.md @@ -1,3 +1,9 @@ +## 7.1.0 (2024-02-26) + +This was a version bump only for eslint-plugin-internal to align it with other projects, there were no code changes. + +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.2 (2024-02-19) diff --git a/packages/eslint-plugin-internal/package.json b/packages/eslint-plugin-internal/package.json index c590b8b9b392..b6e51df6f936 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": "7.0.2", + "version": "7.1.0", "private": true, "main": "dist/index.js", "types": "index.d.ts", @@ -15,10 +15,10 @@ }, "dependencies": { "@prettier/sync": "^0.5.0", - "@typescript-eslint/rule-tester": "7.0.2", - "@typescript-eslint/scope-manager": "7.0.2", - "@typescript-eslint/type-utils": "7.0.2", - "@typescript-eslint/utils": "7.0.2", + "@typescript-eslint/rule-tester": "7.1.0", + "@typescript-eslint/scope-manager": "7.1.0", + "@typescript-eslint/type-utils": "7.1.0", + "@typescript-eslint/utils": "7.1.0", "prettier": "^3.0.3" }, "devDependencies": { diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index 7916a49eb64e..437bb1455784 100644 --- a/packages/eslint-plugin/CHANGELOG.md +++ b/packages/eslint-plugin/CHANGELOG.md @@ -1,3 +1,32 @@ +## 7.1.0 (2024-02-26) + + +### 🚀 Features + +- **eslint-plugin:** add *-type-checked-only configs + +- **eslint-plugin:** [naming-convention] support the auto-accessor syntax + +- **eslint-plugin:** [consistent-return] add new rule + + +### 🩹 Fixes + +- **eslint-plugin:** [prefer-optional-chan] allow typeof for avoiding reference error + +- **eslint-plugin:** [no-misused-promises] improve check union types + +- **eslint-plugin:** [no-use-before-define] fix false positive type reference in as, satisfies + + +### ❤️ Thank You + +- Arka Pratim Chaudhuri +- Josh Goldberg ✨ +- YeonJuan + +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.2 (2024-02-19) diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 4db945376dbf..28445888062b 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin", - "version": "7.0.2", + "version": "7.1.0", "description": "TypeScript plugin for ESLint", "files": [ "dist", @@ -61,10 +61,10 @@ }, "dependencies": { "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "7.0.2", - "@typescript-eslint/type-utils": "7.0.2", - "@typescript-eslint/utils": "7.0.2", - "@typescript-eslint/visitor-keys": "7.0.2", + "@typescript-eslint/scope-manager": "7.1.0", + "@typescript-eslint/type-utils": "7.1.0", + "@typescript-eslint/utils": "7.1.0", + "@typescript-eslint/visitor-keys": "7.1.0", "debug": "^4.3.4", "graphemer": "^1.4.0", "ignore": "^5.2.4", @@ -76,8 +76,8 @@ "@types/debug": "*", "@types/marked": "*", "@types/natural-compare": "*", - "@typescript-eslint/rule-schema-to-typescript-types": "7.0.2", - "@typescript-eslint/rule-tester": "7.0.2", + "@typescript-eslint/rule-schema-to-typescript-types": "7.1.0", + "@typescript-eslint/rule-tester": "7.1.0", "ajv": "^6.12.6", "chalk": "^5.3.0", "cross-env": "^7.0.3", diff --git a/packages/integration-tests/CHANGELOG.md b/packages/integration-tests/CHANGELOG.md index d7eb9b1b7c71..0c9c88cc227e 100644 --- a/packages/integration-tests/CHANGELOG.md +++ b/packages/integration-tests/CHANGELOG.md @@ -1,3 +1,9 @@ +## 7.1.0 (2024-02-26) + +This was a version bump only for integration-tests to align it with other projects, there were no code changes. + +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.2 (2024-02-19) diff --git a/packages/integration-tests/package.json b/packages/integration-tests/package.json index 3edaa27ea39a..b6d73832ba22 100644 --- a/packages/integration-tests/package.json +++ b/packages/integration-tests/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/integration-tests", - "version": "7.0.2", + "version": "7.1.0", "private": true, "scripts": { "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", diff --git a/packages/parser/CHANGELOG.md b/packages/parser/CHANGELOG.md index cb9c008453f1..127426b5786a 100644 --- a/packages/parser/CHANGELOG.md +++ b/packages/parser/CHANGELOG.md @@ -1,3 +1,9 @@ +## 7.1.0 (2024-02-26) + +This was a version bump only for parser to align it with other projects, there were no code changes. + +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.2 (2024-02-19) diff --git a/packages/parser/package.json b/packages/parser/package.json index 9fbf5bdddc00..942dc6e73ea8 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/parser", - "version": "7.0.2", + "version": "7.1.0", "description": "An ESLint custom parser which leverages TypeScript ESTree", "files": [ "dist", @@ -51,10 +51,10 @@ "eslint": "^8.56.0" }, "dependencies": { - "@typescript-eslint/scope-manager": "7.0.2", - "@typescript-eslint/types": "7.0.2", - "@typescript-eslint/typescript-estree": "7.0.2", - "@typescript-eslint/visitor-keys": "7.0.2", + "@typescript-eslint/scope-manager": "7.1.0", + "@typescript-eslint/types": "7.1.0", + "@typescript-eslint/typescript-estree": "7.1.0", + "@typescript-eslint/visitor-keys": "7.1.0", "debug": "^4.3.4" }, "devDependencies": { diff --git a/packages/repo-tools/CHANGELOG.md b/packages/repo-tools/CHANGELOG.md index cc49bbc56fe3..092dbfced5e8 100644 --- a/packages/repo-tools/CHANGELOG.md +++ b/packages/repo-tools/CHANGELOG.md @@ -1,3 +1,19 @@ +## 7.1.0 (2024-02-26) + + +### 🚀 Features + +- **eslint-plugin:** add *-type-checked-only configs + + +### ❤️ Thank You + +- Arka Pratim Chaudhuri +- Josh Goldberg ✨ +- YeonJuan + +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.2 (2024-02-19) diff --git a/packages/repo-tools/package.json b/packages/repo-tools/package.json index bf22667449a8..20f69ba449e5 100644 --- a/packages/repo-tools/package.json +++ b/packages/repo-tools/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/repo-tools", - "version": "7.0.2", + "version": "7.1.0", "private": true, "scripts": { "//": "NOTE: intentionally no build step in this package", diff --git a/packages/rule-schema-to-typescript-types/CHANGELOG.md b/packages/rule-schema-to-typescript-types/CHANGELOG.md index 1e5940a0ada3..7554fb99080e 100644 --- a/packages/rule-schema-to-typescript-types/CHANGELOG.md +++ b/packages/rule-schema-to-typescript-types/CHANGELOG.md @@ -1,3 +1,9 @@ +## 7.1.0 (2024-02-26) + +This was a version bump only for rule-schema-to-typescript-types to align it with other projects, there were no code changes. + +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.2 (2024-02-19) diff --git a/packages/rule-schema-to-typescript-types/package.json b/packages/rule-schema-to-typescript-types/package.json index ecafb8926309..84666897ed7f 100644 --- a/packages/rule-schema-to-typescript-types/package.json +++ b/packages/rule-schema-to-typescript-types/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/rule-schema-to-typescript-types", - "version": "7.0.2", + "version": "7.1.0", "private": true, "type": "commonjs", "exports": { @@ -33,8 +33,8 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/type-utils": "7.0.2", - "@typescript-eslint/utils": "7.0.2", + "@typescript-eslint/type-utils": "7.1.0", + "@typescript-eslint/utils": "7.1.0", "natural-compare": "^1.4.0", "prettier": "^3.0.3" }, diff --git a/packages/rule-tester/CHANGELOG.md b/packages/rule-tester/CHANGELOG.md index af133b5e7ed0..b02d2b6808b0 100644 --- a/packages/rule-tester/CHANGELOG.md +++ b/packages/rule-tester/CHANGELOG.md @@ -1,3 +1,9 @@ +## 7.1.0 (2024-02-26) + +This was a version bump only for rule-tester to align it with other projects, there were no code changes. + +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.2 (2024-02-19) diff --git a/packages/rule-tester/package.json b/packages/rule-tester/package.json index 94902301c19a..c2c29e2b7c49 100644 --- a/packages/rule-tester/package.json +++ b/packages/rule-tester/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/rule-tester", - "version": "7.0.2", + "version": "7.1.0", "description": "Tooling to test ESLint rules", "files": [ "dist", @@ -47,8 +47,8 @@ }, "//": "NOTE - AJV is out-of-date, but it's intentionally synced with ESLint - https://github.com/eslint/eslint/blob/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/package.json#L70", "dependencies": { - "@typescript-eslint/typescript-estree": "7.0.2", - "@typescript-eslint/utils": "7.0.2", + "@typescript-eslint/typescript-estree": "7.1.0", + "@typescript-eslint/utils": "7.1.0", "ajv": "^6.10.0", "lodash.merge": "4.6.2", "semver": "^7.5.4" @@ -59,7 +59,7 @@ }, "devDependencies": { "@types/lodash.merge": "4.6.9", - "@typescript-eslint/parser": "7.0.2", + "@typescript-eslint/parser": "7.1.0", "chai": "^4.3.7", "mocha": "^10.0.0", "sinon": "^16.0.0", diff --git a/packages/scope-manager/CHANGELOG.md b/packages/scope-manager/CHANGELOG.md index aa1e437f7f77..859985a8748f 100644 --- a/packages/scope-manager/CHANGELOG.md +++ b/packages/scope-manager/CHANGELOG.md @@ -1,3 +1,9 @@ +## 7.1.0 (2024-02-26) + +This was a version bump only for scope-manager to align it with other projects, there were no code changes. + +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.2 (2024-02-19) diff --git a/packages/scope-manager/package.json b/packages/scope-manager/package.json index 953b94afb48b..653b4b1ab331 100644 --- a/packages/scope-manager/package.json +++ b/packages/scope-manager/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/scope-manager", - "version": "7.0.2", + "version": "7.1.0", "description": "TypeScript scope analyser for ESLint", "files": [ "dist", @@ -45,12 +45,12 @@ "typecheck": "npx nx typecheck" }, "dependencies": { - "@typescript-eslint/types": "7.0.2", - "@typescript-eslint/visitor-keys": "7.0.2" + "@typescript-eslint/types": "7.1.0", + "@typescript-eslint/visitor-keys": "7.1.0" }, "devDependencies": { "@types/glob": "*", - "@typescript-eslint/typescript-estree": "7.0.2", + "@typescript-eslint/typescript-estree": "7.1.0", "glob": "*", "jest-specific-snapshot": "*", "make-dir": "*", diff --git a/packages/type-utils/CHANGELOG.md b/packages/type-utils/CHANGELOG.md index 11db9b204f45..d0702f48f747 100644 --- a/packages/type-utils/CHANGELOG.md +++ b/packages/type-utils/CHANGELOG.md @@ -1,3 +1,9 @@ +## 7.1.0 (2024-02-26) + +This was a version bump only for type-utils to align it with other projects, there were no code changes. + +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.2 (2024-02-19) diff --git a/packages/type-utils/package.json b/packages/type-utils/package.json index fd50dd383737..24c9ecb8fa41 100644 --- a/packages/type-utils/package.json +++ b/packages/type-utils/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/type-utils", - "version": "7.0.2", + "version": "7.1.0", "description": "Type utilities for working with TypeScript + ESLint together", "files": [ "dist", @@ -45,13 +45,13 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/typescript-estree": "7.0.2", - "@typescript-eslint/utils": "7.0.2", + "@typescript-eslint/typescript-estree": "7.1.0", + "@typescript-eslint/utils": "7.1.0", "debug": "^4.3.4", "ts-api-utils": "^1.0.1" }, "devDependencies": { - "@typescript-eslint/parser": "7.0.2", + "@typescript-eslint/parser": "7.1.0", "ajv": "^6.10.0", "downlevel-dts": "*", "jest": "29.7.0", diff --git a/packages/types/CHANGELOG.md b/packages/types/CHANGELOG.md index ab9728855a23..7a60f39e283a 100644 --- a/packages/types/CHANGELOG.md +++ b/packages/types/CHANGELOG.md @@ -1,3 +1,9 @@ +## 7.1.0 (2024-02-26) + +This was a version bump only for types to align it with other projects, there were no code changes. + +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.2 (2024-02-19) diff --git a/packages/types/package.json b/packages/types/package.json index e7de9e9301e9..fb87152eeaf3 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/types", - "version": "7.0.2", + "version": "7.1.0", "description": "Types for the TypeScript-ESTree AST spec", "files": [ "dist", diff --git a/packages/typescript-eslint/CHANGELOG.md b/packages/typescript-eslint/CHANGELOG.md index 7e70f19981a3..15adc36b6c5a 100644 --- a/packages/typescript-eslint/CHANGELOG.md +++ b/packages/typescript-eslint/CHANGELOG.md @@ -1,3 +1,19 @@ +## 7.1.0 (2024-02-26) + + +### 🚀 Features + +- **eslint-plugin:** add *-type-checked-only configs + + +### ❤️ Thank You + +- Arka Pratim Chaudhuri +- Josh Goldberg ✨ +- YeonJuan + +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.2 (2024-02-19) diff --git a/packages/typescript-eslint/package.json b/packages/typescript-eslint/package.json index 614e697d989d..a5c4f3e3bea1 100644 --- a/packages/typescript-eslint/package.json +++ b/packages/typescript-eslint/package.json @@ -1,6 +1,6 @@ { "name": "typescript-eslint", - "version": "7.0.2", + "version": "7.1.0", "description": "Tooling which enables you to use TypeScript with ESLint", "files": [ "dist", @@ -54,8 +54,8 @@ "eslint": "^8.56.0" }, "dependencies": { - "@typescript-eslint/eslint-plugin": "7.0.2", - "@typescript-eslint/parser": "7.0.2" + "@typescript-eslint/eslint-plugin": "7.1.0", + "@typescript-eslint/parser": "7.1.0" }, "devDependencies": { "downlevel-dts": "*", diff --git a/packages/typescript-estree/CHANGELOG.md b/packages/typescript-estree/CHANGELOG.md index db757e600ed8..30ae54c6417b 100644 --- a/packages/typescript-estree/CHANGELOG.md +++ b/packages/typescript-estree/CHANGELOG.md @@ -1,3 +1,24 @@ +## 7.1.0 (2024-02-26) + + +### 🚀 Features + +- **typescript-estree:** add debug logs for useProgramFromProjectService + + +### 🩹 Fixes + +- **typescript-estree:** use simpler absolutify behavior for project service client file paths + + +### ❤️ Thank You + +- Arka Pratim Chaudhuri +- Josh Goldberg ✨ +- YeonJuan + +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.2 (2024-02-19) diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index e7fa40130834..6208c9c45a5b 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/typescript-estree", - "version": "7.0.2", + "version": "7.1.0", "description": "A parser that converts TypeScript source code into an ESTree compatible form", "files": [ "dist", @@ -53,8 +53,8 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/types": "7.0.2", - "@typescript-eslint/visitor-keys": "7.0.2", + "@typescript-eslint/types": "7.1.0", + "@typescript-eslint/visitor-keys": "7.1.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", diff --git a/packages/utils/CHANGELOG.md b/packages/utils/CHANGELOG.md index 0abbd4e95305..1bdea533a536 100644 --- a/packages/utils/CHANGELOG.md +++ b/packages/utils/CHANGELOG.md @@ -1,3 +1,9 @@ +## 7.1.0 (2024-02-26) + +This was a version bump only for utils to align it with other projects, there were no code changes. + +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.2 (2024-02-19) diff --git a/packages/utils/package.json b/packages/utils/package.json index 1941c0c099e5..af780340a8c6 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/utils", - "version": "7.0.2", + "version": "7.1.0", "description": "Utilities for working with TypeScript + ESLint together", "files": [ "dist", @@ -69,16 +69,16 @@ "@eslint-community/eslint-utils": "^4.4.0", "@types/json-schema": "^7.0.12", "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "7.0.2", - "@typescript-eslint/types": "7.0.2", - "@typescript-eslint/typescript-estree": "7.0.2", + "@typescript-eslint/scope-manager": "7.1.0", + "@typescript-eslint/types": "7.1.0", + "@typescript-eslint/typescript-estree": "7.1.0", "semver": "^7.5.4" }, "peerDependencies": { "eslint": "^8.56.0" }, "devDependencies": { - "@typescript-eslint/parser": "7.0.2", + "@typescript-eslint/parser": "7.1.0", "downlevel-dts": "*", "jest": "29.7.0", "prettier": "^3.0.3", diff --git a/packages/visitor-keys/CHANGELOG.md b/packages/visitor-keys/CHANGELOG.md index 4dc1a4192bf2..efad0724694e 100644 --- a/packages/visitor-keys/CHANGELOG.md +++ b/packages/visitor-keys/CHANGELOG.md @@ -1,3 +1,9 @@ +## 7.1.0 (2024-02-26) + +This was a version bump only for visitor-keys to align it with other projects, there were no code changes. + +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.2 (2024-02-19) diff --git a/packages/visitor-keys/package.json b/packages/visitor-keys/package.json index 6e5878ba646b..378ff3c12158 100644 --- a/packages/visitor-keys/package.json +++ b/packages/visitor-keys/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/visitor-keys", - "version": "7.0.2", + "version": "7.1.0", "description": "Visitor keys used to help traverse the TypeScript-ESTree AST", "files": [ "dist", @@ -46,7 +46,7 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/types": "7.0.2", + "@typescript-eslint/types": "7.1.0", "eslint-visitor-keys": "^3.4.1" }, "devDependencies": { diff --git a/packages/website-eslint/CHANGELOG.md b/packages/website-eslint/CHANGELOG.md index f96c1462f822..5376494f93e9 100644 --- a/packages/website-eslint/CHANGELOG.md +++ b/packages/website-eslint/CHANGELOG.md @@ -1,3 +1,9 @@ +## 7.1.0 (2024-02-26) + +This was a version bump only for website-eslint to align it with other projects, there were no code changes. + +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.2 (2024-02-19) diff --git a/packages/website-eslint/package.json b/packages/website-eslint/package.json index bc6485a62006..3d463b3a3c9d 100644 --- a/packages/website-eslint/package.json +++ b/packages/website-eslint/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/website-eslint", - "version": "7.0.2", + "version": "7.1.0", "private": true, "description": "ESLint which works in browsers.", "files": [ @@ -23,16 +23,16 @@ "typecheck": "tsc --noEmit" }, "dependencies": { - "@typescript-eslint/types": "7.0.2", - "@typescript-eslint/utils": "7.0.2" + "@typescript-eslint/types": "7.1.0", + "@typescript-eslint/utils": "7.1.0" }, "devDependencies": { "@eslint/js": "*", - "@typescript-eslint/eslint-plugin": "7.0.2", - "@typescript-eslint/parser": "7.0.2", - "@typescript-eslint/scope-manager": "7.0.2", - "@typescript-eslint/typescript-estree": "7.0.2", - "@typescript-eslint/visitor-keys": "7.0.2", + "@typescript-eslint/eslint-plugin": "7.1.0", + "@typescript-eslint/parser": "7.1.0", + "@typescript-eslint/scope-manager": "7.1.0", + "@typescript-eslint/typescript-estree": "7.1.0", + "@typescript-eslint/visitor-keys": "7.1.0", "esbuild": "~0.20.0", "eslint": "*", "esquery": "*", diff --git a/packages/website/CHANGELOG.md b/packages/website/CHANGELOG.md index e1662e6e227a..650cae8f818f 100644 --- a/packages/website/CHANGELOG.md +++ b/packages/website/CHANGELOG.md @@ -1,3 +1,9 @@ +## 7.1.0 (2024-02-26) + +This was a version bump only for website to align it with other projects, there were no code changes. + +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.2 (2024-02-19) diff --git a/packages/website/package.json b/packages/website/package.json index 569ea3c695ca..9ca4bcb7ccdd 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -1,6 +1,6 @@ { "name": "website", - "version": "7.0.2", + "version": "7.1.0", "private": true, "scripts": { "build": "docusaurus build", @@ -24,8 +24,8 @@ "@docusaurus/remark-plugin-npm2yarn": "~2.4.1", "@docusaurus/theme-common": "~2.4.1", "@mdx-js/react": "1.6.22", - "@typescript-eslint/parser": "7.0.2", - "@typescript-eslint/website-eslint": "7.0.2", + "@typescript-eslint/parser": "7.1.0", + "@typescript-eslint/website-eslint": "7.1.0", "clsx": "^2.0.0", "eslint": "*", "json-schema": "^0.4.0", @@ -50,9 +50,9 @@ "@types/react": "*", "@types/react-helmet": "^6.1.6", "@types/react-router-dom": "^5.3.3", - "@typescript-eslint/eslint-plugin": "7.0.2", - "@typescript-eslint/rule-schema-to-typescript-types": "7.0.2", - "@typescript-eslint/types": "7.0.2", + "@typescript-eslint/eslint-plugin": "7.1.0", + "@typescript-eslint/rule-schema-to-typescript-types": "7.1.0", + "@typescript-eslint/types": "7.1.0", "copy-webpack-plugin": "^11.0.0", "cross-fetch": "*", "globby": "^11.1.0", diff --git a/yarn.lock b/yarn.lock index 722db0215383..6c5be76bbed4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5415,17 +5415,17 @@ __metadata: resolution: "@typescript-eslint/eslint-plugin-internal@workspace:packages/eslint-plugin-internal" dependencies: "@prettier/sync": ^0.5.0 - "@typescript-eslint/rule-tester": 7.0.2 - "@typescript-eslint/scope-manager": 7.0.2 - "@typescript-eslint/type-utils": 7.0.2 - "@typescript-eslint/utils": 7.0.2 + "@typescript-eslint/rule-tester": 7.1.0 + "@typescript-eslint/scope-manager": 7.1.0 + "@typescript-eslint/type-utils": 7.1.0 + "@typescript-eslint/utils": 7.1.0 jest: 29.7.0 prettier: ^3.0.3 rimraf: "*" languageName: unknown linkType: soft -"@typescript-eslint/eslint-plugin@7.0.2, @typescript-eslint/eslint-plugin@workspace:packages/eslint-plugin": +"@typescript-eslint/eslint-plugin@7.1.0, @typescript-eslint/eslint-plugin@workspace:packages/eslint-plugin": version: 0.0.0-use.local resolution: "@typescript-eslint/eslint-plugin@workspace:packages/eslint-plugin" dependencies: @@ -5433,12 +5433,12 @@ __metadata: "@types/debug": "*" "@types/marked": "*" "@types/natural-compare": "*" - "@typescript-eslint/rule-schema-to-typescript-types": 7.0.2 - "@typescript-eslint/rule-tester": 7.0.2 - "@typescript-eslint/scope-manager": 7.0.2 - "@typescript-eslint/type-utils": 7.0.2 - "@typescript-eslint/utils": 7.0.2 - "@typescript-eslint/visitor-keys": 7.0.2 + "@typescript-eslint/rule-schema-to-typescript-types": 7.1.0 + "@typescript-eslint/rule-tester": 7.1.0 + "@typescript-eslint/scope-manager": 7.1.0 + "@typescript-eslint/type-utils": 7.1.0 + "@typescript-eslint/utils": 7.1.0 + "@typescript-eslint/visitor-keys": 7.1.0 ajv: ^6.12.6 chalk: ^5.3.0 cross-env: ^7.0.3 @@ -5480,15 +5480,15 @@ __metadata: languageName: unknown linkType: soft -"@typescript-eslint/parser@7.0.2, @typescript-eslint/parser@workspace:packages/parser": +"@typescript-eslint/parser@7.1.0, @typescript-eslint/parser@workspace:packages/parser": version: 0.0.0-use.local resolution: "@typescript-eslint/parser@workspace:packages/parser" dependencies: "@types/glob": "*" - "@typescript-eslint/scope-manager": 7.0.2 - "@typescript-eslint/types": 7.0.2 - "@typescript-eslint/typescript-estree": 7.0.2 - "@typescript-eslint/visitor-keys": 7.0.2 + "@typescript-eslint/scope-manager": 7.1.0 + "@typescript-eslint/types": 7.1.0 + "@typescript-eslint/typescript-estree": 7.1.0 + "@typescript-eslint/visitor-keys": 7.1.0 debug: ^4.3.4 downlevel-dts: "*" glob: "*" @@ -5519,25 +5519,25 @@ __metadata: languageName: unknown linkType: soft -"@typescript-eslint/rule-schema-to-typescript-types@7.0.2, @typescript-eslint/rule-schema-to-typescript-types@workspace:packages/rule-schema-to-typescript-types": +"@typescript-eslint/rule-schema-to-typescript-types@7.1.0, @typescript-eslint/rule-schema-to-typescript-types@workspace:packages/rule-schema-to-typescript-types": version: 0.0.0-use.local resolution: "@typescript-eslint/rule-schema-to-typescript-types@workspace:packages/rule-schema-to-typescript-types" dependencies: - "@typescript-eslint/type-utils": 7.0.2 - "@typescript-eslint/utils": 7.0.2 + "@typescript-eslint/type-utils": 7.1.0 + "@typescript-eslint/utils": 7.1.0 natural-compare: ^1.4.0 prettier: ^3.0.3 languageName: unknown linkType: soft -"@typescript-eslint/rule-tester@7.0.2, @typescript-eslint/rule-tester@workspace:packages/rule-tester": +"@typescript-eslint/rule-tester@7.1.0, @typescript-eslint/rule-tester@workspace:packages/rule-tester": version: 0.0.0-use.local resolution: "@typescript-eslint/rule-tester@workspace:packages/rule-tester" dependencies: "@types/lodash.merge": 4.6.9 - "@typescript-eslint/parser": 7.0.2 - "@typescript-eslint/typescript-estree": 7.0.2 - "@typescript-eslint/utils": 7.0.2 + "@typescript-eslint/parser": 7.1.0 + "@typescript-eslint/typescript-estree": 7.1.0 + "@typescript-eslint/utils": 7.1.0 ajv: ^6.10.0 chai: ^4.3.7 lodash.merge: 4.6.2 @@ -5551,14 +5551,14 @@ __metadata: languageName: unknown linkType: soft -"@typescript-eslint/scope-manager@7.0.2, @typescript-eslint/scope-manager@workspace:packages/scope-manager": +"@typescript-eslint/scope-manager@7.1.0, @typescript-eslint/scope-manager@workspace:packages/scope-manager": version: 0.0.0-use.local resolution: "@typescript-eslint/scope-manager@workspace:packages/scope-manager" dependencies: "@types/glob": "*" - "@typescript-eslint/types": 7.0.2 - "@typescript-eslint/typescript-estree": 7.0.2 - "@typescript-eslint/visitor-keys": 7.0.2 + "@typescript-eslint/types": 7.1.0 + "@typescript-eslint/typescript-estree": 7.1.0 + "@typescript-eslint/visitor-keys": 7.1.0 glob: "*" jest-specific-snapshot: "*" make-dir: "*" @@ -5587,13 +5587,13 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/type-utils@7.0.2, @typescript-eslint/type-utils@workspace:packages/type-utils": +"@typescript-eslint/type-utils@7.1.0, @typescript-eslint/type-utils@workspace:packages/type-utils": version: 0.0.0-use.local resolution: "@typescript-eslint/type-utils@workspace:packages/type-utils" dependencies: - "@typescript-eslint/parser": 7.0.2 - "@typescript-eslint/typescript-estree": 7.0.2 - "@typescript-eslint/utils": 7.0.2 + "@typescript-eslint/parser": 7.1.0 + "@typescript-eslint/typescript-estree": 7.1.0 + "@typescript-eslint/utils": 7.1.0 ajv: ^6.10.0 debug: ^4.3.4 downlevel-dts: "*" @@ -5610,7 +5610,7 @@ __metadata: languageName: unknown linkType: soft -"@typescript-eslint/types@7.0.2, @typescript-eslint/types@workspace:packages/types": +"@typescript-eslint/types@7.1.0, @typescript-eslint/types@workspace:packages/types": version: 0.0.0-use.local resolution: "@typescript-eslint/types@workspace:packages/types" dependencies: @@ -5711,14 +5711,14 @@ __metadata: languageName: unknown linkType: soft -"@typescript-eslint/typescript-estree@7.0.2, @typescript-eslint/typescript-estree@workspace:packages/typescript-estree": +"@typescript-eslint/typescript-estree@7.1.0, @typescript-eslint/typescript-estree@workspace:packages/typescript-estree": version: 0.0.0-use.local resolution: "@typescript-eslint/typescript-estree@workspace:packages/typescript-estree" dependencies: "@babel/code-frame": "*" "@babel/parser": "*" - "@typescript-eslint/types": 7.0.2 - "@typescript-eslint/visitor-keys": 7.0.2 + "@typescript-eslint/types": 7.1.0 + "@typescript-eslint/visitor-keys": 7.1.0 debug: ^4.3.4 glob: "*" globby: ^11.1.0 @@ -5776,17 +5776,17 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/utils@7.0.2, @typescript-eslint/utils@workspace:packages/utils": +"@typescript-eslint/utils@7.1.0, @typescript-eslint/utils@workspace:packages/utils": version: 0.0.0-use.local resolution: "@typescript-eslint/utils@workspace:packages/utils" dependencies: "@eslint-community/eslint-utils": ^4.4.0 "@types/json-schema": ^7.0.12 "@types/semver": ^7.5.0 - "@typescript-eslint/parser": 7.0.2 - "@typescript-eslint/scope-manager": 7.0.2 - "@typescript-eslint/types": 7.0.2 - "@typescript-eslint/typescript-estree": 7.0.2 + "@typescript-eslint/parser": 7.1.0 + "@typescript-eslint/scope-manager": 7.1.0 + "@typescript-eslint/types": 7.1.0 + "@typescript-eslint/typescript-estree": 7.1.0 downlevel-dts: "*" jest: 29.7.0 prettier: ^3.0.3 @@ -5833,12 +5833,12 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/visitor-keys@7.0.2, @typescript-eslint/visitor-keys@workspace:packages/visitor-keys": +"@typescript-eslint/visitor-keys@7.1.0, @typescript-eslint/visitor-keys@workspace:packages/visitor-keys": version: 0.0.0-use.local resolution: "@typescript-eslint/visitor-keys@workspace:packages/visitor-keys" dependencies: "@types/eslint-visitor-keys": "*" - "@typescript-eslint/types": 7.0.2 + "@typescript-eslint/types": 7.1.0 downlevel-dts: "*" eslint-visitor-keys: ^3.4.1 jest: 29.7.0 @@ -5868,18 +5868,18 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/website-eslint@7.0.2, @typescript-eslint/website-eslint@workspace:packages/website-eslint": +"@typescript-eslint/website-eslint@7.1.0, @typescript-eslint/website-eslint@workspace:packages/website-eslint": version: 0.0.0-use.local resolution: "@typescript-eslint/website-eslint@workspace:packages/website-eslint" dependencies: "@eslint/js": "*" - "@typescript-eslint/eslint-plugin": 7.0.2 - "@typescript-eslint/parser": 7.0.2 - "@typescript-eslint/scope-manager": 7.0.2 - "@typescript-eslint/types": 7.0.2 - "@typescript-eslint/typescript-estree": 7.0.2 - "@typescript-eslint/utils": 7.0.2 - "@typescript-eslint/visitor-keys": 7.0.2 + "@typescript-eslint/eslint-plugin": 7.1.0 + "@typescript-eslint/parser": 7.1.0 + "@typescript-eslint/scope-manager": 7.1.0 + "@typescript-eslint/types": 7.1.0 + "@typescript-eslint/typescript-estree": 7.1.0 + "@typescript-eslint/utils": 7.1.0 + "@typescript-eslint/visitor-keys": 7.1.0 esbuild: ~0.20.0 eslint: "*" esquery: "*" @@ -18427,8 +18427,8 @@ __metadata: version: 0.0.0-use.local resolution: "typescript-eslint@workspace:packages/typescript-eslint" dependencies: - "@typescript-eslint/eslint-plugin": 7.0.2 - "@typescript-eslint/parser": 7.0.2 + "@typescript-eslint/eslint-plugin": 7.1.0 + "@typescript-eslint/parser": 7.1.0 downlevel-dts: "*" jest: 29.7.0 prettier: ^3.0.3 @@ -19217,11 +19217,11 @@ __metadata: "@types/react": "*" "@types/react-helmet": ^6.1.6 "@types/react-router-dom": ^5.3.3 - "@typescript-eslint/eslint-plugin": 7.0.2 - "@typescript-eslint/parser": 7.0.2 - "@typescript-eslint/rule-schema-to-typescript-types": 7.0.2 - "@typescript-eslint/types": 7.0.2 - "@typescript-eslint/website-eslint": 7.0.2 + "@typescript-eslint/eslint-plugin": 7.1.0 + "@typescript-eslint/parser": 7.1.0 + "@typescript-eslint/rule-schema-to-typescript-types": 7.1.0 + "@typescript-eslint/types": 7.1.0 + "@typescript-eslint/website-eslint": 7.1.0 clsx: ^2.0.0 copy-webpack-plugin: ^11.0.0 cross-fetch: "*" pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy