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