eslint-plugin-perfectionist 2.0.0 → 2.1.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,119 +1,131 @@
1
1
  import U from "path";
2
- import { ESLintUtils as le, ASTUtils as D } from "@typescript-eslint/utils";
3
- import { minimatch as $ } from "minimatch";
4
- import ie from "natural-compare-lite";
5
- import { builtinModules as oe } from "module";
6
- let v = le.RuleCreator(
7
- (s) => `https://eslint-plugin-perfectionist.azat.io/rules/${s}`
8
- ), x = (s, l) => {
9
- for (let n = 0, a = s.length; n < a; n++) {
10
- let u = s[n];
2
+ import { ESLintUtils as ne, ASTUtils as D } from "@typescript-eslint/utils";
3
+ import { minimatch as M } from "minimatch";
4
+ import le from "natural-compare-lite";
5
+ import { builtinModules as ie } from "module";
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];
11
11
  if (l.group === u || Array.isArray(u) && typeof l.group == "string" && u.includes(l.group))
12
- return n;
12
+ return s;
13
13
  }
14
- return s.length;
15
- }, w = (s) => {
16
- let [l, n] = s;
17
- return n - l;
18
- }, j = (s) => s > 0;
19
- var i = /* @__PURE__ */ ((s) => (s.alphabetical = "alphabetical", s["line-length"] = "line-length", s.natural = "natural", s))(i || {}), f = /* @__PURE__ */ ((s) => (s.desc = "desc", s.asc = "asc", s))(f || {});
20
- let G = (s) => {
21
- let l, n = (u) => {
22
- !l && s.flat().includes(u) && (l = u);
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);
23
23
  };
24
24
  return {
25
25
  getGroup: () => l ?? "unknown",
26
- setCustomGroups: (u, t) => {
26
+ setCustomGroups: (u, r) => {
27
27
  if (u)
28
- for (let [e, o] of Object.entries(u))
29
- Array.isArray(o) && o.some((r) => $(t, r)) && n(e), typeof o == "string" && $(t, o) && n(e);
28
+ for (let [e, t] of Object.entries(u))
29
+ Array.isArray(t) && t.some(
30
+ (n) => M(r, n, {
31
+ nocomment: !0
32
+ })
33
+ ) && s(e), typeof t == "string" && M(r, t, {
34
+ nocomment: !0
35
+ }) && s(e);
30
36
  },
31
- defineGroup: n
37
+ defineGroup: s
32
38
  };
33
- }, I = (s, l, n) => {
34
- var e, o;
35
- if ((e = l.dependencies) != null && e.includes(s.name))
39
+ }, A = (a, l, s) => {
40
+ var e, t;
41
+ if ((e = l.dependencies) != null && e.includes(a.name))
36
42
  return -1;
37
- if ((o = s.dependencies) != null && o.includes(l.name))
43
+ if ((t = a.dependencies) != null && t.includes(l.name))
38
44
  return 1;
39
- let a = n.order === "asc" ? 1 : -1, u, t = (r) => n["ignore-case"] ? r.toLowerCase() : r;
40
- return n.type === i.alphabetical ? u = (r, c) => t(r.name).localeCompare(t(c.name)) : n.type === i.natural ? u = (r, c) => ie(t(r.name), t(c.name)) : u = (r, c) => r.size - c.size, a * u(s, l);
41
- }, N = (s, l) => [...s].sort((n, a) => I(n, a, l)), pe = (s, l) => {
42
- let n = l.getTokenAfter(s, {
43
- filter: ({ value: a, type: u }) => !(u === "Punctuator" && [",", ";"].includes(a)),
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)),
44
50
  includeComments: !0
45
51
  });
46
- return ((n == null ? void 0 : n.type) === "Block" || (n == null ? void 0 : n.type) === "Line") && s.loc.end.line === n.loc.end.line ? n : null;
47
- }, ne = (s, l) => Array.isArray(s) && s.some((n) => $(l.trim(), n)) || typeof s == "string" && $(l.trim(), s) || s === !0, _ = (s, l) => {
48
- let [n, a] = l.getTokensBefore(s, {
49
- filter: ({ value: u, type: t }) => !(t === "Punctuator" && [",", ";"].includes(u)),
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, {
55
+ nocomment: !0
56
+ })
57
+ ) || typeof a == "string" && M(l.trim(), a, {
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)),
50
62
  includeComments: !0,
51
63
  count: 2
52
64
  });
53
- return ((a == null ? void 0 : a.type) === "Block" || (a == null ? void 0 : a.type) === "Line") && s.loc.start.line - a.loc.end.line <= 1 && (n == null ? void 0 : n.loc.end.line) !== a.loc.start.line ? a : null;
54
- }, L = (s, l, n) => {
55
- var o;
56
- let a = s.range.at(0), u = s.range.at(1), t = l.text.slice(a, u);
57
- if (D.isParenthesized(s, l)) {
58
- let r = l.getTokenBefore(
59
- s,
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,
60
72
  D.isOpeningParenToken
61
73
  ), c = l.getTokenAfter(
62
- s,
74
+ a,
63
75
  D.isClosingParenToken
64
76
  );
65
- a = r.range.at(0), u = c.range.at(1);
77
+ o = n.range.at(0), u = c.range.at(1);
66
78
  }
67
- let e = _(s, l);
68
- if (t.endsWith(";") || t.endsWith(",")) {
69
- let r = l.getTokensAfter(s, {
79
+ let e = _(a, l);
80
+ if (r.endsWith(";") || r.endsWith(",")) {
81
+ let n = l.getTokensAfter(a, {
70
82
  includeComments: !0,
71
83
  count: 2
72
84
  });
73
- s.loc.start.line === ((o = r.at(1)) == null ? void 0 : o.loc.start.line) && (u -= 1);
85
+ a.loc.start.line === ((t = n.at(1)) == null ? void 0 : t.loc.start.line) && (u -= 1);
74
86
  }
75
- return e && !ne(
76
- (n == null ? void 0 : n.partitionComment) ?? !1,
87
+ return e && !oe(
88
+ (s == null ? void 0 : s.partitionComment) ?? !1,
77
89
  e.value
78
- ) && (a = e.range.at(0)), [a, u];
79
- }, P = (s, l, n, a, u) => {
80
- var o, r;
81
- let t = [], e = ((o = l.at(0)) == null ? void 0 : o.node.loc.start.line) === ((r = l.at(-1)) == null ? void 0 : r.node.loc.end.line);
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);
82
94
  for (let c = 0, d = l.length; c < d; c++) {
83
- let { node: y } = l.at(c);
84
- t.push(
85
- s.replaceTextRange(
86
- L(y, a, u),
87
- a.text.slice(
88
- ...L(n.at(c).node, a, u)
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)
89
101
  )
90
102
  )
91
103
  );
92
- let m = pe(n.at(c).node, a);
93
- if (m && !e) {
94
- let p = [
95
- a.getTokenBefore(m).range.at(1),
96
- m.range.at(1)
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)
97
109
  ];
98
- t.push(s.replaceTextRange(p, ""));
99
- let h = a.getTokenAfter(y);
100
- t.push(
101
- s.insertTextAfter(
102
- (h == null ? void 0 : h.loc.end.line) === y.loc.end.line ? h : y,
103
- a.text.slice(...p)
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)
104
116
  )
105
117
  );
106
118
  }
107
119
  }
108
- return t;
109
- }, k = (s = {}, l) => Object.assign(l, s), C = (s, l) => {
110
- if (s.length > 1)
111
- for (let n = 1; n < s.length; n++) {
112
- let a = s.at(n - 1), u = s.at(n);
113
- a && u && l(a, u, n - 1);
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);
114
126
  }
115
127
  };
