From 2d85288db9082c516982edc57e08988f5e5ab56e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josh=20Goldberg=20=E2=9C=A8?= Date: Tue, 27 Aug 2024 10:11:26 -0400 Subject: [PATCH 01/15] docs: add 'Rule Not Found' FAQ for Local Linking (#9864) --- .../local-development/Local_Linking.mdx | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/docs/contributing/local-development/Local_Linking.mdx b/docs/contributing/local-development/Local_Linking.mdx index 7c7b6cdaf086..8f313fffd21f 100644 --- a/docs/contributing/local-development/Local_Linking.mdx +++ b/docs/contributing/local-development/Local_Linking.mdx @@ -10,6 +10,10 @@ The general strategy to do so is: 2. [Repository linking](#repository-linking): Use your package manager's link command to reference those global symlinks in the local downstream repository. 3. [Trying rules](#trying-rules): Test your local rules and plugins by enabling them in the local downstream repository. +:::tip +Before linking a repository, make sure it's gone through the steps in [Getting Started](../../getting-started/Quickstart.mdx) to be able to use typescript-eslint rules. +::: + ## Global Linking To make all `@typescript-eslint/*` packages available globally, run this command from your `typescript-eslint` repository root: @@ -29,9 +33,15 @@ The command to put instead of that `#` comment, depends on the local downstream - [Yarn v1 / classic](https://classic.yarnpkg.com/lang/en/docs/cli/link/ 'Yarn v1 / classic docs'): `yarn link` - [Yarn v2 / v3 / berry](https://yarnpkg.com/cli/link 'Yarn v2 / v3 / berry docs'): _skip this step altogether_ +Additionally, if you haven't yet built the typescript-eslint repository, do so now: + +```shell +yarn build +``` + ## Repository Linking -Now that the `@typescript-eslint/*` packages are available locally, you can link to them in the local downstream repository. +Now that the `@typescript-eslint/*` packages are built and available locally, you can link to them in the local downstream repository. Run that repository's package manager's link command for any `@typescript-eslint/*` packages that repository depends on: - npm: `npm link @typescript-eslint/eslint-plugin @typescript-eslint/parser` @@ -85,6 +95,15 @@ In this case, you can manually install any missing packages in the local downstr yarn add ts-api-utils -D ``` +### Rules Not Found (`Definition for rule ... was not found`) + +Packages need to be built. +First try re-running `yarn build` from the typescript-eslint repository root. + +If you're adding new rules, you'll need to also modify [`packages/eslint-plugin/src/rules/index.ts`](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/rules/index.ts) to export the rule object, then re-build. + +If you're modifying preset configurations, you'll also need to run `yarn generate-configs`, then re-build. + ### Yarn Link Failures (`Cannot link ... conflicts with parent dependency`) Yarn v2 / v3 / berry can be strict about conflicting dependencies. From 863cc5fdd08b991e8ed79749508f0bdaff8b6fa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josh=20Goldberg=20=E2=9C=A8?= Date: Tue, 27 Aug 2024 10:44:53 -0400 Subject: [PATCH 02/15] docs: added more no-restricted-syntax FAQ examples (#9872) * docs: added more no-restricted-syntax FAQ examples * duplicate static this --- docs/troubleshooting/faqs/General.mdx | 98 +++++++++++++++++++++++++-- 1 file changed, 91 insertions(+), 7 deletions(-) diff --git a/docs/troubleshooting/faqs/General.mdx b/docs/troubleshooting/faqs/General.mdx index 3861f8a44512..9b988d63c416 100644 --- a/docs/troubleshooting/faqs/General.mdx +++ b/docs/troubleshooting/faqs/General.mdx @@ -74,35 +74,119 @@ This generic rule allows you to specify a [selector](https://eslint.org/docs/dev You can use an AST visualization tool such as [typescript-eslint playground](/play#showAST=es) > _Options_ > _AST Explorer_ on its left sidebar by selecting _ESTree_ to help in figuring out the structure of the AST that you want to ban. -For example, you can ban enums (or some variation of) using one of the following configs: +
+Banning confusing property uses ```jsonc { "rules": { "no-restricted-syntax": [ "error", - // ban all enums + + // Ban accessing `constructor.name`: + { + "selector": "MemberExpression[object.property.name='constructor'][property.name='name']", + "message": "'constructor.name' is not reliable after code minifier usage.", + }, + + // Ban get and set accessors: + { + "selector": "Property:matches([kind = \"get\"], [kind = \"set\"]), MethodDefinition:matches([kind = \"get\"], [kind = \"set\"])", + "message": "Don't use get and set accessors.", + }, + ], + }, +} +``` + +
+ +
+Banning specific uses of class properties + +```jsonc +{ + "rules": { + "no-restricted-syntax": [ + "error", + + // Ban `private` members: + { + "selector": ":matches(PropertyDefinition, MethodDefinition)[accessibility=\"private\"]", + "message": "Use `#private` members instead.", + }, + + // Ban `#private` members: + { + "selector": ":matches(PropertyDefinition, MethodDefinition) > PrivateIdentifier.key", + "message": "Use the `private` modifier instead.", + }, + + // Ban static `this`: + { + "selector": "MethodDefinition[static = true] ThisExpression", + "message": "Prefer using the class's name directly.", + }, + ], + }, +} +``` + +
+ +
+Banning specific uses of TypeScript enums + +```jsonc +{ + "rules": { + "no-restricted-syntax": [ + "error", + + // Ban all enums: { "selector": "TSEnumDeclaration", - "message": "My reason for not using any enums at all", + "message": "My reason for not using any enums at all.", }, - // ban just const enums + // Ban just `const` enums: { "selector": "TSEnumDeclaration[const=true]", - "message": "My reason for not using const enums", + "message": "My reason for not using const enums.", }, - // ban just non-const enums + // Ban just non-`const` enums: { "selector": "TSEnumDeclaration:not([const=true])", - "message": "My reason for not using non-const enums", + "message": "My reason for not using non-const enums.", }, ], }, } ``` +
+ +
+Banning specific uses of TypeScript tuples + +```jsonc +{ + "rules": { + "no-restricted-syntax": [ + "error", + // enforce tuple members have labels + { + "selector": "TSTupleType > :not(TSNamedTupleMember)", + "message": "All tuples should have labels.", + }, + ], + }, +} +``` + +
+ ## How do I check to see what versions are installed? If you have multiple versions of our tooling, it can cause various bugs for you. From d9f66da27da692728d12785d883f0eb74b3a0790 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josh=20Goldberg=20=E2=9C=A8?= Date: Tue, 27 Aug 2024 14:28:46 -0400 Subject: [PATCH 03/15] docs: add more project service docs and FAQs (#9871) * docs: add more project service docs and FAQs * Use custom.css instead of inline bold * Update unit tests --- docs/packages/Parser.mdx | 28 +++++--- docs/troubleshooting/typed-linting/index.mdx | 67 ++++++++++++++++--- .../tests/lib/createProjectService.test.ts | 31 +++++++-- ...7-announcing-typescript-eslint-v8-beta.mdx | 2 +- ...4-07-31-announcing-typescript-eslint-v8.md | 2 +- packages/website/src/css/custom.css | 4 ++ 6 files changed, 110 insertions(+), 24 deletions(-) diff --git a/docs/packages/Parser.mdx b/docs/packages/Parser.mdx index c75ca14a8855..a75c1ca8429b 100644 --- a/docs/packages/Parser.mdx +++ b/docs/packages/Parser.mdx @@ -283,7 +283,8 @@ For an option that allows linting files outside of your TSConfig file(s), see [` > Default `false`. Specifies using TypeScript APIs to generate type information for rules. -It 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`). +It will automatically use the nearest `tsconfig.json` for each file (like `project: true`). +It can also be configured to also allow type information to be computed for JavaScript files without the `allowJs` compiler option (unlike `project: true`). @@ -320,24 +321,21 @@ module.exports = { This option brings two main benefits over the older `project`: - Simpler configurations: most projects shouldn't need to explicitly configure `project` paths or create `tsconfig.eslint.json`s -- Improved performance: this API is optimized on the TypeScript side for speed - - Initial versions of this option demonstrated performance changes in subsets of the typescript-eslint monorepo ranging from 11% slower to 70% faster +- Predictability: it uses the same type information services as editors, giving better consistency with the types seen in editors -For more information, see: - -- [feat(typescript-estree): add EXPERIMENTAL_useProjectService option to use TypeScript project service](https://github.com/typescript-eslint/typescript-eslint/pull/6754) -- [docs: blog post on parserOptions.projectService](https://github.com/typescript-eslint/typescript-eslint/pull/8031) +See [FAQs > Typed Linting > Project Service Issues](../troubleshooting/typed-linting/index.mdx#project-service-issues) for help on working with the project service. #### `ProjectServiceOptions` The behavior of `parserOptions.projectService` can be customized by setting it to an object. ```js -module.exports = { +{ parser: '@typescript-eslint/parser', parserOptions: { projectService: { allowDefaultProject: ['*.js'], + defaultProject: 'tsconfig.json', }, }, }; @@ -346,10 +344,24 @@ module.exports = { ##### `allowDefaultProject` Globs of files to allow running with the default project compiler options despite not being matched by the project service. +It takes in an array of string paths that will be resolved relative to the [`tsconfigRootDir`](#tsconfigrootdir). +When set, [`projectService.defaultProject`](#defaultproject) must be set as well. + +This is intended to produce type information for config files such as `eslint.config.js` that aren't included in their sibling `tsconfig.json`. +Every file with type information retrieved from the default project incurs a non-trivial performance overhead to linting. +Use this option sparingly. + +There are several restrictions on this option to prevent it from being overused: + +- `**` is not allowed in globs passed to it +- Files that match `allowDefaultProject` may not also be included in their nearest `tsconfig.json` ##### `defaultProject` Path to a TSConfig to use instead of TypeScript's default project configuration. +It takes in a string path that will be resolved relative to the [`tsconfigRootDir`](#tsconfigrootdir). + +This is required to specify which TSConfig file on disk will be used for [`projectService.allowDefaultProject`](#allowdefaultproject). ##### `maximumDefaultProjectFileMatchCount_THIS_WILL_SLOW_DOWN_LINTING` diff --git a/docs/troubleshooting/typed-linting/index.mdx b/docs/troubleshooting/typed-linting/index.mdx index f1453b63f972..1ac1623e145a 100644 --- a/docs/troubleshooting/typed-linting/index.mdx +++ b/docs/troubleshooting/typed-linting/index.mdx @@ -84,18 +84,21 @@ If the IDE provides different type information from typescript-eslint's report, ## Are TypeScript project references supported? -Yes, but only with [`EXPERIMENTAL_useProjectService`](../../packages/Parser.mdx#experimental_useprojectservice). +Yes, but only with [`parserOptions.projectService`](../../packages/Parser.mdx#projectservice). See [issue #2094 discussing project references](https://github.com/typescript-eslint/typescript-eslint/issues/2094) for more details. ## Project Service Issues - - +[`parserOptions.projectService`](../../packages/Parser.mdx#projectservice) is the recommended parser option to enable typed linting as of typescript-eslint v8. +It enforces projects generate type information for typed linting from the same `tsconfig.json` files used by editors such as VS Code. -### I get errors telling me "Having many files run with the default project is known to cause performance issues and slow down linting." +### I get errors telling me "... was not found by the project service. Consider either including it in the tsconfig.json or including it in allowDefaultProject" + +These errors are caused by attempting to use the project service to lint a file not explicitly included in its nearest `tsconfig.json`. -These errors are caused by attempting to use the [`projectService`](../../packages/Parser.mdx#projectservice) to lint a file not explicitly included in a `tsconfig.json`. +The project service will attempt to build type information for each file being linted using the nearest `tsconfig.json` on disk to that file. +If that `tsconfig.json` does not include the file, and the file isn't allowlisted in [`allowDefaultProject`](../../packages/parser#allowdefaultproject), then the project service will throw this error. For each file being reported: @@ -111,13 +114,61 @@ For each file being reported: + "*.js" ] ``` - 2. Otherwise, consider setting [`parserOptions.createProjectService.allowDefaultProject`](../../packages/parser#allowdefaultproject). + 2. Otherwise, if you have a small number of "out of project" files, try setting [`projectService.allowDefaultProject`](../../packages/parser#allowdefaultproject). + 3. If not, you can switch to [`parserOptions.project`](../../packages/Parser.mdx#project) for more fine-grained control of projects. + +Note also: + +- TSConfigs don't include `.js` files by default. + Enabling [`allowJs`](https://www.typescriptlang.org/tsconfig/#allowJs) or [`checkJs`](https://www.typescriptlang.org/tsconfig/#checkJs) is required to do so. +- The project service _only_ looks at `tsconfig.json` files. + It does not look at `tsconfig.eslint.json` or other coincidentally-similarly-named files. + +If these steps don't work for you, please [file an issue on typescript-eslint's typescript-estree package](https://github.com/typescript-eslint/typescript-eslint/issues/new?assignees=&labels=enhancement%2Ctriage&projects=&template=07-enhancement-other.yaml&title=Enhancement%3A+%3Ca+short+description+of+my+proposal%3E) telling us your use case and why you need more out-of-project files linted. +Be sure to include a minimal reproduction we can work with to understand your use case! + + + +### I get errors telling me "Having many files run with the default project is known to cause performance issues and slow down linting." + +These errors are caused by attempting to use the project service to lint too many files not explicitly included in a `tsconfig.json` with its [`allowDefaultProject`](../../packages/parser#allowdefaultproject) option. typescript-eslint allows up to 8 "out of project" files by default. Each file causes a new TypeScript "program" to be built for each file it includes, which incurs a performance overhead _for each file_. -If you cannot do this, please [file an issue on typescript-eslint's typescript-estree package](https://github.com/typescript-eslint/typescript-eslint/issues/new?assignees=&labels=enhancement%2Ctriage&projects=&template=07-enhancement-other.yaml&title=Enhancement%3A+%3Ca+short+description+of+my+proposal%3E) telling us your use case and why you need more out-of-project files linted. -Be sure to include a minimal reproduction we can work with to understand your use case! +For each file being reported: + +- If you **do not** want to lint the file: + - Use [one of the options ESLint offers to ignore files](https://eslint.org/docs/latest/user-guide/configuring/ignoring-code), such an `ignores` config key. +- If you **do** want to lint the file: + - If you **do not** want to lint the file with [type-aware linting](../../getting-started/Typed_Linting.mdx): [disable type-checked linting for that file](#how-do-i-disable-type-checked-linting-for-a-file). + - If you **do** want to lint the file with [type-aware linting](../../getting-started/Typed_Linting.mdx): + 1. If possible, add the file to the closest `tsconfig.json`'s `include` instead of adding it to `allowDefaultProject`. For example, allowing `.js` files: + ```diff title="tsconfig.json" + "include": [ + "src", + + "*.js" + ] + ``` + 2. If not, you can switch to [`parserOptions.project`](../../packages/Parser.mdx#project) for more fine-grained control of projects. + +### I'd like to use TSConfigs other than `tsconfig.json`s for project service type information + +Only the TSConfig path used for "out of project" files in [`allowDefaultProject`](../../packages/Parser.mdx#allowdefaultproject) can be customized. +Otherwise, only `tsconfig.json` files on disk will be read. + +For example, instead of: + +- `tsconfig.json`s for building (and, coincidentally, type information in editors) +- Separate TSConfig(s) like `tsconfig.eslint.json` for linting + +Consider using: + +- `tsconfig.json`s for linting (and, intentionally, the same type information in editors) +- Separate TSConfig(s) like `tsconfig.build.json` for building + +The project service uses the same underlying TypeScript logic as editors such as VS Code. +Using only `tsconfig.json` for typed linting enforces that the types seen in your editor match what's used for linting. ## Traditional Project Issues diff --git a/packages/typescript-estree/tests/lib/createProjectService.test.ts b/packages/typescript-estree/tests/lib/createProjectService.test.ts index b708188722e1..16b801c007a6 100644 --- a/packages/typescript-estree/tests/lib/createProjectService.test.ts +++ b/packages/typescript-estree/tests/lib/createProjectService.test.ts @@ -61,7 +61,7 @@ describe('createProjectService', () => { expect(settings.allowDefaultProject).toBeUndefined(); }); - it('throws an error when options.defaultProject is set and getParsedConfigFile throws a diagnostic error', () => { + it('throws an error with a relative path when options.defaultProject is set to a relative path and getParsedConfigFile throws a diagnostic error', () => { mockGetParsedConfigFile.mockImplementation(() => { throw new Error('./tsconfig.json(1,1): error TS1234: Oh no!'); }); @@ -80,6 +80,25 @@ describe('createProjectService', () => { ); }); + it('throws an error with a local path when options.defaultProject is set to a local path and getParsedConfigFile throws a diagnostic error', () => { + mockGetParsedConfigFile.mockImplementation(() => { + throw new Error('./tsconfig.json(1,1): error TS1234: Oh no!'); + }); + + expect(() => + createProjectService( + { + allowDefaultProject: ['file.js'], + defaultProject: 'tsconfig.json', + }, + undefined, + undefined, + ), + ).toThrow( + /Could not read default project 'tsconfig.json': .+ error TS1234: Oh no!/, + ); + }); + it('throws an error when options.defaultProject is set and getParsedConfigFile throws an environment error', () => { mockGetParsedConfigFile.mockImplementation(() => { throw new Error( @@ -91,13 +110,13 @@ describe('createProjectService', () => { createProjectService( { allowDefaultProject: ['file.js'], - defaultProject: './tsconfig.json', + defaultProject: 'tsconfig.json', }, undefined, undefined, ), ).toThrow( - "Could not read default project './tsconfig.json': `getParsedConfigFile` is only supported in a Node-like environment.", + "Could not read default project 'tsconfig.json': `getParsedConfigFile` is only supported in a Node-like environment.", ); }); @@ -108,7 +127,7 @@ describe('createProjectService', () => { const { service } = createProjectService( { allowDefaultProject: ['file.js'], - defaultProject: './tsconfig.json', + defaultProject: 'tsconfig.json', }, undefined, undefined, @@ -127,7 +146,7 @@ describe('createProjectService', () => { const { service } = createProjectService( { allowDefaultProject: ['file.js'], - defaultProject: './tsconfig.json', + defaultProject: 'tsconfig.json', }, undefined, tsconfigRootDir, @@ -139,7 +158,7 @@ describe('createProjectService', () => { expect(mockGetParsedConfigFile).toHaveBeenCalledWith( // eslint-disable-next-line @typescript-eslint/no-require-imports require('typescript/lib/tsserverlibrary'), - './tsconfig.json', + 'tsconfig.json', tsconfigRootDir, ); }); diff --git a/packages/website/blog/2024-05-27-announcing-typescript-eslint-v8-beta.mdx b/packages/website/blog/2024-05-27-announcing-typescript-eslint-v8-beta.mdx index 52d2de3c52b8..69189cb2ab01 100644 --- a/packages/website/blog/2024-05-27-announcing-typescript-eslint-v8-beta.mdx +++ b/packages/website/blog/2024-05-27-announcing-typescript-eslint-v8-beta.mdx @@ -133,7 +133,7 @@ export default tseslint.config( // Added lines start projectService: { allowDefaultProject: ['*.js'], - defaultProject: './tsconfig.json', + defaultProject: 'tsconfig.json', }, // Added lines end tsconfigRootDir: import.meta.dirname, diff --git a/packages/website/blog/2024-07-31-announcing-typescript-eslint-v8.md b/packages/website/blog/2024-07-31-announcing-typescript-eslint-v8.md index 80f306e8f760..a0690cab09d7 100644 --- a/packages/website/blog/2024-07-31-announcing-typescript-eslint-v8.md +++ b/packages/website/blog/2024-07-31-announcing-typescript-eslint-v8.md @@ -121,7 +121,7 @@ export default tseslint.config( // Added lines start projectService: { allowDefaultProject: ['*.js'], - defaultProject: './tsconfig.json', + defaultProject: 'tsconfig.json', }, // Added lines end tsconfigRootDir: import.meta.dirname, diff --git a/packages/website/src/css/custom.css b/packages/website/src/css/custom.css index 825b824a9b6a..1fe7a2879640 100644 --- a/packages/website/src/css/custom.css +++ b/packages/website/src/css/custom.css @@ -211,3 +211,7 @@ h6 { td > p:last-child { margin-bottom: 0; } + +h5 { + font-weight: bold; +} From 2421575f7db4056bb309eecd85d6077a3f53c101 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josh=20Goldberg=20=E2=9C=A8?= Date: Tue, 27 Aug 2024 23:31:28 -0400 Subject: [PATCH 04/15] docs: add global variable rule disabling FAQ for ESLint (#9865) * docs: add global variable rule disabling FAQ for ESLint * Linked to FAQ too, good idea * disable-next-line --- docs/troubleshooting/faqs/ESLint.mdx | 45 +++++++++++++++++++ .../eslint-plugin/docs/rules/no-namespace.mdx | 3 ++ 2 files changed, 48 insertions(+) diff --git a/docs/troubleshooting/faqs/ESLint.mdx b/docs/troubleshooting/faqs/ESLint.mdx index 5766af8b487a..d1a5cdf0d809 100644 --- a/docs/troubleshooting/faqs/ESLint.mdx +++ b/docs/troubleshooting/faqs/ESLint.mdx @@ -84,6 +84,51 @@ 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). +## I get errors from the `@typescript-eslint/no-namespace` and/or `no-var` rules about declaring global variables + +Two common solutions in TypeScript for declaring the existence of a global variable include: + +- `declare global` with a `var`, which violates [`no-var`](https://eslint.org/docs/latest/rules/no-var): + + ```ts + declare global { + var myValue: string; + // Unexpected var, use let or const instead. eslint (no-var) + } + + myValue; + ``` + +- `declare namespace globalThis`, which violates [`@typescript-eslint/no-namespace`](https://typescript-eslint.io/rules/no-namespace): + + ```ts + declare namespace globalThis { + // ES2015 module syntax is preferred over namespaces. eslint (@typescript-eslint/no-namespace) + let myValue: string; + } + + globalThis.myValue; + ``` + +[Using global variables is generally discouraged](https://stackoverflow.com/questions/10525582/why-are-global-variables-considered-bad-practice). +If possible, it's best to avoid declaring globals altogether. + +If you absolutely must use one of the two strategies, then you can use an [ESLint configuration comment](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments-1) to disable rules as needed. +For example: + +```ts +declare global { + // eslint-disable-next-line no-var -- Provided by an old third-party integration. + var myValue: string; +} +``` + +:::tip +Whenever you need to disable an ESLint rule, it's best to include an informative comment explaining why. +::: + +See [#9582](https://github.com/typescript-eslint/typescript-eslint/issues/9582 'typescript-eslint/typescript-eslint#9582 Docs: globalThis without ignores of no-var and no-namespace') and [#7941](https://github.com/typescript-eslint/typescript-eslint/issues/7941 'typescript-eslint/typescript-eslint#7941 Base rule extension: no-var configuration for declarations') for discussions around typescript-eslint supporting these use cases. + ## Can I use ESLint's `--cache` with typescript-eslint? [ESLint's `--cache` option](https://eslint.org/docs/latest/use/command-line-interface#caching) caches on a per-file basis. diff --git a/packages/eslint-plugin/docs/rules/no-namespace.mdx b/packages/eslint-plugin/docs/rules/no-namespace.mdx index 3d4f14fe9151..3bb12bf375ae 100644 --- a/packages/eslint-plugin/docs/rules/no-namespace.mdx +++ b/packages/eslint-plugin/docs/rules/no-namespace.mdx @@ -137,6 +137,9 @@ You might consider using [ESLint disable comments](https://eslint.org/docs/lates ## Further Reading +{/* cspell:disable-next-line */} + +- [FAQ: I get errors from the `@typescript-eslint/no-namespace` and/or `no-var` rules about declaring global variables](/troubleshooting/faqs/eslint#i-get-errors-from-the-typescript-eslintno-namespace-andor-no-var-rules-about-declaring-global-variables) - [Modules](https://www.typescriptlang.org/docs/handbook/modules.html) - [Namespaces](https://www.typescriptlang.org/docs/handbook/namespaces.html) - [Namespaces and Modules](https://www.typescriptlang.org/docs/handbook/namespaces-and-modules.html) From cef0912ab76b8dc1aa2c65a7daac90913b4be920 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josh=20Goldberg=20=E2=9C=A8?= Date: Wed, 28 Aug 2024 09:44:19 -0400 Subject: [PATCH 05/15] docs: mention RuleTester static properties (#9874) * docs: mention RuleTester static properties * Apply suggestions from code review Co-authored-by: Kirk Waiblinger --------- Co-authored-by: Kirk Waiblinger --- docs/packages/Rule_Tester.mdx | 80 ++++++++++++++++++++++++++++++----- 1 file changed, 70 insertions(+), 10 deletions(-) diff --git a/docs/packages/Rule_Tester.mdx b/docs/packages/Rule_Tester.mdx index f9f288511ae4..3eb90fb46d78 100644 --- a/docs/packages/Rule_Tester.mdx +++ b/docs/packages/Rule_Tester.mdx @@ -225,6 +225,27 @@ import { RuleTester } from '@typescript-eslint/rule-tester'; RuleTester.afterAll = mocha.after; ``` +#### Node.js (`node:test`) + +Consider setting up `RuleTester`'s static properties in a preloaded module using the [`--import`](https://nodejs.org/api/cli.html#--importmodule) or [`--require`](https://nodejs.org/api/cli.html#-r---require-module) flag: + +```ts +// setup.js +import * as test from 'node:test'; +import { RuleTester } from '@typescript-eslint/rule-tester'; + +RuleTester.afterAll = test.after; +RuleTester.describe = test.describe; +RuleTester.it = test.it; +RuleTester.itOnly = test.it.only; +``` + +Tests can then be [run from the command line](https://nodejs.org/api/test.html#running-tests-from-the-command-line) like so: + +```sh +node --import setup.js --test +``` + #### Vitest Consider setting up `RuleTester`'s static properties in a [`setupFiles` script](https://vitest.dev/config/#setupfiles): @@ -241,13 +262,20 @@ RuleTester.itOnly = vitest.it.only; RuleTester.describe = vitest.describe; ``` -#### Node built-in test runner +#### Other Frameworks -Consider setting up `RuleTester`'s static properties in a preloaded module using the [`--import`](https://nodejs.org/api/cli.html#--importmodule) or [`--require`](https://nodejs.org/api/cli.html#-r---require-module) flag: +In general, `RuleTester` can support any test framework that exposes hooks for running code before or after rules. +From `RuleTester`'s [Static Properties](#static-properties), assign any of the following that the running test framework supports. + +- `afterAll` +- `describe` +- `it` +- `itOnly` + +I.e.: ```ts -// setup.js -import * as test from 'node:test'; +import * as test from '...'; import { RuleTester } from '@typescript-eslint/rule-tester'; RuleTester.afterAll = test.after; @@ -256,12 +284,6 @@ RuleTester.it = test.it; RuleTester.itOnly = test.it.only; ``` -Tests can then be [run from the command line](https://nodejs.org/api/test.html#running-tests-from-the-command-line) like so: - -```sh -node --import setup.js --test -``` - ## Options ### `RuleTester` constructor options @@ -281,3 +303,41 @@ import ValidTestCase from '!!raw-loader!../../packages/rule-tester/src/types/Val import InvalidTestCase from '!!raw-loader!../../packages/rule-tester/src/types/InvalidTestCase.ts'; {InvalidTestCase} + +## Static Properties + +Each of the following properties may be assigned to as static members of the `RuleTester` class. + +For example, to assign `afterAll`: + +```ts +import { RuleTester } from '@typescript-eslint/rule-tester'; + +RuleTester.afterAll = () => { + // ... +}; +``` + +### `afterAll` + +Runs after all the tests in this file have completed. + +### `describe` + +Creates a test grouping. + +### `describeSkip` + +Skips running the tests inside this `describe`. + +### `it` + +Creates a test closure. + +### `itOnly` + +Skips all other tests in the current file. + +### `itSkip` + +Skips running this test. From 5fd42513ce9c99b2c8232fe2c1a021920c7deb35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josh=20Goldberg=20=E2=9C=A8?= Date: Thu, 29 Aug 2024 14:31:18 -0400 Subject: [PATCH 06/15] docs: fill in most remaining rule option descriptions (#9868) docs: fill in most remainng rule option descriptions --- .../docs/rules/ban-ts-comment.mdx | 2 +- .../docs/rules/consistent-type-assertions.mdx | 7 ++- .../docs/rules/consistent-type-exports.mdx | 2 +- .../docs/rules/consistent-type-imports.mdx | 6 +-- .../eslint-plugin/docs/rules/dot-notation.mdx | 8 ++++ .../rules/explicit-member-accessibility.mdx | 3 +- .../eslint-plugin/docs/rules/max-params.mdx | 42 ++++++++++++++++ .../docs/rules/no-base-to-string.mdx | 3 +- .../rules/no-confusing-void-expression.mdx | 8 +++- .../docs/rules/no-inferrable-types.mdx | 4 ++ .../docs/rules/no-invalid-void-type.mdx | 4 +- .../docs/rules/no-magic-numbers.mdx | 8 ++-- .../rules/no-meaningless-void-operator.mdx | 2 +- .../docs/rules/no-misused-promises.mdx | 2 + .../eslint-plugin/docs/rules/no-redeclare.mdx | 2 +- .../docs/rules/no-restricted-imports.mdx | 2 +- .../eslint-plugin/docs/rules/no-shadow.mdx | 4 +- .../docs/rules/no-use-before-define.mdx | 8 +++- .../docs/rules/prefer-literal-enum-member.mdx | 2 +- .../docs/rules/prefer-nullish-coalescing.mdx | 10 ++-- .../rules/prefer-readonly-parameter-types.mdx | 10 ++-- .../docs/rules/promise-function-async.mdx | 4 +- packages/eslint-plugin/docs/rules/typedef.mdx | 2 +- .../eslint-plugin/src/rules/ban-ts-comment.ts | 2 + .../src/rules/consistent-type-assertions.ts | 4 ++ .../src/rules/consistent-type-exports.ts | 3 +- .../src/rules/consistent-type-imports.ts | 6 ++- .../eslint-plugin/src/rules/dot-notation.ts | 8 ++++ .../rules/explicit-member-accessibility.ts | 2 +- .../eslint-plugin/src/rules/max-params.ts | 10 +++- .../src/rules/no-base-to-string.ts | 2 + .../src/rules/no-confusing-void-expression.ts | 12 ++++- .../rules/no-duplicate-type-constituents.ts | 2 + .../src/rules/no-empty-function.ts | 2 + .../src/rules/no-empty-interface.ts | 2 + .../src/rules/no-empty-object-type.ts | 4 ++ .../src/rules/no-floating-promises.ts | 11 ++++- .../src/rules/no-inferrable-types.ts | 2 + .../src/rules/no-invalid-void-type.ts | 4 ++ .../src/rules/no-magic-numbers.ts | 5 ++ .../src/rules/no-meaningless-void-operator.ts | 2 + .../src/rules/no-misused-promises.ts | 37 +++++++++++--- .../eslint-plugin/src/rules/no-redeclare.ts | 4 ++ packages/eslint-plugin/src/rules/no-shadow.ts | 11 +++++ .../eslint-plugin/src/rules/no-unused-vars.ts | 24 ++++++++-- .../src/rules/no-use-before-define.ts | 33 ++++++++++--- .../src/rules/only-throw-error.ts | 4 ++ .../src/rules/parameter-properties.ts | 4 ++ .../src/rules/prefer-literal-enum-member.ts | 2 + .../src/rules/prefer-nullish-coalescing.ts | 10 ++++ .../src/rules/prefer-promise-reject-errors.ts | 2 + .../rules/prefer-readonly-parameter-types.ts | 15 ++++-- .../src/rules/prefer-readonly.ts | 2 + .../src/rules/promise-function-async.ts | 5 ++ .../eslint-plugin/src/rules/return-await.ts | 30 +++++++++--- .../src/rules/strict-boolean-expressions.ts | 45 +++++++++++++---- .../src/rules/triple-slash-reference.ts | 6 +++ packages/eslint-plugin/src/rules/typedef.ts | 48 +++++++++++++++---- .../max-params.shot | 22 +++++++++ .../schema-snapshots/ban-ts-comment.shot | 2 + .../consistent-type-assertions.shot | 20 ++++++-- .../consistent-type-exports.shot | 2 + .../consistent-type-imports.shot | 16 ++++++- .../tests/schema-snapshots/dot-notation.shot | 10 ++++ .../explicit-member-accessibility.shot | 2 + .../tests/schema-snapshots/max-params.shot | 6 +++ .../schema-snapshots/no-base-to-string.shot | 2 + .../no-confusing-void-expression.shot | 4 ++ .../no-duplicate-type-constituents.shot | 4 ++ .../schema-snapshots/no-empty-function.shot | 2 + .../schema-snapshots/no-empty-interface.shot | 2 + .../no-empty-object-type.shot | 17 ++++++- .../no-floating-promises.shot | 4 ++ .../schema-snapshots/no-inferrable-types.shot | 4 ++ .../no-invalid-void-type.shot | 9 +++- .../schema-snapshots/no-magic-numbers.shot | 8 ++++ .../no-meaningless-void-operator.shot | 2 + .../schema-snapshots/no-misused-promises.shot | 14 ++++++ .../tests/schema-snapshots/no-redeclare.shot | 4 ++ .../tests/schema-snapshots/no-shadow.shot | 18 ++++++- .../schema-snapshots/no-unused-vars.shot | 36 ++++++++++++-- .../no-use-before-define.shot | 12 +++++ .../schema-snapshots/only-throw-error.shot | 4 ++ .../parameter-properties.shot | 9 +++- .../prefer-literal-enum-member.shot | 2 + .../prefer-nullish-coalescing.shot | 15 +++++- .../prefer-promise-reject-errors.shot | 2 + .../prefer-readonly-parameter-types.shot | 8 ++++ .../schema-snapshots/prefer-readonly.shot | 2 + .../promise-function-async.shot | 8 ++++ .../tests/schema-snapshots/return-await.shot | 35 +++++++++++--- .../strict-boolean-expressions.shot | 16 +++++++ .../triple-slash-reference.shot | 22 +++++++-- .../tests/schema-snapshots/typedef.shot | 16 +++++++ 94 files changed, 764 insertions(+), 107 deletions(-) create mode 100644 packages/eslint-plugin/tests/docs-eslint-output-snapshots/max-params.shot diff --git a/packages/eslint-plugin/docs/rules/ban-ts-comment.mdx b/packages/eslint-plugin/docs/rules/ban-ts-comment.mdx index ca36964e28cb..8f287665a3ce 100644 --- a/packages/eslint-plugin/docs/rules/ban-ts-comment.mdx +++ b/packages/eslint-plugin/docs/rules/ban-ts-comment.mdx @@ -153,7 +153,7 @@ if (false) { ## When Not To Use It -If your project or its dependencies were not architected with strong type safety in mind, it can be difficult to always adhere to proper TypeScript semantics. +If your project or its dependencies were not architected with strong type safety in mind, it can be difficult to always adhere to proper TypeScript semantics. You might consider using [ESLint disable comments](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments-1) for those specific situations instead of completely disabling this rule. ## Further Reading diff --git a/packages/eslint-plugin/docs/rules/consistent-type-assertions.mdx b/packages/eslint-plugin/docs/rules/consistent-type-assertions.mdx index 225c35e92195..cf437b9ed714 100644 --- a/packages/eslint-plugin/docs/rules/consistent-type-assertions.mdx +++ b/packages/eslint-plugin/docs/rules/consistent-type-assertions.mdx @@ -30,7 +30,7 @@ Examples of them include `let x = "hello" as const;` and `let x = "hello" ### `assertionStyle` -This option defines the expected assertion style. Valid values for `assertionStyle` are: +The expected assertion style to enforce. Valid values for `assertionStyle` are: - `as` will enforce that you always use `... as foo`. - `angle-bracket` will enforce that you always use `...` @@ -42,7 +42,10 @@ Some codebases like to go for an extra level of type safety, and ban assertions ### `objectLiteralTypeAssertions` -Always prefer `const x: T = { ... };` to `const x = { ... } as T;` (or similar with angle brackets). The type assertion in the latter case is either unnecessary or will probably hide an error. +Whether to always prefer type declarations for object literals used as variable initializers, rather than type assertions. + +For example, this would prefer `const x: T = { ... };` to `const x = { ... } as T;` (or similar with angle brackets). +The type assertion in the latter case is either unnecessary or will probably hide an error. The compiler will warn for excess properties with this syntax, but not missing _required_ fields. For example: `const x: { foo: number } = {};` will fail to compile, but `const x = {} as { foo: number }` will succeed. diff --git a/packages/eslint-plugin/docs/rules/consistent-type-exports.mdx b/packages/eslint-plugin/docs/rules/consistent-type-exports.mdx index 7c699d1096aa..7c2ed45dcda9 100644 --- a/packages/eslint-plugin/docs/rules/consistent-type-exports.mdx +++ b/packages/eslint-plugin/docs/rules/consistent-type-exports.mdx @@ -54,7 +54,7 @@ export type { ButtonProps }; ### `fixMixedExportsWithInlineTypeSpecifier` -When this is set to true, the rule will autofix "mixed" export cases using TS 4.5's "inline type specifier". +Whether the rule will autofix "mixed" export cases using TS inline type specifiers. If you are using a TypeScript version less than 4.5, then you will not be able to use this option. For example the following code: diff --git a/packages/eslint-plugin/docs/rules/consistent-type-imports.mdx b/packages/eslint-plugin/docs/rules/consistent-type-imports.mdx index 8df00017e565..cacc53d50a2c 100644 --- a/packages/eslint-plugin/docs/rules/consistent-type-imports.mdx +++ b/packages/eslint-plugin/docs/rules/consistent-type-imports.mdx @@ -18,7 +18,7 @@ This allows transpilers to drop imports without knowing the types of the depende ### `prefer` -This option defines the expected import kind for type-only imports. Valid values for `prefer` are: +The expected import kind for type-only imports. Valid values for `prefer` are: - `type-imports` will enforce that you always use `import type Foo from '...'` except referenced by metadata of decorators. It is the default. - `no-type-imports` will enforce that you always use `import Foo from '...'`. @@ -43,7 +43,7 @@ const x: Bar = 1; ### `fixStyle` -This option defines the expected type modifier to be added when an import is detected as used only in the type position. Valid values for `fixStyle` are: +The expected type modifier to be added when an import is detected as used only in the type position. Valid values for `fixStyle` are: - `separate-type-imports` will add the type keyword after the import keyword `import type { A } from '...'`. It is the default. - `inline-type-imports` will inline the type keyword `import { type A } from '...'` and is only available in TypeScript 4.5 and onwards. See [documentation here](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-5.html#type-modifiers-on-import-names 'TypeScript 4.5 documentation on type modifiers and import names'). @@ -83,7 +83,7 @@ const x: Bar = 1; ### `disallowTypeAnnotations` -If `true`, type imports in type annotations (`import()`) are not allowed. +Whether to disallow type imports in type annotations (`import()`). Default is `true`. Examples of **incorrect** code with `{disallowTypeAnnotations: true}`: diff --git a/packages/eslint-plugin/docs/rules/dot-notation.mdx b/packages/eslint-plugin/docs/rules/dot-notation.mdx index ba23d98b366f..cf44c44028b8 100644 --- a/packages/eslint-plugin/docs/rules/dot-notation.mdx +++ b/packages/eslint-plugin/docs/rules/dot-notation.mdx @@ -38,6 +38,9 @@ If the TypeScript compiler option `noPropertyAccessFromIndexSignature` is set to ### `allowPrivateClassPropertyAccess` +Whether to allow accessing class members marked as `private` with array notation. +This can be useful because TypeScript will report a type error on dot notation but not array notation. + Example of a correct code when `allowPrivateClassPropertyAccess` is set to `true`: ```ts option='{ "allowPrivateClassPropertyAccess": true }' showPlaygroundButton @@ -51,6 +54,9 @@ x['priv_prop'] = 123; ### `allowProtectedClassPropertyAccess` +Whether to allow accessing class members marked as `protected` with array notation. +This can be useful because TypeScript will report a type error on dot notation but not array notation. + Example of a correct code when `allowProtectedClassPropertyAccess` is set to `true`: ```ts option='{ "allowProtectedClassPropertyAccess": true }' showPlaygroundButton @@ -64,6 +70,8 @@ x['protected_prop'] = 123; ### `allowIndexSignaturePropertyAccess` +Whether to allow accessing properties matching an index signature with array notation. + Example of correct code when `allowIndexSignaturePropertyAccess` is set to `true`: ```ts option='{ "allowIndexSignaturePropertyAccess": true }' showPlaygroundButton diff --git a/packages/eslint-plugin/docs/rules/explicit-member-accessibility.mdx b/packages/eslint-plugin/docs/rules/explicit-member-accessibility.mdx index 59eaa315afb1..60f4f6c2a810 100644 --- a/packages/eslint-plugin/docs/rules/explicit-member-accessibility.mdx +++ b/packages/eslint-plugin/docs/rules/explicit-member-accessibility.mdx @@ -317,7 +317,8 @@ class Animal { ### `ignoredMethodNames` -If you want to ignore some specific methods, you can do it by specifying method names. Note that this option does not care for the context, and will ignore every method with these names, which could lead to it missing some cases. You should use this sparingly. +Specific method names that may be ignored. +Note that this option does not care for the context, and will ignore every method with these names, which could lead to it missing some cases. You should use this sparingly. e.g. `[ { ignoredMethodNames: ['specificMethod', 'whateverMethod'] } ]` ```ts option='{ "ignoredMethodNames": ["specificMethod", "whateverMethod"] }' showPlaygroundButton diff --git a/packages/eslint-plugin/docs/rules/max-params.mdx b/packages/eslint-plugin/docs/rules/max-params.mdx index 3e1d80bb1563..1797dffaec73 100644 --- a/packages/eslint-plugin/docs/rules/max-params.mdx +++ b/packages/eslint-plugin/docs/rules/max-params.mdx @@ -11,3 +11,45 @@ import TabItem from '@theme/TabItem'; This rule extends the base [`eslint/max-params`](https://eslint.org/docs/rules/max-params) rule. This version adds support for TypeScript `this` parameters so they won't be counted as a parameter. + +## Options + +This rule adds the following options: + +```ts +interface Options extends BaseMaxParamsOptions { + countVoidThis?: boolean; +} + +const defaultOptions: Options = { + ...baseMaxParamsOptions, + countVoidThis: false, +}; +``` + +### `countVoidThis` + +Whether to count a `this` declaration when the type is `void`. + +Example of a code when `countVoidThis` is set to `false` and `max` is `1`: + + + + +```ts option='{ "countVoidThis": false, "max": 1 }' +function hasNoThis(this: void, first: string, second: string) { + // ... +} +``` + + + + +```ts option='{ "countVoidThis": false, "max": 1 }' +function hasNoThis(this: void, first: string) { + // ... +} +``` + + + diff --git a/packages/eslint-plugin/docs/rules/no-base-to-string.mdx b/packages/eslint-plugin/docs/rules/no-base-to-string.mdx index f959897d7e68..97767da415b8 100644 --- a/packages/eslint-plugin/docs/rules/no-base-to-string.mdx +++ b/packages/eslint-plugin/docs/rules/no-base-to-string.mdx @@ -66,7 +66,8 @@ const literalWithToString = { ### `ignoredTypeNames` -A string array of type names to ignore, this is useful for types missing `toString()` (but actually has `toString()`). +Stringified regular expressions of type names to ignore. +This is useful for types missing `toString()` (but actually has `toString()`). There are some types missing `toString()` in old version TypeScript, like `RegExp`, `URL`, `URLSearchParams` etc. The following patterns are considered correct with the default options `{ ignoredTypeNames: ["RegExp"] }`: diff --git a/packages/eslint-plugin/docs/rules/no-confusing-void-expression.mdx b/packages/eslint-plugin/docs/rules/no-confusing-void-expression.mdx index 043b07521c6b..b779558319b7 100644 --- a/packages/eslint-plugin/docs/rules/no-confusing-void-expression.mdx +++ b/packages/eslint-plugin/docs/rules/no-confusing-void-expression.mdx @@ -77,8 +77,10 @@ cond ? console.log('true') : console.error('false'); ### `ignoreArrowShorthand` -It might be undesirable to wrap every arrow function shorthand expression with braces. -Especially when using Prettier formatter, which spreads such code across 3 lines instead of 1. +Whether to ignore "shorthand" `() =>` arrow functions: those without `{ ... }` braces. + +It might be undesirable to wrap every arrow function shorthand expression. +Especially when using the Prettier formatter, which spreads such code across 3 lines instead of 1. Examples of additional **correct** code with this option enabled: @@ -88,6 +90,8 @@ promise.then(value => window.postMessage(value)); ### `ignoreVoidOperator` +Whether to ignore returns that start with the `void` operator. + It might be preferable to only use some distinct syntax to explicitly mark the confusing but valid usage of void expressions. This option allows void expressions which are explicitly wrapped in the `void` operator. diff --git a/packages/eslint-plugin/docs/rules/no-inferrable-types.mdx b/packages/eslint-plugin/docs/rules/no-inferrable-types.mdx index ff21a3538a35..0cf7caa4d767 100644 --- a/packages/eslint-plugin/docs/rules/no-inferrable-types.mdx +++ b/packages/eslint-plugin/docs/rules/no-inferrable-types.mdx @@ -80,6 +80,8 @@ function fn(a = 5, b = true) {} ### `ignoreParameters` +Whether to ignore function parameters. + When set to true, the following pattern is considered valid: ```ts option='{ "ignoreParameters": true }' showPlaygroundButton @@ -90,6 +92,8 @@ function foo(a: number = 5, b: boolean = true) { ### `ignoreProperties` +Whether to ignore class properties. + When set to true, the following pattern is considered valid: ```ts option='{ "ignoreProperties": true }' showPlaygroundButton diff --git a/packages/eslint-plugin/docs/rules/no-invalid-void-type.mdx b/packages/eslint-plugin/docs/rules/no-invalid-void-type.mdx index d73d09512264..1e6a1507a3fa 100644 --- a/packages/eslint-plugin/docs/rules/no-invalid-void-type.mdx +++ b/packages/eslint-plugin/docs/rules/no-invalid-void-type.mdx @@ -62,7 +62,7 @@ type stillVoid = void | never; ### `allowInGenericTypeArguments` -This option lets you control if `void` can be used as a valid value for generic type parameters. +Whether `void` can be used as a valid value for generic type parameters. Alternatively, you can provide an array of strings which whitelist which types may accept `void` as a generic type parameter. @@ -98,7 +98,7 @@ type AllowedVoidUnion = void | Ex.Mx.Tx; ### `allowAsThisParameter` -This option allows specifying a `this` parameter of a function to be `void` when set to `true`. +Whether a `this` parameter of a function may be `void`. This pattern can be useful to explicitly label function types that do not use a `this` argument. [See the TypeScript docs for more information](https://www.typescriptlang.org/docs/handbook/functions.html#this-parameters-in-callbacks). This option is `false` by default. diff --git a/packages/eslint-plugin/docs/rules/no-magic-numbers.mdx b/packages/eslint-plugin/docs/rules/no-magic-numbers.mdx index c8a2058791ee..2110f5bed847 100644 --- a/packages/eslint-plugin/docs/rules/no-magic-numbers.mdx +++ b/packages/eslint-plugin/docs/rules/no-magic-numbers.mdx @@ -39,7 +39,7 @@ const defaultOptions: Options = { ### `ignoreEnums` -A boolean to specify if enums used in TypeScript are considered okay. `false` by default. +Whether enums used in TypeScript are considered okay. `false` by default. Examples of **incorrect** code for the `{ "ignoreEnums": false }` option: @@ -59,7 +59,7 @@ enum foo { ### `ignoreNumericLiteralTypes` -A boolean to specify if numbers used in TypeScript numeric literal types are considered okay. `false` by default. +Whether numbers used in TypeScript numeric literal types are considered okay. `false` by default. Examples of **incorrect** code for the `{ "ignoreNumericLiteralTypes": false }` option: @@ -75,6 +75,8 @@ type SmallPrimes = 2 | 3 | 5 | 7 | 11; ### `ignoreReadonlyClassProperties` +Whether `readonly` class properties are considered okay. + Examples of **incorrect** code for the `{ "ignoreReadonlyClassProperties": false }` option: ```ts option='{ "ignoreReadonlyClassProperties": false }' showPlaygroundButton @@ -99,7 +101,7 @@ class Foo { ### `ignoreTypeIndexes` -A boolean to specify if numbers used to index types are okay. `false` by default. +Whether numbers used to index types are okay. `false` by default. Examples of **incorrect** code for the `{ "ignoreTypeIndexes": false }` option: diff --git a/packages/eslint-plugin/docs/rules/no-meaningless-void-operator.mdx b/packages/eslint-plugin/docs/rules/no-meaningless-void-operator.mdx index 905c70618710..518da46b3328 100644 --- a/packages/eslint-plugin/docs/rules/no-meaningless-void-operator.mdx +++ b/packages/eslint-plugin/docs/rules/no-meaningless-void-operator.mdx @@ -54,7 +54,7 @@ void bar(1); // discarding a number ### `checkNever` -`checkNever: true` will suggest removing `void` when the argument has type `never`. +Whether to suggest removing `void` when the argument has type `never`. ## When Not To Use It diff --git a/packages/eslint-plugin/docs/rules/no-misused-promises.mdx b/packages/eslint-plugin/docs/rules/no-misused-promises.mdx index 4ac2c491cde0..bc8ae0f33b6e 100644 --- a/packages/eslint-plugin/docs/rules/no-misused-promises.mdx +++ b/packages/eslint-plugin/docs/rules/no-misused-promises.mdx @@ -101,6 +101,8 @@ Disables checking an asynchronous function used as a variable whose return type ### `checksSpreads` +Whether to warn when `...` spreading a `Promise`. + If you don't want to check object spreads, you can add this configuration: ```json diff --git a/packages/eslint-plugin/docs/rules/no-redeclare.mdx b/packages/eslint-plugin/docs/rules/no-redeclare.mdx index 8c896acb20c9..cf0171d484e8 100644 --- a/packages/eslint-plugin/docs/rules/no-redeclare.mdx +++ b/packages/eslint-plugin/docs/rules/no-redeclare.mdx @@ -33,7 +33,7 @@ const defaultOptions: Options = { ### `ignoreDeclarationMerge` -When set to `true`, the rule will ignore declaration merges between the following sets: +Whether to ignore declaration merges between the following sets: - interface + interface - namespace + namespace diff --git a/packages/eslint-plugin/docs/rules/no-restricted-imports.mdx b/packages/eslint-plugin/docs/rules/no-restricted-imports.mdx index d74494d41e18..621bf351e833 100644 --- a/packages/eslint-plugin/docs/rules/no-restricted-imports.mdx +++ b/packages/eslint-plugin/docs/rules/no-restricted-imports.mdx @@ -45,7 +45,7 @@ You can specify this option for a specific path or pattern as follows: } ``` -When set to `true`, the rule will allow [Type-Only Imports](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export). +Whether to allow [Type-Only Imports](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export). Examples of code with the above config: diff --git a/packages/eslint-plugin/docs/rules/no-shadow.mdx b/packages/eslint-plugin/docs/rules/no-shadow.mdx index 2e9328907161..40651e2fbe99 100644 --- a/packages/eslint-plugin/docs/rules/no-shadow.mdx +++ b/packages/eslint-plugin/docs/rules/no-shadow.mdx @@ -31,7 +31,7 @@ const defaultOptions: Options = { ### `ignoreTypeValueShadow` -When set to `true`, the rule will ignore the case when you name a type the same as a variable. This is generally safe because you cannot use variables in type locations without a `typeof` operator, so there's little risk of confusion. +Whether to ignore types named the same as a variable. This is generally safe because you cannot use variables in type locations without a `typeof` operator, so there's little risk of confusion. Examples of **correct** code with `{ ignoreTypeValueShadow: true }`: @@ -55,7 +55,7 @@ _Shadowing_ specifically refers to two identical identifiers that are in differe ### `ignoreFunctionTypeParameterNameValueShadow` -When set to `true`, the rule will ignore the case when you name a parameter in a function type the same as a variable. +Whether to ignore function parameters named the same as a variable. Each of a function type's arguments creates a value variable within the scope of the function type. This is done so that you can reference the type later using the `typeof` operator: diff --git a/packages/eslint-plugin/docs/rules/no-use-before-define.mdx b/packages/eslint-plugin/docs/rules/no-use-before-define.mdx index 09afc8b973d1..29bf8b75a0a7 100644 --- a/packages/eslint-plugin/docs/rules/no-use-before-define.mdx +++ b/packages/eslint-plugin/docs/rules/no-use-before-define.mdx @@ -33,6 +33,8 @@ const defaultOptions: Options = { ### `enums` +Whether to check references to enums before the enum declaration. + If this is `true`, this rule warns every reference to a enum before the enum declaration. If this is `false`, this rule will ignore references to enums, when the reference is in a child scope. @@ -67,6 +69,8 @@ enum Foo { ### `typedefs` +Whether to check references to types before the type declaration. + If this is `true`, this rule warns every reference to a type before the type declaration. If this is `false`, this rule will ignore references to types. @@ -79,7 +83,9 @@ type StringOrNumber = string | number; ### `ignoreTypeReferences` -If this is `true`, this rule ignores all type references, such as in type annotations and assertions. +Whether to ignore type references, such as in type annotations and assertions. + +If this is `true`, this rule ignores all type references. If this is `false`, this will check all type references. Examples of **correct** code for the `{ "ignoreTypeReferences": true }` option: diff --git a/packages/eslint-plugin/docs/rules/prefer-literal-enum-member.mdx b/packages/eslint-plugin/docs/rules/prefer-literal-enum-member.mdx index a2088d0d1956..5f9e4ac03736 100644 --- a/packages/eslint-plugin/docs/rules/prefer-literal-enum-member.mdx +++ b/packages/eslint-plugin/docs/rules/prefer-literal-enum-member.mdx @@ -67,7 +67,7 @@ enum Valid { ### `allowBitwiseExpressions` -When set to `true` will allow you to use bitwise expressions in enum initializer (default: `false`). +Whether to allow using bitwise expressions in enum initializers (default: `false`). Examples of code for the `{ "allowBitwiseExpressions": true }` option: diff --git a/packages/eslint-plugin/docs/rules/prefer-nullish-coalescing.mdx b/packages/eslint-plugin/docs/rules/prefer-nullish-coalescing.mdx index 6748b58873ba..f36acad8e05f 100644 --- a/packages/eslint-plugin/docs/rules/prefer-nullish-coalescing.mdx +++ b/packages/eslint-plugin/docs/rules/prefer-nullish-coalescing.mdx @@ -25,7 +25,7 @@ This rule will not work as expected if [`strictNullChecks`](https://www.typescri ### `ignoreTernaryTests` -Setting this option to `true` will cause the rule to ignore any ternary expressions that could be simplified by using the nullish coalescing operator. This is set to `false` by default. +Whether to ignore any ternary expressions that could be simplified by using the nullish coalescing operator. This is set to `false` by default. Incorrect code for `ignoreTernaryTests: false`, and correct code for `ignoreTernaryTests: true`: @@ -65,7 +65,7 @@ foo ?? 'a string'; ### `ignoreConditionalTests` -Setting this option to `false` will cause the rule to also check cases that are located within a conditional test. This is set to `true` by default. +Whether to ignore cases that are located within a conditional test. This is set to `true` by default. Generally expressions within conditional tests intentionally use the falsy fallthrough behavior of the logical or operator, meaning that fixing the operator to the nullish coalesce operator could cause bugs. @@ -107,7 +107,7 @@ a ?? b ? true : false; ### `ignoreMixedLogicalExpressions` -Setting this option to `true` will cause the rule to ignore any logical or expressions that are part of a mixed logical expression (with `&&`). This is set to `false` by default. +Whether to ignore any logical or expressions that are part of a mixed logical expression (with `&&`). This is set to `false` by default. Generally expressions within mixed logical expressions intentionally use the falsy fallthrough behavior of the logical or operator, meaning that fixing the operator to the nullish coalesce operator could cause bugs. @@ -147,6 +147,8 @@ a ?? (b && c && d); ### `ignorePrimitives` +Whether to ignore all (`true`) or some (an object with properties) primitive types. + If you would like to ignore expressions containing operands of certain primitive types that can be falsy then you may pass an object containing a boolean value for each primitive: - `string: true`, ignores `null` or `undefined` unions with `string` (default: false). @@ -172,7 +174,7 @@ Also, if you would like to ignore all primitives types, you can set `ignorePrimi ### `allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing` -If this is set to `false`, then the rule will error on every file whose `tsconfig.json` does _not_ have the `strictNullChecks` compiler option (or `strict`) set to `true`. +Unless this is set to `true`, the rule will error on every file whose `tsconfig.json` does _not_ have the `strictNullChecks` compiler option (or `strict`) set to `true`. Without `strictNullChecks`, TypeScript essentially erases `undefined` and `null` from the types. This means when this rule inspects the types from a variable, **it will not be able to tell that the variable might be `null` or `undefined`**, which essentially makes this rule useless. diff --git a/packages/eslint-plugin/docs/rules/prefer-readonly-parameter-types.mdx b/packages/eslint-plugin/docs/rules/prefer-readonly-parameter-types.mdx index e2ddcef23048..e700b429f4f6 100644 --- a/packages/eslint-plugin/docs/rules/prefer-readonly-parameter-types.mdx +++ b/packages/eslint-plugin/docs/rules/prefer-readonly-parameter-types.mdx @@ -140,9 +140,9 @@ interface Foo { ### `allow` +An array of type specifiers to ignore. Some complex types cannot easily be made readonly, for example the `HTMLElement` type or the `JQueryStatic` type from `@types/jquery`. This option allows you to globally disable reporting of such types. -This option takes an array of type specifiers to ignore. Each item in the array must have one of the following forms: - A type defined in a file (`{ from: "file", name: "Foo", path: "src/foo-file.ts" }` with `path` being an optional path relative to the project root directory) @@ -258,7 +258,7 @@ function fn(arg: Foo) {} ### `checkParameterProperties` -This option allows you to enable or disable the checking of parameter properties. +Whether to check class parameter properties. Because parameter properties create properties on the class, it may be undesirable to force them to be readonly. Examples of code for this rule with `{checkParameterProperties: true}`: @@ -297,7 +297,8 @@ class Foo { ### `ignoreInferredTypes` -This option allows you to ignore parameters which don't explicitly specify a type. This may be desirable in cases where an external dependency specifies a callback with mutable parameters, and manually annotating the callback's parameters is undesirable. +Whether to ignore parameters which don't explicitly specify a type. +This may be desirable in cases where an external dependency specifies a callback with mutable parameters, and manually annotating the callback's parameters is undesirable. Examples of code for this rule with `{ignoreInferredTypes: true}`: @@ -354,7 +355,8 @@ export const acceptsCallback: AcceptsCallback; ### `treatMethodsAsReadonly` -This option allows you to treat all mutable methods as though they were readonly. This may be desirable when you are never reassigning methods. +Whether to treat all mutable methods as though they are readonly. +This may be desirable when you are never reassigning methods. Examples of code for this rule with `{treatMethodsAsReadonly: false}`: diff --git a/packages/eslint-plugin/docs/rules/promise-function-async.mdx b/packages/eslint-plugin/docs/rules/promise-function-async.mdx index bb506ad08bfc..aabe921925d3 100644 --- a/packages/eslint-plugin/docs/rules/promise-function-async.mdx +++ b/packages/eslint-plugin/docs/rules/promise-function-async.mdx @@ -68,7 +68,7 @@ async function functionReturnsUnionWithPromiseImplicitly(p: boolean) { ### `allowAny` -Whether to ignore functions that return `any` and `unknown`. +Whether to ignore functions that return `any` or `unknown`. If you want additional safety, consider turning this option off, as it makes the rule less able to catch incorrect Promise behaviors. Examples of code with `{ "allowAny": false }`: @@ -135,7 +135,7 @@ Whether to check inline function expressions. ### `checkMethodDeclarations` -Whether to check methods on classes and object literals +Whether to check methods on classes and object literals. `true` by default, but can be set to `false` to ignore them. ## When Not To Use It diff --git a/packages/eslint-plugin/docs/rules/typedef.mdx b/packages/eslint-plugin/docs/rules/typedef.mdx index cfbe5fa1a8c5..46fa0134c90f 100644 --- a/packages/eslint-plugin/docs/rules/typedef.mdx +++ b/packages/eslint-plugin/docs/rules/typedef.mdx @@ -306,7 +306,7 @@ let delayedText: string; ### `variableDeclarationIgnoreFunction` -Ignore variable declarations for non-arrow and arrow functions. +Whether to ignore variable declarations for non-arrow and arrow functions. Examples of code with `{ "variableDeclaration": true, "variableDeclarationIgnoreFunction": true }`: diff --git a/packages/eslint-plugin/src/rules/ban-ts-comment.ts b/packages/eslint-plugin/src/rules/ban-ts-comment.ts index b554510f57d3..44970393cfc7 100644 --- a/packages/eslint-plugin/src/rules/ban-ts-comment.ts +++ b/packages/eslint-plugin/src/rules/ban-ts-comment.ts @@ -84,6 +84,8 @@ export default createRule<[Options], MessageIds>({ 'ts-nocheck': { $ref: '#/items/0/$defs/directiveConfigSchema' }, 'ts-check': { $ref: '#/items/0/$defs/directiveConfigSchema' }, minimumDescriptionLength: { + description: + 'A minimum character length for descriptions when `allow-with-description` is enabled.', type: 'number', default: defaultMinimumDescriptionLength, }, diff --git a/packages/eslint-plugin/src/rules/consistent-type-assertions.ts b/packages/eslint-plugin/src/rules/consistent-type-assertions.ts index 4c45d12e5a74..76e1386cf6e3 100644 --- a/packages/eslint-plugin/src/rules/consistent-type-assertions.ts +++ b/packages/eslint-plugin/src/rules/consistent-type-assertions.ts @@ -57,6 +57,7 @@ export default createRule({ type: 'object', properties: { assertionStyle: { + description: 'The expected assertion style to enforce.', type: 'string', enum: ['never'], }, @@ -68,10 +69,13 @@ export default createRule({ type: 'object', properties: { assertionStyle: { + description: 'The expected assertion style to enforce.', type: 'string', enum: ['as', 'angle-bracket'], }, objectLiteralTypeAssertions: { + description: + 'Whether to always prefer type declarations for object literals used as variable initializers, rather than type assertions.', type: 'string', enum: ['allow', 'allow-as-parameter', 'never'], }, diff --git a/packages/eslint-plugin/src/rules/consistent-type-exports.ts b/packages/eslint-plugin/src/rules/consistent-type-exports.ts index 236659d13adb..7f9568533710 100644 --- a/packages/eslint-plugin/src/rules/consistent-type-exports.ts +++ b/packages/eslint-plugin/src/rules/consistent-type-exports.ts @@ -48,7 +48,6 @@ export default createRule({ messages: { typeOverValue: 'All exports in the declaration are only used as types. Use `export type`.', - singleExportIsType: 'Type export {{exportNames}} is not a value and should be exported using `export type`.', multipleExportsAreTypes: @@ -59,6 +58,8 @@ export default createRule({ type: 'object', properties: { fixMixedExportsWithInlineTypeSpecifier: { + description: + 'Whether the rule will autofix "mixed" export cases using TS inline type specifiers.', type: 'boolean', }, }, diff --git a/packages/eslint-plugin/src/rules/consistent-type-imports.ts b/packages/eslint-plugin/src/rules/consistent-type-imports.ts index b645165ab606..8a618faf89c1 100644 --- a/packages/eslint-plugin/src/rules/consistent-type-imports.ts +++ b/packages/eslint-plugin/src/rules/consistent-type-imports.ts @@ -60,7 +60,6 @@ export default createRule({ typeOverValue: 'All imports in the declaration are only used as types. Use `import type`.', someImportsAreOnlyTypes: 'Imports {{typeImports}} are only used as type.', - avoidImportType: 'Use an `import` instead of an `import type`.', noImportTypeAnnotations: '`import()` type annotations are forbidden.', }, @@ -69,13 +68,18 @@ export default createRule({ type: 'object', properties: { disallowTypeAnnotations: { + description: + 'Whether to disallow type imports in type annotations (`import()`).', type: 'boolean', }, fixStyle: { + description: + 'The expected type modifier to be added when an import is detected as used only in the type position.', type: 'string', enum: ['separate-type-imports', 'inline-type-imports'], }, prefer: { + description: 'The expected import kind for type-only imports.', type: 'string', enum: ['type-imports', 'no-type-imports'], }, diff --git a/packages/eslint-plugin/src/rules/dot-notation.ts b/packages/eslint-plugin/src/rules/dot-notation.ts index 06b1c78c29d9..f7b1c612288c 100644 --- a/packages/eslint-plugin/src/rules/dot-notation.ts +++ b/packages/eslint-plugin/src/rules/dot-notation.ts @@ -30,22 +30,30 @@ export default createRule({ type: 'object', properties: { allowKeywords: { + description: 'Whether to allow keywords such as ["class"]`.', type: 'boolean', default: true, }, allowPattern: { + description: 'Regular expression of names to allow.', type: 'string', default: '', }, allowPrivateClassPropertyAccess: { + description: + 'Whether to allow accessing class members marked as `private` with array notation.', type: 'boolean', default: false, }, allowProtectedClassPropertyAccess: { + description: + 'Whether to allow accessing class members marked as `protected` with array notation.', type: 'boolean', default: false, }, allowIndexSignaturePropertyAccess: { + description: + 'Whether to allow accessing properties matching an index signature with array notation.', type: 'boolean', default: false, }, diff --git a/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts b/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts index 5947d292f8bd..2661949b57d7 100644 --- a/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts +++ b/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts @@ -91,10 +91,10 @@ export default createRule({ $ref: '#/items/0/$defs/accessibilityLevel', }, }, - additionalProperties: false, }, ignoredMethodNames: { + description: 'Specific method names that may be ignored.', type: 'array', items: { type: 'string', diff --git a/packages/eslint-plugin/src/rules/max-params.ts b/packages/eslint-plugin/src/rules/max-params.ts index 622848affce1..680cea10a40c 100644 --- a/packages/eslint-plugin/src/rules/max-params.ts +++ b/packages/eslint-plugin/src/rules/max-params.ts @@ -33,15 +33,21 @@ export default createRule({ { type: 'object', properties: { - maximum: { + max: { + description: + 'A maximum number of parameters in function definitions.', type: 'integer', minimum: 0, }, - max: { + maximum: { + description: + '(deprecated) A maximum number of parameters in function definitions.', type: 'integer', minimum: 0, }, countVoidThis: { + description: + 'Whether to count a `this` declaration when the type is `void`.', type: 'boolean', }, }, diff --git a/packages/eslint-plugin/src/rules/no-base-to-string.ts b/packages/eslint-plugin/src/rules/no-base-to-string.ts index 0369e66fe66f..d4620aa7c031 100644 --- a/packages/eslint-plugin/src/rules/no-base-to-string.ts +++ b/packages/eslint-plugin/src/rules/no-base-to-string.ts @@ -35,6 +35,8 @@ export default createRule({ type: 'object', properties: { ignoredTypeNames: { + description: + 'Stringified regular expressions of type names to ignore.', type: 'array', items: { type: 'string', diff --git a/packages/eslint-plugin/src/rules/no-confusing-void-expression.ts b/packages/eslint-plugin/src/rules/no-confusing-void-expression.ts index 3abf127b7faa..ff66138dcf9d 100644 --- a/packages/eslint-plugin/src/rules/no-confusing-void-expression.ts +++ b/packages/eslint-plugin/src/rules/no-confusing-void-expression.ts @@ -70,8 +70,16 @@ export default createRule({ { type: 'object', properties: { - ignoreArrowShorthand: { type: 'boolean' }, - ignoreVoidOperator: { type: 'boolean' }, + ignoreArrowShorthand: { + description: + 'Whether to ignore "shorthand" `() =>` arrow functions: those without `{ ... }` braces.', + type: 'boolean', + }, + ignoreVoidOperator: { + description: + 'Whether to ignore returns that start with the `void` operator.', + type: 'boolean', + }, }, additionalProperties: false, }, diff --git a/packages/eslint-plugin/src/rules/no-duplicate-type-constituents.ts b/packages/eslint-plugin/src/rules/no-duplicate-type-constituents.ts index d92de657aa47..49de6d8a0435 100644 --- a/packages/eslint-plugin/src/rules/no-duplicate-type-constituents.ts +++ b/packages/eslint-plugin/src/rules/no-duplicate-type-constituents.ts @@ -86,9 +86,11 @@ export default createRule({ type: 'object', properties: { ignoreIntersections: { + description: 'Whether to ignore `&` intersections.', type: 'boolean', }, ignoreUnions: { + description: 'Whether to ignore `|` unions.', type: 'boolean', }, }, diff --git a/packages/eslint-plugin/src/rules/no-empty-function.ts b/packages/eslint-plugin/src/rules/no-empty-function.ts index 6a8e90ebaf13..1b5061dc2d36 100644 --- a/packages/eslint-plugin/src/rules/no-empty-function.ts +++ b/packages/eslint-plugin/src/rules/no-empty-function.ts @@ -22,6 +22,8 @@ const schema = deepMerge( { properties: { allow: { + description: + 'Locations and kinds of functions that are allowed to be empty.', items: { type: 'string', enum: [ diff --git a/packages/eslint-plugin/src/rules/no-empty-interface.ts b/packages/eslint-plugin/src/rules/no-empty-interface.ts index 6de165c37938..c776eb6d6eb8 100644 --- a/packages/eslint-plugin/src/rules/no-empty-interface.ts +++ b/packages/eslint-plugin/src/rules/no-empty-interface.ts @@ -33,6 +33,8 @@ export default createRule({ additionalProperties: false, properties: { allowSingleExtends: { + description: + 'Whether to allow empty interfaces that extend a single other interface.', type: 'boolean', }, }, diff --git a/packages/eslint-plugin/src/rules/no-empty-object-type.ts b/packages/eslint-plugin/src/rules/no-empty-object-type.ts index 2471726240b8..cf41ee2031cd 100644 --- a/packages/eslint-plugin/src/rules/no-empty-object-type.ts +++ b/packages/eslint-plugin/src/rules/no-empty-object-type.ts @@ -56,14 +56,18 @@ export default createRule({ additionalProperties: false, properties: { allowInterfaces: { + description: 'Whether to allow empty interfaces.', enum: ['always', 'never', 'with-single-extends'], type: 'string', }, allowObjectTypes: { + description: 'Whether to allow empty object type literals.', enum: ['always', 'never'], type: 'string', }, allowWithName: { + description: + 'A stringified regular expression to allow interfaces and object type aliases with the configured name.', type: 'string', }, }, diff --git a/packages/eslint-plugin/src/rules/no-floating-promises.ts b/packages/eslint-plugin/src/rules/no-floating-promises.ts index e59c32665427..3b0265e1718f 100644 --- a/packages/eslint-plugin/src/rules/no-floating-promises.ts +++ b/packages/eslint-plugin/src/rules/no-floating-promises.ts @@ -76,8 +76,15 @@ export default createRule({ { type: 'object', properties: { - allowForKnownSafePromises: readonlynessOptionsSchema.properties.allow, - allowForKnownSafeCalls: readonlynessOptionsSchema.properties.allow, + allowForKnownSafePromises: { + ...readonlynessOptionsSchema.properties.allow, + description: 'Type specifiers that are known to be safe to float.', + }, + allowForKnownSafeCalls: { + ...readonlynessOptionsSchema.properties.allow, + description: + 'Type specifiers of functions whose calls are safe to float.', + }, checkThenables: { description: 'Whether to check all "Thenable"s, not just the built-in Promise type.', diff --git a/packages/eslint-plugin/src/rules/no-inferrable-types.ts b/packages/eslint-plugin/src/rules/no-inferrable-types.ts index 51ead2ae476a..2b54267a503a 100644 --- a/packages/eslint-plugin/src/rules/no-inferrable-types.ts +++ b/packages/eslint-plugin/src/rules/no-inferrable-types.ts @@ -31,9 +31,11 @@ export default createRule({ type: 'object', properties: { ignoreParameters: { + description: 'Whether to ignore function parameters.', type: 'boolean', }, ignoreProperties: { + description: 'Whether to ignore class properties.', type: 'boolean', }, }, diff --git a/packages/eslint-plugin/src/rules/no-invalid-void-type.ts b/packages/eslint-plugin/src/rules/no-invalid-void-type.ts index f518e2dc861b..81faa510faf9 100644 --- a/packages/eslint-plugin/src/rules/no-invalid-void-type.ts +++ b/packages/eslint-plugin/src/rules/no-invalid-void-type.ts @@ -42,6 +42,8 @@ export default createRule<[Options], MessageIds>({ type: 'object', properties: { allowInGenericTypeArguments: { + description: + 'Whether `void` can be used as a valid value for generic type parameters.', oneOf: [ { type: 'boolean' }, { @@ -52,6 +54,8 @@ export default createRule<[Options], MessageIds>({ ], }, allowAsThisParameter: { + description: + 'Whether a `this` parameter of a function may be `void`.', type: 'boolean', }, }, diff --git a/packages/eslint-plugin/src/rules/no-magic-numbers.ts b/packages/eslint-plugin/src/rules/no-magic-numbers.ts index 583f77329193..2bfd2e50bc36 100644 --- a/packages/eslint-plugin/src/rules/no-magic-numbers.ts +++ b/packages/eslint-plugin/src/rules/no-magic-numbers.ts @@ -23,15 +23,20 @@ const schema = deepMerge( { properties: { ignoreNumericLiteralTypes: { + description: + 'Whether numbers used in TypeScript numeric literal types are considered okay.', type: 'boolean', }, ignoreEnums: { + description: 'Whether enums used in TypeScript are considered okay.', type: 'boolean', }, ignoreReadonlyClassProperties: { + description: 'Whether `readonly` class properties are considered okay.', type: 'boolean', }, ignoreTypeIndexes: { + description: 'Whether numbers used to index types are okay.', type: 'boolean', }, }, diff --git a/packages/eslint-plugin/src/rules/no-meaningless-void-operator.ts b/packages/eslint-plugin/src/rules/no-meaningless-void-operator.ts index e8fdde8d1f33..a75bb04afc13 100644 --- a/packages/eslint-plugin/src/rules/no-meaningless-void-operator.ts +++ b/packages/eslint-plugin/src/rules/no-meaningless-void-operator.ts @@ -33,6 +33,8 @@ export default createRule({ type: 'object', properties: { checkNever: { + description: + 'Whether to suggest removing `void` when the argument has type `never`.', type: 'boolean', default: false, }, diff --git a/packages/eslint-plugin/src/rules/no-misused-promises.ts b/packages/eslint-plugin/src/rules/no-misused-promises.ts index be1f81df92e8..6c0a94bf8087 100644 --- a/packages/eslint-plugin/src/rules/no-misused-promises.ts +++ b/packages/eslint-plugin/src/rules/no-misused-promises.ts @@ -107,18 +107,43 @@ export default createRule({ { additionalProperties: false, properties: { - arguments: { type: 'boolean' }, - attributes: { type: 'boolean' }, - inheritedMethods: { type: 'boolean' }, - properties: { type: 'boolean' }, - returns: { type: 'boolean' }, - variables: { type: 'boolean' }, + arguments: { + description: + 'Disables checking an asynchronous function passed as argument where the parameter type expects a function that returns `void`.', + type: 'boolean', + }, + attributes: { + description: + 'Disables checking an asynchronous function passed as a JSX attribute expected to be a function that returns `void`.', + type: 'boolean', + }, + inheritedMethods: { + description: + 'Disables checking an asynchronous method in a type that extends or implements another type expecting that method to return `void`.', + type: 'boolean', + }, + properties: { + description: + 'Disables checking an asynchronous function passed as an object property expected to be a function that returns `void`.', + type: 'boolean', + }, + returns: { + description: + 'Disables checking an asynchronous function returned in a function whose return type is a function that returns `void`.', + type: 'boolean', + }, + variables: { + description: + 'Disables checking an asynchronous function used as a variable whose return type is a function that returns `void`.', + type: 'boolean', + }, }, type: 'object', }, ], }, checksSpreads: { + description: 'Whether to warn when `...` spreading a `Promise`.', type: 'boolean', }, }, diff --git a/packages/eslint-plugin/src/rules/no-redeclare.ts b/packages/eslint-plugin/src/rules/no-redeclare.ts index b084d90650b0..a2060a0ea4da 100644 --- a/packages/eslint-plugin/src/rules/no-redeclare.ts +++ b/packages/eslint-plugin/src/rules/no-redeclare.ts @@ -25,9 +25,13 @@ export default createRule({ type: 'object', properties: { builtinGlobals: { + description: + 'Whether to report shadowing of built-in global variables.', type: 'boolean', }, ignoreDeclarationMerge: { + description: + 'Whether to ignore declaration merges between certain TypeScript declaration types.', type: 'boolean', }, }, diff --git a/packages/eslint-plugin/src/rules/no-shadow.ts b/packages/eslint-plugin/src/rules/no-shadow.ts index 152d536239e8..2de2cbf0ff60 100644 --- a/packages/eslint-plugin/src/rules/no-shadow.ts +++ b/packages/eslint-plugin/src/rules/no-shadow.ts @@ -37,25 +37,36 @@ export default createRule({ type: 'object', properties: { builtinGlobals: { + description: + 'Whether to report shadowing of built-in global variables.', type: 'boolean', }, hoist: { + description: + 'Whether to report shadowing before outer functions or variables are defined.', type: 'string', enum: ['all', 'functions', 'never'], }, allow: { + description: 'Identifier names for which shadowing is allowed.', type: 'array', items: { type: 'string', }, }, ignoreOnInitialization: { + description: + 'Whether to ignore the variable initializers when the shadowed variable is presumably still unitialized.', type: 'boolean', }, ignoreTypeValueShadow: { + description: + 'Whether to ignore types named the same as a variable.', type: 'boolean', }, ignoreFunctionTypeParameterNameValueShadow: { + description: + 'Whether to ignore function parameters named the same as a variable.', type: 'boolean', }, }, diff --git a/packages/eslint-plugin/src/rules/no-unused-vars.ts b/packages/eslint-plugin/src/rules/no-unused-vars.ts index d98c2f5bf5a5..417467a1faef 100644 --- a/packages/eslint-plugin/src/rules/no-unused-vars.ts +++ b/packages/eslint-plugin/src/rules/no-unused-vars.ts @@ -77,36 +77,54 @@ export default createRule({ type: 'object', properties: { vars: { + description: + 'Whether to check all variables or only locally-declared variables.', type: 'string', enum: ['all', 'local'], }, varsIgnorePattern: { + description: + 'Regular expressions of variable names to not check for usage.', type: 'string', }, args: { + description: 'Whether to check all, some, or no arguments.', type: 'string', enum: ['all', 'after-used', 'none'], }, - ignoreRestSiblings: { - type: 'boolean', - }, argsIgnorePattern: { + description: + 'Regular expressions of argument names to not check for usage.', type: 'string', }, caughtErrors: { + description: 'Whether to check catch block arguments.', type: 'string', enum: ['all', 'none'], }, caughtErrorsIgnorePattern: { + description: + 'Regular expressions of catch block argument names to not check for usage.', type: 'string', }, destructuredArrayIgnorePattern: { + description: + 'Regular expressions of destructured array variable names to not check for usage.', type: 'string', }, ignoreClassWithStaticInitBlock: { + description: + 'Whether to ignore classes with at least one static initialization block.', + type: 'boolean', + }, + ignoreRestSiblings: { + description: + 'Whether to ignore sibling properties in `...` destructurings.', type: 'boolean', }, reportUsedIgnorePattern: { + description: + 'Whether to report variables that match any of the valid ignore pattern options if they have been used.', type: 'boolean', }, }, 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 f333683d2f42..4c6cc0041971 100644 --- a/packages/eslint-plugin/src/rules/no-use-before-define.ts +++ b/packages/eslint-plugin/src/rules/no-use-before-define.ts @@ -235,12 +235,33 @@ export default createRule({ { type: 'object', properties: { - functions: { type: 'boolean' }, - classes: { type: 'boolean' }, - enums: { type: 'boolean' }, - variables: { type: 'boolean' }, - typedefs: { type: 'boolean' }, - ignoreTypeReferences: { type: 'boolean' }, + functions: { + description: + 'Whether to ignore references to function declarations.', + type: 'boolean', + }, + classes: { + description: + 'Whether to ignore references to class declarations.', + type: 'boolean', + }, + enums: { + description: 'Whether to check references to enums.', + type: 'boolean', + }, + variables: { + description: 'Whether to ignore references to variables.', + type: 'boolean', + }, + typedefs: { + description: 'Whether to check references to types.', + type: 'boolean', + }, + ignoreTypeReferences: { + description: + 'Whether to ignore type references, such as in type annotations and assertions.', + type: 'boolean', + }, allowNamedExports: { type: 'boolean' }, }, additionalProperties: false, diff --git a/packages/eslint-plugin/src/rules/only-throw-error.ts b/packages/eslint-plugin/src/rules/only-throw-error.ts index f2526bde2c4a..1f0796fe98ca 100644 --- a/packages/eslint-plugin/src/rules/only-throw-error.ts +++ b/packages/eslint-plugin/src/rules/only-throw-error.ts @@ -34,9 +34,13 @@ export default createRule({ type: 'object', properties: { allowThrowingAny: { + description: + 'Whether to always allow throwing values typed as `any`.', type: 'boolean', }, allowThrowingUnknown: { + description: + 'Whether to always allow throwing values typed as `unknown`.', type: 'boolean', }, }, diff --git a/packages/eslint-plugin/src/rules/parameter-properties.ts b/packages/eslint-plugin/src/rules/parameter-properties.ts index 5246594e912e..34cd6da38140 100644 --- a/packages/eslint-plugin/src/rules/parameter-properties.ts +++ b/packages/eslint-plugin/src/rules/parameter-properties.ts @@ -56,12 +56,16 @@ export default createRule({ type: 'object', properties: { allow: { + description: + 'Whether to allow certain kinds of properties to be ignored.', type: 'array', items: { $ref: '#/items/0/$defs/modifier', }, }, prefer: { + description: + 'Whether to prefer class properties or parameter properties.', type: 'string', enum: ['class-property', 'parameter-property'], }, diff --git a/packages/eslint-plugin/src/rules/prefer-literal-enum-member.ts b/packages/eslint-plugin/src/rules/prefer-literal-enum-member.ts index efc3eacdd518..dcc31ba5742a 100644 --- a/packages/eslint-plugin/src/rules/prefer-literal-enum-member.ts +++ b/packages/eslint-plugin/src/rules/prefer-literal-enum-member.ts @@ -20,6 +20,8 @@ export default createRule({ type: 'object', properties: { allowBitwiseExpressions: { + description: + 'Whether to allow using bitwise expressions in enum initializers.', type: 'boolean', }, }, diff --git a/packages/eslint-plugin/src/rules/prefer-nullish-coalescing.ts b/packages/eslint-plugin/src/rules/prefer-nullish-coalescing.ts index 87a23ab98808..05de88296a4f 100644 --- a/packages/eslint-plugin/src/rules/prefer-nullish-coalescing.ts +++ b/packages/eslint-plugin/src/rules/prefer-nullish-coalescing.ts @@ -65,15 +65,23 @@ export default createRule({ type: 'object', properties: { allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing: { + description: + 'Unless this is set to `true`, the rule will error on every file whose `tsconfig.json` does _not_ have the `strictNullChecks` compiler option (or `strict`) set to `true`.', type: 'boolean', }, ignoreConditionalTests: { + description: + 'Whether to ignore cases that are located within a conditional test.', type: 'boolean', }, ignoreMixedLogicalExpressions: { + description: + 'Whether to ignore any logical or expressions that are part of a mixed logical expression (with `&&`).', type: 'boolean', }, ignorePrimitives: { + description: + 'Whether to ignore all (`true`) or some (an object with properties) primitive types.', oneOf: [ { type: 'object', @@ -91,6 +99,8 @@ export default createRule({ ], }, ignoreTernaryTests: { + description: + 'Whether to ignore any ternary expressions that could be simplified by using the nullish coalescing operator.', type: 'boolean', }, }, diff --git a/packages/eslint-plugin/src/rules/prefer-promise-reject-errors.ts b/packages/eslint-plugin/src/rules/prefer-promise-reject-errors.ts index ef15fe918c17..ae5a344a299e 100644 --- a/packages/eslint-plugin/src/rules/prefer-promise-reject-errors.ts +++ b/packages/eslint-plugin/src/rules/prefer-promise-reject-errors.ts @@ -35,6 +35,8 @@ export default createRule({ type: 'object', properties: { allowEmptyReject: { + description: + 'Whether to allow calls to `Promise.reject()` with no arguments.', type: 'boolean', }, }, diff --git a/packages/eslint-plugin/src/rules/prefer-readonly-parameter-types.ts b/packages/eslint-plugin/src/rules/prefer-readonly-parameter-types.ts index 6cb935c1db9a..edc66bf2a76e 100644 --- a/packages/eslint-plugin/src/rules/prefer-readonly-parameter-types.ts +++ b/packages/eslint-plugin/src/rules/prefer-readonly-parameter-types.ts @@ -34,15 +34,24 @@ export default createRule({ type: 'object', additionalProperties: false, properties: { - allow: readonlynessOptionsSchema.properties.allow, + allow: { + ...readonlynessOptionsSchema.properties.allow, + description: 'An array of type specifiers to ignore.', + }, checkParameterProperties: { + description: 'Whether to check class parameter properties.', type: 'boolean', }, ignoreInferredTypes: { + description: + "Whether to ignore parameters which don't explicitly specify a type.", type: 'boolean', }, - treatMethodsAsReadonly: - readonlynessOptionsSchema.properties.treatMethodsAsReadonly, + treatMethodsAsReadonly: { + ...readonlynessOptionsSchema.properties.treatMethodsAsReadonly, + description: + 'Whether to treat all mutable methods as though they are readonly.', + }, }, }, ], diff --git a/packages/eslint-plugin/src/rules/prefer-readonly.ts b/packages/eslint-plugin/src/rules/prefer-readonly.ts index f163b1aaab34..df05668299a2 100644 --- a/packages/eslint-plugin/src/rules/prefer-readonly.ts +++ b/packages/eslint-plugin/src/rules/prefer-readonly.ts @@ -46,6 +46,8 @@ export default createRule({ additionalProperties: false, properties: { onlyInlineLambdas: { + description: + 'Whether to restrict checking only to members immediately assigned a lambda value.', type: 'boolean', }, }, diff --git a/packages/eslint-plugin/src/rules/promise-function-async.ts b/packages/eslint-plugin/src/rules/promise-function-async.ts index c191ce45b0db..942ef6b8fa46 100644 --- a/packages/eslint-plugin/src/rules/promise-function-async.ts +++ b/packages/eslint-plugin/src/rules/promise-function-async.ts @@ -55,15 +55,20 @@ export default createRule({ }, }, checkArrowFunctions: { + description: 'Whether to check arrow functions.', type: 'boolean', }, checkFunctionDeclarations: { + description: 'Whether to check standalone function declarations.', type: 'boolean', }, checkFunctionExpressions: { + description: 'Whether to check inline function expressions', type: 'boolean', }, checkMethodDeclarations: { + description: + 'Whether to check methods on classes and object literals.', type: 'boolean', }, }, diff --git a/packages/eslint-plugin/src/rules/return-await.ts b/packages/eslint-plugin/src/rules/return-await.ts index 716962a8a11b..5152cc61466f 100644 --- a/packages/eslint-plugin/src/rules/return-await.ts +++ b/packages/eslint-plugin/src/rules/return-await.ts @@ -59,12 +59,30 @@ export default createRule({ schema: [ { type: 'string', - enum: [ - 'in-try-catch', - 'always', - 'never', - 'error-handling-correctness-only', - ] satisfies Option[], + oneOf: [ + { + type: 'string', + enum: ['always'], + description: 'Requires that all returned promises be awaited.', + }, + { + type: 'string', + enum: ['error-handling-correctness-only'], + description: + 'In error-handling contexts, the rule enforces that returned promises must be awaited. In ordinary contexts, the rule does not enforce any particular behavior around whether returned promises are awaited.', + }, + { + type: 'string', + enum: ['in-try-catch'], + description: + 'In error-handling contexts, the rule enforces that returned promises must be awaited. In ordinary contexts, the rule enforces that returned promises _must not_ be awaited.', + }, + { + type: 'string', + enum: ['never'], + description: 'Disallows awaiting any returned promises.', + }, + ], }, ], }, diff --git a/packages/eslint-plugin/src/rules/strict-boolean-expressions.ts b/packages/eslint-plugin/src/rules/strict-boolean-expressions.ts index 3e01b5c15a1a..7bd708ac6f9c 100644 --- a/packages/eslint-plugin/src/rules/strict-boolean-expressions.ts +++ b/packages/eslint-plugin/src/rules/strict-boolean-expressions.ts @@ -67,14 +67,43 @@ export default createRule({ { type: 'object', properties: { - allowString: { type: 'boolean' }, - allowNumber: { type: 'boolean' }, - allowNullableObject: { type: 'boolean' }, - allowNullableBoolean: { type: 'boolean' }, - allowNullableString: { type: 'boolean' }, - allowNullableNumber: { type: 'boolean' }, - allowNullableEnum: { type: 'boolean' }, - allowAny: { type: 'boolean' }, + allowString: { + description: 'Whether to allow `string` in a boolean context.', + type: 'boolean', + }, + allowNumber: { + description: 'Whether to allow `number` in a boolean context.', + type: 'boolean', + }, + allowNullableObject: { + description: + 'Whether to allow nullable `object`s in a boolean context.', + type: 'boolean', + }, + allowNullableBoolean: { + description: + 'Whether to allow nullable `boolean`s in a boolean context.', + type: 'boolean', + }, + allowNullableString: { + description: + 'Whether to allow nullable `string`s in a boolean context.', + type: 'boolean', + }, + allowNullableNumber: { + description: + 'Whether to allow nullable `number`s in a boolean context.', + type: 'boolean', + }, + allowNullableEnum: { + description: + 'Whether to allow nullable `enum`s in a boolean context.', + type: 'boolean', + }, + allowAny: { + description: 'Whether to allow `any` in a boolean context.', + type: 'boolean', + }, allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing: { type: 'boolean', }, diff --git a/packages/eslint-plugin/src/rules/triple-slash-reference.ts b/packages/eslint-plugin/src/rules/triple-slash-reference.ts index a45662c33d4c..7512f8ce0778 100644 --- a/packages/eslint-plugin/src/rules/triple-slash-reference.ts +++ b/packages/eslint-plugin/src/rules/triple-slash-reference.ts @@ -30,14 +30,20 @@ export default createRule({ type: 'object', properties: { lib: { + description: + 'What to enforce for `/// ` references.', type: 'string', enum: ['always', 'never'], }, path: { + description: + 'What to enforce for `/// ` references.', type: 'string', enum: ['always', 'never'], }, types: { + description: + 'What to enforce for `/// ` references.', type: 'string', enum: ['always', 'never', 'prefer-import'], }, diff --git a/packages/eslint-plugin/src/rules/typedef.ts b/packages/eslint-plugin/src/rules/typedef.ts index 187f4d620365..5853c79dfff9 100644 --- a/packages/eslint-plugin/src/rules/typedef.ts +++ b/packages/eslint-plugin/src/rules/typedef.ts @@ -33,14 +33,46 @@ export default createRule<[Options], MessageIds>({ type: 'object', additionalProperties: false, properties: { - [OptionKeys.ArrayDestructuring]: { type: 'boolean' }, - [OptionKeys.ArrowParameter]: { type: 'boolean' }, - [OptionKeys.MemberVariableDeclaration]: { type: 'boolean' }, - [OptionKeys.ObjectDestructuring]: { type: 'boolean' }, - [OptionKeys.Parameter]: { type: 'boolean' }, - [OptionKeys.PropertyDeclaration]: { type: 'boolean' }, - [OptionKeys.VariableDeclaration]: { type: 'boolean' }, - [OptionKeys.VariableDeclarationIgnoreFunction]: { type: 'boolean' }, + [OptionKeys.ArrayDestructuring]: { + description: + 'Whether to enforce type annotations on variables declared using array destructuring.', + type: 'boolean', + }, + [OptionKeys.ArrowParameter]: { + description: + 'Whether to enforce type annotations for parameters of arrow functions.', + type: 'boolean', + }, + [OptionKeys.MemberVariableDeclaration]: { + description: + 'Whether to enforce type annotations on member variables of classes.', + type: 'boolean', + }, + [OptionKeys.ObjectDestructuring]: { + description: + 'Whether to enforce type annotations on variables declared using object destructuring.', + type: 'boolean', + }, + [OptionKeys.Parameter]: { + description: + 'Whether to enforce type annotations for parameters of functions and methods.', + type: 'boolean', + }, + [OptionKeys.PropertyDeclaration]: { + description: + 'Whether to enforce type annotations for properties of interfaces and types.', + type: 'boolean', + }, + [OptionKeys.VariableDeclaration]: { + description: + 'Whether to enforce type annotations for variable declarations, excluding array and object destructuring.', + type: 'boolean', + }, + [OptionKeys.VariableDeclarationIgnoreFunction]: { + description: + 'Whether to ignore variable declarations for non-arrow and arrow functions.', + type: 'boolean', + }, }, }, ], diff --git a/packages/eslint-plugin/tests/docs-eslint-output-snapshots/max-params.shot b/packages/eslint-plugin/tests/docs-eslint-output-snapshots/max-params.shot new file mode 100644 index 000000000000..9ab894b8a858 --- /dev/null +++ b/packages/eslint-plugin/tests/docs-eslint-output-snapshots/max-params.shot @@ -0,0 +1,22 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Validating rule docs max-params.mdx code examples ESLint output 1`] = ` +"Incorrect +Options: { "countVoidThis": false, "max": 1 } + +function hasNoThis(this: void, first: string, second: string) { +~~~~~~~~~~~~~~~~~~ Function 'hasNoThis' has too many parameters (2). Maximum allowed is 1. + // ... +} +" +`; + +exports[`Validating rule docs max-params.mdx code examples ESLint output 2`] = ` +"Correct +Options: { "countVoidThis": false, "max": 1 } + +function hasNoThis(this: void, first: string) { + // ... +} +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/ban-ts-comment.shot b/packages/eslint-plugin/tests/schema-snapshots/ban-ts-comment.shot index a39ac4e59b3b..c6e35698c0d9 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/ban-ts-comment.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/ban-ts-comment.shot @@ -33,6 +33,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "properties": { "minimumDescriptionLength": { "default": 3, + "description": "A minimum character length for descriptions when \`allow-with-description\` is enabled.", "type": "number" }, "ts-check": { @@ -68,6 +69,7 @@ type Options = [ 'ts-expect-error'?: DirectiveConfigSchema; 'ts-ignore'?: DirectiveConfigSchema; 'ts-nocheck'?: DirectiveConfigSchema; + /** A minimum character length for descriptions when \`allow-with-description\` is enabled. */ minimumDescriptionLength?: number; }, ]; diff --git a/packages/eslint-plugin/tests/schema-snapshots/consistent-type-assertions.shot b/packages/eslint-plugin/tests/schema-snapshots/consistent-type-assertions.shot index b50dc807a9ba..5a7b31771041 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/consistent-type-assertions.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/consistent-type-assertions.shot @@ -11,6 +11,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "additionalProperties": false, "properties": { "assertionStyle": { + "description": "The expected assertion style to enforce.", "enum": ["never"], "type": "string" } @@ -22,10 +23,12 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "additionalProperties": false, "properties": { "assertionStyle": { + "description": "The expected assertion style to enforce.", "enum": ["angle-bracket", "as"], "type": "string" }, "objectLiteralTypeAssertions": { + "description": "Whether to always prefer type declarations for object literals used as variable initializers, rather than type assertions.", "enum": ["allow", "allow-as-parameter", "never"], "type": "string" } @@ -42,11 +45,22 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ | { - assertionStyle: 'angle-bracket' | 'as'; - objectLiteralTypeAssertions?: 'allow' | 'allow-as-parameter' | 'never'; + /** The expected assertion style to enforce. */ + assertionStyle: + | 'as' + /** The expected assertion style to enforce. */ + | 'angle-bracket'; + /** Whether to always prefer type declarations for object literals used as variable initializers, rather than type assertions. */ + objectLiteralTypeAssertions?: + | 'allow-as-parameter' + | 'never' + /** Whether to always prefer type declarations for object literals used as variable initializers, rather than type assertions. */ + | 'allow'; } | { - assertionStyle: 'never'; + /** The expected assertion style to enforce. */ + assertionStyle: /** The expected assertion style to enforce. */ + 'never'; }, ]; " diff --git a/packages/eslint-plugin/tests/schema-snapshots/consistent-type-exports.shot b/packages/eslint-plugin/tests/schema-snapshots/consistent-type-exports.shot index 1ad2d9511949..2da93e73dfad 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/consistent-type-exports.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/consistent-type-exports.shot @@ -9,6 +9,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "additionalProperties": false, "properties": { "fixMixedExportsWithInlineTypeSpecifier": { + "description": "Whether the rule will autofix \\"mixed\\" export cases using TS inline type specifiers.", "type": "boolean" } }, @@ -21,6 +22,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ { + /** Whether the rule will autofix "mixed" export cases using TS inline type specifiers. */ fixMixedExportsWithInlineTypeSpecifier?: boolean; }, ]; diff --git a/packages/eslint-plugin/tests/schema-snapshots/consistent-type-imports.shot b/packages/eslint-plugin/tests/schema-snapshots/consistent-type-imports.shot index 7164fbdd3672..09ce1afb5b2a 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/consistent-type-imports.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/consistent-type-imports.shot @@ -9,13 +9,16 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "additionalProperties": false, "properties": { "disallowTypeAnnotations": { + "description": "Whether to disallow type imports in type annotations (\`import()\`).", "type": "boolean" }, "fixStyle": { + "description": "The expected type modifier to be added when an import is detected as used only in the type position.", "enum": ["inline-type-imports", "separate-type-imports"], "type": "string" }, "prefer": { + "description": "The expected import kind for type-only imports.", "enum": ["no-type-imports", "type-imports"], "type": "string" } @@ -29,9 +32,18 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ { + /** Whether to disallow type imports in type annotations (\`import()\`). */ disallowTypeAnnotations?: boolean; - fixStyle?: 'inline-type-imports' | 'separate-type-imports'; - prefer?: 'no-type-imports' | 'type-imports'; + /** The expected type modifier to be added when an import is detected as used only in the type position. */ + fixStyle?: + | 'separate-type-imports' + /** The expected type modifier to be added when an import is detected as used only in the type position. */ + | 'inline-type-imports'; + /** The expected import kind for type-only imports. */ + prefer?: + | 'type-imports' + /** The expected import kind for type-only imports. */ + | 'no-type-imports'; }, ]; " diff --git a/packages/eslint-plugin/tests/schema-snapshots/dot-notation.shot b/packages/eslint-plugin/tests/schema-snapshots/dot-notation.shot index 73c0dcdad74b..2017f266c262 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/dot-notation.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/dot-notation.shot @@ -10,22 +10,27 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "properties": { "allowIndexSignaturePropertyAccess": { "default": false, + "description": "Whether to allow accessing properties matching an index signature with array notation.", "type": "boolean" }, "allowKeywords": { "default": true, + "description": "Whether to allow keywords such as [\\"class\\"]\`.", "type": "boolean" }, "allowPattern": { "default": "", + "description": "Regular expression of names to allow.", "type": "string" }, "allowPrivateClassPropertyAccess": { "default": false, + "description": "Whether to allow accessing class members marked as \`private\` with array notation.", "type": "boolean" }, "allowProtectedClassPropertyAccess": { "default": false, + "description": "Whether to allow accessing class members marked as \`protected\` with array notation.", "type": "boolean" } }, @@ -38,10 +43,15 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ { + /** Whether to allow accessing properties matching an index signature with array notation. */ allowIndexSignaturePropertyAccess?: boolean; + /** Whether to allow keywords such as ["class"]\`. */ allowKeywords?: boolean; + /** Regular expression of names to allow. */ allowPattern?: string; + /** Whether to allow accessing class members marked as \`private\` with array notation. */ allowPrivateClassPropertyAccess?: boolean; + /** Whether to allow accessing class members marked as \`protected\` with array notation. */ allowProtectedClassPropertyAccess?: boolean; }, ]; diff --git a/packages/eslint-plugin/tests/schema-snapshots/explicit-member-accessibility.shot b/packages/eslint-plugin/tests/schema-snapshots/explicit-member-accessibility.shot index 5a33d7fca21f..38813f579a5e 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/explicit-member-accessibility.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/explicit-member-accessibility.shot @@ -33,6 +33,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "$ref": "#/items/0/$defs/accessibilityLevel" }, "ignoredMethodNames": { + "description": "Specific method names that may be ignored.", "items": { "type": "string" }, @@ -78,6 +79,7 @@ type AccessibilityLevel = type Options = [ { accessibility?: AccessibilityLevel; + /** Specific method names that may be ignored. */ ignoredMethodNames?: string[]; overrides?: { accessors?: AccessibilityLevel; diff --git a/packages/eslint-plugin/tests/schema-snapshots/max-params.shot b/packages/eslint-plugin/tests/schema-snapshots/max-params.shot index 646c1287dfae..ed1a2fa62a4d 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/max-params.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/max-params.shot @@ -9,13 +9,16 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "additionalProperties": false, "properties": { "countVoidThis": { + "description": "Whether to count a \`this\` declaration when the type is \`void\`.", "type": "boolean" }, "max": { + "description": "A maximum number of parameters in function definitions.", "minimum": 0, "type": "integer" }, "maximum": { + "description": "(deprecated) A maximum number of parameters in function definitions.", "minimum": 0, "type": "integer" } @@ -29,8 +32,11 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ { + /** Whether to count a \`this\` declaration when the type is \`void\`. */ countVoidThis?: boolean; + /** A maximum number of parameters in function definitions. */ max?: number; + /** (deprecated) A maximum number of parameters in function definitions. */ maximum?: number; }, ]; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-base-to-string.shot b/packages/eslint-plugin/tests/schema-snapshots/no-base-to-string.shot index af652bc7e381..08776052d51f 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-base-to-string.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-base-to-string.shot @@ -9,6 +9,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "additionalProperties": false, "properties": { "ignoredTypeNames": { + "description": "Stringified regular expressions of type names to ignore.", "items": { "type": "string" }, @@ -24,6 +25,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ { + /** Stringified regular expressions of type names to ignore. */ ignoredTypeNames?: string[]; }, ]; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-confusing-void-expression.shot b/packages/eslint-plugin/tests/schema-snapshots/no-confusing-void-expression.shot index b7481d1000ce..33d620951ee6 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-confusing-void-expression.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-confusing-void-expression.shot @@ -9,9 +9,11 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "additionalProperties": false, "properties": { "ignoreArrowShorthand": { + "description": "Whether to ignore \\"shorthand\\" \`() =>\` arrow functions: those without \`{ ... }\` braces.", "type": "boolean" }, "ignoreVoidOperator": { + "description": "Whether to ignore returns that start with the \`void\` operator.", "type": "boolean" } }, @@ -24,7 +26,9 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ { + /** Whether to ignore "shorthand" \`() =>\` arrow functions: those without \`{ ... }\` braces. */ ignoreArrowShorthand?: boolean; + /** Whether to ignore returns that start with the \`void\` operator. */ ignoreVoidOperator?: boolean; }, ]; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-duplicate-type-constituents.shot b/packages/eslint-plugin/tests/schema-snapshots/no-duplicate-type-constituents.shot index d111b2e37297..d3e7832f1846 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-duplicate-type-constituents.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-duplicate-type-constituents.shot @@ -9,9 +9,11 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "additionalProperties": false, "properties": { "ignoreIntersections": { + "description": "Whether to ignore \`&\` intersections.", "type": "boolean" }, "ignoreUnions": { + "description": "Whether to ignore \`|\` unions.", "type": "boolean" } }, @@ -24,7 +26,9 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ { + /** Whether to ignore \`&\` intersections. */ ignoreIntersections?: boolean; + /** Whether to ignore \`|\` unions. */ ignoreUnions?: boolean; }, ]; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-empty-function.shot b/packages/eslint-plugin/tests/schema-snapshots/no-empty-function.shot index c7660d3ec1ea..3bba08942345 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-empty-function.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-empty-function.shot @@ -9,6 +9,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "additionalProperties": false, "properties": { "allow": { + "description": "Locations and kinds of functions that are allowed to be empty.", "items": { "enum": [ "arrowFunctions", @@ -41,6 +42,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ { + /** Locations and kinds of functions that are allowed to be empty. */ allow?: ( | 'arrowFunctions' | 'asyncFunctions' diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-empty-interface.shot b/packages/eslint-plugin/tests/schema-snapshots/no-empty-interface.shot index fa4dbf83d2c6..0b7f9461781f 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-empty-interface.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-empty-interface.shot @@ -9,6 +9,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "additionalProperties": false, "properties": { "allowSingleExtends": { + "description": "Whether to allow empty interfaces that extend a single other interface.", "type": "boolean" } }, @@ -21,6 +22,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ { + /** Whether to allow empty interfaces that extend a single other interface. */ allowSingleExtends?: boolean; }, ]; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-empty-object-type.shot b/packages/eslint-plugin/tests/schema-snapshots/no-empty-object-type.shot index 084d86820ca7..766c7f445205 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-empty-object-type.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-empty-object-type.shot @@ -9,14 +9,17 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "additionalProperties": false, "properties": { "allowInterfaces": { + "description": "Whether to allow empty interfaces.", "enum": ["always", "never", "with-single-extends"], "type": "string" }, "allowObjectTypes": { + "description": "Whether to allow empty object type literals.", "enum": ["always", "never"], "type": "string" }, "allowWithName": { + "description": "A stringified regular expression to allow interfaces and object type aliases with the configured name.", "type": "string" } }, @@ -29,8 +32,18 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ { - allowInterfaces?: 'always' | 'never' | 'with-single-extends'; - allowObjectTypes?: 'always' | 'never'; + /** Whether to allow empty interfaces. */ + allowInterfaces?: + | 'never' + | 'with-single-extends' + /** Whether to allow empty interfaces. */ + | 'always'; + /** Whether to allow empty object type literals. */ + allowObjectTypes?: + | 'never' + /** Whether to allow empty object type literals. */ + | 'always'; + /** A stringified regular expression to allow interfaces and object type aliases with the configured name. */ allowWithName?: string; }, ]; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-floating-promises.shot b/packages/eslint-plugin/tests/schema-snapshots/no-floating-promises.shot index 10adf9eed25d..f93997a991f4 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-floating-promises.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-floating-promises.shot @@ -9,6 +9,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "additionalProperties": false, "properties": { "allowForKnownSafeCalls": { + "description": "Type specifiers of functions whose calls are safe to float.", "items": { "oneOf": [ { @@ -103,6 +104,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "type": "array" }, "allowForKnownSafePromises": { + "description": "Type specifiers that are known to be safe to float.", "items": { "oneOf": [ { @@ -218,6 +220,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ { + /** Type specifiers of functions whose calls are safe to float. */ allowForKnownSafeCalls?: ( | { from: 'file'; @@ -235,6 +238,7 @@ type Options = [ } | string )[]; + /** Type specifiers that are known to be safe to float. */ allowForKnownSafePromises?: ( | { from: 'file'; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-inferrable-types.shot b/packages/eslint-plugin/tests/schema-snapshots/no-inferrable-types.shot index c913653a0078..79d257c7a52f 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-inferrable-types.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-inferrable-types.shot @@ -9,9 +9,11 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "additionalProperties": false, "properties": { "ignoreParameters": { + "description": "Whether to ignore function parameters.", "type": "boolean" }, "ignoreProperties": { + "description": "Whether to ignore class properties.", "type": "boolean" } }, @@ -24,7 +26,9 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ { + /** Whether to ignore function parameters. */ ignoreParameters?: boolean; + /** Whether to ignore class properties. */ ignoreProperties?: boolean; }, ]; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-invalid-void-type.shot b/packages/eslint-plugin/tests/schema-snapshots/no-invalid-void-type.shot index a6d271f1a0f4..a02fca83275d 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-invalid-void-type.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-invalid-void-type.shot @@ -9,9 +9,11 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "additionalProperties": false, "properties": { "allowAsThisParameter": { + "description": "Whether a \`this\` parameter of a function may be \`void\`.", "type": "boolean" }, "allowInGenericTypeArguments": { + "description": "Whether \`void\` can be used as a valid value for generic type parameters.", "oneOf": [ { "type": "boolean" @@ -35,8 +37,13 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ { + /** Whether a \`this\` parameter of a function may be \`void\`. */ allowAsThisParameter?: boolean; - allowInGenericTypeArguments?: [string, ...string[]] | boolean; + /** Whether \`void\` can be used as a valid value for generic type parameters. */ + allowInGenericTypeArguments?: + | [string, ...string[]] + /** Whether \`void\` can be used as a valid value for generic type parameters. */ + | boolean; }, ]; " diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-magic-numbers.shot b/packages/eslint-plugin/tests/schema-snapshots/no-magic-numbers.shot index 5628d7b9927a..bb7c001fa6aa 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-magic-numbers.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-magic-numbers.shot @@ -44,15 +44,19 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "type": "boolean" }, "ignoreEnums": { + "description": "Whether enums used in TypeScript are considered okay.", "type": "boolean" }, "ignoreNumericLiteralTypes": { + "description": "Whether numbers used in TypeScript numeric literal types are considered okay.", "type": "boolean" }, "ignoreReadonlyClassProperties": { + "description": "Whether \`readonly\` class properties are considered okay.", "type": "boolean" }, "ignoreTypeIndexes": { + "description": "Whether numbers used to index types are okay.", "type": "boolean" } }, @@ -71,9 +75,13 @@ type Options = [ ignoreArrayIndexes?: boolean; ignoreClassFieldInitialValues?: boolean; ignoreDefaultValues?: boolean; + /** Whether enums used in TypeScript are considered okay. */ ignoreEnums?: boolean; + /** Whether numbers used in TypeScript numeric literal types are considered okay. */ ignoreNumericLiteralTypes?: boolean; + /** Whether \`readonly\` class properties are considered okay. */ ignoreReadonlyClassProperties?: boolean; + /** Whether numbers used to index types are okay. */ ignoreTypeIndexes?: boolean; }, ]; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-meaningless-void-operator.shot b/packages/eslint-plugin/tests/schema-snapshots/no-meaningless-void-operator.shot index 8f66e54f40de..eb8f091b2dda 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-meaningless-void-operator.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-meaningless-void-operator.shot @@ -10,6 +10,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "properties": { "checkNever": { "default": false, + "description": "Whether to suggest removing \`void\` when the argument has type \`never\`.", "type": "boolean" } }, @@ -22,6 +23,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ { + /** Whether to suggest removing \`void\` when the argument has type \`never\`. */ checkNever?: boolean; }, ]; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-misused-promises.shot b/packages/eslint-plugin/tests/schema-snapshots/no-misused-promises.shot index 4cd7d094b174..e0d897012c0a 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-misused-promises.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-misused-promises.shot @@ -12,6 +12,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "type": "boolean" }, "checksSpreads": { + "description": "Whether to warn when \`...\` spreading a \`Promise\`.", "type": "boolean" }, "checksVoidReturn": { @@ -23,21 +24,27 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "additionalProperties": false, "properties": { "arguments": { + "description": "Disables checking an asynchronous function passed as argument where the parameter type expects a function that returns \`void\`.", "type": "boolean" }, "attributes": { + "description": "Disables checking an asynchronous function passed as a JSX attribute expected to be a function that returns \`void\`.", "type": "boolean" }, "inheritedMethods": { + "description": "Disables checking an asynchronous method in a type that extends or implements another type expecting that method to return \`void\`.", "type": "boolean" }, "properties": { + "description": "Disables checking an asynchronous function passed as an object property expected to be a function that returns \`void\`.", "type": "boolean" }, "returns": { + "description": "Disables checking an asynchronous function returned in a function whose return type is a function that returns \`void\`.", "type": "boolean" }, "variables": { + "description": "Disables checking an asynchronous function used as a variable whose return type is a function that returns \`void\`.", "type": "boolean" } }, @@ -56,14 +63,21 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ { checksConditionals?: boolean; + /** Whether to warn when \`...\` spreading a \`Promise\`. */ checksSpreads?: boolean; checksVoidReturn?: | { + /** Disables checking an asynchronous function passed as argument where the parameter type expects a function that returns \`void\`. */ arguments?: boolean; + /** Disables checking an asynchronous function passed as a JSX attribute expected to be a function that returns \`void\`. */ attributes?: boolean; + /** Disables checking an asynchronous method in a type that extends or implements another type expecting that method to return \`void\`. */ inheritedMethods?: boolean; + /** Disables checking an asynchronous function passed as an object property expected to be a function that returns \`void\`. */ properties?: boolean; + /** Disables checking an asynchronous function returned in a function whose return type is a function that returns \`void\`. */ returns?: boolean; + /** Disables checking an asynchronous function used as a variable whose return type is a function that returns \`void\`. */ variables?: boolean; } | boolean; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-redeclare.shot b/packages/eslint-plugin/tests/schema-snapshots/no-redeclare.shot index 61f33831a071..878098ff2450 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-redeclare.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-redeclare.shot @@ -9,9 +9,11 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "additionalProperties": false, "properties": { "builtinGlobals": { + "description": "Whether to report shadowing of built-in global variables.", "type": "boolean" }, "ignoreDeclarationMerge": { + "description": "Whether to ignore declaration merges between certain TypeScript declaration types.", "type": "boolean" } }, @@ -24,7 +26,9 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ { + /** Whether to report shadowing of built-in global variables. */ builtinGlobals?: boolean; + /** Whether to ignore declaration merges between certain TypeScript declaration types. */ ignoreDeclarationMerge?: boolean; }, ]; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-shadow.shot b/packages/eslint-plugin/tests/schema-snapshots/no-shadow.shot index 78b85fbadc0d..22a2dba566de 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-shadow.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-shadow.shot @@ -9,25 +9,31 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "additionalProperties": false, "properties": { "allow": { + "description": "Identifier names for which shadowing is allowed.", "items": { "type": "string" }, "type": "array" }, "builtinGlobals": { + "description": "Whether to report shadowing of built-in global variables.", "type": "boolean" }, "hoist": { + "description": "Whether to report shadowing before outer functions or variables are defined.", "enum": ["all", "functions", "never"], "type": "string" }, "ignoreFunctionTypeParameterNameValueShadow": { + "description": "Whether to ignore function parameters named the same as a variable.", "type": "boolean" }, "ignoreOnInitialization": { + "description": "Whether to ignore the variable initializers when the shadowed variable is presumably still unitialized.", "type": "boolean" }, "ignoreTypeValueShadow": { + "description": "Whether to ignore types named the same as a variable.", "type": "boolean" } }, @@ -40,11 +46,21 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ { + /** Identifier names for which shadowing is allowed. */ allow?: string[]; + /** Whether to report shadowing of built-in global variables. */ builtinGlobals?: boolean; - hoist?: 'all' | 'functions' | 'never'; + /** Whether to report shadowing before outer functions or variables are defined. */ + hoist?: + | 'functions' + | 'never' + /** Whether to report shadowing before outer functions or variables are defined. */ + | 'all'; + /** Whether to ignore function parameters named the same as a variable. */ ignoreFunctionTypeParameterNameValueShadow?: boolean; + /** Whether to ignore the variable initializers when the shadowed variable is presumably still unitialized. */ ignoreOnInitialization?: boolean; + /** Whether to ignore types named the same as a variable. */ ignoreTypeValueShadow?: boolean; }, ]; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unused-vars.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unused-vars.shot index f7a81d300694..b9abdde2bab4 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-unused-vars.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unused-vars.shot @@ -15,36 +15,46 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "additionalProperties": false, "properties": { "args": { + "description": "Whether to check all, some, or no arguments.", "enum": ["after-used", "all", "none"], "type": "string" }, "argsIgnorePattern": { + "description": "Regular expressions of argument names to not check for usage.", "type": "string" }, "caughtErrors": { + "description": "Whether to check catch block arguments.", "enum": ["all", "none"], "type": "string" }, "caughtErrorsIgnorePattern": { + "description": "Regular expressions of catch block argument names to not check for usage.", "type": "string" }, "destructuredArrayIgnorePattern": { + "description": "Regular expressions of destructured array variable names to not check for usage.", "type": "string" }, "ignoreClassWithStaticInitBlock": { + "description": "Whether to ignore classes with at least one static initialization block.", "type": "boolean" }, "ignoreRestSiblings": { + "description": "Whether to ignore sibling properties in \`...\` destructurings.", "type": "boolean" }, "reportUsedIgnorePattern": { + "description": "Whether to report variables that match any of the valid ignore pattern options if they have been used.", "type": "boolean" }, "vars": { + "description": "Whether to check all variables or only locally-declared variables.", "enum": ["all", "local"], "type": "string" }, "varsIgnorePattern": { + "description": "Regular expressions of variable names to not check for usage.", "type": "string" } }, @@ -61,15 +71,35 @@ type Options = [ | 'all' | 'local' | { - args?: 'after-used' | 'all' | 'none'; + /** Whether to check all, some, or no arguments. */ + args?: + | 'all' + | 'none' + /** Whether to check all, some, or no arguments. */ + | 'after-used'; + /** Regular expressions of argument names to not check for usage. */ argsIgnorePattern?: string; - caughtErrors?: 'all' | 'none'; + /** Whether to check catch block arguments. */ + caughtErrors?: + | 'none' + /** Whether to check catch block arguments. */ + | 'all'; + /** Regular expressions of catch block argument names to not check for usage. */ caughtErrorsIgnorePattern?: string; + /** Regular expressions of destructured array variable names to not check for usage. */ destructuredArrayIgnorePattern?: string; + /** Whether to ignore classes with at least one static initialization block. */ ignoreClassWithStaticInitBlock?: boolean; + /** Whether to ignore sibling properties in \`...\` destructurings. */ ignoreRestSiblings?: boolean; + /** Whether to report variables that match any of the valid ignore pattern options if they have been used. */ reportUsedIgnorePattern?: boolean; - vars?: 'all' | 'local'; + /** Whether to check all variables or only locally-declared variables. */ + vars?: + | 'local' + /** Whether to check all variables or only locally-declared variables. */ + | 'all'; + /** Regular expressions of variable names to not check for usage. */ varsIgnorePattern?: string; }, ]; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-use-before-define.shot b/packages/eslint-plugin/tests/schema-snapshots/no-use-before-define.shot index 624448da333f..a094b1776731 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/no-use-before-define.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/no-use-before-define.shot @@ -18,21 +18,27 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "type": "boolean" }, "classes": { + "description": "Whether to ignore references to class declarations.", "type": "boolean" }, "enums": { + "description": "Whether to check references to enums.", "type": "boolean" }, "functions": { + "description": "Whether to ignore references to function declarations.", "type": "boolean" }, "ignoreTypeReferences": { + "description": "Whether to ignore type references, such as in type annotations and assertions.", "type": "boolean" }, "typedefs": { + "description": "Whether to check references to types.", "type": "boolean" }, "variables": { + "description": "Whether to ignore references to variables.", "type": "boolean" } }, @@ -49,11 +55,17 @@ type Options = [ | 'nofunc' | { allowNamedExports?: boolean; + /** Whether to ignore references to class declarations. */ classes?: boolean; + /** Whether to check references to enums. */ enums?: boolean; + /** Whether to ignore references to function declarations. */ functions?: boolean; + /** Whether to ignore type references, such as in type annotations and assertions. */ ignoreTypeReferences?: boolean; + /** Whether to check references to types. */ typedefs?: boolean; + /** Whether to ignore references to variables. */ variables?: boolean; }, ]; diff --git a/packages/eslint-plugin/tests/schema-snapshots/only-throw-error.shot b/packages/eslint-plugin/tests/schema-snapshots/only-throw-error.shot index 370beb0d1bd8..05b6ae4af6b0 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/only-throw-error.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/only-throw-error.shot @@ -9,9 +9,11 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "additionalProperties": false, "properties": { "allowThrowingAny": { + "description": "Whether to always allow throwing values typed as \`any\`.", "type": "boolean" }, "allowThrowingUnknown": { + "description": "Whether to always allow throwing values typed as \`unknown\`.", "type": "boolean" } }, @@ -24,7 +26,9 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ { + /** Whether to always allow throwing values typed as \`any\`. */ allowThrowingAny?: boolean; + /** Whether to always allow throwing values typed as \`unknown\`. */ allowThrowingUnknown?: boolean; }, ]; diff --git a/packages/eslint-plugin/tests/schema-snapshots/parameter-properties.shot b/packages/eslint-plugin/tests/schema-snapshots/parameter-properties.shot index 502e7b0387f2..73e2120ea8b3 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/parameter-properties.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/parameter-properties.shot @@ -23,12 +23,14 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "additionalProperties": false, "properties": { "allow": { + "description": "Whether to allow certain kinds of properties to be ignored.", "items": { "$ref": "#/items/0/$defs/modifier" }, "type": "array" }, "prefer": { + "description": "Whether to prefer class properties or parameter properties.", "enum": ["class-property", "parameter-property"], "type": "string" } @@ -51,8 +53,13 @@ type Modifier = type Options = [ { + /** Whether to allow certain kinds of properties to be ignored. */ allow?: Modifier[]; - prefer?: 'class-property' | 'parameter-property'; + /** Whether to prefer class properties or parameter properties. */ + prefer?: + | 'parameter-property' + /** Whether to prefer class properties or parameter properties. */ + | 'class-property'; }, ]; " diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-literal-enum-member.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-literal-enum-member.shot index 9bbb15fe6ddb..227983ab267e 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/prefer-literal-enum-member.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-literal-enum-member.shot @@ -9,6 +9,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "additionalProperties": false, "properties": { "allowBitwiseExpressions": { + "description": "Whether to allow using bitwise expressions in enum initializers.", "type": "boolean" } }, @@ -21,6 +22,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ { + /** Whether to allow using bitwise expressions in enum initializers. */ allowBitwiseExpressions?: boolean; }, ]; diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-nullish-coalescing.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-nullish-coalescing.shot index 2a4fd6b7550e..7afce381e977 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/prefer-nullish-coalescing.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-nullish-coalescing.shot @@ -9,15 +9,19 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "additionalProperties": false, "properties": { "allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing": { + "description": "Unless this is set to \`true\`, the rule will error on every file whose \`tsconfig.json\` does _not_ have the \`strictNullChecks\` compiler option (or \`strict\`) set to \`true\`.", "type": "boolean" }, "ignoreConditionalTests": { + "description": "Whether to ignore cases that are located within a conditional test.", "type": "boolean" }, "ignoreMixedLogicalExpressions": { + "description": "Whether to ignore any logical or expressions that are part of a mixed logical expression (with \`&&\`).", "type": "boolean" }, "ignorePrimitives": { + "description": "Whether to ignore all (\`true\`) or some (an object with properties) primitive types.", "oneOf": [ { "properties": { @@ -43,6 +47,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos ] }, "ignoreTernaryTests": { + "description": "Whether to ignore any ternary expressions that could be simplified by using the nullish coalescing operator.", "type": "boolean" } }, @@ -55,18 +60,24 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ { + /** Unless this is set to \`true\`, the rule will error on every file whose \`tsconfig.json\` does _not_ have the \`strictNullChecks\` compiler option (or \`strict\`) set to \`true\`. */ allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing?: boolean; + /** Whether to ignore cases that are located within a conditional test. */ ignoreConditionalTests?: boolean; + /** Whether to ignore any logical or expressions that are part of a mixed logical expression (with \`&&\`). */ ignoreMixedLogicalExpressions?: boolean; + /** Whether to ignore all (\`true\`) or some (an object with properties) primitive types. */ ignorePrimitives?: + | true + /** Whether to ignore all (\`true\`) or some (an object with properties) primitive types. */ | { bigint?: boolean; boolean?: boolean; number?: boolean; string?: boolean; [k: string]: unknown; - } - | true; + }; + /** Whether to ignore any ternary expressions that could be simplified by using the nullish coalescing operator. */ ignoreTernaryTests?: boolean; }, ]; diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-promise-reject-errors.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-promise-reject-errors.shot index fc04d11fd3f1..069c2ea65846 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/prefer-promise-reject-errors.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-promise-reject-errors.shot @@ -9,6 +9,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "additionalProperties": false, "properties": { "allowEmptyReject": { + "description": "Whether to allow calls to \`Promise.reject()\` with no arguments.", "type": "boolean" } }, @@ -21,6 +22,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ { + /** Whether to allow calls to \`Promise.reject()\` with no arguments. */ allowEmptyReject?: boolean; }, ]; diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-readonly-parameter-types.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-readonly-parameter-types.shot index 332e54184b30..6aef90b64a8b 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/prefer-readonly-parameter-types.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-readonly-parameter-types.shot @@ -9,6 +9,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "additionalProperties": false, "properties": { "allow": { + "description": "An array of type specifiers to ignore.", "items": { "oneOf": [ { @@ -103,12 +104,15 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "type": "array" }, "checkParameterProperties": { + "description": "Whether to check class parameter properties.", "type": "boolean" }, "ignoreInferredTypes": { + "description": "Whether to ignore parameters which don't explicitly specify a type.", "type": "boolean" }, "treatMethodsAsReadonly": { + "description": "Whether to treat all mutable methods as though they are readonly.", "type": "boolean" } }, @@ -121,6 +125,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ { + /** An array of type specifiers to ignore. */ allow?: ( | { from: 'file'; @@ -138,8 +143,11 @@ type Options = [ } | string )[]; + /** Whether to check class parameter properties. */ checkParameterProperties?: boolean; + /** Whether to ignore parameters which don't explicitly specify a type. */ ignoreInferredTypes?: boolean; + /** Whether to treat all mutable methods as though they are readonly. */ treatMethodsAsReadonly?: boolean; }, ]; diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-readonly.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-readonly.shot index 34e4a22204a9..aa6f21373b5c 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/prefer-readonly.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-readonly.shot @@ -9,6 +9,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "additionalProperties": false, "properties": { "onlyInlineLambdas": { + "description": "Whether to restrict checking only to members immediately assigned a lambda value.", "type": "boolean" } }, @@ -21,6 +22,7 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ { + /** Whether to restrict checking only to members immediately assigned a lambda value. */ onlyInlineLambdas?: boolean; }, ]; diff --git a/packages/eslint-plugin/tests/schema-snapshots/promise-function-async.shot b/packages/eslint-plugin/tests/schema-snapshots/promise-function-async.shot index c073af42009a..323889a27a5d 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/promise-function-async.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/promise-function-async.shot @@ -20,15 +20,19 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "type": "array" }, "checkArrowFunctions": { + "description": "Whether to check arrow functions.", "type": "boolean" }, "checkFunctionDeclarations": { + "description": "Whether to check standalone function declarations.", "type": "boolean" }, "checkFunctionExpressions": { + "description": "Whether to check inline function expressions", "type": "boolean" }, "checkMethodDeclarations": { + "description": "Whether to check methods on classes and object literals.", "type": "boolean" } }, @@ -45,9 +49,13 @@ type Options = [ allowAny?: boolean; /** Any extra names of classes or interfaces to be considered Promises. */ allowedPromiseNames?: string[]; + /** Whether to check arrow functions. */ checkArrowFunctions?: boolean; + /** Whether to check standalone function declarations. */ checkFunctionDeclarations?: boolean; + /** Whether to check inline function expressions */ checkFunctionExpressions?: boolean; + /** Whether to check methods on classes and object literals. */ checkMethodDeclarations?: boolean; }, ]; diff --git a/packages/eslint-plugin/tests/schema-snapshots/return-await.shot b/packages/eslint-plugin/tests/schema-snapshots/return-await.shot index 7096730066db..1737782efd25 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/return-await.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/return-await.shot @@ -6,11 +6,27 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos [ { - "enum": [ - "always", - "error-handling-correctness-only", - "in-try-catch", - "never" + "oneOf": [ + { + "description": "Requires that all returned promises be awaited.", + "enum": ["always"], + "type": "string" + }, + { + "description": "In error-handling contexts, the rule enforces that returned promises must be awaited. In ordinary contexts, the rule does not enforce any particular behavior around whether returned promises are awaited.", + "enum": ["error-handling-correctness-only"], + "type": "string" + }, + { + "description": "In error-handling contexts, the rule enforces that returned promises must be awaited. In ordinary contexts, the rule enforces that returned promises _must not_ be awaited.", + "enum": ["in-try-catch"], + "type": "string" + }, + { + "description": "Disallows awaiting any returned promises.", + "enum": ["never"], + "type": "string" + } ], "type": "string" } @@ -20,7 +36,14 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos # TYPES: type Options = [ - 'always' | 'error-handling-correctness-only' | 'in-try-catch' | 'never', + /** Disallows awaiting any returned promises. */ + | 'never' + /** In error-handling contexts, the rule enforces that returned promises must be awaited. In ordinary contexts, the rule does not enforce any particular behavior around whether returned promises are awaited. */ + | 'error-handling-correctness-only' + /** In error-handling contexts, the rule enforces that returned promises must be awaited. In ordinary contexts, the rule enforces that returned promises _must not_ be awaited. */ + | 'in-try-catch' + /** Requires that all returned promises be awaited. */ + | 'always', ]; " `; diff --git a/packages/eslint-plugin/tests/schema-snapshots/strict-boolean-expressions.shot b/packages/eslint-plugin/tests/schema-snapshots/strict-boolean-expressions.shot index 140b7e556a48..5c52af177f3d 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/strict-boolean-expressions.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/strict-boolean-expressions.shot @@ -9,30 +9,38 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "additionalProperties": false, "properties": { "allowAny": { + "description": "Whether to allow \`any\` in a boolean context.", "type": "boolean" }, "allowNullableBoolean": { + "description": "Whether to allow nullable \`boolean\`s in a boolean context.", "type": "boolean" }, "allowNullableEnum": { + "description": "Whether to allow nullable \`enum\`s in a boolean context.", "type": "boolean" }, "allowNullableNumber": { + "description": "Whether to allow nullable \`number\`s in a boolean context.", "type": "boolean" }, "allowNullableObject": { + "description": "Whether to allow nullable \`object\`s in a boolean context.", "type": "boolean" }, "allowNullableString": { + "description": "Whether to allow nullable \`string\`s in a boolean context.", "type": "boolean" }, "allowNumber": { + "description": "Whether to allow \`number\` in a boolean context.", "type": "boolean" }, "allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing": { "type": "boolean" }, "allowString": { + "description": "Whether to allow \`string\` in a boolean context.", "type": "boolean" } }, @@ -45,14 +53,22 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ { + /** Whether to allow \`any\` in a boolean context. */ allowAny?: boolean; + /** Whether to allow nullable \`boolean\`s in a boolean context. */ allowNullableBoolean?: boolean; + /** Whether to allow nullable \`enum\`s in a boolean context. */ allowNullableEnum?: boolean; + /** Whether to allow nullable \`number\`s in a boolean context. */ allowNullableNumber?: boolean; + /** Whether to allow nullable \`object\`s in a boolean context. */ allowNullableObject?: boolean; + /** Whether to allow nullable \`string\`s in a boolean context. */ allowNullableString?: boolean; + /** Whether to allow \`number\` in a boolean context. */ allowNumber?: boolean; allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing?: boolean; + /** Whether to allow \`string\` in a boolean context. */ allowString?: boolean; }, ]; diff --git a/packages/eslint-plugin/tests/schema-snapshots/triple-slash-reference.shot b/packages/eslint-plugin/tests/schema-snapshots/triple-slash-reference.shot index 330be71ffe18..96fc018138a5 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/triple-slash-reference.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/triple-slash-reference.shot @@ -9,14 +9,17 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "additionalProperties": false, "properties": { "lib": { + "description": "What to enforce for \`/// \` references.", "enum": ["always", "never"], "type": "string" }, "path": { + "description": "What to enforce for \`/// \` references.", "enum": ["always", "never"], "type": "string" }, "types": { + "description": "What to enforce for \`/// \` references.", "enum": ["always", "never", "prefer-import"], "type": "string" } @@ -30,9 +33,22 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ { - lib?: 'always' | 'never'; - path?: 'always' | 'never'; - types?: 'always' | 'never' | 'prefer-import'; + /** What to enforce for \`/// \` references. */ + lib?: + | 'never' + /** What to enforce for \`/// \` references. */ + | 'always'; + /** What to enforce for \`/// \` references. */ + path?: + | 'never' + /** What to enforce for \`/// \` references. */ + | 'always'; + /** What to enforce for \`/// \` references. */ + types?: + | 'never' + | 'prefer-import' + /** What to enforce for \`/// \` references. */ + | 'always'; }, ]; " diff --git a/packages/eslint-plugin/tests/schema-snapshots/typedef.shot b/packages/eslint-plugin/tests/schema-snapshots/typedef.shot index e244ad4d80ca..b03a5d2644dc 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/typedef.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/typedef.shot @@ -9,27 +9,35 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos "additionalProperties": false, "properties": { "arrayDestructuring": { + "description": "Whether to enforce type annotations on variables declared using array destructuring.", "type": "boolean" }, "arrowParameter": { + "description": "Whether to enforce type annotations for parameters of arrow functions.", "type": "boolean" }, "memberVariableDeclaration": { + "description": "Whether to enforce type annotations on member variables of classes.", "type": "boolean" }, "objectDestructuring": { + "description": "Whether to enforce type annotations on variables declared using object destructuring.", "type": "boolean" }, "parameter": { + "description": "Whether to enforce type annotations for parameters of functions and methods.", "type": "boolean" }, "propertyDeclaration": { + "description": "Whether to enforce type annotations for properties of interfaces and types.", "type": "boolean" }, "variableDeclaration": { + "description": "Whether to enforce type annotations for variable declarations, excluding array and object destructuring.", "type": "boolean" }, "variableDeclarationIgnoreFunction": { + "description": "Whether to ignore variable declarations for non-arrow and arrow functions.", "type": "boolean" } }, @@ -42,13 +50,21 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos type Options = [ { + /** Whether to enforce type annotations on variables declared using array destructuring. */ arrayDestructuring?: boolean; + /** Whether to enforce type annotations for parameters of arrow functions. */ arrowParameter?: boolean; + /** Whether to enforce type annotations on member variables of classes. */ memberVariableDeclaration?: boolean; + /** Whether to enforce type annotations on variables declared using object destructuring. */ objectDestructuring?: boolean; + /** Whether to enforce type annotations for parameters of functions and methods. */ parameter?: boolean; + /** Whether to enforce type annotations for properties of interfaces and types. */ propertyDeclaration?: boolean; + /** Whether to enforce type annotations for variable declarations, excluding array and object destructuring. */ variableDeclaration?: boolean; + /** Whether to ignore variable declarations for non-arrow and arrow functions. */ variableDeclarationIgnoreFunction?: boolean; }, ]; From 8b1eb00a622e0f0e39577d324e40e6ccbd907190 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josh=20Goldberg=20=E2=9C=A8?= Date: Fri, 30 Aug 2024 08:06:39 -0400 Subject: [PATCH 07/15] docs: add website-eslint README.md (#9873) * docs(website-eslint): add README.md * On-the-fly typescript * Update packages/website/README.md Co-authored-by: Joshua Chen * wrong url --------- Co-authored-by: Joshua Chen --- packages/website-eslint/README.md | 19 +++++++++++++++++++ packages/website/README.md | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 packages/website-eslint/README.md diff --git a/packages/website-eslint/README.md b/packages/website-eslint/README.md new file mode 100644 index 000000000000..06e1fb2226bd --- /dev/null +++ b/packages/website-eslint/README.md @@ -0,0 +1,19 @@ +# `website-eslint` + +A bundled version of ESLint plus `typescript-eslint`, made to work in a browser. +This is exclusively used for the playground in the [`website` package](../website/README.md). + +## Building + +`yarn build` runs `build.ts`, which uses ESBuild to create a CommonJS bundle including: + +- ESLint's [`Linter` class](https://eslint.org/docs/latest/integrate/nodejs-api#linter) and built-in rules +- A wrapper that causes TypeScript's `typescript` and `typescript/lib/tsserverlibrary` module entry points to be downloaded on the fly + - This uses the same source as the [TypeScript playground](https://typescriptlang.org/play), giving us a "Monaco web" compatible bundle +- typescript-eslint packages, including: + - `@typescript-eslint/eslint-plugin` and all its configs and rules + - `@typescript-eslint/parser` and `@typescript-eslint/typescript-estree` + +The build files intentionally use deep `/use-at-your-own-risk` imports into our packages. +This is so that esbuild can properly tree-shake and only include the necessary code. +This saves us having to mock unnecessary things and reduces our website bundle size. diff --git a/packages/website/README.md b/packages/website/README.md index 7f4c12e23722..6af12c5c79ce 100644 --- a/packages/website/README.md +++ b/packages/website/README.md @@ -2,7 +2,7 @@ [![Netlify Status](https://api.netlify.com/api/v1/badges/128d21c7-b2fe-45ad-b141-9878fcf5de3a/deploy-status)](https://app.netlify.com/sites/typescript-eslint/deploys) -This website is built using [Docusaurus 2](https://v2.docusaurus.io/), a modern static website generator. +This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator. ## Installation From 875e03d9245a2206d07537a3b2234ce10c060470 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josh=20Goldberg=20=E2=9C=A8?= Date: Fri, 30 Aug 2024 08:14:07 -0400 Subject: [PATCH 08/15] docs: formalized '1 approval' and 'team assigned' labels (#9861) * docs: formalized '1 approval' and 'team assigned' labels * Update docs/maintenance/Pull_Requests.mdx Co-authored-by: Kirk Waiblinger * Mention time critical tasks * Update docs/maintenance/Pull_Requests.mdx * remove unnecessary tip * Added note on waiting periods --------- Co-authored-by: Kirk Waiblinger --- .github/workflows/pr-review-requested.yml | 4 +++- docs/maintenance/Issues.mdx | 6 ++++-- docs/maintenance/Pull_Requests.mdx | 20 ++++++++++++++++---- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pr-review-requested.yml b/.github/workflows/pr-review-requested.yml index 3a69f7c14e19..edfdbbdafb97 100644 --- a/.github/workflows/pr-review-requested.yml +++ b/.github/workflows/pr-review-requested.yml @@ -4,7 +4,9 @@ jobs: steps: - uses: actions-ecosystem/action-remove-labels@v1 with: - labels: 'awaiting response' + labels: | + 1 approval + awaiting response - if: failure() run: | echo "Don't worry if the previous step failed." diff --git a/docs/maintenance/Issues.mdx b/docs/maintenance/Issues.mdx index e97767d6bf7b..5d6848c41680 100644 --- a/docs/maintenance/Issues.mdx +++ b/docs/maintenance/Issues.mdx @@ -60,7 +60,9 @@ Most issues go through the following review flow when created or updated: - Close the issue as _not planned_ - If the issue requires further discussion or community engagement evaluation: - Add the `evaluating community engagement` label and remove the `triage` label -2. If the report is valid, add the `accepting prs` label and remove the `triage` label +2. If the report is valid: + - Remove the `triage` label + - Add the `team assigned` label if you think only a member of the team should tackle it, or `accepting prs` if anybody could 3. If you know the rough steps for a fix, consider writing a comment with links to codebase to help someone put together a fix 4. If you think that the fix is relatively straightforward, consider also adding the `good first issue` label @@ -97,7 +99,7 @@ However, there are cases when maintainers can't confidently choose the most reas 3-6 months after the issue is labeled `evaluating community engagement`, the engagement of community is evaluated: -- If the community was active and common ground was found, the issue is labeled as `accepting prs` +- If the community was active and common ground was found, the issue is labeled as `accepting prs` or `team assigned` - Otherwise, the issue is closed as _not planned_ with the `wontfix` label For requests that can be implemented outside of typescript-eslint, be sure to mention any relevant APIs such as [Custom Rules](../developers/Custom_Rules.mdx) that can be used. diff --git a/docs/maintenance/Pull_Requests.mdx b/docs/maintenance/Pull_Requests.mdx index 15b5e83d1bb2..7fdf9f9e28dd 100644 --- a/docs/maintenance/Pull_Requests.mdx +++ b/docs/maintenance/Pull_Requests.mdx @@ -37,7 +37,7 @@ Open pull requests ideally switch between two states: - Ready for review: either newly created or after [review is re-requested](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/about-pull-request-reviews#re-requesting-a-review) - Waiting for author activity: either by virtue of [being a draft](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests#draft-pull-requests) or having the [`awaiting response` label](https://github.com/typescript-eslint/typescript-eslint/pulls?q=is%3Apr+is%3Aopen+label%3A%22awaiting+response%22) -Add the `awaiting response` label to a PR whenever you post a review. +Add the `awaiting response` label to a PR and remove `1 approval` if it exists whenever you post a request for changes. It will be automatically removed if the author re-requests review. ### Be Kind @@ -66,9 +66,6 @@ If there's no backing issue: - If the PR is a straightforward docs or tooling fix that doesn't impact users, it's ok to review it as-is - Otherwise, add the `please fill out the template` label and post a comment like the _Needs Issue_ template -Upon completing your review, if the build is passing and you feel comfortable merging it in, go ahead and squash merge. -Otherwise, add the `1 approval` label. - #### Common Things to Look For - Style: that can you read through the code easily, there are comments for necessary tricky areas, and not unnecessary comments otherwise. @@ -111,6 +108,21 @@ For preliminary reviews, be clear with what scale you're reviewing at: _"Reviewi For repeat reviews, be clear when it's something you missed earlier and/or there's new information. Don't apologize if the missed information was only made clear because of requested changes - this is part of the review process! +### Approvals + +If the PR addresses a time critical task, such as a security fix or `main` branch build break, go ahead and squash merge it. + +Otherwise, upon completing your review, if the build is passing and you have no blockers, approve it on GitHub. +Then: + +- If there isn't a `1 approval` label or existing approval, add the `1 approval` label +- If there's already `1 approval` and/or it's been a week since the last request for changes, go ahead and squash merge + - For straightforward PRs that don't impact users, you can wait 3 days instead + +There's no need to reset waiting periods for minor fixups from code reviews of otherwise approved code. + +We try to leave PRs open for at least a week to give reviewers who aren't active every day a chance to get to it. + ### Other States #### External Blockers From cc50e621cbc39ca899bf7b6843cae7bcd4472fe1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josh=20Goldberg=20=E2=9C=A8?= Date: Fri, 30 Aug 2024 08:14:29 -0400 Subject: [PATCH 09/15] chore: disable eslint-plugin-perfectionist on enums (#9883) chore: disable eslint-plugin-perfectionist n enums --- eslint.config.mjs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 85804081ad99..bf26af7515c8 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -596,14 +596,7 @@ export default tseslint.config( type: 'natural', }, ], - 'perfectionist/sort-enums': [ - 'error', - { - order: 'asc', - partitionByComment: true, - type: 'natural', - }, - ], + 'perfectionist/sort-enums': 'off', 'perfectionist/sort-objects': [ 'error', { From c27b9e9073b90001ff66e6f3f4b43e6bd8b4bf21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josh=20Goldberg=20=E2=9C=A8?= Date: Fri, 30 Aug 2024 08:14:41 -0400 Subject: [PATCH 10/15] feat(typescript-estree): make withoutProjectParserOptions generic (#9877) * feat(typescript-estree): make withoutProjectParserOptions generic * Update packages/typescript-estree/src/withoutProjectParserOptions.ts Co-authored-by: Brad Zacher * Remove unnecessary import --------- Co-authored-by: Brad Zacher --- .../src/withoutProjectParserOptions.ts | 13 ++++++------ .../lib/withoutProjectParserOptions.test.ts | 21 +++++++++++++++++-- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/packages/typescript-estree/src/withoutProjectParserOptions.ts b/packages/typescript-estree/src/withoutProjectParserOptions.ts index a58074f50361..a6a8a97f61d6 100644 --- a/packages/typescript-estree/src/withoutProjectParserOptions.ts +++ b/packages/typescript-estree/src/withoutProjectParserOptions.ts @@ -1,5 +1,3 @@ -import type { TSESTreeOptions } from './parser-options'; - /** * Removes options that prompt the parser to parse the project with type * information. In other words, you can use this if you are invoking the parser @@ -8,12 +6,15 @@ import type { TSESTreeOptions } from './parser-options'; * * @see https://github.com/typescript-eslint/typescript-eslint/issues/8428 */ -export function withoutProjectParserOptions( - opts: TSESTreeOptions, -): TSESTreeOptions { +export function withoutProjectParserOptions( + opts: Options, +): Omit< + Options, + 'EXPERIMENTAL_useProjectService' | 'project' | 'projectService' +> { // eslint-disable-next-line @typescript-eslint/no-unused-vars -- The variables are meant to be omitted const { EXPERIMENTAL_useProjectService, project, projectService, ...rest } = opts as Record; - return rest; + return rest as unknown as Options; } diff --git a/packages/typescript-estree/tests/lib/withoutProjectParserOptions.test.ts b/packages/typescript-estree/tests/lib/withoutProjectParserOptions.test.ts index 9a7468f19dff..bf1b111544da 100644 --- a/packages/typescript-estree/tests/lib/withoutProjectParserOptions.test.ts +++ b/packages/typescript-estree/tests/lib/withoutProjectParserOptions.test.ts @@ -3,14 +3,31 @@ import { withoutProjectParserOptions } from '../../src'; describe('withoutProjectParserOptions', () => { it('removes only project parser options', () => { - const without = withoutProjectParserOptions({ + const options = { comment: true, EXPERIMENTAL_useProjectService: true, project: true, projectService: true, - } as TSESTreeOptions); + } as TSESTreeOptions; + + const without = withoutProjectParserOptions(options); + + expect(without).toEqual({ + comment: true, + }); + }); + + it('allows an alternate type extending from TSESTreeOptions', () => { + const without = withoutProjectParserOptions({ + comment: true, + project: true, + projectService: true, + other: true, + }); + expect(without).toEqual({ comment: true, + other: true, }); }); }); From e5d1ac4a29180c0b8d32e89f4831e09f903d3b05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josh=20Goldberg=20=E2=9C=A8?= Date: Fri, 30 Aug 2024 08:24:51 -0400 Subject: [PATCH 11/15] docs: add dedicated TypeOrValueSpecifier docs page (#9875) * docs: add dedicated TypeOrValueSpecifier docs page * spelling * Unnecessary new test * path/package copypasta * push updated test snapshots --- .cspell.json | 6 +- .../type-utils/TypeOrValueSpecifier.mdx | 135 ++++++++++++++++++ .../docs/rules/no-floating-promises.mdx | 13 +- .../rules/prefer-readonly-parameter-types.mdx | 19 +-- .../prefer-readonly-parameter-types.shot | 10 +- .../tests/rules/no-floating-promises.test.ts | 14 ++ .../type-utils/src/TypeOrValueSpecifier.ts | 36 +++++ packages/website/sidebars/sidebar.base.js | 11 +- packages/website/src/css/custom.css | 4 + 9 files changed, 219 insertions(+), 29 deletions(-) create mode 100644 docs/packages/type-utils/TypeOrValueSpecifier.mdx diff --git a/.cspell.json b/.cspell.json index 2dc68256f79c..93e100a70adf 100644 --- a/.cspell.json +++ b/.cspell.json @@ -49,9 +49,10 @@ "words": [ "Airbnb", "Airbnb's", - "ambiently", "allowdefaultproject", "allowdefaultprojectforfiles", + "allowforknownsafecalls", + "allowforknownsafepromises", "ambiently", "Arka", "Armano", @@ -102,6 +103,7 @@ "estree", "extrafileextensions", "falsiness", + "filespecifier", "fisker", "García", "globby", @@ -115,6 +117,7 @@ "joshuakgoldberg", "Katt", "kirkwaiblinger", + "libspecifier", "linebreaks", "Lundberg", "lzstring", @@ -140,6 +143,7 @@ "OOM", "OOMs", "oxlint", + "packagespecifier", "parameterised", "performant", "pluggable", diff --git a/docs/packages/type-utils/TypeOrValueSpecifier.mdx b/docs/packages/type-utils/TypeOrValueSpecifier.mdx new file mode 100644 index 000000000000..b9d76442406a --- /dev/null +++ b/docs/packages/type-utils/TypeOrValueSpecifier.mdx @@ -0,0 +1,135 @@ +--- +id: type-or-value-specifier +title: TypeOrValueSpecifier +--- + +Some lint rules include options to describe specific _types_ and/or _values_. +These options use a standardized format exported from the `type-utils` package, **`TypeOrValueSpecifier`**. + +`TypeOrValueSpecifier` allows three object forms of specifiers: + +- [`FileSpecifier`](#filespecifier): for types or values declared in local files +- [`LibSpecifier`](#libspecifier): for types or values declared in TypeScript's built-in lib definitions +- [`PackageSpecifier`](#packagespecifier): for types or values imported from packages + +For example, the following configuration of [`@typescript-eslint/no-floating-promises` > `allowForKnownSafeCalls`](/rules/no-floating-promises#allowforknownsafecalls) marks `node:test`'s `it` as safe using a package specifier: + +```json +{ + "@typescript-eslint/no-floating-promises": [ + "error", + { + "allowForKnownSafeCalls": [ + { "from": "package", "name": "it", "package": "node:test" } + ] + } + ] +} +``` + +Each object format requires at least: + +- `from`: which specifier to use, as `'file' | 'lib' | 'package'` +- `name`: a `string` or `string[]` for type or value name(s) to match on + +## FileSpecifier + +```ts +interface FileSpecifier { + from: 'file'; + name: string[] | string; + path?: string; +} +``` + +Describes specific types or values declared in local files. + +`path` may be used to specify a file the types or values must be declared in. +If omitted, all files will be matched. + +### FileSpecifier Examples + +Matching all types and values named `Props`: + +```json +{ "from": "file", "name": "Props" } +``` + +Matching all types and values named `Props` in `file.tsx`: + +```json +{ "from": "file", "name": "Props", "path": "file.tsx" } +``` + +## LibSpecifier + +```ts +interface LibSpecifier { + from: 'lib'; + name: string[] | string; +} +``` + +Describes specific types or values declared in TypeScript's built-in `lib.*.d.ts` ("lib") types. + +Lib types include `lib.dom.d.ts` globals such as `Window` and `lib.es*.ts` globals such as `Array`. + +### LibSpecifier Examples + +Matching all array-typed values: + +```json +{ "from": "lib", "name": "Array" } +``` + +Matching all `Promise` and `PromiseLike`-typed values: + +```json +{ "from": "lib", "name": ["Promise", "PromiseLike"] } +``` + +## PackageSpecifier + +```ts +interface PackageSpecifier { + from: 'package'; + name: string[] | string; + package: string; +} +``` + +Describes specific types or values imported from packages. + +`package` must be used to specify the package name. + +### PackageSpecifier Examples + +Matching the `SafePromise` type from `@reduxjs/toolkit`: + +```json +{ "from": "package", "name": "SafePromise", "package": "@reduxjs/toolkit" } +``` + +Matching the `describe`, `it`, and `test` values from `vitest`: + +```json +{ "from": "package", "name": ["describe", "it", "test"], "package": "vitest" } +``` + +## Universal String Specifiers + +`TypeOrValueSpecifier` also allows providing a plain string specifier to match all names regardless of declaration source. +For example, providing `"RegExp"` matches _all_ types and values named `RegExp`. + +:::danger +We strongly recommend not using universal string specifiers. +Matching _all_ names without specifying a source file, library, or package can accidentally match other types or values with a coincidentally similar name. + +Universal string specifiers will be removed in a future major version of typescript-eslint. +::: + +## Rule Options Using This Format + +- [`@typescript-eslint/no-floating-promises` > `allowForKnownSafeCalls`](/rules/no-floating-promises#allowforknownsafecalls) +- [`@typescript-eslint/no-floating-promises` > `allowForKnownSafePromises`](/rules/no-floating-promises#allowforknownsafepromises) +- [`@typescript-eslint/prefer-readonly-parameter-types` > `allow`](/rules/prefer-readonly-parameter-types/#allow) diff --git a/packages/eslint-plugin/docs/rules/no-floating-promises.mdx b/packages/eslint-plugin/docs/rules/no-floating-promises.mdx index bd814ac63dcd..18a84c2e0240 100644 --- a/packages/eslint-plugin/docs/rules/no-floating-promises.mdx +++ b/packages/eslint-plugin/docs/rules/no-floating-promises.mdx @@ -166,14 +166,9 @@ await (async function () { ### `allowForKnownSafePromises` -This option allows marking specific types as "safe" to be floating. For example, you may need to do this in the case of libraries whose APIs return Promises whose rejections are safely handled by the library. +Specific types to be marked as "safe" to be floating. For example, you may need to do this in the case of libraries whose APIs return Promises whose rejections are safely handled by the library. -This option takes an array of type specifiers to consider safe. -Each item in the array must have one of the following forms: - -- A type defined in a file (`{ from: "file", name: "Foo", path: "src/foo-file.ts" }` with `path` being an optional path relative to the project root directory) -- A type from the default library (`{ from: "lib", name: "PromiseLike" }`) -- A type from a package (`{ from: "package", name: "Foo", package: "foo-lib" }`, this also works for types defined in a typings package). +This option takes the shared [`TypeOrValueSpecifier` format](/packages/type-utils/type-or-value-specifier). Examples of code for this rule with: @@ -223,10 +218,10 @@ returnsSafePromise(); ### `allowForKnownSafeCalls` -This option allows marking specific functions as "safe" to be called to create floating Promises. +Specific functions to be marked as "safe" to be called to create floating Promises. For example, you may need to do this in the case of libraries whose APIs may be called without handling the resultant Promises. -This option takes the same array format as [`allowForKnownSafePromises`](#allowForKnownSafePromises). +This option takes the shared [`TypeOrValueSpecifier` format](/packages/type-utils/type-or-value-specifier). Examples of code for this rule with: diff --git a/packages/eslint-plugin/docs/rules/prefer-readonly-parameter-types.mdx b/packages/eslint-plugin/docs/rules/prefer-readonly-parameter-types.mdx index e700b429f4f6..f89d653bd63e 100644 --- a/packages/eslint-plugin/docs/rules/prefer-readonly-parameter-types.mdx +++ b/packages/eslint-plugin/docs/rules/prefer-readonly-parameter-types.mdx @@ -143,20 +143,13 @@ interface Foo { An array of type specifiers to ignore. Some complex types cannot easily be made readonly, for example the `HTMLElement` type or the `JQueryStatic` type from `@types/jquery`. This option allows you to globally disable reporting of such types. -Each item in the array must have one of the following forms: - -- A type defined in a file (`{ from: "file", name: "Foo", path: "src/foo-file.ts" }` with `path` being an optional path relative to the project root directory) -- A type from the default library (`{ from: "lib", name: "Foo" }`) -- A type from a package (`{ from: "package", name: "Foo", package: "foo-lib" }`, this also works for types defined in a typings package). - -Additionally, a type may be defined just as a simple string, which then matches the type independently of its origin. +This option takes the shared [`TypeOrValueSpecifier` format](/packages/type-utils/type-or-value-specifier). Examples of code for this rule with: ```json { "allow": [ - "$", { "from": "file", "name": "Foo" }, { "from": "lib", "name": "HTMLElement" }, { "from": "package", "name": "Bar", "package": "bar-lib" } @@ -167,7 +160,7 @@ Examples of code for this rule with: -```ts option='{"allow":["$",{"from":"file","name":"Foo"},{"from":"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; } @@ -191,7 +184,7 @@ function fn2(arg: Wrapper) {} function fn3(arg: WrapperWithOther) {} ``` -```ts option='{"allow":["$",{"from":"file","name":"Foo"},{"from":"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'; @@ -212,7 +205,7 @@ function fn3(arg: Bar) {} -```ts option='{"allow":["$",{"from":"file","name":"Foo"},{"from":"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; } @@ -229,7 +222,7 @@ function fn1(arg: Foo) {} function fn2(arg: Wrapper) {} ``` -```ts option='{"allow":["$",{"from":"file","name":"Foo"},{"from":"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 { @@ -246,7 +239,7 @@ function fn2(arg: HTMLElement) {} function fn3(arg: Bar) {} ``` -```ts option='{"allow":["$",{"from":"file","name":"Foo"},{"from":"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 diff --git a/packages/eslint-plugin/tests/docs-eslint-output-snapshots/prefer-readonly-parameter-types.shot b/packages/eslint-plugin/tests/docs-eslint-output-snapshots/prefer-readonly-parameter-types.shot index 606039e2e781..c09a4fad60f3 100644 --- a/packages/eslint-plugin/tests/docs-eslint-output-snapshots/prefer-readonly-parameter-types.shot +++ b/packages/eslint-plugin/tests/docs-eslint-output-snapshots/prefer-readonly-parameter-types.shot @@ -127,7 +127,7 @@ interface Foo { exports[`Validating rule docs prefer-readonly-parameter-types.mdx code examples ESLint output 3`] = ` "Incorrect -Options: {"allow":["$",{"from":"file","name":"Foo"},{"from":"lib","name":"HTMLElement"},{"from":"package","name":"Bar","package":"bar-lib"}]} +Options: {"allow":[{"from":"file","name":"Foo"},{"from":"lib","name":"HTMLElement"},{"from":"package","name":"Bar","package":"bar-lib"}]} interface ThisIsMutable { prop: string; @@ -158,7 +158,7 @@ function fn3(arg: WrapperWithOther) {} exports[`Validating rule docs prefer-readonly-parameter-types.mdx code examples ESLint output 4`] = ` "Incorrect -Options: {"allow":["$",{"from":"file","name":"Foo"},{"from":"lib","name":"HTMLElement"},{"from":"package","name":"Bar","package":"bar-lib"}]} +Options: {"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'; @@ -181,7 +181,7 @@ function fn3(arg: Bar) {} exports[`Validating rule docs prefer-readonly-parameter-types.mdx code examples ESLint output 5`] = ` "Correct -Options: {"allow":["$",{"from":"file","name":"Foo"},{"from":"lib","name":"HTMLElement"},{"from":"package","name":"Bar","package":"bar-lib"}]} +Options: {"allow":[{"from":"file","name":"Foo"},{"from":"lib","name":"HTMLElement"},{"from":"package","name":"Bar","package":"bar-lib"}]} interface Foo { prop: string; @@ -202,7 +202,7 @@ function fn2(arg: Wrapper) {} exports[`Validating rule docs prefer-readonly-parameter-types.mdx code examples ESLint output 6`] = ` "Correct -Options: {"allow":["$",{"from":"file","name":"Foo"},{"from":"lib","name":"HTMLElement"},{"from":"package","name":"Bar","package":"bar-lib"}]} +Options: {"allow":[{"from":"file","name":"Foo"},{"from":"lib","name":"HTMLElement"},{"from":"package","name":"Bar","package":"bar-lib"}]} import { Bar } from 'bar-lib'; @@ -223,7 +223,7 @@ function fn3(arg: Bar) {} exports[`Validating rule docs prefer-readonly-parameter-types.mdx code examples ESLint output 7`] = ` "Correct -Options: {"allow":["$",{"from":"file","name":"Foo"},{"from":"lib","name":"HTMLElement"},{"from":"package","name":"Bar","package":"bar-lib"}]} +Options: {"allow":[{"from":"file","name":"Foo"},{"from":"lib","name":"HTMLElement"},{"from":"package","name":"Bar","package":"bar-lib"}]} import { Foo } from './foo'; diff --git a/packages/eslint-plugin/tests/rules/no-floating-promises.test.ts b/packages/eslint-plugin/tests/rules/no-floating-promises.test.ts index 097a16928ed0..090146c0c90b 100644 --- a/packages/eslint-plugin/tests/rules/no-floating-promises.test.ts +++ b/packages/eslint-plugin/tests/rules/no-floating-promises.test.ts @@ -819,6 +819,20 @@ promise().then(() => {}); }, ], }, + { + code: ` + import { it } from 'node:test'; + + it('...', () => {}); + `, + options: [ + { + allowForKnownSafeCalls: [ + { from: 'package', name: 'it', package: 'node:test' }, + ], + }, + ], + }, { code: ` interface SafePromise extends Promise { diff --git a/packages/type-utils/src/TypeOrValueSpecifier.ts b/packages/type-utils/src/TypeOrValueSpecifier.ts index 2d7c5a3e6555..422e83769208 100644 --- a/packages/type-utils/src/TypeOrValueSpecifier.ts +++ b/packages/type-utils/src/TypeOrValueSpecifier.ts @@ -7,23 +7,59 @@ import { typeDeclaredInFile } from './typeOrValueSpecifiers/typeDeclaredInFile'; import { typeDeclaredInLib } from './typeOrValueSpecifiers/typeDeclaredInLib'; import { typeDeclaredInPackageDeclarationFile } from './typeOrValueSpecifiers/typeDeclaredInPackageDeclarationFile'; +/** + * Describes specific types or values declared in local files. + * See [TypeOrValueSpecifier > FileSpecifier](/packages/type-utils/type-or-value-specifier#filespecifier). + */ export interface FileSpecifier { from: 'file'; + + /** + * Type or value name(s) to match on. + */ name: string[] | string; + + /** + * A specific file the types or values must be declared in. + */ path?: string; } +/** + * Describes specific types or values declared in TypeScript's built-in lib definitions. + * See [TypeOrValueSpecifier > LibSpecifier](/packages/type-utils/type-or-value-specifier#libspecifier). + */ export interface LibSpecifier { from: 'lib'; + + /** + * Type or value name(s) to match on. + */ name: string[] | string; } +/** + * Describes specific types or values imported from packages. + * See [TypeOrValueSpecifier > PackageSpecifier](/packages/type-utils/type-or-value-specifier#packagespecifier). + */ export interface PackageSpecifier { from: 'package'; + + /** + * Type or value name(s) to match on. + */ name: string[] | string; + + /** + * Package name the type or value must be declared in. + */ package: string; } +/** + * A centralized format for rule options to describe specific _types_ and/or _values_. + * See [TypeOrValueSpecifier](/packages/type-utils/type-or-value-specifier). + */ export type TypeOrValueSpecifier = | FileSpecifier | LibSpecifier diff --git a/packages/website/sidebars/sidebar.base.js b/packages/website/sidebars/sidebar.base.js index ea42ac995d7c..b0d55ed91ffb 100644 --- a/packages/website/sidebars/sidebar.base.js +++ b/packages/website/sidebars/sidebar.base.js @@ -105,7 +105,16 @@ module.exports = { 'packages/parser', 'packages/rule-tester', 'packages/scope-manager', - 'packages/type-utils', + { + collapsible: false, + items: ['packages/type-utils/type-or-value-specifier'], + label: 'type-utils', + link: { + id: 'packages/type-utils', + type: 'doc', + }, + type: 'category', + }, { collapsible: false, items: ['packages/typescript-estree/ast-spec'], diff --git a/packages/website/src/css/custom.css b/packages/website/src/css/custom.css index 1fe7a2879640..5ef592f5f21c 100644 --- a/packages/website/src/css/custom.css +++ b/packages/website/src/css/custom.css @@ -204,6 +204,10 @@ h6 { text-decoration: underline; } +.markdown a:has(code) { + text-underline-offset: 0.25em; +} + .markdown a * { vertical-align: baseline; } From 46f27e6b1c5d5150dbacf06796dc3836d88b0abf Mon Sep 17 00:00:00 2001 From: xaos7991 <44319098+xaos7991@users.noreply.github.com> Date: Fri, 30 Aug 2024 21:42:18 +0300 Subject: [PATCH 12/15] docs: added note on async generator support in require-await (#9795) * docs: added note on async generator support in require-await * docs: add a new example for the require-await rule * docs: add examples of incorrect code * docs: update the note and the examples --------- Co-authored-by: Kirk Waiblinger --- .../docs/rules/require-await.mdx | 37 +++++++++++++++++-- .../require-await.shot | 35 ++++++++++++++++++ 2 files changed, 68 insertions(+), 4 deletions(-) create mode 100644 packages/eslint-plugin/tests/docs-eslint-output-snapshots/require-await.shot diff --git a/packages/eslint-plugin/docs/rules/require-await.mdx b/packages/eslint-plugin/docs/rules/require-await.mdx index 5a88e5012e03..c2bd9f7a072d 100644 --- a/packages/eslint-plugin/docs/rules/require-await.mdx +++ b/packages/eslint-plugin/docs/rules/require-await.mdx @@ -12,14 +12,43 @@ import TabItem from '@theme/TabItem'; This rule extends the base [`eslint/require-await`](https://eslint.org/docs/rules/require-await) rule. It uses type information to allow promise-returning functions to be marked as `async` without containing an `await` expression. +:::note +`yield` expressions in [async generator functions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function*) behave differently from sync generator functions (they unwrap promises), so the base rule never checks async generator functions. On the other hand, our rule uses type information and can detect async generator functions that both never use `await` and always yield non-promise values. +::: + ## Examples -Examples of **correct** code for this rule: + + + +```ts +async function returnNumber() { + return 1; +} + +async function* asyncGenerator() { + yield 1; +} + +const num = returnNumber(); +const callAsyncGenerator = () => asyncGenerator(); +``` + + + ```ts -async function returnsPromise1() { - return Promise.resolve(1); +function returnNumber() { + return 1; } -const returnsPromise2 = () => returnsPromise1(); +function* syncGenerator() { + yield 1; +} + +const num = returnNumber(); +const callSyncGenerator = () => syncGenerator(); ``` + + + diff --git a/packages/eslint-plugin/tests/docs-eslint-output-snapshots/require-await.shot b/packages/eslint-plugin/tests/docs-eslint-output-snapshots/require-await.shot new file mode 100644 index 000000000000..a4584d5b8ad7 --- /dev/null +++ b/packages/eslint-plugin/tests/docs-eslint-output-snapshots/require-await.shot @@ -0,0 +1,35 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Validating rule docs require-await.mdx code examples ESLint output 1`] = ` +"Incorrect + +async function returnNumber() { +~~~~~~~~~~~~~~~~~~~~~~~~~~~ Async function 'returnNumber' has no 'await' expression. + return 1; +} + +async function* asyncGenerator() { +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Async generator function 'asyncGenerator' has no 'await' expression. + yield 1; +} + +const num = returnNumber(); +const callAsyncGenerator = () => asyncGenerator(); +" +`; + +exports[`Validating rule docs require-await.mdx code examples ESLint output 2`] = ` +"Correct + +function returnNumber() { + return 1; +} + +function* syncGenerator() { + yield 1; +} + +const num = returnNumber(); +const callSyncGenerator = () => syncGenerator(); +" +`; From 2ad3404690cd601d1bbb80daa7f861ab5bb127e4 Mon Sep 17 00:00:00 2001 From: Abraham Guo Date: Fri, 30 Aug 2024 20:18:37 -0500 Subject: [PATCH 13/15] chore: enable `unicorn/prefer-export-from` and `@typescript-eslint/consistent-type-exports` (#9833) * prefer-export-from * sort imports * consistent-type-exports --- eslint.config.mjs | 5 +++++ .../src/rules/naming-convention-utils/enums.ts | 14 +++++++------- .../eslint-plugin/src/rules/naming-convention.ts | 2 +- .../src/util/explicitReturnTypeUtils.ts | 4 ++-- packages/eslint-plugin/src/util/index.ts | 4 ++-- packages/eslint-plugin/src/util/misc.ts | 6 +++--- packages/parser/src/index.ts | 8 ++++---- packages/parser/src/parser.ts | 7 ++++--- packages/scope-manager/src/analyze.ts | 2 +- .../scope-manager/src/definition/Definition.ts | 2 +- packages/scope-manager/src/index.ts | 6 +++--- .../scope-manager/src/referencer/PatternVisitor.ts | 6 +++++- packages/scope-manager/src/referencer/Reference.ts | 7 ++++++- .../scope-manager/src/referencer/Referencer.ts | 2 +- packages/scope-manager/src/referencer/Visitor.ts | 7 +++++-- .../scope-manager/src/referencer/VisitorBase.ts | 7 +++++-- packages/scope-manager/src/referencer/index.ts | 2 +- packages/scope-manager/src/scope/Scope.ts | 2 +- .../src/variable/ImplicitLibVariable.ts | 2 +- packages/scope-manager/src/variable/index.ts | 2 +- packages/scope-manager/tests/test-utils/parse.ts | 7 +++++-- packages/types/src/lib.ts | 2 +- packages/types/src/parser-options.ts | 2 +- packages/typescript-eslint/src/index.ts | 8 ++++---- .../WatchCompilerHostOfConfigFile.ts | 2 +- .../typescript-estree/src/create-program/shared.ts | 8 ++++---- packages/typescript-estree/src/index.ts | 6 +++--- packages/typescript-estree/src/parser-options.ts | 2 +- packages/typescript-estree/src/parser.ts | 4 ++-- .../utils/src/eslint-utils/InferTypesFromRule.ts | 2 +- packages/utils/src/eslint-utils/RuleCreator.ts | 4 ++-- packages/utils/src/index.ts | 11 +++++------ packages/utils/src/ts-eslint/AST.ts | 2 +- packages/utils/src/ts-eslint/ParserOptions.ts | 2 +- packages/utils/src/ts-eslint/RuleTester.ts | 14 +++++++------- packages/visitor-keys/src/index.ts | 2 +- packages/visitor-keys/src/visitor-keys.ts | 2 +- 37 files changed, 100 insertions(+), 77 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index bf26af7515c8..dd9762a689cf 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -111,6 +111,10 @@ export default tseslint.config( minimumDescriptionLength: 5, }, ], + '@typescript-eslint/consistent-type-exports': [ + 'error', + { fixMixedExportsWithInlineTypeSpecifier: true }, + ], '@typescript-eslint/consistent-type-imports': [ 'error', { prefer: 'type-imports', disallowTypeAnnotations: true }, @@ -323,6 +327,7 @@ export default tseslint.config( 'unicorn/no-lonely-if': 'error', 'unicorn/no-typeof-undefined': 'error', 'unicorn/no-useless-spread': 'error', + 'unicorn/prefer-export-from': 'error', 'unicorn/prefer-node-protocol': 'error', 'unicorn/prefer-regexp-test': 'error', 'unicorn/prefer-string-replace-all': 'error', 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 c30029882e16..539ca50a7810 100644 --- a/packages/eslint-plugin/src/rules/naming-convention-utils/enums.ts +++ b/packages/eslint-plugin/src/rules/naming-convention-utils/enums.ts @@ -134,17 +134,17 @@ enum TypeModifiers { type TypeModifiersString = keyof typeof TypeModifiers; export { - IndividualAndMetaSelectorsString, + type IndividualAndMetaSelectorsString, MetaSelectors, - MetaSelectorsString, + type MetaSelectorsString, Modifiers, - ModifiersString, + type ModifiersString, PredefinedFormats, - PredefinedFormatsString, + type PredefinedFormatsString, Selectors, - SelectorsString, + type SelectorsString, TypeModifiers, - TypeModifiersString, + type TypeModifiersString, UnderscoreOptions, - UnderscoreOptionsString, + type UnderscoreOptionsString, }; diff --git a/packages/eslint-plugin/src/rules/naming-convention.ts b/packages/eslint-plugin/src/rules/naming-convention.ts index 262f86668071..5133126e65be 100644 --- a/packages/eslint-plugin/src/rules/naming-convention.ts +++ b/packages/eslint-plugin/src/rules/naming-convention.ts @@ -785,4 +785,4 @@ function requiresQuoting( return _requiresQuoting(name, target); } -export { MessageIds, Options }; +export type { MessageIds, Options }; diff --git a/packages/eslint-plugin/src/util/explicitReturnTypeUtils.ts b/packages/eslint-plugin/src/util/explicitReturnTypeUtils.ts index f65273a502ef..9558e4629efa 100644 --- a/packages/eslint-plugin/src/util/explicitReturnTypeUtils.ts +++ b/packages/eslint-plugin/src/util/explicitReturnTypeUtils.ts @@ -365,8 +365,8 @@ export { checkFunctionExpressionReturnType, checkFunctionReturnType, doesImmediatelyReturnFunctionExpression, - FunctionExpression, - FunctionNode, + type FunctionExpression, + type FunctionNode, isTypedFunctionExpression, isValidFunctionExpressionReturnType, ancestorHasReturnType, diff --git a/packages/eslint-plugin/src/util/index.ts b/packages/eslint-plugin/src/util/index.ts index 4ceb0b42f2ce..58f34597653b 100644 --- a/packages/eslint-plugin/src/util/index.ts +++ b/packages/eslint-plugin/src/util/index.ts @@ -42,7 +42,7 @@ export { isObjectNotArray, getParserServices, nullThrows, - InferMessageIdsTypeFromRule, - InferOptionsTypeFromRule, + type InferMessageIdsTypeFromRule, + type InferOptionsTypeFromRule, NullThrowsReasons, }; diff --git a/packages/eslint-plugin/src/util/misc.ts b/packages/eslint-plugin/src/util/misc.ts index 46ad05c3a0e1..64f23f2e81bc 100644 --- a/packages/eslint-plugin/src/util/misc.ts +++ b/packages/eslint-plugin/src/util/misc.ts @@ -235,8 +235,8 @@ function isParenlessArrowFunction( export { arrayGroupByToMap, arraysAreEqual, - Equal, - ExcludeKeys, + type Equal, + type ExcludeKeys, findFirstResult, formatWordList, getEnumNames, @@ -246,7 +246,7 @@ export { isRestParameterDeclaration, isParenlessArrowFunction, MemberNameType, - RequireKeys, + type RequireKeys, typeNodeRequiresParentheses, upperCaseFirst, findLastIndex, diff --git a/packages/parser/src/index.ts b/packages/parser/src/index.ts index b166e7bd85fb..a1af2c02cd4b 100644 --- a/packages/parser/src/index.ts +++ b/packages/parser/src/index.ts @@ -1,10 +1,10 @@ -export { parse, parseForESLint, ParserOptions } from './parser'; +export { parse, parseForESLint, type ParserOptions } from './parser'; export { clearCaches, createProgram, - ParserServices, - ParserServicesWithoutTypeInformation, - ParserServicesWithTypeInformation, + type ParserServices, + type ParserServicesWithoutTypeInformation, + type ParserServicesWithTypeInformation, withoutProjectParserOptions, } from '@typescript-eslint/typescript-estree'; diff --git a/packages/parser/src/parser.ts b/packages/parser/src/parser.ts index 584d5727e12c..19abb97b3a44 100644 --- a/packages/parser/src/parser.ts +++ b/packages/parser/src/parser.ts @@ -2,7 +2,7 @@ import type { AnalyzeOptions, ScopeManager, } from '@typescript-eslint/scope-manager'; -import type { Lib, TSESTree } from '@typescript-eslint/types'; +import type { Lib, ParserOptions, TSESTree } from '@typescript-eslint/types'; import type { AST, ParserServices, @@ -12,7 +12,6 @@ import type { VisitorKeys } from '@typescript-eslint/visitor-keys'; import type * as ts from 'typescript'; import { analyze } from '@typescript-eslint/scope-manager'; -import { ParserOptions } from '@typescript-eslint/types'; import { parseAndGenerateServices } from '@typescript-eslint/typescript-estree'; import { visitorKeys } from '@typescript-eslint/visitor-keys'; import debug from 'debug'; @@ -188,4 +187,6 @@ function parseForESLint( return { ast, scopeManager, services, visitorKeys }; } -export { parse, parseForESLint, ParserOptions }; +export { parse, parseForESLint }; + +export type { ParserOptions } from '@typescript-eslint/types'; diff --git a/packages/scope-manager/src/analyze.ts b/packages/scope-manager/src/analyze.ts index 307adfe0905f..cf6cf0b57731 100644 --- a/packages/scope-manager/src/analyze.ts +++ b/packages/scope-manager/src/analyze.ts @@ -110,4 +110,4 @@ function analyze( return scopeManager; } -export { analyze, AnalyzeOptions }; +export { analyze, type AnalyzeOptions }; diff --git a/packages/scope-manager/src/definition/Definition.ts b/packages/scope-manager/src/definition/Definition.ts index 35b380ee6626..7d614862dca2 100644 --- a/packages/scope-manager/src/definition/Definition.ts +++ b/packages/scope-manager/src/definition/Definition.ts @@ -23,4 +23,4 @@ type Definition = | TypeDefinition | VariableDefinition; -export { Definition }; +export type { Definition }; diff --git a/packages/scope-manager/src/index.ts b/packages/scope-manager/src/index.ts index 8dc52ac4ac8c..03331783b8d5 100644 --- a/packages/scope-manager/src/index.ts +++ b/packages/scope-manager/src/index.ts @@ -1,11 +1,11 @@ -export { analyze, AnalyzeOptions } from './analyze'; +export { analyze, type AnalyzeOptions } from './analyze'; export * from './definition'; export { Reference } from './referencer/Reference'; export { Visitor } from './referencer/Visitor'; export { PatternVisitor, - PatternVisitorCallback, - PatternVisitorOptions, + type PatternVisitorCallback, + type PatternVisitorOptions, } from './referencer/PatternVisitor'; export * from './scope'; export { ScopeManager } from './ScopeManager'; diff --git a/packages/scope-manager/src/referencer/PatternVisitor.ts b/packages/scope-manager/src/referencer/PatternVisitor.ts index 51564882ef88..1b4c432b0164 100644 --- a/packages/scope-manager/src/referencer/PatternVisitor.ts +++ b/packages/scope-manager/src/referencer/PatternVisitor.ts @@ -138,4 +138,8 @@ class PatternVisitor extends VisitorBase { } } -export { PatternVisitor, PatternVisitorCallback, PatternVisitorOptions }; +export { + PatternVisitor, + type PatternVisitorCallback, + type PatternVisitorOptions, +}; diff --git a/packages/scope-manager/src/referencer/Reference.ts b/packages/scope-manager/src/referencer/Reference.ts index d74b628d8cc1..98e3bea9e5ac 100644 --- a/packages/scope-manager/src/referencer/Reference.ts +++ b/packages/scope-manager/src/referencer/Reference.ts @@ -146,4 +146,9 @@ class Reference { } } -export { Reference, ReferenceFlag, ReferenceTypeFlag, ReferenceImplicitGlobal }; +export { + Reference, + ReferenceFlag, + ReferenceTypeFlag, + type ReferenceImplicitGlobal, +}; diff --git a/packages/scope-manager/src/referencer/Referencer.ts b/packages/scope-manager/src/referencer/Referencer.ts index b7b01ee38c0f..eb2c77ca27cd 100644 --- a/packages/scope-manager/src/referencer/Referencer.ts +++ b/packages/scope-manager/src/referencer/Referencer.ts @@ -807,4 +807,4 @@ class Referencer extends Visitor { } } -export { Referencer, ReferencerOptions }; +export { Referencer, type ReferencerOptions }; diff --git a/packages/scope-manager/src/referencer/Visitor.ts b/packages/scope-manager/src/referencer/Visitor.ts index bbcf348734df..6d799bc58097 100644 --- a/packages/scope-manager/src/referencer/Visitor.ts +++ b/packages/scope-manager/src/referencer/Visitor.ts @@ -5,7 +5,8 @@ import type { PatternVisitorOptions, } from './PatternVisitor'; import { PatternVisitor } from './PatternVisitor'; -import { VisitorBase, VisitorOptions } from './VisitorBase'; +import type { VisitorOptions } from './VisitorBase'; +import { VisitorBase } from './VisitorBase'; interface VisitPatternOptions extends PatternVisitorOptions { processRightHandNodes?: boolean; @@ -42,4 +43,6 @@ class Visitor extends VisitorBase { } } -export { Visitor, VisitorBase, VisitorOptions }; +export { Visitor }; + +export { VisitorBase, type VisitorOptions } from './VisitorBase'; diff --git a/packages/scope-manager/src/referencer/VisitorBase.ts b/packages/scope-manager/src/referencer/VisitorBase.ts index 43af065b4c6f..2d3bd2779300 100644 --- a/packages/scope-manager/src/referencer/VisitorBase.ts +++ b/packages/scope-manager/src/referencer/VisitorBase.ts @@ -1,5 +1,6 @@ import type { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/types'; -import { VisitorKeys, visitorKeys } from '@typescript-eslint/visitor-keys'; +import type { VisitorKeys } from '@typescript-eslint/visitor-keys'; +import { visitorKeys } from '@typescript-eslint/visitor-keys'; interface VisitorOptions { childVisitorKeys?: VisitorKeys | null; @@ -83,4 +84,6 @@ abstract class VisitorBase { } } -export { VisitorBase, VisitorOptions, VisitorKeys }; +export { VisitorBase, type VisitorOptions }; + +export type { VisitorKeys } from '@typescript-eslint/visitor-keys'; diff --git a/packages/scope-manager/src/referencer/index.ts b/packages/scope-manager/src/referencer/index.ts index 6ac29bd3e0e0..6dca338bb85c 100644 --- a/packages/scope-manager/src/referencer/index.ts +++ b/packages/scope-manager/src/referencer/index.ts @@ -1 +1 @@ -export { Referencer, ReferencerOptions } from './Referencer'; +export { Referencer, type ReferencerOptions } from './Referencer'; diff --git a/packages/scope-manager/src/scope/Scope.ts b/packages/scope-manager/src/scope/Scope.ts index 87999d4b74b3..0f5090f1919a 100644 --- a/packages/scope-manager/src/scope/Scope.ts +++ b/packages/scope-manager/src/scope/Scope.ts @@ -37,4 +37,4 @@ type Scope = | TypeScope | WithScope; -export { Scope }; +export type { Scope }; diff --git a/packages/scope-manager/src/variable/ImplicitLibVariable.ts b/packages/scope-manager/src/variable/ImplicitLibVariable.ts index 2ebb8fef0ee6..2c4575af7ef6 100644 --- a/packages/scope-manager/src/variable/ImplicitLibVariable.ts +++ b/packages/scope-manager/src/variable/ImplicitLibVariable.ts @@ -42,4 +42,4 @@ class ImplicitLibVariable extends ESLintScopeVariable implements Variable { } } -export { ImplicitLibVariable, ImplicitLibVariableOptions }; +export { ImplicitLibVariable, type ImplicitLibVariableOptions }; diff --git a/packages/scope-manager/src/variable/index.ts b/packages/scope-manager/src/variable/index.ts index 80d3d9e485af..99acd7dcd290 100644 --- a/packages/scope-manager/src/variable/index.ts +++ b/packages/scope-manager/src/variable/index.ts @@ -4,7 +4,7 @@ import type { Variable } from './Variable'; export { ESLintScopeVariable } from './ESLintScopeVariable'; export { ImplicitLibVariable, - ImplicitLibVariableOptions, + type ImplicitLibVariableOptions, } from './ImplicitLibVariable'; export { Variable } from './Variable'; diff --git a/packages/scope-manager/tests/test-utils/parse.ts b/packages/scope-manager/tests/test-utils/parse.ts index 1ba739d66ed6..b3a2b6e8f644 100644 --- a/packages/scope-manager/tests/test-utils/parse.ts +++ b/packages/scope-manager/tests/test-utils/parse.ts @@ -1,6 +1,7 @@ import * as tseslint from '@typescript-eslint/typescript-estree'; -import { analyze, AnalyzeOptions } from '../../src/analyze'; +import type { AnalyzeOptions } from '../../src/analyze'; +import { analyze } from '../../src/analyze'; type SourceType = AnalyzeOptions['sourceType']; @@ -59,4 +60,6 @@ function parseAndAnalyze( return { ast, scopeManager }; } -export { parse, parseAndAnalyze, AnalyzeOptions }; +export { parse, parseAndAnalyze }; + +export type { AnalyzeOptions } from '../../src/analyze'; diff --git a/packages/types/src/lib.ts b/packages/types/src/lib.ts index 71c8f4334917..3548a0db0809 100644 --- a/packages/types/src/lib.ts +++ b/packages/types/src/lib.ts @@ -100,4 +100,4 @@ type Lib = | 'webworker.importscripts' | 'webworker.iterable'; -export { Lib }; +export type { Lib }; diff --git a/packages/types/src/parser-options.ts b/packages/types/src/parser-options.ts index ab4631aa7768..59db7debd0cb 100644 --- a/packages/types/src/parser-options.ts +++ b/packages/types/src/parser-options.ts @@ -107,7 +107,7 @@ interface ParserOptions { warnOnUnsupportedTypeScriptVersion?: boolean; } -export { +export type { CacheDurationSeconds, DebugLevel, EcmaVersion, diff --git a/packages/typescript-eslint/src/index.ts b/packages/typescript-eslint/src/index.ts index 786f4593a9d9..470cb1055491 100644 --- a/packages/typescript-eslint/src/index.ts +++ b/packages/typescript-eslint/src/index.ts @@ -4,8 +4,6 @@ import type { TSESLint } from '@typescript-eslint/utils'; import pluginBase from '@typescript-eslint/eslint-plugin'; import * as parserBase from '@typescript-eslint/parser'; -import type { ConfigWithExtends } from './config-helper'; - import { config } from './config-helper'; import allConfig from './configs/all'; import baseConfig from './configs/base'; @@ -138,7 +136,7 @@ const configs = { }; export type Config = TSESLint.FlatConfig.ConfigFile; -export type { ConfigWithExtends }; + /* we do both a default and named exports to allow people to use this package from both CJS and ESM in very natural ways. @@ -186,4 +184,6 @@ export default { parser, plugin, }; -export { config, configs, parser, plugin }; +export { configs, parser, plugin }; + +export { config, type ConfigWithExtends } from './config-helper'; diff --git a/packages/typescript-estree/src/create-program/WatchCompilerHostOfConfigFile.ts b/packages/typescript-estree/src/create-program/WatchCompilerHostOfConfigFile.ts index 04799b89580c..21d0c24516f8 100644 --- a/packages/typescript-estree/src/create-program/WatchCompilerHostOfConfigFile.ts +++ b/packages/typescript-estree/src/create-program/WatchCompilerHostOfConfigFile.ts @@ -35,4 +35,4 @@ interface WatchCompilerHostOfConfigFile extraFileExtensions?: readonly ts.FileExtensionInfo[]; } -export { WatchCompilerHostOfConfigFile }; +export type { WatchCompilerHostOfConfigFile }; diff --git a/packages/typescript-estree/src/create-program/shared.ts b/packages/typescript-estree/src/create-program/shared.ts index 73f6e8e3588f..ca6c5f35abe9 100644 --- a/packages/typescript-estree/src/create-program/shared.ts +++ b/packages/typescript-estree/src/create-program/shared.ts @@ -128,12 +128,12 @@ function createHash(content: string): string { } export { - ASTAndDefiniteProgram, - ASTAndNoProgram, - ASTAndProgram, + type ASTAndDefiniteProgram, + type ASTAndNoProgram, + type ASTAndProgram, CORE_COMPILER_OPTIONS, canonicalDirname, - CanonicalPath, + type CanonicalPath, createDefaultCompilerOptionsFromExtra, createHash, ensureAbsolutePath, diff --git a/packages/typescript-estree/src/index.ts b/packages/typescript-estree/src/index.ts index 5f6e8768d0c4..757b50074d17 100644 --- a/packages/typescript-estree/src/index.ts +++ b/packages/typescript-estree/src/index.ts @@ -1,10 +1,10 @@ export { - AST, + type AST, parse, parseAndGenerateServices, - ParseAndGenerateServicesResult, + type ParseAndGenerateServicesResult, } from './parser'; -export { +export type { ParserServices, ParserServicesWithTypeInformation, ParserServicesWithoutTypeInformation, diff --git a/packages/typescript-estree/src/parser-options.ts b/packages/typescript-estree/src/parser-options.ts index 8aeeaa8ff049..55f4d3b05ebd 100644 --- a/packages/typescript-estree/src/parser-options.ts +++ b/packages/typescript-estree/src/parser-options.ts @@ -8,7 +8,7 @@ import type * as ts from 'typescript'; import type { TSESTree, TSESTreeToTSNode, TSNode, TSToken } from './ts-estree'; -export { ProjectServiceOptions } from '@typescript-eslint/types'; +export type { ProjectServiceOptions } from '@typescript-eslint/types'; ////////////////////////////////////////////////////////// // MAKE SURE THIS IS KEPT IN SYNC WITH THE WEBSITE DOCS // diff --git a/packages/typescript-estree/src/parser.ts b/packages/typescript-estree/src/parser.ts index 45e5a0a92b87..3f37aeed5e64 100644 --- a/packages/typescript-estree/src/parser.ts +++ b/packages/typescript-estree/src/parser.ts @@ -273,10 +273,10 @@ function parseAndGenerateServices( } export { - AST, + type AST, parse, parseAndGenerateServices, - ParseAndGenerateServicesResult, + type ParseAndGenerateServicesResult, clearDefaultProjectMatchedFiles, clearProgramCache, clearParseAndGenerateServicesCalls, diff --git a/packages/utils/src/eslint-utils/InferTypesFromRule.ts b/packages/utils/src/eslint-utils/InferTypesFromRule.ts index 76280db1d8e4..ab8a43a8b8c6 100644 --- a/packages/utils/src/eslint-utils/InferTypesFromRule.ts +++ b/packages/utils/src/eslint-utils/InferTypesFromRule.ts @@ -20,4 +20,4 @@ type InferMessageIdsTypeFromRule = ? MessageIds : unknown; -export { InferMessageIdsTypeFromRule, InferOptionsTypeFromRule }; +export type { InferMessageIdsTypeFromRule, InferOptionsTypeFromRule }; diff --git a/packages/utils/src/eslint-utils/RuleCreator.ts b/packages/utils/src/eslint-utils/RuleCreator.ts index 6dd7ce13e96c..293671649c6e 100644 --- a/packages/utils/src/eslint-utils/RuleCreator.ts +++ b/packages/utils/src/eslint-utils/RuleCreator.ts @@ -8,8 +8,6 @@ import type { import { applyDefault } from './applyDefault'; -export type { RuleListener, RuleModule }; - // we automatically add the url export type NamedCreateRuleMetaDocs = Omit; @@ -119,3 +117,5 @@ RuleCreator.withoutDocs = function withoutDocs< ): RuleModule { return createRule(args); }; + +export { type RuleListener, type RuleModule } from '../ts-eslint/Rule'; diff --git a/packages/utils/src/index.ts b/packages/utils/src/index.ts index e604617af997..d6d907cd0ef4 100644 --- a/packages/utils/src/index.ts +++ b/packages/utils/src/index.ts @@ -1,8 +1,7 @@ -import * as ASTUtils from './ast-utils'; -import * as ESLintUtils from './eslint-utils'; -import * as JSONSchema from './json-schema'; -import * as TSESLint from './ts-eslint'; -import * as TSUtils from './ts-utils'; +export * as ASTUtils from './ast-utils'; -export { ASTUtils, ESLintUtils, JSONSchema, TSESLint, TSUtils }; +export * as ESLintUtils from './eslint-utils'; +export * as JSONSchema from './json-schema'; +export * as TSESLint from './ts-eslint'; export * from './ts-estree'; +export * as TSUtils from './ts-utils'; diff --git a/packages/utils/src/ts-eslint/AST.ts b/packages/utils/src/ts-eslint/AST.ts index 4cace04f13f6..a8462faa8907 100644 --- a/packages/utils/src/ts-eslint/AST.ts +++ b/packages/utils/src/ts-eslint/AST.ts @@ -12,4 +12,4 @@ namespace AST { export type Range = TSESTree.Range; } -export { AST }; +export type { AST }; diff --git a/packages/utils/src/ts-eslint/ParserOptions.ts b/packages/utils/src/ts-eslint/ParserOptions.ts index 5a64049f3351..12fa08ba635d 100644 --- a/packages/utils/src/ts-eslint/ParserOptions.ts +++ b/packages/utils/src/ts-eslint/ParserOptions.ts @@ -1,4 +1,4 @@ -export { +export type { DebugLevel, EcmaVersion, ParserOptions, diff --git a/packages/utils/src/ts-eslint/RuleTester.ts b/packages/utils/src/ts-eslint/RuleTester.ts index c2b02cfde619..a9887ad835d1 100644 --- a/packages/utils/src/ts-eslint/RuleTester.ts +++ b/packages/utils/src/ts-eslint/RuleTester.ts @@ -229,12 +229,12 @@ declare class RuleTesterBase { class RuleTester extends (ESLintRuleTester as typeof RuleTesterBase) {} export { - InvalidTestCase, + type InvalidTestCase, RuleTester, - RuleTesterConfig, - RuleTesterTestFrameworkFunction, - RunTests, - SuggestionOutput, - TestCaseError, - ValidTestCase, + type RuleTesterConfig, + type RuleTesterTestFrameworkFunction, + type RunTests, + type SuggestionOutput, + type TestCaseError, + type ValidTestCase, }; diff --git a/packages/visitor-keys/src/index.ts b/packages/visitor-keys/src/index.ts index 04aa65158635..29cb09b54586 100644 --- a/packages/visitor-keys/src/index.ts +++ b/packages/visitor-keys/src/index.ts @@ -1,2 +1,2 @@ export { getKeys } from './get-keys'; -export { visitorKeys, VisitorKeys } from './visitor-keys'; +export { visitorKeys, type VisitorKeys } from './visitor-keys'; diff --git a/packages/visitor-keys/src/visitor-keys.ts b/packages/visitor-keys/src/visitor-keys.ts index caa7671359b9..569075daa533 100644 --- a/packages/visitor-keys/src/visitor-keys.ts +++ b/packages/visitor-keys/src/visitor-keys.ts @@ -275,4 +275,4 @@ const additionalKeys: AdditionalKeys = { const visitorKeys: VisitorKeys = eslintVisitorKeys.unionWith(additionalKeys); -export { visitorKeys, VisitorKeys }; +export { visitorKeys, type VisitorKeys }; From 51e947c4449230cb967448e97f4dd7ed09876c78 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 1 Sep 2024 08:12:49 -0400 Subject: [PATCH 14/15] chore(deps): update dependency webpack to v5.94.0 (#9904) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- yarn.lock | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/yarn.lock b/yarn.lock index 14d1e58608e1..2d5bce2551ca 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5112,12 +5112,6 @@ __metadata: languageName: node linkType: hard -"@types/eslint-scope@link:./tools/dummypkg::locator=%40typescript-eslint%2Ftypescript-eslint%40workspace%3A.": - version: 0.0.0-use.local - resolution: "@types/eslint-scope@link:./tools/dummypkg::locator=%40typescript-eslint%2Ftypescript-eslint%40workspace%3A." - languageName: node - linkType: soft - "@types/eslint-visitor-keys@npm:*": version: 3.3.0 resolution: "@types/eslint-visitor-keys@npm:3.3.0" @@ -9291,13 +9285,13 @@ __metadata: languageName: node linkType: hard -"enhanced-resolve@npm:^5.17.0": - version: 5.17.0 - resolution: "enhanced-resolve@npm:5.17.0" +"enhanced-resolve@npm:^5.17.1": + version: 5.17.1 + resolution: "enhanced-resolve@npm:5.17.1" dependencies: graceful-fs: ^4.2.4 tapable: ^2.2.0 - checksum: 1066000454da6a7aeabdbe1f433d912d1e39e6892142a78a37b6577aab27e0436091fa1399d857ad87085b1c3b73a0f811c8874da3dbdc40fbd5ebe89a5568e6 + checksum: 4bc38cf1cea96456f97503db7280394177d1bc46f8f87c267297d04f795ac5efa81e48115a2f5b6273c781027b5b6bfc5f62b54df629e4d25fa7001a86624f59 languageName: node linkType: hard @@ -20126,10 +20120,9 @@ __metadata: linkType: hard "webpack@npm:^5.88.1, webpack@npm:^5.91.0": - version: 5.93.0 - resolution: "webpack@npm:5.93.0" + version: 5.94.0 + resolution: "webpack@npm:5.94.0" dependencies: - "@types/eslint-scope": ^3.7.3 "@types/estree": ^1.0.5 "@webassemblyjs/ast": ^1.12.1 "@webassemblyjs/wasm-edit": ^1.12.1 @@ -20138,7 +20131,7 @@ __metadata: acorn-import-attributes: ^1.9.5 browserslist: ^4.21.10 chrome-trace-event: ^1.0.2 - enhanced-resolve: ^5.17.0 + enhanced-resolve: ^5.17.1 es-module-lexer: ^1.2.1 eslint-scope: 5.1.1 events: ^3.2.0 @@ -20158,7 +20151,7 @@ __metadata: optional: true bin: webpack: bin/webpack.js - checksum: c93bd73d9e1ab49b07e139582187f1c3760ee2cf0163b6288fab2ae210e39e59240a26284e7e5d29bec851255ef4b43c51642c882fa5a94e16ce7cb906deeb47 + checksum: 6a3d667be304a69cd6dcb8d676bc29f47642c0d389af514cfcd646eaaa809961bc6989fc4b2621a717dfc461130f29c6e20006d62a32e012dafaa9517813a4e6 languageName: node linkType: hard From 3920c937e8a7b56e6134a073f03e89faeed4dd9a Mon Sep 17 00:00:00 2001 From: "typescript-eslint[bot]" Date: Mon, 2 Sep 2024 17:15:35 +0000 Subject: [PATCH 15/15] chore(release): publish 8.4.0 --- CHANGELOG.md | 13 +++ packages/ast-spec/CHANGELOG.md | 6 ++ packages/ast-spec/package.json | 2 +- packages/eslint-plugin/CHANGELOG.md | 6 ++ packages/eslint-plugin/package.json | 14 ++-- packages/parser/CHANGELOG.md | 6 ++ packages/parser/package.json | 10 +-- .../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 | 6 ++ packages/typescript-eslint/package.json | 8 +- packages/typescript-estree/CHANGELOG.md | 14 ++++ packages/typescript-estree/package.json | 6 +- packages/utils/CHANGELOG.md | 6 ++ packages/utils/package.json | 8 +- packages/visitor-keys/CHANGELOG.md | 6 ++ packages/visitor-keys/package.json | 4 +- yarn.lock | 80 +++++++++---------- 26 files changed, 175 insertions(+), 82 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a6eb2fc67a34..2f56e280c4a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,16 @@ +## 8.4.0 (2024-09-02) + + +### 🚀 Features + +- **typescript-estree:** make withoutProjectParserOptions generic ([#9877](https://github.com/typescript-eslint/typescript-eslint/pull/9877)) + +### ❤️ Thank You + +- Josh Goldberg ✨ + +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. + ## 8.3.0 (2024-08-26) diff --git a/packages/ast-spec/CHANGELOG.md b/packages/ast-spec/CHANGELOG.md index 6506711f100f..c974c0f8acc9 100644 --- a/packages/ast-spec/CHANGELOG.md +++ b/packages/ast-spec/CHANGELOG.md @@ -1,3 +1,9 @@ +## 8.4.0 (2024-09-02) + +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. + ## 8.3.0 (2024-08-26) diff --git a/packages/ast-spec/package.json b/packages/ast-spec/package.json index 6ec1a18f08c0..8dcc473c0dff 100644 --- a/packages/ast-spec/package.json +++ b/packages/ast-spec/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/ast-spec", - "version": "8.3.0", + "version": "8.4.0", "description": "Complete specification for the TypeScript-ESTree AST", "private": true, "keywords": [ diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index fa40ba1c93e6..e03c942c3570 100644 --- a/packages/eslint-plugin/CHANGELOG.md +++ b/packages/eslint-plugin/CHANGELOG.md @@ -1,3 +1,9 @@ +## 8.4.0 (2024-09-02) + +This was a version bump only for eslint-plugin 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. + ## 8.3.0 (2024-08-26) diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 2750ef08edfe..a5d0676c8baa 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin", - "version": "8.3.0", + "version": "8.4.0", "description": "TypeScript plugin for ESLint", "files": [ "dist", @@ -60,10 +60,10 @@ }, "dependencies": { "@eslint-community/regexpp": "^4.10.0", - "@typescript-eslint/scope-manager": "8.3.0", - "@typescript-eslint/type-utils": "8.3.0", - "@typescript-eslint/utils": "8.3.0", - "@typescript-eslint/visitor-keys": "8.3.0", + "@typescript-eslint/scope-manager": "8.4.0", + "@typescript-eslint/type-utils": "8.4.0", + "@typescript-eslint/utils": "8.4.0", + "@typescript-eslint/visitor-keys": "8.4.0", "graphemer": "^1.4.0", "ignore": "^5.3.1", "natural-compare": "^1.4.0", @@ -74,8 +74,8 @@ "@types/marked": "^5.0.2", "@types/mdast": "^4.0.3", "@types/natural-compare": "*", - "@typescript-eslint/rule-schema-to-typescript-types": "8.3.0", - "@typescript-eslint/rule-tester": "8.3.0", + "@typescript-eslint/rule-schema-to-typescript-types": "8.4.0", + "@typescript-eslint/rule-tester": "8.4.0", "ajv": "^6.12.6", "cross-env": "^7.0.3", "cross-fetch": "*", diff --git a/packages/parser/CHANGELOG.md b/packages/parser/CHANGELOG.md index 57f3e931ed30..6b8ebe0bc32f 100644 --- a/packages/parser/CHANGELOG.md +++ b/packages/parser/CHANGELOG.md @@ -1,3 +1,9 @@ +## 8.4.0 (2024-09-02) + +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. + ## 8.3.0 (2024-08-26) This was a version bump only for parser to align it with other projects, there were no code changes. diff --git a/packages/parser/package.json b/packages/parser/package.json index aab20ff7f30c..404e663304e9 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/parser", - "version": "8.3.0", + "version": "8.4.0", "description": "An ESLint custom parser which leverages TypeScript ESTree", "files": [ "dist", @@ -52,10 +52,10 @@ "eslint": "^8.57.0 || ^9.0.0" }, "dependencies": { - "@typescript-eslint/scope-manager": "8.3.0", - "@typescript-eslint/types": "8.3.0", - "@typescript-eslint/typescript-estree": "8.3.0", - "@typescript-eslint/visitor-keys": "8.3.0", + "@typescript-eslint/scope-manager": "8.4.0", + "@typescript-eslint/types": "8.4.0", + "@typescript-eslint/typescript-estree": "8.4.0", + "@typescript-eslint/visitor-keys": "8.4.0", "debug": "^4.3.4" }, "devDependencies": { diff --git a/packages/rule-schema-to-typescript-types/CHANGELOG.md b/packages/rule-schema-to-typescript-types/CHANGELOG.md index d943c4cd999a..5627a878428b 100644 --- a/packages/rule-schema-to-typescript-types/CHANGELOG.md +++ b/packages/rule-schema-to-typescript-types/CHANGELOG.md @@ -1,3 +1,9 @@ +## 8.4.0 (2024-09-02) + +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. + ## 8.3.0 (2024-08-26) This was a version bump only for rule-schema-to-typescript-types to align it with other projects, there were no code changes. diff --git a/packages/rule-schema-to-typescript-types/package.json b/packages/rule-schema-to-typescript-types/package.json index 2653b2278c16..55eaee390b15 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": "8.3.0", + "version": "8.4.0", "private": true, "type": "commonjs", "exports": { @@ -34,8 +34,8 @@ "typecheck": "tsc --noEmit" }, "dependencies": { - "@typescript-eslint/type-utils": "8.3.0", - "@typescript-eslint/utils": "8.3.0", + "@typescript-eslint/type-utils": "8.4.0", + "@typescript-eslint/utils": "8.4.0", "natural-compare": "^1.4.0", "prettier": "^3.2.5" }, diff --git a/packages/rule-tester/CHANGELOG.md b/packages/rule-tester/CHANGELOG.md index 71e59d08f4bd..3efbb458b721 100644 --- a/packages/rule-tester/CHANGELOG.md +++ b/packages/rule-tester/CHANGELOG.md @@ -1,3 +1,9 @@ +## 8.4.0 (2024-09-02) + +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. + ## 8.3.0 (2024-08-26) This was a version bump only for rule-tester to align it with other projects, there were no code changes. diff --git a/packages/rule-tester/package.json b/packages/rule-tester/package.json index 84b93b090708..c5db41d9b055 100644 --- a/packages/rule-tester/package.json +++ b/packages/rule-tester/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/rule-tester", - "version": "8.3.0", + "version": "8.4.0", "description": "Tooling to test ESLint rules", "files": [ "dist", @@ -48,8 +48,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": "8.3.0", - "@typescript-eslint/utils": "8.3.0", + "@typescript-eslint/typescript-estree": "8.4.0", + "@typescript-eslint/utils": "8.4.0", "ajv": "^6.12.6", "json-stable-stringify-without-jsonify": "^1.0.1", "lodash.merge": "4.6.2", @@ -62,7 +62,7 @@ "@jest/types": "29.6.3", "@types/json-stable-stringify-without-jsonify": "^1.0.2", "@types/lodash.merge": "4.6.9", - "@typescript-eslint/parser": "8.3.0", + "@typescript-eslint/parser": "8.4.0", "chai": "^4.4.1", "eslint-visitor-keys": "^4.0.0", "espree": "^10.0.1", diff --git a/packages/scope-manager/CHANGELOG.md b/packages/scope-manager/CHANGELOG.md index 174abd288ab7..67bb7a63b4ae 100644 --- a/packages/scope-manager/CHANGELOG.md +++ b/packages/scope-manager/CHANGELOG.md @@ -1,3 +1,9 @@ +## 8.4.0 (2024-09-02) + +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. + ## 8.3.0 (2024-08-26) diff --git a/packages/scope-manager/package.json b/packages/scope-manager/package.json index efb3ae9e29ff..69b3f219b764 100644 --- a/packages/scope-manager/package.json +++ b/packages/scope-manager/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/scope-manager", - "version": "8.3.0", + "version": "8.4.0", "description": "TypeScript scope analyser for ESLint", "files": [ "dist", @@ -46,13 +46,13 @@ "typecheck": "npx nx typecheck" }, "dependencies": { - "@typescript-eslint/types": "8.3.0", - "@typescript-eslint/visitor-keys": "8.3.0" + "@typescript-eslint/types": "8.4.0", + "@typescript-eslint/visitor-keys": "8.4.0" }, "devDependencies": { "@jest/types": "29.6.3", "@types/glob": "*", - "@typescript-eslint/typescript-estree": "8.3.0", + "@typescript-eslint/typescript-estree": "8.4.0", "glob": "*", "jest-specific-snapshot": "*", "make-dir": "*", diff --git a/packages/type-utils/CHANGELOG.md b/packages/type-utils/CHANGELOG.md index b3cb1880249f..1ef67283ce18 100644 --- a/packages/type-utils/CHANGELOG.md +++ b/packages/type-utils/CHANGELOG.md @@ -1,3 +1,9 @@ +## 8.4.0 (2024-09-02) + +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. + ## 8.3.0 (2024-08-26) diff --git a/packages/type-utils/package.json b/packages/type-utils/package.json index 1251f57900a3..4e3be03bb31e 100644 --- a/packages/type-utils/package.json +++ b/packages/type-utils/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/type-utils", - "version": "8.3.0", + "version": "8.4.0", "description": "Type utilities for working with TypeScript + ESLint together", "files": [ "dist", @@ -46,14 +46,14 @@ "typecheck": "tsc --noEmit" }, "dependencies": { - "@typescript-eslint/typescript-estree": "8.3.0", - "@typescript-eslint/utils": "8.3.0", + "@typescript-eslint/typescript-estree": "8.4.0", + "@typescript-eslint/utils": "8.4.0", "debug": "^4.3.4", "ts-api-utils": "^1.3.0" }, "devDependencies": { "@jest/types": "29.6.3", - "@typescript-eslint/parser": "8.3.0", + "@typescript-eslint/parser": "8.4.0", "ajv": "^6.12.6", "downlevel-dts": "*", "jest": "29.7.0", diff --git a/packages/types/CHANGELOG.md b/packages/types/CHANGELOG.md index d0eca08afd5a..3d8b92f39810 100644 --- a/packages/types/CHANGELOG.md +++ b/packages/types/CHANGELOG.md @@ -1,3 +1,9 @@ +## 8.4.0 (2024-09-02) + +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. + ## 8.3.0 (2024-08-26) This was a version bump only for types to align it with other projects, there were no code changes. diff --git a/packages/types/package.json b/packages/types/package.json index 0206eaf572bc..7789c3b28733 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/types", - "version": "8.3.0", + "version": "8.4.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 d1aca677b8d7..f875e0d7db5d 100644 --- a/packages/typescript-eslint/CHANGELOG.md +++ b/packages/typescript-eslint/CHANGELOG.md @@ -1,3 +1,9 @@ +## 8.4.0 (2024-09-02) + +This was a version bump only for typescript-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. + ## 8.3.0 (2024-08-26) diff --git a/packages/typescript-eslint/package.json b/packages/typescript-eslint/package.json index 219900f67b9e..3c28148d73cc 100644 --- a/packages/typescript-eslint/package.json +++ b/packages/typescript-eslint/package.json @@ -1,6 +1,6 @@ { "name": "typescript-eslint", - "version": "8.3.0", + "version": "8.4.0", "description": "Tooling which enables you to use TypeScript with ESLint", "files": [ "dist", @@ -52,9 +52,9 @@ "typecheck": "tsc --noEmit" }, "dependencies": { - "@typescript-eslint/eslint-plugin": "8.3.0", - "@typescript-eslint/parser": "8.3.0", - "@typescript-eslint/utils": "8.3.0" + "@typescript-eslint/eslint-plugin": "8.4.0", + "@typescript-eslint/parser": "8.4.0", + "@typescript-eslint/utils": "8.4.0" }, "devDependencies": { "@jest/types": "29.6.3", diff --git a/packages/typescript-estree/CHANGELOG.md b/packages/typescript-estree/CHANGELOG.md index df8ec6365784..56f4bbe372b0 100644 --- a/packages/typescript-estree/CHANGELOG.md +++ b/packages/typescript-estree/CHANGELOG.md @@ -1,3 +1,17 @@ +## 8.4.0 (2024-09-02) + + +### 🚀 Features + +- **typescript-estree:** make withoutProjectParserOptions generic + + +### ❤️ Thank You + +- Josh Goldberg ✨ + +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. + ## 8.3.0 (2024-08-26) diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index 23376a6b1dad..da3c1346fe6f 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/typescript-estree", - "version": "8.3.0", + "version": "8.4.0", "description": "A parser that converts TypeScript source code into an ESTree compatible form", "files": [ "dist", @@ -54,8 +54,8 @@ "typecheck": "tsc --noEmit" }, "dependencies": { - "@typescript-eslint/types": "8.3.0", - "@typescript-eslint/visitor-keys": "8.3.0", + "@typescript-eslint/types": "8.4.0", + "@typescript-eslint/visitor-keys": "8.4.0", "debug": "^4.3.4", "fast-glob": "^3.3.2", "is-glob": "^4.0.3", diff --git a/packages/utils/CHANGELOG.md b/packages/utils/CHANGELOG.md index a53ac7a7559a..294399da1b4b 100644 --- a/packages/utils/CHANGELOG.md +++ b/packages/utils/CHANGELOG.md @@ -1,3 +1,9 @@ +## 8.4.0 (2024-09-02) + +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. + ## 8.3.0 (2024-08-26) diff --git a/packages/utils/package.json b/packages/utils/package.json index 1a5e99280d2f..c7e556ef76a1 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/utils", - "version": "8.3.0", + "version": "8.4.0", "description": "Utilities for working with TypeScript + ESLint together", "files": [ "dist", @@ -64,9 +64,9 @@ }, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", - "@typescript-eslint/scope-manager": "8.3.0", - "@typescript-eslint/types": "8.3.0", - "@typescript-eslint/typescript-estree": "8.3.0" + "@typescript-eslint/scope-manager": "8.4.0", + "@typescript-eslint/types": "8.4.0", + "@typescript-eslint/typescript-estree": "8.4.0" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0" diff --git a/packages/visitor-keys/CHANGELOG.md b/packages/visitor-keys/CHANGELOG.md index 500e0011eb0f..03bdb5cca40c 100644 --- a/packages/visitor-keys/CHANGELOG.md +++ b/packages/visitor-keys/CHANGELOG.md @@ -1,3 +1,9 @@ +## 8.4.0 (2024-09-02) + +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. + ## 8.3.0 (2024-08-26) This was a version bump only for visitor-keys to align it with other projects, there were no code changes. diff --git a/packages/visitor-keys/package.json b/packages/visitor-keys/package.json index 309d89ad3dd1..f438f5d59a23 100644 --- a/packages/visitor-keys/package.json +++ b/packages/visitor-keys/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/visitor-keys", - "version": "8.3.0", + "version": "8.4.0", "description": "Visitor keys used to help traverse the TypeScript-ESTree AST", "files": [ "dist", @@ -47,7 +47,7 @@ "typecheck": "tsc --noEmit" }, "dependencies": { - "@typescript-eslint/types": "8.3.0", + "@typescript-eslint/types": "8.4.0", "eslint-visitor-keys": "^3.4.3" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index 2d5bce2551ca..58d81d900b9a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5631,7 +5631,7 @@ __metadata: languageName: unknown linkType: soft -"@typescript-eslint/eslint-plugin@8.3.0, @typescript-eslint/eslint-plugin@workspace:*, @typescript-eslint/eslint-plugin@workspace:^, @typescript-eslint/eslint-plugin@workspace:packages/eslint-plugin": +"@typescript-eslint/eslint-plugin@8.4.0, @typescript-eslint/eslint-plugin@workspace:*, @typescript-eslint/eslint-plugin@workspace:^, @typescript-eslint/eslint-plugin@workspace:packages/eslint-plugin": version: 0.0.0-use.local resolution: "@typescript-eslint/eslint-plugin@workspace:packages/eslint-plugin" dependencies: @@ -5640,12 +5640,12 @@ __metadata: "@types/marked": ^5.0.2 "@types/mdast": ^4.0.3 "@types/natural-compare": "*" - "@typescript-eslint/rule-schema-to-typescript-types": 8.3.0 - "@typescript-eslint/rule-tester": 8.3.0 - "@typescript-eslint/scope-manager": 8.3.0 - "@typescript-eslint/type-utils": 8.3.0 - "@typescript-eslint/utils": 8.3.0 - "@typescript-eslint/visitor-keys": 8.3.0 + "@typescript-eslint/rule-schema-to-typescript-types": 8.4.0 + "@typescript-eslint/rule-tester": 8.4.0 + "@typescript-eslint/scope-manager": 8.4.0 + "@typescript-eslint/type-utils": 8.4.0 + "@typescript-eslint/utils": 8.4.0 + "@typescript-eslint/visitor-keys": 8.4.0 ajv: ^6.12.6 cross-env: ^7.0.3 cross-fetch: "*" @@ -5689,16 +5689,16 @@ __metadata: languageName: unknown linkType: soft -"@typescript-eslint/parser@8.3.0, @typescript-eslint/parser@workspace:*, @typescript-eslint/parser@workspace:packages/parser": +"@typescript-eslint/parser@8.4.0, @typescript-eslint/parser@workspace:*, @typescript-eslint/parser@workspace:packages/parser": version: 0.0.0-use.local resolution: "@typescript-eslint/parser@workspace:packages/parser" dependencies: "@jest/types": 29.6.3 "@types/glob": "*" - "@typescript-eslint/scope-manager": 8.3.0 - "@typescript-eslint/types": 8.3.0 - "@typescript-eslint/typescript-estree": 8.3.0 - "@typescript-eslint/visitor-keys": 8.3.0 + "@typescript-eslint/scope-manager": 8.4.0 + "@typescript-eslint/types": 8.4.0 + "@typescript-eslint/typescript-estree": 8.4.0 + "@typescript-eslint/visitor-keys": 8.4.0 debug: ^4.3.4 downlevel-dts: "*" glob: "*" @@ -5714,28 +5714,28 @@ __metadata: languageName: unknown linkType: soft -"@typescript-eslint/rule-schema-to-typescript-types@8.3.0, @typescript-eslint/rule-schema-to-typescript-types@workspace:*, @typescript-eslint/rule-schema-to-typescript-types@workspace:packages/rule-schema-to-typescript-types": +"@typescript-eslint/rule-schema-to-typescript-types@8.4.0, @typescript-eslint/rule-schema-to-typescript-types@workspace:*, @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: "@jest/types": 29.6.3 - "@typescript-eslint/type-utils": 8.3.0 - "@typescript-eslint/utils": 8.3.0 + "@typescript-eslint/type-utils": 8.4.0 + "@typescript-eslint/utils": 8.4.0 natural-compare: ^1.4.0 prettier: ^3.2.5 languageName: unknown linkType: soft -"@typescript-eslint/rule-tester@8.3.0, @typescript-eslint/rule-tester@workspace:*, @typescript-eslint/rule-tester@workspace:packages/rule-tester": +"@typescript-eslint/rule-tester@8.4.0, @typescript-eslint/rule-tester@workspace:*, @typescript-eslint/rule-tester@workspace:packages/rule-tester": version: 0.0.0-use.local resolution: "@typescript-eslint/rule-tester@workspace:packages/rule-tester" dependencies: "@jest/types": 29.6.3 "@types/json-stable-stringify-without-jsonify": ^1.0.2 "@types/lodash.merge": 4.6.9 - "@typescript-eslint/parser": 8.3.0 - "@typescript-eslint/typescript-estree": 8.3.0 - "@typescript-eslint/utils": 8.3.0 + "@typescript-eslint/parser": 8.4.0 + "@typescript-eslint/typescript-estree": 8.4.0 + "@typescript-eslint/utils": 8.4.0 ajv: ^6.12.6 chai: ^4.4.1 eslint-visitor-keys: ^4.0.0 @@ -5753,15 +5753,15 @@ __metadata: languageName: unknown linkType: soft -"@typescript-eslint/scope-manager@8.3.0, @typescript-eslint/scope-manager@workspace:*, @typescript-eslint/scope-manager@workspace:^, @typescript-eslint/scope-manager@workspace:packages/scope-manager": +"@typescript-eslint/scope-manager@8.4.0, @typescript-eslint/scope-manager@workspace:*, @typescript-eslint/scope-manager@workspace:^, @typescript-eslint/scope-manager@workspace:packages/scope-manager": version: 0.0.0-use.local resolution: "@typescript-eslint/scope-manager@workspace:packages/scope-manager" dependencies: "@jest/types": 29.6.3 "@types/glob": "*" - "@typescript-eslint/types": 8.3.0 - "@typescript-eslint/typescript-estree": 8.3.0 - "@typescript-eslint/visitor-keys": 8.3.0 + "@typescript-eslint/types": 8.4.0 + "@typescript-eslint/typescript-estree": 8.4.0 + "@typescript-eslint/visitor-keys": 8.4.0 glob: "*" jest-specific-snapshot: "*" make-dir: "*" @@ -5780,14 +5780,14 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/type-utils@8.3.0, @typescript-eslint/type-utils@workspace:*, @typescript-eslint/type-utils@workspace:packages/type-utils": +"@typescript-eslint/type-utils@8.4.0, @typescript-eslint/type-utils@workspace:*, @typescript-eslint/type-utils@workspace:packages/type-utils": version: 0.0.0-use.local resolution: "@typescript-eslint/type-utils@workspace:packages/type-utils" dependencies: "@jest/types": 29.6.3 - "@typescript-eslint/parser": 8.3.0 - "@typescript-eslint/typescript-estree": 8.3.0 - "@typescript-eslint/utils": 8.3.0 + "@typescript-eslint/parser": 8.4.0 + "@typescript-eslint/typescript-estree": 8.4.0 + "@typescript-eslint/utils": 8.4.0 ajv: ^6.12.6 debug: ^4.3.4 downlevel-dts: "*" @@ -5802,7 +5802,7 @@ __metadata: languageName: unknown linkType: soft -"@typescript-eslint/types@8.3.0, @typescript-eslint/types@^8.1.0, @typescript-eslint/types@workspace:*, @typescript-eslint/types@workspace:^, @typescript-eslint/types@workspace:packages/types": +"@typescript-eslint/types@8.4.0, @typescript-eslint/types@^8.1.0, @typescript-eslint/types@workspace:*, @typescript-eslint/types@workspace:^, @typescript-eslint/types@workspace:packages/types": version: 0.0.0-use.local resolution: "@typescript-eslint/types@workspace:packages/types" dependencies: @@ -5902,13 +5902,13 @@ __metadata: languageName: unknown linkType: soft -"@typescript-eslint/typescript-estree@8.3.0, @typescript-eslint/typescript-estree@workspace:*, @typescript-eslint/typescript-estree@workspace:^, @typescript-eslint/typescript-estree@workspace:packages/typescript-estree": +"@typescript-eslint/typescript-estree@8.4.0, @typescript-eslint/typescript-estree@workspace:*, @typescript-eslint/typescript-estree@workspace:^, @typescript-eslint/typescript-estree@workspace:packages/typescript-estree": version: 0.0.0-use.local resolution: "@typescript-eslint/typescript-estree@workspace:packages/typescript-estree" dependencies: "@jest/types": 29.6.3 - "@typescript-eslint/types": 8.3.0 - "@typescript-eslint/visitor-keys": 8.3.0 + "@typescript-eslint/types": 8.4.0 + "@typescript-eslint/visitor-keys": 8.4.0 debug: ^4.3.4 fast-glob: ^3.3.2 glob: "*" @@ -5945,14 +5945,14 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/utils@8.3.0, @typescript-eslint/utils@^8.1.0, @typescript-eslint/utils@workspace:*, @typescript-eslint/utils@workspace:^, @typescript-eslint/utils@workspace:packages/utils": +"@typescript-eslint/utils@8.4.0, @typescript-eslint/utils@^8.1.0, @typescript-eslint/utils@workspace:*, @typescript-eslint/utils@workspace:^, @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 - "@typescript-eslint/scope-manager": 8.3.0 - "@typescript-eslint/types": 8.3.0 - "@typescript-eslint/typescript-estree": 8.3.0 + "@typescript-eslint/scope-manager": 8.4.0 + "@typescript-eslint/types": 8.4.0 + "@typescript-eslint/typescript-estree": 8.4.0 downlevel-dts: "*" jest: 29.7.0 prettier: ^3.2.5 @@ -5981,13 +5981,13 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/visitor-keys@8.3.0, @typescript-eslint/visitor-keys@workspace:*, @typescript-eslint/visitor-keys@workspace:packages/visitor-keys": +"@typescript-eslint/visitor-keys@8.4.0, @typescript-eslint/visitor-keys@workspace:*, @typescript-eslint/visitor-keys@workspace:packages/visitor-keys": version: 0.0.0-use.local resolution: "@typescript-eslint/visitor-keys@workspace:packages/visitor-keys" dependencies: "@jest/types": 29.6.3 "@types/eslint-visitor-keys": "*" - "@typescript-eslint/types": 8.3.0 + "@typescript-eslint/types": 8.4.0 downlevel-dts: "*" eslint-visitor-keys: ^3.4.3 jest: 29.7.0 @@ -19482,9 +19482,9 @@ __metadata: resolution: "typescript-eslint@workspace:packages/typescript-eslint" dependencies: "@jest/types": 29.6.3 - "@typescript-eslint/eslint-plugin": 8.3.0 - "@typescript-eslint/parser": 8.3.0 - "@typescript-eslint/utils": 8.3.0 + "@typescript-eslint/eslint-plugin": 8.4.0 + "@typescript-eslint/parser": 8.4.0 + "@typescript-eslint/utils": 8.4.0 downlevel-dts: "*" jest: 29.7.0 prettier: ^3.2.5