eslint-plugin-perfectionist 3.6.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 (57) hide show
  1. package/dist/index.d.ts +47 -4
  2. package/dist/rules/sort-array-includes.js +124 -60
  3. package/dist/rules/sort-array-includes.mjs +112 -58
  4. package/dist/rules/sort-astro-attributes.js +26 -45
  5. package/dist/rules/sort-astro-attributes.mjs +18 -34
  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 +70 -41
  9. package/dist/rules/sort-classes.mjs +68 -44
  10. package/dist/rules/sort-enums.js +81 -39
  11. package/dist/rules/sort-enums.mjs +72 -37
  12. package/dist/rules/sort-exports.js +95 -7
  13. package/dist/rules/sort-exports.mjs +91 -12
  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 +93 -107
  17. package/dist/rules/sort-interfaces.mjs +76 -96
  18. package/dist/rules/sort-intersection-types.js +163 -119
  19. package/dist/rules/sort-intersection-types.mjs +153 -113
  20. package/dist/rules/sort-jsx-props.js +28 -47
  21. package/dist/rules/sort-jsx-props.mjs +20 -36
  22. package/dist/rules/sort-maps.js +84 -22
  23. package/dist/rules/sort-maps.mjs +80 -22
  24. package/dist/rules/sort-named-exports.js +99 -31
  25. package/dist/rules/sort-named-exports.mjs +87 -28
  26. package/dist/rules/sort-named-imports.js +98 -31
  27. package/dist/rules/sort-named-imports.mjs +86 -28
  28. package/dist/rules/sort-object-types.js +90 -117
  29. package/dist/rules/sort-object-types.mjs +80 -108
  30. package/dist/rules/sort-objects.js +73 -64
  31. package/dist/rules/sort-objects.mjs +71 -56
  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 +29 -50
  35. package/dist/rules/sort-svelte-attributes.mjs +21 -39
  36. package/dist/rules/sort-union-types.js +163 -119
  37. package/dist/rules/sort-union-types.mjs +153 -113
  38. package/dist/rules/sort-variable-declarations.js +109 -24
  39. package/dist/rules/sort-variable-declarations.mjs +101 -25
  40. package/dist/rules/sort-vue-attributes.js +26 -46
  41. package/dist/rules/sort-vue-attributes.mjs +18 -35
  42. package/dist/utils/compare.js +12 -6
  43. package/dist/utils/compare.mjs +12 -6
  44. package/dist/utils/get-node-range.js +9 -3
  45. package/dist/utils/get-node-range.mjs +9 -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/sort-nodes-by-dependencies.js +16 -0
  51. package/dist/utils/sort-nodes-by-dependencies.mjs +16 -1
  52. package/dist/utils/sort-nodes-by-groups.js +22 -0
  53. package/dist/utils/sort-nodes-by-groups.mjs +20 -0
  54. package/dist/utils/use-groups.js +4 -8
  55. package/dist/utils/use-groups.mjs +4 -13
  56. package/{license → license.md} +1 -1
  57. package/package.json +3 -3
@@ -1,18 +1,16 @@
1
1
  'use strict'
2
2
  const path = require('node:path')
3
3
  const validateGroupsConfiguration = require('../utils/validate-groups-configuration.js')
4
+ const sortNodesByGroups = require('../utils/sort-nodes-by-groups.js')
4
5
  const createEslintRule = require('../utils/create-eslint-rule.js')
5
6
  const getGroupNumber = require('../utils/get-group-number.js')
6
7
  const getSourceCode = require('../utils/get-source-code.js')
7
8
  const rangeToDiff = require('../utils/range-to-diff.js')
8
9
  const getSettings = require('../utils/get-settings.js')
9
- const isPositive = require('../utils/is-positive.js')
10
10
  const useGroups = require('../utils/use-groups.js')
11
11
  const makeFixes = require('../utils/make-fixes.js')
12
- const sortNodes = require('../utils/sort-nodes.js')
13
12
  const pairwise = require('../utils/pairwise.js')
14
13
  const complete = require('../utils/complete.js')
