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