@iqrf/eslint-config 0.3.0 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.d.ts +81 -376
  2. package/dist/index.js +807 -1232
  3. package/package.json +11 -11
package/dist/index.js CHANGED
@@ -1,1264 +1,839 @@
1
- // src/index.ts
2
- import fs from "fs";
1
+ import fs from "node:fs";
3
2
  import configGitignore from "eslint-config-flat-gitignore";
4
-
5
- // src/configs/comments.ts
6
3
  import pluginEslintComments from "eslint-plugin-eslint-comments";
7
- var comments = [
8
- {
9
- plugins: {
10
- "eslint-comments": pluginEslintComments
11
- },
12
- rules: {
13
- "eslint-comments/no-aggregating-enable": "error",
14
- "eslint-comments/no-duplicate-disable": "error",
15
- "eslint-comments/no-unlimited-disable": "error",
16
- "eslint-comments/no-unused-enable": "error"
17
- }
18
- }
19
- ];
20
-
21
- // src/configs/cypress.ts
22
4
  import pluginCypress from "eslint-plugin-cypress/flat";
23
- var cypress = [
24
- pluginCypress.configs.recommended
25
- ];
26
-
27
- // src/configs/imports.ts
28
- import path from "path";
29
- import process2 from "process";
5
+ import path from "node:path";
6
+ import process$1 from "node:process";
30
7
  import pluginImport from "eslint-plugin-import-x";
31
- var commonRules = (options) => ({
32
- "import-x/consistent-type-specifier-style": [
33
- "error",
34
- "prefer-inline"
35
- ],
36
- "import-x/no-named-as-default-member": "off",
37
- "import-x/no-unresolved": [
38
- "warn",
39
- options.vue ? {
40
- ignore: ["^virtual:"]
41
- } : {}
42
- ],
43
- "import-x/order": [
44
- "error",
45
- {
46
- "alphabetize": {
47
- "order": "asc",
48
- "caseInsensitive": true
49
- },
50
- "pathGroups": [
51
- {
52
- "pattern": "@/**",
53
- "group": "internal"
54
- }
55
- ],
56
- "groups": [
57
- "builtin",
58
- "external",
59
- "internal",
60
- "parent",
61
- "sibling",
62
- "index",
63
- "object",
64
- "type"
65
- ],
66
- "newlines-between": "always"
67
- }
68
- ]
69
- });
70
- var imports = (options) => [
71
- options.typescript ? {
72
- languageOptions: {
73
- ecmaVersion: 2022,
74
- parserOptions: {
75
- ecmaVersion: 2022,
76
- sourceType: "module"
77
- }
78
- },
79
- plugins: {
80
- "import-x": pluginImport
81
- },
82
- rules: {
83
- ...pluginImport.configs.recommended.rules,
84
- ...pluginImport.configs.typescript.rules,
85
- ...commonRules(options)
86
- },
87
- settings: {
88
- ...pluginImport.configs.typescript.settings,
89
- "import-x/resolver": {
90
- "node": {
91
- extensions: [
92
- ".ts",
93
- ".tsx",
94
- ".js",
95
- ".jsx"
96
- ]
97
- },
98
- "typescript": {
99
- "alwaysTryTypes": true,
100
- "project": path.join(process2.cwd(), "tsconfig.json")
101
- }
102
- }
103
- }
104
- } : {
105
- languageOptions: {
106
- ecmaVersion: 2022,
107
- parserOptions: {
108
- ecmaVersion: 2022,
109
- sourceType: "module"
110
- }
111
- },
112
- plugins: {
113
- "import-x": pluginImport
114
- },
115
- rules: {
116
- ...pluginImport.configs.recommended.rules,
117
- ...commonRules(options)
118
- }
119
- }
120
- ];
121
-
122
- // src/configs/javascript.ts
123
8
  import pluginEslint from "@eslint/js";
124
9
  import globals from "globals";
125
- var javascript = (options) => [
126
- {
127
- languageOptions: {
128
- ecmaVersion: 2022,
129
- globals: {
130
- ...globals.browser,
131
- ...globals.es2022,
132
- ...globals.node,
133
- document: "readonly",
134
- navigator: "readonly",
135
- window: "readonly"
136
- },
137
- parserOptions: {
138
- ecmaVersion: 2022,
139
- sourceType: "module"
140
- },
141
- sourceType: "module"
142
- },
143
- rules: {
144
- ...pluginEslint.configs.recommended.rules,
145
- "array-callback-return": "error",
146
- "comma-dangle": "off",
147
- "default-case-last": "error",
148
- "eqeqeq": [
149
- "error",
150
- "always"
151
- ],
152
- "indent": [
153
- "error",
154
- "tab",
155
- {
156
- "SwitchCase": 1
157
- }
158
- ],
159
- "linebreak-style": [
160
- "error",
161
- "unix"
162
- ],
163
- "no-alert": "error",
164
- "no-array-constructor": "error",
165
- "no-caller": "error",
166
- "no-console": [
167
- "warn",
168
- { allow: ["warn", "error"] }
169
- ],
170
- "no-eval": "error",
171
- "no-extra-bind": "error",
172
- "no-implied-eval": "error",
173
- "no-invalid-regexp": "error",
174
- "no-iterator": "error",
175
- "no-lonely-if": "error",
176
- "no-new": "error",
177
- "no-new-func": "error",
178
- "no-new-wrappers": "error",
179
- "no-proto": "error",
180
- "no-template-curly-in-string": "error",
181
- "no-throw-literal": "error",
182
- "no-unmodified-loop-condition": "error",
183
- "no-unused-vars": options.typescript ? "off" : "warn",
184
- "no-unreachable-loop": "error",
185
- "no-useless-call": "error",
186
- "no-useless-computed-key": "error",
187
- "no-useless-concat": "error",
188
- "no-useless-rename": "error",
189
- "no-useless-return": "error",
190
- "no-var": "error",
191
- "prefer-const": "error",
192
- "prefer-exponentiation-operator": "error",
193
- "prefer-rest-params": "error",
194
- "prefer-spread": "error",
195
- "prefer-template": "error",
196
- "quotes": [
197
- "error",
198
- "single"
199
- ],
200
- "semi": [
201
- "error",
202
- "always"
203
- ],
204
- "unicode-bom": [
205
- "error",
206
- "never"
207
- ],
208
- "vars-on-top": "warn",
209
- "yoda": [
210
- "error",
211
- "never"
212
- ]
213
- }
214
- }
215
- ];
216
-
217
- // src/configs/jsdoc.ts
218
10
  import pluginJsDoc from "eslint-plugin-jsdoc";
219
- var jsDoc = [
220
- pluginJsDoc.configs["flat/recommended"],
221
- {
222
- settings: {
223
- jsdoc: {
224
- tagNamePreference: {
225
- constant: "const",
226
- const: "const",
227
- member: "var",
228
- returns: "return"
229
- }
230
- }
231
- }
232
- }
233
- ];
234
-
235
- // src/configs/json.ts
236
11
  import pluginJson from "eslint-plugin-jsonc";
237
- var json = [
238
- ...pluginJson.configs["flat/recommended-with-json"],
239
- {
240
- rules: {
241
- "jsonc/array-bracket-spacing": [
242
- "error",
243
- "never"
244
- ],
245
- "jsonc/array-element-newline": [
246
- "error",
247
- "consistent"
248
- ],
249
- "jsonc/comma-style": [
250
- "error",
251
- "last"
252
- ],
253
- "jsonc/indent": [
254
- "error",
255
- "tab",
256
- {}
257
- ],
258
- "jsonc/key-spacing": [
259
- "error",
260
- {
261
- "beforeColon": false,
262
- "afterColon": true,
263
- "mode": "strict"
264
- }
265
- ],
266
- "jsonc/object-curly-newline": [
267
- "error",
268
- {
269
- "consistent": true,
270
- "multiline": true
271
- }
272
- ]
273
- }
274
- }
275
- ];
276
-
277
- // src/configs/markdown.ts
278
12
  import pluginMarkdown from "@eslint/markdown";
279
- var markdown = [
280
- {
281
- files: ["**/*.md"],
282
- plugins: {
283
- markdown: pluginMarkdown
284
- },
285
- language: "markdown/gfm",
286
- processor: pluginMarkdown.processors.markdown,
287
- rules: {
288
- "markdown/fenced-code-language": "error",
289
- "markdown/heading-increment": "error",
290
- "markdown/no-duplicate-definitions": "error",
291
- "markdown/no-empty-definitions": "error",
292
- "markdown/no-empty-images": "error",
293
- "markdown/no-empty-links": "error",
294
- "markdown/no-invalid-label-refs": "error",
295
- "markdown/no-missing-atx-heading-space": "error",
296
- "markdown/no-missing-label-refs": "error",
297
- "markdown/no-missing-link-fragments": "error",
298
- "markdown/no-multiple-h1": "error",
299
- "markdown/no-reversed-media-syntax": "error",
300
- "markdown/no-space-in-emphasis": "error",
301
- "markdown/no-unused-definitions": "error",
302
- "markdown/require-alt-text": "error",
303
- "markdown/table-column-count": "error"
304
- }
305
- }
306
- ];
307
-
308
- // src/configs/math.ts
309
13
  import pluginMath from "eslint-plugin-math";
310
- var math = [
311
- pluginMath.configs.recommended
312
- ];
313
-
314
- // src/configs/node.ts
315
14
  import pluginNode from "eslint-plugin-n";
