@rotki/eslint-config 1.1.2 → 2.1.0

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