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.mjs CHANGED
@@ -1,97 +1,97 @@
1
1
  var ae = Object.defineProperty;
2
- var re = (t, l, s) => l in t ? ae(t, l, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[l] = s;
3
- var Q = (t, l, s) => (re(t, typeof l != "symbol" ? l + "" : l, s), s);
4
- import { AST_TOKEN_TYPES as C, AST_NODE_TYPES as u } from "@typescript-eslint/types";
5
- import { ESLintUtils as se, ASTUtils as $ } from "@typescript-eslint/utils";
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 B } from "minimatch";
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 A = se.RuleCreator(
13
- (t) => `https://eslint-plugin-perfectionist.azat.io/rules/${t}`
14
- ), I = (t) => t.replaceAll(/\s\s+/g, " ").trim(), N = (t) => {
15
- let [l, s] = t;
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__ */ ((t) => (t.alphabetical = "alphabetical", t["line-length"] = "line-length", t.natural = "natural", t))(i || {}), d = /* @__PURE__ */ ((t) => (t.desc = "desc", t.asc = "asc", t))(d || {});
19
- let j = (t, l, s) => {
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(t.name))
21
+ if ((e = l.dependencies) != null && e.includes(a.name))
22
22
  return !1;
23
- if ((o = t.dependencies) != null && o.includes(l.name))
23
+ if ((o = a.dependencies) != null && o.includes(l.name))
24
24
  return !0;
25
- let n = s.order === "asc" ? 1 : -1, p, r = (a) => s["ignore-case"] ? a.toLowerCase() : a;
26
- return s.type === i.alphabetical ? p = (a, c) => r(a.name).localeCompare(r(c.name)) : s.type === i.natural ? p = (a, c) => ne(r(a.name), r(c.name)) : p = (a, c) => a.size - c.size, n * p(t, l) > 0;
27
- }, S = (t, l) => [...t].sort((s, n) => Number(j(s, n, l)) || -1), pe = (t, l) => {
28
- let s = l.getTokenAfter(t, {
29
- filter: ({ type: n, value: p }) => !(n === C.Punctuator && [",", ";"].includes(p)),
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) === C.Block || (s == null ? void 0 : s.type) === C.Line) && t.loc.end.line === s.loc.end.line ? s : null;
33
- }, F = (t, l) => {
34
- let [s, n] = l.getTokensBefore(t, {
35
- filter: ({ type: p, value: r }) => !(p === C.Punctuator && [",", ";"].includes(r)),
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) === C.Block || (n == null ? void 0 : n.type) === C.Line) && t.loc.start.line - n.loc.end.line <= 1 && (s == null ? void 0 : s.loc.end.line) !== n.loc.start.line ? n : null;
40
- }, T = (t, l) => {
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 = t.range.at(0), n = t.range.at(1), p = l.text.slice(s, n);
43
- if ($.isParenthesized(t, l)) {
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
- t,
46
- $.isOpeningParenToken
47
- ), a = l.getTokenAfter(
48
- t,
49
- $.isClosingParenToken
45
+ a,
46
+ M.isOpeningParenToken
47
+ ), t = l.getTokenAfter(
48
+ a,
49
+ M.isClosingParenToken
50
50
  );
51
- s = o.range.at(0), n = a.range.at(1);
51
+ s = o.range.at(0), n = t.range.at(1);
52
52
  }
