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

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