Skip to content

Commit 90576fa

Browse files
feat(typescript-eslint): add JSDoc comments on generated configs (typescript-eslint#9672)
* feat(typescript-eslint): add JSDoc comments on generated configs * Also add to index.ts
1 parent fe56157 commit 90576fa

15 files changed

+167
-12
lines changed

packages/typescript-eslint/src/configs/all.ts

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint';
1010
import baseConfig from './base';
1111
import eslintRecommendedConfig from './eslint-recommended';
1212

13+
/**
14+
* Enables each the rules provided as a part of typescript-eslint. Note that many rules are not applicable in all codebases, or are meant to be configured.
15+
* @see {@link https://typescript-eslint.io/users/configs#all}
16+
*/
1317
export default (
1418
plugin: FlatConfig.Plugin,
1519
parser: FlatConfig.Parser,

packages/typescript-eslint/src/configs/base.ts

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint';
22

3+
/**
4+
* A minimal ruleset that sets only the required parser and plugin options needed to run typescript-eslint.
5+
* We don't recommend using this directly; instead, extend from an earlier recommended rule.
6+
* @see {@link https://typescript-eslint.io/users/configs#base}
7+
*/
38
export default (
49
plugin: FlatConfig.Plugin,
510
parser: FlatConfig.Parser,

packages/typescript-eslint/src/configs/disable-type-checked.ts

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77

88
import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint';
99

10+
/**
11+
* A utility ruleset that will disable type-aware linting and all type-aware rules available in our project.
12+
* @see {@link https://typescript-eslint.io/users/configs#disable-type-checked}
13+
*/
1014
export default (
1115
_plugin: FlatConfig.Plugin,
1216
_parser: FlatConfig.Parser,

packages/typescript-eslint/src/configs/eslint-recommended.ts

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint';
55
* This is a compatibility ruleset that:
66
* - disables rules from eslint:recommended which are already handled by TypeScript.
77
* - enables rules that make sense due to TS's typechecking / transpilation.
8+
* @see {@link https://typescript-eslint.io/users/configs/#eslint-recommended}
89
*/
910
export default (
1011
_plugin: FlatConfig.Plugin,

packages/typescript-eslint/src/configs/recommended-type-checked-only.ts

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint';
1010
import baseConfig from './base';
1111
import eslintRecommendedConfig from './eslint-recommended';
1212

13+
/**
14+
* A version of `recommended` that only contains type-checked rules and disables of any corresponding core ESLint rules.
15+
* @see {@link https://typescript-eslint.io/users/configs#recommended-type-checked-only}
16+
*/
1317
export default (
1418
plugin: FlatConfig.Plugin,
1519
parser: FlatConfig.Parser,

packages/typescript-eslint/src/configs/recommended-type-checked.ts

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint';
1010
import baseConfig from './base';
1111
import eslintRecommendedConfig from './eslint-recommended';
1212

13+
/**
14+
* Contains all of `recommended` along with additional recommended rules that require type information.
15+
* @see {@link https://typescript-eslint.io/users/configs#recommended-type-checked}
16+
*/
1317
export default (
1418
plugin: FlatConfig.Plugin,
1519
parser: FlatConfig.Parser,

packages/typescript-eslint/src/configs/recommended.ts

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint';
1010
import baseConfig from './base';
1111
import eslintRecommendedConfig from './eslint-recommended';
1212

13+
/**
14+
* Recommended rules for code correctness that you can drop in without additional configuration.
15+
* @see {@link https://typescript-eslint.io/users/configs#recommended}
16+
*/
1317
export default (
1418
plugin: FlatConfig.Plugin,
1519
parser: FlatConfig.Parser,

packages/typescript-eslint/src/configs/strict-type-checked-only.ts

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint';
1010
import baseConfig from './base';
1111
import eslintRecommendedConfig from './eslint-recommended';
1212

13+
/**
14+
* A version of `strict` that only contains type-checked rules and disables of any corresponding core ESLint rules.
15+
* @see {@link https://typescript-eslint.io/users/configs#strict-type-checked-only}
16+
*/
1317
export default (
1418
plugin: FlatConfig.Plugin,
1519
parser: FlatConfig.Parser,

packages/typescript-eslint/src/configs/strict-type-checked.ts

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint';
1010
import baseConfig from './base';
1111
import eslintRecommendedConfig from './eslint-recommended';
1212

13+
/**
14+
* Contains all of `recommended`, `recommended-type-checked`, and `strict`, along with additional strict rules that require type information.
15+
* @see {@link https://typescript-eslint.io/users/configs#strict-type-checked}
16+
*/
1317
export default (
1418
plugin: FlatConfig.Plugin,
1519
parser: FlatConfig.Parser,

packages/typescript-eslint/src/configs/strict.ts

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint';
1010
import baseConfig from './base';
1111
import eslintRecommendedConfig from './eslint-recommended';
1212

13+
/**
14+
* Contains all of `recommended`, as well as additional strict rules that can also catch bugs.
15+
* @see {@link https://typescript-eslint.io/users/configs#strict}
16+
*/
1317
export default (
1418
plugin: FlatConfig.Plugin,
1519
parser: FlatConfig.Parser,

packages/typescript-eslint/src/configs/stylistic-type-checked-only.ts

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint';
1010
import baseConfig from './base';
1111
import eslintRecommendedConfig from './eslint-recommended';
1212

13+
/**
14+
* A version of `stylistic` that only contains type-checked rules and disables of any corresponding core ESLint rules.
15+
* @see {@link https://typescript-eslint.io/users/configs#stylistic-type-checked-only}
16+
*/
1317
export default (
1418
plugin: FlatConfig.Plugin,
1519
parser: FlatConfig.Parser,

packages/typescript-eslint/src/configs/stylistic-type-checked.ts

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint';
1010
import baseConfig from './base';
1111
import eslintRecommendedConfig from './eslint-recommended';
1212

13+
/**
14+
* Contains all of `stylistic`, along with additional stylistic rules that require type information.
15+
* @see {@link https://typescript-eslint.io/users/configs#stylistic-type-checked}
16+
*/
1317
export default (
1418
plugin: FlatConfig.Plugin,
1519
parser: FlatConfig.Parser,

packages/typescript-eslint/src/configs/stylistic.ts

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint';
1010
import baseConfig from './base';
1111
import eslintRecommendedConfig from './eslint-recommended';
1212

13+
/**
14+
* Rules considered to be best practice for modern TypeScript codebases, but that do not impact program logic.
15+
* @see {@link https://typescript-eslint.io/users/configs#stylistic}
16+
*/
1317
export default (
1418
plugin: FlatConfig.Plugin,
1519
parser: FlatConfig.Parser,

packages/typescript-eslint/src/index.ts

+67
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,85 @@ const plugin: TSESLint.FlatConfig.Plugin = pluginBase as Omit<
5353
>;
5454

5555
const configs = {
56+
/**
57+
* Enables each the rules provided as a part of typescript-eslint. Note that many rules are not applicable in all codebases, or are meant to be configured.
58+
* @see {@link https://typescript-eslint.io/users/configs#all}
59+
*/
5660
all: allConfig(plugin, parser),
61+
62+
/**
63+
* A minimal ruleset that sets only the required parser and plugin options needed to run typescript-eslint.
64+
* We don't recommend using this directly; instead, extend from an earlier recommended rule.
65+
* @see {@link https://typescript-eslint.io/users/configs#base}
66+
*/
5767
base: baseConfig(plugin, parser),
68+
69+
/**
70+
* A utility ruleset that will disable type-aware linting and all type-aware rules available in our project.
71+
* @see {@link https://typescript-eslint.io/users/configs#disable-type-checked}
72+
*/
5873
disableTypeChecked: disableTypeCheckedConfig(plugin, parser),
74+
75+
/**
76+
* This is a compatibility ruleset that:
77+
* - disables rules from eslint:recommended which are already handled by TypeScript.
78+
* - enables rules that make sense due to TS's typechecking / transpilation.
79+
* @see {@link https://typescript-eslint.io/users/configs/#eslint-recommended}
80+
*/
5981
eslintRecommended: eslintRecommendedConfig(plugin, parser),
82+
83+
/**
84+
* Recommended rules for code correctness that you can drop in without additional configuration.
85+
* @see {@link https://typescript-eslint.io/users/configs#recommended}
86+
*/
6087
recommended: recommendedConfig(plugin, parser),
88+
89+
/**
90+
* Contains all of `recommended` along with additional recommended rules that require type information.
91+
* @see {@link https://typescript-eslint.io/users/configs#recommended-type-checked}
92+
*/
6193
recommendedTypeChecked: recommendedTypeCheckedConfig(plugin, parser),
94+
95+
/**
96+
* A version of `recommended` that only contains type-checked rules and disables of any corresponding core ESLint rules.
97+
* @see {@link https://typescript-eslint.io/users/configs#recommended-type-checked-only}
98+
*/
6299
recommendedTypeCheckedOnly: recommendedTypeCheckedOnlyConfig(plugin, parser),
100+
101+
/**
102+
* Contains all of `recommended`, as well as additional strict rules that can also catch bugs.
103+
* @see {@link https://typescript-eslint.io/users/configs#strict}
104+
*/
63105
strict: strictConfig(plugin, parser),
106+
107+
/**
108+
* Contains all of `recommended`, `recommended-type-checked`, and `strict`, along with additional strict rules that require type information.
109+
* @see {@link https://typescript-eslint.io/users/configs#strict-type-checked}
110+
*/
64111
strictTypeChecked: strictTypeCheckedConfig(plugin, parser),
112+
113+
/**
114+
* A version of `strict` that only contains type-checked rules and disables of any corresponding core ESLint rules.
115+
* @see {@link https://typescript-eslint.io/users/configs#strict-type-checked-only}
116+
*/
65117
strictTypeCheckedOnly: strictTypeCheckedOnlyConfig(plugin, parser),
118+
119+
/**
120+
* Rules considered to be best practice for modern TypeScript codebases, but that do not impact program logic.
121+
* @see {@link https://typescript-eslint.io/users/configs#stylistic}
122+
*/
66123
stylistic: stylisticConfig(plugin, parser),
124+
125+
/**
126+
* Contains all of `stylistic`, along with additional stylistic rules that require type information.
127+
* @see {@link https://typescript-eslint.io/users/configs#stylistic-type-checked}
128+
*/
67129
stylisticTypeChecked: stylisticTypeCheckedConfig(plugin, parser),
130+
131+
/**
132+
* A version of `stylistic` that only contains type-checked rules and disables of any corresponding core ESLint rules.
133+
* @see {@link https://typescript-eslint.io/users/configs#stylistic-type-checked-only}
134+
*/
68135
stylisticTypeCheckedOnly: stylisticTypeCheckedOnlyConfig(plugin, parser),
69136
};
70137

0 commit comments

Comments
 (0)