eslint-plugin-perfectionist 5.3.0 → 5.4.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.
- package/dist/index.d.ts +4 -1
- package/dist/package.json.js +1 -1
- package/dist/rules/sort-array-includes.js +3 -3
- package/dist/rules/sort-classes/compute-dependencies.js +2 -3
- package/dist/rules/sort-classes/compute-overload-signature-groups.d.ts +13 -0
- package/dist/rules/sort-classes/compute-overload-signature-groups.js +58 -0
- package/dist/rules/sort-classes/types.d.ts +9 -1
- package/dist/rules/sort-classes.d.ts +2 -2
- package/dist/rules/sort-classes.js +32 -48
- package/dist/rules/sort-decorators.js +3 -3
- package/dist/rules/sort-enums/compute-dependencies-by-sorting-node.d.ts +13 -0
- package/dist/rules/sort-enums/compute-dependencies-by-sorting-node.js +51 -0
- package/dist/rules/sort-enums/compute-dependencies.d.ts +14 -0
- package/dist/rules/sort-enums/compute-dependencies.js +73 -0
- package/dist/rules/sort-enums/types.d.ts +2 -0
- package/dist/rules/sort-enums.js +49 -54
- package/dist/rules/sort-export-attributes.js +4 -3
- package/dist/rules/sort-exports.js +2 -3
- package/dist/rules/sort-heritage-clauses.js +3 -3
- package/dist/rules/sort-import-attributes.js +4 -3
- package/dist/rules/sort-imports/comparator-by-options-computer.js +0 -1
- package/dist/rules/sort-imports/compute-dependencies.d.ts +4 -7
- package/dist/rules/sort-imports/compute-dependency-names.d.ts +2 -5
- package/dist/rules/sort-imports/compute-node-name.d.ts +2 -5
- package/dist/rules/sort-imports/compute-specifier-modifiers.d.ts +2 -5
- package/dist/rules/sort-imports/compute-specifier-name.d.ts +2 -5
- package/dist/rules/sort-imports/is-non-external-reference-ts-import-equals.d.ts +2 -4
- package/dist/rules/sort-imports/is-side-effect-import.d.ts +2 -5
- package/dist/rules/sort-imports/types.d.ts +7 -5
- package/dist/rules/sort-imports.js +29 -11
- package/dist/rules/sort-jsx-props.js +4 -3
- package/dist/rules/sort-maps.js +4 -3
- package/dist/rules/sort-modules/build-comparator-by-options-computer.d.ts +7 -2
- package/dist/rules/sort-modules/build-comparator-by-options-computer.js +5 -37
- package/dist/rules/sort-modules/build-usage-comparator.d.ts +29 -0
- package/dist/rules/sort-modules/build-usage-comparator.js +115 -0
- package/dist/rules/sort-modules/compute-dependencies-by-sorting-node.d.ts +16 -0
- package/dist/rules/sort-modules/compute-dependencies-by-sorting-node.js +127 -0
- package/dist/rules/sort-modules/compute-dependencies.d.ts +2 -0
- package/dist/rules/sort-modules/compute-dependencies.js +9 -2
- package/dist/rules/sort-modules/compute-node-details.d.ts +11 -1
- package/dist/rules/sort-modules/compute-node-details.js +25 -4
- package/dist/rules/sort-modules/compute-overload-signature-groups.d.ts +11 -0
- package/dist/rules/sort-modules/compute-overload-signature-groups.js +67 -0
- package/dist/rules/sort-modules/types.d.ts +10 -4
- package/dist/rules/sort-modules.d.ts +2 -2
- package/dist/rules/sort-modules.js +59 -16
- package/dist/rules/sort-named-exports.js +4 -3
- package/dist/rules/sort-named-imports.js +4 -3
- package/dist/rules/sort-object-types/types.d.ts +1 -5
- package/dist/rules/sort-object-types.js +5 -3
- package/dist/rules/sort-objects/comparator-by-options-computer.d.ts +6 -0
- package/dist/rules/sort-objects/comparator-by-options-computer.js +39 -0
- package/dist/rules/sort-objects/compute-dependencies.d.ts +2 -0
- package/dist/rules/sort-objects/compute-dependencies.js +75 -0
- package/dist/rules/sort-objects/compute-matched-context-options.js +2 -0
- package/dist/rules/sort-objects/is-style-component.d.ts +10 -0
- package/dist/rules/sort-objects/{is-style-node.js → is-style-component.js} +24 -1
- package/dist/rules/sort-objects/types.d.ts +22 -5
- package/dist/rules/sort-objects/types.js +8 -0
- package/dist/rules/sort-objects.js +136 -204
- package/dist/rules/sort-union-types.js +3 -3
- package/dist/rules/sort-variable-declarations/compute-dependencies.d.ts +12 -0
- package/dist/rules/sort-variable-declarations/compute-dependencies.js +74 -0
- package/dist/rules/sort-variable-declarations/compute-node-name.d.ts +17 -0
- package/dist/rules/sort-variable-declarations/compute-node-name.js +15 -0
- package/dist/rules/sort-variable-declarations/types.d.ts +14 -1
- package/dist/rules/sort-variable-declarations.js +50 -108
- package/dist/types/common-groups-options.d.ts +4 -4
- package/dist/utils/{build-default-options-by-group-index-computer.d.ts → build-options-by-group-index-computer.d.ts} +4 -5
- package/dist/utils/{build-default-options-by-group-index-computer.js → build-options-by-group-index-computer.js} +2 -2
- package/dist/utils/build-sorting-node-by-node-map.d.ts +10 -0
- package/dist/utils/build-sorting-node-by-node-map.js +8 -0
- package/dist/utils/compute-consecutive-parent-nodes-by-type.d.ts +6 -0
- package/dist/utils/compute-deep-scope-references.d.ts +13 -0
- package/dist/utils/compute-deep-scope-references.js +10 -0
- package/dist/utils/compute-dependencies-by-sorting-node.d.ts +42 -0
- package/dist/utils/compute-dependencies-by-sorting-node.js +88 -0
- package/dist/utils/compute-dependencies-outside-functions-by-sorting-node.d.ts +13 -0
- package/dist/utils/compute-dependencies-outside-functions-by-sorting-node.js +28 -0
- package/dist/utils/compute-parent-nodes-with-types.d.ts +8 -0
- package/dist/utils/compute-parent-nodes-with-types.js +11 -1
- package/dist/utils/does-sorting-node-have-one-of-dependency-names.d.ts +14 -0
- package/dist/utils/does-sorting-node-have-one-of-dependency-names.js +7 -0
- package/dist/utils/generate-predefined-groups.js +3 -7
- package/dist/utils/get-enum-members.d.ts +4 -4
- package/dist/utils/get-eslint-disabled-lines.js +1 -1
- package/dist/utils/get-group-index.d.ts +4 -4
- package/dist/utils/get-newlines-between-errors.d.ts +6 -3
- package/dist/utils/get-newlines-between-errors.js +1 -1
- package/dist/utils/get-options-with-clean-groups.d.ts +1 -1
- package/dist/utils/json-schemas/common-json-schemas.d.ts +1 -0
- package/dist/utils/json-schemas/common-json-schemas.js +6 -0
- package/dist/utils/make-comment-after-fixes.js +2 -3
- package/dist/utils/overload-signature/build-overload-signature-newlines-between-value-getter.d.ts +13 -0
- package/dist/utils/overload-signature/build-overload-signature-newlines-between-value-getter.js +13 -0
- package/dist/utils/overload-signature/overload-signature-group.d.ts +21 -0
- package/dist/utils/overload-signature/overload-signature-group.js +12 -0
- package/dist/utils/overload-signature/populate-sorting-node-groups-with-overload-signature.d.ts +25 -0
- package/dist/utils/overload-signature/populate-sorting-node-groups-with-overload-signature.js +75 -0
- package/dist/utils/populate-sorting-node-groups-with-dependencies.d.ts +25 -0
- package/dist/utils/populate-sorting-node-groups-with-dependencies.js +37 -0
- package/dist/utils/range-contains-range.d.ts +12 -0
- package/dist/utils/range-contains-range.js +4 -0
- package/dist/utils/report-all-errors.js +3 -4
- package/dist/utils/report-errors.d.ts +1 -1
- package/dist/utils/report-errors.js +1 -1
- package/package.json +2 -2
- package/dist/rules/sort-classes/get-overload-signature-groups.d.ts +0 -10
- package/dist/rules/sort-classes/get-overload-signature-groups.js +0 -33
- package/dist/rules/sort-objects/is-style-node.d.ts +0 -8
package/dist/rules/sort-enums.js
CHANGED
|
@@ -10,18 +10,24 @@ import {
|
|
|
10
10
|
partitionByNewLineJsonSchema,
|
|
11
11
|
partitionByCommentJsonSchema,
|
|
12
12
|
} from '../utils/json-schemas/common-partition-json-schemas.js'
|
|
13
|
+
import {
|
|
14
|
+
useExperimentalDependencyDetectionJsonSchema,
|
|
15
|
+
buildCommonJsonSchemas,
|
|
16
|
+
} from '../utils/json-schemas/common-json-schemas.js'
|
|
17
|
+
import { populateSortingNodeGroupsWithDependencies } from '../utils/populate-sorting-node-groups-with-dependencies.js'
|
|
13
18
|
import { validateNewlinesAndPartitionConfiguration } from '../utils/validate-newlines-and-partition-configuration.js'
|
|
14
|
-
import { buildDefaultOptionsByGroupIndexComputer } from '../utils/build-default-options-by-group-index-computer.js'
|
|
15
19
|
import { buildComparatorByOptionsComputer } from './sort-enums/build-comparator-by-options-computer.js'
|
|
20
|
+
import { computeDependenciesBySortingNode } from './sort-enums/compute-dependencies-by-sorting-node.js'
|
|
21
|
+
import { buildOptionsByGroupIndexComputer } from '../utils/build-options-by-group-index-computer.js'
|
|
16
22
|
import { buildCommonGroupsJsonSchemas } from '../utils/json-schemas/common-groups-json-schemas.js'
|
|
17
23
|
import { validateCustomSortConfiguration } from '../utils/validate-custom-sort-configuration.js'
|
|
18
24
|
import { validateGroupsConfiguration } from '../utils/validate-groups-configuration.js'
|
|
19
|
-
import { buildCommonJsonSchemas } from '../utils/json-schemas/common-json-schemas.js'
|
|
20
25
|
import { additionalCustomGroupMatchOptionsJsonSchema } from './sort-enums/types.js'
|
|
21
26
|
import { sortNodesByDependencies } from '../utils/sort-nodes-by-dependencies.js'
|
|
22
27
|
import { getEslintDisabledLines } from '../utils/get-eslint-disabled-lines.js'
|
|
23
28
|
import { isNodeEslintDisabled } from '../utils/is-node-eslint-disabled.js'
|
|
24
29
|
import { doesCustomGroupMatch } from '../utils/does-custom-group-match.js'
|
|
30
|
+
import { computeDependencies } from './sort-enums/compute-dependencies.js'
|
|
25
31
|
import { sortNodesByGroups } from '../utils/sort-nodes-by-groups.js'
|
|
26
32
|
import { createEslintRule } from '../utils/create-eslint-rule.js'
|
|
27
33
|
import { reportAllErrors } from '../utils/report-all-errors.js'
|
|
@@ -38,6 +44,7 @@ const EXTRA_SPACING_ERROR_ID = 'extraSpacingBetweenEnumsMembers'
|
|
|
38
44
|
const MISSED_SPACING_ERROR_ID = 'missedSpacingBetweenEnumsMembers'
|
|
39
45
|
const DEPENDENCY_ORDER_ERROR_ID = 'unexpectedEnumsDependencyOrder'
|
|
40
46
|
let defaultOptions = {
|
|
47
|
+
useExperimentalDependencyDetection: true,
|
|
41
48
|
fallbackSort: { type: 'unsorted' },
|
|
42
49
|
newlinesInside: 'newlinesBetween',
|
|
43
50
|
sortByValue: 'ifNumericEnum',
|
|
@@ -77,39 +84,10 @@ const sortEnums = createEslintRule({
|
|
|
77
84
|
ruleName: id,
|
|
78
85
|
sourceCode,
|
|
79
86
|
})
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
while (stack.length > 0) {
|
|
84
|
-
let node = stack.pop()
|
|
85
|
-
if (
|
|
86
|
-
node.type === AST_NODE_TYPES.MemberExpression &&
|
|
87
|
-
node.object.type === AST_NODE_TYPES.Identifier &&
|
|
88
|
-
node.object.name === enumName &&
|
|
89
|
-
node.property.type === AST_NODE_TYPES.Identifier
|
|
90
|
-
) {
|
|
91
|
-
dependencies.push(node.property.name)
|
|
92
|
-
} else if (node.type === AST_NODE_TYPES.Identifier) {
|
|
93
|
-
dependencies.push(node.name)
|
|
94
|
-
}
|
|
95
|
-
if ('left' in node) {
|
|
96
|
-
stack.push(node.left)
|
|
97
|
-
}
|
|
98
|
-
if ('right' in node) {
|
|
99
|
-
stack.push(node.right)
|
|
100
|
-
}
|
|
101
|
-
if ('expressions' in node) {
|
|
102
|
-
stack.push(...node.expressions)
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
return dependencies
|
|
106
|
-
}
|
|
107
|
-
let formattedMembers = members.reduce(
|
|
87
|
+
let optionsByGroupIndexComputer =
|
|
88
|
+
buildOptionsByGroupIndexComputer(options)
|
|
89
|
+
let sortingNodeGroups = members.reduce(
|
|
108
90
|
(accumulator, member) => {
|
|
109
|
-
let dependencies = extractDependencies(
|
|
110
|
-
member.initializer,
|
|
111
|
-
enumDeclaration.id.name,
|
|
112
|
-
)
|
|
113
91
|
let name =
|
|
114
92
|
member.id.type === AST_NODE_TYPES.Literal
|
|
115
93
|
? member.id.value
|
|
@@ -128,6 +106,12 @@ const sortEnums = createEslintRule({
|
|
|
128
106
|
})
|
|
129
107
|
let lastSortingNode = accumulator.at(-1)?.at(-1)
|
|
130
108
|
let sortingNode = {
|
|
109
|
+
dependencies: options.useExperimentalDependencyDetection
|
|
110
|
+
? []
|
|
111
|
+
: computeDependencies(
|
|
112
|
+
member.initializer,
|
|
113
|
+
enumDeclaration.id.name,
|
|
114
|
+
),
|
|
131
115
|
value:
|
|
132
116
|
member.initializer?.type === AST_NODE_TYPES.Literal
|
|
133
117
|
? (member.initializer.value?.toString() ?? null)
|
|
@@ -137,7 +121,6 @@ const sortEnums = createEslintRule({
|
|
|
137
121
|
size: rangeToDiff(member, sourceCode),
|
|
138
122
|
dependencyNames: [name],
|
|
139
123
|
node: member,
|
|
140
|
-
dependencies,
|
|
141
124
|
group,
|
|
142
125
|
name,
|
|
143
126
|
}
|
|
@@ -159,26 +142,21 @@ const sortEnums = createEslintRule({
|
|
|
159
142
|
},
|
|
160
143
|
[[]],
|
|
161
144
|
)
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
comparatorByOptionsComputer:
|
|
172
|
-
buildComparatorByOptionsComputer(isNumericEnum),
|
|
173
|
-
ignoreEslintDisabledNodes,
|
|
174
|
-
groups: options.groups,
|
|
175
|
-
nodes: sortingNodes,
|
|
176
|
-
}),
|
|
177
|
-
)
|
|
178
|
-
return sortNodesByDependencies(nodesSortedByGroups, {
|
|
179
|
-
ignoreEslintDisabledNodes,
|
|
145
|
+
if (options.useExperimentalDependencyDetection) {
|
|
146
|
+
let dependenciesBySortingNode = computeDependenciesBySortingNode({
|
|
147
|
+
sortingNodes: sortingNodeGroups.flat(),
|
|
148
|
+
enumName: enumDeclaration.id.name,
|
|
149
|
+
sourceCode,
|
|
150
|
+
})
|
|
151
|
+
sortingNodeGroups = populateSortingNodeGroupsWithDependencies({
|
|
152
|
+
dependenciesBySortingNode,
|
|
153
|
+
sortingNodeGroups,
|
|
180
154
|
})
|
|
181
155
|
}
|
|
156
|
+
let sortingNodes = sortingNodeGroups.flat()
|
|
157
|
+
let isNumericEnum = sortingNodes.every(
|
|
158
|
+
sortingNode => sortingNode.numericValue !== null,
|
|
159
|
+
)
|
|
182
160
|
reportAllErrors({
|
|
183
161
|
availableMessageIds: {
|
|
184
162
|
missedSpacingBetweenMembers: MISSED_SPACING_ERROR_ID,
|
|
@@ -188,10 +166,25 @@ const sortEnums = createEslintRule({
|
|
|
188
166
|
unexpectedOrder: ORDER_ERROR_ID,
|
|
189
167
|
},
|
|
190
168
|
sortNodesExcludingEslintDisabled,
|
|
169
|
+
nodes: sortingNodes,
|
|
191
170
|
options,
|
|
192
171
|
context,
|
|
193
|
-
nodes,
|
|
194
172
|
})
|
|
173
|
+
function sortNodesExcludingEslintDisabled(ignoreEslintDisabledNodes) {
|
|
174
|
+
let nodesSortedByGroups = sortingNodeGroups.flatMap(sortingNodeGroup =>
|
|
175
|
+
sortNodesByGroups({
|
|
176
|
+
comparatorByOptionsComputer:
|
|
177
|
+
buildComparatorByOptionsComputer(isNumericEnum),
|
|
178
|
+
optionsByGroupIndexComputer,
|
|
179
|
+
ignoreEslintDisabledNodes,
|
|
180
|
+
nodes: sortingNodeGroup,
|
|
181
|
+
groups: options.groups,
|
|
182
|
+
}),
|
|
183
|
+
)
|
|
184
|
+
return sortNodesByDependencies(nodesSortedByGroups, {
|
|
185
|
+
ignoreEslintDisabledNodes,
|
|
186
|
+
})
|
|
187
|
+
}
|
|
195
188
|
},
|
|
196
189
|
}),
|
|
197
190
|
meta: {
|
|
@@ -208,6 +201,8 @@ const sortEnums = createEslintRule({
|
|
|
208
201
|
enum: ['always', 'ifNumericEnum', 'never'],
|
|
209
202
|
type: 'string',
|
|
210
203
|
},
|
|
204
|
+
useExperimentalDependencyDetection:
|
|
205
|
+
useExperimentalDependencyDetectionJsonSchema,
|
|
211
206
|
partitionByComment: partitionByCommentJsonSchema,
|
|
212
207
|
partitionByNewLine: partitionByNewLineJsonSchema,
|
|
213
208
|
},
|
|
@@ -10,8 +10,8 @@ import {
|
|
|
10
10
|
MISSED_SPACING_ERROR,
|
|
11
11
|
} from '../utils/report-errors.js'
|
|
12
12
|
import { validateNewlinesAndPartitionConfiguration } from '../utils/validate-newlines-and-partition-configuration.js'
|
|
13
|
-
import { buildDefaultOptionsByGroupIndexComputer } from '../utils/build-default-options-by-group-index-computer.js'
|
|
14
13
|
import { defaultComparatorByOptionsComputer } from '../utils/compare/default-comparator-by-options-computer.js'
|
|
14
|
+
import { buildOptionsByGroupIndexComputer } from '../utils/build-options-by-group-index-computer.js'
|
|
15
15
|
import { buildCommonGroupsJsonSchemas } from '../utils/json-schemas/common-groups-json-schemas.js'
|
|
16
16
|
import { validateCustomSortConfiguration } from '../utils/validate-custom-sort-configuration.js'
|
|
17
17
|
import { validateGroupsConfiguration } from '../utils/validate-groups-configuration.js'
|
|
@@ -68,6 +68,8 @@ const sortExportAttributes = createEslintRule({
|
|
|
68
68
|
ruleName: id,
|
|
69
69
|
sourceCode,
|
|
70
70
|
})
|
|
71
|
+
let optionsByGroupIndexComputer =
|
|
72
|
+
buildOptionsByGroupIndexComputer(options)
|
|
71
73
|
let formattedMembers = [[]]
|
|
72
74
|
for (let attribute of attributes) {
|
|
73
75
|
let name = getAttributeName(attribute, sourceCode)
|
|
@@ -112,9 +114,8 @@ const sortExportAttributes = createEslintRule({
|
|
|
112
114
|
let createSortNodesExcludingEslintDisabled = function (sortingNodes) {
|
|
113
115
|
return function (ignoreEslintDisabledNodes) {
|
|
114
116
|
return sortNodesByGroups({
|
|
115
|
-
optionsByGroupIndexComputer:
|
|
116
|
-
buildDefaultOptionsByGroupIndexComputer(options),
|
|
117
117
|
comparatorByOptionsComputer: defaultComparatorByOptionsComputer,
|
|
118
|
+
optionsByGroupIndexComputer,
|
|
118
119
|
ignoreEslintDisabledNodes,
|
|
119
120
|
groups: options.groups,
|
|
120
121
|
nodes: sortingNodes,
|
|
@@ -16,8 +16,8 @@ import {
|
|
|
16
16
|
allModifiers,
|
|
17
17
|
} from './sort-exports/types.js'
|
|
18
18
|
import { validateNewlinesAndPartitionConfiguration } from '../utils/validate-newlines-and-partition-configuration.js'
|
|
19
|
-
import { buildDefaultOptionsByGroupIndexComputer } from '../utils/build-default-options-by-group-index-computer.js'
|
|
20
19
|
import { defaultComparatorByOptionsComputer } from '../utils/compare/default-comparator-by-options-computer.js'
|
|
20
|
+
import { buildOptionsByGroupIndexComputer } from '../utils/build-options-by-group-index-computer.js'
|
|
21
21
|
import { buildCommonGroupsJsonSchemas } from '../utils/json-schemas/common-groups-json-schemas.js'
|
|
22
22
|
import { validateCustomSortConfiguration } from '../utils/validate-custom-sort-configuration.js'
|
|
23
23
|
import { validateGroupsConfiguration } from '../utils/validate-groups-configuration.js'
|
|
@@ -174,8 +174,7 @@ const sortExports = createEslintRule({
|
|
|
174
174
|
name: 'sort-exports',
|
|
175
175
|
})
|
|
176
176
|
function sortExportNodes({ formattedMembers, context, options }) {
|
|
177
|
-
let optionsByGroupIndexComputer =
|
|
178
|
-
buildDefaultOptionsByGroupIndexComputer(options)
|
|
177
|
+
let optionsByGroupIndexComputer = buildOptionsByGroupIndexComputer(options)
|
|
179
178
|
let nodes = formattedMembers.flat()
|
|
180
179
|
reportAllErrors({
|
|
181
180
|
availableMessageIds: {
|
|
@@ -10,8 +10,8 @@ import {
|
|
|
10
10
|
MISSED_SPACING_ERROR,
|
|
11
11
|
} from '../utils/report-errors.js'
|
|
12
12
|
import { validateNewlinesAndPartitionConfiguration } from '../utils/validate-newlines-and-partition-configuration.js'
|
|
13
|
-
import { buildDefaultOptionsByGroupIndexComputer } from '../utils/build-default-options-by-group-index-computer.js'
|
|
14
13
|
import { defaultComparatorByOptionsComputer } from '../utils/compare/default-comparator-by-options-computer.js'
|
|
14
|
+
import { buildOptionsByGroupIndexComputer } from '../utils/build-options-by-group-index-computer.js'
|
|
15
15
|
import { buildCommonGroupsJsonSchemas } from '../utils/json-schemas/common-groups-json-schemas.js'
|
|
16
16
|
import { validateCustomSortConfiguration } from '../utils/validate-custom-sort-configuration.js'
|
|
17
17
|
import { validateGroupsConfiguration } from '../utils/validate-groups-configuration.js'
|
|
@@ -106,6 +106,7 @@ function sortHeritageClauses$1(context, options, heritageClauses) {
|
|
|
106
106
|
ruleName: id,
|
|
107
107
|
sourceCode,
|
|
108
108
|
})
|
|
109
|
+
let optionsByGroupIndexComputer = buildOptionsByGroupIndexComputer(options)
|
|
109
110
|
let formattedMembers = [[]]
|
|
110
111
|
for (let heritageClause of heritageClauses) {
|
|
111
112
|
let name = getHeritageClauseExpressionName(heritageClause.expression)
|
|
@@ -148,9 +149,8 @@ function sortHeritageClauses$1(context, options, heritageClauses) {
|
|
|
148
149
|
let createSortNodesExcludingEslintDisabled = function (sortingNodes) {
|
|
149
150
|
return function (ignoreEslintDisabledNodes) {
|
|
150
151
|
return sortNodesByGroups({
|
|
151
|
-
optionsByGroupIndexComputer:
|
|
152
|
-
buildDefaultOptionsByGroupIndexComputer(options),
|
|
153
152
|
comparatorByOptionsComputer: defaultComparatorByOptionsComputer,
|
|
153
|
+
optionsByGroupIndexComputer,
|
|
154
154
|
ignoreEslintDisabledNodes,
|
|
155
155
|
groups: options.groups,
|
|
156
156
|
nodes: sortingNodes,
|
|
@@ -10,8 +10,8 @@ import {
|
|
|
10
10
|
MISSED_SPACING_ERROR,
|
|
11
11
|
} from '../utils/report-errors.js'
|
|
12
12
|
import { validateNewlinesAndPartitionConfiguration } from '../utils/validate-newlines-and-partition-configuration.js'
|
|
13
|
-
import { buildDefaultOptionsByGroupIndexComputer } from '../utils/build-default-options-by-group-index-computer.js'
|
|
14
13
|
import { defaultComparatorByOptionsComputer } from '../utils/compare/default-comparator-by-options-computer.js'
|
|
14
|
+
import { buildOptionsByGroupIndexComputer } from '../utils/build-options-by-group-index-computer.js'
|
|
15
15
|
import { buildCommonGroupsJsonSchemas } from '../utils/json-schemas/common-groups-json-schemas.js'
|
|
16
16
|
import { validateCustomSortConfiguration } from '../utils/validate-custom-sort-configuration.js'
|
|
17
17
|
import { validateGroupsConfiguration } from '../utils/validate-groups-configuration.js'
|
|
@@ -68,6 +68,8 @@ const sortImportAttributes = createEslintRule({
|
|
|
68
68
|
ruleName: id,
|
|
69
69
|
sourceCode,
|
|
70
70
|
})
|
|
71
|
+
let optionsByGroupIndexComputer =
|
|
72
|
+
buildOptionsByGroupIndexComputer(options)
|
|
71
73
|
let formattedMembers = [[]]
|
|
72
74
|
for (let attribute of attributes) {
|
|
73
75
|
let name = getAttributeName(attribute, sourceCode)
|
|
@@ -112,9 +114,8 @@ const sortImportAttributes = createEslintRule({
|
|
|
112
114
|
let createSortNodesExcludingEslintDisabled = function (sortingNodes) {
|
|
113
115
|
return function (ignoreEslintDisabledNodes) {
|
|
114
116
|
return sortNodesByGroups({
|
|
115
|
-
optionsByGroupIndexComputer:
|
|
116
|
-
buildDefaultOptionsByGroupIndexComputer(options),
|
|
117
117
|
comparatorByOptionsComputer: defaultComparatorByOptionsComputer,
|
|
118
|
+
optionsByGroupIndexComputer,
|
|
118
119
|
ignoreEslintDisabledNodes,
|
|
119
120
|
groups: options.groups,
|
|
120
121
|
nodes: sortingNodes,
|
|
@@ -10,7 +10,6 @@ let comparatorByOptionsComputer = options => {
|
|
|
10
10
|
switch (options.type) {
|
|
11
11
|
case 'type-import-first':
|
|
12
12
|
return (a, b) => compareTypeImportFirst(a, b, options)
|
|
13
|
-
/* v8 ignore next -- @preserve Untested for now as not a relevant sort for this rule. */
|
|
14
13
|
case 'subgroup-order':
|
|
15
14
|
case 'alphabetical':
|
|
16
15
|
case 'line-length':
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SortImportsNode } from './types.js'
|
|
2
2
|
/**
|
|
3
3
|
* Computes the dependencies of an import-like AST node.
|
|
4
4
|
*
|
|
5
|
+
* @deprecated - To remove when experimental dependency detection is the only
|
|
6
|
+
* option.
|
|
5
7
|
* @param node - The AST node representing an import-like declaration.
|
|
6
8
|
* @returns The names of the dependencies.
|
|
7
9
|
*/
|
|
8
|
-
export declare function computeDependencies(
|
|
9
|
-
node:
|
|
10
|
-
| TSESTree.TSImportEqualsDeclaration
|
|
11
|
-
| TSESTree.VariableDeclaration
|
|
12
|
-
| TSESTree.ImportDeclaration,
|
|
13
|
-
): string[]
|
|
10
|
+
export declare function computeDependencies(node: SortImportsNode): string[]
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TSESTree } from '@typescript-eslint/types'
|
|
2
1
|
import { TSESLint } from '@typescript-eslint/utils'
|
|
2
|
+
import { SortImportsNode } from './types.js'
|
|
3
3
|
/**
|
|
4
4
|
* Computes the dependency names of an import-like AST node.
|
|
5
5
|
*
|
|
@@ -12,9 +12,6 @@ export declare function computeDependencyNames({
|
|
|
12
12
|
sourceCode,
|
|
13
13
|
node,
|
|
14
14
|
}: {
|
|
15
|
-
node:
|
|
16
|
-
| TSESTree.TSImportEqualsDeclaration
|
|
17
|
-
| TSESTree.VariableDeclaration
|
|
18
|
-
| TSESTree.ImportDeclaration
|
|
19
15
|
sourceCode: TSESLint.SourceCode
|
|
16
|
+
node: SortImportsNode
|
|
20
17
|
}): string[]
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TSESTree } from '@typescript-eslint/types'
|
|
2
1
|
import { TSESLint } from '@typescript-eslint/utils'
|
|
2
|
+
import { SortImportsNode } from './types.js'
|
|
3
3
|
/**
|
|
4
4
|
* Computes the name of an import-like AST node.
|
|
5
5
|
*
|
|
@@ -12,9 +12,6 @@ export declare function computeNodeName({
|
|
|
12
12
|
sourceCode,
|
|
13
13
|
node,
|
|
14
14
|
}: {
|
|
15
|
-
node:
|
|
16
|
-
| TSESTree.TSImportEqualsDeclaration
|
|
17
|
-
| TSESTree.VariableDeclaration
|
|
18
|
-
| TSESTree.ImportDeclaration
|
|
19
15
|
sourceCode: TSESLint.SourceCode
|
|
16
|
+
node: SortImportsNode
|
|
20
17
|
}): string
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SortImportsNode } from './types.js'
|
|
2
2
|
type Modifier = 'wildcard' | 'default' | 'named'
|
|
3
3
|
/**
|
|
4
4
|
* Computes the specifier modifiers of an import-like AST node.
|
|
@@ -7,9 +7,6 @@ type Modifier = 'wildcard' | 'default' | 'named'
|
|
|
7
7
|
* @returns A list of specifier modifiers.
|
|
8
8
|
*/
|
|
9
9
|
export declare function computeSpecifierModifiers(
|
|
10
|
-
node:
|
|
11
|
-
| TSESTree.TSImportEqualsDeclaration
|
|
12
|
-
| TSESTree.VariableDeclaration
|
|
13
|
-
| TSESTree.ImportDeclaration,
|
|
10
|
+
node: SortImportsNode,
|
|
14
11
|
): Modifier[]
|
|
15
12
|
export {}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { TSESLint } from '@typescript-eslint/utils'
|
|
2
|
-
import {
|
|
2
|
+
import { SortImportsNode } from './types.js'
|
|
3
3
|
export declare function computeSpecifierName({
|
|
4
4
|
sourceCode,
|
|
5
5
|
node,
|
|
6
6
|
}: {
|
|
7
|
-
node:
|
|
8
|
-
| TSESTree.TSImportEqualsDeclaration
|
|
9
|
-
| TSESTree.VariableDeclaration
|
|
10
|
-
| TSESTree.ImportDeclaration
|
|
11
7
|
sourceCode: TSESLint.SourceCode
|
|
8
|
+
node: SortImportsNode
|
|
12
9
|
}): string | null
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { TSESTree } from '@typescript-eslint/types'
|
|
2
|
+
import { SortImportsNode } from './types.js'
|
|
2
3
|
/**
|
|
3
4
|
* Determines whether the given AST node is a non-external-reference TS import
|
|
4
5
|
* equals declaration.
|
|
@@ -8,8 +9,5 @@ import { TSESTree } from '@typescript-eslint/types'
|
|
|
8
9
|
* declaration; otherwise, false.
|
|
9
10
|
*/
|
|
10
11
|
export declare function isNonExternalReferenceTsImportEquals(
|
|
11
|
-
node:
|
|
12
|
-
| TSESTree.TSImportEqualsDeclaration
|
|
13
|
-
| TSESTree.VariableDeclaration
|
|
14
|
-
| TSESTree.ImportDeclaration,
|
|
12
|
+
node: SortImportsNode,
|
|
15
13
|
): node is TSESTree.TSImportEqualsDeclaration
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TSESLint } from '@typescript-eslint/utils'
|
|
2
|
-
import {
|
|
2
|
+
import { SortImportsNode } from './types.js'
|
|
3
3
|
/**
|
|
4
4
|
* Determines whether the given AST node is a side-effect import.
|
|
5
5
|
*
|
|
@@ -12,9 +12,6 @@ export declare function isSideEffectImport({
|
|
|
12
12
|
sourceCode,
|
|
13
13
|
node,
|
|
14
14
|
}: {
|
|
15
|
-
node:
|
|
16
|
-
| TSESTree.TSImportEqualsDeclaration
|
|
17
|
-
| TSESTree.VariableDeclaration
|
|
18
|
-
| TSESTree.ImportDeclaration
|
|
19
15
|
sourceCode: TSESLint.SourceCode
|
|
16
|
+
node: SortImportsNode
|
|
20
17
|
}): boolean
|
|
@@ -24,6 +24,8 @@ export type Options = Partial<
|
|
|
24
24
|
/** Root directory where to search for the TypeScript config file. */
|
|
25
25
|
rootDir: string
|
|
26
26
|
}
|
|
27
|
+
/** Enables experimental dependency detection. */
|
|
28
|
+
useExperimentalDependencyDetection: boolean
|
|
27
29
|
/**
|
|
28
30
|
* Patterns to identify internal imports. Imports matching these patterns
|
|
29
31
|
* are categorized as 'internal'.
|
|
@@ -58,11 +60,7 @@ export type Options = Partial<
|
|
|
58
60
|
* Represents a sorting node for an import statement. Extends the base sorting
|
|
59
61
|
* node with dependency information and ignore flag.
|
|
60
62
|
*/
|
|
61
|
-
export interface SortImportsSortingNode extends SortingNodeWithDependencies<
|
|
62
|
-
| TSESTree.TSImportEqualsDeclaration
|
|
63
|
-
| TSESTree.VariableDeclaration
|
|
64
|
-
| TSESTree.ImportDeclaration
|
|
65
|
-
> {
|
|
63
|
+
export interface SortImportsSortingNode extends SortingNodeWithDependencies<SortImportsNode> {
|
|
66
64
|
/** The name of the import specifier for sorting purposes. */
|
|
67
65
|
specifierName: string | null
|
|
68
66
|
/** Whether this import is a type-only import. */
|
|
@@ -73,6 +71,10 @@ export interface SortImportsSortingNode extends SortingNodeWithDependencies<
|
|
|
73
71
|
*/
|
|
74
72
|
isIgnored: boolean
|
|
75
73
|
}
|
|
74
|
+
export type SortImportsNode =
|
|
75
|
+
| TSESTree.TSImportEqualsDeclaration
|
|
76
|
+
| TSESTree.VariableDeclaration
|
|
77
|
+
| TSESTree.ImportDeclaration
|
|
76
78
|
export type CustomTypeOption = 'type-import-first' | TypeOption
|
|
77
79
|
/**
|
|
78
80
|
* Union type of all available import selectors. Used to categorize different
|
|
@@ -14,18 +14,21 @@ import {
|
|
|
14
14
|
DEPENDENCY_ORDER_ERROR,
|
|
15
15
|
MISSED_COMMENT_ABOVE_ERROR,
|
|
16
16
|
} from '../utils/report-errors.js'
|
|
17
|
+
import {
|
|
18
|
+
buildRegexJsonSchema,
|
|
19
|
+
useExperimentalDependencyDetectionJsonSchema,
|
|
20
|
+
buildCommonJsonSchemas,
|
|
21
|
+
} from '../utils/json-schemas/common-json-schemas.js'
|
|
17
22
|
import {
|
|
18
23
|
partitionByNewLineJsonSchema,
|
|
19
24
|
partitionByCommentJsonSchema,
|
|
20
25
|
} from '../utils/json-schemas/common-partition-json-schemas.js'
|
|
26
|
+
import { populateSortingNodeGroupsWithDependencies } from '../utils/populate-sorting-node-groups-with-dependencies.js'
|
|
21
27
|
import { validateNewlinesAndPartitionConfiguration } from '../utils/validate-newlines-and-partition-configuration.js'
|
|
22
|
-
import { buildDefaultOptionsByGroupIndexComputer } from '../utils/build-default-options-by-group-index-computer.js'
|
|
23
28
|
import { isNonExternalReferenceTsImportEquals } from './sort-imports/is-non-external-reference-ts-import-equals.js'
|
|
24
|
-
import {
|
|
25
|
-
buildRegexJsonSchema,
|
|
26
|
-
buildCommonJsonSchemas,
|
|
27
|
-
} from '../utils/json-schemas/common-json-schemas.js'
|
|
28
29
|
import { validateSideEffectsConfiguration } from './sort-imports/validate-side-effects-configuration.js'
|
|
30
|
+
import { buildOptionsByGroupIndexComputer } from '../utils/build-options-by-group-index-computer.js'
|
|
31
|
+
import { computeDependenciesBySortingNode } from '../utils/compute-dependencies-by-sorting-node.js'
|
|
29
32
|
import { buildCommonGroupsJsonSchemas } from '../utils/json-schemas/common-groups-json-schemas.js'
|
|
30
33
|
import { validateCustomSortConfiguration } from '../utils/validate-custom-sort-configuration.js'
|
|
31
34
|
import { comparatorByOptionsComputer } from './sort-imports/comparator-by-options-computer.js'
|
|
@@ -73,6 +76,7 @@ let defaultOptions = {
|
|
|
73
76
|
'ts-equals-import',
|
|
74
77
|
'unknown',
|
|
75
78
|
],
|
|
79
|
+
useExperimentalDependencyDetection: true,
|
|
76
80
|
internalPattern: ['^~/.+', '^@/.+'],
|
|
77
81
|
fallbackSort: { type: 'unsorted' },
|
|
78
82
|
partitionByComment: false,
|
|
@@ -200,11 +204,13 @@ const sortImports = createEslintRule({
|
|
|
200
204
|
isSideEffect &&
|
|
201
205
|
!shouldRegroupSideEffectNodes &&
|
|
202
206
|
(!isStyleSideEffect || !shouldRegroupSideEffectStyleNodes),
|
|
207
|
+
dependencies: options.useExperimentalDependencyDetection
|
|
208
|
+
? []
|
|
209
|
+
: computeDependencies(node),
|
|
203
210
|
isEslintDisabled: isNodeEslintDisabled(node, eslintDisabledLines),
|
|
204
211
|
dependencyNames: computeDependencyNames({ sourceCode, node }),
|
|
205
212
|
specifierName: computeSpecifierName({ sourceCode, node }),
|
|
206
213
|
isTypeImport: modifiers.includes('type'),
|
|
207
|
-
dependencies: computeDependencies(node),
|
|
208
214
|
addSafetySemicolonWhenInline: true,
|
|
209
215
|
group,
|
|
210
216
|
size,
|
|
@@ -280,6 +286,8 @@ const sortImports = createEslintRule({
|
|
|
280
286
|
enum: ['node', 'bun'],
|
|
281
287
|
type: 'string',
|
|
282
288
|
},
|
|
289
|
+
useExperimentalDependencyDetection:
|
|
290
|
+
useExperimentalDependencyDetectionJsonSchema,
|
|
283
291
|
partitionByComment: partitionByCommentJsonSchema,
|
|
284
292
|
partitionByNewLine: partitionByNewLineJsonSchema,
|
|
285
293
|
internalPattern: buildRegexJsonSchema(),
|
|
@@ -311,8 +319,7 @@ const sortImports = createEslintRule({
|
|
|
311
319
|
})
|
|
312
320
|
function sortImportNodes({ sortingNodesWithoutPartitionId, options, context }) {
|
|
313
321
|
let { sourceCode } = context
|
|
314
|
-
let optionsByGroupIndexComputer =
|
|
315
|
-
buildDefaultOptionsByGroupIndexComputer(options)
|
|
322
|
+
let optionsByGroupIndexComputer = buildOptionsByGroupIndexComputer(options)
|
|
316
323
|
let contentSeparatedSortingNodeGroups = [[[]]]
|
|
317
324
|
for (let sortingNodeWithoutPartitionId of sortingNodesWithoutPartitionId) {
|
|
318
325
|
let lastGroupWithNoContentBetween = contentSeparatedSortingNodeGroups.at(-1)
|
|
@@ -341,8 +348,19 @@ function sortImportNodes({ sortingNodesWithoutPartitionId, options, context }) {
|
|
|
341
348
|
partitionId: lastGroupWithNoContentBetween.length,
|
|
342
349
|
})
|
|
343
350
|
}
|
|
344
|
-
for (let
|
|
345
|
-
let
|
|
351
|
+
for (let contentSeparatedSortingNodeGroup of contentSeparatedSortingNodeGroups) {
|
|
352
|
+
let sortingNodeGroups = [...contentSeparatedSortingNodeGroup]
|
|
353
|
+
if (options.useExperimentalDependencyDetection) {
|
|
354
|
+
let dependenciesBySortingNode = computeDependenciesBySortingNode({
|
|
355
|
+
sortingNodes: sortingNodeGroups.flat(),
|
|
356
|
+
sourceCode,
|
|
357
|
+
})
|
|
358
|
+
sortingNodeGroups = populateSortingNodeGroupsWithDependencies({
|
|
359
|
+
dependenciesBySortingNode,
|
|
360
|
+
sortingNodeGroups,
|
|
361
|
+
})
|
|
362
|
+
}
|
|
363
|
+
let sortingNodes = sortingNodeGroups.flat()
|
|
346
364
|
reportAllErrors({
|
|
347
365
|
availableMessageIds: {
|
|
348
366
|
unexpectedDependencyOrder: DEPENDENCY_ORDER_ERROR_ID,
|
|
@@ -354,9 +372,9 @@ function sortImportNodes({ sortingNodesWithoutPartitionId, options, context }) {
|
|
|
354
372
|
},
|
|
355
373
|
sortNodesExcludingEslintDisabled:
|
|
356
374
|
createSortNodesExcludingEslintDisabled(sortingNodeGroups),
|
|
375
|
+
nodes: sortingNodes,
|
|
357
376
|
options,
|
|
358
377
|
context,
|
|
359
|
-
nodes,
|
|
360
378
|
})
|
|
361
379
|
}
|
|
362
380
|
function createSortNodesExcludingEslintDisabled(nodeGroups) {
|
|
@@ -16,9 +16,9 @@ import {
|
|
|
16
16
|
allModifiers,
|
|
17
17
|
} from './sort-jsx-props/types.js'
|
|
18
18
|
import { validateNewlinesAndPartitionConfiguration } from '../utils/validate-newlines-and-partition-configuration.js'
|
|
19
|
-
import { buildDefaultOptionsByGroupIndexComputer } from '../utils/build-default-options-by-group-index-computer.js'
|
|
20
19
|
import { defaultComparatorByOptionsComputer } from '../utils/compare/default-comparator-by-options-computer.js'
|
|
21
20
|
import { partitionByNewLineJsonSchema } from '../utils/json-schemas/common-partition-json-schemas.js'
|
|
21
|
+
import { buildOptionsByGroupIndexComputer } from '../utils/build-options-by-group-index-computer.js'
|
|
22
22
|
import { buildCommonGroupsJsonSchemas } from '../utils/json-schemas/common-groups-json-schemas.js'
|
|
23
23
|
import { validateCustomSortConfiguration } from '../utils/validate-custom-sort-configuration.js'
|
|
24
24
|
import { filterOptionsByAllNamesMatch } from '../utils/filter-options-by-all-names-match.js'
|
|
@@ -83,6 +83,8 @@ const sortJsxProps = createEslintRule({
|
|
|
83
83
|
ruleName: id,
|
|
84
84
|
sourceCode,
|
|
85
85
|
})
|
|
86
|
+
let optionsByGroupIndexComputer =
|
|
87
|
+
buildOptionsByGroupIndexComputer(options)
|
|
86
88
|
let formattedMembers = node.openingElement.attributes.reduce(
|
|
87
89
|
(accumulator, attribute) => {
|
|
88
90
|
if (attribute.type === AST_NODE_TYPES.JSXSpreadAttribute) {
|
|
@@ -154,9 +156,8 @@ const sortJsxProps = createEslintRule({
|
|
|
154
156
|
let createSortNodesExcludingEslintDisabled = function (nodes) {
|
|
155
157
|
return function (ignoreEslintDisabledNodes) {
|
|
156
158
|
return sortNodesByGroups({
|
|
157
|
-
optionsByGroupIndexComputer:
|
|
158
|
-
buildDefaultOptionsByGroupIndexComputer(options),
|
|
159
159
|
comparatorByOptionsComputer: defaultComparatorByOptionsComputer,
|
|
160
|
+
optionsByGroupIndexComputer,
|
|
160
161
|
ignoreEslintDisabledNodes,
|
|
161
162
|
groups: options.groups,
|
|
162
163
|
nodes,
|
package/dist/rules/sort-maps.js
CHANGED
|
@@ -13,8 +13,8 @@ import {
|
|
|
13
13
|
buildUseConfigurationIfJsonSchema,
|
|
14
14
|
buildCommonJsonSchemas,
|
|
15
15
|
} from '../utils/json-schemas/common-json-schemas.js'
|
|
16
|
-
import { buildDefaultOptionsByGroupIndexComputer } from '../utils/build-default-options-by-group-index-computer.js'
|
|
17
16
|
import { defaultComparatorByOptionsComputer } from '../utils/compare/default-comparator-by-options-computer.js'
|
|
17
|
+
import { buildOptionsByGroupIndexComputer } from '../utils/build-options-by-group-index-computer.js'
|
|
18
18
|
import { buildCommonGroupsJsonSchemas } from '../utils/json-schemas/common-groups-json-schemas.js'
|
|
19
19
|
import { validateCustomSortConfiguration } from '../utils/validate-custom-sort-configuration.js'
|
|
20
20
|
import { filterOptionsByAllNamesMatch } from '../utils/filter-options-by-all-names-match.js'
|
|
@@ -88,6 +88,8 @@ const sortMaps = createEslintRule({
|
|
|
88
88
|
ruleName: id,
|
|
89
89
|
sourceCode,
|
|
90
90
|
})
|
|
91
|
+
let optionsByGroupIndexComputer =
|
|
92
|
+
buildOptionsByGroupIndexComputer(options)
|
|
91
93
|
let parts = elements.reduce(
|
|
92
94
|
(accumulator, element) => {
|
|
93
95
|
if (
|
|
@@ -150,9 +152,8 @@ const sortMaps = createEslintRule({
|
|
|
150
152
|
let createSortNodesExcludingEslintDisabled = function (sortingNodes) {
|
|
151
153
|
return function (ignoreEslintDisabledNodes) {
|
|
152
154
|
return sortNodesByGroups({
|
|
153
|
-
optionsByGroupIndexComputer:
|
|
154
|
-
buildDefaultOptionsByGroupIndexComputer(options),
|
|
155
155
|
comparatorByOptionsComputer: defaultComparatorByOptionsComputer,
|
|
156
|
+
optionsByGroupIndexComputer,
|
|
156
157
|
ignoreEslintDisabledNodes,
|
|
157
158
|
groups: options.groups,
|
|
158
159
|
nodes: sortingNodes,
|
|
@@ -1,12 +1,17 @@
|
|
|
1
|
+
import { TSESLint } from '@typescript-eslint/utils'
|
|
1
2
|
import { ComparatorByOptionsComputer } from '../../utils/compare/default-comparator-by-options-computer.js'
|
|
2
|
-
import { SortModulesSortingNode,
|
|
3
|
+
import { SortModulesSortingNode, Options } from './types.js'
|
|
3
4
|
export declare function buildComparatorByOptionsComputer({
|
|
5
|
+
useExperimentalDependencyDetection,
|
|
4
6
|
ignoreEslintDisabledNodes,
|
|
5
7
|
sortingNodes,
|
|
8
|
+
sourceCode,
|
|
6
9
|
}: {
|
|
10
|
+
useExperimentalDependencyDetection: boolean
|
|
7
11
|
sortingNodes: SortModulesSortingNode[]
|
|
8
12
|
ignoreEslintDisabledNodes: boolean
|
|
13
|
+
sourceCode: TSESLint.SourceCode
|
|
9
14
|
}): ComparatorByOptionsComputer<
|
|
10
|
-
Required<
|
|
15
|
+
Required<Options[number]>,
|
|
11
16
|
SortModulesSortingNode
|
|
12
17
|
>
|