@ntnyq/eslint-config 2.0.0-beta.5 → 2.0.0-beta.6

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