316
- var node = [
317
- pluginNode.configs["flat/recommended"],
318
- {
319
- rules: {
320
- "n/no-missing-import": "off",
321
- "n/no-missing-require": "off"
322
- }
323
- }
324
- ];
325
-
326
- // src/configs/perfectionist.ts
327
15
  import pluginPerfectionist from "eslint-plugin-perfectionist";
328
- var perfectionist = [
329
- {
330
- plugins: {
331
- perfectionist: pluginPerfectionist
332
- },
333
- rules: {
334
- "perfectionist/sort-array-includes": [
335
- "error",
336
- {
337
- "type": "alphabetical",
338
- "order": "asc",
339
- "ignoreCase": false
340
- }
341
- ],
342
- "perfectionist/sort-exports": [
343
- "error",
344
- {
345
- "type": "alphabetical",
346
- "order": "asc",
347
- "fallbackSort": {
348
- "type": "line-length",
349
- "order": "asc"
350
- },
351
- "ignoreCase": false
352
- }
353
- ],
354
- "perfectionist/sort-named-exports": [
355
- "error",
356
- {
357
- "type": "alphabetical",
358
- "order": "asc",
359
- "fallbackSort": {
360
- "type": "line-length",
361
- "order": "asc"
362
- },
363
- "ignoreCase": false
364
- }
365
- ],
366
- "perfectionist/sort-named-imports": [
367
- "error",
368
- {
369
- "type": "alphabetical",
370
- "order": "asc",
371
- "fallbackSort": {
372
- "type": "line-length",
373
- "order": "asc"
374
- },
375
- "ignoreCase": false
376
- }
377
- ]
378
- }
379
- }
380
- ];
381
-
382
- // src/configs/pinia.ts
383
16
  import pluginPinia from "eslint-plugin-pinia";
384
- var pinia = [
385
- {
386
- plugins: {
387
- pinia: pluginPinia
388
- },
389
- rules: {
390
- ...pluginPinia.configs["recommended-flat"].rules
391
- }
392
- }
393
- ];
394
-
395
- // src/configs/promise.ts
396
17
  import pluginPromise from "eslint-plugin-promise";
397
- var promise = [
398
- {
399
- ...pluginPromise.configs["flat/recommended"],
400
- rules: {
401
- ...pluginPromise.configs["flat/recommended"].rules,
402
- "promise/always-return": "warn",
403
- "promise/prefer-await-to-then": "warn",
404
- "promise/prefer-catch": "error"
405
- }
406
- }
407
- ];
408
-
409
- // src/configs/regexp.ts
410
18
  import pluginRegexp from "eslint-plugin-regexp";
411
- var regexp = [
412
- {
413
- files: [
414
- "**/*.js",
415
- "**/*.jsx",
416
- "**/*.ts",
417
- "**/*.tsx",
418
- "**/*.vue"
419
- ],
420
- plugins: {
421
- regexp: pluginRegexp
422
- },
423
- rules: {
424
- ...pluginRegexp.configs["flat/recommended"].rules,
425
- "regexp/no-unused-capturing-group": "warn",
426
- "regexp/prefer-quantifier": "error"
427
- }
428
- }
429
- ];
430
-
431
- // src/configs/stylistic.ts
432
19
  import pluginStylistic from "@stylistic/eslint-plugin";
433
- var stylistic = [
434
- {
435
- plugins: {
436
- "@stylistic": pluginStylistic
437
- },
438
- rules: {
439
- "@stylistic/array-bracket-newline": [
440
- "error",
441
- "consistent"
442
- ],
443
- "@stylistic/array-bracket-spacing": [
444
- "error",
445
- "never"
446
- ],
447
- "@stylistic/array-element-newline": [
448
- "error",
449
- {
450
- "consistent": true,
451
- "multiline": true
452
- }
453
- ],
454
- "@stylistic/arrow-spacing": [
455
- "error",
456
- {
457
- "after": true,
458
- "before": true
459
- }
460
- ],
461
- "@stylistic/brace-style": [
462
- "error",
463
- "1tbs"
464
- ],
465
- "@stylistic/comma-dangle": [
466
- "error",
467
- "always-multiline"
468
- ],
469
- "@stylistic/comma-spacing": [
470
- "error",
471
- {
472
- "after": true,
473
- "before": false
474
- }
475
- ],
476
- "@stylistic/comma-style": [
477
- "error",
478
- "last"
479
- ],
480
- "@stylistic/computed-property-spacing": [
481
- "error",
482
- "never"
483
- ],
484
- "@stylistic/curly-newline": [
485
- "error",
486
- {
487
- "consistent": true
488
- }
489
- ],
490
- "@stylistic/eol-last": [
491
- "error",
492
- "always"
493
- ],
494
- "@stylistic/function-call-argument-newline": [
495
- "error",
496
- "consistent"
497
- ],
498
- "@stylistic/function-paren-newline": [
499
- "error",
500
- "consistent"
501
- ],
502
- "@stylistic/implicit-arrow-linebreak": [
503
- "error",
504
- "beside"
505
- ],
506
- "@stylistic/key-spacing": [
507
- "error",
508
- {
509
- "afterColon": true,
510
- "beforeColon": false
511
- }
512
- ],
513
- "@stylistic/keyword-spacing": [
514
- "error",
515
- {
516
- "after": true,
517
- "before": true
518
- }
519
- ],
520
- "@stylistic/linebreak-style": [
521
- "error",
522
- "unix"
523
- ],
524
- "@stylistic/max-len": [
525
- "warn",
526
- {
527
- "code": 150,
528
- "ignoreRegExpLiterals": true,
529
- "ignoreStrings": true,
530
- "ignoreTemplateLiterals": true,
531
- "ignoreTrailingComments": true,
532
- "ignoreUrls": true
533
- }
534
- ],
535
- "@stylistic/member-delimiter-style": [
536
- "error",
537
- {
538
- "multiline": {
539
- "delimiter": "semi",
540
- "requireLast": true
541
- },
542
- "singleline": {
543
- "delimiter": "semi",
544
- "requireLast": false
545
- },
546
- "multilineDetection": "brackets"
547
- }
548
- ],
549
- "@stylistic/new-parens": [
550
- "error",
551
- "always"
552
- ],
553
- "@stylistic/newline-per-chained-call": [
554
- "error",
555
- {
556
- "ignoreChainWithDepth": 3
557
- }
558
- ],
559
- "@stylistic/no-extra-parens": [
560
- "error",
561
- "all",
562
- {
563
- "nestedBinaryExpressions": false,
564
- "ternaryOperandBinaryExpressions": false
565
- }
566
- ],
567
- "@stylistic/no-extra-semi": "error",
568
- "@stylistic/no-floating-decimal": "error",
569
- "@stylistic/no-mixed-operators": "error",
570
- "@stylistic/no-mixed-spaces-and-tabs": [
571
- "error",
572
- "smart-tabs"
573
- ],
574
- "@stylistic/no-multi-spaces": "error",
575
- "@stylistic/no-multiple-empty-lines": "error",
576
- "@stylistic/no-trailing-spaces": "error",
577
- "@stylistic/no-whitespace-before-property": "error",
578
- "@stylistic/nonblock-statement-body-position": [
579
- "error",
580
- "beside"
581
- ],
582
- "@stylistic/object-curly-newline": [
583
- "error",
584
- {
585
- "consistent": true
586
- }
587
- ],
588
- "@stylistic/object-curly-spacing": [
589
- "error",
590
- "always"
591
- ],
592
- "@stylistic/rest-spread-spacing": [
593
- "error",
594
- "never"
595
- ],
596
- "@stylistic/semi": [
597
- "error",
598
- "always"
599
- ],
600
- "@stylistic/semi-spacing": [
601
- "error",
602
- {
603
- "after": true,
604
- "before": false
605
- }
606
- ],
607
- "@stylistic/semi-style": [
608
- "error",
609
- "last"
610
- ],
611
- "@stylistic/space-before-blocks": [
612
- "error",
613
- "always"
614
- ],
615
- "@stylistic/space-before-function-paren": [
616
- "error",
617
- {
618
- "anonymous": "always",
619
- "named": "never",
620
- "asyncArrow": "always"
621
- }
622
- ],
623
- "@stylistic/space-in-parens": [
624
- "error",
625
- "never"
626
- ],
627
- "@stylistic/space-unary-ops": "error",
628
- "@stylistic/spaced-comment": [
629
- "error",
630
- "always",
631
- {
632
- "markers": ["/"]
633
- }
634
- ],
635
- "@stylistic/switch-colon-spacing": [
636
- "error",
637
- {
638
- "before": false,
639
- "after": true
640
- }
641
- ],
642
- "@stylistic/template-curly-spacing": [
643
- "error",
644
- "never"
645
- ],
646
- "@stylistic/type-annotation-spacing": "error",
647
- "@stylistic/type-generic-spacing": "error",
648
- "@stylistic/type-named-tuple-spacing": "error"
649
- }
650
- }
651
- ];
652
-
653
- // src/configs/typescript.ts
654
- import path2 from "path";
655
- import process4 from "process";
656
20
  import tsEslint from "typescript-eslint";
657
-
658
- // src/env.ts
659
- import process3 from "process";
660
21
  import { getPackageInfoSync, isPackageExists } from "local-pkg";
