eslint-plugin-perfectionist 1.5.0 → 2.0.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/configs/recommended-alphabetical.js +1 -1
- package/dist/configs/recommended-alphabetical.mjs +8 -11
- package/dist/configs/recommended-line-length.js +1 -1
- package/dist/configs/recommended-line-length.mjs +8 -11
- package/dist/configs/recommended-natural.js +1 -1
- package/dist/configs/recommended-natural.mjs +5 -8
- package/dist/index.js +3 -3
- package/dist/index.mjs +1229 -870
- package/package.json +21 -6
- package/readme.md +19 -17
package/dist/index.mjs
CHANGED
|
@@ -1,127 +1,355 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { AST_TOKEN_TYPES as M, AST_NODE_TYPES as m } from "@typescript-eslint/types";
|
|
5
|
-
import { ESLintUtils as le, ASTUtils as _ } from "@typescript-eslint/utils";
|
|
1
|
+
import U from "path";
|
|
2
|
+
import { ESLintUtils as le, ASTUtils as D } from "@typescript-eslint/utils";
|
|
3
|
+
import { minimatch as $ } from "minimatch";
|
|
6
4
|
import ie from "natural-compare-lite";
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
let
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
5
|
+
import { builtinModules as oe } from "module";
|
|
6
|
+
let v = le.RuleCreator(
|
|
7
|
+
(s) => `https://eslint-plugin-perfectionist.azat.io/rules/${s}`
|
|
8
|
+
), x = (s, l) => {
|
|
9
|
+
for (let n = 0, a = s.length; n < a; n++) {
|
|
10
|
+
let u = s[n];
|
|
11
|
+
if (l.group === u || Array.isArray(u) && typeof l.group == "string" && u.includes(l.group))
|
|
12
|
+
return n;
|
|
13
|
+
}
|
|
14
|
+
return s.length;
|
|
15
|
+
}, w = (s) => {
|
|
16
|
+
let [l, n] = s;
|
|
17
|
+
return n - l;
|
|
18
|
+
}, j = (s) => s > 0;
|
|
19
|
+
var i = /* @__PURE__ */ ((s) => (s.alphabetical = "alphabetical", s["line-length"] = "line-length", s.natural = "natural", s))(i || {}), f = /* @__PURE__ */ ((s) => (s.desc = "desc", s.asc = "asc", s))(f || {});
|
|
20
|
+
let G = (s) => {
|
|
21
|
+
let l, n = (u) => {
|
|
22
|
+
!l && s.flat().includes(u) && (l = u);
|
|
23
|
+
};
|
|
24
|
+
return {
|
|
25
|
+
getGroup: () => l ?? "unknown",
|
|
26
|
+
setCustomGroups: (u, t) => {
|
|
27
|
+
if (u)
|
|
28
|
+
for (let [e, o] of Object.entries(u))
|
|
29
|
+
Array.isArray(o) && o.some((r) => $(t, r)) && n(e), typeof o == "string" && $(t, o) && n(e);
|
|
30
|
+
},
|
|
31
|
+
defineGroup: n
|
|
32
|
+
};
|
|
33
|
+
}, I = (s, l, n) => {
|
|
34
|
+
var e, o;
|
|
35
|
+
if ((e = l.dependencies) != null && e.includes(s.name))
|
|
36
|
+
return -1;
|
|
37
|
+
if ((o = s.dependencies) != null && o.includes(l.name))
|
|
38
|
+
return 1;
|
|
39
|
+
let a = n.order === "asc" ? 1 : -1, u, t = (r) => n["ignore-case"] ? r.toLowerCase() : r;
|
|
40
|
+
return n.type === i.alphabetical ? u = (r, c) => t(r.name).localeCompare(t(c.name)) : n.type === i.natural ? u = (r, c) => ie(t(r.name), t(c.name)) : u = (r, c) => r.size - c.size, a * u(s, l);
|
|
41
|
+
}, N = (s, l) => [...s].sort((n, a) => I(n, a, l)), pe = (s, l) => {
|
|
42
|
+
let n = l.getTokenAfter(s, {
|
|
43
|
+
filter: ({ value: a, type: u }) => !(u === "Punctuator" && [",", ";"].includes(a)),
|
|
30
44
|
includeComments: !0
|
|
31
45
|
});
|
|
32
|
-
return ((
|
|
33
|
-
},
|
|
34
|
-
let [
|
|
35
|
-
filter: ({ value:
|
|
46
|
+
return ((n == null ? void 0 : n.type) === "Block" || (n == null ? void 0 : n.type) === "Line") && s.loc.end.line === n.loc.end.line ? n : null;
|
|
47
|
+
}, ne = (s, l) => Array.isArray(s) && s.some((n) => $(l.trim(), n)) || typeof s == "string" && $(l.trim(), s) || s === !0, _ = (s, l) => {
|
|
48
|
+
let [n, a] = l.getTokensBefore(s, {
|
|
49
|
+
filter: ({ value: u, type: t }) => !(t === "Punctuator" && [",", ";"].includes(u)),
|
|
36
50
|
includeComments: !0,
|
|
37
51
|
count: 2
|
|
38
52
|
});
|
|
39
|
-
return ((
|
|
40
|
-
},
|
|
41
|
-
var
|
|
42
|
-
let
|
|
43
|
-
if (
|
|
44
|
-
let
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
), c =
|
|
48
|
-
|
|
49
|
-
|
|
53
|
+
return ((a == null ? void 0 : a.type) === "Block" || (a == null ? void 0 : a.type) === "Line") && s.loc.start.line - a.loc.end.line <= 1 && (n == null ? void 0 : n.loc.end.line) !== a.loc.start.line ? a : null;
|
|
54
|
+
}, L = (s, l, n) => {
|
|
55
|
+
var o;
|
|
56
|
+
let a = s.range.at(0), u = s.range.at(1), t = l.text.slice(a, u);
|
|
57
|
+
if (D.isParenthesized(s, l)) {
|
|
58
|
+
let r = l.getTokenBefore(
|
|
59
|
+
s,
|
|
60
|
+
D.isOpeningParenToken
|
|
61
|
+
), c = l.getTokenAfter(
|
|
62
|
+
s,
|
|
63
|
+
D.isClosingParenToken
|
|
50
64
|
);
|
|
51
|
-
|
|
65
|
+
a = r.range.at(0), u = c.range.at(1);
|
|
52
66
|
}
|
|
53
|
-
let e =
|
|
54
|
-
if (
|
|
55
|
-
let
|
|
67
|
+
let e = _(s, l);
|
|
68
|
+
if (t.endsWith(";") || t.endsWith(",")) {
|
|
69
|
+
let r = l.getTokensAfter(s, {
|
|
56
70
|
includeComments: !0,
|
|
57
71
|
count: 2
|
|
58
72
|
});
|
|
59
|
-
|
|
73
|
+
s.loc.start.line === ((o = r.at(1)) == null ? void 0 : o.loc.start.line) && (u -= 1);
|
|
60
74
|
}
|
|
61
|
-
return e && !
|
|
62
|
-
(
|
|
75
|
+
return e && !ne(
|
|
76
|
+
(n == null ? void 0 : n.partitionComment) ?? !1,
|
|
63
77
|
e.value
|
|
64
|
-
) && (
|
|
65
|
-
},
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
l.
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
78
|
+
) && (a = e.range.at(0)), [a, u];
|
|
79
|
+
}, P = (s, l, n, a, u) => {
|
|
80
|
+
var o, r;
|
|
81
|
+
let t = [], e = ((o = l.at(0)) == null ? void 0 : o.node.loc.start.line) === ((r = l.at(-1)) == null ? void 0 : r.node.loc.end.line);
|
|
82
|
+
for (let c = 0, d = l.length; c < d; c++) {
|
|
83
|
+
let { node: y } = l.at(c);
|
|
84
|
+
t.push(
|
|
85
|
+
s.replaceTextRange(
|
|
86
|
+
L(y, a, u),
|
|
87
|
+
a.text.slice(
|
|
88
|
+
...L(n.at(c).node, a, u)
|
|
74
89
|
)
|
|
75
90
|
)
|
|
76
91
|
);
|
|
77
|
-
let
|
|
78
|
-
if (
|
|
79
|
-
let
|
|
80
|
-
|
|
81
|
-
|
|
92
|
+
let m = pe(n.at(c).node, a);
|
|
93
|
+
if (m && !e) {
|
|
94
|
+
let p = [
|
|
95
|
+
a.getTokenBefore(m).range.at(1),
|
|
96
|
+
m.range.at(1)
|
|
82
97
|
];
|
|
83
|
-
|
|
84
|
-
let
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
(
|
|
88
|
-
|
|
98
|
+
t.push(s.replaceTextRange(p, ""));
|
|
99
|
+
let h = a.getTokenAfter(y);
|
|
100
|
+
t.push(
|
|
101
|
+
s.insertTextAfter(
|
|
102
|
+
(h == null ? void 0 : h.loc.end.line) === y.loc.end.line ? h : y,
|
|
103
|
+
a.text.slice(...p)
|
|
89
104
|
)
|
|
90
105
|
);
|
|
91
106
|
}
|
|
92
107
|
}
|
|
93
|
-
return
|
|
94
|
-
},
|
|
95
|
-
if (
|
|
96
|
-
for (let
|
|
97
|
-
let
|
|
98
|
-
|
|
108
|
+
return t;
|
|
109
|
+
}, k = (s = {}, l) => Object.assign(l, s), C = (s, l) => {
|
|
110
|
+
if (s.length > 1)
|
|
111
|
+
for (let n = 1; n < s.length; n++) {
|
|
112
|
+
let a = s.at(n - 1), u = s.at(n);
|
|
113
|
+
a && u && l(a, u, n - 1);
|
|
99
114
|
}
|
|
100
115
|
};
|
|
101
|
-
const
|
|
102
|
-
name:
|
|
116
|
+
const V = "sort-svelte-attributes", ue = v({
|
|
117
|
+
name: V,
|
|
103
118
|
meta: {
|
|
104
119
|
type: "suggestion",
|
|
105
120
|
docs: {
|
|
106
|
-
description: "enforce sorted
|
|
107
|
-
recommended: !1
|
|
121
|
+
description: "enforce sorted Svelte attributes"
|
|
108
122
|
},
|
|
109
123
|
fixable: "code",
|
|
110
124
|
schema: [
|
|
111
125
|
{
|
|
112
126
|
type: "object",
|
|
113
127
|
properties: {
|
|
128
|
+
"custom-groups": {
|
|
129
|
+
type: "object"
|
|
130
|
+
},
|
|
114
131
|
type: {
|
|
115
132
|
enum: [
|
|
116
133
|
i.alphabetical,
|
|
117
134
|
i.natural,
|
|
118
135
|
i["line-length"]
|
|
119
136
|
],
|
|
120
|
-
default: i.
|
|
137
|
+
default: i.alphabetical,
|
|
138
|
+
type: "string"
|
|
121
139
|
},
|
|
122
140
|
order: {
|
|
123
|
-
enum: [
|
|
124
|
-
default:
|
|
141
|
+
enum: [f.asc, f.desc],
|
|
142
|
+
default: f.asc,
|
|
143
|
+
type: "string"
|
|
144
|
+
},
|
|
145
|
+
"ignore-case": {
|
|
146
|
+
type: "boolean",
|
|
147
|
+
default: !1
|
|
148
|
+
},
|
|
149
|
+
groups: {
|
|
150
|
+
type: "array"
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
additionalProperties: !1
|
|
154
|
+
}
|
|
155
|
+
],
|
|
156
|
+
messages: {
|
|
157
|
+
unexpectedSvelteAttributesOrder: 'Expected "{{right}}" to come before "{{left}}"'
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
defaultOptions: [
|
|
161
|
+
{
|
|
162
|
+
type: i.alphabetical,
|
|
163
|
+
order: f.asc
|
|
164
|
+
}
|
|
165
|
+
],
|
|
166
|
+
create: (s) => U.extname(s.getFilename()) !== ".svelte" ? {} : {
|
|
167
|
+
SvelteStartTag: (l) => {
|
|
168
|
+
if (l.attributes.length > 1) {
|
|
169
|
+
let n = k(s.options.at(0), {
|
|
170
|
+
type: i.alphabetical,
|
|
171
|
+
order: f.asc,
|
|
172
|
+
"ignore-case": !1,
|
|
173
|
+
"custom-groups": {},
|
|
174
|
+
groups: []
|
|
175
|
+
}), a = s.getSourceCode(), u = l.attributes.reduce(
|
|
176
|
+
(t, e) => {
|
|
177
|
+
if (e.type === "SvelteSpreadAttribute")
|
|
178
|
+
return t.push([]), t;
|
|
179
|
+
let o, { getGroup: r, defineGroup: c, setCustomGroups: d } = G(
|
|
180
|
+
n.groups
|
|
181
|
+
);
|
|
182
|
+
return e.key.type === "SvelteSpecialDirectiveKey" ? o = a.text.slice(...e.key.range) : typeof e.key.name == "string" ? { name: o } = e.key : o = a.text.slice(...e.key.range), d(n["custom-groups"], o), e.type === "SvelteShorthandAttribute" && (c("svelte-shorthand"), c("shorthand")), (!("value" in e) || Array.isArray(e.value) && !e.value.at(0)) && c("shorthand"), e.loc.start.line !== e.loc.end.line && c("multiline"), t.at(-1).push({
|
|
183
|
+
size: w(e.range),
|
|
184
|
+
node: e,
|
|
185
|
+
group: r(),
|
|
186
|
+
name: o
|
|
187
|
+
}), t;
|
|
188
|
+
},
|
|
189
|
+
[[]]
|
|
190
|
+
);
|
|
191
|
+
for (let t of u)
|
|
192
|
+
C(t, (e, o) => {
|
|
193
|
+
let r = x(n.groups, e), c = x(n.groups, o);
|
|
194
|
+
(r > c || r === c && j(I(e, o, n))) && s.report({
|
|
195
|
+
messageId: "unexpectedSvelteAttributesOrder",
|
|
196
|
+
data: {
|
|
197
|
+
left: e.name,
|
|
198
|
+
right: o.name
|
|
199
|
+
},
|
|
200
|
+
node: o.node,
|
|
201
|
+
fix: (d) => {
|
|
202
|
+
let y = {};
|
|
203
|
+
for (let g of t) {
|
|
204
|
+
let p = x(n.groups, g);
|
|
205
|
+
p in y ? y[p] = N(
|
|
206
|
+
[...y[p], g],
|
|
207
|
+
n
|
|
208
|
+
) : y[p] = [g];
|
|
209
|
+
}
|
|
210
|
+
let m = [];
|
|
211
|
+
for (let g of Object.keys(y).sort())
|
|
212
|
+
m.push(...N(y[g], n));
|
|
213
|
+
return P(d, t, m, a);
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}), W = "sort-astro-attributes", ce = v({
|
|
221
|
+
name: W,
|
|
222
|
+
meta: {
|
|
223
|
+
type: "suggestion",
|
|
224
|
+
docs: {
|
|
225
|
+
description: "enforce sorted Astro attributes"
|
|
226
|
+
},
|
|
227
|
+
fixable: "code",
|
|
228
|
+
schema: [
|
|
229
|
+
{
|
|
230
|
+
type: "object",
|
|
231
|
+
properties: {
|
|
232
|
+
"custom-groups": {
|
|
233
|
+
type: "object"
|
|
234
|
+
},
|
|
235
|
+
type: {
|
|
236
|
+
enum: [
|
|
237
|
+
i.alphabetical,
|
|
238
|
+
i.natural,
|
|
239
|
+
i["line-length"]
|
|
240
|
+
],
|
|
241
|
+
default: i.alphabetical,
|
|
242
|
+
type: "string"
|
|
243
|
+
},
|
|
244
|
+
order: {
|
|
245
|
+
enum: [f.asc, f.desc],
|
|
246
|
+
default: f.asc,
|
|
247
|
+
type: "string"
|
|
248
|
+
},
|
|
249
|
+
"ignore-case": {
|
|
250
|
+
type: "boolean",
|
|
251
|
+
default: !1
|
|
252
|
+
},
|
|
253
|
+
groups: {
|
|
254
|
+
type: "array"
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
additionalProperties: !1
|
|
258
|
+
}
|
|
259
|
+
],
|
|
260
|
+
messages: {
|
|
261
|
+
unexpectedAstroAttributesOrder: 'Expected "{{right}}" to come before "{{left}}"'
|
|
262
|
+
}
|
|
263
|
+
},
|
|
264
|
+
defaultOptions: [
|
|
265
|
+
{
|
|
266
|
+
type: i.alphabetical,
|
|
267
|
+
order: f.asc
|
|
268
|
+
}
|
|
269
|
+
],
|
|
270
|
+
// @ts-ignore
|
|
271
|
+
create: (s) => U.extname(s.getFilename()) !== ".astro" ? {} : {
|
|
272
|
+
JSXElement: (l) => {
|
|
273
|
+
let { attributes: n } = l.openingElement;
|
|
274
|
+
if (n.length > 1) {
|
|
275
|
+
let a = k(s.options.at(0), {
|
|
276
|
+
type: i.alphabetical,
|
|
277
|
+
order: f.asc,
|
|
278
|
+
"ignore-case": !1,
|
|
279
|
+
"custom-groups": {},
|
|
280
|
+
groups: []
|
|
281
|
+
}), u = s.getSourceCode(), t = n.reduce(
|
|
282
|
+
(e, o) => {
|
|
283
|
+
if (o.type === "JSXSpreadAttribute")
|
|
284
|
+
return e.push([]), e;
|
|
285
|
+
let r = typeof o.name.name == "string" ? o.name.name : u.text.slice(...o.name.range), { getGroup: c, defineGroup: d, setCustomGroups: y } = G(
|
|
286
|
+
a.groups
|
|
287
|
+
);
|
|
288
|
+
return y(a["custom-groups"], r), o.type === "AstroShorthandAttribute" && (d("astro-shorthand"), d("shorthand")), o.value === null && d("shorthand"), o.loc.start.line !== o.loc.end.line && d("multiline"), e.at(-1).push({
|
|
289
|
+
size: w(o.range),
|
|
290
|
+
node: o,
|
|
291
|
+
group: c(),
|
|
292
|
+
name: r
|
|
293
|
+
}), e;
|
|
294
|
+
},
|
|
295
|
+
[[]]
|
|
296
|
+
);
|
|
297
|
+
for (let e of t)
|
|
298
|
+
C(e, (o, r) => {
|
|
299
|
+
let c = x(a.groups, o), d = x(a.groups, r);
|
|
300
|
+
(c > d || c === d && j(I(o, r, a))) && s.report({
|
|
301
|
+
messageId: "unexpectedAstroAttributesOrder",
|
|
302
|
+
data: {
|
|
303
|
+
left: o.name,
|
|
304
|
+
right: r.name
|
|
305
|
+
},
|
|
306
|
+
node: r.node,
|
|
307
|
+
fix: (y) => {
|
|
308
|
+
let m = {};
|
|
309
|
+
for (let p of e) {
|
|
310
|
+
let h = x(a.groups, p);
|
|
311
|
+
h in m ? m[h] = N(
|
|
312
|
+
[...m[h], p],
|
|
313
|
+
a
|
|
314
|
+
) : m[h] = [p];
|
|
315
|
+
}
|
|
316
|
+
let g = [];
|
|
317
|
+
for (let p of Object.keys(m).sort())
|
|
318
|
+
g.push(...N(m[p], a));
|
|
319
|
+
return P(y, e, g, u);
|
|
320
|
+
}
|
|
321
|
+
});
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
});
|
|
327
|
+
let O = (s) => s.replaceAll(/\s\s+/g, " ").trim();
|
|
328
|
+
const J = "sort-array-includes", de = v({
|
|
329
|
+
name: J,
|
|
330
|
+
meta: {
|
|
331
|
+
type: "suggestion",
|
|
332
|
+
docs: {
|
|
333
|
+
description: "enforce sorted arrays before include method"
|
|
334
|
+
},
|
|
335
|
+
fixable: "code",
|
|
336
|
+
schema: [
|
|
337
|
+
{
|
|
338
|
+
type: "object",
|
|
339
|
+
properties: {
|
|
340
|
+
type: {
|
|
341
|
+
enum: [
|
|
342
|
+
i.alphabetical,
|
|
343
|
+
i.natural,
|
|
344
|
+
i["line-length"]
|
|
345
|
+
],
|
|
346
|
+
default: i.alphabetical,
|
|
347
|
+
type: "string"
|
|
348
|
+
},
|
|
349
|
+
order: {
|
|
350
|
+
enum: [f.asc, f.desc],
|
|
351
|
+
default: f.asc,
|
|
352
|
+
type: "string"
|
|
125
353
|
},
|
|
126
354
|
"ignore-case": {
|
|
127
355
|
type: "boolean",
|
|
@@ -142,43 +370,43 @@ const D = "sort-array-includes", ue = N({
|
|
|
142
370
|
defaultOptions: [
|
|
143
371
|
{
|
|
144
372
|
type: i.alphabetical,
|
|
145
|
-
order:
|
|
373
|
+
order: f.asc
|
|
146
374
|
}
|
|
147
375
|
],
|
|
148
|
-
create: (
|
|
149
|
-
MemberExpression: (
|
|
150
|
-
if ((
|
|
151
|
-
let
|
|
152
|
-
if (
|
|
153
|
-
let
|
|
376
|
+
create: (s) => ({
|
|
377
|
+
MemberExpression: (l) => {
|
|
378
|
+
if ((l.object.type === "ArrayExpression" || l.object.type === "NewExpression") && l.property.type === "Identifier" && l.property.name === "includes") {
|
|
379
|
+
let n = l.object.type === "ArrayExpression" ? l.object.elements : l.object.arguments;
|
|
380
|
+
if (n.length > 1) {
|
|
381
|
+
let a = k(s.options.at(0), {
|
|
154
382
|
type: i.alphabetical,
|
|
155
|
-
order:
|
|
383
|
+
order: f.asc,
|
|
156
384
|
"ignore-case": !1,
|
|
157
385
|
"spread-last": !1
|
|
158
|
-
}),
|
|
159
|
-
(e,
|
|
160
|
-
name:
|
|
161
|
-
size:
|
|
162
|
-
type:
|
|
163
|
-
node:
|
|
386
|
+
}), u = s.getSourceCode(), t = n.reduce(
|
|
387
|
+
(e, o) => (o !== null && e.at(0).push({
|
|
388
|
+
name: o.type === "Literal" ? `${o.value}` : u.text.slice(...o.range),
|
|
389
|
+
size: w(o.range),
|
|
390
|
+
type: o.type,
|
|
391
|
+
node: o
|
|
164
392
|
}), e),
|
|
165
393
|
[[], []]
|
|
166
394
|
).flat();
|
|
167
|
-
|
|
168
|
-
let
|
|
169
|
-
|
|
395
|
+
C(t, (e, o) => {
|
|
396
|
+
let r;
|
|
397
|
+
a["spread-last"] && e.node.type === "Literal" && o.node.type === "SpreadElement" ? r = !1 : a["spread-last"] && e.node.type === "SpreadElement" && o.node.type === "Literal" ? r = !0 : r = j(I(e, o, a)), r && s.report({
|
|
170
398
|
messageId: "unexpectedArrayIncludesOrder",
|
|
171
399
|
data: {
|
|
172
|
-
left:
|
|
173
|
-
right:
|
|
400
|
+
left: O(e.name),
|
|
401
|
+
right: O(o.name)
|
|
174
402
|
},
|
|
175
|
-
node:
|
|
403
|
+
node: o.node,
|
|
176
404
|
fix: (c) => {
|
|
177
|
-
let
|
|
178
|
-
if (
|
|
179
|
-
for (let y = 0,
|
|
180
|
-
|
|
181
|
-
return
|
|
405
|
+
let d = N(t, a);
|
|
406
|
+
if (a["spread-last"])
|
|
407
|
+
for (let y = 0, m = d.length; y < m; y++)
|
|
408
|
+
d.at(y).node.type === "SpreadElement" && d.push(d.splice(y, 1).at(0));
|
|
409
|
+
return P(c, t, d, u);
|
|
182
410
|
}
|
|
183
411
|
});
|
|
184
412
|
});
|
|
@@ -186,82 +414,124 @@ const D = "sort-array-includes", ue = N({
|
|
|
186
414
|
}
|
|
187
415
|
}
|
|
188
416
|
})
|
|
189
|
-
}),
|
|
190
|
-
name:
|
|
417
|
+
}), X = "sort-vue-attributes", fe = v({
|
|
418
|
+
name: X,
|
|
191
419
|
meta: {
|
|
192
420
|
type: "suggestion",
|
|
193
421
|
docs: {
|
|
194
|
-
description: "enforce sorted
|
|
195
|
-
recommended: !1
|
|
422
|
+
description: "enforce sorted Vue attributes"
|
|
196
423
|
},
|
|
197
424
|
fixable: "code",
|
|
198
425
|
schema: [
|
|
199
426
|
{
|
|
200
427
|
type: "object",
|
|
201
428
|
properties: {
|
|
429
|
+
"custom-groups": {
|
|
430
|
+
type: "object"
|
|
431
|
+
},
|
|
202
432
|
type: {
|
|
203
433
|
enum: [
|
|
204
434
|
i.alphabetical,
|
|
205
435
|
i.natural,
|
|
206
436
|
i["line-length"]
|
|
207
437
|
],
|
|
208
|
-
default: i.
|
|
438
|
+
default: i.alphabetical,
|
|
439
|
+
type: "string"
|
|
209
440
|
},
|
|
210
441
|
order: {
|
|
211
|
-
enum: [
|
|
212
|
-
default:
|
|
442
|
+
enum: [f.asc, f.desc],
|
|
443
|
+
default: f.asc,
|
|
444
|
+
type: "string"
|
|
213
445
|
},
|
|
214
446
|
"ignore-case": {
|
|
215
447
|
type: "boolean",
|
|
216
448
|
default: !1
|
|
449
|
+
},
|
|
450
|
+
groups: {
|
|
451
|
+
type: "array",
|
|
452
|
+
default: []
|
|
217
453
|
}
|
|
218
454
|
},
|
|
219
455
|
additionalProperties: !1
|
|
220
456
|
}
|
|
221
457
|
],
|
|
222
458
|
messages: {
|
|
223
|
-
|
|
459
|
+
unexpectedVueAttributesOrder: 'Expected "{{right}}" to come before "{{left}}"'
|
|
224
460
|
}
|
|
225
461
|
},
|
|
226
462
|
defaultOptions: [
|
|
227
463
|
{
|
|
228
464
|
type: i.alphabetical,
|
|
229
|
-
order:
|
|
465
|
+
order: f.asc
|
|
230
466
|
}
|
|
231
467
|
],
|
|
232
|
-
create: (
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
468
|
+
create: (s) => {
|
|
469
|
+
if (U.extname(s.getFilename()) !== ".vue")
|
|
470
|
+
return {};
|
|
471
|
+
if (!("defineTemplateBodyVisitor" in s.parserServices))
|
|
472
|
+
return {};
|
|
473
|
+
let { defineTemplateBodyVisitor: l } = s.parserServices;
|
|
474
|
+
return l({
|
|
475
|
+
VStartTag: (n) => {
|
|
476
|
+
if (n.attributes.length > 1) {
|
|
477
|
+
let a = k(s.options.at(0), {
|
|
478
|
+
type: i.alphabetical,
|
|
479
|
+
order: f.asc,
|
|
480
|
+
"ignore-case": !1,
|
|
481
|
+
"custom-groups": {},
|
|
482
|
+
groups: []
|
|
483
|
+
}), u = s.getSourceCode(), t = n.attributes.reduce(
|
|
484
|
+
(e, o) => {
|
|
485
|
+
if (o.key.type === "VDirectiveKey" && o.key.name.rawName === "bind")
|
|
486
|
+
return e.push([]), e;
|
|
487
|
+
let r, { getGroup: c, defineGroup: d, setCustomGroups: y } = G(
|
|
488
|
+
a.groups
|
|
489
|
+
);
|
|
490
|
+
return typeof o.key.name == "string" && o.key.type !== "VDirectiveKey" ? r = o.key.rawName : r = u.text.slice(...o.key.range), y(a["custom-groups"], r), o.value === null && d("shorthand"), o.loc.start.line !== o.loc.end.line && d("multiline"), e.at(-1).push({
|
|
491
|
+
size: w(o.range),
|
|
492
|
+
node: o,
|
|
493
|
+
group: c(),
|
|
494
|
+
name: r
|
|
495
|
+
}), e;
|
|
250
496
|
},
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
497
|
+
[[]]
|
|
498
|
+
);
|
|
499
|
+
for (let e of t)
|
|
500
|
+
C(e, (o, r) => {
|
|
501
|
+
let c = x(a.groups, o), d = x(a.groups, r);
|
|
502
|
+
(c > d || c === d && j(I(o, r, a))) && s.report({
|
|
503
|
+
messageId: "unexpectedVueAttributesOrder",
|
|
504
|
+
data: {
|
|
505
|
+
left: o.name,
|
|
506
|
+
right: r.name
|
|
507
|
+
},
|
|
508
|
+
node: r.node,
|
|
509
|
+
fix: (y) => {
|
|
510
|
+
let m = {};
|
|
511
|
+
for (let p of e) {
|
|
512
|
+
let h = x(a.groups, p);
|
|
513
|
+
h in m ? m[h] = N(
|
|
514
|
+
[...m[h], p],
|
|
515
|
+
a
|
|
516
|
+
) : m[h] = [p];
|
|
517
|
+
}
|
|
518
|
+
let g = [];
|
|
519
|
+
for (let p of Object.keys(m).sort())
|
|
520
|
+
g.push(...N(m[p], a));
|
|
521
|
+
return P(y, e, g, u);
|
|
522
|
+
}
|
|
523
|
+
});
|
|
524
|
+
});
|
|
525
|
+
}
|
|
255
526
|
}
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
}),
|
|
259
|
-
name:
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
}), K = "sort-named-exports", ge = v({
|
|
530
|
+
name: K,
|
|
260
531
|
meta: {
|
|
261
532
|
type: "suggestion",
|
|
262
533
|
docs: {
|
|
263
|
-
description: "enforce sorted named
|
|
264
|
-
recommended: !1
|
|
534
|
+
description: "enforce sorted named exports"
|
|
265
535
|
},
|
|
266
536
|
fixable: "code",
|
|
267
537
|
schema: [
|
|
@@ -274,11 +544,13 @@ const D = "sort-array-includes", ue = N({
|
|
|
274
544
|
i.natural,
|
|
275
545
|
i["line-length"]
|
|
276
546
|
],
|
|
277
|
-
default: i.
|
|
547
|
+
default: i.alphabetical,
|
|
548
|
+
type: "string"
|
|
278
549
|
},
|
|
279
550
|
order: {
|
|
280
|
-
enum: [
|
|
281
|
-
default:
|
|
551
|
+
enum: [f.asc, f.desc],
|
|
552
|
+
default: f.asc,
|
|
553
|
+
type: "string"
|
|
282
554
|
},
|
|
283
555
|
"ignore-case": {
|
|
284
556
|
type: "boolean",
|
|
@@ -289,51 +561,47 @@ const D = "sort-array-includes", ue = N({
|
|
|
289
561
|
}
|
|
290
562
|
],
|
|
291
563
|
messages: {
|
|
292
|
-
|
|
564
|
+
unexpectedNamedExportsOrder: 'Expected "{{right}}" to come before "{{left}}"'
|
|
293
565
|
}
|
|
294
566
|
},
|
|
295
567
|
defaultOptions: [
|
|
296
568
|
{
|
|
297
569
|
type: i.alphabetical,
|
|
298
|
-
order:
|
|
570
|
+
order: f.asc
|
|
299
571
|
}
|
|
300
572
|
],
|
|
301
|
-
create: (
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
);
|
|
306
|
-
if (r.length > 1) {
|
|
307
|
-
let s = P(a.options.at(0), {
|
|
573
|
+
create: (s) => ({
|
|
574
|
+
ExportNamedDeclaration: (l) => {
|
|
575
|
+
if (l.specifiers.length > 1) {
|
|
576
|
+
let n = k(s.options.at(0), {
|
|
308
577
|
type: i.alphabetical,
|
|
309
578
|
"ignore-case": !1,
|
|
310
|
-
order:
|
|
311
|
-
}),
|
|
312
|
-
size:
|
|
313
|
-
name:
|
|
314
|
-
node:
|
|
579
|
+
order: f.asc
|
|
580
|
+
}), a = s.getSourceCode(), u = l.specifiers.map((t) => ({
|
|
581
|
+
size: w(t.range),
|
|
582
|
+
name: t.local.name,
|
|
583
|
+
node: t
|
|
315
584
|
}));
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
messageId: "
|
|
585
|
+
C(u, (t, e) => {
|
|
586
|
+
j(I(t, e, n)) && s.report({
|
|
587
|
+
messageId: "unexpectedNamedExportsOrder",
|
|
319
588
|
data: {
|
|
320
|
-
left:
|
|
321
|
-
right:
|
|
589
|
+
left: t.name,
|
|
590
|
+
right: e.name
|
|
322
591
|
},
|
|
323
|
-
node:
|
|
324
|
-
fix: (
|
|
592
|
+
node: e.node,
|
|
593
|
+
fix: (o) => P(o, u, N(u, n), a)
|
|
325
594
|
});
|
|
326
595
|
});
|
|
327
596
|
}
|
|
328
597
|
}
|
|
329
598
|
})
|
|
330
|
-
}),
|
|
331
|
-
name:
|
|
599
|
+
}), q = "sort-named-imports", ye = v({
|
|
600
|
+
name: q,
|
|
332
601
|
meta: {
|
|
333
602
|
type: "suggestion",
|
|
334
603
|
docs: {
|
|
335
|
-
description: "enforce sorted
|
|
336
|
-
recommended: !1
|
|
604
|
+
description: "enforce sorted named imports"
|
|
337
605
|
},
|
|
338
606
|
fixable: "code",
|
|
339
607
|
schema: [
|
|
@@ -346,11 +614,13 @@ const D = "sort-array-includes", ue = N({
|
|
|
346
614
|
i.natural,
|
|
347
615
|
i["line-length"]
|
|
348
616
|
],
|
|
349
|
-
default: i.
|
|
617
|
+
default: i.alphabetical,
|
|
618
|
+
type: "string"
|
|
350
619
|
},
|
|
351
620
|
order: {
|
|
352
|
-
enum: [
|
|
353
|
-
default:
|
|
621
|
+
enum: [f.asc, f.desc],
|
|
622
|
+
default: f.asc,
|
|
623
|
+
type: "string"
|
|
354
624
|
},
|
|
355
625
|
"ignore-case": {
|
|
356
626
|
type: "boolean",
|
|
@@ -361,151 +631,164 @@ const D = "sort-array-includes", ue = N({
|
|
|
361
631
|
}
|
|
362
632
|
],
|
|
363
633
|
messages: {
|
|
364
|
-
|
|
634
|
+
unexpectedNamedImportsOrder: 'Expected "{{right}}" to come before "{{left}}"'
|
|
365
635
|
}
|
|
366
636
|
},
|
|
367
637
|
defaultOptions: [
|
|
368
638
|
{
|
|
369
639
|
type: i.alphabetical,
|
|
370
|
-
order:
|
|
640
|
+
order: f.asc
|
|
371
641
|
}
|
|
372
642
|
],
|
|
373
|
-
create: (
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
643
|
+
create: (s) => ({
|
|
644
|
+
ImportDeclaration: (l) => {
|
|
645
|
+
let n = l.specifiers.filter(
|
|
646
|
+
({ type: a }) => a === "ImportSpecifier"
|
|
647
|
+
);
|
|
648
|
+
if (n.length > 1) {
|
|
649
|
+
let a = k(s.options.at(0), {
|
|
377
650
|
type: i.alphabetical,
|
|
378
651
|
"ignore-case": !1,
|
|
379
|
-
order:
|
|
380
|
-
}),
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
else if (l.type === m.TSIndexSignature) {
|
|
389
|
-
let w = ((b = l.typeAnnotation) == null ? void 0 : b.range.at(0)) ?? l.range.at(1);
|
|
390
|
-
e = t(s.text.slice(l.range.at(0), w));
|
|
391
|
-
} else
|
|
392
|
-
e = t(
|
|
393
|
-
s.text.slice(l.range.at(0), l.range.at(1))
|
|
394
|
-
);
|
|
395
|
-
let g = n.endsWith(";") || n.endsWith(",") ? 1 : 0;
|
|
396
|
-
return {
|
|
397
|
-
size: k(l.range) - g,
|
|
398
|
-
node: l,
|
|
399
|
-
name: e
|
|
400
|
-
};
|
|
401
|
-
});
|
|
402
|
-
v(p, (l, e) => {
|
|
403
|
-
A(l, e, r) && a.report({
|
|
404
|
-
messageId: "unexpectedObjectTypesOrder",
|
|
652
|
+
order: f.asc
|
|
653
|
+
}), u = s.getSourceCode(), t = n.map((e) => ({
|
|
654
|
+
size: w(e.range),
|
|
655
|
+
name: e.local.name,
|
|
656
|
+
node: e
|
|
657
|
+
}));
|
|
658
|
+
C(t, (e, o) => {
|
|
659
|
+
j(I(e, o, a)) && s.report({
|
|
660
|
+
messageId: "unexpectedNamedImportsOrder",
|
|
405
661
|
data: {
|
|
406
|
-
left:
|
|
407
|
-
right:
|
|
662
|
+
left: e.name,
|
|
663
|
+
right: o.name
|
|
408
664
|
},
|
|
409
|
-
node:
|
|
410
|
-
fix: (
|
|
665
|
+
node: o.node,
|
|
666
|
+
fix: (r) => P(r, t, N(t, a), u)
|
|
411
667
|
});
|
|
412
668
|
});
|
|
413
669
|
}
|
|
414
670
|
}
|
|
415
671
|
})
|
|
416
|
-
}),
|
|
417
|
-
name:
|
|
672
|
+
}), F = "sort-object-types", me = v({
|
|
673
|
+
name: F,
|
|
418
674
|
meta: {
|
|
419
675
|
type: "suggestion",
|
|
420
676
|
docs: {
|
|
421
|
-
description: "enforce sorted
|
|
422
|
-
recommended: !1
|
|
677
|
+
description: "enforce sorted object types"
|
|
423
678
|
},
|
|
424
679
|
fixable: "code",
|
|
425
680
|
schema: [
|
|
426
681
|
{
|
|
427
682
|
type: "object",
|
|
428
683
|
properties: {
|
|
684
|
+
"custom-groups": {
|
|
685
|
+
type: "object"
|
|
686
|
+
},
|
|
429
687
|
type: {
|
|
430
688
|
enum: [
|
|
431
689
|
i.alphabetical,
|
|
432
690
|
i.natural,
|
|
433
691
|
i["line-length"]
|
|
434
692
|
],
|
|
435
|
-
default: i.
|
|
693
|
+
default: i.alphabetical,
|
|
694
|
+
type: "string"
|
|
436
695
|
},
|
|
437
696
|
order: {
|
|
438
|
-
enum: [
|
|
439
|
-
default:
|
|
697
|
+
enum: [f.asc, f.desc],
|
|
698
|
+
default: f.asc,
|
|
699
|
+
type: "string"
|
|
440
700
|
},
|
|
441
701
|
"ignore-case": {
|
|
442
702
|
type: "boolean",
|
|
443
703
|
default: !1
|
|
704
|
+
},
|
|
705
|
+
groups: {
|
|
706
|
+
type: "array",
|
|
707
|
+
default: []
|
|
444
708
|
}
|
|
445
709
|
},
|
|
446
710
|
additionalProperties: !1
|
|
447
711
|
}
|
|
448
712
|
],
|
|
449
713
|
messages: {
|
|
450
|
-
|
|
714
|
+
unexpectedObjectTypesOrder: 'Expected "{{right}}" to come before "{{left}}"'
|
|
451
715
|
}
|
|
452
716
|
},
|
|
453
717
|
defaultOptions: [
|
|
454
718
|
{
|
|
455
719
|
type: i.alphabetical,
|
|
456
|
-
order:
|
|
720
|
+
order: f.asc
|
|
457
721
|
}
|
|
458
722
|
],
|
|
459
|
-
create: (
|
|
460
|
-
|
|
461
|
-
if (
|
|
462
|
-
let
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
723
|
+
create: (s) => ({
|
|
724
|
+
TSTypeLiteral: (l) => {
|
|
725
|
+
if (l.members.length > 1) {
|
|
726
|
+
let n = k(s.options.at(0), {
|
|
727
|
+
type: i.alphabetical,
|
|
728
|
+
"ignore-case": !1,
|
|
729
|
+
order: f.asc,
|
|
730
|
+
"custom-groups": {},
|
|
731
|
+
groups: []
|
|
732
|
+
}), a = s.getSourceCode(), u = l.members.map((t) => {
|
|
733
|
+
var p, h;
|
|
734
|
+
let e, o = a.text.slice(t.range.at(0), t.range.at(1)), { getGroup: r, defineGroup: c, setCustomGroups: d } = G(
|
|
735
|
+
n.groups
|
|
736
|
+
), y = (S) => S.replace(/(,|;)$/, "");
|
|
737
|
+
if (t.type === "TSPropertySignature")
|
|
738
|
+
t.key.type === "Identifier" ? { name: e } = t.key : t.key.type === "Literal" ? e = `${t.key.value}` : e = a.text.slice(
|
|
739
|
+
t.range.at(0),
|
|
740
|
+
(p = t.typeAnnotation) == null ? void 0 : p.range.at(0)
|
|
741
|
+
);
|
|
742
|
+
else if (t.type === "TSIndexSignature") {
|
|
743
|
+
let S = ((h = t.typeAnnotation) == null ? void 0 : h.range.at(0)) ?? t.range.at(1);
|
|
744
|
+
e = y(a.text.slice(t.range.at(0), S));
|
|
745
|
+
} else
|
|
746
|
+
e = y(
|
|
747
|
+
a.text.slice(t.range.at(0), t.range.at(1))
|
|
748
|
+
);
|
|
749
|
+
d(n["custom-groups"], e), t.loc.start.line !== t.loc.end.line && c("multiline");
|
|
750
|
+
let g = o.endsWith(";") || o.endsWith(",") ? 1 : 0;
|
|
751
|
+
return {
|
|
752
|
+
size: w(t.range) - g,
|
|
753
|
+
group: r(),
|
|
754
|
+
node: t,
|
|
755
|
+
name: e
|
|
756
|
+
};
|
|
757
|
+
});
|
|
758
|
+
C(u, (t, e) => {
|
|
759
|
+
let o = x(n.groups, t), r = x(n.groups, e);
|
|
760
|
+
(o > r || o === r && j(I(t, e, n))) && s.report({
|
|
761
|
+
messageId: "unexpectedObjectTypesOrder",
|
|
762
|
+
data: {
|
|
763
|
+
left: O(t.name),
|
|
764
|
+
right: O(e.name)
|
|
765
|
+
},
|
|
766
|
+
node: e.node,
|
|
767
|
+
fix: (c) => {
|
|
768
|
+
let d = {};
|
|
769
|
+
for (let m of u) {
|
|
770
|
+
let g = x(n.groups, m);
|
|
771
|
+
g in d ? d[g] = N(
|
|
772
|
+
[...d[g], m],
|
|
773
|
+
n
|
|
774
|
+
) : d[g] = [m];
|
|
775
|
+
}
|
|
776
|
+
let y = [];
|
|
777
|
+
for (let m of Object.keys(d).sort())
|
|
778
|
+
y.push(...N(d[m], n));
|
|
779
|
+
return P(c, u, y, a);
|
|
780
|
+
}
|
|
781
|
+
});
|
|
782
|
+
});
|
|
499
783
|
}
|
|
500
784
|
}
|
|
501
785
|
})
|
|
502
|
-
}),
|
|
503
|
-
name:
|
|
786
|
+
}), H = "sort-union-types", he = v({
|
|
787
|
+
name: H,
|
|
504
788
|
meta: {
|
|
505
789
|
type: "suggestion",
|
|
506
790
|
docs: {
|
|
507
|
-
description: "enforce sorted union types"
|
|
508
|
-
recommended: !1
|
|
791
|
+
description: "enforce sorted union types"
|
|
509
792
|
},
|
|
510
793
|
fixable: "code",
|
|
511
794
|
schema: [
|
|
@@ -518,15 +801,21 @@ const D = "sort-array-includes", ue = N({
|
|
|
518
801
|
i.natural,
|
|
519
802
|
i["line-length"]
|
|
520
803
|
],
|
|
521
|
-
default: i.
|
|
804
|
+
default: i.alphabetical,
|
|
805
|
+
type: "string"
|
|
522
806
|
},
|
|
523
807
|
order: {
|
|
524
|
-
enum: [
|
|
525
|
-
default:
|
|
808
|
+
enum: [f.asc, f.desc],
|
|
809
|
+
default: f.asc,
|
|
810
|
+
type: "string"
|
|
526
811
|
},
|
|
527
812
|
"ignore-case": {
|
|
528
813
|
type: "boolean",
|
|
529
814
|
default: !1
|
|
815
|
+
},
|
|
816
|
+
"nullable-last": {
|
|
817
|
+
type: "boolean",
|
|
818
|
+
default: !1
|
|
530
819
|
}
|
|
531
820
|
},
|
|
532
821
|
additionalProperties: !1
|
|
@@ -539,63 +828,87 @@ const D = "sort-array-includes", ue = N({
|
|
|
539
828
|
defaultOptions: [
|
|
540
829
|
{
|
|
541
830
|
type: i.alphabetical,
|
|
542
|
-
order:
|
|
831
|
+
order: f.asc
|
|
543
832
|
}
|
|
544
833
|
],
|
|
545
|
-
create: (
|
|
546
|
-
TSUnionType: (
|
|
547
|
-
let
|
|
834
|
+
create: (s) => ({
|
|
835
|
+
TSUnionType: (l) => {
|
|
836
|
+
let n = s.getSourceCode(), a = k(s.options.at(0), {
|
|
548
837
|
type: i.alphabetical,
|
|
838
|
+
"nullable-last": !1,
|
|
549
839
|
"ignore-case": !1,
|
|
550
|
-
order:
|
|
551
|
-
}),
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
840
|
+
order: f.asc
|
|
841
|
+
}), u = l.types.map((t) => ({
|
|
842
|
+
group: t.type === "TSNullKeyword" || t.type === "TSUndefinedKeyword" ? "nullable" : "unknown",
|
|
843
|
+
name: n.text.slice(...t.range),
|
|
844
|
+
size: w(t.range),
|
|
845
|
+
node: t
|
|
555
846
|
}));
|
|
556
|
-
|
|
557
|
-
|
|
847
|
+
C(u, (t, e) => {
|
|
848
|
+
let o = j(I(t, e, a));
|
|
849
|
+
a["nullable-last"] && (t.group === "nullable" && e.group === "unknown" ? o = !0 : t.group === "unknown" && e.group === "nullable" && (o = !1)), o && s.report({
|
|
558
850
|
messageId: "unexpectedUnionTypesOrder",
|
|
559
851
|
data: {
|
|
560
|
-
left:
|
|
561
|
-
right:
|
|
852
|
+
left: O(t.name),
|
|
853
|
+
right: O(e.name)
|
|
562
854
|
},
|
|
563
855
|
node: e.node,
|
|
564
|
-
fix: (
|
|
856
|
+
fix: (r) => {
|
|
857
|
+
let c = [];
|
|
858
|
+
if (a["nullable-last"]) {
|
|
859
|
+
let d = [], y = u.filter((m) => m.group === "nullable" ? (d.push(m), !1) : !0);
|
|
860
|
+
c = [
|
|
861
|
+
...N(y, a),
|
|
862
|
+
...N(d, a)
|
|
863
|
+
];
|
|
864
|
+
} else
|
|
865
|
+
c = N(u, a);
|
|
866
|
+
return P(r, u, c, n);
|
|
867
|
+
}
|
|
565
868
|
});
|
|
566
869
|
});
|
|
567
870
|
}
|
|
568
871
|
})
|
|
569
|
-
}),
|
|
570
|
-
name:
|
|
872
|
+
}), Q = "sort-interfaces", be = v({
|
|
873
|
+
name: Q,
|
|
571
874
|
meta: {
|
|
572
875
|
type: "suggestion",
|
|
573
876
|
docs: {
|
|
574
|
-
description: "enforce sorted interface properties"
|
|
575
|
-
recommended: !1
|
|
877
|
+
description: "enforce sorted interface properties"
|
|
576
878
|
},
|
|
577
879
|
fixable: "code",
|
|
578
880
|
schema: [
|
|
579
881
|
{
|
|
580
882
|
type: "object",
|
|
581
883
|
properties: {
|
|
884
|
+
"custom-groups": {
|
|
885
|
+
type: "object"
|
|
886
|
+
},
|
|
582
887
|
type: {
|
|
583
888
|
enum: [
|
|
584
889
|
i.alphabetical,
|
|
585
890
|
i.natural,
|
|
586
891
|
i["line-length"]
|
|
587
892
|
],
|
|
588
|
-
default: i.
|
|
893
|
+
default: i.alphabetical,
|
|
894
|
+
type: "string"
|
|
589
895
|
},
|
|
590
896
|
order: {
|
|
591
|
-
enum: [
|
|
592
|
-
default:
|
|
897
|
+
enum: [f.asc, f.desc],
|
|
898
|
+
default: f.asc,
|
|
899
|
+
type: "string"
|
|
593
900
|
},
|
|
594
901
|
"ignore-case": {
|
|
595
902
|
type: "boolean",
|
|
596
903
|
default: !1
|
|
597
904
|
},
|
|
598
905
|
"ignore-pattern": {
|
|
906
|
+
items: {
|
|
907
|
+
type: "string"
|
|
908
|
+
},
|
|
909
|
+
type: "array"
|
|
910
|
+
},
|
|
911
|
+
groups: {
|
|
599
912
|
type: "array",
|
|
600
913
|
default: []
|
|
601
914
|
}
|
|
@@ -610,128 +923,121 @@ const D = "sort-array-includes", ue = N({
|
|
|
610
923
|
defaultOptions: [
|
|
611
924
|
{
|
|
612
925
|
type: i.alphabetical,
|
|
613
|
-
order:
|
|
926
|
+
order: f.asc
|
|
614
927
|
}
|
|
615
928
|
],
|
|
616
|
-
create: (
|
|
617
|
-
TSInterfaceDeclaration: (
|
|
618
|
-
if (
|
|
619
|
-
let
|
|
929
|
+
create: (s) => ({
|
|
930
|
+
TSInterfaceDeclaration: (l) => {
|
|
931
|
+
if (l.body.body.length > 1) {
|
|
932
|
+
let n = k(s.options.at(0), {
|
|
620
933
|
type: i.alphabetical,
|
|
621
934
|
"ignore-case": !1,
|
|
622
|
-
order:
|
|
623
|
-
"ignore-pattern": []
|
|
935
|
+
order: f.asc,
|
|
936
|
+
"ignore-pattern": [],
|
|
937
|
+
"custom-groups": {},
|
|
938
|
+
groups: []
|
|
624
939
|
});
|
|
625
|
-
if (!
|
|
626
|
-
(
|
|
940
|
+
if (!n["ignore-pattern"].some(
|
|
941
|
+
(a) => $(l.id.name, a)
|
|
627
942
|
)) {
|
|
628
|
-
let
|
|
629
|
-
(
|
|
630
|
-
var
|
|
631
|
-
if (e.type ===
|
|
632
|
-
return
|
|
633
|
-
let
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
943
|
+
let a = s.getSourceCode(), u = l.body.body.reduce(
|
|
944
|
+
(t, e) => {
|
|
945
|
+
var y, m, g;
|
|
946
|
+
if (e.type === "TSCallSignatureDeclaration")
|
|
947
|
+
return t.push([]), t;
|
|
948
|
+
let o, { getGroup: r, defineGroup: c, setCustomGroups: d } = G(
|
|
949
|
+
n.groups
|
|
950
|
+
);
|
|
951
|
+
if (e.type === "TSPropertySignature")
|
|
952
|
+
if (e.key.type === "Identifier")
|
|
953
|
+
({ name: o } = e.key);
|
|
954
|
+
else if (e.key.type === "Literal")
|
|
955
|
+
o = `${e.key.value}`;
|
|
639
956
|
else {
|
|
640
|
-
let
|
|
641
|
-
|
|
957
|
+
let p = ((y = e.typeAnnotation) == null ? void 0 : y.range.at(0)) ?? e.range.at(1) - (e.optional ? 1 : 0);
|
|
958
|
+
o = a.text.slice(e.range.at(0), p);
|
|
642
959
|
}
|
|
643
|
-
else if (e.type ===
|
|
644
|
-
let
|
|
645
|
-
|
|
960
|
+
else if (e.type === "TSIndexSignature") {
|
|
961
|
+
let p = ((m = e.typeAnnotation) == null ? void 0 : m.range.at(0)) ?? e.range.at(1);
|
|
962
|
+
o = a.text.slice(e.range.at(0), p);
|
|
646
963
|
} else {
|
|
647
|
-
let
|
|
648
|
-
|
|
964
|
+
let p = ((g = e.returnType) == null ? void 0 : g.range.at(0)) ?? e.range.at(1);
|
|
965
|
+
o = a.text.slice(e.range.at(0), p);
|
|
649
966
|
}
|
|
650
|
-
return
|
|
651
|
-
size:
|
|
967
|
+
return d(n["custom-groups"], o), e.loc.start.line !== e.loc.end.line && c("multiline"), t.at(-1).push({
|
|
968
|
+
size: w(e.range),
|
|
969
|
+
group: r(),
|
|
652
970
|
node: e,
|
|
653
|
-
name:
|
|
654
|
-
}),
|
|
971
|
+
name: o
|
|
972
|
+
}), t;
|
|
655
973
|
},
|
|
656
974
|
[[]]
|
|
657
975
|
);
|
|
658
|
-
for (let
|
|
659
|
-
|
|
660
|
-
|
|
976
|
+
for (let t of u)
|
|
977
|
+
C(t, (e, o) => {
|
|
978
|
+
let r = x(n.groups, e), c = x(n.groups, o);
|
|
979
|
+
(r > c || r === c && j(I(e, o, n))) && s.report({
|
|
661
980
|
messageId: "unexpectedInterfacePropertiesOrder",
|
|
662
981
|
data: {
|
|
663
|
-
left:
|
|
664
|
-
right:
|
|
982
|
+
left: O(e.name),
|
|
983
|
+
right: O(o.name)
|
|
665
984
|
},
|
|
666
|
-
node:
|
|
667
|
-
fix: (
|
|
985
|
+
node: o.node,
|
|
986
|
+
fix: (d) => {
|
|
987
|
+
let y = {};
|
|
988
|
+
for (let g of t) {
|
|
989
|
+
let p = x(n.groups, g);
|
|
990
|
+
p in y ? y[p] = N(
|
|
991
|
+
[...y[p], g],
|
|
992
|
+
n
|
|
993
|
+
) : y[p] = [g];
|
|
994
|
+
}
|
|
995
|
+
let m = [];
|
|
996
|
+
for (let g of Object.keys(y).sort())
|
|
997
|
+
m.push(...N(y[g], n));
|
|
998
|
+
return P(d, t, m, a);
|
|
999
|
+
}
|
|
668
1000
|
});
|
|
669
1001
|
});
|
|
670
1002
|
}
|
|
671
1003
|
}
|
|
672
1004
|
}
|
|
673
1005
|
})
|
|
674
|
-
})
|
|
675
|
-
let re = (a, o) => a.reduce((r, s) => {
|
|
676
|
-
let p = o(s);
|
|
677
|
-
return p in r || (r[p] = []), r[p].push(s), r;
|
|
678
|
-
}, {});
|
|
679
|
-
const Y = "sort-jsx-props", Ee = N({
|
|
1006
|
+
}), Y = "sort-jsx-props", xe = v({
|
|
680
1007
|
name: Y,
|
|
681
1008
|
meta: {
|
|
682
1009
|
type: "suggestion",
|
|
683
1010
|
docs: {
|
|
684
|
-
description: "enforce sorted JSX props"
|
|
685
|
-
recommended: !1
|
|
1011
|
+
description: "enforce sorted JSX props"
|
|
686
1012
|
},
|
|
687
1013
|
fixable: "code",
|
|
688
1014
|
schema: [
|
|
689
1015
|
{
|
|
690
1016
|
type: "object",
|
|
691
1017
|
properties: {
|
|
1018
|
+
"custom-groups": {
|
|
1019
|
+
type: "object"
|
|
1020
|
+
},
|
|
692
1021
|
type: {
|
|
693
1022
|
enum: [
|
|
694
1023
|
i.alphabetical,
|
|
695
1024
|
i.natural,
|
|
696
1025
|
i["line-length"]
|
|
697
1026
|
],
|
|
698
|
-
default: i.
|
|
1027
|
+
default: i.alphabetical,
|
|
1028
|
+
type: "string"
|
|
699
1029
|
},
|
|
700
1030
|
order: {
|
|
701
|
-
enum: [
|
|
702
|
-
default:
|
|
1031
|
+
enum: [f.asc, f.desc],
|
|
1032
|
+
default: f.asc,
|
|
1033
|
+
type: "string"
|
|
703
1034
|
},
|
|
704
|
-
|
|
705
|
-
type: "array"
|
|
706
|
-
default: []
|
|
1035
|
+
groups: {
|
|
1036
|
+
type: "array"
|
|
707
1037
|
},
|
|
708
1038
|
"ignore-case": {
|
|
709
1039
|
type: "boolean",
|
|
710
1040
|
default: !1
|
|
711
|
-
},
|
|
712
|
-
shorthand: {
|
|
713
|
-
enum: [
|
|
714
|
-
"first",
|
|
715
|
-
"last",
|
|
716
|
-
"ignore"
|
|
717
|
-
/* ignore */
|
|
718
|
-
]
|
|
719
|
-
},
|
|
720
|
-
callback: {
|
|
721
|
-
enum: [
|
|
722
|
-
"first",
|
|
723
|
-
"last",
|
|
724
|
-
"ignore"
|
|
725
|
-
/* ignore */
|
|
726
|
-
]
|
|
727
|
-
},
|
|
728
|
-
multiline: {
|
|
729
|
-
enum: [
|
|
730
|
-
"first",
|
|
731
|
-
"last",
|
|
732
|
-
"ignore"
|
|
733
|
-
/* ignore */
|
|
734
|
-
]
|
|
735
1041
|
}
|
|
736
1042
|
},
|
|
737
1043
|
additionalProperties: !1
|
|
@@ -744,103 +1050,151 @@ const Y = "sort-jsx-props", Ee = N({
|
|
|
744
1050
|
defaultOptions: [
|
|
745
1051
|
{
|
|
746
1052
|
type: i.alphabetical,
|
|
747
|
-
order:
|
|
1053
|
+
order: f.asc
|
|
748
1054
|
}
|
|
749
1055
|
],
|
|
750
|
-
create: (
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
1056
|
+
create: (s) => [".svelte", ".astro", ".vue"].includes(
|
|
1057
|
+
U.extname(s.getFilename())
|
|
1058
|
+
) ? {} : {
|
|
1059
|
+
JSXElement: (l) => {
|
|
1060
|
+
if (l.openingElement.attributes.length > 1) {
|
|
1061
|
+
let n = k(s.options.at(0), {
|
|
754
1062
|
type: i.alphabetical,
|
|
755
|
-
shorthand: "ignore",
|
|
756
|
-
multiline: "ignore",
|
|
757
|
-
callback: "ignore",
|
|
758
|
-
"always-on-top": [],
|
|
759
1063
|
"ignore-case": !1,
|
|
760
|
-
order:
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
let
|
|
768
|
-
|
|
769
|
-
|
|
1064
|
+
order: f.asc,
|
|
1065
|
+
"custom-groups": {},
|
|
1066
|
+
groups: []
|
|
1067
|
+
}), a = s.getSourceCode(), u = l.openingElement.attributes.reduce(
|
|
1068
|
+
(t, e) => {
|
|
1069
|
+
if (e.type === "JSXSpreadAttribute")
|
|
1070
|
+
return t.push([]), t;
|
|
1071
|
+
let o = e.name.type === "JSXNamespacedName" ? `${e.name.namespace.name}:${e.name.name.name}` : e.name.name, { getGroup: r, defineGroup: c, setCustomGroups: d } = G(
|
|
1072
|
+
n.groups
|
|
1073
|
+
);
|
|
1074
|
+
d(n["custom-groups"], o), e.value === null && c("shorthand"), e.loc.start.line !== e.loc.end.line && c("multiline");
|
|
1075
|
+
let y = {
|
|
1076
|
+
size: w(e.range),
|
|
1077
|
+
group: r(),
|
|
770
1078
|
node: e,
|
|
771
|
-
|
|
1079
|
+
name: o
|
|
772
1080
|
};
|
|
773
|
-
return
|
|
1081
|
+
return t.at(-1).push(y), t;
|
|
774
1082
|
},
|
|
775
1083
|
[[]]
|
|
776
1084
|
);
|
|
777
|
-
for (let
|
|
778
|
-
|
|
779
|
-
let
|
|
780
|
-
|
|
781
|
-
t = r["always-on-top"].indexOf(e.name) > r["always-on-top"].indexOf(n.name);
|
|
782
|
-
else if (e.position === n.position)
|
|
783
|
-
t = A(e, n, r);
|
|
784
|
-
else {
|
|
785
|
-
let c = {
|
|
786
|
-
exception: 2,
|
|
787
|
-
first: 1,
|
|
788
|
-
ignore: 0,
|
|
789
|
-
last: -1
|
|
790
|
-
};
|
|
791
|
-
t = c[e.position] < c[n.position];
|
|
792
|
-
}
|
|
793
|
-
t && a.report({
|
|
1085
|
+
for (let t of u)
|
|
1086
|
+
C(t, (e, o) => {
|
|
1087
|
+
let r = x(n.groups, e), c = x(n.groups, o);
|
|
1088
|
+
(r > c || r === c && j(I(e, o, n))) && s.report({
|
|
794
1089
|
messageId: "unexpectedJSXPropsOrder",
|
|
795
1090
|
data: {
|
|
796
1091
|
left: e.name,
|
|
797
|
-
right:
|
|
1092
|
+
right: o.name
|
|
798
1093
|
},
|
|
799
|
-
node:
|
|
800
|
-
fix: (
|
|
801
|
-
let
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
)
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
"ignore"
|
|
814
|
-
/* ignore */
|
|
815
|
-
), r),
|
|
816
|
-
j(y(
|
|
817
|
-
"last"
|
|
818
|
-
/* last */
|
|
819
|
-
), r)
|
|
820
|
-
].flat();
|
|
821
|
-
return L(c, l, b, s);
|
|
1094
|
+
node: o.node,
|
|
1095
|
+
fix: (d) => {
|
|
1096
|
+
let y = {};
|
|
1097
|
+
for (let g of t) {
|
|
1098
|
+
let p = x(n.groups, g);
|
|
1099
|
+
p in y ? y[p] = N(
|
|
1100
|
+
[...y[p], g],
|
|
1101
|
+
n
|
|
1102
|
+
) : y[p] = [g];
|
|
1103
|
+
}
|
|
1104
|
+
let m = [];
|
|
1105
|
+
for (let g of Object.keys(y).sort())
|
|
1106
|
+
m.push(...N(y[g], n));
|
|
1107
|
+
return P(d, t, m, a);
|
|
822
1108
|
}
|
|
823
1109
|
});
|
|
824
1110
|
});
|
|
825
1111
|
}
|
|
826
1112
|
}
|
|
827
|
-
})
|
|
828
|
-
});
|
|
829
|
-
class se {
|
|
830
|
-
static get() {
|
|
831
|
-
return this._instance ? this._instance : (this._instance = pe.parse(
|
|
832
|
-
de.readFileSync(ce.resolve(process.cwd(), "tsconfig.json"), "utf8")
|
|
833
|
-
), this._instance);
|
|
834
1113
|
}
|
|
835
|
-
}
|
|
836
|
-
|
|
837
|
-
const q = "sort-imports", we = N({
|
|
838
|
-
name: q,
|
|
1114
|
+
}), Z = "sort-exports", Ee = v({
|
|
1115
|
+
name: Z,
|
|
839
1116
|
meta: {
|
|
840
1117
|
type: "suggestion",
|
|
841
1118
|
docs: {
|
|
842
|
-
description: "enforce sorted
|
|
843
|
-
|
|
1119
|
+
description: "enforce sorted exports"
|
|
1120
|
+
},
|
|
1121
|
+
fixable: "code",
|
|
1122
|
+
schema: [
|
|
1123
|
+
{
|
|
1124
|
+
type: "object",
|
|
1125
|
+
properties: {
|
|
1126
|
+
type: {
|
|
1127
|
+
enum: [
|
|
1128
|
+
i.alphabetical,
|
|
1129
|
+
i.natural,
|
|
1130
|
+
i["line-length"]
|
|
1131
|
+
],
|
|
1132
|
+
default: i.alphabetical,
|
|
1133
|
+
type: "string"
|
|
1134
|
+
},
|
|
1135
|
+
order: {
|
|
1136
|
+
enum: [f.asc, f.desc],
|
|
1137
|
+
default: f.asc,
|
|
1138
|
+
type: "string"
|
|
1139
|
+
},
|
|
1140
|
+
"ignore-case": {
|
|
1141
|
+
type: "boolean",
|
|
1142
|
+
default: !1
|
|
1143
|
+
}
|
|
1144
|
+
},
|
|
1145
|
+
additionalProperties: !1
|
|
1146
|
+
}
|
|
1147
|
+
],
|
|
1148
|
+
messages: {
|
|
1149
|
+
unexpectedExportsOrder: 'Expected "{{right}}" to come before "{{left}}"'
|
|
1150
|
+
}
|
|
1151
|
+
},
|
|
1152
|
+
defaultOptions: [
|
|
1153
|
+
{
|
|
1154
|
+
type: i.alphabetical,
|
|
1155
|
+
order: f.asc
|
|
1156
|
+
}
|
|
1157
|
+
],
|
|
1158
|
+
create: (s) => {
|
|
1159
|
+
let l = k(s.options.at(0), {
|
|
1160
|
+
type: i.alphabetical,
|
|
1161
|
+
order: f.asc,
|
|
1162
|
+
"ignore-case": !1
|
|
1163
|
+
}), n = [[]], a = (u) => {
|
|
1164
|
+
u.type === "ExportAllDeclaration" && u.exported === null ? n.push([]) : n.at(-1).push({
|
|
1165
|
+
size: w(u.range),
|
|
1166
|
+
name: u.source.value,
|
|
1167
|
+
node: u
|
|
1168
|
+
});
|
|
1169
|
+
};
|
|
1170
|
+
return {
|
|
1171
|
+
ExportAllDeclaration: a,
|
|
1172
|
+
ExportNamedDeclaration: (u) => {
|
|
1173
|
+
u.source !== null && a(u);
|
|
1174
|
+
},
|
|
1175
|
+
"Program:exit": () => {
|
|
1176
|
+
let u = s.getSourceCode();
|
|
1177
|
+
for (let t of n)
|
|
1178
|
+
C(t, (e, o) => {
|
|
1179
|
+
j(I(e, o, l)) && s.report({
|
|
1180
|
+
messageId: "unexpectedExportsOrder",
|
|
1181
|
+
data: {
|
|
1182
|
+
left: e.name,
|
|
1183
|
+
right: o.name
|
|
1184
|
+
},
|
|
1185
|
+
node: o.node,
|
|
1186
|
+
fix: (r) => P(r, t, N(t, l), u)
|
|
1187
|
+
});
|
|
1188
|
+
});
|
|
1189
|
+
}
|
|
1190
|
+
};
|
|
1191
|
+
}
|
|
1192
|
+
}), ee = "sort-imports", Se = v({
|
|
1193
|
+
name: ee,
|
|
1194
|
+
meta: {
|
|
1195
|
+
type: "suggestion",
|
|
1196
|
+
docs: {
|
|
1197
|
+
description: "enforce sorted imports"
|
|
844
1198
|
},
|
|
845
1199
|
fixable: "code",
|
|
846
1200
|
schema: [
|
|
@@ -865,11 +1219,13 @@ const q = "sort-imports", we = N({
|
|
|
865
1219
|
i.natural,
|
|
866
1220
|
i["line-length"]
|
|
867
1221
|
],
|
|
868
|
-
default: i.
|
|
1222
|
+
default: i.alphabetical,
|
|
1223
|
+
type: "string"
|
|
869
1224
|
},
|
|
870
1225
|
order: {
|
|
871
|
-
enum: [
|
|
872
|
-
default:
|
|
1226
|
+
enum: [f.asc, f.desc],
|
|
1227
|
+
default: f.asc,
|
|
1228
|
+
type: "string"
|
|
873
1229
|
},
|
|
874
1230
|
"ignore-case": {
|
|
875
1231
|
type: "boolean",
|
|
@@ -880,8 +1236,10 @@ const q = "sort-imports", we = N({
|
|
|
880
1236
|
default: []
|
|
881
1237
|
},
|
|
882
1238
|
"internal-pattern": {
|
|
883
|
-
|
|
884
|
-
|
|
1239
|
+
items: {
|
|
1240
|
+
type: "string"
|
|
1241
|
+
},
|
|
1242
|
+
type: "array"
|
|
885
1243
|
},
|
|
886
1244
|
"newlines-between": {
|
|
887
1245
|
enum: [
|
|
@@ -890,12 +1248,8 @@ const q = "sort-imports", we = N({
|
|
|
890
1248
|
"never"
|
|
891
1249
|
/* never */
|
|
892
1250
|
],
|
|
893
|
-
default: "always"
|
|
894
|
-
|
|
895
|
-
},
|
|
896
|
-
"read-tsconfig": {
|
|
897
|
-
type: "boolean",
|
|
898
|
-
default: !1
|
|
1251
|
+
default: "always",
|
|
1252
|
+
type: "string"
|
|
899
1253
|
}
|
|
900
1254
|
},
|
|
901
1255
|
additionalProperties: !1
|
|
@@ -910,31 +1264,22 @@ const q = "sort-imports", we = N({
|
|
|
910
1264
|
defaultOptions: [
|
|
911
1265
|
{
|
|
912
1266
|
type: i.alphabetical,
|
|
913
|
-
order:
|
|
1267
|
+
order: f.asc
|
|
914
1268
|
}
|
|
915
1269
|
],
|
|
916
|
-
create: (
|
|
917
|
-
|
|
918
|
-
let o = P(a.options.at(0), {
|
|
1270
|
+
create: (s) => {
|
|
1271
|
+
let l = k(s.options.at(0), {
|
|
919
1272
|
"newlines-between": "always",
|
|
920
1273
|
"custom-groups": { type: {}, value: {} },
|
|
921
1274
|
"internal-pattern": ["~/**"],
|
|
922
1275
|
type: i.alphabetical,
|
|
923
|
-
|
|
924
|
-
order: d.asc,
|
|
1276
|
+
order: f.asc,
|
|
925
1277
|
"ignore-case": !1,
|
|
926
1278
|
groups: []
|
|
927
|
-
}),
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
for (let c of Object.keys(t.compilerOptions.paths))
|
|
932
|
-
r.push(c);
|
|
933
|
-
}
|
|
934
|
-
let s = a.getSourceCode(), p = [], l = (t) => {
|
|
935
|
-
let c, g = (h) => [".less", ".scss", ".sass", ".styl", ".pcss", ".css", ".sss"].some(
|
|
936
|
-
(O) => h.endsWith(O)
|
|
937
|
-
), y = (h) => [
|
|
1279
|
+
}), n = [], a = s.getSourceCode(), u = [], t = (r) => r.type === "ImportDeclaration" && r.specifiers.length === 0, e = (r) => {
|
|
1280
|
+
let c = (b) => [".less", ".scss", ".sass", ".styl", ".pcss", ".css", ".sss"].some(
|
|
1281
|
+
(E) => b.endsWith(E)
|
|
1282
|
+
), d = (b) => [
|
|
938
1283
|
"./index.d.js",
|
|
939
1284
|
"./index.d.ts",
|
|
940
1285
|
"./index.js",
|
|
@@ -942,93 +1287,82 @@ const q = "sort-imports", we = N({
|
|
|
942
1287
|
"./index",
|
|
943
1288
|
"./",
|
|
944
1289
|
"."
|
|
945
|
-
].includes(
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
for (let [E, I] of Object.entries(
|
|
951
|
-
o["custom-groups"][h] ?? {}
|
|
952
|
-
))
|
|
953
|
-
Array.isArray(I) && I.some((C) => R(O, C)) && f(E), typeof I == "string" && R(O, I) && f(E);
|
|
954
|
-
};
|
|
955
|
-
return t.importKind === "type" && (t.type === m.ImportDeclaration && (x("type", t.source.value), te(t.source.value) && f("builtin-type"), u(t) && f("internal-type"), y(t.source.value) && f("index-type"), b(t.source.value) && f("parent-type"), w(t.source.value) && f("sibling-type")), f("external-type"), f("type")), !c && t.type === m.ImportDeclaration && (x("value", t.source.value), te(t.source.value) && f("builtin"), u(t) && f("internal"), g(t.source.value) && f("style"), t.specifiers.length === 0 && f("side-effect"), y(t.source.value) && f("index"), b(t.source.value) && f("parent"), w(t.source.value) && f("sibling"), f("external")), c ?? "unknown";
|
|
956
|
-
}, e = (t) => {
|
|
1290
|
+
].includes(b), y = (b) => b.indexOf("..") === 0, m = (b) => b.indexOf("./") === 0, { getGroup: g, defineGroup: p, setCustomGroups: h } = G(l.groups), S = (b) => l["internal-pattern"].length && l["internal-pattern"].some(
|
|
1291
|
+
(E) => $(b.source.value, E)
|
|
1292
|
+
) || n.some((E) => $(b.source.value, E)), A = (b) => oe.includes(b) || oe.includes(`node:${b}`);
|
|
1293
|
+
return r.importKind === "type" && (r.type === "ImportDeclaration" && (h(l["custom-groups"].type, r.source.value), A(r.source.value) && p("builtin-type"), S(r) && p("internal-type"), d(r.source.value) && p("index-type"), y(r.source.value) && p("parent-type"), m(r.source.value) && p("sibling-type")), p("external-type"), p("type")), r.type === "ImportDeclaration" && (h(l["custom-groups"].value, r.source.value), A(r.source.value) && p("builtin"), S(r) && p("internal"), c(r.source.value) && p("style"), t(r) && p("side-effect"), d(r.source.value) && p("index"), y(r.source.value) && p("parent"), m(r.source.value) && p("sibling"), p("external")), g();
|
|
1294
|
+
}, o = (r) => {
|
|
957
1295
|
let c;
|
|
958
|
-
|
|
959
|
-
size:
|
|
960
|
-
group:
|
|
1296
|
+
r.type === "ImportDeclaration" ? c = r.source.value : r.moduleReference.type === "TSExternalModuleReference" && r.moduleReference.expression.type === "Literal" ? c = `${r.moduleReference.expression.value}` : c = a.text.slice(...r.moduleReference.range), u.push({
|
|
1297
|
+
size: w(r.range),
|
|
1298
|
+
group: e(r),
|
|
961
1299
|
name: c,
|
|
962
|
-
node:
|
|
1300
|
+
node: r
|
|
963
1301
|
});
|
|
964
1302
|
};
|
|
965
1303
|
return {
|
|
966
|
-
TSImportEqualsDeclaration:
|
|
967
|
-
ImportDeclaration:
|
|
1304
|
+
TSImportEqualsDeclaration: o,
|
|
1305
|
+
ImportDeclaration: o,
|
|
968
1306
|
"Program:exit": () => {
|
|
969
|
-
var
|
|
970
|
-
let
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
if (f.group === h || Array.isArray(h) && h.includes(f.group))
|
|
974
|
-
return u;
|
|
975
|
-
}
|
|
976
|
-
return o.groups.length;
|
|
977
|
-
}, c = (f, u) => !!s.getTokensBetween(
|
|
978
|
-
f.node,
|
|
979
|
-
z(u.node, s) || u.node,
|
|
1307
|
+
var m;
|
|
1308
|
+
let r = (g, p) => !!a.getTokensBetween(
|
|
1309
|
+
g.node,
|
|
1310
|
+
_(p.node, a) || p.node,
|
|
980
1311
|
{
|
|
981
1312
|
includeComments: !0
|
|
982
1313
|
}
|
|
983
|
-
).length,
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
).filter((
|
|
987
|
-
let
|
|
988
|
-
for (let
|
|
989
|
-
let
|
|
990
|
-
|
|
991
|
-
[...
|
|
992
|
-
|
|
993
|
-
) :
|
|
1314
|
+
).length, c = (g, p) => a.lines.slice(
|
|
1315
|
+
g.node.loc.end.line,
|
|
1316
|
+
p.node.loc.start.line - 1
|
|
1317
|
+
).filter((S) => !S.trim().length).length, d = (g, p) => {
|
|
1318
|
+
let h = [], S = {};
|
|
1319
|
+
for (let b of p) {
|
|
1320
|
+
let E = x(l.groups, b);
|
|
1321
|
+
E in S ? S[E] = N(
|
|
1322
|
+
[...S[E], b],
|
|
1323
|
+
l
|
|
1324
|
+
) : S[E] = [b];
|
|
994
1325
|
}
|
|
995
|
-
let
|
|
996
|
-
(
|
|
1326
|
+
let A = Object.keys(S).sort().reduce(
|
|
1327
|
+
(b, E) => [
|
|
1328
|
+
...b,
|
|
1329
|
+
...S[E]
|
|
1330
|
+
],
|
|
997
1331
|
[]
|
|
998
1332
|
);
|
|
999
|
-
for (let
|
|
1000
|
-
let
|
|
1001
|
-
if (
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1333
|
+
for (let b = 0, E = A.length; b < E; b++) {
|
|
1334
|
+
let M = A.at(b);
|
|
1335
|
+
if (h.push(
|
|
1336
|
+
g.replaceTextRange(
|
|
1337
|
+
L(p.at(b).node, a),
|
|
1338
|
+
a.text.slice(...L(M.node, a))
|
|
1005
1339
|
)
|
|
1006
|
-
),
|
|
1007
|
-
let
|
|
1008
|
-
if (
|
|
1009
|
-
let
|
|
1010
|
-
|
|
1011
|
-
|
|
1340
|
+
), l["newlines-between"] !== "ignore") {
|
|
1341
|
+
let T = A.at(b + 1);
|
|
1342
|
+
if (T) {
|
|
1343
|
+
let R = c(
|
|
1344
|
+
p.at(b),
|
|
1345
|
+
p.at(b + 1)
|
|
1012
1346
|
);
|
|
1013
|
-
(
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1347
|
+
(l["newlines-between"] === "always" && x(l.groups, M) === x(l.groups, T) && R !== 0 || l["newlines-between"] === "never" && R > 0) && h.push(
|
|
1348
|
+
g.removeRange([
|
|
1349
|
+
L(p.at(b).node, a).at(1),
|
|
1350
|
+
L(p.at(b + 1).node, a).at(0) - 1
|
|
1017
1351
|
])
|
|
1018
|
-
),
|
|
1019
|
-
|
|
1352
|
+
), l["newlines-between"] === "always" && x(l.groups, M) !== x(l.groups, T) && R > 1 && h.push(
|
|
1353
|
+
g.replaceTextRange(
|
|
1020
1354
|
[
|
|
1021
|
-
|
|
1022
|
-
|
|
1355
|
+
L(p.at(b).node, a).at(1),
|
|
1356
|
+
L(p.at(b + 1).node, a).at(
|
|
1023
1357
|
0
|
|
1024
1358
|
) - 1
|
|
1025
1359
|
],
|
|
1026
1360
|
`
|
|
1027
1361
|
`
|
|
1028
1362
|
)
|
|
1029
|
-
),
|
|
1030
|
-
|
|
1031
|
-
|
|
1363
|
+
), l["newlines-between"] === "always" && x(l.groups, M) !== x(l.groups, T) && R === 0 && h.push(
|
|
1364
|
+
g.insertTextAfterRange(
|
|
1365
|
+
L(p.at(b).node, a),
|
|
1032
1366
|
`
|
|
1033
1367
|
`
|
|
1034
1368
|
)
|
|
@@ -1036,207 +1370,248 @@ const q = "sort-imports", we = N({
|
|
|
1036
1370
|
}
|
|
1037
1371
|
}
|
|
1038
1372
|
}
|
|
1039
|
-
return
|
|
1040
|
-
},
|
|
1041
|
-
for (let
|
|
1042
|
-
let
|
|
1043
|
-
|
|
1373
|
+
return h;
|
|
1374
|
+
}, y = [[]];
|
|
1375
|
+
for (let g of u) {
|
|
1376
|
+
let p = (m = y.at(-1)) == null ? void 0 : m.at(-1);
|
|
1377
|
+
p && r(p, g) ? y.push([g]) : y.at(-1).push(g);
|
|
1044
1378
|
}
|
|
1045
|
-
for (let
|
|
1046
|
-
|
|
1047
|
-
let
|
|
1048
|
-
!
|
|
1379
|
+
for (let g of y)
|
|
1380
|
+
C(g, (p, h) => {
|
|
1381
|
+
let S = x(l.groups, p), A = x(l.groups, h), b = c(p, h);
|
|
1382
|
+
!(t(p.node) && t(h.node)) && !r(p, h) && (S > A || S === A && j(I(p, h, l))) && s.report({
|
|
1049
1383
|
messageId: "unexpectedImportsOrder",
|
|
1050
1384
|
data: {
|
|
1051
|
-
left:
|
|
1052
|
-
right:
|
|
1385
|
+
left: p.name,
|
|
1386
|
+
right: h.name
|
|
1053
1387
|
},
|
|
1054
|
-
node:
|
|
1055
|
-
fix: (
|
|
1056
|
-
}),
|
|
1388
|
+
node: h.node,
|
|
1389
|
+
fix: (E) => d(E, g)
|
|
1390
|
+
}), l["newlines-between"] === "never" && b > 0 && s.report({
|
|
1057
1391
|
messageId: "extraSpacingBetweenImports",
|
|
1058
1392
|
data: {
|
|
1059
|
-
left:
|
|
1060
|
-
right:
|
|
1393
|
+
left: p.name,
|
|
1394
|
+
right: h.name
|
|
1061
1395
|
},
|
|
1062
|
-
node:
|
|
1063
|
-
fix: (
|
|
1064
|
-
}),
|
|
1396
|
+
node: h.node,
|
|
1397
|
+
fix: (E) => d(E, g)
|
|
1398
|
+
}), l["newlines-between"] === "always" && (S < A && b === 0 ? s.report({
|
|
1065
1399
|
messageId: "missedSpacingBetweenImports",
|
|
1066
1400
|
data: {
|
|
1067
|
-
left:
|
|
1068
|
-
right:
|
|
1401
|
+
left: p.name,
|
|
1402
|
+
right: h.name
|
|
1069
1403
|
},
|
|
1070
|
-
node:
|
|
1071
|
-
fix: (
|
|
1072
|
-
}) : (
|
|
1404
|
+
node: h.node,
|
|
1405
|
+
fix: (E) => d(E, g)
|
|
1406
|
+
}) : (b > 1 || S === A && b > 0) && s.report({
|
|
1073
1407
|
messageId: "extraSpacingBetweenImports",
|
|
1074
1408
|
data: {
|
|
1075
|
-
left:
|
|
1076
|
-
right:
|
|
1409
|
+
left: p.name,
|
|
1410
|
+
right: h.name
|
|
1077
1411
|
},
|
|
1078
|
-
node:
|
|
1079
|
-
fix: (
|
|
1412
|
+
node: h.node,
|
|
1413
|
+
fix: (E) => d(E, g)
|
|
1080
1414
|
}));
|
|
1081
1415
|
});
|
|
1082
1416
|
}
|
|
1083
1417
|
};
|
|
1084
1418
|
}
|
|
1085
|
-
}),
|
|
1086
|
-
name:
|
|
1419
|
+
}), te = "sort-objects", Ne = v({
|
|
1420
|
+
name: te,
|
|
1087
1421
|
meta: {
|
|
1088
1422
|
type: "suggestion",
|
|
1089
1423
|
docs: {
|
|
1090
|
-
description: "enforce sorted
|
|
1091
|
-
recommended: !1
|
|
1424
|
+
description: "enforce sorted objects"
|
|
1092
1425
|
},
|
|
1093
1426
|
fixable: "code",
|
|
1094
1427
|
schema: [
|
|
1095
1428
|
{
|
|
1096
1429
|
type: "object",
|
|
1097
1430
|
properties: {
|
|
1431
|
+
"custom-groups": {
|
|
1432
|
+
type: "object"
|
|
1433
|
+
},
|
|
1434
|
+
"partition-by-comment": {
|
|
1435
|
+
type: ["boolean", "string", "array"],
|
|
1436
|
+
default: !1
|
|
1437
|
+
},
|
|
1438
|
+
"styled-components": {
|
|
1439
|
+
type: "boolean",
|
|
1440
|
+
default: !0
|
|
1441
|
+
},
|
|
1098
1442
|
type: {
|
|
1099
1443
|
enum: [
|
|
1100
1444
|
i.alphabetical,
|
|
1101
1445
|
i.natural,
|
|
1102
1446
|
i["line-length"]
|
|
1103
1447
|
],
|
|
1104
|
-
default: i.
|
|
1448
|
+
default: i.alphabetical,
|
|
1449
|
+
type: "string"
|
|
1450
|
+
},
|
|
1451
|
+
order: {
|
|
1452
|
+
enum: [f.asc, f.desc],
|
|
1453
|
+
default: f.asc,
|
|
1454
|
+
type: "string"
|
|
1105
1455
|
},
|
|
1106
1456
|
"ignore-case": {
|
|
1107
1457
|
type: "boolean",
|
|
1108
1458
|
default: !1
|
|
1109
1459
|
},
|
|
1110
|
-
order: {
|
|
1111
|
-
enum: [d.asc, d.desc],
|
|
1112
|
-
default: d.asc
|
|
1113
|
-
},
|
|
1114
1460
|
groups: {
|
|
1115
|
-
type: "array"
|
|
1116
|
-
default: ["property", "constructor", "method", "unknown"]
|
|
1461
|
+
type: "array"
|
|
1117
1462
|
}
|
|
1118
1463
|
},
|
|
1119
1464
|
additionalProperties: !1
|
|
1120
1465
|
}
|
|
1121
1466
|
],
|
|
1122
1467
|
messages: {
|
|
1123
|
-
|
|
1468
|
+
unexpectedObjectsOrder: 'Expected "{{right}}" to come before "{{left}}"'
|
|
1124
1469
|
}
|
|
1125
1470
|
},
|
|
1126
1471
|
defaultOptions: [
|
|
1127
1472
|
{
|
|
1128
1473
|
type: i.alphabetical,
|
|
1129
|
-
order:
|
|
1474
|
+
order: f.asc
|
|
1130
1475
|
}
|
|
1131
1476
|
],
|
|
1132
|
-
create: (
|
|
1133
|
-
|
|
1134
|
-
if (
|
|
1135
|
-
let
|
|
1477
|
+
create: (s) => {
|
|
1478
|
+
let l = (n) => {
|
|
1479
|
+
if (n.properties.length > 1) {
|
|
1480
|
+
let a = k(s.options.at(0), {
|
|
1481
|
+
"partition-by-comment": !1,
|
|
1136
1482
|
type: i.alphabetical,
|
|
1137
|
-
|
|
1483
|
+
"styled-components": !0,
|
|
1138
1484
|
"ignore-case": !1,
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
)
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1485
|
+
order: f.asc,
|
|
1486
|
+
"custom-groups": {},
|
|
1487
|
+
groups: []
|
|
1488
|
+
}), u = (r) => r.type === "Identifier" && r.name === "styled", t = (r) => r !== void 0 && r.type === "CallExpression" && (r.callee.type === "MemberExpression" && u(r.callee.object) || r.callee.type === "CallExpression" && u(r.callee.callee));
|
|
1489
|
+
if (!a["styled-components"] && (t(n.parent) || n.parent.type === "ArrowFunctionExpression" && t(n.parent.parent)))
|
|
1490
|
+
return;
|
|
1491
|
+
let e = s.getSourceCode(), o = (r) => r.reduce(
|
|
1492
|
+
(c, d) => {
|
|
1493
|
+
if (d.type === "SpreadElement" || d.type === "RestElement")
|
|
1494
|
+
return c.push([]), c;
|
|
1495
|
+
let y = _(d, e);
|
|
1496
|
+
a["partition-by-comment"] && y && ne(
|
|
1497
|
+
a["partition-by-comment"],
|
|
1498
|
+
y.value
|
|
1499
|
+
) && c.push([]);
|
|
1500
|
+
let m, g = "ignore", p = [], { getGroup: h, setCustomGroups: S } = G(a.groups);
|
|
1501
|
+
d.key.type === "Identifier" ? { name: m } = d.key : d.key.type === "Literal" ? m = `${d.key.value}` : m = e.text.slice(...d.key.range), d.value.type === "AssignmentPattern" && ((E) => {
|
|
1502
|
+
E.right.type === "Identifier" && p.push(E.right.name);
|
|
1503
|
+
let M = (T) => {
|
|
1504
|
+
let R = [];
|
|
1505
|
+
switch (T.type) {
|
|
1506
|
+
case "ArrowFunctionExpression":
|
|
1507
|
+
R.push(T.body);
|
|
1508
|
+
break;
|
|
1509
|
+
case "ConditionalExpression":
|
|
1510
|
+
R.push(T.consequent, T.alternate);
|
|
1511
|
+
break;
|
|
1512
|
+
case "LogicalExpression":
|
|
1513
|
+
case "BinaryExpression":
|
|
1514
|
+
R.push(T.left, T.right);
|
|
1515
|
+
break;
|
|
1516
|
+
case "CallExpression":
|
|
1517
|
+
R.push(...T.arguments);
|
|
1518
|
+
break;
|
|
1519
|
+
}
|
|
1520
|
+
R.forEach((B) => {
|
|
1521
|
+
B.type === "Identifier" && p.push(B.name), (B.type === "BinaryExpression" || B.type === "ConditionalExpression") && M(B);
|
|
1522
|
+
});
|
|
1523
|
+
};
|
|
1524
|
+
switch (E.right.type) {
|
|
1525
|
+
case "ArrowFunctionExpression":
|
|
1526
|
+
case "ConditionalExpression":
|
|
1527
|
+
case "LogicalExpression":
|
|
1528
|
+
case "BinaryExpression":
|
|
1529
|
+
case "CallExpression":
|
|
1530
|
+
M(E.right);
|
|
1531
|
+
break;
|
|
1532
|
+
}
|
|
1533
|
+
})(d.value), S(a["custom-groups"], m);
|
|
1534
|
+
let A = {
|
|
1535
|
+
size: w(d.range),
|
|
1536
|
+
group: h(),
|
|
1537
|
+
dependencies: p,
|
|
1538
|
+
node: d,
|
|
1539
|
+
position: g,
|
|
1540
|
+
name: m
|
|
1541
|
+
};
|
|
1542
|
+
return c.at(-1).push(A), c;
|
|
1543
|
+
},
|
|
1544
|
+
[[]]
|
|
1545
|
+
);
|
|
1546
|
+
for (let r of o(n.properties))
|
|
1547
|
+
C(r, (c, d) => {
|
|
1548
|
+
let y = x(a.groups, c), m = x(a.groups, d);
|
|
1549
|
+
if (y > m || y === m && j(I(c, d, a))) {
|
|
1550
|
+
let g = (p) => {
|
|
1551
|
+
let h = {};
|
|
1552
|
+
for (let A of r) {
|
|
1553
|
+
let b = x(a.groups, A);
|
|
1554
|
+
b in h ? h[b] = N(
|
|
1555
|
+
[...h[b], A],
|
|
1556
|
+
a
|
|
1557
|
+
) : h[b] = [A];
|
|
1558
|
+
}
|
|
1559
|
+
let S = [];
|
|
1560
|
+
for (let A of Object.keys(h).sort())
|
|
1561
|
+
S.push(...N(h[A], a));
|
|
1562
|
+
return P(p, r, S, e, {
|
|
1563
|
+
partitionComment: a["partition-by-comment"]
|
|
1564
|
+
});
|
|
1565
|
+
};
|
|
1566
|
+
s.report({
|
|
1567
|
+
messageId: "unexpectedObjectsOrder",
|
|
1568
|
+
data: {
|
|
1569
|
+
left: O(c.name),
|
|
1570
|
+
right: O(d.name)
|
|
1181
1571
|
},
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
...f,
|
|
1186
|
-
...b[u]
|
|
1187
|
-
],
|
|
1188
|
-
[]
|
|
1189
|
-
);
|
|
1190
|
-
for (let f = 0, u = w.length; f < u; f++)
|
|
1191
|
-
y.push(
|
|
1192
|
-
g.replaceTextRange(
|
|
1193
|
-
T(p.at(f).node, s),
|
|
1194
|
-
s.text.slice(
|
|
1195
|
-
...T(w.at(f).node, s)
|
|
1196
|
-
)
|
|
1197
|
-
)
|
|
1198
|
-
);
|
|
1199
|
-
return y;
|
|
1572
|
+
node: d.node,
|
|
1573
|
+
fix: g
|
|
1574
|
+
});
|
|
1200
1575
|
}
|
|
1201
1576
|
});
|
|
1202
|
-
});
|
|
1203
1577
|
}
|
|
1204
|
-
}
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1578
|
+
};
|
|
1579
|
+
return {
|
|
1580
|
+
ObjectExpression: l,
|
|
1581
|
+
ObjectPattern: l
|
|
1582
|
+
};
|
|
1583
|
+
}
|
|
1584
|
+
}), re = "sort-classes", Ae = v({
|
|
1585
|
+
name: re,
|
|
1208
1586
|
meta: {
|
|
1209
1587
|
type: "suggestion",
|
|
1210
1588
|
docs: {
|
|
1211
|
-
description: "enforce sorted
|
|
1212
|
-
recommended: !1
|
|
1589
|
+
description: "enforce sorted classes"
|
|
1213
1590
|
},
|
|
1214
1591
|
fixable: "code",
|
|
1215
1592
|
schema: [
|
|
1216
1593
|
{
|
|
1217
1594
|
type: "object",
|
|
1218
1595
|
properties: {
|
|
1219
|
-
"partition-by-comment": {
|
|
1220
|
-
type: ["boolean", "string", "array"],
|
|
1221
|
-
default: !1
|
|
1222
|
-
},
|
|
1223
1596
|
type: {
|
|
1224
1597
|
enum: [
|
|
1225
1598
|
i.alphabetical,
|
|
1226
1599
|
i.natural,
|
|
1227
1600
|
i["line-length"]
|
|
1228
1601
|
],
|
|
1229
|
-
default: i.
|
|
1230
|
-
|
|
1231
|
-
order: {
|
|
1232
|
-
enum: [d.asc, d.desc],
|
|
1233
|
-
default: d.asc
|
|
1602
|
+
default: i.alphabetical,
|
|
1603
|
+
type: "string"
|
|
1234
1604
|
},
|
|
1235
1605
|
"ignore-case": {
|
|
1236
1606
|
type: "boolean",
|
|
1237
1607
|
default: !1
|
|
1238
1608
|
},
|
|
1239
|
-
|
|
1609
|
+
order: {
|
|
1610
|
+
enum: [f.asc, f.desc],
|
|
1611
|
+
default: f.asc,
|
|
1612
|
+
type: "string"
|
|
1613
|
+
},
|
|
1614
|
+
groups: {
|
|
1240
1615
|
type: "array",
|
|
1241
1616
|
default: []
|
|
1242
1617
|
}
|
|
@@ -1245,112 +1620,86 @@ const q = "sort-imports", we = N({
|
|
|
1245
1620
|
}
|
|
1246
1621
|
],
|
|
1247
1622
|
messages: {
|
|
1248
|
-
|
|
1623
|
+
unexpectedClassesOrder: 'Expected "{{right}}" to come before "{{left}}"'
|
|
1249
1624
|
}
|
|
1250
1625
|
},
|
|
1251
1626
|
defaultOptions: [
|
|
1252
1627
|
{
|
|
1253
1628
|
type: i.alphabetical,
|
|
1254
|
-
order:
|
|
1629
|
+
order: f.asc
|
|
1255
1630
|
}
|
|
1256
1631
|
],
|
|
1257
|
-
create: (
|
|
1258
|
-
|
|
1259
|
-
if (
|
|
1260
|
-
let
|
|
1261
|
-
"partition-by-comment": !1,
|
|
1632
|
+
create: (s) => ({
|
|
1633
|
+
ClassBody: (l) => {
|
|
1634
|
+
if (l.body.length > 1) {
|
|
1635
|
+
let n = k(s.options.at(0), {
|
|
1262
1636
|
type: i.alphabetical,
|
|
1637
|
+
order: f.asc,
|
|
1263
1638
|
"ignore-case": !1,
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
for (let e of l(r.properties))
|
|
1298
|
-
v(e, (n, t) => {
|
|
1299
|
-
let c;
|
|
1300
|
-
if (n.position === "exception" && t.position === "exception")
|
|
1301
|
-
c = s["always-on-top"].indexOf(n.name) > s["always-on-top"].indexOf(t.name);
|
|
1302
|
-
else if (n.position === t.position)
|
|
1303
|
-
c = A(n, t, s);
|
|
1304
|
-
else {
|
|
1305
|
-
let g = {
|
|
1306
|
-
exception: 1,
|
|
1307
|
-
ignore: 0
|
|
1308
|
-
};
|
|
1309
|
-
c = g[n.position] < g[t.position];
|
|
1310
|
-
}
|
|
1311
|
-
if (c) {
|
|
1312
|
-
let g = (y) => {
|
|
1313
|
-
let b = re(e, ({ position: u }) => u), w = (u) => u in b ? b[u] : [], f = [
|
|
1314
|
-
w(
|
|
1315
|
-
"exception"
|
|
1316
|
-
/* exception */
|
|
1317
|
-
).sort(
|
|
1318
|
-
(u, x) => s["always-on-top"].indexOf(u.name) - s["always-on-top"].indexOf(x.name)
|
|
1319
|
-
),
|
|
1320
|
-
j(w(
|
|
1321
|
-
"ignore"
|
|
1322
|
-
/* ignore */
|
|
1323
|
-
), s)
|
|
1324
|
-
].flat();
|
|
1325
|
-
return L(y, e, f, p, {
|
|
1326
|
-
partitionComment: s["partition-by-comment"]
|
|
1327
|
-
});
|
|
1328
|
-
};
|
|
1329
|
-
a.report({
|
|
1330
|
-
messageId: "unexpectedObjectsOrder",
|
|
1331
|
-
data: {
|
|
1332
|
-
left: S(n.name),
|
|
1333
|
-
right: S(t.name)
|
|
1639
|
+
groups: ["property", "constructor", "method", "unknown"]
|
|
1640
|
+
}), a = s.getSourceCode(), u = l.body.map((t) => {
|
|
1641
|
+
var d;
|
|
1642
|
+
let e, { getGroup: o, defineGroup: r } = G(n.groups);
|
|
1643
|
+
t.type === "StaticBlock" ? e = "static" : t.type === "TSIndexSignature" ? e = a.text.slice(
|
|
1644
|
+
t.range.at(0),
|
|
1645
|
+
((d = t.typeAnnotation) == null ? void 0 : d.range.at(0)) ?? t.range.at(1)
|
|
1646
|
+
) : t.key.type === "Identifier" ? { name: e } = t.key : e = a.text.slice(...t.key.range);
|
|
1647
|
+
let c = e.startsWith("_") || e.startsWith("#");
|
|
1648
|
+
return t.type === "MethodDefinition" ? (t.kind === "constructor" && r("constructor"), (t.accessibility === "private" || c) && r("private-method"), t.static && r("static-method"), t.kind === "get" && r("get-method"), t.kind === "set" && r("set-method"), r("method")) : t.type === "TSIndexSignature" ? r("index-signature") : t.type === "PropertyDefinition" && ((t.accessibility === "private" || c) && r("private-property"), t.static && r("static-property"), r("property")), {
|
|
1649
|
+
size: w(t.range),
|
|
1650
|
+
group: o(),
|
|
1651
|
+
node: t,
|
|
1652
|
+
name: e
|
|
1653
|
+
};
|
|
1654
|
+
});
|
|
1655
|
+
C(u, (t, e) => {
|
|
1656
|
+
let o = x(n.groups, t), r = x(n.groups, e);
|
|
1657
|
+
t.name !== e.name && (o > r || o === r && j(I(t, e, n))) && s.report({
|
|
1658
|
+
messageId: "unexpectedClassesOrder",
|
|
1659
|
+
data: {
|
|
1660
|
+
left: O(t.name),
|
|
1661
|
+
right: O(e.name)
|
|
1662
|
+
},
|
|
1663
|
+
node: e.node,
|
|
1664
|
+
fix: (c) => {
|
|
1665
|
+
let d = [], y = u.reduce(
|
|
1666
|
+
(g, p) => {
|
|
1667
|
+
let h = x(n.groups, p);
|
|
1668
|
+
return h in g ? g[h] = N(
|
|
1669
|
+
[...g[h], p],
|
|
1670
|
+
n
|
|
1671
|
+
) : g[h] = [p], g;
|
|
1334
1672
|
},
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1673
|
+
{}
|
|
1674
|
+
), m = Object.keys(y).sort().reduce(
|
|
1675
|
+
(g, p) => [
|
|
1676
|
+
...g,
|
|
1677
|
+
...y[p]
|
|
1678
|
+
],
|
|
1679
|
+
[]
|
|
1680
|
+
);
|
|
1681
|
+
for (let g = 0, p = m.length; g < p; g++)
|
|
1682
|
+
d.push(
|
|
1683
|
+
c.replaceTextRange(
|
|
1684
|
+
L(u.at(g).node, a),
|
|
1685
|
+
a.text.slice(
|
|
1686
|
+
...L(m.at(g).node, a)
|
|
1687
|
+
)
|
|
1688
|
+
)
|
|
1689
|
+
);
|
|
1690
|
+
return d;
|
|
1338
1691
|
}
|
|
1339
1692
|
});
|
|
1693
|
+
});
|
|
1340
1694
|
}
|
|
1341
|
-
}
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
};
|
|
1346
|
-
}
|
|
1347
|
-
}), Z = "sort-exports", Se = N({
|
|
1348
|
-
name: Z,
|
|
1695
|
+
}
|
|
1696
|
+
})
|
|
1697
|
+
}), se = "sort-enums", Ie = v({
|
|
1698
|
+
name: se,
|
|
1349
1699
|
meta: {
|
|
1350
1700
|
type: "suggestion",
|
|
1351
1701
|
docs: {
|
|
1352
|
-
description: "enforce sorted
|
|
1353
|
-
recommended: !1
|
|
1702
|
+
description: "enforce sorted TypeScript enums"
|
|
1354
1703
|
},
|
|
1355
1704
|
fixable: "code",
|
|
1356
1705
|
schema: [
|
|
@@ -1363,71 +1712,64 @@ const q = "sort-imports", we = N({
|
|
|
1363
1712
|
i.natural,
|
|
1364
1713
|
i["line-length"]
|
|
1365
1714
|
],
|
|
1366
|
-
default: i.
|
|
1367
|
-
|
|
1368
|
-
order: {
|
|
1369
|
-
enum: [d.asc, d.desc],
|
|
1370
|
-
default: d.asc
|
|
1715
|
+
default: i.alphabetical,
|
|
1716
|
+
type: "string"
|
|
1371
1717
|
},
|
|
1372
1718
|
"ignore-case": {
|
|
1373
1719
|
type: "boolean",
|
|
1374
1720
|
default: !1
|
|
1721
|
+
},
|
|
1722
|
+
order: {
|
|
1723
|
+
enum: [f.asc, f.desc],
|
|
1724
|
+
default: f.asc,
|
|
1725
|
+
type: "string"
|
|
1375
1726
|
}
|
|
1376
1727
|
},
|
|
1377
1728
|
additionalProperties: !1
|
|
1378
1729
|
}
|
|
1379
1730
|
],
|
|
1380
1731
|
messages: {
|
|
1381
|
-
|
|
1732
|
+
unexpectedEnumsOrder: 'Expected "{{right}}" to come before "{{left}}"'
|
|
1382
1733
|
}
|
|
1383
1734
|
},
|
|
1384
1735
|
defaultOptions: [
|
|
1385
1736
|
{
|
|
1386
1737
|
type: i.alphabetical,
|
|
1387
|
-
order:
|
|
1738
|
+
order: f.asc
|
|
1388
1739
|
}
|
|
1389
1740
|
],
|
|
1390
|
-
create: (
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
A(e, n, o) && a.report({
|
|
1412
|
-
messageId: "unexpectedExportsOrder",
|
|
1413
|
-
data: {
|
|
1414
|
-
left: e.name,
|
|
1415
|
-
right: n.name
|
|
1416
|
-
},
|
|
1417
|
-
node: n.node,
|
|
1418
|
-
fix: (t) => L(t, l, j(l, o), p)
|
|
1419
|
-
});
|
|
1741
|
+
create: (s) => ({
|
|
1742
|
+
TSEnumDeclaration: (l) => {
|
|
1743
|
+
if (l.members.length > 1 && l.members.every(({ initializer: n }) => n)) {
|
|
1744
|
+
let n = k(s.options.at(0), {
|
|
1745
|
+
type: i.alphabetical,
|
|
1746
|
+
order: f.asc,
|
|
1747
|
+
"ignore-case": !1
|
|
1748
|
+
}), a = s.getSourceCode(), u = l.members.map((t) => ({
|
|
1749
|
+
name: t.id.type === "Literal" ? `${t.id.value}` : `${a.text.slice(...t.id.range)}`,
|
|
1750
|
+
size: w(t.range),
|
|
1751
|
+
node: t
|
|
1752
|
+
}));
|
|
1753
|
+
C(u, (t, e) => {
|
|
1754
|
+
j(I(t, e, n)) && s.report({
|
|
1755
|
+
messageId: "unexpectedEnumsOrder",
|
|
1756
|
+
data: {
|
|
1757
|
+
left: O(t.name),
|
|
1758
|
+
right: O(e.name)
|
|
1759
|
+
},
|
|
1760
|
+
node: e.node,
|
|
1761
|
+
fix: (o) => P(o, u, N(u, n), a)
|
|
1420
1762
|
});
|
|
1763
|
+
});
|
|
1421
1764
|
}
|
|
1422
|
-
}
|
|
1423
|
-
}
|
|
1424
|
-
}),
|
|
1425
|
-
name:
|
|
1765
|
+
}
|
|
1766
|
+
})
|
|
1767
|
+
}), ae = "sort-maps", Oe = v({
|
|
1768
|
+
name: ae,
|
|
1426
1769
|
meta: {
|
|
1427
1770
|
type: "suggestion",
|
|
1428
1771
|
docs: {
|
|
1429
|
-
description: "enforce sorted
|
|
1430
|
-
recommended: !1
|
|
1772
|
+
description: "enforce sorted Map elements"
|
|
1431
1773
|
},
|
|
1432
1774
|
fixable: "code",
|
|
1433
1775
|
schema: [
|
|
@@ -1440,60 +1782,79 @@ const q = "sort-imports", we = N({
|
|
|
1440
1782
|
i.natural,
|
|
1441
1783
|
i["line-length"]
|
|
1442
1784
|
],
|
|
1443
|
-
default: i.
|
|
1785
|
+
default: i.alphabetical,
|
|
1786
|
+
type: "string"
|
|
1787
|
+
},
|
|
1788
|
+
order: {
|
|
1789
|
+
enum: [f.asc, f.desc],
|
|
1790
|
+
default: f.asc,
|
|
1791
|
+
type: "string"
|
|
1444
1792
|
},
|
|
1445
1793
|
"ignore-case": {
|
|
1446
1794
|
type: "boolean",
|
|
1447
1795
|
default: !1
|
|
1448
|
-
},
|
|
1449
|
-
order: {
|
|
1450
|
-
enum: [d.asc, d.desc],
|
|
1451
|
-
default: d.asc
|
|
1452
1796
|
}
|
|
1453
1797
|
},
|
|
1454
1798
|
additionalProperties: !1
|
|
1455
1799
|
}
|
|
1456
1800
|
],
|
|
1457
1801
|
messages: {
|
|
1458
|
-
|
|
1802
|
+
unexpectedMapElementsOrder: 'Expected "{{right}}" to come before "{{left}}"'
|
|
1459
1803
|
}
|
|
1460
1804
|
},
|
|
1461
1805
|
defaultOptions: [
|
|
1462
1806
|
{
|
|
1463
1807
|
type: i.alphabetical,
|
|
1464
|
-
order:
|
|
1808
|
+
order: f.asc
|
|
1465
1809
|
}
|
|
1466
1810
|
],
|
|
1467
|
-
create: (
|
|
1468
|
-
|
|
1469
|
-
if (
|
|
1470
|
-
let
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1811
|
+
create: (s) => ({
|
|
1812
|
+
NewExpression: (l) => {
|
|
1813
|
+
if (l.callee.type === "Identifier" && l.callee.name === "Map" && l.arguments.length && l.arguments[0].type === "ArrayExpression") {
|
|
1814
|
+
let [{ elements: n }] = l.arguments;
|
|
1815
|
+
if (n.length > 1) {
|
|
1816
|
+
let a = k(s.options.at(0), {
|
|
1817
|
+
type: i.alphabetical,
|
|
1818
|
+
"ignore-case": !1,
|
|
1819
|
+
order: f.asc
|
|
1820
|
+
}), u = s.getSourceCode(), t = n.reduce(
|
|
1821
|
+
(e, o) => (o === null || o.type === "SpreadElement" ? e.push([]) : e.at(-1).push(o), e),
|
|
1822
|
+
[[]]
|
|
1823
|
+
);
|
|
1824
|
+
for (let e of t) {
|
|
1825
|
+
let o = e.map((r) => {
|
|
1826
|
+
let c;
|
|
1827
|
+
if (r.type === "ArrayExpression") {
|
|
1828
|
+
let [d] = r.elements;
|
|
1829
|
+
d ? d.type === "Literal" ? c = d.raw : c = u.text.slice(...d.range) : c = `${d}`;
|
|
1830
|
+
} else
|
|
1831
|
+
c = u.text.slice(...r.range);
|
|
1832
|
+
return {
|
|
1833
|
+
size: w(r.range),
|
|
1834
|
+
node: r,
|
|
1835
|
+
name: c
|
|
1836
|
+
};
|
|
1837
|
+
});
|
|
1838
|
+
C(o, (r, c) => {
|
|
1839
|
+
j(I(r, c, a)) && s.report({
|
|
1840
|
+
messageId: "unexpectedMapElementsOrder",
|
|
1841
|
+
data: {
|
|
1842
|
+
left: O(r.name),
|
|
1843
|
+
right: O(c.name)
|
|
1844
|
+
},
|
|
1845
|
+
node: c.node,
|
|
1846
|
+
fix: (d) => P(d, o, N(o, a), u)
|
|
1847
|
+
});
|
|
1848
|
+
});
|
|
1849
|
+
}
|
|
1850
|
+
}
|
|
1490
1851
|
}
|
|
1491
1852
|
}
|
|
1492
1853
|
})
|
|
1493
|
-
}),
|
|
1494
|
-
let
|
|
1495
|
-
let
|
|
1496
|
-
[
|
|
1854
|
+
}), ve = "eslint-plugin-perfectionist";
|
|
1855
|
+
let z = (s) => {
|
|
1856
|
+
let l = {
|
|
1857
|
+
[ee]: [
|
|
1497
1858
|
"error",
|
|
1498
1859
|
{
|
|
1499
1860
|
groups: [
|
|
@@ -1511,14 +1872,14 @@ let U = (a) => {
|
|
|
1511
1872
|
type: {}
|
|
1512
1873
|
},
|
|
1513
1874
|
"newlines-between": "always",
|
|
1514
|
-
"internal-pattern": ["~/**"]
|
|
1515
|
-
"read-tsconfig": !1
|
|
1875
|
+
"internal-pattern": ["~/**"]
|
|
1516
1876
|
}
|
|
1517
1877
|
],
|
|
1518
|
-
[
|
|
1878
|
+
[re]: [
|
|
1519
1879
|
"error",
|
|
1520
1880
|
{
|
|
1521
1881
|
groups: [
|
|
1882
|
+
"index-signature",
|
|
1522
1883
|
"static-property",
|
|
1523
1884
|
"private-property",
|
|
1524
1885
|
"property",
|
|
@@ -1526,85 +1887,83 @@ let U = (a) => {
|
|
|
1526
1887
|
"static-method",
|
|
1527
1888
|
"private-method",
|
|
1528
1889
|
"method",
|
|
1890
|
+
["get-method", "set-method"],
|
|
1529
1891
|
"unknown"
|
|
1530
1892
|
]
|
|
1531
1893
|
}
|
|
1532
1894
|
],
|
|
1533
|
-
[
|
|
1895
|
+
[te]: [
|
|
1534
1896
|
"error",
|
|
1535
1897
|
{
|
|
1536
|
-
"
|
|
1537
|
-
shorthand: "ignore",
|
|
1538
|
-
multiline: "first",
|
|
1539
|
-
callback: "ignore"
|
|
1898
|
+
"partition-by-comment": !1
|
|
1540
1899
|
}
|
|
1541
1900
|
],
|
|
1542
|
-
[
|
|
1543
|
-
"error",
|
|
1544
|
-
{
|
|
1545
|
-
"partition-by-comment": !1,
|
|
1546
|
-
"always-on-top": []
|
|
1547
|
-
}
|
|
1548
|
-
],
|
|
1549
|
-
[D]: [
|
|
1901
|
+
[J]: [
|
|
1550
1902
|
"error",
|
|
1551
1903
|
{
|
|
1552
1904
|
"spread-last": !0
|
|
1553
1905
|
}
|
|
1554
1906
|
],
|
|
1555
|
-
[J]: ["error"],
|
|
1556
|
-
[G]: ["error"],
|
|
1557
|
-
[X]: ["error"],
|
|
1558
|
-
[W]: ["error"],
|
|
1559
1907
|
[V]: ["error"],
|
|
1908
|
+
[W]: ["error"],
|
|
1909
|
+
[X]: ["error"],
|
|
1560
1910
|
[K]: ["error"],
|
|
1911
|
+
[q]: ["error"],
|
|
1912
|
+
[F]: ["error"],
|
|
1913
|
+
[H]: ["error"],
|
|
1914
|
+
[Q]: ["error"],
|
|
1915
|
+
[Y]: ["error"],
|
|
1561
1916
|
[Z]: ["error"],
|
|
1562
|
-
[
|
|
1917
|
+
[se]: ["error"],
|
|
1918
|
+
[ae]: ["error"]
|
|
1563
1919
|
};
|
|
1564
1920
|
return {
|
|
1565
1921
|
rules: Object.fromEntries(
|
|
1566
|
-
Object.entries(
|
|
1567
|
-
`perfectionist/${
|
|
1568
|
-
[
|
|
1922
|
+
Object.entries(l).map(([n, [a, u = {}]]) => [
|
|
1923
|
+
`perfectionist/${n}`,
|
|
1924
|
+
[a, Object.assign(u, s)]
|
|
1569
1925
|
])
|
|
1570
1926
|
),
|
|
1571
1927
|
plugins: ["perfectionist"]
|
|
1572
1928
|
};
|
|
1573
1929
|
};
|
|
1574
|
-
const
|
|
1930
|
+
const Te = {
|
|
1575
1931
|
rules: {
|
|
1576
|
-
[
|
|
1577
|
-
[
|
|
1578
|
-
[
|
|
1579
|
-
[
|
|
1580
|
-
[
|
|
1581
|
-
[
|
|
1582
|
-
[
|
|
1583
|
-
[
|
|
1584
|
-
[
|
|
1585
|
-
[
|
|
1586
|
-
[
|
|
1587
|
-
[
|
|
1588
|
-
[
|
|
1932
|
+
[J]: de,
|
|
1933
|
+
[W]: ce,
|
|
1934
|
+
[re]: Ae,
|
|
1935
|
+
[se]: Ie,
|
|
1936
|
+
[Z]: Ee,
|
|
1937
|
+
[ee]: Se,
|
|
1938
|
+
[Q]: be,
|
|
1939
|
+
[Y]: xe,
|
|
1940
|
+
[ae]: Oe,
|
|
1941
|
+
[K]: ge,
|
|
1942
|
+
[q]: ye,
|
|
1943
|
+
[F]: me,
|
|
1944
|
+
[te]: Ne,
|
|
1945
|
+
[V]: ue,
|
|
1946
|
+
[H]: he,
|
|
1947
|
+
[X]: fe
|
|
1589
1948
|
},
|
|
1590
1949
|
configs: {
|
|
1591
|
-
"recommended-alphabetical":
|
|
1950
|
+
"recommended-alphabetical": z({
|
|
1592
1951
|
type: i.alphabetical,
|
|
1593
|
-
order:
|
|
1952
|
+
order: f.asc,
|
|
1594
1953
|
"ignore-case": !1
|
|
1595
1954
|
}),
|
|
1596
|
-
"recommended-natural":
|
|
1955
|
+
"recommended-natural": z({
|
|
1597
1956
|
type: i.natural,
|
|
1598
|
-
order:
|
|
1957
|
+
order: f.asc,
|
|
1599
1958
|
"ignore-case": !1
|
|
1600
1959
|
}),
|
|
1601
|
-
"recommended-line-length":
|
|
1960
|
+
"recommended-line-length": z({
|
|
1602
1961
|
type: i["line-length"],
|
|
1603
|
-
order:
|
|
1962
|
+
order: f.desc
|
|
1604
1963
|
})
|
|
1605
1964
|
},
|
|
1606
|
-
name:
|
|
1965
|
+
name: ve
|
|
1607
1966
|
};
|
|
1608
1967
|
export {
|
|
1609
|
-
|
|
1968
|
+
Te as default
|
|
1610
1969
|
};
|