@rotki/eslint-config 1.1.2 → 2.0.0

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