eslint-plugin-perfectionist 3.7.0 → 3.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/index.d.ts +18 -0
  2. package/dist/rules/sort-array-includes.js +9 -3
  3. package/dist/rules/sort-array-includes.mjs +9 -3
  4. package/dist/rules/sort-astro-attributes.js +8 -1
  5. package/dist/rules/sort-astro-attributes.mjs +9 -3
  6. package/dist/rules/sort-classes-utils.js +4 -8
  7. package/dist/rules/sort-classes-utils.mjs +4 -8
  8. package/dist/rules/sort-classes.js +21 -13
  9. package/dist/rules/sort-classes.mjs +19 -16
  10. package/dist/rules/sort-enums.js +15 -3
  11. package/dist/rules/sort-enums.mjs +9 -3
  12. package/dist/rules/sort-exports.js +15 -3
  13. package/dist/rules/sort-exports.mjs +9 -3
  14. package/dist/rules/sort-imports.js +57 -29
  15. package/dist/rules/sort-imports.mjs +54 -32
  16. package/dist/rules/sort-interfaces.js +18 -8
  17. package/dist/rules/sort-interfaces.mjs +13 -10
  18. package/dist/rules/sort-intersection-types.js +16 -4
  19. package/dist/rules/sort-intersection-types.mjs +10 -4
  20. package/dist/rules/sort-jsx-props.js +10 -3
  21. package/dist/rules/sort-jsx-props.mjs +11 -5
  22. package/dist/rules/sort-maps.js +9 -3
  23. package/dist/rules/sort-maps.mjs +9 -3
  24. package/dist/rules/sort-named-exports.js +15 -3
  25. package/dist/rules/sort-named-exports.mjs +9 -3
  26. package/dist/rules/sort-named-imports.js +14 -3
  27. package/dist/rules/sort-named-imports.mjs +8 -3
  28. package/dist/rules/sort-object-types.js +17 -5
  29. package/dist/rules/sort-object-types.mjs +11 -7
  30. package/dist/rules/sort-objects.js +27 -16
  31. package/dist/rules/sort-objects.mjs +25 -15
  32. package/dist/rules/sort-sets.js +1 -0
  33. package/dist/rules/sort-sets.mjs +1 -0
  34. package/dist/rules/sort-svelte-attributes.js +11 -6
  35. package/dist/rules/sort-svelte-attributes.mjs +12 -8
  36. package/dist/rules/sort-union-types.js +16 -4
  37. package/dist/rules/sort-union-types.mjs +10 -4
  38. package/dist/rules/sort-variable-declarations.js +15 -3
  39. package/dist/rules/sort-variable-declarations.mjs +9 -3
  40. package/dist/rules/sort-vue-attributes.js +8 -1
  41. package/dist/rules/sort-vue-attributes.mjs +9 -3
  42. package/dist/utils/compare.js +12 -6
  43. package/dist/utils/compare.mjs +12 -6
  44. package/dist/utils/get-node-range.js +11 -3
  45. package/dist/utils/get-node-range.mjs +13 -3
  46. package/dist/utils/is-partition-comment.js +8 -10
  47. package/dist/utils/is-partition-comment.mjs +8 -10
  48. package/dist/utils/matches.js +15 -0
  49. package/dist/utils/matches.mjs +13 -0
  50. package/dist/utils/use-groups.js +4 -8
  51. package/dist/utils/use-groups.mjs +4 -13
  52. package/{license → license.md} +1 -1
  53. package/package.json +3 -3