116
- const V = "sort-svelte-attributes", ue = v({
128
+ const V = "sort-svelte-attributes", ue = O({
117
129
  name: V,
118
130
  meta: {
119
131
  type: "suggestion",
@@ -163,61 +175,61 @@ const V = "sort-svelte-attributes", ue = v({
163
175
  order: f.asc
164
176
  }
165
177
  ],
166
- create: (s) => U.extname(s.getFilename()) !== ".svelte" ? {} : {
178
+ create: (a) => U.extname(a.getFilename()) !== ".svelte" ? {} : {
167
179
  SvelteStartTag: (l) => {
168
180
  if (l.attributes.length > 1) {
169
- let n = k(s.options.at(0), {
181
+ let s = j(a.options.at(0), {
170
182
  type: i.alphabetical,
171
183
  order: f.asc,
172
184
  "ignore-case": !1,
173
185
  "custom-groups": {},
174
186
  groups: []
175
- }), a = s.getSourceCode(), u = l.attributes.reduce(
176
- (t, e) => {
187
+ }), o = a.getSourceCode(), u = l.attributes.reduce(
188
+ (r, e) => {
177
189
  if (e.type === "SvelteSpreadAttribute")
178
- return t.push([]), t;
179
- let o, { getGroup: r, defineGroup: c, setCustomGroups: d } = G(
180
- n.groups
190
+ return r.push([]), r;
191
+ let t, { getGroup: n, defineGroup: c, setCustomGroups: d } = R(
192
+ s.groups
181
193
  );
182
- return e.key.type === "SvelteSpecialDirectiveKey" ? o = a.text.slice(...e.key.range) : typeof e.key.name == "string" ? { name: o } = e.key : o = a.text.slice(...e.key.range), d(n["custom-groups"], o), e.type === "SvelteShorthandAttribute" && (c("svelte-shorthand"), c("shorthand")), (!("value" in e) || Array.isArray(e.value) && !e.value.at(0)) && c("shorthand"), e.loc.start.line !== e.loc.end.line && c("multiline"), t.at(-1).push({
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({
183
195
  size: w(e.range),
184
196
  node: e,
185
- group: r(),
186
- name: o
187
- }), t;
197
+ group: n(),
198
+ name: t
199
+ }), r;
188
200
  },
189
201
  [[]]
190
202
  );
191
- for (let t of u)
192
- C(t, (e, o) => {
193
- let r = x(n.groups, e), c = x(n.groups, o);
194
- (r > c || r === c && j(I(e, o, n))) && s.report({
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({
195
207
  messageId: "unexpectedSvelteAttributesOrder",
196
208
  data: {
197
209
  left: e.name,
198
- right: o.name
210
+ right: t.name
199
211
  },
200
- node: o.node,
212
+ node: t.node,
201
213
  fix: (d) => {
202
- let y = {};
203
- for (let g of t) {
204
- let p = x(n.groups, g);
205
- p in y ? y[p] = N(
206
- [...y[p], g],
207
- n
208
- ) : y[p] = [g];
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];
209
221
  }
210
- let m = [];
211
- for (let g of Object.keys(y).sort())
212
- m.push(...N(y[g], n));
213
- return P(d, t, m, a);
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);
214
226
  }
215
227
  });
216
228
  });
217
229
  }
218
230
  }
219
231
  }
220
- }), W = "sort-astro-attributes", ce = v({
232
+ }), W = "sort-astro-attributes", ce = O({
221
233
  name: W,
222
234
  meta: {
223
235
  type: "suggestion",
@@ -268,55 +280,55 @@ const V = "sort-svelte-attributes", ue = v({
268
280
  }
269
281
  ],
270
282
  // @ts-ignore
271
- create: (s) => U.extname(s.getFilename()) !== ".astro" ? {} : {
283
+ create: (a) => U.extname(a.getFilename()) !== ".astro" ? {} : {
272
284
  JSXElement: (l) => {
273
- let { attributes: n } = l.openingElement;
274
- if (n.length > 1) {
275
- let a = k(s.options.at(0), {
285
+ let { attributes: s } = l.openingElement;
286
+ if (s.length > 1) {
287
+ let o = j(a.options.at(0), {
276
288
  type: i.alphabetical,
277
289
  order: f.asc,
278
290
  "ignore-case": !1,
279
291
  "custom-groups": {},
280
292
  groups: []
281
- }), u = s.getSourceCode(), t = n.reduce(
282
- (e, o) => {
283
- if (o.type === "JSXSpreadAttribute")
293
+ }), u = a.getSourceCode(), r = s.reduce(
294
+ (e, t) => {
295
+ if (t.type === "JSXSpreadAttribute")
284
296
  return e.push([]), e;
285
- let r = typeof o.name.name == "string" ? o.name.name : u.text.slice(...o.name.range), { getGroup: c, defineGroup: d, setCustomGroups: y } = G(
286
- a.groups
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
287
299
  );
288
- return y(a["custom-groups"], r), o.type === "AstroShorthandAttribute" && (d("astro-shorthand"), d("shorthand")), o.value === null && d("shorthand"), o.loc.start.line !== o.loc.end.line && d("multiline"), e.at(-1).push({
289
- size: w(o.range),
290
- node: o,
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,
291
303
  group: c(),
292
- name: r
304
+ name: n
293
305
  }), e;
294
306
  },
295
307
  [[]]
296
308
  );
297
- for (let e of t)
298
- C(e, (o, r) => {
299
- let c = x(a.groups, o), d = x(a.groups, r);
300
- (c > d || c === d && j(I(o, r, a))) && s.report({
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({
301
313
  messageId: "unexpectedAstroAttributesOrder",
302
314
  data: {
303
- left: o.name,
304
- right: r.name
315
+ left: t.name,
316
+ right: n.name
305
317
  },
306
- node: r.node,
307
- fix: (y) => {
308
- let m = {};
309
- for (let p of e) {
310
- let h = x(a.groups, p);
311
- h in m ? m[h] = N(
312
- [...m[h], p],
313
- a
314
- ) : m[h] = [p];
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];
315
327
  }
316
- let g = [];
317
- for (let p of Object.keys(m).sort())
318
- g.push(...N(m[p], a));
319
- return P(y, e, g, u);
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);
320
332
  }
321
333
  });
322
334
  });
@@ -324,8 +336,8 @@ const V = "sort-svelte-attributes", ue = v({
324
336
  }
325
337
  }
326
338
  });
327
- let O = (s) => s.replaceAll(/\s\s+/g, " ").trim();
328
- const J = "sort-array-includes", de = v({
339
+ let I = (a) => a.replaceAll(/\s\s+/g, " ").trim();
340
+ const J = "sort-array-includes", de = O({
329
341
  name: J,
330
342
  meta: {
331
343
  type: "suggestion",
@@ -373,40 +385,40 @@ const J = "sort-array-includes", de = v({
373
385
  order: f.asc
374
386
  }
375
387
  ],
376
- create: (s) => ({
388
+ create: (a) => ({
377
389
  MemberExpression: (l) => {
378
390
  if ((l.object.type === "ArrayExpression" || l.object.type === "NewExpression") && l.property.type === "Identifier" && l.property.name === "includes") {
379
- let n = l.object.type === "ArrayExpression" ? l.object.elements : l.object.arguments;
380
- if (n.length > 1) {
381
- let a = k(s.options.at(0), {
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), {
382
394
  type: i.alphabetical,
383
395
  order: f.asc,
384
396
  "ignore-case": !1,
385
397
  "spread-last": !1
386
- }), u = s.getSourceCode(), t = n.reduce(
387
- (e, o) => (o !== null && e.at(0).push({
388
- name: o.type === "Literal" ? `${o.value}` : u.text.slice(...o.range),
389
- size: w(o.range),
390
- type: o.type,
391
- node: o
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
392
404
  }), e),
393
405
  [[], []]
394
406
  ).flat();
395
- C(t, (e, o) => {
396
- let r;
397
- a["spread-last"] && e.node.type === "Literal" && o.node.type === "SpreadElement" ? r = !1 : a["spread-last"] && e.node.type === "SpreadElement" && o.node.type === "Literal" ? r = !0 : r = j(I(e, o, a)), r && s.report({
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({
398
410
  messageId: "unexpectedArrayIncludesOrder",
399
411
  data: {
400
- left: O(e.name),
401
- right: O(o.name)
412
+ left: I(e.name),
413
+ right: I(t.name)
402
414
  },
403
- node: o.node,
415
+ node: t.node,
404
416
  fix: (c) => {
405
- let d = N(t, a);
406
- if (a["spread-last"])
407
- for (let y = 0, m = d.length; y < m; y++)
408
- d.at(y).node.type === "SpreadElement" && d.push(d.splice(y, 1).at(0));
409
- return P(c, t, d, u);
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);
410
422
  }
411
423
  });
412
424
  });
@@ -414,7 +426,7 @@ const J = "sort-array-includes", de = v({
414
426
  }
415
427
  }
416
428
  })
417
- }), X = "sort-vue-attributes", fe = v({
429
+ }), X = "sort-vue-attributes", fe = O({
418
430
  name: X,
419
431
  meta: {
420
432
  type: "suggestion",
@@ -465,60 +477,60 @@ const J = "sort-array-includes", de = v({
465
477
  order: f.asc
466
478
  }
467
479
  ],
468
- create: (s) => {
469
- if (U.extname(s.getFilename()) !== ".vue")
480
+ create: (a) => {
481
+ if (U.extname(a.getFilename()) !== ".vue")
470
482
  return {};
471
- if (!("defineTemplateBodyVisitor" in s.parserServices))
483
+ if (!("defineTemplateBodyVisitor" in a.parserServices))
472
484
  return {};
473
- let { defineTemplateBodyVisitor: l } = s.parserServices;
485
+ let { defineTemplateBodyVisitor: l } = a.parserServices;
474
486
  return l({
475
- VStartTag: (n) => {
476
- if (n.attributes.length > 1) {
477
- let a = k(s.options.at(0), {
487
+ VStartTag: (s) => {
488
+ if (s.attributes.length > 1) {
489
+ let o = j(a.options.at(0), {
478
490
  type: i.alphabetical,
479
491
  order: f.asc,
480
492
  "ignore-case": !1,
481
493
  "custom-groups": {},
482
494
  groups: []
483
- }), u = s.getSourceCode(), t = n.attributes.reduce(
484
- (e, o) => {
485
- if (o.key.type === "VDirectiveKey" && o.key.name.rawName === "bind")
495
+ }), u = a.getSourceCode(), r = s.attributes.reduce(
496
+ (e, t) => {
497
+ if (t.key.type === "VDirectiveKey" && t.key.name.rawName === "bind")
486
498
  return e.push([]), e;
487
- let r, { getGroup: c, defineGroup: d, setCustomGroups: y } = G(
488
- a.groups
499
+ let n, { getGroup: c, defineGroup: d, setCustomGroups: m } = R(
500
+ o.groups
489
501
  );
490
- return typeof o.key.name == "string" && o.key.type !== "VDirectiveKey" ? r = o.key.rawName : r = u.text.slice(...o.key.range), y(a["custom-groups"], r), o.value === null && d("shorthand"), o.loc.start.line !== o.loc.end.line && d("multiline"), e.at(-1).push({
491
- size: w(o.range),
492
- node: o,
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,
493
505
  group: c(),
494
- name: r
506
+ name: n
495
507
  }), e;
496
508
  },
497
509
  [[]]
498
510
  );
499
- for (let e of t)
500
- C(e, (o, r) => {
501
- let c = x(a.groups, o), d = x(a.groups, r);
502
- (c > d || c === d && j(I(o, r, a))) && s.report({
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({
503
515
  messageId: "unexpectedVueAttributesOrder",
504
516
  data: {
505
- left: o.name,
506
- right: r.name
517
+ left: t.name,
518
+ right: n.name
507
519
  },
508
- node: r.node,
509
- fix: (y) => {
510
- let m = {};
511
- for (let p of e) {
512
- let h = x(a.groups, p);
513
- h in m ? m[h] = N(
514
- [...m[h], p],
515
- a
516
- ) : m[h] = [p];
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];
517
529
  }
518
- let g = [];
519
- for (let p of Object.keys(m).sort())
520
- g.push(...N(m[p], a));
521
- return P(y, e, g, u);
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);
522
534
  }
523
535
  });
524
536
  });
@@ -526,7 +538,7 @@ const J = "sort-array-includes", de = v({
526
538
  }
527
539
  });
528
540
  }
529
- }), K = "sort-named-exports", ge = v({
541
+ }), K = "sort-named-exports", ge = O({
530
542
  name: K,
531
543
  meta: {
532
544
  type: "suggestion",
@@ -570,33 +582,33 @@ const J = "sort-array-includes", de = v({
570
582
  order: f.asc
571
583
  }
572
584
  ],
573
- create: (s) => ({
585
+ create: (a) => ({
574
586
  ExportNamedDeclaration: (l) => {
575
587
  if (l.specifiers.length > 1) {
576
- let n = k(s.options.at(0), {
588
+ let s = j(a.options.at(0), {
577
589
  type: i.alphabetical,
578
590
  "ignore-case": !1,
579
591
  order: f.asc
580
- }), a = s.getSourceCode(), u = l.specifiers.map((t) => ({
581
- size: w(t.range),
582
- name: t.local.name,
583
- node: t
592
+ }), o = a.getSourceCode(), u = l.specifiers.map((r) => ({
593
+ size: w(r.range),
594
+ name: r.local.name,
595
+ node: r
584
596
  }));
585
- C(u, (t, e) => {
586
- j(I(t, e, n)) && s.report({
597
+ k(u, (r, e) => {
598
+ v(A(r, e, s)) && a.report({
587
599
  messageId: "unexpectedNamedExportsOrder",
588
600
  data: {
589
- left: t.name,
601
+ left: r.name,
590
602
  right: e.name
591
603
  },
592
604
  node: e.node,
593
- fix: (o) => P(o, u, N(u, n), a)
605
+ fix: (t) => C(t, u, S(u, s), o)
594
606
  });
595
607
  });
596
608
  }
597
609
  }
598
610
  })
599
- }), q = "sort-named-imports", ye = v({
611
+ }), q = "sort-named-imports", ye = O({
600
612
  name: q,
601
613
  meta: {
602
614
  type: "suggestion",
@@ -640,36 +652,36 @@ const J = "sort-array-includes", de = v({
640
652
  order: f.asc
641
653
  }
642
654
  ],
643
- create: (s) => ({
655
+ create: (a) => ({
644
656
  ImportDeclaration: (l) => {
645
- let n = l.specifiers.filter(
646
- ({ type: a }) => a === "ImportSpecifier"
657
+ let s = l.specifiers.filter(
658
+ ({ type: o }) => o === "ImportSpecifier"
647
659
  );
648
- if (n.length > 1) {
649
- let a = k(s.options.at(0), {
660
+ if (s.length > 1) {
661
+ let o = j(a.options.at(0), {
650
662
  type: i.alphabetical,
651
663
  "ignore-case": !1,
652
664
  order: f.asc
653
- }), u = s.getSourceCode(), t = n.map((e) => ({
665
+ }), u = a.getSourceCode(), r = s.map((e) => ({
654
666
  size: w(e.range),
655
667
  name: e.local.name,
656
668
  node: e
657
669
  }));
658
- C(t, (e, o) => {
659
- j(I(e, o, a)) && s.report({
670
+ k(r, (e, t) => {
671
+ v(A(e, t, o)) && a.report({
660
672
  messageId: "unexpectedNamedImportsOrder",
661
673
  data: {
662
674
  left: e.name,
663
- right: o.name
675
+ right: t.name
664
676
  },
665
- node: o.node,
666
- fix: (r) => P(r, t, N(t, a), u)
677
+ node: t.node,
678
+ fix: (n) => C(n, r, S(r, o), u)
667
679
  });
668
680
  });
669
681
  }
670
682
  }
671
683
  })
672
- }), F = "sort-object-types", me = v({
684
+ }), F = "sort-object-types", me = O({
673
685
  name: F,
674
686
  meta: {
675
687
  type: "suggestion",
@@ -720,70 +732,70 @@ const J = "sort-array-includes", de = v({
720
732
  order: f.asc
721
733
  }
722
734
  ],
723
- create: (s) => ({
735
+ create: (a) => ({
724
736
  TSTypeLiteral: (l) => {
725
737
  if (l.members.length > 1) {
726
- let n = k(s.options.at(0), {
738
+ let s = j(a.options.at(0), {
727
739
  type: i.alphabetical,
728
740
  "ignore-case": !1,
729
741
  order: f.asc,
730
742
  "custom-groups": {},
731
743
  groups: []
732
- }), a = s.getSourceCode(), u = l.members.map((t) => {
733
- var p, h;
734
- let e, o = a.text.slice(t.range.at(0), t.range.at(1)), { getGroup: r, defineGroup: c, setCustomGroups: d } = G(
735
- n.groups
736
- ), y = (S) => S.replace(/(,|;)$/, "");
737
- if (t.type === "TSPropertySignature")
738
- t.key.type === "Identifier" ? { name: e } = t.key : t.key.type === "Literal" ? e = `${t.key.value}` : e = a.text.slice(
739
- t.range.at(0),
740
- (p = t.typeAnnotation) == null ? void 0 : p.range.at(0)
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)
741
753
  );
742
- else if (t.type === "TSIndexSignature") {
743
- let S = ((h = t.typeAnnotation) == null ? void 0 : h.range.at(0)) ?? t.range.at(1);
744
- e = y(a.text.slice(t.range.at(0), S));
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));
745
757
  } else
746
- e = y(
747
- a.text.slice(t.range.at(0), t.range.at(1))
758
+ e = m(
759
+ o.text.slice(r.range.at(0), r.range.at(1))
748
760
  );
749
- d(n["custom-groups"], e), t.loc.start.line !== t.loc.end.line && c("multiline");
750
- let g = o.endsWith(";") || o.endsWith(",") ? 1 : 0;
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;
751
763
  return {
752
- size: w(t.range) - g,
753
- group: r(),
754
- node: t,
764
+ size: w(r.range) - p,
765
+ group: n(),
766
+ node: r,
755
767
  name: e
756
768
  };
757
769
  });
758
- C(u, (t, e) => {
759
- let o = x(n.groups, t), r = x(n.groups, e);
760
- (o > r || o === r && j(I(t, e, n))) && s.report({
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({
761
773
  messageId: "unexpectedObjectTypesOrder",
762
774
  data: {
763
- left: O(t.name),
764
- right: O(e.name)
775
+ left: I(r.name),
776
+ right: I(e.name)
765
777
  },
766
778
  node: e.node,
767
779
  fix: (c) => {
768
780
  let d = {};
769
- for (let m of u) {
770
- let g = x(n.groups, m);
771
- g in d ? d[g] = N(
772
- [...d[g], m],
773
- n
774
- ) : d[g] = [m];
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];
775
787
  }
776
- let y = [];
777
- for (let m of Object.keys(d).sort())
778
- y.push(...N(d[m], n));
779
- return P(c, u, y, a);
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);
780
792
  }
781
793
  });
782
794
  });
783
795
  }
784
796
  }
785
797
  })
786
- }), H = "sort-union-types", he = v({
798
+ }), H = "sort-union-types", he = O({
787
799
  name: H,
788
800
  meta: {
789
801
  type: "suggestion",
@@ -831,45 +843,45 @@ const J = "sort-array-includes", de = v({
831
843
  order: f.asc
832
844
  }
833
845
  ],
834
- create: (s) => ({
846
+ create: (a) => ({
835
847
  TSUnionType: (l) => {
836
- let n = s.getSourceCode(), a = k(s.options.at(0), {
848
+ let s = a.getSourceCode(), o = j(a.options.at(0), {
837
849
  type: i.alphabetical,
838
850
  "nullable-last": !1,
839
851
  "ignore-case": !1,
840
852
  order: f.asc
841
- }), u = l.types.map((t) => ({
842
- group: t.type === "TSNullKeyword" || t.type === "TSUndefinedKeyword" ? "nullable" : "unknown",
843
- name: n.text.slice(...t.range),
844
- size: w(t.range),
845
- node: t
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
846
858
  }));
847
- C(u, (t, e) => {
848
- let o = j(I(t, e, a));
849
- a["nullable-last"] && (t.group === "nullable" && e.group === "unknown" ? o = !0 : t.group === "unknown" && e.group === "nullable" && (o = !1)), o && s.report({
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({
850
862
  messageId: "unexpectedUnionTypesOrder",
851
863
  data: {
852
- left: O(t.name),
853
- right: O(e.name)
864
+ left: I(r.name),
865
+ right: I(e.name)
854
866
  },
855
867
  node: e.node,
856
- fix: (r) => {
868
+ fix: (n) => {
857
869
  let c = [];
858
- if (a["nullable-last"]) {
859
- let d = [], y = u.filter((m) => m.group === "nullable" ? (d.push(m), !1) : !0);
870
+ if (o["nullable-last"]) {
871
+ let d = [], m = u.filter((g) => g.group === "nullable" ? (d.push(g), !1) : !0);
860
872
  c = [
861
- ...N(y, a),
862
- ...N(d, a)
873
+ ...S(m, o),
874
+ ...S(d, o)
863
875
  ];
864
876
  } else
865
- c = N(u, a);
866
- return P(r, u, c, n);
877
+ c = S(u, o);
878
+ return C(n, u, c, s);
867
879
  }
868
880
  });
869
881
  });
870
882
  }
871
883
  })
872
- }), Q = "sort-interfaces", be = v({
884
+ }), Q = "sort-interfaces", be = O({
873
885
  name: Q,
874
886
  meta: {
875
887
  type: "suggestion",
@@ -926,10 +938,10 @@ const J = "sort-array-includes", de = v({
926
938
  order: f.asc
927
939
  }
928
940
  ],
929
- create: (s) => ({
941
+ create: (a) => ({
930
942
  TSInterfaceDeclaration: (l) => {
931
943
  if (l.body.body.length > 1) {
932
- let n = k(s.options.at(0), {
944
+ let s = j(a.options.at(0), {
933
945
  type: i.alphabetical,
934
946
  "ignore-case": !1,
935
947
  order: f.asc,
@@ -937,65 +949,67 @@ const J = "sort-array-includes", de = v({
937
949
  "custom-groups": {},
938
950
  groups: []
939
951
  });
940
- if (!n["ignore-pattern"].some(
941
- (a) => $(l.id.name, a)
952
+ if (!s["ignore-pattern"].some(
953
+ (o) => M(l.id.name, o, {
954
+ nocomment: !0
955
+ })
942
956
  )) {
943
- let a = s.getSourceCode(), u = l.body.body.reduce(
944
- (t, e) => {
945
- var y, m, g;
957
+ let o = a.getSourceCode(), u = l.body.body.reduce(
958
+ (r, e) => {
959
+ var m, g, p;
946
960
  if (e.type === "TSCallSignatureDeclaration")
947
- return t.push([]), t;
948
- let o, { getGroup: r, defineGroup: c, setCustomGroups: d } = G(
949
- n.groups
961
+ return r.push([]), r;
962
+ let t, { getGroup: n, defineGroup: c, setCustomGroups: d } = R(
963
+ s.groups
950
964
  );
951
965
  if (e.type === "TSPropertySignature")
952
966
  if (e.key.type === "Identifier")
953
- ({ name: o } = e.key);
967
+ ({ name: t } = e.key);
954
968
  else if (e.key.type === "Literal")
955
- o = `${e.key.value}`;
969
+ t = `${e.key.value}`;
956
970
  else {
957
- let p = ((y = e.typeAnnotation) == null ? void 0 : y.range.at(0)) ?? e.range.at(1) - (e.optional ? 1 : 0);
958
- o = a.text.slice(e.range.at(0), p);
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);
959
973
  }
960
974
  else if (e.type === "TSIndexSignature") {
961
- let p = ((m = e.typeAnnotation) == null ? void 0 : m.range.at(0)) ?? e.range.at(1);
962
- o = a.text.slice(e.range.at(0), p);
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);
963
977
  } else {
964
- let p = ((g = e.returnType) == null ? void 0 : g.range.at(0)) ?? e.range.at(1);
965
- o = a.text.slice(e.range.at(0), p);
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);
966
980
  }
967
- return d(n["custom-groups"], o), e.loc.start.line !== e.loc.end.line && c("multiline"), t.at(-1).push({
981
+ return d(s["custom-groups"], t), e.loc.start.line !== e.loc.end.line && c("multiline"), r.at(-1).push({
968
982
  size: w(e.range),
969
- group: r(),
983
+ group: n(),
970
984
  node: e,
971
- name: o
972
- }), t;
985
+ name: t
986
+ }), r;
973
987
  },
974
988
  [[]]
975
989
  );
976
- for (let t of u)
977
- C(t, (e, o) => {
978
- let r = x(n.groups, e), c = x(n.groups, o);
979
- (r > c || r === c && j(I(e, o, n))) && s.report({
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({
980
994
  messageId: "unexpectedInterfacePropertiesOrder",
981
995
  data: {
982
- left: O(e.name),
983
- right: O(o.name)
996
+ left: I(e.name),
997
+ right: I(t.name)
984
998
  },
985
- node: o.node,
999
+ node: t.node,
986
1000
  fix: (d) => {
987
- let y = {};
988
- for (let g of t) {
989
- let p = x(n.groups, g);
990
- p in y ? y[p] = N(
991
- [...y[p], g],
992
- n
993
- ) : y[p] = [g];
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];
994
1008
  }
995
- let m = [];
996
- for (let g of Object.keys(y).sort())
997
- m.push(...N(y[g], n));
998
- return P(d, t, m, a);
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);
999
1013
  }
1000
1014
  });
1001
1015
  });
@@ -1003,7 +1017,7 @@ const J = "sort-array-includes", de = v({
1003
1017
  }
1004
1018
  }
1005
1019
  })
1006
- }), Y = "sort-jsx-props", xe = v({
1020
+ }), Y = "sort-jsx-props", xe = O({
1007
1021
  name: Y,
1008
1022
  meta: {
1009
1023
  type: "suggestion",
@@ -1053,65 +1067,65 @@ const J = "sort-array-includes", de = v({
1053
1067
  order: f.asc
1054
1068
  }
1055
1069
  ],
1056
- create: (s) => [".svelte", ".astro", ".vue"].includes(
1057
- U.extname(s.getFilename())
1070
+ create: (a) => [".svelte", ".astro", ".vue"].includes(
1071
+ U.extname(a.getFilename())
1058
1072
  ) ? {} : {
1059
1073
  JSXElement: (l) => {
1060
1074
  if (l.openingElement.attributes.length > 1) {
1061
- let n = k(s.options.at(0), {
1075
+ let s = j(a.options.at(0), {
1062
1076
  type: i.alphabetical,
1063
1077
  "ignore-case": !1,
1064
1078
  order: f.asc,
1065
1079
  "custom-groups": {},
1066
1080
  groups: []
1067
- }), a = s.getSourceCode(), u = l.openingElement.attributes.reduce(
1068
- (t, e) => {
1081
+ }), o = a.getSourceCode(), u = l.openingElement.attributes.reduce(
1082
+ (r, e) => {
1069
1083
  if (e.type === "JSXSpreadAttribute")
1070
- return t.push([]), t;
1071
- let o = e.name.type === "JSXNamespacedName" ? `${e.name.namespace.name}:${e.name.name.name}` : e.name.name, { getGroup: r, defineGroup: c, setCustomGroups: d } = G(
1072
- n.groups
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
1073
1087
  );
1074
- d(n["custom-groups"], o), e.value === null && c("shorthand"), e.loc.start.line !== e.loc.end.line && c("multiline");
1075
- let y = {
1088
+ d(s["custom-groups"], t), e.value === null && c("shorthand"), e.loc.start.line !== e.loc.end.line && c("multiline");
1089
+ let m = {
1076
1090
  size: w(e.range),
1077
- group: r(),
1091
+ group: n(),
1078
1092
  node: e,
1079
- name: o
1093
+ name: t
1080
1094
  };
1081
- return t.at(-1).push(y), t;
1095
+ return r.at(-1).push(m), r;
1082
1096
  },
1083
1097
  [[]]
1084
1098
  );
1085
- for (let t of u)
1086
- C(t, (e, o) => {
1087
- let r = x(n.groups, e), c = x(n.groups, o);
1088
- (r > c || r === c && j(I(e, o, n))) && s.report({
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({
1089
1103
  messageId: "unexpectedJSXPropsOrder",
1090
1104
  data: {
1091
1105
  left: e.name,
1092
- right: o.name
1106
+ right: t.name
1093
1107
  },
1094
- node: o.node,
1108
+ node: t.node,
1095
1109
  fix: (d) => {
1096
- let y = {};
1097
- for (let g of t) {
1098
- let p = x(n.groups, g);
1099
- p in y ? y[p] = N(
1100
- [...y[p], g],
1101
- n
1102
- ) : y[p] = [g];
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];
1103
1117
  }
1104
- let m = [];
1105
- for (let g of Object.keys(y).sort())
1106
- m.push(...N(y[g], n));
1107
- return P(d, t, m, a);
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);
1108
1122
  }
1109
1123
  });
1110
1124
  });
1111
1125
  }
1112
1126
  }
1113
1127
  }
1114
- }), Z = "sort-exports", Ee = v({
1128
+ }), Z = "sort-exports", Ee = O({
1115
1129
  name: Z,
1116
1130
  meta: {
1117
1131
  type: "suggestion",
@@ -1155,41 +1169,41 @@ const J = "sort-array-includes", de = v({
1155
1169
  order: f.asc
1156
1170
  }
1157
1171
  ],
1158
- create: (s) => {
1159
- let l = k(s.options.at(0), {
1172
+ create: (a) => {
1173
+ let l = j(a.options.at(0), {
1160
1174
  type: i.alphabetical,
1161
1175
  order: f.asc,
1162
1176
  "ignore-case": !1
1163
- }), n = [[]], a = (u) => {
1164
- u.type === "ExportAllDeclaration" && u.exported === null ? n.push([]) : n.at(-1).push({
1177
+ }), s = [[]], o = (u) => {
1178
+ u.type === "ExportAllDeclaration" && u.exported === null ? s.push([]) : s.at(-1).push({
1165
1179
  size: w(u.range),
1166
1180
  name: u.source.value,
1167
1181
  node: u
1168
1182
  });
1169
1183
  };
1170
1184
  return {
1171
- ExportAllDeclaration: a,
1185
+ ExportAllDeclaration: o,
1172
1186
  ExportNamedDeclaration: (u) => {
1173
- u.source !== null && a(u);
1187
+ u.source !== null && o(u);
1174
1188
  },
1175
1189
  "Program:exit": () => {
1176
- let u = s.getSourceCode();
1177
- for (let t of n)
1178
- C(t, (e, o) => {
1179
- j(I(e, o, l)) && s.report({
1190
+ let u = a.getSourceCode();
1191
+ for (let r of s)
1192
+ k(r, (e, t) => {
1193
+ v(A(e, t, l)) && a.report({
1180
1194
  messageId: "unexpectedExportsOrder",
1181
1195
  data: {
1182
1196
  left: e.name,
1183
- right: o.name
1197
+ right: t.name
1184
1198
  },
1185
- node: o.node,
1186
- fix: (r) => P(r, t, N(t, l), u)
1199
+ node: t.node,
1200
+ fix: (n) => C(n, r, S(r, l), u)
1187
1201
  });
1188
1202
  });
1189
1203
  }
1190
1204
  };
1191
1205
  }
1192
- }), ee = "sort-imports", Se = v({
1206
+ }), ee = "sort-imports", Se = O({
1193
1207
  name: ee,
1194
1208
  meta: {
1195
1209
  type: "suggestion",
@@ -1267,8 +1281,8 @@ const J = "sort-array-includes", de = v({
1267
1281
  order: f.asc
1268
1282
  }
1269
1283
  ],
1270
- create: (s) => {
1271
- let l = k(s.options.at(0), {
1284
+ create: (a) => {
1285
+ let l = j(a.options.at(0), {
1272
1286
  "newlines-between": "always",
1273
1287
  "custom-groups": { type: {}, value: {} },
1274
1288
  "internal-pattern": ["~/**"],
@@ -1276,10 +1290,10 @@ const J = "sort-array-includes", de = v({
1276
1290
  order: f.asc,
1277
1291
  "ignore-case": !1,
1278
1292
  groups: []
1279
- }), n = [], a = s.getSourceCode(), u = [], t = (r) => r.type === "ImportDeclaration" && r.specifiers.length === 0, e = (r) => {
1280
- let c = (b) => [".less", ".scss", ".sass", ".styl", ".pcss", ".css", ".sss"].some(
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(
1281
1295
  (E) => b.endsWith(E)
1282
- ), d = (b) => [
1296
+ ), c = (b) => [
1283
1297
  "./index.d.js",
1284
1298
  "./index.d.ts",
1285
1299
  "./index.js",
@@ -1287,82 +1301,99 @@ const J = "sort-array-includes", de = v({
1287
1301
  "./index",
1288
1302
  "./",
1289
1303
  "."
1290
- ].includes(b), y = (b) => b.indexOf("..") === 0, m = (b) => b.indexOf("./") === 0, { getGroup: g, defineGroup: p, setCustomGroups: h } = G(l.groups), S = (b) => l["internal-pattern"].length && l["internal-pattern"].some(
1291
- (E) => $(b.source.value, E)
1292
- ) || n.some((E) => $(b.source.value, E)), A = (b) => oe.includes(b) || oe.includes(`node:${b}`);
1293
- return r.importKind === "type" && (r.type === "ImportDeclaration" && (h(l["custom-groups"].type, r.source.value), A(r.source.value) && p("builtin-type"), S(r) && p("internal-type"), d(r.source.value) && p("index-type"), y(r.source.value) && p("parent-type"), m(r.source.value) && p("sibling-type")), p("external-type"), p("type")), r.type === "ImportDeclaration" && (h(l["custom-groups"].value, r.source.value), A(r.source.value) && p("builtin"), S(r) && p("internal"), c(r.source.value) && p("style"), t(r) && p("side-effect"), d(r.source.value) && p("index"), y(r.source.value) && p("parent"), m(r.source.value) && p("sibling"), p("external")), g();
1294
- }, o = (r) => {
1295
- let c;
1296
- r.type === "ImportDeclaration" ? c = r.source.value : r.moduleReference.type === "TSExternalModuleReference" && r.moduleReference.expression.type === "Literal" ? c = `${r.moduleReference.expression.value}` : c = a.text.slice(...r.moduleReference.range), u.push({
1297
- size: w(r.range),
1298
- group: e(r),
1299
- name: c,
1300
- node: r
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, {
1306
+ nocomment: !0
1307
+ })
1308
+ ), N = (b) => {
1309
+ let E = [
1310
+ "bun",
1311
+ "bun:ffi",
1312
+ "bun:jsc",
1313
+ "bun:sqlite",
1314
+ "bun:test",
1315
+ "bun:wrap",
1316
+ "detect-libc",
1317
+ "undici",
1318
+ "ws"
1319
+ ];
1320
+ return ie.includes(
1321
+ 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
1301
1332
  });
1302
1333
  };
1303
1334
  return {
1304
- TSImportEqualsDeclaration: o,
1305
- ImportDeclaration: o,
1335
+ TSImportEqualsDeclaration: e,
1336
+ ImportDeclaration: e,
1306
1337
  "Program:exit": () => {
1307
1338
  var m;
1308
- let r = (g, p) => !!a.getTokensBetween(
1339
+ let t = (g, p) => !!s.getTokensBetween(
1309
1340
  g.node,
1310
- _(p.node, a) || p.node,
1341
+ _(p.node, s) || p.node,
1311
1342
  {
1312
1343
  includeComments: !0
1313
1344
  }
1314
- ).length, c = (g, p) => a.lines.slice(
1345
+ ).length, n = (g, p) => s.lines.slice(
1315
1346
  g.node.loc.end.line,
1316
1347
  p.node.loc.start.line - 1
1317
- ).filter((S) => !S.trim().length).length, d = (g, p) => {
1318
- let h = [], S = {};
1348
+ ).filter((h) => !h.trim().length).length, c = (g, p) => {
1349
+ let y = [], h = {};
1319
1350
  for (let b of p) {
1320
1351
  let E = x(l.groups, b);
1321
- E in S ? S[E] = N(
1322
- [...S[E], b],
1352
+ E in h ? h[E] = S(
1353
+ [...h[E], b],
1323
1354
  l
1324
- ) : S[E] = [b];
1355
+ ) : h[E] = [b];
1325
1356
  }
1326
- let A = Object.keys(S).sort().reduce(
1357
+ let N = Object.keys(h).sort().reduce(
1327
1358
  (b, E) => [
1328
1359
  ...b,
1329
- ...S[E]
1360
+ ...h[E]
1330
1361
  ],
1331
1362
  []
1332
1363
  );
1333
- for (let b = 0, E = A.length; b < E; b++) {
1334
- let M = A.at(b);
1335
- if (h.push(
1364
+ for (let b = 0, E = N.length; b < E; b++) {
1365
+ let L = N.at(b);
1366
+ if (y.push(
1336
1367
  g.replaceTextRange(
1337
- L(p.at(b).node, a),
1338
- a.text.slice(...L(M.node, a))
1368
+ T(p.at(b).node, s),
1369
+ s.text.slice(...T(L.node, s))
1339
1370
  )
1340
1371
  ), l["newlines-between"] !== "ignore") {
1341
- let T = A.at(b + 1);
1342
- if (T) {
1343
- let R = c(
1372
+ let G = N.at(b + 1);
1373
+ if (G) {
1374
+ let P = n(
1344
1375
  p.at(b),
1345
1376
  p.at(b + 1)
1346
1377
  );
1347
- (l["newlines-between"] === "always" && x(l.groups, M) === x(l.groups, T) && R !== 0 || l["newlines-between"] === "never" && R > 0) && h.push(
1378
+ (l["newlines-between"] === "always" && x(l.groups, L) === x(l.groups, G) && P !== 0 || l["newlines-between"] === "never" && P > 0) && y.push(
1348
1379
  g.removeRange([
1349
- L(p.at(b).node, a).at(1),
1350
- L(p.at(b + 1).node, a).at(0) - 1
1380
+ T(p.at(b).node, s).at(1),
1381
+ T(p.at(b + 1).node, s).at(0) - 1
1351
1382
  ])
1352
- ), l["newlines-between"] === "always" && x(l.groups, M) !== x(l.groups, T) && R > 1 && h.push(
1383
+ ), l["newlines-between"] === "always" && x(l.groups, L) !== x(l.groups, G) && P > 1 && y.push(
1353
1384
  g.replaceTextRange(
1354
1385
  [
1355
- L(p.at(b).node, a).at(1),
1356
- L(p.at(b + 1).node, a).at(
1386
+ T(p.at(b).node, s).at(1),
1387
+ T(p.at(b + 1).node, s).at(
1357
1388
  0
1358
1389
  ) - 1
1359
1390
  ],
1360
1391
  `
1361
1392
  `
1362
1393
  )
1363
- ), l["newlines-between"] === "always" && x(l.groups, M) !== x(l.groups, T) && R === 0 && h.push(
1394
+ ), l["newlines-between"] === "always" && x(l.groups, L) !== x(l.groups, G) && P === 0 && y.push(
1364
1395
  g.insertTextAfterRange(
1365
- L(p.at(b).node, a),
1396
+ T(p.at(b).node, s),
1366
1397
  `
1367
1398
  `
1368
1399
  )
@@ -1370,53 +1401,53 @@ const J = "sort-array-includes", de = v({
1370
1401
  }
1371
1402
  }
1372
1403
  }
1373
- return h;
1374
- }, y = [[]];
1375
- for (let g of u) {
1376
- let p = (m = y.at(-1)) == null ? void 0 : m.at(-1);
1377
- p && r(p, g) ? y.push([g]) : y.at(-1).push(g);
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);
1378
1409
  }
1379
- for (let g of y)
1380
- C(g, (p, h) => {
1381
- let S = x(l.groups, p), A = x(l.groups, h), b = c(p, h);
1382
- !(t(p.node) && t(h.node)) && !r(p, h) && (S > A || S === A && j(I(p, h, l))) && s.report({
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({
1383
1414
  messageId: "unexpectedImportsOrder",
1384
1415
  data: {
1385
1416
  left: p.name,
1386
- right: h.name
1417
+ right: y.name
1387
1418
  },
1388
- node: h.node,
1389
- fix: (E) => d(E, g)
1390
- }), l["newlines-between"] === "never" && b > 0 && s.report({
1419
+ node: y.node,
1420
+ fix: (E) => c(E, g)
1421
+ }), l["newlines-between"] === "never" && b > 0 && a.report({
1391
1422
  messageId: "extraSpacingBetweenImports",
1392
1423
  data: {
1393
1424
  left: p.name,
1394
- right: h.name
1425
+ right: y.name
1395
1426
  },
1396
- node: h.node,
1397
- fix: (E) => d(E, g)
1398
- }), l["newlines-between"] === "always" && (S < A && b === 0 ? s.report({
1427
+ node: y.node,
1428
+ fix: (E) => c(E, g)
1429
+ }), l["newlines-between"] === "always" && (h < N && b === 0 ? a.report({
1399
1430
  messageId: "missedSpacingBetweenImports",
1400
1431
  data: {
1401
1432
  left: p.name,
1402
- right: h.name
1433
+ right: y.name
1403
1434
  },
1404
- node: h.node,
1405
- fix: (E) => d(E, g)
1406
- }) : (b > 1 || S === A && b > 0) && s.report({
1435
+ node: y.node,
1436
+ fix: (E) => c(E, g)
1437
+ }) : (b > 1 || h === N && b > 0) && a.report({
1407
1438
  messageId: "extraSpacingBetweenImports",
1408
1439
  data: {
1409
1440
  left: p.name,
1410
- right: h.name
1441
+ right: y.name
1411
1442
  },
1412
- node: h.node,
1413
- fix: (E) => d(E, g)
1443
+ node: y.node,
1444
+ fix: (E) => c(E, g)
1414
1445
  }));
1415
1446
  });
1416
1447
  }
1417
1448
  };
1418
1449
  }
1419
- }), te = "sort-objects", Ne = v({
1450
+ }), te = "sort-objects", Ne = O({
1420
1451
  name: te,
1421
1452
  meta: {
1422
1453
  type: "suggestion",
@@ -1474,10 +1505,10 @@ const J = "sort-array-includes", de = v({
1474
1505
  order: f.asc
1475
1506
  }
1476
1507
  ],
1477
- create: (s) => {
1478
- let l = (n) => {
1479
- if (n.properties.length > 1) {
1480
- let a = k(s.options.at(0), {
1508
+ create: (a) => {
1509
+ let l = (s) => {
1510
+ if (s.properties.length > 1) {
1511
+ let o = j(a.options.at(0), {
1481
1512
  "partition-by-comment": !1,
1482
1513
  type: i.alphabetical,
1483
1514
  "styled-components": !0,
@@ -1485,92 +1516,92 @@ const J = "sort-array-includes", de = v({
1485
1516
  order: f.asc,
1486
1517
  "custom-groups": {},
1487
1518
  groups: []
1488
- }), u = (r) => r.type === "Identifier" && r.name === "styled", t = (r) => r !== void 0 && r.type === "CallExpression" && (r.callee.type === "MemberExpression" && u(r.callee.object) || r.callee.type === "CallExpression" && u(r.callee.callee));
1489
- if (!a["styled-components"] && (t(n.parent) || n.parent.type === "ArrowFunctionExpression" && t(n.parent.parent)))
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)))
1490
1521
  return;
1491
- let e = s.getSourceCode(), o = (r) => r.reduce(
1522
+ let e = a.getSourceCode(), t = (n) => n.reduce(
1492
1523
  (c, d) => {
1493
1524
  if (d.type === "SpreadElement" || d.type === "RestElement")
1494
1525
  return c.push([]), c;
1495
- let y = _(d, e);
1496
- a["partition-by-comment"] && y && ne(
1497
- a["partition-by-comment"],
1498
- y.value
1526
+ let m = _(d, e);
1527
+ o["partition-by-comment"] && m && oe(
1528
+ o["partition-by-comment"],
1529
+ m.value
1499
1530
  ) && c.push([]);
1500
- let m, g = "ignore", p = [], { getGroup: h, setCustomGroups: S } = G(a.groups);
1501
- d.key.type === "Identifier" ? { name: m } = d.key : d.key.type === "Literal" ? m = `${d.key.value}` : m = e.text.slice(...d.key.range), d.value.type === "AssignmentPattern" && ((E) => {
1502
- E.right.type === "Identifier" && p.push(E.right.name);
1503
- let M = (T) => {
1504
- let R = [];
1505
- switch (T.type) {
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) {
1506
1537
  case "ArrowFunctionExpression":
1507
- R.push(T.body);
1538
+ $.push(P.body);
1508
1539
  break;
1509
1540
  case "ConditionalExpression":
1510
- R.push(T.consequent, T.alternate);
1541
+ $.push(P.consequent, P.alternate);
1511
1542
  break;
1512
1543
  case "LogicalExpression":
1513
1544
  case "BinaryExpression":
1514
- R.push(T.left, T.right);
1545
+ $.push(P.left, P.right);
1515
1546
  break;
1516
1547
  case "CallExpression":
1517
- R.push(...T.arguments);
1548
+ $.push(...P.arguments);
1518
1549
  break;
1519
1550
  }
1520
- R.forEach((B) => {
1521
- B.type === "Identifier" && p.push(B.name), (B.type === "BinaryExpression" || B.type === "ConditionalExpression") && M(B);
1551
+ $.forEach((B) => {
1552
+ B.type === "Identifier" && y.push(B.name), (B.type === "BinaryExpression" || B.type === "ConditionalExpression") && G(B);
1522
1553
  });
1523
1554
  };
1524
- switch (E.right.type) {
1555
+ switch (L.right.type) {
1525
1556
  case "ArrowFunctionExpression":
1526
1557
  case "ConditionalExpression":
1527
1558
  case "LogicalExpression":
1528
1559
  case "BinaryExpression":
1529
1560
  case "CallExpression":
1530
- M(E.right);
1561
+ G(L.right);
1531
1562
  break;
1532
1563
  }
1533
- })(d.value), S(a["custom-groups"], m);
1534
- let A = {
1564
+ })(d.value), N(o["custom-groups"], g);
1565
+ let b = {
1535
1566
  size: w(d.range),
1536
1567
  group: h(),
1537
- dependencies: p,
1568
+ dependencies: y,
1538
1569
  node: d,
1539
- position: g,
1540
- name: m
1570
+ position: p,
1571
+ name: g
1541
1572
  };
1542
- return c.at(-1).push(A), c;
1573
+ return c.at(-1).push(b), c;
1543
1574
  },
1544
1575
  [[]]
1545
1576
  );
1546
- for (let r of o(n.properties))
1547
- C(r, (c, d) => {
1548
- let y = x(a.groups, c), m = x(a.groups, d);
1549
- if (y > m || y === m && j(I(c, d, a))) {
1550
- let g = (p) => {
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) => {
1551
1582
  let h = {};
1552
- for (let A of r) {
1553
- let b = x(a.groups, A);
1554
- b in h ? h[b] = N(
1555
- [...h[b], A],
1556
- a
1557
- ) : h[b] = [A];
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];
1558
1589
  }
1559
- let S = [];
1560
- for (let A of Object.keys(h).sort())
1561
- S.push(...N(h[A], a));
1562
- return P(p, r, S, e, {
1563
- partitionComment: a["partition-by-comment"]
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"]
1564
1595
  });
1565
1596
  };
1566
- s.report({
1597
+ a.report({
1567
1598
  messageId: "unexpectedObjectsOrder",
1568
1599
  data: {
1569
- left: O(c.name),
1570
- right: O(d.name)
1600
+ left: I(c.name),
1601
+ right: I(d.name)
1571
1602
  },
1572
1603
  node: d.node,
1573
- fix: g
1604
+ fix: p
1574
1605
  });
1575
1606
  }
1576
1607
  });
@@ -1581,7 +1612,7 @@ const J = "sort-array-includes", de = v({
1581
1612
  ObjectPattern: l
1582
1613
  };
1583
1614
  }
1584
- }), re = "sort-classes", Ae = v({
1615
+ }), re = "sort-classes", Ae = O({
1585
1616
  name: re,
1586
1617
  meta: {
1587
1618
  type: "suggestion",
@@ -1629,61 +1660,67 @@ const J = "sort-array-includes", de = v({
1629
1660
  order: f.asc
1630
1661
  }
1631
1662
  ],
1632
- create: (s) => ({
1663
+ create: (a) => ({
1633
1664
  ClassBody: (l) => {
1634
1665
  if (l.body.length > 1) {
1635
- let n = k(s.options.at(0), {
1666
+ let s = j(a.options.at(0), {
1636
1667
  type: i.alphabetical,
1637
1668
  order: f.asc,
1638
1669
  "ignore-case": !1,
1639
1670
  groups: ["property", "constructor", "method", "unknown"]
1640
- }), a = s.getSourceCode(), u = l.body.map((t) => {
1671
+ }), o = a.getSourceCode(), u = l.body.map((r) => {
1641
1672
  var d;
1642
- let e, { getGroup: o, defineGroup: r } = G(n.groups);
1643
- t.type === "StaticBlock" ? e = "static" : t.type === "TSIndexSignature" ? e = a.text.slice(
1644
- t.range.at(0),
1645
- ((d = t.typeAnnotation) == null ? void 0 : d.range.at(0)) ?? t.range.at(1)
1646
- ) : t.key.type === "Identifier" ? { name: e } = t.key : e = a.text.slice(...t.key.range);
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);
1647
1678
  let c = e.startsWith("_") || e.startsWith("#");
1648
- return t.type === "MethodDefinition" ? (t.kind === "constructor" && r("constructor"), (t.accessibility === "private" || c) && r("private-method"), t.static && r("static-method"), t.kind === "get" && r("get-method"), t.kind === "set" && r("set-method"), r("method")) : t.type === "TSIndexSignature" ? r("index-signature") : t.type === "PropertyDefinition" && ((t.accessibility === "private" || c) && r("private-property"), t.static && r("static-property"), r("property")), {
1649
- size: w(t.range),
1650
- group: o(),
1651
- node: t,
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");
1683
+ } 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"));
1685
+ return {
1686
+ size: w(r.range),
1687
+ group: t(),
1688
+ node: r,
1652
1689
  name: e
1653
1690
  };
1654
1691
  });
1655
- C(u, (t, e) => {
1656
- let o = x(n.groups, t), r = x(n.groups, e);
1657
- t.name !== e.name && (o > r || o === r && j(I(t, e, n))) && s.report({
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({
1658
1695
  messageId: "unexpectedClassesOrder",
1659
1696
  data: {
1660
- left: O(t.name),
1661
- right: O(e.name)
1697
+ left: I(r.name),
1698
+ right: I(e.name)
1662
1699
  },
1663
1700
  node: e.node,
1664
1701
  fix: (c) => {
1665
- let d = [], y = u.reduce(
1666
- (g, p) => {
1667
- let h = x(n.groups, p);
1668
- return h in g ? g[h] = N(
1669
- [...g[h], p],
1670
- n
1671
- ) : g[h] = [p], g;
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;
1672
1709
  },
1673
1710
  {}
1674
- ), m = Object.keys(y).sort().reduce(
1675
- (g, p) => [
1676
- ...g,
1677
- ...y[p]
1711
+ ), g = Object.keys(m).sort().reduce(
1712
+ (p, y) => [
1713
+ ...p,
1714
+ ...m[y]
1678
1715
  ],
1679
1716
  []
1680
1717
  );
1681
- for (let g = 0, p = m.length; g < p; g++)
1718
+ for (let p = 0, y = g.length; p < y; p++)
1682
1719
  d.push(
1683
1720
  c.replaceTextRange(
1684
- L(u.at(g).node, a),
1685
- a.text.slice(
1686
- ...L(m.at(g).node, a)
1721
+ T(u.at(p).node, o),
1722
+ o.text.slice(
1723
+ ...T(g.at(p).node, o)
1687
1724
  )
1688
1725
  )
1689
1726
  );
@@ -1694,7 +1731,7 @@ const J = "sort-array-includes", de = v({
1694
1731
  }
1695
1732
  }
1696
1733
  })
1697
- }), se = "sort-enums", Ie = v({
1734
+ }), se = "sort-enums", Ie = O({
1698
1735
  name: se,
1699
1736
  meta: {
1700
1737
  type: "suggestion",
@@ -1738,33 +1775,33 @@ const J = "sort-array-includes", de = v({
1738
1775
  order: f.asc
1739
1776
  }
1740
1777
  ],
1741
- create: (s) => ({
1778
+ create: (a) => ({
1742
1779
  TSEnumDeclaration: (l) => {
1743
- if (l.members.length > 1 && l.members.every(({ initializer: n }) => n)) {
1744
- let n = k(s.options.at(0), {
1780
+ if (l.members.length > 1 && l.members.every(({ initializer: s }) => s)) {
1781
+ let s = j(a.options.at(0), {
1745
1782
  type: i.alphabetical,
1746
1783
  order: f.asc,
1747
1784
  "ignore-case": !1
1748
- }), a = s.getSourceCode(), u = l.members.map((t) => ({
1749
- name: t.id.type === "Literal" ? `${t.id.value}` : `${a.text.slice(...t.id.range)}`,
1750
- size: w(t.range),
1751
- node: t
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
1752
1789
  }));
1753
- C(u, (t, e) => {
1754
- j(I(t, e, n)) && s.report({
1790
+ k(u, (r, e) => {
1791
+ v(A(r, e, s)) && a.report({
1755
1792
  messageId: "unexpectedEnumsOrder",
1756
1793
  data: {
1757
- left: O(t.name),
1758
- right: O(e.name)
1794
+ left: I(r.name),
1795
+ right: I(e.name)
1759
1796
  },
1760
1797
  node: e.node,
1761
- fix: (o) => P(o, u, N(u, n), a)
1798
+ fix: (t) => C(t, u, S(u, s), o)
1762
1799
  });
1763
1800
  });
1764
1801
  }
1765
1802
  }
1766
1803
  })
1767
- }), ae = "sort-maps", Oe = v({
1804
+ }), ae = "sort-maps", Oe = O({
1768
1805
  name: ae,
1769
1806
  meta: {
1770
1807
  type: "suggestion",
@@ -1808,42 +1845,42 @@ const J = "sort-array-includes", de = v({
1808
1845
  order: f.asc
1809
1846
  }
1810
1847
  ],
1811
- create: (s) => ({
1848
+ create: (a) => ({
1812
1849
  NewExpression: (l) => {
1813
1850
  if (l.callee.type === "Identifier" && l.callee.name === "Map" && l.arguments.length && l.arguments[0].type === "ArrayExpression") {
1814
- let [{ elements: n }] = l.arguments;
1815
- if (n.length > 1) {
1816
- let a = k(s.options.at(0), {
1851
+ let [{ elements: s }] = l.arguments;
1852
+ if (s.length > 1) {
1853
+ let o = j(a.options.at(0), {
1817
1854
  type: i.alphabetical,
1818
1855
  "ignore-case": !1,
1819
1856
  order: f.asc
1820
- }), u = s.getSourceCode(), t = n.reduce(
1821
- (e, o) => (o === null || o.type === "SpreadElement" ? e.push([]) : e.at(-1).push(o), e),
1857
+ }), u = a.getSourceCode(), r = s.reduce(
1858
+ (e, t) => (t === null || t.type === "SpreadElement" ? e.push([]) : e.at(-1).push(t), e),
1822
1859
  [[]]
1823
1860
  );
1824
- for (let e of t) {
1825
- let o = e.map((r) => {
1861
+ for (let e of r) {
1862
+ let t = e.map((n) => {
1826
1863
  let c;
1827
- if (r.type === "ArrayExpression") {
1828
- let [d] = r.elements;
1864
+ if (n.type === "ArrayExpression") {
1865
+ let [d] = n.elements;
1829
1866
  d ? d.type === "Literal" ? c = d.raw : c = u.text.slice(...d.range) : c = `${d}`;
1830
1867
  } else
1831
- c = u.text.slice(...r.range);
1868
+ c = u.text.slice(...n.range);
1832
1869
  return {
1833
- size: w(r.range),
1834
- node: r,
1870
+ size: w(n.range),
1871
+ node: n,
1835
1872
  name: c
1836
1873
  };
1837
1874
  });
1838
- C(o, (r, c) => {
1839
- j(I(r, c, a)) && s.report({
1875
+ k(t, (n, c) => {
1876
+ v(A(n, c, o)) && a.report({
1840
1877
  messageId: "unexpectedMapElementsOrder",
1841
1878
  data: {
1842
- left: O(r.name),
1843
- right: O(c.name)
1879
+ left: I(n.name),
1880
+ right: I(c.name)
1844
1881
  },
1845
1882
  node: c.node,
1846
- fix: (d) => P(d, o, N(o, a), u)
1883
+ fix: (d) => C(d, t, S(t, o), u)
1847
1884
  });
1848
1885
  });
1849
1886
  }
@@ -1851,8 +1888,8 @@ const J = "sort-array-includes", de = v({
1851
1888
  }
1852
1889
  }
1853
1890
  })
1854
- }), ve = "eslint-plugin-perfectionist";
1855
- let z = (s) => {
1891
+ }), we = "eslint-plugin-perfectionist";
1892
+ let z = (a) => {
1856
1893
  let l = {
1857
1894
  [ee]: [
1858
1895
  "error",
@@ -1919,9 +1956,9 @@ let z = (s) => {
1919
1956
  };
1920
1957
  return {
1921
1958
  rules: Object.fromEntries(
1922
- Object.entries(l).map(([n, [a, u = {}]]) => [
1923
- `perfectionist/${n}`,
1924
- [a, Object.assign(u, s)]
1959
+ Object.entries(l).map(([s, [o, u = {}]]) => [
1960
+ `perfectionist/${s}`,
1961
+ [o, Object.assign(u, a)]
1925
1962
  ])
1926
1963
  ),
1927
1964
  plugins: ["perfectionist"]
@@ -1962,7 +1999,7 @@ const Te = {
1962
1999
  order: f.desc
1963
2000
  })
1964
2001
  },
1965
- name: ve
2002
+ name: we
1966
2003
  };
1967
2004
  export {
1968
2005
  Te as default