@isentinel/eslint-config 0.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.js ADDED
@@ -0,0 +1,2726 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __esm = (fn, res) => function __init() {
8
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
9
+ };
10
+ var __commonJS = (cb, mod) => function __require() {
11
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+
30
+ // node_modules/.pnpm/tsup@8.0.2_typescript@5.2.2/node_modules/tsup/assets/esm_shims.js
31
+ var init_esm_shims = __esm({
32
+ "node_modules/.pnpm/tsup@8.0.2_typescript@5.2.2/node_modules/tsup/assets/esm_shims.js"() {
33
+ "use strict";
34
+ }
35
+ });
36
+
37
+ // node_modules/.pnpm/eslint-plugin-simple-import-sort@12.0.0_eslint-ts-patch@8.57.0-0/node_modules/eslint-plugin-simple-import-sort/shared.js
38
+ var require_shared = __commonJS({
39
+ "node_modules/.pnpm/eslint-plugin-simple-import-sort@12.0.0_eslint-ts-patch@8.57.0-0/node_modules/eslint-plugin-simple-import-sort/shared.js"(exports, module) {
40
+ "use strict";
41
+ init_esm_shims();
42
+ function extractChunks(parentNode, isPartOfChunk) {
43
+ const chunks = [];
44
+ let chunk = [];
45
+ let lastNode = void 0;
46
+ for (const node of parentNode.body) {
47
+ const result = isPartOfChunk(node, lastNode);
48
+ switch (result) {
49
+ case "PartOfChunk":
50
+ chunk.push(node);
51
+ break;
52
+ case "PartOfNewChunk":
53
+ if (chunk.length > 0) {
54
+ chunks.push(chunk);
55
+ }
56
+ chunk = [node];
57
+ break;
58
+ case "NotPartOfChunk":
59
+ if (chunk.length > 0) {
60
+ chunks.push(chunk);
61
+ chunk = [];
62
+ }
63
+ break;
64
+ default:
65
+ throw new Error(`Unknown chunk result: ${result}`);
66
+ }
67
+ lastNode = node;
68
+ }
69
+ if (chunk.length > 0) {
70
+ chunks.push(chunk);
71
+ }
72
+ return chunks;
73
+ }
74
+ function maybeReportSorting(context, sorted, start, end) {
75
+ const sourceCode = getSourceCode(context);
76
+ const original = sourceCode.getText().slice(start, end);
77
+ if (original !== sorted) {
78
+ context.report({
79
+ messageId: "sort",
80
+ loc: {
81
+ start: sourceCode.getLocFromIndex(start),
82
+ end: sourceCode.getLocFromIndex(end)
83
+ },
84
+ fix: (fixer) => fixer.replaceTextRange([start, end], sorted)
85
+ });
86
+ }
87
+ }
88
+ function printSortedItems(sortedItems, originalItems, sourceCode) {
89
+ const newline = guessNewline(sourceCode);
90
+ const sorted = sortedItems.map(
91
+ (groups) => groups.map((groupItems) => groupItems.map((item) => item.code).join(newline)).join(newline)
92
+ ).join(newline + newline);
93
+ const flattened = flatMap(sortedItems, (groups) => [].concat(...groups));
94
+ const lastSortedItem = flattened[flattened.length - 1];
95
+ const lastOriginalItem = originalItems[originalItems.length - 1];
96
+ const nextToken = lastSortedItem.needsNewline ? sourceCode.getTokenAfter(lastOriginalItem.node, {
97
+ includeComments: true,
98
+ filter: (token) => !isLineComment(token) && !(isBlockComment(token) && token.loc.end.line === lastOriginalItem.node.loc.end.line)
99
+ }) : void 0;
100
+ const maybeNewline = nextToken != null && nextToken.loc.start.line === lastOriginalItem.node.loc.end.line ? newline : "";
101
+ return sorted + maybeNewline;
102
+ }
103
+ function getImportExportItems(passedChunk, sourceCode, isSideEffectImport, getSpecifiers) {
104
+ const chunk = handleLastSemicolon(passedChunk, sourceCode);
105
+ return chunk.map((node, nodeIndex) => {
106
+ const lastLine = nodeIndex === 0 ? node.loc.start.line - 1 : chunk[nodeIndex - 1].loc.end.line;
107
+ const commentsBefore = sourceCode.getCommentsBefore(node).filter(
108
+ (comment) => comment.loc.start.line <= node.loc.start.line && comment.loc.end.line > lastLine && (nodeIndex > 0 || comment.loc.start.line > lastLine)
109
+ );
110
+ const commentsAfter = sourceCode.getCommentsAfter(node).filter((comment) => comment.loc.end.line === node.loc.end.line);
111
+ const before = printCommentsBefore(node, commentsBefore, sourceCode);
112
+ const after = printCommentsAfter(node, commentsAfter, sourceCode);
113
+ const indentation = getIndentation(
114
+ commentsBefore.length > 0 ? commentsBefore[0] : node,
115
+ sourceCode
116
+ );
117
+ const trailingSpaces = getTrailingSpaces(
118
+ commentsAfter.length > 0 ? commentsAfter[commentsAfter.length - 1] : node,
119
+ sourceCode
120
+ );
121
+ const code = indentation + before + printWithSortedSpecifiers(node, sourceCode, getSpecifiers) + after + trailingSpaces;
122
+ const all = [...commentsBefore, node, ...commentsAfter];
123
+ const [start] = all[0].range;
124
+ const [, end] = all[all.length - 1].range;
125
+ const source = getSource(node);
126
+ return {
127
+ node,
128
+ code,
129
+ start: start - indentation.length,
130
+ end: end + trailingSpaces.length,
131
+ isSideEffectImport: isSideEffectImport(node, sourceCode),
132
+ source,
133
+ index: nodeIndex,
134
+ needsNewline: commentsAfter.length > 0 && isLineComment(commentsAfter[commentsAfter.length - 1])
135
+ };
136
+ });
137
+ }
138
+ function handleLastSemicolon(chunk, sourceCode) {
139
+ const lastIndex = chunk.length - 1;
140
+ const lastNode = chunk[lastIndex];
141
+ const [nextToLastToken, lastToken] = sourceCode.getLastTokens(lastNode, {
142
+ count: 2
143
+ });
144
+ const lastIsSemicolon = isPunctuator(lastToken, ";");
145
+ if (!lastIsSemicolon) {
146
+ return chunk;
147
+ }
148
+ const semicolonBelongsToNode = nextToLastToken.loc.end.line === lastToken.loc.start.line || // If there’s no more code after the last import/export the semicolon has to
149
+ // belong to the import/export, even if it is not on the same line.
150
+ sourceCode.getTokenAfter(lastToken) == null;
151
+ if (semicolonBelongsToNode) {
152
+ return chunk;
153
+ }
154
+ const newLastNode = {
155
+ ...lastNode,
156
+ range: [lastNode.range[0], nextToLastToken.range[1]],
157
+ loc: {
158
+ start: lastNode.loc.start,
159
+ end: nextToLastToken.loc.end
160
+ }
161
+ };
162
+ return chunk.slice(0, lastIndex).concat(newLastNode);
163
+ }
164
+ function printWithSortedSpecifiers(node, sourceCode, getSpecifiers) {
165
+ const allTokens = getAllTokens(node, sourceCode);
166
+ const openBraceIndex = allTokens.findIndex(
167
+ (token) => isPunctuator(token, "{")
168
+ );
169
+ const closeBraceIndex = allTokens.findIndex(
170
+ (token) => isPunctuator(token, "}")
171
+ );
172
+ const specifiers = getSpecifiers(node);
173
+ if (openBraceIndex === -1 || closeBraceIndex === -1 || specifiers.length <= 1) {
174
+ return printTokens(allTokens);
175
+ }
176
+ const specifierTokens = allTokens.slice(openBraceIndex + 1, closeBraceIndex);
177
+ const itemsResult = getSpecifierItems(specifierTokens, sourceCode);
178
+ const items = itemsResult.items.map((originalItem, index) => ({
179
+ ...originalItem,
180
+ node: specifiers[index]
181
+ }));
182
+ const sortedItems = sortSpecifierItems(items);
183
+ const newline = guessNewline(sourceCode);
184
+ const hasTrailingComma = isPunctuator(
185
+ sourceCode.getTokenBefore(allTokens[closeBraceIndex]),
186
+ ","
187
+ );
188
+ const lastIndex = sortedItems.length - 1;
189
+ const sorted = flatMap(sortedItems, (item, index) => {
190
+ const previous = index === 0 ? void 0 : sortedItems[index - 1];
191
+ const maybeNewline2 = previous != null && needsStartingNewline(item.before) && !(previous.after.length > 0 && isNewline(previous.after[previous.after.length - 1])) ? [{ type: "Newline", code: newline }] : [];
192
+ if (index < lastIndex || hasTrailingComma) {
193
+ return [
194
+ ...maybeNewline2,
195
+ ...item.before,
196
+ ...item.specifier,
197
+ { type: "Comma", code: "," },
198
+ ...item.after
199
+ ];
200
+ }
201
+ const nonBlankIndex = item.after.findIndex(
202
+ (token) => !isNewline(token) && !isSpaces(token)
203
+ );
204
+ const after = !item.hadComma ? item.after : nonBlankIndex === -1 ? [] : item.after.slice(nonBlankIndex);
205
+ return [...maybeNewline2, ...item.before, ...item.specifier, ...after];
206
+ });
207
+ const maybeNewline = needsStartingNewline(itemsResult.after) && !isNewline(sorted[sorted.length - 1]) ? [{ type: "Newline", code: newline }] : [];
208
+ return printTokens([
209
+ ...allTokens.slice(0, openBraceIndex + 1),
210
+ ...itemsResult.before,
211
+ ...sorted,
212
+ ...maybeNewline,
213
+ ...itemsResult.after,
214
+ ...allTokens.slice(closeBraceIndex)
215
+ ]);
216
+ }
217
+ function getSpecifierItems(tokens) {
218
+ const result = {
219
+ before: [],
220
+ after: [],
221
+ items: []
222
+ };
223
+ let current = makeEmptyItem();
224
+ for (const token of tokens) {
225
+ switch (current.state) {
226
+ case "before":
227
+ switch (token.type) {
228
+ case "Newline":
229
+ current.before.push(token);
230
+ if (result.before.length === 0 && result.items.length === 0) {
231
+ result.before = current.before;
232
+ current = makeEmptyItem();
233
+ }
234
+ break;
235
+ case "Spaces":
236
+ case "Block":
237
+ case "Line":
238
+ current.before.push(token);
239
+ break;
240
+ default:
241
+ if (result.before.length === 0 && result.items.length === 0) {
242
+ result.before = current.before;
243
+ current = makeEmptyItem();
244
+ }
245
+ current.state = "specifier";
246
+ current.specifier.push(token);
247
+ }
248
+ break;
249
+ case "specifier":
250
+ switch (token.type) {
251
+ case "Punctuator":
252
+ if (isPunctuator(token, ",")) {
253
+ current.hadComma = true;
254
+ current.state = "after";
255
+ } else {
256
+ current.specifier.push(token);
257
+ }
258
+ break;
259
+ default:
260
+ current.specifier.push(token);
261
+ }
262
+ break;
263
+ case "after":
264
+ switch (token.type) {
265
+ case "Newline":
266
+ current.after.push(token);
267
+ result.items.push(current);
268
+ current = makeEmptyItem();
269
+ break;
270
+ case "Spaces":
271
+ case "Line":
272
+ current.after.push(token);
273
+ break;
274
+ case "Block":
275
+ if (hasNewline(token.code)) {
276
+ result.items.push(current);
277
+ current = makeEmptyItem();
278
+ current.before.push(token);
279
+ } else {
280
+ current.after.push(token);
281
+ }
282
+ break;
283
+ default:
284
+ result.items.push(current);
285
+ current = makeEmptyItem();
286
+ current.state = "specifier";
287
+ current.specifier.push(token);
288
+ }
289
+ break;
290
+ default:
291
+ throw new Error(`Unknown state: ${current.state}`);
292
+ }
293
+ }
294
+ switch (current.state) {
295
+ case "before":
296
+ result.after = current.before;
297
+ break;
298
+ case "specifier": {
299
+ const lastIdentifierIndex = findLastIndex(
300
+ current.specifier,
301
+ (token2) => isIdentifier(token2) || isKeyword(token2)
302
+ );
303
+ const specifier = current.specifier.slice(0, lastIdentifierIndex + 1);
304
+ const after = current.specifier.slice(lastIdentifierIndex + 1);
305
+ const newlineIndexRaw = after.findIndex((token2) => isNewline(token2));
306
+ const newlineIndex = newlineIndexRaw === -1 ? -1 : newlineIndexRaw + 1;
307
+ const multilineBlockCommentIndex = after.findIndex(
308
+ (token2) => isBlockComment(token2) && hasNewline(token2.code)
309
+ );
310
+ const sliceIndex = (
311
+ // If both a newline and a multiline block comment exists, choose the
312
+ // earlier one.
313
+ newlineIndex >= 0 && multilineBlockCommentIndex >= 0 ? Math.min(newlineIndex, multilineBlockCommentIndex) : newlineIndex >= 0 ? newlineIndex : multilineBlockCommentIndex >= 0 ? multilineBlockCommentIndex : (
314
+ // If there are no newlines, move the last whitespace into `result.after`.
315
+ endsWithSpaces(after) ? after.length - 1 : -1
316
+ )
317
+ );
318
+ current.specifier = specifier;
319
+ current.after = sliceIndex === -1 ? after : after.slice(0, sliceIndex);
320
+ result.items.push(current);
321
+ result.after = sliceIndex === -1 ? [] : after.slice(sliceIndex);
322
+ break;
323
+ }
324
+ case "after":
325
+ if (endsWithSpaces(current.after)) {
326
+ const last = current.after.pop();
327
+ result.after = [last];
328
+ }
329
+ result.items.push(current);
330
+ break;
331
+ default:
332
+ throw new Error(`Unknown state: ${current.state}`);
333
+ }
334
+ return result;
335
+ }
336
+ function makeEmptyItem() {
337
+ return {
338
+ // "before" | "specifier" | "after"
339
+ state: "before",
340
+ before: [],
341
+ after: [],
342
+ specifier: [],
343
+ hadComma: false
344
+ };
345
+ }
346
+ function needsStartingNewline(tokens) {
347
+ const before = tokens.filter((token) => !isSpaces(token));
348
+ if (before.length === 0) {
349
+ return false;
350
+ }
351
+ const firstToken = before[0];
352
+ return isLineComment(firstToken) || isBlockComment(firstToken) && !hasNewline(firstToken.code);
353
+ }
354
+ function endsWithSpaces(tokens) {
355
+ const last = tokens.length > 0 ? tokens[tokens.length - 1] : void 0;
356
+ return last == null ? false : isSpaces(last);
357
+ }
358
+ var NEWLINE = /(\r?\n)/;
359
+ function hasNewline(string) {
360
+ return NEWLINE.test(string);
361
+ }
362
+ function guessNewline(sourceCode) {
363
+ const match = NEWLINE.exec(sourceCode.text);
364
+ return match == null ? "\n" : match[0];
365
+ }
366
+ function parseWhitespace(whitespace) {
367
+ const allItems = whitespace.split(NEWLINE);
368
+ const items = allItems.length >= 5 ? allItems.slice(0, 2).concat(allItems.slice(-1)) : allItems;
369
+ return items.map(
370
+ (spacesOrNewline, index) => index % 2 === 0 ? { type: "Spaces", code: spacesOrNewline } : { type: "Newline", code: spacesOrNewline }
371
+ ).filter((token) => token.code !== "");
372
+ }
373
+ function removeBlankLines(whitespace) {
374
+ return printTokens(parseWhitespace(whitespace));
375
+ }
376
+ function getAllTokens(node, sourceCode) {
377
+ const tokens = sourceCode.getTokens(node);
378
+ const lastTokenIndex = tokens.length - 1;
379
+ return flatMap(tokens, (token, tokenIndex) => {
380
+ const newToken = { ...token, code: sourceCode.getText(token) };
381
+ if (tokenIndex === lastTokenIndex) {
382
+ return [newToken];
383
+ }
384
+ const comments2 = sourceCode.getCommentsAfter(token);
385
+ const last = comments2.length > 0 ? comments2[comments2.length - 1] : token;
386
+ const nextToken = tokens[tokenIndex + 1];
387
+ return [
388
+ newToken,
389
+ ...flatMap(comments2, (comment, commentIndex) => {
390
+ const previous = commentIndex === 0 ? token : comments2[commentIndex - 1];
391
+ return [
392
+ ...parseWhitespace(
393
+ sourceCode.text.slice(previous.range[1], comment.range[0])
394
+ ),
395
+ { ...comment, code: sourceCode.getText(comment) }
396
+ ];
397
+ }),
398
+ ...parseWhitespace(
399
+ sourceCode.text.slice(last.range[1], nextToken.range[0])
400
+ )
401
+ ];
402
+ });
403
+ }
404
+ function printTokens(tokens) {
405
+ return tokens.map((token) => token.code).join("");
406
+ }
407
+ function printCommentsBefore(node, comments2, sourceCode) {
408
+ const lastIndex = comments2.length - 1;
409
+ return comments2.map((comment, index) => {
410
+ const next = index === lastIndex ? node : comments2[index + 1];
411
+ return sourceCode.getText(comment) + removeBlankLines(sourceCode.text.slice(comment.range[1], next.range[0]));
412
+ }).join("");
413
+ }
414
+ function printCommentsAfter(node, comments2, sourceCode) {
415
+ return comments2.map((comment, index) => {
416
+ const previous = index === 0 ? node : comments2[index - 1];
417
+ return removeBlankLines(
418
+ sourceCode.text.slice(previous.range[1], comment.range[0])
419
+ ) + sourceCode.getText(comment);
420
+ }).join("");
421
+ }
422
+ function getIndentation(node, sourceCode) {
423
+ const tokenBefore = sourceCode.getTokenBefore(node, {
424
+ includeComments: true
425
+ });
426
+ if (tokenBefore == null) {
427
+ const text2 = sourceCode.text.slice(0, node.range[0]);
428
+ const lines2 = text2.split(NEWLINE);
429
+ return lines2[lines2.length - 1];
430
+ }
431
+ const text = sourceCode.text.slice(tokenBefore.range[1], node.range[0]);
432
+ const lines = text.split(NEWLINE);
433
+ return lines.length > 1 ? lines[lines.length - 1] : "";
434
+ }
435
+ function getTrailingSpaces(node, sourceCode) {
436
+ const tokenAfter = sourceCode.getTokenAfter(node, {
437
+ includeComments: true
438
+ });
439
+ if (tokenAfter == null) {
440
+ const text2 = sourceCode.text.slice(node.range[1]);
441
+ const lines2 = text2.split(NEWLINE);
442
+ return lines2[0];
443
+ }
444
+ const text = sourceCode.text.slice(node.range[1], tokenAfter.range[0]);
445
+ const lines = text.split(NEWLINE);
446
+ return lines[0];
447
+ }
448
+ function sortImportExportItems(items) {
449
+ return items.slice().sort(
450
+ (itemA, itemB) => (
451
+ // If both items are side effect imports, keep their original order.
452
+ itemA.isSideEffectImport && itemB.isSideEffectImport ? itemA.index - itemB.index : (
453
+ // If one of the items is a side effect import, move it first.
454
+ itemA.isSideEffectImport ? -1 : itemB.isSideEffectImport ? 1 : (
455
+ // Compare the `from` part.
456
+ compare(itemA.source.source, itemB.source.source) || // The `.source` has been slightly tweaked. To stay fully deterministic,
457
+ // also sort on the original value.
458
+ compare(itemA.source.originalSource, itemB.source.originalSource) || // Then put type imports/exports before regular ones.
459
+ compare(itemA.source.kind, itemB.source.kind) || // Keep the original order if the sources are the same. It’s not worth
460
+ // trying to compare anything else, and you can use `import/no-duplicates`
461
+ // to get rid of the problem anyway.
462
+ itemA.index - itemB.index
463
+ )
464
+ )
465
+ )
466
+ );
467
+ }
468
+ function sortSpecifierItems(items) {
469
+ return items.slice().sort(
470
+ (itemA, itemB) => (
471
+ // Compare by imported or exported name (external interface name).
472
+ // import { a as b } from "a"
473
+ // ^
474
+ // export { b as a }
475
+ // ^
476
+ compare(
477
+ (itemA.node.imported || itemA.node.exported).name,
478
+ (itemB.node.imported || itemB.node.exported).name
479
+ ) || // Then compare by the file-local name.
480
+ // import { a as b } from "a"
481
+ // ^
482
+ // export { b as a }
483
+ // ^
484
+ compare(itemA.node.local.name, itemB.node.local.name) || // Then put type specifiers before regular ones.
485
+ compare(
486
+ getImportExportKind(itemA.node),
487
+ getImportExportKind(itemB.node)
488
+ ) || // Keep the original order if the names are the same. It’s not worth
489
+ // trying to compare anything else, `import {a, a} from "mod"` is a syntax
490
+ // error anyway (but @babel/eslint-parser kind of supports it).
491
+ // istanbul ignore next
492
+ itemA.index - itemB.index
493
+ )
494
+ );
495
+ }
496
+ var collator = new Intl.Collator("en", {
497
+ sensitivity: "base",
498
+ numeric: true
499
+ });
500
+ function compare(a, b) {
501
+ return collator.compare(a, b) || (a < b ? -1 : a > b ? 1 : 0);
502
+ }
503
+ function isIdentifier(node) {
504
+ return node.type === "Identifier";
505
+ }
506
+ function isKeyword(node) {
507
+ return node.type === "Keyword";
508
+ }
509
+ function isPunctuator(node, value) {
510
+ return node.type === "Punctuator" && node.value === value;
511
+ }
512
+ function isBlockComment(node) {
513
+ return node.type === "Block";
514
+ }
515
+ function isLineComment(node) {
516
+ return node.type === "Line";
517
+ }
518
+ function isSpaces(node) {
519
+ return node.type === "Spaces";
520
+ }
521
+ function isNewline(node) {
522
+ return node.type === "Newline";
523
+ }
524
+ function getSource(node) {
525
+ const source = node.source.value;
526
+ return {
527
+ // Sort by directory level rather than by string length.
528
+ source: source.replace(/^[./]*\.$/, "$&/").replace(/^[./]*\/$/, "$&,").replace(/[./_-]/g, (char) => {
529
+ switch (char) {
530
+ case ".":
531
+ return "_";
532
+ case "/":
533
+ return "-";
534
+ case "_":
535
+ return ".";
536
+ case "-":
537
+ return "/";
538
+ default:
539
+ throw new Error(`Unknown source substitution character: ${char}`);
540
+ }
541
+ }),
542
+ originalSource: source,
543
+ kind: getImportExportKind(node)
544
+ };
545
+ }
546
+ function getImportExportKind(node) {
547
+ return node.importKind || node.exportKind || "value";
548
+ }
549
+ function findLastIndex(array, fn) {
550
+ for (let index = array.length - 1; index >= 0; index--) {
551
+ if (fn(array[index], index, array)) {
552
+ return index;
553
+ }
554
+ }
555
+ return -1;
556
+ }
557
+ function flatMap(array, fn) {
558
+ return [].concat(...array.map(fn));
559
+ }
560
+ function getSourceCode(context) {
561
+ return context.sourceCode || context.getSourceCode();
562
+ }
563
+ module.exports = {
564
+ extractChunks,
565
+ flatMap,
566
+ getImportExportItems,
567
+ getSourceCode,
568
+ isPunctuator,
569
+ maybeReportSorting,
570
+ printSortedItems,
571
+ printWithSortedSpecifiers,
572
+ sortImportExportItems
573
+ };
574
+ }
575
+ });
576
+
577
+ // node_modules/.pnpm/eslint-plugin-simple-import-sort@12.0.0_eslint-ts-patch@8.57.0-0/node_modules/eslint-plugin-simple-import-sort/imports.js
578
+ var require_imports = __commonJS({
579
+ "node_modules/.pnpm/eslint-plugin-simple-import-sort@12.0.0_eslint-ts-patch@8.57.0-0/node_modules/eslint-plugin-simple-import-sort/imports.js"(exports, module) {
580
+ "use strict";
581
+ init_esm_shims();
582
+ var shared = require_shared();
583
+ var defaultGroups = [
584
+ // Side effect imports.
585
+ ["^\\u0000"],
586
+ // Node.js builtins prefixed with `node:`.
587
+ ["^node:"],
588
+ // Packages.
589
+ // Things that start with a letter (or digit or underscore), or `@` followed by a letter.
590
+ ["^@?\\w"],
591
+ // Absolute imports and other imports such as Vue-style `@/foo`.
592
+ // Anything not matched in another group.
593
+ ["^"],
594
+ // Relative imports.
595
+ // Anything that starts with a dot.
596
+ ["^\\."]
597
+ ];
598
+ module.exports = {
599
+ meta: {
600
+ type: "layout",
601
+ fixable: "code",
602
+ schema: [
603
+ {
604
+ type: "object",
605
+ properties: {
606
+ groups: {
607
+ type: "array",
608
+ items: {
609
+ type: "array",
610
+ items: {
611
+ type: "string"
612
+ }
613
+ }
614
+ }
615
+ },
616
+ additionalProperties: false
617
+ }
618
+ ],
619
+ docs: {
620
+ url: "https://github.com/lydell/eslint-plugin-simple-import-sort#sort-order"
621
+ },
622
+ messages: {
623
+ sort: "Run autofix to sort these imports!"
624
+ }
625
+ },
626
+ create: (context) => {
627
+ const { groups: rawGroups = defaultGroups } = context.options[0] || {};
628
+ const outerGroups = rawGroups.map(
629
+ (groups) => groups.map((item) => RegExp(item, "u"))
630
+ );
631
+ const parents = /* @__PURE__ */ new Set();
632
+ return {
633
+ ImportDeclaration: (node) => {
634
+ parents.add(node.parent);
635
+ },
636
+ "Program:exit": () => {
637
+ for (const parent of parents) {
638
+ for (const chunk of shared.extractChunks(
639
+ parent,
640
+ (node) => isImport(node) ? "PartOfChunk" : "NotPartOfChunk"
641
+ )) {
642
+ maybeReportChunkSorting(chunk, context, outerGroups);
643
+ }
644
+ }
645
+ parents.clear();
646
+ }
647
+ };
648
+ }
649
+ };
650
+ function maybeReportChunkSorting(chunk, context, outerGroups) {
651
+ const sourceCode = shared.getSourceCode(context);
652
+ const items = shared.getImportExportItems(
653
+ chunk,
654
+ sourceCode,
655
+ isSideEffectImport,
656
+ getSpecifiers
657
+ );
658
+ const sortedItems = makeSortedItems(items, outerGroups);
659
+ const sorted = shared.printSortedItems(sortedItems, items, sourceCode);
660
+ const { start } = items[0];
661
+ const { end } = items[items.length - 1];
662
+ shared.maybeReportSorting(context, sorted, start, end);
663
+ }
664
+ function makeSortedItems(items, outerGroups) {
665
+ const itemGroups = outerGroups.map(
666
+ (groups) => groups.map((regex) => ({ regex, items: [] }))
667
+ );
668
+ const rest = [];
669
+ for (const item of items) {
670
+ const { originalSource } = item.source;
671
+ const source = item.isSideEffectImport ? `\0${originalSource}` : item.source.kind !== "value" ? `${originalSource}\0` : originalSource;
672
+ const [matchedGroup] = shared.flatMap(
673
+ itemGroups,
674
+ (groups) => groups.map((group) => [group, group.regex.exec(source)])
675
+ ).reduce(
676
+ ([group, longestMatch], [nextGroup, nextMatch]) => nextMatch != null && (longestMatch == null || nextMatch[0].length > longestMatch[0].length) ? [nextGroup, nextMatch] : [group, longestMatch],
677
+ [void 0, void 0]
678
+ );
679
+ if (matchedGroup == null) {
680
+ rest.push(item);
681
+ } else {
682
+ matchedGroup.items.push(item);
683
+ }
684
+ }
685
+ return itemGroups.concat([[{ regex: /^/, items: rest }]]).map((groups) => groups.filter((group) => group.items.length > 0)).filter((groups) => groups.length > 0).map(
686
+ (groups) => groups.map((group) => shared.sortImportExportItems(group.items))
687
+ );
688
+ }
689
+ function getSpecifiers(importNode) {
690
+ return importNode.specifiers.filter((node) => isImportSpecifier(node));
691
+ }
692
+ function isImport(node) {
693
+ return node.type === "ImportDeclaration";
694
+ }
695
+ function isImportSpecifier(node) {
696
+ return node.type === "ImportSpecifier";
697
+ }
698
+ function isSideEffectImport(importNode, sourceCode) {
699
+ return importNode.specifiers.length === 0 && (!importNode.importKind || importNode.importKind === "value") && !shared.isPunctuator(sourceCode.getFirstToken(importNode, { skip: 1 }), "{");
700
+ }
701
+ }
702
+ });
703
+
704
+ // node_modules/.pnpm/eslint-plugin-simple-import-sort@12.0.0_eslint-ts-patch@8.57.0-0/node_modules/eslint-plugin-simple-import-sort/exports.js
705
+ var require_exports = __commonJS({
706
+ "node_modules/.pnpm/eslint-plugin-simple-import-sort@12.0.0_eslint-ts-patch@8.57.0-0/node_modules/eslint-plugin-simple-import-sort/exports.js"(exports, module) {
707
+ "use strict";
708
+ init_esm_shims();
709
+ var shared = require_shared();
710
+ module.exports = {
711
+ meta: {
712
+ type: "layout",
713
+ fixable: "code",
714
+ schema: [],
715
+ docs: {
716
+ url: "https://github.com/lydell/eslint-plugin-simple-import-sort#sort-order"
717
+ },
718
+ messages: {
719
+ sort: "Run autofix to sort these exports!"
720
+ }
721
+ },
722
+ create: (context) => {
723
+ const parents = /* @__PURE__ */ new Set();
724
+ const addParent = (node) => {
725
+ if (isExportFrom(node)) {
726
+ parents.add(node.parent);
727
+ }
728
+ };
729
+ return {
730
+ ExportNamedDeclaration: (node) => {
731
+ if (node.source == null && node.declaration == null) {
732
+ maybeReportExportSpecifierSorting(node, context);
733
+ } else {
734
+ addParent(node);
735
+ }
736
+ },
737
+ ExportAllDeclaration: addParent,
738
+ "Program:exit": () => {
739
+ const sourceCode = shared.getSourceCode(context);
740
+ for (const parent of parents) {
741
+ for (const chunk of shared.extractChunks(
742
+ parent,
743
+ (node, lastNode) => isPartOfChunk(node, lastNode, sourceCode)
744
+ )) {
745
+ maybeReportChunkSorting(chunk, context);
746
+ }
747
+ }
748
+ parents.clear();
749
+ }
750
+ };
751
+ }
752
+ };
753
+ function maybeReportChunkSorting(chunk, context) {
754
+ const sourceCode = shared.getSourceCode(context);
755
+ const items = shared.getImportExportItems(
756
+ chunk,
757
+ sourceCode,
758
+ () => false,
759
+ // isSideEffectImport
760
+ getSpecifiers
761
+ );
762
+ const sortedItems = [[shared.sortImportExportItems(items)]];
763
+ const sorted = shared.printSortedItems(sortedItems, items, sourceCode);
764
+ const { start } = items[0];
765
+ const { end } = items[items.length - 1];
766
+ shared.maybeReportSorting(context, sorted, start, end);
767
+ }
768
+ function maybeReportExportSpecifierSorting(node, context) {
769
+ const sorted = shared.printWithSortedSpecifiers(
770
+ node,
771
+ shared.getSourceCode(context),
772
+ getSpecifiers
773
+ );
774
+ const [start, end] = node.range;
775
+ shared.maybeReportSorting(context, sorted, start, end);
776
+ }
777
+ function getSpecifiers(exportNode) {
778
+ return exportNode.specifiers || [];
779
+ }
780
+ function isPartOfChunk(node, lastNode, sourceCode) {
781
+ if (!isExportFrom(node)) {
782
+ return "NotPartOfChunk";
783
+ }
784
+ const hasGroupingComment = sourceCode.getCommentsBefore(node).some(
785
+ (comment) => (lastNode == null || comment.loc.start.line > lastNode.loc.end.line) && comment.loc.end.line < node.loc.start.line
786
+ );
787
+ return hasGroupingComment ? "PartOfNewChunk" : "PartOfChunk";
788
+ }
789
+ function isExportFrom(node) {
790
+ return (node.type === "ExportNamedDeclaration" || node.type === "ExportAllDeclaration") && node.source != null;
791
+ }
792
+ }
793
+ });
794
+
795
+ // node_modules/.pnpm/eslint-plugin-simple-import-sort@12.0.0_eslint-ts-patch@8.57.0-0/node_modules/eslint-plugin-simple-import-sort/index.js
796
+ var require_eslint_plugin_simple_import_sort = __commonJS({
797
+ "node_modules/.pnpm/eslint-plugin-simple-import-sort@12.0.0_eslint-ts-patch@8.57.0-0/node_modules/eslint-plugin-simple-import-sort/index.js"(exports, module) {
798
+ "use strict";
799
+ init_esm_shims();
800
+ var importsRule = require_imports();
801
+ var exportsRule = require_exports();
802
+ module.exports = {
803
+ meta: {
804
+ name: "eslint-plugin-simple-import-sort",
805
+ version: "12.0.0"
806
+ },
807
+ rules: {
808
+ imports: importsRule,
809
+ exports: exportsRule
810
+ }
811
+ };
812
+ }
813
+ });
814
+
815
+ // src/index.ts
816
+ init_esm_shims();
817
+
818
+ // src/configs/index.ts
819
+ init_esm_shims();
820
+
821
+ // src/configs/comments.ts
822
+ init_esm_shims();
823
+
824
+ // src/plugins.ts
825
+ init_esm_shims();
826
+ var import_eslint_plugin_simple_import_sort = __toESM(require_eslint_plugin_simple_import_sort(), 1);
827
+ import { default as default2 } from "@shopify/eslint-plugin";
828
+ import { default as default3 } from "eslint-config-prettier";
829
+ import { default as default4 } from "eslint-plugin-antfu";
830
+ import { default as default5 } from "eslint-plugin-arrow-return-style";
831
+ import { default as default6 } from "eslint-plugin-comment-length";
832
+ import { default as default7 } from "eslint-plugin-eslint-comments";
833
+ import { default as default8 } from "eslint-plugin-format";
834
+ import * as pluginImport from "eslint-plugin-i";
835
+ import { default as default9 } from "eslint-plugin-no-autofix";
836
+ import { default as default10 } from "eslint-plugin-perfectionist";
837
+ import { default as default11 } from "eslint-plugin-promise";
838
+ import { default as default12 } from "eslint-plugin-roblox-ts";
839
+ import * as pluginSonar from "eslint-plugin-sonarjs";
840
+ import { default as default14 } from "eslint-plugin-unicorn";
841
+ import { default as default15 } from "eslint-plugin-unused-imports";
842
+ import { default as default16 } from "prettier-plugin-jsdoc";
843
+
844
+ // src/configs/comments.ts
845
+ async function comments() {
846
+ return [
847
+ {
848
+ name: "style:eslint-comments",
849
+ plugins: {
850
+ "comment-length": default6,
851
+ "eslint-comments": default7
852
+ },
853
+ rules: {
854
+ "comment-length/limit-multi-line-comments": [
855
+ "warn",
856
+ {
857
+ ignoreUrls: true,
858
+ maxLength: 80
859
+ }
860
+ ],
861
+ "comment-length/limit-single-line-comments": [
862
+ "warn",
863
+ {
864
+ ignoreUrls: true,
865
+ maxLength: 80
866
+ }
867
+ ],
868
+ "eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }],
869
+ "eslint-comments/no-aggregating-enable": "error",
870
+ "eslint-comments/no-duplicate-disable": "error",
871
+ "eslint-comments/no-unlimited-disable": "error",
872
+ "eslint-comments/no-unused-enable": "error",
873
+ "eslint-comments/require-description": "error",
874
+ "multiline-comment-style": ["error", "separate-lines"],
875
+ "no-inline-comments": "error"
876
+ }
877
+ }
878
+ ];
879
+ }
880
+
881
+ // src/configs/formatters.ts
882
+ init_esm_shims();
883
+
884
+ // src/globs.ts
885
+ init_esm_shims();
886
+ var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
887
+ var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
888
+ var GLOB_JS = "**/*.?([cm])js";
889
+ var GLOB_JSX = "**/*.?([cm])jsx";
890
+ var GLOB_TS = "**/*.?([cm])ts";
891
+ var GLOB_TSX = "**/*.?([cm])tsx";
892
+ var GLOB_STYLE = "**/*.{c,le,sc}ss";
893
+ var GLOB_CSS = "**/*.css";
894
+ var GLOB_POSTCSS = "**/*.{p,post}css";
895
+ var GLOB_LESS = "**/*.less";
896
+ var GLOB_SCSS = "**/*.scss";
897
+ var GLOB_JSON = "**/*.json";
898
+ var GLOB_JSON5 = "**/*.json5";
899
+ var GLOB_JSONC = "**/*.jsonc";
900
+ var GLOB_MARKDOWN = "**/*.md";
901
+ var GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
902
+ var GLOB_HTML = "**/*.htm?(l)";
903
+ var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
904
+ var GLOB_ALL_SRC = [GLOB_SRC, GLOB_STYLE, GLOB_JSON, GLOB_JSON5, GLOB_MARKDOWN, GLOB_HTML];
905
+ var GLOB_EXCLUDE = [
906
+ "**/node_modules",
907
+ "**/dist",
908
+ "**/package-lock.json",
909
+ "**/yarn.lock",
910
+ "**/bun.lockb",
911
+ "**/output",
912
+ "**/coverage",
913
+ "**/temp",
914
+ "**/.temp",
915
+ "**/tmp",
916
+ "**/.tmp",
917
+ "**/.history",
918
+ "**/.vitepress/cache",
919
+ "**/.nuxt",
920
+ "**/.next",
921
+ "**/.vercel",
922
+ "**/.changeset",
923
+ "**/.idea",
924
+ "**/.cache",
925
+ "**/.output",
926
+ "**/.vite-inspect",
927
+ "**/CHANGELOG*.md",
928
+ "**/*.min.*",
929
+ "**/LICENSE*",
930
+ "**/__snapshots__",
931
+ "**/auto-import?(s).d.ts",
932
+ "**/components.d.ts"
933
+ ];
934
+
935
+ // src/configs/stylistic.ts
936
+ init_esm_shims();
937
+
938
+ // src/utils.ts
939
+ init_esm_shims();
940
+ import { isPackageExists } from "local-pkg";
941
+ import process from "process";
942
+ async function combine(...configs) {
943
+ const resolved = await Promise.all(configs);
944
+ return resolved.flat();
945
+ }
946
+ function renameRules(rules, from, to) {
947
+ return Object.fromEntries(
948
+ Object.entries(rules).map(([key, value]) => {
949
+ if (key.startsWith(from)) {
950
+ return [to + key.slice(from.length), value];
951
+ }
952
+ return [key, value];
953
+ })
954
+ );
955
+ }
956
+ function toArray(value) {
957
+ return Array.isArray(value) ? value : [value];
958
+ }
959
+ async function interopDefault(dynamicImport) {
960
+ const resolved = await dynamicImport;
961
+ return resolved.default || resolved;
962
+ }
963
+ async function ensurePackages(packages) {
964
+ if (process.env.CI ?? process.stdout.isTTY === false) {
965
+ return;
966
+ }
967
+ const nonExistingPackages = packages.filter((index) => !isPackageExists(index));
968
+ if (nonExistingPackages.length === 0) {
969
+ return;
970
+ }
971
+ const { default: prompts } = await import("prompts");
972
+ const { result } = await prompts([
973
+ {
974
+ message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(
975
+ ", "
976
+ )}. Do you want to install them?`,
977
+ name: "result",
978
+ type: "confirm"
979
+ }
980
+ ]);
981
+ if (result) {
982
+ await import("@antfu/install-pkg").then(
983
+ (import_) => import_.installPackage(nonExistingPackages, { dev: true })
984
+ );
985
+ }
986
+ }
987
+ function resolveSubOptions(options, key) {
988
+ return typeof options[key] === "boolean" ? {} : options[key] || {};
989
+ }
990
+ function getOverrides(options, key) {
991
+ const sub = resolveSubOptions(options, key);
992
+ return {
993
+ ..."overrides" in sub ? sub.overrides : {}
994
+ };
995
+ }
996
+
997
+ // src/configs/stylistic.ts
998
+ var StylisticConfigDefaults = {
999
+ indent: "tab",
1000
+ jsx: true,
1001
+ quotes: "double",
1002
+ semi: true
1003
+ };
1004
+ async function stylistic(options = {}) {
1005
+ const { indent, jsx, quotes, semi } = {
1006
+ ...StylisticConfigDefaults,
1007
+ ...options
1008
+ };
1009
+ const pluginStylistic = await interopDefault(import("@stylistic/eslint-plugin"));
1010
+ const config = pluginStylistic.configs.customize({
1011
+ flat: true,
1012
+ indent,
1013
+ jsx,
1014
+ pluginName: "style",
1015
+ quotes,
1016
+ semi
1017
+ });
1018
+ return [
1019
+ {
1020
+ name: "style:stylistic",
1021
+ plugins: {
1022
+ antfu: default4,
1023
+ "arrow-style": default5,
1024
+ style: pluginStylistic
1025
+ },
1026
+ rules: {
1027
+ ...config.rules,
1028
+ "antfu/consistent-list-newline": "error",
1029
+ "antfu/if-newline": "off",
1030
+ "antfu/top-level-function": "error",
1031
+ "arrow-style/arrow-return-style": [
1032
+ "warn",
1033
+ {
1034
+ jsxAlwaysUseExplicitReturn: true,
1035
+ maxLen: 80
1036
+ }
1037
+ ],
1038
+ "arrow-style/no-export-default-arrow": "warn",
1039
+ curly: ["error", "all"],
1040
+ "style/object-property-newline": ["error", { allowAllPropertiesOnSameLine: true }],
1041
+ "style/padding-line-between-statements": [
1042
+ "error",
1043
+ {
1044
+ blankLine: "always",
1045
+ next: "*",
1046
+ prev: ["block", "block-like", "class", "export", "import"]
1047
+ },
1048
+ {
1049
+ blankLine: "never",
1050
+ next: "*",
1051
+ prev: ["case"]
1052
+ },
1053
+ {
1054
+ blankLine: "any",
1055
+ next: ["export", "import"],
1056
+ prev: ["export", "import"]
1057
+ },
1058
+ {
1059
+ blankLine: "any",
1060
+ next: "*",
1061
+ prev: ["do"]
1062
+ }
1063
+ ]
1064
+ }
1065
+ }
1066
+ ];
1067
+ }
1068
+
1069
+ // src/configs/formatters.ts
1070
+ async function formatters(options = {}, stylistic2 = {}, markdownEnabled = true) {
1071
+ if (options === true) {
1072
+ options = {
1073
+ css: true,
1074
+ graphql: true,
1075
+ html: true,
1076
+ markdown: true,
1077
+ toml: true
1078
+ };
1079
+ }
1080
+ const { indent, quotes, semi } = {
1081
+ ...StylisticConfigDefaults,
1082
+ ...stylistic2
1083
+ };
1084
+ const prettierOptions = Object.assign(
1085
+ {
1086
+ semi,
1087
+ singleQuote: quotes === "single",
1088
+ tabWidth: typeof indent === "number" ? indent : 2,
1089
+ trailingComma: "all",
1090
+ useTabs: indent === "tab"
1091
+ },
1092
+ options.prettierOptions ?? {}
1093
+ );
1094
+ const dprintOptions = Object.assign(
1095
+ {
1096
+ indentWidth: typeof indent === "number" ? indent : 2,
1097
+ quoteStyle: quotes === "single" ? "preferSingle" : "preferDouble",
1098
+ useTabs: indent === "tab"
1099
+ },
1100
+ options.dprintOptions ?? {}
1101
+ );
1102
+ const configs = [
1103
+ {
1104
+ name: "style:formatters:setup",
1105
+ plugins: {
1106
+ format: default8
1107
+ }
1108
+ }
1109
+ ];
1110
+ if (options.css) {
1111
+ configs.push(
1112
+ {
1113
+ files: [GLOB_CSS, GLOB_POSTCSS],
1114
+ languageOptions: {
1115
+ parser: default8.parserPlain
1116
+ },
1117
+ name: "style:formatter:css",
1118
+ rules: {
1119
+ "format/prettier": [
1120
+ "error",
1121
+ {
1122
+ ...prettierOptions,
1123
+ parser: "css"
1124
+ }
1125
+ ]
1126
+ }
1127
+ },
1128
+ {
1129
+ files: [GLOB_SCSS],
1130
+ languageOptions: {
1131
+ parser: default8.parserPlain
1132
+ },
1133
+ name: "style:formatter:scss",
1134
+ rules: {
1135
+ "format/prettier": [
1136
+ "error",
1137
+ {
1138
+ ...prettierOptions,
1139
+ parser: "scss"
1140
+ }
1141
+ ]
1142
+ }
1143
+ },
1144
+ {
1145
+ files: [GLOB_LESS],
1146
+ languageOptions: {
1147
+ parser: default8.parserPlain
1148
+ },
1149
+ name: "style:formatter:less",
1150
+ rules: {
1151
+ "format/prettier": [
1152
+ "error",
1153
+ {
1154
+ ...prettierOptions,
1155
+ parser: "less"
1156
+ }
1157
+ ]
1158
+ }
1159
+ }
1160
+ );
1161
+ }
1162
+ if (options.html) {
1163
+ configs.push({
1164
+ files: ["**/*.html"],
1165
+ languageOptions: {
1166
+ parser: default8.parserPlain
1167
+ },
1168
+ name: "style:formatter:html",
1169
+ rules: {
1170
+ "format/prettier": [
1171
+ "error",
1172
+ {
1173
+ ...prettierOptions,
1174
+ parser: "html"
1175
+ }
1176
+ ]
1177
+ }
1178
+ });
1179
+ }
1180
+ if (options.toml) {
1181
+ configs.push({
1182
+ files: ["**/*.toml"],
1183
+ languageOptions: {
1184
+ parser: default8.parserPlain
1185
+ },
1186
+ name: "style:formatter:toml",
1187
+ rules: {
1188
+ "format/dprint": [
1189
+ "error",
1190
+ {
1191
+ ...dprintOptions,
1192
+ language: "toml"
1193
+ }
1194
+ ]
1195
+ }
1196
+ });
1197
+ }
1198
+ if (options.markdown) {
1199
+ const formater = options.markdown === true ? "prettier" : options.markdown;
1200
+ configs.push({
1201
+ files: markdownEnabled ? ["**/*.__markdown_content__"] : [GLOB_MARKDOWN],
1202
+ languageOptions: {
1203
+ parser: default8.parserPlain
1204
+ },
1205
+ name: "style:formatter:markdown",
1206
+ rules: {
1207
+ [`format/${formater}`]: [
1208
+ "error",
1209
+ formater === "prettier" ? {
1210
+ ...prettierOptions,
1211
+ embeddedLanguageFormatting: "off",
1212
+ parser: "markdown"
1213
+ } : {
1214
+ ...dprintOptions,
1215
+ language: "markdown"
1216
+ }
1217
+ ]
1218
+ }
1219
+ });
1220
+ }
1221
+ if (options.graphql) {
1222
+ configs.push({
1223
+ files: ["**/*.graphql"],
1224
+ languageOptions: {
1225
+ parser: default8.parserPlain
1226
+ },
1227
+ name: "style:formatter:graphql",
1228
+ rules: {
1229
+ "format/prettier": [
1230
+ "error",
1231
+ {
1232
+ ...prettierOptions,
1233
+ parser: "graphql"
1234
+ }
1235
+ ]
1236
+ }
1237
+ });
1238
+ }
1239
+ return configs;
1240
+ }
1241
+
1242
+ // src/configs/ignores.ts
1243
+ init_esm_shims();
1244
+ async function ignores() {
1245
+ return [
1246
+ {
1247
+ ignores: GLOB_EXCLUDE
1248
+ }
1249
+ ];
1250
+ }
1251
+
1252
+ // src/configs/imports.ts
1253
+ init_esm_shims();
1254
+ async function imports(options = {}) {
1255
+ const { stylistic: stylistic2 = true } = options;
1256
+ return [
1257
+ {
1258
+ name: "style:imports",
1259
+ plugins: {
1260
+ antfu: default4,
1261
+ import: pluginImport
1262
+ },
1263
+ rules: {
1264
+ "antfu/import-dedupe": "error",
1265
+ "import/first": "error",
1266
+ "import/no-duplicates": "error",
1267
+ "import/no-mutable-exports": "error",
1268
+ "import/no-named-default": "error",
1269
+ "import/no-self-import": "error",
1270
+ "import/no-webpack-loader-syntax": "off",
1271
+ "import/order": "off",
1272
+ ...stylistic2 ? {
1273
+ "import/newline-after-import": [
1274
+ "error",
1275
+ { considerComments: true, count: 1 }
1276
+ ]
1277
+ } : {}
1278
+ }
1279
+ },
1280
+ {
1281
+ languageOptions: {
1282
+ parserOptions: {
1283
+ sourceType: "script"
1284
+ }
1285
+ },
1286
+ name: "style:import-sort",
1287
+ plugins: {
1288
+ "simple-import-sort": import_eslint_plugin_simple_import_sort.default
1289
+ },
1290
+ rules: {
1291
+ "simple-import-sort/exports": "error",
1292
+ "simple-import-sort/imports": [
1293
+ "error",
1294
+ {
1295
+ groups: [["^react"], ["@?"], ["^\\w"], ["^\\."]]
1296
+ }
1297
+ ]
1298
+ }
1299
+ }
1300
+ ];
1301
+ }
1302
+
1303
+ // src/configs/jsdoc.ts
1304
+ init_esm_shims();
1305
+ async function jsdoc(options = {}) {
1306
+ const { stylistic: stylistic2 = true } = options;
1307
+ return [
1308
+ {
1309
+ name: "style:jsdoc",
1310
+ plugins: {
1311
+ jsdoc: await interopDefault(import("eslint-plugin-jsdoc")),
1312
+ "jsdoc-prettier": await interopDefault(import("prettier-plugin-jsdoc"))
1313
+ },
1314
+ rules: {
1315
+ "jsdoc/check-access": "warn",
1316
+ "jsdoc/check-param-names": "warn",
1317
+ "jsdoc/check-property-names": "warn",
1318
+ "jsdoc/check-types": "warn",
1319
+ "jsdoc/empty-tags": "warn",
1320
+ "jsdoc/implements-on-classes": "warn",
1321
+ "jsdoc/informative-docs": "warn",
1322
+ "jsdoc/no-blank-block-descriptions": "warn",
1323
+ "jsdoc/no-blank-blocks": "warn",
1324
+ "jsdoc/no-defaults": "warn",
1325
+ "jsdoc/no-multi-asterisks": "warn",
1326
+ "jsdoc/no-types": "warn",
1327
+ "jsdoc/require-asterisk-prefix": "warn",
1328
+ "jsdoc/require-description": ["warn", { exemptedBy: ["hidden, ignore"] }],
1329
+ "jsdoc/require-description-complete-sentence": "warn",
1330
+ "jsdoc/require-hyphen-before-param-description": "warn",
1331
+ "jsdoc/require-param": ["warn", { exemptedBy: ["hidden"] }],
1332
+ "jsdoc/require-param-description": "warn",
1333
+ "jsdoc/require-param-name": "warn",
1334
+ "jsdoc/require-property": "warn",
1335
+ "jsdoc/require-property-description": "warn",
1336
+ "jsdoc/require-property-name": "warn",
1337
+ "jsdoc/require-returns": ["warn", { exemptedBy: ["hidden"] }],
1338
+ "jsdoc/require-returns-check": "warn",
1339
+ "jsdoc/require-returns-description": "warn",
1340
+ "jsdoc/require-yields-check": "warn",
1341
+ "jsdoc/sort-tags": "warn",
1342
+ ...stylistic2 ? {
1343
+ "jsdoc/check-alignment": "warn",
1344
+ "jsdoc/multiline-blocks": "warn"
1345
+ } : {}
1346
+ }
1347
+ }
1348
+ ];
1349
+ }
1350
+
1351
+ // src/configs/jsonc.ts
1352
+ init_esm_shims();
1353
+ async function jsonc(options = {}) {
1354
+ const {
1355
+ files = [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
1356
+ overrides = {},
1357
+ stylistic: stylistic2 = true
1358
+ } = options;
1359
+ const { indent = "tab" } = typeof stylistic2 === "boolean" ? {} : stylistic2;
1360
+ const [pluginJsonc, parserJsonc] = await Promise.all([
1361
+ interopDefault(import("eslint-plugin-jsonc")),
1362
+ interopDefault(import("jsonc-eslint-parser"))
1363
+ ]);
1364
+ return [
1365
+ {
1366
+ name: "style:jsonc:setup",
1367
+ plugins: {
1368
+ jsonc: pluginJsonc
1369
+ }
1370
+ },
1371
+ {
1372
+ files,
1373
+ languageOptions: {
1374
+ parser: parserJsonc
1375
+ },
1376
+ name: "style:jsonc:rules",
1377
+ rules: {
1378
+ "jsonc/no-bigint-literals": "error",
1379
+ "jsonc/no-binary-expression": "error",
1380
+ "jsonc/no-binary-numeric-literals": "error",
1381
+ "jsonc/no-dupe-keys": "error",
1382
+ "jsonc/no-escape-sequence-in-identifier": "error",
1383
+ "jsonc/no-floating-decimal": "error",
1384
+ "jsonc/no-hexadecimal-numeric-literals": "error",
1385
+ "jsonc/no-infinity": "error",
1386
+ "jsonc/no-multi-str": "error",
1387
+ "jsonc/no-nan": "error",
1388
+ "jsonc/no-number-props": "error",
1389
+ "jsonc/no-numeric-separators": "error",
1390
+ "jsonc/no-octal": "error",
1391
+ "jsonc/no-octal-escape": "error",
1392
+ "jsonc/no-octal-numeric-literals": "error",
1393
+ "jsonc/no-parenthesized": "error",
1394
+ "jsonc/no-plus-sign": "error",
1395
+ "jsonc/no-regexp-literals": "error",
1396
+ "jsonc/no-sparse-arrays": "error",
1397
+ "jsonc/no-template-literals": "error",
1398
+ "jsonc/no-undefined-value": "error",
1399
+ "jsonc/no-unicode-codepoint-escapes": "error",
1400
+ "jsonc/no-useless-escape": "error",
1401
+ "jsonc/space-unary-ops": "error",
1402
+ "jsonc/valid-json-number": "error",
1403
+ ...stylistic2 ? {
1404
+ "jsonc/array-bracket-spacing": ["error", "never"],
1405
+ "jsonc/comma-dangle": ["error", "never"],
1406
+ "jsonc/comma-style": ["error", "last"],
1407
+ "jsonc/indent": ["error", indent],
1408
+ "jsonc/key-spacing": [
1409
+ "error",
1410
+ { afterColon: true, beforeColon: false }
1411
+ ],
1412
+ "jsonc/object-curly-newline": [
1413
+ "error",
1414
+ { consistent: true, multiline: true }
1415
+ ],
1416
+ "jsonc/object-curly-spacing": ["error", "always"],
1417
+ "jsonc/object-property-newline": [
1418
+ "error",
1419
+ { allowMultiplePropertiesPerLine: true }
1420
+ ],
1421
+ "jsonc/quote-props": "error",
1422
+ "jsonc/quotes": "error"
1423
+ } : {},
1424
+ ...overrides
1425
+ }
1426
+ }
1427
+ ];
1428
+ }
1429
+
1430
+ // src/configs/markdown.ts
1431
+ init_esm_shims();
1432
+ async function markdown(options = {}, formatMarkdown = false) {
1433
+ const {
1434
+ componentExts: componentExtensions = [],
1435
+ files = [GLOB_MARKDOWN],
1436
+ overrides = {}
1437
+ } = options;
1438
+ const markdownPlugin = await interopDefault(import("eslint-plugin-markdown"));
1439
+ const baseProcessor = markdownPlugin.processors.markdown;
1440
+ const processor = !formatMarkdown ? {
1441
+ meta: {
1442
+ name: "markdown-processor"
1443
+ },
1444
+ supportsAutofix: true,
1445
+ ...baseProcessor
1446
+ } : {
1447
+ meta: {
1448
+ name: "markdown-processor-with-content"
1449
+ },
1450
+ postprocess(messages, filename) {
1451
+ const markdownContent = messages.pop();
1452
+ const codeSnippets = baseProcessor.postprocess(messages, filename);
1453
+ return [...markdownContent ?? [], ...codeSnippets ?? []];
1454
+ },
1455
+ preprocess(text, filename) {
1456
+ const result = baseProcessor.preprocess(text, filename);
1457
+ return [
1458
+ ...result,
1459
+ {
1460
+ filename: ".__markdown_content__",
1461
+ text
1462
+ }
1463
+ ];
1464
+ },
1465
+ supportsAutofix: true
1466
+ };
1467
+ return [
1468
+ {
1469
+ name: "style:markdown:setup",
1470
+ plugins: {
1471
+ markdown: markdownPlugin
1472
+ }
1473
+ },
1474
+ {
1475
+ files,
1476
+ ignores: [GLOB_MARKDOWN_IN_MARKDOWN],
1477
+ name: "style:markdown:processor",
1478
+ processor
1479
+ },
1480
+ {
1481
+ files: [
1482
+ GLOB_MARKDOWN_CODE,
1483
+ ...componentExtensions.map((extension) => `${GLOB_MARKDOWN}/**/*.${extension}`)
1484
+ ],
1485
+ languageOptions: {
1486
+ parserOptions: {
1487
+ ecmaFeatures: {
1488
+ impliedStrict: true
1489
+ }
1490
+ }
1491
+ },
1492
+ name: "style:markdown:disables",
1493
+ rules: {
1494
+ "import/newline-after-import": "off",
1495
+ "no-alert": "off",
1496
+ "no-console": "off",
1497
+ "no-inline-comments": "off",
1498
+ "no-labels": "off",
1499
+ "no-lone-blocks": "off",
1500
+ "no-restricted-syntax": "off",
1501
+ "no-undef": "off",
1502
+ "no-unused-expressions": "off",
1503
+ "no-unused-labels": "off",
1504
+ "no-unused-vars": "off",
1505
+ "style/comma-dangle": "off",
1506
+ "style/eol-last": "off",
1507
+ "ts/await-thenable": "off",
1508
+ "ts/consistent-type-imports": "off",
1509
+ "ts/dot-notation": "off",
1510
+ "ts/no-floating-promises": "off",
1511
+ "ts/no-for-in-array": "off",
1512
+ "ts/no-implied-eval": "off",
1513
+ "ts/no-misused-promises": "off",
1514
+ "ts/no-namespace": "off",
1515
+ "ts/no-redeclare": "off",
1516
+ "ts/no-require-imports": "off",
1517
+ // Type aware rules
1518
+ "ts/no-throw-literal": "off",
1519
+ "ts/no-unnecessary-type-assertion": "off",
1520
+ "ts/no-unsafe-argument": "off",
1521
+ "ts/no-unsafe-assignment": "off",
1522
+ "ts/no-unsafe-call": "off",
1523
+ "ts/no-unsafe-member-access": "off",
1524
+ "ts/no-unsafe-return": "off",
1525
+ "ts/no-unused-vars": "off",
1526
+ "ts/no-use-before-define": "off",
1527
+ "ts/no-var-requires": "off",
1528
+ "ts/restrict-plus-operands": "off",
1529
+ "ts/restrict-template-expressions": "off",
1530
+ "ts/unbound-method": "off",
1531
+ "unicode-bom": "off",
1532
+ "unused-imports/no-unused-imports": "off",
1533
+ "unused-imports/no-unused-vars": "off",
1534
+ ...overrides
1535
+ }
1536
+ }
1537
+ ];
1538
+ }
1539
+
1540
+ // src/configs/perfectionist.ts
1541
+ init_esm_shims();
1542
+ async function perfectionist() {
1543
+ return [
1544
+ {
1545
+ name: "style:perfectionist",
1546
+ plugins: {
1547
+ perfectionist: default10
1548
+ },
1549
+ rules: {
1550
+ "perfectionist/sort-array-includes": ["error", { type: "natural" }],
1551
+ "perfectionist/sort-classes": ["off"],
1552
+ "perfectionist/sort-enums": ["error", { type: "natural" }],
1553
+ "perfectionist/sort-interfaces": ["error", { type: "natural" }],
1554
+ "perfectionist/sort-jsx-props": "off",
1555
+ "perfectionist/sort-maps": ["error", { type: "natural" }],
1556
+ "perfectionist/sort-object-types": ["error", { type: "natural" }],
1557
+ "perfectionist/sort-objects": ["error", { type: "natural" }]
1558
+ }
1559
+ }
1560
+ ];
1561
+ }
1562
+
1563
+ // src/configs/prettier.ts
1564
+ init_esm_shims();
1565
+ async function prettier(options = {}) {
1566
+ const { componentExts: componentExtensions = [] } = options;
1567
+ const files = options.files ?? [
1568
+ GLOB_SRC,
1569
+ ...componentExtensions.map((extension) => `**/*.${extension}`)
1570
+ ];
1571
+ const prettierOptions = {
1572
+ arrowParens: "avoid",
1573
+ jsdocPreferCodeFences: true,
1574
+ jsdocPrintWidth: 80,
1575
+ plugins: ["prettier-plugin-jsdoc"],
1576
+ printWidth: 100,
1577
+ semi: true,
1578
+ singleQuote: false,
1579
+ tabWidth: 4,
1580
+ trailingComma: "all",
1581
+ tsdoc: true,
1582
+ useTabs: true
1583
+ };
1584
+ return [
1585
+ {
1586
+ files,
1587
+ plugins: {
1588
+ format: default8
1589
+ },
1590
+ rules: {
1591
+ ...default3.rules,
1592
+ "arrow-body-style": "off",
1593
+ curly: ["error", "all"],
1594
+ "format/prettier": [
1595
+ "error",
1596
+ {
1597
+ ...prettierOptions,
1598
+ parser: "typescript"
1599
+ }
1600
+ ],
1601
+ "no-unexpected-multiline": "off",
1602
+ "prefer-arrow-callback": "off",
1603
+ "standard/array-bracket-even-spacing": "off",
1604
+ "standard/computed-property-even-spacing": "off",
1605
+ "standard/object-curly-even-spacing": "off",
1606
+ "style/array-bracket-newline": "off",
1607
+ "style/array-bracket-spacing": "off",
1608
+ "style/array-element-newline": "off",
1609
+ "style/arrow-parens": "off",
1610
+ "style/arrow-spacing": "off",
1611
+ "style/block-spacing": "off",
1612
+ "style/brace-style": "off",
1613
+ "style/comma-dangle": "off",
1614
+ "style/comma-spacing": "off",
1615
+ "style/comma-style": "off",
1616
+ "style/computed-property-spacing": "off",
1617
+ "style/dot-location": "off",
1618
+ "style/eol-last": "off",
1619
+ "style/func-call-spacing": "off",
1620
+ "style/function-call-argument-newline": "off",
1621
+ "style/function-paren-newline": "off",
1622
+ "style/generator-star-spacing": "off",
1623
+ "style/implicit-arrow-linebreak": "off",
1624
+ "style/indent": "off",
1625
+ "style/indent-binary-ops": "off",
1626
+ "style/jsx-child-element-spacing": "off",
1627
+ "style/jsx-closing-bracket-location": "off",
1628
+ "style/jsx-closing-tag-location": "off",
1629
+ "style/jsx-curly-newline": "off",
1630
+ "style/jsx-curly-spacing": "off",
1631
+ "style/jsx-equals-spacing": "off",
1632
+ "style/jsx-first-prop-new-line": "off",
1633
+ "style/jsx-indent": "off",
1634
+ "style/jsx-indent-props": "off",
1635
+ "style/jsx-max-props-per-line": "off",
1636
+ "style/jsx-newline": "off",
1637
+ "style/jsx-one-expression-per-line": "off",
1638
+ "style/jsx-props-no-multi-spaces": "off",
1639
+ "style/jsx-quotes": "off",
1640
+ "style/jsx-tag-spacing": "off",
1641
+ "style/jsx-wrap-multilines": "off",
1642
+ "style/key-spacing": "off",
1643
+ "style/keyword-spacing": "off",
1644
+ "style/linebreak-style": "off",
1645
+ "style/lines-around-comment": "off",
1646
+ "style/max-len": "off",
1647
+ "style/max-statements-per-line": "off",
1648
+ "style/member-delimiter-style": "off",
1649
+ "style/multiline-ternary": "off",
1650
+ "style/new-parens": "off",
1651
+ "style/newline-per-chained-call": "off",
1652
+ "style/no-confusing-arrow": "off",
1653
+ "style/no-extra-parens": "off",
1654
+ "style/no-extra-semi": "off",
1655
+ "style/no-floating-decimal": "off",
1656
+ "style/no-mixed-operators": "off",
1657
+ "style/no-mixed-spaces-and-tabs": "off",
1658
+ "style/no-multi-spaces": "off",
1659
+ "style/no-multiple-empty-lines": "off",
1660
+ "style/no-tabs": "off",
1661
+ "style/no-trailing-spaces": "off",
1662
+ "style/no-whitespace-before-property": "off",
1663
+ "style/nonblock-statement-body-position": "off",
1664
+ "style/object-curly-newline": "off",
1665
+ "style/object-curly-spacing": "off",
1666
+ "style/object-property-newline": "off",
1667
+ "style/one-var-declaration-per-line": "off",
1668
+ "style/operator-linebreak": "off",
1669
+ "style/padded-blocks": "off",
1670
+ "style/quote-props": "off",
1671
+ "style/quotes": "off",
1672
+ "style/rest-spread-spacing": "off",
1673
+ "style/semi": "off",
1674
+ "style/semi-spacing": "off",
1675
+ "style/semi-style": "off",
1676
+ "style/space-before-blocks": "off",
1677
+ "style/space-before-function-paren": "off",
1678
+ "style/space-in-parens": "off",
1679
+ "style/space-infix-ops": "off",
1680
+ "style/space-unary-ops": "off",
1681
+ "style/switch-colon-spacing": "off",
1682
+ "style/template-curly-spacing": "off",
1683
+ "style/template-tag-spacing": "off",
1684
+ "style/type-annotation-spacing": "off",
1685
+ "style/wrap-iife": "off",
1686
+ "style/wrap-regex": "off",
1687
+ "style/yield-star-spacing": "off",
1688
+ "unicorn/empty-brace-spaces": "off",
1689
+ "unicorn/number-literal-case": "off",
1690
+ "unicorn/template-indent": "off"
1691
+ }
1692
+ }
1693
+ ];
1694
+ }
1695
+
1696
+ // src/configs/promise.ts
1697
+ init_esm_shims();
1698
+ async function promise() {
1699
+ return [
1700
+ {
1701
+ name: "style:promise",
1702
+ plugins: {
1703
+ promise: default11
1704
+ },
1705
+ rules: {
1706
+ "promise/always-return": [
1707
+ "error",
1708
+ {
1709
+ ignoreLastCallback: true
1710
+ }
1711
+ ],
1712
+ "promise/avoid-new": "off",
1713
+ "promise/catch-or-return": [
1714
+ "error",
1715
+ {
1716
+ allowFinally: true,
1717
+ allowThen: true
1718
+ }
1719
+ ],
1720
+ "promise/no-callback-in-promise": "off",
1721
+ "promise/no-multiple-resolved": "warn",
1722
+ "promise/no-native": "off",
1723
+ "promise/no-nesting": "warn",
1724
+ "promise/no-new-statics": "off",
1725
+ "promise/no-promise-in-callback": "warn",
1726
+ "promise/no-return-in-finally": "warn",
1727
+ "promise/no-return-wrap": "error",
1728
+ "promise/param-names": "warn",
1729
+ "promise/prefer-await-to-callbacks": "off",
1730
+ "promise/prefer-await-to-then": "off"
1731
+ }
1732
+ }
1733
+ ];
1734
+ }
1735
+
1736
+ // src/configs/react.ts
1737
+ init_esm_shims();
1738
+ async function react(options = {}) {
1739
+ const { files = [GLOB_JSX, GLOB_TSX], overrides = {}, typescript: typescript2 = true } = options;
1740
+ await ensurePackages(["eslint-plugin-react", "eslint-plugin-react-hooks"]);
1741
+ const [pluginReact, pluginReactHooks, pluginStylistic, pluginPreferHooks] = await Promise.all([
1742
+ interopDefault(import("eslint-plugin-react")),
1743
+ interopDefault(import("eslint-plugin-react-hooks")),
1744
+ interopDefault(import("@stylistic/eslint-plugin")),
1745
+ interopDefault(import("eslint-plugin-react-prefer-function-component"))
1746
+ ]);
1747
+ return [
1748
+ {
1749
+ name: "style:react:setup",
1750
+ plugins: {
1751
+ "prefer-hooks": pluginPreferHooks,
1752
+ react: pluginReact,
1753
+ "react-hooks": pluginReactHooks,
1754
+ style: pluginStylistic
1755
+ },
1756
+ settings: {
1757
+ react: {
1758
+ version: "detect"
1759
+ }
1760
+ }
1761
+ },
1762
+ {
1763
+ files,
1764
+ languageOptions: {
1765
+ parserOptions: {
1766
+ ecmaFeatures: {
1767
+ jsx: true
1768
+ }
1769
+ }
1770
+ },
1771
+ name: "style:react:rules",
1772
+ rules: {
1773
+ "prefer-hooks/react-prefer-function-component": "error",
1774
+ "react/destructuring-assignment": [
1775
+ "error",
1776
+ "always",
1777
+ {
1778
+ destructureInSignature: "always"
1779
+ }
1780
+ ],
1781
+ "react/display-name": "off",
1782
+ "react/function-component-definition": "error",
1783
+ "react/hook-use-state": "error",
1784
+ "react/jsx-fragments": "error",
1785
+ "react/jsx-handler-names": "error",
1786
+ "react/jsx-key": "error",
1787
+ "react/jsx-max-depth": [
1788
+ "error",
1789
+ {
1790
+ max: 5
1791
+ }
1792
+ ],
1793
+ "react/jsx-no-bind": "error",
1794
+ "react/jsx-no-comment-textnodes": "error",
1795
+ "react/jsx-no-duplicate-props": "error",
1796
+ "react/jsx-no-leaked-render": "error",
1797
+ "react/jsx-no-target-blank": "error",
1798
+ "react/jsx-no-undef": "error",
1799
+ "react/jsx-uses-react": "error",
1800
+ "react/jsx-uses-vars": "error",
1801
+ "react/no-children-prop": "error",
1802
+ "react/no-danger-with-children": "off",
1803
+ "react/no-deprecated": "error",
1804
+ "react/no-direct-mutation-state": "error",
1805
+ "react/no-find-dom-node": "off",
1806
+ "react/no-is-mounted": "error",
1807
+ "react/no-render-return-value": "error",
1808
+ "react/no-string-refs": "error",
1809
+ "react/no-unescaped-entities": "off",
1810
+ "react/no-unknown-property": "off",
1811
+ "react/no-unsafe": "off",
1812
+ "react/no-unstable-nested-components": [
1813
+ "error",
1814
+ {
1815
+ allowAsProps: true
1816
+ }
1817
+ ],
1818
+ "react/no-unused-prop-types": "error",
1819
+ "react/prefer-read-only-props": "error",
1820
+ "react/prop-types": "error",
1821
+ "react/react-in-jsx-scope": "off",
1822
+ "react/require-render-return": "error",
1823
+ "react/self-closing-comp": [
1824
+ "error",
1825
+ {
1826
+ component: true
1827
+ }
1828
+ ],
1829
+ "react-hooks/exhaustive-deps": "warn",
1830
+ "react-hooks/rules-of-hooks": "error",
1831
+ "style/jsx-curly-brace-presence": [
1832
+ "error",
1833
+ {
1834
+ children: "never",
1835
+ propElementValues: "always",
1836
+ props: "never"
1837
+ }
1838
+ ],
1839
+ "style/jsx-newline": "error",
1840
+ "style/jsx-sort-props": [
1841
+ "error",
1842
+ {
1843
+ callbacksLast: true,
1844
+ ignoreCase: true,
1845
+ reservedFirst: true,
1846
+ shorthandFirst: true
1847
+ }
1848
+ ],
1849
+ ...typescript2 ? {
1850
+ "react/jsx-no-undef": "off",
1851
+ "react/prop-type": "off"
1852
+ } : {},
1853
+ // overrides
1854
+ ...overrides
1855
+ },
1856
+ settings: {
1857
+ react: {
1858
+ version: "17.0"
1859
+ }
1860
+ }
1861
+ },
1862
+ {
1863
+ files: ["**/*.story.tsx"],
1864
+ rules: {
1865
+ "react-hooks/rules-of-hooks": "off"
1866
+ }
1867
+ }
1868
+ ];
1869
+ }
1870
+
1871
+ // src/configs/roblox.ts
1872
+ init_esm_shims();
1873
+ import process2 from "process";
1874
+ async function roblox(options = {}) {
1875
+ const { componentExts: componentExtensions = [], parserOptions = {} } = options;
1876
+ const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
1877
+ const [parserTs] = await Promise.all([
1878
+ interopDefault(import("@typescript-eslint/parser"))
1879
+ ]);
1880
+ const files = options.files ?? [
1881
+ GLOB_SRC,
1882
+ ...componentExtensions.map((extension) => `**/*.${extension}`)
1883
+ ];
1884
+ return [
1885
+ {
1886
+ files,
1887
+ languageOptions: {
1888
+ parser: parserTs,
1889
+ parserOptions: {
1890
+ ecmaVersion: 2018,
1891
+ sourceType: "script",
1892
+ ...tsconfigPath ? {
1893
+ project: tsconfigPath,
1894
+ tsconfigRootDir: process2.cwd()
1895
+ } : {},
1896
+ ...parserOptions
1897
+ }
1898
+ },
1899
+ name: "style:roblox",
1900
+ plugins: {
1901
+ roblox: default12
1902
+ },
1903
+ rules: {
1904
+ "roblox/lua-truthiness": "warn",
1905
+ "roblox/misleading-luatuple-checks": "warn",
1906
+ "roblox/no-any": "off",
1907
+ "roblox/no-array-pairs": "warn",
1908
+ "roblox/no-enum-merging": "error",
1909
+ "roblox/no-export-assignment-let": "error",
1910
+ "roblox/no-for-in": "error",
1911
+ "roblox/no-function-expression-id": "error",
1912
+ "roblox/no-getters-or-setters": "error",
1913
+ "roblox/no-global-this": "error",
1914
+ "roblox/no-namespace-merging": "error",
1915
+ "roblox/no-null": "error",
1916
+ "roblox/no-object-math": "error",
1917
+ "roblox/no-preceding-spread-element": "error",
1918
+ "roblox/no-private-identifier": "error",
1919
+ "roblox/no-prototype": "error",
1920
+ "roblox/no-rbx-postfix-new": "error",
1921
+ "roblox/no-regex": "error",
1922
+ "roblox/no-spread-destructuring": "error",
1923
+ "roblox/no-value-typeof": "error",
1924
+ "ts/no-explicit-any": "error"
1925
+ }
1926
+ }
1927
+ ];
1928
+ }
1929
+
1930
+ // src/configs/shopify.ts
1931
+ init_esm_shims();
1932
+ async function shopify() {
1933
+ return [
1934
+ {
1935
+ name: "style:shopify",
1936
+ plugins: {
1937
+ shopify: default2
1938
+ },
1939
+ rules: {
1940
+ "shopify/prefer-class-properties": "error",
1941
+ "shopify/prefer-early-return": ["error", { maximumStatements: 1 }],
1942
+ "shopify/typescript/prefer-pascal-case-enums": "error",
1943
+ "shopify/typescript/prefer-singular-enums": "error"
1944
+ }
1945
+ }
1946
+ ];
1947
+ }
1948
+
1949
+ // src/configs/sonarjs.ts
1950
+ init_esm_shims();
1951
+ async function sonarjs() {
1952
+ return [
1953
+ {
1954
+ name: "style:sonarjs",
1955
+ plugins: {
1956
+ sonar: pluginSonar
1957
+ },
1958
+ rules: {
1959
+ "sonar/cognitive-complexity": "warn",
1960
+ "sonar/elseif-without-else": "off",
1961
+ "sonar/max-switch-cases": "error",
1962
+ "sonar/no-all-duplicated-branches": "error",
1963
+ "sonar/no-collapsible-if": "error",
1964
+ "sonar/no-duplicate-string": [
1965
+ "error",
1966
+ {
1967
+ ignoreStrings: "Not implemented"
1968
+ }
1969
+ ],
1970
+ "sonar/no-duplicated-branches": "error",
1971
+ "sonar/no-element-overwrite": "error",
1972
+ "sonar/no-empty-collection": "error",
1973
+ "sonar/no-gratuitous-expressions": "off",
1974
+ "sonar/no-identical-conditions": "error",
1975
+ "sonar/no-identical-expressions": "error",
1976
+ "sonar/no-identical-functions": "error",
1977
+ "sonar/no-ignored-return": "error",
1978
+ "sonar/no-inverted-boolean-check": "error",
1979
+ "sonar/no-nested-switch": "error",
1980
+ "sonar/no-nested-template-literals": "error",
1981
+ "sonar/no-one-iteration-loop": "error",
1982
+ "sonar/no-redundant-boolean": "error",
1983
+ "sonar/no-redundant-jump": "error",
1984
+ "sonar/no-unused-collection": "error",
1985
+ "sonar/no-use-of-empty-return-value": "error",
1986
+ "sonar/no-useless-catch": "error",
1987
+ "sonar/non-existent-operator": "error",
1988
+ "sonar/prefer-immediate-return": "error",
1989
+ "sonar/prefer-object-literal": "error",
1990
+ "sonar/prefer-single-boolean-return": "error",
1991
+ "sonar/prefer-while": "error"
1992
+ }
1993
+ }
1994
+ ];
1995
+ }
1996
+
1997
+ // src/configs/sort.ts
1998
+ init_esm_shims();
1999
+ async function sortPackageJson() {
2000
+ return [
2001
+ {
2002
+ files: ["**/package.json"],
2003
+ name: "style:sort-package-json",
2004
+ rules: {
2005
+ "jsonc/sort-array-values": [
2006
+ "error",
2007
+ {
2008
+ order: { type: "asc" },
2009
+ pathPattern: "^files$"
2010
+ }
2011
+ ],
2012
+ "jsonc/sort-keys": [
2013
+ "error",
2014
+ {
2015
+ order: [
2016
+ "publisher",
2017
+ "name",
2018
+ "displayName",
2019
+ "type",
2020
+ "version",
2021
+ "private",
2022
+ "packageManager",
2023
+ "description",
2024
+ "author",
2025
+ "license",
2026
+ "funding",
2027
+ "homepage",
2028
+ "repository",
2029
+ "bugs",
2030
+ "keywords",
2031
+ "categories",
2032
+ "sideEffects",
2033
+ "exports",
2034
+ "main",
2035
+ "module",
2036
+ "unpkg",
2037
+ "jsdelivr",
2038
+ "types",
2039
+ "typesVersions",
2040
+ "bin",
2041
+ "icon",
2042
+ "files",
2043
+ "engines",
2044
+ "activationEvents",
2045
+ "contributes",
2046
+ "scripts",
2047
+ "peerDependencies",
2048
+ "peerDependenciesMeta",
2049
+ "dependencies",
2050
+ "optionalDependencies",
2051
+ "devDependencies",
2052
+ "pnpm",
2053
+ "overrides",
2054
+ "resolutions",
2055
+ "husky",
2056
+ "simple-git-hooks",
2057
+ "lint-staged",
2058
+ "eslintConfig",
2059
+ "prettier"
2060
+ ],
2061
+ pathPattern: "^$"
2062
+ },
2063
+ {
2064
+ order: { type: "asc" },
2065
+ pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies$"
2066
+ },
2067
+ {
2068
+ order: { type: "asc" },
2069
+ pathPattern: "^resolutions$"
2070
+ },
2071
+ {
2072
+ order: { type: "asc" },
2073
+ pathPattern: "^pnpm.overrides$"
2074
+ },
2075
+ {
2076
+ order: ["types", "import", "require", "default"],
2077
+ pathPattern: "^exports.*$"
2078
+ }
2079
+ ]
2080
+ }
2081
+ }
2082
+ ];
2083
+ }
2084
+ function sortTsconfig() {
2085
+ return [
2086
+ {
2087
+ files: ["**/tsconfig.json", "**/tsconfig.*.json"],
2088
+ name: "style:sort-tsconfig",
2089
+ rules: {
2090
+ "jsonc/sort-keys": [
2091
+ "error",
2092
+ {
2093
+ order: [
2094
+ "extends",
2095
+ "compilerOptions",
2096
+ "references",
2097
+ "files",
2098
+ "include",
2099
+ "exclude"
2100
+ ],
2101
+ pathPattern: "^$"
2102
+ },
2103
+ {
2104
+ order: [
2105
+ /* Projects */
2106
+ "incremental",
2107
+ "composite",
2108
+ "tsBuildInfoFile",
2109
+ "disableSourceOfProjectReferenceRedirect",
2110
+ "disableSolutionSearching",
2111
+ "disableReferencedProjectLoad",
2112
+ /* Language and Environment */
2113
+ "target",
2114
+ "jsx",
2115
+ "jsxFactory",
2116
+ "jsxFragmentFactory",
2117
+ "jsxImportSource",
2118
+ "lib",
2119
+ "moduleDetection",
2120
+ "noLib",
2121
+ "reactNamespace",
2122
+ "useDefineForClassFields",
2123
+ "emitDecoratorMetadata",
2124
+ "experimentalDecorators",
2125
+ /* Modules */
2126
+ "baseUrl",
2127
+ "rootDir",
2128
+ "rootDirs",
2129
+ "customConditions",
2130
+ "module",
2131
+ "moduleResolution",
2132
+ "moduleSuffixes",
2133
+ "noResolve",
2134
+ "paths",
2135
+ "resolveJsonModule",
2136
+ "resolvePackageJsonExports",
2137
+ "resolvePackageJsonImports",
2138
+ "typeRoots",
2139
+ "types",
2140
+ "allowArbitraryExtensions",
2141
+ "allowImportingTsExtensions",
2142
+ "allowUmdGlobalAccess",
2143
+ /* JavaScript Support */
2144
+ "allowJs",
2145
+ "checkJs",
2146
+ "maxNodeModuleJsDepth",
2147
+ /* Type Checking */
2148
+ "strict",
2149
+ "strictBindCallApply",
2150
+ "strictFunctionTypes",
2151
+ "strictNullChecks",
2152
+ "strictPropertyInitialization",
2153
+ "allowUnreachableCode",
2154
+ "allowUnusedLabels",
2155
+ "alwaysStrict",
2156
+ "exactOptionalPropertyTypes",
2157
+ "noFallthroughCasesInSwitch",
2158
+ "noImplicitAny",
2159
+ "noImplicitOverride",
2160
+ "noImplicitReturns",
2161
+ "noImplicitThis",
2162
+ "noPropertyAccessFromIndexSignature",
2163
+ "noUncheckedIndexedAccess",
2164
+ "noUnusedLocals",
2165
+ "noUnusedParameters",
2166
+ "useUnknownInCatchVariables",
2167
+ /* Emit */
2168
+ "declaration",
2169
+ "declarationDir",
2170
+ "declarationMap",
2171
+ "downlevelIteration",
2172
+ "emitBOM",
2173
+ "emitDeclarationOnly",
2174
+ "importHelpers",
2175
+ "importsNotUsedAsValues",
2176
+ "inlineSourceMap",
2177
+ "inlineSources",
2178
+ "mapRoot",
2179
+ "newLine",
2180
+ "noEmit",
2181
+ "noEmitHelpers",
2182
+ "noEmitOnError",
2183
+ "outDir",
2184
+ "outFile",
2185
+ "preserveConstEnums",
2186
+ "preserveValueImports",
2187
+ "removeComments",
2188
+ "sourceMap",
2189
+ "sourceRoot",
2190
+ "stripInternal",
2191
+ /* Interop Constraints */
2192
+ "allowSyntheticDefaultImports",
2193
+ "esModuleInterop",
2194
+ "forceConsistentCasingInFileNames",
2195
+ "isolatedModules",
2196
+ "preserveSymlinks",
2197
+ "verbatimModuleSyntax",
2198
+ /* Completeness */
2199
+ "skipDefaultLibCheck",
2200
+ "skipLibCheck"
2201
+ ],
2202
+ pathPattern: "^compilerOptions$"
2203
+ }
2204
+ ]
2205
+ }
2206
+ }
2207
+ ];
2208
+ }
2209
+
2210
+ // src/configs/typescript.ts
2211
+ init_esm_shims();
2212
+ import process3 from "process";
2213
+ async function typescript(options = {}) {
2214
+ const { componentExts: componentExtensions = [], overrides = {}, parserOptions = {} } = options;
2215
+ const files = options.files ?? [
2216
+ GLOB_SRC,
2217
+ ...componentExtensions.map((extension) => `**/*.${extension}`)
2218
+ ];
2219
+ const typeAwareRules = {
2220
+ "dot-notation": "off",
2221
+ "no-implied-eval": "off",
2222
+ "no-throw-literal": "off",
2223
+ "no-unsafe-optional-chaining": "error",
2224
+ "ts/await-thenable": "error",
2225
+ "ts/consistent-type-assertions": [
2226
+ "error",
2227
+ { assertionStyle: "as", objectLiteralTypeAssertions: "allow" }
2228
+ ],
2229
+ "ts/dot-notation": ["error", { allowKeywords: true }],
2230
+ "ts/naming-convention": [
2231
+ "error",
2232
+ {
2233
+ custom: {
2234
+ match: false,
2235
+ regex: "^I[A-Z]"
2236
+ },
2237
+ format: ["PascalCase"],
2238
+ selector: "interface"
2239
+ }
2240
+ ],
2241
+ "ts/no-confusing-void-expression": "error",
2242
+ "ts/no-duplicate-type-constituents": "error",
2243
+ "ts/no-floating-promises": [
2244
+ "error",
2245
+ {
2246
+ ignoreVoid: true
2247
+ }
2248
+ ],
2249
+ "ts/no-for-in-array": "error",
2250
+ "ts/no-implied-eval": "error",
2251
+ "ts/no-meaningless-void-operator": "error",
2252
+ "ts/no-misused-promises": "error",
2253
+ "ts/no-mixed-enums": "error",
2254
+ "ts/no-redundant-type-constituents": "error",
2255
+ "ts/no-throw-literal": "off",
2256
+ "ts/no-unnecessary-boolean-literal-compare": "error",
2257
+ "ts/no-unnecessary-condition": ["error", { allowConstantLoopConditions: true }],
2258
+ "ts/no-unnecessary-qualifier": "error",
2259
+ "ts/no-unnecessary-type-arguments": "error",
2260
+ "ts/no-unnecessary-type-assertion": "error",
2261
+ "ts/no-unsafe-argument": "error",
2262
+ "ts/no-unsafe-assignment": "error",
2263
+ "ts/no-unsafe-call": "error",
2264
+ "ts/no-unsafe-member-access": "error",
2265
+ "ts/no-unsafe-return": "error",
2266
+ "ts/no-useless-template-literals": "error",
2267
+ "ts/non-nullable-type-assertion-style": "error",
2268
+ "ts/prefer-destructuring": "error",
2269
+ "ts/prefer-includes": "error",
2270
+ "ts/prefer-nullish-coalescing": "error",
2271
+ "ts/prefer-optional-chain": "error",
2272
+ "ts/prefer-readonly": "error",
2273
+ "ts/prefer-reduce-type-parameter": "error",
2274
+ "ts/prefer-return-this-type": "error",
2275
+ "ts/promise-function-async": "error",
2276
+ "ts/restrict-plus-operands": "error",
2277
+ "ts/restrict-template-expressions": "off",
2278
+ "ts/return-await": "error",
2279
+ "ts/strict-boolean-expressions": "error",
2280
+ "ts/switch-exhaustiveness-check": "error",
2281
+ "ts/unbound-method": "error"
2282
+ };
2283
+ const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
2284
+ const [pluginTs, parserTs] = await Promise.all([
2285
+ interopDefault(import("@typescript-eslint/eslint-plugin")),
2286
+ interopDefault(import("@typescript-eslint/parser"))
2287
+ ]);
2288
+ return [
2289
+ {
2290
+ // Install the plugins without globs, so they can be configured
2291
+ // separately.
2292
+ name: "style:typescript:setup",
2293
+ plugins: {
2294
+ antfu: default4,
2295
+ "no-autofix": default9,
2296
+ ts: pluginTs
2297
+ }
2298
+ },
2299
+ {
2300
+ files,
2301
+ languageOptions: {
2302
+ parser: parserTs,
2303
+ parserOptions: {
2304
+ extraFileExtensions: componentExtensions.map((extension) => `.${extension}`),
2305
+ sourceType: "module",
2306
+ ...tsconfigPath ? {
2307
+ project: tsconfigPath,
2308
+ tsconfigRootDir: process3.cwd()
2309
+ } : {},
2310
+ ...parserOptions
2311
+ }
2312
+ },
2313
+ name: "style:typescript:rules",
2314
+ rules: {
2315
+ ...renameRules(
2316
+ pluginTs.configs["eslint-recommended"].overrides?.[0].rules ?? {},
2317
+ "@typescript-eslint/",
2318
+ "ts/"
2319
+ ),
2320
+ ...renameRules(pluginTs.configs.strict.rules ?? {}, "@typescript-eslint/", "ts/"),
2321
+ "array-callback-return": [
2322
+ "error",
2323
+ {
2324
+ allowImplicit: true
2325
+ }
2326
+ ],
2327
+ "id-length": [
2328
+ "error",
2329
+ {
2330
+ exceptions: ["_", "x", "y", "z", "a", "b"],
2331
+ max: 30,
2332
+ min: 2,
2333
+ properties: "never"
2334
+ }
2335
+ ],
2336
+ "logical-assignment-operators": "error",
2337
+ "no-autofix/no-useless-return": "error",
2338
+ "no-autofix/prefer-const": [
2339
+ "error",
2340
+ {
2341
+ destructuring: "all",
2342
+ ignoreReadBeforeAssign: true
2343
+ }
2344
+ ],
2345
+ "no-constant-condition": [
2346
+ "error",
2347
+ {
2348
+ checkLoops: false
2349
+ }
2350
+ ],
2351
+ "no-dupe-class-members": "off",
2352
+ "no-else-return": "error",
2353
+ "no-empty-function": "off",
2354
+ "no-lonely-if": "error",
2355
+ "no-loss-of-precision": "off",
2356
+ "no-redeclare": "off",
2357
+ "no-return-assign": ["error", "always"],
2358
+ "no-shadow": "off",
2359
+ "no-unused-private-class-members": "error",
2360
+ "no-use-before-define": "off",
2361
+ "no-useless-constructor": "off",
2362
+ "no-useless-return": "off",
2363
+ "prefer-const": "off",
2364
+ "ts/adjacent-overload-signatures": "error",
2365
+ "ts/array-type": [
2366
+ "error",
2367
+ {
2368
+ default: "generic",
2369
+ readonly: "generic"
2370
+ }
2371
+ ],
2372
+ "ts/ban-ts-comment": ["error", { "ts-ignore": "allow-with-description" }],
2373
+ "ts/ban-types": ["error", { types: { Function: false } }],
2374
+ "ts/consistent-generic-constructors": ["error", "constructor"],
2375
+ "ts/consistent-indexed-object-style": ["error", "record"],
2376
+ "ts/consistent-type-definitions": ["error", "interface"],
2377
+ "ts/consistent-type-imports": [
2378
+ "error",
2379
+ { disallowTypeAnnotations: false, prefer: "type-imports" }
2380
+ ],
2381
+ "ts/default-param-last": "error",
2382
+ "ts/explicit-function-return-type": [
2383
+ "error",
2384
+ {
2385
+ allowExpressions: true
2386
+ }
2387
+ ],
2388
+ "ts/explicit-member-accessibility": [
2389
+ "error",
2390
+ {
2391
+ overrides: {
2392
+ constructors: "no-public"
2393
+ }
2394
+ }
2395
+ ],
2396
+ "ts/max-params": ["error", { max: 4 }],
2397
+ "ts/method-signature-style": "off",
2398
+ "ts/no-array-constructor": "off",
2399
+ "ts/no-confusing-non-null-assertion": "error",
2400
+ "ts/no-dupe-class-members": "error",
2401
+ "ts/no-dynamic-delete": "off",
2402
+ "ts/no-empty-function": "error",
2403
+ "ts/no-empty-interface": "error",
2404
+ "ts/no-explicit-any": "off",
2405
+ "ts/no-extraneous-class": "error",
2406
+ "ts/no-for-in-array": "off",
2407
+ "ts/no-import-type-side-effects": "error",
2408
+ "ts/no-inferrable-types": "error",
2409
+ "ts/no-invalid-void-type": "off",
2410
+ "ts/no-loss-of-precision": "error",
2411
+ "ts/no-namespace": "off",
2412
+ "ts/no-non-null-assertion": "error",
2413
+ "ts/no-redeclare": "off",
2414
+ "ts/no-require-imports": "error",
2415
+ "ts/no-shadow": "error",
2416
+ "ts/no-throw-literal": "off",
2417
+ "ts/no-unused-vars": [
2418
+ "error",
2419
+ {
2420
+ argsIgnorePattern: "^_",
2421
+ caughtErrorsIgnorePattern: "^_",
2422
+ varsIgnorePattern: "^(Roact$|_)"
2423
+ }
2424
+ ],
2425
+ "ts/no-use-before-define": "off",
2426
+ "ts/no-useless-constructor": "error",
2427
+ "ts/prefer-for-of": "error",
2428
+ "ts/prefer-function-type": "error",
2429
+ "ts/prefer-ts-expect-error": "error",
2430
+ "ts/triple-slash-reference": "off",
2431
+ "ts/unified-signatures": "off",
2432
+ yoda: ["error", "never"],
2433
+ ...tsconfigPath ? typeAwareRules : {},
2434
+ ...overrides
2435
+ }
2436
+ },
2437
+ {
2438
+ files: ["**/*.d.ts"],
2439
+ name: "style:typescript:dts-overrides",
2440
+ rules: {
2441
+ "eslint-comments/no-unlimited-disable": "off",
2442
+ "import/no-duplicates": "off",
2443
+ "no-restricted-syntax": "off",
2444
+ "unused-imports/no-unused-vars": "off"
2445
+ }
2446
+ }
2447
+ ];
2448
+ }
2449
+
2450
+ // src/configs/unicorn.ts
2451
+ init_esm_shims();
2452
+ async function unicorn() {
2453
+ return [
2454
+ {
2455
+ name: "style:unicorn",
2456
+ plugins: {
2457
+ unicorn: default14
2458
+ },
2459
+ rules: {
2460
+ // The auto-fix here does not support roblox-ts well, but the rules are
2461
+ // still useful
2462
+ "unicorn/catch-error-name": [
2463
+ "error",
2464
+ {
2465
+ name: "err"
2466
+ }
2467
+ ],
2468
+ "unicorn/consistent-destructuring": "error",
2469
+ "unicorn/consistent-function-scoping": ["error", { checkArrowFunctions: false }],
2470
+ "unicorn/filename-case": [
2471
+ "error",
2472
+ {
2473
+ case: "kebabCase",
2474
+ ignore: ["README.md"]
2475
+ }
2476
+ ],
2477
+ "unicorn/no-array-for-each": "error",
2478
+ "unicorn/no-array-push-push": "error",
2479
+ "unicorn/no-await-expression-member": "error",
2480
+ "unicorn/no-for-loop": "error",
2481
+ "unicorn/no-keyword-prefix": "error",
2482
+ "unicorn/no-lonely-if": "error",
2483
+ "unicorn/no-negated-condition": "off",
2484
+ "unicorn/no-nested-ternary": "error",
2485
+ "unicorn/no-object-as-default-parameter": "error",
2486
+ "unicorn/no-static-only-class": "error",
2487
+ "unicorn/no-unreadable-array-destructuring": "error",
2488
+ "unicorn/no-unused-properties": "error",
2489
+ "unicorn/no-useless-promise-resolve-reject": "error",
2490
+ "unicorn/no-useless-spread": "error",
2491
+ "unicorn/no-useless-undefined": ["error", { checkArguments: false }],
2492
+ "unicorn/number-literal-case": "error",
2493
+ "unicorn/prefer-default-parameters": "error",
2494
+ "unicorn/prefer-export-from": "error",
2495
+ "unicorn/prefer-includes": "error",
2496
+ "unicorn/prefer-logical-operator-over-ternary": "error",
2497
+ "unicorn/prefer-optional-catch-binding": "error",
2498
+ "unicorn/prefer-set-has": "error",
2499
+ "unicorn/prefer-switch": "error",
2500
+ "unicorn/prefer-ternary": ["error", "only-single-line"],
2501
+ "unicorn/prevent-abbreviations": [
2502
+ "error",
2503
+ {
2504
+ replacements: {
2505
+ args: false,
2506
+ dist: {
2507
+ distance: true
2508
+ },
2509
+ e: {
2510
+ err: true,
2511
+ error: false
2512
+ },
2513
+ err: false,
2514
+ fn: {
2515
+ func: true,
2516
+ function: false
2517
+ },
2518
+ func: false,
2519
+ inst: {
2520
+ instance: true
2521
+ },
2522
+ nums: {
2523
+ numbers: true
2524
+ },
2525
+ pos: {
2526
+ position: true
2527
+ },
2528
+ props: false,
2529
+ ref: false,
2530
+ refs: false,
2531
+ str: false
2532
+ }
2533
+ }
2534
+ ],
2535
+ "unicorn/switch-case-braces": "error"
2536
+ }
2537
+ }
2538
+ ];
2539
+ }
2540
+
2541
+ // src/factory.ts
2542
+ init_esm_shims();
2543
+ import fs from "fs";
2544
+ var flatConfigProps = [
2545
+ "files",
2546
+ "ignores",
2547
+ "languageOptions",
2548
+ "linterOptions",
2549
+ "processor",
2550
+ "plugins",
2551
+ "rules",
2552
+ "settings"
2553
+ ];
2554
+ async function style(options = {}, ...userConfigs) {
2555
+ const {
2556
+ componentExts: componentExtensions = [],
2557
+ gitignore: enableGitignore = true,
2558
+ jsx,
2559
+ react: enableReact = false,
2560
+ roblox: enableRoblox = true,
2561
+ typescript: enableTypeScript
2562
+ } = options;
2563
+ const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
2564
+ if (stylisticOptions && !("jsx" in stylisticOptions)) {
2565
+ stylisticOptions.jsx = jsx ?? true;
2566
+ }
2567
+ const configs = [];
2568
+ if (enableGitignore) {
2569
+ if (typeof enableGitignore !== "boolean") {
2570
+ configs.push(
2571
+ interopDefault(import("eslint-config-flat-gitignore")).then((resolved) => {
2572
+ return [resolved(enableGitignore)];
2573
+ })
2574
+ );
2575
+ } else if (fs.existsSync(".gitignore")) {
2576
+ configs.push(
2577
+ interopDefault(import("eslint-config-flat-gitignore")).then((resolved) => {
2578
+ return [resolved()];
2579
+ })
2580
+ );
2581
+ } else {
2582
+ throw new Error(
2583
+ "gitignore option is enabled but no .gitignore file was found in the current directory"
2584
+ );
2585
+ }
2586
+ }
2587
+ configs.push(
2588
+ ignores(),
2589
+ comments(),
2590
+ jsdoc({
2591
+ stylistic: stylisticOptions
2592
+ }),
2593
+ imports({
2594
+ stylistic: stylisticOptions
2595
+ }),
2596
+ promise(),
2597
+ shopify(),
2598
+ sonarjs(),
2599
+ unicorn(),
2600
+ perfectionist(),
2601
+ typescript({
2602
+ ...resolveSubOptions(options, "typescript"),
2603
+ componentExts: componentExtensions
2604
+ })
2605
+ );
2606
+ if (enableRoblox) {
2607
+ configs.push(
2608
+ roblox({
2609
+ ...resolveSubOptions(options, "typescript"),
2610
+ componentExts: componentExtensions
2611
+ })
2612
+ );
2613
+ }
2614
+ if (stylisticOptions) {
2615
+ configs.push(stylistic(stylisticOptions));
2616
+ }
2617
+ if (enableReact) {
2618
+ configs.push(
2619
+ react({
2620
+ overrides: getOverrides(options, "react"),
2621
+ typescript: !!enableTypeScript
2622
+ })
2623
+ );
2624
+ }
2625
+ if (options.jsonc ?? true) {
2626
+ configs.push(
2627
+ jsonc({
2628
+ overrides: getOverrides(options, "jsonc"),
2629
+ stylistic: stylisticOptions
2630
+ }),
2631
+ sortPackageJson(),
2632
+ sortTsconfig()
2633
+ );
2634
+ }
2635
+ if (options.markdown ?? true) {
2636
+ configs.push(
2637
+ markdown(
2638
+ {
2639
+ componentExts: componentExtensions,
2640
+ overrides: getOverrides(options, "markdown")
2641
+ },
2642
+ options.formatters === true || !!(options.formatters || {})?.markdown
2643
+ )
2644
+ );
2645
+ }
2646
+ if (options.formatters) {
2647
+ configs.push(
2648
+ formatters(
2649
+ options.formatters,
2650
+ typeof stylisticOptions === "boolean" ? {} : stylisticOptions,
2651
+ options.markdown !== false
2652
+ )
2653
+ );
2654
+ }
2655
+ configs.push(
2656
+ prettier({
2657
+ ...typeof enableTypeScript !== "boolean" ? enableTypeScript : {},
2658
+ componentExts: componentExtensions,
2659
+ overrides: getOverrides(options, "typescript")
2660
+ })
2661
+ );
2662
+ const fusedConfig = flatConfigProps.reduce((accumulator, key) => {
2663
+ if (key in options) {
2664
+ accumulator[key] = options[key];
2665
+ }
2666
+ return accumulator;
2667
+ }, {});
2668
+ if (Object.keys(fusedConfig).length) {
2669
+ configs.push([fusedConfig]);
2670
+ }
2671
+ return combine(...configs, ...userConfigs);
2672
+ }
2673
+
2674
+ // src/types.ts
2675
+ init_esm_shims();
2676
+ export {
2677
+ GLOB_ALL_SRC,
2678
+ GLOB_CSS,
2679
+ GLOB_EXCLUDE,
2680
+ GLOB_HTML,
2681
+ GLOB_JS,
2682
+ GLOB_JSON,
2683
+ GLOB_JSON5,
2684
+ GLOB_JSONC,
2685
+ GLOB_JSX,
2686
+ GLOB_LESS,
2687
+ GLOB_MARKDOWN,
2688
+ GLOB_MARKDOWN_CODE,
2689
+ GLOB_MARKDOWN_IN_MARKDOWN,
2690
+ GLOB_POSTCSS,
2691
+ GLOB_SCSS,
2692
+ GLOB_SRC,
2693
+ GLOB_SRC_EXT,
2694
+ GLOB_STYLE,
2695
+ GLOB_TS,
2696
+ GLOB_TSX,
2697
+ StylisticConfigDefaults,
2698
+ combine,
2699
+ comments,
2700
+ style as default,
2701
+ ensurePackages,
2702
+ formatters,
2703
+ getOverrides,
2704
+ ignores,
2705
+ imports,
2706
+ interopDefault,
2707
+ jsdoc,
2708
+ jsonc,
2709
+ markdown,
2710
+ perfectionist,
2711
+ prettier,
2712
+ promise,
2713
+ react,
2714
+ renameRules,
2715
+ resolveSubOptions,
2716
+ roblox,
2717
+ shopify,
2718
+ sonarjs,
2719
+ sortPackageJson,
2720
+ sortTsconfig,
2721
+ style,
2722
+ stylistic,
2723
+ toArray,
2724
+ typescript,
2725
+ unicorn
2726
+ };