@ntnyq/eslint-config 2.0.0-beta.1 → 2.0.0-beta.11

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,1029 @@
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 = ["**/package-lock.json", "**/yarn.lock", "**/pnpm-lock.yaml"];
33
+ var GLOB_EXCLUDE = [
34
+ GLOB_NODE_MODULES,
35
+ GLOB_DIST,
36
+ ...GLOB_LOCKFILE,
37
+ "**/CHANGELOG*.md",
38
+ "**/*.min.*",
39
+ "**/LICENSE*",
40
+ "**/__snapshots__",
41
+ "**/auto-import?(s).d.ts",
42
+ "**/components.d.ts",
43
+ "**/output",
44
+ "**/coverage",
45
+ "**/temp",
46
+ "**/cache",
47
+ "**/fixtures",
48
+ "**/.vitepress/cache",
49
+ "**/.nuxt",
50
+ "**/.vercel",
51
+ "**/.changeset",
52
+ "**/.npmrc",
53
+ "**/.yarnrc"
54
+ ];
55
+
56
+ // src/configs/js.ts
57
+ import globals from "globals";
58
+ import jsConfig from "@eslint/js";
59
+ import importPlugin from "eslint-plugin-import";
60
+ import unicornPlugin from "eslint-plugin-unicorn";
61
+ var js = [
62
+ jsConfig.configs.recommended,
63
+ {
64
+ languageOptions: {
65
+ globals: {
66
+ ...globals.browser,
67
+ ...globals.es2021,
68
+ ...globals.node
69
+ },
70
+ sourceType: "module"
71
+ },
72
+ rules: {
73
+ // standard v 17.0.0
74
+ "accessor-pairs": ["error", { setWithoutGet: true, enforceForClassMembers: true }],
75
+ "array-bracket-spacing": ["error", "never"],
76
+ "arrow-spacing": ["error", { before: true, after: true }],
77
+ "block-spacing": ["error", "always"],
78
+ "brace-style": ["error", "1tbs", { allowSingleLine: true }],
79
+ camelcase: [
80
+ "error",
81
+ {
82
+ allow: ["^UNSAFE_"],
83
+ properties: "never",
84
+ ignoreGlobals: true
85
+ }
86
+ ],
87
+ "comma-spacing": ["error", { before: false, after: true }],
88
+ "comma-style": ["error", "last"],
89
+ "computed-property-spacing": ["error", "never", { enforceForClassMembers: true }],
90
+ "constructor-super": "error",
91
+ curly: ["error", "multi-line"],
92
+ "default-case-last": "error",
93
+ "dot-location": ["error", "property"],
94
+ "dot-notation": ["error", { allowKeywords: true }],
95
+ "eol-last": "error",
96
+ "func-call-spacing": ["error", "never"],
97
+ indent: [
98
+ "error",
99
+ 2,
100
+ {
101
+ SwitchCase: 1,
102
+ VariableDeclarator: 1,
103
+ outerIIFEBody: 1,
104
+ MemberExpression: 1,
105
+ FunctionDeclaration: { parameters: 1, body: 1 },
106
+ FunctionExpression: { parameters: 1, body: 1 },
107
+ CallExpression: { arguments: 1 },
108
+ ArrayExpression: 1,
109
+ ObjectExpression: 1,
110
+ ImportDeclaration: 1,
111
+ flatTernaryExpressions: false,
112
+ ignoreComments: false,
113
+ ignoredNodes: [
114
+ "TemplateLiteral *",
115
+ "JSXElement",
116
+ "JSXElement > *",
117
+ "JSXAttribute",
118
+ "JSXIdentifier",
119
+ "JSXNamespacedName",
120
+ "JSXMemberExpression",
121
+ "JSXSpreadAttribute",
122
+ "JSXExpressionContainer",
123
+ "JSXOpeningElement",
124
+ "JSXClosingElement",
125
+ "JSXFragment",
126
+ "JSXOpeningFragment",
127
+ "JSXClosingFragment",
128
+ "JSXText",
129
+ "JSXEmptyExpression",
130
+ "JSXSpreadChild"
131
+ ],
132
+ offsetTernaryExpressions: true
133
+ }
134
+ ],
135
+ "key-spacing": ["error", { beforeColon: false, afterColon: true }],
136
+ "keyword-spacing": ["error", { before: true, after: true }],
137
+ "lines-between-class-members": ["error", "always", { exceptAfterSingleLine: true }],
138
+ "multiline-ternary": ["error", "always-multiline"],
139
+ "new-cap": ["error", { newIsCap: true, capIsNew: false, properties: true }],
140
+ "new-parens": "error",
141
+ "no-array-constructor": "error",
142
+ "no-async-promise-executor": "error",
143
+ "no-caller": "error",
144
+ "no-class-assign": "error",
145
+ "no-compare-neg-zero": "error",
146
+ "no-cond-assign": "error",
147
+ "no-const-assign": "error",
148
+ "no-constant-condition": ["error", { checkLoops: false }],
149
+ "no-control-regex": "error",
150
+ "no-debugger": "error",
151
+ "no-delete-var": "error",
152
+ "no-dupe-args": "error",
153
+ "no-dupe-class-members": "error",
154
+ "no-dupe-keys": "error",
155
+ "no-duplicate-case": "error",
156
+ "no-useless-backreference": "error",
157
+ "no-empty": ["error", { allowEmptyCatch: true }],
158
+ "no-empty-character-class": "error",
159
+ "no-empty-pattern": "error",
160
+ "no-eval": "error",
161
+ "no-ex-assign": "error",
162
+ "no-extend-native": "error",
163
+ "no-extra-bind": "error",
164
+ "no-extra-boolean-cast": "error",
165
+ "no-extra-parens": ["error", "functions"],
166
+ "no-fallthrough": "error",
167
+ "no-floating-decimal": "error",
168
+ "no-func-assign": "error",
169
+ "no-global-assign": "error",
170
+ "no-implied-eval": "error",
171
+ "no-import-assign": "error",
172
+ "no-invalid-regexp": "error",
173
+ "no-irregular-whitespace": "error",
174
+ "no-iterator": "error",
175
+ "no-labels": ["error", { allowLoop: false, allowSwitch: false }],
176
+ "no-lone-blocks": "error",
177
+ "no-loss-of-precision": "error",
178
+ "no-misleading-character-class": "error",
179
+ "no-prototype-builtins": "error",
180
+ "no-useless-catch": "error",
181
+ "no-mixed-operators": [
182
+ "error",
183
+ {
184
+ groups: [
185
+ ["==", "!=", "===", "!==", ">", ">=", "<", "<="],
186
+ ["&&", "||"],
187
+ ["in", "instanceof"]
188
+ ],
189
+ allowSamePrecedence: true
190
+ }
191
+ ],
192
+ "no-mixed-spaces-and-tabs": "error",
193
+ "no-multiple-empty-lines": ["error", { max: 1, maxBOF: 0, maxEOF: 0 }],
194
+ "no-new": "error",
195
+ "no-new-func": "error",
196
+ "no-new-object": "error",
197
+ "no-new-symbol": "error",
198
+ "no-new-wrappers": "error",
199
+ "no-obj-calls": "error",
200
+ "no-octal": "error",
201
+ "no-octal-escape": "error",
202
+ "no-proto": "error",
203
+ "no-redeclare": ["error", { builtinGlobals: false }],
204
+ "no-regex-spaces": "error",
205
+ "no-self-assign": ["error", { props: true }],
206
+ "no-self-compare": "error",
207
+ "no-sequences": "error",
208
+ "no-shadow-restricted-names": "error",
209
+ "no-sparse-arrays": "error",
210
+ "no-tabs": "error",
211
+ "no-template-curly-in-string": "error",
212
+ "no-this-before-super": "error",
213
+ "no-throw-literal": "error",
214
+ "no-trailing-spaces": "error",
215
+ "no-undef": "error",
216
+ "no-undef-init": "error",
217
+ "no-unexpected-multiline": "error",
218
+ "no-unmodified-loop-condition": "error",
219
+ "no-unneeded-ternary": ["error", { defaultAssignment: false }],
220
+ "no-unreachable": "error",
221
+ "no-unreachable-loop": "error",
222
+ "no-unsafe-finally": "error",
223
+ "no-unsafe-negation": "error",
224
+ "no-unused-expressions": [
225
+ "error",
226
+ {
227
+ allowShortCircuit: true,
228
+ allowTernary: true,
229
+ allowTaggedTemplates: true
230
+ }
231
+ ],
232
+ "no-unused-vars": [
233
+ "error",
234
+ {
235
+ args: "none",
236
+ caughtErrors: "none",
237
+ ignoreRestSiblings: true,
238
+ vars: "all"
239
+ }
240
+ ],
241
+ "no-useless-call": "error",
242
+ "no-useless-computed-key": "error",
243
+ "no-useless-constructor": "error",
244
+ "no-useless-rename": "error",
245
+ "no-useless-return": "error",
246
+ "no-whitespace-before-property": "error",
247
+ "object-curly-newline": ["error", { multiline: true, consistent: true }],
248
+ "object-curly-spacing": ["error", "always"],
249
+ "object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
250
+ "padded-blocks": ["error", { blocks: "never", switches: "never", classes: "never" }],
251
+ "prefer-promise-reject-errors": "error",
252
+ "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
253
+ "quote-props": ["error", "as-needed"],
254
+ "rest-spread-spacing": ["error", "never"],
255
+ semi: ["error", "never"],
256
+ "semi-spacing": ["error", { before: false, after: true }],
257
+ "space-before-blocks": ["error", "always"],
258
+ "space-before-function-paren": ["error", "always"],
259
+ "space-in-parens": ["error", "never"],
260
+ "space-infix-ops": "error",
261
+ "space-unary-ops": ["error", { words: true, nonwords: false }],
262
+ "symbol-description": "error",
263
+ "template-tag-spacing": ["error", "never"],
264
+ "unicode-bom": ["error", "never"],
265
+ "use-isnan": [
266
+ "error",
267
+ {
268
+ enforceForSwitchCase: true,
269
+ enforceForIndexOf: true
270
+ }
271
+ ],
272
+ "valid-typeof": ["error", { requireStringLiterals: true }],
273
+ "wrap-iife": ["error", "any", { functionPrototypeMethods: true }],
274
+ "yield-star-spacing": ["error", "both"],
275
+ yoda: ["error", "never"],
276
+ // es6+
277
+ "no-var": "error",
278
+ "prefer-rest-params": "error",
279
+ "prefer-spread": "error",
280
+ "prefer-template": "error",
281
+ "template-curly-spacing": "error",
282
+ "generator-star-spacing": "off",
283
+ "no-empty-static-block": "error",
284
+ "no-new-native-nonconstructor": "error",
285
+ "arrow-parens": [
286
+ "error",
287
+ "as-needed",
288
+ {
289
+ requireForBlockBody: false
290
+ }
291
+ ],
292
+ quotes: [
293
+ "error",
294
+ "single",
295
+ {
296
+ avoidEscape: true,
297
+ allowTemplateLiterals: false
298
+ }
299
+ ],
300
+ "prefer-const": [
301
+ "error",
302
+ {
303
+ destructuring: "all",
304
+ ignoreReadBeforeAssign: true
305
+ }
306
+ ],
307
+ "prefer-arrow-callback": [
308
+ "error",
309
+ {
310
+ allowNamedFunctions: false,
311
+ allowUnboundThis: true
312
+ }
313
+ ],
314
+ "object-shorthand": [
315
+ "error",
316
+ "always",
317
+ {
318
+ ignoreConstructors: false,
319
+ avoidQuotes: true
320
+ }
321
+ ],
322
+ "spaced-comment": [
323
+ "error",
324
+ "always",
325
+ {
326
+ line: {
327
+ markers: ["/"],
328
+ exceptions: ["/", "#"]
329
+ },
330
+ block: {
331
+ markers: ["!"],
332
+ exceptions: ["*"],
333
+ balanced: true
334
+ }
335
+ }
336
+ ],
337
+ // best-practice
338
+ eqeqeq: ["error", "smart"],
339
+ complexity: ["error", { max: 30 }],
340
+ "array-callback-return": "error",
341
+ "block-scoped-var": "error",
342
+ "consistent-return": "off",
343
+ "no-alert": "error",
344
+ "no-case-declarations": "error",
345
+ "no-multi-spaces": "error",
346
+ "no-multi-str": "error",
347
+ "no-with": "error",
348
+ "no-void": "error",
349
+ "no-useless-escape": "off",
350
+ "vars-on-top": "error",
351
+ "require-await": "off",
352
+ "no-return-assign": "off",
353
+ "one-var": ["error", "never"],
354
+ "operator-linebreak": ["error", "before"],
355
+ "comma-dangle": ["error", "always-multiline"],
356
+ "max-params": ["error", { max: 5 }],
357
+ "max-depth": ["error", { max: 5 }],
358
+ "max-nested-callbacks": ["error", { max: 10 }],
359
+ "max-statements-per-line": ["error", { max: 2 }],
360
+ "max-lines": [
361
+ "error",
362
+ {
363
+ max: 1e3,
364
+ skipComments: true,
365
+ skipBlankLines: true
366
+ }
367
+ ],
368
+ "max-lines-per-function": [
369
+ "error",
370
+ {
371
+ max: 100,
372
+ skipComments: true,
373
+ skipBlankLines: true
374
+ }
375
+ ],
376
+ "no-use-before-define": [
377
+ "error",
378
+ {
379
+ functions: false,
380
+ classes: false,
381
+ variables: true
382
+ }
383
+ ],
384
+ "max-len": [
385
+ "error",
386
+ {
387
+ code: 200,
388
+ tabWidth: 2,
389
+ comments: 200,
390
+ ignoreUrls: true,
391
+ ignoreStrings: true,
392
+ ignoreRegExpLiterals: true,
393
+ ignoreTemplateLiterals: true,
394
+ ignoreTrailingComments: true
395
+ }
396
+ ],
397
+ "sort-imports": [
398
+ "error",
399
+ {
400
+ ignoreCase: false,
401
+ ignoreDeclarationSort: true,
402
+ ignoreMemberSort: false,
403
+ memberSyntaxSortOrder: ["none", "all", "multiple", "single"],
404
+ allowSeparatedGroups: false
405
+ }
406
+ ]
407
+ }
408
+ },
409
+ {
410
+ files: ["**/scripts/*", "**/cli.*"],
411
+ rules: {
412
+ "no-console": "off"
413
+ }
414
+ },
415
+ {
416
+ files: ["**/*.{test,spec}.js?(x)"],
417
+ rules: {
418
+ "no-unused-expressions": "off",
419
+ "max-lines-per-function": "off"
420
+ }
421
+ }
422
+ ];
423
+ var jsx = [
424
+ {
425
+ files: ["**/*.jsx"],
426
+ languageOptions: {
427
+ parserOptions: {
428
+ ecmaFeatures: {
429
+ jsx: true
430
+ }
431
+ }
432
+ }
433
+ }
434
+ ];
435
+ var imports = [
436
+ {
437
+ plugins: {
438
+ import: importPlugin
439
+ },
440
+ settings: {
441
+ "import/resolver": {
442
+ node: { extensions: [".js", ".mjs", ".ts", ".mts", ".d.ts"] }
443
+ }
444
+ },
445
+ rules: {
446
+ "import/no-unresolved": "off",
447
+ "import/no-absolute-path": "off",
448
+ "import/no-named-as-default-member": "off",
449
+ "import/first": "error",
450
+ "import/no-duplicates": "error",
451
+ "import/no-mutable-exports": "error",
452
+ "import/newline-after-import": "error",
453
+ "import/order": [
454
+ "error",
455
+ {
456
+ groups: [
457
+ "builtin",
458
+ "external",
459
+ "internal",
460
+ "parent",
461
+ "sibling",
462
+ "index",
463
+ "object",
464
+ "type"
465
+ ],
466
+ "newlines-between": "never",
467
+ pathGroups: [{ pattern: "@/**", group: "internal" }],
468
+ pathGroupsExcludedImportTypes: ["type"]
469
+ }
470
+ ]
471
+ }
472
+ }
473
+ ];
474
+ var unicorn = [
475
+ {
476
+ plugins: {
477
+ unicorn: unicornPlugin
478
+ },
479
+ rules: {
480
+ "unicorn/no-unsafe-regex": "off",
481
+ "unicorn/error-message": "error",
482
+ "unicorn/escape-case": "error",
483
+ "unicorn/no-new-buffer": "error",
484
+ "unicorn/number-literal-case": "error",
485
+ "unicorn/prefer-includes": "error",
486
+ "unicorn/prefer-type-error": "error",
487
+ "unicorn/throw-new-error": "error",
488
+ "unicorn/no-unnecessary-await": "error",
489
+ "unicorn/switch-case-braces": ["error", "avoid"],
490
+ "unicorn/no-typeof-undefined": "error",
491
+ "unicorn/prefer-set-size": "error",
492
+ "unicorn/better-regex": "error",
493
+ "unicorn/custom-error-definition": "error",
494
+ "unicorn/explicit-length-check": "error",
495
+ "unicorn/new-for-builtins": "error",
496
+ "unicorn/no-console-spaces": "error",
497
+ "unicorn/no-for-loop": "error",
498
+ "unicorn/no-hex-escape": "error",
499
+ "unicorn/no-lonely-if": "error",
500
+ "unicorn/prefer-keyboard-event-key": "error",
501
+ "unicorn/prefer-math-trunc": "error",
502
+ "unicorn/prefer-negative-index": "error",
503
+ "unicorn/prefer-node-protocol": "error",
504
+ "unicorn/prefer-number-properties": "error",
505
+ "unicorn/prefer-optional-catch-binding": "error",
506
+ "unicorn/prefer-prototype-methods": "error",
507
+ "unicorn/prefer-reflect-apply": "error",
508
+ "unicorn/catch-error-name": [
509
+ "error",
510
+ {
511
+ name: "err",
512
+ ignore: ["^_."]
513
+ }
514
+ ],
515
+ "unicorn/prefer-date-now": "error",
516
+ // String
517
+ "unicorn/prefer-string-slice": "error",
518
+ "unicorn/prefer-string-trim-start-end": "error",
519
+ "unicorn/prefer-string-starts-ends-with": "error",
520
+ // DOM
521
+ "unicorn/prefer-add-event-listener": "error",
522
+ "unicorn/no-invalid-remove-event-listener": "error",
523
+ "unicorn/prefer-query-selector": "error",
524
+ "unicorn/prefer-modern-dom-apis": "error",
525
+ "unicorn/prefer-dom-node-append": "error",
526
+ "unicorn/prefer-dom-node-dataset": "error",
527
+ "unicorn/prefer-dom-node-remove": "error",
528
+ "unicorn/prefer-dom-node-text-content": "error",
529
+ // Array
530
+ "unicorn/no-new-array": "error",
531
+ "unicorn/no-instanceof-array": "error",
532
+ "unicorn/no-array-push-push": "error",
533
+ "unicorn/no-array-callback-reference": "error",
534
+ "unicorn/no-array-method-this-argument": "error",
535
+ "unicorn/prefer-array-find": "error",
536
+ "unicorn/prefer-array-some": "error",
537
+ "unicorn/prefer-array-flat-map": "error",
538
+ "unicorn/prefer-array-index-of": "error"
539
+ }
540
+ }
541
+ ];
542
+
543
+ // src/configs/ts.ts
544
+ import tsParser from "@typescript-eslint/parser";
545
+ import tsPlugin from "@typescript-eslint/eslint-plugin";
546
+ var ts = [
547
+ {
548
+ files: [GLOB_TS, GLOB_TSX],
549
+ languageOptions: {
550
+ // @ts-expect-error 2322
551
+ parser: tsParser,
552
+ parserOptions: {
553
+ sourceType: "module"
554
+ }
555
+ },
556
+ plugins: {
557
+ "@typescript-eslint": tsPlugin
558
+ },
559
+ rules: {
560
+ ...tsPlugin.configs["eslint-recommended"].overrides[0].rules,
561
+ ...tsPlugin.configs.recommended.rules,
562
+ "@typescript-eslint/no-unused-vars": "error",
563
+ "@typescript-eslint/no-redeclare": "error",
564
+ "@typescript-eslint/consistent-type-imports": [
565
+ "error",
566
+ {
567
+ prefer: "type-imports",
568
+ fixStyle: "separate-type-imports",
569
+ disallowTypeAnnotations: false
570
+ }
571
+ ],
572
+ "@typescript-eslint/prefer-as-const": "warn",
573
+ "@typescript-eslint/ban-types": "off",
574
+ "@typescript-eslint/camelcase": "off",
575
+ "@typescript-eslint/no-namespace": "off",
576
+ "@typescript-eslint/ban-ts-ignore": "off",
577
+ "@typescript-eslint/ban-ts-comment": "off",
578
+ "@typescript-eslint/no-explicit-any": "off",
579
+ "@typescript-eslint/no-empty-function": "off",
580
+ "@typescript-eslint/naming-convention": "off",
581
+ "@typescript-eslint/no-empty-interface": "off",
582
+ "@typescript-eslint/no-non-null-assertion": "off",
583
+ "@typescript-eslint/triple-slash-reference": "off",
584
+ "@typescript-eslint/no-parameter-properties": "off",
585
+ "@typescript-eslint/explicit-member-accessibility": "off",
586
+ "@typescript-eslint/explicit-function-return-type": "off",
587
+ "@typescript-eslint/explicit-module-boundary-types": "off",
588
+ "@typescript-eslint/consistent-indexed-object-style": "off"
589
+ }
590
+ },
591
+ {
592
+ files: ["**/*.d.ts"],
593
+ rules: {
594
+ "import/no-duplicates": "off",
595
+ "import/newline-after-import": "off"
596
+ }
597
+ },
598
+ {
599
+ files: ["**/*.{spec,test}.ts?(x)"],
600
+ rules: {
601
+ "no-unused-expressions": "off",
602
+ "max-lines-per-function": "off"
603
+ }
604
+ },
605
+ {
606
+ files: ["**/*.js", "**/*.cjs"],
607
+ rules: {
608
+ "@typescript-eslint/no-var-requires": "off"
609
+ }
610
+ }
611
+ ];
612
+
613
+ // src/configs/vue.ts
614
+ import { getPackageInfoSync } from "local-pkg";
615
+ import vuePlugin from "eslint-plugin-vue";
616
+ import vueParser from "vue-eslint-parser";
617
+ import tsPlugin2 from "@typescript-eslint/eslint-plugin";
618
+ function getVueVersion() {
619
+ const pkg = getPackageInfoSync("vue", { paths: [process.cwd()] });
620
+ if (pkg && typeof pkg.version === "string" && !Number.isNaN(+pkg.version[0])) {
621
+ return +pkg.version[0];
622
+ }
623
+ return 3;
624
+ }
625
+ var isVue3 = getVueVersion() === 3;
626
+ var vueBaseRules = {};
627
+ var vue2Rules = {
628
+ ...vueBaseRules
629
+ };
630
+ var vue3Rules = {
631
+ ...vueBaseRules
632
+ };
633
+ var vue = [
634
+ {
635
+ files: [GLOB_VUE],
636
+ plugins: {
637
+ vue: vuePlugin,
638
+ "@typescript-eslint": tsPlugin2
639
+ },
640
+ languageOptions: {
641
+ // @ts-expect-error 2322
642
+ parser: vueParser,
643
+ parserOptions: {
644
+ parser: "@typescript-eslint/parser",
645
+ sourceType: "module",
646
+ extraFileExtensions: [".vue"],
647
+ ecmaFeatures: {
648
+ jsx: true
649
+ }
650
+ }
651
+ },
652
+ processor: vuePlugin.processors[".vue"],
653
+ rules: {
654
+ // @ts-expect-error 2339
655
+ ...ts[0].rules
656
+ }
657
+ },
658
+ {
659
+ plugins: {
660
+ vue: vuePlugin
661
+ },
662
+ rules: isVue3 ? vue3Rules : vue2Rules
663
+ }
664
+ ];
665
+
666
+ // src/configs/yml.ts
667
+ import ymlPlugin, { configs } from "eslint-plugin-yml";
668
+ import ymlParser from "yaml-eslint-parser";
669
+ var yml = [
670
+ {
671
+ files: [GLOB_YAML],
672
+ languageOptions: {
673
+ // @ts-expect-error 2322
674
+ parser: ymlParser
675
+ },
676
+ plugins: {
677
+ yml: ymlPlugin
678
+ },
679
+ // @ts-expect-error 2322
680
+ rules: {
681
+ ...configs.standard.rules,
682
+ ...configs.prettier.rules,
683
+ "yml/no-empty-mapping-value": "off"
684
+ }
685
+ }
686
+ ];
687
+
688
+ // src/configs/react.ts
689
+ import reactPlugin from "eslint-plugin-react";
690
+ import reactHooksPlugin from "eslint-plugin-react-hooks";
691
+ var react = [
692
+ {
693
+ files: [GLOB_JSX, GLOB_TSX],
694
+ plugins: {
695
+ react: reactPlugin,
696
+ reactHooks: reactHooksPlugin
697
+ },
698
+ settings: {
699
+ react: {
700
+ version: "18.0"
701
+ }
702
+ },
703
+ languageOptions: {
704
+ parserOptions: {
705
+ ecmaFeatures: {
706
+ jsx: true
707
+ }
708
+ }
709
+ },
710
+ rules: {
711
+ ...reactPlugin.configs.recommended.rules,
712
+ ...reactHooksPlugin.configs.recommended.rules,
713
+ "jsx-quotes": ["error", "prefer-double"],
714
+ "react/react-in-jsx-scope": "off"
715
+ }
716
+ }
717
+ ];
718
+
719
+ // src/configs/astro.ts
720
+ import astroPlugin, { configs as configs2 } from "eslint-plugin-astro";
721
+ import astroParser from "astro-eslint-parser";
722
+ var astro = [
723
+ {
724
+ files: [GLOB_ASTRO],
725
+ plugins: {
726
+ astro: astroPlugin
727
+ },
728
+ languageOptions: {
729
+ parser: astroParser,
730
+ parserOptions: {
731
+ parser: "@typescript-eslint/parser",
732
+ extraFileExtensions: [".astro"]
733
+ }
734
+ },
735
+ // @ts-expect-error 2322
736
+ rules: {
737
+ ...configs2.recommended.rules
738
+ }
739
+ }
740
+ ];
741
+
742
+ // src/configs/jsonc.ts
743
+ import jsoncPlugin, { configs as configs3 } from "eslint-plugin-jsonc";
744
+ import jsoncParser from "jsonc-eslint-parser";
745
+ var jsonc = [
746
+ {
747
+ files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC, "**/*rc"],
748
+ plugins: {
749
+ jsonc: jsoncPlugin
750
+ },
751
+ languageOptions: {
752
+ parser: jsoncParser
753
+ },
754
+ // @ts-expect-error 2322
755
+ rules: {
756
+ ...configs3["recommended-with-jsonc"].rules,
757
+ "jsonc/array-bracket-spacing": ["error", "never"],
758
+ "jsonc/comma-dangle": ["error", "never"],
759
+ "jsonc/comma-style": ["error", "last"],
760
+ "jsonc/indent": ["error", 2],
761
+ "jsonc/key-spacing": [
762
+ "error",
763
+ {
764
+ beforeColon: false,
765
+ afterColon: true
766
+ }
767
+ ],
768
+ "jsonc/no-octal-escape": "error",
769
+ "jsonc/object-curly-newline": [
770
+ "error",
771
+ {
772
+ multiline: true,
773
+ consistent: true
774
+ }
775
+ ],
776
+ "jsonc/object-curly-spacing": ["error", "always"],
777
+ "jsonc/object-property-newline": [
778
+ "error",
779
+ {
780
+ allowMultiplePropertiesPerLine: true
781
+ }
782
+ ]
783
+ }
784
+ }
785
+ ];
786
+ var pkgOrder = [
787
+ {
788
+ files: ["**/package.json"],
789
+ rules: {
790
+ "jsonc/sort-keys": [
791
+ "error",
792
+ {
793
+ pathPattern: "^$",
794
+ order: [
795
+ "publisher",
796
+ "name",
797
+ "displayName",
798
+ "type",
799
+ "version",
800
+ "private",
801
+ "packageManager",
802
+ "description",
803
+ "keywords",
804
+ "license",
805
+ "author",
806
+ "homepage",
807
+ "repository",
808
+ "funding",
809
+ "exports",
810
+ "main",
811
+ "module",
812
+ "unpkg",
813
+ "jsdelivr",
814
+ // workaround for `type: "module"` with TS `moduleResolution: "node16"`
815
+ "types",
816
+ "typesVersions",
817
+ "bin",
818
+ "icon",
819
+ "files",
820
+ "sideEffects",
821
+ "scripts",
822
+ "peerDependencies",
823
+ "peerDependenciesMeta",
824
+ "dependencies",
825
+ "optionalDependencies",
826
+ "devDependencies",
827
+ "activationEvents",
828
+ "contributes",
829
+ "categories",
830
+ "engines",
831
+ "pnpm",
832
+ "overrides",
833
+ "resolutions",
834
+ "husky",
835
+ "prettier",
836
+ "nano-staged",
837
+ "lint-staged",
838
+ "eslintConfig"
839
+ ]
840
+ },
841
+ {
842
+ pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies$",
843
+ order: { type: "asc" }
844
+ },
845
+ {
846
+ pathPattern: "^exports.*$",
847
+ order: ["types", "require", "import"]
848
+ },
849
+ {
850
+ pathPattern: "^scripts$",
851
+ order: { type: "asc" }
852
+ }
853
+ ]
854
+ }
855
+ }
856
+ ];
857
+
858
+ // src/configs/prettier.ts
859
+ import prettierPlugin from "eslint-plugin-prettier";
860
+ import prettierConfig from "eslint-config-prettier";
861
+ var prettier = [
862
+ {
863
+ plugins: {
864
+ prettier: prettierPlugin
865
+ },
866
+ rules: {
867
+ ...prettierConfig.rules,
868
+ ...prettierPlugin.configs.recommended.rules,
869
+ "prettier/prettier": "warn"
870
+ }
871
+ }
872
+ ];
873
+
874
+ // src/configs/markdown.ts
875
+ import markdownPlugin from "eslint-plugin-markdown";
876
+ import tsPlugin3 from "@typescript-eslint/eslint-plugin";
877
+ var markdown = [
878
+ {
879
+ files: [GLOB_MARKDOWN],
880
+ plugins: {
881
+ markdown: markdownPlugin
882
+ },
883
+ processor: "markdown/markdown"
884
+ },
885
+ {
886
+ files: [`${GLOB_MARKDOWN}/${GLOB_SRC}`, `${GLOB_MARKDOWN}/${GLOB_VUE}`],
887
+ languageOptions: {
888
+ parserOptions: {
889
+ ecmaFeatures: {
890
+ impliedStrict: true
891
+ }
892
+ }
893
+ },
894
+ plugins: {
895
+ "@typescript-eslint": tsPlugin3
896
+ },
897
+ rules: {
898
+ ...markdownPlugin.configs.recommended.overrides[1].rules,
899
+ "no-undef": "off",
900
+ "no-alert": "off",
901
+ "no-console": "off",
902
+ "no-unused-vars": "off",
903
+ "no-unused-expressions": "off",
904
+ "no-restricted-imports": "off",
905
+ "import/no-unresolved": "off",
906
+ "@typescript-eslint/comma-dangle": "off",
907
+ "@typescript-eslint/no-redeclare": "off",
908
+ "@typescript-eslint/no-unused-vars": "off",
909
+ "@typescript-eslint/no-var-requires": "off",
910
+ "@typescript-eslint/no-use-before-define": "off",
911
+ "unused-imports/no-unused-imports": "off",
912
+ "unused-imports/no-unused-vars": "off"
913
+ }
914
+ }
915
+ ];
916
+
917
+ // src/configs/eslint-comments.ts
918
+ import commentsPlugin from "eslint-plugin-eslint-comments";
919
+ var eslintComments = [
920
+ {
921
+ plugins: {
922
+ "eslint-comments": commentsPlugin
923
+ },
924
+ rules: {
925
+ ...commentsPlugin.configs.recommended.rules,
926
+ "eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }]
927
+ }
928
+ }
929
+ ];
930
+
931
+ // src/presets.ts
932
+ var GLOBAL_IGNORE = { ignores: GLOB_EXCLUDE };
933
+ var basic = [
934
+ GLOBAL_IGNORE,
935
+ ...js,
936
+ ...jsx,
937
+ ...ts,
938
+ ...yml,
939
+ ...imports,
940
+ ...unicorn,
941
+ ...jsonc,
942
+ ...pkgOrder,
943
+ ...eslintComments
944
+ ];
945
+ var all = [
946
+ ...basic,
947
+ ...vue,
948
+ ...react,
949
+ ...astro,
950
+ ...prettier,
951
+ ...markdown
952
+ ];
953
+ function ntnyq(config = [], {
954
+ vue: enableVue = false,
955
+ react: enableReact = false,
956
+ astro: enableAstro = false,
957
+ prettier: enablePrettier = false,
958
+ markdown: enableMarkdown = false
959
+ } = {}) {
960
+ const configs4 = [...basic];
961
+ if (enableVue) {
962
+ configs4.push(...vue);
963
+ }
964
+ if (enableReact) {
965
+ configs4.push(...react);
966
+ }
967
+ if (enableAstro) {
968
+ configs4.push(...astro);
969
+ }
970
+ if (enableMarkdown) {
971
+ configs4.push(...markdown);
972
+ }
973
+ if (enablePrettier) {
974
+ configs4.push(...prettier);
975
+ }
976
+ if (Object.keys(config).length > 0) {
977
+ configs4.push(...Array.isArray(config) ? config : [config]);
978
+ }
979
+ return configs4;
980
+ }
981
+ export {
982
+ GLOB_ALL_SRC,
983
+ GLOB_ASTRO,
984
+ GLOB_CSS,
985
+ GLOB_DIST,
986
+ GLOB_EXCLUDE,
987
+ GLOB_HTML,
988
+ GLOB_JS,
989
+ GLOB_JSON,
990
+ GLOB_JSON5,
991
+ GLOB_JSONC,
992
+ GLOB_JSX,
993
+ GLOB_LESS,
994
+ GLOB_LOCKFILE,
995
+ GLOB_MARKDOWN,
996
+ GLOB_NODE_MODULES,
997
+ GLOB_SCSS,
998
+ GLOB_SRC,
999
+ GLOB_SRC_EXT,
1000
+ GLOB_STYLE,
1001
+ GLOB_TS,
1002
+ GLOB_TSX,
1003
+ GLOB_VUE,
1004
+ GLOB_YAML,
1005
+ all,
1006
+ astro,
1007
+ basic,
1008
+ eslintComments,
1009
+ getVueVersion,
1010
+ imports,
1011
+ js,
1012
+ jsonc,
1013
+ jsx,
1014
+ markdown,
1015
+ ntnyq,
1016
+ pkgOrder,
1017
+ prettier,
1018
+ react,
1019
+ reactHooksPlugin,
1020
+ reactPlugin,
1021
+ ts,
1022
+ tsParser,
1023
+ tsPlugin,
1024
+ unicorn,
1025
+ vue,
1026
+ vueParser,
1027
+ vuePlugin,
1028
+ yml
1029
+ };