eslint-plugin-perfectionist 2.5.0 → 2.7.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,139 +1,139 @@
1
- import _ from "node:path";
2
- import { ESLintUtils as ue, ASTUtils as W } from "@typescript-eslint/utils";
3
- import { minimatch as $ } from "minimatch";
4
- import de from "natural-compare-lite";
5
- import { builtinModules as ce } from "node:module";
6
- let v = ue.RuleCreator(
7
- (t) => `https://eslint-plugin-perfectionist.azat.io/rules/${t}`
8
- ), E = (t, o) => {
9
- for (let s = 0, l = t.length; s < l; s++) {
10
- let r = t[s];
11
- if (o.group === r || Array.isArray(r) && typeof o.group == "string" && r.includes(o.group))
1
+ import W from "node:path";
2
+ import { ESLintUtils as de, ASTUtils as K } from "@typescript-eslint/utils";
3
+ import { minimatch as D } from "minimatch";
4
+ import ce from "natural-compare-lite";
5
+ import { builtinModules as fe } from "node:module";
6
+ let A = de.RuleCreator(
7
+ (e) => `https://eslint-plugin-perfectionist.azat.io/rules/${e}`
8
+ ), h = (e, i) => {
9
+ for (let s = 0, l = e.length; s < l; s++) {
10
+ let r = e[s];
11
+ if (i.group === r || Array.isArray(r) && typeof i.group == "string" && r.includes(i.group))
12
12
  return s;
13
13
  }
14
- return t.length;
15
- }, O = (t) => {
16
- let [o, s] = t;
17
- return s - o;
18
- }, j = (t) => t > 0;
19
- var i = /* @__PURE__ */ ((t) => (t.alphabetical = "alphabetical", t["line-length"] = "line-length", t.natural = "natural", t))(i || {}), c = /* @__PURE__ */ ((t) => (t.desc = "desc", t.asc = "asc", t))(c || {});
20
- let M = (t) => {
21
- let o, s = (r) => {
22
- !o && t.flat().includes(r) && (o = r);
14
+ return e.length;
15
+ }, I = (e) => {
16
+ let [i, s] = e;
17
+ return s - i;
18
+ }, O = (e) => e > 0;
19
+ var u = /* @__PURE__ */ ((e) => (e.alphabetical = "alphabetical", e["line-length"] = "line-length", e.natural = "natural", e))(u || {}), g = /* @__PURE__ */ ((e) => (e.desc = "desc", e.asc = "asc", e))(g || {}), L = /* @__PURE__ */ ((e) => (e["values-first"] = "values-first", e["types-first"] = "types-first", e.mixed = "mixed", e))(L || {});
20
+ let G = (e) => {
21
+ let i, s = (r) => {
22
+ !i && e.flat().includes(r) && (i = r);
23
23
  };
24
24
  return {
25
- getGroup: () => o ?? "unknown",
26
- setCustomGroups: (r, e) => {
25
+ getGroup: () => i ?? "unknown",
26
+ setCustomGroups: (r, t) => {
27
27
  if (r)
28
- for (let [a, p] of Object.entries(r))
29
- Array.isArray(p) && p.some(
30
- (n) => $(e, n, {
28
+ for (let [a, n] of Object.entries(r))
29
+ Array.isArray(n) && n.some(
30
+ (o) => D(t, o, {
31
31
  nocomment: !0
32
32
  })
33
- ) && s(a), typeof p == "string" && $(e, p, {
33
+ ) && s(a), typeof n == "string" && D(t, n, {
34
34
  nocomment: !0
35
35
  }) && s(a);
36
36
  },
37
37
  defineGroup: s
38
38
  };
39
- }, A = (t, o, s) => {
40
- var a, p;
41
- if ((a = o.dependencies) != null && a.includes(t.name))
39
+ }, S = (e, i, s) => {
40
+ var a, n;
41
+ if ((a = i.dependencies) != null && a.includes(e.name))
42
42
  return -1;
43
- if ((p = t.dependencies) != null && p.includes(o.name))
43
+ if ((n = e.dependencies) != null && n.includes(i.name))
44
44
  return 1;
45
- let l = s.order === "asc" ? 1 : -1, r, e = (n) => s["ignore-case"] ? n.toLowerCase() : n;
46
- return s.type === i.alphabetical ? r = (n, u) => e(n.name).localeCompare(e(u.name)) : s.type === i.natural ? r = (n, u) => de(e(n.name), e(u.name)) : r = (n, u) => {
47
- let y = n.size, m = u.size, f = s["max-line-length"];
48
- if (f) {
49
- let d = (g, b) => g > f && b.hasMultipleImportDeclarations;
50
- d(y, n) && (y = n.name.length + 10), d(m, u) && (m = u.name.length + 10);
45
+ let l = s.order === "asc" ? 1 : -1, r, t = (o) => s["ignore-case"] ? o.toLowerCase() : o;
46
+ return s.type === u.alphabetical ? r = (o, p) => t(o.name).localeCompare(t(p.name)) : s.type === u.natural ? r = (o, p) => ce(t(o.name), t(p.name)) : r = (o, p) => {
47
+ let f = o.size, y = p.size, d = s["max-line-length"];
48
+ if (d) {
49
+ let c = (m, x) => m > d && x.hasMultipleImportDeclarations;
50
+ c(f, o) && (f = o.name.length + 10), c(y, p) && (y = p.name.length + 10);
51
51
  }
52
- return y - m;
53
- }, l * r(t, o);
54
- }, w = (t, o) => [...t].sort((s, l) => A(s, l, o)), fe = (t, o) => {
55
- let s = o.getTokenAfter(t, {
52
+ return f - y;
53
+ }, l * r(e, i);
54
+ }, v = (e, i) => [...e].sort((s, l) => S(s, l, i)), ge = (e, i) => {
55
+ let s = i.getTokenAfter(e, {
56
56
  filter: ({ value: l, type: r }) => !(r === "Punctuator" && [",", ";"].includes(l)),
57
57
  includeComments: !0
58
58
  });
59
- return ((s == null ? void 0 : s.type) === "Block" || (s == null ? void 0 : s.type) === "Line") && t.loc.end.line === s.loc.end.line ? s : null;
60
- }, pe = (t, o) => Array.isArray(t) && t.some(
61
- (s) => $(o.trim(), s, {
59
+ return ((s == null ? void 0 : s.type) === "Block" || (s == null ? void 0 : s.type) === "Line") && e.loc.end.line === s.loc.end.line ? s : null;
60
+ }, X = (e, i) => Array.isArray(e) && e.some(
61
+ (s) => D(i.trim(), s, {
62
62
  nocomment: !0
63
63
  })
64
- ) || typeof t == "string" && $(o.trim(), t, {
64
+ ) || typeof e == "string" && D(i.trim(), e, {
65
65
  nocomment: !0
66
- }) || t === !0, J = (t, o) => {
67
- let [s, l] = o.getTokensBefore(t, {
68
- filter: ({ value: r, type: e }) => !(e === "Punctuator" && [",", ";"].includes(r)),
66
+ }) || e === !0, V = (e, i) => {
67
+ let [s, l] = i.getTokensBefore(e, {
68
+ filter: ({ value: r, type: t }) => !(t === "Punctuator" && [",", ";"].includes(r)),
69
69
  includeComments: !0,
70
70
  count: 2
71
71
  });
72
- return ((l == null ? void 0 : l.type) === "Block" || (l == null ? void 0 : l.type) === "Line") && t.loc.start.line - l.loc.end.line <= 1 && (s == null ? void 0 : s.loc.end.line) !== l.loc.start.line ? l : null;
73
- }, T = (t, o, s) => {
74
- var p;
75
- let l = t.range.at(0), r = t.range.at(1), e = o.text.slice(l, r);
76
- if (W.isParenthesized(t, o)) {
77
- let n = o.getTokenBefore(
78
- t,
79
- W.isOpeningParenToken
80
- ), u = o.getTokenAfter(
81
- t,
82
- W.isClosingParenToken
72
+ return ((l == null ? void 0 : l.type) === "Block" || (l == null ? void 0 : l.type) === "Line") && e.loc.start.line - l.loc.end.line <= 1 && (s == null ? void 0 : s.loc.end.line) !== l.loc.start.line ? l : null;
73
+ }, T = (e, i, s) => {
74
+ var n;
75
+ let l = e.range.at(0), r = e.range.at(1), t = i.text.slice(l, r);
76
+ if (K.isParenthesized(e, i)) {
77
+ let o = i.getTokenBefore(
78
+ e,
79
+ K.isOpeningParenToken
80
+ ), p = i.getTokenAfter(
81
+ e,
82
+ K.isClosingParenToken
83
83
  );
84
- l = n.range.at(0), r = u.range.at(1);
84
+ l = o.range.at(0), r = p.range.at(1);
85
85
  }
86
- let a = J(t, o);
87
- if (e.endsWith(";") || e.endsWith(",")) {
88
- let n = o.getTokensAfter(t, {
86
+ let a = V(e, i);
87
+ if (t.endsWith(";") || t.endsWith(",")) {
88
+ let o = i.getTokensAfter(e, {
89
89
  includeComments: !0,
90
90
  count: 2
91
91
  });
92
- t.loc.start.line === ((p = n.at(1)) == null ? void 0 : p.loc.start.line) && (r -= 1);
92
+ e.loc.start.line === ((n = o.at(1)) == null ? void 0 : n.loc.start.line) && (r -= 1);
93
93
  }
94
- return a && !pe(
94
+ return a && !X(
95
95
  (s == null ? void 0 : s.partitionComment) ?? !1,
96
96
  a.value
97
97
  ) && (l = a.range.at(0)), [l, r];
98
- }, L = (t, o, s, l, r) => {
99
- var p, n;
100
- let e = [], a = ((p = o.at(0)) == null ? void 0 : p.node.loc.start.line) === ((n = o.at(-1)) == null ? void 0 : n.node.loc.end.line);
101
- for (let u = 0, y = o.length; u < y; u++) {
102
- let { node: m } = o.at(u);
103
- e.push(
104
- t.replaceTextRange(
105
- T(m, l, r),
98
+ }, M = (e, i, s, l, r) => {
99
+ var n, o;
100
+ let t = [], a = ((n = i.at(0)) == null ? void 0 : n.node.loc.start.line) === ((o = i.at(-1)) == null ? void 0 : o.node.loc.end.line);
101
+ for (let p = 0, f = i.length; p < f; p++) {
102
+ let { node: y } = i.at(p);
103
+ t.push(
104
+ e.replaceTextRange(
105
+ T(y, l, r),
106
106
  l.text.slice(
107
- ...T(s.at(u).node, l, r)
107
+ ...T(s.at(p).node, l, r)
108
108
  )
109
109
  )
110
110
  );
111
- let f = fe(s.at(u).node, l);
112
- if (f && !a) {
113
- let g = [
114
- l.getTokenBefore(f).range.at(1),
115
- f.range.at(1)
111
+ let d = ge(s.at(p).node, l);
112
+ if (d && !a) {
113
+ let m = [
114
+ l.getTokenBefore(d).range.at(1),
115
+ d.range.at(1)
116
116
  ];
117
- e.push(t.replaceTextRange(g, ""));
118
- let b = l.getTokenAfter(m);
119
- e.push(
120
- t.insertTextAfter(
121
- (b == null ? void 0 : b.loc.end.line) === m.loc.end.line ? b : m,
122
- l.text.slice(...g)
117
+ t.push(e.replaceTextRange(m, ""));
118
+ let x = l.getTokenAfter(y);
119
+ t.push(
120
+ e.insertTextAfter(
121
+ (x == null ? void 0 : x.loc.end.line) === y.loc.end.line ? x : y,
122
+ l.text.slice(...m)
123
123
  )
124
124
  );
125
125
  }
126
126
  }
127
- return e;
128
- }, k = (t = {}, o) => Object.assign(o, t), P = (t, o) => {
129
- if (t.length > 1)
130
- for (let s = 1; s < t.length; s++) {
131
- let l = t.at(s - 1), r = t.at(s);
132
- l && r && o(l, r, s - 1);
127
+ return t;
128
+ }, j = (e = {}, i) => Object.assign(i, e), P = (e, i) => {
129
+ if (e.length > 1)
130
+ for (let s = 1; s < e.length; s++) {
131
+ let l = e.at(s - 1), r = e.at(s);
132
+ l && r && i(l, r, s - 1);
133
133
  }
134
134
  };
135
- const X = "sort-svelte-attributes", ge = v({
136
- name: X,
135
+ const q = "sort-svelte-attributes", ye = A({
136
+ name: q,
137
137
  meta: {
138
138
  type: "suggestion",
139
139
  docs: {
@@ -149,16 +149,16 @@ const X = "sort-svelte-attributes", ge = v({
149
149
  },
150
150
  type: {
151
151
  enum: [
152
- i.alphabetical,
153
- i.natural,
154
- i["line-length"]
152
+ u.alphabetical,
153
+ u.natural,
154
+ u["line-length"]
155
155
  ],
156
- default: i.alphabetical,
156
+ default: u.alphabetical,
157
157
  type: "string"
158
158
  },
159
159
  order: {
160
- enum: [c.asc, c.desc],
161
- default: c.asc,
160
+ enum: [g.asc, g.desc],
161
+ default: g.asc,
162
162
  type: "string"
163
163
  },
164
164
  "ignore-case": {
@@ -178,64 +178,64 @@ const X = "sort-svelte-attributes", ge = v({
178
178
  },
179
179
  defaultOptions: [
180
180
  {
181
- type: i.alphabetical,
182
- order: c.asc
181
+ type: u.alphabetical,
182
+ order: g.asc
183
183
  }
184
184
  ],
185
- create: (t) => _.extname(t.filename) !== ".svelte" ? {} : {
186
- SvelteStartTag: (o) => {
187
- if (o.attributes.length > 1) {
188
- let s = k(t.options.at(0), {
189
- type: i.alphabetical,
190
- order: c.asc,
185
+ create: (e) => W.extname(e.filename) !== ".svelte" ? {} : {
186
+ SvelteStartTag: (i) => {
187
+ if (i.attributes.length > 1) {
188
+ let s = j(e.options.at(0), {
189
+ type: u.alphabetical,
190
+ order: g.asc,
191
191
  "ignore-case": !1,
192
192
  "custom-groups": {},
193
193
  groups: []
194
- }), l = o.attributes.reduce(
195
- (r, e) => {
196
- if (e.type === "SvelteSpreadAttribute")
194
+ }), l = i.attributes.reduce(
195
+ (r, t) => {
196
+ if (t.type === "SvelteSpreadAttribute")
197
197
  return r.push([]), r;
198
- let a, { getGroup: p, defineGroup: n, setCustomGroups: u } = M(
198
+ let a, { getGroup: n, defineGroup: o, setCustomGroups: p } = G(
199
199
  s.groups
200
200
  );
201
- return e.key.type === "SvelteSpecialDirectiveKey" ? a = t.sourceCode.text.slice(...e.key.range) : typeof e.key.name == "string" ? { name: a } = e.key : a = t.sourceCode.text.slice(...e.key.range), u(s["custom-groups"], a), e.type === "SvelteShorthandAttribute" && (n("svelte-shorthand"), n("shorthand")), (!("value" in e) || Array.isArray(e.value) && !e.value.at(0)) && n("shorthand"), e.loc.start.line !== e.loc.end.line && n("multiline"), r.at(-1).push({
202
- size: O(e.range),
203
- node: e,
204
- group: p(),
201
+ return t.key.type === "SvelteSpecialDirectiveKey" ? a = e.sourceCode.text.slice(...t.key.range) : typeof t.key.name == "string" ? { name: a } = t.key : a = e.sourceCode.text.slice(...t.key.range), p(s["custom-groups"], a), t.type === "SvelteShorthandAttribute" && (o("svelte-shorthand"), o("shorthand")), (!("value" in t) || Array.isArray(t.value) && !t.value.at(0)) && o("shorthand"), t.loc.start.line !== t.loc.end.line && o("multiline"), r.at(-1).push({
202
+ size: I(t.range),
203
+ node: t,
204
+ group: n(),
205
205
  name: a
206
206
  }), r;
207
207
  },
208
208
  [[]]
209
209
  );
210
210
  for (let r of l)
211
- P(r, (e, a) => {
212
- let p = E(s.groups, e), n = E(s.groups, a);
213
- (p > n || p === n && j(A(e, a, s))) && t.report({
211
+ P(r, (t, a) => {
212
+ let n = h(s.groups, t), o = h(s.groups, a);
213
+ (n > o || n === o && O(S(t, a, s))) && e.report({
214
214
  messageId: "unexpectedSvelteAttributesOrder",
215
215
  data: {
216
- left: e.name,
216
+ left: t.name,
217
217
  right: a.name
218
218
  },
219
219
  node: a.node,
220
- fix: (u) => {
221
- let y = {};
222
- for (let f of r) {
223
- let d = E(s.groups, f);
224
- d in y ? y[d] = w(
225
- [...y[d], f],
220
+ fix: (p) => {
221
+ let f = {};
222
+ for (let d of r) {
223
+ let c = h(s.groups, d);
224
+ c in f ? f[c] = v(
225
+ [...f[c], d],
226
226
  s
227
- ) : y[d] = [f];
227
+ ) : f[c] = [d];
228
228
  }
229
- let m = [];
230
- for (let f of Object.keys(y).sort(
231
- (d, g) => Number(d) - Number(g)
229
+ let y = [];
230
+ for (let d of Object.keys(f).sort(
231
+ (c, m) => Number(c) - Number(m)
232
232
  ))
233
- m.push(...w(y[f], s));
234
- return L(
235
- u,
233
+ y.push(...v(f[d], s));
234
+ return M(
235
+ p,
236
236
  r,
237
- m,
238
- t.sourceCode
237
+ y,
238
+ e.sourceCode
239
239
  );
240
240
  }
241
241
  });
@@ -243,8 +243,8 @@ const X = "sort-svelte-attributes", ge = v({
243
243
  }
244
244
  }
245
245
  }
246
- }), q = "sort-astro-attributes", ye = v({
247
- name: q,
246
+ }), H = "sort-astro-attributes", me = A({
247
+ name: H,
248
248
  meta: {
249
249
  type: "suggestion",
250
250
  docs: {
@@ -260,16 +260,16 @@ const X = "sort-svelte-attributes", ge = v({
260
260
  },
261
261
  type: {
262
262
  enum: [
263
- i.alphabetical,
264
- i.natural,
265
- i["line-length"]
263
+ u.alphabetical,
264
+ u.natural,
265
+ u["line-length"]
266
266
  ],
267
- default: i.alphabetical,
267
+ default: u.alphabetical,
268
268
  type: "string"
269
269
  },
270
270
  order: {
271
- enum: [c.asc, c.desc],
272
- default: c.asc,
271
+ enum: [g.asc, g.desc],
272
+ default: g.asc,
273
273
  type: "string"
274
274
  },
275
275
  "ignore-case": {
@@ -289,66 +289,66 @@ const X = "sort-svelte-attributes", ge = v({
289
289
  },
290
290
  defaultOptions: [
291
291
  {
292
- type: i.alphabetical,
293
- order: c.asc
292
+ type: u.alphabetical,
293
+ order: g.asc
294
294
  }
295
295
  ],
296
296
  // @ts-ignore
297
- create: (t) => _.extname(t.filename) !== ".astro" ? {} : {
298
- JSXElement: (o) => {
299
- let { attributes: s } = o.openingElement;
297
+ create: (e) => W.extname(e.filename) !== ".astro" ? {} : {
298
+ JSXElement: (i) => {
299
+ let { attributes: s } = i.openingElement;
300
300
  if (s.length > 1) {
301
- let l = k(t.options.at(0), {
302
- type: i.alphabetical,
303
- order: c.asc,
301
+ let l = j(e.options.at(0), {
302
+ type: u.alphabetical,
303
+ order: g.asc,
304
304
  "ignore-case": !1,
305
305
  "custom-groups": {},
306
306
  groups: []
307
307
  }), r = s.reduce(
308
- (e, a) => {
308
+ (t, a) => {
309
309
  if (a.type === "JSXSpreadAttribute")
310
- return e.push([]), e;
311
- let p = typeof a.name.name == "string" ? a.name.name : t.sourceCode.text.slice(...a.name.range), { getGroup: n, defineGroup: u, setCustomGroups: y } = M(
310
+ return t.push([]), t;
311
+ let n = typeof a.name.name == "string" ? a.name.name : e.sourceCode.text.slice(...a.name.range), { getGroup: o, defineGroup: p, setCustomGroups: f } = G(
312
312
  l.groups
313
313
  );
314
- return y(l["custom-groups"], p), a.type === "AstroShorthandAttribute" && (u("astro-shorthand"), u("shorthand")), a.value === null && u("shorthand"), a.loc.start.line !== a.loc.end.line && u("multiline"), e.at(-1).push({
315
- size: O(a.range),
314
+ return f(l["custom-groups"], n), a.type === "AstroShorthandAttribute" && (p("astro-shorthand"), p("shorthand")), a.value === null && p("shorthand"), a.loc.start.line !== a.loc.end.line && p("multiline"), t.at(-1).push({
315
+ size: I(a.range),
316
316
  node: a,
317
- group: n(),
318
- name: p
319
- }), e;
317
+ group: o(),
318
+ name: n
319
+ }), t;
320
320
  },
321
321
  [[]]
322
322
  );
323
- for (let e of r)
324
- P(e, (a, p) => {
325
- let n = E(l.groups, a), u = E(l.groups, p);
326
- (n > u || n === u && j(A(a, p, l))) && t.report({
323
+ for (let t of r)
324
+ P(t, (a, n) => {
325
+ let o = h(l.groups, a), p = h(l.groups, n);
326
+ (o > p || o === p && O(S(a, n, l))) && e.report({
327
327
  messageId: "unexpectedAstroAttributesOrder",
328
328
  data: {
329
329
  left: a.name,
330
- right: p.name
330
+ right: n.name
331
331
  },
332
- node: p.node,
333
- fix: (y) => {
334
- let m = {};
335
- for (let d of e) {
336
- let g = E(l.groups, d);
337
- g in m ? m[g] = w(
338
- [...m[g], d],
332
+ node: n.node,
333
+ fix: (f) => {
334
+ let y = {};
335
+ for (let c of t) {
336
+ let m = h(l.groups, c);
337
+ m in y ? y[m] = v(
338
+ [...y[m], c],
339
339
  l
340
- ) : m[g] = [d];
340
+ ) : y[m] = [c];
341
341
  }
342
- let f = [];
343
- for (let d of Object.keys(m).sort(
344
- (g, b) => Number(g) - Number(b)
342
+ let d = [];
343
+ for (let c of Object.keys(y).sort(
344
+ (m, x) => Number(m) - Number(x)
345
345
  ))
346
- f.push(...w(m[d], l));
347
- return L(
348
- y,
349
- e,
346
+ d.push(...v(y[c], l));
347
+ return M(
350
348
  f,
351
- t.sourceCode
349
+ t,
350
+ d,
351
+ e.sourceCode
352
352
  );
353
353
  }
354
354
  });
@@ -357,9 +357,9 @@ const X = "sort-svelte-attributes", ge = v({
357
357
  }
358
358
  }
359
359
  });
360
- let I = (t) => t.replaceAll(/\s\s+/g, " ").trim();
361
- const K = "sort-array-includes", me = v({
362
- name: K,
360
+ let k = (e) => e.replaceAll(/\s\s+/g, " ").trim();
361
+ const Q = "sort-array-includes", he = A({
362
+ name: Q,
363
363
  meta: {
364
364
  type: "suggestion",
365
365
  docs: {
@@ -372,16 +372,16 @@ const K = "sort-array-includes", me = v({
372
372
  properties: {
373
373
  type: {
374
374
  enum: [
375
- i.alphabetical,
376
- i.natural,
377
- i["line-length"]
375
+ u.alphabetical,
376
+ u.natural,
377
+ u["line-length"]
378
378
  ],
379
- default: i.alphabetical,
379
+ default: u.alphabetical,
380
380
  type: "string"
381
381
  },
382
382
  order: {
383
- enum: [c.asc, c.desc],
384
- default: c.asc,
383
+ enum: [g.asc, g.desc],
384
+ default: g.asc,
385
385
  type: "string"
386
386
  },
387
387
  "ignore-case": {
@@ -402,48 +402,48 @@ const K = "sort-array-includes", me = v({
402
402
  },
403
403
  defaultOptions: [
404
404
  {
405
- type: i.alphabetical,
406
- order: c.asc
405
+ type: u.alphabetical,
406
+ order: g.asc
407
407
  }
408
408
  ],
409
- create: (t) => ({
410
- MemberExpression: (o) => {
411
- if ((o.object.type === "ArrayExpression" || o.object.type === "NewExpression") && o.property.type === "Identifier" && o.property.name === "includes") {
412
- let s = o.object.type === "ArrayExpression" ? o.object.elements : o.object.arguments;
409
+ create: (e) => ({
410
+ MemberExpression: (i) => {
411
+ if ((i.object.type === "ArrayExpression" || i.object.type === "NewExpression") && i.property.type === "Identifier" && i.property.name === "includes") {
412
+ let s = i.object.type === "ArrayExpression" ? i.object.elements : i.object.arguments;
413
413
  if (s.length > 1) {
414
- let l = k(t.options.at(0), {
415
- type: i.alphabetical,
416
- order: c.asc,
414
+ let l = j(e.options.at(0), {
415
+ type: u.alphabetical,
416
+ order: g.asc,
417
417
  "ignore-case": !1,
418
418
  "spread-last": !1
419
419
  }), r = s.reduce(
420
- (e, a) => (a !== null && e.at(0).push({
421
- name: a.type === "Literal" ? `${a.value}` : t.sourceCode.text.slice(...a.range),
422
- size: O(a.range),
420
+ (t, a) => (a !== null && t.at(0).push({
421
+ name: a.type === "Literal" ? `${a.value}` : e.sourceCode.text.slice(...a.range),
422
+ size: I(a.range),
423
423
  type: a.type,
424
424
  node: a
425
- }), e),
425
+ }), t),
426
426
  [[], []]
427
427
  ).flat();
428
- P(r, (e, a) => {
429
- let p;
430
- l["spread-last"] && e.node.type === "Literal" && a.node.type === "SpreadElement" ? p = !1 : l["spread-last"] && e.node.type === "SpreadElement" && a.node.type === "Literal" ? p = !0 : p = j(A(e, a, l)), p && t.report({
428
+ P(r, (t, a) => {
429
+ let n;
430
+ l["spread-last"] && t.node.type === "Literal" && a.node.type === "SpreadElement" ? n = !1 : l["spread-last"] && t.node.type === "SpreadElement" && a.node.type === "Literal" ? n = !0 : n = O(S(t, a, l)), n && e.report({
431
431
  messageId: "unexpectedArrayIncludesOrder",
432
432
  data: {
433
- left: I(e.name),
434
- right: I(a.name)
433
+ left: k(t.name),
434
+ right: k(a.name)
435
435
  },
436
436
  node: a.node,
437
- fix: (n) => {
438
- let u = w(r, l);
437
+ fix: (o) => {
438
+ let p = v(r, l);
439
439
  if (l["spread-last"])
440
- for (let y = 0, m = u.length; y < m; y++)
441
- u.at(y).node.type === "SpreadElement" && u.push(u.splice(y, 1).at(0));
442
- return L(
443
- n,
440
+ for (let f = 0, y = p.length; f < y; f++)
441
+ p.at(f).node.type === "SpreadElement" && p.push(p.splice(f, 1).at(0));
442
+ return M(
443
+ o,
444
444
  r,
445
- u,
446
- t.sourceCode
445
+ p,
446
+ e.sourceCode
447
447
  );
448
448
  }
449
449
  });
@@ -452,8 +452,8 @@ const K = "sort-array-includes", me = v({
452
452
  }
453
453
  }
454
454
  })
455
- }), H = "sort-vue-attributes", he = v({
456
- name: H,
455
+ }), Y = "sort-vue-attributes", be = A({
456
+ name: Y,
457
457
  meta: {
458
458
  type: "suggestion",
459
459
  docs: {
@@ -469,16 +469,16 @@ const K = "sort-array-includes", me = v({
469
469
  },
470
470
  type: {
471
471
  enum: [
472
- i.alphabetical,
473
- i.natural,
474
- i["line-length"]
472
+ u.alphabetical,
473
+ u.natural,
474
+ u["line-length"]
475
475
  ],
476
- default: i.alphabetical,
476
+ default: u.alphabetical,
477
477
  type: "string"
478
478
  },
479
479
  order: {
480
- enum: [c.asc, c.desc],
481
- default: c.asc,
480
+ enum: [g.asc, g.desc],
481
+ default: g.asc,
482
482
  type: "string"
483
483
  },
484
484
  "ignore-case": {
@@ -499,70 +499,70 @@ const K = "sort-array-includes", me = v({
499
499
  },
500
500
  defaultOptions: [
501
501
  {
502
- type: i.alphabetical,
503
- order: c.asc
502
+ type: u.alphabetical,
503
+ order: g.asc
504
504
  }
505
505
  ],
506
- create: (t) => {
507
- if (_.extname(t.filename) !== ".vue")
506
+ create: (e) => {
507
+ if (W.extname(e.filename) !== ".vue")
508
508
  return {};
509
- if (!("defineTemplateBodyVisitor" in t.sourceCode.parserServices))
509
+ if (!("defineTemplateBodyVisitor" in e.sourceCode.parserServices))
510
510
  return {};
511
- let { defineTemplateBodyVisitor: o } = t.sourceCode.parserServices;
512
- return o({
511
+ let { defineTemplateBodyVisitor: i } = e.sourceCode.parserServices;
512
+ return i({
513
513
  VStartTag: (s) => {
514
514
  if (s.attributes.length > 1) {
515
- let l = k(t.options.at(0), {
516
- type: i.alphabetical,
517
- order: c.asc,
515
+ let l = j(e.options.at(0), {
516
+ type: u.alphabetical,
517
+ order: g.asc,
518
518
  "ignore-case": !1,
519
519
  "custom-groups": {},
520
520
  groups: []
521
521
  }), r = s.attributes.reduce(
522
- (e, a) => {
522
+ (t, a) => {
523
523
  if (a.key.type === "VDirectiveKey" && a.key.name.rawName === "bind")
524
- return e.push([]), e;
525
- let p, { getGroup: n, defineGroup: u, setCustomGroups: y } = M(
524
+ return t.push([]), t;
525
+ let n, { getGroup: o, defineGroup: p, setCustomGroups: f } = G(
526
526
  l.groups
527
527
  );
528
- return typeof a.key.name == "string" && a.key.type !== "VDirectiveKey" ? p = a.key.rawName : p = t.sourceCode.text.slice(...a.key.range), y(l["custom-groups"], p), a.value === null && u("shorthand"), a.loc.start.line !== a.loc.end.line && u("multiline"), e.at(-1).push({
529
- size: O(a.range),
528
+ return typeof a.key.name == "string" && a.key.type !== "VDirectiveKey" ? n = a.key.rawName : n = e.sourceCode.text.slice(...a.key.range), f(l["custom-groups"], n), a.value === null && p("shorthand"), a.loc.start.line !== a.loc.end.line && p("multiline"), t.at(-1).push({
529
+ size: I(a.range),
530
530
  node: a,
531
- group: n(),
532
- name: p
533
- }), e;
531
+ group: o(),
532
+ name: n
533
+ }), t;
534
534
  },
535
535
  [[]]
536
536
  );
537
- for (let e of r)
538
- P(e, (a, p) => {
539
- let n = E(l.groups, a), u = E(l.groups, p);
540
- (n > u || n === u && j(A(a, p, l))) && t.report({
537
+ for (let t of r)
538
+ P(t, (a, n) => {
539
+ let o = h(l.groups, a), p = h(l.groups, n);
540
+ (o > p || o === p && O(S(a, n, l))) && e.report({
541
541
  messageId: "unexpectedVueAttributesOrder",
542
542
  data: {
543
543
  left: a.name,
544
- right: p.name
544
+ right: n.name
545
545
  },
546
- node: p.node,
547
- fix: (y) => {
548
- let m = {};
549
- for (let d of e) {
550
- let g = E(l.groups, d);
551
- g in m ? m[g] = w(
552
- [...m[g], d],
546
+ node: n.node,
547
+ fix: (f) => {
548
+ let y = {};
549
+ for (let c of t) {
550
+ let m = h(l.groups, c);
551
+ m in y ? y[m] = v(
552
+ [...y[m], c],
553
553
  l
554
- ) : m[g] = [d];
554
+ ) : y[m] = [c];
555
555
  }
556
- let f = [];
557
- for (let d of Object.keys(m).sort(
558
- (g, b) => Number(g) - Number(b)
556
+ let d = [];
557
+ for (let c of Object.keys(y).sort(
558
+ (m, x) => Number(m) - Number(x)
559
559
  ))
560
- f.push(...w(m[d], l));
561
- return L(
562
- y,
563
- e,
560
+ d.push(...v(y[c], l));
561
+ return M(
564
562
  f,
565
- t.sourceCode
563
+ t,
564
+ d,
565
+ e.sourceCode
566
566
  );
567
567
  }
568
568
  });
@@ -571,8 +571,8 @@ const K = "sort-array-includes", me = v({
571
571
  }
572
572
  });
573
573
  }
574
- }), Q = "sort-named-exports", be = v({
575
- name: Q,
574
+ }), Z = "sort-named-exports", xe = A({
575
+ name: Z,
576
576
  meta: {
577
577
  type: "suggestion",
578
578
  docs: {
@@ -585,21 +585,30 @@ const K = "sort-array-includes", me = v({
585
585
  properties: {
586
586
  type: {
587
587
  enum: [
588
- i.alphabetical,
589
- i.natural,
590
- i["line-length"]
588
+ u.alphabetical,
589
+ u.natural,
590
+ u["line-length"]
591
591
  ],
592
- default: i.alphabetical,
592
+ default: u.alphabetical,
593
593
  type: "string"
594
594
  },
595
595
  order: {
596
- enum: [c.asc, c.desc],
597
- default: c.asc,
596
+ enum: [g.asc, g.desc],
597
+ default: g.asc,
598
598
  type: "string"
599
599
  },
600
600
  "ignore-case": {
601
601
  type: "boolean",
602
602
  default: !1
603
+ },
604
+ "group-kind": {
605
+ enum: [
606
+ L.mixed,
607
+ L["values-first"],
608
+ L["types-first"]
609
+ ],
610
+ default: L.mixed,
611
+ type: "string"
603
612
  }
604
613
  },
605
614
  additionalProperties: !1
@@ -611,43 +620,44 @@ const K = "sort-array-includes", me = v({
611
620
  },
612
621
  defaultOptions: [
613
622
  {
614
- type: i.alphabetical,
615
- order: c.asc
623
+ type: u.alphabetical,
624
+ order: g.asc
616
625
  }
617
626
  ],
618
- create: (t) => ({
619
- ExportNamedDeclaration: (o) => {
620
- if (o.specifiers.length > 1) {
621
- let s = k(t.options.at(0), {
622
- type: i.alphabetical,
627
+ create: (e) => ({
628
+ ExportNamedDeclaration: (i) => {
629
+ if (i.specifiers.length > 1) {
630
+ let s = j(e.options.at(0), {
631
+ type: u.alphabetical,
623
632
  "ignore-case": !1,
624
- order: c.asc
625
- }), l = o.specifiers.map((r) => ({
626
- size: O(r.range),
627
- name: r.local.name,
628
- node: r
629
- }));
630
- P(l, (r, e) => {
631
- j(A(r, e, s)) && t.report({
632
- messageId: "unexpectedNamedExportsOrder",
633
- data: {
634
- left: r.name,
635
- right: e.name
636
- },
637
- node: e.node,
638
- fix: (a) => L(
639
- a,
640
- l,
641
- w(l, s),
642
- t.sourceCode
643
- )
644
- });
633
+ order: g.asc,
634
+ "group-kind": L.mixed
635
+ }), l = i.specifiers.map((a) => ({
636
+ size: I(a.range),
637
+ name: a.local.name,
638
+ node: a,
639
+ group: a.exportKind
640
+ })), r = s["group-kind"] !== L.mixed, t = s["group-kind"] === L["values-first"] ? ["value", "type"] : ["type", "value"];
641
+ P(l, (a, n) => {
642
+ let o = h(t, a), p = h(t, n);
643
+ if (r && o > p || (!r || o === p) && O(S(a, n, s))) {
644
+ let f = r ? t.map((y) => l.filter((d) => d.group === y)).map((y) => v(y, s)).flat() : v(l, s);
645
+ e.report({
646
+ messageId: "unexpectedNamedExportsOrder",
647
+ data: {
648
+ left: a.name,
649
+ right: n.name
650
+ },
651
+ node: n.node,
652
+ fix: (y) => M(y, l, f, e.sourceCode)
653
+ });
654
+ }
645
655
  });
646
656
  }
647
657
  }
648
658
  })
649
- }), Y = "sort-named-imports", xe = v({
650
- name: Y,
659
+ }), F = "sort-named-imports", Ee = A({
660
+ name: F,
651
661
  meta: {
652
662
  type: "suggestion",
653
663
  docs: {
@@ -660,16 +670,16 @@ const K = "sort-array-includes", me = v({
660
670
  properties: {
661
671
  type: {
662
672
  enum: [
663
- i.alphabetical,
664
- i.natural,
665
- i["line-length"]
673
+ u.alphabetical,
674
+ u.natural,
675
+ u["line-length"]
666
676
  ],
667
- default: i.alphabetical,
677
+ default: u.alphabetical,
668
678
  type: "string"
669
679
  },
670
680
  order: {
671
- enum: [c.asc, c.desc],
672
- default: c.asc,
681
+ enum: [g.asc, g.desc],
682
+ default: g.asc,
673
683
  type: "string"
674
684
  },
675
685
  "ignore-case": {
@@ -679,6 +689,15 @@ const K = "sort-array-includes", me = v({
679
689
  "ignore-alias": {
680
690
  type: "boolean",
681
691
  default: !1
692
+ },
693
+ "group-kind": {
694
+ enum: [
695
+ L.mixed,
696
+ L["values-first"],
697
+ L["types-first"]
698
+ ],
699
+ default: L.mixed,
700
+ type: "string"
682
701
  }
683
702
  },
684
703
  additionalProperties: !1
@@ -690,55 +709,56 @@ const K = "sort-array-includes", me = v({
690
709
  },
691
710
  defaultOptions: [
692
711
  {
693
- type: i.alphabetical,
694
- order: c.asc
712
+ type: u.alphabetical,
713
+ order: g.asc
695
714
  }
696
715
  ],
697
- create: (t) => ({
698
- ImportDeclaration: (o) => {
699
- let s = o.specifiers.filter(
716
+ create: (e) => ({
717
+ ImportDeclaration: (i) => {
718
+ let s = i.specifiers.filter(
700
719
  ({ type: l }) => l === "ImportSpecifier"
701
720
  );
702
721
  if (s.length > 1) {
703
- let l = k(t.options.at(0), {
704
- type: i.alphabetical,
722
+ let l = j(e.options.at(0), {
723
+ type: u.alphabetical,
705
724
  "ignore-alias": !0,
706
725
  "ignore-case": !1,
707
- order: c.asc
708
- }), r = s.map((e) => {
709
- let { name: a } = e.local;
710
- return l["ignore-alias"] && e.type === "ImportSpecifier" && ({ name: a } = e.imported), {
711
- size: O(e.range),
712
- node: e,
713
- name: a
726
+ order: g.asc,
727
+ "group-kind": L.mixed
728
+ }), r = s.map((n) => {
729
+ let o, { name: p } = n.local;
730
+ return n.type === "ImportSpecifier" && (l["ignore-alias"] && ({ name: p } = n.imported), o = n.importKind), {
731
+ size: I(n.range),
732
+ node: n,
733
+ name: p,
734
+ group: o
714
735
  };
715
- });
716
- P(r, (e, a) => {
717
- j(A(e, a, l)) && t.report({
718
- messageId: "unexpectedNamedImportsOrder",
719
- data: {
720
- left: e.name,
721
- right: a.name
722
- },
723
- node: a.node,
724
- fix: (p) => L(
725
- p,
726
- r,
727
- w(r, l),
728
- t.sourceCode
729
- )
730
- });
736
+ }), t = l["group-kind"] !== L.mixed, a = l["group-kind"] === L["values-first"] ? ["value", "type"] : ["type", "value"];
737
+ P(r, (n, o) => {
738
+ let p = h(a, n), f = h(a, o);
739
+ if (t && p > f || (!t || p === f) && O(S(n, o, l))) {
740
+ let y = t ? a.map((d) => r.filter((c) => c.group === d)).map((d) => v(d, l)).flat() : v(r, l);
741
+ e.report({
742
+ messageId: "unexpectedNamedImportsOrder",
743
+ data: {
744
+ left: n.name,
745
+ right: o.name
746
+ },
747
+ node: o.node,
748
+ fix: (d) => M(d, r, y, e.sourceCode)
749
+ });
750
+ }
731
751
  });
732
752
  }
733
753
  }
734
754
  })
735
755
  });
736
- let z = (t, o, s) => t.lines.slice(
737
- o.node.loc.end.line,
756
+ let z = (e, i, s) => e.lines.slice(
757
+ i.node.loc.end.line,
738
758
  s.node.loc.start.line - 1
739
759
  ).filter((r) => !r.trim().length).length;
740
- const Z = "sort-object-types", Ee = v({
741
- name: Z,
760
+ const ee = "sort-object-types", Ne = A({
761
+ name: ee,
742
762
  meta: {
743
763
  type: "suggestion",
744
764
  docs: {
@@ -754,16 +774,16 @@ const Z = "sort-object-types", Ee = v({
754
774
  },
755
775
  type: {
756
776
  enum: [
757
- i.alphabetical,
758
- i.natural,
759
- i["line-length"]
777
+ u.alphabetical,
778
+ u.natural,
779
+ u["line-length"]
760
780
  ],
761
- default: i.alphabetical,
781
+ default: u.alphabetical,
762
782
  type: "string"
763
783
  },
764
784
  order: {
765
- enum: [c.asc, c.desc],
766
- default: c.asc,
785
+ enum: [g.asc, g.desc],
786
+ default: g.asc,
767
787
  type: "string"
768
788
  },
769
789
  "ignore-case": {
@@ -788,88 +808,88 @@ const Z = "sort-object-types", Ee = v({
788
808
  },
789
809
  defaultOptions: [
790
810
  {
791
- type: i.alphabetical,
792
- order: c.asc
811
+ type: u.alphabetical,
812
+ order: g.asc
793
813
  }
794
814
  ],
795
- create: (t) => ({
796
- TSTypeLiteral: (o) => {
797
- if (o.members.length > 1) {
798
- let s = k(t.options.at(0), {
815
+ create: (e) => ({
816
+ TSTypeLiteral: (i) => {
817
+ if (i.members.length > 1) {
818
+ let s = j(e.options.at(0), {
799
819
  "partition-by-new-line": !1,
800
- type: i.alphabetical,
820
+ type: u.alphabetical,
801
821
  "ignore-case": !1,
802
- order: c.asc,
822
+ order: g.asc,
803
823
  "custom-groups": {},
804
824
  groups: []
805
- }), l = o.members.reduce(
806
- (r, e) => {
807
- var N, h, C, x;
808
- let a, p = t.sourceCode.text.slice(
809
- e.range.at(0),
810
- e.range.at(1)
811
- ), n = (N = r.at(-1)) == null ? void 0 : N.at(-1), { getGroup: u, defineGroup: y, setCustomGroups: m } = M(
825
+ }), l = i.members.reduce(
826
+ (r, t) => {
827
+ var C, b, N, E;
828
+ let a, n = e.sourceCode.text.slice(
829
+ t.range.at(0),
830
+ t.range.at(1)
831
+ ), o = (C = r.at(-1)) == null ? void 0 : C.at(-1), { getGroup: p, defineGroup: f, setCustomGroups: y } = G(
812
832
  s.groups
813
- ), f = (S) => S.replace(/(,|;)$/, "");
814
- if (e.type === "TSPropertySignature")
815
- e.key.type === "Identifier" ? { name: a } = e.key : e.key.type === "Literal" ? a = `${e.key.value}` : a = t.sourceCode.text.slice(
816
- e.range.at(0),
817
- (h = e.typeAnnotation) == null ? void 0 : h.range.at(0)
833
+ ), d = (w) => w.replace(/(,|;)$/, "");
834
+ if (t.type === "TSPropertySignature")
835
+ t.key.type === "Identifier" ? { name: a } = t.key : t.key.type === "Literal" ? a = `${t.key.value}` : a = e.sourceCode.text.slice(
836
+ t.range.at(0),
837
+ (b = t.typeAnnotation) == null ? void 0 : b.range.at(0)
818
838
  );
819
- else if (e.type === "TSIndexSignature") {
820
- let S = ((C = e.typeAnnotation) == null ? void 0 : C.range.at(0)) ?? e.range.at(1);
821
- a = f(
822
- t.sourceCode.text.slice(e.range.at(0), S)
839
+ else if (t.type === "TSIndexSignature") {
840
+ let w = ((N = t.typeAnnotation) == null ? void 0 : N.range.at(0)) ?? t.range.at(1);
841
+ a = d(
842
+ e.sourceCode.text.slice(t.range.at(0), w)
823
843
  );
824
844
  } else
825
- a = f(
826
- t.sourceCode.text.slice(
827
- e.range.at(0),
828
- e.range.at(1)
845
+ a = d(
846
+ e.sourceCode.text.slice(
847
+ t.range.at(0),
848
+ t.range.at(1)
829
849
  )
830
850
  );
831
- m(s["custom-groups"], a), e.loc.start.line !== e.loc.end.line && y("multiline");
832
- let g = p.endsWith(";") || p.endsWith(",") ? 1 : 0, b = {
833
- size: O(e.range) - g,
834
- node: e,
851
+ y(s["custom-groups"], a), t.loc.start.line !== t.loc.end.line && f("multiline");
852
+ let m = n.endsWith(";") || n.endsWith(",") ? 1 : 0, x = {
853
+ size: I(t.range) - m,
854
+ node: t,
835
855
  name: a
836
856
  };
837
- return s["partition-by-new-line"] && n && z(t.sourceCode, n, b) && r.push([]), (x = r.at(-1)) == null || x.push({
838
- ...b,
839
- group: u()
857
+ return s["partition-by-new-line"] && o && z(e.sourceCode, o, x) && r.push([]), (E = r.at(-1)) == null || E.push({
858
+ ...x,
859
+ group: p()
840
860
  }), r;
841
861
  },
842
862
  [[]]
843
863
  );
844
864
  for (let r of l)
845
- P(r, (e, a) => {
846
- let p = E(s.groups, e), n = E(s.groups, a);
847
- (p > n || p === n && j(A(e, a, s))) && t.report({
865
+ P(r, (t, a) => {
866
+ let n = h(s.groups, t), o = h(s.groups, a);
867
+ (n > o || n === o && O(S(t, a, s))) && e.report({
848
868
  messageId: "unexpectedObjectTypesOrder",
849
869
  data: {
850
- left: I(e.name),
851
- right: I(a.name)
870
+ left: k(t.name),
871
+ right: k(a.name)
852
872
  },
853
873
  node: a.node,
854
- fix: (u) => {
855
- let y = {};
856
- for (let f of r) {
857
- let d = E(s.groups, f);
858
- d in y ? y[d] = w(
859
- [...y[d], f],
874
+ fix: (p) => {
875
+ let f = {};
876
+ for (let d of r) {
877
+ let c = h(s.groups, d);
878
+ c in f ? f[c] = v(
879
+ [...f[c], d],
860
880
  s
861
- ) : y[d] = [f];
881
+ ) : f[c] = [d];
862
882
  }
863
- let m = [];
864
- for (let f of Object.keys(y).sort(
865
- (d, g) => Number(d) - Number(g)
883
+ let y = [];
884
+ for (let d of Object.keys(f).sort(
885
+ (c, m) => Number(c) - Number(m)
866
886
  ))
867
- m.push(...w(y[f], s));
868
- return L(
869
- u,
887
+ y.push(...v(f[d], s));
888
+ return M(
889
+ p,
870
890
  r,
871
- m,
872
- t.sourceCode
891
+ y,
892
+ e.sourceCode
873
893
  );
874
894
  }
875
895
  });
@@ -877,8 +897,8 @@ const Z = "sort-object-types", Ee = v({
877
897
  }
878
898
  }
879
899
  })
880
- }), F = "sort-union-types", Ce = v({
881
- name: F,
900
+ }), te = "sort-union-types", Ce = A({
901
+ name: te,
882
902
  meta: {
883
903
  type: "suggestion",
884
904
  docs: {
@@ -891,16 +911,16 @@ const Z = "sort-object-types", Ee = v({
891
911
  properties: {
892
912
  type: {
893
913
  enum: [
894
- i.alphabetical,
895
- i.natural,
896
- i["line-length"]
914
+ u.alphabetical,
915
+ u.natural,
916
+ u["line-length"]
897
917
  ],
898
- default: i.alphabetical,
918
+ default: u.alphabetical,
899
919
  type: "string"
900
920
  },
901
921
  order: {
902
- enum: [c.asc, c.desc],
903
- default: c.asc,
922
+ enum: [g.asc, g.desc],
923
+ default: g.asc,
904
924
  type: "string"
905
925
  },
906
926
  "ignore-case": {
@@ -921,50 +941,50 @@ const Z = "sort-object-types", Ee = v({
921
941
  },
922
942
  defaultOptions: [
923
943
  {
924
- type: i.alphabetical,
925
- order: c.asc
944
+ type: u.alphabetical,
945
+ order: g.asc
926
946
  }
927
947
  ],
928
- create: (t) => ({
929
- TSUnionType: (o) => {
930
- let s = k(t.options.at(0), {
931
- type: i.alphabetical,
948
+ create: (e) => ({
949
+ TSUnionType: (i) => {
950
+ let s = j(e.options.at(0), {
951
+ type: u.alphabetical,
932
952
  "nullable-last": !1,
933
953
  "ignore-case": !1,
934
- order: c.asc
935
- }), l = o.types.map((r) => ({
954
+ order: g.asc
955
+ }), l = i.types.map((r) => ({
936
956
  group: r.type === "TSNullKeyword" || r.type === "TSUndefinedKeyword" ? "nullable" : "unknown",
937
- name: t.sourceCode.text.slice(...r.range),
938
- size: O(r.range),
957
+ name: e.sourceCode.text.slice(...r.range),
958
+ size: I(r.range),
939
959
  node: r
940
960
  }));
941
- P(l, (r, e) => {
942
- let a = j(A(r, e, s));
943
- s["nullable-last"] && (r.group === "nullable" && e.group === "unknown" ? a = !0 : r.group === "unknown" && e.group === "nullable" && (a = !1)), a && t.report({
961
+ P(l, (r, t) => {
962
+ let a = O(S(r, t, s));
963
+ s["nullable-last"] && (r.group === "nullable" && t.group === "unknown" ? a = !0 : r.group === "unknown" && t.group === "nullable" && (a = !1)), a && e.report({
944
964
  messageId: "unexpectedUnionTypesOrder",
945
965
  data: {
946
- left: I(r.name),
947
- right: I(e.name)
966
+ left: k(r.name),
967
+ right: k(t.name)
948
968
  },
949
- node: e.node,
950
- fix: (p) => {
951
- let n = [];
969
+ node: t.node,
970
+ fix: (n) => {
971
+ let o = [];
952
972
  if (s["nullable-last"]) {
953
- let u = [], y = l.filter((m) => m.group === "nullable" ? (u.push(m), !1) : !0);
954
- n = [
955
- ...w(y, s),
956
- ...w(u, s)
973
+ let p = [], f = l.filter((y) => y.group === "nullable" ? (p.push(y), !1) : !0);
974
+ o = [
975
+ ...v(f, s),
976
+ ...v(p, s)
957
977
  ];
958
978
  } else
959
- n = w(l, s);
960
- return L(p, l, n, t.sourceCode);
979
+ o = v(l, s);
980
+ return M(n, l, o, e.sourceCode);
961
981
  }
962
982
  });
963
983
  });
964
984
  }
965
985
  })
966
- }), ee = "sort-interfaces", Ne = v({
967
- name: ee,
986
+ }), re = "sort-interfaces", ve = A({
987
+ name: re,
968
988
  meta: {
969
989
  type: "suggestion",
970
990
  docs: {
@@ -980,16 +1000,16 @@ const Z = "sort-object-types", Ee = v({
980
1000
  },
981
1001
  type: {
982
1002
  enum: [
983
- i.alphabetical,
984
- i.natural,
985
- i["line-length"]
1003
+ u.alphabetical,
1004
+ u.natural,
1005
+ u["line-length"]
986
1006
  ],
987
- default: i.alphabetical,
1007
+ default: u.alphabetical,
988
1008
  type: "string"
989
1009
  },
990
1010
  order: {
991
- enum: [c.asc, c.desc],
992
- default: c.asc,
1011
+ enum: [g.asc, g.desc],
1012
+ default: g.asc,
993
1013
  type: "string"
994
1014
  },
995
1015
  "ignore-case": {
@@ -1020,102 +1040,102 @@ const Z = "sort-object-types", Ee = v({
1020
1040
  },
1021
1041
  defaultOptions: [
1022
1042
  {
1023
- type: i.alphabetical,
1024
- order: c.asc
1043
+ type: u.alphabetical,
1044
+ order: g.asc
1025
1045
  }
1026
1046
  ],
1027
- create: (t) => ({
1028
- TSInterfaceDeclaration: (o) => {
1029
- if (o.body.body.length > 1) {
1030
- let s = k(t.options.at(0), {
1047
+ create: (e) => ({
1048
+ TSInterfaceDeclaration: (i) => {
1049
+ if (i.body.body.length > 1) {
1050
+ let s = j(e.options.at(0), {
1031
1051
  "partition-by-new-line": !1,
1032
- type: i.alphabetical,
1052
+ type: u.alphabetical,
1033
1053
  "ignore-case": !1,
1034
- order: c.asc,
1054
+ order: g.asc,
1035
1055
  "ignore-pattern": [],
1036
1056
  "custom-groups": {},
1037
1057
  groups: []
1038
1058
  });
1039
1059
  if (!s["ignore-pattern"].some(
1040
- (l) => $(o.id.name, l, {
1060
+ (l) => D(i.id.name, l, {
1041
1061
  nocomment: !0
1042
1062
  })
1043
1063
  )) {
1044
- let l = o.body.body.reduce(
1045
- (r, e) => {
1046
- var f, d, g, b;
1047
- if (e.type === "TSCallSignatureDeclaration")
1064
+ let l = i.body.body.reduce(
1065
+ (r, t) => {
1066
+ var d, c, m, x;
1067
+ if (t.type === "TSCallSignatureDeclaration")
1048
1068
  return r.push([]), r;
1049
- let a = (f = r.at(-1)) == null ? void 0 : f.at(-1), p, { getGroup: n, defineGroup: u, setCustomGroups: y } = M(
1069
+ let a = (d = r.at(-1)) == null ? void 0 : d.at(-1), n, { getGroup: o, defineGroup: p, setCustomGroups: f } = G(
1050
1070
  s.groups
1051
1071
  );
1052
- if (e.type === "TSPropertySignature")
1053
- if (e.key.type === "Identifier")
1054
- ({ name: p } = e.key);
1055
- else if (e.key.type === "Literal")
1056
- p = `${e.key.value}`;
1072
+ if (t.type === "TSPropertySignature")
1073
+ if (t.key.type === "Identifier")
1074
+ ({ name: n } = t.key);
1075
+ else if (t.key.type === "Literal")
1076
+ n = `${t.key.value}`;
1057
1077
  else {
1058
- let N = ((d = e.typeAnnotation) == null ? void 0 : d.range.at(0)) ?? e.range.at(1) - (e.optional ? 1 : 0);
1059
- p = t.sourceCode.text.slice(e.range.at(0), N);
1078
+ let C = ((c = t.typeAnnotation) == null ? void 0 : c.range.at(0)) ?? t.range.at(1) - (t.optional ? 1 : 0);
1079
+ n = e.sourceCode.text.slice(t.range.at(0), C);
1060
1080
  }
1061
- else if (e.type === "TSIndexSignature") {
1062
- let N = ((g = e.typeAnnotation) == null ? void 0 : g.range.at(0)) ?? e.range.at(1);
1063
- p = t.sourceCode.text.slice(
1064
- e.range.at(0),
1065
- N
1081
+ else if (t.type === "TSIndexSignature") {
1082
+ let C = ((m = t.typeAnnotation) == null ? void 0 : m.range.at(0)) ?? t.range.at(1);
1083
+ n = e.sourceCode.text.slice(
1084
+ t.range.at(0),
1085
+ C
1066
1086
  );
1067
1087
  } else {
1068
- let N = ((b = e.returnType) == null ? void 0 : b.range.at(0)) ?? e.range.at(1);
1069
- p = t.sourceCode.text.slice(
1070
- e.range.at(0),
1071
- N
1088
+ let C = ((x = t.returnType) == null ? void 0 : x.range.at(0)) ?? t.range.at(1);
1089
+ n = e.sourceCode.text.slice(
1090
+ t.range.at(0),
1091
+ C
1072
1092
  );
1073
1093
  }
1074
- let m = {
1075
- size: O(e.range),
1076
- node: e,
1077
- name: p
1094
+ let y = {
1095
+ size: I(t.range),
1096
+ node: t,
1097
+ name: n
1078
1098
  };
1079
1099
  return s["partition-by-new-line"] && a && z(
1080
- t.sourceCode,
1100
+ e.sourceCode,
1081
1101
  a,
1082
- m
1083
- ) && r.push([]), y(s["custom-groups"], p), e.loc.start.line !== e.loc.end.line && u("multiline"), r.at(-1).push({
1084
- ...m,
1085
- group: n()
1102
+ y
1103
+ ) && r.push([]), f(s["custom-groups"], n), t.loc.start.line !== t.loc.end.line && p("multiline"), r.at(-1).push({
1104
+ ...y,
1105
+ group: o()
1086
1106
  }), r;
1087
1107
  },
1088
1108
  [[]]
1089
1109
  );
1090
1110
  for (let r of l)
1091
- P(r, (e, a) => {
1092
- let p = E(s.groups, e), n = E(s.groups, a);
1093
- (p > n || p === n && j(A(e, a, s))) && t.report({
1111
+ P(r, (t, a) => {
1112
+ let n = h(s.groups, t), o = h(s.groups, a);
1113
+ (n > o || n === o && O(S(t, a, s))) && e.report({
1094
1114
  messageId: "unexpectedInterfacePropertiesOrder",
1095
1115
  data: {
1096
- left: I(e.name),
1097
- right: I(a.name)
1116
+ left: k(t.name),
1117
+ right: k(a.name)
1098
1118
  },
1099
1119
  node: a.node,
1100
- fix: (u) => {
1101
- let y = {};
1102
- for (let f of r) {
1103
- let d = E(s.groups, f);
1104
- d in y ? y[d] = w(
1105
- [...y[d], f],
1120
+ fix: (p) => {
1121
+ let f = {};
1122
+ for (let d of r) {
1123
+ let c = h(s.groups, d);
1124
+ c in f ? f[c] = v(
1125
+ [...f[c], d],
1106
1126
  s
1107
- ) : y[d] = [f];
1127
+ ) : f[c] = [d];
1108
1128
  }
1109
- let m = [];
1110
- for (let f of Object.keys(y).sort(
1111
- (d, g) => Number(d) - Number(g)
1129
+ let y = [];
1130
+ for (let d of Object.keys(f).sort(
1131
+ (c, m) => Number(c) - Number(m)
1112
1132
  ))
1113
- m.push(...w(y[f], s));
1114
- return L(
1115
- u,
1133
+ y.push(...v(f[d], s));
1134
+ return M(
1135
+ p,
1116
1136
  r,
1117
- m,
1118
- t.sourceCode
1137
+ y,
1138
+ e.sourceCode
1119
1139
  );
1120
1140
  }
1121
1141
  });
@@ -1124,8 +1144,8 @@ const Z = "sort-object-types", Ee = v({
1124
1144
  }
1125
1145
  }
1126
1146
  })
1127
- }), te = "sort-jsx-props", we = v({
1128
- name: te,
1147
+ }), se = "sort-jsx-props", we = A({
1148
+ name: se,
1129
1149
  meta: {
1130
1150
  type: "suggestion",
1131
1151
  docs: {
@@ -1141,16 +1161,16 @@ const Z = "sort-object-types", Ee = v({
1141
1161
  },
1142
1162
  type: {
1143
1163
  enum: [
1144
- i.alphabetical,
1145
- i.natural,
1146
- i["line-length"]
1164
+ u.alphabetical,
1165
+ u.natural,
1166
+ u["line-length"]
1147
1167
  ],
1148
- default: i.alphabetical,
1168
+ default: u.alphabetical,
1149
1169
  type: "string"
1150
1170
  },
1151
1171
  order: {
1152
- enum: [c.asc, c.desc],
1153
- default: c.asc,
1172
+ enum: [g.asc, g.desc],
1173
+ default: g.asc,
1154
1174
  type: "string"
1155
1175
  },
1156
1176
  groups: {
@@ -1170,66 +1190,66 @@ const Z = "sort-object-types", Ee = v({
1170
1190
  },
1171
1191
  defaultOptions: [
1172
1192
  {
1173
- type: i.alphabetical,
1174
- order: c.asc
1193
+ type: u.alphabetical,
1194
+ order: g.asc
1175
1195
  }
1176
1196
  ],
1177
- create: (t) => [".svelte", ".astro", ".vue"].includes(_.extname(t.filename)) ? {} : {
1178
- JSXElement: (o) => {
1179
- if (o.openingElement.attributes.length > 1) {
1180
- let s = k(t.options.at(0), {
1181
- type: i.alphabetical,
1197
+ create: (e) => [".svelte", ".astro", ".vue"].includes(W.extname(e.filename)) ? {} : {
1198
+ JSXElement: (i) => {
1199
+ if (i.openingElement.attributes.length > 1) {
1200
+ let s = j(e.options.at(0), {
1201
+ type: u.alphabetical,
1182
1202
  "ignore-case": !1,
1183
- order: c.asc,
1203
+ order: g.asc,
1184
1204
  "custom-groups": {},
1185
1205
  groups: []
1186
- }), l = o.openingElement.attributes.reduce(
1187
- (r, e) => {
1188
- if (e.type === "JSXSpreadAttribute")
1206
+ }), l = i.openingElement.attributes.reduce(
1207
+ (r, t) => {
1208
+ if (t.type === "JSXSpreadAttribute")
1189
1209
  return r.push([]), r;
1190
- let a = e.name.type === "JSXNamespacedName" ? `${e.name.namespace.name}:${e.name.name.name}` : e.name.name, { getGroup: p, defineGroup: n, setCustomGroups: u } = M(
1210
+ let a = t.name.type === "JSXNamespacedName" ? `${t.name.namespace.name}:${t.name.name.name}` : t.name.name, { getGroup: n, defineGroup: o, setCustomGroups: p } = G(
1191
1211
  s.groups
1192
1212
  );
1193
- u(s["custom-groups"], a), e.value === null && n("shorthand"), e.loc.start.line !== e.loc.end.line && n("multiline");
1194
- let y = {
1195
- size: O(e.range),
1196
- group: p(),
1197
- node: e,
1213
+ p(s["custom-groups"], a), t.value === null && o("shorthand"), t.loc.start.line !== t.loc.end.line && o("multiline");
1214
+ let f = {
1215
+ size: I(t.range),
1216
+ group: n(),
1217
+ node: t,
1198
1218
  name: a
1199
1219
  };
1200
- return r.at(-1).push(y), r;
1220
+ return r.at(-1).push(f), r;
1201
1221
  },
1202
1222
  [[]]
1203
1223
  );
1204
1224
  for (let r of l)
1205
- P(r, (e, a) => {
1206
- let p = E(s.groups, e), n = E(s.groups, a);
1207
- (p > n || p === n && j(A(e, a, s))) && t.report({
1225
+ P(r, (t, a) => {
1226
+ let n = h(s.groups, t), o = h(s.groups, a);
1227
+ (n > o || n === o && O(S(t, a, s))) && e.report({
1208
1228
  messageId: "unexpectedJSXPropsOrder",
1209
1229
  data: {
1210
- left: e.name,
1230
+ left: t.name,
1211
1231
  right: a.name
1212
1232
  },
1213
1233
  node: a.node,
1214
- fix: (u) => {
1215
- let y = {};
1216
- for (let f of r) {
1217
- let d = E(s.groups, f);
1218
- d in y ? y[d] = w(
1219
- [...y[d], f],
1234
+ fix: (p) => {
1235
+ let f = {};
1236
+ for (let d of r) {
1237
+ let c = h(s.groups, d);
1238
+ c in f ? f[c] = v(
1239
+ [...f[c], d],
1220
1240
  s
1221
- ) : y[d] = [f];
1241
+ ) : f[c] = [d];
1222
1242
  }
1223
- let m = [];
1224
- for (let f of Object.keys(y).sort(
1225
- (d, g) => Number(d) - Number(g)
1243
+ let y = [];
1244
+ for (let d of Object.keys(f).sort(
1245
+ (c, m) => Number(c) - Number(m)
1226
1246
  ))
1227
- m.push(...w(y[f], s));
1228
- return L(
1229
- u,
1247
+ y.push(...v(f[d], s));
1248
+ return M(
1249
+ p,
1230
1250
  r,
1231
- m,
1232
- t.sourceCode
1251
+ y,
1252
+ e.sourceCode
1233
1253
  );
1234
1254
  }
1235
1255
  });
@@ -1237,8 +1257,8 @@ const Z = "sort-object-types", Ee = v({
1237
1257
  }
1238
1258
  }
1239
1259
  }
1240
- }), re = "sort-exports", Se = v({
1241
- name: re,
1260
+ }), ae = "sort-exports", Se = A({
1261
+ name: ae,
1242
1262
  meta: {
1243
1263
  type: "suggestion",
1244
1264
  docs: {
@@ -1251,16 +1271,16 @@ const Z = "sort-object-types", Ee = v({
1251
1271
  properties: {
1252
1272
  type: {
1253
1273
  enum: [
1254
- i.alphabetical,
1255
- i.natural,
1256
- i["line-length"]
1274
+ u.alphabetical,
1275
+ u.natural,
1276
+ u["line-length"]
1257
1277
  ],
1258
- default: i.alphabetical,
1278
+ default: u.alphabetical,
1259
1279
  type: "string"
1260
1280
  },
1261
1281
  order: {
1262
- enum: [c.asc, c.desc],
1263
- default: c.asc,
1282
+ enum: [g.asc, g.desc],
1283
+ default: g.asc,
1264
1284
  type: "string"
1265
1285
  },
1266
1286
  "ignore-case": {
@@ -1277,18 +1297,18 @@ const Z = "sort-object-types", Ee = v({
1277
1297
  },
1278
1298
  defaultOptions: [
1279
1299
  {
1280
- type: i.alphabetical,
1281
- order: c.asc
1300
+ type: u.alphabetical,
1301
+ order: g.asc
1282
1302
  }
1283
1303
  ],
1284
- create: (t) => {
1285
- let o = k(t.options.at(0), {
1286
- type: i.alphabetical,
1287
- order: c.asc,
1304
+ create: (e) => {
1305
+ let i = j(e.options.at(0), {
1306
+ type: u.alphabetical,
1307
+ order: g.asc,
1288
1308
  "ignore-case": !1
1289
1309
  }), s = [[]], l = (r) => {
1290
1310
  r.type === "ExportAllDeclaration" && r.exported === null ? s.push([]) : s.at(-1).push({
1291
- size: O(r.range),
1311
+ size: I(r.range),
1292
1312
  name: r.source.value,
1293
1313
  node: r
1294
1314
  });
@@ -1300,27 +1320,27 @@ const Z = "sort-object-types", Ee = v({
1300
1320
  },
1301
1321
  "Program:exit": () => {
1302
1322
  for (let r of s)
1303
- P(r, (e, a) => {
1304
- j(A(e, a, o)) && t.report({
1323
+ P(r, (t, a) => {
1324
+ O(S(t, a, i)) && e.report({
1305
1325
  messageId: "unexpectedExportsOrder",
1306
1326
  data: {
1307
- left: e.name,
1327
+ left: t.name,
1308
1328
  right: a.name
1309
1329
  },
1310
1330
  node: a.node,
1311
- fix: (p) => L(
1312
- p,
1331
+ fix: (n) => M(
1332
+ n,
1313
1333
  r,
1314
- w(r, o),
1315
- t.sourceCode
1334
+ v(r, i),
1335
+ e.sourceCode
1316
1336
  )
1317
1337
  });
1318
1338
  });
1319
1339
  }
1320
1340
  };
1321
1341
  }
1322
- }), se = "sort-imports", Ae = v({
1323
- name: se,
1342
+ }), oe = "sort-imports", ke = A({
1343
+ name: oe,
1324
1344
  meta: {
1325
1345
  type: "suggestion",
1326
1346
  docs: {
@@ -1346,16 +1366,16 @@ const Z = "sort-object-types", Ee = v({
1346
1366
  },
1347
1367
  type: {
1348
1368
  enum: [
1349
- i.alphabetical,
1350
- i.natural,
1351
- i["line-length"]
1369
+ u.alphabetical,
1370
+ u.natural,
1371
+ u["line-length"]
1352
1372
  ],
1353
- default: i.alphabetical,
1373
+ default: u.alphabetical,
1354
1374
  type: "string"
1355
1375
  },
1356
1376
  order: {
1357
- enum: [c.asc, c.desc],
1358
- default: c.asc,
1377
+ enum: [g.asc, g.desc],
1378
+ default: g.asc,
1359
1379
  type: "string"
1360
1380
  },
1361
1381
  "ignore-case": {
@@ -1398,7 +1418,7 @@ const Z = "sort-object-types", Ee = v({
1398
1418
  definitions: {
1399
1419
  "is-line-length": {
1400
1420
  properties: {
1401
- type: { enum: [i["line-length"]], type: "string" }
1421
+ type: { enum: [u["line-length"]], type: "string" }
1402
1422
  },
1403
1423
  required: ["type"],
1404
1424
  type: "object"
@@ -1423,31 +1443,31 @@ const Z = "sort-object-types", Ee = v({
1423
1443
  },
1424
1444
  defaultOptions: [
1425
1445
  {
1426
- type: i.alphabetical,
1427
- order: c.asc
1446
+ type: u.alphabetical,
1447
+ order: g.asc
1428
1448
  }
1429
1449
  ],
1430
- create: (t) => {
1431
- let o = k(t.options.at(0), {
1450
+ create: (e) => {
1451
+ let i = j(e.options.at(0), {
1432
1452
  "newlines-between": "always",
1433
1453
  "custom-groups": { type: {}, value: {} },
1434
1454
  "internal-pattern": ["~/**"],
1435
- type: i.alphabetical,
1436
- order: c.asc,
1455
+ type: u.alphabetical,
1456
+ order: g.asc,
1437
1457
  "ignore-case": !1,
1438
1458
  groups: []
1439
1459
  }), s = !1;
1440
- for (let n of o.groups)
1441
- if (Array.isArray(n))
1442
- for (let u of n)
1443
- u === "unknown" && (s = !0);
1460
+ for (let o of i.groups)
1461
+ if (Array.isArray(o))
1462
+ for (let p of o)
1463
+ p === "unknown" && (s = !0);
1444
1464
  else
1445
- n === "unknown" && (s = !0);
1446
- s || (o.groups = [...o.groups, "unknown"]);
1447
- let l = [], r = (n) => n.type === "ImportDeclaration" && n.specifiers.length === 0, e = (n) => {
1448
- let u = (x) => [".less", ".scss", ".sass", ".styl", ".pcss", ".css", ".sss"].some(
1449
- (S) => x.endsWith(S)
1450
- ), y = (x) => [
1465
+ o === "unknown" && (s = !0);
1466
+ s || (i.groups = [...i.groups, "unknown"]);
1467
+ let l = [], r = (o) => o.type === "ImportDeclaration" && o.specifiers.length === 0, t = (o) => {
1468
+ let p = (E) => [".less", ".scss", ".sass", ".styl", ".pcss", ".css", ".sss"].some(
1469
+ (w) => E.endsWith(w)
1470
+ ), f = (E) => [
1451
1471
  "./index.d.js",
1452
1472
  "./index.d.ts",
1453
1473
  "./index.js",
@@ -1455,12 +1475,12 @@ const Z = "sort-object-types", Ee = v({
1455
1475
  "./index",
1456
1476
  "./",
1457
1477
  "."
1458
- ].includes(x), m = (x) => x.indexOf("..") === 0, f = (x) => x.indexOf("./") === 0, { getGroup: d, defineGroup: g, setCustomGroups: b } = M(o.groups), N = (x) => o["internal-pattern"].length && o["internal-pattern"].some(
1459
- (S) => $(x.source.value, S, {
1478
+ ].includes(E), y = (E) => E.indexOf("..") === 0, d = (E) => E.indexOf("./") === 0, { getGroup: c, defineGroup: m, setCustomGroups: x } = G(i.groups), C = (E) => i["internal-pattern"].length && i["internal-pattern"].some(
1479
+ (w) => D(E.source.value, w, {
1460
1480
  nocomment: !0
1461
1481
  })
1462
- ), h = (x) => {
1463
- let S = [
1482
+ ), b = (E) => {
1483
+ let w = [
1464
1484
  "bun",
1465
1485
  "bun:ffi",
1466
1486
  "bun:jsc",
@@ -1471,98 +1491,98 @@ const Z = "sort-object-types", Ee = v({
1471
1491
  "undici",
1472
1492
  "ws"
1473
1493
  ];
1474
- return ce.includes(
1475
- x.startsWith("node:") ? x.split("node:")[1] : x
1476
- ) || S.includes(x);
1477
- }, C = (x) => !(x.startsWith(".") || x.startsWith("/"));
1478
- return n.importKind === "type" && (n.type === "ImportDeclaration" && (b(o["custom-groups"].type, n.source.value), y(n.source.value) && g("index-type"), f(n.source.value) && g("sibling-type"), m(n.source.value) && g("parent-type"), N(n) && g("internal-type"), h(n.source.value) && g("builtin-type"), C(n.source.value) && g("external-type")), g("type")), n.type === "ImportDeclaration" && (b(o["custom-groups"].value, n.source.value), r(n) && u(n.source.value) && g("side-effect-style"), r(n) && g("side-effect"), u(n.source.value) && g("style"), y(n.source.value) && g("index"), f(n.source.value) && g("sibling"), m(n.source.value) && g("parent"), N(n) && g("internal"), h(n.source.value) && g("builtin"), C(n.source.value) && g("external")), d();
1479
- }, a = (n) => n.specifiers.length > 1, p = (n) => {
1480
- let u;
1481
- n.type === "ImportDeclaration" ? u = n.source.value : n.moduleReference.type === "TSExternalModuleReference" && n.moduleReference.expression.type === "Literal" ? u = `${n.moduleReference.expression.value}` : u = t.sourceCode.text.slice(...n.moduleReference.range), l.push({
1482
- size: O(n.range),
1483
- group: e(n),
1484
- name: u,
1485
- node: n,
1486
- ...o.type === i["line-length"] && o["max-line-length"] && {
1494
+ return fe.includes(
1495
+ E.startsWith("node:") ? E.split("node:")[1] : E
1496
+ ) || w.includes(E);
1497
+ }, N = (E) => !(E.startsWith(".") || E.startsWith("/"));
1498
+ return o.importKind === "type" && (o.type === "ImportDeclaration" && (x(i["custom-groups"].type, o.source.value), f(o.source.value) && m("index-type"), d(o.source.value) && m("sibling-type"), y(o.source.value) && m("parent-type"), C(o) && m("internal-type"), b(o.source.value) && m("builtin-type"), N(o.source.value) && m("external-type")), m("type")), o.type === "ImportDeclaration" && (x(i["custom-groups"].value, o.source.value), r(o) && p(o.source.value) && m("side-effect-style"), r(o) && m("side-effect"), p(o.source.value) && m("style"), f(o.source.value) && m("index"), d(o.source.value) && m("sibling"), y(o.source.value) && m("parent"), C(o) && m("internal"), b(o.source.value) && m("builtin"), N(o.source.value) && m("external")), c();
1499
+ }, a = (o) => o.specifiers.length > 1, n = (o) => {
1500
+ let p;
1501
+ o.type === "ImportDeclaration" ? p = o.source.value : o.moduleReference.type === "TSExternalModuleReference" && o.moduleReference.expression.type === "Literal" ? p = `${o.moduleReference.expression.value}` : p = e.sourceCode.text.slice(...o.moduleReference.range), l.push({
1502
+ size: I(o.range),
1503
+ group: t(o),
1504
+ name: p,
1505
+ node: o,
1506
+ ...i.type === u["line-length"] && i["max-line-length"] && {
1487
1507
  hasMultipleImportDeclarations: a(
1488
- n
1508
+ o
1489
1509
  )
1490
1510
  }
1491
1511
  });
1492
1512
  };
1493
1513
  return {
1494
- TSImportEqualsDeclaration: p,
1495
- ImportDeclaration: p,
1514
+ TSImportEqualsDeclaration: n,
1515
+ ImportDeclaration: n,
1496
1516
  "Program:exit": () => {
1497
- var m;
1498
- let n = (f, d) => !!t.sourceCode.getTokensBetween(
1499
- f.node,
1500
- J(d.node, t.sourceCode) || d.node,
1517
+ var y;
1518
+ let o = (d, c) => !!e.sourceCode.getTokensBetween(
1519
+ d.node,
1520
+ V(c.node, e.sourceCode) || c.node,
1501
1521
  {
1502
1522
  includeComments: !0
1503
1523
  }
1504
- ).length, u = (f, d) => {
1505
- let g = [], b = {};
1506
- for (let h of d) {
1507
- let C = E(o.groups, h);
1508
- C in b ? b[C] = w(
1509
- [...b[C], h],
1510
- o
1511
- ) : b[C] = [h];
1524
+ ).length, p = (d, c) => {
1525
+ let m = [], x = {};
1526
+ for (let b of c) {
1527
+ let N = h(i.groups, b);
1528
+ N in x ? x[N] = v(
1529
+ [...x[N], b],
1530
+ i
1531
+ ) : x[N] = [b];
1512
1532
  }
1513
- let N = Object.keys(b).sort((h, C) => Number(h) - Number(C)).reduce(
1514
- (h, C) => [
1515
- ...h,
1516
- ...b[C]
1533
+ let C = Object.keys(x).sort((b, N) => Number(b) - Number(N)).reduce(
1534
+ (b, N) => [
1535
+ ...b,
1536
+ ...x[N]
1517
1537
  ],
1518
1538
  []
1519
1539
  );
1520
- for (let h = 0, C = N.length; h < C; h++) {
1521
- let x = N.at(h);
1522
- if (g.push(
1523
- f.replaceTextRange(
1524
- T(d.at(h).node, t.sourceCode),
1525
- t.sourceCode.text.slice(
1526
- ...T(x.node, t.sourceCode)
1540
+ for (let b = 0, N = C.length; b < N; b++) {
1541
+ let E = C.at(b);
1542
+ if (m.push(
1543
+ d.replaceTextRange(
1544
+ T(c.at(b).node, e.sourceCode),
1545
+ e.sourceCode.text.slice(
1546
+ ...T(E.node, e.sourceCode)
1527
1547
  )
1528
1548
  )
1529
- ), o["newlines-between"] !== "ignore") {
1530
- let S = N.at(h + 1);
1531
- if (S) {
1532
- let G = z(
1533
- t.sourceCode,
1534
- d.at(h),
1535
- d.at(h + 1)
1549
+ ), i["newlines-between"] !== "ignore") {
1550
+ let w = C.at(b + 1);
1551
+ if (w) {
1552
+ let R = z(
1553
+ e.sourceCode,
1554
+ c.at(b),
1555
+ c.at(b + 1)
1536
1556
  );
1537
- (o["newlines-between"] === "always" && E(o.groups, x) === E(o.groups, S) && G !== 0 || o["newlines-between"] === "never" && G > 0) && g.push(
1538
- f.removeRange([
1557
+ (i["newlines-between"] === "always" && h(i.groups, E) === h(i.groups, w) && R !== 0 || i["newlines-between"] === "never" && R > 0) && m.push(
1558
+ d.removeRange([
1539
1559
  T(
1540
- d.at(h).node,
1541
- t.sourceCode
1560
+ c.at(b).node,
1561
+ e.sourceCode
1542
1562
  ).at(1),
1543
1563
  T(
1544
- d.at(h + 1).node,
1545
- t.sourceCode
1564
+ c.at(b + 1).node,
1565
+ e.sourceCode
1546
1566
  ).at(0) - 1
1547
1567
  ])
1548
- ), o["newlines-between"] === "always" && E(o.groups, x) !== E(o.groups, S) && G > 1 && g.push(
1549
- f.replaceTextRange(
1568
+ ), i["newlines-between"] === "always" && h(i.groups, E) !== h(i.groups, w) && R > 1 && m.push(
1569
+ d.replaceTextRange(
1550
1570
  [
1551
1571
  T(
1552
- d.at(h).node,
1553
- t.sourceCode
1572
+ c.at(b).node,
1573
+ e.sourceCode
1554
1574
  ).at(1),
1555
1575
  T(
1556
- d.at(h + 1).node,
1557
- t.sourceCode
1576
+ c.at(b + 1).node,
1577
+ e.sourceCode
1558
1578
  ).at(0) - 1
1559
1579
  ],
1560
1580
  `
1561
1581
  `
1562
1582
  )
1563
- ), o["newlines-between"] === "always" && E(o.groups, x) !== E(o.groups, S) && G === 0 && g.push(
1564
- f.insertTextAfterRange(
1565
- T(d.at(h).node, t.sourceCode),
1583
+ ), i["newlines-between"] === "always" && h(i.groups, E) !== h(i.groups, w) && R === 0 && m.push(
1584
+ d.insertTextAfterRange(
1585
+ T(c.at(b).node, e.sourceCode),
1566
1586
  `
1567
1587
  `
1568
1588
  )
@@ -1570,58 +1590,58 @@ const Z = "sort-object-types", Ee = v({
1570
1590
  }
1571
1591
  }
1572
1592
  }
1573
- return g;
1574
- }, y = [[]];
1575
- for (let f of l) {
1576
- let d = (m = y.at(-1)) == null ? void 0 : m.at(-1);
1577
- d && n(d, f) ? y.push([f]) : y.at(-1).push(f);
1593
+ return m;
1594
+ }, f = [[]];
1595
+ for (let d of l) {
1596
+ let c = (y = f.at(-1)) == null ? void 0 : y.at(-1);
1597
+ c && o(c, d) ? f.push([d]) : f.at(-1).push(d);
1578
1598
  }
1579
- for (let f of y)
1580
- P(f, (d, g) => {
1581
- let b = E(o.groups, d), N = E(o.groups, g), h = z(
1582
- t.sourceCode,
1583
- d,
1584
- g
1599
+ for (let d of f)
1600
+ P(d, (c, m) => {
1601
+ let x = h(i.groups, c), C = h(i.groups, m), b = z(
1602
+ e.sourceCode,
1603
+ c,
1604
+ m
1585
1605
  );
1586
- !(r(d.node) && r(g.node)) && !n(d, g) && (b > N || b === N && j(A(d, g, o))) && t.report({
1606
+ !(r(c.node) && r(m.node)) && !o(c, m) && (x > C || x === C && O(S(c, m, i))) && e.report({
1587
1607
  messageId: "unexpectedImportsOrder",
1588
1608
  data: {
1589
- left: d.name,
1590
- right: g.name
1609
+ left: c.name,
1610
+ right: m.name
1591
1611
  },
1592
- node: g.node,
1593
- fix: (C) => u(C, f)
1594
- }), o["newlines-between"] === "never" && h > 0 && t.report({
1612
+ node: m.node,
1613
+ fix: (N) => p(N, d)
1614
+ }), i["newlines-between"] === "never" && b > 0 && e.report({
1595
1615
  messageId: "extraSpacingBetweenImports",
1596
1616
  data: {
1597
- left: d.name,
1598
- right: g.name
1617
+ left: c.name,
1618
+ right: m.name
1599
1619
  },
1600
- node: g.node,
1601
- fix: (C) => u(C, f)
1602
- }), o["newlines-between"] === "always" && (b < N && h === 0 ? t.report({
1620
+ node: m.node,
1621
+ fix: (N) => p(N, d)
1622
+ }), i["newlines-between"] === "always" && (x < C && b === 0 ? e.report({
1603
1623
  messageId: "missedSpacingBetweenImports",
1604
1624
  data: {
1605
- left: d.name,
1606
- right: g.name
1625
+ left: c.name,
1626
+ right: m.name
1607
1627
  },
1608
- node: g.node,
1609
- fix: (C) => u(C, f)
1610
- }) : (h > 1 || b === N && h > 0) && t.report({
1628
+ node: m.node,
1629
+ fix: (N) => p(N, d)
1630
+ }) : (b > 1 || x === C && b > 0) && e.report({
1611
1631
  messageId: "extraSpacingBetweenImports",
1612
1632
  data: {
1613
- left: d.name,
1614
- right: g.name
1633
+ left: c.name,
1634
+ right: m.name
1615
1635
  },
1616
- node: g.node,
1617
- fix: (C) => u(C, f)
1636
+ node: m.node,
1637
+ fix: (N) => p(N, d)
1618
1638
  }));
1619
1639
  });
1620
1640
  }
1621
1641
  };
1622
1642
  }
1623
- }), ae = "sort-objects", Ie = v({
1624
- name: ae,
1643
+ }), ne = "sort-objects", Ae = A({
1644
+ name: ne,
1625
1645
  meta: {
1626
1646
  type: "suggestion",
1627
1647
  docs: {
@@ -1649,16 +1669,16 @@ const Z = "sort-object-types", Ee = v({
1649
1669
  },
1650
1670
  type: {
1651
1671
  enum: [
1652
- i.alphabetical,
1653
- i.natural,
1654
- i["line-length"]
1672
+ u.alphabetical,
1673
+ u.natural,
1674
+ u["line-length"]
1655
1675
  ],
1656
- default: i.alphabetical,
1676
+ default: u.alphabetical,
1657
1677
  type: "string"
1658
1678
  },
1659
1679
  order: {
1660
- enum: [c.asc, c.desc],
1661
- default: c.asc,
1680
+ enum: [g.asc, g.desc],
1681
+ default: g.asc,
1662
1682
  type: "string"
1663
1683
  },
1664
1684
  "ignore-case": {
@@ -1684,139 +1704,139 @@ const Z = "sort-object-types", Ee = v({
1684
1704
  },
1685
1705
  defaultOptions: [
1686
1706
  {
1687
- type: i.alphabetical,
1688
- order: c.asc
1707
+ type: u.alphabetical,
1708
+ order: g.asc
1689
1709
  }
1690
1710
  ],
1691
- create: (t) => {
1692
- let o = (s) => {
1693
- let l = k(t.options.at(0), {
1711
+ create: (e) => {
1712
+ let i = (s) => {
1713
+ let l = j(e.options.at(0), {
1694
1714
  "partition-by-new-line": !1,
1695
1715
  "partition-by-comment": !1,
1696
- type: i.alphabetical,
1716
+ type: u.alphabetical,
1697
1717
  "styled-components": !0,
1698
1718
  "ignore-case": !1,
1699
1719
  "ignore-pattern": [],
1700
- order: c.asc,
1720
+ order: g.asc,
1701
1721
  "custom-groups": {},
1702
1722
  groups: []
1703
1723
  }), r = s.parent.type === "VariableDeclarator" && s.parent.id.type === "Identifier" ? s.parent.id.name : null;
1704
1724
  if (!(l["ignore-pattern"].length && typeof r == "string" ? l["ignore-pattern"].some(
1705
- (a) => $(r, a, {
1725
+ (a) => D(r, a, {
1706
1726
  nocomment: !0
1707
1727
  })
1708
1728
  ) : !1) && s.properties.length > 1) {
1709
- let a = (u) => u.type === "Identifier" && u.name === "styled", p = (u) => u !== void 0 && u.type === "CallExpression" && (u.callee.type === "MemberExpression" && a(u.callee.object) || u.callee.type === "CallExpression" && a(u.callee.callee));
1710
- if (!l["styled-components"] && (p(s.parent) || s.parent.type === "ArrowFunctionExpression" && p(s.parent.parent)))
1729
+ let a = (p) => p.type === "Identifier" && p.name === "styled", n = (p) => p !== void 0 && p.type === "CallExpression" && (p.callee.type === "MemberExpression" && a(p.callee.object) || p.callee.type === "CallExpression" && a(p.callee.callee));
1730
+ if (!l["styled-components"] && (n(s.parent) || s.parent.type === "ArrowFunctionExpression" && n(s.parent.parent)))
1711
1731
  return;
1712
- let n = (u) => u.reduce(
1713
- (y, m) => {
1714
- var G;
1715
- if (m.type === "SpreadElement" || m.type === "RestElement")
1716
- return y.push([]), y;
1717
- let f = J(m, t.sourceCode), d = (G = y.at(-1)) == null ? void 0 : G.at(-1);
1718
- l["partition-by-comment"] && f && pe(
1732
+ let o = (p) => p.reduce(
1733
+ (f, y) => {
1734
+ var R;
1735
+ if (y.type === "SpreadElement" || y.type === "RestElement")
1736
+ return f.push([]), f;
1737
+ let d = V(y, e.sourceCode), c = (R = f.at(-1)) == null ? void 0 : R.at(-1);
1738
+ l["partition-by-comment"] && d && X(
1719
1739
  l["partition-by-comment"],
1720
- f.value
1721
- ) && y.push([]);
1722
- let g, b = "ignore", N = [], { getGroup: h, setCustomGroups: C } = M(l.groups);
1723
- m.key.type === "Identifier" ? { name: g } = m.key : m.key.type === "Literal" ? g = `${m.key.value}` : g = t.sourceCode.text.slice(...m.key.range);
1724
- let x = {
1725
- size: O(m.range),
1726
- node: m,
1727
- name: g
1740
+ d.value
1741
+ ) && f.push([]);
1742
+ let m, x = "ignore", C = [], { getGroup: b, setCustomGroups: N } = G(l.groups);
1743
+ y.key.type === "Identifier" ? { name: m } = y.key : y.key.type === "Literal" ? m = `${y.key.value}` : m = e.sourceCode.text.slice(...y.key.range);
1744
+ let E = {
1745
+ size: I(y.range),
1746
+ node: y,
1747
+ name: m
1728
1748
  };
1729
- l["partition-by-new-line"] && d && z(t.sourceCode, d, x) && y.push([]), m.value.type === "AssignmentPattern" && ((B) => {
1730
- B.right.type === "Identifier" && N.push(B.right.name);
1731
- let ie = (R) => {
1732
- let D = [];
1733
- switch (R.type) {
1749
+ l["partition-by-new-line"] && c && z(e.sourceCode, c, E) && f.push([]), y.value.type === "AssignmentPattern" && ((_) => {
1750
+ _.right.type === "Identifier" && C.push(_.right.name);
1751
+ let ue = ($) => {
1752
+ let B = [];
1753
+ switch ($.type) {
1734
1754
  case "ArrowFunctionExpression":
1735
- D.push(R.body);
1755
+ B.push($.body);
1736
1756
  break;
1737
1757
  case "ConditionalExpression":
1738
- D.push(R.consequent, R.alternate);
1758
+ B.push($.consequent, $.alternate);
1739
1759
  break;
1740
1760
  case "LogicalExpression":
1741
1761
  case "BinaryExpression":
1742
- D.push(R.left, R.right);
1762
+ B.push($.left, $.right);
1743
1763
  break;
1744
1764
  case "CallExpression":
1745
- D.push(...R.arguments);
1765
+ B.push(...$.arguments);
1746
1766
  break;
1747
1767
  }
1748
- D.forEach((U) => {
1749
- U.type === "Identifier" && N.push(U.name), (U.type === "BinaryExpression" || U.type === "ConditionalExpression") && ie(U);
1768
+ B.forEach((U) => {
1769
+ U.type === "Identifier" && C.push(U.name), (U.type === "BinaryExpression" || U.type === "ConditionalExpression") && ue(U);
1750
1770
  });
1751
1771
  };
1752
- switch (B.right.type) {
1772
+ switch (_.right.type) {
1753
1773
  case "ArrowFunctionExpression":
1754
1774
  case "ConditionalExpression":
1755
1775
  case "LogicalExpression":
1756
1776
  case "BinaryExpression":
1757
1777
  case "CallExpression":
1758
- ie(B.right);
1778
+ ue(_.right);
1759
1779
  break;
1760
1780
  }
1761
- })(m.value), C(l["custom-groups"], g);
1762
- let S = {
1763
- ...x,
1764
- group: h(),
1765
- dependencies: N,
1766
- position: b
1781
+ })(y.value), N(l["custom-groups"], m);
1782
+ let w = {
1783
+ ...E,
1784
+ group: b(),
1785
+ dependencies: C,
1786
+ position: x
1767
1787
  };
1768
- return y.at(-1).push(S), y;
1788
+ return f.at(-1).push(w), f;
1769
1789
  },
1770
1790
  [[]]
1771
1791
  );
1772
- for (let u of n(s.properties))
1773
- P(u, (y, m) => {
1774
- let f = E(l.groups, y), d = E(l.groups, m);
1775
- if (f > d || f === d && j(A(y, m, l))) {
1776
- let g = (b) => {
1777
- let N = {};
1778
- for (let C of u) {
1779
- let x = E(l.groups, C);
1780
- x in N ? N[x] = w(
1781
- [...N[x], C],
1792
+ for (let p of o(s.properties))
1793
+ P(p, (f, y) => {
1794
+ let d = h(l.groups, f), c = h(l.groups, y);
1795
+ if (d > c || d === c && O(S(f, y, l))) {
1796
+ let m = (x) => {
1797
+ let C = {};
1798
+ for (let N of p) {
1799
+ let E = h(l.groups, N);
1800
+ E in C ? C[E] = v(
1801
+ [...C[E], N],
1782
1802
  l
1783
- ) : N[x] = [C];
1803
+ ) : C[E] = [N];
1784
1804
  }
1785
- let h = [];
1786
- for (let C of Object.keys(N).sort(
1787
- (x, S) => Number(x) - Number(S)
1805
+ let b = [];
1806
+ for (let N of Object.keys(C).sort(
1807
+ (E, w) => Number(E) - Number(w)
1788
1808
  ))
1789
- h.push(...w(N[C], l));
1790
- return L(
1809
+ b.push(...v(C[N], l));
1810
+ return M(
1811
+ x,
1812
+ p,
1791
1813
  b,
1792
- u,
1793
- h,
1794
- t.sourceCode,
1814
+ e.sourceCode,
1795
1815
  {
1796
1816
  partitionComment: l["partition-by-comment"]
1797
1817
  }
1798
1818
  );
1799
1819
  };
1800
- t.report({
1820
+ e.report({
1801
1821
  messageId: "unexpectedObjectsOrder",
1802
1822
  data: {
1803
- left: I(y.name),
1804
- right: I(m.name)
1823
+ left: k(f.name),
1824
+ right: k(y.name)
1805
1825
  },
1806
- node: m.node,
1807
- fix: g
1826
+ node: y.node,
1827
+ fix: m
1808
1828
  });
1809
1829
  }
1810
1830
  });
1811
1831
  }
1812
1832
  };
1813
1833
  return {
1814
- ObjectExpression: o,
1815
- ObjectPattern: o
1834
+ ObjectExpression: i,
1835
+ ObjectPattern: i
1816
1836
  };
1817
1837
  }
1818
- }), oe = "sort-classes", ve = v({
1819
- name: oe,
1838
+ }), le = "sort-classes", Ie = A({
1839
+ name: le,
1820
1840
  meta: {
1821
1841
  type: "suggestion",
1822
1842
  docs: {
@@ -1829,11 +1849,11 @@ const Z = "sort-object-types", Ee = v({
1829
1849
  properties: {
1830
1850
  type: {
1831
1851
  enum: [
1832
- i.alphabetical,
1833
- i.natural,
1834
- i["line-length"]
1852
+ u.alphabetical,
1853
+ u.natural,
1854
+ u["line-length"]
1835
1855
  ],
1836
- default: i.alphabetical,
1856
+ default: u.alphabetical,
1837
1857
  type: "string"
1838
1858
  },
1839
1859
  "ignore-case": {
@@ -1841,8 +1861,8 @@ const Z = "sort-object-types", Ee = v({
1841
1861
  default: !1
1842
1862
  },
1843
1863
  order: {
1844
- enum: [c.asc, c.desc],
1845
- default: c.asc,
1864
+ enum: [g.asc, g.desc],
1865
+ default: g.asc,
1846
1866
  type: "string"
1847
1867
  },
1848
1868
  groups: {
@@ -1859,86 +1879,86 @@ const Z = "sort-object-types", Ee = v({
1859
1879
  },
1860
1880
  defaultOptions: [
1861
1881
  {
1862
- type: i.alphabetical,
1863
- order: c.asc
1882
+ type: u.alphabetical,
1883
+ order: g.asc
1864
1884
  }
1865
1885
  ],
1866
- create: (t) => ({
1867
- ClassBody: (o) => {
1868
- if (o.body.length > 1) {
1869
- let s = k(t.options.at(0), {
1870
- type: i.alphabetical,
1871
- order: c.asc,
1886
+ create: (e) => ({
1887
+ ClassBody: (i) => {
1888
+ if (i.body.length > 1) {
1889
+ let s = j(e.options.at(0), {
1890
+ type: u.alphabetical,
1891
+ order: g.asc,
1872
1892
  "ignore-case": !1,
1873
1893
  groups: ["property", "constructor", "method", "unknown"]
1874
- }), l = o.body.map((r) => {
1875
- var u;
1876
- let e, { getGroup: a, defineGroup: p } = M(s.groups);
1877
- r.type === "StaticBlock" ? e = "static" : r.type === "TSIndexSignature" ? e = t.sourceCode.text.slice(
1894
+ }), l = i.body.map((r) => {
1895
+ var f;
1896
+ let t, { getGroup: a, defineGroup: n } = G(s.groups);
1897
+ r.type === "StaticBlock" ? t = "static" : r.type === "TSIndexSignature" ? t = e.sourceCode.text.slice(
1878
1898
  r.range.at(0),
1879
- ((u = r.typeAnnotation) == null ? void 0 : u.range.at(0)) ?? r.range.at(1)
1880
- ) : r.key.type === "Identifier" ? { name: e } = r.key : e = t.sourceCode.text.slice(...r.key.range);
1881
- let n = e.startsWith("_") || e.startsWith("#");
1899
+ ((f = r.typeAnnotation) == null ? void 0 : f.range.at(0)) ?? r.range.at(1)
1900
+ ) : r.key.type === "Identifier" ? { name: t } = r.key : t = e.sourceCode.text.slice(...r.key.range);
1901
+ let o = t.startsWith("_") || t.startsWith("#"), p = "decorators" in r && r.decorators.length > 0;
1882
1902
  if (r.type === "MethodDefinition") {
1883
- r.kind === "constructor" && p("constructor");
1884
- let y = r.accessibility === "private" || n, m = r.static;
1885
- y && m && p("static-private-method"), y && p("private-method"), m && p("static-method"), r.kind === "get" && p("get-method"), r.kind === "set" && p("set-method"), p("method");
1903
+ r.kind === "constructor" && n("constructor");
1904
+ let y = r.accessibility === "private" || o, d = r.static;
1905
+ p && (r.kind === "get" && n("decorated-get-method"), r.kind === "set" && n("decorated-set-method"), n("decorated-method")), y && d && n("static-private-method"), y && n("private-method"), d && n("static-method"), r.kind === "get" && n("get-method"), r.kind === "set" && n("set-method"), n("method");
1886
1906
  } else
1887
- r.type === "TSIndexSignature" ? p("index-signature") : r.type === "PropertyDefinition" && ((r.accessibility === "private" || n) && p("private-property"), r.static && p("static-property"), p("property"));
1907
+ r.type === "TSIndexSignature" ? n("index-signature") : r.type === "AccessorProperty" ? p && ((r.accessibility === "private" || o) && n("private-decorated-accessor-property"), n("decorated-accessor-property")) : r.type === "PropertyDefinition" && (p && ((r.accessibility === "private" || o) && n("private-decorated-property"), n("decorated-property")), (r.accessibility === "private" || o) && n("private-property"), r.static && n("static-property"), n("property"));
1888
1908
  return {
1889
- size: O(r.range),
1909
+ size: I(r.range),
1890
1910
  group: a(),
1891
1911
  node: r,
1892
- name: e
1912
+ name: t
1893
1913
  };
1894
1914
  });
1895
- P(l, (r, e) => {
1896
- let a = E(s.groups, r), p = E(s.groups, e);
1897
- r.name !== e.name && (a > p || a === p && j(A(r, e, s))) && t.report({
1915
+ P(l, (r, t) => {
1916
+ let a = h(s.groups, r), n = h(s.groups, t);
1917
+ r.name !== t.name && (a > n || a === n && O(S(r, t, s))) && e.report({
1898
1918
  messageId: "unexpectedClassesOrder",
1899
1919
  data: {
1900
- left: I(r.name),
1901
- right: I(e.name)
1920
+ left: k(r.name),
1921
+ right: k(t.name)
1902
1922
  },
1903
- node: e.node,
1904
- fix: (n) => {
1905
- let u = [], y = l.reduce(
1906
- (f, d) => {
1907
- let g = E(s.groups, d);
1908
- return g in f ? f[g] = w(
1909
- [...f[g], d],
1923
+ node: t.node,
1924
+ fix: (o) => {
1925
+ let p = [], f = l.reduce(
1926
+ (d, c) => {
1927
+ let m = h(s.groups, c);
1928
+ return m in d ? d[m] = v(
1929
+ [...d[m], c],
1910
1930
  s
1911
- ) : f[g] = [d], f;
1931
+ ) : d[m] = [c], d;
1912
1932
  },
1913
1933
  {}
1914
- ), m = Object.keys(y).sort((f, d) => Number(f) - Number(d)).reduce(
1915
- (f, d) => [
1916
- ...f,
1917
- ...y[d]
1934
+ ), y = Object.keys(f).sort((d, c) => Number(d) - Number(c)).reduce(
1935
+ (d, c) => [
1936
+ ...d,
1937
+ ...f[c]
1918
1938
  ],
1919
1939
  []
1920
1940
  );
1921
- for (let f = 0, d = m.length; f < d; f++)
1922
- u.push(
1923
- n.replaceTextRange(
1924
- T(l.at(f).node, t.sourceCode),
1925
- t.sourceCode.text.slice(
1941
+ for (let d = 0, c = y.length; d < c; d++)
1942
+ p.push(
1943
+ o.replaceTextRange(
1944
+ T(l.at(d).node, e.sourceCode),
1945
+ e.sourceCode.text.slice(
1926
1946
  ...T(
1927
- m.at(f).node,
1928
- t.sourceCode
1947
+ y.at(d).node,
1948
+ e.sourceCode
1929
1949
  )
1930
1950
  )
1931
1951
  )
1932
1952
  );
1933
- return u;
1953
+ return p;
1934
1954
  }
1935
1955
  });
1936
1956
  });
1937
1957
  }
1938
1958
  }
1939
1959
  })
1940
- }), ne = "sort-enums", Oe = v({
1941
- name: ne,
1960
+ }), ie = "sort-enums", Oe = A({
1961
+ name: ie,
1942
1962
  meta: {
1943
1963
  type: "suggestion",
1944
1964
  docs: {
@@ -1949,13 +1969,17 @@ const Z = "sort-object-types", Ee = v({
1949
1969
  {
1950
1970
  type: "object",
1951
1971
  properties: {
1972
+ "partition-by-comment": {
1973
+ default: !1,
1974
+ type: ["boolean", "string", "array"]
1975
+ },
1952
1976
  type: {
1953
1977
  enum: [
1954
- i.alphabetical,
1955
- i.natural,
1956
- i["line-length"]
1978
+ u.alphabetical,
1979
+ u.natural,
1980
+ u["line-length"]
1957
1981
  ],
1958
- default: i.alphabetical,
1982
+ default: u.alphabetical,
1959
1983
  type: "string"
1960
1984
  },
1961
1985
  "ignore-case": {
@@ -1963,8 +1987,8 @@ const Z = "sort-object-types", Ee = v({
1963
1987
  default: !1
1964
1988
  },
1965
1989
  order: {
1966
- enum: [c.asc, c.desc],
1967
- default: c.asc,
1990
+ enum: [g.asc, g.desc],
1991
+ default: g.asc,
1968
1992
  type: "string"
1969
1993
  }
1970
1994
  },
@@ -1977,43 +2001,54 @@ const Z = "sort-object-types", Ee = v({
1977
2001
  },
1978
2002
  defaultOptions: [
1979
2003
  {
1980
- type: i.alphabetical,
1981
- order: c.asc
2004
+ type: u.alphabetical,
2005
+ order: g.asc
1982
2006
  }
1983
2007
  ],
1984
- create: (t) => ({
1985
- TSEnumDeclaration: (o) => {
1986
- if (o.members.length > 1 && o.members.every(({ initializer: s }) => s)) {
1987
- let s = k(t.options.at(0), {
1988
- type: i.alphabetical,
1989
- order: c.asc,
1990
- "ignore-case": !1
1991
- }), l = o.members.map((r) => ({
1992
- name: r.id.type === "Literal" ? `${r.id.value}` : `${t.sourceCode.text.slice(...r.id.range)}`,
1993
- size: O(r.range),
1994
- node: r
1995
- }));
1996
- P(l, (r, e) => {
1997
- j(A(r, e, s)) && t.report({
1998
- messageId: "unexpectedEnumsOrder",
1999
- data: {
2000
- left: I(r.name),
2001
- right: I(e.name)
2002
- },
2003
- node: e.node,
2004
- fix: (a) => L(
2005
- a,
2006
- l,
2007
- w(l, s),
2008
- t.sourceCode
2009
- )
2008
+ create: (e) => ({
2009
+ TSEnumDeclaration: (i) => {
2010
+ if (i.members.length > 1 && i.members.every(({ initializer: s }) => s)) {
2011
+ let s = j(e.options.at(0), {
2012
+ type: u.alphabetical,
2013
+ order: g.asc,
2014
+ "ignore-case": !1,
2015
+ "partition-by-comment": !1
2016
+ }), l = s["partition-by-comment"], r = i.members.reduce(
2017
+ (t, a) => {
2018
+ let n = V(a, e.sourceCode);
2019
+ l && n && X(l, n.value) && t.push([]);
2020
+ let p = {
2021
+ name: a.id.type === "Literal" ? `${a.id.value}` : `${e.sourceCode.text.slice(...a.id.range)}`,
2022
+ node: a,
2023
+ size: I(a.range)
2024
+ };
2025
+ return t.at(-1).push(p), t;
2026
+ },
2027
+ [[]]
2028
+ );
2029
+ for (let t of r)
2030
+ P(t, (a, n) => {
2031
+ O(S(a, n, s)) && e.report({
2032
+ messageId: "unexpectedEnumsOrder",
2033
+ data: {
2034
+ left: k(a.name),
2035
+ right: k(n.name)
2036
+ },
2037
+ node: n.node,
2038
+ fix: (o) => M(
2039
+ o,
2040
+ t,
2041
+ v(t, s),
2042
+ e.sourceCode,
2043
+ { partitionComment: l }
2044
+ )
2045
+ });
2010
2046
  });
2011
- });
2012
2047
  }
2013
2048
  }
2014
2049
  })
2015
- }), le = "sort-maps", je = v({
2016
- name: le,
2050
+ }), pe = "sort-maps", je = A({
2051
+ name: pe,
2017
2052
  meta: {
2018
2053
  type: "suggestion",
2019
2054
  docs: {
@@ -2026,16 +2061,16 @@ const Z = "sort-object-types", Ee = v({
2026
2061
  properties: {
2027
2062
  type: {
2028
2063
  enum: [
2029
- i.alphabetical,
2030
- i.natural,
2031
- i["line-length"]
2064
+ u.alphabetical,
2065
+ u.natural,
2066
+ u["line-length"]
2032
2067
  ],
2033
- default: i.alphabetical,
2068
+ default: u.alphabetical,
2034
2069
  type: "string"
2035
2070
  },
2036
2071
  order: {
2037
- enum: [c.asc, c.desc],
2038
- default: c.asc,
2072
+ enum: [g.asc, g.desc],
2073
+ default: g.asc,
2039
2074
  type: "string"
2040
2075
  },
2041
2076
  "ignore-case": {
@@ -2052,50 +2087,50 @@ const Z = "sort-object-types", Ee = v({
2052
2087
  },
2053
2088
  defaultOptions: [
2054
2089
  {
2055
- type: i.alphabetical,
2056
- order: c.asc
2090
+ type: u.alphabetical,
2091
+ order: g.asc
2057
2092
  }
2058
2093
  ],
2059
- create: (t) => ({
2060
- NewExpression: (o) => {
2061
- if (o.callee.type === "Identifier" && o.callee.name === "Map" && o.arguments.length && o.arguments[0].type === "ArrayExpression") {
2062
- let [{ elements: s }] = o.arguments;
2094
+ create: (e) => ({
2095
+ NewExpression: (i) => {
2096
+ if (i.callee.type === "Identifier" && i.callee.name === "Map" && i.arguments.length && i.arguments[0].type === "ArrayExpression") {
2097
+ let [{ elements: s }] = i.arguments;
2063
2098
  if (s.length > 1) {
2064
- let l = k(t.options.at(0), {
2065
- type: i.alphabetical,
2099
+ let l = j(e.options.at(0), {
2100
+ type: u.alphabetical,
2066
2101
  "ignore-case": !1,
2067
- order: c.asc
2102
+ order: g.asc
2068
2103
  }), r = s.reduce(
2069
- (e, a) => (a === null || a.type === "SpreadElement" ? e.push([]) : e.at(-1).push(a), e),
2104
+ (t, a) => (a === null || a.type === "SpreadElement" ? t.push([]) : t.at(-1).push(a), t),
2070
2105
  [[]]
2071
2106
  );
2072
- for (let e of r) {
2073
- let a = e.map((p) => {
2074
- let n;
2075
- if (p.type === "ArrayExpression") {
2076
- let [u] = p.elements;
2077
- u ? u.type === "Literal" ? n = u.raw : n = t.sourceCode.text.slice(...u.range) : n = `${u}`;
2107
+ for (let t of r) {
2108
+ let a = t.map((n) => {
2109
+ let o;
2110
+ if (n.type === "ArrayExpression") {
2111
+ let [p] = n.elements;
2112
+ p ? p.type === "Literal" ? o = p.raw : o = e.sourceCode.text.slice(...p.range) : o = `${p}`;
2078
2113
  } else
2079
- n = t.sourceCode.text.slice(...p.range);
2114
+ o = e.sourceCode.text.slice(...n.range);
2080
2115
  return {
2081
- size: O(p.range),
2082
- node: p,
2083
- name: n
2116
+ size: I(n.range),
2117
+ node: n,
2118
+ name: o
2084
2119
  };
2085
2120
  });
2086
- P(a, (p, n) => {
2087
- j(A(p, n, l)) && t.report({
2121
+ P(a, (n, o) => {
2122
+ O(S(n, o, l)) && e.report({
2088
2123
  messageId: "unexpectedMapElementsOrder",
2089
2124
  data: {
2090
- left: I(p.name),
2091
- right: I(n.name)
2125
+ left: k(n.name),
2126
+ right: k(o.name)
2092
2127
  },
2093
- node: n.node,
2094
- fix: (u) => L(
2095
- u,
2128
+ node: o.node,
2129
+ fix: (p) => M(
2130
+ p,
2096
2131
  a,
2097
- w(a, l),
2098
- t.sourceCode
2132
+ v(a, l),
2133
+ e.sourceCode
2099
2134
  )
2100
2135
  });
2101
2136
  });
@@ -2104,10 +2139,10 @@ const Z = "sort-object-types", Ee = v({
2104
2139
  }
2105
2140
  }
2106
2141
  })
2107
- }), ke = "eslint-plugin-perfectionist";
2108
- let V = (t) => {
2109
- let o = {
2110
- [se]: [
2142
+ }), Pe = "eslint-plugin-perfectionist";
2143
+ let J = (e) => {
2144
+ let i = {
2145
+ [oe]: [
2111
2146
  "error",
2112
2147
  {
2113
2148
  groups: [
@@ -2128,7 +2163,7 @@ let V = (t) => {
2128
2163
  "internal-pattern": ["~/**"]
2129
2164
  }
2130
2165
  ],
2131
- [oe]: [
2166
+ [le]: [
2132
2167
  "error",
2133
2168
  {
2134
2169
  groups: [
@@ -2145,78 +2180,78 @@ let V = (t) => {
2145
2180
  ]
2146
2181
  }
2147
2182
  ],
2148
- [ae]: [
2183
+ [ne]: [
2149
2184
  "error",
2150
2185
  {
2151
2186
  "partition-by-comment": !1
2152
2187
  }
2153
2188
  ],
2154
- [K]: [
2189
+ [Q]: [
2155
2190
  "error",
2156
2191
  {
2157
2192
  "spread-last": !0
2158
2193
  }
2159
2194
  ],
2160
- [X]: ["error"],
2161
2195
  [q]: ["error"],
2162
2196
  [H]: ["error"],
2163
- [Q]: ["error"],
2164
2197
  [Y]: ["error"],
2165
2198
  [Z]: ["error"],
2166
2199
  [F]: ["error"],
2167
2200
  [ee]: ["error"],
2168
2201
  [te]: ["error"],
2169
2202
  [re]: ["error"],
2170
- [ne]: ["error"],
2171
- [le]: ["error"]
2203
+ [se]: ["error"],
2204
+ [ae]: ["error"],
2205
+ [ie]: ["error"],
2206
+ [pe]: ["error"]
2172
2207
  };
2173
2208
  return {
2174
2209
  rules: Object.fromEntries(
2175
- Object.entries(o).map(([s, [l, r = {}]]) => [
2210
+ Object.entries(i).map(([s, [l, r = {}]]) => [
2176
2211
  `perfectionist/${s}`,
2177
- [l, Object.assign(r, t)]
2212
+ [l, Object.assign(r, e)]
2178
2213
  ])
2179
2214
  ),
2180
2215
  plugins: ["perfectionist"]
2181
2216
  };
2182
2217
  };
2183
- const $e = {
2218
+ const De = {
2184
2219
  rules: {
2185
- [K]: me,
2186
- [q]: ye,
2187
- [oe]: ve,
2188
- [ne]: Oe,
2189
- [re]: Se,
2190
- [se]: Ae,
2220
+ [Q]: he,
2221
+ [H]: me,
2222
+ [le]: Ie,
2223
+ [ie]: Oe,
2224
+ [ae]: Se,
2225
+ [oe]: ke,
2226
+ [re]: ve,
2227
+ [se]: we,
2228
+ [pe]: je,
2229
+ [Z]: xe,
2230
+ [F]: Ee,
2191
2231
  [ee]: Ne,
2192
- [te]: we,
2193
- [le]: je,
2194
- [Q]: be,
2195
- [Y]: xe,
2196
- [Z]: Ee,
2197
- [ae]: Ie,
2198
- [X]: ge,
2199
- [F]: Ce,
2200
- [H]: he
2232
+ [ne]: Ae,
2233
+ [q]: ye,
2234
+ [te]: Ce,
2235
+ [Y]: be
2201
2236
  },
2202
2237
  configs: {
2203
- "recommended-alphabetical": V({
2204
- type: i.alphabetical,
2205
- order: c.asc,
2238
+ "recommended-alphabetical": J({
2239
+ type: u.alphabetical,
2240
+ order: g.asc,
2206
2241
  "ignore-case": !1
2207
2242
  }),
2208
- "recommended-natural": V({
2209
- type: i.natural,
2210
- order: c.asc,
2243
+ "recommended-natural": J({
2244
+ type: u.natural,
2245
+ order: g.asc,
2211
2246
  "ignore-case": !1
2212
2247
  }),
2213
- "recommended-line-length": V({
2214
- type: i["line-length"],
2215
- order: c.desc
2248
+ "recommended-line-length": J({
2249
+ type: u["line-length"],
2250
+ order: g.desc
2216
2251
  })
2217
2252
  },
2218
- name: ke
2253
+ name: Pe
2219
2254
  };
2220
2255
  export {
2221
- $e as default
2256
+ De as default
2222
2257
  };