From bdd8c45c99585ff817de92d18b12615af39a75b6 Mon Sep 17 00:00:00 2001 From: "hugo.prunaux" Date: Tue, 10 Mar 2026 19:49:26 +0100 Subject: [PATCH 01/10] =?UTF-8?q?docs:=20replace=20`=E2=80=99`=20with=20`'?= =?UTF-8?q?`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/content/rules/sort-classes.mdx | 2 +- docs/content/rules/sort-decorators.mdx | 2 +- docs/content/rules/sort-exports.mdx | 2 +- docs/content/rules/sort-heritage-clauses.mdx | 2 +- docs/content/rules/sort-imports.mdx | 4 ++-- docs/content/rules/sort-interfaces.mdx | 2 +- docs/content/rules/sort-intersection-types.mdx | 4 ++-- docs/content/rules/sort-modules.mdx | 2 +- docs/content/rules/sort-named-exports.mdx | 2 +- docs/content/rules/sort-named-imports.mdx | 2 +- docs/content/rules/sort-object-types.mdx | 2 +- docs/content/rules/sort-objects.mdx | 4 ++-- docs/content/rules/sort-union-types.mdx | 4 ++-- 13 files changed, 17 insertions(+), 17 deletions(-) diff --git a/docs/content/rules/sort-classes.mdx b/docs/content/rules/sort-classes.mdx index e090652cb..d25be52e8 100644 --- a/docs/content/rules/sort-classes.mdx +++ b/docs/content/rules/sort-classes.mdx @@ -553,7 +553,7 @@ The `private` modifier will currently match any of the following: Elements that are not `protected` nor `private` will be matched with the `public` modifier, even if the keyword is not present. ##### The `unknown` group -Members that don’t fit into any group specified in the `groups` option will be placed in the `unknown` group. If the `unknown` group is not specified in the `groups` option, +Members that don't fit into any group specified in the `groups` option will be placed in the `unknown` group. If the `unknown` group is not specified in the `groups` option, the members will remain in their original order. ##### Behavior when multiple groups match an element diff --git a/docs/content/rules/sort-decorators.mdx b/docs/content/rules/sort-decorators.mdx index e6367deb9..594f7b264 100644 --- a/docs/content/rules/sort-decorators.mdx +++ b/docs/content/rules/sort-decorators.mdx @@ -319,7 +319,7 @@ Specifies a list of decorator groups for sorting. Predefined groups: -- `'unknown'` — Decorators that don’t fit into any group specified in the `groups` option. +- `'unknown'` — Decorators that don't fit into any group specified in the `groups` option. If the `unknown` group is not specified in the `groups` option, it will automatically be added to the end of the list. diff --git a/docs/content/rules/sort-exports.mdx b/docs/content/rules/sort-exports.mdx index 5120c7bd4..35a1df740 100644 --- a/docs/content/rules/sort-exports.mdx +++ b/docs/content/rules/sort-exports.mdx @@ -302,7 +302,7 @@ Example: `type-export`. ##### The `unknown` group -Members that don’t fit into any group specified in the `groups` option will be placed in the `unknown` group. If the `unknown` group is not specified in the `groups` option, +Members that don't fit into any group specified in the `groups` option will be placed in the `unknown` group. If the `unknown` group is not specified in the `groups` option, it will automatically be added to the end of the list. ##### Group with overridden settings diff --git a/docs/content/rules/sort-heritage-clauses.mdx b/docs/content/rules/sort-heritage-clauses.mdx index 1978a7b71..e6566c072 100644 --- a/docs/content/rules/sort-heritage-clauses.mdx +++ b/docs/content/rules/sort-heritage-clauses.mdx @@ -308,7 +308,7 @@ Specifies a list of heritage clause groups for sorting. Predefined groups: -- `'unknown'` — Heritage Clauses that don’t fit into any group specified in the `groups` option. +- `'unknown'` — Heritage Clauses that don't fit into any group specified in the `groups` option. If the `unknown` group is not specified in the `groups` option, it will automatically be added to the end of the list. diff --git a/docs/content/rules/sort-imports.mdx b/docs/content/rules/sort-imports.mdx index 52c8ee9ed..cd4486390 100644 --- a/docs/content/rules/sort-imports.mdx +++ b/docs/content/rules/sort-imports.mdx @@ -444,7 +444,7 @@ The list of modifiers is sorted from most to least important: ##### The `unknown` group -Members that don’t fit into any group specified in the `groups` option will be placed in the `unknown` group. If the `unknown` group is not specified in the `groups` option, +Members that don't fit into any group specified in the `groups` option will be placed in the `unknown` group. If the `unknown` group is not specified in the `groups` option, the members will remain in their original order. ##### Behavior when multiple groups match an element @@ -713,7 +713,7 @@ you must write a custom group definition that does the same as what the predefin default: `'node'` -Specifies which environment’s built-in modules should be recognized. If you are using [Bun](https://bun.sh), change the value to `'bun'`. +Specifies which environment's built-in modules should be recognized. If you are using [Bun](https://bun.sh), change the value to `'bun'`. ### useExperimentalDependencyDetection diff --git a/docs/content/rules/sort-interfaces.mdx b/docs/content/rules/sort-interfaces.mdx index 5b337501b..13830188a 100644 --- a/docs/content/rules/sort-interfaces.mdx +++ b/docs/content/rules/sort-interfaces.mdx @@ -546,7 +546,7 @@ Elements that are not `optional` will be matched with the `required` modifier, e ##### The `unknown` group -Members that don’t fit into any group specified in the `groups` option will be placed in the `unknown` group. If the `unknown` group is not specified in the `groups` option, +Members that don't fit into any group specified in the `groups` option will be placed in the `unknown` group. If the `unknown` group is not specified in the `groups` option, it will automatically be added to the end of the list. ##### Behavior when multiple groups match an element diff --git a/docs/content/rules/sort-intersection-types.mdx b/docs/content/rules/sort-intersection-types.mdx index 5eea04a7d..66a288902 100644 --- a/docs/content/rules/sort-intersection-types.mdx +++ b/docs/content/rules/sort-intersection-types.mdx @@ -339,11 +339,11 @@ Predefined groups are characterized by a single selector. - `'tuple`' — Tuple types. - `'union`' — Union types. - `'nullish`' — Nullish types (`null` or `undefined`). -- `'unknown`' — Types that don’t fit into any group specified in the `groups` option. +- `'unknown`' — Types that don't fit into any group specified in the `groups` option. ##### The `unknown` group -Members that don’t fit into any group specified in the `groups` option will be placed in the `unknown` group. If the `unknown` group is not specified in the `groups` option, +Members that don't fit into any group specified in the `groups` option will be placed in the `unknown` group. If the `unknown` group is not specified in the `groups` option, it will automatically be added to the end of the list. #### Example 1 diff --git a/docs/content/rules/sort-modules.mdx b/docs/content/rules/sort-modules.mdx index 79f4731af..be0771391 100644 --- a/docs/content/rules/sort-modules.mdx +++ b/docs/content/rules/sort-modules.mdx @@ -440,7 +440,7 @@ Predefined groups are characterized by a single selector and potentially multipl ##### The `unknown` group -Members that don’t fit into any group specified in the `groups` option will be placed in the `unknown` group. If the `unknown` group is not specified in the `groups` option, +Members that don't fit into any group specified in the `groups` option will be placed in the `unknown` group. If the `unknown` group is not specified in the `groups` option, the members will remain in their original order. ##### Behavior when multiple groups match an element diff --git a/docs/content/rules/sort-named-exports.mdx b/docs/content/rules/sort-named-exports.mdx index 284ee8599..a5e7c5988 100644 --- a/docs/content/rules/sort-named-exports.mdx +++ b/docs/content/rules/sort-named-exports.mdx @@ -381,7 +381,7 @@ Example: `type-export`. ##### The `unknown` group -Members that don’t fit into any group specified in the `groups` option will be placed in the `unknown` group. If the `unknown` group is not specified in the `groups` option, +Members that don't fit into any group specified in the `groups` option will be placed in the `unknown` group. If the `unknown` group is not specified in the `groups` option, it will automatically be added to the end of the list. ##### Group with overridden settings diff --git a/docs/content/rules/sort-named-imports.mdx b/docs/content/rules/sort-named-imports.mdx index cae75cb91..a40dfc332 100644 --- a/docs/content/rules/sort-named-imports.mdx +++ b/docs/content/rules/sort-named-imports.mdx @@ -380,7 +380,7 @@ Example: `type-import`. ##### The `unknown` group -Members that don’t fit into any group specified in the `groups` option will be placed in the `unknown` group. If the `unknown` group is not specified in the `groups` option, +Members that don't fit into any group specified in the `groups` option will be placed in the `unknown` group. If the `unknown` group is not specified in the `groups` option, it will automatically be added to the end of the list. ##### Group with overridden settings diff --git a/docs/content/rules/sort-object-types.mdx b/docs/content/rules/sort-object-types.mdx index 1bdebe0b7..d765f0ea6 100644 --- a/docs/content/rules/sort-object-types.mdx +++ b/docs/content/rules/sort-object-types.mdx @@ -514,7 +514,7 @@ Elements that are not `optional` will be matched with the `required` modifier, e ##### The `unknown` group -Members that don’t fit into any group specified in the `groups` option will be placed in the `unknown` group. If the `unknown` group is not specified in the `groups` option, +Members that don't fit into any group specified in the `groups` option will be placed in the `unknown` group. If the `unknown` group is not specified in the `groups` option, it will automatically be added to the end of the list. ##### Behavior when multiple groups match an element diff --git a/docs/content/rules/sort-objects.mdx b/docs/content/rules/sort-objects.mdx index 62b55ca40..eef17014b 100644 --- a/docs/content/rules/sort-objects.mdx +++ b/docs/content/rules/sort-objects.mdx @@ -272,7 +272,7 @@ Enables the use of comments to separate the keys of objects into logical groups. default: `false` -When `true`, the rule will not sort the object’s keys if there is an empty line between them. This helps maintain the defined order of logically separated groups of keys. +When `true`, the rule will not sort the object's keys if there is an empty line between them. This helps maintain the defined order of logically separated groups of keys. ```ts const user = { @@ -626,7 +626,7 @@ let user = { ##### The `unknown` group -Members that don’t fit into any group specified in the `groups` option will be placed in the `unknown` group. If the `unknown` group is not specified in the `groups` option, +Members that don't fit into any group specified in the `groups` option will be placed in the `unknown` group. If the `unknown` group is not specified in the `groups` option, it will automatically be added to the end of the list. #### Important notes diff --git a/docs/content/rules/sort-union-types.mdx b/docs/content/rules/sort-union-types.mdx index d8eea97f6..1de33ee65 100644 --- a/docs/content/rules/sort-union-types.mdx +++ b/docs/content/rules/sort-union-types.mdx @@ -361,11 +361,11 @@ Predefined groups are characterized by a single selector. - `'tuple'` — Tuple types. - `'union'` — Union types. - `'nullish'` — Nullish types (`null` or `undefined`). -- `'unknown'` — Types that don’t fit into any group entered by the user. +- `'unknown'` — Types that don't fit into any group entered by the user. ##### The `unknown` group -Members that don’t fit into any group specified in the `groups` option will be placed in the `unknown` group. If the `unknown` group is not specified in the `groups` option, +Members that don't fit into any group specified in the `groups` option will be placed in the `unknown` group. If the `unknown` group is not specified in the `groups` option, it will automatically be added to the end of the list. #### Example 1 From 950fedb3e4c4f053ce2f6fed83529d80718bb5ab Mon Sep 17 00:00:00 2001 From: "hugo.prunaux" Date: Tue, 10 Mar 2026 19:39:44 +0100 Subject: [PATCH 02/10] docs: move `lang="tsx"` at the end of the file --- docs/content/rules/sort-sets.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/content/rules/sort-sets.mdx b/docs/content/rules/sort-sets.mdx index 1768bc164..b7c7a28bf 100644 --- a/docs/content/rules/sort-sets.mdx +++ b/docs/content/rules/sort-sets.mdx @@ -85,8 +85,6 @@ By keeping sets sorted, developers can quickly scan and verify the values, makin return 'Unknown' } `} - client:load - lang="tsx" initial={dedent` const getProductCategories = (product) => { let electronics = new Set([ @@ -118,6 +116,8 @@ By keeping sets sorted, developers can quickly scan and verify the values, makin return 'Unknown' } `} + client:load + lang="tsx" /> ## Options From b16ae33d85ff2d876de26fab9259929be5a065fb Mon Sep 17 00:00:00 2001 From: "hugo.prunaux" Date: Tue, 10 Mar 2026 19:40:14 +0100 Subject: [PATCH 03/10] docs: remove duplicate keywords --- docs/content/rules/sort-intersection-types.mdx | 1 - docs/content/rules/sort-union-types.mdx | 2 -- 2 files changed, 3 deletions(-) diff --git a/docs/content/rules/sort-intersection-types.mdx b/docs/content/rules/sort-intersection-types.mdx index 66a288902..86a88b457 100644 --- a/docs/content/rules/sort-intersection-types.mdx +++ b/docs/content/rules/sort-intersection-types.mdx @@ -11,7 +11,6 @@ keywords: - typescript linting - intersection types sorting - typescript types - - typescript linting - typescript-eslint --- diff --git a/docs/content/rules/sort-union-types.mdx b/docs/content/rules/sort-union-types.mdx index 1de33ee65..582c88b93 100644 --- a/docs/content/rules/sort-union-types.mdx +++ b/docs/content/rules/sort-union-types.mdx @@ -11,12 +11,10 @@ keywords: - typescript linting - union types sorting - typescript types - - typescript linting - typescript-eslint - typescript union types - typescript union type sorting - typescript union type members - - typescript union type sorting - typescript union type members sorting --- From 8fe8dcc5f40afec6ee2df77635e72218dd75535b Mon Sep 17 00:00:00 2001 From: "hugo.prunaux" Date: Tue, 10 Mar 2026 19:40:40 +0100 Subject: [PATCH 04/10] docs: fix misplaced backticks --- .../content/rules/sort-intersection-types.mdx | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/content/rules/sort-intersection-types.mdx b/docs/content/rules/sort-intersection-types.mdx index 86a88b457..615fa4729 100644 --- a/docs/content/rules/sort-intersection-types.mdx +++ b/docs/content/rules/sort-intersection-types.mdx @@ -326,19 +326,19 @@ Predefined groups are characterized by a single selector. ##### Selectors -- `'conditional`' — Conditional types. -- `'function`' — Function types. -- `'import`' — Imported types. -- `'intersection`' — Intersection types. -- `'keyword`' — Keyword types. -- `'literal`' — Literal types. -- `'named`' — Named types. -- `'object`' — Object types. -- `'operator`' — Operator types. -- `'tuple`' — Tuple types. -- `'union`' — Union types. -- `'nullish`' — Nullish types (`null` or `undefined`). -- `'unknown`' — Types that don't fit into any group specified in the `groups` option. +- `'conditional'` — Conditional types. +- `'function'` — Function types. +- `'import'` — Imported types. +- `'intersection'` — Intersection types. +- `'keyword'` — Keyword types. +- `'literal'` — Literal types. +- `'named'` — Named types. +- `'object'` — Object types. +- `'operator'` — Operator types. +- `'tuple'` — Tuple types. +- `'union'` — Union types. +- `'nullish'` — Nullish types (`null` or `undefined`). +- `'unknown'` — Types that don't fit into any group specified in the `groups` option. ##### The `unknown` group From 4e19375b3d18adbe376b8a5187aba008f18c5def Mon Sep 17 00:00:00 2001 From: "hugo.prunaux" Date: Tue, 10 Mar 2026 19:41:15 +0100 Subject: [PATCH 05/10] docs: fix heading level inconsistencies --- docs/content/rules/sort-enums.mdx | 2 +- docs/content/rules/sort-jsx-props.mdx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/content/rules/sort-enums.mdx b/docs/content/rules/sort-enums.mdx index 2418f9571..ce83f65af 100644 --- a/docs/content/rules/sort-enums.mdx +++ b/docs/content/rules/sort-enums.mdx @@ -364,7 +364,7 @@ Within a given group, members will be sorted according to the `type`, `order`, ` Individual groups can be combined together by placing them in an array. The order of groups in that array does not matter. All members of the groups in the array will be sorted together as if they were part of a single group. -##### Group with overridden settings +#### Group with overridden settings You may directly override options for a specific group by using an object with the `group` property and other option overrides. diff --git a/docs/content/rules/sort-jsx-props.mdx b/docs/content/rules/sort-jsx-props.mdx index 47c9e2797..5c6189eb3 100644 --- a/docs/content/rules/sort-jsx-props.mdx +++ b/docs/content/rules/sort-jsx-props.mdx @@ -402,7 +402,7 @@ All members of the groups in the array will be sorted together as if they were p Predefined groups are characterized by a single selector and potentially multiple modifiers. You may enter modifiers in any order, but the selector must always come at the end. -##### Selectors +#### Selectors The only selector possible for this rule is `'prop'`. From 0cab6a499e56e521399816025c7cc803615b3fb1 Mon Sep 17 00:00:00 2001 From: "hugo.prunaux" Date: Tue, 10 Mar 2026 19:46:44 +0100 Subject: [PATCH 06/10] docs: fix formatting issue --- docs/content/rules/sort-exports.mdx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/content/rules/sort-exports.mdx b/docs/content/rules/sort-exports.mdx index 35a1df740..6cf258a9f 100644 --- a/docs/content/rules/sort-exports.mdx +++ b/docs/content/rules/sort-exports.mdx @@ -131,7 +131,7 @@ Example: enforce alphabetical sort between two elements with the same length. You can also sort by subgroup order (nested groups in the [`groups`](#groups) option) using `subgroup-order`. -Example: When two exports tie on the primary sort key, sort type exports before value exports inside a subgroup. +Example: when two exports tie on the primary sort key, sort type exports before value exports inside a subgroup. ```ts { groups: [['type-export', 'value-export']], @@ -483,7 +483,6 @@ Custom groups have a higher priority than any predefined group. lang="tsx" /> - ## Version This rule was introduced in [v1.2.0](https://github.com/azat-io/eslint-plugin-perfectionist/releases/tag/v1.2.0). From 1d1be806fad41dde8daff55d3940417ccd9e3210 Mon Sep 17 00:00:00 2001 From: "hugo.prunaux" Date: Tue, 10 Mar 2026 19:42:42 +0100 Subject: [PATCH 07/10] docs: fix missing option --- docs/content/rules/sort-array-includes.mdx | 6 ++++-- docs/content/rules/sort-sets.mdx | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/content/rules/sort-array-includes.mdx b/docs/content/rules/sort-array-includes.mdx index 44b59433f..ce2bff650 100644 --- a/docs/content/rules/sort-array-includes.mdx +++ b/docs/content/rules/sort-array-includes.mdx @@ -523,11 +523,12 @@ Custom groups have a higher priority than any predefined group. fallbackSort: { type: 'unsorted' }, ignoreCase: true, specialCharacters: 'keep', + partitionByComment: false, partitionByNewLine: false, newlinesBetween: 'ignore', newlinesInside: 'ignore', useConfigurationIf: {}, - groups: ["literal"], + groups: ['literal'], customGroups: [], }, ], @@ -554,11 +555,12 @@ Custom groups have a higher priority than any predefined group. fallbackSort: { type: 'unsorted' }, ignoreCase: true, specialCharacters: 'keep', + partitionByComment: false, partitionByNewLine: false, newlinesBetween: 'ignore', newlinesInside: 'ignore', useConfigurationIf: {}, - groups: ["literal"], + groups: ['literal'], customGroups: [], }, ], diff --git a/docs/content/rules/sort-sets.mdx b/docs/content/rules/sort-sets.mdx index b7c7a28bf..57f10aae4 100644 --- a/docs/content/rules/sort-sets.mdx +++ b/docs/content/rules/sort-sets.mdx @@ -528,6 +528,7 @@ Custom groups have a higher priority than any predefined group. fallbackSort: { type: 'unsorted' }, ignoreCase: true, specialCharacters: 'keep', + partitionByComment: false, partitionByNewLine: false, newlinesBetween: 'ignore', newlinesInside: 'ignore', @@ -559,6 +560,7 @@ Custom groups have a higher priority than any predefined group. fallbackSort: { type: 'unsorted' }, ignoreCase: true, specialCharacters: 'keep', + partitionByComment: false, partitionByNewLine: false, newlinesBetween: 'ignore', newlinesInside: 'ignore', From 1eda9eae34627d48f3bd2199523a09916b00491f Mon Sep 17 00:00:00 2001 From: "hugo.prunaux" Date: Tue, 10 Mar 2026 19:43:40 +0100 Subject: [PATCH 08/10] docs: fix misc issues --- docs/content/rules/sort-array-includes.mdx | 2 +- docs/content/rules/sort-classes.mdx | 2 +- docs/content/rules/sort-heritage-clauses.mdx | 2 +- docs/content/rules/sort-intersection-types.mdx | 8 +++++--- docs/content/rules/sort-jsx-props.mdx | 2 +- docs/content/rules/sort-modules.mdx | 2 +- docs/content/rules/sort-union-types.mdx | 6 +++--- 7 files changed, 13 insertions(+), 11 deletions(-) diff --git a/docs/content/rules/sort-array-includes.mdx b/docs/content/rules/sort-array-includes.mdx index ce2bff650..40b1b26ca 100644 --- a/docs/content/rules/sort-array-includes.mdx +++ b/docs/content/rules/sort-array-includes.mdx @@ -447,7 +447,7 @@ This feature is only applicable when [`partitionByNewLine`](#partitionbynewline) default: `[]` -Defines custom groups to match specific object type members. +Defines custom groups to match specific array elements. A custom group definition may follow one of the two following interfaces: diff --git a/docs/content/rules/sort-classes.mdx b/docs/content/rules/sort-classes.mdx index d25be52e8..03ca9e4b1 100644 --- a/docs/content/rules/sort-classes.mdx +++ b/docs/content/rules/sort-classes.mdx @@ -375,7 +375,7 @@ Without `ignoreCallbackDependenciesPatterns: ['^computed$']`, `role` and `userna default: `{}` -Specifies filters to match a particular options configuration for a given object. +Specifies filters to match a particular options configuration for a given class. The first matching options configuration will be used. If no configuration matches, the default options configuration will be used. diff --git a/docs/content/rules/sort-heritage-clauses.mdx b/docs/content/rules/sort-heritage-clauses.mdx index e6566c072..ce57d8b06 100644 --- a/docs/content/rules/sort-heritage-clauses.mdx +++ b/docs/content/rules/sort-heritage-clauses.mdx @@ -232,7 +232,7 @@ Example configuration: don't sort heritage clauses of classes (only interfaces). default: `false` -Enables the use of comments to separate class decorators into logical groups. +Enables the use of comments to separate heritage clauses into logical groups. - `true` — All comments will be treated as delimiters, creating partitions. - `false` — Comments will not be used as delimiters. diff --git a/docs/content/rules/sort-intersection-types.mdx b/docs/content/rules/sort-intersection-types.mdx index 615fa4729..8bd4ae854 100644 --- a/docs/content/rules/sort-intersection-types.mdx +++ b/docs/content/rules/sort-intersection-types.mdx @@ -314,6 +314,8 @@ To avoid unexpected behavior, do not use `:exit` or `:enter` pseudo-selectors. default: `[]` +Specifies a list of intersection type groups for sorting. Groups help organize types into categories, making your type definitions more readable and maintainable. + Each member will be assigned a single group specified in the `groups` option (or the `unknown` group if no match is found). The order of items in the `groups` option determines how groups are ordered. @@ -472,7 +474,7 @@ This feature is only applicable when [`partitionByNewLine`](#partitionbynewline) default: `[]` -Defines custom groups to match specific object type members. +Defines custom groups to match specific intersection type members. A custom group definition may follow one of the two following interfaces: @@ -488,7 +490,7 @@ interface CustomGroupDefinition { } ``` -An type member will match a `CustomGroupDefinition` group if it matches all the filters of the custom group's definition. +A type member will match a `CustomGroupDefinition` group if it matches all the filters of the custom group's definition. or: @@ -506,7 +508,7 @@ interface CustomGroupAnyOfDefinition { } ``` -An type member will match a `CustomGroupAnyOfDefinition` group if it matches all the filters of at least one of the `anyOf` items. +A type member will match a `CustomGroupAnyOfDefinition` group if it matches all the filters of at least one of the `anyOf` items. #### Attributes diff --git a/docs/content/rules/sort-jsx-props.mdx b/docs/content/rules/sort-jsx-props.mdx index 5c6189eb3..7951f3a95 100644 --- a/docs/content/rules/sort-jsx-props.mdx +++ b/docs/content/rules/sort-jsx-props.mdx @@ -485,7 +485,7 @@ Current API: default: `[]` -Defines custom groups to match specific JSX prop. +Defines custom groups to match specific JSX props. A custom group definition may follow one of the two following interfaces: diff --git a/docs/content/rules/sort-modules.mdx b/docs/content/rules/sort-modules.mdx index be0771391..8bbde97cf 100644 --- a/docs/content/rules/sort-modules.mdx +++ b/docs/content/rules/sort-modules.mdx @@ -288,7 +288,7 @@ Enables the use of comments to separate the module members into logical groups. default: `false` -When `true`, the rule will not sort the members of a class if there is an empty line between them. This helps maintain the defined order of logically separated groups of members. +When `true`, the rule will not sort the members of a module if there is an empty line between them. This helps maintain the defined order of logically separated groups of members. ```ts // Group 1 diff --git a/docs/content/rules/sort-union-types.mdx b/docs/content/rules/sort-union-types.mdx index 582c88b93..8791fd9ec 100644 --- a/docs/content/rules/sort-union-types.mdx +++ b/docs/content/rules/sort-union-types.mdx @@ -493,7 +493,7 @@ This feature is only applicable when [`partitionByNewLine`](#partitionbynewline) default: `[]` -Defines custom groups to match specific object type members. +Defines custom groups to match specific union type members. A custom group definition may follow one of the two following interfaces: @@ -509,7 +509,7 @@ interface CustomGroupDefinition { } ``` -An type member will match a `CustomGroupDefinition` group if it matches all the filters of the custom group's definition. +A type member will match a `CustomGroupDefinition` group if it matches all the filters of the custom group's definition. or: @@ -527,7 +527,7 @@ interface CustomGroupAnyOfDefinition { } ``` -An type member will match a `CustomGroupAnyOfDefinition` group if it matches all the filters of at least one of the `anyOf` items. +A type member will match a `CustomGroupAnyOfDefinition` group if it matches all the filters of at least one of the `anyOf` items. #### Attributes From 37265f0903bfda80252732bd1de250c6b2c6a03c Mon Sep 17 00:00:00 2001 From: "hugo.prunaux" Date: Tue, 10 Mar 2026 19:26:25 +0100 Subject: [PATCH 09/10] test: rename bad test --- ...atch.test.ts => passes-all-names-match-pattern-filter.test.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename test/utils/context-matching/{filter-options-by-all-names-match.test.ts => passes-all-names-match-pattern-filter.test.ts} (100%) diff --git a/test/utils/context-matching/filter-options-by-all-names-match.test.ts b/test/utils/context-matching/passes-all-names-match-pattern-filter.test.ts similarity index 100% rename from test/utils/context-matching/filter-options-by-all-names-match.test.ts rename to test/utils/context-matching/passes-all-names-match-pattern-filter.test.ts From b49f289e80683d96af4ca4c2e639364329598f5d Mon Sep 17 00:00:00 2001 From: "hugo.prunaux" Date: Tue, 10 Mar 2026 19:26:30 +0100 Subject: [PATCH 10/10] test: add tests --- .../passes-ast-selector-filter.test.ts | 38 ++++++++++++++ .../partition-patterns-by-scope.test.ts | 52 +++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 test/utils/context-matching/passes-ast-selector-filter.test.ts create mode 100644 test/utils/scoped-regex/partition-patterns-by-scope.test.ts diff --git a/test/utils/context-matching/passes-ast-selector-filter.test.ts b/test/utils/context-matching/passes-ast-selector-filter.test.ts new file mode 100644 index 000000000..be6771bd5 --- /dev/null +++ b/test/utils/context-matching/passes-ast-selector-filter.test.ts @@ -0,0 +1,38 @@ +import { describe, expect, it } from 'vitest' + +import { passesAstSelectorFilter } from '../../../utils/context-matching/passes-ast-selector-filter' + +describe('passes-ast-selector-filter', () => { + it.each([undefined, ''])( + 'returns true if `matchesAstSelector` is %s', + matchesAstSelector => { + let matchedAstSelectors = new Set(['TSTypeAnnotation']) + + expect( + passesAstSelectorFilter({ matchedAstSelectors, matchesAstSelector }), + ).toBeTruthy() + }, + ) + + it('returns true if `matchedAstSelectors` contains `matchesAstSelector`', () => { + let matchedAstSelectors = new Set(['TSTypeAnnotation', 'ClassBody']) + + expect( + passesAstSelectorFilter({ + matchesAstSelector: 'TSTypeAnnotation', + matchedAstSelectors, + }), + ).toBeTruthy() + }) + + it('returns false if `matchedAstSelectors` does not contain `matchesAstSelector`', () => { + let matchedAstSelectors = new Set(['TSTypeAnnotation']) + + expect( + passesAstSelectorFilter({ + matchesAstSelector: 'ClassBody', + matchedAstSelectors, + }), + ).toBeFalsy() + }) +}) diff --git a/test/utils/scoped-regex/partition-patterns-by-scope.test.ts b/test/utils/scoped-regex/partition-patterns-by-scope.test.ts new file mode 100644 index 000000000..7acc2c057 --- /dev/null +++ b/test/utils/scoped-regex/partition-patterns-by-scope.test.ts @@ -0,0 +1,52 @@ +import { describe, expect, it } from 'vitest' + +import { partitionPatternsByScope } from '../../../utils/scoped-regex/partition-patterns-by-scope' + +describe('partition-patterns-by-scope', () => { + it('puts a string pattern into shallowScopePatterns', () => { + expect(partitionPatternsByScope('foo')).toEqual({ + shallowScopePatterns: ['foo'], + deepScopePatterns: [], + }) + }) + + it('puts an object pattern without scope into shallowScopePatterns', () => { + let pattern = { pattern: 'foo', flags: 'i' } + + expect(partitionPatternsByScope(pattern)).toEqual({ + shallowScopePatterns: [pattern], + deepScopePatterns: [], + }) + }) + + it('puts an object pattern with shallow scope into shallowScopePatterns', () => { + let pattern = { scope: 'shallow' as const, pattern: 'foo' } + + expect(partitionPatternsByScope(pattern)).toEqual({ + shallowScopePatterns: [pattern], + deepScopePatterns: [], + }) + }) + + it('puts an object pattern with deep scope into deepScopePatterns', () => { + let pattern = { scope: 'deep' as const, pattern: 'foo' } + + expect(partitionPatternsByScope(pattern)).toEqual({ + deepScopePatterns: [pattern], + shallowScopePatterns: [], + }) + }) + + it('partitions an array of mixed patterns by scope', () => { + let shallowString = 'foo' + let shallowObject = { pattern: 'bar', flags: 'i' } + let deepObject = { scope: 'deep' as const, pattern: 'baz' } + + expect( + partitionPatternsByScope([shallowString, shallowObject, deepObject]), + ).toEqual({ + shallowScopePatterns: [shallowString, shallowObject], + deepScopePatterns: [deepObject], + }) + }) +})