diff --git a/docs/linting/PRESETS.md b/docs/linting/PRESETS.md new file mode 100644 index 00000000000..cb5f95f0d27 --- /dev/null +++ b/docs/linting/PRESETS.md @@ -0,0 +1,54 @@ +--- +id: presets +sidebar_label: Presets +title: Presets +--- + +`@typescript-eslint/eslint-plugin` includes three rulesets you can extend from to pull in the recommended starting rules. + +### `plugin:@typescript-eslint/recommended` + +Recommended rules for code correctness that you can drop in without additional configuration. +We strongly recommend all TypeScript projects extend from this preset. + +This preset is considered "stable": rule additions and removals will only be done in major version bumps. + +```json +{ + "extends": ["plugin:@typescript-eslint/recommended"] +} +``` + +### `plugin:@typescript-eslint/recommended-requiring-type-checking` + +```json +{ + "extends": [ + "plugin:@typescript-eslint/recommended", + "plugin:@typescript-eslint/recommended-requiring-type-checking" + ] +} +``` + +Additional recommended rules that require type information. +We recommend all TypeScript projects extend from this preset, with the caveat that rules using type information take longer to run. +See [Linting with Type Information](/docs/linting/type-linting) for more details. + +This preset is considered "stable": rule additions and removals will only be done in major version bumps. + +### `plugin:@typescript-eslint/strict` + +```json +{ + "extends": [ + "plugin:@typescript-eslint/recommended", + "plugin:@typescript-eslint/recommended-requiring-type-checking", + "plugin:@typescript-eslint/strict" + ] +} +``` + +Additional strict rules that can also catch bugs but are more opinionated than recommended rules. +If you are an experienced TypeScript user, you may find benefit from extending from this preset. + +This preset is considered "unstable": rule additions and removals may be done in minor or even patch version bumps. diff --git a/packages/eslint-plugin/docs/rules/README.md b/packages/eslint-plugin/docs/rules/README.md index 890eaa4ac43..34404fc218c 100644 --- a/packages/eslint-plugin/docs/rules/README.md +++ b/packages/eslint-plugin/docs/rules/README.md @@ -6,12 +6,8 @@ pagination_prev: null slug: / --- -`@typescript-eslint/eslint-plugin` comes with two rulesets you can extend from to pull in the recommended starting rules: - -- `'plugin:@typescript-eslint/recommended'`: recommended rules for code correctness that you can drop in without additional configuration. - See [Linting](https://typescript-eslint.io/docs/linting) for more details. -- `'plugin:@typescript-eslint/recommended-requiring-type-checking'` additional recommended rules that require type information. - See [Linting](https://typescript-eslint.io/docs/linting/type-linting) for more details. +`@typescript-eslint/eslint-plugin` includes over 100 rules that detect best practice violations, bugs, and/or stylistic issues specifically for TypeScript code. +See [Presets](/docs/linting/presets) for how to enable recommended rules using presets. ## Supported Rules diff --git a/packages/website/sidebars/sidebar.base.js b/packages/website/sidebars/sidebar.base.js index 5d50b266eef..942fd98e405 100644 --- a/packages/website/sidebars/sidebar.base.js +++ b/packages/website/sidebars/sidebar.base.js @@ -8,6 +8,7 @@ module.exports = { items: [ 'linting/linting', 'linting/type-linting', + 'linting/presets', 'linting/monorepo', 'linting/troubleshooting', 'linting/tslint',