53
- let r = F(t, l);
53
+ let r = F(a, l);
54
54
  if (p.endsWith(";") || p.endsWith(",")) {
55
- let o = l.getTokensAfter(t, {
55
+ let o = l.getTokensAfter(a, {
56
56
  includeComments: !0,
57
57
  count: 2
58
58
  });
59
- t.loc.start.line === ((e = o.at(1)) == null ? void 0 : e.loc.start.line) && (n -= 1);
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
- }, v = (t, l, s, n) => {
62
+ }, R = (a, l, s, n) => {
63
63
  let p = [];
64
64
  return l.forEach(({ node: r }, e) => {
65
65
  p.push(
66
- t.replaceTextRange(
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 c = [
73
+ let d = [
74
74
  n.getTokenBefore(o).range.at(1),
75
75
  o.range.at(1)
76
76
  ];
77
- p.push(t.replaceTextRange(c, ""));
77
+ p.push(a.replaceTextRange(d, ""));
78
78
  let g = n.getTokenAfter(r);
79
79
  p.push(
80
- t.insertTextAfter(
80
+ a.insertTextAfter(
81
81
  (g == null ? void 0 : g.loc.end.line) === r.loc.end.line ? g : r,
82
- n.text.slice(...c)
82
+ n.text.slice(...d)
83
83
  )
84
84
  );
85
85
  }
86
86
  }), p;
87
- }, k = (t = {}, l) => Object.assign(l, t), P = (t, l) => {
88
- if (t.length > 1)
89
- for (let s = 1; s < t.length; s++) {
90
- let n = t.at(s - 1), p = t.at(s);
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 = A({
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: [d.asc, d.desc],
117
- default: d.asc
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: d.asc
138
+ order: f.asc
139
139
  }
140
140
  ],
141
- create: (t) => ({
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 = k(t.options.at(0), {
146
+ let n = P(a.options.at(0), {
147
147
  type: i.alphabetical,
148
- order: d.asc,
148
+ order: f.asc,
149
149
  "ignore-case": !1,
150
150
  "spread-last": !1
151
- }), p = t.getSourceCode(), r = s.reduce(
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: N(o.range),
154
+ size: k(o.range),
155
155
  type: o.type,
156
156
  node: o
157
157
  }), e),
158
158
  [[], []]
159
159
  ).flat();
160
- P(r, (e, o) => {
161
- let a;
162
- n["spread-last"] && e.node.type === u.Literal && o.node.type === u.SpreadElement ? a = !1 : n["spread-last"] && e.node.type === u.SpreadElement && o.node.type === u.Literal ? a = !0 : a = j(e, o, n), a && t.report({
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: (c) => {
169
+ fix: (d) => {
170
170
  let g = S(r, n);
171
- return n["spread-last"] && g.forEach((x, E) => {
172
- x.node.type === u.SpreadElement && g.push(g.splice(E, 1).at(0));
173
- }), v(c, r, g, p);
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 = A({
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: [d.asc, d.desc],
204
- default: d.asc
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: d.asc
221
+ order: f.asc
222
222
  }
223
223
  ],
224
- create: (t) => ({
224
+ create: (a) => ({
225
225
  ExportNamedDeclaration: (l) => {
226
226
  if (l.specifiers.length > 1) {
227
- let s = k(t.options.at(0), {
227
+ let s = P(a.options.at(0), {
228
228
  type: i.alphabetical,
229
229
  "ignore-case": !1,
230
- order: d.asc
231
- }), n = t.getSourceCode(), p = l.specifiers.map((r) => ({
232
- size: N(r.range),
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
- P(p, (r, e) => {
237
- j(r, e, s) && t.report({
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) => v(o, p, S(p, s), n)
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 = A({
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: [d.asc, d.desc],
273
- default: d.asc
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: d.asc
290
+ order: f.asc
291
291
  }
292
292
  ],
293
- create: (t) => ({
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 = k(t.options.at(0), {
299
+ let n = P(a.options.at(0), {
300
300
  type: i.alphabetical,
301
301
  "ignore-case": !1,
302
- order: d.asc
303
- }), p = t.getSourceCode(), r = s.map((e) => ({
304
- size: N(e.range),
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
- P(r, (e, o) => {
309
- j(e, o, n) && t.report({
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: (a) => v(a, r, S(r, n), p)
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 = A({
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: [d.asc, d.desc],
345
- default: d.asc
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: d.asc
362
+ order: f.asc
363
363
  }
364
364
  ],
365
- create: (t) => ({
365
+ create: (a) => ({
366
366
  TSTypeLiteral: (l) => {
367
367
  if (l.members.length > 1) {
368
- let s = k(t.options.at(0), {
368
+ let s = P(a.options.at(0), {
369
369
  type: i.alphabetical,
370
370
  "ignore-case": !1,
371
- order: d.asc
372
- }), n = t.getSourceCode(), p = l.members.map((r) => {
373
- var x, E;
374
- let e, o = n.text.slice(r.range.at(0), r.range.at(1)), a = (y) => y.replace(/(,|;)$/, "");
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
- (x = r.typeAnnotation) == null ? void 0 : x.range.at(0)
378
+ (h = r.typeAnnotation) == null ? void 0 : h.range.at(0)
379
379
  );
380
380
  else if (r.type === u.TSIndexSignature) {
381
- let y = ((E = r.typeAnnotation) == null ? void 0 : E.range.at(0)) ?? r.range.at(1);
382
- e = a(n.text.slice(r.range.at(0), y));
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 = a(
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: N(r.range) - g,
389
+ size: k(r.range) - g,
390
390
  node: r,
391
391
  name: e
392
392
  };
393
393
  });
394
- P(p, (r, e) => {
395
- j(r, e, s) && t.report({
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) => v(o, p, S(p, s), n)
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 = A({
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: [d.asc, d.desc],
431
- default: d.asc
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: d.asc
448
+ order: f.asc
449
449
  }
450
450
  ],
451
- create: (t) => ({
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 = k(t.options.at(0), {
456
+ let n = P(a.options.at(0), {
457
457
  type: i.alphabetical,
458
458
  "ignore-case": !1,
459
- order: d.asc
460
- }), p = t.getSourceCode();
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((a) => {
466
- let c;
467
- if (a.type === u.ArrayExpression) {
468
- let [g] = a.elements;
469
- g ? g.type === u.Literal ? c = g.raw : c = p.text.slice(...g.range) : c = `${g}`;
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
- c = p.text.slice(...a.range);
471
+ d = p.text.slice(...t.range);
472
472
  return {
473
- size: N(a.range),
474
- node: a,
475
- name: c
473
+ size: k(t.range),
474
+ node: t,
475
+ name: d
476
476
  };
477
477
  });
478
- P(o, (a, c) => {
479
- j(a, c, n) && t.report({
478
+ v(o, (t, d) => {
479
+ A(t, d, n) && a.report({
480
480
  messageId: "unexpectedMapElementsOrder",
481
481
  data: {
482
- left: I(a.name),
483
- right: I(c.name)
482
+ left: I(t.name),
483
+ right: I(d.name)
484
484
  },
485
- node: c.node,
486
- fix: (g) => v(g, o, S(o, n), p)
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
- }), W = "sort-union-types", me = A({
495
- name: W,
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: [d.asc, d.desc],
517
- default: d.asc
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: d.asc
534
+ order: f.asc
535
535
  }
536
536
  ],
537
- create: (t) => ({
537
+ create: (a) => ({
538
538
  TSUnionType: (l) => {
539
- let s = t.getSourceCode(), n = k(t.options.at(0), {
539
+ let s = a.getSourceCode(), n = P(a.options.at(0), {
540
540
  type: i.alphabetical,
541
541
  "ignore-case": !1,
542
- order: d.asc
542
+ order: f.asc
543
543
  }), p = l.types.map((r) => ({
544
544
  name: s.text.slice(...r.range),
545
- size: N(r.range),
545
+ size: k(r.range),
546
546
  node: r
547
547
  }));
548
- P(p, (r, e) => {
549
- j(r, e, n) && t.report({
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) => v(o, p, S(p, n), s)
556
+ fix: (o) => R(o, p, S(p, n), s)
557
557
  });
558
558
  });
559
559
  }
560
560
  })
561
- }), X = "sort-interfaces", ye = A({
562
- name: X,
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: [d.asc, d.desc],
584
- default: d.asc
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: d.asc
605
+ order: f.asc
606
606
  }
607
607
  ],
608
- create: (t) => ({
608
+ create: (a) => ({
609
609
  TSInterfaceDeclaration: (l) => {
610
610
  if (l.body.body.length > 1) {
611
- let s = k(t.options.at(0), {
611
+ let s = P(a.options.at(0), {
612
612
  type: i.alphabetical,
613
613
  "ignore-case": !1,
614
- order: d.asc,
614
+ order: f.asc,
615
615
  "ignore-pattern": []
616
616
  });
617
617
  if (!s["ignore-pattern"].some(
618
- (n) => B(l.id.name, n)
618
+ (n) => $(l.id.name, n)
619
619
  )) {
620
- let n = t.getSourceCode(), p = l.body.body.map((r) => {
621
- var o, a, c;
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 = ((a = r.typeAnnotation) == null ? void 0 : a.range.at(0)) ?? r.range.at(1);
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 = ((c = r.returnType) == null ? void 0 : c.range.at(0)) ?? r.range.at(1);
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: N(r.range),
640
+ size: k(r.range),
641
641
  node: r,
642
642
  name: e
643
643
  };
644
644
  });
645
- P(p, (r, e) => {
646
- j(r, e, s) && t.report({
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) => v(o, p, S(p, s), n)
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 = (t, l) => t.reduce((s, n) => {
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 G = "sort-jsx-props", he = A({
666
- name: G,
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: [d.asc, d.desc],
688
- default: d.asc
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: d.asc
733
+ order: f.asc
734
734
  }
735
735
  ],
736
- create: (t) => ({
736
+ create: (a) => ({
737
737
  JSXElement: (l) => {
738
738
  if (l.openingElement.attributes.length > 1) {
739
- let s = k(t.options.at(0), {
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: d.asc
747
- }), n = t.getSourceCode();
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 a = {
754
+ let t = {
755
755
  name: e.name.type === u.JSXNamespacedName ? `${e.name.namespace.name}:${e.name.name.name}` : e.name.name,
756
- size: N(e.range),
756
+ size: k(e.range),
757
757
  node: e,
758
758
  position: o
759
759
  };
760
- return r.at(-1).push(a), r;
760
+ return r.at(-1).push(t), r;
761
761
  },
762
762
  [[]]
763
763
  ).forEach((r) => {
764
- P(r, (e, o) => {
765
- let a;
764
+ v(r, (e, o) => {
765
+ let t;
766
766
  if (e.position === "exception" && o.position === "exception")
767
- a = s["always-on-top"].indexOf(e.name) > s["always-on-top"].indexOf(o.name);
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
- a = j(e, o, s);
769
+ t = A(e, o, s);
770
770
  else {
771
- let c = {
771
+ let d = {
772
772
  exception: 2,
773
773
  first: 1,
774
774
  ignore: 0,
775
775
  last: -1
776
776
  };
777
- a = c[e.position] < c[o.position];
777
+ t = d[e.position] < d[o.position];
778
778
  }
779
- a && t.report({
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: (c) => {
787
- let g = ee(r, ({ position: y }) => y), x = (y) => y in g ? g[y] : [], E = [
788
- x(
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, f) => s["always-on-top"].indexOf(y.name) - s["always-on-top"].indexOf(f.name)
792
+ (y, c) => s["always-on-top"].indexOf(y.name) - s["always-on-top"].indexOf(c.name)
793
793
  ),
794
- S(x(
794
+ S(h(
795
795
  "first"
796
796
  /* first */
797
797
  ), s),
798
- S(x(
798
+ S(h(
799
799
  "ignore"
800
800
  /* ignore */
801
801
  ), s),
802
- S(x(
802
+ S(h(
803
803
  "last"
804
804
  /* last */
805
805
  ), s)
806
806
  ].flat();
807
- return v(c, r, E, n);
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 = A({
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: [d.asc, d.desc],
847
- default: d.asc
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: d.asc
900
+ order: f.asc
889
901
  }
890
902
  ],
891
- create: (t) => {
903
+ create: (a) => {
892
904
  var o;
893
- let l = k(t.options.at(0), {
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: d.asc,
911
+ order: f.asc,
899
912
  "ignore-case": !1,
900
913
  groups: []
901
914
  }), s = [];
902
915
  if (l["read-tsconfig"]) {
903
- let a = te.get();
904
- (o = a.compilerOptions) != null && o.paths && Object.keys(a.compilerOptions.paths).forEach((c) => {
905
- s.push(c);
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 = t.getSourceCode(), p = [], r = (a) => {
909
- let c, g = (h) => [".less", ".scss", ".sass", ".styl", ".pcss", ".css", ".sss"].some(
910
- (w) => h.endsWith(w)
911
- ), x = (h) => [
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(h), E = (h) => h.indexOf("..") === 0, y = (h) => h.indexOf("./") === 0, f = (h) => {
920
- !c && l.groups.flat().includes(h) && (c = h);
921
- }, m = (h) => l["internal-pattern"].length && l["internal-pattern"].some(
922
- (w) => B(h.source.value, w)
923
- ) || s.some((w) => B(h.source.value, w));
924
- return a.importKind === "type" && (a.type === u.ImportDeclaration && (Z(a.source.value) && f("builtin-type"), m(a) && f("internal-type"), x(a.source.value) && f("index-type"), E(a.source.value) && f("parent-type"), y(a.source.value) && f("sibling-type")), f("type")), !c && a.type === u.ImportDeclaration && (Z(a.source.value) && f("builtin"), m(a) && f("internal"), g(a.source.value) && f("style"), a.specifiers.length === 0 && f("side-effect"), x(a.source.value) && f("index"), E(a.source.value) && f("parent"), y(a.source.value) && f("sibling"), f("external")), c ?? "unknown";
925
- }, e = (a) => {
926
- let c;
927
- a.type === u.ImportDeclaration ? c = a.source.value : a.moduleReference.type === u.TSExternalModuleReference && a.moduleReference.expression.type === u.Literal ? c = `${a.moduleReference.expression.value}` : c = n.text.slice(...a.moduleReference.range), p.push({
928
- size: N(a.range),
929
- group: r(a),
930
- name: c,
931
- node: a
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 a = (y) => {
939
- for (let f = 0, m = l.groups.length; f < m; f++) {
940
- let h = l.groups[f];
941
- if (y.group === h || Array.isArray(h) && h.includes(y.group))
942
- return f;
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
- }, c = (y, f) => !!n.getTokensBetween(
964
+ }, d = (y, c) => !!n.getTokensBetween(
946
965
  y.node,
947
- F(f.node, n) || f.node,
966
+ F(c.node, n) || c.node,
948
967
  {
949
968
  includeComments: !0
950
969
  }
951
- ).length, g = (y, f) => n.lines.slice(
970
+ ).length, g = (y, c) => n.lines.slice(
952
971
  y.node.loc.end.line,
953
- f.node.loc.start.line - 1
954
- ).filter((h) => !h.trim().length).length, x = (y, f) => {
955
- let m = [], h = f.reduce(
956
- (O, b) => {
957
- let R = a(b);
958
- return R in O ? O[R] = S(
959
- [...O[R], b],
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
- ) : O[R] = [b], O;
980
+ ) : E[j] = [w], E;
962
981
  },
963
982
  {}
964
- ), w = Object.keys(h).sort().reduce(
965
- (O, b) => [
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 w.forEach((O, b) => {
987
+ return b.forEach((E, w) => {
972
988
  if (m.push(
973
989
  y.replaceTextRange(
974
- T(f.at(b).node, n),
975
- n.text.slice(...T(O.node, n))
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 R = w.at(b + 1);
979
- if (R) {
980
- let L = g(
981
- f.at(b),
982
- f.at(b + 1)
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" && a(O) === a(R) && L !== 0 || l["newlines-between"] === "never" && L > 0) && m.push(
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(f.at(b).node, n).at(1),
987
- T(f.at(b + 1).node, n).at(0) - 1
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" && L > 1 && m.push(
1005
+ ), l["newlines-between"] === "always" && t(E) !== t(j) && C > 1 && m.push(
990
1006
  y.replaceTextRange(
991
1007
  [
992
- T(f.at(b).node, n).at(1),
993
- T(f.at(b + 1).node, n).at(
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" && a(O) !== a(R) && L === 0 && m.push(
1016
+ ), l["newlines-between"] === "always" && t(E) !== t(j) && C === 0 && m.push(
1001
1017
  y.insertTextAfterRange(
1002
- T(f.at(b).node, n),
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, f) => {
1013
- var h;
1014
- let m = (h = y.at(-1)) == null ? void 0 : h.at(-1);
1015
- return m && c(m, f) ? y.push([f]) : y.at(-1).push(f), y;
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
- P(y, (f, m) => {
1020
- let h = a(f), w = a(m), O = g(f, m);
1021
- !c(f, m) && (h > w || h === w && j(f, m, l)) && t.report({
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: f.name,
1040
+ left: c.name,
1025
1041
  right: m.name
1026
1042
  },
1027
1043
  node: m.node,
1028
- fix: (b) => x(b, y)
1029
- }), l["newlines-between"] === "never" && O > 0 && t.report({
1044
+ fix: (w) => h(w, y)
1045
+ }), l["newlines-between"] === "never" && E > 0 && a.report({
1030
1046
  messageId: "extraSpacingBetweenImports",
1031
1047
  data: {
1032
- left: f.name,
1048
+ left: c.name,
1033
1049
  right: m.name
1034
1050
  },
1035
1051
  node: m.node,
1036
- fix: (b) => x(b, y)
1037
- }), l["newlines-between"] === "always" && (h < w && O === 0 ? t.report({
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: f.name,
1056
+ left: c.name,
1041
1057
  right: m.name
1042
1058
  },
1043
1059
  node: m.node,
1044
- fix: (b) => x(b, y)
1045
- }) : (O > 1 || h === w && O > 0) && t.report({
1060
+ fix: (w) => h(w, y)
1061
+ }) : (E > 1 || x === b && E > 0) && a.report({
1046
1062
  messageId: "extraSpacingBetweenImports",
1047
1063
  data: {
1048
- left: f.name,
1064
+ left: c.name,
1049
1065
  right: m.name
1050
1066
  },
1051
1067
  node: m.node,
1052
- fix: (b) => x(b, y)
1068
+ fix: (w) => h(w, y)
1053
1069
  }));
1054
1070
  });
1055
1071
  });
1056
1072
  }
1057
1073
  };
1058
1074
  }
1059
- }), V = "sort-classes", be = A({
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: [d.asc, d.desc],
1086
- default: d.asc
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: d.asc
1119
+ order: f.asc
1104
1120
  }
1105
1121
  ],
1106
- create: (t) => ({
1122
+ create: (a) => ({
1107
1123
  ClassBody: (l) => {
1108
1124
  if (l.body.length > 1) {
1109
- let s = k(t.options.at(0), {
1125
+ let s = P(a.options.at(0), {
1110
1126
  type: i.alphabetical,
1111
- order: d.asc,
1127
+ order: f.asc,
1112
1128
  "ignore-case": !1,
1113
1129
  groups: ["property", "constructor", "method", "unknown"]
1114
- }), n = t.getSourceCode(), p = l.body.map((e) => {
1130
+ }), n = a.getSourceCode(), p = l.body.map((e) => {
1115
1131
  var g;
1116
- let o, a;
1117
- e.type === u.StaticBlock ? a = "static" : e.type === u.TSIndexSignature ? a = n.text.slice(
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: a } = e.key : a = n.text.slice(...e.key.range);
1121
- let c = (x) => {
1122
- !o && s.groups.flat().includes(x) && (o = x);
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" && c("constructor"), e.static && c("static-method"), e.accessibility === "private" && c("private-method"), c("method")) : e.type === u.PropertyDefinition && (e.static && c("static-property"), e.accessibility === "private" && c("private-property"), c("property")), {
1125
- size: N(e.range),
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: a
1144
+ name: t
1129
1145
  };
1130
1146
  }), r = (e) => {
1131
- for (let o = 0, a = s.groups.length; o < a; o++) {
1132
- let c = s.groups[o];
1133
- if (e.group === c || Array.isArray(c) && c.includes(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
- P(p, (e, o) => {
1139
- let a = r(e), c = r(o);
1140
- (a > c || a === c && j(e, o, s)) && t.report({
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 x = [], E = p.reduce(
1149
- (f, m) => {
1150
- let h = r(m);
1151
- return h in f ? f[h] = S(
1152
- [...f[h], m],
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
- ) : f[h] = [m], f;
1170
+ ) : c[x] = [m], c;
1155
1171
  },
1156
1172
  {}
1157
1173
  );
1158
- return Object.keys(E).sort().reduce(
1159
- (f, m) => [
1160
- ...f,
1161
- ...E[m]
1174
+ return Object.keys(O).sort().reduce(
1175
+ (c, m) => [
1176
+ ...c,
1177
+ ...O[m]
1162
1178
  ],
1163
1179
  []
1164
- ).forEach((f, m) => {
1165
- x.push(
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(f.node, n)
1185
+ ...T(c.node, n)
1170
1186
  )
1171
1187
  )
1172
1188
  );
1173
- }), x;
1189
+ }), h;
1174
1190
  }
1175
1191
  });
1176
1192
  });
1177
1193
  }
1178
1194
  }
1179
1195
  })
1180
- }), Y = "sort-objects", Ee = A({
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: [d.asc, d.desc],
1203
- default: d.asc
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: d.asc
1240
+ order: f.asc
1225
1241
  }
1226
1242
  ],
1227
- create: (t) => {
1243
+ create: (a) => {
1228
1244
  let l = (s) => {
1229
1245
  if (s.properties.length > 1) {
1230
- let n = k(t.options.at(0), {
1246
+ let n = P(a.options.at(0), {
1231
1247
  type: i.alphabetical,
1232
1248
  "ignore-case": !1,
1233
- order: d.asc,
1249
+ order: f.asc,
1234
1250
  "always-on-top": []
1235
- }), p = t.getSourceCode();
1251
+ }), p = a.getSourceCode();
1236
1252
  ((e) => e.reduce(
1237
- (o, a) => {
1238
- if (a.type === u.SpreadElement || a.type === u.RestElement)
1253
+ (o, t) => {
1254
+ if (t.type === u.SpreadElement || t.type === u.RestElement)
1239
1255
  return o.push([]), o;
1240
- let c, g = "ignore", x = [];
1241
- if (a.key.type === u.Identifier ? { name: c } = a.key : a.key.type === u.Literal ? c = `${a.key.value}` : c = p.text.slice(...a.key.range), a.key.type === u.Identifier && n["always-on-top"].includes(a.key.name) && (g = "exception"), a.value.type === u.AssignmentPattern) {
1242
- let y = (f, m) => {
1243
- f.right.type === u.Identifier && x.push(f.right.name), !m && f.left.type === u.Identifier && x.push(f.left.name);
1244
- let h = (w) => {
1245
- w.right.type === u.Identifier && x.push(w.right.name), w.left.type === u.BinaryExpression && y(w.left, !1);
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
- f.right.type === u.BinaryExpression && h(f.right);
1263
+ c.right.type === u.BinaryExpression && x(c.right);
1248
1264
  };
1249
- y(a.value, !0);
1265
+ y(t.value, !0);
1250
1266
  }
1251
- let E = {
1252
- size: N(a.range),
1253
- dependencies: x,
1254
- node: a,
1267
+ let O = {
1268
+ size: k(t.range),
1269
+ dependencies: h,
1270
+ node: t,
1255
1271
  position: g,
1256
- name: c
1272
+ name: d
1257
1273
  };
1258
- return o.at(-1).push(E), o;
1274
+ return o.at(-1).push(O), o;
1259
1275
  },
1260
1276
  [[]]
1261
1277
  ))(s.properties).forEach((e) => {
1262
- P(e, (o, a) => {
1263
- let c;
1264
- if (o.position === "exception" && a.position === "exception")
1265
- c = n["always-on-top"].indexOf(o.name) > n["always-on-top"].indexOf(a.name);
1266
- else if (o.position === a.position)
1267
- c = j(o, a, n);
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
- c = g[o.position] < g[a.position];
1289
+ d = g[o.position] < g[t.position];
1274
1290
  }
1275
- if (c) {
1276
- let g = (x) => {
1277
- let E = ee(e, ({ position: m }) => m), y = (m) => m in E ? E[m] : [], f = [
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, h) => n["always-on-top"].indexOf(m.name) - n["always-on-top"].indexOf(h.name)
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 v(x, e, f, p);
1305
+ return R(h, e, c, p);
1290
1306
  };
1291
- t.report({
1307
+ a.report({
1292
1308
  messageId: "unexpectedObjectsOrder",
1293
1309
  data: {
1294
1310
  left: I(o.name),
1295
- right: I(a.name)
1311
+ right: I(t.name)
1296
1312
  },
1297
- node: a.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 = A({
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: [d.asc, d.desc],
1333
- default: d.asc
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: d.asc
1366
+ order: f.asc
1351
1367
  }
1352
1368
  ],
1353
- create: (t) => {
1354
- let l = k(t.options.at(0), {
1369
+ create: (a) => {
1370
+ let l = P(a.options.at(0), {
1355
1371
  type: i.alphabetical,
1356
- order: d.asc,
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: N(p.range),
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 = t.getSourceCode();
1387
+ let p = a.getSourceCode();
1372
1388
  s.forEach((r) => {
1373
- P(r, (e, o) => {
1374
- j(e, o, l) && t.report({
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: (a) => v(a, r, S(r, l), p)
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 = A({
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: [d.asc, d.desc],
1415
- default: d.asc
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: d.asc
1444
+ order: f.asc
1429
1445
  }
1430
1446
  ],
1431
- create: (t) => ({
1447
+ create: (a) => ({
1432
1448
  TSEnumDeclaration: (l) => {
1433
1449
  if (l.members.length > 1 && l.members.some(({ initializer: s }) => s)) {
1434
- let s = k(t.options.at(0), {
1450
+ let s = P(a.options.at(0), {
1435
1451
  type: i.alphabetical,
1436
- order: d.asc,
1452
+ order: f.asc,
1437
1453
  "ignore-case": !1
1438
- }), n = t.getSourceCode(), p = l.members.map((r) => ({
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: N(r.range),
1456
+ size: k(r.range),
1441
1457
  node: r
1442
1458
  }));
1443
- P(p, (r, e) => {
1444
- j(r, e, s) && t.report({
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) => v(o, p, S(p, s), n)
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 M = (t) => {
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
- [G]: [
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, t)]
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
- [X]: ye,
1541
- [G]: he,
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
- [W]: me
1567
+ [G]: me
1548
1568
  },
1549
1569
  configs: {
1550
- "recommended-alphabetical": M({
1570
+ "recommended-alphabetical": B({
1551
1571
  type: i.alphabetical,
1552
- order: d.asc,
1572
+ order: f.asc,
1553
1573
  "ignore-case": !1
1554
1574
  }),
1555
- "recommended-natural": M({
1575
+ "recommended-natural": B({
1556
1576
  type: i.natural,
1557
- order: d.asc,
1577
+ order: f.asc,
1558
1578
  "ignore-case": !1
1559
1579
  }),
1560
- "recommended-line-length": M({
1580
+ "recommended-line-length": B({
1561
1581
  type: i["line-length"],
1562
- order: d.desc
1582
+ order: f.desc
1563
1583
  })
1564
1584
  },
1565
1585
  name: Ie