eslint-plugin-perfectionist 2.1.0 → 2.2.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,132 +1,132 @@
1
- import U from "path";
1
+ import B from "node:path";
2
2
  import { ESLintUtils as ne, ASTUtils as D } from "@typescript-eslint/utils";
3
- import { minimatch as M } from "minimatch";
3
+ import { minimatch as $ } from "minimatch";
4
4
  import le from "natural-compare-lite";
5
- import { builtinModules as ie } from "module";
5
+ import { builtinModules as ie } from "node:module";
6
6
  let O = ne.RuleCreator(
7
- (a) => `https://eslint-plugin-perfectionist.azat.io/rules/${a}`
8
- ), x = (a, l) => {
9
- for (let s = 0, o = a.length; s < o; s++) {
10
- let u = a[s];
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
11
  if (l.group === u || Array.isArray(u) && typeof l.group == "string" && u.includes(l.group))
12
- return s;
12
+ return n;
13
13
  }
14
- return a.length;
15
- }, w = (a) => {
16
- let [l, s] = a;
17
- return s - l;
18
- }, v = (a) => a > 0;
19
- 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 || {});
20
- let R = (a) => {
21
- let l, s = (u) => {
22
- !l && a.flat().includes(u) && (l = u);
14
+ return s.length;
15
+ }, v = (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 M = (s) => {
21
+ let l, n = (u) => {
22
+ !l && s.flat().includes(u) && (l = u);
23
23
  };
24
24
  return {
25
25
  getGroup: () => l ?? "unknown",
26
- setCustomGroups: (u, r) => {
26
+ setCustomGroups: (u, t) => {
27
27
  if (u)
28
- for (let [e, t] of Object.entries(u))
29
- Array.isArray(t) && t.some(
30
- (n) => M(r, n, {
28
+ for (let [e, o] of Object.entries(u))
29
+ Array.isArray(o) && o.some(
30
+ (r) => $(t, r, {
31
31
  nocomment: !0
32
32
  })
33
- ) && s(e), typeof t == "string" && M(r, t, {
33
+ ) && n(e), typeof o == "string" && $(t, o, {
34
34
  nocomment: !0
35
- }) && s(e);
35
+ }) && n(e);
36
36
  },
37
- defineGroup: s
37
+ defineGroup: n
38
38
  };
39
- }, A = (a, l, s) => {
40
- var e, t;
41
- if ((e = l.dependencies) != null && e.includes(a.name))
39
+ }, w = (s, l, n) => {
40
+ var e, o;
41
+ if ((e = l.dependencies) != null && e.includes(s.name))
42
42
  return -1;
43
- if ((t = a.dependencies) != null && t.includes(l.name))
43
+ if ((o = s.dependencies) != null && o.includes(l.name))
44
44
  return 1;
45
- let o = s.order === "asc" ? 1 : -1, u, r = (n) => s["ignore-case"] ? n.toLowerCase() : n;
46
- return s.type === i.alphabetical ? u = (n, c) => r(n.name).localeCompare(r(c.name)) : s.type === i.natural ? u = (n, c) => le(r(n.name), r(c.name)) : u = (n, c) => n.size - c.size, o * u(a, l);
47
- }, S = (a, l) => [...a].sort((s, o) => A(s, o, l)), pe = (a, l) => {
48
- let s = l.getTokenAfter(a, {
49
- filter: ({ value: o, type: u }) => !(u === "Punctuator" && [",", ";"].includes(o)),
45
+ let a = n.order === "asc" ? 1 : -1, u, t = (r) => n["ignore-case"] ? r.toLowerCase() : r;
46
+ return n.type === i.alphabetical ? u = (r, c) => t(r.name).localeCompare(t(c.name)) : n.type === i.natural ? u = (r, c) => le(t(r.name), t(c.name)) : u = (r, c) => r.size - c.size, a * u(s, l);
47
+ }, A = (s, l) => [...s].sort((n, a) => w(n, a, l)), pe = (s, l) => {
48
+ let n = l.getTokenAfter(s, {
49
+ filter: ({ value: a, type: u }) => !(u === "Punctuator" && [",", ";"].includes(a)),
50
50
  includeComments: !0
51
51
  });
52
- return ((s == null ? void 0 : s.type) === "Block" || (s == null ? void 0 : s.type) === "Line") && a.loc.end.line === s.loc.end.line ? s : null;
53
- }, oe = (a, l) => Array.isArray(a) && a.some(
54
- (s) => M(l.trim(), s, {
52
+ 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;
53
+ }, oe = (s, l) => Array.isArray(s) && s.some(
54
+ (n) => $(l.trim(), n, {
55
55
  nocomment: !0
56
56
  })
57
- ) || typeof a == "string" && M(l.trim(), a, {
57
+ ) || typeof s == "string" && $(l.trim(), s, {
58
58
  nocomment: !0
59
- }) || a === !0, _ = (a, l) => {
60
- let [s, o] = l.getTokensBefore(a, {
61
- filter: ({ value: u, type: r }) => !(r === "Punctuator" && [",", ";"].includes(u)),
59
+ }) || s === !0, _ = (s, l) => {
60
+ let [n, a] = l.getTokensBefore(s, {
61
+ filter: ({ value: u, type: t }) => !(t === "Punctuator" && [",", ";"].includes(u)),
62
62
  includeComments: !0,
63
63
  count: 2
64
64
  });
65
- return ((o == null ? void 0 : o.type) === "Block" || (o == null ? void 0 : o.type) === "Line") && a.loc.start.line - o.loc.end.line <= 1 && (s == null ? void 0 : s.loc.end.line) !== o.loc.start.line ? o : null;
66
- }, T = (a, l, s) => {
67
- var t;
68
- let o = a.range.at(0), u = a.range.at(1), r = l.text.slice(o, u);
69
- if (D.isParenthesized(a, l)) {
70
- let n = l.getTokenBefore(
71
- a,
65
+ 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;
66
+ }, G = (s, l, n) => {
67
+ var o;
68
+ let a = s.range.at(0), u = s.range.at(1), t = l.text.slice(a, u);
69
+ if (D.isParenthesized(s, l)) {
70
+ let r = l.getTokenBefore(
71
+ s,
72
72
  D.isOpeningParenToken
73
73
  ), c = l.getTokenAfter(
74
- a,
74
+ s,
75
75
  D.isClosingParenToken
76
76
  );
77
- o = n.range.at(0), u = c.range.at(1);
77
+ a = r.range.at(0), u = c.range.at(1);
78
78
  }
79
- let e = _(a, l);
80
- if (r.endsWith(";") || r.endsWith(",")) {
81
- let n = l.getTokensAfter(a, {
79
+ let e = _(s, l);
80
+ if (t.endsWith(";") || t.endsWith(",")) {
81
+ let r = l.getTokensAfter(s, {
82
82
  includeComments: !0,
83
83
  count: 2
84
84
  });
85
- a.loc.start.line === ((t = n.at(1)) == null ? void 0 : t.loc.start.line) && (u -= 1);
85
+ s.loc.start.line === ((o = r.at(1)) == null ? void 0 : o.loc.start.line) && (u -= 1);
86
86
  }
87
87
  return e && !oe(
88
- (s == null ? void 0 : s.partitionComment) ?? !1,
88
+ (n == null ? void 0 : n.partitionComment) ?? !1,
89
89
  e.value
90
- ) && (o = e.range.at(0)), [o, u];
91
- }, C = (a, l, s, o, u) => {
92
- var t, n;
93
- let r = [], e = ((t = l.at(0)) == null ? void 0 : t.node.loc.start.line) === ((n = l.at(-1)) == null ? void 0 : n.node.loc.end.line);
90
+ ) && (a = e.range.at(0)), [a, u];
91
+ }, P = (s, l, n, a, u) => {
92
+ var o, r;
93
+ 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);
94
94
  for (let c = 0, d = l.length; c < d; c++) {
95
- let { node: m } = l.at(c);
96
- r.push(
97
- a.replaceTextRange(
98
- T(m, o, u),
99
- o.text.slice(
100
- ...T(s.at(c).node, o, u)
95
+ let { node: y } = l.at(c);
96
+ t.push(
97
+ s.replaceTextRange(
98
+ G(y, a, u),
99
+ a.text.slice(
100
+ ...G(n.at(c).node, a, u)
101
101
  )
102
102
  )
103
103
  );
104
- let g = pe(s.at(c).node, o);
105
- if (g && !e) {
106
- let y = [
107
- o.getTokenBefore(g).range.at(1),
108
- g.range.at(1)
104
+ let m = pe(n.at(c).node, a);
105
+ if (m && !e) {
106
+ let p = [
107
+ a.getTokenBefore(m).range.at(1),
108
+ m.range.at(1)
109
109
  ];
110
- r.push(a.replaceTextRange(y, ""));
111
- let h = o.getTokenAfter(m);
112
- r.push(
113
- a.insertTextAfter(
114
- (h == null ? void 0 : h.loc.end.line) === m.loc.end.line ? h : m,
115
- o.text.slice(...y)
110
+ t.push(s.replaceTextRange(p, ""));
111
+ let h = a.getTokenAfter(y);
112
+ t.push(
113
+ s.insertTextAfter(
114
+ (h == null ? void 0 : h.loc.end.line) === y.loc.end.line ? h : y,
115
+ a.text.slice(...p)
116
116
  )
117
117
  );
118
118
  }
119
119
  }
120
- return r;
121
- }, j = (a = {}, l) => Object.assign(l, a), k = (a, l) => {
122
- if (a.length > 1)
123
- for (let s = 1; s < a.length; s++) {
124
- let o = a.at(s - 1), u = a.at(s);
125
- o && u && l(o, u, s - 1);
120
+ return t;
121
+ }, k = (s = {}, l) => Object.assign(l, s), C = (s, l) => {
122
+ if (s.length > 1)
123
+ for (let n = 1; n < s.length; n++) {
124
+ let a = s.at(n - 1), u = s.at(n);
125
+ a && u && l(a, u, n - 1);
126
126
  }
127
127
  };
128
- const V = "sort-svelte-attributes", ue = O({
129
- name: V,
128
+ const W = "sort-svelte-attributes", ue = O({
129
+ name: W,
130
130
  meta: {
131
131
  type: "suggestion",
132
132
  docs: {
@@ -175,62 +175,62 @@ const V = "sort-svelte-attributes", ue = O({
175
175
  order: f.asc
176
176
  }
177
177
  ],
178
- create: (a) => U.extname(a.getFilename()) !== ".svelte" ? {} : {
178
+ create: (s) => B.extname(s.getFilename()) !== ".svelte" ? {} : {
179
179
  SvelteStartTag: (l) => {
180
180
  if (l.attributes.length > 1) {
181
- let s = j(a.options.at(0), {
181
+ let n = k(s.options.at(0), {
182
182
  type: i.alphabetical,
183
183
  order: f.asc,
184
184
  "ignore-case": !1,
185
185
  "custom-groups": {},
186
186
  groups: []
187
- }), o = a.getSourceCode(), u = l.attributes.reduce(
188
- (r, e) => {
187
+ }), a = s.getSourceCode(), u = l.attributes.reduce(
188
+ (t, e) => {
189
189
  if (e.type === "SvelteSpreadAttribute")
190
- return r.push([]), r;
191
- let t, { getGroup: n, defineGroup: c, setCustomGroups: d } = R(
192
- s.groups
190
+ return t.push([]), t;
191
+ let o, { getGroup: r, defineGroup: c, setCustomGroups: d } = M(
192
+ n.groups
193
193
  );
194
- return e.key.type === "SvelteSpecialDirectiveKey" ? t = o.text.slice(...e.key.range) : typeof e.key.name == "string" ? { name: t } = e.key : t = o.text.slice(...e.key.range), d(s["custom-groups"], t), 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"), r.at(-1).push({
195
- size: w(e.range),
194
+ 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({
195
+ size: v(e.range),
196
196
  node: e,
197
- group: n(),
198
- name: t
199
- }), r;
197
+ group: r(),
198
+ name: o
199
+ }), t;
200
200
  },
201
201
  [[]]
202
202
  );
203
- for (let r of u)
204
- k(r, (e, t) => {
205
- let n = x(s.groups, e), c = x(s.groups, t);
206
- (n > c || n === c && v(A(e, t, s))) && a.report({
203
+ for (let t of u)
204
+ C(t, (e, o) => {
205
+ let r = x(n.groups, e), c = x(n.groups, o);
206
+ (r > c || r === c && j(w(e, o, n))) && s.report({
207
207
  messageId: "unexpectedSvelteAttributesOrder",
208
208
  data: {
209
209
  left: e.name,
210
- right: t.name
210
+ right: o.name
211
211
  },
212
- node: t.node,
212
+ node: o.node,
213
213
  fix: (d) => {
214
- let m = {};
215
- for (let p of r) {
216
- let y = x(s.groups, p);
217
- y in m ? m[y] = S(
218
- [...m[y], p],
219
- s
220
- ) : m[y] = [p];
214
+ let y = {};
215
+ for (let g of t) {
216
+ let p = x(n.groups, g);
217
+ p in y ? y[p] = A(
218
+ [...y[p], g],
219
+ n
220
+ ) : y[p] = [g];
221
221
  }
222
- let g = [];
223
- for (let p of Object.keys(m).sort())
224
- g.push(...S(m[p], s));
225
- return C(d, r, g, o);
222
+ let m = [];
223
+ for (let g of Object.keys(y).sort())
224
+ m.push(...A(y[g], n));
225
+ return P(d, t, m, a);
226
226
  }
227
227
  });
228
228
  });
229
229
  }
230
230
  }
231
231
  }
232
- }), W = "sort-astro-attributes", ce = O({
233
- name: W,
232
+ }), V = "sort-astro-attributes", ce = O({
233
+ name: V,
234
234
  meta: {
235
235
  type: "suggestion",
236
236
  docs: {
@@ -280,55 +280,55 @@ const V = "sort-svelte-attributes", ue = O({
280
280
  }
281
281
  ],
282
282
  // @ts-ignore
283
- create: (a) => U.extname(a.getFilename()) !== ".astro" ? {} : {
283
+ create: (s) => B.extname(s.getFilename()) !== ".astro" ? {} : {
284
284
  JSXElement: (l) => {
285
- let { attributes: s } = l.openingElement;
286
- if (s.length > 1) {
287
- let o = j(a.options.at(0), {
285
+ let { attributes: n } = l.openingElement;
286
+ if (n.length > 1) {
287
+ let a = k(s.options.at(0), {
288
288
  type: i.alphabetical,
289
289
  order: f.asc,
290
290
  "ignore-case": !1,
291
291
  "custom-groups": {},
292
292
  groups: []
293
- }), u = a.getSourceCode(), r = s.reduce(
294
- (e, t) => {
295
- if (t.type === "JSXSpreadAttribute")
293
+ }), u = s.getSourceCode(), t = n.reduce(
294
+ (e, o) => {
295
+ if (o.type === "JSXSpreadAttribute")
296
296
  return e.push([]), e;
297
- let n = typeof t.name.name == "string" ? t.name.name : u.text.slice(...t.name.range), { getGroup: c, defineGroup: d, setCustomGroups: m } = R(
298
- o.groups
297
+ let r = typeof o.name.name == "string" ? o.name.name : u.text.slice(...o.name.range), { getGroup: c, defineGroup: d, setCustomGroups: y } = M(
298
+ a.groups
299
299
  );
300
- return m(o["custom-groups"], n), t.type === "AstroShorthandAttribute" && (d("astro-shorthand"), d("shorthand")), t.value === null && d("shorthand"), t.loc.start.line !== t.loc.end.line && d("multiline"), e.at(-1).push({
301
- size: w(t.range),
302
- node: t,
300
+ 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({
301
+ size: v(o.range),
302
+ node: o,
303
303
  group: c(),
304
- name: n
304
+ name: r
305
305
  }), e;
306
306
  },
307
307
  [[]]
308
308
  );
309
- for (let e of r)
310
- k(e, (t, n) => {
311
- let c = x(o.groups, t), d = x(o.groups, n);
312
- (c > d || c === d && v(A(t, n, o))) && a.report({
309
+ for (let e of t)
310
+ C(e, (o, r) => {
311
+ let c = x(a.groups, o), d = x(a.groups, r);
312
+ (c > d || c === d && j(w(o, r, a))) && s.report({
313
313
  messageId: "unexpectedAstroAttributesOrder",
314
314
  data: {
315
- left: t.name,
316
- right: n.name
315
+ left: o.name,
316
+ right: r.name
317
317
  },
318
- node: n.node,
319
- fix: (m) => {
320
- let g = {};
321
- for (let y of e) {
322
- let h = x(o.groups, y);
323
- h in g ? g[h] = S(
324
- [...g[h], y],
325
- o
326
- ) : g[h] = [y];
318
+ node: r.node,
319
+ fix: (y) => {
320
+ let m = {};
321
+ for (let p of e) {
322
+ let h = x(a.groups, p);
323
+ h in m ? m[h] = A(
324
+ [...m[h], p],
325
+ a
326
+ ) : m[h] = [p];
327
327
  }
328
- let p = [];
329
- for (let y of Object.keys(g).sort())
330
- p.push(...S(g[y], o));
331
- return C(m, e, p, u);
328
+ let g = [];
329
+ for (let p of Object.keys(m).sort())
330
+ g.push(...A(m[p], a));
331
+ return P(y, e, g, u);
332
332
  }
333
333
  });
334
334
  });
@@ -336,7 +336,7 @@ const V = "sort-svelte-attributes", ue = O({
336
336
  }
337
337
  }
338
338
  });
339
- let I = (a) => a.replaceAll(/\s\s+/g, " ").trim();
339
+ let I = (s) => s.replaceAll(/\s\s+/g, " ").trim();
340
340
  const J = "sort-array-includes", de = O({
341
341
  name: J,
342
342
  meta: {
@@ -385,40 +385,40 @@ const J = "sort-array-includes", de = O({
385
385
  order: f.asc
386
386
  }
387
387
  ],
388
- create: (a) => ({
388
+ create: (s) => ({
389
389
  MemberExpression: (l) => {
390
390
  if ((l.object.type === "ArrayExpression" || l.object.type === "NewExpression") && l.property.type === "Identifier" && l.property.name === "includes") {
391
- let s = l.object.type === "ArrayExpression" ? l.object.elements : l.object.arguments;
392
- if (s.length > 1) {
393
- let o = j(a.options.at(0), {
391
+ let n = l.object.type === "ArrayExpression" ? l.object.elements : l.object.arguments;
392
+ if (n.length > 1) {
393
+ let a = k(s.options.at(0), {
394
394
  type: i.alphabetical,
395
395
  order: f.asc,
396
396
  "ignore-case": !1,
397
397
  "spread-last": !1
398
- }), u = a.getSourceCode(), r = s.reduce(
399
- (e, t) => (t !== null && e.at(0).push({
400
- name: t.type === "Literal" ? `${t.value}` : u.text.slice(...t.range),
401
- size: w(t.range),
402
- type: t.type,
403
- node: t
398
+ }), u = s.getSourceCode(), t = n.reduce(
399
+ (e, o) => (o !== null && e.at(0).push({
400
+ name: o.type === "Literal" ? `${o.value}` : u.text.slice(...o.range),
401
+ size: v(o.range),
402
+ type: o.type,
403
+ node: o
404
404
  }), e),
405
405
  [[], []]
406
406
  ).flat();
407
- k(r, (e, t) => {
408
- let n;
409
- o["spread-last"] && e.node.type === "Literal" && t.node.type === "SpreadElement" ? n = !1 : o["spread-last"] && e.node.type === "SpreadElement" && t.node.type === "Literal" ? n = !0 : n = v(A(e, t, o)), n && a.report({
407
+ C(t, (e, o) => {
408
+ let r;
409
+ 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(w(e, o, a)), r && s.report({
410
410
  messageId: "unexpectedArrayIncludesOrder",
411
411
  data: {
412
412
  left: I(e.name),
413
- right: I(t.name)
413
+ right: I(o.name)
414
414
  },
415
- node: t.node,
415
+ node: o.node,
416
416
  fix: (c) => {
417
- let d = S(r, o);
418
- if (o["spread-last"])
419
- for (let m = 0, g = d.length; m < g; m++)
420
- d.at(m).node.type === "SpreadElement" && d.push(d.splice(m, 1).at(0));
421
- return C(c, r, d, u);
417
+ let d = A(t, a);
418
+ if (a["spread-last"])
419
+ for (let y = 0, m = d.length; y < m; y++)
420
+ d.at(y).node.type === "SpreadElement" && d.push(d.splice(y, 1).at(0));
421
+ return P(c, t, d, u);
422
422
  }
423
423
  });
424
424
  });
@@ -477,60 +477,60 @@ const J = "sort-array-includes", de = O({
477
477
  order: f.asc
478
478
  }
479
479
  ],
480
- create: (a) => {
481
- if (U.extname(a.getFilename()) !== ".vue")
480
+ create: (s) => {
481
+ if (B.extname(s.getFilename()) !== ".vue")
482
482
  return {};
483
- if (!("defineTemplateBodyVisitor" in a.parserServices))
483
+ if (!("defineTemplateBodyVisitor" in s.parserServices))
484
484
  return {};
485
- let { defineTemplateBodyVisitor: l } = a.parserServices;
485
+ let { defineTemplateBodyVisitor: l } = s.parserServices;
486
486
  return l({
487
- VStartTag: (s) => {
488
- if (s.attributes.length > 1) {
489
- let o = j(a.options.at(0), {
487
+ VStartTag: (n) => {
488
+ if (n.attributes.length > 1) {
489
+ let a = k(s.options.at(0), {
490
490
  type: i.alphabetical,
491
491
  order: f.asc,
492
492
  "ignore-case": !1,
493
493
  "custom-groups": {},
494
494
  groups: []
495
- }), u = a.getSourceCode(), r = s.attributes.reduce(
496
- (e, t) => {
497
- if (t.key.type === "VDirectiveKey" && t.key.name.rawName === "bind")
495
+ }), u = s.getSourceCode(), t = n.attributes.reduce(
496
+ (e, o) => {
497
+ if (o.key.type === "VDirectiveKey" && o.key.name.rawName === "bind")
498
498
  return e.push([]), e;
499
- let n, { getGroup: c, defineGroup: d, setCustomGroups: m } = R(
500
- o.groups
499
+ let r, { getGroup: c, defineGroup: d, setCustomGroups: y } = M(
500
+ a.groups
501
501
  );
502
- return typeof t.key.name == "string" && t.key.type !== "VDirectiveKey" ? n = t.key.rawName : n = u.text.slice(...t.key.range), m(o["custom-groups"], n), t.value === null && d("shorthand"), t.loc.start.line !== t.loc.end.line && d("multiline"), e.at(-1).push({
503
- size: w(t.range),
504
- node: t,
502
+ 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({
503
+ size: v(o.range),
504
+ node: o,
505
505
  group: c(),
506
- name: n
506
+ name: r
507
507
  }), e;
508
508
  },
509
509
  [[]]
510
510
  );
511
- for (let e of r)
512
- k(e, (t, n) => {
513
- let c = x(o.groups, t), d = x(o.groups, n);
514
- (c > d || c === d && v(A(t, n, o))) && a.report({
511
+ for (let e of t)
512
+ C(e, (o, r) => {
513
+ let c = x(a.groups, o), d = x(a.groups, r);
514
+ (c > d || c === d && j(w(o, r, a))) && s.report({
515
515
  messageId: "unexpectedVueAttributesOrder",
516
516
  data: {
517
- left: t.name,
518
- right: n.name
517
+ left: o.name,
518
+ right: r.name
519
519
  },
520
- node: n.node,
521
- fix: (m) => {
522
- let g = {};
523
- for (let y of e) {
524
- let h = x(o.groups, y);
525
- h in g ? g[h] = S(
526
- [...g[h], y],
527
- o
528
- ) : g[h] = [y];
520
+ node: r.node,
521
+ fix: (y) => {
522
+ let m = {};
523
+ for (let p of e) {
524
+ let h = x(a.groups, p);
525
+ h in m ? m[h] = A(
526
+ [...m[h], p],
527
+ a
528
+ ) : m[h] = [p];
529
529
  }
530
- let p = [];
531
- for (let y of Object.keys(g).sort())
532
- p.push(...S(g[y], o));
533
- return C(m, e, p, u);
530
+ let g = [];
531
+ for (let p of Object.keys(m).sort())
532
+ g.push(...A(m[p], a));
533
+ return P(y, e, g, u);
534
534
  }
535
535
  });
536
536
  });
@@ -582,27 +582,27 @@ const J = "sort-array-includes", de = O({
582
582
  order: f.asc
583
583
  }
584
584
  ],
585
- create: (a) => ({
585
+ create: (s) => ({
586
586
  ExportNamedDeclaration: (l) => {
587
587
  if (l.specifiers.length > 1) {
588
- let s = j(a.options.at(0), {
588
+ let n = k(s.options.at(0), {
589
589
  type: i.alphabetical,
590
590
  "ignore-case": !1,
591
591
  order: f.asc
592
- }), o = a.getSourceCode(), u = l.specifiers.map((r) => ({
593
- size: w(r.range),
594
- name: r.local.name,
595
- node: r
592
+ }), a = s.getSourceCode(), u = l.specifiers.map((t) => ({
593
+ size: v(t.range),
594
+ name: t.local.name,
595
+ node: t
596
596
  }));
597
- k(u, (r, e) => {
598
- v(A(r, e, s)) && a.report({
597
+ C(u, (t, e) => {
598
+ j(w(t, e, n)) && s.report({
599
599
  messageId: "unexpectedNamedExportsOrder",
600
600
  data: {
601
- left: r.name,
601
+ left: t.name,
602
602
  right: e.name
603
603
  },
604
604
  node: e.node,
605
- fix: (t) => C(t, u, S(u, s), o)
605
+ fix: (o) => P(o, u, A(u, n), a)
606
606
  });
607
607
  });
608
608
  }
@@ -637,6 +637,10 @@ const J = "sort-array-includes", de = O({
637
637
  "ignore-case": {
638
638
  type: "boolean",
639
639
  default: !1
640
+ },
641
+ "ignore-alias": {
642
+ type: "boolean",
643
+ default: !1
640
644
  }
641
645
  },
642
646
  additionalProperties: !1
@@ -652,30 +656,34 @@ const J = "sort-array-includes", de = O({
652
656
  order: f.asc
653
657
  }
654
658
  ],
655
- create: (a) => ({
659
+ create: (s) => ({
656
660
  ImportDeclaration: (l) => {
657
- let s = l.specifiers.filter(
658
- ({ type: o }) => o === "ImportSpecifier"
661
+ let n = l.specifiers.filter(
662
+ ({ type: a }) => a === "ImportSpecifier"
659
663
  );
660
- if (s.length > 1) {
661
- let o = j(a.options.at(0), {
664
+ if (n.length > 1) {
665
+ let a = k(s.options.at(0), {
662
666
  type: i.alphabetical,
667
+ "ignore-alias": !0,
663
668
  "ignore-case": !1,
664
669
  order: f.asc
665
- }), u = a.getSourceCode(), r = s.map((e) => ({
666
- size: w(e.range),
667
- name: e.local.name,
668
- node: e
669
- }));
670
- k(r, (e, t) => {
671
- v(A(e, t, o)) && a.report({
670
+ }), u = s.getSourceCode(), t = n.map((e) => {
671
+ let { name: o } = e.local;
672
+ return a["ignore-alias"] && e.type === "ImportSpecifier" && ({ name: o } = e.imported), {
673
+ size: v(e.range),
674
+ node: e,
675
+ name: o
676
+ };
677
+ });
678
+ C(t, (e, o) => {
679
+ j(w(e, o, a)) && s.report({
672
680
  messageId: "unexpectedNamedImportsOrder",
673
681
  data: {
674
682
  left: e.name,
675
- right: t.name
683
+ right: o.name
676
684
  },
677
- node: t.node,
678
- fix: (n) => C(n, r, S(r, o), u)
685
+ node: o.node,
686
+ fix: (r) => P(r, t, A(t, a), u)
679
687
  });
680
688
  });
681
689
  }
@@ -732,63 +740,63 @@ const J = "sort-array-includes", de = O({
732
740
  order: f.asc
733
741
  }
734
742
  ],
735
- create: (a) => ({
743
+ create: (s) => ({
736
744
  TSTypeLiteral: (l) => {
737
745
  if (l.members.length > 1) {
738
- let s = j(a.options.at(0), {
746
+ let n = k(s.options.at(0), {
739
747
  type: i.alphabetical,
740
748
  "ignore-case": !1,
741
749
  order: f.asc,
742
750
  "custom-groups": {},
743
751
  groups: []
744
- }), o = a.getSourceCode(), u = l.members.map((r) => {
745
- var y, h;
746
- let e, t = o.text.slice(r.range.at(0), r.range.at(1)), { getGroup: n, defineGroup: c, setCustomGroups: d } = R(
747
- s.groups
748
- ), m = (N) => N.replace(/(,|;)$/, "");
749
- if (r.type === "TSPropertySignature")
750
- r.key.type === "Identifier" ? { name: e } = r.key : r.key.type === "Literal" ? e = `${r.key.value}` : e = o.text.slice(
751
- r.range.at(0),
752
- (y = r.typeAnnotation) == null ? void 0 : y.range.at(0)
752
+ }), a = s.getSourceCode(), u = l.members.map((t) => {
753
+ var p, h;
754
+ let e, o = a.text.slice(t.range.at(0), t.range.at(1)), { getGroup: r, defineGroup: c, setCustomGroups: d } = M(
755
+ n.groups
756
+ ), y = (S) => S.replace(/(,|;)$/, "");
757
+ if (t.type === "TSPropertySignature")
758
+ t.key.type === "Identifier" ? { name: e } = t.key : t.key.type === "Literal" ? e = `${t.key.value}` : e = a.text.slice(
759
+ t.range.at(0),
760
+ (p = t.typeAnnotation) == null ? void 0 : p.range.at(0)
753
761
  );
754
- else if (r.type === "TSIndexSignature") {
755
- let N = ((h = r.typeAnnotation) == null ? void 0 : h.range.at(0)) ?? r.range.at(1);
756
- e = m(o.text.slice(r.range.at(0), N));
762
+ else if (t.type === "TSIndexSignature") {
763
+ let S = ((h = t.typeAnnotation) == null ? void 0 : h.range.at(0)) ?? t.range.at(1);
764
+ e = y(a.text.slice(t.range.at(0), S));
757
765
  } else
758
- e = m(
759
- o.text.slice(r.range.at(0), r.range.at(1))
766
+ e = y(
767
+ a.text.slice(t.range.at(0), t.range.at(1))
760
768
  );
761
- d(s["custom-groups"], e), r.loc.start.line !== r.loc.end.line && c("multiline");
762
- let p = t.endsWith(";") || t.endsWith(",") ? 1 : 0;
769
+ d(n["custom-groups"], e), t.loc.start.line !== t.loc.end.line && c("multiline");
770
+ let g = o.endsWith(";") || o.endsWith(",") ? 1 : 0;
763
771
  return {
764
- size: w(r.range) - p,
765
- group: n(),
766
- node: r,
772
+ size: v(t.range) - g,
773
+ group: r(),
774
+ node: t,
767
775
  name: e
768
776
  };
769
777
  });
770
- k(u, (r, e) => {
771
- let t = x(s.groups, r), n = x(s.groups, e);
772
- (t > n || t === n && v(A(r, e, s))) && a.report({
778
+ C(u, (t, e) => {
779
+ let o = x(n.groups, t), r = x(n.groups, e);
780
+ (o > r || o === r && j(w(t, e, n))) && s.report({
773
781
  messageId: "unexpectedObjectTypesOrder",
774
782
  data: {
775
- left: I(r.name),
783
+ left: I(t.name),
776
784
  right: I(e.name)
777
785
  },
778
786
  node: e.node,
779
787
  fix: (c) => {
780
788
  let d = {};
781
- for (let g of u) {
782
- let p = x(s.groups, g);
783
- p in d ? d[p] = S(
784
- [...d[p], g],
785
- s
786
- ) : d[p] = [g];
789
+ for (let m of u) {
790
+ let g = x(n.groups, m);
791
+ g in d ? d[g] = A(
792
+ [...d[g], m],
793
+ n
794
+ ) : d[g] = [m];
787
795
  }
788
- let m = [];
789
- for (let g of Object.keys(d).sort())
790
- m.push(...S(d[g], s));
791
- return C(c, u, m, o);
796
+ let y = [];
797
+ for (let m of Object.keys(d).sort())
798
+ y.push(...A(d[m], n));
799
+ return P(c, u, y, a);
792
800
  }
793
801
  });
794
802
  });
@@ -843,39 +851,39 @@ const J = "sort-array-includes", de = O({
843
851
  order: f.asc
844
852
  }
845
853
  ],
846
- create: (a) => ({
854
+ create: (s) => ({
847
855
  TSUnionType: (l) => {
848
- let s = a.getSourceCode(), o = j(a.options.at(0), {
856
+ let n = s.getSourceCode(), a = k(s.options.at(0), {
849
857
  type: i.alphabetical,
850
858
  "nullable-last": !1,
851
859
  "ignore-case": !1,
852
860
  order: f.asc
853
- }), u = l.types.map((r) => ({
854
- group: r.type === "TSNullKeyword" || r.type === "TSUndefinedKeyword" ? "nullable" : "unknown",
855
- name: s.text.slice(...r.range),
856
- size: w(r.range),
857
- node: r
861
+ }), u = l.types.map((t) => ({
862
+ group: t.type === "TSNullKeyword" || t.type === "TSUndefinedKeyword" ? "nullable" : "unknown",
863
+ name: n.text.slice(...t.range),
864
+ size: v(t.range),
865
+ node: t
858
866
  }));
859
- k(u, (r, e) => {
860
- let t = v(A(r, e, o));
861
- o["nullable-last"] && (r.group === "nullable" && e.group === "unknown" ? t = !0 : r.group === "unknown" && e.group === "nullable" && (t = !1)), t && a.report({
867
+ C(u, (t, e) => {
868
+ let o = j(w(t, e, a));
869
+ a["nullable-last"] && (t.group === "nullable" && e.group === "unknown" ? o = !0 : t.group === "unknown" && e.group === "nullable" && (o = !1)), o && s.report({
862
870
  messageId: "unexpectedUnionTypesOrder",
863
871
  data: {
864
- left: I(r.name),
872
+ left: I(t.name),
865
873
  right: I(e.name)
866
874
  },
867
875
  node: e.node,
868
- fix: (n) => {
876
+ fix: (r) => {
869
877
  let c = [];
870
- if (o["nullable-last"]) {
871
- let d = [], m = u.filter((g) => g.group === "nullable" ? (d.push(g), !1) : !0);
878
+ if (a["nullable-last"]) {
879
+ let d = [], y = u.filter((m) => m.group === "nullable" ? (d.push(m), !1) : !0);
872
880
  c = [
873
- ...S(m, o),
874
- ...S(d, o)
881
+ ...A(y, a),
882
+ ...A(d, a)
875
883
  ];
876
884
  } else
877
- c = S(u, o);
878
- return C(n, u, c, s);
885
+ c = A(u, a);
886
+ return P(r, u, c, n);
879
887
  }
880
888
  });
881
889
  });
@@ -938,10 +946,10 @@ const J = "sort-array-includes", de = O({
938
946
  order: f.asc
939
947
  }
940
948
  ],
941
- create: (a) => ({
949
+ create: (s) => ({
942
950
  TSInterfaceDeclaration: (l) => {
943
951
  if (l.body.body.length > 1) {
944
- let s = j(a.options.at(0), {
952
+ let n = k(s.options.at(0), {
945
953
  type: i.alphabetical,
946
954
  "ignore-case": !1,
947
955
  order: f.asc,
@@ -949,67 +957,67 @@ const J = "sort-array-includes", de = O({
949
957
  "custom-groups": {},
950
958
  groups: []
951
959
  });
952
- if (!s["ignore-pattern"].some(
953
- (o) => M(l.id.name, o, {
960
+ if (!n["ignore-pattern"].some(
961
+ (a) => $(l.id.name, a, {
954
962
  nocomment: !0
955
963
  })
956
964
  )) {
957
- let o = a.getSourceCode(), u = l.body.body.reduce(
958
- (r, e) => {
959
- var m, g, p;
965
+ let a = s.getSourceCode(), u = l.body.body.reduce(
966
+ (t, e) => {
967
+ var y, m, g;
960
968
  if (e.type === "TSCallSignatureDeclaration")
961
- return r.push([]), r;
962
- let t, { getGroup: n, defineGroup: c, setCustomGroups: d } = R(
963
- s.groups
969
+ return t.push([]), t;
970
+ let o, { getGroup: r, defineGroup: c, setCustomGroups: d } = M(
971
+ n.groups
964
972
  );
965
973
  if (e.type === "TSPropertySignature")
966
974
  if (e.key.type === "Identifier")
967
- ({ name: t } = e.key);
975
+ ({ name: o } = e.key);
968
976
  else if (e.key.type === "Literal")
969
- t = `${e.key.value}`;
977
+ o = `${e.key.value}`;
970
978
  else {
971
- let y = ((m = e.typeAnnotation) == null ? void 0 : m.range.at(0)) ?? e.range.at(1) - (e.optional ? 1 : 0);
972
- t = o.text.slice(e.range.at(0), y);
979
+ let p = ((y = e.typeAnnotation) == null ? void 0 : y.range.at(0)) ?? e.range.at(1) - (e.optional ? 1 : 0);
980
+ o = a.text.slice(e.range.at(0), p);
973
981
  }
974
982
  else if (e.type === "TSIndexSignature") {
975
- let y = ((g = e.typeAnnotation) == null ? void 0 : g.range.at(0)) ?? e.range.at(1);
976
- t = o.text.slice(e.range.at(0), y);
983
+ let p = ((m = e.typeAnnotation) == null ? void 0 : m.range.at(0)) ?? e.range.at(1);
984
+ o = a.text.slice(e.range.at(0), p);
977
985
  } else {
978
- let y = ((p = e.returnType) == null ? void 0 : p.range.at(0)) ?? e.range.at(1);
979
- t = o.text.slice(e.range.at(0), y);
986
+ let p = ((g = e.returnType) == null ? void 0 : g.range.at(0)) ?? e.range.at(1);
987
+ o = a.text.slice(e.range.at(0), p);
980
988
  }
981
- return d(s["custom-groups"], t), e.loc.start.line !== e.loc.end.line && c("multiline"), r.at(-1).push({
982
- size: w(e.range),
983
- group: n(),
989
+ return d(n["custom-groups"], o), e.loc.start.line !== e.loc.end.line && c("multiline"), t.at(-1).push({
990
+ size: v(e.range),
991
+ group: r(),
984
992
  node: e,
985
- name: t
986
- }), r;
993
+ name: o
994
+ }), t;
987
995
  },
988
996
  [[]]
989
997
  );
990
- for (let r of u)
991
- k(r, (e, t) => {
992
- let n = x(s.groups, e), c = x(s.groups, t);
993
- (n > c || n === c && v(A(e, t, s))) && a.report({
998
+ for (let t of u)
999
+ C(t, (e, o) => {
1000
+ let r = x(n.groups, e), c = x(n.groups, o);
1001
+ (r > c || r === c && j(w(e, o, n))) && s.report({
994
1002
  messageId: "unexpectedInterfacePropertiesOrder",
995
1003
  data: {
996
1004
  left: I(e.name),
997
- right: I(t.name)
1005
+ right: I(o.name)
998
1006
  },
999
- node: t.node,
1007
+ node: o.node,
1000
1008
  fix: (d) => {
1001
- let m = {};
1002
- for (let p of r) {
1003
- let y = x(s.groups, p);
1004
- y in m ? m[y] = S(
1005
- [...m[y], p],
1006
- s
1007
- ) : m[y] = [p];
1009
+ let y = {};
1010
+ for (let g of t) {
1011
+ let p = x(n.groups, g);
1012
+ p in y ? y[p] = A(
1013
+ [...y[p], g],
1014
+ n
1015
+ ) : y[p] = [g];
1008
1016
  }
1009
- let g = [];
1010
- for (let p of Object.keys(m).sort())
1011
- g.push(...S(m[p], s));
1012
- return C(d, r, g, o);
1017
+ let m = [];
1018
+ for (let g of Object.keys(y).sort())
1019
+ m.push(...A(y[g], n));
1020
+ return P(d, t, m, a);
1013
1021
  }
1014
1022
  });
1015
1023
  });
@@ -1067,58 +1075,58 @@ const J = "sort-array-includes", de = O({
1067
1075
  order: f.asc
1068
1076
  }
1069
1077
  ],
1070
- create: (a) => [".svelte", ".astro", ".vue"].includes(
1071
- U.extname(a.getFilename())
1078
+ create: (s) => [".svelte", ".astro", ".vue"].includes(
1079
+ B.extname(s.getFilename())
1072
1080
  ) ? {} : {
1073
1081
  JSXElement: (l) => {
1074
1082
  if (l.openingElement.attributes.length > 1) {
1075
- let s = j(a.options.at(0), {
1083
+ let n = k(s.options.at(0), {
1076
1084
  type: i.alphabetical,
1077
1085
  "ignore-case": !1,
1078
1086
  order: f.asc,
1079
1087
  "custom-groups": {},
1080
1088
  groups: []
1081
- }), o = a.getSourceCode(), u = l.openingElement.attributes.reduce(
1082
- (r, e) => {
1089
+ }), a = s.getSourceCode(), u = l.openingElement.attributes.reduce(
1090
+ (t, e) => {
1083
1091
  if (e.type === "JSXSpreadAttribute")
1084
- return r.push([]), r;
1085
- let t = e.name.type === "JSXNamespacedName" ? `${e.name.namespace.name}:${e.name.name.name}` : e.name.name, { getGroup: n, defineGroup: c, setCustomGroups: d } = R(
1086
- s.groups
1092
+ return t.push([]), t;
1093
+ let o = e.name.type === "JSXNamespacedName" ? `${e.name.namespace.name}:${e.name.name.name}` : e.name.name, { getGroup: r, defineGroup: c, setCustomGroups: d } = M(
1094
+ n.groups
1087
1095
  );
1088
- d(s["custom-groups"], t), e.value === null && c("shorthand"), e.loc.start.line !== e.loc.end.line && c("multiline");
1089
- let m = {
1090
- size: w(e.range),
1091
- group: n(),
1096
+ d(n["custom-groups"], o), e.value === null && c("shorthand"), e.loc.start.line !== e.loc.end.line && c("multiline");
1097
+ let y = {
1098
+ size: v(e.range),
1099
+ group: r(),
1092
1100
  node: e,
1093
- name: t
1101
+ name: o
1094
1102
  };
1095
- return r.at(-1).push(m), r;
1103
+ return t.at(-1).push(y), t;
1096
1104
  },
1097
1105
  [[]]
1098
1106
  );
1099
- for (let r of u)
1100
- k(r, (e, t) => {
1101
- let n = x(s.groups, e), c = x(s.groups, t);
1102
- (n > c || n === c && v(A(e, t, s))) && a.report({
1107
+ for (let t of u)
1108
+ C(t, (e, o) => {
1109
+ let r = x(n.groups, e), c = x(n.groups, o);
1110
+ (r > c || r === c && j(w(e, o, n))) && s.report({
1103
1111
  messageId: "unexpectedJSXPropsOrder",
1104
1112
  data: {
1105
1113
  left: e.name,
1106
- right: t.name
1114
+ right: o.name
1107
1115
  },
1108
- node: t.node,
1116
+ node: o.node,
1109
1117
  fix: (d) => {
1110
- let m = {};
1111
- for (let p of r) {
1112
- let y = x(s.groups, p);
1113
- y in m ? m[y] = S(
1114
- [...m[y], p],
1115
- s
1116
- ) : m[y] = [p];
1118
+ let y = {};
1119
+ for (let g of t) {
1120
+ let p = x(n.groups, g);
1121
+ p in y ? y[p] = A(
1122
+ [...y[p], g],
1123
+ n
1124
+ ) : y[p] = [g];
1117
1125
  }
1118
- let g = [];
1119
- for (let p of Object.keys(m).sort())
1120
- g.push(...S(m[p], s));
1121
- return C(d, r, g, o);
1126
+ let m = [];
1127
+ for (let g of Object.keys(y).sort())
1128
+ m.push(...A(y[g], n));
1129
+ return P(d, t, m, a);
1122
1130
  }
1123
1131
  });
1124
1132
  });
@@ -1169,35 +1177,35 @@ const J = "sort-array-includes", de = O({
1169
1177
  order: f.asc
1170
1178
  }
1171
1179
  ],
1172
- create: (a) => {
1173
- let l = j(a.options.at(0), {
1180
+ create: (s) => {
1181
+ let l = k(s.options.at(0), {
1174
1182
  type: i.alphabetical,
1175
1183
  order: f.asc,
1176
1184
  "ignore-case": !1
1177
- }), s = [[]], o = (u) => {
1178
- u.type === "ExportAllDeclaration" && u.exported === null ? s.push([]) : s.at(-1).push({
1179
- size: w(u.range),
1185
+ }), n = [[]], a = (u) => {
1186
+ u.type === "ExportAllDeclaration" && u.exported === null ? n.push([]) : n.at(-1).push({
1187
+ size: v(u.range),
1180
1188
  name: u.source.value,
1181
1189
  node: u
1182
1190
  });
1183
1191
  };
1184
1192
  return {
1185
- ExportAllDeclaration: o,
1193
+ ExportAllDeclaration: a,
1186
1194
  ExportNamedDeclaration: (u) => {
1187
- u.source !== null && o(u);
1195
+ u.source !== null && a(u);
1188
1196
  },
1189
1197
  "Program:exit": () => {
1190
- let u = a.getSourceCode();
1191
- for (let r of s)
1192
- k(r, (e, t) => {
1193
- v(A(e, t, l)) && a.report({
1198
+ let u = s.getSourceCode();
1199
+ for (let t of n)
1200
+ C(t, (e, o) => {
1201
+ j(w(e, o, l)) && s.report({
1194
1202
  messageId: "unexpectedExportsOrder",
1195
1203
  data: {
1196
1204
  left: e.name,
1197
- right: t.name
1205
+ right: o.name
1198
1206
  },
1199
- node: t.node,
1200
- fix: (n) => C(n, r, S(r, l), u)
1207
+ node: o.node,
1208
+ fix: (r) => P(r, t, A(t, l), u)
1201
1209
  });
1202
1210
  });
1203
1211
  }
@@ -1281,8 +1289,8 @@ const J = "sort-array-includes", de = O({
1281
1289
  order: f.asc
1282
1290
  }
1283
1291
  ],
1284
- create: (a) => {
1285
- let l = j(a.options.at(0), {
1292
+ create: (s) => {
1293
+ let l = k(s.options.at(0), {
1286
1294
  "newlines-between": "always",
1287
1295
  "custom-groups": { type: {}, value: {} },
1288
1296
  "internal-pattern": ["~/**"],
@@ -1290,10 +1298,18 @@ const J = "sort-array-includes", de = O({
1290
1298
  order: f.asc,
1291
1299
  "ignore-case": !1,
1292
1300
  groups: []
1293
- }), s = a.getSourceCode(), o = [], u = (t) => t.type === "ImportDeclaration" && t.specifiers.length === 0, r = (t) => {
1294
- let n = (b) => [".less", ".scss", ".sass", ".styl", ".pcss", ".css", ".sss"].some(
1295
- (E) => b.endsWith(E)
1296
- ), c = (b) => [
1301
+ }), n = !1;
1302
+ for (let r of l.groups)
1303
+ if (Array.isArray(r))
1304
+ for (let c of r)
1305
+ c === "unknown" && (n = !0);
1306
+ else
1307
+ r === "unknown" && (n = !0);
1308
+ n || (l.groups = [...l.groups, "unknown"]);
1309
+ let a = s.getSourceCode(), u = [], t = (r) => r.type === "ImportDeclaration" && r.specifiers.length === 0, e = (r) => {
1310
+ let c = (b) => [".less", ".scss", ".sass", ".styl", ".pcss", ".css", ".sss"].some(
1311
+ (T) => b.endsWith(T)
1312
+ ), d = (b) => [
1297
1313
  "./index.d.js",
1298
1314
  "./index.d.ts",
1299
1315
  "./index.js",
@@ -1301,12 +1317,12 @@ const J = "sort-array-includes", de = O({
1301
1317
  "./index",
1302
1318
  "./",
1303
1319
  "."
1304
- ].includes(b), d = (b) => b.indexOf("..") === 0, m = (b) => b.indexOf("./") === 0, { getGroup: g, defineGroup: p, setCustomGroups: y } = R(l.groups), h = (b) => l["internal-pattern"].length && l["internal-pattern"].some(
1305
- (E) => M(b.source.value, E, {
1320
+ ].includes(b), y = (b) => b.indexOf("..") === 0, m = (b) => b.indexOf("./") === 0, { getGroup: g, defineGroup: p, setCustomGroups: h } = M(l.groups), S = (b) => l["internal-pattern"].length && l["internal-pattern"].some(
1321
+ (T) => $(b.source.value, T, {
1306
1322
  nocomment: !0
1307
1323
  })
1308
1324
  ), N = (b) => {
1309
- let E = [
1325
+ let T = [
1310
1326
  "bun",
1311
1327
  "bun:ffi",
1312
1328
  "bun:jsc",
@@ -1319,81 +1335,81 @@ const J = "sort-array-includes", de = O({
1319
1335
  ];
1320
1336
  return ie.includes(
1321
1337
  b.startsWith("node:") ? b.split("node:")[1] : b
1322
- ) || E.includes(b);
1323
- };
1324
- return t.importKind === "type" && (t.type === "ImportDeclaration" && (y(l["custom-groups"].type, t.source.value), N(t.source.value) && p("builtin-type"), h(t) && p("internal-type"), c(t.source.value) && p("index-type"), d(t.source.value) && p("parent-type"), m(t.source.value) && p("sibling-type")), p("external-type"), p("type")), t.type === "ImportDeclaration" && (y(l["custom-groups"].value, t.source.value), N(t.source.value) && p("builtin"), h(t) && p("internal"), n(t.source.value) && p("style"), u(t) && p("side-effect"), c(t.source.value) && p("index"), d(t.source.value) && p("parent"), m(t.source.value) && p("sibling"), p("external")), g();
1325
- }, e = (t) => {
1326
- let n;
1327
- t.type === "ImportDeclaration" ? n = t.source.value : t.moduleReference.type === "TSExternalModuleReference" && t.moduleReference.expression.type === "Literal" ? n = `${t.moduleReference.expression.value}` : n = s.text.slice(...t.moduleReference.range), o.push({
1328
- size: w(t.range),
1329
- group: r(t),
1330
- name: n,
1331
- node: t
1338
+ ) || T.includes(b);
1339
+ }, E = (b) => !(b.startsWith(".") || b.startsWith("/"));
1340
+ return r.importKind === "type" && (r.type === "ImportDeclaration" && (h(l["custom-groups"].type, r.source.value), d(r.source.value) && p("index-type"), m(r.source.value) && p("sibling-type"), y(r.source.value) && p("parent-type"), S(r) && p("internal-type"), N(r.source.value) && p("builtin-type"), E(r.source.value) && p("external-type")), p("type")), r.type === "ImportDeclaration" && (h(l["custom-groups"].value, r.source.value), t(r) && p("side-effect"), c(r.source.value) && p("style"), d(r.source.value) && p("index"), m(r.source.value) && p("sibling"), y(r.source.value) && p("parent"), S(r) && p("internal"), N(r.source.value) && p("builtin"), E(r.source.value) && p("external")), g();
1341
+ }, o = (r) => {
1342
+ let c;
1343
+ 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({
1344
+ size: v(r.range),
1345
+ group: e(r),
1346
+ name: c,
1347
+ node: r
1332
1348
  });
1333
1349
  };
1334
1350
  return {
1335
- TSImportEqualsDeclaration: e,
1336
- ImportDeclaration: e,
1351
+ TSImportEqualsDeclaration: o,
1352
+ ImportDeclaration: o,
1337
1353
  "Program:exit": () => {
1338
1354
  var m;
1339
- let t = (g, p) => !!s.getTokensBetween(
1355
+ let r = (g, p) => !!a.getTokensBetween(
1340
1356
  g.node,
1341
- _(p.node, s) || p.node,
1357
+ _(p.node, a) || p.node,
1342
1358
  {
1343
1359
  includeComments: !0
1344
1360
  }
1345
- ).length, n = (g, p) => s.lines.slice(
1361
+ ).length, c = (g, p) => a.lines.slice(
1346
1362
  g.node.loc.end.line,
1347
1363
  p.node.loc.start.line - 1
1348
- ).filter((h) => !h.trim().length).length, c = (g, p) => {
1349
- let y = [], h = {};
1350
- for (let b of p) {
1351
- let E = x(l.groups, b);
1352
- E in h ? h[E] = S(
1353
- [...h[E], b],
1364
+ ).filter((S) => !S.trim().length).length, d = (g, p) => {
1365
+ let h = [], S = {};
1366
+ for (let E of p) {
1367
+ let b = x(l.groups, E);
1368
+ b in S ? S[b] = A(
1369
+ [...S[b], E],
1354
1370
  l
1355
- ) : h[E] = [b];
1371
+ ) : S[b] = [E];
1356
1372
  }
1357
- let N = Object.keys(h).sort().reduce(
1358
- (b, E) => [
1359
- ...b,
1360
- ...h[E]
1373
+ let N = Object.keys(S).sort().reduce(
1374
+ (E, b) => [
1375
+ ...E,
1376
+ ...S[b]
1361
1377
  ],
1362
1378
  []
1363
1379
  );
1364
- for (let b = 0, E = N.length; b < E; b++) {
1365
- let L = N.at(b);
1366
- if (y.push(
1380
+ for (let E = 0, b = N.length; E < b; E++) {
1381
+ let T = N.at(E);
1382
+ if (h.push(
1367
1383
  g.replaceTextRange(
1368
- T(p.at(b).node, s),
1369
- s.text.slice(...T(L.node, s))
1384
+ G(p.at(E).node, a),
1385
+ a.text.slice(...G(T.node, a))
1370
1386
  )
1371
1387
  ), l["newlines-between"] !== "ignore") {
1372
- let G = N.at(b + 1);
1373
- if (G) {
1374
- let P = n(
1375
- p.at(b),
1376
- p.at(b + 1)
1388
+ let L = N.at(E + 1);
1389
+ if (L) {
1390
+ let R = c(
1391
+ p.at(E),
1392
+ p.at(E + 1)
1377
1393
  );
1378
- (l["newlines-between"] === "always" && x(l.groups, L) === x(l.groups, G) && P !== 0 || l["newlines-between"] === "never" && P > 0) && y.push(
1394
+ (l["newlines-between"] === "always" && x(l.groups, T) === x(l.groups, L) && R !== 0 || l["newlines-between"] === "never" && R > 0) && h.push(
1379
1395
  g.removeRange([
1380
- T(p.at(b).node, s).at(1),
1381
- T(p.at(b + 1).node, s).at(0) - 1
1396
+ G(p.at(E).node, a).at(1),
1397
+ G(p.at(E + 1).node, a).at(0) - 1
1382
1398
  ])
1383
- ), l["newlines-between"] === "always" && x(l.groups, L) !== x(l.groups, G) && P > 1 && y.push(
1399
+ ), l["newlines-between"] === "always" && x(l.groups, T) !== x(l.groups, L) && R > 1 && h.push(
1384
1400
  g.replaceTextRange(
1385
1401
  [
1386
- T(p.at(b).node, s).at(1),
1387
- T(p.at(b + 1).node, s).at(
1402
+ G(p.at(E).node, a).at(1),
1403
+ G(p.at(E + 1).node, a).at(
1388
1404
  0
1389
1405
  ) - 1
1390
1406
  ],
1391
1407
  `
1392
1408
  `
1393
1409
  )
1394
- ), l["newlines-between"] === "always" && x(l.groups, L) !== x(l.groups, G) && P === 0 && y.push(
1410
+ ), l["newlines-between"] === "always" && x(l.groups, T) !== x(l.groups, L) && R === 0 && h.push(
1395
1411
  g.insertTextAfterRange(
1396
- T(p.at(b).node, s),
1412
+ G(p.at(E).node, a),
1397
1413
  `
1398
1414
  `
1399
1415
  )
@@ -1401,53 +1417,53 @@ const J = "sort-array-includes", de = O({
1401
1417
  }
1402
1418
  }
1403
1419
  }
1404
- return y;
1405
- }, d = [[]];
1406
- for (let g of o) {
1407
- let p = (m = d.at(-1)) == null ? void 0 : m.at(-1);
1408
- p && t(p, g) ? d.push([g]) : d.at(-1).push(g);
1420
+ return h;
1421
+ }, y = [[]];
1422
+ for (let g of u) {
1423
+ let p = (m = y.at(-1)) == null ? void 0 : m.at(-1);
1424
+ p && r(p, g) ? y.push([g]) : y.at(-1).push(g);
1409
1425
  }
1410
- for (let g of d)
1411
- k(g, (p, y) => {
1412
- let h = x(l.groups, p), N = x(l.groups, y), b = n(p, y);
1413
- !(u(p.node) && u(y.node)) && !t(p, y) && (h > N || h === N && v(A(p, y, l))) && a.report({
1426
+ for (let g of y)
1427
+ C(g, (p, h) => {
1428
+ let S = x(l.groups, p), N = x(l.groups, h), E = c(p, h);
1429
+ !(t(p.node) && t(h.node)) && !r(p, h) && (S > N || S === N && j(w(p, h, l))) && s.report({
1414
1430
  messageId: "unexpectedImportsOrder",
1415
1431
  data: {
1416
1432
  left: p.name,
1417
- right: y.name
1433
+ right: h.name
1418
1434
  },
1419
- node: y.node,
1420
- fix: (E) => c(E, g)
1421
- }), l["newlines-between"] === "never" && b > 0 && a.report({
1435
+ node: h.node,
1436
+ fix: (b) => d(b, g)
1437
+ }), l["newlines-between"] === "never" && E > 0 && s.report({
1422
1438
  messageId: "extraSpacingBetweenImports",
1423
1439
  data: {
1424
1440
  left: p.name,
1425
- right: y.name
1441
+ right: h.name
1426
1442
  },
1427
- node: y.node,
1428
- fix: (E) => c(E, g)
1429
- }), l["newlines-between"] === "always" && (h < N && b === 0 ? a.report({
1443
+ node: h.node,
1444
+ fix: (b) => d(b, g)
1445
+ }), l["newlines-between"] === "always" && (S < N && E === 0 ? s.report({
1430
1446
  messageId: "missedSpacingBetweenImports",
1431
1447
  data: {
1432
1448
  left: p.name,
1433
- right: y.name
1449
+ right: h.name
1434
1450
  },
1435
- node: y.node,
1436
- fix: (E) => c(E, g)
1437
- }) : (b > 1 || h === N && b > 0) && a.report({
1451
+ node: h.node,
1452
+ fix: (b) => d(b, g)
1453
+ }) : (E > 1 || S === N && E > 0) && s.report({
1438
1454
  messageId: "extraSpacingBetweenImports",
1439
1455
  data: {
1440
1456
  left: p.name,
1441
- right: y.name
1457
+ right: h.name
1442
1458
  },
1443
- node: y.node,
1444
- fix: (E) => c(E, g)
1459
+ node: h.node,
1460
+ fix: (b) => d(b, g)
1445
1461
  }));
1446
1462
  });
1447
1463
  }
1448
1464
  };
1449
1465
  }
1450
- }), te = "sort-objects", Ne = O({
1466
+ }), te = "sort-objects", Ae = O({
1451
1467
  name: te,
1452
1468
  meta: {
1453
1469
  type: "suggestion",
@@ -1505,10 +1521,10 @@ const J = "sort-array-includes", de = O({
1505
1521
  order: f.asc
1506
1522
  }
1507
1523
  ],
1508
- create: (a) => {
1509
- let l = (s) => {
1510
- if (s.properties.length > 1) {
1511
- let o = j(a.options.at(0), {
1524
+ create: (s) => {
1525
+ let l = (n) => {
1526
+ if (n.properties.length > 1) {
1527
+ let a = k(s.options.at(0), {
1512
1528
  "partition-by-comment": !1,
1513
1529
  type: i.alphabetical,
1514
1530
  "styled-components": !0,
@@ -1516,92 +1532,92 @@ const J = "sort-array-includes", de = O({
1516
1532
  order: f.asc,
1517
1533
  "custom-groups": {},
1518
1534
  groups: []
1519
- }), u = (n) => n.type === "Identifier" && n.name === "styled", r = (n) => n !== void 0 && n.type === "CallExpression" && (n.callee.type === "MemberExpression" && u(n.callee.object) || n.callee.type === "CallExpression" && u(n.callee.callee));
1520
- if (!o["styled-components"] && (r(s.parent) || s.parent.type === "ArrowFunctionExpression" && r(s.parent.parent)))
1535
+ }), 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));
1536
+ if (!a["styled-components"] && (t(n.parent) || n.parent.type === "ArrowFunctionExpression" && t(n.parent.parent)))
1521
1537
  return;
1522
- let e = a.getSourceCode(), t = (n) => n.reduce(
1538
+ let e = s.getSourceCode(), o = (r) => r.reduce(
1523
1539
  (c, d) => {
1524
1540
  if (d.type === "SpreadElement" || d.type === "RestElement")
1525
1541
  return c.push([]), c;
1526
- let m = _(d, e);
1527
- o["partition-by-comment"] && m && oe(
1528
- o["partition-by-comment"],
1529
- m.value
1542
+ let y = _(d, e);
1543
+ a["partition-by-comment"] && y && oe(
1544
+ a["partition-by-comment"],
1545
+ y.value
1530
1546
  ) && c.push([]);
1531
- let g, p = "ignore", y = [], { getGroup: h, setCustomGroups: N } = R(o.groups);
1532
- d.key.type === "Identifier" ? { name: g } = d.key : d.key.type === "Literal" ? g = `${d.key.value}` : g = e.text.slice(...d.key.range), d.value.type === "AssignmentPattern" && ((L) => {
1533
- L.right.type === "Identifier" && y.push(L.right.name);
1534
- let G = (P) => {
1535
- let $ = [];
1536
- switch (P.type) {
1547
+ let m, g = "ignore", p = [], { getGroup: h, setCustomGroups: S } = M(a.groups);
1548
+ 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" && ((b) => {
1549
+ b.right.type === "Identifier" && p.push(b.right.name);
1550
+ let T = (L) => {
1551
+ let R = [];
1552
+ switch (L.type) {
1537
1553
  case "ArrowFunctionExpression":
1538
- $.push(P.body);
1554
+ R.push(L.body);
1539
1555
  break;
1540
1556
  case "ConditionalExpression":
1541
- $.push(P.consequent, P.alternate);
1557
+ R.push(L.consequent, L.alternate);
1542
1558
  break;
1543
1559
  case "LogicalExpression":
1544
1560
  case "BinaryExpression":
1545
- $.push(P.left, P.right);
1561
+ R.push(L.left, L.right);
1546
1562
  break;
1547
1563
  case "CallExpression":
1548
- $.push(...P.arguments);
1564
+ R.push(...L.arguments);
1549
1565
  break;
1550
1566
  }
1551
- $.forEach((B) => {
1552
- B.type === "Identifier" && y.push(B.name), (B.type === "BinaryExpression" || B.type === "ConditionalExpression") && G(B);
1567
+ R.forEach((U) => {
1568
+ U.type === "Identifier" && p.push(U.name), (U.type === "BinaryExpression" || U.type === "ConditionalExpression") && T(U);
1553
1569
  });
1554
1570
  };
1555
- switch (L.right.type) {
1571
+ switch (b.right.type) {
1556
1572
  case "ArrowFunctionExpression":
1557
1573
  case "ConditionalExpression":
1558
1574
  case "LogicalExpression":
1559
1575
  case "BinaryExpression":
1560
1576
  case "CallExpression":
1561
- G(L.right);
1577
+ T(b.right);
1562
1578
  break;
1563
1579
  }
1564
- })(d.value), N(o["custom-groups"], g);
1565
- let b = {
1566
- size: w(d.range),
1580
+ })(d.value), S(a["custom-groups"], m);
1581
+ let N = {
1582
+ size: v(d.range),
1567
1583
  group: h(),
1568
- dependencies: y,
1584
+ dependencies: p,
1569
1585
  node: d,
1570
- position: p,
1571
- name: g
1586
+ position: g,
1587
+ name: m
1572
1588
  };
1573
- return c.at(-1).push(b), c;
1589
+ return c.at(-1).push(N), c;
1574
1590
  },
1575
1591
  [[]]
1576
1592
  );
1577
- for (let n of t(s.properties))
1578
- k(n, (c, d) => {
1579
- let m = x(o.groups, c), g = x(o.groups, d);
1580
- if (m > g || m === g && v(A(c, d, o))) {
1581
- let p = (y) => {
1593
+ for (let r of o(n.properties))
1594
+ C(r, (c, d) => {
1595
+ let y = x(a.groups, c), m = x(a.groups, d);
1596
+ if (y > m || y === m && j(w(c, d, a))) {
1597
+ let g = (p) => {
1582
1598
  let h = {};
1583
- for (let b of n) {
1584
- let E = x(o.groups, b);
1585
- E in h ? h[E] = S(
1586
- [...h[E], b],
1587
- o
1588
- ) : h[E] = [b];
1599
+ for (let N of r) {
1600
+ let E = x(a.groups, N);
1601
+ E in h ? h[E] = A(
1602
+ [...h[E], N],
1603
+ a
1604
+ ) : h[E] = [N];
1589
1605
  }
1590
- let N = [];
1591
- for (let b of Object.keys(h).sort())
1592
- N.push(...S(h[b], o));
1593
- return C(y, n, N, e, {
1594
- partitionComment: o["partition-by-comment"]
1606
+ let S = [];
1607
+ for (let N of Object.keys(h).sort())
1608
+ S.push(...A(h[N], a));
1609
+ return P(p, r, S, e, {
1610
+ partitionComment: a["partition-by-comment"]
1595
1611
  });
1596
1612
  };
1597
- a.report({
1613
+ s.report({
1598
1614
  messageId: "unexpectedObjectsOrder",
1599
1615
  data: {
1600
1616
  left: I(c.name),
1601
1617
  right: I(d.name)
1602
1618
  },
1603
1619
  node: d.node,
1604
- fix: p
1620
+ fix: g
1605
1621
  });
1606
1622
  }
1607
1623
  });
@@ -1612,7 +1628,7 @@ const J = "sort-array-includes", de = O({
1612
1628
  ObjectPattern: l
1613
1629
  };
1614
1630
  }
1615
- }), re = "sort-classes", Ae = O({
1631
+ }), re = "sort-classes", Ne = O({
1616
1632
  name: re,
1617
1633
  meta: {
1618
1634
  type: "suggestion",
@@ -1660,67 +1676,67 @@ const J = "sort-array-includes", de = O({
1660
1676
  order: f.asc
1661
1677
  }
1662
1678
  ],
1663
- create: (a) => ({
1679
+ create: (s) => ({
1664
1680
  ClassBody: (l) => {
1665
1681
  if (l.body.length > 1) {
1666
- let s = j(a.options.at(0), {
1682
+ let n = k(s.options.at(0), {
1667
1683
  type: i.alphabetical,
1668
1684
  order: f.asc,
1669
1685
  "ignore-case": !1,
1670
1686
  groups: ["property", "constructor", "method", "unknown"]
1671
- }), o = a.getSourceCode(), u = l.body.map((r) => {
1687
+ }), a = s.getSourceCode(), u = l.body.map((t) => {
1672
1688
  var d;
1673
- let e, { getGroup: t, defineGroup: n } = R(s.groups);
1674
- r.type === "StaticBlock" ? e = "static" : r.type === "TSIndexSignature" ? e = o.text.slice(
1675
- r.range.at(0),
1676
- ((d = r.typeAnnotation) == null ? void 0 : d.range.at(0)) ?? r.range.at(1)
1677
- ) : r.key.type === "Identifier" ? { name: e } = r.key : e = o.text.slice(...r.key.range);
1689
+ let e, { getGroup: o, defineGroup: r } = M(n.groups);
1690
+ t.type === "StaticBlock" ? e = "static" : t.type === "TSIndexSignature" ? e = a.text.slice(
1691
+ t.range.at(0),
1692
+ ((d = t.typeAnnotation) == null ? void 0 : d.range.at(0)) ?? t.range.at(1)
1693
+ ) : t.key.type === "Identifier" ? { name: e } = t.key : e = a.text.slice(...t.key.range);
1678
1694
  let c = e.startsWith("_") || e.startsWith("#");
1679
- if (r.type === "MethodDefinition") {
1680
- r.kind === "constructor" && n("constructor");
1681
- let m = r.accessibility === "private" || c, g = r.static;
1682
- m && g && n("static-private-method"), m && n("private-method"), g && n("static-method"), r.kind === "get" && n("get-method"), r.kind === "set" && n("set-method"), n("method");
1695
+ if (t.type === "MethodDefinition") {
1696
+ t.kind === "constructor" && r("constructor");
1697
+ let y = t.accessibility === "private" || c, m = t.static;
1698
+ y && m && r("static-private-method"), y && r("private-method"), m && r("static-method"), t.kind === "get" && r("get-method"), t.kind === "set" && r("set-method"), r("method");
1683
1699
  } else
1684
- r.type === "TSIndexSignature" ? n("index-signature") : r.type === "PropertyDefinition" && ((r.accessibility === "private" || c) && n("private-property"), r.static && n("static-property"), n("property"));
1700
+ t.type === "TSIndexSignature" ? r("index-signature") : t.type === "PropertyDefinition" && ((t.accessibility === "private" || c) && r("private-property"), t.static && r("static-property"), r("property"));
1685
1701
  return {
1686
- size: w(r.range),
1687
- group: t(),
1688
- node: r,
1702
+ size: v(t.range),
1703
+ group: o(),
1704
+ node: t,
1689
1705
  name: e
1690
1706
  };
1691
1707
  });
1692
- k(u, (r, e) => {
1693
- let t = x(s.groups, r), n = x(s.groups, e);
1694
- r.name !== e.name && (t > n || t === n && v(A(r, e, s))) && a.report({
1708
+ C(u, (t, e) => {
1709
+ let o = x(n.groups, t), r = x(n.groups, e);
1710
+ t.name !== e.name && (o > r || o === r && j(w(t, e, n))) && s.report({
1695
1711
  messageId: "unexpectedClassesOrder",
1696
1712
  data: {
1697
- left: I(r.name),
1713
+ left: I(t.name),
1698
1714
  right: I(e.name)
1699
1715
  },
1700
1716
  node: e.node,
1701
1717
  fix: (c) => {
1702
- let d = [], m = u.reduce(
1703
- (p, y) => {
1704
- let h = x(s.groups, y);
1705
- return h in p ? p[h] = S(
1706
- [...p[h], y],
1707
- s
1708
- ) : p[h] = [y], p;
1718
+ let d = [], y = u.reduce(
1719
+ (g, p) => {
1720
+ let h = x(n.groups, p);
1721
+ return h in g ? g[h] = A(
1722
+ [...g[h], p],
1723
+ n
1724
+ ) : g[h] = [p], g;
1709
1725
  },
1710
1726
  {}
1711
- ), g = Object.keys(m).sort().reduce(
1712
- (p, y) => [
1713
- ...p,
1714
- ...m[y]
1727
+ ), m = Object.keys(y).sort().reduce(
1728
+ (g, p) => [
1729
+ ...g,
1730
+ ...y[p]
1715
1731
  ],
1716
1732
  []
1717
1733
  );
1718
- for (let p = 0, y = g.length; p < y; p++)
1734
+ for (let g = 0, p = m.length; g < p; g++)
1719
1735
  d.push(
1720
1736
  c.replaceTextRange(
1721
- T(u.at(p).node, o),
1722
- o.text.slice(
1723
- ...T(g.at(p).node, o)
1737
+ G(u.at(g).node, a),
1738
+ a.text.slice(
1739
+ ...G(m.at(g).node, a)
1724
1740
  )
1725
1741
  )
1726
1742
  );
@@ -1731,7 +1747,7 @@ const J = "sort-array-includes", de = O({
1731
1747
  }
1732
1748
  }
1733
1749
  })
1734
- }), se = "sort-enums", Ie = O({
1750
+ }), se = "sort-enums", we = O({
1735
1751
  name: se,
1736
1752
  meta: {
1737
1753
  type: "suggestion",
@@ -1775,33 +1791,33 @@ const J = "sort-array-includes", de = O({
1775
1791
  order: f.asc
1776
1792
  }
1777
1793
  ],
1778
- create: (a) => ({
1794
+ create: (s) => ({
1779
1795
  TSEnumDeclaration: (l) => {
1780
- if (l.members.length > 1 && l.members.every(({ initializer: s }) => s)) {
1781
- let s = j(a.options.at(0), {
1796
+ if (l.members.length > 1 && l.members.every(({ initializer: n }) => n)) {
1797
+ let n = k(s.options.at(0), {
1782
1798
  type: i.alphabetical,
1783
1799
  order: f.asc,
1784
1800
  "ignore-case": !1
1785
- }), o = a.getSourceCode(), u = l.members.map((r) => ({
1786
- name: r.id.type === "Literal" ? `${r.id.value}` : `${o.text.slice(...r.id.range)}`,
1787
- size: w(r.range),
1788
- node: r
1801
+ }), a = s.getSourceCode(), u = l.members.map((t) => ({
1802
+ name: t.id.type === "Literal" ? `${t.id.value}` : `${a.text.slice(...t.id.range)}`,
1803
+ size: v(t.range),
1804
+ node: t
1789
1805
  }));
1790
- k(u, (r, e) => {
1791
- v(A(r, e, s)) && a.report({
1806
+ C(u, (t, e) => {
1807
+ j(w(t, e, n)) && s.report({
1792
1808
  messageId: "unexpectedEnumsOrder",
1793
1809
  data: {
1794
- left: I(r.name),
1810
+ left: I(t.name),
1795
1811
  right: I(e.name)
1796
1812
  },
1797
1813
  node: e.node,
1798
- fix: (t) => C(t, u, S(u, s), o)
1814
+ fix: (o) => P(o, u, A(u, n), a)
1799
1815
  });
1800
1816
  });
1801
1817
  }
1802
1818
  }
1803
1819
  })
1804
- }), ae = "sort-maps", Oe = O({
1820
+ }), ae = "sort-maps", Ie = O({
1805
1821
  name: ae,
1806
1822
  meta: {
1807
1823
  type: "suggestion",
@@ -1845,42 +1861,42 @@ const J = "sort-array-includes", de = O({
1845
1861
  order: f.asc
1846
1862
  }
1847
1863
  ],
1848
- create: (a) => ({
1864
+ create: (s) => ({
1849
1865
  NewExpression: (l) => {
1850
1866
  if (l.callee.type === "Identifier" && l.callee.name === "Map" && l.arguments.length && l.arguments[0].type === "ArrayExpression") {
1851
- let [{ elements: s }] = l.arguments;
1852
- if (s.length > 1) {
1853
- let o = j(a.options.at(0), {
1867
+ let [{ elements: n }] = l.arguments;
1868
+ if (n.length > 1) {
1869
+ let a = k(s.options.at(0), {
1854
1870
  type: i.alphabetical,
1855
1871
  "ignore-case": !1,
1856
1872
  order: f.asc
1857
- }), u = a.getSourceCode(), r = s.reduce(
1858
- (e, t) => (t === null || t.type === "SpreadElement" ? e.push([]) : e.at(-1).push(t), e),
1873
+ }), u = s.getSourceCode(), t = n.reduce(
1874
+ (e, o) => (o === null || o.type === "SpreadElement" ? e.push([]) : e.at(-1).push(o), e),
1859
1875
  [[]]
1860
1876
  );
1861
- for (let e of r) {
1862
- let t = e.map((n) => {
1877
+ for (let e of t) {
1878
+ let o = e.map((r) => {
1863
1879
  let c;
1864
- if (n.type === "ArrayExpression") {
1865
- let [d] = n.elements;
1880
+ if (r.type === "ArrayExpression") {
1881
+ let [d] = r.elements;
1866
1882
  d ? d.type === "Literal" ? c = d.raw : c = u.text.slice(...d.range) : c = `${d}`;
1867
1883
  } else
1868
- c = u.text.slice(...n.range);
1884
+ c = u.text.slice(...r.range);
1869
1885
  return {
1870
- size: w(n.range),
1871
- node: n,
1886
+ size: v(r.range),
1887
+ node: r,
1872
1888
  name: c
1873
1889
  };
1874
1890
  });
1875
- k(t, (n, c) => {
1876
- v(A(n, c, o)) && a.report({
1891
+ C(o, (r, c) => {
1892
+ j(w(r, c, a)) && s.report({
1877
1893
  messageId: "unexpectedMapElementsOrder",
1878
1894
  data: {
1879
- left: I(n.name),
1895
+ left: I(r.name),
1880
1896
  right: I(c.name)
1881
1897
  },
1882
1898
  node: c.node,
1883
- fix: (d) => C(d, t, S(t, o), u)
1899
+ fix: (d) => P(d, o, A(o, a), u)
1884
1900
  });
1885
1901
  });
1886
1902
  }
@@ -1888,8 +1904,8 @@ const J = "sort-array-includes", de = O({
1888
1904
  }
1889
1905
  }
1890
1906
  })
1891
- }), we = "eslint-plugin-perfectionist";
1892
- let z = (a) => {
1907
+ }), Oe = "eslint-plugin-perfectionist";
1908
+ let z = (s) => {
1893
1909
  let l = {
1894
1910
  [ee]: [
1895
1911
  "error",
@@ -1941,8 +1957,8 @@ let z = (a) => {
1941
1957
  "spread-last": !0
1942
1958
  }
1943
1959
  ],
1944
- [V]: ["error"],
1945
1960
  [W]: ["error"],
1961
+ [V]: ["error"],
1946
1962
  [X]: ["error"],
1947
1963
  [K]: ["error"],
1948
1964
  [q]: ["error"],
@@ -1956,9 +1972,9 @@ let z = (a) => {
1956
1972
  };
1957
1973
  return {
1958
1974
  rules: Object.fromEntries(
1959
- Object.entries(l).map(([s, [o, u = {}]]) => [
1960
- `perfectionist/${s}`,
1961
- [o, Object.assign(u, a)]
1975
+ Object.entries(l).map(([n, [a, u = {}]]) => [
1976
+ `perfectionist/${n}`,
1977
+ [a, Object.assign(u, s)]
1962
1978
  ])
1963
1979
  ),
1964
1980
  plugins: ["perfectionist"]
@@ -1967,19 +1983,19 @@ let z = (a) => {
1967
1983
  const Te = {
1968
1984
  rules: {
1969
1985
  [J]: de,
1970
- [W]: ce,
1971
- [re]: Ae,
1972
- [se]: Ie,
1986
+ [V]: ce,
1987
+ [re]: Ne,
1988
+ [se]: we,
1973
1989
  [Z]: Ee,
1974
1990
  [ee]: Se,
1975
1991
  [Q]: be,
1976
1992
  [Y]: xe,
1977
- [ae]: Oe,
1993
+ [ae]: Ie,
1978
1994
  [K]: ge,
1979
1995
  [q]: ye,
1980
1996
  [F]: me,
1981
- [te]: Ne,
1982
- [V]: ue,
1997
+ [te]: Ae,
1998
+ [W]: ue,
1983
1999
  [H]: he,
1984
2000
  [X]: fe
1985
2001
  },
@@ -1999,7 +2015,7 @@ const Te = {
1999
2015
  order: f.desc
2000
2016
  })
2001
2017
  },
2002
- name: we
2018
+ name: Oe
2003
2019
  };
2004
2020
  export {
2005
2021
  Te as default