eslint-plugin-perfectionist 4.15.0 → 4.15.1

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 (88) hide show
  1. package/dist/alphabet.d.ts +118 -90
  2. package/dist/index.js +17 -12
  3. package/dist/package.json.js +1 -1
  4. package/dist/rules/sort-array-includes.js +18 -14
  5. package/dist/rules/sort-classes/get-overload-signature-groups.js +1 -1
  6. package/dist/rules/sort-classes.js +13 -22
  7. package/dist/rules/sort-decorators.js +5 -6
  8. package/dist/rules/sort-enums.js +48 -56
  9. package/dist/rules/sort-exports.js +13 -12
  10. package/dist/rules/sort-heritage-clauses.js +5 -4
  11. package/dist/rules/sort-imports/compute-common-selectors.js +47 -40
  12. package/dist/rules/sort-imports/get-typescript-import.js +1 -1
  13. package/dist/rules/sort-imports/is-side-effect-only-group.js +1 -1
  14. package/dist/rules/sort-imports/matches-tsconfig-paths.js +5 -3
  15. package/dist/rules/sort-imports/read-closest-ts-config-by-path.js +3 -3
  16. package/dist/rules/sort-imports/validate-side-effects-configuration.js +1 -1
  17. package/dist/rules/sort-imports.js +128 -126
  18. package/dist/rules/sort-jsx-props.js +23 -24
  19. package/dist/rules/sort-maps.js +18 -17
  20. package/dist/rules/sort-modules.js +33 -31
  21. package/dist/rules/sort-named-exports.js +12 -11
  22. package/dist/rules/sort-named-imports.js +12 -11
  23. package/dist/rules/sort-object-types/build-node-value-getter.js +3 -2
  24. package/dist/rules/sort-object-types/get-custom-groups-compare-options.js +2 -5
  25. package/dist/rules/sort-object-types/is-member-optional.js +1 -1
  26. package/dist/rules/sort-object-types.js +22 -24
  27. package/dist/rules/sort-objects/get-first-node-parent-with-type.js +1 -1
  28. package/dist/rules/sort-objects.js +90 -86
  29. package/dist/rules/sort-sets.js +2 -5
  30. package/dist/rules/sort-switch-case.js +21 -21
  31. package/dist/rules/sort-union-types.js +22 -20
  32. package/dist/rules/sort-variable-declarations.js +26 -33
  33. package/dist/utils/alphabet.js +122 -130
  34. package/dist/utils/common-json-schemas.js +121 -107
  35. package/dist/utils/compare.js +82 -78
  36. package/dist/utils/complete.js +3 -5
  37. package/dist/utils/compute-group.js +3 -10
  38. package/dist/utils/compute-nodes-in-circular-dependencies.js +2 -2
  39. package/dist/utils/convert-boolean-to-sign.js +3 -1
  40. package/dist/utils/create-node-index-map.js +1 -1
  41. package/dist/utils/does-custom-group-match.js +8 -14
  42. package/dist/utils/generate-predefined-groups.js +3 -3
  43. package/dist/utils/get-array-combinations.js +2 -2
  44. package/dist/utils/get-comment-above-that-should-exist.js +5 -4
  45. package/dist/utils/get-comments-before.js +9 -12
  46. package/dist/utils/get-custom-groups-compare-options.js +17 -18
  47. package/dist/utils/get-decorator-name.js +1 -1
  48. package/dist/utils/get-enum-members.js +2 -3
  49. package/dist/utils/get-eslint-disabled-lines.js +5 -5
  50. package/dist/utils/get-eslint-disabled-rules.js +3 -4
  51. package/dist/utils/get-group-index.js +1 -1
  52. package/dist/utils/get-lines-between.js +1 -1
  53. package/dist/utils/get-matching-context-options.js +4 -7
  54. package/dist/utils/get-newlines-between-errors.js +7 -9
  55. package/dist/utils/get-newlines-between-option.js +20 -20
  56. package/dist/utils/get-node-decorators.js +3 -1
  57. package/dist/utils/get-node-range.js +5 -10
  58. package/dist/utils/get-options-with-clean-groups.js +15 -10
  59. package/dist/utils/get-settings.js +2 -2
  60. package/dist/utils/is-comment-above-option.js +3 -2
  61. package/dist/utils/is-newlines-between-option.js +3 -2
  62. package/dist/utils/is-node-dependent-on-other-node.js +1 -1
  63. package/dist/utils/is-node-eslint-disabled.js +3 -2
  64. package/dist/utils/is-node-function-type.js +1 -1
  65. package/dist/utils/is-partition-comment.js +3 -3
  66. package/dist/utils/is-sortable.js +3 -1
  67. package/dist/utils/make-comment-above-fixes.js +4 -6
  68. package/dist/utils/make-comment-after-fixes.js +1 -1
  69. package/dist/utils/make-fixes.js +4 -7
  70. package/dist/utils/make-newlines-between-fixes.js +13 -14
  71. package/dist/utils/make-order-fixes.js +4 -6
  72. package/dist/utils/make-single-node-comment-after-fixes.js +5 -7
  73. package/dist/utils/matches.js +1 -1
  74. package/dist/utils/pairwise.js +1 -1
  75. package/dist/utils/range-to-diff.js +1 -1
  76. package/dist/utils/report-all-errors.js +6 -7
  77. package/dist/utils/report-errors.js +8 -9
  78. package/dist/utils/should-partition.js +5 -4
  79. package/dist/utils/sort-nodes-by-dependencies.js +2 -2
  80. package/dist/utils/sort-nodes-by-groups.js +5 -10
  81. package/dist/utils/sort-nodes.js +3 -3
  82. package/dist/utils/unreachable-case-error.js +7 -0
  83. package/dist/utils/validate-custom-sort-configuration.js +1 -1
  84. package/dist/utils/validate-generated-groups-configuration.js +5 -5
  85. package/dist/utils/validate-newlines-and-partition-configuration.js +2 -2
  86. package/dist/utils/validate-no-duplicated-groups.js +1 -1
  87. package/dist/utils/validate-objects-inside-groups.js +1 -1
  88. package/package.json +3 -6
