@ntnyq/eslint-config 2.0.0-beta.2 → 2.0.0-beta.20

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,1228 @@
1
+ // src/shared.ts
2
+ var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
3
+ var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
4
+ var GLOB_JS = "**/*.?([cm])js";
5
+ var GLOB_JSX = "**/*.?([cm])jsx";
6
+ var GLOB_TS = "**/*.?([cm])ts";
7
+ var GLOB_TSX = "**/*.?([cm])tsx";
8
+ var GLOB_STYLE = "**/*.{c,le,sc}ss";
9
+ var GLOB_CSS = "**/*.css";
10
+ var GLOB_LESS = "**/*.less";
11
+ var GLOB_SCSS = "**/*.scss";
12
+ var GLOB_JSON = "**/*.json";
13
+ var GLOB_JSON5 = "**/*.json5";
14
+ var GLOB_JSONC = "**/*.jsonc";
15
+ var GLOB_VUE = "**/*.vue";
16
+ var GLOB_ASTRO = "**/*.astro";
17
+ var GLOB_MARKDOWN = "**/*.md";
18
+ var GLOB_YAML = "**/*.y?(a)ml";
19
+ var GLOB_HTML = "**/*.htm?(l)";
20
+ var GLOB_ALL_SRC = [
21
+ GLOB_SRC,
22
+ GLOB_STYLE,
23
+ GLOB_JSON,
24
+ GLOB_JSON5,
25
+ GLOB_MARKDOWN,
26
+ GLOB_VUE,
27
+ GLOB_YAML,
28
+ GLOB_HTML
29
+ ];
30
+ var GLOB_NODE_MODULES = "**/node_modules/**";
31
+ var GLOB_DIST = "**/dist/**";
32
+ var GLOB_LOCKFILE = [
33
+ "**/package-lock.json",
34
+ "**/yarn.lock",
35
+ "**/pnpm-lock.yaml",
36
+ "**/bun.lockb"
37
+ ];
38
+ var GLOB_EXCLUDE = [
39
+ GLOB_NODE_MODULES,
40
+ GLOB_DIST,
41
+ ...GLOB_LOCKFILE,
42
+ "**/CHANGELOG*.md",
43
+ "**/*.min.*",
44
+ "**/LICENSE*",
45
+ "**/__snapshots__",
46
+ "**/auto-import?(s).d.ts",
47
+ "**/components.d.ts",
48
+ "**/output",
49
+ "**/coverage",
50
+ "**/temp",
51
+ "**/cache",
52
+ "**/fixtures",
53
+ "**/.vitepress/cache",
54
+ "**/.nuxt",
55
+ "**/.vercel",
56
+ "**/.changeset",
57
+ "**/.npmrc",
58
+ "**/.yarnrc"
59
+ ];
60
+
61
+ // src/configs/vue.ts
62
+ import process from "node:process";
63
+ import { getPackageInfoSync } from "local-pkg";
64
+
65
+ // src/parsers.ts
66
+ import { default as default2 } from "yaml-eslint-parser";
67
+ import { default as default3 } from "vue-eslint-parser";
68
+ import { default as default4 } from "jsonc-eslint-parser";
69
+ import { default as default5 } from "astro-eslint-parser";
70
+ import { default as default6 } from "@typescript-eslint/parser";
71
+
72
+ // src/plugins.ts
73
+ import { default as default7 } from "eslint-plugin-n";
74
+ import { default as default8 } from "eslint-plugin-i";
75
+ import { default as default9 } from "eslint-plugin-yml";
76
+ import { default as default10 } from "eslint-plugin-vue";
77
+ import { default as default11 } from "eslint-plugin-astro";
78
+ import { default as default12 } from "eslint-plugin-jsonc";
79
+ import { default as default13 } from "eslint-plugin-react";
80
+ import { default as default14 } from "@unocss/eslint-plugin";
81
+ import { default as default15 } from "eslint-plugin-unicorn";
82
+ import { default as default16 } from "eslint-plugin-prettier";
83
+ import { default as default17 } from "eslint-plugin-markdown";
84
+ import { default as default18 } from "eslint-plugin-react-hooks";
85
+ import { default as default19 } from "eslint-plugin-eslint-comments";
86
+ import { default as default20 } from "@typescript-eslint/eslint-plugin";
87
+
88
+ // src/configs/typescript.ts
89
+ var typescript = [
90
+ {
91
+ files: [GLOB_TS, GLOB_TSX],
92
+ languageOptions: {
93
+ parser: default6,
94
+ parserOptions: {
95
+ sourceType: "module"
96
+ }
97
+ },
98
+ plugins: {
99
+ "@typescript-eslint": default20
100
+ },
101
+ rules: {
102
+ ...default20.configs.recommended.rules,
103
+ ...default20.configs.stylistic.rules,
104
+ "@typescript-eslint/no-unused-vars": "error",
105
+ "@typescript-eslint/no-redeclare": "error",
106
+ "@typescript-eslint/consistent-type-imports": [
107
+ "error",
108
+ {
109
+ prefer: "type-imports",
110
+ fixStyle: "separate-type-imports",
111
+ disallowTypeAnnotations: false
112
+ }
113
+ ],
114
+ "@typescript-eslint/consistent-type-assertions": [
115
+ "error",
116
+ {
117
+ assertionStyle: "as",
118
+ objectLiteralTypeAssertions: "allow-as-parameter"
119
+ }
120
+ ],
121
+ "@typescript-eslint/prefer-as-const": "warn",
122
+ "@typescript-eslint/ban-types": "off",
123
+ "@typescript-eslint/camelcase": "off",
124
+ "@typescript-eslint/no-namespace": "off",
125
+ "@typescript-eslint/ban-ts-ignore": "off",
126
+ "@typescript-eslint/ban-ts-comment": "off",
127
+ "@typescript-eslint/no-explicit-any": "off",
128
+ "@typescript-eslint/no-empty-function": "off",
129
+ "@typescript-eslint/naming-convention": "off",
130
+ "@typescript-eslint/no-empty-interface": "off",
131
+ "@typescript-eslint/no-non-null-assertion": "off",
132
+ "@typescript-eslint/triple-slash-reference": "off",
133
+ "@typescript-eslint/no-parameter-properties": "off",
134
+ "@typescript-eslint/explicit-member-accessibility": "off",
135
+ "@typescript-eslint/explicit-function-return-type": "off",
136
+ "@typescript-eslint/explicit-module-boundary-types": "off",
137
+ "@typescript-eslint/consistent-indexed-object-style": "off"
138
+ }
139
+ },
140
+ {
141
+ files: ["**/*.d.ts"],
142
+ rules: {
143
+ "import/no-duplicates": "off",
144
+ "import/newline-after-import": "off"
145
+ }
146
+ },
147
+ {
148
+ files: ["**/*.{spec,test}.ts?(x)"],
149
+ rules: {
150
+ "no-unused-expressions": "off",
151
+ "max-lines-per-function": "off"
152
+ }
153
+ },
154
+ {
155
+ files: ["**/*.js", "**/*.cjs"],
156
+ rules: {
157
+ "@typescript-eslint/no-var-requires": "off"
158
+ }
159
+ }
160
+ ];
161
+
162
+ // src/configs/vue.ts
163
+ function getVueVersion() {
164
+ const pkg = getPackageInfoSync("vue", { paths: [process.cwd()] });
165
+ if (pkg && typeof pkg.version === "string" && !Number.isNaN(+pkg.version[0])) {
166
+ return +pkg.version[0];
167
+ }
168
+ return 3;
169
+ }
170
+ var isVue3 = getVueVersion() === 3;
171
+ var vueBaseRules = {};
172
+ var vue2Rules = {
173
+ ...vueBaseRules
174
+ };
175
+ var vue3Rules = {
176
+ ...vueBaseRules
177
+ };
178
+ var vue = [
179
+ {
180
+ files: [GLOB_VUE],
181
+ plugins: {
182
+ vue: default10,
183
+ "@typescript-eslint": default20
184
+ },
185
+ languageOptions: {
186
+ parser: default3,
187
+ parserOptions: {
188
+ parser: "@typescript-eslint/parser",
189
+ sourceType: "module",
190
+ extraFileExtensions: [".vue"],
191
+ ecmaFeatures: {
192
+ jsx: true
193
+ }
194
+ }
195
+ },
196
+ processor: default10.processors[".vue"],
197
+ rules: {
198
+ ...typescript[0].rules
199
+ }
200
+ },
201
+ {
202
+ plugins: {
203
+ vue: default10
204
+ },
205
+ rules: isVue3 ? vue3Rules : vue2Rules
206
+ }
207
+ ];
208
+
209
+ // src/configs/yml.ts
210
+ var yml = [
211
+ {
212
+ files: [GLOB_YAML],
213
+ languageOptions: {
214
+ parser: default2
215
+ },
216
+ plugins: {
217
+ yml: default9
218
+ },
219
+ rules: {
220
+ ...default9.configs.standard.rules,
221
+ ...default9.configs.prettier.rules,
222
+ "yml/no-empty-mapping-value": "off",
223
+ "yml/quotes": ["error", { avoidEscape: false, prefer: "single" }]
224
+ }
225
+ }
226
+ ];
227
+
228
+ // src/configs/node.ts
229
+ var node = [
230
+ {
231
+ plugins: {
232
+ node: default7
233
+ },
234
+ rules: {
235
+ "node/handle-callback-err": ["error", "^(err|error)$"],
236
+ "node/no-deprecated-api": "error",
237
+ "node/no-exports-assign": "error",
238
+ "node/no-new-require": "error",
239
+ "node/no-path-concat": "error",
240
+ "node/prefer-global/buffer": ["error", "never"],
241
+ "node/prefer-global/process": ["error", "never"],
242
+ "node/process-exit-as-throw": "error"
243
+ }
244
+ }
245
+ ];
246
+
247
+ // src/configs/sort.ts
248
+ var sortPackageJson = [
249
+ {
250
+ files: ["**/package.json"],
251
+ rules: {
252
+ "jsonc/sort-keys": [
253
+ "error",
254
+ {
255
+ pathPattern: "^$",
256
+ order: [
257
+ "publisher",
258
+ "name",
259
+ "displayName",
260
+ "type",
261
+ "version",
262
+ "private",
263
+ "packageManager",
264
+ "description",
265
+ "keywords",
266
+ "license",
267
+ "author",
268
+ "homepage",
269
+ "repository",
270
+ "funding",
271
+ "exports",
272
+ "main",
273
+ "module",
274
+ "unpkg",
275
+ "jsdelivr",
276
+ // workaround for `type: "module"` with TS `moduleResolution: "node16"`
277
+ "types",
278
+ "typesVersions",
279
+ "bin",
280
+ "icon",
281
+ "files",
282
+ "sideEffects",
283
+ "scripts",
284
+ "peerDependencies",
285
+ "peerDependenciesMeta",
286
+ "dependencies",
287
+ "optionalDependencies",
288
+ "devDependencies",
289
+ "activationEvents",
290
+ "contributes",
291
+ "categories",
292
+ "engines",
293
+ "pnpm",
294
+ "overrides",
295
+ "resolutions",
296
+ "husky",
297
+ "prettier",
298
+ "nano-staged",
299
+ "lint-staged",
300
+ "eslintConfig"
301
+ ]
302
+ },
303
+ {
304
+ pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies$",
305
+ order: { type: "asc" }
306
+ },
307
+ {
308
+ pathPattern: "^exports.*$",
309
+ order: ["types", "import", "require", "default"]
310
+ },
311
+ {
312
+ pathPattern: "^scripts$",
313
+ order: { type: "asc" }
314
+ }
315
+ ],
316
+ "jsonc/sort-array-values": [
317
+ "error",
318
+ {
319
+ pathPattern: "^files$",
320
+ order: { type: "asc" }
321
+ }
322
+ ]
323
+ }
324
+ }
325
+ ];
326
+ var sortTsConfig = [
327
+ {
328
+ files: ["**/tsconfig.json", "**/tsconfig.*.json"],
329
+ rules: {
330
+ "jsonc/sort-keys": [
331
+ "error",
332
+ {
333
+ order: ["extends", "compilerOptions", "references", "files", "include", "exclude"],
334
+ pathPattern: "^$"
335
+ },
336
+ {
337
+ order: [
338
+ /* Projects */
339
+ "incremental",
340
+ "composite",
341
+ "tsBuildInfoFile",
342
+ "disableSourceOfProjectReferenceRedirect",
343
+ "disableSolutionSearching",
344
+ "disableReferencedProjectLoad",
345
+ /* Language and Environment */
346
+ "target",
347
+ "lib",
348
+ "jsx",
349
+ "experimentalDecorators",
350
+ "emitDecoratorMetadata",
351
+ "jsxFactory",
352
+ "jsxFragmentFactory",
353
+ "jsxImportSource",
354
+ "reactNamespace",
355
+ "noLib",
356
+ "useDefineForClassFields",
357
+ "moduleDetection",
358
+ /* Modules */
359
+ "module",
360
+ "rootDir",
361
+ "moduleResolution",
362
+ "baseUrl",
363
+ "paths",
364
+ "rootDirs",
365
+ "typeRoots",
366
+ "types",
367
+ "allowUmdGlobalAccess",
368
+ "moduleSuffixes",
369
+ "allowImportingTsExtensions",
370
+ "resolvePackageJsonExports",
371
+ "resolvePackageJsonImports",
372
+ "customConditions",
373
+ "resolveJsonModule",
374
+ "allowArbitraryExtensions",
375
+ "noResolve",
376
+ /* JavaScript Support */
377
+ "allowJs",
378
+ "checkJs",
379
+ "maxNodeModuleJsDepth",
380
+ /* Emit */
381
+ "declaration",
382
+ "declarationMap",
383
+ "emitDeclarationOnly",
384
+ "sourceMap",
385
+ "inlineSourceMap",
386
+ "outFile",
387
+ "outDir",
388
+ "removeComments",
389
+ "noEmit",
390
+ "importHelpers",
391
+ "importsNotUsedAsValues",
392
+ "downlevelIteration",
393
+ "sourceRoot",
394
+ "mapRoot",
395
+ "inlineSources",
396
+ "emitBOM",
397
+ "newLine",
398
+ "stripInternal",
399
+ "noEmitHelpers",
400
+ "noEmitOnError",
401
+ "preserveConstEnums",
402
+ "declarationDir",
403
+ "preserveValueImports",
404
+ /* Interop Constraints */
405
+ "isolatedModules",
406
+ "verbatimModuleSyntax",
407
+ "allowSyntheticDefaultImports",
408
+ "esModuleInterop",
409
+ "preserveSymlinks",
410
+ "forceConsistentCasingInFileNames",
411
+ /* Type Checking */
412
+ "strict",
413
+ "strictBindCallApply",
414
+ "strictFunctionTypes",
415
+ "strictNullChecks",
416
+ "strictPropertyInitialization",
417
+ "allowUnreachableCode",
418
+ "allowUnusedLabels",
419
+ "alwaysStrict",
420
+ "exactOptionalPropertyTypes",
421
+ "noFallthroughCasesInSwitch",
422
+ "noImplicitAny",
423
+ "noImplicitOverride",
424
+ "noImplicitReturns",
425
+ "noImplicitThis",
426
+ "noPropertyAccessFromIndexSignature",
427
+ "noUncheckedIndexedAccess",
428
+ "noUnusedLocals",
429
+ "noUnusedParameters",
430
+ "useUnknownInCatchVariables",
431
+ /* Completeness */
432
+ "skipDefaultLibCheck",
433
+ "skipLibCheck"
434
+ ],
435
+ pathPattern: "^compilerOptions$"
436
+ }
437
+ ]
438
+ }
439
+ }
440
+ ];
441
+
442
+ // src/configs/react.ts
443
+ var react = [
444
+ {
445
+ files: [GLOB_JSX, GLOB_TSX],
446
+ plugins: {
447
+ react: default13,
448
+ "react-hooks": default18
449
+ },
450
+ settings: {
451
+ react: {
452
+ version: "18.0"
453
+ }
454
+ },
455
+ languageOptions: {
456
+ parserOptions: {
457
+ ecmaFeatures: {
458
+ jsx: true
459
+ }
460
+ }
461
+ },
462
+ rules: {
463
+ ...default13.configs.recommended.rules,
464
+ ...default18.configs.recommended.rules,
465
+ "jsx-quotes": ["error", "prefer-double"],
466
+ "react/react-in-jsx-scope": "off"
467
+ }
468
+ }
469
+ ];
470
+
471
+ // src/configs/astro.ts
472
+ var astro = [
473
+ {
474
+ files: [GLOB_ASTRO],
475
+ plugins: {
476
+ astro: default11
477
+ },
478
+ languageOptions: {
479
+ parser: default5,
480
+ parserOptions: {
481
+ parser: "@typescript-eslint/parser",
482
+ extraFileExtensions: [".astro"]
483
+ }
484
+ },
485
+ rules: {
486
+ ...default11.configs.recommended.rules
487
+ }
488
+ }
489
+ ];
490
+
491
+ // src/configs/jsonc.ts
492
+ var jsonc = [
493
+ {
494
+ files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC, "**/*rc"],
495
+ plugins: {
496
+ jsonc: default12
497
+ },
498
+ languageOptions: {
499
+ parser: default4
500
+ },
501
+ rules: {
502
+ ...default12.configs["recommended-with-jsonc"].rules,
503
+ "jsonc/array-bracket-spacing": ["error", "never"],
504
+ "jsonc/comma-dangle": ["error", "never"],
505
+ "jsonc/comma-style": ["error", "last"],
506
+ "jsonc/indent": ["error", 2],
507
+ "jsonc/key-spacing": [
508
+ "error",
509
+ {
510
+ beforeColon: false,
511
+ afterColon: true
512
+ }
513
+ ],
514
+ "jsonc/no-octal-escape": "error",
515
+ "jsonc/object-curly-newline": [
516
+ "error",
517
+ {
518
+ multiline: true,
519
+ consistent: true
520
+ }
521
+ ],
522
+ "jsonc/object-curly-spacing": ["error", "always"],
523
+ "jsonc/object-property-newline": [
524
+ "error",
525
+ {
526
+ allowMultiplePropertiesPerLine: true
527
+ }
528
+ ]
529
+ }
530
+ }
531
+ ];
532
+
533
+ // src/configs/imports.ts
534
+ var imports = [
535
+ {
536
+ plugins: {
537
+ import: default8
538
+ },
539
+ settings: {
540
+ "import/resolver": {
541
+ node: { extensions: [".js", ".mjs", ".ts", ".mts", ".d.ts"] }
542
+ }
543
+ },
544
+ rules: {
545
+ "import/no-unresolved": "off",
546
+ "import/no-absolute-path": "off",
547
+ "import/no-named-as-default-member": "off",
548
+ "import/first": "error",
549
+ "import/export": "error",
550
+ "import/no-duplicates": "error",
551
+ "import/no-mutable-exports": "error",
552
+ "import/newline-after-import": "error",
553
+ "import/order": [
554
+ "error",
555
+ {
556
+ groups: [
557
+ "builtin",
558
+ "external",
559
+ "internal",
560
+ "parent",
561
+ "sibling",
562
+ "index",
563
+ "object",
564
+ "type"
565
+ ],
566
+ "newlines-between": "never",
567
+ pathGroups: [{ pattern: "{{@,~}/,#}**", group: "internal" }],
568
+ pathGroupsExcludedImportTypes: ["type"]
569
+ }
570
+ ]
571
+ }
572
+ }
573
+ ];
574
+
575
+ // src/configs/unocss.ts
576
+ var unocss = [
577
+ {
578
+ plugins: {
579
+ "@unocss": default14
580
+ },
581
+ rules: {
582
+ ...default14.configs.recommended.rules
583
+ }
584
+ }
585
+ ];
586
+
587
+ // src/configs/unicorn.ts
588
+ var unicorn = [
589
+ {
590
+ plugins: {
591
+ unicorn: default15
592
+ },
593
+ rules: {
594
+ "unicorn/no-unsafe-regex": "off",
595
+ "unicorn/error-message": "error",
596
+ "unicorn/escape-case": "error",
597
+ "unicorn/no-new-buffer": "error",
598
+ "unicorn/number-literal-case": "error",
599
+ "unicorn/prefer-includes": "error",
600
+ "unicorn/prefer-type-error": "error",
601
+ "unicorn/throw-new-error": "error",
602
+ "unicorn/no-unnecessary-await": "error",
603
+ "unicorn/switch-case-braces": ["error", "avoid"],
604
+ "unicorn/no-typeof-undefined": "error",
605
+ "unicorn/prefer-set-size": "error",
606
+ "unicorn/better-regex": "error",
607
+ "unicorn/prefer-regexp-test": "error",
608
+ "unicorn/prefer-top-level-await": "error",
609
+ "unicorn/no-static-only-class": "error",
610
+ "unicorn/no-zero-fractions": "error",
611
+ "unicorn/custom-error-definition": "error",
612
+ "unicorn/prefer-modern-math-apis": "error",
613
+ "unicorn/explicit-length-check": "error",
614
+ "unicorn/new-for-builtins": "error",
615
+ "unicorn/no-console-spaces": "error",
616
+ "unicorn/no-for-loop": "error",
617
+ "unicorn/no-hex-escape": "error",
618
+ "unicorn/no-lonely-if": "error",
619
+ "unicorn/prefer-keyboard-event-key": "error",
620
+ "unicorn/prefer-math-trunc": "error",
621
+ "unicorn/prefer-negative-index": "error",
622
+ "unicorn/prefer-node-protocol": "error",
623
+ "unicorn/prefer-number-properties": "error",
624
+ "unicorn/prefer-optional-catch-binding": "error",
625
+ "unicorn/prefer-prototype-methods": "error",
626
+ "unicorn/prefer-reflect-apply": "error",
627
+ "unicorn/catch-error-name": [
628
+ "error",
629
+ {
630
+ name: "err",
631
+ ignore: ["^_."]
632
+ }
633
+ ],
634
+ "unicorn/prefer-date-now": "error",
635
+ // String
636
+ "unicorn/prefer-string-slice": "error",
637
+ "unicorn/prefer-string-trim-start-end": "error",
638
+ "unicorn/prefer-string-starts-ends-with": "error",
639
+ // DOM
640
+ "unicorn/prefer-add-event-listener": "error",
641
+ "unicorn/no-invalid-remove-event-listener": "error",
642
+ "unicorn/prefer-query-selector": "error",
643
+ "unicorn/prefer-modern-dom-apis": "error",
644
+ "unicorn/prefer-dom-node-append": "error",
645
+ "unicorn/prefer-dom-node-dataset": "error",
646
+ "unicorn/prefer-dom-node-remove": "error",
647
+ "unicorn/prefer-dom-node-text-content": "error",
648
+ // Array
649
+ "unicorn/no-new-array": "error",
650
+ "unicorn/no-instanceof-array": "error",
651
+ "unicorn/no-array-push-push": "error",
652
+ "unicorn/no-array-callback-reference": "error",
653
+ "unicorn/no-array-method-this-argument": "error",
654
+ "unicorn/prefer-array-find": "error",
655
+ "unicorn/prefer-array-some": "error",
656
+ "unicorn/prefer-array-flat-map": "error",
657
+ "unicorn/prefer-array-index-of": "error"
658
+ }
659
+ }
660
+ ];
661
+
662
+ // src/configs/prettier.ts
663
+ import prettierConfig from "eslint-config-prettier";
664
+ var prettier = [
665
+ {
666
+ plugins: {
667
+ prettier: default16
668
+ },
669
+ rules: {
670
+ ...prettierConfig.rules,
671
+ ...default16.configs.recommended.rules,
672
+ "prettier/prettier": "warn"
673
+ }
674
+ }
675
+ ];
676
+
677
+ // src/configs/markdown.ts
678
+ var markdown = [
679
+ {
680
+ files: [GLOB_MARKDOWN],
681
+ plugins: {
682
+ markdown: default17
683
+ },
684
+ processor: "markdown/markdown"
685
+ },
686
+ {
687
+ files: [`${GLOB_MARKDOWN}/${GLOB_SRC}`, `${GLOB_MARKDOWN}/${GLOB_VUE}`],
688
+ languageOptions: {
689
+ parserOptions: {
690
+ ecmaFeatures: {
691
+ impliedStrict: true
692
+ }
693
+ }
694
+ },
695
+ plugins: {
696
+ "@typescript-eslint": default20
697
+ },
698
+ rules: {
699
+ ...default17.configs.recommended.overrides[1].rules,
700
+ "no-undef": "off",
701
+ "no-alert": "off",
702
+ "no-console": "off",
703
+ "no-unused-vars": "off",
704
+ "no-unused-expressions": "off",
705
+ "no-restricted-imports": "off",
706
+ "import/no-unresolved": "off",
707
+ "@typescript-eslint/comma-dangle": "off",
708
+ "@typescript-eslint/no-redeclare": "off",
709
+ "@typescript-eslint/no-unused-vars": "off",
710
+ "@typescript-eslint/no-var-requires": "off",
711
+ "@typescript-eslint/no-extraneous-class": "off",
712
+ "@typescript-eslint/no-use-before-define": "off",
713
+ "unused-imports/no-unused-imports": "off",
714
+ "unused-imports/no-unused-vars": "off"
715
+ }
716
+ }
717
+ ];
718
+
719
+ // src/configs/comments.ts
720
+ var comments = [
721
+ {
722
+ plugins: {
723
+ "eslint-comments": default19
724
+ },
725
+ rules: {
726
+ ...default19.configs.recommended.rules,
727
+ "eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }]
728
+ }
729
+ }
730
+ ];
731
+
732
+ // src/configs/javascript.ts
733
+ import globals from "globals";
734
+ import jsConfig from "@eslint/js";
735
+ var javascript = [
736
+ jsConfig.configs.recommended,
737
+ {
738
+ languageOptions: {
739
+ globals: {
740
+ ...globals.browser,
741
+ ...globals.es2021,
742
+ ...globals.node
743
+ },
744
+ sourceType: "module"
745
+ },
746
+ rules: {
747
+ // standard v17.0.0
748
+ "accessor-pairs": ["error", { setWithoutGet: true, enforceForClassMembers: true }],
749
+ "array-bracket-spacing": ["error", "never"],
750
+ "arrow-spacing": ["error", { before: true, after: true }],
751
+ "block-spacing": ["error", "always"],
752
+ "brace-style": ["error", "1tbs", { allowSingleLine: true }],
753
+ camelcase: [
754
+ "error",
755
+ {
756
+ allow: ["^UNSAFE_"],
757
+ properties: "never",
758
+ ignoreGlobals: true
759
+ }
760
+ ],
761
+ "comma-spacing": ["error", { before: false, after: true }],
762
+ "comma-style": ["error", "last"],
763
+ "computed-property-spacing": ["error", "never", { enforceForClassMembers: true }],
764
+ "constructor-super": "error",
765
+ curly: ["error", "multi-line"],
766
+ "default-case-last": "error",
767
+ "dot-location": ["error", "property"],
768
+ "dot-notation": ["error", { allowKeywords: true }],
769
+ "eol-last": "error",
770
+ "func-call-spacing": ["error", "never"],
771
+ indent: [
772
+ "error",
773
+ 2,
774
+ {
775
+ SwitchCase: 1,
776
+ VariableDeclarator: 1,
777
+ outerIIFEBody: 1,
778
+ MemberExpression: 1,
779
+ FunctionDeclaration: { parameters: 1, body: 1 },
780
+ FunctionExpression: { parameters: 1, body: 1 },
781
+ CallExpression: { arguments: 1 },
782
+ ArrayExpression: 1,
783
+ ObjectExpression: 1,
784
+ ImportDeclaration: 1,
785
+ flatTernaryExpressions: false,
786
+ ignoreComments: false,
787
+ ignoredNodes: [
788
+ "TemplateLiteral *",
789
+ "JSXElement",
790
+ "JSXElement > *",
791
+ "JSXAttribute",
792
+ "JSXIdentifier",
793
+ "JSXNamespacedName",
794
+ "JSXMemberExpression",
795
+ "JSXSpreadAttribute",
796
+ "JSXExpressionContainer",
797
+ "JSXOpeningElement",
798
+ "JSXClosingElement",
799
+ "JSXFragment",
800
+ "JSXOpeningFragment",
801
+ "JSXClosingFragment",
802
+ "JSXText",
803
+ "JSXEmptyExpression",
804
+ "JSXSpreadChild"
805
+ ],
806
+ offsetTernaryExpressions: true
807
+ }
808
+ ],
809
+ "key-spacing": ["error", { beforeColon: false, afterColon: true }],
810
+ "keyword-spacing": ["error", { before: true, after: true }],
811
+ "lines-between-class-members": ["error", "always", { exceptAfterSingleLine: true }],
812
+ "multiline-ternary": ["error", "always-multiline"],
813
+ "new-cap": ["error", { newIsCap: true, capIsNew: false, properties: true }],
814
+ "new-parens": "error",
815
+ "no-array-constructor": "error",
816
+ "no-async-promise-executor": "error",
817
+ "no-caller": "error",
818
+ "no-class-assign": "error",
819
+ "no-compare-neg-zero": "error",
820
+ "no-cond-assign": "error",
821
+ "no-const-assign": "error",
822
+ "no-constant-condition": ["error", { checkLoops: false }],
823
+ "no-control-regex": "error",
824
+ "no-debugger": "error",
825
+ "no-delete-var": "error",
826
+ "no-dupe-args": "error",
827
+ "no-dupe-class-members": "error",
828
+ "no-dupe-keys": "error",
829
+ "no-duplicate-case": "error",
830
+ "no-useless-backreference": "error",
831
+ "no-empty": ["error", { allowEmptyCatch: true }],
832
+ "no-empty-character-class": "error",
833
+ "no-empty-pattern": "error",
834
+ "no-eval": "error",
835
+ "no-ex-assign": "error",
836
+ "no-extend-native": "error",
837
+ "no-extra-bind": "error",
838
+ "no-extra-boolean-cast": "error",
839
+ "no-extra-parens": ["error", "functions"],
840
+ "no-fallthrough": "error",
841
+ "no-floating-decimal": "error",
842
+ "no-func-assign": "error",
843
+ "no-global-assign": "error",
844
+ "no-implied-eval": "error",
845
+ "no-import-assign": "error",
846
+ "no-invalid-regexp": "error",
847
+ "no-irregular-whitespace": "error",
848
+ "no-iterator": "error",
849
+ "no-labels": ["error", { allowLoop: false, allowSwitch: false }],
850
+ "no-lone-blocks": "error",
851
+ "no-loss-of-precision": "error",
852
+ "no-misleading-character-class": "error",
853
+ "no-prototype-builtins": "error",
854
+ "no-useless-catch": "error",
855
+ "no-mixed-operators": [
856
+ "error",
857
+ {
858
+ groups: [
859
+ ["==", "!=", "===", "!==", ">", ">=", "<", "<="],
860
+ ["&&", "||"],
861
+ ["in", "instanceof"]
862
+ ],
863
+ allowSamePrecedence: true
864
+ }
865
+ ],
866
+ "no-mixed-spaces-and-tabs": "error",
867
+ "no-multiple-empty-lines": ["error", { max: 1, maxBOF: 0, maxEOF: 0 }],
868
+ "no-new": "error",
869
+ "no-new-func": "error",
870
+ "no-new-object": "error",
871
+ "no-new-symbol": "error",
872
+ "no-new-wrappers": "error",
873
+ "no-obj-calls": "error",
874
+ "no-octal": "error",
875
+ "no-octal-escape": "error",
876
+ "no-proto": "error",
877
+ "no-redeclare": ["error", { builtinGlobals: false }],
878
+ "no-regex-spaces": "error",
879
+ "no-self-assign": ["error", { props: true }],
880
+ "no-self-compare": "error",
881
+ "no-sequences": "error",
882
+ "no-shadow-restricted-names": "error",
883
+ "no-sparse-arrays": "error",
884
+ "no-tabs": "error",
885
+ "no-template-curly-in-string": "error",
886
+ "no-this-before-super": "error",
887
+ "no-throw-literal": "error",
888
+ "no-trailing-spaces": "error",
889
+ "no-undef": "error",
890
+ "no-undef-init": "error",
891
+ "no-unexpected-multiline": "error",
892
+ "no-unmodified-loop-condition": "error",
893
+ "no-unneeded-ternary": ["error", { defaultAssignment: false }],
894
+ "no-unreachable": "error",
895
+ "no-unreachable-loop": "error",
896
+ "no-unsafe-finally": "error",
897
+ "no-unsafe-negation": "error",
898
+ "no-unused-expressions": [
899
+ "error",
900
+ {
901
+ allowShortCircuit: true,
902
+ allowTernary: true,
903
+ allowTaggedTemplates: true
904
+ }
905
+ ],
906
+ "no-unused-vars": [
907
+ "error",
908
+ {
909
+ args: "none",
910
+ caughtErrors: "none",
911
+ ignoreRestSiblings: true,
912
+ vars: "all"
913
+ }
914
+ ],
915
+ "no-useless-call": "error",
916
+ "no-useless-computed-key": "error",
917
+ "no-useless-constructor": "error",
918
+ "no-useless-rename": "error",
919
+ "no-useless-return": "error",
920
+ "no-whitespace-before-property": "error",
921
+ "object-curly-newline": ["error", { multiline: true, consistent: true }],
922
+ "object-curly-spacing": ["error", "always"],
923
+ "object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
924
+ "padded-blocks": ["error", { blocks: "never", switches: "never", classes: "never" }],
925
+ "prefer-promise-reject-errors": "error",
926
+ "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
927
+ "quote-props": ["error", "as-needed"],
928
+ "rest-spread-spacing": ["error", "never"],
929
+ semi: ["error", "never"],
930
+ "semi-spacing": ["error", { before: false, after: true }],
931
+ "space-before-blocks": ["error", "always"],
932
+ "space-before-function-paren": ["error", "never"],
933
+ "space-in-parens": ["error", "never"],
934
+ "space-infix-ops": "error",
935
+ "space-unary-ops": ["error", { words: true, nonwords: false }],
936
+ "symbol-description": "error",
937
+ "template-tag-spacing": ["error", "never"],
938
+ "unicode-bom": ["error", "never"],
939
+ "use-isnan": [
940
+ "error",
941
+ {
942
+ enforceForSwitchCase: true,
943
+ enforceForIndexOf: true
944
+ }
945
+ ],
946
+ "valid-typeof": ["error", { requireStringLiterals: true }],
947
+ "wrap-iife": ["error", "any", { functionPrototypeMethods: true }],
948
+ "yield-star-spacing": ["error", "both"],
949
+ yoda: ["error", "never"],
950
+ // es6+
951
+ "no-var": "error",
952
+ "prefer-rest-params": "error",
953
+ "prefer-spread": "error",
954
+ "prefer-template": "error",
955
+ "template-curly-spacing": "error",
956
+ "generator-star-spacing": "off",
957
+ "no-empty-static-block": "error",
958
+ "no-new-native-nonconstructor": "error",
959
+ "arrow-parens": [
960
+ "error",
961
+ "as-needed",
962
+ {
963
+ requireForBlockBody: false
964
+ }
965
+ ],
966
+ quotes: [
967
+ "error",
968
+ "single",
969
+ {
970
+ avoidEscape: true,
971
+ allowTemplateLiterals: false
972
+ }
973
+ ],
974
+ "prefer-const": [
975
+ "error",
976
+ {
977
+ destructuring: "all",
978
+ ignoreReadBeforeAssign: true
979
+ }
980
+ ],
981
+ "prefer-arrow-callback": [
982
+ "error",
983
+ {
984
+ allowNamedFunctions: false,
985
+ allowUnboundThis: true
986
+ }
987
+ ],
988
+ "object-shorthand": [
989
+ "error",
990
+ "always",
991
+ {
992
+ ignoreConstructors: false,
993
+ avoidQuotes: true
994
+ }
995
+ ],
996
+ "spaced-comment": [
997
+ "error",
998
+ "always",
999
+ {
1000
+ line: {
1001
+ markers: ["/"],
1002
+ exceptions: ["/", "#"]
1003
+ },
1004
+ block: {
1005
+ markers: ["!"],
1006
+ exceptions: ["*"],
1007
+ balanced: true
1008
+ }
1009
+ }
1010
+ ],
1011
+ // best-practice
1012
+ eqeqeq: ["error", "smart"],
1013
+ complexity: ["error", { max: 30 }],
1014
+ "array-callback-return": "error",
1015
+ "block-scoped-var": "error",
1016
+ "consistent-return": "off",
1017
+ "no-alert": "error",
1018
+ "no-case-declarations": "error",
1019
+ "no-multi-spaces": "error",
1020
+ "no-multi-str": "error",
1021
+ "no-with": "error",
1022
+ "no-void": "error",
1023
+ "no-useless-escape": "off",
1024
+ "vars-on-top": "error",
1025
+ "require-await": "off",
1026
+ "no-return-assign": "off",
1027
+ "one-var": ["error", "never"],
1028
+ "operator-linebreak": ["error", "before"],
1029
+ "comma-dangle": ["error", "always-multiline"],
1030
+ "max-params": ["error", { max: 5 }],
1031
+ "max-depth": ["error", { max: 5 }],
1032
+ "max-nested-callbacks": ["error", { max: 10 }],
1033
+ "max-statements-per-line": ["error", { max: 2 }],
1034
+ "max-lines": [
1035
+ "error",
1036
+ {
1037
+ max: 1e3,
1038
+ skipComments: true,
1039
+ skipBlankLines: true
1040
+ }
1041
+ ],
1042
+ "max-lines-per-function": [
1043
+ "error",
1044
+ {
1045
+ max: 100,
1046
+ skipComments: true,
1047
+ skipBlankLines: true
1048
+ }
1049
+ ],
1050
+ "no-use-before-define": [
1051
+ "error",
1052
+ {
1053
+ functions: false,
1054
+ classes: false,
1055
+ variables: true
1056
+ }
1057
+ ],
1058
+ "max-len": [
1059
+ "error",
1060
+ {
1061
+ code: 200,
1062
+ tabWidth: 2,
1063
+ comments: 200,
1064
+ ignoreUrls: true,
1065
+ ignoreStrings: true,
1066
+ ignoreRegExpLiterals: true,
1067
+ ignoreTemplateLiterals: true,
1068
+ ignoreTrailingComments: true
1069
+ }
1070
+ ],
1071
+ "sort-imports": [
1072
+ "error",
1073
+ {
1074
+ ignoreCase: false,
1075
+ ignoreDeclarationSort: true,
1076
+ ignoreMemberSort: false,
1077
+ memberSyntaxSortOrder: ["none", "all", "multiple", "single"],
1078
+ allowSeparatedGroups: false
1079
+ }
1080
+ ]
1081
+ }
1082
+ },
1083
+ {
1084
+ files: ["**/scripts/*", "**/cli.*"],
1085
+ rules: {
1086
+ "no-console": "off"
1087
+ }
1088
+ },
1089
+ {
1090
+ files: ["**/*.{test,spec}.js?(x)"],
1091
+ rules: {
1092
+ "no-unused-expressions": "off",
1093
+ "max-lines-per-function": "off"
1094
+ }
1095
+ }
1096
+ ];
1097
+ var jsx = [
1098
+ {
1099
+ files: ["**/*.jsx"],
1100
+ languageOptions: {
1101
+ parserOptions: {
1102
+ ecmaFeatures: {
1103
+ jsx: true
1104
+ }
1105
+ }
1106
+ }
1107
+ }
1108
+ ];
1109
+
1110
+ // src/configs/ignores.ts
1111
+ var ignores = [
1112
+ {
1113
+ ignores: GLOB_EXCLUDE
1114
+ }
1115
+ ];
1116
+
1117
+ // src/presets.ts
1118
+ var basic = [
1119
+ ...ignores,
1120
+ ...javascript,
1121
+ ...jsx,
1122
+ ...node,
1123
+ ...typescript,
1124
+ ...imports,
1125
+ ...unicorn,
1126
+ ...comments
1127
+ ];
1128
+ var common = [
1129
+ ...basic,
1130
+ ...yml,
1131
+ ...jsonc,
1132
+ ...sortPackageJson,
1133
+ ...sortTsConfig,
1134
+ ...prettier,
1135
+ ...markdown
1136
+ ];
1137
+ var all = [...common, ...vue, ...react, ...astro, ...unocss];
1138
+ function ntnyq(config = [], {
1139
+ vue: enableVue = false,
1140
+ react: enableReact = false,
1141
+ astro: enableAstro = false,
1142
+ unocss: enableUnoCSS = false
1143
+ } = {}) {
1144
+ const configs = [...common];
1145
+ if (enableVue) {
1146
+ configs.push(...vue);
1147
+ }
1148
+ if (enableReact) {
1149
+ configs.push(...react);
1150
+ }
1151
+ if (enableAstro) {
1152
+ configs.push(...astro);
1153
+ }
1154
+ if (enableUnoCSS) {
1155
+ configs.push(...unocss);
1156
+ }
1157
+ if (Object.keys(config).length > 0) {
1158
+ configs.push(...Array.isArray(config) ? config : [config]);
1159
+ }
1160
+ return configs;
1161
+ }
1162
+ export {
1163
+ GLOB_ALL_SRC,
1164
+ GLOB_ASTRO,
1165
+ GLOB_CSS,
1166
+ GLOB_DIST,
1167
+ GLOB_EXCLUDE,
1168
+ GLOB_HTML,
1169
+ GLOB_JS,
1170
+ GLOB_JSON,
1171
+ GLOB_JSON5,
1172
+ GLOB_JSONC,
1173
+ GLOB_JSX,
1174
+ GLOB_LESS,
1175
+ GLOB_LOCKFILE,
1176
+ GLOB_MARKDOWN,
1177
+ GLOB_NODE_MODULES,
1178
+ GLOB_SCSS,
1179
+ GLOB_SRC,
1180
+ GLOB_SRC_EXT,
1181
+ GLOB_STYLE,
1182
+ GLOB_TS,
1183
+ GLOB_TSX,
1184
+ GLOB_VUE,
1185
+ GLOB_YAML,
1186
+ all,
1187
+ astro,
1188
+ basic,
1189
+ comments,
1190
+ common,
1191
+ getVueVersion,
1192
+ ignores,
1193
+ imports,
1194
+ javascript,
1195
+ jsonc,
1196
+ jsx,
1197
+ markdown,
1198
+ node,
1199
+ ntnyq,
1200
+ default5 as parserAstro,
1201
+ default4 as parserJsonc,
1202
+ default6 as parserTypescript,
1203
+ default3 as parserVue,
1204
+ default2 as parserYml,
1205
+ default11 as pluginAstro,
1206
+ default19 as pluginComments,
1207
+ default8 as pluginImport,
1208
+ default12 as pluginJsonc,
1209
+ default17 as pluginMarkdown,
1210
+ default7 as pluginNode,
1211
+ default16 as pluginPrettier,
1212
+ default13 as pluginReact,
1213
+ default18 as pluginReactHooks,
1214
+ default20 as pluginTypeScript,
1215
+ default15 as pluginUnicorn,
1216
+ default14 as pluginUnoCSS,
1217
+ default10 as pluginVue,
1218
+ default9 as pluginYml,
1219
+ prettier,
1220
+ react,
1221
+ sortPackageJson,
1222
+ sortTsConfig,
1223
+ typescript,
1224
+ unicorn,
1225
+ unocss,
1226
+ vue,
1227
+ yml
1228
+ };