eslint-plugin-perfectionist 2.1.0 → 2.3.0

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