@@ -1,81 +1,108 @@
1
1
  /**
2
- * Utility class to build alphabets
2
+ * Manages a customizable alphabet for sorting operations.
3
+ *
4
+ * Provides methods to generate, modify, and sort alphabets based on various
5
+ * criteria including Unicode ranges, case prioritization, and locale-specific
6
+ * ordering. Used by the 'custom' sort type to define character precedence.
7
+ *
8
+ * The class supports:
9
+ *
10
+ * - Generating alphabets from strings or Unicode ranges
11
+ * - Case prioritization and manipulation
12
+ * - Character positioning and removal
13
+ * - Multiple sorting strategies (natural, locale, char code).
14
+ *
15
+ * @example
16
+ * // Create a custom alphabet with specific character order
17
+ * const alphabet = Alphabet.generateFrom('aAbBcC')
18
+ * .prioritizeCase('uppercase')
19
+ * .getCharacters()
20
+ * // Returns: 'AaBbCc'
3
21
  */
4
22
  export declare class Alphabet {
5
- private _characters
23
+ private characters
6
24
  private constructor()
7
25
  /**
8
26
  * Generates an alphabet from the given characters.
9
- * @param {string|string[]} values - The characters to generate the alphabet from
10
- * @returns {Alphabet} - The wrapped alphabet
27
+ *
28
+ * @param values - The characters to generate the alphabet from.
29
+ * @returns - The wrapped alphabet.
11
30
  */
12
31
  static generateFrom(values: string[] | string): Alphabet
13
32
  /**
14
33
  * Generates an alphabet containing relevant characters from the Unicode
15
34
  * standard. Contains the Unicode planes 0 and 1.
16
- * @returns {Alphabet} - The generated alphabet
35
+ *
36
+ * @returns - The generated alphabet.
17
37
  */
18
38
  static generateRecommendedAlphabet(): Alphabet
19
39
  /**
20
40
  * Generates an alphabet containing all characters from the Unicode standard
21
- * except for irrelevant Unicode planes.
22
- * Contains the Unicode planes 0, 1, 2 and 3.
23
- * @returns {Alphabet} - The generated alphabet
41
+ * except for irrelevant Unicode planes. Contains the Unicode planes 0, 1, 2
42
+ * and 3.
43
+ *
44
+ * @returns - The generated alphabet.
24
45
  */
25
46
  static generateCompleteAlphabet(): Alphabet
26
- private static _convertCodepointToCharacter
47
+ private static getCharactersWithCase
27
48
  /**
28
49
  * Generates an alphabet containing relevant characters from the Unicode
29
50
  * standard.
30
- * @param {number} maxCodePoint - The maximum code point to generate the
31
- * alphabet to
32
- * @returns {Alphabet} - The generated alphabet
51
+ *
52
+ * @param maxCodePoint - The maximum code point to generate the alphabet to.
53
+ * @returns - The generated alphabet.
33
54
  */
34
- private static _generateAlphabetToRange
55
+ private static generateAlphabetToRange
35
56
  /**
36
- * For each character with a lower and upper case, permutes the two cases
37
- * so that the alphabet is ordered by the case priority entered.
38
- * @param {string} casePriority - The case to prioritize
39
- * @returns {Alphabet} - The same alphabet instance with the cases prioritized
57
+ * For each character with a lower and upper case, permutes the two cases so
58
+ * that the alphabet is ordered by the case priority entered.
59
+ *
40
60
  * @example
41
- * Alphabet.generateFrom('aAbBcdCD')
42
- * .prioritizeCase('uppercase') // Returns 'AaBbCDcd'.
61
+ * Alphabet.generateFrom('aAbBcdCD').prioritizeCase('uppercase') // Returns 'AaBbCDcd'.
62
+ *
63
+ * @param casePriority - The case to prioritize.
64
+ * @returns - The same alphabet instance with the cases prioritized.
43
65
  */
44
66
  prioritizeCase(casePriority: 'lowercase' | 'uppercase'): this
45
67
  /**
46
68
  * Adds specific characters to the end of the alphabet.
47
- * @param {string|string[]} values - The characters to push to the alphabet
48
- * @returns {Alphabet} - The same alphabet instance without the specified
49
- * characters
69
+ *
50
70
  * @example
51
- * Alphabet.generateFrom('ab')
52
- * .pushCharacters('cd')
53
- * // Returns 'abcd'
71
+ * Alphabet.generateFrom('ab').pushCharacters('cd')
72
+ * // Returns 'abcd'
73
+ *
74
+ * @param values - The characters to push to the alphabet.
75
+ * @returns - The same alphabet instance without the specified characters.
54
76
  */
55
77
  pushCharacters(values: string[] | string): this
56
78
  /**
57
- * Permutes characters with cases so that all characters with the entered case
58
- * are put before the other characters.
59
- * @param {string} caseToComeFirst - The case to put before the other
60
- * characters
61
- * @returns {Alphabet} - The same alphabet instance with all characters with
62
- * case before all the characters with the other case
79
+ * Permutes characters with cases so that all characters with the entered
80
+ * case are put before the other characters.
81
+ *
82
+ * @param caseToComeFirst - The case to put before the other characters.
83
+ * @returns - The same alphabet instance with all characters with case
84
+ * before all the characters with the other case.
63
85
  */
64
86
  placeAllWithCaseBeforeAllWithOtherCase(
65
87
  caseToComeFirst: 'uppercase' | 'lowercase',
66
88
  ): this
67
89
  /**
68
- * Places a specific character right before another character in the alphabet.
69
- * @param {object} params - The parameters for the operation
70
- * @param {string} params.characterBefore - The character to come before
71
- * characterAfter
72
- * @param {string} params.characterAfter - The target character
73
- * @returns {Alphabet} - The same alphabet instance with the specific
74
- * character prioritized
90
+ * Places a specific character right before another character in the
91
+ * alphabet.
92
+ *
75
93
  * @example
76
- * Alphabet.generateFrom('ab-cd/')
77
- * .placeCharacterBefore({ characterBefore: '/', characterAfter: '-' })
78
- * // Returns 'ab/-cd'
94
+ * Alphabet.generateFrom('ab-cd/').placeCharacterBefore({
95
+ * characterBefore: '/',
96
+ * characterAfter: '-',
97
+ * })
98
+ * // Returns 'ab/-cd'
99
+ *
100
+ * @param params - The parameters for the operation.
101
+ * @param params.characterBefore - The character to come before
102
+ * characterAfter.
103
+ * @param params.characterAfter - The target character.
104
+ * @returns - The same alphabet instance with the specific character
105
+ * prioritized.
79
106
  */
80
107
  placeCharacterBefore({
81
108
  characterBefore,
@@ -85,17 +112,22 @@ export declare class Alphabet {
85
112
  characterAfter: string
86
113
  }): this
87
114
  /**
88
- * Places a specific character right after another character in the alphabet.
89
- * @param {object} params - The parameters for the operation
90
- * @param {string} params.characterBefore - The target character
91
- * @param {string} params.characterAfter - The character to come after
92
- * characterBefore
93
- * @returns {Alphabet} - The same alphabet instance with the specific
94
- * character prioritized
115
+ * Places a specific character right after another character in the
116
+ * alphabet.
117
+ *
95
118
  * @example
96
- * Alphabet.generateFrom('ab-cd/')
97
- * .placeCharacterAfter({ characterBefore: '/', characterAfter: '-' })
98
- * // Returns 'abcd/-'
119
+ * Alphabet.generateFrom('ab-cd/').placeCharacterAfter({
120
+ * characterBefore: '/',
121
+ * characterAfter: '-',
122
+ * })
123
+ * // Returns 'abcd/-'
124
+ *
125
+ * @param params - The parameters for the operation.
126
+ * @param params.characterBefore - The target character.
127
+ * @param params.characterAfter - The character to come after
128
+ * characterBefore.
129
+ * @returns - The same alphabet instance with the specific character
130
+ * prioritized.
99
131
  */
100
132
  placeCharacterAfter({
101
133
  characterBefore,
@@ -106,70 +138,66 @@ export declare class Alphabet {
106
138
  }): this
107
139
  /**
108
140
  * Removes specific characters from the alphabet by their range.
109
- * @param {object} range - The Unicode range to remove characters from
110
- * @param {number} range.start - The starting Unicode codepoint
111
- * @param {number} range.end - The ending Unicode codepoint
112
- * @returns {Alphabet} - The same alphabet instance without the characters
113
- * from the specified range
141
+ *
142
+ * @param range - The Unicode range to remove characters from.
143
+ * @param range.start - The starting Unicode codepoint.
144
+ * @param range.end - The ending Unicode codepoint.
145
+ * @returns - The same alphabet instance without the characters from the
146
+ * specified range.
114
147
  */
115
148
  removeUnicodeRange({ start, end }: { start: number; end: number }): this
116
149
  /**
117
150
  * Sorts the alphabet by the sorting function provided.
118
- * @param {Function} sortingFunction - The sorting function to use
119
- * @returns {Alphabet} - The same alphabet instance sorted by the sorting function provided
151
+ *
152
+ * @param sortingFunction - The sorting function to use.
153
+ * @returns - The same alphabet instance sorted by the sorting function
154
+ * provided.
120
155
  */
121
156
  sortBy(
122
157
  sortingFunction: (characterA: string, characterB: string) => number,
123
158
  ): this
124
- /**
125
- * Removes specific characters from the alphabet.
126
- * @param {string|string[]} values - The characters to remove from the
127
- * alphabet
128
- * @returns {Alphabet} - The same alphabet instance without the specified
129
- * characters
130
- * @example
131
- * Alphabet.generateFrom('abcd')
132
- * .removeCharacters('dcc')
133
- * // Returns 'ab'
134
- */
135
- removeCharacters(values: string[] | string): this
136
159
  /**
137
160
  * Sorts the alphabet by the natural order of the characters using
138
161
  * `natural-orderby`.
139
- * @param {string} locale - The locale to use for sorting
140
- * @returns {Alphabet} - The same alphabet instance sorted by the natural
141
- * order of the characters
162
+ *
163
+ * @param locale - The locale to use for sorting.
164
+ * @returns - The same alphabet instance sorted by the natural order of the
165
+ * characters.
142
166
  */
143
167
  sortByNaturalSort(locale?: string): this
168
+ /**
169
+ * Removes specific characters from the alphabet.
170
+ *
171
+ * @example
172
+ * Alphabet.generateFrom('abcd').removeCharacters('dcc')
173
+ * // Returns 'ab'
174
+ *
175
+ * @param values - The characters to remove from the alphabet.
176
+ * @returns - The same alphabet instance without the specified characters.
177
+ */
178
+ removeCharacters(values: string[] | string): this
144
179
  /**
145
180
  * Sorts the alphabet by the character code point.
146
- * @returns {Alphabet} - The same alphabet instance sorted by the character
147
- * code point
181
+ *
182
+ * @returns - The same alphabet instance sorted by the character code point.
148
183
  */
149
184
  sortByCharCodeAt(): this
150
185
  /**
151
186
  * Sorts the alphabet by the locale order of the characters.
152
- * @param {Intl.LocalesArgument} locales - The locales to use for sorting
153
- * @returns {Alphabet} - The same alphabet instance sorted by the locale
154
- * order of the characters
187
+ *
188
+ * @param locales - The locales to use for sorting.
189
+ * @returns - The same alphabet instance sorted by the locale order of the
190
+ * characters.
155
191
  */
156
192
  sortByLocaleCompare(locales?: Intl.LocalesArgument): this
157
193
  /**
158
194
  * Retrieves the characters from the alphabet.
159
- * @returns {string} The characters from the alphabet
195
+ *
196
+ * @returns The characters from the alphabet.
160
197
  */
161
198
  getCharacters(): string
162
- /**
163
- * Reverses the alphabet.
164
- * @returns {Alphabet} - The same alphabet instance reversed
165
- * @example
166
- * Alphabet.generateFrom('ab')
167
- * .reverse()
168
- * // Returns 'ba'
169
- */
170
- reverse(): this
171
- private _placeCharacterBeforeOrAfter
172
- private _getCharactersWithCase
199
+ private placeCharacterBeforeOrAfter
200
+ private getCharactersWithCase
173
201
  }
174
202
 
175
203
  export {}
package/dist/index.js CHANGED
@@ -49,23 +49,28 @@ let plugin = {
49
49
  name: _package.name,
50
50
  },
51
51
  }
52
- let getRules = options =>
53
- Object.fromEntries(
52
+ function getRules(options) {
53
+ return Object.fromEntries(
54
54
  Object.keys(plugin.rules).map(ruleName => [
55
55
  `${pluginName}/${ruleName}`,
56
56
  ['error', options],
57
57
  ]),
58
58
  )
59
- let createConfig = options => ({
60
- plugins: {
61
- [pluginName]: plugin,
62
- },
63
- rules: getRules(options),
64
- })
65
- let createLegacyConfig = options => ({
66
- rules: getRules(options),
67
- plugins: [pluginName],
68
- })
59
+ }
60
+ function createConfig(options) {
61
+ return {
62
+ plugins: {
63
+ [pluginName]: plugin,
64
+ },
65
+ rules: getRules(options),
66
+ }
67
+ }
68
+ function createLegacyConfig(options) {
69
+ return {
70
+ rules: getRules(options),
71
+ plugins: [pluginName],
72
+ }
73
+ }
69
74
  const index = {
70
75
  ...plugin,
71
76
  configs: {
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' })
3
3
  const name = 'eslint-plugin-perfectionist'
4
- const version = '4.15.0'
4
+ const version = '4.15.1'
5
5
  exports.name = name
6
6
  exports.version = version
@@ -113,7 +113,7 @@ const sortArrayIncludes = createEslintRule.createEslintRule({
113
113
  defaultOptions: [defaultOptions],
114
114
  name: 'sort-array-includes',
115
115
  })
116
- let sortArray = ({ availableMessageIds, elements, context }) => {
116
+ function sortArray({ availableMessageIds, elements, context }) {
117
117
  if (!isSortable.isSortable(elements)) {
118
118
  return
119
119
  }
@@ -146,7 +146,6 @@ let sortArray = ({ availableMessageIds, elements, context }) => {
146
146
  })
147
147
  let formattedMembers = elements.reduce(
148
148
  (accumulator, element) => {
149
- var _a
150
149
  if (element === null) {
151
150
  return accumulator
152
151
  }
@@ -187,8 +186,7 @@ let sortArray = ({ availableMessageIds, elements, context }) => {
187
186
  group,
188
187
  name,
189
188
  }
190
- let lastSortingNode =
191
- (_a = accumulator.at(-1)) == null ? void 0 : _a.at(-1)
189
+ let lastSortingNode = accumulator.at(-1)?.at(-1)
192
190
  if (
193
191
  shouldPartition.shouldPartition({
194
192
  lastSortingNode,
@@ -216,14 +214,10 @@ let sortArray = ({ availableMessageIds, elements, context }) => {
216
214
  groupKindOrder = ['any']
217
215
  }
218
216
  for (let nodes of formattedMembers) {
219
- let filteredGroupKindNodes = groupKindOrder.map(groupKind =>
220
- nodes.filter(
221
- currentNode =>
222
- groupKind === 'any' || currentNode.groupKind === groupKind,
223
- ),
224
- )
225
- let sortNodesExcludingEslintDisabled = ignoreEslintDisabledNodes =>
226
- filteredGroupKindNodes.flatMap(groupedNodes =>
217
+ let sortNodesExcludingEslintDisabled = function (
218
+ ignoreEslintDisabledNodes,
219
+ ) {
220
+ return filteredGroupKindNodes.flatMap(groupedNodes =>
227
221
  sortNodesByGroups.sortNodesByGroups({
228
222
  getOptionsByGroupIndex:
229
223
  getCustomGroupsCompareOptions.buildGetCustomGroupOverriddenOptionsFunction(
@@ -234,6 +228,13 @@ let sortArray = ({ availableMessageIds, elements, context }) => {
234
228
  nodes: groupedNodes,
235
229
  }),
236
230
  )
231
+ }
232
+ let filteredGroupKindNodes = groupKindOrder.map(groupKind =>
233
+ nodes.filter(
234
+ currentNode =>
235
+ groupKind === 'any' || currentNode.groupKind === groupKind,
236
+ ),
237
+ )
237
238
  reportAllErrors.reportAllErrors({
238
239
  sortNodesExcludingEslintDisabled,
239
240
  availableMessageIds,
@@ -244,8 +245,11 @@ let sortArray = ({ availableMessageIds, elements, context }) => {
244
245
  })
245
246
  }
246
247
  }
247
- let getNodeName = ({ sourceCode, element }) =>
248
- element.type === 'Literal' ? `${element.value}` : sourceCode.getText(element)
248
+ function getNodeName({ sourceCode, element }) {
249
+ return element.type === 'Literal'
250
+ ? `${element.value}`
251
+ : sourceCode.getText(element)
252
+ }
249
253
  exports.default = sortArrayIncludes
250
254
  exports.defaultOptions = defaultOptions
251
255
  exports.jsonSchema = jsonSchema
@@ -1,7 +1,7 @@
1
1
  'use strict'
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' })
3
3
  const isSortable = require('../../utils/is-sortable.js')
4
- let getOverloadSignatureGroups = members => {
4
+ function getOverloadSignatureGroups(members) {
5
5
  let methods = members
6
6
  .filter(
7
7
  member =>
@@ -67,7 +67,6 @@ let defaultOptions = {
67
67
  const sortClasses = createEslintRule.createEslintRule({
68
68
  create: context => ({
69
69
  ClassBody: node => {
70
- var _a
71
70
  if (!isSortable.isSortable(node.body)) {
72
71
  return
73
72
  }
@@ -93,9 +92,10 @@ const sortClasses = createEslintRule.createEslintRule({
93
92
  ruleName: id,
94
93
  sourceCode,
95
94
  })
96
- let className = (_a = node.parent.id) == null ? void 0 : _a.name
97
- let getDependencyName = props =>
98
- `${props.isStatic ? 'static ' : ''}${props.isPrivateHash ? '#' : ''}${props.nodeNameWithoutStartingHash}`
95
+ let className = node.parent.id?.name
96
+ function getDependencyName(props) {
97
+ return `${props.isStatic ? 'static ' : ''}${props.isPrivateHash ? '#' : ''}${props.nodeNameWithoutStartingHash}`
98
+ }
99
99
  let classMethodsDependencyNames = new Set(
100
100
  node.body
101
101
  .map(member => {
@@ -114,9 +114,9 @@ const sortClasses = createEslintRule.createEslintRule({
114
114
  })
115
115
  .filter(Boolean),
116
116
  )
117
- let extractDependencies = (expression, isMemberStatic) => {
117
+ function extractDependencies(expression, isMemberStatic) {
118
118
  let dependencies = []
119
- let checkNode = nodeValue => {
119
+ function checkNode(nodeValue) {
120
120
  if (
121
121
  nodeValue.type === 'MemberExpression' &&
122
122
  (nodeValue.object.type === 'ThisExpression' ||
@@ -214,7 +214,7 @@ const sortClasses = createEslintRule.createEslintRule({
214
214
  }
215
215
  }
216
216
  }
217
- let traverseNode = nodeValue => {
217
+ function traverseNode(nodeValue) {
218
218
  if (Array.isArray(nodeValue)) {
219
219
  for (let nodeItem of nodeValue) {
220
220
  traverseNode(nodeItem)
@@ -230,7 +230,6 @@ const sortClasses = createEslintRule.createEslintRule({
230
230
  getOverloadSignatureGroups.getOverloadSignatureGroups(node.body)
231
231
  let formattedNodes = node.body.reduce(
232
232
  (accumulator, member) => {
233
- var _a2, _b, _c, _d, _e
234
233
  let name
235
234
  let dependencies = []
236
235
  if (member.type === 'StaticBlock') {
@@ -238,9 +237,7 @@ const sortClasses = createEslintRule.createEslintRule({
238
237
  } else if (member.type === 'TSIndexSignature') {
239
238
  name = sourceCode.text.slice(
240
239
  member.range.at(0),
241
- ((_a2 = member.typeAnnotation) == null
242
- ? void 0
243
- : _a2.range.at(0)) ?? member.range.at(1),
240
+ member.typeAnnotation?.range.at(0) ?? member.range.at(1),
244
241
  )
245
242
  } else if (member.key.type === 'Identifier') {
246
243
  ;({ name } = member.key)
@@ -302,10 +299,8 @@ const sortClasses = createEslintRule.createEslintRule({
302
299
  modifiers.push('optional')
303
300
  }
304
301
  if (
305
- ((_b = member.value) == null ? void 0 : _b.type) ===
306
- 'ArrowFunctionExpression' ||
307
- ((_c = member.value) == null ? void 0 : _c.type) ===
308
- 'FunctionExpression'
302
+ member.value?.type === 'ArrowFunctionExpression' ||
303
+ member.value?.type === 'FunctionExpression'
309
304
  ) {
310
305
  if (member.value.async) {
311
306
  modifiers.push('async')
@@ -419,10 +414,7 @@ const sortClasses = createEslintRule.createEslintRule({
419
414
  overloadSignatures.includes(member),
420
415
  )
421
416
  let overloadSignatureGroupMember =
422
- (_d = overloadSignatureGroups[overloadSignatureGroupMemberIndex]) ==
423
- null
424
- ? void 0
425
- : _d.at(-1)
417
+ overloadSignatureGroups[overloadSignatureGroupMemberIndex]?.at(-1)
426
418
  let sortingNode = {
427
419
  dependencyNames: [
428
420
  getDependencyName({
@@ -453,8 +445,7 @@ const sortClasses = createEslintRule.createEslintRule({
453
445
  group,
454
446
  name,
455
447
  }
456
- let lastSortingNode =
457
- (_e = accumulator.at(-1)) == null ? void 0 : _e.at(-1)
448
+ let lastSortingNode = accumulator.at(-1)?.at(-1)
458
449
  if (
459
450
  shouldPartition.shouldPartition({
460
451
  lastSortingNode,
@@ -473,7 +464,7 @@ const sortClasses = createEslintRule.createEslintRule({
473
464
  },
474
465
  [[]],
475
466
  )
476
- let sortNodesExcludingEslintDisabled = ignoreEslintDisabledNodes => {
467
+ function sortNodesExcludingEslintDisabled(ignoreEslintDisabledNodes) {
477
468
  let nodesSortedByGroups = formattedNodes.flatMap(nodes2 =>
478
469
  sortNodesByGroups.sortNodesByGroups({
479
470
  isNodeIgnored: sortingNode =>
@@ -151,7 +151,7 @@ const sortDecorators = createEslintRule.createEslintRule({
151
151
  defaultOptions: [defaultOptions],
152
152
  name: 'sort-decorators',
153
153
  })
154
- let sortDecorators$1 = (context, options, decorators) => {
154
+ function sortDecorators$1(context, options, decorators) {
155
155
  if (!isSortable.isSortable(decorators)) {
156
156
  return
157
157
  }
@@ -162,7 +162,6 @@ let sortDecorators$1 = (context, options, decorators) => {
162
162
  })
163
163
  let formattedMembers = decorators.reduce(
164
164
  (accumulator, decorator) => {
165
- var _a
166
165
  let name = getDecoratorName.getDecoratorName({
167
166
  sourceCode,
168
167
  decorator,
@@ -182,8 +181,7 @@ let sortDecorators$1 = (context, options, decorators) => {
182
181
  group,
183
182
  name,
184
183
  }
185
- let lastSortingNode =
186
- (_a = accumulator.at(-1)) == null ? void 0 : _a.at(-1)
184
+ let lastSortingNode = accumulator.at(-1)?.at(-1)
187
185
  if (
188
186
  shouldPartition.shouldPartition({
189
187
  lastSortingNode,
@@ -202,8 +200,8 @@ let sortDecorators$1 = (context, options, decorators) => {
202
200
  },
203
201
  [[]],
204
202
  )
205
- let sortNodesExcludingEslintDisabled = ignoreEslintDisabledNodes =>
206
- formattedMembers.flatMap(nodes2 =>
203
+ function sortNodesExcludingEslintDisabled(ignoreEslintDisabledNodes) {
204
+ return formattedMembers.flatMap(nodes2 =>
207
205
  sortNodesByGroups.sortNodesByGroups({
208
206
  getOptionsByGroupIndex: () => ({ options }),
209
207
  ignoreEslintDisabledNodes,
@@ -211,6 +209,7 @@ let sortDecorators$1 = (context, options, decorators) => {
211
209
  nodes: nodes2,
212
210
  }),
213
211
  )
212
+ }
214
213
  let nodes = formattedMembers.flat()
215
214
  reportAllErrors.reportAllErrors({
216
215
  availableMessageIds: {