661
- var isInEditor = !!(!process3.env.CI && (process3.env.VSCODE_PID || process3.env.JETBRAINS_IDE || process3.env.VIM));
662
- var hasCypress = isPackageExists("cypress");
663
- var hasPinia = isPackageExists("pinia");
664
- var hasTypescript = isPackageExists("typescript");
665
- var hasVitest = isPackageExists("vitest");
666
- var hasVue = isPackageExists("nuxt") || isPackageExists("vitepress") || isPackageExists("vue") || isPackageExists("vuepress");
667
- var hasVueI18n = isPackageExists("vue-i18n");
668
- var hasVuetify = isPackageExists("vuetify");
669
- var versionVue = getPackageInfoSync("vue")?.version;
670
-
671
- // src/configs/typescript.ts
672
- function extractRules(configs2) {
673
- const rules = {};
674
- for (const config of configs2) {
675
- const configsArray = Array.isArray(config) ? config : [config];
676
- for (const c of configsArray) {
677
- if (c.rules) {
678
- Object.assign(rules, c.rules);
679
- }
680
- }
681
- }
682
- return rules;
683
- }
684
- var typescript = [
685
- {
686
- files: [
687
- "**/*.ts",
688
- "**/*.tsx",
689
- "**/*.md/*.ts"
690
- ],
691
- languageOptions: {
692
- parser: tsEslint.parser,
693
- parserOptions: {
694
- sourceType: "module",
695
- project: path2.join(process4.cwd(), "tsconfig.json"),
696
- projectService: true
697
- }
698
- },
699
- plugins: {
700
- "@typescript-eslint": tsEslint.plugin
701
- },
702
- rules: {
703
- ...extractRules(tsEslint.configs.recommendedTypeChecked),
704
- ...extractRules(tsEslint.configs.stylisticTypeChecked),
705
- ...extractRules(tsEslint.configs.strictTypeChecked),
706
- "@typescript-eslint/ban-ts-comment": "off",
707
- "@typescript-eslint/consistent-type-imports": [
708
- "error",
709
- {
710
- prefer: "type-imports",
711
- fixStyle: "inline-type-imports"
712
- }
713
- ],
714
- "@typescript-eslint/dot-notation": [
715
- "error",
716
- {
717
- allowKeywords: true
718
- }
719
- ],
720
- "@typescript-eslint/explicit-member-accessibility": "error",
721
- "@typescript-eslint/no-duplicate-enum-values": "warn",
722
- "@typescript-eslint/no-dynamic-delete": "warn",
723
- "@typescript-eslint/no-empty-function": [
724
- "error",
725
- {
726
- allow: ["arrowFunctions"]
727
- }
728
- ],
729
- "@typescript-eslint/no-explicit-any": "warn",
730
- "@typescript-eslint/no-extraneous-class": "off",
731
- "@typescript-eslint/no-inferrable-types": "off",
732
- "@typescript-eslint/no-unsafe-call": "warn",
733
- "@typescript-eslint/no-unused-expressions": [
734
- "error",
735
- {
736
- allowShortCircuit: true,
737
- allowTernary: true
738
- }
739
- ]
740
- }
741
- },
742
- ...hasPinia ? [
743
- {
744
- files: [
745
- "src/store/**/*.ts"
746
- ],
747
- rules: {
748
- "@typescript-eslint/unbound-method": "off"
749
- }
750
- }
751
- ] : []
752
- ];
753
-
754
- // src/configs/unicorn.ts
755
22
  import pluginUnicorn from "eslint-plugin-unicorn";
756
- var unicorn = [
757
- {
758
- languageOptions: {
759
- ecmaVersion: 2024
760
- },
761
- plugins: {
762
- unicorn: pluginUnicorn
763
- },
764
- rules: {
765
- "unicorn/better-regex": "error",
766
- "unicorn/catch-error-name": "error",
767
- "unicorn/consistent-destructuring": "error",
768
- "unicorn/consistent-empty-array-spread": "error",
769
- "unicorn/consistent-existence-index-check": "error",
770
- "unicorn/custom-error-definition": "error",
771
- "unicorn/error-message": "error",
772
- "unicorn/explicit-length-check": "error",
773
- "unicorn/new-for-builtins": "error",
774
- "unicorn/no-abusive-eslint-disable": "error",
775
- "unicorn/no-accessor-recursion": "error",
776
- "unicorn/no-anonymous-default-export": "error",
777
- "unicorn/no-array-callback-reference": "error",
778
- "unicorn/no-array-for-each": "error",
779
- "unicorn/no-array-method-this-argument": "error",
780
- "unicorn/no-await-in-promise-methods": "error",
781
- "unicorn/no-document-cookie": "error",
782
- "unicorn/no-instanceof-array": "error",
783
- "unicorn/no-lonely-if": "warn",
784
- "unicorn/no-negation-in-equality-check": "error",
785
- "unicorn/no-nested-ternary": "error",
786
- "unicorn/no-single-promise-in-promise-methods": "error",
787
- "unicorn/no-this-assignment": "error",
788
- "unicorn/no-typeof-undefined": "error",
789
- "unicorn/no-unnecessary-array-splice-count": "error",
790
- "unicorn/no-unnecessary-await": "error",
791
- "unicorn/no-unnecessary-slice-end": "error",
792
- "unicorn/no-unreadable-iife": "warn",
793
- "unicorn/no-useless-fallback-in-spread": "error",
794
- "unicorn/no-useless-length-check": "error",
795
- "unicorn/no-useless-promise-resolve-reject": "error",
796
- "unicorn/no-useless-spread": "error",
797
- "unicorn/no-useless-switch-case": "error",
798
- "unicorn/no-useless-undefined": "error",
799
- "unicorn/no-zero-fractions": "warn",
800
- "unicorn/number-literal-case": "error",
801
- "unicorn/numeric-separators-style": [
802
- "warn",
803
- {
804
- onlyIfContainsSeparator: false,
805
- hexadecimal: {
806
- minimumDigits: 0,
807
- groupLength: 2
808
- },
809
- binary: {
810
- minimumDigits: 0,
811
- groupLength: 4
812
- },
813
- octal: {
814
- minimumDigits: 0,
815
- groupLength: 3
816
- },
817
- number: {
818
- minimumDigits: 0,
819
- groupLength: 3
820
- }
821
- }
822
- ],
823
- "unicorn/prefer-array-index-of": "error",
824
- "unicorn/prefer-date-now": "error",
825
- "unicorn/prefer-default-parameters": "error",
826
- "unicorn/prefer-dom-node-append": "error",
827
- "unicorn/prefer-dom-node-remove": "error",
828
- "unicorn/prefer-export-from": "error",
829
- "unicorn/prefer-modern-math-apis": "error",
830
- "unicorn/prefer-node-protocol": "error",
831
- "unicorn/prefer-number-properties": "error",
832
- "unicorn/prefer-optional-catch-binding": "error",
833
- "unicorn/prefer-regexp-test": "error",
834
- "unicorn/prefer-set-size": "error",
835
- "unicorn/prefer-string-replace-all": "error",
836
- "unicorn/prefer-string-starts-ends-with": "error",
837
- "unicorn/prefer-string-trim-start-end": "error",
838
- "unicorn/prefer-structured-clone": "error",
839
- "unicorn/prefer-switch": [
840
- "error",
841
- {
842
- "emptyDefaultCase": "no-default-case",
843
- "minimumCases": 3
844
- }
845
- ],
846
- "unicorn/require-array-join-separator": "error",
847
- "unicorn/require-module-attributes": "error",
848
- "unicorn/require-module-specifiers": "error",
849
- "unicorn/require-number-to-fixed-digits-argument": "error",
850
- "unicorn/switch-case-braces": [
851
- "error",
852
- "avoid"
853
- ],
854
- "unicorn/throw-new-error": "error"
855
- }
856
- }
857
- ];
858
-
859
- // src/configs/vitest.ts
860
23
  import pluginVitest from "@vitest/eslint-plugin";
861
- var vitest = [
862
- {
863
- files: ["**/*.test.*"],
864
- plugins: {
865
- // @ts-ignore see https://github.com/vitest-dev/eslint-plugin-vitest/issues/737
866
- vitest: pluginVitest
867
- },
868
- languageOptions: {
869
- globals: {
870
- ...pluginVitest.environments.env.globals
871
- }
872
- },
873
- rules: {
874
- ...pluginVitest.configs.recommended.rules,
875
- "vitest/consistent-test-it": [
876
- "error",
877
- { fn: "test" }
878
- ],
879
- "vitest/no-alias-methods": "warn",
880
- "vitest/no-duplicate-hooks": "warn",
881
- "vitest/no-focused-tests": "warn",
882
- "vitest/no-test-return-statement": "error",
883
- "vitest/prefer-called-with": "warn",
884
- "vitest/prefer-comparison-matcher": "warn",
885
- "vitest/prefer-each": "warn",
886
- "vitest/prefer-equality-matcher": "warn",
887
- "vitest/prefer-expect-assertions": "error",
888
- "vitest/prefer-expect-resolves": "warn",
889
- "vitest/prefer-hooks-in-order": "warn",
890
- "vitest/prefer-hooks-on-top": "warn",
891
- "vitest/prefer-mock-promise-shorthand": "warn",
892
- "vitest/prefer-spy-on": "warn",
893
- "vitest/prefer-strict-boolean-matchers": "warn",
894
- "vitest/prefer-to-contain": "warn",
895
- "vitest/prefer-to-have-length": "warn",
896
- "vitest/require-mock-type-parameters": "error",
897
- "vitest/require-to-throw-message": "warn",
898
- "vitest/require-top-level-describe": "warn"
899
- },
900
- settings: {
901
- vitest: {
902
- typecheck: true
903
- }
904
- }
905
- }
906
- ];
907
-
908
- // src/configs/vue.ts
909
24
  import pluginVue from "eslint-plugin-vue";
