eslint-plugin-perfectionist 1.2.0 → 1.3.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.js +3 -3
- package/dist/index.mjs +397 -377
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1,97 +1,97 @@
|
|
|
1
1
|
var ae = Object.defineProperty;
|
|
2
|
-
var re = (
|
|
3
|
-
var Q = (
|
|
4
|
-
import { AST_TOKEN_TYPES as
|
|
5
|
-
import { ESLintUtils as se, ASTUtils as
|
|
2
|
+
var re = (a, l, s) => l in a ? ae(a, l, { enumerable: !0, configurable: !0, writable: !0, value: s }) : a[l] = s;
|
|
3
|
+
var Q = (a, l, s) => (re(a, typeof l != "symbol" ? l + "" : l, s), s);
|
|
4
|
+
import { AST_TOKEN_TYPES as L, AST_NODE_TYPES as u } from "@typescript-eslint/types";
|
|
5
|
+
import { ESLintUtils as se, ASTUtils as M } from "@typescript-eslint/utils";
|
|
6
6
|
import ne from "natural-compare-lite";
|
|
7
|
-
import { minimatch as
|
|
7
|
+
import { minimatch as $ } from "minimatch";
|
|
8
8
|
import Z from "is-core-module";
|
|
9
9
|
import oe from "json5";
|
|
10
10
|
import le from "path";
|
|
11
11
|
import ie from "fs";
|
|
12
|
-
let
|
|
13
|
-
(
|
|
14
|
-
), I = (
|
|
15
|
-
let [l, s] =
|
|
12
|
+
let N = se.RuleCreator(
|
|
13
|
+
(a) => `https://eslint-plugin-perfectionist.azat.io/rules/${a}`
|
|
14
|
+
), I = (a) => a.replaceAll(/\s\s+/g, " ").trim(), k = (a) => {
|
|
15
|
+
let [l, s] = a;
|
|
16
16
|
return s - l;
|
|
17
17
|
};
|
|
18
|
-
var i = /* @__PURE__ */ ((
|
|
19
|
-
let
|
|
18
|
+
var i = /* @__PURE__ */ ((a) => (a.alphabetical = "alphabetical", a["line-length"] = "line-length", a.natural = "natural", a))(i || {}), f = /* @__PURE__ */ ((a) => (a.desc = "desc", a.asc = "asc", a))(f || {});
|
|
19
|
+
let A = (a, l, s) => {
|
|
20
20
|
var e, o;
|
|
21
|
-
if ((e = l.dependencies) != null && e.includes(
|
|
21
|
+
if ((e = l.dependencies) != null && e.includes(a.name))
|
|
22
22
|
return !1;
|
|
23
|
-
if ((o =
|
|
23
|
+
if ((o = a.dependencies) != null && o.includes(l.name))
|
|
24
24
|
return !0;
|
|
25
|
-
let n = s.order === "asc" ? 1 : -1, p, r = (
|
|
26
|
-
return s.type === i.alphabetical ? p = (
|
|
27
|
-
}, S = (
|
|
28
|
-
let s = l.getTokenAfter(
|
|
29
|
-
filter: ({ type: n, value: p }) => !(n ===
|
|
25
|
+
let n = s.order === "asc" ? 1 : -1, p, r = (t) => s["ignore-case"] ? t.toLowerCase() : t;
|
|
26
|
+
return s.type === i.alphabetical ? p = (t, d) => r(t.name).localeCompare(r(d.name)) : s.type === i.natural ? p = (t, d) => ne(r(t.name), r(d.name)) : p = (t, d) => t.size - d.size, n * p(a, l) > 0;
|
|
27
|
+
}, S = (a, l) => [...a].sort((s, n) => Number(A(s, n, l)) || -1), pe = (a, l) => {
|
|
28
|
+
let s = l.getTokenAfter(a, {
|
|
29
|
+
filter: ({ type: n, value: p }) => !(n === L.Punctuator && [",", ";"].includes(p)),
|
|
30
30
|
includeComments: !0
|
|
31
31
|
});
|
|
32
|
-
return ((s == null ? void 0 : s.type) ===
|
|
33
|
-
}, F = (
|
|
34
|
-
let [s, n] = l.getTokensBefore(
|
|
35
|
-
filter: ({ type: p, value: r }) => !(p ===
|
|
32
|
+
return ((s == null ? void 0 : s.type) === L.Block || (s == null ? void 0 : s.type) === L.Line) && a.loc.end.line === s.loc.end.line ? s : null;
|
|
33
|
+
}, F = (a, l) => {
|
|
34
|
+
let [s, n] = l.getTokensBefore(a, {
|
|
35
|
+
filter: ({ type: p, value: r }) => !(p === L.Punctuator && [",", ";"].includes(r)),
|
|
36
36
|
includeComments: !0,
|
|
37
37
|
count: 2
|
|
38
38
|
});
|
|
39
|
-
return ((n == null ? void 0 : n.type) ===
|
|
40
|
-
}, T = (
|
|
39
|
+
return ((n == null ? void 0 : n.type) === L.Block || (n == null ? void 0 : n.type) === L.Line) && a.loc.start.line - n.loc.end.line <= 1 && (s == null ? void 0 : s.loc.end.line) !== n.loc.start.line ? n : null;
|
|
40
|
+
}, T = (a, l) => {
|
|
41
41
|
var e;
|
|
42
|
-
let s =
|
|
43
|
-
if (
|
|
42
|
+
let s = a.range.at(0), n = a.range.at(1), p = l.text.slice(s, n);
|
|
43
|
+
if (M.isParenthesized(a, l)) {
|
|
44
44
|
let o = l.getTokenBefore(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
),
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
a,
|
|
46
|
+
M.isOpeningParenToken
|
|
47
|
+
), t = l.getTokenAfter(
|
|
48
|
+
a,
|
|
49
|
+
M.isClosingParenToken
|
|
50
50
|
);
|
|
51
|
-
s = o.range.at(0), n =
|
|
51
|
+
s = o.range.at(0), n = t.range.at(1);
|
|
52
52
|
}
|
|
53
|
-
let r = F(
|
|
53
|
+
let r = F(a, l);
|
|
54
54
|
if (p.endsWith(";") || p.endsWith(",")) {
|
|
55
|
-
let o = l.getTokensAfter(
|
|
55
|
+
let o = l.getTokensAfter(a, {
|
|
56
56
|
includeComments: !0,
|
|
57
57
|
count: 2
|
|
58
58
|
});
|
|
59
|
-
|
|
59
|
+
a.loc.start.line === ((e = o.at(1)) == null ? void 0 : e.loc.start.line) && (n -= 1);
|
|
60
60
|
}
|
|
61
61
|
return r && (s = r.range.at(0)), [s, n];
|
|
62
|
-
},
|
|
62
|
+
}, R = (a, l, s, n) => {
|
|
63
63
|
let p = [];
|
|
64
64
|
return l.forEach(({ node: r }, e) => {
|
|
65
65
|
p.push(
|
|
66
|
-
|
|
66
|
+
a.replaceTextRange(
|
|
67
67
|
T(r, n),
|
|
68
68
|
n.text.slice(...T(s[e].node, n))
|
|
69
69
|
)
|
|
70
70
|
);
|
|
71
71
|
let o = pe(s[e].node, n);
|
|
72
72
|
if (o) {
|
|
73
|
-
let
|
|
73
|
+
let d = [
|
|
74
74
|
n.getTokenBefore(o).range.at(1),
|
|
75
75
|
o.range.at(1)
|
|
76
76
|
];
|
|
77
|
-
p.push(
|
|
77
|
+
p.push(a.replaceTextRange(d, ""));
|
|
78
78
|
let g = n.getTokenAfter(r);
|
|
79
79
|
p.push(
|
|
80
|
-
|
|
80
|
+
a.insertTextAfter(
|
|
81
81
|
(g == null ? void 0 : g.loc.end.line) === r.loc.end.line ? g : r,
|
|
82
|
-
n.text.slice(...
|
|
82
|
+
n.text.slice(...d)
|
|
83
83
|
)
|
|
84
84
|
);
|
|
85
85
|
}
|
|
86
86
|
}), p;
|
|
87
|
-
},
|
|
88
|
-
if (
|
|
89
|
-
for (let s = 1; s <
|
|
90
|
-
let n =
|
|
87
|
+
}, P = (a = {}, l) => Object.assign(l, a), v = (a, l) => {
|
|
88
|
+
if (a.length > 1)
|
|
89
|
+
for (let s = 1; s < a.length; s++) {
|
|
90
|
+
let n = a.at(s - 1), p = a.at(s);
|
|
91
91
|
n && p && l(n, p, s - 1);
|
|
92
92
|
}
|
|
93
93
|
};
|
|
94
|
-
const _ = "sort-array-includes", ce =
|
|
94
|
+
const _ = "sort-array-includes", ce = N({
|
|
95
95
|
name: _,
|
|
96
96
|
meta: {
|
|
97
97
|
type: "suggestion",
|
|
@@ -113,8 +113,8 @@ const _ = "sort-array-includes", ce = A({
|
|
|
113
113
|
default: i.natural
|
|
114
114
|
},
|
|
115
115
|
order: {
|
|
116
|
-
enum: [
|
|
117
|
-
default:
|
|
116
|
+
enum: [f.asc, f.desc],
|
|
117
|
+
default: f.asc
|
|
118
118
|
},
|
|
119
119
|
"ignore-case": {
|
|
120
120
|
type: "boolean",
|
|
@@ -135,42 +135,42 @@ const _ = "sort-array-includes", ce = A({
|
|
|
135
135
|
defaultOptions: [
|
|
136
136
|
{
|
|
137
137
|
type: i.alphabetical,
|
|
138
|
-
order:
|
|
138
|
+
order: f.asc
|
|
139
139
|
}
|
|
140
140
|
],
|
|
141
|
-
create: (
|
|
141
|
+
create: (a) => ({
|
|
142
142
|
MemberExpression: (l) => {
|
|
143
143
|
if ((l.object.type === u.ArrayExpression || l.object.type === u.NewExpression) && l.property.type === u.Identifier && l.property.name === "includes") {
|
|
144
144
|
let s = l.object.type === u.ArrayExpression ? l.object.elements : l.object.arguments;
|
|
145
145
|
if (s.length > 1) {
|
|
146
|
-
let n =
|
|
146
|
+
let n = P(a.options.at(0), {
|
|
147
147
|
type: i.alphabetical,
|
|
148
|
-
order:
|
|
148
|
+
order: f.asc,
|
|
149
149
|
"ignore-case": !1,
|
|
150
150
|
"spread-last": !1
|
|
151
|
-
}), p =
|
|
151
|
+
}), p = a.getSourceCode(), r = s.reduce(
|
|
152
152
|
(e, o) => (o !== null && e.at(0).push({
|
|
153
153
|
name: o.type === u.Literal ? o.raw : p.text.slice(...o.range),
|
|
154
|
-
size:
|
|
154
|
+
size: k(o.range),
|
|
155
155
|
type: o.type,
|
|
156
156
|
node: o
|
|
157
157
|
}), e),
|
|
158
158
|
[[], []]
|
|
159
159
|
).flat();
|
|
160
|
-
|
|
161
|
-
let
|
|
162
|
-
n["spread-last"] && e.node.type === u.Literal && o.node.type === u.SpreadElement ?
|
|
160
|
+
v(r, (e, o) => {
|
|
161
|
+
let t;
|
|
162
|
+
n["spread-last"] && e.node.type === u.Literal && o.node.type === u.SpreadElement ? t = !1 : n["spread-last"] && e.node.type === u.SpreadElement && o.node.type === u.Literal ? t = !0 : t = A(e, o, n), t && a.report({
|
|
163
163
|
messageId: "unexpectedArrayIncludesOrder",
|
|
164
164
|
data: {
|
|
165
165
|
left: I(e.name),
|
|
166
166
|
right: I(o.name)
|
|
167
167
|
},
|
|
168
168
|
node: o.node,
|
|
169
|
-
fix: (
|
|
169
|
+
fix: (d) => {
|
|
170
170
|
let g = S(r, n);
|
|
171
|
-
return n["spread-last"] && g.forEach((
|
|
172
|
-
|
|
173
|
-
}),
|
|
171
|
+
return n["spread-last"] && g.forEach((h, O) => {
|
|
172
|
+
h.node.type === u.SpreadElement && g.push(g.splice(O, 1).at(0));
|
|
173
|
+
}), R(d, r, g, p);
|
|
174
174
|
}
|
|
175
175
|
});
|
|
176
176
|
});
|
|
@@ -178,7 +178,7 @@ const _ = "sort-array-includes", ce = A({
|
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
180
|
})
|
|
181
|
-
}), U = "sort-named-exports", de =
|
|
181
|
+
}), U = "sort-named-exports", de = N({
|
|
182
182
|
name: U,
|
|
183
183
|
meta: {
|
|
184
184
|
type: "suggestion",
|
|
@@ -200,8 +200,8 @@ const _ = "sort-array-includes", ce = A({
|
|
|
200
200
|
default: i.natural
|
|
201
201
|
},
|
|
202
202
|
order: {
|
|
203
|
-
enum: [
|
|
204
|
-
default:
|
|
203
|
+
enum: [f.asc, f.desc],
|
|
204
|
+
default: f.asc
|
|
205
205
|
},
|
|
206
206
|
"ignore-case": {
|
|
207
207
|
type: "boolean",
|
|
@@ -218,36 +218,36 @@ const _ = "sort-array-includes", ce = A({
|
|
|
218
218
|
defaultOptions: [
|
|
219
219
|
{
|
|
220
220
|
type: i.alphabetical,
|
|
221
|
-
order:
|
|
221
|
+
order: f.asc
|
|
222
222
|
}
|
|
223
223
|
],
|
|
224
|
-
create: (
|
|
224
|
+
create: (a) => ({
|
|
225
225
|
ExportNamedDeclaration: (l) => {
|
|
226
226
|
if (l.specifiers.length > 1) {
|
|
227
|
-
let s =
|
|
227
|
+
let s = P(a.options.at(0), {
|
|
228
228
|
type: i.alphabetical,
|
|
229
229
|
"ignore-case": !1,
|
|
230
|
-
order:
|
|
231
|
-
}), n =
|
|
232
|
-
size:
|
|
230
|
+
order: f.asc
|
|
231
|
+
}), n = a.getSourceCode(), p = l.specifiers.map((r) => ({
|
|
232
|
+
size: k(r.range),
|
|
233
233
|
name: r.local.name,
|
|
234
234
|
node: r
|
|
235
235
|
}));
|
|
236
|
-
|
|
237
|
-
|
|
236
|
+
v(p, (r, e) => {
|
|
237
|
+
A(r, e, s) && a.report({
|
|
238
238
|
messageId: "unexpectedNamedExportsOrder",
|
|
239
239
|
data: {
|
|
240
240
|
left: r.name,
|
|
241
241
|
right: e.name
|
|
242
242
|
},
|
|
243
243
|
node: e.node,
|
|
244
|
-
fix: (o) =>
|
|
244
|
+
fix: (o) => R(o, p, S(p, s), n)
|
|
245
245
|
});
|
|
246
246
|
});
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
249
|
})
|
|
250
|
-
}), z = "sort-named-imports", fe =
|
|
250
|
+
}), z = "sort-named-imports", fe = N({
|
|
251
251
|
name: z,
|
|
252
252
|
meta: {
|
|
253
253
|
type: "suggestion",
|
|
@@ -269,8 +269,8 @@ const _ = "sort-array-includes", ce = A({
|
|
|
269
269
|
default: i.natural
|
|
270
270
|
},
|
|
271
271
|
order: {
|
|
272
|
-
enum: [
|
|
273
|
-
default:
|
|
272
|
+
enum: [f.asc, f.desc],
|
|
273
|
+
default: f.asc
|
|
274
274
|
},
|
|
275
275
|
"ignore-case": {
|
|
276
276
|
type: "boolean",
|
|
@@ -287,39 +287,39 @@ const _ = "sort-array-includes", ce = A({
|
|
|
287
287
|
defaultOptions: [
|
|
288
288
|
{
|
|
289
289
|
type: i.alphabetical,
|
|
290
|
-
order:
|
|
290
|
+
order: f.asc
|
|
291
291
|
}
|
|
292
292
|
],
|
|
293
|
-
create: (
|
|
293
|
+
create: (a) => ({
|
|
294
294
|
ImportDeclaration: (l) => {
|
|
295
295
|
let s = l.specifiers.filter(
|
|
296
296
|
({ type: n }) => n === u.ImportSpecifier
|
|
297
297
|
);
|
|
298
298
|
if (s.length > 1) {
|
|
299
|
-
let n =
|
|
299
|
+
let n = P(a.options.at(0), {
|
|
300
300
|
type: i.alphabetical,
|
|
301
301
|
"ignore-case": !1,
|
|
302
|
-
order:
|
|
303
|
-
}), p =
|
|
304
|
-
size:
|
|
302
|
+
order: f.asc
|
|
303
|
+
}), p = a.getSourceCode(), r = s.map((e) => ({
|
|
304
|
+
size: k(e.range),
|
|
305
305
|
name: e.local.name,
|
|
306
306
|
node: e
|
|
307
307
|
}));
|
|
308
|
-
|
|
309
|
-
|
|
308
|
+
v(r, (e, o) => {
|
|
309
|
+
A(e, o, n) && a.report({
|
|
310
310
|
messageId: "unexpectedNamedImportsOrder",
|
|
311
311
|
data: {
|
|
312
312
|
left: e.name,
|
|
313
313
|
right: o.name
|
|
314
314
|
},
|
|
315
315
|
node: o.node,
|
|
316
|
-
fix: (
|
|
316
|
+
fix: (t) => R(t, r, S(r, n), p)
|
|
317
317
|
});
|
|
318
318
|
});
|
|
319
319
|
}
|
|
320
320
|
}
|
|
321
321
|
})
|
|
322
|
-
}), D = "sort-object-types", ue =
|
|
322
|
+
}), D = "sort-object-types", ue = N({
|
|
323
323
|
name: D,
|
|
324
324
|
meta: {
|
|
325
325
|
type: "suggestion",
|
|
@@ -341,8 +341,8 @@ const _ = "sort-array-includes", ce = A({
|
|
|
341
341
|
default: i.natural
|
|
342
342
|
},
|
|
343
343
|
order: {
|
|
344
|
-
enum: [
|
|
345
|
-
default:
|
|
344
|
+
enum: [f.asc, f.desc],
|
|
345
|
+
default: f.asc
|
|
346
346
|
},
|
|
347
347
|
"ignore-case": {
|
|
348
348
|
type: "boolean",
|
|
@@ -359,53 +359,53 @@ const _ = "sort-array-includes", ce = A({
|
|
|
359
359
|
defaultOptions: [
|
|
360
360
|
{
|
|
361
361
|
type: i.alphabetical,
|
|
362
|
-
order:
|
|
362
|
+
order: f.asc
|
|
363
363
|
}
|
|
364
364
|
],
|
|
365
|
-
create: (
|
|
365
|
+
create: (a) => ({
|
|
366
366
|
TSTypeLiteral: (l) => {
|
|
367
367
|
if (l.members.length > 1) {
|
|
368
|
-
let s =
|
|
368
|
+
let s = P(a.options.at(0), {
|
|
369
369
|
type: i.alphabetical,
|
|
370
370
|
"ignore-case": !1,
|
|
371
|
-
order:
|
|
372
|
-
}), n =
|
|
373
|
-
var
|
|
374
|
-
let e, o = n.text.slice(r.range.at(0), r.range.at(1)),
|
|
371
|
+
order: f.asc
|
|
372
|
+
}), n = a.getSourceCode(), p = l.members.map((r) => {
|
|
373
|
+
var h, O;
|
|
374
|
+
let e, o = n.text.slice(r.range.at(0), r.range.at(1)), t = (y) => y.replace(/(,|;)$/, "");
|
|
375
375
|
if (r.type === u.TSPropertySignature)
|
|
376
376
|
r.key.type === u.Identifier ? { name: e } = r.key : r.key.type === u.Literal ? e = `${r.key.value}` : e = n.text.slice(
|
|
377
377
|
r.range.at(0),
|
|
378
|
-
(
|
|
378
|
+
(h = r.typeAnnotation) == null ? void 0 : h.range.at(0)
|
|
379
379
|
);
|
|
380
380
|
else if (r.type === u.TSIndexSignature) {
|
|
381
|
-
let y = ((
|
|
382
|
-
e =
|
|
381
|
+
let y = ((O = r.typeAnnotation) == null ? void 0 : O.range.at(0)) ?? r.range.at(1);
|
|
382
|
+
e = t(n.text.slice(r.range.at(0), y));
|
|
383
383
|
} else
|
|
384
|
-
e =
|
|
384
|
+
e = t(
|
|
385
385
|
n.text.slice(r.range.at(0), r.range.at(1))
|
|
386
386
|
);
|
|
387
387
|
let g = o.endsWith(";") || o.endsWith(",") ? 1 : 0;
|
|
388
388
|
return {
|
|
389
|
-
size:
|
|
389
|
+
size: k(r.range) - g,
|
|
390
390
|
node: r,
|
|
391
391
|
name: e
|
|
392
392
|
};
|
|
393
393
|
});
|
|
394
|
-
|
|
395
|
-
|
|
394
|
+
v(p, (r, e) => {
|
|
395
|
+
A(r, e, s) && a.report({
|
|
396
396
|
messageId: "unexpectedObjectTypesOrder",
|
|
397
397
|
data: {
|
|
398
398
|
left: I(r.name),
|
|
399
399
|
right: I(e.name)
|
|
400
400
|
},
|
|
401
401
|
node: e.node,
|
|
402
|
-
fix: (o) =>
|
|
402
|
+
fix: (o) => R(o, p, S(p, s), n)
|
|
403
403
|
});
|
|
404
404
|
});
|
|
405
405
|
}
|
|
406
406
|
}
|
|
407
407
|
})
|
|
408
|
-
}), J = "sort-map-elements", ge =
|
|
408
|
+
}), J = "sort-map-elements", ge = N({
|
|
409
409
|
name: J,
|
|
410
410
|
meta: {
|
|
411
411
|
type: "suggestion",
|
|
@@ -427,8 +427,8 @@ const _ = "sort-array-includes", ce = A({
|
|
|
427
427
|
default: i.natural
|
|
428
428
|
},
|
|
429
429
|
order: {
|
|
430
|
-
enum: [
|
|
431
|
-
default:
|
|
430
|
+
enum: [f.asc, f.desc],
|
|
431
|
+
default: f.asc
|
|
432
432
|
},
|
|
433
433
|
"ignore-case": {
|
|
434
434
|
type: "boolean",
|
|
@@ -445,45 +445,45 @@ const _ = "sort-array-includes", ce = A({
|
|
|
445
445
|
defaultOptions: [
|
|
446
446
|
{
|
|
447
447
|
type: i.alphabetical,
|
|
448
|
-
order:
|
|
448
|
+
order: f.asc
|
|
449
449
|
}
|
|
450
450
|
],
|
|
451
|
-
create: (
|
|
451
|
+
create: (a) => ({
|
|
452
452
|
NewExpression: (l) => {
|
|
453
453
|
if (l.callee.type === u.Identifier && l.callee.name === "Map" && l.arguments.length && l.arguments[0].type === u.ArrayExpression) {
|
|
454
454
|
let [{ elements: s }] = l.arguments;
|
|
455
455
|
if (s.length > 1) {
|
|
456
|
-
let n =
|
|
456
|
+
let n = P(a.options.at(0), {
|
|
457
457
|
type: i.alphabetical,
|
|
458
458
|
"ignore-case": !1,
|
|
459
|
-
order:
|
|
460
|
-
}), p =
|
|
459
|
+
order: f.asc
|
|
460
|
+
}), p = a.getSourceCode();
|
|
461
461
|
s.reduce(
|
|
462
462
|
(e, o) => (o === null || o.type === u.SpreadElement ? e.push([]) : e.at(-1).push(o), e),
|
|
463
463
|
[[]]
|
|
464
464
|
).forEach((e) => {
|
|
465
|
-
let o = e.map((
|
|
466
|
-
let
|
|
467
|
-
if (
|
|
468
|
-
let [g] =
|
|
469
|
-
g ? g.type === u.Literal ?
|
|
465
|
+
let o = e.map((t) => {
|
|
466
|
+
let d;
|
|
467
|
+
if (t.type === u.ArrayExpression) {
|
|
468
|
+
let [g] = t.elements;
|
|
469
|
+
g ? g.type === u.Literal ? d = g.raw : d = p.text.slice(...g.range) : d = `${g}`;
|
|
470
470
|
} else
|
|
471
|
-
|
|
471
|
+
d = p.text.slice(...t.range);
|
|
472
472
|
return {
|
|
473
|
-
size:
|
|
474
|
-
node:
|
|
475
|
-
name:
|
|
473
|
+
size: k(t.range),
|
|
474
|
+
node: t,
|
|
475
|
+
name: d
|
|
476
476
|
};
|
|
477
477
|
});
|
|
478
|
-
|
|
479
|
-
|
|
478
|
+
v(o, (t, d) => {
|
|
479
|
+
A(t, d, n) && a.report({
|
|
480
480
|
messageId: "unexpectedMapElementsOrder",
|
|
481
481
|
data: {
|
|
482
|
-
left: I(
|
|
483
|
-
right: I(
|
|
482
|
+
left: I(t.name),
|
|
483
|
+
right: I(d.name)
|
|
484
484
|
},
|
|
485
|
-
node:
|
|
486
|
-
fix: (g) =>
|
|
485
|
+
node: d.node,
|
|
486
|
+
fix: (g) => R(g, o, S(o, n), p)
|
|
487
487
|
});
|
|
488
488
|
});
|
|
489
489
|
});
|
|
@@ -491,8 +491,8 @@ const _ = "sort-array-includes", ce = A({
|
|
|
491
491
|
}
|
|
492
492
|
}
|
|
493
493
|
})
|
|
494
|
-
}),
|
|
495
|
-
name:
|
|
494
|
+
}), G = "sort-union-types", me = N({
|
|
495
|
+
name: G,
|
|
496
496
|
meta: {
|
|
497
497
|
type: "suggestion",
|
|
498
498
|
docs: {
|
|
@@ -513,8 +513,8 @@ const _ = "sort-array-includes", ce = A({
|
|
|
513
513
|
default: i.natural
|
|
514
514
|
},
|
|
515
515
|
order: {
|
|
516
|
-
enum: [
|
|
517
|
-
default:
|
|
516
|
+
enum: [f.asc, f.desc],
|
|
517
|
+
default: f.asc
|
|
518
518
|
},
|
|
519
519
|
"ignore-case": {
|
|
520
520
|
type: "boolean",
|
|
@@ -531,35 +531,35 @@ const _ = "sort-array-includes", ce = A({
|
|
|
531
531
|
defaultOptions: [
|
|
532
532
|
{
|
|
533
533
|
type: i.alphabetical,
|
|
534
|
-
order:
|
|
534
|
+
order: f.asc
|
|
535
535
|
}
|
|
536
536
|
],
|
|
537
|
-
create: (
|
|
537
|
+
create: (a) => ({
|
|
538
538
|
TSUnionType: (l) => {
|
|
539
|
-
let s =
|
|
539
|
+
let s = a.getSourceCode(), n = P(a.options.at(0), {
|
|
540
540
|
type: i.alphabetical,
|
|
541
541
|
"ignore-case": !1,
|
|
542
|
-
order:
|
|
542
|
+
order: f.asc
|
|
543
543
|
}), p = l.types.map((r) => ({
|
|
544
544
|
name: s.text.slice(...r.range),
|
|
545
|
-
size:
|
|
545
|
+
size: k(r.range),
|
|
546
546
|
node: r
|
|
547
547
|
}));
|
|
548
|
-
|
|
549
|
-
|
|
548
|
+
v(p, (r, e) => {
|
|
549
|
+
A(r, e, n) && a.report({
|
|
550
550
|
messageId: "unexpectedUnionTypesOrder",
|
|
551
551
|
data: {
|
|
552
552
|
left: I(r.name),
|
|
553
553
|
right: I(e.name)
|
|
554
554
|
},
|
|
555
555
|
node: e.node,
|
|
556
|
-
fix: (o) =>
|
|
556
|
+
fix: (o) => R(o, p, S(p, n), s)
|
|
557
557
|
});
|
|
558
558
|
});
|
|
559
559
|
}
|
|
560
560
|
})
|
|
561
|
-
}),
|
|
562
|
-
name:
|
|
561
|
+
}), W = "sort-interfaces", ye = N({
|
|
562
|
+
name: W,
|
|
563
563
|
meta: {
|
|
564
564
|
type: "suggestion",
|
|
565
565
|
docs: {
|
|
@@ -580,8 +580,8 @@ const _ = "sort-array-includes", ce = A({
|
|
|
580
580
|
default: i.natural
|
|
581
581
|
},
|
|
582
582
|
order: {
|
|
583
|
-
enum: [
|
|
584
|
-
default:
|
|
583
|
+
enum: [f.asc, f.desc],
|
|
584
|
+
default: f.asc
|
|
585
585
|
},
|
|
586
586
|
"ignore-case": {
|
|
587
587
|
type: "boolean",
|
|
@@ -602,23 +602,23 @@ const _ = "sort-array-includes", ce = A({
|
|
|
602
602
|
defaultOptions: [
|
|
603
603
|
{
|
|
604
604
|
type: i.alphabetical,
|
|
605
|
-
order:
|
|
605
|
+
order: f.asc
|
|
606
606
|
}
|
|
607
607
|
],
|
|
608
|
-
create: (
|
|
608
|
+
create: (a) => ({
|
|
609
609
|
TSInterfaceDeclaration: (l) => {
|
|
610
610
|
if (l.body.body.length > 1) {
|
|
611
|
-
let s =
|
|
611
|
+
let s = P(a.options.at(0), {
|
|
612
612
|
type: i.alphabetical,
|
|
613
613
|
"ignore-case": !1,
|
|
614
|
-
order:
|
|
614
|
+
order: f.asc,
|
|
615
615
|
"ignore-pattern": []
|
|
616
616
|
});
|
|
617
617
|
if (!s["ignore-pattern"].some(
|
|
618
|
-
(n) =>
|
|
618
|
+
(n) => $(l.id.name, n)
|
|
619
619
|
)) {
|
|
620
|
-
let n =
|
|
621
|
-
var o,
|
|
620
|
+
let n = a.getSourceCode(), p = l.body.body.map((r) => {
|
|
621
|
+
var o, t, d;
|
|
622
622
|
let e;
|
|
623
623
|
if (r.type === u.TSPropertySignature)
|
|
624
624
|
if (r.key.type === u.Identifier)
|
|
@@ -630,27 +630,27 @@ const _ = "sort-array-includes", ce = A({
|
|
|
630
630
|
e = n.text.slice(r.range.at(0), g);
|
|
631
631
|
}
|
|
632
632
|
else if (r.type === u.TSIndexSignature) {
|
|
633
|
-
let g = ((
|
|
633
|
+
let g = ((t = r.typeAnnotation) == null ? void 0 : t.range.at(0)) ?? r.range.at(1);
|
|
634
634
|
e = n.text.slice(r.range.at(0), g);
|
|
635
635
|
} else {
|
|
636
|
-
let g = ((
|
|
636
|
+
let g = ((d = r.returnType) == null ? void 0 : d.range.at(0)) ?? r.range.at(1);
|
|
637
637
|
e = n.text.slice(r.range.at(0), g);
|
|
638
638
|
}
|
|
639
639
|
return {
|
|
640
|
-
size:
|
|
640
|
+
size: k(r.range),
|
|
641
641
|
node: r,
|
|
642
642
|
name: e
|
|
643
643
|
};
|
|
644
644
|
});
|
|
645
|
-
|
|
646
|
-
|
|
645
|
+
v(p, (r, e) => {
|
|
646
|
+
A(r, e, s) && a.report({
|
|
647
647
|
messageId: "unexpectedInterfacePropertiesOrder",
|
|
648
648
|
data: {
|
|
649
649
|
left: I(r.name),
|
|
650
650
|
right: I(e.name)
|
|
651
651
|
},
|
|
652
652
|
node: e.node,
|
|
653
|
-
fix: (o) =>
|
|
653
|
+
fix: (o) => R(o, p, S(p, s), n)
|
|
654
654
|
});
|
|
655
655
|
});
|
|
656
656
|
}
|
|
@@ -658,12 +658,12 @@ const _ = "sort-array-includes", ce = A({
|
|
|
658
658
|
}
|
|
659
659
|
})
|
|
660
660
|
});
|
|
661
|
-
let ee = (
|
|
661
|
+
let ee = (a, l) => a.reduce((s, n) => {
|
|
662
662
|
let p = l(n);
|
|
663
663
|
return p in s || (s[p] = []), s[p].push(n), s;
|
|
664
664
|
}, {});
|
|
665
|
-
const
|
|
666
|
-
name:
|
|
665
|
+
const X = "sort-jsx-props", he = N({
|
|
666
|
+
name: X,
|
|
667
667
|
meta: {
|
|
668
668
|
type: "suggestion",
|
|
669
669
|
docs: {
|
|
@@ -684,8 +684,8 @@ const G = "sort-jsx-props", he = A({
|
|
|
684
684
|
default: i.natural
|
|
685
685
|
},
|
|
686
686
|
order: {
|
|
687
|
-
enum: [
|
|
688
|
-
default:
|
|
687
|
+
enum: [f.asc, f.desc],
|
|
688
|
+
default: f.asc
|
|
689
689
|
},
|
|
690
690
|
"always-on-top": {
|
|
691
691
|
type: "array",
|
|
@@ -730,81 +730,81 @@ const G = "sort-jsx-props", he = A({
|
|
|
730
730
|
defaultOptions: [
|
|
731
731
|
{
|
|
732
732
|
type: i.alphabetical,
|
|
733
|
-
order:
|
|
733
|
+
order: f.asc
|
|
734
734
|
}
|
|
735
735
|
],
|
|
736
|
-
create: (
|
|
736
|
+
create: (a) => ({
|
|
737
737
|
JSXElement: (l) => {
|
|
738
738
|
if (l.openingElement.attributes.length > 1) {
|
|
739
|
-
let s =
|
|
739
|
+
let s = P(a.options.at(0), {
|
|
740
740
|
type: i.alphabetical,
|
|
741
741
|
shorthand: "ignore",
|
|
742
742
|
multiline: "ignore",
|
|
743
743
|
callback: "ignore",
|
|
744
744
|
"always-on-top": [],
|
|
745
745
|
"ignore-case": !1,
|
|
746
|
-
order:
|
|
747
|
-
}), n =
|
|
746
|
+
order: f.asc
|
|
747
|
+
}), n = a.getSourceCode();
|
|
748
748
|
l.openingElement.attributes.reduce(
|
|
749
749
|
(r, e) => {
|
|
750
750
|
if (e.type === u.JSXSpreadAttribute)
|
|
751
751
|
return r.push([]), r;
|
|
752
752
|
let o = "ignore";
|
|
753
753
|
e.name.type === u.JSXIdentifier && s["always-on-top"].includes(e.name.name) ? o = "exception" : (s.shorthand !== "ignore" && e.value === null && (o = s.shorthand), s.callback !== "ignore" && e.name.type === u.JSXIdentifier && e.name.name.indexOf("on") === 0 && e.value !== null ? o = s.callback : s.multiline !== "ignore" && e.loc.start.line !== e.loc.end.line && (o = s.multiline));
|
|
754
|
-
let
|
|
754
|
+
let t = {
|
|
755
755
|
name: e.name.type === u.JSXNamespacedName ? `${e.name.namespace.name}:${e.name.name.name}` : e.name.name,
|
|
756
|
-
size:
|
|
756
|
+
size: k(e.range),
|
|
757
757
|
node: e,
|
|
758
758
|
position: o
|
|
759
759
|
};
|
|
760
|
-
return r.at(-1).push(
|
|
760
|
+
return r.at(-1).push(t), r;
|
|
761
761
|
},
|
|
762
762
|
[[]]
|
|
763
763
|
).forEach((r) => {
|
|
764
|
-
|
|
765
|
-
let
|
|
764
|
+
v(r, (e, o) => {
|
|
765
|
+
let t;
|
|
766
766
|
if (e.position === "exception" && o.position === "exception")
|
|
767
|
-
|
|
767
|
+
t = s["always-on-top"].indexOf(e.name) > s["always-on-top"].indexOf(o.name);
|
|
768
768
|
else if (e.position === o.position)
|
|
769
|
-
|
|
769
|
+
t = A(e, o, s);
|
|
770
770
|
else {
|
|
771
|
-
let
|
|
771
|
+
let d = {
|
|
772
772
|
exception: 2,
|
|
773
773
|
first: 1,
|
|
774
774
|
ignore: 0,
|
|
775
775
|
last: -1
|
|
776
776
|
};
|
|
777
|
-
|
|
777
|
+
t = d[e.position] < d[o.position];
|
|
778
778
|
}
|
|
779
|
-
|
|
779
|
+
t && a.report({
|
|
780
780
|
messageId: "unexpectedJSXPropsOrder",
|
|
781
781
|
data: {
|
|
782
782
|
left: e.name,
|
|
783
783
|
right: o.name
|
|
784
784
|
},
|
|
785
785
|
node: o.node,
|
|
786
|
-
fix: (
|
|
787
|
-
let g = ee(r, ({ position: y }) => y),
|
|
788
|
-
|
|
786
|
+
fix: (d) => {
|
|
787
|
+
let g = ee(r, ({ position: y }) => y), h = (y) => y in g ? g[y] : [], O = [
|
|
788
|
+
h(
|
|
789
789
|
"exception"
|
|
790
790
|
/* exception */
|
|
791
791
|
).sort(
|
|
792
|
-
(y,
|
|
792
|
+
(y, c) => s["always-on-top"].indexOf(y.name) - s["always-on-top"].indexOf(c.name)
|
|
793
793
|
),
|
|
794
|
-
S(
|
|
794
|
+
S(h(
|
|
795
795
|
"first"
|
|
796
796
|
/* first */
|
|
797
797
|
), s),
|
|
798
|
-
S(
|
|
798
|
+
S(h(
|
|
799
799
|
"ignore"
|
|
800
800
|
/* ignore */
|
|
801
801
|
), s),
|
|
802
|
-
S(
|
|
802
|
+
S(h(
|
|
803
803
|
"last"
|
|
804
804
|
/* last */
|
|
805
805
|
), s)
|
|
806
806
|
].flat();
|
|
807
|
-
return
|
|
807
|
+
return R(d, r, O, n);
|
|
808
808
|
}
|
|
809
809
|
});
|
|
810
810
|
});
|
|
@@ -821,7 +821,7 @@ class te {
|
|
|
821
821
|
}
|
|
822
822
|
}
|
|
823
823
|
Q(te, "_instance");
|
|
824
|
-
const K = "sort-imports", xe =
|
|
824
|
+
const K = "sort-imports", xe = N({
|
|
825
825
|
name: K,
|
|
826
826
|
meta: {
|
|
827
827
|
type: "suggestion",
|
|
@@ -834,6 +834,18 @@ const K = "sort-imports", xe = A({
|
|
|
834
834
|
{
|
|
835
835
|
type: "object",
|
|
836
836
|
properties: {
|
|
837
|
+
"custom-groups": {
|
|
838
|
+
type: "object",
|
|
839
|
+
properties: {
|
|
840
|
+
type: {
|
|
841
|
+
type: "object"
|
|
842
|
+
},
|
|
843
|
+
value: {
|
|
844
|
+
type: "object"
|
|
845
|
+
}
|
|
846
|
+
},
|
|
847
|
+
additionalProperties: !1
|
|
848
|
+
},
|
|
837
849
|
type: {
|
|
838
850
|
enum: [
|
|
839
851
|
i.alphabetical,
|
|
@@ -843,8 +855,8 @@ const K = "sort-imports", xe = A({
|
|
|
843
855
|
default: i.natural
|
|
844
856
|
},
|
|
845
857
|
order: {
|
|
846
|
-
enum: [
|
|
847
|
-
default:
|
|
858
|
+
enum: [f.asc, f.desc],
|
|
859
|
+
default: f.asc
|
|
848
860
|
},
|
|
849
861
|
"ignore-case": {
|
|
850
862
|
type: "boolean",
|
|
@@ -885,30 +897,31 @@ const K = "sort-imports", xe = A({
|
|
|
885
897
|
defaultOptions: [
|
|
886
898
|
{
|
|
887
899
|
type: i.alphabetical,
|
|
888
|
-
order:
|
|
900
|
+
order: f.asc
|
|
889
901
|
}
|
|
890
902
|
],
|
|
891
|
-
create: (
|
|
903
|
+
create: (a) => {
|
|
892
904
|
var o;
|
|
893
|
-
let l =
|
|
905
|
+
let l = P(a.options.at(0), {
|
|
894
906
|
"newlines-between": "always",
|
|
907
|
+
"custom-groups": { type: {}, value: {} },
|
|
895
908
|
"internal-pattern": ["~/**"],
|
|
896
909
|
type: i.alphabetical,
|
|
897
910
|
"read-tsconfig": !1,
|
|
898
|
-
order:
|
|
911
|
+
order: f.asc,
|
|
899
912
|
"ignore-case": !1,
|
|
900
913
|
groups: []
|
|
901
914
|
}), s = [];
|
|
902
915
|
if (l["read-tsconfig"]) {
|
|
903
|
-
let
|
|
904
|
-
(o =
|
|
905
|
-
s.push(
|
|
916
|
+
let t = te.get();
|
|
917
|
+
(o = t.compilerOptions) != null && o.paths && Object.keys(t.compilerOptions.paths).forEach((d) => {
|
|
918
|
+
s.push(d);
|
|
906
919
|
});
|
|
907
920
|
}
|
|
908
|
-
let n =
|
|
909
|
-
let
|
|
910
|
-
(
|
|
911
|
-
),
|
|
921
|
+
let n = a.getSourceCode(), p = [], r = (t) => {
|
|
922
|
+
let d, g = (b) => [".less", ".scss", ".sass", ".styl", ".pcss", ".css", ".sss"].some(
|
|
923
|
+
(E) => b.endsWith(E)
|
|
924
|
+
), h = (b) => [
|
|
912
925
|
"./index.d.js",
|
|
913
926
|
"./index.d.ts",
|
|
914
927
|
"./index.js",
|
|
@@ -916,90 +929,93 @@ const K = "sort-imports", xe = A({
|
|
|
916
929
|
"./index",
|
|
917
930
|
"./",
|
|
918
931
|
"."
|
|
919
|
-
].includes(
|
|
920
|
-
!
|
|
921
|
-
}, m = (
|
|
922
|
-
(
|
|
923
|
-
) || s.some((
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
+
].includes(b), O = (b) => b.indexOf("..") === 0, y = (b) => b.indexOf("./") === 0, c = (b) => {
|
|
933
|
+
!d && l.groups.flat().includes(b) && (d = b);
|
|
934
|
+
}, m = (b) => l["internal-pattern"].length && l["internal-pattern"].some(
|
|
935
|
+
(E) => $(b.source.value, E)
|
|
936
|
+
) || s.some((E) => $(b.source.value, E)), x = (b, E) => {
|
|
937
|
+
Object.entries(l["custom-groups"][b] ?? {}).forEach(
|
|
938
|
+
([w, j]) => {
|
|
939
|
+
Array.isArray(j) && j.some((C) => $(E, C)) && c(w), typeof j == "string" && $(E, j) && c(w);
|
|
940
|
+
}
|
|
941
|
+
);
|
|
942
|
+
};
|
|
943
|
+
return t.importKind === "type" && (t.type === u.ImportDeclaration && (x("type", t.source.value), Z(t.source.value) && c("builtin-type"), m(t) && c("internal-type"), h(t.source.value) && c("index-type"), O(t.source.value) && c("parent-type"), y(t.source.value) && c("sibling-type")), c("type")), !d && t.type === u.ImportDeclaration && (x("value", t.source.value), Z(t.source.value) && c("builtin"), m(t) && c("internal"), g(t.source.value) && c("style"), t.specifiers.length === 0 && c("side-effect"), h(t.source.value) && c("index"), O(t.source.value) && c("parent"), y(t.source.value) && c("sibling"), c("external")), d ?? "unknown";
|
|
944
|
+
}, e = (t) => {
|
|
945
|
+
let d;
|
|
946
|
+
t.type === u.ImportDeclaration ? d = t.source.value : t.moduleReference.type === u.TSExternalModuleReference && t.moduleReference.expression.type === u.Literal ? d = `${t.moduleReference.expression.value}` : d = n.text.slice(...t.moduleReference.range), p.push({
|
|
947
|
+
size: k(t.range),
|
|
948
|
+
group: r(t),
|
|
949
|
+
name: d,
|
|
950
|
+
node: t
|
|
932
951
|
});
|
|
933
952
|
};
|
|
934
953
|
return {
|
|
935
954
|
TSImportEqualsDeclaration: e,
|
|
936
955
|
ImportDeclaration: e,
|
|
937
956
|
"Program:exit": () => {
|
|
938
|
-
let
|
|
939
|
-
for (let
|
|
940
|
-
let
|
|
941
|
-
if (y.group ===
|
|
942
|
-
return
|
|
957
|
+
let t = (y) => {
|
|
958
|
+
for (let c = 0, m = l.groups.length; c < m; c++) {
|
|
959
|
+
let x = l.groups[c];
|
|
960
|
+
if (y.group === x || Array.isArray(x) && x.includes(y.group))
|
|
961
|
+
return c;
|
|
943
962
|
}
|
|
944
963
|
return l.groups.length;
|
|
945
|
-
},
|
|
964
|
+
}, d = (y, c) => !!n.getTokensBetween(
|
|
946
965
|
y.node,
|
|
947
|
-
F(
|
|
966
|
+
F(c.node, n) || c.node,
|
|
948
967
|
{
|
|
949
968
|
includeComments: !0
|
|
950
969
|
}
|
|
951
|
-
).length, g = (y,
|
|
970
|
+
).length, g = (y, c) => n.lines.slice(
|
|
952
971
|
y.node.loc.end.line,
|
|
953
|
-
|
|
954
|
-
).filter((
|
|
955
|
-
let m = [],
|
|
956
|
-
(
|
|
957
|
-
let
|
|
958
|
-
return
|
|
959
|
-
[...
|
|
972
|
+
c.node.loc.start.line - 1
|
|
973
|
+
).filter((x) => !x.trim().length).length, h = (y, c) => {
|
|
974
|
+
let m = [], x = c.reduce(
|
|
975
|
+
(E, w) => {
|
|
976
|
+
let j = t(w);
|
|
977
|
+
return j in E ? E[j] = S(
|
|
978
|
+
[...E[j], w],
|
|
960
979
|
l
|
|
961
|
-
) :
|
|
980
|
+
) : E[j] = [w], E;
|
|
962
981
|
},
|
|
963
982
|
{}
|
|
964
|
-
),
|
|
965
|
-
(
|
|
966
|
-
...O,
|
|
967
|
-
...h[b]
|
|
968
|
-
],
|
|
983
|
+
), b = Object.keys(x).sort().reduce(
|
|
984
|
+
(E, w) => [...E, ...x[w]],
|
|
969
985
|
[]
|
|
970
986
|
);
|
|
971
|
-
return
|
|
987
|
+
return b.forEach((E, w) => {
|
|
972
988
|
if (m.push(
|
|
973
989
|
y.replaceTextRange(
|
|
974
|
-
T(
|
|
975
|
-
n.text.slice(...T(
|
|
990
|
+
T(c.at(w).node, n),
|
|
991
|
+
n.text.slice(...T(E.node, n))
|
|
976
992
|
)
|
|
977
993
|
), l["newlines-between"] !== "ignore") {
|
|
978
|
-
let
|
|
979
|
-
if (
|
|
980
|
-
let
|
|
981
|
-
|
|
982
|
-
|
|
994
|
+
let j = b.at(w + 1);
|
|
995
|
+
if (j) {
|
|
996
|
+
let C = g(
|
|
997
|
+
c.at(w),
|
|
998
|
+
c.at(w + 1)
|
|
983
999
|
);
|
|
984
|
-
(l["newlines-between"] === "always" &&
|
|
1000
|
+
(l["newlines-between"] === "always" && t(E) === t(j) && C !== 0 || l["newlines-between"] === "never" && C > 0) && m.push(
|
|
985
1001
|
y.removeRange([
|
|
986
|
-
T(
|
|
987
|
-
T(
|
|
1002
|
+
T(c.at(w).node, n).at(1),
|
|
1003
|
+
T(c.at(w + 1).node, n).at(0) - 1
|
|
988
1004
|
])
|
|
989
|
-
), l["newlines-between"] === "always" &&
|
|
1005
|
+
), l["newlines-between"] === "always" && t(E) !== t(j) && C > 1 && m.push(
|
|
990
1006
|
y.replaceTextRange(
|
|
991
1007
|
[
|
|
992
|
-
T(
|
|
993
|
-
T(
|
|
1008
|
+
T(c.at(w).node, n).at(1),
|
|
1009
|
+
T(c.at(w + 1).node, n).at(
|
|
994
1010
|
0
|
|
995
1011
|
) - 1
|
|
996
1012
|
],
|
|
997
1013
|
`
|
|
998
1014
|
`
|
|
999
1015
|
)
|
|
1000
|
-
), l["newlines-between"] === "always" &&
|
|
1016
|
+
), l["newlines-between"] === "always" && t(E) !== t(j) && C === 0 && m.push(
|
|
1001
1017
|
y.insertTextAfterRange(
|
|
1002
|
-
T(
|
|
1018
|
+
T(c.at(w).node, n),
|
|
1003
1019
|
`
|
|
1004
1020
|
`
|
|
1005
1021
|
)
|
|
@@ -1009,54 +1025,54 @@ const K = "sort-imports", xe = A({
|
|
|
1009
1025
|
}), m;
|
|
1010
1026
|
};
|
|
1011
1027
|
p.reduce(
|
|
1012
|
-
(y,
|
|
1013
|
-
var
|
|
1014
|
-
let m = (
|
|
1015
|
-
return m &&
|
|
1028
|
+
(y, c) => {
|
|
1029
|
+
var x;
|
|
1030
|
+
let m = (x = y.at(-1)) == null ? void 0 : x.at(-1);
|
|
1031
|
+
return m && d(m, c) ? y.push([c]) : y.at(-1).push(c), y;
|
|
1016
1032
|
},
|
|
1017
1033
|
[[]]
|
|
1018
1034
|
).forEach((y) => {
|
|
1019
|
-
|
|
1020
|
-
let
|
|
1021
|
-
!c
|
|
1035
|
+
v(y, (c, m) => {
|
|
1036
|
+
let x = t(c), b = t(m), E = g(c, m);
|
|
1037
|
+
!d(c, m) && (x > b || x === b && A(c, m, l)) && a.report({
|
|
1022
1038
|
messageId: "unexpectedImportsOrder",
|
|
1023
1039
|
data: {
|
|
1024
|
-
left:
|
|
1040
|
+
left: c.name,
|
|
1025
1041
|
right: m.name
|
|
1026
1042
|
},
|
|
1027
1043
|
node: m.node,
|
|
1028
|
-
fix: (
|
|
1029
|
-
}), l["newlines-between"] === "never" &&
|
|
1044
|
+
fix: (w) => h(w, y)
|
|
1045
|
+
}), l["newlines-between"] === "never" && E > 0 && a.report({
|
|
1030
1046
|
messageId: "extraSpacingBetweenImports",
|
|
1031
1047
|
data: {
|
|
1032
|
-
left:
|
|
1048
|
+
left: c.name,
|
|
1033
1049
|
right: m.name
|
|
1034
1050
|
},
|
|
1035
1051
|
node: m.node,
|
|
1036
|
-
fix: (
|
|
1037
|
-
}), l["newlines-between"] === "always" && (
|
|
1052
|
+
fix: (w) => h(w, y)
|
|
1053
|
+
}), l["newlines-between"] === "always" && (x < b && E === 0 ? a.report({
|
|
1038
1054
|
messageId: "missedSpacingBetweenImports",
|
|
1039
1055
|
data: {
|
|
1040
|
-
left:
|
|
1056
|
+
left: c.name,
|
|
1041
1057
|
right: m.name
|
|
1042
1058
|
},
|
|
1043
1059
|
node: m.node,
|
|
1044
|
-
fix: (
|
|
1045
|
-
}) : (
|
|
1060
|
+
fix: (w) => h(w, y)
|
|
1061
|
+
}) : (E > 1 || x === b && E > 0) && a.report({
|
|
1046
1062
|
messageId: "extraSpacingBetweenImports",
|
|
1047
1063
|
data: {
|
|
1048
|
-
left:
|
|
1064
|
+
left: c.name,
|
|
1049
1065
|
right: m.name
|
|
1050
1066
|
},
|
|
1051
1067
|
node: m.node,
|
|
1052
|
-
fix: (
|
|
1068
|
+
fix: (w) => h(w, y)
|
|
1053
1069
|
}));
|
|
1054
1070
|
});
|
|
1055
1071
|
});
|
|
1056
1072
|
}
|
|
1057
1073
|
};
|
|
1058
1074
|
}
|
|
1059
|
-
}), V = "sort-classes", be =
|
|
1075
|
+
}), V = "sort-classes", be = N({
|
|
1060
1076
|
name: V,
|
|
1061
1077
|
meta: {
|
|
1062
1078
|
type: "suggestion",
|
|
@@ -1082,8 +1098,8 @@ const K = "sort-imports", xe = A({
|
|
|
1082
1098
|
default: !1
|
|
1083
1099
|
},
|
|
1084
1100
|
order: {
|
|
1085
|
-
enum: [
|
|
1086
|
-
default:
|
|
1101
|
+
enum: [f.asc, f.desc],
|
|
1102
|
+
default: f.asc
|
|
1087
1103
|
},
|
|
1088
1104
|
groups: {
|
|
1089
1105
|
type: "array",
|
|
@@ -1100,44 +1116,44 @@ const K = "sort-imports", xe = A({
|
|
|
1100
1116
|
defaultOptions: [
|
|
1101
1117
|
{
|
|
1102
1118
|
type: i.alphabetical,
|
|
1103
|
-
order:
|
|
1119
|
+
order: f.asc
|
|
1104
1120
|
}
|
|
1105
1121
|
],
|
|
1106
|
-
create: (
|
|
1122
|
+
create: (a) => ({
|
|
1107
1123
|
ClassBody: (l) => {
|
|
1108
1124
|
if (l.body.length > 1) {
|
|
1109
|
-
let s =
|
|
1125
|
+
let s = P(a.options.at(0), {
|
|
1110
1126
|
type: i.alphabetical,
|
|
1111
|
-
order:
|
|
1127
|
+
order: f.asc,
|
|
1112
1128
|
"ignore-case": !1,
|
|
1113
1129
|
groups: ["property", "constructor", "method", "unknown"]
|
|
1114
|
-
}), n =
|
|
1130
|
+
}), n = a.getSourceCode(), p = l.body.map((e) => {
|
|
1115
1131
|
var g;
|
|
1116
|
-
let o,
|
|
1117
|
-
e.type === u.StaticBlock ?
|
|
1132
|
+
let o, t;
|
|
1133
|
+
e.type === u.StaticBlock ? t = "static" : e.type === u.TSIndexSignature ? t = n.text.slice(
|
|
1118
1134
|
e.range.at(0),
|
|
1119
1135
|
((g = e.typeAnnotation) == null ? void 0 : g.range.at(0)) ?? e.range.at(1)
|
|
1120
|
-
) : e.key.type === u.Identifier ? { name:
|
|
1121
|
-
let
|
|
1122
|
-
!o && s.groups.flat().includes(
|
|
1136
|
+
) : e.key.type === u.Identifier ? { name: t } = e.key : t = n.text.slice(...e.key.range);
|
|
1137
|
+
let d = (h) => {
|
|
1138
|
+
!o && s.groups.flat().includes(h) && (o = h);
|
|
1123
1139
|
};
|
|
1124
|
-
return e.type === u.MethodDefinition ? (e.kind === "constructor" &&
|
|
1125
|
-
size:
|
|
1140
|
+
return e.type === u.MethodDefinition ? (e.kind === "constructor" && d("constructor"), e.static && d("static-method"), e.accessibility === "private" && d("private-method"), d("method")) : e.type === u.PropertyDefinition && (e.static && d("static-property"), e.accessibility === "private" && d("private-property"), d("property")), {
|
|
1141
|
+
size: k(e.range),
|
|
1126
1142
|
group: o ?? "unknown",
|
|
1127
1143
|
node: e,
|
|
1128
|
-
name:
|
|
1144
|
+
name: t
|
|
1129
1145
|
};
|
|
1130
1146
|
}), r = (e) => {
|
|
1131
|
-
for (let o = 0,
|
|
1132
|
-
let
|
|
1133
|
-
if (e.group ===
|
|
1147
|
+
for (let o = 0, t = s.groups.length; o < t; o++) {
|
|
1148
|
+
let d = s.groups[o];
|
|
1149
|
+
if (e.group === d || Array.isArray(d) && d.includes(e.group))
|
|
1134
1150
|
return o;
|
|
1135
1151
|
}
|
|
1136
1152
|
return s.groups.length;
|
|
1137
1153
|
};
|
|
1138
|
-
|
|
1139
|
-
let
|
|
1140
|
-
(
|
|
1154
|
+
v(p, (e, o) => {
|
|
1155
|
+
let t = r(e), d = r(o);
|
|
1156
|
+
(t > d || t === d && A(e, o, s)) && a.report({
|
|
1141
1157
|
messageId: "unexpectedClassesOrder",
|
|
1142
1158
|
data: {
|
|
1143
1159
|
left: I(e.name),
|
|
@@ -1145,39 +1161,39 @@ const K = "sort-imports", xe = A({
|
|
|
1145
1161
|
},
|
|
1146
1162
|
node: o.node,
|
|
1147
1163
|
fix: (g) => {
|
|
1148
|
-
let
|
|
1149
|
-
(
|
|
1150
|
-
let
|
|
1151
|
-
return
|
|
1152
|
-
[...
|
|
1164
|
+
let h = [], O = p.reduce(
|
|
1165
|
+
(c, m) => {
|
|
1166
|
+
let x = r(m);
|
|
1167
|
+
return x in c ? c[x] = S(
|
|
1168
|
+
[...c[x], m],
|
|
1153
1169
|
s
|
|
1154
|
-
) :
|
|
1170
|
+
) : c[x] = [m], c;
|
|
1155
1171
|
},
|
|
1156
1172
|
{}
|
|
1157
1173
|
);
|
|
1158
|
-
return Object.keys(
|
|
1159
|
-
(
|
|
1160
|
-
...
|
|
1161
|
-
...
|
|
1174
|
+
return Object.keys(O).sort().reduce(
|
|
1175
|
+
(c, m) => [
|
|
1176
|
+
...c,
|
|
1177
|
+
...O[m]
|
|
1162
1178
|
],
|
|
1163
1179
|
[]
|
|
1164
|
-
).forEach((
|
|
1165
|
-
|
|
1180
|
+
).forEach((c, m) => {
|
|
1181
|
+
h.push(
|
|
1166
1182
|
g.replaceTextRange(
|
|
1167
1183
|
T(p.at(m).node, n),
|
|
1168
1184
|
n.text.slice(
|
|
1169
|
-
...T(
|
|
1185
|
+
...T(c.node, n)
|
|
1170
1186
|
)
|
|
1171
1187
|
)
|
|
1172
1188
|
);
|
|
1173
|
-
}),
|
|
1189
|
+
}), h;
|
|
1174
1190
|
}
|
|
1175
1191
|
});
|
|
1176
1192
|
});
|
|
1177
1193
|
}
|
|
1178
1194
|
}
|
|
1179
1195
|
})
|
|
1180
|
-
}), Y = "sort-objects", Ee =
|
|
1196
|
+
}), Y = "sort-objects", Ee = N({
|
|
1181
1197
|
name: Y,
|
|
1182
1198
|
meta: {
|
|
1183
1199
|
type: "suggestion",
|
|
@@ -1199,8 +1215,8 @@ const K = "sort-imports", xe = A({
|
|
|
1199
1215
|
default: i.natural
|
|
1200
1216
|
},
|
|
1201
1217
|
order: {
|
|
1202
|
-
enum: [
|
|
1203
|
-
default:
|
|
1218
|
+
enum: [f.asc, f.desc],
|
|
1219
|
+
default: f.asc
|
|
1204
1220
|
},
|
|
1205
1221
|
"ignore-case": {
|
|
1206
1222
|
type: "boolean",
|
|
@@ -1221,80 +1237,80 @@ const K = "sort-imports", xe = A({
|
|
|
1221
1237
|
defaultOptions: [
|
|
1222
1238
|
{
|
|
1223
1239
|
type: i.alphabetical,
|
|
1224
|
-
order:
|
|
1240
|
+
order: f.asc
|
|
1225
1241
|
}
|
|
1226
1242
|
],
|
|
1227
|
-
create: (
|
|
1243
|
+
create: (a) => {
|
|
1228
1244
|
let l = (s) => {
|
|
1229
1245
|
if (s.properties.length > 1) {
|
|
1230
|
-
let n =
|
|
1246
|
+
let n = P(a.options.at(0), {
|
|
1231
1247
|
type: i.alphabetical,
|
|
1232
1248
|
"ignore-case": !1,
|
|
1233
|
-
order:
|
|
1249
|
+
order: f.asc,
|
|
1234
1250
|
"always-on-top": []
|
|
1235
|
-
}), p =
|
|
1251
|
+
}), p = a.getSourceCode();
|
|
1236
1252
|
((e) => e.reduce(
|
|
1237
|
-
(o,
|
|
1238
|
-
if (
|
|
1253
|
+
(o, t) => {
|
|
1254
|
+
if (t.type === u.SpreadElement || t.type === u.RestElement)
|
|
1239
1255
|
return o.push([]), o;
|
|
1240
|
-
let
|
|
1241
|
-
if (
|
|
1242
|
-
let y = (
|
|
1243
|
-
|
|
1244
|
-
let
|
|
1245
|
-
|
|
1256
|
+
let d, g = "ignore", h = [];
|
|
1257
|
+
if (t.key.type === u.Identifier ? { name: d } = t.key : t.key.type === u.Literal ? d = `${t.key.value}` : d = p.text.slice(...t.key.range), t.key.type === u.Identifier && n["always-on-top"].includes(t.key.name) && (g = "exception"), t.value.type === u.AssignmentPattern) {
|
|
1258
|
+
let y = (c, m) => {
|
|
1259
|
+
c.right.type === u.Identifier && h.push(c.right.name), !m && c.left.type === u.Identifier && h.push(c.left.name);
|
|
1260
|
+
let x = (b) => {
|
|
1261
|
+
b.right.type === u.Identifier && h.push(b.right.name), b.left.type === u.BinaryExpression && y(b.left, !1);
|
|
1246
1262
|
};
|
|
1247
|
-
|
|
1263
|
+
c.right.type === u.BinaryExpression && x(c.right);
|
|
1248
1264
|
};
|
|
1249
|
-
y(
|
|
1265
|
+
y(t.value, !0);
|
|
1250
1266
|
}
|
|
1251
|
-
let
|
|
1252
|
-
size:
|
|
1253
|
-
dependencies:
|
|
1254
|
-
node:
|
|
1267
|
+
let O = {
|
|
1268
|
+
size: k(t.range),
|
|
1269
|
+
dependencies: h,
|
|
1270
|
+
node: t,
|
|
1255
1271
|
position: g,
|
|
1256
|
-
name:
|
|
1272
|
+
name: d
|
|
1257
1273
|
};
|
|
1258
|
-
return o.at(-1).push(
|
|
1274
|
+
return o.at(-1).push(O), o;
|
|
1259
1275
|
},
|
|
1260
1276
|
[[]]
|
|
1261
1277
|
))(s.properties).forEach((e) => {
|
|
1262
|
-
|
|
1263
|
-
let
|
|
1264
|
-
if (o.position === "exception" &&
|
|
1265
|
-
|
|
1266
|
-
else if (o.position ===
|
|
1267
|
-
|
|
1278
|
+
v(e, (o, t) => {
|
|
1279
|
+
let d;
|
|
1280
|
+
if (o.position === "exception" && t.position === "exception")
|
|
1281
|
+
d = n["always-on-top"].indexOf(o.name) > n["always-on-top"].indexOf(t.name);
|
|
1282
|
+
else if (o.position === t.position)
|
|
1283
|
+
d = A(o, t, n);
|
|
1268
1284
|
else {
|
|
1269
1285
|
let g = {
|
|
1270
1286
|
exception: 1,
|
|
1271
1287
|
ignore: 0
|
|
1272
1288
|
};
|
|
1273
|
-
|
|
1289
|
+
d = g[o.position] < g[t.position];
|
|
1274
1290
|
}
|
|
1275
|
-
if (
|
|
1276
|
-
let g = (
|
|
1277
|
-
let
|
|
1291
|
+
if (d) {
|
|
1292
|
+
let g = (h) => {
|
|
1293
|
+
let O = ee(e, ({ position: m }) => m), y = (m) => m in O ? O[m] : [], c = [
|
|
1278
1294
|
y(
|
|
1279
1295
|
"exception"
|
|
1280
1296
|
/* exception */
|
|
1281
1297
|
).sort(
|
|
1282
|
-
(m,
|
|
1298
|
+
(m, x) => n["always-on-top"].indexOf(m.name) - n["always-on-top"].indexOf(x.name)
|
|
1283
1299
|
),
|
|
1284
1300
|
S(y(
|
|
1285
1301
|
"ignore"
|
|
1286
1302
|
/* ignore */
|
|
1287
1303
|
), n)
|
|
1288
1304
|
].flat();
|
|
1289
|
-
return
|
|
1305
|
+
return R(h, e, c, p);
|
|
1290
1306
|
};
|
|
1291
|
-
|
|
1307
|
+
a.report({
|
|
1292
1308
|
messageId: "unexpectedObjectsOrder",
|
|
1293
1309
|
data: {
|
|
1294
1310
|
left: I(o.name),
|
|
1295
|
-
right: I(
|
|
1311
|
+
right: I(t.name)
|
|
1296
1312
|
},
|
|
1297
|
-
node:
|
|
1313
|
+
node: t.node,
|
|
1298
1314
|
fix: g
|
|
1299
1315
|
});
|
|
1300
1316
|
}
|
|
@@ -1307,7 +1323,7 @@ const K = "sort-imports", xe = A({
|
|
|
1307
1323
|
ObjectPattern: l
|
|
1308
1324
|
};
|
|
1309
1325
|
}
|
|
1310
|
-
}), q = "sort-exports", we =
|
|
1326
|
+
}), q = "sort-exports", we = N({
|
|
1311
1327
|
name: q,
|
|
1312
1328
|
meta: {
|
|
1313
1329
|
type: "suggestion",
|
|
@@ -1329,8 +1345,8 @@ const K = "sort-imports", xe = A({
|
|
|
1329
1345
|
default: i.natural
|
|
1330
1346
|
},
|
|
1331
1347
|
order: {
|
|
1332
|
-
enum: [
|
|
1333
|
-
default:
|
|
1348
|
+
enum: [f.asc, f.desc],
|
|
1349
|
+
default: f.asc
|
|
1334
1350
|
},
|
|
1335
1351
|
"ignore-case": {
|
|
1336
1352
|
type: "boolean",
|
|
@@ -1347,17 +1363,17 @@ const K = "sort-imports", xe = A({
|
|
|
1347
1363
|
defaultOptions: [
|
|
1348
1364
|
{
|
|
1349
1365
|
type: i.alphabetical,
|
|
1350
|
-
order:
|
|
1366
|
+
order: f.asc
|
|
1351
1367
|
}
|
|
1352
1368
|
],
|
|
1353
|
-
create: (
|
|
1354
|
-
let l =
|
|
1369
|
+
create: (a) => {
|
|
1370
|
+
let l = P(a.options.at(0), {
|
|
1355
1371
|
type: i.alphabetical,
|
|
1356
|
-
order:
|
|
1372
|
+
order: f.asc,
|
|
1357
1373
|
"ignore-case": !1
|
|
1358
1374
|
}), s = [[]], n = (p) => {
|
|
1359
1375
|
p.type === u.ExportAllDeclaration && p.exported === null ? s.push([]) : s.at(-1).push({
|
|
1360
|
-
size:
|
|
1376
|
+
size: k(p.range),
|
|
1361
1377
|
name: p.source.value,
|
|
1362
1378
|
node: p
|
|
1363
1379
|
});
|
|
@@ -1368,24 +1384,24 @@ const K = "sort-imports", xe = A({
|
|
|
1368
1384
|
p.source !== null && n(p);
|
|
1369
1385
|
},
|
|
1370
1386
|
"Program:exit": () => {
|
|
1371
|
-
let p =
|
|
1387
|
+
let p = a.getSourceCode();
|
|
1372
1388
|
s.forEach((r) => {
|
|
1373
|
-
|
|
1374
|
-
|
|
1389
|
+
v(r, (e, o) => {
|
|
1390
|
+
A(e, o, l) && a.report({
|
|
1375
1391
|
messageId: "unexpectedExportsOrder",
|
|
1376
1392
|
data: {
|
|
1377
1393
|
left: e.name,
|
|
1378
1394
|
right: o.name
|
|
1379
1395
|
},
|
|
1380
1396
|
node: o.node,
|
|
1381
|
-
fix: (
|
|
1397
|
+
fix: (t) => R(t, r, S(r, l), p)
|
|
1382
1398
|
});
|
|
1383
1399
|
});
|
|
1384
1400
|
});
|
|
1385
1401
|
}
|
|
1386
1402
|
};
|
|
1387
1403
|
}
|
|
1388
|
-
}), H = "sort-enums", Oe =
|
|
1404
|
+
}), H = "sort-enums", Oe = N({
|
|
1389
1405
|
name: H,
|
|
1390
1406
|
meta: {
|
|
1391
1407
|
type: "suggestion",
|
|
@@ -1411,8 +1427,8 @@ const K = "sort-imports", xe = A({
|
|
|
1411
1427
|
default: !1
|
|
1412
1428
|
},
|
|
1413
1429
|
order: {
|
|
1414
|
-
enum: [
|
|
1415
|
-
default:
|
|
1430
|
+
enum: [f.asc, f.desc],
|
|
1431
|
+
default: f.asc
|
|
1416
1432
|
}
|
|
1417
1433
|
},
|
|
1418
1434
|
additionalProperties: !1
|
|
@@ -1425,37 +1441,37 @@ const K = "sort-imports", xe = A({
|
|
|
1425
1441
|
defaultOptions: [
|
|
1426
1442
|
{
|
|
1427
1443
|
type: i.alphabetical,
|
|
1428
|
-
order:
|
|
1444
|
+
order: f.asc
|
|
1429
1445
|
}
|
|
1430
1446
|
],
|
|
1431
|
-
create: (
|
|
1447
|
+
create: (a) => ({
|
|
1432
1448
|
TSEnumDeclaration: (l) => {
|
|
1433
1449
|
if (l.members.length > 1 && l.members.some(({ initializer: s }) => s)) {
|
|
1434
|
-
let s =
|
|
1450
|
+
let s = P(a.options.at(0), {
|
|
1435
1451
|
type: i.alphabetical,
|
|
1436
|
-
order:
|
|
1452
|
+
order: f.asc,
|
|
1437
1453
|
"ignore-case": !1
|
|
1438
|
-
}), n =
|
|
1454
|
+
}), n = a.getSourceCode(), p = l.members.map((r) => ({
|
|
1439
1455
|
name: r.id.type === u.Literal ? `${r.id.value}` : `${n.text.slice(...r.id.range)}`,
|
|
1440
|
-
size:
|
|
1456
|
+
size: k(r.range),
|
|
1441
1457
|
node: r
|
|
1442
1458
|
}));
|
|
1443
|
-
|
|
1444
|
-
|
|
1459
|
+
v(p, (r, e) => {
|
|
1460
|
+
A(r, e, s) && a.report({
|
|
1445
1461
|
messageId: "unexpectedEnumsOrder",
|
|
1446
1462
|
data: {
|
|
1447
1463
|
left: I(r.name),
|
|
1448
1464
|
right: I(e.name)
|
|
1449
1465
|
},
|
|
1450
1466
|
node: e.node,
|
|
1451
|
-
fix: (o) =>
|
|
1467
|
+
fix: (o) => R(o, p, S(p, s), n)
|
|
1452
1468
|
});
|
|
1453
1469
|
});
|
|
1454
1470
|
}
|
|
1455
1471
|
}
|
|
1456
1472
|
})
|
|
1457
1473
|
}), Ie = "eslint-plugin-perfectionist";
|
|
1458
|
-
let
|
|
1474
|
+
let B = (a) => {
|
|
1459
1475
|
let l = {
|
|
1460
1476
|
[K]: [
|
|
1461
1477
|
"error",
|
|
@@ -1470,6 +1486,10 @@ let M = (t) => {
|
|
|
1470
1486
|
"object",
|
|
1471
1487
|
"unknown"
|
|
1472
1488
|
],
|
|
1489
|
+
"custom-groups": {
|
|
1490
|
+
value: {},
|
|
1491
|
+
type: {}
|
|
1492
|
+
},
|
|
1473
1493
|
"newlines-between": "always",
|
|
1474
1494
|
"internal-pattern": ["~/**"],
|
|
1475
1495
|
"read-tsconfig": !1
|
|
@@ -1490,7 +1510,7 @@ let M = (t) => {
|
|
|
1490
1510
|
]
|
|
1491
1511
|
}
|
|
1492
1512
|
],
|
|
1493
|
-
[
|
|
1513
|
+
[X]: [
|
|
1494
1514
|
"error",
|
|
1495
1515
|
{
|
|
1496
1516
|
"always-on-top": [],
|
|
@@ -1515,8 +1535,8 @@ let M = (t) => {
|
|
|
1515
1535
|
[U]: ["error"],
|
|
1516
1536
|
[D]: ["error"],
|
|
1517
1537
|
[J]: ["error"],
|
|
1538
|
+
[G]: ["error"],
|
|
1518
1539
|
[W]: ["error"],
|
|
1519
|
-
[X]: ["error"],
|
|
1520
1540
|
[q]: ["error"],
|
|
1521
1541
|
[H]: ["error"]
|
|
1522
1542
|
};
|
|
@@ -1524,7 +1544,7 @@ let M = (t) => {
|
|
|
1524
1544
|
rules: Object.fromEntries(
|
|
1525
1545
|
Object.entries(l).map(([s, [n, p = {}]]) => [
|
|
1526
1546
|
`perfectionist/${s}`,
|
|
1527
|
-
[n, Object.assign(p,
|
|
1547
|
+
[n, Object.assign(p, a)]
|
|
1528
1548
|
])
|
|
1529
1549
|
),
|
|
1530
1550
|
plugins: ["perfectionist"]
|
|
@@ -1537,29 +1557,29 @@ const Ce = {
|
|
|
1537
1557
|
[H]: Oe,
|
|
1538
1558
|
[q]: we,
|
|
1539
1559
|
[K]: xe,
|
|
1540
|
-
[
|
|
1541
|
-
[
|
|
1560
|
+
[W]: ye,
|
|
1561
|
+
[X]: he,
|
|
1542
1562
|
[J]: ge,
|
|
1543
1563
|
[U]: de,
|
|
1544
1564
|
[z]: fe,
|
|
1545
1565
|
[D]: ue,
|
|
1546
1566
|
[Y]: Ee,
|
|
1547
|
-
[
|
|
1567
|
+
[G]: me
|
|
1548
1568
|
},
|
|
1549
1569
|
configs: {
|
|
1550
|
-
"recommended-alphabetical":
|
|
1570
|
+
"recommended-alphabetical": B({
|
|
1551
1571
|
type: i.alphabetical,
|
|
1552
|
-
order:
|
|
1572
|
+
order: f.asc,
|
|
1553
1573
|
"ignore-case": !1
|
|
1554
1574
|
}),
|
|
1555
|
-
"recommended-natural":
|
|
1575
|
+
"recommended-natural": B({
|
|
1556
1576
|
type: i.natural,
|
|
1557
|
-
order:
|
|
1577
|
+
order: f.asc,
|
|
1558
1578
|
"ignore-case": !1
|
|
1559
1579
|
}),
|
|
1560
|
-
"recommended-line-length":
|
|
1580
|
+
"recommended-line-length": B({
|
|
1561
1581
|
type: i["line-length"],
|
|
1562
|
-
order:
|
|
1582
|
+
order: f.desc
|
|
1563
1583
|
})
|
|
1564
1584
|
},
|
|
1565
1585
|
name: Ie
|