Skip to content

feat(typescript-eslint): add JSDoc comments on generated configs #9672

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/typescript-eslint/src/configs/all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint';
import baseConfig from './base';
import eslintRecommendedConfig from './eslint-recommended';

/**
* 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.
* @see {@link https://typescript-eslint.io/users/configs#all}
*/
export default (
plugin: FlatConfig.Plugin,
parser: FlatConfig.Parser,
Expand Down
5 changes: 5 additions & 0 deletions packages/typescript-eslint/src/configs/base.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint';

/**
* A minimal ruleset that sets only the required parser and plugin options needed to run typescript-eslint.
* We don't recommend using this directly; instead, extend from an earlier recommended rule.
* @see {@link https://typescript-eslint.io/users/configs#base}
*/
export default (
plugin: FlatConfig.Plugin,
parser: FlatConfig.Parser,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

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

/**
* A utility ruleset that will disable type-aware linting and all type-aware rules available in our project.
* @see {@link https://typescript-eslint.io/users/configs#disable-type-checked}
*/
export default (
_plugin: FlatConfig.Plugin,
_parser: FlatConfig.Parser,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint';
* This is a compatibility ruleset that:
* - disables rules from eslint:recommended which are already handled by TypeScript.
* - enables rules that make sense due to TS's typechecking / transpilation.
* @see {@link https://typescript-eslint.io/users/configs/#eslint-recommended}
*/
export default (
_plugin: FlatConfig.Plugin,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint';
import baseConfig from './base';
import eslintRecommendedConfig from './eslint-recommended';

/**
* A version of `recommended` that only contains type-checked rules and disables of any corresponding core ESLint rules.
* @see {@link https://typescript-eslint.io/users/configs#recommended-type-checked-only}
*/
export default (
plugin: FlatConfig.Plugin,
parser: FlatConfig.Parser,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint';
import baseConfig from './base';
import eslintRecommendedConfig from './eslint-recommended';

/**
* Contains all of `recommended` along with additional recommended rules that require type information.
* @see {@link https://typescript-eslint.io/users/configs#recommended-type-checked}
*/
export default (
plugin: FlatConfig.Plugin,
parser: FlatConfig.Parser,
Expand Down
4 changes: 4 additions & 0 deletions packages/typescript-eslint/src/configs/recommended.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint';
import baseConfig from './base';
import eslintRecommendedConfig from './eslint-recommended';

/**
* Recommended rules for code correctness that you can drop in without additional configuration.
* @see {@link https://typescript-eslint.io/users/configs#recommended}
*/
export default (
plugin: FlatConfig.Plugin,
parser: FlatConfig.Parser,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint';
import baseConfig from './base';
import eslintRecommendedConfig from './eslint-recommended';

/**
* A version of `strict` that only contains type-checked rules and disables of any corresponding core ESLint rules.
* @see {@link https://typescript-eslint.io/users/configs#strict-type-checked-only}
*/
export default (
plugin: FlatConfig.Plugin,
parser: FlatConfig.Parser,
Expand Down
4 changes: 4 additions & 0 deletions packages/typescript-eslint/src/configs/strict-type-checked.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint';
import baseConfig from './base';
import eslintRecommendedConfig from './eslint-recommended';

/**
* Contains all of `recommended`, `recommended-type-checked`, and `strict`, along with additional strict rules that require type information.
* @see {@link https://typescript-eslint.io/users/configs#strict-type-checked}
*/
export default (
plugin: FlatConfig.Plugin,
parser: FlatConfig.Parser,
Expand Down
4 changes: 4 additions & 0 deletions packages/typescript-eslint/src/configs/strict.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint';
import baseConfig from './base';
import eslintRecommendedConfig from './eslint-recommended';

/**
* Contains all of `recommended`, as well as additional strict rules that can also catch bugs.
* @see {@link https://typescript-eslint.io/users/configs#strict}
*/
export default (
plugin: FlatConfig.Plugin,
parser: FlatConfig.Parser,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint';
import baseConfig from './base';
import eslintRecommendedConfig from './eslint-recommended';

/**
* A version of `stylistic` that only contains type-checked rules and disables of any corresponding core ESLint rules.
* @see {@link https://typescript-eslint.io/users/configs#stylistic-type-checked-only}
*/
export default (
plugin: FlatConfig.Plugin,
parser: FlatConfig.Parser,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint';
import baseConfig from './base';
import eslintRecommendedConfig from './eslint-recommended';

/**
* Contains all of `stylistic`, along with additional stylistic rules that require type information.
* @see {@link https://typescript-eslint.io/users/configs#stylistic-type-checked}
*/
export default (
plugin: FlatConfig.Plugin,
parser: FlatConfig.Parser,
Expand Down
4 changes: 4 additions & 0 deletions packages/typescript-eslint/src/configs/stylistic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint';
import baseConfig from './base';
import eslintRecommendedConfig from './eslint-recommended';

/**
* Rules considered to be best practice for modern TypeScript codebases, but that do not impact program logic.
* @see {@link https://typescript-eslint.io/users/configs#stylistic}
*/
export default (
plugin: FlatConfig.Plugin,
parser: FlatConfig.Parser,
Expand Down
67 changes: 67 additions & 0 deletions packages/typescript-eslint/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,85 @@ const plugin: TSESLint.FlatConfig.Plugin = pluginBase as Omit<
>;

const configs = {
/**
* 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.
* @see {@link https://typescript-eslint.io/users/configs#all}
*/
all: allConfig(plugin, parser),

/**
* A minimal ruleset that sets only the required parser and plugin options needed to run typescript-eslint.
* We don't recommend using this directly; instead, extend from an earlier recommended rule.
* @see {@link https://typescript-eslint.io/users/configs#base}
*/
base: baseConfig(plugin, parser),

/**
* A utility ruleset that will disable type-aware linting and all type-aware rules available in our project.
* @see {@link https://typescript-eslint.io/users/configs#disable-type-checked}
*/
disableTypeChecked: disableTypeCheckedConfig(plugin, parser),

/**
* This is a compatibility ruleset that:
* - disables rules from eslint:recommended which are already handled by TypeScript.
* - enables rules that make sense due to TS's typechecking / transpilation.
* @see {@link https://typescript-eslint.io/users/configs/#eslint-recommended}
*/
eslintRecommended: eslintRecommendedConfig(plugin, parser),

/**
* Recommended rules for code correctness that you can drop in without additional configuration.
* @see {@link https://typescript-eslint.io/users/configs#recommended}
*/
recommended: recommendedConfig(plugin, parser),

/**
* Contains all of `recommended` along with additional recommended rules that require type information.
* @see {@link https://typescript-eslint.io/users/configs#recommended-type-checked}
*/
recommendedTypeChecked: recommendedTypeCheckedConfig(plugin, parser),

/**
* A version of `recommended` that only contains type-checked rules and disables of any corresponding core ESLint rules.
* @see {@link https://typescript-eslint.io/users/configs#recommended-type-checked-only}
*/
recommendedTypeCheckedOnly: recommendedTypeCheckedOnlyConfig(plugin, parser),

/**
* Contains all of `recommended`, as well as additional strict rules that can also catch bugs.
* @see {@link https://typescript-eslint.io/users/configs#strict}
*/
strict: strictConfig(plugin, parser),

/**
* Contains all of `recommended`, `recommended-type-checked`, and `strict`, along with additional strict rules that require type information.
* @see {@link https://typescript-eslint.io/users/configs#strict-type-checked}
*/
strictTypeChecked: strictTypeCheckedConfig(plugin, parser),

/**
* A version of `strict` that only contains type-checked rules and disables of any corresponding core ESLint rules.
* @see {@link https://typescript-eslint.io/users/configs#strict-type-checked-only}
*/
strictTypeCheckedOnly: strictTypeCheckedOnlyConfig(plugin, parser),

/**
* Rules considered to be best practice for modern TypeScript codebases, but that do not impact program logic.
* @see {@link https://typescript-eslint.io/users/configs#stylistic}
*/
stylistic: stylisticConfig(plugin, parser),

/**
* Contains all of `stylistic`, along with additional stylistic rules that require type information.
* @see {@link https://typescript-eslint.io/users/configs#stylistic-type-checked}
*/
stylisticTypeChecked: stylisticTypeCheckedConfig(plugin, parser),

/**
* A version of `stylistic` that only contains type-checked rules and disables of any corresponding core ESLint rules.
* @see {@link https://typescript-eslint.io/users/configs#stylistic-type-checked-only}
*/
stylisticTypeCheckedOnly: stylisticTypeCheckedOnlyConfig(plugin, parser),
};

Expand Down
Loading
Loading
pFad - Phonifier reborn

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

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


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy