Skip to content

Commit

Permalink
docs(eslint-plugin): [sort-type-constituents] deprecate the rule (#9253)
Browse files Browse the repository at this point in the history
* docs(eslint-plugin): [sort-type-constituents] deprecate the rule

* fix: regenerate configs
  • Loading branch information
JoshuaKGoldberg committed Jun 5, 2024
1 parent 588bd53 commit c6e9719
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
15 changes: 6 additions & 9 deletions packages/eslint-plugin/docs/rules/sort-type-constituents.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ import TabItem from '@theme/TabItem';
>
> See **https://typescript-eslint.io/rules/sort-type-constituents** for documentation.
:::danger Deprecated
This rule has been deprecated in favor of the [`perfectionist/sort-intersection-types`](https://eslint-plugin-perfectionist.azat.io/rules/sort-intersection-types) and [`perfectionist/sort-union-types`](https://eslint-plugin-perfectionist.azat.io/rules/sort-union-types) rules.

See [Docs: Deprecate sort-type-constituents in favor of eslint-plugin-perfectionist](https://github.com/typescript-eslint/typescript-eslint/issues/8915) and [eslint-plugin: Feature freeze naming and sorting stylistic rules](https://github.com/typescript-eslint/typescript-eslint/issues/8792) for more information.
:::

Sorting union (`|`) and intersection (`&`) types can help:

- keep your codebase standardized
Expand All @@ -19,15 +25,6 @@ This rule reports on any types that aren't sorted alphabetically.

> Types are sorted case-insensitively and treating numbers like a human would, falling back to character code sorting in case of ties.
:::note
This rule is _feature frozen_: it will no longer receive new features such as new options.
It still will accept bug and documentation fixes for its existing area of features.

Stylistic rules that enforce naming and/or sorting conventions tend to grow incomprehensibly complex as increasingly obscure features are requested.
This rule has reached the limit of what is reasonable for the typescript-eslint project to maintain.
See [eslint-plugin: Feature freeze naming and sorting stylistic rules](https://github.com/typescript-eslint/typescript-eslint/issues/8792) for more information.
:::

## Examples

<Tabs>
Expand Down
1 change: 0 additions & 1 deletion packages/eslint-plugin/src/configs/all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ export = {
'@typescript-eslint/restrict-template-expressions': 'error',
'no-return-await': 'off',
'@typescript-eslint/return-await': 'error',
'@typescript-eslint/sort-type-constituents': 'error',
'@typescript-eslint/strict-boolean-expressions': 'error',
'@typescript-eslint/switch-exhaustiveness-check': 'error',
'@typescript-eslint/triple-slash-reference': 'error',
Expand Down
5 changes: 5 additions & 0 deletions packages/eslint-plugin/src/rules/sort-type-constituents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ export type MessageIds = 'notSorted' | 'notSortedNamed' | 'suggestFix';
export default createRule<Options, MessageIds>({
name: 'sort-type-constituents',
meta: {
deprecated: true,
replacedBy: [
'perfectionist/sort-intersection-types',
'perfectionist/sort-union-types',
],
type: 'suggestion',
docs: {
description:
Expand Down
1 change: 0 additions & 1 deletion packages/typescript-eslint/src/configs/all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ export default (
'@typescript-eslint/restrict-template-expressions': 'error',
'no-return-await': 'off',
'@typescript-eslint/return-await': 'error',
'@typescript-eslint/sort-type-constituents': 'error',
'@typescript-eslint/strict-boolean-expressions': 'error',
'@typescript-eslint/switch-exhaustiveness-check': 'error',
'@typescript-eslint/triple-slash-reference': 'error',
Expand Down

0 comments on commit c6e9719

Please sign in to comment.