910
25
  import pluginVueScopedCSS from "eslint-plugin-vue-scoped-css";
911
26
  import pluginVuetify from "eslint-plugin-vuetify";
912
- import { getPackageInfoSync as getPackageInfoSync2 } from "local-pkg";
913
- import tsEslint2 from "typescript-eslint";
914
27
  import parserVue from "vue-eslint-parser";
28
+ import pluginVueI18n from "@intlify/eslint-plugin-vue-i18n";
29
+
30
+ //#region src/configs/comments.ts
31
+ const comments = [{
32
+ plugins: { "eslint-comments": pluginEslintComments },
33
+ rules: {
34
+ "eslint-comments/no-aggregating-enable": "error",
35
+ "eslint-comments/no-duplicate-disable": "error",
36
+ "eslint-comments/no-unlimited-disable": "error",
37
+ "eslint-comments/no-unused-enable": "error"
38
+ }
39
+ }];
40
+
41
+ //#endregion
42
+ //#region src/configs/cypress.ts
43
+ const cypress = [pluginCypress.configs.recommended];
44
+
45
+ //#endregion
46
+ //#region src/configs/imports.ts
47
+ const commonRules = (options) => ({
48
+ "import-x/consistent-type-specifier-style": ["error", "prefer-inline"],
49
+ "import-x/no-named-as-default-member": "off",
50
+ "import-x/no-unresolved": ["warn", options.vue ? { ignore: ["^virtual:"] } : {}],
51
+ "import-x/order": ["error", {
52
+ "alphabetize": {
53
+ "order": "asc",
54
+ "caseInsensitive": true
55
+ },
56
+ "pathGroups": [{
57
+ "pattern": "@/**",
58
+ "group": "internal"
59
+ }],
60
+ "groups": [
61
+ "builtin",
62
+ "external",
63
+ "internal",
64
+ "parent",
65
+ "sibling",
66
+ "index",
67
+ "object",
68
+ "type"
69
+ ],
70
+ "newlines-between": "always"
71
+ }]
72
+ });
73
+ const imports = (options) => [options.typescript ? {
74
+ languageOptions: {
75
+ ecmaVersion: 2022,
76
+ parserOptions: {
77
+ ecmaVersion: 2022,
78
+ sourceType: "module"
79
+ }
80
+ },
81
+ plugins: { "import-x": pluginImport },
82
+ rules: {
83
+ ...pluginImport.configs.recommended.rules,
84
+ ...pluginImport.configs.typescript.rules,
85
+ ...commonRules(options)
86
+ },
87
+ settings: {
88
+ ...pluginImport.configs.typescript.settings,
89
+ "import-x/resolver": {
90
+ "node": { extensions: [
91
+ ".ts",
92
+ ".tsx",
93
+ ".js",
94
+ ".jsx"
95
+ ] },
96
+ "typescript": {
97
+ "alwaysTryTypes": true,
98
+ "project": path.join(process$1.cwd(), "tsconfig.json")
99
+ }
100
+ }
101
+ }
102
+ } : {
103
+ languageOptions: {
104
+ ecmaVersion: 2022,
105
+ parserOptions: {
106
+ ecmaVersion: 2022,
107
+ sourceType: "module"
108
+ }
109
+ },
110
+ plugins: { "import-x": pluginImport },
111
+ rules: {
112
+ ...pluginImport.configs.recommended.rules,
113
+ ...commonRules(options)
114
+ }
115
+ }];
116
+
117
+ //#endregion
118
+ //#region src/configs/javascript.ts
119
+ const javascript = (options) => [{
120
+ languageOptions: {
121
+ ecmaVersion: 2022,
122
+ globals: {
123
+ ...globals.browser,
124
+ ...globals.es2022,
125
+ ...globals.node,
126
+ document: "readonly",
127
+ navigator: "readonly",
128
+ window: "readonly"
129
+ },
130
+ parserOptions: {
131
+ ecmaVersion: 2022,
132
+ sourceType: "module"
133
+ },
134
+ sourceType: "module"
135
+ },
136
+ rules: {
137
+ ...pluginEslint.configs.recommended.rules,
138
+ "array-callback-return": "error",
139
+ "comma-dangle": "off",
140
+ "default-case-last": "error",
141
+ "eqeqeq": ["error", "always"],
142
+ "indent": [
143
+ "error",
144
+ "tab",
145
+ { "SwitchCase": 1 }
146
+ ],
147
+ "linebreak-style": ["error", "unix"],
148
+ "no-alert": "error",
149
+ "no-array-constructor": "error",
150
+ "no-caller": "error",
151
+ "no-console": ["warn", { allow: ["warn", "error"] }],
152
+ "no-eval": "error",
153
+ "no-extra-bind": "error",
154
+ "no-implied-eval": "error",
155
+ "no-invalid-regexp": "error",
156
+ "no-iterator": "error",
157
+ "no-lonely-if": "error",
158
+ "no-new": "error",
159
+ "no-new-func": "error",
160
+ "no-new-wrappers": "error",
161
+ "no-proto": "error",
162
+ "no-template-curly-in-string": "error",
163
+ "no-throw-literal": "error",
164
+ "no-unmodified-loop-condition": "error",
165
+ "no-unused-vars": options.typescript ? "off" : "warn",
166
+ "no-unreachable-loop": "error",
167
+ "no-useless-call": "error",
168
+ "no-useless-computed-key": "error",
169
+ "no-useless-concat": "error",
170
+ "no-useless-rename": "error",
171
+ "no-useless-return": "error",
172
+ "no-var": "error",
173
+ "prefer-const": "error",
174
+ "prefer-exponentiation-operator": "error",
175
+ "prefer-rest-params": "error",
176
+ "prefer-spread": "error",
177
+ "prefer-template": "error",
178
+ "quotes": ["error", "single"],
179
+ "semi": ["error", "always"],
180
+ "unicode-bom": ["error", "never"],
181
+ "vars-on-top": "warn",
182
+ "yoda": ["error", "never"]
183
+ }
184
+ }];
185
+
186
+ //#endregion
187
+ //#region src/configs/jsdoc.ts
188
+ const jsDoc = [pluginJsDoc.configs["flat/recommended"], { settings: { jsdoc: { tagNamePreference: {
189
+ constant: "const",
190
+ const: "const",
191
+ member: "var",
192
+ returns: "return"
193
+ } } } }];
194
+
195
+ //#endregion
196
+ //#region src/configs/json.ts
197
+ const json = [...pluginJson.configs["flat/recommended-with-json"], { rules: {
198
+ "jsonc/array-bracket-spacing": ["error", "never"],
199
+ "jsonc/array-element-newline": ["error", "consistent"],
200
+ "jsonc/comma-style": ["error", "last"],
201
+ "jsonc/indent": [
202
+ "error",
203
+ "tab",
204
+ {}
205
+ ],
206
+ "jsonc/key-spacing": ["error", {
207
+ "beforeColon": false,
208
+ "afterColon": true,
209
+ "mode": "strict"
210
+ }],
211
+ "jsonc/object-curly-newline": ["error", {
212
+ "consistent": true,
213
+ "multiline": true
214
+ }]
215
+ } }];
216
+
217
+ //#endregion
218
+ //#region src/configs/markdown.ts
219
+ const markdown = [{
220
+ files: ["**/*.md"],
221
+ plugins: { markdown: pluginMarkdown },
222
+ language: "markdown/gfm",
223
+ processor: pluginMarkdown.processors.markdown,
224
+ rules: {
225
+ "markdown/fenced-code-language": "error",
226
+ "markdown/heading-increment": "error",
227
+ "markdown/no-duplicate-definitions": "error",
228
+ "markdown/no-empty-definitions": "error",
229
+ "markdown/no-empty-images": "error",
230
+ "markdown/no-empty-links": "error",
231
+ "markdown/no-invalid-label-refs": "error",
232
+ "markdown/no-missing-atx-heading-space": "error",
233
+ "markdown/no-missing-label-refs": "error",
234
+ "markdown/no-missing-link-fragments": "error",
235
+ "markdown/no-multiple-h1": "error",
236
+ "markdown/no-reversed-media-syntax": "error",
237
+ "markdown/no-space-in-emphasis": "error",
238
+ "markdown/no-unused-definitions": "error",
239
+ "markdown/require-alt-text": "error",
240
+ "markdown/table-column-count": "error"
241
+ }
242
+ }];
243
+
244
+ //#endregion
245
+ //#region src/configs/math.ts
246
+ const math = [pluginMath.configs.recommended];
247
+
248
+ //#endregion
249
+ //#region src/configs/node.ts
250
+ const node = [pluginNode.configs["flat/recommended"], { rules: {
251
+ "n/no-missing-import": "off",
252
+ "n/no-missing-require": "off"
253
+ } }];
254
+
255
+ //#endregion
256
+ //#region src/configs/perfectionist.ts
257
+ const perfectionist = [{
258
+ plugins: { perfectionist: pluginPerfectionist },
259
+ rules: {
260
+ "perfectionist/sort-array-includes": ["error", {
261
+ "type": "alphabetical",
262
+ "order": "asc",
263
+ "ignoreCase": false
264
+ }],
265
+ "perfectionist/sort-exports": ["error", {
266
+ "type": "alphabetical",
267
+ "order": "asc",
268
+ "fallbackSort": {
269
+ "type": "line-length",
270
+ "order": "asc"
271
+ },
272
+ "ignoreCase": false,
273
+ "partitionByNewLine": true
274
+ }],
275
+ "perfectionist/sort-named-exports": ["error", {
276
+ "type": "alphabetical",
277
+ "order": "asc",
278
+ "fallbackSort": {
279
+ "type": "line-length",
280
+ "order": "asc"
281
+ },
282
+ "ignoreCase": false
283
+ }],
284
+ "perfectionist/sort-named-imports": ["error", {
285
+ "type": "alphabetical",
286
+ "order": "asc",
287
+ "fallbackSort": {
288
+ "type": "line-length",
289
+ "order": "asc"
290
+ },
291
+ "ignoreCase": false
292
+ }]
293
+ }
294
+ }];
295
+
296
+ //#endregion
297
+ //#region src/configs/pinia.ts
298
+ const pinia = [{
299
+ plugins: { pinia: pluginPinia },
300
+ rules: { ...pluginPinia.configs["recommended-flat"].rules }
301
+ }];
302
+
303
+ //#endregion
304
+ //#region src/configs/promise.ts
305
+ const promise = [{
306
+ ...pluginPromise.configs["flat/recommended"],
307
+ rules: {
308
+ ...pluginPromise.configs["flat/recommended"].rules,
309
+ "promise/always-return": "warn",
310
+ "promise/prefer-await-to-then": "warn",
311
+ "promise/prefer-catch": "error"
312
+ }
313
+ }];
314
+
315
+ //#endregion
316
+ //#region src/configs/regexp.ts
317
+ const regexp = [{
318
+ files: [
319
+ "**/*.js",
320
+ "**/*.jsx",
321
+ "**/*.ts",
322
+ "**/*.tsx",
323
+ "**/*.vue"
324
+ ],
325
+ plugins: { regexp: pluginRegexp },
326
+ rules: {
327
+ ...pluginRegexp.configs["flat/recommended"].rules,
328
+ "regexp/no-unused-capturing-group": "warn",
329
+ "regexp/prefer-quantifier": "error"
330
+ }
331
+ }];
332
+
333
+ //#endregion
334
+ //#region src/configs/stylistic.ts
335
+ const stylistic = [{
336
+ plugins: { "@stylistic": pluginStylistic },
337
+ rules: {
338
+ "@stylistic/array-bracket-newline": ["error", "consistent"],
339
+ "@stylistic/array-bracket-spacing": ["error", "never"],
340
+ "@stylistic/array-element-newline": ["error", {
341
+ "consistent": true,
342
+ "multiline": true
343
+ }],
344
+ "@stylistic/arrow-spacing": ["error", {
345
+ "after": true,
346
+ "before": true
347
+ }],
348
+ "@stylistic/brace-style": ["error", "1tbs"],
349
+ "@stylistic/comma-dangle": ["error", "always-multiline"],
350
+ "@stylistic/comma-spacing": ["error", {
351
+ "after": true,
352
+ "before": false
353
+ }],
354
+ "@stylistic/comma-style": ["error", "last"],
355
+ "@stylistic/computed-property-spacing": ["error", "never"],
356
+ "@stylistic/curly-newline": ["error", { "consistent": true }],
357
+ "@stylistic/eol-last": ["error", "always"],
358
+ "@stylistic/function-call-argument-newline": ["error", "consistent"],
359
+ "@stylistic/function-paren-newline": ["error", "consistent"],
360
+ "@stylistic/implicit-arrow-linebreak": ["error", "beside"],
361
+ "@stylistic/key-spacing": ["error", {
362
+ "afterColon": true,
363
+ "beforeColon": false
364
+ }],
365
+ "@stylistic/keyword-spacing": ["error", {
366
+ "after": true,
367
+ "before": true
368
+ }],
369
+ "@stylistic/linebreak-style": ["error", "unix"],
370
+ "@stylistic/max-len": ["warn", {
371
+ "code": 150,
372
+ "ignoreRegExpLiterals": true,
373
+ "ignoreStrings": true,
374
+ "ignoreTemplateLiterals": true,
375
+ "ignoreTrailingComments": true,
376
+ "ignoreUrls": true
377
+ }],
378
+ "@stylistic/member-delimiter-style": ["error", {
379
+ "multiline": {
380
+ "delimiter": "semi",
381
+ "requireLast": true
382
+ },
383
+ "singleline": {
384
+ "delimiter": "semi",
385
+ "requireLast": false
386
+ },
387
+ "multilineDetection": "brackets"
388
+ }],
389
+ "@stylistic/new-parens": ["error", "always"],
390
+ "@stylistic/newline-per-chained-call": ["error", { "ignoreChainWithDepth": 3 }],
391
+ "@stylistic/no-extra-parens": [
392
+ "error",
393
+ "all",
394
+ {
395
+ "nestedBinaryExpressions": false,
396
+ "ternaryOperandBinaryExpressions": false
397
+ }
398
+ ],
399
+ "@stylistic/no-extra-semi": "error",
400
+ "@stylistic/no-floating-decimal": "error",
401
+ "@stylistic/no-mixed-operators": "error",
402
+ "@stylistic/no-mixed-spaces-and-tabs": ["error", "smart-tabs"],
403
+ "@stylistic/no-multi-spaces": "error",
404
+ "@stylistic/no-multiple-empty-lines": "error",
405
+ "@stylistic/no-trailing-spaces": "error",
406
+ "@stylistic/no-whitespace-before-property": "error",
407
+ "@stylistic/nonblock-statement-body-position": ["error", "beside"],
408
+ "@stylistic/object-curly-newline": ["error", { "consistent": true }],
409
+ "@stylistic/object-curly-spacing": ["error", "always"],
410
+ "@stylistic/rest-spread-spacing": ["error", "never"],
411
+ "@stylistic/semi": ["error", "always"],
412
+ "@stylistic/semi-spacing": ["error", {
413
+ "after": true,
414
+ "before": false
415
+ }],
416
+ "@stylistic/semi-style": ["error", "last"],
417
+ "@stylistic/space-before-blocks": ["error", "always"],
418
+ "@stylistic/space-before-function-paren": ["error", {
419
+ "anonymous": "always",
420
+ "named": "never",
421
+ "asyncArrow": "always"
422
+ }],
423
+ "@stylistic/space-in-parens": ["error", "never"],
424
+ "@stylistic/space-unary-ops": "error",
425
+ "@stylistic/spaced-comment": [
426
+ "error",
427
+ "always",
428
+ { "markers": ["/"] }
429
+ ],
430
+ "@stylistic/switch-colon-spacing": ["error", {
431
+ "before": false,
432
+ "after": true
433
+ }],
434
+ "@stylistic/template-curly-spacing": ["error", "never"],
435
+ "@stylistic/type-annotation-spacing": "error",
436
+ "@stylistic/type-generic-spacing": "error",
437
+ "@stylistic/type-named-tuple-spacing": "error"
438
+ }
439
+ }];
440
+
441
+ //#endregion
442
+ //#region src/env.ts
443
+ /**
444
+ * @const {boolean} isInEditor Is the code running in an editor?
445
+ */
446
+ const isInEditor = !!(!process$1.env.CI && (process$1.env.VSCODE_PID || process$1.env.JETBRAINS_IDE || process$1.env.VIM));
447
+ /**
448
+ * @const {boolean} hasCypress Does the project have Cypress installed?
449
+ */
450
+ const hasCypress = isPackageExists("cypress");
451
+ /**
452
+ * @const {boolean} hasPinia Does the project have Pinia installed?
453
+ */
454
+ const hasPinia = isPackageExists("pinia");
455
+ /**
456
+ * @const {boolean} hasTypescript Does the project have TypeScript installed?
457
+ */
458
+ const hasTypescript = isPackageExists("typescript");
459
+ /**
460
+ * @const {boolean} hasVitest Does the project have Vitest installed?
461
+ */
462
+ const hasVitest = isPackageExists("vitest");
463
+ /**
464
+ * @const {boolean} hasVue Does the project have Vue installed?
465
+ */
466
+ const hasVue = isPackageExists("nuxt") || isPackageExists("vitepress") || isPackageExists("vue") || isPackageExists("vuepress");
467
+ /**
468
+ * @const {boolean} hasVueI18n Does the project have vue-i18n installed?
469
+ */
470
+ const hasVueI18n = isPackageExists("vue-i18n");
471
+ /**
472
+ * @const {boolean} hasVuetify Does the project have Vuetify installed?
473
+ */
474
+ const hasVuetify = isPackageExists("vuetify");
475
+ /**
476
+ * @const {string | undefined} versionVue Vue version
477
+ */
478
+ const versionVue = getPackageInfoSync("vue")?.version;
479
+
480
+ //#endregion
481
+ //#region src/configs/typescript.ts
482
+ /**
483
+ * Extracts rules from ESLint configurations
484
+ * @param {(Linter.Config | Linter.Config[])[]} configs ESLint configurations
485
+ * @return {Linter.RulesRecord} Extracted rules
486
+ */
487
+ function extractRules(configs$1) {
488
+ const rules = {};
489
+ for (const config of configs$1) {
490
+ const configsArray = Array.isArray(config) ? config : [config];
491
+ for (const c of configsArray) if (c.rules) Object.assign(rules, c.rules);
492
+ }
493
+ return rules;
494
+ }
495
+ const typescript = [{
496
+ files: [
497
+ "**/*.ts",
498
+ "**/*.tsx",
499
+ "**/*.md/*.ts"
500
+ ],
501
+ languageOptions: {
502
+ parser: tsEslint.parser,
503
+ parserOptions: {
504
+ sourceType: "module",
505
+ project: path.join(process$1.cwd(), "tsconfig.json"),
506
+ projectService: true
507
+ }
508
+ },
509
+ plugins: { "@typescript-eslint": tsEslint.plugin },
510
+ rules: {
511
+ ...extractRules(tsEslint.configs.recommendedTypeChecked),
512
+ ...extractRules(tsEslint.configs.stylisticTypeChecked),
513
+ ...extractRules(tsEslint.configs.strictTypeChecked),
514
+ "@typescript-eslint/ban-ts-comment": "off",
515
+ "@typescript-eslint/consistent-type-imports": ["error", {
516
+ prefer: "type-imports",
517
+ fixStyle: "inline-type-imports"
518
+ }],
519
+ "@typescript-eslint/dot-notation": ["error", { allowKeywords: true }],
520
+ "@typescript-eslint/explicit-member-accessibility": "error",
521
+ "@typescript-eslint/no-duplicate-enum-values": "warn",
522
+ "@typescript-eslint/no-dynamic-delete": "warn",
523
+ "@typescript-eslint/no-empty-function": ["error", { allow: ["arrowFunctions"] }],
524
+ "@typescript-eslint/no-explicit-any": "warn",
525
+ "@typescript-eslint/no-extraneous-class": "off",
526
+ "@typescript-eslint/no-inferrable-types": "off",
527
+ "@typescript-eslint/no-unsafe-call": "warn",
528
+ "@typescript-eslint/no-unused-expressions": ["error", {
529
+ allowShortCircuit: true,
530
+ allowTernary: true
531
+ }]
532
+ }
533
+ }, ...hasPinia ? [{
534
+ files: ["src/store/**/*.ts"],
535
+ rules: { "@typescript-eslint/unbound-method": "off" }
536
+ }] : []];
537
+
538
+ //#endregion
539
+ //#region src/configs/unicorn.ts
540
+ const unicorn = [{
541
+ languageOptions: { ecmaVersion: 2024 },
542
+ plugins: { unicorn: pluginUnicorn },
543
+ rules: {
544
+ "unicorn/better-regex": "error",
545
+ "unicorn/catch-error-name": "error",
546
+ "unicorn/consistent-destructuring": "error",
547
+ "unicorn/consistent-empty-array-spread": "error",
548
+ "unicorn/consistent-existence-index-check": "error",
549
+ "unicorn/custom-error-definition": "error",
550
+ "unicorn/error-message": "error",
551
+ "unicorn/explicit-length-check": "error",
552
+ "unicorn/new-for-builtins": "error",
553
+ "unicorn/no-abusive-eslint-disable": "error",
554
+ "unicorn/no-accessor-recursion": "error",
555
+ "unicorn/no-anonymous-default-export": "error",
556
+ "unicorn/no-array-callback-reference": "error",
557
+ "unicorn/no-array-for-each": "error",
558
+ "unicorn/no-array-method-this-argument": "error",
559
+ "unicorn/no-await-in-promise-methods": "error",
560
+ "unicorn/no-document-cookie": "error",
561
+ "unicorn/no-instanceof-array": "error",
562
+ "unicorn/no-lonely-if": "warn",
563
+ "unicorn/no-negation-in-equality-check": "error",
564
+ "unicorn/no-nested-ternary": "error",
565
+ "unicorn/no-single-promise-in-promise-methods": "error",
566
+ "unicorn/no-this-assignment": "error",
567
+ "unicorn/no-typeof-undefined": "error",
568
+ "unicorn/no-unnecessary-array-splice-count": "error",
569
+ "unicorn/no-unnecessary-await": "error",
570
+ "unicorn/no-unnecessary-slice-end": "error",
571
+ "unicorn/no-unreadable-iife": "warn",
572
+ "unicorn/no-useless-fallback-in-spread": "error",
573
+ "unicorn/no-useless-length-check": "error",
574
+ "unicorn/no-useless-promise-resolve-reject": "error",
575
+ "unicorn/no-useless-spread": "error",
576
+ "unicorn/no-useless-switch-case": "error",
577
+ "unicorn/no-useless-undefined": "error",
578
+ "unicorn/no-zero-fractions": "warn",
579
+ "unicorn/number-literal-case": "error",
580
+ "unicorn/numeric-separators-style": ["warn", {
581
+ onlyIfContainsSeparator: false,
582
+ hexadecimal: {
583
+ minimumDigits: 0,
584
+ groupLength: 2
585
+ },
586
+ binary: {
587
+ minimumDigits: 0,
588
+ groupLength: 4
589
+ },
590
+ octal: {
591
+ minimumDigits: 0,
592
+ groupLength: 3
593
+ },
594
+ number: {
595
+ minimumDigits: 0,
596
+ groupLength: 3
597
+ }
598
+ }],
599
+ "unicorn/prefer-array-index-of": "error",
600
+ "unicorn/prefer-date-now": "error",
601
+ "unicorn/prefer-default-parameters": "error",
602
+ "unicorn/prefer-dom-node-append": "error",
603
+ "unicorn/prefer-dom-node-remove": "error",
604
+ "unicorn/prefer-export-from": "error",
605
+ "unicorn/prefer-modern-math-apis": "error",
606
+ "unicorn/prefer-node-protocol": "error",
607
+ "unicorn/prefer-number-properties": "error",
608
+ "unicorn/prefer-optional-catch-binding": "error",
609
+ "unicorn/prefer-regexp-test": "error",
610
+ "unicorn/prefer-set-size": "error",
611
+ "unicorn/prefer-string-replace-all": "error",
612
+ "unicorn/prefer-string-starts-ends-with": "error",
613
+ "unicorn/prefer-string-trim-start-end": "error",
614
+ "unicorn/prefer-structured-clone": "error",
615
+ "unicorn/prefer-switch": ["error", {
616
+ "emptyDefaultCase": "no-default-case",
617
+ "minimumCases": 3
618
+ }],
619
+ "unicorn/require-array-join-separator": "error",
620
+ "unicorn/require-module-attributes": "error",
621
+ "unicorn/require-module-specifiers": "error",
622
+ "unicorn/require-number-to-fixed-digits-argument": "error",
623
+ "unicorn/switch-case-braces": ["error", "avoid"],
624
+ "unicorn/throw-new-error": "error"
625
+ }
626
+ }];
627
+
628
+ //#endregion
629
+ //#region src/configs/vitest.ts
630
+ const vitest = [{
631
+ files: ["**/*.test.*"],
632
+ plugins: { vitest: pluginVitest },
633
+ languageOptions: { globals: { ...pluginVitest.environments.env.globals } },
634
+ rules: {
635
+ ...pluginVitest.configs.recommended.rules,
636
+ "vitest/consistent-test-it": ["error", { fn: "test" }],
637
+ "vitest/no-alias-methods": "warn",
638
+ "vitest/no-duplicate-hooks": "warn",
639
+ "vitest/no-focused-tests": "warn",
640
+ "vitest/no-test-return-statement": "error",
641
+ "vitest/prefer-called-with": "warn",
642
+ "vitest/prefer-comparison-matcher": "warn",
643
+ "vitest/prefer-each": "warn",
644
+ "vitest/prefer-equality-matcher": "warn",
645
+ "vitest/prefer-expect-assertions": "error",
646
+ "vitest/prefer-expect-resolves": "warn",
647
+ "vitest/prefer-hooks-in-order": "warn",
648
+ "vitest/prefer-hooks-on-top": "warn",
649
+ "vitest/prefer-mock-promise-shorthand": "warn",
650
+ "vitest/prefer-spy-on": "warn",
651
+ "vitest/prefer-strict-boolean-matchers": "warn",
652
+ "vitest/prefer-to-contain": "warn",
653
+ "vitest/prefer-to-have-length": "warn",
654
+ "vitest/require-mock-type-parameters": "error",
655
+ "vitest/require-to-throw-message": "warn",
656
+ "vitest/require-top-level-describe": "warn"
657
+ },
658
+ settings: { vitest: { typecheck: true } }
659
+ }];
660
+
661
+ //#endregion
662
+ //#region src/configs/vue.ts
663
+ /**
664
+ * Retrieves the Vue version from the package.json file.
665
+ * @return {number} Vue version
666
+ */
915
667
  function getVueVersion() {
916
- const pkg = getPackageInfoSync2("vue", { paths: [process.cwd()] });
917
- if (pkg && typeof pkg.version === "string" && !Number.isNaN(+pkg.version[0])) {
918
- return +pkg.version[0];
919
- }
920
- return 3;
668
+ const pkg = getPackageInfoSync("vue", { paths: [process.cwd()] });
669
+ if (pkg && typeof pkg.version === "string" && !Number.isNaN(+pkg.version[0])) return +pkg.version[0];
670
+ return 3;
921
671
  }