15
- const compare = require('../utils/compare.js')
16
14
  const sortAstroAttributes = createEslintRule.createEslintRule({
17
15
  name: 'sort-astro-attributes',
18
16
  meta: {
@@ -36,6 +34,11 @@ const sortAstroAttributes = createEslintRule.createEslintRule({
36
34
  type: 'string',
37
35
  enum: ['asc', 'desc'],
38
36
  },
37
+ matcher: {
38
+ description: 'Specifies the string matcher.',
39
+ type: 'string',
40
+ enum: ['minimatch', 'regex'],
41
+ },
39
42
  ignoreCase: {
40
43
  description:
41
44
  'Controls whether sorting should be case-sensitive or not.',
@@ -91,6 +94,7 @@ const sortAstroAttributes = createEslintRule.createEslintRule({
91
94
  type: 'alphabetical',
92
95
  order: 'asc',
93
96
  ignoreCase: true,
97
+ matcher: 'minimatch',
94
98
  groups: [],
95
99
  customGroups: {},
96
100
  },
@@ -108,6 +112,7 @@ const sortAstroAttributes = createEslintRule.createEslintRule({
108
112
  let options = complete.complete(context.options.at(0), settings, {
109
113
  type: 'alphabetical',
110
114
  ignoreCase: true,
115
+ matcher: 'minimatch',
111
116
  customGroups: {},
112
117
  order: 'asc',
113
118
  groups: [],
@@ -129,7 +134,7 @@ const sortAstroAttributes = createEslintRule.createEslintRule({
129
134
  ? attribute.name.name
130
135
  : sourceCode.text.slice(...attribute.name.range)
131
136
  let { getGroup, defineGroup, setCustomGroups } =
132
- useGroups.useGroups(options.groups)
137
+ useGroups.useGroups(options)
133
138
  setCustomGroups(options.customGroups, name)
134
139
  if (attribute.type === 'AstroShorthandAttribute') {
135
140
  defineGroup('astro-shorthand')
@@ -152,17 +157,22 @@ const sortAstroAttributes = createEslintRule.createEslintRule({
152
157
  [[]],
153
158
  )
154
159
  for (let nodes of parts) {
160
+ let sortedNodes = sortNodesByGroups.sortNodesByGroups(
161
+ nodes,
162
+ options,
163
+ )
155
164
  pairwise.pairwise(nodes, (left, right) => {
156
- let leftNum = getGroupNumber.getGroupNumber(options.groups, left)
157
- let rightNum = getGroupNumber.getGroupNumber(
158
- options.groups,
159
- right,
160
- )
161
- if (
162
- leftNum > rightNum ||
163
- (leftNum === rightNum &&
164
- isPositive.isPositive(compare.compare(left, right, options)))
165
- ) {
165
+ let indexOfLeft = sortedNodes.indexOf(left)
166
+ let indexOfRight = sortedNodes.indexOf(right)
167
+ if (indexOfLeft > indexOfRight) {
168
+ let leftNum = getGroupNumber.getGroupNumber(
169
+ options.groups,
170
+ left,
171
+ )
172
+ let rightNum = getGroupNumber.getGroupNumber(
173
+ options.groups,
174
+ right,
175
+ )
166
176
  context.report({
167
177
  messageId:
168
178
  leftNum !== rightNum
@@ -175,37 +185,8 @@ const sortAstroAttributes = createEslintRule.createEslintRule({
175
185
  rightGroup: right.group,
176
186
  },
177
187
  node: right.node,
178
- fix: fixer => {
179
- let grouped = {}
180
- for (let currentNode of nodes) {
181
- let groupNum = getGroupNumber.getGroupNumber(
182
- options.groups,
183
- currentNode,
184
- )
185
- if (!(groupNum in grouped)) {
186
- grouped[groupNum] = [currentNode]
187
- } else {
188
- grouped[groupNum] = sortNodes.sortNodes(
189
- [...grouped[groupNum], currentNode],
190
- options,
191
- )
192
- }
193
- }
194
- let sortedNodes = []
195
- for (let group of Object.keys(grouped).sort(
196
- (a, b) => Number(a) - Number(b),
197
- )) {
198
- sortedNodes.push(
199
- ...sortNodes.sortNodes(grouped[group], options),
200
- )
201
- }
202
- return makeFixes.makeFixes(
203
- fixer,
204
- nodes,
205
- sortedNodes,
206
- sourceCode,
207
- )
208
- },
188
+ fix: fixer =>
189
+ makeFixes.makeFixes(fixer, nodes, sortedNodes, sourceCode),
209
190
  })
210
191
  }
211
192
  })
@@ -1,17 +1,15 @@
1
1
  import path from 'node:path'
2
2
  import { validateGroupsConfiguration } from '../utils/validate-groups-configuration.mjs'
3
+ import { sortNodesByGroups } from '../utils/sort-nodes-by-groups.mjs'
3
4
  import { createEslintRule } from '../utils/create-eslint-rule.mjs'
4
5
  import { getGroupNumber } from '../utils/get-group-number.mjs'
5
6
  import { getSourceCode } from '../utils/get-source-code.mjs'
6
7
  import { rangeToDiff } from '../utils/range-to-diff.mjs'
7
8
  import { getSettings } from '../utils/get-settings.mjs'
8
- import { isPositive } from '../utils/is-positive.mjs'
9
9
  import { useGroups } from '../utils/use-groups.mjs'
10
10
  import { makeFixes } from '../utils/make-fixes.mjs'
11
- import { sortNodes } from '../utils/sort-nodes.mjs'
12
11
  import { pairwise } from '../utils/pairwise.mjs'
13
12
  import { complete } from '../utils/complete.mjs'
14
- import { compare } from '../utils/compare.mjs'
15
13
  const sortAstroAttributes = createEslintRule({
16
14
  name: 'sort-astro-attributes',
17
15
  meta: {
@@ -35,6 +33,11 @@ const sortAstroAttributes = createEslintRule({
35
33
  type: 'string',
36
34
  enum: ['asc', 'desc'],
37
35
  },
36
+ matcher: {
37
+ description: 'Specifies the string matcher.',
38
+ type: 'string',
39
+ enum: ['minimatch', 'regex'],
40
+ },
38
41
  ignoreCase: {
39
42
  description:
40
43
  'Controls whether sorting should be case-sensitive or not.',
@@ -90,6 +93,7 @@ const sortAstroAttributes = createEslintRule({
90
93
  type: 'alphabetical',
91
94
  order: 'asc',
92
95
  ignoreCase: true,
96
+ matcher: 'minimatch',
93
97
  groups: [],
94
98
  customGroups: {},
95
99
  },
@@ -107,6 +111,7 @@ const sortAstroAttributes = createEslintRule({
107
111
  let options = complete(context.options.at(0), settings, {
108
112
  type: 'alphabetical',
109
113
  ignoreCase: true,
114
+ matcher: 'minimatch',
110
115
  customGroups: {},
111
116
  order: 'asc',
112
117
  groups: [],
@@ -127,9 +132,8 @@ const sortAstroAttributes = createEslintRule({
127
132
  typeof attribute.name.name === 'string'
128
133
  ? attribute.name.name
129
134
  : sourceCode.text.slice(...attribute.name.range)
130
- let { getGroup, defineGroup, setCustomGroups } = useGroups(
131
- options.groups,
132
- )
135
+ let { getGroup, defineGroup, setCustomGroups } =
136
+ useGroups(options)
133
137
  setCustomGroups(options.customGroups, name)
134
138
  if (attribute.type === 'AstroShorthandAttribute') {
135
139
  defineGroup('astro-shorthand')
@@ -152,14 +156,13 @@ const sortAstroAttributes = createEslintRule({
152
156
  [[]],
153
157
  )
154
158
  for (let nodes of parts) {
159
+ let sortedNodes = sortNodesByGroups(nodes, options)
155
160
  pairwise(nodes, (left, right) => {
156
- let leftNum = getGroupNumber(options.groups, left)
157
- let rightNum = getGroupNumber(options.groups, right)
158
- if (
159
- leftNum > rightNum ||
160
- (leftNum === rightNum &&
161
- isPositive(compare(left, right, options)))
162
- ) {
161
+ let indexOfLeft = sortedNodes.indexOf(left)
162
+ let indexOfRight = sortedNodes.indexOf(right)
163
+ if (indexOfLeft > indexOfRight) {
164
+ let leftNum = getGroupNumber(options.groups, left)
165
+ let rightNum = getGroupNumber(options.groups, right)
163
166
  context.report({
164
167
  messageId:
165
168
  leftNum !== rightNum
@@ -172,27 +175,8 @@ const sortAstroAttributes = createEslintRule({
172
175
  rightGroup: right.group,
173
176
  },
174
177
  node: right.node,
175
- fix: fixer => {
176
- let grouped = {}
177
- for (let currentNode of nodes) {
178
- let groupNum = getGroupNumber(options.groups, currentNode)
179
- if (!(groupNum in grouped)) {
180
- grouped[groupNum] = [currentNode]
181
- } else {
182
- grouped[groupNum] = sortNodes(
183
- [...grouped[groupNum], currentNode],
184
- options,
185
- )
186
- }
187
- }
188
- let sortedNodes = []
189
- for (let group of Object.keys(grouped).sort(
190
- (a, b) => Number(a) - Number(b),
191
- )) {
192
- sortedNodes.push(...sortNodes(grouped[group], options))
193
- }
194
- return makeFixes(fixer, nodes, sortedNodes, sourceCode)
195
- },
178
+ fix: fixer =>
179
+ makeFixes(fixer, nodes, sortedNodes, sourceCode),
196
180
  })
197
181
  }
198
182
  })
@@ -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.',
@@ -45,7 +50,7 @@ const sortClasses = createEslintRule.createEslintRule({
45
50
  },
46
51
  partitionByComment: {
47
52
  description:
48
- 'Allows to use comments to separate the nodes into logical groups.',
53
+ 'Allows to use comments to separate the class members into logical groups.',
49
54
  anyOf: [
50
55
  {
51
56
  type: 'array',
@@ -145,6 +150,8 @@ const sortClasses = createEslintRule.createEslintRule({
145
150
  unexpectedClassesGroupOrder:
146
151
  'Expected "{{right}}" ({{rightGroup}}) to come before "{{left}}" ({{leftGroup}}).',
147
152
  unexpectedClassesOrder: 'Expected "{{right}}" to come before "{{left}}".',
153
+ unexpectedClassesDependencyOrder:
154
+ 'Expected dependency "{{right}}" to come before "{{nodeDependentOnRight}}".',
148
155
  },
149
156
  },
150
157
  defaultOptions: [
@@ -152,6 +159,7 @@ const sortClasses = createEslintRule.createEslintRule({
152
159
  type: 'alphabetical',
153
160
  order: 'asc',
154
161
  ignoreCase: true,
162
+ matcher: 'minimatch',
155
163
  partitionByComment: false,
156
164
  groups: [
157
165
  'index-signature',
@@ -192,6 +200,7 @@ const sortClasses = createEslintRule.createEslintRule({
192
200
  ['get-method', 'set-method'],
193
201
  'unknown',
194
202
  ],
203
+ matcher: 'minimatch',
195
204
  partitionByComment: false,
196
205
  type: 'alphabetical',
197
206
  ignoreCase: true,
@@ -320,6 +329,7 @@ const sortClasses = createEslintRule.createEslintRule({
320
329
  isPartitionComment.hasPartitionComment(
321
330
  options.partitionByComment,
322
331
  comments,
332
+ options.matcher,
323
333
  )
324
334
  ) {
325
335
  accumulator.push([])
@@ -327,7 +337,7 @@ const sortClasses = createEslintRule.createEslintRule({
327
337
  let name
328
338
  let dependencies = []
329
339
  let { getGroup, defineGroup, setCustomGroups } =
330
- useGroups.useGroups(options.groups)
340
+ useGroups.useGroups(options)
331
341
  if (member.type === 'StaticBlock') {
332
342
  name = 'static'
333
343
  } else if (member.type === 'TSIndexSignature') {
@@ -337,12 +347,10 @@ const sortClasses = createEslintRule.createEslintRule({
337
347
  ? void 0
338
348
  : _a2.range.at(0)) ?? member.range.at(1),
339
349
  )
350
+ } else if (member.key.type === 'Identifier') {
351
+ ;({ name } = member.key)
340
352
  } else {
341
- if (member.key.type === 'Identifier') {
342
- ;({ name } = member.key)
343
- } else {
344
- name = sourceCode.text.slice(...member.key.range)
345
- }
353
+ name = sourceCode.text.slice(...member.key.range)
346
354
  }
347
355
  let isPrivateHash =
348
356
  'key' in member && member.key.type === 'PrivateIdentifier'
@@ -495,6 +503,7 @@ const sortClasses = createEslintRule.createEslintRule({
495
503
  modifiers,
496
504
  selectors,
497
505
  decorators,
506
+ matcher: options.matcher,
498
507
  })
499
508
  ) {
500
509
  defineGroup(customGroup.groupName, true)
@@ -532,10 +541,11 @@ const sortClasses = createEslintRule.createEslintRule({
532
541
  },
533
542
  [[]],
534
543
  )
535
- for (let nodes of formattedNodes) {
544
+ let sortedNodes = []
545
+ for (let nodes2 of formattedNodes) {
536
546
  let nodesByNonIgnoredGroupNumber = {}
537
547
  let ignoredNodeIndices = []
538
- for (let [index, sortingNode] of nodes.entries()) {
548
+ for (let [index, sortingNode] of nodes2.entries()) {
539
549
  let groupNum = getGroupNumber.getGroupNumber(
540
550
  options.groups,
541
551
  sortingNode,
@@ -548,7 +558,6 @@ const sortClasses = createEslintRule.createEslintRule({
548
558
  nodesByNonIgnoredGroupNumber[groupNum] ?? []
549
559
  nodesByNonIgnoredGroupNumber[groupNum].push(sortingNode)
550
560
  }
551
- let sortedNodes = []
552
561
  for (let groupNumber of Object.keys(
553
562
  nodesByNonIgnoredGroupNumber,
554
563
  ).sort((a, b) => Number(a) - Number(b))) {
@@ -570,39 +579,59 @@ const sortClasses = createEslintRule.createEslintRule({
570
579
  }
571
580
  }
572
581
  for (let ignoredIndex of ignoredNodeIndices) {
573
- sortedNodes.splice(ignoredIndex, 0, nodes[ignoredIndex])
582
+ sortedNodes.splice(ignoredIndex, 0, nodes2[ignoredIndex])
574
583
  }
575
- sortedNodes =
576
- sortNodesByDependencies.sortNodesByDependencies(sortedNodes)
577
- pairwise.pairwise(nodes, (left, right) => {
578
- let leftNum = getGroupNumber.getGroupNumber(options.groups, left)
579
- let rightNum = getGroupNumber.getGroupNumber(options.groups, right)
580
- let isLeftOrRightIgnored =
581
- leftNum === options.groups.length ||
582
- rightNum === options.groups.length
583
- let indexOfLeft = sortedNodes.indexOf(left)
584
- let indexOfRight = sortedNodes.indexOf(right)
585
- if (!isLeftOrRightIgnored && indexOfLeft > indexOfRight) {
586
- context.report({
587
- messageId:
588
- leftNum !== rightNum
589
- ? 'unexpectedClassesGroupOrder'
590
- : 'unexpectedClassesOrder',
591
- data: {
592
- left: toSingleLine.toSingleLine(left.name),
593
- leftGroup: left.group,
594
- right: toSingleLine.toSingleLine(right.name),
595
- rightGroup: right.group,
596
- },
597
- node: right.node,
598
- fix: fixer =>
599
- makeFixes.makeFixes(fixer, nodes, sortedNodes, sourceCode, {
600
- partitionComment: options.partitionByComment,
601
- }),
602
- })
603
- }
604
- })
605
584
  }
585
+ sortedNodes =
586
+ sortNodesByDependencies.sortNodesByDependencies(sortedNodes)
587
+ let nodes = formattedNodes.flat()
588
+ pairwise.pairwise(nodes, (left, right) => {
589
+ let leftNum = getGroupNumber.getGroupNumber(options.groups, left)
590
+ let rightNum = getGroupNumber.getGroupNumber(options.groups, right)
591
+ let indexOfLeft = sortedNodes.indexOf(left)
592
+ let indexOfRight = sortedNodes.indexOf(right)
593
+ let firstUnorderedNodeDependentOnRight =
594
+ sortNodesByDependencies.getFirstUnorderedNodeDependentOn(
595
+ right,
596
+ nodes,
597
+ )
598
+ if (
599
+ firstUnorderedNodeDependentOnRight ||
600
+ indexOfLeft > indexOfRight
601
+ ) {
602
+ let messageId
603
+ if (firstUnorderedNodeDependentOnRight) {
604
+ messageId = 'unexpectedClassesDependencyOrder'
605
+ } else {
606
+ messageId =
607
+ leftNum !== rightNum
608
+ ? 'unexpectedClassesGroupOrder'
609
+ : 'unexpectedClassesOrder'
610
+ }
611
+ context.report({
612
+ messageId,
613
+ data: {
614
+ left: toSingleLine.toSingleLine(left.name),
615
+ leftGroup: left.group,
616
+ right: toSingleLine.toSingleLine(right.name),
617
+ rightGroup: right.group,
618
+ nodeDependentOnRight:
619
+ firstUnorderedNodeDependentOnRight == null
620
+ ? void 0
621
+ : firstUnorderedNodeDependentOnRight.name,
622
+ },
623
+ node: right.node,
624
+ fix: fixer =>
625
+ makeFixes.makeFixes(
626
+ fixer,
627
+ nodes,
628
+ sortedNodes,
629
+ sourceCode,
630
+ options,
631
+ ),
632
+ })
633
+ }
634
+ })
606
635
  }
607
636
  },
608
637
  }),