eslint-plugin-perfectionist 2.2.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 B from "node:path";
2
- import { ESLintUtils as ne, ASTUtils as D } from "@typescript-eslint/utils";
3
- import { minimatch as $ } from "minimatch";
4
- import le from "natural-compare-lite";
5
- import { builtinModules as ie } from "node:module";
6
- let O = ne.RuleCreator(
7
- (s) => `https://eslint-plugin-perfectionist.azat.io/rules/${s}`
8
- ), x = (s, l) => {
9
- for (let n = 0, a = s.length; n < a; n++) {
10
- let u = s[n];
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
- return n;
12
+ return s;
13
13
  }
14
- return s.length;
15
- }, v = (s) => {
16
- let [l, n] = s;
17
- return n - l;
18
- }, j = (s) => s > 0;
19
- var i = /* @__PURE__ */ ((s) => (s.alphabetical = "alphabetical", s["line-length"] = "line-length", s.natural = "natural", s))(i || {}), f = /* @__PURE__ */ ((s) => (s.desc = "desc", s.asc = "asc", s))(f || {});
20
- let M = (s) => {
21
- let l, n = (u) => {
22
- !l && s.flat().includes(u) && (l = u);
14
+ return r.length;
15
+ }, v = (r) => {
16
+ let [l, s] = r;
17
+ return s - l;
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
+ let l, s = (u) => {
22
+ !l && r.flat().includes(u) && (l = u);
23
23
  };
24
24
  return {
25
25
  getGroup: () => l ?? "unknown",
26
- setCustomGroups: (u, t) => {
26
+ setCustomGroups: (u, n) => {
27
27
  if (u)
28
- for (let [e, o] of Object.entries(u))
29
- Array.isArray(o) && o.some(
30
- (r) => $(t, r, {
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
- ) && n(e), typeof o == "string" && $(t, o, {
33
+ ) && s(e), typeof a == "string" && D(n, a, {
34
34
  nocomment: !0
35
- }) && n(e);
35
+ }) && s(e);
36
36
  },
37
- defineGroup: n
37
+ defineGroup: s
38
38
  };
39
- }, w = (s, l, n) => {
40
- var e, o;
41
- if ((e = l.dependencies) != null && e.includes(s.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 ((o = s.dependencies) != null && o.includes(l.name))
43
+ if ((a = r.dependencies) != null && a.includes(l.name))
44
44
  return 1;
45
- let a = n.order === "asc" ? 1 : -1, u, t = (r) => n["ignore-case"] ? r.toLowerCase() : r;
46
- return n.type === i.alphabetical ? u = (r, c) => t(r.name).localeCompare(t(c.name)) : n.type === i.natural ? u = (r, c) => le(t(r.name), t(c.name)) : u = (r, c) => r.size - c.size, a * u(s, l);
47
- }, A = (s, l) => [...s].sort((n, a) => w(n, a, l)), pe = (s, l) => {
48
- let n = l.getTokenAfter(s, {
49
- filter: ({ value: a, type: u }) => !(u === "Punctuator" && [",", ";"].includes(a)),
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 ((n == null ? void 0 : n.type) === "Block" || (n == null ? void 0 : n.type) === "Line") && s.loc.end.line === n.loc.end.line ? n : null;
53
- }, oe = (s, l) => Array.isArray(s) && s.some(
54
- (n) => $(l.trim(), n, {
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 s == "string" && $(l.trim(), s, {
64
+ ) || typeof r == "string" && D(l.trim(), r, {
58
65
  nocomment: !0
59
- }) || s === !0, _ = (s, l) => {
60
- let [n, a] = l.getTokensBefore(s, {
61
- filter: ({ value: u, type: t }) => !(t === "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 ((a == null ? void 0 : a.type) === "Block" || (a == null ? void 0 : a.type) === "Line") && s.loc.start.line - a.loc.end.line <= 1 && (n == null ? void 0 : n.loc.end.line) !== a.loc.start.line ? a : null;
66
- }, G = (s, l, n) => {
67
- var o;
68
- let a = s.range.at(0), u = s.range.at(1), t = l.text.slice(a, u);
69
- if (D.isParenthesized(s, l)) {
70
- let r = l.getTokenBefore(
71
- s,
72
- D.isOpeningParenToken
73
- ), c = l.getTokenAfter(
74
- s,
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
- a = r.range.at(0), u = c.range.at(1);
84
+ t = i.range.at(0), u = o.range.at(1);
78
85
  }
79
- let e = _(s, l);
80
- if (t.endsWith(";") || t.endsWith(",")) {
81
- let r = l.getTokensAfter(s, {
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
- s.loc.start.line === ((o = r.at(1)) == null ? void 0 : o.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(
88
- (n == null ? void 0 : n.partitionComment) ?? !1,
94
+ return e && !pe(
95
+ (s == null ? void 0 : s.partitionComment) ?? !1,
89
96
  e.value
90
- ) && (a = e.range.at(0)), [a, u];
91
- }, P = (s, l, n, a, u) => {
92
- var o, r;
93
- let t = [], e = ((o = l.at(0)) == null ? void 0 : o.node.loc.start.line) === ((r = l.at(-1)) == null ? void 0 : r.node.loc.end.line);
94
- for (let c = 0, d = l.length; c < d; c++) {
95
- let { node: y } = l.at(c);
96
- t.push(
97
- s.replaceTextRange(
98
- G(y, a, u),
99
- a.text.slice(
100
- ...G(n.at(c).node, a, u)
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 m = pe(n.at(c).node, a);
105
- if (m && !e) {
106
- let p = [
107
- a.getTokenBefore(m).range.at(1),
108
- m.range.at(1)
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
- t.push(s.replaceTextRange(p, ""));
111
- let h = a.getTokenAfter(y);
112
- t.push(
113
- s.insertTextAfter(
114
- (h == null ? void 0 : h.loc.end.line) === y.loc.end.line ? h : y,
115
- a.text.slice(...p)
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 t;
121
- }, k = (s = {}, l) => Object.assign(l, s), C = (s, l) => {
122
- if (s.length > 1)
123
- for (let n = 1; n < s.length; n++) {
124
- let a = s.at(n - 1), u = s.at(n);
125
- a && u && l(a, u, n - 1);
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 W = "sort-svelte-attributes", ue = O({
129
- name: W,
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 W = "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 W = "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: (s) => B.extname(s.getFilename()) !== ".svelte" ? {} : {
185
+ create: (r) => _.extname(r.getFilename()) !== ".svelte" ? {} : {
179
186
  SvelteStartTag: (l) => {
180
187
  if (l.attributes.length > 1) {
181
- let n = k(s.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
- }), a = s.getSourceCode(), u = l.attributes.reduce(
188
- (t, e) => {
194
+ }), t = r.getSourceCode(), u = l.attributes.reduce(
195
+ (n, e) => {
189
196
  if (e.type === "SvelteSpreadAttribute")
190
- return t.push([]), t;
191
- let o, { getGroup: r, defineGroup: c, setCustomGroups: d } = M(
192
- n.groups
197
+ return n.push([]), n;
198
+ let a, { getGroup: i, defineGroup: o, setCustomGroups: c } = R(
199
+ s.groups
193
200
  );
194
- return e.key.type === "SvelteSpecialDirectiveKey" ? o = a.text.slice(...e.key.range) : typeof e.key.name == "string" ? { name: o } = e.key : o = a.text.slice(...e.key.range), d(n["custom-groups"], o), e.type === "SvelteShorthandAttribute" && (c("svelte-shorthand"), c("shorthand")), (!("value" in e) || Array.isArray(e.value) && !e.value.at(0)) && c("shorthand"), e.loc.start.line !== e.loc.end.line && c("multiline"), t.at(-1).push({
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({
195
202
  size: v(e.range),
196
203
  node: e,
197
- group: r(),
198
- name: o
199
- }), t;
204
+ group: i(),
205
+ name: a
206
+ }), n;
200
207
  },
201
208
  [[]]
202
209
  );
203
- for (let t of u)
204
- C(t, (e, o) => {
205
- let r = x(n.groups, e), c = x(n.groups, o);
206
- (r > c || r === c && j(w(e, o, n))) && s.report({
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: o.name
217
+ right: a.name
211
218
  },
212
- node: o.node,
213
- fix: (d) => {
219
+ node: a.node,
220
+ fix: (c) => {
214
221
  let y = {};
215
- for (let g of t) {
216
- let p = x(n.groups, g);
217
- p in y ? y[p] = A(
218
- [...y[p], g],
219
- n
220
- ) : y[p] = [g];
222
+ for (let f of n) {
223
+ let g = x(s.groups, f);
224
+ g in y ? y[g] = A(
225
+ [...y[g], f],
226
+ s
227
+ ) : y[g] = [f];
221
228
  }
222
- let m = [];
223
- for (let g of Object.keys(y).sort())
224
- m.push(...A(y[g], n));
225
- return P(d, t, m, a);
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
- }), V = "sort-astro-attributes", ce = O({
233
- name: V,
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 W = "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 W = "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: (s) => B.extname(s.getFilename()) !== ".astro" ? {} : {
290
+ create: (r) => _.extname(r.getFilename()) !== ".astro" ? {} : {
284
291
  JSXElement: (l) => {
285
- let { attributes: n } = l.openingElement;
286
- if (n.length > 1) {
287
- let a = k(s.options.at(0), {
288
- type: i.alphabetical,
289
- order: f.asc,
292
+ let { attributes: s } = l.openingElement;
293
+ if (s.length > 1) {
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 = s.getSourceCode(), t = n.reduce(
294
- (e, o) => {
295
- if (o.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 r = typeof o.name.name == "string" ? o.name.name : u.text.slice(...o.name.range), { getGroup: c, defineGroup: d, setCustomGroups: y } = M(
298
- a.groups
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 y(a["custom-groups"], r), o.type === "AstroShorthandAttribute" && (d("astro-shorthand"), d("shorthand")), o.value === null && d("shorthand"), o.loc.start.line !== o.loc.end.line && d("multiline"), e.at(-1).push({
301
- size: v(o.range),
302
- node: o,
303
- group: c(),
304
- name: r
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 t)
310
- C(e, (o, r) => {
311
- let c = x(a.groups, o), d = x(a.groups, r);
312
- (c > d || c === d && j(w(o, r, a))) && s.report({
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: o.name,
316
- right: r.name
322
+ left: a.name,
323
+ right: i.name
317
324
  },
318
- node: r.node,
325
+ node: i.node,
319
326
  fix: (y) => {
320
- let m = {};
321
- for (let p of e) {
322
- let h = x(a.groups, p);
323
- h in m ? m[h] = A(
324
- [...m[h], p],
325
- a
326
- ) : m[h] = [p];
327
+ 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 g = [];
329
- for (let p of Object.keys(m).sort())
330
- g.push(...A(m[p], a));
331
- return P(y, e, g, 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 W = "sort-svelte-attributes", ue = O({
336
343
  }
337
344
  }
338
345
  });
339
- let I = (s) => s.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: (s) => ({
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
- let n = l.object.type === "ArrayExpression" ? l.object.elements : l.object.arguments;
392
- if (n.length > 1) {
393
- let a = k(s.options.at(0), {
394
- type: i.alphabetical,
395
- order: f.asc,
398
+ let s = l.object.type === "ArrayExpression" ? l.object.elements : l.object.arguments;
399
+ if (s.length > 1) {
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 = s.getSourceCode(), t = n.reduce(
399
- (e, o) => (o !== null && e.at(0).push({
400
- name: o.type === "Literal" ? `${o.value}` : u.text.slice(...o.range),
401
- size: v(o.range),
402
- type: o.type,
403
- node: o
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
- C(t, (e, o) => {
408
- let r;
409
- a["spread-last"] && e.node.type === "Literal" && o.node.type === "SpreadElement" ? r = !1 : a["spread-last"] && e.node.type === "SpreadElement" && o.node.type === "Literal" ? r = !0 : r = j(w(e, o, a)), r && s.report({
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(o.name)
420
+ right: I(a.name)
414
421
  },
415
- node: o.node,
416
- fix: (c) => {
417
- let d = A(t, a);
418
- if (a["spread-last"])
419
- for (let y = 0, m = d.length; y < m; y++)
420
- d.at(y).node.type === "SpreadElement" && d.push(d.splice(y, 1).at(0));
421
- return P(c, t, d, u);
422
+ 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: (s) => {
481
- if (B.extname(s.getFilename()) !== ".vue")
487
+ create: (r) => {
488
+ if (_.extname(r.getFilename()) !== ".vue")
482
489
  return {};
483
- if (!("defineTemplateBodyVisitor" in s.parserServices))
490
+ if (!("defineTemplateBodyVisitor" in r.parserServices))
484
491
  return {};
485
- let { defineTemplateBodyVisitor: l } = s.parserServices;
492
+ let { defineTemplateBodyVisitor: l } = r.parserServices;
486
493
  return l({
487
- VStartTag: (n) => {
488
- if (n.attributes.length > 1) {
489
- let a = k(s.options.at(0), {
490
- type: i.alphabetical,
491
- order: f.asc,
494
+ VStartTag: (s) => {
495
+ if (s.attributes.length > 1) {
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 = s.getSourceCode(), t = n.attributes.reduce(
496
- (e, o) => {
497
- if (o.key.type === "VDirectiveKey" && o.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 r, { getGroup: c, defineGroup: d, setCustomGroups: y } = M(
500
- a.groups
506
+ let i, { getGroup: o, defineGroup: c, setCustomGroups: y } = R(
507
+ t.groups
501
508
  );
502
- return typeof o.key.name == "string" && o.key.type !== "VDirectiveKey" ? r = o.key.rawName : r = u.text.slice(...o.key.range), y(a["custom-groups"], r), o.value === null && d("shorthand"), o.loc.start.line !== o.loc.end.line && d("multiline"), e.at(-1).push({
503
- size: v(o.range),
504
- node: o,
505
- group: c(),
506
- name: r
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 t)
512
- C(e, (o, r) => {
513
- let c = x(a.groups, o), d = x(a.groups, r);
514
- (c > d || c === d && j(w(o, r, a))) && s.report({
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: o.name,
518
- right: r.name
524
+ left: a.name,
525
+ right: i.name
519
526
  },
520
- node: r.node,
527
+ node: i.node,
521
528
  fix: (y) => {
522
- let m = {};
523
- for (let p of e) {
524
- let h = x(a.groups, p);
525
- h in m ? m[h] = A(
526
- [...m[h], p],
527
- a
528
- ) : m[h] = [p];
529
+ 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 g = [];
531
- for (let p of Object.keys(m).sort())
532
- g.push(...A(m[p], a));
533
- return P(y, e, g, 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: (s) => ({
592
+ create: (r) => ({
586
593
  ExportNamedDeclaration: (l) => {
587
594
  if (l.specifiers.length > 1) {
588
- let n = k(s.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
- }), a = s.getSourceCode(), u = l.specifiers.map((t) => ({
593
- size: v(t.range),
594
- name: t.local.name,
595
- node: t
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
- C(u, (t, e) => {
598
- j(w(t, e, n)) && s.report({
604
+ P(u, (n, e) => {
605
+ k(O(n, e, s)) && r.report({
599
606
  messageId: "unexpectedNamedExportsOrder",
600
607
  data: {
601
- left: t.name,
608
+ left: n.name,
602
609
  right: e.name
603
610
  },
604
611
  node: e.node,
605
- fix: (o) => P(o, u, A(u, n), a)
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,16 +629,16 @@ 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": {
@@ -652,45 +659,50 @@ const J = "sort-array-includes", de = O({
652
659
  },
653
660
  defaultOptions: [
654
661
  {
655
- type: i.alphabetical,
656
- order: f.asc
662
+ type: p.alphabetical,
663
+ order: d.asc
657
664
  }
658
665
  ],
659
- create: (s) => ({
666
+ create: (r) => ({
660
667
  ImportDeclaration: (l) => {
661
- let n = l.specifiers.filter(
662
- ({ type: a }) => a === "ImportSpecifier"
668
+ let s = l.specifiers.filter(
669
+ ({ type: t }) => t === "ImportSpecifier"
663
670
  );
664
- if (n.length > 1) {
665
- let a = k(s.options.at(0), {
666
- type: i.alphabetical,
671
+ if (s.length > 1) {
672
+ let t = C(r.options.at(0), {
673
+ type: p.alphabetical,
667
674
  "ignore-alias": !0,
668
675
  "ignore-case": !1,
669
- order: f.asc
670
- }), u = s.getSourceCode(), t = n.map((e) => {
671
- let { name: o } = e.local;
672
- return a["ignore-alias"] && e.type === "ImportSpecifier" && ({ name: o } = e.imported), {
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), {
673
680
  size: v(e.range),
674
681
  node: e,
675
- name: o
682
+ name: a
676
683
  };
677
684
  });
678
- C(t, (e, o) => {
679
- j(w(e, o, a)) && s.report({
685
+ P(n, (e, a) => {
686
+ k(O(e, a, t)) && r.report({
680
687
  messageId: "unexpectedNamedImportsOrder",
681
688
  data: {
682
689
  left: e.name,
683
- right: o.name
690
+ right: a.name
684
691
  },
685
- node: o.node,
686
- fix: (r) => P(r, t, A(t, a), u)
692
+ node: a.node,
693
+ fix: (i) => T(i, n, A(n, t), u)
687
694
  });
688
695
  });
689
696
  }
690
697
  }
691
698
  })
692
- }), F = "sort-object-types", me = O({
693
- 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,
694
706
  meta: {
695
707
  type: "suggestion",
696
708
  docs: {
@@ -706,16 +718,16 @@ const J = "sort-array-includes", de = O({
706
718
  },
707
719
  type: {
708
720
  enum: [
709
- i.alphabetical,
710
- i.natural,
711
- i["line-length"]
721
+ p.alphabetical,
722
+ p.natural,
723
+ p["line-length"]
712
724
  ],
713
- default: i.alphabetical,
725
+ default: p.alphabetical,
714
726
  type: "string"
715
727
  },
716
728
  order: {
717
- enum: [f.asc, f.desc],
718
- default: f.asc,
729
+ enum: [d.asc, d.desc],
730
+ default: d.asc,
719
731
  type: "string"
720
732
  },
721
733
  "ignore-case": {
@@ -725,6 +737,10 @@ const J = "sort-array-includes", de = O({
725
737
  groups: {
726
738
  type: "array",
727
739
  default: []
740
+ },
741
+ "partition-by-new-line": {
742
+ type: "boolean",
743
+ default: !1
728
744
  }
729
745
  },
730
746
  additionalProperties: !1
@@ -736,75 +752,82 @@ const J = "sort-array-includes", de = O({
736
752
  },
737
753
  defaultOptions: [
738
754
  {
739
- type: i.alphabetical,
740
- order: f.asc
755
+ type: p.alphabetical,
756
+ order: d.asc
741
757
  }
742
758
  ],
743
- create: (s) => ({
759
+ create: (r) => ({
744
760
  TSTypeLiteral: (l) => {
745
761
  if (l.members.length > 1) {
746
- let n = k(s.options.at(0), {
747
- type: i.alphabetical,
762
+ let s = C(r.options.at(0), {
763
+ "partition-by-new-line": !1,
764
+ type: p.alphabetical,
748
765
  "ignore-case": !1,
749
- order: f.asc,
766
+ order: d.asc,
750
767
  "custom-groups": {},
751
768
  groups: []
752
- }), a = s.getSourceCode(), u = l.members.map((t) => {
753
- var p, h;
754
- let e, o = a.text.slice(t.range.at(0), t.range.at(1)), { getGroup: r, defineGroup: c, setCustomGroups: d } = M(
755
- n.groups
756
- ), y = (S) => S.replace(/(,|;)$/, "");
757
- if (t.type === "TSPropertySignature")
758
- t.key.type === "Identifier" ? { name: e } = t.key : t.key.type === "Literal" ? e = `${t.key.value}` : e = a.text.slice(
759
- t.range.at(0),
760
- (p = t.typeAnnotation) == null ? void 0 : p.range.at(0)
761
- );
762
- else if (t.type === "TSIndexSignature") {
763
- let S = ((h = t.typeAnnotation) == null ? void 0 : h.range.at(0)) ?? t.range.at(1);
764
- e = y(a.text.slice(t.range.at(0), S));
765
- } else
766
- e = y(
767
- a.text.slice(t.range.at(0), t.range.at(1))
768
- );
769
- d(n["custom-groups"], e), t.loc.start.line !== t.loc.end.line && c("multiline");
770
- let g = o.endsWith(";") || o.endsWith(",") ? 1 : 0;
771
- return {
772
- size: v(t.range) - g,
773
- group: r(),
774
- node: t,
775
- name: e
776
- };
777
- });
778
- C(u, (t, e) => {
779
- let o = x(n.groups, t), r = x(n.groups, e);
780
- (o > r || o === r && j(w(t, e, n))) && s.report({
781
- messageId: "unexpectedObjectTypesOrder",
782
- data: {
783
- left: I(t.name),
784
- right: I(e.name)
785
- },
786
- node: e.node,
787
- fix: (c) => {
788
- let d = {};
789
- for (let m of u) {
790
- let g = x(n.groups, m);
791
- g in d ? d[g] = A(
792
- [...d[g], m],
793
- n
794
- ) : d[g] = [m];
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);
795
823
  }
796
- let y = [];
797
- for (let m of Object.keys(d).sort())
798
- y.push(...A(d[m], n));
799
- return P(c, u, y, a);
800
- }
824
+ });
801
825
  });
802
- });
803
826
  }
804
827
  }
805
828
  })
806
- }), H = "sort-union-types", he = O({
807
- name: H,
829
+ }), Z = "sort-union-types", Se = j({
830
+ name: Z,
808
831
  meta: {
809
832
  type: "suggestion",
810
833
  docs: {
@@ -817,16 +840,16 @@ const J = "sort-array-includes", de = O({
817
840
  properties: {
818
841
  type: {
819
842
  enum: [
820
- i.alphabetical,
821
- i.natural,
822
- i["line-length"]
843
+ p.alphabetical,
844
+ p.natural,
845
+ p["line-length"]
823
846
  ],
824
- default: i.alphabetical,
847
+ default: p.alphabetical,
825
848
  type: "string"
826
849
  },
827
850
  order: {
828
- enum: [f.asc, f.desc],
829
- default: f.asc,
851
+ enum: [d.asc, d.desc],
852
+ default: d.asc,
830
853
  type: "string"
831
854
  },
832
855
  "ignore-case": {
@@ -847,50 +870,50 @@ const J = "sort-array-includes", de = O({
847
870
  },
848
871
  defaultOptions: [
849
872
  {
850
- type: i.alphabetical,
851
- order: f.asc
873
+ type: p.alphabetical,
874
+ order: d.asc
852
875
  }
853
876
  ],
854
- create: (s) => ({
877
+ create: (r) => ({
855
878
  TSUnionType: (l) => {
856
- let n = s.getSourceCode(), a = k(s.options.at(0), {
857
- type: i.alphabetical,
879
+ let s = r.getSourceCode(), t = C(r.options.at(0), {
880
+ type: p.alphabetical,
858
881
  "nullable-last": !1,
859
882
  "ignore-case": !1,
860
- order: f.asc
861
- }), u = l.types.map((t) => ({
862
- group: t.type === "TSNullKeyword" || t.type === "TSUndefinedKeyword" ? "nullable" : "unknown",
863
- name: n.text.slice(...t.range),
864
- size: v(t.range),
865
- node: t
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
866
889
  }));
867
- C(u, (t, e) => {
868
- let o = j(w(t, e, a));
869
- a["nullable-last"] && (t.group === "nullable" && e.group === "unknown" ? o = !0 : t.group === "unknown" && e.group === "nullable" && (o = !1)), o && s.report({
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({
870
893
  messageId: "unexpectedUnionTypesOrder",
871
894
  data: {
872
- left: I(t.name),
895
+ left: I(n.name),
873
896
  right: I(e.name)
874
897
  },
875
898
  node: e.node,
876
- fix: (r) => {
877
- let c = [];
878
- if (a["nullable-last"]) {
879
- let d = [], y = u.filter((m) => m.group === "nullable" ? (d.push(m), !1) : !0);
880
- c = [
881
- ...A(y, a),
882
- ...A(d, a)
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)
883
906
  ];
884
907
  } else
885
- c = A(u, a);
886
- return P(r, u, c, n);
908
+ o = A(u, t);
909
+ return T(i, u, o, s);
887
910
  }
888
911
  });
889
912
  });
890
913
  }
891
914
  })
892
- }), Q = "sort-interfaces", be = O({
893
- name: Q,
915
+ }), ee = "sort-interfaces", we = j({
916
+ name: ee,
894
917
  meta: {
895
918
  type: "suggestion",
896
919
  docs: {
@@ -906,16 +929,16 @@ const J = "sort-array-includes", de = O({
906
929
  },
907
930
  type: {
908
931
  enum: [
909
- i.alphabetical,
910
- i.natural,
911
- i["line-length"]
932
+ p.alphabetical,
933
+ p.natural,
934
+ p["line-length"]
912
935
  ],
913
- default: i.alphabetical,
936
+ default: p.alphabetical,
914
937
  type: "string"
915
938
  },
916
939
  order: {
917
- enum: [f.asc, f.desc],
918
- default: f.asc,
940
+ enum: [d.asc, d.desc],
941
+ default: d.asc,
919
942
  type: "string"
920
943
  },
921
944
  "ignore-case": {
@@ -931,6 +954,10 @@ const J = "sort-array-includes", de = O({
931
954
  groups: {
932
955
  type: "array",
933
956
  default: []
957
+ },
958
+ "partition-by-new-line": {
959
+ type: "boolean",
960
+ default: !1
934
961
  }
935
962
  },
936
963
  additionalProperties: !1
@@ -942,82 +969,86 @@ const J = "sort-array-includes", de = O({
942
969
  },
943
970
  defaultOptions: [
944
971
  {
945
- type: i.alphabetical,
946
- order: f.asc
972
+ type: p.alphabetical,
973
+ order: d.asc
947
974
  }
948
975
  ],
949
- create: (s) => ({
976
+ create: (r) => ({
950
977
  TSInterfaceDeclaration: (l) => {
951
978
  if (l.body.body.length > 1) {
952
- let n = k(s.options.at(0), {
953
- type: i.alphabetical,
979
+ let s = C(r.options.at(0), {
980
+ "partition-by-new-line": !1,
981
+ type: p.alphabetical,
954
982
  "ignore-case": !1,
955
- order: f.asc,
983
+ order: d.asc,
956
984
  "ignore-pattern": [],
957
985
  "custom-groups": {},
958
986
  groups: []
959
987
  });
960
- if (!n["ignore-pattern"].some(
961
- (a) => $(l.id.name, a, {
988
+ if (!s["ignore-pattern"].some(
989
+ (t) => D(l.id.name, t, {
962
990
  nocomment: !0
963
991
  })
964
992
  )) {
965
- let a = s.getSourceCode(), u = l.body.body.reduce(
966
- (t, e) => {
967
- var y, m, g;
993
+ let t = r.getSourceCode(), u = l.body.body.reduce(
994
+ (n, e) => {
995
+ var f, g, m, w;
968
996
  if (e.type === "TSCallSignatureDeclaration")
969
- return t.push([]), t;
970
- let o, { getGroup: r, defineGroup: c, setCustomGroups: d } = M(
971
- n.groups
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(
999
+ s.groups
972
1000
  );
973
1001
  if (e.type === "TSPropertySignature")
974
1002
  if (e.key.type === "Identifier")
975
- ({ name: o } = e.key);
1003
+ ({ name: i } = e.key);
976
1004
  else if (e.key.type === "Literal")
977
- o = `${e.key.value}`;
1005
+ i = `${e.key.value}`;
978
1006
  else {
979
- let p = ((y = e.typeAnnotation) == null ? void 0 : y.range.at(0)) ?? e.range.at(1) - (e.optional ? 1 : 0);
980
- o = a.text.slice(e.range.at(0), p);
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);
981
1009
  }
982
1010
  else if (e.type === "TSIndexSignature") {
983
- let p = ((m = e.typeAnnotation) == null ? void 0 : m.range.at(0)) ?? e.range.at(1);
984
- o = a.text.slice(e.range.at(0), p);
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);
985
1013
  } else {
986
- let p = ((g = e.returnType) == null ? void 0 : g.range.at(0)) ?? e.range.at(1);
987
- o = a.text.slice(e.range.at(0), p);
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);
988
1016
  }
989
- return d(n["custom-groups"], o), e.loc.start.line !== e.loc.end.line && c("multiline"), t.at(-1).push({
1017
+ let h = {
990
1018
  size: v(e.range),
991
- group: r(),
992
1019
  node: e,
993
- name: o
994
- }), t;
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;
995
1026
  },
996
1027
  [[]]
997
1028
  );
998
- for (let t of u)
999
- C(t, (e, o) => {
1000
- let r = x(n.groups, e), c = x(n.groups, o);
1001
- (r > c || r === c && j(w(e, o, n))) && s.report({
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({
1002
1033
  messageId: "unexpectedInterfacePropertiesOrder",
1003
1034
  data: {
1004
1035
  left: I(e.name),
1005
- right: I(o.name)
1036
+ right: I(a.name)
1006
1037
  },
1007
- node: o.node,
1008
- fix: (d) => {
1038
+ node: a.node,
1039
+ fix: (c) => {
1009
1040
  let y = {};
1010
- for (let g of t) {
1011
- let p = x(n.groups, g);
1012
- p in y ? y[p] = A(
1013
- [...y[p], g],
1014
- n
1015
- ) : y[p] = [g];
1041
+ for (let f of n) {
1042
+ let g = x(s.groups, f);
1043
+ g in y ? y[g] = A(
1044
+ [...y[g], f],
1045
+ s
1046
+ ) : y[g] = [f];
1016
1047
  }
1017
- let m = [];
1018
- for (let g of Object.keys(y).sort())
1019
- m.push(...A(y[g], n));
1020
- return P(d, t, m, a);
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);
1021
1052
  }
1022
1053
  });
1023
1054
  });
@@ -1025,8 +1056,8 @@ const J = "sort-array-includes", de = O({
1025
1056
  }
1026
1057
  }
1027
1058
  })
1028
- }), Y = "sort-jsx-props", xe = O({
1029
- name: Y,
1059
+ }), te = "sort-jsx-props", Ae = j({
1060
+ name: te,
1030
1061
  meta: {
1031
1062
  type: "suggestion",
1032
1063
  docs: {
@@ -1042,16 +1073,16 @@ const J = "sort-array-includes", de = O({
1042
1073
  },
1043
1074
  type: {
1044
1075
  enum: [
1045
- i.alphabetical,
1046
- i.natural,
1047
- i["line-length"]
1076
+ p.alphabetical,
1077
+ p.natural,
1078
+ p["line-length"]
1048
1079
  ],
1049
- default: i.alphabetical,
1080
+ default: p.alphabetical,
1050
1081
  type: "string"
1051
1082
  },
1052
1083
  order: {
1053
- enum: [f.asc, f.desc],
1054
- default: f.asc,
1084
+ enum: [d.asc, d.desc],
1085
+ default: d.asc,
1055
1086
  type: "string"
1056
1087
  },
1057
1088
  groups: {
@@ -1071,70 +1102,70 @@ const J = "sort-array-includes", de = O({
1071
1102
  },
1072
1103
  defaultOptions: [
1073
1104
  {
1074
- type: i.alphabetical,
1075
- order: f.asc
1105
+ type: p.alphabetical,
1106
+ order: d.asc
1076
1107
  }
1077
1108
  ],
1078
- create: (s) => [".svelte", ".astro", ".vue"].includes(
1079
- B.extname(s.getFilename())
1109
+ create: (r) => [".svelte", ".astro", ".vue"].includes(
1110
+ _.extname(r.getFilename())
1080
1111
  ) ? {} : {
1081
1112
  JSXElement: (l) => {
1082
1113
  if (l.openingElement.attributes.length > 1) {
1083
- let n = k(s.options.at(0), {
1084
- type: i.alphabetical,
1114
+ let s = C(r.options.at(0), {
1115
+ type: p.alphabetical,
1085
1116
  "ignore-case": !1,
1086
- order: f.asc,
1117
+ order: d.asc,
1087
1118
  "custom-groups": {},
1088
1119
  groups: []
1089
- }), a = s.getSourceCode(), u = l.openingElement.attributes.reduce(
1090
- (t, e) => {
1120
+ }), t = r.getSourceCode(), u = l.openingElement.attributes.reduce(
1121
+ (n, e) => {
1091
1122
  if (e.type === "JSXSpreadAttribute")
1092
- return t.push([]), t;
1093
- let o = e.name.type === "JSXNamespacedName" ? `${e.name.namespace.name}:${e.name.name.name}` : e.name.name, { getGroup: r, defineGroup: c, setCustomGroups: d } = M(
1094
- n.groups
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(
1125
+ s.groups
1095
1126
  );
1096
- d(n["custom-groups"], o), e.value === null && c("shorthand"), e.loc.start.line !== e.loc.end.line && c("multiline");
1127
+ c(s["custom-groups"], a), e.value === null && o("shorthand"), e.loc.start.line !== e.loc.end.line && o("multiline");
1097
1128
  let y = {
1098
1129
  size: v(e.range),
1099
- group: r(),
1130
+ group: i(),
1100
1131
  node: e,
1101
- name: o
1132
+ name: a
1102
1133
  };
1103
- return t.at(-1).push(y), t;
1134
+ return n.at(-1).push(y), n;
1104
1135
  },
1105
1136
  [[]]
1106
1137
  );
1107
- for (let t of u)
1108
- C(t, (e, o) => {
1109
- let r = x(n.groups, e), c = x(n.groups, o);
1110
- (r > c || r === c && j(w(e, o, n))) && s.report({
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({
1111
1142
  messageId: "unexpectedJSXPropsOrder",
1112
1143
  data: {
1113
1144
  left: e.name,
1114
- right: o.name
1145
+ right: a.name
1115
1146
  },
1116
- node: o.node,
1117
- fix: (d) => {
1147
+ node: a.node,
1148
+ fix: (c) => {
1118
1149
  let y = {};
1119
- for (let g of t) {
1120
- let p = x(n.groups, g);
1121
- p in y ? y[p] = A(
1122
- [...y[p], g],
1123
- n
1124
- ) : y[p] = [g];
1150
+ for (let f of n) {
1151
+ let g = x(s.groups, f);
1152
+ g in y ? y[g] = A(
1153
+ [...y[g], f],
1154
+ s
1155
+ ) : y[g] = [f];
1125
1156
  }
1126
- let m = [];
1127
- for (let g of Object.keys(y).sort())
1128
- m.push(...A(y[g], n));
1129
- return P(d, t, m, a);
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);
1130
1161
  }
1131
1162
  });
1132
1163
  });
1133
1164
  }
1134
1165
  }
1135
1166
  }
1136
- }), Z = "sort-exports", Ee = O({
1137
- name: Z,
1167
+ }), re = "sort-exports", Ne = j({
1168
+ name: re,
1138
1169
  meta: {
1139
1170
  type: "suggestion",
1140
1171
  docs: {
@@ -1147,16 +1178,16 @@ const J = "sort-array-includes", de = O({
1147
1178
  properties: {
1148
1179
  type: {
1149
1180
  enum: [
1150
- i.alphabetical,
1151
- i.natural,
1152
- i["line-length"]
1181
+ p.alphabetical,
1182
+ p.natural,
1183
+ p["line-length"]
1153
1184
  ],
1154
- default: i.alphabetical,
1185
+ default: p.alphabetical,
1155
1186
  type: "string"
1156
1187
  },
1157
1188
  order: {
1158
- enum: [f.asc, f.desc],
1159
- default: f.asc,
1189
+ enum: [d.asc, d.desc],
1190
+ default: d.asc,
1160
1191
  type: "string"
1161
1192
  },
1162
1193
  "ignore-case": {
@@ -1173,46 +1204,46 @@ const J = "sort-array-includes", de = O({
1173
1204
  },
1174
1205
  defaultOptions: [
1175
1206
  {
1176
- type: i.alphabetical,
1177
- order: f.asc
1207
+ type: p.alphabetical,
1208
+ order: d.asc
1178
1209
  }
1179
1210
  ],
1180
- create: (s) => {
1181
- let l = k(s.options.at(0), {
1182
- type: i.alphabetical,
1183
- order: f.asc,
1211
+ create: (r) => {
1212
+ let l = C(r.options.at(0), {
1213
+ type: p.alphabetical,
1214
+ order: d.asc,
1184
1215
  "ignore-case": !1
1185
- }), n = [[]], a = (u) => {
1186
- u.type === "ExportAllDeclaration" && u.exported === null ? n.push([]) : n.at(-1).push({
1216
+ }), s = [[]], t = (u) => {
1217
+ u.type === "ExportAllDeclaration" && u.exported === null ? s.push([]) : s.at(-1).push({
1187
1218
  size: v(u.range),
1188
1219
  name: u.source.value,
1189
1220
  node: u
1190
1221
  });
1191
1222
  };
1192
1223
  return {
1193
- ExportAllDeclaration: a,
1224
+ ExportAllDeclaration: t,
1194
1225
  ExportNamedDeclaration: (u) => {
1195
- u.source !== null && a(u);
1226
+ u.source !== null && t(u);
1196
1227
  },
1197
1228
  "Program:exit": () => {
1198
- let u = s.getSourceCode();
1199
- for (let t of n)
1200
- C(t, (e, o) => {
1201
- j(w(e, o, l)) && s.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({
1202
1233
  messageId: "unexpectedExportsOrder",
1203
1234
  data: {
1204
1235
  left: e.name,
1205
- right: o.name
1236
+ right: a.name
1206
1237
  },
1207
- node: o.node,
1208
- fix: (r) => P(r, t, A(t, l), u)
1238
+ node: a.node,
1239
+ fix: (i) => T(i, n, A(n, l), u)
1209
1240
  });
1210
1241
  });
1211
1242
  }
1212
1243
  };
1213
1244
  }
1214
- }), ee = "sort-imports", Se = O({
1215
- name: ee,
1245
+ }), se = "sort-imports", Oe = j({
1246
+ name: se,
1216
1247
  meta: {
1217
1248
  type: "suggestion",
1218
1249
  docs: {
@@ -1221,6 +1252,7 @@ const J = "sort-array-includes", de = O({
1221
1252
  fixable: "code",
1222
1253
  schema: [
1223
1254
  {
1255
+ id: "sort-imports",
1224
1256
  type: "object",
1225
1257
  properties: {
1226
1258
  "custom-groups": {
@@ -1237,16 +1269,16 @@ const J = "sort-array-includes", de = O({
1237
1269
  },
1238
1270
  type: {
1239
1271
  enum: [
1240
- i.alphabetical,
1241
- i.natural,
1242
- i["line-length"]
1272
+ p.alphabetical,
1273
+ p.natural,
1274
+ p["line-length"]
1243
1275
  ],
1244
- default: i.alphabetical,
1276
+ default: p.alphabetical,
1245
1277
  type: "string"
1246
1278
  },
1247
1279
  order: {
1248
- enum: [f.asc, f.desc],
1249
- default: f.asc,
1280
+ enum: [d.asc, d.desc],
1281
+ default: d.asc,
1250
1282
  type: "string"
1251
1283
  },
1252
1284
  "ignore-case": {
@@ -1272,9 +1304,38 @@ const J = "sort-array-includes", de = O({
1272
1304
  ],
1273
1305
  default: "always",
1274
1306
  type: "string"
1307
+ },
1308
+ "max-line-length": {
1309
+ type: "integer",
1310
+ minimum: 0,
1311
+ exclusiveMinimum: !0
1275
1312
  }
1276
1313
  },
1277
- 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
+ }
1278
1339
  }
1279
1340
  ],
1280
1341
  messages: {
@@ -1285,31 +1346,31 @@ const J = "sort-array-includes", de = O({
1285
1346
  },
1286
1347
  defaultOptions: [
1287
1348
  {
1288
- type: i.alphabetical,
1289
- order: f.asc
1349
+ type: p.alphabetical,
1350
+ order: d.asc
1290
1351
  }
1291
1352
  ],
1292
- create: (s) => {
1293
- let l = k(s.options.at(0), {
1353
+ create: (r) => {
1354
+ let l = C(r.options.at(0), {
1294
1355
  "newlines-between": "always",
1295
1356
  "custom-groups": { type: {}, value: {} },
1296
1357
  "internal-pattern": ["~/**"],
1297
- type: i.alphabetical,
1298
- order: f.asc,
1358
+ type: p.alphabetical,
1359
+ order: d.asc,
1299
1360
  "ignore-case": !1,
1300
1361
  groups: []
1301
- }), n = !1;
1302
- for (let r of l.groups)
1303
- if (Array.isArray(r))
1304
- for (let c of r)
1305
- c === "unknown" && (n = !0);
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);
1306
1367
  else
1307
- r === "unknown" && (n = !0);
1308
- n || (l.groups = [...l.groups, "unknown"]);
1309
- let a = s.getSourceCode(), u = [], t = (r) => r.type === "ImportDeclaration" && r.specifiers.length === 0, e = (r) => {
1310
- let c = (b) => [".less", ".scss", ".sass", ".styl", ".pcss", ".css", ".sss"].some(
1311
- (T) => b.endsWith(T)
1312
- ), d = (b) => [
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) => [
1313
1374
  "./index.d.js",
1314
1375
  "./index.d.ts",
1315
1376
  "./index.js",
@@ -1317,12 +1378,12 @@ const J = "sort-array-includes", de = O({
1317
1378
  "./index",
1318
1379
  "./",
1319
1380
  "."
1320
- ].includes(b), y = (b) => b.indexOf("..") === 0, m = (b) => b.indexOf("./") === 0, { getGroup: g, defineGroup: p, setCustomGroups: h } = M(l.groups), S = (b) => l["internal-pattern"].length && l["internal-pattern"].some(
1321
- (T) => $(b.source.value, T, {
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, {
1322
1383
  nocomment: !0
1323
1384
  })
1324
- ), N = (b) => {
1325
- let T = [
1385
+ ), b = (S) => {
1386
+ let L = [
1326
1387
  "bun",
1327
1388
  "bun:ffi",
1328
1389
  "bun:jsc",
@@ -1333,83 +1394,86 @@ const J = "sort-array-includes", de = O({
1333
1394
  "undici",
1334
1395
  "ws"
1335
1396
  ];
1336
- return ie.includes(
1337
- b.startsWith("node:") ? b.split("node:")[1] : b
1338
- ) || T.includes(b);
1339
- }, E = (b) => !(b.startsWith(".") || b.startsWith("/"));
1340
- return r.importKind === "type" && (r.type === "ImportDeclaration" && (h(l["custom-groups"].type, r.source.value), d(r.source.value) && p("index-type"), m(r.source.value) && p("sibling-type"), y(r.source.value) && p("parent-type"), S(r) && p("internal-type"), N(r.source.value) && p("builtin-type"), E(r.source.value) && p("external-type")), p("type")), r.type === "ImportDeclaration" && (h(l["custom-groups"].value, r.source.value), t(r) && p("side-effect"), c(r.source.value) && p("style"), d(r.source.value) && p("index"), m(r.source.value) && p("sibling"), y(r.source.value) && p("parent"), S(r) && p("internal"), N(r.source.value) && p("builtin"), E(r.source.value) && p("external")), g();
1341
- }, o = (r) => {
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) => {
1342
1403
  let c;
1343
- r.type === "ImportDeclaration" ? c = r.source.value : r.moduleReference.type === "TSExternalModuleReference" && r.moduleReference.expression.type === "Literal" ? c = `${r.moduleReference.expression.value}` : c = a.text.slice(...r.moduleReference.range), u.push({
1344
- size: v(r.range),
1345
- group: e(r),
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),
1346
1407
  name: c,
1347
- node: r
1408
+ node: o,
1409
+ ...l.type === p["line-length"] && l["max-line-length"] && {
1410
+ hasMultipleImportDeclarations: a(
1411
+ o
1412
+ )
1413
+ }
1348
1414
  });
1349
1415
  };
1350
1416
  return {
1351
- TSImportEqualsDeclaration: o,
1352
- ImportDeclaration: o,
1417
+ TSImportEqualsDeclaration: i,
1418
+ ImportDeclaration: i,
1353
1419
  "Program:exit": () => {
1354
- var m;
1355
- let r = (g, p) => !!a.getTokensBetween(
1356
- g.node,
1357
- _(p.node, a) || p.node,
1420
+ var h;
1421
+ let o = (f, g) => !!t.getTokensBetween(
1422
+ f.node,
1423
+ J(g.node, t) || g.node,
1358
1424
  {
1359
1425
  includeComments: !0
1360
1426
  }
1361
- ).length, c = (g, p) => a.lines.slice(
1362
- g.node.loc.end.line,
1363
- p.node.loc.start.line - 1
1364
- ).filter((S) => !S.trim().length).length, d = (g, p) => {
1365
- let h = [], S = {};
1366
- for (let E of p) {
1367
- let b = x(l.groups, E);
1368
- b in S ? S[b] = A(
1369
- [...S[b], E],
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],
1370
1433
  l
1371
- ) : S[b] = [E];
1434
+ ) : w[N] = [b];
1372
1435
  }
1373
- let N = Object.keys(S).sort().reduce(
1374
- (E, b) => [
1375
- ...E,
1376
- ...S[b]
1436
+ let E = Object.keys(w).sort().reduce(
1437
+ (b, N) => [
1438
+ ...b,
1439
+ ...w[N]
1377
1440
  ],
1378
1441
  []
1379
1442
  );
1380
- for (let E = 0, b = N.length; E < b; E++) {
1381
- let T = N.at(E);
1382
- if (h.push(
1383
- g.replaceTextRange(
1384
- G(p.at(E).node, a),
1385
- a.text.slice(...G(T.node, a))
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))
1386
1449
  )
1387
1450
  ), l["newlines-between"] !== "ignore") {
1388
- let L = N.at(E + 1);
1451
+ let L = E.at(b + 1);
1389
1452
  if (L) {
1390
- let R = c(
1391
- p.at(E),
1392
- p.at(E + 1)
1453
+ let G = B(
1454
+ t,
1455
+ g.at(b),
1456
+ g.at(b + 1)
1393
1457
  );
1394
- (l["newlines-between"] === "always" && x(l.groups, T) === x(l.groups, L) && R !== 0 || l["newlines-between"] === "never" && R > 0) && h.push(
1395
- g.removeRange([
1396
- G(p.at(E).node, a).at(1),
1397
- G(p.at(E + 1).node, a).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
1398
1462
  ])
1399
- ), l["newlines-between"] === "always" && x(l.groups, T) !== x(l.groups, L) && R > 1 && h.push(
1400
- g.replaceTextRange(
1463
+ ), l["newlines-between"] === "always" && x(l.groups, S) !== x(l.groups, L) && G > 1 && m.push(
1464
+ f.replaceTextRange(
1401
1465
  [
1402
- G(p.at(E).node, a).at(1),
1403
- G(p.at(E + 1).node, a).at(
1466
+ M(g.at(b).node, t).at(1),
1467
+ M(g.at(b + 1).node, t).at(
1404
1468
  0
1405
1469
  ) - 1
1406
1470
  ],
1407
1471
  `
1408
1472
  `
1409
1473
  )
1410
- ), l["newlines-between"] === "always" && x(l.groups, T) !== x(l.groups, L) && R === 0 && h.push(
1411
- g.insertTextAfterRange(
1412
- G(p.at(E).node, a),
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),
1413
1477
  `
1414
1478
  `
1415
1479
  )
@@ -1417,54 +1481,54 @@ const J = "sort-array-includes", de = O({
1417
1481
  }
1418
1482
  }
1419
1483
  }
1420
- return h;
1484
+ return m;
1421
1485
  }, y = [[]];
1422
- for (let g of u) {
1423
- let p = (m = y.at(-1)) == null ? void 0 : m.at(-1);
1424
- p && r(p, g) ? y.push([g]) : y.at(-1).push(g);
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);
1425
1489
  }
1426
- for (let g of y)
1427
- C(g, (p, h) => {
1428
- let S = x(l.groups, p), N = x(l.groups, h), E = c(p, h);
1429
- !(t(p.node) && t(h.node)) && !r(p, h) && (S > N || S === N && j(w(p, h, l))) && s.report({
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({
1430
1494
  messageId: "unexpectedImportsOrder",
1431
1495
  data: {
1432
- left: p.name,
1433
- right: h.name
1496
+ left: g.name,
1497
+ right: m.name
1434
1498
  },
1435
- node: h.node,
1436
- fix: (b) => d(b, g)
1437
- }), l["newlines-between"] === "never" && E > 0 && s.report({
1499
+ node: m.node,
1500
+ fix: (N) => c(N, f)
1501
+ }), l["newlines-between"] === "never" && b > 0 && r.report({
1438
1502
  messageId: "extraSpacingBetweenImports",
1439
1503
  data: {
1440
- left: p.name,
1441
- right: h.name
1504
+ left: g.name,
1505
+ right: m.name
1442
1506
  },
1443
- node: h.node,
1444
- fix: (b) => d(b, g)
1445
- }), l["newlines-between"] === "always" && (S < N && E === 0 ? s.report({
1507
+ node: m.node,
1508
+ fix: (N) => c(N, f)
1509
+ }), l["newlines-between"] === "always" && (w < E && b === 0 ? r.report({
1446
1510
  messageId: "missedSpacingBetweenImports",
1447
1511
  data: {
1448
- left: p.name,
1449
- right: h.name
1512
+ left: g.name,
1513
+ right: m.name
1450
1514
  },
1451
- node: h.node,
1452
- fix: (b) => d(b, g)
1453
- }) : (E > 1 || S === N && E > 0) && s.report({
1515
+ node: m.node,
1516
+ fix: (N) => c(N, f)
1517
+ }) : (b > 1 || w === E && b > 0) && r.report({
1454
1518
  messageId: "extraSpacingBetweenImports",
1455
1519
  data: {
1456
- left: p.name,
1457
- right: h.name
1520
+ left: g.name,
1521
+ right: m.name
1458
1522
  },
1459
- node: h.node,
1460
- fix: (b) => d(b, g)
1523
+ node: m.node,
1524
+ fix: (N) => c(N, f)
1461
1525
  }));
1462
1526
  });
1463
1527
  }
1464
1528
  };
1465
1529
  }
1466
- }), te = "sort-objects", Ae = O({
1467
- name: te,
1530
+ }), ae = "sort-objects", Ie = j({
1531
+ name: ae,
1468
1532
  meta: {
1469
1533
  type: "suggestion",
1470
1534
  docs: {
@@ -1482,22 +1546,26 @@ const J = "sort-array-includes", de = O({
1482
1546
  type: ["boolean", "string", "array"],
1483
1547
  default: !1
1484
1548
  },
1549
+ "partition-by-new-line": {
1550
+ type: "boolean",
1551
+ default: !1
1552
+ },
1485
1553
  "styled-components": {
1486
1554
  type: "boolean",
1487
1555
  default: !0
1488
1556
  },
1489
1557
  type: {
1490
1558
  enum: [
1491
- i.alphabetical,
1492
- i.natural,
1493
- i["line-length"]
1559
+ p.alphabetical,
1560
+ p.natural,
1561
+ p["line-length"]
1494
1562
  ],
1495
- default: i.alphabetical,
1563
+ default: p.alphabetical,
1496
1564
  type: "string"
1497
1565
  },
1498
1566
  order: {
1499
- enum: [f.asc, f.desc],
1500
- default: f.asc,
1567
+ enum: [d.asc, d.desc],
1568
+ default: d.asc,
1501
1569
  type: "string"
1502
1570
  },
1503
1571
  "ignore-case": {
@@ -1517,107 +1585,113 @@ const J = "sort-array-includes", de = O({
1517
1585
  },
1518
1586
  defaultOptions: [
1519
1587
  {
1520
- type: i.alphabetical,
1521
- order: f.asc
1588
+ type: p.alphabetical,
1589
+ order: d.asc
1522
1590
  }
1523
1591
  ],
1524
- create: (s) => {
1525
- let l = (n) => {
1526
- if (n.properties.length > 1) {
1527
- let a = k(s.options.at(0), {
1592
+ create: (r) => {
1593
+ let l = (s) => {
1594
+ if (s.properties.length > 1) {
1595
+ let t = C(r.options.at(0), {
1596
+ "partition-by-new-line": !1,
1528
1597
  "partition-by-comment": !1,
1529
- type: i.alphabetical,
1598
+ type: p.alphabetical,
1530
1599
  "styled-components": !0,
1531
1600
  "ignore-case": !1,
1532
- order: f.asc,
1601
+ order: d.asc,
1533
1602
  "custom-groups": {},
1534
1603
  groups: []
1535
- }), u = (r) => r.type === "Identifier" && r.name === "styled", t = (r) => r !== void 0 && r.type === "CallExpression" && (r.callee.type === "MemberExpression" && u(r.callee.object) || r.callee.type === "CallExpression" && u(r.callee.callee));
1536
- if (!a["styled-components"] && (t(n.parent) || n.parent.type === "ArrowFunctionExpression" && t(n.parent.parent)))
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)))
1537
1606
  return;
1538
- let e = s.getSourceCode(), o = (r) => r.reduce(
1539
- (c, d) => {
1540
- if (d.type === "SpreadElement" || d.type === "RestElement")
1541
- return c.push([]), c;
1542
- let y = _(d, e);
1543
- a["partition-by-comment"] && y && oe(
1544
- a["partition-by-comment"],
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"],
1545
1615
  y.value
1546
- ) && c.push([]);
1547
- let m, g = "ignore", p = [], { getGroup: h, setCustomGroups: S } = M(a.groups);
1548
- d.key.type === "Identifier" ? { name: m } = d.key : d.key.type === "Literal" ? m = `${d.key.value}` : m = e.text.slice(...d.key.range), d.value.type === "AssignmentPattern" && ((b) => {
1549
- b.right.type === "Identifier" && p.push(b.right.name);
1550
- let T = (L) => {
1551
- let R = [];
1552
- switch (L.type) {
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) {
1553
1629
  case "ArrowFunctionExpression":
1554
- R.push(L.body);
1630
+ U.push($.body);
1555
1631
  break;
1556
1632
  case "ConditionalExpression":
1557
- R.push(L.consequent, L.alternate);
1633
+ U.push($.consequent, $.alternate);
1558
1634
  break;
1559
1635
  case "LogicalExpression":
1560
1636
  case "BinaryExpression":
1561
- R.push(L.left, L.right);
1637
+ U.push($.left, $.right);
1562
1638
  break;
1563
1639
  case "CallExpression":
1564
- R.push(...L.arguments);
1640
+ U.push(...$.arguments);
1565
1641
  break;
1566
1642
  }
1567
- R.forEach((U) => {
1568
- U.type === "Identifier" && p.push(U.name), (U.type === "BinaryExpression" || U.type === "ConditionalExpression") && T(U);
1643
+ U.forEach((z) => {
1644
+ z.type === "Identifier" && m.push(z.name), (z.type === "BinaryExpression" || z.type === "ConditionalExpression") && ie(z);
1569
1645
  });
1570
1646
  };
1571
- switch (b.right.type) {
1647
+ switch (G.right.type) {
1572
1648
  case "ArrowFunctionExpression":
1573
1649
  case "ConditionalExpression":
1574
1650
  case "LogicalExpression":
1575
1651
  case "BinaryExpression":
1576
1652
  case "CallExpression":
1577
- T(b.right);
1653
+ ie(G.right);
1578
1654
  break;
1579
1655
  }
1580
- })(d.value), S(a["custom-groups"], m);
1656
+ })(c.value), E(t["custom-groups"], f);
1581
1657
  let N = {
1582
- size: v(d.range),
1583
- group: h(),
1584
- dependencies: p,
1585
- node: d,
1586
- position: g,
1587
- name: m
1658
+ ...b,
1659
+ group: w(),
1660
+ dependencies: m,
1661
+ position: g
1588
1662
  };
1589
- return c.at(-1).push(N), c;
1663
+ return o.at(-1).push(N), o;
1590
1664
  },
1591
1665
  [[]]
1592
1666
  );
1593
- for (let r of o(n.properties))
1594
- C(r, (c, d) => {
1595
- let y = x(a.groups, c), m = x(a.groups, d);
1596
- if (y > m || y === m && j(w(c, d, a))) {
1597
- let g = (p) => {
1598
- let h = {};
1599
- for (let N of r) {
1600
- let E = x(a.groups, N);
1601
- E in h ? h[E] = A(
1602
- [...h[E], N],
1603
- a
1604
- ) : h[E] = [N];
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];
1605
1679
  }
1606
- let S = [];
1607
- for (let N of Object.keys(h).sort())
1608
- S.push(...A(h[N], a));
1609
- return P(p, r, S, e, {
1610
- partitionComment: a["partition-by-comment"]
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"]
1611
1685
  });
1612
1686
  };
1613
- s.report({
1687
+ r.report({
1614
1688
  messageId: "unexpectedObjectsOrder",
1615
1689
  data: {
1616
- left: I(c.name),
1617
- right: I(d.name)
1690
+ left: I(o.name),
1691
+ right: I(c.name)
1618
1692
  },
1619
- node: d.node,
1620
- fix: g
1693
+ node: c.node,
1694
+ fix: f
1621
1695
  });
1622
1696
  }
1623
1697
  });
@@ -1628,8 +1702,8 @@ const J = "sort-array-includes", de = O({
1628
1702
  ObjectPattern: l
1629
1703
  };
1630
1704
  }
1631
- }), re = "sort-classes", Ne = O({
1632
- name: re,
1705
+ }), ne = "sort-classes", je = j({
1706
+ name: ne,
1633
1707
  meta: {
1634
1708
  type: "suggestion",
1635
1709
  docs: {
@@ -1642,11 +1716,11 @@ const J = "sort-array-includes", de = O({
1642
1716
  properties: {
1643
1717
  type: {
1644
1718
  enum: [
1645
- i.alphabetical,
1646
- i.natural,
1647
- i["line-length"]
1719
+ p.alphabetical,
1720
+ p.natural,
1721
+ p["line-length"]
1648
1722
  ],
1649
- default: i.alphabetical,
1723
+ default: p.alphabetical,
1650
1724
  type: "string"
1651
1725
  },
1652
1726
  "ignore-case": {
@@ -1654,8 +1728,8 @@ const J = "sort-array-includes", de = O({
1654
1728
  default: !1
1655
1729
  },
1656
1730
  order: {
1657
- enum: [f.asc, f.desc],
1658
- default: f.asc,
1731
+ enum: [d.asc, d.desc],
1732
+ default: d.asc,
1659
1733
  type: "string"
1660
1734
  },
1661
1735
  groups: {
@@ -1672,83 +1746,83 @@ const J = "sort-array-includes", de = O({
1672
1746
  },
1673
1747
  defaultOptions: [
1674
1748
  {
1675
- type: i.alphabetical,
1676
- order: f.asc
1749
+ type: p.alphabetical,
1750
+ order: d.asc
1677
1751
  }
1678
1752
  ],
1679
- create: (s) => ({
1753
+ create: (r) => ({
1680
1754
  ClassBody: (l) => {
1681
1755
  if (l.body.length > 1) {
1682
- let n = k(s.options.at(0), {
1683
- type: i.alphabetical,
1684
- order: f.asc,
1756
+ let s = C(r.options.at(0), {
1757
+ type: p.alphabetical,
1758
+ order: d.asc,
1685
1759
  "ignore-case": !1,
1686
1760
  groups: ["property", "constructor", "method", "unknown"]
1687
- }), a = s.getSourceCode(), u = l.body.map((t) => {
1688
- var d;
1689
- let e, { getGroup: o, defineGroup: r } = M(n.groups);
1690
- t.type === "StaticBlock" ? e = "static" : t.type === "TSIndexSignature" ? e = a.text.slice(
1691
- t.range.at(0),
1692
- ((d = t.typeAnnotation) == null ? void 0 : d.range.at(0)) ?? t.range.at(1)
1693
- ) : t.key.type === "Identifier" ? { name: e } = t.key : e = a.text.slice(...t.key.range);
1694
- let c = e.startsWith("_") || e.startsWith("#");
1695
- if (t.type === "MethodDefinition") {
1696
- t.kind === "constructor" && r("constructor");
1697
- let y = t.accessibility === "private" || c, m = t.static;
1698
- y && m && r("static-private-method"), y && r("private-method"), m && r("static-method"), t.kind === "get" && r("get-method"), t.kind === "set" && r("set-method"), r("method");
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");
1699
1773
  } else
1700
- t.type === "TSIndexSignature" ? r("index-signature") : t.type === "PropertyDefinition" && ((t.accessibility === "private" || c) && r("private-property"), t.static && r("static-property"), r("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"));
1701
1775
  return {
1702
- size: v(t.range),
1703
- group: o(),
1704
- node: t,
1776
+ size: v(n.range),
1777
+ group: a(),
1778
+ node: n,
1705
1779
  name: e
1706
1780
  };
1707
1781
  });
1708
- C(u, (t, e) => {
1709
- let o = x(n.groups, t), r = x(n.groups, e);
1710
- t.name !== e.name && (o > r || o === r && j(w(t, e, n))) && s.report({
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({
1711
1785
  messageId: "unexpectedClassesOrder",
1712
1786
  data: {
1713
- left: I(t.name),
1787
+ left: I(n.name),
1714
1788
  right: I(e.name)
1715
1789
  },
1716
1790
  node: e.node,
1717
- fix: (c) => {
1718
- let d = [], y = u.reduce(
1719
- (g, p) => {
1720
- let h = x(n.groups, p);
1721
- return h in g ? g[h] = A(
1722
- [...g[h], p],
1723
- n
1724
- ) : g[h] = [p], g;
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],
1797
+ s
1798
+ ) : f[m] = [g], f;
1725
1799
  },
1726
1800
  {}
1727
- ), m = Object.keys(y).sort().reduce(
1728
- (g, p) => [
1729
- ...g,
1730
- ...y[p]
1801
+ ), h = Object.keys(y).sort().reduce(
1802
+ (f, g) => [
1803
+ ...f,
1804
+ ...y[g]
1731
1805
  ],
1732
1806
  []
1733
1807
  );
1734
- for (let g = 0, p = m.length; g < p; g++)
1735
- d.push(
1736
- c.replaceTextRange(
1737
- G(u.at(g).node, a),
1738
- a.text.slice(
1739
- ...G(m.at(g).node, a)
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)
1740
1814
  )
1741
1815
  )
1742
1816
  );
1743
- return d;
1817
+ return c;
1744
1818
  }
1745
1819
  });
1746
1820
  });
1747
1821
  }
1748
1822
  }
1749
1823
  })
1750
- }), se = "sort-enums", we = O({
1751
- name: se,
1824
+ }), oe = "sort-enums", ve = j({
1825
+ name: oe,
1752
1826
  meta: {
1753
1827
  type: "suggestion",
1754
1828
  docs: {
@@ -1761,11 +1835,11 @@ const J = "sort-array-includes", de = O({
1761
1835
  properties: {
1762
1836
  type: {
1763
1837
  enum: [
1764
- i.alphabetical,
1765
- i.natural,
1766
- i["line-length"]
1838
+ p.alphabetical,
1839
+ p.natural,
1840
+ p["line-length"]
1767
1841
  ],
1768
- default: i.alphabetical,
1842
+ default: p.alphabetical,
1769
1843
  type: "string"
1770
1844
  },
1771
1845
  "ignore-case": {
@@ -1773,8 +1847,8 @@ const J = "sort-array-includes", de = O({
1773
1847
  default: !1
1774
1848
  },
1775
1849
  order: {
1776
- enum: [f.asc, f.desc],
1777
- default: f.asc,
1850
+ enum: [d.asc, d.desc],
1851
+ default: d.asc,
1778
1852
  type: "string"
1779
1853
  }
1780
1854
  },
@@ -1787,38 +1861,38 @@ const J = "sort-array-includes", de = O({
1787
1861
  },
1788
1862
  defaultOptions: [
1789
1863
  {
1790
- type: i.alphabetical,
1791
- order: f.asc
1864
+ type: p.alphabetical,
1865
+ order: d.asc
1792
1866
  }
1793
1867
  ],
1794
- create: (s) => ({
1868
+ create: (r) => ({
1795
1869
  TSEnumDeclaration: (l) => {
1796
- if (l.members.length > 1 && l.members.every(({ initializer: n }) => n)) {
1797
- let n = k(s.options.at(0), {
1798
- type: i.alphabetical,
1799
- order: f.asc,
1870
+ if (l.members.length > 1 && l.members.every(({ initializer: s }) => s)) {
1871
+ let s = C(r.options.at(0), {
1872
+ type: p.alphabetical,
1873
+ order: d.asc,
1800
1874
  "ignore-case": !1
1801
- }), a = s.getSourceCode(), u = l.members.map((t) => ({
1802
- name: t.id.type === "Literal" ? `${t.id.value}` : `${a.text.slice(...t.id.range)}`,
1803
- size: v(t.range),
1804
- node: t
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
1805
1879
  }));
1806
- C(u, (t, e) => {
1807
- j(w(t, e, n)) && s.report({
1880
+ P(u, (n, e) => {
1881
+ k(O(n, e, s)) && r.report({
1808
1882
  messageId: "unexpectedEnumsOrder",
1809
1883
  data: {
1810
- left: I(t.name),
1884
+ left: I(n.name),
1811
1885
  right: I(e.name)
1812
1886
  },
1813
1887
  node: e.node,
1814
- fix: (o) => P(o, u, A(u, n), a)
1888
+ fix: (a) => T(a, u, A(u, s), t)
1815
1889
  });
1816
1890
  });
1817
1891
  }
1818
1892
  }
1819
1893
  })
1820
- }), ae = "sort-maps", Ie = O({
1821
- name: ae,
1894
+ }), le = "sort-maps", ke = j({
1895
+ name: le,
1822
1896
  meta: {
1823
1897
  type: "suggestion",
1824
1898
  docs: {
@@ -1831,16 +1905,16 @@ const J = "sort-array-includes", de = O({
1831
1905
  properties: {
1832
1906
  type: {
1833
1907
  enum: [
1834
- i.alphabetical,
1835
- i.natural,
1836
- i["line-length"]
1908
+ p.alphabetical,
1909
+ p.natural,
1910
+ p["line-length"]
1837
1911
  ],
1838
- default: i.alphabetical,
1912
+ default: p.alphabetical,
1839
1913
  type: "string"
1840
1914
  },
1841
1915
  order: {
1842
- enum: [f.asc, f.desc],
1843
- default: f.asc,
1916
+ enum: [d.asc, d.desc],
1917
+ default: d.asc,
1844
1918
  type: "string"
1845
1919
  },
1846
1920
  "ignore-case": {
@@ -1857,46 +1931,46 @@ const J = "sort-array-includes", de = O({
1857
1931
  },
1858
1932
  defaultOptions: [
1859
1933
  {
1860
- type: i.alphabetical,
1861
- order: f.asc
1934
+ type: p.alphabetical,
1935
+ order: d.asc
1862
1936
  }
1863
1937
  ],
1864
- create: (s) => ({
1938
+ create: (r) => ({
1865
1939
  NewExpression: (l) => {
1866
1940
  if (l.callee.type === "Identifier" && l.callee.name === "Map" && l.arguments.length && l.arguments[0].type === "ArrayExpression") {
1867
- let [{ elements: n }] = l.arguments;
1868
- if (n.length > 1) {
1869
- let a = k(s.options.at(0), {
1870
- type: i.alphabetical,
1941
+ let [{ elements: s }] = l.arguments;
1942
+ if (s.length > 1) {
1943
+ let t = C(r.options.at(0), {
1944
+ type: p.alphabetical,
1871
1945
  "ignore-case": !1,
1872
- order: f.asc
1873
- }), u = s.getSourceCode(), t = n.reduce(
1874
- (e, o) => (o === null || o.type === "SpreadElement" ? e.push([]) : e.at(-1).push(o), 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),
1875
1949
  [[]]
1876
1950
  );
1877
- for (let e of t) {
1878
- let o = e.map((r) => {
1879
- let c;
1880
- if (r.type === "ArrayExpression") {
1881
- let [d] = r.elements;
1882
- 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}`;
1883
1957
  } else
1884
- c = u.text.slice(...r.range);
1958
+ o = u.text.slice(...i.range);
1885
1959
  return {
1886
- size: v(r.range),
1887
- node: r,
1888
- name: c
1960
+ size: v(i.range),
1961
+ node: i,
1962
+ name: o
1889
1963
  };
1890
1964
  });
1891
- C(o, (r, c) => {
1892
- j(w(r, c, a)) && s.report({
1965
+ P(a, (i, o) => {
1966
+ k(O(i, o, t)) && r.report({
1893
1967
  messageId: "unexpectedMapElementsOrder",
1894
1968
  data: {
1895
- left: I(r.name),
1896
- right: I(c.name)
1969
+ left: I(i.name),
1970
+ right: I(o.name)
1897
1971
  },
1898
- node: c.node,
1899
- fix: (d) => P(d, o, A(o, a), u)
1972
+ node: o.node,
1973
+ fix: (c) => T(c, a, A(a, t), u)
1900
1974
  });
1901
1975
  });
1902
1976
  }
@@ -1904,10 +1978,10 @@ const J = "sort-array-includes", de = O({
1904
1978
  }
1905
1979
  }
1906
1980
  })
1907
- }), Oe = "eslint-plugin-perfectionist";
1908
- let z = (s) => {
1981
+ }), Ce = "eslint-plugin-perfectionist";
1982
+ let V = (r) => {
1909
1983
  let l = {
1910
- [ee]: [
1984
+ [se]: [
1911
1985
  "error",
1912
1986
  {
1913
1987
  groups: [
@@ -1928,7 +2002,7 @@ let z = (s) => {
1928
2002
  "internal-pattern": ["~/**"]
1929
2003
  }
1930
2004
  ],
1931
- [re]: [
2005
+ [ne]: [
1932
2006
  "error",
1933
2007
  {
1934
2008
  groups: [
@@ -1945,78 +2019,78 @@ let z = (s) => {
1945
2019
  ]
1946
2020
  }
1947
2021
  ],
1948
- [te]: [
2022
+ [ae]: [
1949
2023
  "error",
1950
2024
  {
1951
2025
  "partition-by-comment": !1
1952
2026
  }
1953
2027
  ],
1954
- [J]: [
2028
+ [K]: [
1955
2029
  "error",
1956
2030
  {
1957
2031
  "spread-last": !0
1958
2032
  }
1959
2033
  ],
1960
- [W]: ["error"],
1961
- [V]: ["error"],
1962
2034
  [X]: ["error"],
1963
- [K]: ["error"],
1964
2035
  [q]: ["error"],
1965
2036
  [F]: ["error"],
1966
2037
  [H]: ["error"],
1967
2038
  [Q]: ["error"],
1968
2039
  [Y]: ["error"],
1969
2040
  [Z]: ["error"],
1970
- [se]: ["error"],
1971
- [ae]: ["error"]
2041
+ [ee]: ["error"],
2042
+ [te]: ["error"],
2043
+ [re]: ["error"],
2044
+ [oe]: ["error"],
2045
+ [le]: ["error"]
1972
2046
  };
1973
2047
  return {
1974
2048
  rules: Object.fromEntries(
1975
- Object.entries(l).map(([n, [a, u = {}]]) => [
1976
- `perfectionist/${n}`,
1977
- [a, Object.assign(u, s)]
2049
+ Object.entries(l).map(([s, [t, u = {}]]) => [
2050
+ `perfectionist/${s}`,
2051
+ [t, Object.assign(u, r)]
1978
2052
  ])
1979
2053
  ),
1980
2054
  plugins: ["perfectionist"]
1981
2055
  };
1982
2056
  };
1983
- const Te = {
2057
+ const Re = {
1984
2058
  rules: {
1985
- [J]: de,
1986
- [V]: ce,
1987
- [re]: Ne,
1988
- [se]: we,
1989
- [Z]: Ee,
1990
- [ee]: Se,
1991
- [Q]: be,
1992
- [Y]: xe,
1993
- [ae]: Ie,
1994
- [K]: ge,
2059
+ [K]: me,
1995
2060
  [q]: ye,
1996
- [F]: me,
2061
+ [ne]: je,
2062
+ [oe]: ve,
2063
+ [re]: Ne,
2064
+ [se]: Oe,
2065
+ [ee]: we,
1997
2066
  [te]: Ae,
1998
- [W]: ue,
1999
- [H]: he,
2000
- [X]: fe
2067
+ [le]: ke,
2068
+ [H]: be,
2069
+ [Q]: xe,
2070
+ [Y]: Ee,
2071
+ [ae]: Ie,
2072
+ [X]: ge,
2073
+ [Z]: Se,
2074
+ [F]: he
2001
2075
  },
2002
2076
  configs: {
2003
- "recommended-alphabetical": z({
2004
- type: i.alphabetical,
2005
- order: f.asc,
2077
+ "recommended-alphabetical": V({
2078
+ type: p.alphabetical,
2079
+ order: d.asc,
2006
2080
  "ignore-case": !1
2007
2081
  }),
2008
- "recommended-natural": z({
2009
- type: i.natural,
2010
- order: f.asc,
2082
+ "recommended-natural": V({
2083
+ type: p.natural,
2084
+ order: d.asc,
2011
2085
  "ignore-case": !1
2012
2086
  }),
2013
- "recommended-line-length": z({
2014
- type: i["line-length"],
2015
- order: f.desc
2087
+ "recommended-line-length": V({
2088
+ type: p["line-length"],
2089
+ order: d.desc
2016
2090
  })
2017
2091
  },
2018
- name: Oe
2092
+ name: Ce
2019
2093
  };
2020
2094
  export {
2021
- Te as default
2095
+ Re as default
2022
2096
  };