@ntnyq/eslint-config 2.0.0-beta.0 → 2.0.0-beta.10

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,1022 @@
1
+ // src/shared.ts
2
+ var GLOB_SRC_EXT = "?([mt])[jt]s?(x)";
3
+ var GLOB_SRC = "**/*.?([mt])[jt]s?(x)";
4
+ var GLOB_JS = "**/*.?([mt])js";
5
+ var GLOB_JSX = "**/*.?([mt])jsx";
6
+ var GLOB_TS = "**/*.?([mt])ts";
7
+ var GLOB_TSX = "**/*.?([mt])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.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/prefer-date-now": "error",
509
+ // String
510
+ "unicorn/prefer-string-slice": "error",
511
+ "unicorn/prefer-string-trim-start-end": "error",
512
+ "unicorn/prefer-string-starts-ends-with": "error",
513
+ // DOM
514
+ "unicorn/prefer-add-event-listener": "error",
515
+ "unicorn/no-invalid-remove-event-listener": "error",
516
+ "unicorn/prefer-query-selector": "error",
517
+ "unicorn/prefer-modern-dom-apis": "error",
518
+ "unicorn/prefer-dom-node-append": "error",
519
+ "unicorn/prefer-dom-node-dataset": "error",
520
+ "unicorn/prefer-dom-node-remove": "error",
521
+ "unicorn/prefer-dom-node-text-content": "error",
522
+ // Array
523
+ "unicorn/no-new-array": "error",
524
+ "unicorn/no-instanceof-array": "error",
525
+ "unicorn/no-array-push-push": "error",
526
+ "unicorn/no-array-callback-reference": "error",
527
+ "unicorn/no-array-method-this-argument": "error",
528
+ "unicorn/prefer-array-find": "error",
529
+ "unicorn/prefer-array-some": "error",
530
+ "unicorn/prefer-array-flat-map": "error",
531
+ "unicorn/prefer-array-index-of": "error"
532
+ }
533
+ }
534
+ ];
535
+
536
+ // src/configs/ts.ts
537
+ import tsParser from "@typescript-eslint/parser";
538
+ import tsPlugin from "@typescript-eslint/eslint-plugin";
539
+ var ts = [
540
+ {
541
+ files: [GLOB_TS, GLOB_TSX],
542
+ languageOptions: {
543
+ // @ts-expect-error 2322
544
+ parser: tsParser,
545
+ parserOptions: {
546
+ sourceType: "module"
547
+ }
548
+ },
549
+ plugins: {
550
+ "@typescript-eslint": tsPlugin
551
+ },
552
+ rules: {
553
+ ...tsPlugin.configs["eslint-recommended"].overrides[0].rules,
554
+ ...tsPlugin.configs.recommended.rules,
555
+ "@typescript-eslint/no-unused-vars": "error",
556
+ "@typescript-eslint/no-redeclare": "error",
557
+ "@typescript-eslint/consistent-type-imports": [
558
+ "error",
559
+ {
560
+ prefer: "type-imports",
561
+ fixStyle: "separate-type-imports",
562
+ disallowTypeAnnotations: false
563
+ }
564
+ ],
565
+ "@typescript-eslint/prefer-as-const": "warn",
566
+ "@typescript-eslint/ban-types": "off",
567
+ "@typescript-eslint/camelcase": "off",
568
+ "@typescript-eslint/no-namespace": "off",
569
+ "@typescript-eslint/ban-ts-ignore": "off",
570
+ "@typescript-eslint/ban-ts-comment": "off",
571
+ "@typescript-eslint/no-explicit-any": "off",
572
+ "@typescript-eslint/no-empty-function": "off",
573
+ "@typescript-eslint/naming-convention": "off",
574
+ "@typescript-eslint/no-empty-interface": "off",
575
+ "@typescript-eslint/no-non-null-assertion": "off",
576
+ "@typescript-eslint/triple-slash-reference": "off",
577
+ "@typescript-eslint/no-parameter-properties": "off",
578
+ "@typescript-eslint/explicit-member-accessibility": "off",
579
+ "@typescript-eslint/explicit-function-return-type": "off",
580
+ "@typescript-eslint/explicit-module-boundary-types": "off",
581
+ "@typescript-eslint/consistent-indexed-object-style": "off"
582
+ }
583
+ },
584
+ {
585
+ files: ["**/*.d.ts"],
586
+ rules: {
587
+ "import/no-duplicates": "off",
588
+ "import/newline-after-import": "off"
589
+ }
590
+ },
591
+ {
592
+ files: ["**/*.{spec,test}.ts?(x)"],
593
+ rules: {
594
+ "no-unused-expressions": "off",
595
+ "max-lines-per-function": "off"
596
+ }
597
+ },
598
+ {
599
+ files: ["**/*.js", "**/*.cjs"],
600
+ rules: {
601
+ "@typescript-eslint/no-var-requires": "off"
602
+ }
603
+ }
604
+ ];
605
+
606
+ // src/configs/vue.ts
607
+ import { getPackageInfoSync } from "local-pkg";
608
+ import vuePlugin from "eslint-plugin-vue";
609
+ import vueParser from "vue-eslint-parser";
610
+ import tsPlugin2 from "@typescript-eslint/eslint-plugin";
611
+ function getVueVersion() {
612
+ const pkg = getPackageInfoSync("vue", { paths: [process.cwd()] });
613
+ if (pkg && typeof pkg.version === "string" && !Number.isNaN(+pkg.version[0])) {
614
+ return +pkg.version[0];
615
+ }
616
+ return 3;
617
+ }
618
+ var isVue3 = getVueVersion() === 3;
619
+ var vueBaseRules = {};
620
+ var vue2Rules = {
621
+ ...vueBaseRules
622
+ };
623
+ var vue3Rules = {
624
+ ...vueBaseRules
625
+ };
626
+ var vue = [
627
+ {
628
+ files: [GLOB_VUE],
629
+ plugins: {
630
+ vue: vuePlugin,
631
+ "@typescript-eslint": tsPlugin2
632
+ },
633
+ languageOptions: {
634
+ // @ts-expect-error 2322
635
+ parser: vueParser,
636
+ parserOptions: {
637
+ parser: "@typescript-eslint/parser",
638
+ sourceType: "module",
639
+ extraFileExtensions: [".vue"],
640
+ ecmaFeatures: {
641
+ jsx: true
642
+ }
643
+ }
644
+ },
645
+ processor: vuePlugin.processors[".vue"],
646
+ rules: {
647
+ // @ts-expect-error 2339
648
+ ...ts[0].rules
649
+ }
650
+ },
651
+ {
652
+ plugins: {
653
+ vue: vuePlugin
654
+ },
655
+ rules: isVue3 ? vue3Rules : vue2Rules
656
+ }
657
+ ];
658
+
659
+ // src/configs/yml.ts
660
+ import ymlPlugin, { configs } from "eslint-plugin-yml";
661
+ import ymlParser from "yaml-eslint-parser";
662
+ var yml = [
663
+ {
664
+ files: [GLOB_YAML],
665
+ languageOptions: {
666
+ // @ts-expect-error 2322
667
+ parser: ymlParser
668
+ },
669
+ plugins: {
670
+ yml: ymlPlugin
671
+ },
672
+ // @ts-expect-error 2322
673
+ rules: {
674
+ ...configs.standard.rules,
675
+ ...configs.prettier.rules,
676
+ "yml/no-empty-mapping-value": "off"
677
+ }
678
+ }
679
+ ];
680
+
681
+ // src/configs/react.ts
682
+ import reactPlugin from "eslint-plugin-react";
683
+ import reactHooksPlugin from "eslint-plugin-react-hooks";
684
+ var react = [
685
+ {
686
+ files: [GLOB_JSX, GLOB_TSX],
687
+ plugins: {
688
+ react: reactPlugin,
689
+ reactHooks: reactHooksPlugin
690
+ },
691
+ settings: {
692
+ react: {
693
+ version: "18.0"
694
+ }
695
+ },
696
+ languageOptions: {
697
+ parserOptions: {
698
+ ecmaFeatures: {
699
+ jsx: true
700
+ }
701
+ }
702
+ },
703
+ rules: {
704
+ ...reactPlugin.configs.recommended.rules,
705
+ ...reactHooksPlugin.configs.recommended.rules,
706
+ "jsx-quotes": ["error", "prefer-double"],
707
+ "react/react-in-jsx-scope": "off"
708
+ }
709
+ }
710
+ ];
711
+
712
+ // src/configs/astro.ts
713
+ import astroPlugin, { configs as configs2 } from "eslint-plugin-astro";
714
+ import astroParser from "astro-eslint-parser";
715
+ var astro = [
716
+ {
717
+ files: [GLOB_ASTRO],
718
+ plugins: {
719
+ astro: astroPlugin
720
+ },
721
+ languageOptions: {
722
+ parser: astroParser,
723
+ parserOptions: {
724
+ parser: "@typescript-eslint/parser",
725
+ extraFileExtensions: [".astro"]
726
+ }
727
+ },
728
+ // @ts-expect-error 2322
729
+ rules: {
730
+ ...configs2.recommended.rules
731
+ }
732
+ }
733
+ ];
734
+
735
+ // src/configs/jsonc.ts
736
+ import jsoncPlugin, { configs as configs3 } from "eslint-plugin-jsonc";
737
+ import jsoncParser from "jsonc-eslint-parser";
738
+ var jsonc = [
739
+ {
740
+ files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC, "**/*rc"],
741
+ plugins: {
742
+ jsonc: jsoncPlugin
743
+ },
744
+ languageOptions: {
745
+ parser: jsoncParser
746
+ },
747
+ // @ts-expect-error 2322
748
+ rules: {
749
+ ...configs3["recommended-with-jsonc"].rules,
750
+ "jsonc/array-bracket-spacing": ["error", "never"],
751
+ "jsonc/comma-dangle": ["error", "never"],
752
+ "jsonc/comma-style": ["error", "last"],
753
+ "jsonc/indent": ["error", 2],
754
+ "jsonc/key-spacing": [
755
+ "error",
756
+ {
757
+ beforeColon: false,
758
+ afterColon: true
759
+ }
760
+ ],
761
+ "jsonc/no-octal-escape": "error",
762
+ "jsonc/object-curly-newline": [
763
+ "error",
764
+ {
765
+ multiline: true,
766
+ consistent: true
767
+ }
768
+ ],
769
+ "jsonc/object-curly-spacing": ["error", "always"],
770
+ "jsonc/object-property-newline": [
771
+ "error",
772
+ {
773
+ allowMultiplePropertiesPerLine: true
774
+ }
775
+ ]
776
+ }
777
+ }
778
+ ];
779
+ var pkgOrder = [
780
+ {
781
+ files: ["**/package.json"],
782
+ rules: {
783
+ "jsonc/sort-keys": [
784
+ "error",
785
+ {
786
+ pathPattern: "^$",
787
+ order: [
788
+ "publisher",
789
+ "name",
790
+ "displayName",
791
+ "type",
792
+ "version",
793
+ "private",
794
+ "packageManager",
795
+ "description",
796
+ "keywords",
797
+ "license",
798
+ "author",
799
+ "homepage",
800
+ "repository",
801
+ "funding",
802
+ "exports",
803
+ "main",
804
+ "module",
805
+ "unpkg",
806
+ "jsdelivr",
807
+ // workaround for `type: "module"` with TS `moduleResolution: "node16"`
808
+ "types",
809
+ "typesVersions",
810
+ "bin",
811
+ "icon",
812
+ "files",
813
+ "sideEffects",
814
+ "scripts",
815
+ "peerDependencies",
816
+ "peerDependenciesMeta",
817
+ "dependencies",
818
+ "optionalDependencies",
819
+ "devDependencies",
820
+ "activationEvents",
821
+ "contributes",
822
+ "categories",
823
+ "engines",
824
+ "pnpm",
825
+ "overrides",
826
+ "resolutions",
827
+ "husky",
828
+ "prettier",
829
+ "nano-staged",
830
+ "lint-staged",
831
+ "eslintConfig"
832
+ ]
833
+ },
834
+ {
835
+ pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies$",
836
+ order: { type: "asc" }
837
+ },
838
+ {
839
+ pathPattern: "^exports.*$",
840
+ order: ["types", "require", "import"]
841
+ },
842
+ {
843
+ pathPattern: "^scripts$",
844
+ order: { type: "asc" }
845
+ }
846
+ ]
847
+ }
848
+ }
849
+ ];
850
+
851
+ // src/configs/prettier.ts
852
+ import prettierPlugin from "eslint-plugin-prettier";
853
+ import prettierConfig from "eslint-config-prettier";
854
+ var prettier = [
855
+ {
856
+ plugins: {
857
+ prettier: prettierPlugin
858
+ },
859
+ rules: {
860
+ ...prettierConfig.rules,
861
+ ...prettierPlugin.configs.recommended.rules,
862
+ "prettier/prettier": "warn"
863
+ }
864
+ }
865
+ ];
866
+
867
+ // src/configs/markdown.ts
868
+ import markdownPlugin from "eslint-plugin-markdown";
869
+ import tsPlugin3 from "@typescript-eslint/eslint-plugin";
870
+ var markdown = [
871
+ {
872
+ files: [GLOB_MARKDOWN],
873
+ plugins: {
874
+ markdown: markdownPlugin
875
+ },
876
+ processor: "markdown/markdown"
877
+ },
878
+ {
879
+ files: [`${GLOB_MARKDOWN}/${GLOB_SRC}`, `${GLOB_MARKDOWN}/${GLOB_VUE}`],
880
+ languageOptions: {
881
+ parserOptions: {
882
+ ecmaFeatures: {
883
+ impliedStrict: true
884
+ }
885
+ }
886
+ },
887
+ plugins: {
888
+ "@typescript-eslint": tsPlugin3
889
+ },
890
+ rules: {
891
+ ...markdownPlugin.configs.recommended.overrides[1].rules,
892
+ "no-undef": "off",
893
+ "no-alert": "off",
894
+ "no-console": "off",
895
+ "no-unused-vars": "off",
896
+ "no-unused-expressions": "off",
897
+ "no-restricted-imports": "off",
898
+ "import/no-unresolved": "off",
899
+ "@typescript-eslint/comma-dangle": "off",
900
+ "@typescript-eslint/no-redeclare": "off",
901
+ "@typescript-eslint/no-unused-vars": "off",
902
+ "@typescript-eslint/no-var-requires": "off",
903
+ "@typescript-eslint/no-use-before-define": "off",
904
+ "unused-imports/no-unused-imports": "off",
905
+ "unused-imports/no-unused-vars": "off"
906
+ }
907
+ }
908
+ ];
909
+
910
+ // src/configs/eslint-comments.ts
911
+ import commentsPlugin from "eslint-plugin-eslint-comments";
912
+ var eslintComments = [
913
+ {
914
+ plugins: {
915
+ "eslint-comments": commentsPlugin
916
+ },
917
+ rules: {
918
+ ...commentsPlugin.configs.recommended.rules,
919
+ "eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }]
920
+ }
921
+ }
922
+ ];
923
+
924
+ // src/presets.ts
925
+ var GLOBAL_IGNORE = { ignores: GLOB_EXCLUDE };
926
+ var basic = [
927
+ GLOBAL_IGNORE,
928
+ ...js,
929
+ ...jsx,
930
+ ...ts,
931
+ ...yml,
932
+ ...imports,
933
+ ...unicorn,
934
+ ...jsonc,
935
+ ...pkgOrder,
936
+ ...eslintComments
937
+ ];
938
+ var all = [
939
+ ...basic,
940
+ ...vue,
941
+ ...react,
942
+ ...astro,
943
+ ...prettier,
944
+ ...markdown
945
+ ];
946
+ function ntnyq(config = [], {
947
+ vue: enableVue = false,
948
+ react: enableReact = false,
949
+ astro: enableAstro = false,
950
+ prettier: enablePrettier = false,
951
+ markdown: enableMarkdown = false
952
+ } = {}) {
953
+ const configs4 = [...basic];
954
+ if (enableVue) {
955
+ configs4.push(...vue);
956
+ }
957
+ if (enableReact) {
958
+ configs4.push(...react);
959
+ }
960
+ if (enableAstro) {
961
+ configs4.push(...astro);
962
+ }
963
+ if (enableMarkdown) {
964
+ configs4.push(...markdown);
965
+ }
966
+ if (enablePrettier) {
967
+ configs4.push(...prettier);
968
+ }
969
+ if (Object.keys(config).length > 0) {
970
+ configs4.push(...Array.isArray(config) ? config : [config]);
971
+ }
972
+ return configs4;
973
+ }
974
+ export {
975
+ GLOB_ALL_SRC,
976
+ GLOB_ASTRO,
977
+ GLOB_CSS,
978
+ GLOB_DIST,
979
+ GLOB_EXCLUDE,
980
+ GLOB_HTML,
981
+ GLOB_JS,
982
+ GLOB_JSON,
983
+ GLOB_JSON5,
984
+ GLOB_JSONC,
985
+ GLOB_JSX,
986
+ GLOB_LESS,
987
+ GLOB_LOCKFILE,
988
+ GLOB_MARKDOWN,
989
+ GLOB_NODE_MODULES,
990
+ GLOB_SCSS,
991
+ GLOB_SRC,
992
+ GLOB_SRC_EXT,
993
+ GLOB_STYLE,
994
+ GLOB_TS,
995
+ GLOB_TSX,
996
+ GLOB_VUE,
997
+ GLOB_YAML,
998
+ all,
999
+ astro,
1000
+ basic,
1001
+ eslintComments,
1002
+ getVueVersion,
1003
+ imports,
1004
+ js,
1005
+ jsonc,
1006
+ jsx,
1007
+ markdown,
1008
+ ntnyq,
1009
+ pkgOrder,
1010
+ prettier,
1011
+ react,
1012
+ reactHooksPlugin,
1013
+ reactPlugin,
1014
+ ts,
1015
+ tsParser,
1016
+ tsPlugin,
1017
+ unicorn,
1018
+ vue,
1019
+ vueParser,
1020
+ vuePlugin,
1021
+ yml
1022
+ };