Skip to content

Commit 5a6d5fa

Browse files
hugop95azat-io
authored andcommitted
feat!: drop deprecated object-based custom groups support
1 parent 4c0161a commit 5a6d5fa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1415
-3641
lines changed

docs/content/rules/sort-heritage-clauses.mdx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -326,9 +326,12 @@ interface Interface extends WithId, Logged, StartupService {
326326
'withIdInterface', // [!code ++]
327327
'unknown'
328328
],
329-
+ customGroups: { // [!code ++]
330-
+ withIdInterface: '^WithId' // [!code ++]
331-
+ } // [!code ++]
329+
+ customGroups: [ // [!code ++]
330+
+ { // [!code ++]
331+
+ groupName: 'withIdInterface' // [!code ++]
332+
+ elementNamePattern: '^WithId' // [!code ++]
333+
+ } // [!code ++]
334+
+ ] // [!code ++]
332335
}
333336
```
334337

docs/content/rules/sort-interfaces.mdx

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -336,11 +336,20 @@ Example configuration:
336336
'error',
337337
{
338338
groups: ['r', 'g', 'b'], // Sort colors types by RGB
339-
customGroups: {
340-
r: '^r$',
341-
g: '^g$',
342-
b: '^b$',
343-
},
339+
customGroups: [
340+
{
341+
groupName: 'r',
342+
elementNamePattern: '^r$',
343+
},
344+
{
345+
groupName: 'g',
346+
elementNamePattern: '^g$',
347+
},
348+
{
349+
groupName: 'b',
350+
elementNamePattern: '^b$',
351+
},
352+
],
344353
useConfigurationIf: {
345354
allNamesMatchPattern: '^r|g|b$',
346355
},

docs/content/rules/sort-jsx-props.mdx

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -285,11 +285,20 @@ Example configuration:
285285
'error',
286286
{
287287
groups: ['r', 'g', 'b'], // Sort tag with colors keys by RGB
288-
customGroups: {
289-
r: '^r$',
290-
g: '^g$',
291-
b: '^b$',
292-
},
288+
customGroups: [
289+
{
290+
groupName: 'r',
291+
elementNamePattern: '^r$',
292+
},
293+
{
294+
groupName: 'g',
295+
elementNamePattern: '^g$',
296+
},
297+
{
298+
groupName: 'b',
299+
elementNamePattern: '^b$',
300+
},
301+
],
293302
useConfigurationIf: {
294303
allNamesMatchPattern: '^r|g|b$',
295304
},
@@ -511,7 +520,7 @@ Custom groups have a higher priority than any predefined group.
511520
newlinesBetween: 'ignore',
512521
useConfigurationIf: {},
513522
groups: [],
514-
customGroups: {},
523+
customGroups: [],
515524
},
516525
],
517526
},
@@ -542,7 +551,7 @@ Custom groups have a higher priority than any predefined group.
542551
newlinesBetween: 'ignore',
543552
useConfigurationIf: {},
544553
groups: [],
545-
customGroups: {},
554+
customGroups: [],
546555
},
547556
],
548557
},

docs/content/rules/sort-object-types.mdx

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -302,11 +302,20 @@ Example configuration:
302302
'error',
303303
{
304304
groups: ['r', 'g', 'b'], // Sort colors types by RGB
305-
customGroups: {
306-
r: '^r$',
307-
g: '^g$',
308-
b: '^b$',
309-
},
305+
customGroups: [
306+
{
307+
groupName: 'r',
308+
elementNamePattern: '^r$',
309+
},
310+
{
311+
groupName: 'g',
312+
elementNamePattern: '^g$',
313+
},
314+
{
315+
groupName: 'b',
316+
elementNamePattern: '^b$',
317+
},
318+
],
310319
useConfigurationIf: {
311320
allNamesMatchPattern: '^r|g|b$',
312321
},

docs/content/rules/sort-objects.mdx

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -367,11 +367,20 @@ Example configuration:
367367
'error',
368368
{
369369
groups: ['r', 'g', 'b'], // Sort colors by RGB
370-
customGroups: {
371-
r: '^r$',
372-
g: '^g$',
373-
b: '^b$',
374-
},
370+
customGroups: [
371+
{
372+
groupName: 'r',
373+
elementNamePattern: '^r$',
374+
},
375+
{
376+
groupName: 'g',
377+
elementNamePattern: '^g$',
378+
},
379+
{
380+
groupName: 'b',
381+
elementNamePattern: '^b$',
382+
},
383+
],
375384
useConfigurationIf: {
376385
allNamesMatchPattern: '^r|g|b$',
377386
},

rules/sort-decorators.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import type {
88

99
import {
1010
buildCustomGroupsArrayJsonSchema,
11-
deprecatedCustomGroupsJsonSchema,
1211
partitionByCommentJsonSchema,
1312
partitionByNewLineJsonSchema,
1413
newlinesBetweenJsonSchema,
@@ -73,12 +72,6 @@ export default createEslintRule<Options, MessageId>({
7372
items: {
7473
properties: {
7574
...commonJsonSchemas,
76-
customGroups: {
77-
oneOf: [
78-
deprecatedCustomGroupsJsonSchema,
79-
buildCustomGroupsArrayJsonSchema({ singleCustomGroupJsonSchema }),
80-
],
81-
},
8275
sortOnParameters: {
8376
description:
8477
'Controls whether sorting should be enabled for method parameter decorators.',
@@ -104,6 +97,9 @@ export default createEslintRule<Options, MessageId>({
10497
'Controls whether sorting should be enabled for class decorators.',
10598
type: 'boolean',
10699
},
100+
customGroups: buildCustomGroupsArrayJsonSchema({
101+
singleCustomGroupJsonSchema,
102+
}),
107103
partitionByComment: partitionByCommentJsonSchema,
108104
partitionByNewLine: partitionByNewLineJsonSchema,
109105
newlinesBetween: newlinesBetweenJsonSchema,
@@ -223,7 +219,6 @@ function sortDecorators(
223219
}),
224220
predefinedGroups: [],
225221
options,
226-
name,
227222
})
228223

229224
let sortingNode: Omit<SortDecoratorsSortingNode, 'partitionId'> = {

rules/sort-decorators/types.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import type { JSONSchema4 } from '@typescript-eslint/utils/json-schema'
22
import type { TSESTree } from '@typescript-eslint/types'
33

44
import type {
5-
DeprecatedCustomGroupsOption,
65
PartitionByCommentOption,
76
NewlinesBetweenOption,
87
CustomGroupsOption,
@@ -16,9 +15,7 @@ import { regexJsonSchema } from '../../utils/common-json-schemas'
1615

1716
export type Options = Partial<
1817
{
19-
customGroups:
20-
| CustomGroupsOption<SingleCustomGroup>
21-
| DeprecatedCustomGroupsOption
18+
customGroups: CustomGroupsOption<SingleCustomGroup>
2219
partitionByComment: PartitionByCommentOption
2320
newlinesBetween: NewlinesBetweenOption
2421
groups: GroupsOptions<Group>

rules/sort-enums.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import type { Options } from './sort-enums/types'
77

88
import {
99
buildCustomGroupsArrayJsonSchema,
10-
deprecatedCustomGroupsJsonSchema,
1110
partitionByCommentJsonSchema,
1211
partitionByNewLineJsonSchema,
1312
newlinesBetweenJsonSchema,
@@ -263,12 +262,6 @@ export default createEslintRule<Options, MessageId>({
263262
{
264263
properties: {
265264
...commonJsonSchemas,
266-
customGroups: {
267-
oneOf: [
268-
deprecatedCustomGroupsJsonSchema,
269-
buildCustomGroupsArrayJsonSchema({ singleCustomGroupJsonSchema }),
270-
],
271-
},
272265
forceNumericSort: {
273266
description:
274267
'Will always sort numeric enums by their value regardless of the sort type specified.',
@@ -278,6 +271,9 @@ export default createEslintRule<Options, MessageId>({
278271
description: 'Compare enum values instead of names.',
279272
type: 'boolean',
280273
},
274+
customGroups: buildCustomGroupsArrayJsonSchema({
275+
singleCustomGroupJsonSchema,
276+
}),
281277
partitionByComment: partitionByCommentJsonSchema,
282278
partitionByNewLine: partitionByNewLineJsonSchema,
283279
newlinesBetween: newlinesBetweenJsonSchema,

rules/sort-heritage-clauses.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import type { SortingNode } from '../types/sorting-node'
66

77
import {
88
buildCustomGroupsArrayJsonSchema,
9-
deprecatedCustomGroupsJsonSchema,
109
partitionByNewLineJsonSchema,
1110
partitionByCommentJsonSchema,
1211
newlinesBetweenJsonSchema,
@@ -64,12 +63,9 @@ export default createEslintRule<Options, MessageId>({
6463
items: {
6564
properties: {
6665
...commonJsonSchemas,
67-
customGroups: {
68-
oneOf: [
69-
deprecatedCustomGroupsJsonSchema,
70-
buildCustomGroupsArrayJsonSchema({ singleCustomGroupJsonSchema }),
71-
],
72-
},
66+
customGroups: buildCustomGroupsArrayJsonSchema({
67+
singleCustomGroupJsonSchema,
68+
}),
7369
partitionByNewLine: partitionByNewLineJsonSchema,
7470
partitionByComment: partitionByCommentJsonSchema,
7571
newlinesBetween: newlinesBetweenJsonSchema,
@@ -149,7 +145,6 @@ function sortHeritageClauses(
149145
}),
150146
predefinedGroups: [],
151147
options,
152-
name,
153148
})
154149

155150
let sortingNode: SortingNode = {

rules/sort-heritage-clauses/types.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import type { JSONSchema4 } from '@typescript-eslint/utils/json-schema'
22

33
import type {
4-
DeprecatedCustomGroupsOption,
54
PartitionByCommentOption,
65
NewlinesBetweenOption,
76
CustomGroupsOption,
@@ -14,9 +13,7 @@ import { regexJsonSchema } from '../../utils/common-json-schemas'
1413

1514
export type Options = Partial<
1615
{
17-
customGroups:
18-
| CustomGroupsOption<SingleCustomGroup>
19-
| DeprecatedCustomGroupsOption
16+
customGroups: CustomGroupsOption<SingleCustomGroup>
2017
partitionByComment: PartitionByCommentOption
2118
newlinesBetween: NewlinesBetweenOption
2219
groups: GroupsOptions<Group>

0 commit comments

Comments
 (0)