922
- var configs = getVueVersion() === 3 ? [
923
- ...pluginVue.configs["flat/recommended"],
924
- ...pluginVueScopedCSS.configs["flat/recommended"]
925
- ] : [
926
- ...pluginVue.configs["flat/vue2-recommended"],
927
- ...pluginVueScopedCSS.configs["flat/vue2-recommended"]
928
- ];
929
- var vuetifyConfigs = [
930
- ...pluginVuetify.configs["flat/base"],
931
- ...pluginVuetify.configs["flat/recommended"]
932
- ].map((config) => {
933
- if ("plugins" in config && config.plugins !== void 0 && "vue" in config.plugins) {
934
- delete config.plugins.vue;
935
- }
936
- return config;
672
+ const configs = getVueVersion() === 3 ? [...pluginVue.configs["flat/recommended"], ...pluginVueScopedCSS.configs["flat/recommended"]] : [...pluginVue.configs["flat/vue2-recommended"], ...pluginVueScopedCSS.configs["flat/vue2-recommended"]];
673
+ const vuetifyConfigs = [...pluginVuetify.configs["flat/base"], ...pluginVuetify.configs["flat/recommended"]].map((config) => {
674
+ if ("plugins" in config && config.plugins !== void 0 && "vue" in config.plugins) delete config.plugins.vue;
675
+ return config;
937
676
  });
938
- var vue = (options) => [
939
- ...configs,
940
- ...options.vuetify ? vuetifyConfigs : [],
941
- {
942
- files: ["**/*.vue"],
943
- languageOptions: {
944
- ecmaVersion: 2022,
945
- parser: parserVue,
946
- parserOptions: {
947
- ecmaVersion: 2022,
948
- ecmaFeatures: {
949
- jsx: true
950
- },
951
- extraFileExtensions: [".vue"],
952
- parser: options.typescript ? tsEslint2.parser : null,
953
- sourceType: "module"
954
- }
955
- },
956
- rules: {
957
- "vue/array-bracket-newline": [
958
- "error",
959
- "consistent"
960
- ],
961
- "vue/array-bracket-spacing": [
962
- "error",
963
- "never"
964
- ],
965
- "vue/array-element-newline": [
966
- "error",
967
- {
968
- "consistent": true,
969
- "multiline": true
970
- }
971
- ],
972
- "vue/arrow-spacing": [
973
- "error",
974
- {
975
- "after": true,
976
- "before": true
977
- }
978
- ],
979
- "vue/brace-style": [
980
- "error",
981
- "1tbs"
982
- ],
983
- "vue/comma-dangle": [
984
- "error",
985
- "always-multiline"
986
- ],
987
- "vue/comma-spacing": [
988
- "error",
989
- {
990
- "after": true,
991
- "before": false
992
- }
993
- ],
994
- "vue/comma-style": [
995
- "error",
996
- "last"
997
- ],
998
- "vue/component-api-style": [
999
- "error",
1000
- [
1001
- "script-setup",
1002
- "composition"
1003
- ]
1004
- ],
1005
- "vue/define-emits-declaration": [
1006
- "error",
1007
- "type-literal"
1008
- ],
1009
- "vue/define-macros-order": [
1010
- "error",
1011
- {
1012
- "defineExposeLast": true,
1013
- "order": [
1014
- "defineOptions",
1015
- "defineModel",
1016
- "defineProps",
1017
- "defineEmits",
1018
- "defineSlots"
1019
- ]
1020
- }
1021
- ],
1022
- "vue/eqeqeq": [
1023
- "error",
1024
- "always"
1025
- ],
1026
- "vue/html-indent": [
1027
- "warn",
1028
- "tab"
1029
- ],
1030
- "vue/html-quotes": [
1031
- "warn",
1032
- "single"
1033
- ],
1034
- "vue/key-spacing": [
1035
- "error",
1036
- {
1037
- "afterColon": true,
1038
- "beforeColon": false
1039
- }
1040
- ],
1041
- "vue/keyword-spacing": [
1042
- "error",
1043
- {
1044
- "after": true,
1045
- "before": true
1046
- }
1047
- ],
1048
- "vue/max-attributes-per-line": [
1049
- "warn",
1050
- {
1051
- "singleline": 3
1052
- }
1053
- ],
1054
- "vue/multi-word-component-names": "off",
1055
- "vue/no-console": "error",
1056
- "vue/no-constant-condition": "error",
1057
- "vue/no-empty-component-block": "error",
1058
- "vue/no-extra-parens": [
1059
- "error",
1060
- "all",
1061
- {
1062
- "nestedBinaryExpressions": false,
1063
- "ternaryOperandBinaryExpressions": false
1064
- }
1065
- ],
1066
- "vue/no-import-compiler-macros": "error",
1067
- "vue/no-ref-object-reactivity-loss": "error",
1068
- "vue/no-root-v-if": "warn",
1069
- "vue/no-sparse-arrays": "error",
1070
- "vue/no-template-target-blank": "error",
1071
- "vue/no-undef-components": [
1072
- "error",
1073
- {
1074
- ignorePatterns: [
1075
- "^router-link$",
1076
- "^router-view$",
1077
- "^RouterLink$",
1078
- "^RouterView$",
1079
- "^v-+",
1080
- "^V[A-Z]+"
1081
- ]
1082
- }
1083
- ],
1084
- "vue/no-undef-properties": "error",
1085
- "vue/no-unused-emit-declarations": "error",
1086
- "vue/no-unused-properties": "warn",
1087
- "vue/no-unused-refs": "error",
1088
- "vue/no-useless-concat": "error",
1089
- "vue/no-useless-mustaches": "error",
1090
- "vue/object-curly-newline": [
1091
- "error",
1092
- {
1093
- "consistent": true
1094
- }
1095
- ],
1096
- "vue/object-curly-spacing": [
1097
- "error",
1098
- "always"
1099
- ],
1100
- "vue/padding-line-between-blocks": [
1101
- "error",
1102
- "always"
1103
- ],
1104
- "vue/prefer-define-options": "error",
1105
- "vue/prefer-template": "error",
1106
- "vue/prefer-use-template-ref": "error",
1107
- "vue/require-macro-variable-name": [
1108
- "error",
1109
- {
1110
- "defineProps": "componentProps"
1111
- }
1112
- ],
1113
- "vue/require-typed-object-prop": "error",
1114
- "vue/require-typed-ref": "error",
1115
- "vue/space-in-parens": [
1116
- "error",
1117
- "never"
1118
- ],
1119
- "vue/space-unary-ops": "error",
1120
- "vue/template-curly-spacing": [
1121
- "error",
1122
- "never"
1123
- ]
1124
- }
1125
- }
677
+ const vue = (options) => [
678
+ ...configs,
679
+ ...options.vuetify ? vuetifyConfigs : [],
680
+ {
681
+ files: ["**/*.vue"],
682
+ languageOptions: {
683
+ ecmaVersion: 2022,
684
+ parser: parserVue,
685
+ parserOptions: {
686
+ ecmaVersion: 2022,
687
+ ecmaFeatures: { jsx: true },
688
+ extraFileExtensions: [".vue"],
689
+ parser: options.typescript ? tsEslint.parser : null,
690
+ sourceType: "module"
691
+ }
692
+ },
693
+ rules: {
694
+ "vue/array-bracket-newline": ["error", "consistent"],
695
+ "vue/array-bracket-spacing": ["error", "never"],
696
+ "vue/array-element-newline": ["error", {
697
+ "consistent": true,
698
+ "multiline": true
699
+ }],
700
+ "vue/arrow-spacing": ["error", {
701
+ "after": true,
702
+ "before": true
703
+ }],
704
+ "vue/brace-style": ["error", "1tbs"],
705
+ "vue/comma-dangle": ["error", "always-multiline"],
706
+ "vue/comma-spacing": ["error", {
707
+ "after": true,
708
+ "before": false
709
+ }],
710
+ "vue/comma-style": ["error", "last"],
711
+ "vue/component-api-style": ["error", ["script-setup", "composition"]],
712
+ "vue/define-emits-declaration": ["error", "type-literal"],
713
+ "vue/define-macros-order": ["error", {
714
+ "defineExposeLast": true,
715
+ "order": [
716
+ "defineOptions",
717
+ "defineModel",
718
+ "defineProps",
719
+ "defineEmits",
720
+ "defineSlots"
721
+ ]
722
+ }],
723
+ "vue/eqeqeq": ["error", "always"],
724
+ "vue/html-indent": ["warn", "tab"],
725
+ "vue/html-quotes": ["warn", "single"],
726
+ "vue/key-spacing": ["error", {
727
+ "afterColon": true,
728
+ "beforeColon": false
729
+ }],
730
+ "vue/keyword-spacing": ["error", {
731
+ "after": true,
732
+ "before": true
733
+ }],
734
+ "vue/max-attributes-per-line": ["warn", { "singleline": 3 }],
735
+ "vue/multi-word-component-names": "off",
736
+ "vue/no-console": "error",
737
+ "vue/no-constant-condition": "error",
738
+ "vue/no-empty-component-block": "error",
739
+ "vue/no-extra-parens": [
740
+ "error",
741
+ "all",
742
+ {
743
+ "nestedBinaryExpressions": false,
744
+ "ternaryOperandBinaryExpressions": false
745
+ }
746
+ ],
747
+ "vue/no-import-compiler-macros": "error",
748
+ "vue/no-ref-object-reactivity-loss": "error",
749
+ "vue/no-root-v-if": "warn",
750
+ "vue/no-sparse-arrays": "error",
751
+ "vue/no-template-target-blank": "error",
752
+ "vue/no-undef-components": ["error", { ignorePatterns: [
753
+ "^client-only$",
754
+ "^ClientOnly$",
755
+ "^router-link$",
756
+ "^router-view$",
757
+ "^RouterLink$",
758
+ "^RouterView$",
759
+ "^v-+",
760
+ "^V[A-Z]+"
761
+ ] }],
762
+ "vue/no-undef-properties": "error",
763
+ "vue/no-unused-emit-declarations": "error",
764
+ "vue/no-unused-properties": "warn",
765
+ "vue/no-unused-refs": "error",
766
+ "vue/no-useless-concat": "error",
767
+ "vue/no-useless-mustaches": "error",
768
+ "vue/object-curly-newline": ["error", { "consistent": true }],
769
+ "vue/object-curly-spacing": ["error", "always"],
770
+ "vue/padding-line-between-blocks": ["error", "always"],
771
+ "vue/prefer-define-options": "error",
772
+ "vue/prefer-template": "error",
773
+ "vue/prefer-use-template-ref": "error",
774
+ "vue/require-macro-variable-name": ["error", { "defineProps": "componentProps" }],
775
+ "vue/require-typed-object-prop": "error",
776
+ "vue/require-typed-ref": "error",
777
+ "vue/space-in-parens": ["error", "never"],
778
+ "vue/space-unary-ops": "error",
779
+ "vue/template-curly-spacing": ["error", "never"]
780
+ }
781
+ }
1126
782
  ];
1127
783
 
1128
- // src/configs/vue-i18n.ts
1129
- import path3 from "path";
1130
- import process5 from "process";
1131
- import pluginVueI18n from "@intlify/eslint-plugin-vue-i18n";
1132
- var vueI18n = [
1133
- ...pluginVueI18n.configs.recommended,
1134
- {
1135
- settings: {
1136
- "vue-i18n": {
1137
- localeDir: path3.join(process5.cwd(), "/src/locales/*.json"),
1138
- messageSyntaxVersion: "^11.0.0"
1139
- }
1140
- }
1141
- }
1142
- ];
784
+ //#endregion
785
+ //#region src/configs/vue-i18n.ts
786
+ const vueI18n = [...pluginVueI18n.configs.recommended, { settings: { "vue-i18n": {
787
+ localeDir: path.join(process$1.cwd(), "/src/locales/*.json"),
788
+ messageSyntaxVersion: "^11.0.0"
789
+ } } }];
1143
790
 
1144
- // src/index.ts
791
+ //#endregion
792
+ //#region src/index.ts
793
+ /**
794
+ * Generate ESLint configuration.
795
+ * @param {Partial<IqrfEslintOptions>} options Configuration options.
796
+ * @param {Linter.Config | Linter.Config[]} config Additional ESLint configuration.
797
+ * @return {Linter.Config[]} Generated ESLint configuration.
798
+ */
1145
799
  function iqrfEslint(options = {}, config = []) {
1146
- const {
1147
- cypress: enableCypress = hasCypress,
1148
- ignores = [
1149
- ".pnpm-store/",
1150
- "coverage/",
1151
- "dist/"
1152
- ],
1153
- import: enableImport = true,
1154
- jsdoc: enableJsDoc = true,
1155
- markdown: enableMarkdown = true,
1156
- node: enableNode = false,
1157
- perfectionist: enablePerfectionist = true,
1158
- pinia: enablePinia = hasPinia,
1159
- promise: enablePromise = true,
1160
- regExp: enableRegExp = true,
1161
- typescript: enableTypescript = hasTypescript,
1162
- vitest: enableVitest = hasVitest,
1163
- vue: enableVue = hasVue,
1164
- vueI18n: enableVueI18n = hasVueI18n,
1165
- vuetify: enableVuetify = hasVuetify
1166
- } = options;
1167
- const configs2 = [];
1168
- if (ignores.length > 0) {
1169
- configs2.push({ ignores });
1170
- }
1171
- const ignoreFiles = [".gitignore", ".eslintignore"].filter((path4) => fs.existsSync(path4));
1172
- if (ignoreFiles.length > 0) {
1173
- configs2.push(configGitignore({ files: ignoreFiles }));
1174
- }
1175
- configs2.push(...javascript({
1176
- typescript: enableTypescript
1177
- }));
1178
- configs2.push(...comments);
1179
- if (enableTypescript) {
1180
- configs2.push(...typescript);
1181
- }
1182
- if (enableImport) {
1183
- configs2.push(...imports({
1184
- typescript: enableTypescript,
1185
- vue: enableVue
1186
- }));
1187
- }
1188
- if (enablePinia) {
1189
- configs2.push(...pinia);
1190
- }
1191
- if (enablePromise) {
1192
- configs2.push(...promise);
1193
- }
1194
- if (enableRegExp) {
1195
- configs2.push(...regexp);
1196
- }
1197
- if (enableMarkdown) {
1198
- configs2.push(...markdown);
1199
- }
1200
- if (enableNode) {
1201
- configs2.push(...node);
1202
- }
1203
- if (enablePerfectionist) {
1204
- configs2.push(...perfectionist);
1205
- }
1206
- if (enableVue) {
1207
- configs2.push(...vue({
1208
- typescript: enableTypescript,
1209
- vuetify: enableVuetify
1210
- }));
1211
- }
1212
- if (enableVueI18n) {
1213
- configs2.push(...vueI18n);
1214
- }
1215
- if (enableVitest) {
1216
- configs2.push(...vitest);
1217
- }
1218
- if (enableJsDoc) {
1219
- configs2.push(...jsDoc);
1220
- }
1221
- if (enableCypress) {
1222
- configs2.push(...cypress);
1223
- }
1224
- configs2.push(...json);
1225
- configs2.push(...stylistic);
1226
- configs2.push(...unicorn);
1227
- configs2.push(...math);
1228
- if (Object.keys(config).length > 0) {
1229
- configs2.push(...Array.isArray(config) ? config : [config]);
1230
- }
1231
- return configs2;
800
+ const { cypress: enableCypress = hasCypress, ignores = [
801
+ ".pnpm-store/",
802
+ "coverage/",
803
+ "dist/"
804
+ ], import: enableImport = true, jsdoc: enableJsDoc = true, markdown: enableMarkdown = true, node: enableNode = false, perfectionist: enablePerfectionist = true, pinia: enablePinia = hasPinia, promise: enablePromise = true, regExp: enableRegExp = true, typescript: enableTypescript = hasTypescript, vitest: enableVitest = hasVitest, vue: enableVue = hasVue, vueI18n: enableVueI18n = hasVueI18n, vuetify: enableVuetify = hasVuetify } = options;
805
+ const configs$1 = [];
806
+ if (ignores.length > 0) configs$1.push({ ignores });
807
+ const ignoreFiles = [".gitignore", ".eslintignore"].filter((path$1) => fs.existsSync(path$1));
808
+ if (ignoreFiles.length > 0) configs$1.push(configGitignore({ files: ignoreFiles }));
809
+ configs$1.push(...javascript({ typescript: enableTypescript }));
810
+ configs$1.push(...comments);
811
+ if (enableTypescript) configs$1.push(...typescript);
812
+ if (enableImport) configs$1.push(...imports({
813
+ typescript: enableTypescript,
814
+ vue: enableVue
815
+ }));
816
+ if (enablePinia) configs$1.push(...pinia);
817
+ if (enablePromise) configs$1.push(...promise);
818
+ if (enableRegExp) configs$1.push(...regexp);
819
+ if (enableMarkdown) configs$1.push(...markdown);
820
+ if (enableNode) configs$1.push(...node);
821
+ if (enablePerfectionist) configs$1.push(...perfectionist);
822
+ if (enableVue) configs$1.push(...vue({
823
+ typescript: enableTypescript,
824
+ vuetify: enableVuetify
825
+ }));
826
+ if (enableVueI18n) configs$1.push(...vueI18n);
827
+ if (enableVitest) configs$1.push(...vitest);
828
+ if (enableJsDoc) configs$1.push(...jsDoc);
829
+ if (enableCypress) configs$1.push(...cypress);
830
+ configs$1.push(...json);
831
+ configs$1.push(...stylistic);
832
+ configs$1.push(...unicorn);
833
+ configs$1.push(...math);
834
+ if (Object.keys(config).length > 0) configs$1.push(...Array.isArray(config) ? config : [config]);
835
+ return configs$1;
1232
836
  }
1233
- export {
1234
- comments,
1235
- cypress,
1236
- getVueVersion,
1237
- hasCypress,
1238
- hasPinia,
1239
- hasTypescript,
1240
- hasVitest,
1241
- hasVue,
1242
- hasVueI18n,
1243
- hasVuetify,
1244
- imports,
1245
- iqrfEslint,
1246
- isInEditor,
1247
- javascript,
1248
- jsDoc,
1249
- json,
1250
- markdown,
1251
- math,
1252
- node,
1253
- perfectionist,
1254
- pinia,
1255
- promise,
1256
- regexp,
1257
- stylistic,
1258
- typescript,
1259
- unicorn,
1260
- versionVue,
1261
- vitest,
1262
- vue,
1263
- vueI18n
1264
- };
837
+
838
+ //#endregion
839
+ export { comments, cypress, getVueVersion, hasCypress, hasPinia, hasTypescript, hasVitest, hasVue, hasVueI18n, hasVuetify, imports, iqrfEslint, isInEditor, javascript, jsDoc, json, markdown, math, node, perfectionist, pinia, promise, regexp, stylistic, typescript, unicorn, versionVue, vitest, vue, vueI18n };