eslint-config-un 0.0.2

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,2315 @@
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.1.0_postcss@8.4.39_typescript@5.5.3/node_modules/tsup/assets/cjs_shims.js
37
+ var init_cjs_shims = __esm({
38
+ "node_modules/.pnpm/tsup@8.1.0_postcss@8.4.39_typescript@5.5.3/node_modules/tsup/assets/cjs_shims.js"() {
39
+ "use strict";
40
+ }
41
+ });
42
+
43
+ // node_modules/.pnpm/@eslint+js@9.6.0/node_modules/@eslint/js/src/configs/eslint-all.js
44
+ var require_eslint_all = __commonJS({
45
+ "node_modules/.pnpm/@eslint+js@9.6.0/node_modules/@eslint/js/src/configs/eslint-all.js"(exports2, module2) {
46
+ "use strict";
47
+ init_cjs_shims();
48
+ module2.exports = Object.freeze({
49
+ "rules": {
50
+ "accessor-pairs": "error",
51
+ "array-callback-return": "error",
52
+ "arrow-body-style": "error",
53
+ "block-scoped-var": "error",
54
+ "camelcase": "error",
55
+ "capitalized-comments": "error",
56
+ "class-methods-use-this": "error",
57
+ "complexity": "error",
58
+ "consistent-return": "error",
59
+ "consistent-this": "error",
60
+ "constructor-super": "error",
61
+ "curly": "error",
62
+ "default-case": "error",
63
+ "default-case-last": "error",
64
+ "default-param-last": "error",
65
+ "dot-notation": "error",
66
+ "eqeqeq": "error",
67
+ "for-direction": "error",
68
+ "func-name-matching": "error",
69
+ "func-names": "error",
70
+ "func-style": "error",
71
+ "getter-return": "error",
72
+ "grouped-accessor-pairs": "error",
73
+ "guard-for-in": "error",
74
+ "id-denylist": "error",
75
+ "id-length": "error",
76
+ "id-match": "error",
77
+ "init-declarations": "error",
78
+ "logical-assignment-operators": "error",
79
+ "max-classes-per-file": "error",
80
+ "max-depth": "error",
81
+ "max-lines": "error",
82
+ "max-lines-per-function": "error",
83
+ "max-nested-callbacks": "error",
84
+ "max-params": "error",
85
+ "max-statements": "error",
86
+ "new-cap": "error",
87
+ "no-alert": "error",
88
+ "no-array-constructor": "error",
89
+ "no-async-promise-executor": "error",
90
+ "no-await-in-loop": "error",
91
+ "no-bitwise": "error",
92
+ "no-caller": "error",
93
+ "no-case-declarations": "error",
94
+ "no-class-assign": "error",
95
+ "no-compare-neg-zero": "error",
96
+ "no-cond-assign": "error",
97
+ "no-console": "error",
98
+ "no-const-assign": "error",
99
+ "no-constant-binary-expression": "error",
100
+ "no-constant-condition": "error",
101
+ "no-constructor-return": "error",
102
+ "no-continue": "error",
103
+ "no-control-regex": "error",
104
+ "no-debugger": "error",
105
+ "no-delete-var": "error",
106
+ "no-div-regex": "error",
107
+ "no-dupe-args": "error",
108
+ "no-dupe-class-members": "error",
109
+ "no-dupe-else-if": "error",
110
+ "no-dupe-keys": "error",
111
+ "no-duplicate-case": "error",
112
+ "no-duplicate-imports": "error",
113
+ "no-else-return": "error",
114
+ "no-empty": "error",
115
+ "no-empty-character-class": "error",
116
+ "no-empty-function": "error",
117
+ "no-empty-pattern": "error",
118
+ "no-empty-static-block": "error",
119
+ "no-eq-null": "error",
120
+ "no-eval": "error",
121
+ "no-ex-assign": "error",
122
+ "no-extend-native": "error",
123
+ "no-extra-bind": "error",
124
+ "no-extra-boolean-cast": "error",
125
+ "no-extra-label": "error",
126
+ "no-fallthrough": "error",
127
+ "no-func-assign": "error",
128
+ "no-global-assign": "error",
129
+ "no-implicit-coercion": "error",
130
+ "no-implicit-globals": "error",
131
+ "no-implied-eval": "error",
132
+ "no-import-assign": "error",
133
+ "no-inline-comments": "error",
134
+ "no-inner-declarations": "error",
135
+ "no-invalid-regexp": "error",
136
+ "no-invalid-this": "error",
137
+ "no-irregular-whitespace": "error",
138
+ "no-iterator": "error",
139
+ "no-label-var": "error",
140
+ "no-labels": "error",
141
+ "no-lone-blocks": "error",
142
+ "no-lonely-if": "error",
143
+ "no-loop-func": "error",
144
+ "no-loss-of-precision": "error",
145
+ "no-magic-numbers": "error",
146
+ "no-misleading-character-class": "error",
147
+ "no-multi-assign": "error",
148
+ "no-multi-str": "error",
149
+ "no-negated-condition": "error",
150
+ "no-nested-ternary": "error",
151
+ "no-new": "error",
152
+ "no-new-func": "error",
153
+ "no-new-native-nonconstructor": "error",
154
+ "no-new-wrappers": "error",
155
+ "no-nonoctal-decimal-escape": "error",
156
+ "no-obj-calls": "error",
157
+ "no-object-constructor": "error",
158
+ "no-octal": "error",
159
+ "no-octal-escape": "error",
160
+ "no-param-reassign": "error",
161
+ "no-plusplus": "error",
162
+ "no-promise-executor-return": "error",
163
+ "no-proto": "error",
164
+ "no-prototype-builtins": "error",
165
+ "no-redeclare": "error",
166
+ "no-regex-spaces": "error",
167
+ "no-restricted-exports": "error",
168
+ "no-restricted-globals": "error",
169
+ "no-restricted-imports": "error",
170
+ "no-restricted-properties": "error",
171
+ "no-restricted-syntax": "error",
172
+ "no-return-assign": "error",
173
+ "no-script-url": "error",
174
+ "no-self-assign": "error",
175
+ "no-self-compare": "error",
176
+ "no-sequences": "error",
177
+ "no-setter-return": "error",
178
+ "no-shadow": "error",
179
+ "no-shadow-restricted-names": "error",
180
+ "no-sparse-arrays": "error",
181
+ "no-template-curly-in-string": "error",
182
+ "no-ternary": "error",
183
+ "no-this-before-super": "error",
184
+ "no-throw-literal": "error",
185
+ "no-undef": "error",
186
+ "no-undef-init": "error",
187
+ "no-undefined": "error",
188
+ "no-underscore-dangle": "error",
189
+ "no-unexpected-multiline": "error",
190
+ "no-unmodified-loop-condition": "error",
191
+ "no-unneeded-ternary": "error",
192
+ "no-unreachable": "error",
193
+ "no-unreachable-loop": "error",
194
+ "no-unsafe-finally": "error",
195
+ "no-unsafe-negation": "error",
196
+ "no-unsafe-optional-chaining": "error",
197
+ "no-unused-expressions": "error",
198
+ "no-unused-labels": "error",
199
+ "no-unused-private-class-members": "error",
200
+ "no-unused-vars": "error",
201
+ "no-use-before-define": "error",
202
+ "no-useless-assignment": "error",
203
+ "no-useless-backreference": "error",
204
+ "no-useless-call": "error",
205
+ "no-useless-catch": "error",
206
+ "no-useless-computed-key": "error",
207
+ "no-useless-concat": "error",
208
+ "no-useless-constructor": "error",
209
+ "no-useless-escape": "error",
210
+ "no-useless-rename": "error",
211
+ "no-useless-return": "error",
212
+ "no-var": "error",
213
+ "no-void": "error",
214
+ "no-warning-comments": "error",
215
+ "no-with": "error",
216
+ "object-shorthand": "error",
217
+ "one-var": "error",
218
+ "operator-assignment": "error",
219
+ "prefer-arrow-callback": "error",
220
+ "prefer-const": "error",
221
+ "prefer-destructuring": "error",
222
+ "prefer-exponentiation-operator": "error",
223
+ "prefer-named-capture-group": "error",
224
+ "prefer-numeric-literals": "error",
225
+ "prefer-object-has-own": "error",
226
+ "prefer-object-spread": "error",
227
+ "prefer-promise-reject-errors": "error",
228
+ "prefer-regex-literals": "error",
229
+ "prefer-rest-params": "error",
230
+ "prefer-spread": "error",
231
+ "prefer-template": "error",
232
+ "radix": "error",
233
+ "require-atomic-updates": "error",
234
+ "require-await": "error",
235
+ "require-unicode-regexp": "error",
236
+ "require-yield": "error",
237
+ "sort-imports": "error",
238
+ "sort-keys": "error",
239
+ "sort-vars": "error",
240
+ "strict": "error",
241
+ "symbol-description": "error",
242
+ "unicode-bom": "error",
243
+ "use-isnan": "error",
244
+ "valid-typeof": "error",
245
+ "vars-on-top": "error",
246
+ "yoda": "error"
247
+ }
248
+ });
249
+ }
250
+ });
251
+
252
+ // node_modules/.pnpm/@eslint+js@9.6.0/node_modules/@eslint/js/src/configs/eslint-recommended.js
253
+ var require_eslint_recommended = __commonJS({
254
+ "node_modules/.pnpm/@eslint+js@9.6.0/node_modules/@eslint/js/src/configs/eslint-recommended.js"(exports2, module2) {
255
+ "use strict";
256
+ init_cjs_shims();
257
+ module2.exports = Object.freeze({
258
+ rules: Object.freeze({
259
+ "constructor-super": "error",
260
+ "for-direction": "error",
261
+ "getter-return": "error",
262
+ "no-async-promise-executor": "error",
263
+ "no-case-declarations": "error",
264
+ "no-class-assign": "error",
265
+ "no-compare-neg-zero": "error",
266
+ "no-cond-assign": "error",
267
+ "no-const-assign": "error",
268
+ "no-constant-binary-expression": "error",
269
+ "no-constant-condition": "error",
270
+ "no-control-regex": "error",
271
+ "no-debugger": "error",
272
+ "no-delete-var": "error",
273
+ "no-dupe-args": "error",
274
+ "no-dupe-class-members": "error",
275
+ "no-dupe-else-if": "error",
276
+ "no-dupe-keys": "error",
277
+ "no-duplicate-case": "error",
278
+ "no-empty": "error",
279
+ "no-empty-character-class": "error",
280
+ "no-empty-pattern": "error",
281
+ "no-empty-static-block": "error",
282
+ "no-ex-assign": "error",
283
+ "no-extra-boolean-cast": "error",
284
+ "no-fallthrough": "error",
285
+ "no-func-assign": "error",
286
+ "no-global-assign": "error",
287
+ "no-import-assign": "error",
288
+ "no-invalid-regexp": "error",
289
+ "no-irregular-whitespace": "error",
290
+ "no-loss-of-precision": "error",
291
+ "no-misleading-character-class": "error",
292
+ "no-new-native-nonconstructor": "error",
293
+ "no-nonoctal-decimal-escape": "error",
294
+ "no-obj-calls": "error",
295
+ "no-octal": "error",
296
+ "no-prototype-builtins": "error",
297
+ "no-redeclare": "error",
298
+ "no-regex-spaces": "error",
299
+ "no-self-assign": "error",
300
+ "no-setter-return": "error",
301
+ "no-shadow-restricted-names": "error",
302
+ "no-sparse-arrays": "error",
303
+ "no-this-before-super": "error",
304
+ "no-undef": "error",
305
+ "no-unexpected-multiline": "error",
306
+ "no-unreachable": "error",
307
+ "no-unsafe-finally": "error",
308
+ "no-unsafe-negation": "error",
309
+ "no-unsafe-optional-chaining": "error",
310
+ "no-unused-labels": "error",
311
+ "no-unused-private-class-members": "error",
312
+ "no-unused-vars": "error",
313
+ "no-useless-backreference": "error",
314
+ "no-useless-catch": "error",
315
+ "no-useless-escape": "error",
316
+ "no-with": "error",
317
+ "require-yield": "error",
318
+ "use-isnan": "error",
319
+ "valid-typeof": "error"
320
+ })
321
+ });
322
+ }
323
+ });
324
+
325
+ // node_modules/.pnpm/@eslint+js@9.6.0/node_modules/@eslint/js/src/index.js
326
+ var require_src = __commonJS({
327
+ "node_modules/.pnpm/@eslint+js@9.6.0/node_modules/@eslint/js/src/index.js"(exports2, module2) {
328
+ "use strict";
329
+ init_cjs_shims();
330
+ module2.exports = {
331
+ configs: {
332
+ all: require_eslint_all(),
333
+ recommended: require_eslint_recommended()
334
+ }
335
+ };
336
+ }
337
+ });
338
+
339
+ // src/index.ts
340
+ var src_exports = {};
341
+ __export(src_exports, {
342
+ eslintConfig: () => eslintConfig
343
+ });
344
+ module.exports = __toCommonJS(src_exports);
345
+ init_cjs_shims();
346
+ var import_eslint_plugin = __toESM(require("@stylistic/eslint-plugin"), 1);
347
+ var import_eslint_config_prettier = __toESM(require("eslint-config-prettier"), 1);
348
+ var import_eslint_plugin_disable_autofix = __toESM(require("eslint-plugin-disable-autofix"), 1);
349
+ var import_eslint_plugin_unicorn2 = __toESM(require("eslint-plugin-unicorn"), 1);
350
+ var import_globals2 = __toESM(require("globals"), 1);
351
+ var import_local_pkg = require("local-pkg");
352
+
353
+ // src/configs/import.ts
354
+ init_cjs_shims();
355
+ var import_eslint_plugin_import_x = __toESM(require("eslint-plugin-import-x"), 1);
356
+
357
+ // src/constants.ts
358
+ init_cjs_shims();
359
+ var ERROR = 2;
360
+ var WARNING = 1;
361
+ var OFF = 0;
362
+ var GLOB_JS_TS_EXTENSION = "?([cm])[jt]s?(x)";
363
+ var GLOB_JS_TS = `**/*.${GLOB_JS_TS_EXTENSION}`;
364
+ var GLOB_CONFIG_FILES = [
365
+ `**/*.config.${GLOB_JS_TS_EXTENSION}`,
366
+ `**/.*rc.${GLOB_JS_TS_EXTENSION}`
367
+ ];
368
+ var GLOB_TS = "**/*.?([cm])ts";
369
+ var GLOB_TSX = `${GLOB_TS}x`;
370
+ var GLOB_VUE = "**/*.vue";
371
+
372
+ // src/utils.ts
373
+ init_cjs_shims();
374
+ var genFlatConfigEntryName = (name) => `eslint-config-un/${name}`;
375
+ var genRuleOverrideFn = (prefix) => (baseRuleName, severity, ...options) => ({
376
+ [baseRuleName]: OFF,
377
+ [`${prefix}/${baseRuleName}`]: [severity, ...options]
378
+ });
379
+ var disableAutofixForRule = genRuleOverrideFn("disable-autofix");
380
+ var createPluginObjectRenamer = (from, to) => {
381
+ const fromRegex = new RegExp(`^${from}/`);
382
+ return (object) => Object.fromEntries(
383
+ Object.entries(object).map(([ruleName, v]) => [ruleName.replace(fromRegex, `${to}/`), v])
384
+ );
385
+ };
386
+ var assignOptions = (options, key) => ({
387
+ ...typeof options[key] === "object" && options[key]
388
+ });
389
+ var warnUnlessForcedError = (internalOptions, rule, ...options) => {
390
+ const { errorsInsteadOfWarnings } = internalOptions.globalOptions || {};
391
+ const level = errorsInsteadOfWarnings === true || Array.isArray(errorsInsteadOfWarnings) && errorsInsteadOfWarnings.includes(rule) ? ERROR : WARNING;
392
+ return {
393
+ [rule]: [level, ...options]
394
+ };
395
+ };
396
+ var arraify = (value) => Array.isArray(value) ? value : value == null ? [] : [value];
397
+
398
+ // src/configs/import.ts
399
+ var pluginRenamer = createPluginObjectRenamer("import-x", "import");
400
+ var importEslintConfig = (options = {}, internalOptions = {}) => {
401
+ const isTsEnabled = options.tsconfigPath != null;
402
+ const noUnresolvedIgnores = arraify(options.importPatternsToIgnoreWhenTryingToResolve);
403
+ const rules = {
404
+ // 'import/consistent-type-specifier-style': OFF,
405
+ // 'import/default': ERROR,
406
+ // 'import/dynamic-import-chunkname': OFF,
407
+ // 'import/export': ERROR,
408
+ // 'import/exports-last': OFF,
409
+ "import/extensions": [
410
+ options.requireModuleExtensions ? ERROR : OFF,
411
+ typeof options.requireModuleExtensions === "object" && options.requireModuleExtensions["*"] || "ignorePackages",
412
+ {
413
+ ...options.requireModuleExtensions === true && Object.fromEntries(
414
+ ["js", "cjs", "mjs", "ts", "cts", "mts", "jsx", "tsx"].map((ext) => [ext, "always"])
415
+ ),
416
+ ...typeof options.requireModuleExtensions === "object" && options.requireModuleExtensions
417
+ }
418
+ ],
419
+ "import/first": ERROR,
420
+ // 'import/group-exports': OFF,
421
+ // 'import/max-dependencies': OFF,
422
+ // 'import/named': ERROR | OFF, // disabled in TS config
423
+ // 'import/namespace': ERROR,
424
+ "import/newline-after-import": ERROR,
425
+ "import/no-absolute-path": ERROR,
426
+ // 'import/no-amd': OFF,
427
+ // 'import/no-anonymous-default-export': OFF,
428
+ // 'import/no-commonjs': OFF,
429
+ ...warnUnlessForcedError(internalOptions, "import/no-cycle"),
430
+ "import/no-default-export": ERROR,
431
+ ...warnUnlessForcedError(internalOptions, "import/no-deprecated"),
432
+ // 'import/no-duplicates': ERROR,
433
+ // 'import/no-dynamic-require': OFF,
434
+ "import/no-empty-named-blocks": ERROR,
435
+ "import/no-extraneous-dependencies": [ERROR, { peerDependencies: false }],
436
+ // 'import/no-import-module-exports': OFF, // TODO enable?
437
+ // 'import/no-internal-modules': OFF,
438
+ ...warnUnlessForcedError(internalOptions, "import/no-mutable-exports"),
439
+ "import/no-named-as-default-member": OFF,
440
+ "import/no-named-as-default": OFF,
441
+ // Not very useful + false positives for axios@1.6.7?
442
+ // 'import/no-named-default': OFF,
443
+ // 'import/no-named-export': OFF,
444
+ // 'import/no-namespace': OFF,
445
+ // 'import/no-nodejs-modules': OFF, // TODO
446
+ // 'import/no-relative-packages': OFF,
447
+ // 'import/no-relative-parent-imports': OFF,
448
+ // 'import/no-restricted-paths': OFF,
449
+ "import/no-self-import": ERROR,
450
+ // 'import/no-unassigned-import': OFF,
451
+ "import/no-unresolved": [
452
+ ERROR,
453
+ {
454
+ ...noUnresolvedIgnores.length > 0 && { ignore: noUnresolvedIgnores }
455
+ }
456
+ ],
457
+ // 'import/no-unused-modules': OFF,
458
+ ...warnUnlessForcedError(internalOptions, "import/no-useless-path-segments"),
459
+ "import/no-webpack-loader-syntax": ERROR,
460
+ "import/order": [
461
+ ERROR,
462
+ {
463
+ groups: ["builtin", "external", "internal", "parent", "sibling", "index"],
464
+ alphabetize: { order: "asc" }
465
+ }
466
+ ]
467
+ // 'import/prefer-default-export': OFF,
468
+ // 'import/unambiguous': OFF,
469
+ };
470
+ return [
471
+ {
472
+ plugins: {
473
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-assignment
474
+ import: import_eslint_plugin_import_x.default
475
+ },
476
+ ...options.files && { files: options.files },
477
+ ...options.ignores && { ignores: options.ignores },
478
+ settings: {
479
+ ...isTsEnabled && import_eslint_plugin_import_x.default.configs.typescript.settings,
480
+ "import-x/resolver": {
481
+ ...isTsEnabled && {
482
+ typescript: {
483
+ project: true,
484
+ alwaysTryTypes: true
485
+ }
486
+ },
487
+ node: true
488
+ // TODO
489
+ },
490
+ ...isTsEnabled && {
491
+ "import-x/parsers": {
492
+ "@typescript-eslint/parser": [".ts", ".cts", ".mts", ".tsx", ".ctsx", ".mtsx"]
493
+ }
494
+ }
495
+ },
496
+ rules: {
497
+ ...pluginRenamer(import_eslint_plugin_import_x.default.configs.recommended.rules),
498
+ ...isTsEnabled && pluginRenamer(import_eslint_plugin_import_x.default.configs.typescript.rules),
499
+ ...rules,
500
+ ...options.overrides
501
+ },
502
+ name: genFlatConfigEntryName("import")
503
+ }
504
+ ];
505
+ };
506
+
507
+ // src/configs/js.ts
508
+ init_cjs_shims();
509
+ var import_js = __toESM(require_src(), 1);
510
+ var RULE_CAMELCASE_OPTIONS = {
511
+ properties: "never",
512
+ ignoreGlobals: true,
513
+ allow: [String.raw`\d_\d`]
514
+ };
515
+ var RULE_EQEQEQ_OPTIONS = ["always", { null: "ignore" }];
516
+ var RULE_NO_UNUSED_EXPRESSIONS_OPTIONS = {
517
+ allowShortCircuit: true,
518
+ allowTernary: true,
519
+ allowTaggedTemplates: true
520
+ };
521
+ var RULE_NO_USE_BEFORE_DEFINE_OPTIONS = {
522
+ functions: false
523
+ };
524
+ var RULE_PREFER_DESTRUCTURING_OPTIONS = {
525
+ VariableDeclarator: {
526
+ array: false,
527
+ object: true
528
+ },
529
+ AssignmentExpression: {
530
+ array: false,
531
+ object: false
532
+ }
533
+ };
534
+ var jsEslintConfig = (options = {}, internalOptions = {}) => {
535
+ const rules = {
536
+ // 🔵 Recommended - Possible Problems
537
+ // 'constructor-super': ERROR,
538
+ // 'for-direction': ERROR,
539
+ // 'getter-return': ERROR,
540
+ // 'no-async-promise-executor': ERROR,
541
+ // 'no-class-assign': ERROR,
542
+ // 'no-compare-neg-zero': ERROR,
543
+ // 'no-cond-assign': ERROR,
544
+ // 'no-const-assign': ERROR,
545
+ // 'no-constant-binary-expression': ERROR,
546
+ // 'no-constant-condition': ERROR,
547
+ // 'no-control-regex': ERROR,
548
+ // 'no-debugger': ERROR,
549
+ // 'no-dupe-args': ERROR,
550
+ // 'no-dupe-class-members': ERROR,
551
+ // 'no-dupe-else-if': ERROR,
552
+ // 'no-dupe-keys': ERROR,
553
+ // 'no-duplicate-case': ERROR,
554
+ // 'no-empty-character-class': ERROR,
555
+ // 'no-empty-pattern': ERROR,
556
+ // 'no-ex-assign': ERROR,
557
+ // 'no-fallthrough': ERROR,
558
+ // 'no-func-assign': ERROR,
559
+ // 'no-import-assign': ERROR,
560
+ // 'no-invalid-regexp': ERROR,
561
+ // 'no-irregular-whitespace': ERROR,
562
+ // 'no-loss-of-precision': ERROR,
563
+ // 'no-misleading-character-class': ERROR,
564
+ // 'no-new-native-nonconstructor': ERROR,
565
+ // 'no-obj-calls': ERROR,
566
+ // 'no-prototype-builtins': ERROR,
567
+ // 'no-self-assign': ERROR,
568
+ // 'no-setter-return': ERROR,
569
+ // 'no-sparse-arrays': ERROR,
570
+ // 'no-this-before-super': ERROR,
571
+ // 'no-undef': ERROR,
572
+ // 'no-unexpected-multiline': ERROR,
573
+ // 'no-unreachable': ERROR,
574
+ // 'no-unsafe-finally': ERROR,
575
+ // 'no-unsafe-negation': ERROR,
576
+ // 'no-unsafe-optional-chaining': ERROR,
577
+ // 'no-unused-private-class-members': ERROR,
578
+ // 'no-unused-vars': ERROR,
579
+ // 'no-useless-backreference': ERROR,
580
+ // 'use-isnan': ERROR,
581
+ // 'valid-typeof': ERROR,
582
+ // 🔵 Recommended - Suggestions
583
+ // 'no-case-declarations': ERROR,
584
+ // 'no-delete-var': ERROR,
585
+ // 'no-empty': ERROR,
586
+ // 'no-empty-static-block': ERROR,
587
+ // 'no-extra-boolean-cast': ERROR,
588
+ // 'no-global-assign': ERROR,
589
+ // 'no-nonoctal-decimal-escape': ERROR,
590
+ // 'no-octal': ERROR,
591
+ // 'no-redeclare': ERROR,
592
+ // 'no-regex-spaces': ERROR,
593
+ // 'no-shadow-restricted-names': ERROR,
594
+ // 'no-unused-labels': ERROR,
595
+ // 'no-useless-catch': ERROR,
596
+ // 'no-useless-escape': ERROR,
597
+ // 'no-with': ERROR,
598
+ // 'require-yield': ERROR,
599
+ // 🔵 Not in recommended - Possible Problems
600
+ "array-callback-return": [ERROR, { checkForEach: true }],
601
+ ...warnUnlessForcedError(internalOptions, "no-await-in-loop"),
602
+ ...warnUnlessForcedError(internalOptions, "no-constructor-return"),
603
+ "no-duplicate-imports": ERROR,
604
+ "no-inner-declarations": ERROR,
605
+ "no-promise-executor-return": ERROR,
606
+ "no-self-compare": ERROR,
607
+ "no-template-curly-in-string": ERROR,
608
+ "no-unmodified-loop-condition": ERROR,
609
+ "no-unreachable-loop": ERROR,
610
+ "no-use-before-define": [ERROR, RULE_NO_USE_BEFORE_DEFINE_OPTIONS],
611
+ "no-useless-assignment": ERROR,
612
+ // @ts-expect-error no options typings
613
+ "require-atomic-updates": [ERROR, { allowProperties: true }],
614
+ // 🔵 Not in recommended - Suggestions
615
+ "accessor-pairs": ERROR,
616
+ // 'arrow-body-style': OFF,
617
+ "block-scoped-var": ERROR,
618
+ // @ts-expect-error incorrect typings
619
+ camelcase: [ERROR, RULE_CAMELCASE_OPTIONS],
620
+ // 'capitalized-comments': OFF,
621
+ "class-methods-use-this": ERROR,
622
+ // complexity: OFF,
623
+ "consistent-return": ERROR,
624
+ "consistent-this": [ERROR, "that"],
625
+ curly: [
626
+ ERROR,
627
+ "all"
628
+ /* default */
629
+ ],
630
+ "default-case": ERROR,
631
+ "default-case-last": ERROR,
632
+ "default-param-last": ERROR,
633
+ "dot-notation": ERROR,
634
+ eqeqeq: [ERROR, ...RULE_EQEQEQ_OPTIONS],
635
+ "func-name-matching": [ERROR, { considerPropertyDescriptor: true }],
636
+ // 'func-names': OFF,
637
+ // 'func-style': OFF,
638
+ "grouped-accessor-pairs": [ERROR, "getBeforeSet"],
639
+ "guard-for-in": ERROR,
640
+ // 'id-denylist': OFF,
641
+ // 'id-length': OFF,
642
+ // 'id-match': OFF,
643
+ // 'init-declarations': OFF,
644
+ "logical-assignment-operators": [ERROR, "always", { enforceForIfStatements: true }],
645
+ // @ts-expect-error incorrect typings
646
+ "max-classes-per-file": [ERROR, { ignoreExpressions: true, max: 2 }],
647
+ // 'max-depth': OFF,
648
+ // 'max-lines': OFF,
649
+ // 'max-lines-per-function': OFF,
650
+ // 'max-nested-callbacks': OFF,
651
+ // 'max-params': OFF,
652
+ // 'max-statements': OFF,
653
+ "new-cap": [ERROR, { properties: false, capIsNew: false }],
654
+ ...warnUnlessForcedError(internalOptions, "no-alert"),
655
+ "no-array-constructor": ERROR,
656
+ // 'no-bitwise': OFF,
657
+ "no-caller": ERROR,
658
+ ...warnUnlessForcedError(internalOptions, "no-console", { allow: ["warn", "error"] }),
659
+ // 'no-continue': OFF,
660
+ // 'no-div-regex': OFF,
661
+ "no-else-return": [ERROR, { allowElseIf: false }],
662
+ "no-empty-function": ERROR,
663
+ // 'no-eq-null': OFF,
664
+ "no-eval": ERROR,
665
+ "no-extend-native": ERROR,
666
+ "no-extra-bind": ERROR,
667
+ "no-extra-label": ERROR,
668
+ "no-implicit-coercion": [ERROR, { boolean: true, disallowTemplateShorthand: true }],
669
+ // 'no-implicit-globals': OFF,
670
+ "no-implied-eval": ERROR,
671
+ // 'no-inline-comments': OFF,
672
+ // 'no-invalid-this': OFF,
673
+ "no-iterator": ERROR,
674
+ "no-label-var": ERROR,
675
+ "no-labels": [ERROR, { allowLoop: false }],
676
+ "no-lone-blocks": ERROR,
677
+ "no-lonely-if": ERROR,
678
+ "no-loop-func": ERROR,
679
+ // 'no-magic-numbers': OFF,
680
+ "no-multi-assign": ERROR,
681
+ "no-multi-str": ERROR,
682
+ "no-negated-condition": ERROR,
683
+ // 'no-nested-ternary': OFF,
684
+ ...warnUnlessForcedError(internalOptions, "no-new"),
685
+ "no-new-func": ERROR,
686
+ "no-new-wrappers": ERROR,
687
+ "no-object-constructor": ERROR,
688
+ "no-octal-escape": ERROR,
689
+ ...warnUnlessForcedError(internalOptions, "no-param-reassign"),
690
+ // 'no-plusplus': OFF,
691
+ "no-proto": ERROR,
692
+ // 'no-restricted-exports': OFF,
693
+ "no-restricted-globals": [
694
+ ERROR,
695
+ { name: "global", message: "Use `globalThis` instead" },
696
+ { name: "self", message: "Use `globalThis` instead" },
697
+ { name: "event", message: "Use local parameter instead" }
698
+ ],
699
+ // 'no-restricted-imports': OFF,
700
+ // 'no-restricted-properties': OFF,
701
+ // 'no-restricted-syntax': OFF,
702
+ "no-return-assign": [ERROR, "always"],
703
+ "no-script-url": ERROR,
704
+ "no-sequences": ERROR,
705
+ "no-shadow": ERROR,
706
+ // 'no-ternary': OFF,
707
+ "no-throw-literal": ERROR,
708
+ "no-undef-init": ERROR,
709
+ // 'no-undefined': OFF,
710
+ // Had a potential, but unfortunately reports accesses of object properties starting with _
711
+ // 'no-underscore-dangle': [
712
+ // OFF,
713
+ // {
714
+ // allow: ['__dirname', '__filename'],
715
+ // allowAfterThis: true,
716
+ // allowAfterSuper: true,
717
+ // // @ts-expect-error does not exist in typings
718
+ // allowAfterThisConstructor: true,
719
+ // },
720
+ // ],
721
+ "no-unneeded-ternary": [ERROR, { defaultAssignment: false }],
722
+ "no-unused-expressions": [ERROR, RULE_NO_UNUSED_EXPRESSIONS_OPTIONS],
723
+ "no-useless-call": ERROR,
724
+ "no-useless-computed-key": ERROR,
725
+ "no-useless-concat": ERROR,
726
+ "no-useless-constructor": ERROR,
727
+ "no-useless-rename": ERROR,
728
+ "no-useless-return": ERROR,
729
+ "no-var": ERROR,
730
+ // @ts-expect-error incorrect typings
731
+ "no-void": [ERROR, { allowAsStatement: true }],
732
+ // 'no-warning-comments': OFF,
733
+ "object-shorthand": ERROR,
734
+ "one-var": [ERROR, "never"],
735
+ "operator-assignment": ERROR,
736
+ "prefer-arrow-callback": [
737
+ ERROR,
738
+ {
739
+ allowNamedFunctions: false,
740
+ allowUnboundThis: true
741
+ }
742
+ ],
743
+ "prefer-const": [ERROR, { ignoreReadBeforeAssign: true }],
744
+ "prefer-destructuring": [ERROR, RULE_PREFER_DESTRUCTURING_OPTIONS],
745
+ "prefer-exponentiation-operator": ERROR,
746
+ // 'prefer-named-capture-group': OFF,
747
+ "prefer-numeric-literals": ERROR,
748
+ // TODO disable if ecmaVersion<2022?
749
+ "prefer-object-has-own": ERROR,
750
+ "prefer-object-spread": ERROR,
751
+ "prefer-promise-reject-errors": ERROR,
752
+ "prefer-regex-literals": [ERROR, { disallowRedundantWrapping: true }],
753
+ "prefer-rest-params": ERROR,
754
+ "prefer-spread": ERROR,
755
+ "prefer-template": ERROR,
756
+ radix: ERROR,
757
+ "require-await": ERROR,
758
+ // 'require-unicode-regexp': OFF,
759
+ "sort-imports": [ERROR, { ignoreDeclarationSort: true }],
760
+ // 'sort-keys': OFF,
761
+ // 'sort-vars': OFF,
762
+ strict: [ERROR, "never"],
763
+ "symbol-description": ERROR,
764
+ "vars-on-top": ERROR,
765
+ yoda: ERROR,
766
+ // 🔵 Not in recommended - Layout & Formatting
767
+ "unicode-bom": ERROR,
768
+ // 🔵 Stylistic
769
+ "@stylistic/quotes": [
770
+ ERROR,
771
+ "single",
772
+ // Doesn't matter since `ignoreStringLiterals` is true - BUT will be used in fixes
773
+ {
774
+ ignoreStringLiterals: true,
775
+ avoidEscape: true
776
+ // TODO Doesn't have any effect `ignoreStringLiterals` is true - should propose auto-fix?
777
+ }
778
+ ]
779
+ };
780
+ return [
781
+ {
782
+ ...options.files && { files: options.files },
783
+ ...options.ignores && { ignores: options.ignores },
784
+ // https://eslint.org/docs/latest/rules/
785
+ rules: {
786
+ ...import_js.default.configs.recommended.rules,
787
+ ...rules,
788
+ ...options.overrides
789
+ },
790
+ name: genFlatConfigEntryName("js")
791
+ }
792
+ ];
793
+ };
794
+
795
+ // src/configs/node.ts
796
+ init_cjs_shims();
797
+ var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
798
+ var pluginRenamer2 = createPluginObjectRenamer("n", "node");
799
+ var nodeEslintConfig = (options = {}, internalOptions = {}) => {
800
+ const rules = {
801
+ // 'node/callback-return': OFF,
802
+ "node/exports-style": [
803
+ ERROR,
804
+ "module.exports",
805
+ {
806
+ allowBatchAssign: false
807
+ }
808
+ ],
809
+ // 'node/file-extension-in-import': OFF,
810
+ // 'node/global-require': OFF,
811
+ // 'node/handle-callback-err': OFF,
812
+ // 'node/hashbang': ERROR,
813
+ // 'node/no-callback-literal': OFF,
814
+ // 'node/no-deprecated-api': ERROR,
815
+ // 'node/no-exports-assign': ERROR,
816
+ // TODO only disable when import plugin is enabled?
817
+ "node/no-extraneous-import": OFF,
818
+ // 'node/no-extraneous-require': ERROR, // TODO handled by import plugin too?
819
+ // TODO only disable when import plugin is enabled?
820
+ "node/no-missing-import": OFF,
821
+ // 'node/no-missing-require': ERROR, // TODO handled by import plugin too?
822
+ // 'node/no-mixed-requires': OFF,
823
+ "node/no-new-require": ERROR,
824
+ "node/no-path-concat": ERROR,
825
+ // 'node/no-process-env': OFF,
826
+ "node/no-process-exit": OFF,
827
+ // The corresponding Unicorn rule is better: https://github.com/sindresorhus/eslint-plugin-unicorn/blob/1deb9bb5edf27fdb2f656add11c924dfa59fdac9/docs/rules/no-process-exit.md
828
+ "unicorn/no-process-exit": ERROR,
829
+ // TODO
830
+ // 'node/no-restricted-import': OFF,
831
+ // 'node/no-restricted-require': OFF,
832
+ // 'node/no-sync': OFF,
833
+ // 'node/no-unpublished-bin': ERROR,
834
+ // TODO only disable when import plugin is enabled?
835
+ "node/no-unpublished-import": OFF,
836
+ // 'node/no-unpublished-require': ERROR, // TODO handled by import plugin too?
837
+ // 'node/no-unsupported-features/es-builtins': ERROR,
838
+ // 'node/no-unsupported-features/es-syntax': ERROR,
839
+ // 'node/no-unsupported-features/node-builtins': ERROR,
840
+ "node/prefer-global/buffer": ERROR,
841
+ "node/prefer-global/console": ERROR,
842
+ "node/prefer-global/process": ERROR,
843
+ "node/prefer-global/text-decoder": ERROR,
844
+ "node/prefer-global/text-encoder": ERROR,
845
+ "node/prefer-global/url": ERROR,
846
+ "node/prefer-global/url-search-params": ERROR,
847
+ "node/prefer-node-protocol": ERROR,
848
+ "node/prefer-promises/dns": OFF,
849
+ // TODO enable?
850
+ "node/prefer-promises/fs": OFF
851
+ // TODO enable?
852
+ // Does not report anything, makes ESLint treat `process.exit()` calls as a stop: https://github.com/eslint-community/eslint-plugin-node/blob/c092cd893010f8da894f87da567c07d69be6cc0d/docs/rules/process-exit-as-throw.md
853
+ // 'node/process-exit-as-throw': ERROR,
854
+ };
855
+ return [
856
+ {
857
+ plugins: {
858
+ node: import_eslint_plugin_n.default
859
+ },
860
+ ...options.files && { files: options.files },
861
+ ...options.ignores && { ignores: options.ignores },
862
+ rules: {
863
+ ...pluginRenamer2(import_eslint_plugin_n.default.configs["flat/recommended"].rules || {}),
864
+ ...rules,
865
+ ...options.overrides
866
+ },
867
+ name: genFlatConfigEntryName("node")
868
+ }
869
+ ];
870
+ };
871
+
872
+ // src/configs/promise.ts
873
+ init_cjs_shims();
874
+ var import_eslint_plugin_promise = __toESM(require("eslint-plugin-promise"), 1);
875
+ var promiseEslintConfig = (options = {}, internalOptions = {}) => {
876
+ const rules = {
877
+ "promise/always-return": [ERROR, { ignoreLastCallback: true }],
878
+ // 'avoid-new': OFF,
879
+ "promise/catch-or-return": [
880
+ ERROR,
881
+ {
882
+ allowThen: true,
883
+ allowFinally: true
884
+ }
885
+ ],
886
+ "promise/no-callback-in-promise": ERROR,
887
+ // Default: warn
888
+ ...warnUnlessForcedError(internalOptions, "promise/no-multiple-resolved"),
889
+ // 'promise/no-native': OFF,
890
+ ...warnUnlessForcedError(internalOptions, "promise/no-nesting"),
891
+ // 'promise/no-new-statics': ERROR,
892
+ ...warnUnlessForcedError(internalOptions, "promise/no-promise-in-callback"),
893
+ "promise/no-return-in-finally": ERROR,
894
+ // Default: warn
895
+ "promise/no-return-wrap": [ERROR, { allowReject: true }],
896
+ // 'promise/param-names': ERROR,
897
+ // 'promise/prefer-await-to-callbacks': OFF,
898
+ // 'promise/prefer-await-to-then': OFF,
899
+ "promise/valid-params": ERROR
900
+ // Default: warn
901
+ };
902
+ return [
903
+ {
904
+ plugins: {
905
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
906
+ promise: import_eslint_plugin_promise.default
907
+ },
908
+ ...options.files && { files: options.files },
909
+ ...options.ignores && { ignores: options.ignores },
910
+ rules: {
911
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
912
+ ...import_eslint_plugin_promise.default.configs.recommended.rules,
913
+ ...rules,
914
+ ...options.overrides
915
+ },
916
+ name: genFlatConfigEntryName("promise")
917
+ }
918
+ ];
919
+ };
920
+
921
+ // src/configs/regexp.ts
922
+ init_cjs_shims();
923
+ var eslintPluginRegexp = __toESM(require("eslint-plugin-regexp"), 1);
924
+ var overrideBaseRule = genRuleOverrideFn("regexp");
925
+ var regexpEslintConfig = (options = {}, internalOptions = {}) => {
926
+ const rules = {
927
+ // Possible Errors
928
+ // 'regexp/no-contradiction-with-assertion': ERROR,
929
+ // "This rule is inspired by the no-control-regex rule. The positions of reports are improved over the core rule and suggestions are provided in some cases"
930
+ "no-control-regex": OFF,
931
+ "regexp/no-control-character": ERROR,
932
+ // 'regexp/no-dupe-disjunctions': ERROR,
933
+ "regexp/no-empty-alternative": ERROR,
934
+ // Default: warn
935
+ // 'regexp/no-empty-capturing-group': ERROR,
936
+ // "The reports for this rule include reports for the ESLint core no-empty-character-class rule. That is, if you use this rule, you can turn off the ESLint core no-empty-character-class rule"
937
+ ...overrideBaseRule("no-empty-character-class", ERROR),
938
+ // 'regexp/no-empty-group': ERROR,
939
+ // 'regexp/no-empty-lookarounds-assertion': ERROR,
940
+ // 'regexp/no-escape-backspace': ERROR,
941
+ // 'regexp/no-invalid-regexp': ERROR,
942
+ "regexp/no-lazy-ends": ERROR,
943
+ // Default: warn
944
+ // 'regexp/no-misleading-capturing-group': ERROR,
945
+ // 'regexp/no-misleading-unicode-character': ERROR,
946
+ // 'regexp/no-missing-g-flag': ERROR,
947
+ // 'regexp/no-optional-assertion': ERROR,
948
+ ...warnUnlessForcedError(internalOptions, "regexp/no-potentially-useless-backreference"),
949
+ // 'regexp/no-super-linear-backtracking': ERROR,
950
+ // 'regexp/no-super-linear-move': OFF,
951
+ // 'regexp/no-useless-assertions': ERROR,
952
+ // "This rule is a based on the ESLint core no-useless-backreference rule. It reports all the ESLint core rule reports and some more"
953
+ ...overrideBaseRule("no-useless-backreference", ERROR),
954
+ // 'regexp/no-useless-dollar-replacements': ERROR,
955
+ // 'regexp/strict': ERROR,
956
+ // Best Practices
957
+ "regexp/confusing-quantifier": ERROR,
958
+ // Default: warn
959
+ // 'regexp/control-character-escape': ERROR,
960
+ // 'regexp/negation': ERROR,
961
+ // 'regexp/no-dupe-characters-character-class': ERROR,
962
+ // 'regexp/no-empty-string-literal': ERROR,
963
+ // 'regexp/no-extra-lookaround-assertions': ERROR,
964
+ // 'regexp/no-invisible-character': ERROR,
965
+ // 'regexp/no-legacy-features': ERROR,
966
+ // 'regexp/no-non-standard-flag': ERROR,
967
+ ...warnUnlessForcedError(internalOptions, "regexp/no-obscure-range"),
968
+ "regexp/no-octal": ERROR,
969
+ "regexp/no-standalone-backslash": ERROR,
970
+ // 'regexp/no-trivially-nested-assertion': ERROR,
971
+ // 'regexp/no-trivially-nested-quantifier': ERROR,
972
+ // 'regexp/no-unused-capturing-group': ERROR,
973
+ // 'regexp/no-useless-character-class': ERROR,
974
+ "regexp/no-useless-flag": ERROR,
975
+ // Default: warn
976
+ // 'regexp/no-useless-lazy': ERROR,
977
+ // 'regexp/no-useless-quantifier': ERROR,
978
+ // 'regexp/no-useless-range': ERROR,
979
+ // 'regexp/no-useless-set-operand': ERROR,
980
+ // 'regexp/no-useless-string-literal': ERROR,
981
+ // 'regexp/no-useless-two-nums-quantifier': ERROR,
982
+ // 'regexp/no-zero-quantifier': ERROR,
983
+ "regexp/optimal-lookaround-quantifier": ERROR,
984
+ // Default: warn
985
+ // 'regexp/optimal-quantifier-concatenation': ERROR,
986
+ // 'regexp/prefer-escape-replacement-dollar-char': OFF,
987
+ // 'regexp/prefer-predefined-assertion': ERROR,
988
+ "regexp/prefer-quantifier": ERROR,
989
+ // Default: off
990
+ // 'regexp/prefer-range': ERROR,
991
+ // Same (?) as `@typescript-eslint/prefer-regexp-exec` which is turned off by default
992
+ // 'regexp/prefer-regexp-exec': OFF,
993
+ "unicorn/prefer-regexp-test": OFF,
994
+ "regexp/prefer-regexp-test": ERROR,
995
+ // TODO better than the unicorn rule? Off by default
996
+ // 'regexp/prefer-set-operation': ERROR,
997
+ // "This rule is inspired by the require-unicode-regexp rule. The position of the report is improved over the core rule and arguments of new RegExp() are also checked"
998
+ // Yes, still off - we just want to show that it's a better replacement for the core rule
999
+ ...overrideBaseRule("require-unicode-regexp", OFF),
1000
+ // 'regexp/require-unicode-sets-regexp': OFF,
1001
+ // 'regexp/simplify-set-operations': ERROR,
1002
+ // 'regexp/sort-alternatives': OFF,
1003
+ // 'regexp/use-ignore-case': ERROR,
1004
+ // Stylistic Issues
1005
+ // 'regexp/grapheme-string-literal': OFF, // TODO
1006
+ "regexp/hexadecimal-escape": [ERROR, "never"],
1007
+ // 'regexp/letter-case': ERROR,
1008
+ // 'regexp/match-any': ERROR,
1009
+ // 'regexp/no-useless-escape': ERROR,
1010
+ // 'regexp/no-useless-non-capturing-group': ERROR,
1011
+ // 'regexp/prefer-character-class': ERROR,
1012
+ // 'regexp/prefer-d': ERROR,
1013
+ "regexp/prefer-lookaround": [ERROR, { lookbehind: false }],
1014
+ // Default: off
1015
+ // 'regexp/prefer-named-backreference': OFF,
1016
+ // "This rule is inspired by the prefer-named-capture-group rule. The positions of reports are improved over the core rule and arguments of new RegExp() are also checked"
1017
+ // Yes, still off - we just want to show that it's a better replacement for the core rule
1018
+ ...overrideBaseRule("prefer-named-capture-group", OFF),
1019
+ // 'regexp/prefer-named-replacement': OFF,
1020
+ // 'regexp/prefer-plus-quantifier': ERROR,
1021
+ // 'regexp/prefer-question-quantifier': ERROR,
1022
+ // 'regexp/prefer-result-array-groups': OFF,
1023
+ // 'regexp/prefer-star-quantifier': ERROR,
1024
+ // 'regexp/prefer-unicode-codepoint-escapes': ERROR,
1025
+ // 'regexp/prefer-w': ERROR,
1026
+ "regexp/sort-character-class-elements": ERROR,
1027
+ // Default: off
1028
+ // 'regexp/sort-flags': ERROR,
1029
+ // 'regexp/unicode-escape': OFF,
1030
+ "regexp/unicode-property": ERROR
1031
+ // ...warnUnlessForcedError(internalOptions, 'regexp/'),
1032
+ };
1033
+ return [
1034
+ {
1035
+ ...options.files && { files: options.files },
1036
+ ...options.ignores && { ignores: options.ignores },
1037
+ plugins: {
1038
+ regexp: eslintPluginRegexp
1039
+ },
1040
+ rules: {
1041
+ ...eslintPluginRegexp.configs["flat/recommended"].rules,
1042
+ ...rules,
1043
+ ...options.overrides
1044
+ },
1045
+ name: genFlatConfigEntryName("regexp")
1046
+ }
1047
+ ];
1048
+ };
1049
+
1050
+ // src/configs/security.ts
1051
+ init_cjs_shims();
1052
+ var import_eslint_plugin_security = __toESM(require("eslint-plugin-security"), 1);
1053
+ var securityEslintConfig = (options = {}, internalOptions = {}) => {
1054
+ const rules = {
1055
+ "security/detect-bidi-characters": ERROR,
1056
+ "security/detect-buffer-noassert": ERROR,
1057
+ ...warnUnlessForcedError(internalOptions, "security/detect-child-process"),
1058
+ "security/detect-disable-mustache-escape": ERROR,
1059
+ "security/detect-eval-with-expression": ERROR,
1060
+ "security/detect-new-buffer": ERROR,
1061
+ ...warnUnlessForcedError(internalOptions, "security/detect-no-csrf-before-method-override"),
1062
+ "security/detect-non-literal-fs-filename": OFF,
1063
+ "security/detect-non-literal-regexp": OFF,
1064
+ "security/detect-non-literal-require": OFF,
1065
+ "security/detect-object-injection": OFF,
1066
+ "security/detect-possible-timing-attacks": OFF,
1067
+ ...warnUnlessForcedError(internalOptions, "security/detect-pseudoRandomBytes"),
1068
+ ...warnUnlessForcedError(internalOptions, "security/detect-unsafe-regex")
1069
+ };
1070
+ return [
1071
+ {
1072
+ ...options.files && { files: options.files },
1073
+ ...options.ignores && { ignores: options.ignores },
1074
+ plugins: {
1075
+ security: import_eslint_plugin_security.default
1076
+ },
1077
+ rules: {
1078
+ ...import_eslint_plugin_security.default.configs.recommended.rules,
1079
+ ...rules,
1080
+ ...options.overrides
1081
+ },
1082
+ name: genFlatConfigEntryName("security")
1083
+ }
1084
+ ];
1085
+ };
1086
+
1087
+ // src/configs/sonar.ts
1088
+ init_cjs_shims();
1089
+ var import_eslint_plugin_sonarjs = __toESM(require("eslint-plugin-sonarjs"), 1);
1090
+ var sonarEslintConfig = (options = {}, internalOptions = {}) => {
1091
+ const rules = {
1092
+ // Bug Detection
1093
+ // 'sonarjs/no-all-duplicated-branches': ERROR,
1094
+ // 'sonarjs/no-element-overwrite': ERROR,
1095
+ // 'sonarjs/no-empty-collection': ERROR,
1096
+ // 'sonarjs/no-extra-arguments': ERROR,
1097
+ // 'sonarjs/no-identical-conditions': ERROR,
1098
+ // 'sonarjs/no-identical-expressions': ERROR,
1099
+ // 'sonarjs/no-ignored-return': ERROR,
1100
+ // 'sonarjs/no-one-iteration-loop': ERROR,
1101
+ // 'sonarjs/no-use-of-empty-return-value': ERROR,
1102
+ // 'sonarjs/non-existent-operator': ERROR,
1103
+ // Code Smell Detection
1104
+ // 'sonarjs/cognitive-complexity': OFF,
1105
+ // 'sonarjs/elseif-without-else': OFF,
1106
+ // 'sonarjs/max-switch-cases': OFF,
1107
+ // 'sonarjs/no-collapsible-if': ERROR,
1108
+ // 'sonarjs/no-collection-size-mischeck': ERROR, // TODO disable autofix?
1109
+ "sonarjs/no-duplicate-string": OFF,
1110
+ // 'sonarjs/no-duplicated-branches': ERROR,
1111
+ // 'sonarjs/no-gratuitous-expressions': ERROR,
1112
+ // 'sonarjs/no-identical-functions': ERROR,
1113
+ // 'sonarjs/no-inverted-boolean-check': ERROR,
1114
+ "sonarjs/no-nested-switch": OFF,
1115
+ "sonarjs/no-nested-template-literals": OFF,
1116
+ // 'sonarjs/no-redundant-boolean': ERROR,
1117
+ // 'sonarjs/no-redundant-jump': ERROR,
1118
+ // 'sonarjs/no-same-line-conditional': ERROR, // TODO disable autofix?
1119
+ // 'sonarjs/no-small-switch': ERROR,
1120
+ "sonarjs/no-unused-collection": OFF,
1121
+ // 'sonarjs/no-useless-catch': ERROR,
1122
+ "sonarjs/prefer-immediate-return": OFF
1123
+ // 'sonarjs/prefer-object-literal': ERROR,
1124
+ // 'sonarjs/prefer-single-boolean-return': ERROR,
1125
+ // 'sonarjs/prefer-while': ERROR,
1126
+ };
1127
+ return [
1128
+ {
1129
+ plugins: {
1130
+ sonarjs: import_eslint_plugin_sonarjs.default
1131
+ },
1132
+ ...options.files && { files: options.files },
1133
+ ...options.ignores && { ignores: options.ignores },
1134
+ rules: {
1135
+ ...import_eslint_plugin_sonarjs.default.configs.recommended.rules,
1136
+ ...rules,
1137
+ ...options.overrides
1138
+ },
1139
+ name: genFlatConfigEntryName("sonar")
1140
+ }
1141
+ ];
1142
+ };
1143
+
1144
+ // src/configs/tailwind.ts
1145
+ init_cjs_shims();
1146
+ var import_eslint_plugin_tailwindcss = __toESM(require("eslint-plugin-tailwindcss"), 1);
1147
+ var tailwindEslintConfig = (options = {}, internalOptions = {}) => {
1148
+ const rules = {
1149
+ ...warnUnlessForcedError(internalOptions, "tailwindcss/classnames-order"),
1150
+ ...warnUnlessForcedError(internalOptions, "tailwindcss/enforces-negative-arbitrary-values"),
1151
+ ...warnUnlessForcedError(internalOptions, "tailwindcss/enforces-shorthand"),
1152
+ ...warnUnlessForcedError(internalOptions, "tailwindcss/migration-from-tailwind-2"),
1153
+ // 'tailwindcss/no-arbitrary-value': OFF,
1154
+ // 'tailwindcss/no-contradicting-classname': ERROR,
1155
+ "tailwindcss/no-custom-classname": OFF,
1156
+ ...warnUnlessForcedError(internalOptions, "tailwindcss/no-unnecessary-arbitrary-value")
1157
+ };
1158
+ return [
1159
+ {
1160
+ plugins: {
1161
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
1162
+ tailwindcss: import_eslint_plugin_tailwindcss.default
1163
+ },
1164
+ ...options.files && { files: options.files },
1165
+ ...options.ignores && { ignores: options.ignores },
1166
+ rules: {
1167
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
1168
+ ...import_eslint_plugin_tailwindcss.default.configs.recommended.rules,
1169
+ ...rules,
1170
+ ...options.overrides
1171
+ },
1172
+ name: genFlatConfigEntryName("tailwind")
1173
+ }
1174
+ ];
1175
+ };
1176
+
1177
+ // src/configs/ts.ts
1178
+ init_cjs_shims();
1179
+ var import_eslint_plugin_no_type_assertion = __toESM(require("eslint-plugin-no-type-assertion"), 1);
1180
+ var import_typescript_eslint = require("typescript-eslint");
1181
+ var overrideBaseRule2 = genRuleOverrideFn("@typescript-eslint");
1182
+ var tsEslintConfig = (options = {}, internalOptions = {}) => {
1183
+ const onlyTsFiles = [GLOB_TS, GLOB_TSX];
1184
+ const allExtraFiles = (options.extraFileExtensions || []).map((ext) => `**/*.${ext}`);
1185
+ const extraFiles = internalOptions.vueOptions?.enforceTypescriptInScriptSection ? allExtraFiles.filter((pattern) => pattern.endsWith(".vue")) : [];
1186
+ const filesNonTypeAware = options.files || [...onlyTsFiles, ...extraFiles];
1187
+ const filesTypeAware = options.filesTypeAware === true || options.filesTypeAware == null ? [...onlyTsFiles, ...extraFiles] : options.filesTypeAware || [];
1188
+ const filesAll = [...onlyTsFiles, ...filesTypeAware];
1189
+ const tsVersion = options.typescriptVersion ? Number.parseFloat(options.typescriptVersion) : void 0;
1190
+ const generateBaseOptions = (isTypeAware) => ({
1191
+ languageOptions: {
1192
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-assignment
1193
+ parser: import_typescript_eslint.parser,
1194
+ parserOptions: {
1195
+ extraFileExtensions: options.extraFileExtensions?.map((ext) => `.${ext}`),
1196
+ sourceType: "module",
1197
+ ...isTypeAware && {
1198
+ project: arraify(options.tsconfigPath),
1199
+ tsconfigRootDir: process.cwd()
1200
+ },
1201
+ ...options.parserOptions
1202
+ }
1203
+ }
1204
+ });
1205
+ const typescriptRulesRegular = {
1206
+ ...import_typescript_eslint.plugin.configs?.strict?.rules,
1207
+ ...import_typescript_eslint.plugin.configs?.stylistic?.rules,
1208
+ // 🔵 Strict - overrides
1209
+ // '@typescript-eslint/ban-ts-comment': ERROR,
1210
+ "@typescript-eslint/ban-types": [ERROR, { types: { object: false, "{}": false } }],
1211
+ ...overrideBaseRule2("no-array-constructor", ERROR),
1212
+ // '@typescript-eslint/no-duplicate-enum-values': ERROR,
1213
+ ...warnUnlessForcedError(internalOptions, "@typescript-eslint/no-dynamic-delete"),
1214
+ ...warnUnlessForcedError(internalOptions, "@typescript-eslint/no-explicit-any", {
1215
+ ignoreRestArgs: true
1216
+ }),
1217
+ // '@typescript-eslint/no-extra-non-null-assertion': ERROR,
1218
+ // '@typescript-eslint/no-extraneous-class': ERROR,
1219
+ // '@typescript-eslint/no-invalid-void-type': ERROR,
1220
+ ...overrideBaseRule2("no-loss-of-precision", ERROR),
1221
+ // '@typescript-eslint/no-misused-new': ERROR,
1222
+ // '@typescript-eslint/no-namespace': ERROR,
1223
+ // '@typescript-eslint/no-non-null-asserted-nullish-coalescing': ERROR,
1224
+ // '@typescript-eslint/no-non-null-asserted-optional-chain': ERROR,
1225
+ ...warnUnlessForcedError(internalOptions, "@typescript-eslint/no-non-null-assertion"),
1226
+ // '@typescript-eslint/no-this-alias': ERROR,
1227
+ // '@typescript-eslint/no-unnecessary-type-constraint': ERROR,
1228
+ // '@typescript-eslint/no-unsafe-declaration-merging': ERROR,
1229
+ ...overrideBaseRule2("no-unused-vars", ERROR, { ignoreRestSiblings: true }),
1230
+ ...overrideBaseRule2("no-useless-constructor", ERROR),
1231
+ // '@typescript-eslint/no-var-requires': ERROR,
1232
+ // '@typescript-eslint/prefer-as-const': ERROR,
1233
+ "@typescript-eslint/prefer-literal-enum-member": [ERROR, { allowBitwiseExpressions: true }],
1234
+ // '@typescript-eslint/triple-slash-reference': ERROR,
1235
+ // '@typescript-eslint/unified-signatures': ERROR,
1236
+ // 🔵 Stylistic - overrides
1237
+ // '@typescript-eslint/adjacent-overload-signatures': ERROR,
1238
+ // '@typescript-eslint/array-type': ERROR,
1239
+ // '@typescript-eslint/ban-tslint-comment': ERROR,
1240
+ // '@typescript-eslint/class-literal-property-style': ERROR,
1241
+ // '@typescript-eslint/consistent-generic-constructors': ERROR,
1242
+ // '@typescript-eslint/consistent-indexed-object-style': ERROR,
1243
+ // '@typescript-eslint/consistent-type-assertions': ERROR,
1244
+ // '@typescript-eslint/consistent-type-definitions': ERROR,
1245
+ // '@typescript-eslint/no-confusing-non-null-assertion': ERROR,
1246
+ ...overrideBaseRule2("no-empty-function", ERROR),
1247
+ "@typescript-eslint/no-empty-interface": [ERROR, { allowSingleExtends: true }],
1248
+ // '@typescript-eslint/no-inferrable-types': ERROR,
1249
+ // '@typescript-eslint/prefer-for-of': ERROR,
1250
+ // '@typescript-eslint/prefer-function-type': ERROR,
1251
+ // '@typescript-eslint/prefer-namespace-keyword': ERROR,
1252
+ // 🔵 Additional rules
1253
+ ...overrideBaseRule2("class-methods-use-this", ERROR, {
1254
+ ignoreOverrideMethods: true,
1255
+ ignoreClassesThatImplementAnInterface: true
1256
+ }),
1257
+ "@typescript-eslint/consistent-type-imports": [
1258
+ ERROR,
1259
+ {
1260
+ ...tsVersion && tsVersion >= 4.5 && { fixStyle: "inline-type-imports" },
1261
+ disallowTypeAnnotations: false
1262
+ }
1263
+ ],
1264
+ ...overrideBaseRule2("default-param-last", ERROR),
1265
+ // '@typescript-eslint/explicit-function-return-type': OFF,
1266
+ // '@typescript-eslint/explicit-member-accessibility': OFF,
1267
+ "@typescript-eslint/explicit-module-boundary-types": OFF,
1268
+ // ...overrideBaseRule('init-declarations', OFF),
1269
+ // ...overrideBaseRule('max-params', OFF),
1270
+ // '@typescript-eslint/member-ordering': OFF, // ❄️
1271
+ "@typescript-eslint/method-signature-style": ERROR,
1272
+ // ...overrideBaseRule('no-dupe-class-members', OFF), // 👍
1273
+ "@typescript-eslint/no-empty-object-type": [
1274
+ ERROR,
1275
+ {
1276
+ allowInterfaces: "with-single-extends",
1277
+ allowObjectTypes: "always"
1278
+ }
1279
+ ],
1280
+ "@typescript-eslint/no-import-type-side-effects": ERROR,
1281
+ // ...overrideBaseRule('no-invalid-this', OFF), // 👍
1282
+ ...overrideBaseRule2("no-loop-func", ERROR),
1283
+ // ...overrideBaseRule('no-magic-numbers', OFF),
1284
+ "no-redeclare": OFF,
1285
+ // '@typescript-eslint/no-redeclare': OFF, // 👍
1286
+ // '@typescript-eslint/no-require-imports': OFF,
1287
+ // ...overrideBaseRule('no-restricted-imports', OFF),
1288
+ ...overrideBaseRule2("no-shadow", ERROR),
1289
+ "@typescript-eslint/no-unnecessary-parameter-property-assignment": ERROR,
1290
+ ...overrideBaseRule2("no-unused-expressions", ERROR, RULE_NO_UNUSED_EXPRESSIONS_OPTIONS),
1291
+ ...overrideBaseRule2("no-use-before-define", ERROR, RULE_NO_USE_BEFORE_DEFINE_OPTIONS),
1292
+ "@typescript-eslint/no-useless-empty-export": ERROR,
1293
+ // '@typescript-eslint/parameter-properties': OFF,
1294
+ // '@typescript-eslint/prefer-enum-initializers': OFF,
1295
+ // '@typescript-eslint/typedef': OFF,
1296
+ // 🔵 Disable conflicting rules
1297
+ "no-useless-constructor": OFF,
1298
+ "dot-notation": OFF,
1299
+ ...options.overrides
1300
+ };
1301
+ const typescriptRulesTypeAware = {
1302
+ ...import_typescript_eslint.plugin.configs?.["strict-type-checked-only"]?.rules,
1303
+ ...import_typescript_eslint.plugin.configs?.["stylistic-type-checked-only"]?.rules,
1304
+ // 🔵 Strict - overrides
1305
+ // '@typescript-eslint/await-thenable': ERROR,
1306
+ // '@typescript-eslint/no-array-delete': ERROR,
1307
+ // '@typescript-eslint/no-base-to-string': ERROR,
1308
+ "@typescript-eslint/no-confusing-void-expression": [
1309
+ ERROR,
1310
+ {
1311
+ ignoreArrowShorthand: true
1312
+ }
1313
+ ],
1314
+ // '@typescript-eslint/no-duplicate-type-constituents': ERROR,
1315
+ "@typescript-eslint/no-floating-promises": [
1316
+ ERROR,
1317
+ {
1318
+ checkThenables: true,
1319
+ ignoreVoid: true
1320
+ // Default
1321
+ }
1322
+ ],
1323
+ // '@typescript-eslint/no-for-in-array': ERROR,
1324
+ ...overrideBaseRule2("no-implied-eval", ERROR),
1325
+ // '@typescript-eslint/no-meaningless-void-operator': ERROR,
1326
+ // '@typescript-eslint/no-misused-promises': ERROR,
1327
+ // '@typescript-eslint/no-mixed-enums': ERROR,
1328
+ // '@typescript-eslint/no-redundant-type-constituents': ERROR,
1329
+ // '@typescript-eslint/no-unnecessary-boolean-literal-compare': ERROR,
1330
+ ...disableAutofixForRule("@typescript-eslint/no-unnecessary-condition", ERROR, {
1331
+ allowConstantLoopConditions: true
1332
+ }),
1333
+ // '@typescript-eslint/no-unnecessary-template-expression': ERROR,
1334
+ // Reason for disabling autofix: could remove type aliases
1335
+ ...disableAutofixForRule("@typescript-eslint/no-unnecessary-type-arguments", ERROR),
1336
+ // '@typescript-eslint/no-unnecessary-type-assertion': ERROR,
1337
+ ...warnUnlessForcedError(internalOptions, "@typescript-eslint/no-unsafe-argument"),
1338
+ ...warnUnlessForcedError(internalOptions, "@typescript-eslint/no-unsafe-assignment"),
1339
+ ...warnUnlessForcedError(internalOptions, "@typescript-eslint/no-unsafe-call"),
1340
+ ...warnUnlessForcedError(internalOptions, "@typescript-eslint/no-unsafe-enum-comparison"),
1341
+ ...warnUnlessForcedError(internalOptions, "@typescript-eslint/no-unsafe-member-access"),
1342
+ ...warnUnlessForcedError(internalOptions, "@typescript-eslint/no-unsafe-return"),
1343
+ "no-throw-literal": OFF,
1344
+ // Note: has different name
1345
+ "@typescript-eslint/only-throw-error": [
1346
+ ERROR,
1347
+ {
1348
+ allowThrowingUnknown: true
1349
+ }
1350
+ ],
1351
+ "unicorn/prefer-includes": OFF,
1352
+ // Note: in Unicorn
1353
+ "@typescript-eslint/prefer-includes": ERROR,
1354
+ ...overrideBaseRule2("prefer-promise-reject-errors", ERROR),
1355
+ // '@typescript-eslint/prefer-reduce-type-parameter': ERROR,
1356
+ // '@typescript-eslint/prefer-return-this-type': ERROR,
1357
+ ...overrideBaseRule2("require-await", ERROR),
1358
+ // '@typescript-eslint/restrict-plus-operands': ERROR,
1359
+ "@typescript-eslint/restrict-template-expressions": [
1360
+ ERROR,
1361
+ { allowAny: false, allowRegExp: false }
1362
+ ],
1363
+ // '@typescript-eslint/unbound-method': ERROR,
1364
+ // '@typescript-eslint/use-unknown-in-catch-callback-variable': ERROR,
1365
+ // 🔵 Stylistic - overrides
1366
+ ...overrideBaseRule2("dot-notation", ERROR, {
1367
+ allowIndexSignaturePropertyAccess: true
1368
+ }),
1369
+ // '@typescript-eslint/non-nullable-type-assertion-style': ERROR,
1370
+ "@typescript-eslint/prefer-nullish-coalescing": OFF,
1371
+ // '@typescript-eslint/prefer-optional-chain': ERROR,
1372
+ "@typescript-eslint/prefer-string-starts-ends-with": [
1373
+ ERROR,
1374
+ {
1375
+ allowSingleElementEquality: "always"
1376
+ }
1377
+ ],
1378
+ // 🔵 Additional rules
1379
+ // ...overrideBaseRule('consistent-return', OFF),
1380
+ "@typescript-eslint/consistent-type-exports": [
1381
+ ERROR,
1382
+ { fixMixedExportsWithInlineTypeSpecifier: true }
1383
+ ],
1384
+ // '@typescript-eslint/naming-convention': OFF, // ❄️
1385
+ // '@typescript-eslint/no-unnecessary-qualifier': OFF,
1386
+ "@typescript-eslint/no-unsafe-unary-minus": ERROR,
1387
+ ...overrideBaseRule2("prefer-destructuring", ERROR, RULE_PREFER_DESTRUCTURING_OPTIONS),
1388
+ "unicorn/prefer-array-find": OFF,
1389
+ // Note: in Unicorn
1390
+ "@typescript-eslint/prefer-find": ERROR,
1391
+ "@typescript-eslint/prefer-readonly": ERROR,
1392
+ // '@typescript-eslint/prefer-readonly-parameter-types': OFF,
1393
+ // '@typescript-eslint/prefer-regexp-exec': OFF,
1394
+ // '@typescript-eslint/promise-function-async': OFF,
1395
+ // '@typescript-eslint/require-array-sort-compare': OFF,
1396
+ // Note: has different name. Also note that the original rule is deprecated and not included in this config, but we disable it anyway just for safety
1397
+ "no-return-await": OFF,
1398
+ "@typescript-eslint/return-await": [ERROR, "always"],
1399
+ // '@typescript-eslint/strict-boolean-expressions': OFF,
1400
+ "@typescript-eslint/switch-exhaustiveness-check": ERROR,
1401
+ ...options.overridesTypeAware
1402
+ };
1403
+ return [
1404
+ {
1405
+ plugins: {
1406
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-assignment
1407
+ "@typescript-eslint": import_typescript_eslint.plugin
1408
+ },
1409
+ name: genFlatConfigEntryName("ts/setup")
1410
+ },
1411
+ {
1412
+ ...generateBaseOptions(false),
1413
+ files: filesNonTypeAware,
1414
+ ...options.ignores && { ignores: options.ignores },
1415
+ rules: typescriptRulesRegular,
1416
+ name: genFlatConfigEntryName("ts/regular-rules")
1417
+ },
1418
+ filesTypeAware.length > 0 && {
1419
+ ...generateBaseOptions(true),
1420
+ files: filesTypeAware,
1421
+ ...options.ignoresTypeAware && {
1422
+ ignores: options.ignoresTypeAware === true ? options.ignores || [] : options.ignoresTypeAware
1423
+ },
1424
+ rules: typescriptRulesTypeAware,
1425
+ name: genFlatConfigEntryName("ts/type-aware-rules")
1426
+ },
1427
+ // Handled by TS compiler
1428
+ {
1429
+ files: filesAll,
1430
+ rules: {
1431
+ "constructor-super": OFF,
1432
+ "getter-return": OFF,
1433
+ "no-const-assign": OFF,
1434
+ "no-dupe-args": OFF,
1435
+ "no-dupe-class-members": OFF,
1436
+ "no-dupe-keys": OFF,
1437
+ "no-func-assign": OFF,
1438
+ // "Note that the compiler will not catch the Object.assign() case. Thus, if you use Object.assign() in your codebase, this rule will still provide some value." - https://eslint.org/docs/latest/rules/no-import-assign#handled_by_typescript
1439
+ // 'no-import-assign': OFF,
1440
+ // "Note that, technically, TypeScript will only catch this if you have the strict or noImplicitThis flags enabled. These are enabled in most TypeScript projects, since they are considered to be best practice." - https://eslint.org/docs/latest/rules/no-invalid-this#rule-details
1441
+ // 'no-invalid-this': OFF,
1442
+ "no-new-native-nonconstructor": OFF,
1443
+ // successor of no-new-symbol
1444
+ "no-obj-calls": OFF,
1445
+ // "Note that while TypeScript will catch let redeclares and const redeclares, it will not catch var redeclares. Thus, if you use the legacy var keyword in your TypeScript codebase, this rule will still provide some value." - https://eslint.org/docs/latest/rules/no-redeclare#handled_by_typescript
1446
+ // 'no-redeclare': OFF,
1447
+ "no-setter-return": OFF,
1448
+ "no-this-before-super": OFF,
1449
+ "no-undef": OFF,
1450
+ // "TypeScript must be configured with allowUnreachableCode: false for it to consider unreachable code an error." - https://eslint.org/docs/latest/rules/no-unreachable#handled_by_typescript
1451
+ // 'no-unreachable': OFF,
1452
+ "no-unsafe-negation": OFF,
1453
+ // Does not work correctly when type-only imports are present because you can't combine such an import with a default import.
1454
+ "no-duplicate-imports": OFF
1455
+ },
1456
+ name: genFlatConfigEntryName("ts/disable-handled-by-ts-compiler-rules")
1457
+ },
1458
+ {
1459
+ files: ["**/*.d.?([cm])ts"],
1460
+ rules: {
1461
+ "@typescript-eslint/consistent-indexed-object-style": OFF,
1462
+ "@typescript-eslint/no-explicit-any": OFF,
1463
+ "@typescript-eslint/no-use-before-define": OFF,
1464
+ "@typescript-eslint/no-unused-vars": OFF,
1465
+ "@typescript-eslint/no-shadow": OFF,
1466
+ "@typescript-eslint/method-signature-style": OFF,
1467
+ "import/no-default-export": OFF,
1468
+ "import/newline-after-import": OFF
1469
+ },
1470
+ name: genFlatConfigEntryName("ts/dts")
1471
+ },
1472
+ options.noTypeAssertion && {
1473
+ plugins: {
1474
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
1475
+ "no-type-assertion": import_eslint_plugin_no_type_assertion.default
1476
+ },
1477
+ rules: {
1478
+ "no-type-assertion/no-type-assertion": options.noTypeAssertion === "warning" ? WARNING : ERROR
1479
+ },
1480
+ name: genFlatConfigEntryName("ts/no-type-assertion")
1481
+ }
1482
+ ].flat().filter((v) => !!v);
1483
+ };
1484
+
1485
+ // src/configs/unicorn.ts
1486
+ init_cjs_shims();
1487
+ var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
1488
+ var unicornEslintConfig = (options = {}, internalOptions = {}) => {
1489
+ const rules = {
1490
+ // 'unicorn/better-regex': ERROR,
1491
+ "unicorn/catch-error-name": OFF,
1492
+ ...warnUnlessForcedError(internalOptions, "disable-autofix/unicorn/catch-error-name"),
1493
+ // 'unicorn/catch-error-name': ERROR, // TODO warning & disable autofix?
1494
+ // 'unicorn/consistent-destructuring': OFF, // 🔴
1495
+ // 'unicorn/consistent-empty-array-spread': ERROR,
1496
+ // 'unicorn/consistent-function-scoping': ERROR,
1497
+ "unicorn/custom-error-definition": ERROR,
1498
+ // 🔴
1499
+ // 'unicorn/empty-brace-spaces': ERROR, // 💅
1500
+ // 'unicorn/error-message': ERROR,
1501
+ // 'unicorn/escape-case': ERROR,
1502
+ // 'unicorn/expiring-todo-comments': ERROR,
1503
+ // Reason for disabling autofix: wrong auto-fixes
1504
+ ...disableAutofixForRule("unicorn/explicit-length-check", ERROR),
1505
+ "unicorn/filename-case": OFF,
1506
+ // 'unicorn/import-style': ERROR,
1507
+ // 'unicorn/new-for-builtins': ERROR,
1508
+ // 'unicorn/no-abusive-eslint-disable': ERROR,
1509
+ "unicorn/no-anonymous-default-export": OFF,
1510
+ // Note: there's the same rule in import plugin
1511
+ "unicorn/no-array-callback-reference": OFF,
1512
+ "unicorn/no-array-for-each": OFF,
1513
+ // 'unicorn/no-array-method-this-argument': ERROR,
1514
+ // 'unicorn/no-array-push-push': ERROR,
1515
+ "unicorn/no-array-reduce": OFF,
1516
+ "unicorn/no-await-expression-member": OFF,
1517
+ // 'unicorn/no-await-in-promise-methods': ERROR,
1518
+ // 'unicorn/no-console-spaces': ERROR,
1519
+ // 'unicorn/no-document-cookie': ERROR,
1520
+ // 'unicorn/no-empty-file': ERROR,
1521
+ "unicorn/no-for-loop": OFF,
1522
+ // 'unicorn/no-hex-escape': ERROR,
1523
+ // 'unicorn/no-instanceof-array': ERROR,
1524
+ // 'unicorn/no-invalid-fetch-options': ERROR,
1525
+ // 'unicorn/no-invalid-remove-event-listener': ERROR,
1526
+ // 'unicorn/no-keyword-prefix': OFF, // 🔴
1527
+ // 'unicorn/no-lonely-if': ERROR,
1528
+ // 'unicorn/no-magic-array-flat-depth': ERROR,
1529
+ // "This is an improved version of the no-negated-condition ESLint rule that makes it automatically fixable" - Unicorn docs
1530
+ // 'no-negated-condition': OFF,
1531
+ // 'unicorn/no-negated-condition': ERROR,
1532
+ // 'unicorn/no-negation-in-equality-check': ERROR,
1533
+ "unicorn/no-nested-ternary": OFF,
1534
+ // 'unicorn/no-new-array': ERROR,
1535
+ // 'unicorn/no-new-buffer': ERROR,
1536
+ "unicorn/no-null": OFF,
1537
+ // 'unicorn/no-object-as-default-parameter': ERROR,
1538
+ "unicorn/no-process-exit": OFF,
1539
+ // Used in `node` config
1540
+ // 'unicorn/no-single-promise-in-promise-methods': ERROR,
1541
+ // 'unicorn/no-static-only-class': ERROR,
1542
+ // 'unicorn/no-thenable': ERROR,
1543
+ // 'unicorn/no-this-assignment': ERROR,
1544
+ // 'unicorn/no-typeof-undefined': ERROR,
1545
+ // 'unicorn/no-unnecessary-await': ERROR,
1546
+ // 'unicorn/no-unnecessary-polyfills': ERROR,
1547
+ "unicorn/no-unreadable-array-destructuring": OFF,
1548
+ // 'unicorn/no-unreadable-iife': ERROR,
1549
+ // 'unicorn/no-unused-properties': OFF, // 🔴
1550
+ // 'unicorn/no-useless-fallback-in-spread': ERROR,
1551
+ // 'unicorn/no-useless-length-check': ERROR,
1552
+ // 'unicorn/no-useless-promise-resolve-reject': ERROR,
1553
+ // 'unicorn/no-useless-spread': ERROR,
1554
+ // 'unicorn/no-useless-switch-case': ERROR,
1555
+ // TODO reason for disabling autofix
1556
+ ...disableAutofixForRule("unicorn/no-useless-undefined", ERROR, {
1557
+ checkArguments: false
1558
+ }),
1559
+ // 'unicorn/no-zero-fractions': ERROR,
1560
+ // 'unicorn/number-literal-case': ERROR,
1561
+ "unicorn/numeric-separators-style": [
1562
+ ERROR,
1563
+ {
1564
+ onlyIfContainsSeparator: true
1565
+ }
1566
+ ],
1567
+ // 'unicorn/prefer-add-event-listener': ERROR,
1568
+ // 'unicorn/prefer-array-find': ERROR,
1569
+ // 'unicorn/prefer-array-flat-map': ERROR,
1570
+ // 'unicorn/prefer-array-flat': ERROR,
1571
+ // 'unicorn/prefer-array-index-of': ERROR,
1572
+ // 'unicorn/prefer-array-some': ERROR,
1573
+ // 'unicorn/prefer-at': ERROR,
1574
+ // 'unicorn/prefer-blob-reading-methods': ERROR,
1575
+ // 'unicorn/prefer-code-point': ERROR,
1576
+ // 'unicorn/prefer-date-now': ERROR,
1577
+ // 'unicorn/prefer-default-parameters': ERROR,
1578
+ // 'unicorn/prefer-dom-node-append': ERROR,
1579
+ // 'unicorn/prefer-dom-node-dataset': ERROR,
1580
+ // 'unicorn/prefer-dom-node-remove': ERROR,
1581
+ "unicorn/prefer-dom-node-text-content": OFF,
1582
+ // 'unicorn/prefer-event-target': ERROR,
1583
+ "unicorn/prefer-export-from": [ERROR, { ignoreUsedVariables: true }],
1584
+ // 'unicorn/prefer-includes': ERROR,
1585
+ // 'unicorn/prefer-json-parse-buffer': ERROR,
1586
+ // 'unicorn/prefer-keyboard-event-key': ERROR,
1587
+ // 'unicorn/prefer-logical-operator-over-ternary': ERROR,
1588
+ // 'unicorn/prefer-math-trunc': ERROR,
1589
+ // 'unicorn/prefer-modern-dom-apis': ERROR,
1590
+ // 'unicorn/prefer-modern-math-apis': ERROR,
1591
+ "unicorn/prefer-module": OFF,
1592
+ // 'unicorn/prefer-native-coercion-functions': ERROR,
1593
+ // 'unicorn/prefer-negative-index': ERROR,
1594
+ "unicorn/prefer-node-protocol": OFF,
1595
+ // `n/prefer-node-protocol` seem to be better as it checks supported node versions
1596
+ // 'unicorn/prefer-number-properties': ERROR,
1597
+ // 'unicorn/prefer-object-from-entries': ERROR,
1598
+ // 'unicorn/prefer-optional-catch-binding': ERROR,
1599
+ // 'unicorn/prefer-prototype-methods': ERROR,
1600
+ "unicorn/prefer-query-selector": OFF,
1601
+ // 'unicorn/prefer-reflect-apply': ERROR,
1602
+ // 'unicorn/prefer-regexp-test': ERROR,
1603
+ // 'unicorn/prefer-set-has': ERROR,
1604
+ // 'unicorn/prefer-set-size': ERROR,
1605
+ ...disableAutofixForRule("unicorn/prefer-spread", ERROR),
1606
+ // 'unicorn/prefer-string-raw': ERROR,
1607
+ // 'unicorn/prefer-string-replace-all': ERROR,
1608
+ // 'unicorn/prefer-string-slice': ERROR,
1609
+ // 'unicorn/prefer-string-starts-ends-with': ERROR,
1610
+ // 'unicorn/prefer-string-trim-start-end': ERROR,
1611
+ // 'unicorn/prefer-structured-clone': ERROR,
1612
+ "unicorn/prefer-switch": [
1613
+ ERROR,
1614
+ {
1615
+ minimumCases: 4,
1616
+ emptyDefaultCase: "do-nothing-comment"
1617
+ }
1618
+ ],
1619
+ // 'unicorn/prefer-ternary': ERROR,
1620
+ // 'unicorn/prefer-top-level-await': ERROR,
1621
+ // 'unicorn/prefer-type-error': ERROR,
1622
+ "unicorn/prevent-abbreviations": OFF,
1623
+ "unicorn/relative-url-style": [ERROR, "always"]
1624
+ // 'unicorn/require-array-join-separator': ERROR,
1625
+ // 'unicorn/require-number-to-fixed-digits-argument': ERROR,
1626
+ // 'unicorn/require-post-message-target-origin': OFF, // 🔴
1627
+ // 'unicorn/string-content': OFF, // 🔴
1628
+ // 'unicorn/switch-case-braces': ERROR,
1629
+ // 'unicorn/template-indent': ERROR,
1630
+ // 'unicorn/text-encoding-identifier-case': ERROR,
1631
+ // 'unicorn/throw-new-error': ERROR,
1632
+ };
1633
+ return [
1634
+ {
1635
+ ...options.files && { files: options.files },
1636
+ ...options.ignores && { ignores: options.ignores },
1637
+ rules: {
1638
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
1639
+ ...import_eslint_plugin_unicorn.default.configs["flat/recommended"].rules,
1640
+ ...rules,
1641
+ ...options.overrides
1642
+ },
1643
+ name: genFlatConfigEntryName("unicorn")
1644
+ }
1645
+ ];
1646
+ };
1647
+
1648
+ // src/configs/vue.ts
1649
+ init_cjs_shims();
1650
+ var import_eslint_plugin_pinia = __toESM(require("eslint-plugin-pinia"), 1);
1651
+ var import_eslint_plugin_vue = __toESM(require("eslint-plugin-vue"), 1);
1652
+ var import_eslint_plugin_vuejs_accessibility = __toESM(require("eslint-plugin-vuejs-accessibility"), 1);
1653
+ var import_globals = __toESM(require("globals"), 1);
1654
+ var import_vue_eslint_parser = __toESM(require("vue-eslint-parser"), 1);
1655
+ var DEPRECATED_HTML_TAGS = [
1656
+ "acronym",
1657
+ "big",
1658
+ "center",
1659
+ "content",
1660
+ "dir",
1661
+ "font",
1662
+ "frame",
1663
+ "frameset",
1664
+ "image",
1665
+ "marquee",
1666
+ "menuitem",
1667
+ "nobr",
1668
+ "noembed",
1669
+ "noframes",
1670
+ "param",
1671
+ "plaintext",
1672
+ "rb",
1673
+ "rtc",
1674
+ "shadow",
1675
+ "strike",
1676
+ "tt",
1677
+ "xmp"
1678
+ ];
1679
+ var vueEslintConfig = (options, internalOptions = {}) => {
1680
+ const { majorVersion, enforceTypescriptInScriptSection, a11y = true } = options;
1681
+ const files = options.files || [GLOB_VUE];
1682
+ const vueMajorAndMinorVersion = Number.parseFloat(options.fullVersion || "");
1683
+ const isVue2 = majorVersion === 2;
1684
+ const isVue3 = majorVersion === 3;
1685
+ const isMin3_3 = isVue3 && vueMajorAndMinorVersion >= 3.3;
1686
+ const isMin3_4 = isVue3 && vueMajorAndMinorVersion >= 3.4;
1687
+ const isLess2_5 = isVue2 && vueMajorAndMinorVersion < 2.5;
1688
+ const isLess2_6 = isVue2 && vueMajorAndMinorVersion < 2.6;
1689
+ const isLess3_1 = vueMajorAndMinorVersion < 3.1;
1690
+ const recommendedRules = (
1691
+ // TODO report to Prettier?
1692
+ // prettier-ignore
1693
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
1694
+ import_eslint_plugin_vue.default.configs[isVue3 ? "flat/recommended" : "flat/vue2-recommended"].find(
1695
+ (entry) => entry.name === "vue:recommended:rules" || entry.name === "vue:vue2-recommended:rules"
1696
+ )?.rules
1697
+ );
1698
+ const rules = {
1699
+ // 🔵 Disable deprecated rules from Recommended
1700
+ "vue/component-tags-order": OFF,
1701
+ // 🔵 Base
1702
+ "vue/comment-directive": [
1703
+ ERROR,
1704
+ { reportUnusedDisableDirectives: true }
1705
+ // false by default
1706
+ ],
1707
+ // 'vue/jsx-uses-vars': ERROR,
1708
+ // 🔵 Priority A: Essential
1709
+ // 'vue/multi-word-component-names': ERROR,
1710
+ // 'vue/no-arrow-functions-in-watch': ERROR,
1711
+ // 'vue/no-async-in-computed-properties': ERROR,
1712
+ // 'vue/no-child-content': ERROR,
1713
+ // 'vue/no-computed-properties-in-data': ERROR,
1714
+ // 'vue/no-deprecated-data-object-declaration': ERROR, // 3️⃣
1715
+ // 'vue/no-deprecated-destroyed-lifecycle': ERROR, // 3️⃣
1716
+ // 'vue/no-deprecated-dollar-listeners-api': ERROR, // 3️⃣
1717
+ // 'vue/no-deprecated-dollar-scopedslots-api': ERROR, // 3️⃣
1718
+ // 'vue/no-deprecated-events-api': ERROR, // 3️⃣
1719
+ // 'vue/no-deprecated-filter': ERROR, // 3️⃣
1720
+ // 'vue/no-deprecated-functional-template': ERROR, // 3️⃣
1721
+ // 'vue/no-deprecated-html-element-is': ERROR, // 3️⃣
1722
+ // 'vue/no-deprecated-inline-template': ERROR, // 3️⃣
1723
+ // 'vue/no-deprecated-props-default-this': ERROR, // 3️⃣
1724
+ // 'vue/no-deprecated-router-link-tag-prop': ERROR, // 3️⃣
1725
+ "vue/no-deprecated-scope-attribute": isLess2_5 ? OFF : ERROR,
1726
+ // 3️⃣ deprecated in 2.5.0
1727
+ "vue/no-deprecated-slot-attribute": isLess2_6 ? OFF : ERROR,
1728
+ // 3️⃣ deprecated in 2.6.0
1729
+ "vue/no-deprecated-slot-scope-attribute": isLess2_6 ? OFF : ERROR,
1730
+ // 3️⃣ deprecated in 2.6.0
1731
+ // 'vue/no-deprecated-v-bind-sync': ERROR, // 3️⃣
1732
+ "vue/no-deprecated-v-is": isLess3_1 ? OFF : ERROR,
1733
+ // 3️⃣ deprecated in 3.1.0
1734
+ // 'vue/no-deprecated-v-on-native-modifier': ERROR, // 3️⃣
1735
+ // 'vue/no-deprecated-v-on-number-modifiers': ERROR, // 3️⃣
1736
+ // 'vue/no-deprecated-vue-config-keycodes': ERROR, // 3️⃣
1737
+ // 'vue/no-dupe-keys': ERROR,
1738
+ // 'vue/no-dupe-v-else-if': ERROR,
1739
+ // 'vue/no-duplicate-attributes': ERROR,
1740
+ // 'vue/no-export-in-script-setup': ERROR,
1741
+ // 'vue/no-expose-after-await': ERROR, // 3️⃣
1742
+ // 'vue/no-lifecycle-after-await': ERROR, // 3️⃣
1743
+ // 'vue/no-mutating-props': ERROR,
1744
+ // 'vue/no-parsing-error': ERROR,
1745
+ // 'vue/no-ref-as-operand': ERROR,
1746
+ // 'vue/no-reserved-component-names': ERROR,
1747
+ // 'vue/no-reserved-keys': ERROR,
1748
+ // 'vue/no-reserved-props': ERROR,
1749
+ // 'vue/no-shared-component-data': ERROR,
1750
+ // 'vue/no-side-effects-in-computed-properties': ERROR,
1751
+ // 'vue/no-template-key': ERROR,
1752
+ // 'vue/no-textarea-mustache': ERROR,
1753
+ // 'vue/no-unused-components': ERROR,
1754
+ // 'vue/no-unused-vars': ERROR,
1755
+ // 'vue/no-use-computed-property-like-method': ERROR,
1756
+ // 'vue/no-use-v-if-with-v-for': ERROR,
1757
+ // 'vue/no-useless-template-attributes': ERROR,
1758
+ // 'vue/no-v-for-template-key-on-child': ERROR, // 3️⃣
1759
+ // 'vue/no-v-text-v-html-on-component': ERROR,
1760
+ // 'vue/no-watch-after-await': ERROR, // 3️⃣
1761
+ // 'vue/prefer-import-from-vue': ERROR, // 3️⃣
1762
+ // 'vue/require-component-is': ERROR,
1763
+ // 'vue/require-prop-type-constructor': ERROR,
1764
+ // 'vue/require-render-return': ERROR,
1765
+ // 'vue/require-slots-as-functions': ERROR, // 3️⃣
1766
+ // 'vue/require-toggle-inside-transition': ERROR, // 3️⃣
1767
+ // 'vue/require-v-for-key': ERROR,
1768
+ // 'vue/require-valid-default-prop': ERROR,
1769
+ // 'vue/return-in-computed-property': ERROR,
1770
+ // 'vue/return-in-emits-validator': ERROR,
1771
+ // 'vue/use-v-on-exact': ERROR,
1772
+ // 'vue/valid-attribute-name': ERROR,
1773
+ // 'vue/valid-define-emits': ERROR,
1774
+ // 'vue/valid-define-props': ERROR,
1775
+ // 'vue/valid-next-tick': ERROR,
1776
+ // 'vue/valid-template-root': ERROR,
1777
+ // 'vue/valid-v-bind': ERROR,
1778
+ // 'vue/valid-v-cloak': ERROR,
1779
+ // 'vue/valid-v-else-if': ERROR,
1780
+ // 'vue/valid-v-else': ERROR,
1781
+ // 'vue/valid-v-for': ERROR,
1782
+ // 'vue/valid-v-html': ERROR,
1783
+ // 'vue/valid-v-if': ERROR,
1784
+ // 'vue/valid-v-is': ERROR, // 3️⃣
1785
+ // 'vue/valid-v-memo': ERROR, // 3️⃣
1786
+ // 'vue/valid-v-model': ERROR,
1787
+ // 'vue/valid-v-on': ERROR,
1788
+ // 'vue/valid-v-once': ERROR,
1789
+ // 'vue/valid-v-pre': ERROR,
1790
+ // 'vue/valid-v-show': ERROR,
1791
+ // 'vue/valid-v-slot': ERROR,
1792
+ // 'vue/valid-v-text': ERROR,
1793
+ // 🔵 Priority B: Strongly Recommended
1794
+ // 'vue/attribute-hyphenation': ERROR,
1795
+ // 'vue/component-definition-name-casing': ERROR,
1796
+ // 'vue/first-attribute-linebreak': ERROR,
1797
+ // 'vue/html-closing-bracket-newline': ERROR,
1798
+ // 'vue/html-closing-bracket-spacing': ERROR,
1799
+ // 'vue/html-end-tags': ERROR,
1800
+ // 'vue/html-indent': ERROR,
1801
+ // 'vue/html-quotes': ERROR,
1802
+ "vue/html-self-closing": [
1803
+ ERROR,
1804
+ {
1805
+ html: {
1806
+ void: "any",
1807
+ // TODO Setting other value here for `void` would conflict with Prettier, default is `never`
1808
+ normal: "never",
1809
+ component: "never"
1810
+ }
1811
+ }
1812
+ ],
1813
+ // 'vue/max-attributes-per-line': ERROR,
1814
+ // 'vue/multiline-html-element-content-newline': ERROR,
1815
+ // 'vue/mustache-interpolation-spacing': ERROR,
1816
+ // 'vue/no-multi-spaces': ERROR,
1817
+ // 'vue/no-spaces-around-equal-signs-in-attribute': ERROR,
1818
+ // 'vue/no-template-shadow': ERROR,
1819
+ // 'vue/one-component-per-file': ERROR,
1820
+ // 'vue/prop-name-casing': ERROR,
1821
+ "vue/require-default-prop": OFF,
1822
+ // 'vue/require-explicit-emits': ERROR, // 3️⃣
1823
+ // 'vue/require-prop-types': ERROR,
1824
+ // 'vue/singleline-html-element-content-newline': ERROR,
1825
+ "vue/v-bind-style": [
1826
+ ERROR,
1827
+ "shorthand",
1828
+ {
1829
+ ...isMin3_4 && { sameNameShorthand: "always" }
1830
+ }
1831
+ ],
1832
+ // 'vue/v-on-event-hyphenation': ERROR, // 3️⃣
1833
+ // 'vue/v-on-style': ERROR,
1834
+ // 'vue/v-slot-style': ERROR,
1835
+ // 🔵 Priority C: Recommended
1836
+ // 'vue/attributes-order': ERROR,
1837
+ // 'vue/no-lone-template': ERROR,
1838
+ // 'vue/no-multiple-slot-args': ERROR,
1839
+ // 'vue/no-v-html': ERROR,
1840
+ // 'vue/order-in-components': ERROR,
1841
+ // 'vue/this-in-template': ERROR,
1842
+ // 🔵 Uncategorized
1843
+ "vue/block-lang": [
1844
+ ERROR,
1845
+ {
1846
+ script: {
1847
+ lang: "ts",
1848
+ ...!enforceTypescriptInScriptSection && { allowNoLang: true }
1849
+ }
1850
+ }
1851
+ ],
1852
+ "vue/block-order": [
1853
+ ERROR,
1854
+ {
1855
+ order: [
1856
+ ...Array.isArray(options.sfcBlockOrder) ? options.sfcBlockOrder : options.sfcBlockOrder === "script-first" ? ["script:not([setup])", "script[setup]", "template"] : ["template", "script:not([setup])", "script[setup]"],
1857
+ "style:not([scoped])",
1858
+ // TODO move to top?
1859
+ "style[scoped]"
1860
+ ]
1861
+ }
1862
+ ],
1863
+ // 'vue/block-tag-newline': OFF,
1864
+ ...options.enforceApiStyle != null && {
1865
+ "vue/component-api-style": [
1866
+ ERROR,
1867
+ [
1868
+ options.enforceApiStyle === "setup" ? "script-setup" : "options",
1869
+ // allows Composition API (not <script setup>)
1870
+ isVue2 ? "composition-vue2" : "composition"
1871
+ ]
1872
+ ]
1873
+ },
1874
+ "vue/component-name-in-template-casing": [
1875
+ ERROR,
1876
+ "kebab-case",
1877
+ {
1878
+ registeredComponentsOnly: false,
1879
+ ignores: [
1880
+ "/^[A-Z][a-z]+$/"
1881
+ /* Single word components must start with a capital letter */
1882
+ ]
1883
+ }
1884
+ ],
1885
+ "vue/component-options-name-casing": [
1886
+ ERROR,
1887
+ "PascalCase"
1888
+ /* default */
1889
+ ],
1890
+ "vue/custom-event-name-casing": [
1891
+ ERROR,
1892
+ "kebab-case"
1893
+ /* default is `camelCase` */
1894
+ ],
1895
+ "vue/define-emits-declaration": [
1896
+ ERROR,
1897
+ isMin3_3 ? "type-literal" : "type-based"
1898
+ ],
1899
+ "vue/define-macros-order": [
1900
+ ERROR,
1901
+ {
1902
+ order: ["defineOptions", "defineModel", "defineProps", "defineEmits", "defineSlots"],
1903
+ ...isMin3_4 && { defineExposeLast: true }
1904
+ }
1905
+ ],
1906
+ "vue/define-props-declaration": [ERROR, options.enforcePropsDeclarationStyle ?? "runtime"],
1907
+ // 'vue/enforce-style-attribute': OFF,
1908
+ "vue/html-button-has-type": ERROR,
1909
+ // 'vue/html-comment-content-newline': OFF,
1910
+ // 'vue/html-comment-content-spacing': OFF,
1911
+ // 'vue/html-comment-indent': OFF,
1912
+ // 'vue/match-component-file-name': OFF,
1913
+ // 'vue/match-component-import-name': OFF,
1914
+ // 'vue/max-lines-per-block': OFF,
1915
+ // 'vue/new-line-between-multi-line-property': OFF,
1916
+ // 'vue/next-tick-style': OFF,
1917
+ // 'vue/no-bare-strings-in-template': OFF,
1918
+ // For explicitness (Vue uses `false` as default value automatically)
1919
+ "vue/no-boolean-default": [ERROR, "default-false"],
1920
+ ...isVue3 && { "vue/no-deprecated-model-definition": ERROR },
1921
+ "vue/no-duplicate-attr-inheritance": ERROR,
1922
+ "vue/no-empty-component-block": ERROR,
1923
+ "vue/no-multiple-objects-in-class": ERROR,
1924
+ "vue/no-potential-component-option-typo": ERROR,
1925
+ "vue/no-ref-object-reactivity-loss": ERROR,
1926
+ "vue/no-required-prop-with-default": ERROR,
1927
+ // 'vue/no-restricted-block': OFF,
1928
+ // 'vue/no-restricted-call-after-await': OFF,
1929
+ // 'vue/no-restricted-class': OFF,
1930
+ // 'vue/no-restricted-component-names': OFF,
1931
+ // 'vue/no-restricted-component-options': OFF,
1932
+ // 'vue/no-restricted-custom-event': OFF,
1933
+ "vue/no-restricted-html-elements": [ERROR, ...DEPRECATED_HTML_TAGS],
1934
+ // 'vue/no-restricted-props': OFF,
1935
+ // 'vue/no-restricted-static-attribute': OFF,
1936
+ // 'vue/no-restricted-v-bind': OFF,
1937
+ // 'vue/no-restricted-v-on': OFF,
1938
+ // 'vue/no-root-v-if': OFF,
1939
+ "vue/no-setup-props-reactivity-loss": ERROR,
1940
+ // 'vue/no-static-inline-styles': OFF,
1941
+ // 'vue/no-template-target-blank': OFF,
1942
+ "vue/no-this-in-before-route-enter": ERROR,
1943
+ "vue/no-undef-components": [
1944
+ ERROR,
1945
+ {
1946
+ ignorePatterns: [...options.knownComponentNames || []]
1947
+ }
1948
+ ],
1949
+ // TODO enable if script setup is enforced?
1950
+ // 'vue/no-undef-properties': OFF,
1951
+ "vue/no-unsupported-features": [ERROR, { version: `^${options.fullVersion || majorVersion}` }],
1952
+ "vue/no-unused-emit-declarations": ERROR,
1953
+ // 'vue/no-unused-properties': OFF,
1954
+ "vue/no-unused-refs": ERROR,
1955
+ "vue/no-use-v-else-with-v-for": ERROR,
1956
+ "vue/no-useless-mustaches": ERROR,
1957
+ "vue/no-useless-v-bind": ERROR,
1958
+ // 'vue/no-v-text': OFF,
1959
+ "vue/padding-line-between-blocks": ERROR,
1960
+ // 'vue/padding-line-between-tags': OFF,
1961
+ "vue/padding-lines-in-component-definition": [
1962
+ ERROR,
1963
+ {
1964
+ withinOption: {
1965
+ // TODO understand the difference between `betweenItems` and `withinEach`: https://eslint.vuejs.org/rules/padding-lines-in-component-definition.html
1966
+ props: "ignore"
1967
+ }
1968
+ }
1969
+ ],
1970
+ ...isMin3_3 && {
1971
+ "vue/prefer-define-options": ERROR
1972
+ },
1973
+ "vue/prefer-prop-type-boolean-first": ERROR,
1974
+ "vue/prefer-separate-static-class": ERROR,
1975
+ "vue/prefer-true-attribute-shorthand": ERROR,
1976
+ "vue/require-direct-export": ERROR,
1977
+ // 'vue/require-emit-validator': OFF,
1978
+ ...isMin3_3 && {
1979
+ "vue/require-explicit-slots": ERROR
1980
+ },
1981
+ // 'vue/require-expose': OFF,
1982
+ "vue/require-macro-variable-name": ERROR,
1983
+ // 'vue/require-name-property': OFF,
1984
+ // 'vue/require-prop-comment': OFF,
1985
+ "vue/require-typed-object-prop": ERROR,
1986
+ "vue/require-typed-ref": ERROR,
1987
+ // 'vue/script-indent': OFF,
1988
+ // 'vue/sort-keys': OFF,
1989
+ // 'vue/static-class-names-order': OFF,
1990
+ "vue/v-for-delimiter-style": [
1991
+ ERROR,
1992
+ "in"
1993
+ /* default */
1994
+ ],
1995
+ // This rule is not required in Vue 3, as the key is automatically assigned to the elements.
1996
+ ...isVue2 && {
1997
+ "vue/v-for-delimiter-style": ERROR
1998
+ },
1999
+ // TODO change to [inline, inline-function] once this is landed: https://github.com/vuejs/eslint-plugin-vue/issues/2460
2000
+ "vue/v-on-handler-style": [ERROR, "inline"],
2001
+ ...isMin3_3 && {
2002
+ "vue/valid-define-options": ERROR
2003
+ },
2004
+ // 🔵 Extension Rules
2005
+ // 'vue/array-bracket-newline': OFF,
2006
+ // 'vue/array-bracket-spacing': OFF,
2007
+ // 'vue/array-element-newline': OFF,
2008
+ // 'vue/arrow-spacing': OFF,
2009
+ // 'vue/block-spacing': OFF,
2010
+ // 'vue/brace-style': OFF,
2011
+ "vue/camelcase": [ERROR, RULE_CAMELCASE_OPTIONS],
2012
+ // 'vue/comma-dangle': OFF,
2013
+ // 'vue/comma-spacing': OFF,
2014
+ // 'vue/comma-style': OFF,
2015
+ // 'vue/dot-location': OFF,
2016
+ ...!options.noPropertyAccessFromIndexSignatureSetInTsconfigForVueFiles && {
2017
+ "vue/dot-notation": ERROR
2018
+ },
2019
+ "vue/eqeqeq": [ERROR, ...RULE_EQEQEQ_OPTIONS],
2020
+ // 'vue/func-call-spacing': OFF,
2021
+ // 'vue/key-spacing': OFF,
2022
+ // 'vue/keyword-spacing': OFF,
2023
+ // 'vue/max-len': OFF,
2024
+ // 'vue/multiline-ternary': OFF,
2025
+ "vue/no-console": ERROR,
2026
+ ...warnUnlessForcedError(internalOptions, "vue/no-constant-condition"),
2027
+ "vue/no-empty-pattern": ERROR,
2028
+ // 'vue/no-extra-parens': OFF,
2029
+ "vue/no-irregular-whitespace": ERROR,
2030
+ "vue/no-loss-of-precision": ERROR,
2031
+ // 'vue/no-restricted-syntax': OFF,
2032
+ "vue/no-sparse-arrays": ERROR,
2033
+ "vue/no-useless-concat": ERROR,
2034
+ // 'vue/object-curly-newline': OFF,
2035
+ // 'vue/object-curly-spacing': OFF,
2036
+ // 'vue/object-property-newline': OFF,
2037
+ "vue/object-shorthand": ERROR,
2038
+ // 'vue/operator-linebreak': OFF,
2039
+ "vue/prefer-template": ERROR,
2040
+ // 'vue/quote-props': OFF,
2041
+ // 'vue/space-in-parens': OFF,
2042
+ // 'vue/space-infix-ops': OFF,
2043
+ // 'vue/space-unary-ops': OFF,
2044
+ // 'vue/template-curly-spacing': OFF,
2045
+ // 🔵 Not working great in Vue files
2046
+ "@typescript-eslint/prefer-function-type": OFF,
2047
+ "@typescript-eslint/unified-signatures": OFF,
2048
+ "import/first": OFF,
2049
+ // May be wrong if multiple <script> blocks are present
2050
+ "import/no-default-export": OFF,
2051
+ "no-useless-assignment": OFF,
2052
+ // False positives in script setup
2053
+ ...options.overrides
2054
+ };
2055
+ const isNuxtEnabled = Boolean(options.nuxtMajorVersion);
2056
+ const nuxtLayoutsFiles = `${options.nuxtOrVueProjectDir}layouts/**/*.vue`;
2057
+ return [
2058
+ {
2059
+ plugins: {
2060
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
2061
+ vue: import_eslint_plugin_vue.default
2062
+ },
2063
+ name: genFlatConfigEntryName("vue/setup")
2064
+ },
2065
+ {
2066
+ files: [GLOB_VUE, ...files],
2067
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
2068
+ processor: import_eslint_plugin_vue.default.processors[".vue"],
2069
+ languageOptions: {
2070
+ globals: import_globals.default.browser,
2071
+ parser: import_vue_eslint_parser.default,
2072
+ parserOptions: {
2073
+ ecmaFeatures: {
2074
+ jsx: true
2075
+ },
2076
+ extraFileExtensions: [".vue"],
2077
+ parser: internalOptions.isTypescriptEnabled ? "@typescript-eslint/parser" : void 0,
2078
+ sourceType: "module"
2079
+ }
2080
+ },
2081
+ name: genFlatConfigEntryName("vue/setup")
2082
+ },
2083
+ {
2084
+ files,
2085
+ ...options.ignores && { ignores: options.ignores },
2086
+ rules: {
2087
+ ...recommendedRules,
2088
+ ...rules,
2089
+ ...options.overrides
2090
+ },
2091
+ name: genFlatConfigEntryName("vue")
2092
+ },
2093
+ {
2094
+ files: [
2095
+ `${options.nuxtOrVueProjectDir}pages/**/*.vue`,
2096
+ `${options.nuxtOrVueProjectDir}views/**/*.vue`,
2097
+ isNuxtEnabled && [nuxtLayoutsFiles, "app.vue", "error.vue"],
2098
+ ...arraify(options.doNotRequireComponentNamesToBeMultiWordForPatterns)
2099
+ ].filter((v) => v !== false),
2100
+ rules: {
2101
+ "vue/multi-word-component-names": OFF
2102
+ },
2103
+ name: genFlatConfigEntryName("vue/allow-single-word-component-names")
2104
+ },
2105
+ isNuxtEnabled && {
2106
+ files: [nuxtLayoutsFiles],
2107
+ rules: {
2108
+ "vue/require-explicit-slots": OFF
2109
+ },
2110
+ name: genFlatConfigEntryName("vue/allow-implicit-slots")
2111
+ },
2112
+ {
2113
+ files: [
2114
+ GLOB_VUE,
2115
+ isNuxtEnabled && [
2116
+ `${options.nuxtOrVueProjectDir}plugins/**/*.*`,
2117
+ `${options.nuxtOrVueProjectDir}server/**/*.*`
2118
+ ]
2119
+ ].filter((v) => v !== false),
2120
+ rules: {
2121
+ "import/no-default-export": OFF
2122
+ },
2123
+ name: genFlatConfigEntryName("vue/allow-default-export")
2124
+ },
2125
+ a11y && [
2126
+ ...import_eslint_plugin_vuejs_accessibility.default.configs["flat/recommended"],
2127
+ {
2128
+ files,
2129
+ rules: {
2130
+ // 'vuejs-accessibility/alt-text': ERROR,
2131
+ // 'vuejs-accessibility/anchor-has-content': ERROR,
2132
+ // 'vuejs-accessibility/aria-props': ERROR,
2133
+ // 'vuejs-accessibility/aria-role': ERROR,
2134
+ // 'vuejs-accessibility/aria-unsupported-elements': ERROR,
2135
+ // 'vuejs-accessibility/click-events-have-key-events': ERROR,
2136
+ // 'vuejs-accessibility/form-control-has-label': ERROR,
2137
+ // 'vuejs-accessibility/heading-has-content': ERROR,
2138
+ // 'vuejs-accessibility/iframe-has-title': ERROR,
2139
+ // 'vuejs-accessibility/interactive-supports-focus': ERROR,
2140
+ // 'vuejs-accessibility/label-has-for': ERROR,
2141
+ // 'vuejs-accessibility/media-has-caption': ERROR,
2142
+ // 'vuejs-accessibility/mouse-events-have-key-events': ERROR,
2143
+ // 'vuejs-accessibility/no-access-key': ERROR,
2144
+ // 'vuejs-accessibility/no-autofocus': ERROR,
2145
+ // 'vuejs-accessibility/no-distracting-elements': ERROR,
2146
+ // 'vuejs-accessibility/no-onchange': ERROR,
2147
+ // 'vuejs-accessibility/no-redundant-roles': ERROR,
2148
+ // 'vuejs-accessibility/no-static-element-interactions': ERROR,
2149
+ // 'vuejs-accessibility/role-has-required-aria-props': ERROR,
2150
+ // 'vuejs-accessibility/tabindex-no-positive': ERROR,
2151
+ ...options.overridesA11y
2152
+ },
2153
+ name: genFlatConfigEntryName("vue/a11y")
2154
+ }
2155
+ ],
2156
+ options.pinia && {
2157
+ plugins: {
2158
+ pinia: import_eslint_plugin_pinia.default
2159
+ },
2160
+ rules: {
2161
+ ...import_eslint_plugin_pinia.default.configs.recommended.rules,
2162
+ // 'pinia/never-export-initialized-store': ERROR,
2163
+ // 'pinia/no-duplicate-store-ids': ERROR,
2164
+ // 'pinia/no-return-global-properties': ERROR,
2165
+ "pinia/prefer-single-store-per-file": ERROR,
2166
+ "pinia/prefer-use-store-naming-convention": [
2167
+ ERROR,
2168
+ {
2169
+ checkStoreNameMismatch: true
2170
+ }
2171
+ ],
2172
+ // 'pinia/require-setup-store-properties-export': ERROR,
2173
+ ...options.overridesPinia
2174
+ },
2175
+ name: genFlatConfigEntryName("pinia")
2176
+ }
2177
+ ].flat().filter((v) => !!v);
2178
+ };
2179
+
2180
+ // src/index.ts
2181
+ var RULES_NOT_TO_DISABLE_IN_CONFIG_PRETTIER = /* @__PURE__ */ new Set(["curly", "unicorn/template-indent"]);
2182
+ var eslintConfig = (options = {}) => {
2183
+ const configsOptions = options.configs || {};
2184
+ const isVueEnabled = configsOptions.vue !== false && (Boolean(configsOptions.vue) || (0, import_local_pkg.isPackageExists)("vue"));
2185
+ const typescriptPackageInfo = (0, import_local_pkg.getPackageInfoSync)("typescript");
2186
+ const isTypescriptEnabled = configsOptions.ts !== false && Boolean(configsOptions.ts || typescriptPackageInfo);
2187
+ const jsOptions = {
2188
+ ...assignOptions(configsOptions, "js")
2189
+ };
2190
+ const tsOptions = {
2191
+ extraFileExtensions: [isVueEnabled && "vue"].filter((v) => v !== false),
2192
+ typescriptVersion: typescriptPackageInfo?.version,
2193
+ ...assignOptions(configsOptions, "ts")
2194
+ };
2195
+ tsOptions.tsconfigPath ||= "./**/tsconfig*.json";
2196
+ const vueFullVersion = (0, import_local_pkg.getPackageInfoSync)("vue")?.version;
2197
+ const vueMajorVersionStr = vueFullVersion?.split(".")[0];
2198
+ const vueMajorVersion = vueMajorVersionStr === "2" ? 2 : vueMajorVersionStr === "3" ? 3 : void 0;
2199
+ const nuxtMajorVersionStr = (0, import_local_pkg.getPackageInfoSync)("nuxt")?.version?.split(".")[0];
2200
+ const nuxtMajorVersion = nuxtMajorVersionStr === "3" ? 3 : void 0;
2201
+ const vueOptions = {
2202
+ majorVersion: vueMajorVersion ?? 3,
2203
+ fullVersion: vueFullVersion,
2204
+ nuxtMajorVersion,
2205
+ pinia: (0, import_local_pkg.isPackageExists)("pinia"),
2206
+ enforceTypescriptInScriptSection: isTypescriptEnabled,
2207
+ ...assignOptions(configsOptions, "vue")
2208
+ };
2209
+ const isUnicornEnabled = Boolean(configsOptions.unicorn ?? true);
2210
+ const unicornOptions = {
2211
+ ...assignOptions(configsOptions, "unicorn")
2212
+ };
2213
+ const isImportEnabled = Boolean(configsOptions.import ?? true);
2214
+ const importOptions = {
2215
+ ...isTypescriptEnabled && { tsconfigPath: tsOptions.tsconfigPath },
2216
+ ...assignOptions(configsOptions, "import")
2217
+ };
2218
+ const isNodeEnabled = Boolean(configsOptions.node ?? true);
2219
+ const nodeOptions = {
2220
+ ...assignOptions(configsOptions, "node")
2221
+ };
2222
+ const isPromiseEnabled = Boolean(configsOptions.promise ?? true);
2223
+ const promiseOptions = {
2224
+ ...assignOptions(configsOptions, "promise")
2225
+ };
2226
+ const isSonarEnabled = Boolean(configsOptions.sonar ?? true);
2227
+ const sonarOptions = {
2228
+ ...assignOptions(configsOptions, "sonar")
2229
+ };
2230
+ const isTailwindEnabled = configsOptions.tailwind === false ? false : configsOptions.tailwind ? true : (0, import_local_pkg.isPackageExists)("tailwindcss");
2231
+ const tailwindOptions = {
2232
+ ...assignOptions(configsOptions, "tailwind")
2233
+ };
2234
+ const isRegexpEnabled = Boolean(configsOptions.regexp ?? true);
2235
+ const regexpOptions = {
2236
+ ...assignOptions(configsOptions, "regexp")
2237
+ };
2238
+ const isSecurityEnabled = Boolean(configsOptions.security ?? false);
2239
+ const securityOptions = {
2240
+ ...assignOptions(configsOptions, "security")
2241
+ };
2242
+ const internalOptions = {
2243
+ globalOptions: options,
2244
+ isTypescriptEnabled,
2245
+ vueOptions
2246
+ };
2247
+ return [
2248
+ // According to ESLint docs: "If `ignores` is used without any other keys in the configuration object, then the patterns act as global ignores <...> Patterns are added after the default patterns, which are ["**/node_modules/", ".git/"]." - https://eslint.org/docs/latest/use/configure/configuration-files#globally-ignoring-files-with-ignores
2249
+ {
2250
+ ignores: options.ignores || ["**/dist"],
2251
+ name: genFlatConfigEntryName("global-ignores")
2252
+ },
2253
+ {
2254
+ plugins: {
2255
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
2256
+ "disable-autofix": import_eslint_plugin_disable_autofix.default,
2257
+ // Used in multiple configs and we can't define plugin multiple times
2258
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
2259
+ unicorn: import_eslint_plugin_unicorn2.default,
2260
+ "@stylistic": import_eslint_plugin.default
2261
+ },
2262
+ languageOptions: {
2263
+ ecmaVersion: "latest",
2264
+ sourceType: "module",
2265
+ parserOptions: {
2266
+ ecmaVersion: "latest",
2267
+ ecmaFeatures: {
2268
+ jsx: true
2269
+ },
2270
+ sourceType: "module"
2271
+ },
2272
+ globals: {
2273
+ ...isNodeEnabled && import_globals2.default.node
2274
+ }
2275
+ },
2276
+ name: genFlatConfigEntryName("global-setup")
2277
+ },
2278
+ jsEslintConfig(jsOptions, internalOptions),
2279
+ isUnicornEnabled && unicornEslintConfig(unicornOptions, internalOptions),
2280
+ isImportEnabled && importEslintConfig(importOptions, internalOptions),
2281
+ isNodeEnabled && nodeEslintConfig(nodeOptions, internalOptions),
2282
+ isPromiseEnabled && promiseEslintConfig(promiseOptions, internalOptions),
2283
+ isSonarEnabled && sonarEslintConfig(sonarOptions, internalOptions),
2284
+ isTailwindEnabled && tailwindEslintConfig(tailwindOptions, internalOptions),
2285
+ isRegexpEnabled && regexpEslintConfig(regexpOptions, internalOptions),
2286
+ isSecurityEnabled && securityEslintConfig(securityOptions, internalOptions),
2287
+ isTypescriptEnabled && tsEslintConfig(tsOptions, internalOptions),
2288
+ // Must come after all rulesets for vanilla JS
2289
+ isVueEnabled && vueEslintConfig(vueOptions, internalOptions),
2290
+ // Must come after ts
2291
+ {
2292
+ files: GLOB_CONFIG_FILES,
2293
+ rules: {
2294
+ "import/no-default-export": OFF,
2295
+ "import/no-extraneous-dependencies": OFF,
2296
+ "n/no-unpublished-require": OFF
2297
+ },
2298
+ name: genFlatConfigEntryName("config-files")
2299
+ },
2300
+ ...options.extraConfigs || [],
2301
+ // MUST be last
2302
+ !options.disablePrettierIncompatibleRules && {
2303
+ rules: Object.fromEntries(
2304
+ Object.entries(import_eslint_config_prettier.default.rules).filter(
2305
+ ([k]) => !RULES_NOT_TO_DISABLE_IN_CONFIG_PRETTIER.has(k)
2306
+ )
2307
+ ),
2308
+ name: genFlatConfigEntryName("eslint-config-prettier")
2309
+ }
2310
+ ].filter((v) => !!v).flat();
2311
+ };
2312
+ // Annotate the CommonJS export names for ESM import in node:
2313
+ 0 && (module.exports = {
2314
+ eslintConfig
2315
+ });