@jsse/eslint-config 0.0.1

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,2259 @@
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 __commonJS = (cb, mod) => function __require() {
9
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
+ };
11
+ var __export = (target, all) => {
12
+ for (var name in all)
13
+ __defProp(target, name, { get: all[name], enumerable: true });
14
+ };
15
+ var __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from === "object" || typeof from === "function") {
17
+ for (let key of __getOwnPropNames(from))
18
+ if (!__hasOwnProp.call(to, key) && key !== except)
19
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
20
+ }
21
+ return to;
22
+ };
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
+ // If the importer is in node compatibility mode or this is not an ESM
25
+ // file that has been converted to a CommonJS file using a Babel-
26
+ // compatible transform (i.e. "__esModule" has not been set), then set
27
+ // "default" to the CommonJS "module.exports" for node compatibility.
28
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
29
+ mod
30
+ ));
31
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
+
33
+ // node_modules/.pnpm/natural-compare@1.4.0/node_modules/natural-compare/index.js
34
+ var require_natural_compare = __commonJS({
35
+ "node_modules/.pnpm/natural-compare@1.4.0/node_modules/natural-compare/index.js"(exports, module2) {
36
+ "use strict";
37
+ var naturalCompare = function(a, b) {
38
+ var i, codeA, codeB = 1, posA = 0, posB = 0, alphabet = String.alphabet;
39
+ function getCode(str, pos, code) {
40
+ if (code) {
41
+ for (i = pos; code = getCode(str, i), code < 76 && code > 65; )
42
+ ++i;
43
+ return +str.slice(pos - 1, i);
44
+ }
45
+ code = alphabet && alphabet.indexOf(str.charAt(pos));
46
+ return code > -1 ? code + 76 : (code = str.charCodeAt(pos) || 0, code < 45 || code > 127) ? code : code < 46 ? 65 : code < 48 ? code - 1 : code < 58 ? code + 18 : code < 65 ? code - 11 : code < 91 ? code + 11 : code < 97 ? code - 37 : code < 123 ? code + 5 : code - 63;
47
+ }
48
+ if ((a += "") != (b += ""))
49
+ for (; codeB; ) {
50
+ codeA = getCode(a, posA++);
51
+ codeB = getCode(b, posB++);
52
+ if (codeA < 76 && codeB < 76 && codeA > 66 && codeB > 66) {
53
+ codeA = getCode(a, posA, posA);
54
+ codeB = getCode(b, posB, posA = i);
55
+ posB = i;
56
+ }
57
+ if (codeA != codeB)
58
+ return codeA < codeB ? -1 : 1;
59
+ }
60
+ return 0;
61
+ };
62
+ try {
63
+ module2.exports = naturalCompare;
64
+ } catch (e) {
65
+ String.naturalCompare = naturalCompare;
66
+ }
67
+ }
68
+ });
69
+
70
+ // node_modules/.pnpm/eslint-plugin-sort-keys@2.3.5/node_modules/eslint-plugin-sort-keys/rules/sort-keys-fix.js
71
+ var require_sort_keys_fix = __commonJS({
72
+ "node_modules/.pnpm/eslint-plugin-sort-keys@2.3.5/node_modules/eslint-plugin-sort-keys/rules/sort-keys-fix.js"(exports, module2) {
73
+ "use strict";
74
+ var naturalCompare = require_natural_compare();
75
+ module2.exports = {
76
+ meta: {
77
+ type: "suggestion",
78
+ fixable: "code",
79
+ docs: {
80
+ description: "require object keys to be sorted",
81
+ category: "Stylistic Issues",
82
+ recommended: false,
83
+ url: "https://github.com/namnm/eslint-plugin-sort-keys"
84
+ },
85
+ schema: [
86
+ {
87
+ enum: ["asc", "desc"]
88
+ },
89
+ {
90
+ type: "object",
91
+ properties: {
92
+ caseSensitive: {
93
+ type: "boolean",
94
+ default: true
95
+ },
96
+ natural: {
97
+ type: "boolean",
98
+ default: false
99
+ },
100
+ minKeys: {
101
+ type: "integer",
102
+ minimum: 2,
103
+ default: 2
104
+ }
105
+ },
106
+ additionalProperties: false
107
+ }
108
+ ],
109
+ messages: {
110
+ sortKeys: "Expected object keys to be in {{natural}}{{insensitive}}{{order}}ending order. '{{thisName}}' should be before '{{prevName}}'."
111
+ }
112
+ },
113
+ create(ctx) {
114
+ const order = ctx.options[0] || "asc";
115
+ const options = ctx.options[1];
116
+ const insensitive = (options && options.caseSensitive) === false;
117
+ const natural = Boolean(options && options.natural);
118
+ const isValidOrder = isValidOrders[order + (insensitive ? "I" : "") + (natural ? "N" : "")];
119
+ const minKeys = Number(options && options.minKeys) || 2;
120
+ let stack = null;
121
+ const SpreadElement = (node2) => {
122
+ if (node2.parent.type === "ObjectExpression") {
123
+ stack.prevName = null;
124
+ }
125
+ };
126
+ return {
127
+ ExperimentalSpreadProperty: SpreadElement,
128
+ SpreadElement,
129
+ ObjectExpression() {
130
+ stack = {
131
+ upper: stack,
132
+ prevName: null,
133
+ prevNode: null
134
+ };
135
+ },
136
+ "ObjectExpression:exit"() {
137
+ stack = stack.upper;
138
+ },
139
+ Property(node2) {
140
+ if (node2.parent.type === "ObjectPattern") {
141
+ return;
142
+ }
143
+ if (node2.parent.properties.length < minKeys) {
144
+ return;
145
+ }
146
+ const prevName = stack.prevName;
147
+ const prevNode = stack.prevNode;
148
+ const thisName = getPropertyName(node2);
149
+ if (thisName !== null) {
150
+ stack.prevName = thisName;
151
+ stack.prevNode = node2 || prevNode;
152
+ }
153
+ if (prevName === null || thisName === null) {
154
+ return;
155
+ }
156
+ if (!isValidOrder(prevName, thisName)) {
157
+ ctx.report({
158
+ node: node2,
159
+ loc: node2.key.loc,
160
+ messageId: "sortKeys",
161
+ data: {
162
+ thisName,
163
+ prevName,
164
+ order,
165
+ insensitive: insensitive ? "insensitive " : "",
166
+ natural: natural ? "natural " : ""
167
+ },
168
+ fix(fixer) {
169
+ if (node2.parent.__alreadySorted || node2.parent.properties.__alreadySorted) {
170
+ return [];
171
+ }
172
+ node2.parent.__alreadySorted = true;
173
+ node2.parent.properties.__alreadySorted = true;
174
+ const src = ctx.getSourceCode();
175
+ const props = node2.parent.properties;
176
+ const parts = [];
177
+ let part = [];
178
+ props.forEach((p) => {
179
+ if (!p.key) {
180
+ parts.push(part);
181
+ part = [];
182
+ } else {
183
+ part.push(p);
184
+ }
185
+ });
186
+ parts.push(part);
187
+ parts.forEach((part2) => {
188
+ part2.sort((p1, p2) => {
189
+ const n1 = getPropertyName(p1);
190
+ const n2 = getPropertyName(p2);
191
+ if (insensitive && n1.toLowerCase() === n2.toLowerCase()) {
192
+ return 0;
193
+ }
194
+ return isValidOrder(n1, n2) ? -1 : 1;
195
+ });
196
+ });
197
+ const fixes = [];
198
+ let newIndex = 0;
199
+ parts.forEach((part2) => {
200
+ part2.forEach((p) => {
201
+ moveProperty(p, props[newIndex], fixer, src).forEach(
202
+ (f) => fixes.push(f)
203
+ );
204
+ newIndex++;
205
+ });
206
+ newIndex++;
207
+ });
208
+ return fixes;
209
+ }
210
+ });
211
+ }
212
+ }
213
+ };
214
+ }
215
+ };
216
+ var moveProperty = (thisNode, toNode, fixer, src) => {
217
+ if (thisNode === toNode) {
218
+ return [];
219
+ }
220
+ const fixes = [];
221
+ fixes.push(fixer.replaceText(toNode, src.getText(thisNode)));
222
+ const prev = findTokenPrevLine(thisNode, src);
223
+ const cond = (c) => !prev || prev.loc.end.line !== c.loc.start.line;
224
+ const commentsBefore = src.getCommentsBefore(thisNode).filter(cond);
225
+ if (commentsBefore.length) {
226
+ const prevComments = src.getCommentsBefore(thisNode).filter((c) => !cond(c));
227
+ const b = prevComments.length ? prevComments[prevComments.length - 1].range[1] : prev ? prev.range[1] : commentsBefore[0].range[0];
228
+ const e = commentsBefore[commentsBefore.length - 1].range[1];
229
+ fixes.push(fixer.replaceTextRange([b, e], ""));
230
+ const toPrev = src.getTokenBefore(toNode, { includeComments: true });
231
+ const txt = src.text.substring(b, e);
232
+ fixes.push(fixer.insertTextAfter(toPrev, txt));
233
+ }
234
+ const next = findCommaSameLine(thisNode, src) || thisNode;
235
+ const commentsAfter = src.getCommentsAfter(next).filter((c) => thisNode.loc.end.line === c.loc.start.line);
236
+ if (commentsAfter.length) {
237
+ const b = next.range[1];
238
+ const e = commentsAfter[commentsAfter.length - 1].range[1];
239
+ fixes.push(fixer.replaceTextRange([b, e], ""));
240
+ const toNext = findCommaSameLine(toNode, src) || toNode;
241
+ const txt = src.text.substring(b, e);
242
+ fixes.push(fixer.insertTextAfter(toNext, txt));
243
+ }
244
+ return fixes;
245
+ };
246
+ var findTokenPrevLine = (node2, src) => {
247
+ let t = src.getTokenBefore(node2);
248
+ while (true) {
249
+ if (!t || t.range[0] < node2.parent.range[0]) {
250
+ return null;
251
+ }
252
+ if (t.loc.end.line < node2.loc.start.line) {
253
+ return t;
254
+ }
255
+ t = src.getTokenBefore(t);
256
+ }
257
+ };
258
+ var findCommaSameLine = (node2, src) => {
259
+ const t = src.getTokenAfter(node2);
260
+ return t && t.value === "," && node2.loc.end.line === t.loc.start.line ? t : null;
261
+ };
262
+ var isValidOrders = {
263
+ asc: (a, b) => a <= b,
264
+ ascI: (a, b) => a.toLowerCase() <= b.toLowerCase(),
265
+ ascN: (a, b) => naturalCompare(a, b) <= 0,
266
+ ascIN: (a, b) => naturalCompare(a.toLowerCase(), b.toLowerCase()) <= 0,
267
+ desc: (a, b) => isValidOrders.asc(b, a),
268
+ descI: (a, b) => isValidOrders.ascI(b, a),
269
+ descN: (a, b) => isValidOrders.ascN(b, a),
270
+ descIN: (a, b) => isValidOrders.ascIN(b, a)
271
+ };
272
+ var getPropertyName = (node2) => {
273
+ let prop;
274
+ switch (node2 && node2.type) {
275
+ case "Property":
276
+ case "MethodDefinition":
277
+ prop = node2.key;
278
+ break;
279
+ case "MemberExpression":
280
+ prop = node2.property;
281
+ break;
282
+ }
283
+ switch (prop && prop.type) {
284
+ case "Literal":
285
+ return String(prop.value);
286
+ case "TemplateLiteral":
287
+ if (prop.expressions.length === 0 && prop.quasis.length === 1) {
288
+ return prop.quasis[0].value.cooked;
289
+ }
290
+ break;
291
+ case "Identifier":
292
+ if (!node2.computed) {
293
+ return prop.name;
294
+ }
295
+ break;
296
+ }
297
+ return node2.key && node2.key.name || null;
298
+ };
299
+ }
300
+ });
301
+
302
+ // node_modules/.pnpm/eslint-plugin-sort-keys@2.3.5/node_modules/eslint-plugin-sort-keys/index.js
303
+ var require_eslint_plugin_sort_keys = __commonJS({
304
+ "node_modules/.pnpm/eslint-plugin-sort-keys@2.3.5/node_modules/eslint-plugin-sort-keys/index.js"(exports, module2) {
305
+ "use strict";
306
+ module2.exports.rules = {
307
+ "sort-keys-fix": require_sort_keys_fix()
308
+ };
309
+ }
310
+ });
311
+
312
+ // src/index.ts
313
+ var src_exports = {};
314
+ __export(src_exports, {
315
+ GLOB_ALL_SRC: () => GLOB_ALL_SRC,
316
+ GLOB_CSS: () => GLOB_CSS,
317
+ GLOB_EXCLUDE: () => GLOB_EXCLUDE,
318
+ GLOB_HTML: () => GLOB_HTML,
319
+ GLOB_JS: () => GLOB_JS,
320
+ GLOB_JSON: () => GLOB_JSON,
321
+ GLOB_JSON5: () => GLOB_JSON5,
322
+ GLOB_JSONC: () => GLOB_JSONC,
323
+ GLOB_JSX: () => GLOB_JSX,
324
+ GLOB_LESS: () => GLOB_LESS,
325
+ GLOB_MARKDOWN: () => GLOB_MARKDOWN,
326
+ GLOB_MARKDOWN_CODE: () => GLOB_MARKDOWN_CODE,
327
+ GLOB_SCSS: () => GLOB_SCSS,
328
+ GLOB_SRC: () => GLOB_SRC,
329
+ GLOB_SRC_EXT: () => GLOB_SRC_EXT,
330
+ GLOB_STYLE: () => GLOB_STYLE,
331
+ GLOB_TESTS: () => GLOB_TESTS,
332
+ GLOB_TS: () => GLOB_TS,
333
+ GLOB_TSX: () => GLOB_TSX,
334
+ GLOB_YAML: () => GLOB_YAML,
335
+ combine: () => combine,
336
+ comments: () => comments,
337
+ default: () => jsse,
338
+ ignores: () => ignores,
339
+ imports: () => imports,
340
+ isCI: () => isCI,
341
+ isInEditor: () => isInEditor,
342
+ javascript: () => javascript,
343
+ jsdoc: () => jsdoc,
344
+ jsonc: () => jsonc,
345
+ jsse: () => jsse,
346
+ node: () => node,
347
+ parserJsonc: () => import_jsonc_eslint_parser.default,
348
+ parserTs: () => parserTs,
349
+ pluginEslintComments: () => import_eslint_plugin_eslint_comments.default,
350
+ pluginImport: () => pluginImport,
351
+ pluginJsdoc: () => import_eslint_plugin_jsdoc.default,
352
+ pluginJsonc: () => pluginJsonc,
353
+ pluginNoOnlyTests: () => import_eslint_plugin_no_only_tests.default,
354
+ pluginNode: () => import_eslint_plugin_n.default,
355
+ pluginReact: () => import_eslint_plugin_react.default,
356
+ pluginReactHooks: () => import_eslint_plugin_react_hooks.default,
357
+ pluginReactRefresh: () => pluginReactRefresh,
358
+ pluginSortKeys: () => pluginSortKeys,
359
+ pluginStylistic: () => import_eslint_plugin.default,
360
+ pluginTailwind: () => import_eslint_plugin_tailwindcss.default,
361
+ pluginTs: () => import_eslint_plugin2.default,
362
+ pluginUnicorn: () => import_eslint_plugin_unicorn.default,
363
+ pluginUnusedImports: () => import_eslint_plugin_unused_imports.default,
364
+ pluginVitest: () => import_eslint_plugin_vitest.default,
365
+ react: () => react,
366
+ reactHooks: () => reactHooks,
367
+ renameRules: () => renameRules,
368
+ sortPackageJson: () => sortPackageJson,
369
+ sortTsconfig: () => sortTsconfig,
370
+ test: () => test,
371
+ typescript: () => typescript,
372
+ unicorn: () => unicorn
373
+ });
374
+ module.exports = __toCommonJS(src_exports);
375
+
376
+ // src/plugins.ts
377
+ var import_eslint_plugin = __toESM(require("@stylistic/eslint-plugin"), 1);
378
+ var import_eslint_plugin2 = __toESM(require("@typescript-eslint/eslint-plugin"), 1);
379
+ var parserTs = __toESM(require("@typescript-eslint/parser"), 1);
380
+ var import_eslint_plugin_eslint_comments = __toESM(require("eslint-plugin-eslint-comments"), 1);
381
+ var pluginImport = __toESM(require("eslint-plugin-i"), 1);
382
+ var import_eslint_plugin_jsdoc = __toESM(require("eslint-plugin-jsdoc"), 1);
383
+ var pluginJsonc = __toESM(require("eslint-plugin-jsonc"), 1);
384
+ var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
385
+ var import_eslint_plugin_no_only_tests = __toESM(require("eslint-plugin-no-only-tests"), 1);
386
+ var import_eslint_plugin_react = __toESM(require("eslint-plugin-react"), 1);
387
+ var import_eslint_plugin_react_hooks = __toESM(require("eslint-plugin-react-hooks"), 1);
388
+ var pluginReactRefresh = __toESM(require("eslint-plugin-react-refresh"), 1);
389
+ var pluginSortKeys = __toESM(require_eslint_plugin_sort_keys(), 1);
390
+ var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
391
+ var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
392
+ var import_eslint_plugin_tailwindcss = __toESM(require("eslint-plugin-tailwindcss"), 1);
393
+ var import_eslint_plugin_vitest = __toESM(require("eslint-plugin-vitest"), 1);
394
+ var import_jsonc_eslint_parser = __toESM(require("jsonc-eslint-parser"), 1);
395
+
396
+ // src/configs/comments.ts
397
+ function comments() {
398
+ return [
399
+ {
400
+ name: "jsse:eslint-comments",
401
+ plugins: {
402
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
403
+ "eslint-comments": import_eslint_plugin_eslint_comments.default
404
+ },
405
+ rules: {
406
+ "eslint-comments/no-aggregating-enable": "error",
407
+ "eslint-comments/no-duplicate-disable": "error",
408
+ "eslint-comments/no-unlimited-disable": "error",
409
+ "eslint-comments/no-unused-enable": "error"
410
+ }
411
+ }
412
+ ];
413
+ }
414
+
415
+ // src/globs.ts
416
+ var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
417
+ var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
418
+ var GLOB_JS = "**/*.?([cm])js";
419
+ var GLOB_JSX = "**/*.?([cm])jsx";
420
+ var GLOB_TS = "**/*.?([cm])ts";
421
+ var GLOB_TSX = "**/*.?([cm])tsx";
422
+ var GLOB_STYLE = "**/*.{c,le,sc}ss";
423
+ var GLOB_CSS = "**/*.css";
424
+ var GLOB_LESS = "**/*.less";
425
+ var GLOB_SCSS = "**/*.scss";
426
+ var GLOB_JSON = "**/*.json";
427
+ var GLOB_JSON5 = "**/*.json5";
428
+ var GLOB_JSONC = "**/*.jsonc";
429
+ var GLOB_MARKDOWN = "**/*.md";
430
+ var GLOB_YAML = "**/*.y?(a)ml";
431
+ var GLOB_HTML = "**/*.htm?(l)";
432
+ var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
433
+ var GLOB_TESTS = [
434
+ `**/__tests__/**/*.${GLOB_SRC_EXT}`,
435
+ `**/*.spec.${GLOB_SRC_EXT}`,
436
+ `**/*.test.${GLOB_SRC_EXT}`,
437
+ `**/*.bench.${GLOB_SRC_EXT}`,
438
+ `**/*.benchmark.${GLOB_SRC_EXT}`
439
+ ];
440
+ var GLOB_ALL_SRC = [GLOB_SRC, GLOB_STYLE, GLOB_JSON, GLOB_JSON5, GLOB_MARKDOWN, GLOB_YAML, GLOB_HTML];
441
+ var GLOB_EXCLUDE = [
442
+ "**/node_modules",
443
+ "**/dist",
444
+ "**/package-lock.json",
445
+ "**/yarn.lock",
446
+ "**/pnpm-lock.yaml",
447
+ "**/bun.lockb",
448
+ "**/output",
449
+ "**/out",
450
+ "**/coverage",
451
+ "**/temp",
452
+ "**/.vitepress/cache",
453
+ "**/.nuxt",
454
+ "**/.next",
455
+ "**/.vercel",
456
+ "**/.changeset",
457
+ "**/.idea",
458
+ "**/.cache",
459
+ "**/.output",
460
+ "**/.vite-inspect",
461
+ "**/CHANGELOG*.md",
462
+ "**/*.min.*",
463
+ "**/LICENSE*",
464
+ "**/__snapshots__",
465
+ "**/auto-import?(s).d.ts",
466
+ "**/components.d.ts",
467
+ "**/scratch",
468
+ "**/tmp",
469
+ "**/temp"
470
+ ];
471
+
472
+ // src/configs/ignores.ts
473
+ function ignores() {
474
+ return [
475
+ {
476
+ ignores: GLOB_EXCLUDE
477
+ }
478
+ ];
479
+ }
480
+
481
+ // src/configs/imports.ts
482
+ function imports(options = {}) {
483
+ const { stylistic = true } = options;
484
+ return [
485
+ {
486
+ name: "jsse:imports",
487
+ plugins: {
488
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
489
+ import: pluginImport
490
+ },
491
+ rules: {
492
+ "import/first": "error",
493
+ "import/no-duplicates": "error",
494
+ "import/no-mutable-exports": "error",
495
+ "import/no-named-default": "error",
496
+ "import/no-self-import": "error",
497
+ "import/no-webpack-loader-syntax": "error",
498
+ "import/order": "error",
499
+ ...stylistic ? {
500
+ "import/newline-after-import": ["error", { considerComments: true, count: 1 }]
501
+ } : {}
502
+ }
503
+ }
504
+ ];
505
+ }
506
+
507
+ // src/configs/javascript.ts
508
+ var import_js = __toESM(require("@eslint/js"), 1);
509
+ var import_globals = __toESM(require("globals"), 1);
510
+ function javascript(options = {}) {
511
+ const { isInEditor: isInEditor2 = false, overrides = {} } = options;
512
+ return [
513
+ {
514
+ languageOptions: {
515
+ ecmaVersion: 2022,
516
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
517
+ globals: {
518
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
519
+ ...import_globals.default.browser,
520
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
521
+ ...import_globals.default.es2021,
522
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
523
+ ...import_globals.default.node,
524
+ document: "readonly",
525
+ navigator: "readonly",
526
+ window: "readonly"
527
+ },
528
+ parserOptions: {
529
+ ecmaFeatures: {
530
+ jsx: true
531
+ },
532
+ ecmaVersion: 2022,
533
+ sourceType: "module"
534
+ },
535
+ sourceType: "module"
536
+ },
537
+ linterOptions: {
538
+ reportUnusedDisableDirectives: options.reportUnusedDisableDirectives ?? true
539
+ },
540
+ name: "jsse:javascript",
541
+ plugins: {
542
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
543
+ "unused-imports": import_eslint_plugin_unused_imports.default
544
+ },
545
+ rules: {
546
+ ...import_js.default.configs.recommended.rules,
547
+ "accessor-pairs": ["error", { enforceForClassMembers: true, setWithoutGet: true }],
548
+ "array-callback-return": "error",
549
+ "arrow-parens": ["error", "as-needed", { requireForBlockBody: true }],
550
+ "block-scoped-var": "error",
551
+ "constructor-super": "error",
552
+ "default-case-last": "error",
553
+ "dot-notation": ["error", { allowKeywords: true }],
554
+ eqeqeq: ["error", "smart"],
555
+ "new-cap": ["error", { capIsNew: false, newIsCap: true, properties: true }],
556
+ "no-alert": "error",
557
+ "no-array-constructor": "error",
558
+ "no-async-promise-executor": "error",
559
+ "no-caller": "error",
560
+ "no-case-declarations": "error",
561
+ "no-class-assign": "error",
562
+ "no-compare-neg-zero": "error",
563
+ "no-cond-assign": ["error", "always"],
564
+ "no-console": ["error", { allow: ["warn", "error"] }],
565
+ "no-const-assign": "error",
566
+ "no-control-regex": "error",
567
+ "no-debugger": "error",
568
+ "no-delete-var": "error",
569
+ "no-dupe-args": "error",
570
+ "no-dupe-class-members": "error",
571
+ "no-dupe-keys": "error",
572
+ "no-duplicate-case": "error",
573
+ "no-empty": ["error", { allowEmptyCatch: true }],
574
+ "no-empty-character-class": "error",
575
+ "no-empty-pattern": "error",
576
+ "no-eval": "error",
577
+ "no-ex-assign": "error",
578
+ "no-extend-native": "error",
579
+ "no-extra-bind": "error",
580
+ "no-extra-boolean-cast": "error",
581
+ "no-fallthrough": "error",
582
+ "no-func-assign": "error",
583
+ "no-global-assign": "error",
584
+ "no-implied-eval": "error",
585
+ "no-import-assign": "error",
586
+ "no-invalid-regexp": "error",
587
+ "no-invalid-this": "error",
588
+ "no-irregular-whitespace": "error",
589
+ "no-iterator": "error",
590
+ "no-labels": ["error", { allowLoop: false, allowSwitch: false }],
591
+ "no-lone-blocks": "error",
592
+ "no-loss-of-precision": "error",
593
+ "no-misleading-character-class": "error",
594
+ "no-multi-str": "error",
595
+ "no-nested-ternary": "off",
596
+ "no-new": "error",
597
+ "no-new-func": "error",
598
+ "no-new-object": "error",
599
+ "no-new-symbol": "error",
600
+ "no-new-wrappers": "error",
601
+ "no-obj-calls": "error",
602
+ "no-octal": "error",
603
+ "no-octal-escape": "error",
604
+ "no-proto": "error",
605
+ "no-prototype-builtins": "error",
606
+ "no-redeclare": ["error", { builtinGlobals: false }],
607
+ "no-regex-spaces": "error",
608
+ "no-restricted-globals": [
609
+ "error",
610
+ { message: "Use `globalThis` instead.", name: "global" },
611
+ { message: "Use `globalThis` instead.", name: "self" }
612
+ ],
613
+ "no-restricted-properties": [
614
+ "error",
615
+ {
616
+ message: "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.",
617
+ property: "__proto__"
618
+ },
619
+ {
620
+ message: "Use `Object.defineProperty` instead.",
621
+ property: "__defineGetter__"
622
+ },
623
+ {
624
+ message: "Use `Object.defineProperty` instead.",
625
+ property: "__defineSetter__"
626
+ },
627
+ {
628
+ message: "Use `Object.getOwnPropertyDescriptor` instead.",
629
+ property: "__lookupGetter__"
630
+ },
631
+ {
632
+ message: "Use `Object.getOwnPropertyDescriptor` instead.",
633
+ property: "__lookupSetter__"
634
+ }
635
+ ],
636
+ "no-restricted-syntax": [
637
+ "error",
638
+ "DebuggerStatement",
639
+ "LabeledStatement",
640
+ "WithStatement",
641
+ "TSEnumDeclaration[const=true]",
642
+ "TSExportAssignment"
643
+ ],
644
+ "no-self-assign": ["error", { props: true }],
645
+ "no-self-compare": "error",
646
+ "no-sequences": "error",
647
+ "no-shadow-restricted-names": "error",
648
+ "no-sparse-arrays": "error",
649
+ "no-template-curly-in-string": "error",
650
+ "no-this-before-super": "error",
651
+ "no-throw-literal": "error",
652
+ "no-undef": "error",
653
+ "no-undef-init": "error",
654
+ "no-unexpected-multiline": "error",
655
+ "no-unmodified-loop-condition": "error",
656
+ "no-unneeded-ternary": ["error", { defaultAssignment: false }],
657
+ "no-unreachable": "error",
658
+ "no-unreachable-loop": "error",
659
+ "no-unsafe-finally": "error",
660
+ "no-unsafe-negation": "error",
661
+ "no-unused-expressions": [
662
+ "error",
663
+ {
664
+ allowShortCircuit: true,
665
+ allowTaggedTemplates: true,
666
+ allowTernary: true
667
+ }
668
+ ],
669
+ "no-unused-vars": [
670
+ "error",
671
+ {
672
+ args: "none",
673
+ caughtErrors: "none",
674
+ ignoreRestSiblings: true,
675
+ vars: "all"
676
+ }
677
+ ],
678
+ "no-use-before-define": ["error", { classes: false, functions: false, variables: true }],
679
+ "no-useless-backreference": "error",
680
+ "no-useless-call": "error",
681
+ "no-useless-catch": "error",
682
+ "no-useless-computed-key": "error",
683
+ "no-useless-constructor": "error",
684
+ "no-useless-rename": "error",
685
+ "no-useless-return": "error",
686
+ "no-var": "error",
687
+ "no-void": "error",
688
+ "no-with": "error",
689
+ "object-shorthand": [
690
+ "error",
691
+ "always",
692
+ {
693
+ avoidQuotes: true,
694
+ ignoreConstructors: false
695
+ }
696
+ ],
697
+ "one-var": ["error", { initialized: "never" }],
698
+ "prefer-arrow-callback": [
699
+ "error",
700
+ {
701
+ allowNamedFunctions: false,
702
+ allowUnboundThis: true
703
+ }
704
+ ],
705
+ "prefer-const": [
706
+ "error",
707
+ {
708
+ destructuring: "all",
709
+ ignoreReadBeforeAssign: true
710
+ }
711
+ ],
712
+ "prefer-exponentiation-operator": "error",
713
+ "prefer-promise-reject-errors": "error",
714
+ "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
715
+ "prefer-rest-params": "error",
716
+ "prefer-spread": "error",
717
+ "prefer-template": "error",
718
+ "sort-imports": [
719
+ "error",
720
+ {
721
+ allowSeparatedGroups: false,
722
+ ignoreCase: false,
723
+ ignoreDeclarationSort: true,
724
+ ignoreMemberSort: false,
725
+ memberSyntaxSortOrder: ["none", "all", "multiple", "single"]
726
+ }
727
+ ],
728
+ "symbol-description": "error",
729
+ "unicode-bom": ["error", "never"],
730
+ "unused-imports/no-unused-imports": isInEditor2 ? "off" : "error",
731
+ "unused-imports/no-unused-vars": [
732
+ "error",
733
+ {
734
+ args: "after-used",
735
+ argsIgnorePattern: "^_",
736
+ vars: "all",
737
+ varsIgnorePattern: "^_"
738
+ }
739
+ ],
740
+ "use-isnan": ["error", { enforceForIndexOf: true, enforceForSwitchCase: true }],
741
+ "valid-typeof": ["error", { requireStringLiterals: true }],
742
+ "vars-on-top": "error",
743
+ yoda: ["error", "never"],
744
+ ...overrides
745
+ }
746
+ },
747
+ {
748
+ files: [`scripts/${GLOB_SRC}`, `cli.${GLOB_SRC_EXT}`],
749
+ name: "jsse:scripts-overrides",
750
+ rules: {
751
+ "no-console": "off"
752
+ }
753
+ }
754
+ ];
755
+ }
756
+
757
+ // src/configs/jsdoc.ts
758
+ function jsdoc(options = {}) {
759
+ const { stylistic = true } = options;
760
+ return [
761
+ {
762
+ name: "jsse:jsdoc",
763
+ plugins: {
764
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
765
+ jsdoc: import_eslint_plugin_jsdoc.default
766
+ },
767
+ rules: {
768
+ "jsdoc/check-access": "warn",
769
+ "jsdoc/check-param-names": "warn",
770
+ "jsdoc/check-property-names": "warn",
771
+ "jsdoc/check-types": "warn",
772
+ "jsdoc/empty-tags": "warn",
773
+ "jsdoc/implements-on-classes": "warn",
774
+ "jsdoc/no-defaults": "warn",
775
+ "jsdoc/no-multi-asterisks": "warn",
776
+ "jsdoc/require-param-name": "warn",
777
+ "jsdoc/require-property": "warn",
778
+ "jsdoc/require-property-description": "warn",
779
+ "jsdoc/require-property-name": "warn",
780
+ "jsdoc/require-returns-check": "warn",
781
+ "jsdoc/require-returns-description": "warn",
782
+ "jsdoc/require-yields-check": "warn",
783
+ ...stylistic ? {
784
+ "jsdoc/check-alignment": "warn",
785
+ "jsdoc/multiline-blocks": "warn"
786
+ } : {}
787
+ }
788
+ }
789
+ ];
790
+ }
791
+
792
+ // src/configs/jsonc.ts
793
+ function jsonc(options = {}) {
794
+ const { stylistic = true, overrides = {} } = options;
795
+ const { indent = 2 } = typeof stylistic === "boolean" ? {} : stylistic;
796
+ return [
797
+ {
798
+ name: "jsse:jsonc:setup",
799
+ plugins: {
800
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-explicit-any
801
+ jsonc: pluginJsonc
802
+ }
803
+ },
804
+ {
805
+ files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
806
+ languageOptions: {
807
+ parser: import_jsonc_eslint_parser.default
808
+ },
809
+ name: "jsse:jsonc:rules",
810
+ rules: {
811
+ "jsonc/no-bigint-literals": "error",
812
+ "jsonc/no-binary-expression": "error",
813
+ "jsonc/no-binary-numeric-literals": "error",
814
+ "jsonc/no-dupe-keys": "error",
815
+ "jsonc/no-escape-sequence-in-identifier": "error",
816
+ "jsonc/no-floating-decimal": "error",
817
+ "jsonc/no-hexadecimal-numeric-literals": "error",
818
+ "jsonc/no-infinity": "error",
819
+ "jsonc/no-multi-str": "error",
820
+ "jsonc/no-nan": "error",
821
+ "jsonc/no-number-props": "error",
822
+ "jsonc/no-numeric-separators": "error",
823
+ "jsonc/no-octal": "error",
824
+ "jsonc/no-octal-escape": "error",
825
+ "jsonc/no-octal-numeric-literals": "error",
826
+ "jsonc/no-parenthesized": "error",
827
+ "jsonc/no-plus-sign": "error",
828
+ "jsonc/no-regexp-literals": "error",
829
+ "jsonc/no-sparse-arrays": "error",
830
+ "jsonc/no-template-literals": "error",
831
+ "jsonc/no-undefined-value": "error",
832
+ "jsonc/no-unicode-codepoint-escapes": "error",
833
+ "jsonc/no-useless-escape": "error",
834
+ "jsonc/space-unary-ops": "error",
835
+ "jsonc/valid-json-number": "error",
836
+ "jsonc/vue-custom-block/no-parsing-error": "error",
837
+ ...stylistic ? {
838
+ "jsonc/array-bracket-spacing": ["error", "never"],
839
+ "jsonc/comma-dangle": ["error", "never"],
840
+ "jsonc/comma-style": ["error", "last"],
841
+ "jsonc/indent": ["error", indent],
842
+ "jsonc/key-spacing": ["error", { afterColon: true, beforeColon: false }],
843
+ "jsonc/object-curly-newline": ["error", { consistent: true, multiline: true }],
844
+ "jsonc/object-curly-spacing": ["error", "always"],
845
+ "jsonc/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
846
+ "jsonc/quote-props": "error",
847
+ "jsonc/quotes": "error"
848
+ } : {},
849
+ ...overrides
850
+ }
851
+ }
852
+ ];
853
+ }
854
+
855
+ // src/configs/node.ts
856
+ function node() {
857
+ return [
858
+ {
859
+ name: "jsse:node",
860
+ plugins: {
861
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
862
+ node: import_eslint_plugin_n.default
863
+ },
864
+ rules: {
865
+ "node/handle-callback-err": ["error", "^(err|error)$"],
866
+ "node/no-deprecated-api": "error",
867
+ "node/no-exports-assign": "error",
868
+ "node/no-new-require": "error",
869
+ "node/no-path-concat": "error",
870
+ "node/prefer-global/buffer": ["error", "never"],
871
+ "node/prefer-global/process": ["error", "never"],
872
+ "node/process-exit-as-throw": "error"
873
+ }
874
+ }
875
+ ];
876
+ }
877
+
878
+ // src/configs/ts/typescript-language-options.ts
879
+ var import_node_process = __toESM(require("process"), 1);
880
+ function parserOptionProject(tsconfigPath) {
881
+ if (typeof tsconfigPath === "string") {
882
+ return [tsconfigPath];
883
+ }
884
+ return tsconfigPath;
885
+ }
886
+ function typescriptLanguageOptions(options) {
887
+ const { parserOptions = {}, tsconfigPath, react: react2 } = options ?? {};
888
+ if (react2) {
889
+ return {
890
+ parser: parserTs,
891
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
892
+ parserOptions: {
893
+ ecmaFeatures: { jsx: true, modules: true },
894
+ jsxPragma: null,
895
+ sourceType: "module",
896
+ ...tsconfigPath ? {
897
+ project: parserOptionProject(tsconfigPath),
898
+ tsconfigRootDir: import_node_process.default.cwd()
899
+ } : {},
900
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
901
+ ...parserOptions
902
+ }
903
+ };
904
+ }
905
+ return {
906
+ parser: parserTs,
907
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
908
+ parserOptions: {
909
+ sourceType: "module",
910
+ ...tsconfigPath ? {
911
+ project: parserOptionProject(tsconfigPath),
912
+ tsconfigRootDir: import_node_process.default.cwd()
913
+ } : {},
914
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
915
+ ...parserOptions
916
+ }
917
+ };
918
+ }
919
+
920
+ // src/configs/react.ts
921
+ var reactRules = {
922
+ "react-hooks/exhaustive-deps": "error",
923
+ "react-hooks/rules-of-hooks": "error",
924
+ "react/boolean-prop-naming": [
925
+ "error",
926
+ {
927
+ rule: ["^(is|has)[A-Z]([A-Za-z0-9]?)+", "|^(debug|disabled|hidden|required|selected|highlight)$"].join(""),
928
+ validateNested: true
929
+ }
930
+ ],
931
+ "react/button-has-type": "error",
932
+ "react/function-component-definition": [
933
+ "error",
934
+ {
935
+ namedComponents: "function-declaration",
936
+ unnamedComponents: "arrow-function"
937
+ }
938
+ ],
939
+ "react/hook-use-state": "error",
940
+ "react/iframe-missing-sandbox": "error",
941
+ "react/jsx-boolean-value": "error",
942
+ "react/jsx-child-element-spacing": "error",
943
+ "react/jsx-closing-bracket-location": [
944
+ "error",
945
+ {
946
+ nonEmpty: "tag-aligned",
947
+ selfClosing: false
948
+ }
949
+ ],
950
+ "react/jsx-closing-tag-location": "error",
951
+ "react/jsx-curly-brace-presence": [
952
+ "error",
953
+ {
954
+ children: "never",
955
+ propElementValues: "always",
956
+ props: "never"
957
+ }
958
+ ],
959
+ "react/jsx-curly-newline": [
960
+ "error",
961
+ {
962
+ multiline: "consistent",
963
+ singleline: "forbid"
964
+ }
965
+ ],
966
+ "react/jsx-curly-spacing": ["error", "never"],
967
+ "react/jsx-equals-spacing": ["error", "never"],
968
+ "react/jsx-first-prop-new-line": "error",
969
+ "react/jsx-fragments": ["error", "syntax"],
970
+ "react/jsx-indent": ["error", 2],
971
+ "react/jsx-indent-props": ["error", 2],
972
+ "react/jsx-key": "warn",
973
+ "react/jsx-max-props-per-line": [
974
+ "error",
975
+ {
976
+ maximum: 3,
977
+ when: "multiline"
978
+ }
979
+ ],
980
+ "react/jsx-no-bind": [
981
+ "error",
982
+ {
983
+ allowArrowFunctions: true
984
+ }
985
+ ],
986
+ "react/jsx-no-comment-textnodes": "error",
987
+ "react/jsx-no-constructed-context-values": "error",
988
+ "react/jsx-no-duplicate-props": [
989
+ "error",
990
+ {
991
+ ignoreCase: true
992
+ }
993
+ ],
994
+ "react/jsx-no-script-url": "error",
995
+ "react/jsx-no-target-blank": [
996
+ "error",
997
+ {
998
+ forms: true,
999
+ warnOnSpreadAttributes: true
1000
+ }
1001
+ ],
1002
+ "react/jsx-no-undef": "error",
1003
+ "react/jsx-no-useless-fragment": "error",
1004
+ "react/jsx-pascal-case": "error",
1005
+ "react/jsx-props-no-multi-spaces": "error",
1006
+ "react/jsx-sort-props": [
1007
+ "error",
1008
+ {
1009
+ callbacksLast: true,
1010
+ noSortAlphabetically: true,
1011
+ reservedFirst: true,
1012
+ shorthandFirst: true
1013
+ }
1014
+ ],
1015
+ "react/jsx-tag-spacing": [
1016
+ "error",
1017
+ {
1018
+ afterOpening: "never",
1019
+ beforeClosing: "never",
1020
+ beforeSelfClosing: "never",
1021
+ closingSlash: "never"
1022
+ }
1023
+ ],
1024
+ "react/jsx-uses-react": "error",
1025
+ "react/jsx-uses-vars": "error",
1026
+ "react/jsx-wrap-multilines": [
1027
+ "error",
1028
+ {
1029
+ arrow: "parens-new-line",
1030
+ assignment: "parens-new-line",
1031
+ condition: "ignore",
1032
+ declaration: "parens-new-line",
1033
+ logical: "ignore",
1034
+ prop: "ignore",
1035
+ return: "parens-new-line"
1036
+ }
1037
+ ],
1038
+ "react/no-access-state-in-setstate": "error",
1039
+ "react/no-array-index-key": "error",
1040
+ "react/no-arrow-function-lifecycle": "error",
1041
+ "react/no-children-prop": "error",
1042
+ "react/no-danger": "error",
1043
+ "react/no-danger-with-children": "error",
1044
+ "react/no-deprecated": "error",
1045
+ "react/no-did-update-set-state": "error",
1046
+ "react/no-direct-mutation-state": "error",
1047
+ "react/no-find-dom-node": "error",
1048
+ "react/no-invalid-html-attribute": "error",
1049
+ "react/no-is-mounted": "error",
1050
+ "react/no-namespace": "error",
1051
+ "react/no-redundant-should-component-update": "error",
1052
+ "react/no-render-return-value": "error",
1053
+ "react/no-string-refs": [
1054
+ "error",
1055
+ {
1056
+ noTemplateLiterals: true
1057
+ }
1058
+ ],
1059
+ "react/no-this-in-sfc": "error",
1060
+ "react/no-typos": "error",
1061
+ "react/no-unescaped-entities": "error",
1062
+ "react/no-unsafe": "error",
1063
+ // "react/no-unused-prop-types": "error",
1064
+ "react/no-unused-state": "error",
1065
+ "react/prefer-read-only-props": "error",
1066
+ // "react/prop-types": "error",
1067
+ "react/react-in-jsx-scope": "off",
1068
+ "react/require-default-props": [
1069
+ "error",
1070
+ {
1071
+ forbidDefaultForRequired: true,
1072
+ ignoreFunctionalComponents: true
1073
+ }
1074
+ ],
1075
+ "react/self-closing-comp": "error",
1076
+ "react/state-in-constructor": ["error", "never"],
1077
+ "react/static-property-placement": "error",
1078
+ "react/style-prop-object": [
1079
+ "error",
1080
+ {
1081
+ allow: ["FormattedNumber"]
1082
+ }
1083
+ ],
1084
+ "react/void-dom-elements-no-children": "error"
1085
+ };
1086
+ function reactHooks() {
1087
+ return [
1088
+ {
1089
+ files: [GLOB_SRC],
1090
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
1091
+ plugins: { "react-hooks": import_eslint_plugin_react_hooks.default },
1092
+ rules: {
1093
+ "react-hooks/exhaustive-deps": "error",
1094
+ "react-hooks/rules-of-hooks": "error"
1095
+ }
1096
+ }
1097
+ ];
1098
+ }
1099
+ function reactRefreshFlatConfigs() {
1100
+ return [
1101
+ {
1102
+ files: [GLOB_SRC],
1103
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
1104
+ plugins: { "react-refresh": pluginReactRefresh },
1105
+ rules: {
1106
+ "react-refresh/only-export-components": "error"
1107
+ }
1108
+ },
1109
+ {
1110
+ files: ["**/*.stories.tsx"],
1111
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
1112
+ plugins: { "react-refresh": pluginReactRefresh },
1113
+ rules: {
1114
+ "react-refresh/only-export-components": "off"
1115
+ }
1116
+ }
1117
+ ];
1118
+ }
1119
+ function reactRecomendedRules() {
1120
+ return {
1121
+ "react/display-name": 2,
1122
+ "react/jsx-key": 2,
1123
+ "react/jsx-no-comment-textnodes": 2,
1124
+ "react/jsx-no-duplicate-props": 2,
1125
+ "react/jsx-no-target-blank": 2,
1126
+ "react/jsx-no-undef": 2,
1127
+ "react/jsx-uses-react": 2,
1128
+ "react/jsx-uses-vars": 2,
1129
+ "react/no-children-prop": 2,
1130
+ "react/no-danger-with-children": 2,
1131
+ "react/no-deprecated": 2,
1132
+ "react/no-direct-mutation-state": 2,
1133
+ "react/no-find-dom-node": 2,
1134
+ "react/no-is-mounted": 2,
1135
+ "react/no-render-return-value": 2,
1136
+ "react/no-string-refs": 2,
1137
+ "react/no-unescaped-entities": 2,
1138
+ // this rule has a bug w/ typescript-eslint-parser
1139
+ // 'react/no-unknown-property': 2,
1140
+ "react/no-unsafe": 0,
1141
+ "react/prop-types": 1,
1142
+ "react/react-in-jsx-scope": 2,
1143
+ "react/require-render-return": 2
1144
+ };
1145
+ }
1146
+ function react(options) {
1147
+ const { parserOptions = {}, tsconfigPath, react: react2, reactRefresh } = options ?? {};
1148
+ const config = [
1149
+ {
1150
+ files: [GLOB_SRC],
1151
+ languageOptions: typescriptLanguageOptions({
1152
+ parserOptions,
1153
+ react: react2,
1154
+ tsconfigPath
1155
+ }),
1156
+ name: "jsse:react:setup",
1157
+ plugins: {
1158
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
1159
+ react: import_eslint_plugin_react.default,
1160
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
1161
+ "react-hooks": import_eslint_plugin_react_hooks.default
1162
+ }
1163
+ },
1164
+ {
1165
+ files: [GLOB_SRC],
1166
+ plugins: {
1167
+ // react: pluginReact,
1168
+ // },
1169
+ },
1170
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
1171
+ rules: {
1172
+ ...reactRecomendedRules(),
1173
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
1174
+ ...import_eslint_plugin_react.default.configs["jsx-runtime"].rules,
1175
+ ...reactRules
1176
+ },
1177
+ settings: {
1178
+ react: {
1179
+ version: "detect"
1180
+ }
1181
+ }
1182
+ }
1183
+ ];
1184
+ if (reactRefresh) {
1185
+ config.push(...reactRefreshFlatConfigs());
1186
+ }
1187
+ return config;
1188
+ }
1189
+
1190
+ // src/configs/sort.ts
1191
+ function sortPackageJson() {
1192
+ return [
1193
+ {
1194
+ files: ["**/package.json"],
1195
+ name: "jsse:sort-package-json",
1196
+ rules: {
1197
+ "jsonc/sort-array-values": [
1198
+ "error",
1199
+ {
1200
+ order: { type: "asc" },
1201
+ pathPattern: "^files$"
1202
+ }
1203
+ ],
1204
+ "jsonc/sort-keys": [
1205
+ "error",
1206
+ {
1207
+ order: [
1208
+ "publisher",
1209
+ "name",
1210
+ "displayName",
1211
+ "type",
1212
+ "version",
1213
+ "private",
1214
+ "packageManager",
1215
+ "description",
1216
+ "author",
1217
+ "license",
1218
+ "funding",
1219
+ "homepage",
1220
+ "repository",
1221
+ "bugs",
1222
+ "keywords",
1223
+ "categories",
1224
+ "sideEffects",
1225
+ "exports",
1226
+ "main",
1227
+ "module",
1228
+ "unpkg",
1229
+ "jsdelivr",
1230
+ "types",
1231
+ "typesVersions",
1232
+ "bin",
1233
+ "icon",
1234
+ "files",
1235
+ "engines",
1236
+ "activationEvents",
1237
+ "contributes",
1238
+ "scripts",
1239
+ "peerDependencies",
1240
+ "peerDependenciesMeta",
1241
+ "dependencies",
1242
+ "optionalDependencies",
1243
+ "devDependencies",
1244
+ "pnpm",
1245
+ "overrides",
1246
+ "resolutions",
1247
+ "husky",
1248
+ "simple-git-hooks",
1249
+ "lint-staged",
1250
+ "eslintConfig"
1251
+ ],
1252
+ pathPattern: "^$"
1253
+ },
1254
+ {
1255
+ order: { type: "asc" },
1256
+ pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies$"
1257
+ },
1258
+ {
1259
+ order: { type: "asc" },
1260
+ pathPattern: "^resolutions$"
1261
+ },
1262
+ {
1263
+ order: { type: "asc" },
1264
+ pathPattern: "^pnpm.overrides$"
1265
+ },
1266
+ {
1267
+ order: ["types", "import", "require", "default"],
1268
+ pathPattern: "^exports.*$"
1269
+ }
1270
+ ]
1271
+ }
1272
+ }
1273
+ ];
1274
+ }
1275
+ function sortTsconfig() {
1276
+ return [
1277
+ {
1278
+ files: ["**/tsconfig.json", "**/tsconfig.*.json"],
1279
+ name: "antfu:sort-tsconfig",
1280
+ rules: {
1281
+ "jsonc/sort-keys": [
1282
+ "error",
1283
+ {
1284
+ order: ["extends", "compilerOptions", "references", "files", "include", "exclude"],
1285
+ pathPattern: "^$"
1286
+ },
1287
+ {
1288
+ order: [
1289
+ /* Projects */
1290
+ "incremental",
1291
+ "composite",
1292
+ "tsBuildInfoFile",
1293
+ "disableSourceOfProjectReferenceRedirect",
1294
+ "disableSolutionSearching",
1295
+ "disableReferencedProjectLoad",
1296
+ /* Language and Environment */
1297
+ "target",
1298
+ "jsx",
1299
+ "jsxFactory",
1300
+ "jsxFragmentFactory",
1301
+ "jsxImportSource",
1302
+ "lib",
1303
+ "moduleDetection",
1304
+ "noLib",
1305
+ "reactNamespace",
1306
+ "useDefineForClassFields",
1307
+ "emitDecoratorMetadata",
1308
+ "experimentalDecorators",
1309
+ /* Modules */
1310
+ "baseUrl",
1311
+ "rootDir",
1312
+ "rootDirs",
1313
+ "customConditions",
1314
+ "module",
1315
+ "moduleResolution",
1316
+ "moduleSuffixes",
1317
+ "noResolve",
1318
+ "paths",
1319
+ "resolveJsonModule",
1320
+ "resolvePackageJsonExports",
1321
+ "resolvePackageJsonImports",
1322
+ "typeRoots",
1323
+ "types",
1324
+ "allowArbitraryExtensions",
1325
+ "allowImportingTsExtensions",
1326
+ "allowUmdGlobalAccess",
1327
+ /* JavaScript Support */
1328
+ "allowJs",
1329
+ "checkJs",
1330
+ "maxNodeModuleJsDepth",
1331
+ /* Type Checking */
1332
+ "strict",
1333
+ "strictBindCallApply",
1334
+ "strictFunctionTypes",
1335
+ "strictNullChecks",
1336
+ "strictPropertyInitialization",
1337
+ "allowUnreachableCode",
1338
+ "allowUnusedLabels",
1339
+ "alwaysStrict",
1340
+ "exactOptionalPropertyTypes",
1341
+ "noFallthroughCasesInSwitch",
1342
+ "noImplicitAny",
1343
+ "noImplicitOverride",
1344
+ "noImplicitReturns",
1345
+ "noImplicitThis",
1346
+ "noPropertyAccessFromIndexSignature",
1347
+ "noUncheckedIndexedAccess",
1348
+ "noUnusedLocals",
1349
+ "noUnusedParameters",
1350
+ "useUnknownInCatchVariables",
1351
+ /* Emit */
1352
+ "declaration",
1353
+ "declarationDir",
1354
+ "declarationMap",
1355
+ "downlevelIteration",
1356
+ "emitBOM",
1357
+ "emitDeclarationOnly",
1358
+ "importHelpers",
1359
+ "importsNotUsedAsValues",
1360
+ "inlineSourceMap",
1361
+ "inlineSources",
1362
+ "mapRoot",
1363
+ "newLine",
1364
+ "noEmit",
1365
+ "noEmitHelpers",
1366
+ "noEmitOnError",
1367
+ "outDir",
1368
+ "outFile",
1369
+ "preserveConstEnums",
1370
+ "preserveValueImports",
1371
+ "removeComments",
1372
+ "sourceMap",
1373
+ "sourceRoot",
1374
+ "stripInternal",
1375
+ /* Interop Constraints */
1376
+ "allowSyntheticDefaultImports",
1377
+ "esModuleInterop",
1378
+ "forceConsistentCasingInFileNames",
1379
+ "isolatedModules",
1380
+ "preserveSymlinks",
1381
+ "verbatimModuleSyntax",
1382
+ /* Completeness */
1383
+ "skipDefaultLibCheck",
1384
+ "skipLibCheck"
1385
+ ],
1386
+ pathPattern: "^compilerOptions$"
1387
+ }
1388
+ ]
1389
+ }
1390
+ }
1391
+ ];
1392
+ }
1393
+
1394
+ // src/utils.ts
1395
+ var import_node_process2 = __toESM(require("process"), 1);
1396
+ function combine(...configs) {
1397
+ return configs.flatMap((config) => Array.isArray(config) ? config : [config]);
1398
+ }
1399
+ function renameRules(rules, from, to) {
1400
+ if (from === to) {
1401
+ return rules;
1402
+ }
1403
+ return Object.fromEntries(
1404
+ Object.entries(rules).map(([key, value]) => {
1405
+ if (key.startsWith(from)) {
1406
+ return [to + key.slice(from.length), value];
1407
+ }
1408
+ return [key, value];
1409
+ })
1410
+ );
1411
+ }
1412
+ function isCI() {
1413
+ return !!import_node_process2.default.env.CI;
1414
+ }
1415
+ function isInEditor() {
1416
+ return !!((import_node_process2.default.env.VSCODE_PID || import_node_process2.default.env.JETBRAINS_IDE) && !isCI());
1417
+ }
1418
+
1419
+ // src/configs/test.ts
1420
+ function test(options = {}) {
1421
+ const { isInEditor: isInEditor2 = false, overrides = {} } = options;
1422
+ return [
1423
+ {
1424
+ name: "jsse:test:setup",
1425
+ plugins: {
1426
+ test: {
1427
+ ...import_eslint_plugin_vitest.default,
1428
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
1429
+ rules: {
1430
+ ...import_eslint_plugin_vitest.default.rules,
1431
+ // extend `test/no-only-tests` rule
1432
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
1433
+ ...import_eslint_plugin_no_only_tests.default.rules
1434
+ }
1435
+ }
1436
+ }
1437
+ },
1438
+ {
1439
+ files: GLOB_TESTS,
1440
+ name: "jsse:test:rules",
1441
+ rules: {
1442
+ "test/consistent-test-it": ["error", { fn: "it", withinDescribe: "it" }],
1443
+ "test/no-identical-title": "error",
1444
+ "test/no-only-tests": isInEditor2 ? "off" : isCI() ? "error" : "warn",
1445
+ "test/prefer-hooks-in-order": "error",
1446
+ "test/prefer-lowercase-title": "error",
1447
+ "unicorn/no-null": "off",
1448
+ ...overrides
1449
+ }
1450
+ }
1451
+ ];
1452
+ }
1453
+
1454
+ // src/configs/ts/typescript-rules.ts
1455
+ function typescriptRulesTypeAware() {
1456
+ return {
1457
+ "@typescript-eslint/await-thenable": "error",
1458
+ "@typescript-eslint/no-for-in-array": "error",
1459
+ "no-implied-eval": "off",
1460
+ "@typescript-eslint/consistent-type-exports": [
1461
+ "error",
1462
+ {
1463
+ fixMixedExportsWithInlineTypeSpecifier: true
1464
+ }
1465
+ ],
1466
+ "dot-notation": "off",
1467
+ "@typescript-eslint/dot-notation": [
1468
+ "error",
1469
+ {
1470
+ allowPattern: "^_",
1471
+ allowKeywords: true
1472
+ }
1473
+ ],
1474
+ "@typescript-eslint/no-implied-eval": "error",
1475
+ "@typescript-eslint/no-misused-promises": "error",
1476
+ "@typescript-eslint/no-unnecessary-qualifier": "error",
1477
+ "@typescript-eslint/no-unnecessary-type-arguments": "off",
1478
+ "@typescript-eslint/no-unnecessary-type-assertion": "error",
1479
+ "no-throw-literal": "off",
1480
+ "@typescript-eslint/no-throw-literal": "error",
1481
+ "@typescript-eslint/no-unsafe-argument": "error",
1482
+ "@typescript-eslint/no-unsafe-assignment": "error",
1483
+ "@typescript-eslint/no-unsafe-call": "error",
1484
+ "@typescript-eslint/no-unsafe-member-access": "error",
1485
+ "@typescript-eslint/no-unsafe-return": "error",
1486
+ "@typescript-eslint/restrict-plus-operands": "error",
1487
+ "@typescript-eslint/restrict-template-expressions": "error",
1488
+ "@typescript-eslint/unbound-method": "error",
1489
+ "@typescript-eslint/naming-convention": [
1490
+ "error",
1491
+ {
1492
+ selector: ["variable"],
1493
+ modifiers: ["global"],
1494
+ format: ["camelCase", "snake_case", "UPPER_CASE", "PascalCase"],
1495
+ leadingUnderscore: "allowSingleOrDouble",
1496
+ trailingUnderscore: "allow",
1497
+ filter: {
1498
+ regex: "[- ]",
1499
+ match: false
1500
+ }
1501
+ },
1502
+ {
1503
+ selector: [
1504
+ "classProperty",
1505
+ "objectLiteralProperty",
1506
+ "typeProperty",
1507
+ "classMethod",
1508
+ "objectLiteralMethod",
1509
+ "typeMethod",
1510
+ "accessor",
1511
+ "enumMember"
1512
+ ],
1513
+ format: null,
1514
+ modifiers: ["requiresQuotes"]
1515
+ },
1516
+ {
1517
+ selector: [
1518
+ "variable",
1519
+ "function",
1520
+ "classProperty",
1521
+ "objectLiteralProperty",
1522
+ "parameterProperty",
1523
+ "classMethod",
1524
+ "objectLiteralMethod",
1525
+ "typeMethod",
1526
+ "accessor"
1527
+ ],
1528
+ format: ["camelCase", "snake_case", "PascalCase"],
1529
+ leadingUnderscore: "allowSingleOrDouble",
1530
+ trailingUnderscore: "allow",
1531
+ filter: {
1532
+ // also allow when '/' is in object key
1533
+ regex: "^[0-9]|[- ]|[/]",
1534
+ match: false
1535
+ }
1536
+ },
1537
+ {
1538
+ selector: "typeLike",
1539
+ format: ["PascalCase"]
1540
+ },
1541
+ {
1542
+ selector: "variable",
1543
+ types: ["boolean"],
1544
+ format: ["PascalCase", "camelCase"],
1545
+ prefix: ["is", "has", "can", "should", "will", "did"]
1546
+ },
1547
+ {
1548
+ selector: "interface",
1549
+ format: ["PascalCase"]
1550
+ },
1551
+ {
1552
+ selector: "typeParameter",
1553
+ filter: "^T$|^[A-Z][a-zA-Z]+$",
1554
+ format: ["PascalCase"]
1555
+ }
1556
+ ],
1557
+ "@typescript-eslint/no-floating-promises": [
1558
+ "error",
1559
+ {
1560
+ ignoreVoid: true,
1561
+ ignoreIIFE: true
1562
+ }
1563
+ ]
1564
+ };
1565
+ }
1566
+ function typescriptRulesTypeOblivious() {
1567
+ return {
1568
+ eqeqeq: "error",
1569
+ camelcase: "off",
1570
+ yoda: "error",
1571
+ "arrow-parens": "off",
1572
+ "no-console": [
1573
+ "warn",
1574
+ {
1575
+ allow: [
1576
+ "log",
1577
+ "warn",
1578
+ "dir",
1579
+ "time",
1580
+ "timeEnd",
1581
+ "timeLog",
1582
+ "trace",
1583
+ "assert",
1584
+ "clear",
1585
+ "count",
1586
+ "countReset",
1587
+ "group",
1588
+ "groupEnd",
1589
+ "table",
1590
+ "debug",
1591
+ "info",
1592
+ "dirxml",
1593
+ "error",
1594
+ "groupCollapsed",
1595
+ "Console",
1596
+ "profile",
1597
+ "profileEnd",
1598
+ "timeStamp",
1599
+ "context"
1600
+ ]
1601
+ }
1602
+ ],
1603
+ "object-curly-spacing": "off",
1604
+ "@typescript-eslint/object-curly-spacing": "off",
1605
+ "@typescript-eslint/no-inferrable-types": "off",
1606
+ "@typescript-eslint/prefer-ts-expect-error": "error",
1607
+ "@typescript-eslint/consistent-type-imports": [
1608
+ "error",
1609
+ {
1610
+ prefer: "type-imports",
1611
+ fixStyle: "separate-type-imports"
1612
+ }
1613
+ ],
1614
+ "@typescript-eslint/adjacent-overload-signatures": "error",
1615
+ "@typescript-eslint/ban-types": [
1616
+ "warn",
1617
+ {
1618
+ extendDefaults: false,
1619
+ types: {
1620
+ String: {
1621
+ message: 'Use "string" instead',
1622
+ fixWith: "string"
1623
+ },
1624
+ Boolean: {
1625
+ message: 'Use "boolean" instead',
1626
+ fixWith: "boolean"
1627
+ },
1628
+ Number: {
1629
+ message: 'Use "number" instead',
1630
+ fixWith: "number"
1631
+ },
1632
+ BigInt: {
1633
+ message: "Use `bigint` instead.",
1634
+ fixWith: "bigint"
1635
+ },
1636
+ Object: {
1637
+ message: "The `Object` type is mostly the same as `unknown`. You probably want `Record<string, unknown>` instead. See https://github.com/typescript-eslint/typescript-eslint/pull/848",
1638
+ fixWith: "Record<string, unknown>"
1639
+ },
1640
+ object: {
1641
+ message: "The `object` type is hard to use. Use `Record<string, unknown>` instead. See: https://github.com/typescript-eslint/typescript-eslint/pull/848",
1642
+ fixWith: "Record<string, unknown>"
1643
+ },
1644
+ Symbol: {
1645
+ message: 'Use "symbol" instead',
1646
+ fixWith: "symbol"
1647
+ },
1648
+ Function: {
1649
+ message: 'The "Function" type accepts any function-like value.\nIt provides no type safety when calling the function, which can be a common source of bugs.\nIt also accepts things like class declarations, which will throw at runtime as they will not be called with "new".\nIf you are expecting the function to accept certain arguments, you should explicitly define the function shape.'
1650
+ },
1651
+ // eslint-disable-next-line @typescript-eslint/naming-convention
1652
+ "{}": {
1653
+ message: "The `{}` type is mostly the same as `unknown`. You probably want `Record<string, unknown>` instead.",
1654
+ fixWith: "Record<string, unknown>"
1655
+ },
1656
+ // eslint-disable-next-line @typescript-eslint/naming-convention
1657
+ "[]": "Don't use the empty array type `[]`. It only allows empty arrays. Use `SomeType[]` instead.",
1658
+ // eslint-disable-next-line @typescript-eslint/naming-convention
1659
+ "[[]]": "Don't use `[[]]`. It only allows an array with a single element which is an empty array. Use `SomeType[][]` instead.",
1660
+ // eslint-disable-next-line @typescript-eslint/naming-convention
1661
+ "[[[]]]": "Don't use `[[[]]]`. Use `SomeType[][][]` instead."
1662
+ }
1663
+ }
1664
+ ],
1665
+ "@typescript-eslint/consistent-type-assertions": "error",
1666
+ "@typescript-eslint/consistent-type-definitions": ["error", "type"],
1667
+ "@typescript-eslint/member-ordering": [
1668
+ "warn",
1669
+ {
1670
+ default: "never",
1671
+ classes: ["field", "constructor", "method"]
1672
+ }
1673
+ ],
1674
+ "no-array-constructor": "off",
1675
+ "@typescript-eslint/no-array-constructor": "error",
1676
+ "@typescript-eslint/no-explicit-any": "error",
1677
+ "@typescript-eslint/no-misused-new": "error",
1678
+ "@typescript-eslint/no-namespace": [
1679
+ "error",
1680
+ {
1681
+ allowDeclarations: false,
1682
+ allowDefinitionFiles: false
1683
+ }
1684
+ ],
1685
+ "no-unused-vars": "off",
1686
+ "@typescript-eslint/no-unused-vars": [
1687
+ "warn",
1688
+ {
1689
+ vars: "all",
1690
+ args: "none",
1691
+ argsIgnorePattern: "^_",
1692
+ varsIgnorePattern: "^_",
1693
+ caughtErrorsIgnorePattern: "^_"
1694
+ }
1695
+ ],
1696
+ "no-use-before-define": "off",
1697
+ "@typescript-eslint/no-use-before-define": [
1698
+ "error",
1699
+ {
1700
+ functions: false,
1701
+ classes: true,
1702
+ variables: true,
1703
+ enums: true,
1704
+ typedefs: true
1705
+ }
1706
+ ],
1707
+ "@typescript-eslint/prefer-namespace-keyword": "warn",
1708
+ "@typescript-eslint/typedef": [
1709
+ "warn",
1710
+ {
1711
+ arrayDestructuring: false,
1712
+ arrowParameter: false,
1713
+ memberVariableDeclaration: true,
1714
+ objectDestructuring: false,
1715
+ parameter: true,
1716
+ propertyDeclaration: true,
1717
+ variableDeclaration: false,
1718
+ variableDeclarationIgnoreFunction: true
1719
+ }
1720
+ ],
1721
+ "accessor-pairs": "error",
1722
+ "for-direction": "warn",
1723
+ "guard-for-in": "error",
1724
+ "max-lines": [
1725
+ "warn",
1726
+ {
1727
+ max: 2e3
1728
+ }
1729
+ ],
1730
+ "no-async-promise-executor": "error",
1731
+ "no-bitwise": [
1732
+ "warn",
1733
+ {
1734
+ allow: ["^", "<<", ">>", ">>>", "^=", "<<=", ">>=", ">>>=", "~"]
1735
+ }
1736
+ ],
1737
+ "no-caller": "error",
1738
+ "no-compare-neg-zero": "error",
1739
+ "no-cond-assign": "error",
1740
+ "no-constant-condition": "warn",
1741
+ "no-control-regex": "error",
1742
+ "no-debugger": "warn",
1743
+ "no-delete-var": "error",
1744
+ "no-duplicate-case": "error",
1745
+ "no-empty": "warn",
1746
+ "no-empty-character-class": "error",
1747
+ "no-empty-pattern": "warn",
1748
+ "no-eval": "warn",
1749
+ "no-ex-assign": "error",
1750
+ "no-extend-native": "error",
1751
+ "no-extra-boolean-cast": "warn",
1752
+ "no-extra-label": "warn",
1753
+ "no-fallthrough": "error",
1754
+ "no-func-assign": "warn",
1755
+ "no-implied-eval": "error",
1756
+ "no-invalid-regexp": "error",
1757
+ "no-label-var": "error",
1758
+ "no-lone-blocks": "warn",
1759
+ "no-misleading-character-class": "error",
1760
+ "no-multi-str": "error",
1761
+ "no-new": "warn",
1762
+ "no-new-func": "error",
1763
+ "no-new-wrappers": "warn",
1764
+ "no-octal": "error",
1765
+ "no-octal-escape": "error",
1766
+ "no-regex-spaces": "error",
1767
+ "no-return-assign": "error",
1768
+ "no-script-url": "warn",
1769
+ "no-self-assign": "error",
1770
+ "no-self-compare": "error",
1771
+ "no-sequences": "error",
1772
+ "no-shadow-restricted-names": "error",
1773
+ "no-sparse-arrays": "error",
1774
+ "no-unmodified-loop-condition": "warn",
1775
+ "no-unsafe-finally": "error",
1776
+ "no-unused-expressions": "off",
1777
+ "@typescript-eslint/no-unused-expressions": "error",
1778
+ "no-unused-labels": "error",
1779
+ "no-useless-catch": "warn",
1780
+ "no-useless-concat": "error",
1781
+ "no-var": "error",
1782
+ "no-void": [
1783
+ "error",
1784
+ {
1785
+ allowAsStatement: true
1786
+ }
1787
+ ],
1788
+ "no-with": "error",
1789
+ "prefer-const": "error",
1790
+ "require-atomic-updates": "error",
1791
+ "require-yield": "warn",
1792
+ strict: ["error", "never"],
1793
+ "use-isnan": "error",
1794
+ "no-useless-constructor": "off",
1795
+ "@typescript-eslint/no-useless-constructor": "error",
1796
+ "@typescript-eslint/no-unnecessary-type-constraint": "error",
1797
+ "@typescript-eslint/brace-style": [
1798
+ "error",
1799
+ "1tbs",
1800
+ {
1801
+ allowSingleLine: false
1802
+ }
1803
+ ],
1804
+ "comma-spacing": "off",
1805
+ "@typescript-eslint/comma-spacing": [
1806
+ "error",
1807
+ {
1808
+ before: false,
1809
+ after: true
1810
+ }
1811
+ ],
1812
+ "default-param-last": "off",
1813
+ "@typescript-eslint/default-param-last": "error",
1814
+ "func-call-spacing": "off",
1815
+ "@typescript-eslint/func-call-spacing": ["error", "never"],
1816
+ "keyword-spacing": "off",
1817
+ "@typescript-eslint/keyword-spacing": "error",
1818
+ "lines-between-class-members": "off",
1819
+ "@typescript-eslint/lines-between-class-members": [
1820
+ "error",
1821
+ "always",
1822
+ {
1823
+ exceptAfterSingleLine: true
1824
+ }
1825
+ ],
1826
+ "no-dupe-class-members": "off",
1827
+ "@typescript-eslint/no-dupe-class-members": "error",
1828
+ "no-empty-function": "off",
1829
+ "@typescript-eslint/no-empty-function": "error",
1830
+ "no-extra-parens": "off",
1831
+ "no-extra-semi": "off",
1832
+ "@typescript-eslint/no-extra-semi": "error",
1833
+ "no-loop-func": "off",
1834
+ "@typescript-eslint/no-loop-func": "error",
1835
+ "no-loss-of-precision": "off",
1836
+ "@typescript-eslint/no-loss-of-precision": "error",
1837
+ "no-redeclare": "off",
1838
+ "@typescript-eslint/no-redeclare": "error",
1839
+ "no-restricted-imports": "off",
1840
+ "@typescript-eslint/no-restricted-imports": [
1841
+ "error",
1842
+ {
1843
+ paths: ["error", "domain", "freelist", "smalloc", "punycode", "sys", "querystring", "colors"]
1844
+ }
1845
+ ],
1846
+ "padding-line-between-statements": "off",
1847
+ "@typescript-eslint/padding-line-between-statements": "off",
1848
+ quotes: "off",
1849
+ "@typescript-eslint/quotes": "off",
1850
+ "space-before-function-paren": "off",
1851
+ "@typescript-eslint/space-before-function-paren": "off",
1852
+ "space-infix-ops": "off",
1853
+ "@typescript-eslint/space-infix-ops": "error",
1854
+ semi: "off",
1855
+ "@typescript-eslint/semi": ["error", "always"],
1856
+ "space-before-blocks": "off",
1857
+ "@typescript-eslint/space-before-blocks": ["error", "always"],
1858
+ "no-undef": "off",
1859
+ "no-duplicate-imports": "off"
1860
+ };
1861
+ }
1862
+ function typescriptRules({ typeAware }) {
1863
+ return {
1864
+ ...typescriptRulesTypeOblivious(),
1865
+ ...typeAware ? typescriptRulesTypeAware() : {}
1866
+ };
1867
+ }
1868
+
1869
+ // src/configs/ts/typescript.ts
1870
+ function typescript(options) {
1871
+ const { componentExts = [], overrides = {}, parserOptions = {}, tsconfigPath, react: react2, prefix } = options ?? {};
1872
+ const tsPrefix = prefix?.from ?? "@typescript-eslint";
1873
+ const tsPrefixTo = prefix?.to ?? "ts";
1874
+ const tsrules = {
1875
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1876
+ ...import_eslint_plugin2.default.configs["eslint-recommended"].overrides[0].rules,
1877
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1878
+ ...import_eslint_plugin2.default.configs.strict.rules,
1879
+ "no-invalid-this": "off",
1880
+ ...typescriptRules(tsconfigPath ? { typeAware: true } : { typeAware: false }),
1881
+ ...overrides
1882
+ };
1883
+ return [
1884
+ {
1885
+ // Install the plugins without globs, so they can be configured separately.
1886
+ name: "jsse:typescript:setup",
1887
+ plugins: {
1888
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
1889
+ import: pluginImport,
1890
+ [tsPrefixTo]: import_eslint_plugin2.default
1891
+ }
1892
+ },
1893
+ {
1894
+ name: "jsse:typescript:parser",
1895
+ // use ts parser for js files as well!
1896
+ files: [GLOB_SRC, ...componentExts.map((ext) => `**/*.${ext}`)],
1897
+ languageOptions: typescriptLanguageOptions({
1898
+ parserOptions,
1899
+ react: react2,
1900
+ tsconfigPath
1901
+ })
1902
+ },
1903
+ {
1904
+ name: "jsse:typescript:rules",
1905
+ // only apply ts rules to ts files!
1906
+ files: [GLOB_TS, GLOB_TSX, ...componentExts.map((ext) => `**/*.${ext}`)],
1907
+ rules: renameRules(tsrules, tsPrefix, tsPrefixTo)
1908
+ },
1909
+ {
1910
+ files: ["**/*.d.ts"],
1911
+ name: "jsse:typescript:dts-overrides",
1912
+ rules: {
1913
+ "eslint-comments/no-unlimited-disable": "off",
1914
+ "import/no-duplicates": "off",
1915
+ "no-restricted-syntax": ["error", "[declare=true]"],
1916
+ "unused-imports/no-unused-vars": "off"
1917
+ }
1918
+ },
1919
+ {
1920
+ files: ["**/*.{test,spec}.ts?(x)"],
1921
+ name: "jsse:typescript:tests-overrides",
1922
+ rules: {
1923
+ "no-unused-expressions": "off"
1924
+ }
1925
+ },
1926
+ {
1927
+ files: ["**/*.js", "**/*.cjs"],
1928
+ name: "jsse:typescript:javascript-overrides",
1929
+ rules: {
1930
+ "@typescript-eslint/no-require-imports": "off",
1931
+ "@typescript-eslint/no-var-requires": "off"
1932
+ }
1933
+ }
1934
+ ];
1935
+ }
1936
+
1937
+ // src/configs/unicorn.ts
1938
+ function unicornOff() {
1939
+ return {
1940
+ "unicorn/catch-error-name": "off",
1941
+ "unicorn/consistent-destructuring": "off",
1942
+ "unicorn/no-array-for-each": "off",
1943
+ "unicorn/no-array-reduce": "off",
1944
+ "unicorn/no-nested-ternary": "off",
1945
+ // conflicts with prettier
1946
+ "unicorn/no-process-exit": "off",
1947
+ "unicorn/prefer-module": "off",
1948
+ "unicorn/prefer-optional-catch-binding": "off",
1949
+ "unicorn/prefer-top-level-await": "off",
1950
+ "unicorn/prevent-abbreviations": "off"
1951
+ // Super insanely annoying rule
1952
+ };
1953
+ }
1954
+ function unicorn() {
1955
+ return [
1956
+ {
1957
+ name: "jsse:unicorn",
1958
+ plugins: {
1959
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
1960
+ unicorn: import_eslint_plugin_unicorn.default
1961
+ },
1962
+ rules: {
1963
+ ...unicornOff(),
1964
+ "unicorn/better-regex": "error",
1965
+ "unicorn/custom-error-definition": "error",
1966
+ // Pass error message when throwing errors
1967
+ "unicorn/error-message": "error",
1968
+ // Uppercase regex escapes
1969
+ "unicorn/escape-case": "error",
1970
+ "unicorn/explicit-length-check": "error",
1971
+ "unicorn/filename-case": "error",
1972
+ "unicorn/new-for-builtins": "error",
1973
+ "unicorn/no-array-callback-reference": "error",
1974
+ "unicorn/no-array-method-this-argument": "error",
1975
+ "unicorn/no-array-push-push": "error",
1976
+ "unicorn/no-console-spaces": "error",
1977
+ "unicorn/no-for-loop": "error",
1978
+ "unicorn/no-hex-escape": "error",
1979
+ // Array.isArray instead of instanceof
1980
+ "unicorn/no-instanceof-array": "error",
1981
+ "unicorn/no-invalid-remove-event-listener": "error",
1982
+ "unicorn/no-lonely-if": "error",
1983
+ // conflicts with prettier
1984
+ // Ban `new Array` as `Array` constructor's params are ambiguous
1985
+ "unicorn/no-new-array": "error",
1986
+ // Prevent deprecated `new Buffer()`
1987
+ "unicorn/no-new-buffer": "error",
1988
+ "unicorn/no-static-only-class": "error",
1989
+ "unicorn/no-unnecessary-await": "error",
1990
+ // Keep regex literals safe!
1991
+ "unicorn/no-unsafe-regex": "error",
1992
+ "unicorn/no-zero-fractions": `error`,
1993
+ // Lowercase number formatting for octal, hex, binary (0x1ERROR instead of 0X1'error')
1994
+ "unicorn/number-literal-case": "error",
1995
+ "unicorn/prefer-add-event-listener": "error",
1996
+ "unicorn/prefer-array-find": "error",
1997
+ "unicorn/prefer-array-flat-map": "error",
1998
+ "unicorn/prefer-array-index-of": "error",
1999
+ "unicorn/prefer-array-some": "error",
2000
+ "unicorn/prefer-at": "error",
2001
+ "unicorn/prefer-blob-reading-methods": "error",
2002
+ "unicorn/prefer-date-now": "error",
2003
+ "unicorn/prefer-dom-node-append": "error",
2004
+ "unicorn/prefer-dom-node-dataset": "error",
2005
+ "unicorn/prefer-dom-node-remove": "error",
2006
+ // textContent instead of innerText
2007
+ "unicorn/prefer-dom-node-text-content": "error",
2008
+ // includes over indexOf when checking for existence
2009
+ "unicorn/prefer-includes": "error",
2010
+ "unicorn/prefer-keyboard-event-key": "error",
2011
+ "unicorn/prefer-math-trunc": "error",
2012
+ "unicorn/prefer-modern-dom-apis": "error",
2013
+ "unicorn/prefer-modern-math-apis": "error",
2014
+ "unicorn/prefer-negative-index": "error",
2015
+ // Prefer using the node: protocol
2016
+ "unicorn/prefer-node-protocol": "error",
2017
+ // Prefer using number properties like `Number.isNaN` rather than `isNaN`
2018
+ "unicorn/prefer-number-properties": "error",
2019
+ "unicorn/prefer-prototype-methods": "error",
2020
+ "unicorn/prefer-query-selector": "error",
2021
+ "unicorn/prefer-reflect-apply": "error",
2022
+ "unicorn/prefer-regexp-test": "error",
2023
+ "unicorn/prefer-string-replace-all": "error",
2024
+ "unicorn/prefer-string-slice": "error",
2025
+ // String methods startsWith/endsWith instead of more complicated stuff
2026
+ "unicorn/prefer-string-starts-ends-with": "error",
2027
+ "unicorn/prefer-string-trim-start-end": "error",
2028
+ // Enforce throwing type error when throwing error while checking typeof
2029
+ "unicorn/prefer-type-error": "error",
2030
+ // Use new when throwing error
2031
+ "unicorn/throw-new-error": "error"
2032
+ }
2033
+ }
2034
+ ];
2035
+ }
2036
+
2037
+ // src/factory.ts
2038
+ var import_node_fs = __toESM(require("fs"), 1);
2039
+ var import_eslint_config_flat_gitignore = __toESM(require("eslint-config-flat-gitignore"), 1);
2040
+ var import_local_pkg = require("local-pkg");
2041
+
2042
+ // src/configs/tailwind.ts
2043
+ function tailwind() {
2044
+ return [
2045
+ {
2046
+ name: "jsse:tailwind",
2047
+ plugins: {
2048
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
2049
+ tailwindcss: import_eslint_plugin_tailwindcss.default
2050
+ },
2051
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
2052
+ rules: {
2053
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
2054
+ ...import_eslint_plugin_tailwindcss.default.configs.recommended.rules
2055
+ }
2056
+ }
2057
+ ];
2058
+ }
2059
+
2060
+ // src/factory.ts
2061
+ var flatConfigProps = [
2062
+ "files",
2063
+ "ignores",
2064
+ "languageOptions",
2065
+ "linterOptions",
2066
+ "processor",
2067
+ "plugins",
2068
+ "rules",
2069
+ "settings"
2070
+ ];
2071
+ function defaultOptions() {
2072
+ return {
2073
+ gitignore: import_eslint_config_flat_gitignore.default,
2074
+ isInEditor: isInEditor(),
2075
+ jsonc: true,
2076
+ off: [],
2077
+ reportUnusedDisableDirectives: true,
2078
+ stylistic: true,
2079
+ test: true,
2080
+ tsPrefix: "@typescript-eslint",
2081
+ typescript: (0, import_local_pkg.isPackageExists)("typescript")
2082
+ };
2083
+ }
2084
+ function opts(options = {}) {
2085
+ return {
2086
+ ...defaultOptions(),
2087
+ ...options
2088
+ };
2089
+ }
2090
+ function jsse(options = {}, ...userConfigs) {
2091
+ const {
2092
+ isInEditor: isInEditor2,
2093
+ typescript: enableTypeScript = (0, import_local_pkg.isPackageExists)("typescript"),
2094
+ gitignore: enableGitignore = true,
2095
+ overrides = {},
2096
+ componentExts = [],
2097
+ react: enableReact = (0, import_local_pkg.isPackageExists)("react"),
2098
+ reportUnusedDisableDirectives,
2099
+ tsPrefix,
2100
+ off
2101
+ } = opts(options);
2102
+ const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
2103
+ if (stylisticOptions && !("jsx" in stylisticOptions))
2104
+ stylisticOptions.jsx = options.jsx ?? true;
2105
+ const configs = [];
2106
+ if (enableGitignore && import_node_fs.default.existsSync(".gitignore")) {
2107
+ configs.push([(0, import_eslint_config_flat_gitignore.default)()]);
2108
+ }
2109
+ configs.push(
2110
+ ignores(),
2111
+ javascript({
2112
+ isInEditor: isInEditor2,
2113
+ overrides: overrides.javascript,
2114
+ reportUnusedDisableDirectives
2115
+ }),
2116
+ comments(),
2117
+ node(),
2118
+ jsdoc({
2119
+ stylistic: stylisticOptions
2120
+ }),
2121
+ imports({
2122
+ stylistic: stylisticOptions
2123
+ }),
2124
+ unicorn()
2125
+ );
2126
+ if (enableTypeScript) {
2127
+ configs.push(
2128
+ typescript({
2129
+ ...typeof enableTypeScript === "boolean" ? {} : enableTypeScript,
2130
+ componentExts,
2131
+ overrides: overrides.typescript,
2132
+ prefix: {
2133
+ from: "@typescript-eslint",
2134
+ to: tsPrefix
2135
+ },
2136
+ react: enableReact
2137
+ })
2138
+ );
2139
+ }
2140
+ if (options.react) {
2141
+ configs.push(
2142
+ react({
2143
+ reactRefresh: options.reactRefresh
2144
+ })
2145
+ );
2146
+ }
2147
+ if (options.test) {
2148
+ configs.push(
2149
+ test({
2150
+ isInEditor: isInEditor2,
2151
+ overrides: overrides.test
2152
+ })
2153
+ );
2154
+ }
2155
+ if (options.jsonc ?? true) {
2156
+ configs.push(
2157
+ jsonc({
2158
+ overrides: overrides.jsonc,
2159
+ stylistic: stylisticOptions
2160
+ }),
2161
+ sortPackageJson(),
2162
+ sortTsconfig()
2163
+ );
2164
+ }
2165
+ if (options.tailwind) {
2166
+ configs.push(tailwind());
2167
+ }
2168
+ const fusedConfig = flatConfigProps.reduce((acc, key) => {
2169
+ if (key in options) {
2170
+ acc[key] = options[key];
2171
+ }
2172
+ return acc;
2173
+ }, {});
2174
+ if (Object.keys(fusedConfig).length > 0) {
2175
+ configs.push([fusedConfig]);
2176
+ }
2177
+ if (off.length > 0) {
2178
+ configs.push(
2179
+ off.map((rule) => ({
2180
+ files: ["**/*.{js,jsx,ts,tsx}"],
2181
+ rules: {
2182
+ [rule]: "off"
2183
+ }
2184
+ }))
2185
+ );
2186
+ }
2187
+ return combine(...configs, ...userConfigs);
2188
+ }
2189
+ // Annotate the CommonJS export names for ESM import in node:
2190
+ 0 && (module.exports = {
2191
+ GLOB_ALL_SRC,
2192
+ GLOB_CSS,
2193
+ GLOB_EXCLUDE,
2194
+ GLOB_HTML,
2195
+ GLOB_JS,
2196
+ GLOB_JSON,
2197
+ GLOB_JSON5,
2198
+ GLOB_JSONC,
2199
+ GLOB_JSX,
2200
+ GLOB_LESS,
2201
+ GLOB_MARKDOWN,
2202
+ GLOB_MARKDOWN_CODE,
2203
+ GLOB_SCSS,
2204
+ GLOB_SRC,
2205
+ GLOB_SRC_EXT,
2206
+ GLOB_STYLE,
2207
+ GLOB_TESTS,
2208
+ GLOB_TS,
2209
+ GLOB_TSX,
2210
+ GLOB_YAML,
2211
+ combine,
2212
+ comments,
2213
+ ignores,
2214
+ imports,
2215
+ isCI,
2216
+ isInEditor,
2217
+ javascript,
2218
+ jsdoc,
2219
+ jsonc,
2220
+ jsse,
2221
+ node,
2222
+ parserJsonc,
2223
+ parserTs,
2224
+ pluginEslintComments,
2225
+ pluginImport,
2226
+ pluginJsdoc,
2227
+ pluginJsonc,
2228
+ pluginNoOnlyTests,
2229
+ pluginNode,
2230
+ pluginReact,
2231
+ pluginReactHooks,
2232
+ pluginReactRefresh,
2233
+ pluginSortKeys,
2234
+ pluginStylistic,
2235
+ pluginTailwind,
2236
+ pluginTs,
2237
+ pluginUnicorn,
2238
+ pluginUnusedImports,
2239
+ pluginVitest,
2240
+ react,
2241
+ reactHooks,
2242
+ renameRules,
2243
+ sortPackageJson,
2244
+ sortTsconfig,
2245
+ test,
2246
+ typescript,
2247
+ unicorn
2248
+ });
2249
+ /*! Bundled license information:
2250
+
2251
+ natural-compare/index.js:
2252
+ (*
2253
+ * @version 1.4.0
2254
+ * @date 2015-10-26
2255
+ * @stability 3 - Stable
2256
+ * @author Lauri Rooden (https://github.com/litejs/natural-compare-lite)
2257
+ * @license MIT License
2258
+ *)
2259
+ */