package/dist/index.d.ts CHANGED
@@ -114,6 +114,7 @@ declare const _default: {
114
114
  Partial<{
115
115
  type: 'alphabetical' | 'line-length' | 'natural'
116
116
  partitionByComment: string[] | boolean | string
117
+ matcher: 'minimatch' | 'regex'
117
118
  partitionByNewLine: boolean
118
119
  order: 'desc' | 'asc'
119
120
  ignoreCase: boolean
@@ -129,6 +130,7 @@ declare const _default: {
129
130
  Partial<{
130
131
  type: 'alphabetical' | 'line-length' | 'natural'
131
132
  partitionByComment: string[] | boolean | string
133
+ matcher: 'minimatch' | 'regex'
132
134
  groups: (
133
135
  | (
134
136
  | 'object'
@@ -179,6 +181,7 @@ declare const _default: {
179
181
  }
180
182
  type: 'alphabetical' | 'line-length' | 'natural'
181
183
  groups: (string | string[])[]
184
+ matcher: 'minimatch' | 'regex'
182
185
  order: 'desc' | 'asc'
183
186
  ignoreCase: boolean
184
187
  }>,
@@ -195,6 +198,7 @@ declare const _default: {
195
198
  }
196
199
  type: 'alphabetical' | 'line-length' | 'natural'
197
200
  groups: (string | string[])[]
201
+ matcher: 'minimatch' | 'regex'
198
202
  order: 'desc' | 'asc'
199
203
  ignoreCase: boolean
200
204
  }>,
@@ -211,6 +215,7 @@ declare const _default: {
211
215
  }
212
216
  type: 'alphabetical' | 'line-length' | 'natural'
213
217
  groups: (string | string[])[]
218
+ matcher: 'minimatch' | 'regex'
214
219
  order: 'desc' | 'asc'
215
220
  ignoreCase: boolean
216
221
  }>,
@@ -231,6 +236,7 @@ declare const _default: {
231
236
  groupKind: 'values-first' | 'types-first' | 'mixed'
232
237
  type: 'alphabetical' | 'line-length' | 'natural'
233
238
  partitionByComment: string[] | boolean | string
239
+ matcher: 'minimatch' | 'regex'
234
240
  partitionByNewLine: boolean
235
241
  order: 'desc' | 'asc'
236
242
  ignoreAlias: boolean
@@ -247,6 +253,7 @@ declare const _default: {
247
253
  groupKind: 'values-first' | 'types-first' | 'mixed'
248
254
  type: 'alphabetical' | 'line-length' | 'natural'
249
255
  partitionByComment: string[] | boolean | string
256
+ matcher: 'minimatch' | 'regex'
250
257
  partitionByNewLine: boolean
251
258
  order: 'desc' | 'asc'
252
259
  ignoreCase: boolean
@@ -266,6 +273,7 @@ declare const _default: {
266
273
  type: 'alphabetical' | 'line-length' | 'natural'
267
274
  partitionByComment: string[] | boolean | string
268
275
  groups: (string | string[])[]
276
+ matcher: 'minimatch' | 'regex'
269
277
  partitionByNewLine: boolean
270
278
  order: 'desc' | 'asc'
271
279
  ignoreCase: boolean
@@ -280,6 +288,7 @@ declare const _default: {
280
288
  Partial<{
281
289
  type: 'alphabetical' | 'line-length' | 'natural'
282
290
  partitionByComment: string[] | boolean | string
291
+ matcher: 'minimatch' | 'regex'
283
292
  groups: (
284
293
  | (
285
294
  | 'object'
@@ -344,6 +353,7 @@ declare const _default: {
344
353
  type: 'alphabetical' | 'line-length' | 'natural'
345
354
  partitionByComment: string[] | boolean | string
346
355
  groups: (string | string[])[]
356
+ matcher: 'minimatch' | 'regex'
347
357
  partitionByNewLine: boolean
348
358
  ignorePattern: string[]
349
359
  order: 'desc' | 'asc'
@@ -362,6 +372,7 @@ declare const _default: {
362
372
  }
363
373
  type: 'alphabetical' | 'line-length' | 'natural'
364
374
  groups: (string | string[])[]
375
+ matcher: 'minimatch' | 'regex'
365
376
  ignorePattern: string[]
366
377
  order: 'desc' | 'asc'
367
378
  ignoreCase: boolean
@@ -400,6 +411,7 @@ declare const _default: {
400
411
  type: 'alphabetical' | 'line-length' | 'natural'
401
412
  newlinesBetween: 'ignore' | 'always' | 'never'
402
413
  groups: (string | string[])[]
414
+ matcher: 'minimatch' | 'regex'
403
415
  environment: 'node' | 'bun'
404
416
  internalPattern: string[]
405
417
  sortSideEffects: boolean
@@ -418,6 +430,7 @@ declare const _default: {
418
430
  groupKind: 'values-first' | 'types-first' | 'mixed'
419
431
  type: 'alphabetical' | 'line-length' | 'natural'
420
432
  partitionByComment: string[] | boolean | string
433
+ matcher: 'minimatch' | 'regex'
421
434
  partitionByNewLine: boolean
422
435
  order: 'desc' | 'asc'
423
436
  ignoreCase: boolean
@@ -437,6 +450,7 @@ declare const _default: {
437
450
  }
438
451
  type: 'alphabetical' | 'line-length' | 'natural'
439
452
  partitionByComment: string[] | boolean | string
453
+ matcher: 'minimatch' | 'regex'
440
454
  groups: (string[] | string)[]
441
455
  partitionByNewLine: boolean
442
456
  styledComponents: boolean
@@ -467,6 +481,7 @@ declare const _default: {
467
481
  Partial<{
468
482
  type: 'alphabetical' | 'line-length' | 'natural'
469
483
  partitionByComment: string[] | boolean | string
484
+ matcher: 'minimatch' | 'regex'
470
485
  partitionByNewLine: boolean
471
486
  order: 'desc' | 'asc'
472
487
  ignoreCase: boolean
@@ -534,6 +549,7 @@ declare type Options = [
534
549
  groupKind: 'literals-first' | 'spreads-first' | 'mixed'
535
550
  type: 'alphabetical' | 'line-length' | 'natural'
536
551
  partitionByComment: string[] | boolean | string
552
+ matcher: 'minimatch' | 'regex'
537
553
  partitionByNewLine: boolean
538
554
  order: 'desc' | 'asc'
539
555
  ignoreCase: boolean
@@ -544,6 +560,7 @@ declare type Options_2 = [
544
560
  Partial<{
545
561
  type: 'alphabetical' | 'line-length' | 'natural'
546
562
  partitionByComment: string[] | boolean | string
563
+ matcher: 'minimatch' | 'regex'
547
564
  partitionByNewLine: boolean
548
565
  forceNumericSort: boolean
549
566
  order: 'desc' | 'asc'
@@ -610,6 +627,7 @@ declare type SortClassesOptions = [
610
627
  | CustomGroup[]
611
628
  type: 'alphabetical' | 'line-length' | 'natural'
612
629
  partitionByComment: string[] | boolean | string
630
+ matcher: 'minimatch' | 'regex'
613
631
  groups: (Group[] | Group)[]
614
632
  order: 'desc' | 'asc'
615
633
  ignoreCase: boolean
@@ -32,6 +32,11 @@ let jsonSchema = {
32
32
  type: 'string',
33
33
  enum: ['asc', 'desc'],
34
34
  },
35
+ matcher: {
36
+ description: 'Specifies the string matcher.',
37
+ type: 'string',
38
+ enum: ['minimatch', 'regex'],
39
+ },
35
40
  ignoreCase: {
36
41
  description: 'Controls whether sorting should be case-sensitive or not.',
37
42
  type: 'boolean',
@@ -86,6 +91,7 @@ const sortArrayIncludes = createEslintRule.createEslintRule({
86
91
  type: 'alphabetical',
87
92
  order: 'asc',
88
93
  ignoreCase: true,
94
+ matcher: 'minimatch',
89
95
  groupKind: 'literals-first',
90
96
  partitionByComment: false,
91
97
  partitionByNewLine: false,
@@ -115,6 +121,7 @@ let sortArray = (context, messageId, elements) => {
115
121
  groupKind: 'literals-first',
116
122
  type: 'alphabetical',
117
123
  ignoreCase: true,
124
+ matcher: 'minimatch',
118
125
  order: 'asc',
119
126
  partitionByComment: false,
120
127
  partitionByNewLine: false,
@@ -145,6 +152,7 @@ let sortArray = (context, messageId, elements) => {
145
152
  isPartitionComment.hasPartitionComment(
146
153
  partitionComment,
147
154
  getCommentsBefore.getCommentsBefore(element, sourceCode),
155
+ options.matcher,
148
156
  )) ||
149
157
  (options.partitionByNewLine &&
150
158
  lastSortingNode &&
@@ -200,9 +208,7 @@ let sortArray = (context, messageId, elements) => {
200
208
  nodes,
201
209
  sortedNodes,
202
210
  sourceCode,
203
- {
204
- partitionComment,
205
- },
211
+ options,
206
212
  )
207
213
  },
208
214
  })
@@ -27,6 +27,11 @@ let jsonSchema = {
27
27
  type: 'string',
28
28
  enum: ['asc', 'desc'],
29
29
  },
30
+ matcher: {
31
+ description: 'Specifies the string matcher.',
32
+ type: 'string',
33
+ enum: ['minimatch', 'regex'],
34
+ },
30
35
  ignoreCase: {
31
36
  description: 'Controls whether sorting should be case-sensitive or not.',
32
37
  type: 'boolean',
@@ -81,6 +86,7 @@ const sortArrayIncludes = createEslintRule({
81
86
  type: 'alphabetical',
82
87
  order: 'asc',
83
88
  ignoreCase: true,
89
+ matcher: 'minimatch',
84
90
  groupKind: 'literals-first',
85
91
  partitionByComment: false,
86
92
  partitionByNewLine: false,
@@ -110,6 +116,7 @@ let sortArray = (context, messageId, elements) => {
110
116
  groupKind: 'literals-first',
111
117
  type: 'alphabetical',
112
118
  ignoreCase: true,
119
+ matcher: 'minimatch',
113
120
  order: 'asc',
114
121
  partitionByComment: false,
115
122
  partitionByNewLine: false,
@@ -140,6 +147,7 @@ let sortArray = (context, messageId, elements) => {
140
147
  hasPartitionComment(
141
148
  partitionComment,
142
149
  getCommentsBefore(element, sourceCode),
150
+ options.matcher,
143
151
  )) ||
144
152
  (options.partitionByNewLine &&
145
153
  lastSortingNode &&
@@ -184,9 +192,7 @@ let sortArray = (context, messageId, elements) => {
184
192
  .map(groupedNodes => sortNodes(groupedNodes, options))
185
193
  .flat()
186
194
  : sortNodes(nodes, options)
187
- return makeFixes(fixer, nodes, sortedNodes, sourceCode, {
188
- partitionComment,
189
- })
195
+ return makeFixes(fixer, nodes, sortedNodes, sourceCode, options)
190
196
  },
191
197
  })
192
198
  }
@@ -34,6 +34,11 @@ const sortAstroAttributes = createEslintRule.createEslintRule({
34
34
  type: 'string',
35
35
  enum: ['asc', 'desc'],
36
36
  },
37
+ matcher: {
38
+ description: 'Specifies the string matcher.',
39
+ type: 'string',
40
+ enum: ['minimatch', 'regex'],
41
+ },
37
42
  ignoreCase: {
38
43
  description:
39
44
  'Controls whether sorting should be case-sensitive or not.',
@@ -89,6 +94,7 @@ const sortAstroAttributes = createEslintRule.createEslintRule({
89
94
  type: 'alphabetical',
90
95
  order: 'asc',
91
96
  ignoreCase: true,
97
+ matcher: 'minimatch',
92
98
  groups: [],
93
99
  customGroups: {},
94
100
  },
@@ -106,6 +112,7 @@ const sortAstroAttributes = createEslintRule.createEslintRule({
106
112
  let options = complete.complete(context.options.at(0), settings, {
107
113
  type: 'alphabetical',
108
114
  ignoreCase: true,
115
+ matcher: 'minimatch',
109
116
  customGroups: {},
110
117
  order: 'asc',
111
118
  groups: [],
@@ -127,7 +134,7 @@ const sortAstroAttributes = createEslintRule.createEslintRule({
127
134
  ? attribute.name.name
128
135
  : sourceCode.text.slice(...attribute.name.range)
129
136
  let { getGroup, defineGroup, setCustomGroups } =
130
- useGroups.useGroups(options.groups)
137
+ useGroups.useGroups(options)
131
138
  setCustomGroups(options.customGroups, name)
132
139
  if (attribute.type === 'AstroShorthandAttribute') {
133
140
  defineGroup('astro-shorthand')
@@ -33,6 +33,11 @@ const sortAstroAttributes = createEslintRule({
33
33
  type: 'string',
34
34
  enum: ['asc', 'desc'],
35
35
  },
36
+ matcher: {
37
+ description: 'Specifies the string matcher.',
38
+ type: 'string',
39
+ enum: ['minimatch', 'regex'],
40
+ },
36
41
  ignoreCase: {
37
42
  description:
38
43
  'Controls whether sorting should be case-sensitive or not.',
@@ -88,6 +93,7 @@ const sortAstroAttributes = createEslintRule({
88
93
  type: 'alphabetical',
89
94
  order: 'asc',
90
95
  ignoreCase: true,
96
+ matcher: 'minimatch',
91
97
  groups: [],
92
98
  customGroups: {},
93
99
  },
@@ -105,6 +111,7 @@ const sortAstroAttributes = createEslintRule({
105
111
  let options = complete(context.options.at(0), settings, {
106
112
  type: 'alphabetical',
107
113
  ignoreCase: true,
114
+ matcher: 'minimatch',
108
115
  customGroups: {},
109
116
  order: 'asc',
110
117
  groups: [],
@@ -125,9 +132,8 @@ const sortAstroAttributes = createEslintRule({
125
132
  typeof attribute.name.name === 'string'
126
133
  ? attribute.name.name
127
134
  : sourceCode.text.slice(...attribute.name.range)
128
- let { getGroup, defineGroup, setCustomGroups } = useGroups(
129
- options.groups,
130
- )
135
+ let { getGroup, defineGroup, setCustomGroups } =
136
+ useGroups(options)
131
137
  setCustomGroups(options.customGroups, name)
132
138
  if (attribute.type === 'AstroShorthandAttribute') {
133
139
  defineGroup('astro-shorthand')
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' })
3
- const minimatch = require('minimatch')
3
+ const matches = require('../utils/matches.js')
4
4
  const cachedGroupsByModifiersAndSelectors = /* @__PURE__ */ new Map()
5
5
  const generateOfficialGroups = (modifiers, selectors) => {
6
6
  let modifiersAndSelectorsKey = modifiers.join('&') + '/' + selectors.join('&')
@@ -119,12 +119,10 @@ const customGroupMatches = props => {
119
119
  'elementNamePattern' in props.customGroup &&
120
120
  props.customGroup.elementNamePattern
121
121
  ) {
122
- let matchesElementNamePattern = minimatch.minimatch(
122
+ let matchesElementNamePattern = matches.matches(
123
123
  props.elementName,
124
124
  props.customGroup.elementNamePattern,
125
- {
126
- nocomment: true,
127
- },
125
+ props.matcher,
128
126
  )
129
127
  if (!matchesElementNamePattern) {
130
128
  return false
@@ -136,9 +134,7 @@ const customGroupMatches = props => {
136
134
  ) {
137
135
  let decoratorPattern = props.customGroup.decoratorNamePattern
138
136
  let matchesDecoratorNamePattern = props.decorators.some(decorator =>
139
- minimatch.minimatch(decorator, decoratorPattern, {
140
- nocomment: true,
141
- }),
137
+ matches.matches(decorator, decoratorPattern, props.matcher),
142
138
  )
143
139
  if (!matchesDecoratorNamePattern) {
144
140
  return false
@@ -1,4 +1,4 @@
1
- import { minimatch } from 'minimatch'
1
+ import { matches } from '../utils/matches.mjs'
2
2
  const cachedGroupsByModifiersAndSelectors = /* @__PURE__ */ new Map()
3
3
  const generateOfficialGroups = (modifiers, selectors) => {
4
4
  let modifiersAndSelectorsKey = modifiers.join('&') + '/' + selectors.join('&')
@@ -117,12 +117,10 @@ const customGroupMatches = props => {
117
117
  'elementNamePattern' in props.customGroup &&
118
118
  props.customGroup.elementNamePattern
119
119
  ) {
120
- let matchesElementNamePattern = minimatch(
120
+ let matchesElementNamePattern = matches(
121
121
  props.elementName,
122
122
  props.customGroup.elementNamePattern,
123
- {
124
- nocomment: true,
125
- },
123
+ props.matcher,
126
124
  )
127
125
  if (!matchesElementNamePattern) {
128
126
  return false
@@ -134,9 +132,7 @@ const customGroupMatches = props => {
134
132
  ) {
135
133
  let decoratorPattern = props.customGroup.decoratorNamePattern
136
134
  let matchesDecoratorNamePattern = props.decorators.some(decorator =>
137
- minimatch(decorator, decoratorPattern, {
138
- nocomment: true,
139
- }),
135
+ matches(decorator, decoratorPattern, props.matcher),
140
136
  )
141
137
  if (!matchesDecoratorNamePattern) {
142
138
  return false
@@ -38,6 +38,11 @@ const sortClasses = createEslintRule.createEslintRule({
38
38
  type: 'string',
39
39
  enum: ['asc', 'desc'],
40
40
  },
41
+ matcher: {
42
+ description: 'Specifies the string matcher.',
43
+ type: 'string',
44
+ enum: ['minimatch', 'regex'],
45
+ },
41
46
  ignoreCase: {
42
47
  description:
43
48
  'Controls whether sorting should be case-sensitive or not.',
@@ -154,6 +159,7 @@ const sortClasses = createEslintRule.createEslintRule({
154
159
  type: 'alphabetical',
155
160
  order: 'asc',
156
161
  ignoreCase: true,
162
+ matcher: 'minimatch',
157
163
  partitionByComment: false,
158
164
  groups: [
159
165
  'index-signature',
@@ -194,6 +200,7 @@ const sortClasses = createEslintRule.createEslintRule({
194
200
  ['get-method', 'set-method'],
195
201
  'unknown',
196
202
  ],
203
+ matcher: 'minimatch',
197
204
  partitionByComment: false,
198
205
  type: 'alphabetical',
199
206
  ignoreCase: true,
@@ -322,6 +329,7 @@ const sortClasses = createEslintRule.createEslintRule({
322
329
  isPartitionComment.hasPartitionComment(
323
330
  options.partitionByComment,
324
331
  comments,
332
+ options.matcher,
325
333
  )
326
334
  ) {
327
335
  accumulator.push([])
@@ -329,7 +337,7 @@ const sortClasses = createEslintRule.createEslintRule({
329
337
  let name
330
338
  let dependencies = []
331
339
  let { getGroup, defineGroup, setCustomGroups } =
332
- useGroups.useGroups(options.groups)
340
+ useGroups.useGroups(options)
333
341
  if (member.type === 'StaticBlock') {
334
342
  name = 'static'
335
343
  } else if (member.type === 'TSIndexSignature') {
@@ -339,12 +347,10 @@ const sortClasses = createEslintRule.createEslintRule({
339
347
  ? void 0
340
348
  : _a2.range.at(0)) ?? member.range.at(1),
341
349
  )
350
+ } else if (member.key.type === 'Identifier') {
351
+ ;({ name } = member.key)
342
352
  } else {
343
- if (member.key.type === 'Identifier') {
344
- ;({ name } = member.key)
345
- } else {
346
- name = sourceCode.text.slice(...member.key.range)
347
- }
353
+ name = sourceCode.text.slice(...member.key.range)
348
354
  }
349
355
  let isPrivateHash =
350
356
  'key' in member && member.key.type === 'PrivateIdentifier'
@@ -497,6 +503,7 @@ const sortClasses = createEslintRule.createEslintRule({
497
503
  modifiers,
498
504
  selectors,
499
505
  decorators,
506
+ matcher: options.matcher,
500
507
  })
501
508
  ) {
502
509
  defineGroup(customGroup.groupName, true)
@@ -581,9 +588,6 @@ const sortClasses = createEslintRule.createEslintRule({
581
588
  pairwise.pairwise(nodes, (left, right) => {
582
589
  let leftNum = getGroupNumber.getGroupNumber(options.groups, left)
583
590
  let rightNum = getGroupNumber.getGroupNumber(options.groups, right)
584
- let isLeftOrRightIgnored =
585
- leftNum === options.groups.length ||
586
- rightNum === options.groups.length
587
591
  let indexOfLeft = sortedNodes.indexOf(left)
588
592
  let indexOfRight = sortedNodes.indexOf(right)
589
593
  let firstUnorderedNodeDependentOnRight =
@@ -593,7 +597,7 @@ const sortClasses = createEslintRule.createEslintRule({
593
597
  )
594
598
  if (
595
599
  firstUnorderedNodeDependentOnRight ||
596
- (!isLeftOrRightIgnored && indexOfLeft > indexOfRight)
600
+ indexOfLeft > indexOfRight
597
601
  ) {
598
602
  let messageId
599
603
  if (firstUnorderedNodeDependentOnRight) {
@@ -618,9 +622,13 @@ const sortClasses = createEslintRule.createEslintRule({
618
622
  },
619
623
  node: right.node,
620
624
  fix: fixer =>
621
- makeFixes.makeFixes(fixer, nodes, sortedNodes, sourceCode, {
622
- partitionComment: options.partitionByComment,
623
- }),
625
+ makeFixes.makeFixes(
626
+ fixer,
627
+ nodes,
628
+ sortedNodes,
629
+ sourceCode,
630
+ options,
631
+ ),
624
632
  })
625
633
  }
626
634
  })
@@ -49,6 +49,11 @@ const sortClasses = createEslintRule({
49
49
  type: 'string',
50
50
  enum: ['asc', 'desc'],
51
51
  },
52
+ matcher: {
53
+ description: 'Specifies the string matcher.',
54
+ type: 'string',
55
+ enum: ['minimatch', 'regex'],
56
+ },
52
57
  ignoreCase: {
53
58
  description:
54
59
  'Controls whether sorting should be case-sensitive or not.',
@@ -165,6 +170,7 @@ const sortClasses = createEslintRule({
165
170
  type: 'alphabetical',
166
171
  order: 'asc',
167
172
  ignoreCase: true,
173
+ matcher: 'minimatch',
168
174
  partitionByComment: false,
169
175
  groups: [
170
176
  'index-signature',
@@ -205,6 +211,7 @@ const sortClasses = createEslintRule({
205
211
  ['get-method', 'set-method'],
206
212
  'unknown',
207
213
  ],
214
+ matcher: 'minimatch',
208
215
  partitionByComment: false,
209
216
  type: 'alphabetical',
210
217
  ignoreCase: true,
@@ -326,15 +333,17 @@ const sortClasses = createEslintRule({
326
333
  let comments = getCommentsBefore(member, sourceCode)
327
334
  if (
328
335
  options.partitionByComment &&
329
- hasPartitionComment(options.partitionByComment, comments)
336
+ hasPartitionComment(
337
+ options.partitionByComment,
338
+ comments,
339
+ options.matcher,
340
+ )
330
341
  ) {
331
342
  accumulator.push([])
332
343
  }
333
344
  let name
334
345
  let dependencies = []
335
- let { getGroup, defineGroup, setCustomGroups } = useGroups(
336
- options.groups,
337
- )
346
+ let { getGroup, defineGroup, setCustomGroups } = useGroups(options)
338
347
  if (member.type === 'StaticBlock') {
339
348
  name = 'static'
340
349
  } else if (member.type === 'TSIndexSignature') {
@@ -344,12 +353,10 @@ const sortClasses = createEslintRule({
344
353
  ? void 0
345
354
  : _a2.range.at(0)) ?? member.range.at(1),
346
355
  )
356
+ } else if (member.key.type === 'Identifier') {
357
+ ;({ name } = member.key)
347
358
  } else {
348
- if (member.key.type === 'Identifier') {
349
- ;({ name } = member.key)
350
- } else {
351
- name = sourceCode.text.slice(...member.key.range)
352
- }
359
+ name = sourceCode.text.slice(...member.key.range)
353
360
  }
354
361
  let isPrivateHash =
355
362
  'key' in member && member.key.type === 'PrivateIdentifier'
@@ -502,6 +509,7 @@ const sortClasses = createEslintRule({
502
509
  modifiers,
503
510
  selectors,
504
511
  decorators,
512
+ matcher: options.matcher,
505
513
  })
506
514
  ) {
507
515
  defineGroup(customGroup.groupName, true)
@@ -579,16 +587,13 @@ const sortClasses = createEslintRule({
579
587
  pairwise(nodes, (left, right) => {
580
588
  let leftNum = getGroupNumber(options.groups, left)
581
589
  let rightNum = getGroupNumber(options.groups, right)
582
- let isLeftOrRightIgnored =
583
- leftNum === options.groups.length ||
584
- rightNum === options.groups.length
585
590
  let indexOfLeft = sortedNodes.indexOf(left)
586
591
  let indexOfRight = sortedNodes.indexOf(right)
587
592
  let firstUnorderedNodeDependentOnRight =
588
593
  getFirstUnorderedNodeDependentOn(right, nodes)
589
594
  if (
590
595
  firstUnorderedNodeDependentOnRight ||
591
- (!isLeftOrRightIgnored && indexOfLeft > indexOfRight)
596
+ indexOfLeft > indexOfRight
592
597
  ) {
593
598
  let messageId
594
599
  if (firstUnorderedNodeDependentOnRight) {
@@ -613,9 +618,7 @@ const sortClasses = createEslintRule({
613
618
  },
614
619
  node: right.node,
615
620
  fix: fixer =>
616
- makeFixes(fixer, nodes, sortedNodes, sourceCode, {
617
- partitionComment: options.partitionByComment,
618
- }),
621
+ makeFixes(fixer, nodes, sortedNodes, sourceCode, options),
619
622
  })
620
623
  }
621
624
  })
@@ -35,6 +35,11 @@ const sortEnums = createEslintRule.createEslintRule({
35
35
  type: 'string',
36
36
  enum: ['asc', 'desc'],
37
37
  },
38
+ matcher: {
39
+ description: 'Specifies the string matcher.',
40
+ type: 'string',
41
+ enum: ['minimatch', 'regex'],
42
+ },
38
43
  ignoreCase: {
39
44
  description:
40
45
  'Controls whether sorting should be case-sensitive or not.',
@@ -87,6 +92,7 @@ const sortEnums = createEslintRule.createEslintRule({
87
92
  type: 'alphabetical',
88
93
  order: 'asc',
89
94
  ignoreCase: true,
95
+ matcher: 'minimatch',
90
96
  sortByValue: false,
91
97
  partitionByComment: false,
92
98
  partitionByNewLine: false,
@@ -115,6 +121,7 @@ const sortEnums = createEslintRule.createEslintRule({
115
121
  partitionByComment: false,
116
122
  partitionByNewLine: false,
117
123
  type: 'alphabetical',
124
+ matcher: 'minimatch',
118
125
  ignoreCase: true,
119
126
  order: 'asc',
120
127
  sortByValue: false,
@@ -174,6 +181,7 @@ const sortEnums = createEslintRule.createEslintRule({
174
181
  isPartitionComment.hasPartitionComment(
175
182
  partitionComment,
176
183
  getCommentsBefore.getCommentsBefore(member, sourceCode),
184
+ options.matcher,
177
185
  )) ||
178
186
  (options.partitionByNewLine &&
179
187
  lastSortingNode &&
@@ -255,9 +263,13 @@ const sortEnums = createEslintRule.createEslintRule({
255
263
  },
256
264
  node: right.node,
257
265
  fix: fixer =>
258
- makeFixes.makeFixes(fixer, nodes, sortedNodes, sourceCode, {
259
- partitionComment,
260
- }),
266
+ makeFixes.makeFixes(
267
+ fixer,
268
+ nodes,
269
+ sortedNodes,
270
+ sourceCode,
271
+ options,
272
+ ),
261
273
  })
262
274
  }
263
275
  })
@@ -37,6 +37,11 @@ const sortEnums = createEslintRule({
37
37
  type: 'string',
38
38
  enum: ['asc', 'desc'],
39
39
  },
40
+ matcher: {
41
+ description: 'Specifies the string matcher.',
42
+ type: 'string',
43
+ enum: ['minimatch', 'regex'],
44
+ },
40
45
  ignoreCase: {
41
46
  description:
42
47
  'Controls whether sorting should be case-sensitive or not.',
@@ -89,6 +94,7 @@ const sortEnums = createEslintRule({
89
94
  type: 'alphabetical',
90
95
  order: 'asc',
91
96
  ignoreCase: true,
97
+ matcher: 'minimatch',
92
98
  sortByValue: false,
93
99
  partitionByComment: false,
94
100
  partitionByNewLine: false,
@@ -117,6 +123,7 @@ const sortEnums = createEslintRule({
117
123
  partitionByComment: false,
118
124
  partitionByNewLine: false,
119
125
  type: 'alphabetical',
126
+ matcher: 'minimatch',
120
127
  ignoreCase: true,
121
128
  order: 'asc',
122
129
  sortByValue: false,
@@ -176,6 +183,7 @@ const sortEnums = createEslintRule({
176
183
  hasPartitionComment(
177
184
  partitionComment,
178
185
  getCommentsBefore(member, sourceCode),
186
+ options.matcher,
179
187
  )) ||
180
188
  (options.partitionByNewLine &&
181
189
  lastSortingNode &&
@@ -250,9 +258,7 @@ const sortEnums = createEslintRule({
250
258
  },
251
259
  node: right.node,
252
260
  fix: fixer =>
253
- makeFixes(fixer, nodes, sortedNodes, sourceCode, {
254
- partitionComment,
255
- }),
261
+ makeFixes(fixer, nodes, sortedNodes, sourceCode, options),
256
262
  })
257
263
  }
258
264
  })